From 892016dc0c341789951bc5260e5abe00e8ef08fc Mon Sep 17 00:00:00 2001 From: Michael Malone Date: Thu, 20 Aug 2015 09:15:45 +1200 Subject: [PATCH 1/3] chore(update): update to work with the aurelia-framework 0.15.0 release --- config.js | 100 ++++++++++++++++++++++++++------------------------- package.json | 11 +++--- 2 files changed, 57 insertions(+), 54 deletions(-) diff --git a/config.js b/config.js index b0d3679..df4fbfc 100644 --- a/config.js +++ b/config.js @@ -1,84 +1,86 @@ System.config({ - "baseURL": "/", - "transpiler": "babel", - "babelOptions": { + baseURL: "/", + defaultJSExtensions: true, + transpiler: "babel", + babelOptions: { "optional": [ "es7.classProperties", "es7.decorators", "runtime" ] }, - "paths": { - "*": "*.js", - "github:*": "jspm_packages/github/*.js", - "npm:*": "jspm_packages/npm/*.js", - "dialog/*": "dist/commonjs/*.js" - } -}); + paths: { + "github:*": "jspm_packages/github/*", + "npm:*": "jspm_packages/npm/*", + "dialog/*": "dist/commonjs/*" + }, -System.config({ - "map": { - "aurelia-dependency-injection": "github:aurelia/dependency-injection@0.9.0", - "aurelia-framework": "github:aurelia/framework@0.13.3", - "aurelia-metadata": "github:aurelia/metadata@0.7.0", - "aurelia-templating": "github:aurelia/templating@0.13.11", - "babel": "npm:babel-core@5.7.4", - "babel-runtime": "npm:babel-runtime@5.7.0", - "core-js": "npm:core-js@0.9.18", - "github:aurelia/binding@0.8.2": { - "aurelia-dependency-injection": "github:aurelia/dependency-injection@0.9.0", - "aurelia-metadata": "github:aurelia/metadata@0.7.0", - "aurelia-task-queue": "github:aurelia/task-queue@0.6.0", + map: { + "aurelia-dependency-injection": "github:aurelia/dependency-injection@0.9.2", + "aurelia-framework": "github:aurelia/framework@0.15.0", + "aurelia-metadata": "github:aurelia/metadata@0.7.3", + "aurelia-templating": "github:aurelia/templating@0.14.4", + "babel": "npm:babel-core@5.8.22", + "babel-runtime": "npm:babel-runtime@5.8.20", + "core-js": "npm:core-js@1.1.0", + "github:aurelia/binding@0.8.6": { + "aurelia-dependency-injection": "github:aurelia/dependency-injection@0.9.2", + "aurelia-metadata": "github:aurelia/metadata@0.7.3", + "aurelia-task-queue": "github:aurelia/task-queue@0.6.2", "core-js": "npm:core-js@0.9.18" }, - "github:aurelia/dependency-injection@0.9.0": { - "aurelia-logging": "github:aurelia/logging@0.6.1", - "aurelia-metadata": "github:aurelia/metadata@0.7.0", + "github:aurelia/dependency-injection@0.9.2": { + "aurelia-logging": "github:aurelia/logging@0.6.4", + "aurelia-metadata": "github:aurelia/metadata@0.7.3", "core-js": "npm:core-js@0.9.18" }, - "github:aurelia/framework@0.13.3": { - "aurelia-binding": "github:aurelia/binding@0.8.2", - "aurelia-dependency-injection": "github:aurelia/dependency-injection@0.9.0", - "aurelia-loader": "github:aurelia/loader@0.8.2", - "aurelia-logging": "github:aurelia/logging@0.6.1", - "aurelia-metadata": "github:aurelia/metadata@0.7.0", - "aurelia-path": "github:aurelia/path@0.8.0", - "aurelia-task-queue": "github:aurelia/task-queue@0.6.0", - "aurelia-templating": "github:aurelia/templating@0.13.11", + "github:aurelia/framework@0.15.0": { + "aurelia-binding": "github:aurelia/binding@0.8.6", + "aurelia-dependency-injection": "github:aurelia/dependency-injection@0.9.2", + "aurelia-loader": "github:aurelia/loader@0.8.7", + "aurelia-logging": "github:aurelia/logging@0.6.4", + "aurelia-metadata": "github:aurelia/metadata@0.7.3", + "aurelia-path": "github:aurelia/path@0.8.1", + "aurelia-task-queue": "github:aurelia/task-queue@0.6.2", + "aurelia-templating": "github:aurelia/templating@0.14.4", "core-js": "npm:core-js@0.9.18" }, - "github:aurelia/loader@0.8.2": { + "github:aurelia/loader@0.8.7": { "aurelia-html-template-element": "github:aurelia/html-template-element@0.2.0", - "aurelia-metadata": "github:aurelia/metadata@0.7.0", - "aurelia-path": "github:aurelia/path@0.8.0", + "aurelia-metadata": "github:aurelia/metadata@0.7.3", + "aurelia-path": "github:aurelia/path@0.8.1", "core-js": "npm:core-js@0.9.18", "webcomponentsjs": "github:webcomponents/webcomponentsjs@0.6.3" }, - "github:aurelia/metadata@0.7.0": { + "github:aurelia/metadata@0.7.3": { "core-js": "npm:core-js@0.9.18" }, - "github:aurelia/templating@0.13.11": { - "aurelia-binding": "github:aurelia/binding@0.8.2", - "aurelia-dependency-injection": "github:aurelia/dependency-injection@0.9.0", + "github:aurelia/templating@0.14.4": { + "aurelia-binding": "github:aurelia/binding@0.8.6", + "aurelia-dependency-injection": "github:aurelia/dependency-injection@0.9.2", "aurelia-html-template-element": "github:aurelia/html-template-element@0.2.0", - "aurelia-loader": "github:aurelia/loader@0.8.2", - "aurelia-logging": "github:aurelia/logging@0.6.1", - "aurelia-metadata": "github:aurelia/metadata@0.7.0", - "aurelia-path": "github:aurelia/path@0.8.0", - "aurelia-task-queue": "github:aurelia/task-queue@0.6.0", + "aurelia-loader": "github:aurelia/loader@0.8.7", + "aurelia-logging": "github:aurelia/logging@0.6.4", + "aurelia-metadata": "github:aurelia/metadata@0.7.3", + "aurelia-path": "github:aurelia/path@0.8.1", + "aurelia-task-queue": "github:aurelia/task-queue@0.6.2", "core-js": "npm:core-js@0.9.18" }, "github:jspm/nodelibs-process@0.1.1": { "process": "npm:process@0.10.1" }, - "npm:babel-runtime@5.7.0": { + "npm:babel-runtime@5.8.20": { "process": "github:jspm/nodelibs-process@0.1.1" }, "npm:core-js@0.9.18": { "fs": "github:jspm/nodelibs-fs@0.1.2", "process": "github:jspm/nodelibs-process@0.1.1", "systemjs-json": "github:systemjs/plugin-json@0.1.0" + }, + "npm:core-js@1.1.0": { + "fs": "github:jspm/nodelibs-fs@0.1.2", + "process": "github:jspm/nodelibs-process@0.1.1", + "systemjs-json": "github:systemjs/plugin-json@0.1.0" } } }); - diff --git a/package.json b/package.json index 85fc859..4aa3af5 100644 --- a/package.json +++ b/package.json @@ -27,14 +27,14 @@ }, "dependencies": { "aurelia-dependency-injection": "github:aurelia/dependency-injection@^0.9.0", - "aurelia-framework": "github:aurelia/framework@^0.13.3", + "aurelia-framework": "github:aurelia/framework@^0.15.0", "aurelia-metadata": "github:aurelia/metadata@^0.7.0", - "aurelia-templating": "github:aurelia/templating@^0.13.5" + "aurelia-templating": "github:aurelia/templating@^0.14.4" }, "devDependencies": { - "babel": "npm:babel-core@^5.1.13", - "babel-runtime": "npm:babel-runtime@^5.1.13", - "core-js": "npm:core-js@^0.8.1", + "babel": "npm:babel-core@^5.8.22", + "babel-runtime": "npm:babel-runtime@^5.8.20", + "core-js": "npm:core-js@^1.1.0", "traceur": "github:jmcriffey/bower-traceur@0.0.87", "traceur-runtime": "github:jmcriffey/bower-traceur-runtime@0.0.87" } @@ -58,6 +58,7 @@ "gulp-yuidoc": "^0.1.2", "jasmine-core": "^2.1.3", "jshint-stylish": "^1.0.0", + "jspm": "^0.16.0", "karma": "^0.12.28", "karma-babel-preprocessor": "^5.2.1", "karma-chrome-launcher": "^0.1.7", From 33b58ee09ee3318668d0915d1035f85b74dac61f Mon Sep 17 00:00:00 2001 From: pwkad Date: Mon, 24 Aug 2015 17:58:05 -0500 Subject: [PATCH 2/3] chore(eslint): update eslint, clean up issues Cleans to match aurelia-tools eslint files. --- .eslintrc | 3 ++ build/tasks/lint.js | 8 ++-- doc/CHANGELOG.md | 3 ++ doc/api.json | 1 + src/attach-focus.js | 4 +- src/dialog-controller.js | 16 ++++---- src/dialog-footer.js | 14 +++---- src/dialog-header.js | 2 +- src/dialog-renderer.js | 75 +++++++++++++++++----------------- src/dialog-service.js | 42 +++++++++---------- src/examples/common-dialogs.js | 8 ++-- src/examples/prompt.js | 4 +- src/lifecycle.js | 10 ++--- 13 files changed, 98 insertions(+), 92 deletions(-) create mode 100644 .eslintrc create mode 100644 doc/CHANGELOG.md create mode 100644 doc/api.json diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..c11e5df --- /dev/null +++ b/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/aurelia-tools/.eslintrc" +} \ No newline at end of file diff --git a/build/tasks/lint.js b/build/tasks/lint.js index d10253f..b690fa4 100644 --- a/build/tasks/lint.js +++ b/build/tasks/lint.js @@ -1,10 +1,10 @@ var gulp = require('gulp'); var paths = require('../paths'); -var jshint = require('gulp-jshint'); -var stylish = require('jshint-stylish'); +var eslint = require('gulp-eslint'); gulp.task('lint', function() { return gulp.src(paths.source) - .pipe(jshint()) - .pipe(jshint.reporter(stylish)); + .pipe(eslint()) + .pipe(eslint.format()) + .pipe(eslint.failOnError()); }); diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md new file mode 100644 index 0000000..155bc82 --- /dev/null +++ b/doc/CHANGELOG.md @@ -0,0 +1,3 @@ +### 0.1.1 (2015-08-24) + + diff --git a/doc/api.json b/doc/api.json new file mode 100644 index 0000000..6de3c0a --- /dev/null +++ b/doc/api.json @@ -0,0 +1 @@ +{"classes":[],"methods":[],"properties":[],"events":[]} \ No newline at end of file diff --git a/src/attach-focus.js b/src/attach-focus.js index 1e56081..359a3ae 100644 --- a/src/attach-focus.js +++ b/src/attach-focus.js @@ -4,11 +4,11 @@ import {customAttribute} from 'aurelia-templating'; export class AttachFocus { static inject = [Element]; - constructor(element){ + constructor(element) { this.element = element; } - attached(){ + attached() { this.element.focus(); } } diff --git a/src/dialog-controller.js b/src/dialog-controller.js index 97bc8c3..4eb78b9 100644 --- a/src/dialog-controller.js +++ b/src/dialog-controller.js @@ -1,22 +1,22 @@ import {invokeLifecycle} from './lifecycle'; export class DialogController { - constructor(renderer, settings, resolve, reject){ + constructor(renderer, settings, resolve, reject) { this._renderer = renderer; this.settings = settings; this._resolve = resolve; this._reject = reject; } - ok(result){ + ok(result) { this.close(true, result); } - cancel(result){ + cancel(result) { this.close(false, result); } - error(message){ + error(message) { return invokeLifecycle(this.viewModel, 'deactivate').then(() => { return this._renderer.hideDialog(this).then(() => { return this._renderer.destroyDialogHost(this).then(() => { @@ -27,14 +27,14 @@ export class DialogController { }); } - close(ok, result){ - return invokeLifecycle(this.viewModel, 'canDeactivate').then(canDeactivate =>{ - if(canDeactivate){ + close(ok, result) { + return invokeLifecycle(this.viewModel, 'canDeactivate').then(canDeactivate => { + if (canDeactivate) { return invokeLifecycle(this.viewModel, 'deactivate').then(() => { return this._renderer.hideDialog(this).then(() => { return this._renderer.destroyDialogHost(this).then(() => { this.behavior.unbind(); - if(ok){ + if (ok) { this._resolve(result); } }); diff --git a/src/dialog-footer.js b/src/dialog-footer.js index 8d2e93c..15b0eeb 100644 --- a/src/dialog-footer.js +++ b/src/dialog-footer.js @@ -8,25 +8,25 @@ export class DialogFooter { @bindable buttons = []; @bindable useDefaultButtons = false; - constructor(controller){ + constructor(controller) { this.controller = controller; } - close(buttonValue){ - if(DialogFooter.isCancelButton(buttonValue)){ + close(buttonValue) { + if (DialogFooter.isCancelButton(buttonValue)) { this.controller.cancel(buttonValue); - }else{ + } else { this.controller.ok(buttonValue); } } - useDefaultButtonsChanged(newValue){ - if(newValue){ + useDefaultButtonsChanged(newValue) { + if (newValue) { this.buttons = ['Cancel', 'Ok']; } } - static isCancelButton(value){ + static isCancelButton(value) { return value === 'Cancel'; } } diff --git a/src/dialog-header.js b/src/dialog-header.js index ac3c928..c26f492 100644 --- a/src/dialog-header.js +++ b/src/dialog-header.js @@ -5,7 +5,7 @@ import {DialogController} from './dialog-controller'; export class DialogHeader { static inject = [DialogController]; - constructor(controller){ + constructor(controller) { this.controller = controller; } } diff --git a/src/dialog-renderer.js b/src/dialog-renderer.js index 0433bff..0f8bbfc 100644 --- a/src/dialog-renderer.js +++ b/src/dialog-renderer.js @@ -1,52 +1,51 @@ -import {ViewSlot} from 'aurelia-templating' +import {ViewSlot} from 'aurelia-templating'; let currentZIndex = 1000; -let transitionEvent = (function(){ - var t, - el = document.createElement("fakeelement"); - - var transitions = { - "transition" : "transitionend", - "OTransition" : "oTransitionEnd", - "MozTransition" : "transitionend", - "WebkitTransition": "webkitTransitionEnd" - } +let transitionEvent = (function() { + let t; + let el = document.createElement('fakeelement'); + + let transitions = { + 'transition': 'transitionend', + 'OTransition': 'oTransitionEnd', + 'MozTransition': 'transitionend', + 'WebkitTransition': 'webkitTransitionEnd' + }; - for (t in transitions){ - if (el.style[t] !== undefined){ + for (t in transitions) { + if (el.style[t] !== undefined) { return transitions[t]; } } })(); -function getNextZIndex(){ +function getNextZIndex() { return ++currentZIndex; } export class DialogRenderer { defaultSettings = { lock: true, - centerHorizontalOnly: false, + centerHorizontalOnly: false }; - constructor(){ + constructor() { this.dialogControllers = []; document.addEventListener('keyup', e => { - if (e.keyCode === 27){ - var top = this.dialogControllers[this.dialogControllers.length-1]; - if(top && top.settings.lock !== true){ + if (e.keyCode === 27) { + let top = this.dialogControllers[this.dialogControllers.length - 1]; + if (top && top.settings.lock !== true) { top.cancel(); } } }); } - createDialogHost(controller){ - var settings = controller.settings, - emptyParameters = {}, - modalOverlay = document.createElement('dialog-overlay'), - modalContainer = document.createElement('dialog-container'); + createDialogHost(controller) { + let settings = controller.settings; + let modalOverlay = document.createElement('dialog-overlay'); + let modalContainer = document.createElement('dialog-container'); modalOverlay.style.zIndex = getNextZIndex(); modalContainer.style.zIndex = getNextZIndex(); @@ -71,13 +70,13 @@ export class DialogRenderer { } }; - return new Promise((resolve, reject) => { + return new Promise((resolve) => { modalContainer.addEventListener(transitionEvent, onTransitionEnd); - function onTransitionEnd(event) { + function onTransitionEnd() { modalContainer.removeEventListener(transitionEvent, onTransitionEnd); resolve(); - }; + } modalOverlay.classList.add('active'); modalContainer.classList.add('active'); @@ -86,17 +85,17 @@ export class DialogRenderer { controller.hideDialog = () => { let i = this.dialogControllers.indexOf(controller); - if(i !== -1) { + if (i !== -1) { this.dialogControllers.splice(i, 1); } - return new Promise((resolve, reject) => { + return new Promise((resolve) => { modalContainer.addEventListener(transitionEvent, onTransitionEnd); - function onTransitionEnd(event) { + function onTransitionEnd() { modalContainer.removeEventListener(transitionEvent, onTransitionEnd); resolve(); - }; + } modalOverlay.classList.remove('active'); modalContainer.classList.remove('active'); @@ -111,27 +110,27 @@ export class DialogRenderer { }; controller.centerDialog = () => { - var child = modalContainer.children[0]; + let child = modalContainer.children[0]; - child.style.marginLeft = -(child.offsetWidth/2) + 'px'; + child.style.marginLeft = -(child.offsetWidth / 2) + 'px'; - if(!settings.centerHorizontalOnly){ - child.style.marginTop = -(child.offsetHeight/2) + 'px'; + if (!settings.centerHorizontalOnly) { + child.style.marginTop = -(child.offsetHeight / 2) + 'px'; } }; return Promise.resolve(); } - showDialog(controller){ + showDialog(controller) { return controller.showDialog(); } - hideDialog(controller){ + hideDialog(controller) { return controller.hideDialog(); } - destroyDialogHost(controller){ + destroyDialogHost(controller) { return controller.destroyDialogHost(); } } diff --git a/src/dialog-service.js b/src/dialog-service.js index 887582d..7a1ae7b 100644 --- a/src/dialog-service.js +++ b/src/dialog-service.js @@ -8,45 +8,45 @@ import {invokeLifecycle} from './lifecycle'; export class DialogService { static inject = [Container, CompositionEngine, DialogRenderer]; - constructor(container, compositionEngine, renderer){ + constructor(container, compositionEngine, renderer) { this.container = container; this.compositionEngine = compositionEngine; this.renderer = renderer; } - _getViewModel(instruction){ - if(typeof instruction.viewModel === 'function'){ + _getViewModel(instruction) { + if (typeof instruction.viewModel === 'function') { instruction.viewModel = Origin.get(instruction.viewModel).moduleId; } - if(typeof instruction.viewModel === 'string'){ + if (typeof instruction.viewModel === 'string') { return this.compositionEngine.createViewModel(instruction); - }else{ - return Promise.resolve(instruction); } + + return Promise.resolve(instruction); } - open(settings){ - settings = Object.assign({}, this.renderer.defaultSettings, settings); + open(settings) { + let _settings = Object.assign({}, this.renderer.defaultSettings, settings); return new Promise((resolve, reject) => { - var childContainer = this.container.createChild(), - controller = new DialogController(this.renderer, settings, resolve, reject), - instruction = { - viewModel:settings.viewModel, - container:this.container, - childContainer:childContainer, - model:settings.model - }; + let childContainer = this.container.createChild(); + let controller = new DialogController(this.renderer, _settings, resolve, reject); + let instruction = { + viewModel: _settings.viewModel, + container: this.container, + childContainer: childContainer, + model: _settings.model + }; childContainer.registerInstance(DialogController, controller); - return this._getViewModel(instruction).then(instruction => { - controller.viewModel = instruction.viewModel; + return this._getViewModel(instruction).then(returnedInstruction => { + controller.viewModel = returnedInstruction.viewModel; - return invokeLifecycle(instruction.viewModel, 'canActivate', settings.model).then(canActivate => { - if(canActivate){ - return this.compositionEngine.createBehavior(instruction).then(behavior => { + return invokeLifecycle(returnedInstruction.viewModel, 'canActivate', _settings.model).then(canActivate => { + if (canActivate) { + return this.compositionEngine.createBehavior(returnedInstruction).then(behavior => { controller.behavior = behavior; controller.view = behavior.view; behavior.view.bind(behavior.executionContext); diff --git a/src/examples/common-dialogs.js b/src/examples/common-dialogs.js index 824db0d..6fd08ac 100644 --- a/src/examples/common-dialogs.js +++ b/src/examples/common-dialogs.js @@ -4,11 +4,11 @@ import {DialogService} from '../dialog-service'; export class CommonDialogs { static inject = [DialogService]; - constructor(dialogService){ + constructor(dialogService) { this.dialogService = dialogService; } - prompt(question){ - return this.dialogService.open({viewModel:Prompt, model:question}); - }; + prompt(question) { + return this.dialogService.open({viewModel: Prompt, model: question}); + } } diff --git a/src/examples/prompt.js b/src/examples/prompt.js index 1b300b7..d9ba849 100644 --- a/src/examples/prompt.js +++ b/src/examples/prompt.js @@ -3,14 +3,14 @@ import {DialogController} from '../dialog-controller'; export class Prompt { static inject = [DialogController]; - constructor(controller){ + constructor(controller) { this.controller = controller; this.answer = null; controller.settings.lock = false; } - activate(question){ + activate(question) { this.question = question; } } diff --git a/src/lifecycle.js b/src/lifecycle.js index 4dcaf59..bae6744 100644 --- a/src/lifecycle.js +++ b/src/lifecycle.js @@ -1,12 +1,12 @@ -export function invokeLifecycle(instance, name, model){ - if(typeof instance[name] === 'function'){ - var result = instance[name](model); +export function invokeLifecycle(instance, name, model) { + if (typeof instance[name] === 'function') { + let result = instance[name](model); - if(result instanceof Promise){ + if (result instanceof Promise) { return result; } - if(result !== null && result !== undefined){ + if (result !== null && result !== undefined) { return Promise.resolve(result); } From ad6ad07eab9abfee7e697474631fdcf9dc0ea626 Mon Sep 17 00:00:00 2001 From: pwkad Date: Mon, 24 Aug 2015 18:00:50 -0500 Subject: [PATCH 3/3] chore(release): prepare release tag 0.1.1 Releases version 0.1.1 with minor code-style fixes and updates. --- bower.json | 2 +- dist/amd/dialog-renderer.js | 43 ++++++++--------- dist/amd/dialog-service.js | 24 ++++----- dist/commonjs/dialog-renderer.js | 41 ++++++++-------- dist/commonjs/dialog-service.js | 24 ++++----- dist/es6/attach-focus.js | 4 +- dist/es6/dialog-controller.js | 16 +++--- dist/es6/dialog-footer.js | 14 +++--- dist/es6/dialog-header.js | 2 +- dist/es6/dialog-renderer.js | 75 ++++++++++++++--------------- dist/es6/dialog-service.js | 42 ++++++++-------- dist/es6/examples/common-dialogs.js | 8 +-- dist/es6/examples/prompt.js | 4 +- dist/es6/lifecycle.js | 10 ++-- dist/system/dialog-renderer.js | 45 +++++++++-------- dist/system/dialog-service.js | 24 ++++----- doc/CHANGELOG.md | 3 ++ karma.conf.js | 3 +- package.json | 2 +- 19 files changed, 192 insertions(+), 194 deletions(-) diff --git a/bower.json b/bower.json index e741d05..b40cf42 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "aurelia-dialog", - "version": "0.1.0", + "version": "0.1.1", "description": "A dialog plugin for Aurelia.", "keywords": [ "aurelia", diff --git a/dist/amd/dialog-renderer.js b/dist/amd/dialog-renderer.js index cc6635e..4c83b2f 100644 --- a/dist/amd/dialog-renderer.js +++ b/dist/amd/dialog-renderer.js @@ -1,20 +1,20 @@ -define(["exports", "aurelia-templating"], function (exports, _aureliaTemplating) { - "use strict"; +define(['exports', 'aurelia-templating'], function (exports, _aureliaTemplating) { + 'use strict'; exports.__esModule = true; - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } var currentZIndex = 1000; var transitionEvent = (function () { - var t, - el = document.createElement("fakeelement"); + var t = undefined; + var el = document.createElement('fakeelement'); var transitions = { - "transition": "transitionend", - "OTransition": "oTransitionEnd", - "MozTransition": "transitionend", - "WebkitTransition": "webkitTransitionEnd" + 'transition': 'transitionend', + 'OTransition': 'oTransitionEnd', + 'MozTransition': 'transitionend', + 'WebkitTransition': 'webkitTransitionEnd' }; for (t in transitions) { @@ -43,9 +43,9 @@ define(["exports", "aurelia-templating"], function (exports, _aureliaTemplating) document.addEventListener('keyup', function (e) { if (e.keyCode === 27) { - var top = _this.dialogControllers[_this.dialogControllers.length - 1]; - if (top && top.settings.lock !== true) { - top.cancel(); + var _top = _this.dialogControllers[_this.dialogControllers.length - 1]; + if (_top && _top.settings.lock !== true) { + _top.cancel(); } } }); @@ -54,10 +54,9 @@ define(["exports", "aurelia-templating"], function (exports, _aureliaTemplating) DialogRenderer.prototype.createDialogHost = function createDialogHost(controller) { var _this2 = this; - var settings = controller.settings, - emptyParameters = {}, - modalOverlay = document.createElement('dialog-overlay'), - modalContainer = document.createElement('dialog-container'); + var settings = controller.settings; + var modalOverlay = document.createElement('dialog-overlay'); + var modalContainer = document.createElement('dialog-container'); modalOverlay.style.zIndex = getNextZIndex(); modalContainer.style.zIndex = getNextZIndex(); @@ -82,13 +81,13 @@ define(["exports", "aurelia-templating"], function (exports, _aureliaTemplating) } }; - return new Promise(function (resolve, reject) { + return new Promise(function (resolve) { modalContainer.addEventListener(transitionEvent, onTransitionEnd); - function onTransitionEnd(event) { + function onTransitionEnd() { modalContainer.removeEventListener(transitionEvent, onTransitionEnd); resolve(); - }; + } modalOverlay.classList.add('active'); modalContainer.classList.add('active'); @@ -101,13 +100,13 @@ define(["exports", "aurelia-templating"], function (exports, _aureliaTemplating) _this2.dialogControllers.splice(i, 1); } - return new Promise(function (resolve, reject) { + return new Promise(function (resolve) { modalContainer.addEventListener(transitionEvent, onTransitionEnd); - function onTransitionEnd(event) { + function onTransitionEnd() { modalContainer.removeEventListener(transitionEvent, onTransitionEnd); resolve(); - }; + } modalOverlay.classList.remove('active'); modalContainer.classList.remove('active'); diff --git a/dist/amd/dialog-service.js b/dist/amd/dialog-service.js index ef00daf..9500dd6 100644 --- a/dist/amd/dialog-service.js +++ b/dist/amd/dialog-service.js @@ -29,34 +29,34 @@ define(['exports', 'aurelia-metadata', 'aurelia-dependency-injection', 'aurelia- if (typeof instruction.viewModel === 'string') { return this.compositionEngine.createViewModel(instruction); - } else { - return Promise.resolve(instruction); } + + return Promise.resolve(instruction); }; DialogService.prototype.open = function open(settings) { var _this = this; - settings = Object.assign({}, this.renderer.defaultSettings, settings); + var _settings = Object.assign({}, this.renderer.defaultSettings, settings); return new Promise(function (resolve, reject) { - var childContainer = _this.container.createChild(), - controller = new _dialogController.DialogController(_this.renderer, settings, resolve, reject), - instruction = { - viewModel: settings.viewModel, + var childContainer = _this.container.createChild(); + var controller = new _dialogController.DialogController(_this.renderer, _settings, resolve, reject); + var instruction = { + viewModel: _settings.viewModel, container: _this.container, childContainer: childContainer, - model: settings.model + model: _settings.model }; childContainer.registerInstance(_dialogController.DialogController, controller); - return _this._getViewModel(instruction).then(function (instruction) { - controller.viewModel = instruction.viewModel; + return _this._getViewModel(instruction).then(function (returnedInstruction) { + controller.viewModel = returnedInstruction.viewModel; - return _lifecycle.invokeLifecycle(instruction.viewModel, 'canActivate', settings.model).then(function (canActivate) { + return _lifecycle.invokeLifecycle(returnedInstruction.viewModel, 'canActivate', _settings.model).then(function (canActivate) { if (canActivate) { - return _this.compositionEngine.createBehavior(instruction).then(function (behavior) { + return _this.compositionEngine.createBehavior(returnedInstruction).then(function (behavior) { controller.behavior = behavior; controller.view = behavior.view; behavior.view.bind(behavior.executionContext); diff --git a/dist/commonjs/dialog-renderer.js b/dist/commonjs/dialog-renderer.js index 7248fb2..5b6820a 100644 --- a/dist/commonjs/dialog-renderer.js +++ b/dist/commonjs/dialog-renderer.js @@ -1,21 +1,21 @@ -"use strict"; +'use strict'; exports.__esModule = true; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } var _aureliaTemplating = require('aurelia-templating'); var currentZIndex = 1000; var transitionEvent = (function () { - var t, - el = document.createElement("fakeelement"); + var t = undefined; + var el = document.createElement('fakeelement'); var transitions = { - "transition": "transitionend", - "OTransition": "oTransitionEnd", - "MozTransition": "transitionend", - "WebkitTransition": "webkitTransitionEnd" + 'transition': 'transitionend', + 'OTransition': 'oTransitionEnd', + 'MozTransition': 'transitionend', + 'WebkitTransition': 'webkitTransitionEnd' }; for (t in transitions) { @@ -44,9 +44,9 @@ var DialogRenderer = (function () { document.addEventListener('keyup', function (e) { if (e.keyCode === 27) { - var top = _this.dialogControllers[_this.dialogControllers.length - 1]; - if (top && top.settings.lock !== true) { - top.cancel(); + var _top = _this.dialogControllers[_this.dialogControllers.length - 1]; + if (_top && _top.settings.lock !== true) { + _top.cancel(); } } }); @@ -55,10 +55,9 @@ var DialogRenderer = (function () { DialogRenderer.prototype.createDialogHost = function createDialogHost(controller) { var _this2 = this; - var settings = controller.settings, - emptyParameters = {}, - modalOverlay = document.createElement('dialog-overlay'), - modalContainer = document.createElement('dialog-container'); + var settings = controller.settings; + var modalOverlay = document.createElement('dialog-overlay'); + var modalContainer = document.createElement('dialog-container'); modalOverlay.style.zIndex = getNextZIndex(); modalContainer.style.zIndex = getNextZIndex(); @@ -83,13 +82,13 @@ var DialogRenderer = (function () { } }; - return new Promise(function (resolve, reject) { + return new Promise(function (resolve) { modalContainer.addEventListener(transitionEvent, onTransitionEnd); - function onTransitionEnd(event) { + function onTransitionEnd() { modalContainer.removeEventListener(transitionEvent, onTransitionEnd); resolve(); - }; + } modalOverlay.classList.add('active'); modalContainer.classList.add('active'); @@ -102,13 +101,13 @@ var DialogRenderer = (function () { _this2.dialogControllers.splice(i, 1); } - return new Promise(function (resolve, reject) { + return new Promise(function (resolve) { modalContainer.addEventListener(transitionEvent, onTransitionEnd); - function onTransitionEnd(event) { + function onTransitionEnd() { modalContainer.removeEventListener(transitionEvent, onTransitionEnd); resolve(); - }; + } modalOverlay.classList.remove('active'); modalContainer.classList.remove('active'); diff --git a/dist/commonjs/dialog-service.js b/dist/commonjs/dialog-service.js index 4c4a099..ad2b03b 100644 --- a/dist/commonjs/dialog-service.js +++ b/dist/commonjs/dialog-service.js @@ -40,34 +40,34 @@ var DialogService = (function () { if (typeof instruction.viewModel === 'string') { return this.compositionEngine.createViewModel(instruction); - } else { - return Promise.resolve(instruction); } + + return Promise.resolve(instruction); }; DialogService.prototype.open = function open(settings) { var _this = this; - settings = Object.assign({}, this.renderer.defaultSettings, settings); + var _settings = Object.assign({}, this.renderer.defaultSettings, settings); return new Promise(function (resolve, reject) { - var childContainer = _this.container.createChild(), - controller = new _dialogController.DialogController(_this.renderer, settings, resolve, reject), - instruction = { - viewModel: settings.viewModel, + var childContainer = _this.container.createChild(); + var controller = new _dialogController.DialogController(_this.renderer, _settings, resolve, reject); + var instruction = { + viewModel: _settings.viewModel, container: _this.container, childContainer: childContainer, - model: settings.model + model: _settings.model }; childContainer.registerInstance(_dialogController.DialogController, controller); - return _this._getViewModel(instruction).then(function (instruction) { - controller.viewModel = instruction.viewModel; + return _this._getViewModel(instruction).then(function (returnedInstruction) { + controller.viewModel = returnedInstruction.viewModel; - return _lifecycle.invokeLifecycle(instruction.viewModel, 'canActivate', settings.model).then(function (canActivate) { + return _lifecycle.invokeLifecycle(returnedInstruction.viewModel, 'canActivate', _settings.model).then(function (canActivate) { if (canActivate) { - return _this.compositionEngine.createBehavior(instruction).then(function (behavior) { + return _this.compositionEngine.createBehavior(returnedInstruction).then(function (behavior) { controller.behavior = behavior; controller.view = behavior.view; behavior.view.bind(behavior.executionContext); diff --git a/dist/es6/attach-focus.js b/dist/es6/attach-focus.js index 1e56081..359a3ae 100644 --- a/dist/es6/attach-focus.js +++ b/dist/es6/attach-focus.js @@ -4,11 +4,11 @@ import {customAttribute} from 'aurelia-templating'; export class AttachFocus { static inject = [Element]; - constructor(element){ + constructor(element) { this.element = element; } - attached(){ + attached() { this.element.focus(); } } diff --git a/dist/es6/dialog-controller.js b/dist/es6/dialog-controller.js index 97bc8c3..4eb78b9 100644 --- a/dist/es6/dialog-controller.js +++ b/dist/es6/dialog-controller.js @@ -1,22 +1,22 @@ import {invokeLifecycle} from './lifecycle'; export class DialogController { - constructor(renderer, settings, resolve, reject){ + constructor(renderer, settings, resolve, reject) { this._renderer = renderer; this.settings = settings; this._resolve = resolve; this._reject = reject; } - ok(result){ + ok(result) { this.close(true, result); } - cancel(result){ + cancel(result) { this.close(false, result); } - error(message){ + error(message) { return invokeLifecycle(this.viewModel, 'deactivate').then(() => { return this._renderer.hideDialog(this).then(() => { return this._renderer.destroyDialogHost(this).then(() => { @@ -27,14 +27,14 @@ export class DialogController { }); } - close(ok, result){ - return invokeLifecycle(this.viewModel, 'canDeactivate').then(canDeactivate =>{ - if(canDeactivate){ + close(ok, result) { + return invokeLifecycle(this.viewModel, 'canDeactivate').then(canDeactivate => { + if (canDeactivate) { return invokeLifecycle(this.viewModel, 'deactivate').then(() => { return this._renderer.hideDialog(this).then(() => { return this._renderer.destroyDialogHost(this).then(() => { this.behavior.unbind(); - if(ok){ + if (ok) { this._resolve(result); } }); diff --git a/dist/es6/dialog-footer.js b/dist/es6/dialog-footer.js index 8d2e93c..15b0eeb 100644 --- a/dist/es6/dialog-footer.js +++ b/dist/es6/dialog-footer.js @@ -8,25 +8,25 @@ export class DialogFooter { @bindable buttons = []; @bindable useDefaultButtons = false; - constructor(controller){ + constructor(controller) { this.controller = controller; } - close(buttonValue){ - if(DialogFooter.isCancelButton(buttonValue)){ + close(buttonValue) { + if (DialogFooter.isCancelButton(buttonValue)) { this.controller.cancel(buttonValue); - }else{ + } else { this.controller.ok(buttonValue); } } - useDefaultButtonsChanged(newValue){ - if(newValue){ + useDefaultButtonsChanged(newValue) { + if (newValue) { this.buttons = ['Cancel', 'Ok']; } } - static isCancelButton(value){ + static isCancelButton(value) { return value === 'Cancel'; } } diff --git a/dist/es6/dialog-header.js b/dist/es6/dialog-header.js index ac3c928..c26f492 100644 --- a/dist/es6/dialog-header.js +++ b/dist/es6/dialog-header.js @@ -5,7 +5,7 @@ import {DialogController} from './dialog-controller'; export class DialogHeader { static inject = [DialogController]; - constructor(controller){ + constructor(controller) { this.controller = controller; } } diff --git a/dist/es6/dialog-renderer.js b/dist/es6/dialog-renderer.js index 0433bff..0f8bbfc 100644 --- a/dist/es6/dialog-renderer.js +++ b/dist/es6/dialog-renderer.js @@ -1,52 +1,51 @@ -import {ViewSlot} from 'aurelia-templating' +import {ViewSlot} from 'aurelia-templating'; let currentZIndex = 1000; -let transitionEvent = (function(){ - var t, - el = document.createElement("fakeelement"); - - var transitions = { - "transition" : "transitionend", - "OTransition" : "oTransitionEnd", - "MozTransition" : "transitionend", - "WebkitTransition": "webkitTransitionEnd" - } +let transitionEvent = (function() { + let t; + let el = document.createElement('fakeelement'); + + let transitions = { + 'transition': 'transitionend', + 'OTransition': 'oTransitionEnd', + 'MozTransition': 'transitionend', + 'WebkitTransition': 'webkitTransitionEnd' + }; - for (t in transitions){ - if (el.style[t] !== undefined){ + for (t in transitions) { + if (el.style[t] !== undefined) { return transitions[t]; } } })(); -function getNextZIndex(){ +function getNextZIndex() { return ++currentZIndex; } export class DialogRenderer { defaultSettings = { lock: true, - centerHorizontalOnly: false, + centerHorizontalOnly: false }; - constructor(){ + constructor() { this.dialogControllers = []; document.addEventListener('keyup', e => { - if (e.keyCode === 27){ - var top = this.dialogControllers[this.dialogControllers.length-1]; - if(top && top.settings.lock !== true){ + if (e.keyCode === 27) { + let top = this.dialogControllers[this.dialogControllers.length - 1]; + if (top && top.settings.lock !== true) { top.cancel(); } } }); } - createDialogHost(controller){ - var settings = controller.settings, - emptyParameters = {}, - modalOverlay = document.createElement('dialog-overlay'), - modalContainer = document.createElement('dialog-container'); + createDialogHost(controller) { + let settings = controller.settings; + let modalOverlay = document.createElement('dialog-overlay'); + let modalContainer = document.createElement('dialog-container'); modalOverlay.style.zIndex = getNextZIndex(); modalContainer.style.zIndex = getNextZIndex(); @@ -71,13 +70,13 @@ export class DialogRenderer { } }; - return new Promise((resolve, reject) => { + return new Promise((resolve) => { modalContainer.addEventListener(transitionEvent, onTransitionEnd); - function onTransitionEnd(event) { + function onTransitionEnd() { modalContainer.removeEventListener(transitionEvent, onTransitionEnd); resolve(); - }; + } modalOverlay.classList.add('active'); modalContainer.classList.add('active'); @@ -86,17 +85,17 @@ export class DialogRenderer { controller.hideDialog = () => { let i = this.dialogControllers.indexOf(controller); - if(i !== -1) { + if (i !== -1) { this.dialogControllers.splice(i, 1); } - return new Promise((resolve, reject) => { + return new Promise((resolve) => { modalContainer.addEventListener(transitionEvent, onTransitionEnd); - function onTransitionEnd(event) { + function onTransitionEnd() { modalContainer.removeEventListener(transitionEvent, onTransitionEnd); resolve(); - }; + } modalOverlay.classList.remove('active'); modalContainer.classList.remove('active'); @@ -111,27 +110,27 @@ export class DialogRenderer { }; controller.centerDialog = () => { - var child = modalContainer.children[0]; + let child = modalContainer.children[0]; - child.style.marginLeft = -(child.offsetWidth/2) + 'px'; + child.style.marginLeft = -(child.offsetWidth / 2) + 'px'; - if(!settings.centerHorizontalOnly){ - child.style.marginTop = -(child.offsetHeight/2) + 'px'; + if (!settings.centerHorizontalOnly) { + child.style.marginTop = -(child.offsetHeight / 2) + 'px'; } }; return Promise.resolve(); } - showDialog(controller){ + showDialog(controller) { return controller.showDialog(); } - hideDialog(controller){ + hideDialog(controller) { return controller.hideDialog(); } - destroyDialogHost(controller){ + destroyDialogHost(controller) { return controller.destroyDialogHost(); } } diff --git a/dist/es6/dialog-service.js b/dist/es6/dialog-service.js index 887582d..7a1ae7b 100644 --- a/dist/es6/dialog-service.js +++ b/dist/es6/dialog-service.js @@ -8,45 +8,45 @@ import {invokeLifecycle} from './lifecycle'; export class DialogService { static inject = [Container, CompositionEngine, DialogRenderer]; - constructor(container, compositionEngine, renderer){ + constructor(container, compositionEngine, renderer) { this.container = container; this.compositionEngine = compositionEngine; this.renderer = renderer; } - _getViewModel(instruction){ - if(typeof instruction.viewModel === 'function'){ + _getViewModel(instruction) { + if (typeof instruction.viewModel === 'function') { instruction.viewModel = Origin.get(instruction.viewModel).moduleId; } - if(typeof instruction.viewModel === 'string'){ + if (typeof instruction.viewModel === 'string') { return this.compositionEngine.createViewModel(instruction); - }else{ - return Promise.resolve(instruction); } + + return Promise.resolve(instruction); } - open(settings){ - settings = Object.assign({}, this.renderer.defaultSettings, settings); + open(settings) { + let _settings = Object.assign({}, this.renderer.defaultSettings, settings); return new Promise((resolve, reject) => { - var childContainer = this.container.createChild(), - controller = new DialogController(this.renderer, settings, resolve, reject), - instruction = { - viewModel:settings.viewModel, - container:this.container, - childContainer:childContainer, - model:settings.model - }; + let childContainer = this.container.createChild(); + let controller = new DialogController(this.renderer, _settings, resolve, reject); + let instruction = { + viewModel: _settings.viewModel, + container: this.container, + childContainer: childContainer, + model: _settings.model + }; childContainer.registerInstance(DialogController, controller); - return this._getViewModel(instruction).then(instruction => { - controller.viewModel = instruction.viewModel; + return this._getViewModel(instruction).then(returnedInstruction => { + controller.viewModel = returnedInstruction.viewModel; - return invokeLifecycle(instruction.viewModel, 'canActivate', settings.model).then(canActivate => { - if(canActivate){ - return this.compositionEngine.createBehavior(instruction).then(behavior => { + return invokeLifecycle(returnedInstruction.viewModel, 'canActivate', _settings.model).then(canActivate => { + if (canActivate) { + return this.compositionEngine.createBehavior(returnedInstruction).then(behavior => { controller.behavior = behavior; controller.view = behavior.view; behavior.view.bind(behavior.executionContext); diff --git a/dist/es6/examples/common-dialogs.js b/dist/es6/examples/common-dialogs.js index 824db0d..6fd08ac 100644 --- a/dist/es6/examples/common-dialogs.js +++ b/dist/es6/examples/common-dialogs.js @@ -4,11 +4,11 @@ import {DialogService} from '../dialog-service'; export class CommonDialogs { static inject = [DialogService]; - constructor(dialogService){ + constructor(dialogService) { this.dialogService = dialogService; } - prompt(question){ - return this.dialogService.open({viewModel:Prompt, model:question}); - }; + prompt(question) { + return this.dialogService.open({viewModel: Prompt, model: question}); + } } diff --git a/dist/es6/examples/prompt.js b/dist/es6/examples/prompt.js index 1b300b7..d9ba849 100644 --- a/dist/es6/examples/prompt.js +++ b/dist/es6/examples/prompt.js @@ -3,14 +3,14 @@ import {DialogController} from '../dialog-controller'; export class Prompt { static inject = [DialogController]; - constructor(controller){ + constructor(controller) { this.controller = controller; this.answer = null; controller.settings.lock = false; } - activate(question){ + activate(question) { this.question = question; } } diff --git a/dist/es6/lifecycle.js b/dist/es6/lifecycle.js index 4dcaf59..bae6744 100644 --- a/dist/es6/lifecycle.js +++ b/dist/es6/lifecycle.js @@ -1,12 +1,12 @@ -export function invokeLifecycle(instance, name, model){ - if(typeof instance[name] === 'function'){ - var result = instance[name](model); +export function invokeLifecycle(instance, name, model) { + if (typeof instance[name] === 'function') { + let result = instance[name](model); - if(result instanceof Promise){ + if (result instanceof Promise) { return result; } - if(result !== null && result !== undefined){ + if (result !== null && result !== undefined) { return Promise.resolve(result); } diff --git a/dist/system/dialog-renderer.js b/dist/system/dialog-renderer.js index 4c8d631..ea3446e 100644 --- a/dist/system/dialog-renderer.js +++ b/dist/system/dialog-renderer.js @@ -1,9 +1,9 @@ -System.register(["aurelia-templating"], function (_export) { - "use strict"; +System.register(['aurelia-templating'], function (_export) { + 'use strict'; var ViewSlot, currentZIndex, transitionEvent, DialogRenderer; - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } function getNextZIndex() { return ++currentZIndex; @@ -17,14 +17,14 @@ System.register(["aurelia-templating"], function (_export) { currentZIndex = 1000; transitionEvent = (function () { - var t, - el = document.createElement("fakeelement"); + var t = undefined; + var el = document.createElement('fakeelement'); var transitions = { - "transition": "transitionend", - "OTransition": "oTransitionEnd", - "MozTransition": "transitionend", - "WebkitTransition": "webkitTransitionEnd" + 'transition': 'transitionend', + 'OTransition': 'oTransitionEnd', + 'MozTransition': 'transitionend', + 'WebkitTransition': 'webkitTransitionEnd' }; for (t in transitions) { @@ -49,9 +49,9 @@ System.register(["aurelia-templating"], function (_export) { document.addEventListener('keyup', function (e) { if (e.keyCode === 27) { - var top = _this.dialogControllers[_this.dialogControllers.length - 1]; - if (top && top.settings.lock !== true) { - top.cancel(); + var _top = _this.dialogControllers[_this.dialogControllers.length - 1]; + if (_top && _top.settings.lock !== true) { + _top.cancel(); } } }); @@ -60,10 +60,9 @@ System.register(["aurelia-templating"], function (_export) { DialogRenderer.prototype.createDialogHost = function createDialogHost(controller) { var _this2 = this; - var settings = controller.settings, - emptyParameters = {}, - modalOverlay = document.createElement('dialog-overlay'), - modalContainer = document.createElement('dialog-container'); + var settings = controller.settings; + var modalOverlay = document.createElement('dialog-overlay'); + var modalContainer = document.createElement('dialog-container'); modalOverlay.style.zIndex = getNextZIndex(); modalContainer.style.zIndex = getNextZIndex(); @@ -88,13 +87,13 @@ System.register(["aurelia-templating"], function (_export) { } }; - return new Promise(function (resolve, reject) { + return new Promise(function (resolve) { modalContainer.addEventListener(transitionEvent, onTransitionEnd); - function onTransitionEnd(event) { + function onTransitionEnd() { modalContainer.removeEventListener(transitionEvent, onTransitionEnd); resolve(); - }; + } modalOverlay.classList.add('active'); modalContainer.classList.add('active'); @@ -107,13 +106,13 @@ System.register(["aurelia-templating"], function (_export) { _this2.dialogControllers.splice(i, 1); } - return new Promise(function (resolve, reject) { + return new Promise(function (resolve) { modalContainer.addEventListener(transitionEvent, onTransitionEnd); - function onTransitionEnd(event) { + function onTransitionEnd() { modalContainer.removeEventListener(transitionEvent, onTransitionEnd); resolve(); - }; + } modalOverlay.classList.remove('active'); modalContainer.classList.remove('active'); @@ -155,7 +154,7 @@ System.register(["aurelia-templating"], function (_export) { return DialogRenderer; })(); - _export("DialogRenderer", DialogRenderer); + _export('DialogRenderer', DialogRenderer); } }; }); \ No newline at end of file diff --git a/dist/system/dialog-service.js b/dist/system/dialog-service.js index 1c12e3d..973fa82 100644 --- a/dist/system/dialog-service.js +++ b/dist/system/dialog-service.js @@ -44,34 +44,34 @@ System.register(['aurelia-metadata', 'aurelia-dependency-injection', 'aurelia-te if (typeof instruction.viewModel === 'string') { return this.compositionEngine.createViewModel(instruction); - } else { - return Promise.resolve(instruction); } + + return Promise.resolve(instruction); }; DialogService.prototype.open = function open(settings) { var _this = this; - settings = Object.assign({}, this.renderer.defaultSettings, settings); + var _settings = Object.assign({}, this.renderer.defaultSettings, settings); return new Promise(function (resolve, reject) { - var childContainer = _this.container.createChild(), - controller = new DialogController(_this.renderer, settings, resolve, reject), - instruction = { - viewModel: settings.viewModel, + var childContainer = _this.container.createChild(); + var controller = new DialogController(_this.renderer, _settings, resolve, reject); + var instruction = { + viewModel: _settings.viewModel, container: _this.container, childContainer: childContainer, - model: settings.model + model: _settings.model }; childContainer.registerInstance(DialogController, controller); - return _this._getViewModel(instruction).then(function (instruction) { - controller.viewModel = instruction.viewModel; + return _this._getViewModel(instruction).then(function (returnedInstruction) { + controller.viewModel = returnedInstruction.viewModel; - return invokeLifecycle(instruction.viewModel, 'canActivate', settings.model).then(function (canActivate) { + return invokeLifecycle(returnedInstruction.viewModel, 'canActivate', _settings.model).then(function (canActivate) { if (canActivate) { - return _this.compositionEngine.createBehavior(instruction).then(function (behavior) { + return _this.compositionEngine.createBehavior(returnedInstruction).then(function (behavior) { controller.behavior = behavior; controller.view = behavior.view; behavior.view.bind(behavior.executionContext); diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 155bc82..ace8b97 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,6 @@ ### 0.1.1 (2015-08-24) +### 0.1.1 (2015-08-24) + + diff --git a/karma.conf.js b/karma.conf.js index d551cb0..800ed34 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -41,8 +41,7 @@ module.exports = function(config) { loose: "all", optional: [ "es7.decorators", - "es7.classProperties" - + "es7.classProperties" ] } }, diff --git a/package.json b/package.json index 4aa3af5..6736aa5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-dialog", - "version": "0.1.0", + "version": "0.1.1", "description": "A dialog plugin for Aurelia.", "keywords": [ "aurelia",