diff --git a/bower.json b/bower.json index 0bb059e..33f9742 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "aurelia-templating-resources", - "version": "0.11.1", + "version": "0.12.0", "description": "A standard set of behaviors, converters and other resources for use with the Aurelia templating library.", "keywords": [ "aurelia", @@ -17,10 +17,11 @@ "url": "http://github.com/aurelia/templating-resources" }, "dependencies": { - "aurelia-binding": "^0.6.1", - "aurelia-dependency-injection": "^0.7.1", - "aurelia-logging": "^0.4.0", - "aurelia-templating": "^0.11.1", + "aurelia-binding": "^0.7.0", + "aurelia-dependency-injection": "^0.8.1", + "aurelia-logging": "^0.5.0", + "aurelia-task-queue": "^0.5.0", + "aurelia-templating": "^0.12.0", "core-js": "zloirock/core-js" } } diff --git a/config.js b/config.js index 0b886fe..4c495cb 100644 --- a/config.js +++ b/config.js @@ -16,50 +16,52 @@ System.config({ System.config({ "map": { - "aurelia-binding": "github:aurelia/binding@0.6.1", - "aurelia-dependency-injection": "github:aurelia/dependency-injection@0.7.1", - "aurelia-logging": "github:aurelia/logging@0.4.0", - "aurelia-task-queue": "github:aurelia/task-queue@0.4.0", - "aurelia-templating": "github:aurelia/templating@0.11.1", + "aurelia-binding": "github:aurelia/binding@0.7.0", + "aurelia-dependency-injection": "github:aurelia/dependency-injection@0.8.1", + "aurelia-logging": "github:aurelia/logging@0.5.0", + "aurelia-task-queue": "github:aurelia/task-queue@0.5.0", + "aurelia-templating": "github:aurelia/templating@0.12.0", "babel": "npm:babel-core@5.2.2", "babel-runtime": "npm:babel-runtime@5.2.2", - "core-js": "npm:core-js@0.9.6", - "github:aurelia/binding@0.6.1": { - "aurelia-dependency-injection": "github:aurelia/dependency-injection@0.7.1", - "aurelia-metadata": "github:aurelia/metadata@0.5.0", - "aurelia-task-queue": "github:aurelia/task-queue@0.4.0", - "core-js": "npm:core-js@0.9.6" + "core-js": "npm:core-js@0.9.15", + "github:aurelia/binding@0.7.0": { + "aurelia-dependency-injection": "github:aurelia/dependency-injection@0.8.1", + "aurelia-metadata": "github:aurelia/metadata@0.6.0", + "aurelia-task-queue": "github:aurelia/task-queue@0.5.0", + "core-js": "npm:core-js@0.9.15" }, - "github:aurelia/dependency-injection@0.7.1": { - "aurelia-logging": "github:aurelia/logging@0.4.0", - "aurelia-metadata": "github:aurelia/metadata@0.5.0", - "core-js": "npm:core-js@0.9.6" + "github:aurelia/dependency-injection@0.8.1": { + "aurelia-logging": "github:aurelia/logging@0.5.0", + "aurelia-metadata": "github:aurelia/metadata@0.6.0", + "core-js": "npm:core-js@0.9.15" }, - "github:aurelia/loader@0.6.0": { + "github:aurelia/loader@0.7.0": { "aurelia-html-template-element": "github:aurelia/html-template-element@0.2.0", - "aurelia-path": "github:aurelia/path@0.6.1", - "core-js": "npm:core-js@0.9.6", - "webcomponentsjs": "github:webcomponents/webcomponentsjs@0.6.1" + "aurelia-path": "github:aurelia/path@0.7.0", + "core-js": "npm:core-js@0.9.15", + "webcomponentsjs": "github:webcomponents/webcomponentsjs@0.6.3" }, - "github:aurelia/metadata@0.5.0": { - "core-js": "npm:core-js@0.9.6" + "github:aurelia/metadata@0.6.0": { + "core-js": "npm:core-js@0.9.15" }, - "github:aurelia/templating@0.11.1": { - "aurelia-binding": "github:aurelia/binding@0.6.1", - "aurelia-dependency-injection": "github:aurelia/dependency-injection@0.7.1", + "github:aurelia/templating@0.12.0": { + "aurelia-binding": "github:aurelia/binding@0.7.0", + "aurelia-dependency-injection": "github:aurelia/dependency-injection@0.8.1", "aurelia-html-template-element": "github:aurelia/html-template-element@0.2.0", - "aurelia-loader": "github:aurelia/loader@0.6.0", - "aurelia-logging": "github:aurelia/logging@0.4.0", - "aurelia-metadata": "github:aurelia/metadata@0.5.0", - "aurelia-path": "github:aurelia/path@0.6.1", - "aurelia-task-queue": "github:aurelia/task-queue@0.4.0", - "core-js": "npm:core-js@0.9.6" + "aurelia-loader": "github:aurelia/loader@0.7.0", + "aurelia-logging": "github:aurelia/logging@0.5.0", + "aurelia-metadata": "github:aurelia/metadata@0.6.0", + "aurelia-path": "github:aurelia/path@0.7.0", + "aurelia-task-queue": "github:aurelia/task-queue@0.5.0", + "core-js": "npm:core-js@0.9.15" }, "github:jspm/nodelibs-process@0.1.1": { "process": "npm:process@0.10.1" }, - "npm:core-js@0.9.6": { - "process": "github:jspm/nodelibs-process@0.1.1" + "npm:core-js@0.9.15": { + "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/dist/amd/compose.js b/dist/amd/compose.js index 20ff72c..0394ff1 100644 --- a/dist/amd/compose.js +++ b/dist/amd/compose.js @@ -1,14 +1,27 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-task-queue', 'aurelia-templating'], function (exports, _aureliaDependencyInjection, _aureliaTaskQueue, _aureliaTemplating) { 'use strict'; - var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - exports.__esModule = true; + var _createDecoratedClass = (function () { function defineProperties(target, descriptors, initializers) { for (var i = 0; i < descriptors.length; i++) { var descriptor = descriptors[i]; var decorators = descriptor.decorators; var key = descriptor.key; delete descriptor.key; delete descriptor.decorators; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor || descriptor.initializer) descriptor.writable = true; if (decorators) { for (var f = 0; f < decorators.length; f++) { var decorator = decorators[f]; if (typeof decorator === 'function') { descriptor = decorator(target, key, descriptor) || descriptor; } else { throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator); } } if (descriptor.initializer !== undefined) { initializers[key] = descriptor; continue; } } Object.defineProperty(target, key, descriptor); } } return function (Constructor, protoProps, staticProps, protoInitializers, staticInitializers) { if (protoProps) defineProperties(Constructor.prototype, protoProps, protoInitializers); if (staticProps) defineProperties(Constructor, staticProps, staticInitializers); return Constructor; }; })(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer.call(target); Object.defineProperty(target, key, descriptor); } + var Compose = (function () { - function Compose(container, compositionEngine, viewSlot, viewResources, taskQueue) { + var _instanceInitializers = {}; + + function Compose(element, container, compositionEngine, viewSlot, viewResources, taskQueue) { _classCallCheck(this, _Compose); + _defineDecoratedPropertyDescriptor(this, 'model', _instanceInitializers); + + _defineDecoratedPropertyDescriptor(this, 'view', _instanceInitializers); + + _defineDecoratedPropertyDescriptor(this, 'viewModel', _instanceInitializers); + + this.element = element; this.container = container; this.compositionEngine = compositionEngine; this.viewSlot = viewSlot; @@ -89,12 +102,26 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-task-queue', 'aureli }); }; - Compose = _aureliaDependencyInjection.inject(_aureliaDependencyInjection.Container, _aureliaTemplating.CompositionEngine, _aureliaTemplating.ViewSlot, _aureliaTemplating.ViewResources, _aureliaTaskQueue.TaskQueue)(Compose) || Compose; - Compose = _aureliaTemplating.noView(Compose) || Compose; - Compose = _aureliaTemplating.bindable('viewModel')(Compose) || Compose; - Compose = _aureliaTemplating.bindable('view')(Compose) || Compose; - Compose = _aureliaTemplating.bindable('model')(Compose) || Compose; - Compose = _aureliaTemplating.customElement('compose')(Compose) || Compose; + _createDecoratedClass(_Compose, [{ + key: 'model', + decorators: [_aureliaTemplating.bindable], + initializer: null, + enumerable: true + }, { + key: 'view', + decorators: [_aureliaTemplating.bindable], + initializer: null, + enumerable: true + }, { + key: 'viewModel', + decorators: [_aureliaTemplating.bindable], + initializer: null, + enumerable: true + }], null, _instanceInitializers); + + Compose = (0, _aureliaDependencyInjection.inject)(Element, _aureliaDependencyInjection.Container, _aureliaTemplating.CompositionEngine, _aureliaTemplating.ViewSlot, _aureliaTemplating.ViewResources, _aureliaTaskQueue.TaskQueue)(Compose) || Compose; + Compose = (0, _aureliaTemplating.noView)(Compose) || Compose; + Compose = (0, _aureliaTemplating.customElement)('compose')(Compose) || Compose; return Compose; })(); @@ -106,7 +133,8 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-task-queue', 'aureli container: composer.container, viewSlot: composer.viewSlot, viewResources: composer.viewResources, - currentBehavior: composer.currentBehavior + currentBehavior: composer.currentBehavior, + host: composer.element }); } diff --git a/dist/amd/focus.js b/dist/amd/focus.js new file mode 100644 index 0000000..2b4d606 --- /dev/null +++ b/dist/amd/focus.js @@ -0,0 +1,63 @@ +define(['exports', 'aurelia-templating', 'aurelia-binding', 'aurelia-dependency-injection', 'aurelia-task-queue'], function (exports, _aureliaTemplating, _aureliaBinding, _aureliaDependencyInjection, _aureliaTaskQueue) { + 'use strict'; + + exports.__esModule = true; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + var Focus = (function () { + function Focus(element, taskQueue) { + var _this = this; + + _classCallCheck(this, _Focus); + + this.element = element; + this.taskQueue = taskQueue; + + this.focusListener = function (e) { + _this.value = true; + }; + this.blurListener = function (e) { + if (document.activeElement !== _this.element) { + _this.value = false; + } + }; + } + + var _Focus = Focus; + + _Focus.prototype.valueChanged = function valueChanged(newValue) { + if (newValue) { + this.giveFocus(); + } else { + this.element.blur(); + } + }; + + _Focus.prototype.giveFocus = function giveFocus() { + var _this2 = this; + + this.taskQueue.queueMicroTask(function () { + if (_this2.value) { + _this2.element.focus(); + } + }); + }; + + _Focus.prototype.attached = function attached() { + this.element.addEventListener('focus', this.focusListener); + this.element.addEventListener('blur', this.blurListener); + }; + + _Focus.prototype.detached = function detached() { + this.element.removeEventListener('focus', this.focusListener); + this.element.removeEventListener('blur', this.blurListener); + }; + + Focus = (0, _aureliaDependencyInjection.inject)(Element, _aureliaTaskQueue.TaskQueue)(Focus) || Focus; + Focus = (0, _aureliaTemplating.customAttribute)('focus', _aureliaBinding.bindingMode.twoWay)(Focus) || Focus; + return Focus; + })(); + + exports.Focus = Focus; +}); \ No newline at end of file diff --git a/dist/amd/global-behavior.js b/dist/amd/global-behavior.js index 5985b7e..4028918 100644 --- a/dist/amd/global-behavior.js +++ b/dist/amd/global-behavior.js @@ -1,10 +1,10 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aurelia-logging'], function (exports, _aureliaDependencyInjection, _aureliaTemplating, _aureliaLogging) { 'use strict'; - var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - exports.__esModule = true; + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + var GlobalBehavior = (function () { function GlobalBehavior(element) { _classCallCheck(this, _GlobalBehavior); @@ -24,7 +24,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aureli try { this.handler = handler.bind(this, this.element, this.aureliaCommand) || handler; } catch (error) { - throw _aureliaLogging.AggregateError('Conventional binding handler failed.', error); + throw (0, _aureliaLogging.AggregateError)('Conventional binding handler failed.', error); } }; @@ -48,9 +48,9 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-templating', 'aureli this.handler = null; }; - GlobalBehavior = _aureliaDependencyInjection.inject(Element)(GlobalBehavior) || GlobalBehavior; - GlobalBehavior = _aureliaTemplating.dynamicOptions(GlobalBehavior) || GlobalBehavior; - GlobalBehavior = _aureliaTemplating.customAttribute('global-behavior')(GlobalBehavior) || GlobalBehavior; + GlobalBehavior = (0, _aureliaDependencyInjection.inject)(Element)(GlobalBehavior) || GlobalBehavior; + GlobalBehavior = (0, _aureliaTemplating.dynamicOptions)(GlobalBehavior) || GlobalBehavior; + GlobalBehavior = (0, _aureliaTemplating.customAttribute)('global-behavior')(GlobalBehavior) || GlobalBehavior; return GlobalBehavior; })(); diff --git a/dist/amd/if.js b/dist/amd/if.js index 4f8bd0b..73e9d3d 100644 --- a/dist/amd/if.js +++ b/dist/amd/if.js @@ -1,10 +1,10 @@ define(['exports', 'aurelia-templating', 'aurelia-dependency-injection'], function (exports, _aureliaTemplating, _aureliaDependencyInjection) { 'use strict'; - var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - exports.__esModule = true; + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + var If = (function () { function If(viewFactory, viewSlot) { _classCallCheck(this, _If); @@ -16,6 +16,11 @@ define(['exports', 'aurelia-templating', 'aurelia-dependency-injection'], functi var _If = If; + _If.prototype.bind = function bind(executionContext) { + this.executionContext = executionContext; + this.valueChanged(this.value); + }; + _If.prototype.valueChanged = function valueChanged(newValue) { if (!newValue) { if (this.view) { @@ -28,13 +33,13 @@ define(['exports', 'aurelia-templating', 'aurelia-dependency-injection'], functi } if (!this.view) { - this.view = this.viewFactory.create(); + this.view = this.viewFactory.create(this.executionContext); } if (!this.showing) { this.showing = true; - if (!this.view.bound) { + if (!this.view.isBound) { this.view.bind(); } @@ -42,9 +47,9 @@ define(['exports', 'aurelia-templating', 'aurelia-dependency-injection'], functi } }; - If = _aureliaDependencyInjection.inject(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot)(If) || If; - If = _aureliaTemplating.templateController(If) || If; - If = _aureliaTemplating.customAttribute('if')(If) || If; + If = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot)(If) || If; + If = (0, _aureliaTemplating.templateController)(If) || If; + If = (0, _aureliaTemplating.customAttribute)('if')(If) || If; return If; })(); diff --git a/dist/amd/index.js b/dist/amd/index.js index b064dc4..293ef82 100644 --- a/dist/amd/index.js +++ b/dist/amd/index.js @@ -1,10 +1,10 @@ -define(['exports', './compose', './if', './with', './repeat', './show', './global-behavior', './sanitize-html'], function (exports, _compose, _if, _with, _repeat, _show, _globalBehavior, _sanitizeHtml) { +define(['exports', './compose', './if', './with', './repeat', './show', './global-behavior', './sanitize-html', './replaceable', './focus'], function (exports, _compose, _if, _with, _repeat, _show, _globalBehavior, _sanitizeHtml, _replaceable, _focus) { 'use strict'; exports.__esModule = true; function configure(aurelia) { - aurelia.globalizeResources('./compose', './if', './with', './repeat', './show', './global-behavior', './sanitize-html'); + aurelia.globalizeResources('./compose', './if', './with', './repeat', './show', './replaceable', './global-behavior', './sanitize-html', './focus'); } exports.Compose = _compose.Compose; @@ -14,5 +14,7 @@ define(['exports', './compose', './if', './with', './repeat', './show', './globa exports.Show = _show.Show; exports.SanitizeHtmlValueConverter = _sanitizeHtml.SanitizeHtmlValueConverter; exports.GlobalBehavior = _globalBehavior.GlobalBehavior; + exports.Replaceable = _replaceable.Replaceable; + exports.Focus = _focus.Focus; exports.configure = configure; }); \ No newline at end of file diff --git a/dist/amd/repeat.js b/dist/amd/repeat.js index 51c9b83..eaa8273 100644 --- a/dist/amd/repeat.js +++ b/dist/amd/repeat.js @@ -1,14 +1,28 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-templating'], function (exports, _aureliaDependencyInjection, _aureliaBinding, _aureliaTemplating) { 'use strict'; - var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - exports.__esModule = true; + var _createDecoratedClass = (function () { function defineProperties(target, descriptors, initializers) { for (var i = 0; i < descriptors.length; i++) { var descriptor = descriptors[i]; var decorators = descriptor.decorators; var key = descriptor.key; delete descriptor.key; delete descriptor.decorators; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor || descriptor.initializer) descriptor.writable = true; if (decorators) { for (var f = 0; f < decorators.length; f++) { var decorator = decorators[f]; if (typeof decorator === 'function') { descriptor = decorator(target, key, descriptor) || descriptor; } else { throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator); } } if (descriptor.initializer !== undefined) { initializers[key] = descriptor; continue; } } Object.defineProperty(target, key, descriptor); } } return function (Constructor, protoProps, staticProps, protoInitializers, staticInitializers) { if (protoProps) defineProperties(Constructor.prototype, protoProps, protoInitializers); if (staticProps) defineProperties(Constructor, staticProps, staticInitializers); return Constructor; }; })(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer.call(target); Object.defineProperty(target, key, descriptor); } + var Repeat = (function () { + var _instanceInitializers = {}; + function Repeat(viewFactory, viewSlot, observerLocator) { _classCallCheck(this, _Repeat); + _defineDecoratedPropertyDescriptor(this, 'items', _instanceInitializers); + + _defineDecoratedPropertyDescriptor(this, 'local', _instanceInitializers); + + _defineDecoratedPropertyDescriptor(this, 'key', _instanceInitializers); + + _defineDecoratedPropertyDescriptor(this, 'value', _instanceInitializers); + this.viewFactory = viewFactory; this.viewSlot = viewSlot; this.observerLocator = observerLocator; @@ -37,7 +51,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t if (this.oldItems === items) { if (items instanceof Map) { - var records = _aureliaBinding.getChangeRecords(items); + var records = (0, _aureliaBinding.getChangeRecords)(items); observer = this.observerLocator.getMapObserver(items); this.handleMapChangeRecords(items, records); @@ -46,7 +60,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t _this.handleMapChangeRecords(items, records); }); } else { - var splices = _aureliaBinding.calcSplices(items, 0, items.length, this.lastBoundItems, 0, this.lastBoundItems.length); + var splices = (0, _aureliaBinding.calcSplices)(items, 0, items.length, this.lastBoundItems, 0, this.lastBoundItems.length); observer = this.observerLocator.getArrayObserver(items); this.handleSplices(items, splices); @@ -80,11 +94,18 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t _Repeat.prototype.processItems = function processItems() { var items = this.items, - viewSlot = this.viewSlot; + viewSlot = this.viewSlot, + views, + i; if (this.disposeSubscription) { this.disposeSubscription(); + views = viewSlot.children; viewSlot.removeAll(); + i = views.length; + while (i--) { + views[i].unbind(); + } } if (!items) { @@ -209,6 +230,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t var viewLookup = new Map(), viewSlot = this.viewSlot, spliceIndexLow, + viewOrPromise, view, i, ii, @@ -240,9 +262,9 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t view.executionContext[this.local] = array[addIndex + j]; --itemsLeftToAdd; } else { - view = viewSlot.removeAt(addIndex + splice.addedCount); - if (view) { - viewLookup.set(removed[j], view); + viewOrPromise = viewSlot.removeAt(addIndex + splice.addedCount); + if (viewOrPromise) { + viewLookup.set(removed[j], viewOrPromise); } } } @@ -251,10 +273,17 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t for (; 0 < itemsLeftToAdd; ++addIndex) { model = array[addIndex]; - view = viewLookup.get(model); - if (view) { + viewOrPromise = viewLookup.get(model); + if (viewOrPromise instanceof Promise) { + (function (localAddIndex, localModel) { + viewOrPromise.then(function (view) { + viewLookup['delete'](localModel); + viewSlot.insert(localAddIndex, view); + }); + })(addIndex, model); + } else if (viewOrPromise) { viewLookup['delete'](model); - viewSlot.insert(addIndex, view); + viewSlot.insert(addIndex, viewOrPromise); } else { row = this.createBaseExecutionContext(model); view = this.viewFactory.create(row); @@ -276,7 +305,13 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t } viewLookup.forEach(function (x) { - return x.unbind(); + if (x instanceof Promise) { + x.then(function (y) { + return y.unbind(); + }); + } else { + x.unbind(); + } }); }; @@ -342,13 +377,31 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t } }; - Repeat = _aureliaDependencyInjection.inject(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot, _aureliaBinding.ObserverLocator)(Repeat) || Repeat; - Repeat = _aureliaTemplating.templateController(Repeat) || Repeat; - Repeat = _aureliaTemplating.bindable('value')(Repeat) || Repeat; - Repeat = _aureliaTemplating.bindable('key')(Repeat) || Repeat; - Repeat = _aureliaTemplating.bindable('local')(Repeat) || Repeat; - Repeat = _aureliaTemplating.bindable('items')(Repeat) || Repeat; - Repeat = _aureliaTemplating.customAttribute('repeat')(Repeat) || Repeat; + _createDecoratedClass(_Repeat, [{ + key: 'items', + decorators: [_aureliaTemplating.bindable], + initializer: null, + enumerable: true + }, { + key: 'local', + decorators: [_aureliaTemplating.bindable], + initializer: null, + enumerable: true + }, { + key: 'key', + decorators: [_aureliaTemplating.bindable], + initializer: null, + enumerable: true + }, { + key: 'value', + decorators: [_aureliaTemplating.bindable], + initializer: null, + enumerable: true + }], null, _instanceInitializers); + + Repeat = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot, _aureliaBinding.ObserverLocator)(Repeat) || Repeat; + Repeat = (0, _aureliaTemplating.templateController)(Repeat) || Repeat; + Repeat = (0, _aureliaTemplating.customAttribute)('repeat')(Repeat) || Repeat; return Repeat; })(); diff --git a/dist/amd/replaceable.js b/dist/amd/replaceable.js new file mode 100644 index 0000000..38eb597 --- /dev/null +++ b/dist/amd/replaceable.js @@ -0,0 +1,23 @@ +define(['exports', 'aurelia-dependency-injection', 'aurelia-templating'], function (exports, _aureliaDependencyInjection, _aureliaTemplating) { + 'use strict'; + + exports.__esModule = true; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + var Replaceable = (function () { + function Replaceable(viewFactory, viewSlot) { + _classCallCheck(this, _Replaceable); + + viewSlot.add(viewFactory.create()); + } + + var _Replaceable = Replaceable; + Replaceable = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot)(Replaceable) || Replaceable; + Replaceable = (0, _aureliaTemplating.templateController)(Replaceable) || Replaceable; + Replaceable = (0, _aureliaTemplating.customAttribute)('replaceable')(Replaceable) || Replaceable; + return Replaceable; + })(); + + exports.Replaceable = Replaceable; +}); \ No newline at end of file diff --git a/dist/amd/sanitize-html.js b/dist/amd/sanitize-html.js index 4d3e986..ea371a6 100644 --- a/dist/amd/sanitize-html.js +++ b/dist/amd/sanitize-html.js @@ -1,10 +1,10 @@ define(['exports', 'aurelia-binding'], function (exports, _aureliaBinding) { 'use strict'; - var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - exports.__esModule = true; + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + var SCRIPT_REGEX = /)<[^<]*)*<\/script>/gi; var SanitizeHtmlValueConverter = (function () { @@ -28,7 +28,7 @@ define(['exports', 'aurelia-binding'], function (exports, _aureliaBinding) { return this.sanitizer(untrustedMarkup); }; - SanitizeHtmlValueConverter = _aureliaBinding.valueConverter('sanitizeHtml')(SanitizeHtmlValueConverter) || SanitizeHtmlValueConverter; + SanitizeHtmlValueConverter = (0, _aureliaBinding.valueConverter)('sanitizeHtml')(SanitizeHtmlValueConverter) || SanitizeHtmlValueConverter; return SanitizeHtmlValueConverter; })(); diff --git a/dist/amd/show.js b/dist/amd/show.js index ab8b6fc..e01e95e 100644 --- a/dist/amd/show.js +++ b/dist/amd/show.js @@ -1,10 +1,10 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-templating'], function (exports, _aureliaDependencyInjection, _aureliaTemplating) { 'use strict'; - var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - exports.__esModule = true; + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + function addStyleString(str) { var node = document.createElement('style'); node.innerHTML = str; @@ -31,8 +31,8 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-templating'], functi } }; - Show = _aureliaDependencyInjection.inject(Element)(Show) || Show; - Show = _aureliaTemplating.customAttribute('show')(Show) || Show; + Show = (0, _aureliaDependencyInjection.inject)(Element)(Show) || Show; + Show = (0, _aureliaTemplating.customAttribute)('show')(Show) || Show; return Show; })(); diff --git a/dist/amd/with.js b/dist/amd/with.js index 27e8e14..e551861 100644 --- a/dist/amd/with.js +++ b/dist/amd/with.js @@ -1,10 +1,10 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-templating'], function (exports, _aureliaDependencyInjection, _aureliaTemplating) { 'use strict'; - var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - exports.__esModule = true; + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + var With = (function () { function With(viewFactory, viewSlot) { _classCallCheck(this, _With); @@ -24,9 +24,9 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-templating'], functi } }; - With = _aureliaDependencyInjection.inject(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot)(With) || With; - With = _aureliaTemplating.templateController(With) || With; - With = _aureliaTemplating.customAttribute('with')(With) || With; + With = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot)(With) || With; + With = (0, _aureliaTemplating.templateController)(With) || With; + With = (0, _aureliaTemplating.customAttribute)('with')(With) || With; return With; })(); diff --git a/dist/commonjs/compose.js b/dist/commonjs/compose.js index cde016f..6f7bca1 100644 --- a/dist/commonjs/compose.js +++ b/dist/commonjs/compose.js @@ -1,19 +1,32 @@ 'use strict'; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - exports.__esModule = true; -var _Container$inject = require('aurelia-dependency-injection'); +var _createDecoratedClass = (function () { function defineProperties(target, descriptors, initializers) { for (var i = 0; i < descriptors.length; i++) { var descriptor = descriptors[i]; var decorators = descriptor.decorators; var key = descriptor.key; delete descriptor.key; delete descriptor.decorators; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor || descriptor.initializer) descriptor.writable = true; if (decorators) { for (var f = 0; f < decorators.length; f++) { var decorator = decorators[f]; if (typeof decorator === 'function') { descriptor = decorator(target, key, descriptor) || descriptor; } else { throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator); } } if (descriptor.initializer !== undefined) { initializers[key] = descriptor; continue; } } Object.defineProperty(target, key, descriptor); } } return function (Constructor, protoProps, staticProps, protoInitializers, staticInitializers) { if (protoProps) defineProperties(Constructor.prototype, protoProps, protoInitializers); if (staticProps) defineProperties(Constructor, staticProps, staticInitializers); return Constructor; }; })(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + +function _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer.call(target); Object.defineProperty(target, key, descriptor); } + +var _aureliaDependencyInjection = require('aurelia-dependency-injection'); -var _TaskQueue = require('aurelia-task-queue'); +var _aureliaTaskQueue = require('aurelia-task-queue'); -var _CompositionEngine$ViewSlot$ViewResources$customElement$bindable$noView = require('aurelia-templating'); +var _aureliaTemplating = require('aurelia-templating'); var Compose = (function () { - function Compose(container, compositionEngine, viewSlot, viewResources, taskQueue) { + var _instanceInitializers = {}; + + function Compose(element, container, compositionEngine, viewSlot, viewResources, taskQueue) { _classCallCheck(this, _Compose); + _defineDecoratedPropertyDescriptor(this, 'model', _instanceInitializers); + + _defineDecoratedPropertyDescriptor(this, 'view', _instanceInitializers); + + _defineDecoratedPropertyDescriptor(this, 'viewModel', _instanceInitializers); + + this.element = element; this.container = container; this.compositionEngine = compositionEngine; this.viewSlot = viewSlot; @@ -94,12 +107,26 @@ var Compose = (function () { }); }; - Compose = _Container$inject.inject(_Container$inject.Container, _CompositionEngine$ViewSlot$ViewResources$customElement$bindable$noView.CompositionEngine, _CompositionEngine$ViewSlot$ViewResources$customElement$bindable$noView.ViewSlot, _CompositionEngine$ViewSlot$ViewResources$customElement$bindable$noView.ViewResources, _TaskQueue.TaskQueue)(Compose) || Compose; - Compose = _CompositionEngine$ViewSlot$ViewResources$customElement$bindable$noView.noView(Compose) || Compose; - Compose = _CompositionEngine$ViewSlot$ViewResources$customElement$bindable$noView.bindable('viewModel')(Compose) || Compose; - Compose = _CompositionEngine$ViewSlot$ViewResources$customElement$bindable$noView.bindable('view')(Compose) || Compose; - Compose = _CompositionEngine$ViewSlot$ViewResources$customElement$bindable$noView.bindable('model')(Compose) || Compose; - Compose = _CompositionEngine$ViewSlot$ViewResources$customElement$bindable$noView.customElement('compose')(Compose) || Compose; + _createDecoratedClass(_Compose, [{ + key: 'model', + decorators: [_aureliaTemplating.bindable], + initializer: null, + enumerable: true + }, { + key: 'view', + decorators: [_aureliaTemplating.bindable], + initializer: null, + enumerable: true + }, { + key: 'viewModel', + decorators: [_aureliaTemplating.bindable], + initializer: null, + enumerable: true + }], null, _instanceInitializers); + + Compose = (0, _aureliaDependencyInjection.inject)(Element, _aureliaDependencyInjection.Container, _aureliaTemplating.CompositionEngine, _aureliaTemplating.ViewSlot, _aureliaTemplating.ViewResources, _aureliaTaskQueue.TaskQueue)(Compose) || Compose; + Compose = (0, _aureliaTemplating.noView)(Compose) || Compose; + Compose = (0, _aureliaTemplating.customElement)('compose')(Compose) || Compose; return Compose; })(); @@ -111,7 +138,8 @@ function createInstruction(composer, instruction) { container: composer.container, viewSlot: composer.viewSlot, viewResources: composer.viewResources, - currentBehavior: composer.currentBehavior + currentBehavior: composer.currentBehavior, + host: composer.element }); } diff --git a/dist/commonjs/focus.js b/dist/commonjs/focus.js new file mode 100644 index 0000000..3918eb9 --- /dev/null +++ b/dist/commonjs/focus.js @@ -0,0 +1,69 @@ +'use strict'; + +exports.__esModule = true; + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + +var _aureliaTemplating = require('aurelia-templating'); + +var _aureliaBinding = require('aurelia-binding'); + +var _aureliaDependencyInjection = require('aurelia-dependency-injection'); + +var _aureliaTaskQueue = require('aurelia-task-queue'); + +var Focus = (function () { + function Focus(element, taskQueue) { + var _this = this; + + _classCallCheck(this, _Focus); + + this.element = element; + this.taskQueue = taskQueue; + + this.focusListener = function (e) { + _this.value = true; + }; + this.blurListener = function (e) { + if (document.activeElement !== _this.element) { + _this.value = false; + } + }; + } + + var _Focus = Focus; + + _Focus.prototype.valueChanged = function valueChanged(newValue) { + if (newValue) { + this.giveFocus(); + } else { + this.element.blur(); + } + }; + + _Focus.prototype.giveFocus = function giveFocus() { + var _this2 = this; + + this.taskQueue.queueMicroTask(function () { + if (_this2.value) { + _this2.element.focus(); + } + }); + }; + + _Focus.prototype.attached = function attached() { + this.element.addEventListener('focus', this.focusListener); + this.element.addEventListener('blur', this.blurListener); + }; + + _Focus.prototype.detached = function detached() { + this.element.removeEventListener('focus', this.focusListener); + this.element.removeEventListener('blur', this.blurListener); + }; + + Focus = (0, _aureliaDependencyInjection.inject)(Element, _aureliaTaskQueue.TaskQueue)(Focus) || Focus; + Focus = (0, _aureliaTemplating.customAttribute)('focus', _aureliaBinding.bindingMode.twoWay)(Focus) || Focus; + return Focus; +})(); + +exports.Focus = Focus; \ No newline at end of file diff --git a/dist/commonjs/global-behavior.js b/dist/commonjs/global-behavior.js index db460ed..43fb2e0 100644 --- a/dist/commonjs/global-behavior.js +++ b/dist/commonjs/global-behavior.js @@ -1,18 +1,18 @@ 'use strict'; -var _interopRequireWildcard = function (obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (typeof obj === 'object' && obj !== null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }; +exports.__esModule = true; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } -exports.__esModule = true; +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } -var _inject = require('aurelia-dependency-injection'); +var _aureliaDependencyInjection = require('aurelia-dependency-injection'); -var _customAttribute$dynamicOptions = require('aurelia-templating'); +var _aureliaTemplating = require('aurelia-templating'); -var _AggregateError = require('aurelia-logging'); +var _aureliaLogging = require('aurelia-logging'); -var LogManager = _interopRequireWildcard(_AggregateError); +var LogManager = _interopRequireWildcard(_aureliaLogging); var GlobalBehavior = (function () { function GlobalBehavior(element) { @@ -33,7 +33,7 @@ var GlobalBehavior = (function () { try { this.handler = handler.bind(this, this.element, this.aureliaCommand) || handler; } catch (error) { - throw _AggregateError.AggregateError('Conventional binding handler failed.', error); + throw (0, _aureliaLogging.AggregateError)('Conventional binding handler failed.', error); } }; @@ -57,9 +57,9 @@ var GlobalBehavior = (function () { this.handler = null; }; - GlobalBehavior = _inject.inject(Element)(GlobalBehavior) || GlobalBehavior; - GlobalBehavior = _customAttribute$dynamicOptions.dynamicOptions(GlobalBehavior) || GlobalBehavior; - GlobalBehavior = _customAttribute$dynamicOptions.customAttribute('global-behavior')(GlobalBehavior) || GlobalBehavior; + GlobalBehavior = (0, _aureliaDependencyInjection.inject)(Element)(GlobalBehavior) || GlobalBehavior; + GlobalBehavior = (0, _aureliaTemplating.dynamicOptions)(GlobalBehavior) || GlobalBehavior; + GlobalBehavior = (0, _aureliaTemplating.customAttribute)('global-behavior')(GlobalBehavior) || GlobalBehavior; return GlobalBehavior; })(); diff --git a/dist/commonjs/if.js b/dist/commonjs/if.js index 3d620c4..e4e24d2 100644 --- a/dist/commonjs/if.js +++ b/dist/commonjs/if.js @@ -1,12 +1,12 @@ 'use strict'; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - exports.__esModule = true; -var _BoundViewFactory$ViewSlot$customAttribute$templateController = require('aurelia-templating'); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + +var _aureliaTemplating = require('aurelia-templating'); -var _inject = require('aurelia-dependency-injection'); +var _aureliaDependencyInjection = require('aurelia-dependency-injection'); var If = (function () { function If(viewFactory, viewSlot) { @@ -19,6 +19,11 @@ var If = (function () { var _If = If; + _If.prototype.bind = function bind(executionContext) { + this.executionContext = executionContext; + this.valueChanged(this.value); + }; + _If.prototype.valueChanged = function valueChanged(newValue) { if (!newValue) { if (this.view) { @@ -31,13 +36,13 @@ var If = (function () { } if (!this.view) { - this.view = this.viewFactory.create(); + this.view = this.viewFactory.create(this.executionContext); } if (!this.showing) { this.showing = true; - if (!this.view.bound) { + if (!this.view.isBound) { this.view.bind(); } @@ -45,9 +50,9 @@ var If = (function () { } }; - If = _inject.inject(_BoundViewFactory$ViewSlot$customAttribute$templateController.BoundViewFactory, _BoundViewFactory$ViewSlot$customAttribute$templateController.ViewSlot)(If) || If; - If = _BoundViewFactory$ViewSlot$customAttribute$templateController.templateController(If) || If; - If = _BoundViewFactory$ViewSlot$customAttribute$templateController.customAttribute('if')(If) || If; + If = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot)(If) || If; + If = (0, _aureliaTemplating.templateController)(If) || If; + If = (0, _aureliaTemplating.customAttribute)('if')(If) || If; return If; })(); diff --git a/dist/commonjs/index.js b/dist/commonjs/index.js index 8bfc26e..594da95 100644 --- a/dist/commonjs/index.js +++ b/dist/commonjs/index.js @@ -2,29 +2,35 @@ exports.__esModule = true; -var _Compose = require('./compose'); +var _compose = require('./compose'); -var _If = require('./if'); +var _if = require('./if'); -var _With = require('./with'); +var _with = require('./with'); -var _Repeat = require('./repeat'); +var _repeat = require('./repeat'); -var _Show = require('./show'); +var _show = require('./show'); -var _GlobalBehavior = require('./global-behavior'); +var _globalBehavior = require('./global-behavior'); -var _SanitizeHtmlValueConverter = require('./sanitize-html'); +var _sanitizeHtml = require('./sanitize-html'); + +var _replaceable = require('./replaceable'); + +var _focus = require('./focus'); function configure(aurelia) { - aurelia.globalizeResources('./compose', './if', './with', './repeat', './show', './global-behavior', './sanitize-html'); + aurelia.globalizeResources('./compose', './if', './with', './repeat', './show', './replaceable', './global-behavior', './sanitize-html', './focus'); } -exports.Compose = _Compose.Compose; -exports.If = _If.If; -exports.With = _With.With; -exports.Repeat = _Repeat.Repeat; -exports.Show = _Show.Show; -exports.SanitizeHtmlValueConverter = _SanitizeHtmlValueConverter.SanitizeHtmlValueConverter; -exports.GlobalBehavior = _GlobalBehavior.GlobalBehavior; +exports.Compose = _compose.Compose; +exports.If = _if.If; +exports.With = _with.With; +exports.Repeat = _repeat.Repeat; +exports.Show = _show.Show; +exports.SanitizeHtmlValueConverter = _sanitizeHtml.SanitizeHtmlValueConverter; +exports.GlobalBehavior = _globalBehavior.GlobalBehavior; +exports.Replaceable = _replaceable.Replaceable; +exports.Focus = _focus.Focus; exports.configure = configure; \ No newline at end of file diff --git a/dist/commonjs/repeat.js b/dist/commonjs/repeat.js index bda1e34..7eed4da 100644 --- a/dist/commonjs/repeat.js +++ b/dist/commonjs/repeat.js @@ -1,19 +1,33 @@ 'use strict'; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - exports.__esModule = true; -var _inject = require('aurelia-dependency-injection'); +var _createDecoratedClass = (function () { function defineProperties(target, descriptors, initializers) { for (var i = 0; i < descriptors.length; i++) { var descriptor = descriptors[i]; var decorators = descriptor.decorators; var key = descriptor.key; delete descriptor.key; delete descriptor.decorators; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor || descriptor.initializer) descriptor.writable = true; if (decorators) { for (var f = 0; f < decorators.length; f++) { var decorator = decorators[f]; if (typeof decorator === 'function') { descriptor = decorator(target, key, descriptor) || descriptor; } else { throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator); } } if (descriptor.initializer !== undefined) { initializers[key] = descriptor; continue; } } Object.defineProperty(target, key, descriptor); } } return function (Constructor, protoProps, staticProps, protoInitializers, staticInitializers) { if (protoProps) defineProperties(Constructor.prototype, protoProps, protoInitializers); if (staticProps) defineProperties(Constructor, staticProps, staticInitializers); return Constructor; }; })(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + +function _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer.call(target); Object.defineProperty(target, key, descriptor); } + +var _aureliaDependencyInjection = require('aurelia-dependency-injection'); -var _ObserverLocator$calcSplices$getChangeRecords = require('aurelia-binding'); +var _aureliaBinding = require('aurelia-binding'); -var _BoundViewFactory$ViewSlot$customAttribute$bindable$templateController = require('aurelia-templating'); +var _aureliaTemplating = require('aurelia-templating'); var Repeat = (function () { + var _instanceInitializers = {}; + function Repeat(viewFactory, viewSlot, observerLocator) { _classCallCheck(this, _Repeat); + _defineDecoratedPropertyDescriptor(this, 'items', _instanceInitializers); + + _defineDecoratedPropertyDescriptor(this, 'local', _instanceInitializers); + + _defineDecoratedPropertyDescriptor(this, 'key', _instanceInitializers); + + _defineDecoratedPropertyDescriptor(this, 'value', _instanceInitializers); + this.viewFactory = viewFactory; this.viewSlot = viewSlot; this.observerLocator = observerLocator; @@ -42,7 +56,7 @@ var Repeat = (function () { if (this.oldItems === items) { if (items instanceof Map) { - var records = _ObserverLocator$calcSplices$getChangeRecords.getChangeRecords(items); + var records = (0, _aureliaBinding.getChangeRecords)(items); observer = this.observerLocator.getMapObserver(items); this.handleMapChangeRecords(items, records); @@ -51,7 +65,7 @@ var Repeat = (function () { _this.handleMapChangeRecords(items, records); }); } else { - var splices = _ObserverLocator$calcSplices$getChangeRecords.calcSplices(items, 0, items.length, this.lastBoundItems, 0, this.lastBoundItems.length); + var splices = (0, _aureliaBinding.calcSplices)(items, 0, items.length, this.lastBoundItems, 0, this.lastBoundItems.length); observer = this.observerLocator.getArrayObserver(items); this.handleSplices(items, splices); @@ -85,11 +99,18 @@ var Repeat = (function () { _Repeat.prototype.processItems = function processItems() { var items = this.items, - viewSlot = this.viewSlot; + viewSlot = this.viewSlot, + views, + i; if (this.disposeSubscription) { this.disposeSubscription(); + views = viewSlot.children; viewSlot.removeAll(); + i = views.length; + while (i--) { + views[i].unbind(); + } } if (!items) { @@ -214,6 +235,7 @@ var Repeat = (function () { var viewLookup = new Map(), viewSlot = this.viewSlot, spliceIndexLow, + viewOrPromise, view, i, ii, @@ -245,9 +267,9 @@ var Repeat = (function () { view.executionContext[this.local] = array[addIndex + j]; --itemsLeftToAdd; } else { - view = viewSlot.removeAt(addIndex + splice.addedCount); - if (view) { - viewLookup.set(removed[j], view); + viewOrPromise = viewSlot.removeAt(addIndex + splice.addedCount); + if (viewOrPromise) { + viewLookup.set(removed[j], viewOrPromise); } } } @@ -256,10 +278,17 @@ var Repeat = (function () { for (; 0 < itemsLeftToAdd; ++addIndex) { model = array[addIndex]; - view = viewLookup.get(model); - if (view) { + viewOrPromise = viewLookup.get(model); + if (viewOrPromise instanceof Promise) { + (function (localAddIndex, localModel) { + viewOrPromise.then(function (view) { + viewLookup['delete'](localModel); + viewSlot.insert(localAddIndex, view); + }); + })(addIndex, model); + } else if (viewOrPromise) { viewLookup['delete'](model); - viewSlot.insert(addIndex, view); + viewSlot.insert(addIndex, viewOrPromise); } else { row = this.createBaseExecutionContext(model); view = this.viewFactory.create(row); @@ -281,7 +310,13 @@ var Repeat = (function () { } viewLookup.forEach(function (x) { - return x.unbind(); + if (x instanceof Promise) { + x.then(function (y) { + return y.unbind(); + }); + } else { + x.unbind(); + } }); }; @@ -347,13 +382,31 @@ var Repeat = (function () { } }; - Repeat = _inject.inject(_BoundViewFactory$ViewSlot$customAttribute$bindable$templateController.BoundViewFactory, _BoundViewFactory$ViewSlot$customAttribute$bindable$templateController.ViewSlot, _ObserverLocator$calcSplices$getChangeRecords.ObserverLocator)(Repeat) || Repeat; - Repeat = _BoundViewFactory$ViewSlot$customAttribute$bindable$templateController.templateController(Repeat) || Repeat; - Repeat = _BoundViewFactory$ViewSlot$customAttribute$bindable$templateController.bindable('value')(Repeat) || Repeat; - Repeat = _BoundViewFactory$ViewSlot$customAttribute$bindable$templateController.bindable('key')(Repeat) || Repeat; - Repeat = _BoundViewFactory$ViewSlot$customAttribute$bindable$templateController.bindable('local')(Repeat) || Repeat; - Repeat = _BoundViewFactory$ViewSlot$customAttribute$bindable$templateController.bindable('items')(Repeat) || Repeat; - Repeat = _BoundViewFactory$ViewSlot$customAttribute$bindable$templateController.customAttribute('repeat')(Repeat) || Repeat; + _createDecoratedClass(_Repeat, [{ + key: 'items', + decorators: [_aureliaTemplating.bindable], + initializer: null, + enumerable: true + }, { + key: 'local', + decorators: [_aureliaTemplating.bindable], + initializer: null, + enumerable: true + }, { + key: 'key', + decorators: [_aureliaTemplating.bindable], + initializer: null, + enumerable: true + }, { + key: 'value', + decorators: [_aureliaTemplating.bindable], + initializer: null, + enumerable: true + }], null, _instanceInitializers); + + Repeat = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot, _aureliaBinding.ObserverLocator)(Repeat) || Repeat; + Repeat = (0, _aureliaTemplating.templateController)(Repeat) || Repeat; + Repeat = (0, _aureliaTemplating.customAttribute)('repeat')(Repeat) || Repeat; return Repeat; })(); diff --git a/dist/commonjs/replaceable.js b/dist/commonjs/replaceable.js new file mode 100644 index 0000000..a5679f3 --- /dev/null +++ b/dist/commonjs/replaceable.js @@ -0,0 +1,25 @@ +'use strict'; + +exports.__esModule = true; + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + +var _aureliaDependencyInjection = require('aurelia-dependency-injection'); + +var _aureliaTemplating = require('aurelia-templating'); + +var Replaceable = (function () { + function Replaceable(viewFactory, viewSlot) { + _classCallCheck(this, _Replaceable); + + viewSlot.add(viewFactory.create()); + } + + var _Replaceable = Replaceable; + Replaceable = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot)(Replaceable) || Replaceable; + Replaceable = (0, _aureliaTemplating.templateController)(Replaceable) || Replaceable; + Replaceable = (0, _aureliaTemplating.customAttribute)('replaceable')(Replaceable) || Replaceable; + return Replaceable; +})(); + +exports.Replaceable = Replaceable; \ No newline at end of file diff --git a/dist/commonjs/sanitize-html.js b/dist/commonjs/sanitize-html.js index 3f54dea..6fd52f4 100644 --- a/dist/commonjs/sanitize-html.js +++ b/dist/commonjs/sanitize-html.js @@ -1,10 +1,10 @@ 'use strict'; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - exports.__esModule = true; -var _valueConverter = require('aurelia-binding'); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + +var _aureliaBinding = require('aurelia-binding'); var SCRIPT_REGEX = /)<[^<]*)*<\/script>/gi; @@ -29,7 +29,7 @@ var SanitizeHtmlValueConverter = (function () { return this.sanitizer(untrustedMarkup); }; - SanitizeHtmlValueConverter = _valueConverter.valueConverter('sanitizeHtml')(SanitizeHtmlValueConverter) || SanitizeHtmlValueConverter; + SanitizeHtmlValueConverter = (0, _aureliaBinding.valueConverter)('sanitizeHtml')(SanitizeHtmlValueConverter) || SanitizeHtmlValueConverter; return SanitizeHtmlValueConverter; })(); diff --git a/dist/commonjs/show.js b/dist/commonjs/show.js index 4332973..3f2683c 100644 --- a/dist/commonjs/show.js +++ b/dist/commonjs/show.js @@ -1,12 +1,12 @@ 'use strict'; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - exports.__esModule = true; -var _inject = require('aurelia-dependency-injection'); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + +var _aureliaDependencyInjection = require('aurelia-dependency-injection'); -var _customAttribute = require('aurelia-templating'); +var _aureliaTemplating = require('aurelia-templating'); function addStyleString(str) { var node = document.createElement('style'); @@ -34,8 +34,8 @@ var Show = (function () { } }; - Show = _inject.inject(Element)(Show) || Show; - Show = _customAttribute.customAttribute('show')(Show) || Show; + Show = (0, _aureliaDependencyInjection.inject)(Element)(Show) || Show; + Show = (0, _aureliaTemplating.customAttribute)('show')(Show) || Show; return Show; })(); diff --git a/dist/commonjs/with.js b/dist/commonjs/with.js index a942508..5452daa 100644 --- a/dist/commonjs/with.js +++ b/dist/commonjs/with.js @@ -1,12 +1,12 @@ 'use strict'; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - exports.__esModule = true; -var _inject = require('aurelia-dependency-injection'); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + +var _aureliaDependencyInjection = require('aurelia-dependency-injection'); -var _BoundViewFactory$ViewSlot$customAttribute$templateController = require('aurelia-templating'); +var _aureliaTemplating = require('aurelia-templating'); var With = (function () { function With(viewFactory, viewSlot) { @@ -27,9 +27,9 @@ var With = (function () { } }; - With = _inject.inject(_BoundViewFactory$ViewSlot$customAttribute$templateController.BoundViewFactory, _BoundViewFactory$ViewSlot$customAttribute$templateController.ViewSlot)(With) || With; - With = _BoundViewFactory$ViewSlot$customAttribute$templateController.templateController(With) || With; - With = _BoundViewFactory$ViewSlot$customAttribute$templateController.customAttribute('with')(With) || With; + With = (0, _aureliaDependencyInjection.inject)(_aureliaTemplating.BoundViewFactory, _aureliaTemplating.ViewSlot)(With) || With; + With = (0, _aureliaTemplating.templateController)(With) || With; + With = (0, _aureliaTemplating.customAttribute)('with')(With) || With; return With; })(); diff --git a/dist/es6/compose.js b/dist/es6/compose.js index bb2f8cd..39cbed9 100644 --- a/dist/es6/compose.js +++ b/dist/es6/compose.js @@ -5,14 +5,43 @@ import { customElement, bindable, noView } from 'aurelia-templating'; +/** +* Used to compose a new view / view-model template or bind to an existing instance +* +* @class Compose +* @constructor +* @param {Container} container The containing container +* @param {CompositionEngine} compositionEngine The engine used when composing this view +* @param {ViewSlot} viewSlot The slot the view will be inserted in to +* @param {ViewResources} viewResources The resources available in the current viewSlot +*/ @customElement('compose') -@bindable('model') -@bindable('view') -@bindable('viewModel') @noView -@inject(Container, CompositionEngine, ViewSlot, ViewResources, TaskQueue) +@inject(Element, Container, CompositionEngine, ViewSlot, ViewResources, TaskQueue) export class Compose { - constructor(container, compositionEngine, viewSlot, viewResources, taskQueue){ + /** + * Model to bind the custom element to + * + * @property model + * @type {CustomElement} + */ + @bindable model + /** + * View to bind the custom element to + * + * @property view + * @type {HtmlElement} + */ + @bindable view + /** + * View-model to bind the custom element's template to + * + * @property viewModel + * @type {Class} + */ + @bindable viewModel + constructor(element, container, compositionEngine, viewSlot, viewResources, taskQueue){ + this.element = element; this.container = container; this.compositionEngine = compositionEngine; this.viewSlot = viewSlot; @@ -20,6 +49,12 @@ export class Compose { this.taskQueue = taskQueue; } + /** + * Used to set the executionContext + * + * @method bind + * @param {ExecutionContext} executionContext The context in which the view model is executed in + */ bind(executionContext){ this.executionContext = executionContext; processInstruction(this, createInstruction(this, { @@ -88,7 +123,8 @@ function createInstruction(composer, instruction){ container:composer.container, viewSlot:composer.viewSlot, viewResources:composer.viewResources, - currentBehavior:composer.currentBehavior + currentBehavior:composer.currentBehavior, + host:composer.element }); } diff --git a/dist/es6/focus.js b/dist/es6/focus.js new file mode 100644 index 0000000..1f37d1a --- /dev/null +++ b/dist/es6/focus.js @@ -0,0 +1,48 @@ +import {customAttribute} from 'aurelia-templating'; +import {bindingMode} from 'aurelia-binding'; +import {inject} from 'aurelia-dependency-injection'; +import {TaskQueue} from 'aurelia-task-queue'; + +@customAttribute('focus', bindingMode.twoWay) +@inject(Element, TaskQueue) +export class Focus { + constructor(element, taskQueue) { + this.element = element; + this.taskQueue = taskQueue; + + this.focusListener = e => { + this.value = true; + }; + this.blurListener = e => { + if (document.activeElement !== this.element) { + this.value = false; + } + }; + } + + valueChanged(newValue) { + if (newValue) { + this.giveFocus(); + } else { + this.element.blur(); + } + } + + giveFocus() { + this.taskQueue.queueMicroTask(() => { + if (this.value) { + this.element.focus(); + } + }); + } + + attached() { + this.element.addEventListener('focus', this.focusListener); + this.element.addEventListener('blur', this.blurListener); + } + + detached() { + this.element.removeEventListener('focus', this.focusListener) + this.element.removeEventListener('blur', this.blurListener); + } +} \ No newline at end of file diff --git a/dist/es6/if.js b/dist/es6/if.js index ba4c4f9..918318d 100644 --- a/dist/es6/if.js +++ b/dist/es6/if.js @@ -1,6 +1,15 @@ import {BoundViewFactory, ViewSlot, customAttribute, templateController} from 'aurelia-templating'; import {inject} from 'aurelia-dependency-injection'; +/** +* Binding to conditionally include or not include template logic depending on returned result +* - value should be Boolean or will be treated as such (truthy / falsey) +* +* @class If +* @constructor +* @param {ViewFactory} viewFactory The factory used to create the view +* @param {ViewSlot} viewSlot The slot the view will be inserted in to +*/ @customAttribute('if') @templateController @inject(BoundViewFactory, ViewSlot) @@ -11,6 +20,12 @@ export class If { this.showing = false; } + bind(executionContext) { + // Store parent executionContext, so we can pass it down + this.executionContext = executionContext; + this.valueChanged(this.value); + } + valueChanged(newValue){ if (!newValue) { if(this.view){ @@ -23,13 +38,13 @@ export class If { } if(!this.view){ - this.view = this.viewFactory.create(); + this.view = this.viewFactory.create(this.executionContext); } if (!this.showing) { this.showing = true; - if(!this.view.bound){ + if(!this.view.isBound){ this.view.bind(); } diff --git a/dist/es6/index.js b/dist/es6/index.js index e11a8f5..bcb0bda 100644 --- a/dist/es6/index.js +++ b/dist/es6/index.js @@ -5,6 +5,8 @@ import {Repeat} from './repeat'; import {Show} from './show'; import {GlobalBehavior} from './global-behavior'; import {SanitizeHtmlValueConverter} from './sanitize-html'; +import {Replaceable} from './replaceable'; +import {Focus} from './focus'; function configure(aurelia){ aurelia.globalizeResources( @@ -13,8 +15,10 @@ function configure(aurelia){ './with', './repeat', './show', + './replaceable', './global-behavior', - './sanitize-html' + './sanitize-html', + './focus' ); } @@ -26,5 +30,7 @@ export { Show, SanitizeHtmlValueConverter, GlobalBehavior, + Replaceable, + Focus, configure }; diff --git a/dist/es6/repeat.js b/dist/es6/repeat.js index 53b8339..67766cb 100644 --- a/dist/es6/repeat.js +++ b/dist/es6/repeat.js @@ -2,14 +2,29 @@ import {inject} from 'aurelia-dependency-injection'; import {ObserverLocator, calcSplices, getChangeRecords} from 'aurelia-binding'; import {BoundViewFactory, ViewSlot, customAttribute, bindable, templateController} from 'aurelia-templating'; +/** +* Binding to iterate over an array and repeat a template +* +* @class Repeat +* @constructor +* @param {BoundViewFactory} viewFactory The factory generating the view +* @param {ViewSlot} viewSlot The slot the view is injected in to +* @param {ObserverLocator} observerLocator The observer locator instance +*/ @customAttribute('repeat') -@bindable('items') -@bindable('local') -@bindable('key') -@bindable('value') @templateController @inject(BoundViewFactory, ViewSlot, ObserverLocator) export class Repeat { + /** + * List of items to bind the repeater to + * + * @property items + * @type {Array} + */ + @bindable items + @bindable local + @bindable key + @bindable value constructor(viewFactory, viewSlot, observerLocator){ this.viewFactory = viewFactory; this.viewSlot = viewSlot; @@ -78,11 +93,17 @@ export class Repeat { processItems() { var items = this.items, - viewSlot = this.viewSlot; + viewSlot = this.viewSlot, + views, i; if (this.disposeSubscription) { this.disposeSubscription(); + views = viewSlot.children; viewSlot.removeAll(); + i = views.length; + while(i--) { + views[i].unbind(); + } } if(!items){ @@ -193,7 +214,8 @@ export class Repeat { handleSplices(array, splices) { var viewLookup = new Map(), viewSlot = this.viewSlot, - spliceIndexLow, view, i, ii, j, jj, row, splice, + spliceIndexLow, viewOrPromise, view, + i, ii, j, jj, row, splice, addIndex, end, itemsLeftToAdd, removed, model, children, length; @@ -213,9 +235,9 @@ export class Repeat { view.executionContext[this.local] = array[addIndex + j]; --itemsLeftToAdd; } else { - view = viewSlot.removeAt(addIndex + splice.addedCount); - if(view){ - viewLookup.set(removed[j], view); + viewOrPromise = viewSlot.removeAt(addIndex + splice.addedCount); + if(viewOrPromise){ + viewLookup.set(removed[j], viewOrPromise); } } } @@ -224,10 +246,17 @@ export class Repeat { for (; 0 < itemsLeftToAdd; ++addIndex) { model = array[addIndex]; - view = viewLookup.get(model); - if(view){ + viewOrPromise = viewLookup.get(model); + if(viewOrPromise instanceof Promise){ + ((localAddIndex, localModel) => { + viewOrPromise.then(view => { + viewLookup.delete(localModel); + viewSlot.insert(localAddIndex, view); + }); + })(addIndex, model); + }else if(viewOrPromise){ viewLookup.delete(model); - viewSlot.insert(addIndex, view); + viewSlot.insert(addIndex, viewOrPromise); }else{ row = this.createBaseExecutionContext(model); view = this.viewFactory.create(row); @@ -248,7 +277,13 @@ export class Repeat { this.updateExecutionContext(children[spliceIndexLow].executionContext, spliceIndexLow, length); } - viewLookup.forEach(x => x.unbind()); + viewLookup.forEach(x => { + if(x instanceof Promise){ + x.then(y => y.unbind()); + }else{ + x.unbind(); + } + }); } handleMapChangeRecords(map, records) { diff --git a/dist/es6/replaceable.js b/dist/es6/replaceable.js new file mode 100644 index 0000000..e1aff36 --- /dev/null +++ b/dist/es6/replaceable.js @@ -0,0 +1,11 @@ +import {inject} from 'aurelia-dependency-injection'; +import {BoundViewFactory, ViewSlot, customAttribute, templateController} from 'aurelia-templating'; + +@customAttribute('replaceable') +@templateController +@inject(BoundViewFactory, ViewSlot) +export class Replaceable { + constructor(viewFactory, viewSlot){ + viewSlot.add(viewFactory.create()); + } +} diff --git a/dist/es6/sanitize-html.js b/dist/es6/sanitize-html.js index a671dfe..daf252a 100644 --- a/dist/es6/sanitize-html.js +++ b/dist/es6/sanitize-html.js @@ -2,6 +2,12 @@ import {valueConverter} from 'aurelia-binding'; var SCRIPT_REGEX = /)<[^<]*)*<\/script>/gi; +/** +* Default Html Sanitizer to prevent script injection +* +* @class SanitizeHtml +* @constructor +*/ @valueConverter('sanitizeHtml') export class SanitizeHtmlValueConverter { static defaultSanitizer(untrustedMarkup){ diff --git a/dist/es6/show.js b/dist/es6/show.js index f16112b..6db675f 100644 --- a/dist/es6/show.js +++ b/dist/es6/show.js @@ -10,6 +10,14 @@ function addStyleString(str) { addStyleString('.aurelia-hide { display:none !important; }'); +/** +* Binding to conditionally show markup in the DOM based on the value. +* - different from if in that the markup is still added to the DOM, simply not shown +* +* @class Show +* @constructor +* @param {Element} element The element that the to bind to +*/ @customAttribute('show') @inject(Element) export class Show { diff --git a/dist/system/compose.js b/dist/system/compose.js index 174738c..8fd1e74 100644 --- a/dist/system/compose.js +++ b/dist/system/compose.js @@ -1,5 +1,13 @@ System.register(['aurelia-dependency-injection', 'aurelia-task-queue', 'aurelia-templating'], function (_export) { - var Container, inject, TaskQueue, CompositionEngine, ViewSlot, ViewResources, customElement, bindable, noView, _classCallCheck, Compose; + 'use strict'; + + var Container, inject, TaskQueue, CompositionEngine, ViewSlot, ViewResources, customElement, bindable, noView, Compose; + + var _createDecoratedClass = (function () { function defineProperties(target, descriptors, initializers) { for (var i = 0; i < descriptors.length; i++) { var descriptor = descriptors[i]; var decorators = descriptor.decorators; var key = descriptor.key; delete descriptor.key; delete descriptor.decorators; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor || descriptor.initializer) descriptor.writable = true; if (decorators) { for (var f = 0; f < decorators.length; f++) { var decorator = decorators[f]; if (typeof decorator === 'function') { descriptor = decorator(target, key, descriptor) || descriptor; } else { throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator); } } if (descriptor.initializer !== undefined) { initializers[key] = descriptor; continue; } } Object.defineProperty(target, key, descriptor); } } return function (Constructor, protoProps, staticProps, protoInitializers, staticInitializers) { if (protoProps) defineProperties(Constructor.prototype, protoProps, protoInitializers); if (staticProps) defineProperties(Constructor, staticProps, staticInitializers); return Constructor; }; })(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer.call(target); Object.defineProperty(target, key, descriptor); } function createInstruction(composer, instruction) { return Object.assign(instruction, { @@ -7,7 +15,8 @@ System.register(['aurelia-dependency-injection', 'aurelia-task-queue', 'aurelia- container: composer.container, viewSlot: composer.viewSlot, viewResources: composer.viewResources, - currentBehavior: composer.currentBehavior + currentBehavior: composer.currentBehavior, + host: composer.element }); } @@ -33,14 +42,19 @@ System.register(['aurelia-dependency-injection', 'aurelia-task-queue', 'aurelia- noView = _aureliaTemplating.noView; }], execute: function () { - 'use strict'; - - _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - Compose = (function () { - function Compose(container, compositionEngine, viewSlot, viewResources, taskQueue) { + var _instanceInitializers = {}; + + function Compose(element, container, compositionEngine, viewSlot, viewResources, taskQueue) { _classCallCheck(this, _Compose); + _defineDecoratedPropertyDescriptor(this, 'model', _instanceInitializers); + + _defineDecoratedPropertyDescriptor(this, 'view', _instanceInitializers); + + _defineDecoratedPropertyDescriptor(this, 'viewModel', _instanceInitializers); + + this.element = element; this.container = container; this.compositionEngine = compositionEngine; this.viewSlot = viewSlot; @@ -121,11 +135,25 @@ System.register(['aurelia-dependency-injection', 'aurelia-task-queue', 'aurelia- }); }; - Compose = inject(Container, CompositionEngine, ViewSlot, ViewResources, TaskQueue)(Compose) || Compose; + _createDecoratedClass(_Compose, [{ + key: 'model', + decorators: [bindable], + initializer: null, + enumerable: true + }, { + key: 'view', + decorators: [bindable], + initializer: null, + enumerable: true + }, { + key: 'viewModel', + decorators: [bindable], + initializer: null, + enumerable: true + }], null, _instanceInitializers); + + Compose = inject(Element, Container, CompositionEngine, ViewSlot, ViewResources, TaskQueue)(Compose) || Compose; Compose = noView(Compose) || Compose; - Compose = bindable('viewModel')(Compose) || Compose; - Compose = bindable('view')(Compose) || Compose; - Compose = bindable('model')(Compose) || Compose; Compose = customElement('compose')(Compose) || Compose; return Compose; })(); diff --git a/dist/system/focus.js b/dist/system/focus.js new file mode 100644 index 0000000..91e5fb7 --- /dev/null +++ b/dist/system/focus.js @@ -0,0 +1,76 @@ +System.register(['aurelia-templating', 'aurelia-binding', 'aurelia-dependency-injection', 'aurelia-task-queue'], function (_export) { + 'use strict'; + + var customAttribute, bindingMode, inject, TaskQueue, Focus; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + return { + setters: [function (_aureliaTemplating) { + customAttribute = _aureliaTemplating.customAttribute; + }, function (_aureliaBinding) { + bindingMode = _aureliaBinding.bindingMode; + }, function (_aureliaDependencyInjection) { + inject = _aureliaDependencyInjection.inject; + }, function (_aureliaTaskQueue) { + TaskQueue = _aureliaTaskQueue.TaskQueue; + }], + execute: function () { + Focus = (function () { + function Focus(element, taskQueue) { + var _this = this; + + _classCallCheck(this, _Focus); + + this.element = element; + this.taskQueue = taskQueue; + + this.focusListener = function (e) { + _this.value = true; + }; + this.blurListener = function (e) { + if (document.activeElement !== _this.element) { + _this.value = false; + } + }; + } + + var _Focus = Focus; + + _Focus.prototype.valueChanged = function valueChanged(newValue) { + if (newValue) { + this.giveFocus(); + } else { + this.element.blur(); + } + }; + + _Focus.prototype.giveFocus = function giveFocus() { + var _this2 = this; + + this.taskQueue.queueMicroTask(function () { + if (_this2.value) { + _this2.element.focus(); + } + }); + }; + + _Focus.prototype.attached = function attached() { + this.element.addEventListener('focus', this.focusListener); + this.element.addEventListener('blur', this.blurListener); + }; + + _Focus.prototype.detached = function detached() { + this.element.removeEventListener('focus', this.focusListener); + this.element.removeEventListener('blur', this.blurListener); + }; + + Focus = inject(Element, TaskQueue)(Focus) || Focus; + Focus = customAttribute('focus', bindingMode.twoWay)(Focus) || Focus; + return Focus; + })(); + + _export('Focus', Focus); + } + }; +}); \ No newline at end of file diff --git a/dist/system/global-behavior.js b/dist/system/global-behavior.js index 1dff01d..cf1af7f 100644 --- a/dist/system/global-behavior.js +++ b/dist/system/global-behavior.js @@ -1,5 +1,9 @@ System.register(['aurelia-dependency-injection', 'aurelia-templating', 'aurelia-logging'], function (_export) { - var inject, customAttribute, dynamicOptions, AggregateError, LogManager, _classCallCheck, GlobalBehavior; + 'use strict'; + + var inject, customAttribute, dynamicOptions, AggregateError, LogManager, GlobalBehavior; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } return { setters: [function (_aureliaDependencyInjection) { @@ -12,10 +16,6 @@ System.register(['aurelia-dependency-injection', 'aurelia-templating', 'aurelia- LogManager = _aureliaLogging; }], execute: function () { - 'use strict'; - - _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - GlobalBehavior = (function () { function GlobalBehavior(element) { _classCallCheck(this, _GlobalBehavior); diff --git a/dist/system/if.js b/dist/system/if.js index 5160e3d..932fdf1 100644 --- a/dist/system/if.js +++ b/dist/system/if.js @@ -1,5 +1,9 @@ System.register(['aurelia-templating', 'aurelia-dependency-injection'], function (_export) { - var BoundViewFactory, ViewSlot, customAttribute, templateController, inject, _classCallCheck, If; + 'use strict'; + + var BoundViewFactory, ViewSlot, customAttribute, templateController, inject, If; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } return { setters: [function (_aureliaTemplating) { @@ -11,10 +15,6 @@ System.register(['aurelia-templating', 'aurelia-dependency-injection'], function inject = _aureliaDependencyInjection.inject; }], execute: function () { - 'use strict'; - - _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - If = (function () { function If(viewFactory, viewSlot) { _classCallCheck(this, _If); @@ -26,6 +26,11 @@ System.register(['aurelia-templating', 'aurelia-dependency-injection'], function var _If = If; + _If.prototype.bind = function bind(executionContext) { + this.executionContext = executionContext; + this.valueChanged(this.value); + }; + _If.prototype.valueChanged = function valueChanged(newValue) { if (!newValue) { if (this.view) { @@ -38,13 +43,13 @@ System.register(['aurelia-templating', 'aurelia-dependency-injection'], function } if (!this.view) { - this.view = this.viewFactory.create(); + this.view = this.viewFactory.create(this.executionContext); } if (!this.showing) { this.showing = true; - if (!this.view.bound) { + if (!this.view.isBound) { this.view.bind(); } diff --git a/dist/system/index.js b/dist/system/index.js index f02f174..f1ecbea 100644 --- a/dist/system/index.js +++ b/dist/system/index.js @@ -1,8 +1,10 @@ -System.register(['./compose', './if', './with', './repeat', './show', './global-behavior', './sanitize-html'], function (_export) { - var Compose, If, With, Repeat, Show, GlobalBehavior, SanitizeHtmlValueConverter; +System.register(['./compose', './if', './with', './repeat', './show', './global-behavior', './sanitize-html', './replaceable', './focus'], function (_export) { + 'use strict'; + + var Compose, If, With, Repeat, Show, GlobalBehavior, SanitizeHtmlValueConverter, Replaceable, Focus; function configure(aurelia) { - aurelia.globalizeResources('./compose', './if', './with', './repeat', './show', './global-behavior', './sanitize-html'); + aurelia.globalizeResources('./compose', './if', './with', './repeat', './show', './replaceable', './global-behavior', './sanitize-html', './focus'); } return { @@ -20,10 +22,12 @@ System.register(['./compose', './if', './with', './repeat', './show', './global- GlobalBehavior = _globalBehavior.GlobalBehavior; }, function (_sanitizeHtml) { SanitizeHtmlValueConverter = _sanitizeHtml.SanitizeHtmlValueConverter; + }, function (_replaceable) { + Replaceable = _replaceable.Replaceable; + }, function (_focus) { + Focus = _focus.Focus; }], execute: function () { - 'use strict'; - _export('Compose', Compose); _export('If', If); @@ -38,6 +42,10 @@ System.register(['./compose', './if', './with', './repeat', './show', './global- _export('GlobalBehavior', GlobalBehavior); + _export('Replaceable', Replaceable); + + _export('Focus', Focus); + _export('configure', configure); } }; diff --git a/dist/system/repeat.js b/dist/system/repeat.js index dbe89bf..6d2a586 100644 --- a/dist/system/repeat.js +++ b/dist/system/repeat.js @@ -1,5 +1,13 @@ System.register(['aurelia-dependency-injection', 'aurelia-binding', 'aurelia-templating'], function (_export) { - var inject, ObserverLocator, calcSplices, getChangeRecords, BoundViewFactory, ViewSlot, customAttribute, bindable, templateController, _classCallCheck, Repeat; + 'use strict'; + + var inject, ObserverLocator, calcSplices, getChangeRecords, BoundViewFactory, ViewSlot, customAttribute, bindable, templateController, Repeat; + + var _createDecoratedClass = (function () { function defineProperties(target, descriptors, initializers) { for (var i = 0; i < descriptors.length; i++) { var descriptor = descriptors[i]; var decorators = descriptor.decorators; var key = descriptor.key; delete descriptor.key; delete descriptor.decorators; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor || descriptor.initializer) descriptor.writable = true; if (decorators) { for (var f = 0; f < decorators.length; f++) { var decorator = decorators[f]; if (typeof decorator === 'function') { descriptor = decorator(target, key, descriptor) || descriptor; } else { throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator); } } if (descriptor.initializer !== undefined) { initializers[key] = descriptor; continue; } } Object.defineProperty(target, key, descriptor); } } return function (Constructor, protoProps, staticProps, protoInitializers, staticInitializers) { if (protoProps) defineProperties(Constructor.prototype, protoProps, protoInitializers); if (staticProps) defineProperties(Constructor, staticProps, staticInitializers); return Constructor; }; })(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer.call(target); Object.defineProperty(target, key, descriptor); } return { setters: [function (_aureliaDependencyInjection) { @@ -16,14 +24,20 @@ System.register(['aurelia-dependency-injection', 'aurelia-binding', 'aurelia-tem templateController = _aureliaTemplating.templateController; }], execute: function () { - 'use strict'; - - _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - Repeat = (function () { + var _instanceInitializers = {}; + function Repeat(viewFactory, viewSlot, observerLocator) { _classCallCheck(this, _Repeat); + _defineDecoratedPropertyDescriptor(this, 'items', _instanceInitializers); + + _defineDecoratedPropertyDescriptor(this, 'local', _instanceInitializers); + + _defineDecoratedPropertyDescriptor(this, 'key', _instanceInitializers); + + _defineDecoratedPropertyDescriptor(this, 'value', _instanceInitializers); + this.viewFactory = viewFactory; this.viewSlot = viewSlot; this.observerLocator = observerLocator; @@ -95,11 +109,18 @@ System.register(['aurelia-dependency-injection', 'aurelia-binding', 'aurelia-tem _Repeat.prototype.processItems = function processItems() { var items = this.items, - viewSlot = this.viewSlot; + viewSlot = this.viewSlot, + views, + i; if (this.disposeSubscription) { this.disposeSubscription(); + views = viewSlot.children; viewSlot.removeAll(); + i = views.length; + while (i--) { + views[i].unbind(); + } } if (!items) { @@ -224,6 +245,7 @@ System.register(['aurelia-dependency-injection', 'aurelia-binding', 'aurelia-tem var viewLookup = new Map(), viewSlot = this.viewSlot, spliceIndexLow, + viewOrPromise, view, i, ii, @@ -255,9 +277,9 @@ System.register(['aurelia-dependency-injection', 'aurelia-binding', 'aurelia-tem view.executionContext[this.local] = array[addIndex + j]; --itemsLeftToAdd; } else { - view = viewSlot.removeAt(addIndex + splice.addedCount); - if (view) { - viewLookup.set(removed[j], view); + viewOrPromise = viewSlot.removeAt(addIndex + splice.addedCount); + if (viewOrPromise) { + viewLookup.set(removed[j], viewOrPromise); } } } @@ -266,10 +288,17 @@ System.register(['aurelia-dependency-injection', 'aurelia-binding', 'aurelia-tem for (; 0 < itemsLeftToAdd; ++addIndex) { model = array[addIndex]; - view = viewLookup.get(model); - if (view) { + viewOrPromise = viewLookup.get(model); + if (viewOrPromise instanceof Promise) { + (function (localAddIndex, localModel) { + viewOrPromise.then(function (view) { + viewLookup['delete'](localModel); + viewSlot.insert(localAddIndex, view); + }); + })(addIndex, model); + } else if (viewOrPromise) { viewLookup['delete'](model); - viewSlot.insert(addIndex, view); + viewSlot.insert(addIndex, viewOrPromise); } else { row = this.createBaseExecutionContext(model); view = this.viewFactory.create(row); @@ -291,7 +320,13 @@ System.register(['aurelia-dependency-injection', 'aurelia-binding', 'aurelia-tem } viewLookup.forEach(function (x) { - return x.unbind(); + if (x instanceof Promise) { + x.then(function (y) { + return y.unbind(); + }); + } else { + x.unbind(); + } }); }; @@ -357,12 +392,30 @@ System.register(['aurelia-dependency-injection', 'aurelia-binding', 'aurelia-tem } }; + _createDecoratedClass(_Repeat, [{ + key: 'items', + decorators: [bindable], + initializer: null, + enumerable: true + }, { + key: 'local', + decorators: [bindable], + initializer: null, + enumerable: true + }, { + key: 'key', + decorators: [bindable], + initializer: null, + enumerable: true + }, { + key: 'value', + decorators: [bindable], + initializer: null, + enumerable: true + }], null, _instanceInitializers); + Repeat = inject(BoundViewFactory, ViewSlot, ObserverLocator)(Repeat) || Repeat; Repeat = templateController(Repeat) || Repeat; - Repeat = bindable('value')(Repeat) || Repeat; - Repeat = bindable('key')(Repeat) || Repeat; - Repeat = bindable('local')(Repeat) || Repeat; - Repeat = bindable('items')(Repeat) || Repeat; Repeat = customAttribute('repeat')(Repeat) || Repeat; return Repeat; })(); diff --git a/dist/system/replaceable.js b/dist/system/replaceable.js new file mode 100644 index 0000000..5d7f731 --- /dev/null +++ b/dist/system/replaceable.js @@ -0,0 +1,35 @@ +System.register(['aurelia-dependency-injection', 'aurelia-templating'], function (_export) { + 'use strict'; + + var inject, BoundViewFactory, ViewSlot, customAttribute, templateController, Replaceable; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + return { + setters: [function (_aureliaDependencyInjection) { + inject = _aureliaDependencyInjection.inject; + }, function (_aureliaTemplating) { + BoundViewFactory = _aureliaTemplating.BoundViewFactory; + ViewSlot = _aureliaTemplating.ViewSlot; + customAttribute = _aureliaTemplating.customAttribute; + templateController = _aureliaTemplating.templateController; + }], + execute: function () { + Replaceable = (function () { + function Replaceable(viewFactory, viewSlot) { + _classCallCheck(this, _Replaceable); + + viewSlot.add(viewFactory.create()); + } + + var _Replaceable = Replaceable; + Replaceable = inject(BoundViewFactory, ViewSlot)(Replaceable) || Replaceable; + Replaceable = templateController(Replaceable) || Replaceable; + Replaceable = customAttribute('replaceable')(Replaceable) || Replaceable; + return Replaceable; + })(); + + _export('Replaceable', Replaceable); + } + }; +}); \ No newline at end of file diff --git a/dist/system/sanitize-html.js b/dist/system/sanitize-html.js index 82d9a99..d5132ca 100644 --- a/dist/system/sanitize-html.js +++ b/dist/system/sanitize-html.js @@ -1,15 +1,15 @@ System.register(['aurelia-binding'], function (_export) { - var valueConverter, _classCallCheck, SCRIPT_REGEX, SanitizeHtmlValueConverter; + 'use strict'; + + var valueConverter, SCRIPT_REGEX, SanitizeHtmlValueConverter; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } return { setters: [function (_aureliaBinding) { valueConverter = _aureliaBinding.valueConverter; }], execute: function () { - 'use strict'; - - _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - SCRIPT_REGEX = /)<[^<]*)*<\/script>/gi; SanitizeHtmlValueConverter = (function () { diff --git a/dist/system/show.js b/dist/system/show.js index cfe48bf..a2add30 100644 --- a/dist/system/show.js +++ b/dist/system/show.js @@ -1,5 +1,9 @@ System.register(['aurelia-dependency-injection', 'aurelia-templating'], function (_export) { - var inject, customAttribute, _classCallCheck, Show; + 'use strict'; + + var inject, customAttribute, Show; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } function addStyleString(str) { var node = document.createElement('style'); @@ -15,10 +19,6 @@ System.register(['aurelia-dependency-injection', 'aurelia-templating'], function customAttribute = _aureliaTemplating.customAttribute; }], execute: function () { - 'use strict'; - - _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - addStyleString('.aurelia-hide { display:none !important; }'); Show = (function () { diff --git a/dist/system/with.js b/dist/system/with.js index 888508c..e98f759 100644 --- a/dist/system/with.js +++ b/dist/system/with.js @@ -1,5 +1,9 @@ System.register(['aurelia-dependency-injection', 'aurelia-templating'], function (_export) { - var inject, BoundViewFactory, ViewSlot, customAttribute, templateController, _classCallCheck, With; + 'use strict'; + + var inject, BoundViewFactory, ViewSlot, customAttribute, templateController, With; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } return { setters: [function (_aureliaDependencyInjection) { @@ -11,10 +15,6 @@ System.register(['aurelia-dependency-injection', 'aurelia-templating'], function templateController = _aureliaTemplating.templateController; }], execute: function () { - 'use strict'; - - _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; - With = (function () { function With(viewFactory, viewSlot) { _classCallCheck(this, _With); diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 98aa4fc..5a8b904 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,25 @@ +## 0.12.0 (2015-06-08) + + +#### Bug Fixes + +* **if:** + * fix passing context binding to the view factory ([ecfa3ce4](http://github.com/aurelia/templating-resources/commit/ecfa3ce4b18ed9cd9bb32178e3fa3360e58bafbe), closes [#56](http://github.com/aurelia/templating-resources/issues/56)) + * fix multiple view.bind() call ([172bdfae](http://github.com/aurelia/templating-resources/commit/172bdfaee29f224bb14d5ee8dd981ed7c4ba9b9c)) +* **repeat:** + * unbind children on property change ([96a2065c](http://github.com/aurelia/templating-resources/commit/96a2065c6a82743c86827bcb56850afb9b33d4f9)) + * handle promises returned by view-slot ([28338958](http://github.com/aurelia/templating-resources/commit/28338958ccff3d4764687ae4605068aec760410b), closes [#54](http://github.com/aurelia/templating-resources/issues/54)) + + +#### Features + +* **all:** add focus attached behavior ([ecd300ae](http://github.com/aurelia/templating-resources/commit/ecd300ae9f0922cc393cbe9e368ec9be35e1f955)) +* **compose:** suppost syncChildren ([0240d5ca](http://github.com/aurelia/templating-resources/commit/0240d5cad778555312e931813b4131c112e7950f)) +* **docs:** Initial YUIDocs ([745131b0](http://github.com/aurelia/templating-resources/commit/745131b0201cf3a9d9aa14d66a7a68c72b784504)) +* **focus:** set two-way as default binding mode ([96ef5d43](http://github.com/aurelia/templating-resources/commit/96ef5d4333a2dbbb288576cf41ce5a0ad4df99e7)) +* **replaceable:** add the replaceable attribute for use with replaceable parts ([a5a17bc6](http://github.com/aurelia/templating-resources/commit/a5a17bc67d08ff192b98459cdb217a0908d06b5e)) + + ### 0.11.1 (2015-05-06) diff --git a/doc/api.json b/doc/api.json index a514c02..c4c7ff0 100644 --- a/doc/api.json +++ b/doc/api.json @@ -1 +1 @@ -{"classes":[{"name":"Compose","file":"aurelia/templating-resources/src/compose.js","line":7,"description":"Used to compose a new view / view-model template or bind to an existing instance","is_constructor":1,"params":[{"name":"container","description":"The containing container","type":"Container"},{"name":"compositionEngine","description":"The engine used when composing this view","type":"CompositionEngine"},{"name":"viewSlot","description":"The slot the view will be inserted in to","type":"ViewSlot"},{"name":"viewResources","description":"The resources available in the current viewSlot","type":"ViewResources"}],"methods":[{"line":49,"description":"Used to set the executionContext","name":"bind","params":[{"name":"executionContext","description":"The context in which the view model is executed in","type":"ExecutionContext"}]}],"properties":[{"line":21,"description":"Model to bind the custom element to","name":"model","type":"{CustomElement}"},{"line":28,"description":"View to bind the custom element to","name":"view","type":"{HtmlElement}"},{"line":35,"description":"View-model to bind the custom element's template to","name":"viewModel","type":"{Class}"}],"events":[]},{"name":"If","file":"aurelia/templating-resources/src/if.js","line":4,"description":"Binding to conditionally include or not include template logic depending on returned result\n- value should be Boolean or will be treated as such (truthy / falsey)","is_constructor":1,"params":[{"name":"viewFactory","description":"The factory used to create the view","type":"ViewFactory"},{"name":"viewSlot","description":"The slot the view will be inserted in to","type":"ViewSlot"}],"methods":[],"properties":[],"events":[]},{"name":"Repeat","file":"aurelia/templating-resources/src/repeat.js","line":5,"description":"Binding to iterate over an array and repeat a template","is_constructor":1,"params":[{"name":"viewFactory","description":"The factory generating the view","type":"BoundViewFactory"},{"name":"viewSlot","description":"The slot the view is injected in to","type":"ViewSlot"},{"name":"observerLocator","description":"The observer locator instance","type":"ObserverLocator"}],"methods":[],"properties":[{"line":18,"description":"List of items to bind the repeater to","name":"items","type":"{Array}"}],"events":[]},{"name":"SanitizeHtml","file":"aurelia/templating-resources/src/sanitize-html.js","line":5,"description":"Default Html Sanitizer to prevent script injection","is_constructor":1,"methods":[],"properties":[],"events":[]},{"name":"Show","file":"aurelia/templating-resources/src/show.js","line":13,"description":"Binding to conditionally show markup in the DOM based on the value.\n- different from if in that the markup is still added to the DOM, simply not shown","is_constructor":1,"params":[{"name":"element","description":"The element that the to bind to","type":"Element"}],"methods":[],"properties":[],"events":[]}],"methods":[],"properties":[],"events":[]} \ No newline at end of file +{"classes":[{"name":"Compose","file":"aurelia/templating-resources/src/compose.js","line":8,"description":"Used to compose a new view / view-model template or bind to an existing instance","is_constructor":1,"params":[{"name":"container","description":"The containing container","type":"Container"},{"name":"compositionEngine","description":"The engine used when composing this view","type":"CompositionEngine"},{"name":"viewSlot","description":"The slot the view will be inserted in to","type":"ViewSlot"},{"name":"viewResources","description":"The resources available in the current viewSlot","type":"ViewResources"}],"methods":[{"line":52,"description":"Used to set the executionContext","name":"bind","params":[{"name":"executionContext","description":"The context in which the view model is executed in","type":"ExecutionContext"}]}],"properties":[{"line":22,"description":"Model to bind the custom element to","name":"model","type":"{CustomElement}"},{"line":29,"description":"View to bind the custom element to","name":"view","type":"{HtmlElement}"},{"line":36,"description":"View-model to bind the custom element's template to","name":"viewModel","type":"{Class}"}],"events":[]},{"name":"If","file":"aurelia/templating-resources/src/if.js","line":4,"description":"Binding to conditionally include or not include template logic depending on returned result\n- value should be Boolean or will be treated as such (truthy / falsey)","is_constructor":1,"params":[{"name":"viewFactory","description":"The factory used to create the view","type":"ViewFactory"},{"name":"viewSlot","description":"The slot the view will be inserted in to","type":"ViewSlot"}],"methods":[],"properties":[],"events":[]},{"name":"Repeat","file":"aurelia/templating-resources/src/repeat.js","line":5,"description":"Binding to iterate over an array and repeat a template","is_constructor":1,"params":[{"name":"viewFactory","description":"The factory generating the view","type":"BoundViewFactory"},{"name":"viewSlot","description":"The slot the view is injected in to","type":"ViewSlot"},{"name":"observerLocator","description":"The observer locator instance","type":"ObserverLocator"}],"methods":[],"properties":[{"line":18,"description":"List of items to bind the repeater to","name":"items","type":"{Array}"}],"events":[]},{"name":"SanitizeHtml","file":"aurelia/templating-resources/src/sanitize-html.js","line":5,"description":"Default Html Sanitizer to prevent script injection","is_constructor":1,"methods":[],"properties":[],"events":[]},{"name":"Show","file":"aurelia/templating-resources/src/show.js","line":13,"description":"Binding to conditionally show markup in the DOM based on the value.\n- different from if in that the markup is still added to the DOM, simply not shown","is_constructor":1,"params":[{"name":"element","description":"The element that the to bind to","type":"Element"}],"methods":[],"properties":[],"events":[]}],"methods":[],"properties":[],"events":[]} \ No newline at end of file diff --git a/package.json b/package.json index 199078c..2bcab1a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-templating-resources", - "version": "0.11.1", + "version": "0.12.0", "description": "A standard set of behaviors, converters and other resources for use with the Aurelia templating library.", "keywords": [ "aurelia", @@ -25,11 +25,11 @@ "lib": "dist/system" }, "dependencies": { - "aurelia-binding": "github:aurelia/binding@^0.6.1", - "aurelia-dependency-injection": "github:aurelia/dependency-injection@^0.7.1", - "aurelia-logging": "github:aurelia/logging@^0.4.0", - "aurelia-task-queue": "github:aurelia/task-queue@^0.4.0", - "aurelia-templating": "github:aurelia/templating@^0.11.1", + "aurelia-binding": "github:aurelia/binding@^0.7.0", + "aurelia-dependency-injection": "github:aurelia/dependency-injection@^0.8.1", + "aurelia-logging": "github:aurelia/logging@^0.5.0", + "aurelia-task-queue": "github:aurelia/task-queue@^0.5.0", + "aurelia-templating": "github:aurelia/templating@^0.12.0", "core-js": "npm:core-js@^0.9.5" }, "devDependencies": {