dist/ember-template-compiler.js in ember-source-2.4.6 vs dist/ember-template-compiler.js in ember-source-2.5.0.beta.1
- old
+ new
@@ -4,11 +4,11 @@
* @copyright Copyright 2011-2016 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.4.6
+ * @version 2.5.0-beta.1
*/
var enifed, requireModule, require, requirejs, Ember;
var mainContext = this;
@@ -1243,15 +1243,13 @@
@submodule ember-debug
*/
/**
Display a deprecation warning with the provided message and a stack trace
- (Chrome and Firefox only).
+ (Chrome and Firefox only). Ember build tools will remove any calls to
+ `Ember.deprecate()` when doing a production build.
- * In a production build, this method is defined as an empty function (NOP).
- Uses of this method in Ember itself are stripped from the ember.prod.js build.
-
@method deprecate
@param {String} message A description of the deprecation.
@param {Boolean} test A boolean. If falsy, the deprecation
will be displayed.
@param {Object} options An object that can be used to pass
@@ -1300,11 +1298,11 @@
var HANDLERS = {};
exports.HANDLERS = HANDLERS;
function generateTestAsFunctionDeprecation(source) {
- return 'Calling `' + source + '` with a function argument is deprecated. Please ' + 'use `!!Constructor` for constructors, or an `IIFE` to compute the test for deprecation. ' + 'In a future version functions will be treated as truthy values instead of being executed.';
+ return 'Calling `' + source + '` with a function argument is deprecated. Please ' + 'use `!!Constructor` for constructors, or an `IIFE` to compute the test for deprecation. ' + 'In a future version, functions will be treated as truthy values instead of being executed.';
}
function normalizeTest(test, source) {
if (_emberDebugIsPlainFunction.default(test)) {
_emberDebugDeprecate.default(generateTestAsFunctionDeprecation(source), false, { id: 'ember-debug.deprecate-test-as-function', until: '2.5.0' });
@@ -1353,15 +1351,14 @@
@class Ember
@public
*/
/**
- Define an assertion that will throw an exception if the condition is not met.
+ 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:
- * In a production build, this method is defined as an empty function (NOP).
- Uses of this method in Ember itself are stripped from the ember.prod.js build.
-
```javascript
// Test for truthiness
Ember.assert('Must pass a valid object', obj);
// Fail unconditionally
@@ -1390,15 +1387,13 @@
throw new _emberMetalError.default('Assertion Failed: ' + desc);
}
});
/**
- Display a debug notice.
+ Display a debug notice. Ember build tools will remove any calls to
+ `Ember.debug()` when doing a production build.
- * In a production build, this method is defined as an empty function (NOP).
- Uses of this method in Ember itself are stripped from the ember.prod.js build.
-
```javascript
Ember.debug('I\'m a debug notice!');
```
@method debug
@@ -1410,13 +1405,10 @@
});
/**
Display an info notice.
- * In a production build, this method is defined as an empty function (NOP).
- Uses of this method in Ember itself are stripped from the ember.prod.js build.
-
@method info
@private
*/
_emberMetalDebug.setDebugFunction('info', function info() {
_emberMetalLogger.default.info.apply(undefined, arguments);
@@ -1426,21 +1418,22 @@
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.
- * In a production build, this method is defined as an empty function (NOP).
+ Ember build tools will not remove calls to `Ember.deprecateFunc()`, though
+ no warnings will be shown in production.
```javascript
Ember.oldMethod = Ember.deprecateFunc('Please use the new, updated method', Ember.newMethod);
```
@method deprecateFunc
@param {String} message A description of the deprecation.
@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
+ @return {Function} A new function that wraps the original function with a deprecation warning
@private
*/
_emberMetalDebug.setDebugFunction('deprecateFunc', function deprecateFunc() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
@@ -1477,15 +1470,13 @@
if (typeof _ret2 === 'object') return _ret2.v;
}
});
/**
- Run a function meant for debugging.
+ Run a function meant for debugging. Ember build tools will remove any calls to
+ `Ember.runInDebug()` when doing a production build.
- * In a production build, this method is defined as an empty function (NOP).
- Uses of this method in Ember itself are stripped from the ember.prod.js build.
-
```javascript
Ember.runInDebug(() => {
Ember.Component.reopen({
didInsertElement() {
console.log("I'm happy");
@@ -1520,33 +1511,33 @@
@private
@method _warnIfUsingStrippedFeatureFlags
@return {void}
*/
- function _warnIfUsingStrippedFeatureFlags(FEATURES, knownFeatures, featuresWereStripped) {
+ function _warnIfUsingStrippedFeatureFlags(FEATURES, featuresWereStripped) {
if (featuresWereStripped) {
_emberMetalDebug.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' });
- var keys = Object.keys(FEATURES || {});
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- if (key === 'isEnabled' || !(key in knownFeatures)) {
- continue;
+ for (var key in FEATURES) {
+ if (FEATURES.hasOwnProperty(key) && key !== 'isEnabled') {
+ _emberMetalDebug.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' });
}
-
- _emberMetalDebug.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' });
}
}
}
if (!_emberMetalCore.default.testing) {
// Complain if they're using FEATURE flags in builds other than canary
_emberMetalFeatures.FEATURES['features-stripped-test'] = true;
var featuresWereStripped = true;
+ if (_emberMetalFeatures.default('features-stripped-test')) {
+ exports.featuresWereStripped = featuresWereStripped = false;
+ }
+
delete _emberMetalFeatures.FEATURES['features-stripped-test'];
- _warnIfUsingStrippedFeatureFlags(_emberMetalCore.default.ENV.FEATURES, _emberMetalFeatures.KNOWN_FEATURES, featuresWereStripped);
+ _warnIfUsingStrippedFeatureFlags(_emberMetalCore.default.ENV.FEATURES, featuresWereStripped);
// Inform the developer about the Ember Inspector if not installed.
var isFirefox = _emberMetalEnvironment.default.isFirefox;
var isChrome = _emberMetalEnvironment.default.isChrome;
@@ -1587,22 +1578,22 @@
}
}
```
The handler function takes the following arguments:
<ul>
- <li> <code>message</code> - The message received from the deprecation call. </li>
+ <li> <code>message</code> - The message received from the deprecation call.</li>
<li> <code>options</code> - An object passed in with the deprecation call containing additional information including:</li>
<ul>
- <li> <code>id</code> - an id of the deprecation in the form of <code>package-name.specific-deprecation</code>.</li>
- <li> <code>until</code> - is the version number Ember the feature and deprecation will be removed in.</li>
+ <li> <code>id</code> - An id of the deprecation in the form of <code>package-name.specific-deprecation</code>.</li>
+ <li> <code>until</code> - The Ember version number the feature and deprecation will be removed in.</li>
</ul>
- <li> <code>next</code> - a function that calls into the previously registered handler.</li>
+ <li> <code>next</code> - A function that calls into the previously registered handler.</li>
</ul>
@public
@static
@method registerDeprecationHandler
- @param handler {Function} a function to handle deprecation calls
+ @param handler {Function} A function to handle deprecation calls.
@since 2.1.0
*/
_emberMetalCore.default.Debug.registerDeprecationHandler = _emberDebugDeprecate.registerHandler;
/**
Allows for runtime registration of handler functions that override the default warning behavior.
@@ -1616,18 +1607,18 @@
The handler function takes the following arguments:
<ul>
<li> <code>message</code> - The message received from the warn call. </li>
<li> <code>options</code> - An object passed in with the warn call containing additional information including:</li>
<ul>
- <li> <code>id</code> - an id of the warning in the form of <code>package-name.specific-warning</code>.</li>
+ <li> <code>id</code> - An id of the warning in the form of <code>package-name.specific-warning</code>.</li>
</ul>
- <li> <code>next</code> - a function that calls into the previously registered handler.</li>
+ <li> <code>next</code> - A function that calls into the previously registered handler.</li>
</ul>
@public
@static
@method registerWarnHandler
- @param handler {Function} a function to handle warnings
+ @param handler {Function} A function to handle warnings.
@since 2.1.0
*/
_emberMetalCore.default.Debug.registerWarnHandler = _emberDebugWarn.registerHandler;
/*
@@ -1680,20 +1671,18 @@
@module ember
@submodule ember-debug
*/
/**
- Display a warning with the provided message.
+ Display a warning with the provided message. Ember build tools will
+ remove any calls to `Ember.warn()` when doing a production build.
- * In a production build, this method is defined as an empty function (NOP).
- Uses of this method in Ember itself are stripped from the ember.prod.js build.
-
@method warn
@param {String} message A warning to display.
@param {Boolean} test An optional boolean. If falsy, the warning
will be displayed.
- @param {Object} options An ojbect that can be used to pass a unique
+ @param {Object} options An object that can be used to pass a unique
`id` for this warning. The `id` can be used by Ember debugging tools
to change the behavior (raise, log, or silence) for that specific warning.
The `id` should be namespaced by dots, e.g. "ember-debug.feature-flag-with-features-stripped"
@for Ember
@public
@@ -1785,11 +1774,11 @@
function AliasedProperty_oneWaySet(obj, keyName, value) {
_emberMetalProperties.defineProperty(obj, keyName, null);
return _emberMetalProperty_set.set(obj, keyName, value);
}
- // Backwards compatibility with Ember Data
+ // Backwards compatibility with Ember Data.
AliasedProperty.prototype._meta = undefined;
AliasedProperty.prototype.meta = _emberMetalComputed.ComputedProperty.prototype.meta;
});
enifed("ember-metal/assign", ["exports"], function (exports) {
/**
@@ -1833,11 +1822,11 @@
}
return original;
}
});
-enifed('ember-metal/binding', ['exports', 'ember-metal/core', 'ember-metal/logger', 'ember-metal/debug', '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, _emberMetalLogger, _emberMetalDebug, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalUtils, _emberMetalObserver, _emberMetalRun_loop, _emberMetalPath_cache) {
+enifed('ember-metal/binding', ['exports', 'ember-metal/core', 'ember-metal/logger', 'ember-metal/run_loop', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/utils', 'ember-metal/events', 'ember-metal/observer', 'ember-metal/path_cache'], function (exports, _emberMetalCore, _emberMetalLogger, _emberMetalRun_loop, _emberMetalDebug, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalUtils, _emberMetalEvents, _emberMetalObserver, _emberMetalPath_cache) {
'use strict';
exports.bind = bind;
// ES6TODO: where is Ember.lookup defined?
@@ -1861,35 +1850,26 @@
@default false
@public
*/
_emberMetalCore.default.LOG_BINDINGS = false || !!_emberMetalCore.default.ENV.LOG_BINDINGS;
- /**
- Returns true if the provided path is global (e.g., `MyApp.fooController.bar`)
- instead of local (`foo.bar.baz`).
-
- @method isGlobalPath
- @for Ember
- @private
- @param {String} path
- @return Boolean
- */
-
- function getWithGlobals(obj, path) {
- return _emberMetalProperty_get.get(_emberMetalPath_cache.isGlobal(path) ? _emberMetalCore.default.lookup : obj, path);
- }
-
// ..........................................................
// BINDING
//
function Binding(toPath, fromPath) {
- this._direction = undefined;
+ // Configuration
this._from = fromPath;
this._to = toPath;
- this._readyToSync = undefined;
this._oneWay = undefined;
+
+ // State
+ this._direction = undefined;
+ this._readyToSync = undefined;
+ this._fromObj = undefined;
+ this._fromPath = undefined;
+ this._toObj = undefined;
}
/**
@class Binding
@namespace Ember
@@ -1921,11 +1901,11 @@
connect the binding.
The binding will search for the property path starting at the root object
you pass when you `connect()` the binding. It follows the same rules as
`get()` - see that method for more information.
@method from
- @param {String} path the property path to connect to
+ @param {String} path The property path to connect to.
@return {Ember.Binding} `this`
@public
*/
from: function (path) {
this._from = path;
@@ -1938,11 +1918,11 @@
connect the binding.
The binding will search for the property path starting at the root object
you pass when you `connect()` the binding. It follows the same rules as
`get()` - see that method for more information.
@method to
- @param {String|Tuple} path A property path or tuple
+ @param {String|Tuple} path A property path or tuple.
@return {Ember.Binding} `this`
@public
*/
to: function (path) {
this._to = path;
@@ -1987,121 +1967,143 @@
@public
*/
connect: function (obj) {
_emberMetalDebug.assert('Must pass a valid object to Ember.Binding.connect()', !!obj);
- var fromPath = this._from;
- var toPath = this._to;
- _emberMetalProperty_set.trySet(obj, toPath, getWithGlobals(obj, fromPath));
+ var fromObj = undefined,
+ fromPath = undefined;
- // add an observer on the object to be notified when the binding should be updated
- _emberMetalObserver.addObserver(obj, fromPath, this, this.fromDidChange);
+ // If the binding's "from" path could be interpreted as a global, verify
+ // whether the path refers to a global or not by consulting `Ember.lookup`.
+ if (_emberMetalPath_cache.isGlobalPath(this._from)) {
+ var _name = _emberMetalPath_cache.getFirstKey(this._from);
+ var possibleGlobal = _emberMetalCore.default.lookup[_name];
- // if the binding is a two-way binding, also set up an observer on the target
+ if (possibleGlobal) {
+ fromObj = possibleGlobal;
+ fromPath = _emberMetalPath_cache.getTailPath(this._from);
+ }
+ }
+
+ if (fromObj === undefined) {
+ fromObj = obj;
+ fromPath = this._from;
+ }
+
+ _emberMetalProperty_set.trySet(obj, this._to, _emberMetalProperty_get.get(fromObj, fromPath));
+
+ // Add an observer on the object to be notified when the binding should be updated.
+ _emberMetalObserver.addObserver(fromObj, fromPath, this, 'fromDidChange');
+
+ // If the binding is a two-way binding, also set up an observer on the target.
if (!this._oneWay) {
- _emberMetalObserver.addObserver(obj, toPath, this, this.toDidChange);
+ _emberMetalObserver.addObserver(obj, this._to, this, 'toDidChange');
}
+ _emberMetalEvents.addListener(obj, 'willDestroy', this, 'disconnect');
+
this._readyToSync = true;
+ this._fromObj = fromObj;
+ this._fromPath = fromPath;
+ this._toObj = obj;
return this;
},
/**
Disconnects the binding instance. Changes will no longer be relayed. You
will not usually need to call this method.
@method disconnect
- @param {Object} obj The root object you passed when connecting the binding.
@return {Ember.Binding} `this`
@public
*/
- disconnect: function (obj) {
- _emberMetalDebug.assert('Must pass a valid object to Ember.Binding.disconnect()', !!obj);
+ disconnect: function () {
+ _emberMetalDebug.assert('Must pass a valid object to Ember.Binding.disconnect()', !!this._toObj);
- var twoWay = !this._oneWay;
-
- // remove an observer on the object so we're no longer notified of
+ // Remove an observer on the object so we're no longer notified of
// changes that should update bindings.
- _emberMetalObserver.removeObserver(obj, this._from, this, this.fromDidChange);
+ _emberMetalObserver.removeObserver(this._fromObj, this._fromPath, this, 'fromDidChange');
- // if the binding is two-way, remove the observer from the target as well
- if (twoWay) {
- _emberMetalObserver.removeObserver(obj, this._to, this, this.toDidChange);
+ // If the binding is two-way, remove the observer from the target as well.
+ if (!this._oneWay) {
+ _emberMetalObserver.removeObserver(this._toObj, this._to, this, 'toDidChange');
}
- this._readyToSync = false; // disable scheduled syncs...
+ this._readyToSync = false; // Disable scheduled syncs...
return this;
},
// ..........................................................
// PRIVATE
//
- /* called when the from side changes */
+ /* Called when the from side changes. */
fromDidChange: function (target) {
- this._scheduleSync(target, 'fwd');
+ this._scheduleSync('fwd');
},
- /* called when the to side changes */
+ /* Called when the to side changes. */
toDidChange: function (target) {
- this._scheduleSync(target, 'back');
+ this._scheduleSync('back');
},
- _scheduleSync: function (obj, dir) {
+ _scheduleSync: function (dir) {
var existingDir = this._direction;
- // if we haven't scheduled the binding yet, schedule it
+ // If we haven't scheduled the binding yet, schedule it.
if (existingDir === undefined) {
- _emberMetalRun_loop.default.schedule('sync', this, this._sync, obj);
+ _emberMetalRun_loop.default.schedule('sync', this, '_sync');
this._direction = dir;
}
// If both a 'back' and 'fwd' sync have been scheduled on the same object,
// default to a 'fwd' sync so that it remains deterministic.
if (existingDir === 'back' && dir === 'fwd') {
this._direction = 'fwd';
}
},
- _sync: function (obj) {
+ _sync: function () {
var log = _emberMetalCore.default.LOG_BINDINGS;
- // don't synchronize destroyed objects or disconnected bindings
- if (obj.isDestroyed || !this._readyToSync) {
+ var toObj = this._toObj;
+
+ // Don't synchronize destroyed objects or disconnected bindings.
+ if (toObj.isDestroyed || !this._readyToSync) {
return;
}
- // get the direction of the binding for the object we are
- // synchronizing from
+ // Get the direction of the binding for the object we are
+ // synchronizing from.
var direction = this._direction;
- var fromPath = this._from;
- var toPath = this._to;
+ var fromObj = this._fromObj;
+ var fromPath = this._fromPath;
this._direction = undefined;
- // if we're synchronizing from the remote object...
+ // If we're synchronizing from the remote object...
if (direction === 'fwd') {
- var fromValue = getWithGlobals(obj, this._from);
+ var fromValue = _emberMetalProperty_get.get(fromObj, fromPath);
if (log) {
- _emberMetalLogger.default.log(' ', this.toString(), '->', fromValue, obj);
+ _emberMetalLogger.default.log(' ', this.toString(), '->', fromValue, fromObj);
}
if (this._oneWay) {
- _emberMetalProperty_set.trySet(obj, toPath, fromValue);
+ _emberMetalProperty_set.trySet(toObj, this._to, fromValue);
} else {
- _emberMetalObserver._suspendObserver(obj, toPath, this, this.toDidChange, function () {
- _emberMetalProperty_set.trySet(obj, toPath, fromValue);
+ _emberMetalObserver._suspendObserver(toObj, this._to, this, 'toDidChange', function () {
+ _emberMetalProperty_set.trySet(toObj, this._to, fromValue);
});
}
- // if we're synchronizing *to* the remote object
+ // If we're synchronizing *to* the remote object.
} else if (direction === 'back') {
- var toValue = _emberMetalProperty_get.get(obj, this._to);
+ var toValue = _emberMetalProperty_get.get(toObj, this._to);
if (log) {
- _emberMetalLogger.default.log(' ', this.toString(), '<-', toValue, obj);
+ _emberMetalLogger.default.log(' ', this.toString(), '<-', toValue, toObj);
}
- _emberMetalObserver._suspendObserver(obj, fromPath, this, this.fromDidChange, function () {
- _emberMetalProperty_set.trySet(_emberMetalPath_cache.isGlobal(fromPath) ? _emberMetalCore.default.lookup : obj, fromPath, toValue);
+ _emberMetalObserver._suspendObserver(fromObj, fromPath, this, 'fromDidChange', function () {
+ _emberMetalProperty_set.trySet(fromObj, fromPath, toValue);
});
}
}
};
@@ -2138,11 +2140,11 @@
});
/**
An `Ember.Binding` connects the properties of two objects so that whenever
the value of one property changes, the other property will be changed also.
- ## Automatic Creation of Bindings with `/^*Binding/`-named Properties
+ ## Automatic Creation of Bindings with `/^*Binding/`-named Properties.
You do not usually create Binding objects directly but instead describe
bindings in your class or object definition using automatic binding
detection.
@@ -2187,11 +2189,11 @@
## Adding Bindings Manually
All of the examples above show you how to configure a custom binding, but the
result of these customizations will be a binding template, not a fully active
Binding instance. The binding will actually become active only when you
- instantiate the object the binding belongs to. It is useful however, to
+ instantiate the object the binding belongs to. It is useful, however, to
understand what actually happens when the binding is activated.
For a binding to function it must have at least a `from` property and a `to`
property. The `from` property path points to the object/key that you want to
bind from while the `to` path points to the object/key you want to bind to.
@@ -2286,11 +2288,10 @@
function bind(obj, to, from) {
return new Binding(to, from).connect(obj);
}
exports.Binding = Binding;
- exports.isGlobalPath = _emberMetalPath_cache.isGlobal;
});
// Ember.LOG_BINDINGS
enifed('ember-metal/cache', ['exports', 'ember-metal/empty_object'], function (exports, _emberMetalEmpty_object) {
'use strict';
@@ -2344,14 +2345,13 @@
this.hits = 0;
this.misses = 0;
}
};
});
-enifed('ember-metal/chains', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/meta', 'ember-metal/watch_key', 'ember-metal/empty_object'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberMetalMeta, _emberMetalWatch_key, _emberMetalEmpty_object) {
+enifed('ember-metal/chains', ['exports', 'ember-metal/property_get', 'ember-metal/meta', 'ember-metal/watch_key', 'ember-metal/empty_object'], function (exports, _emberMetalProperty_get, _emberMetalMeta, _emberMetalWatch_key, _emberMetalEmpty_object) {
'use strict';
- exports.flushPendingChains = flushPendingChains;
exports.finishChains = finishChains;
var FIRST_KEY = /^([^\.]+)/;
function firstKey(path) {
@@ -2364,13 +2364,11 @@
function isVolatile(obj) {
return !(isObject(obj) && obj.isDescriptor && obj._volatile === false);
}
- function ChainWatchers(obj) {
- // this obj would be the referencing chain node's parent node's value
- this.obj = obj;
+ function ChainWatchers() {
// 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 _emberMetalEmpty_object.default();
}
@@ -2451,35 +2449,14 @@
callback(obj, path);
}
}
};
- var pendingQueue = [];
-
- // attempts to add the pendingQueue chains again. If some of them end up
- // back in the queue and reschedule is true, schedules a timeout to try
- // again.
-
- function flushPendingChains() {
- if (pendingQueue.length === 0) {
- return;
- }
-
- var queue = pendingQueue;
- pendingQueue = [];
-
- queue.forEach(function (q) {
- return q[0].add(q[1]);
- });
-
- _emberMetalDebug.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() {
+ return new ChainWatchers();
}
- function makeChainWatcher(obj) {
- return new ChainWatchers(obj);
- }
-
function addChainWatcher(obj, keyName, node) {
if (!isObject(obj)) {
return;
}
@@ -2596,88 +2573,53 @@
},
// called on the root node of a chain to setup watchers on the specified
// path.
add: function (path) {
- var obj, tuple, key, src, paths;
-
- paths = this._paths;
+ var paths = this._paths;
paths[path] = (paths[path] || 0) + 1;
- obj = this.value();
- tuple = _emberMetalProperty_get.normalizeTuple(obj, path);
+ var key = firstKey(path);
+ var tail = path.slice(key.length + 1);
- // the path was a local path
- if (tuple[0] && tuple[0] === obj) {
- path = tuple[1];
- key = firstKey(path);
- path = path.slice(key.length + 1);
-
- // global path, but object does not exist yet.
- // put into a queue and try to connect later.
- } else if (!tuple[0]) {
- pendingQueue.push([this, path]);
- tuple.length = 0;
- return;
-
- // global path, and object already exists
- } else {
- src = tuple[0];
- key = path.slice(0, 0 - (tuple[1].length + 1));
- path = tuple[1];
- }
-
- tuple.length = 0;
- this.chain(key, path, src);
+ this.chain(key, tail);
},
// called on the root node of a chain to teardown watcher on the specified
// path
remove: function (path) {
- var obj, tuple, key, src, paths;
-
- paths = this._paths;
+ var paths = this._paths;
if (paths[path] > 0) {
paths[path]--;
}
- obj = this.value();
- tuple = _emberMetalProperty_get.normalizeTuple(obj, path);
- if (tuple[0] === obj) {
- path = tuple[1];
- key = firstKey(path);
- path = path.slice(key.length + 1);
- } else {
- src = tuple[0];
- key = path.slice(0, 0 - (tuple[1].length + 1));
- path = tuple[1];
- }
+ var key = firstKey(path);
+ var tail = path.slice(key.length + 1);
- tuple.length = 0;
- this.unchain(key, path);
+ this.unchain(key, tail);
},
- chain: function (key, path, src) {
+ chain: function (key, path) {
var chains = this._chains;
var node;
if (chains === undefined) {
chains = this._chains = new _emberMetalEmpty_object.default();
} else {
node = chains[key];
}
if (node === undefined) {
- node = chains[key] = new ChainNode(this, key, src);
+ node = chains[key] = new ChainNode(this, key, undefined);
}
node.count++; // count chains...
// chain rest of path if there is one
if (path) {
key = firstKey(path);
path = path.slice(key.length + 1);
- node.chain(key, path); // NOTE: no src means it will observe changes...
+ node.chain(key, path);
}
},
unchain: function (key, path) {
var chains = this._chains;
@@ -2720,29 +2662,25 @@
}
}
}
if (affected && this._parent) {
- this._parent.populateAffected(this, this._key, 1, affected);
+ this._parent.populateAffected(this._key, 1, affected);
}
},
- populateAffected: function (chain, path, depth, affected) {
+ populateAffected: function (path, depth, affected) {
if (this._key) {
path = this._key + '.' + path;
}
if (this._parent) {
- this._parent.populateAffected(this, path, depth + 1, affected);
+ this._parent.populateAffected(path, depth + 1, affected);
} else {
if (depth > 1) {
affected.push(this.value(), path);
}
- path = 'this.' + path;
- if (this._paths[path] > 0) {
- affected.push(this.value(), path);
- }
}
}
};
function finishChains(obj) {
@@ -2779,10 +2717,14 @@
function UNDEFINED() {}
var DEEP_EACH_REGEX = /\.@each\.[^.]+\./;
+ // ..........................................................
+ // COMPUTED PROPERTY
+ //
+
/**
A computed property transforms an object literal with object's accessor function(s) into a property.
By default the function backing the computed property will only be called
once and the result will be cached. You can specify various properties
@@ -2881,10 +2823,11 @@
- [New CP syntax RFC](https://github.com/emberjs/rfcs/blob/master/text/0011-improved-cp-syntax.md)
- [New computed syntax explained in "Ember 1.12 released" ](http://emberjs.com/blog/2015/05/13/ember-1-12-released.html#toc_new-computed-syntax)
@class ComputedProperty
@namespace Ember
+ @constructor
@public
*/
function ComputedProperty(config, opts) {
this.isDescriptor = true;
if (typeof config === 'function') {
@@ -3039,10 +2982,11 @@
@method meta
@param {Object} meta
@chainable
@public
*/
+
ComputedPropertyPrototype.meta = function (meta) {
if (arguments.length === 0) {
return this._meta || {};
} else {
this._meta = meta;
@@ -3069,10 +3013,37 @@
cache[keyName] = undefined;
_emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, meta);
}
};
+ /**
+ Access the value of the function backing the computed property.
+ If this property has already been cached, return the cached result.
+ Otherwise, call the function passing the property name as an argument.
+
+ ```javascript
+ let Person = Ember.Object.extend({
+ fullName: Ember.computed('firstName', 'lastName', function(keyName) {
+ // the keyName parameter is 'fullName' in this case.
+ return this.get('firstName') + ' ' + this.get('lastName');
+ })
+ });
+
+
+ let tom = Person.create({
+ firstName: 'Tom',
+ lastName: 'Dale'
+ });
+
+ tom.get('fullName') // 'Tom Dale'
+ ```
+
+ @method get
+ @param {String} keyName The key being accessed.
+ @return {Object} The return value of the function backing the CP.
+ @public
+ */
ComputedPropertyPrototype.get = function (obj, keyName) {
if (this._volatile) {
return this._getter.call(obj, keyName);
}
@@ -3100,10 +3071,58 @@
_emberMetalDependent_keys.addDependentKeys(this, obj, keyName, meta);
return ret;
};
+ /**
+ Set the value of a computed property. If the function that backs your
+ computed property does not accept arguments then the default action for
+ setting would be to define the property on the current object, and set
+ the value of the property to the value being set.
+
+ Generally speaking if you intend for your computed property to be set
+ you should pass `set(key, value)` function in hash as argument to `Ember.computed()` along with `get(key)` function.
+
+ ```javascript
+ let Person = Ember.Object.extend({
+ // these will be supplied by `create`
+ firstName: null,
+ lastName: null,
+
+ fullName: Ember.computed('firstName', 'lastName', {
+ // getter
+ get() {
+ let firstName = this.get('firstName');
+ let lastName = this.get('lastName');
+
+ return firstName + ' ' + lastName;
+ },
+ // setter
+ set(key, value) {
+ let [firstName, lastName] = value.split(' ');
+
+ this.set('firstName', firstName);
+ this.set('lastName', lastName);
+
+ return value;
+ }
+ })
+ });
+
+ let person = Person.create();
+
+ person.set('fullName', 'Peter Wagenet');
+ person.get('firstName'); // 'Peter'
+ person.get('lastName'); // 'Wagenet'
+ ```
+
+ @method set
+ @param {String} keyName The key being accessed.
+ @param {Object} newValue The new value being assigned.
+ @return {Object} The return value of the function backing the CP.
+ @public
+ */
ComputedPropertyPrototype.set = function computedPropertySetEntry(obj, keyName, value) {
if (this._readOnly) {
this._throwReadOnlyError(obj, keyName);
}
@@ -3243,11 +3262,11 @@
this.firstName = 'Betty';
this.lastName = 'Jones';
},
- fullName: Ember.computed('firstName', 'lastName', {
+ fullName: Ember.computed({
get(key) {
return `${this.get('firstName')} ${this.get('lastName')}`;
},
set(key, value) {
let [firstName, lastName] = value.split(/\s+/);
@@ -4021,19 +4040,21 @@
/**
This namespace contains all Ember methods and functions. Future versions of
Ember may overwrite this namespace and therefore, you should avoid adding any
new properties.
+ You can also use the shorthand `Em` instead of `Ember`.
+
At the heart of Ember is Ember-Runtime, a set of core functions that provide
cross-platform compatibility and object property observing. Ember-Runtime is
small and performance-focused so you can use it alongside other
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.4.6
+ @version 2.5.0-beta.1
@public
*/
if ('undefined' === typeof Ember) {
// Create core object. Make it act like an instance of Ember.Namespace so that
@@ -4071,15 +4092,15 @@
/**
The semantic version.
@property VERSION
@type String
- @default '2.4.6'
+ @default '2.5.0-beta.1'
@static
@public
*/
- Ember.VERSION = '2.4.6';
+ Ember.VERSION = '2.5.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
@@ -4806,22 +4827,21 @@
var events = args;
func.__ember_listens__ = events;
return func;
}
});
-enifed('ember-metal/expand_properties', ['exports', 'ember-metal/error'], function (exports, _emberMetalError) {
+enifed('ember-metal/expand_properties', ['exports', 'ember-metal/debug'], function (exports, _emberMetalDebug) {
'use strict';
exports.default = expandProperties;
/**
@module ember
@submodule ember-metal
*/
var SPLIT_REGEX = /\{|\}/;
-
var END_WITH_EACH_REGEX = /\.@each$/;
/**
Expands `pattern`, invoking `callback` for each expansion.
@@ -4849,29 +4869,25 @@
@param {Function} callback The callback to invoke. It is invoked once per
expansion, and is passed the expansion.
*/
function expandProperties(pattern, callback) {
- if (pattern.indexOf(' ') > -1) {
- throw new _emberMetalError.default('Brace expanded properties cannot contain spaces, e.g. \'user.{firstName, lastName}\' should be \'user.{firstName,lastName}\'');
- }
+ _emberMetalDebug.assert('A computed property key must be a string', typeof pattern === 'string');
+ _emberMetalDebug.assert('Brace expanded properties cannot contain spaces, e.g. "user.{firstName, lastName}" should be "user.{firstName,lastName}"', pattern.indexOf(' ') === -1);
- if ('string' === typeof pattern) {
- var parts = pattern.split(SPLIT_REGEX);
- var properties = [parts];
+ var parts = pattern.split(SPLIT_REGEX);
+ var properties = [parts];
- parts.forEach(function (part, index) {
- if (part.indexOf(',') >= 0) {
- properties = duplicateAndReplace(properties, part.split(','), index);
- }
- });
+ for (var i = 0; i < parts.length; i++) {
+ var part = parts[i];
+ if (part.indexOf(',') >= 0) {
+ properties = duplicateAndReplace(properties, part.split(','), i);
+ }
+ }
- properties.forEach(function (property) {
- callback(property.join('').replace(END_WITH_EACH_REGEX, '.[]'));
- });
- } else {
- callback(pattern.replace(END_WITH_EACH_REGEX, '.[]'));
+ for (var i = 0; i < properties.length; i++) {
+ callback(properties[i].join('').replace(END_WITH_EACH_REGEX, '.[]'));
}
}
function duplicateAndReplace(properties, currentParts, index) {
var all = [];
@@ -4903,15 +4919,13 @@
@namespace Ember
@static
@since 1.1.0
@public
*/
- var KNOWN_FEATURES = {};exports.KNOWN_FEATURES = KNOWN_FEATURES;
+ var FEATURES = _emberMetalAssign.default({}, _emberMetalCore.default.ENV.FEATURES);exports.FEATURES = FEATURES;
// jshint ignore:line
- var FEATURES = _emberMetalAssign.default(KNOWN_FEATURES, _emberMetalCore.default.ENV.FEATURES);
- 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:
@@ -4981,11 +4995,11 @@
ret[propertyNames[i]] = _emberMetalProperty_get.get(obj, propertyNames[i]);
}
return ret;
}
});
-enifed('ember-metal/index', ['exports', 'require', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/features', 'ember-metal/assign', '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, _require, _emberMetalCore, _emberMetalDebug, _emberMetalFeatures, _emberMetalAssign, _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) {
+enifed('ember-metal/index', ['exports', 'require', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/features', 'ember-metal/assign', '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/path_cache', '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, _require, _emberMetalCore, _emberMetalDebug, _emberMetalFeatures, _emberMetalAssign, _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, _emberMetalPath_cache, _emberMetalRun_loop, _emberMetalLibraries, _emberMetalIs_none, _emberMetalIs_empty, _emberMetalIs_blank, _emberMetalIs_present, _backburner) {
/**
@module ember
@submodule ember-metal
*/
@@ -5051,11 +5065,10 @@
_emberMetalCore.default.Logger = _emberMetalLogger.default;
_emberMetalCore.default.get = _emberMetalProperty_get.get;
_emberMetalCore.default.getWithDefault = _emberMetalProperty_get.getWithDefault;
- _emberMetalCore.default.normalizeTuple = _emberMetalProperty_get.normalizeTuple;
_emberMetalCore.default._getPath = _emberMetalProperty_get._getPath;
_emberMetalCore.default.on = _emberMetalEvents.on;
_emberMetalCore.default.addListener = _emberMetalEvents.addListener;
_emberMetalCore.default.removeListener = _emberMetalEvents.removeListener;
@@ -5089,11 +5102,10 @@
_emberMetalCore.default.setProperties = _emberMetalSet_properties.default;
_emberMetalCore.default.watchKey = _emberMetalWatch_key.watchKey;
_emberMetalCore.default.unwatchKey = _emberMetalWatch_key.unwatchKey;
- _emberMetalCore.default.flushPendingChains = _emberMetalChains.flushPendingChains;
_emberMetalCore.default.removeChainWatcher = _emberMetalChains.removeChainWatcher;
_emberMetalCore.default._ChainNode = _emberMetalChains.ChainNode;
_emberMetalCore.default.finishChains = _emberMetalChains.finishChains;
_emberMetalCore.default.watchPath = _emberMetalWatch_path.watchPath;
@@ -5125,11 +5137,11 @@
_emberMetalCore.default.mixin = _emberMetalMixin.mixin;
_emberMetalCore.default.Mixin = _emberMetalMixin.Mixin;
_emberMetalCore.default.bind = _emberMetalBinding.bind;
_emberMetalCore.default.Binding = _emberMetalBinding.Binding;
- _emberMetalCore.default.isGlobalPath = _emberMetalBinding.isGlobalPath;
+ _emberMetalCore.default.isGlobalPath = _emberMetalPath_cache.isGlobalPath;
_emberMetalCore.default.run = _emberMetalRun_loop.default;
/**
@class Backburner
@@ -5147,10 +5159,11 @@
_emberMetalCore.default.isNone = _emberMetalIs_none.default;
_emberMetalCore.default.isEmpty = _emberMetalIs_empty.default;
_emberMetalCore.default.isBlank = _emberMetalIs_blank.default;
_emberMetalCore.default.isPresent = _emberMetalIs_present.default;
+ _emberMetalCore.default.assign = Object.assign || _emberMetalAssign.default;
_emberMetalCore.default.merge = _emberMetalMerge.default;
_emberMetalCore.default.FEATURES = _emberMetalFeatures.FEATURES;
_emberMetalCore.default.FEATURES.isEnabled = _emberMetalFeatures.default;
@@ -5188,10 +5201,14 @@
_emberMetalCore.default.Debug.registerDeprecationHandler = function () {};
_emberMetalCore.default.Debug.registerWarnHandler = function () {};
}
+ _emberMetalDebug.deprecate('Support for the `ember-legacy-views` addon will end soon, please remove it from your application.', !!_emberMetalCore.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT, { id: 'ember-legacy-views', until: '2.6.0', url: 'http://emberjs.com/deprecations/v1.x/#toc_ember-view' });
+
+ _emberMetalDebug.deprecate('Support for the `ember-legacy-controllers` addon will end soon, please remove it from your application.', !!_emberMetalCore.default.ENV._ENABLE_LEGACY_CONTROLLER_SUPPORT, { id: 'ember-legacy-controllers', until: '2.6.0', url: 'http://emberjs.com/deprecations/v1.x/#toc_objectcontroller' });
+
_emberMetalCore.default.create = _emberMetalDebug.deprecateFunc('Ember.create is deprecated in favor of Object.create', { id: 'ember-metal.ember-create', until: '3.0.0' }, Object.create);
_emberMetalCore.default.keys = _emberMetalDebug.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;
});
@@ -5718,10 +5735,16 @@
this._registry.splice(index, 1);
}
}
};
+ if (_emberMetalFeatures.default('ember-libraries-isregistered')) {
+ Libraries.prototype.isRegistered = function (name) {
+ return !!this._getLibraryByName(name);
+ };
+ }
+
exports.default = Libraries;
});
enifed('ember-metal/logger', ['exports', 'ember-metal/core', 'ember-metal/error'], function (exports, _emberMetalCore, _emberMetalError) {
'use strict';
@@ -6389,10 +6412,13 @@
@return {Object}
@public
*/
function merge(original, updates) {
+ if (_emberMetalFeatures.default('ember-metal-ember-assign')) {
+ _emberMetalDebug.deprecate('Usage of `Ember.merge` is deprecated, use `Ember.assign` instead.', false, { id: 'ember-metal.merge', until: '3.0.0' });
+ }
if (!updates || typeof updates !== 'object') {
return original;
}
@@ -8244,13 +8270,13 @@
// define a simple property
Ember.defineProperty(contact, 'lastName', undefined, 'Jolley');
// define a computed property
- Ember.defineProperty(contact, 'fullName', Ember.computed('firstName', 'lastName', function() {
+ Ember.defineProperty(contact, 'fullName', Ember.computed(function() {
return this.firstName+' '+this.lastName;
- }));
+ }).property('firstName', 'lastName'));
```
@private
@method defineProperty
@for Ember
@@ -8628,24 +8654,21 @@
exports.overrideChains = overrideChains;
exports.beginPropertyChanges = beginPropertyChanges;
exports.endPropertyChanges = endPropertyChanges;
exports.changeProperties = changeProperties;
});
-enifed('ember-metal/property_get', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/error', 'ember-metal/path_cache'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalError, _emberMetalPath_cache) {
+enifed('ember-metal/property_get', ['exports', 'ember-metal/debug', 'ember-metal/path_cache'], function (exports, _emberMetalDebug, _emberMetalPath_cache) {
/**
@module ember-metal
*/
'use strict';
exports.get = get;
- exports.normalizeTuple = normalizeTuple;
exports._getPath = _getPath;
exports.getWithDefault = getWithDefault;
- var FIRST_KEY = /^([^\.]+)/;
-
// ..........................................................
// GET AND SET
//
// If we are on a platform that supports accessors we can use those.
// Otherwise simulate accessors by looking up the property directly on the
@@ -8707,81 +8730,28 @@
return ret;
}
}
- /**
- Normalizes a target/path pair to reflect that actual target/path that should
- be observed, etc. This takes into account passing in global property
- paths (i.e. a path beginning with a capital letter not defined on the
- target).
-
- @private
- @method normalizeTuple
- @for Ember
- @param {Object} target The current target. May be `null`.
- @param {String} path A path on the target or a global property path.
- @return {Array} a temporary array with the normalized target/path pair.
- */
-
- function normalizeTuple(target, path) {
- var hasThis = _emberMetalPath_cache.hasThis(path);
- var isGlobal = !hasThis && _emberMetalPath_cache.isGlobal(path);
- var key;
-
- if (!target && !isGlobal) {
- return [undefined, ''];
- }
-
- if (hasThis) {
- path = path.slice(5);
- }
-
- if (!target || isGlobal) {
- target = _emberMetalCore.default.lookup;
- }
-
- if (isGlobal && _emberMetalPath_cache.isPath(path)) {
- key = path.match(FIRST_KEY)[0];
- target = get(target, key);
- path = path.slice(key.length + 1);
- }
-
- // must return some kind of path to be valid else other things will break.
- validateIsPath(path);
-
- return [target, path];
- }
-
- function validateIsPath(path) {
- if (!path || path.length === 0) {
- throw new _emberMetalError.default('Object in path ' + path + ' could not be found or was destroyed.');
- }
- }
-
function _getPath(root, path) {
- var hasThis, parts, tuple, idx, len;
+ var obj = root;
+ var parts = path.split('.');
+ var len = parts.length;
- // detect complicated paths and normalize them
- hasThis = _emberMetalPath_cache.hasThis(path);
+ for (var i = 0; i < len; i++) {
+ if (obj == null) {
+ return obj;
+ }
- if (!root || hasThis) {
- tuple = normalizeTuple(root, path);
- root = tuple[0];
- path = tuple[1];
- tuple.length = 0;
- }
+ obj = get(obj, parts[i]);
- parts = path.split('.');
- len = parts.length;
- for (idx = 0; root != null && idx < len; idx++) {
- root = get(root, parts[idx]);
- if (root && root.isDestroyed) {
+ if (obj && obj.isDestroyed) {
return undefined;
}
}
- return root;
+
+ return obj;
}
/**
Retrieves the value of a property from an Object, or a default value in the
case that the property returns `undefined`.
@@ -8847,11 +8817,11 @@
var isUnknown, currentValue;
if (desc === undefined && _emberMetalPath_cache.isPath(keyName)) {
return setPath(obj, keyName, value, tolerant);
}
- _emberMetalDebug.assert('calling set on destroyed object', !obj.isDestroyed);
+ _emberMetalDebug.assert('calling set on destroyed object: ' + _emberMetalUtils.toString(obj) + '.' + keyName + ' = ' + _emberMetalUtils.toString(value), !obj.isDestroyed);
if (desc) {
desc.set(obj, keyName, value);
} else {
if (value !== undefined && typeof obj === 'object' && obj[keyName] === value) {
@@ -10341,17 +10311,17 @@
exports.zipHash = zipHash;
exports.chain = chain;
exports.setValue = setValue;
/*
- Check whether an object is a stream or not
+ Check whether an object is a stream or not.
@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
+ @param {Object|Stream} object Object to check whether it is a stream.
+ @return {Boolean} `true` if the object is a stream, `false` otherwise.
*/
function isStream(object) {
return object && object.isStream;
}
@@ -10361,14 +10331,14 @@
object. If a non-stream object is passed, the function does nothing.
@public
@for Ember.stream
@function subscribe
- @param {Object|Stream} object object or stream to potentially subscribe to
- @param {Function} callback function to run when stream value changes
+ @param {Object|Stream} object Object or stream to potentially subscribe to.
+ @param {Function} callback Function to run when stream value changes.
@param {Object} [context] the callback will be executed with this context if it
- is provided
+ is provided.
*/
function subscribe(object, callback, context) {
if (object && object.isStream) {
return object.subscribe(callback, context);
@@ -10380,30 +10350,30 @@
object. If a non-stream object is passed, the function does nothing.
@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()`
+ @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()`.
*/
function unsubscribe(object, callback, context) {
if (object && object.isStream) {
object.unsubscribe(callback, context);
}
}
/*
- Retrieve the value of a stream, or in the case a non-stream object is passed,
+ Retrieve the value of a stream, or in the case where a non-stream object is passed,
return the object itself.
@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
+ @param {Object|Stream} object Object to return the value of.
+ @return The stream's current value, or the non-stream object itself.
*/
function read(object) {
if (object && object.isStream) {
return object.value();
@@ -10417,11 +10387,11 @@
@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
+ @return {Array} A new array of the same length with the values of non-stream
objects mapped from their original positions untouched, and
the values of stream objects retaining their original position
and replaced with the stream's current value.
*/
@@ -10439,12 +10409,12 @@
stream.
@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
+ @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
the case of non-stream objects, and the streams' current
values in the case of stream objects.
*/
@@ -10455,18 +10425,18 @@
}
return ret;
}
/*
- Check whether an array contains any stream values
+ Check whether an array contains any stream values.
@private
@for Ember.stream
@function scanArray
- @param {Array} array array given to a handlebars helper
+ @param {Array} array Array given to a handlebars helper.
@return {Boolean} `true` if the array contains a stream/bound value, `false`
- otherwise
+ otherwise.
*/
function scanArray(array) {
var length = array.length;
var containsStream = false;
@@ -10480,18 +10450,18 @@
return containsStream;
}
/*
- Check whether a hash has any stream property values
+ Check whether a hash has any stream property values.
@private
@for Ember.stream
@function scanHash
- @param {Object} hash "hash" argument given to a handlebars helper
+ @param {Object} hash "hash" argument given to a handlebars helper.
@return {Boolean} `true` if the object contains a stream/bound value, `false`
- otherwise
+ otherwise.
*/
function scanHash(hash) {
var containsStream = false;
@@ -10508,12 +10478,12 @@
var ConcatStream = _emberMetalStreamsStream.default.extend({
init: function (array, separator) {
this.array = array;
this.separator = separator;
- // used by angle bracket components to detect an attribute was provided
- // as a string literal
+ // Used by angle bracket components to detect an attribute was provided
+ // as a string literal.
this.isConcat = true;
},
label: function () {
var labels = labelsFor(this.array);
@@ -10524,21 +10494,21 @@
return concat(readArray(this.array), this.separator);
}
});
/*
- Join an array, with any streams replaced by their current values
+ Join an array, with any streams replaced by their current values.
@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
+ zero or more non-stream objects.
+ @param {String} separator String to be used to join array elements.
@return {String} String with array elements concatenated and joined by the
provided separator, and any stream array members having been
- replaced by the current value of the stream
+ replaced by the current value of the stream.
*/
function concat(array, separator) {
// TODO: Create subclass ConcatStream < Stream. Defer
// subscribing to streams until the value() is called.
@@ -10674,13 +10644,13 @@
source was numeric.
@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
+ @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.
@return {Object|Stream} In the case of a stream `value` parameter, a new
stream that will be updated with the return value of
the provided function `fn`. In the case of a
non-stream object, the return value of the provided
function `fn`.
@@ -10743,10 +10713,11 @@
exports.makeArray = makeArray;
exports.inspect = inspect;
exports.apply = apply;
exports.applyStr = applyStr;
exports.lookupDescriptor = lookupDescriptor;
+ exports.toString = toString;
var _uuid = 0;
/**
Generates a universally unique identifier. This method
is used internally by Ember for assisting with
@@ -11127,11 +11098,11 @@
// ........................................
// TYPING & ARRAY MESSAGING
//
- var toString = Object.prototype.toString;
+ var objectToString = Object.prototype.toString;
/**
Forces the passed object to be part of an array. If the object is already
an array, it will return the object. Otherwise, it will add the object to
an array. If obj is `null` or `undefined`, it will return an empty array.
@@ -11191,11 +11162,11 @@
var type = typeof obj;
if (type !== 'object' && type !== 'symbol') {
return '' + obj;
}
// overridden toString
- if (typeof obj.toString === 'function' && obj.toString !== toString) {
+ if (typeof obj.toString === 'function' && obj.toString !== objectToString) {
return obj.toString();
}
// Object.prototype.toString === {}.toString
var v;
@@ -11209,11 +11180,11 @@
if (typeof v === 'function') {
v = 'function() { ... }';
}
if (v && typeof v.toString !== 'function') {
- ret.push(key + ': ' + toString.call(v));
+ ret.push(key + ': ' + objectToString.call(v));
} else {
ret.push(key + ': ' + v);
}
}
}
@@ -11291,10 +11262,21 @@
}
return null;
}
+ // A `toString` util function that supports objects without a `toString`
+ // method, e.g. an object created with `Object.create(null)`.
+
+ function toString(obj) {
+ if (obj && obj.toString) {
+ return obj.toString();
+ } else {
+ return objectToString.call(obj);
+ }
+ }
+
exports.GUID_KEY = GUID_KEY;
exports.makeArray = makeArray;
exports.canInvoke = canInvoke;
});
enifed('ember-metal/watch_key', ['exports', 'ember-metal/features', 'ember-metal/meta', 'ember-metal/properties', 'ember-metal/utils'], function (exports, _emberMetalFeatures, _emberMetalMeta, _emberMetalProperties, _emberMetalUtils) {
@@ -11510,12 +11492,10 @@
function watcherCount(obj, key) {
var meta = _emberMetalMeta.peekMeta(obj);
return meta && meta.peekWatching(key) || 0;
}
- watch.flushPending = _emberMetalChains.flushPendingChains;
-
function unwatch(obj, _keyPath, m) {
// can't watch length on Array - it is special...
if (_keyPath === 'length' && Array.isArray(obj)) {
return;
}
@@ -11703,24 +11683,23 @@
EmberHandlebars.precompile = _emberTemplateCompilerCompatPrecompile.default;
EmberHandlebars.compile = _emberTemplateCompilerSystemCompile.default;
EmberHandlebars.template = _emberTemplateCompilerSystemTemplate.default;
});
-enifed('ember-template-compiler/index', ['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-closure-component-attrs-into-mut', 'ember-template-compiler/plugins/transform-component-attrs-into-mut', 'ember-template-compiler/plugins/transform-component-curly-to-readonly', 'ember-template-compiler/plugins/transform-angle-bracket-components', 'ember-template-compiler/plugins/transform-input-on-to-onEvent', 'ember-template-compiler/plugins/transform-top-level-components', 'ember-template-compiler/plugins/transform-each-into-collection', 'ember-template-compiler/plugins/transform-unescaped-inline-link-to', 'ember-template-compiler/plugins/deprecate-render-block', '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, _emberTemplateCompilerPluginsTransformClosureComponentAttrsIntoMut, _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut, _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly, _emberTemplateCompilerPluginsTransformAngleBracketComponents, _emberTemplateCompilerPluginsTransformInputOnToOnEvent, _emberTemplateCompilerPluginsTransformTopLevelComponents, _emberTemplateCompilerPluginsTransformEachIntoCollection, _emberTemplateCompilerPluginsTransformUnescapedInlineLinkTo, _emberTemplateCompilerPluginsDeprecateRenderBlock, _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths, _emberTemplateCompilerPluginsAssertNoViewHelper, _emberTemplateCompilerCompat) {
+enifed('ember-template-compiler/index', ['exports', 'ember-metal', 'ember-template-compiler/system/precompile', 'ember-template-compiler/system/compile', 'ember-template-compiler/system/template', 'ember-template-compiler/plugins', 'ember-template-compiler/plugins/transform-old-binding-syntax', 'ember-template-compiler/plugins/transform-old-class-binding-syntax', 'ember-template-compiler/plugins/transform-item-class', 'ember-template-compiler/plugins/transform-component-attrs-into-mut', 'ember-template-compiler/plugins/transform-component-curly-to-readonly', 'ember-template-compiler/plugins/transform-angle-bracket-components', 'ember-template-compiler/plugins/transform-input-on-to-onEvent', 'ember-template-compiler/plugins/transform-top-level-components', 'ember-template-compiler/plugins/transform-each-into-collection', 'ember-template-compiler/plugins/transform-unescaped-inline-link-to', 'ember-template-compiler/plugins/assert-no-view-and-controller-paths', 'ember-template-compiler/plugins/assert-no-view-helper', 'ember-template-compiler/plugins/assert-no-each-in', 'ember-template-compiler/compat'], function (exports, _emberMetal, _emberTemplateCompilerSystemPrecompile, _emberTemplateCompilerSystemCompile, _emberTemplateCompilerSystemTemplate, _emberTemplateCompilerPlugins, _emberTemplateCompilerPluginsTransformOldBindingSyntax, _emberTemplateCompilerPluginsTransformOldClassBindingSyntax, _emberTemplateCompilerPluginsTransformItemClass, _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut, _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly, _emberTemplateCompilerPluginsTransformAngleBracketComponents, _emberTemplateCompilerPluginsTransformInputOnToOnEvent, _emberTemplateCompilerPluginsTransformTopLevelComponents, _emberTemplateCompilerPluginsTransformEachIntoCollection, _emberTemplateCompilerPluginsTransformUnescapedInlineLinkTo, _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths, _emberTemplateCompilerPluginsAssertNoViewHelper, _emberTemplateCompilerPluginsAssertNoEachIn, _emberTemplateCompilerCompat) {
'use strict';
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldBindingSyntax.default);
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldClassBindingSyntax.default);
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformItemClass.default);
- _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformClosureComponentAttrsIntoMut.default);
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut.default);
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly.default);
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformAngleBracketComponents.default);
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformInputOnToOnEvent.default);
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformTopLevelComponents.default);
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformUnescapedInlineLinkTo.default);
- _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsDeprecateRenderBlock.default);
+ _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsAssertNoEachIn.default);
if (_emberMetal.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformEachIntoCollection.default);
} else {
_emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths.default);
@@ -11733,17 +11712,60 @@
exports.template = _emberTemplateCompilerSystemTemplate.default;
exports.registerPlugin = _emberTemplateCompilerPlugins.registerPlugin;
});
// used for adding Ember.Handlebars.compile for backwards compat
+enifed('ember-template-compiler/plugins/assert-no-each-in', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-template-compiler/system/calculate-location-display'], function (exports, _emberMetalCore, _emberMetalDebug, _emberTemplateCompilerSystemCalculateLocationDisplay) {
+ 'use strict';
+
+ function AssertNoEachIn() {
+ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
+
+ this.syntax = null;
+ this.options = options;
+ }
+
+ AssertNoEachIn.prototype.transform = function AssertNoEachIn_transform(ast) {
+ if (!!_emberMetalCore.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
+ return ast;
+ }
+ var walker = new this.syntax.Walker();
+ var moduleName = this.options && this.options.moduleName;
+
+ walker.visit(ast, function (node) {
+ if (!validate(node)) {
+ return;
+ }
+ assertHelper(moduleName, node);
+ });
+
+ return ast;
+ };
+
+ function assertHelper(moduleName, node) {
+ var moduleInfo = _emberTemplateCompilerSystemCalculateLocationDisplay.default(moduleName, node.loc);
+ var singular = node.params[0].original;
+ var plural = node.params[2].original;
+
+ _emberMetalDebug.assert('Using {{#each ' + singular + ' in ' + plural + '}} ' + moduleInfo + 'is no longer supported in Ember 2.0+, please use {{#each ' + plural + ' as |' + singular + '|}}');
+ }
+
+ function validate(node) {
+ return (node.type === 'BlockStatement' || node.type === 'MustacheStatement') && node.path.original === 'each' && node.params.length === 3 && node.params[1].type === 'PathExpression' && node.params[1].original === 'in';
+ }
+
+ exports.default = AssertNoEachIn;
+});
enifed('ember-template-compiler/plugins/assert-no-view-and-controller-paths', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-template-compiler/system/calculate-location-display'], function (exports, _emberMetalCore, _emberMetalDebug, _emberTemplateCompilerSystemCalculateLocationDisplay) {
'use strict';
- function AssertNoViewAndControllerPaths(options) {
+ function AssertNoViewAndControllerPaths() {
+ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
+
// set later within HTMLBars to the syntax package
this.syntax = null;
- this.options = options || {};
+ this.options = options;
}
/**
@private
@method transform
@@ -11814,14 +11836,16 @@
exports.default = AssertNoViewAndControllerPaths;
});
enifed('ember-template-compiler/plugins/assert-no-view-helper', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-template-compiler/system/calculate-location-display'], function (exports, _emberMetalCore, _emberMetalDebug, _emberTemplateCompilerSystemCalculateLocationDisplay) {
'use strict';
- function AssertNoViewHelper(options) {
+ function AssertNoViewHelper() {
+ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
+
// set later within HTMLBars to the syntax package
this.syntax = null;
- this.options = options || {};
+ this.options = options;
}
/**
@private
@method transform
@@ -11859,49 +11883,10 @@
return (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && node.path.parts[0] === 'view';
}
exports.default = AssertNoViewHelper;
});
-enifed('ember-template-compiler/plugins/deprecate-render-block', ['exports', 'ember-metal/debug', 'ember-template-compiler/system/calculate-location-display'], function (exports, _emberMetalDebug, _emberTemplateCompilerSystemCalculateLocationDisplay) {
- 'use strict';
-
- exports.default = DeprecateRenderBlock;
-
- function DeprecateRenderBlock(options) {
- this.syntax = null;
- this.options = options;
- }
-
- DeprecateRenderBlock.prototype.transform = function DeprecateRenderBlock_transform(ast) {
- var moduleName = this.options.moduleName;
- var walker = new this.syntax.Walker();
-
- walker.visit(ast, function (node) {
- if (!validate(node)) {
- return;
- }
-
- _emberMetalDebug.deprecate(deprecationMessage(moduleName, node), false, {
- id: 'ember-template-compiler.deprecate-render-block',
- until: '2.4.0',
- url: 'http://emberjs.com/deprecations/v2.x#toc_render-helper-with-block'
- });
- });
-
- return ast;
- };
-
- function validate(node) {
- return node.type === 'BlockStatement' && node.path.original === 'render';
- }
-
- function deprecationMessage(moduleName, node) {
- var sourceInformation = _emberTemplateCompilerSystemCalculateLocationDisplay.default(moduleName, node.loc);
-
- return 'Usage of `render` in block form is deprecated ' + sourceInformation + '.';
- }
-});
enifed('ember-template-compiler/plugins/transform-angle-bracket-components', ['exports'], function (exports) {
'use strict';
function TransformAngleBracketComponents() {
// set later within HTMLBars to the syntax package
@@ -11931,92 +11916,10 @@
return node.type === 'ComponentNode';
}
exports.default = TransformAngleBracketComponents;
});
-enifed('ember-template-compiler/plugins/transform-closure-component-attrs-into-mut', ['exports'], function (exports) {
- 'use strict';
-
- function TransformClosureComponentAttrsIntoMut() {
- // set later within HTMLBars to the syntax package
- this.syntax = null;
- }
-
- /**
- @private
- @method transform
- @param {AST} ast The AST to be transformed.
- */
- TransformClosureComponentAttrsIntoMut.prototype.transform = function TransformClosureComponentAttrsIntoMut_transform(ast) {
- var b = this.syntax.builders;
- var walker = new this.syntax.Walker();
-
- walker.visit(ast, function (node) {
- if (validate(node)) {
- processExpression(b, node);
- }
- });
-
- return ast;
- };
-
- function processExpression(builder, node) {
- processSubExpressionsInNode(builder, node);
-
- if (isComponentClosure(node)) {
- mutParameters(builder, node);
- }
- }
-
- function processSubExpressionsInNode(builder, node) {
- for (var i = 0; i < node.params.length; i++) {
- if (node.params[i].type === 'SubExpression') {
- processExpression(builder, node.params[i]);
- }
- }
-
- each(node.hash.pairs, function (pair) {
- var value = pair.value;
-
- if (value.type === 'SubExpression') {
- processExpression(builder, value);
- }
- });
- }
-
- function isComponentClosure(node) {
- return node.type === 'SubExpression' && node.path.original === 'component';
- }
-
- function mutParameters(builder, node) {
- for (var i = 1; i < node.params.length; i++) {
- if (node.params[i].type === 'PathExpression') {
- node.params[i] = builder.sexpr(builder.path('@mut'), [node.params[i]]);
- }
- }
-
- each(node.hash.pairs, function (pair) {
- var value = pair.value;
-
- if (value.type === 'PathExpression') {
- pair.value = builder.sexpr(builder.path('@mut'), [pair.value]);
- }
- });
- }
-
- function validate(node) {
- return node.type === 'BlockStatement' || node.type === 'MustacheStatement';
- }
-
- function each(list, callback) {
- for (var i = 0, l = list.length; i < l; i++) {
- callback(list[i]);
- }
- }
-
- exports.default = TransformClosureComponentAttrsIntoMut;
-});
enifed('ember-template-compiler/plugins/transform-component-attrs-into-mut', ['exports'], function (exports) {
'use strict';
function TransformComponentAttrsIntoMut() {
// set later within HTMLBars to the syntax package
@@ -12108,79 +12011,10 @@
}
}
exports.default = TransformComponentCurlyToReadonly;
});
-enifed('ember-template-compiler/plugins/transform-each-in-to-hash', ['exports'], function (exports) {
- /**
- @module ember
- @submodule ember-htmlbars
- */
-
- /**
- An HTMLBars AST transformation that replaces all instances of
-
- ```handlebars
- {{#each item in items}}
- {{/each}}
- ```
-
- with
-
- ```handlebars
- {{#each items keyword="item"}}
- {{/each}}
- ```
-
- @class TransformEachInToHash
- @private
- */
- 'use strict';
-
- function TransformEachInToHash(options) {
- // set later within HTMLBars to the syntax package
- this.syntax = null;
- this.options = options || {};
- }
-
- /**
- @private
- @method transform
- @param {AST} ast The AST to be transformed.
- */
- TransformEachInToHash.prototype.transform = function TransformEachInToHash_transform(ast) {
- var pluginContext = this;
- 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);
- var keyword = removedParams[0].original;
-
- // TODO: This may not be necessary.
- if (!node.sexpr.hash) {
- node.sexpr.hash = b.hash();
- }
-
- node.sexpr.hash.pairs.push(b.pair('keyword', b.string(keyword)));
- }
- });
-
- return ast;
- };
-
- TransformEachInToHash.prototype.validate = function TransformEachInToHash_validate(node) {
- return (node.type === 'BlockStatement' || node.type === 'MustacheStatement') && node.sexpr.path.original === 'each' && node.sexpr.params.length === 3 && node.sexpr.params[1].type === 'PathExpression' && node.sexpr.params[1].original === 'in';
- };
-
- exports.default = TransformEachInToHash;
-});
enifed('ember-template-compiler/plugins/transform-each-into-collection', ['exports', 'ember-metal/debug', 'ember-template-compiler/system/calculate-location-display'], function (exports, _emberMetalDebug, _emberTemplateCompilerSystemCalculateLocationDisplay) {
'use strict';
exports.default = TransformEachIntoCollection;
@@ -12266,14 +12100,16 @@
```
@private
@class TransformInputOnToOnEvent
*/
- function TransformInputOnToOnEvent(options) {
+ function TransformInputOnToOnEvent() {
+ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
+
// set later within HTMLBars to the syntax package
this.syntax = null;
- this.options = options || {};
+ this.options = options;
}
/**
@private
@method transform
@@ -12618,11 +12454,11 @@
}
return segments;
}
});
-enifed('ember-template-compiler/plugins/transform-top-level-components', ['exports', 'ember-metal/features'], function (exports, _emberMetalFeatures) {
+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;
@@ -12769,12 +12605,12 @@
enifed('ember-template-compiler/system/calculate-location-display', ['exports'], function (exports) {
'use strict';
exports.default = calculateLocationDisplay;
- function calculateLocationDisplay(moduleName, _loc) {
- var loc = _loc || {};
+ function calculateLocationDisplay(moduleName) {
+ var loc = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var _ref = loc.start || {};
var column = _ref.column;
var line = _ref.line;
@@ -12832,11 +12668,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/assign', 'ember-template-compiler/plugins'], function (exports, _emberMetalFeatures, _emberMetalAssign, _emberTemplateCompilerPlugins) {
+enifed('ember-template-compiler/system/compile_options', ['exports', 'ember-metal/assign', 'ember-template-compiler/plugins'], function (exports, _emberMetalAssign, _emberTemplateCompilerPlugins) {
/**
@module ember
@submodule ember-template-compiler
*/
@@ -12872,10 +12708,10 @@
options.plugins = plugins;
options.buildMeta = function buildMeta(program) {
return {
fragmentReason: fragmentReason(program),
- revision: 'Ember@2.4.6',
+ revision: 'Ember@2.5.0-beta.1',
loc: program.loc,
moduleName: options.moduleName
};
};
\ No newline at end of file