Skip to content

Commit

Permalink
chore(all): prepare release 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Oct 23, 2017
1 parent 70b0163 commit 0915a00
Show file tree
Hide file tree
Showing 15 changed files with 429 additions and 100 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-binding",
"version": "1.3.0",
"version": "1.4.0",
"description": "A modern databinding library for JavaScript and HTML.",
"license": "MIT",
"keywords": [
Expand Down
61 changes: 46 additions & 15 deletions dist/amd/aurelia-binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getSetObserver = exports.BindingEngine = exports.NameExpression = exports.Listener = exports.ListenerExpression = exports.BindingBehaviorResource = exports.ValueConverterResource = exports.Call = exports.CallExpression = exports.Binding = exports.BindingExpression = exports.ObjectObservationAdapter = exports.ObserverLocator = exports.SVGAnalyzer = exports.presentationAttributes = exports.presentationElements = exports.elements = exports.ComputedExpression = exports.ClassObserver = exports.SelectValueObserver = exports.CheckedObserver = exports.ValueAttributeObserver = exports.StyleObserver = exports.DataAttributeObserver = exports.dataAttributeAccessor = exports.XLinkAttributeObserver = exports.SetterObserver = exports.PrimitiveObserver = exports.propertyAccessor = exports.DirtyCheckProperty = exports.DirtyChecker = exports.EventManager = exports.delegationStrategy = exports.getMapObserver = exports.ParserImplementation = exports.Parser = exports.Scanner = exports.Lexer = exports.Token = exports.bindingMode = exports.ExpressionCloner = exports.Unparser = exports.LiteralObject = exports.LiteralArray = exports.LiteralString = exports.LiteralPrimitive = exports.PrefixNot = exports.Binary = exports.CallFunction = exports.CallMember = exports.CallScope = exports.AccessKeyed = exports.AccessMember = exports.AccessScope = exports.AccessThis = exports.Conditional = exports.Assign = exports.ValueConverter = exports.BindingBehavior = exports.Chain = exports.Expression = exports.getArrayObserver = exports.CollectionLengthObserver = exports.ModifyCollectionObserver = exports.ExpressionObserver = exports.sourceContext = undefined;
exports.getSetObserver = exports.BindingEngine = exports.NameExpression = exports.Listener = exports.ListenerExpression = exports.BindingBehaviorResource = exports.ValueConverterResource = exports.Call = exports.CallExpression = exports.Binding = exports.BindingExpression = exports.ObjectObservationAdapter = exports.ObserverLocator = exports.SVGAnalyzer = exports.presentationAttributes = exports.presentationElements = exports.elements = exports.ComputedExpression = exports.ClassObserver = exports.SelectValueObserver = exports.CheckedObserver = exports.ValueAttributeObserver = exports.StyleObserver = exports.DataAttributeObserver = exports.dataAttributeAccessor = exports.XLinkAttributeObserver = exports.SetterObserver = exports.PrimitiveObserver = exports.propertyAccessor = exports.DirtyCheckProperty = exports.DirtyChecker = exports.EventManager = exports.delegationStrategy = exports.getMapObserver = exports.ParserImplementation = exports.Parser = exports.Scanner = exports.Lexer = exports.Token = exports.bindingMode = exports.ExpressionCloner = exports.Unparser = exports.LiteralObject = exports.LiteralArray = exports.LiteralString = exports.LiteralPrimitive = exports.PrefixNot = exports.Binary = exports.CallFunction = exports.CallMember = exports.CallScope = exports.AccessKeyed = exports.AccessMember = exports.AccessScope = exports.AccessThis = exports.Conditional = exports.Assign = exports.ValueConverter = exports.BindingBehavior = exports.Chain = exports.Expression = exports.getArrayObserver = exports.CollectionLengthObserver = exports.ModifyCollectionObserver = exports.ExpressionObserver = exports.sourceContext = exports.targetContext = undefined;
exports.camelCase = camelCase;
exports.createOverrideContext = createOverrideContext;
exports.getContextFor = getContextFor;
Expand Down Expand Up @@ -96,6 +96,9 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure

var _dec, _dec2, _class, _dec3, _class2, _dec4, _class3, _dec5, _class5, _dec6, _class7, _dec7, _class8, _dec8, _class9, _dec9, _class10, _class12, _temp, _dec10, _class13, _class14, _temp2;

var targetContext = exports.targetContext = 'Binding:target';
var sourceContext = exports.sourceContext = 'Binding:source';

var map = Object.create(null);

function camelCase(name) {
Expand Down Expand Up @@ -153,7 +156,6 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
};
}

var sourceContext = exports.sourceContext = 'Binding:source';
var slotNames = [];
var versionSlotNames = [];

Expand Down Expand Up @@ -1338,6 +1340,18 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
while (i--) {
expressions[i].connect(binding, scope);
}
var converter = binding.lookupFunctions.valueConverters(this.name);
if (!converter) {
throw new Error('No ValueConverter named "' + this.name + '" was found!');
}
var signals = converter.signals;
if (signals === undefined) {
return;
}
i = signals.length;
while (i--) {
connectBindingToSignal(binding, signals[i]);
}
};

return ValueConverter;
Expand Down Expand Up @@ -2307,9 +2321,9 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure

var bindingMode = exports.bindingMode = {
oneTime: 0,
toView: 1,
oneWay: 1,
twoWay: 2,
toView: 1,
fromView: 3
};

Expand Down Expand Up @@ -3477,14 +3491,14 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure

EventManager.prototype.createElementHandler = function createElementHandler(events) {
return {
subscribe: function subscribe(target, callback) {
subscribe: function subscribe(target, callbackOrListener) {
events.forEach(function (changeEvent) {
target.addEventListener(changeEvent, callback, false);
target.addEventListener(changeEvent, callbackOrListener, false);
});

return function () {
events.forEach(function (changeEvent) {
target.removeEventListener(changeEvent, callback);
target.removeEventListener(changeEvent, callbackOrListener, false);
});
};
}
Expand Down Expand Up @@ -3770,7 +3784,11 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
return obj.getAttribute(propertyName);
},
setValue: function setValue(value, obj, propertyName) {
return obj.setAttribute(propertyName, value);
if (value === null || value === undefined) {
obj.removeAttribute(propertyName);
} else {
obj.setAttribute(propertyName, value);
}
}
};

Expand All @@ -3787,6 +3805,9 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
};

DataAttributeObserver.prototype.setValue = function setValue(newValue) {
if (newValue === null || newValue === undefined) {
return this.element.removeAttribute(this.propertyName);
}
return this.element.setAttribute(this.propertyName, newValue);
};

Expand Down Expand Up @@ -3912,10 +3933,14 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
this.oldValue = newValue;
};

ValueAttributeObserver.prototype.handleEvent = function handleEvent() {
this.notify();
};

ValueAttributeObserver.prototype.subscribe = function subscribe(context, callable) {
if (!this.hasSubscribers()) {
this.oldValue = this.getValue();
this.disposeHandler = this.handler.subscribe(this.element, this.notify.bind(this));
this.disposeHandler = this.handler.subscribe(this.element, this);
}

this.addSubscriber(context, callable);
Expand Down Expand Up @@ -4045,9 +4070,13 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
this.callSubscribers(newValue, oldValue);
};

CheckedObserver.prototype.handleEvent = function handleEvent() {
this.synchronizeValue();
};

CheckedObserver.prototype.subscribe = function subscribe(context, callable) {
if (!this.hasSubscribers()) {
this.disposeHandler = this.handler.subscribe(this.element, this.synchronizeValue.bind(this, false));
this.disposeHandler = this.handler.subscribe(this.element, this);
}
this.addSubscriber(context, callable);
};
Expand Down Expand Up @@ -4238,9 +4267,13 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
this.callSubscribers(newValue, oldValue);
};

SelectValueObserver.prototype.handleEvent = function handleEvent() {
this.synchronizeValue();
};

SelectValueObserver.prototype.subscribe = function subscribe(context, callable) {
if (!this.hasSubscribers()) {
this.disposeHandler = this.handler.subscribe(this.element, this.synchronizeValue.bind(this, false));
this.disposeHandler = this.handler.subscribe(this.element, this);
}
this.addSubscriber(context, callable);
};
Expand Down Expand Up @@ -4807,7 +4840,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
if (propertyName === 'class' || propertyName === 'style' || propertyName === 'css' || propertyName === 'value' && (obj.tagName.toLowerCase() === 'input' || obj.tagName.toLowerCase() === 'select') || propertyName === 'checked' && obj.tagName.toLowerCase() === 'input' || propertyName === 'model' && obj.tagName.toLowerCase() === 'input' || /^xlink:.+$/.exec(propertyName)) {
return this.getObserver(obj, propertyName);
}
if (/^\w+:|^data-|^aria-/.test(propertyName) || obj instanceof _aureliaPal.DOM.SVGElement && this.svgAnalyzer.isStandardSvgAttribute(obj.nodeName, propertyName)) {
if (/^\w+:|^data-|^aria-/.test(propertyName) || obj instanceof _aureliaPal.DOM.SVGElement && this.svgAnalyzer.isStandardSvgAttribute(obj.nodeName, propertyName) || obj.tagName.toLowerCase() === 'img' && propertyName === 'src' || obj.tagName.toLowerCase() === 'a' && propertyName === 'href') {
return dataAttributeAccessor;
}
}
Expand Down Expand Up @@ -4861,8 +4894,6 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
return BindingExpression;
}();

var targetContext = 'Binding:target';

var Binding = exports.Binding = (_dec10 = connectable(), _dec10(_class13 = function () {
function Binding(observerLocator, sourceExpression, target, targetProperty, mode, lookupFunctions) {

Expand Down Expand Up @@ -4937,7 +4968,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
this.updateTarget(value);
}

if (mode === bindingMode.oneWay) {
if (mode === bindingMode.toView) {
enqueueBindingConnect(this);
} else if (mode === bindingMode.twoWay) {
this.sourceExpression.connect(this, source);
Expand Down Expand Up @@ -5314,7 +5345,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
}

BindingEngine.prototype.createBindingExpression = function createBindingExpression(targetProperty, sourceExpression) {
var mode = arguments.length <= 2 || arguments[2] === undefined ? bindingMode.oneWay : arguments[2];
var mode = arguments.length <= 2 || arguments[2] === undefined ? bindingMode.toView : arguments[2];
var lookupFunctions = arguments.length <= 3 || arguments[3] === undefined ? LookupFunctions : arguments[3];

return new BindingExpression(this.observerLocator, targetProperty, this.parser.parse(sourceExpression), mode, lookupFunctions);
Expand Down
42 changes: 32 additions & 10 deletions dist/aurelia-binding.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,23 +134,39 @@ export declare interface CollectionObserver {
*/
export declare enum bindingMode {
/**
* Updates the binding target once. This is essentially a simpler form of one-way binding
* Updates the binding target once. This is essentially a simpler form of to-view binding
* that provides better performance in cases where the source value does not change.
*/
oneTime = 0,
/**
* Updates the binding target (target) property when the binding source (source) changes.
* This type of binding is appropriate if the element being bound is implicitly read-only.
* If there is no need to monitor the changes of the target property, using the OneWay
* This type of binding is appropriate if the element being bound (target)
* is implicitly read-only - serves only as an output.
* If there is no need to monitor the changes of the target property, using the to-view
* binding mode avoids the overhead of the two-way binding mode.
*/
toView = 1,
/**
* Updates the binding target (target) property when the binding source (source) changes.
* This type of binding is appropriate if the element being bound (target)
* is implicitly read-only - serves only as an output.
* If there is no need to monitor the changes of the target property, using the one-way
* binding mode avoids the overhead of the two-way binding mode.
* @deprecated Use `toView` instead.
*/
oneWay = 1,
/**
* Causes changes to either the source property or the target property to automatically update
* the other. This type of binding is appropriate for editable forms or other fully-interactive
* UI scenarios.
*/
twoWay = 2
twoWay = 2,
/**
* Updates the binding source (source) when the binding target (target) property changes.
* This type of binding is appropriate if the element being bound (target)
* is implicitly write-only - serves only as an intput.
*/
fromView = 3
}

/**
Expand Down Expand Up @@ -266,11 +282,11 @@ export declare interface InternalCollectionObserver {
/**
* Provides high-level access to the definition of a binding, which connects the properties of
* binding target objects (typically, HTML elements), and any data source.
*
* There are several implementations of this interface, depending on the type of
* binding (attribute, event, interpolation).
*
* The `updateSource`, `updateTarget` and `callSource` are methods that may or may not be defined
*
* There are several implementations of this interface, depending on the type of
* binding (attribute, event, interpolation).
*
* The `updateSource`, `updateTarget` and `callSource` are methods that may or may not be defined
* depending on the type of binding.
*/
export declare interface Binding {
Expand Down Expand Up @@ -429,7 +445,7 @@ export declare class AccessKeyed extends Expression {
* The property name.
*/
key: Expression;

constructor(object: Expression, key: Expression)
}

Expand Down Expand Up @@ -616,6 +632,12 @@ export declare function bindingBehavior(name: string): any;
*/
export declare const sourceContext: string;

/**
* A context used when invoking a binding's callable API to notify
* the binding that the context is a "target update".
*/
export declare const targetContext: string;

/**
* An internal API used by Aurelia's array observation components.
*/
Expand Down
Loading

0 comments on commit 0915a00

Please sign in to comment.