Skip to content

Commit

Permalink
chore(all): prepare release 0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jan 22, 2015
1 parent 3f77813 commit 8125436
Show file tree
Hide file tree
Showing 31 changed files with 704 additions and 277 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.7.0",
"version": "0.8.0",
"description": "A standard set of behaviors, converters and other resources for use with the Aurelia templating library.",
"keywords": [
"aurelia",
Expand Down
24 changes: 11 additions & 13 deletions dist/amd/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,29 @@ define(["exports", "aurelia-dependency-injection", "aurelia-templating"], functi
};

var Container = _aureliaDependencyInjection.Container;
var CustomElement = _aureliaTemplating.CustomElement;
var Behavior = _aureliaTemplating.Behavior;
var CompositionEngine = _aureliaTemplating.CompositionEngine;
var Property = _aureliaTemplating.Property;
var ViewSlot = _aureliaTemplating.ViewSlot;
var NoView = _aureliaTemplating.NoView;
var ViewResources = _aureliaTemplating.ViewResources;
var Compose = (function () {
var Compose = function Compose(container, compositionEngine, viewSlot, viewResources) {
function Compose(container, compositionEngine, viewSlot, viewResources) {
this.container = container;
this.compositionEngine = compositionEngine;
this.viewSlot = viewSlot;
this.viewResources = viewResources;
};
}

_prototypeProperties(Compose, {
annotations: {
value: function () {
return [new CustomElement("compose"), new Property("model"), new Property("view"), new Property("viewModel"), new NoView()];
metadata: {
value: function metadata() {
return Behavior.customElement("compose").withProperty("model").withProperty("view").withProperty("view-model").noView();
},
writable: true,
enumerable: true,
configurable: true
},
inject: {
value: function () {
value: function inject() {
return [Container, CompositionEngine, ViewSlot, ViewResources];
},
writable: true,
Expand All @@ -40,7 +38,7 @@ define(["exports", "aurelia-dependency-injection", "aurelia-templating"], functi
}
}, {
bind: {
value: function (executionContext) {
value: function bind(executionContext) {
this.executionContext = executionContext;
processInstruction(this, {
view: this.view,
Expand All @@ -53,7 +51,7 @@ define(["exports", "aurelia-dependency-injection", "aurelia-templating"], functi
configurable: true
},
modelChanged: {
value: function (newValue, oldValue) {
value: function modelChanged(newValue, oldValue) {
if (this.viewModel && typeof this.viewModel.activate === "function") {
this.viewModel.activate(newValue);
}
Expand All @@ -63,15 +61,15 @@ define(["exports", "aurelia-dependency-injection", "aurelia-templating"], functi
configurable: true
},
viewChanged: {
value: function (newValue, oldValue) {
value: function viewChanged(newValue, oldValue) {
processInstruction(this, { view: newValue });
},
writable: true,
enumerable: true,
configurable: true
},
viewModelChanged: {
value: function (newValue, oldValue) {
value: function viewModelChanged(newValue, oldValue) {
processInstruction(this, { viewModel: newValue });
},
writable: true,
Expand Down
89 changes: 89 additions & 0 deletions dist/amd/global-behavior.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
define(["exports", "aurelia-templating"], function (exports, _aureliaTemplating) {
"use strict";

var _prototypeProperties = function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};

var Behavior = _aureliaTemplating.Behavior;
var GlobalBehavior = (function () {
function GlobalBehavior(element) {
this.element = element;
}

_prototypeProperties(GlobalBehavior, {
metadata: {
value: function metadata() {
return Behavior.attachedBehavior("global-behavior").withOptions().and(function (x) {
return x.dynamic();
});
},
writable: true,
enumerable: true,
configurable: true
},
inject: {
value: function inject() {
return [Element];
},
writable: true,
enumerable: true,
configurable: true
}
}, {
bind: {
value: function bind() {
var settings, lookup, globalObject;

lookup = GlobalBehavior.whitelist[this.aureliaAttrName];
if (!lookup) {
throw new Error("Conventional global binding behavior not whitelisted for " + this.aureliaAttrName + ".");
}

globalObject = window[lookup];
if (!globalObject) {
throw new Error("Conventional global " + lookup + " was not found.");
}

settings = {};

for (var key in this) {
if (key === "aureliaAttrName" || key === "aureliaCommand" || !this.hasOwnProperty(key)) {
continue;
}

settings[key] = this[key];
}

try {
this.instance = globalObject(this.element)[this.aureliaCommand](settings);
} catch (error) {
throw new Error("Conventional global binding behavior failed.", error);
}
},
writable: true,
enumerable: true,
configurable: true
},
unbind: {
value: function unbind() {
if (this.instance && "destroy" in this.instance) {
this.instance.destroy();
this.instance = null;
}
},
writable: true,
enumerable: true,
configurable: true
}
});

return GlobalBehavior;
})();

exports.GlobalBehavior = GlobalBehavior;


GlobalBehavior.whitelist = { jquery: "jQuery" };
});
17 changes: 8 additions & 9 deletions dist/amd/if.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,27 @@ define(["exports", "aurelia-templating"], function (exports, _aureliaTemplating)
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};

var TemplateController = _aureliaTemplating.TemplateController;
var Property = _aureliaTemplating.Property;
var Behavior = _aureliaTemplating.Behavior;
var BoundViewFactory = _aureliaTemplating.BoundViewFactory;
var ViewSlot = _aureliaTemplating.ViewSlot;
var If = (function () {
var If = function If(viewFactory, viewSlot) {
function If(viewFactory, viewSlot) {
this.viewFactory = viewFactory;
this.viewSlot = viewSlot;
this.showing = false;
};
}

_prototypeProperties(If, {
annotations: {
value: function () {
return [new TemplateController("if"), new Property("value", "valueChanged", "if")];
metadata: {
value: function metadata() {
return Behavior.templateController("if").withProperty("value", "valueChanged", "if");
},
writable: true,
enumerable: true,
configurable: true
},
inject: {
value: function () {
value: function inject() {
return [BoundViewFactory, ViewSlot];
},
writable: true,
Expand All @@ -36,7 +35,7 @@ define(["exports", "aurelia-templating"], function (exports, _aureliaTemplating)
}
}, {
valueChanged: {
value: function (newValue) {
value: function valueChanged(newValue) {
if (!newValue) {
if (this.view) {
this.viewSlot.remove(this.view);
Expand Down
6 changes: 4 additions & 2 deletions dist/amd/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
define(["exports", "./compose", "./if", "./repeat", "./show", "./selected-item"], function (exports, _compose, _if, _repeat, _show, _selectedItem) {
define(["exports", "./compose", "./if", "./repeat", "./show", "./selected-item", "./global-behavior"], function (exports, _compose, _if, _repeat, _show, _selectedItem, _globalBehavior) {
"use strict";

var Compose = _compose.Compose;
var If = _if.If;
var Repeat = _repeat.Repeat;
var Show = _show.Show;
var SelectedItem = _selectedItem.SelectedItem;
var GlobalBehavior = _globalBehavior.GlobalBehavior;


function install(aurelia) {
aurelia.withResources([Show, If, Repeat, Compose, SelectedItem]);
aurelia.withResources([Show, If, Repeat, Compose, SelectedItem, GlobalBehavior]);
}

exports.Compose = Compose;
exports.If = If;
exports.Repeat = Repeat;
exports.Show = Show;
exports.SelectedItem = SelectedItem;
exports.GlobalBehavior = GlobalBehavior;
exports.install = install;
});
59 changes: 41 additions & 18 deletions dist/amd/repeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,28 @@ define(["exports", "aurelia-binding", "aurelia-templating"], function (exports,

var ObserverLocator = _aureliaBinding.ObserverLocator;
var calcSplices = _aureliaBinding.calcSplices;
var TemplateController = _aureliaTemplating.TemplateController;
var Behavior = _aureliaTemplating.Behavior;
var BoundViewFactory = _aureliaTemplating.BoundViewFactory;
var ViewSlot = _aureliaTemplating.ViewSlot;
var Property = _aureliaTemplating.Property;
var Repeat = (function () {
var Repeat = function Repeat(viewFactory, viewSlot, observerLocator) {
function Repeat(viewFactory, viewSlot, observerLocator) {
this.viewFactory = viewFactory;
this.viewSlot = viewSlot;
this.observerLocator = observerLocator;
this.local = "item";
};
}

_prototypeProperties(Repeat, {
annotations: {
value: function () {
return [new TemplateController("repeat"), new Property("items", "itemsChanged", "repeat"), new Property("local")];
metadata: {
value: function metadata() {
return Behavior.templateController("repeat").withProperty("items", "itemsChanged", "repeat").withProperty("local");
},
writable: true,
enumerable: true,
configurable: true
},
inject: {
value: function () {
value: function inject() {
return [BoundViewFactory, ViewSlot, ObserverLocator];
},
writable: true,
Expand All @@ -39,7 +38,7 @@ define(["exports", "aurelia-binding", "aurelia-templating"], function (exports,
}
}, {
bind: {
value: function (executionContext) {
value: function bind(executionContext) {
var _this = this;
var items = this.items;

Expand All @@ -64,7 +63,7 @@ define(["exports", "aurelia-binding", "aurelia-templating"], function (exports,
configurable: true
},
unbind: {
value: function () {
value: function unbind() {
this.oldItems = this.items;
this.lastBoundItems = this.items.slice(0);

Expand All @@ -78,17 +77,24 @@ define(["exports", "aurelia-binding", "aurelia-templating"], function (exports,
configurable: true
},
itemsChanged: {
value: function () {
value: function itemsChanged() {
this.processItems();
},
writable: true,
enumerable: true,
configurable: true
},
processItems: {
value: function () {
value: function processItems() {
var _this2 = this;
var items = this.items, observer = this.observerLocator.getArrayObserver(items), viewSlot = this.viewSlot, viewFactory = this.viewFactory, i, ii, row, view;
var items = this.items,
observer = this.observerLocator.getArrayObserver(items),
viewSlot = this.viewSlot,
viewFactory = this.viewFactory,
i,
ii,
row,
view;

if (this.disposeArraySubscription) {
this.disposeArraySubscription();
Expand All @@ -110,7 +116,7 @@ define(["exports", "aurelia-binding", "aurelia-templating"], function (exports,
configurable: true
},
createBaseExecutionContext: {
value: function (data) {
value: function createBaseExecutionContext(data) {
var context = {};
context[this.local] = data;
return context;
Expand All @@ -120,7 +126,7 @@ define(["exports", "aurelia-binding", "aurelia-templating"], function (exports,
configurable: true
},
createFullExecutionContext: {
value: function (data, index, length) {
value: function createFullExecutionContext(data, index, length) {
var context = this.createBaseExecutionContext(data);
return this.updateExecutionContext(context, index, length);
},
Expand All @@ -129,7 +135,7 @@ define(["exports", "aurelia-binding", "aurelia-templating"], function (exports,
configurable: true
},
updateExecutionContext: {
value: function (context, index, length) {
value: function updateExecutionContext(context, index, length) {
var first = index === 0,
last = index === length - 1,
even = index % 2 === 0;
Expand All @@ -149,8 +155,25 @@ define(["exports", "aurelia-binding", "aurelia-templating"], function (exports,
configurable: true
},
handleSplices: {
value: function (array, splices) {
var viewLookup = new Map(), removeDelta = 0, arrayLength = array.length, viewSlot = this.viewSlot, viewFactory = this.viewFactory, i, ii, j, jj, splice, removed, addIndex, end, model, view, children, length, row;
value: function handleSplices(array, splices) {
var viewLookup = new Map(),
removeDelta = 0,
arrayLength = array.length,
viewSlot = this.viewSlot,
viewFactory = this.viewFactory,
i,
ii,
j,
jj,
splice,
removed,
addIndex,
end,
model,
view,
children,
length,
row;

for (i = 0, ii = splices.length; i < ii; ++i) {
splice = splices[i];
Expand Down
Loading

0 comments on commit 8125436

Please sign in to comment.