Skip to content

Commit

Permalink
chore(all): prepare release 1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Sep 29, 2016
1 parent ca1dd60 commit 72d6675
Show file tree
Hide file tree
Showing 10 changed files with 200 additions and 113 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.0.4",
"version": "1.0.5",
"description": "A modern databinding library for JavaScript and HTML.",
"license": "MIT",
"keywords": [
Expand Down
46 changes: 28 additions & 18 deletions dist/amd/aurelia-binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -1920,21 +1920,12 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
return LiteralObject;
}(Expression);

var evalListCache = [[], [0], [0, 0], [0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0]];

function evalList(scope, list, lookupFunctions) {
var length = list.length;

for (var cacheLength = evalListCache.length; cacheLength <= length; ++cacheLength) {
evalListCache.push([]);
}

var result = evalListCache[length];

for (var _i14 = 0; _i14 < length; ++_i14) {
var result = [];
for (var _i14 = 0; _i14 < length; _i14++) {
result[_i14] = list[_i14].evaluate(scope, lookupFunctions);
}

return result;
}

Expand Down Expand Up @@ -3017,7 +3008,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
if (this.optional('.')) {
name = this.peek.key;
this.advance();
} else if (this.peek === EOF || this.peek.text === '(' || this.peek.text === '[' || this.peek.text === '}') {
} else if (this.peek === EOF || this.peek.text === '(' || this.peek.text === '[' || this.peek.text === '}' || this.peek.text === ',') {
return new AccessThis(ancestor);
} else {
this.error('Unexpected token ' + this.peek.text);
Expand Down Expand Up @@ -3698,6 +3689,16 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
return this.element.style.cssText;
};

StyleObserver.prototype._setProperty = function _setProperty(style, value) {
var priority = '';

if (value.indexOf('!important') !== -1) {
priority = 'important';
value = value.replace('!important', '');
}
this.element.style.setProperty(style, value, priority);
};

StyleObserver.prototype.setValue = function setValue(newValue) {
var styles = this.styles || {};
var style = void 0;
Expand All @@ -3708,7 +3709,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
for (style in newValue) {
if (newValue.hasOwnProperty(style)) {
styles[style] = version;
this.element.style[style] = newValue[style];
this._setProperty(style, newValue[style]);
}
}
} else if (newValue.length) {
Expand All @@ -3721,7 +3722,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
}

styles[style] = version;
this.element.style[style] = pair[2];
this._setProperty(style, pair[2]);
}
}
}
Expand All @@ -3739,7 +3740,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
continue;
}

this.element.style[style] = '';
this.element.style.removeProperty(style);
}
};

Expand Down Expand Up @@ -4601,7 +4602,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
if (xlinkResult) {
return new XLinkAttributeObserver(obj, propertyName, xlinkResult[1]);
}
if (/^\w+:|^data-|^aria-/.test(propertyName) || obj instanceof _aureliaPal.DOM.SVGElement && this.svgAnalyzer.isStandardSvgAttribute(obj.nodeName, propertyName)) {
if (propertyName === 'role' && (obj instanceof _aureliaPal.DOM.Element || obj instanceof _aureliaPal.DOM.SVGElement) || /^\w+:|^data-|^aria-/.test(propertyName) || obj instanceof _aureliaPal.DOM.SVGElement && this.svgAnalyzer.isStandardSvgAttribute(obj.nodeName, propertyName)) {
return new DataAttributeObserver(obj, propertyName);
}
}
Expand Down Expand Up @@ -5304,7 +5305,8 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure

function observable(targetOrConfig, key, descriptor) {
function deco(target, key, descriptor, config) {
if (key === undefined) {
var isClassDecorator = key === undefined;
if (isClassDecorator) {
target = target.prototype;
key = typeof config === 'string' ? config : config.name;
}
Expand All @@ -5321,6 +5323,10 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure
descriptor = {};
}

if (!('enumerable' in descriptor)) {
descriptor.enumerable = true;
}

delete descriptor.writable;
delete descriptor.initializer;

Expand All @@ -5337,7 +5343,11 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-task-queue', 'aure

descriptor.get.dependencies = [innerPropertyName];

Reflect.defineProperty(target, key, descriptor);
if (isClassDecorator) {
Reflect.defineProperty(target, key, descriptor);
} else {
return descriptor;
}
}

if (key === undefined) {
Expand Down
5 changes: 5 additions & 0 deletions dist/aurelia-binding.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ export declare interface InternalPropertyObserver {
unsubscribe(context: any, callable: Callable): void;
}

/**
* Property observer for HTML Attributes.
*/
export declare class DataAttributeObserver implements InternalPropertyObserver {}

/**
* Observes collection mutation.
*/
Expand Down
56 changes: 37 additions & 19 deletions dist/aurelia-binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -1769,22 +1769,13 @@ export class LiteralObject extends Expression {
}
}
let evalListCache = [[], [0], [0, 0], [0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0]];
/// Evaluate the [list] in context of the [scope].
function evalList(scope, list, lookupFunctions) {
let length = list.length;
for (let cacheLength = evalListCache.length; cacheLength <= length; ++cacheLength) {
evalListCache.push([]);
}
let result = evalListCache[length];
for (let i = 0; i < length; ++i) {
const length = list.length;
const result = [];
for (let i = 0; i < length; i++) {
result[i] = list[i].evaluate(scope, lookupFunctions);
}
return result;
}
Expand Down Expand Up @@ -2889,7 +2880,12 @@ export class ParserImplementation {
if (this.optional('.')) {
name = this.peek.key;
this.advance();
} else if (this.peek === EOF || this.peek.text === '(' || this.peek.text === '[' || this.peek.text === '}') {
} else if (this.peek === EOF
|| this.peek.text === '('
|| this.peek.text === '['
|| this.peek.text === '}'
|| this.peek.text === ','
) {
return new AccessThis(ancestor);
} else {
this.error(`Unexpected token ${this.peek.text}`);
Expand Down Expand Up @@ -3512,6 +3508,16 @@ export class StyleObserver {
return this.element.style.cssText;
}

_setProperty(style, value) {
let priority = '';

if (value.indexOf('!important') !== -1) {
priority = 'important';
value = value.replace('!important', '');
}
this.element.style.setProperty(style, value, priority);
}

setValue(newValue) {
let styles = this.styles || {};
let style;
Expand All @@ -3522,7 +3528,7 @@ export class StyleObserver {
for (style in newValue) {
if (newValue.hasOwnProperty(style)) {
styles[style] = version;
this.element.style[style] = newValue[style];
this._setProperty(style, newValue[style]);
}
}
} else if (newValue.length) {
Expand All @@ -3533,7 +3539,7 @@ export class StyleObserver {
if ( !style ) { continue; }

styles[style] = version;
this.element.style[style] = pair[2];
this._setProperty(style, pair[2]);
}
}
}
Expand All @@ -3551,7 +3557,7 @@ export class StyleObserver {
continue;
}

this.element.style[style] = '';
this.element.style.removeProperty(style);
}
}

Expand Down Expand Up @@ -4357,7 +4363,8 @@ export class ObserverLocator {
if (xlinkResult) {
return new XLinkAttributeObserver(obj, propertyName, xlinkResult[1]);
}
if (/^\w+:|^data-|^aria-/.test(propertyName)
if (propertyName === 'role' && (obj instanceof DOM.Element || obj instanceof DOM.SVGElement)
|| /^\w+:|^data-|^aria-/.test(propertyName)
|| obj instanceof DOM.SVGElement && this.svgAnalyzer.isStandardSvgAttribute(obj.nodeName, propertyName)) {
return new DataAttributeObserver(obj, propertyName);
}
Expand Down Expand Up @@ -5025,7 +5032,8 @@ class ModifySetObserver extends ModifyCollectionObserver {
export function observable(targetOrConfig: any, key: string, descriptor?: PropertyDescriptor) {
function deco(target, key, descriptor, config) { // eslint-disable-line no-shadow
// class decorator?
if (key === undefined) {
const isClassDecorator = key === undefined;
if (isClassDecorator) {
target = target.prototype;
key = typeof config === 'string' ? config : config.name;
}
Expand All @@ -5044,8 +5052,14 @@ export function observable(targetOrConfig: any, key: string, descriptor?: Proper
target[innerPropertyName] = descriptor.initializer();
}
} else {
// there is no descriptor if the target was a field in TS (although Babel provides one),
// or if the decorator was applied to a class.
descriptor = {};
}
// make the accessor enumerable by default, as fields are enumerable
if (!('enumerable' in descriptor)) {
descriptor.enumerable = true;
}

// we're adding a getter and setter which means the property descriptor
// cannot have a "value" or "writable" attribute
Expand All @@ -5066,7 +5080,11 @@ export function observable(targetOrConfig: any, key: string, descriptor?: Proper
// dependencies. This is the equivalent of "@computedFrom(...)".
descriptor.get.dependencies = [innerPropertyName];

Reflect.defineProperty(target, key, descriptor);
if (isClassDecorator) {
Reflect.defineProperty(target, key, descriptor);
} else {
return descriptor;
}
}

if (key === undefined) {
Expand Down
46 changes: 28 additions & 18 deletions dist/commonjs/aurelia-binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -1873,21 +1873,12 @@ var LiteralObject = exports.LiteralObject = function (_Expression18) {
return LiteralObject;
}(Expression);

var evalListCache = [[], [0], [0, 0], [0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0, 0]];

function evalList(scope, list, lookupFunctions) {
var length = list.length;

for (var cacheLength = evalListCache.length; cacheLength <= length; ++cacheLength) {
evalListCache.push([]);
}

var result = evalListCache[length];

for (var _i14 = 0; _i14 < length; ++_i14) {
var result = [];
for (var _i14 = 0; _i14 < length; _i14++) {
result[_i14] = list[_i14].evaluate(scope, lookupFunctions);
}

return result;
}

Expand Down Expand Up @@ -2970,7 +2961,7 @@ var ParserImplementation = exports.ParserImplementation = function () {
if (this.optional('.')) {
name = this.peek.key;
this.advance();
} else if (this.peek === EOF || this.peek.text === '(' || this.peek.text === '[' || this.peek.text === '}') {
} else if (this.peek === EOF || this.peek.text === '(' || this.peek.text === '[' || this.peek.text === '}' || this.peek.text === ',') {
return new AccessThis(ancestor);
} else {
this.error('Unexpected token ' + this.peek.text);
Expand Down Expand Up @@ -3651,6 +3642,16 @@ var StyleObserver = exports.StyleObserver = function () {
return this.element.style.cssText;
};

StyleObserver.prototype._setProperty = function _setProperty(style, value) {
var priority = '';

if (value.indexOf('!important') !== -1) {
priority = 'important';
value = value.replace('!important', '');
}
this.element.style.setProperty(style, value, priority);
};

StyleObserver.prototype.setValue = function setValue(newValue) {
var styles = this.styles || {};
var style = void 0;
Expand All @@ -3661,7 +3662,7 @@ var StyleObserver = exports.StyleObserver = function () {
for (style in newValue) {
if (newValue.hasOwnProperty(style)) {
styles[style] = version;
this.element.style[style] = newValue[style];
this._setProperty(style, newValue[style]);
}
}
} else if (newValue.length) {
Expand All @@ -3674,7 +3675,7 @@ var StyleObserver = exports.StyleObserver = function () {
}

styles[style] = version;
this.element.style[style] = pair[2];
this._setProperty(style, pair[2]);
}
}
}
Expand All @@ -3692,7 +3693,7 @@ var StyleObserver = exports.StyleObserver = function () {
continue;
}

this.element.style[style] = '';
this.element.style.removeProperty(style);
}
};

Expand Down Expand Up @@ -4554,7 +4555,7 @@ var ObserverLocator = exports.ObserverLocator = (_temp = _class11 = function ()
if (xlinkResult) {
return new XLinkAttributeObserver(obj, propertyName, xlinkResult[1]);
}
if (/^\w+:|^data-|^aria-/.test(propertyName) || obj instanceof _aureliaPal.DOM.SVGElement && this.svgAnalyzer.isStandardSvgAttribute(obj.nodeName, propertyName)) {
if (propertyName === 'role' && (obj instanceof _aureliaPal.DOM.Element || obj instanceof _aureliaPal.DOM.SVGElement) || /^\w+:|^data-|^aria-/.test(propertyName) || obj instanceof _aureliaPal.DOM.SVGElement && this.svgAnalyzer.isStandardSvgAttribute(obj.nodeName, propertyName)) {
return new DataAttributeObserver(obj, propertyName);
}
}
Expand Down Expand Up @@ -5257,7 +5258,8 @@ var ModifySetObserver = function (_ModifyCollectionObse3) {

function observable(targetOrConfig, key, descriptor) {
function deco(target, key, descriptor, config) {
if (key === undefined) {
var isClassDecorator = key === undefined;
if (isClassDecorator) {
target = target.prototype;
key = typeof config === 'string' ? config : config.name;
}
Expand All @@ -5274,6 +5276,10 @@ function observable(targetOrConfig, key, descriptor) {
descriptor = {};
}

if (!('enumerable' in descriptor)) {
descriptor.enumerable = true;
}

delete descriptor.writable;
delete descriptor.initializer;

Expand All @@ -5290,7 +5296,11 @@ function observable(targetOrConfig, key, descriptor) {

descriptor.get.dependencies = [innerPropertyName];

Reflect.defineProperty(target, key, descriptor);
if (isClassDecorator) {
Reflect.defineProperty(target, key, descriptor);
} else {
return descriptor;
}
}

if (key === undefined) {
Expand Down
Loading

0 comments on commit 72d6675

Please sign in to comment.