Permalink
Browse files

feat(all): switch prefix - "ai" => "ux"

  • Loading branch information...
StrahilKazlachev committed Mar 16, 2017
1 parent cdc72a0 commit 817be7ff16ebf447e30de79e691e489020800851
View
@@ -14,10 +14,10 @@ export function configure(
applyConfig();
}
-export * from './ai-dialog';
-export * from './ai-dialog-header';
-export * from './ai-dialog-body';
-export * from './ai-dialog-footer';
+export * from './ux-dialog';
+export * from './ux-dialog-header';
+export * from './ux-dialog-body';
+export * from './ux-dialog-footer';
export * from './attach-focus';
export * from './interfaces';
export * from './dialog-settings';
@@ -7,18 +7,18 @@ import { DOM } from 'aurelia-pal';
const defaultRenderer: RendererStatic = DialogRenderer;
const resources: { [key: string]: string } = {
- 'ai-dialog': './ai-dialog',
- 'ai-dialog-header': './ai-dialog-header',
- 'ai-dialog-body': './ai-dialog-body',
- 'ai-dialog-footer': './ai-dialog-footer',
+ 'ux-dialog': './ux-dialog',
+ 'ux-dialog-header': './ux-dialog-header',
+ 'ux-dialog-body': './ux-dialog-body',
+ 'ux-dialog-footer': './ux-dialog-footer',
'attach-focus': './attach-focus'
};
// tslint:disable-next-line:max-line-length
-export type DialogResourceName = 'ai-dialog' | 'ai-dialog-header' | 'ai-dialog-body' | 'ai-dialog-footer' | 'attach-focus';
+export type DialogResourceName = 'ux-dialog' | 'ux-dialog-header' | 'ux-dialog-body' | 'ux-dialog-footer' | 'attach-focus';
// tslint:disable-next-line:max-line-length
-const defaultCSSText = `ai-dialog-container,ai-dialog-overlay{position:fixed;top:0;right:0;bottom:0;left:0}ai-dialog-overlay{opacity:0}ai-dialog-overlay.active{opacity:1}ai-dialog-container{display:block;transition:opacity .2s linear;opacity:0;overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch}ai-dialog-container.active{opacity:1}ai-dialog-container>div{padding:30px}ai-dialog-container>div>div{display:block;min-width:300px;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;height:-moz-fit-content;height:-webkit-fit-content;height:fit-content;margin:auto}ai-dialog-container,ai-dialog-container>div,ai-dialog-container>div>div{outline:0}ai-dialog{display:table;box-shadow:0 5px 15px rgba(0,0,0,.5);border:1px solid rgba(0,0,0,.2);border-radius:5px;padding:3;min-width:300px;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;height:-moz-fit-content;height:-webkit-fit-content;height:fit-content;margin:auto;border-image-source:initial;border-image-slice:initial;border-image-width:initial;border-image-outset:initial;border-image-repeat:initial;background:#fff}ai-dialog>ai-dialog-header{display:block;padding:16px;border-bottom:1px solid #e5e5e5}ai-dialog>ai-dialog-header>button{float:right;border:none;display:block;width:32px;height:32px;background:0 0;font-size:22px;line-height:16px;margin:-14px -16px 0 0;padding:0;cursor:pointer}ai-dialog>ai-dialog-body{display:block;padding:16px}ai-dialog>ai-dialog-footer{display:block;padding:6px;border-top:1px solid #e5e5e5;text-align:right}ai-dialog>ai-dialog-footer button{color:#333;background-color:#fff;padding:6px 12px;font-size:14px;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;background-image:none;border:1px solid #ccc;border-radius:4px;margin:5px 0 5px 5px}ai-dialog>ai-dialog-footer button:disabled{cursor:default;opacity:.45}ai-dialog>ai-dialog-footer button:hover:enabled{color:#333;background-color:#e6e6e6;border-color:#adadad}.ai-dialog-open{overflow:hidden}`;
+const defaultCSSText = `ux-dialog-container,ux-dialog-overlay{position:fixed;top:0;right:0;bottom:0;left:0}ux-dialog-overlay{opacity:0}ux-dialog-overlay.active{opacity:1}ux-dialog-container{display:block;transition:opacity .2s linear;opacity:0;overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch}ux-dialog-container.active{opacity:1}ux-dialog-container>div{padding:30px}ux-dialog-container>div>div{display:block;min-width:300px;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;height:-moz-fit-content;height:-webkit-fit-content;height:fit-content;margin:auto}ux-dialog-container,ux-dialog-container>div,ux-dialog-container>div>div{outline:0}ux-dialog{display:table;box-shadow:0 5px 15px rgba(0,0,0,.5);border:1px solid rgba(0,0,0,.2);border-radius:5px;padding:3;min-width:300px;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;height:-moz-fit-content;height:-webkit-fit-content;height:fit-content;margin:auto;border-image-source:initial;border-image-slice:initial;border-image-width:initial;border-image-outset:initial;border-image-repeat:initial;background:#fff}ux-dialog>ux-dialog-header{display:block;padding:16px;border-bottom:1px solid #e5e5e5}ux-dialog>ux-dialog-header>button{float:right;border:none;display:block;width:32px;height:32px;background:0 0;font-size:22px;line-height:16px;margin:-14px -16px 0 0;padding:0;cursor:pointer}ux-dialog>ux-dialog-body{display:block;padding:16px}ux-dialog>ux-dialog-footer{display:block;padding:6px;border-top:1px solid #e5e5e5;text-align:right}ux-dialog>ux-dialog-footer button{color:#333;background-color:#fff;padding:6px 12px;font-size:14px;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;background-image:none;border:1px solid #ccc;border-radius:4px;margin:5px 0 5px 5px}ux-dialog>ux-dialog-footer button:disabled{cursor:default;opacity:.45}ux-dialog>ux-dialog-footer button:hover:enabled{color:#333;background-color:#e6e6e6;border-color:#adadad}.ux-dialog-open{overflow:hidden}`;
/**
* A configuration builder for the dialog plugin.
@@ -64,10 +64,10 @@ export class DialogConfiguration {
* @return This instance.
*/
public useStandardResources(): this {
- return this.useResource('ai-dialog')
- .useResource('ai-dialog-header')
- .useResource('ai-dialog-body')
- .useResource('ai-dialog-footer')
+ return this.useResource('ux-dialog')
+ .useResource('ux-dialog-header')
+ .useResource('ux-dialog-body')
+ .useResource('ux-dialog-footer')
.useResource('attach-focus');
}
View
@@ -4,8 +4,8 @@ import { ActionKey } from './dialog-settings';
import { Renderer } from './renderer';
import { DialogController } from './dialog-controller';
-const containerTagName = 'ai-dialog-container';
-const overlayTagName = 'ai-dialog-overlay';
+const containerTagName = 'ux-dialog-container';
+const overlayTagName = 'ux-dialog-overlay';
export const transitionEvent = (() => {
let transition: string | undefined;
@@ -119,15 +119,15 @@ export class DialogRenderer implements Renderer {
body.insertBefore(this.dialogOverlay, body.firstChild);
}
dialogController.controller.attached();
- body.classList.add('ai-dialog-open');
+ body.classList.add('ux-dialog-open');
}
private detach(dialogController: DialogController): void {
body.removeChild(this.dialogOverlay);
body.removeChild(this.dialogContainer);
dialogController.controller.detached();
if (!DialogRenderer.dialogControllers.length) {
- body.classList.remove('ai-dialog-open');
+ body.classList.remove('ux-dialog-open');
}
}
@@ -1,11 +1,11 @@
import { customElement, inlineView } from 'aurelia-templating';
-@customElement('ai-dialog-body')
+@customElement('ux-dialog-body')
@inlineView(`
<template>
<slot></slot>
</template>
`)
-export class AiDialogBody {
+export class UxDialogBody {
}
@@ -4,7 +4,7 @@ import { DialogController } from './dialog-controller';
/**
* View-model for footer of Dialog.
*/
-@customElement('ai-dialog-footer')
+@customElement('ux-dialog-footer')
@inlineView(`
<template>
<slot></slot>
@@ -19,7 +19,7 @@ import { DialogController } from './dialog-controller';
</template>
`)
-export class AiDialogFooter {
+export class UxDialogFooter {
public static isCancelButton(value: string) {
return value === 'Cancel';
}
@@ -34,7 +34,7 @@ export class AiDialogFooter {
constructor(public controller: DialogController) { }
public close(buttonValue: string) {
- if (AiDialogFooter.isCancelButton(buttonValue)) {
+ if (UxDialogFooter.isCancelButton(buttonValue)) {
this.controller.cancel(buttonValue);
} else {
this.controller.ok(buttonValue);
@@ -1,7 +1,7 @@
import { customElement, bindable, inlineView, ComponentBind } from 'aurelia-templating';
import { DialogController } from './dialog-controller';
-@customElement('ai-dialog-header')
+@customElement('ux-dialog-header')
@inlineView(`
<template>
<button
@@ -19,7 +19,7 @@ import { DialogController } from './dialog-controller';
</template>
`)
-export class AiDialogHeader implements ComponentBind {
+export class UxDialogHeader implements ComponentBind {
@bindable() public showCloseButton: boolean | undefined;
/**
@@ -1,11 +1,11 @@
import { customElement, inlineView } from 'aurelia-templating';
-@customElement('ai-dialog')
+@customElement('ux-dialog')
@inlineView(`
<template>
<slot></slot>
</template>
`)
-export class AiDialog {
+export class UxDialog {
}
@@ -53,7 +53,7 @@ describe('DialogConfiguration', () => {
describe('useResource', () => {
it('should call globalResources', () => {
spyOn(frameworkConfig, 'globalResources');
- configuration.useResource('ai-dialog');
+ configuration.useResource('ux-dialog');
applyConfig();
expect(frameworkConfig.globalResources).toHaveBeenCalled();
});
@@ -67,10 +67,10 @@ describe('DialogConfiguration', () => {
configuration.useDefaults();
applyConfig();
expect(configuration.useRenderer).toHaveBeenCalledWith(DialogRenderer);
- expect(configuration.useResource).toHaveBeenCalledWith('ai-dialog');
- expect(configuration.useResource).toHaveBeenCalledWith('ai-dialog-header');
- expect(configuration.useResource).toHaveBeenCalledWith('ai-dialog-footer');
- expect(configuration.useResource).toHaveBeenCalledWith('ai-dialog-body');
+ expect(configuration.useResource).toHaveBeenCalledWith('ux-dialog');
+ expect(configuration.useResource).toHaveBeenCalledWith('ux-dialog-header');
+ expect(configuration.useResource).toHaveBeenCalledWith('ux-dialog-footer');
+ expect(configuration.useResource).toHaveBeenCalledWith('ux-dialog-body');
expect(configuration.useResource).toHaveBeenCalledWith('attach-focus');
});
@@ -165,7 +165,7 @@ describe('DialogRenderer', () => {
expect(DialogRenderer.dialogControllers.length).toBe(0);
});
- it('adds "ai-dialog-open" class to the dialog host', async done => {
+ it('adds "ux-dialog-open" class to the dialog host', async done => {
spyOn(body.classList, 'add').and.callThrough();
const renderer = createRenderer();
await show(done, renderer);
@@ -199,7 +199,7 @@ describe('DialogRenderer', () => {
expect(DialogRenderer.dialogControllers.length).toBe(0);
});
- it('removes "ai-dialog-open" class from the dialog host', async done => {
+ it('removes "ux-dialog-open" class from the dialog host', async done => {
spyOn(body.classList, 'remove').and.callThrough();
await hide(done, ...renderers);
expect(body.classList.remove).toHaveBeenCalled();
@@ -228,7 +228,7 @@ describe('DialogRenderer', () => {
expect(DialogRenderer.dialogControllers.length).toBe(2);
});
- it('does not remove "ai-dialog-open" from the dialog host', async done => {
+ it('does not remove "ux-dialog-open" from the dialog host', async done => {
spyOn(body.classList, 'remove').and.callThrough();
await hide(done, renderer);
expect(body.classList.remove).not.toHaveBeenCalled();

0 comments on commit 817be7f

Please sign in to comment.