Skip to content

Commit

Permalink
chore(all): prepare release 0.17.1
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Nov 12, 2015
1 parent 80cebd8 commit 5fdb3a4
Show file tree
Hide file tree
Showing 11 changed files with 185 additions and 54 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": "0.17.0",
"version": "0.17.1",
"description": "A standard set of behaviors, converters and other resources for use with the Aurelia templating library.",
"keywords": [
"aurelia",
Expand Down
16 changes: 13 additions & 3 deletions dist/amd/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,24 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-task-queue', 'aureli
this.currentViewModel = null;
}

Compose.prototype.bind = function bind(bindingContext) {
this.$parent = bindingContext;
Compose.prototype.bind = function bind(bindingContext, overrideContext) {
this.bindingContext = bindingContext;
this.overrideContext = overrideContext;
processInstruction(this, createInstruction(this, {
view: this.view,
viewModel: this.viewModel,
model: this.model
}));
};

Compose.prototype.unbind = function unbind(bindingContext, overrideContext) {
this.bindingContext = null;
this.overrideContext = null;
var returnToCache = true;
var skipAnimation = true;
this.viewSlot.removeAll(returnToCache, skipAnimation);
};

Compose.prototype.modelChanged = function modelChanged(newValue, oldValue) {
var _this = this;

Expand Down Expand Up @@ -130,7 +139,8 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-task-queue', 'aureli

function createInstruction(composer, instruction) {
return Object.assign(instruction, {
bindingContext: composer.$parent,
bindingContext: composer.bindingContext,
overrideContext: composer.overrideContext,
container: composer.container,
viewSlot: composer.viewSlot,
viewResources: composer.viewResources,
Expand Down
40 changes: 30 additions & 10 deletions dist/amd/repeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
this.key = 'key';
this.value = 'value';
this.collectionStrategyLocator = collectionStrategyLocator;
this.ignoreMutation = false;
}

Repeat.prototype.call = function call(context, changes) {
Expand All @@ -62,21 +63,20 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t

Repeat.prototype.bind = function bind(bindingContext, overrideContext) {
var items = this.items;
this.sourceExpression = getSourceExpression(this.instruction, 'repeat.for');
this.scope = { bindingContext: bindingContext, overrideContext: overrideContext };
if (items === undefined || items === null) {
return;
}

this.sourceExpression = getSourceExpression(this.instruction, 'repeat.for');
this.scope = { bindingContext: bindingContext, overrideContext: overrideContext };
this.collectionStrategy = this.collectionStrategyLocator.getStrategy(this.items);
this.collectionStrategy.initialize(this, bindingContext, overrideContext);
this.processItems();
};

Repeat.prototype.unbind = function unbind() {
this.sourceExpression = null;
this.scope = null;
this.collectionStrategy.dispose();
if (this.collectionStrategy) {
this.collectionStrategy.dispose();
}
this.items = null;
this.collectionStrategy = null;
this.viewSlot.removeAll(true);
Expand All @@ -99,17 +99,27 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
var _this = this;

var items = this.items;
var rmPromise = undefined;

if (this.collectionObserver) {
this.unsubscribeCollection();
rmPromise = this.viewSlot.removeAll(true);
this.unsubscribeCollection();
var rmPromise = this.viewSlot.removeAll(true);
if (this.collectionStrategy) {
this.collectionStrategy.dispose();
}

if (!items && items !== 0) {
return;
}

var bindingContext = undefined;
var overrideContext = undefined;
if (this.scope) {
bindingContext = this.scope.bindingContext;
overrideContext = this.scope.overrideContext;
}

this.collectionStrategy = this.collectionStrategyLocator.getStrategy(items);
this.collectionStrategy.initialize(this, bindingContext, overrideContext);

if (rmPromise instanceof Promise) {
rmPromise.then(function () {
_this.processItemsByStrategy();
Expand Down Expand Up @@ -162,7 +172,17 @@ define(['exports', 'aurelia-dependency-injection', 'aurelia-binding', 'aurelia-t
};

Repeat.prototype.handleInnerCollectionChanges = function handleInnerCollectionChanges(collection, changes) {
var _this2 = this;

if (this.ignoreMutation) {
return;
}
this.ignoreMutation = true;
var newItems = this.sourceExpression.evaluate(this.scope, this.lookupFunctions);
this.observerLocator.taskQueue.queueMicroTask(function () {
return _this2.ignoreMutation = false;
});

if (newItems === this.items) {
return;
}
Expand Down
16 changes: 13 additions & 3 deletions dist/commonjs/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,24 @@ var Compose = (function () {
this.currentViewModel = null;
}

Compose.prototype.bind = function bind(bindingContext) {
this.$parent = bindingContext;
Compose.prototype.bind = function bind(bindingContext, overrideContext) {
this.bindingContext = bindingContext;
this.overrideContext = overrideContext;
processInstruction(this, createInstruction(this, {
view: this.view,
viewModel: this.viewModel,
model: this.model
}));
};

Compose.prototype.unbind = function unbind(bindingContext, overrideContext) {
this.bindingContext = null;
this.overrideContext = null;
var returnToCache = true;
var skipAnimation = true;
this.viewSlot.removeAll(returnToCache, skipAnimation);
};

Compose.prototype.modelChanged = function modelChanged(newValue, oldValue) {
var _this = this;

Expand Down Expand Up @@ -137,7 +146,8 @@ exports.Compose = Compose;

function createInstruction(composer, instruction) {
return Object.assign(instruction, {
bindingContext: composer.$parent,
bindingContext: composer.bindingContext,
overrideContext: composer.overrideContext,
container: composer.container,
viewSlot: composer.viewSlot,
viewResources: composer.viewResources,
Expand Down
40 changes: 30 additions & 10 deletions dist/commonjs/repeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ var Repeat = (function () {
this.key = 'key';
this.value = 'value';
this.collectionStrategyLocator = collectionStrategyLocator;
this.ignoreMutation = false;
}

Repeat.prototype.call = function call(context, changes) {
Expand All @@ -69,21 +70,20 @@ var Repeat = (function () {

Repeat.prototype.bind = function bind(bindingContext, overrideContext) {
var items = this.items;
this.sourceExpression = getSourceExpression(this.instruction, 'repeat.for');
this.scope = { bindingContext: bindingContext, overrideContext: overrideContext };
if (items === undefined || items === null) {
return;
}

this.sourceExpression = getSourceExpression(this.instruction, 'repeat.for');
this.scope = { bindingContext: bindingContext, overrideContext: overrideContext };
this.collectionStrategy = this.collectionStrategyLocator.getStrategy(this.items);
this.collectionStrategy.initialize(this, bindingContext, overrideContext);
this.processItems();
};

Repeat.prototype.unbind = function unbind() {
this.sourceExpression = null;
this.scope = null;
this.collectionStrategy.dispose();
if (this.collectionStrategy) {
this.collectionStrategy.dispose();
}
this.items = null;
this.collectionStrategy = null;
this.viewSlot.removeAll(true);
Expand All @@ -106,17 +106,27 @@ var Repeat = (function () {
var _this = this;

var items = this.items;
var rmPromise = undefined;

if (this.collectionObserver) {
this.unsubscribeCollection();
rmPromise = this.viewSlot.removeAll(true);
this.unsubscribeCollection();
var rmPromise = this.viewSlot.removeAll(true);
if (this.collectionStrategy) {
this.collectionStrategy.dispose();
}

if (!items && items !== 0) {
return;
}

var bindingContext = undefined;
var overrideContext = undefined;
if (this.scope) {
bindingContext = this.scope.bindingContext;
overrideContext = this.scope.overrideContext;
}

this.collectionStrategy = this.collectionStrategyLocator.getStrategy(items);
this.collectionStrategy.initialize(this, bindingContext, overrideContext);

if (rmPromise instanceof Promise) {
rmPromise.then(function () {
_this.processItemsByStrategy();
Expand Down Expand Up @@ -169,7 +179,17 @@ var Repeat = (function () {
};

Repeat.prototype.handleInnerCollectionChanges = function handleInnerCollectionChanges(collection, changes) {
var _this2 = this;

if (this.ignoreMutation) {
return;
}
this.ignoreMutation = true;
var newItems = this.sourceExpression.evaluate(this.scope, this.lookupFunctions);
this.observerLocator.taskQueue.queueMicroTask(function () {
return _this2.ignoreMutation = false;
});

if (newItems === this.items) {
return;
}
Expand Down
17 changes: 14 additions & 3 deletions dist/es6/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,26 @@ export class Compose {
*
* @method bind
* @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
*/
bind(bindingContext) {
this.$parent = bindingContext;
bind(bindingContext, overrideContext) {
this.bindingContext = bindingContext;
this.overrideContext = overrideContext;
processInstruction(this, createInstruction(this, {
view: this.view,
viewModel: this.viewModel,
model: this.model
}));
}

unbind(bindingContext, overrideContext) {
this.bindingContext = null;
this.overrideContext = null;
let returnToCache = true;
let skipAnimation = true;
this.viewSlot.removeAll(returnToCache, skipAnimation);
}

modelChanged(newValue, oldValue) {
if (this.currentInstruction) {
this.currentInstruction.model = newValue;
Expand Down Expand Up @@ -123,7 +133,8 @@ export class Compose {

function createInstruction(composer, instruction) {
return Object.assign(instruction, {
bindingContext: composer.$parent,
bindingContext: composer.bindingContext,
overrideContext: composer.overrideContext,
container: composer.container,
viewSlot: composer.viewSlot,
viewResources: composer.viewResources,
Expand Down
39 changes: 29 additions & 10 deletions dist/es6/repeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class Repeat {
this.key = 'key';
this.value = 'value';
this.collectionStrategyLocator = collectionStrategyLocator;
this.ignoreMutation = false;
}

call(context, changes) {
Expand All @@ -60,21 +61,20 @@ export class Repeat {

bind(bindingContext, overrideContext) {
let items = this.items;
this.sourceExpression = getSourceExpression(this.instruction, 'repeat.for');
this.scope = { bindingContext, overrideContext };
if (items === undefined || items === null) {
return;
}

this.sourceExpression = getSourceExpression(this.instruction, 'repeat.for');
this.scope = { bindingContext, overrideContext };
this.collectionStrategy = this.collectionStrategyLocator.getStrategy(this.items);
this.collectionStrategy.initialize(this, bindingContext, overrideContext);
this.processItems();
}

unbind() {
this.sourceExpression = null;
this.scope = null;
this.collectionStrategy.dispose();
if (this.collectionStrategy) {
this.collectionStrategy.dispose();
}
this.items = null;
this.collectionStrategy = null;
this.viewSlot.removeAll(true);
Expand All @@ -95,17 +95,27 @@ export class Repeat {

processItems() {
let items = this.items;
let rmPromise;

if (this.collectionObserver) {
this.unsubscribeCollection();
rmPromise = this.viewSlot.removeAll(true);
this.unsubscribeCollection();
let rmPromise = this.viewSlot.removeAll(true);
if (this.collectionStrategy) {
this.collectionStrategy.dispose();
}

if (!items && items !== 0) {
return;
}

let bindingContext;
let overrideContext;
if (this.scope) {
bindingContext = this.scope.bindingContext;
overrideContext = this.scope.overrideContext;
}

this.collectionStrategy = this.collectionStrategyLocator.getStrategy(items);
this.collectionStrategy.initialize(this, bindingContext, overrideContext);

if (rmPromise instanceof Promise) {
rmPromise.then(() => {
this.processItemsByStrategy();
Expand Down Expand Up @@ -158,7 +168,16 @@ export class Repeat {
}

handleInnerCollectionChanges(collection, changes) {
// guard against source expressions that have observable side-effects that could
// cause an infinite loop- eg a value converter that mutates the source array.
if (this.ignoreMutation) {
return;
}
this.ignoreMutation = true;
let newItems = this.sourceExpression.evaluate(this.scope, this.lookupFunctions);
this.observerLocator.taskQueue.queueMicroTask(() => this.ignoreMutation = false);

// collection change?
if (newItems === this.items) {
return;
}
Expand Down
Loading

0 comments on commit 5fdb3a4

Please sign in to comment.