Skip to content

Commit

Permalink
chore(all): prepare release 1.0.0-beta.1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jan 29, 2016
1 parent bdff323 commit 3cc6d3c
Show file tree
Hide file tree
Showing 14 changed files with 216 additions and 85 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": "1.0.0-beta.1.0.3",
"version": "1.0.0-beta.1.1.0",
"description": "An extensible HTML templating engine supporting databinding, custom elements, attached behaviors and more.",
"keywords": [
"aurelia",
Expand Down
5 changes: 3 additions & 2 deletions dist/amd/aurelia-templating.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ declare module 'aurelia-templating' {
*/
constructor(parentContainer: Container, viewFactory: ViewFactory, partReplacements?: Object);

// This is referenced internally in the controller's bind method.
/**
* Creates a view or returns one from the internal cache, if available.
* @return The created view.
Expand Down Expand Up @@ -1363,12 +1364,12 @@ declare module 'aurelia-templating' {
}

/**
* Creates a behavior property that references an array of immediate content child elememnts that matches the provided selector.
* Creates a behavior property that references an array of immediate content child elements that matches the provided selector.
*/
export function children(selectorOrConfig: string | Object): any;

/**
* Creates a behavior property that references an immediate content child elememnt that matches the provided selector.
* Creates a behavior property that references an immediate content child element that matches the provided selector.
*/
export function child(selectorOrConfig: string | Object): any;
class ChildObserver {
Expand Down
32 changes: 25 additions & 7 deletions dist/amd/aurelia-templating.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-pa
instruction.host = host;
instruction.viewModel = viewModel;
instruction.viewFactory = viewFactory;
instruction.inheritBindingContext = true;
return instruction;
};

Expand All @@ -212,6 +213,7 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-pa
this.attributes = null;
this.type = null;
this.attrName = null;
this.inheritBindingContext = false;
}

return BehaviorInstruction;
Expand Down Expand Up @@ -2674,7 +2676,7 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-pa
this.isAttached = false;
this.view = null;
this.isBound = false;
this.bindingContext = null;
this.scope = null;

var observerLookup = behavior.observerLocator.getOrCreateObserversLookup(viewModel);
var handlesBind = behavior.handlesBind;
Expand Down Expand Up @@ -2717,18 +2719,17 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-pa
var x = undefined;
var observer = undefined;
var selfSubscriber = undefined;
var context = scope.bindingContext;

if (this.isBound) {
if (this.bindingContext === context) {
if (this.scope === scope) {
return;
}

this.unbind();
}

this.isBound = true;
this.bindingContext = context;
this.scope = scope;

for (i = 0, ii = boundProperties.length; i < ii; ++i) {
x = boundProperties[i];
Expand All @@ -2747,14 +2748,29 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-pa
observer.selfSubscriber = selfSubscriber;
}

var overrideContext = undefined;
if (this.view !== null) {
if (skipSelfSubscriber) {
this.view.viewModelScope = scope;
}

this.view.bind(this.viewModel, _aureliaBinding.createOverrideContext(this.viewModel, scope.overrideContext));
if (this.viewModel === scope.overrideContext.bindingContext) {
overrideContext = scope.overrideContext;
} else if (this.instruction.inheritBindingContext) {
overrideContext = _aureliaBinding.createOverrideContext(this.viewModel, scope.overrideContext);
} else {
overrideContext = _aureliaBinding.createOverrideContext(this.viewModel);
overrideContext.__parentOverrideContext = scope.overrideContext;
}
this.view.bind(this.viewModel, overrideContext);
} else if (skipSelfSubscriber) {
this.viewModel.bind(context, scope.overrideContext);
overrideContext = scope.overrideContext;

if (scope.overrideContext.__parentOverrideContext !== undefined && this.viewModel.viewFactory && this.viewModel.viewFactory.factoryCreateInstruction.partReplacements) {
overrideContext = Object.assign({}, scope.overrideContext);
overrideContext.parentOverrideContext = scope.overrideContext.__parentOverrideContext;
}
this.viewModel.bind(scope.bindingContext, overrideContext);
}
};

Expand Down Expand Up @@ -3279,7 +3295,7 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-pa
node = template;
}
} else if (this.elementName !== null) {
var _partReplacements2 = instruction.partReplacements = {};
var _partReplacements2 = {};

if (this.processContent(compiler, resources, node, instruction) && node.hasChildNodes()) {
if (this.usesShadowDOM) {
Expand All @@ -3293,6 +3309,7 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-pa
if (currentChild.tagName === 'TEMPLATE' && (toReplace = currentChild.getAttribute('replace-part'))) {
_partReplacements2[toReplace] = compiler.compile(currentChild, resources);
_aureliaPal.DOM.removeNode(currentChild, parentNode);
instruction.partReplacements = _partReplacements2;
}

currentChild = nextSibling;
Expand All @@ -3311,6 +3328,7 @@ define(['exports', 'core-js', 'aurelia-logging', 'aurelia-metadata', 'aurelia-pa
if (currentChild.tagName === 'TEMPLATE' && (toReplace = currentChild.getAttribute('replace-part'))) {
_partReplacements2[toReplace] = compiler.compile(currentChild, resources);
_aureliaPal.DOM.removeNode(currentChild, parentNode);
instruction.partReplacements = _partReplacements2;
} else {
fragment.appendChild(currentChild);
}
Expand Down
5 changes: 3 additions & 2 deletions dist/aurelia-templating.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ declare module 'aurelia-templating' {
*/
constructor(parentContainer: Container, viewFactory: ViewFactory, partReplacements?: Object);

// This is referenced internally in the controller's bind method.
/**
* Creates a view or returns one from the internal cache, if available.
* @return The created view.
Expand Down Expand Up @@ -1363,12 +1364,12 @@ declare module 'aurelia-templating' {
}

/**
* Creates a behavior property that references an array of immediate content child elememnts that matches the provided selector.
* Creates a behavior property that references an array of immediate content child elements that matches the provided selector.
*/
export function children(selectorOrConfig: string | Object): any;

/**
* Creates a behavior property that references an immediate content child elememnt that matches the provided selector.
* Creates a behavior property that references an immediate content child element that matches the provided selector.
*/
export function child(selectorOrConfig: string | Object): any;
class ChildObserver {
Expand Down
53 changes: 41 additions & 12 deletions dist/aurelia-templating.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ export class BehaviorInstruction {
instruction.host = host;
instruction.viewModel = viewModel;
instruction.viewFactory = viewFactory;
instruction.inheritBindingContext = true;
return instruction;
}

Expand All @@ -286,6 +287,7 @@ export class BehaviorInstruction {
this.attributes = null;
this.type = null;
this.attrName = null;
this.inheritBindingContext = false;
}
}

Expand Down Expand Up @@ -2086,7 +2088,7 @@ export class BoundViewFactory {
constructor(parentContainer: Container, viewFactory: ViewFactory, partReplacements?: Object) {
this.parentContainer = parentContainer;
this.viewFactory = viewFactory;
this.factoryCreateInstruction = { partReplacements: partReplacements };
this.factoryCreateInstruction = { partReplacements: partReplacements }; //This is referenced internally in the controller's bind method.
}

/**
Expand Down Expand Up @@ -3226,7 +3228,7 @@ export class Controller {
this.isAttached = false;
this.view = null;
this.isBound = false;
this.bindingContext = null;
this.scope = null;

let observerLookup = behavior.observerLocator.getOrCreateObserversLookup(viewModel);
let handlesBind = behavior.handlesBind;
Expand Down Expand Up @@ -3264,7 +3266,7 @@ export class Controller {
this.view.overrideContext = overrideContext || createOverrideContext(this.viewModel);
this.view._isUserControlled = true;

if(this.behavior.handlesCreated) {
if (this.behavior.handlesCreated) {
this.viewModel.created(owningView || null, this.view);
}

Expand All @@ -3283,18 +3285,17 @@ export class Controller {
let x;
let observer;
let selfSubscriber;
let context = scope.bindingContext;

if (this.isBound) {
if (this.bindingContext === context) {
if (this.scope === scope) {
return;
}

this.unbind();
}

this.isBound = true;
this.bindingContext = context;
this.scope = scope;

for (i = 0, ii = boundProperties.length; i < ii; ++i) {
x = boundProperties[i];
Expand All @@ -3313,14 +3314,40 @@ export class Controller {
observer.selfSubscriber = selfSubscriber;
}

let overrideContext;
if (this.view !== null) {
if (skipSelfSubscriber) {
this.view.viewModelScope = scope;
}

this.view.bind(this.viewModel, createOverrideContext(this.viewModel, scope.overrideContext));
// do we need to create an overrideContext or is the scope's overrideContext
// valid for this viewModel?
if (this.viewModel === scope.overrideContext.bindingContext) {
overrideContext = scope.overrideContext;
// should we inherit the parent scope? (eg compose / router)
} else if (this.instruction.inheritBindingContext) {
overrideContext = createOverrideContext(this.viewModel, scope.overrideContext);
// create the overrideContext and capture the parent without making it
// available to AccessScope. We may need it later for template-part replacements.
} else {
overrideContext = createOverrideContext(this.viewModel);
overrideContext.__parentOverrideContext = scope.overrideContext;
}
this.view.bind(this.viewModel, overrideContext);
} else if (skipSelfSubscriber) {
this.viewModel.bind(context, scope.overrideContext);
overrideContext = scope.overrideContext;
// the factoryCreateInstruction's partReplacements will either be null or an object
// containing the replacements. If there are partReplacements we need to preserve the parent
// context to allow replacement parts to bind to both the custom element scope and the ambient scope.
// Note that factoryCreateInstruction is a property defined on BoundViewFactory. The code below assumes the
// behavior stores a the BoundViewFactory on its viewModel under the name of viewFactory. This is implemented
// by the replaceable custom attribute.
if (scope.overrideContext.__parentOverrideContext !== undefined
&& this.viewModel.viewFactory && this.viewModel.viewFactory.factoryCreateInstruction.partReplacements) {
// clone the overrideContext and connect the ambient context.
overrideContext = Object.assign({}, scope.overrideContext);
overrideContext.parentOverrideContext = scope.overrideContext.__parentOverrideContext;
}
this.viewModel.bind(scope.bindingContext, overrideContext);
}
}

Expand Down Expand Up @@ -3932,7 +3959,7 @@ export class HtmlBehaviorResource {
node = template;
}
} else if (this.elementName !== null) { //custom element
let partReplacements = instruction.partReplacements = {};
let partReplacements = {};

if (this.processContent(compiler, resources, node, instruction) && node.hasChildNodes()) {
if (this.usesShadowDOM) {
Expand All @@ -3946,6 +3973,7 @@ export class HtmlBehaviorResource {
if (currentChild.tagName === 'TEMPLATE' && (toReplace = currentChild.getAttribute('replace-part'))) {
partReplacements[toReplace] = compiler.compile(currentChild, resources);
DOM.removeNode(currentChild, parentNode);
instruction.partReplacements = partReplacements;
}

currentChild = nextSibling;
Expand All @@ -3964,6 +3992,7 @@ export class HtmlBehaviorResource {
if (currentChild.tagName === 'TEMPLATE' && (toReplace = currentChild.getAttribute('replace-part'))) {
partReplacements[toReplace] = compiler.compile(currentChild, resources);
DOM.removeNode(currentChild, parentNode);
instruction.partReplacements = partReplacements;
} else {
fragment.appendChild(currentChild);
}
Expand Down Expand Up @@ -4144,14 +4173,14 @@ function createChildObserverDecorator(selectorOrConfig, all) {
}

/**
* Creates a behavior property that references an array of immediate content child elememnts that matches the provided selector.
* Creates a behavior property that references an array of immediate content child elements that matches the provided selector.
*/
export function children(selectorOrConfig: string | Object): any {
return createChildObserverDecorator(selectorOrConfig, true);
}

/**
* Creates a behavior property that references an immediate content child elememnt that matches the provided selector.
* Creates a behavior property that references an immediate content child element that matches the provided selector.
*/
export function child(selectorOrConfig: string | Object): any {
return createChildObserverDecorator(selectorOrConfig, false);
Expand Down
5 changes: 3 additions & 2 deletions dist/commonjs/aurelia-templating.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ declare module 'aurelia-templating' {
*/
constructor(parentContainer: Container, viewFactory: ViewFactory, partReplacements?: Object);

// This is referenced internally in the controller's bind method.
/**
* Creates a view or returns one from the internal cache, if available.
* @return The created view.
Expand Down Expand Up @@ -1363,12 +1364,12 @@ declare module 'aurelia-templating' {
}

/**
* Creates a behavior property that references an array of immediate content child elememnts that matches the provided selector.
* Creates a behavior property that references an array of immediate content child elements that matches the provided selector.
*/
export function children(selectorOrConfig: string | Object): any;

/**
* Creates a behavior property that references an immediate content child elememnt that matches the provided selector.
* Creates a behavior property that references an immediate content child element that matches the provided selector.
*/
export function child(selectorOrConfig: string | Object): any;
class ChildObserver {
Expand Down
Loading

0 comments on commit 3cc6d3c

Please sign in to comment.