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 b9a0f1e commit e9c4cb3
Show file tree
Hide file tree
Showing 78 changed files with 2,436 additions and 1,206 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",
"version": "0.7.2",
"version": "0.8.0",
"description": "An extensible HTML templating engine supporting databinding, custom elements, attached behaviors and more.",
"keywords": [
"aurelia",
Expand Down
38 changes: 16 additions & 22 deletions dist/amd/attached-behavior.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
define(["exports", "aurelia-metadata", "./behavior-instance", "./behaviors", "./property", "./util"], function (exports, _aureliaMetadata, _behaviorInstance, _behaviors, _property, _util) {
define(["exports", "aurelia-metadata", "./behavior-instance", "./behaviors", "./util"], function (exports, _aureliaMetadata, _behaviorInstance, _behaviors, _util) {
"use strict";

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

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

var ResourceType = _aureliaMetadata.ResourceType;
var BehaviorInstance = _behaviorInstance.BehaviorInstance;
var configureBehavior = _behaviors.configureBehavior;
var Property = _property.Property;
var hyphenate = _util.hyphenate;
var AttachedBehavior = (function (ResourceType) {
var AttachedBehavior = function AttachedBehavior(attribute) {
function AttachedBehavior(attribute) {
this.name = attribute;
this.properties = [];
this.attributes = {};
};
}

_inherits(AttachedBehavior, ResourceType);

_prototypeProperties(AttachedBehavior, {
convention: {
value: function (name) {
value: function convention(name) {
if (name.endsWith("AttachedBehavior")) {
return new AttachedBehavior(hyphenate(name.substring(0, name.length - 16)));
}
Expand All @@ -48,29 +47,24 @@ define(["exports", "aurelia-metadata", "./behavior-instance", "./behaviors", "./
}
}, {
load: {
value: function (container, target) {
configureBehavior(this, container, target);

if (this.properties.length === 0 && "valueChanged" in target.prototype) {
new Property("value", "valueChanged", this.name).configureBehavior(this);
}

value: function load(container, target) {
configureBehavior(container, this, target);
return Promise.resolve(this);
},
writable: true,
enumerable: true,
configurable: true
},
register: {
value: function (registry, name) {
value: function register(registry, name) {
registry.registerAttribute(name || this.name, this, this.name);
},
writable: true,
enumerable: true,
configurable: true
},
compile: {
value: function (compiler, resources, node, instruction) {
value: function compile(compiler, resources, node, instruction) {
instruction.suppressBind = true;
return node;
},
Expand All @@ -79,9 +73,9 @@ define(["exports", "aurelia-metadata", "./behavior-instance", "./behaviors", "./
configurable: true
},
create: {
value: function (container, instruction, element, bindings) {
value: function create(container, instruction, element, bindings) {
var executionContext = instruction.executionContext || container.get(this.target),
behaviorInstance = new BehaviorInstance(this.taskQueue, this.observerLocator, this, executionContext, instruction);
behaviorInstance = new BehaviorInstance(this, executionContext, instruction);

if (this.childExpression) {
bindings.push(this.childExpression.createBinding(element, behaviorInstance.executionContext));
Expand Down
50 changes: 27 additions & 23 deletions dist/amd/behavior-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,27 @@ define(["exports"], function (exports) {
};

var BehaviorInstance = (function () {
var BehaviorInstance = function BehaviorInstance(taskQueue, observerLocator, behaviorType, executionContext, instruction) {
this.behaviorType = behaviorType;
function BehaviorInstance(behavior, executionContext, instruction) {
this.behavior = behavior;
this.executionContext = executionContext;

var observerLookup = observerLocator.getObserversLookup(executionContext),
handlesBind = behaviorType.handlesBind,
var observerLookup = behavior.observerLocator.getObserversLookup(executionContext),
handlesBind = behavior.handlesBind,
attributes = instruction.attributes,
boundProperties = this.boundProperties = [],
properties = behaviorType.properties,
properties = behavior.properties,
i,
ii,
info;
ii;

for (i = 0, ii = properties.length; i < ii; ++i) {
info = properties[i].create(taskQueue, executionContext, observerLookup, attributes, handlesBind);
if (info !== undefined) {
boundProperties.push(info);
}
properties[i].initialize(executionContext, observerLookup, attributes, handlesBind, boundProperties);
}
};
}

_prototypeProperties(BehaviorInstance, null, {
created: {
value: function (context) {
if (this.behaviorType.handlesCreated) {
value: function created(context) {
if (this.behavior.handlesCreated) {
this.executionContext.created(context);
}
},
Expand All @@ -40,8 +36,14 @@ define(["exports"], function (exports) {
configurable: true
},
bind: {
value: function (context) {
var skipSelfSubscriber = this.behaviorType.handlesBind, boundProperties = this.boundProperties, i, ii, x, observer, selfSubscriber;
value: function bind(context) {
var skipSelfSubscriber = this.behavior.handlesBind,
boundProperties = this.boundProperties,
i,
ii,
x,
observer,
selfSubscriber;

for (i = 0, ii = boundProperties.length; i < ii; ++i) {
x = boundProperties[i];
Expand Down Expand Up @@ -73,14 +75,16 @@ define(["exports"], function (exports) {
configurable: true
},
unbind: {
value: function () {
var boundProperties = this.boundProperties, i, ii;
value: function unbind() {
var boundProperties = this.boundProperties,
i,
ii;

if (this.view) {
this.view.unbind();
}

if (this.behaviorType.handlesUnbind) {
if (this.behavior.handlesUnbind) {
this.executionContext.unbind();
}

Expand All @@ -93,8 +97,8 @@ define(["exports"], function (exports) {
configurable: true
},
attached: {
value: function () {
if (this.behaviorType.handlesAttached) {
value: function attached() {
if (this.behavior.handlesAttached) {
this.executionContext.attached();
}
},
Expand All @@ -103,8 +107,8 @@ define(["exports"], function (exports) {
configurable: true
},
detached: {
value: function () {
if (this.behaviorType.handlesDetached) {
value: function detached() {
if (this.behavior.handlesDetached) {
this.executionContext.detached();
}
},
Expand Down
51 changes: 38 additions & 13 deletions dist/amd/behaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,62 @@ define(["exports", "aurelia-metadata", "aurelia-task-queue", "aurelia-binding",
"use strict";

exports.configureBehavior = configureBehavior;
var getAllAnnotations = _aureliaMetadata.getAllAnnotations;
var getAnnotation = _aureliaMetadata.getAnnotation;
var ResourceType = _aureliaMetadata.ResourceType;
var Metadata = _aureliaMetadata.Metadata;
var TaskQueue = _aureliaTaskQueue.TaskQueue;
var ObserverLocator = _aureliaBinding.ObserverLocator;
var Children = _children.Children;
var Property = _property.Property;
var ChildObserver = _children.ChildObserver;
var BehaviorProperty = _property.BehaviorProperty;
var hyphenate = _util.hyphenate;
function configureBehavior(behavior, container, target) {
var proto = target.prototype, i, ii, properties;
function configureBehavior(container, behavior, target, valuePropertyName) {
var proto = target.prototype,
taskQueue = container.get(TaskQueue),
meta = Metadata.on(target),
observerLocator = container.get(ObserverLocator),
i,
ii,
properties;

if (!behavior.name) {
behavior.name = hyphenate(target.name);
}

behavior.target = target;
behavior.taskQueue = container.get(TaskQueue);
behavior.observerLocator = container.get(ObserverLocator);

behavior.observerLocator = observerLocator;
behavior.handlesCreated = "created" in proto;
behavior.handlesBind = "bind" in proto;
behavior.handlesUnbind = "unbind" in proto;
behavior.handlesAttached = "attached" in proto;
behavior.handlesDetached = "detached" in proto;

properties = getAllAnnotations(target, Property);
properties = meta.all(BehaviorProperty);

for (i = 0, ii = properties.length; i < ii; ++i) {
properties[i].configureBehavior(behavior);
properties[i].define(taskQueue, behavior);
}

properties = behavior.properties;

if (properties.length === 0 && "valueChanged" in target.prototype) {
new BehaviorProperty("value", "valueChanged", valuePropertyName || behavior.name).define(taskQueue, behavior);
}

if (properties.length !== 0) {
target.initialize = function (executionContext) {
var observerLookup = observerLocator.getObserversLookup(executionContext),
i,
ii,
observer;

for (i = 0, ii = properties.length; i < ii; ++i) {
observer = properties[i].createObserver(executionContext);

if (observer !== undefined) {
observerLookup[observer.propertyName] = observer;
}
}
};
}

behavior.childExpression = getAnnotation(target, Children);
behavior.childExpression = meta.first(ChildObserver);
}
});
8 changes: 4 additions & 4 deletions dist/amd/binding-language.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ define(["exports"], function (exports) {
};

var BindingLanguage = (function () {
var BindingLanguage = function BindingLanguage() {};
function BindingLanguage() {}

_prototypeProperties(BindingLanguage, null, {
inspectAttribute: {
value: function (resources, attrName, attrValue) {
value: function inspectAttribute(resources, attrName, attrValue) {
throw new Error("A BindingLanguage must implement inspectAttribute(...)");
},
writable: true,
enumerable: true,
configurable: true
},
createAttributeInstruction: {
value: function (resources, element, info, existingInstruction) {
value: function createAttributeInstruction(resources, element, info, existingInstruction) {
throw new Error("A BindingLanguage must implement createAttributeInstruction(...)");
},
writable: true,
enumerable: true,
configurable: true
},
parseText: {
value: function (resources, value) {
value: function parseText(resources, value) {
throw new Error("A BindingLanguage must implement parseText(...)");
},
writable: true,
Expand Down
Loading

0 comments on commit e9c4cb3

Please sign in to comment.