dist/ember.js in ember-source-2.0.3.1 vs dist/ember.js in ember-source-2.1.0.beta.1
- 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.0.3
+ * @version 2.1.0-beta.1
*/
(function() {
var enifed, requireModule, eriuqer, requirejs, Ember;
var mainContext = this;
@@ -65,11 +65,11 @@
var deps = mod.deps;
var callback = mod.callback;
var reified = [];
var length = deps.length;
- for (var i=0; i<length; i++) {
+ for (var i = 0; i < length; i++) {
if (deps[i] === 'exports') {
reified.push(exports);
} else {
reified.push(internalRequire(resolve(deps[i], name), name));
}
@@ -85,11 +85,11 @@
return child;
}
var parts = child.split('/');
var parentBase = name.split('/').slice(0, -1);
- for (var i=0, l=parts.length; i<l; i++) {
+ for (var i = 0, l = parts.length; i < l; i++) {
var part = parts[i];
if (part === '..') {
parentBase.pop();
} else if (part === '.') {
@@ -1182,11 +1182,11 @@
}
exports.Registry = _containerRegistry.default;
exports.Container = _containerContainer.default;
});
-enifed('container/container', ['exports', 'ember-metal/core', 'ember-metal/dictionary'], function (exports, _emberMetalCore, _emberMetalDictionary) {
+enifed('container/container', ['exports', 'ember-metal/core', 'ember-metal/dictionary', 'ember-metal/features'], function (exports, _emberMetalCore, _emberMetalDictionary, _emberMetalFeatures) {
'use strict';
/**
A container used to instantiate and cache objects.
@@ -1199,24 +1199,24 @@
@private
@class Container
*/
function Container(registry, options) {
- this._registry = registry;
+ this.registry = registry;
this.cache = _emberMetalDictionary.default(options && options.cache ? options.cache : null);
this.factoryCache = _emberMetalDictionary.default(options && options.factoryCache ? options.factoryCache : null);
this.validationCache = _emberMetalDictionary.default(options && options.validationCache ? options.validationCache : null);
}
Container.prototype = {
/**
@private
- @property _registry
+ @property registry
@type Registry
@since 1.11.0
*/
- _registry: null,
+ registry: null,
/**
@private
@property cache
@type InheritingDict
@@ -1267,24 +1267,24 @@
@param {String} fullName
@param {Object} options
@return {any}
*/
lookup: function (fullName, options) {
- _emberMetalCore.default.assert('fullName must be a proper full name', this._registry.validateFullName(fullName));
- return lookup(this, this._registry.normalize(fullName), options);
+ _emberMetalCore.default.assert('fullName must be a proper full name', this.registry.validateFullName(fullName));
+ return lookup(this, this.registry.normalize(fullName), options);
},
/**
Given a fullName return the corresponding factory.
@private
@method lookupFactory
@param {String} fullName
@return {any}
*/
lookupFactory: function (fullName) {
- _emberMetalCore.default.assert('fullName must be a proper full name', this._registry.validateFullName(fullName));
- return factoryFor(this, this._registry.normalize(fullName));
+ _emberMetalCore.default.assert('fullName must be a proper full name', this.registry.validateFullName(fullName));
+ return factoryFor(this, this.registry.normalize(fullName));
},
/**
A depth first traversal, destroying the container, its descendant containers and all
their managed objects.
@@ -1307,17 +1307,21 @@
@method reset
@param {String} fullName optional key to reset; if missing, resets everything
*/
reset: function (fullName) {
if (arguments.length > 0) {
- resetMember(this, this._registry.normalize(fullName));
+ resetMember(this, this.registry.normalize(fullName));
} else {
resetCache(this);
}
}
};
+ function isSingleton(container, fullName) {
+ return container.registry.getOption(fullName, 'singleton') !== false;
+ }
+
function lookup(container, fullName, options) {
options = options || {};
if (container.cache[fullName] && options.singleton !== false) {
return container.cache[fullName];
@@ -1327,17 +1331,25 @@
if (value === undefined) {
return;
}
- if (container._registry.getOption(fullName, 'singleton') !== false && options.singleton !== false) {
+ if (isSingleton(container, fullName) && options.singleton !== false) {
container.cache[fullName] = value;
}
return value;
}
+ function markInjectionsAsDynamic(injections) {
+ injections._dynamic = true;
+ }
+
+ function areInjectionsDynamic(injections) {
+ return !!injections._dynamic;
+ }
+
function buildInjections(container) {
var hash = {};
if (arguments.length > 1) {
var injectionArgs = Array.prototype.slice.call(arguments, 1);
@@ -1348,15 +1360,18 @@
if (injectionArgs[i]) {
injections = injections.concat(injectionArgs[i]);
}
}
- container._registry.validateInjections(injections);
+ container.registry.validateInjections(injections);
for (i = 0, l = injections.length; i < l; i++) {
injection = injections[i];
hash[injection.property] = lookup(container, injection.fullName);
+ if (!isSingleton(container, injection.fullName)) {
+ markInjectionsAsDynamic(hash);
+ }
}
}
return hash;
}
@@ -1364,11 +1379,11 @@
function factoryFor(container, fullName) {
var cache = container.factoryCache;
if (cache[fullName]) {
return cache[fullName];
}
- var registry = container._registry;
+ var registry = container.registry;
var factory = registry.resolve(fullName);
if (factory === undefined) {
return;
}
@@ -1383,28 +1398,31 @@
cache[fullName] = factory;
return factory;
} else {
var injections = injectionsFor(container, fullName);
var factoryInjections = factoryInjectionsFor(container, fullName);
+ var cacheable = !areInjectionsDynamic(injections) && !areInjectionsDynamic(factoryInjections);
factoryInjections._toString = registry.makeToString(factory, fullName);
var injectedFactory = factory.extend(injections);
injectedFactory.reopenClass(factoryInjections);
if (factory && typeof factory._onLookup === 'function') {
factory._onLookup(fullName);
}
- cache[fullName] = injectedFactory;
+ if (cacheable) {
+ cache[fullName] = injectedFactory;
+ }
return injectedFactory;
}
}
function injectionsFor(container, fullName) {
- var registry = container._registry;
+ var registry = container.registry;
var splitName = fullName.split(':');
var type = splitName[0];
var injections = buildInjections(container, registry.getTypeInjections(type), registry.getInjections(fullName));
injections._debugContainerKey = fullName;
@@ -1412,11 +1430,11 @@
return injections;
}
function factoryInjectionsFor(container, fullName) {
- var registry = container._registry;
+ var registry = container.registry;
var splitName = fullName.split(':');
var type = splitName[0];
var factoryInjections = buildInjections(container, registry.getFactoryTypeInjections(type), registry.getFactoryInjections(fullName));
factoryInjections._debugContainerKey = fullName;
@@ -1426,11 +1444,11 @@
function instantiate(container, fullName) {
var factory = factoryFor(container, fullName);
var lazyInjections, validationCache;
- if (container._registry.getOption(fullName, 'instantiate') === false) {
+ if (container.registry.getOption(fullName, 'instantiate') === false) {
return factory;
}
if (factory) {
if (typeof factory.create !== 'function') {
@@ -1440,13 +1458,13 @@
validationCache = container.validationCache;
// Ensure that all lazy injections are valid at instantiation time
if (!validationCache[fullName] && typeof factory._lazyInjections === 'function') {
lazyInjections = factory._lazyInjections();
- lazyInjections = container._registry.normalizeInjectionsHash(lazyInjections);
+ lazyInjections = container.registry.normalizeInjectionsHash(lazyInjections);
- container._registry.validateInjections(lazyInjections);
+ container.registry.validateInjections(lazyInjections);
}
validationCache[fullName] = true;
if (typeof factory.extend === 'function') {
@@ -1468,11 +1486,11 @@
for (var i = 0, l = keys.length; i < l; i++) {
key = keys[i];
value = cache[key];
- if (container._registry.getOption(key, 'instantiate') !== false) {
+ if (container.registry.getOption(key, 'instantiate') !== false) {
callback(value);
}
}
}
@@ -1498,14 +1516,16 @@
member.destroy();
}
}
}
+ // Once registry / container reform is enabled, we no longer need to expose
+ // Container#_registry, since Container itself will be fully private.
exports.default = Container;
});
// Ember.assert
-enifed('container/registry', ['exports', 'ember-metal/core', 'ember-metal/dictionary', 'ember-metal/merge', './container'], function (exports, _emberMetalCore, _emberMetalDictionary, _emberMetalMerge, _container) {
+enifed('container/registry', ['exports', 'ember-metal/core', 'ember-metal/dictionary', 'ember-metal/assign', './container'], function (exports, _emberMetalCore, _emberMetalDictionary, _emberMetalAssign, _container) {
'use strict';
var VALID_FULL_NAME_REGEXP = /^[^:]+.+:[^:]+$/;
/**
@@ -1513,12 +1533,11 @@
by type.
A `Registry` stores the factory and option information needed by a
`Container` to instantiate and cache objects.
- The public API for `Registry` is still in flux and should not be considered
- stable.
+ The API for `Registry` is still in flux and should not be considered stable.
@private
@class Registry
@since 1.11.0
*/
@@ -1749,11 +1768,11 @@
normalizeFullName: function (fullName) {
return fullName;
},
/**
- normalize a fullName based on the applications conventions
+ Normalize a fullName based on the application's conventions
@private
@method normalize
@param {String} fullName
@return {string} normalized fullName
*/
@@ -2035,13 +2054,13 @@
fullName: normalizedInjectionName
});
},
/**
+ @private
@method knownForType
@param {String} type the type to iterate over
- @private
*/
knownForType: function (type) {
var fallbackKnown = undefined,
resolverKnown = undefined;
@@ -2062,11 +2081,11 @@
if (this.resolver.knownForType) {
resolverKnown = this.resolver.knownForType(type);
}
- return _emberMetalMerge.assign({}, fallbackKnown, localKnown, resolverKnown);
+ return _emberMetalAssign.default({}, fallbackKnown, localKnown, resolverKnown);
},
validateFullName: function (fullName) {
if (!VALID_FULL_NAME_REGEXP.test(fullName)) {
throw new TypeError('Invalid Fullname, expected: `type:name` got: ' + fullName);
@@ -3380,11 +3399,11 @@
/**
@module ember
@submodule ember-application
*/
-enifed('ember-application/system/application-instance', ['exports', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-runtime/system/object', 'ember-metal/run_loop', 'ember-metal/computed', 'container/registry'], function (exports, _emberMetalProperty_get, _emberMetalProperty_set, _emberRuntimeSystemObject, _emberMetalRun_loop, _emberMetalComputed, _containerRegistry) {
+enifed('ember-application/system/application-instance', ['exports', 'ember-metal', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-runtime/system/object', 'ember-metal/run_loop', 'ember-metal/computed', 'container/registry', 'ember-runtime/mixins/registry_proxy', 'ember-runtime/mixins/container_proxy', 'ember-metal/assign'], function (exports, _emberMetal, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_set, _emberRuntimeSystemObject, _emberMetalRun_loop, _emberMetalComputed, _containerRegistry, _emberRuntimeMixinsRegistry_proxy, _emberRuntimeMixinsContainer_proxy, _emberMetalAssign) {
/**
@module ember
@submodule ember-application
@private
*/
@@ -3412,36 +3431,19 @@
it once the particular test run or FastBoot request has finished.
@public
*/
- exports.default = _emberRuntimeSystemObject.default.extend({
+ var ApplicationInstance = _emberRuntimeSystemObject.default.extend(_emberRuntimeMixinsRegistry_proxy.default, _emberRuntimeMixinsContainer_proxy.default, {
/**
- The application instance's container. The container stores all of the
- instance-specific state for this application run.
- @property {Ember.Container} container
- @public
- */
- container: null,
-
- /**
- The application's registry. The registry contains the classes, templates,
- and other code that makes up the application.
- @property {Ember.Registry} registry
+ The `Application` for which this is an instance.
+ @property {Ember.Application} application
@private
*/
- applicationRegistry: null,
+ application: null,
/**
- The registry for this application instance. It should use the
- `applicationRegistry` as a fallback.
- @property {Ember.Registry} registry
- @private
- */
- registry: null,
-
- /**
The DOM events for which the event dispatcher should listen.
By default, the application's `Ember.EventDispatcher` listens
for a set of standard DOM events, such as `mousedown` and
`keyup`, and delegates them to your application's `Ember.View`
instances.
@@ -3460,34 +3462,40 @@
rootElement: null,
init: function () {
this._super.apply(this, arguments);
+ var application = _emberMetalProperty_get.get(this, 'application');
+
+ _emberMetalProperty_set.set(this, 'rootElement', _emberMetalProperty_get.get(application, 'rootElement'));
+
// Create a per-instance registry that will use the application's registry
// as a fallback for resolving registrations.
- this.registry = new _containerRegistry.default({
- fallback: this.applicationRegistry,
- resolver: this.applicationRegistry.resolver
+ var applicationRegistry = _emberMetalProperty_get.get(application, '__registry__');
+ var registry = this.__registry__ = new _containerRegistry.default({
+ fallback: applicationRegistry
});
- this.registry.normalizeFullName = this.applicationRegistry.normalizeFullName;
- this.registry.makeToString = this.applicationRegistry.makeToString;
+ registry.normalizeFullName = applicationRegistry.normalizeFullName;
+ registry.makeToString = applicationRegistry.makeToString;
// Create a per-instance container from the instance's registry
- this.container = this.registry.container();
+ this.__container__ = registry.container();
// Register this instance in the per-instance registry.
//
// Why do we need to register the instance in the first place?
// 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.registry.register('-application-instance:main', this, { instantiate: false });
+ this.register('-application-instance:main', this, { instantiate: false });
+
+ assignAliases(this);
},
router: _emberMetalComputed.computed(function () {
- return this.container.lookup('router:main');
+ return this.lookup('router:main');
}).readOnly(),
/**
Instantiates and sets up the router, specifically overriding the default
location. This is useful for manually starting the app in FastBoot or
@@ -3525,13 +3533,11 @@
To start the app at a specific URL, call `handleURL` instead.
@private
*/
startRouting: function () {
var router = _emberMetalProperty_get.get(this, 'router');
- var isModuleBasedResolver = !!this.registry.resolver.moduleBasedResolver;
-
- router.startRouting(isModuleBasedResolver);
+ router.startRouting(isResolverModuleBased(this));
this._didSetupRouter = true;
},
/**
@private
@@ -3545,12 +3551,11 @@
return;
}
this._didSetupRouter = true;
var router = _emberMetalProperty_get.get(this, 'router');
- var isModuleBasedResolver = !!this.registry.resolver.moduleBasedResolver;
- router.setupRouter(isModuleBasedResolver);
+ router.setupRouter(isResolverModuleBased(this));
},
/**
Directs the router to route to a particular URL. This is useful in tests,
for example, to tell the app to start at a particular URL. Ensure that you
@@ -3567,28 +3572,53 @@
/**
@private
*/
setupEventDispatcher: function () {
- var dispatcher = this.container.lookup('event_dispatcher:main');
+ var dispatcher = this.lookup('event_dispatcher:main');
var applicationCustomEvents = _emberMetalProperty_get.get(this.application, 'customEvents');
+ var instanceCustomEvents = _emberMetalProperty_get.get(this, 'customEvents');
- dispatcher.setup(applicationCustomEvents, this.rootElement);
+ var customEvents = _emberMetalAssign.default({}, applicationCustomEvents, instanceCustomEvents);
+ dispatcher.setup(customEvents, this.rootElement);
return dispatcher;
},
/**
@private
*/
willDestroy: function () {
this._super.apply(this, arguments);
- _emberMetalRun_loop.default(this.container, 'destroy');
+ _emberMetalRun_loop.default(this.__container__, 'destroy');
}
});
+
+ 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 () {
+ _emberMetal.default.deprecate('Using `ApplicationInstance.container.lookup` is deprecated. Please use `ApplicationInstance.lookup` instead.', false, { id: 'ember-application.app-instance-container', until: '3.0.0' });
+ return instance.lookup.apply(instance, arguments);
+ }
+ };
+ }
+ });
+ }
+
+ exports.default = ApplicationInstance;
});
-enifed('ember-application/system/application', ['exports', 'dag-map', 'container/registry', 'ember-metal', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/property_set', '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-metal/environment'], function (exports, _dagMap, _containerRegistry, _emberMetal, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_set, _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, _emberMetalEnvironment) {
+// 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) {
/**
@module ember
@submodule ember-application
*/
'use strict';
@@ -3672,10 +3702,24 @@
paste: 'paste'
}
});
```
+ To prevent Ember from setting up a listener for a default event,
+ specify the event name with a `null` value in the `customEvents`
+ property:
+
+ ```javascript
+ var App = Ember.Application.create({
+ customEvents: {
+ // prevent listeners for mouseenter/mouseleave events
+ mouseenter: null,
+ mouseleave: null
+ }
+ });
+ ```
+
By default, the application sets up these event listeners on the document
body. However, in cases where you are embedding an Ember application inside
an existing page, you may want it to set up the listeners on an element
inside the body.
@@ -3703,11 +3747,11 @@
```javascript
Ember.Application.initializer({
name: 'api-adapter',
- initialize: function(container, application) {
+ initialize: function(application) {
application.register('api-adapter:main', ApiAdapter);
}
});
```
@@ -3745,11 +3789,11 @@
@namespace Ember
@extends Ember.Namespace
@public
*/
- var Application = _emberRuntimeSystemNamespace.default.extend({
+ var Application = _emberRuntimeSystemNamespace.default.extend(_emberRuntimeMixinsRegistry_proxy.default, {
_suppressDeferredDeprecation: true,
/**
The root DOM element of the Application. This can be specified as an
element or a
@@ -3785,20 +3829,33 @@
`keyup`, and delegates them to your application's `Ember.View`
instances.
If you would like additional bubbling events to be delegated to your
views, set your `Ember.Application`'s `customEvents` property
to a hash containing the DOM event name as the key and the
- corresponding view method name as the value. For example:
+ corresponding view method name as the value. Setting an event to
+ a value of `null` will prevent a default event listener from being
+ added for that event.
+ To add new events to be listened to:
```javascript
var App = Ember.Application.create({
customEvents: {
// add support for the paste event
paste: 'paste'
}
});
```
- @property customEvents
+ To prevent default events from being listened to:
+ ```javascript
+ var App = Ember.Application.create({
+ customEvents: {
+ // remove support for mouseenter / mouseleave events
+ mouseenter: null,
+ mouseleave: null
+ }
+ });
+ ```
+ @property customEvents
@type Object
@default null
@public
*/
customEvents: null,
@@ -3842,11 +3899,11 @@
@private
@method buildRegistry
@return {Ember.Registry} the configured registry
*/
buildRegistry: function () {
- var registry = this.registry = Application.buildRegistry(this);
+ var registry = this.__registry__ = Application.buildRegistry(this);
return registry;
},
/**
@@ -3855,28 +3912,26 @@
@method buildInstance
@return {Ember.Container} the configured container
*/
buildInstance: function () {
return _emberApplicationSystemApplicationInstance.default.create({
- application: this,
- rootElement: _emberMetalProperty_get.get(this, 'rootElement'),
- applicationRegistry: this.registry
+ application: this
});
},
buildDefaultInstance: function () {
var instance = this.buildInstance();
// For the default instance only, set the view registry to the global
// Ember.View.views hash for backwards-compatibility.
- _emberViewsViewsView.default.views = instance.container.lookup('-view-registry:main');
+ _emberViewsViewsView.default.views = instance.lookup('-view-registry:main');
// TODO2.0: Legacy support for App.__container__
// and global methods on App that rely on a single,
// default instance.
this.__deprecatedInstance__ = instance;
- this.__container__ = instance.container;
+ this.__container__ = instance.__container__;
return instance;
},
/**
@@ -3941,106 +3996,22 @@
_emberMetalRun_loop.default.once(this, this.didBecomeReady);
}
},
/**
- Registers a factory that can be used for dependency injection (with
- `App.inject`) or for service lookup. Each factory is registered with
- a full name including two parts: `type:name`.
- A simple example:
- ```javascript
- var App = Ember.Application.create();
- App.Orange = Ember.Object.extend();
- App.register('fruit:favorite', App.Orange);
- ```
- Ember will resolve factories from the `App` namespace automatically.
- For example `App.CarsController` will be discovered and returned if
- an application requests `controller:cars`.
- An example of registering a controller with a non-standard name:
- ```javascript
- var App = Ember.Application.create();
- var Session = Ember.Controller.extend();
- App.register('controller:session', Session);
- // The Session controller can now be treated like a normal controller,
- // despite its non-standard name.
- App.ApplicationController = Ember.Controller.extend({
- needs: ['session']
- });
- ```
- Registered factories are **instantiated** by having `create`
- called on them. Additionally they are **singletons**, each time
- they are looked up they return the same instance.
- Some examples modifying that default behavior:
- ```javascript
- var App = Ember.Application.create();
- App.Person = Ember.Object.extend();
- App.Orange = Ember.Object.extend();
- App.Email = Ember.Object.extend();
- App.session = Ember.Object.create();
- App.register('model:user', App.Person, { singleton: false });
- App.register('fruit:favorite', App.Orange);
- App.register('communication:main', App.Email, { singleton: false });
- App.register('session', App.session, { instantiate: false });
- ```
- @method register
- @param fullName {String} type:name (e.g., 'model:user')
- @param factory {Function} (e.g., App.Person)
- @param options {Object} (optional) disable instantiation or singleton usage
- @public
- **/
- register: function () {
- var _registry;
-
- (_registry = this.registry).register.apply(_registry, arguments);
+ Calling initialize manually is not supported.
+ Please see Ember.Application#advanceReadiness and
+ Ember.Application#deferReadiness.
+ @private
+ @deprecated
+ @method initialize
+ **/
+ initialize: function () {
+ _emberMetal.default.deprecate('Calling initialize manually is not supported. Please see Ember.Application#advanceReadiness and Ember.Application#deferReadiness');
},
/**
- Define a dependency injection onto a specific factory or all factories
- of a type.
- When Ember instantiates a controller, view, or other framework component
- it can attach a dependency to that component. This is often used to
- provide services to a set of framework components.
- An example of providing a session object to all controllers:
- ```javascript
- var App = Ember.Application.create();
- var Session = Ember.Object.extend({ isAuthenticated: false });
- // A factory must be registered before it can be injected
- App.register('session:main', Session);
- // Inject 'session:main' onto all factories of the type 'controller'
- // with the name 'session'
- App.inject('controller', 'session', 'session:main');
- App.IndexController = Ember.Controller.extend({
- isLoggedIn: Ember.computed.alias('session.isAuthenticated')
- });
- ```
- Injections can also be performed on specific factories.
- ```javascript
- App.inject(<full_name or type>, <property name>, <full_name>)
- App.inject('route', 'source', 'source:main')
- App.inject('route:application', 'email', 'model:email')
- ```
- It is important to note that injections can only be performed on
- classes that are instantiated by Ember itself. Instantiating a class
- directly (via `create` or `new`) bypasses the dependency injection
- system.
- **Note:** Ember-Data instantiates its models in a unique manner, and consequently
- injections onto models (or all models) will not work as expected. Injections
- on models can be enabled by setting `Ember.MODEL_FACTORY_INJECTIONS`
- to `true`.
- @method inject
- @param factoryNameOrType {String}
- @param property {String}
- @param injectionName {String}
- @public
- **/
- inject: function () {
- var _registry2;
-
- (_registry2 = this.registry).injection.apply(_registry2, arguments);
- },
-
- /**
Initialize the application. This happens automatically.
Run any initializers and run the application load hook. These hooks may
choose to defer readiness. For example, an authentication hook might want
to defer readiness until the auth token has been retrieved.
@private
@@ -4063,11 +4034,11 @@
var defer = new _emberMetal.default.RSVP.defer();
this._bootPromise = defer.promise;
this._bootResolver = defer;
- this.runInitializers(this.registry);
+ this.runInitializers();
_emberRuntimeSystemLazy_load.runLoadHooks('application', this);
this.advanceReadiness();
return this._bootPromise;
@@ -4152,15 +4123,21 @@
/**
@private
@method runInitializers
*/
- runInitializers: function (registry) {
+ runInitializers: function () {
var App = this;
this._runInitializer('initializers', function (name, initializer) {
_emberMetal.default.assert('No application initializer named \'' + name + '\'', !!initializer);
- initializer.initialize(registry, App);
+ if (initializer.initialize.length === 2) {
+ _emberMetal.default.deprecate('The `initialize` method for Application initializer \'' + name + '\' should take only one argument - `App`, an instance of an `Application`.', false, { id: 'ember-application.app-initializer-initialize-arguments', until: '3.0.0' });
+
+ initializer.initialize(App.__registry__, App);
+ } else {
+ initializer.initialize(App);
+ }
});
},
runInstanceInitializers: function (instance) {
this._runInitializer('instanceInitializers', function (name, initializer) {
@@ -4189,15 +4166,16 @@
@private
@method didBecomeReady
*/
didBecomeReady: function () {
if (this.autoboot) {
+ this.runInstanceInitializers(this.__deprecatedInstance__);
+
if (_emberMetalEnvironment.default.hasDOM) {
this.__deprecatedInstance__.setupEventDispatcher();
}
- this.runInstanceInitializers(this.__deprecatedInstance__);
this.ready(); // user hook
this.__deprecatedInstance__.startRouting();
if (!_emberMetal.default.testing) {
// Eagerly name all classes that are already loaded
@@ -4254,16 +4232,69 @@
this.constructor.initializer(options);
}
});
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
+ after code has loaded and are not allowed to defer readiness.
+ Instance initializer receives an object which has the following attributes:
+ `name`, `before`, `after`, `initialize`. The only required attribute is
+ `initialize`, all others are optional.
+ * `name` allows you to specify under which name the instanceInitializer is
+ registered. This must be a unique name, as trying to register two
+ instanceInitializer with the same name will result in an error.
+ ```javascript
+ Ember.Application.instanceInitializer({
+ name: 'namedinstanceInitializer',
+ initialize: function(application) {
+ Ember.debug('Running namedInitializer!');
+ }
+ });
+ ```
+ * `before` and `after` are used to ensure that this initializer is ran prior
+ or after the one identified by the value. This value can be a single string
+ or an array of strings, referencing the `name` of other initializers.
+ * See Ember.Application.initializer for discussion on the usage of before
+ and after.
+ Example instanceInitializer to preload data into the store.
+ ```javascript
+ Ember.Application.initializer({
+ name: 'preload-data',
+ initialize: function(application) {
+ var userConfig, userConfigEncoded, store;
+ // We have a HTML escaped JSON representation of the user's basic
+ // configuration generated server side and stored in the DOM of the main
+ // index.html file. This allows the app to have access to a set of data
+ // without making any additional remote calls. Good for basic data that is
+ // needed for immediate rendering of the page. Keep in mind, this data,
+ // like all local models and data can be manipulated by the user, so it
+ // should not be relied upon for security or authorization.
+ //
+ // Grab the encoded data from the meta tag
+ userConfigEncoded = Ember.$('head meta[name=app-user-config]').attr('content');
+ // Unescape the text, then parse the resulting JSON into a real object
+ userConfig = JSON.parse(unescape(userConfigEncoded));
+ // Lookup the store
+ store = application.lookup('service:store');
+ // Push the encoded JSON into the store
+ store.pushPayload(userConfig);
+ }
+ });
+ ```
+ @method instanceInitializer
+ @param instanceInitializer
+ @public
+ */
instanceInitializer: buildInitializerMethod('instanceInitializers', 'instance initializer')
});
Application.reopenClass({
- initializers: Object.create(null),
- instanceInitializers: Object.create(null),
+ initializers: new _emberMetalEmpty_object.default(),
+ instanceInitializers: new _emberMetalEmpty_object.default(),
/**
The goal of initializers should be to register dependencies and injections.
This phase runs once. Because these initializers may load code, they are
allowed to defer application readiness and advance it. If you need to access
@@ -4277,11 +4308,11 @@
This must be a unique name, as trying to register two initializers with the
same name will result in an error.
```javascript
Ember.Application.initializer({
name: 'namedInitializer',
- initialize: function(container, application) {
+ initialize: function(application) {
Ember.debug('Running namedInitializer!');
}
});
```
* `before` and `after` are used to ensure that this initializer is ran prior
@@ -4289,11 +4320,11 @@
or an array of strings, referencing the `name` of other initializers.
An example of ordering initializers, we create an initializer named `first`:
```javascript
Ember.Application.initializer({
name: 'first',
- initialize: function(container, application) {
+ initialize: function(application) {
Ember.debug('First initializer!');
}
});
// DEBUG: First initializer!
```
@@ -4301,11 +4332,11 @@
after the initializer named `first`:
```javascript
Ember.Application.initializer({
name: 'second',
after: 'first',
- initialize: function(container, application) {
+ initialize: function(application) {
Ember.debug('Second initializer!');
}
});
// DEBUG: First initializer!
// DEBUG: Second initializer!
@@ -4314,11 +4345,11 @@
that it should run before the initializer named `first`:
```javascript
Ember.Application.initializer({
name: 'pre',
before: 'first',
- initialize: function(container, application) {
+ initialize: function(application) {
Ember.debug('Pre initializer!');
}
});
// DEBUG: Pre initializer!
// DEBUG: First initializer!
@@ -4328,100 +4359,35 @@
both the `first` and the `second` initializers:
```javascript
Ember.Application.initializer({
name: 'post',
after: ['first', 'second'],
- initialize: function(container, application) {
+ initialize: function(application) {
Ember.debug('Post initializer!');
}
});
// DEBUG: Pre initializer!
// DEBUG: First initializer!
// DEBUG: Second initializer!
// DEBUG: Post initializer!
```
- * `initialize` is a callback function that receives two arguments, `container`
- and `application` on which you can operate.
- Example of using `container` to preload data into the store:
- ```javascript
- Ember.Application.initializer({
- name: 'preload-data',
- after: 'ember-data', // ember-data must be loaded before we can access store
- initialize: function(container, application) {
- var store = container.lookup('store:main');
- store.pushPayload(preloadedData);
- }
- });
- ```
+ * `initialize` is a callback function that receives one argument,
+ `application`, on which you can operate.
Example of using `application` to register an adapter:
```javascript
Ember.Application.initializer({
name: 'api-adapter',
- initialize: function(container, application) {
+ initialize: function(application) {
application.register('api-adapter:main', ApiAdapter);
}
});
```
@method initializer
@param initializer {Object}
@public
*/
- /**
- InstanceInitializers run after all initializers have run. Because
- instanceInitializers run after the app is fully set up. We have access
- to the store, container, and other items. However, these initializers run
- after code has loaded and are not allowed to defer readiness.
- InstanceInitializer receives an object which has the following attributes:
- `name`, `before`, `after`, `initialize`. The only required attribute is
- `initialize`, all others are optional.
- * `name` allows you to specify under which name the instanceInitializer is
- registered. This must be a unique name, as trying to register two
- instanceInitializer with the same name will result in an error.
- ```javascript
- Ember.Application.instanceInitializer({
- name: 'namedinstanceInitializer',
- initialize: function(application) {
- Ember.debug('Running namedInitializer!');
- }
- });
- ```
- * `before` and `after` are used to ensure that this initializer is ran prior
- or after the one identified by the value. This value can be a single string
- or an array of strings, referencing the `name` of other initializers.
- * See Ember.Application.initializer for discussion on the usage of before
- and after.
- Example instanceInitializer to preload data into the store.
- ```javascript
- Ember.Application.initializer({
- name: 'preload-data',
- initialize: function(application) {
- var userConfig, userConfigEncoded, store;
- // We have a HTML escaped JSON representation of the user's basic
- // configuration generated server side and stored in the DOM of the main
- // index.html file. This allows the app to have access to a set of data
- // without making any additional remote calls. Good for basic data that is
- // needed for immediate rendering of the page. Keep in mind, this data,
- // like all local models and data can be manipulated by the user, so it
- // should not be relied upon for security or authorization.
- //
- // Grab the encoded data from the meta tag
- userConfigEncoded = Ember.$('head meta[name=app-user-config]').attr('content');
- // Unescape the text, then parse the resulting JSON into a real object
- userConfig = JSON.parse(unescape(userConfigEncoded));
- // Lookup the store
- store = application.container.lookup('service:store');
- // Push the encoded JSON into the store
- store.pushPayload(userConfig);
- }
- });
- ```
- @method instanceInitializer
- @param instanceInitializer
- @public
- */
-
initializer: buildInitializerMethod('initializers', 'initializer'),
/**
This creates a registry with the default Ember naming conventions.
It also configures the registry:
@@ -4465,11 +4431,13 @@
registry.register('renderer:-dom', { create: function () {
return new _emberMetalViewsRenderer.default(new _emberHtmlbarsSystemDomHelper.default());
} });
registry.injection('view', 'renderer', 'renderer:-dom');
- registry.register('view:select', _emberViewsViewsSelect.default);
+ if (_emberMetal.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
+ registry.register('view:select', _emberViewsViewsSelect.default);
+ }
registry.register('view:-outlet', _emberRoutingViewsViewsOutlet.OutletView);
registry.register('-view-registry:main', { create: function () {
return {};
} });
@@ -5134,31 +5102,27 @@
return resolvedType[factoryFlag];
});
}
}
});
-enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/error', 'ember-metal/logger', 'ember-debug/deprecation-manager', 'ember-metal/environment'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalError, _emberMetalLogger, _emberDebugDeprecationManager, _emberMetalEnvironment) {
- /*global __fail__*/
-
+enifed('ember-debug', ['exports', 'ember-metal/core', 'ember-metal/assert', 'ember-metal/features', 'ember-metal/error', 'ember-metal/logger', 'ember-metal/environment', 'ember-debug/deprecate', 'ember-debug/warn', 'ember-debug/is-plain-function'], function (exports, _emberMetalCore, _emberMetalAssert, _emberMetalFeatures, _emberMetalError, _emberMetalLogger, _emberMetalEnvironment, _emberDebugDeprecate, _emberDebugWarn, _emberDebugIsPlainFunction) {
'use strict';
exports._warnIfUsingStrippedFeatureFlags = _warnIfUsingStrippedFeatureFlags;
+ _emberMetalCore.default.deprecate = _emberDebugDeprecate.default;
+
/**
@module ember
@submodule ember-debug
*/
/**
@class Ember
@public
*/
- function isPlainFunction(test) {
- return typeof test === 'function' && test.PrototypeMixin === undefined;
- }
-
/**
Define an assertion that will throw an exception if the condition is not
met. Ember build tools will remove any calls to `Ember.assert()` when
doing a production build. Example:
@@ -5176,44 +5140,25 @@
@param {Boolean|Function} test Must be truthy for the assertion to pass. If
falsy, an exception will be thrown. If this is a function, it will be executed and
its return value will be used as condition.
@public
*/
- _emberMetalCore.default.assert = function (desc, test) {
+ function assert(desc, test) {
var throwAssertion;
- if (isPlainFunction(test)) {
+ if (_emberDebugIsPlainFunction.default(test)) {
throwAssertion = !test();
} else {
throwAssertion = !test;
}
if (throwAssertion) {
throw new _emberMetalError.default('Assertion Failed: ' + desc);
}
- };
+ }
/**
- Display a warning with the provided message. Ember build tools will
- remove any calls to `Ember.warn()` when doing a production build.
-
- @method warn
- @param {String} message A warning to display.
- @param {Boolean} test An optional boolean. If falsy, the warning
- will be displayed.
- @public
- */
- _emberMetalCore.default.warn = function (message, test) {
- if (!test) {
- _emberMetalLogger.default.warn('WARNING: ' + message);
- if ('trace' in _emberMetalLogger.default) {
- _emberMetalLogger.default.trace();
- }
- }
- };
-
- /**
Display a debug notice. Ember build tools will remove any calls to
`Ember.debug()` when doing a production build.
```javascript
Ember.debug('I\'m a debug notice!');
@@ -5221,96 +5166,15 @@
@method debug
@param {String} message A debug message to display.
@public
*/
- _emberMetalCore.default.debug = function (message) {
+ function debug(message) {
_emberMetalLogger.default.debug('DEBUG: ' + message);
- };
+ }
/**
- Display a deprecation warning with the provided message and a stack trace
- (Chrome and Firefox only). Ember build tools will remove any calls to
- `Ember.deprecate()` when doing a production build.
-
- @method deprecate
- @param {String} message A description of the deprecation.
- @param {Boolean|Function} test An optional boolean. If falsy, the deprecation
- will be displayed. If this is a function, it will be executed and its return
- value will be used as condition.
- @param {Object} options An optional object that can be used to pass
- in a `url` to the transition guide on the emberjs.com website, and a unique
- `id` for this deprecation. The `id` can be used by Ember debugging tools
- to change the behavior (raise, log or silence) for that specific deprecation.
- The `id` should be namespaced by dots, e.g. "view.helper.select".
- @public
- */
- _emberMetalCore.default.deprecate = function (message, test, options) {
- if (_emberMetalCore.default.ENV.RAISE_ON_DEPRECATION) {
- _emberDebugDeprecationManager.default.setDefaultLevel(_emberDebugDeprecationManager.deprecationLevels.RAISE);
- }
- if (_emberDebugDeprecationManager.default.getLevel(options && options.id) === _emberDebugDeprecationManager.deprecationLevels.SILENCE) {
- return;
- }
-
- var noDeprecation;
-
- if (isPlainFunction(test)) {
- noDeprecation = test();
- } else {
- noDeprecation = test;
- }
-
- if (noDeprecation) {
- return;
- }
-
- if (options && options.id) {
- message = message + (' [deprecation id: ' + options.id + ']');
- }
-
- if (_emberDebugDeprecationManager.default.getLevel(options && options.id) === _emberDebugDeprecationManager.deprecationLevels.RAISE) {
- throw new _emberMetalError.default(message);
- }
-
- var error;
-
- // When using new Error, we can't do the arguments check for Chrome. Alternatives are welcome
- try {
- __fail__.fail();
- } catch (e) {
- error = e;
- }
-
- if (arguments.length === 3) {
- _emberMetalCore.default.assert('options argument to Ember.deprecate should be an object', options && typeof options === 'object');
- if (options.url) {
- message += ' See ' + options.url + ' for more details.';
- }
- }
-
- if (_emberMetalCore.default.LOG_STACKTRACE_ON_DEPRECATION && error.stack) {
- var stack;
- var stackStr = '';
-
- if (error['arguments']) {
- // Chrome
- stack = error.stack.replace(/^\s+at\s+/gm, '').replace(/^([^\(]+?)([\n$])/gm, '{anonymous}($1)$2').replace(/^Object.<anonymous>\s*\(([^\)]+)\)/gm, '{anonymous}($1)').split('\n');
- stack.shift();
- } else {
- // Firefox
- stack = error.stack.replace(/(?:\n@:0)?\s+$/m, '').replace(/^\(/gm, '{anonymous}(').split('\n');
- }
-
- stackStr = '\n ' + stack.slice(2).join('\n ');
- message = message + stackStr;
- }
-
- _emberMetalLogger.default.warn('DEPRECATION: ' + message);
- };
-
- /**
Alias an old, deprecated method with its new counterpart.
Display a deprecation warning with the provided message and a stack trace
(Chrome and Firefox only) when the assigned method is called.
@@ -5326,11 +5190,11 @@
@param {Object} [options] The options object for Ember.deprecate.
@param {Function} func The new function called to replace its deprecated counterpart.
@return {Function} a new function that wrapped the original function with a deprecation warning
@private
*/
- _emberMetalCore.default.deprecateFunc = function () {
+ function deprecateFunc() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args.length === 3) {
@@ -5361,11 +5225,11 @@
};
})();
if (typeof _ret2 === 'object') return _ret2.v;
}
- };
+ }
/**
Run a function meant for debugging. Ember build tools will remove any calls to
`Ember.runInDebug()` when doing a production build.
@@ -5382,14 +5246,21 @@
@method runInDebug
@param {Function} func The function to be executed.
@since 1.5.0
@public
*/
- _emberMetalCore.default.runInDebug = function (func) {
+ function runInDebug(func) {
func();
- };
+ }
+ _emberMetalAssert.registerDebugFunction('assert', assert);
+ _emberMetalAssert.registerDebugFunction('warn', _emberDebugWarn.default);
+ _emberMetalAssert.registerDebugFunction('debug', debug);
+ _emberMetalAssert.registerDebugFunction('deprecate', _emberDebugDeprecate.default);
+ _emberMetalAssert.registerDebugFunction('deprecateFunc', deprecateFunc);
+ _emberMetalAssert.registerDebugFunction('runInDebug', runInDebug);
+
/**
Will call `Ember.warn()` if ENABLE_ALL_FEATURES, ENABLE_OPTIONAL_FEATURES, or
any specific FEATURES flag is truthy.
This method is called automatically in debug canary builds.
@@ -5399,16 +5270,16 @@
@return {void}
*/
function _warnIfUsingStrippedFeatureFlags(FEATURES, featuresWereStripped) {
if (featuresWereStripped) {
- _emberMetalCore.default.warn('Ember.ENV.ENABLE_ALL_FEATURES is only available in canary builds.', !_emberMetalCore.default.ENV.ENABLE_ALL_FEATURES);
- _emberMetalCore.default.warn('Ember.ENV.ENABLE_OPTIONAL_FEATURES is only available in canary builds.', !_emberMetalCore.default.ENV.ENABLE_OPTIONAL_FEATURES);
+ _emberMetalCore.default.warn('Ember.ENV.ENABLE_ALL_FEATURES is only available in canary builds.', !_emberMetalCore.default.ENV.ENABLE_ALL_FEATURES, { id: 'ember-debug.feature-flag-with-features-stripped' });
+ _emberMetalCore.default.warn('Ember.ENV.ENABLE_OPTIONAL_FEATURES is only available in canary builds.', !_emberMetalCore.default.ENV.ENABLE_OPTIONAL_FEATURES, { id: 'ember-debug.feature-flag-with-features-stripped' });
for (var key in FEATURES) {
if (FEATURES.hasOwnProperty(key) && key !== 'isEnabled') {
- _emberMetalCore.default.warn('FEATURE["' + key + '"] is set as enabled, but FEATURE flags are only available in canary builds.', !FEATURES[key]);
+ _emberMetalCore.default.warn('FEATURE["' + key + '"] is set as enabled, but FEATURE flags are only available in canary builds.', !FEATURES[key], { id: 'ember-debug.feature-flag-with-features-stripped' });
}
}
}
}
@@ -5439,17 +5310,15 @@
}
}, false);
}
}
- _emberMetalCore.default.Debug = {
- _addDeprecationLevel: function (id, level) {
- _emberDebugDeprecationManager.default.setLevel(id, level);
- },
- _deprecationLevels: _emberDebugDeprecationManager.deprecationLevels
- };
+ _emberMetalCore.default.Debug = {};
+ _emberMetalCore.default.Debug.registerDeprecationHandler = _emberDebugDeprecate.registerHandler;
+ _emberMetalCore.default.Debug.registerWarnHandler = _emberDebugWarn.registerHandler;
+
/*
We are transitioning away from `ember.js` to `ember.debug.js` to make
it much clearer that it is only for local development purposes.
This flag value is changed by the tooling (by a simple string replacement)
@@ -5460,38 +5329,219 @@
exports.runningNonEmberDebugJS = runningNonEmberDebugJS;
if (runningNonEmberDebugJS) {
_emberMetalCore.default.warn('Please use `ember.debug.js` instead of `ember.js` for development and debugging.');
}
});
-enifed('ember-debug/deprecation-manager', ['exports', 'ember-metal/dictionary', 'ember-metal/utils'], function (exports, _emberMetalDictionary, _emberMetalUtils) {
+enifed('ember-debug/deprecate', ['exports', 'ember-metal/core', 'ember-metal/error', 'ember-metal/logger', 'ember-debug/handlers'], function (exports, _emberMetalCore, _emberMetalError, _emberMetalLogger, _emberDebugHandlers) {
+ /*global __fail__*/
+
'use strict';
- var deprecationLevels = {
- RAISE: _emberMetalUtils.symbol('RAISE'),
- LOG: _emberMetalUtils.symbol('LOG'),
- SILENCE: _emberMetalUtils.symbol('SILENCE')
- };
+ var _slice = Array.prototype.slice;
+ exports.registerHandler = registerHandler;
+ exports.default = deprecate;
- exports.deprecationLevels = deprecationLevels;
- exports.default = {
- defaultLevel: deprecationLevels.LOG,
- individualLevels: _emberMetalDictionary.default(null),
- setDefaultLevel: function (level) {
- this.defaultLevel = level;
- },
- setLevel: function (id, level) {
- this.individualLevels[id] = level;
- },
- getLevel: function (id) {
- var level = this.individualLevels[id];
- if (!level) {
- level = this.defaultLevel;
+ function registerHandler(handler) {
+ _emberDebugHandlers.registerHandler('deprecate', handler);
+ }
+
+ function formatMessage(_message, options) {
+ var message = _message;
+
+ if (options && options.id) {
+ message = message + (' [deprecation id: ' + options.id + ']');
+ }
+
+ if (options && options.url) {
+ message += ' See ' + options.url + ' for more details.';
+ }
+
+ return message;
+ }
+
+ registerHandler(function logDeprecationToConsole(message, options) {
+ var updatedMessage = formatMessage(message, options);
+
+ _emberMetalLogger.default.warn('DEPRECATION: ' + updatedMessage);
+ });
+
+ registerHandler(function logDeprecationStackTrace(message, options, next) {
+ if (_emberMetalCore.default.LOG_STACKTRACE_ON_DEPRECATION) {
+ var stackStr = '';
+ var error = undefined,
+ stack = undefined;
+
+ // When using new Error, we can't do the arguments check for Chrome. Alternatives are welcome
+ try {
+ __fail__.fail();
+ } catch (e) {
+ error = e;
}
- return level;
+
+ if (error.stack) {
+ if (error['arguments']) {
+ // Chrome
+ stack = error.stack.replace(/^\s+at\s+/gm, '').replace(/^([^\(]+?)([\n$])/gm, '{anonymous}($1)$2').replace(/^Object.<anonymous>\s*\(([^\)]+)\)/gm, '{anonymous}($1)').split('\n');
+ stack.shift();
+ } else {
+ // Firefox
+ stack = error.stack.replace(/(?:\n@:0)?\s+$/m, '').replace(/^\(/gm, '{anonymous}(').split('\n');
+ }
+
+ stackStr = '\n ' + stack.slice(2).join('\n ');
+ }
+
+ var updatedMessage = formatMessage(message, options);
+
+ _emberMetalLogger.default.warn('DEPRECATION: ' + updatedMessage + stackStr);
+ } else {
+ next.apply(undefined, arguments);
}
- };
+ });
+
+ registerHandler(function raiseOnDeprecation(message, options, next) {
+ if (_emberMetalCore.default.ENV.RAISE_ON_DEPRECATION) {
+ var updatedMessage = formatMessage(message);
+
+ throw new _emberMetalError.default(updatedMessage);
+ } else {
+ next.apply(undefined, arguments);
+ }
+ });
+
+ var missingOptionsDeprecation = 'When calling `Ember.deprecate` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include `id` and `until` properties.';
+ exports.missingOptionsDeprecation = missingOptionsDeprecation;
+ var missingOptionsIdDeprecation = 'When calling `Ember.deprecate` you must provide `id` in options.';
+ exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation;
+ var missingOptionsUntilDeprecation = 'When calling `Ember.deprecate` you must provide `until` in options.';
+
+ exports.missingOptionsUntilDeprecation = missingOptionsUntilDeprecation;
+ /**
+ Display a deprecation warning with the provided message and a stack trace
+ (Chrome and Firefox only). Ember build tools will remove any calls to
+ `Ember.deprecate()` when doing a production build.
+
+ @method deprecate
+ @param {String} message A description of the deprecation.
+ @param {Boolean|Function} test A boolean. If falsy, the deprecation
+ will be displayed. If this is a function, it will be executed and its return
+ value will be used as condition.
+ @param {Object} options An object that can be used to pass
+ in a `url` to the transition guide on the emberjs.com website, and a unique
+ `id` for this deprecation. The `id` can be used by Ember debugging tools
+ to change the behavior (raise, log or silence) for that specific deprecation.
+ The `id` should be namespaced by dots, e.g. "view.helper.select".
+ @public
+ */
+
+ function deprecate(message, test, options) {
+ if (!options || !options.id && !options.until) {
+ deprecate(missingOptionsDeprecation, false, { id: 'ember-debug.deprecate-options-missing', until: '3.0.0' });
+ }
+
+ if (options && !options.id) {
+ deprecate(missingOptionsIdDeprecation, false, { id: 'ember-debug.deprecate-id-missing', until: '3.0.0' });
+ }
+
+ if (options && !options.until) {
+ deprecate(missingOptionsUntilDeprecation, options && options.until, { id: 'ember-debug.deprecate-until-missing', until: '3.0.0' });
+ }
+
+ _emberDebugHandlers.invoke.apply(undefined, ['deprecate'].concat(_slice.call(arguments)));
+ }
});
+enifed('ember-debug/handlers', ['exports', 'ember-debug/is-plain-function'], function (exports, _emberDebugIsPlainFunction) {
+ 'use strict';
+
+ exports.registerHandler = registerHandler;
+ exports.invoke = invoke;
+ var HANDLERS = {};
+
+ exports.HANDLERS = HANDLERS;
+ function normalizeTest(test) {
+ return _emberDebugIsPlainFunction.default(test) ? test() : test;
+ }
+
+ function registerHandler(type, callback) {
+ var nextHandler = HANDLERS[type] || function () {};
+
+ HANDLERS[type] = function (message, options) {
+ callback(message, options, nextHandler);
+ };
+ }
+
+ function invoke(type, message, test, options) {
+ if (normalizeTest(test)) {
+ return;
+ }
+
+ var handlerForType = HANDLERS[type];
+
+ if (!handlerForType) {
+ return;
+ }
+
+ if (handlerForType) {
+ handlerForType(message, options);
+ }
+ }
+});
+enifed('ember-debug/is-plain-function', ['exports'], function (exports) {
+ 'use strict';
+
+ exports.default = isPlainFunction;
+
+ function isPlainFunction(test) {
+ return typeof test === 'function' && test.PrototypeMixin === undefined;
+ }
+});
+enifed('ember-debug/warn', ['exports', 'ember-metal/core', 'ember-metal/logger', 'ember-debug/handlers'], function (exports, _emberMetalCore, _emberMetalLogger, _emberDebugHandlers) {
+ 'use strict';
+
+ var _slice = Array.prototype.slice;
+ exports.registerHandler = registerHandler;
+ exports.default = warn;
+
+ function registerHandler(handler) {
+ _emberDebugHandlers.registerHandler('warn', handler);
+ }
+
+ registerHandler(function logWarning(message, options) {
+ _emberMetalLogger.default.warn('WARNING: ' + message);
+ if ('trace' in _emberMetalLogger.default) {
+ _emberMetalLogger.default.trace();
+ }
+ });
+
+ var missingOptionsDeprecation = 'When calling `Ember.warn` you ' + 'must provide an `options` hash as the third parameter. ' + '`options` should include an `id` property.';
+ exports.missingOptionsDeprecation = missingOptionsDeprecation;
+ var missingOptionsIdDeprecation = 'When calling `Ember.warn` you must provide `id` in options.';
+
+ exports.missingOptionsIdDeprecation = missingOptionsIdDeprecation;
+ /**
+ Display a warning with the provided message. Ember build tools will
+ remove any calls to `Ember.warn()` when doing a production build.
+
+ @method warn
+ @param {String} message A warning to display.
+ @param {Boolean} test An optional boolean. If falsy, the warning
+ will be displayed.
+ @public
+ */
+
+ function warn(message, test, options) {
+ if (!options) {
+ _emberMetalCore.default.deprecate(missingOptionsDeprecation, false, { id: 'ember-debug.warn-options-missing', until: '3.0.0' });
+ }
+
+ if (options && !options.id) {
+ _emberMetalCore.default.deprecate(missingOptionsIdDeprecation, false, { id: 'ember-debug.warn-id-missing', until: '3.0.0' });
+ }
+
+ _emberDebugHandlers.invoke.apply(undefined, ['warn'].concat(_slice.call(arguments)));
+ }
+});
enifed('ember-extension-support', ['exports', 'ember-metal/core', 'ember-extension-support/data_adapter', 'ember-extension-support/container_debug_adapter'], function (exports, _emberMetalCore, _emberExtensionSupportData_adapter, _emberExtensionSupportContainer_debug_adapter) {
/**
@module ember
@submodule ember-extension-support
*/
@@ -6102,11 +6152,11 @@
observeRecord: function (record, recordUpdated) {
return function () {};
}
});
});
-enifed('ember-htmlbars', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-template-compiler', 'ember-htmlbars/system/make_bound_helper', 'ember-htmlbars/helpers', 'ember-htmlbars/helpers/if_unless', 'ember-htmlbars/helpers/with', 'ember-htmlbars/helpers/loc', 'ember-htmlbars/helpers/log', 'ember-htmlbars/helpers/each', 'ember-htmlbars/helpers/each-in', 'ember-htmlbars/helpers/-normalize-class', 'ember-htmlbars/helpers/-concat', 'ember-htmlbars/helpers/-join-classes', 'ember-htmlbars/helpers/-legacy-each-with-controller', 'ember-htmlbars/helpers/-legacy-each-with-keyword', 'ember-htmlbars/helpers/-html-safe', 'ember-htmlbars/system/dom-helper', 'ember-htmlbars/helper', 'ember-htmlbars/system/bootstrap', 'ember-htmlbars/compat'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberTemplateCompiler, _emberHtmlbarsSystemMake_bound_helper, _emberHtmlbarsHelpers, _emberHtmlbarsHelpersIf_unless, _emberHtmlbarsHelpersWith, _emberHtmlbarsHelpersLoc, _emberHtmlbarsHelpersLog, _emberHtmlbarsHelpersEach, _emberHtmlbarsHelpersEachIn, _emberHtmlbarsHelpersNormalizeClass, _emberHtmlbarsHelpersConcat, _emberHtmlbarsHelpersJoinClasses, _emberHtmlbarsHelpersLegacyEachWithController, _emberHtmlbarsHelpersLegacyEachWithKeyword, _emberHtmlbarsHelpersHtmlSafe, _emberHtmlbarsSystemDomHelper, _emberHtmlbarsHelper, _emberHtmlbarsSystemBootstrap, _emberHtmlbarsCompat) {
+enifed('ember-htmlbars', ['exports', 'ember-metal/core', 'ember-template-compiler', 'ember-htmlbars/system/make_bound_helper', 'ember-htmlbars/helpers', 'ember-htmlbars/helpers/if_unless', 'ember-htmlbars/helpers/with', 'ember-htmlbars/helpers/loc', 'ember-htmlbars/helpers/log', 'ember-htmlbars/helpers/each', 'ember-htmlbars/helpers/each-in', 'ember-htmlbars/helpers/-normalize-class', 'ember-htmlbars/helpers/-concat', 'ember-htmlbars/helpers/-join-classes', 'ember-htmlbars/helpers/-legacy-each-with-controller', 'ember-htmlbars/helpers/-legacy-each-with-keyword', 'ember-htmlbars/helpers/-html-safe', 'ember-htmlbars/system/dom-helper', 'ember-htmlbars/helper', 'ember-htmlbars/system/bootstrap', 'ember-htmlbars/compat'], function (exports, _emberMetalCore, _emberTemplateCompiler, _emberHtmlbarsSystemMake_bound_helper, _emberHtmlbarsHelpers, _emberHtmlbarsHelpersIf_unless, _emberHtmlbarsHelpersWith, _emberHtmlbarsHelpersLoc, _emberHtmlbarsHelpersLog, _emberHtmlbarsHelpersEach, _emberHtmlbarsHelpersEachIn, _emberHtmlbarsHelpersNormalizeClass, _emberHtmlbarsHelpersConcat, _emberHtmlbarsHelpersJoinClasses, _emberHtmlbarsHelpersLegacyEachWithController, _emberHtmlbarsHelpersLegacyEachWithKeyword, _emberHtmlbarsHelpersHtmlSafe, _emberHtmlbarsSystemDomHelper, _emberHtmlbarsHelper, _emberHtmlbarsSystemBootstrap, _emberHtmlbarsCompat) {
/**
Ember templates are executed by [HTMLBars](https://github.com/tildeio/htmlbars),
an HTML-friendly version of [Handlebars](http://handlebarsjs.com/). Any valid Handlebars syntax is valid in an Ember template.
### Showing a property
@@ -6207,13 +6257,11 @@
_emberHtmlbarsHelpers.registerHelper('unless', _emberHtmlbarsHelpersIf_unless.unlessHelper);
_emberHtmlbarsHelpers.registerHelper('with', _emberHtmlbarsHelpersWith.default);
_emberHtmlbarsHelpers.registerHelper('loc', _emberHtmlbarsHelpersLoc.default);
_emberHtmlbarsHelpers.registerHelper('log', _emberHtmlbarsHelpersLog.default);
_emberHtmlbarsHelpers.registerHelper('each', _emberHtmlbarsHelpersEach.default);
-
_emberHtmlbarsHelpers.registerHelper('each-in', _emberHtmlbarsHelpersEachIn.default);
-
_emberHtmlbarsHelpers.registerHelper('-normalize-class', _emberHtmlbarsHelpersNormalizeClass.default);
_emberHtmlbarsHelpers.registerHelper('concat', _emberHtmlbarsHelpersConcat.default);
_emberHtmlbarsHelpers.registerHelper('-join-classes', _emberHtmlbarsHelpersJoinClasses.default);
_emberHtmlbarsHelpers.registerHelper('-html-safe', _emberHtmlbarsHelpersHtmlSafe.default);
@@ -6250,11 +6298,11 @@
escapeExpression: _emberHtmlbarsUtilsString.escapeExpression
};
exports.default = EmberHandlebars;
});
-enifed('ember-htmlbars/env', ['exports', 'ember-metal', 'ember-metal/features', 'ember-metal/environment', 'htmlbars-runtime', 'ember-metal/merge', 'ember-htmlbars/hooks/subexpr', 'ember-htmlbars/hooks/concat', 'ember-htmlbars/hooks/link-render-node', 'ember-htmlbars/hooks/create-fresh-scope', 'ember-htmlbars/hooks/bind-shadow-scope', 'ember-htmlbars/hooks/bind-self', 'ember-htmlbars/hooks/bind-scope', 'ember-htmlbars/hooks/bind-local', 'ember-htmlbars/hooks/update-self', 'ember-htmlbars/hooks/get-root', 'ember-htmlbars/hooks/get-child', 'ember-htmlbars/hooks/get-value', 'ember-htmlbars/hooks/get-cell-or-value', 'ember-htmlbars/hooks/cleanup-render-node', 'ember-htmlbars/hooks/destroy-render-node', 'ember-htmlbars/hooks/did-render-node', 'ember-htmlbars/hooks/will-cleanup-tree', 'ember-htmlbars/hooks/did-cleanup-tree', 'ember-htmlbars/hooks/classify', 'ember-htmlbars/hooks/component', 'ember-htmlbars/hooks/lookup-helper', 'ember-htmlbars/hooks/has-helper', 'ember-htmlbars/hooks/invoke-helper', 'ember-htmlbars/hooks/element', 'ember-htmlbars/helpers', 'ember-htmlbars/keywords', 'ember-htmlbars/system/dom-helper', 'ember-htmlbars/keywords/debugger', 'ember-htmlbars/keywords/with', 'ember-htmlbars/keywords/outlet', 'ember-htmlbars/keywords/unbound', 'ember-htmlbars/keywords/view', 'ember-htmlbars/keywords/component', 'ember-htmlbars/keywords/partial', 'ember-htmlbars/keywords/input', 'ember-htmlbars/keywords/textarea', 'ember-htmlbars/keywords/collection', 'ember-htmlbars/keywords/legacy-yield', 'ember-htmlbars/keywords/mut', 'ember-htmlbars/keywords/each', 'ember-htmlbars/keywords/readonly', 'ember-htmlbars/keywords/get'], function (exports, _emberMetal, _emberMetalFeatures, _emberMetalEnvironment, _htmlbarsRuntime, _emberMetalMerge, _emberHtmlbarsHooksSubexpr, _emberHtmlbarsHooksConcat, _emberHtmlbarsHooksLinkRenderNode, _emberHtmlbarsHooksCreateFreshScope, _emberHtmlbarsHooksBindShadowScope, _emberHtmlbarsHooksBindSelf, _emberHtmlbarsHooksBindScope, _emberHtmlbarsHooksBindLocal, _emberHtmlbarsHooksUpdateSelf, _emberHtmlbarsHooksGetRoot, _emberHtmlbarsHooksGetChild, _emberHtmlbarsHooksGetValue, _emberHtmlbarsHooksGetCellOrValue, _emberHtmlbarsHooksCleanupRenderNode, _emberHtmlbarsHooksDestroyRenderNode, _emberHtmlbarsHooksDidRenderNode, _emberHtmlbarsHooksWillCleanupTree, _emberHtmlbarsHooksDidCleanupTree, _emberHtmlbarsHooksClassify, _emberHtmlbarsHooksComponent, _emberHtmlbarsHooksLookupHelper, _emberHtmlbarsHooksHasHelper, _emberHtmlbarsHooksInvokeHelper, _emberHtmlbarsHooksElement, _emberHtmlbarsHelpers, _emberHtmlbarsKeywords, _emberHtmlbarsSystemDomHelper, _emberHtmlbarsKeywordsDebugger, _emberHtmlbarsKeywordsWith, _emberHtmlbarsKeywordsOutlet, _emberHtmlbarsKeywordsUnbound, _emberHtmlbarsKeywordsView, _emberHtmlbarsKeywordsComponent, _emberHtmlbarsKeywordsPartial, _emberHtmlbarsKeywordsInput, _emberHtmlbarsKeywordsTextarea, _emberHtmlbarsKeywordsCollection, _emberHtmlbarsKeywordsLegacyYield, _emberHtmlbarsKeywordsMut, _emberHtmlbarsKeywordsEach, _emberHtmlbarsKeywordsReadonly, _emberHtmlbarsKeywordsGet) {
+enifed('ember-htmlbars/env', ['exports', 'ember-metal', 'ember-metal/environment', 'htmlbars-runtime', 'ember-metal/merge', 'ember-htmlbars/hooks/subexpr', 'ember-htmlbars/hooks/concat', 'ember-htmlbars/hooks/link-render-node', 'ember-htmlbars/hooks/create-fresh-scope', 'ember-htmlbars/hooks/bind-shadow-scope', 'ember-htmlbars/hooks/bind-self', 'ember-htmlbars/hooks/bind-scope', 'ember-htmlbars/hooks/bind-local', 'ember-htmlbars/hooks/update-self', 'ember-htmlbars/hooks/get-root', 'ember-htmlbars/hooks/get-child', 'ember-htmlbars/hooks/get-value', 'ember-htmlbars/hooks/get-cell-or-value', 'ember-htmlbars/hooks/cleanup-render-node', 'ember-htmlbars/hooks/destroy-render-node', 'ember-htmlbars/hooks/did-render-node', 'ember-htmlbars/hooks/will-cleanup-tree', 'ember-htmlbars/hooks/did-cleanup-tree', 'ember-htmlbars/hooks/classify', 'ember-htmlbars/hooks/component', 'ember-htmlbars/hooks/lookup-helper', 'ember-htmlbars/hooks/has-helper', 'ember-htmlbars/hooks/invoke-helper', 'ember-htmlbars/hooks/element', 'ember-htmlbars/hooks/attributes', 'ember-htmlbars/helpers', 'ember-htmlbars/keywords', 'ember-htmlbars/system/dom-helper', 'ember-htmlbars/keywords/debugger', 'ember-htmlbars/keywords/with', 'ember-htmlbars/keywords/outlet', 'ember-htmlbars/keywords/unbound', 'ember-htmlbars/keywords/view', 'ember-htmlbars/keywords/component', 'ember-htmlbars/keywords/partial', 'ember-htmlbars/keywords/input', 'ember-htmlbars/keywords/textarea', 'ember-htmlbars/keywords/collection', 'ember-htmlbars/keywords/legacy-yield', 'ember-htmlbars/keywords/mut', 'ember-htmlbars/keywords/each', 'ember-htmlbars/keywords/readonly', 'ember-htmlbars/keywords/get'], function (exports, _emberMetal, _emberMetalEnvironment, _htmlbarsRuntime, _emberMetalMerge, _emberHtmlbarsHooksSubexpr, _emberHtmlbarsHooksConcat, _emberHtmlbarsHooksLinkRenderNode, _emberHtmlbarsHooksCreateFreshScope, _emberHtmlbarsHooksBindShadowScope, _emberHtmlbarsHooksBindSelf, _emberHtmlbarsHooksBindScope, _emberHtmlbarsHooksBindLocal, _emberHtmlbarsHooksUpdateSelf, _emberHtmlbarsHooksGetRoot, _emberHtmlbarsHooksGetChild, _emberHtmlbarsHooksGetValue, _emberHtmlbarsHooksGetCellOrValue, _emberHtmlbarsHooksCleanupRenderNode, _emberHtmlbarsHooksDestroyRenderNode, _emberHtmlbarsHooksDidRenderNode, _emberHtmlbarsHooksWillCleanupTree, _emberHtmlbarsHooksDidCleanupTree, _emberHtmlbarsHooksClassify, _emberHtmlbarsHooksComponent, _emberHtmlbarsHooksLookupHelper, _emberHtmlbarsHooksHasHelper, _emberHtmlbarsHooksInvokeHelper, _emberHtmlbarsHooksElement, _emberHtmlbarsHooksAttributes, _emberHtmlbarsHelpers, _emberHtmlbarsKeywords, _emberHtmlbarsSystemDomHelper, _emberHtmlbarsKeywordsDebugger, _emberHtmlbarsKeywordsWith, _emberHtmlbarsKeywordsOutlet, _emberHtmlbarsKeywordsUnbound, _emberHtmlbarsKeywordsView, _emberHtmlbarsKeywordsComponent, _emberHtmlbarsKeywordsPartial, _emberHtmlbarsKeywordsInput, _emberHtmlbarsKeywordsTextarea, _emberHtmlbarsKeywordsCollection, _emberHtmlbarsKeywordsLegacyYield, _emberHtmlbarsKeywordsMut, _emberHtmlbarsKeywordsEach, _emberHtmlbarsKeywordsReadonly, _emberHtmlbarsKeywordsGet) {
'use strict';
var emberHooks = _emberMetalMerge.default({}, _htmlbarsRuntime.hooks);
emberHooks.keywords = _emberHtmlbarsKeywords.default;
@@ -6280,11 +6328,12 @@
classify: _emberHtmlbarsHooksClassify.default,
component: _emberHtmlbarsHooksComponent.default,
lookupHelper: _emberHtmlbarsHooksLookupHelper.default,
hasHelper: _emberHtmlbarsHooksHasHelper.default,
invokeHelper: _emberHtmlbarsHooksInvokeHelper.default,
- element: _emberHtmlbarsHooksElement.default
+ element: _emberHtmlbarsHooksElement.default,
+ attributes: _emberHtmlbarsHooksAttributes.default
});
_emberHtmlbarsKeywords.registerKeyword('debugger', _emberHtmlbarsKeywordsDebugger.default);
_emberHtmlbarsKeywords.registerKeyword('with', _emberHtmlbarsKeywordsWith.default);
_emberHtmlbarsKeywords.registerKeyword('outlet', _emberHtmlbarsKeywordsOutlet.default);
@@ -6296,17 +6345,17 @@
_emberHtmlbarsKeywords.registerKeyword('legacy-yield', _emberHtmlbarsKeywordsLegacyYield.default);
_emberHtmlbarsKeywords.registerKeyword('mut', _emberHtmlbarsKeywordsMut.default);
_emberHtmlbarsKeywords.registerKeyword('@mut', _emberHtmlbarsKeywordsMut.privateMut);
_emberHtmlbarsKeywords.registerKeyword('each', _emberHtmlbarsKeywordsEach.default);
_emberHtmlbarsKeywords.registerKeyword('readonly', _emberHtmlbarsKeywordsReadonly.default);
+ _emberHtmlbarsKeywords.registerKeyword('get', _emberHtmlbarsKeywordsGet.default);
if (_emberMetal.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
_emberHtmlbarsKeywords.registerKeyword('collection', _emberHtmlbarsKeywordsCollection.default);
_emberHtmlbarsKeywords.registerKeyword('view', _emberHtmlbarsKeywordsView.default);
}
- _emberHtmlbarsKeywords.registerKeyword('get', _emberHtmlbarsKeywordsGet.default);
exports.default = {
hooks: emberHooks,
helpers: _emberHtmlbarsHelpers.default,
useFragmentCache: true
};
@@ -6431,25 +6480,26 @@
};
}
exports.default = Helper;
});
-enifed("ember-htmlbars/helpers", ["exports"], function (exports) {
+enifed('ember-htmlbars/helpers', ['exports', 'ember-metal/empty_object'], function (exports, _emberMetalEmpty_object) {
/**
@module ember
@submodule ember-htmlbars
*/
/**
@private
@property helpers
*/
- "use strict";
+ 'use strict';
exports.registerHelper = registerHelper;
- var helpers = Object.create(null);
+ var helpers = new _emberMetalEmpty_object.default();
+
/**
@module ember
@submodule ember-htmlbars
*/
@@ -6528,10 +6578,11 @@
function joinClasses(classNames) {
var result = [];
for (var i = 0, l = classNames.length; i < l; i++) {
var className = classNames[i];
+
if (className) {
result.push(className);
}
}
@@ -6606,13 +6657,13 @@
}
function bindKeyword(self, keyword, item) {
var _ref;
- return _ref = {
+ return (_ref = {
self: self
- }, _ref[keyword] = item, _ref;
+ }, _ref[keyword] = item, _ref);
}
var deprecation = 'Using the context switching form of {{each}} is deprecated. Please use the keyword form (`{{#each items as |item|}}`) instead.';
exports.deprecation = deprecation;
});
@@ -6667,11 +6718,11 @@
} else {
return null;
}
}
});
-enifed('ember-htmlbars/helpers/each-in', ['exports', 'ember-metal/features', 'ember-views/streams/should_display'], function (exports, _emberMetalFeatures, _emberViewsStreamsShould_display) {
+enifed('ember-htmlbars/helpers/each-in', ['exports', 'ember-views/streams/should_display'], function (exports, _emberViewsStreamsShould_display) {
/**
@module ember
@submodule ember-templates
*/
@@ -6679,28 +6730,34 @@
/**
The `{{each-in}}` helper loops over properties on an object. It is unbound,
in that new (or removed) properties added to the target object will not be
rendered.
- For example, given a `user` object that looks like:
- ```javascript
+
+ For example, given a `user` object that looks like:
+
+ ```javascript
{
"name": "Shelly Sails",
"age": 42
}
```
- This template would display all properties on the `user`
+
+ This template would display all properties on the `user`
object in a list:
- ```handlebars
+
+ ```handlebars
<ul>
{{#each-in user as |key value|}}
<li>{{key}}: {{value}}</li>
{{/each-in}}
</ul>
```
- Outputting their name and age.
- @method each-in
+
+ Outputting their name and age.
+
+ @method each-in
@for Ember.Templates.helpers
@public
*/
var eachInHelper = function (_ref, hash, blocks) {
var object = _ref[0];
@@ -6714,10 +6771,11 @@
}
} else if (blocks.inverse.yield) {
blocks.inverse.yield();
}
};
+
exports.default = eachInHelper;
});
enifed('ember-htmlbars/helpers/each', ['exports', 'ember-views/streams/should_display', 'ember-htmlbars/utils/decode-each-key'], function (exports, _emberViewsStreamsShould_display, _emberHtmlbarsUtilsDecodeEachKey) {
/**
@module ember
@@ -6823,11 +6881,11 @@
'use strict';
/**
Use the `if` block helper to conditionally render a block depending on a
- property. If the property is "falsey", for example: `false`, `undefined
+ property. If the property is "falsey", for example: `false`, `undefined`,
`null`, `""`, `0` or an empty array, the block will not be rendered.
```handlebars
{{! will not render if foo is falsey}}
{{#if foo}}
@@ -7044,10 +7102,70 @@
} else if (options.inverse && options.inverse.yield) {
options.inverse.yield([]);
}
}
});
+enifed('ember-htmlbars/hooks/attributes', ['exports', 'htmlbars-runtime'], function (exports, _htmlbarsRuntime) {
+ 'use strict';
+
+ exports.default = attributes;
+
+ function attributes(morph, env, scope, template, parentNode, visitor) {
+ var state = morph.state;
+ var block = state.block;
+
+ if (!block) {
+ var element = findRootElement(parentNode);
+ if (!element) {
+ return;
+ }
+
+ normalizeClassStatement(template.statements, element);
+
+ template.element = element;
+ block = morph.state.block = _htmlbarsRuntime.internal.blockFor(_htmlbarsRuntime.render, template, { scope: scope });
+ }
+
+ block(env, [], undefined, morph, undefined, visitor);
+ }
+
+ function normalizeClassStatement(statements, element) {
+ var className = element.getAttribute('class');
+ if (!className) {
+ return;
+ }
+
+ for (var i = 0, l = statements.length; i < l; i++) {
+ var statement = statements[i];
+
+ if (statement[1] === 'class') {
+ statement[2][2].unshift(className);
+ }
+ }
+ }
+
+ function findRootElement(parentNode) {
+ var node = parentNode.firstChild;
+ var found = null;
+
+ while (node) {
+ if (node.nodeType === 1) {
+ // found more than one top-level element, so there is no "root element"
+ if (found) {
+ return null;
+ }
+ found = node;
+ }
+ node = node.nextSibling;
+ }
+
+ var className = found && found.getAttribute('class');
+ if (!className || className.split(' ').indexOf('ember-view') === -1) {
+ return found;
+ }
+ }
+});
enifed('ember-htmlbars/hooks/bind-local', ['exports', 'ember-metal/streams/stream', 'ember-metal/streams/proxy-stream'], function (exports, _emberMetalStreamsStream, _emberMetalStreamsProxyStream) {
/**
@module ember
@submodule ember-htmlbars
*/
@@ -7209,11 +7327,11 @@
if (renderNode.cleanup) {
renderNode.cleanup();
}
}
});
-enifed('ember-htmlbars/hooks/component', ['exports', 'ember-htmlbars/node-managers/component-node-manager'], function (exports, _emberHtmlbarsNodeManagersComponentNodeManager) {
+enifed('ember-htmlbars/hooks/component', ['exports', 'ember-htmlbars/node-managers/component-node-manager', 'ember-views/system/build-component-template'], function (exports, _emberHtmlbarsNodeManagersComponentNodeManager, _emberViewsSystemBuildComponentTemplate) {
'use strict';
exports.default = componentHook;
function componentHook(renderNode, env, scope, _tagName, params, attrs, templates, visitor) {
@@ -7225,31 +7343,54 @@
return;
}
var tagName = _tagName;
var isAngleBracket = false;
+ var isTopLevel = undefined;
- if (tagName.charAt(0) === '<') {
- tagName = tagName.slice(1, -1);
+ var angles = tagName.match(/^(@?)<(.*)>$/);
+
+ if (angles) {
+ tagName = angles[2];
isAngleBracket = true;
+ isTopLevel = !!angles[1];
}
var parentView = env.view;
- var manager = _emberHtmlbarsNodeManagersComponentNodeManager.default.create(renderNode, env, {
- tagName: tagName,
- params: params,
- attrs: attrs,
- parentView: parentView,
- templates: templates,
- isAngleBracket: isAngleBracket,
- parentScope: scope
- });
+ if (!isTopLevel || tagName !== env.view.tagName) {
+ var manager = _emberHtmlbarsNodeManagersComponentNodeManager.default.create(renderNode, env, {
+ tagName: tagName,
+ params: params,
+ attrs: attrs,
+ parentView: parentView,
+ templates: templates,
+ isAngleBracket: isAngleBracket,
+ isTopLevel: isTopLevel,
+ parentScope: scope
+ });
- state.manager = manager;
+ state.manager = manager;
+ manager.render(env, visitor);
+ } else {
+ var component = env.view;
+ var templateOptions = {
+ component: component,
+ isAngleBracket: true,
+ isComponentElement: true,
+ outerAttrs: scope.attrs,
+ parentScope: scope
+ };
- manager.render(env, visitor);
+ var contentOptions = { templates: templates, scope: scope };
+
+ var _buildComponentTemplate = _emberViewsSystemBuildComponentTemplate.default(templateOptions, attrs, contentOptions);
+
+ var block = _buildComponentTemplate.block;
+
+ block(env, [], undefined, renderNode, scope, visitor);
+ }
}
});
enifed('ember-htmlbars/hooks/concat', ['exports', 'ember-metal/streams/utils'], function (exports, _emberMetalStreamsUtils) {
/**
@module ember
@@ -7505,11 +7646,11 @@
}
var container = env.container;
if (_emberHtmlbarsSystemLookupHelper.validateLazyHelperName(helperName, container, env.hooks.keywords, env.knownHelpers)) {
var containerName = 'helper:' + helperName;
- if (container._registry.has(containerName)) {
+ if (container.registry.has(containerName)) {
return true;
}
}
return false;
@@ -7519,11 +7660,10 @@
'use strict';
exports.default = invokeHelper;
function invokeHelper(morph, env, scope, visitor, params, hash, helper, templates, context) {
-
if (helper.isLegacyViewHelper) {
_emberMetalCore.default.assert('You can only pass attributes (such as name=value) not bare ' + 'values to a helper for a View found in \'' + helper.viewClass + '\'', params.length === 0);
env.hooks.keyword('view', morph, env, scope, [helper.viewClass], hash, templates.template.raw, null, visitor);
// Opts into a special mode for view helpers
@@ -7532,11 +7672,10 @@
var helperStream = _emberHtmlbarsSystemInvokeHelper.buildHelperStream(helper, params, hash, templates, env, scope);
// Ember.Helper helpers are pure values, thus linkable
if (helperStream.linkable) {
-
if (morph) {
// When processing an inline expression the params and hash have already
// been linked. Thus, HTMLBars will not link the returned helperStream.
// We subscribe the morph to the helperStream here, and also subscribe
// the helperStream to any params.
@@ -7672,10 +7811,11 @@
*/
'use strict';
exports.default = subexpr;
+ exports.labelForSubexpr = labelForSubexpr;
function subexpr(env, scope, helperName, params, hash) {
// TODO: Keywords and helper invocation should be integrated into
// the subexpr hook upstream in HTMLBars.
var keyword = env.hooks.keywords[helperName];
@@ -7832,11 +7972,11 @@
keywords[name] = keyword;
}
exports.default = keywords;
});
-enifed('ember-htmlbars/keywords/collection', ['exports', 'ember-views/streams/utils', 'ember-views/views/collection_view', 'ember-htmlbars/node-managers/view-node-manager', 'ember-metal/merge'], function (exports, _emberViewsStreamsUtils, _emberViewsViewsCollection_view, _emberHtmlbarsNodeManagersViewNodeManager, _emberMetalMerge) {
+enifed('ember-htmlbars/keywords/collection', ['exports', 'ember-views/streams/utils', 'ember-views/views/collection_view', 'ember-htmlbars/node-managers/view-node-manager', 'ember-metal/assign'], function (exports, _emberViewsStreamsUtils, _emberViewsViewsCollection_view, _emberHtmlbarsNodeManagersViewNodeManager, _emberMetalAssign) {
/**
@module ember
@submodule ember-templates
*/
@@ -7968,11 +8108,11 @@
*/
exports.default = {
setupState: function (state, env, scope, params, hash) {
var read = env.hooks.getValue;
- return _emberMetalMerge.assign({}, state, {
+ return _emberMetalAssign.default({}, state, {
parentView: env.view,
viewClassOrInstance: getView(read(params[0]), env.container)
});
},
@@ -8022,11 +8162,11 @@
}
return viewClassOrInstance;
}
});
-enifed('ember-htmlbars/keywords/component', ['exports', 'ember-metal/merge'], function (exports, _emberMetalMerge) {
+enifed('ember-htmlbars/keywords/component', ['exports', 'ember-metal/assign'], function (exports, _emberMetalAssign) {
/**
@module ember
@submodule ember-templates
@public
*/
@@ -8080,11 +8220,11 @@
@public
*/
exports.default = {
setupState: function (lastState, env, scope, params, hash) {
var componentPath = env.hooks.getValue(params[0]);
- return _emberMetalMerge.assign({}, lastState, { componentPath: componentPath, isComponentHelper: true });
+ return _emberMetalAssign.default({}, lastState, { componentPath: componentPath, isComponentHelper: true });
},
render: function (morph) {
if (morph.state.manager) {
morph.state.manager.destroy();
@@ -8216,11 +8356,11 @@
}
return false;
}
});
-enifed('ember-htmlbars/keywords/get', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/streams/stream', 'ember-metal/streams/key-stream', 'ember-metal/streams/utils', 'ember-metal/merge', 'ember-htmlbars/utils/subscribe', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/observer'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalStreamsStream, _emberMetalStreamsKeyStream, _emberMetalStreamsUtils, _emberMetalMerge, _emberHtmlbarsUtilsSubscribe, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalObserver) {
+enifed('ember-htmlbars/keywords/get', ['exports', 'ember-metal/core', 'ember-metal/streams/stream', 'ember-metal/streams/key-stream', 'ember-metal/streams/utils', 'ember-metal/merge', 'ember-htmlbars/utils/subscribe', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/observer'], function (exports, _emberMetalCore, _emberMetalStreamsStream, _emberMetalStreamsKeyStream, _emberMetalStreamsUtils, _emberMetalMerge, _emberHtmlbarsUtilsSubscribe, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalObserver) {
/**
@module ember
@submodule ember-templates
*/
@@ -8245,36 +8385,46 @@
};
/**
Dynamically look up a property on an object. The second argument to `{{get}}`
should have a string value, although it can be bound.
- For example, these two usages are equivilent:
- ```handlebars
+
+ For example, these two usages are equivilent:
+
+ ```handlebars
{{person.height}}
{{get person "height"}}
```
- If there were several facts about a person, the `{{get}}` helper can dynamically
+
+ If there were several facts about a person, the `{{get}}` helper can dynamically
pick one:
- ```handlebars
+
+ ```handlebars
{{get person factName}}
```
- For a more complex example, this template would allow the user to switch
+
+ For a more complex example, this template would allow the user to switch
between showing the user's height and weight with a click:
- ```handlebars
+
+ ```handlebars
{{get person factName}}
<button {{action (mut factName) "height"}}>Show height</button>
<button {{action (mut factName) "weight"}}>Show weight</button>
```
- The `{{get}}` helper can also respect mutable values itself. For example:
- ```handlebars
+
+ The `{{get}}` helper can also respect mutable values itself. For example:
+
+ ```handlebars
{{input value=(mut (get person factName)) type="text"}}
<button {{action (mut factName) "height"}}>Show height</button>
<button {{action (mut factName) "weight"}}>Show weight</button>
```
- Would allow the user to swap what fact is being displayed, and also edit
+
+ Would allow the user to swap what fact is being displayed, and also edit
that fact via a two-way mutable binding.
- @public
+
+ @public
@method get
@for Ember.Templates.helpers
*/
var getKeyword = function getKeyword(morph, env, scope, params, hash, template, inverse, visitor) {
if (morph === null) {
@@ -8368,11 +8518,11 @@
}
});
exports.default = getKeyword;
});
-enifed('ember-htmlbars/keywords/input', ['exports', 'ember-metal/core', 'ember-metal/merge'], function (exports, _emberMetalCore, _emberMetalMerge) {
+enifed('ember-htmlbars/keywords/input', ['exports', 'ember-metal/core', 'ember-metal/assign'], function (exports, _emberMetalCore, _emberMetalAssign) {
/**
@module ember
@submodule ember-templates
*/
'use strict';
@@ -8450,11 +8600,11 @@
For example, if you desire an action to be sent when the input is blurred,
you only need to setup the action name to the event name property.
```handlebars
- {{input focus-in="alertMessage"}}
+ {{input focus-out="alertMessage"}}
```
See more about [Text Support Actions](/api/classes/Ember.TextField.html)
@@ -8528,11 +8678,11 @@
var type = env.hooks.getValue(hash.type);
var componentName = componentNameMap[type] || defaultComponentName;
_emberMetalCore.default.assert('{{input type=\'checkbox\'}} does not support setting `value=someBooleanValue`;' + ' you must use `checked=someBooleanValue` instead.', !(type === 'checkbox' && hash.hasOwnProperty('value')));
- return _emberMetalMerge.assign({}, lastState, { componentName: componentName });
+ return _emberMetalAssign.default({}, lastState, { componentName: componentName });
},
render: function (morph, env, scope, params, hash, template, inverse, visitor) {
env.hooks.component(morph, env, scope, morph.state.componentName, params, hash, { default: template, inverse: inverse }, visitor);
},
@@ -8699,19 +8849,19 @@
}
}, _merge[_emberRoutingHtmlbarsKeywordsClosureAction.INVOKE] = function (val) {
this.setValue(val);
}, _merge));
});
-enifed('ember-htmlbars/keywords/outlet', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-htmlbars/node-managers/view-node-manager', 'ember-htmlbars/templates/top-level-view'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberHtmlbarsNodeManagersViewNodeManager, _emberHtmlbarsTemplatesTopLevelView) {
+enifed('ember-htmlbars/keywords/outlet', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-htmlbars/node-managers/view-node-manager', 'ember-htmlbars/templates/top-level-view', 'ember-metal/features'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberHtmlbarsNodeManagersViewNodeManager, _emberHtmlbarsTemplatesTopLevelView, _emberMetalFeatures) {
/**
@module ember
@submodule ember-templates
*/
'use strict';
- _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.0.3';
+ _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.1.0-beta.1';
/**
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:
@@ -8814,30 +8964,41 @@
if (!state.hasParentOutlet && !ViewClass) {
ViewClass = env.container.lookupFactory('view:toplevel');
}
- var options = {
- component: ViewClass,
- self: toRender.controller,
- createOptions: {
- controller: toRender.controller
- }
- };
+ var Component;
- template = template || toRender.template && toRender.template.raw;
+ var options;
+ var attrs = {};
+ if (Component) {
+ options = {
+ component: Component
+ };
+ attrs = toRender.attrs;
+ } else {
+ options = {
+ component: ViewClass,
+ self: toRender.controller,
+ createOptions: {
+ controller: toRender.controller
+ }
+ };
- if (LOG_VIEW_LOOKUPS && ViewClass) {
- _emberMetalCore.default.Logger.info('Rendering ' + toRender.name + ' with ' + ViewClass, { fullName: 'view:' + toRender.name });
+ template = template || toRender.template && toRender.template.raw;
+
+ if (LOG_VIEW_LOOKUPS && ViewClass) {
+ _emberMetalCore.default.Logger.info('Rendering ' + toRender.name + ' with ' + ViewClass, { fullName: 'view:' + toRender.name });
+ }
}
if (state.manager) {
state.manager.destroy();
state.manager = null;
}
- var nodeManager = _emberHtmlbarsNodeManagersViewNodeManager.default.create(renderNode, env, {}, options, parentView, null, null, template);
+ var nodeManager = _emberHtmlbarsNodeManagersViewNodeManager.default.create(renderNode, env, attrs, options, parentView, null, null, template);
state.manager = nodeManager;
nodeManager.render(env, hash, visitor);
}
};
@@ -9638,10 +9799,11 @@
parentView.removeChild(view);
}
}
var toDestroy = this.emberToDestroy;
+
if (toDestroy) {
for (var i = 0, l = toDestroy.length; i < l; i++) {
toDestroy[i].destroy();
}
@@ -9653,11 +9815,11 @@
env.renderedNodes[this.guid] = true;
};
exports.default = EmberMorph;
});
-enifed('ember-htmlbars/node-managers/component-node-manager', ['exports', 'ember-metal/core', 'ember-metal/merge', '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, _emberMetalMerge, _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-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) {
'use strict';
exports.createComponent = createComponent;
function ComponentNodeManager(component, isAngleBracket, scope, renderNode, attrs, block, expectElement) {
@@ -9800,14 +9962,18 @@
this.block(env, [], undefined, this.renderNode, this.scope, visitor);
}
var element = this.expectElement && this.renderNode.firstNode;
- env.renderer.didCreateElement(component, element);
- env.renderer.willInsertElement(component, element); // 2.0TODO remove legacy hook
+ // 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.lifecycleHooks.push({ type: 'didInsertElement', view: component });
+ env.lifecycleHooks.push({ type: 'didInsertElement', view: component });
+ }
}, this);
};
ComponentNodeManager.prototype.rerender = function (_env, attrs, visitor) {
var component = this.component;
@@ -9854,11 +10020,11 @@
};
function createComponent(_component, isAngleBracket, _props, renderNode, env) {
var attrs = arguments.length <= 5 || arguments[5] === undefined ? {} : arguments[5];
- var props = _emberMetalMerge.assign({}, _props);
+ var props = _emberMetalAssign.default({}, _props);
if (!isAngleBracket) {
var proto = _component.proto();
_emberMetalCore.default.assert('controller= is no longer supported', !('controller' in attrs));
@@ -10030,11 +10196,10 @@
ViewNodeManager.prototype.render = function (env, attrs, visitor) {
var component = this.component;
return _emberHtmlbarsSystemInstrumentationSupport.instrument(component, function () {
-
var newEnv = env;
if (component) {
newEnv = env.childWithView(component);
}
@@ -10048,13 +10213,17 @@
}
if (component) {
var element = this.expectElement && this.renderNode.firstNode;
- env.renderer.didCreateElement(component, element); // 2.0TODO: Remove legacy hooks.
- env.renderer.willInsertElement(component, element);
- env.lifecycleHooks.push({ type: 'didInsertElement', view: component });
+ // 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.willInsertElement(component, element);
+ env.lifecycleHooks.push({ type: 'didInsertElement', view: component });
+ }
}
}, this);
};
ViewNodeManager.prototype.rerender = function (env, attrs, visitor) {
@@ -10297,19 +10466,21 @@
// are pure functions that can only work with values.
function getArrayValues(params) {
var l = params.length;
var out = new Array(l);
+
for (var i = 0; i < l; i++) {
out[i] = _emberHtmlbarsHooksGetValue.default(params[i]);
}
return out;
}
function getHashValues(hash) {
var out = {};
+
for (var prop in hash) {
out[prop] = _emberHtmlbarsHooksGetValue.default(hash[prop]);
}
return out;
@@ -10421,11 +10592,11 @@
function _bootstrap() {
bootstrap(_emberViewsSystemJquery.default(document));
}
function registerComponentLookup(app) {
- app.registry.register('component-lookup:main', _emberViewsComponent_lookup.default);
+ app.register('component-lookup:main', _emberViewsComponent_lookup.default);
}
/*
We tie this to application.load to ensure that we've at least
attempted to bootstrap at the point that the application is loaded.
@@ -10449,17 +10620,17 @@
});
});
exports.default = bootstrap;
});
-enifed('ember-htmlbars/system/discover-known-helpers', ['exports', 'ember-metal/features', 'ember-metal/dictionary'], function (exports, _emberMetalFeatures, _emberMetalDictionary) {
+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 registry = container && container.registry;
var helpers = _emberMetalDictionary.default(null);
if (!registry) {
return helpers;
}
@@ -10538,12 +10709,12 @@
'use strict';
exports.buildHelperStream = buildHelperStream;
function buildHelperStream(helper, params, hash, templates, env, scope, label) {
- _emberMetalCore.default.assert('Helpers may not be used in the block form, for example {{#my-helper}}{{/my-helper}}. Please use a component, or alternatively use the helper in combination with a built-in Ember helper, for example {{#if (my-helper)}}{{/if}}.', !(helper.isHelperInstance && !helper.isHelperFactory) || !templates || !templates.template || !templates.template.meta);
- _emberMetalCore.default.assert('Helpers may not be used in the element form, for example <div {{my-helper}}>.', !(helper.isHelperInstance && !helper.isHelperFactory) || !templates || !templates.element);
+ _emberMetalCore.default.assert('Helpers may not be used in the block form, for example {{#my-helper}}{{/my-helper}}. Please use a component, or alternatively use the helper in combination with a built-in Ember helper, for example {{#if (my-helper)}}{{/if}}.', !(helper.isHelperInstance && !helper.isHelperFactory) || (!templates || !templates.template || !templates.template.meta));
+ _emberMetalCore.default.assert('Helpers may not be used in the element form, for example <div {{my-helper}}>.', !(helper.isHelperInstance && !helper.isHelperFactory) || (!templates || !templates.element));
if (helper.isHelperFactory) {
return new _emberHtmlbarsStreamsHelperFactory.default(helper, params, hash, label);
} else if (helper.isHelperInstance) {
return new _emberHtmlbarsStreamsHelperInstance.default(helper, params, hash, label);
} else {
@@ -10599,11 +10770,11 @@
if (!helper) {
var container = env.container;
if (validateLazyHelperName(name, container, env.hooks.keywords, env.knownHelpers)) {
var helperName = 'helper:' + name;
- if (container._registry.has(helperName)) {
+ if (container.registry.has(helperName)) {
helper = container.lookupFactory(helperName);
_emberMetalCore.default.assert('Expected to find an Ember.Helper with the name ' + helperName + ', but found an object of type ' + typeof helper + ' instead.', helper.isHelperFactory || helper.isHelperInstance);
}
}
}
@@ -10696,10 +10867,11 @@
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;
}
RenderEnv.build = function (view) {
return new RenderEnv({
view: view,
@@ -10764,10 +10936,11 @@
"use strict";
exports.default = _emberTemplateCompilerSystemTemplate.default((function () {
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -10793,10 +10966,11 @@
exports.default = _emberTemplateCompilerSystemTemplate.default((function () {
var child0 = (function () {
return {
meta: {},
+ isEmpty: false,
arity: 1,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -10818,10 +10992,11 @@
})();
var child1 = (function () {
var child0 = (function () {
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -10841,10 +11016,11 @@
templates: []
};
})();
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -10864,10 +11040,11 @@
templates: [child0]
};
})();
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -10892,10 +11069,11 @@
"use strict";
exports.default = _emberTemplateCompilerSystemTemplate.default((function () {
return {
meta: {},
+ isEmpty: true,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -10918,10 +11096,11 @@
var child0 = (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();
@@ -10941,10 +11120,11 @@
templates: []
};
})();
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -10965,10 +11145,11 @@
};
})();
var child1 = (function () {
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -10988,10 +11169,11 @@
templates: []
};
})();
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11014,10 +11196,11 @@
var child1 = (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();
@@ -11037,10 +11220,11 @@
templates: []
};
})();
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11061,10 +11245,11 @@
};
})();
var child1 = (function () {
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11084,10 +11269,11 @@
templates: []
};
})();
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11107,10 +11293,11 @@
templates: [child0, child1]
};
})();
return {
meta: {},
+ isEmpty: false,
arity: 1,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11132,10 +11319,11 @@
})();
var child1 = (function () {
var child0 = (function () {
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11155,10 +11343,11 @@
templates: []
};
})();
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11178,10 +11367,11 @@
templates: [child0]
};
})();
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11200,74 +11390,19 @@
locals: [],
templates: [child0, child1]
};
})());
});
-enifed("ember-htmlbars/templates/link-to-escaped", ["exports", "ember-template-compiler/system/template"], function (exports, _emberTemplateCompilerSystemTemplate) {
- "use strict";
-
- exports.default = _emberTemplateCompilerSystemTemplate.default((function () {
- return {
- meta: {},
- 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, 0], [1, 13]]]]],
- locals: [],
- templates: []
- };
- })());
-});
-enifed("ember-htmlbars/templates/link-to-unescaped", ["exports", "ember-template-compiler/system/template"], function (exports, _emberTemplateCompilerSystemTemplate) {
- "use strict";
-
- exports.default = _emberTemplateCompilerSystemTemplate.default((function () {
- return {
- meta: {},
- 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, 0], [1, 15]]]]],
- locals: [],
- templates: []
- };
- })());
-});
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();
@@ -11288,10 +11423,11 @@
};
})();
var child1 = (function () {
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11311,10 +11447,11 @@
templates: []
};
})();
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11335,10 +11472,11 @@
};
})();
var child1 = (function () {
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11358,10 +11496,11 @@
templates: []
};
})();
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11387,10 +11526,11 @@
exports.default = _emberTemplateCompilerSystemTemplate.default((function () {
var child0 = (function () {
return {
meta: {},
+ isEmpty: false,
arity: 1,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11410,10 +11550,11 @@
templates: []
};
})();
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11438,10 +11579,11 @@
"use strict";
exports.default = _emberTemplateCompilerSystemTemplate.default((function () {
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11467,10 +11609,11 @@
exports.default = _emberTemplateCompilerSystemTemplate.default((function () {
var child0 = (function () {
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11493,10 +11636,11 @@
})();
var child1 = (function () {
var child0 = (function () {
return {
meta: {},
+ isEmpty: false,
arity: 1,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11516,10 +11660,11 @@
templates: []
};
})();
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11541,10 +11686,11 @@
})();
var child2 = (function () {
var child0 = (function () {
return {
meta: {},
+ isEmpty: false,
arity: 1,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11564,10 +11710,11 @@
templates: []
};
})();
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11587,10 +11734,11 @@
templates: [child0]
};
})();
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11619,10 +11767,11 @@
"use strict";
exports.default = _emberTemplateCompilerSystemTemplate.default((function () {
return {
meta: {},
+ isEmpty: false,
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
var el0 = dom.createDocumentFragment();
@@ -11707,11 +11856,11 @@
return false;
}
if (!_emberHtmlbarsSystemLookupHelper.CONTAINS_DASH_CACHE.get(path)) {
return false;
}
- return container._registry.has('component:' + path) || container._registry.has('template:components/' + path);
+ return container.registry.has('component:' + path) || container.registry.has('template:components/' + path);
}
});
enifed('ember-htmlbars/utils/lookup-component', ['exports'], function (exports) {
'use strict';
@@ -11838,15 +11987,23 @@
enifed('ember-metal-views', ['exports', 'ember-metal-views/renderer'], function (exports, _emberMetalViewsRenderer) {
'use strict';
exports.Renderer = _emberMetalViewsRenderer.default;
});
-enifed('ember-metal-views/renderer', ['exports', 'ember-metal/run_loop', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/merge', 'ember-metal/set_properties', 'ember-views/system/build-component-template'], function (exports, _emberMetalRun_loop, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalMerge, _emberMetalSet_properties, _emberViewsSystemBuildComponentTemplate) {
+enifed('ember-metal-views/renderer', ['exports', 'ember-metal/run_loop', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/assign', 'ember-metal/set_properties', 'ember-views/system/build-component-template', 'ember-metal/environment'], function (exports, _emberMetalRun_loop, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalAssign, _emberMetalSet_properties, _emberViewsSystemBuildComponentTemplate, _emberMetalEnvironment) {
'use strict';
- function Renderer(_helper) {
- this._dom = _helper;
+ function Renderer(domHelper, destinedForDOM) {
+ this._dom = domHelper;
+
+ // This flag indicates whether the resulting rendered element will be
+ // inserted into the DOM. This should be set to `false` if the rendered
+ // element is going to be serialized to HTML without being inserted into
+ // the DOM (e.g., in FastBoot mode). By default, this flag is the same
+ // as whether we are running in an environment with DOM, but may be
+ // overridden.
+ this._destinedForDOM = destinedForDOM === undefined ? _emberMetalEnvironment.default.hasDOM : destinedForDOM;
}
Renderer.prototype.prerenderTopLevelView = function Renderer_prerenderTopLevelView(view, renderNode) {
if (view._state === 'inDOM') {
throw new Error('You cannot insert a View that has already been rendered');
@@ -11967,12 +12124,10 @@
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) {
@@ -12003,18 +12158,16 @@
Renderer.prototype.componentUpdateAttrs = function (component, newAttrs) {
var oldAttrs = null;
if (component.attrs) {
- oldAttrs = _emberMetalMerge.assign({}, component.attrs);
+ oldAttrs = _emberMetalAssign.default({}, component.attrs);
_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) {
@@ -12090,11 +12243,11 @@
}
}; // element destroyed so view.destroy shouldn't try to remove it removedFromDOM
exports.default = Renderer;
});
-enifed('ember-metal', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/merge', 'ember-metal/instrumentation', 'ember-metal/utils', 'ember-metal/error', 'ember-metal/cache', 'ember-metal/logger', 'ember-metal/property_get', 'ember-metal/events', 'ember-metal/observer_set', 'ember-metal/property_events', 'ember-metal/properties', 'ember-metal/property_set', 'ember-metal/map', 'ember-metal/get_properties', 'ember-metal/set_properties', 'ember-metal/watch_key', 'ember-metal/chains', 'ember-metal/watch_path', 'ember-metal/watching', 'ember-metal/expand_properties', 'ember-metal/computed', 'ember-metal/alias', 'ember-metal/computed_macros', 'ember-metal/observer', 'ember-metal/mixin', 'ember-metal/binding', 'ember-metal/run_loop', 'ember-metal/libraries', 'ember-metal/is_none', 'ember-metal/is_empty', 'ember-metal/is_blank', 'ember-metal/is_present', 'backburner', 'ember-metal/streams/utils', 'ember-metal/streams/stream'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalMerge, _emberMetalInstrumentation, _emberMetalUtils, _emberMetalError, _emberMetalCache, _emberMetalLogger, _emberMetalProperty_get, _emberMetalEvents, _emberMetalObserver_set, _emberMetalProperty_events, _emberMetalProperties, _emberMetalProperty_set, _emberMetalMap, _emberMetalGet_properties, _emberMetalSet_properties, _emberMetalWatch_key, _emberMetalChains, _emberMetalWatch_path, _emberMetalWatching, _emberMetalExpand_properties, _emberMetalComputed, _emberMetalAlias, _emberMetalComputed_macros, _emberMetalObserver, _emberMetalMixin, _emberMetalBinding, _emberMetalRun_loop, _emberMetalLibraries, _emberMetalIs_none, _emberMetalIs_empty, _emberMetalIs_blank, _emberMetalIs_present, _backburner, _emberMetalStreamsUtils, _emberMetalStreamsStream) {
+enifed('ember-metal', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/merge', 'ember-metal/instrumentation', 'ember-metal/utils', 'ember-metal/meta', 'ember-metal/error', 'ember-metal/cache', 'ember-metal/logger', 'ember-metal/property_get', 'ember-metal/events', 'ember-metal/observer_set', 'ember-metal/property_events', 'ember-metal/properties', 'ember-metal/property_set', 'ember-metal/map', 'ember-metal/get_properties', 'ember-metal/set_properties', 'ember-metal/watch_key', 'ember-metal/chains', 'ember-metal/watch_path', 'ember-metal/watching', 'ember-metal/expand_properties', 'ember-metal/computed', 'ember-metal/alias', 'ember-metal/computed_macros', 'ember-metal/observer', 'ember-metal/mixin', 'ember-metal/binding', 'ember-metal/run_loop', 'ember-metal/libraries', 'ember-metal/is_none', 'ember-metal/is_empty', 'ember-metal/is_blank', 'ember-metal/is_present', 'backburner'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalMerge, _emberMetalInstrumentation, _emberMetalUtils, _emberMetalMeta, _emberMetalError, _emberMetalCache, _emberMetalLogger, _emberMetalProperty_get, _emberMetalEvents, _emberMetalObserver_set, _emberMetalProperty_events, _emberMetalProperties, _emberMetalProperty_set, _emberMetalMap, _emberMetalGet_properties, _emberMetalSet_properties, _emberMetalWatch_key, _emberMetalChains, _emberMetalWatch_path, _emberMetalWatching, _emberMetalExpand_properties, _emberMetalComputed, _emberMetalAlias, _emberMetalComputed_macros, _emberMetalObserver, _emberMetalMixin, _emberMetalBinding, _emberMetalRun_loop, _emberMetalLibraries, _emberMetalIs_none, _emberMetalIs_empty, _emberMetalIs_blank, _emberMetalIs_present, _backburner) {
/**
@module ember
@submodule ember-metal
*/
@@ -12144,13 +12297,13 @@
hasPropertyAccessors: true
};
_emberMetalCore.default.Error = _emberMetalError.default;
_emberMetalCore.default.guidFor = _emberMetalUtils.guidFor;
- _emberMetalCore.default.META_DESC = _emberMetalUtils.META_DESC;
- _emberMetalCore.default.EMPTY_META = _emberMetalUtils.EMPTY_META;
- _emberMetalCore.default.meta = _emberMetalUtils.meta;
+ _emberMetalCore.default.META_DESC = _emberMetalMeta.META_DESC;
+ _emberMetalCore.default.EMPTY_META = _emberMetalMeta.EMPTY_META;
+ _emberMetalCore.default.meta = _emberMetalMeta.meta;
_emberMetalCore.default.inspect = _emberMetalUtils.inspect;
_emberMetalCore.default.tryCatchFinally = _emberMetalUtils.deprecatedTryCatchFinally;
_emberMetalCore.default.makeArray = _emberMetalUtils.makeArray;
_emberMetalCore.default.canInvoke = _emberMetalUtils.canInvoke;
_emberMetalCore.default.tryInvoke = _emberMetalUtils.tryInvoke;
@@ -12291,18 +12444,23 @@
// do this for side-effects of updating Ember.assert, warn, etc when
// ember-debug is present
// This needs to be called before any deprecateFunc
if (_emberMetalCore.default.__loader.registry['ember-debug']) {
requireModule('ember-debug');
+ } else {
+ _emberMetalCore.default.Debug = {};
+
+ _emberMetalCore.default.Debug.registerDeprecationHandler = function () {};
+ _emberMetalCore.default.Debug.registerWarnHandler = function () {};
}
_emberMetalCore.default.create = _emberMetalCore.default.deprecateFunc('Ember.create is deprecated in favor of Object.create', { id: 'ember-metal.ember-create', until: '3.0.0' }, Object.create);
_emberMetalCore.default.keys = _emberMetalCore.default.deprecateFunc('Ember.keys is deprecated in favor of Object.keys', { id: 'ember-metal.ember.keys', until: '3.0.0' }, Object.keys);
exports.default = _emberMetalCore.default;
});
-enifed('ember-metal/alias', ['exports', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/core', 'ember-metal/error', 'ember-metal/properties', 'ember-metal/computed', 'ember-metal/utils', 'ember-metal/dependent_keys'], function (exports, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalCore, _emberMetalError, _emberMetalProperties, _emberMetalComputed, _emberMetalUtils, _emberMetalDependent_keys) {
+enifed('ember-metal/alias', ['exports', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/core', 'ember-metal/error', 'ember-metal/properties', 'ember-metal/computed', 'ember-metal/utils', 'ember-metal/meta', 'ember-metal/dependent_keys'], function (exports, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalCore, _emberMetalError, _emberMetalProperties, _emberMetalComputed, _emberMetalUtils, _emberMetalMeta, _emberMetalDependent_keys) {
'use strict';
exports.default = alias;
exports.AliasedProperty = AliasedProperty;
@@ -12325,28 +12483,28 @@
AliasedProperty.prototype.set = function AliasedProperty_set(obj, keyName, value) {
return _emberMetalProperty_set.set(obj, this.altKey, value);
};
AliasedProperty.prototype.willWatch = function (obj, keyName) {
- _emberMetalDependent_keys.addDependentKeys(this, obj, keyName, _emberMetalUtils.meta(obj));
+ _emberMetalDependent_keys.addDependentKeys(this, obj, keyName, _emberMetalMeta.meta(obj));
};
AliasedProperty.prototype.didUnwatch = function (obj, keyName) {
- _emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, _emberMetalUtils.meta(obj));
+ _emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, _emberMetalMeta.meta(obj));
};
AliasedProperty.prototype.setup = function (obj, keyName) {
_emberMetalCore.default.assert('Setting alias \'' + keyName + '\' on self', this.altKey !== keyName);
- var m = _emberMetalUtils.meta(obj);
- if (m.watching[keyName]) {
+ var m = _emberMetalMeta.meta(obj);
+ if (m.peekWatching(keyName)) {
_emberMetalDependent_keys.addDependentKeys(this, obj, keyName, m);
}
};
AliasedProperty.prototype.teardown = function (obj, keyName) {
- var m = _emberMetalUtils.meta(obj);
- if (m.watching[keyName]) {
+ var m = _emberMetalMeta.meta(obj);
+ if (m.peekWatching(keyName)) {
_emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, m);
}
};
AliasedProperty.prototype.readOnly = function () {
@@ -12371,10 +12529,92 @@
// Backwards compatibility with Ember Data
AliasedProperty.prototype._meta = undefined;
AliasedProperty.prototype.meta = _emberMetalComputed.ComputedProperty.prototype.meta;
});
// Ember.assert
+enifed("ember-metal/assert", ["exports"], function (exports) {
+ "use strict";
+
+ exports.registerDebugFunction = registerDebugFunction;
+ exports.assert = assert;
+ exports.warn = warn;
+ exports.debug = debug;
+ exports.deprecate = deprecate;
+ exports.deprecateFunc = deprecateFunc;
+ exports.runInDebug = runInDebug;
+ var debugFunctions = {
+ assert: function () {},
+ warn: function () {},
+ debug: function () {},
+ deprecate: function () {},
+ deprecateFunc: function () {
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
+ return args[args.length - 1];
+ },
+ runInDebug: function () {}
+ };
+
+ exports.debugFunctions = debugFunctions;
+
+ function registerDebugFunction(name, fn) {
+ debugFunctions[name] = fn;
+ }
+
+ function assert() {
+ return debugFunctions.assert.apply(undefined, arguments);
+ }
+
+ function warn() {
+ return debugFunctions.warn.apply(undefined, arguments);
+ }
+
+ function debug() {
+ return debugFunctions.debug.apply(undefined, arguments);
+ }
+
+ function deprecate() {
+ return debugFunctions.deprecate.apply(undefined, arguments);
+ }
+
+ function deprecateFunc() {
+ return debugFunctions.deprecateFunc.apply(undefined, arguments);
+ }
+
+ function runInDebug() {
+ return debugFunctions.runInDebug.apply(undefined, arguments);
+ }
+});
+enifed("ember-metal/assign", ["exports"], function (exports) {
+ "use strict";
+
+ exports.default = assign;
+
+ function assign(original) {
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
+ for (var i = 0, l = args.length; i < l; i++) {
+ var arg = args[i];
+ if (!arg) {
+ continue;
+ }
+
+ var updates = Object.keys(arg);
+
+ for (var _i = 0, _l = updates.length; _i < _l; _i++) {
+ var prop = updates[_i];
+ original[prop] = arg[prop];
+ }
+ }
+
+ return original;
+ }
+});
enifed('ember-metal/binding', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/utils', 'ember-metal/observer', 'ember-metal/run_loop', 'ember-metal/path_cache'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalUtils, _emberMetalObserver, _emberMetalRun_loop, _emberMetalPath_cache) {
'use strict';
exports.bind = bind;
@@ -12882,11 +13122,11 @@
this.hits = 0;
this.misses = 0;
}
};
});
-enifed('ember-metal/chains', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/utils', 'ember-metal/watch_key'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalUtils, _emberMetalWatch_key) {
+enifed('ember-metal/chains', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/meta', 'ember-metal/watch_key', 'ember-metal/empty_object'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalMeta, _emberMetalWatch_key, _emberMetalEmpty_object) {
'use strict';
exports.flushPendingChains = flushPendingChains;
exports.finishChains = finishChains;
@@ -12902,21 +13142,17 @@
function isVolatile(obj) {
return !(isObject(obj) && obj.isDescriptor && obj._volatile === false);
}
- function Chains() {}
-
- Chains.prototype = Object.create(null);
-
function ChainWatchers(obj) {
// this obj would be the referencing chain node's parent node's value
this.obj = obj;
// chain nodes that reference a key in this obj by key
// we only create ChainWatchers when we are going to add them
// so create this upfront
- this.chains = new Chains();
+ this.chains = new _emberMetalEmpty_object.default();
}
ChainWatchers.prototype = {
add: function (key, node) {
var nodes = this.chains[key];
@@ -13014,41 +13250,39 @@
});
_emberMetalCore.default.warn('Watching an undefined global, Ember expects watched globals to be ' + 'setup by the time the run loop is flushed, check for typos', pendingQueue.length === 0, { id: 'ember-metal.chains-flush-pending-chains' });
}
+ function makeChainWatcher(obj) {
+ return new ChainWatchers(obj);
+ }
+
function addChainWatcher(obj, keyName, node) {
if (!isObject(obj)) {
return;
}
- var m = _emberMetalUtils.meta(obj);
-
- if (m.chainWatchers === undefined || m.chainWatchers.obj !== obj) {
- m.chainWatchers = new ChainWatchers(obj);
- }
-
- m.chainWatchers.add(keyName, node);
-
+ var m = _emberMetalMeta.meta(obj);
+ m.writableChainWatchers(makeChainWatcher).add(keyName, node);
_emberMetalWatch_key.watchKey(obj, keyName, m);
}
function removeChainWatcher(obj, keyName, node) {
if (!isObject(obj)) {
return;
}
var m = obj.__ember_meta__;
- if (!m || m.chainWatchers === undefined || m.chainWatchers.obj !== obj) {
+ if (!m || !m.readableChainWatchers()) {
return;
}
// make meta writable
- m = _emberMetalUtils.meta(obj);
+ m = _emberMetalMeta.meta(obj);
- m.chainWatchers.remove(keyName, node);
+ m.readableChainWatchers().remove(keyName, node);
_emberMetalWatch_key.unwatchKey(obj, keyName, m);
}
// A ChainNode watches a single key on an object. If you provide a starting
@@ -13095,12 +13329,13 @@
// Use `get` if the return value is an EachProxy or an uncacheable value.
if (isVolatile(obj[key])) {
return _emberMetalProperty_get.get(obj, key);
// Otherwise attempt to get the cached value of the computed property
} else {
- if (meta.cache && key in meta.cache) {
- return meta.cache[key];
+ var cache = meta.readableCache();
+ if (cache && key in cache) {
+ return cache[key];
}
}
}
ChainNode.prototype = {
@@ -13201,11 +13436,11 @@
chain: function (key, path, src) {
var chains = this._chains;
var node;
if (chains === undefined) {
- chains = this._chains = new Chains();
+ chains = this._chains = new _emberMetalEmpty_object.default();
} else {
node = chains[key];
}
if (node === undefined) {
@@ -13290,39 +13525,40 @@
function finishChains(obj) {
// We only create meta if we really have to
var m = obj.__ember_meta__;
if (m) {
+ m = _emberMetalMeta.meta(obj);
+
// finish any current chains node watchers that reference obj
- var chainWatchers = m.chainWatchers;
+ var chainWatchers = m.readableChainWatchers();
if (chainWatchers) {
chainWatchers.revalidateAll();
}
- // copy chains from prototype
- var chains = m.chains;
- if (chains && chains.value() !== obj) {
- // need to check if meta is writable
- _emberMetalUtils.meta(obj).chains = chains.copy(obj);
+ // ensure that if we have inherited any chains they have been
+ // copied onto our own meta.
+ if (m.readableChains()) {
+ m.writableChains();
}
}
}
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/expand_properties', 'ember-metal/error', 'ember-metal/properties', 'ember-metal/property_events', 'ember-metal/dependent_keys'], function (exports, _emberMetalCore, _emberMetalProperty_set, _emberMetalUtils, _emberMetalExpand_properties, _emberMetalError, _emberMetalProperties, _emberMetalProperty_events, _emberMetalDependent_keys) {
+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 = _emberMetalUtils.meta;
+ var metaFor = _emberMetalMeta.meta;
function UNDEFINED() {}
// ..........................................................
// COMPUTED PROPERTY
@@ -13576,11 +13812,11 @@
var meta = obj.__ember_meta__;
if (!meta || meta.source !== obj) {
return;
}
- var cache = meta.cache;
+ var cache = meta.readableCache();
if (cache && cache[keyName] !== undefined) {
cache[keyName] = undefined;
_emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, meta);
}
};
@@ -13616,14 +13852,11 @@
if (this._volatile) {
return this._getter.call(obj, keyName);
}
var meta = metaFor(obj);
- var cache = meta.cache;
- if (!cache) {
- cache = meta.cache = {};
- }
+ var cache = meta.writableCache();
var result = cache[keyName];
if (result === UNDEFINED) {
return undefined;
} else if (result !== undefined) {
@@ -13635,11 +13868,11 @@
cache[keyName] = UNDEFINED;
} else {
cache[keyName] = ret;
}
- var chainWatchers = meta.chainWatchers;
+ var chainWatchers = meta.readableChainWatchers();
if (chainWatchers) {
chainWatchers.revalidate(keyName);
}
_emberMetalDependent_keys.addDependentKeys(this, obj, keyName, meta);
@@ -13738,14 +13971,11 @@
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.cache;
- if (!cache) {
- cache = meta.cache = {};
- }
+ var cache = meta.writableCache();
var hadCachedValue = false;
var cachedValue = undefined;
if (cache[keyName] !== undefined) {
if (cache[keyName] !== UNDEFINED) {
cachedValue = cache[keyName];
@@ -13758,11 +13988,11 @@
// allows setter to return the same value that is cached already
if (hadCachedValue && cachedValue === ret) {
return ret;
}
- var watched = meta.watching && meta.watching[keyName];
+ var watched = meta.peekWatching(keyName);
if (watched) {
_emberMetalProperty_events.propertyWillChange(obj, keyName);
}
if (hadCachedValue) {
@@ -13790,11 +14020,11 @@
ComputedPropertyPrototype.teardown = function (obj, keyName) {
if (this._volatile) {
return;
}
var meta = metaFor(obj);
- var cache = meta.cache;
+ var cache = meta.readableCache();
if (cache && cache[keyName] !== undefined) {
_emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, meta);
cache[keyName] = undefined;
}
};
@@ -13885,11 +14115,11 @@
@return {Object} the cached value
@public
*/
function cacheFor(obj, key) {
var meta = obj.__ember_meta__;
- var cache = meta && meta.source === obj && meta.cache;
+ var cache = meta && meta.source === obj && meta.readableCache();
var ret = cache && cache[key];
if (ret === UNDEFINED) {
return undefined;
}
@@ -14612,11 +14842,11 @@
return value;
}
});
}
});
-enifed('ember-metal/core', ['exports'], function (exports) {
+enifed('ember-metal/core', ['exports', 'ember-metal/assert'], function (exports, _emberMetalAssert) {
/*globals Ember:true,ENV,EmberENV */
/**
@module ember
@submodule ember-metal
@@ -14635,11 +14865,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.0.3
+ @version 2.1.0-beta.1
@public
*/
'use strict';
@@ -14669,15 +14899,15 @@
/**
The semantic version.
@property VERSION
@type String
- @default '2.0.3'
+ @default '2.1.0-beta.1'
@static
@public
*/
- Ember.VERSION = '2.0.3';
+ Ember.VERSION = '2.1.0-beta.1';
/**
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
@@ -14782,37 +15012,17 @@
exports.K = K;
Ember.K = K;
//TODO: ES6 GLOBAL TODO
- // Stub out the methods defined by the ember-debug package in case it's not loaded
+ Ember.assert = _emberMetalAssert.assert;
+ Ember.warn = _emberMetalAssert.warn;
+ Ember.debug = _emberMetalAssert.debug;
+ Ember.deprecate = _emberMetalAssert.deprecate;
+ Ember.deprecateFunc = _emberMetalAssert.deprecateFunc;
+ Ember.runInDebug = _emberMetalAssert.runInDebug;
- if ('undefined' === typeof Ember.assert) {
- Ember.assert = K;
- }
- if ('undefined' === typeof Ember.warn) {
- Ember.warn = K;
- }
- if ('undefined' === typeof Ember.debug) {
- Ember.debug = K;
- }
- if ('undefined' === typeof Ember.runInDebug) {
- Ember.runInDebug = K;
- }
- if ('undefined' === typeof Ember.deprecate) {
- Ember.deprecate = K;
- }
- if ('undefined' === typeof Ember.deprecateFunc) {
- Ember.deprecateFunc = function () {
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
-
- return args[args.length - 1];
- };
- }
-
exports.default = Ember;
});
enifed('ember-metal/dependent_keys', ['exports', 'ember-metal/watching'], function (exports, _emberMetalWatching) {
// Remove "use strict"; from transpiled module until
// https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
@@ -14829,54 +15039,23 @@
// ..........................................................
// DEPENDENT KEYS
//
- // data structure:
- // meta.deps = {
- // 'depKey': {
- // 'keyName': count,
- // }
- // }
-
- /*
- This function returns a map of unique dependencies for a
- given object and key.
- */
- function keysForDep(depsMeta, depKey) {
- var keys = depsMeta[depKey];
- if (!keys) {
- // if there are no dependencies yet for a the given key
- // create a new empty list of dependencies for the key
- keys = depsMeta[depKey] = {};
- } else if (!depsMeta.hasOwnProperty(depKey)) {
- // otherwise if the dependency list is inherited from
- // a superclass, clone the hash
- keys = depsMeta[depKey] = Object.create(keys);
- }
- return keys;
- }
-
- function metaForDeps(meta) {
- return keysForDep(meta, 'deps');
- }
-
function addDependentKeys(desc, obj, keyName, meta) {
// the descriptor has a list of dependent keys, so
// add all of its dependent keys.
- var depsMeta, idx, len, depKey, keys;
+ var idx, len, depKey, keys;
var depKeys = desc._dependentKeys;
if (!depKeys) {
return;
}
- depsMeta = metaForDeps(meta);
-
for (idx = 0, len = depKeys.length; idx < len; idx++) {
depKey = depKeys[idx];
// Lookup keys meta for depKey
- keys = keysForDep(depsMeta, depKey);
+ keys = meta.writableDeps(depKey);
// Increment the number of times depKey depends on keyName.
keys[keyName] = (keys[keyName] || 0) + 1;
// Watch the depKey
_emberMetalWatching.watch(obj, depKey, meta);
}
@@ -14884,21 +15063,19 @@
function removeDependentKeys(desc, obj, keyName, meta) {
// the descriptor has a list of dependent keys, so
// remove all of its dependent keys.
var depKeys = desc._dependentKeys;
- var depsMeta, idx, len, depKey, keys;
+ var idx, len, depKey, keys;
if (!depKeys) {
return;
}
- depsMeta = metaForDeps(meta);
-
for (idx = 0, len = depKeys.length; idx < len; idx++) {
depKey = depKeys[idx];
// Lookup keys meta for depKey
- keys = keysForDep(depsMeta, depKey);
+ keys = meta.writableDeps(depKey);
// Decrement the number of times depKey depends on keyName.
keys[keyName] = (keys[keyName] || 0) - 1;
// Unwatch the depKey
_emberMetalWatching.unwatch(obj, depKey, meta);
}
@@ -15066,17 +15243,18 @@
}
}
EmberError.prototype = Object.create(Error.prototype);
});
-enifed('ember-metal/events', ['exports', 'ember-metal/core', 'ember-metal/utils'], function (exports, _emberMetalCore, _emberMetalUtils) {
+enifed('ember-metal/events', ['exports', 'ember-metal/core', 'ember-metal/utils', 'ember-metal/meta', 'ember-metal/meta_listeners'], function (exports, _emberMetalCore, _emberMetalUtils, _emberMetalMeta, _emberMetalMeta_listeners) {
// Remove "use strict"; from transpiled module until
// https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
//
exports.accumulateListeners = accumulateListeners;
exports.addListener = addListener;
+ exports.removeListener = removeListener;
exports.suspendListener = suspendListener;
exports.suspendListeners = suspendListeners;
exports.watchedEvents = watchedEvents;
exports.sendEvent = sendEvent;
exports.hasListeners = hasListeners;
@@ -15087,14 +15265,10 @@
/**
@module ember
@submodule ember-metal
*/
- /* listener flags */
- var ONCE = 1;
- var SUSPENDED = 2;
-
/*
The event system uses a series of nested hashes to store listeners on an
object. When a listener is registered, or when an event arrives, these
hashes are consulted to determine which target and action pair to invoke.
@@ -15123,46 +15297,16 @@
}
}
return index;
}
- function actionsFor(obj, eventName) {
- var meta = _emberMetalUtils.meta(obj, true);
- var actions;
- var listeners = meta.listeners;
-
- if (!listeners) {
- listeners = meta.listeners = Object.create(null);
- listeners.__source__ = obj;
- } else if (listeners.__source__ !== obj) {
- // setup inherited copy of the listeners object
- listeners = meta.listeners = Object.create(listeners);
- listeners.__source__ = obj;
- }
-
- actions = listeners[eventName];
-
- // if there are actions, but the eventName doesn't exist in our listeners, then copy them from the prototype
- if (actions && actions.__source__ !== obj) {
- actions = listeners[eventName] = listeners[eventName].slice();
- actions.__source__ = obj;
- } else if (!actions) {
- actions = listeners[eventName] = [];
- actions.__source__ = obj;
- }
-
- return actions;
- }
-
function accumulateListeners(obj, eventName, otherActions) {
var meta = obj['__ember_meta__'];
- var actions = meta && meta.listeners && meta.listeners[eventName];
-
- if (!actions) {
+ if (!meta) {
return;
}
-
+ var actions = meta.matchingListeners(eventName);
var newActions = [];
for (var i = actions.length - 3; i >= 0; i -= 3) {
var target = actions[i];
var method = actions[i + 1];
@@ -15197,24 +15341,17 @@
if (!method && 'function' === typeof target) {
method = target;
target = null;
}
- var actions = actionsFor(obj, eventName);
- var actionIndex = indexOf(actions, target, method);
var flags = 0;
-
if (once) {
- flags |= ONCE;
+ flags |= _emberMetalMeta_listeners.ONCE;
}
- if (actionIndex !== -1) {
- return;
- }
+ _emberMetalMeta.meta(obj).addToListeners(eventName, target, method, flags);
- actions.push(target, method, flags);
-
if ('function' === typeof obj.didAddListener) {
obj.didAddListener(eventName, target, method);
}
}
@@ -15229,47 +15366,24 @@
@param {String} eventName
@param {Object|Function} target A target object or a function
@param {Function|String} method A function or the name of a function to be called on `target`
@public
*/
+
function removeListener(obj, eventName, target, method) {
_emberMetalCore.default.assert('You must pass at least an object and event name to Ember.removeListener', !!obj && !!eventName);
if (!method && 'function' === typeof target) {
method = target;
target = null;
}
- function _removeListener(target, method) {
- var actions = actionsFor(obj, eventName);
- var actionIndex = indexOf(actions, target, method);
-
- // action doesn't exist, give up silently
- if (actionIndex === -1) {
- return;
- }
-
- actions.splice(actionIndex, 3);
-
+ _emberMetalMeta.meta(obj).removeFromListeners(eventName, target, method, function () {
if ('function' === typeof obj.didRemoveListener) {
- obj.didRemoveListener(eventName, target, method);
+ obj.didRemoveListener.apply(obj, arguments);
}
- }
-
- if (method) {
- _removeListener(target, method);
- } else {
- var meta = obj['__ember_meta__'];
- var actions = meta && meta.listeners && meta.listeners[eventName];
-
- if (!actions) {
- return;
- }
- for (var i = actions.length - 3; i >= 0; i -= 3) {
- _removeListener(actions[i], actions[i + 1]);
- }
- }
+ });
}
/**
Suspend listener during callback.
@@ -15288,29 +15402,11 @@
@param {Function|String} method A function or the name of a function to be called on `target`
@param {Function} callback
*/
function suspendListener(obj, eventName, target, method, callback) {
- if (!method && 'function' === typeof target) {
- method = target;
- target = null;
- }
-
- var actions = actionsFor(obj, eventName);
- var actionIndex = indexOf(actions, target, method);
-
- if (actionIndex !== -1) {
- actions[actionIndex + 2] |= SUSPENDED; // mark the action as suspended
- }
-
- try {
- return callback.call(target);
- } finally {
- if (actionIndex !== -1) {
- actions[actionIndex + 2] &= ~SUSPENDED;
- }
- }
+ return suspendListeners(obj, [eventName], target, method, callback);
}
/**
Suspends multiple listeners during a callback.
@@ -15328,34 +15424,11 @@
function suspendListeners(obj, eventNames, target, method, callback) {
if (!method && 'function' === typeof target) {
method = target;
target = null;
}
-
- var suspendedActions = [];
- var actionsList = [];
-
- for (var i = 0, l = eventNames.length; i < l; i++) {
- var eventName = eventNames[i];
- var actions = actionsFor(obj, eventName);
- var actionIndex = indexOf(actions, target, method);
-
- if (actionIndex !== -1) {
- actions[actionIndex + 2] |= SUSPENDED;
- suspendedActions.push(actionIndex);
- actionsList.push(actions);
- }
- }
-
- try {
- return callback.call(target);
- } finally {
- for (var i = 0, l = suspendedActions.length; i < l; i++) {
- var actionIndex = suspendedActions[i];
- actionsList[i][actionIndex + 2] &= ~SUSPENDED;
- }
- }
+ return _emberMetalMeta.meta(obj).suspendListeners(eventNames, target, method, callback);
}
/**
Return a list of currently watched events
@@ -15364,21 +15437,11 @@
@for Ember
@param obj
*/
function watchedEvents(obj) {
- var listeners = obj['__ember_meta__'].listeners;
- var ret = [];
-
- if (listeners) {
- for (var eventName in listeners) {
- if (eventName !== '__source__' && listeners[eventName]) {
- ret.push(eventName);
- }
- }
- }
- return ret;
+ return _emberMetalMeta.meta(obj).watchedEvents();
}
/**
Send an event. The execution of suspended listeners
is skipped, and once listeners are removed. A listener without
@@ -15396,14 +15459,14 @@
*/
function sendEvent(obj, eventName, params, actions) {
if (!actions) {
var meta = obj['__ember_meta__'];
- actions = meta && meta.listeners && meta.listeners[eventName];
+ actions = meta && meta.matchingListeners(eventName);
}
- if (!actions) {
+ if (!actions || actions.length === 0) {
return;
}
for (var i = actions.length - 3; i >= 0; i -= 3) {
// looping in reverse for once listeners
@@ -15412,14 +15475,14 @@
var flags = actions[i + 2];
if (!method) {
continue;
}
- if (flags & SUSPENDED) {
+ if (flags & _emberMetalMeta_listeners.SUSPENDED) {
continue;
}
- if (flags & ONCE) {
+ if (flags & _emberMetalMeta_listeners.ONCE) {
removeListener(obj, eventName, target, method);
}
if (!target) {
target = obj;
}
@@ -15448,13 +15511,14 @@
@param {String} eventName
*/
function hasListeners(obj, eventName) {
var meta = obj['__ember_meta__'];
- var actions = meta && meta.listeners && meta.listeners[eventName];
-
- return !!(actions && actions.length);
+ if (!meta) {
+ return false;
+ }
+ return meta.matchingListeners(eventName).length > 0;
}
/**
@private
@method listenersFor
@@ -15464,11 +15528,11 @@
*/
function listenersFor(obj, eventName) {
var ret = [];
var meta = obj['__ember_meta__'];
- var actions = meta && meta.listeners && meta.listeners[eventName];
+ var actions = meta && meta.matchingListeners(eventName);
if (!actions) {
return ret;
}
@@ -15514,12 +15578,10 @@
var func = args.pop();
var events = args;
func.__ember_listens__ = events;
return func;
}
-
- exports.removeListener = removeListener;
});
enifed('ember-metal/expand_properties', ['exports', 'ember-metal/error'], function (exports, _emberMetalError) {
'use strict';
exports.default = expandProperties;
@@ -15544,11 +15606,11 @@
Ember.expandProperties('foo.bar', echo); //=> 'foo.bar'
Ember.expandProperties('{foo,bar}', echo); //=> 'foo', 'bar'
Ember.expandProperties('foo.{bar,baz}', echo); //=> 'foo.bar', 'foo.baz'
Ember.expandProperties('{foo,bar}.baz', echo); //=> 'foo.baz', 'bar.baz'
- Ember.expandProperties('foo.{bar,baz}.[]', echo) //=> 'foo.bar.[]', 'foo.baz.[]'
+ Ember.expandProperties('foo.{bar,baz}.[]', echo) //=> 'foo.bar.[]', 'foo.baz.[]'
Ember.expandProperties('{foo,bar}.{spam,eggs}', echo) //=> 'foo.spam', 'foo.eggs', 'bar.spam', 'bar.eggs'
Ember.expandProperties('{foo}.bar.{baz}') //=> 'foo.bar.baz'
```
@method expandProperties
@@ -15594,11 +15656,11 @@
});
return all;
}
});
-enifed('ember-metal/features', ['exports', 'ember-metal/core'], function (exports, _emberMetalCore) {
+enifed('ember-metal/features', ['exports', 'ember-metal/core', 'ember-metal/assign'], function (exports, _emberMetalCore, _emberMetalAssign) {
'use strict';
exports.default = isEnabled;
/**
@@ -15612,13 +15674,13 @@
@namespace Ember
@static
@since 1.1.0
@public
*/
- var FEATURES = _emberMetalCore.default.ENV.FEATURES || {};
+ var FEATURES = _emberMetalAssign.default({}, _emberMetalCore.default.ENV.FEATURES);exports.FEATURES = FEATURES;
+ // jshint ignore:line
- exports.FEATURES = FEATURES;
/**
Determine whether the specified `feature` is enabled. Used by Ember's
build tools to exclude experimental features from beta/stable builds.
You can define the following configuration options:
@@ -16412,11 +16474,11 @@
*/
assert: consoleMethod('assert') || assertPolyfill
};
});
// Ember.imports
-enifed('ember-metal/map', ['exports', 'ember-metal/core', 'ember-metal/utils'], function (exports, _emberMetalCore, _emberMetalUtils) {
+enifed('ember-metal/map', ['exports', 'ember-metal/core', 'ember-metal/utils', 'ember-metal/empty_object'], function (exports, _emberMetalCore, _emberMetalUtils, _emberMetalEmpty_object) {
/**
@module ember
@submodule ember-metal
*/
@@ -16447,14 +16509,14 @@
function missingNew(name) {
throw new TypeError('Constructor ' + name + ' requires \'new\'');
}
function copyNull(obj) {
- var output = Object.create(null);
+ var output = new _emberMetalEmpty_object.default();
for (var prop in obj) {
- // hasOwnPropery is not needed because obj is Object.create(null);
+ // hasOwnPropery is not needed because obj is new EmptyObject();
output[prop] = obj[prop];
}
return output;
}
@@ -16479,11 +16541,10 @@
@namespace Ember
@constructor
@private
*/
function OrderedSet() {
-
if (this instanceof OrderedSet) {
this.clear();
this._silenceRemoveDeprecation = false;
} else {
missingNew('OrderedSet');
@@ -16507,11 +16568,11 @@
/**
@method clear
@private
*/
clear: function () {
- this.presenceSet = Object.create(null);
+ this.presenceSet = new _emberMetalEmpty_object.default();
this.list = [];
this.size = 0;
},
/**
@@ -16665,11 +16726,11 @@
*/
function Map() {
if (this instanceof this.constructor) {
this._keys = OrderedSet.create();
this._keys._silenceRemoveDeprecation = true;
- this._values = Object.create(null);
+ this._values = new _emberMetalEmpty_object.default();
this.size = 0;
} else {
missingNew('OrderedSet');
}
}
@@ -16823,11 +16884,11 @@
@method clear
@private
*/
clear: function () {
this._keys.clear();
- this._values = Object.create(null);
+ this._values = new _emberMetalEmpty_object.default();
this.size = 0;
},
/**
@method copy
@@ -16931,11 +16992,10 @@
@public
*/
'use strict';
exports.default = merge;
- exports.assign = assign;
function merge(original, updates) {
if (!updates || typeof updates !== 'object') {
return original;
}
@@ -16949,34 +17009,479 @@
original[prop] = updates[prop];
}
return original;
}
+});
+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
+ //
+
+ exports.meta = meta;
+ 'REMOVE_USE_STRICT: true';
- function assign(original) {
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
+ /**
+ @module ember-metal
+ */
+
+ /*
+ This declares several meta-programmed members on the Meta class. Such
+ meta!
+
+ In general, the `readable` variants will give you an object (if it
+ already exists) that you can read but should not modify. The
+ `writable` variants will give you a mutable object, and they will
+ create it if it didn't already exist.
+
+ The following methods will get generated metaprogrammatically, and
+ I'm including them here for greppability:
+
+ writableCache, readableCache, writableWatching, readableWatching,
+ peekWatching, clearWatching, writableMixins, readableMixins,
+ peekMixins, clearMixins, writableBindings, readableBindings,
+ peekBindings, clearBindings, writableValues, readableValues,
+ peekValues, clearValues, writableDeps, readableDeps, getAllDeps
+ writableChainWatchers, readableChainWatchers, writableChains,
+ readableChains
+
+ */
+ var members = {
+ cache: ownMap,
+ watching: inheritedMap,
+ mixins: inheritedMap,
+ bindings: inheritedMap,
+ values: inheritedMap,
+ deps: inheritedMapOfMaps,
+ chainWatchers: ownCustomObject,
+ chains: inheritedCustomObject
+ };
+
+ var memberNames = Object.keys(members);
+
+ function Meta(obj, parentMeta) {
+ this._cache = undefined;
+ this._watching = undefined;
+ this._mixins = undefined;
+ this._bindings = undefined;
+ this._values = undefined;
+ this._deps = undefined;
+ this._chainWatchers = undefined;
+ this._chains = undefined;
+ // used only internally
+ this.source = obj;
+
+ // when meta(obj).proto === obj, the object is intended to be only a
+ // prototype and doesn't need to actually be observable itself
+ this.proto = undefined;
+
+ // The next meta in our inheritance chain. We (will) track this
+ // explicitly instead of using prototypical inheritance because we
+ // have detailed knowledge of how each property should really be
+ // inherited, and we can optimize it much better than JS runtimes.
+ this.parent = parentMeta;
+
+ this._initializeListeners();
+ }
+
+ for (var _name in _emberMetalMeta_listeners.protoMethods) {
+ Meta.prototype[_name] = _emberMetalMeta_listeners.protoMethods[_name];
+ }
+ memberNames.forEach(function (name) {
+ return members[name](name, Meta);
+ });
+
+ // Implements a member that is a lazily created, non-inheritable
+ // POJO.
+ function ownMap(name, Meta) {
+ var key = memberProperty(name);
+ var capitalized = capitalize(name);
+ Meta.prototype['writable' + capitalized] = function () {
+ return this._getOrCreateOwnMap(key);
+ };
+ Meta.prototype['readable' + capitalized] = function () {
+ return this[key];
+ };
+ }
+
+ Meta.prototype._getOrCreateOwnMap = function (key) {
+ var ret = this[key];
+ if (!ret) {
+ ret = this[key] = new _emberMetalEmpty_object.default();
}
+ return ret;
+ };
- for (var i = 0, l = args.length; i < l; i++) {
- var arg = args[i];
- if (!arg) {
- continue;
+ // Implements a member that is a lazily created POJO with inheritable
+ // values.
+ function inheritedMap(name, Meta) {
+ var key = memberProperty(name);
+ var capitalized = capitalize(name);
+
+ Meta.prototype['writable' + capitalized] = function () {
+ return this._getOrCreateInheritedMap(key);
+ };
+
+ Meta.prototype['readable' + capitalized] = function () {
+ return this._getInherited(key);
+ };
+
+ Meta.prototype['peek' + capitalized] = function (subkey) {
+ var map = this._getInherited(key);
+ if (map) {
+ return map[subkey];
}
+ };
- var updates = Object.keys(arg);
+ Meta.prototype['clear' + capitalized] = function () {
+ this[key] = new _emberMetalEmpty_object.default();
+ };
+ }
- for (var _i = 0, _l = updates.length; _i < _l; _i++) {
- var prop = updates[_i];
- original[prop] = arg[prop];
+ Meta.prototype._getOrCreateInheritedMap = function (key) {
+ var ret = this[key];
+ if (!ret) {
+ if (this.parent) {
+ ret = this[key] = Object.create(this.parent._getOrCreateInheritedMap(key));
+ } else {
+ ret = this[key] = new _emberMetalEmpty_object.default();
}
}
+ return ret;
+ };
- return original;
+ Meta.prototype._getInherited = function (key) {
+ var pointer = this;
+ while (pointer !== undefined) {
+ if (pointer[key]) {
+ return pointer[key];
+ }
+ pointer = pointer.parent;
+ }
+ };
+
+ // Implements a member that provides a lazily created map of maps,
+ // with inheritance at both levels.
+ function inheritedMapOfMaps(name, Meta) {
+ var key = memberProperty(name);
+ var capitalized = capitalize(name);
+
+ Meta.prototype['writable' + capitalized] = function (subkey) {
+ var outerMap = this._getOrCreateInheritedMap(key);
+ var innerMap = outerMap[subkey];
+ if (!innerMap) {
+ innerMap = outerMap[subkey] = new _emberMetalEmpty_object.default();
+ } else if (!Object.hasOwnProperty.call(outerMap, subkey)) {
+ innerMap = outerMap[subkey] = Object.create(innerMap);
+ }
+ return innerMap;
+ };
+
+ Meta.prototype['readable' + capitalized] = function (subkey) {
+ var map = this._getInherited(key);
+ if (map) {
+ return map[subkey];
+ }
+ };
+
+ Meta.prototype['getAll' + capitalized] = function () {
+ return this._getInherited(key);
+ };
}
+
+ // Implements a member that provides a non-heritable, lazily-created
+ // object using the method you provide.
+ function ownCustomObject(name, Meta) {
+ var key = memberProperty(name);
+ var capitalized = capitalize(name);
+ Meta.prototype['writable' + capitalized] = function (create) {
+ var ret = this[key];
+ if (!ret) {
+ ret = this[key] = create(this.source);
+ }
+ return ret;
+ };
+ Meta.prototype['readable' + capitalized] = function () {
+ return this[key];
+ };
+ }
+
+ // Implements a member that provides an inheritable, lazily-created
+ // object using the method you provide. We will derived children from
+ // their parents by calling your object's `copy()` method.
+ function inheritedCustomObject(name, Meta) {
+ var key = memberProperty(name);
+ var capitalized = capitalize(name);
+ Meta.prototype['writable' + capitalized] = function (create) {
+ var ret = this[key];
+ if (!ret) {
+ if (this.parent) {
+ ret = this[key] = this.parent['writable' + capitalized](create).copy(this.source);
+ } else {
+ ret = this[key] = create(this.source);
+ }
+ }
+ return ret;
+ };
+ Meta.prototype['readable' + capitalized] = function () {
+ return this._getInherited(key);
+ };
+ }
+
+ function memberProperty(name) {
+ return '_' + name;
+ }
+
+ // there's a more general-purpose capitalize in ember-runtime, but we
+ // don't want to make ember-metal depend on ember-runtime.
+ function capitalize(name) {
+ return name.replace(/^\w/, function (m) {
+ return m.toUpperCase();
+ });
+ }
+
+ var META_DESC = {
+ writable: true,
+ configurable: true,
+ enumerable: false,
+ value: null
+ };
+
+ exports.META_DESC = META_DESC;
+ var EMBER_META_PROPERTY = {
+ name: '__ember_meta__',
+ descriptor: META_DESC
+ };
+
+ // 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
+ well as any watched properties and other information. You generally will
+ not access this information directly but instead work with higher level
+ methods that manipulate this hash indirectly.
+
+ @method meta
+ @for Ember
+ @private
+
+ @param {Object} obj The object to retrieve meta for
+ @param {Boolean} [writable=true] Pass `false` if you do not intend to modify
+ the meta hash, allowing the method to avoid making an unnecessary copy.
+ @return {Object} the meta hash for an object
+ */
+
+ function meta(obj, writable) {
+ var ret = obj.__ember_meta__;
+ if (writable === false) {
+ return ret || EMPTY_META;
+ }
+
+ if (ret && ret.source === obj) {
+ return ret;
+ }
+
+ if (!ret) {
+ ret = new Meta(obj);
+
+ ret.writableValues();
+ } else {
+ ret = new Meta(obj, ret);
+ }
+
+ if (obj.__defineNonEnumerable) {
+ obj.__defineNonEnumerable(EMBER_META_PROPERTY);
+ } else {
+ Object.defineProperty(obj, '__ember_meta__', META_DESC);
+ }
+ obj.__ember_meta__ = ret;
+
+ return ret;
+ }
});
-enifed('ember-metal/mixin', ['exports', 'ember-metal/core', 'ember-metal/merge', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/utils', '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, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalUtils, _emberMetalExpand_properties, _emberMetalProperties, _emberMetalComputed, _emberMetalBinding, _emberMetalObserver, _emberMetalEvents, _emberMetalStreamsUtils) {
+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
//
exports.mixin = mixin;
@@ -16994,51 +17499,12 @@
*/
var REQUIRED;
var a_slice = [].slice;
- function superFunction() {
- var func = this.__nextSuper;
- var ret;
-
- if (func) {
- var length = arguments.length;
- this.__nextSuper = null;
- if (length === 0) {
- ret = func.call(this);
- } else if (length === 1) {
- ret = func.call(this, arguments[0]);
- } else if (length === 2) {
- ret = func.call(this, arguments[0], arguments[1]);
- } else {
- ret = func.apply(this, arguments);
- }
- this.__nextSuper = func;
- return ret;
- }
- }
-
- // ensure we prime superFunction to mitigate
- // v8 bug potentially incorrectly deopts this function: https://code.google.com/p/v8/issues/detail?id=3709
- var primer = {
- __nextSuper: function (a, b, c, d) {}
- };
-
- superFunction.call(primer);
- superFunction.call(primer, 1);
- superFunction.call(primer, 1, 2);
- superFunction.call(primer, 1, 2, 3);
-
function mixinsMeta(obj) {
- var m = _emberMetalUtils.meta(obj, true);
- var ret = m.mixins;
- if (!ret) {
- ret = m.mixins = {};
- } else if (!m.hasOwnProperty('mixins')) {
- ret = m.mixins = Object.create(ret);
- }
- return ret;
+ return _emberMetalMeta.meta(obj, true).writableMixins();
}
function isMethod(obj) {
return 'function' === typeof obj && obj.isMethod !== false && obj !== Boolean && obj !== Object && obj !== Number && obj !== Array && obj !== Date && obj !== String;
}
@@ -17108,14 +17574,10 @@
}
return property;
}
- var sourceAvailable = (function () {
- return this;
- }).toString().indexOf('return this;') > -1;
-
function giveMethodSuper(obj, key, method, values, descs) {
var superMethod;
// Methods overwrite computed properties, and do not call super to them.
if (descs[key] === undefined) {
@@ -17130,25 +17592,11 @@
// Only wrap the new method if the original method was a function
if (superMethod === undefined || 'function' !== typeof superMethod) {
return method;
}
- var hasSuper;
- if (sourceAvailable) {
- hasSuper = method.__hasSuper;
-
- if (hasSuper === undefined) {
- hasSuper = method.toString().indexOf('_super') > -1;
- method.__hasSuper = hasSuper;
- }
- }
-
- if (sourceAvailable === false || hasSuper) {
- return _emberMetalUtils.wrap(method, superMethod);
- } else {
- return method;
- }
+ return _emberMetalUtils.wrap(method, superMethod);
}
function applyConcatenatedProperties(obj, key, value, values) {
var baseValue = values[key] || obj[key];
@@ -17193,11 +17641,11 @@
newBase[prop] = propValue;
}
}
if (hasFunction) {
- newBase._super = superFunction;
+ newBase._super = function () {};
}
return newBase;
}
@@ -17206,11 +17654,11 @@
if (value === REQUIRED && descs[key]) {
return CONTINUE;
}
// Wrap descriptor function to implement
- // __nextSuper() if needed
+ // _super() if needed
if (value._getter) {
value = giveDescriptorSuper(meta, key, value, values, descs, base);
}
descs[key] = value;
@@ -17245,11 +17693,11 @@
if (props === CONTINUE) {
continue;
}
if (props) {
- meta = _emberMetalUtils.meta(base);
+ meta = _emberMetalMeta.meta(base);
if (base.willMergeMixin) {
base.willMergeMixin(props);
}
concats = concatenatedMixinProperties('concatenatedProperties', props, values, base);
mergings = concatenatedMixinProperties('mergedProperties', props, values, base);
@@ -17277,17 +17725,11 @@
var IS_BINDING = /^.+Binding$/;
function detectBinding(obj, key, value, m) {
if (IS_BINDING.test(key)) {
- var bindings = m.bindings;
- if (!bindings) {
- bindings = m.bindings = {};
- } else if (!m.hasOwnProperty('bindings')) {
- bindings = m.bindings = Object.create(m.bindings);
- }
- bindings[key] = value;
+ m.writableBindings()[key] = value;
}
}
function connectStreamBinding(obj, key, stream) {
var onNotify = function (stream) {
@@ -17306,19 +17748,19 @@
_emberMetalObserver.addObserver(obj, key, null, didChange);
stream.subscribe(onNotify);
if (obj._streamBindingSubscriptions === undefined) {
- obj._streamBindingSubscriptions = Object.create(null);
+ obj._streamBindingSubscriptions = new _emberMetalEmpty_object.default();
}
obj._streamBindingSubscriptions[key] = onNotify;
}
function connectBindings(obj, m) {
// TODO Mixin.apply(instance) should disconnect binding if exists
- var bindings = m.bindings;
+ var bindings = m.readableBindings();
var key, binding, to;
if (bindings) {
for (key in bindings) {
binding = bindings[key];
if (binding) {
@@ -17336,16 +17778,16 @@
binding.connect(obj);
obj[key] = binding;
}
}
// mark as applied
- m.bindings = {};
+ m.clearBindings();
}
}
function finishPartial(obj, m) {
- connectBindings(obj, m || _emberMetalUtils.meta(obj));
+ connectBindings(obj, m || _emberMetalMeta.meta(obj));
return obj;
}
function followAlias(obj, desc, m, descs, values) {
var altKey = desc.methodName;
@@ -17392,15 +17834,15 @@
}
function applyMixin(obj, mixins, partial) {
var descs = {};
var values = {};
- var m = _emberMetalUtils.meta(obj);
+ var m = _emberMetalMeta.meta(obj);
var keys = [];
var key, value, desc;
- obj._super = superFunction;
+ obj._super = function () {};
// Go through all mixins and hashes passed in, and:
//
// * Handle concatenated properties
// * Handle merged properties
@@ -17655,16 +18097,15 @@
return false;
}
if (obj instanceof Mixin) {
return _detect(obj, this, {});
}
- var m = obj['__ember_meta__'];
- var mixins = m && m.mixins;
- if (mixins) {
- return !!mixins[_emberMetalUtils.guidFor(this)];
+ var m = obj.__ember_meta__;
+ if (!m) {
+ return false;
}
- return false;
+ return !!m.peekMixins(_emberMetalUtils.guidFor(this));
};
MixinPrototype.without = function () {
var ret = new Mixin([this]);
@@ -17711,11 +18152,11 @@
// returns the mixins currently applied to the specified object
// TODO: Make Ember.mixin
Mixin.mixins = function (obj) {
var m = obj['__ember_meta__'];
- var mixins = m && m.mixins;
+ var mixins = m && m.readableMixins();
var ret = [];
if (!mixins) {
return ret;
}
@@ -17775,11 +18216,11 @@
```
@method aliasMethod
@for Ember
@param {String} methodName name of the method to alias
- @public
+ @private
*/
function aliasMethod(methodName) {
return new Alias(methodName);
}
@@ -18228,11 +18669,11 @@
function getTailPath(path) {
return tailPathCache.get(path);
}
});
-enifed('ember-metal/properties', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/utils', 'ember-metal/property_events'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalUtils, _emberMetalProperty_events) {
+enifed('ember-metal/properties', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/meta', 'ember-metal/property_events'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalMeta, _emberMetalProperty_events) {
/**
@module ember-metal
*/
'use strict';
@@ -18269,11 +18710,11 @@
}
function DEFAULT_GETTER_FUNCTION(name) {
return function GETTER_FUNCTION() {
var meta = this['__ember_meta__'];
- return meta && meta.values[name];
+ return meta && meta.peekValues(name);
};
}
/**
NOTE: This is a low-level method used by other parts of the API. You almost
@@ -18323,13 +18764,13 @@
function defineProperty(obj, keyName, desc, data, meta) {
var possibleDesc, existingDesc, watching, value;
if (!meta) {
- meta = _emberMetalUtils.meta(obj);
+ meta = _emberMetalMeta.meta(obj);
}
- var watchEntry = meta.watching[keyName];
+ var watchEntry = meta.peekWatching(keyName);
possibleDesc = obj[keyName];
existingDesc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
watching = watchEntry !== undefined && watchEntry > 0;
@@ -18357,11 +18798,11 @@
} else {
if (desc == null) {
value = data;
if (watching) {
- meta.values[keyName] = data;
+ meta.writableValues()[keyName] = data;
Object.defineProperty(obj, keyName, {
configurable: true,
enumerable: true,
set: MANDATORY_SETTER_FUNCTION(keyName),
get: DEFAULT_GETTER_FUNCTION(keyName)
@@ -18422,11 +18863,11 @@
@return {void}
@private
*/
function propertyWillChange(obj, keyName) {
var m = obj['__ember_meta__'];
- var watching = m && m.watching[keyName] > 0 || keyName === 'length';
+ var watching = m && m.peekWatching(keyName) > 0 || keyName === 'length';
var proto = m && m.proto;
var possibleDesc = obj[keyName];
var desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
if (!watching) {
@@ -18462,11 +18903,11 @@
@return {void}
@private
*/
function propertyDidChange(obj, keyName) {
var m = obj['__ember_meta__'];
- var watching = m && m.watching[keyName] > 0 || keyName === 'length';
+ var watching = m && m.peekWatching(keyName) > 0 || keyName === 'length';
var proto = m && m.proto;
var possibleDesc = obj[keyName];
var desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
if (proto === obj) {
@@ -18484,11 +18925,11 @@
if (!watching && keyName !== 'length') {
return;
}
- if (m && m.deps && m.deps[keyName]) {
+ if (m && m.readableDeps(keyName)) {
dependentKeysDidChange(obj, keyName, m);
}
chainsDidChange(obj, keyName, m, false);
notifyObservers(obj, keyName);
@@ -18500,11 +18941,11 @@
if (obj.isDestroying) {
return;
}
var deps;
- if (meta && meta.deps && (deps = meta.deps[depKey])) {
+ if (meta && (deps = meta.readableDeps(depKey))) {
var seen = WILL_SEEN;
var top = !seen;
if (top) {
seen = WILL_SEEN = {};
@@ -18523,11 +18964,11 @@
if (obj.isDestroying) {
return;
}
var deps;
- if (meta && meta.deps && (deps = meta.deps[depKey])) {
+ if (meta && (deps = meta.readableDeps(depKey))) {
var seen = DID_SEEN;
var top = !seen;
if (top) {
seen = DID_SEEN = {};
@@ -18586,30 +19027,28 @@
}
}
}
function chainsWillChange(obj, keyName, m) {
- if (m.chainWatchers === undefined || m.chainWatchers.obj !== obj) {
- return;
+ var c = m.readableChainWatchers();
+ if (c) {
+ c.notify(keyName, false, propertyWillChange);
}
-
- m.chainWatchers.notify(keyName, false, propertyWillChange);
}
function chainsDidChange(obj, keyName, m) {
- if (m.chainWatchers === undefined || m.chainWatchers.obj !== obj) {
- return;
+ var c = m.readableChainWatchers();
+ if (c) {
+ c.notify(keyName, true, propertyDidChange);
}
-
- m.chainWatchers.notify(keyName, true, propertyDidChange);
}
function overrideChains(obj, keyName, m) {
- if (m.chainWatchers === undefined || m.chainWatchers.obj !== obj) {
- return;
+ var c = m.readableChainWatchers();
+ if (c) {
+ c.revalidate(keyName);
}
- m.chainWatchers.revalidate(keyName);
}
/**
@method beginPropertyChanges
@chainable
@@ -18762,12 +19201,12 @@
}
if (desc) {
return desc.get(obj, keyName);
} else {
- if (meta && meta.watching[keyName] > 0) {
- ret = meta.values[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) {
@@ -18915,22 +19354,22 @@
// setUnknownProperty is called if `obj` is an object,
// the property does not already exist, and the
// `setUnknownProperty` method exists on the object
if (isUnknown && 'function' === typeof obj.setUnknownProperty) {
obj.setUnknownProperty(keyName, value);
- } else if (meta && meta.watching[keyName] > 0) {
+ } else if (meta && meta.peekWatching(keyName) > 0) {
if (meta.proto !== obj) {
- currentValue = meta.values[keyName];
+ currentValue = meta.peekValues(keyName);
}
// only trigger a change if the value has changed
if (value !== currentValue) {
_emberMetalProperty_events.propertyWillChange(obj, keyName);
if (currentValue === undefined && !(keyName in obj) || !Object.prototype.propertyIsEnumerable.call(obj, keyName)) {
_emberMetalProperties.defineProperty(obj, keyName, null, value); // setup mandatory setter
} else {
- meta.values[keyName] = value;
+ meta.writableValues()[keyName] = value;
}
_emberMetalProperty_events.propertyDidChange(obj, keyName);
}
} else {
@@ -20011,11 +20450,11 @@
}
});
exports.default = ProxyStream;
});
-enifed('ember-metal/streams/stream', ['exports', 'ember-metal/core', 'ember-metal/path_cache', 'ember-metal/observer', 'ember-metal/streams/utils', 'ember-metal/streams/subscriber', 'ember-metal/streams/dependency'], function (exports, _emberMetalCore, _emberMetalPath_cache, _emberMetalObserver, _emberMetalStreamsUtils, _emberMetalStreamsSubscriber, _emberMetalStreamsDependency) {
+enifed('ember-metal/streams/stream', ['exports', 'ember-metal/core', 'ember-metal/path_cache', 'ember-metal/observer', 'ember-metal/streams/utils', 'ember-metal/empty_object', 'ember-metal/streams/subscriber', 'ember-metal/streams/dependency'], function (exports, _emberMetalCore, _emberMetalPath_cache, _emberMetalObserver, _emberMetalStreamsUtils, _emberMetalEmpty_object, _emberMetalStreamsSubscriber, _emberMetalStreamsDependency) {
'use strict';
/**
@module ember-metal
*/
@@ -20060,11 +20499,11 @@
delete this.children[key];
},
getKey: function (key) {
if (this.children === undefined) {
- this.children = Object.create(null);
+ this.children = new _emberMetalEmpty_object.default();
}
var keyStream = this.children[key];
if (keyStream === undefined) {
@@ -20078,11 +20517,11 @@
get: function (path) {
var firstKey = _emberMetalPath_cache.getFirstKey(path);
var tailPath = _emberMetalPath_cache.getTailPath(path);
if (this.children === undefined) {
- this.children = Object.create(null);
+ this.children = new _emberMetalEmpty_object.default();
}
var keyStream = this.children[firstKey];
if (keyStream === undefined) {
@@ -20399,11 +20838,11 @@
exports.setValue = setValue;
/*
Check whether an object is a stream or not
- @public
+ @private
@for Ember.stream
@function isStream
@param {Object|Stream} object object to check whether it is a stream
@return {Boolean} `true` if the object is a stream, `false` otherwise
*/
@@ -20433,11 +20872,11 @@
/*
A method of unsubscribing from a stream which is safe for use with a non-stream
object. If a non-stream object is passed, the function does nothing.
- @public
+ @private
@for Ember.stream
@function unsubscribe
@param {Object|Stream} object object or stream to potentially unsubscribe from
@param {Function} callback function originally passed to `subscribe()`
@param {Object} [context] object originally passed to `subscribe()`
@@ -20451,11 +20890,11 @@
/*
Retrieve the value of a stream, or in the case a non-stream object is passed,
return the object itself.
- @public
+ @private
@for Ember.stream
@function read
@param {Object|Stream} object object to return the value of
@return the stream's current value, or the non-stream object itself
*/
@@ -20469,11 +20908,11 @@
}
/*
Map an array, replacing any streams with their values.
- @public
+ @private
@for Ember.stream
@function readArray
@param {Array} array The array to read values from
@return {Array} a new array of the same length with the values of non-stream
objects mapped from their original positions untouched, and
@@ -20492,11 +20931,11 @@
/*
Map a hash, replacing any stream property values with the current value of that
stream.
- @public
+ @private
@for Ember.stream
@function readHash
@param {Object} object The hash to read keys and values from
@return {Object} a new object with the same keys as the passed object. The
property values in the new object are the original values in
@@ -20513,11 +20952,11 @@
}
/*
Check whether an array contains any stream values
- @public
+ @private
@for Ember.stream
@function scanArray
@param {Array} array array given to a handlebars helper
@return {Boolean} `true` if the array contains a stream/bound value, `false`
otherwise
@@ -20538,11 +20977,11 @@
}
/*
Check whether a hash has any stream property values
- @public
+ @private
@for Ember.stream
@function scanHash
@param {Object} hash "hash" argument given to a handlebars helper
@return {Boolean} `true` if the object contains a stream/bound value, `false`
otherwise
@@ -20562,11 +21001,11 @@
}
/*
Join an array, with any streams replaced by their current values
- @public
+ @private
@for Ember.stream
@function concat
@param {Array} array An array containing zero or more stream objects and
zero or more non-stream objects
@param {String} separator string to be used to join array elements
@@ -20587,11 +21026,11 @@
var labels = labelsFor(array);
return 'concat([' + labels.join(', ') + ']; separator=' + inspect(separator) + ')';
});
for (i = 0, l = array.length; i < l; i++) {
- stream.addDependency(array[i]);
+ subscribe(array[i], stream.notify, stream);
}
// used by angle bracket components to detect an attribute was provided
// as a string literal
stream.isConcat = true;
@@ -20716,11 +21155,11 @@
```
In the example, result is a stream if source is a stream, or a number of
source was numeric.
- @public
+ @private
@for Ember.stream
@function chain
@param {Object|Stream} value A stream or non-stream object
@param {Function} fn function to be run when the stream value changes, or to
be run once in the case of a non-stream object
@@ -20751,25 +21190,15 @@
}
});
enifed("ember-metal/symbol", ["exports"], function (exports) {
"use strict";
});
-enifed('ember-metal/utils', ['exports', 'ember-metal/features'], function (exports, _emberMetalFeatures) {
+enifed('ember-metal/utils', ['exports'], function (exports) {
// Remove "use strict"; from transpiled module until
// https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
//
- exports.uuid = uuid;
- exports.symbol = symbol;
- exports.generateGuid = generateGuid;
- exports.guidFor = guidFor;
- exports.wrap = wrap;
- exports.tryInvoke = tryInvoke;
- exports.makeArray = makeArray;
- exports.inspect = inspect;
- exports.apply = apply;
- exports.applyStr = applyStr;
'REMOVE_USE_STRICT: true';
/**
@module ember-metal
*/
@@ -20779,10 +21208,20 @@
jQuery master. We'll just bootstrap our own uuid now.
@private
@return {Number} the uuid
*/
+ exports.uuid = uuid;
+ exports.symbol = symbol;
+ exports.generateGuid = generateGuid;
+ exports.guidFor = guidFor;
+ exports.wrap = wrap;
+ exports.tryInvoke = tryInvoke;
+ exports.makeArray = makeArray;
+ exports.inspect = inspect;
+ exports.apply = apply;
+ exports.applyStr = applyStr;
var _uuid = 0;
/**
Generates a universally unique identifier. This method
is used internally by Ember for assisting with
@@ -20890,49 +21329,23 @@
enumerable: false,
value: null
};
exports.GUID_DESC = GUID_DESC;
- var undefinedDescriptor = {
- configurable: true,
- writable: true,
- enumerable: false,
- value: undefined
- };
-
var nullDescriptor = {
configurable: true,
writable: true,
enumerable: false,
value: null
};
- var META_DESC = {
- writable: true,
- configurable: true,
- enumerable: false,
- value: null
- };
-
- var EMBER_META_PROPERTY = {
- name: '__ember_meta__',
- descriptor: META_DESC
- };
-
- exports.EMBER_META_PROPERTY = EMBER_META_PROPERTY;
var GUID_KEY_PROPERTY = {
name: GUID_KEY,
descriptor: nullDescriptor
};
exports.GUID_KEY_PROPERTY = GUID_KEY_PROPERTY;
- var NEXT_SUPER_PROPERTY = {
- name: '__nextSuper',
- descriptor: undefinedDescriptor
- };
-
- exports.NEXT_SUPER_PROPERTY = NEXT_SUPER_PROPERTY;
/**
Generates a new guid, optionally saving the guid to the object that you
pass in. You will rarely need to use this method. Instead you should
call `Ember.guidFor(obj)`, which return an existing guid if available.
@@ -21049,88 +21462,15 @@
}
return ret;
}
}
- // ..........................................................
- // META
- //
- function Meta(obj) {
- this.watching = {};
- this.cache = undefined;
- this.source = obj;
- this.deps = undefined;
- this.listeners = undefined;
- this.mixins = undefined;
- this.bindings = undefined;
- this.chains = undefined;
- this.chainWatchers = undefined;
- this.values = undefined;
- this.proto = undefined;
- }
+ var sourceAvailable = (function () {
+ return this;
+ }).toString().indexOf('return this;') > -1;
- // Placeholder for non-writable metas.
- var EMPTY_META = new Meta(null);
-
- EMPTY_META.values = {};
-
/**
- 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
- well as any watched properties and other information. You generally will
- not access this information directly but instead work with higher level
- methods that manipulate this hash indirectly.
-
- @method meta
- @for Ember
- @private
-
- @param {Object} obj The object to retrieve meta for
- @param {Boolean} [writable=true] Pass `false` if you do not intend to modify
- the meta hash, allowing the method to avoid making an unnecessary copy.
- @return {Object} the meta hash for an object
- */
- function meta(obj, writable) {
- var ret = obj.__ember_meta__;
- if (writable === false) {
- return ret || EMPTY_META;
- }
-
- if (!ret) {
- if (obj.__defineNonEnumerable) {
- obj.__defineNonEnumerable(EMBER_META_PROPERTY);
- } else {
- Object.defineProperty(obj, '__ember_meta__', META_DESC);
- }
-
- ret = new Meta(obj);
-
- ret.values = {};
-
- obj.__ember_meta__ = ret;
- } else if (ret.source !== obj) {
- if (obj.__defineNonEnumerable) {
- obj.__defineNonEnumerable(EMBER_META_PROPERTY);
- } else {
- Object.defineProperty(obj, '__ember_meta__', META_DESC);
- }
-
- ret = Object.create(ret);
- ret.watching = Object.create(ret.watching);
- ret.cache = undefined;
- ret.source = obj;
-
- ret.values = Object.create(ret.values);
-
- obj['__ember_meta__'] = ret;
- }
- return ret;
- }
-
- /**
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.
@private
@@ -21139,38 +21479,56 @@
@param {Function} func The function to call
@param {Function} superFunc The super function.
@return {Function} wrapped function.
*/
- function wrap(func, superFunc) {
- function superWrapper() {
- var ret;
- var sup = this && this.__nextSuper;
- var length = arguments.length;
+ function wrap(func, _superFunc) {
+ var superFunc = _superFunc;
+ var hasSuper;
+ if (sourceAvailable) {
+ hasSuper = func.__hasSuper;
- if (this) {
- this.__nextSuper = superFunc;
+ if (hasSuper === undefined) {
+ hasSuper = func.toString().indexOf('_super') > -1;
+ func.__hasSuper = hasSuper;
}
- if (length === 0) {
- ret = func.call(this);
- } else if (length === 1) {
- ret = func.call(this, arguments[0]);
- } else if (length === 2) {
- ret = func.call(this, arguments[0], arguments[1]);
- } else {
- var args = new Array(length);
- for (var i = 0; i < length; i++) {
- args[i] = arguments[i];
- }
- ret = apply(this, func, args);
+ if (!hasSuper) {
+ return func;
}
+ }
- if (this) {
- this.__nextSuper = sup;
- }
+ if (superFunc.wrappedFunction === undefined) {
+ // terminate _super to prevent infinite recursion
+ superFunc = wrap(superFunc, function () {});
+ }
+ return _wrap(func, superFunc);
+ }
+
+ function _wrap(func, superFunc) {
+ function superWrapper() {
+ var ret;
+ var orig = this._super;
+ this._super = superFunc;
+ switch (arguments.length) {
+ case 0:
+ ret = func.call(this);break;
+ case 1:
+ ret = func.call(this, arguments[0]);break;
+ case 2:
+ ret = func.call(this, arguments[0], arguments[1]);break;
+ case 3:
+ ret = func.call(this, arguments[0], arguments[1], arguments[2]);break;
+ 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;
+ }
+ this._super = orig;
return ret;
}
superWrapper.wrappedFunction = func;
superWrapper.__ember_observes__ = func.__ember_observes__;
@@ -21381,17 +21739,14 @@
return t[m].apply(t, a);
}
}
exports.GUID_KEY = GUID_KEY;
- exports.META_DESC = META_DESC;
- exports.EMPTY_META = EMPTY_META;
- exports.meta = meta;
exports.makeArray = makeArray;
exports.canInvoke = canInvoke;
});
-enifed('ember-metal/watch_key', ['exports', 'ember-metal/features', 'ember-metal/utils', 'ember-metal/properties'], function (exports, _emberMetalFeatures, _emberMetalUtils, _emberMetalProperties) {
+enifed('ember-metal/watch_key', ['exports', 'ember-metal/features', 'ember-metal/meta', 'ember-metal/properties'], function (exports, _emberMetalFeatures, _emberMetalMeta, _emberMetalProperties) {
'use strict';
exports.watchKey = watchKey;
exports.unwatchKey = unwatchKey;
@@ -21399,12 +21754,12 @@
// can't watch length on Array - it is special...
if (keyName === 'length' && Array.isArray(obj)) {
return;
}
- var m = meta || _emberMetalUtils.meta(obj);
- var watching = m.watching;
+ var m = meta || _emberMetalMeta.meta(obj);
+ var watching = m.writableWatching();
// activate watching first time
if (!watching[keyName]) {
watching[keyName] = 1;
@@ -21436,11 +21791,11 @@
return;
}
// this x in Y deopts, so keeping it in this function is better;
if (configurable && isWritable && hasValue && keyName in obj) {
- m.values[keyName] = obj[keyName];
+ 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)
@@ -21451,12 +21806,12 @@
// This is super annoying, but required until
// https://github.com/babel/babel/issues/906 is resolved
; // jshint ignore:line
function unwatchKey(obj, keyName, meta) {
- var m = meta || _emberMetalUtils.meta(obj);
- var watching = m.watching;
+ var m = meta || _emberMetalMeta.meta(obj);
+ var watching = m.writableWatching();
if (watching[keyName] === 1) {
watching[keyName] = 0;
var possibleDesc = obj[keyName];
@@ -21479,48 +21834,45 @@
configurable: true,
writable: true,
enumerable: true,
value: val
});
- delete m.values[keyName];
+ delete m.writableValues()[keyName];
},
get: _emberMetalProperties.DEFAULT_GETTER_FUNCTION(keyName)
});
}
} else if (watching[keyName] > 1) {
watching[keyName]--;
}
}
});
-enifed('ember-metal/watch_path', ['exports', 'ember-metal/utils', 'ember-metal/chains'], function (exports, _emberMetalUtils, _emberMetalChains) {
+enifed('ember-metal/watch_path', ['exports', 'ember-metal/meta', 'ember-metal/chains'], function (exports, _emberMetalMeta, _emberMetalChains) {
'use strict';
exports.watchPath = watchPath;
exports.unwatchPath = unwatchPath;
// get the chains for the current object. If the current object has
// chains inherited from the proto they will be cloned and reconfigured for
// the current object.
function chainsFor(obj, meta) {
- var m = meta || _emberMetalUtils.meta(obj);
- var ret = m.chains;
- if (!ret) {
- ret = m.chains = new _emberMetalChains.ChainNode(null, null, obj);
- } else if (ret.value() !== obj) {
- ret = m.chains = ret.copy(obj);
- }
- return ret;
+ return (meta || _emberMetalMeta.meta(obj)).writableChains(makeChainNode);
}
+ function makeChainNode(obj) {
+ return new _emberMetalChains.ChainNode(null, null, obj);
+ }
+
function watchPath(obj, keyPath, meta) {
// can't watch length on Array - it is special...
if (keyPath === 'length' && Array.isArray(obj)) {
return;
}
- var m = meta || _emberMetalUtils.meta(obj);
- var watching = m.watching;
+ var m = meta || _emberMetalMeta.meta(obj);
+ var watching = m.writableWatching();
if (!watching[keyPath]) {
// activate watching first time
watching[keyPath] = 1;
chainsFor(obj, m).add(keyPath);
@@ -21528,12 +21880,12 @@
watching[keyPath] = (watching[keyPath] || 0) + 1;
}
}
function unwatchPath(obj, keyPath, meta) {
- var m = meta || _emberMetalUtils.meta(obj);
- var watching = m.watching;
+ var m = meta || _emberMetalMeta.meta(obj);
+ var watching = m.writableWatching();
if (watching[keyPath] === 1) {
watching[keyPath] = 0;
chainsFor(obj, m).remove(keyPath);
} else if (watching[keyPath] > 1) {
@@ -21580,11 +21932,11 @@
exports.watch = watch;
function isWatching(obj, key) {
var meta = obj['__ember_meta__'];
- return (meta && meta.watching[key]) > 0;
+ return (meta && meta.peekWatching(key)) > 0;
}
watch.flushPending = _emberMetalChains.flushPendingChains;
function unwatch(obj, _keyPath, m) {
@@ -21618,11 +21970,11 @@
var node, nodes, key, nodeObject;
if (meta) {
obj['__ember_meta__'] = null;
// remove chainWatchers to remove circular references that would prevent GC
- node = meta.chains;
+ node = meta.readableChains();
if (node) {
NODE_STACK.push(node);
// process tree
while (NODE_STACK.length > 0) {
node = NODE_STACK.pop();
@@ -21698,11 +22050,11 @@
values: hash
});
}
});
// assert
-enifed('ember-routing-htmlbars/keywords/action', ['exports', 'ember-metal/features', 'htmlbars-runtime/hooks', 'ember-routing-htmlbars/keywords/closure-action'], function (exports, _emberMetalFeatures, _htmlbarsRuntimeHooks, _emberRoutingHtmlbarsKeywordsClosureAction) {
+enifed('ember-routing-htmlbars/keywords/action', ['exports', 'htmlbars-runtime/hooks', 'ember-routing-htmlbars/keywords/closure-action'], function (exports, _htmlbarsRuntimeHooks, _emberRoutingHtmlbarsKeywordsClosureAction) {
/**
@module ember
@submodule ember-templates
*/
@@ -21947,29 +22299,22 @@
}
return _emberRoutingHtmlbarsKeywordsClosureAction.default(morph, env, scope, params, hash, template, inverse, visitor);
};
});
-enifed('ember-routing-htmlbars/keywords/closure-action', ['exports', 'ember-metal/streams/stream', 'ember-metal/streams/utils', 'ember-metal/utils', 'ember-metal/property_get', 'ember-metal/error'], function (exports, _emberMetalStreamsStream, _emberMetalStreamsUtils, _emberMetalUtils, _emberMetalProperty_get, _emberMetalError) {
+enifed('ember-routing-htmlbars/keywords/closure-action', ['exports', 'ember-metal/streams/stream', 'ember-metal/streams/utils', 'ember-metal/utils', 'ember-metal/property_get', 'ember-htmlbars/hooks/subexpr', 'ember-metal/error'], function (exports, _emberMetalStreamsStream, _emberMetalStreamsUtils, _emberMetalUtils, _emberMetalProperty_get, _emberHtmlbarsHooksSubexpr, _emberMetalError) {
'use strict';
exports.default = closureAction;
var INVOKE = _emberMetalUtils.symbol('INVOKE');
exports.INVOKE = INVOKE;
var ACTION = _emberMetalUtils.symbol('ACTION');
exports.ACTION = ACTION;
function closureAction(morph, env, scope, params, hash, template, inverse, visitor) {
- return new _emberMetalStreamsStream.default(function () {
- var _this = this;
-
- params.map(this.addDependency, this);
- Object.keys(hash).map(function (item) {
- return _this.addDependency(item);
- });
-
+ var s = new _emberMetalStreamsStream.default(function () {
var rawAction = params[0];
var actionArguments = _emberMetalStreamsUtils.readArray(params.slice(1, params.length));
var target, action, valuePath;
if (rawAction[INVOKE]) {
@@ -22005,11 +22350,20 @@
// on-keypress is not even an Ember feature yet
valuePath = _emberMetalStreamsUtils.read(hash.value);
}
return createClosureAction(target, action, valuePath, actionArguments);
+ }, function () {
+ return _emberHtmlbarsHooksSubexpr.labelForSubexpr(params, hash, 'action');
});
+
+ params.forEach(s.addDependency, s);
+ Object.keys(hash).forEach(function (item) {
+ return s.addDependency(item);
+ });
+
+ return s;
}
function createClosureAction(target, action, valuePath, actionArguments) {
var closureAction;
@@ -22039,27 +22393,21 @@
closureAction[ACTION] = true;
return closureAction;
}
});
-enifed('ember-routing-htmlbars/keywords/element-action', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/utils', 'ember-metal/run_loop', 'ember-views/streams/utils', 'ember-views/system/utils', 'ember-views/system/action_manager'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalUtils, _emberMetalRun_loop, _emberViewsStreamsUtils, _emberViewsSystemUtils, _emberViewsSystemAction_manager) {
+enifed('ember-routing-htmlbars/keywords/element-action', ['exports', 'ember-metal/core', 'ember-metal/utils', 'ember-metal/run_loop', 'ember-views/streams/utils', 'ember-views/system/utils', 'ember-views/system/action_manager'], function (exports, _emberMetalCore, _emberMetalUtils, _emberMetalRun_loop, _emberViewsStreamsUtils, _emberViewsSystemUtils, _emberViewsSystemAction_manager) {
'use strict';
- function assert(message, test) {
- // This only exists to prevent defeatureify from error when attempting
- // to transform the same source twice (tldr; you can't nest stripped statements)
- _emberMetalCore.default.assert(message, test);
- }
-
exports.default = {
setupState: function (state, env, scope, params, hash) {
var getStream = env.hooks.get;
var read = env.hooks.getValue;
var actionName = read(params[0]);
- assert('You specified a quoteless path to the {{action}} helper ' + 'which did not resolve to an action name (a string). ' + 'Perhaps you meant to use a quoted actionName? (e.g. {{action \'save\'}}).', typeof actionName === 'string' || typeof actionName === 'function');
+ _emberMetalCore.default.assert('You specified a quoteless path to the {{action}} helper ' + 'which did not resolve to an action name (a string). ' + 'Perhaps you meant to use a quoted actionName? (e.g. {{action \'save\'}}).', typeof actionName === 'string' || typeof actionName === 'function');
var actionArgs = [];
for (var i = 1, l = params.length; i < l; i++) {
actionArgs.push(_emberViewsStreamsUtils.readUnwrappedModel(params[i]));
}
@@ -22146,11 +22494,10 @@
_emberMetalRun_loop.default(function runRegisteredAction() {
if (typeof actionName === 'function') {
actionName.apply(target, actionArgs);
return;
}
-
if (target.send) {
target.send.apply(target, [actionName].concat(actionArgs));
} else {
_emberMetalCore.default.assert('The action \'' + actionName + '\' did not exist on ' + target, typeof target[actionName] === 'function');
@@ -22530,85 +22877,13 @@
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/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, _emberMetalError, _emberMetalStreamsUtils, _emberRuntimeSystemString, _emberRoutingSystemGenerate_controller, _emberHtmlbarsNodeManagersViewNodeManager) {
- /**
- @module ember
- @submodule ember-templates
- */
-
+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';
- /**
- 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);
@@ -22662,11 +22937,11 @@
} else if (params.length !== 2) {
throw new _emberMetalError.default('You must pass a templateName to render');
}
var templateName = 'template:' + name;
- _emberMetalCore.default.assert('You used `{{render \'' + name + '\'}}`, but \'' + name + '\' can not be ' + 'found as either a template or a view.', container._registry.has('view:' + name) || container._registry.has(templateName) || !!template);
+ _emberMetalCore.default.assert('You used `{{render \'' + name + '\'}}`, but \'' + name + '\' can not be ' + 'found as either a template or a view.', container.registry.has('view:' + name) || container.registry.has(templateName) || !!template);
var view = container.lookup('view:' + name);
if (!view) {
view = container.lookup('view:default');
}
@@ -22686,11 +22961,11 @@
if (hash.controller) {
controllerName = hash.controller;
controllerFullName = 'controller:' + controllerName;
delete hash.controller;
- _emberMetalCore.default.assert('The controller name you supplied \'' + controllerName + '\' ' + 'did not resolve to a controller.', container._registry.has(controllerFullName));
+ _emberMetalCore.default.assert('The controller name you supplied \'' + controllerName + '\' ' + 'did not resolve to a controller.', container.registry.has(controllerFullName));
} else {
controllerName = name;
controllerFullName = 'controller:' + controllerName;
}
@@ -22770,11 +23045,11 @@
if (!selectedOutletState) {
return;
}
var matched = selectedOutletState.outlets[name];
if (matched) {
- var childState = Object.create(null);
+ var childState = new _emberMetalEmpty_object.default();
childState[matched.render.outlet] = matched;
matched.wasUsed = true;
return childState;
}
}
@@ -22815,36 +23090,33 @@
}
return true;
}
});
// assert
-enifed('ember-routing-views', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-routing-views/views/link', 'ember-routing-views/views/outlet'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberRoutingViewsViewsLink, _emberRoutingViewsViewsOutlet) {
+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;
+
exports.default = _emberMetalCore.default;
});
-enifed('ember-routing-views/views/link', ['exports', 'ember-metal/core', 'ember-metal/features', '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, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalComputed, _emberMetalComputed_macros, _emberViewsSystemUtils, _emberViewsViewsComponent, _emberRuntimeInject, _emberRuntimeSystemService, _emberRuntimeMixinsController, _emberHtmlbarsTemplatesLinkTo) {
+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.0.3';
+ _emberHtmlbarsTemplatesLinkTo.default.meta.revision = 'Ember@2.1.0-beta.1';
- var linkComponentClassNameBindings = ['active', 'loading', 'disabled'];
-
- linkComponentClassNameBindings = ['active', 'loading', 'disabled', 'transitioningIn', 'transitioningOut'];
-
/**
`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.
@@ -22968,11 +23240,11 @@
@property classNameBindings
@type Array
@default ['active', 'loading', 'disabled']
@public
*/
- classNameBindings: linkComponentClassNameBindings,
+ classNameBindings: ['active', 'loading', 'disabled', 'transitioningIn', 'transitioningOut'],
/**
By default the `{{link-to}}` helper responds to the `click` event. You
can override this globally by setting this property to your custom
event name.
@@ -23130,11 +23402,11 @@
if (targetAttribute2 && targetAttribute2 !== '_self') {
return false;
}
var routing = _emberMetalProperty_get.get(this, '_routing');
- var targetRouteName = this._handleOnlyQueryParamsSupplied(_emberMetalProperty_get.get(this, 'targetRouteName'));
+ var targetRouteName = this._computeRouteNameWithQueryParams(_emberMetalProperty_get.get(this, 'targetRouteName'));
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);
@@ -23149,11 +23421,10 @@
than `a`, this property will be ignored.
@property href
@private
*/
href: _emberMetalComputed.computed('models', 'targetRouteName', '_routing.currentState', function computeLinkComponentHref() {
-
if (_emberMetalProperty_get.get(this, 'tagName') !== 'a') {
return;
}
var targetRouteName = _emberMetalProperty_get.get(this, 'targetRouteName');
@@ -23161,11 +23432,11 @@
if (_emberMetalProperty_get.get(this, 'loading')) {
return _emberMetalProperty_get.get(this, 'loadingHref');
}
- targetRouteName = this._handleOnlyQueryParamsSupplied(targetRouteName);
+ 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);
}),
@@ -23177,11 +23448,11 @@
if (!modelsAreLoaded(models) || targetRouteName == null) {
return _emberMetalProperty_get.get(this, 'loadingClass');
}
}),
- _handleOnlyQueryParamsSupplied: function (route) {
+ _computeRouteNameWithQueryParams: function (route) {
var params = this.attrs.params.slice();
var lastParam = params[params.length - 1];
if (lastParam && lastParam.isQueryParams) {
params.pop();
}
@@ -23255,11 +23526,11 @@
params[i] = value;
}
var targetRouteName = undefined;
var models = [];
- targetRouteName = this._handleOnlyQueryParamsSupplied(params[0]);
+ targetRouteName = this._computeRouteNameWithQueryParams(params[0]);
for (var i = 1; i < params.length; i++) {
models.push(params[i]);
}
@@ -23328,20 +23599,21 @@
}
exports.default = LinkComponent;
});
// FEATURES, Logger, assert
+
// creates inject.service
enifed('ember-routing-views/views/outlet', ['exports', 'ember-views/views/view', 'ember-htmlbars/templates/top-level-view'], function (exports, _emberViewsViewsView, _emberHtmlbarsTemplatesTopLevelView) {
/**
@module ember
@submodule ember-routing-views
*/
'use strict';
- _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.0.3';
+ _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.1.0-beta.1';
var CoreOutletView = _emberViewsViewsView.default.extend({
defaultTemplate: _emberHtmlbarsTemplatesTopLevelView.default,
init: function () {
@@ -23571,25 +23843,33 @@
// 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'], function (exports, _emberRuntimeSystemLazy_load, _emberRoutingServicesRouting) {
+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: function (registry) {
- // Register the routing service...
- registry.register('service:-routing', _emberRoutingServicesRouting.default);
- // Then inject the app router into it
- registry.injection('service:-routing', 'router', 'router:main');
- }
+ 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
@@ -24632,10 +24912,11 @@
router: null,
targetState: _emberMetalComputed_macros.readOnly('router.targetState'),
currentState: _emberMetalComputed_macros.readOnly('router.currentState'),
currentRouteName: _emberMetalComputed_macros.readOnly('router.currentRouteName'),
+ currentPath: _emberMetalComputed_macros.readOnly('router.currentPath'),
availableRoutes: function () {
return Object.keys(_emberMetalProperty_get.get(this, 'router').router.recognizer.names);
},
@@ -24762,13 +25043,15 @@
function controllerFor(container, controllerName, lookupOptions) {
return container.lookup("controller:" + controllerName, lookupOptions);
}
});
-enifed('ember-routing/system/dsl', ['exports', 'ember-metal/core', 'ember-metal/features'], function (exports, _emberMetalCore, _emberMetalFeatures) {
+enifed('ember-routing/system/dsl', ['exports', 'ember-metal/core'], function (exports, _emberMetalCore) {
'use strict';
+ // FEATURES, assert
+
/**
@module ember
@submodule ember-routing
*/
@@ -24797,10 +25080,12 @@
}
return ['array', 'basic', 'object', 'application'].indexOf(name) === -1;
})());
+ _emberMetalCore.default.warn('Using a route named \'select\' (and defining a App.SelectView) will prevent you from using {{view \'select\'}}', name !== 'select', { id: 'ember-routing.dsl-select-route' });
+
if (this.enableLoadingSubstates) {
createRoute(this, name + '_loading', { resetNamespace: options.resetNamespace });
createRoute(this, name + '_error', { path: dummyErrorRoute });
}
@@ -24889,11 +25174,10 @@
var dsl = new DSL();
callback.call(dsl);
return dsl;
};
});
-// FEATURES, assert
enifed('ember-routing/system/generate_controller', ['exports', 'ember-metal/core', 'ember-metal/property_get'], function (exports, _emberMetalCore, _emberMetalProperty_get) {
'use strict';
exports.generateControllerFactory = generateControllerFactory;
exports.default = generateController;
@@ -24921,11 +25205,11 @@
}
});
fullName = 'controller:' + controllerName;
- container._registry.register(fullName, Factory);
+ container.registry.register(fullName, Factory);
return Factory;
}
/**
@@ -25778,11 +26062,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](#method_replaceWith).
+ See also 'replaceWith'.
Simple Transition Example
```javascript
App.Router.map(function() {
this.route('index');
this.route('secret');
@@ -25874,11 +26158,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
- @public
+ @private
*/
intermediateTransitionTo: function () {
var router = this.router;
router.intermediateTransitionTo.apply(router, arguments);
},
@@ -25929,11 +26213,11 @@
@param {String} name the name of the route or a URL
@param {...Object} models the model(s) or identifier(s) to be used while
transitioning to the route.
@return {Transition} the transition object associated with this
attempted transition
- @private
+ @public
*/
replaceWith: function () {
var router = this.router;
return router.replaceWith.apply(router, arguments);
},
@@ -26509,18 +26793,17 @@
return _emberRoutingSystemGenerate_controller.default(container, name, model);
},
/**
- Returns the resolved model of a parent (or any ancestor) route
+ Returns the 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. If the ancestor route's model was a promise,
- its resolved result is returned.
+ retrieve it.
Example
```javascript
App.Router.map(function() {
this.route('post', { path: '/post/:post_id' }, function() {
this.route('comments', { resetNamespace: true });
@@ -26872,17 +27155,10 @@
}
viewName = options && options.view || namePassed && name || route.viewName || name;
ViewClass = route.container.lookupFactory('view:' + viewName);
template = route.container.lookup('template:' + templateName);
- if (!ViewClass && !template) {
- _emberMetalCore.default.assert('Could not find "' + name + '" template or view.', isDefaultRender);
- if (LOG_VIEW_LOOKUPS) {
- var fullName = 'template:' + name;
- _emberMetalCore.default.Logger.info('Could not find "' + name + '" template or view. Nothing will be rendered', { fullName: fullName });
- }
- }
var parent;
if (into && (parent = parentRoute(route)) && into === parentRoute(route).routeName) {
into = undefined;
}
@@ -26894,10 +27170,20 @@
controller: controller,
ViewClass: ViewClass,
template: template
};
+ var Component = undefined;
+
+ if (!ViewClass && !template && !Component) {
+ _emberMetalCore.default.assert('Could not find "' + name + '" template, view, or component.', isDefaultRender);
+ if (LOG_VIEW_LOOKUPS) {
+ var fullName = 'template:' + name;
+ _emberMetalCore.default.Logger.info('Could not find "' + name + '" template or view. Nothing will be rendered', { fullName: fullName });
+ }
+ }
+
return renderOptions;
}
function getFullQueryParams(router, state) {
if (state.fullQueryParams) {
@@ -27009,11 +27295,11 @@
// 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', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/error', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/properties', '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, _emberMetalFeatures, _emberMetalError, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalProperties, _emberMetalComputed, _emberMetalMerge, _emberMetalRun_loop, _emberRuntimeSystemObject, _emberRuntimeMixinsEvented, _emberRoutingSystemDsl, _emberRoutingLocationApi, _emberRoutingUtils, _router_state, _router4, _routerTransition) {
+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;
}
@@ -27033,15 +27319,14 @@
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:
- * `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`
+ * `auto`
+ * `hash`
+ * `history`
+ * `none`
@property location
@default 'hash'
@see {Ember.Location}
@public
*/
@@ -27085,11 +27370,11 @@
router.map(dsl.generate());
},
init: function () {
this._activeViews = {};
- this._qpCache = Object.create(null);
+ this._qpCache = new _emberMetalEmpty_object.default();
this._resetQueuedQueryParameterChanges();
},
/*
Resets all pending query paramter changes.
@@ -27158,24 +27443,10 @@
/**
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) {
@@ -27461,11 +27732,11 @@
},
_getHandlerFunction: function () {
var _this2 = this;
- var seen = Object.create(null);
+ var seen = new _emberMetalEmpty_object.default();
var container = this.container;
var DefaultRoute = container.lookupFactory('route:basic');
return function (name) {
var routeName = 'route:' + name;
@@ -27476,11 +27747,11 @@
}
seen[name] = true;
if (!handler) {
- container._registry.register(routeName, DefaultRoute.extend());
+ container.registry.register(routeName, DefaultRoute.extend());
handler = container.lookup(routeName);
if (_emberMetalProperty_get.get(_this2, 'namespace.LOG_ACTIVE_GENERATION')) {
_emberMetalCore.default.Logger.info('generated -> ' + routeName, { fullName: routeName });
}
@@ -27827,11 +28098,11 @@
}
}
function routeHasBeenDefined(router, name) {
var container = router.container;
- return router.hasRoute(name) && (container._registry.has('template:' + name) || container._registry.has('route:' + name));
+ return router.hasRoute(name) && (container.registry.has('template:' + name) || container.registry.has('route:' + name));
}
function triggerEvent(handlerInfos, ignoreFailure, args) {
var name = args.shift();
@@ -27883,35 +28154,37 @@
}
return state;
}
function updatePaths(router) {
+ var infos = router.router.currentHandlerInfos;
+ var path = EmberRouter._routePath(infos);
+ var currentRouteName = infos[infos.length - 1].name;
+
+ _emberMetalProperty_set.set(router, 'currentPath', path);
+ _emberMetalProperty_set.set(router, 'currentRouteName', currentRouteName);
+
var appController = router.container.lookup('controller:application');
if (!appController) {
// appController might not exist when top-level loading/error
// substates have been entered since ApplicationRoute hasn't
// actually been entered at that point.
return;
}
- var infos = router.router.currentHandlerInfos;
- var path = EmberRouter._routePath(infos);
-
if (!('currentPath' in appController)) {
_emberMetalProperties.defineProperty(appController, 'currentPath');
}
_emberMetalProperty_set.set(appController, 'currentPath', path);
- _emberMetalProperty_set.set(router, 'currentPath', path);
if (!('currentRouteName' in appController)) {
_emberMetalProperties.defineProperty(appController, 'currentRouteName');
}
- _emberMetalProperty_set.set(appController, 'currentRouteName', infos[infos.length - 1].name);
- _emberMetalProperty_set.set(router, 'currentRouteName', infos[infos.length - 1].name);
+ _emberMetalProperty_set.set(appController, 'currentRouteName', currentRouteName);
}
EmberRouter.reopenClass({
router: null,
@@ -27949,11 +28222,10 @@
@method map
@param callback
@public
*/
map: function (callback) {
-
if (!this.dslCallbacks) {
this.dslCallbacks = [];
this.reopenClass({ dslCallbacks: this.dslCallbacks });
}
@@ -28007,20 +28279,10 @@
if (!router.currentState) {
router.set('currentState', routerState);
}
router.set('targetState', routerState);
-
- transition.then(null, function (error) {
- if (!error || !error.name) {
- return;
- }
-
- _emberMetalCore.default.assert('The URL \'' + error.message + '\' did not match any routes in your application', error.name !== 'UnrecognizedURLError');
-
- return error;
- }, 'Ember: Process errors from Router');
}
function resemblesURL(str) {
return typeof str === 'string' && (str === '' || str.charAt(0) === '/');
}
@@ -28060,11 +28322,11 @@
function appendLiveRoute(liveRoutes, defaultParentState, renderOptions) {
var target;
var myState = {
render: renderOptions,
- outlets: Object.create(null)
+ outlets: new _emberMetalEmpty_object.default()
};
if (renderOptions.into) {
target = findLiveRoute(liveRoutes, renderOptions.into);
} else {
target = defaultParentState;
@@ -28094,11 +28356,11 @@
if (!liveRoutes.outlets.__ember_orphans__) {
liveRoutes.outlets.__ember_orphans__ = {
render: {
name: '__ember_orphans__'
},
- outlets: Object.create(null)
+ outlets: new _emberMetalEmpty_object.default()
};
}
liveRoutes.outlets.__ember_orphans__.outlets[into] = myState;
_emberMetalCore.default.run.schedule('afterRender', function () {
// `wasUsed` gets set by the render helper. See the function
@@ -28247,17 +28509,19 @@
// given : prefix = site.article, part = site.article.id
// - returns: site.article. (use get(values[site.article], 'id') to get the dynamic part - used below)
var prefixParts = prefix.split('.');
var currPrefix = '';
+
for (var i = 0, len = prefixParts.length; i < len; i++) {
var currPart = prefixParts.slice(0, i + 1).join('.');
if (part.indexOf(currPart) !== 0) {
break;
}
currPrefix = currPart;
}
+
return currPrefix;
}
/*
Stolen from Controller
@@ -28356,11 +28620,11 @@
accum[key] = tmp;
}
}
});
-enifed('ember-runtime', ['exports', 'ember-metal', 'ember-runtime/core', 'ember-runtime/compare', 'ember-runtime/copy', 'ember-runtime/inject', 'ember-runtime/system/namespace', 'ember-runtime/system/object', 'ember-runtime/system/container', 'ember-runtime/system/array_proxy', 'ember-runtime/system/object_proxy', 'ember-runtime/system/core_object', 'ember-runtime/system/native_array', 'ember-runtime/system/string', 'ember-runtime/system/lazy_load', 'ember-runtime/mixins/array', 'ember-runtime/mixins/comparable', 'ember-runtime/mixins/copyable', 'ember-runtime/mixins/enumerable', 'ember-runtime/mixins/freezable', 'ember-runtime/mixins/-proxy', 'ember-runtime/mixins/observable', 'ember-runtime/mixins/action_handler', 'ember-runtime/mixins/mutable_enumerable', 'ember-runtime/mixins/mutable_array', 'ember-runtime/mixins/target_action_support', 'ember-runtime/mixins/evented', 'ember-runtime/mixins/promise_proxy', 'ember-runtime/computed/reduce_computed_macros', 'ember-runtime/controllers/controller', 'ember-runtime/mixins/controller', 'ember-runtime/system/service', 'ember-runtime/ext/rsvp', 'ember-runtime/ext/string', 'ember-runtime/ext/function', 'ember-runtime/utils'], function (exports, _emberMetal, _emberRuntimeCore, _emberRuntimeCompare, _emberRuntimeCopy, _emberRuntimeInject, _emberRuntimeSystemNamespace, _emberRuntimeSystemObject, _emberRuntimeSystemContainer, _emberRuntimeSystemArray_proxy, _emberRuntimeSystemObject_proxy, _emberRuntimeSystemCore_object, _emberRuntimeSystemNative_array, _emberRuntimeSystemString, _emberRuntimeSystemLazy_load, _emberRuntimeMixinsArray, _emberRuntimeMixinsComparable, _emberRuntimeMixinsCopyable, _emberRuntimeMixinsEnumerable, _emberRuntimeMixinsFreezable, _emberRuntimeMixinsProxy, _emberRuntimeMixinsObservable, _emberRuntimeMixinsAction_handler, _emberRuntimeMixinsMutable_enumerable, _emberRuntimeMixinsMutable_array, _emberRuntimeMixinsTarget_action_support, _emberRuntimeMixinsEvented, _emberRuntimeMixinsPromise_proxy, _emberRuntimeComputedReduce_computed_macros, _emberRuntimeControllersController, _emberRuntimeMixinsController, _emberRuntimeSystemService, _emberRuntimeExtRsvp, _emberRuntimeExtString, _emberRuntimeExtFunction, _emberRuntimeUtils) {
+enifed('ember-runtime', ['exports', 'ember-metal', 'ember-runtime/is-equal', 'ember-runtime/compare', 'ember-runtime/copy', 'ember-runtime/inject', 'ember-runtime/system/namespace', 'ember-runtime/system/object', 'ember-runtime/system/container', 'ember-runtime/system/array_proxy', 'ember-runtime/system/object_proxy', 'ember-runtime/system/core_object', 'ember-runtime/system/native_array', 'ember-runtime/system/string', 'ember-runtime/system/lazy_load', 'ember-runtime/mixins/array', 'ember-runtime/mixins/comparable', 'ember-runtime/mixins/copyable', 'ember-runtime/mixins/enumerable', 'ember-runtime/mixins/freezable', 'ember-runtime/mixins/-proxy', 'ember-runtime/mixins/observable', 'ember-runtime/mixins/action_handler', 'ember-runtime/mixins/mutable_enumerable', 'ember-runtime/mixins/mutable_array', 'ember-runtime/mixins/target_action_support', 'ember-runtime/mixins/evented', 'ember-runtime/mixins/promise_proxy', 'ember-runtime/computed/reduce_computed_macros', 'ember-runtime/controllers/controller', 'ember-runtime/mixins/controller', 'ember-runtime/system/service', 'ember-runtime/ext/rsvp', 'ember-runtime/ext/string', 'ember-runtime/ext/function', 'ember-runtime/utils'], function (exports, _emberMetal, _emberRuntimeIsEqual, _emberRuntimeCompare, _emberRuntimeCopy, _emberRuntimeInject, _emberRuntimeSystemNamespace, _emberRuntimeSystemObject, _emberRuntimeSystemContainer, _emberRuntimeSystemArray_proxy, _emberRuntimeSystemObject_proxy, _emberRuntimeSystemCore_object, _emberRuntimeSystemNative_array, _emberRuntimeSystemString, _emberRuntimeSystemLazy_load, _emberRuntimeMixinsArray, _emberRuntimeMixinsComparable, _emberRuntimeMixinsCopyable, _emberRuntimeMixinsEnumerable, _emberRuntimeMixinsFreezable, _emberRuntimeMixinsProxy, _emberRuntimeMixinsObservable, _emberRuntimeMixinsAction_handler, _emberRuntimeMixinsMutable_enumerable, _emberRuntimeMixinsMutable_array, _emberRuntimeMixinsTarget_action_support, _emberRuntimeMixinsEvented, _emberRuntimeMixinsPromise_proxy, _emberRuntimeComputedReduce_computed_macros, _emberRuntimeControllersController, _emberRuntimeMixinsController, _emberRuntimeSystemService, _emberRuntimeExtRsvp, _emberRuntimeExtString, _emberRuntimeExtFunction, _emberRuntimeUtils) {
/**
@module ember
@submodule ember-runtime
*/
@@ -28370,11 +28634,11 @@
// END IMPORTS
// BEGIN EXPORTS
_emberMetal.default.compare = _emberRuntimeCompare.default;
_emberMetal.default.copy = _emberRuntimeCopy.default;
- _emberMetal.default.isEqual = _emberRuntimeCore.isEqual;
+ _emberMetal.default.isEqual = _emberRuntimeIsEqual.default;
_emberMetal.default.inject = _emberRuntimeInject.default;
_emberMetal.default.Array = _emberRuntimeMixinsArray.default;
@@ -28581,17 +28845,11 @@
function reduceMacro(dependentKey, callback, initialValue) {
return _emberMetalComputed.computed(dependentKey + '.[]', function () {
var _this = this;
- var arr = _emberMetalProperty_get.get(this, dependentKey);
-
- if (arr === null || typeof arr !== 'object') {
- return initialValue;
- }
-
- return arr.reduce(function (previousValue, currentValue, index, array) {
+ return _emberMetalProperty_get.get(this, dependentKey).reduce(function (previousValue, currentValue, index, array) {
return callback.call(_this, previousValue, currentValue, index, array);
}, initialValue);
}).readOnly();
}
@@ -29178,14 +29436,10 @@
}
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);
});
@@ -29216,11 +29470,10 @@
cp._sortPropObservers.push(args);
_emberMetalObserver.addObserver.apply(null, args);
});
return _emberMetalCore.default.A(items.slice().sort(function (itemA, itemB) {
-
for (var i = 0; i < normalizedSort.length; ++i) {
var _normalizedSort$i = normalizedSort[i];
var prop = _normalizedSort$i[0];
var direction = _normalizedSort$i[1];
@@ -29388,51 +29641,17 @@
}
return _copy(obj, deep, deep ? [] : null, deep ? [] : null);
}
});
-enifed('ember-runtime/core', ['exports'], function (exports) {
- /**
- @module ember
- @submodule ember-runtime
- */
-
- /**
- Compares two objects, returning true if they are logically equal. This is
- a deeper comparison than a simple triple equal. For sets it will compare the
- internal objects. For any other object that implements `isEqual()` it will
- respect that method.
-
- ```javascript
- Ember.isEqual('hello', 'hello'); // true
- Ember.isEqual(1, 2); // false
- Ember.isEqual([4, 2], [4, 2]); // false
- ```
-
- @method isEqual
- @for Ember
- @param {Object} a first object to compare
- @param {Object} b second object to compare
- @return {Boolean}
- @public
- */
- 'use strict';
-
- exports.isEqual = isEqual;
-
- function isEqual(a, b) {
- if (a && typeof a.isEqual === 'function') {
- return a.isEqual(b);
- }
-
- if (a instanceof Date && b instanceof Date) {
- return a.getTime() === b.getTime();
- }
-
- return a === b;
- }
+enifed("ember-runtime/core", ["exports"], function (exports) {
+ "use strict";
});
+/**
+@module ember
+@submodule ember-runtime
+*/
enifed('ember-runtime/ext/function', ['exports', 'ember-metal/core', 'ember-metal/computed', 'ember-metal/mixin'], function (exports, _emberMetalCore, _emberMetalComputed, _emberMetalMixin) {
/**
@module ember
@submodule ember-runtime
*/
@@ -29441,11 +29660,10 @@
var a_slice = Array.prototype.slice;
var FunctionPrototype = Function.prototype;
if (_emberMetalCore.default.EXTEND_PROTOTYPES === true || _emberMetalCore.default.EXTEND_PROTOTYPES.Function) {
-
/**
The `property` extension of Javascript's Function prototype is available
when `Ember.EXTEND_PROTOTYPES` or `Ember.EXTEND_PROTOTYPES.Function` is
`true`, which is the default.
Computed properties allow you to treat a function like a property:
@@ -29640,10 +29858,15 @@
error.__reason_with_error_thrown__ = e;
} else {
error = e;
}
+ if (error && error.name === "UnrecognizedURLError") {
+ _emberMetalCore.default.assert("The URL '" + error.message + "' did not match any routes in your application", false);
+ return;
+ }
+
if (error && error.name !== 'TransitionAborted') {
if (_emberMetalCore.default.testing) {
// ES6TODO: remove when possible
if (!Test && _emberMetalCore.default.__loader.registry[testModuleName]) {
Test = requireModule(testModuleName)['default'];
@@ -29681,11 +29904,10 @@
'use strict';
var StringPrototype = String.prototype;
if (_emberMetalCore.default.EXTEND_PROTOTYPES === true || _emberMetalCore.default.EXTEND_PROTOTYPES.String) {
-
/**
See [Ember.String.fmt](/api/classes/Ember.String.html#method_fmt).
@method fmt
@for String
@private
@@ -29864,12 +30086,49 @@
return true;
}
});
// Ember.assert
-enifed('ember-runtime/mixins/-proxy', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/utils', 'ember-metal/observer', 'ember-metal/property_events', 'ember-metal/computed', 'ember-metal/properties', 'ember-metal/mixin'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalUtils, _emberMetalObserver, _emberMetalProperty_events, _emberMetalComputed, _emberMetalProperties, _emberMetalMixin) {
+enifed('ember-runtime/is-equal', ['exports'], function (exports) {
/**
+ Compares two objects, returning true if they are logically equal. This is
+ a deeper comparison than a simple triple equal. For sets it will compare the
+ internal objects. For any other object that implements `isEqual()` it will
+ respect that method.
+
+ ```javascript
+ Ember.isEqual('hello', 'hello'); // true
+ Ember.isEqual(1, 2); // false
+ Ember.isEqual([4, 2], [4, 2]); // false
+ Ember.isEqual({ isEqual() { return true;} }, null) // true
+ ```
+
+ @method isEqual
+ @for Ember
+ @param {Object} a first object to compare
+ @param {Object} b second object to compare
+ @return {Boolean}
+ @public
+ */
+ 'use strict';
+
+ exports.default = isEqual;
+
+ function isEqual(a, b) {
+ if (a && typeof a.isEqual === 'function') {
+ return a.isEqual(b);
+ }
+
+ if (a instanceof Date && b instanceof Date) {
+ return a.getTime() === b.getTime();
+ }
+
+ return a === b;
+ }
+});
+enifed('ember-runtime/mixins/-proxy', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/meta', 'ember-metal/observer', 'ember-metal/property_events', 'ember-metal/computed', 'ember-metal/properties', 'ember-metal/mixin'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalMeta, _emberMetalObserver, _emberMetalProperty_events, _emberMetalComputed, _emberMetalProperties, _emberMetalMixin) {
+ /**
@module ember
@submodule ember-runtime
*/
'use strict';
@@ -29934,11 +30193,11 @@
return _emberMetalProperty_get.get(content, key);
}
},
setUnknownProperty: function (key, value) {
- var m = _emberMetalUtils.meta(this);
+ var m = _emberMetalMeta.meta(this);
if (m.proto === this) {
// if marked as prototype then just defineProperty
// rather than delegate
_emberMetalProperties.defineProperty(this, key, null, value);
return value;
@@ -29952,11 +30211,11 @@
}
});
});
// Ember.assert
-enifed('ember-runtime/mixins/action_handler', ['exports', 'ember-metal/core', 'ember-metal/mixin', 'ember-metal/property_get'], function (exports, _emberMetalCore, _emberMetalMixin, _emberMetalProperty_get) {
+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) {
/**
@module ember
@submodule ember-runtime
*/
'use strict';
@@ -30122,41 +30381,18 @@
var _target;
_emberMetalCore.default.assert('The `target` for ' + this + ' (' + target + ') does not have a `send` method', typeof target.send === 'function');
(_target = target).send.apply(_target, arguments);
}
- },
-
- willMergeMixin: function (props) {
- _emberMetalCore.default.assert('Specifying `_actions` and `actions` in the same mixin is not supported.', !props.actions || !props._actions);
-
- if (props._actions) {
- _emberMetalCore.default.deprecate('Specifying actions in `_actions` is deprecated, please use `actions` instead.', false, { id: 'ember-runtime.action-handler-_actions', until: '3.0.0' });
-
- props.actions = props._actions;
- delete props._actions;
- }
}
});
exports.default = ActionHandler;
function deprecateUnderscoreActions(factory) {
- function deprecate() {
- _emberMetalCore.default.deprecate('Usage of `_actions` is deprecated, use `actions` instead.', false, { id: 'ember-runtime.action-handler-_actions', until: '3.0.0' });
- }
-
- Object.defineProperty(factory.prototype, '_actions', {
- configurable: true,
- enumerable: false,
- set: function (value) {
- _emberMetalCore.default.assert('You cannot set `_actions` on ' + this + ', please use `actions` instead.');
- },
- get: function () {
- deprecate();
- return _emberMetalProperty_get.get(this, 'actions');
- }
+ _emberMetalDeprecate_property.deprecateProperty(factory.prototype, '_actions', 'actions', {
+ id: 'ember-runtime.action-handler-_actions', until: '3.0.0'
});
}
});
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) {
/**
@@ -30215,11 +30451,11 @@
You can use the methods defined in this module to access and modify array
contents in a KVO-friendly way. You can also be notified whenever the
membership of an array changes by using `.observes('myArray.[]')`.
To support `Ember.Array` in your own class, you must override two
- primitives to use it: `replace()` and `objectAt()`.
+ primitives to use it: `length()` and `objectAt()`.
Note that the Ember.Array mixin also incorporates the `Ember.Enumerable`
mixin. All `Ember.Array`-like objects are also enumerable.
@class Array
@@ -30682,10 +30918,83 @@
@private
*/
compare: null
});
});
+enifed('ember-runtime/mixins/container_proxy', ['exports', 'ember-metal/run_loop', 'ember-metal/mixin'], function (exports, _emberMetalRun_loop, _emberMetalMixin) {
+ 'use strict';
+
+ exports.default = _emberMetalMixin.Mixin.create({
+ /**
+ The container stores state.
+ @private
+ @property {Ember.Container} __container__
+ */
+ __container__: null,
+
+ /**
+ Given a fullName return a corresponding instance.
+ The default behaviour is for lookup to return a singleton instance.
+ The singleton is scoped to the container, allowing multiple containers
+ to all have their own locally scoped singletons.
+ ```javascript
+ var registry = new Registry();
+ var container = registry.container();
+ registry.register('api:twitter', Twitter);
+ var twitter = container.lookup('api:twitter');
+ twitter instanceof Twitter; // => true
+ // by default the container will return singletons
+ var twitter2 = container.lookup('api:twitter');
+ twitter2 instanceof Twitter; // => true
+ twitter === twitter2; //=> true
+ ```
+ If singletons are not wanted an optional flag can be provided at lookup.
+ ```javascript
+ var registry = new Registry();
+ var container = registry.container();
+ registry.register('api:twitter', Twitter);
+ var twitter = container.lookup('api:twitter', { singleton: false });
+ var twitter2 = container.lookup('api:twitter', { singleton: false });
+ twitter === twitter2; //=> false
+ ```
+ @public
+ @method lookup
+ @param {String} fullName
+ @param {Object} options
+ @return {any}
+ */
+ lookup: containerAlias('lookup'),
+
+ /**
+ Given a fullName return the corresponding factory.
+ @private
+ @method _lookupFactory
+ @param {String} fullName
+ @return {any}
+ */
+ _lookupFactory: containerAlias('lookupFactory'),
+
+ /**
+ @private
+ */
+ willDestroy: function () {
+ this._super.apply(this, arguments);
+
+ if (this.__container__) {
+ _emberMetalRun_loop.default(this.__container__, 'destroy');
+ }
+ }
+ });
+
+ function containerAlias(name) {
+ return function () {
+ var _container__;
+
+ return (_container__ = this.__container__)[name].apply(_container__, arguments);
+ };
+ }
+});
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
@@ -30709,11 +31018,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
- @public
+ @private
*/
target: null,
container: null,
@@ -31422,11 +31731,11 @@
@method isAny
@param {String} key the property to test
@param {String} [value] optional value to test against. Defaults to `true`
@return {Boolean}
@since 1.3.0
- @private
+ @public
*/
isAny: function (key, value) {
return this.any(iter.apply(this, arguments));
},
@@ -32179,11 +32488,10 @@
@return {Ember.Array} receiver
@public
*/
removeAt: function (start, len) {
if ('number' === typeof start) {
-
if (start < 0 || start >= _emberMetalProperty_get.get(this, 'length')) {
throw new _emberMetalError.default(OUT_OF_RANGE_EXCEPTION);
}
// fast case
@@ -32563,14 +32871,13 @@
call to the end of your method declarations in classes that you write.
For example:
```javascript
Ember.Object.extend({
- valueObserver: Ember.observer('value', function(sender, key, value, rev) {
+ valueObserver: function() {
// Executes whenever the "value" property changes
- // See the addObserver method for more information about the callback arguments
- })
+ }.observes('value')
});
```
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
@@ -33151,10 +33458,218 @@
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) {
+ 'use strict';
+
+ exports.default = _emberMetalMixin.Mixin.create({
+ __registry__: null,
+
+ /**
+ Given a fullName return the corresponding factory.
+ @public
+ @method resolveRegistration
+ @param {String} fullName
+ @return {Function} fullName's factory
+ */
+ resolveRegistration: registryAlias('resolve'),
+
+ /**
+ Registers a factory that can be used for dependency injection (with
+ `inject`) or for service lookup. Each factory is registered with
+ a full name including two parts: `type:name`.
+ A simple example:
+ ```javascript
+ var App = Ember.Application.create();
+ App.Orange = Ember.Object.extend();
+ App.register('fruit:favorite', App.Orange);
+ ```
+ Ember will resolve factories from the `App` namespace automatically.
+ For example `App.CarsController` will be discovered and returned if
+ an application requests `controller:cars`.
+ An example of registering a controller with a non-standard name:
+ ```javascript
+ var App = Ember.Application.create();
+ var Session = Ember.Controller.extend();
+ App.register('controller:session', Session);
+ // The Session controller can now be treated like a normal controller,
+ // despite its non-standard name.
+ App.ApplicationController = Ember.Controller.extend({
+ needs: ['session']
+ });
+ ```
+ Registered factories are **instantiated** by having `create`
+ called on them. Additionally they are **singletons**, each time
+ they are looked up they return the same instance.
+ Some examples modifying that default behavior:
+ ```javascript
+ var App = Ember.Application.create();
+ App.Person = Ember.Object.extend();
+ App.Orange = Ember.Object.extend();
+ App.Email = Ember.Object.extend();
+ App.session = Ember.Object.create();
+ App.register('model:user', App.Person, { singleton: false });
+ App.register('fruit:favorite', App.Orange);
+ App.register('communication:main', App.Email, { singleton: false });
+ App.register('session', App.session, { instantiate: false });
+ ```
+ @public
+ @method register
+ @param fullName {String} type:name (e.g., 'model:user')
+ @param factory {Function} (e.g., App.Person)
+ @param options {Object} (optional) disable instantiation or singleton usage
+ @public
+ */
+ register: registryAlias('register'),
+
+ /**
+ Unregister a factory.
+ ```javascript
+ var App = Ember.Application.create();
+ var User = Ember.Object.extend();
+ App.register('model:user', User);
+ App.resolveRegistration('model:user').create() instanceof User //=> true
+ App.unregister('model:user')
+ App.resolveRegistration('model:user') === undefined //=> true
+ ```
+ @public
+ @method unregister
+ @param {String} fullName
+ */
+ unregister: registryAlias('unregister'),
+
+ /**
+ Check if a factory is registered.
+ @public
+ @method hasRegistration
+ @param {String} fullName
+ @return {Boolean}
+ */
+ hasRegistration: registryAlias('has'),
+
+ /**
+ Register an option for a particular factory.
+ @public
+ @method registerOption
+ @param {String} fullName
+ @param {String} optionName
+ @param {Object} options
+ */
+ registerOption: registryAlias('option'),
+
+ /**
+ Return a specific registered option for a particular factory.
+ @public
+ @method registeredOption
+ @param {String} fullName
+ @param {String} optionName
+ @return {Object} options
+ */
+ registeredOption: registryAlias('getOption'),
+
+ /**
+ Register options for a particular factory.
+ @public
+ @method registerOptions
+ @param {String} fullName
+ @param {Object} options
+ */
+ registerOptions: registryAlias('options'),
+
+ /**
+ Return registered options for a particular factory.
+ @public
+ @method registeredOptions
+ @param {String} fullName
+ @return {Object} options
+ */
+ registeredOptions: registryAlias('getOptions'),
+
+ /**
+ Allow registering options for all factories of a type.
+ ```javascript
+ var App = Ember.Application.create();
+ var appInstance = App.buildInstance();
+ // if all of type `connection` must not be singletons
+ appInstance.optionsForType('connection', { singleton: false });
+ appInstance.register('connection:twitter', TwitterConnection);
+ appInstance.register('connection:facebook', FacebookConnection);
+ var twitter = appInstance.lookup('connection:twitter');
+ var twitter2 = appInstance.lookup('connection:twitter');
+ twitter === twitter2; // => false
+ var facebook = appInstance.lookup('connection:facebook');
+ var facebook2 = appInstance.lookup('connection:facebook');
+ facebook === facebook2; // => false
+ ```
+ @public
+ @method registerOptionsForType
+ @param {String} type
+ @param {Object} options
+ */
+ registerOptionsForType: registryAlias('optionsForType'),
+
+ /**
+ Return the registered options for all factories of a type.
+ @public
+ @method registeredOptionsForType
+ @param {String} type
+ @return {Object} options
+ */
+ registeredOptionsForType: registryAlias('getOptionsForType'),
+
+ /**
+ Define a dependency injection onto a specific factory or all factories
+ of a type.
+ When Ember instantiates a controller, view, or other framework component
+ it can attach a dependency to that component. This is often used to
+ provide services to a set of framework components.
+ An example of providing a session object to all controllers:
+ ```javascript
+ var App = Ember.Application.create();
+ var Session = Ember.Object.extend({ isAuthenticated: false });
+ // A factory must be registered before it can be injected
+ App.register('session:main', Session);
+ // Inject 'session:main' onto all factories of the type 'controller'
+ // with the name 'session'
+ App.inject('controller', 'session', 'session:main');
+ App.IndexController = Ember.Controller.extend({
+ isLoggedIn: Ember.computed.alias('session.isAuthenticated')
+ });
+ ```
+ Injections can also be performed on specific factories.
+ ```javascript
+ App.inject(<full_name or type>, <property name>, <full_name>)
+ App.inject('route', 'source', 'source:main')
+ App.inject('route:application', 'email', 'model:email')
+ ```
+ It is important to note that injections can only be performed on
+ classes that are instantiated by Ember itself. Instantiating a class
+ directly (via `create` or `new`) bypasses the dependency injection
+ system.
+ **Note:** Ember-Data instantiates its models in a unique manner, and consequently
+ injections onto models (or all models) will not work as expected. Injections
+ on models can be enabled by setting `Ember.MODEL_FACTORY_INJECTIONS`
+ to `true`.
+ @public
+ @method inject
+ @param factoryNameOrType {String}
+ @param property {String}
+ @param injectionName {String}
+ **/
+ inject: registryAlias('injection')
+ });
+
+ function registryAlias(name) {
+ return function () {
+ var _registry__;
+
+ return (_registry__ = this.__registry__)[name].apply(_registry__, 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
*/
@@ -33369,19 +33884,33 @@
`Ember.MutableArray.`
@property content
@type Ember.Array
@private
*/
- content: null,
+ content: _emberMetalComputed.computed({
+ get: function () {
+ return this._content;
+ },
+ set: function (k, v) {
+ if (this._didInitArrayProxy) {
+ var oldContent = this._content;
+ var len = oldContent ? _emberMetalProperty_get.get(oldContent, 'length') : 0;
+ this.arrangedContentArrayWillChange(this, 0, len, undefined);
+ this.arrangedContentWillChange(this);
+ }
+ this._content = v;
+ return v;
+ }
+ }),
/**
The array that the proxy pretends to be. In the default `ArrayProxy`
implementation, this and `content` are the same. Subclasses of `ArrayProxy`
can override this property to provide things like sorting and filtering.
@property arrangedContent
@private
- */
+ */
arrangedContent: _emberMetalAlias.default('content'),
/**
Should actually retrieve the object at the specified index from the
content. You can override this method in subclasses to transform the
@@ -33411,23 +33940,11 @@
*/
replaceContent: function (idx, amt, objects) {
_emberMetalProperty_get.get(this, 'content').replace(idx, amt, objects);
},
- /**
- Invoked when the content property is about to change. Notifies observers that the
- entire array content will change.
- @private
- @method _contentWillChange
- */
- _contentWillChange: _emberMetalMixin._beforeObserver('content', function () {
- this._teardownContent();
- }),
-
- _teardownContent: function () {
- var content = _emberMetalProperty_get.get(this, 'content');
-
+ _teardownContent: function (content) {
if (content) {
content.removeArrayObserver(this, {
willChange: 'contentArrayWillChange',
didChange: 'contentArrayDidChange'
});
@@ -33461,18 +33978,20 @@
@private
@method _contentDidChange
*/
_contentDidChange: _emberMetalMixin.observer('content', function () {
var content = _emberMetalProperty_get.get(this, 'content');
+ this._teardownContent(this._prevContent);
_emberMetalCore.default.assert('Can\'t set ArrayProxy\'s content to itself', content !== this);
this._setupContent();
}),
_setupContent: function () {
var content = _emberMetalProperty_get.get(this, 'content');
+ this._prevContent = content;
if (content) {
_emberMetalCore.default.assert('ArrayProxy expects an Array or Ember.ArrayProxy, but you passed ' + typeof content, _emberRuntimeUtils.isArray(content) || content.isDestroyed);
content.addArrayObserver(this, {
@@ -33480,21 +33999,12 @@
didChange: 'contentArrayDidChange'
});
}
},
- _arrangedContentWillChange: _emberMetalMixin._beforeObserver('arrangedContent', function () {
- var arrangedContent = _emberMetalProperty_get.get(this, 'arrangedContent');
- var len = arrangedContent ? _emberMetalProperty_get.get(arrangedContent, 'length') : 0;
-
- this.arrangedContentArrayWillChange(this, 0, len, undefined);
- this.arrangedContentWillChange(this);
-
- this._teardownArrangedContent(arrangedContent);
- }),
-
_arrangedContentDidChange: _emberMetalMixin.observer('arrangedContent', function () {
+ this._teardownArrangedContent(this._prevArrangedContent);
var arrangedContent = _emberMetalProperty_get.get(this, 'arrangedContent');
var len = arrangedContent ? _emberMetalProperty_get.get(arrangedContent, 'length') : 0;
_emberMetalCore.default.assert('Can\'t set ArrayProxy\'s content to itself', arrangedContent !== this);
@@ -33504,10 +34014,11 @@
this.arrangedContentArrayDidChange(this, 0, undefined, len);
}),
_setupArrangedContent: function () {
var arrangedContent = _emberMetalProperty_get.get(this, 'arrangedContent');
+ this._prevArrangedContent = arrangedContent;
if (arrangedContent) {
_emberMetalCore.default.assert('ArrayProxy expects an Array or Ember.ArrayProxy, but you passed ' + typeof arrangedContent, _emberRuntimeUtils.isArray(arrangedContent) || arrangedContent.isDestroyed);
arrangedContent.addArrayObserver(this, {
@@ -33657,18 +34168,19 @@
arrangedContentArrayDidChange: function (item, idx, removedCnt, addedCnt) {
this.arrayContentDidChange(idx, removedCnt, addedCnt);
},
init: function () {
+ this._didInitArrayProxy = true;
this._super.apply(this, arguments);
this._setupContent();
this._setupArrangedContent();
},
willDestroy: function () {
this._teardownArrangedContent();
- this._teardownContent();
+ this._teardownContent(this.get('content'));
}
});
exports.default = ArrayProxy;
});
@@ -33680,11 +34192,11 @@
_containerContainer.default.set = _emberMetalProperty_set.set;
exports.Registry = _containerRegistry.default;
exports.Container = _containerContainer.default;
});
-enifed('ember-runtime/system/core_object', ['exports', 'ember-metal', 'ember-metal/features', 'ember-metal/merge', 'ember-metal/property_get', 'ember-metal/utils', 'ember-metal/chains', 'ember-metal/events', 'ember-metal/mixin', 'ember-metal/error', 'ember-runtime/mixins/action_handler', 'ember-metal/properties', 'ember-metal/binding', 'ember-metal/computed', 'ember-metal/injected_property', 'ember-metal/run_loop', 'ember-metal/watching', 'ember-metal/core', 'ember-runtime/inject'], function (exports, _emberMetal, _emberMetalFeatures, _emberMetalMerge, _emberMetalProperty_get, _emberMetalUtils, _emberMetalChains, _emberMetalEvents, _emberMetalMixin, _emberMetalError, _emberRuntimeMixinsAction_handler, _emberMetalProperties, _emberMetalBinding, _emberMetalComputed, _emberMetalInjected_property, _emberMetalRun_loop, _emberMetalWatching, _emberMetalCore, _emberRuntimeInject) {
+enifed('ember-runtime/system/core_object', ['exports', 'ember-metal', 'ember-metal/features', 'ember-metal/merge', 'ember-metal/property_get', 'ember-metal/utils', 'ember-metal/meta', 'ember-metal/chains', 'ember-metal/events', 'ember-metal/mixin', 'ember-metal/error', 'ember-runtime/mixins/action_handler', 'ember-metal/properties', 'ember-metal/binding', 'ember-metal/computed', 'ember-metal/injected_property', 'ember-metal/run_loop', 'ember-metal/watching', 'ember-metal/core', 'ember-runtime/inject'], function (exports, _emberMetal, _emberMetalFeatures, _emberMetalMerge, _emberMetalProperty_get, _emberMetalUtils, _emberMetalMeta, _emberMetalChains, _emberMetalEvents, _emberMetalMixin, _emberMetalError, _emberRuntimeMixinsAction_handler, _emberMetalProperties, _emberMetalBinding, _emberMetalComputed, _emberMetalInjected_property, _emberMetalRun_loop, _emberMetalWatching, _emberMetalCore, _emberRuntimeInject) {
// Remove "use strict"; from transpiled module until
// https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
//
'REMOVE_USE_STRICT: true';
@@ -33702,11 +34214,10 @@
var finishPartial = _emberMetalMixin.Mixin.finishPartial;
var reopen = _emberMetalMixin.Mixin.prototype.reopen;
var hasCachedComputedProperties = false;
function makeCtor() {
-
// Note: avoid accessing any properties on the object since it makes the
// method a lot faster. This is glue code so we want it to be as fast as
// possible.
var wasApplied = false;
@@ -33714,13 +34225,17 @@
var Class = function () {
if (!wasApplied) {
Class.proto(); // prepare prototype...
}
+
+ if (arguments.length > 0) {
+ initProperties = [arguments[0]];
+ }
+
this.__defineNonEnumerable(_emberMetalUtils.GUID_KEY_PROPERTY);
- this.__defineNonEnumerable(_emberMetalUtils.NEXT_SUPER_PROPERTY);
- var m = _emberMetalUtils.meta(this);
+ var m = _emberMetalMeta.meta(this);
var proto = m.proto;
m.proto = this;
if (initMixins) {
// capture locally so we can clear the closed over variable
var mixins = initMixins;
@@ -33753,17 +34268,11 @@
for (var j = 0, ll = keyNames.length; j < ll; j++) {
var keyName = keyNames[j];
var value = properties[keyName];
if (_emberMetalMixin.IS_BINDING.test(keyName)) {
- var bindings = m.bindings;
- if (!bindings) {
- bindings = m.bindings = {};
- } else if (!m.hasOwnProperty('bindings')) {
- bindings = m.bindings = Object.create(m.bindings);
- }
- bindings[keyName] = value;
+ m.writableBindings()[keyName] = value;
}
var possibleDesc = this[keyName];
var desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
@@ -34175,11 +34684,11 @@
Class.__super__ = this.prototype;
proto = Class.prototype = Object.create(this.prototype);
proto.constructor = Class;
_emberMetalUtils.generateGuid(proto);
- _emberMetalUtils.meta(proto).proto = proto; // this will disable observers on prototype
+ _emberMetalMeta.meta(proto).proto = proto; // this will disable observers on prototype
Class.ClassMixin.apply(Class);
return Class;
},
@@ -34362,11 +34871,11 @@
var properties = [];
for (var name in proto) {
property = proto[name];
- if (property instanceof _emberMetalComputed.ComputedProperty) {
+ if (property && property.isDescriptor) {
properties.push({
name: name,
meta: property._meta
});
}
@@ -34445,11 +34954,11 @@
didDefineProperty: function (proto, key, value) {
if (hasCachedComputedProperties === false) {
return;
}
if (value instanceof _emberMetal.default.ComputedProperty) {
- var cache = _emberMetal.default.meta(this.constructor).cache;
+ var cache = _emberMetal.default.meta(this.constructor).readableCache();
if (cache && cache._computedProperties !== undefined) {
cache._computedProperties = undefined;
}
}
@@ -34461,11 +34970,11 @@
// 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.
-enifed('ember-runtime/system/each_proxy', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/observer', 'ember-metal/property_events'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalObserver, _emberMetalProperty_events) {
+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
array. It uses the unknownProperty handler to automatically create
@@ -34478,21 +34987,22 @@
this._keys = undefined;
this.__ember_meta__ = undefined;
}
EachProxy.prototype = {
+ __defineNonEnumerable: function (property) {
+ this[property.name] = property.descriptor.value;
+ },
+
// ..........................................................
// ARRAY CHANGES
// Invokes whenever the content array itself changes.
arrayWillChange: function (content, idx, removedCnt, addedCnt) {
var keys = this._keys;
var lim = removedCnt > 0 ? idx + removedCnt : -1;
for (var key in keys) {
- if (!keys.hasOwnProperty(key)) {
- continue;
- }
if (lim > 0) {
removeObserverForContentKey(content, key, this, idx, lim);
}
_emberMetalProperty_events.propertyWillChange(this, key);
}
@@ -34500,13 +35010,10 @@
arrayDidChange: function (content, idx, removedCnt, addedCnt) {
var keys = this._keys;
var lim = addedCnt > 0 ? idx + addedCnt : -1;
for (var key in keys) {
- if (!keys.hasOwnProperty(key)) {
- continue;
- }
if (lim > 0) {
addObserverForContentKey(content, key, this, idx, lim);
}
_emberMetalProperty_events.propertyDidChange(this, key);
}
@@ -34529,11 +35036,11 @@
// Actual watch keys on the source content.
beginObservingContentKey: function (keyName) {
var keys = this._keys;
if (!keys) {
- keys = this._keys = {};
+ keys = this._keys = new _emberMetalEmpty_object.default();
}
if (!keys[keyName]) {
keys[keyName] = 1;
var content = this._content;
@@ -34941,11 +35448,10 @@
return this[idx];
},
// primitive for array support.
replace: function (idx, amt, objects) {
-
if (this.isFrozen) {
throw _emberRuntimeMixinsFreezable.FROZEN_ERROR;
}
// if we replaced exactly the same number of items, then pass only the
@@ -35167,11 +35673,11 @@
@class ObjectProxy
@namespace Ember
@extends Ember.Object
@extends Ember._ProxyMixin
- @private
+ @public
*/
exports.default = _emberRuntimeSystemObject.default.extend(_emberRuntimeMixinsProxy.default);
});
enifed('ember-runtime/system/service', ['exports', 'ember-runtime/system/object', 'ember-runtime/inject'], function (exports, _emberRuntimeSystemObject, _emberRuntimeInject) {
@@ -35680,20 +36186,21 @@
}
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-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, _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/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) {
'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);
if (_emberMetal.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformEachIntoCollection.default);
} else {
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths.default);
@@ -36074,11 +36581,10 @@
var walker = new pluginContext.syntax.Walker();
var b = pluginContext.syntax.builders;
walker.visit(ast, function (node) {
if (pluginContext.validate(node)) {
-
if (node.program && node.program.blockParams.length) {
throw new Error('You cannot use keyword (`{{each foo in bar}}`) and block params (`{{each bar as |foo|}}`) at the same time.');
}
var removedParams = node.sexpr.params.splice(0, 2);
@@ -36123,11 +36629,11 @@
return;
}
var moduleInfo = _emberTemplateCompilerSystemCalculateLocationDisplay.default(moduleName, legacyHashKey.loc);
- _emberMetalCore.default.deprecate('Using \'' + legacyHashKey.key + '\' with \'{{each}}\' ' + moduleInfo + 'is deprecated. Please refactor to a component.');
+ _emberMetalCore.default.deprecate('Using \'' + legacyHashKey.key + '\' with \'{{each}}\' ' + moduleInfo + 'is deprecated. Please refactor to a component.', false, { id: 'ember-template-compiler.transform-each-into-collection', until: '2.0.0' });
var list = node.params.shift();
node.path = b.path('collection');
node.params.unshift(b.string('-legacy-each'));
@@ -36144,11 +36650,10 @@
return ast;
};
function validate(node) {
if ((node.type === 'BlockStatement' || node.type === 'MustacheStatement') && node.path.original === 'each') {
-
return any(node.hash.pairs, function (pair) {
var key = pair.key;
return key === 'itemController' || key === 'itemView' || key === 'itemViewClass' || key === 'tagName' || key === 'emptyView' || key === 'emptyViewClass';
});
}
@@ -36216,21 +36721,21 @@
var onEvent = hashPairForKey(node.hash, 'onEvent');
var normalizedOn = on || onEvent;
var moduleInfo = _emberTemplateCompilerSystemCalculateLocationDisplay.default(moduleName, node.loc);
if (normalizedOn && normalizedOn.value.type !== 'StringLiteral') {
- _emberMetalCore.default.deprecate('Using a dynamic value for \'#{normalizedOn.key}=\' with the \'{{input}}\' helper ' + moduleInfo + 'is deprecated.');
+ _emberMetalCore.default.deprecate('Using a dynamic value for \'#{normalizedOn.key}=\' with the \'{{input}}\' helper ' + moduleInfo + 'is deprecated.', false, { id: 'ember-template-compiler.transform-input-on-to-onEvent.dynamic-value', until: '3.0.0' });
normalizedOn.key = 'onEvent';
return; // exit early, as we cannot transform further
}
removeFromHash(node.hash, normalizedOn);
removeFromHash(node.hash, action);
if (!action) {
- _emberMetalCore.default.deprecate('Using \'{{input ' + normalizedOn.key + '="' + normalizedOn.value.value + '" ...}}\' without specifying an action ' + moduleInfo + 'will do nothing.');
+ _emberMetalCore.default.deprecate('Using \'{{input ' + normalizedOn.key + '="' + normalizedOn.value.value + '" ...}}\' without specifying an action ' + moduleInfo + 'will do nothing.', false, { id: 'ember-template-compiler.transform-input-on-to-onEvent.no-action', until: '3.0.0' });
return; // exit early, if no action was available there is nothing to do
}
var specifiedOn = normalizedOn ? normalizedOn.key + '="' + normalizedOn.value.value + '" ' : '';
@@ -36240,11 +36745,11 @@
normalizedOn.value.value = 'key-press';
}
var expected = (normalizedOn ? normalizedOn.value.value : 'enter') + '="' + action.value.original + '"';
- _emberMetalCore.default.deprecate('Using \'{{input ' + specifiedOn + 'action="' + action.value.original + '"}}\' ' + moduleInfo + 'is deprecated. Please use \'{{input ' + expected + '}}\' instead.');
+ _emberMetalCore.default.deprecate('Using \'{{input ' + specifiedOn + 'action="' + action.value.original + '"}}\' ' + moduleInfo + 'is deprecated. Please use \'{{input ' + expected + '}}\' instead.', false, { id: 'ember-template-compiler.transform-input-on-to-onEvent.normalized-on', until: '3.0.0' });
if (!normalizedOn) {
normalizedOn = b.pair('onEvent', b.string('enter'));
}
node.hash.pairs.push(b.pair(normalizedOn.value.value, action.value));
@@ -36370,11 +36875,11 @@
_emberMetalCore.default.assert('Setting \'attributeBindings\' via template helpers is not allowed ' + sourceInformation, key !== 'attributeBindings');
if (key.substr(-7) === 'Binding') {
var newKey = key.slice(0, -7);
- _emberMetalCore.default.deprecate('You\'re using legacy binding syntax: ' + key + '=' + exprToString(value) + ' ' + sourceInformation + '. Please replace with ' + newKey + '=' + value.original);
+ _emberMetalCore.default.deprecate('You\'re using legacy binding syntax: ' + key + '=' + exprToString(value) + ' ' + sourceInformation + '. Please replace with ' + newKey + '=' + value.original, false, { id: 'ember-template-compiler.transform-old-binding-syntax', until: '3.0.0' });
pair.key = newKey;
if (value.type === 'StringLiteral') {
pair.value = b.path(value.original);
}
@@ -36542,10 +37047,66 @@
}
return segments;
}
});
+enifed('ember-template-compiler/plugins/transform-top-level-components', ['exports'], function (exports) {
+ 'use strict';
+
+ function TransformTopLevelComponents() {
+ // set later within HTMLBars to the syntax package
+ this.syntax = null;
+ }
+
+ /**
+ @private
+ @method transform
+ @param {AST} The AST to be transformed.
+ */
+ TransformTopLevelComponents.prototype.transform = function TransformTopLevelComponents_transform(ast) {
+ hasSingleComponentNode(ast.body, function (component) {
+ component.tag = '@' + component.tag;
+ });
+
+ return ast;
+ };
+
+ function hasSingleComponentNode(body, callback) {
+ var lastComponentNode = undefined;
+ var lastIndex = undefined;
+ var nodeCount = 0;
+
+ for (var i = 0, l = body.length; i < l; i++) {
+ var curr = body[i];
+
+ // text node with whitespace only
+ if (curr.type === 'TextNode' && /^[\s]*$/.test(curr.chars)) {
+ continue;
+ }
+
+ // has multiple root elements if we've been here before
+ if (nodeCount++ > 0) {
+ return false;
+ }
+
+ if (curr.type === 'ComponentNode' || curr.type === 'ElementNode') {
+ lastComponentNode = curr;
+ lastIndex = i;
+ }
+ }
+
+ if (!lastComponentNode) {
+ return;
+ }
+
+ if (lastComponentNode.type === 'ComponentNode') {
+ callback(lastComponentNode);
+ }
+ }
+
+ exports.default = TransformTopLevelComponents;
+});
enifed('ember-template-compiler/system/calculate-location-display', ['exports'], function (exports) {
'use strict';
exports.default = calculateLocationDisplay;
@@ -36610,11 +37171,11 @@
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/merge', 'ember-template-compiler/plugins'], function (exports, _emberMetalFeatures, _emberMetalMerge, _emberTemplateCompilerPlugins) {
+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
*/
@@ -36633,11 +37194,11 @@
// had a special meaning (long since lost), this just gaurds against
// `options` being true, and causing an error during compilation.
if (_options === true) {
options = {};
} else {
- options = _emberMetalMerge.assign({}, _options);
+ options = _emberMetalAssign.default({}, _options);
}
options.disableComponentGeneration = disableComponentGeneration;
var plugins = {
@@ -36649,18 +37210,65 @@
}
options.plugins = plugins;
options.buildMeta = function buildMeta(program) {
return {
- revision: 'Ember@2.0.3',
+ topLevel: detectTopLevel(program),
+ revision: 'Ember@2.1.0-beta.1',
loc: program.loc,
moduleName: options.moduleName
};
};
return options;
};
+
+ function detectTopLevel(program) {
+ var loc = program.loc;
+ var body = program.body;
+
+ if (!loc || loc.start.line !== 1 || loc.start.column !== 0) {
+ return null;
+ }
+
+ var lastComponentNode = undefined;
+ var lastIndex = undefined;
+ var nodeCount = 0;
+
+ for (var i = 0, l = body.length; i < l; i++) {
+ var curr = body[i];
+
+ // text node with whitespace only
+ if (curr.type === 'TextNode' && /^[\s]*$/.test(curr.chars)) {
+ continue;
+ }
+
+ // has multiple root elements if we've been here before
+ if (nodeCount++ > 0) {
+ return false;
+ }
+
+ if (curr.type === 'ComponentNode' || curr.type === 'ElementNode') {
+ lastComponentNode = curr;
+ lastIndex = i;
+ }
+ }
+
+ if (!lastComponentNode) {
+ return null;
+ }
+
+ if (lastComponentNode.type === 'ComponentNode') {
+ var tag = lastComponentNode.tag;
+ if (tag.charAt(0) !== '<') {
+ return null;
+ }
+ return tag.slice(1, -1);
+ }
+
+ return null;
+ }
});
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
@@ -37348,11 +37956,11 @@
_emberRuntimeSystemLazy_load.onLoad('Ember.Application', function (Application) {
if (!Application.initializers[name]) {
Application.initializer({
name: name,
- initialize: function (registry, application) {
+ initialize: function (application) {
if (application.testing) {
application.deferReadiness();
}
}
});
@@ -38112,11 +38720,11 @@
initializeShape: _emberMetalEvents.on('init', function () {
this._isDispatchingAttrs = false;
}),
- _internalDidReceiveAttrs: function () {
+ didReceiveAttrs: function () {
this._super();
this._isDispatchingAttrs = true;
this._propagateAttrsToThis();
this._isDispatchingAttrs = false;
},
@@ -38216,28 +38824,27 @@
return true;
}
},
lookupFactory: function (name, container) {
-
container = container || this.container;
var fullName = 'component:' + name;
var templateFullName = 'template:components/' + name;
- var templateRegistered = container && container._registry.has(templateFullName);
+ var templateRegistered = container && container.registry.has(templateFullName);
if (templateRegistered) {
- container._registry.injection(fullName, 'layout', templateFullName);
+ container.registry.injection(fullName, 'layout', templateFullName);
}
var Component = container.lookupFactory(fullName);
// Only treat as a component if either the component
// or a template has been registered.
if (templateRegistered || Component) {
if (!Component) {
- container._registry.register(fullName, _emberMetalCore.default.Component);
+ container.registry.register(fullName, _emberMetalCore.default.Component);
Component = container.lookupFactory(fullName);
}
return Component;
}
},
@@ -39670,42 +40277,50 @@
*/
ActionManager.registeredActions = {};
exports.default = ActionManager;
});
-enifed('ember-views/system/build-component-template', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/path_cache', 'htmlbars-runtime', 'ember-htmlbars/hooks/get-value'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalPath_cache, _htmlbarsRuntime, _emberHtmlbarsHooksGetValue) {
+enifed('ember-views/system/build-component-template', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/assign', 'ember-metal/path_cache', 'htmlbars-runtime', 'ember-htmlbars/hooks/get-value', 'ember-metal/streams/utils'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalAssign, _emberMetalPath_cache, _htmlbarsRuntime, _emberHtmlbarsHooksGetValue, _emberMetalStreamsUtils) {
'use strict';
exports.default = buildComponentTemplate;
function buildComponentTemplate(_ref, attrs, content) {
var component = _ref.component;
var layout = _ref.layout;
var isAngleBracket = _ref.isAngleBracket;
+ var isComponentElement = _ref.isComponentElement;
+ var outerAttrs = _ref.outerAttrs;
var blockToRender, tagName, meta;
if (component === undefined) {
component = null;
}
if (layout && layout.raw) {
+ var _attributes = component && component._isAngleBracket ? normalizeComponentAttributes(component, true, attrs) : undefined;
+
var yieldTo = createContentBlocks(content.templates, content.scope, content.self, component);
- blockToRender = createLayoutBlock(layout.raw, yieldTo, content.self, component, attrs);
+ blockToRender = createLayoutBlock(layout.raw, yieldTo, content.self, component, attrs, _attributes);
meta = layout.raw.meta;
} else if (content.templates && content.templates.default) {
- blockToRender = createContentBlock(content.templates.default, content.scope, content.self, component);
+ var _attributes2 = component && component._isAngleBracket ? normalizeComponentAttributes(component, true, attrs) : undefined;
+ blockToRender = createContentBlock(content.templates.default, content.scope, content.self, component, _attributes2);
meta = content.templates.default.meta;
}
- if (component) {
+ if (component && !component._isAngleBracket || isComponentElement) {
tagName = tagNameFor(component);
// If this is not a tagless component, we need to create the wrapping
// element. We use `manualElement` to create a template that represents
// the wrapping element and yields to the previous block.
if (tagName !== '') {
+ if (isComponentElement) {
+ attrs = mergeAttrs(attrs, outerAttrs);
+ }
var attributes = normalizeComponentAttributes(component, isAngleBracket, attrs);
var elementTemplate = _htmlbarsRuntime.internal.manualElement(tagName, attributes);
elementTemplate.meta = meta;
blockToRender = createElementBlock(elementTemplate, blockToRender, component);
@@ -39719,21 +40334,32 @@
// * the falsy value "" if set explicitly on the component
// * an actual tagName set explicitly on the component
return { createdElement: !!tagName, block: blockToRender };
}
+ function mergeAttrs(innerAttrs, outerAttrs) {
+ var result = _emberMetalAssign.default({}, innerAttrs, outerAttrs);
+
+ if (innerAttrs.class && outerAttrs.class) {
+ result.class = ['subexpr', '-join-classes', [['value', innerAttrs.class], ['value', outerAttrs.class]], []];
+ }
+
+ return result;
+ }
+
function blockFor(template, options) {
_emberMetalCore.default.assert('BUG: Must pass a template to blockFor', !!template);
return _htmlbarsRuntime.internal.blockFor(_htmlbarsRuntime.render, template, options);
}
- function createContentBlock(template, scope, self, component) {
+ function createContentBlock(template, scope, self, component, attributes) {
_emberMetalCore.default.assert('BUG: buildComponentTemplate can take a scope or a self, but not both', !(scope && self));
return blockFor(template, {
scope: scope,
self: self,
+ attributes: attributes,
options: { view: component }
});
}
function createContentBlocks(templates, scope, self, component) {
@@ -39750,13 +40376,14 @@
}
}
return output;
}
- function createLayoutBlock(template, yieldTo, self, component, attrs) {
+ function createLayoutBlock(template, yieldTo, self, component, attrs, attributes) {
return blockFor(template, {
yieldTo: yieldTo,
+ attributes: attributes,
// If we have an old-style Controller with a template it will be
// passed as our `self` argument, and it should be the context for
// the template. Otherwise, we must have a real Component and it
// should be its own template context.
@@ -39874,14 +40501,14 @@
var normalizedClass = [];
var classNames = _emberMetalProperty_get.get(component, 'classNames');
var classNameBindings = _emberMetalProperty_get.get(component, 'classNameBindings');
if (attrs.class) {
- if (typeof attrs.class === 'string') {
- normalizedClass.push(attrs.class);
- } else {
+ if (_emberMetalStreamsUtils.isStream(attrs.class)) {
normalizedClass.push(['subexpr', '-normalize-class', [['value', attrs.class.path], ['value', attrs.class]], []]);
+ } else {
+ normalizedClass.push(attrs.class);
}
}
if (attrs.classBinding) {
normalizeClasses(attrs.classBinding.split(' '), normalizedClass);
@@ -39941,11 +40568,11 @@
var classNameBindings = component.classNameBindings;
return !classNameBindings || classNameBindings.length === 0;
});
}
});
-enifed('ember-views/system/event_dispatcher', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/is_none', 'ember-metal/run_loop', 'ember-runtime/system/object', 'ember-views/system/jquery', 'ember-views/system/action_manager', 'ember-views/views/view', 'ember-metal/merge'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalIs_none, _emberMetalRun_loop, _emberRuntimeSystemObject, _emberViewsSystemJquery, _emberViewsSystemAction_manager, _emberViewsViewsView, _emberMetalMerge) {
+enifed('ember-views/system/event_dispatcher', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/is_none', 'ember-metal/run_loop', 'ember-runtime/system/object', 'ember-views/system/jquery', 'ember-views/system/action_manager', 'ember-views/views/view', 'ember-metal/assign'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalIs_none, _emberMetalRun_loop, _emberRuntimeSystemObject, _emberViewsSystemJquery, _emberViewsSystemAction_manager, _emberViewsViewsView, _emberMetalAssign) {
/**
@module ember
@submodule ember-views
*/
'use strict';
@@ -39963,15 +40590,30 @@
*/
exports.default = _emberRuntimeSystemObject.default.extend({
/**
The set of events names (and associated handler function names) to be setup
- and dispatched by the `EventDispatcher`. Custom events can added to this list at setup
- time, generally via the `Ember.Application.customEvents` hash. Only override this
- default set to prevent the EventDispatcher from listening on some events all together.
- This set will be modified by `setup` to also include any events added at that time.
- @property events
+ and dispatched by the `EventDispatcher`. Modifications to this list can be done
+ at setup time, generally via the `Ember.Application.customEvents` hash.
+ To add new events to be listened to:
+ ```javascript
+ var App = Ember.Application.create({
+ customEvents: {
+ paste: 'paste'
+ }
+ });
+ ```
+ To prevent default events from being listened to:
+ ```javascript
+ var App = Ember.Application.create({
+ customEvents: {
+ mouseenter: null,
+ mouseleave: null
+ }
+ });
+ ```
+ @property events
@type Object
@private
*/
events: {
touchstart: 'touchStart',
@@ -40053,14 +40695,12 @@
@method setup
@param addedEvents {Object}
*/
setup: function (addedEvents, rootElement) {
var event;
- var events = _emberMetalProperty_get.get(this, 'events');
+ var events = _emberMetalAssign.default({}, _emberMetalProperty_get.get(this, 'events'), addedEvents);
- _emberMetalMerge.default(events, addedEvents || {});
-
if (!_emberMetalIs_none.default(rootElement)) {
_emberMetalProperty_set.set(this, 'rootElement', rootElement);
}
rootElement = _emberViewsSystemJquery.default(_emberMetalProperty_get.get(this, 'rootElement'));
@@ -40094,10 +40734,14 @@
*/
setupHandler: function (rootElement, event, eventName) {
var self = this;
var viewRegistry = this.container && this.container.lookup('-view-registry:main') || _emberViewsViewsView.default.views;
+ if (eventName === null) {
+ return;
+ }
+
rootElement.on(event + '.ember', '.ember-view', function (evt, triggeringManager) {
var view = viewRegistry[this.id];
var result = true;
var manager = self.canDispatchToEventManager ? self._findNearestEventManager(view, eventName) : null;
@@ -40608,42 +41252,34 @@
this._contentDidChange();
return ret;
},
/**
- Invoked when the content property is about to change. Notifies observers that the
- entire array content will change.
- @private
- @method _contentWillChange
- */
- _contentWillChange: _emberMetalMixin._beforeObserver('content', function () {
- var content = this.get('content');
-
- if (content) {
- content.removeArrayObserver(this);
- }
- var len = content ? _emberMetalProperty_get.get(content, 'length') : 0;
- this.arrayWillChange(content, 0, len);
- }),
-
- /**
Check to make sure that the content has changed, and if so,
update the children directly. This is always scheduled
asynchronously, to allow the element to be created before
bindings have synchronized and vice versa.
@private
@method _contentDidChange
*/
_contentDidChange: _emberMetalMixin.observer('content', function () {
+ var prevContent = this._prevContent;
+ if (prevContent) {
+ prevContent.removeArrayObserver(this);
+ }
+ var len = prevContent ? _emberMetalProperty_get.get(prevContent, 'length') : 0;
+ this.arrayWillChange(prevContent, 0, len);
+
var content = _emberMetalProperty_get.get(this, 'content');
if (content) {
+ this._prevContent = content;
this._assertArrayLike(content);
content.addArrayObserver(this);
}
- var len = content ? _emberMetalProperty_get.get(content, 'length') : 0;
+ len = content ? _emberMetalProperty_get.get(content, 'length') : 0;
this.arrayDidChange(content, 0, null, len);
}),
/**
Ensure that the content implements Ember.Array
@@ -41193,49 +41829,10 @@
```
@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
});
@@ -41244,11 +41841,11 @@
});
// 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.0.3';
+ _emberHtmlbarsTemplatesContainerView.default.meta.revision = 'Ember@2.1.0-beta.1';
/**
@module ember
@submodule ember-views
*/
@@ -41412,11 +42009,11 @@
init: function () {
var _this = this;
this._super.apply(this, arguments);
-
+ this._prevCurrentView = undefined;
var userChildViews = _emberMetalProperty_get.get(this, 'childViews');
_emberMetalCore.default.deprecate('Setting `childViews` on a Container is deprecated.', _emberMetalCore.default.isEmpty(userChildViews), { id: 'ember-views.container-child-views', until: '2.4.0' });
// redefine view's childViews property that was obliterated
// 2.0TODO: Don't Ember.A() this so users disabling prototype extensions
@@ -41459,19 +42056,17 @@
if (view.parentView !== this) {
this.linkChild(view);
}
},
- _currentViewWillChange: _emberMetalMixin._beforeObserver('currentView', function () {
- var currentView = _emberMetalProperty_get.get(this, 'currentView');
- if (currentView) {
- currentView.destroy();
- }
- }),
-
_currentViewDidChange: _emberMetalMixin.observer('currentView', function () {
+ var prevView = this._prevCurrentView;
+ if (prevView) {
+ prevView.destroy();
+ }
var currentView = _emberMetalProperty_get.get(this, 'currentView');
+ this._prevCurrentView = currentView;
if (currentView) {
_emberMetalCore.default.assert('You tried to set a current view that already has a parent. Make sure you don\'t have multiple outlets in the same view.', !currentView.parentView);
this.pushObject(currentView);
}
}),
@@ -42613,28 +43208,11 @@
});
},
exit: function (view) {
view._unregister();
- },
-
- appendAttr: function (view, attrNode) {
- var childViews = view.childViews;
-
- if (!childViews.length) {
- childViews = view.childViews = childViews.slice();
- }
- childViews.push(attrNode);
-
- attrNode.parentView = view;
- view.renderer.appendAttrTo(attrNode, view.element, attrNode.attrName);
-
- view.propertyDidChange('childViews');
-
- return attrNode;
}
-
});
exports.default = inDOM;
});
enifed('ember-views/views/states/pre_render', ['exports', 'ember-views/views/states/default', 'ember-metal/merge'], function (exports, _emberViewsViewsStatesDefault, _emberMetalMerge) {
@@ -42687,19 +43265,19 @@
attributeBindings: ['rows', 'cols', 'name', 'selectionEnd', 'selectionStart', 'wrap', 'lang', 'dir', 'value'],
rows: null,
cols: null
});
});
-enifed('ember-views/views/text_field', ['exports', 'ember-metal/computed', 'ember-metal/environment', 'ember-views/views/component', 'ember-views/mixins/text_support'], function (exports, _emberMetalComputed, _emberMetalEnvironment, _emberViewsViewsComponent, _emberViewsMixinsText_support) {
+enifed('ember-views/views/text_field', ['exports', 'ember-metal/computed', 'ember-metal/environment', 'ember-views/views/component', 'ember-views/mixins/text_support', 'ember-metal/empty_object'], function (exports, _emberMetalComputed, _emberMetalEnvironment, _emberViewsViewsComponent, _emberViewsMixinsText_support, _emberMetalEmpty_object) {
/**
@module ember
@submodule ember-views
*/
'use strict';
var inputTypeTestElement;
- var inputTypes = Object.create(null);
+ var inputTypes = new _emberMetalEmpty_object.default();
function canSetTypeOfInput(type) {
if (type in inputTypes) {
return inputTypes[type];
}
@@ -43586,11 +44164,11 @@
class or mixin.
@method nearestOfType
@param {Class,Mixin} klass Subclass of Ember.View (or Ember.View itself),
or an instance of Ember.Mixin.
@return Ember.View
- @private
+ @public
*/
nearestOfType: function (klass) {
var view = _emberMetalProperty_get.get(this, 'parentView');
var isOfType = klass instanceof _emberMetalMixin.Mixin ? function (view) {
return klass.detect(view);
@@ -44077,14 +44655,10 @@
this.scheduledRevalidation = true;
_emberMetalRun_loop.default.scheduleOnce('render', this, this.revalidate);
}
},
- appendAttr: function (node, buffer) {
- return this.currentState.appendAttr(this, node, buffer);
- },
-
templateRenderer: null,
/**
Removes the view from its `parentView`, if one is found. Otherwise
does nothing.
@@ -44299,304 +44873,119 @@
/**
@module ember
*/
});
-enifed('htmlbars-runtime', ['exports', './htmlbars-runtime/hooks', './htmlbars-runtime/render', '../htmlbars-util/morph-utils', '../htmlbars-util/template-utils', './htmlbars-runtime/expression-visitor', 'htmlbars-runtime/hooks'], function (exports, _htmlbarsRuntimeHooks, _htmlbarsRuntimeRender, _htmlbarsUtilMorphUtils, _htmlbarsUtilTemplateUtils, _htmlbarsRuntimeExpressionVisitor, _htmlbarsRuntimeHooks2) {
+enifed('htmlbars-runtime', ['exports', './htmlbars-runtime/hooks', './htmlbars-runtime/render', '../htmlbars-util/morph-utils', '../htmlbars-util/template-utils', 'htmlbars-runtime/hooks'], function (exports, _htmlbarsRuntimeHooks, _htmlbarsRuntimeRender, _htmlbarsUtilMorphUtils, _htmlbarsUtilTemplateUtils, _htmlbarsRuntimeHooks2) {
'use strict';
var internal = {
blockFor: _htmlbarsUtilTemplateUtils.blockFor,
manualElement: _htmlbarsRuntimeRender.manualElement,
hostBlock: _htmlbarsRuntimeHooks2.hostBlock,
continueBlock: _htmlbarsRuntimeHooks2.continueBlock,
hostYieldWithShadowTemplate: _htmlbarsRuntimeHooks2.hostYieldWithShadowTemplate,
visitChildren: _htmlbarsUtilMorphUtils.visitChildren,
- validateChildMorphs: _htmlbarsRuntimeExpressionVisitor.validateChildMorphs,
+ validateChildMorphs: _htmlbarsUtilMorphUtils.validateChildMorphs,
clearMorph: _htmlbarsUtilTemplateUtils.clearMorph
};
exports.hooks = _htmlbarsRuntimeHooks.default;
exports.render = _htmlbarsRuntimeRender.default;
exports.internal = internal;
});
-enifed("htmlbars-runtime/expression-visitor", ["exports", "../htmlbars-util/object-utils", "../htmlbars-util/morph-utils"], function (exports, _htmlbarsUtilObjectUtils, _htmlbarsUtilMorphUtils) {
- "use strict";
-
+enifed('htmlbars-runtime/expression-visitor', ['exports'], function (exports) {
/**
- Node classification:
-
- # Primary Statement Nodes:
-
- These nodes are responsible for a render node that represents a morph-range.
-
- * block
- * inline
- * content
- * element
- * component
-
- # Leaf Statement Nodes:
-
- This node is responsible for a render node that represents a morph-attr.
-
- * attribute
-
# Expression Nodes:
These nodes are not directly responsible for any part of the DOM, but are
eventually passed to a Statement Node.
* get
* subexpr
* concat
*/
- var base = {
- acceptExpression: function (node, env, scope) {
- var ret = { value: null };
+ 'use strict';
- // Primitive literals are unambiguously non-array representations of
- // themselves.
- if (typeof node !== 'object' || node === null) {
- ret.value = node;
- return ret;
- }
+ exports.acceptParams = acceptParams;
+ exports.acceptHash = acceptHash;
- switch (node[0]) {
- // can be used by manualElement
- case 'value':
- ret.value = node[1];break;
- case 'get':
- ret.value = this.get(node, env, scope);break;
- case 'subexpr':
- ret.value = this.subexpr(node, env, scope);break;
- case 'concat':
- ret.value = this.concat(node, env, scope);break;
- }
+ function acceptParams(nodes, env, scope) {
+ var array = [];
- return ret;
- },
+ for (var i = 0, l = nodes.length; i < l; i++) {
+ array.push(acceptExpression(nodes[i], env, scope).value);
+ }
- acceptParams: function (nodes, env, scope) {
- var arr = new Array(nodes.length);
+ return array;
+ }
- for (var i = 0, l = nodes.length; i < l; i++) {
- arr[i] = this.acceptExpression(nodes[i], env, scope).value;
- }
+ function acceptHash(pairs, env, scope) {
+ var object = {};
- return arr;
- },
+ for (var i = 0, l = pairs.length; i < l; i += 2) {
+ var key = pairs[i];
+ var value = pairs[i + 1];
+ object[key] = acceptExpression(value, env, scope).value;
+ }
- acceptHash: function (pairs, env, scope) {
- var object = {};
+ return object;
+ }
- for (var i = 0, l = pairs.length; i < l; i += 2) {
- object[pairs[i]] = this.acceptExpression(pairs[i + 1], env, scope).value;
- }
+ function acceptExpression(node, env, scope) {
+ var ret = { value: null };
- return object;
- },
-
- // [ 'get', path ]
- get: function (node, env, scope) {
- return env.hooks.get(env, scope, node[1]);
- },
-
- // [ 'subexpr', path, params, hash ]
- subexpr: function (node, env, scope) {
- var path = node[1],
- params = node[2],
- hash = node[3];
- return env.hooks.subexpr(env, scope, path, this.acceptParams(params, env, scope), this.acceptHash(hash, env, scope));
- },
-
- // [ 'concat', parts ]
- concat: function (node, env, scope) {
- return env.hooks.concat(env, this.acceptParams(node[1], env, scope));
- },
-
- linkParamsAndHash: function (env, scope, morph, path, params, hash) {
- if (morph.linkedParams) {
- params = morph.linkedParams.params;
- hash = morph.linkedParams.hash;
- } else {
- params = params && this.acceptParams(params, env, scope);
- hash = hash && this.acceptHash(hash, env, scope);
- }
-
- _htmlbarsUtilMorphUtils.linkParams(env, scope, morph, path, params, hash);
- return [params, hash];
+ // Primitive literals are unambiguously non-array representations of
+ // themselves.
+ if (typeof node !== 'object' || node === null) {
+ ret.value = node;
+ } else {
+ ret.value = evaluateNode(node, env, scope);
}
- };
- var AlwaysDirtyVisitor = _htmlbarsUtilObjectUtils.merge(Object.create(base), {
- // [ 'block', path, params, hash, templateId, inverseId ]
- block: function (node, morph, env, scope, template, visitor) {
- var path = node[1],
- params = node[2],
- hash = node[3],
- templateId = node[4],
- inverseId = node[5];
- var paramsAndHash = this.linkParamsAndHash(env, scope, morph, path, params, hash);
+ return ret;
+ }
- morph.isDirty = morph.isSubtreeDirty = false;
- env.hooks.block(morph, env, scope, path, paramsAndHash[0], paramsAndHash[1], templateId === null ? null : template.templates[templateId], inverseId === null ? null : template.templates[inverseId], visitor);
- },
-
- // [ 'inline', path, params, hash ]
- inline: function (node, morph, env, scope, visitor) {
- var path = node[1],
- params = node[2],
- hash = node[3];
- var paramsAndHash = this.linkParamsAndHash(env, scope, morph, path, params, hash);
-
- morph.isDirty = morph.isSubtreeDirty = false;
- env.hooks.inline(morph, env, scope, path, paramsAndHash[0], paramsAndHash[1], visitor);
- },
-
- // [ 'content', path ]
- content: function (node, morph, env, scope, visitor) {
- var path = node[1];
-
- morph.isDirty = morph.isSubtreeDirty = false;
-
- if (isHelper(env, scope, path)) {
- env.hooks.inline(morph, env, scope, path, [], {}, visitor);
- if (morph.linkedResult) {
- _htmlbarsUtilMorphUtils.linkParams(env, scope, morph, '@content-helper', [morph.linkedResult], null);
- }
- return;
- }
-
- var params;
- if (morph.linkedParams) {
- params = morph.linkedParams.params;
- } else {
- params = [env.hooks.get(env, scope, path)];
- }
-
- _htmlbarsUtilMorphUtils.linkParams(env, scope, morph, '@range', params, null);
- env.hooks.range(morph, env, scope, path, params[0], visitor);
- },
-
- // [ 'element', path, params, hash ]
- element: function (node, morph, env, scope, visitor) {
- var path = node[1],
- params = node[2],
- hash = node[3];
- var paramsAndHash = this.linkParamsAndHash(env, scope, morph, path, params, hash);
-
- morph.isDirty = morph.isSubtreeDirty = false;
- env.hooks.element(morph, env, scope, path, paramsAndHash[0], paramsAndHash[1], visitor);
- },
-
- // [ 'attribute', name, value ]
- attribute: function (node, morph, env, scope) {
- var name = node[1],
- value = node[2];
- var paramsAndHash = this.linkParamsAndHash(env, scope, morph, '@attribute', [value], null);
-
- morph.isDirty = morph.isSubtreeDirty = false;
- env.hooks.attribute(morph, env, scope, name, paramsAndHash[0][0]);
- },
-
- // [ 'component', path, attrs, templateId, inverseId ]
- component: function (node, morph, env, scope, template, visitor) {
- var path = node[1],
- attrs = node[2],
- templateId = node[3],
- inverseId = node[4];
- var paramsAndHash = this.linkParamsAndHash(env, scope, morph, path, [], attrs);
- var templates = {
- default: template.templates[templateId],
- inverse: template.templates[inverseId]
- };
-
- morph.isDirty = morph.isSubtreeDirty = false;
- env.hooks.component(morph, env, scope, path, paramsAndHash[0], paramsAndHash[1], templates, visitor);
- },
-
- // [ 'attributes', template ]
- attributes: function (node, morph, env, scope, parentMorph, visitor) {
- var template = node[1];
- env.hooks.attributes(morph, env, scope, template, parentMorph, visitor);
+ function evaluateNode(node, env, scope) {
+ switch (node[0]) {
+ // can be used by manualElement
+ case 'value':
+ return node[1];
+ case 'get':
+ return evaluateGet(node, env, scope);
+ case 'subexpr':
+ return evaluateSubexpr(node, env, scope);
+ case 'concat':
+ return evaluateConcat(node, env, scope);
}
- });
+ }
- exports.AlwaysDirtyVisitor = AlwaysDirtyVisitor;
- exports.default = _htmlbarsUtilObjectUtils.merge(Object.create(base), {
- // [ 'block', path, params, hash, templateId, inverseId ]
- block: function (node, morph, env, scope, template, visitor) {
- dirtyCheck(env, morph, visitor, function (visitor) {
- AlwaysDirtyVisitor.block(node, morph, env, scope, template, visitor);
- });
- },
+ function evaluateGet(node, env, scope) {
+ var path = node[1];
- // [ 'inline', path, params, hash ]
- inline: function (node, morph, env, scope, visitor) {
- dirtyCheck(env, morph, visitor, function (visitor) {
- AlwaysDirtyVisitor.inline(node, morph, env, scope, visitor);
- });
- },
+ return env.hooks.get(env, scope, path);
+ }
- // [ 'content', path ]
- content: function (node, morph, env, scope, visitor) {
- dirtyCheck(env, morph, visitor, function (visitor) {
- AlwaysDirtyVisitor.content(node, morph, env, scope, visitor);
- });
- },
+ function evaluateSubexpr(node, env, scope) {
+ var path = node[1];
+ var rawParams = node[2];
+ var rawHash = node[3];
- // [ 'element', path, params, hash ]
- element: function (node, morph, env, scope, template, visitor) {
- dirtyCheck(env, morph, visitor, function (visitor) {
- AlwaysDirtyVisitor.element(node, morph, env, scope, template, visitor);
- });
- },
+ var params = acceptParams(rawParams, env, scope);
+ var hash = acceptHash(rawHash, env, scope);
- // [ 'attribute', name, value ]
- attribute: function (node, morph, env, scope, template) {
- dirtyCheck(env, morph, null, function () {
- AlwaysDirtyVisitor.attribute(node, morph, env, scope, template);
- });
- },
+ return env.hooks.subexpr(env, scope, path, params, hash);
+ }
- // [ 'component', path, attrs, templateId ]
- component: function (node, morph, env, scope, template, visitor) {
- dirtyCheck(env, morph, visitor, function (visitor) {
- AlwaysDirtyVisitor.component(node, morph, env, scope, template, visitor);
- });
- },
+ function evaluateConcat(node, env, scope) {
+ var rawParts = node[1];
- // [ 'attributes', template ]
- attributes: function (node, morph, env, scope, parentMorph, visitor) {
- AlwaysDirtyVisitor.attributes(node, morph, env, scope, parentMorph, visitor);
- }
- });
+ var parts = acceptParams(rawParts, env, scope);
- function dirtyCheck(_env, morph, visitor, callback) {
- var isDirty = morph.isDirty;
- var isSubtreeDirty = morph.isSubtreeDirty;
- var env = _env;
-
- if (isSubtreeDirty) {
- visitor = AlwaysDirtyVisitor;
- }
-
- if (isDirty || isSubtreeDirty) {
- callback(visitor);
- } else {
- if (morph.buildChildEnv) {
- env = morph.buildChildEnv(morph.state, env);
- }
- _htmlbarsUtilMorphUtils.validateChildMorphs(env, morph, visitor);
- }
+ return env.hooks.concat(env, parts);
}
-
- function isHelper(env, scope, path) {
- return env.hooks.keywords[path] !== undefined || env.hooks.hasHelper(env, scope, path);
- }
});
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;
@@ -45085,10 +45474,12 @@
}
function createChildScope(parent) {
var scope = Object.create(parent);
scope.locals = Object.create(parent.locals);
+ scope.localPresent = Object.create(parent.localPresent);
+ scope.blocks = Object.create(parent.blocks);
return scope;
}
/**
Host Hook: bindSelf
@@ -45833,13 +46224,210 @@
prototype.constructor = HTMLBarsMorph;
prototype.super$constructor = _morphRange.default;
exports.default = HTMLBarsMorph;
});
-enifed("htmlbars-runtime/render", ["exports", "../htmlbars-util/array-utils", "../htmlbars-util/morph-utils", "./expression-visitor", "./morph", "../htmlbars-util/template-utils", "../htmlbars-util/void-tag-names"], function (exports, _htmlbarsUtilArrayUtils, _htmlbarsUtilMorphUtils, _expressionVisitor, _morph, _htmlbarsUtilTemplateUtils, _htmlbarsUtilVoidTagNames) {
+enifed("htmlbars-runtime/node-visitor", ["exports", "../htmlbars-util/morph-utils", "./expression-visitor"], function (exports, _htmlbarsUtilMorphUtils, _expressionVisitor) {
"use strict";
+ /**
+ Node classification:
+
+ # Primary Statement Nodes:
+
+ These nodes are responsible for a render node that represents a morph-range.
+
+ * block
+ * inline
+ * content
+ * element
+ * component
+
+ # Leaf Statement Nodes:
+
+ This node is responsible for a render node that represents a morph-attr.
+
+ * attribute
+ */
+
+ function linkParamsAndHash(env, scope, morph, path, params, hash) {
+ if (morph.linkedParams) {
+ params = morph.linkedParams.params;
+ hash = morph.linkedParams.hash;
+ } else {
+ params = params && _expressionVisitor.acceptParams(params, env, scope);
+ hash = hash && _expressionVisitor.acceptHash(hash, env, scope);
+ }
+
+ _htmlbarsUtilMorphUtils.linkParams(env, scope, morph, path, params, hash);
+ return [params, hash];
+ }
+
+ var AlwaysDirtyVisitor = {
+
+ block: function (node, morph, env, scope, template, visitor) {
+ var path = node[1];
+ var params = node[2];
+ var hash = node[3];
+ var templateId = node[4];
+ var inverseId = node[5];
+
+ var paramsAndHash = linkParamsAndHash(env, scope, morph, path, params, hash);
+
+ morph.isDirty = morph.isSubtreeDirty = false;
+ env.hooks.block(morph, env, scope, path, paramsAndHash[0], paramsAndHash[1], templateId === null ? null : template.templates[templateId], inverseId === null ? null : template.templates[inverseId], visitor);
+ },
+
+ inline: function (node, morph, env, scope, visitor) {
+ var path = node[1];
+ var params = node[2];
+ var hash = node[3];
+
+ var paramsAndHash = linkParamsAndHash(env, scope, morph, path, params, hash);
+
+ morph.isDirty = morph.isSubtreeDirty = false;
+ env.hooks.inline(morph, env, scope, path, paramsAndHash[0], paramsAndHash[1], visitor);
+ },
+
+ content: function (node, morph, env, scope, visitor) {
+ var path = node[1];
+
+ morph.isDirty = morph.isSubtreeDirty = false;
+
+ if (isHelper(env, scope, path)) {
+ env.hooks.inline(morph, env, scope, path, [], {}, visitor);
+ if (morph.linkedResult) {
+ _htmlbarsUtilMorphUtils.linkParams(env, scope, morph, '@content-helper', [morph.linkedResult], null);
+ }
+ return;
+ }
+
+ var params = undefined;
+ if (morph.linkedParams) {
+ params = morph.linkedParams.params;
+ } else {
+ params = [env.hooks.get(env, scope, path)];
+ }
+
+ _htmlbarsUtilMorphUtils.linkParams(env, scope, morph, '@range', params, null);
+ env.hooks.range(morph, env, scope, path, params[0], visitor);
+ },
+
+ element: function (node, morph, env, scope, visitor) {
+ var path = node[1];
+ var params = node[2];
+ var hash = node[3];
+
+ var paramsAndHash = linkParamsAndHash(env, scope, morph, path, params, hash);
+
+ morph.isDirty = morph.isSubtreeDirty = false;
+ env.hooks.element(morph, env, scope, path, paramsAndHash[0], paramsAndHash[1], visitor);
+ },
+
+ attribute: function (node, morph, env, scope) {
+ var name = node[1];
+ var value = node[2];
+
+ var paramsAndHash = linkParamsAndHash(env, scope, morph, '@attribute', [value], null);
+
+ morph.isDirty = morph.isSubtreeDirty = false;
+ env.hooks.attribute(morph, env, scope, name, paramsAndHash[0][0]);
+ },
+
+ component: function (node, morph, env, scope, template, visitor) {
+ var path = node[1];
+ var attrs = node[2];
+ var templateId = node[3];
+ var inverseId = node[4];
+
+ var paramsAndHash = linkParamsAndHash(env, scope, morph, path, [], attrs);
+ var templates = {
+ default: template.templates[templateId],
+ inverse: template.templates[inverseId]
+ };
+
+ morph.isDirty = morph.isSubtreeDirty = false;
+ env.hooks.component(morph, env, scope, path, paramsAndHash[0], paramsAndHash[1], templates, visitor);
+ },
+
+ attributes: function (node, morph, env, scope, parentMorph, visitor) {
+ var template = node[1];
+
+ env.hooks.attributes(morph, env, scope, template, parentMorph, visitor);
+ }
+
+ };
+
+ exports.AlwaysDirtyVisitor = AlwaysDirtyVisitor;
+ exports.default = {
+ block: function (node, morph, env, scope, template, visitor) {
+ dirtyCheck(env, morph, visitor, function (visitor) {
+ AlwaysDirtyVisitor.block(node, morph, env, scope, template, visitor);
+ });
+ },
+
+ inline: function (node, morph, env, scope, visitor) {
+ dirtyCheck(env, morph, visitor, function (visitor) {
+ AlwaysDirtyVisitor.inline(node, morph, env, scope, visitor);
+ });
+ },
+
+ content: function (node, morph, env, scope, visitor) {
+ dirtyCheck(env, morph, visitor, function (visitor) {
+ AlwaysDirtyVisitor.content(node, morph, env, scope, visitor);
+ });
+ },
+
+ element: function (node, morph, env, scope, template, visitor) {
+ dirtyCheck(env, morph, visitor, function (visitor) {
+ AlwaysDirtyVisitor.element(node, morph, env, scope, template, visitor);
+ });
+ },
+
+ attribute: function (node, morph, env, scope, template) {
+ dirtyCheck(env, morph, null, function () {
+ AlwaysDirtyVisitor.attribute(node, morph, env, scope, template);
+ });
+ },
+
+ component: function (node, morph, env, scope, template, visitor) {
+ dirtyCheck(env, morph, visitor, function (visitor) {
+ AlwaysDirtyVisitor.component(node, morph, env, scope, template, visitor);
+ });
+ },
+
+ attributes: function (node, morph, env, scope, parentMorph, visitor) {
+ AlwaysDirtyVisitor.attributes(node, morph, env, scope, parentMorph, visitor);
+ }
+ };
+
+ function dirtyCheck(_env, morph, visitor, callback) {
+ var isDirty = morph.isDirty;
+ var isSubtreeDirty = morph.isSubtreeDirty;
+ var env = _env;
+
+ if (isSubtreeDirty) {
+ visitor = AlwaysDirtyVisitor;
+ }
+
+ if (isDirty || isSubtreeDirty) {
+ callback(visitor);
+ } else {
+ if (morph.buildChildEnv) {
+ env = morph.buildChildEnv(morph.state, env);
+ }
+ _htmlbarsUtilMorphUtils.validateChildMorphs(env, morph, visitor);
+ }
+ }
+
+ function isHelper(env, scope, path) {
+ return env.hooks.keywords[path] !== undefined || env.hooks.hasHelper(env, scope, path);
+ }
+});
+enifed("htmlbars-runtime/render", ["exports", "../htmlbars-util/array-utils", "../htmlbars-util/morph-utils", "./node-visitor", "./morph", "../htmlbars-util/template-utils", "../htmlbars-util/void-tag-names"], function (exports, _htmlbarsUtilArrayUtils, _htmlbarsUtilMorphUtils, _nodeVisitor, _morph, _htmlbarsUtilTemplateUtils, _htmlbarsUtilVoidTagNames) {
+ "use strict";
+
exports.default = render;
exports.manualElement = manualElement;
exports.attachAttributes = attachAttributes;
exports.createChildMorph = createChildMorph;
exports.getCachedFragment = getCachedFragment;
@@ -45920,22 +46508,26 @@
rootNode.childNodes = nodes;
return new RenderResult(env, scope, options, rootNode, ownerNode, nodes, fragment, template, shouldSetContent);
};
- function manualElement(tagName, attributes) {
+ function manualElement(tagName, attributes, _isEmpty) {
var statements = [];
for (var key in attributes) {
if (typeof attributes[key] === 'string') {
continue;
}
statements.push(["attribute", key, attributes[key]]);
}
- statements.push(['content', 'yield']);
+ var isEmpty = _isEmpty || _htmlbarsUtilVoidTagNames.default[tagName];
+ if (!isEmpty) {
+ statements.push(['content', 'yield']);
+ }
+
var template = {
arity: 0,
cachedFragment: null,
hasRendered: false,
buildFragment: function buildFragment(dom) {
@@ -45950,11 +46542,11 @@
continue;
}
dom.setAttribute(el1, key, attributes[key]);
}
- if (!_htmlbarsUtilVoidTagNames.default[tagName]) {
+ if (!isEmpty) {
var el2 = dom.createComment("");
dom.appendChild(el1, el2);
}
dom.appendChild(el0, el1);
@@ -45970,11 +46562,14 @@
continue;
}
morphs.push(dom.createAttrMorph(element, key));
}
- morphs.push(dom.createMorphAt(element, 0, 0));
+ if (!isEmpty) {
+ morphs.push(dom.createMorphAt(element, 0, 0));
+ }
+
return morphs;
},
statements: statements,
locals: [],
templates: []
@@ -46040,11 +46635,11 @@
};
RenderResult.prototype.render = function () {
this.root.lastResult = this;
this.root.rendered = true;
- this.populateNodes(_expressionVisitor.AlwaysDirtyVisitor);
+ this.populateNodes(_nodeVisitor.AlwaysDirtyVisitor);
if (this.shouldSetContent && this.root.setContent) {
this.root.setContent(this.fragment);
}
};
@@ -46054,15 +46649,15 @@
node.isDirty = true;
});
};
RenderResult.prototype.revalidate = function (env, self, blockArguments, scope) {
- this.revalidateWith(env, scope, self, blockArguments, _expressionVisitor.default);
+ this.revalidateWith(env, scope, self, blockArguments, _nodeVisitor.default);
};
RenderResult.prototype.rerender = function (env, self, blockArguments, scope) {
- this.revalidateWith(env, scope, self, blockArguments, _expressionVisitor.AlwaysDirtyVisitor);
+ this.revalidateWith(env, scope, self, blockArguments, _nodeVisitor.AlwaysDirtyVisitor);
};
RenderResult.prototype.revalidateWith = function (env, scope, self, blockArguments, visitor) {
if (env !== undefined) {
this.env = env;
@@ -46418,16 +47013,11 @@
while (current) {
nodes.push(current);
current = current.nextMorph;
}
} else if (node.morphList) {
- var current = node.morphList.firstChildMorph;
-
- while (current) {
- nodes.push(current);
- current = current.nextMorph;
- }
+ nodes.push(node.morphList);
}
}
}
function validateChildMorphs(env, morph, visitor) {
@@ -47045,11 +47635,11 @@
case 'object':
if (typeof content.nodeType === 'number') {
return this.setNode(content);
}
/* Handlebars.SafeString */
- if (typeof content.toHTML === 'function') {
- return this.setHTML(content.toHTML());
+ if (typeof content.string === 'string') {
+ return this.setHTML(content.string);
}
if (this.parseTextAsHTML) {
return this.setHTML(content.toString());
}
/* falls through */
\ No newline at end of file