Skip to content

Commit

Permalink
chore(all): prepare release 1.0.0-beta.1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jan 9, 2016
1 parent 871b380 commit 7816b7b
Show file tree
Hide file tree
Showing 35 changed files with 1,801 additions and 453 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-templating-resources",
"version": "1.0.0-beta.1.0.3",
"version": "1.0.0-beta.1.0.4",
"description": "A standard set of behaviors, converters and other resources for use with the Aurelia templating library.",
"keywords": [
"aurelia",
Expand Down
45 changes: 23 additions & 22 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ System.config({
},

map: {
"aurelia-binding": "npm:[email protected].3",
"aurelia-dependency-injection": "npm:[email protected]",
"aurelia-loader": "npm:[email protected]",
"aurelia-binding": "npm:[email protected].5",
"aurelia-dependency-injection": "npm:[email protected].0.1",
"aurelia-loader": "npm:[email protected].0.1",
"aurelia-logging": "npm:[email protected]",
"aurelia-metadata": "npm:[email protected]",
"aurelia-pal": "npm:[email protected].1",
"aurelia-pal-browser": "npm:[email protected].1",
"aurelia-pal": "npm:[email protected].2",
"aurelia-pal-browser": "npm:[email protected].3",
"aurelia-path": "npm:[email protected]",
"aurelia-task-queue": "npm:[email protected]",
"aurelia-templating": "npm:[email protected].2",
"aurelia-templating": "npm:[email protected].3",
"aurelia-templating-binding": "npm:[email protected]",
"babel": "npm:[email protected]",
"babel-runtime": "npm:[email protected]",
Expand All @@ -44,44 +44,45 @@ System.config({
"npm:[email protected]": {
"util": "npm:[email protected]"
},
"npm:[email protected].3": {
"npm:[email protected].5": {
"aurelia-metadata": "npm:[email protected]",
"aurelia-pal": "npm:[email protected].1",
"aurelia-pal": "npm:[email protected].2",
"aurelia-task-queue": "npm:[email protected]",
"core-js": "npm:[email protected]"
},
"npm:[email protected]": {
"npm:[email protected].0.1": {
"aurelia-logging": "npm:[email protected]",
"aurelia-metadata": "npm:[email protected]",
"aurelia-pal": "npm:[email protected].1",
"aurelia-pal": "npm:[email protected].2",
"core-js": "npm:[email protected]"
},
"npm:[email protected]": {
"npm:[email protected].0.1": {
"aurelia-metadata": "npm:[email protected]",
"aurelia-path": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-pal": "npm:[email protected].1",
"aurelia-pal": "npm:[email protected].2",
"core-js": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-pal": "npm:[email protected]"
"npm:[email protected]": {
"aurelia-pal": "npm:[email protected]",
"core-js": "npm:[email protected]"
},
"npm:[email protected]": {
"aurelia-pal": "npm:[email protected].1"
"aurelia-pal": "npm:[email protected].2"
},
"npm:[email protected]": {
"aurelia-binding": "npm:[email protected].3",
"aurelia-binding": "npm:[email protected].5",
"aurelia-logging": "npm:[email protected]",
"aurelia-templating": "npm:[email protected].2"
"aurelia-templating": "npm:[email protected].3"
},
"npm:[email protected].2": {
"aurelia-binding": "npm:[email protected].3",
"aurelia-dependency-injection": "npm:[email protected]",
"aurelia-loader": "npm:[email protected]",
"npm:[email protected].3": {
"aurelia-binding": "npm:[email protected].5",
"aurelia-dependency-injection": "npm:[email protected].0.1",
"aurelia-loader": "npm:[email protected].0.1",
"aurelia-logging": "npm:[email protected]",
"aurelia-metadata": "npm:[email protected]",
"aurelia-pal": "npm:[email protected].1",
"aurelia-pal": "npm:[email protected].2",
"aurelia-path": "npm:[email protected]",
"aurelia-task-queue": "npm:[email protected]",
"core-js": "npm:[email protected]"
Expand Down
50 changes: 44 additions & 6 deletions dist/amd/array-repeat-strategy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['exports', './repeat-utilities'], function (exports, _repeatUtilities) {
define(['exports', './repeat-utilities', 'aurelia-binding'], function (exports, _repeatUtilities, _aureliaBinding) {
'use strict';

exports.__esModule = true;
Expand Down Expand Up @@ -96,6 +96,44 @@ define(['exports', './repeat-utilities'], function (exports, _repeatUtilities) {
ArrayRepeatStrategy.prototype._standardProcessInstanceMutated = function _standardProcessInstanceMutated(repeat, array, splices) {
var _this2 = this;

if (repeat.__queuedSplices) {
for (var i = 0, ii = splices.length; i < ii; ++i) {
var _splices$i = splices[i];
var index = _splices$i.index;
var removed = _splices$i.removed;
var addedCount = _splices$i.addedCount;

_aureliaBinding.mergeSplice(repeat.__queuedSplices, index, removed, addedCount);
}
repeat.__array = array.slice(0);
return;
}

var maybePromise = this._runSplices(repeat, array, splices);
if (maybePromise instanceof Promise) {
(function () {
var queuedSplices = repeat.__queuedSplices = [];

var runQueuedSplices = function runQueuedSplices() {
if (!queuedSplices.length) {
delete repeat.__queuedSplices;
delete repeat.__array;
return;
}

var nextPromise = _this2._runSplices(repeat, repeat.__array, queuedSplices) || Promise.resolve();
queuedSplices = repeat.__queuedSplices = [];
nextPromise.then(runQueuedSplices);
};

maybePromise.then(runQueuedSplices);
})();
}
};

ArrayRepeatStrategy.prototype._runSplices = function _runSplices(repeat, array, splices) {
var _this3 = this;

var removeDelta = 0;
var viewSlot = repeat.viewSlot;
var rmPromises = [];
Expand All @@ -114,14 +152,14 @@ define(['exports', './repeat-utilities'], function (exports, _repeatUtilities) {
}

if (rmPromises.length > 0) {
Promise.all(rmPromises).then(function () {
var spliceIndexLow = _this2._handleAddedSplices(repeat, array, splices);
return Promise.all(rmPromises).then(function () {
var spliceIndexLow = _this3._handleAddedSplices(repeat, array, splices);
_repeatUtilities.updateOverrideContexts(repeat.viewSlot.children, spliceIndexLow);
});
} else {
var spliceIndexLow = this._handleAddedSplices(repeat, array, splices);
_repeatUtilities.updateOverrideContexts(repeat.viewSlot.children, spliceIndexLow);
}

var spliceIndexLow = this._handleAddedSplices(repeat, array, splices);
_repeatUtilities.updateOverrideContexts(repeat.viewSlot.children, spliceIndexLow);
};

ArrayRepeatStrategy.prototype._handleAddedSplices = function _handleAddedSplices(repeat, array, splices) {
Expand Down
40 changes: 36 additions & 4 deletions dist/amd/aurelia-templating-resources.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
declare module 'aurelia-templating-resources' {
import * as LogManager from 'aurelia-logging';
import { inject, Container } from 'aurelia-dependency-injection';
import { BoundViewFactory, ViewSlot, customAttribute, templateController, Animator, useView, customElement, bindable, ViewResources, resource, ViewCompileInstruction, CompositionEngine, noView, TargetInstruction, ViewEngine } from 'aurelia-templating';
import { createOverrideContext, bindingMode, EventManager, BindingBehavior, ValueConverter, sourceContext, valueConverter, ObserverLocator } from 'aurelia-binding';
import { BoundViewFactory, ViewSlot, customAttribute, templateController, Animator, useView, customElement, bindable, ViewResources, resource, ViewCompileInstruction, CompositionEngine, noView, View, TargetInstruction, ViewEngine } from 'aurelia-templating';
import { createOverrideContext, bindingMode, EventManager, BindingBehavior, ValueConverter, sourceContext, mergeSplice, valueConverter, ObserverLocator } from 'aurelia-binding';
import { DOM, FEATURE } from 'aurelia-pal';
import { TaskQueue } from 'aurelia-task-queue';
import { Loader } from 'aurelia-loader';
Expand Down Expand Up @@ -307,11 +307,18 @@ declare module 'aurelia-templating-resources' {
*/
constructor(element: any, container: any, compositionEngine: any, viewSlot: any, viewResources: any, taskQueue: any);

/**
* Invoked when the component has been created.
*
* @param owningView The view that this component was created inside of.
*/
created(owningView: View): any;

/**
* Used to set the bindingContext.
*
* @param {bindingContext} bindingContext The context in which the view model is executed in.
* @param {overrideContext} overrideContext The context in which the view model is executed in.
* @param bindingContext The context in which the view model is executed in.
* @param overrideContext The context in which the view model is executed in.
*/
bind(bindingContext: any, overrideContext: any): any;

Expand Down Expand Up @@ -452,6 +459,31 @@ declare module 'aurelia-templating-resources' {
instanceChanged(repeat: any, value: any): any;
}

/**
* A strategy for repeating a template over a Set.
*/
export class SetRepeatStrategy {

/**
* Gets a Set observer.
* @param items The items to be observed.
*/
getCollectionObserver(observerLocator: any, items: any): any;

/**
* Process the provided Set entries.
* @param items The entries to process.
*/
instanceChanged(repeat: any, items: any): any;

/**
* Handle changes in a Set collection.
* @param map The underlying Set collection.
* @param records The change records.
*/
instanceMutated(repeat: any, set: any, records: any): any;
}

/**
* Simple html sanitization converter to preserve whitelisted elements and attributes on a bound property containing html.
*/
Expand Down
4 changes: 2 additions & 2 deletions dist/amd/aurelia-templating-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ define(['exports', './compose', './if', './with', './repeat', './show', './sanit
bindable = [];
}

return (_ref = {}, _ref[elementName] = _dynamicElement._createDynamicElement(elementName, address, bindable), _ref);
return _ref = {}, _ref[elementName] = _dynamicElement._createDynamicElement(elementName, address, bindable), _ref;
});
}
});
Expand All @@ -46,7 +46,7 @@ define(['exports', './compose', './if', './with', './repeat', './show', './sanit
'fetch': function fetch(address) {
var _ref2;

return (_ref2 = {}, _ref2[address] = _cssResource._createCSSResource(address), _ref2);
return _ref2 = {}, _ref2[address] = _cssResource._createCSSResource(address), _ref2;
}
});
}
Expand Down
5 changes: 5 additions & 0 deletions dist/amd/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-task-queue', 'aureli
this.currentViewModel = null;
}

Compose.prototype.created = function created(owningView) {
this.owningView = owningView;
};

Compose.prototype.bind = function bind(bindingContext, overrideContext) {
this.bindingContext = bindingContext;
this.overrideContext = overrideContext;
Expand Down Expand Up @@ -141,6 +145,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-task-queue', 'aureli
return Object.assign(instruction, {
bindingContext: composer.bindingContext,
overrideContext: composer.overrideContext,
owningView: composer.owningView,
container: composer.container,
viewSlot: composer.viewSlot,
viewResources: composer.viewResources,
Expand Down
5 changes: 4 additions & 1 deletion dist/amd/repeat-strategy-locator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['exports', './null-repeat-strategy', './array-repeat-strategy', './map-repeat-strategy', './number-repeat-strategy'], function (exports, _nullRepeatStrategy, _arrayRepeatStrategy, _mapRepeatStrategy, _numberRepeatStrategy) {
define(['exports', './null-repeat-strategy', './array-repeat-strategy', './map-repeat-strategy', './set-repeat-strategy', './number-repeat-strategy'], function (exports, _nullRepeatStrategy, _arrayRepeatStrategy, _mapRepeatStrategy, _setRepeatStrategy, _numberRepeatStrategy) {
'use strict';

exports.__esModule = true;
Expand All @@ -21,6 +21,9 @@ define(['exports', './null-repeat-strategy', './array-repeat-strategy', './map-r
this.addStrategy(function (items) {
return items instanceof Map;
}, new _mapRepeatStrategy.MapRepeatStrategy());
this.addStrategy(function (items) {
return items instanceof Set;
}, new _setRepeatStrategy.SetRepeatStrategy());
this.addStrategy(function (items) {
return typeof items === 'number';
}, new _numberRepeatStrategy.NumberRepeatStrategy());
Expand Down
110 changes: 110 additions & 0 deletions dist/amd/set-repeat-strategy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
define(['exports', './repeat-utilities'], function (exports, _repeatUtilities) {
'use strict';

exports.__esModule = true;

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

var SetRepeatStrategy = (function () {
function SetRepeatStrategy() {
_classCallCheck(this, SetRepeatStrategy);
}

SetRepeatStrategy.prototype.getCollectionObserver = function getCollectionObserver(observerLocator, items) {
return observerLocator.getSetObserver(items);
};

SetRepeatStrategy.prototype.instanceChanged = function instanceChanged(repeat, items) {
var _this = this;

var removePromise = repeat.viewSlot.removeAll(true);
if (removePromise instanceof Promise) {
removePromise.then(function () {
return _this._standardProcessItems(repeat, items);
});
return;
}
this._standardProcessItems(repeat, items);
};

SetRepeatStrategy.prototype._standardProcessItems = function _standardProcessItems(repeat, items) {
var viewFactory = repeat.viewFactory;
var viewSlot = repeat.viewSlot;
var index = 0;
var overrideContext = undefined;
var view = undefined;

items.forEach(function (value) {
overrideContext = _repeatUtilities.createFullOverrideContext(repeat, value, index, items.size);
view = viewFactory.create();
view.bind(overrideContext.bindingContext, overrideContext);
viewSlot.add(view);
++index;
});
};

SetRepeatStrategy.prototype.instanceMutated = function instanceMutated(repeat, set, records) {
var viewSlot = repeat.viewSlot;
var value = undefined;
var i = undefined;
var ii = undefined;
var view = undefined;
var overrideContext = undefined;
var removeIndex = undefined;
var record = undefined;
var rmPromises = [];
var viewOrPromise = undefined;

for (i = 0, ii = records.length; i < ii; ++i) {
record = records[i];
value = record.value;
switch (record.type) {
case 'add':
overrideContext = _repeatUtilities.createFullOverrideContext(repeat, value, set.size - 1, set.size);
view = repeat.viewFactory.create();
view.bind(overrideContext.bindingContext, overrideContext);
viewSlot.insert(set.size - 1, view);
break;
case 'delete':
removeIndex = this._getViewIndexByValue(repeat, value);
viewOrPromise = viewSlot.removeAt(removeIndex, true);
if (viewOrPromise instanceof Promise) {
rmPromises.push(viewOrPromise);
}
break;
case 'clear':
viewSlot.removeAll(true);
break;
default:
continue;
}
}

if (rmPromises.length > 0) {
Promise.all(rmPromises).then(function () {
_repeatUtilities.updateOverrideContexts(repeat.viewSlot.children, 0);
});
} else {
_repeatUtilities.updateOverrideContexts(repeat.viewSlot.children, 0);
}
};

SetRepeatStrategy.prototype._getViewIndexByValue = function _getViewIndexByValue(repeat, value) {
var viewSlot = repeat.viewSlot;
var i = undefined;
var ii = undefined;
var child = undefined;

for (i = 0, ii = viewSlot.children.length; i < ii; ++i) {
child = viewSlot.children[i];
if (child.bindingContext[repeat.local] === value) {
return i;
}
}
};

return SetRepeatStrategy;
})();

exports.SetRepeatStrategy = SetRepeatStrategy;
});
Loading

0 comments on commit 7816b7b

Please sign in to comment.