From 9f6b166cca6b60118f4b086bed55edd300041006 Mon Sep 17 00:00:00 2001 From: Rob Eisenberg Date: Thu, 3 Dec 2015 15:51:18 -0500 Subject: [PATCH] chore(all): prepare release 1.0.0-beta.1.0.1 --- bower.json | 2 +- dist/amd/aurelia-templating-binding.js | 28 +++++++++++--------- dist/aurelia-templating-binding.js | 29 ++++++++++++--------- dist/commonjs/aurelia-templating-binding.js | 28 +++++++++++--------- dist/es6/aurelia-templating-binding.js | 29 ++++++++++++--------- dist/system/aurelia-templating-binding.js | 28 +++++++++++--------- doc/CHANGELOG.md | 8 ++++++ package.json | 2 +- 8 files changed, 92 insertions(+), 62 deletions(-) diff --git a/bower.json b/bower.json index 2769235..2537fec 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "aurelia-templating-binding", - "version": "1.0.0-beta.1", + "version": "1.0.0-beta.1.0.1", "description": "An implementation of the templating engine's Binding Language abstraction which uses a pluggable command syntax.", "keywords": [ "aurelia", diff --git a/dist/amd/aurelia-templating-binding.js b/dist/amd/aurelia-templating-binding.js index 825a1cb..1ebffc2 100644 --- a/dist/amd/aurelia-templating-binding.js +++ b/dist/amd/aurelia-templating-binding.js @@ -209,20 +209,20 @@ define(['exports', 'aurelia-logging', 'aurelia-binding', 'aurelia-templating'], this.eventManager = eventManager; } - SyntaxInterpreter.prototype.interpret = function interpret(resources, element, info, existingInstruction) { + SyntaxInterpreter.prototype.interpret = function interpret(resources, element, info, existingInstruction, context) { if (info.command in this) { - return this[info.command](resources, element, info, existingInstruction); + return this[info.command](resources, element, info, existingInstruction, context); } - return this.handleUnknownCommand(resources, element, info, existingInstruction); + return this.handleUnknownCommand(resources, element, info, existingInstruction, context); }; - SyntaxInterpreter.prototype.handleUnknownCommand = function handleUnknownCommand(resources, element, info, existingInstruction) { + SyntaxInterpreter.prototype.handleUnknownCommand = function handleUnknownCommand(resources, element, info, existingInstruction, context) { _aureliaLogging.getLogger('templating-binding').warn('Unknown binding command.', info); return existingInstruction; }; - SyntaxInterpreter.prototype.determineDefaultBindingMode = function determineDefaultBindingMode(element, attrName) { + SyntaxInterpreter.prototype.determineDefaultBindingMode = function determineDefaultBindingMode(element, attrName, context) { var tagName = element.tagName.toLowerCase(); if (tagName === 'input') { @@ -235,13 +235,17 @@ define(['exports', 'aurelia-logging', 'aurelia-binding', 'aurelia-templating'], return _aureliaBinding.bindingMode.twoWay; } + if (context && attrName in context.attributes) { + return context.attributes[attrName].defaultBindingMode || _aureliaBinding.bindingMode.oneWay; + } + return _aureliaBinding.bindingMode.oneWay; }; - SyntaxInterpreter.prototype.bind = function bind(resources, element, info, existingInstruction) { + SyntaxInterpreter.prototype.bind = function bind(resources, element, info, existingInstruction, context) { var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName); - instruction.attributes[info.attrName] = new _aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap[info.attrName] || info.attrName, this.parser.parse(info.attrValue), info.defaultBindingMode || this.determineDefaultBindingMode(element, info.attrName), resources.lookupFunctions); + instruction.attributes[info.attrName] = new _aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap[info.attrName] || info.attrName, this.parser.parse(info.attrValue), info.defaultBindingMode || this.determineDefaultBindingMode(element, info.attrName, context), resources.lookupFunctions); return instruction; }; @@ -262,7 +266,7 @@ define(['exports', 'aurelia-logging', 'aurelia-binding', 'aurelia-templating'], return instruction; }; - SyntaxInterpreter.prototype.options = function options(resources, element, info, existingInstruction) { + SyntaxInterpreter.prototype.options = function options(resources, element, info, existingInstruction, context) { var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName); var attrValue = info.attrValue; var language = this.language; @@ -277,7 +281,7 @@ define(['exports', 'aurelia-logging', 'aurelia-binding', 'aurelia-templating'], if (current === ';') { info = language.inspectAttribute(resources, name, target.trim()); - language.createAttributeInstruction(resources, element, info, instruction); + language.createAttributeInstruction(resources, element, info, instruction, context); if (!instruction.attributes[info.attrName]) { instruction.attributes[info.attrName] = info.attrValue; @@ -295,7 +299,7 @@ define(['exports', 'aurelia-logging', 'aurelia-binding', 'aurelia-templating'], if (name !== null) { info = language.inspectAttribute(resources, name, target.trim()); - language.createAttributeInstruction(resources, element, info, instruction); + language.createAttributeInstruction(resources, element, info, instruction, context); if (!instruction.attributes[info.attrName]) { instruction.attributes[info.attrName] = info.attrValue; @@ -436,7 +440,7 @@ define(['exports', 'aurelia-logging', 'aurelia-binding', 'aurelia-templating'], return info; }; - TemplatingBindingLanguage.prototype.createAttributeInstruction = function createAttributeInstruction(resources, element, theInfo, existingInstruction) { + TemplatingBindingLanguage.prototype.createAttributeInstruction = function createAttributeInstruction(resources, element, theInfo, existingInstruction, context) { var instruction = undefined; if (theInfo.expression) { @@ -447,7 +451,7 @@ define(['exports', 'aurelia-logging', 'aurelia-binding', 'aurelia-templating'], instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(theInfo.attrName); instruction.attributes[theInfo.attrName] = theInfo.expression; } else if (theInfo.command) { - instruction = this.syntaxInterpreter.interpret(resources, element, theInfo, existingInstruction); + instruction = this.syntaxInterpreter.interpret(resources, element, theInfo, existingInstruction, context); } return instruction; diff --git a/dist/aurelia-templating-binding.js b/dist/aurelia-templating-binding.js index b841f47..89d11d0 100644 --- a/dist/aurelia-templating-binding.js +++ b/dist/aurelia-templating-binding.js @@ -198,20 +198,20 @@ export class SyntaxInterpreter { this.eventManager = eventManager; } - interpret(resources, element, info, existingInstruction) { + interpret(resources, element, info, existingInstruction, context) { if (info.command in this) { - return this[info.command](resources, element, info, existingInstruction); + return this[info.command](resources, element, info, existingInstruction, context); } - return this.handleUnknownCommand(resources, element, info, existingInstruction); + return this.handleUnknownCommand(resources, element, info, existingInstruction, context); } - handleUnknownCommand(resources, element, info, existingInstruction) { + handleUnknownCommand(resources, element, info, existingInstruction, context) { LogManager.getLogger('templating-binding').warn('Unknown binding command.', info); return existingInstruction; } - determineDefaultBindingMode(element, attrName) { + determineDefaultBindingMode(element, attrName, context) { let tagName = element.tagName.toLowerCase(); if (tagName === 'input') { @@ -224,17 +224,21 @@ export class SyntaxInterpreter { return bindingMode.twoWay; } + if (context && attrName in context.attributes) { + return context.attributes[attrName].defaultBindingMode || bindingMode.oneWay; + } + return bindingMode.oneWay; } - bind(resources, element, info, existingInstruction) { + bind(resources, element, info, existingInstruction, context) { let instruction = existingInstruction || BehaviorInstruction.attribute(info.attrName); instruction.attributes[info.attrName] = new BindingExpression( this.observerLocator, this.attributeMap[info.attrName] || info.attrName, this.parser.parse(info.attrValue), - info.defaultBindingMode || this.determineDefaultBindingMode(element, info.attrName), + info.defaultBindingMode || this.determineDefaultBindingMode(element, info.attrName, context), resources.lookupFunctions ); @@ -276,7 +280,7 @@ export class SyntaxInterpreter { return instruction; } - options(resources, element, info, existingInstruction) { + options(resources, element, info, existingInstruction, context) { let instruction = existingInstruction || BehaviorInstruction.attribute(info.attrName); let attrValue = info.attrValue; let language = this.language; @@ -291,7 +295,7 @@ export class SyntaxInterpreter { if (current === ';') { info = language.inspectAttribute(resources, name, target.trim()); - language.createAttributeInstruction(resources, element, info, instruction); + language.createAttributeInstruction(resources, element, info, instruction, context); if (!instruction.attributes[info.attrName]) { instruction.attributes[info.attrName] = info.attrValue; @@ -309,7 +313,7 @@ export class SyntaxInterpreter { if (name !== null) { info = language.inspectAttribute(resources, name, target.trim()); - language.createAttributeInstruction(resources, element, info, instruction); + language.createAttributeInstruction(resources, element, info, instruction, context); if (!instruction.attributes[info.attrName]) { instruction.attributes[info.attrName] = info.attrValue; @@ -463,7 +467,7 @@ export class TemplatingBindingLanguage extends BindingLanguage { return info; } - createAttributeInstruction(resources, element, theInfo, existingInstruction) { + createAttributeInstruction(resources, element, theInfo, existingInstruction, context) { let instruction; if (theInfo.expression) { @@ -478,7 +482,8 @@ export class TemplatingBindingLanguage extends BindingLanguage { resources, element, theInfo, - existingInstruction + existingInstruction, + context ); } diff --git a/dist/commonjs/aurelia-templating-binding.js b/dist/commonjs/aurelia-templating-binding.js index a34b673..97d4364 100644 --- a/dist/commonjs/aurelia-templating-binding.js +++ b/dist/commonjs/aurelia-templating-binding.js @@ -218,20 +218,20 @@ var SyntaxInterpreter = (function () { this.eventManager = eventManager; } - SyntaxInterpreter.prototype.interpret = function interpret(resources, element, info, existingInstruction) { + SyntaxInterpreter.prototype.interpret = function interpret(resources, element, info, existingInstruction, context) { if (info.command in this) { - return this[info.command](resources, element, info, existingInstruction); + return this[info.command](resources, element, info, existingInstruction, context); } - return this.handleUnknownCommand(resources, element, info, existingInstruction); + return this.handleUnknownCommand(resources, element, info, existingInstruction, context); }; - SyntaxInterpreter.prototype.handleUnknownCommand = function handleUnknownCommand(resources, element, info, existingInstruction) { + SyntaxInterpreter.prototype.handleUnknownCommand = function handleUnknownCommand(resources, element, info, existingInstruction, context) { LogManager.getLogger('templating-binding').warn('Unknown binding command.', info); return existingInstruction; }; - SyntaxInterpreter.prototype.determineDefaultBindingMode = function determineDefaultBindingMode(element, attrName) { + SyntaxInterpreter.prototype.determineDefaultBindingMode = function determineDefaultBindingMode(element, attrName, context) { var tagName = element.tagName.toLowerCase(); if (tagName === 'input') { @@ -244,13 +244,17 @@ var SyntaxInterpreter = (function () { return _aureliaBinding.bindingMode.twoWay; } + if (context && attrName in context.attributes) { + return context.attributes[attrName].defaultBindingMode || _aureliaBinding.bindingMode.oneWay; + } + return _aureliaBinding.bindingMode.oneWay; }; - SyntaxInterpreter.prototype.bind = function bind(resources, element, info, existingInstruction) { + SyntaxInterpreter.prototype.bind = function bind(resources, element, info, existingInstruction, context) { var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName); - instruction.attributes[info.attrName] = new _aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap[info.attrName] || info.attrName, this.parser.parse(info.attrValue), info.defaultBindingMode || this.determineDefaultBindingMode(element, info.attrName), resources.lookupFunctions); + instruction.attributes[info.attrName] = new _aureliaBinding.BindingExpression(this.observerLocator, this.attributeMap[info.attrName] || info.attrName, this.parser.parse(info.attrValue), info.defaultBindingMode || this.determineDefaultBindingMode(element, info.attrName, context), resources.lookupFunctions); return instruction; }; @@ -271,7 +275,7 @@ var SyntaxInterpreter = (function () { return instruction; }; - SyntaxInterpreter.prototype.options = function options(resources, element, info, existingInstruction) { + SyntaxInterpreter.prototype.options = function options(resources, element, info, existingInstruction, context) { var instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(info.attrName); var attrValue = info.attrValue; var language = this.language; @@ -286,7 +290,7 @@ var SyntaxInterpreter = (function () { if (current === ';') { info = language.inspectAttribute(resources, name, target.trim()); - language.createAttributeInstruction(resources, element, info, instruction); + language.createAttributeInstruction(resources, element, info, instruction, context); if (!instruction.attributes[info.attrName]) { instruction.attributes[info.attrName] = info.attrValue; @@ -304,7 +308,7 @@ var SyntaxInterpreter = (function () { if (name !== null) { info = language.inspectAttribute(resources, name, target.trim()); - language.createAttributeInstruction(resources, element, info, instruction); + language.createAttributeInstruction(resources, element, info, instruction, context); if (!instruction.attributes[info.attrName]) { instruction.attributes[info.attrName] = info.attrValue; @@ -445,7 +449,7 @@ var TemplatingBindingLanguage = (function (_BindingLanguage) { return info; }; - TemplatingBindingLanguage.prototype.createAttributeInstruction = function createAttributeInstruction(resources, element, theInfo, existingInstruction) { + TemplatingBindingLanguage.prototype.createAttributeInstruction = function createAttributeInstruction(resources, element, theInfo, existingInstruction, context) { var instruction = undefined; if (theInfo.expression) { @@ -456,7 +460,7 @@ var TemplatingBindingLanguage = (function (_BindingLanguage) { instruction = existingInstruction || _aureliaTemplating.BehaviorInstruction.attribute(theInfo.attrName); instruction.attributes[theInfo.attrName] = theInfo.expression; } else if (theInfo.command) { - instruction = this.syntaxInterpreter.interpret(resources, element, theInfo, existingInstruction); + instruction = this.syntaxInterpreter.interpret(resources, element, theInfo, existingInstruction, context); } return instruction; diff --git a/dist/es6/aurelia-templating-binding.js b/dist/es6/aurelia-templating-binding.js index b841f47..89d11d0 100644 --- a/dist/es6/aurelia-templating-binding.js +++ b/dist/es6/aurelia-templating-binding.js @@ -198,20 +198,20 @@ export class SyntaxInterpreter { this.eventManager = eventManager; } - interpret(resources, element, info, existingInstruction) { + interpret(resources, element, info, existingInstruction, context) { if (info.command in this) { - return this[info.command](resources, element, info, existingInstruction); + return this[info.command](resources, element, info, existingInstruction, context); } - return this.handleUnknownCommand(resources, element, info, existingInstruction); + return this.handleUnknownCommand(resources, element, info, existingInstruction, context); } - handleUnknownCommand(resources, element, info, existingInstruction) { + handleUnknownCommand(resources, element, info, existingInstruction, context) { LogManager.getLogger('templating-binding').warn('Unknown binding command.', info); return existingInstruction; } - determineDefaultBindingMode(element, attrName) { + determineDefaultBindingMode(element, attrName, context) { let tagName = element.tagName.toLowerCase(); if (tagName === 'input') { @@ -224,17 +224,21 @@ export class SyntaxInterpreter { return bindingMode.twoWay; } + if (context && attrName in context.attributes) { + return context.attributes[attrName].defaultBindingMode || bindingMode.oneWay; + } + return bindingMode.oneWay; } - bind(resources, element, info, existingInstruction) { + bind(resources, element, info, existingInstruction, context) { let instruction = existingInstruction || BehaviorInstruction.attribute(info.attrName); instruction.attributes[info.attrName] = new BindingExpression( this.observerLocator, this.attributeMap[info.attrName] || info.attrName, this.parser.parse(info.attrValue), - info.defaultBindingMode || this.determineDefaultBindingMode(element, info.attrName), + info.defaultBindingMode || this.determineDefaultBindingMode(element, info.attrName, context), resources.lookupFunctions ); @@ -276,7 +280,7 @@ export class SyntaxInterpreter { return instruction; } - options(resources, element, info, existingInstruction) { + options(resources, element, info, existingInstruction, context) { let instruction = existingInstruction || BehaviorInstruction.attribute(info.attrName); let attrValue = info.attrValue; let language = this.language; @@ -291,7 +295,7 @@ export class SyntaxInterpreter { if (current === ';') { info = language.inspectAttribute(resources, name, target.trim()); - language.createAttributeInstruction(resources, element, info, instruction); + language.createAttributeInstruction(resources, element, info, instruction, context); if (!instruction.attributes[info.attrName]) { instruction.attributes[info.attrName] = info.attrValue; @@ -309,7 +313,7 @@ export class SyntaxInterpreter { if (name !== null) { info = language.inspectAttribute(resources, name, target.trim()); - language.createAttributeInstruction(resources, element, info, instruction); + language.createAttributeInstruction(resources, element, info, instruction, context); if (!instruction.attributes[info.attrName]) { instruction.attributes[info.attrName] = info.attrValue; @@ -463,7 +467,7 @@ export class TemplatingBindingLanguage extends BindingLanguage { return info; } - createAttributeInstruction(resources, element, theInfo, existingInstruction) { + createAttributeInstruction(resources, element, theInfo, existingInstruction, context) { let instruction; if (theInfo.expression) { @@ -478,7 +482,8 @@ export class TemplatingBindingLanguage extends BindingLanguage { resources, element, theInfo, - existingInstruction + existingInstruction, + context ); } diff --git a/dist/system/aurelia-templating-binding.js b/dist/system/aurelia-templating-binding.js index 12c1edb..d5805c9 100644 --- a/dist/system/aurelia-templating-binding.js +++ b/dist/system/aurelia-templating-binding.js @@ -233,20 +233,20 @@ System.register(['aurelia-logging', 'aurelia-binding', 'aurelia-templating'], fu this.eventManager = eventManager; } - SyntaxInterpreter.prototype.interpret = function interpret(resources, element, info, existingInstruction) { + SyntaxInterpreter.prototype.interpret = function interpret(resources, element, info, existingInstruction, context) { if (info.command in this) { - return this[info.command](resources, element, info, existingInstruction); + return this[info.command](resources, element, info, existingInstruction, context); } - return this.handleUnknownCommand(resources, element, info, existingInstruction); + return this.handleUnknownCommand(resources, element, info, existingInstruction, context); }; - SyntaxInterpreter.prototype.handleUnknownCommand = function handleUnknownCommand(resources, element, info, existingInstruction) { + SyntaxInterpreter.prototype.handleUnknownCommand = function handleUnknownCommand(resources, element, info, existingInstruction, context) { LogManager.getLogger('templating-binding').warn('Unknown binding command.', info); return existingInstruction; }; - SyntaxInterpreter.prototype.determineDefaultBindingMode = function determineDefaultBindingMode(element, attrName) { + SyntaxInterpreter.prototype.determineDefaultBindingMode = function determineDefaultBindingMode(element, attrName, context) { var tagName = element.tagName.toLowerCase(); if (tagName === 'input') { @@ -259,13 +259,17 @@ System.register(['aurelia-logging', 'aurelia-binding', 'aurelia-templating'], fu return bindingMode.twoWay; } + if (context && attrName in context.attributes) { + return context.attributes[attrName].defaultBindingMode || bindingMode.oneWay; + } + return bindingMode.oneWay; }; - SyntaxInterpreter.prototype.bind = function bind(resources, element, info, existingInstruction) { + SyntaxInterpreter.prototype.bind = function bind(resources, element, info, existingInstruction, context) { var instruction = existingInstruction || BehaviorInstruction.attribute(info.attrName); - instruction.attributes[info.attrName] = new BindingExpression(this.observerLocator, this.attributeMap[info.attrName] || info.attrName, this.parser.parse(info.attrValue), info.defaultBindingMode || this.determineDefaultBindingMode(element, info.attrName), resources.lookupFunctions); + instruction.attributes[info.attrName] = new BindingExpression(this.observerLocator, this.attributeMap[info.attrName] || info.attrName, this.parser.parse(info.attrValue), info.defaultBindingMode || this.determineDefaultBindingMode(element, info.attrName, context), resources.lookupFunctions); return instruction; }; @@ -286,7 +290,7 @@ System.register(['aurelia-logging', 'aurelia-binding', 'aurelia-templating'], fu return instruction; }; - SyntaxInterpreter.prototype.options = function options(resources, element, info, existingInstruction) { + SyntaxInterpreter.prototype.options = function options(resources, element, info, existingInstruction, context) { var instruction = existingInstruction || BehaviorInstruction.attribute(info.attrName); var attrValue = info.attrValue; var language = this.language; @@ -301,7 +305,7 @@ System.register(['aurelia-logging', 'aurelia-binding', 'aurelia-templating'], fu if (current === ';') { info = language.inspectAttribute(resources, name, target.trim()); - language.createAttributeInstruction(resources, element, info, instruction); + language.createAttributeInstruction(resources, element, info, instruction, context); if (!instruction.attributes[info.attrName]) { instruction.attributes[info.attrName] = info.attrValue; @@ -319,7 +323,7 @@ System.register(['aurelia-logging', 'aurelia-binding', 'aurelia-templating'], fu if (name !== null) { info = language.inspectAttribute(resources, name, target.trim()); - language.createAttributeInstruction(resources, element, info, instruction); + language.createAttributeInstruction(resources, element, info, instruction, context); if (!instruction.attributes[info.attrName]) { instruction.attributes[info.attrName] = info.attrValue; @@ -460,7 +464,7 @@ System.register(['aurelia-logging', 'aurelia-binding', 'aurelia-templating'], fu return info; }; - TemplatingBindingLanguage.prototype.createAttributeInstruction = function createAttributeInstruction(resources, element, theInfo, existingInstruction) { + TemplatingBindingLanguage.prototype.createAttributeInstruction = function createAttributeInstruction(resources, element, theInfo, existingInstruction, context) { var instruction = undefined; if (theInfo.expression) { @@ -471,7 +475,7 @@ System.register(['aurelia-logging', 'aurelia-binding', 'aurelia-templating'], fu instruction = existingInstruction || BehaviorInstruction.attribute(theInfo.attrName); instruction.attributes[theInfo.attrName] = theInfo.expression; } else if (theInfo.command) { - instruction = this.syntaxInterpreter.interpret(resources, element, theInfo, existingInstruction); + instruction = this.syntaxInterpreter.interpret(resources, element, theInfo, existingInstruction, context); } return instruction; diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 079b84f..acd31c2 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.0.0-beta.1.0.1 (2015-12-03) + + +#### Bug Fixes + +* **binding-language:** apply default modes to options props ([d025af9b](http://github.com/aurelia/templating-binding/commit/d025af9b6f8a10cfda98ae87ae876ac9fff7b33c)) + + ### 1.0.0-beta.1 (2015-11-16) diff --git a/package.json b/package.json index f38d405..1012ed6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-templating-binding", - "version": "1.0.0-beta.1", + "version": "1.0.0-beta.1.0.1", "description": "An implementation of the templating engine's Binding Language abstraction which uses a pluggable command syntax.", "keywords": [ "aurelia",