Skip to content

Commit

Permalink
chore(all): prepare release 1.0.0-beta.1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Apr 29, 2016
1 parent 9431f53 commit 6d0c154
Show file tree
Hide file tree
Showing 14 changed files with 1,832 additions and 1,172 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.2.2",
"version": "1.0.0-beta.1.2.3",
"description": "An extensible HTML templating engine supporting databinding, custom elements, attached behaviors and more.",
"keywords": [
"aurelia",
Expand Down
24 changes: 23 additions & 1 deletion dist/amd/aurelia-templating.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ declare module 'aurelia-templating' {
* A binding context for the enhancement.
*/
bindingContext?: Object;

/**
* A secondary binding context that can override the standard context.
*/
overrideContext?: any;
}

/**
Expand Down Expand Up @@ -853,13 +858,14 @@ declare module 'aurelia-templating' {

/**
* Creates a View instance.
* @param container The container from which the view was created.
* @param viewFactory The factory that created this view.
* @param fragment The DOM fragement representing the view.
* @param controllers The controllers inside this view.
* @param bindings The bindings inside this view.
* @param children The children of this view.
*/
constructor(viewFactory: ViewFactory, fragment: DocumentFragment, controllers: Controller[], bindings: Binding[], children: ViewNode[], contentSelectors: Array<Object>);
constructor(container: Container, viewFactory: ViewFactory, fragment: DocumentFragment, controllers: Controller[], bindings: Binding[], children: ViewNode[], contentSelectors: Array<Object>);

/**
* Returns this view to the appropriate view cache.
Expand Down Expand Up @@ -964,6 +970,13 @@ declare module 'aurelia-templating' {
*/
insert(index: number, view: View): void | Promise<any>;

/**
* Moves a view across the slot.
* @param sourceIndex The index the view is currently at.
* @param targetIndex The index to insert the view at.
*/
move(sourceIndex: any, targetIndex: any): any;

/**
* Removes a view from the slot.
* @param view The view to remove.
Expand All @@ -973,6 +986,15 @@ declare module 'aurelia-templating' {
*/
remove(view: View, returnToCache?: boolean, skipAnimation?: boolean): void | Promise<View>;

/**
* Removes many views from the slot.
* @param viewsToRemove The array of views to remove.
* @param returnToCache Should the views be returned to the view cache?
* @param skipAnimation Should the removal animation be skipped?
* @return May return a promise if the view removal triggered an animation.
*/
removeMany(viewsToRemove: View[], returnToCache?: boolean, skipAnimation?: boolean): void | Promise<View>;

/**
* Removes a view an a specified index from the slot.
* @param index The index to remove the view at.
Expand Down
125 changes: 97 additions & 28 deletions dist/amd/aurelia-templating.js
Original file line number Diff line number Diff line change
Expand Up @@ -844,9 +844,10 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli
}();

var View = exports.View = function () {
function View(viewFactory, fragment, controllers, bindings, children, contentSelectors) {
function View(container, viewFactory, fragment, controllers, bindings, children, contentSelectors) {
_classCallCheck(this, View);

this.container = container;
this.viewFactory = viewFactory;
this.resources = viewFactory.resources;
this.fragment = fragment;
Expand Down Expand Up @@ -1298,21 +1299,89 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli
}
};

ViewSlot.prototype.move = function move(sourceIndex, targetIndex) {
if (sourceIndex === targetIndex) {
return;
}

var children = this.children;
var view = children[sourceIndex];

view.removeNodes();
view.insertNodesBefore(children[targetIndex].firstChild);
children.splice(sourceIndex, 1);
children.splice(targetIndex, 0, view);
};

ViewSlot.prototype.remove = function remove(view, returnToCache, skipAnimation) {
return this.removeAt(this.children.indexOf(view), returnToCache, skipAnimation);
};

ViewSlot.prototype.removeAt = function removeAt(index, returnToCache, skipAnimation) {
ViewSlot.prototype.removeMany = function removeMany(viewsToRemove, returnToCache, skipAnimation) {
var _this4 = this;

var children = this.children;
var ii = viewsToRemove.length;
var i = void 0;
var rmPromises = [];

viewsToRemove.forEach(function (child) {
if (skipAnimation) {
child.removeNodes();
return;
}

var animatableElement = getAnimatableElement(child);
if (animatableElement !== null) {
rmPromises.push(_this4.animator.leave(animatableElement).then(function () {
return child.removeNodes();
}));
} else {
child.removeNodes();
}
});

var removeAction = function removeAction() {
if (_this4.isAttached) {
for (i = 0; i < ii; ++i) {
viewsToRemove[i].detached();
}
}

if (returnToCache) {
for (i = 0; i < ii; ++i) {
viewsToRemove[i].returnToCache();
}
}

for (i = 0; i < ii; ++i) {
var index = children.indexOf(viewsToRemove[i]);
if (index >= 0) {
children.splice(index, 1);
}
}
};

if (rmPromises.length > 0) {
return Promise.all(rmPromises).then(function () {
return removeAction();
});
}

removeAction();
};

ViewSlot.prototype.removeAt = function removeAt(index, returnToCache, skipAnimation) {
var _this5 = this;

var view = this.children[index];

var removeAction = function removeAction() {
index = _this4.children.indexOf(view);
index = _this5.children.indexOf(view);
view.removeNodes();
_this4.children.splice(index, 1);
_this5.children.splice(index, 1);

if (_this4.isAttached) {
if (_this5.isAttached) {
view.detached();
}

Expand All @@ -1336,7 +1405,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli
};

ViewSlot.prototype.removeAll = function removeAll(returnToCache, skipAnimation) {
var _this5 = this;
var _this6 = this;

var children = this.children;
var ii = children.length;
Expand All @@ -1351,7 +1420,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli

var animatableElement = getAnimatableElement(child);
if (animatableElement !== null) {
rmPromises.push(_this5.animator.leave(animatableElement).then(function () {
rmPromises.push(_this6.animator.leave(animatableElement).then(function () {
return child.removeNodes();
}));
} else {
Expand All @@ -1360,7 +1429,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli
});

var removeAction = function removeAction() {
if (_this5.isAttached) {
if (_this6.isAttached) {
for (i = 0; i < ii; ++i) {
children[i].detached();
}
Expand All @@ -1372,7 +1441,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli
}
}

_this5.children = [];
_this6.children = [];
};

if (rmPromises.length > 0) {
Expand Down Expand Up @@ -1889,7 +1958,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli
applyInstructions(containers, instructable, instruction, controllers, bindings, children, contentSelectors, partReplacements, resources);
}

view = new View(this, fragment, controllers, bindings, children, contentSelectors);
view = new View(container, this, fragment, controllers, bindings, children, contentSelectors);

if (!createInstruction.initiatedByBehavior) {
view.created();
Expand Down Expand Up @@ -2539,12 +2608,12 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli

var ProxyViewFactory = function () {
function ProxyViewFactory(promise) {
var _this6 = this;
var _this7 = this;

_classCallCheck(this, ProxyViewFactory);

promise.then(function (x) {
return _this6.viewFactory = x;
return _this7.viewFactory = x;
});
}

Expand Down Expand Up @@ -2593,7 +2662,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli
};

ViewEngine.prototype.loadViewFactory = function loadViewFactory(urlOrRegistryEntry, compileInstruction, loadContext) {
var _this7 = this;
var _this8 = this;

loadContext = loadContext || new ResourceLoadContext();

Expand All @@ -2609,9 +2678,9 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli

loadContext.addDependency(urlOrRegistryEntry);

registryEntry.onReady = _this7.loadTemplateResources(registryEntry, compileInstruction, loadContext).then(function (resources) {
registryEntry.onReady = _this8.loadTemplateResources(registryEntry, compileInstruction, loadContext).then(function (resources) {
registryEntry.resources = resources;
var viewFactory = _this7.viewCompiler.compile(registryEntry.template, resources, compileInstruction);
var viewFactory = _this8.viewCompiler.compile(registryEntry.template, resources, compileInstruction);
registryEntry.factory = viewFactory;
return viewFactory;
});
Expand Down Expand Up @@ -2644,30 +2713,30 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli
};

ViewEngine.prototype.importViewModelResource = function importViewModelResource(moduleImport, moduleMember) {
var _this8 = this;
var _this9 = this;

return this.loader.loadModule(moduleImport).then(function (viewModelModule) {
var normalizedId = _aureliaMetadata.Origin.get(viewModelModule).moduleId;
var resourceModule = _this8.moduleAnalyzer.analyze(normalizedId, viewModelModule, moduleMember);
var resourceModule = _this9.moduleAnalyzer.analyze(normalizedId, viewModelModule, moduleMember);

if (!resourceModule.mainResource) {
throw new Error('No view model found in module "' + moduleImport + '".');
}

resourceModule.initialize(_this8.container);
resourceModule.initialize(_this9.container);

return resourceModule.mainResource;
});
};

ViewEngine.prototype.importViewResources = function importViewResources(moduleIds, names, resources, compileInstruction, loadContext) {
var _this9 = this;
var _this10 = this;

loadContext = loadContext || new ResourceLoadContext();
compileInstruction = compileInstruction || ViewCompileInstruction.normal;

moduleIds = moduleIds.map(function (x) {
return _this9._applyLoaderPlugin(x);
return _this10._applyLoaderPlugin(x);
});

return this.loader.loadAllModules(moduleIds).then(function (imports) {
Expand All @@ -2677,8 +2746,8 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli
var normalizedId = void 0;
var current = void 0;
var associatedModule = void 0;
var container = _this9.container;
var moduleAnalyzer = _this9.moduleAnalyzer;
var container = _this10.container;
var moduleAnalyzer = _this10.moduleAnalyzer;
var allAnalysis = new Array(imports.length);

for (i = 0, ii = imports.length; i < ii; ++i) {
Expand Down Expand Up @@ -3310,7 +3379,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli
};

HtmlBehaviorResource.prototype.load = function load(container, target, loadContext, viewStrategy, transientView) {
var _this10 = this;
var _this11 = this;

var options = void 0;

Expand All @@ -3323,8 +3392,8 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli
}

return viewStrategy.loadViewFactory(container.get(ViewEngine), options, loadContext).then(function (viewFactory) {
if (!transientView || !_this10.viewFactory) {
_this10.viewFactory = viewFactory;
if (!transientView || !_this11.viewFactory) {
_this11.viewFactory = viewFactory;
}

return viewFactory;
Expand Down Expand Up @@ -3813,7 +3882,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli
};

CompositionEngine.prototype.createController = function createController(context) {
var _this11 = this;
var _this12 = this;

var childContainer = void 0;
var viewModel = void 0;
Expand All @@ -3826,7 +3895,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli
viewModelResource = context.viewModelResource;
m = viewModelResource.metadata;

var viewStrategy = _this11.viewLocator.getViewStrategy(context.view || viewModel);
var viewStrategy = _this12.viewLocator.getViewStrategy(context.view || viewModel);

if (context.viewResources) {
viewStrategy.makeRelativeTo(context.viewResources.viewUrl);
Expand Down Expand Up @@ -4126,7 +4195,7 @@ define(['exports', 'aurelia-logging', 'aurelia-pal', 'aurelia-metadata', 'aureli
var container = instruction.container || this._container.createChild();
var view = factory.create(container, BehaviorInstruction.enhance());

view.bind(instruction.bindingContext || {});
view.bind(instruction.bindingContext || {}, instruction.overrideContext);

return view;
};
Expand Down
Loading

0 comments on commit 6d0c154

Please sign in to comment.