Skip to content

Commit

Permalink
chore(all): prepare release 0.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Nov 10, 2015
1 parent 781cdf4 commit ab9f9c9
Show file tree
Hide file tree
Showing 75 changed files with 3,490 additions and 1,675 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.16.1",
"version": "0.17.0",
"description": "A standard set of behaviors, converters and other resources for use with the Aurelia templating library.",
"keywords": [
"aurelia",
Expand Down
96 changes: 96 additions & 0 deletions dist/amd/array-collection-strategy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
define(['exports', './collection-strategy'], function (exports, _collectionStrategy) {
'use strict';

exports.__esModule = true;

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

function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var ArrayCollectionStrategy = (function (_CollectionStrategy) {
_inherits(ArrayCollectionStrategy, _CollectionStrategy);

function ArrayCollectionStrategy() {
_classCallCheck(this, ArrayCollectionStrategy);

_CollectionStrategy.apply(this, arguments);
}

ArrayCollectionStrategy.prototype.processItems = function processItems(items) {
var i = undefined;
var ii = undefined;
var overrideContext = undefined;
var view = undefined;
this.items = items;
for (i = 0, ii = items.length; i < ii; ++i) {
overrideContext = _CollectionStrategy.prototype.createFullOverrideContext.call(this, items[i], i, ii);
view = this.viewFactory.create();
view.bind(undefined, overrideContext);
this.viewSlot.add(view);
}
};

ArrayCollectionStrategy.prototype.getCollectionObserver = function getCollectionObserver(items) {
return this.observerLocator.getArrayObserver(items);
};

ArrayCollectionStrategy.prototype.handleChanges = function handleChanges(array, splices) {
var _this = this;

var removeDelta = 0;
var viewSlot = this.viewSlot;
var rmPromises = [];

for (var i = 0, ii = splices.length; i < ii; ++i) {
var splice = splices[i];
var removed = splice.removed;

for (var j = 0, jj = removed.length; j < jj; ++j) {
var viewOrPromise = viewSlot.removeAt(splice.index + removeDelta + rmPromises.length, true);
if (viewOrPromise instanceof Promise) {
rmPromises.push(viewOrPromise);
}
}
removeDelta -= splice.addedCount;
}

if (rmPromises.length > 0) {
Promise.all(rmPromises).then(function () {
var spliceIndexLow = _this._handleAddedSplices(array, splices);
_this.updateOverrideContexts(spliceIndexLow);
});
} else {
var spliceIndexLow = this._handleAddedSplices(array, splices);
_CollectionStrategy.prototype.updateOverrideContexts.call(this, spliceIndexLow);
}
};

ArrayCollectionStrategy.prototype._handleAddedSplices = function _handleAddedSplices(array, splices) {
var spliceIndex = undefined;
var spliceIndexLow = undefined;
var arrayLength = array.length;
for (var i = 0, ii = splices.length; i < ii; ++i) {
var splice = splices[i];
var addIndex = spliceIndex = splice.index;
var end = splice.index + splice.addedCount;

if (typeof spliceIndexLow === 'undefined' || spliceIndexLow === null || spliceIndexLow > splice.index) {
spliceIndexLow = spliceIndex;
}

for (; addIndex < end; ++addIndex) {
var overrideContext = this.createFullOverrideContext(array[addIndex], addIndex, arrayLength);
var view = this.viewFactory.create();
view.bind(undefined, overrideContext);
this.viewSlot.insert(addIndex, view);
}
}

return spliceIndexLow;
};

return ArrayCollectionStrategy;
})(_collectionStrategy.CollectionStrategy);

exports.ArrayCollectionStrategy = ArrayCollectionStrategy;
});
13 changes: 10 additions & 3 deletions dist/amd/aurelia-templating-resources.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['exports', './compose', './if', './with', './repeat', './show', './global-behavior', './sanitize-html', './replaceable', './focus', './compile-spy', './view-spy', 'aurelia-templating', './dynamic-element', './css-resource', 'aurelia-pal', './html-sanitizer'], function (exports, _compose, _if, _with, _repeat, _show, _globalBehavior, _sanitizeHtml, _replaceable, _focus, _compileSpy, _viewSpy, _aureliaTemplating, _dynamicElement, _cssResource, _aureliaPal, _htmlSanitizer) {
define(['exports', './compose', './if', './with', './repeat', './show', './sanitize-html', './replaceable', './focus', './compile-spy', './view-spy', 'aurelia-templating', './dynamic-element', './css-resource', 'aurelia-pal', './html-sanitizer', './binding-mode-behaviors', './throttle-binding-behavior', './debounce-binding-behavior', './signal-binding-behavior', './binding-signaler', './update-trigger-binding-behavior'], function (exports, _compose, _if, _with, _repeat, _show, _sanitizeHtml, _replaceable, _focus, _compileSpy, _viewSpy, _aureliaTemplating, _dynamicElement, _cssResource, _aureliaPal, _htmlSanitizer, _bindingModeBehaviors, _throttleBindingBehavior, _debounceBindingBehavior, _signalBindingBehavior, _bindingSignaler, _updateTriggerBindingBehavior) {
'use strict';

exports.__esModule = true;
Expand All @@ -10,7 +10,7 @@ define(['exports', './compose', './if', './with', './repeat', './show', './globa
_aureliaPal.DOM.injectStyles('.aurelia-hide { display:none !important; }');
}

config.globalResources('./compose', './if', './with', './repeat', './show', './replaceable', './global-behavior', './sanitize-html', './focus', './compile-spy', './view-spy');
config.globalResources('./compose', './if', './with', './repeat', './show', './replaceable', './sanitize-html', './focus', './compile-spy', './view-spy', './binding-mode-behaviors', './throttle-binding-behavior', './debounce-binding-behavior', './signal-binding-behavior', './update-trigger-binding-behavior');

var viewEngine = config.container.get(_aureliaTemplating.ViewEngine);
var loader = config.aurelia.loader;
Expand Down Expand Up @@ -58,10 +58,17 @@ define(['exports', './compose', './if', './with', './repeat', './show', './globa
exports.Show = _show.Show;
exports.HTMLSanitizer = _htmlSanitizer.HTMLSanitizer;
exports.SanitizeHTMLValueConverter = _sanitizeHtml.SanitizeHTMLValueConverter;
exports.GlobalBehavior = _globalBehavior.GlobalBehavior;
exports.Replaceable = _replaceable.Replaceable;
exports.Focus = _focus.Focus;
exports.CompileSpy = _compileSpy.CompileSpy;
exports.ViewSpy = _viewSpy.ViewSpy;
exports.configure = configure;
exports.OneTimeBindingBehavior = _bindingModeBehaviors.OneTimeBindingBehavior;
exports.OneWayBindingBehavior = _bindingModeBehaviors.OneWayBindingBehavior;
exports.TwoWayBindingBehavior = _bindingModeBehaviors.TwoWayBindingBehavior;
exports.ThrottleBindingBehavior = _throttleBindingBehavior.ThrottleBindingBehavior;
exports.DebounceBindingBehavior = _debounceBindingBehavior.DebounceBindingBehavior;
exports.SignalBindingBehavior = _signalBindingBehavior.SignalBindingBehavior;
exports.BindingSignaler = _bindingSignaler.BindingSignaler;
exports.UpdateTriggerBindingBehavior = _updateTriggerBindingBehavior.UpdateTriggerBindingBehavior;
});
71 changes: 71 additions & 0 deletions dist/amd/binding-mode-behaviors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
define(['exports', 'aurelia-binding'], function (exports, _aureliaBinding) {
'use strict';

exports.__esModule = true;

function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

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

var ModeBindingBehavior = (function () {
function ModeBindingBehavior(mode) {
_classCallCheck(this, ModeBindingBehavior);

this.mode = mode;
}

ModeBindingBehavior.prototype.bind = function bind(binding, source, lookupFunctions) {
binding.originalMode = binding.mode;
binding.mode = this.mode;
};

ModeBindingBehavior.prototype.unbind = function unbind(binding, source) {
binding.mode = binding.originalMode;
binding.originalMode = null;
};

return ModeBindingBehavior;
})();

var OneTimeBindingBehavior = (function (_ModeBindingBehavior) {
_inherits(OneTimeBindingBehavior, _ModeBindingBehavior);

function OneTimeBindingBehavior() {
_classCallCheck(this, OneTimeBindingBehavior);

_ModeBindingBehavior.call(this, _aureliaBinding.bindingMode.oneTime);
}

return OneTimeBindingBehavior;
})(ModeBindingBehavior);

exports.OneTimeBindingBehavior = OneTimeBindingBehavior;

var OneWayBindingBehavior = (function (_ModeBindingBehavior2) {
_inherits(OneWayBindingBehavior, _ModeBindingBehavior2);

function OneWayBindingBehavior() {
_classCallCheck(this, OneWayBindingBehavior);

_ModeBindingBehavior2.call(this, _aureliaBinding.bindingMode.oneWay);
}

return OneWayBindingBehavior;
})(ModeBindingBehavior);

exports.OneWayBindingBehavior = OneWayBindingBehavior;

var TwoWayBindingBehavior = (function (_ModeBindingBehavior3) {
_inherits(TwoWayBindingBehavior, _ModeBindingBehavior3);

function TwoWayBindingBehavior() {
_classCallCheck(this, TwoWayBindingBehavior);

_ModeBindingBehavior3.call(this, _aureliaBinding.bindingMode.twoWay);
}

return TwoWayBindingBehavior;
})(ModeBindingBehavior);

exports.TwoWayBindingBehavior = TwoWayBindingBehavior;
});
30 changes: 30 additions & 0 deletions dist/amd/binding-signaler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
define(['exports', 'aurelia-binding'], function (exports, _aureliaBinding) {
'use strict';

exports.__esModule = true;

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

var BindingSignaler = (function () {
function BindingSignaler() {
_classCallCheck(this, BindingSignaler);

this.signals = {};
}

BindingSignaler.prototype.signal = function signal(name) {
var bindings = this.signals[name];
if (!bindings) {
return;
}
var i = bindings.length;
while (i--) {
bindings[i].call(_aureliaBinding.sourceContext);
}
};

return BindingSignaler;
})();

exports.BindingSignaler = BindingSignaler;
});
50 changes: 50 additions & 0 deletions dist/amd/collection-strategy-locator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
define(['exports', 'aurelia-dependency-injection', './array-collection-strategy', './map-collection-strategy', './number-strategy'], function (exports, _aureliaDependencyInjection, _arrayCollectionStrategy, _mapCollectionStrategy, _numberStrategy) {
'use strict';

exports.__esModule = true;

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

var CollectionStrategyLocator = (function () {
function CollectionStrategyLocator(container) {
_classCallCheck(this, _CollectionStrategyLocator);

this.container = container;
this.strategies = [];
this.matchers = [];

this.addStrategy(_arrayCollectionStrategy.ArrayCollectionStrategy, function (items) {
return items instanceof Array;
});
this.addStrategy(_mapCollectionStrategy.MapCollectionStrategy, function (items) {
return items instanceof Map;
});
this.addStrategy(_numberStrategy.NumberStrategy, function (items) {
return typeof items === 'number';
});
}

CollectionStrategyLocator.prototype.addStrategy = function addStrategy(collectionStrategy, matcher) {
this.strategies.push(collectionStrategy);
this.matchers.push(matcher);
};

CollectionStrategyLocator.prototype.getStrategy = function getStrategy(items) {
var matchers = this.matchers;

for (var i = 0, ii = matchers.length; i < ii; ++i) {
if (matchers[i](items)) {
return this.container.get(this.strategies[i]);
}
}

throw new Error('Object in "repeat" must have a valid collection strategy.');
};

var _CollectionStrategyLocator = CollectionStrategyLocator;
CollectionStrategyLocator = _aureliaDependencyInjection.inject(_aureliaDependencyInjection.Container)(CollectionStrategyLocator) || CollectionStrategyLocator;
return CollectionStrategyLocator;
})();

exports.CollectionStrategyLocator = CollectionStrategyLocator;
});
90 changes: 90 additions & 0 deletions dist/amd/collection-strategy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
define(['exports', 'aurelia-dependency-injection', 'aurelia-binding'], function (exports, _aureliaDependencyInjection, _aureliaBinding) {
'use strict';

exports.__esModule = true;

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

var CollectionStrategy = (function () {
function CollectionStrategy(observerLocator) {
_classCallCheck(this, _CollectionStrategy);

this.observerLocator = observerLocator;
}

CollectionStrategy.prototype.initialize = function initialize(repeat, bindingContext, overrideContext) {
this.viewFactory = repeat.viewFactory;
this.viewSlot = repeat.viewSlot;
this.items = repeat.items;
this.local = repeat.local;
this.key = repeat.key;
this.value = repeat.value;
this.bindingContext = bindingContext;
this.overrideContext = overrideContext;
};

CollectionStrategy.prototype.dispose = function dispose() {
this.viewFactory = null;
this.viewSlot = null;
this.items = null;
this.local = null;
this.key = null;
this.value = null;
this.bindingContext = null;
this.overrideContext = null;
};

CollectionStrategy.prototype.updateOverrideContexts = function updateOverrideContexts(startIndex) {
var children = this.viewSlot.children;
var length = children.length;

if (startIndex > 0) {
startIndex = startIndex - 1;
}

for (; startIndex < length; ++startIndex) {
this.updateOverrideContext(children[startIndex].overrideContext, startIndex, length);
}
};

CollectionStrategy.prototype.createFullOverrideContext = function createFullOverrideContext(data, index, length, key) {
var context = this.createBaseOverrideContext(data, key);
return this.updateOverrideContext(context, index, length);
};

CollectionStrategy.prototype.createBaseOverrideContext = function createBaseOverrideContext(data, key) {
var context = _aureliaBinding.createOverrideContext(undefined, this.overrideContext);

if (typeof key !== 'undefined') {
context[this.key] = key;
context[this.value] = data;
} else {
context[this.local] = data;
}

return context;
};

CollectionStrategy.prototype.updateOverrideContext = function updateOverrideContext(context, index, length) {
var first = index === 0;
var last = index === length - 1;
var even = index % 2 === 0;

context.$index = index;
context.$first = first;
context.$last = last;
context.$middle = !(first || last);
context.$odd = !even;
context.$even = even;

return context;
};

var _CollectionStrategy = CollectionStrategy;
CollectionStrategy = _aureliaDependencyInjection.transient()(CollectionStrategy) || CollectionStrategy;
CollectionStrategy = _aureliaDependencyInjection.inject(_aureliaBinding.ObserverLocator)(CollectionStrategy) || CollectionStrategy;
return CollectionStrategy;
})();

exports.CollectionStrategy = CollectionStrategy;
});
Loading

0 comments on commit ab9f9c9

Please sign in to comment.