dist/ember.prod.js in ember-source-2.1.0.beta.1 vs dist/ember.prod.js in ember-source-2.1.0.beta.3
- old
+ new
@@ -3,11 +3,11 @@
* @copyright Copyright 2011-2015 Tilde Inc. and contributors
* Portions Copyright 2006-2011 Strobe Inc.
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
* @license Licensed under MIT license
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
- * @version 2.1.0-beta.1
+ * @version 2.1.0-beta.3
*/
(function() {
var enifed, requireModule, eriuqer, requirejs, Ember;
var mainContext = this;
@@ -3477,12 +3477,10 @@
// Because we need a good way for the root route (a.k.a ApplicationRoute)
// to notify us when it has created the root-most view. That view is then
// appended to the rootElement, in the case of apps, to the fixture harness
// in tests, or rendered to a string in the case of FastBoot.
this.register('-application-instance:main', this, { instantiate: false });
-
- assignAliases(this);
},
router: _emberMetalComputed.computed(function () {
return this.lookup('router:main');
}).readOnly(),
@@ -3586,29 +3584,34 @@
function isResolverModuleBased(applicationInstance) {
return !!applicationInstance.application.__registry__.resolver.moduleBasedResolver;
}
- function assignAliases(applicationInstance) {
- Object.defineProperty(applicationInstance, 'container', {
- configurable: true,
- enumerable: false,
- get: function () {
- var instance = this;
- return {
- lookup: function () {
- return instance.lookup.apply(instance, arguments);
- }
- };
- }
- });
- }
+ Object.defineProperty(ApplicationInstance.prototype, 'container', {
+ configurable: true,
+ enumerable: false,
+ get: function () {
+ var instance = this;
+ return {
+ lookup: function () {
+ return instance.lookup.apply(instance, arguments);
+ }
+ };
+ }
+ });
+ Object.defineProperty(ApplicationInstance.prototype, 'registry', {
+ configurable: true,
+ enumerable: false,
+ get: function () {
+ return _emberRuntimeMixinsRegistry_proxy.buildFakeRegistryWithDeprecations(this, 'ApplicationInstance');
+ }
+ });
exports.default = ApplicationInstance;
});
// Ember.deprecate
-enifed('ember-application/system/application', ['exports', 'dag-map', 'container/registry', 'ember-metal', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/empty_object', 'ember-runtime/system/lazy_load', 'ember-runtime/system/namespace', 'ember-application/system/resolver', 'ember-metal/run_loop', 'ember-metal/utils', 'ember-runtime/controllers/controller', 'ember-metal-views/renderer', 'ember-htmlbars/system/dom-helper', 'ember-views/views/select', 'ember-routing-views/views/outlet', 'ember-views/views/view', 'ember-views/system/event_dispatcher', 'ember-views/system/jquery', 'ember-routing/system/route', 'ember-routing/system/router', 'ember-routing/location/hash_location', 'ember-routing/location/history_location', 'ember-routing/location/auto_location', 'ember-routing/location/none_location', 'ember-routing/system/cache', 'ember-application/system/application-instance', 'ember-views/views/text_field', 'ember-views/views/text_area', 'ember-views/views/checkbox', 'ember-views/views/legacy_each_view', 'ember-routing-views/views/link', 'ember-routing/services/routing', 'ember-extension-support/container_debug_adapter', 'ember-runtime/mixins/registry_proxy', 'ember-metal/environment'], function (exports, _dagMap, _containerRegistry, _emberMetal, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalEmpty_object, _emberRuntimeSystemLazy_load, _emberRuntimeSystemNamespace, _emberApplicationSystemResolver, _emberMetalRun_loop, _emberMetalUtils, _emberRuntimeControllersController, _emberMetalViewsRenderer, _emberHtmlbarsSystemDomHelper, _emberViewsViewsSelect, _emberRoutingViewsViewsOutlet, _emberViewsViewsView, _emberViewsSystemEvent_dispatcher, _emberViewsSystemJquery, _emberRoutingSystemRoute, _emberRoutingSystemRouter, _emberRoutingLocationHash_location, _emberRoutingLocationHistory_location, _emberRoutingLocationAuto_location, _emberRoutingLocationNone_location, _emberRoutingSystemCache, _emberApplicationSystemApplicationInstance, _emberViewsViewsText_field, _emberViewsViewsText_area, _emberViewsViewsCheckbox, _emberViewsViewsLegacy_each_view, _emberRoutingViewsViewsLink, _emberRoutingServicesRouting, _emberExtensionSupportContainer_debug_adapter, _emberRuntimeMixinsRegistry_proxy, _emberMetalEnvironment) {
+enifed('ember-application/system/application', ['exports', 'dag-map', 'container/registry', 'ember-metal', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/empty_object', 'ember-runtime/system/lazy_load', 'ember-runtime/system/namespace', 'ember-application/system/resolver', 'ember-metal/run_loop', 'ember-metal/utils', 'ember-runtime/controllers/controller', 'ember-metal-views/renderer', 'ember-htmlbars/system/dom-helper', 'ember-views/views/select', 'ember-routing-views/views/outlet', 'ember-views/views/view', 'ember-views/system/event_dispatcher', 'ember-views/system/jquery', 'ember-routing/system/route', 'ember-routing/system/router', 'ember-routing/location/hash_location', 'ember-routing/location/history_location', 'ember-routing/location/auto_location', 'ember-routing/location/none_location', 'ember-routing/system/cache', 'ember-application/system/application-instance', 'ember-views/views/text_field', 'ember-views/views/text_area', 'ember-views/views/checkbox', 'ember-views/views/legacy_each_view', 'ember-routing-views/components/link-to', 'ember-routing/services/routing', 'ember-extension-support/container_debug_adapter', 'ember-runtime/mixins/registry_proxy', 'ember-metal/environment'], function (exports, _dagMap, _containerRegistry, _emberMetal, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalEmpty_object, _emberRuntimeSystemLazy_load, _emberRuntimeSystemNamespace, _emberApplicationSystemResolver, _emberMetalRun_loop, _emberMetalUtils, _emberRuntimeControllersController, _emberMetalViewsRenderer, _emberHtmlbarsSystemDomHelper, _emberViewsViewsSelect, _emberRoutingViewsViewsOutlet, _emberViewsViewsView, _emberViewsSystemEvent_dispatcher, _emberViewsSystemJquery, _emberRoutingSystemRoute, _emberRoutingSystemRouter, _emberRoutingLocationHash_location, _emberRoutingLocationHistory_location, _emberRoutingLocationAuto_location, _emberRoutingLocationNone_location, _emberRoutingSystemCache, _emberApplicationSystemApplicationInstance, _emberViewsViewsText_field, _emberViewsViewsText_area, _emberViewsViewsCheckbox, _emberViewsViewsLegacy_each_view, _emberRoutingViewsComponentsLinkTo, _emberRoutingServicesRouting, _emberExtensionSupportContainer_debug_adapter, _emberRuntimeMixinsRegistry_proxy, _emberMetalEnvironment) {
/**
@module ember
@submodule ember-application
*/
'use strict';
@@ -4214,10 +4217,18 @@
initializer: function (options) {
this.constructor.initializer(options);
}
});
+ Object.defineProperty(Application.prototype, 'registry', {
+ configurable: true,
+ enumerable: false,
+ get: function () {
+ return _emberRuntimeMixinsRegistry_proxy.buildFakeRegistryWithDeprecations(this, 'Application');
+ }
+ });
+
Application.reopenClass({
/**
Instance initializers run after all initializers have run. Because
instance initializers run after the app is fully set up. We have access
to the store, container, and other items. However, these initializers run
@@ -4452,11 +4463,11 @@
registry.register('component:-text-field', _emberViewsViewsText_field.default);
registry.register('component:-text-area', _emberViewsViewsText_area.default);
registry.register('component:-checkbox', _emberViewsViewsCheckbox.default);
registry.register('view:-legacy-each', _emberViewsViewsLegacy_each_view.default);
- registry.register('component:-link-to', _emberRoutingViewsViewsLink.default);
+ registry.register('component:link-to', _emberRoutingViewsComponentsLinkTo.default);
// Register the routing service...
registry.register('service:-routing', _emberRoutingServicesRouting.default);
// Then inject the app router into it
registry.injection('service:-routing', 'router', 'router:main');
@@ -6917,11 +6928,11 @@
var _buildComponentTemplate = _emberViewsSystemBuildComponentTemplate.default(templateOptions, attrs, contentOptions);
var block = _buildComponentTemplate.block;
- block(env, [], undefined, renderNode, scope, visitor);
+ block.invoke(env, [], undefined, renderNode, scope, visitor);
}
}
});
enifed('ember-htmlbars/hooks/concat', ['exports', 'ember-metal/streams/utils'], function (exports, _emberMetalStreamsUtils) {
/**
@@ -7176,11 +7187,11 @@
if (env.helpers[helperName]) {
return true;
}
var container = env.container;
- if (_emberHtmlbarsSystemLookupHelper.validateLazyHelperName(helperName, container, env.hooks.keywords, env.knownHelpers)) {
+ if (_emberHtmlbarsSystemLookupHelper.validateLazyHelperName(helperName, container, env.hooks.keywords)) {
var containerName = 'helper:' + helperName;
if (container.registry.has(containerName)) {
return true;
}
}
@@ -8241,13 +8252,13 @@
if (hash.controller) {
scope = env.hooks.createChildScope(scope);
scope.locals.controller = new _emberMetalStreamsProxyStream.default(hash.controller, 'controller');
scope.overrideController = true;
}
- scope.blocks.default(env, [], params[0], morph, scope, visitor);
+ scope.blocks.default.invoke(env, [], params[0], morph, scope, visitor);
} else {
- scope.blocks.default(env, params, undefined, morph, scope, visitor);
+ scope.blocks.default.invoke(env, params, undefined, morph, scope, visitor);
}
return true;
}
});
@@ -8382,11 +8393,11 @@
@submodule ember-templates
*/
'use strict';
- _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.1.0-beta.1';
+ _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.1.0-beta.3';
/**
The `{{outlet}}` helper lets you specify where a child routes will render in
your template. An important use of the `{{outlet}}` helper is in your
application's `application.hbs` file:
@@ -9324,15 +9335,24 @@
env.renderedNodes[this.guid] = true;
};
exports.default = EmberMorph;
});
-enifed('ember-htmlbars/node-managers/component-node-manager', ['exports', 'ember-metal/core', 'ember-metal/assign', 'ember-views/system/build-component-template', 'ember-htmlbars/utils/lookup-component', 'ember-htmlbars/hooks/get-cell-or-value', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/set_properties', 'ember-views/compat/attrs-proxy', 'ember-htmlbars/system/instrumentation-support', 'ember-views/views/component', 'ember-metal/streams/stream', 'ember-metal/streams/utils', 'ember-htmlbars/hooks/get-value'], function (exports, _emberMetalCore, _emberMetalAssign, _emberViewsSystemBuildComponentTemplate, _emberHtmlbarsUtilsLookupComponent, _emberHtmlbarsHooksGetCellOrValue, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalSet_properties, _emberViewsCompatAttrsProxy, _emberHtmlbarsSystemInstrumentationSupport, _emberViewsViewsComponent, _emberMetalStreamsStream, _emberMetalStreamsUtils, _emberHtmlbarsHooksGetValue) {
+enifed('ember-htmlbars/node-managers/component-node-manager', ['exports', 'ember-metal/core', 'ember-views/system/build-component-template', 'ember-htmlbars/utils/lookup-component', 'ember-htmlbars/hooks/get-cell-or-value', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-views/compat/attrs-proxy', 'ember-htmlbars/system/instrumentation-support', 'ember-views/views/component', 'ember-metal/streams/stream', 'ember-metal/streams/utils', 'ember-metal/utils', 'ember-htmlbars/hooks/get-value'], function (exports, _emberMetalCore, _emberViewsSystemBuildComponentTemplate, _emberHtmlbarsUtilsLookupComponent, _emberHtmlbarsHooksGetCellOrValue, _emberMetalProperty_get, _emberMetalProperty_set, _emberViewsCompatAttrsProxy, _emberHtmlbarsSystemInstrumentationSupport, _emberViewsViewsComponent, _emberMetalStreamsStream, _emberMetalStreamsUtils, _emberMetalUtils, _emberHtmlbarsHooksGetValue) {
'use strict';
exports.createComponent = createComponent;
+ // These symbols will be used to limit link-to's public API surface area.
+ var HAS_BLOCK = _emberMetalUtils.symbol('HAS_BLOCK');
+
+ exports.HAS_BLOCK = HAS_BLOCK;
+ // In theory this should come through the env, but it should
+ // be safe to import this until we make the hook system public
+ // and it gets actively used in addons or other downstream
+ // libraries.
+
function ComponentNodeManager(component, isAngleBracket, scope, renderNode, attrs, block, expectElement) {
this.component = component;
this.isAngleBracket = isAngleBracket;
this.scope = scope;
this.renderNode = renderNode;
@@ -9342,10 +9362,12 @@
}
exports.default = ComponentNodeManager;
ComponentNodeManager.create = function (renderNode, env, options) {
+ var _createOptions;
+
var tagName = options.tagName;
var params = options.params;
var attrs = options.attrs;
var parentView = options.parentView;
var parentScope = options.parentScope;
@@ -9363,11 +9385,13 @@
var layout = _lookupComponent.layout;
component = component || _emberViewsViewsComponent.default;
- var createOptions = { parentView: parentView };
+ var createOptions = (_createOptions = {
+ parentView: parentView
+ }, _createOptions[HAS_BLOCK] = !!templates.default, _createOptions);
configureTagName(attrs, tagName, component, isAngleBracket, createOptions);
// Map passed attributes (e.g. <my-component id="foo">) to component
// properties ({ id: "foo" }).
@@ -9383,14 +9407,16 @@
extractPositionalParams(renderNode, component, params, attrs);
// Instantiate the component
component = createComponent(component, isAngleBracket, createOptions, renderNode, env, attrs);
- // If the component specifies its template via the `layout`
- // properties instead of using the template looked up in the container, get
- // them now that we have the component instance.
- layout = _emberMetalProperty_get.get(component, 'layout') || layout;
+ // If the component specifies its layout via the `layout` property
+ // instead of using the template looked up in the container, get it
+ // now that we have the component instance.
+ if (!layout) {
+ layout = _emberMetalProperty_get.get(component, 'layout');
+ }
var results = _emberViewsSystemBuildComponentTemplate.default({ layout: layout, component: component, isAngleBracket: isAngleBracket }, attrs, { templates: templates, scope: parentScope });
return new ComponentNodeManager(component, isAngleBracket, parentScope, renderNode, attrs, results.block, results.createdElement);
};
@@ -9463,20 +9489,20 @@
env.renderer.componentWillRender(component);
env.renderedViews.push(component.elementId);
if (this.block) {
- this.block(env, [], undefined, this.renderNode, this.scope, visitor);
+ this.block.invoke(env, [], undefined, this.renderNode, this.scope, visitor);
}
var element = this.expectElement && this.renderNode.firstNode;
// In environments like FastBoot, disable any hooks that would cause the component
// to access the DOM directly.
if (env.destinedForDOM) {
env.renderer.didCreateElement(component, element);
- env.renderer.willInsertElement(component, element); // 2.0TODO remove legacy hook
+ env.renderer.willInsertElement(component, element);
env.lifecycleHooks.push({ type: 'didInsertElement', view: component });
}
}, this);
};
@@ -9489,26 +9515,21 @@
var snapshot = takeSnapshot(attrs);
if (component._renderNode.shouldReceiveAttrs) {
env.renderer.componentUpdateAttrs(component, snapshot);
-
- if (!component._isAngleBracket) {
- _emberMetalSet_properties.default(component, mergeBindings({}, shadowedAttrs(component, snapshot)));
- }
-
component._renderNode.shouldReceiveAttrs = false;
}
// Notify component that it has become dirty and is about to change.
env.renderer.componentWillUpdate(component, snapshot);
env.renderer.componentWillRender(component);
env.renderedViews.push(component.elementId);
if (this.block) {
- this.block(env, [], undefined, this.renderNode, this.scope, visitor);
+ this.block.invoke(env, [], undefined, this.renderNode, this.scope, visitor);
}
env.lifecycleHooks.push({ type: 'didUpdate', view: component });
return env;
@@ -9523,24 +9544,22 @@
// node to a different view and it will get cleaned up automatically.
component._renderNode = null;
component.destroy();
};
- function createComponent(_component, isAngleBracket, _props, renderNode, env) {
+ function createComponent(_component, isAngleBracket, props, renderNode, env) {
var attrs = arguments.length <= 5 || arguments[5] === undefined ? {} : arguments[5];
- var props = _emberMetalAssign.default({}, _props);
-
if (!isAngleBracket) {
- var proto = _component.proto();
-
var snapshot = takeSnapshot(attrs);
props.attrs = snapshot;
- mergeBindings(props, shadowedAttrs(proto, snapshot));
+ snapshotAndUpdateTarget(attrs, props);
} else {
+ props.attrs = takeSnapshot(attrs);
+
props._isAngleBracket = true;
}
props.renderer = props.parentView ? props.parentView.renderer : env.container.lookup('renderer:-dom');
props._viewRegistry = props.parentView ? props.parentView._viewRegistry : env.container.lookup('-view-registry:main');
@@ -9562,70 +9581,49 @@
renderNode.emberView = component;
renderNode.buildChildEnv = buildChildEnv;
return component;
}
- function shadowedAttrs(target, attrs) {
- var shadowed = {};
-
- // For backwards compatibility, set the component property
- // if it has an attr with that name. Undefined attributes
- // are handled on demand via the `unknownProperty` hook.
- for (var attr in attrs) {
- if (attr in target) {
- // TODO: Should we issue a deprecation here?
- //Ember.deprecate(deprecation(attr));
- shadowed[attr] = attrs[attr];
- }
- }
-
- return shadowed;
- }
-
function takeSnapshot(attrs) {
var hash = {};
for (var prop in attrs) {
hash[prop] = _emberHtmlbarsHooksGetCellOrValue.default(attrs[prop]);
}
return hash;
}
- function mergeBindings(target, attrs) {
- for (var prop in attrs) {
- if (!attrs.hasOwnProperty(prop)) {
- continue;
- }
+ function snapshotAndUpdateTarget(rawAttrs, target) {
+ var attrs = {};
+
+ for (var prop in rawAttrs) {
+ var value = _emberHtmlbarsHooksGetCellOrValue.default(rawAttrs[prop]);
+ attrs[prop] = value;
+
// when `attrs` is an actual value being set in the
// attrs hash (`{{foo-bar attrs="blah"}}`) we cannot
// set `"blah"` to the root of the target because
// that would replace all attrs with `attrs.attrs`
if (prop === 'attrs') {
continue;
}
- var value = attrs[prop];
if (value && value[_emberViewsCompatAttrsProxy.MUTABLE_CELL]) {
- target[prop] = value.value;
- } else {
- target[prop] = value;
+ value = value.value;
}
+
+ target[prop] = value;
}
- return target;
+ return target.attrs = attrs;
}
function buildChildEnv(state, env) {
return env.childWithView(this.emberView);
}
});
-
-// In theory this should come through the env, but it should
-// be safe to import this until we make the hook system public
-// and it gets actively used in addons or other downstream
-// libraries.
enifed('ember-htmlbars/node-managers/view-node-manager', ['exports', 'ember-metal/merge', 'ember-metal/core', 'ember-views/system/build-component-template', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/set_properties', 'ember-views/views/view', 'ember-views/compat/attrs-proxy', 'ember-htmlbars/hooks/get-cell-or-value', 'ember-htmlbars/system/instrumentation-support', 'ember-htmlbars/hooks/get-value'], function (exports, _emberMetalMerge, _emberMetalCore, _emberViewsSystemBuildComponentTemplate, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalSet_properties, _emberViewsViewsView, _emberViewsCompatAttrsProxy, _emberHtmlbarsHooksGetCellOrValue, _emberHtmlbarsSystemInstrumentationSupport, _emberHtmlbarsHooksGetValue) {
'use strict';
exports.createOrUpdateComponent = createOrUpdateComponent;
@@ -9703,20 +9701,20 @@
env.renderer.willRender(component);
env.renderedViews.push(component.elementId);
}
if (this.block) {
- this.block(newEnv, [], undefined, this.renderNode, this.scope, visitor);
+ this.block.invoke(newEnv, [], undefined, this.renderNode, this.scope, visitor);
}
if (component) {
var element = this.expectElement && this.renderNode.firstNode;
// In environments like FastBoot, disable any hooks that would cause the component
// to access the DOM directly.
if (env.destinedForDOM) {
- env.renderer.didCreateElement(component, element); // 2.0TODO: Remove legacy hooks.
+ env.renderer.didCreateElement(component, element);
env.renderer.willInsertElement(component, element);
env.lifecycleHooks.push({ type: 'didInsertElement', view: component });
}
}
}, this);
@@ -9735,20 +9733,19 @@
// Notify component that it has become dirty and is about to change.
env.renderer.willUpdate(component, snapshot);
if (component._renderNode.shouldReceiveAttrs) {
env.renderer.componentUpdateAttrs(component, snapshot);
- _emberMetalSet_properties.default(component, mergeBindings({}, shadowedAttrs(component, snapshot)));
component._renderNode.shouldReceiveAttrs = false;
}
env.renderer.willRender(component);
env.renderedViews.push(component.elementId);
}
if (this.block) {
- this.block(newEnv, [], undefined, this.renderNode, this.scope, visitor);
+ this.block.invoke(newEnv, [], undefined, this.renderNode, this.scope, visitor);
}
return newEnv;
}, this);
};
@@ -9798,11 +9795,10 @@
}
component = component.create(props);
} else {
env.renderer.componentUpdateAttrs(component, snapshot);
- mergeBindings(props, shadowedAttrs(component, snapshot));
_emberMetalSet_properties.default(component, props);
}
if (options.parentView) {
options.parentView.appendChild(component);
@@ -10114,36 +10110,10 @@
});
});
exports.default = bootstrap;
});
-enifed('ember-htmlbars/system/discover-known-helpers', ['exports', 'ember-metal/dictionary'], function (exports, _emberMetalDictionary) {
- 'use strict';
-
- exports.default = discoverKnownHelpers;
-
- function discoverKnownHelpers(container) {
- var registry = container && container.registry;
- var helpers = _emberMetalDictionary.default(null);
-
- if (!registry) {
- return helpers;
- }
-
- var known = registry.knownForType('helper');
- var knownContainerKeys = Object.keys(known);
-
- for (var index = 0, _length = knownContainerKeys.length; index < _length; index++) {
- var fullName = knownContainerKeys[index];
- var _name = fullName.slice(7); // remove `helper:` from fullName
-
- helpers[_name] = true;
- }
-
- return helpers;
- }
-});
enifed('ember-htmlbars/system/dom-helper', ['exports', 'dom-helper', 'ember-htmlbars/morphs/morph', 'ember-htmlbars/morphs/attr-morph'], function (exports, _domHelper, _emberHtmlbarsMorphsMorph, _emberHtmlbarsMorphsAttrMorph) {
'use strict';
function EmberDOMHelper(_document) {
_domHelper.default.call(this, _document);
@@ -10230,18 +10200,12 @@
return key.indexOf('-') !== -1;
});
exports.CONTAINS_DASH_CACHE = CONTAINS_DASH_CACHE;
- function validateLazyHelperName(helperName, container, keywords, knownHelpers) {
- if (!container || helperName in keywords) {
- return false;
- }
-
- if (knownHelpers[helperName] || CONTAINS_DASH_CACHE.get(helperName)) {
- return true;
- }
+ function validateLazyHelperName(helperName, container, keywords) {
+ return container && !(helperName in keywords);
}
/**
Used to lookup/resolve handlebars helpers. The lookup order is:
@@ -10260,11 +10224,11 @@
function findHelper(name, view, env) {
var helper = env.helpers[name];
if (!helper) {
var container = env.container;
- if (validateLazyHelperName(name, container, env.hooks.keywords, env.knownHelpers)) {
+ if (validateLazyHelperName(name, container, env.hooks.keywords)) {
var helperName = 'helper:' + name;
if (container.registry.has(helperName)) {
helper = container.lookupFactory(helperName);
}
}
@@ -10335,11 +10299,11 @@
function makeBoundHelper(fn) {
return _emberHtmlbarsHelper.helper(fn);
}
});
-enifed('ember-htmlbars/system/render-env', ['exports', 'ember-htmlbars/env', 'ember-htmlbars/system/discover-known-helpers'], function (exports, _emberHtmlbarsEnv, _emberHtmlbarsSystemDiscoverKnownHelpers) {
+enifed('ember-htmlbars/system/render-env', ['exports', 'ember-htmlbars/env'], function (exports, _emberHtmlbarsEnv) {
'use strict';
exports.default = RenderEnv;
function RenderEnv(options) {
@@ -10351,11 +10315,10 @@
this.view = options.view;
this.outletState = options.outletState;
this.container = options.container;
this.renderer = options.renderer;
this.dom = options.dom;
- this.knownHelpers = options.knownHelpers || _emberHtmlbarsSystemDiscoverKnownHelpers.default(options.container);
this.hooks = _emberHtmlbarsEnv.default.hooks;
this.helpers = _emberHtmlbarsEnv.default.helpers;
this.useFragmentCache = _emberHtmlbarsEnv.default.useFragmentCache;
this.destinedForDOM = this.renderer._destinedForDOM;
@@ -10379,12 +10342,11 @@
renderer: this.renderer,
dom: this.dom,
lifecycleHooks: this.lifecycleHooks,
renderedViews: this.renderedViews,
renderedNodes: this.renderedNodes,
- hasParentOutlet: this.hasParentOutlet,
- knownHelpers: this.knownHelpers
+ hasParentOutlet: this.hasParentOutlet
});
};
RenderEnv.prototype.childWithOutletState = function (outletState) {
var hasParentOutlet = arguments.length <= 1 || arguments[1] === undefined ? this.hasParentOutlet : arguments[1];
@@ -10396,12 +10358,11 @@
renderer: this.renderer,
dom: this.dom,
lifecycleHooks: this.lifecycleHooks,
renderedViews: this.renderedViews,
renderedNodes: this.renderedNodes,
- hasParentOutlet: hasParentOutlet,
- knownHelpers: this.knownHelpers
+ hasParentOutlet: hasParentOutlet
});
};
});
enifed('ember-htmlbars/system/render-view', ['exports', 'ember-htmlbars/node-managers/view-node-manager', 'ember-htmlbars/system/render-env'], function (exports, _emberHtmlbarsNodeManagersViewNodeManager, _emberHtmlbarsSystemRenderEnv) {
'use strict';
@@ -10884,60 +10845,10 @@
enifed("ember-htmlbars/templates/link-to", ["exports", "ember-template-compiler/system/template"], function (exports, _emberTemplateCompilerSystemTemplate) {
"use strict";
exports.default = _emberTemplateCompilerSystemTemplate.default((function () {
var child0 = (function () {
- var child0 = (function () {
- return {
- meta: {},
- isEmpty: false,
- arity: 0,
- cachedFragment: null,
- hasRendered: false,
- buildFragment: function buildFragment(dom) {
- var el0 = dom.createDocumentFragment();
- var el1 = dom.createComment("");
- dom.appendChild(el0, el1);
- return el0;
- },
- buildRenderNodes: function buildRenderNodes(dom, fragment, contextualElement) {
- var morphs = new Array(1);
- morphs[0] = dom.createMorphAt(fragment, 0, 0, contextualElement);
- dom.insertBoundary(fragment, 0);
- dom.insertBoundary(fragment, null);
- return morphs;
- },
- statements: [["content", "linkTitle", ["loc", [null, [1, 38], [1, 51]]]]],
- locals: [],
- templates: []
- };
- })();
- var child1 = (function () {
- return {
- meta: {},
- isEmpty: false,
- arity: 0,
- cachedFragment: null,
- hasRendered: false,
- buildFragment: function buildFragment(dom) {
- var el0 = dom.createDocumentFragment();
- var el1 = dom.createComment("");
- dom.appendChild(el0, el1);
- return el0;
- },
- buildRenderNodes: function buildRenderNodes(dom, fragment, contextualElement) {
- var morphs = new Array(1);
- morphs[0] = dom.createUnsafeMorphAt(fragment, 0, 0, contextualElement);
- dom.insertBoundary(fragment, 0);
- dom.insertBoundary(fragment, null);
- return morphs;
- },
- statements: [["content", "linkTitle", ["loc", [null, [1, 59], [1, 74]]]]],
- locals: [],
- templates: []
- };
- })();
return {
meta: {},
isEmpty: false,
arity: 0,
cachedFragment: null,
@@ -10953,13 +10864,13 @@
morphs[0] = dom.createMorphAt(fragment, 0, 0, contextualElement);
dom.insertBoundary(fragment, 0);
dom.insertBoundary(fragment, null);
return morphs;
},
- statements: [["block", "if", [["get", "attrs.escaped", ["loc", [null, [1, 23], [1, 36]]]]], [], 0, 1, ["loc", [null, [1, 17], [1, 81]]]]],
+ statements: [["content", "linkTitle", ["loc", [null, [1, 17], [1, 30]]]]],
locals: [],
- templates: [child0, child1]
+ templates: []
};
})();
var child1 = (function () {
return {
meta: {},
@@ -10978,11 +10889,11 @@
morphs[0] = dom.createMorphAt(fragment, 0, 0, contextualElement);
dom.insertBoundary(fragment, 0);
dom.insertBoundary(fragment, null);
return morphs;
},
- statements: [["content", "yield", ["loc", [null, [1, 89], [1, 98]]]]],
+ statements: [["content", "yield", ["loc", [null, [1, 38], [1, 47]]]]],
locals: [],
templates: []
};
})();
return {
@@ -11002,11 +10913,11 @@
morphs[0] = dom.createMorphAt(fragment, 0, 0, contextualElement);
dom.insertBoundary(fragment, 0);
dom.insertBoundary(fragment, null);
return morphs;
},
- statements: [["block", "if", [["get", "linkTitle", ["loc", [null, [1, 6], [1, 15]]]]], [], 0, 1, ["loc", [null, [1, 0], [1, 105]]]]],
+ statements: [["block", "if", [["get", "linkTitle", ["loc", [null, [1, 6], [1, 15]]]]], [], 0, 1, ["loc", [null, [1, 0], [1, 54]]]]],
locals: [],
templates: [child0, child1]
};
})());
});
@@ -11613,10 +11524,12 @@
Renderer.prototype.setAttrs = function (view, attrs) {
_emberMetalProperty_set.set(view, 'attrs', attrs);
}; // set attrs the first time
Renderer.prototype.componentInitAttrs = function (component, attrs) {
+ // for attrs-proxy support
+ component.trigger('_internalDidReceiveAttrs');
component.trigger('didInitAttrs', { attrs: attrs });
component.trigger('didReceiveAttrs', { newAttrs: attrs });
}; // set attrs the first time
Renderer.prototype.didInsertElement = function (view) {
@@ -11653,10 +11566,12 @@
_emberMetalSet_properties.default(component.attrs, newAttrs);
} else {
_emberMetalProperty_set.set(component, 'attrs', newAttrs);
}
+ // for attrs-proxy support
+ component.trigger('_internalDidReceiveAttrs');
component.trigger('didUpdateAttrs', { oldAttrs: oldAttrs, newAttrs: newAttrs });
component.trigger('didReceiveAttrs', { oldAttrs: oldAttrs, newAttrs: newAttrs });
};
Renderer.prototype.willUpdate = function (view, attrs) {
@@ -13029,612 +12944,10 @@
exports.removeChainWatcher = removeChainWatcher;
exports.ChainNode = ChainNode;
});
// warn, assert, etc;
-enifed('ember-metal/computed', ['exports', 'ember-metal/core', 'ember-metal/property_set', 'ember-metal/utils', 'ember-metal/meta', 'ember-metal/expand_properties', 'ember-metal/error', 'ember-metal/properties', 'ember-metal/property_events', 'ember-metal/dependent_keys'], function (exports, _emberMetalCore, _emberMetalProperty_set, _emberMetalUtils, _emberMetalMeta, _emberMetalExpand_properties, _emberMetalError, _emberMetalProperties, _emberMetalProperty_events, _emberMetalDependent_keys) {
- 'use strict';
-
- exports.default = computed;
-
- /**
- @module ember
- @submodule ember-metal
- */
-
- var metaFor = _emberMetalMeta.meta;
-
- function UNDEFINED() {}
-
- // ..........................................................
- // COMPUTED PROPERTY
- //
-
- /**
- A computed property transforms an object's function into a property.
-
- By default the function backing the computed property will only be called
- once and the result will be cached. You can specify various properties
- that your computed property depends on. This will force the cached
- result to be recomputed if the dependencies are modified.
-
- In the following example we declare a computed property (by calling
- `.property()` on the fullName function) and setup the property
- dependencies (depending on firstName and lastName). The fullName function
- will be called once (regardless of how many times it is accessed) as long
- as its dependencies have not changed. Once firstName or lastName are updated
- any future calls (or anything bound) to fullName will incorporate the new
- values.
-
- ```javascript
- var Person = Ember.Object.extend({
- // these will be supplied by `create`
- firstName: null,
- lastName: null,
-
- fullName: function() {
- var firstName = this.get('firstName');
- var lastName = this.get('lastName');
-
- return firstName + ' ' + lastName;
- }.property('firstName', 'lastName')
- });
-
- var tom = Person.create({
- firstName: 'Tom',
- lastName: 'Dale'
- });
-
- tom.get('fullName') // 'Tom Dale'
- ```
-
- You can also define what Ember should do when setting a computed property.
- If you try to set a computed property, it will be invoked with the key and
- value you want to set it to. You can also accept the previous value as the
- third parameter.
-
- ```javascript
- var Person = Ember.Object.extend({
- // these will be supplied by `create`
- firstName: null,
- lastName: null,
-
- fullName: function(key, value, oldValue) {
- // getter
- if (arguments.length === 1) {
- var firstName = this.get('firstName');
- var lastName = this.get('lastName');
-
- return firstName + ' ' + lastName;
-
- // setter
- } else {
- var name = value.split(' ');
-
- this.set('firstName', name[0]);
- this.set('lastName', name[1]);
-
- return value;
- }
- }.property('firstName', 'lastName')
- });
-
- var person = Person.create();
-
- person.set('fullName', 'Peter Wagenet');
- person.get('firstName'); // 'Peter'
- person.get('lastName'); // 'Wagenet'
- ```
-
- @class ComputedProperty
- @namespace Ember
- @constructor
- @public
- */
- function ComputedProperty(config, opts) {
- this.isDescriptor = true;
- if (typeof config === 'function') {
- this._getter = config;
- } else {
- this._getter = config.get;
- this._setter = config.set;
- }
- this._dependentKeys = undefined;
- this._suspended = undefined;
- this._meta = undefined;
- this._volatile = false;
- this._dependentKeys = opts && opts.dependentKeys;
- this._readOnly = false;
- }
-
- ComputedProperty.prototype = new _emberMetalProperties.Descriptor();
-
- var ComputedPropertyPrototype = ComputedProperty.prototype;
-
- /**
- Call on a computed property to set it into non-cached mode. When in this
- mode the computed property will not automatically cache the return value.
-
- It also does not automatically fire any change events. You must manually notify
- any changes if you want to observe this property.
-
- Dependency keys have no effect on volatile properties as they are for cache
- invalidation and notification when cached value is invalidated.
-
- ```javascript
- var outsideService = Ember.Object.extend({
- value: function() {
- return OutsideService.getValue();
- }.property().volatile()
- }).create();
- ```
-
- @method volatile
- @return {Ember.ComputedProperty} this
- @chainable
- @public
- */
- ComputedPropertyPrototype.volatile = function () {
- this._volatile = true;
- return this;
- };
-
- /**
- Call on a computed property to set it into read-only mode. When in this
- mode the computed property will throw an error when set.
-
- ```javascript
- var Person = Ember.Object.extend({
- guid: function() {
- return 'guid-guid-guid';
- }.property().readOnly()
- });
-
- var person = Person.create();
-
- person.set('guid', 'new-guid'); // will throw an exception
- ```
-
- @method readOnly
- @return {Ember.ComputedProperty} this
- @chainable
- @public
- */
- ComputedPropertyPrototype.readOnly = function () {
- this._readOnly = true;
- return this;
- };
-
- /**
- Sets the dependent keys on this computed property. Pass any number of
- arguments containing key paths that this computed property depends on.
-
- ```javascript
- var President = Ember.Object.extend({
- fullName: computed(function() {
- return this.get('firstName') + ' ' + this.get('lastName');
-
- // Tell Ember that this computed property depends on firstName
- // and lastName
- }).property('firstName', 'lastName')
- });
-
- var president = President.create({
- firstName: 'Barack',
- lastName: 'Obama'
- });
-
- president.get('fullName'); // 'Barack Obama'
- ```
-
- @method property
- @param {String} path* zero or more property paths
- @return {Ember.ComputedProperty} this
- @chainable
- @public
- */
- ComputedPropertyPrototype.property = function () {
- var args;
-
- var addArg = function (property) {
- args.push(property);
- };
-
- args = [];
- for (var i = 0, l = arguments.length; i < l; i++) {
- _emberMetalExpand_properties.default(arguments[i], addArg);
- }
-
- this._dependentKeys = args;
- return this;
- };
-
- /**
- In some cases, you may want to annotate computed properties with additional
- metadata about how they function or what values they operate on. For example,
- computed property functions may close over variables that are then no longer
- available for introspection.
-
- You can pass a hash of these values to a computed property like this:
-
- ```
- person: function() {
- var personId = this.get('personId');
- return App.Person.create({ id: personId });
- }.property().meta({ type: App.Person })
- ```
-
- The hash that you pass to the `meta()` function will be saved on the
- computed property descriptor under the `_meta` key. Ember runtime
- exposes a public API for retrieving these values from classes,
- via the `metaForProperty()` function.
-
- @method meta
- @param {Object} meta
- @chainable
- @public
- */
-
- ComputedPropertyPrototype.meta = function (meta) {
- if (arguments.length === 0) {
- return this._meta || {};
- } else {
- this._meta = meta;
- return this;
- }
- };
-
- // invalidate cache when CP key changes
- ComputedPropertyPrototype.didChange = function (obj, keyName) {
- // _suspended is set via a CP.set to ensure we don't clear
- // the cached value set by the setter
- if (this._volatile || this._suspended === obj) {
- return;
- }
-
- // don't create objects just to invalidate
- var meta = obj.__ember_meta__;
- if (!meta || meta.source !== obj) {
- return;
- }
-
- var cache = meta.readableCache();
- if (cache && cache[keyName] !== undefined) {
- cache[keyName] = undefined;
- _emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, meta);
- }
- };
-
- /**
- Access the value of the function backing the computed property.
- If this property has already been cached, return the cached result.
- Otherwise, call the function passing the property name as an argument.
-
- ```javascript
- var Person = Ember.Object.extend({
- fullName: function(keyName) {
- // the keyName parameter is 'fullName' in this case.
- return this.get('firstName') + ' ' + this.get('lastName');
- }.property('firstName', 'lastName')
- });
-
-
- var tom = Person.create({
- firstName: 'Tom',
- lastName: 'Dale'
- });
-
- tom.get('fullName') // 'Tom Dale'
- ```
-
- @method get
- @param {String} keyName The key being accessed.
- @return {Object} The return value of the function backing the CP.
- @public
- */
- ComputedPropertyPrototype.get = function (obj, keyName) {
- if (this._volatile) {
- return this._getter.call(obj, keyName);
- }
-
- var meta = metaFor(obj);
- var cache = meta.writableCache();
-
- var result = cache[keyName];
- if (result === UNDEFINED) {
- return undefined;
- } else if (result !== undefined) {
- return result;
- }
-
- var ret = this._getter.call(obj, keyName);
- if (ret === undefined) {
- cache[keyName] = UNDEFINED;
- } else {
- cache[keyName] = ret;
- }
-
- var chainWatchers = meta.readableChainWatchers();
- if (chainWatchers) {
- chainWatchers.revalidate(keyName);
- }
- _emberMetalDependent_keys.addDependentKeys(this, obj, keyName, meta);
-
- return ret;
- };
-
- /**
- Set the value of a computed property. If the function that backs your
- computed property does not accept arguments then the default action for
- setting would be to define the property on the current object, and set
- the value of the property to the value being set.
-
- Generally speaking if you intend for your computed property to be set
- your backing function should accept either two or three arguments.
-
- ```javascript
- var Person = Ember.Object.extend({
- // these will be supplied by `create`
- firstName: null,
- lastName: null,
-
- fullName: function(key, value, oldValue) {
- // getter
- if (arguments.length === 1) {
- var firstName = this.get('firstName');
- var lastName = this.get('lastName');
-
- return firstName + ' ' + lastName;
-
- // setter
- } else {
- var name = value.split(' ');
-
- this.set('firstName', name[0]);
- this.set('lastName', name[1]);
-
- return value;
- }
- }.property('firstName', 'lastName')
- });
-
- var person = Person.create();
-
- person.set('fullName', 'Peter Wagenet');
- person.get('firstName'); // 'Peter'
- person.get('lastName'); // 'Wagenet'
- ```
-
- @method set
- @param {String} keyName The key being accessed.
- @param {Object} newValue The new value being assigned.
- @param {String} oldValue The old value being replaced.
- @return {Object} The return value of the function backing the CP.
- @public
- */
- ComputedPropertyPrototype.set = function computedPropertySetEntry(obj, keyName, value) {
- if (this._readOnly) {
- this._throwReadOnlyError(obj, keyName);
- }
-
- if (!this._setter) {
- return this.clobberSet(obj, keyName, value);
- }
-
- if (this._volatile) {
- return this.volatileSet(obj, keyName, value);
- }
-
- return this.setWithSuspend(obj, keyName, value);
- };
-
- ComputedPropertyPrototype._throwReadOnlyError = function computedPropertyThrowReadOnlyError(obj, keyName) {
- throw new _emberMetalError.default('Cannot set read-only property "' + keyName + '" on object: ' + _emberMetalUtils.inspect(obj));
- };
-
- ComputedPropertyPrototype.clobberSet = function computedPropertyClobberSet(obj, keyName, value) {
- var cachedValue = cacheFor(obj, keyName);
- _emberMetalProperties.defineProperty(obj, keyName, null, cachedValue);
- _emberMetalProperty_set.set(obj, keyName, value);
- return value;
- };
-
- ComputedPropertyPrototype.volatileSet = function computedPropertyVolatileSet(obj, keyName, value) {
- return this._setter.call(obj, keyName, value);
- };
-
- ComputedPropertyPrototype.setWithSuspend = function computedPropertySetWithSuspend(obj, keyName, value) {
- var oldSuspended = this._suspended;
- this._suspended = obj;
- try {
- return this._set(obj, keyName, value);
- } finally {
- this._suspended = oldSuspended;
- }
- };
-
- ComputedPropertyPrototype._set = function computedPropertySet(obj, keyName, value) {
- // cache requires own meta
- var meta = metaFor(obj);
- // either there is a writable cache or we need one to update
- var cache = meta.writableCache();
- var hadCachedValue = false;
- var cachedValue = undefined;
- if (cache[keyName] !== undefined) {
- if (cache[keyName] !== UNDEFINED) {
- cachedValue = cache[keyName];
- }
- hadCachedValue = true;
- }
-
- var ret = this._setter.call(obj, keyName, value, cachedValue);
-
- // allows setter to return the same value that is cached already
- if (hadCachedValue && cachedValue === ret) {
- return ret;
- }
-
- var watched = meta.peekWatching(keyName);
- if (watched) {
- _emberMetalProperty_events.propertyWillChange(obj, keyName);
- }
-
- if (hadCachedValue) {
- cache[keyName] = undefined;
- }
-
- if (!hadCachedValue) {
- _emberMetalDependent_keys.addDependentKeys(this, obj, keyName, meta);
- }
-
- if (ret === undefined) {
- cache[keyName] = UNDEFINED;
- } else {
- cache[keyName] = ret;
- }
-
- if (watched) {
- _emberMetalProperty_events.propertyDidChange(obj, keyName);
- }
-
- return ret;
- };
-
- /* called before property is overridden */
- ComputedPropertyPrototype.teardown = function (obj, keyName) {
- if (this._volatile) {
- return;
- }
- var meta = metaFor(obj);
- var cache = meta.readableCache();
- if (cache && cache[keyName] !== undefined) {
- _emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, meta);
- cache[keyName] = undefined;
- }
- };
-
- /**
- This helper returns a new property descriptor that wraps the passed
- computed property function. You can use this helper to define properties
- with mixins or via `Ember.defineProperty()`.
-
- The function you pass will be used to both get and set property values.
- The function should accept two parameters, key and value. If value is not
- undefined you should set the value first. In either case return the
- current value of the property.
-
- A computed property defined in this way might look like this:
-
- ```js
- var Person = Ember.Object.extend({
- firstName: 'Betty',
- lastName: 'Jones',
-
- fullName: Ember.computed('firstName', 'lastName', function(key, value) {
- return this.get('firstName') + ' ' + this.get('lastName');
- })
- });
-
- var client = Person.create();
-
- client.get('fullName'); // 'Betty Jones'
-
- client.set('lastName', 'Fuller');
- client.get('fullName'); // 'Betty Fuller'
- ```
-
- _Note: This is the preferred way to define computed properties when writing third-party
- libraries that depend on or use Ember, since there is no guarantee that the user
- will have prototype extensions enabled._
-
- You might use this method if you disabled
- [Prototype Extensions](http://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/).
- The alternative syntax might look like this
- (if prototype extensions are enabled, which is the default behavior):
-
- ```js
- fullName: function () {
- return this.get('firstName') + ' ' + this.get('lastName');
- }.property('firstName', 'lastName')
- ```
-
- @class computed
- @namespace Ember
- @constructor
- @static
- @param {String} [dependentKeys*] Optional dependent keys that trigger this computed property.
- @param {Function} func The computed property function.
- @return {Ember.ComputedProperty} property descriptor instance
- @public
- */
-
- function computed(func) {
- var args;
-
- if (arguments.length > 1) {
- args = [].slice.call(arguments);
- func = args.pop();
- }
-
- var cp = new ComputedProperty(func);
-
- if (args) {
- cp.property.apply(cp, args);
- }
-
- return cp;
- }
-
- /**
- Returns the cached value for a property, if one exists.
- This can be useful for peeking at the value of a computed
- property that is generated lazily, without accidentally causing
- it to be created.
-
- @method cacheFor
- @for Ember
- @param {Object} obj the object whose property you want to check
- @param {String} key the name of the property whose cached value you want
- to return
- @return {Object} the cached value
- @public
- */
- function cacheFor(obj, key) {
- var meta = obj.__ember_meta__;
- var cache = meta && meta.source === obj && meta.readableCache();
- var ret = cache && cache[key];
-
- if (ret === UNDEFINED) {
- return undefined;
- }
- return ret;
- }
-
- cacheFor.set = function (cache, key, value) {
- if (value === undefined) {
- cache[key] = UNDEFINED;
- } else {
- cache[key] = value;
- }
- };
-
- cacheFor.get = function (cache, key) {
- var ret = cache[key];
- if (ret === UNDEFINED) {
- return undefined;
- }
- return ret;
- };
-
- cacheFor.remove = function (cache, key) {
- cache[key] = undefined;
- };
-
- exports.ComputedProperty = ComputedProperty;
- exports.computed = computed;
- exports.cacheFor = cacheFor;
-});
enifed('ember-metal/computed_macros', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/computed', 'ember-metal/is_empty', 'ember-metal/is_none', 'ember-metal/alias'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalComputed, _emberMetalIs_empty, _emberMetalIs_none, _emberMetalAlias) {
'use strict';
exports.empty = empty;
exports.notEmpty = notEmpty;
@@ -14323,10 +13636,612 @@
return value;
}
});
}
});
+enifed('ember-metal/computed', ['exports', 'ember-metal/core', 'ember-metal/property_set', 'ember-metal/utils', 'ember-metal/meta', 'ember-metal/expand_properties', 'ember-metal/error', 'ember-metal/properties', 'ember-metal/property_events', 'ember-metal/dependent_keys'], function (exports, _emberMetalCore, _emberMetalProperty_set, _emberMetalUtils, _emberMetalMeta, _emberMetalExpand_properties, _emberMetalError, _emberMetalProperties, _emberMetalProperty_events, _emberMetalDependent_keys) {
+ 'use strict';
+
+ exports.default = computed;
+
+ /**
+ @module ember
+ @submodule ember-metal
+ */
+
+ var metaFor = _emberMetalMeta.meta;
+
+ function UNDEFINED() {}
+
+ // ..........................................................
+ // COMPUTED PROPERTY
+ //
+
+ /**
+ A computed property transforms an object's function into a property.
+
+ By default the function backing the computed property will only be called
+ once and the result will be cached. You can specify various properties
+ that your computed property depends on. This will force the cached
+ result to be recomputed if the dependencies are modified.
+
+ In the following example we declare a computed property (by calling
+ `.property()` on the fullName function) and setup the property
+ dependencies (depending on firstName and lastName). The fullName function
+ will be called once (regardless of how many times it is accessed) as long
+ as its dependencies have not changed. Once firstName or lastName are updated
+ any future calls (or anything bound) to fullName will incorporate the new
+ values.
+
+ ```javascript
+ var Person = Ember.Object.extend({
+ // these will be supplied by `create`
+ firstName: null,
+ lastName: null,
+
+ fullName: function() {
+ var firstName = this.get('firstName');
+ var lastName = this.get('lastName');
+
+ return firstName + ' ' + lastName;
+ }.property('firstName', 'lastName')
+ });
+
+ var tom = Person.create({
+ firstName: 'Tom',
+ lastName: 'Dale'
+ });
+
+ tom.get('fullName') // 'Tom Dale'
+ ```
+
+ You can also define what Ember should do when setting a computed property.
+ If you try to set a computed property, it will be invoked with the key and
+ value you want to set it to. You can also accept the previous value as the
+ third parameter.
+
+ ```javascript
+ var Person = Ember.Object.extend({
+ // these will be supplied by `create`
+ firstName: null,
+ lastName: null,
+
+ fullName: function(key, value, oldValue) {
+ // getter
+ if (arguments.length === 1) {
+ var firstName = this.get('firstName');
+ var lastName = this.get('lastName');
+
+ return firstName + ' ' + lastName;
+
+ // setter
+ } else {
+ var name = value.split(' ');
+
+ this.set('firstName', name[0]);
+ this.set('lastName', name[1]);
+
+ return value;
+ }
+ }.property('firstName', 'lastName')
+ });
+
+ var person = Person.create();
+
+ person.set('fullName', 'Peter Wagenet');
+ person.get('firstName'); // 'Peter'
+ person.get('lastName'); // 'Wagenet'
+ ```
+
+ @class ComputedProperty
+ @namespace Ember
+ @constructor
+ @public
+ */
+ function ComputedProperty(config, opts) {
+ this.isDescriptor = true;
+ if (typeof config === 'function') {
+ this._getter = config;
+ } else {
+ this._getter = config.get;
+ this._setter = config.set;
+ }
+ this._dependentKeys = undefined;
+ this._suspended = undefined;
+ this._meta = undefined;
+ this._volatile = false;
+ this._dependentKeys = opts && opts.dependentKeys;
+ this._readOnly = false;
+ }
+
+ ComputedProperty.prototype = new _emberMetalProperties.Descriptor();
+
+ var ComputedPropertyPrototype = ComputedProperty.prototype;
+
+ /**
+ Call on a computed property to set it into non-cached mode. When in this
+ mode the computed property will not automatically cache the return value.
+
+ It also does not automatically fire any change events. You must manually notify
+ any changes if you want to observe this property.
+
+ Dependency keys have no effect on volatile properties as they are for cache
+ invalidation and notification when cached value is invalidated.
+
+ ```javascript
+ var outsideService = Ember.Object.extend({
+ value: function() {
+ return OutsideService.getValue();
+ }.property().volatile()
+ }).create();
+ ```
+
+ @method volatile
+ @return {Ember.ComputedProperty} this
+ @chainable
+ @public
+ */
+ ComputedPropertyPrototype.volatile = function () {
+ this._volatile = true;
+ return this;
+ };
+
+ /**
+ Call on a computed property to set it into read-only mode. When in this
+ mode the computed property will throw an error when set.
+
+ ```javascript
+ var Person = Ember.Object.extend({
+ guid: function() {
+ return 'guid-guid-guid';
+ }.property().readOnly()
+ });
+
+ var person = Person.create();
+
+ person.set('guid', 'new-guid'); // will throw an exception
+ ```
+
+ @method readOnly
+ @return {Ember.ComputedProperty} this
+ @chainable
+ @public
+ */
+ ComputedPropertyPrototype.readOnly = function () {
+ this._readOnly = true;
+ return this;
+ };
+
+ /**
+ Sets the dependent keys on this computed property. Pass any number of
+ arguments containing key paths that this computed property depends on.
+
+ ```javascript
+ var President = Ember.Object.extend({
+ fullName: computed(function() {
+ return this.get('firstName') + ' ' + this.get('lastName');
+
+ // Tell Ember that this computed property depends on firstName
+ // and lastName
+ }).property('firstName', 'lastName')
+ });
+
+ var president = President.create({
+ firstName: 'Barack',
+ lastName: 'Obama'
+ });
+
+ president.get('fullName'); // 'Barack Obama'
+ ```
+
+ @method property
+ @param {String} path* zero or more property paths
+ @return {Ember.ComputedProperty} this
+ @chainable
+ @public
+ */
+ ComputedPropertyPrototype.property = function () {
+ var args;
+
+ var addArg = function (property) {
+ args.push(property);
+ };
+
+ args = [];
+ for (var i = 0, l = arguments.length; i < l; i++) {
+ _emberMetalExpand_properties.default(arguments[i], addArg);
+ }
+
+ this._dependentKeys = args;
+ return this;
+ };
+
+ /**
+ In some cases, you may want to annotate computed properties with additional
+ metadata about how they function or what values they operate on. For example,
+ computed property functions may close over variables that are then no longer
+ available for introspection.
+
+ You can pass a hash of these values to a computed property like this:
+
+ ```
+ person: function() {
+ var personId = this.get('personId');
+ return App.Person.create({ id: personId });
+ }.property().meta({ type: App.Person })
+ ```
+
+ The hash that you pass to the `meta()` function will be saved on the
+ computed property descriptor under the `_meta` key. Ember runtime
+ exposes a public API for retrieving these values from classes,
+ via the `metaForProperty()` function.
+
+ @method meta
+ @param {Object} meta
+ @chainable
+ @public
+ */
+
+ ComputedPropertyPrototype.meta = function (meta) {
+ if (arguments.length === 0) {
+ return this._meta || {};
+ } else {
+ this._meta = meta;
+ return this;
+ }
+ };
+
+ // invalidate cache when CP key changes
+ ComputedPropertyPrototype.didChange = function (obj, keyName) {
+ // _suspended is set via a CP.set to ensure we don't clear
+ // the cached value set by the setter
+ if (this._volatile || this._suspended === obj) {
+ return;
+ }
+
+ // don't create objects just to invalidate
+ var meta = obj.__ember_meta__;
+ if (!meta || meta.source !== obj) {
+ return;
+ }
+
+ var cache = meta.readableCache();
+ if (cache && cache[keyName] !== undefined) {
+ cache[keyName] = undefined;
+ _emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, meta);
+ }
+ };
+
+ /**
+ Access the value of the function backing the computed property.
+ If this property has already been cached, return the cached result.
+ Otherwise, call the function passing the property name as an argument.
+
+ ```javascript
+ var Person = Ember.Object.extend({
+ fullName: function(keyName) {
+ // the keyName parameter is 'fullName' in this case.
+ return this.get('firstName') + ' ' + this.get('lastName');
+ }.property('firstName', 'lastName')
+ });
+
+
+ var tom = Person.create({
+ firstName: 'Tom',
+ lastName: 'Dale'
+ });
+
+ tom.get('fullName') // 'Tom Dale'
+ ```
+
+ @method get
+ @param {String} keyName The key being accessed.
+ @return {Object} The return value of the function backing the CP.
+ @public
+ */
+ ComputedPropertyPrototype.get = function (obj, keyName) {
+ if (this._volatile) {
+ return this._getter.call(obj, keyName);
+ }
+
+ var meta = metaFor(obj);
+ var cache = meta.writableCache();
+
+ var result = cache[keyName];
+ if (result === UNDEFINED) {
+ return undefined;
+ } else if (result !== undefined) {
+ return result;
+ }
+
+ var ret = this._getter.call(obj, keyName);
+ if (ret === undefined) {
+ cache[keyName] = UNDEFINED;
+ } else {
+ cache[keyName] = ret;
+ }
+
+ var chainWatchers = meta.readableChainWatchers();
+ if (chainWatchers) {
+ chainWatchers.revalidate(keyName);
+ }
+ _emberMetalDependent_keys.addDependentKeys(this, obj, keyName, meta);
+
+ return ret;
+ };
+
+ /**
+ Set the value of a computed property. If the function that backs your
+ computed property does not accept arguments then the default action for
+ setting would be to define the property on the current object, and set
+ the value of the property to the value being set.
+
+ Generally speaking if you intend for your computed property to be set
+ your backing function should accept either two or three arguments.
+
+ ```javascript
+ var Person = Ember.Object.extend({
+ // these will be supplied by `create`
+ firstName: null,
+ lastName: null,
+
+ fullName: function(key, value, oldValue) {
+ // getter
+ if (arguments.length === 1) {
+ var firstName = this.get('firstName');
+ var lastName = this.get('lastName');
+
+ return firstName + ' ' + lastName;
+
+ // setter
+ } else {
+ var name = value.split(' ');
+
+ this.set('firstName', name[0]);
+ this.set('lastName', name[1]);
+
+ return value;
+ }
+ }.property('firstName', 'lastName')
+ });
+
+ var person = Person.create();
+
+ person.set('fullName', 'Peter Wagenet');
+ person.get('firstName'); // 'Peter'
+ person.get('lastName'); // 'Wagenet'
+ ```
+
+ @method set
+ @param {String} keyName The key being accessed.
+ @param {Object} newValue The new value being assigned.
+ @param {String} oldValue The old value being replaced.
+ @return {Object} The return value of the function backing the CP.
+ @public
+ */
+ ComputedPropertyPrototype.set = function computedPropertySetEntry(obj, keyName, value) {
+ if (this._readOnly) {
+ this._throwReadOnlyError(obj, keyName);
+ }
+
+ if (!this._setter) {
+ return this.clobberSet(obj, keyName, value);
+ }
+
+ if (this._volatile) {
+ return this.volatileSet(obj, keyName, value);
+ }
+
+ return this.setWithSuspend(obj, keyName, value);
+ };
+
+ ComputedPropertyPrototype._throwReadOnlyError = function computedPropertyThrowReadOnlyError(obj, keyName) {
+ throw new _emberMetalError.default('Cannot set read-only property "' + keyName + '" on object: ' + _emberMetalUtils.inspect(obj));
+ };
+
+ ComputedPropertyPrototype.clobberSet = function computedPropertyClobberSet(obj, keyName, value) {
+ var cachedValue = cacheFor(obj, keyName);
+ _emberMetalProperties.defineProperty(obj, keyName, null, cachedValue);
+ _emberMetalProperty_set.set(obj, keyName, value);
+ return value;
+ };
+
+ ComputedPropertyPrototype.volatileSet = function computedPropertyVolatileSet(obj, keyName, value) {
+ return this._setter.call(obj, keyName, value);
+ };
+
+ ComputedPropertyPrototype.setWithSuspend = function computedPropertySetWithSuspend(obj, keyName, value) {
+ var oldSuspended = this._suspended;
+ this._suspended = obj;
+ try {
+ return this._set(obj, keyName, value);
+ } finally {
+ this._suspended = oldSuspended;
+ }
+ };
+
+ ComputedPropertyPrototype._set = function computedPropertySet(obj, keyName, value) {
+ // cache requires own meta
+ var meta = metaFor(obj);
+ // either there is a writable cache or we need one to update
+ var cache = meta.writableCache();
+ var hadCachedValue = false;
+ var cachedValue = undefined;
+ if (cache[keyName] !== undefined) {
+ if (cache[keyName] !== UNDEFINED) {
+ cachedValue = cache[keyName];
+ }
+ hadCachedValue = true;
+ }
+
+ var ret = this._setter.call(obj, keyName, value, cachedValue);
+
+ // allows setter to return the same value that is cached already
+ if (hadCachedValue && cachedValue === ret) {
+ return ret;
+ }
+
+ var watched = meta.peekWatching(keyName);
+ if (watched) {
+ _emberMetalProperty_events.propertyWillChange(obj, keyName);
+ }
+
+ if (hadCachedValue) {
+ cache[keyName] = undefined;
+ }
+
+ if (!hadCachedValue) {
+ _emberMetalDependent_keys.addDependentKeys(this, obj, keyName, meta);
+ }
+
+ if (ret === undefined) {
+ cache[keyName] = UNDEFINED;
+ } else {
+ cache[keyName] = ret;
+ }
+
+ if (watched) {
+ _emberMetalProperty_events.propertyDidChange(obj, keyName);
+ }
+
+ return ret;
+ };
+
+ /* called before property is overridden */
+ ComputedPropertyPrototype.teardown = function (obj, keyName) {
+ if (this._volatile) {
+ return;
+ }
+ var meta = metaFor(obj);
+ var cache = meta.readableCache();
+ if (cache && cache[keyName] !== undefined) {
+ _emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, meta);
+ cache[keyName] = undefined;
+ }
+ };
+
+ /**
+ This helper returns a new property descriptor that wraps the passed
+ computed property function. You can use this helper to define properties
+ with mixins or via `Ember.defineProperty()`.
+
+ The function you pass will be used to both get and set property values.
+ The function should accept two parameters, key and value. If value is not
+ undefined you should set the value first. In either case return the
+ current value of the property.
+
+ A computed property defined in this way might look like this:
+
+ ```js
+ var Person = Ember.Object.extend({
+ firstName: 'Betty',
+ lastName: 'Jones',
+
+ fullName: Ember.computed('firstName', 'lastName', function(key, value) {
+ return this.get('firstName') + ' ' + this.get('lastName');
+ })
+ });
+
+ var client = Person.create();
+
+ client.get('fullName'); // 'Betty Jones'
+
+ client.set('lastName', 'Fuller');
+ client.get('fullName'); // 'Betty Fuller'
+ ```
+
+ _Note: This is the preferred way to define computed properties when writing third-party
+ libraries that depend on or use Ember, since there is no guarantee that the user
+ will have prototype extensions enabled._
+
+ You might use this method if you disabled
+ [Prototype Extensions](http://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/).
+ The alternative syntax might look like this
+ (if prototype extensions are enabled, which is the default behavior):
+
+ ```js
+ fullName: function () {
+ return this.get('firstName') + ' ' + this.get('lastName');
+ }.property('firstName', 'lastName')
+ ```
+
+ @class computed
+ @namespace Ember
+ @constructor
+ @static
+ @param {String} [dependentKeys*] Optional dependent keys that trigger this computed property.
+ @param {Function} func The computed property function.
+ @return {Ember.ComputedProperty} property descriptor instance
+ @public
+ */
+
+ function computed(func) {
+ var args;
+
+ if (arguments.length > 1) {
+ args = [].slice.call(arguments);
+ func = args.pop();
+ }
+
+ var cp = new ComputedProperty(func);
+
+ if (args) {
+ cp.property.apply(cp, args);
+ }
+
+ return cp;
+ }
+
+ /**
+ Returns the cached value for a property, if one exists.
+ This can be useful for peeking at the value of a computed
+ property that is generated lazily, without accidentally causing
+ it to be created.
+
+ @method cacheFor
+ @for Ember
+ @param {Object} obj the object whose property you want to check
+ @param {String} key the name of the property whose cached value you want
+ to return
+ @return {Object} the cached value
+ @public
+ */
+ function cacheFor(obj, key) {
+ var meta = obj.__ember_meta__;
+ var cache = meta && meta.source === obj && meta.readableCache();
+ var ret = cache && cache[key];
+
+ if (ret === UNDEFINED) {
+ return undefined;
+ }
+ return ret;
+ }
+
+ cacheFor.set = function (cache, key, value) {
+ if (value === undefined) {
+ cache[key] = UNDEFINED;
+ } else {
+ cache[key] = value;
+ }
+ };
+
+ cacheFor.get = function (cache, key) {
+ var ret = cache[key];
+ if (ret === UNDEFINED) {
+ return undefined;
+ }
+ return ret;
+ };
+
+ cacheFor.remove = function (cache, key) {
+ cache[key] = undefined;
+ };
+
+ exports.ComputedProperty = ComputedProperty;
+ exports.computed = computed;
+ exports.cacheFor = cacheFor;
+});
enifed('ember-metal/core', ['exports', 'ember-metal/assert'], function (exports, _emberMetalAssert) {
/*globals Ember:true,ENV,EmberENV */
/**
@module ember
@@ -14346,11 +14261,11 @@
cross-platform libraries such as jQuery. For more details, see
[Ember-Runtime](http://emberjs.com/api/modules/ember-runtime.html).
@class Ember
@static
- @version 2.1.0-beta.1
+ @version 2.1.0-beta.3
@public
*/
'use strict';
@@ -14380,15 +14295,15 @@
/**
The semantic version.
@property VERSION
@type String
- @default '2.1.0-beta.1'
+ @default '2.1.0-beta.3'
@static
@public
*/
- Ember.VERSION = '2.1.0-beta.1';
+ Ember.VERSION = '2.1.0-beta.3';
/**
The hash of environment variables used to control various configuration
settings. To specify your own or override default settings, add the
desired properties to a global hash named `EmberENV` (or `ENV` for
@@ -16484,10 +16399,183 @@
}
return original;
}
});
+enifed('ember-metal/meta_listeners', ['exports'], function (exports) {
+ /*
+ When we render a rich template hierarchy, the set of events that
+ *might* happen tends to be much larger than the set of events that
+ actually happen. This implies that we should make listener creation &
+ destruction cheap, even at the cost of making event dispatch more
+ expensive.
+
+ Thus we store a new listener with a single push and no new
+ allocations, without even bothering to do deduplication -- we can
+ save that for dispatch time, if an event actually happens.
+ */
+
+ /* listener flags */
+ 'use strict';
+
+ var ONCE = 1;
+ exports.ONCE = ONCE;
+ var SUSPENDED = 2;
+
+ exports.SUSPENDED = SUSPENDED;
+ var protoMethods = {
+
+ addToListeners: function (eventName, target, method, flags) {
+ if (!this._listeners) {
+ this._listeners = [];
+ }
+ this._listeners.push(eventName, target, method, flags);
+ },
+
+ _finalizeListeners: function () {
+ if (this._listenersFinalized) {
+ return;
+ }
+ if (!this._listeners) {
+ this._listeners = [];
+ }
+ var pointer = this.parent;
+ while (pointer) {
+ var listeners = pointer._listeners;
+ if (listeners) {
+ this._listeners = this._listeners.concat(listeners);
+ }
+ if (pointer._listenersFinalized) {
+ break;
+ }
+ pointer = pointer.parent;
+ }
+ this._listenersFinalized = true;
+ },
+
+ removeFromListeners: function (eventName, target, method, didRemove) {
+ var pointer = this;
+ while (pointer) {
+ var listeners = pointer._listeners;
+ if (listeners) {
+ for (var index = listeners.length - 4; index >= 0; index -= 4) {
+ if (listeners[index] === eventName && (!method || listeners[index + 1] === target && listeners[index + 2] === method)) {
+ if (pointer === this) {
+ // we are modifying our own list, so we edit directly
+ if (typeof didRemove === 'function') {
+ didRemove(eventName, target, listeners[index + 2]);
+ }
+ listeners.splice(index, 4);
+ } else {
+ // we are trying to remove an inherited listener, so we do
+ // just-in-time copying to detach our own listeners from
+ // our inheritance chain.
+ this._finalizeListeners();
+ return this.removeFromListeners(eventName, target, method);
+ }
+ }
+ }
+ }
+ if (pointer._listenersFinalized) {
+ break;
+ }
+ pointer = pointer.parent;
+ }
+ },
+
+ matchingListeners: function (eventName) {
+ var pointer = this;
+ var result = [];
+ while (pointer) {
+ var listeners = pointer._listeners;
+ if (listeners) {
+ for (var index = 0; index < listeners.length - 3; index += 4) {
+ if (listeners[index] === eventName) {
+ pushUniqueListener(result, listeners, index);
+ }
+ }
+ }
+ if (pointer._listenersFinalized) {
+ break;
+ }
+ pointer = pointer.parent;
+ }
+ var sus = this._suspendedListeners;
+ if (sus) {
+ for (var susIndex = 0; susIndex < sus.length - 2; susIndex += 3) {
+ if (eventName === sus[susIndex]) {
+ for (var resultIndex = 0; resultIndex < result.length - 2; resultIndex += 3) {
+ if (result[resultIndex] === sus[susIndex + 1] && result[resultIndex + 1] === sus[susIndex + 2]) {
+ result[resultIndex + 2] |= SUSPENDED;
+ }
+ }
+ }
+ }
+ }
+ return result;
+ },
+
+ suspendListeners: function (eventNames, target, method, callback) {
+ var sus = this._suspendedListeners;
+ if (!sus) {
+ sus = this._suspendedListeners = [];
+ }
+ for (var i = 0; i < eventNames.length; i++) {
+ sus.push(eventNames[i], target, method);
+ }
+ try {
+ return callback.call(target);
+ } finally {
+ if (sus.length === eventNames.length) {
+ this._suspendedListeners = undefined;
+ } else {
+ for (var i = sus.length - 3; i >= 0; i -= 3) {
+ if (sus[i + 1] === target && sus[i + 2] === method && eventNames.indexOf(sus[i]) !== -1) {
+ sus.splice(i, 3);
+ }
+ }
+ }
+ }
+ },
+
+ watchedEvents: function () {
+ var pointer = this;
+ var names = {};
+ while (pointer) {
+ var listeners = pointer._listeners;
+ if (listeners) {
+ for (var index = 0; index < listeners.length - 3; index += 4) {
+ names[listeners[index]] = true;
+ }
+ }
+ if (pointer._listenersFinalized) {
+ break;
+ }
+ pointer = pointer.parent;
+ }
+ return Object.keys(names);
+ },
+
+ _initializeListeners: function () {
+ this._listeners = undefined;
+ this._listenersFinalized = undefined;
+ this._suspendedListeners = undefined;
+ }
+ };
+
+ exports.protoMethods = protoMethods;
+ function pushUniqueListener(destination, source, index) {
+ var target = source[index + 1];
+ var method = source[index + 2];
+ for (var destinationIndex = 0; destinationIndex < destination.length - 2; destinationIndex += 3) {
+ if (destination[destinationIndex] === target && destination[destinationIndex + 1] === method) {
+ return;
+ }
+ }
+ destination.push(target, method, source[index + 3]);
+ }
+});
enifed('ember-metal/meta', ['exports', 'ember-metal/features', 'ember-metal/meta_listeners', 'ember-metal/empty_object'], function (exports, _emberMetalFeatures, _emberMetalMeta_listeners, _emberMetalEmpty_object) {
// Remove "use strict"; from transpiled module until
// https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
//
@@ -16729,10 +16817,12 @@
// Placeholder for non-writable metas.
var EMPTY_META = new Meta(null);
exports.EMPTY_META = EMPTY_META;
+ EMPTY_META.writableValues();
+
/**
Retrieves the meta hash for an object. If `writable` is true ensures the
hash is writable for this object as well.
The meta object contains information about computed property descriptors as
@@ -16760,10 +16850,12 @@
return ret;
}
if (!ret) {
ret = new Meta(obj);
+
+ ret.writableValues();
} else {
ret = new Meta(obj, ret);
}
if (obj.__defineNonEnumerable) {
@@ -16774,183 +16866,10 @@
obj.__ember_meta__ = ret;
return ret;
}
});
-enifed('ember-metal/meta_listeners', ['exports'], function (exports) {
- /*
- When we render a rich template hierarchy, the set of events that
- *might* happen tends to be much larger than the set of events that
- actually happen. This implies that we should make listener creation &
- destruction cheap, even at the cost of making event dispatch more
- expensive.
-
- Thus we store a new listener with a single push and no new
- allocations, without even bothering to do deduplication -- we can
- save that for dispatch time, if an event actually happens.
- */
-
- /* listener flags */
- 'use strict';
-
- var ONCE = 1;
- exports.ONCE = ONCE;
- var SUSPENDED = 2;
-
- exports.SUSPENDED = SUSPENDED;
- var protoMethods = {
-
- addToListeners: function (eventName, target, method, flags) {
- if (!this._listeners) {
- this._listeners = [];
- }
- this._listeners.push(eventName, target, method, flags);
- },
-
- _finalizeListeners: function () {
- if (this._listenersFinalized) {
- return;
- }
- if (!this._listeners) {
- this._listeners = [];
- }
- var pointer = this.parent;
- while (pointer) {
- var listeners = pointer._listeners;
- if (listeners) {
- this._listeners = this._listeners.concat(listeners);
- }
- if (pointer._listenersFinalized) {
- break;
- }
- pointer = pointer.parent;
- }
- this._listenersFinalized = true;
- },
-
- removeFromListeners: function (eventName, target, method, didRemove) {
- var pointer = this;
- while (pointer) {
- var listeners = pointer._listeners;
- if (listeners) {
- for (var index = listeners.length - 4; index >= 0; index -= 4) {
- if (listeners[index] === eventName && (!method || listeners[index + 1] === target && listeners[index + 2] === method)) {
- if (pointer === this) {
- // we are modifying our own list, so we edit directly
- if (typeof didRemove === 'function') {
- didRemove(eventName, target, listeners[index + 2]);
- }
- listeners.splice(index, 4);
- } else {
- // we are trying to remove an inherited listener, so we do
- // just-in-time copying to detach our own listeners from
- // our inheritance chain.
- this._finalizeListeners();
- return this.removeFromListeners(eventName, target, method);
- }
- }
- }
- }
- if (pointer._listenersFinalized) {
- break;
- }
- pointer = pointer.parent;
- }
- },
-
- matchingListeners: function (eventName) {
- var pointer = this;
- var result = [];
- while (pointer) {
- var listeners = pointer._listeners;
- if (listeners) {
- for (var index = 0; index < listeners.length - 3; index += 4) {
- if (listeners[index] === eventName) {
- pushUniqueListener(result, listeners, index);
- }
- }
- }
- if (pointer._listenersFinalized) {
- break;
- }
- pointer = pointer.parent;
- }
- var sus = this._suspendedListeners;
- if (sus) {
- for (var susIndex = 0; susIndex < sus.length - 2; susIndex += 3) {
- if (eventName === sus[susIndex]) {
- for (var resultIndex = 0; resultIndex < result.length - 2; resultIndex += 3) {
- if (result[resultIndex] === sus[susIndex + 1] && result[resultIndex + 1] === sus[susIndex + 2]) {
- result[resultIndex + 2] |= SUSPENDED;
- }
- }
- }
- }
- }
- return result;
- },
-
- suspendListeners: function (eventNames, target, method, callback) {
- var sus = this._suspendedListeners;
- if (!sus) {
- sus = this._suspendedListeners = [];
- }
- for (var i = 0; i < eventNames.length; i++) {
- sus.push(eventNames[i], target, method);
- }
- try {
- return callback.call(target);
- } finally {
- if (sus.length === eventNames.length) {
- this._suspendedListeners = undefined;
- } else {
- for (var i = sus.length - 3; i >= 0; i -= 3) {
- if (sus[i + 1] === target && sus[i + 2] === method && eventNames.indexOf(sus[i]) !== -1) {
- sus.splice(i, 3);
- }
- }
- }
- }
- },
-
- watchedEvents: function () {
- var pointer = this;
- var names = {};
- while (pointer) {
- var listeners = pointer._listeners;
- if (listeners) {
- for (var index = 0; index < listeners.length - 3; index += 4) {
- names[listeners[index]] = true;
- }
- }
- if (pointer._listenersFinalized) {
- break;
- }
- pointer = pointer.parent;
- }
- return Object.keys(names);
- },
-
- _initializeListeners: function () {
- this._listeners = undefined;
- this._listenersFinalized = undefined;
- this._suspendedListeners = undefined;
- }
- };
-
- exports.protoMethods = protoMethods;
- function pushUniqueListener(destination, source, index) {
- var target = source[index + 1];
- var method = source[index + 2];
- for (var destinationIndex = 0; destinationIndex < destination.length - 2; destinationIndex += 3) {
- if (destination[destinationIndex] === target && destination[destinationIndex + 1] === method) {
- return;
- }
- }
- destination.push(target, method, source[index + 3]);
- }
-});
enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/merge', 'ember-metal/empty_object', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/utils', 'ember-metal/meta', 'ember-metal/expand_properties', 'ember-metal/properties', 'ember-metal/computed', 'ember-metal/binding', 'ember-metal/observer', 'ember-metal/events', 'ember-metal/streams/utils'], function (exports, _emberMetalCore, _emberMetalMerge, _emberMetalEmpty_object, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalUtils, _emberMetalMeta, _emberMetalExpand_properties, _emberMetalProperties, _emberMetalComputed, _emberMetalBinding, _emberMetalObserver, _emberMetalEvents, _emberMetalStreamsUtils) {
// Remove "use strict"; from transpiled module until
// https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
//
@@ -16966,10 +16885,13 @@
/**
@module ember
@submodule ember-metal
*/
+ function ROOT() {}
+ ROOT.__hasSuper = false;
+
var REQUIRED;
var a_slice = [].slice;
function mixinsMeta(obj) {
return _emberMetalMeta.meta(obj, true).writableMixins();
@@ -17110,11 +17032,11 @@
newBase[prop] = propValue;
}
}
if (hasFunction) {
- newBase._super = function () {};
+ newBase._super = ROOT;
}
return newBase;
}
@@ -17306,11 +17228,11 @@
var values = {};
var m = _emberMetalMeta.meta(obj);
var keys = [];
var key, value, desc;
- obj._super = function () {};
+ obj._super = ROOT;
// Go through all mixins and hashes passed in, and:
//
// * Handle concatenated properties
// * Handle merged properties
@@ -17682,11 +17604,11 @@
```
@method aliasMethod
@for Ember
@param {String} methodName name of the method to alias
- @private
+ @public
*/
function aliasMethod(methodName) {
return new Alias(methodName);
}
@@ -17867,10 +17789,79 @@
exports.Mixin = Mixin;
exports.required = required;
exports.REQUIRED = REQUIRED;
});
// warn, assert, wrap, et;
+enifed('ember-metal/observer_set', ['exports', 'ember-metal/utils', 'ember-metal/events'], function (exports, _emberMetalUtils, _emberMetalEvents) {
+ 'use strict';
+
+ /*
+ this.observerSet = {
+ [senderGuid]: { // variable name: `keySet`
+ [keyName]: listIndex
+ }
+ },
+ this.observers = [
+ {
+ sender: obj,
+ keyName: keyName,
+ eventName: eventName,
+ listeners: [
+ [target, method, flags]
+ ]
+ },
+ ...
+ ]
+ */
+ exports.default = ObserverSet;
+
+ function ObserverSet() {
+ this.clear();
+ }
+
+ ObserverSet.prototype.add = function (sender, keyName, eventName) {
+ var observerSet = this.observerSet;
+ var observers = this.observers;
+ var senderGuid = _emberMetalUtils.guidFor(sender);
+ var keySet = observerSet[senderGuid];
+ var index;
+
+ if (!keySet) {
+ observerSet[senderGuid] = keySet = {};
+ }
+ index = keySet[keyName];
+ if (index === undefined) {
+ index = observers.push({
+ sender: sender,
+ keyName: keyName,
+ eventName: eventName,
+ listeners: []
+ }) - 1;
+ keySet[keyName] = index;
+ }
+ return observers[index].listeners;
+ };
+
+ ObserverSet.prototype.flush = function () {
+ var observers = this.observers;
+ var i, len, observer, sender;
+ this.clear();
+ for (i = 0, len = observers.length; i < len; ++i) {
+ observer = observers[i];
+ sender = observer.sender;
+ if (sender.isDestroying || sender.isDestroyed) {
+ continue;
+ }
+ _emberMetalEvents.sendEvent(sender, observer.eventName, [sender, observer.keyName], observer.listeners);
+ }
+ };
+
+ ObserverSet.prototype.clear = function () {
+ this.observerSet = {};
+ this.observers = [];
+ };
+});
enifed('ember-metal/observer', ['exports', 'ember-metal/watching', 'ember-metal/events'], function (exports, _emberMetalWatching, _emberMetalEvents) {
'use strict';
exports.addObserver = addObserver;
exports.observersFor = observersFor;
@@ -17981,79 +17972,10 @@
_emberMetalEvents.removeListener(obj, beforeEvent(path), target, method);
return this;
}
});
-enifed('ember-metal/observer_set', ['exports', 'ember-metal/utils', 'ember-metal/events'], function (exports, _emberMetalUtils, _emberMetalEvents) {
- 'use strict';
-
- /*
- this.observerSet = {
- [senderGuid]: { // variable name: `keySet`
- [keyName]: listIndex
- }
- },
- this.observers = [
- {
- sender: obj,
- keyName: keyName,
- eventName: eventName,
- listeners: [
- [target, method, flags]
- ]
- },
- ...
- ]
- */
- exports.default = ObserverSet;
-
- function ObserverSet() {
- this.clear();
- }
-
- ObserverSet.prototype.add = function (sender, keyName, eventName) {
- var observerSet = this.observerSet;
- var observers = this.observers;
- var senderGuid = _emberMetalUtils.guidFor(sender);
- var keySet = observerSet[senderGuid];
- var index;
-
- if (!keySet) {
- observerSet[senderGuid] = keySet = {};
- }
- index = keySet[keyName];
- if (index === undefined) {
- index = observers.push({
- sender: sender,
- keyName: keyName,
- eventName: eventName,
- listeners: []
- }) - 1;
- keySet[keyName] = index;
- }
- return observers[index].listeners;
- };
-
- ObserverSet.prototype.flush = function () {
- var observers = this.observers;
- var i, len, observer, sender;
- this.clear();
- for (i = 0, len = observers.length; i < len; ++i) {
- observer = observers[i];
- sender = observer.sender;
- if (sender.isDestroying || sender.isDestroyed) {
- continue;
- }
- _emberMetalEvents.sendEvent(sender, observer.eventName, [sender, observer.keyName], observer.listeners);
- }
- };
-
- ObserverSet.prototype.clear = function () {
- this.observerSet = {};
- this.observers = [];
- };
-});
enifed('ember-metal/path_cache', ['exports', 'ember-metal/cache'], function (exports, _emberMetalCache) {
'use strict';
exports.isGlobal = isGlobal;
exports.isGlobalPath = isGlobalPath;
@@ -18240,20 +18162,39 @@
}
if (desc instanceof Descriptor) {
value = desc;
- obj[keyName] = value;
+ if (watching) {
+ Object.defineProperty(obj, keyName, {
+ configurable: true,
+ enumerable: true,
+ writable: true,
+ value: value
+ });
+ } else {
+ obj[keyName] = value;
+ }
if (desc.setup) {
desc.setup(obj, keyName);
}
} else {
if (desc == null) {
value = data;
- obj[keyName] = data;
+ if (watching) {
+ meta.writableValues()[keyName] = data;
+ Object.defineProperty(obj, keyName, {
+ configurable: true,
+ enumerable: true,
+ set: MANDATORY_SETTER_FUNCTION(keyName),
+ get: DEFAULT_GETTER_FUNCTION(keyName)
+ });
+ } else {
+ obj[keyName] = data;
+ }
} else {
value = desc;
// fallback to ES5
Object.defineProperty(obj, keyName, desc);
@@ -18639,11 +18580,15 @@
}
if (desc) {
return desc.get(obj, keyName);
} else {
- ret = obj[keyName];
+ if (meta && meta.peekWatching(keyName) > 0) {
+ ret = meta.peekValues(keyName);
+ } else {
+ ret = obj[keyName];
+ }
if (ret === undefined && 'object' === typeof obj && !(keyName in obj) && 'function' === typeof obj.unknownProperty) {
return obj.unknownProperty(keyName);
}
@@ -18785,17 +18730,21 @@
// `setUnknownProperty` method exists on the object
if (isUnknown && 'function' === typeof obj.setUnknownProperty) {
obj.setUnknownProperty(keyName, value);
} else if (meta && meta.peekWatching(keyName) > 0) {
if (meta.proto !== obj) {
- currentValue = obj[keyName];
+ currentValue = meta.peekValues(keyName);
}
// only trigger a change if the value has changed
if (value !== currentValue) {
_emberMetalProperty_events.propertyWillChange(obj, keyName);
- obj[keyName] = value;
+ if (currentValue === undefined && !(keyName in obj) || !Object.prototype.propertyIsEnumerable.call(obj, keyName)) {
+ _emberMetalProperties.defineProperty(obj, keyName, null, value); // setup mandatory setter
+ } else {
+ meta.writableValues()[keyName] = value;
+ }
_emberMetalProperty_events.propertyDidChange(obj, keyName);
}
} else {
obj[keyName] = value;
@@ -18854,11 +18803,10 @@
function trySet(root, path, value) {
return set(root, path, value, true);
}
});
-// setup mandatory setter
enifed("ember-metal/replace", ["exports"], function (exports) {
"use strict";
exports._replace = _replace;
exports.default = replace;
@@ -19638,65 +19586,10 @@
}
});
return properties;
}
});
-enifed('ember-metal/streams/conditional', ['exports', 'ember-metal/streams/stream', 'ember-metal/streams/utils'], function (exports, _emberMetalStreamsStream, _emberMetalStreamsUtils) {
- 'use strict';
-
- exports.default = conditional;
-
- function conditional(test, consequent, alternate) {
- if (_emberMetalStreamsUtils.isStream(test)) {
- return new ConditionalStream(test, consequent, alternate);
- } else {
- if (test) {
- return consequent;
- } else {
- return alternate;
- }
- }
- }
-
- function ConditionalStream(test, consequent, alternate) {
- this.init();
-
- this.oldTestResult = undefined;
- this.test = test;
- this.consequent = consequent;
- this.alternate = alternate;
- }
-
- ConditionalStream.prototype = Object.create(_emberMetalStreamsStream.default.prototype);
-
- ConditionalStream.prototype.compute = function () {
- var oldTestResult = this.oldTestResult;
- var newTestResult = !!_emberMetalStreamsUtils.read(this.test);
-
- if (newTestResult !== oldTestResult) {
- switch (oldTestResult) {
- case true:
- _emberMetalStreamsUtils.unsubscribe(this.consequent, this.notify, this);break;
- case false:
- _emberMetalStreamsUtils.unsubscribe(this.alternate, this.notify, this);break;
- case undefined:
- _emberMetalStreamsUtils.subscribe(this.test, this.notify, this);
- }
-
- switch (newTestResult) {
- case true:
- _emberMetalStreamsUtils.subscribe(this.consequent, this.notify, this);break;
- case false:
- _emberMetalStreamsUtils.subscribe(this.alternate, this.notify, this);
- }
-
- this.oldTestResult = newTestResult;
- }
-
- return newTestResult ? _emberMetalStreamsUtils.read(this.consequent) : _emberMetalStreamsUtils.read(this.alternate);
- };
-});
enifed('ember-metal/streams/dependency', ['exports', 'ember-metal/core', 'ember-metal/merge', 'ember-metal/streams/utils'], function (exports, _emberMetalCore, _emberMetalMerge, _emberMetalStreamsUtils) {
'use strict';
/**
@module ember-metal
@@ -20446,11 +20339,11 @@
var labels = labelsFor(array);
return 'concat([' + labels.join(', ') + ']; separator=' + inspect(separator) + ')';
});
for (i = 0, l = array.length; i < l; i++) {
- subscribe(array[i], stream.notify, stream);
+ stream.addDependency(array[i]);
}
// used by angle bracket components to detect an attribute was provided
// as a string literal
stream.isConcat = true;
@@ -20878,14 +20771,36 @@
}
return ret;
}
}
- var sourceAvailable = (function () {
- return this;
- }).toString().indexOf('return this;') > -1;
+ var checkHasSuper = (function () {
+ var sourceAvailable = (function () {
+ return this;
+ }).toString().indexOf('return this;') > -1;
+ if (sourceAvailable) {
+ return function checkHasSuper(func) {
+ return func.toString().indexOf('_super') > -1;
+ };
+ }
+
+ return function checkHasSuper() {
+ return true;
+ };
+ })();
+
+ function ROOT() {}
+ ROOT.__hasSuper = false;
+
+ function hasSuper(func) {
+ if (func.__hasSuper === undefined) {
+ func.__hasSuper = checkHasSuper(func);
+ }
+ return func.__hasSuper;
+ }
+
/**
Wraps the passed function so that `this._super` will point to the superFunc
when the function is invoked. This is the primitive we use to implement
calls to super.
@@ -20895,40 +20810,28 @@
@param {Function} func The function to call
@param {Function} superFunc The super function.
@return {Function} wrapped function.
*/
- function wrap(func, _superFunc) {
- var superFunc = _superFunc;
- var hasSuper;
- if (sourceAvailable) {
- hasSuper = func.__hasSuper;
-
- if (hasSuper === undefined) {
- hasSuper = func.toString().indexOf('_super') > -1;
- func.__hasSuper = hasSuper;
- }
-
- if (!hasSuper) {
- return func;
- }
+ function wrap(func, superFunc) {
+ if (!hasSuper(func)) {
+ return func;
}
-
- if (superFunc.wrappedFunction === undefined) {
- // terminate _super to prevent infinite recursion
- superFunc = wrap(superFunc, function () {});
+ // ensure an unwrapped super that calls _super is wrapped with a terminal _super
+ if (!superFunc.wrappedFunction && hasSuper(superFunc)) {
+ return _wrap(func, _wrap(superFunc, ROOT));
}
-
return _wrap(func, superFunc);
}
function _wrap(func, superFunc) {
function superWrapper() {
- var ret;
var orig = this._super;
+ var length = arguments.length;
+ var ret = undefined;
this._super = superFunc;
- switch (arguments.length) {
+ switch (length) {
case 0:
ret = func.call(this);break;
case 1:
ret = func.call(this, arguments[0]);break;
case 2:
@@ -20938,11 +20841,18 @@
case 4:
ret = func.call(this, arguments[0], arguments[1], arguments[2], arguments[3]);break;
case 5:
ret = func.call(this, arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);break;
default:
- ret = func.apply(this, arguments);break;
+ // v8 bug potentially incorrectly deopts this function: https://code.google.com/p/v8/issues/detail?id=3709
+ // we may want to keep this around till this ages out on mobile
+ var args = new Array(length);
+ for (var x = 0; x < length; x++) {
+ args[x] = arguments[x];
+ }
+ ret = func.apply(this, args);
+ break;
}
this._super = orig;
return ret;
}
@@ -21186,15 +21096,41 @@
}
if ('function' === typeof obj.willWatchProperty) {
obj.willWatchProperty(keyName);
}
+
+ handleMandatorySetter(m, obj, keyName);
} else {
watching[keyName] = (watching[keyName] || 0) + 1;
}
}
+ var handleMandatorySetter = function handleMandatorySetter(m, obj, keyName) {
+ var descriptor = Object.getOwnPropertyDescriptor && Object.getOwnPropertyDescriptor(obj, keyName);
+ var configurable = descriptor ? descriptor.configurable : true;
+ var isWritable = descriptor ? descriptor.writable : true;
+ var hasValue = descriptor ? 'value' in descriptor : true;
+ var possibleDesc = descriptor && descriptor.value;
+ var isDescriptor = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor;
+
+ if (isDescriptor) {
+ return;
+ }
+
+ // this x in Y deopts, so keeping it in this function is better;
+ if (configurable && isWritable && hasValue && keyName in obj) {
+ m.writableValues()[keyName] = obj[keyName];
+ Object.defineProperty(obj, keyName, {
+ configurable: true,
+ enumerable: Object.prototype.propertyIsEnumerable.call(obj, keyName),
+ set: _emberMetalProperties.MANDATORY_SETTER_FUNCTION(keyName),
+ get: _emberMetalProperties.DEFAULT_GETTER_FUNCTION(keyName)
+ });
+ }
+ };
+
// This is super annoying, but required until
// https://github.com/babel/babel/issues/906 is resolved
; // jshint ignore:line
function unwatchKey(obj, keyName, meta) {
@@ -21211,19 +21147,33 @@
}
if ('function' === typeof obj.didUnwatchProperty) {
obj.didUnwatchProperty(keyName);
}
+
+ if (!desc && keyName in obj) {
+ Object.defineProperty(obj, keyName, {
+ configurable: true,
+ enumerable: Object.prototype.propertyIsEnumerable.call(obj, keyName),
+ set: function (val) {
+ // redefine to set as enumerable
+ Object.defineProperty(obj, keyName, {
+ configurable: true,
+ writable: true,
+ enumerable: true,
+ value: val
+ });
+ delete m.writableValues()[keyName];
+ },
+ get: _emberMetalProperties.DEFAULT_GETTER_FUNCTION(keyName)
+ });
+ }
} else if (watching[keyName] > 1) {
watching[keyName]--;
}
}
});
-
-// this x in Y deopts, so keeping it in this function is better;
-
-// redefine to set as enumerable
enifed('ember-metal/watch_path', ['exports', 'ember-metal/meta', 'ember-metal/chains'], function (exports, _emberMetalMeta, _emberMetalChains) {
'use strict';
exports.watchPath = watchPath;
exports.unwatchPath = unwatchPath;
@@ -21373,11 +21323,11 @@
}
}
}
}
});
-enifed('ember-routing-htmlbars', ['exports', 'ember-metal/core', 'ember-htmlbars/helpers', 'ember-htmlbars/keywords', 'ember-routing-htmlbars/helpers/query-params', 'ember-routing-htmlbars/keywords/action', 'ember-routing-htmlbars/keywords/element-action', 'ember-routing-htmlbars/keywords/link-to', 'ember-routing-htmlbars/keywords/render'], function (exports, _emberMetalCore, _emberHtmlbarsHelpers, _emberHtmlbarsKeywords, _emberRoutingHtmlbarsHelpersQueryParams, _emberRoutingHtmlbarsKeywordsAction, _emberRoutingHtmlbarsKeywordsElementAction, _emberRoutingHtmlbarsKeywordsLinkTo, _emberRoutingHtmlbarsKeywordsRender) {
+enifed('ember-routing-htmlbars', ['exports', 'ember-metal/core', 'ember-htmlbars/helpers', 'ember-htmlbars/keywords', 'ember-routing-htmlbars/helpers/query-params', 'ember-routing-htmlbars/keywords/action', 'ember-routing-htmlbars/keywords/element-action', 'ember-routing-htmlbars/keywords/render'], function (exports, _emberMetalCore, _emberHtmlbarsHelpers, _emberHtmlbarsKeywords, _emberRoutingHtmlbarsHelpersQueryParams, _emberRoutingHtmlbarsKeywordsAction, _emberRoutingHtmlbarsKeywordsElementAction, _emberRoutingHtmlbarsKeywordsRender) {
/**
@module ember
@submodule ember-routing-htmlbars
*/
@@ -21385,11 +21335,10 @@
_emberHtmlbarsHelpers.registerHelper('query-params', _emberRoutingHtmlbarsHelpersQueryParams.queryParamsHelper);
_emberHtmlbarsKeywords.registerKeyword('action', _emberRoutingHtmlbarsKeywordsAction.default);
_emberHtmlbarsKeywords.registerKeyword('@element_action', _emberRoutingHtmlbarsKeywordsElementAction.default);
- _emberHtmlbarsKeywords.registerKeyword('link-to', _emberRoutingHtmlbarsKeywordsLinkTo.default);
_emberHtmlbarsKeywords.registerKeyword('render', _emberRoutingHtmlbarsKeywordsRender.default);
exports.default = _emberMetalCore.default;
});
enifed('ember-routing-htmlbars/helpers/query-params', ['exports', 'ember-metal/core', 'ember-routing/system/query_params'], function (exports, _emberMetalCore, _emberRoutingSystemQuery_params) {
@@ -21700,11 +21649,13 @@
// on-change={{action setName}}
// element-space actions look to "controller" then target. Here we only
// look to "target".
target = _emberMetalStreamsUtils.read(scope.self);
action = _emberMetalStreamsUtils.read(rawAction);
- if (typeof action === 'string') {
+ var actionType = typeof action;
+
+ if (actionType === 'string') {
var actionName = action;
action = null;
// on-change={{action 'setName'}}
if (hash.target) {
// on-change={{action 'setName' target=alternativeComponent}}
@@ -21715,10 +21666,12 @@
}
if (!action) {
throw new _emberMetalError.default('An action named \'' + actionName + '\' was not found in ' + target + '.');
}
+ } else if (actionType !== 'function') {
+ throw new _emberMetalError.default('An action could not be made for `' + rawAction.label + '` in ' + target + '. Please confirm that you are using either a quoted action name (i.e. `(action \'' + rawAction.label + '\')`) or a function available in ' + target + '.');
}
}
if (hash.value) {
// <button on-keypress={{action (mut name) value="which"}}
@@ -21911,20 +21864,311 @@
return true;
}
});
// assert
-enifed('ember-routing-htmlbars/keywords/link-to', ['exports', 'ember-metal/streams/utils', 'ember-metal/core', 'ember-metal/merge'], function (exports, _emberMetalStreamsUtils, _emberMetalCore, _emberMetalMerge) {
+enifed('ember-routing-htmlbars/keywords/render', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/empty_object', 'ember-metal/error', 'ember-metal/streams/utils', 'ember-runtime/system/string', 'ember-routing/system/generate_controller', 'ember-htmlbars/node-managers/view-node-manager'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalEmpty_object, _emberMetalError, _emberMetalStreamsUtils, _emberRuntimeSystemString, _emberRoutingSystemGenerate_controller, _emberHtmlbarsNodeManagersViewNodeManager) {
/**
@module ember
- @submodule ember-routing-htmlbars
+ @submodule ember-templates
*/
'use strict';
/**
- The `{{link-to}}` helper renders a link to the supplied
+ Calling ``{{render}}`` from within a template will insert another
+ template that matches the provided name. The inserted template will
+ access its properties on its own controller (rather than the controller
+ of the parent template).
+ If a view class with the same name exists, the view class also will be used.
+ Note: A given controller may only be used *once* in your app in this manner.
+ A singleton instance of the controller will be created for you.
+ Example:
+
+ ```javascript
+ App.NavigationController = Ember.Controller.extend({
+ who: "world"
+ });
+ ```
+
+ ```handlebars
+ <!-- navigation.hbs -->
+ Hello, {{who}}.
+ ```
+
+ ```handlebars
+ <!-- application.hbs -->
+ <h1>My great app</h1>
+ {{render "navigation"}}
+ ```
+
+ ```html
+ <h1>My great app</h1>
+ <div class='ember-view'>
+ Hello, world.
+ </div>
+ ```
+
+ Optionally you may provide a second argument: a property path
+ that will be bound to the `model` property of the controller.
+ If a `model` property path is specified, then a new instance of the
+ controller will be created and `{{render}}` can be used multiple times
+ with the same name.
+
+ For example if you had this `author` template.
+
+ ```handlebars
+ <div class="author">
+ Written by {{firstName}} {{lastName}}.
+ Total Posts: {{postCount}}
+ </div>
+ ```
+
+ You could render it inside the `post` template using the `render` helper.
+
+ ```handlebars
+ <div class="post">
+ <h1>{{title}}</h1>
+ <div>{{body}}</div>
+ {{render "author" author}}
+ </div>
+ ```
+
+ @method render
+ @for Ember.Templates.helpers
+ @param {String} name
+ @param {Object?} context
+ @param {Hash} options
+ @return {String} HTML string
+ @public
+ */
+ exports.default = {
+ willRender: function (renderNode, env) {
+ if (env.view.ownerView._outlets) {
+ // We make sure we will get dirtied when outlet state changes.
+ env.view.ownerView._outlets.push(renderNode);
+ }
+ },
+
+ setupState: function (prevState, env, scope, params, hash) {
+ var name = params[0];
+
+
+ return {
+ parentView: env.view,
+ manager: prevState.manager,
+ controller: prevState.controller,
+ childOutletState: childOutletState(name, env)
+ };
+ },
+
+ childEnv: function (state, env) {
+ return env.childWithOutletState(state.childOutletState);
+ },
+
+ isStable: function (lastState, nextState) {
+ return isStable(lastState.childOutletState, nextState.childOutletState);
+ },
+
+ isEmpty: function (state) {
+ return false;
+ },
+
+ render: function (node, env, scope, params, hash, template, inverse, visitor) {
+ var state = node.state;
+ var name = params[0];
+ var context = params[1];
+
+ var container = env.container;
+
+ // The render keyword presumes it can work without a router. This is really
+ // only to satisfy the test:
+ //
+ // {{view}} should not override class bindings defined on a child view"
+ //
+ var router = container.lookup('router:main');
+
+
+ if (params.length === 1) {
+ // use the singleton controller
+ } else if (params.length !== 2) {
+ throw new _emberMetalError.default('You must pass a templateName to render');
+ }
+
+ var templateName = 'template:' + name;
+
+ var view = container.lookup('view:' + name);
+ if (!view) {
+ view = container.lookup('view:default');
+ }
+ var viewHasTemplateSpecified = view && !!_emberMetalProperty_get.get(view, 'template');
+ if (!template && !viewHasTemplateSpecified) {
+ template = container.lookup(templateName);
+ }
+
+ if (view) {
+ view.ownerView = env.view.ownerView;
+ }
+
+ // provide controller override
+ var controllerName;
+ var controllerFullName;
+
+ if (hash.controller) {
+ controllerName = hash.controller;
+ controllerFullName = 'controller:' + controllerName;
+ delete hash.controller;
+
+ } else {
+ controllerName = name;
+ controllerFullName = 'controller:' + controllerName;
+ }
+
+ var parentController = _emberMetalStreamsUtils.read(scope.locals.controller);
+ var controller;
+
+ // choose name
+ if (params.length > 1) {
+ var factory = container.lookupFactory(controllerFullName) || _emberRoutingSystemGenerate_controller.generateControllerFactory(container, controllerName);
+
+ controller = factory.create({
+ model: _emberMetalStreamsUtils.read(context),
+ parentController: parentController,
+ target: parentController
+ });
+
+ node.addDestruction(controller);
+ } else {
+ controller = container.lookup(controllerFullName) || _emberRoutingSystemGenerate_controller.default(container, controllerName);
+
+ controller.setProperties({
+ target: parentController,
+ parentController: parentController
+ });
+ }
+
+ if (view) {
+ view.set('controller', controller);
+ }
+ state.controller = controller;
+
+ hash.viewName = _emberRuntimeSystemString.camelize(name);
+
+ // var state = node.state;
+ // var parentView = scope.view;
+ if (template && template.raw) {
+ template = template.raw;
+ }
+
+ var options = {
+ layout: null,
+ self: controller
+ };
+
+ if (view) {
+ options.component = view;
+ }
+
+ var nodeManager = _emberHtmlbarsNodeManagersViewNodeManager.default.create(node, env, hash, options, state.parentView, null, null, template);
+ state.manager = nodeManager;
+
+ if (router && params.length === 1) {
+ router._connectActiveComponentNode(name, nodeManager);
+ }
+
+ nodeManager.render(env, hash, visitor);
+ },
+
+ rerender: function (node, env, scope, params, hash, template, inverse, visitor) {
+ var model = _emberMetalStreamsUtils.read(params[1]);
+ node.state.controller.set('model', model);
+ }
+ };
+
+ function childOutletState(name, env) {
+ var topLevel = env.view.ownerView;
+ if (!topLevel || !topLevel.outletState) {
+ return;
+ }
+
+ var outletState = topLevel.outletState;
+ if (!outletState.main) {
+ return;
+ }
+
+ var selectedOutletState = outletState.main.outlets['__ember_orphans__'];
+ if (!selectedOutletState) {
+ return;
+ }
+ var matched = selectedOutletState.outlets[name];
+ if (matched) {
+ var childState = new _emberMetalEmpty_object.default();
+ childState[matched.render.outlet] = matched;
+ matched.wasUsed = true;
+ return childState;
+ }
+ }
+
+ function isStable(a, b) {
+ if (!a && !b) {
+ return true;
+ }
+ if (!a || !b) {
+ return false;
+ }
+ for (var outletName in a) {
+ if (!isStableOutlet(a[outletName], b[outletName])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ function isStableOutlet(a, b) {
+ if (!a && !b) {
+ return true;
+ }
+ if (!a || !b) {
+ return false;
+ }
+ a = a.render;
+ b = b.render;
+ for (var key in a) {
+ if (a.hasOwnProperty(key)) {
+ // name is only here for logging & debugging. If two different
+ // names result in otherwise identical states, they're still
+ // identical.
+ if (a[key] !== b[key] && key !== 'name') {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+});
+// assert
+enifed('ember-routing-views', ['exports', 'ember-metal/core', 'ember-routing-views/components/link-to', 'ember-routing-views/views/outlet'], function (exports, _emberMetalCore, _emberRoutingViewsComponentsLinkTo, _emberRoutingViewsViewsOutlet) {
+ /**
+ @module ember
+ @submodule ember-routing-views
+ */
+
+ 'use strict';
+
+ _emberMetalCore.default.LinkComponent = _emberRoutingViewsComponentsLinkTo.default;
+ _emberMetalCore.default.OutletView = _emberRoutingViewsViewsOutlet.OutletView;
+
+ exports.default = _emberMetalCore.default;
+});
+enifed('ember-routing-views/components/link-to', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/computed', 'ember-metal/computed_macros', 'ember-views/system/utils', 'ember-views/views/component', 'ember-runtime/inject', 'ember-runtime/system/service', 'ember-runtime/mixins/controller', 'ember-htmlbars/node-managers/component-node-manager', 'ember-htmlbars/templates/link-to'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalComputed, _emberMetalComputed_macros, _emberViewsSystemUtils, _emberViewsViewsComponent, _emberRuntimeInject, _emberRuntimeSystemService, _emberRuntimeMixinsController, _emberHtmlbarsNodeManagersComponentNodeManager, _emberHtmlbarsTemplatesLinkTo) {
+ /**
+ @module ember
+ @submodule ember-templates
+ */
+
+ /**
+ The `{{link-to}}` component renders a link to the supplied
`routeName` passing an optionally supplied model to the
route as its `model` context of the route. The block
for `{{link-to}}` becomes the innerHTML of the rendered
element:
@@ -21932,13 +22176,13 @@
{{#link-to 'photoGallery'}}
Great Hamster Photos
{{/link-to}}
```
- You can also use an inline form of `{{link-to}}` helper by
+ You can also use an inline form of `{{link-to}}` component by
passing the link text as the first argument
- to the helper:
+ to the component:
```handlebars
{{link-to 'Great Hamster Photos' 'photoGallery'}}
```
@@ -21968,13 +22212,14 @@
```
To override this option for your entire application, see
"Overriding Application-wide Defaults".
- ### Disabling the `link-to` helper
+ ### Disabling the `link-to` component
By default `{{link-to}}` is enabled.
- any passed value to `disabled` helper property will disable the `link-to` helper.
+ any passed value to the `disabled` component property will disable
+ the `link-to` component.
static use: the `disabled` option:
```handlebars
{{#link-to 'photoGallery' disabled=true}}
@@ -21989,11 +22234,11 @@
Great Hamster Photos
{{/link-to}}
```
any passed value to `disabled` will disable it except `undefined`.
- to ensure that only `true` disable the `link-to` helper you can
+ to ensure that only `true` disable the `link-to` component you can
override the global behaviour of `Ember.LinkComponent`.
```javascript
Ember.LinkComponent.reopen({
disabled: Ember.computed(function(key, value) {
@@ -22161,11 +22406,11 @@
When transitioning into the linked route, the `model` hook will
be triggered with parameters including this passed identifier.
### Allowing Default Action
- By default the `{{link-to}}` helper prevents the default browser action
+ By default the `{{link-to}}` component prevents the default browser action
by calling `preventDefault()` as this sort of action bubbling is normally
handled internally and we do not want to take the browser to a new URL (for
example).
If you need to override this behavior specify `preventDefault=false` in
@@ -22176,12 +22421,12 @@
{{aPhotoId.title}}
{{/link-to}}
```
### Overriding attributes
- You can override any given property of the Ember.LinkComponent
- that is generated by the `{{link-to}}` helper by passing
+ You can override any given property of the `Ember.LinkComponent`
+ that is generated by the `{{link-to}}` component by passing
key/value pairs, like so:
```handlebars
{{#link-to aPhoto tagName='li' title='Following this link will change your life' classNames='pic sweet'}}
Uh-mazing!
@@ -22191,13 +22436,13 @@
See [Ember.LinkComponent](/api/classes/Ember.LinkComponent.html) for a
complete list of overrideable properties. Be sure to also
check out inherited properties of `LinkComponent`.
### Overriding Application-wide Defaults
- ``{{link-to}}`` creates an instance of Ember.LinkComponent
+ ``{{link-to}}`` creates an instance of `Ember.LinkComponent`
for rendering. To override options for your entire
- application, reopen Ember.LinkComponent and supply the
+ application, reopen `Ember.LinkComponent` and supply the
desired values:
``` javascript
Ember.LinkComponent.reopen({
activeClass: "is-active",
@@ -22221,286 +22466,37 @@
@param [options] {Object} Handlebars key/value pairs of options, you can override any property of Ember.LinkComponent
@return {String} HTML string
@see {Ember.LinkComponent}
@public
*/
- exports.default = {
- link: function (state, params, hash) {
- },
- render: function (morph, env, scope, params, hash, template, inverse, visitor) {
- var attrs = _emberMetalMerge.default({}, hash);
-
- // TODO: Rewrite link-to to use arbitrary length positional params.
- attrs.params = _emberMetalStreamsUtils.readArray(params);
-
- // Used for deprecations (to tell the user what view the deprecated syntax
- // was used in).
- attrs.view = env.view;
-
- // TODO: Remove once `hasBlock` is working again
- attrs.hasBlock = !!template;
-
- attrs.escaped = !morph.parseTextAsHTML;
-
- env.hooks.component(morph, env, scope, '-link-to', params, attrs, { default: template }, visitor);
- },
-
- rerender: function (morph, env, scope, params, hash, template, inverse, visitor) {
- this.render(morph, env, scope, params, hash, template, inverse, visitor);
- }
- };
-});
-// assert
-enifed('ember-routing-htmlbars/keywords/render', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/empty_object', 'ember-metal/error', 'ember-metal/streams/utils', 'ember-runtime/system/string', 'ember-routing/system/generate_controller', 'ember-htmlbars/node-managers/view-node-manager'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalEmpty_object, _emberMetalError, _emberMetalStreamsUtils, _emberRuntimeSystemString, _emberRoutingSystemGenerate_controller, _emberHtmlbarsNodeManagersViewNodeManager) {
- 'use strict';
-
- exports.default = {
- willRender: function (renderNode, env) {
- if (env.view.ownerView._outlets) {
- // We make sure we will get dirtied when outlet state changes.
- env.view.ownerView._outlets.push(renderNode);
- }
- },
-
- setupState: function (prevState, env, scope, params, hash) {
- var name = params[0];
-
-
- return {
- parentView: env.view,
- manager: prevState.manager,
- controller: prevState.controller,
- childOutletState: childOutletState(name, env)
- };
- },
-
- childEnv: function (state, env) {
- return env.childWithOutletState(state.childOutletState);
- },
-
- isStable: function (lastState, nextState) {
- return isStable(lastState.childOutletState, nextState.childOutletState);
- },
-
- isEmpty: function (state) {
- return false;
- },
-
- render: function (node, env, scope, params, hash, template, inverse, visitor) {
- var state = node.state;
- var name = params[0];
- var context = params[1];
-
- var container = env.container;
-
- // The render keyword presumes it can work without a router. This is really
- // only to satisfy the test:
- //
- // {{view}} should not override class bindings defined on a child view"
- //
- var router = container.lookup('router:main');
-
-
- if (params.length === 1) {
- // use the singleton controller
- } else if (params.length !== 2) {
- throw new _emberMetalError.default('You must pass a templateName to render');
- }
-
- var templateName = 'template:' + name;
-
- var view = container.lookup('view:' + name);
- if (!view) {
- view = container.lookup('view:default');
- }
- var viewHasTemplateSpecified = view && !!_emberMetalProperty_get.get(view, 'template');
- if (!template && !viewHasTemplateSpecified) {
- template = container.lookup(templateName);
- }
-
- if (view) {
- view.ownerView = env.view.ownerView;
- }
-
- // provide controller override
- var controllerName;
- var controllerFullName;
-
- if (hash.controller) {
- controllerName = hash.controller;
- controllerFullName = 'controller:' + controllerName;
- delete hash.controller;
-
- } else {
- controllerName = name;
- controllerFullName = 'controller:' + controllerName;
- }
-
- var parentController = _emberMetalStreamsUtils.read(scope.locals.controller);
- var controller;
-
- // choose name
- if (params.length > 1) {
- var factory = container.lookupFactory(controllerFullName) || _emberRoutingSystemGenerate_controller.generateControllerFactory(container, controllerName);
-
- controller = factory.create({
- model: _emberMetalStreamsUtils.read(context),
- parentController: parentController,
- target: parentController
- });
-
- node.addDestruction(controller);
- } else {
- controller = container.lookup(controllerFullName) || _emberRoutingSystemGenerate_controller.default(container, controllerName);
-
- controller.setProperties({
- target: parentController,
- parentController: parentController
- });
- }
-
- if (view) {
- view.set('controller', controller);
- }
- state.controller = controller;
-
- hash.viewName = _emberRuntimeSystemString.camelize(name);
-
- // var state = node.state;
- // var parentView = scope.view;
- if (template && template.raw) {
- template = template.raw;
- }
-
- var options = {
- layout: null,
- self: controller
- };
-
- if (view) {
- options.component = view;
- }
-
- var nodeManager = _emberHtmlbarsNodeManagersViewNodeManager.default.create(node, env, hash, options, state.parentView, null, null, template);
- state.manager = nodeManager;
-
- if (router && params.length === 1) {
- router._connectActiveComponentNode(name, nodeManager);
- }
-
- nodeManager.render(env, hash, visitor);
- },
-
- rerender: function (node, env, scope, params, hash, template, inverse, visitor) {
- var model = _emberMetalStreamsUtils.read(params[1]);
- node.state.controller.set('model', model);
- }
- };
-
- function childOutletState(name, env) {
- var topLevel = env.view.ownerView;
- if (!topLevel || !topLevel.outletState) {
- return;
- }
-
- var outletState = topLevel.outletState;
- if (!outletState.main) {
- return;
- }
-
- var selectedOutletState = outletState.main.outlets['__ember_orphans__'];
- if (!selectedOutletState) {
- return;
- }
- var matched = selectedOutletState.outlets[name];
- if (matched) {
- var childState = new _emberMetalEmpty_object.default();
- childState[matched.render.outlet] = matched;
- matched.wasUsed = true;
- return childState;
- }
- }
-
- function isStable(a, b) {
- if (!a && !b) {
- return true;
- }
- if (!a || !b) {
- return false;
- }
- for (var outletName in a) {
- if (!isStableOutlet(a[outletName], b[outletName])) {
- return false;
- }
- }
- return true;
- }
-
- function isStableOutlet(a, b) {
- if (!a && !b) {
- return true;
- }
- if (!a || !b) {
- return false;
- }
- a = a.render;
- b = b.render;
- for (var key in a) {
- if (a.hasOwnProperty(key)) {
- // name is only here for logging & debugging. If two different
- // names result in otherwise identical states, they're still
- // identical.
- if (a[key] !== b[key] && key !== 'name') {
- return false;
- }
- }
- }
- return true;
- }
-});
-// assert
-enifed('ember-routing-views', ['exports', 'ember-metal/core', 'ember-routing-views/views/link', 'ember-routing-views/views/outlet'], function (exports, _emberMetalCore, _emberRoutingViewsViewsLink, _emberRoutingViewsViewsOutlet) {
/**
@module ember
@submodule ember-routing-views
*/
'use strict';
- _emberMetalCore.default.LinkComponent = _emberRoutingViewsViewsLink.default;
- _emberMetalCore.default.OutletView = _emberRoutingViewsViewsOutlet.OutletView;
+ _emberHtmlbarsTemplatesLinkTo.default.meta.revision = 'Ember@2.1.0-beta.3';
- exports.default = _emberMetalCore.default;
-});
-enifed('ember-routing-views/views/link', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/computed', 'ember-metal/computed_macros', 'ember-views/system/utils', 'ember-views/views/component', 'ember-runtime/inject', 'ember-runtime/system/service', 'ember-runtime/mixins/controller', 'ember-htmlbars/templates/link-to'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalComputed, _emberMetalComputed_macros, _emberViewsSystemUtils, _emberViewsViewsComponent, _emberRuntimeInject, _emberRuntimeSystemService, _emberRuntimeMixinsController, _emberHtmlbarsTemplatesLinkTo) {
/**
- @module ember
- @submodule ember-routing-views
- */
-
- 'use strict';
-
- _emberHtmlbarsTemplatesLinkTo.default.meta.revision = 'Ember@2.1.0-beta.1';
-
- /**
`Ember.LinkComponent` renders an element whose `click` event triggers a
transition of the application's instance of `Ember.Router` to
a supplied route by name.
- Instances of `LinkComponent` will most likely be created through
- the `link-to` Handlebars helper, but properties of this class
- can be overridden to customize application-wide behavior.
+ `Ember.LinkComponent` components are invoked with {{#link-to}}. Properties
+ of this class can be overridden with `reopen` to customize application-wide
+ behavior.
@class LinkComponent
@namespace Ember
@extends Ember.Component
- @see {Handlebars.helpers.link-to}
+ @see {Ember.Templates.helpers.link-to}
@private
**/
var LinkComponent = _emberViewsViewsComponent.default.extend({
- defaultLayout: _emberHtmlbarsTemplatesLinkTo.default,
+ layout: _emberHtmlbarsTemplatesLinkTo.default,
tagName: 'a',
/**
@deprecated Use current-when instead.
@@ -22508,11 +22504,11 @@
@private
*/
currentWhen: _emberMetalComputed_macros.deprecatingAlias('current-when', { id: 'ember-routing-view.deprecated-current-when', until: '3.0.0' }),
/**
- Used to determine when this LinkComponent is active.
+ Used to determine when this `LinkComponent` is active.
@property currentWhen
@public
*/
'current-when': null,
@@ -22589,32 +22585,32 @@
@public
**/
replace: false,
/**
- By default the `{{link-to}}` helper will bind to the `href` and
+ By default the `{{link-to}}` component will bind to the `href` and
`title` attributes. It's discouraged that you override these defaults,
however you can push onto the array if needed.
@property attributeBindings
@type Array | String
@default ['title', 'rel', 'tabindex', 'target']
@public
*/
attributeBindings: ['href', 'title', 'rel', 'tabindex', 'target'],
/**
- By default the `{{link-to}}` helper will bind to the `active`, `loading`, and
- `disabled` classes. It is discouraged to override these directly.
+ By default the `{{link-to}}` component will bind to the `active`, `loading`,
+ and `disabled` classes. It is discouraged to override these directly.
@property classNameBindings
@type Array
@default ['active', 'loading', 'disabled']
@public
*/
classNameBindings: ['active', 'loading', 'disabled', 'transitioningIn', 'transitioningOut'],
/**
- By default the `{{link-to}}` helper responds to the `click` event. You
+ By default the `{{link-to}}` component responds to the `click` event. You
can override this globally by setting this property to your custom
event name.
This is particularly useful on mobile when one wants to avoid the 300ms
click delay using some sort of custom `tap` event.
@property eventName
@@ -22635,11 +22631,11 @@
@event click
@private
*/
/**
- An overridable method called when LinkComponent objects are instantiated.
+ An overridable method called when `LinkComponent` objects are instantiated.
Example:
```javascript
App.MyLinkComponent = Ember.LinkComponent.extend({
init: function() {
this._super.apply(this, arguments);
@@ -22683,10 +22679,33 @@
return value ? _emberMetalProperty_get.get(this, 'disabledClass') : false;
}
}),
+ _computeActive: function (routerState) {
+ if (_emberMetalProperty_get.get(this, 'loading')) {
+ return false;
+ }
+
+ var routing = _emberMetalProperty_get.get(this, '_routing');
+ var models = _emberMetalProperty_get.get(this, 'models');
+ var resolvedQueryParams = _emberMetalProperty_get.get(this, 'resolvedQueryParams');
+
+ var currentWhen = _emberMetalProperty_get.get(this, 'current-when');
+ var isCurrentWhenSpecified = !!currentWhen;
+ currentWhen = currentWhen || _emberMetalProperty_get.get(this, 'qualifiedRouteName');
+ currentWhen = currentWhen.split(' ');
+
+ for (var i = 0, len = currentWhen.length; i < len; i++) {
+ if (routing.isActiveForRoute(models, resolvedQueryParams, currentWhen[i], routerState, isCurrentWhenSpecified)) {
+ return _emberMetalProperty_get.get(this, 'activeClass');
+ }
+ }
+
+ return false;
+ },
+
/**
Accessed as a classname binding to apply the `LinkComponent`'s `activeClass`
CSS `class` to the element when the link is active.
A `LinkComponent` is considered active when its `currentWhen` property is `true`
or the application's current route is the route the `LinkComponent` would trigger
@@ -22694,39 +22713,39 @@
The `currentWhen` property can match against multiple routes by separating
route names using the ` ` (space) character.
@property active
@private
*/
- active: _emberMetalComputed.computed('attrs.params', '_routing.currentState', function computeLinkComponentActive() {
+ active: _emberMetalComputed.computed('attrs.params', '_routing.currentState', function computeLinkToComponentActive() {
var currentState = _emberMetalProperty_get.get(this, '_routing.currentState');
if (!currentState) {
return false;
}
- return computeActive(this, currentState);
+ return this._computeActive(currentState);
}),
- willBeActive: _emberMetalComputed.computed('_routing.targetState', function () {
+ willBeActive: _emberMetalComputed.computed('_routing.targetState', function computeLinkToComponentWillBeActive() {
var routing = _emberMetalProperty_get.get(this, '_routing');
var targetState = _emberMetalProperty_get.get(routing, 'targetState');
if (_emberMetalProperty_get.get(routing, 'currentState') === targetState) {
return;
}
- return !!computeActive(this, targetState);
+ return !!this._computeActive(targetState);
}),
- transitioningIn: _emberMetalComputed.computed('active', 'willBeActive', function () {
+ transitioningIn: _emberMetalComputed.computed('active', 'willBeActive', function computeLinkToComponentTransitioningIn() {
var willBeActive = _emberMetalProperty_get.get(this, 'willBeActive');
if (typeof willBeActive === 'undefined') {
return false;
}
return !_emberMetalProperty_get.get(this, 'active') && willBeActive && 'ember-transitioning-in';
}),
- transitioningOut: _emberMetalComputed.computed('active', 'willBeActive', function () {
+ transitioningOut: _emberMetalComputed.computed('active', 'willBeActive', function computeLinkToComponentTransitioningOut() {
var willBeActive = _emberMetalProperty_get.get(this, 'willBeActive');
if (typeof willBeActive === 'undefined') {
return false;
}
@@ -22769,72 +22788,97 @@
if (targetAttribute2 && targetAttribute2 !== '_self') {
return false;
}
var routing = _emberMetalProperty_get.get(this, '_routing');
- var targetRouteName = this._computeRouteNameWithQueryParams(_emberMetalProperty_get.get(this, 'targetRouteName'));
+ var qualifiedRouteName = _emberMetalProperty_get.get(this, 'qualifiedRouteName');
var models = _emberMetalProperty_get.get(this, 'models');
var queryParamValues = _emberMetalProperty_get.get(this, 'queryParams.values');
var shouldReplace = _emberMetalProperty_get.get(this, 'attrs.replace');
- routing.transitionTo(targetRouteName, models, queryParamValues, shouldReplace);
+ routing.transitionTo(qualifiedRouteName, models, queryParamValues, shouldReplace);
},
queryParams: null,
+ qualifiedRouteName: _emberMetalComputed.computed('targetRouteName', '_routing.currentState', function computeLinkToComponentQualifiedRouteName() {
+ var params = this.attrs.params.slice();
+ var lastParam = params[params.length - 1];
+ if (lastParam && lastParam.isQueryParams) {
+ params.pop();
+ }
+ var onlyQueryParamsSupplied = this[_emberHtmlbarsNodeManagersComponentNodeManager.HAS_BLOCK] ? params.length === 0 : params.length === 1;
+ if (onlyQueryParamsSupplied) {
+ return _emberMetalProperty_get.get(this, '_routing.currentRouteName');
+ }
+ return _emberMetalProperty_get.get(this, 'targetRouteName');
+ }),
+
+ resolvedQueryParams: _emberMetalComputed.computed('queryParams', function computeLinkToComponentResolvedQueryParams() {
+ var resolvedQueryParams = {};
+ var queryParams = _emberMetalProperty_get.get(this, 'queryParams');
+
+ if (!queryParams) {
+ return resolvedQueryParams;
+ }
+
+ var values = queryParams.values;
+ for (var key in values) {
+ if (!values.hasOwnProperty(key)) {
+ continue;
+ }
+ resolvedQueryParams[key] = values[key];
+ }
+
+ return resolvedQueryParams;
+ }),
+
/**
Sets the element's `href` attribute to the url for
the `LinkComponent`'s targeted route.
If the `LinkComponent`'s `tagName` is changed to a value other
than `a`, this property will be ignored.
@property href
@private
*/
- href: _emberMetalComputed.computed('models', 'targetRouteName', '_routing.currentState', function computeLinkComponentHref() {
+ href: _emberMetalComputed.computed('models', 'qualifiedRouteName', function computeLinkToComponentHref() {
if (_emberMetalProperty_get.get(this, 'tagName') !== 'a') {
return;
}
- var targetRouteName = _emberMetalProperty_get.get(this, 'targetRouteName');
+ var qualifiedRouteName = _emberMetalProperty_get.get(this, 'qualifiedRouteName');
var models = _emberMetalProperty_get.get(this, 'models');
if (_emberMetalProperty_get.get(this, 'loading')) {
return _emberMetalProperty_get.get(this, 'loadingHref');
}
- targetRouteName = this._computeRouteNameWithQueryParams(targetRouteName);
-
var routing = _emberMetalProperty_get.get(this, '_routing');
var queryParams = _emberMetalProperty_get.get(this, 'queryParams.values');
- return routing.generateURL(targetRouteName, models, queryParams);
+ return routing.generateURL(qualifiedRouteName, models, queryParams);
}),
- loading: _emberMetalComputed.computed('models', 'targetRouteName', function () {
- var targetRouteName = _emberMetalProperty_get.get(this, 'targetRouteName');
- var models = _emberMetalProperty_get.get(this, 'models');
+ loading: _emberMetalComputed.computed('_modelsAreLoaded', 'qualifiedRouteName', function computeLinkToComponentLoading() {
+ var qualifiedRouteName = _emberMetalProperty_get.get(this, 'qualifiedRouteName');
+ var modelsAreLoaded = _emberMetalProperty_get.get(this, '_modelsAreLoaded');
- if (!modelsAreLoaded(models) || targetRouteName == null) {
+ if (!modelsAreLoaded || qualifiedRouteName == null) {
return _emberMetalProperty_get.get(this, 'loadingClass');
}
}),
- _computeRouteNameWithQueryParams: function (route) {
- var params = this.attrs.params.slice();
- var lastParam = params[params.length - 1];
- if (lastParam && lastParam.isQueryParams) {
- params.pop();
- }
- var onlyQueryParamsSupplied = this.attrs.hasBlock ? params.length === 0 : params.length === 1;
- if (onlyQueryParamsSupplied) {
- var appController = this.container.lookup('controller:application');
- if (appController) {
- return _emberMetalProperty_get.get(appController, 'currentRouteName');
+ _modelsAreLoaded: _emberMetalComputed.computed('models', function computeLinkToComponentModelsAreLoaded() {
+ var models = _emberMetalProperty_get.get(this, 'models');
+ for (var i = 0, l = models.length; i < l; i++) {
+ if (models[i] == null) {
+ return false;
}
}
- return route;
- },
+ return true;
+ }),
+
/**
The default href value to use while a link-to is loading.
Only applies when tagName is 'a'
@property loadingHref
@type String
@@ -22842,26 +22886,18 @@
@private
*/
loadingHref: '#',
willRender: function () {
- var queryParams;
+ var queryParams = undefined;
var attrs = this.attrs;
// Do not mutate params in place
var params = attrs.params.slice();
- var lastParam = params[params.length - 1];
-
- if (lastParam && lastParam.isQueryParams) {
- queryParams = params.pop();
- } else {
- queryParams = {};
- }
-
if (attrs.disabledClass) {
this.set('disabledClass', attrs.disabledClass);
}
if (attrs.activeClass) {
@@ -22870,101 +22906,58 @@
if (attrs.disabledWhen) {
this.set('disabled', attrs.disabledWhen);
}
- // TODO: Change to built-in hasBlock once it's available
- if (!attrs.hasBlock) {
- this.set('linkTitle', params.shift());
+ if (attrs.loadingClass) {
+ this.set('loadingClass', attrs.loadingClass);
}
- if (attrs.loadingClass) {
- _emberMetalProperty_set.set(this, 'loadingClass', attrs.loadingClass);
+ // Process the positional arguments, in order.
+ // 1. Inline link title comes first, if present.
+ if (!this[_emberHtmlbarsNodeManagersComponentNodeManager.HAS_BLOCK]) {
+ this.set('linkTitle', params.shift());
}
- for (var i = 0; i < params.length; i++) {
- var value = params[i];
+ // 2. `targetRouteName` is now always at index 0.
+ this.set('targetRouteName', params[0]);
- while (_emberRuntimeMixinsController.default.detect(value)) {
- value = value.get('model');
- }
+ // 3. The last argument (if still remaining) is the `queryParams` object.
+ var lastParam = params[params.length - 1];
- params[i] = value;
+ if (lastParam && lastParam.isQueryParams) {
+ queryParams = params.pop();
+ } else {
+ queryParams = {};
}
+ this.set('queryParams', queryParams);
- var targetRouteName = undefined;
+ // 4. Any remaining indices (excepting `targetRouteName` at 0) are `models`.
var models = [];
- targetRouteName = this._computeRouteNameWithQueryParams(params[0]);
for (var i = 1; i < params.length; i++) {
- models.push(params[i]);
- }
+ var value = params[i];
- var resolvedQueryParams = getResolvedQueryParams(queryParams, targetRouteName);
+ while (_emberRuntimeMixinsController.default.detect(value)) {
+ value = value.get('model');
+ }
- this.set('targetRouteName', targetRouteName);
+ models.push(value);
+ }
+
this.set('models', models);
- this.set('queryParams', queryParams);
- this.set('resolvedQueryParams', resolvedQueryParams);
}
});
LinkComponent.toString = function () {
return 'LinkComponent';
};
- function computeActive(view, routerState) {
- if (_emberMetalProperty_get.get(view, 'loading')) {
- return false;
- }
+ LinkComponent.reopenClass({
+ positionalParams: 'params'
+ });
- var currentWhen = _emberMetalProperty_get.get(view, 'current-when');
- var isCurrentWhenSpecified = !!currentWhen;
- currentWhen = currentWhen || _emberMetalProperty_get.get(view, 'targetRouteName');
- currentWhen = currentWhen.split(' ');
- for (var i = 0, len = currentWhen.length; i < len; i++) {
- if (isActiveForRoute(view, currentWhen[i], isCurrentWhenSpecified, routerState)) {
- return _emberMetalProperty_get.get(view, 'activeClass');
- }
- }
-
- return false;
- }
-
- function modelsAreLoaded(models) {
- for (var i = 0, l = models.length; i < l; i++) {
- if (models[i] == null) {
- return false;
- }
- }
-
- return true;
- }
-
- function isActiveForRoute(view, routeName, isCurrentWhenSpecified, routerState) {
- var service = _emberMetalProperty_get.get(view, '_routing');
- return service.isActiveForRoute(_emberMetalProperty_get.get(view, 'models'), _emberMetalProperty_get.get(view, 'resolvedQueryParams'), routeName, routerState, isCurrentWhenSpecified);
- }
-
- function getResolvedQueryParams(queryParamsObject, targetRouteName) {
- var resolvedQueryParams = {};
-
- if (!queryParamsObject) {
- return resolvedQueryParams;
- }
-
- var values = queryParamsObject.values;
- for (var key in values) {
- if (!values.hasOwnProperty(key)) {
- continue;
- }
- resolvedQueryParams[key] = values[key];
- }
-
- return resolvedQueryParams;
- }
-
exports.default = LinkComponent;
});
// FEATURES, Logger, assert
// creates inject.service
@@ -22974,11 +22967,11 @@
@submodule ember-routing-views
*/
'use strict';
- _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.1.0-beta.1';
+ _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.1.0-beta.3';
var CoreOutletView = _emberViewsViewsView.default.extend({
defaultTemplate: _emberHtmlbarsTemplatesTopLevelView.default,
init: function () {
@@ -23011,11 +23004,11 @@
exports.CoreOutletView = CoreOutletView;
var OutletView = CoreOutletView.extend({ tagName: '' });
exports.OutletView = OutletView;
});
-enifed('ember-routing', ['exports', 'ember-metal/core', 'ember-routing/ext/run_loop', 'ember-routing/ext/controller', 'ember-routing/location/api', 'ember-routing/location/none_location', 'ember-routing/location/hash_location', 'ember-routing/location/history_location', 'ember-routing/location/auto_location', 'ember-routing/system/generate_controller', 'ember-routing/system/controller_for', 'ember-routing/system/dsl', 'ember-routing/system/router', 'ember-routing/system/route', 'ember-routing/initializers/routing-service'], function (exports, _emberMetalCore, _emberRoutingExtRun_loop, _emberRoutingExtController, _emberRoutingLocationApi, _emberRoutingLocationNone_location, _emberRoutingLocationHash_location, _emberRoutingLocationHistory_location, _emberRoutingLocationAuto_location, _emberRoutingSystemGenerate_controller, _emberRoutingSystemController_for, _emberRoutingSystemDsl, _emberRoutingSystemRouter, _emberRoutingSystemRoute, _emberRoutingInitializersRoutingService) {
+enifed('ember-routing', ['exports', 'ember-metal/core', 'ember-routing/ext/run_loop', 'ember-routing/ext/controller', 'ember-routing/location/api', 'ember-routing/location/none_location', 'ember-routing/location/hash_location', 'ember-routing/location/history_location', 'ember-routing/location/auto_location', 'ember-routing/system/generate_controller', 'ember-routing/system/controller_for', 'ember-routing/system/dsl', 'ember-routing/system/router', 'ember-routing/system/route'], function (exports, _emberMetalCore, _emberRoutingExtRun_loop, _emberRoutingExtController, _emberRoutingLocationApi, _emberRoutingLocationNone_location, _emberRoutingLocationHash_location, _emberRoutingLocationHistory_location, _emberRoutingLocationAuto_location, _emberRoutingSystemGenerate_controller, _emberRoutingSystemController_for, _emberRoutingSystemDsl, _emberRoutingSystemRouter, _emberRoutingSystemRoute) {
/**
@module ember
@submodule ember-routing
*/
@@ -23208,33 +23201,10 @@
// resolve), which is used in router transitions to prevent unnecessary
// loading state entry if all context promises resolve on the
// 'actions' queue first.
_emberMetalRun_loop.default._addQueue('routerTransitions', 'actions');
});
-enifed('ember-routing/initializers/routing-service', ['exports', 'ember-runtime/system/lazy_load', 'ember-routing/services/routing', 'ember-metal/features'], function (exports, _emberRuntimeSystemLazy_load, _emberRoutingServicesRouting, _emberMetalFeatures) {
- 'use strict';
-
- var initialize = undefined;
-
- initialize = function (application) {
- // Register the routing service...
- application.register('service:-routing', _emberRoutingServicesRouting.default);
- // Then inject the app router into it
- application.inject('service:-routing', 'router', 'router:main');
- };
-
- _emberRuntimeSystemLazy_load.onLoad('Ember.Application', function (Application) {
- Application.initializer({
- name: 'routing-service',
- initialize: initialize
- });
- });
-});
-
-// Register the routing service...
-
-// Then inject the app router into it
enifed('ember-routing/location/api', ['exports', 'ember-metal/core', 'ember-metal/environment', 'ember-routing/location/util'], function (exports, _emberMetalCore, _emberMetalEnvironment, _emberRoutingLocationUtil) {
'use strict';
/**
@module ember
@@ -25412,11 +25382,11 @@
queryParams: {showComments: 'true'}
});
// if you just want to transition the query parameters without changing the route
this.transitionTo({queryParams: {sort: 'date'}});
```
- See also 'replaceWith'.
+ See also [replaceWith](#method_replaceWith).
Simple Transition Example
```javascript
App.Router.map(function() {
this.route('index');
this.route('secret');
@@ -25508,11 +25478,11 @@
@method intermediateTransitionTo
@param {String} name the name of the route
@param {...Object} models the model(s) to be used while transitioning
to the route.
@since 1.2.0
- @private
+ @public
*/
intermediateTransitionTo: function () {
var router = this.router;
router.intermediateTransitionTo.apply(router, arguments);
},
@@ -26140,17 +26110,18 @@
return _emberRoutingSystemGenerate_controller.default(container, name, model);
},
/**
- Returns the model of a parent (or any ancestor) route
+ Returns the resolved model of a parent (or any ancestor) route
in a route hierarchy. During a transition, all routes
must resolve a model object, and if a route
needs access to a parent route's model in order to
resolve a model (or just reuse the model from a parent),
it can call `this.modelFor(theNameOfParentRoute)` to
- retrieve it.
+ retrieve it. If the ancestor route's model was a promise,
+ its resolved result is returned.
Example
```javascript
App.Router.map(function() {
this.route('post', { path: '/post/:post_id' }, function() {
this.route('comments', { resetNamespace: true });
@@ -26639,10 +26610,55 @@
// apply default values to controllers
// detect that default value defined on router config
// detect that property was not defined on controller
+enifed('ember-routing/system/router_state', ['exports', 'ember-metal/is_empty', 'ember-metal/keys', 'ember-runtime/system/object', 'ember-metal/merge'], function (exports, _emberMetalIs_empty, _emberMetalKeys, _emberRuntimeSystemObject, _emberMetalMerge) {
+ 'use strict';
+
+ var RouterState = _emberRuntimeSystemObject.default.extend({
+ emberRouter: null,
+ routerJs: null,
+ routerJsState: null,
+
+ isActiveIntent: function (routeName, models, queryParams, queryParamsMustMatch) {
+ var state = this.routerJsState;
+ if (!this.routerJs.isActiveIntent(routeName, models, null, state)) {
+ return false;
+ }
+
+ var emptyQueryParams = _emberMetalIs_empty.default(_emberMetalKeys.default(queryParams));
+
+ if (queryParamsMustMatch && !emptyQueryParams) {
+ var visibleQueryParams = {};
+ _emberMetalMerge.default(visibleQueryParams, queryParams);
+
+ this.emberRouter._prepareQueryParams(routeName, models, visibleQueryParams);
+ return shallowEqual(visibleQueryParams, state.queryParams);
+ }
+
+ return true;
+ }
+ });
+
+ function shallowEqual(a, b) {
+ var k;
+ for (k in a) {
+ if (a.hasOwnProperty(k) && a[k] !== b[k]) {
+ return false;
+ }
+ }
+ for (k in b) {
+ if (b.hasOwnProperty(k) && a[k] !== b[k]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ exports.default = RouterState;
+});
enifed('ember-routing/system/router', ['exports', 'ember-metal/core', 'ember-metal/error', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/properties', 'ember-metal/empty_object', 'ember-metal/computed', 'ember-metal/merge', 'ember-metal/run_loop', 'ember-runtime/system/object', 'ember-runtime/mixins/evented', 'ember-routing/system/dsl', 'ember-routing/location/api', 'ember-routing/utils', './router_state', 'router', 'router/transition'], function (exports, _emberMetalCore, _emberMetalError, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalProperties, _emberMetalEmpty_object, _emberMetalComputed, _emberMetalMerge, _emberMetalRun_loop, _emberRuntimeSystemObject, _emberRuntimeMixinsEvented, _emberRoutingSystemDsl, _emberRoutingLocationApi, _emberRoutingUtils, _router_state, _router4, _routerTransition) {
'use strict';
function K() {
return this;
@@ -26663,14 +26679,15 @@
var EmberRouter = _emberRuntimeSystemObject.default.extend(_emberRuntimeMixinsEvented.default, {
/**
The `location` property determines the type of URL's that your
application will use.
The following location types are currently available:
- * `auto`
- * `hash`
- * `history`
- * `none`
+ * `history` - use the browser's history API to make the URLs look just like any standard URL
+ * `hash` - use `#` to separate the server part of the URL from the Ember part: `/blog/#/posts/new`
+ * `none` - do not store the Ember URL in the actual browser URL (mainly used for testing)
+ * `auto` - use the best option based on browser capabilites: `history` if possible, then `hash` if possible, otherwise `none`
+ Note: If using ember-cli, this value is defaulted to `auto` by the `locationType` setting of `/config/environment.js`
@property location
@default 'hash'
@see {Ember.Location}
@public
*/
@@ -26787,10 +26804,24 @@
/**
Handles updating the paths and notifying any listeners of the URL
change.
Triggers the router level `didTransition` hook.
+ For example, to notify google analytics when the route changes,
+ you could use this hook. (Note: requires also including GA scripts, etc.)
+ ```javascript
+ var Router = Ember.Router.extend({
+ location: config.locationType,
+ didTransition: function() {
+ this._super(...arguments);
+ return ga('send', 'pageview', {
+ 'page': this.get('url'),
+ 'title': this.get('url')
+ });
+ }
+ });
+ ```
@method didTransition
@public
@since 1.2.0
*/
didTransition: function (infos) {
@@ -27738,55 +27769,10 @@
/**
@module ember
@submodule ember-routing
*/
-enifed('ember-routing/system/router_state', ['exports', 'ember-metal/is_empty', 'ember-metal/keys', 'ember-runtime/system/object', 'ember-metal/merge'], function (exports, _emberMetalIs_empty, _emberMetalKeys, _emberRuntimeSystemObject, _emberMetalMerge) {
- 'use strict';
-
- var RouterState = _emberRuntimeSystemObject.default.extend({
- emberRouter: null,
- routerJs: null,
- routerJsState: null,
-
- isActiveIntent: function (routeName, models, queryParams, queryParamsMustMatch) {
- var state = this.routerJsState;
- if (!this.routerJs.isActiveIntent(routeName, models, null, state)) {
- return false;
- }
-
- var emptyQueryParams = _emberMetalIs_empty.default(_emberMetalKeys.default(queryParams));
-
- if (queryParamsMustMatch && !emptyQueryParams) {
- var visibleQueryParams = {};
- _emberMetalMerge.default(visibleQueryParams, queryParams);
-
- this.emberRouter._prepareQueryParams(routeName, models, visibleQueryParams);
- return shallowEqual(visibleQueryParams, state.queryParams);
- }
-
- return true;
- }
- });
-
- function shallowEqual(a, b) {
- var k;
- for (k in a) {
- if (a.hasOwnProperty(k) && a[k] !== b[k]) {
- return false;
- }
- }
- for (k in b) {
- if (b.hasOwnProperty(k) && a[k] !== b[k]) {
- return false;
- }
- }
- return true;
- }
-
- exports.default = RouterState;
-});
enifed('ember-routing/utils', ['exports', 'ember-metal/merge', 'ember-metal/property_get'], function (exports, _emberMetalMerge, _emberMetalProperty_get) {
'use strict';
exports.routeArgs = routeArgs;
exports.getActiveTargetName = getActiveTargetName;
@@ -28185,11 +28171,17 @@
function reduceMacro(dependentKey, callback, initialValue) {
return _emberMetalComputed.computed(dependentKey + '.[]', function () {
var _this = this;
- return _emberMetalProperty_get.get(this, dependentKey).reduce(function (previousValue, currentValue, index, array) {
+ var arr = _emberMetalProperty_get.get(this, dependentKey);
+
+ if (arr === null || typeof arr !== 'object') {
+ return initialValue;
+ }
+
+ return arr.reduce(function (previousValue, currentValue, index, array) {
return callback.call(_this, previousValue, currentValue, index, array);
}, initialValue);
}).readOnly();
}
@@ -28774,10 +28766,14 @@
}
var items = itemsKey === '@this' ? this : _emberMetalProperty_get.get(this, itemsKey);
var sortProperties = _emberMetalProperty_get.get(this, sortPropertiesKey);
+ if (items === null || typeof items !== 'object') {
+ return _emberMetalCore.default.A();
+ }
+
// TODO: Ideally we'd only do this if things have changed
if (cp._sortPropObservers) {
cp._sortPropObservers.forEach(function (args) {
return _emberMetalObserver.removeObserver.apply(null, args);
});
@@ -29172,22 +29168,25 @@
}
callback(promise);
});
});
- function onerrorDefault(e) {
+ function onerrorDefault(reason) {
var error;
- if (e && e.errorThrown) {
+ if (reason && reason.errorThrown) {
// jqXHR provides this
- error = e.errorThrown;
+ error = reason.errorThrown;
if (typeof error === 'string') {
error = new Error(error);
}
- error.__reason_with_error_thrown__ = e;
+ Object.defineProperty(error, '__reason_with_error_thrown__', {
+ value: reason,
+ enumerable: false
+ });
} else {
- error = e;
+ error = reason;
}
if (error && error.name === "UnrecognizedURLError") {
return;
}
@@ -29533,11 +29532,11 @@
}
});
});
// Ember.assert
-enifed('ember-runtime/mixins/action_handler', ['exports', 'ember-metal/core', 'ember-metal/mixin', 'ember-metal/property_get', 'ember-metal/deprecate_property'], function (exports, _emberMetalCore, _emberMetalMixin, _emberMetalProperty_get, _emberMetalDeprecate_property) {
+enifed('ember-runtime/mixins/action_handler', ['exports', 'ember-metal/core', 'ember-metal/mixin', 'ember-metal/property_get'], function (exports, _emberMetalCore, _emberMetalMixin, _emberMetalProperty_get) {
/**
@module ember
@submodule ember-runtime
*/
'use strict';
@@ -29702,18 +29701,37 @@
if (target = _emberMetalProperty_get.get(this, 'target')) {
var _target;
(_target = target).send.apply(_target, arguments);
}
+ },
+
+ willMergeMixin: function (props) {
+
+ if (props._actions) {
+
+ props.actions = props._actions;
+ delete props._actions;
+ }
}
});
exports.default = ActionHandler;
function deprecateUnderscoreActions(factory) {
- _emberMetalDeprecate_property.deprecateProperty(factory.prototype, '_actions', 'actions', {
- id: 'ember-runtime.action-handler-_actions', until: '3.0.0'
+ function deprecate() {
+ }
+
+ Object.defineProperty(factory.prototype, '_actions', {
+ configurable: true,
+ enumerable: false,
+ set: function (value) {
+ },
+ get: function () {
+ deprecate();
+ return _emberMetalProperty_get.get(this, 'actions');
+ }
});
}
});
enifed('ember-runtime/mixins/array', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/computed', 'ember-metal/is_none', 'ember-runtime/mixins/enumerable', 'ember-metal/mixin', 'ember-metal/property_events', 'ember-metal/events', 'ember-runtime/system/each_proxy'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalComputed, _emberMetalIs_none, _emberRuntimeMixinsEnumerable, _emberMetalMixin, _emberMetalProperty_events, _emberMetalEvents, _emberRuntimeSystemEach_proxy) {
/**
@@ -30312,10 +30330,53 @@
return (_container__ = this.__container__)[name].apply(_container__, arguments);
};
}
});
+enifed('ember-runtime/mixins/controller_content_model_alias_deprecation', ['exports', 'ember-metal/core', 'ember-metal/mixin'], function (exports, _emberMetalCore, _emberMetalMixin) {
+ 'use strict';
+
+ /*
+ The ControllerContentModelAliasDeprecation mixin is used to provide a useful
+ deprecation warning when specifying `content` directly on a `Ember.Controller`
+ (without also specifying `model`).
+
+ Ember versions prior to 1.7 used `model` as an alias of `content`, but due to
+ much confusion this alias was reversed (so `content` is now an alias of `model).
+
+ This change reduces many caveats with model/content, and also sets a
+ simple ground rule: Never set a controllers content, rather always set
+ its model and ember will do the right thing.
+
+ Used internally by Ember in `Ember.Controller`.
+ */
+ exports.default = _emberMetalMixin.Mixin.create({
+ /**
+ @private
+ Moves `content` to `model` at extend time if a `model` is not also specified.
+ Note that this currently modifies the mixin themselves, which is technically
+ dubious but is practically of little consequence. This may change in the
+ future.
+ @method willMergeMixin
+ @since 1.4.0
+ */
+ willMergeMixin: function (props) {
+ // Calling super is only OK here since we KNOW that
+ // there is another Mixin loaded first.
+ this._super.apply(this, arguments);
+
+ var modelSpecified = !!props.model;
+
+ if (props.content && !modelSpecified) {
+ props.model = props.content;
+ delete props['content'];
+
+ }
+ }
+ });
+});
+// Ember.deprecate
enifed('ember-runtime/mixins/controller', ['exports', 'ember-metal/mixin', 'ember-metal/alias', 'ember-runtime/mixins/action_handler', 'ember-runtime/mixins/controller_content_model_alias_deprecation'], function (exports, _emberMetalMixin, _emberMetalAlias, _emberRuntimeMixinsAction_handler, _emberRuntimeMixinsController_content_model_alias_deprecation) {
'use strict';
/**
@class ControllerMixin
@@ -30339,11 +30400,11 @@
template, or when a controller is used as an `itemController`. In most
cases the `target` property will automatically be set to the logical
consumer of actions for the controller.
@property target
@default null
- @private
+ @public
*/
target: null,
container: null,
@@ -30364,53 +30425,10 @@
*/
content: _emberMetalAlias.default('model')
});
});
-enifed('ember-runtime/mixins/controller_content_model_alias_deprecation', ['exports', 'ember-metal/core', 'ember-metal/mixin'], function (exports, _emberMetalCore, _emberMetalMixin) {
- 'use strict';
-
- /*
- The ControllerContentModelAliasDeprecation mixin is used to provide a useful
- deprecation warning when specifying `content` directly on a `Ember.Controller`
- (without also specifying `model`).
-
- Ember versions prior to 1.7 used `model` as an alias of `content`, but due to
- much confusion this alias was reversed (so `content` is now an alias of `model).
-
- This change reduces many caveats with model/content, and also sets a
- simple ground rule: Never set a controllers content, rather always set
- its model and ember will do the right thing.
-
- Used internally by Ember in `Ember.Controller`.
- */
- exports.default = _emberMetalMixin.Mixin.create({
- /**
- @private
- Moves `content` to `model` at extend time if a `model` is not also specified.
- Note that this currently modifies the mixin themselves, which is technically
- dubious but is practically of little consequence. This may change in the
- future.
- @method willMergeMixin
- @since 1.4.0
- */
- willMergeMixin: function (props) {
- // Calling super is only OK here since we KNOW that
- // there is another Mixin loaded first.
- this._super.apply(this, arguments);
-
- var modelSpecified = !!props.model;
-
- if (props.content && !modelSpecified) {
- props.model = props.content;
- delete props['content'];
-
- }
- }
- });
-});
-// Ember.deprecate
enifed('ember-runtime/mixins/copyable', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/mixin', 'ember-runtime/mixins/freezable', 'ember-metal/error'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalMixin, _emberRuntimeMixinsFreezable, _emberMetalError) {
/**
@module ember
@submodule ember-runtime
*/
@@ -32189,13 +32207,14 @@
call to the end of your method declarations in classes that you write.
For example:
```javascript
Ember.Object.extend({
- valueObserver: function() {
+ valueObserver: Ember.observer('value', function(sender, key, value, rev) {
// Executes whenever the "value" property changes
- }.observes('value')
+ // See the addObserver method for more information about the callback arguments
+ })
});
```
Although this is the most common way to add an observer, this capability
is actually built into the `Ember.Object` class on top of two methods
@@ -32774,13 +32793,14 @@
var promise = _emberMetalProperty_get.get(this, 'promise');
return promise[name].apply(promise, arguments);
};
}
});
-enifed('ember-runtime/mixins/registry_proxy', ['exports', 'ember-metal/mixin'], function (exports, _emberMetalMixin) {
+enifed('ember-runtime/mixins/registry_proxy', ['exports', 'ember-metal/core', 'ember-metal/mixin'], function (exports, _emberMetalCore, _emberMetalMixin) {
'use strict';
+ exports.buildFakeRegistryWithDeprecations = buildFakeRegistryWithDeprecations;
exports.default = _emberMetalMixin.Mixin.create({
__registry__: null,
/**
Given a fullName return the corresponding factory.
@@ -32981,10 +33001,38 @@
var _registry__;
return (_registry__ = this.__registry__)[name].apply(_registry__, arguments);
};
}
+
+ function buildFakeRegistryWithDeprecations(instance, typeForMessage) {
+ var fakeRegistry = {};
+ var registryProps = {
+ resolve: 'resolveRegistration',
+ register: 'register',
+ unregister: 'unregister',
+ has: 'hasRegistration',
+ option: 'registerOption',
+ options: 'registerOptions',
+ getOptions: 'registeredOptions',
+ optionsForType: 'registerOptionsForType',
+ getOptionsForType: 'registeredOptionsForType',
+ injection: 'inject'
+ };
+
+ for (var deprecatedProperty in registryProps) {
+ fakeRegistry[deprecatedProperty] = buildFakeRegistryFunction(instance, typeForMessage, deprecatedProperty, registryProps[deprecatedProperty]);
+ }
+
+ return fakeRegistry;
+ }
+
+ function buildFakeRegistryFunction(instance, typeForMessage, deprecatedProperty, nonDeprecatedProperty) {
+ return function () {
+ return instance[nonDeprecatedProperty].apply(instance, arguments);
+ };
+ }
});
enifed('ember-runtime/mixins/target_action_support', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/mixin', 'ember-metal/computed'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalMixin, _emberMetalComputed) {
/**
@module ember
@submodule ember-runtime
@@ -33610,11 +33658,11 @@
desc.set(this, keyName, value);
} else {
if (typeof this.setUnknownProperty === 'function' && !(keyName in this)) {
this.setUnknownProperty(keyName, value);
} else {
- this[keyName] = value;
+ _emberMetalProperties.defineProperty(this, keyName, null, value); // setup mandatory setter
}
}
}
}
}
@@ -34266,11 +34314,10 @@
// Ember.assert, Ember.config
// NOTE: this object should never be included directly. Instead use `Ember.Object`.
// We only define this separately so that `Ember.Set` can depend on it.
-// setup mandatory setter
enifed('ember-runtime/system/each_proxy', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/observer', 'ember-metal/property_events', 'ember-metal/empty_object'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalObserver, _emberMetalProperty_events, _emberMetalEmpty_object) {
'use strict';
/**
This is the object instance returned when you get the `@each` property on an
@@ -34873,36 +34920,10 @@
_emberMetalCore.default.A = A;exports.A = A;
exports.NativeArray = NativeArray;
exports.default = NativeArray;
});
// Ember.EXTEND_PROTOTYPES
-enifed('ember-runtime/system/object', ['exports', 'ember-runtime/system/core_object', 'ember-runtime/mixins/observable'], function (exports, _emberRuntimeSystemCore_object, _emberRuntimeMixinsObservable) {
- /**
- @module ember
- @submodule ember-runtime
- */
-
- 'use strict';
-
- /**
- `Ember.Object` is the main base class for all Ember objects. It is a subclass
- of `Ember.CoreObject` with the `Ember.Observable` mixin applied. For details,
- see the documentation for each of these.
-
- @class Object
- @namespace Ember
- @extends Ember.CoreObject
- @uses Ember.Observable
- @public
- */
- var EmberObject = _emberRuntimeSystemCore_object.default.extend(_emberRuntimeMixinsObservable.default);
- EmberObject.toString = function () {
- return 'Ember.Object';
- };
-
- exports.default = EmberObject;
-});
enifed('ember-runtime/system/object_proxy', ['exports', 'ember-runtime/system/object', 'ember-runtime/mixins/-proxy'], function (exports, _emberRuntimeSystemObject, _emberRuntimeMixinsProxy) {
'use strict';
/**
`Ember.ObjectProxy` forwards all properties not defined by the proxy itself
@@ -34974,10 +34995,36 @@
@public
*/
exports.default = _emberRuntimeSystemObject.default.extend(_emberRuntimeMixinsProxy.default);
});
+enifed('ember-runtime/system/object', ['exports', 'ember-runtime/system/core_object', 'ember-runtime/mixins/observable'], function (exports, _emberRuntimeSystemCore_object, _emberRuntimeMixinsObservable) {
+ /**
+ @module ember
+ @submodule ember-runtime
+ */
+
+ 'use strict';
+
+ /**
+ `Ember.Object` is the main base class for all Ember objects. It is a subclass
+ of `Ember.CoreObject` with the `Ember.Observable` mixin applied. For details,
+ see the documentation for each of these.
+
+ @class Object
+ @namespace Ember
+ @extends Ember.CoreObject
+ @uses Ember.Observable
+ @public
+ */
+ var EmberObject = _emberRuntimeSystemCore_object.default.extend(_emberRuntimeMixinsObservable.default);
+ EmberObject.toString = function () {
+ return 'Ember.Object';
+ };
+
+ exports.default = EmberObject;
+});
enifed('ember-runtime/system/service', ['exports', 'ember-runtime/system/object', 'ember-runtime/inject'], function (exports, _emberRuntimeSystemObject, _emberRuntimeInject) {
'use strict';
/**
Creates a property that lazily looks up a service in the container. There
@@ -35481,21 +35528,22 @@
}
return ret;
}
});
-enifed('ember-template-compiler', ['exports', 'ember-metal', 'ember-template-compiler/system/precompile', 'ember-template-compiler/system/compile', 'ember-template-compiler/system/template', 'ember-template-compiler/plugins', 'ember-template-compiler/plugins/transform-old-binding-syntax', 'ember-template-compiler/plugins/transform-old-class-binding-syntax', 'ember-template-compiler/plugins/transform-item-class', 'ember-template-compiler/plugins/transform-component-attrs-into-mut', 'ember-template-compiler/plugins/transform-component-curly-to-readonly', 'ember-template-compiler/plugins/transform-angle-bracket-components', 'ember-template-compiler/plugins/transform-input-on-to-onEvent', 'ember-template-compiler/plugins/transform-top-level-components', 'ember-template-compiler/plugins/transform-each-into-collection', 'ember-template-compiler/plugins/assert-no-view-and-controller-paths', 'ember-template-compiler/plugins/assert-no-view-helper', 'ember-template-compiler/compat'], function (exports, _emberMetal, _emberTemplateCompilerSystemPrecompile, _emberTemplateCompilerSystemCompile, _emberTemplateCompilerSystemTemplate, _emberTemplateCompilerPlugins, _emberTemplateCompilerPluginsTransformOldBindingSyntax, _emberTemplateCompilerPluginsTransformOldClassBindingSyntax, _emberTemplateCompilerPluginsTransformItemClass, _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut, _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly, _emberTemplateCompilerPluginsTransformAngleBracketComponents, _emberTemplateCompilerPluginsTransformInputOnToOnEvent, _emberTemplateCompilerPluginsTransformTopLevelComponents, _emberTemplateCompilerPluginsTransformEachIntoCollection, _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths, _emberTemplateCompilerPluginsAssertNoViewHelper, _emberTemplateCompilerCompat) {
+enifed('ember-template-compiler', ['exports', 'ember-metal', 'ember-template-compiler/system/precompile', 'ember-template-compiler/system/compile', 'ember-template-compiler/system/template', 'ember-template-compiler/plugins', 'ember-template-compiler/plugins/transform-old-binding-syntax', 'ember-template-compiler/plugins/transform-old-class-binding-syntax', 'ember-template-compiler/plugins/transform-item-class', 'ember-template-compiler/plugins/transform-component-attrs-into-mut', 'ember-template-compiler/plugins/transform-component-curly-to-readonly', 'ember-template-compiler/plugins/transform-angle-bracket-components', 'ember-template-compiler/plugins/transform-input-on-to-onEvent', 'ember-template-compiler/plugins/transform-top-level-components', 'ember-template-compiler/plugins/transform-each-into-collection', 'ember-template-compiler/plugins/transform-unescaped-inline-link-to', 'ember-template-compiler/plugins/assert-no-view-and-controller-paths', 'ember-template-compiler/plugins/assert-no-view-helper', 'ember-template-compiler/compat'], function (exports, _emberMetal, _emberTemplateCompilerSystemPrecompile, _emberTemplateCompilerSystemCompile, _emberTemplateCompilerSystemTemplate, _emberTemplateCompilerPlugins, _emberTemplateCompilerPluginsTransformOldBindingSyntax, _emberTemplateCompilerPluginsTransformOldClassBindingSyntax, _emberTemplateCompilerPluginsTransformItemClass, _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut, _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly, _emberTemplateCompilerPluginsTransformAngleBracketComponents, _emberTemplateCompilerPluginsTransformInputOnToOnEvent, _emberTemplateCompilerPluginsTransformTopLevelComponents, _emberTemplateCompilerPluginsTransformEachIntoCollection, _emberTemplateCompilerPluginsTransformUnescapedInlineLinkTo, _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths, _emberTemplateCompilerPluginsAssertNoViewHelper, _emberTemplateCompilerCompat) {
'use strict';
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldBindingSyntax.default);
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldClassBindingSyntax.default);
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformItemClass.default);
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut.default);
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly.default);
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformAngleBracketComponents.default);
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformInputOnToOnEvent.default);
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformTopLevelComponents.default);
+ _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformUnescapedInlineLinkTo.default);
if (_emberMetal.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformEachIntoCollection.default);
} else {
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths.default);
@@ -36376,10 +36424,40 @@
}
}
exports.default = TransformTopLevelComponents;
});
+enifed('ember-template-compiler/plugins/transform-unescaped-inline-link-to', ['exports'], function (exports) {
+ 'use strict';
+
+ exports.default = TransformUnescapedInlineLinkTo;
+
+ function TransformUnescapedInlineLinkTo(options) {
+ this.options = options;
+ this.syntax = null;
+ }
+
+ TransformUnescapedInlineLinkTo.prototype.transform = function TransformUnescapedInlineLinkTo_transform(ast) {
+ var b = this.syntax.builders;
+ var walker = new this.syntax.Walker();
+
+ walker.visit(ast, function (node) {
+ if (!validate(node)) {
+ return;
+ }
+
+ node.escaped = true;
+ node.params[0] = b.sexpr(b.string('-html-safe'), [node.params[0]]);
+ });
+
+ return ast;
+ };
+
+ function validate(node) {
+ return node.type === 'MustacheStatement' && node.path.original === 'link-to' && !node.escaped;
+ }
+});
enifed('ember-template-compiler/system/calculate-location-display', ['exports'], function (exports) {
'use strict';
exports.default = calculateLocationDisplay;
@@ -36409,45 +36487,10 @@
}
return moduleInfo;
}
});
-enifed('ember-template-compiler/system/compile', ['exports', 'ember-metal/core', 'ember-template-compiler/system/compile_options', 'ember-template-compiler/system/template'], function (exports, _emberMetalCore, _emberTemplateCompilerSystemCompile_options, _emberTemplateCompilerSystemTemplate) {
- /**
- @module ember
- @submodule ember-template-compiler
- */
-
- 'use strict';
-
- var compile;
-
- /**
- Uses HTMLBars `compile` function to process a string into a compiled template.
-
- This is not present in production builds.
-
- @private
- @method compile
- @param {String} templateString This is the string to be compiled by HTMLBars.
- @param {Object} options This is an options hash to augment the compiler options.
- */
-
- exports.default = function (templateString, options) {
- if (!compile && _emberMetalCore.default.__loader.registry['htmlbars-compiler/compiler']) {
- compile = requireModule('htmlbars-compiler/compiler').compile;
- }
-
- if (!compile) {
- throw new Error('Cannot call `compile` without the template compiler loaded. Please load `ember-template-compiler.js` prior to calling `compile`.');
- }
-
- var templateSpec = compile(templateString, _emberTemplateCompilerSystemCompile_options.default(options));
-
- return _emberTemplateCompilerSystemTemplate.default(templateSpec);
- };
-});
enifed('ember-template-compiler/system/compile_options', ['exports', 'ember-metal/features', 'ember-metal/assign', 'ember-template-compiler/plugins'], function (exports, _emberMetalFeatures, _emberMetalAssign, _emberTemplateCompilerPlugins) {
/**
@module ember
@submodule ember-template-compiler
*/
@@ -36484,11 +36527,11 @@
options.plugins = plugins;
options.buildMeta = function buildMeta(program) {
return {
topLevel: detectTopLevel(program),
- revision: 'Ember@2.1.0-beta.1',
+ revision: 'Ember@2.1.0-beta.3',
loc: program.loc,
moduleName: options.moduleName
};
};
@@ -36539,10 +36582,45 @@
}
return null;
}
});
+enifed('ember-template-compiler/system/compile', ['exports', 'ember-metal/core', 'ember-template-compiler/system/compile_options', 'ember-template-compiler/system/template'], function (exports, _emberMetalCore, _emberTemplateCompilerSystemCompile_options, _emberTemplateCompilerSystemTemplate) {
+ /**
+ @module ember
+ @submodule ember-template-compiler
+ */
+
+ 'use strict';
+
+ var compile;
+
+ /**
+ Uses HTMLBars `compile` function to process a string into a compiled template.
+
+ This is not present in production builds.
+
+ @private
+ @method compile
+ @param {String} templateString This is the string to be compiled by HTMLBars.
+ @param {Object} options This is an options hash to augment the compiler options.
+ */
+
+ exports.default = function (templateString, options) {
+ if (!compile && _emberMetalCore.default.__loader.registry['htmlbars-compiler/compiler']) {
+ compile = requireModule('htmlbars-compiler/compiler').compile;
+ }
+
+ if (!compile) {
+ throw new Error('Cannot call `compile` without the template compiler loaded. Please load `ember-template-compiler.js` prior to calling `compile`.');
+ }
+
+ var templateSpec = compile(templateString, _emberTemplateCompilerSystemCompile_options.default(options));
+
+ return _emberTemplateCompilerSystemTemplate.default(templateSpec);
+ };
+});
enifed('ember-template-compiler/system/precompile', ['exports', 'ember-metal/core', 'ember-template-compiler/system/compile_options'], function (exports, _emberMetalCore, _emberTemplateCompilerSystemCompile_options) {
/**
@module ember
@submodule ember-template-compiler
*/
@@ -36754,11 +36832,11 @@
initializeShape: _emberMetalEvents.on('init', function () {
this._isDispatchingAttrs = false;
}),
- didReceiveAttrs: function () {
+ _internalDidReceiveAttrs: function () {
this._super();
this._isDispatchingAttrs = true;
this._propagateAttrsToThis();
this._isDispatchingAttrs = false;
},
@@ -36795,12 +36873,12 @@
}
if (this._isDispatchingAttrs) {
return;
}
- if (this.currentState) {
- this.currentState.legacyPropertyDidChange(this, key);
+ if (this._currentState) {
+ this._currentState.legacyPropertyDidChange(this, key);
}
};
exports.default = _emberMetalMixin.Mixin.create(AttrsProxyMixin);
});
@@ -37841,12 +37919,12 @@
transitionTo: function (state) {
this._transitionTo(state);
},
_transitionTo: function (state) {
- var priorState = this.currentState;
- var currentState = this.currentState = this._states[state];
+ var priorState = this._currentState;
+ var currentState = this._currentState = this._states[state];
this._state = state;
if (priorState && priorState.exit) {
priorState.exit(this);
}
@@ -38525,14 +38603,10 @@
if (attrs.classBinding) {
normalizeClasses(attrs.classBinding.split(' '), normalizedClass);
}
- if (attrs.classNames) {
- normalizedClass.push(['value', attrs.classNames]);
- }
-
if (classNames) {
for (i = 0, l = classNames.length; i < l; i++) {
normalizedClass.push(classNames[i]);
}
}
@@ -39616,13 +39690,29 @@
init: function () {
this._super.apply(this, arguments);
_emberMetalProperty_set.set(this, 'controller', this);
_emberMetalProperty_set.set(this, 'context', this);
+
+ if (!this.layout && this.layoutName && this.container) {
+ var layoutName = _emberMetalProperty_get.get(this, 'layoutName');
+
+ this.layout = this.templateForName(layoutName);
+ }
+
+ // If a `defaultLayout` was specified move it to the `layout` prop.
+ // `layout` is no longer a CP, so this just ensures that the `defaultLayout`
+ // logic is supported with a deprecation
+ if (this.defaultLayout && !this.layout) {
+
+ this.layout = this.defaultLayout;
+ }
},
template: null,
+ layoutName: null,
+ layout: null,
/**
If the component is currently inserted into the DOM of a parent view, this
property will point to the controller of the parent view.
@property targetObject
@@ -39822,23 +39912,61 @@
```
@public
@property hasBlockParams
@returns Boolean
*/
+
+ /**
+ Enables components to take a list of parameters as arguments
+ For example a component that takes two parameters with the names
+ `name` and `age`:
+ ```javascript
+ let MyComponent = Ember.Component.extend;
+ MyComponent.reopenClass({
+ positionalParams: ['name', 'age']
+ });
+ ```
+ It can then be invoked like this:
+ ```hbs
+ {{my-component "John" 38}}
+ ```
+ The parameters can be refered to just like named parameters:
+ ```hbs
+ Name: {{attrs.name}}, Age: {{attrs.age}}.
+ ```
+ Using a string instead of an array allows for an arbitrary number of
+ parameters:
+ ```javascript
+ let MyComponent = Ember.Component.extend;
+ MyComponent.reopenClass({
+ positionalParams: 'names'
+ });
+ ```
+ It can then be invoked like this:
+ ```hbs
+ {{my-component "John" "Michael" "Scott"}}
+ ```
+ The parameters can then be refered to by enumerating over the list:
+ ```hbs
+ {{#each attrs.names as |name|}}{{name}}{{/each}}
+ ```
+ @static
+ @public
+ @property positionalParams
+ */
});
Component.reopenClass({
isComponentFactory: true
});
exports.default = Component;
});
-// Ember.assert, Ember.Handlebars
enifed('ember-views/views/container_view', ['exports', 'ember-metal/core', 'ember-runtime/mixins/mutable_array', 'ember-views/views/view', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/mixin', 'ember-metal/events', 'ember-htmlbars/templates/container-view'], function (exports, _emberMetalCore, _emberRuntimeMixinsMutable_array, _emberViewsViewsView, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalMixin, _emberMetalEvents, _emberHtmlbarsTemplatesContainerView) {
'use strict';
- _emberHtmlbarsTemplatesContainerView.default.meta.revision = 'Ember@2.1.0-beta.1';
+ _emberHtmlbarsTemplatesContainerView.default.meta.revision = 'Ember@2.1.0-beta.3';
/**
@module ember
@submodule ember-views
*/
@@ -40180,11 +40308,11 @@
_states: _emberViewsViewsStates.cloneStates(_emberViewsViewsStates.states),
init: function () {
this._super.apply(this, arguments);
this._state = 'preRender';
- this.currentState = this._states.preRender;
+ this._currentState = this._states.preRender;
this._isVisible = _emberMetalProperty_get.get(this, 'isVisible');
// Fallback for legacy cases where the view was created directly
// via `create()` instead of going through the container.
if (!this.renderer) {
@@ -40245,11 +40373,11 @@
destroy: function () {
if (!this._super.apply(this, arguments)) {
return;
}
- this.currentState.cleanup(this);
+ this._currentState.cleanup(this);
// If the destroyingSubtreeForView property is not set but we have an
// associated render node, it means this view is being destroyed from user
// code and not via a change in the templating layer (like an {{if}}
// becoming falsy, for example). In this case, it is our responsibility to
@@ -41120,11 +41248,11 @@
renderNode.ownerNode.emberView.scheduleRevalidate(renderNode, view.toString(), 'rerendering');
},
cleanup: function (view) {
- view.currentState.destroyElement(view);
+ view._currentState.destroyElement(view);
},
// once the view is already in the DOM, destroying it removes it
// from the DOM, nukes its element, and puts it back into the
// preRender state if inDOM.
@@ -41367,11 +41495,11 @@
@public
*/
max: null
});
});
-enifed('ember-views/views/view', ['exports', 'ember-metal/core', 'ember-metal/error', 'ember-metal/property_get', 'ember-metal/run_loop', 'ember-metal/observer', 'ember-metal/utils', 'ember-metal/computed', 'ember-metal/mixin', 'ember-views/system/jquery', 'ember-views/system/ext', 'ember-views/views/core_view', 'ember-views/mixins/view_context_support', 'ember-views/mixins/view_child_views_support', 'ember-views/mixins/view_state_support', 'ember-views/mixins/template_rendering_support', 'ember-views/mixins/class_names_support', 'ember-views/mixins/legacy_view_support', 'ember-views/mixins/instrumentation_support', 'ember-views/mixins/aria_role_support', 'ember-views/mixins/visibility_support', 'ember-views/compat/attrs-proxy'], function (exports, _emberMetalCore, _emberMetalError, _emberMetalProperty_get, _emberMetalRun_loop, _emberMetalObserver, _emberMetalUtils, _emberMetalComputed, _emberMetalMixin, _emberViewsSystemJquery, _emberViewsSystemExt, _emberViewsViewsCore_view, _emberViewsMixinsView_context_support, _emberViewsMixinsView_child_views_support, _emberViewsMixinsView_state_support, _emberViewsMixinsTemplate_rendering_support, _emberViewsMixinsClass_names_support, _emberViewsMixinsLegacy_view_support, _emberViewsMixinsInstrumentation_support, _emberViewsMixinsAria_role_support, _emberViewsMixinsVisibility_support, _emberViewsCompatAttrsProxy) {
+enifed('ember-views/views/view', ['exports', 'ember-metal/core', 'ember-metal/error', 'ember-metal/property_get', 'ember-metal/run_loop', 'ember-metal/observer', 'ember-metal/utils', 'ember-metal/computed', 'ember-metal/mixin', 'ember-views/system/jquery', 'ember-views/system/ext', 'ember-views/views/core_view', 'ember-views/mixins/view_context_support', 'ember-views/mixins/view_child_views_support', 'ember-views/mixins/view_state_support', 'ember-views/mixins/template_rendering_support', 'ember-views/mixins/class_names_support', 'ember-views/mixins/legacy_view_support', 'ember-views/mixins/instrumentation_support', 'ember-views/mixins/aria_role_support', 'ember-views/mixins/visibility_support', 'ember-views/compat/attrs-proxy', 'ember-metal/deprecate_property'], function (exports, _emberMetalCore, _emberMetalError, _emberMetalProperty_get, _emberMetalRun_loop, _emberMetalObserver, _emberMetalUtils, _emberMetalComputed, _emberMetalMixin, _emberViewsSystemJquery, _emberViewsSystemExt, _emberViewsViewsCore_view, _emberViewsMixinsView_context_support, _emberViewsMixinsView_child_views_support, _emberViewsMixinsView_state_support, _emberViewsMixinsTemplate_rendering_support, _emberViewsMixinsClass_names_support, _emberViewsMixinsLegacy_view_support, _emberViewsMixinsInstrumentation_support, _emberViewsMixinsAria_role_support, _emberViewsMixinsVisibility_support, _emberViewsCompatAttrsProxy, _emberMetalDeprecate_property) {
// Ember.assert, Ember.deprecate, Ember.warn, Ember.TEMPLATES,
// jQuery, Ember.lookup,
// Ember.ContainerView circular dependency
// Ember.ENV
'use strict';
@@ -42180,11 +42308,11 @@
be slow.
@method rerender
@public
*/
rerender: function () {
- return this.currentState.rerender(this);
+ return this._currentState.rerender(this);
},
/**
Given a property name, returns a dasherized version of that
property name if the property evaluates to a non-falsy value.
@@ -42220,11 +42348,11 @@
@param {String} [selector] a jQuery-compatible selector string
@return {jQuery} the jQuery object for the DOM node
@public
*/
$: function (sel) {
- return this.currentState.$(this, sel);
+ return this._currentState.$(this, sel);
},
forEachChildView: function (callback) {
var childViews = this.childViews;
@@ -42474,11 +42602,11 @@
@method destroyElement
@return {Ember.View} receiver
@private
*/
destroyElement: function () {
- return this.currentState.destroyElement(this);
+ return this._currentState.destroyElement(this);
},
/**
Called when the element of the view is going to be destroyed. Override
this function to do any teardown that requires an element, like removing
@@ -42674,11 +42802,11 @@
@param eventName {String}
@param evt {Event}
@private
*/
handleEvent: function (eventName, evt) {
- return this.currentState.handleEvent(this, eventName, evt);
+ return this._currentState.handleEvent(this, eventName, evt);
},
/**
Registers the view in the view registry, keyed on the view's `elementId`.
This is used by the EventDispatcher to locate the view in response to
@@ -42722,20 +42850,25 @@
},
_wrapAsScheduled: function (fn) {
var view = this;
var stateCheckedFn = function () {
- view.currentState.invokeObserver(this, fn);
+ view._currentState.invokeObserver(this, fn);
};
var scheduledFn = function () {
_emberMetalRun_loop.default.scheduleOnce('render', this, stateCheckedFn);
};
return scheduledFn;
}
});
// jscs:enable validateIndentation
+ _emberMetalDeprecate_property.deprecateProperty(View.prototype, 'currentState', '_currentState', {
+ id: 'ember-view.current-state',
+ until: '2.3.0'
+ });
+
/*
Describe how the specified actions should behave in the various
states that a view can exist in. Possible states:
* preRender: when a view is first instantiated, and after its
@@ -42938,11 +43071,10 @@
enifed("htmlbars-runtime/hooks", ["exports", "./render", "../morph-range/morph-list", "../htmlbars-util/object-utils", "../htmlbars-util/morph-utils", "../htmlbars-util/template-utils"], function (exports, _render, _morphRangeMorphList, _htmlbarsUtilObjectUtils, _htmlbarsUtilMorphUtils, _htmlbarsUtilTemplateUtils) {
"use strict";
exports.wrap = wrap;
exports.wrapForHelper = wrapForHelper;
- exports.hostYieldWithShadowTemplate = hostYieldWithShadowTemplate;
exports.createScope = createScope;
exports.createFreshScope = createFreshScope;
exports.bindShadowScope = bindShadowScope;
exports.createChildScope = createChildScope;
exports.bindSelf = bindSelf;
@@ -42965,10 +43097,11 @@
exports.element = element;
exports.attribute = attribute;
exports.subexpr = subexpr;
exports.get = get;
exports.getRoot = getRoot;
+ exports.getBlock = getBlock;
exports.getChild = getChild;
exports.getValue = getValue;
exports.getCellOrValue = getCellOrValue;
exports.component = component;
exports.concat = concat;
@@ -43070,23 +43203,20 @@
};
}
function wrapForHelper(template, env, scope, morph, renderState, visitor) {
if (!template) {
- return {
- yieldIn: yieldInShadowTemplate(null, env, scope, morph, renderState, visitor)
- };
+ return {};
}
var yieldArgs = yieldTemplate(template, env, scope, morph, renderState, visitor);
return {
meta: template.meta,
arity: template.arity,
yield: yieldArgs,
yieldItem: yieldItem(template, env, scope, morph, renderState, visitor),
- yieldIn: yieldInShadowTemplate(template, env, scope, morph, renderState, visitor),
raw: template,
render: function (self, blockArguments) {
yieldArgs(blockArguments, self);
}
@@ -43249,59 +43379,10 @@
}
function isStableTemplate(template, lastYielded) {
return !lastYielded.shadowTemplate && template === lastYielded.template;
}
-
- function yieldInShadowTemplate(template, env, parentScope, morph, renderState, visitor) {
- var hostYield = hostYieldWithShadowTemplate(template, env, parentScope, morph, renderState, visitor);
-
- return function (shadowTemplate, self) {
- hostYield(shadowTemplate, env, self, []);
- };
- }
-
- function hostYieldWithShadowTemplate(template, env, parentScope, morph, renderState, visitor) {
- return function (shadowTemplate, env, self, blockArguments) {
- renderState.morphToClear = null;
-
- if (morph.lastYielded && isStableShadowRoot(template, shadowTemplate, morph.lastYielded)) {
- return morph.lastResult.revalidateWith(env, undefined, self, blockArguments, visitor);
- }
-
- var shadowScope = env.hooks.createFreshScope();
- env.hooks.bindShadowScope(env, parentScope, shadowScope, renderState.shadowOptions);
- blockToYield.arity = template.arity;
- env.hooks.bindBlock(env, shadowScope, blockToYield);
-
- morph.lastYielded = { self: self, template: template, shadowTemplate: shadowTemplate };
-
- // Render the shadow template with the block available
- _render.default(shadowTemplate.raw, env, shadowScope, { renderNode: morph, self: self, blockArguments: blockArguments });
- };
-
- function blockToYield(env, blockArguments, self, renderNode, shadowParent, visitor) {
- if (renderNode.lastResult) {
- renderNode.lastResult.revalidateWith(env, undefined, undefined, blockArguments, visitor);
- } else {
- var scope = parentScope;
-
- // Since a yielded template shares a `self` with its original context,
- // we only need to create a new scope if the template has block parameters
- if (template.arity) {
- scope = env.hooks.createChildScope(parentScope);
- }
-
- _render.default(template, env, scope, { renderNode: renderNode, self: self, blockArguments: blockArguments });
- }
- }
- }
-
- function isStableShadowRoot(template, shadowTemplate, lastYielded) {
- return template === lastYielded.template && shadowTemplate === lastYielded.shadowTemplate;
- }
-
function optionsFor(template, inverse, env, scope, morph, visitor) {
// If there was a template yielded last time, set morphToClear so it will be cleared
// if no template is yielded on this render.
var morphToClear = morph.lastResult ? morph : null;
var renderState = new _htmlbarsUtilTemplateUtils.RenderState(morphToClear, morph.morphList || null);
@@ -43810,24 +43891,27 @@
yield: function (morph, env, scope, params, hash, template, inverse, visitor) {
// the current scope is provided purely for the creation of shadow
// scopes; it should not be provided to user code.
var to = env.hooks.getValue(hash.to) || 'default';
- if (scope.blocks[to]) {
- scope.blocks[to](env, params, hash.self, morph, scope, visitor);
+ var block = env.hooks.getBlock(scope, to);
+
+ if (block) {
+ block.invoke(env, params, hash.self, morph, scope, visitor);
}
return true;
},
hasBlock: function (morph, env, scope, params) {
var name = env.hooks.getValue(params[0]) || 'default';
- return !!scope.blocks[name];
+ return !!env.hooks.getBlock(scope, name);
},
hasBlockParams: function (morph, env, scope, params) {
var name = env.hooks.getValue(params[0]) || 'default';
- return !!(scope.blocks[name] && scope.blocks[name].arity);
+ var block = env.hooks.getBlock(scope, name);
+ return !!(block && block.arity);
}
};
exports.keywords = keywords;
@@ -44023,10 +44107,14 @@
} else {
return [undefined];
}
}
+ function getBlock(scope, key) {
+ return scope.blocks[key];
+ }
+
function getChild(value, key) {
return value[key];
}
function getValue(reference) {
@@ -44089,10 +44177,11 @@
component: component,
concat: concat,
createFreshScope: createFreshScope,
getChild: getChild,
getRoot: getRoot,
+ getBlock: getBlock,
getValue: getValue,
getCellOrValue: getCellOrValue,
keywords: keywords,
linkRenderNode: linkRenderNode,
partial: partial,
@@ -44415,15 +44504,10 @@
this.scope = scope;
this.shouldSetContent = shouldSetContent;
this.bindScope();
- if (options.attributes !== undefined) {
- nodes.push({ state: {} });
- this.statements.push(['attributes', attachAttributes(options.attributes)]);
- }
-
if (options.self !== undefined) {
this.bindSelf(options.self);
}
if (options.blockArguments !== undefined) {
this.bindLocals(options.blockArguments);
@@ -44659,12 +44743,10 @@
visitor.element(statement, morph, env, scope, template, visitor);break;
case 'attribute':
visitor.attribute(statement, morph, env, scope);break;
case 'component':
visitor.component(statement, morph, env, scope, template, visitor);break;
- case 'attributes':
- visitor.attributes(statement, morph, env, scope, this.fragment, visitor);break;
}
if (env.hooks.didRenderNode) {
env.hooks.didRenderNode(morph, env, scope);
}
@@ -44963,11 +45045,16 @@
while (current) {
nodes.push(current);
current = current.nextMorph;
}
} else if (node.morphList) {
- nodes.push(node.morphList);
+ var current = node.morphList.firstChildMorph;
+
+ while (current) {
+ nodes.push(current);
+ current = current.nextMorph;
+ }
}
}
}
function validateChildMorphs(env, morph, visitor) {
@@ -45171,47 +45258,57 @@
this.morphToClear = renderNode;
this.shadowOptions = null;
}
- function blockFor(render, template, blockOptions) {
- var block = function (env, blockArguments, self, renderNode, parentScope, visitor) {
- if (renderNode.lastResult) {
- renderNode.lastResult.revalidateWith(env, undefined, self, blockArguments, visitor);
- } else {
+ function Block(render, template, blockOptions) {
+ this.render = render;
+ this.template = template;
+ this.blockOptions = blockOptions;
+ this.arity = template.arity;
+ }
+
+ Block.prototype.invoke = function (env, blockArguments, self, renderNode, parentScope, visitor) {
+ var _this = this;
+
+ if (renderNode.lastResult) {
+ renderNode.lastResult.revalidateWith(env, undefined, self, blockArguments, visitor);
+ } else {
+ (function () {
var options = { renderState: new RenderState(renderNode) };
+ var render = _this.render;
+ var template = _this.template;
+ var scope = _this.blockOptions.scope;
- var scope = blockOptions.scope;
var shadowScope = scope ? env.hooks.createChildScope(scope) : env.hooks.createFreshScope();
- var attributes = blockOptions.attributes;
- env.hooks.bindShadowScope(env, parentScope, shadowScope, blockOptions.options);
+ env.hooks.bindShadowScope(env, parentScope, shadowScope, _this.blockOptions.options);
if (self !== undefined) {
env.hooks.bindSelf(env, shadowScope, self);
- } else if (blockOptions.self !== undefined) {
- env.hooks.bindSelf(env, shadowScope, blockOptions.self);
+ } else if (_this.blockOptions.self !== undefined) {
+ env.hooks.bindSelf(env, shadowScope, _this.blockOptions.self);
}
- bindBlocks(env, shadowScope, blockOptions.yieldTo);
+ bindBlocks(env, shadowScope, _this.blockOptions.yieldTo);
renderAndCleanup(renderNode, env, options, null, function () {
options.renderState.morphToClear = null;
- render(template, env, shadowScope, { renderNode: renderNode, blockArguments: blockArguments, attributes: attributes });
+ render(template, env, shadowScope, { renderNode: renderNode, blockArguments: blockArguments });
});
- }
- };
+ })();
+ }
+ };
- block.arity = template.arity;
-
- return block;
+ function blockFor(render, template, blockOptions) {
+ return new Block(render, template, blockOptions);
}
function bindBlocks(env, shadowScope, blocks) {
if (!blocks) {
return;
}
- if (typeof blocks === 'function') {
+ if (blocks instanceof Block) {
env.hooks.bindBlock(env, shadowScope, blocks);
} else {
for (var name in blocks) {
if (blocks.hasOwnProperty(name)) {
env.hooks.bindBlock(env, shadowScope, blocks[name], name);
\ No newline at end of file