dist/ember.prod.js in ember-source-2.1.2 vs dist/ember.prod.js in ember-source-2.2.0.beta.1
- old
+ new
@@ -1,17 +1,17 @@
+;(function() {
/*!
* @overview Ember - JavaScript Application Framework
* @copyright Copyright 2011-2015 Tilde Inc. and contributors
* Portions Copyright 2006-2011 Strobe Inc.
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
* @license Licensed under MIT license
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
- * @version 2.1.2
+ * @version 2.2.0-beta.1
*/
-(function() {
-var enifed, requireModule, eriuqer, requirejs, Ember;
+var enifed, requireModule, require, requirejs, Ember;
var mainContext = this;
(function() {
var isNode = typeof window === 'undefined' &&
typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
@@ -38,11 +38,11 @@
}
registry[name] = value;
};
- requirejs = eriuqer = requireModule = function(name) {
+ requirejs = require = requireModule = function(name) {
return internalRequire(name, null);
}
function internalRequire(name, referrerName) {
var exports = seen[name];
@@ -69,57 +69,444 @@
for (var i = 0; i < length; i++) {
if (deps[i] === 'exports') {
reified.push(exports);
} else {
- reified.push(internalRequire(resolve(deps[i], name), name));
+ reified.push(internalRequire(deps[i], name));
}
}
callback.apply(this, reified);
return exports;
};
- function resolve(child, name) {
- if (child.charAt(0) !== '.') {
- return child;
+ requirejs._eak_seen = registry;
+
+ Ember.__loader = {
+ define: enifed,
+ require: require,
+ registry: registry
+ };
+ } else {
+ enifed = Ember.__loader.define;
+ requirejs = require = requireModule = Ember.__loader.require;
+ }
+})();
+
+enifed("backburner/binary-search", ["exports"], function (exports) {
+ "use strict";
+
+ exports.default = binarySearch;
+
+ function binarySearch(time, timers) {
+ var start = 0;
+ var end = timers.length - 2;
+ var middle, l;
+
+ while (start < end) {
+ // since timers is an array of pairs 'l' will always
+ // be an integer
+ l = (end - start) / 2;
+
+ // compensate for the index in case even number
+ // of pairs inside timers
+ middle = start + l - l % 2;
+
+ if (time >= timers[middle]) {
+ start = middle + 2;
+ } else {
+ end = middle;
}
- var parts = child.split('/');
- var parentBase = name.split('/').slice(0, -1);
+ }
- for (var i = 0, l = parts.length; i < l; i++) {
- var part = parts[i];
+ return time >= timers[start] ? start + 2 : start;
+ }
+});
+enifed('backburner/deferred-action-queues', ['exports', 'backburner/utils', 'backburner/queue'], function (exports, _backburnerUtils, _backburnerQueue) {
+ 'use strict';
- if (part === '..') {
- parentBase.pop();
- } else if (part === '.') {
- continue;
+ exports.default = DeferredActionQueues;
+
+ function DeferredActionQueues(queueNames, options) {
+ var queues = this.queues = {};
+ this.queueNames = queueNames = queueNames || [];
+
+ this.options = options;
+
+ _backburnerUtils.each(queueNames, function (queueName) {
+ queues[queueName] = new _backburnerQueue.default(queueName, options[queueName], options);
+ });
+ }
+
+ function noSuchQueue(name) {
+ throw new Error('You attempted to schedule an action in a queue (' + name + ') that doesn\'t exist');
+ }
+
+ function noSuchMethod(name) {
+ throw new Error('You attempted to schedule an action in a queue (' + name + ') for a method that doesn\'t exist');
+ }
+
+ DeferredActionQueues.prototype = {
+ schedule: function (name, target, method, args, onceFlag, stack) {
+ var queues = this.queues;
+ var queue = queues[name];
+
+ if (!queue) {
+ noSuchQueue(name);
+ }
+
+ if (!method) {
+ noSuchMethod(name);
+ }
+
+ if (onceFlag) {
+ return queue.pushUnique(target, method, args, stack);
+ } else {
+ return queue.push(target, method, args, stack);
+ }
+ },
+
+ flush: function () {
+ var queues = this.queues;
+ var queueNames = this.queueNames;
+ var queueName, queue;
+ var queueNameIndex = 0;
+ var numberOfQueues = queueNames.length;
+
+ while (queueNameIndex < numberOfQueues) {
+ queueName = queueNames[queueNameIndex];
+ queue = queues[queueName];
+
+ var numberOfQueueItems = queue._queue.length;
+
+ if (numberOfQueueItems === 0) {
+ queueNameIndex++;
} else {
- parentBase.push(part);
+ queue.flush(false /* async */);
+ queueNameIndex = 0;
}
}
+ }
+ };
+});
+enifed('backburner/platform', ['exports'], function (exports) {
+ // In IE 6-8, try/finally doesn't work without a catch.
+ // Unfortunately, this is impossible to test for since wrapping it in a parent try/catch doesn't trigger the bug.
+ // This tests for another broken try/catch behavior that only exhibits in the same versions of IE.
+ 'use strict';
- return parentBase.join('/');
+ var needsIETryCatchFix = (function (e, x) {
+ try {
+ x();
+ } catch (e) {} // jshint ignore:line
+ return !!e;
+ })();
+
+ exports.needsIETryCatchFix = needsIETryCatchFix;
+ var platform;
+
+ /* global self */
+ if (typeof self === 'object') {
+ platform = self;
+
+ /* global global */
+ } else if (typeof global === 'object') {
+ platform = global;
+ } else {
+ throw new Error('no global: `self` or `global` found');
}
- requirejs._eak_seen = registry;
+ exports.default = platform;
+});
+enifed('backburner/queue', ['exports', 'backburner/utils'], function (exports, _backburnerUtils) {
+ 'use strict';
- Ember.__loader = {
- define: enifed,
- require: eriuqer,
- registry: registry
- };
- } else {
- enifed = Ember.__loader.define;
- requirejs = eriuqer = requireModule = Ember.__loader.require;
+ exports.default = Queue;
+
+ function Queue(name, options, globalOptions) {
+ this.name = name;
+ this.globalOptions = globalOptions || {};
+ this.options = options;
+ this._queue = [];
+ this.targetQueues = {};
+ this._queueBeingFlushed = undefined;
}
-})();
-enifed('backburner', ['exports', './backburner/utils', './backburner/platform', './backburner/binary-search', './backburner/deferred-action-queues'], function (exports, _backburnerUtils, _backburnerPlatform, _backburnerBinarySearch, _backburnerDeferredActionQueues) {
+ Queue.prototype = {
+ push: function (target, method, args, stack) {
+ var queue = this._queue;
+ queue.push(target, method, args, stack);
+
+ return {
+ queue: this,
+ target: target,
+ method: method
+ };
+ },
+
+ pushUniqueWithoutGuid: function (target, method, args, stack) {
+ var queue = this._queue;
+
+ for (var i = 0, l = queue.length; i < l; i += 4) {
+ var currentTarget = queue[i];
+ var currentMethod = queue[i + 1];
+
+ if (currentTarget === target && currentMethod === method) {
+ queue[i + 2] = args; // replace args
+ queue[i + 3] = stack; // replace stack
+ return;
+ }
+ }
+
+ queue.push(target, method, args, stack);
+ },
+
+ targetQueue: function (targetQueue, target, method, args, stack) {
+ var queue = this._queue;
+
+ for (var i = 0, l = targetQueue.length; i < l; i += 2) {
+ var currentMethod = targetQueue[i];
+ var currentIndex = targetQueue[i + 1];
+
+ if (currentMethod === method) {
+ queue[currentIndex + 2] = args; // replace args
+ queue[currentIndex + 3] = stack; // replace stack
+ return;
+ }
+ }
+
+ targetQueue.push(method, queue.push(target, method, args, stack) - 4);
+ },
+
+ pushUniqueWithGuid: function (guid, target, method, args, stack) {
+ var hasLocalQueue = this.targetQueues[guid];
+
+ if (hasLocalQueue) {
+ this.targetQueue(hasLocalQueue, target, method, args, stack);
+ } else {
+ this.targetQueues[guid] = [method, this._queue.push(target, method, args, stack) - 4];
+ }
+
+ return {
+ queue: this,
+ target: target,
+ method: method
+ };
+ },
+
+ pushUnique: function (target, method, args, stack) {
+ var KEY = this.globalOptions.GUID_KEY;
+
+ if (target && KEY) {
+ var guid = target[KEY];
+ if (guid) {
+ return this.pushUniqueWithGuid(guid, target, method, args, stack);
+ }
+ }
+
+ this.pushUniqueWithoutGuid(target, method, args, stack);
+
+ return {
+ queue: this,
+ target: target,
+ method: method
+ };
+ },
+
+ invoke: function (target, method, args, _, _errorRecordedForStack) {
+ if (args && args.length > 0) {
+ method.apply(target, args);
+ } else {
+ method.call(target);
+ }
+ },
+
+ invokeWithOnError: function (target, method, args, onError, errorRecordedForStack) {
+ try {
+ if (args && args.length > 0) {
+ method.apply(target, args);
+ } else {
+ method.call(target);
+ }
+ } catch (error) {
+ onError(error, errorRecordedForStack);
+ }
+ },
+
+ flush: function (sync) {
+ var queue = this._queue;
+ var length = queue.length;
+
+ if (length === 0) {
+ return;
+ }
+
+ var globalOptions = this.globalOptions;
+ var options = this.options;
+ var before = options && options.before;
+ var after = options && options.after;
+ var onError = globalOptions.onError || globalOptions.onErrorTarget && globalOptions.onErrorTarget[globalOptions.onErrorMethod];
+ var target, method, args, errorRecordedForStack;
+ var invoke = onError ? this.invokeWithOnError : this.invoke;
+
+ this.targetQueues = Object.create(null);
+ var queueItems = this._queueBeingFlushed = this._queue.slice();
+ this._queue = [];
+
+ if (before) {
+ before();
+ }
+
+ for (var i = 0; i < length; i += 4) {
+ target = queueItems[i];
+ method = queueItems[i + 1];
+ args = queueItems[i + 2];
+ errorRecordedForStack = queueItems[i + 3]; // Debugging assistance
+
+ if (_backburnerUtils.isString(method)) {
+ method = target[method];
+ }
+
+ // method could have been nullified / canceled during flush
+ if (method) {
+ //
+ // ** Attention intrepid developer **
+ //
+ // To find out the stack of this task when it was scheduled onto
+ // the run loop, add the following to your app.js:
+ //
+ // Ember.run.backburner.DEBUG = true; // NOTE: This slows your app, don't leave it on in production.
+ //
+ // Once that is in place, when you are at a breakpoint and navigate
+ // here in the stack explorer, you can look at `errorRecordedForStack.stack`,
+ // which will be the captured stack when this job was scheduled.
+ //
+ invoke(target, method, args, onError, errorRecordedForStack);
+ }
+ }
+
+ if (after) {
+ after();
+ }
+
+ this._queueBeingFlushed = undefined;
+
+ if (sync !== false && this._queue.length > 0) {
+ // check if new items have been added
+ this.flush(true);
+ }
+ },
+
+ cancel: function (actionToCancel) {
+ var queue = this._queue,
+ currentTarget,
+ currentMethod,
+ i,
+ l;
+ var target = actionToCancel.target;
+ var method = actionToCancel.method;
+ var GUID_KEY = this.globalOptions.GUID_KEY;
+
+ if (GUID_KEY && this.targetQueues && target) {
+ var targetQueue = this.targetQueues[target[GUID_KEY]];
+
+ if (targetQueue) {
+ for (i = 0, l = targetQueue.length; i < l; i++) {
+ if (targetQueue[i] === method) {
+ targetQueue.splice(i, 1);
+ }
+ }
+ }
+ }
+
+ for (i = 0, l = queue.length; i < l; i += 4) {
+ currentTarget = queue[i];
+ currentMethod = queue[i + 1];
+
+ if (currentTarget === target && currentMethod === method) {
+ queue.splice(i, 4);
+ return true;
+ }
+ }
+
+ // if not found in current queue
+ // could be in the queue that is being flushed
+ queue = this._queueBeingFlushed;
+
+ if (!queue) {
+ return;
+ }
+
+ for (i = 0, l = queue.length; i < l; i += 4) {
+ currentTarget = queue[i];
+ currentMethod = queue[i + 1];
+
+ if (currentTarget === target && currentMethod === method) {
+ // don't mess with array during flush
+ // just nullify the method
+ queue[i + 1] = null;
+ return true;
+ }
+ }
+ }
+ };
+});
+enifed('backburner/utils', ['exports'], function (exports) {
'use strict';
+ exports.each = each;
+ exports.isString = isString;
+ exports.isFunction = isFunction;
+ exports.isNumber = isNumber;
+ exports.isCoercableNumber = isCoercableNumber;
+ exports.wrapInTryCatch = wrapInTryCatch;
+ var NUMBER = /\d+/;
+
+ function each(collection, callback) {
+ for (var i = 0; i < collection.length; i++) {
+ callback(collection[i]);
+ }
+ }
+
+ // Date.now is not available in browsers < IE9
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility
+ var now = Date.now || function () {
+ return new Date().getTime();
+ };
+
+ exports.now = now;
+
+ function isString(suspect) {
+ return typeof suspect === 'string';
+ }
+
+ function isFunction(suspect) {
+ return typeof suspect === 'function';
+ }
+
+ function isNumber(suspect) {
+ return typeof suspect === 'number';
+ }
+
+ function isCoercableNumber(number) {
+ return isNumber(number) || NUMBER.test(number);
+ }
+
+ function wrapInTryCatch(func) {
+ return function () {
+ try {
+ return func.apply(this, arguments);
+ } catch (e) {
+ throw e;
+ }
+ };
+ }
+});
+enifed('backburner', ['exports', 'backburner/utils', 'backburner/platform', 'backburner/binary-search', 'backburner/deferred-action-queues'], function (exports, _backburnerUtils, _backburnerPlatform, _backburnerBinarySearch, _backburnerDeferredActionQueues) {
+ 'use strict';
+
exports.default = Backburner;
function Backburner(queueNames, options) {
this.queueNames = queueNames;
this.options = options || {};
@@ -793,446 +1180,13 @@
function clearItems(item) {
clearTimeout(item[2]);
}
});
-enifed("backburner/binary-search", ["exports"], function (exports) {
- "use strict";
-
- exports.default = binarySearch;
-
- function binarySearch(time, timers) {
- var start = 0;
- var end = timers.length - 2;
- var middle, l;
-
- while (start < end) {
- // since timers is an array of pairs 'l' will always
- // be an integer
- l = (end - start) / 2;
-
- // compensate for the index in case even number
- // of pairs inside timers
- middle = start + l - l % 2;
-
- if (time >= timers[middle]) {
- start = middle + 2;
- } else {
- end = middle;
- }
- }
-
- return time >= timers[start] ? start + 2 : start;
- }
-});
-enifed('backburner/deferred-action-queues', ['exports', './utils', './queue'], function (exports, _utils, _queue) {
+enifed('container/container', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/dictionary', 'ember-metal/features'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalDictionary, _emberMetalFeatures) {
'use strict';
- exports.default = DeferredActionQueues;
-
- function DeferredActionQueues(queueNames, options) {
- var queues = this.queues = {};
- this.queueNames = queueNames = queueNames || [];
-
- this.options = options;
-
- _utils.each(queueNames, function (queueName) {
- queues[queueName] = new _queue.default(queueName, options[queueName], options);
- });
- }
-
- function noSuchQueue(name) {
- throw new Error('You attempted to schedule an action in a queue (' + name + ') that doesn\'t exist');
- }
-
- function noSuchMethod(name) {
- throw new Error('You attempted to schedule an action in a queue (' + name + ') for a method that doesn\'t exist');
- }
-
- DeferredActionQueues.prototype = {
- schedule: function (name, target, method, args, onceFlag, stack) {
- var queues = this.queues;
- var queue = queues[name];
-
- if (!queue) {
- noSuchQueue(name);
- }
-
- if (!method) {
- noSuchMethod(name);
- }
-
- if (onceFlag) {
- return queue.pushUnique(target, method, args, stack);
- } else {
- return queue.push(target, method, args, stack);
- }
- },
-
- flush: function () {
- var queues = this.queues;
- var queueNames = this.queueNames;
- var queueName, queue;
- var queueNameIndex = 0;
- var numberOfQueues = queueNames.length;
-
- while (queueNameIndex < numberOfQueues) {
- queueName = queueNames[queueNameIndex];
- queue = queues[queueName];
-
- var numberOfQueueItems = queue._queue.length;
-
- if (numberOfQueueItems === 0) {
- queueNameIndex++;
- } else {
- queue.flush(false /* async */);
- queueNameIndex = 0;
- }
- }
- }
- };
-});
-enifed('backburner/platform', ['exports'], function (exports) {
- // In IE 6-8, try/finally doesn't work without a catch.
- // Unfortunately, this is impossible to test for since wrapping it in a parent try/catch doesn't trigger the bug.
- // This tests for another broken try/catch behavior that only exhibits in the same versions of IE.
- 'use strict';
-
- var needsIETryCatchFix = (function (e, x) {
- try {
- x();
- } catch (e) {} // jshint ignore:line
- return !!e;
- })();
-
- exports.needsIETryCatchFix = needsIETryCatchFix;
- var platform;
-
- /* global self */
- if (typeof self === 'object') {
- platform = self;
-
- /* global global */
- } else if (typeof global === 'object') {
- platform = global;
- } else {
- throw new Error('no global: `self` or `global` found');
- }
-
- exports.default = platform;
-});
-enifed('backburner/queue', ['exports', './utils'], function (exports, _utils) {
- 'use strict';
-
- exports.default = Queue;
-
- function Queue(name, options, globalOptions) {
- this.name = name;
- this.globalOptions = globalOptions || {};
- this.options = options;
- this._queue = [];
- this.targetQueues = {};
- this._queueBeingFlushed = undefined;
- }
-
- Queue.prototype = {
- push: function (target, method, args, stack) {
- var queue = this._queue;
- queue.push(target, method, args, stack);
-
- return {
- queue: this,
- target: target,
- method: method
- };
- },
-
- pushUniqueWithoutGuid: function (target, method, args, stack) {
- var queue = this._queue;
-
- for (var i = 0, l = queue.length; i < l; i += 4) {
- var currentTarget = queue[i];
- var currentMethod = queue[i + 1];
-
- if (currentTarget === target && currentMethod === method) {
- queue[i + 2] = args; // replace args
- queue[i + 3] = stack; // replace stack
- return;
- }
- }
-
- queue.push(target, method, args, stack);
- },
-
- targetQueue: function (targetQueue, target, method, args, stack) {
- var queue = this._queue;
-
- for (var i = 0, l = targetQueue.length; i < l; i += 2) {
- var currentMethod = targetQueue[i];
- var currentIndex = targetQueue[i + 1];
-
- if (currentMethod === method) {
- queue[currentIndex + 2] = args; // replace args
- queue[currentIndex + 3] = stack; // replace stack
- return;
- }
- }
-
- targetQueue.push(method, queue.push(target, method, args, stack) - 4);
- },
-
- pushUniqueWithGuid: function (guid, target, method, args, stack) {
- var hasLocalQueue = this.targetQueues[guid];
-
- if (hasLocalQueue) {
- this.targetQueue(hasLocalQueue, target, method, args, stack);
- } else {
- this.targetQueues[guid] = [method, this._queue.push(target, method, args, stack) - 4];
- }
-
- return {
- queue: this,
- target: target,
- method: method
- };
- },
-
- pushUnique: function (target, method, args, stack) {
- var KEY = this.globalOptions.GUID_KEY;
-
- if (target && KEY) {
- var guid = target[KEY];
- if (guid) {
- return this.pushUniqueWithGuid(guid, target, method, args, stack);
- }
- }
-
- this.pushUniqueWithoutGuid(target, method, args, stack);
-
- return {
- queue: this,
- target: target,
- method: method
- };
- },
-
- invoke: function (target, method, args, _, _errorRecordedForStack) {
- if (args && args.length > 0) {
- method.apply(target, args);
- } else {
- method.call(target);
- }
- },
-
- invokeWithOnError: function (target, method, args, onError, errorRecordedForStack) {
- try {
- if (args && args.length > 0) {
- method.apply(target, args);
- } else {
- method.call(target);
- }
- } catch (error) {
- onError(error, errorRecordedForStack);
- }
- },
-
- flush: function (sync) {
- var queue = this._queue;
- var length = queue.length;
-
- if (length === 0) {
- return;
- }
-
- var globalOptions = this.globalOptions;
- var options = this.options;
- var before = options && options.before;
- var after = options && options.after;
- var onError = globalOptions.onError || globalOptions.onErrorTarget && globalOptions.onErrorTarget[globalOptions.onErrorMethod];
- var target, method, args, errorRecordedForStack;
- var invoke = onError ? this.invokeWithOnError : this.invoke;
-
- this.targetQueues = Object.create(null);
- var queueItems = this._queueBeingFlushed = this._queue.slice();
- this._queue = [];
-
- if (before) {
- before();
- }
-
- for (var i = 0; i < length; i += 4) {
- target = queueItems[i];
- method = queueItems[i + 1];
- args = queueItems[i + 2];
- errorRecordedForStack = queueItems[i + 3]; // Debugging assistance
-
- if (_utils.isString(method)) {
- method = target[method];
- }
-
- // method could have been nullified / canceled during flush
- if (method) {
- //
- // ** Attention intrepid developer **
- //
- // To find out the stack of this task when it was scheduled onto
- // the run loop, add the following to your app.js:
- //
- // Ember.run.backburner.DEBUG = true; // NOTE: This slows your app, don't leave it on in production.
- //
- // Once that is in place, when you are at a breakpoint and navigate
- // here in the stack explorer, you can look at `errorRecordedForStack.stack`,
- // which will be the captured stack when this job was scheduled.
- //
- invoke(target, method, args, onError, errorRecordedForStack);
- }
- }
-
- if (after) {
- after();
- }
-
- this._queueBeingFlushed = undefined;
-
- if (sync !== false && this._queue.length > 0) {
- // check if new items have been added
- this.flush(true);
- }
- },
-
- cancel: function (actionToCancel) {
- var queue = this._queue,
- currentTarget,
- currentMethod,
- i,
- l;
- var target = actionToCancel.target;
- var method = actionToCancel.method;
- var GUID_KEY = this.globalOptions.GUID_KEY;
-
- if (GUID_KEY && this.targetQueues && target) {
- var targetQueue = this.targetQueues[target[GUID_KEY]];
-
- if (targetQueue) {
- for (i = 0, l = targetQueue.length; i < l; i++) {
- if (targetQueue[i] === method) {
- targetQueue.splice(i, 1);
- }
- }
- }
- }
-
- for (i = 0, l = queue.length; i < l; i += 4) {
- currentTarget = queue[i];
- currentMethod = queue[i + 1];
-
- if (currentTarget === target && currentMethod === method) {
- queue.splice(i, 4);
- return true;
- }
- }
-
- // if not found in current queue
- // could be in the queue that is being flushed
- queue = this._queueBeingFlushed;
-
- if (!queue) {
- return;
- }
-
- for (i = 0, l = queue.length; i < l; i += 4) {
- currentTarget = queue[i];
- currentMethod = queue[i + 1];
-
- if (currentTarget === target && currentMethod === method) {
- // don't mess with array during flush
- // just nullify the method
- queue[i + 1] = null;
- return true;
- }
- }
- }
- };
-});
-enifed('backburner/utils', ['exports'], function (exports) {
- 'use strict';
-
- exports.each = each;
- exports.isString = isString;
- exports.isFunction = isFunction;
- exports.isNumber = isNumber;
- exports.isCoercableNumber = isCoercableNumber;
- exports.wrapInTryCatch = wrapInTryCatch;
- var NUMBER = /\d+/;
-
- function each(collection, callback) {
- for (var i = 0; i < collection.length; i++) {
- callback(collection[i]);
- }
- }
-
- // Date.now is not available in browsers < IE9
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility
- var now = Date.now || function () {
- return new Date().getTime();
- };
-
- exports.now = now;
-
- function isString(suspect) {
- return typeof suspect === 'string';
- }
-
- function isFunction(suspect) {
- return typeof suspect === 'function';
- }
-
- function isNumber(suspect) {
- return typeof suspect === 'number';
- }
-
- function isCoercableNumber(number) {
- return isNumber(number) || NUMBER.test(number);
- }
-
- function wrapInTryCatch(func) {
- return function () {
- try {
- return func.apply(this, arguments);
- } catch (e) {
- throw e;
- }
- };
- }
-});
-enifed('container', ['exports', 'ember-metal/core', 'container/registry', 'container/container'], function (exports, _emberMetalCore, _containerRegistry, _containerContainer) {
- 'use strict';
-
- /*
- Public api for the container is still in flux.
- The public api, specified on the application namespace should be considered the stable api.
- // @module container
- @private
- */
-
- /*
- Flag to enable/disable model factory injections (disabled by default)
- If model factory injections are enabled, models should not be
- accessed globally (only through `container.lookupFactory('model:modelName'))`);
- */
- _emberMetalCore.default.MODEL_FACTORY_INJECTIONS = false;
-
- if (_emberMetalCore.default.ENV && typeof _emberMetalCore.default.ENV.MODEL_FACTORY_INJECTIONS !== 'undefined') {
- _emberMetalCore.default.MODEL_FACTORY_INJECTIONS = !!_emberMetalCore.default.ENV.MODEL_FACTORY_INJECTIONS;
- }
-
- exports.Registry = _containerRegistry.default;
- exports.Container = _containerContainer.default;
-});
-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.
Every `Container` must be associated with a `Registry`, which is referenced
to determine the factory and options that should be used to instantiate
@@ -1311,22 +1265,22 @@
@param {String} fullName
@param {Object} options
@return {any}
*/
lookup: function (fullName, options) {
- return lookup(this, this.registry.normalize(fullName), options);
+ 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) {
- return factoryFor(this, this.registry.normalize(fullName));
+ return factoryFor(this, this.registry.normalize(fullName));
},
/**
A depth first traversal, destroying the container, its descendant containers and all
their managed objects.
@@ -1562,12 +1516,11 @@
// 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/assign', './container'], function (exports, _emberMetalCore, _emberMetalDictionary, _emberMetalAssign, _container) {
+enifed('container/registry', ['exports', 'ember-metal/debug', 'ember-metal/dictionary', 'ember-metal/assign', 'container/container'], function (exports, _emberMetalDebug, _emberMetalDictionary, _emberMetalAssign, _containerContainer) {
'use strict';
var VALID_FULL_NAME_REGEXP = /^[^:]+.+:[^:]+$/;
/**
@@ -1688,11 +1641,11 @@
@method container
@param {Object} options
@return {Container} created container
*/
container: function (options) {
- return new _container.default(this, options);
+ return new _containerContainer.default(this, options);
},
/**
Registers a factory for later injection.
Example:
@@ -1707,11 +1660,11 @@
@param {String} fullName
@param {Function} factory
@param {Object} options
*/
register: function (fullName, factory, options) {
-
+
if (factory === undefined) {
throw new TypeError('Attempting to register an unknown factory: `' + fullName + '`');
}
var normalizedName = this.normalize(fullName);
@@ -1737,11 +1690,11 @@
@private
@method unregister
@param {String} fullName
*/
unregister: function (fullName) {
-
+
var normalizedName = this.normalize(fullName);
delete this.registrations[normalizedName];
delete this._resolveCache[normalizedName];
delete this._failCache[normalizedName];
@@ -1773,11 +1726,11 @@
@method resolve
@param {String} fullName
@return {Function} fullName's factory
*/
resolve: function (fullName) {
- var factory = resolve(this, this.normalize(fullName));
+ var factory = resolve(this, this.normalize(fullName));
if (factory === undefined && this.fallback) {
factory = this.fallback.resolve(fullName);
}
return factory;
},
@@ -1837,11 +1790,11 @@
@method has
@param {String} fullName
@return {Boolean}
*/
has: function (fullName) {
- return has(this, this.normalize(fullName));
+ return has(this, this.normalize(fullName));
},
/**
Allow registering options for all factories of a type.
```javascript
@@ -1939,11 +1892,11 @@
@param {String} type
@param {String} property
@param {String} fullName
*/
typeInjection: function (type, property, fullName) {
-
+
var fullNameType = fullName.split(':')[0];
if (fullNameType === type) {
throw new Error('Cannot inject a `' + fullName + '` on other ' + type + '(s).');
}
@@ -1994,11 +1947,11 @@
if (fullName.indexOf(':') === -1) {
return this.typeInjection(fullName, property, normalizedInjectionName);
}
- var normalizedName = this.normalize(fullName);
+ var normalizedName = this.normalize(fullName);
var injections = this._injections[normalizedName] || (this._injections[normalizedName] = []);
injections.push({
property: property,
@@ -2148,11 +2101,11 @@
normalizeInjectionsHash: function (hash) {
var injections = [];
for (var key in hash) {
if (hash.hasOwnProperty(key)) {
-
+
injections.push({
property: key,
fullName: hash[key]
});
}
@@ -2218,69 +2171,73 @@
return registry.resolve(fullName) !== undefined;
}
exports.default = Registry;
});
-// Ember.assert
-enifed("dag-map", ["exports"], function (exports) {
- "use strict";
+enifed('container', ['exports', 'ember-metal/core', 'container/registry', 'container/container'], function (exports, _emberMetalCore, _containerRegistry, _containerContainer) {
+ 'use strict';
- function visit(vertex, fn, visited, path) {
- var name = vertex.name;
- var vertices = vertex.incoming;
- var names = vertex.incomingNames;
- var len = names.length;
- var i;
+ /*
+ Public api for the container is still in flux.
+ The public api, specified on the application namespace should be considered the stable api.
+ // @module container
+ @private
+ */
- if (!visited) {
- visited = {};
- }
- if (!path) {
- path = [];
- }
- if (visited.hasOwnProperty(name)) {
- return;
- }
- path.push(name);
- visited[name] = true;
- for (i = 0; i < len; i++) {
- visit(vertices[names[i]], fn, visited, path);
- }
- fn(vertex, path);
- path.pop();
+ /*
+ Flag to enable/disable model factory injections (disabled by default)
+ If model factory injections are enabled, models should not be
+ accessed globally (only through `container.lookupFactory('model:modelName'))`);
+ */
+ _emberMetalCore.default.MODEL_FACTORY_INJECTIONS = false;
+
+ if (_emberMetalCore.default.ENV && typeof _emberMetalCore.default.ENV.MODEL_FACTORY_INJECTIONS !== 'undefined') {
+ _emberMetalCore.default.MODEL_FACTORY_INJECTIONS = !!_emberMetalCore.default.ENV.MODEL_FACTORY_INJECTIONS;
}
+ exports.Registry = _containerRegistry.default;
+ exports.Container = _containerContainer.default;
+});
+enifed('dag-map/platform', ['exports'], function (exports) {
+ 'use strict';
+
+ var platform;
+
+ /* global self */
+ if (typeof self === 'object') {
+ platform = self;
+
+ /* global global */
+ } else if (typeof global === 'object') {
+ platform = global;
+ } else {
+ throw new Error('no global: `self` or `global` found');
+ }
+
+ exports.default = platform;
+});
+enifed('dag-map', ['exports', 'vertex', 'visit'], function (exports, _vertex, _visit) {
+ 'use strict';
+
+ exports.default = DAG;
+
/**
* DAG stands for Directed acyclic graph.
*
* It is used to build a graph of dependencies checking that there isn't circular
* dependencies. p.e Registering initializers with a certain precedence order.
*
* @class DAG
* @constructor
*/
+
function DAG() {
this.names = [];
this.vertices = Object.create(null);
}
/**
- * DAG Vertex
- *
- * @class Vertex
- * @constructor
- */
-
- function Vertex(name) {
- this.name = name;
- this.incoming = {};
- this.incomingNames = [];
- this.hasOutgoing = false;
- this.value = null;
- }
-
- /**
* Adds a vertex entry to the graph unless it is already added.
*
* @private
* @method add
* @param {String} name The name of the vertex to add
@@ -2290,11 +2247,11 @@
throw new Error("Can't add Vertex without name");
}
if (this.vertices[name] !== undefined) {
return this.vertices[name];
}
- var vertex = new Vertex(name);
+ var vertex = new _vertex.default(name);
this.vertices[name] = vertex;
this.names.push(name);
return vertex;
};
@@ -2331,11 +2288,11 @@
function checkCycle(vertex, path) {
if (vertex.name === toName) {
throw new Error("cycle detected: " + toName + " <- " + path.join(" <- "));
}
}
- visit(from, checkCycle);
+ _visit.default(from, checkCycle);
from.hasOutgoing = true;
to.incoming[fromName] = from;
to.incomingNames.push(fromName);
};
@@ -2354,11 +2311,11 @@
var i, vertex;
for (i = 0; i < len; i++) {
vertex = vertices[names[i]];
if (!vertex.hasOutgoing) {
- visit(vertex, fn, visited);
+ _visit.default(vertex, fn, visited);
}
}
};
/**
@@ -2398,28 +2355,485 @@
this.addEdge(after[i], name);
}
}
}
};
-
- exports.default = DAG;
});
-enifed('dag-map.umd', ['exports', './dag-map'], function (exports, _dagMap) {
+enifed('dag-map.umd', ['exports', 'dag-map/platform', 'dag-map'], function (exports, _dagMapPlatform, _dagMap) {
'use strict';
/* global define:true module:true window: true */
- if (typeof enifed === 'function' && enifed.amd) {
- enifed(function () {
+ if (typeof define === 'function' && define.amd) {
+ define(function () {
return _dagMap.default;
});
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = _dagMap.default;
- } else if (typeof undefined !== 'undefined') {
- undefined['DAG'] = _dagMap.default;
+ } else if (typeof _dagMapPlatform.default !== 'undefined') {
+ _dagMapPlatform.default['DAG'] = _dagMap.default;
}
});
-enifed("dom-helper", ["exports", "./htmlbars-runtime/morph", "./morph-attr", "./dom-helper/build-html-dom", "./dom-helper/classes", "./dom-helper/prop"], function (exports, _htmlbarsRuntimeMorph, _morphAttr, _domHelperBuildHtmlDom, _domHelperClasses, _domHelperProp) {
+enifed('dom-helper/build-html-dom', ['exports'], function (exports) {
+ /* global XMLSerializer:false */
+ 'use strict';
+
+ var svgHTMLIntegrationPoints = { foreignObject: 1, desc: 1, title: 1 };
+ exports.svgHTMLIntegrationPoints = svgHTMLIntegrationPoints;
+ var svgNamespace = 'http://www.w3.org/2000/svg';
+
+ exports.svgNamespace = svgNamespace;
+ var doc = typeof document === 'undefined' ? false : document;
+
+ // Safari does not like using innerHTML on SVG HTML integration
+ // points (desc/title/foreignObject).
+ var needsIntegrationPointFix = doc && (function (document) {
+ if (document.createElementNS === undefined) {
+ return;
+ }
+ // In FF title will not accept innerHTML.
+ var testEl = document.createElementNS(svgNamespace, 'title');
+ testEl.innerHTML = "<div></div>";
+ return testEl.childNodes.length === 0 || testEl.childNodes[0].nodeType !== 1;
+ })(doc);
+
+ // Internet Explorer prior to 9 does not allow setting innerHTML if the first element
+ // is a "zero-scope" element. This problem can be worked around by making
+ // the first node an invisible text node. We, like Modernizr, use ­
+ var needsShy = doc && (function (document) {
+ var testEl = document.createElement('div');
+ testEl.innerHTML = "<div></div>";
+ testEl.firstChild.innerHTML = "<script><\/script>";
+ return testEl.firstChild.innerHTML === '';
+ })(doc);
+
+ // IE 8 (and likely earlier) likes to move whitespace preceeding
+ // a script tag to appear after it. This means that we can
+ // accidentally remove whitespace when updating a morph.
+ var movesWhitespace = doc && (function (document) {
+ var testEl = document.createElement('div');
+ testEl.innerHTML = "Test: <script type='text/x-placeholder'><\/script>Value";
+ return testEl.childNodes[0].nodeValue === 'Test:' && testEl.childNodes[2].nodeValue === ' Value';
+ })(doc);
+
+ var tagNamesRequiringInnerHTMLFix = doc && (function (document) {
+ var tagNamesRequiringInnerHTMLFix;
+ // IE 9 and earlier don't allow us to set innerHTML on col, colgroup, frameset,
+ // html, style, table, tbody, tfoot, thead, title, tr. Detect this and add
+ // them to an initial list of corrected tags.
+ //
+ // Here we are only dealing with the ones which can have child nodes.
+ //
+ var tableNeedsInnerHTMLFix;
+ var tableInnerHTMLTestElement = document.createElement('table');
+ try {
+ tableInnerHTMLTestElement.innerHTML = '<tbody></tbody>';
+ } catch (e) {} finally {
+ tableNeedsInnerHTMLFix = tableInnerHTMLTestElement.childNodes.length === 0;
+ }
+ if (tableNeedsInnerHTMLFix) {
+ tagNamesRequiringInnerHTMLFix = {
+ colgroup: ['table'],
+ table: [],
+ tbody: ['table'],
+ tfoot: ['table'],
+ thead: ['table'],
+ tr: ['table', 'tbody']
+ };
+ }
+
+ // IE 8 doesn't allow setting innerHTML on a select tag. Detect this and
+ // add it to the list of corrected tags.
+ //
+ var selectInnerHTMLTestElement = document.createElement('select');
+ selectInnerHTMLTestElement.innerHTML = '<option></option>';
+ if (!selectInnerHTMLTestElement.childNodes[0]) {
+ tagNamesRequiringInnerHTMLFix = tagNamesRequiringInnerHTMLFix || {};
+ tagNamesRequiringInnerHTMLFix.select = [];
+ }
+ return tagNamesRequiringInnerHTMLFix;
+ })(doc);
+
+ function scriptSafeInnerHTML(element, html) {
+ // without a leading text node, IE will drop a leading script tag.
+ html = '­' + html;
+
+ element.innerHTML = html;
+
+ var nodes = element.childNodes;
+
+ // Look for ­ to remove it.
+ var shyElement = nodes[0];
+ while (shyElement.nodeType === 1 && !shyElement.nodeName) {
+ shyElement = shyElement.firstChild;
+ }
+ // At this point it's the actual unicode character.
+ if (shyElement.nodeType === 3 && shyElement.nodeValue.charAt(0) === "\u00AD") {
+ var newValue = shyElement.nodeValue.slice(1);
+ if (newValue.length) {
+ shyElement.nodeValue = shyElement.nodeValue.slice(1);
+ } else {
+ shyElement.parentNode.removeChild(shyElement);
+ }
+ }
+
+ return nodes;
+ }
+
+ function buildDOMWithFix(html, contextualElement) {
+ var tagName = contextualElement.tagName;
+
+ // Firefox versions < 11 do not have support for element.outerHTML.
+ var outerHTML = contextualElement.outerHTML || new XMLSerializer().serializeToString(contextualElement);
+ if (!outerHTML) {
+ throw "Can't set innerHTML on " + tagName + " in this browser";
+ }
+
+ html = fixSelect(html, contextualElement);
+
+ var wrappingTags = tagNamesRequiringInnerHTMLFix[tagName.toLowerCase()];
+
+ var startTag = outerHTML.match(new RegExp("<" + tagName + "([^>]*)>", 'i'))[0];
+ var endTag = '</' + tagName + '>';
+
+ var wrappedHTML = [startTag, html, endTag];
+
+ var i = wrappingTags.length;
+ var wrappedDepth = 1 + i;
+ while (i--) {
+ wrappedHTML.unshift('<' + wrappingTags[i] + '>');
+ wrappedHTML.push('</' + wrappingTags[i] + '>');
+ }
+
+ var wrapper = document.createElement('div');
+ scriptSafeInnerHTML(wrapper, wrappedHTML.join(''));
+ var element = wrapper;
+ while (wrappedDepth--) {
+ element = element.firstChild;
+ while (element && element.nodeType !== 1) {
+ element = element.nextSibling;
+ }
+ }
+ while (element && element.tagName !== tagName) {
+ element = element.nextSibling;
+ }
+ return element ? element.childNodes : [];
+ }
+
+ var buildDOM;
+ if (needsShy) {
+ buildDOM = function buildDOM(html, contextualElement, dom) {
+ html = fixSelect(html, contextualElement);
+
+ contextualElement = dom.cloneNode(contextualElement, false);
+ scriptSafeInnerHTML(contextualElement, html);
+ return contextualElement.childNodes;
+ };
+ } else {
+ buildDOM = function buildDOM(html, contextualElement, dom) {
+ html = fixSelect(html, contextualElement);
+
+ contextualElement = dom.cloneNode(contextualElement, false);
+ contextualElement.innerHTML = html;
+ return contextualElement.childNodes;
+ };
+ }
+
+ function fixSelect(html, contextualElement) {
+ if (contextualElement.tagName === 'SELECT') {
+ html = "<option></option>" + html;
+ }
+
+ return html;
+ }
+
+ var buildIESafeDOM;
+ if (tagNamesRequiringInnerHTMLFix || movesWhitespace) {
+ buildIESafeDOM = function buildIESafeDOM(html, contextualElement, dom) {
+ // Make a list of the leading text on script nodes. Include
+ // script tags without any whitespace for easier processing later.
+ var spacesBefore = [];
+ var spacesAfter = [];
+ if (typeof html === 'string') {
+ html = html.replace(/(\s*)(<script)/g, function (match, spaces, tag) {
+ spacesBefore.push(spaces);
+ return tag;
+ });
+
+ html = html.replace(/(<\/script>)(\s*)/g, function (match, tag, spaces) {
+ spacesAfter.push(spaces);
+ return tag;
+ });
+ }
+
+ // Fetch nodes
+ var nodes;
+ if (tagNamesRequiringInnerHTMLFix[contextualElement.tagName.toLowerCase()]) {
+ // buildDOMWithFix uses string wrappers for problematic innerHTML.
+ nodes = buildDOMWithFix(html, contextualElement);
+ } else {
+ nodes = buildDOM(html, contextualElement, dom);
+ }
+
+ // Build a list of script tags, the nodes themselves will be
+ // mutated as we add test nodes.
+ var i, j, node, nodeScriptNodes;
+ var scriptNodes = [];
+ for (i = 0; i < nodes.length; i++) {
+ node = nodes[i];
+ if (node.nodeType !== 1) {
+ continue;
+ }
+ if (node.tagName === 'SCRIPT') {
+ scriptNodes.push(node);
+ } else {
+ nodeScriptNodes = node.getElementsByTagName('script');
+ for (j = 0; j < nodeScriptNodes.length; j++) {
+ scriptNodes.push(nodeScriptNodes[j]);
+ }
+ }
+ }
+
+ // Walk the script tags and put back their leading text nodes.
+ var scriptNode, textNode, spaceBefore, spaceAfter;
+ for (i = 0; i < scriptNodes.length; i++) {
+ scriptNode = scriptNodes[i];
+ spaceBefore = spacesBefore[i];
+ if (spaceBefore && spaceBefore.length > 0) {
+ textNode = dom.document.createTextNode(spaceBefore);
+ scriptNode.parentNode.insertBefore(textNode, scriptNode);
+ }
+
+ spaceAfter = spacesAfter[i];
+ if (spaceAfter && spaceAfter.length > 0) {
+ textNode = dom.document.createTextNode(spaceAfter);
+ scriptNode.parentNode.insertBefore(textNode, scriptNode.nextSibling);
+ }
+ }
+
+ return nodes;
+ };
+ } else {
+ buildIESafeDOM = buildDOM;
+ }
+
+ var buildHTMLDOM;
+ if (needsIntegrationPointFix) {
+ exports.buildHTMLDOM = buildHTMLDOM = function buildHTMLDOM(html, contextualElement, dom) {
+ if (svgHTMLIntegrationPoints[contextualElement.tagName]) {
+ return buildIESafeDOM(html, document.createElement('div'), dom);
+ } else {
+ return buildIESafeDOM(html, contextualElement, dom);
+ }
+ };
+ } else {
+ exports.buildHTMLDOM = buildHTMLDOM = buildIESafeDOM;
+ }
+
+ exports.buildHTMLDOM = buildHTMLDOM;
+});
+enifed('dom-helper/classes', ['exports'], function (exports) {
+ 'use strict';
+
+ var doc = typeof document === 'undefined' ? false : document;
+
+ // PhantomJS has a broken classList. See https://github.com/ariya/phantomjs/issues/12782
+ var canClassList = doc && (function () {
+ var d = document.createElement('div');
+ if (!d.classList) {
+ return false;
+ }
+ d.classList.add('boo');
+ d.classList.add('boo', 'baz');
+ return d.className === 'boo baz';
+ })();
+
+ function buildClassList(element) {
+ var classString = element.getAttribute('class') || '';
+ return classString !== '' && classString !== ' ' ? classString.split(' ') : [];
+ }
+
+ function intersect(containingArray, valuesArray) {
+ var containingIndex = 0;
+ var containingLength = containingArray.length;
+ var valuesIndex = 0;
+ var valuesLength = valuesArray.length;
+
+ var intersection = new Array(valuesLength);
+
+ // TODO: rewrite this loop in an optimal manner
+ for (; containingIndex < containingLength; containingIndex++) {
+ valuesIndex = 0;
+ for (; valuesIndex < valuesLength; valuesIndex++) {
+ if (valuesArray[valuesIndex] === containingArray[containingIndex]) {
+ intersection[valuesIndex] = containingIndex;
+ break;
+ }
+ }
+ }
+
+ return intersection;
+ }
+
+ function addClassesViaAttribute(element, classNames) {
+ var existingClasses = buildClassList(element);
+
+ var indexes = intersect(existingClasses, classNames);
+ var didChange = false;
+
+ for (var i = 0, l = classNames.length; i < l; i++) {
+ if (indexes[i] === undefined) {
+ didChange = true;
+ existingClasses.push(classNames[i]);
+ }
+ }
+
+ if (didChange) {
+ element.setAttribute('class', existingClasses.length > 0 ? existingClasses.join(' ') : '');
+ }
+ }
+
+ function removeClassesViaAttribute(element, classNames) {
+ var existingClasses = buildClassList(element);
+
+ var indexes = intersect(classNames, existingClasses);
+ var didChange = false;
+ var newClasses = [];
+
+ for (var i = 0, l = existingClasses.length; i < l; i++) {
+ if (indexes[i] === undefined) {
+ newClasses.push(existingClasses[i]);
+ } else {
+ didChange = true;
+ }
+ }
+
+ if (didChange) {
+ element.setAttribute('class', newClasses.length > 0 ? newClasses.join(' ') : '');
+ }
+ }
+
+ var addClasses, removeClasses;
+ if (canClassList) {
+ exports.addClasses = addClasses = function addClasses(element, classNames) {
+ if (element.classList) {
+ if (classNames.length === 1) {
+ element.classList.add(classNames[0]);
+ } else if (classNames.length === 2) {
+ element.classList.add(classNames[0], classNames[1]);
+ } else {
+ element.classList.add.apply(element.classList, classNames);
+ }
+ } else {
+ addClassesViaAttribute(element, classNames);
+ }
+ };
+ exports.removeClasses = removeClasses = function removeClasses(element, classNames) {
+ if (element.classList) {
+ if (classNames.length === 1) {
+ element.classList.remove(classNames[0]);
+ } else if (classNames.length === 2) {
+ element.classList.remove(classNames[0], classNames[1]);
+ } else {
+ element.classList.remove.apply(element.classList, classNames);
+ }
+ } else {
+ removeClassesViaAttribute(element, classNames);
+ }
+ };
+ } else {
+ exports.addClasses = addClasses = addClassesViaAttribute;
+ exports.removeClasses = removeClasses = removeClassesViaAttribute;
+ }
+
+ exports.addClasses = addClasses;
+ exports.removeClasses = removeClasses;
+});
+enifed('dom-helper/prop', ['exports'], function (exports) {
+ 'use strict';
+
+ exports.isAttrRemovalValue = isAttrRemovalValue;
+ exports.normalizeProperty = normalizeProperty;
+
+ function isAttrRemovalValue(value) {
+ return value === null || value === undefined;
+ }
+
+ /*
+ *
+ * @method normalizeProperty
+ * @param element {HTMLElement}
+ * @param slotName {String}
+ * @returns {Object} { name, type }
+ */
+
+ function normalizeProperty(element, slotName) {
+ var type, normalized;
+
+ if (slotName in element) {
+ normalized = slotName;
+ type = 'prop';
+ } else {
+ var lower = slotName.toLowerCase();
+ if (lower in element) {
+ type = 'prop';
+ normalized = lower;
+ } else {
+ type = 'attr';
+ normalized = slotName;
+ }
+ }
+
+ if (type === 'prop' && (normalized.toLowerCase() === 'style' || preferAttr(element.tagName, normalized))) {
+ type = 'attr';
+ }
+
+ return { normalized: normalized, type: type };
+ }
+
+ // properties that MUST be set as attributes, due to:
+ // * browser bug
+ // * strange spec outlier
+ var ATTR_OVERRIDES = {
+
+ // phantomjs < 2.0 lets you set it as a prop but won't reflect it
+ // back to the attribute. button.getAttribute('type') === null
+ BUTTON: { type: true, form: true },
+
+ INPUT: {
+ // TODO: remove when IE8 is droped
+ // Some versions of IE (IE8) throw an exception when setting
+ // `input.list = 'somestring'`:
+ // https://github.com/emberjs/ember.js/issues/10908
+ // https://github.com/emberjs/ember.js/issues/11364
+ list: true,
+ // Some version of IE (like IE9) actually throw an exception
+ // if you set input.type = 'something-unknown'
+ type: true,
+ form: true,
+ // Chrome 46.0.2464.0: 'autocorrect' in document.createElement('input') === false
+ // Safari 8.0.7: 'autocorrect' in document.createElement('input') === false
+ // Mobile Safari (iOS 8.4 simulator): 'autocorrect' in document.createElement('input') === true
+ autocorrect: true
+ },
+
+ // element.form is actually a legitimate readOnly property, that is to be
+ // mutated, but must be mutated by setAttribute...
+ SELECT: { form: true },
+ OPTION: { form: true },
+ TEXTAREA: { form: true },
+ LABEL: { form: true },
+ FIELDSET: { form: true },
+ LEGEND: { form: true },
+ OBJECT: { form: true }
+ };
+
+ function preferAttr(tagName, propName) {
+ var tag = ATTR_OVERRIDES[tagName.toUpperCase()];
+ return tag && tag[propName.toLowerCase()] || false;
+ }
+});
+enifed("dom-helper", ["exports", "htmlbars-runtime/morph", "morph-attr", "dom-helper/build-html-dom", "dom-helper/classes", "dom-helper/prop"], function (exports, _htmlbarsRuntimeMorph, _morphAttr, _domHelperBuildHtmlDom, _domHelperClasses, _domHelperProp) {
"use strict";
var doc = typeof document === 'undefined' ? false : document;
var deletesBlankTextNodes = doc && (function (document) {
@@ -2512,14 +2926,28 @@
this.element = element;
this.dom = dom;
this.namespace = namespace;
this.guid = "element" + guid++;
- this.state = {};
+ this._state = undefined;
this.isDirty = true;
}
+ ElementMorph.prototype.getState = function () {
+ if (!this._state) {
+ this._state = {};
+ }
+
+ return this._state;
+ };
+
+ ElementMorph.prototype.setState = function (newState) {
+ /*jshint -W093 */
+
+ return this._state = newState;
+ };
+
// renderAndCleanup calls `clear` on all items in the morph map
// just before calling `destroy` on the morph.
//
// As a future refactor this could be changed to set the property
// back to its original/default value.
@@ -2813,11 +3241,11 @@
};
prototype.AttrMorphClass = _morphAttr.default;
prototype.createAttrMorph = function (element, attrName, namespace) {
- return new this.AttrMorphClass(element, attrName, this, namespace);
+ return this.AttrMorphClass.create(element, attrName, this, namespace);
};
prototype.ElementMorphClass = ElementMorph;
prototype.createElementMorph = function (element, namespace) {
@@ -2965,487 +3393,20 @@
return parsingNode.protocol;
};
exports.default = DOMHelper;
});
-enifed('dom-helper/build-html-dom', ['exports'], function (exports) {
- /* global XMLSerializer:false */
- 'use strict';
-
- var svgHTMLIntegrationPoints = { foreignObject: 1, desc: 1, title: 1 };
- exports.svgHTMLIntegrationPoints = svgHTMLIntegrationPoints;
- var svgNamespace = 'http://www.w3.org/2000/svg';
-
- exports.svgNamespace = svgNamespace;
- var doc = typeof document === 'undefined' ? false : document;
-
- // Safari does not like using innerHTML on SVG HTML integration
- // points (desc/title/foreignObject).
- var needsIntegrationPointFix = doc && (function (document) {
- if (document.createElementNS === undefined) {
- return;
- }
- // In FF title will not accept innerHTML.
- var testEl = document.createElementNS(svgNamespace, 'title');
- testEl.innerHTML = "<div></div>";
- return testEl.childNodes.length === 0 || testEl.childNodes[0].nodeType !== 1;
- })(doc);
-
- // Internet Explorer prior to 9 does not allow setting innerHTML if the first element
- // is a "zero-scope" element. This problem can be worked around by making
- // the first node an invisible text node. We, like Modernizr, use ­
- var needsShy = doc && (function (document) {
- var testEl = document.createElement('div');
- testEl.innerHTML = "<div></div>";
- testEl.firstChild.innerHTML = "<script><\/script>";
- return testEl.firstChild.innerHTML === '';
- })(doc);
-
- // IE 8 (and likely earlier) likes to move whitespace preceeding
- // a script tag to appear after it. This means that we can
- // accidentally remove whitespace when updating a morph.
- var movesWhitespace = doc && (function (document) {
- var testEl = document.createElement('div');
- testEl.innerHTML = "Test: <script type='text/x-placeholder'><\/script>Value";
- return testEl.childNodes[0].nodeValue === 'Test:' && testEl.childNodes[2].nodeValue === ' Value';
- })(doc);
-
- var tagNamesRequiringInnerHTMLFix = doc && (function (document) {
- var tagNamesRequiringInnerHTMLFix;
- // IE 9 and earlier don't allow us to set innerHTML on col, colgroup, frameset,
- // html, style, table, tbody, tfoot, thead, title, tr. Detect this and add
- // them to an initial list of corrected tags.
- //
- // Here we are only dealing with the ones which can have child nodes.
- //
- var tableNeedsInnerHTMLFix;
- var tableInnerHTMLTestElement = document.createElement('table');
- try {
- tableInnerHTMLTestElement.innerHTML = '<tbody></tbody>';
- } catch (e) {} finally {
- tableNeedsInnerHTMLFix = tableInnerHTMLTestElement.childNodes.length === 0;
- }
- if (tableNeedsInnerHTMLFix) {
- tagNamesRequiringInnerHTMLFix = {
- colgroup: ['table'],
- table: [],
- tbody: ['table'],
- tfoot: ['table'],
- thead: ['table'],
- tr: ['table', 'tbody']
- };
- }
-
- // IE 8 doesn't allow setting innerHTML on a select tag. Detect this and
- // add it to the list of corrected tags.
- //
- var selectInnerHTMLTestElement = document.createElement('select');
- selectInnerHTMLTestElement.innerHTML = '<option></option>';
- if (!selectInnerHTMLTestElement.childNodes[0]) {
- tagNamesRequiringInnerHTMLFix = tagNamesRequiringInnerHTMLFix || {};
- tagNamesRequiringInnerHTMLFix.select = [];
- }
- return tagNamesRequiringInnerHTMLFix;
- })(doc);
-
- function scriptSafeInnerHTML(element, html) {
- // without a leading text node, IE will drop a leading script tag.
- html = '­' + html;
-
- element.innerHTML = html;
-
- var nodes = element.childNodes;
-
- // Look for ­ to remove it.
- var shyElement = nodes[0];
- while (shyElement.nodeType === 1 && !shyElement.nodeName) {
- shyElement = shyElement.firstChild;
- }
- // At this point it's the actual unicode character.
- if (shyElement.nodeType === 3 && shyElement.nodeValue.charAt(0) === "\u00AD") {
- var newValue = shyElement.nodeValue.slice(1);
- if (newValue.length) {
- shyElement.nodeValue = shyElement.nodeValue.slice(1);
- } else {
- shyElement.parentNode.removeChild(shyElement);
- }
- }
-
- return nodes;
- }
-
- function buildDOMWithFix(html, contextualElement) {
- var tagName = contextualElement.tagName;
-
- // Firefox versions < 11 do not have support for element.outerHTML.
- var outerHTML = contextualElement.outerHTML || new XMLSerializer().serializeToString(contextualElement);
- if (!outerHTML) {
- throw "Can't set innerHTML on " + tagName + " in this browser";
- }
-
- html = fixSelect(html, contextualElement);
-
- var wrappingTags = tagNamesRequiringInnerHTMLFix[tagName.toLowerCase()];
-
- var startTag = outerHTML.match(new RegExp("<" + tagName + "([^>]*)>", 'i'))[0];
- var endTag = '</' + tagName + '>';
-
- var wrappedHTML = [startTag, html, endTag];
-
- var i = wrappingTags.length;
- var wrappedDepth = 1 + i;
- while (i--) {
- wrappedHTML.unshift('<' + wrappingTags[i] + '>');
- wrappedHTML.push('</' + wrappingTags[i] + '>');
- }
-
- var wrapper = document.createElement('div');
- scriptSafeInnerHTML(wrapper, wrappedHTML.join(''));
- var element = wrapper;
- while (wrappedDepth--) {
- element = element.firstChild;
- while (element && element.nodeType !== 1) {
- element = element.nextSibling;
- }
- }
- while (element && element.tagName !== tagName) {
- element = element.nextSibling;
- }
- return element ? element.childNodes : [];
- }
-
- var buildDOM;
- if (needsShy) {
- buildDOM = function buildDOM(html, contextualElement, dom) {
- html = fixSelect(html, contextualElement);
-
- contextualElement = dom.cloneNode(contextualElement, false);
- scriptSafeInnerHTML(contextualElement, html);
- return contextualElement.childNodes;
- };
- } else {
- buildDOM = function buildDOM(html, contextualElement, dom) {
- html = fixSelect(html, contextualElement);
-
- contextualElement = dom.cloneNode(contextualElement, false);
- contextualElement.innerHTML = html;
- return contextualElement.childNodes;
- };
- }
-
- function fixSelect(html, contextualElement) {
- if (contextualElement.tagName === 'SELECT') {
- html = "<option></option>" + html;
- }
-
- return html;
- }
-
- var buildIESafeDOM;
- if (tagNamesRequiringInnerHTMLFix || movesWhitespace) {
- buildIESafeDOM = function buildIESafeDOM(html, contextualElement, dom) {
- // Make a list of the leading text on script nodes. Include
- // script tags without any whitespace for easier processing later.
- var spacesBefore = [];
- var spacesAfter = [];
- if (typeof html === 'string') {
- html = html.replace(/(\s*)(<script)/g, function (match, spaces, tag) {
- spacesBefore.push(spaces);
- return tag;
- });
-
- html = html.replace(/(<\/script>)(\s*)/g, function (match, tag, spaces) {
- spacesAfter.push(spaces);
- return tag;
- });
- }
-
- // Fetch nodes
- var nodes;
- if (tagNamesRequiringInnerHTMLFix[contextualElement.tagName.toLowerCase()]) {
- // buildDOMWithFix uses string wrappers for problematic innerHTML.
- nodes = buildDOMWithFix(html, contextualElement);
- } else {
- nodes = buildDOM(html, contextualElement, dom);
- }
-
- // Build a list of script tags, the nodes themselves will be
- // mutated as we add test nodes.
- var i, j, node, nodeScriptNodes;
- var scriptNodes = [];
- for (i = 0; i < nodes.length; i++) {
- node = nodes[i];
- if (node.nodeType !== 1) {
- continue;
- }
- if (node.tagName === 'SCRIPT') {
- scriptNodes.push(node);
- } else {
- nodeScriptNodes = node.getElementsByTagName('script');
- for (j = 0; j < nodeScriptNodes.length; j++) {
- scriptNodes.push(nodeScriptNodes[j]);
- }
- }
- }
-
- // Walk the script tags and put back their leading text nodes.
- var scriptNode, textNode, spaceBefore, spaceAfter;
- for (i = 0; i < scriptNodes.length; i++) {
- scriptNode = scriptNodes[i];
- spaceBefore = spacesBefore[i];
- if (spaceBefore && spaceBefore.length > 0) {
- textNode = dom.document.createTextNode(spaceBefore);
- scriptNode.parentNode.insertBefore(textNode, scriptNode);
- }
-
- spaceAfter = spacesAfter[i];
- if (spaceAfter && spaceAfter.length > 0) {
- textNode = dom.document.createTextNode(spaceAfter);
- scriptNode.parentNode.insertBefore(textNode, scriptNode.nextSibling);
- }
- }
-
- return nodes;
- };
- } else {
- buildIESafeDOM = buildDOM;
- }
-
- var buildHTMLDOM;
- if (needsIntegrationPointFix) {
- exports.buildHTMLDOM = buildHTMLDOM = function buildHTMLDOM(html, contextualElement, dom) {
- if (svgHTMLIntegrationPoints[contextualElement.tagName]) {
- return buildIESafeDOM(html, document.createElement('div'), dom);
- } else {
- return buildIESafeDOM(html, contextualElement, dom);
- }
- };
- } else {
- exports.buildHTMLDOM = buildHTMLDOM = buildIESafeDOM;
- }
-
- exports.buildHTMLDOM = buildHTMLDOM;
-});
-enifed('dom-helper/classes', ['exports'], function (exports) {
- 'use strict';
-
- var doc = typeof document === 'undefined' ? false : document;
-
- // PhantomJS has a broken classList. See https://github.com/ariya/phantomjs/issues/12782
- var canClassList = doc && (function () {
- var d = document.createElement('div');
- if (!d.classList) {
- return false;
- }
- d.classList.add('boo');
- d.classList.add('boo', 'baz');
- return d.className === 'boo baz';
- })();
-
- function buildClassList(element) {
- var classString = element.getAttribute('class') || '';
- return classString !== '' && classString !== ' ' ? classString.split(' ') : [];
- }
-
- function intersect(containingArray, valuesArray) {
- var containingIndex = 0;
- var containingLength = containingArray.length;
- var valuesIndex = 0;
- var valuesLength = valuesArray.length;
-
- var intersection = new Array(valuesLength);
-
- // TODO: rewrite this loop in an optimal manner
- for (; containingIndex < containingLength; containingIndex++) {
- valuesIndex = 0;
- for (; valuesIndex < valuesLength; valuesIndex++) {
- if (valuesArray[valuesIndex] === containingArray[containingIndex]) {
- intersection[valuesIndex] = containingIndex;
- break;
- }
- }
- }
-
- return intersection;
- }
-
- function addClassesViaAttribute(element, classNames) {
- var existingClasses = buildClassList(element);
-
- var indexes = intersect(existingClasses, classNames);
- var didChange = false;
-
- for (var i = 0, l = classNames.length; i < l; i++) {
- if (indexes[i] === undefined) {
- didChange = true;
- existingClasses.push(classNames[i]);
- }
- }
-
- if (didChange) {
- element.setAttribute('class', existingClasses.length > 0 ? existingClasses.join(' ') : '');
- }
- }
-
- function removeClassesViaAttribute(element, classNames) {
- var existingClasses = buildClassList(element);
-
- var indexes = intersect(classNames, existingClasses);
- var didChange = false;
- var newClasses = [];
-
- for (var i = 0, l = existingClasses.length; i < l; i++) {
- if (indexes[i] === undefined) {
- newClasses.push(existingClasses[i]);
- } else {
- didChange = true;
- }
- }
-
- if (didChange) {
- element.setAttribute('class', newClasses.length > 0 ? newClasses.join(' ') : '');
- }
- }
-
- var addClasses, removeClasses;
- if (canClassList) {
- exports.addClasses = addClasses = function addClasses(element, classNames) {
- if (element.classList) {
- if (classNames.length === 1) {
- element.classList.add(classNames[0]);
- } else if (classNames.length === 2) {
- element.classList.add(classNames[0], classNames[1]);
- } else {
- element.classList.add.apply(element.classList, classNames);
- }
- } else {
- addClassesViaAttribute(element, classNames);
- }
- };
- exports.removeClasses = removeClasses = function removeClasses(element, classNames) {
- if (element.classList) {
- if (classNames.length === 1) {
- element.classList.remove(classNames[0]);
- } else if (classNames.length === 2) {
- element.classList.remove(classNames[0], classNames[1]);
- } else {
- element.classList.remove.apply(element.classList, classNames);
- }
- } else {
- removeClassesViaAttribute(element, classNames);
- }
- };
- } else {
- exports.addClasses = addClasses = addClassesViaAttribute;
- exports.removeClasses = removeClasses = removeClassesViaAttribute;
- }
-
- exports.addClasses = addClasses;
- exports.removeClasses = removeClasses;
-});
-enifed('dom-helper/prop', ['exports'], function (exports) {
- 'use strict';
-
- exports.isAttrRemovalValue = isAttrRemovalValue;
- exports.normalizeProperty = normalizeProperty;
-
- function isAttrRemovalValue(value) {
- return value === null || value === undefined;
- }
-
- /*
- *
- * @method normalizeProperty
- * @param element {HTMLElement}
- * @param slotName {String}
- * @returns {Object} { name, type }
- */
-
- function normalizeProperty(element, slotName) {
- var type, normalized;
-
- if (slotName in element) {
- normalized = slotName;
- type = 'prop';
- } else {
- var lower = slotName.toLowerCase();
- if (lower in element) {
- type = 'prop';
- normalized = lower;
- } else {
- type = 'attr';
- normalized = slotName;
- }
- }
-
- if (type === 'prop' && (normalized.toLowerCase() === 'style' || preferAttr(element.tagName, normalized))) {
- type = 'attr';
- }
-
- return { normalized: normalized, type: type };
- }
-
- // properties that MUST be set as attributes, due to:
- // * browser bug
- // * strange spec outlier
- var ATTR_OVERRIDES = {
-
- // phantomjs < 2.0 lets you set it as a prop but won't reflect it
- // back to the attribute. button.getAttribute('type') === null
- BUTTON: { type: true, form: true },
-
- INPUT: {
- // TODO: remove when IE8 is droped
- // Some versions of IE (IE8) throw an exception when setting
- // `input.list = 'somestring'`:
- // https://github.com/emberjs/ember.js/issues/10908
- // https://github.com/emberjs/ember.js/issues/11364
- list: true,
- // Some version of IE (like IE9) actually throw an exception
- // if you set input.type = 'something-unknown'
- type: true,
- form: true
- },
-
- // element.form is actually a legitimate readOnly property, that is to be
- // mutated, but must be mutated by setAttribute...
- SELECT: { form: true },
- OPTION: { form: true },
- TEXTAREA: { form: true },
- LABEL: { form: true },
- FIELDSET: { form: true },
- LEGEND: { form: true },
- OBJECT: { form: true }
- };
-
- function preferAttr(tagName, propName) {
- var tag = ATTR_OVERRIDES[tagName.toUpperCase()];
- return tag && tag[propName.toLowerCase()] || false;
- }
-});
-enifed('ember-application', ['exports', 'ember-metal/core', 'ember-runtime/system/lazy_load', 'ember-application/system/resolver', 'ember-application/system/application'], function (exports, _emberMetalCore, _emberRuntimeSystemLazy_load, _emberApplicationSystemResolver, _emberApplicationSystemApplication) {
- 'use strict';
-
- _emberMetalCore.default.Application = _emberApplicationSystemApplication.default;
- _emberMetalCore.default.Resolver = _emberApplicationSystemResolver.Resolver;
- _emberMetalCore.default.DefaultResolver = _emberApplicationSystemResolver.default;
-
- _emberRuntimeSystemLazy_load.runLoadHooks('Ember.Application', _emberApplicationSystemApplication.default);
-});
-
-/**
-@module ember
-@submodule ember-application
-*/
-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) {
+enifed('ember-application/system/application-instance', ['exports', 'ember-metal/debug', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-runtime/system/object', 'ember-metal/run_loop', 'ember-metal/computed', 'ember-runtime/mixins/container_proxy', 'ember-htmlbars/system/dom-helper', 'container/registry', 'ember-runtime/mixins/registry_proxy', 'ember-metal-views/renderer', 'ember-metal/assign', 'ember-metal/environment', 'ember-runtime/ext/rsvp', 'ember-views/system/jquery'], function (exports, _emberMetalDebug, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_set, _emberRuntimeSystemObject, _emberMetalRun_loop, _emberMetalComputed, _emberRuntimeMixinsContainer_proxy, _emberHtmlbarsSystemDomHelper, _containerRegistry, _emberRuntimeMixinsRegistry_proxy, _emberMetalViewsRenderer, _emberMetalAssign, _emberMetalEnvironment, _emberRuntimeExtRsvp, _emberViewsSystemJquery) {
/**
@module ember
@submodule ember-application
*/
'use strict';
+ var BootOptions = undefined;
+
/**
The `ApplicationInstance` encapsulates all of the stateful aspects of a
running `Application`.
At a high-level, we break application boot into two distinct phases:
@@ -3524,33 +3485,71 @@
// Because we need a good way for the root route (a.k.a ApplicationRoute)
// to notify us when it has created the root-most view. That view is then
// appended to the rootElement, in the case of apps, to the fixture harness
// in tests, or rendered to a string in the case of FastBoot.
this.register('-application-instance:main', this, { instantiate: false });
+
+ this._booted = false;
},
- router: _emberMetalComputed.computed(function () {
- return this.lookup('router:main');
- }).readOnly(),
+ /**
+ Initialize the `Ember.ApplicationInstance` and return a promise that resolves
+ with the instance itself when the boot process is complete.
+ The primary task here is to run any registered instance initializers.
+ See the documentation on `BootOptions` for the options it takes.
+ @private
+ @method boot
+ @param options
+ @return {Promise<Ember.ApplicationInstance,Error>}
+ */
+ boot: function () {
+ var _this = this;
+ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
+
+ if (this._bootPromise) {
+ return this._bootPromise;
+ }
+
+ this._bootPromise = new _emberRuntimeExtRsvp.default.Promise(function (resolve) {
+ return resolve(_this._bootSync(options));
+ });
+
+ return this._bootPromise;
+ },
+
/**
- Instantiates and sets up the router, specifically overriding the default
- location. This is useful for manually starting the app in FastBoot or
- testing environments, where trying to modify the URL would be
- inappropriate.
- @param options
- @private
+ Unfortunately, a lot of existing code assumes booting an instance is
+ synchronous – specifically, a lot of tests assumes the last call to
+ `app.advanceReadiness()` or `app.reset()` will result in a new instance
+ being fully-booted when the current runloop completes.
+ We would like new code (like the `visit` API) to stop making this assumption,
+ so we created the asynchronous version above that returns a promise. But until
+ we have migrated all the code, we would have to expose this method for use
+ *internally* in places where we need to boot an instance synchronously.
+ @private
*/
- overrideRouterLocation: function (options) {
- var location = options && options.location;
- var router = _emberMetalProperty_get.get(this, 'router');
+ _bootSync: function (options) {
+ if (this._booted) {
+ return this;
+ }
- if (location) {
- _emberMetalProperty_set.set(router, 'location', location);
+ this.application.runInstanceInitializers(this);
+
+ if (_emberMetalEnvironment.default.hasDOM) {
+ this.setupEventDispatcher();
}
+
+ this._booted = true;
+
+ return this;
},
+ router: _emberMetalComputed.computed(function () {
+ return this.lookup('router:main');
+ }).readOnly(),
+
/**
This hook is called by the root-most Route (a.k.a. the ApplicationRoute)
when it has finished creating the root View. By default, we simply take the
view and append it to the `rootElement` specified on the Application.
In cases like FastBoot and testing, we can override this hook and implement
@@ -3592,12 +3591,11 @@
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
- have called `setupRouter()` before calling this method.
+ for example, to tell the app to start at a particular URL.
@param url {String} the URL the router should route to
@private
*/
handleURL: function (url) {
var router = _emberMetalProperty_get.get(this, 'router');
@@ -3638,11 +3636,10 @@
enumerable: false,
get: function () {
var instance = this;
return {
lookup: function () {
-
return instance.lookup.apply(instance, arguments);
}
};
}
});
@@ -3654,12 +3651,159 @@
return _emberRuntimeMixinsRegistry_proxy.buildFakeRegistryWithDeprecations(this, 'ApplicationInstance');
}
});
exports.default = ApplicationInstance;
});
-// Ember.deprecate
-enifed('ember-application/system/application', ['exports', 'dag-map', 'container/registry', 'ember-metal', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/empty_object', 'ember-runtime/system/lazy_load', 'ember-runtime/system/namespace', 'ember-application/system/resolver', 'ember-metal/run_loop', 'ember-metal/utils', 'ember-runtime/controllers/controller', 'ember-metal-views/renderer', 'ember-htmlbars/system/dom-helper', 'ember-views/views/select', 'ember-routing-views/views/outlet', 'ember-views/views/view', 'ember-views/system/event_dispatcher', 'ember-views/system/jquery', 'ember-routing/system/route', 'ember-routing/system/router', 'ember-routing/location/hash_location', 'ember-routing/location/history_location', 'ember-routing/location/auto_location', 'ember-routing/location/none_location', 'ember-routing/system/cache', 'ember-application/system/application-instance', 'ember-views/views/text_field', 'ember-views/views/text_area', 'ember-views/views/checkbox', 'ember-views/views/legacy_each_view', 'ember-routing-views/components/link-to', 'ember-routing/services/routing', 'ember-extension-support/container_debug_adapter', 'ember-runtime/mixins/registry_proxy', 'ember-metal/environment'], function (exports, _dagMap, _containerRegistry, _emberMetal, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalEmpty_object, _emberRuntimeSystemLazy_load, _emberRuntimeSystemNamespace, _emberApplicationSystemResolver, _emberMetalRun_loop, _emberMetalUtils, _emberRuntimeControllersController, _emberMetalViewsRenderer, _emberHtmlbarsSystemDomHelper, _emberViewsViewsSelect, _emberRoutingViewsViewsOutlet, _emberViewsViewsView, _emberViewsSystemEvent_dispatcher, _emberViewsSystemJquery, _emberRoutingSystemRoute, _emberRoutingSystemRouter, _emberRoutingLocationHash_location, _emberRoutingLocationHistory_location, _emberRoutingLocationAuto_location, _emberRoutingLocationNone_location, _emberRoutingSystemCache, _emberApplicationSystemApplicationInstance, _emberViewsViewsText_field, _emberViewsViewsText_area, _emberViewsViewsCheckbox, _emberViewsViewsLegacy_each_view, _emberRoutingViewsComponentsLinkTo, _emberRoutingServicesRouting, _emberExtensionSupportContainer_debug_adapter, _emberRuntimeMixinsRegistry_proxy, _emberMetalEnvironment) {
+
+/**
+ Returns the current URL of the app instance. This is useful when your
+ app does not update the browsers URL bar (i.e. it uses the `'none'`
+ location adapter).
+ @public
+ @return {String} the current URL
+*/
+
+// `instance.visit(url)` should eventually replace `instance.handleURL()`;
+// the test helpers can probably be switched to use this implementation too
+
+/**
+ Navigate the instance to a particular URL. This is useful in tests, for
+ example, or to tell the app to start at a particular URL. This method
+ returns a promise that resolves with the app instance when the transition
+ is complete, or rejects if the transion was aborted due to an error.
+ @public
+ @param url {String} the destination URL
+ @return {Promise}
+*/
+
+// Resolve only after rendering is complete
+
+// TODO: why is this necessary? Shouldn't 'actions' queue be enough?
+// Also, aren't proimses supposed to be async anyway?
+
+// Keeps the location adapter's internal URL in-sync
+
+/**
+ A list of boot-time configuration options for customizing the behavior of
+ an `Ember.ApplicationInstance`.
+ This is an interface class that exists purely to document the available
+ options; you do not need to construct it manually. Simply pass a regular
+ JavaScript object containing the desired options into methods that require
+ one of these options object:
+ ```javascript
+ MyApp.visit("/", { location: "none", rootElement: "#container" });
+ ```
+ Not all combinations of the supported options are valid. See the documentation
+ on `Ember.Application#visit` for the supported configurations.
+ Internal, experimental or otherwise unstable flags are marked as private.
+ @class BootOptions
+ @namespace @Ember.ApplicationInstance
+ @public
+*/
+
+/**
+ Provide a specific instance of jQuery. This is useful in conjunction with
+ the `document` option, as it allows you to use a copy of `jQuery` that is
+ appropriately bound to the foreign `document` (e.g. a jsdom).
+ This is highly experimental and support very incomplete at the moment.
+ @property jQuery
+ @type Object
+ @default auto-detected
+ @private
+*/
+// This default is overridable below
+
+/**
+ Interactive mode: whether we need to set up event delegation and invoke
+ lifecycle callbacks on Components.
+ @property isInteractive
+ @type boolean
+ @default auto-detected
+ @private
+*/
+// This default is overridable below
+
+/**
+ Run in a full browser environment.
+ When this flag is set to `false`, it will disable most browser-specific
+ and interactive features. Specifically:
+ * It does not use `jQuery` to append the root view; the `rootElement`
+ (either specified as a subsequent option or on the application itself)
+ must already be an `Element` in the given `document` (as opposed to a
+ string selector).
+ * It does not set up an `EventDispatcher`.
+ * It does not run any `Component` lifecycle hooks (such as `didInsertElement`).
+ * It sets the `location` option to `"none"`. (If you would like to use
+ the location adapter specified in the app's router instead, you can also
+ specify `{ location: null }` to specifically opt-out.)
+ @property isBrowser
+ @type boolean
+ @default auto-detected
+ @public
+*/
+
+/**
+ Disable rendering completely.
+ When this flag is set to `true`, it will disable the entire rendering
+ pipeline. Essentially, this puts the app into "routing-only" mode. No
+ templates will be rendered, and no Components will be created.
+ @property shouldRender
+ @type boolean
+ @default true
+ @public
+*/
+
+/**
+ If present, render into the given `Document` object instead of the
+ global `window.document` object.
+ In practice, this is only useful in non-browser environment or in
+ non-interactive mode, because Ember's `jQuery` dependency is
+ implicitly bound to the current document, causing event delegation
+ to not work properly when the app is rendered into a foreign
+ document object (such as an iframe's `contentDocument`).
+ In non-browser mode, this could be a "`Document`-like" object as
+ Ember only interact with a small subset of the DOM API in non-
+ interactive mode. While the exact requirements have not yet been
+ formalized, the `SimpleDOM` library's implementation is known to
+ work.
+ @property document
+ @type Document
+ @default the global `document` object
+ @public
+*/
+
+/**
+ If present, overrides the application's `rootElement` property on
+ the instance. This is useful for testing environment, where you
+ might want to append the root view to a fixture area.
+ In non-browser mode, because Ember does not have access to jQuery,
+ this options must be specified as a DOM `Element` object instead of
+ a selector string.
+ See the documentation on `Ember.Applications`'s `rootElement` for
+ details.
+ @property rootElement
+ @type String|Element
+ @default null
+ @public
+ */
+
+// Set these options last to give the user a chance to override the
+// defaults from the "combo" options like `isBrowser` (although in
+// practice, the resulting combination is probably invalid)
+
+/**
+ If present, overrides the router's `location` property with this
+ value. This is useful for environments where trying to modify the
+ URL would be inappropriate.
+ @property location
+ @type string
+ @default null
+ @public
+*/
+
+// For compatibility with existing code
+enifed('ember-application/system/application', ['exports', 'dag-map', 'container/registry', 'ember-metal', 'ember-metal/debug', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/empty_object', 'ember-runtime/system/lazy_load', 'ember-runtime/system/namespace', 'ember-application/system/resolver', 'ember-metal/run_loop', 'ember-metal/utils', 'ember-runtime/controllers/controller', 'ember-metal-views/renderer', 'ember-htmlbars/system/dom-helper', 'ember-views/views/select', 'ember-routing-views/views/outlet', 'ember-views/views/view', 'ember-views/system/event_dispatcher', 'ember-views/system/jquery', 'ember-routing/system/route', 'ember-routing/system/router', 'ember-routing/location/hash_location', 'ember-routing/location/history_location', 'ember-routing/location/auto_location', 'ember-routing/location/none_location', 'ember-routing/system/cache', 'ember-application/system/application-instance', 'ember-views/views/text_field', 'ember-views/views/text_area', 'ember-views/views/checkbox', 'ember-views/views/legacy_each_view', 'ember-routing-views/components/link-to', 'ember-routing/services/routing', 'ember-extension-support/container_debug_adapter', 'ember-runtime/mixins/registry_proxy', 'ember-metal/environment', 'ember-runtime/ext/rsvp'], function (exports, _dagMap, _containerRegistry, _emberMetal, _emberMetalDebug, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalEmpty_object, _emberRuntimeSystemLazy_load, _emberRuntimeSystemNamespace, _emberApplicationSystemResolver, _emberMetalRun_loop, _emberMetalUtils, _emberRuntimeControllersController, _emberMetalViewsRenderer, _emberHtmlbarsSystemDomHelper, _emberViewsViewsSelect, _emberRoutingViewsViewsOutlet, _emberViewsViewsView, _emberViewsSystemEvent_dispatcher, _emberViewsSystemJquery, _emberRoutingSystemRoute, _emberRoutingSystemRouter, _emberRoutingLocationHash_location, _emberRoutingLocationHistory_location, _emberRoutingLocationAuto_location, _emberRoutingLocationNone_location, _emberRoutingSystemCache, _emberApplicationSystemApplicationInstance, _emberViewsViewsText_field, _emberViewsViewsText_area, _emberViewsViewsCheckbox, _emberViewsViewsLegacy_each_view, _emberRoutingViewsComponentsLinkTo, _emberRoutingServicesRouting, _emberExtensionSupportContainer_debug_adapter, _emberRuntimeMixinsRegistry_proxy, _emberMetalEnvironment, _emberRuntimeExtRsvp) {
/**
@module ember
@submodule ember-application
*/
'use strict';
@@ -3913,10 +4057,47 @@
@default true
@private
*/
autoboot: true,
+ /**
+ Whether the application should be configured for the legacy "globals mode".
+ Under this mode, the Application object serves as a global namespace for all
+ classes.
+ ```javascript
+ var App = Ember.Application.create({
+ ...
+ });
+ App.Router.reopen({
+ location: 'none'
+ });
+ App.Router.map({
+ ...
+ });
+ App.MyComponent = Ember.Component.extend({
+ ...
+ });
+ ```
+ This flag also exposes other internal APIs that assumes the existence of
+ a special "default instance", like `App.__container__.lookup(...)`.
+ This option is currently not configurable, its value is derived from
+ the `autoboot` flag – disabling `autoboot` also implies opting-out of
+ globals mode support, although they are ultimately orthogonal concerns.
+ Some of the global modes features are already deprecated in 1.x. The
+ existence of this flag is to untangle the globals mode code paths from
+ the autoboot code paths, so that these legacy features can be reviewed
+ for deprecation/removal separately.
+ Forcing the (autoboot=true, _globalsMode=false) here and running the tests
+ would reveal all the places where we are still relying on these legacy
+ behavior internally (mostly just tests).
+ @property _globalsMode
+ @type Boolean
+ @default true
+ @private
+ */
+ _globalsMode: true,
+
init: function () {
this._super.apply(this, arguments);
if (!this.$) {
this.$ = _emberViewsSystemJquery.default;
@@ -3925,16 +4106,20 @@
this.buildRegistry();
registerLibraries();
logLibraryVersions();
- // Start off the number of deferrals at 1. This will be
- // decremented by the Application's own `initialize` method.
+ // Start off the number of deferrals at 1. This will be decremented by
+ // the Application's own `boot` method.
this._readinessDeferrals = 1;
+ this._booted = false;
- this.Router = (this.Router || _emberRoutingSystemRouter.default).extend();
- this.buildDefaultInstance();
+ // Force-assign these flags to their default values when the feature is
+ // disabled, this ensures we can rely on their values in other paths.
+ this.autoboot = this._globalsMode = true;
+
+ this._prepareForGlobalsMode();
this.waitForDOMReady();
},
/**
Build and configure the registry for the current application.
@@ -3947,47 +4132,74 @@
return registry;
},
/**
- Create a container for the current application's registry.
+ Create an ApplicationInstance for this application.
@private
@method buildInstance
- @return {Ember.Container} the configured container
+ @return {Ember.ApplicationInstance} the application instance
*/
buildInstance: function () {
- return _emberApplicationSystemApplicationInstance.default.create({
- application: this
- });
+ var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
+
+ options.application = this;
+ return _emberApplicationSystemApplicationInstance.default.create(options);
},
- buildDefaultInstance: function () {
- var instance = this.buildInstance();
+ /**
+ Enable the legacy globals mode by allowing this application to act
+ as a global namespace. See the docs on the `_globalsMode` property
+ for details.
+ Most of these features are already deprecated in 1.x, so we can
+ stop using them internally and try to remove them.
+ @private
+ @method _prepareForGlobalsMode
+ */
+ _prepareForGlobalsMode: function () {
+ // Create subclass of Ember.Router for this Application instance.
+ // This is to ensure that someone reopening `App.Router` does not
+ // tamper with the default `Ember.Router`.
+ this.Router = (this.Router || _emberRoutingSystemRouter.default).extend();
- // For the default instance only, set the view registry to the global
- // Ember.View.views hash for backwards-compatibility.
- _emberViewsViewsView.default.views = instance.lookup('-view-registry:main');
+ this._buildDeprecatedInstance();
+ },
- // TODO2.0: Legacy support for App.__container__
- // and global methods on App that rely on a single,
- // default instance.
+ /*
+ Build the deprecated instance for legacy globals mode support.
+ Called when creating and resetting the application.
+ This is orthogonal to autoboot: the deprecated instance needs to
+ be created at Application construction (not boot) time to expose
+ App.__container__ and the global Ember.View.views registry. If
+ autoboot sees that this instance exists, it will continue booting
+ it to avoid doing unncessary work (as opposed to building a new
+ instance at boot time), but they are otherwise unrelated.
+ @private
+ @method _buildDeprecatedInstance
+ */
+ _buildDeprecatedInstance: function () {
+ // Build a default instance
+ var instance = this.buildInstance();
+
+ // Legacy support for App.__container__ and other global methods
+ // on App that rely on a single, default instance.
this.__deprecatedInstance__ = instance;
this.__container__ = instance.__container__;
- return instance;
+ // For the default instance only, set the view registry to the global
+ // Ember.View.views hash for backwards-compatibility.
+ _emberViewsViewsView.default.views = instance.lookup('-view-registry:main');
},
/**
- Automatically initialize the application once the DOM has
- become ready.
- The initialization itself is scheduled on the actions queue
- which ensures that application loading finishes before
- booting.
- If you are asynchronously loading code, you should call
- `deferReadiness()` to defer booting, and then call
- `advanceReadiness()` once all of your code has finished
- loading.
+ Automatically kick-off the boot process for the application once the
+ DOM has become ready.
+ The initialization itself is scheduled on the actions queue which
+ ensures that code-loading finishes before booting.
+ If you are asynchronously loading code, you should call `deferReadiness()`
+ to defer booting, and then call `advanceReadiness()` once all of your code
+ has finished loading.
@private
@method waitForDOMReady
*/
waitForDOMReady: function () {
if (!this.$ || this.$.isReady) {
@@ -3996,10 +4208,49 @@
this.$().ready(_emberMetalRun_loop.default.bind(this, 'domReady'));
}
},
/**
+ This is the autoboot flow:
+ 1. Boot the app by calling `this.boot()`
+ 2. Create an instance (or use the `__deprecatedInstance__` in globals mode)
+ 3. Boot the instance by calling `instance.boot()`
+ 4. Invoke the `App.ready()` callback
+ 5. Kick-off routing on the instance
+ Ideally, this is all we would need to do:
+ ```javascript
+ _autoBoot() {
+ this.boot().then(() => {
+ let instance = (this._globalsMode) ? this.__deprecatedInstance__ : this.buildInstance();
+ return instance.boot();
+ }).then((instance) => {
+ App.ready();
+ instance.startRouting();
+ });
+ }
+ ```
+ Unfortunately, we cannot actually write this because we need to participate
+ in the "synchronous" boot process. While the code above would work fine on
+ the initial boot (i.e. DOM ready), when `App.reset()` is called, we need to
+ boot a new instance synchronously (see the documentation on `_bootSync()`
+ for details).
+ Because of this restriction, the actual logic of this method is located
+ inside `didBecomeReady()`.
+ @private
+ @method domReady
+ */
+ domReady: function () {
+ if (this.isDestroyed) {
+ return;
+ }
+
+ this._bootSync();
+
+ // Continues to `didBecomeReady`
+ },
+
+ /**
Use this to defer readiness until some condition is true.
Example:
```javascript
var App = Ember.Application.create();
App.deferReadiness();
@@ -4015,11 +4266,11 @@
to use the router for this purpose.
@method deferReadiness
@public
*/
deferReadiness: function () {
- this._readinessDeferrals++;
+ this._readinessDeferrals++;
},
/**
Call `advanceReadiness` after any asynchronous setup logic has completed.
Each call to `deferReadiness` must be matched by a call to `advanceReadiness`
@@ -4027,61 +4278,80 @@
@method advanceReadiness
@see {Ember.Application#deferReadiness}
@public
*/
advanceReadiness: function () {
- this._readinessDeferrals--;
+ this._readinessDeferrals--;
if (this._readinessDeferrals === 0) {
_emberMetalRun_loop.default.once(this, this.didBecomeReady);
}
},
/**
- Calling initialize manually is not supported.
- Please see Ember.Application#advanceReadiness and
- Ember.Application#deferReadiness.
+ Initialize the application and return a promise that resolves with the `Ember.Application`
+ object when the boot process is complete.
+ Run any application 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.
+ By default, this method is called automatically on "DOM ready"; however, if autoboot
+ is disabled, this is automatically called when the first application instance is
+ created via `visit`.
@private
- @deprecated
- @method initialize
- **/
- initialize: function () {
- },
-
- /**
- 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
- @method domReady
+ @method boot
+ @return {Promise<Ember.Application,Error>}
*/
- domReady: function () {
- if (this.isDestroyed) {
- return;
+ boot: function () {
+ if (this._bootPromise) {
+ return this._bootPromise;
}
- this.boot();
+ try {
+ this._bootSync();
+ } catch (_) {
+ // Ignore th error: in the asynchronous boot path, the error is already reflected
+ // in the promise rejection
+ }
- return this;
+ return this._bootPromise;
},
- boot: function () {
- if (this._bootPromise) {
- return this._bootPromise;
+ /**
+ Unfortunately, a lot of existing code assumes the booting process is
+ "synchronous". Specifically, a lot of tests assumes the last call to
+ `app.advanceReadiness()` or `app.reset()` will result in the app being
+ fully-booted when the current runloop completes.
+ We would like new code (like the `visit` API) to stop making this assumption,
+ so we created the asynchronous version above that returns a promise. But until
+ we have migrated all the code, we would have to expose this method for use
+ *internally* in places where we need to boot an app "synchronously".
+ @private
+ */
+ _bootSync: function () {
+ if (this._booted) {
+ return;
}
- var defer = new _emberMetal.default.RSVP.defer();
+ // Even though this returns synchronously, we still need to make sure the
+ // boot promise exists for book-keeping purposes: if anything went wrong in
+ // the boot process, we need to store the error as a rejection on the boot
+ // promise so that a future caller of `boot()` can tell what failed.
+ var defer = this._bootResolver = new _emberRuntimeExtRsvp.default.defer();
this._bootPromise = defer.promise;
- this._bootResolver = defer;
- this.runInitializers();
- _emberRuntimeSystemLazy_load.runLoadHooks('application', this);
+ try {
+ this.runInitializers();
+ _emberRuntimeSystemLazy_load.runLoadHooks('application', this);
+ this.advanceReadiness();
+ // Continues to `didBecomeReady`
+ } catch (error) {
+ // For the asynchronous boot path
+ defer.reject(error);
- this.advanceReadiness();
-
- return this._bootPromise;
+ // For the synchronous boot path
+ throw error;
+ }
},
/**
Reset the application. This is typically used only in tests. It cleans up
the application in the following order:
@@ -4132,22 +4402,24 @@
ok(true, 'something after app is initialized');
});
```
@method reset
@public
- **/
+ */
reset: function () {
+
var instance = this.__deprecatedInstance__;
this._readinessDeferrals = 1;
this._bootPromise = null;
this._bootResolver = null;
+ this._booted = false;
function handleReset() {
_emberMetalRun_loop.default(instance, 'destroy');
-
- _emberMetalRun_loop.default.schedule('actions', this, 'domReady', this.buildDefaultInstance());
+ this._buildDeprecatedInstance();
+ _emberMetalRun_loop.default.schedule('actions', this, '_bootSync');
}
_emberMetalRun_loop.default.join(this, handleReset);
},
@@ -4164,22 +4436,21 @@
@method runInitializers
*/
runInitializers: function () {
var App = this;
this._runInitializer('initializers', function (name, initializer) {
- if (initializer.initialize.length === 2) {
-
+ if (initializer.initialize.length === 2) {
initializer.initialize(App.__registry__, App);
} else {
initializer.initialize(App);
}
});
},
runInstanceInitializers: function (instance) {
this._runInitializer('instanceInitializers', function (name, initializer) {
- initializer.initialize(instance);
+ initializer.initialize(instance);
});
},
_runInitializer: function (bucketName, cb) {
var initializersByName = _emberMetalProperty_get.get(this.constructor, bucketName);
@@ -4200,28 +4471,36 @@
/**
@private
@method didBecomeReady
*/
didBecomeReady: function () {
- if (this.autoboot) {
- this.runInstanceInitializers(this.__deprecatedInstance__);
-
- if (_emberMetalEnvironment.default.hasDOM) {
- this.__deprecatedInstance__.setupEventDispatcher();
- }
-
- this.ready(); // user hook
- this.__deprecatedInstance__.startRouting();
-
+ try {
+ // TODO: Is this still needed for _globalsMode = false?
if (!_emberMetal.default.testing) {
// Eagerly name all classes that are already loaded
_emberMetal.default.Namespace.processAll();
_emberMetal.default.BOOTED = true;
}
- }
- this._bootResolver.resolve();
+ var instance = this.__deprecatedInstance__;
+
+ instance._bootSync();
+ this.ready();
+ instance.startRouting();
+
+ // For the asynchronous boot path
+ this._bootResolver.resolve(this);
+
+ // For the synchronous boot path
+ this._booted = true;
+ } catch (error) {
+ // For the asynchronous boot path
+ this._bootResolver.reject(error);
+
+ // For the synchronous boot path
+ throw error;
+ }
},
/**
Called when the Application has become ready, immediately before routing
begins. The call will be delayed until the DOM has become ready.
@@ -4249,18 +4528,19 @@
// This method must be moved to the application instance object
willDestroy: function () {
this._super.apply(this, arguments);
_emberMetal.default.BOOTED = false;
+ this._booted = false;
this._bootPromise = null;
this._bootResolver = null;
if (_emberRuntimeSystemLazy_load._loaded.application === this) {
_emberRuntimeSystemLazy_load._loaded.application = undefined;
}
- if (this.__deprecatedInstance__) {
+ if (this._globalsMode && this.__deprecatedInstance__) {
this.__deprecatedInstance__.destroy();
}
},
initializer: function (options) {
@@ -4606,15 +4886,15 @@
return _emberMetalProperty_get.get(item, 'name.length');
});
var maxNameLength = Math.max.apply(this, nameLengths);
- for (var i = 0, l = libs.length; i < l; i++) {
+ for (var i = 0, l = libs.length; i < l; i++) {
var lib = libs[i];
var spaces = new Array(maxNameLength - lib.name.length + 1).join(' ');
- }
- }
+ }
+ }
}
function buildInitializerMethod(bucketName, humanName) {
return function (initializer) {
// If this is the first initializer being added to a subclass, we are going to reopen the class
@@ -4625,38 +4905,183 @@
var attrs = {};
attrs[bucketName] = Object.create(this[bucketName]);
this.reopenClass(attrs);
}
-
this[bucketName][initializer.name] = initializer;
};
}
exports.default = Application;
});
-// Ember.deprecate, Ember.assert, Ember.libraries, LOG_VERSION, Namespace, BOOTED
+// Ember.libraries, LOG_VERSION, Namespace, BOOTED
-// Create subclass of Ember.Router for this Application instance.
-// This is to ensure that someone reopening `App.Router` does not
-// tamper with the default `Ember.Router`.
-// 2.0TODO: Can we move this into a globals-mode-only library?
+// See documentation on `_autoboot()` for details
+// If we already have the __deprecatedInstance__ lying around, boot it to
+// avoid unnecessary work
+
+// Otherwise, build an instance and boot it. This is currently unreachable,
+// because we forced _globalsMode to === autoboot; but having this branch
+// allows us to locally toggle that flag for weeding out legacy globals mode
+// dependencies independently
+
+// TODO: App.ready() is not called when autoboot is disabled, is this correct?
+
/**
- Creates a new instance of the application and instructs it to route to the
- specified initial URL. This method returns a promise that will be resolved
- once rendering is complete. That promise is resolved with the instance.
- ```js
- App.visit('/users').then(function(instance) {
- var view = instance.view;
- view.appendTo('#qunit-test-fixtures');
+ Boot a new instance of `Ember.ApplicationInstance` for the current
+ application and navigate it to the given `url`. Returns a `Promise` that
+ resolves with the instance when the initial routing and rendering is
+ complete, or rejects with any error that occured during the boot process.
+ When `autoboot` is disabled, calling `visit` would first cause the
+ application to boot, which runs the application initializers.
+ This method also takes a hash of boot-time configuration options for
+ customizing the instance's behavior. See the documentation on
+ `Ember.ApplicationInstance.BootOptions` for details.
+ `Ember.ApplicationInstance.BootOptions` is an interface class that exists
+ purely to document the available options; you do not need to construct it
+ manually. Simply pass a regular JavaScript object containing of the
+ desired options:
+ ```javascript
+ MyApp.visit("/", { location: "none", rootElement: "#container" });
+ ```
+ ### Supported Scenarios
+ While the `BootOptions` class exposes a large number of knobs, not all
+ combinations of them are valid; certain incompatible combinations might
+ result in unexpected behavior.
+ For example, booting the instance in the full browser environment
+ while specifying a foriegn `document` object (e.g. `{ isBrowser: true,
+ document: iframe.contentDocument }`) does not work correctly today,
+ largely due to Ember's jQuery dependency.
+ Currently, there are three officially supported scenarios/configurations.
+ Usages outside of these scenarios are not guaranteed to work, but please
+ feel free to file bug reports documenting your experience and any issues
+ you encountered to help expand support.
+ #### Browser Applications (Manual Boot)
+ The setup is largely similar to how Ember works out-of-the-box. Normally,
+ Ember will boot a default instance for your Application on "DOM ready".
+ However, you can customize this behavior by disabling `autoboot`.
+ For example, this allows you to render a miniture demo of your application
+ into a specific area on your marketing website:
+ ```javascript
+ import MyApp from 'my-app';
+ $(function() {
+ let App = MyApp.create({ autoboot: false });
+ let options = {
+ // Override the router's location adapter to prevent it from updating
+ // the URL in the address bar
+ location: 'none',
+ // Override the default `rootElement` on the app to render into a
+ // specific `div` on the page
+ rootElement: '#demo'
+ };
+ // Start the app at the special demo URL
+ App.visit('/demo', options);
});
- ```
+ ````
+ Or perhaps you might want to boot two instances of your app on the same
+ page for a split-screen multiplayer experience:
+ ```javascript
+ import MyApp from 'my-app';
+ $(function() {
+ let App = MyApp.create({ autoboot: false });
+ let sessionId = MyApp.generateSessionID();
+ let player1 = App.visit(`/matches/join?name=Player+1&session=${sessionId}`, { rootElement: '#left', location: 'none' });
+ let player2 = App.visit(`/matches/join?name=Player+2&session=${sessionId}`, { rootElement: '#right', location: 'none' });
+ Promise.all([player1, player2]).then(() => {
+ // Both apps have completed the initial render
+ $('#loading').fadeOut();
+ });
+ });
+ ```
+ Do note that each app instance maintains their own registry/container, so
+ they will run in complete isolation by default.
+ #### Server-Side Rendering (also known as FastBoot)
+ This setup allows you to run your Ember app in a server environment using
+ Node.js and render its content into static HTML for SEO purposes.
+ ```javascript
+ const HTMLSerializer = new SimpleDOM.HTMLSerializer(SimpleDOM.voidMap);
+ function renderURL(url) {
+ let dom = new SimpleDOM.Document();
+ let rootElement = dom.body;
+ let options = { isBrowser: false, document: dom, rootElement: rootElement };
+ return MyApp.visit(options).then(instance => {
+ try {
+ return HTMLSerializer.serialize(rootElement.firstChild);
+ } finally {
+ instance.destroy();
+ }
+ });
+ }
+ ```
+ In this scenario, because Ember does not have access to a global `document`
+ object in the Node.js environment, you must provide one explicitly. In practice,
+ in the non-browser environment, the stand-in `document` object only need to
+ implement a limited subset of the full DOM API. The `SimpleDOM` library is known
+ to work.
+ Since there is no access to jQuery in the non-browser environment, you must also
+ specify a DOM `Element` object in the same `document` for the `rootElement` option
+ (as opposed to a selector string like `"body"`).
+ See the documentation on the `isBrowser`, `document` and `rootElement` properties
+ on `Ember.ApplicationInstance.BootOptions` for details.
+ #### Server-Side Resource Discovery
+ This setup allows you to run the routing layer of your Ember app in a server
+ environment using Node.js and completely disable rendering. This allows you
+ to simulate and discover the resources (i.e. AJAX requests) needed to fufill
+ a given request and eagerly "push" these resources to the client.
+ ```app/initializers/network-service.js
+ import BrowserNetworkService from 'app/services/network/browser';
+ import NodeNetworkService from 'app/services/network/node';
+ // Inject a (hypothetical) service for abstracting all AJAX calls and use
+ // the appropiate implementaion on the client/server. This also allows the
+ // server to log all the AJAX calls made during a particular request and use
+ // that for resource-discovery purpose.
+ export function initialize(application) {
+ if (window) { // browser
+ application.register('service:network', BrowserNetworkService);
+ } else { // node
+ application.register('service:network', NodeNetworkService);
+ }
+ application.inject('route', 'network', 'service:network');
+ };
+ export default {
+ name: 'network-service',
+ initialize: initialize
+ };
+ ```
+ ```app/routes/post.js
+ import Ember from 'ember';
+ // An example of how the (hypothetical) service is used in routes.
+ export default Ember.Route.extend({
+ model(params) {
+ return this.network.fetch(`/api/posts/${params.post_id}.json`);
+ },
+ afterModel(post) {
+ if (post.isExternalContent) {
+ return this.network.fetch(`/api/external/?url=${post.externalURL}`);
+ } else {
+ return post;
+ }
+ }
+ });
+ ```
+ ```javascript
+ // Finally, put all the pieces together
+ function discoverResourcesFor(url) {
+ return MyApp.visit(url, { isBrowser: false, shouldRender: false }).then(instance => {
+ let networkService = instance.lookup('service:network');
+ return networkService.requests; // => { "/api/posts/123.json": "..." }
+ });
+ }
+ ```
@method visit
+ @param url {String} The initial URL to navigate to
+ @param options {Ember.ApplicationInstance.BootOptions}
+ @return {Promise<Ember.ApplicationInstance, Error>}
@private
*/
-enifed('ember-application/system/resolver', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/logger', 'ember-runtime/system/string', 'ember-runtime/system/object', 'ember-runtime/system/namespace', 'ember-htmlbars/helpers', 'ember-application/utils/validate-type', 'ember-metal/dictionary'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalLogger, _emberRuntimeSystemString, _emberRuntimeSystemObject, _emberRuntimeSystemNamespace, _emberHtmlbarsHelpers, _emberApplicationUtilsValidateType, _emberMetalDictionary) {
+enifed('ember-application/system/resolver', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/property_get', 'ember-runtime/system/string', 'ember-runtime/system/object', 'ember-runtime/system/namespace', 'ember-htmlbars/helpers', 'ember-application/utils/validate-type', 'ember-metal/dictionary'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalProperty_get, _emberRuntimeSystemString, _emberRuntimeSystemObject, _emberRuntimeSystemNamespace, _emberHtmlbarsHelpers, _emberApplicationUtilsValidateType, _emberMetalDictionary) {
/**
@module ember
@submodule ember-application
*/
@@ -4767,11 +5192,10 @@
var _fullName$split = fullName.split(':', 2);
var type = _fullName$split[0];
var name = _fullName$split[1];
-
if (type !== 'template') {
var result = name;
if (result.indexOf('.') > -1) {
result = result.replace(/\.(.)/g, function (m) {
@@ -4855,13 +5279,12 @@
if (type !== 'template' && name.indexOf('/') !== -1) {
var parts = name.split('/');
name = parts[parts.length - 1];
var namespaceName = _emberRuntimeSystemString.capitalize(parts.slice(0, -1).join('.'));
root = _emberRuntimeSystemNamespace.default.byName(namespaceName);
+ }
- }
-
var resolveMethodName = fullNameWithoutType === 'main' ? 'Main' : _emberRuntimeSystemString.classify(type);
if (!(name && type)) {
throw new TypeError('Invalid fullName: `' + fullName + '`, must be of the form `type:name` ');
}
@@ -5049,12 +5472,10 @@
if (parsedName.fullName.length > 60) {
padding = '.';
} else {
padding = new Array(60 - parsedName.fullName.length).join('.');
}
-
- _emberMetalLogger.default.info(symbol, parsedName.fullName, padding, this.lookupDescription(parsedName.fullName));
},
/**
Used to iterate all items of a given type.
@method knownForType
@@ -5099,12 +5520,11 @@
return type + ':' + dasherizedName;
}
});
});
-// Ember.TEMPLATES, Ember.assert
-enifed('ember-application/utils/validate-type', ['exports', 'ember-metal/core'], function (exports, _emberMetalCore) {
+enifed('ember-application/utils/validate-type', ['exports', 'ember-metal/debug'], function (exports, _emberMetalDebug) {
/**
@module ember
@submodule ember-application
*/
@@ -5128,26 +5548,27 @@
var action = validationAttributes[0];
var factoryFlag = validationAttributes[1];
var expectedType = validationAttributes[2];
- if (action === 'deprecate') {
- } else {
- }
+ if (action === 'deprecate') {} else {}
}
});
-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
- */
-
+enifed('ember-application', ['exports', 'ember-metal/core', 'ember-runtime/system/lazy_load', 'ember-application/system/resolver', 'ember-application/system/application'], function (exports, _emberMetalCore, _emberRuntimeSystemLazy_load, _emberApplicationSystemResolver, _emberApplicationSystemApplication) {
'use strict';
- _emberMetalCore.default.DataAdapter = _emberExtensionSupportData_adapter.default;
- _emberMetalCore.default.ContainerDebugAdapter = _emberExtensionSupportContainer_debug_adapter.default;
+ _emberMetalCore.default.Application = _emberApplicationSystemApplication.default;
+ _emberMetalCore.default.Resolver = _emberApplicationSystemResolver.Resolver;
+ _emberMetalCore.default.DefaultResolver = _emberApplicationSystemResolver.default;
+
+ _emberRuntimeSystemLazy_load.runLoadHooks('Ember.Application', _emberApplicationSystemApplication.default);
});
+
+/**
+@module ember
+@submodule ember-application
+*/
enifed('ember-extension-support/container_debug_adapter', ['exports', 'ember-metal/core', 'ember-runtime/system/native_array', 'ember-runtime/utils', 'ember-runtime/system/string', 'ember-runtime/system/namespace', 'ember-runtime/system/object'], function (exports, _emberMetalCore, _emberRuntimeSystemNative_array, _emberRuntimeUtils, _emberRuntimeSystemString, _emberRuntimeSystemNamespace, _emberRuntimeSystemObject) {
'use strict';
/**
@module ember
@@ -5747,144 +6168,21 @@
observeRecord: function (record, recordUpdated) {
return function () {};
}
});
});
-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) {
+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) {
/**
- 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
-
- Templates manage the flow of an application's UI, and display state (through
- the DOM) to a user. For example, given a component with the property "name",
- that component's template can use the name in several ways:
-
- ```javascript
- // app/components/person.js
- export default Ember.Component.extend({
- name: 'Jill'
- });
- ```
-
- ```handlebars
- {{! app/components/person.hbs }}
- {{name}}
- <div>{{name}}</div>
- <span data-name={{name}}></span>
- ```
-
- Any time the "name" property on the component changes, the DOM will be
- updated.
-
- Properties can be chained as well:
-
- ```handlebars
- {{aUserModel.name}}
- <div>{{listOfUsers.firstObject.name}}</div>
- ```
-
- ### Using Ember helpers
-
- When content is passed in mustaches `{{}}`, Ember will first try to find a helper
- or component with that name. For example, the `if` helper:
-
- ```handlebars
- {{if name "I have a name" "I have no name"}}
- <span data-has-name={{if name true}}></span>
- ```
-
- The returned value is placed where the `{{}}` is called. The above style is
- called "inline". A second style of helper usage is called "block". For example:
-
- ```handlebars
- {{#if name}}
- I have a name
- {{else}}
- I have no name
- {{/if}}
- ```
-
- The block form of helpers allows you to control how the UI is created based
- on the values of properties.
-
- A third form of helper is called "nested". For example here the concat
- helper will add " Doe" to a displayed name if the person has no last name:
-
- ```handlebars
- <span data-name={{concat firstName (
- if lastName (concat " " lastName) "Doe"
- )}}></span>
- ```
-
- Ember's built-in helpers are described under the [Ember.Templates.helpers](/api/classes/Ember.Templates.helpers.html)
- namespace. Documentation on creating custom helpers can be found under
- [Ember.Helper](/api/classes/Ember.Helper.html).
-
- ### Invoking a Component
-
- Ember components represent state to the UI of an application. Further
- reading on components can be found under [Ember.Component](/api/classes/Ember.Component.html).
-
- @module ember
- @submodule ember-templates
- @main ember-templates
- @public
+ @module ember
+ @submodule ember-extension-support
*/
- /**
-
- [HTMLBars](https://github.com/tildeio/htmlbars) is a [Handlebars](http://handlebarsjs.com/)
- compatible templating engine used by Ember.js. The classes and namespaces
- covered by this documentation attempt to focus on APIs for interacting
- with HTMLBars itself. For more general guidance on Ember.js templates and
- helpers, please see the [ember-templates](/api/modules/ember-templates.html)
- package.
-
- @module ember
- @submodule ember-htmlbars
- @main ember-htmlbars
- @public
- */
'use strict';
- _emberHtmlbarsHelpers.registerHelper('if', _emberHtmlbarsHelpersIf_unless.ifHelper);
- _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);
-
- if (_emberMetalCore.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
- _emberHtmlbarsHelpers.registerHelper('-legacy-each-with-controller', _emberHtmlbarsHelpersLegacyEachWithController.default);
- _emberHtmlbarsHelpers.registerHelper('-legacy-each-with-keyword', _emberHtmlbarsHelpersLegacyEachWithKeyword.default);
- }
-
- _emberMetalCore.default.HTMLBars = {
- template: _emberTemplateCompiler.template,
- compile: _emberTemplateCompiler.compile,
- precompile: _emberTemplateCompiler.precompile,
- makeBoundHelper: _emberHtmlbarsSystemMake_bound_helper.default,
- registerPlugin: _emberTemplateCompiler.registerPlugin,
- DOMHelper: _emberHtmlbarsSystemDomHelper.default
- };
-
- _emberHtmlbarsHelper.default.helper = _emberHtmlbarsHelper.helper;
- _emberMetalCore.default.Helper = _emberHtmlbarsHelper.default;
+ _emberMetalCore.default.DataAdapter = _emberExtensionSupportData_adapter.default;
+ _emberMetalCore.default.ContainerDebugAdapter = _emberExtensionSupportContainer_debug_adapter.default;
});
-
-// importing adds template bootstrapping
-// initializer to enable embedded templates
-
-// importing ember-htmlbars/compat updates the
-// Ember.Handlebars global if htmlbars is enabled
enifed('ember-htmlbars/compat', ['exports', 'ember-metal/core', 'ember-htmlbars/utils/string'], function (exports, _emberMetalCore, _emberHtmlbarsUtilsString) {
'use strict';
var EmberHandlebars = _emberMetalCore.default.Handlebars = _emberMetalCore.default.Handlebars || {};
@@ -5893,24 +6191,27 @@
escapeExpression: _emberHtmlbarsUtilsString.escapeExpression
};
exports.default = EmberHandlebars;
});
-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) {
+enifed('ember-htmlbars/env', ['exports', 'ember-metal', 'ember-metal/environment', 'htmlbars-runtime', 'ember-metal/assign', '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/bind-block', 'ember-htmlbars/hooks/update-self', 'ember-htmlbars/hooks/get-root', 'ember-htmlbars/hooks/get-child', 'ember-htmlbars/hooks/get-block', '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/element-component', 'ember-htmlbars/keywords/partial', 'ember-htmlbars/keywords/input', 'ember-htmlbars/keywords/textarea', 'ember-htmlbars/keywords/collection', 'ember-htmlbars/keywords/yield', '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, _emberMetalAssign, _emberHtmlbarsHooksSubexpr, _emberHtmlbarsHooksConcat, _emberHtmlbarsHooksLinkRenderNode, _emberHtmlbarsHooksCreateFreshScope, _emberHtmlbarsHooksBindShadowScope, _emberHtmlbarsHooksBindSelf, _emberHtmlbarsHooksBindScope, _emberHtmlbarsHooksBindLocal, _emberHtmlbarsHooksBindBlock, _emberHtmlbarsHooksUpdateSelf, _emberHtmlbarsHooksGetRoot, _emberHtmlbarsHooksGetChild, _emberHtmlbarsHooksGetBlock, _emberHtmlbarsHooksGetValue, _emberHtmlbarsHooksGetCellOrValue, _emberHtmlbarsHooksCleanupRenderNode, _emberHtmlbarsHooksDestroyRenderNode, _emberHtmlbarsHooksDidRenderNode, _emberHtmlbarsHooksWillCleanupTree, _emberHtmlbarsHooksDidCleanupTree, _emberHtmlbarsHooksClassify, _emberHtmlbarsHooksComponent, _emberHtmlbarsHooksLookupHelper, _emberHtmlbarsHooksHasHelper, _emberHtmlbarsHooksInvokeHelper, _emberHtmlbarsHooksElement, _emberHtmlbarsHelpers, _emberHtmlbarsKeywords, _emberHtmlbarsSystemDomHelper, _emberHtmlbarsKeywordsDebugger, _emberHtmlbarsKeywordsWith, _emberHtmlbarsKeywordsOutlet, _emberHtmlbarsKeywordsUnbound, _emberHtmlbarsKeywordsView, _emberHtmlbarsKeywordsComponent, _emberHtmlbarsKeywordsElementComponent, _emberHtmlbarsKeywordsPartial, _emberHtmlbarsKeywordsInput, _emberHtmlbarsKeywordsTextarea, _emberHtmlbarsKeywordsCollection, _emberHtmlbarsKeywordsYield, _emberHtmlbarsKeywordsLegacyYield, _emberHtmlbarsKeywordsMut, _emberHtmlbarsKeywordsEach, _emberHtmlbarsKeywordsReadonly, _emberHtmlbarsKeywordsGet) {
'use strict';
- var emberHooks = _emberMetalMerge.default({}, _htmlbarsRuntime.hooks);
+ var emberHooks = _emberMetalAssign.default({}, _htmlbarsRuntime.hooks);
emberHooks.keywords = _emberHtmlbarsKeywords.default;
- _emberMetalMerge.default(emberHooks, {
+ _emberMetalAssign.default(emberHooks, {
linkRenderNode: _emberHtmlbarsHooksLinkRenderNode.default,
createFreshScope: _emberHtmlbarsHooksCreateFreshScope.default,
+ createChildScope: _emberHtmlbarsHooksCreateFreshScope.createChildScope,
bindShadowScope: _emberHtmlbarsHooksBindShadowScope.default,
bindSelf: _emberHtmlbarsHooksBindSelf.default,
bindScope: _emberHtmlbarsHooksBindScope.default,
bindLocal: _emberHtmlbarsHooksBindLocal.default,
+ bindBlock: _emberHtmlbarsHooksBindBlock.default,
updateSelf: _emberHtmlbarsHooksUpdateSelf.default,
+ getBlock: _emberHtmlbarsHooksGetBlock.default,
getRoot: _emberHtmlbarsHooksGetRoot.default,
getChild: _emberHtmlbarsHooksGetChild.default,
getValue: _emberHtmlbarsHooksGetValue.default,
getCellOrValue: _emberHtmlbarsHooksGetCellOrValue.default,
subexpr: _emberHtmlbarsHooksSubexpr.default,
@@ -5923,22 +6224,23 @@
classify: _emberHtmlbarsHooksClassify.default,
component: _emberHtmlbarsHooksComponent.default,
lookupHelper: _emberHtmlbarsHooksLookupHelper.default,
hasHelper: _emberHtmlbarsHooksHasHelper.default,
invokeHelper: _emberHtmlbarsHooksInvokeHelper.default,
- element: _emberHtmlbarsHooksElement.default,
- attributes: _emberHtmlbarsHooksAttributes.default
+ element: _emberHtmlbarsHooksElement.default
});
_emberHtmlbarsKeywords.registerKeyword('debugger', _emberHtmlbarsKeywordsDebugger.default);
_emberHtmlbarsKeywords.registerKeyword('with', _emberHtmlbarsKeywordsWith.default);
_emberHtmlbarsKeywords.registerKeyword('outlet', _emberHtmlbarsKeywordsOutlet.default);
_emberHtmlbarsKeywords.registerKeyword('unbound', _emberHtmlbarsKeywordsUnbound.default);
_emberHtmlbarsKeywords.registerKeyword('component', _emberHtmlbarsKeywordsComponent.default);
+ _emberHtmlbarsKeywords.registerKeyword('@element_component', _emberHtmlbarsKeywordsElementComponent.default);
_emberHtmlbarsKeywords.registerKeyword('partial', _emberHtmlbarsKeywordsPartial.default);
_emberHtmlbarsKeywords.registerKeyword('input', _emberHtmlbarsKeywordsInput.default);
_emberHtmlbarsKeywords.registerKeyword('textarea', _emberHtmlbarsKeywordsTextarea.default);
+ _emberHtmlbarsKeywords.registerKeyword('yield', _emberHtmlbarsKeywordsYield.default);
_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);
@@ -5957,10 +6259,23 @@
var domHelper = _emberMetalEnvironment.default.hasDOM ? new _emberHtmlbarsSystemDomHelper.default() : null;
exports.domHelper = domHelper;
});
+enifed('ember-htmlbars/glimmer-component', ['exports', 'ember-views/views/core_view', 'ember-views/mixins/view_child_views_support', 'ember-views/mixins/view_state_support', 'ember-views/mixins/template_rendering_support', 'ember-views/mixins/class_names_support', 'ember-views/mixins/instrumentation_support', 'ember-views/mixins/aria_role_support', 'ember-views/mixins/view_support', 'ember-views/views/view'], function (exports, _emberViewsViewsCore_view, _emberViewsMixinsView_child_views_support, _emberViewsMixinsView_state_support, _emberViewsMixinsTemplate_rendering_support, _emberViewsMixinsClass_names_support, _emberViewsMixinsInstrumentation_support, _emberViewsMixinsAria_role_support, _emberViewsMixinsView_support, _emberViewsViewsView) {
+ 'use strict';
+
+ exports.default = _emberViewsViewsCore_view.default.extend(_emberViewsMixinsView_child_views_support.default, _emberViewsMixinsView_state_support.default, _emberViewsMixinsTemplate_rendering_support.default, _emberViewsMixinsClass_names_support.default, _emberViewsMixinsInstrumentation_support.default, _emberViewsMixinsAria_role_support.default, _emberViewsMixinsView_support.default, {
+ isComponent: true,
+ isGlimmerComponent: true,
+
+ init: function () {
+ this._super.apply(this, arguments);
+ this._viewRegistry = this._viewRegistry || _emberViewsViewsView.default.views;
+ }
+ });
+});
enifed('ember-htmlbars/helper', ['exports', 'ember-runtime/system/object'], function (exports, _emberRuntimeSystemObject) {
/**
@module ember
@submodule ember-templates
*/
@@ -6075,45 +6390,10 @@
};
}
exports.default = Helper;
});
-enifed('ember-htmlbars/helpers', ['exports', 'ember-metal/empty_object'], function (exports, _emberMetalEmpty_object) {
- /**
- @module ember
- @submodule ember-htmlbars
- */
-
- /**
- @private
- @property helpers
- */
- 'use strict';
-
- exports.registerHelper = registerHelper;
-
- var helpers = new _emberMetalEmpty_object.default();
-
- /**
- @module ember
- @submodule ember-htmlbars
- */
-
- /**
- @private
- @method _registerHelper
- @for Ember.HTMLBars
- @param {String} name
- @param {Object|Function} helperFunc the helper function to add
- */
-
- function registerHelper(name, helperFunc) {
- helpers[name] = helperFunc;
- }
-
- exports.default = helpers;
-});
enifed('ember-htmlbars/helpers/-concat', ['exports'], function (exports) {
/**
@module ember
@submodule ember-templates
*/
@@ -6182,11 +6462,11 @@
}
return result.join(' ');
}
});
-enifed('ember-htmlbars/helpers/-legacy-each-with-controller', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-htmlbars/utils/normalize-self', 'ember-htmlbars/utils/decode-each-key'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberHtmlbarsUtilsNormalizeSelf, _emberHtmlbarsUtilsDecodeEachKey) {
+enifed('ember-htmlbars/helpers/-legacy-each-with-controller', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-htmlbars/utils/normalize-self', 'ember-htmlbars/utils/decode-each-key'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberHtmlbarsUtilsNormalizeSelf, _emberHtmlbarsUtilsDecodeEachKey) {
'use strict';
exports.default = legacyEachWithControllerHelper;
function legacyEachWithControllerHelper(params, hash, blocks) {
@@ -6203,11 +6483,11 @@
list.forEach(function (item, i) {
var self;
if (blocks.template.arity === 0) {
- self = _emberHtmlbarsUtilsNormalizeSelf.default(item);
+ self = _emberHtmlbarsUtilsNormalizeSelf.default(item);
self = bindController(self, true);
}
var key = _emberHtmlbarsUtilsDecodeEachKey.default(item, keyPath, i);
blocks.template.yieldItem(key, [item, i], self);
@@ -6251,13 +6531,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;
});
@@ -6465,11 +6745,52 @@
function forEach(iterable, cb) {
return iterable.forEach ? iterable.forEach(cb) : Array.prototype.forEach.call(iterable, cb);
}
});
-enifed('ember-htmlbars/helpers/if_unless', ['exports', 'ember-metal/core', 'ember-views/streams/should_display'], function (exports, _emberMetalCore, _emberViewsStreamsShould_display) {
+enifed("ember-htmlbars/helpers/hash", ["exports"], function (exports) {
+ /**
+ @module ember
+ @submodule ember-templates
+ */
+
+ /**
+ Use the `{{hash}}` helper to create a hash to pass as an option to your
+ components. This is specially useful for contextual components where you can
+ just yield a hash:
+
+ ```handlebars
+ {{yield (hash
+ name='Sarah'
+ title=office
+ )}}
+ ```
+
+ Would result in an object such as:
+
+ ```js
+ { name: 'Sarah', title: this.get('office') }
+ ```
+
+ Where the `title` is bound to updates of the `office` property.
+
+ @method hash
+ @for Ember.Templates.helpers
+ @param {Object} options
+ @return {Object} Hash
+ @public
+ */
+
+ "use strict";
+
+ exports.default = hashHelper;
+
+ function hashHelper(params, hash, options) {
+ return hash;
+ }
+});
+enifed('ember-htmlbars/helpers/if_unless', ['exports', 'ember-metal/debug', 'ember-views/streams/should_display'], function (exports, _emberMetalDebug, _emberViewsStreamsShould_display) {
/**
@module ember
@submodule ember-templates
*/
@@ -6547,12 +6868,11 @@
function unlessHelper(params, hash, options) {
return ifUnless(params, hash, options, !_emberViewsStreamsShould_display.default(params[0]));
}
function ifUnless(params, hash, options, truthy) {
-
-
+
if (truthy) {
if (options.template.yield) {
options.template.yield();
} else {
return params[1];
@@ -6567,11 +6887,10 @@
}
exports.ifHelper = ifHelper;
exports.unlessHelper = unlessHelper;
});
-// Ember.assert
enifed('ember-htmlbars/helpers/loc', ['exports', 'ember-runtime/system/string'], function (exports, _emberRuntimeSystemString) {
'use strict';
exports.default = locHelper;
@@ -6694,68 +7013,54 @@
} else if (options.inverse && options.inverse.yield) {
options.inverse.yield([]);
}
}
});
-enifed('ember-htmlbars/hooks/attributes', ['exports', 'htmlbars-runtime'], function (exports, _htmlbarsRuntime) {
+enifed('ember-htmlbars/helpers', ['exports', 'ember-metal/empty_object'], function (exports, _emberMetalEmpty_object) {
+ /**
+ @module ember
+ @submodule ember-htmlbars
+ */
+
+ /**
+ @private
+ @property helpers
+ */
'use strict';
- exports.default = attributes;
+ exports.registerHelper = registerHelper;
- function attributes(morph, env, scope, template, parentNode, visitor) {
- var state = morph.state;
- var block = state.block;
+ var helpers = new _emberMetalEmpty_object.default();
- if (!block) {
- var element = findRootElement(parentNode);
- if (!element) {
- return;
- }
+ /**
+ @module ember
+ @submodule ember-htmlbars
+ */
- normalizeClassStatement(template.statements, element);
+ /**
+ @private
+ @method _registerHelper
+ @for Ember.HTMLBars
+ @param {String} name
+ @param {Object|Function} helperFunc the helper function to add
+ */
- template.element = element;
- block = morph.state.block = _htmlbarsRuntime.internal.blockFor(_htmlbarsRuntime.render, template, { scope: scope });
- }
-
- block(env, [], undefined, morph, undefined, visitor);
+ function registerHelper(name, helperFunc) {
+ helpers[name] = helperFunc;
}
- function normalizeClassStatement(statements, element) {
- var className = element.getAttribute('class');
- if (!className) {
- return;
- }
+ exports.default = helpers;
+});
+enifed('ember-htmlbars/hooks/bind-block', ['exports'], function (exports) {
+ 'use strict';
- for (var i = 0, l = statements.length; i < l; i++) {
- var statement = statements[i];
+ exports.default = bindBlock;
- if (statement[1] === 'class') {
- statement[2][2].unshift(className);
- }
- }
- }
+ function bindBlock(env, scope, block) {
+ var name = arguments.length <= 3 || arguments[3] === undefined ? 'default' : arguments[3];
- 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;
- }
+ scope.bindBlock(name, block);
}
});
enifed('ember-htmlbars/hooks/bind-local', ['exports', 'ember-metal/streams/stream', 'ember-metal/streams/proxy-stream'], function (exports, _emberMetalStreamsStream, _emberMetalStreamsProxyStream) {
/**
@module ember
@@ -6765,31 +7070,30 @@
'use strict';
exports.default = bindLocal;
function bindLocal(env, scope, key, value) {
- var isExisting = scope.locals.hasOwnProperty(key);
- if (isExisting) {
- var existing = scope.locals[key];
-
+ // TODO: What is the cause of these cases?
+ if (scope.hasOwnLocal(key)) {
+ var existing = scope.getLocal(key);
if (existing !== value) {
existing.setSource(value);
}
} else {
- var newValue = _emberMetalStreamsStream.default.wrap(value, _emberMetalStreamsProxyStream.default, key);
- scope.locals[key] = newValue;
+ var newValue = _emberMetalStreamsStream.wrap(value, _emberMetalStreamsProxyStream.default, key);
+ scope.bindLocal(key, newValue);
}
}
});
enifed("ember-htmlbars/hooks/bind-scope", ["exports"], function (exports) {
"use strict";
exports.default = bindScope;
function bindScope(env, scope) {}
});
-enifed('ember-htmlbars/hooks/bind-self', ['exports', 'ember-metal/streams/proxy-stream', 'ember-htmlbars/utils/subscribe'], function (exports, _emberMetalStreamsProxyStream, _emberHtmlbarsUtilsSubscribe) {
+enifed('ember-htmlbars/hooks/bind-self', ['exports', 'ember-metal', 'ember-metal/streams/proxy-stream'], function (exports, _emberMetal, _emberMetalStreamsProxyStream) {
/**
@module ember
@submodule ember-htmlbars
*/
@@ -6804,36 +7108,50 @@
var _self2 = self;
var controller = _self2.controller;
self = self.self;
- newStream(scope.locals, 'controller', controller || self);
+ if (!!_emberMetal.default.ENV._ENABLE_LEGACY_CONTROLLER_SUPPORT) {
+ scope.bindLocal('controller', newStream(controller || self));
+ }
}
if (self && self.isView) {
- newStream(scope.locals, 'view', self, null);
- newStream(scope.locals, 'controller', scope.locals.view.getKey('controller'));
- newStream(scope, 'self', scope.locals.view.getKey('context'), null, true);
+ if (!!_emberMetal.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
+ scope.bindLocal('view', newStream(self, 'view'));
+ }
+
+ if (!!_emberMetal.default.ENV._ENABLE_LEGACY_CONTROLLER_SUPPORT) {
+ scope.bindLocal('controller', newStream(self, '').getKey('controller'));
+ }
+
+ var _selfStream = newStream(self, '');
+
+ if (self.isGlimmerComponent) {
+ scope.bindSelf(_selfStream);
+ } else {
+ scope.bindSelf(newStream(_selfStream.getKey('context'), ''));
+ }
+
return;
}
- newStream(scope, 'self', self, null, true);
+ var selfStream = newStream(self, '');
+ scope.bindSelf(selfStream);
- if (!scope.locals.controller) {
- scope.locals.controller = scope.self;
+ if (!!_emberMetal.default.ENV._ENABLE_LEGACY_CONTROLLER_SUPPORT) {
+ if (!scope.hasLocal('controller')) {
+ scope.bindLocal('controller', selfStream);
+ }
}
}
- function newStream(scope, key, newValue, renderNode, isSelf) {
- var stream = new _emberMetalStreamsProxyStream.default(newValue, isSelf ? '' : key);
- if (renderNode) {
- _emberHtmlbarsUtilsSubscribe.default(renderNode, scope, stream);
- }
- scope[key] = stream;
+ function newStream(newValue, key) {
+ return new _emberMetalStreamsProxyStream.default(newValue, key);
}
});
-enifed('ember-htmlbars/hooks/bind-shadow-scope', ['exports', 'ember-views/views/component', 'ember-metal/streams/proxy-stream', 'ember-htmlbars/utils/subscribe'], function (exports, _emberViewsViewsComponent, _emberMetalStreamsProxyStream, _emberHtmlbarsUtilsSubscribe) {
+enifed('ember-htmlbars/hooks/bind-shadow-scope', ['exports', 'ember-metal/streams/proxy-stream'], function (exports, _emberMetalStreamsProxyStream) {
/**
@module ember
@submodule ember-htmlbars
*/
@@ -6848,45 +7166,41 @@
var didOverrideController = false;
if (parentScope && parentScope.overrideController) {
didOverrideController = true;
- shadowScope.locals.controller = parentScope.locals.controller;
+ shadowScope.bindLocal('controller', parentScope.getLocal('controller'));
}
var view = options.view;
- if (view && !(view instanceof _emberViewsViewsComponent.default)) {
- newStream(shadowScope.locals, 'view', view, null);
+ if (view && !view.isComponent) {
+ shadowScope.bindLocal('view', newStream(view, 'view'));
if (!didOverrideController) {
- newStream(shadowScope.locals, 'controller', shadowScope.locals.view.getKey('controller'));
+ shadowScope.bindLocal('controller', newStream(shadowScope.getLocal('view').getKey('controller')));
}
if (view.isView) {
- newStream(shadowScope, 'self', shadowScope.locals.view.getKey('context'), null, true);
+ shadowScope.bindSelf(newStream(shadowScope.getLocal('view').getKey('context'), ''));
}
}
- shadowScope.view = view;
+ shadowScope.bindView(view);
if (view && options.attrs) {
- shadowScope.component = view;
+ shadowScope.bindComponent(view);
}
if ('attrs' in options) {
- shadowScope.attrs = options.attrs;
+ shadowScope.bindAttrs(options.attrs);
}
return shadowScope;
}
- function newStream(scope, key, newValue, renderNode, isSelf) {
- var stream = new _emberMetalStreamsProxyStream.default(newValue, isSelf ? '' : key);
- if (renderNode) {
- _emberHtmlbarsUtilsSubscribe.default(renderNode, scope, stream);
- }
- scope[key] = stream;
+ function newStream(newValue, key) {
+ return new _emberMetalStreamsProxyStream.default(newValue, key);
}
});
enifed('ember-htmlbars/hooks/classify', ['exports', 'ember-htmlbars/utils/is-component'], function (exports, _emberHtmlbarsUtilsIsComponent) {
/**
@module ember
@@ -6919,69 +7233,129 @@
if (renderNode.cleanup) {
renderNode.cleanup();
}
}
});
-enifed('ember-htmlbars/hooks/component', ['exports', 'ember-htmlbars/node-managers/component-node-manager', 'ember-views/system/build-component-template'], function (exports, _emberHtmlbarsNodeManagersComponentNodeManager, _emberViewsSystemBuildComponentTemplate) {
+enifed('ember-htmlbars/hooks/component', ['exports', 'ember-metal/debug', 'ember-htmlbars/node-managers/component-node-manager', 'ember-views/system/build-component-template', 'ember-htmlbars/utils/lookup-component', 'ember-metal/cache'], function (exports, _emberMetalDebug, _emberHtmlbarsNodeManagersComponentNodeManager, _emberViewsSystemBuildComponentTemplate, _emberHtmlbarsUtilsLookupComponent, _emberMetalCache) {
'use strict';
exports.default = componentHook;
+ var IS_ANGLE_CACHE = new _emberMetalCache.default(1000, function (key) {
+ return key.match(/^(@?)<(.*)>$/);
+ });
+
+ var CONTAINS_DASH = new _emberMetalCache.default(1000, function (key) {
+ return key.indexOf('-') !== -1;
+ });
+
function componentHook(renderNode, env, scope, _tagName, params, attrs, templates, visitor) {
- var state = renderNode.state;
+ var state = renderNode.getState();
// Determine if this is an initial render or a re-render
if (state.manager) {
state.manager.rerender(env, attrs, visitor);
return;
}
var tagName = _tagName;
var isAngleBracket = false;
- var isTopLevel = undefined;
+ var isTopLevel = false;
+ var isDasherized = false;
- var angles = tagName.match(/^(@?)<(.*)>$/);
+ var angles = IS_ANGLE_CACHE.get(tagName);
if (angles) {
tagName = angles[2];
isAngleBracket = true;
isTopLevel = !!angles[1];
}
+ if (CONTAINS_DASH.get(tagName)) {
+ isDasherized = true;
+ }
+
var parentView = env.view;
- 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
- });
+ // | Top-level | Invocation: <foo-bar> | Invocation: {{foo-bar}} |
+ // ----------------------------------------------------------------------
+ // | <div> | <div> is component el | no special semantics (a) |
+ // | <foo-bar> | <foo-bar> is identity el | EWTF |
+ // | <bar-baz> | recursive invocation | no special semantics |
+ // | {{anything}} | EWTF | no special semantics |
+ //
+ // (a) needs to be implemented specially, because the usual semantics of
+ // <div> are defined by the compiled template, and we need to emulate
+ // those semantics.
- state.manager = manager;
- manager.render(env, visitor);
- } else {
- var component = env.view;
+ var currentComponent = env.view;
+ var isInvokedWithAngles = currentComponent && currentComponent._isAngleBracket;
+ var isInvokedWithCurlies = currentComponent && !currentComponent._isAngleBracket;
+
+ // <div> at the top level of a <foo-bar> invocation
+ var isComponentHTMLElement = isAngleBracket && !isDasherized && isInvokedWithAngles;
+
+ // <foo-bar> at the top level of a <foo-bar> invocation
+ var isComponentIdentityElement = isAngleBracket && isTopLevel && tagName === env.view.tagName;
+
+ // <div> at the top level of a {{foo-bar}} invocation
+ var isNormalHTMLElement = isAngleBracket && !isDasherized && isInvokedWithCurlies;
+
+ var component = undefined,
+ layout = undefined;
+ if (isDasherized || !isAngleBracket) {
+ var result = _emberHtmlbarsUtilsLookupComponent.default(env.container, tagName);
+ component = result.component;
+ layout = result.layout;
+
+ if (isAngleBracket && isDasherized && !component && !layout) {
+ isComponentHTMLElement = true;
+ } else {}
+ }
+
+ if (isComponentIdentityElement || isComponentHTMLElement) {
+ // Inside the layout for <foo-bar> invoked with angles, this is the top-level element
+ // for the component. It can either be `<foo-bar>` (the "identity element") or any
+ // normal HTML element (non-dasherized).
var templateOptions = {
- component: component,
+ component: currentComponent,
+ tagName: tagName,
isAngleBracket: true,
isComponentElement: true,
- outerAttrs: scope.attrs,
+ outerAttrs: scope.getAttrs(),
parentScope: scope
};
var contentOptions = { templates: templates, scope: scope };
var _buildComponentTemplate = _emberViewsSystemBuildComponentTemplate.default(templateOptions, attrs, contentOptions);
var block = _buildComponentTemplate.block;
block.invoke(env, [], undefined, renderNode, scope, visitor);
+ } else if (isNormalHTMLElement) {
+ var block = _emberViewsSystemBuildComponentTemplate.buildHTMLTemplate(tagName, attrs, { templates: templates, scope: scope });
+ block.invoke(env, [], undefined, renderNode, scope, visitor);
+ } else {
+ // Invoking a component from the outside (either via <foo-bar> angle brackets
+ // or {{foo-bar}} legacy curlies).
+
+ var manager = _emberHtmlbarsNodeManagersComponentNodeManager.default.create(renderNode, env, {
+ tagName: tagName,
+ params: params,
+ attrs: attrs,
+ parentView: parentView,
+ templates: templates,
+ isAngleBracket: isAngleBracket,
+ isTopLevel: isTopLevel,
+ component: component,
+ layout: layout,
+ parentScope: scope
+ });
+
+ state.manager = manager;
+ manager.render(env, visitor);
}
}
});
enifed('ember-htmlbars/hooks/concat', ['exports', 'ember-metal/streams/utils'], function (exports, _emberMetalStreamsUtils) {
/**
@@ -6995,11 +7369,16 @@
function concat(env, parts) {
return _emberMetalStreamsUtils.concat(parts, '');
}
});
-enifed("ember-htmlbars/hooks/create-fresh-scope", ["exports"], function (exports) {
+enifed('ember-htmlbars/hooks/create-fresh-scope', ['exports', 'ember-metal/streams/proxy-stream', 'ember-metal/empty_object'], function (exports, _emberMetalStreamsProxyStream, _emberMetalEmpty_object) {
+ 'use strict';
+
+ exports.default = createFreshScope;
+ exports.createChildScope = createChildScope;
+
/*
Ember's implementation of HTMLBars creates an enriched scope.
* self: same as HTMLBars, this field represents the dynamic lookup
of root keys that are not special keywords or block arguments.
@@ -7044,24 +7423,182 @@
view-less templates and the legacy `controller=foo` semantics,
the controller hierarchy is managed dynamically by looking at
the current view's `controller`.
*/
- "use strict";
+ function Scope(parent) {
+ this._self = undefined;
+ this._blocks = undefined;
+ this._component = undefined;
+ this._view = undefined;
+ this._attrs = undefined;
+ this._locals = undefined;
+ this._localPresent = undefined;
+ this.overrideController = undefined;
+ this.parent = parent;
+ }
- exports.default = createFreshScope;
+ var proto = Scope.prototype;
+ proto.getSelf = function () {
+ return this._self || this.parent.getSelf();
+ };
+
+ proto.bindSelf = function (self) {
+ this._self = self;
+ };
+
+ proto.updateSelf = function (self, key) {
+ var existing = this._self;
+
+ if (existing) {
+ existing.setSource(self);
+ } else {
+ this._self = new _emberMetalStreamsProxyStream.default(self, key);
+ }
+ };
+
+ proto.getBlock = function (name) {
+ if (!this._blocks) {
+ return this.parent.getBlock(name);
+ }
+ return this._blocks[name] || this.parent.getBlock(name);
+ };
+
+ proto.hasBlock = function (name) {
+ if (!this._blocks) {
+ return this.parent.hasBlock(name);
+ }
+ return !!(this._blocks[name] || this.parent.hasBlock(name));
+ };
+
+ proto.bindBlock = function (name, block) {
+ if (!this._blocks) {
+ this._blocks = new _emberMetalEmpty_object.default();
+ }
+ this._blocks[name] = block;
+ };
+
+ proto.getComponent = function () {
+ return this._component || this.parent.getComponent();
+ };
+
+ proto.bindComponent = function (component) {
+ this._component = component;
+ };
+
+ proto.getView = function () {
+ return this._view || this.parent.getView();
+ };
+
+ proto.bindView = function (view) {
+ this._view = view;
+ };
+
+ proto.getAttrs = function () {
+ return this._attrs || this.parent.getAttrs();
+ };
+
+ proto.bindAttrs = function (attrs) {
+ this._attrs = attrs;
+ };
+
+ proto.hasLocal = function (name) {
+ if (!this._localPresent) {
+ return this.parent.hasLocal(name);
+ }
+ return this._localPresent[name] || this.parent.hasLocal(name);
+ };
+
+ proto.hasOwnLocal = function (name) {
+ return this._localPresent && this._localPresent[name];
+ };
+
+ proto.getLocal = function (name) {
+ if (!this._localPresent) {
+ return this.parent.getLocal(name);
+ }
+ return this._localPresent[name] ? this._locals[name] : this.parent.getLocal(name);
+ };
+
+ proto.bindLocal = function (name, value) {
+ if (!this._localPresent) {
+ this._localPresent = new _emberMetalEmpty_object.default();
+ this._locals = new _emberMetalEmpty_object.default();
+ }
+
+ this._localPresent[name] = true;
+ this._locals[name] = value;
+ };
+
+ var EMPTY = {
+ _self: undefined,
+ _blocks: undefined,
+ _component: undefined,
+ _view: undefined,
+ _attrs: undefined,
+ _locals: undefined,
+ _localPresent: undefined,
+ overrideController: undefined,
+
+ getSelf: function () {
+ return null;
+ },
+ bindSelf: function (self) {
+ return null;
+ },
+ updateSelf: function (self, key) {
+ return null;
+ },
+ getBlock: function (name) {
+ return null;
+ },
+ bindBlock: function (name, block) {
+ return null;
+ },
+ hasBlock: function (name) {
+ return false;
+ },
+ getComponent: function () {
+ return null;
+ },
+ bindComponent: function () {
+ return null;
+ },
+ getView: function () {
+ return null;
+ },
+ bindView: function (view) {
+ return null;
+ },
+ getAttrs: function () {
+ return null;
+ },
+ bindAttrs: function (attrs) {
+ return null;
+ },
+ hasLocal: function (name) {
+ return false;
+ },
+ hasOwnLocal: function (name) {
+ return false;
+ },
+ getLocal: function (name) {
+ return null;
+ },
+ bindLocal: function (name, value) {
+ return null;
+ }
+ };
+
function createFreshScope() {
- return {
- self: null,
- blocks: {},
- component: null,
- attrs: null,
- locals: {},
- localPresent: {}
- };
+ return new Scope(EMPTY);
}
+
+ function createChildScope(parent) {
+ return new Scope(parent);
+ }
});
enifed("ember-htmlbars/hooks/destroy-render-node", ["exports"], function (exports) {
/**
@module ember
@submodule ember-htmlbars
@@ -7099,11 +7636,11 @@
"use strict";
exports.default = didRenderNode;
function didRenderNode(morph, env) {
- env.renderedNodes[morph.guid] = true;
+ env.renderedNodes.add(morph);
}
});
enifed('ember-htmlbars/hooks/element', ['exports', 'ember-htmlbars/system/lookup-helper', 'htmlbars-runtime/hooks', 'ember-htmlbars/system/invoke-helper'], function (exports, _emberHtmlbarsSystemLookupHelper, _htmlbarsRuntimeHooks, _emberHtmlbarsSystemInvokeHelper) {
/**
@module ember
@@ -7118,21 +7655,30 @@
if (_htmlbarsRuntimeHooks.handleRedirect(morph, env, scope, path, params, hash, null, null, visitor)) {
return;
}
var result;
- var helper = _emberHtmlbarsSystemLookupHelper.findHelper(path, scope.self, env);
+ var helper = _emberHtmlbarsSystemLookupHelper.findHelper(path, scope.getSelf(), env);
if (helper) {
var helperStream = _emberHtmlbarsSystemInvokeHelper.buildHelperStream(helper, params, hash, { element: morph.element }, env, scope, path);
result = helperStream.value();
} else {
result = env.hooks.get(env, scope, path);
}
env.hooks.getValue(result);
}
});
+enifed("ember-htmlbars/hooks/get-block", ["exports"], function (exports) {
+ "use strict";
+
+ exports.default = getBlock;
+
+ function getBlock(scope, key) {
+ return scope.getBlock(key);
+ }
+});
enifed('ember-htmlbars/hooks/get-cell-or-value', ['exports', 'ember-metal/streams/utils', 'ember-htmlbars/keywords/mut'], function (exports, _emberMetalStreamsUtils, _emberHtmlbarsKeywordsMut) {
'use strict';
exports.default = getCellOrValue;
@@ -7177,35 +7723,42 @@
exports.default = getRoot;
function getRoot(scope, key) {
if (key === 'this') {
- return [scope.self];
+ return [scope.getSelf()];
} else if (key === 'hasBlock') {
- return [!!scope.blocks.default];
+ return [!!scope.hasBlock('default')];
} else if (key === 'hasBlockParams') {
- return [!!(scope.blocks.default && scope.blocks.default.arity)];
- } else if (key in scope.locals) {
- return [scope.locals[key]];
+ var block = scope.getBlock('default');
+ return [!!block && block.arity];
+ } else if (scope.hasLocal(key)) {
+ return [scope.getLocal(key)];
} else {
return [getKey(scope, key)];
}
}
function getKey(scope, key) {
- if (key === 'attrs' && scope.attrs) {
- return scope.attrs;
+ if (key === 'attrs') {
+ var _attrs = scope.getAttrs();
+ if (_attrs) {
+ return _attrs;
+ }
}
- var self = scope.self || scope.locals.view;
+ var self = scope.getSelf() || scope.getLocal('view');
if (self) {
return self.getKey(key);
- } else if (scope.attrs && key in scope.attrs) {
+ }
+
+ var attrs = scope.getAttrs();
+ if (key in attrs) {
// TODO: attrs
- // Ember.deprecate("You accessed the `" + key + "` attribute directly. Please use `attrs." + key + "` instead.");
- return scope.attrs[key];
+ // deprecate("You accessed the `" + key + "` attribute directly. Please use `attrs." + key + "` instead.");
+ return attrs[key];
}
}
});
enifed('ember-htmlbars/hooks/get-value', ['exports', 'ember-metal/streams/utils', 'ember-views/compat/attrs-proxy'], function (exports, _emberMetalStreamsUtils, _emberViewsCompatAttrsProxy) {
/**
@@ -7246,23 +7799,16 @@
}
return false;
}
});
-enifed('ember-htmlbars/hooks/invoke-helper', ['exports', 'ember-metal/core', 'ember-htmlbars/system/invoke-helper', 'ember-htmlbars/utils/subscribe'], function (exports, _emberMetalCore, _emberHtmlbarsSystemInvokeHelper, _emberHtmlbarsUtilsSubscribe) {
+enifed('ember-htmlbars/hooks/invoke-helper', ['exports', 'ember-htmlbars/system/invoke-helper', 'ember-htmlbars/utils/subscribe'], function (exports, _emberHtmlbarsSystemInvokeHelper, _emberHtmlbarsUtilsSubscribe) {
'use strict';
exports.default = invokeHelper;
function invokeHelper(morph, env, scope, visitor, params, hash, helper, templates, context) {
- if (helper.isLegacyViewHelper) {
-
- env.hooks.keyword('view', morph, env, scope, [helper.viewClass], hash, templates.template.raw, null, visitor);
- // Opts into a special mode for view helpers
- return { handled: true };
- }
-
var helperStream = _emberHtmlbarsSystemInvokeHelper.buildHelperStream(helper, params, hash, templates, env, scope);
// Ember.Helper helpers are pure values, thus linkable
if (helperStream.linkable) {
if (morph) {
@@ -7289,11 +7835,10 @@
// Built-in helpers are not linkable, they must run every rerender
return { value: helperStream.value() };
}
});
-// Ember.assert
enifed('ember-htmlbars/hooks/link-render-node', ['exports', 'ember-htmlbars/utils/subscribe', 'ember-runtime/utils', 'ember-metal/streams/utils'], function (exports, _emberHtmlbarsUtilsSubscribe, _emberRuntimeUtils, _emberMetalStreamsUtils) {
/**
@module ember
@submodule ember-htmlbars
*/
@@ -7307,11 +7852,11 @@
return true;
}
var keyword = env.hooks.keywords[path];
if (keyword && keyword.link) {
- keyword.link(renderNode.state, params, hash);
+ keyword.link(renderNode.getState(), params, hash);
} else {
switch (path) {
case 'unbound':
return true;
case 'unless':
@@ -7390,11 +7935,11 @@
'use strict';
exports.default = lookupHelperHook;
function lookupHelperHook(env, scope, helperName) {
- return _emberHtmlbarsSystemLookupHelper.default(helperName, scope.self, env);
+ return _emberHtmlbarsSystemLookupHelper.default(helperName, scope.getSelf(), env);
}
});
enifed('ember-htmlbars/hooks/subexpr', ['exports', 'ember-htmlbars/system/lookup-helper', 'ember-htmlbars/system/invoke-helper', 'ember-metal/streams/utils'], function (exports, _emberHtmlbarsSystemLookupHelper, _emberHtmlbarsSystemInvokeHelper, _emberMetalStreamsUtils) {
/**
@module ember
@@ -7413,11 +7958,11 @@
if (keyword) {
return keyword(null, env, scope, params, hash, null, null);
}
var label = labelForSubexpr(params, hash, helperName);
- var helper = _emberHtmlbarsSystemLookupHelper.default(helperName, scope.self, env);
+ var helper = _emberHtmlbarsSystemLookupHelper.default(helperName, scope.getSelf(), env);
var helperStream = _emberHtmlbarsSystemInvokeHelper.buildHelperStream(helper, params, hash, null, env, scope, label);
for (var i = 0, l = params.length; i < l; i++) {
helperStream.addDependency(params[i]);
@@ -7457,11 +8002,11 @@
}
return out.join(' ');
}
});
-enifed('ember-htmlbars/hooks/update-self', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-htmlbars/utils/update-scope'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberHtmlbarsUtilsUpdateScope) {
+enifed('ember-htmlbars/hooks/update-self', ['exports', 'ember-metal/debug', 'ember-metal/property_get'], function (exports, _emberMetalDebug, _emberMetalProperty_get) {
/**
@module ember
@submodule ember-htmlbars
*/
@@ -7476,21 +8021,20 @@
var _self2 = self;
var controller = _self2.controller;
self = self.self;
- _emberHtmlbarsUtilsUpdateScope.default(scope.locals, 'controller', controller || self);
+ scope.updateLocal('controller', controller || self);
}
-
if (self && self.isView) {
- _emberHtmlbarsUtilsUpdateScope.default(scope.locals, 'view', self, null);
- _emberHtmlbarsUtilsUpdateScope.default(scope, 'self', _emberMetalProperty_get.get(self, 'context'), null, true);
+ scope.updateLocal('view', self);
+ scope.updateSelf(_emberMetalProperty_get.get(self, 'context'), '');
return;
}
- _emberHtmlbarsUtilsUpdateScope.default(scope, 'self', self, null);
+ scope.updateSelf(self);
}
});
enifed("ember-htmlbars/hooks/will-cleanup-tree", ["exports"], function (exports) {
"use strict";
@@ -7527,44 +8071,126 @@
// untouched. This view is then cleared once cleanup is complete in
// `didCleanupTree`.
view.ownerView._destroyingSubtreeForView = view;
}
});
-enifed('ember-htmlbars/keywords', ['exports', 'htmlbars-runtime'], function (exports, _htmlbarsRuntime) {
+enifed('ember-htmlbars/keywords/closure-component', ['exports', 'ember-metal/utils', 'ember-metal/streams/stream', 'ember-metal/streams/utils', 'ember-htmlbars/hooks/subexpr', 'ember-metal/assign', 'ember-htmlbars/utils/extract-positional-params', 'ember-htmlbars/utils/lookup-component'], function (exports, _emberMetalUtils, _emberMetalStreamsStream, _emberMetalStreamsUtils, _emberHtmlbarsHooksSubexpr, _emberMetalAssign, _emberHtmlbarsUtilsExtractPositionalParams, _emberHtmlbarsUtilsLookupComponent) {
/**
@module ember
- @submodule ember-htmlbars
+ @submodule ember-templates
*/
'use strict';
- exports.registerKeyword = registerKeyword;
+ exports.default = closureComponent;
+ exports.isComponentCell = isComponentCell;
+ exports.mergeHash = mergeHash;
+ var COMPONENT_REFERENCE = _emberMetalUtils.symbol('COMPONENT_REFERENCE');
+ exports.COMPONENT_REFERENCE = COMPONENT_REFERENCE;
+ var COMPONENT_CELL = _emberMetalUtils.symbol('COMPONENT_CELL');
+ exports.COMPONENT_CELL = COMPONENT_CELL;
+ var COMPONENT_PATH = _emberMetalUtils.symbol('COMPONENT_PATH');
+ exports.COMPONENT_PATH = COMPONENT_PATH;
+ var COMPONENT_POSITIONAL_PARAMS = _emberMetalUtils.symbol('COMPONENT_POSITIONAL_PARAMS');
+ exports.COMPONENT_POSITIONAL_PARAMS = COMPONENT_POSITIONAL_PARAMS;
+ var COMPONENT_HASH = _emberMetalUtils.symbol('COMPONENT_HASH');
- /**
- @private
- @property helpers
- */
- var keywords = Object.create(_htmlbarsRuntime.hooks.keywords);
+ exports.COMPONENT_HASH = COMPONENT_HASH;
+ var ClosureComponentStream = _emberMetalStreamsStream.default.extend({
+ init: function (env, path, params, hash) {
+ this._env = env;
+ this._path = path;
+ this._params = params;
+ this._hash = hash;
+ this.label = _emberHtmlbarsHooksSubexpr.labelForSubexpr([path].concat(params), hash, 'component');
+ this[COMPONENT_REFERENCE] = true;
+ },
+ compute: function () {
+ return createClosureComponentCell(this._env, this._path, this._params, this._hash);
+ }
+ });
- /**
- @module ember
- @submodule ember-htmlbars
- */
+ function closureComponent(env, _ref3, hash) {
+ var path = _ref3[0];
- /**
- @private
- @method _registerHelper
- @for Ember.HTMLBars
- @param {String} name
- @param {Object|Function} keyword the keyword to add
- */
+ var params = _ref3.slice(1);
- function registerKeyword(name, keyword) {
- keywords[name] = keyword;
+ var s = new ClosureComponentStream(env, path, params, hash);
+
+ s.addDependency(path);
+
+ // FIXME: If the stream invalidates on every params or hash change, then
+ // the {{component helper will be forces to rerender the whole component
+ // each time. Instead, these dependencies should not be required and the
+ // element component keyword should add the params and hash as dependencies
+ params.forEach(function (item) {
+ return s.addDependency(item);
+ });
+ Object.keys(hash).forEach(function (key) {
+ return s.addDependency(hash[key]);
+ });
+
+ return s;
}
- exports.default = keywords;
+ function createClosureComponentCell(env, originalComponentPath, params, hash) {
+ var componentPath = _emberMetalStreamsUtils.read(originalComponentPath);
+
+ if (isComponentCell(componentPath)) {
+ return createNestedClosureComponentCell(componentPath, params, hash);
+ } else {
+ return createNewClosureComponentCell(env, componentPath, params, hash);
+ }
+ }
+
+ function isComponentCell(component) {
+ return component && component[COMPONENT_CELL];
+ }
+
+ function createNestedClosureComponentCell(componentCell, params, hash) {
+ var _ref;
+
+ var positionalParams = componentCell[COMPONENT_POSITIONAL_PARAMS];
+
+ // This needs to be done in each nesting level to avoid raising assertions
+ _emberHtmlbarsUtilsExtractPositionalParams.processPositionalParams(null, positionalParams, params, hash);
+
+ return (_ref = {}, _ref[COMPONENT_PATH] = componentCell[COMPONENT_PATH], _ref[COMPONENT_HASH] = mergeHash(componentCell[COMPONENT_HASH], hash), _ref[COMPONENT_POSITIONAL_PARAMS] = positionalParams, _ref[COMPONENT_CELL] = true, _ref);
+ }
+
+ function createNewClosureComponentCell(env, componentPath, params, hash) {
+ var _ref2;
+
+ var positionalParams = getPositionalParams(env.container, componentPath);
+
+ // This needs to be done in each nesting level to avoid raising assertions
+ _emberHtmlbarsUtilsExtractPositionalParams.processPositionalParams(null, positionalParams, params, hash);
+
+ return (_ref2 = {}, _ref2[COMPONENT_PATH] = componentPath, _ref2[COMPONENT_HASH] = hash, _ref2[COMPONENT_POSITIONAL_PARAMS] = positionalParams, _ref2[COMPONENT_CELL] = true, _ref2);
+ }
+
+ /*
+ Returns the positional parameters for component `componentPath`.
+ If it has no positional parameters, it returns the empty array.
+ */
+ function getPositionalParams(container, componentPath) {
+ if (!componentPath) {
+ return [];
+ }
+ var result = _emberHtmlbarsUtilsLookupComponent.default(container, componentPath);
+ var component = result.component;
+
+ if (component && component.positionalParams) {
+ return component.positionalParams;
+ } else {
+ return [];
+ }
+ }
+
+ function mergeHash(original, updates) {
+ return _emberMetalAssign.default(original, updates);
+ }
});
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
@@ -7709,19 +8335,19 @@
rerender: function (morph, env, scope, params, hash, template, inverse, visitor) {
// If the hash is empty, the component cannot have extracted a part
// of a mutable param and used it in its layout, because there are
// no params at all.
if (Object.keys(hash).length) {
- return morph.state.manager.rerender(env, hash, visitor, true);
+ return morph.getState().manager.rerender(env, hash, visitor, true);
}
},
render: function (node, env, scope, params, hash, template, inverse, visitor) {
- var state = node.state;
+ var state = node.getState();
var parentView = state.parentView;
- var options = { component: node.state.viewClassOrInstance, layout: null };
+ var options = { component: state.viewClassOrInstance, layout: null };
if (template) {
options.createOptions = {
_itemViewTemplate: template && { raw: template },
_itemViewInverse: inverse && { raw: inverse }
};
@@ -7752,11 +8378,11 @@
}
return viewClassOrInstance;
}
});
-enifed('ember-htmlbars/keywords/component', ['exports', 'ember-metal/assign'], function (exports, _emberMetalAssign) {
+enifed('ember-htmlbars/keywords/component', ['exports', 'htmlbars-runtime/hooks', 'ember-htmlbars/keywords/closure-component', 'ember-metal/features'], function (exports, _htmlbarsRuntimeHooks, _emberHtmlbarsKeywordsClosureComponent, _emberMetalFeatures) {
/**
@module ember
@submodule ember-templates
@public
*/
@@ -7807,55 +8433,24 @@
@method component
@since 1.11.0
@for Ember.Templates.helpers
@public
*/
- exports.default = {
- setupState: function (lastState, env, scope, params, hash) {
- var componentPath = env.hooks.getValue(params[0]);
- return _emberMetalAssign.default({}, lastState, { componentPath: componentPath, isComponentHelper: true });
- },
- render: function (morph) {
- if (morph.state.manager) {
- morph.state.manager.destroy();
- }
-
- // Force the component hook to treat this as a first-time render,
- // because normal components (`<foo-bar>`) cannot change at runtime,
- // but the `{{component}}` helper can.
- morph.state.manager = null;
-
- for (var _len = arguments.length, rest = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- rest[_key - 1] = arguments[_key];
- }
-
- render.apply(undefined, [morph].concat(rest));
- },
-
- rerender: render
+ exports.default = function (morph, env, scope, params, hash, template, inverse, visitor) {
+ _htmlbarsRuntimeHooks.keyword('@element_component', morph, env, scope, params, hash, template, inverse, visitor);
+ return true;
};
-
- function render(morph, env, scope, params, hash, template, inverse, visitor) {
- var componentPath = morph.state.componentPath;
-
- // If the value passed to the {{component}} helper is undefined or null,
- // don't create a new ComponentNode.
- if (componentPath === undefined || componentPath === null) {
- return;
- }
-
- env.hooks.component(morph, env, scope, componentPath, params, hash, { default: template, inverse: inverse }, visitor);
- }
});
-enifed('ember-htmlbars/keywords/debugger', ['exports', 'ember-metal/logger'], function (exports, _emberMetalLogger) {
+enifed('ember-htmlbars/keywords/debugger', ['exports', 'ember-metal/debug'], function (exports, _emberMetalDebug) {
/*jshint debug:true*/
/**
@module ember
@submodule ember-htmlbars
*/
+
'use strict';
exports.default = debuggerKeyword;
/**
@@ -7902,19 +8497,17 @@
*/
function debuggerKeyword(morph, env, scope) {
/* jshint unused: false, debug: true */
- var view = env.hooks.getValue(scope.locals.view);
- var context = env.hooks.getValue(scope.self);
+ var view = env.hooks.getValue(scope.getLocal('view'));
+ var context = env.hooks.getValue(scope.getSelf());
function get(path) {
return env.hooks.getValue(env.hooks.get(env, scope, path));
}
- _emberMetalLogger.default.info('Use `view`, `context`, and `get(<path>)` to debug this template.');
-
debugger;
return true;
}
});
@@ -7946,11 +8539,84 @@
}
return false;
}
});
-enifed('ember-htmlbars/keywords/get', ['exports', 'ember-metal/core', 'ember-metal/streams/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, _emberMetalStreamsUtils, _emberMetalMerge, _emberHtmlbarsUtilsSubscribe, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalObserver) {
+enifed('ember-htmlbars/keywords/element-component', ['exports', 'ember-metal/assign', 'ember-htmlbars/keywords/closure-component', 'ember-htmlbars/utils/extract-positional-params'], function (exports, _emberMetalAssign, _emberHtmlbarsKeywordsClosureComponent, _emberHtmlbarsUtilsExtractPositionalParams) {
+ 'use strict';
+
+ exports.default = {
+ setupState: function (lastState, env, scope, params, hash) {
+ var componentPath = getComponentPath(params[0], env);
+ return _emberMetalAssign.default({}, lastState, {
+ componentPath: componentPath,
+ isComponentHelper: true
+ });
+ },
+
+ render: function (morph) {
+ var state = morph.getState();
+
+ if (state.manager) {
+ state.manager.destroy();
+ }
+
+ // Force the component hook to treat this as a first-time render,
+ // because normal components (`<foo-bar>`) cannot change at runtime,
+ // but the `{{component}}` helper can.
+ state.manager = null;
+
+ for (var _len = arguments.length, rest = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ rest[_key - 1] = arguments[_key];
+ }
+
+ render.apply(undefined, [morph].concat(rest));
+ },
+
+ rerender: render
+ };
+
+ function getComponentPath(param, env) {
+ var path = env.hooks.getValue(param);
+ if (_emberHtmlbarsKeywordsClosureComponent.isComponentCell(path)) {
+ path = path[_emberHtmlbarsKeywordsClosureComponent.COMPONENT_PATH];
+ }
+ return path;
+ }
+
+ function render(morph, env, scope, _ref, hash, template, inverse, visitor) {
+ var path = _ref[0];
+
+ var params = _ref.slice(1);
+
+ var _morph$getState = morph.getState();
+
+ var componentPath = _morph$getState.componentPath;
+
+ // If the value passed to the {{component}} helper is undefined or null,
+ // don't create a new ComponentNode.
+ if (componentPath === undefined || componentPath === null) {
+ return;
+ }
+
+ path = env.hooks.getValue(path);
+
+ if (_emberHtmlbarsKeywordsClosureComponent.isComponentCell(path)) {
+ var closureComponent = env.hooks.getValue(path);
+ var positionalParams = closureComponent[_emberHtmlbarsKeywordsClosureComponent.COMPONENT_POSITIONAL_PARAMS];
+
+ // This needs to be done in each nesting level to avoid raising assertions
+ _emberHtmlbarsUtilsExtractPositionalParams.processPositionalParams(null, positionalParams, params, hash);
+ params = [];
+ hash = _emberHtmlbarsKeywordsClosureComponent.mergeHash(closureComponent[_emberHtmlbarsKeywordsClosureComponent.COMPONENT_HASH], hash);
+ }
+
+ var templates = { default: template, inverse: inverse };
+ env.hooks.component(morph, env, scope, componentPath, params, hash, templates, visitor);
+ }
+});
+enifed('ember-htmlbars/keywords/get', ['exports', 'ember-metal/debug', 'ember-metal/streams/stream', 'ember-metal/streams/utils', 'ember-htmlbars/utils/subscribe', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/observer'], function (exports, _emberMetalDebug, _emberMetalStreamsStream, _emberMetalStreamsUtils, _emberHtmlbarsUtilsSubscribe, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalObserver) {
/**
@module ember
@submodule ember-templates
*/
@@ -7960,20 +8626,90 @@
var sourceLabel = source.label ? source.label : '';
var keyLabel = key.label ? key.label : '';
return '(get ' + sourceLabel + ' ' + keyLabel + ')';
}
+ var DynamicKeyStream = _emberMetalStreamsStream.default.extend({
+ init: function (source, keySource) {
+ // used to get the original path for debugging purposes
+ var label = labelFor(source, keySource);
+
+ this.label = label;
+ this.path = label;
+ this.sourceDep = this.addMutableDependency(source);
+ this.keyDep = this.addMutableDependency(keySource);
+ this.observedObject = null;
+ this.observedKey = null;
+ },
+
+ key: function () {
+ var key = this.keyDep.getValue();
+ if (typeof key === 'string') {
+ return key;
+ }
+ },
+
+ compute: function () {
+ var object = this.sourceDep.getValue();
+ var key = this.key();
+ if (object && key) {
+ return _emberMetalProperty_get.get(object, key);
+ }
+ },
+
+ setValue: function (value) {
+ var object = this.sourceDep.getValue();
+ var key = this.key();
+ if (object) {
+ _emberMetalProperty_set.set(object, key, value);
+ }
+ },
+
+ _super$revalidate: _emberMetalStreamsStream.default.prototype.revalidate,
+
+ revalidate: function (value) {
+ this._super$revalidate(value);
+
+ var object = this.sourceDep.getValue();
+ var key = this.key();
+ if (object !== this.observedObject || key !== this.observedKey) {
+ this._clearObservedObject();
+
+ if (object && typeof object === 'object' && key) {
+ _emberMetalObserver.addObserver(object, key, this, this.notify);
+ this.observedObject = object;
+ this.observedKey = key;
+ }
+ }
+ },
+
+ _clearObservedObject: function () {
+ if (this.observedObject) {
+ _emberMetalObserver.removeObserver(this.observedObject, this.observedKey, this, this.notify);
+ this.observedObject = null;
+ this.observedKey = null;
+ }
+ }
+ });
+
var buildStream = function buildStream(params) {
var objRef = params[0];
var pathRef = params[1];
-
- var stream = new DynamicKeyStream(objRef, pathRef);
+ var stream = buildDynamicKeyStream(objRef, pathRef);
return stream;
};
+ function buildDynamicKeyStream(source, keySource) {
+ if (!_emberMetalStreamsUtils.isStream(keySource)) {
+ return source.get(keySource);
+ } else {
+ return new DynamicKeyStream(source, keySource);
+ }
+ }
+
/**
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:
@@ -8012,11 +8748,11 @@
@public
@method get
@for Ember.Templates.helpers
*/
- var getKeyword = function getKeyword(morph, env, scope, params, hash, template, inverse, visitor) {
+ function getKeyword(morph, env, scope, params, hash, template, inverse, visitor) {
if (morph === null) {
return buildStream(params);
} else {
var stream = undefined;
if (morph.linkedResult) {
@@ -8031,82 +8767,15 @@
}
env.hooks.range(morph, env, scope, null, stream, visitor);
}
return true;
- };
+ }
- var DynamicKeyStream = function DynamicKeyStream(source, keySource) {
- if (!_emberMetalStreamsUtils.isStream(keySource)) {
- return source.get(keySource);
- }
- var label = labelFor(source, keySource);
-
- this.init(label);
- this.path = label;
- this.sourceDep = this.addMutableDependency(source);
- this.keyDep = this.addMutableDependency(keySource);
- this.observedObject = null;
- this.observedKey = null;
- };
-
- DynamicKeyStream.prototype = Object.create(_emberMetalStreamsStream.default.prototype);
-
- _emberMetalMerge.default(DynamicKeyStream.prototype, {
- key: function () {
- var key = this.keyDep.getValue();
- if (typeof key === 'string') {
- return key;
- }
- },
-
- compute: function () {
- var object = this.sourceDep.getValue();
- var key = this.key();
- if (object && key) {
- return _emberMetalProperty_get.get(object, key);
- }
- },
-
- setValue: function (value) {
- var object = this.sourceDep.getValue();
- var key = this.key();
- if (object) {
- _emberMetalProperty_set.set(object, key, value);
- }
- },
-
- _super$revalidate: _emberMetalStreamsStream.default.prototype.revalidate,
-
- revalidate: function (value) {
- this._super$revalidate(value);
-
- var object = this.sourceDep.getValue();
- var key = this.key();
- if (object !== this.observedObject || key !== this.observedKey) {
- this._clearObservedObject();
-
- if (object && typeof object === 'object' && key) {
- _emberMetalObserver.addObserver(object, key, this, this.notify);
- this.observedObject = object;
- this.observedKey = key;
- }
- }
- },
-
- _clearObservedObject: function () {
- if (this.observedObject) {
- _emberMetalObserver.removeObserver(this.observedObject, this.observedKey, this, this.notify);
- this.observedObject = null;
- this.observedKey = null;
- }
- }
- });
-
exports.default = getKeyword;
});
-enifed('ember-htmlbars/keywords/input', ['exports', 'ember-metal/core', 'ember-metal/assign'], function (exports, _emberMetalCore, _emberMetalAssign) {
+enifed('ember-htmlbars/keywords/input', ['exports', 'ember-metal/debug', 'ember-metal/assign'], function (exports, _emberMetalDebug, _emberMetalAssign) {
/**
@module ember
@submodule ember-templates
*/
'use strict';
@@ -8260,16 +8929,15 @@
exports.default = {
setupState: function (lastState, env, scope, params, hash) {
var type = env.hooks.getValue(hash.type);
var componentName = componentNameMap[type] || defaultComponentName;
-
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);
+ env.hooks.component(morph, env, scope, morph.getState().componentName, params, hash, { default: template, inverse: inverse }, visitor);
},
rerender: function () {
this.render.apply(this, arguments);
}
@@ -8286,45 +8954,76 @@
exports.default = legacyYield;
function legacyYield(morph, env, _scope, params, hash, template, inverse, visitor) {
var scope = _scope;
+ var block = scope.getBlock('default');
- if (scope.blocks.default.arity === 0) {
+ if (block.arity === 0) {
// Typically, the `controller` local is persists through lexical scope.
// However, in this case, the `{{legacy-yield}}` in the legacy each view
// needs to override the controller local for the template it is yielding.
// This megahaxx allows us to override the controller, and most importantly,
// prevents the downstream scope from attempting to bind the `controller` local.
if (hash.controller) {
scope = env.hooks.createChildScope(scope);
- scope.locals.controller = new _emberMetalStreamsProxyStream.default(hash.controller, 'controller');
+ scope.bindLocal('controller', new _emberMetalStreamsProxyStream.default(hash.controller, 'controller'));
scope.overrideController = true;
}
- scope.blocks.default.invoke(env, [], params[0], morph, scope, visitor);
+ block.invoke(env, [], params[0], morph, scope, visitor);
} else {
- scope.blocks.default.invoke(env, params, undefined, morph, scope, visitor);
+ block.invoke(env, params, undefined, morph, scope, visitor);
}
return true;
}
});
-enifed('ember-htmlbars/keywords/mut', ['exports', 'ember-metal/core', 'ember-metal/merge', 'ember-metal/utils', 'ember-metal/streams/proxy-stream', 'ember-metal/streams/utils', 'ember-metal/streams/stream', 'ember-views/compat/attrs-proxy', 'ember-routing-htmlbars/keywords/closure-action'], function (exports, _emberMetalCore, _emberMetalMerge, _emberMetalUtils, _emberMetalStreamsProxyStream, _emberMetalStreamsUtils, _emberMetalStreamsStream, _emberViewsCompatAttrsProxy, _emberRoutingHtmlbarsKeywordsClosureAction) {
+enifed('ember-htmlbars/keywords/mut', ['exports', 'ember-metal/debug', 'ember-metal/utils', 'ember-metal/streams/proxy-stream', 'ember-metal/streams/stream', 'ember-metal/streams/utils', 'ember-views/compat/attrs-proxy', 'ember-routing-htmlbars/keywords/closure-action'], function (exports, _emberMetalDebug, _emberMetalUtils, _emberMetalStreamsProxyStream, _emberMetalStreamsStream, _emberMetalStreamsUtils, _emberViewsCompatAttrsProxy, _emberRoutingHtmlbarsKeywordsClosureAction) {
/**
@module ember
@submodule ember-templates
*/
'use strict';
- var _merge;
+ var _ProxyStream$extend;
exports.default = mut;
exports.privateMut = privateMut;
var MUTABLE_REFERENCE = _emberMetalUtils.symbol('MUTABLE_REFERENCE');
exports.MUTABLE_REFERENCE = MUTABLE_REFERENCE;
+ var MutStream = _emberMetalStreamsProxyStream.default.extend((_ProxyStream$extend = {
+ init: function (stream) {
+ this.label = '(mut ' + stream.label + ')';
+ this.path = stream.path;
+ this.sourceDep = this.addMutableDependency(stream);
+ this[MUTABLE_REFERENCE] = true;
+ },
+
+ cell: function () {
+ var source = this;
+ var value = source.value();
+
+ if (value && value[_emberRoutingHtmlbarsKeywordsClosureAction.ACTION]) {
+ return value;
+ }
+
+ var val = {
+ value: value,
+ update: function (val) {
+ source.setValue(val);
+ }
+ };
+
+ val[_emberViewsCompatAttrsProxy.MUTABLE_CELL] = true;
+ return val;
+ }
+ }, _ProxyStream$extend[_emberRoutingHtmlbarsKeywordsClosureAction.INVOKE] = function (val) {
+ this.setValue(val);
+ }, _ProxyStream$extend));
+
/**
The `mut` helper lets you __clearly specify__ that a child `Component` can update the
(mutable) value passed to it, which will __change the value of the parent component__.
This is very helpful for passing mutable values to a `Component` of any size, but
@@ -8375,75 +9074,50 @@
}
return true;
}
+ var LiteralStream = _emberMetalStreamsStream.default.extend({
+ init: function (literal) {
+ this.literal = literal;
+ this.label = '(literal ' + literal + ')';
+ },
+
+ compute: function () {
+ return this.literal;
+ },
+
+ setValue: function (val) {
+ this.literal = val;
+ this.notify();
+ }
+ });
+
function mutParam(read, stream, internal) {
if (internal) {
if (!_emberMetalStreamsUtils.isStream(stream)) {
- (function () {
- var literal = stream;
- stream = new _emberMetalStreamsStream.default(function () {
- return literal;
- }, '(literal ' + literal + ')');
- stream.setValue = function (newValue) {
- literal = newValue;
- stream.notify();
- };
- })();
+ var literal = stream;
+ stream = new LiteralStream(literal);
}
- } else {
- }
+ } else {}
if (stream[MUTABLE_REFERENCE]) {
return stream;
}
return new MutStream(stream);
}
-
- function MutStream(stream) {
- this.init('(mut ' + stream.label + ')');
- this.path = stream.path;
- this.sourceDep = this.addMutableDependency(stream);
- this[MUTABLE_REFERENCE] = true;
- }
-
- MutStream.prototype = Object.create(_emberMetalStreamsProxyStream.default.prototype);
-
- _emberMetalMerge.default(MutStream.prototype, (_merge = {
- cell: function () {
- var source = this;
- var value = source.value();
-
- if (value && value[_emberRoutingHtmlbarsKeywordsClosureAction.ACTION]) {
- return value;
- }
-
- var val = {
- value: value,
- update: function (val) {
- source.setValue(val);
- }
- };
-
- val[_emberViewsCompatAttrsProxy.MUTABLE_CELL] = true;
- return val;
- }
- }, _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', 'ember-metal/features'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberHtmlbarsNodeManagersViewNodeManager, _emberHtmlbarsTemplatesTopLevelView, _emberMetalFeatures) {
+enifed('ember-htmlbars/keywords/outlet', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-htmlbars/node-managers/view-node-manager', 'ember-htmlbars/templates/top-level-view', 'ember-metal/features'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberHtmlbarsNodeManagersViewNodeManager, _emberHtmlbarsTemplatesTopLevelView, _emberMetalFeatures) {
/**
@module ember
@submodule ember-templates
*/
'use strict';
- _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.1.2';
+ _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.2.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:
@@ -8533,11 +9207,11 @@
isEmpty: function (state) {
return isEmpty(state.outletState);
},
render: function (renderNode, env, scope, params, hash, template, inverse, visitor) {
- var state = renderNode.state;
+ var state = renderNode.getState();
var parentView = env.view;
var outletState = state.outletState;
var toRender = outletState.render;
var namespace = env.container.lookup('application:main');
var LOG_VIEW_LOOKUPS = _emberMetalProperty_get.get(namespace, 'LOG_VIEW_LOOKUPS');
@@ -8566,13 +9240,11 @@
}
};
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 (LOG_VIEW_LOOKUPS && ViewClass) {}
}
if (state.manager) {
state.manager.destroy();
state.manager = null;
@@ -8664,11 +9336,11 @@
setupState: function (state, env, scope, params, hash) {
return { partialName: env.hooks.getValue(params[0]) };
},
render: function (renderNode, env, scope, params, hash, template, inverse, visitor) {
- var state = renderNode.state;
+ var state = renderNode.getState();
if (!state.partialName) {
return true;
}
var found = _emberViewsSystemLookup_partial.default(env, state.partialName);
if (!found) {
@@ -8903,20 +9575,19 @@
function textarea(morph, env, scope, originalParams, hash, template, inverse, visitor) {
env.hooks.component(morph, env, scope, '-text-area', originalParams, hash, { default: template, inverse: inverse }, visitor);
return true;
}
});
-enifed('ember-htmlbars/keywords/unbound', ['exports', 'ember-metal/core', 'ember-metal/merge', 'ember-metal/streams/stream', 'ember-metal/streams/utils'], function (exports, _emberMetalCore, _emberMetalMerge, _emberMetalStreamsStream, _emberMetalStreamsUtils) {
+enifed('ember-htmlbars/keywords/unbound', ['exports', 'ember-metal/debug', 'ember-metal/streams/stream', 'ember-metal/streams/utils'], function (exports, _emberMetalDebug, _emberMetalStreamsStream, _emberMetalStreamsUtils) {
/**
@module ember
@submodule ember-templates
*/
'use strict';
exports.default = unbound;
- // assert
/**
The `{{unbound}}` helper disconnects the one-way binding of a property,
essentially freezing its value at the moment of rendering. For example,
in this example the display of the variable `name` will not change even
@@ -8942,12 +9613,26 @@
@method unbound
@for Ember.Templates.helpers
@public
*/
+ var VolatileStream = _emberMetalStreamsStream.default.extend({
+ init: function (source) {
+ this.label = '(volatile ' + source.label + ')';
+ this.source = source;
+ this.addDependency(source);
+ },
+
+ value: function () {
+ return _emberMetalStreamsUtils.read(this.source);
+ },
+
+ notify: function () {}
+ });
+
function unbound(morph, env, scope, params, hash, template, inverse, visitor) {
-
+
if (morph === null) {
return new VolatileStream(params[0]);
}
var stream = undefined;
@@ -8958,27 +9643,10 @@
morph.linkedResult = stream;
}
env.hooks.range(morph, env, scope, null, stream, visitor);
return true;
}
-
- function VolatileStream(source) {
- this.init('(volatile ' + source.label + ')');
- this.source = source;
-
- this.addDependency(source);
- }
-
- VolatileStream.prototype = Object.create(_emberMetalStreamsStream.default.prototype);
-
- _emberMetalMerge.default(VolatileStream.prototype, {
- value: function () {
- return _emberMetalStreamsUtils.read(this.source);
- },
-
- notify: function () {}
- });
});
enifed('ember-htmlbars/keywords/view', ['exports', 'ember-views/streams/utils', 'ember-views/views/view', 'ember-htmlbars/node-managers/view-node-manager'], function (exports, _emberViewsStreamsUtils, _emberViewsViewsView, _emberHtmlbarsNodeManagersViewNodeManager) {
/**
@module ember
@submodule ember-templates
@@ -9165,19 +9833,19 @@
*/
exports.default = {
setupState: function (state, env, scope, params, hash) {
var read = env.hooks.getValue;
- var targetObject = read(scope.self);
+ var targetObject = read(scope.getSelf());
var viewClassOrInstance = state.viewClassOrInstance;
if (!viewClassOrInstance) {
viewClassOrInstance = getView(read(params[0]), env.container);
}
// if parentView exists, use its controller (the default
// behavior), otherwise use `scope.self` as the controller
- var controller = scope.locals.view ? null : read(scope.self);
+ var controller = scope.hasLocal('view') ? null : read(scope.getSelf());
return {
manager: state.manager,
parentView: env.view,
controller: controller,
@@ -9189,11 +9857,11 @@
rerender: function (morph, env, scope, params, hash, template, inverse, visitor) {
// If the hash is empty, the component cannot have extracted a part
// of a mutable param and used it in its layout, because there are
// no params at all.
if (Object.keys(hash).length) {
- return morph.state.manager.rerender(env, hash, visitor, true);
+ return morph.getState().manager.rerender(env, hash, visitor, true);
}
},
render: function (node, env, scope, params, hash, template, inverse, visitor) {
if (hash.tag) {
@@ -9202,29 +9870,29 @@
if (hash.classNameBindings) {
hash.classNameBindings = hash.classNameBindings.split(' ');
}
- var state = node.state;
+ var state = node.getState();
var parentView = state.parentView;
var options = {
- component: node.state.viewClassOrInstance,
+ component: state.viewClassOrInstance,
layout: null
};
options.createOptions = {};
- if (node.state.controller) {
+ if (state.controller) {
// Use `_controller` to avoid stomping on a CP
// that exists in the target view/component
- options.createOptions._controller = node.state.controller;
+ options.createOptions._controller = state.controller;
}
- if (node.state.targetObject) {
+ if (state.targetObject) {
// Use `_targetObject` to avoid stomping on a CP
// that exists in the target view/component
- options.createOptions._targetObject = node.state.targetObject;
+ options.createOptions._targetObject = state.targetObject;
}
if (state.manager) {
state.manager.destroy();
state.manager = null;
@@ -9265,11 +9933,11 @@
}
return newHash;
}
});
-enifed('ember-htmlbars/keywords/with', ['exports', 'ember-metal/core', 'htmlbars-runtime'], function (exports, _emberMetalCore, _htmlbarsRuntime) {
+enifed('ember-htmlbars/keywords/with', ['exports', 'ember-metal/debug', 'htmlbars-runtime'], function (exports, _emberMetalDebug, _htmlbarsRuntime) {
/**
@module ember
@submodule ember-templates
*/
@@ -9283,48 +9951,95 @@
isEmpty: function (state) {
return false;
},
render: function (morph, env, scope, params, hash, template, inverse, visitor) {
-
-
+
_htmlbarsRuntime.internal.continueBlock(morph, env, scope, 'with', params, hash, template, inverse, visitor);
},
rerender: function (morph, env, scope, params, hash, template, inverse, visitor) {
_htmlbarsRuntime.internal.continueBlock(morph, env, scope, 'with', params, hash, template, inverse, visitor);
}
};
});
-enifed('ember-htmlbars/morphs/attr-morph', ['exports', 'ember-metal/core', 'dom-helper'], function (exports, _emberMetalCore, _domHelper) {
+enifed('ember-htmlbars/keywords/yield', ['exports'], function (exports) {
'use strict';
+ exports.default = yieldKeyword;
+
+ function yieldKeyword(morph, env, scope, params, hash, template, inverse, visitor) {
+ var to = env.hooks.getValue(hash.to) || 'default';
+ var block = scope.getBlock(to);
+
+ if (block) {
+ block.invoke(env, params, hash.self, morph, scope, visitor);
+ }
+
+ return true;
+ }
+});
+enifed('ember-htmlbars/keywords', ['exports', 'htmlbars-runtime'], function (exports, _htmlbarsRuntime) {
+ /**
+ @module ember
+ @submodule ember-htmlbars
+ */
+
+ 'use strict';
+
+ exports.registerKeyword = registerKeyword;
+
+ /**
+ @private
+ @property helpers
+ */
+ var keywords = Object.create(_htmlbarsRuntime.hooks.keywords);
+
+ /**
+ @module ember
+ @submodule ember-htmlbars
+ */
+
+ /**
+ @private
+ @method _registerHelper
+ @for Ember.HTMLBars
+ @param {String} name
+ @param {Object|Function} keyword the keyword to add
+ */
+
+ function registerKeyword(name, keyword) {
+ keywords[name] = keyword;
+ }
+
+ exports.default = keywords;
+});
+enifed('ember-htmlbars/morphs/attr-morph', ['exports', 'ember-metal/debug', 'dom-helper'], function (exports, _emberMetalDebug, _domHelper) {
+ 'use strict';
+
var HTMLBarsAttrMorph = _domHelper.default.prototype.AttrMorphClass;
var styleWarning = '' + 'Binding style attributes may introduce cross-site scripting vulnerabilities; ' + 'please ensure that values being bound are properly escaped. For more information, ' + 'including how to disable this warning, see ' + 'http://emberjs.com/deprecations/v1.x/#toc_binding-style-attributes.';
exports.styleWarning = styleWarning;
- function EmberAttrMorph(element, attrName, domHelper, namespace) {
- HTMLBarsAttrMorph.call(this, element, attrName, domHelper, namespace);
+ var proto = HTMLBarsAttrMorph.prototype;
+ proto.didInit = function () {
this.streamUnsubscribers = null;
- }
+ };
- var proto = EmberAttrMorph.prototype = Object.create(HTMLBarsAttrMorph.prototype);
- proto.HTMLBarsAttrMorph$setContent = HTMLBarsAttrMorph.prototype.setContent;
+ function deprecateEscapedStyle(morph, value) {}
- proto._deprecateEscapedStyle = function EmberAttrMorph_deprecateEscapedStyle(value) {
- };
-
- proto.setContent = function EmberAttrMorph_setContent(value) {
- this._deprecateEscapedStyle(value);
- this.HTMLBarsAttrMorph$setContent(value);
+ proto.willSetContent = function (value) {
+ deprecateEscapedStyle(this, value);
};
- exports.default = EmberAttrMorph;
+ exports.default = HTMLBarsAttrMorph;
});
-enifed('ember-htmlbars/morphs/morph', ['exports', 'dom-helper'], function (exports, _domHelper) {
+
+// SafeString
+enifed('ember-htmlbars/morphs/morph', ['exports', 'dom-helper', 'ember-metal/debug'], function (exports, _domHelper, _emberMetalDebug) {
'use strict';
var HTMLBarsMorph = _domHelper.default.prototype.MorphClass;
var guid = 1;
@@ -9376,19 +10091,20 @@
this.emberToDestroy = null;
}
};
proto.didRender = function (env, scope) {
- env.renderedNodes[this.guid] = true;
+ env.renderedNodes.add(this);
};
exports.default = EmberMorph;
});
-enifed('ember-htmlbars/node-managers/component-node-manager', ['exports', 'ember-metal/core', 'ember-views/system/build-component-template', 'ember-htmlbars/utils/lookup-component', 'ember-htmlbars/hooks/get-cell-or-value', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-views/compat/attrs-proxy', 'ember-htmlbars/system/instrumentation-support', 'ember-views/views/component', 'ember-metal/streams/stream', 'ember-metal/streams/utils', 'ember-metal/utils', 'ember-htmlbars/hooks/get-value'], function (exports, _emberMetalCore, _emberViewsSystemBuildComponentTemplate, _emberHtmlbarsUtilsLookupComponent, _emberHtmlbarsHooksGetCellOrValue, _emberMetalProperty_get, _emberMetalProperty_set, _emberViewsCompatAttrsProxy, _emberHtmlbarsSystemInstrumentationSupport, _emberViewsViewsComponent, _emberMetalStreamsStream, _emberMetalStreamsUtils, _emberMetalUtils, _emberHtmlbarsHooksGetValue) {
+enifed('ember-htmlbars/node-managers/component-node-manager', ['exports', 'ember-metal/debug', 'ember-views/system/build-component-template', 'ember-htmlbars/hooks/get-cell-or-value', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-views/compat/attrs-proxy', 'ember-htmlbars/system/instrumentation-support', 'ember-views/components/component', 'ember-htmlbars/glimmer-component', 'ember-htmlbars/utils/extract-positional-params', 'ember-metal/utils', 'ember-htmlbars/hooks/get-value'], function (exports, _emberMetalDebug, _emberViewsSystemBuildComponentTemplate, _emberHtmlbarsHooksGetCellOrValue, _emberMetalProperty_get, _emberMetalProperty_set, _emberViewsCompatAttrsProxy, _emberHtmlbarsSystemInstrumentationSupport, _emberViewsComponentsComponent, _emberHtmlbarsGlimmerComponent, _emberHtmlbarsUtilsExtractPositionalParams, _emberMetalUtils, _emberHtmlbarsHooksGetValue) {
'use strict';
exports.createComponent = createComponent;
+ exports.takeLegacySnapshot = takeLegacySnapshot;
// These symbols will be used to limit link-to's public API surface area.
var HAS_BLOCK = _emberMetalUtils.symbol('HAS_BLOCK');
exports.HAS_BLOCK = HAS_BLOCK;
@@ -9407,34 +10123,27 @@
this.expectElement = expectElement;
}
exports.default = ComponentNodeManager;
- ComponentNodeManager.create = function (renderNode, env, options) {
+ ComponentNodeManager.create = function ComponentNodeManager_create(renderNode, env, options) {
var _createOptions;
var tagName = options.tagName;
var params = options.params;
var attrs = options.attrs;
var parentView = options.parentView;
var parentScope = options.parentScope;
var isAngleBracket = options.isAngleBracket;
+ var component = options.component;
+ var layout = options.layout;
var templates = options.templates;
attrs = attrs || {};
- // Try to find the Component class and/or template for this component name in
- // the container.
+ component = component || (isAngleBracket ? _emberHtmlbarsGlimmerComponent.default : _emberViewsComponentsComponent.default);
- var _lookupComponent = _emberHtmlbarsUtilsLookupComponent.default(env.container, tagName);
-
- var component = _lookupComponent.component;
- var layout = _lookupComponent.layout;
-
-
- component = component || _emberViewsViewsComponent.default;
-
var createOptions = (_createOptions = {
parentView: parentView
}, _createOptions[HAS_BLOCK] = !!templates.default, _createOptions);
configureTagName(attrs, tagName, component, isAngleBracket, createOptions);
@@ -9444,15 +10153,17 @@
configureCreateOptions(attrs, createOptions);
// If there is a controller on the scope, pluck it off and save it on the
// component. This allows the component to target actions sent via
// `sendAction` correctly.
- if (parentScope.locals.controller) {
- createOptions._controller = _emberHtmlbarsHooksGetValue.default(parentScope.locals.controller);
+ if (parentScope.hasLocal('controller')) {
+ createOptions._controller = _emberHtmlbarsHooksGetValue.default(parentScope.getLocal('controller'));
+ } else {
+ createOptions._targetObject = _emberHtmlbarsHooksGetValue.default(parentScope.getSelf());
}
- extractPositionalParams(renderNode, component, params, attrs);
+ _emberHtmlbarsUtilsExtractPositionalParams.default(renderNode, component, params, attrs);
// Instantiate the component
component = createComponent(component, isAngleBracket, createOptions, renderNode, env, attrs);
// If the component specifies its layout via the `layout` property
@@ -9465,68 +10176,10 @@
var results = _emberViewsSystemBuildComponentTemplate.default({ layout: layout, component: component, isAngleBracket: isAngleBracket }, attrs, { templates: templates, scope: parentScope });
return new ComponentNodeManager(component, isAngleBracket, parentScope, renderNode, attrs, results.block, results.createdElement);
};
- function extractPositionalParams(renderNode, component, params, attrs) {
- var positionalParams = component.positionalParams;
-
- if (positionalParams) {
- processPositionalParams(renderNode, positionalParams, params, attrs);
- }
- }
-
- function processPositionalParams(renderNode, positionalParams, params, attrs) {
- // if the component is rendered via {{component}} helper, the first
- // element of `params` is the name of the component, so we need to
- // skip that when the positional parameters are constructed
- var isNamed = typeof positionalParams === 'string';
-
- if (isNamed) {
- processRestPositionalParameters(renderNode, positionalParams, params, attrs);
- } else {
- processNamedPositionalParameters(renderNode, positionalParams, params, attrs);
- }
- }
-
- function processNamedPositionalParameters(renderNode, positionalParams, params, attrs) {
- var paramsStartIndex = renderNode.state.isComponentHelper ? 1 : 0;
-
- var limit = Math.min(params.length, positionalParams.length);
-
- for (var i = 0; i < limit; i++) {
- var param = params[paramsStartIndex + i];
-
-
- attrs[positionalParams[i]] = param;
- }
- }
-
- function processRestPositionalParameters(renderNode, positionalParamsName, params, attrs) {
- var nameInAttrs = (positionalParamsName in attrs);
-
- // when no params are used, do not override the specified `attrs.stringParamName` value
- if (params.length === 0 && nameInAttrs) {
- return;
- }
-
- // If there is already an attribute for that variable, do nothing
-
- var paramsStartIndex = renderNode.state.isComponentHelper ? 1 : 0;
-
- var paramsStream = new _emberMetalStreamsStream.default(function () {
- return _emberMetalStreamsUtils.readArray(params.slice(paramsStartIndex));
- }, 'params');
-
- attrs[positionalParamsName] = paramsStream;
-
- for (var i = paramsStartIndex; i < params.length; i++) {
- var param = params[i];
- paramsStream.addDependency(param);
- }
- }
-
function configureTagName(attrs, tagName, component, isAngleBracket, createOptions) {
if (isAngleBracket) {
createOptions.tagName = tagName;
} else if (attrs.tagName) {
createOptions.tagName = _emberHtmlbarsHooksGetValue.default(attrs.tagName);
@@ -9546,25 +10199,39 @@
if (attrs.viewName) {
createOptions.viewName = _emberHtmlbarsHooksGetValue.default(attrs.viewName);
}
}
- ComponentNodeManager.prototype.render = function (_env, visitor) {
+ ComponentNodeManager.prototype.render = function ComponentNodeManager_render(_env, visitor) {
var component = this.component;
- return _emberHtmlbarsSystemInstrumentationSupport.instrument(component, function () {
+ return _emberHtmlbarsSystemInstrumentationSupport.instrument(component, function ComponentNodeManager_render_instrument() {
var env = _env.childWithView(component);
env.renderer.componentWillRender(component);
env.renderedViews.push(component.elementId);
if (this.block) {
this.block.invoke(env, [], undefined, this.renderNode, this.scope, visitor);
}
- var element = this.expectElement && this.renderNode.firstNode;
+ var element = undefined;
+ if (this.expectElement || component.isGlimmerComponent) {
+ // This code assumes that Glimmer components are never fragments. When
+ // Glimmer components gain fragment powers, we will need to communicate
+ // whether the layout produced a single top-level node or fragment
+ // somehow (either via static information on the template/component, or
+ // dynamically as the layout is being rendered).
+ element = this.renderNode.firstNode;
+ // Glimmer components may have whitespace or boundary nodes around the
+ // top-level element.
+ if (element && element.nodeType !== 1) {
+ element = nextElementSibling(element);
+ }
+ }
+
// 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);
@@ -9572,19 +10239,34 @@
env.lifecycleHooks.push({ type: 'didInsertElement', view: component });
}
}, this);
};
- ComponentNodeManager.prototype.rerender = function (_env, attrs, visitor) {
+ function nextElementSibling(node) {
+ var current = node;
+
+ while (current) {
+ if (current.nodeType === 1) {
+ return current;
+ }
+ current = node.nextSibling;
+ }
+ }
+
+ ComponentNodeManager.prototype.rerender = function ComponentNodeManager_rerender(_env, attrs, visitor) {
var component = this.component;
- return _emberHtmlbarsSystemInstrumentationSupport.instrument(component, function () {
+ return _emberHtmlbarsSystemInstrumentationSupport.instrument(component, function ComponentNodeManager_rerender_instrument() {
var env = _env.childWithView(component);
var snapshot = takeSnapshot(attrs);
if (component._renderNode.shouldReceiveAttrs) {
+ if (component._propagateAttrsToThis) {
+ component._propagateAttrsToThis(takeLegacySnapshot(attrs));
+ }
+
env.renderer.componentUpdateAttrs(component, snapshot);
component._renderNode.shouldReceiveAttrs = false;
}
// Notify component that it has become dirty and is about to change.
@@ -9601,11 +10283,11 @@
return env;
}, this);
};
- ComponentNodeManager.prototype.destroy = function () {
+ ComponentNodeManager.prototype.destroy = function ComponentNodeManager_destroy() {
var component = this.component;
// Clear component's render node. Normally this gets cleared
// during view destruction, but in this case we're re-assigning the
// node to a different view and it will get cleaned up automatically.
@@ -9615,13 +10297,10 @@
function createComponent(_component, isAngleBracket, props, renderNode, env) {
var attrs = arguments.length <= 5 || arguments[5] === undefined ? {} : arguments[5];
if (!isAngleBracket) {
-
- var snapshot = takeSnapshot(attrs);
- props.attrs = snapshot;
snapshotAndUpdateTarget(attrs, props);
} else {
props.attrs = takeSnapshot(attrs);
@@ -9658,10 +10337,20 @@
}
return hash;
}
+ function takeLegacySnapshot(attrs) {
+ var hash = {};
+
+ for (var prop in attrs) {
+ hash[prop] = _emberHtmlbarsHooksGetValue.default(attrs[prop]);
+ }
+
+ return hash;
+ }
+
function snapshotAndUpdateTarget(rawAttrs, target) {
var attrs = {};
for (var prop in rawAttrs) {
var value = _emberHtmlbarsHooksGetCellOrValue.default(rawAttrs[prop]);
@@ -9670,11 +10359,11 @@
// when `attrs` is an actual value being set in the
// attrs hash (`{{foo-bar attrs="blah"}}`) we cannot
// set `"blah"` to the root of the target because
// that would replace all attrs with `attrs.attrs`
if (prop === 'attrs') {
- continue;
+ continue;
}
if (value && value[_emberViewsCompatAttrsProxy.MUTABLE_CELL]) {
value = value.value;
}
@@ -9687,11 +10376,11 @@
function buildChildEnv(state, env) {
return env.childWithView(this.emberView);
}
});
-enifed('ember-htmlbars/node-managers/view-node-manager', ['exports', 'ember-metal/merge', 'ember-metal/core', 'ember-views/system/build-component-template', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/set_properties', 'ember-views/views/view', 'ember-views/compat/attrs-proxy', 'ember-htmlbars/hooks/get-cell-or-value', 'ember-htmlbars/system/instrumentation-support', 'ember-htmlbars/hooks/get-value'], function (exports, _emberMetalMerge, _emberMetalCore, _emberViewsSystemBuildComponentTemplate, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalSet_properties, _emberViewsViewsView, _emberViewsCompatAttrsProxy, _emberHtmlbarsHooksGetCellOrValue, _emberHtmlbarsSystemInstrumentationSupport, _emberHtmlbarsHooksGetValue) {
+enifed('ember-htmlbars/node-managers/view-node-manager', ['exports', 'ember-metal/assign', 'ember-metal/debug', 'ember-views/system/build-component-template', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/set_properties', 'ember-views/views/view', 'ember-views/compat/attrs-proxy', 'ember-htmlbars/hooks/get-cell-or-value', 'ember-htmlbars/system/instrumentation-support', 'ember-htmlbars/node-managers/component-node-manager', 'ember-htmlbars/hooks/get-value'], function (exports, _emberMetalAssign, _emberMetalDebug, _emberViewsSystemBuildComponentTemplate, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalSet_properties, _emberViewsViewsView, _emberViewsCompatAttrsProxy, _emberHtmlbarsHooksGetCellOrValue, _emberHtmlbarsSystemInstrumentationSupport, _emberHtmlbarsNodeManagersComponentNodeManager, _emberHtmlbarsHooksGetValue) {
'use strict';
exports.createOrUpdateComponent = createOrUpdateComponent;
function ViewNodeManager(component, scope, renderNode, block, expectElement) {
@@ -9702,12 +10391,12 @@
this.expectElement = expectElement;
}
exports.default = ViewNodeManager;
- ViewNodeManager.create = function (renderNode, env, attrs, found, parentView, path, contentScope, contentTemplate) {
-
+ ViewNodeManager.create = function ViewNodeManager_create(renderNode, env, attrs, found, parentView, path, contentScope, contentTemplate) {
+
var component;
var componentInfo = { layout: found.layout };
if (found.component) {
var options = { parentView: parentView };
@@ -9723,12 +10412,15 @@
}
if (attrs && attrs.viewName) {
options.viewName = _emberHtmlbarsHooksGetValue.default(attrs.viewName);
}
- if (found.component.create && contentScope && contentScope.self) {
- options._context = _emberHtmlbarsHooksGetValue.default(contentScope.self);
+ if (found.component.create && contentScope) {
+ var _self = contentScope.getSelf();
+ if (_self) {
+ options._context = _emberHtmlbarsHooksGetValue.default(contentScope.getSelf());
+ }
}
if (found.self) {
options._context = _emberHtmlbarsHooksGetValue.default(found.self);
}
@@ -9743,24 +10435,23 @@
}
renderNode.emberView = component;
}
-
var results = _emberViewsSystemBuildComponentTemplate.default(componentInfo, attrs, {
templates: { default: contentTemplate },
scope: contentScope,
self: found.self
});
return new ViewNodeManager(component, contentScope, renderNode, results.block, results.createdElement);
};
- ViewNodeManager.prototype.render = function (env, attrs, visitor) {
+ ViewNodeManager.prototype.render = function ViewNodeManager_render(env, attrs, visitor) {
var component = this.component;
- return _emberHtmlbarsSystemInstrumentationSupport.instrument(component, function () {
+ return _emberHtmlbarsSystemInstrumentationSupport.instrument(component, function ViewNodeManager_render_instrument() {
var newEnv = env;
if (component) {
newEnv = env.childWithView(component);
}
@@ -9785,24 +10476,28 @@
}
}
}, this);
};
- ViewNodeManager.prototype.rerender = function (env, attrs, visitor) {
+ ViewNodeManager.prototype.rerender = function ViewNodeManager_rerender(env, attrs, visitor) {
var component = this.component;
- return _emberHtmlbarsSystemInstrumentationSupport.instrument(component, function () {
+ return _emberHtmlbarsSystemInstrumentationSupport.instrument(component, function ViewNodeManager_rerender_instrument() {
var newEnv = env;
if (component) {
newEnv = env.childWithView(component);
var snapshot = takeSnapshot(attrs);
// Notify component that it has become dirty and is about to change.
env.renderer.willUpdate(component, snapshot);
if (component._renderNode.shouldReceiveAttrs) {
+ if (component._propagateAttrsToThis) {
+ component._propagateAttrsToThis(_emberHtmlbarsNodeManagersComponentNodeManager.takeLegacySnapshot(attrs));
+ }
+
env.renderer.componentUpdateAttrs(component, snapshot);
component._renderNode.shouldReceiveAttrs = false;
}
env.renderer.willRender(component);
@@ -9815,11 +10510,11 @@
return newEnv;
}, this);
};
- ViewNodeManager.prototype.destroy = function () {
+ ViewNodeManager.prototype.destroy = function ViewNodeManager_destroy() {
if (this.component) {
this.component.destroy();
this.component = null;
}
};
@@ -9834,11 +10529,11 @@
function createOrUpdateComponent(component, options, createOptions, renderNode, env) {
var attrs = arguments.length <= 5 || arguments[5] === undefined ? {} : arguments[5];
var snapshot = takeSnapshot(attrs);
- var props = _emberMetalMerge.default({}, options);
+ var props = _emberMetalAssign.default({}, options);
var defaultController = _emberViewsViewsView.default.proto().controller;
var hasSuppliedController = 'controller' in attrs || 'controller' in props;
if (!props.ownerView && options.parentView) {
props.ownerView = options.parentView.ownerView;
@@ -9847,14 +10542,14 @@
props.attrs = snapshot;
if (component.create) {
var proto = component.proto();
if (createOptions) {
- _emberMetalMerge.default(props, createOptions);
+ _emberMetalAssign.default(props, createOptions);
}
- mergeBindings(props, shadowedAttrs(proto, snapshot));
+ mergeBindings(props, snapshot);
props.container = options.parentView ? options.parentView.container : env.container;
props.renderer = options.parentView ? options.parentView.renderer : props.container && props.container.lookup('renderer:-dom');
props._viewRegistry = options.parentView ? options.parentView._viewRegistry : props.container && props.container.lookup('-view-registry:main');
if (proto.controller !== defaultController || hasSuppliedController) {
@@ -9863,10 +10558,14 @@
component = component.create(props);
} else {
env.renderer.componentUpdateAttrs(component, snapshot);
_emberMetalSet_properties.default(component, props);
+
+ if (component._propagateAttrsToThis) {
+ component._propagateAttrsToThis(_emberHtmlbarsNodeManagersComponentNodeManager.takeLegacySnapshot(attrs));
+ }
}
if (options.parentView) {
options.parentView.appendChild(component);
@@ -9879,27 +10578,10 @@
renderNode.emberView = component;
return component;
}
- function shadowedAttrs(target, attrs) {
- var shadowed = {};
-
- // For backwards compatibility, set the component property
- // if it has an attr with that name. Undefined attributes
- // are handled on demand via the `unknownProperty` hook.
- for (var attr in attrs) {
- if (attr in target) {
- // TODO: Should we issue a deprecation here?
- //Ember.deprecate(deprecation(attr));
- shadowed[attr] = attrs[attr];
- }
- }
-
- return shadowed;
- }
-
function takeSnapshot(attrs) {
var hash = {};
for (var prop in attrs) {
hash[prop] = _emberHtmlbarsHooksGetCellOrValue.default(attrs[prop]);
@@ -9916,11 +10598,11 @@
// when `attrs` is an actual value being set in the
// attrs hash (`{{foo-bar attrs="blah"}}`) we cannot
// set `"blah"` to the root of the target because
// that would replace all attrs with `attrs.attrs`
if (prop === 'attrs') {
- continue;
+ continue;
}
var value = attrs[prop];
if (value && value[_emberViewsCompatAttrsProxy.MUTABLE_CELL]) {
target[prop] = value.value;
@@ -9935,86 +10617,81 @@
// In theory this should come through the env, but it should
// be safe to import this until we make the hook system public
// and it gets actively used in addons or other downstream
// libraries.
-enifed('ember-htmlbars/streams/built-in-helper', ['exports', 'ember-metal/streams/stream', 'ember-metal/merge', 'ember-htmlbars/streams/utils'], function (exports, _emberMetalStreamsStream, _emberMetalMerge, _emberHtmlbarsStreamsUtils) {
+enifed('ember-htmlbars/streams/built-in-helper', ['exports', 'ember-metal/streams/stream', 'ember-htmlbars/streams/utils'], function (exports, _emberMetalStreamsStream, _emberHtmlbarsStreamsUtils) {
'use strict';
- exports.default = BuiltInHelperStream;
+ var BuiltInHelperStream = _emberMetalStreamsStream.default.extend({
+ init: function (helper, params, hash, templates, env, scope, label) {
+ this.helper = helper;
+ this.params = params;
+ this.templates = templates;
+ this.env = env;
+ this.scope = scope;
+ this.hash = hash;
+ this.label = label;
+ },
- function BuiltInHelperStream(helper, params, hash, templates, env, scope, label) {
- this.init(label);
- this.helper = helper;
- this.params = params;
- this.templates = templates;
- this.env = env;
- this.scope = scope;
- this.hash = hash;
- }
-
- BuiltInHelperStream.prototype = Object.create(_emberMetalStreamsStream.default.prototype);
-
- _emberMetalMerge.default(BuiltInHelperStream.prototype, {
compute: function () {
return this.helper(_emberHtmlbarsStreamsUtils.getArrayValues(this.params), _emberHtmlbarsStreamsUtils.getHashValues(this.hash), this.templates, this.env, this.scope);
}
});
+
+ exports.default = BuiltInHelperStream;
});
-enifed('ember-htmlbars/streams/helper-factory', ['exports', 'ember-metal/streams/stream', 'ember-metal/merge', 'ember-htmlbars/streams/utils'], function (exports, _emberMetalStreamsStream, _emberMetalMerge, _emberHtmlbarsStreamsUtils) {
+enifed('ember-htmlbars/streams/helper-factory', ['exports', 'ember-metal/streams/stream', 'ember-htmlbars/streams/utils'], function (exports, _emberMetalStreamsStream, _emberHtmlbarsStreamsUtils) {
'use strict';
- exports.default = HelperFactoryStream;
+ var HelperFactoryStream = _emberMetalStreamsStream.default.extend({
+ init: function (helperFactory, params, hash, label) {
+ this.helperFactory = helperFactory;
+ this.params = params;
+ this.hash = hash;
+ this.linkable = true;
+ this.helper = null;
+ this.label = label;
+ },
- function HelperFactoryStream(helperFactory, params, hash, label) {
- this.init(label);
- this.helperFactory = helperFactory;
- this.params = params;
- this.hash = hash;
- this.linkable = true;
- this.helper = null;
- }
-
- HelperFactoryStream.prototype = Object.create(_emberMetalStreamsStream.default.prototype);
-
- _emberMetalMerge.default(HelperFactoryStream.prototype, {
compute: function () {
if (!this.helper) {
this.helper = this.helperFactory.create({ _stream: this });
}
return this.helper.compute(_emberHtmlbarsStreamsUtils.getArrayValues(this.params), _emberHtmlbarsStreamsUtils.getHashValues(this.hash));
},
+
deactivate: function () {
this.super$deactivate();
if (this.helper) {
this.helper.destroy();
this.helper = null;
}
},
- super$deactivate: HelperFactoryStream.prototype.deactivate
+ super$deactivate: _emberMetalStreamsStream.default.prototype.deactivate
});
+
+ exports.default = HelperFactoryStream;
});
-enifed('ember-htmlbars/streams/helper-instance', ['exports', 'ember-metal/streams/stream', 'ember-metal/merge', 'ember-htmlbars/streams/utils'], function (exports, _emberMetalStreamsStream, _emberMetalMerge, _emberHtmlbarsStreamsUtils) {
+enifed('ember-htmlbars/streams/helper-instance', ['exports', 'ember-metal/streams/stream', 'ember-htmlbars/streams/utils'], function (exports, _emberMetalStreamsStream, _emberHtmlbarsStreamsUtils) {
'use strict';
- exports.default = HelperInstanceStream;
+ var HelperInstanceStream = _emberMetalStreamsStream.default.extend({
+ init: function (helper, params, hash, label) {
+ this.helper = helper;
+ this.params = params;
+ this.hash = hash;
+ this.linkable = true;
+ this.label = label;
+ },
- function HelperInstanceStream(helper, params, hash, label) {
- this.init(label);
- this.helper = helper;
- this.params = params;
- this.hash = hash;
- this.linkable = true;
- }
-
- HelperInstanceStream.prototype = Object.create(_emberMetalStreamsStream.default.prototype);
-
- _emberMetalMerge.default(HelperInstanceStream.prototype, {
compute: function () {
return this.helper.compute(_emberHtmlbarsStreamsUtils.getArrayValues(this.params), _emberHtmlbarsStreamsUtils.getHashValues(this.hash));
}
});
+
+ exports.default = HelperInstanceStream;
});
enifed('ember-htmlbars/streams/utils', ['exports', 'ember-htmlbars/hooks/get-value'], function (exports, _emberHtmlbarsHooksGetValue) {
'use strict';
exports.getArrayValues = getArrayValues;
@@ -10042,11 +10719,11 @@
}
return out;
}
});
-enifed('ember-htmlbars/system/append-templated-view', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-views/views/view'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberViewsViewsView) {
+enifed('ember-htmlbars/system/append-templated-view', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-views/views/view'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberViewsViewsView) {
/**
@module ember
@submodule ember-htmlbars
*/
@@ -10060,11 +10737,10 @@
viewProto = viewClassOrInstance;
} else {
viewProto = viewClassOrInstance.proto();
}
-
// We only want to override the `_context` computed property if there is
// no specified controller. See View#_context for more information.
var noControllerInProto = !viewProto.controller;
if (viewProto.controller && viewProto.controller.isDescriptor) {
@@ -10077,11 +10753,10 @@
props._morph = morph;
return parentView.appendChild(viewClassOrInstance, props);
}
});
-// Ember.assert
enifed('ember-htmlbars/system/bootstrap', ['exports', 'ember-metal/core', 'ember-views/component_lookup', 'ember-views/system/jquery', 'ember-metal/error', 'ember-runtime/system/lazy_load', 'ember-template-compiler/system/compile', 'ember-metal/environment'], function (exports, _emberMetalCore, _emberViewsComponent_lookup, _emberViewsSystemJquery, _emberMetalError, _emberRuntimeSystemLazy_load, _emberTemplateCompilerSystemCompile, _emberMetalEnvironment) {
/*globals Handlebars */
/**
@module ember
@@ -10234,27 +10909,27 @@
} else {
return callback.call(context);
}
}
});
-enifed('ember-htmlbars/system/invoke-helper', ['exports', 'ember-metal/core', 'ember-htmlbars/streams/helper-instance', 'ember-htmlbars/streams/helper-factory', 'ember-htmlbars/streams/built-in-helper'], function (exports, _emberMetalCore, _emberHtmlbarsStreamsHelperInstance, _emberHtmlbarsStreamsHelperFactory, _emberHtmlbarsStreamsBuiltInHelper) {
+enifed('ember-htmlbars/system/invoke-helper', ['exports', 'ember-metal/debug', 'ember-htmlbars/streams/helper-instance', 'ember-htmlbars/streams/helper-factory', 'ember-htmlbars/streams/built-in-helper'], function (exports, _emberMetalDebug, _emberHtmlbarsStreamsHelperInstance, _emberHtmlbarsStreamsHelperFactory, _emberHtmlbarsStreamsBuiltInHelper) {
'use strict';
exports.buildHelperStream = buildHelperStream;
function buildHelperStream(helper, params, hash, templates, env, scope, label) {
- if (helper.isHelperFactory) {
+ if (helper.isHelperFactory) {
return new _emberHtmlbarsStreamsHelperFactory.default(helper, params, hash, label);
} else if (helper.isHelperInstance) {
return new _emberHtmlbarsStreamsHelperInstance.default(helper, params, hash, label);
} else {
templates = templates || { template: {}, inverse: {} };
return new _emberHtmlbarsStreamsBuiltInHelper.default(helper, params, hash, templates, env, scope, label);
}
}
});
-enifed('ember-htmlbars/system/lookup-helper', ['exports', 'ember-metal/core', 'ember-metal/cache'], function (exports, _emberMetalCore, _emberMetalCache) {
+enifed('ember-htmlbars/system/lookup-helper', ['exports', 'ember-metal/debug', 'ember-metal/cache'], function (exports, _emberMetalDebug, _emberMetalCache) {
/**
@module ember
@submodule ember-htmlbars
*/
@@ -10295,25 +10970,24 @@
var container = env.container;
if (validateLazyHelperName(name, container, env.hooks.keywords)) {
var helperName = 'helper:' + name;
if (container.registry.has(helperName)) {
helper = container.lookupFactory(helperName);
- }
+ }
}
}
return helper;
}
function lookupHelper(name, view, env) {
var helper = findHelper(name, view, env);
-
return helper;
}
});
-enifed('ember-htmlbars/system/make_bound_helper', ['exports', 'ember-metal/core', 'ember-htmlbars/helper'], function (exports, _emberMetalCore, _emberHtmlbarsHelper) {
+enifed('ember-htmlbars/system/make_bound_helper', ['exports', 'ember-metal/debug', 'ember-htmlbars/helper'], function (exports, _emberMetalDebug, _emberHtmlbarsHelper) {
/**
@module ember
@submodule ember-htmlbars
*/
'use strict';
@@ -10363,22 +11037,22 @@
@param {Function} fn
@since 1.10.0
*/
function makeBoundHelper(fn) {
- return _emberHtmlbarsHelper.helper(fn);
+ return _emberHtmlbarsHelper.helper(fn);
}
});
-enifed('ember-htmlbars/system/render-env', ['exports', 'ember-htmlbars/env'], function (exports, _emberHtmlbarsEnv) {
+enifed('ember-htmlbars/system/render-env', ['exports', 'ember-htmlbars/env', 'ember-metal-views/renderer'], function (exports, _emberHtmlbarsEnv, _emberMetalViewsRenderer) {
'use strict';
exports.default = RenderEnv;
function RenderEnv(options) {
this.lifecycleHooks = options.lifecycleHooks || [];
this.renderedViews = options.renderedViews || [];
- this.renderedNodes = options.renderedNodes || {};
+ this.renderedNodes = options.renderedNodes || new _emberMetalViewsRenderer.MorphSet();
this.hasParentOutlet = options.hasParentOutlet || false;
this.view = options.view;
this.outletState = options.outletState;
this.container = options.container;
@@ -11300,10 +11974,59 @@
}
return key;
}
});
+enifed('ember-htmlbars/utils/extract-positional-params', ['exports', 'ember-metal/debug', 'ember-metal/streams/stream', 'ember-metal/streams/utils'], function (exports, _emberMetalDebug, _emberMetalStreamsStream, _emberMetalStreamsUtils) {
+ 'use strict';
+
+ exports.default = extractPositionalParams;
+ exports.processPositionalParams = processPositionalParams;
+
+ function extractPositionalParams(renderNode, component, params, attrs) {
+ var positionalParams = component.positionalParams;
+
+ if (positionalParams) {
+ processPositionalParams(renderNode, positionalParams, params, attrs);
+ }
+ }
+
+ function processPositionalParams(renderNode, positionalParams, params, attrs) {
+ var isNamed = typeof positionalParams === 'string';
+
+ if (isNamed) {
+ processRestPositionalParameters(renderNode, positionalParams, params, attrs);
+ } else {
+ processNamedPositionalParameters(renderNode, positionalParams, params, attrs);
+ }
+ }
+
+ function processNamedPositionalParameters(renderNode, positionalParams, params, attrs) {
+ var limit = Math.min(params.length, positionalParams.length);
+
+ for (var i = 0; i < limit; i++) {
+ var param = params[i];
+
+ attrs[positionalParams[i]] = param;
+ }
+ }
+
+ function processRestPositionalParameters(renderNode, positionalParamsName, params, attrs) {
+
+ var paramsStream = new _emberMetalStreamsStream.Stream(function () {
+ return _emberMetalStreamsUtils.readArray(params.slice(0));
+ }, 'params');
+
+ // If there is already an attribute for that variable, do nothing
+ attrs[positionalParamsName] = paramsStream;
+
+ for (var i = 0; i < params.length; i++) {
+ var param = params[i];
+ paramsStream.addDependency(param);
+ }
+ }
+});
enifed('ember-htmlbars/utils/is-component', ['exports', 'ember-htmlbars/system/lookup-helper'], function (exports, _emberHtmlbarsSystemLookupHelper) {
/**
@module ember
@submodule ember-htmlbars
*/
@@ -11340,10 +12063,23 @@
component: componentLookup.componentFor(tagName, container),
layout: componentLookup.layoutFor(tagName, container)
};
}
});
+enifed('ember-htmlbars/utils/new-stream', ['exports', 'ember-metal/streams/proxy-stream', 'ember-htmlbars/utils/subscribe'], function (exports, _emberMetalStreamsProxyStream, _emberHtmlbarsUtilsSubscribe) {
+ 'use strict';
+
+ exports.default = newStream;
+
+ function newStream(scope, key, newValue, renderNode, isSelf) {
+ var stream = new _emberMetalStreamsProxyStream.default(newValue, isSelf ? '' : key);
+ if (renderNode) {
+ _emberHtmlbarsUtilsSubscribe.default(renderNode, scope, stream);
+ }
+ scope[key] = stream;
+ }
+});
enifed("ember-htmlbars/utils/normalize-self", ["exports"], function (exports) {
"use strict";
exports.default = normalizeSelf;
@@ -11378,12 +12114,14 @@
@return {Handlebars.SafeString} a string that will not be html escaped by Handlebars
@public
*/
function htmlSafe(str) {
if (str === null || str === undefined) {
- str = '';
- } else if (typeof str !== 'string') {
+ return '';
+ }
+
+ if (typeof str !== 'string') {
str = '' + str;
}
return new _htmlbarsUtil.SafeString(str);
}
@@ -11405,11 +12143,11 @@
function subscribe(node, env, scope, stream) {
if (!_emberMetalStreamsUtils.isStream(stream)) {
return;
}
- var component = scope.component;
+ var component = scope.getComponent();
var unsubscribers = node.streamUnsubscribers = node.streamUnsubscribers || [];
unsubscribers.push(stream.subscribe(function () {
node.isDirty = true;
@@ -11420,11 +12158,11 @@
// "re-render" has occured.
if (component && component._renderNode) {
component._renderNode.isDirty = true;
}
- if (node.state.manager) {
+ if (node.getState().manager) {
node.shouldReceiveAttrs = true;
}
node.ownerNode.emberView.scheduleRevalidate(node, _emberMetalStreamsUtils.labelFor(stream));
}));
@@ -11447,489 +12185,145 @@
}
scope[key] = stream;
}
}
});
-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/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(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');
- }
- view.ownerView = renderNode.emberView = view;
- view._renderNode = renderNode;
-
- var layout = _emberMetalProperty_get.get(view, 'layout');
- var template = _emberMetalProperty_get.get(view, 'template');
-
- var componentInfo = { component: view, layout: layout };
-
- var block = _emberViewsSystemBuildComponentTemplate.default(componentInfo, {}, {
- self: view,
- templates: template ? { default: template.raw } : undefined
- }).block;
-
- view.renderBlock(block, renderNode);
- view.lastResult = renderNode.lastResult;
- this.clearRenderedViews(view.env);
- };
-
- Renderer.prototype.renderTopLevelView = function Renderer_renderTopLevelView(view, renderNode) {
- // Check to see if insertion has been canceled
- if (view._willInsert) {
- view._willInsert = false;
- this.prerenderTopLevelView(view, renderNode);
- this.dispatchLifecycleHooks(view.env);
- }
- };
-
- Renderer.prototype.revalidateTopLevelView = function Renderer_revalidateTopLevelView(view) {
- // This guard prevents revalidation on an already-destroyed view.
- if (view._renderNode.lastResult) {
- view._renderNode.lastResult.revalidate(view.env);
- // supports createElement, which operates without moving the view into
- // the inDOM state.
- if (view._state === 'inDOM') {
- this.dispatchLifecycleHooks(view.env);
- }
- this.clearRenderedViews(view.env);
- }
- };
-
- Renderer.prototype.dispatchLifecycleHooks = function Renderer_dispatchLifecycleHooks(env) {
- var ownerView = env.view;
-
- var lifecycleHooks = env.lifecycleHooks;
- var i, hook;
-
- for (i = 0; i < lifecycleHooks.length; i++) {
- hook = lifecycleHooks[i];
- ownerView._dispatching = hook.type;
-
- switch (hook.type) {
- case 'didInsertElement':
- this.didInsertElement(hook.view);break;
- case 'didUpdate':
- this.didUpdate(hook.view);break;
- }
-
- this.didRender(hook.view);
- }
-
- ownerView._dispatching = null;
- env.lifecycleHooks.length = 0;
- };
-
- Renderer.prototype.ensureViewNotRendering = function Renderer_ensureViewNotRendering(view) {
- var env = view.ownerView.env;
- if (env && env.renderedViews.indexOf(view.elementId) !== -1) {
- throw new Error('Something you did caused a view to re-render after it rendered but before it was inserted into the DOM.');
- }
- };
-
- Renderer.prototype.clearRenderedViews = function Renderer_clearRenderedViews(env) {
- env.renderedNodes = {};
- env.renderedViews.length = 0;
- };
-
- // This entry point is called from top-level `view.appendTo`
- Renderer.prototype.appendTo = function Renderer_appendTo(view, target) {
- var morph = this._dom.appendMorph(target);
- morph.ownerNode = morph;
- view._willInsert = true;
- _emberMetalRun_loop.default.schedule('render', this, this.renderTopLevelView, view, morph);
- };
-
- Renderer.prototype.replaceIn = function Renderer_replaceIn(view, target) {
- var morph = this._dom.replaceContentWithMorph(target);
- morph.ownerNode = morph;
- view._willInsert = true;
- _emberMetalRun_loop.default.scheduleOnce('render', this, this.renderTopLevelView, view, morph);
- };
-
- Renderer.prototype.createElement = function Renderer_createElement(view) {
- var morph = this._dom.createFragmentMorph();
- morph.ownerNode = morph;
- this.prerenderTopLevelView(view, morph);
- };
-
- Renderer.prototype.didCreateElement = function (view, element) {
- if (element) {
- view.element = element;
- }
-
- if (view._transitionTo) {
- view._transitionTo('hasElement');
- }
- }; // hasElement
-
- Renderer.prototype.willInsertElement = function (view) {
- if (view.trigger) {
- view.trigger('willInsertElement');
- }
- }; // will place into DOM
-
- 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) {
- if (view._transitionTo) {
- view._transitionTo('inDOM');
- }
-
- if (view.trigger) {
- view.trigger('didInsertElement');
- }
- }; // inDOM // placed into DOM
-
- Renderer.prototype.didUpdate = function (view) {
- if (view.trigger) {
- view.trigger('didUpdate');
- }
- };
-
- Renderer.prototype.didRender = function (view) {
- if (view.trigger) {
- view.trigger('didRender');
- }
- };
-
- Renderer.prototype.updateAttrs = function (view, attrs) {
- this.setAttrs(view, attrs);
- }; // setting new attrs
-
- Renderer.prototype.componentUpdateAttrs = function (component, newAttrs) {
- var oldAttrs = null;
-
- if (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) {
- if (view._willUpdate) {
- view._willUpdate(attrs);
- }
- };
-
- Renderer.prototype.componentWillUpdate = function (component) {
- component.trigger('willUpdate');
- };
-
- Renderer.prototype.willRender = function (view) {
- if (view._willRender) {
- view._willRender();
- }
- };
-
- Renderer.prototype.componentWillRender = function (component) {
- component.trigger('willRender');
- };
-
- Renderer.prototype.remove = function (view, shouldDestroy) {
- this.willDestroyElement(view);
-
- view._willRemoveElement = true;
- _emberMetalRun_loop.default.schedule('render', this, this.renderElementRemoval, view);
- };
-
- Renderer.prototype.renderElementRemoval = function Renderer_renderElementRemoval(view) {
- // Use the _willRemoveElement flag to avoid mulitple removal attempts in
- // case many have been scheduled. This should be more performant than using
- // `scheduleOnce`.
- if (view._willRemoveElement) {
- view._willRemoveElement = false;
-
- if (view._renderNode && view.element && view.element.parentNode) {
- view._renderNode.clear();
- }
- this.didDestroyElement(view);
- }
- };
-
- Renderer.prototype.willRemoveElement = function () /*view*/{};
-
- Renderer.prototype.willDestroyElement = function (view) {
- if (view._willDestroyElement) {
- view._willDestroyElement();
- }
- if (view.trigger) {
- view.trigger('willDestroyElement');
- view.trigger('willClearRender');
- }
-
- if (view._transitionTo) {
- view._transitionTo('destroying');
- }
- };
-
- Renderer.prototype.didDestroyElement = function (view) {
- view.element = null;
-
- // Views that are being destroyed should never go back to the preRender state.
- // However if we're just destroying an element on a view (as is the case when
- // using View#remove) then the view should go to a preRender state so that
- // it can be rendered again later.
- if (view._state !== 'destroying' && view._transitionTo) {
- view._transitionTo('preRender');
- }
-
- if (view.trigger) {
- view.trigger('didDestroyElement');
- }
- }; // 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/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) {
+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/helpers/hash', 'ember-htmlbars/system/dom-helper', 'ember-htmlbars/helper', 'ember-htmlbars/glimmer-component', '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, _emberHtmlbarsHelpersHash, _emberHtmlbarsSystemDomHelper, _emberHtmlbarsHelper, _emberHtmlbarsGlimmerComponent, _emberHtmlbarsSystemBootstrap, _emberHtmlbarsCompat) {
/**
- @module ember
- @submodule ember-metal
- */
-
- // BEGIN IMPORTS
- 'use strict';
-
- _emberMetalComputed.computed.empty = _emberMetalComputed_macros.empty;
- _emberMetalComputed.computed.notEmpty = _emberMetalComputed_macros.notEmpty;
- _emberMetalComputed.computed.none = _emberMetalComputed_macros.none;
- _emberMetalComputed.computed.not = _emberMetalComputed_macros.not;
- _emberMetalComputed.computed.bool = _emberMetalComputed_macros.bool;
- _emberMetalComputed.computed.match = _emberMetalComputed_macros.match;
- _emberMetalComputed.computed.equal = _emberMetalComputed_macros.equal;
- _emberMetalComputed.computed.gt = _emberMetalComputed_macros.gt;
- _emberMetalComputed.computed.gte = _emberMetalComputed_macros.gte;
- _emberMetalComputed.computed.lt = _emberMetalComputed_macros.lt;
- _emberMetalComputed.computed.lte = _emberMetalComputed_macros.lte;
- _emberMetalComputed.computed.alias = _emberMetalAlias.default;
- _emberMetalComputed.computed.oneWay = _emberMetalComputed_macros.oneWay;
- _emberMetalComputed.computed.reads = _emberMetalComputed_macros.oneWay;
- _emberMetalComputed.computed.readOnly = _emberMetalComputed_macros.readOnly;
- _emberMetalComputed.computed.defaultTo = _emberMetalComputed_macros.defaultTo;
- _emberMetalComputed.computed.deprecatingAlias = _emberMetalComputed_macros.deprecatingAlias;
- _emberMetalComputed.computed.and = _emberMetalComputed_macros.and;
- _emberMetalComputed.computed.or = _emberMetalComputed_macros.or;
- _emberMetalComputed.computed.any = _emberMetalComputed_macros.any;
- _emberMetalComputed.computed.collect = _emberMetalComputed_macros.collect;
-
- // END IMPORTS
-
- // BEGIN EXPORTS
- var EmberInstrumentation = _emberMetalCore.default.Instrumentation = {};
- EmberInstrumentation.instrument = _emberMetalInstrumentation.instrument;
- EmberInstrumentation.subscribe = _emberMetalInstrumentation.subscribe;
- EmberInstrumentation.unsubscribe = _emberMetalInstrumentation.unsubscribe;
- EmberInstrumentation.reset = _emberMetalInstrumentation.reset;
-
- _emberMetalCore.default.instrument = _emberMetalInstrumentation.instrument;
- _emberMetalCore.default.subscribe = _emberMetalInstrumentation.subscribe;
-
- _emberMetalCore.default._Cache = _emberMetalCache.default;
-
- _emberMetalCore.default.generateGuid = _emberMetalUtils.generateGuid;
- _emberMetalCore.default.GUID_KEY = _emberMetalUtils.GUID_KEY;
- _emberMetalCore.default.platform = {
- defineProperty: true,
- hasPropertyAccessors: true
- };
-
- _emberMetalCore.default.Error = _emberMetalError.default;
- _emberMetalCore.default.guidFor = _emberMetalUtils.guidFor;
- _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;
- _emberMetalCore.default.wrap = _emberMetalUtils.wrap;
- _emberMetalCore.default.apply = _emberMetalUtils.apply;
- _emberMetalCore.default.applyStr = _emberMetalUtils.applyStr;
- _emberMetalCore.default.uuid = _emberMetalUtils.uuid;
-
- _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;
- _emberMetalCore.default._suspendListener = _emberMetalEvents.suspendListener;
- _emberMetalCore.default._suspendListeners = _emberMetalEvents.suspendListeners;
- _emberMetalCore.default.sendEvent = _emberMetalEvents.sendEvent;
- _emberMetalCore.default.hasListeners = _emberMetalEvents.hasListeners;
- _emberMetalCore.default.watchedEvents = _emberMetalEvents.watchedEvents;
- _emberMetalCore.default.listenersFor = _emberMetalEvents.listenersFor;
- _emberMetalCore.default.accumulateListeners = _emberMetalEvents.accumulateListeners;
-
- _emberMetalCore.default._ObserverSet = _emberMetalObserver_set.default;
-
- _emberMetalCore.default.propertyWillChange = _emberMetalProperty_events.propertyWillChange;
- _emberMetalCore.default.propertyDidChange = _emberMetalProperty_events.propertyDidChange;
- _emberMetalCore.default.overrideChains = _emberMetalProperty_events.overrideChains;
- _emberMetalCore.default.beginPropertyChanges = _emberMetalProperty_events.beginPropertyChanges;
- _emberMetalCore.default.endPropertyChanges = _emberMetalProperty_events.endPropertyChanges;
- _emberMetalCore.default.changeProperties = _emberMetalProperty_events.changeProperties;
-
- _emberMetalCore.default.defineProperty = _emberMetalProperties.defineProperty;
-
- _emberMetalCore.default.set = _emberMetalProperty_set.set;
- _emberMetalCore.default.trySet = _emberMetalProperty_set.trySet;
-
- _emberMetalCore.default.OrderedSet = _emberMetalMap.OrderedSet;
- _emberMetalCore.default.Map = _emberMetalMap.Map;
- _emberMetalCore.default.MapWithDefault = _emberMetalMap.MapWithDefault;
-
- _emberMetalCore.default.getProperties = _emberMetalGet_properties.default;
- _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;
- _emberMetalCore.default.unwatchPath = _emberMetalWatch_path.unwatchPath;
-
- _emberMetalCore.default.watch = _emberMetalWatching.watch;
- _emberMetalCore.default.isWatching = _emberMetalWatching.isWatching;
- _emberMetalCore.default.unwatch = _emberMetalWatching.unwatch;
- _emberMetalCore.default.rewatch = _emberMetalWatching.rewatch;
- _emberMetalCore.default.destroy = _emberMetalWatching.destroy;
-
- _emberMetalCore.default.expandProperties = _emberMetalExpand_properties.default;
-
- _emberMetalCore.default.ComputedProperty = _emberMetalComputed.ComputedProperty;
- _emberMetalCore.default.computed = _emberMetalComputed.computed;
- _emberMetalCore.default.cacheFor = _emberMetalComputed.cacheFor;
-
- _emberMetalCore.default.addObserver = _emberMetalObserver.addObserver;
- _emberMetalCore.default.observersFor = _emberMetalObserver.observersFor;
- _emberMetalCore.default.removeObserver = _emberMetalObserver.removeObserver;
- _emberMetalCore.default._suspendObserver = _emberMetalObserver._suspendObserver;
- _emberMetalCore.default._suspendObservers = _emberMetalObserver._suspendObservers;
-
- _emberMetalCore.default.IS_BINDING = _emberMetalMixin.IS_BINDING;
- _emberMetalCore.default.required = _emberMetalMixin.required;
- _emberMetalCore.default.aliasMethod = _emberMetalMixin.aliasMethod;
- _emberMetalCore.default.observer = _emberMetalMixin.observer;
- _emberMetalCore.default.immediateObserver = _emberMetalMixin._immediateObserver;
- _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.run = _emberMetalRun_loop.default;
-
- /**
- @class Backburner
- @for Ember
- @private
- */
- _emberMetalCore.default.Backburner = _backburner.default;
- // this is the new go forward, once Ember Data updates to using `_Backburner` we
- // can remove the non-underscored version.
- _emberMetalCore.default._Backburner = _backburner.default;
-
- _emberMetalCore.default.libraries = new _emberMetalLibraries.default();
- _emberMetalCore.default.libraries.registerCoreLibrary('Ember', _emberMetalCore.default.VERSION);
-
- _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.merge = _emberMetalMerge.default;
-
- _emberMetalCore.default.FEATURES = _emberMetalFeatures.FEATURES;
- _emberMetalCore.default.FEATURES.isEnabled = _emberMetalFeatures.default;
-
- /**
- A function may be assigned to `Ember.onerror` to be called when Ember
- internals encounter an error. This is useful for specialized error handling
- and reporting code.
+ 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
+
+ Templates manage the flow of an application's UI, and display state (through
+ the DOM) to a user. For example, given a component with the property "name",
+ that component's template can use the name in several ways:
+
```javascript
- Ember.onerror = function(error) {
- Em.$.ajax('/report-error', 'POST', {
- stack: error.stack,
- otherInformation: 'whatever app state you want to provide'
- });
- };
+ // app/components/person.js
+ export default Ember.Component.extend({
+ name: 'Jill'
+ });
```
- Internally, `Ember.onerror` is used as Backburner's error handler.
+ ```handlebars
+ {{! app/components/person.hbs }}
+ {{name}}
+ <div>{{name}}</div>
+ <span data-name={{name}}></span>
+ ```
- @event onerror
- @for Ember
- @param {Exception} error the error object
+ Any time the "name" property on the component changes, the DOM will be
+ updated.
+
+ Properties can be chained as well:
+
+ ```handlebars
+ {{aUserModel.name}}
+ <div>{{listOfUsers.firstObject.name}}</div>
+ ```
+
+ ### Using Ember helpers
+
+ When content is passed in mustaches `{{}}`, Ember will first try to find a helper
+ or component with that name. For example, the `if` helper:
+
+ ```handlebars
+ {{if name "I have a name" "I have no name"}}
+ <span data-has-name={{if name true}}></span>
+ ```
+
+ The returned value is placed where the `{{}}` is called. The above style is
+ called "inline". A second style of helper usage is called "block". For example:
+
+ ```handlebars
+ {{#if name}}
+ I have a name
+ {{else}}
+ I have no name
+ {{/if}}
+ ```
+
+ The block form of helpers allows you to control how the UI is created based
+ on the values of properties.
+
+ A third form of helper is called "nested". For example here the concat
+ helper will add " Doe" to a displayed name if the person has no last name:
+
+ ```handlebars
+ <span data-name={{concat firstName (
+ if lastName (concat " " lastName) "Doe"
+ )}}></span>
+ ```
+
+ Ember's built-in helpers are described under the [Ember.Templates.helpers](/api/classes/Ember.Templates.helpers.html)
+ namespace. Documentation on creating custom helpers can be found under
+ [Ember.Helper](/api/classes/Ember.Helper.html).
+
+ ### Invoking a Component
+
+ Ember components represent state to the UI of an application. Further
+ reading on components can be found under [Ember.Component](/api/classes/Ember.Component.html).
+
+ @module ember
+ @submodule ember-templates
+ @main ember-templates
@public
*/
- _emberMetalCore.default.onerror = null;
- // END EXPORTS
- // 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 = {};
+ /**
+
+ [HTMLBars](https://github.com/tildeio/htmlbars) is a [Handlebars](http://handlebarsjs.com/)
+ compatible templating engine used by Ember.js. The classes and namespaces
+ covered by this documentation attempt to focus on APIs for interacting
+ with HTMLBars itself. For more general guidance on Ember.js templates and
+ helpers, please see the [ember-templates](/api/modules/ember-templates.html)
+ package.
+
+ @module ember
+ @submodule ember-htmlbars
+ @main ember-htmlbars
+ @public
+ */
+ 'use strict';
- _emberMetalCore.default.Debug.registerDeprecationHandler = function () {};
- _emberMetalCore.default.Debug.registerWarnHandler = function () {};
+ _emberHtmlbarsHelpers.registerHelper('if', _emberHtmlbarsHelpersIf_unless.ifHelper);
+ _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);
+
+ if (_emberMetalCore.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
+ _emberHtmlbarsHelpers.registerHelper('-legacy-each-with-controller', _emberHtmlbarsHelpersLegacyEachWithController.default);
+ _emberHtmlbarsHelpers.registerHelper('-legacy-each-with-keyword', _emberHtmlbarsHelpersLegacyEachWithKeyword.default);
}
- _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);
+ _emberMetalCore.default.HTMLBars = {
+ template: _emberTemplateCompiler.template,
+ compile: _emberTemplateCompiler.compile,
+ precompile: _emberTemplateCompiler.precompile,
+ makeBoundHelper: _emberHtmlbarsSystemMake_bound_helper.default,
+ registerPlugin: _emberTemplateCompiler.registerPlugin,
+ DOMHelper: _emberHtmlbarsSystemDomHelper.default
+ };
- exports.default = _emberMetalCore.default;
+ _emberHtmlbarsHelper.default.helper = _emberHtmlbarsHelper.helper;
+ _emberMetalCore.default.Helper = _emberHtmlbarsHelper.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/meta', 'ember-metal/dependent_keys'], function (exports, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalCore, _emberMetalError, _emberMetalProperties, _emberMetalComputed, _emberMetalUtils, _emberMetalMeta, _emberMetalDependent_keys) {
+
+// importing adds template bootstrapping
+// initializer to enable embedded templates
+
+// importing ember-htmlbars/compat updates the
+// Ember.Handlebars global if htmlbars is enabled
+enifed('ember-metal/alias', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/error', 'ember-metal/properties', 'ember-metal/computed', 'ember-metal/utils', 'ember-metal/meta', 'ember-metal/dependent_keys'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalError, _emberMetalProperties, _emberMetalComputed, _emberMetalUtils, _emberMetalMeta, _emberMetalDependent_keys) {
'use strict';
exports.default = alias;
exports.AliasedProperty = AliasedProperty;
@@ -11960,11 +12354,11 @@
AliasedProperty.prototype.didUnwatch = function (obj, keyName) {
_emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, _emberMetalMeta.meta(obj));
};
AliasedProperty.prototype.setup = function (obj, keyName) {
- var m = _emberMetalMeta.meta(obj);
+ var m = _emberMetalMeta.meta(obj);
if (m.peekWatching(keyName)) {
_emberMetalDependent_keys.addDependentKeys(this, obj, keyName, m);
}
};
@@ -11996,67 +12390,28 @@
// 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) {
+ /**
+ Copy properties from a source object to a target object.
+
+ ```javascript
+ var a = {first: 'Yehuda'};
+ var b = {last: 'Katz'};
+ var c = {company: 'Tilde Inc.'};
+ Ember.assign(a, b, c); // a === {first: 'Yehuda', last: 'Katz', company: 'Tilde Inc.'}, b === {last: 'Katz'}, c === {company: 'Tilde Inc.'}
+ ```
+
+ @method assign
+ @for Ember
+ @param {Object} original The object to assign into
+ @param {Object} ...args The objects to copy properties from
+ @return {Object}
+ @public
+ */
"use strict";
exports.default = assign;
function assign(original) {
@@ -12079,11 +12434,11 @@
}
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) {
+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) {
'use strict';
exports.bind = bind;
// ES6TODO: where is Ember.lookup defined?
@@ -12231,11 +12586,11 @@
@param {Object} obj The root object for this binding.
@return {Ember.Binding} `this`
@public
*/
connect: function (obj) {
-
+
var fromPath = this._from;
var toPath = this._to;
_emberMetalProperty_set.trySet(obj, toPath, getWithGlobals(obj, fromPath));
// add an observer on the object to be notified when the binding should be updated
@@ -12258,11 +12613,11 @@
@param {Object} obj The root object you passed when connecting the binding.
@return {Ember.Binding} `this`
@public
*/
disconnect: function (obj) {
-
+
var twoWay = !this._oneWay;
// 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);
@@ -12325,11 +12680,11 @@
// if we're synchronizing from the remote object...
if (direction === 'fwd') {
var fromValue = getWithGlobals(obj, this._from);
if (log) {
- _emberMetalCore.default.Logger.log(' ', this.toString(), '->', fromValue, obj);
+ _emberMetalLogger.default.log(' ', this.toString(), '->', fromValue, obj);
}
if (this._oneWay) {
_emberMetalProperty_set.trySet(obj, toPath, fromValue);
} else {
_emberMetalObserver._suspendObserver(obj, toPath, this, this.toDidChange, function () {
@@ -12338,11 +12693,11 @@
}
// if we're synchronizing *to* the remote object
} else if (direction === 'back') {
var toValue = _emberMetalProperty_get.get(obj, this._to);
if (log) {
- _emberMetalCore.default.Logger.log(' ', this.toString(), '<-', toValue, obj);
+ _emberMetalLogger.default.log(' ', this.toString(), '<-', toValue, obj);
}
_emberMetalObserver._suspendObserver(obj, fromPath, this, this.fromDidChange, function () {
_emberMetalProperty_set.trySet(_emberMetalPath_cache.isGlobal(fromPath) ? _emberMetalCore.default.lookup : obj, fromPath, toValue);
});
}
@@ -12532,18 +12887,18 @@
}
exports.Binding = Binding;
exports.isGlobalPath = _emberMetalPath_cache.isGlobal;
});
-// Ember.Logger, Ember.LOG_BINDINGS, assert
-enifed('ember-metal/cache', ['exports', 'ember-metal/dictionary'], function (exports, _emberMetalDictionary) {
+// Ember.LOG_BINDINGS
+enifed('ember-metal/cache', ['exports', 'ember-metal/empty_object'], function (exports, _emberMetalEmpty_object) {
'use strict';
exports.default = Cache;
function Cache(limit, func) {
- this.store = _emberMetalDictionary.default(null);
+ this.store = new _emberMetalEmpty_object.default();
this.size = 0;
this.misses = 0;
this.hits = 0;
this.limit = limit;
this.func = func;
@@ -12581,18 +12936,18 @@
return value;
},
purge: function () {
- this.store = _emberMetalDictionary.default(null);
+ this.store = new _emberMetalEmpty_object.default();
this.size = 0;
this.hits = 0;
this.misses = 0;
}
};
});
-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) {
+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) {
'use strict';
exports.flushPendingChains = flushPendingChains;
exports.finishChains = finishChains;
@@ -12712,13 +13067,12 @@
pendingQueue = [];
queue.forEach(function (q) {
return q[0].add(q[1]);
});
+ }
- }
-
function makeChainWatcher(obj) {
return new ChainWatchers(obj);
}
function addChainWatcher(obj, keyName, node) {
@@ -13008,14 +13362,640 @@
}
exports.removeChainWatcher = removeChainWatcher;
exports.ChainNode = ChainNode;
});
-// warn, assert, etc;
-enifed('ember-metal/computed_macros', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/computed', 'ember-metal/is_empty', 'ember-metal/is_none', 'ember-metal/alias'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalComputed, _emberMetalIs_empty, _emberMetalIs_none, _emberMetalAlias) {
+enifed('ember-metal/computed', ['exports', 'ember-metal/debug', '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, _emberMetalDebug, _emberMetalProperty_set, _emberMetalUtils, _emberMetalMeta, _emberMetalExpand_properties, _emberMetalError, _emberMetalProperties, _emberMetalProperty_events, _emberMetalDependent_keys) {
'use strict';
+ exports.default = computed;
+
+ /**
+ @module ember
+ @submodule ember-metal
+ */
+
+ function UNDEFINED() {}
+
+ // ..........................................................
+ // 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
+ that your computed property depends on. This will force the cached
+ result to be recomputed if the dependencies are modified.
+
+ In the following example we declare a computed property - `fullName` - by calling
+ `.Ember.computed()` with property dependencies (`firstName` and `lastName`) as leading arguments and getter accessor function. The `fullName` getter function
+ will be called once (regardless of how many times it is accessed) as long
+ as its dependencies have not changed. Once `firstName` or `lastName` are updated
+ any future calls (or anything bound) to `fullName` will incorporate the new
+ values.
+
+ ```javascript
+ let Person = Ember.Object.extend({
+ // these will be supplied by `create`
+ firstName: null,
+ lastName: null,
+
+ fullName: Ember.computed('firstName', 'lastName', function() {
+ let firstName = this.get('firstName'),
+ lastName = this.get('lastName');
+
+ return firstName + ' ' + lastName;
+ })
+ });
+
+ let tom = Person.create({
+ firstName: 'Tom',
+ lastName: 'Dale'
+ });
+
+ tom.get('fullName') // 'Tom Dale'
+ ```
+
+ You can also define what Ember should do when setting a computed property by providing additional function (`set`) in hash argument.
+ If you try to set a computed property, it will try to invoke setter accessor function with the key and
+ value you want to set it to as arguments.
+
+ ```javascript
+ let Person = Ember.Object.extend({
+ // these will be supplied by `create`
+ firstName: null,
+ lastName: null,
+
+ fullName: Ember.computed('firstName', 'lastName', {
+ get(key) {
+ let firstName = this.get('firstName'),
+ lastName = this.get('lastName');
+
+ return firstName + ' ' + lastName;
+ },
+ 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'
+ ```
+
+ You can overwrite computed property with normal property (no longer computed), that won't change if dependencies change, if you set computed property and it won't have setter accessor function defined.
+
+ You can also mark computed property as `.readOnly()` and block all attempts to set it.
+
+ ```javascript
+ let Person = Ember.Object.extend({
+ // these will be supplied by `create`
+ firstName: null,
+ lastName: null,
+
+ fullName: Ember.computed('firstName', 'lastName', {
+ get(key) {
+ let firstName = this.get('firstName');
+ let lastName = this.get('lastName');
+
+ return firstName + ' ' + lastName;
+ }
+ }).readOnly()
+ });
+
+ let person = Person.create();
+ person.set('fullName', 'Peter Wagenet'); // Uncaught Error: Cannot set read-only property "fullName" on object: <(...):emberXXX>
+ ```
+
+ Additional resources:
+ - [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') {
+ this._getter = config;
+ } else {
+ this._getter = config.get;
+ this._setter = config.set;
+ }
+
+ this._dependentKeys = undefined;
+ this._suspended = undefined;
+ this._meta = undefined;
+ this._volatile = false;
+ this._dependentKeys = opts && opts.dependentKeys;
+ this._readOnly = false;
+ }
+
+ ComputedProperty.prototype = new _emberMetalProperties.Descriptor();
+
+ var ComputedPropertyPrototype = ComputedProperty.prototype;
+
+ /**
+ Call on a computed property to set it into non-cached mode. When in this
+ mode the computed property will not automatically cache the return value.
+
+ It also does not automatically fire any change events. You must manually notify
+ any changes if you want to observe this property.
+
+ Dependency keys have no effect on volatile properties as they are for cache
+ invalidation and notification when cached value is invalidated.
+
+ ```javascript
+ let outsideService = Ember.Object.extend({
+ value: Ember.computed(function() {
+ return OutsideService.getValue();
+ }).volatile()
+ }).create();
+ ```
+
+ @method volatile
+ @return {Ember.ComputedProperty} this
+ @chainable
+ @public
+ */
+ ComputedPropertyPrototype.volatile = function () {
+ this._volatile = true;
+ return this;
+ };
+
+ /**
+ Call on a computed property to set it into read-only mode. When in this
+ mode the computed property will throw an error when set.
+
+ ```javascript
+ let Person = Ember.Object.extend({
+ guid: Ember.computed(function() {
+ return 'guid-guid-guid';
+ }).readOnly()
+ });
+
+ let person = Person.create();
+
+ person.set('guid', 'new-guid'); // will throw an exception
+ ```
+
+ @method readOnly
+ @return {Ember.ComputedProperty} this
+ @chainable
+ @public
+ */
+ ComputedPropertyPrototype.readOnly = function () {
+ this._readOnly = true;
+
+ return this;
+ };
+
+ /**
+ Sets the dependent keys on this computed property. Pass any number of
+ arguments containing key paths that this computed property depends on.
+
+ ```javascript
+ let President = Ember.Object.extend({
+ fullName: Ember.computed(function() {
+ return this.get('firstName') + ' ' + this.get('lastName');
+
+ // Tell Ember that this computed property depends on firstName
+ // and lastName
+ }).property('firstName', 'lastName')
+ });
+
+ let president = President.create({
+ firstName: 'Barack',
+ lastName: 'Obama'
+ });
+
+ president.get('fullName'); // 'Barack Obama'
+ ```
+
+ @method property
+ @param {String} path* zero or more property paths
+ @return {Ember.ComputedProperty} this
+ @chainable
+ @public
+ */
+ ComputedPropertyPrototype.property = function () {
+ var args;
+
+ var addArg = function (property) {
+ args.push(property);
+ };
+
+ args = [];
+ for (var i = 0, l = arguments.length; i < l; i++) {
+ _emberMetalExpand_properties.default(arguments[i], addArg);
+ }
+
+ this._dependentKeys = args;
+ return this;
+ };
+
+ /**
+ In some cases, you may want to annotate computed properties with additional
+ metadata about how they function or what values they operate on. For example,
+ computed property functions may close over variables that are then no longer
+ available for introspection.
+
+ You can pass a hash of these values to a computed property like this:
+
+ ```
+ person: Ember.computed(function() {
+ let personId = this.get('personId');
+ return App.Person.create({ id: personId });
+ }).meta({ type: App.Person })
+ ```
+
+ The hash that you pass to the `meta()` function will be saved on the
+ computed property descriptor under the `_meta` key. Ember runtime
+ exposes a public API for retrieving these values from classes,
+ via the `metaForProperty()` function.
+
+ @method meta
+ @param {Object} meta
+ @chainable
+ @public
+ */
+
+ ComputedPropertyPrototype.meta = function (meta) {
+ if (arguments.length === 0) {
+ return this._meta || {};
+ } else {
+ this._meta = meta;
+ return this;
+ }
+ };
+
+ // invalidate cache when CP key changes
+ ComputedPropertyPrototype.didChange = function (obj, keyName) {
+ // _suspended is set via a CP.set to ensure we don't clear
+ // the cached value set by the setter
+ if (this._volatile || this._suspended === obj) {
+ return;
+ }
+
+ // don't create objects just to invalidate
+ var meta = obj.__ember_meta__;
+ if (!meta || meta.source !== obj) {
+ return;
+ }
+
+ var cache = meta.readableCache();
+ if (cache && cache[keyName] !== undefined) {
+ cache[keyName] = undefined;
+ _emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, meta);
+ }
+ };
+
+ /**
+ Access the value of the function backing the computed property.
+ If this property has already been cached, return the cached result.
+ Otherwise, call the function passing the property name as an argument.
+
+ ```javascript
+ 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);
+ }
+
+ var meta = _emberMetalMeta.meta(obj);
+ var cache = meta.writableCache();
+
+ var result = cache[keyName];
+ if (result === UNDEFINED) {
+ return undefined;
+ } else if (result !== undefined) {
+ return result;
+ }
+
+ var ret = this._getter.call(obj, keyName);
+ if (ret === undefined) {
+ cache[keyName] = UNDEFINED;
+ } else {
+ cache[keyName] = ret;
+ }
+
+ var chainWatchers = meta.readableChainWatchers();
+ if (chainWatchers) {
+ chainWatchers.revalidate(keyName);
+ }
+ _emberMetalDependent_keys.addDependentKeys(this, obj, keyName, meta);
+
+ return ret;
+ };
+
+ /**
+ Set the value of a computed property. If the function that backs your
+ computed property does not accept arguments then the default action for
+ setting would be to define the property on the current object, and set
+ the value of the property to the value being set.
+
+ Generally speaking if you intend for your computed property to be set
+ 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);
+ }
+
+ if (!this._setter) {
+ return this.clobberSet(obj, keyName, value);
+ }
+
+ if (this._volatile) {
+ return this.volatileSet(obj, keyName, value);
+ }
+
+ return this.setWithSuspend(obj, keyName, value);
+ };
+
+ ComputedPropertyPrototype._throwReadOnlyError = function computedPropertyThrowReadOnlyError(obj, keyName) {
+ throw new _emberMetalError.default('Cannot set read-only property "' + keyName + '" on object: ' + _emberMetalUtils.inspect(obj));
+ };
+
+ ComputedPropertyPrototype.clobberSet = function computedPropertyClobberSet(obj, keyName, value) {
+ var cachedValue = cacheFor(obj, keyName);
+ _emberMetalProperties.defineProperty(obj, keyName, null, cachedValue);
+ _emberMetalProperty_set.set(obj, keyName, value);
+ return value;
+ };
+
+ ComputedPropertyPrototype.volatileSet = function computedPropertyVolatileSet(obj, keyName, value) {
+ return this._setter.call(obj, keyName, value);
+ };
+
+ ComputedPropertyPrototype.setWithSuspend = function computedPropertySetWithSuspend(obj, keyName, value) {
+ var oldSuspended = this._suspended;
+ this._suspended = obj;
+ try {
+ return this._set(obj, keyName, value);
+ } finally {
+ this._suspended = oldSuspended;
+ }
+ };
+
+ ComputedPropertyPrototype._set = function computedPropertySet(obj, keyName, value) {
+ // cache requires own meta
+ var meta = _emberMetalMeta.meta(obj);
+ // either there is a writable cache or we need one to update
+ var cache = meta.writableCache();
+ var hadCachedValue = false;
+ var cachedValue = undefined;
+ if (cache[keyName] !== undefined) {
+ if (cache[keyName] !== UNDEFINED) {
+ cachedValue = cache[keyName];
+ }
+ hadCachedValue = true;
+ }
+
+ var ret = this._setter.call(obj, keyName, value, cachedValue);
+
+ // allows setter to return the same value that is cached already
+ if (hadCachedValue && cachedValue === ret) {
+ return ret;
+ }
+
+ var watched = meta.peekWatching(keyName);
+ if (watched) {
+ _emberMetalProperty_events.propertyWillChange(obj, keyName);
+ }
+
+ if (hadCachedValue) {
+ cache[keyName] = undefined;
+ }
+
+ if (!hadCachedValue) {
+ _emberMetalDependent_keys.addDependentKeys(this, obj, keyName, meta);
+ }
+
+ if (ret === undefined) {
+ cache[keyName] = UNDEFINED;
+ } else {
+ cache[keyName] = ret;
+ }
+
+ if (watched) {
+ _emberMetalProperty_events.propertyDidChange(obj, keyName);
+ }
+
+ return ret;
+ };
+
+ /* called before property is overridden */
+ ComputedPropertyPrototype.teardown = function (obj, keyName) {
+ if (this._volatile) {
+ return;
+ }
+ var meta = _emberMetalMeta.meta(obj);
+ var cache = meta.readableCache();
+ if (cache && cache[keyName] !== undefined) {
+ _emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, meta);
+ cache[keyName] = undefined;
+ }
+ };
+
+ /**
+ This helper returns a new property descriptor that wraps the passed
+ computed property function. You can use this helper to define properties
+ with mixins or via `Ember.defineProperty()`.
+
+ If you pass function as argument - it will be used as getter.
+ You can pass hash with two functions - instead of single function - as argument to provide both getter and setter.
+
+ The `get` function should accept two parameters, `key` and `value`. If `value` is not
+ undefined you should set the `value` first. In either case return the
+ current value of the property.
+
+ A computed property defined in this way might look like this:
+
+ ```js
+ let Person = Ember.Object.extend({
+ firstName: 'Betty',
+ lastName: 'Jones',
+
+ fullName: Ember.computed('firstName', 'lastName', function() {
+ return this.get('firstName') + ' ' + this.get('lastName');
+ })
+ });
+
+ let client = Person.create();
+
+ client.get('fullName'); // 'Betty Jones'
+
+ client.set('lastName', 'Fuller');
+ client.get('fullName'); // 'Betty Fuller'
+ ```
+
+ _Note: This is the preferred way to define computed properties when writing third-party
+ libraries that depend on or use Ember, since there is no guarantee that the user
+ will have prototype extensions enabled._
+
+ You might use this method if you disabled
+ [Prototype Extensions](http://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/).
+ The alternative syntax might look like this
+ (if prototype extensions are enabled, which is the default behavior):
+
+ ```js
+ fullName() {
+ return this.get('firstName') + ' ' + this.get('lastName');
+ }.property('firstName', 'lastName')
+ ```
+
+ @class computed
+ @namespace Ember
+ @constructor
+ @static
+ @param {String} [dependentKeys*] Optional dependent keys that trigger this computed property.
+ @param {Function} func The computed property function.
+ @return {Ember.ComputedProperty} property descriptor instance
+ @public
+ */
+
+ function computed(func) {
+ var args;
+
+ if (arguments.length > 1) {
+ args = [].slice.call(arguments);
+ func = args.pop();
+ }
+
+ var cp = new ComputedProperty(func);
+
+ if (args) {
+ cp.property.apply(cp, args);
+ }
+
+ return cp;
+ }
+
+ /**
+ Returns the cached value for a property, if one exists.
+ This can be useful for peeking at the value of a computed
+ property that is generated lazily, without accidentally causing
+ it to be created.
+
+ @method cacheFor
+ @for Ember
+ @param {Object} obj the object whose property you want to check
+ @param {String} key the name of the property whose cached value you want
+ to return
+ @return {Object} the cached value
+ @public
+ */
+ function cacheFor(obj, key) {
+ var meta = obj.__ember_meta__;
+ var cache = meta && meta.source === obj && meta.readableCache();
+ var ret = cache && cache[key];
+
+ if (ret === UNDEFINED) {
+ return undefined;
+ }
+ return ret;
+ }
+
+ cacheFor.set = function (cache, key, value) {
+ if (value === undefined) {
+ cache[key] = UNDEFINED;
+ } else {
+ cache[key] = value;
+ }
+ };
+
+ cacheFor.get = function (cache, key) {
+ var ret = cache[key];
+ if (ret === UNDEFINED) {
+ return undefined;
+ }
+ return ret;
+ };
+
+ cacheFor.remove = function (cache, key) {
+ cache[key] = undefined;
+ };
+
+ exports.ComputedProperty = ComputedProperty;
+ exports.computed = computed;
+ exports.cacheFor = cacheFor;
+});
+enifed('ember-metal/computed_macros', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/computed', 'ember-metal/is_empty', 'ember-metal/is_none', 'ember-metal/alias'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalComputed, _emberMetalIs_empty, _emberMetalIs_none, _emberMetalAlias) {
+ 'use strict';
+
exports.empty = empty;
exports.notEmpty = notEmpty;
exports.none = none;
exports.not = not;
exports.bool = bool;
@@ -13692,647 +14672,20 @@
*/
function deprecatingAlias(dependentKey, options) {
return _emberMetalComputed.computed(dependentKey, {
get: function (key) {
- return _emberMetalProperty_get.get(this, dependentKey);
+ return _emberMetalProperty_get.get(this, dependentKey);
},
set: function (key, value) {
- _emberMetalProperty_set.set(this, dependentKey, value);
+ _emberMetalProperty_set.set(this, dependentKey, value);
return value;
}
});
}
});
-enifed('ember-metal/computed', ['exports', 'ember-metal/core', 'ember-metal/property_set', 'ember-metal/utils', 'ember-metal/meta', 'ember-metal/expand_properties', 'ember-metal/error', 'ember-metal/properties', 'ember-metal/property_events', 'ember-metal/dependent_keys'], function (exports, _emberMetalCore, _emberMetalProperty_set, _emberMetalUtils, _emberMetalMeta, _emberMetalExpand_properties, _emberMetalError, _emberMetalProperties, _emberMetalProperty_events, _emberMetalDependent_keys) {
- 'use strict';
-
- exports.default = computed;
-
- /**
- @module ember
- @submodule ember-metal
- */
-
- var metaFor = _emberMetalMeta.meta;
-
- function UNDEFINED() {}
-
- // ..........................................................
- // COMPUTED PROPERTY
- //
-
- /**
- A computed property transforms an object 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
- that your computed property depends on. This will force the cached
- result to be recomputed if the dependencies are modified.
-
- In the following example we declare a computed property - `fullName` - by calling
- `.Ember.computed()` with property dependencies (`firstName` and `lastName`) as leading arguments and getter accessor function. The `fullName` getter function
- will be called once (regardless of how many times it is accessed) as long
- as its dependencies have not changed. Once `firstName` or `lastName` are updated
- any future calls (or anything bound) to `fullName` will incorporate the new
- values.
-
- ```javascript
- let Person = Ember.Object.extend({
- // these will be supplied by `create`
- firstName: null,
- lastName: null,
-
- fullName: Ember.computed('firstName', 'lastName', function() {
- let firstName = this.get('firstName'),
- lastName = this.get('lastName');
-
- return firstName + ' ' + lastName;
- })
- });
-
- let tom = Person.create({
- firstName: 'Tom',
- lastName: 'Dale'
- });
-
- tom.get('fullName') // 'Tom Dale'
- ```
-
- You can also define what Ember should do when setting a computed property by providing additional function (`set`) in hash argument.
- If you try to set a computed property, it will try to invoke setter accessor function with the key and
- value you want to set it to as arguments.
-
- ```javascript
- let Person = Ember.Object.extend({
- // these will be supplied by `create`
- firstName: null,
- lastName: null,
-
- fullName: Ember.computed('firstName', 'lastName', {
- get(key) {
- let firstName = this.get('firstName'),
- lastName = this.get('lastName');
-
- return firstName + ' ' + lastName;
- },
- 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'
- ```
-
- You can overwrite computed property with normal property (no longer computed), that won't change if dependencies change, if you set computed property and it won't have setter accessor function defined.
-
- You can also mark computed property as `.readOnly()` and block all attempts to set it.
-
- ```javascript
- let Person = Ember.Object.extend({
- // these will be supplied by `create`
- firstName: null,
- lastName: null,
-
- fullName: Ember.computed('firstName', 'lastName', {
- get(key) {
- let firstName = this.get('firstName');
- let lastName = this.get('lastName');
-
- return firstName + ' ' + lastName;
- }
- }).readOnly()
- });
-
- let person = Person.create();
- person.set('fullName', 'Peter Wagenet'); // Uncaught Error: Cannot set read-only property "fullName" on object: <(...):emberXXX>
- ```
-
- Additional resources:
- - [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') {
- this._getter = config;
- } else {
- this._getter = config.get;
- this._setter = config.set;
- }
- this._dependentKeys = undefined;
- this._suspended = undefined;
- this._meta = undefined;
- this._volatile = false;
- this._dependentKeys = opts && opts.dependentKeys;
- this._readOnly = false;
- }
-
- ComputedProperty.prototype = new _emberMetalProperties.Descriptor();
-
- var ComputedPropertyPrototype = ComputedProperty.prototype;
-
- /**
- Call on a computed property to set it into non-cached mode. When in this
- mode the computed property will not automatically cache the return value.
-
- It also does not automatically fire any change events. You must manually notify
- any changes if you want to observe this property.
-
- Dependency keys have no effect on volatile properties as they are for cache
- invalidation and notification when cached value is invalidated.
-
- ```javascript
- let outsideService = Ember.Object.extend({
- value: Ember.computed(function() {
- return OutsideService.getValue();
- }).volatile()
- }).create();
- ```
-
- @method volatile
- @return {Ember.ComputedProperty} this
- @chainable
- @public
- */
- ComputedPropertyPrototype.volatile = function () {
- this._volatile = true;
- return this;
- };
-
- /**
- Call on a computed property to set it into read-only mode. When in this
- mode the computed property will throw an error when set.
-
- ```javascript
- let Person = Ember.Object.extend({
- guid: Ember.computed(function() {
- return 'guid-guid-guid';
- }).readOnly()
- });
-
- let person = Person.create();
-
- person.set('guid', 'new-guid'); // will throw an exception
- ```
-
- @method readOnly
- @return {Ember.ComputedProperty} this
- @chainable
- @public
- */
- ComputedPropertyPrototype.readOnly = function () {
- this._readOnly = true;
- return this;
- };
-
- /**
- Sets the dependent keys on this computed property. Pass any number of
- arguments containing key paths that this computed property depends on.
-
- ```javascript
- let President = Ember.Object.extend({
- fullName: Ember.computed(function() {
- return this.get('firstName') + ' ' + this.get('lastName');
-
- // Tell Ember that this computed property depends on firstName
- // and lastName
- }).property('firstName', 'lastName')
- });
-
- let president = President.create({
- firstName: 'Barack',
- lastName: 'Obama'
- });
-
- president.get('fullName'); // 'Barack Obama'
- ```
-
- @method property
- @param {String} path* zero or more property paths
- @return {Ember.ComputedProperty} this
- @chainable
- @public
- */
- ComputedPropertyPrototype.property = function () {
- var args;
-
- var addArg = function (property) {
- args.push(property);
- };
-
- args = [];
- for (var i = 0, l = arguments.length; i < l; i++) {
- _emberMetalExpand_properties.default(arguments[i], addArg);
- }
-
- this._dependentKeys = args;
- return this;
- };
-
- /**
- In some cases, you may want to annotate computed properties with additional
- metadata about how they function or what values they operate on. For example,
- computed property functions may close over variables that are then no longer
- available for introspection.
-
- You can pass a hash of these values to a computed property like this:
-
- ```
- person: Ember.computed(function() {
- let personId = this.get('personId');
- return App.Person.create({ id: personId });
- }).meta({ type: App.Person })
- ```
-
- The hash that you pass to the `meta()` function will be saved on the
- computed property descriptor under the `_meta` key. Ember runtime
- exposes a public API for retrieving these values from classes,
- via the `metaForProperty()` function.
-
- @method meta
- @param {Object} meta
- @chainable
- @public
- */
-
- ComputedPropertyPrototype.meta = function (meta) {
- if (arguments.length === 0) {
- return this._meta || {};
- } else {
- this._meta = meta;
- return this;
- }
- };
-
- // invalidate cache when CP key changes
- ComputedPropertyPrototype.didChange = function (obj, keyName) {
- // _suspended is set via a CP.set to ensure we don't clear
- // the cached value set by the setter
- if (this._volatile || this._suspended === obj) {
- return;
- }
-
- // don't create objects just to invalidate
- var meta = obj.__ember_meta__;
- if (!meta || meta.source !== obj) {
- return;
- }
-
- var cache = meta.readableCache();
- if (cache && cache[keyName] !== undefined) {
- cache[keyName] = undefined;
- _emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, meta);
- }
- };
-
- /**
- Access the value of the function backing the computed property.
- If this property has already been cached, return the cached result.
- Otherwise, call the function passing the property name as an argument.
-
- ```javascript
- 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);
- }
-
- var meta = metaFor(obj);
- var cache = meta.writableCache();
-
- var result = cache[keyName];
- if (result === UNDEFINED) {
- return undefined;
- } else if (result !== undefined) {
- return result;
- }
-
- var ret = this._getter.call(obj, keyName);
- if (ret === undefined) {
- cache[keyName] = UNDEFINED;
- } else {
- cache[keyName] = ret;
- }
-
- var chainWatchers = meta.readableChainWatchers();
- if (chainWatchers) {
- chainWatchers.revalidate(keyName);
- }
- _emberMetalDependent_keys.addDependentKeys(this, obj, keyName, meta);
-
- return ret;
- };
-
- /**
- Set the value of a computed property. If the function that backs your
- computed property does not accept arguments then the default action for
- setting would be to define the property on the current object, and set
- the value of the property to the value being set.
-
- Generally speaking if you intend for your computed property to be set
- 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);
- }
-
- if (!this._setter) {
- return this.clobberSet(obj, keyName, value);
- }
-
- if (this._volatile) {
- return this.volatileSet(obj, keyName, value);
- }
-
- return this.setWithSuspend(obj, keyName, value);
- };
-
- ComputedPropertyPrototype._throwReadOnlyError = function computedPropertyThrowReadOnlyError(obj, keyName) {
- throw new _emberMetalError.default('Cannot set read-only property "' + keyName + '" on object: ' + _emberMetalUtils.inspect(obj));
- };
-
- ComputedPropertyPrototype.clobberSet = function computedPropertyClobberSet(obj, keyName, value) {
- var cachedValue = cacheFor(obj, keyName);
- _emberMetalProperties.defineProperty(obj, keyName, null, cachedValue);
- _emberMetalProperty_set.set(obj, keyName, value);
- return value;
- };
-
- ComputedPropertyPrototype.volatileSet = function computedPropertyVolatileSet(obj, keyName, value) {
- return this._setter.call(obj, keyName, value);
- };
-
- ComputedPropertyPrototype.setWithSuspend = function computedPropertySetWithSuspend(obj, keyName, value) {
- var oldSuspended = this._suspended;
- this._suspended = obj;
- try {
- return this._set(obj, keyName, value);
- } finally {
- this._suspended = oldSuspended;
- }
- };
-
- ComputedPropertyPrototype._set = function computedPropertySet(obj, keyName, value) {
- // cache requires own meta
- var meta = metaFor(obj);
- // either there is a writable cache or we need one to update
- var cache = meta.writableCache();
- var hadCachedValue = false;
- var cachedValue = undefined;
- if (cache[keyName] !== undefined) {
- if (cache[keyName] !== UNDEFINED) {
- cachedValue = cache[keyName];
- }
- hadCachedValue = true;
- }
-
- var ret = this._setter.call(obj, keyName, value, cachedValue);
-
- // allows setter to return the same value that is cached already
- if (hadCachedValue && cachedValue === ret) {
- return ret;
- }
-
- var watched = meta.peekWatching(keyName);
- if (watched) {
- _emberMetalProperty_events.propertyWillChange(obj, keyName);
- }
-
- if (hadCachedValue) {
- cache[keyName] = undefined;
- }
-
- if (!hadCachedValue) {
- _emberMetalDependent_keys.addDependentKeys(this, obj, keyName, meta);
- }
-
- if (ret === undefined) {
- cache[keyName] = UNDEFINED;
- } else {
- cache[keyName] = ret;
- }
-
- if (watched) {
- _emberMetalProperty_events.propertyDidChange(obj, keyName);
- }
-
- return ret;
- };
-
- /* called before property is overridden */
- ComputedPropertyPrototype.teardown = function (obj, keyName) {
- if (this._volatile) {
- return;
- }
- var meta = metaFor(obj);
- var cache = meta.readableCache();
- if (cache && cache[keyName] !== undefined) {
- _emberMetalDependent_keys.removeDependentKeys(this, obj, keyName, meta);
- cache[keyName] = undefined;
- }
- };
-
- /**
- This helper returns a new property descriptor that wraps the passed
- computed property function. You can use this helper to define properties
- with mixins or via `Ember.defineProperty()`.
-
- If you pass function as argument - it will be used as getter.
- You can pass hash with two functions - instead of single function - as argument to provide both getter and setter.
-
- The `get` function should accept two parameters, `key` and `value`. If `value` is not
- undefined you should set the `value` first. In either case return the
- current value of the property.
-
- A computed property defined in this way might look like this:
-
- ```js
- let Person = Ember.Object.extend({
- firstName: 'Betty',
- lastName: 'Jones',
-
- fullName: Ember.computed('firstName', 'lastName', function() {
- return this.get('firstName') + ' ' + this.get('lastName');
- })
- });
-
- let client = Person.create();
-
- client.get('fullName'); // 'Betty Jones'
-
- client.set('lastName', 'Fuller');
- client.get('fullName'); // 'Betty Fuller'
- ```
-
- _Note: This is the preferred way to define computed properties when writing third-party
- libraries that depend on or use Ember, since there is no guarantee that the user
- will have prototype extensions enabled._
-
- You might use this method if you disabled
- [Prototype Extensions](http://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/).
- The alternative syntax might look like this
- (if prototype extensions are enabled, which is the default behavior):
-
- ```js
- fullName() {
- return this.get('firstName') + ' ' + this.get('lastName');
- }.property('firstName', 'lastName')
- ```
-
- @class computed
- @namespace Ember
- @constructor
- @static
- @param {String} [dependentKeys*] Optional dependent keys that trigger this computed property.
- @param {Function} func The computed property function.
- @return {Ember.ComputedProperty} property descriptor instance
- @public
- */
-
- function computed(func) {
- var args;
-
- if (arguments.length > 1) {
- args = [].slice.call(arguments);
- func = args.pop();
- }
-
- var cp = new ComputedProperty(func);
-
- if (args) {
- cp.property.apply(cp, args);
- }
-
- return cp;
- }
-
- /**
- Returns the cached value for a property, if one exists.
- This can be useful for peeking at the value of a computed
- property that is generated lazily, without accidentally causing
- it to be created.
-
- @method cacheFor
- @for Ember
- @param {Object} obj the object whose property you want to check
- @param {String} key the name of the property whose cached value you want
- to return
- @return {Object} the cached value
- @public
- */
- function cacheFor(obj, key) {
- var meta = obj.__ember_meta__;
- var cache = meta && meta.source === obj && meta.readableCache();
- var ret = cache && cache[key];
-
- if (ret === UNDEFINED) {
- return undefined;
- }
- return ret;
- }
-
- cacheFor.set = function (cache, key, value) {
- if (value === undefined) {
- cache[key] = UNDEFINED;
- } else {
- cache[key] = value;
- }
- };
-
- cacheFor.get = function (cache, key) {
- var ret = cache[key];
- if (ret === UNDEFINED) {
- return undefined;
- }
- return ret;
- };
-
- cacheFor.remove = function (cache, key) {
- cache[key] = undefined;
- };
-
- exports.ComputedProperty = ComputedProperty;
- exports.computed = computed;
- exports.cacheFor = cacheFor;
-});
-enifed('ember-metal/core', ['exports', 'ember-metal/assert'], function (exports, _emberMetalAssert) {
+enifed('ember-metal/core', ['exports'], function (exports) {
/*globals Ember:true,ENV,EmberENV */
/**
@module ember
@submodule ember-metal
@@ -14351,11 +14704,11 @@
cross-platform libraries such as jQuery. For more details, see
[Ember-Runtime](http://emberjs.com/api/modules/ember-runtime.html).
@class Ember
@static
- @version 2.1.2
+ @version 2.2.0-beta.1
@public
*/
'use strict';
@@ -14380,20 +14733,30 @@
Ember.toString = function () {
return 'Ember';
};
+ // The debug functions are exported to globals with `require` to
+ // prevent babel-plugin-filter-imports from removing them.
+ var debugModule = Ember.__loader.require('ember-metal/debug');
+ Ember.assert = debugModule.assert;
+ Ember.warn = debugModule.warn;
+ Ember.debug = debugModule.debug;
+ Ember.deprecate = debugModule.deprecate;
+ Ember.deprecateFunc = debugModule.deprecateFunc;
+ Ember.runInDebug = debugModule.runInDebug;
+
/**
The semantic version.
@property VERSION
@type String
- @default '2.1.2'
+ @default '2.2.0-beta.1'
@static
@public
*/
- Ember.VERSION = '2.1.2';
+ Ember.VERSION = '2.2.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
@@ -14405,11 +14768,12 @@
@public
*/
if (Ember.ENV) {
// do nothing if Ember.ENV is already setup
- } else if ('undefined' !== typeof EmberENV) {
+ Ember.assert('Ember.ENV should be an object.', 'object' !== typeof Ember.ENV);
+ } else if ('undefined' !== typeof EmberENV) {
Ember.ENV = EmberENV;
} else if ('undefined' !== typeof ENV) {
Ember.ENV = ENV;
} else {
Ember.ENV = {};
@@ -14497,27 +14861,91 @@
exports.K = K;
Ember.K = K;
//TODO: ES6 GLOBAL TODO
- Ember.assert = _emberMetalAssert.assert;
- Ember.warn = _emberMetalAssert.warn;
- Ember.debug = _emberMetalAssert.debug;
- Ember.deprecate = _emberMetalAssert.deprecate;
- Ember.deprecateFunc = _emberMetalAssert.deprecateFunc;
- Ember.runInDebug = _emberMetalAssert.runInDebug;
-
exports.default = Ember;
});
+enifed("ember-metal/debug", ["exports"], function (exports) {
+ "use strict";
+
+ exports.getDebugFunction = getDebugFunction;
+ exports.setDebugFunction = setDebugFunction;
+ exports.assert = assert;
+ exports.info = info;
+ exports.warn = warn;
+ exports.debug = debug;
+ exports.deprecate = deprecate;
+ exports.deprecateFunc = deprecateFunc;
+ exports.runInDebug = runInDebug;
+ exports.debugSeal = debugSeal;
+ var debugFunctions = {
+ assert: function () {},
+ info: 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 () {},
+ debugSeal: function () {}
+ };
+
+ exports.debugFunctions = debugFunctions;
+
+ function getDebugFunction(name) {
+ return debugFunctions[name];
+ }
+
+ function setDebugFunction(name, fn) {
+ debugFunctions[name] = fn;
+ }
+
+ function assert() {
+ return debugFunctions.assert.apply(undefined, arguments);
+ }
+
+ function info() {
+ return debugFunctions.info.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);
+ }
+
+ function debugSeal() {
+ return debugFunctions.debugSeal.apply(undefined, arguments);
+ }
+});
enifed('ember-metal/dependent_keys', ['exports', 'ember-metal/watching'], function (exports, _emberMetalWatching) {
+ 'no use strict';
// Remove "use strict"; from transpiled module until
// https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
- //
-
+
exports.addDependentKeys = addDependentKeys;
exports.removeDependentKeys = removeDependentKeys;
- 'REMOVE_USE_STRICT: true';
/**
@module ember
@submodule ember-metal
*/
@@ -14527,48 +14955,44 @@
//
function addDependentKeys(desc, obj, keyName, meta) {
// the descriptor has a list of dependent keys, so
// add all of its dependent keys.
- var idx, len, depKey, keys;
+ var idx, len, depKey;
var depKeys = desc._dependentKeys;
if (!depKeys) {
return;
}
for (idx = 0, len = depKeys.length; idx < len; idx++) {
depKey = depKeys[idx];
- // Lookup keys meta for depKey
- keys = meta.writableDeps(depKey);
// Increment the number of times depKey depends on keyName.
- keys[keyName] = (keys[keyName] || 0) + 1;
+ meta.writeDeps(depKey, keyName, (meta.peekDeps(depKey, keyName) || 0) + 1);
// Watch the depKey
_emberMetalWatching.watch(obj, depKey, meta);
}
}
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 idx, len, depKey, keys;
+ var idx, len, depKey;
if (!depKeys) {
return;
}
for (idx = 0, len = depKeys.length; idx < len; idx++) {
depKey = depKeys[idx];
- // Lookup keys meta for depKey
- keys = meta.writableDeps(depKey);
// Decrement the number of times depKey depends on keyName.
- keys[keyName] = (keys[keyName] || 0) - 1;
+ meta.writeDeps(depKey, keyName, (meta.peekDeps(depKey, keyName) || 0) - 1);
// Unwatch the depKey
_emberMetalWatching.unwatch(obj, depKey, meta);
}
}
});
-enifed('ember-metal/deprecate_property', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/property_set'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalProperty_set) {
+enifed('ember-metal/deprecate_property', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/property_set'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberMetalProperty_set) {
/**
@module ember
@submodule ember-metal
*/
@@ -14587,22 +15011,21 @@
@private
@since 1.7.0
*/
function deprecateProperty(object, deprecatedKey, newKey, options) {
- function deprecate() {
- }
+ function _deprecate() {}
Object.defineProperty(object, deprecatedKey, {
configurable: true,
enumerable: false,
set: function (value) {
- deprecate();
+ _deprecate();
_emberMetalProperty_set.set(this, newKey, value);
},
get: function () {
- deprecate();
+ _deprecate();
return _emberMetalProperty_get.get(this, newKey);
}
});
}
});
@@ -14670,22 +15093,20 @@
if (hasDOM) {
environment = {
hasDOM: true,
isChrome: !!window.chrome && !window.opera,
isFirefox: typeof InstallTrigger !== 'undefined',
- isPhantom: !!window.callPhantom,
location: window.location,
history: window.history,
userAgent: window.navigator.userAgent,
global: window
};
} else {
environment = {
hasDOM: false,
isChrome: false,
isFirefox: false,
- isPhantom: false,
location: null,
history: null,
userAgent: 'Lynx (textmode)',
global: null
};
@@ -14729,32 +15150,30 @@
}
}
EmberError.prototype = Object.create(Error.prototype);
});
-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) {
+enifed('ember-metal/events', ['exports', 'ember-metal/debug', 'ember-metal/utils', 'ember-metal/meta', 'ember-metal/meta_listeners'], function (exports, _emberMetalDebug, _emberMetalUtils, _emberMetalMeta, _emberMetalMeta_listeners) {
+ 'no use strict';
// Remove "use strict"; from transpiled module until
// https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
- //
-
+
+ /**
+ @module ember
+ @submodule ember-metal
+ */
exports.accumulateListeners = accumulateListeners;
exports.addListener = addListener;
exports.removeListener = removeListener;
exports.suspendListener = suspendListener;
exports.suspendListeners = suspendListeners;
exports.watchedEvents = watchedEvents;
exports.sendEvent = sendEvent;
exports.hasListeners = hasListeners;
exports.listenersFor = listenersFor;
exports.on = on;
- 'REMOVE_USE_STRICT: true';
- /**
- @module ember
- @submodule ember-metal
- */
-
/*
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.
@@ -14820,11 +15239,11 @@
@param {Boolean} once A flag whether a function should only be called once
@public
*/
function addListener(obj, eventName, target, method, once) {
-
+
if (!method && 'function' === typeof target) {
method = target;
target = null;
}
@@ -14853,11 +15272,11 @@
@param {Function|String} method A function or the name of a function to be called on `target`
@public
*/
function removeListener(obj, eventName, target, method) {
-
+
if (!method && 'function' === typeof target) {
method = target;
target = null;
}
@@ -15237,11 +15656,11 @@
ret[propertyNames[i]] = _emberMetalProperty_get.get(obj, propertyNames[i]);
}
return ret;
}
});
-enifed('ember-metal/injected_property', ['exports', 'ember-metal/core', 'ember-metal/computed', 'ember-metal/alias', 'ember-metal/properties'], function (exports, _emberMetalCore, _emberMetalComputed, _emberMetalAlias, _emberMetalProperties) {
+enifed('ember-metal/injected_property', ['exports', 'ember-metal/debug', 'ember-metal/computed', 'ember-metal/alias', 'ember-metal/properties'], function (exports, _emberMetalDebug, _emberMetalComputed, _emberMetalAlias, _emberMetalProperties) {
'use strict';
/**
Read-only property that returns the result of a container lookup.
@@ -15262,11 +15681,10 @@
}
function injectedPropertyGet(keyName) {
var desc = this[keyName];
-
return this.container.lookup(desc.type + ':' + (desc.name || keyName));
}
InjectedProperty.prototype = Object.create(_emberMetalProperties.Descriptor.prototype);
@@ -15281,11 +15699,10 @@
InjectedPropertyPrototype.teardown = ComputedPropertyPrototype.teardown;
exports.default = InjectedProperty;
});
-// Ember.assert
enifed('ember-metal/instrumentation', ['exports', 'ember-metal/core'], function (exports, _emberMetalCore) {
'use strict';
exports.instrument = instrument;
exports._instrumentStart = _instrumentStart;
@@ -15747,11 +16164,11 @@
})();
}
exports.default = keys;
});
-enifed('ember-metal/libraries', ['exports', 'ember-metal/core', 'ember-metal/features'], function (exports, _emberMetalCore, _emberMetalFeatures) {
+enifed('ember-metal/libraries', ['exports', 'ember-metal/debug', 'ember-metal/features'], function (exports, _emberMetalDebug, _emberMetalFeatures) {
'use strict';
/**
Helper class that allows you to register your library with Ember.
@@ -15786,12 +16203,11 @@
if (!this._getLibraryByName(name)) {
if (isCoreLibrary) {
index = this._coreLibIndex++;
}
this._registry.splice(index, 0, { name: name, version: version });
- } else {
- }
+ } else {}
},
registerCoreLibrary: function (name, version) {
this.register(name, version, true);
},
@@ -16452,11 +16868,15 @@
exports.default = Map;
exports.OrderedSet = OrderedSet;
exports.Map = Map;
exports.MapWithDefault = MapWithDefault;
});
-enifed('ember-metal/merge', ['exports'], function (exports) {
+enifed('ember-metal/merge', ['exports', 'ember-metal/debug', 'ember-metal/features'], function (exports, _emberMetalDebug, _emberMetalFeatures) {
+ 'use strict';
+
+ exports.default = merge;
+
/**
Merge the contents of two objects together into the first object.
```javascript
Ember.merge({first: 'Tom'}, {last: 'Dale'}); // {first: 'Tom', last: 'Dale'}
@@ -16470,15 +16890,13 @@
@param {Object} original The object to merge into
@param {Object} updates The object to copy properties from
@return {Object}
@public
*/
- 'use strict';
- exports.default = merge;
-
function merge(original, updates) {
+
if (!updates || typeof updates !== 'object') {
return original;
}
var props = Object.keys(updates);
@@ -16491,190 +16909,16 @@
}
return original;
}
});
-enifed('ember-metal/meta_listeners', ['exports'], function (exports) {
- /*
- When we render a rich template hierarchy, the set of events that
- *might* happen tends to be much larger than the set of events that
- actually happen. This implies that we should make listener creation &
- destruction cheap, even at the cost of making event dispatch more
- expensive.
-
- Thus we store a new listener with a single push and no new
- allocations, without even bothering to do deduplication -- we can
- save that for dispatch time, if an event actually happens.
- */
-
- /* listener flags */
- 'use strict';
-
- var ONCE = 1;
- exports.ONCE = ONCE;
- var SUSPENDED = 2;
-
- exports.SUSPENDED = SUSPENDED;
- var protoMethods = {
-
- addToListeners: function (eventName, target, method, flags) {
- if (!this._listeners) {
- this._listeners = [];
- }
- this._listeners.push(eventName, target, method, flags);
- },
-
- _finalizeListeners: function () {
- if (this._listenersFinalized) {
- return;
- }
- if (!this._listeners) {
- this._listeners = [];
- }
- var pointer = this.parent;
- while (pointer) {
- var listeners = pointer._listeners;
- if (listeners) {
- this._listeners = this._listeners.concat(listeners);
- }
- if (pointer._listenersFinalized) {
- break;
- }
- pointer = pointer.parent;
- }
- this._listenersFinalized = true;
- },
-
- removeFromListeners: function (eventName, target, method, didRemove) {
- var pointer = this;
- while (pointer) {
- var listeners = pointer._listeners;
- if (listeners) {
- for (var index = listeners.length - 4; index >= 0; index -= 4) {
- if (listeners[index] === eventName && (!method || listeners[index + 1] === target && listeners[index + 2] === method)) {
- if (pointer === this) {
- // we are modifying our own list, so we edit directly
- if (typeof didRemove === 'function') {
- didRemove(eventName, target, listeners[index + 2]);
- }
- listeners.splice(index, 4);
- } else {
- // we are trying to remove an inherited listener, so we do
- // just-in-time copying to detach our own listeners from
- // our inheritance chain.
- this._finalizeListeners();
- return this.removeFromListeners(eventName, target, method);
- }
- }
- }
- }
- if (pointer._listenersFinalized) {
- break;
- }
- pointer = pointer.parent;
- }
- },
-
- matchingListeners: function (eventName) {
- var pointer = this;
- var result = [];
- while (pointer) {
- var listeners = pointer._listeners;
- if (listeners) {
- for (var index = 0; index < listeners.length - 3; index += 4) {
- if (listeners[index] === eventName) {
- pushUniqueListener(result, listeners, index);
- }
- }
- }
- if (pointer._listenersFinalized) {
- break;
- }
- pointer = pointer.parent;
- }
- var sus = this._suspendedListeners;
- if (sus) {
- for (var susIndex = 0; susIndex < sus.length - 2; susIndex += 3) {
- if (eventName === sus[susIndex]) {
- for (var resultIndex = 0; resultIndex < result.length - 2; resultIndex += 3) {
- if (result[resultIndex] === sus[susIndex + 1] && result[resultIndex + 1] === sus[susIndex + 2]) {
- result[resultIndex + 2] |= SUSPENDED;
- }
- }
- }
- }
- }
- return result;
- },
-
- suspendListeners: function (eventNames, target, method, callback) {
- var sus = this._suspendedListeners;
- if (!sus) {
- sus = this._suspendedListeners = [];
- }
- for (var i = 0; i < eventNames.length; i++) {
- sus.push(eventNames[i], target, method);
- }
- try {
- return callback.call(target);
- } finally {
- if (sus.length === eventNames.length) {
- this._suspendedListeners = undefined;
- } else {
- for (var i = sus.length - 3; i >= 0; i -= 3) {
- if (sus[i + 1] === target && sus[i + 2] === method && eventNames.indexOf(sus[i]) !== -1) {
- sus.splice(i, 3);
- }
- }
- }
- }
- },
-
- watchedEvents: function () {
- var pointer = this;
- var names = {};
- while (pointer) {
- var listeners = pointer._listeners;
- if (listeners) {
- for (var index = 0; index < listeners.length - 3; index += 4) {
- names[listeners[index]] = true;
- }
- }
- if (pointer._listenersFinalized) {
- break;
- }
- pointer = pointer.parent;
- }
- return Object.keys(names);
- },
-
- _initializeListeners: function () {
- this._listeners = undefined;
- this._listenersFinalized = undefined;
- this._suspendedListeners = undefined;
- }
- };
-
- exports.protoMethods = protoMethods;
- function pushUniqueListener(destination, source, index) {
- var target = source[index + 1];
- var method = source[index + 2];
- for (var destinationIndex = 0; destinationIndex < destination.length - 2; destinationIndex += 3) {
- if (destination[destinationIndex] === target && destination[destinationIndex + 1] === method) {
- return;
- }
- }
- destination.push(target, method, source[index + 3]);
- }
-});
-enifed('ember-metal/meta', ['exports', 'ember-metal/features', 'ember-metal/meta_listeners', 'ember-metal/empty_object'], function (exports, _emberMetalFeatures, _emberMetalMeta_listeners, _emberMetalEmpty_object) {
+enifed('ember-metal/meta', ['exports', 'ember-metal/meta_listeners', 'ember-metal/empty_object'], function (exports, _emberMetalMeta_listeners, _emberMetalEmpty_object) {
+ 'no use strict';
// 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';
/**
@module ember-metal
*/
@@ -16688,15 +16932,15 @@
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
+ writableCache, readableCache, writeWatching,
+ peekWatching, clearWatching, writeMixins,
+ peekMixins, clearMixins, writeBindings,
+ peekBindings, clearBindings, writeValues,
+ peekValues, clearValues, writeDeps, forEachInDeps
writableChainWatchers, readableChainWatchers, writableChains,
readableChains
*/
var members = {
@@ -16769,47 +17013,68 @@
// values.
function inheritedMap(name, Meta) {
var key = memberProperty(name);
var capitalized = capitalize(name);
- Meta.prototype['writable' + capitalized] = function () {
- return this._getOrCreateInheritedMap(key);
+ Meta.prototype['write' + capitalized] = function (subkey, value) {
+ var map = this._getOrCreateOwnMap(key);
+ map[subkey] = value;
};
- Meta.prototype['readable' + capitalized] = function () {
- return this._getInherited(key);
+ Meta.prototype['peek' + capitalized] = function (subkey) {
+ return this._findInherited(key, subkey);
};
- Meta.prototype['peek' + capitalized] = function (subkey) {
- var map = this._getInherited(key);
- if (map) {
- return map[subkey];
+ Meta.prototype['forEach' + capitalized] = function (fn) {
+ var pointer = this;
+ var seen = new _emberMetalEmpty_object.default();
+ while (pointer !== undefined) {
+ var map = pointer[key];
+ if (map) {
+ for (var _key in map) {
+ if (!seen[_key]) {
+ seen[_key] = true;
+ fn(_key, map[_key]);
+ }
+ }
+ }
+ pointer = pointer.parent;
}
};
Meta.prototype['clear' + capitalized] = function () {
this[key] = new _emberMetalEmpty_object.default();
};
+
+ Meta.prototype['deleteFrom' + capitalized] = function (subkey) {
+ delete this._getOrCreateOwnMap(key)[subkey];
+ };
+
+ Meta.prototype['hasIn' + capitalized] = function (subkey) {
+ return this._findInherited(key, subkey) !== undefined;
+ };
}
- 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();
+ Meta.prototype._getInherited = function (key) {
+ var pointer = this;
+ while (pointer !== undefined) {
+ if (pointer[key]) {
+ return pointer[key];
}
+ pointer = pointer.parent;
}
- return ret;
};
- Meta.prototype._getInherited = function (key) {
+ Meta.prototype._findInherited = function (key, subkey) {
var pointer = this;
while (pointer !== undefined) {
- if (pointer[key]) {
- return pointer[key];
+ var map = pointer[key];
+ if (map) {
+ var value = map[subkey];
+ if (value !== undefined) {
+ return value;
+ }
}
pointer = pointer.parent;
}
};
@@ -16817,33 +17082,79 @@
// 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);
+ Meta.prototype['write' + capitalized] = function (subkey, itemkey, value) {
+ var outerMap = this._getOrCreateOwnMap(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;
+ innerMap[itemkey] = value;
};
- Meta.prototype['readable' + capitalized] = function (subkey) {
- var map = this._getInherited(key);
- if (map) {
- return map[subkey];
+ Meta.prototype['peek' + capitalized] = function (subkey, itemkey) {
+ var pointer = this;
+ while (pointer !== undefined) {
+ var map = pointer[key];
+ if (map) {
+ var value = map[subkey];
+ if (value) {
+ if (value[itemkey] !== undefined) {
+ return value[itemkey];
+ }
+ }
+ }
+ pointer = pointer.parent;
}
};
- Meta.prototype['getAll' + capitalized] = function () {
- return this._getInherited(key);
+ Meta.prototype['has' + capitalized] = function (subkey) {
+ var pointer = this;
+ while (pointer !== undefined) {
+ if (pointer[key] && pointer[key][subkey]) {
+ return true;
+ }
+ pointer = pointer.parent;
+ }
+ return false;
};
+
+ Meta.prototype['forEachIn' + capitalized] = function (subkey, fn) {
+ return this._forEachIn(key, subkey, fn);
+ };
}
+ Meta.prototype._forEachIn = function (key, subkey, fn) {
+ var pointer = this;
+ var seen = new _emberMetalEmpty_object.default();
+ var calls = [];
+ while (pointer !== undefined) {
+ var map = pointer[key];
+ if (map) {
+ var innerMap = map[subkey];
+ if (innerMap) {
+ for (var innerKey in innerMap) {
+ if (!seen[innerKey]) {
+ seen[innerKey] = true;
+ calls.push([innerKey, innerMap[innerKey]]);
+ }
+ }
+ }
+ }
+ pointer = pointer.parent;
+ }
+ for (var i = 0; i < calls.length; i++) {
+ var _calls$i = calls[i];
+ var innerKey = _calls$i[0];
+ var value = _calls$i[1];
+
+ fn(innerKey, value);
+ }
+ };
+
// 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);
@@ -16908,13 +17219,10 @@
// 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
@@ -16942,55 +17250,224 @@
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);
+ // if `null` already, just set it to the new value
+ // otherwise define property first
+ if (obj.__ember_meta__ !== null) {
+ 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/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) {
+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/error', 'ember-metal/debug', 'ember-metal/assign', '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, _emberMetalError, _emberMetalDebug, _emberMetalAssign, _emberMetalEmpty_object, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalUtils, _emberMetalMeta, _emberMetalExpand_properties, _emberMetalProperties, _emberMetalComputed, _emberMetalBinding, _emberMetalObserver, _emberMetalEvents, _emberMetalStreamsUtils) {
+ 'no use strict';
// Remove "use strict"; from transpiled module until
// https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
- //
-
+
+ /**
+ @module ember
+ @submodule ember-metal
+ */
+
exports.mixin = mixin;
exports.default = Mixin;
exports.required = required;
exports.aliasMethod = aliasMethod;
exports.observer = observer;
exports._immediateObserver = _immediateObserver;
- exports._beforeObserver = _beforeObserver;
- 'REMOVE_USE_STRICT: true';
- /**
- @module ember
- @submodule ember-metal
- */
-
function ROOT() {}
ROOT.__hasSuper = false;
var REQUIRED;
var a_slice = [].slice;
- function mixinsMeta(obj) {
- return _emberMetalMeta.meta(obj, true).writableMixins();
- }
-
function isMethod(obj) {
return 'function' === typeof obj && obj.isMethod !== false && obj !== Boolean && obj !== Object && obj !== Number && obj !== Array && obj !== Date && obj !== String;
}
var CONTINUE = {};
@@ -16998,14 +17475,14 @@
function mixinProperties(mixinsMeta, mixin) {
var guid;
if (mixin instanceof Mixin) {
guid = _emberMetalUtils.guidFor(mixin);
- if (mixinsMeta[guid]) {
+ if (mixinsMeta.peekMixins(guid)) {
return CONTINUE;
}
- mixinsMeta[guid] = mixin;
+ mixinsMeta.writeMixins(guid, mixin);
return mixin.properties;
} else {
return mixin; // apply anonymous mixin properties
}
}
@@ -17100,16 +17577,15 @@
}
function applyMergedProperties(obj, key, value, values) {
var baseValue = values[key] || obj[key];
-
if (!baseValue) {
return value;
}
- var newBase = _emberMetalMerge.default({}, baseValue);
+ var newBase = _emberMetalAssign.default({}, baseValue);
var hasFunction = false;
for (var prop in value) {
if (!value.hasOwnProperty(prop)) {
continue;
@@ -17168,11 +17644,11 @@
delete values[keyName];
}
for (var i = 0, l = mixins.length; i < l; i++) {
currentMixin = mixins[i];
-
+
props = mixinProperties(m, currentMixin);
if (props === CONTINUE) {
continue;
}
@@ -17207,11 +17683,11 @@
var IS_BINDING = /^.+Binding$/;
function detectBinding(obj, key, value, m) {
if (IS_BINDING.test(key)) {
- m.writableBindings()[key] = value;
+ m.writeBindings(key, value);
}
}
function connectStreamBinding(obj, key, stream) {
var onNotify = function (stream) {
@@ -17238,34 +17714,29 @@
obj._streamBindingSubscriptions[key] = onNotify;
}
function connectBindings(obj, m) {
// TODO Mixin.apply(instance) should disconnect binding if exists
- var bindings = m.readableBindings();
- var key, binding, to;
- if (bindings) {
- for (key in bindings) {
- binding = bindings[key];
- if (binding) {
- to = key.slice(0, -7); // strip Binding off end
- if (_emberMetalStreamsUtils.isStream(binding)) {
- connectStreamBinding(obj, to, binding);
- continue;
- } else if (binding instanceof _emberMetalBinding.Binding) {
- binding = binding.copy(); // copy prototypes' instance
- binding.to(to);
- } else {
- // binding is string path
- binding = new _emberMetalBinding.Binding(to, binding);
- }
- binding.connect(obj);
- obj[key] = binding;
+ m.forEachBindings(function (key, binding) {
+ if (binding) {
+ var to = key.slice(0, -7); // strip Binding off end
+ if (_emberMetalStreamsUtils.isStream(binding)) {
+ connectStreamBinding(obj, to, binding);
+ return;
+ } else if (binding instanceof _emberMetalBinding.Binding) {
+ binding = binding.copy(); // copy prototypes' instance
+ binding.to(to);
+ } else {
+ // binding is string path
+ binding = new _emberMetalBinding.Binding(to, binding);
}
+ binding.connect(obj);
+ obj[key] = binding;
}
- // mark as applied
- m.clearBindings();
- }
+ });
+ // mark as applied
+ m.clearBindings();
}
function finishPartial(obj, m) {
connectBindings(obj, m || _emberMetalMeta.meta(obj));
return obj;
@@ -17301,17 +17772,15 @@
function replaceObserversAndListeners(obj, key, observerOrListener) {
var prev = obj[key];
if ('function' === typeof prev) {
- updateObserversAndListeners(obj, key, prev, '__ember_observesBefore__', _emberMetalObserver._removeBeforeObserver);
updateObserversAndListeners(obj, key, prev, '__ember_observes__', _emberMetalObserver.removeObserver);
updateObserversAndListeners(obj, key, prev, '__ember_listens__', _emberMetalEvents.removeListener);
}
if ('function' === typeof observerOrListener) {
- updateObserversAndListeners(obj, key, observerOrListener, '__ember_observesBefore__', _emberMetalObserver._addBeforeObserver);
updateObserversAndListeners(obj, key, observerOrListener, '__ember_observes__', _emberMetalObserver.addObserver);
updateObserversAndListeners(obj, key, observerOrListener, '__ember_listens__', _emberMetalEvents.addListener);
}
}
@@ -17329,11 +17798,11 @@
// * Handle concatenated properties
// * Handle merged properties
// * Set up _super wrapping if necessary
// * Set up computed property descriptors
// * Copying `toString` in broken browsers
- mergeMixins(mixins, mixinsMeta(obj), descs, values, obj, keys);
+ mergeMixins(mixins, m, descs, values, obj, keys);
for (var i = 0, l = keys.length; i < l; i++) {
key = keys[i];
if (key === 'constructor' || !values.hasOwnProperty(key)) {
continue;
@@ -17519,11 +17988,11 @@
var mixins = this.mixins;
var idx;
for (idx = 0; idx < len; idx++) {
currentMixin = arguments[idx];
-
+
if (currentMixin instanceof Mixin) {
mixins.push(currentMixin);
} else {
mixins.push(new Mixin(undefined, currentMixin));
}
@@ -17633,25 +18102,21 @@
// 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.readableMixins();
var ret = [];
-
- if (!mixins) {
+ if (!m) {
return ret;
}
- for (var key in mixins) {
- var currentMixin = mixins[key];
-
+ m.forEachMixins(function (key, currentMixin) {
// skip primitive mixins since these are always anonymous
if (!currentMixin.properties) {
ret.push(currentMixin);
}
- }
+ });
return ret;
};
exports.REQUIRED = REQUIRED = new _emberMetalProperties.Descriptor();
@@ -17666,11 +18131,11 @@
@for Ember
@private
*/
function required() {
- return REQUIRED;
+ return REQUIRED;
}
function Alias(methodName) {
this.isDescriptor = true;
this.methodName = methodName;
@@ -17738,30 +18203,31 @@
var func = args.slice(-1)[0];
var paths;
var addWatchedProperty = function (path) {
-
+
paths.push(path);
};
var _paths = args.slice(0, -1);
if (typeof func !== 'function') {
- // revert to old, soft-deprecated argument ordering
-
+
func = args[0];
+
+ // revert to old, soft-deprecated argument ordering
_paths = args.slice(1);
}
paths = [];
for (var i = 0; i < _paths.length; ++i) {
_emberMetalExpand_properties.default(_paths[i], addWatchedProperty);
}
if (typeof func !== 'function') {
- throw new _emberMetalCore.default.Error('Ember.observer called without a function');
+ throw new _emberMetalError.default('Ember.observer called without a function');
}
func.__ember_observes__ = paths;
return func;
}
@@ -17791,169 +18257,25 @@
@return func
@private
*/
function _immediateObserver() {
-
+
for (var i = 0, l = arguments.length; i < l; i++) {
var arg = arguments[i];
- }
+ }
return observer.apply(this, arguments);
}
- /**
- When observers fire, they are called with the arguments `obj`, `keyName`.
-
- Note, `@each.property` observer is called per each add or replace of an element
- and it's not called with a specific enumeration item.
-
- A `_beforeObserver` fires before a property changes.
-
- A `_beforeObserver` is an alternative form of `.observesBefore()`.
-
- ```javascript
- App.PersonView = Ember.View.extend({
- friends: [{ name: 'Tom' }, { name: 'Stefan' }, { name: 'Kris' }],
-
- valueDidChange: Ember.observer('content.value', function(obj, keyName) {
- // only run if updating a value already in the DOM
- if (this.get('state') === 'inDOM') {
- var color = obj.get(keyName) > this.changingFrom ? 'green' : 'red';
- // logic
- }
- }),
-
- friendsDidChange: Ember.observer('friends.@each.name', function(obj, keyName) {
- // some logic
- // obj.get(keyName) returns friends array
- })
- });
- ```
-
- Also available as `Function.prototype.observesBefore` if prototype extensions are
- enabled.
-
- @method beforeObserver
- @for Ember
- @param {String} propertyNames*
- @param {Function} func
- @return func
- @deprecated
- @private
- */
-
- function _beforeObserver() {
- for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
- args[_key5] = arguments[_key5];
- }
-
- var func = args.slice(-1)[0];
- var paths;
-
- var addWatchedProperty = function (path) {
- paths.push(path);
- };
-
- var _paths = args.slice(0, -1);
-
- if (typeof func !== 'function') {
- // revert to old, soft-deprecated argument ordering
-
- func = args[0];
- _paths = args.slice(1);
- }
-
- paths = [];
-
- for (var i = 0; i < _paths.length; ++i) {
- _emberMetalExpand_properties.default(_paths[i], addWatchedProperty);
- }
-
- if (typeof func !== 'function') {
- throw new _emberMetalCore.default.Error('Ember.beforeObserver called without a function');
- }
-
- func.__ember_observesBefore__ = paths;
- return func;
- }
-
exports.IS_BINDING = IS_BINDING;
exports.Mixin = Mixin;
exports.required = required;
exports.REQUIRED = REQUIRED;
});
// warn, assert, wrap, et;
-enifed('ember-metal/observer_set', ['exports', 'ember-metal/utils', 'ember-metal/events'], function (exports, _emberMetalUtils, _emberMetalEvents) {
- 'use strict';
-
- /*
- this.observerSet = {
- [senderGuid]: { // variable name: `keySet`
- [keyName]: listIndex
- }
- },
- this.observers = [
- {
- sender: obj,
- keyName: keyName,
- eventName: eventName,
- listeners: [
- [target, method, flags]
- ]
- },
- ...
- ]
- */
- exports.default = ObserverSet;
-
- function ObserverSet() {
- this.clear();
- }
-
- ObserverSet.prototype.add = function (sender, keyName, eventName) {
- var observerSet = this.observerSet;
- var observers = this.observers;
- var senderGuid = _emberMetalUtils.guidFor(sender);
- var keySet = observerSet[senderGuid];
- var index;
-
- if (!keySet) {
- observerSet[senderGuid] = keySet = {};
- }
- index = keySet[keyName];
- if (index === undefined) {
- index = observers.push({
- sender: sender,
- keyName: keyName,
- eventName: eventName,
- listeners: []
- }) - 1;
- keySet[keyName] = index;
- }
- return observers[index].listeners;
- };
-
- ObserverSet.prototype.flush = function () {
- var observers = this.observers;
- var i, len, observer, sender;
- this.clear();
- for (i = 0, len = observers.length; i < len; ++i) {
- observer = observers[i];
- sender = observer.sender;
- if (sender.isDestroying || sender.isDestroyed) {
- continue;
- }
- _emberMetalEvents.sendEvent(sender, observer.eventName, [sender, observer.keyName], observer.listeners);
- }
- };
-
- ObserverSet.prototype.clear = function () {
- this.observerSet = {};
- this.observers = [];
- };
-});
+// use conditional to avoid stringifying every time
enifed('ember-metal/observer', ['exports', 'ember-metal/watching', 'ember-metal/events'], function (exports, _emberMetalWatching, _emberMetalEvents) {
'use strict';
exports.addObserver = addObserver;
exports.observersFor = observersFor;
@@ -18064,10 +18386,79 @@
_emberMetalEvents.removeListener(obj, beforeEvent(path), target, method);
return this;
}
});
+enifed('ember-metal/observer_set', ['exports', 'ember-metal/utils', 'ember-metal/events'], function (exports, _emberMetalUtils, _emberMetalEvents) {
+ 'use strict';
+
+ /*
+ this.observerSet = {
+ [senderGuid]: { // variable name: `keySet`
+ [keyName]: listIndex
+ }
+ },
+ this.observers = [
+ {
+ sender: obj,
+ keyName: keyName,
+ eventName: eventName,
+ listeners: [
+ [target, method, flags]
+ ]
+ },
+ ...
+ ]
+ */
+ exports.default = ObserverSet;
+
+ function ObserverSet() {
+ this.clear();
+ }
+
+ ObserverSet.prototype.add = function (sender, keyName, eventName) {
+ var observerSet = this.observerSet;
+ var observers = this.observers;
+ var senderGuid = _emberMetalUtils.guidFor(sender);
+ var keySet = observerSet[senderGuid];
+ var index;
+
+ if (!keySet) {
+ observerSet[senderGuid] = keySet = {};
+ }
+ index = keySet[keyName];
+ if (index === undefined) {
+ index = observers.push({
+ sender: sender,
+ keyName: keyName,
+ eventName: eventName,
+ listeners: []
+ }) - 1;
+ keySet[keyName] = index;
+ }
+ return observers[index].listeners;
+ };
+
+ ObserverSet.prototype.flush = function () {
+ var observers = this.observers;
+ var i, len, observer, sender;
+ this.clear();
+ for (i = 0, len = observers.length; i < len; ++i) {
+ observer = observers[i];
+ sender = observer.sender;
+ if (sender.isDestroying || sender.isDestroyed) {
+ continue;
+ }
+ _emberMetalEvents.sendEvent(sender, observer.eventName, [sender, observer.keyName], observer.listeners);
+ }
+ };
+
+ ObserverSet.prototype.clear = function () {
+ this.observerSet = {};
+ this.observers = [];
+ };
+});
enifed('ember-metal/path_cache', ['exports', 'ember-metal/cache'], function (exports, _emberMetalCache) {
'use strict';
exports.isGlobal = isGlobal;
exports.isGlobalPath = isGlobalPath;
@@ -18145,11 +18536,11 @@
function getTailPath(path) {
return tailPathCache.get(path);
}
});
-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) {
+enifed('ember-metal/properties', ['exports', 'ember-metal/debug', 'ember-metal/features', 'ember-metal/meta', 'ember-metal/property_events'], function (exports, _emberMetalDebug, _emberMetalFeatures, _emberMetalMeta, _emberMetalProperty_events) {
/**
@module ember-metal
*/
'use strict';
@@ -18178,12 +18569,11 @@
// ..........................................................
// DEFINING PROPERTIES API
//
function MANDATORY_SETTER_FUNCTION(name) {
- return function SETTER_FUNCTION(value) {
- };
+ return function SETTER_FUNCTION(value) {};
}
function DEFAULT_GETTER_FUNCTION(name) {
return function GETTER_FUNCTION() {
var meta = this['__ember_meta__'];
@@ -18254,39 +18644,20 @@
}
if (desc instanceof Descriptor) {
value = desc;
- if (watching) {
- Object.defineProperty(obj, keyName, {
- configurable: true,
- enumerable: true,
- writable: true,
- value: value
- });
- } else {
- obj[keyName] = value;
- }
+ obj[keyName] = value;
if (desc.setup) {
desc.setup(obj, keyName);
}
} else {
if (desc == null) {
value = data;
- if (watching) {
- meta.writableValues()[keyName] = data;
- Object.defineProperty(obj, keyName, {
- configurable: true,
- enumerable: true,
- set: MANDATORY_SETTER_FUNCTION(keyName),
- get: DEFAULT_GETTER_FUNCTION(keyName)
- });
- } else {
- obj[keyName] = data;
- }
+ obj[keyName] = data;
} else {
value = desc;
// fallback to ES5
Object.defineProperty(obj, keyName, desc);
@@ -18400,11 +18771,11 @@
if (!watching && keyName !== 'length') {
return;
}
- if (m && m.readableDeps(keyName)) {
+ if (m && m.hasDeps(keyName)) {
dependentKeysDidChange(obj, keyName, m);
}
chainsDidChange(obj, keyName, m, false);
notifyObservers(obj, keyName);
@@ -18415,20 +18786,19 @@
function dependentKeysWillChange(obj, depKey, meta) {
if (obj.isDestroying) {
return;
}
- var deps;
- if (meta && (deps = meta.readableDeps(depKey))) {
+ if (meta && meta.hasDeps(depKey)) {
var seen = WILL_SEEN;
var top = !seen;
if (top) {
seen = WILL_SEEN = {};
}
- iterDeps(propertyWillChange, obj, deps, depKey, seen, meta);
+ iterDeps(propertyWillChange, obj, depKey, seen, meta);
if (top) {
WILL_SEEN = null;
}
}
@@ -18438,39 +18808,28 @@
function dependentKeysDidChange(obj, depKey, meta) {
if (obj.isDestroying) {
return;
}
- var deps;
- if (meta && (deps = meta.readableDeps(depKey))) {
+ if (meta && meta.hasDeps(depKey)) {
var seen = DID_SEEN;
var top = !seen;
if (top) {
seen = DID_SEEN = {};
}
- iterDeps(propertyDidChange, obj, deps, depKey, seen, meta);
+ iterDeps(propertyDidChange, obj, depKey, seen, meta);
if (top) {
DID_SEEN = null;
}
}
}
- function keysOf(obj) {
- var keys = [];
-
- for (var key in obj) {
- keys.push(key);
- }
-
- return keys;
- }
-
- function iterDeps(method, obj, deps, depKey, seen, meta) {
- var keys, key, i, possibleDesc, desc;
+ function iterDeps(method, obj, depKey, seen, meta) {
+ var possibleDesc, desc;
var guid = _emberMetalUtils.guidFor(obj);
var current = seen[guid];
if (!current) {
current = seen[guid] = {};
@@ -18480,29 +18839,24 @@
return;
}
current[depKey] = true;
- if (deps) {
- keys = keysOf(deps);
- for (i = 0; i < keys.length; i++) {
- key = keys[i];
+ meta.forEachInDeps(depKey, function (key, value) {
+ if (!value) {
+ return;
+ }
- if (!deps[key]) {
- continue;
- }
+ possibleDesc = obj[key];
+ desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
- possibleDesc = obj[key];
- desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
-
- if (desc && desc._suspended === obj) {
- continue;
- }
-
- method(obj, key);
+ if (desc && desc._suspended === obj) {
+ return;
}
- }
+
+ method(obj, key);
+ });
}
function chainsWillChange(obj, keyName, m) {
var c = m.readableChainWatchers();
if (c) {
@@ -18606,11 +18960,11 @@
exports.overrideChains = overrideChains;
exports.beginPropertyChanges = beginPropertyChanges;
exports.endPropertyChanges = endPropertyChanges;
exports.changeProperties = changeProperties;
});
-enifed('ember-metal/property_get', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/error', 'ember-metal/path_cache'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalError, _emberMetalPath_cache) {
+enifed('ember-metal/property_get', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/features', 'ember-metal/error', 'ember-metal/path_cache'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalFeatures, _emberMetalError, _emberMetalPath_cache) {
/**
@module ember-metal
*/
'use strict';
@@ -18654,11 +19008,11 @@
@return {Object} the property value or `null`.
@public
*/
function get(obj, keyName) {
-
+
// Helpers that operate with 'this' within an #each
if (keyName === '') {
return obj;
}
@@ -18672,15 +19026,11 @@
}
if (desc) {
return desc.get(obj, keyName);
} else {
- if (meta && meta.peekWatching(keyName) > 0) {
- ret = meta.peekValues(keyName);
- } else {
- ret = obj[keyName];
- }
+ ret = obj[keyName];
if (ret === undefined && 'object' === typeof obj && !(keyName in obj) && 'function' === typeof obj.unknownProperty) {
return obj.unknownProperty(keyName);
}
@@ -18770,11 +19120,11 @@
return value;
}
exports.default = get;
});
-enifed('ember-metal/property_set', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/property_events', 'ember-metal/properties', 'ember-metal/error', 'ember-metal/path_cache'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_events, _emberMetalProperties, _emberMetalError, _emberMetalPath_cache) {
+enifed('ember-metal/property_set', ['exports', 'ember-metal/debug', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/property_events', 'ember-metal/properties', 'ember-metal/error', 'ember-metal/path_cache'], function (exports, _emberMetalDebug, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_events, _emberMetalProperties, _emberMetalError, _emberMetalPath_cache) {
'use strict';
exports.set = set;
exports.trySet = trySet;
@@ -18792,11 +19142,11 @@
@return {Object} the passed value.
@public
*/
function set(obj, keyName, value, tolerant) {
-
+
var meta, possibleDesc, desc;
if (obj) {
meta = obj['__ember_meta__'];
possibleDesc = obj[keyName];
desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
@@ -18805,11 +19155,10 @@
var isUnknown, currentValue;
if (desc === undefined && _emberMetalPath_cache.isPath(keyName)) {
return setPath(obj, keyName, value, tolerant);
}
-
if (desc) {
desc.set(obj, keyName, value);
} else {
if (value !== undefined && typeof obj === 'object' && obj[keyName] === value) {
return value;
@@ -18822,21 +19171,17 @@
// `setUnknownProperty` method exists on the object
if (isUnknown && 'function' === typeof obj.setUnknownProperty) {
obj.setUnknownProperty(keyName, value);
} else if (meta && meta.peekWatching(keyName) > 0) {
if (meta.proto !== obj) {
- currentValue = meta.peekValues(keyName);
+ currentValue = obj[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.writableValues()[keyName] = value;
- }
+ obj[keyName] = value;
_emberMetalProperty_events.propertyDidChange(obj, keyName);
}
} else {
obj[keyName] = value;
@@ -18895,10 +19240,11 @@
function trySet(root, path, value) {
return set(root, path, value, true);
}
});
+// setup mandatory setter
enifed("ember-metal/replace", ["exports"], function (exports) {
"use strict";
exports._replace = _replace;
exports.default = replace;
@@ -18964,11 +19310,11 @@
} else {
return _replace(array, idx, amt, objects);
}
}
});
-enifed('ember-metal/run_loop', ['exports', 'ember-metal/core', 'ember-metal/utils', 'ember-metal/property_events', 'backburner'], function (exports, _emberMetalCore, _emberMetalUtils, _emberMetalProperty_events, _backburner) {
+enifed('ember-metal/run_loop', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/utils', 'ember-metal/property_events', 'backburner'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalUtils, _emberMetalProperty_events, _backburner) {
'use strict';
exports.default = run;
function onBegin(current) {
@@ -19614,12 +19960,11 @@
return backburner.throttle.apply(backburner, arguments);
};
// Make sure it's not an autorun during testing
function checkAutoRun() {
- if (!run.currentRunLoop) {
- }
+ if (!run.currentRunLoop) {}
}
/**
Add a new named queue after the specified queue.
@@ -19678,11 +20023,11 @@
}
});
return properties;
}
});
-enifed('ember-metal/streams/dependency', ['exports', 'ember-metal/core', 'ember-metal/merge', 'ember-metal/streams/utils'], function (exports, _emberMetalCore, _emberMetalMerge, _emberMetalStreamsUtils) {
+enifed('ember-metal/streams/dependency', ['exports', 'ember-metal/debug', 'ember-metal/assign', 'ember-metal/streams/utils'], function (exports, _emberMetalDebug, _emberMetalAssign, _emberMetalStreamsUtils) {
'use strict';
/**
@module ember-metal
*/
@@ -19692,21 +20037,21 @@
@class Dependency
@namespace Ember.streams
@constructor
*/
function Dependency(depender, dependee) {
-
+
this.next = null;
this.prev = null;
this.depender = depender;
this.dependee = dependee;
this.unsubscription = null;
}
- _emberMetalMerge.default(Dependency.prototype, {
+ _emberMetalAssign.default(Dependency.prototype, {
subscribe: function () {
-
+
this.unsubscription = _emberMetalStreamsUtils.subscribe(this.dependee, this.depender.notify, this.depender);
},
unsubscribe: function () {
if (this.unsubscription) {
@@ -19721,11 +20066,13 @@
if (this.unsubscription) {
this.unsubscribe();
this.subscribe();
}
+ return true;
}
+ return false;
},
getValue: function () {
return _emberMetalStreamsUtils.read(this.dependee);
},
@@ -19754,33 +20101,26 @@
// }
});
exports.default = Dependency;
});
-enifed('ember-metal/streams/key-stream', ['exports', 'ember-metal/core', 'ember-metal/merge', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/observer', 'ember-metal/streams/stream', 'ember-metal/streams/utils'], function (exports, _emberMetalCore, _emberMetalMerge, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalObserver, _emberMetalStreamsStream, _emberMetalStreamsUtils) {
+enifed('ember-metal/streams/key-stream', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/observer', 'ember-metal/streams/stream', 'ember-metal/streams/utils'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalObserver, _emberMetalStreamsStream, _emberMetalStreamsUtils) {
'use strict';
- function KeyStream(source, key) {
- // TODO: This isn't necessary.
-
- // used to get the original path for debugging and legacy purposes
- var label = labelFor(source, key);
+ var KeyStream = _emberMetalStreamsStream.default.extend({
+ init: function (source, key) {
+ // TODO: This isn't necessary.
- this.init(label);
- this.path = label;
- this.sourceDep = this.addMutableDependency(source);
- this.observedObject = null;
- this.key = key;
- }
+ var label = labelFor(source, key);
- function labelFor(source, key) {
- return source.label ? source.label + '.' + key : key;
- }
+ this.path = label;
+ this.observedObject = null;
+ this.key = key;
+ this.sourceDep = this.addMutableDependency(source);
+ this.label = label;
+ },
- KeyStream.prototype = Object.create(_emberMetalStreamsStream.default.prototype);
-
- _emberMetalMerge.default(KeyStream.prototype, {
compute: function () {
var object = this.sourceDep.getValue();
if (object) {
return _emberMetalProperty_get.get(object, this.key);
}
@@ -19827,64 +20167,74 @@
this._super$deactivate();
this._clearObservedObject();
}
});
+ function labelFor(source, key) {
+ return source.label ? source.label + '.' + key : key;
+ }
+
exports.default = KeyStream;
});
-enifed('ember-metal/streams/proxy-stream', ['exports', 'ember-metal/merge', 'ember-metal/streams/stream'], function (exports, _emberMetalMerge, _emberMetalStreamsStream) {
+enifed('ember-metal/streams/proxy-stream', ['exports', 'ember-runtime/system/object', 'ember-metal/streams/stream'], function (exports, _emberRuntimeSystemObject, _emberMetalStreamsStream) {
'use strict';
- function ProxyStream(source, label) {
- this.init(label);
- this.sourceDep = this.addMutableDependency(source);
- }
+ var ProxyStream = _emberMetalStreamsStream.default.extend({
+ init: function (source, label) {
+ this.label = label;
+ this.sourceDep = this.addMutableDependency(source);
+ },
- ProxyStream.prototype = Object.create(_emberMetalStreamsStream.default.prototype);
-
- _emberMetalMerge.default(ProxyStream.prototype, {
compute: function () {
return this.sourceDep.getValue();
},
setValue: function (value) {
this.sourceDep.setValue(value);
},
setSource: function (source) {
- this.sourceDep.replace(source);
- this.notify();
+ var didChange = this.sourceDep.replace(source);
+ if (didChange || !(source instanceof _emberRuntimeSystemObject.default)) {
+ // If the source changed, we must notify. If the source is not
+ // an Ember.Object, we must also notify, because it could have
+ // interior mutability that is otherwise not being observed.
+ this.notify();
+ }
}
});
+ ProxyStream.extend = _emberMetalStreamsStream.default.extend;
+
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/empty_object', 'ember-metal/streams/subscriber', 'ember-metal/streams/dependency'], function (exports, _emberMetalCore, _emberMetalPath_cache, _emberMetalObserver, _emberMetalStreamsUtils, _emberMetalEmpty_object, _emberMetalStreamsSubscriber, _emberMetalStreamsDependency) {
+enifed('ember-metal/streams/stream', ['exports', 'ember-metal/core', 'ember-metal/assign', 'ember-metal/debug', 'ember-metal/path_cache', 'ember-metal/observer', 'ember-metal/streams/utils', 'ember-metal/empty_object', 'ember-metal/streams/subscriber', 'ember-metal/streams/dependency', 'ember-metal/utils'], function (exports, _emberMetalCore, _emberMetalAssign, _emberMetalDebug, _emberMetalPath_cache, _emberMetalObserver, _emberMetalStreamsUtils, _emberMetalEmpty_object, _emberMetalStreamsSubscriber, _emberMetalStreamsDependency, _emberMetalUtils) {
'use strict';
+ exports.wrap = wrap;
+
/**
@module ember-metal
*/
/**
@private
@class Stream
@namespace Ember.stream
@constructor
*/
- function Stream(fn, label) {
- this.init(label);
- this.compute = fn;
+ function BasicStream(label) {
+ this._init(label);
}
var KeyStream;
var ProxyMixin;
- Stream.prototype = {
+ BasicStream.prototype = {
isStream: true,
- init: function (label) {
+ _init: function (label) {
this.label = makeLabel(label);
this.isActive = false;
this.isDirty = true;
this.isDestroyed = false;
this.cache = undefined;
@@ -19892,10 +20242,12 @@
this.subscriberHead = null;
this.subscriberTail = null;
this.dependencyHead = null;
this.dependencyTail = null;
this.observedProxy = null;
+ this.__ember_meta__ = null;
+ this[_emberMetalUtils.GUID_KEY] = null;
},
_makeChildStream: function (key) {
KeyStream = KeyStream || _emberMetalCore.default.__loader.require('ember-metal/streams/key-stream').default;
return new KeyStream(this, key);
@@ -19944,11 +20296,11 @@
value: function () {
// TODO: Ensure value is never called on a destroyed stream
// so that we can uncomment this assertion.
//
- // Ember.assert("Stream error: value was called after the stream was destroyed", !this.isDestroyed);
+ // assert("Stream error: value was called after the stream was destroyed", !this.isDestroyed);
// TODO: Remove this block. This will require ensuring we are
// not treating streams as "volatile" anywhere.
if (!this.isActive) {
this.isDirty = true;
@@ -20075,11 +20427,11 @@
this.notifySubscribers(callbackToSkip, contextToSkip);
}
},
subscribe: function (callback, context) {
-
+
var subscriber = new _emberMetalStreamsSubscriber.default(callback, context, this);
if (this.subscriberHead === null) {
this.subscriberHead = this.subscriberTail = subscriber;
} else {
var tail = this.subscriberTail;
@@ -20151,35 +20503,59 @@
for (var i = 0, l = dependencies.length; i < l; i++) {
dependencies[i](prune);
}
}
- this.dependencies = null;
return true;
}
}
};
- Stream.wrap = function (value, Kind, param) {
+ BasicStream.extend = function (object) {
+ var Child = function () {
+ this._init();
+ this.init.apply(this, arguments);
+ };
+
+ Child.prototype = Object.create(this.prototype);
+
+ _emberMetalAssign.default(Child.prototype, object);
+ Child.extend = BasicStream.extend;
+ return Child;
+ };
+
+ var Stream = BasicStream.extend({
+ init: function (fn, label) {
+ this._compute = fn;
+ this.label = label;
+ },
+
+ compute: function () {
+ return this._compute();
+ }
+ });
+
+ function wrap(value, Kind, param) {
if (_emberMetalStreamsUtils.isStream(value)) {
return value;
} else {
return new Kind(value, param);
}
- };
+ }
function makeLabel(label) {
if (label === undefined) {
return '(no label)';
} else {
return label;
}
}
- exports.default = Stream;
+ exports.default = BasicStream;
+ exports.Stream = Stream;
});
-enifed('ember-metal/streams/subscriber', ['exports', 'ember-metal/merge'], function (exports, _emberMetalMerge) {
+enifed('ember-metal/streams/subscriber', ['exports', 'ember-metal/assign'], function (exports, _emberMetalAssign) {
'use strict';
/**
@module ember-metal
*/
@@ -20195,11 +20571,11 @@
this.prev = null;
this.callback = callback;
this.context = context;
}
- _emberMetalMerge.default(Subscriber.prototype, {
+ _emberMetalAssign.default(Subscriber.prototype, {
removeFrom: function (stream) {
var next = this.next;
var prev = this.prev;
if (prev) {
@@ -20218,11 +20594,11 @@
}
});
exports.default = Subscriber;
});
-enifed('ember-metal/streams/utils', ['exports', 'ember-metal/core', './stream'], function (exports, _emberMetalCore, _stream) {
+enifed('ember-metal/streams/utils', ['exports', 'ember-metal/debug', 'ember-metal/streams/stream'], function (exports, _emberMetalDebug, _emberMetalStreamsStream) {
'use strict';
exports.isStream = isStream;
exports.subscribe = subscribe;
exports.unsubscribe = unsubscribe;
@@ -20403,10 +20779,30 @@
}
return containsStream;
}
+ 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
+ this.isConcat = true;
+ },
+
+ label: function () {
+ var labels = labelsFor(this.array);
+ return 'concat([' + labels.join(', ') + ']; separator=' + inspect(this.separator) + ')';
+ },
+
+ compute: function () {
+ return concat(readArray(this.array), this.separator);
+ }
+ });
+
/*
Join an array, with any streams replaced by their current values
@private
@for Ember.stream
@@ -20422,25 +20818,16 @@
function concat(array, separator) {
// TODO: Create subclass ConcatStream < Stream. Defer
// subscribing to streams until the value() is called.
var hasStream = scanArray(array);
if (hasStream) {
- var i, l;
- var stream = new _stream.default(function () {
- return concat(readArray(array), separator);
- }, function () {
- var labels = labelsFor(array);
- return 'concat([' + labels.join(', ') + ']; separator=' + inspect(separator) + ')';
- });
+ var stream = new ConcatStream(array, separator);
- for (i = 0, l = array.length; i < l; i++) {
- stream.addDependency(array[i]);
+ for (var i = 0, l = array.length; i < l; i++) {
+ addDependency(stream, array[i]);
}
- // used by angle bracket components to detect an attribute was provided
- // as a string literal
- stream.isConcat = true;
return stream;
} else {
return array.join(separator);
}
}
@@ -20487,11 +20874,11 @@
return String(value);
}
}
function or(first, second) {
- var stream = new _stream.default(function () {
+ var stream = new _emberMetalStreamsStream.Stream(function () {
return first.value() || second.value();
}, function () {
return labelFor(first) + ' || ' + labelFor(second);
});
@@ -20500,18 +20887,18 @@
return stream;
}
function addDependency(stream, dependency) {
- if (isStream(stream)) {
+ if (isStream(stream)) {
stream.addDependency(dependency);
}
}
function zip(streams, callback, label) {
-
- var stream = new _stream.default(function () {
+
+ var stream = new _emberMetalStreamsStream.Stream(function () {
var array = readArray(streams);
return callback ? callback(array) : array;
}, function () {
return label + '(' + labelsFor(streams) + ')';
});
@@ -20522,12 +20909,12 @@
return stream;
}
function zipHash(object, callback, label) {
-
- var stream = new _stream.default(function () {
+
+ var stream = new _emberMetalStreamsStream.Stream(function () {
var hash = readHash(object);
return callback ? callback(hash) : hash;
}, function () {
return label + '(' + labelsForObject(object) + ')';
});
@@ -20571,12 +20958,12 @@
non-stream object, the return value of the provided
function `fn`.
*/
function chain(value, fn, label) {
- if (isStream(value)) {
- var stream = new _stream.default(fn, function () {
+ if (isStream(value)) {
+ var stream = new _emberMetalStreamsStream.Stream(fn, function () {
return label + '(' + labelFor(value) + ')';
});
stream.addDependency(value);
return stream;
} else {
@@ -20592,15 +20979,13 @@
});
enifed("ember-metal/symbol", ["exports"], function (exports) {
"use strict";
});
enifed('ember-metal/utils', ['exports'], function (exports) {
+ 'no use strict';
// Remove "use strict"; from transpiled module until
// https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
- //
-
- 'REMOVE_USE_STRICT: true';
/**
@module ember-metal
*/
@@ -20868,11 +21253,11 @@
var HAS_SUPER_PATTERN = /\.(_super|call\(this|apply\(this)/;
var checkHasSuper = (function () {
var sourceAvailable = (function () {
return this;
- }).toString().indexOf('return this') > -1;
+ }).toString().indexOf('return this;') > -1;
if (sourceAvailable) {
return function checkHasSuper(func) {
return HAS_SUPER_PATTERN.test(func.toString());
};
@@ -20881,11 +21266,10 @@
return function checkHasSuper() {
return true;
};
})();
- exports.checkHasSuper = checkHasSuper;
function ROOT() {}
ROOT.__hasSuper = false;
function hasSuper(func) {
if (func.__hasSuper === undefined) {
@@ -20951,11 +21335,10 @@
return ret;
}
superWrapper.wrappedFunction = func;
superWrapper.__ember_observes__ = func.__ember_observes__;
- superWrapper.__ember_observesBefore__ = func.__ember_observesBefore__;
superWrapper.__ember_listens__ = func.__ember_listens__;
return superWrapper;
}
@@ -21176,99 +21559,53 @@
if (keyName === 'length' && Array.isArray(obj)) {
return;
}
var m = meta || _emberMetalMeta.meta(obj);
- var watching = m.writableWatching();
// activate watching first time
- if (!watching[keyName]) {
- watching[keyName] = 1;
+ if (!m.peekWatching(keyName)) {
+ m.writeWatching(keyName, 1);
var possibleDesc = obj[keyName];
var desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
if (desc && desc.willWatch) {
desc.willWatch(obj, keyName);
}
if ('function' === typeof obj.willWatchProperty) {
obj.willWatchProperty(keyName);
}
-
- handleMandatorySetter(m, obj, keyName);
} else {
- watching[keyName] = (watching[keyName] || 0) + 1;
+ m.writeWatching(keyName, (m.peekWatching(keyName) || 0) + 1);
}
}
- var handleMandatorySetter = function handleMandatorySetter(m, obj, keyName) {
- var descriptor = Object.getOwnPropertyDescriptor && Object.getOwnPropertyDescriptor(obj, keyName);
- var configurable = descriptor ? descriptor.configurable : true;
- var isWritable = descriptor ? descriptor.writable : true;
- var hasValue = descriptor ? 'value' in descriptor : true;
- var possibleDesc = descriptor && descriptor.value;
- var isDescriptor = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor;
-
- if (isDescriptor) {
- return;
- }
-
- // this x in Y deopts, so keeping it in this function is better;
- if (configurable && isWritable && hasValue && keyName in obj) {
- m.writableValues()[keyName] = obj[keyName];
- Object.defineProperty(obj, keyName, {
- configurable: true,
- enumerable: Object.prototype.propertyIsEnumerable.call(obj, keyName),
- set: _emberMetalProperties.MANDATORY_SETTER_FUNCTION(keyName),
- get: _emberMetalProperties.DEFAULT_GETTER_FUNCTION(keyName)
- });
- }
- };
-
- // This is super annoying, but required until
- // https://github.com/babel/babel/issues/906 is resolved
- ; // jshint ignore:line
-
function unwatchKey(obj, keyName, meta) {
var m = meta || _emberMetalMeta.meta(obj);
- var watching = m.writableWatching();
+ var count = m.peekWatching(keyName);
+ if (count === 1) {
+ m.writeWatching(keyName, 0);
- if (watching[keyName] === 1) {
- watching[keyName] = 0;
-
var possibleDesc = obj[keyName];
var desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
if (desc && desc.didUnwatch) {
desc.didUnwatch(obj, keyName);
}
if ('function' === typeof obj.didUnwatchProperty) {
obj.didUnwatchProperty(keyName);
}
-
- if (!desc && keyName in obj) {
- Object.defineProperty(obj, keyName, {
- configurable: true,
- enumerable: Object.prototype.propertyIsEnumerable.call(obj, keyName),
- set: function (val) {
- // redefine to set as enumerable
- Object.defineProperty(obj, keyName, {
- configurable: true,
- writable: true,
- enumerable: true,
- value: val
- });
- delete m.writableValues()[keyName];
- },
- get: _emberMetalProperties.DEFAULT_GETTER_FUNCTION(keyName)
- });
- }
- } else if (watching[keyName] > 1) {
- watching[keyName]--;
+ } else if (count > 1) {
+ m.writeWatching(keyName, count - 1);
}
}
});
+
+// this x in Y deopts, so keeping it in this function is better;
+
+// redefine to set as enumerable
enifed('ember-metal/watch_path', ['exports', 'ember-metal/meta', 'ember-metal/chains'], function (exports, _emberMetalMeta, _emberMetalChains) {
'use strict';
exports.watchPath = watchPath;
exports.unwatchPath = unwatchPath;
@@ -21289,30 +21626,29 @@
if (keyPath === 'length' && Array.isArray(obj)) {
return;
}
var m = meta || _emberMetalMeta.meta(obj);
- var watching = m.writableWatching();
-
- if (!watching[keyPath]) {
+ var counter = m.peekWatching(keyPath) || 0;
+ if (!counter) {
// activate watching first time
- watching[keyPath] = 1;
+ m.writeWatching(keyPath, 1);
chainsFor(obj, m).add(keyPath);
} else {
- watching[keyPath] = (watching[keyPath] || 0) + 1;
+ m.writeWatching(keyPath, counter + 1);
}
}
function unwatchPath(obj, keyPath, meta) {
var m = meta || _emberMetalMeta.meta(obj);
- var watching = m.writableWatching();
+ var counter = m.peekWatching(keyPath) || 0;
- if (watching[keyPath] === 1) {
- watching[keyPath] = 0;
+ if (counter === 1) {
+ m.writeWatching(keyPath, 0);
chainsFor(obj, m).remove(keyPath);
- } else if (watching[keyPath] > 1) {
- watching[keyPath]--;
+ } else if (counter > 1) {
+ m.writeWatching(keyPath, counter - 1);
}
}
});
enifed('ember-metal/watching', ['exports', 'ember-metal/chains', 'ember-metal/watch_key', 'ember-metal/watch_path', 'ember-metal/path_cache'], function (exports, _emberMetalChains, _emberMetalWatch_key, _emberMetalWatch_path, _emberMetalPath_cache) {
/**
@@ -21418,1704 +21754,508 @@
}
}
}
}
});
-enifed('ember-routing-htmlbars', ['exports', 'ember-metal/core', 'ember-htmlbars/helpers', 'ember-htmlbars/keywords', 'ember-routing-htmlbars/helpers/query-params', 'ember-routing-htmlbars/keywords/action', 'ember-routing-htmlbars/keywords/element-action', 'ember-routing-htmlbars/keywords/render'], function (exports, _emberMetalCore, _emberHtmlbarsHelpers, _emberHtmlbarsKeywords, _emberRoutingHtmlbarsHelpersQueryParams, _emberRoutingHtmlbarsKeywordsAction, _emberRoutingHtmlbarsKeywordsElementAction, _emberRoutingHtmlbarsKeywordsRender) {
- /**
- @module ember
- @submodule ember-routing-htmlbars
- */
-
+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';
- _emberHtmlbarsHelpers.registerHelper('query-params', _emberRoutingHtmlbarsHelpersQueryParams.queryParamsHelper);
+ exports.MorphSet = MorphSet;
- _emberHtmlbarsKeywords.registerKeyword('action', _emberRoutingHtmlbarsKeywordsAction.default);
- _emberHtmlbarsKeywords.registerKeyword('@element_action', _emberRoutingHtmlbarsKeywordsElementAction.default);
- _emberHtmlbarsKeywords.registerKeyword('render', _emberRoutingHtmlbarsKeywordsRender.default);
+ function Renderer(domHelper, destinedForDOM) {
+ this._dom = domHelper;
- exports.default = _emberMetalCore.default;
-});
-enifed('ember-routing-htmlbars/helpers/query-params', ['exports', 'ember-metal/core', 'ember-routing/system/query_params'], function (exports, _emberMetalCore, _emberRoutingSystemQuery_params) {
- /**
- @module ember
- @submodule ember-routing-htmlbars
- */
+ // 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;
+ }
- 'use strict';
+ 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');
+ }
+ view.ownerView = renderNode.emberView = view;
+ view._renderNode = renderNode;
- exports.queryParamsHelper = queryParamsHelper;
+ var layout = _emberMetalProperty_get.get(view, 'layout');
+ var template = _emberMetalProperty_get.get(view, 'template');
- /**
- This is a helper to be used in conjunction with the link-to helper.
- It will supply url query parameters to the target route.
-
- Example
-
- ```handlebars
- {{#link-to 'posts' (query-params direction="asc")}}Sort{{/link-to}}
- ```
-
- @method query-params
- @for Ember.Templates.helpers
- @param {Object} hash takes a hash of query parameters
- @return {Object} A `QueryParams` object for `{{link-to}}`
- @public
- */
+ var componentInfo = { component: view, layout: layout };
- function queryParamsHelper(params, hash) {
-
- return _emberRoutingSystemQuery_params.default.create({
- values: hash
- });
- }
-});
-// assert
-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
- */
+ var block = _emberViewsSystemBuildComponentTemplate.default(componentInfo, {}, {
+ self: view,
+ templates: template ? { default: template.raw } : undefined
+ }).block;
- 'use strict';
+ view.renderBlock(block, renderNode);
+ view.lastResult = renderNode.lastResult;
+ this.clearRenderedViews(view.env);
+ };
- /**
- The `{{action}}` helper provides a way to pass triggers for behavior (usually
- just a function) between components, and into components from controllers.
-
- ### Passing functions with the action helper
-
- There are three contexts an action helper can be used in. The first two
- contexts to discuss are attribute context, and Handlebars value context.
-
- ```handlebars
- {{! An example of attribute context }}
- <div onclick={{action "save"}}></div>
- {{! Examples of Handlebars value context }}
- {{input on-input=(action "save")}}
- {{yield (action "refreshData") andAnotherParam}}
- ```
-
- In these contexts,
- the helper is called a "closure action" helper. It's behavior is simple:
- If passed a function name, read that function off the `actions` property
- of the current context. Once that function is read (or if a function was
- passed), create a closure over that function and any arguments.
-
- The resulting value of an action helper used this way is simply a function.
- For example with this attribute context example:
-
- ```handlebars
- {{! An example of attribute context }}
- <div onclick={{action "save"}}></div>
- ```
-
- The resulting template render logic would be:
-
- ```js
- var div = document.createElement('div');
- var actionFunction = (function(context){
- return function() {
- return context.actions.save.apply(context, arguments);
- };
- })(context);
- div.onclick = actionFunction;
- ```
-
- Thus when the div is clicked, the action on that context is called.
- Because the `actionFunction` is just a function, closure actions can be
- passed between components the still execute in the correct context.
-
- Here is an example action handler on a component:
-
- ```js
- export default Ember.Component.extend({
- actions: {
- save(/* event *\/) {
- this.get('model').save();
- }
- }
- });
- ```
-
- Actions are always looked up on the `actions` property of the current context.
- This avoids collisions in the naming of common actions, such as `destroy`.
-
- Two options can be passed to the `action` helper when it is used in this way.
-
- * `target=someProperty` will look to `someProperty` instead of the current
- context for the `actions` hash. This can be useful when targetting a
- service for actions.
- * `value="target.value"` will read the path `target.value` off the first
- argument to the action when it is called and rewrite the first argument
- to be that value. This is useful when attaching actions to event listeners.
-
- ### Invoking an action
-
- Closure actions curry both their scope and any arguments. When invoked, any
- additional arguments are added to the already curried list.
-
- Actions should be invoked using the [sendAction](/api/classes/Ember.Component.html#method_sendAction)
- method. The first argument to `sendAction` is the action to be called, and
- additional arguments are passed to the action function. This has interesting
- properties combined with currying of arguments. For example:
-
- ```js
- export default Ember.Component.extend({
- actions: {
- // Usage {{input on-input=(action (action 'setName' model) value="target.value")}}
- setName(model, name) {
- model.set('name', name);
- }
- }
- });
- ```
-
- The first argument (`model`) was curried over, and the run-time argument (`event`)
- becomes a second argument. Action calls be nested this way because each simply
- returns a function. Any function can be passed to the `{{action` helper, including
- other actions.
-
- Actions invoked with `sendAction` have the same currying behavior as demonstrated
- with `on-input` above. For example:
-
- ```js
- export default Ember.Component.extend({
- actions: {
- setName(model, name) {
- model.set('name', name);
- }
- }
- });
- ```
-
- ```handlebars
- {{my-input submit=(action 'setName' model)}}
- ```
-
- ```js
- // app/components/my-component.js
- export default Ember.Component.extend({
- click() {
- // Note that model is not passed, it was curried in the template
- this.sendAction('submit', 'bob');
- }
- });
- ```
-
- ### Attaching actions to DOM
-
- The third context the `{{action` helper can be used in we call "element space".
- For example:
-
- ```handlebars
- {{! An example of element space }}
- <div {{action "save"}}></div>
- ```
-
- Used this way, the `{{action}}` helper provides a useful shortcut for
- registering an HTML element within a template for a single DOM event and
- forwarding that interaction to the template's context (controller or component).
-
- If the context of a template is a controller, actions used this way will
- bubble to routes when the controller does not implement the specified action.
- Once an action hits a route, it will bubble through the route hierarchy.
-
- ### Event Propagation
-
- `{{action` helpers called in element space can control event bubbling.
-
- Events triggered through the action helper will automatically have
- `.preventDefault()` called on them. You do not need to do so in your event
- handlers. If you need to allow event propagation (to handle file inputs for
- example) you can supply the `preventDefault=false` option to the `{{action}}` helper:
-
- ```handlebars
- <div {{action "sayHello" preventDefault=false}}>
- <input type="file" />
- <input type="checkbox" />
- </div>
- ```
-
- To disable bubbling, pass `bubbles=false` to the helper:
-
- ```handlebars
- <button {{action 'edit' post bubbles=false}}>Edit</button>
- ```
-
- If you need the default handler to trigger you should either register your
- own event handler, or use event methods on your view class. See [Ember.View](/api/classes/Ember.View.html)
- 'Responding to Browser Events' for more information.
-
- ### Specifying DOM event type
-
- `{{action` helpers called in element space can specify an event type.
-
- By default the `{{action}}` helper registers for DOM `click` events. You can
- supply an `on` option to the helper to specify a different DOM event name:
-
- ```handlebars
- <div {{action "anActionName" on="double-click"}}>
- click me
- </div>
- ```
-
- See [Event Names](/api/classes/Ember.View.html#toc_event-names) for a list of
- acceptable DOM event names.
-
- ### Specifying whitelisted modifier keys
-
- `{{action` helpers called in element space can specify modifier keys.
-
- By default the `{{action}}` helper will ignore click event with pressed modifier
- keys. You can supply an `allowedKeys` option to specify which keys should not be ignored.
-
- ```handlebars
- <div {{action "anActionName" allowedKeys="alt"}}>
- click me
- </div>
- ```
-
- This way the `{{action}}` will fire when clicking with the alt key pressed down.
-
- Alternatively, supply "any" to the `allowedKeys` option to accept any combination of modifier keys.
-
- ```handlebars
- <div {{action "anActionName" allowedKeys="any"}}>
- click me with any key pressed
- </div>
- ```
-
- ### Specifying a Target
-
- A `target` option can be provided to the helper to change
- which object will receive the method call. This option must be a path
- to an object, accessible in the current context:
-
- ```handlebars
- {{! app/templates/application.hbs }}
- <div {{action "anActionName" target=someService}}>
- click me
- </div>
- ```
-
- ```javascript
- // app/controllers/application.js
- export default Ember.Controller.extend({
- someService: Ember.inject.service()
- });
- ```
-
- @method action
- @for Ember.Templates.helpers
- @public
- */
-
- exports.default = function (morph, env, scope, params, hash, template, inverse, visitor) {
- if (morph) {
- _htmlbarsRuntimeHooks.keyword('@element_action', morph, env, scope, params, hash, template, inverse, visitor);
- return true;
+ Renderer.prototype.renderTopLevelView = function Renderer_renderTopLevelView(view, renderNode) {
+ // Check to see if insertion has been canceled
+ if (view._willInsert) {
+ view._willInsert = false;
+ this.prerenderTopLevelView(view, renderNode);
+ this.dispatchLifecycleHooks(view.env);
}
-
- 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-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) {
- 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]) {
- // on-change={{action (mut name)}}
- target = rawAction;
- action = rawAction[INVOKE];
- } else {
- // on-change={{action setName}}
- // element-space actions look to "controller" then target. Here we only
- // look to "target".
- target = _emberMetalStreamsUtils.read(scope.self);
- action = _emberMetalStreamsUtils.read(rawAction);
- var actionType = typeof action;
-
- if (actionType === 'string') {
- var actionName = action;
- action = null;
- // on-change={{action 'setName'}}
- if (hash.target) {
- // on-change={{action 'setName' target=alternativeComponent}}
- target = _emberMetalStreamsUtils.read(hash.target);
- }
- if (target.actions) {
- action = target.actions[actionName];
- }
-
- if (!action) {
- throw new _emberMetalError.default('An action named \'' + actionName + '\' was not found in ' + target + '.');
- }
- } else if (actionType !== 'function') {
- throw new _emberMetalError.default('An action could not be made for `' + rawAction.label + '` in ' + target + '. Please confirm that you are using either a quoted action name (i.e. `(action \'' + rawAction.label + '\')`) or a function available in ' + target + '.');
- }
+ Renderer.prototype.revalidateTopLevelView = function Renderer_revalidateTopLevelView(view) {
+ // This guard prevents revalidation on an already-destroyed view.
+ if (view._renderNode.lastResult) {
+ view._renderNode.lastResult.revalidate(view.env);
+ // supports createElement, which operates without moving the view into
+ // the inDOM state.
+ if (view._state === 'inDOM') {
+ this.dispatchLifecycleHooks(view.env);
}
-
- if (hash.value) {
- // <button on-keypress={{action (mut name) value="which"}}
- // 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;
-
- if (actionArguments.length > 0) {
- closureAction = function () {
- var args = actionArguments;
- if (arguments.length > 0) {
- var passedArguments = Array.prototype.slice.apply(arguments);
- args = actionArguments.concat(passedArguments);
- }
- if (valuePath && args.length > 0) {
- args[0] = _emberMetalProperty_get.get(args[0], valuePath);
- }
- return action.apply(target, args);
- };
- } else {
- closureAction = function () {
- var args = arguments;
- if (valuePath && args.length > 0) {
- args = Array.prototype.slice.apply(args);
- args[0] = _emberMetalProperty_get.get(args[0], valuePath);
- }
- return action.apply(target, args);
- };
+ this.clearRenderedViews(view.env);
}
+ };
- closureAction[ACTION] = true;
+ Renderer.prototype.dispatchLifecycleHooks = function Renderer_dispatchLifecycleHooks(env) {
+ var ownerView = env.view;
- return closureAction;
- }
-});
-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';
+ var lifecycleHooks = env.lifecycleHooks;
+ var i, hook;
- exports.default = {
- setupState: function (state, env, scope, params, hash) {
- var getStream = env.hooks.get;
- var read = env.hooks.getValue;
+ for (i = 0; i < lifecycleHooks.length; i++) {
+ hook = lifecycleHooks[i];
+ ownerView._dispatching = hook.type;
- var actionName = read(params[0]);
-
-
- var actionArgs = [];
- for (var i = 1, l = params.length; i < l; i++) {
- actionArgs.push(_emberViewsStreamsUtils.readUnwrappedModel(params[i]));
+ switch (hook.type) {
+ case 'didInsertElement':
+ this.didInsertElement(hook.view);break;
+ case 'didUpdate':
+ this.didUpdate(hook.view);break;
}
- var target;
- if (hash.target) {
- if (typeof hash.target === 'string') {
- target = read(getStream(env, scope, hash.target));
- } else {
- target = read(hash.target);
- }
- } else {
- target = read(scope.locals.controller) || read(scope.self);
- }
+ this.didRender(hook.view);
+ }
- return { actionName: actionName, actionArgs: actionArgs, target: target };
- },
+ ownerView._dispatching = null;
+ env.lifecycleHooks.length = 0;
+ };
- isStable: function (state, env, scope, params, hash) {
- return true;
- },
-
- render: function (node, env, scope, params, hash, template, inverse, visitor) {
- var actionId = env.dom.getAttribute(node.element, 'data-ember-action') || _emberMetalUtils.uuid();
-
- ActionHelper.registerAction({
- actionId: actionId,
- node: node,
- eventName: hash.on || 'click',
- bubbles: hash.bubbles,
- preventDefault: hash.preventDefault,
- withKeyCode: hash.withKeyCode,
- allowedKeys: hash.allowedKeys
- });
-
- node.cleanup = function () {
- ActionHelper.unregisterAction(actionId);
- };
-
- env.dom.setAttribute(node.element, 'data-ember-action', actionId);
+ Renderer.prototype.ensureViewNotRendering = function Renderer_ensureViewNotRendering(view) {
+ var env = view.ownerView.env;
+ if (env && env.renderedViews.indexOf(view.elementId) !== -1) {
+ throw new Error('Something you did caused a view to re-render after it rendered but before it was inserted into the DOM.');
}
};
- var ActionHelper = {};
- exports.ActionHelper = ActionHelper;
- // registeredActions is re-exported for compatibility with older plugins
- // that were using this undocumented API.
- ActionHelper.registeredActions = _emberViewsSystemAction_manager.default.registeredActions;
+ function MorphSet() {
+ this.morphs = [];
+ }
- ActionHelper.registerAction = function (_ref) {
- var actionId = _ref.actionId;
- var node = _ref.node;
- var eventName = _ref.eventName;
- var preventDefault = _ref.preventDefault;
- var bubbles = _ref.bubbles;
- var allowedKeys = _ref.allowedKeys;
+ MorphSet.prototype.add = function (morph) {
+ this.morphs.push(morph);
+ morph.seen = true;
+ };
- var actions = _emberViewsSystemAction_manager.default.registeredActions[actionId];
+ MorphSet.prototype.has = function (morph) {
+ return morph.seen;
+ };
- if (!actions) {
- actions = _emberViewsSystemAction_manager.default.registeredActions[actionId] = [];
+ MorphSet.prototype.clear = function () {
+ var morphs = this.morphs;
+ for (var i = 0, l = morphs.length; i < l; i++) {
+ morphs[i].seen = false;
}
- actions.push({
- eventName: eventName,
- handler: function (event) {
- if (!isAllowedEvent(event, allowedKeys)) {
- return true;
- }
+ this.morphs = [];
+ };
- if (preventDefault !== false) {
- event.preventDefault();
- }
+ Renderer.prototype.clearRenderedViews = function Renderer_clearRenderedViews(env) {
+ env.renderedNodes.clear();
+ env.renderedViews.length = 0;
+ };
- if (bubbles === false) {
- event.stopPropagation();
- }
+ // This entry point is called from top-level `view.appendTo`
+ Renderer.prototype.appendTo = function Renderer_appendTo(view, target) {
+ var morph = this._dom.appendMorph(target);
+ morph.ownerNode = morph;
+ view._willInsert = true;
+ _emberMetalRun_loop.default.schedule('render', this, this.renderTopLevelView, view, morph);
+ };
- var _node$state = node.state;
- var target = _node$state.target;
- var actionName = _node$state.actionName;
- var actionArgs = _node$state.actionArgs;
-
- _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 {
-
- target[actionName].apply(target, actionArgs);
- }
- });
- }
- });
-
- return actionId;
+ Renderer.prototype.replaceIn = function Renderer_replaceIn(view, target) {
+ var morph = this._dom.replaceContentWithMorph(target);
+ morph.ownerNode = morph;
+ view._willInsert = true;
+ _emberMetalRun_loop.default.scheduleOnce('render', this, this.renderTopLevelView, view, morph);
};
- ActionHelper.unregisterAction = function (actionId) {
- delete _emberViewsSystemAction_manager.default.registeredActions[actionId];
+ Renderer.prototype.createElement = function Renderer_createElement(view) {
+ var morph = this._dom.createFragmentMorph();
+ morph.ownerNode = morph;
+ this.prerenderTopLevelView(view, morph);
};
- var MODIFIERS = ['alt', 'shift', 'meta', 'ctrl'];
- var POINTER_EVENT_TYPE_REGEX = /^click|mouse|touch/;
-
- function isAllowedEvent(event, allowedKeys) {
- if (typeof allowedKeys === 'undefined') {
- if (POINTER_EVENT_TYPE_REGEX.test(event.type)) {
- return _emberViewsSystemUtils.isSimpleClick(event);
- } else {
- allowedKeys = '';
- }
+ Renderer.prototype.didCreateElement = function (view, element) {
+ if (element) {
+ view.element = element;
}
- if (allowedKeys.indexOf('any') >= 0) {
- return true;
+ if (view._transitionTo) {
+ view._transitionTo('hasElement');
}
+ }; // hasElement
- for (var i = 0, l = MODIFIERS.length; i < l; i++) {
- if (event[MODIFIERS[i] + 'Key'] && allowedKeys.indexOf(MODIFIERS[i]) === -1) {
- return false;
- }
+ Renderer.prototype.willInsertElement = function (view) {
+ if (view.trigger) {
+ view.trigger('willInsertElement');
}
+ }; // will place into DOM
- return true;
- }
-});
-// assert
-enifed('ember-routing-htmlbars/keywords/render', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/empty_object', 'ember-metal/error', 'ember-metal/streams/utils', 'ember-runtime/system/string', 'ember-routing/system/generate_controller', 'ember-htmlbars/node-managers/view-node-manager'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalEmpty_object, _emberMetalError, _emberMetalStreamsUtils, _emberRuntimeSystemString, _emberRoutingSystemGenerate_controller, _emberHtmlbarsNodeManagersViewNodeManager) {
- /**
- @module ember
- @submodule ember-templates
- */
+ Renderer.prototype.setAttrs = function (view, attrs) {
+ _emberMetalProperty_set.set(view, 'attrs', attrs);
+ }; // set attrs the first time
- 'use strict';
+ Renderer.prototype.componentInitAttrs = function (component, attrs) {
+ component.trigger('didInitAttrs', { attrs: attrs });
+ component.trigger('didReceiveAttrs', { newAttrs: attrs });
+ }; // set attrs the first time
- /**
- 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);
- }
- },
+ Renderer.prototype.didInsertElement = function (view) {
+ if (view._transitionTo) {
+ view._transitionTo('inDOM');
+ }
- setupState: function (prevState, env, scope, params, hash) {
- var name = params[0];
+ if (view.trigger) {
+ view.trigger('didInsertElement');
+ }
+ }; // inDOM // placed into DOM
-
- return {
- parentView: env.view,
- manager: prevState.manager,
- controller: prevState.controller,
- childOutletState: childOutletState(name, env)
- };
- },
+ Renderer.prototype.didUpdate = function (view) {
+ if (view.trigger) {
+ view.trigger('didUpdate');
+ }
+ };
- childEnv: function (state, env) {
- return env.childWithOutletState(state.childOutletState);
- },
+ Renderer.prototype.didRender = function (view) {
+ if (view.trigger) {
+ view.trigger('didRender');
+ }
+ };
- isStable: function (lastState, nextState) {
- return isStable(lastState.childOutletState, nextState.childOutletState);
- },
+ Renderer.prototype.updateAttrs = function (view, attrs) {
+ this.setAttrs(view, attrs);
+ }; // setting new attrs
- isEmpty: function (state) {
- return false;
- },
+ Renderer.prototype.componentUpdateAttrs = function (component, newAttrs) {
+ var oldAttrs = null;
- render: function (node, env, scope, params, hash, template, inverse, visitor) {
- var state = node.state;
- var name = params[0];
- var context = params[1];
+ if (component.attrs) {
+ oldAttrs = _emberMetalAssign.default({}, component.attrs);
+ _emberMetalSet_properties.default(component.attrs, newAttrs);
+ } else {
+ _emberMetalProperty_set.set(component, 'attrs', newAttrs);
+ }
- var container = env.container;
+ component.trigger('didUpdateAttrs', { oldAttrs: oldAttrs, newAttrs: newAttrs });
+ component.trigger('didReceiveAttrs', { oldAttrs: oldAttrs, newAttrs: newAttrs });
+ };
- // The render keyword presumes it can work without a router. This is really
- // only to satisfy the test:
- //
- // {{view}} should not override class bindings defined on a child view"
- //
- var router = container.lookup('router:main');
+ Renderer.prototype.willUpdate = function (view, attrs) {
+ if (view._willUpdate) {
+ view._willUpdate(attrs);
+ }
+ };
-
- if (params.length === 1) {
- // use the singleton controller
- } else if (params.length !== 2) {
- throw new _emberMetalError.default('You must pass a templateName to render');
- }
+ Renderer.prototype.componentWillUpdate = function (component) {
+ component.trigger('willUpdate');
+ };
- var templateName = 'template:' + name;
-
- var view = container.lookup('view:' + name);
- if (!view) {
- view = container.lookup('view:default');
- }
- var viewHasTemplateSpecified = view && !!_emberMetalProperty_get.get(view, 'template');
- if (!template && !viewHasTemplateSpecified) {
- template = container.lookup(templateName);
- }
+ Renderer.prototype.willRender = function (view) {
+ if (view._willRender) {
+ view._willRender();
+ }
+ };
- if (view) {
- view.ownerView = env.view.ownerView;
- }
+ Renderer.prototype.componentWillRender = function (component) {
+ component.trigger('willRender');
+ };
- // provide controller override
- var controllerName;
- var controllerFullName;
+ Renderer.prototype.remove = function (view, shouldDestroy) {
+ this.willDestroyElement(view);
- if (hash.controller) {
- controllerName = hash.controller;
- controllerFullName = 'controller:' + controllerName;
- delete hash.controller;
+ view._willRemoveElement = true;
+ _emberMetalRun_loop.default.schedule('render', this, this.renderElementRemoval, view);
+ };
- } else {
- controllerName = name;
- controllerFullName = 'controller:' + controllerName;
- }
+ Renderer.prototype.renderElementRemoval = function Renderer_renderElementRemoval(view) {
+ // Use the _willRemoveElement flag to avoid mulitple removal attempts in
+ // case many have been scheduled. This should be more performant than using
+ // `scheduleOnce`.
+ if (view._willRemoveElement) {
+ view._willRemoveElement = false;
- var parentController = _emberMetalStreamsUtils.read(scope.locals.controller);
- var controller;
-
- // choose name
- if (params.length > 1) {
- var factory = container.lookupFactory(controllerFullName) || _emberRoutingSystemGenerate_controller.generateControllerFactory(container, controllerName);
-
- controller = factory.create({
- model: _emberMetalStreamsUtils.read(context),
- parentController: parentController,
- target: parentController
- });
-
- node.addDestruction(controller);
- } else {
- controller = container.lookup(controllerFullName) || _emberRoutingSystemGenerate_controller.default(container, controllerName);
-
- controller.setProperties({
- target: parentController,
- parentController: parentController
- });
+ if (view._renderNode && view.element && view.element.parentNode) {
+ view._renderNode.clear();
}
-
- if (view) {
- view.set('controller', controller);
- }
- state.controller = controller;
-
- hash.viewName = _emberRuntimeSystemString.camelize(name);
-
- // var state = node.state;
- // var parentView = scope.view;
- if (template && template.raw) {
- template = template.raw;
- }
-
- var options = {
- layout: null,
- self: controller
- };
-
- if (view) {
- options.component = view;
- }
-
- var nodeManager = _emberHtmlbarsNodeManagersViewNodeManager.default.create(node, env, hash, options, state.parentView, null, null, template);
- state.manager = nodeManager;
-
- if (router && params.length === 1) {
- router._connectActiveComponentNode(name, nodeManager);
- }
-
- nodeManager.render(env, hash, visitor);
- },
-
- rerender: function (node, env, scope, params, hash, template, inverse, visitor) {
- var model = _emberMetalStreamsUtils.read(params[1]);
- node.state.controller.set('model', model);
+ this.didDestroyElement(view);
}
};
- function childOutletState(name, env) {
- var topLevel = env.view.ownerView;
- if (!topLevel || !topLevel.outletState) {
- return;
- }
+ Renderer.prototype.willRemoveElement = function () /*view*/{};
- var outletState = topLevel.outletState;
- if (!outletState.main) {
- return;
+ Renderer.prototype.willDestroyElement = function (view) {
+ if (view._willDestroyElement) {
+ view._willDestroyElement();
}
+ if (view.trigger) {
+ view.trigger('willDestroyElement');
+ view.trigger('willClearRender');
+ }
- var selectedOutletState = outletState.main.outlets['__ember_orphans__'];
- if (!selectedOutletState) {
- return;
+ if (view._transitionTo) {
+ view._transitionTo('destroying');
}
- var matched = selectedOutletState.outlets[name];
- if (matched) {
- var childState = new _emberMetalEmpty_object.default();
- childState[matched.render.outlet] = matched;
- matched.wasUsed = true;
- return childState;
- }
- }
+ };
- function isStable(a, b) {
- if (!a && !b) {
- return true;
+ Renderer.prototype.didDestroyElement = function (view) {
+ view.element = null;
+
+ // Views that are being destroyed should never go back to the preRender state.
+ // However if we're just destroying an element on a view (as is the case when
+ // using View#remove) then the view should go to a preRender state so that
+ // it can be rendered again later.
+ if (view._state !== 'destroying' && view._transitionTo) {
+ view._transitionTo('preRender');
}
- if (!a || !b) {
- return false;
- }
- for (var outletName in a) {
- if (!isStableOutlet(a[outletName], b[outletName])) {
- return false;
- }
- }
- return true;
- }
- function isStableOutlet(a, b) {
- if (!a && !b) {
- return true;
+ if (view.trigger) {
+ view.trigger('didDestroyElement');
}
- if (!a || !b) {
- return false;
- }
- a = a.render;
- b = b.render;
- for (var key in a) {
- if (a.hasOwnProperty(key)) {
- // name is only here for logging & debugging. If two different
- // names result in otherwise identical states, they're still
- // identical.
- if (a[key] !== b[key] && key !== 'name') {
- return false;
- }
- }
- }
- return true;
- }
-});
-// assert
-enifed('ember-routing-views', ['exports', 'ember-metal/core', 'ember-routing-views/components/link-to', 'ember-routing-views/views/outlet'], function (exports, _emberMetalCore, _emberRoutingViewsComponentsLinkTo, _emberRoutingViewsViewsOutlet) {
- /**
- @module ember
- @submodule ember-routing-views
- */
+ }; // element destroyed so view.destroy shouldn't try to remove it removedFromDOM
+ exports.default = Renderer;
+});
+enifed('ember-metal-views', ['exports', 'ember-metal-views/renderer'], function (exports, _emberMetalViewsRenderer) {
'use strict';
- _emberMetalCore.default.LinkComponent = _emberRoutingViewsComponentsLinkTo.default;
- _emberMetalCore.default.OutletView = _emberRoutingViewsViewsOutlet.OutletView;
-
- exports.default = _emberMetalCore.default;
+ exports.Renderer = _emberMetalViewsRenderer.default;
});
-enifed('ember-routing-views/components/link-to', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/computed', 'ember-metal/computed_macros', 'ember-views/system/utils', 'ember-views/views/component', 'ember-runtime/inject', 'ember-runtime/system/service', 'ember-runtime/mixins/controller', 'ember-htmlbars/node-managers/component-node-manager', 'ember-htmlbars/templates/link-to'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalComputed, _emberMetalComputed_macros, _emberViewsSystemUtils, _emberViewsViewsComponent, _emberRuntimeInject, _emberRuntimeSystemService, _emberRuntimeMixinsController, _emberHtmlbarsNodeManagersComponentNodeManager, _emberHtmlbarsTemplatesLinkTo) {
+enifed('ember-metal', ['exports', '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, _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) {
/**
@module ember
- @submodule ember-templates
+ @submodule ember-metal
*/
- /**
- The `{{link-to}}` component renders a link to the supplied
- `routeName` passing an optionally supplied model to the
- route as its `model` context of the route. The block
- for `{{link-to}}` becomes the innerHTML of the rendered
- element:
-
- ```handlebars
- {{#link-to 'photoGallery'}}
- Great Hamster Photos
- {{/link-to}}
- ```
-
- You can also use an inline form of `{{link-to}}` component by
- passing the link text as the first argument
- to the component:
-
- ```handlebars
- {{link-to 'Great Hamster Photos' 'photoGallery'}}
- ```
-
- Both will result in:
-
- ```html
- <a href="/hamster-photos">
- Great Hamster Photos
- </a>
- ```
-
- ### Supplying a tagName
- By default `{{link-to}}` renders an `<a>` element. This can
- be overridden for a single use of `{{link-to}}` by supplying
- a `tagName` option:
-
- ```handlebars
- {{#link-to 'photoGallery' tagName="li"}}
- Great Hamster Photos
- {{/link-to}}
- ```
-
- ```html
- <li>
- Great Hamster Photos
- </li>
- ```
-
- To override this option for your entire application, see
- "Overriding Application-wide Defaults".
-
- ### Disabling the `link-to` component
- By default `{{link-to}}` is enabled.
- any passed value to the `disabled` component property will disable
- the `link-to` component.
-
- static use: the `disabled` option:
-
- ```handlebars
- {{#link-to 'photoGallery' disabled=true}}
- Great Hamster Photos
- {{/link-to}}
- ```
-
- dynamic use: the `disabledWhen` option:
-
- ```handlebars
- {{#link-to 'photoGallery' disabledWhen=controller.someProperty}}
- Great Hamster Photos
- {{/link-to}}
- ```
-
- any passed value to `disabled` will disable it except `undefined`.
- to ensure that only `true` disable the `link-to` component you can
- override the global behaviour of `Ember.LinkComponent`.
-
- ```javascript
- Ember.LinkComponent.reopen({
- disabled: Ember.computed(function(key, value) {
- if (value !== undefined) {
- this.set('_isDisabled', value === true);
- }
- return value === true ? get(this, 'disabledClass') : false;
- })
- });
- ```
-
- see "Overriding Application-wide Defaults" for more.
-
- ### Handling `href`
- `{{link-to}}` will use your application's Router to
- fill the element's `href` property with a url that
- matches the path to the supplied `routeName` for your
- router's configured `Location` scheme, which defaults
- to Ember.HashLocation.
-
- ### Handling current route
- `{{link-to}}` will apply a CSS class name of 'active'
- when the application's current route matches
- the supplied routeName. For example, if the application's
- current route is 'photoGallery.recent' the following
- use of `{{link-to}}`:
-
- ```handlebars
- {{#link-to 'photoGallery.recent'}}
- Great Hamster Photos
- {{/link-to}}
- ```
-
- will result in
-
- ```html
- <a href="/hamster-photos/this-week" class="active">
- Great Hamster Photos
- </a>
- ```
-
- The CSS class name used for active classes can be customized
- for a single use of `{{link-to}}` by passing an `activeClass`
- option:
-
- ```handlebars
- {{#link-to 'photoGallery.recent' activeClass="current-url"}}
- Great Hamster Photos
- {{/link-to}}
- ```
-
- ```html
- <a href="/hamster-photos/this-week" class="current-url">
- Great Hamster Photos
- </a>
- ```
-
- To override this option for your entire application, see
- "Overriding Application-wide Defaults".
-
- ### Keeping a link active for other routes
-
- If you need a link to be 'active' even when it doesn't match
- the current route, you can use the the `current-when`
- argument.
-
- ```handlebars
- {{#link-to 'photoGallery' current-when='photos'}}
- Photo Gallery
- {{/link-to}}
- ```
-
- This may be helpful for keeping links active for:
-
- * non-nested routes that are logically related
- * some secondary menu approaches
- * 'top navigation' with 'sub navigation' scenarios
-
- A link will be active if `current-when` is `true` or the current
- route is the route this link would transition to.
-
- To match multiple routes 'space-separate' the routes:
-
- ```handlebars
- {{#link-to 'gallery' current-when='photos drawings paintings'}}
- Art Gallery
- {{/link-to}}
- ```
-
- ### Supplying a model
- An optional model argument can be used for routes whose
- paths contain dynamic segments. This argument will become
- the model context of the linked route:
-
- ```javascript
- App.Router.map(function() {
- this.route("photoGallery", {path: "hamster-photos/:photo_id"});
- });
- ```
-
- ```handlebars
- {{#link-to 'photoGallery' aPhoto}}
- {{aPhoto.title}}
- {{/link-to}}
- ```
-
- ```html
- <a href="/hamster-photos/42">
- Tomster
- </a>
- ```
-
- ### Supplying multiple models
- For deep-linking to route paths that contain multiple
- dynamic segments, multiple model arguments can be used.
- As the router transitions through the route path, each
- supplied model argument will become the context for the
- route with the dynamic segments:
-
- ```javascript
- App.Router.map(function() {
- this.route("photoGallery", { path: "hamster-photos/:photo_id" }, function() {
- this.route("comment", {path: "comments/:comment_id"});
- });
- });
- ```
- This argument will become the model context of the linked route:
-
- ```handlebars
- {{#link-to 'photoGallery.comment' aPhoto comment}}
- {{comment.body}}
- {{/link-to}}
- ```
-
- ```html
- <a href="/hamster-photos/42/comments/718">
- A+++ would snuggle again.
- </a>
- ```
-
- ### Supplying an explicit dynamic segment value
- If you don't have a model object available to pass to `{{link-to}}`,
- an optional string or integer argument can be passed for routes whose
- paths contain dynamic segments. This argument will become the value
- of the dynamic segment:
-
- ```javascript
- App.Router.map(function() {
- this.route("photoGallery", { path: "hamster-photos/:photo_id" });
- });
- ```
-
- ```handlebars
- {{#link-to 'photoGallery' aPhotoId}}
- {{aPhoto.title}}
- {{/link-to}}
- ```
-
- ```html
- <a href="/hamster-photos/42">
- Tomster
- </a>
- ```
-
- When transitioning into the linked route, the `model` hook will
- be triggered with parameters including this passed identifier.
-
- ### Allowing Default Action
-
- By default the `{{link-to}}` component prevents the default browser action
- by calling `preventDefault()` as this sort of action bubbling is normally
- handled internally and we do not want to take the browser to a new URL (for
- example).
-
- If you need to override this behavior specify `preventDefault=false` in
- your template:
-
- ```handlebars
- {{#link-to 'photoGallery' aPhotoId preventDefault=false}}
- {{aPhotoId.title}}
- {{/link-to}}
- ```
-
- ### Overriding attributes
- You can override any given property of the `Ember.LinkComponent`
- that is generated by the `{{link-to}}` component by passing
- key/value pairs, like so:
-
- ```handlebars
- {{#link-to aPhoto tagName='li' title='Following this link will change your life' classNames='pic sweet'}}
- Uh-mazing!
- {{/link-to}}
- ```
-
- See [Ember.LinkComponent](/api/classes/Ember.LinkComponent.html) for a
- complete list of overrideable properties. Be sure to also
- check out inherited properties of `LinkComponent`.
-
- ### Overriding Application-wide Defaults
- ``{{link-to}}`` creates an instance of `Ember.LinkComponent`
- for rendering. To override options for your entire
- application, reopen `Ember.LinkComponent` and supply the
- desired values:
-
- ``` javascript
- Ember.LinkComponent.reopen({
- activeClass: "is-active",
- tagName: 'li'
- })
- ```
-
- It is also possible to override the default event in
- this manner:
-
- ``` javascript
- Ember.LinkComponent.reopen({
- eventName: 'customEventName'
- });
- ```
-
- @method link-to
- @for Ember.Templates.helpers
- @param {String} routeName
- @param {Object} [context]*
- @param [options] {Object} Handlebars key/value pairs of options, you can override any property of Ember.LinkComponent
- @return {String} HTML string
- @see {Ember.LinkComponent}
- @public
- */
-
- /**
- @module ember
- @submodule ember-routing-views
- */
-
+ // BEGIN IMPORTS
'use strict';
- _emberHtmlbarsTemplatesLinkTo.default.meta.revision = 'Ember@2.1.2';
+ _emberMetalComputed.computed.empty = _emberMetalComputed_macros.empty;
+ _emberMetalComputed.computed.notEmpty = _emberMetalComputed_macros.notEmpty;
+ _emberMetalComputed.computed.none = _emberMetalComputed_macros.none;
+ _emberMetalComputed.computed.not = _emberMetalComputed_macros.not;
+ _emberMetalComputed.computed.bool = _emberMetalComputed_macros.bool;
+ _emberMetalComputed.computed.match = _emberMetalComputed_macros.match;
+ _emberMetalComputed.computed.equal = _emberMetalComputed_macros.equal;
+ _emberMetalComputed.computed.gt = _emberMetalComputed_macros.gt;
+ _emberMetalComputed.computed.gte = _emberMetalComputed_macros.gte;
+ _emberMetalComputed.computed.lt = _emberMetalComputed_macros.lt;
+ _emberMetalComputed.computed.lte = _emberMetalComputed_macros.lte;
+ _emberMetalComputed.computed.alias = _emberMetalAlias.default;
+ _emberMetalComputed.computed.oneWay = _emberMetalComputed_macros.oneWay;
+ _emberMetalComputed.computed.reads = _emberMetalComputed_macros.oneWay;
+ _emberMetalComputed.computed.readOnly = _emberMetalComputed_macros.readOnly;
+ _emberMetalComputed.computed.defaultTo = _emberMetalComputed_macros.defaultTo;
+ _emberMetalComputed.computed.deprecatingAlias = _emberMetalComputed_macros.deprecatingAlias;
+ _emberMetalComputed.computed.and = _emberMetalComputed_macros.and;
+ _emberMetalComputed.computed.or = _emberMetalComputed_macros.or;
+ _emberMetalComputed.computed.any = _emberMetalComputed_macros.any;
+ _emberMetalComputed.computed.collect = _emberMetalComputed_macros.collect;
- /**
- `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.
-
- `Ember.LinkComponent` components are invoked with {{#link-to}}. Properties
- of this class can be overridden with `reopen` to customize application-wide
- behavior.
-
- @class LinkComponent
- @namespace Ember
- @extends Ember.Component
- @see {Ember.Templates.helpers.link-to}
- @private
- **/
- var LinkComponent = _emberViewsViewsComponent.default.extend({
- layout: _emberHtmlbarsTemplatesLinkTo.default,
+ // END IMPORTS
- tagName: 'a',
+ // BEGIN EXPORTS
+ var EmberInstrumentation = _emberMetalCore.default.Instrumentation = {};
+ EmberInstrumentation.instrument = _emberMetalInstrumentation.instrument;
+ EmberInstrumentation.subscribe = _emberMetalInstrumentation.subscribe;
+ EmberInstrumentation.unsubscribe = _emberMetalInstrumentation.unsubscribe;
+ EmberInstrumentation.reset = _emberMetalInstrumentation.reset;
- /**
- @deprecated Use current-when instead.
- @property currentWhen
- @private
- */
- currentWhen: _emberMetalComputed_macros.deprecatingAlias('current-when', { id: 'ember-routing-view.deprecated-current-when', until: '3.0.0' }),
+ _emberMetalCore.default.instrument = _emberMetalInstrumentation.instrument;
+ _emberMetalCore.default.subscribe = _emberMetalInstrumentation.subscribe;
- /**
- Used to determine when this `LinkComponent` is active.
- @property currentWhen
- @public
- */
- 'current-when': null,
+ _emberMetalCore.default._Cache = _emberMetalCache.default;
- /**
- Sets the `title` attribute of the `LinkComponent`'s HTML element.
- @property title
- @default null
- @public
- **/
- title: null,
+ _emberMetalCore.default.generateGuid = _emberMetalUtils.generateGuid;
+ _emberMetalCore.default.GUID_KEY = _emberMetalUtils.GUID_KEY;
+ _emberMetalCore.default.platform = {
+ defineProperty: true,
+ hasPropertyAccessors: true
+ };
- /**
- Sets the `rel` attribute of the `LinkComponent`'s HTML element.
- @property rel
- @default null
- @public
- **/
- rel: null,
+ _emberMetalCore.default.Error = _emberMetalError.default;
+ _emberMetalCore.default.guidFor = _emberMetalUtils.guidFor;
+ _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;
+ _emberMetalCore.default.wrap = _emberMetalUtils.wrap;
+ _emberMetalCore.default.apply = _emberMetalUtils.apply;
+ _emberMetalCore.default.applyStr = _emberMetalUtils.applyStr;
+ _emberMetalCore.default.uuid = _emberMetalUtils.uuid;
- /**
- Sets the `tabindex` attribute of the `LinkComponent`'s HTML element.
- @property tabindex
- @default null
- @public
- **/
- tabindex: null,
+ _emberMetalCore.default.Logger = _emberMetalLogger.default;
- /**
- Sets the `target` attribute of the `LinkComponent`'s HTML element.
- @since 1.8.0
- @property target
- @default null
- @public
- **/
- target: null,
+ _emberMetalCore.default.get = _emberMetalProperty_get.get;
+ _emberMetalCore.default.getWithDefault = _emberMetalProperty_get.getWithDefault;
+ _emberMetalCore.default.normalizeTuple = _emberMetalProperty_get.normalizeTuple;
+ _emberMetalCore.default._getPath = _emberMetalProperty_get._getPath;
- /**
- The CSS class to apply to `LinkComponent`'s element when its `active`
- property is `true`.
- @property activeClass
- @type String
- @default active
- @private
- **/
- activeClass: 'active',
+ _emberMetalCore.default.on = _emberMetalEvents.on;
+ _emberMetalCore.default.addListener = _emberMetalEvents.addListener;
+ _emberMetalCore.default.removeListener = _emberMetalEvents.removeListener;
+ _emberMetalCore.default._suspendListener = _emberMetalEvents.suspendListener;
+ _emberMetalCore.default._suspendListeners = _emberMetalEvents.suspendListeners;
+ _emberMetalCore.default.sendEvent = _emberMetalEvents.sendEvent;
+ _emberMetalCore.default.hasListeners = _emberMetalEvents.hasListeners;
+ _emberMetalCore.default.watchedEvents = _emberMetalEvents.watchedEvents;
+ _emberMetalCore.default.listenersFor = _emberMetalEvents.listenersFor;
+ _emberMetalCore.default.accumulateListeners = _emberMetalEvents.accumulateListeners;
- /**
- The CSS class to apply to `LinkComponent`'s element when its `loading`
- property is `true`.
- @property loadingClass
- @type String
- @default loading
- @private
- **/
- loadingClass: 'loading',
+ _emberMetalCore.default._ObserverSet = _emberMetalObserver_set.default;
- /**
- The CSS class to apply to a `LinkComponent`'s element when its `disabled`
- property is `true`.
- @property disabledClass
- @type String
- @default disabled
- @private
- **/
- disabledClass: 'disabled',
- _isDisabled: false,
+ _emberMetalCore.default.propertyWillChange = _emberMetalProperty_events.propertyWillChange;
+ _emberMetalCore.default.propertyDidChange = _emberMetalProperty_events.propertyDidChange;
+ _emberMetalCore.default.overrideChains = _emberMetalProperty_events.overrideChains;
+ _emberMetalCore.default.beginPropertyChanges = _emberMetalProperty_events.beginPropertyChanges;
+ _emberMetalCore.default.endPropertyChanges = _emberMetalProperty_events.endPropertyChanges;
+ _emberMetalCore.default.changeProperties = _emberMetalProperty_events.changeProperties;
- /**
- Determines whether the `LinkComponent` will trigger routing via
- the `replaceWith` routing strategy.
- @property replace
- @type Boolean
- @default false
- @public
- **/
- replace: false,
+ _emberMetalCore.default.defineProperty = _emberMetalProperties.defineProperty;
- /**
- By default the `{{link-to}}` component will bind to the `href` and
- `title` attributes. It's discouraged that you override these defaults,
- however you can push onto the array if needed.
- @property attributeBindings
- @type Array | String
- @default ['title', 'rel', 'tabindex', 'target']
- @public
- */
- attributeBindings: ['href', 'title', 'rel', 'tabindex', 'target'],
+ _emberMetalCore.default.set = _emberMetalProperty_set.set;
+ _emberMetalCore.default.trySet = _emberMetalProperty_set.trySet;
- /**
- By default the `{{link-to}}` component will bind to the `active`, `loading`,
- and `disabled` classes. It is discouraged to override these directly.
- @property classNameBindings
- @type Array
- @default ['active', 'loading', 'disabled']
- @public
- */
- classNameBindings: ['active', 'loading', 'disabled', 'transitioningIn', 'transitioningOut'],
+ _emberMetalCore.default.OrderedSet = _emberMetalMap.OrderedSet;
+ _emberMetalCore.default.Map = _emberMetalMap.Map;
+ _emberMetalCore.default.MapWithDefault = _emberMetalMap.MapWithDefault;
- /**
- By default the `{{link-to}}` component responds to the `click` event. You
- can override this globally by setting this property to your custom
- event name.
- This is particularly useful on mobile when one wants to avoid the 300ms
- click delay using some sort of custom `tap` event.
- @property eventName
- @type String
- @default click
- @private
- */
- eventName: 'click',
+ _emberMetalCore.default.getProperties = _emberMetalGet_properties.default;
+ _emberMetalCore.default.setProperties = _emberMetalSet_properties.default;
- // this is doc'ed here so it shows up in the events
- // section of the API documentation, which is where
- // people will likely go looking for it.
- /**
- Triggers the `LinkComponent`'s routing behavior. If
- `eventName` is changed to a value other than `click`
- the routing behavior will trigger on that custom event
- instead.
- @event click
- @private
- */
+ _emberMetalCore.default.watchKey = _emberMetalWatch_key.watchKey;
+ _emberMetalCore.default.unwatchKey = _emberMetalWatch_key.unwatchKey;
- /**
- An overridable method called when `LinkComponent` objects are instantiated.
- Example:
- ```javascript
- App.MyLinkComponent = Ember.LinkComponent.extend({
- init: function() {
- this._super.apply(this, arguments);
- Ember.Logger.log('Event is ' + this.get('eventName'));
- }
- });
- ```
- NOTE: If you do override `init` for a framework class like `Ember.View`,
- be sure to call `this._super.apply(this, arguments)` in your
- `init` declaration! If you don't, Ember may not have an opportunity to
- do important setup work, and you'll see strange behavior in your
- application.
- @method init
- @private
- */
- init: function () {
- this._super.apply(this, arguments);
+ _emberMetalCore.default.flushPendingChains = _emberMetalChains.flushPendingChains;
+ _emberMetalCore.default.removeChainWatcher = _emberMetalChains.removeChainWatcher;
+ _emberMetalCore.default._ChainNode = _emberMetalChains.ChainNode;
+ _emberMetalCore.default.finishChains = _emberMetalChains.finishChains;
- // Map desired event name to invoke function
- var eventName = _emberMetalProperty_get.get(this, 'eventName');
- this.on(eventName, this, this._invoke);
- },
+ _emberMetalCore.default.watchPath = _emberMetalWatch_path.watchPath;
+ _emberMetalCore.default.unwatchPath = _emberMetalWatch_path.unwatchPath;
- _routing: _emberRuntimeInject.default.service('-routing'),
+ _emberMetalCore.default.watch = _emberMetalWatching.watch;
+ _emberMetalCore.default.isWatching = _emberMetalWatching.isWatching;
+ _emberMetalCore.default.unwatch = _emberMetalWatching.unwatch;
+ _emberMetalCore.default.rewatch = _emberMetalWatching.rewatch;
+ _emberMetalCore.default.destroy = _emberMetalWatching.destroy;
- /**
- Accessed as a classname binding to apply the `LinkComponent`'s `disabledClass`
- CSS `class` to the element when the link is disabled.
- When `true` interactions with the element will not trigger route changes.
- @property disabled
- @private
- */
- disabled: _emberMetalComputed.computed({
- get: function (key, value) {
- return false;
- },
- set: function (key, value) {
- if (value !== undefined) {
- this.set('_isDisabled', value);
- }
+ _emberMetalCore.default.expandProperties = _emberMetalExpand_properties.default;
- return value ? _emberMetalProperty_get.get(this, 'disabledClass') : false;
- }
- }),
+ _emberMetalCore.default.ComputedProperty = _emberMetalComputed.ComputedProperty;
+ _emberMetalCore.default.computed = _emberMetalComputed.computed;
+ _emberMetalCore.default.cacheFor = _emberMetalComputed.cacheFor;
- _computeActive: function (routerState) {
- if (_emberMetalProperty_get.get(this, 'loading')) {
- return false;
- }
+ _emberMetalCore.default.addObserver = _emberMetalObserver.addObserver;
+ _emberMetalCore.default.observersFor = _emberMetalObserver.observersFor;
+ _emberMetalCore.default.removeObserver = _emberMetalObserver.removeObserver;
+ _emberMetalCore.default._suspendObserver = _emberMetalObserver._suspendObserver;
+ _emberMetalCore.default._suspendObservers = _emberMetalObserver._suspendObservers;
- var routing = _emberMetalProperty_get.get(this, '_routing');
- var models = _emberMetalProperty_get.get(this, 'models');
- var resolvedQueryParams = _emberMetalProperty_get.get(this, 'resolvedQueryParams');
+ _emberMetalCore.default.IS_BINDING = _emberMetalMixin.IS_BINDING;
+ _emberMetalCore.default.required = _emberMetalMixin.required;
+ _emberMetalCore.default.aliasMethod = _emberMetalMixin.aliasMethod;
+ _emberMetalCore.default.observer = _emberMetalMixin.observer;
+ _emberMetalCore.default.immediateObserver = _emberMetalMixin._immediateObserver;
+ _emberMetalCore.default.mixin = _emberMetalMixin.mixin;
+ _emberMetalCore.default.Mixin = _emberMetalMixin.Mixin;
- var currentWhen = _emberMetalProperty_get.get(this, 'current-when');
- var isCurrentWhenSpecified = !!currentWhen;
- currentWhen = currentWhen || _emberMetalProperty_get.get(this, 'qualifiedRouteName');
- currentWhen = currentWhen.split(' ');
+ _emberMetalCore.default.bind = _emberMetalBinding.bind;
+ _emberMetalCore.default.Binding = _emberMetalBinding.Binding;
+ _emberMetalCore.default.isGlobalPath = _emberMetalBinding.isGlobalPath;
- for (var i = 0, len = currentWhen.length; i < len; i++) {
- if (routing.isActiveForRoute(models, resolvedQueryParams, currentWhen[i], routerState, isCurrentWhenSpecified)) {
- return _emberMetalProperty_get.get(this, 'activeClass');
- }
- }
+ _emberMetalCore.default.run = _emberMetalRun_loop.default;
- return false;
- },
-
- /**
- Accessed as a classname binding to apply the `LinkComponent`'s `activeClass`
- CSS `class` to the element when the link is active.
- A `LinkComponent` is considered active when its `currentWhen` property is `true`
- or the application's current route is the route the `LinkComponent` would trigger
- transitions into.
- The `currentWhen` property can match against multiple routes by separating
- route names using the ` ` (space) character.
- @property active
- @private
- */
- active: _emberMetalComputed.computed('attrs.params', '_routing.currentState', function computeLinkToComponentActive() {
- var currentState = _emberMetalProperty_get.get(this, '_routing.currentState');
- if (!currentState) {
- return false;
- }
-
- return this._computeActive(currentState);
- }),
-
- willBeActive: _emberMetalComputed.computed('_routing.targetState', function computeLinkToComponentWillBeActive() {
- var routing = _emberMetalProperty_get.get(this, '_routing');
- var targetState = _emberMetalProperty_get.get(routing, 'targetState');
- if (_emberMetalProperty_get.get(routing, 'currentState') === targetState) {
- return;
- }
-
- return !!this._computeActive(targetState);
- }),
-
- transitioningIn: _emberMetalComputed.computed('active', 'willBeActive', function computeLinkToComponentTransitioningIn() {
- var willBeActive = _emberMetalProperty_get.get(this, 'willBeActive');
- if (typeof willBeActive === 'undefined') {
- return false;
- }
-
- return !_emberMetalProperty_get.get(this, 'active') && willBeActive && 'ember-transitioning-in';
- }),
-
- transitioningOut: _emberMetalComputed.computed('active', 'willBeActive', function computeLinkToComponentTransitioningOut() {
- var willBeActive = _emberMetalProperty_get.get(this, 'willBeActive');
- if (typeof willBeActive === 'undefined') {
- return false;
- }
-
- return _emberMetalProperty_get.get(this, 'active') && !willBeActive && 'ember-transitioning-out';
- }),
-
- /**
- Event handler that invokes the link, activating the associated route.
- @private
- @method _invoke
- @param {Event} event
- @private
- */
- _invoke: function (event) {
- if (!_emberViewsSystemUtils.isSimpleClick(event)) {
- return true;
- }
-
- if (this.attrs.preventDefault !== false) {
- var targetAttribute = this.attrs.target;
- if (!targetAttribute || targetAttribute === '_self') {
- event.preventDefault();
- }
- }
-
- if (this.attrs.bubbles === false) {
- event.stopPropagation();
- }
-
- if (_emberMetalProperty_get.get(this, '_isDisabled')) {
- return false;
- }
-
- if (_emberMetalProperty_get.get(this, 'loading')) {
- _emberMetalCore.default.Logger.warn('This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid.');
- return false;
- }
-
- var targetAttribute2 = this.attrs.target;
- if (targetAttribute2 && targetAttribute2 !== '_self') {
- return false;
- }
-
- var routing = _emberMetalProperty_get.get(this, '_routing');
- var qualifiedRouteName = _emberMetalProperty_get.get(this, 'qualifiedRouteName');
- var models = _emberMetalProperty_get.get(this, 'models');
- var queryParamValues = _emberMetalProperty_get.get(this, 'queryParams.values');
- var shouldReplace = _emberMetalProperty_get.get(this, 'attrs.replace');
-
- routing.transitionTo(qualifiedRouteName, models, queryParamValues, shouldReplace);
- },
-
- queryParams: null,
-
- qualifiedRouteName: _emberMetalComputed.computed('targetRouteName', '_routing.currentState', function computeLinkToComponentQualifiedRouteName() {
- var params = _emberMetalProperty_get.get(this, 'params').slice();
- var lastParam = params[params.length - 1];
- if (lastParam && lastParam.isQueryParams) {
- params.pop();
- }
- var onlyQueryParamsSupplied = this[_emberHtmlbarsNodeManagersComponentNodeManager.HAS_BLOCK] ? params.length === 0 : params.length === 1;
- if (onlyQueryParamsSupplied) {
- return _emberMetalProperty_get.get(this, '_routing.currentRouteName');
- }
- return _emberMetalProperty_get.get(this, 'targetRouteName');
- }),
-
- resolvedQueryParams: _emberMetalComputed.computed('queryParams', function computeLinkToComponentResolvedQueryParams() {
- var resolvedQueryParams = {};
- var queryParams = _emberMetalProperty_get.get(this, 'queryParams');
-
- if (!queryParams) {
- return resolvedQueryParams;
- }
-
- var values = queryParams.values;
- for (var key in values) {
- if (!values.hasOwnProperty(key)) {
- continue;
- }
- resolvedQueryParams[key] = values[key];
- }
-
- return resolvedQueryParams;
- }),
-
- /**
- Sets the element's `href` attribute to the url for
- the `LinkComponent`'s targeted route.
- If the `LinkComponent`'s `tagName` is changed to a value other
- than `a`, this property will be ignored.
- @property href
- @private
- */
- href: _emberMetalComputed.computed('models', 'qualifiedRouteName', function computeLinkToComponentHref() {
- if (_emberMetalProperty_get.get(this, 'tagName') !== 'a') {
- return;
- }
-
- var qualifiedRouteName = _emberMetalProperty_get.get(this, 'qualifiedRouteName');
- var models = _emberMetalProperty_get.get(this, 'models');
-
- if (_emberMetalProperty_get.get(this, 'loading')) {
- return _emberMetalProperty_get.get(this, 'loadingHref');
- }
-
- var routing = _emberMetalProperty_get.get(this, '_routing');
- var queryParams = _emberMetalProperty_get.get(this, 'queryParams.values');
- return routing.generateURL(qualifiedRouteName, models, queryParams);
- }),
-
- loading: _emberMetalComputed.computed('_modelsAreLoaded', 'qualifiedRouteName', function computeLinkToComponentLoading() {
- var qualifiedRouteName = _emberMetalProperty_get.get(this, 'qualifiedRouteName');
- var modelsAreLoaded = _emberMetalProperty_get.get(this, '_modelsAreLoaded');
-
- if (!modelsAreLoaded || qualifiedRouteName == null) {
- return _emberMetalProperty_get.get(this, 'loadingClass');
- }
- }),
-
- _modelsAreLoaded: _emberMetalComputed.computed('models', function computeLinkToComponentModelsAreLoaded() {
- var models = _emberMetalProperty_get.get(this, 'models');
- for (var i = 0, l = models.length; i < l; i++) {
- if (models[i] == null) {
- return false;
- }
- }
-
- return true;
- }),
-
- /**
- The default href value to use while a link-to is loading.
- Only applies when tagName is 'a'
- @property loadingHref
- @type String
- @default #
- @private
- */
- loadingHref: '#',
-
- willRender: function () {
- var queryParams = undefined;
-
- var attrs = this.attrs;
-
- // Do not mutate params in place
- var params = _emberMetalProperty_get.get(this, 'params').slice();
-
-
- if (attrs.disabledWhen) {
- this.set('disabled', attrs.disabledWhen);
- }
-
- // Process the positional arguments, in order.
- // 1. Inline link title comes first, if present.
- if (!this[_emberHtmlbarsNodeManagersComponentNodeManager.HAS_BLOCK]) {
- this.set('linkTitle', params.shift());
- }
-
- // 2. `targetRouteName` is now always at index 0.
- this.set('targetRouteName', params[0]);
-
- // 3. The last argument (if still remaining) is the `queryParams` object.
- var lastParam = params[params.length - 1];
-
- if (lastParam && lastParam.isQueryParams) {
- queryParams = params.pop();
- } else {
- queryParams = {};
- }
- this.set('queryParams', queryParams);
-
- // 4. Any remaining indices (excepting `targetRouteName` at 0) are `models`.
- var models = [];
-
- for (var i = 1; i < params.length; i++) {
- var value = params[i];
-
- while (_emberRuntimeMixinsController.default.detect(value)) {
- value = value.get('model');
- }
-
- models.push(value);
- }
-
- this.set('models', models);
- }
- });
-
- LinkComponent.toString = function () {
- return 'LinkComponent';
- };
-
- LinkComponent.reopenClass({
- positionalParams: 'params'
- });
-
- 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
+ @class Backburner
+ @for Ember
+ @private
*/
+ _emberMetalCore.default.Backburner = _backburner.default;
+ // this is the new go forward, once Ember Data updates to using `_Backburner` we
+ // can remove the non-underscored version.
+ _emberMetalCore.default._Backburner = _backburner.default;
- 'use strict';
+ _emberMetalCore.default.libraries = new _emberMetalLibraries.default();
+ _emberMetalCore.default.libraries.registerCoreLibrary('Ember', _emberMetalCore.default.VERSION);
- _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.1.2';
+ _emberMetalCore.default.isNone = _emberMetalIs_none.default;
+ _emberMetalCore.default.isEmpty = _emberMetalIs_empty.default;
+ _emberMetalCore.default.isBlank = _emberMetalIs_blank.default;
+ _emberMetalCore.default.isPresent = _emberMetalIs_present.default;
- var CoreOutletView = _emberViewsViewsView.default.extend({
- defaultTemplate: _emberHtmlbarsTemplatesTopLevelView.default,
+ _emberMetalCore.default.merge = _emberMetalMerge.default;
- init: function () {
- this._super();
- this._outlets = [];
- },
+ _emberMetalCore.default.FEATURES = _emberMetalFeatures.FEATURES;
+ _emberMetalCore.default.FEATURES.isEnabled = _emberMetalFeatures.default;
- setOutletState: function (state) {
- this.outletState = { main: state };
-
- if (this.env) {
- this.env.outletState = this.outletState;
- }
-
- if (this.lastResult) {
- this.dirtyOutlets();
- this._outlets = [];
-
- this.scheduleRevalidate(null, null);
- }
- },
-
- dirtyOutlets: function () {
- // Dirty any render nodes that correspond to outlets
- for (var i = 0; i < this._outlets.length; i++) {
- this._outlets[i].isDirty = true;
- }
- }
- });
-
- exports.CoreOutletView = CoreOutletView;
- var OutletView = CoreOutletView.extend({ tagName: '' });
- exports.OutletView = OutletView;
-});
-enifed('ember-routing', ['exports', 'ember-metal/core', 'ember-routing/ext/run_loop', 'ember-routing/ext/controller', 'ember-routing/location/api', 'ember-routing/location/none_location', 'ember-routing/location/hash_location', 'ember-routing/location/history_location', 'ember-routing/location/auto_location', 'ember-routing/system/generate_controller', 'ember-routing/system/controller_for', 'ember-routing/system/dsl', 'ember-routing/system/router', 'ember-routing/system/route'], function (exports, _emberMetalCore, _emberRoutingExtRun_loop, _emberRoutingExtController, _emberRoutingLocationApi, _emberRoutingLocationNone_location, _emberRoutingLocationHash_location, _emberRoutingLocationHistory_location, _emberRoutingLocationAuto_location, _emberRoutingSystemGenerate_controller, _emberRoutingSystemController_for, _emberRoutingSystemDsl, _emberRoutingSystemRouter, _emberRoutingSystemRoute) {
/**
- @module ember
- @submodule ember-routing
+ A function may be assigned to `Ember.onerror` to be called when Ember
+ internals encounter an error. This is useful for specialized error handling
+ and reporting code.
+
+ ```javascript
+ Ember.onerror = function(error) {
+ Em.$.ajax('/report-error', 'POST', {
+ stack: error.stack,
+ otherInformation: 'whatever app state you want to provide'
+ });
+ };
+ ```
+
+ Internally, `Ember.onerror` is used as Backburner's error handler.
+
+ @event onerror
+ @for Ember
+ @param {Exception} error the error object
+ @public
*/
+ _emberMetalCore.default.onerror = null;
+ // END EXPORTS
- 'use strict';
+ // 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.Location = _emberRoutingLocationApi.default;
- _emberMetalCore.default.AutoLocation = _emberRoutingLocationAuto_location.default;
- _emberMetalCore.default.HashLocation = _emberRoutingLocationHash_location.default;
- _emberMetalCore.default.HistoryLocation = _emberRoutingLocationHistory_location.default;
- _emberMetalCore.default.NoneLocation = _emberRoutingLocationNone_location.default;
+ _emberMetalCore.default.Debug.registerDeprecationHandler = function () {};
+ _emberMetalCore.default.Debug.registerWarnHandler = function () {};
+ }
- _emberMetalCore.default.controllerFor = _emberRoutingSystemController_for.default;
- _emberMetalCore.default.generateControllerFactory = _emberRoutingSystemGenerate_controller.generateControllerFactory;
- _emberMetalCore.default.generateController = _emberRoutingSystemGenerate_controller.default;
- _emberMetalCore.default.RouterDSL = _emberRoutingSystemDsl.default;
- _emberMetalCore.default.Router = _emberRoutingSystemRouter.default;
- _emberMetalCore.default.Route = _emberRoutingSystemRoute.default;
+ _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;
});
-
-// ES6TODO: Cleanup modules with side-effects below
enifed('ember-routing/ext/controller', ['exports', 'ember-metal/property_get', 'ember-runtime/mixins/controller'], function (exports, _emberMetalProperty_get, _emberRuntimeMixinsController) {
'use strict';
/**
@module ember
@@ -23284,11 +22424,11 @@
// 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/location/api', ['exports', 'ember-metal/core', 'ember-metal/environment', 'ember-routing/location/util'], function (exports, _emberMetalCore, _emberMetalEnvironment, _emberRoutingLocationUtil) {
+enifed('ember-routing/location/api', ['exports', 'ember-metal/debug', 'ember-metal/environment', 'ember-routing/location/util'], function (exports, _emberMetalDebug, _emberMetalEnvironment, _emberRoutingLocationUtil) {
'use strict';
/**
@module ember
@submodule ember-routing
@@ -23429,13 +22569,13 @@
need.
@private
*/
create: function (options) {
var implementation = options && options.implementation;
-
+
var implementationClass = this.implementations[implementation];
-
+
return implementationClass.create.apply(implementationClass, arguments);
},
implementations: {},
_location: _emberMetalEnvironment.default.location,
@@ -23451,12 +22591,11 @@
_getHash: function () {
return _emberRoutingLocationUtil.getHash(this.location);
}
};
});
-// deprecate, assert
-enifed('ember-routing/location/auto_location', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/utils', 'ember-runtime/system/object', 'ember-metal/environment', 'ember-routing/location/util'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalUtils, _emberRuntimeSystemObject, _emberMetalEnvironment, _emberRoutingLocationUtil) {
+enifed('ember-routing/location/auto_location', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/utils', 'ember-runtime/system/object', 'ember-metal/environment', 'ember-routing/location/util'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalUtils, _emberRuntimeSystemObject, _emberMetalEnvironment, _emberRoutingLocationUtil) {
'use strict';
exports.getHistoryPath = getHistoryPath;
exports.getHashPath = getHashPath;
@@ -23545,11 +22684,10 @@
@private
*/
detect: function () {
var rootURL = this.rootURL;
-
var implementation = detectImplementation({
location: this.location,
history: this.history,
userAgent: this.userAgent,
rootURL: rootURL,
@@ -23563,11 +22701,10 @@
}
var concrete = this.container.lookup('location:' + implementation);
_emberMetalProperty_set.set(concrete, 'rootURL', rootURL);
-
_emberMetalProperty_set.set(this, 'concreteImplementation', concrete);
},
initState: delegateToConcreteImplementation('initState'),
getURL: delegateToConcreteImplementation('getURL'),
@@ -23586,11 +22723,11 @@
});
function delegateToConcreteImplementation(methodName) {
return function () {
var concreteImplementation = _emberMetalProperty_get.get(this, 'concreteImplementation');
-
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _emberMetalUtils.tryInvoke(concreteImplementation, methodName, args);
@@ -23675,11 +22812,10 @@
var hash = _emberRoutingLocationUtil.getHash(location);
var query = _emberRoutingLocationUtil.getQuery(location);
var rootURLIndex = path.indexOf(rootURL);
var routeHash, hashParts;
-
// By convention, Ember.js routes using HashLocation are required to start
// with `#/`. Anything else should NOT be considered a route and should
// be passed straight through, without transformation.
if (hash.substr(0, 2) === '#/') {
// There could be extra hash segments after the route
@@ -23729,12 +22865,11 @@
}
return path;
}
});
-// FEATURES
-enifed('ember-routing/location/hash_location', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/run_loop', 'ember-metal/utils', 'ember-runtime/system/object', 'ember-routing/location/api'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalRun_loop, _emberMetalUtils, _emberRuntimeSystemObject, _emberRoutingLocationApi) {
+enifed('ember-routing/location/hash_location', ['exports', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/run_loop', 'ember-metal/utils', 'ember-runtime/system/object', 'ember-routing/location/api', 'ember-views/system/jquery'], function (exports, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalRun_loop, _emberMetalUtils, _emberRuntimeSystemObject, _emberRoutingLocationApi, _emberViewsSystemJquery) {
'use strict';
/**
@module ember
@submodule ember-routing
@@ -23828,11 +22963,11 @@
onUpdateURL: function (callback) {
var _this = this;
var guid = _emberMetalUtils.guidFor(this);
- _emberMetalCore.default.$(window).on('hashchange.ember-location-' + guid, function () {
+ _emberViewsSystemJquery.default(window).on('hashchange.ember-location-' + guid, function () {
_emberMetalRun_loop.default(function () {
var path = _this.getURL();
if (_emberMetalProperty_get.get(_this, 'lastSetURL') === path) {
return;
}
@@ -23863,11 +22998,11 @@
@method willDestroy
*/
willDestroy: function () {
var guid = _emberMetalUtils.guidFor(this);
- _emberMetalCore.default.$(window).off('hashchange.ember-location-' + guid);
+ _emberViewsSystemJquery.default(window).off('hashchange.ember-location-' + guid);
}
});
});
enifed('ember-routing/location/history_location', ['exports', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/utils', 'ember-runtime/system/object', 'ember-routing/location/api', 'ember-views/system/jquery'], function (exports, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalUtils, _emberRuntimeSystemObject, _emberRoutingLocationApi, _emberViewsSystemJquery) {
'use strict';
@@ -24299,11 +23434,11 @@
function replacePath(location, path) {
location.replace(getOrigin(location) + path);
}
});
-enifed('ember-routing/services/routing', ['exports', 'ember-runtime/system/service', 'ember-metal/property_get', 'ember-metal/computed_macros', 'ember-routing/utils', 'ember-metal/merge'], function (exports, _emberRuntimeSystemService, _emberMetalProperty_get, _emberMetalComputed_macros, _emberRoutingUtils, _emberMetalMerge) {
+enifed('ember-routing/services/routing', ['exports', 'ember-runtime/system/service', 'ember-metal/property_get', 'ember-metal/computed_macros', 'ember-routing/utils', 'ember-metal/assign'], function (exports, _emberRuntimeSystemService, _emberMetalProperty_get, _emberMetalComputed_macros, _emberRoutingUtils, _emberMetalAssign) {
/**
@module ember
@submodule ember-routing
*/
@@ -24356,11 +23491,11 @@
if (!router.router) {
return;
}
var visibleQueryParams = {};
- _emberMetalMerge.default(visibleQueryParams, queryParams);
+ _emberMetalAssign.default(visibleQueryParams, queryParams);
this.normalizeQueryParams(routeName, models, visibleQueryParams);
var args = _emberRoutingUtils.routeArgs(routeName, models, visibleQueryParams);
return router.generate.apply(router, args);
@@ -24455,15 +23590,13 @@
function controllerFor(container, controllerName, lookupOptions) {
return container.lookup("controller:" + controllerName, lookupOptions);
}
});
-enifed('ember-routing/system/dsl', ['exports', 'ember-metal/core'], function (exports, _emberMetalCore) {
+enifed('ember-routing/system/dsl', ['exports', 'ember-metal/debug'], function (exports, _emberMetalDebug) {
'use strict';
- // FEATURES, assert
-
/**
@module ember
@submodule ember-routing
*/
@@ -24484,12 +23617,10 @@
if (arguments.length === 1) {
options = {};
}
-
-
if (this.enableLoadingSubstates) {
createRoute(this, name + '_loading', { resetNamespace: options.resetNamespace });
createRoute(this, name + '_error', { path: dummyErrorRoute });
}
@@ -24528,11 +23659,12 @@
if (arguments.length === 1) {
options = {};
}
options.resetNamespace = true;
- this.route(name, options, callback);
+
+ this.route(name, options, callback);
},
generate: function () {
var dslMatches = this.matches;
@@ -24577,11 +23709,11 @@
var dsl = new DSL();
callback.call(dsl);
return dsl;
};
});
-enifed('ember-routing/system/generate_controller', ['exports', 'ember-metal/core', 'ember-metal/property_get'], function (exports, _emberMetalCore, _emberMetalProperty_get) {
+enifed('ember-routing/system/generate_controller', ['exports', 'ember-metal/debug', 'ember-metal/property_get'], function (exports, _emberMetalDebug, _emberMetalProperty_get) {
'use strict';
exports.generateControllerFactory = generateControllerFactory;
exports.default = generateController;
@@ -24633,27 +23765,24 @@
generateControllerFactory(container, controllerName, context);
var fullName = 'controller:' + controllerName;
var instance = container.lookup(fullName);
- if (_emberMetalProperty_get.get(instance, 'namespace.LOG_ACTIVE_GENERATION')) {
- _emberMetalCore.default.Logger.info('generated -> ' + fullName, { fullName: fullName });
- }
+ if (_emberMetalProperty_get.get(instance, 'namespace.LOG_ACTIVE_GENERATION')) {}
return instance;
}
});
-// Logger
enifed('ember-routing/system/query_params', ['exports', 'ember-runtime/system/object'], function (exports, _emberRuntimeSystemObject) {
'use strict';
exports.default = _emberRuntimeSystemObject.default.extend({
isQueryParams: true,
values: null
});
});
-enifed('ember-routing/system/route', ['exports', 'ember-metal/core', 'ember-metal/features', 'ember-metal/error', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/get_properties', 'ember-metal/is_none', 'ember-metal/computed', 'ember-metal/merge', 'ember-runtime/utils', 'ember-metal/run_loop', 'ember-runtime/copy', 'ember-runtime/system/string', 'ember-runtime/system/object', 'ember-runtime/mixins/evented', 'ember-runtime/mixins/action_handler', 'ember-routing/system/generate_controller', 'ember-routing/utils'], function (exports, _emberMetalCore, _emberMetalFeatures, _emberMetalError, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalGet_properties, _emberMetalIs_none, _emberMetalComputed, _emberMetalMerge, _emberRuntimeUtils, _emberMetalRun_loop, _emberRuntimeCopy, _emberRuntimeSystemString, _emberRuntimeSystemObject, _emberRuntimeMixinsEvented, _emberRuntimeMixinsAction_handler, _emberRoutingSystemGenerate_controller, _emberRoutingUtils) {
+enifed('ember-routing/system/route', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/features', 'ember-metal/error', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/get_properties', 'ember-metal/is_none', 'ember-metal/computed', 'ember-metal/assign', 'ember-runtime/utils', 'ember-metal/run_loop', 'ember-runtime/copy', 'ember-runtime/system/string', 'ember-runtime/system/object', 'ember-runtime/system/native_array', 'ember-runtime/mixins/evented', 'ember-runtime/mixins/action_handler', 'ember-routing/system/generate_controller', 'ember-routing/utils'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalFeatures, _emberMetalError, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalGet_properties, _emberMetalIs_none, _emberMetalComputed, _emberMetalAssign, _emberRuntimeUtils, _emberMetalRun_loop, _emberRuntimeCopy, _emberRuntimeSystemString, _emberRuntimeSystemObject, _emberRuntimeSystemNative_array, _emberRuntimeMixinsEvented, _emberRuntimeMixinsAction_handler, _emberRoutingSystemGenerate_controller, _emberRoutingUtils) {
'use strict';
var slice = Array.prototype.slice;
function K() {
@@ -24787,11 +23916,11 @@
var urlKey = desc.as || this.serializeQueryParamKey(propName);
var defaultValue = _emberMetalProperty_get.get(controllerProto, propName);
if (Array.isArray(defaultValue)) {
- defaultValue = _emberMetalCore.default.A(defaultValue.slice());
+ defaultValue = _emberRuntimeSystemNative_array.A(defaultValue.slice());
}
var type = desc.type || _emberRuntimeUtils.typeOf(defaultValue);
var defaultValueSerialized = this.serializeQueryParam(defaultValue, urlKey, type);
@@ -24931,12 +24060,12 @@
var transition = this.router.router.activeTransition;
var state = transition ? transition.state : this.router.router.state;
var params = {};
- _emberMetalMerge.default(params, state.params[name]);
- _emberMetalMerge.default(params, getQueryParamsFor(route, state));
+ _emberMetalAssign.default(params, state.params[name]);
+ _emberMetalAssign.default(params, getQueryParamsFor(route, state));
return params;
},
/**
@@ -24985,11 +24114,11 @@
if (defaultValueType === 'boolean') {
return value === 'true' ? true : false;
} else if (defaultValueType === 'number') {
return Number(value).valueOf();
} else if (defaultValueType === 'array') {
- return _emberMetalCore.default.A(JSON.parse(value));
+ return _emberRuntimeSystemNative_array.A(JSON.parse(value));
}
return value;
},
/**
@@ -26013,16 +25142,14 @@
return {
find: function (name, value) {
var modelClass = container.lookupFactory('model:' + name);
-
if (!modelClass) {
return;
}
-
return modelClass.find(value);
}
};
}),
@@ -26164,11 +25291,11 @@
controller = container.lookup('controller:' + name);
// NOTE: We're specifically checking that skipAssert is true, because according
// to the old API the second parameter was model. We do not want people who
// passed a model to skip the assertion.
-
+
return controller;
},
/**
Generates a controller for a route.
@@ -26366,11 +25493,11 @@
@param {Object} [options.model] the model object to set on `options.controller`.
Defaults to the return value of the Route's model hook
@public
*/
render: function (_name, options) {
-
+
var namePassed = typeof _name === 'string' && !!_name;
var isDefaultRender = arguments.length === 0 || _emberMetalCore.default.isEmpty(arguments[0]);
var name;
if (typeof _name === 'object' && !options) {
@@ -26573,13 +25700,12 @@
};
var Component = undefined;
if (!ViewClass && !template && !Component) {
- if (LOG_VIEW_LOOKUPS) {
+ 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;
}
@@ -26588,11 +25714,11 @@
if (state.fullQueryParams) {
return state.fullQueryParams;
}
state.fullQueryParams = {};
- _emberMetalMerge.default(state.fullQueryParams, state.queryParams);
+ _emberMetalAssign.default(state.fullQueryParams, state.queryParams);
var targetRouteName = state.handlerInfos[state.handlerInfos.length - 1].name;
router._deserializeQueryParams(targetRouteName, state.fullQueryParams);
return state.fullQueryParams;
}
@@ -26623,11 +25749,11 @@
return params;
}
function copyDefaultValue(value) {
if (Array.isArray(value)) {
- return _emberMetalCore.default.A(value.slice());
+ return _emberRuntimeSystemNative_array.A(value.slice());
}
return value;
}
/*
@@ -26652,12 +25778,12 @@
if (!controllerQP.hasOwnProperty(cqpName)) {
continue;
}
var newControllerParameterConfiguration = {};
- _emberMetalMerge.default(newControllerParameterConfiguration, controllerQP[cqpName]);
- _emberMetalMerge.default(newControllerParameterConfiguration, routeQP[cqpName]);
+ _emberMetalAssign.default(newControllerParameterConfiguration, controllerQP[cqpName]);
+ _emberMetalAssign.default(newControllerParameterConfiguration, routeQP[cqpName]);
qps[cqpName] = newControllerParameterConfiguration;
// allows us to skip this QP when we check route QPs.
keysAlreadyMergedOrSkippable[cqpName] = true;
@@ -26669,11 +25795,11 @@
if (!routeQP.hasOwnProperty(rqpName) || keysAlreadyMergedOrSkippable[rqpName]) {
continue;
}
var newRouteParameterConfiguration = {};
- _emberMetalMerge.default(newRouteParameterConfiguration, routeQP[rqpName], controllerQP[rqpName]);
+ _emberMetalAssign.default(newRouteParameterConfiguration, routeQP[rqpName], controllerQP[rqpName]);
qps[rqpName] = newRouteParameterConfiguration;
}
return qps;
}
@@ -26682,69 +25808,23 @@
propNames.forEach(function (prop) {
controller.addObserver(prop + '.[]', controller, controller._qpChanged);
});
}
- function deprecateQueryParamDefaultValuesSetOnController(controllerName, routeName, propName) {
- }
+ function deprecateQueryParamDefaultValuesSetOnController(controllerName, routeName, propName) {}
exports.default = Route;
});
// FEATURES, A, deprecate, assert, Logger
// apply default values to controllers
// detect that default value defined on router config
// detect that property was not defined on controller
-enifed('ember-routing/system/router_state', ['exports', 'ember-metal/is_empty', 'ember-metal/keys', 'ember-runtime/system/object', 'ember-metal/merge'], function (exports, _emberMetalIs_empty, _emberMetalKeys, _emberRuntimeSystemObject, _emberMetalMerge) {
+enifed('ember-routing/system/router', ['exports', 'ember-metal/logger', 'ember-metal/debug', 'ember-metal/error', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/properties', 'ember-metal/empty_object', 'ember-metal/computed', 'ember-metal/assign', 'ember-metal/run_loop', 'ember-runtime/system/object', 'ember-runtime/mixins/evented', 'ember-routing/system/dsl', 'ember-routing/location/api', 'ember-routing/utils', 'ember-routing/system/router_state', 'router', 'router/transition'], function (exports, _emberMetalLogger, _emberMetalDebug, _emberMetalError, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalProperties, _emberMetalEmpty_object, _emberMetalComputed, _emberMetalAssign, _emberMetalRun_loop, _emberRuntimeSystemObject, _emberRuntimeMixinsEvented, _emberRoutingSystemDsl, _emberRoutingLocationApi, _emberRoutingUtils, _emberRoutingSystemRouter_state, _router4, _routerTransition) {
'use strict';
- var RouterState = _emberRuntimeSystemObject.default.extend({
- emberRouter: null,
- routerJs: null,
- routerJsState: null,
-
- isActiveIntent: function (routeName, models, queryParams, queryParamsMustMatch) {
- var state = this.routerJsState;
- if (!this.routerJs.isActiveIntent(routeName, models, null, state)) {
- return false;
- }
-
- var emptyQueryParams = _emberMetalIs_empty.default(_emberMetalKeys.default(queryParams));
-
- if (queryParamsMustMatch && !emptyQueryParams) {
- var visibleQueryParams = {};
- _emberMetalMerge.default(visibleQueryParams, queryParams);
-
- this.emberRouter._prepareQueryParams(routeName, models, visibleQueryParams);
- return shallowEqual(visibleQueryParams, state.queryParams);
- }
-
- return true;
- }
- });
-
- function shallowEqual(a, b) {
- var k;
- for (k in a) {
- if (a.hasOwnProperty(k) && a[k] !== b[k]) {
- return false;
- }
- }
- for (k in b) {
- if (b.hasOwnProperty(k) && a[k] !== b[k]) {
- return false;
- }
- }
- return true;
- }
-
- exports.default = RouterState;
-});
-enifed('ember-routing/system/router', ['exports', 'ember-metal/core', 'ember-metal/error', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/properties', 'ember-metal/empty_object', 'ember-metal/computed', 'ember-metal/merge', 'ember-metal/run_loop', 'ember-runtime/system/object', 'ember-runtime/mixins/evented', 'ember-routing/system/dsl', 'ember-routing/location/api', 'ember-routing/utils', './router_state', 'router', 'router/transition'], function (exports, _emberMetalCore, _emberMetalError, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalProperties, _emberMetalEmpty_object, _emberMetalComputed, _emberMetalMerge, _emberMetalRun_loop, _emberRuntimeSystemObject, _emberRuntimeMixinsEvented, _emberRoutingSystemDsl, _emberRoutingLocationApi, _emberRoutingUtils, _router_state, _router4, _routerTransition) {
- 'use strict';
-
function K() {
return this;
}
var slice = [].slice;
@@ -26806,11 +25886,11 @@
}
generateDSL.call(dsl);
if (_emberMetalProperty_get.get(this, 'namespace.LOG_TRANSITIONS_INTERNAL')) {
- router.log = _emberMetalCore.default.Logger.debug;
+ router.log = _emberMetalLogger.default.debug;
}
router.map(dsl.generate());
},
@@ -26918,11 +25998,11 @@
// Put this in the runloop so url will be accurate. Seems
// less surprising than didTransition being out of sync.
_emberMetalRun_loop.default.once(this, this.trigger, 'didTransition');
if (_emberMetalProperty_get.get(this, 'namespace').LOG_TRANSITIONS) {
- _emberMetalCore.default.Logger.log('Transitioned into \'' + EmberRouter._routePath(infos) + '\'');
+ _emberMetalLogger.default.log('Transitioned into \'' + EmberRouter._routePath(infos) + '\'');
}
},
_setOutlets: function () {
var handlerInfos = this.router.currentHandlerInfos;
@@ -26969,11 +26049,11 @@
*/
willTransition: function (oldInfos, newInfos, transition) {
_emberMetalRun_loop.default.once(this, this.trigger, 'willTransition', transition);
if (_emberMetalProperty_get.get(this, 'namespace').LOG_TRANSITIONS) {
- _emberMetalCore.default.Logger.log('Preparing to transition from \'' + EmberRouter._routePath(oldInfos) + '\' to \' ' + EmberRouter._routePath(newInfos) + '\'');
+ _emberMetalLogger.default.log('Preparing to transition from \'' + EmberRouter._routePath(oldInfos) + '\' to \'' + EmberRouter._routePath(newInfos) + '\'');
}
},
handleURL: function (url) {
// Until we have an ember-idiomatic way of accessing #hashes, we need to
@@ -27017,11 +26097,11 @@
updatePaths(this);
var infos = this.router.currentHandlerInfos;
if (_emberMetalProperty_get.get(this, 'namespace').LOG_TRANSITIONS) {
- _emberMetalCore.default.Logger.log('Intermediate-transitioned into \'' + EmberRouter._routePath(infos) + '\'');
+ _emberMetalLogger.default.log('Intermediate-transitioned into \'' + EmberRouter._routePath(infos) + '\'');
}
},
replaceWith: function () {
return this.transitionTo.apply(this, arguments).method('replace');
@@ -27137,11 +26217,11 @@
this.transitionTo({ queryParams: this._queuedQPChanges });
this._resetQueuedQueryParameterChanges();
},
_connectActiveComponentNode: function (templateName, componentNode) {
-
+
var _activeViews = this._activeViews;
function disconnectActiveView() {
delete _activeViews[templateName];
}
@@ -27207,13 +26287,11 @@
if (!handler) {
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 });
- }
+ if (_emberMetalProperty_get.get(_this2, 'namespace.LOG_ACTIVE_GENERATION')) {}
}
handler.routeName = name;
return handler;
};
@@ -27269,11 +26347,12 @@
delete queryParams[key];
});
for (var key in groupedByUrlKey) {
var qps = groupedByUrlKey[key];
- var qp = qps[0].qp;
+
+ var qp = qps[0].qp;
queryParams[qp.urlKey] = qp.route.serializeQueryParam(qps[0].value, qp.urlKey, qp.type);
}
},
_deserializeQueryParams: function (targetRouteName, queryParams) {
@@ -27293,13 +26372,13 @@
}
},
_doTransition: function (_targetRouteName, models, _queryParams) {
var targetRouteName = _targetRouteName || _emberRoutingUtils.getActiveTargetName(this.router);
-
+
var queryParams = {};
- _emberMetalMerge.default(queryParams, _queryParams);
+ _emberMetalAssign.default(queryParams, _queryParams);
this._prepareQueryParams(targetRouteName, models, queryParams);
var transitionArgs = _emberRoutingUtils.routeArgs(targetRouteName, models, queryParams);
var transitionPromise = this.router.transitionTo.apply(this.router, transitionArgs);
@@ -27341,11 +26420,11 @@
if (!qpMeta) {
continue;
}
- _emberMetalMerge.default(map, qpMeta.map);
+ _emberMetalAssign.default(map, qpMeta.map);
qps.push.apply(qps, qpMeta.qps);
}
return {
qps: qps,
@@ -27394,11 +26473,11 @@
// Don't fire an event if we've since moved on from
// the transition that put us in a loading state.
return;
}
- this.set('targetState', _router_state.default.create({
+ this.set('targetState', _emberRoutingSystemRouter_state.default.create({
emberRouter: this,
routerJs: this.router,
routerJsState: this.router.activeTransition.state
}));
@@ -27529,11 +26608,11 @@
if (typeof error === 'string') {
errorArgs.push(error);
}
}
- _emberMetalCore.default.Logger.error.apply(this, errorArgs);
+ _emberMetalLogger.default.error.apply(this, errorArgs);
}
function findChildRouteName(parentRoute, originatingChildRoute, name) {
var router = parentRoute.router;
var childName;
@@ -27724,11 +26803,11 @@
return path.join('.');
}
});
function didBeginTransition(transition, router) {
- var routerState = _router_state.default.create({
+ var routerState = _emberRoutingSystemRouter_state.default.create({
emberRouter: router,
routerJs: router.router,
routerJsState: transition.state
});
@@ -27815,14 +26894,11 @@
},
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
- // `impersonateAnOutlet`.
- });
+ _emberMetalRun_loop.default.schedule('afterRender', function () {});
}
function representEmptyRoute(liveRoutes, defaultParentState, route) {
// the route didn't render anything
var alreadyAppended = findLiveRoute(liveRoutes, route.routeName);
@@ -27846,19 +26922,66 @@
}
}
exports.default = EmberRouter;
});
-// FEATURES, Logger, assert
/**
@module ember
@submodule ember-routing
*/
-enifed('ember-routing/utils', ['exports', 'ember-metal/merge', 'ember-metal/property_get'], function (exports, _emberMetalMerge, _emberMetalProperty_get) {
+
+// `wasUsed` gets set by the render helper. See the function
+// `impersonateAnOutlet`.
+enifed('ember-routing/system/router_state', ['exports', 'ember-metal/is_empty', 'ember-metal/keys', 'ember-runtime/system/object', 'ember-metal/assign'], function (exports, _emberMetalIs_empty, _emberMetalKeys, _emberRuntimeSystemObject, _emberMetalAssign) {
'use strict';
+ var RouterState = _emberRuntimeSystemObject.default.extend({
+ emberRouter: null,
+ routerJs: null,
+ routerJsState: null,
+
+ isActiveIntent: function (routeName, models, queryParams, queryParamsMustMatch) {
+ var state = this.routerJsState;
+ if (!this.routerJs.isActiveIntent(routeName, models, null, state)) {
+ return false;
+ }
+
+ var emptyQueryParams = _emberMetalIs_empty.default(_emberMetalKeys.default(queryParams));
+
+ if (queryParamsMustMatch && !emptyQueryParams) {
+ var visibleQueryParams = {};
+ _emberMetalAssign.default(visibleQueryParams, queryParams);
+
+ this.emberRouter._prepareQueryParams(routeName, models, visibleQueryParams);
+ return shallowEqual(visibleQueryParams, state.queryParams);
+ }
+
+ return true;
+ }
+ });
+
+ function shallowEqual(a, b) {
+ var k;
+ for (k in a) {
+ if (a.hasOwnProperty(k) && a[k] !== b[k]) {
+ return false;
+ }
+ }
+ for (k in b) {
+ if (b.hasOwnProperty(k) && a[k] !== b[k]) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ exports.default = RouterState;
+});
+enifed('ember-routing/utils', ['exports', 'ember-metal/assign', 'ember-metal/property_get'], function (exports, _emberMetalAssign, _emberMetalProperty_get) {
+ 'use strict';
+
exports.routeArgs = routeArgs;
exports.getActiveTargetName = getActiveTargetName;
exports.stashParamNames = stashParamNames;
exports.calculateCacheKey = calculateCacheKey;
exports.normalizeControllerQueryParams = normalizeControllerQueryParams;
@@ -28023,102 +27146,1699 @@
if (typeof singleDesc === 'string') {
singleDesc = { as: singleDesc };
}
tmp = accum[key] || { as: null, scope: 'model' };
- _emberMetalMerge.default(tmp, singleDesc);
+ _emberMetalAssign.default(tmp, singleDesc);
accum[key] = tmp;
}
}
});
-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) {
+enifed('ember-routing-htmlbars/helpers/query-params', ['exports', 'ember-metal/debug', 'ember-routing/system/query_params'], function (exports, _emberMetalDebug, _emberRoutingSystemQuery_params) {
/**
@module ember
- @submodule ember-runtime
+ @submodule ember-routing-htmlbars
*/
- // BEGIN IMPORTS
'use strict';
- // END IMPORTS
+ exports.queryParamsHelper = queryParamsHelper;
- // BEGIN EXPORTS
- _emberMetal.default.compare = _emberRuntimeCompare.default;
- _emberMetal.default.copy = _emberRuntimeCopy.default;
- _emberMetal.default.isEqual = _emberRuntimeIsEqual.default;
+ /**
+ This is a helper to be used in conjunction with the link-to helper.
+ It will supply url query parameters to the target route.
+
+ Example
+
+ ```handlebars
+ {{#link-to 'posts' (query-params direction="asc")}}Sort{{/link-to}}
+ ```
+
+ @method query-params
+ @for Ember.Templates.helpers
+ @param {Object} hash takes a hash of query parameters
+ @return {Object} A `QueryParams` object for `{{link-to}}`
+ @public
+ */
- _emberMetal.default.inject = _emberRuntimeInject.default;
+ function queryParamsHelper(params, hash) {
- _emberMetal.default.Array = _emberRuntimeMixinsArray.default;
+ return _emberRoutingSystemQuery_params.default.create({
+ values: hash
+ });
+ }
+});
+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
+ */
- _emberMetal.default.Comparable = _emberRuntimeMixinsComparable.default;
- _emberMetal.default.Copyable = _emberRuntimeMixinsCopyable.default;
+ 'use strict';
- _emberMetal.default.Freezable = _emberRuntimeMixinsFreezable.Freezable;
- _emberMetal.default.FROZEN_ERROR = _emberRuntimeMixinsFreezable.FROZEN_ERROR;
+ /**
+ The `{{action}}` helper provides a way to pass triggers for behavior (usually
+ just a function) between components, and into components from controllers.
+
+ ### Passing functions with the action helper
+
+ There are three contexts an action helper can be used in. The first two
+ contexts to discuss are attribute context, and Handlebars value context.
+
+ ```handlebars
+ {{! An example of attribute context }}
+ <div onclick={{action "save"}}></div>
+ {{! Examples of Handlebars value context }}
+ {{input on-input=(action "save")}}
+ {{yield (action "refreshData") andAnotherParam}}
+ ```
+
+ In these contexts,
+ the helper is called a "closure action" helper. It's behavior is simple:
+ If passed a function name, read that function off the `actions` property
+ of the current context. Once that function is read (or if a function was
+ passed), create a closure over that function and any arguments.
+
+ The resulting value of an action helper used this way is simply a function.
+ For example with this attribute context example:
+
+ ```handlebars
+ {{! An example of attribute context }}
+ <div onclick={{action "save"}}></div>
+ ```
+
+ The resulting template render logic would be:
+
+ ```js
+ var div = document.createElement('div');
+ var actionFunction = (function(context){
+ return function() {
+ return context.actions.save.apply(context, arguments);
+ };
+ })(context);
+ div.onclick = actionFunction;
+ ```
+
+ Thus when the div is clicked, the action on that context is called.
+ Because the `actionFunction` is just a function, closure actions can be
+ passed between components the still execute in the correct context.
+
+ Here is an example action handler on a component:
+
+ ```js
+ export default Ember.Component.extend({
+ actions: {
+ save(/* event *\/) {
+ this.get('model').save();
+ }
+ }
+ });
+ ```
+
+ Actions are always looked up on the `actions` property of the current context.
+ This avoids collisions in the naming of common actions, such as `destroy`.
+
+ Two options can be passed to the `action` helper when it is used in this way.
+
+ * `target=someProperty` will look to `someProperty` instead of the current
+ context for the `actions` hash. This can be useful when targetting a
+ service for actions.
+ * `value="target.value"` will read the path `target.value` off the first
+ argument to the action when it is called and rewrite the first argument
+ to be that value. This is useful when attaching actions to event listeners.
+
+ ### Invoking an action
+
+ Closure actions curry both their scope and any arguments. When invoked, any
+ additional arguments are added to the already curried list.
+
+ Actions should be invoked using the [sendAction](/api/classes/Ember.Component.html#method_sendAction)
+ method. The first argument to `sendAction` is the action to be called, and
+ additional arguments are passed to the action function. This has interesting
+ properties combined with currying of arguments. For example:
+
+ ```js
+ export default Ember.Component.extend({
+ actions: {
+ // Usage {{input on-input=(action (action 'setName' model) value="target.value")}}
+ setName(model, name) {
+ model.set('name', name);
+ }
+ }
+ });
+ ```
+
+ The first argument (`model`) was curried over, and the run-time argument (`event`)
+ becomes a second argument. Action calls be nested this way because each simply
+ returns a function. Any function can be passed to the `{{action` helper, including
+ other actions.
+
+ Actions invoked with `sendAction` have the same currying behavior as demonstrated
+ with `on-input` above. For example:
+
+ ```js
+ export default Ember.Component.extend({
+ actions: {
+ setName(model, name) {
+ model.set('name', name);
+ }
+ }
+ });
+ ```
+
+ ```handlebars
+ {{my-input submit=(action 'setName' model)}}
+ ```
+
+ ```js
+ // app/components/my-component.js
+ export default Ember.Component.extend({
+ click() {
+ // Note that model is not passed, it was curried in the template
+ this.sendAction('submit', 'bob');
+ }
+ });
+ ```
+
+ ### Attaching actions to DOM
+
+ The third context the `{{action` helper can be used in we call "element space".
+ For example:
+
+ ```handlebars
+ {{! An example of element space }}
+ <div {{action "save"}}></div>
+ ```
+
+ Used this way, the `{{action}}` helper provides a useful shortcut for
+ registering an HTML element within a template for a single DOM event and
+ forwarding that interaction to the template's context (controller or component).
+
+ If the context of a template is a controller, actions used this way will
+ bubble to routes when the controller does not implement the specified action.
+ Once an action hits a route, it will bubble through the route hierarchy.
+
+ ### Event Propagation
+
+ `{{action` helpers called in element space can control event bubbling.
+
+ Events triggered through the action helper will automatically have
+ `.preventDefault()` called on them. You do not need to do so in your event
+ handlers. If you need to allow event propagation (to handle file inputs for
+ example) you can supply the `preventDefault=false` option to the `{{action}}` helper:
+
+ ```handlebars
+ <div {{action "sayHello" preventDefault=false}}>
+ <input type="file" />
+ <input type="checkbox" />
+ </div>
+ ```
+
+ To disable bubbling, pass `bubbles=false` to the helper:
+
+ ```handlebars
+ <button {{action 'edit' post bubbles=false}}>Edit</button>
+ ```
+
+ If you need the default handler to trigger you should either register your
+ own event handler, or use event methods on your view class. See [Ember.View](/api/classes/Ember.View.html)
+ 'Responding to Browser Events' for more information.
+
+ ### Specifying DOM event type
+
+ `{{action` helpers called in element space can specify an event type.
+
+ By default the `{{action}}` helper registers for DOM `click` events. You can
+ supply an `on` option to the helper to specify a different DOM event name:
+
+ ```handlebars
+ <div {{action "anActionName" on="double-click"}}>
+ click me
+ </div>
+ ```
+
+ See [Event Names](/api/classes/Ember.View.html#toc_event-names) for a list of
+ acceptable DOM event names.
+
+ ### Specifying whitelisted modifier keys
+
+ `{{action` helpers called in element space can specify modifier keys.
+
+ By default the `{{action}}` helper will ignore click event with pressed modifier
+ keys. You can supply an `allowedKeys` option to specify which keys should not be ignored.
+
+ ```handlebars
+ <div {{action "anActionName" allowedKeys="alt"}}>
+ click me
+ </div>
+ ```
+
+ This way the `{{action}}` will fire when clicking with the alt key pressed down.
+
+ Alternatively, supply "any" to the `allowedKeys` option to accept any combination of modifier keys.
+
+ ```handlebars
+ <div {{action "anActionName" allowedKeys="any"}}>
+ click me with any key pressed
+ </div>
+ ```
+
+ ### Specifying a Target
+
+ A `target` option can be provided to the helper to change
+ which object will receive the method call. This option must be a path
+ to an object, accessible in the current context:
+
+ ```handlebars
+ {{! app/templates/application.hbs }}
+ <div {{action "anActionName" target=someService}}>
+ click me
+ </div>
+ ```
+
+ ```javascript
+ // app/controllers/application.js
+ export default Ember.Controller.extend({
+ someService: Ember.inject.service()
+ });
+ ```
+
+ @method action
+ @for Ember.Templates.helpers
+ @public
+ */
- _emberMetal.default.MutableEnumerable = _emberRuntimeMixinsMutable_enumerable.default;
- _emberMetal.default.MutableArray = _emberRuntimeMixinsMutable_array.default;
+ exports.default = function (morph, env, scope, params, hash, template, inverse, visitor) {
+ if (morph) {
+ _htmlbarsRuntimeHooks.keyword('@element_action', morph, env, scope, params, hash, template, inverse, visitor);
+ return true;
+ }
- _emberMetal.default.TargetActionSupport = _emberRuntimeMixinsTarget_action_support.default;
- _emberMetal.default.Evented = _emberRuntimeMixinsEvented.default;
+ 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-htmlbars/hooks/subexpr', 'ember-metal/error'], function (exports, _emberMetalStreamsStream, _emberMetalStreamsUtils, _emberMetalUtils, _emberMetalProperty_get, _emberHtmlbarsHooksSubexpr, _emberMetalError) {
+ 'use strict';
- _emberMetal.default.PromiseProxyMixin = _emberRuntimeMixinsPromise_proxy.default;
+ exports.default = closureAction;
+ var INVOKE = _emberMetalUtils.symbol('INVOKE');
+ exports.INVOKE = INVOKE;
+ var ACTION = _emberMetalUtils.symbol('ACTION');
- _emberMetal.default.Observable = _emberRuntimeMixinsObservable.default;
+ exports.ACTION = ACTION;
- _emberMetal.default.typeOf = _emberRuntimeUtils.typeOf;
- _emberMetal.default.isArray = _emberRuntimeUtils.isArray;
+ function closureAction(morph, env, scope, params, hash, template, inverse, visitor) {
+ var s = new _emberMetalStreamsStream.Stream(function () {
+ var rawAction = params[0];
+ var actionArguments = _emberMetalStreamsUtils.readArray(params.slice(1, params.length));
- // ES6TODO: this seems a less than ideal way/place to add properties to Ember.computed
- var EmComputed = _emberMetal.default.computed;
+ var target, action, valuePath;
+ if (rawAction[INVOKE]) {
+ // on-change={{action (mut name)}}
+ target = rawAction;
+ action = rawAction[INVOKE];
+ } else {
+ // on-change={{action setName}}
+ // element-space actions look to "controller" then target. Here we only
+ // look to "target".
+ target = _emberMetalStreamsUtils.read(scope.getSelf());
+ action = _emberMetalStreamsUtils.read(rawAction);
+ var actionType = typeof action;
- EmComputed.sum = _emberRuntimeComputedReduce_computed_macros.sum;
- EmComputed.min = _emberRuntimeComputedReduce_computed_macros.min;
- EmComputed.max = _emberRuntimeComputedReduce_computed_macros.max;
- EmComputed.map = _emberRuntimeComputedReduce_computed_macros.map;
- EmComputed.sort = _emberRuntimeComputedReduce_computed_macros.sort;
- EmComputed.setDiff = _emberRuntimeComputedReduce_computed_macros.setDiff;
- EmComputed.mapBy = _emberRuntimeComputedReduce_computed_macros.mapBy;
- EmComputed.filter = _emberRuntimeComputedReduce_computed_macros.filter;
- EmComputed.filterBy = _emberRuntimeComputedReduce_computed_macros.filterBy;
- EmComputed.uniq = _emberRuntimeComputedReduce_computed_macros.uniq;
- EmComputed.union = _emberRuntimeComputedReduce_computed_macros.union;
- EmComputed.intersect = _emberRuntimeComputedReduce_computed_macros.intersect;
+ if (actionType === 'string') {
+ var actionName = action;
+ action = null;
+ // on-change={{action 'setName'}}
+ if (hash.target) {
+ // on-change={{action 'setName' target=alternativeComponent}}
+ target = _emberMetalStreamsUtils.read(hash.target);
+ }
+ if (target.actions) {
+ action = target.actions[actionName];
+ }
- _emberMetal.default.String = _emberRuntimeSystemString.default;
- _emberMetal.default.Object = _emberRuntimeSystemObject.default;
- _emberMetal.default.Container = _emberRuntimeSystemContainer.Container;
- _emberMetal.default.Registry = _emberRuntimeSystemContainer.Registry;
- _emberMetal.default.Namespace = _emberRuntimeSystemNamespace.default;
- _emberMetal.default.Enumerable = _emberRuntimeMixinsEnumerable.default;
- _emberMetal.default.ArrayProxy = _emberRuntimeSystemArray_proxy.default;
- _emberMetal.default.ObjectProxy = _emberRuntimeSystemObject_proxy.default;
- _emberMetal.default.ActionHandler = _emberRuntimeMixinsAction_handler.default;
- _emberMetal.default.CoreObject = _emberRuntimeSystemCore_object.default;
- _emberMetal.default.NativeArray = _emberRuntimeSystemNative_array.default;
- // ES6TODO: Currently we must rely on the global from ember-metal/core to avoid circular deps
- // Ember.A = A;
- _emberMetal.default.onLoad = _emberRuntimeSystemLazy_load.onLoad;
- _emberMetal.default.runLoadHooks = _emberRuntimeSystemLazy_load.runLoadHooks;
+ if (!action) {
+ throw new _emberMetalError.default('An action named \'' + actionName + '\' was not found in ' + target + '.');
+ }
+ } else if (actionType !== 'function') {
+ throw new _emberMetalError.default('An action could not be made for `' + rawAction.label + '` in ' + target + '. Please confirm that you are using either a quoted action name (i.e. `(action \'' + rawAction.label + '\')`) or a function available in ' + target + '.');
+ }
+ }
- _emberMetal.default.Controller = _emberRuntimeControllersController.default;
- _emberMetal.default.ControllerMixin = _emberRuntimeMixinsController.default;
+ if (hash.value) {
+ // <button on-keypress={{action (mut name) value="which"}}
+ // on-keypress is not even an Ember feature yet
+ valuePath = _emberMetalStreamsUtils.read(hash.value);
+ }
- _emberMetal.default.Service = _emberRuntimeSystemService.default;
+ return createClosureAction(target, action, valuePath, actionArguments);
+ }, function () {
+ return _emberHtmlbarsHooksSubexpr.labelForSubexpr(params, hash, 'action');
+ });
- _emberMetal.default._ProxyMixin = _emberRuntimeMixinsProxy.default;
+ params.forEach(s.addDependency, s);
+ Object.keys(hash).forEach(function (item) {
+ return s.addDependency(item);
+ });
- _emberMetal.default.RSVP = _emberRuntimeExtRsvp.default;
- // END EXPORTS
+ return s;
+ }
- exports.default = _emberMetal.default;
+ function createClosureAction(target, action, valuePath, actionArguments) {
+ var closureAction;
+
+ if (actionArguments.length > 0) {
+ closureAction = function () {
+ var args = actionArguments;
+ if (arguments.length > 0) {
+ var passedArguments = Array.prototype.slice.apply(arguments);
+ args = actionArguments.concat(passedArguments);
+ }
+ if (valuePath && args.length > 0) {
+ args[0] = _emberMetalProperty_get.get(args[0], valuePath);
+ }
+ return action.apply(target, args);
+ };
+ } else {
+ closureAction = function () {
+ var args = arguments;
+ if (valuePath && args.length > 0) {
+ args = Array.prototype.slice.apply(args);
+ args[0] = _emberMetalProperty_get.get(args[0], valuePath);
+ }
+ return action.apply(target, args);
+ };
+ }
+
+ closureAction[ACTION] = true;
+
+ return closureAction;
+ }
});
-// just for side effect of extending Ember.RSVP
-// just for side effect of extending String.prototype
-// just for side effect of extending Function.prototype
+enifed('ember-routing-htmlbars/keywords/element-action', ['exports', 'ember-metal/debug', 'ember-metal/utils', 'ember-metal/run_loop', 'ember-views/streams/utils', 'ember-views/system/utils', 'ember-views/system/action_manager'], function (exports, _emberMetalDebug, _emberMetalUtils, _emberMetalRun_loop, _emberViewsStreamsUtils, _emberViewsSystemUtils, _emberViewsSystemAction_manager) {
+ 'use strict';
+
+ exports.default = {
+ setupState: function (state, env, scope, params, hash) {
+ var getStream = env.hooks.get;
+ var read = env.hooks.getValue;
+
+ var actionName = read(params[0]);
+
+ var actionArgs = [];
+ for (var i = 1, l = params.length; i < l; i++) {
+ actionArgs.push(_emberViewsStreamsUtils.readUnwrappedModel(params[i]));
+ }
+
+ var target;
+ if (hash.target) {
+ if (typeof hash.target === 'string') {
+ target = read(getStream(env, scope, hash.target));
+ } else {
+ target = read(hash.target);
+ }
+ } else {
+ target = read(scope.getLocal('controller')) || read(scope.getSelf());
+ }
+
+ return { actionName: actionName, actionArgs: actionArgs, target: target };
+ },
+
+ isStable: function (state, env, scope, params, hash) {
+ return true;
+ },
+
+ render: function (node, env, scope, params, hash, template, inverse, visitor) {
+ var actionId = env.dom.getAttribute(node.element, 'data-ember-action') || _emberMetalUtils.uuid();
+
+ ActionHelper.registerAction({
+ actionId: actionId,
+ node: node,
+ eventName: hash.on || 'click',
+ bubbles: hash.bubbles,
+ preventDefault: hash.preventDefault,
+ withKeyCode: hash.withKeyCode,
+ allowedKeys: hash.allowedKeys
+ });
+
+ node.cleanup = function () {
+ ActionHelper.unregisterAction(actionId);
+ };
+
+ env.dom.setAttribute(node.element, 'data-ember-action', actionId);
+ }
+ };
+ var ActionHelper = {};
+
+ exports.ActionHelper = ActionHelper;
+ // registeredActions is re-exported for compatibility with older plugins
+ // that were using this undocumented API.
+ ActionHelper.registeredActions = _emberViewsSystemAction_manager.default.registeredActions;
+
+ ActionHelper.registerAction = function (_ref) {
+ var actionId = _ref.actionId;
+ var node = _ref.node;
+ var eventName = _ref.eventName;
+ var preventDefault = _ref.preventDefault;
+ var bubbles = _ref.bubbles;
+ var allowedKeys = _ref.allowedKeys;
+
+ var actions = _emberViewsSystemAction_manager.default.registeredActions[actionId];
+
+ if (!actions) {
+ actions = _emberViewsSystemAction_manager.default.registeredActions[actionId] = [];
+ }
+
+ actions.push({
+ eventName: eventName,
+ handler: function (event) {
+ if (!isAllowedEvent(event, allowedKeys)) {
+ return true;
+ }
+
+ if (preventDefault !== false) {
+ event.preventDefault();
+ }
+
+ if (bubbles === false) {
+ event.stopPropagation();
+ }
+
+ var _node$getState = node.getState();
+
+ var target = _node$getState.target;
+ var actionName = _node$getState.actionName;
+ var actionArgs = _node$getState.actionArgs;
+
+ _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 {
+
+ target[actionName].apply(target, actionArgs);
+ }
+ });
+ }
+ });
+
+ return actionId;
+ };
+
+ ActionHelper.unregisterAction = function (actionId) {
+ delete _emberViewsSystemAction_manager.default.registeredActions[actionId];
+ };
+
+ var MODIFIERS = ['alt', 'shift', 'meta', 'ctrl'];
+ var POINTER_EVENT_TYPE_REGEX = /^click|mouse|touch/;
+
+ function isAllowedEvent(event, allowedKeys) {
+ if (typeof allowedKeys === 'undefined') {
+ if (POINTER_EVENT_TYPE_REGEX.test(event.type)) {
+ return _emberViewsSystemUtils.isSimpleClick(event);
+ } else {
+ allowedKeys = '';
+ }
+ }
+
+ if (allowedKeys.indexOf('any') >= 0) {
+ return true;
+ }
+
+ for (var i = 0, l = MODIFIERS.length; i < l; i++) {
+ if (event[MODIFIERS[i] + 'Key'] && allowedKeys.indexOf(MODIFIERS[i]) === -1) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+});
+enifed('ember-routing-htmlbars/keywords/render', ['exports', 'ember-metal/debug', '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, _emberMetalDebug, _emberMetalProperty_get, _emberMetalEmpty_object, _emberMetalError, _emberMetalStreamsUtils, _emberRuntimeSystemString, _emberRoutingSystemGenerate_controller, _emberHtmlbarsNodeManagersViewNodeManager) {
+ /**
+ @module ember
+ @submodule ember-templates
+ */
+
+ '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);
+ }
+ },
+
+ setupState: function (prevState, env, scope, params, hash) {
+ var name = params[0];
+
+ return {
+ parentView: env.view,
+ manager: prevState.manager,
+ controller: prevState.controller,
+ childOutletState: childOutletState(name, env)
+ };
+ },
+
+ childEnv: function (state, env) {
+ return env.childWithOutletState(state.childOutletState);
+ },
+
+ isStable: function (lastState, nextState) {
+ return isStable(lastState.childOutletState, nextState.childOutletState);
+ },
+
+ isEmpty: function (state) {
+ return false;
+ },
+
+ render: function (node, env, scope, params, hash, template, inverse, visitor) {
+ var state = node.getState();
+ var name = params[0];
+ var context = params[1];
+
+ var container = env.container;
+
+ // The render keyword presumes it can work without a router. This is really
+ // only to satisfy the test:
+ //
+ // {{view}} should not override class bindings defined on a child view"
+ //
+ var router = container.lookup('router:main');
+
+ if (params.length === 1) {} else if (params.length !== 2) {
+ throw new _emberMetalError.default('You must pass a templateName to render');
+ }
+
+ var templateName = 'template:' + name;
+
+ var view = container.lookup('view:' + name);
+ if (!view) {
+ view = container.lookup('view:default');
+ }
+ var viewHasTemplateSpecified = view && !!_emberMetalProperty_get.get(view, 'template');
+ if (!template && !viewHasTemplateSpecified) {
+ template = container.lookup(templateName);
+ }
+
+ if (view) {
+ view.ownerView = env.view.ownerView;
+ }
+
+ // provide controller override
+ var controllerName;
+ var controllerFullName;
+
+ if (hash.controller) {
+ controllerName = hash.controller;
+ controllerFullName = 'controller:' + controllerName;
+ delete hash.controller;
+ } else {
+ controllerName = name;
+ controllerFullName = 'controller:' + controllerName;
+ }
+
+ var parentController = _emberMetalStreamsUtils.read(scope.getLocal('controller'));
+ var controller;
+
+ // choose name
+ if (params.length > 1) {
+ var factory = container.lookupFactory(controllerFullName) || _emberRoutingSystemGenerate_controller.generateControllerFactory(container, controllerName);
+
+ controller = factory.create({
+ model: _emberMetalStreamsUtils.read(context),
+ parentController: parentController,
+ target: parentController
+ });
+
+ node.addDestruction(controller);
+ } else {
+ controller = container.lookup(controllerFullName) || _emberRoutingSystemGenerate_controller.default(container, controllerName);
+
+ controller.setProperties({
+ target: parentController,
+ parentController: parentController
+ });
+ }
+
+ if (view) {
+ view.set('controller', controller);
+ }
+ state.controller = controller;
+
+ hash.viewName = _emberRuntimeSystemString.camelize(name);
+
+ if (template && template.raw) {
+ template = template.raw;
+ }
+
+ var options = {
+ layout: null,
+ self: controller
+ };
+
+ if (view) {
+ options.component = view;
+ }
+
+ var nodeManager = _emberHtmlbarsNodeManagersViewNodeManager.default.create(node, env, hash, options, state.parentView, null, null, template);
+ state.manager = nodeManager;
+
+ if (router && params.length === 1) {
+ router._connectActiveComponentNode(name, nodeManager);
+ }
+
+ nodeManager.render(env, hash, visitor);
+ },
+
+ rerender: function (node, env, scope, params, hash, template, inverse, visitor) {
+ var model = _emberMetalStreamsUtils.read(params[1]);
+ node.getState().controller.set('model', model);
+ }
+ };
+
+ function childOutletState(name, env) {
+ var topLevel = env.view.ownerView;
+ if (!topLevel || !topLevel.outletState) {
+ return;
+ }
+
+ var outletState = topLevel.outletState;
+ if (!outletState.main) {
+ return;
+ }
+
+ var selectedOutletState = outletState.main.outlets['__ember_orphans__'];
+ if (!selectedOutletState) {
+ return;
+ }
+ var matched = selectedOutletState.outlets[name];
+ if (matched) {
+ var childState = new _emberMetalEmpty_object.default();
+ childState[matched.render.outlet] = matched;
+ matched.wasUsed = true;
+ return childState;
+ }
+ }
+
+ function isStable(a, b) {
+ if (!a && !b) {
+ return true;
+ }
+ if (!a || !b) {
+ return false;
+ }
+ for (var outletName in a) {
+ if (!isStableOutlet(a[outletName], b[outletName])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ function isStableOutlet(a, b) {
+ if (!a && !b) {
+ return true;
+ }
+ if (!a || !b) {
+ return false;
+ }
+ a = a.render;
+ b = b.render;
+ for (var key in a) {
+ if (a.hasOwnProperty(key)) {
+ // name is only here for logging & debugging. If two different
+ // names result in otherwise identical states, they're still
+ // identical.
+ if (a[key] !== b[key] && key !== 'name') {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+});
+
+// use the singleton controller
+enifed('ember-routing-htmlbars', ['exports', 'ember-metal/core', 'ember-htmlbars/helpers', 'ember-htmlbars/keywords', 'ember-routing-htmlbars/helpers/query-params', 'ember-routing-htmlbars/keywords/action', 'ember-routing-htmlbars/keywords/element-action', 'ember-routing-htmlbars/keywords/render'], function (exports, _emberMetalCore, _emberHtmlbarsHelpers, _emberHtmlbarsKeywords, _emberRoutingHtmlbarsHelpersQueryParams, _emberRoutingHtmlbarsKeywordsAction, _emberRoutingHtmlbarsKeywordsElementAction, _emberRoutingHtmlbarsKeywordsRender) {
+ /**
+ @module ember
+ @submodule ember-routing-htmlbars
+ */
+
+ 'use strict';
+
+ _emberHtmlbarsHelpers.registerHelper('query-params', _emberRoutingHtmlbarsHelpersQueryParams.queryParamsHelper);
+
+ _emberHtmlbarsKeywords.registerKeyword('action', _emberRoutingHtmlbarsKeywordsAction.default);
+ _emberHtmlbarsKeywords.registerKeyword('@element_action', _emberRoutingHtmlbarsKeywordsElementAction.default);
+ _emberHtmlbarsKeywords.registerKeyword('render', _emberRoutingHtmlbarsKeywordsRender.default);
+
+ exports.default = _emberMetalCore.default;
+});
+enifed('ember-routing-views/components/link-to', ['exports', 'ember-metal/logger', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/computed', 'ember-metal/computed_macros', 'ember-views/system/utils', 'ember-views/components/component', 'ember-runtime/inject', 'ember-runtime/system/service', 'ember-runtime/mixins/controller', 'ember-htmlbars/node-managers/component-node-manager', 'ember-htmlbars/templates/link-to'], function (exports, _emberMetalLogger, _emberMetalDebug, _emberMetalProperty_get, _emberMetalComputed, _emberMetalComputed_macros, _emberViewsSystemUtils, _emberViewsComponentsComponent, _emberRuntimeInject, _emberRuntimeSystemService, _emberRuntimeMixinsController, _emberHtmlbarsNodeManagersComponentNodeManager, _emberHtmlbarsTemplatesLinkTo) {
+ /**
+ @module ember
+ @submodule ember-templates
+ */
+
+ /**
+ The `{{link-to}}` component renders a link to the supplied
+ `routeName` passing an optionally supplied model to the
+ route as its `model` context of the route. The block
+ for `{{link-to}}` becomes the innerHTML of the rendered
+ element:
+
+ ```handlebars
+ {{#link-to 'photoGallery'}}
+ Great Hamster Photos
+ {{/link-to}}
+ ```
+
+ You can also use an inline form of `{{link-to}}` component by
+ passing the link text as the first argument
+ to the component:
+
+ ```handlebars
+ {{link-to 'Great Hamster Photos' 'photoGallery'}}
+ ```
+
+ Both will result in:
+
+ ```html
+ <a href="/hamster-photos">
+ Great Hamster Photos
+ </a>
+ ```
+
+ ### Supplying a tagName
+ By default `{{link-to}}` renders an `<a>` element. This can
+ be overridden for a single use of `{{link-to}}` by supplying
+ a `tagName` option:
+
+ ```handlebars
+ {{#link-to 'photoGallery' tagName="li"}}
+ Great Hamster Photos
+ {{/link-to}}
+ ```
+
+ ```html
+ <li>
+ Great Hamster Photos
+ </li>
+ ```
+
+ To override this option for your entire application, see
+ "Overriding Application-wide Defaults".
+
+ ### Disabling the `link-to` component
+ By default `{{link-to}}` is enabled.
+ any passed value to the `disabled` component property will disable
+ the `link-to` component.
+
+ static use: the `disabled` option:
+
+ ```handlebars
+ {{#link-to 'photoGallery' disabled=true}}
+ Great Hamster Photos
+ {{/link-to}}
+ ```
+
+ dynamic use: the `disabledWhen` option:
+
+ ```handlebars
+ {{#link-to 'photoGallery' disabledWhen=controller.someProperty}}
+ Great Hamster Photos
+ {{/link-to}}
+ ```
+
+ any passed value to `disabled` will disable it except `undefined`.
+ to ensure that only `true` disable the `link-to` component you can
+ override the global behaviour of `Ember.LinkComponent`.
+
+ ```javascript
+ Ember.LinkComponent.reopen({
+ disabled: Ember.computed(function(key, value) {
+ if (value !== undefined) {
+ this.set('_isDisabled', value === true);
+ }
+ return value === true ? get(this, 'disabledClass') : false;
+ })
+ });
+ ```
+
+ see "Overriding Application-wide Defaults" for more.
+
+ ### Handling `href`
+ `{{link-to}}` will use your application's Router to
+ fill the element's `href` property with a url that
+ matches the path to the supplied `routeName` for your
+ router's configured `Location` scheme, which defaults
+ to Ember.HashLocation.
+
+ ### Handling current route
+ `{{link-to}}` will apply a CSS class name of 'active'
+ when the application's current route matches
+ the supplied routeName. For example, if the application's
+ current route is 'photoGallery.recent' the following
+ use of `{{link-to}}`:
+
+ ```handlebars
+ {{#link-to 'photoGallery.recent'}}
+ Great Hamster Photos
+ {{/link-to}}
+ ```
+
+ will result in
+
+ ```html
+ <a href="/hamster-photos/this-week" class="active">
+ Great Hamster Photos
+ </a>
+ ```
+
+ The CSS class name used for active classes can be customized
+ for a single use of `{{link-to}}` by passing an `activeClass`
+ option:
+
+ ```handlebars
+ {{#link-to 'photoGallery.recent' activeClass="current-url"}}
+ Great Hamster Photos
+ {{/link-to}}
+ ```
+
+ ```html
+ <a href="/hamster-photos/this-week" class="current-url">
+ Great Hamster Photos
+ </a>
+ ```
+
+ To override this option for your entire application, see
+ "Overriding Application-wide Defaults".
+
+ ### Keeping a link active for other routes
+
+ If you need a link to be 'active' even when it doesn't match
+ the current route, you can use the the `current-when`
+ argument.
+
+ ```handlebars
+ {{#link-to 'photoGallery' current-when='photos'}}
+ Photo Gallery
+ {{/link-to}}
+ ```
+
+ This may be helpful for keeping links active for:
+
+ * non-nested routes that are logically related
+ * some secondary menu approaches
+ * 'top navigation' with 'sub navigation' scenarios
+
+ A link will be active if `current-when` is `true` or the current
+ route is the route this link would transition to.
+
+ To match multiple routes 'space-separate' the routes:
+
+ ```handlebars
+ {{#link-to 'gallery' current-when='photos drawings paintings'}}
+ Art Gallery
+ {{/link-to}}
+ ```
+
+ ### Supplying a model
+ An optional model argument can be used for routes whose
+ paths contain dynamic segments. This argument will become
+ the model context of the linked route:
+
+ ```javascript
+ App.Router.map(function() {
+ this.route("photoGallery", {path: "hamster-photos/:photo_id"});
+ });
+ ```
+
+ ```handlebars
+ {{#link-to 'photoGallery' aPhoto}}
+ {{aPhoto.title}}
+ {{/link-to}}
+ ```
+
+ ```html
+ <a href="/hamster-photos/42">
+ Tomster
+ </a>
+ ```
+
+ ### Supplying multiple models
+ For deep-linking to route paths that contain multiple
+ dynamic segments, multiple model arguments can be used.
+ As the router transitions through the route path, each
+ supplied model argument will become the context for the
+ route with the dynamic segments:
+
+ ```javascript
+ App.Router.map(function() {
+ this.route("photoGallery", { path: "hamster-photos/:photo_id" }, function() {
+ this.route("comment", {path: "comments/:comment_id"});
+ });
+ });
+ ```
+ This argument will become the model context of the linked route:
+
+ ```handlebars
+ {{#link-to 'photoGallery.comment' aPhoto comment}}
+ {{comment.body}}
+ {{/link-to}}
+ ```
+
+ ```html
+ <a href="/hamster-photos/42/comments/718">
+ A+++ would snuggle again.
+ </a>
+ ```
+
+ ### Supplying an explicit dynamic segment value
+ If you don't have a model object available to pass to `{{link-to}}`,
+ an optional string or integer argument can be passed for routes whose
+ paths contain dynamic segments. This argument will become the value
+ of the dynamic segment:
+
+ ```javascript
+ App.Router.map(function() {
+ this.route("photoGallery", { path: "hamster-photos/:photo_id" });
+ });
+ ```
+
+ ```handlebars
+ {{#link-to 'photoGallery' aPhotoId}}
+ {{aPhoto.title}}
+ {{/link-to}}
+ ```
+
+ ```html
+ <a href="/hamster-photos/42">
+ Tomster
+ </a>
+ ```
+
+ When transitioning into the linked route, the `model` hook will
+ be triggered with parameters including this passed identifier.
+
+ ### Allowing Default Action
+
+ By default the `{{link-to}}` component prevents the default browser action
+ by calling `preventDefault()` as this sort of action bubbling is normally
+ handled internally and we do not want to take the browser to a new URL (for
+ example).
+
+ If you need to override this behavior specify `preventDefault=false` in
+ your template:
+
+ ```handlebars
+ {{#link-to 'photoGallery' aPhotoId preventDefault=false}}
+ {{aPhotoId.title}}
+ {{/link-to}}
+ ```
+
+ ### Overriding attributes
+ You can override any given property of the `Ember.LinkComponent`
+ that is generated by the `{{link-to}}` component by passing
+ key/value pairs, like so:
+
+ ```handlebars
+ {{#link-to aPhoto tagName='li' title='Following this link will change your life' classNames='pic sweet'}}
+ Uh-mazing!
+ {{/link-to}}
+ ```
+
+ See [Ember.LinkComponent](/api/classes/Ember.LinkComponent.html) for a
+ complete list of overrideable properties. Be sure to also
+ check out inherited properties of `LinkComponent`.
+
+ ### Overriding Application-wide Defaults
+ ``{{link-to}}`` creates an instance of `Ember.LinkComponent`
+ for rendering. To override options for your entire
+ application, reopen `Ember.LinkComponent` and supply the
+ desired values:
+
+ ``` javascript
+ Ember.LinkComponent.reopen({
+ activeClass: "is-active",
+ tagName: 'li'
+ })
+ ```
+
+ It is also possible to override the default event in
+ this manner:
+
+ ``` javascript
+ Ember.LinkComponent.reopen({
+ eventName: 'customEventName'
+ });
+ ```
+
+ @method link-to
+ @for Ember.Templates.helpers
+ @param {String} routeName
+ @param {Object} [context]*
+ @param [options] {Object} Handlebars key/value pairs of options, you can override any property of Ember.LinkComponent
+ @return {String} HTML string
+ @see {Ember.LinkComponent}
+ @public
+ */
+
+ /**
+ @module ember
+ @submodule ember-routing-views
+ */
+
+ 'use strict';
+
+ _emberHtmlbarsTemplatesLinkTo.default.meta.revision = 'Ember@2.2.0-beta.1';
+
+ /**
+ `Ember.LinkComponent` renders an element whose `click` event triggers a
+ transition of the application's instance of `Ember.Router` to
+ a supplied route by name.
+
+ `Ember.LinkComponent` components are invoked with {{#link-to}}. Properties
+ of this class can be overridden with `reopen` to customize application-wide
+ behavior.
+
+ @class LinkComponent
+ @namespace Ember
+ @extends Ember.Component
+ @see {Ember.Templates.helpers.link-to}
+ @private
+ **/
+ var LinkComponent = _emberViewsComponentsComponent.default.extend({
+ layout: _emberHtmlbarsTemplatesLinkTo.default,
+
+ tagName: 'a',
+
+ /**
+ @deprecated Use current-when instead.
+ @property currentWhen
+ @private
+ */
+ currentWhen: _emberMetalComputed_macros.deprecatingAlias('current-when', { id: 'ember-routing-view.deprecated-current-when', until: '3.0.0' }),
+
+ /**
+ Used to determine when this `LinkComponent` is active.
+ @property currentWhen
+ @public
+ */
+ 'current-when': null,
+
+ /**
+ Sets the `title` attribute of the `LinkComponent`'s HTML element.
+ @property title
+ @default null
+ @public
+ **/
+ title: null,
+
+ /**
+ Sets the `rel` attribute of the `LinkComponent`'s HTML element.
+ @property rel
+ @default null
+ @public
+ **/
+ rel: null,
+
+ /**
+ Sets the `tabindex` attribute of the `LinkComponent`'s HTML element.
+ @property tabindex
+ @default null
+ @public
+ **/
+ tabindex: null,
+
+ /**
+ Sets the `target` attribute of the `LinkComponent`'s HTML element.
+ @since 1.8.0
+ @property target
+ @default null
+ @public
+ **/
+ target: null,
+
+ /**
+ The CSS class to apply to `LinkComponent`'s element when its `active`
+ property is `true`.
+ @property activeClass
+ @type String
+ @default active
+ @private
+ **/
+ activeClass: 'active',
+
+ /**
+ The CSS class to apply to `LinkComponent`'s element when its `loading`
+ property is `true`.
+ @property loadingClass
+ @type String
+ @default loading
+ @private
+ **/
+ loadingClass: 'loading',
+
+ /**
+ The CSS class to apply to a `LinkComponent`'s element when its `disabled`
+ property is `true`.
+ @property disabledClass
+ @type String
+ @default disabled
+ @private
+ **/
+ disabledClass: 'disabled',
+ _isDisabled: false,
+
+ /**
+ Determines whether the `LinkComponent` will trigger routing via
+ the `replaceWith` routing strategy.
+ @property replace
+ @type Boolean
+ @default false
+ @public
+ **/
+ replace: false,
+
+ /**
+ By default the `{{link-to}}` component will bind to the `href` and
+ `title` attributes. It's discouraged that you override these defaults,
+ however you can push onto the array if needed.
+ @property attributeBindings
+ @type Array | String
+ @default ['title', 'rel', 'tabindex', 'target']
+ @public
+ */
+ attributeBindings: ['href', 'title', 'rel', 'tabindex', 'target'],
+
+ /**
+ By default the `{{link-to}}` component will bind to the `active`, `loading`,
+ and `disabled` classes. It is discouraged to override these directly.
+ @property classNameBindings
+ @type Array
+ @default ['active', 'loading', 'disabled']
+ @public
+ */
+ classNameBindings: ['active', 'loading', 'disabled', 'transitioningIn', 'transitioningOut'],
+
+ /**
+ By default the `{{link-to}}` component responds to the `click` event. You
+ can override this globally by setting this property to your custom
+ event name.
+ This is particularly useful on mobile when one wants to avoid the 300ms
+ click delay using some sort of custom `tap` event.
+ @property eventName
+ @type String
+ @default click
+ @private
+ */
+ eventName: 'click',
+
+ // this is doc'ed here so it shows up in the events
+ // section of the API documentation, which is where
+ // people will likely go looking for it.
+ /**
+ Triggers the `LinkComponent`'s routing behavior. If
+ `eventName` is changed to a value other than `click`
+ the routing behavior will trigger on that custom event
+ instead.
+ @event click
+ @private
+ */
+
+ /**
+ An overridable method called when `LinkComponent` objects are instantiated.
+ Example:
+ ```javascript
+ App.MyLinkComponent = Ember.LinkComponent.extend({
+ init: function() {
+ this._super.apply(this, arguments);
+ Ember.Logger.log('Event is ' + this.get('eventName'));
+ }
+ });
+ ```
+ NOTE: If you do override `init` for a framework class like `Ember.View`,
+ be sure to call `this._super.apply(this, arguments)` in your
+ `init` declaration! If you don't, Ember may not have an opportunity to
+ do important setup work, and you'll see strange behavior in your
+ application.
+ @method init
+ @private
+ */
+ init: function () {
+ this._super.apply(this, arguments);
+
+ // Map desired event name to invoke function
+ var eventName = _emberMetalProperty_get.get(this, 'eventName');
+ this.on(eventName, this, this._invoke);
+ },
+
+ _routing: _emberRuntimeInject.default.service('-routing'),
+
+ /**
+ Accessed as a classname binding to apply the `LinkComponent`'s `disabledClass`
+ CSS `class` to the element when the link is disabled.
+ When `true` interactions with the element will not trigger route changes.
+ @property disabled
+ @private
+ */
+ disabled: _emberMetalComputed.computed({
+ get: function (key, value) {
+ return false;
+ },
+ set: function (key, value) {
+ if (value !== undefined) {
+ this.set('_isDisabled', value);
+ }
+
+ return value ? _emberMetalProperty_get.get(this, 'disabledClass') : false;
+ }
+ }),
+
+ _computeActive: function (routerState) {
+ if (_emberMetalProperty_get.get(this, 'loading')) {
+ return false;
+ }
+
+ var routing = _emberMetalProperty_get.get(this, '_routing');
+ var models = _emberMetalProperty_get.get(this, 'models');
+ var resolvedQueryParams = _emberMetalProperty_get.get(this, 'resolvedQueryParams');
+
+ var currentWhen = _emberMetalProperty_get.get(this, 'current-when');
+ var isCurrentWhenSpecified = !!currentWhen;
+ currentWhen = currentWhen || _emberMetalProperty_get.get(this, 'qualifiedRouteName');
+ currentWhen = currentWhen.split(' ');
+
+ for (var i = 0, len = currentWhen.length; i < len; i++) {
+ if (routing.isActiveForRoute(models, resolvedQueryParams, currentWhen[i], routerState, isCurrentWhenSpecified)) {
+ return _emberMetalProperty_get.get(this, 'activeClass');
+ }
+ }
+
+ return false;
+ },
+
+ /**
+ Accessed as a classname binding to apply the `LinkComponent`'s `activeClass`
+ CSS `class` to the element when the link is active.
+ A `LinkComponent` is considered active when its `currentWhen` property is `true`
+ or the application's current route is the route the `LinkComponent` would trigger
+ transitions into.
+ The `currentWhen` property can match against multiple routes by separating
+ route names using the ` ` (space) character.
+ @property active
+ @private
+ */
+ active: _emberMetalComputed.computed('attrs.params', '_routing.currentState', function computeLinkToComponentActive() {
+ var currentState = _emberMetalProperty_get.get(this, '_routing.currentState');
+ if (!currentState) {
+ return false;
+ }
+
+ return this._computeActive(currentState);
+ }),
+
+ willBeActive: _emberMetalComputed.computed('_routing.targetState', function computeLinkToComponentWillBeActive() {
+ var routing = _emberMetalProperty_get.get(this, '_routing');
+ var targetState = _emberMetalProperty_get.get(routing, 'targetState');
+ if (_emberMetalProperty_get.get(routing, 'currentState') === targetState) {
+ return;
+ }
+
+ return !!this._computeActive(targetState);
+ }),
+
+ transitioningIn: _emberMetalComputed.computed('active', 'willBeActive', function computeLinkToComponentTransitioningIn() {
+ var willBeActive = _emberMetalProperty_get.get(this, 'willBeActive');
+ if (typeof willBeActive === 'undefined') {
+ return false;
+ }
+
+ return !_emberMetalProperty_get.get(this, 'active') && willBeActive && 'ember-transitioning-in';
+ }),
+
+ transitioningOut: _emberMetalComputed.computed('active', 'willBeActive', function computeLinkToComponentTransitioningOut() {
+ var willBeActive = _emberMetalProperty_get.get(this, 'willBeActive');
+ if (typeof willBeActive === 'undefined') {
+ return false;
+ }
+
+ return _emberMetalProperty_get.get(this, 'active') && !willBeActive && 'ember-transitioning-out';
+ }),
+
+ /**
+ Event handler that invokes the link, activating the associated route.
+ @private
+ @method _invoke
+ @param {Event} event
+ @private
+ */
+ _invoke: function (event) {
+ if (!_emberViewsSystemUtils.isSimpleClick(event)) {
+ return true;
+ }
+
+ if (this.attrs.preventDefault !== false) {
+ var targetAttribute = this.attrs.target;
+ if (!targetAttribute || targetAttribute === '_self') {
+ event.preventDefault();
+ }
+ }
+
+ if (this.attrs.bubbles === false) {
+ event.stopPropagation();
+ }
+
+ if (_emberMetalProperty_get.get(this, '_isDisabled')) {
+ return false;
+ }
+
+ if (_emberMetalProperty_get.get(this, 'loading')) {
+ _emberMetalLogger.default.warn('This link-to is in an inactive loading state because at least one of its parameters presently has a null/undefined value, or the provided route name is invalid.');
+ return false;
+ }
+
+ var targetAttribute2 = this.attrs.target;
+ if (targetAttribute2 && targetAttribute2 !== '_self') {
+ return false;
+ }
+
+ var routing = _emberMetalProperty_get.get(this, '_routing');
+ var qualifiedRouteName = _emberMetalProperty_get.get(this, 'qualifiedRouteName');
+ var models = _emberMetalProperty_get.get(this, 'models');
+ var queryParamValues = _emberMetalProperty_get.get(this, 'queryParams.values');
+ var shouldReplace = _emberMetalProperty_get.get(this, 'attrs.replace');
+
+ routing.transitionTo(qualifiedRouteName, models, queryParamValues, shouldReplace);
+ },
+
+ queryParams: null,
+
+ qualifiedRouteName: _emberMetalComputed.computed('targetRouteName', '_routing.currentState', function computeLinkToComponentQualifiedRouteName() {
+ var params = this.attrs.params.slice();
+ var lastParam = params[params.length - 1];
+ if (lastParam && lastParam.isQueryParams) {
+ params.pop();
+ }
+ var onlyQueryParamsSupplied = this[_emberHtmlbarsNodeManagersComponentNodeManager.HAS_BLOCK] ? params.length === 0 : params.length === 1;
+ if (onlyQueryParamsSupplied) {
+ return _emberMetalProperty_get.get(this, '_routing.currentRouteName');
+ }
+ return _emberMetalProperty_get.get(this, 'targetRouteName');
+ }),
+
+ resolvedQueryParams: _emberMetalComputed.computed('queryParams', function computeLinkToComponentResolvedQueryParams() {
+ var resolvedQueryParams = {};
+ var queryParams = _emberMetalProperty_get.get(this, 'queryParams');
+
+ if (!queryParams) {
+ return resolvedQueryParams;
+ }
+
+ var values = queryParams.values;
+ for (var key in values) {
+ if (!values.hasOwnProperty(key)) {
+ continue;
+ }
+ resolvedQueryParams[key] = values[key];
+ }
+
+ return resolvedQueryParams;
+ }),
+
+ /**
+ Sets the element's `href` attribute to the url for
+ the `LinkComponent`'s targeted route.
+ If the `LinkComponent`'s `tagName` is changed to a value other
+ than `a`, this property will be ignored.
+ @property href
+ @private
+ */
+ href: _emberMetalComputed.computed('models', 'qualifiedRouteName', function computeLinkToComponentHref() {
+ if (_emberMetalProperty_get.get(this, 'tagName') !== 'a') {
+ return;
+ }
+
+ var qualifiedRouteName = _emberMetalProperty_get.get(this, 'qualifiedRouteName');
+ var models = _emberMetalProperty_get.get(this, 'models');
+
+ if (_emberMetalProperty_get.get(this, 'loading')) {
+ return _emberMetalProperty_get.get(this, 'loadingHref');
+ }
+
+ var routing = _emberMetalProperty_get.get(this, '_routing');
+ var queryParams = _emberMetalProperty_get.get(this, 'queryParams.values');
+ return routing.generateURL(qualifiedRouteName, models, queryParams);
+ }),
+
+ loading: _emberMetalComputed.computed('_modelsAreLoaded', 'qualifiedRouteName', function computeLinkToComponentLoading() {
+ var qualifiedRouteName = _emberMetalProperty_get.get(this, 'qualifiedRouteName');
+ var modelsAreLoaded = _emberMetalProperty_get.get(this, '_modelsAreLoaded');
+
+ if (!modelsAreLoaded || qualifiedRouteName == null) {
+ return _emberMetalProperty_get.get(this, 'loadingClass');
+ }
+ }),
+
+ _modelsAreLoaded: _emberMetalComputed.computed('models', function computeLinkToComponentModelsAreLoaded() {
+ var models = _emberMetalProperty_get.get(this, 'models');
+ for (var i = 0, l = models.length; i < l; i++) {
+ if (models[i] == null) {
+ return false;
+ }
+ }
+
+ return true;
+ }),
+
+ /**
+ The default href value to use while a link-to is loading.
+ Only applies when tagName is 'a'
+ @property loadingHref
+ @type String
+ @default #
+ @private
+ */
+ loadingHref: '#',
+
+ willRender: function () {
+ var queryParams = undefined;
+
+ var attrs = this.attrs;
+
+ // Do not mutate params in place
+ var params = attrs.params.slice();
+
+ if (attrs.disabledWhen) {
+ this.set('disabled', attrs.disabledWhen);
+ }
+
+ // Process the positional arguments, in order.
+ // 1. Inline link title comes first, if present.
+ if (!this[_emberHtmlbarsNodeManagersComponentNodeManager.HAS_BLOCK]) {
+ this.set('linkTitle', params.shift());
+ }
+
+ // 2. `targetRouteName` is now always at index 0.
+ this.set('targetRouteName', params[0]);
+
+ // 3. The last argument (if still remaining) is the `queryParams` object.
+ var lastParam = params[params.length - 1];
+
+ if (lastParam && lastParam.isQueryParams) {
+ queryParams = params.pop();
+ } else {
+ queryParams = {};
+ }
+ this.set('queryParams', queryParams);
+
+ // 4. Any remaining indices (excepting `targetRouteName` at 0) are `models`.
+ var models = [];
+
+ for (var i = 1; i < params.length; i++) {
+ var value = params[i];
+
+ while (_emberRuntimeMixinsController.default.detect(value)) {
+ value = value.get('model');
+ }
+
+ models.push(value);
+ }
+
+ this.set('models', models);
+ }
+ });
+
+ LinkComponent.toString = function () {
+ return 'LinkComponent';
+ };
+
+ LinkComponent.reopenClass({
+ positionalParams: 'params'
+ });
+
+ exports.default = LinkComponent;
+});
+// 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.2.0-beta.1';
+
+ var CoreOutletView = _emberViewsViewsView.default.extend({
+ defaultTemplate: _emberHtmlbarsTemplatesTopLevelView.default,
+
+ init: function () {
+ this._super();
+ this._outlets = [];
+ },
+
+ setOutletState: function (state) {
+ this.outletState = { main: state };
+
+ if (this.env) {
+ this.env.outletState = this.outletState;
+ }
+
+ if (this.lastResult) {
+ this.dirtyOutlets();
+ this._outlets = [];
+
+ this.scheduleRevalidate(null, null);
+ }
+ },
+
+ dirtyOutlets: function () {
+ // Dirty any render nodes that correspond to outlets
+ for (var i = 0; i < this._outlets.length; i++) {
+ this._outlets[i].isDirty = true;
+ }
+ }
+ });
+
+ exports.CoreOutletView = CoreOutletView;
+ var OutletView = CoreOutletView.extend({ tagName: '' });
+ exports.OutletView = OutletView;
+});
+enifed('ember-routing-views', ['exports', 'ember-metal/core', 'ember-routing-views/components/link-to', 'ember-routing-views/views/outlet'], function (exports, _emberMetalCore, _emberRoutingViewsComponentsLinkTo, _emberRoutingViewsViewsOutlet) {
+ /**
+ @module ember
+ @submodule ember-routing-views
+ */
+
+ 'use strict';
+
+ _emberMetalCore.default.LinkComponent = _emberRoutingViewsComponentsLinkTo.default;
+ _emberMetalCore.default.OutletView = _emberRoutingViewsViewsOutlet.OutletView;
+
+ exports.default = _emberMetalCore.default;
+});
+enifed('ember-routing', ['exports', 'ember-metal/core', 'ember-routing/ext/run_loop', 'ember-routing/ext/controller', 'ember-routing/location/api', 'ember-routing/location/none_location', 'ember-routing/location/hash_location', 'ember-routing/location/history_location', 'ember-routing/location/auto_location', 'ember-routing/system/generate_controller', 'ember-routing/system/controller_for', 'ember-routing/system/dsl', 'ember-routing/system/router', 'ember-routing/system/route'], function (exports, _emberMetalCore, _emberRoutingExtRun_loop, _emberRoutingExtController, _emberRoutingLocationApi, _emberRoutingLocationNone_location, _emberRoutingLocationHash_location, _emberRoutingLocationHistory_location, _emberRoutingLocationAuto_location, _emberRoutingSystemGenerate_controller, _emberRoutingSystemController_for, _emberRoutingSystemDsl, _emberRoutingSystemRouter, _emberRoutingSystemRoute) {
+ /**
+ @module ember
+ @submodule ember-routing
+ */
+
+ 'use strict';
+
+ _emberMetalCore.default.Location = _emberRoutingLocationApi.default;
+ _emberMetalCore.default.AutoLocation = _emberRoutingLocationAuto_location.default;
+ _emberMetalCore.default.HashLocation = _emberRoutingLocationHash_location.default;
+ _emberMetalCore.default.HistoryLocation = _emberRoutingLocationHistory_location.default;
+ _emberMetalCore.default.NoneLocation = _emberRoutingLocationNone_location.default;
+
+ _emberMetalCore.default.controllerFor = _emberRoutingSystemController_for.default;
+ _emberMetalCore.default.generateControllerFactory = _emberRoutingSystemGenerate_controller.generateControllerFactory;
+ _emberMetalCore.default.generateController = _emberRoutingSystemGenerate_controller.default;
+ _emberMetalCore.default.RouterDSL = _emberRoutingSystemDsl.default;
+ _emberMetalCore.default.Router = _emberRoutingSystemRouter.default;
+ _emberMetalCore.default.Route = _emberRoutingSystemRoute.default;
+
+ exports.default = _emberMetalCore.default;
+});
+
+// ES6TODO: Cleanup modules with side-effects below
enifed('ember-runtime/compare', ['exports', 'ember-runtime/utils', 'ember-runtime/mixins/comparable'], function (exports, _emberRuntimeUtils, _emberRuntimeMixinsComparable) {
'use strict';
exports.default = compare;
@@ -28230,11 +28950,11 @@
default:
return 0;
}
}
});
-enifed('ember-runtime/computed/reduce_computed_macros', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/error', 'ember-metal/computed', 'ember-metal/observer', 'ember-runtime/compare', 'ember-runtime/utils'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalError, _emberMetalComputed, _emberMetalObserver, _emberRuntimeCompare, _emberRuntimeUtils) {
+enifed('ember-runtime/computed/reduce_computed_macros', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/error', 'ember-metal/computed', 'ember-metal/observer', 'ember-runtime/compare', 'ember-runtime/utils', 'ember-runtime/system/native_array'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberMetalError, _emberMetalComputed, _emberMetalObserver, _emberRuntimeCompare, _emberRuntimeUtils, _emberRuntimeSystemNative_array) {
/**
@module ember
@submodule ember-runtime
*/
@@ -28279,24 +28999,24 @@
}
return _emberMetalComputed.computed(dependentKey, function () {
var value = _emberMetalProperty_get.get(this, propertyName);
if (_emberRuntimeUtils.isArray(value)) {
- return _emberMetalCore.default.A(callback.call(this, value));
+ return _emberRuntimeSystemNative_array.A(callback.call(this, value));
} else {
- return _emberMetalCore.default.A();
+ return _emberRuntimeSystemNative_array.A();
}
}).readOnly();
}
function multiArrayMacro(dependentKeys, callback) {
var args = dependentKeys.map(function (key) {
return key + '.[]';
});
args.push(function () {
- return _emberMetalCore.default.A(callback.call(this, dependentKeys));
+ return _emberRuntimeSystemNative_array.A(callback.call(this, dependentKeys));
});
return _emberMetalComputed.computed.apply(this, args).readOnly();
}
@@ -28471,11 +29191,11 @@
@return {Ember.ComputedProperty} an array mapped to the specified key
@public
*/
function mapBy(dependentKey, propertyKey) {
-
+
return map(dependentKey + '.@each.' + propertyKey, function (item) {
return _emberMetalProperty_get.get(item, propertyKey);
});
}
@@ -28604,11 +29324,11 @@
}
return multiArrayMacro(args, function (dependentKeys) {
var _this2 = this;
- var uniq = _emberMetalCore.default.A();
+ var uniq = _emberRuntimeSystemNative_array.A();
dependentKeys.forEach(function (dependentKey) {
var value = _emberMetalProperty_get.get(_this2, dependentKey);
if (_emberRuntimeUtils.isArray(value)) {
value.forEach(function (item) {
@@ -28692,11 +29412,11 @@
}
return true;
});
- return _emberMetalCore.default.A(results);
+ return _emberRuntimeSystemNative_array.A(results);
});
}
/**
A computed property which returns a new array with all the
@@ -28739,14 +29459,14 @@
return _emberMetalComputed.computed(setAProperty + '.[]', setBProperty + '.[]', function () {
var setA = this.get(setAProperty);
var setB = this.get(setBProperty);
if (!_emberRuntimeUtils.isArray(setA)) {
- return _emberMetalCore.default.A();
+ return _emberRuntimeSystemNative_array.A();
}
if (!_emberRuntimeUtils.isArray(setB)) {
- return _emberMetalCore.default.A(setA);
+ return _emberRuntimeSystemNative_array.A(setA);
}
return setA.filter(function (x) {
return setB.indexOf(x) === -1;
});
@@ -28818,11 +29538,11 @@
on the sort property array or callback function
@public
*/
function sort(itemsKey, sortDefinition) {
-
+
if (typeof sortDefinition === 'function') {
return customSort(itemsKey, sortDefinition);
} else {
return propertySort(itemsKey, sortDefinition);
}
@@ -28850,11 +29570,11 @@
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();
+ return _emberRuntimeSystemNative_array.A();
}
// TODO: Ideally we'd only do this if things have changed
if (cp._sortPropObservers) {
cp._sortPropObservers.forEach(function (args) {
@@ -28886,11 +29606,11 @@
var args = [_this5, itemsKey + '.@each.' + prop[0], didChange];
cp._sortPropObservers.push(args);
_emberMetalObserver.addObserver.apply(null, args);
});
- return _emberMetalCore.default.A(items.slice().sort(function (itemA, itemB) {
+ return _emberRuntimeSystemNative_array.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];
@@ -28905,12 +29625,11 @@
});
return cp.property(itemsKey + '.[]', sortPropertiesKey + '.[]').readOnly();
}
});
-// Ember.assert
-enifed('ember-runtime/controllers/controller', ['exports', 'ember-metal/core', 'ember-runtime/system/object', 'ember-runtime/mixins/controller', 'ember-runtime/inject', 'ember-runtime/mixins/action_handler'], function (exports, _emberMetalCore, _emberRuntimeSystemObject, _emberRuntimeMixinsController, _emberRuntimeInject, _emberRuntimeMixinsAction_handler) {
+enifed('ember-runtime/controllers/controller', ['exports', 'ember-metal/debug', 'ember-runtime/system/object', 'ember-runtime/mixins/controller', 'ember-runtime/inject', 'ember-runtime/mixins/action_handler'], function (exports, _emberMetalDebug, _emberRuntimeSystemObject, _emberRuntimeMixinsController, _emberRuntimeInject, _emberRuntimeMixinsAction_handler) {
'use strict';
/**
@module ember
@submodule ember-runtime
@@ -28925,12 +29644,11 @@
*/
var Controller = _emberRuntimeSystemObject.default.extend(_emberRuntimeMixinsController.default);
_emberRuntimeMixinsAction_handler.deprecateUnderscoreActions(Controller);
- function controllerInjectionHelper(factory) {
- }
+ function controllerInjectionHelper(factory) {}
/**
Creates a property that lazily looks up another controller in the container.
Can only be used when defining another controller.
@@ -28963,12 +29681,11 @@
*/
_emberRuntimeInject.createInjectionHelper('controller', controllerInjectionHelper);
exports.default = Controller;
});
-// Ember.assert
-enifed('ember-runtime/copy', ['exports', 'ember-metal/core', 'ember-runtime/system/object', 'ember-runtime/mixins/copyable'], function (exports, _emberMetalCore, _emberRuntimeSystemObject, _emberRuntimeMixinsCopyable) {
+enifed('ember-runtime/copy', ['exports', 'ember-metal/debug', 'ember-runtime/system/object', 'ember-runtime/mixins/copyable'], function (exports, _emberMetalDebug, _emberRuntimeSystemObject, _emberRuntimeMixinsCopyable) {
'use strict';
exports.default = copy;
function _copy(obj, deep, seen, copies) {
@@ -28982,11 +29699,10 @@
// avoid cyclical loops
if (deep && (loc = seen.indexOf(obj)) >= 0) {
return copies[loc];
}
-
// IMPORTANT: this specific test will detect a native array only. Any other
// object will need to implement Copyable.
if (Array.isArray(obj)) {
ret = obj.slice();
@@ -29063,11 +29779,11 @@
});
/**
@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) {
+enifed('ember-runtime/ext/function', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/computed', 'ember-metal/mixin'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalComputed, _emberMetalMixin) {
/**
@module ember
@submodule ember-runtime
*/
@@ -29158,11 +29874,11 @@
args.push(this);
return _emberMetalMixin.observer.apply(this, args);
};
FunctionPrototype._observesImmediately = function () {
-
+
// observes handles property expansion
return this.observes.apply(this, arguments);
};
/**
The `observesImmediately` extension of Javascript's Function prototype is
@@ -29184,11 +29900,11 @@
@method observesImmediately
@for Function
@deprecated
@private
*/
- FunctionPrototype.observesImmediately = _emberMetalCore.default.deprecateFunc('Function#observesImmediately is deprecated. Use Function#observes instead', { id: 'ember-runtime.ext-function', until: '3.0.0' }, FunctionPrototype._observesImmediately);
+ FunctionPrototype.observesImmediately = _emberMetalDebug.deprecateFunc('Function#observesImmediately is deprecated. Use Function#observes instead', { id: 'ember-runtime.ext-function', until: '3.0.0' }, FunctionPrototype._observesImmediately);
/**
The `on` extension of Javascript's Function prototype is available
when `Ember.EXTEND_PROTOTYPES` or `Ember.EXTEND_PROTOTYPES.Function` is
true, which is the default.
@@ -29212,12 +29928,12 @@
return this;
};
}
});
-// Ember.EXTEND_PROTOTYPES, Ember.assert
-enifed('ember-runtime/ext/rsvp', ['exports', 'ember-metal/core', 'ember-metal/logger', 'ember-metal/run_loop', 'rsvp'], function (exports, _emberMetalCore, _emberMetalLogger, _emberMetalRun_loop, _rsvp) {
+// Ember.EXTEND_PROTOTYPES
+enifed('ember-runtime/ext/rsvp', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/logger', 'ember-metal/run_loop', 'rsvp'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalLogger, _emberMetalRun_loop, _rsvp) {
/* globals RSVP:true */
'use strict';
exports.onerrorDefault = onerrorDefault;
@@ -29269,11 +29985,11 @@
} else {
error = reason;
}
if (error && error.name === "UnrecognizedURLError") {
- return;
+ return;
}
if (error && error.name !== 'TransitionAborted') {
if (_emberMetalCore.default.testing) {
// ES6TODO: remove when possible
@@ -29294,11 +30010,11 @@
}
}
}
function after(cb) {
- _emberMetalCore.default.run.schedule(_emberMetalCore.default.run.queues[_emberMetalCore.default.run.queues.length - 1], cb);
+ _emberMetalRun_loop.default.schedule(_emberMetalRun_loop.default.queues[_emberMetalRun_loop.default.queues.length - 1], cb);
}
_rsvp.on('error', onerrorDefault);
_rsvp.configure('after', after);
@@ -29413,12 +30129,12 @@
StringPrototype.capitalize = function () {
return _emberRuntimeSystemString.capitalize(this);
};
}
});
-// Ember.EXTEND_PROTOTYPES, Ember.assert
-enifed('ember-runtime/inject', ['exports', 'ember-metal/core', 'ember-metal/injected_property'], function (exports, _emberMetalCore, _emberMetalInjected_property) {
+// Ember.EXTEND_PROTOTYPES
+enifed('ember-runtime/inject', ['exports', 'ember-metal/debug', 'ember-metal/injected_property'], function (exports, _emberMetalDebug, _emberMetalInjected_property) {
'use strict';
exports.default = inject;
exports.createInjectionHelper = createInjectionHelper;
exports.validatePropertyInjections = validatePropertyInjections;
@@ -29430,12 +30146,11 @@
@namespace Ember
@static
@public
*/
- function inject() {
- }
+ function inject() {}
// Dictionary of injection validations by type, added to by `createInjectionHelper`
var typeValidators = {};
/**
@@ -29493,11 +30208,10 @@
}
return true;
}
});
-// Ember.assert
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
@@ -29531,11 +30245,11 @@
}
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) {
+enifed('ember-runtime/mixins/-proxy', ['exports', 'ember-metal/debug', '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, _emberMetalDebug, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalMeta, _emberMetalObserver, _emberMetalProperty_events, _emberMetalComputed, _emberMetalProperties, _emberMetalMixin) {
/**
@module ember
@submodule ember-runtime
*/
@@ -29572,12 +30286,11 @@
@type Ember.Object
@default null
@private
*/
content: null,
- _contentDidChange: _emberMetalMixin.observer('content', function () {
- }),
+ _contentDidChange: _emberMetalMixin.observer('content', function () {}),
isTruthy: _emberMetalComputed.computed.bool('content'),
_debugContainerKey: null,
@@ -29594,11 +30307,11 @@
},
unknownProperty: function (key) {
var content = _emberMetalProperty_get.get(this, 'content');
if (content) {
- return _emberMetalProperty_get.get(content, key);
+ return _emberMetalProperty_get.get(content, key);
}
},
setUnknownProperty: function (key, value) {
var m = _emberMetalMeta.meta(this);
@@ -29608,22 +30321,22 @@
_emberMetalProperties.defineProperty(this, key, null, value);
return value;
}
var content = _emberMetalProperty_get.get(this, 'content');
-
- return _emberMetalProperty_set.set(content, key, value);
+
+ return _emberMetalProperty_set.set(content, key, value);
}
});
});
-// 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/debug', 'ember-metal/mixin', 'ember-metal/property_get'], function (exports, _emberMetalDebug, _emberMetalMixin, _emberMetalProperty_get) {
/**
@module ember
@submodule ember-runtime
*/
+
'use strict';
exports.deprecateUnderscoreActions = deprecateUnderscoreActions;
/**
@@ -29782,37 +30495,32 @@
}
if (target = _emberMetalProperty_get.get(this, 'target')) {
var _target;
- (_target = target).send.apply(_target, arguments);
+ (_target = target).send.apply(_target, arguments);
}
},
willMergeMixin: function (props) {
-
+
if (props._actions) {
-
+
props.actions = props._actions;
delete props._actions;
}
}
});
exports.default = ActionHandler;
function deprecateUnderscoreActions(factory) {
- function deprecate() {
- }
-
Object.defineProperty(factory.prototype, '_actions', {
configurable: true,
enumerable: false,
- set: function (value) {
- },
+ set: function (value) {},
get: function () {
- deprecate();
return _emberMetalProperty_get.get(this, 'actions');
}
});
}
});
@@ -30424,53 +31132,10 @@
return (_container__ = this.__container__)[name].apply(_container__, arguments);
};
}
});
-enifed('ember-runtime/mixins/controller_content_model_alias_deprecation', ['exports', 'ember-metal/core', 'ember-metal/mixin'], function (exports, _emberMetalCore, _emberMetalMixin) {
- 'use strict';
-
- /*
- The ControllerContentModelAliasDeprecation mixin is used to provide a useful
- deprecation warning when specifying `content` directly on a `Ember.Controller`
- (without also specifying `model`).
-
- Ember versions prior to 1.7 used `model` as an alias of `content`, but due to
- much confusion this alias was reversed (so `content` is now an alias of `model).
-
- This change reduces many caveats with model/content, and also sets a
- simple ground rule: Never set a controllers content, rather always set
- its model and ember will do the right thing.
-
- Used internally by Ember in `Ember.Controller`.
- */
- exports.default = _emberMetalMixin.Mixin.create({
- /**
- @private
- Moves `content` to `model` at extend time if a `model` is not also specified.
- Note that this currently modifies the mixin themselves, which is technically
- dubious but is practically of little consequence. This may change in the
- future.
- @method willMergeMixin
- @since 1.4.0
- */
- willMergeMixin: function (props) {
- // Calling super is only OK here since we KNOW that
- // there is another Mixin loaded first.
- this._super.apply(this, arguments);
-
- var modelSpecified = !!props.model;
-
- if (props.content && !modelSpecified) {
- props.model = props.content;
- delete props['content'];
-
- }
- }
- });
-});
-// Ember.deprecate
enifed('ember-runtime/mixins/controller', ['exports', 'ember-metal/mixin', 'ember-metal/alias', 'ember-runtime/mixins/action_handler', 'ember-runtime/mixins/controller_content_model_alias_deprecation'], function (exports, _emberMetalMixin, _emberMetalAlias, _emberRuntimeMixinsAction_handler, _emberRuntimeMixinsController_content_model_alias_deprecation) {
'use strict';
/**
@class ControllerMixin
@@ -30519,11 +31184,52 @@
*/
content: _emberMetalAlias.default('model')
});
});
-enifed('ember-runtime/mixins/copyable', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/mixin', 'ember-runtime/mixins/freezable', 'ember-metal/error'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalMixin, _emberRuntimeMixinsFreezable, _emberMetalError) {
+enifed('ember-runtime/mixins/controller_content_model_alias_deprecation', ['exports', 'ember-metal/debug', 'ember-metal/mixin'], function (exports, _emberMetalDebug, _emberMetalMixin) {
+ 'use strict';
+
+ /*
+ The ControllerContentModelAliasDeprecation mixin is used to provide a useful
+ deprecation warning when specifying `content` directly on a `Ember.Controller`
+ (without also specifying `model`).
+
+ Ember versions prior to 1.7 used `model` as an alias of `content`, but due to
+ much confusion this alias was reversed (so `content` is now an alias of `model).
+
+ This change reduces many caveats with model/content, and also sets a
+ simple ground rule: Never set a controllers content, rather always set
+ its model and ember will do the right thing.
+
+ Used internally by Ember in `Ember.Controller`.
+ */
+ exports.default = _emberMetalMixin.Mixin.create({
+ /**
+ @private
+ Moves `content` to `model` at extend time if a `model` is not also specified.
+ Note that this currently modifies the mixin themselves, which is technically
+ dubious but is practically of little consequence. This may change in the
+ future.
+ @method willMergeMixin
+ @since 1.4.0
+ */
+ willMergeMixin: function (props) {
+ // Calling super is only OK here since we KNOW that
+ // there is another Mixin loaded first.
+ this._super.apply(this, arguments);
+
+ var modelSpecified = !!props.model;
+
+ if (props.content && !modelSpecified) {
+ props.model = props.content;
+ delete props['content'];
+ }
+ }
+ });
+});
+enifed('ember-runtime/mixins/copyable', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/mixin', 'ember-runtime/mixins/freezable', 'ember-metal/error'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberMetalMixin, _emberRuntimeMixinsFreezable, _emberMetalError) {
/**
@module ember
@submodule ember-runtime
*/
@@ -30569,11 +31275,11 @@
@return {Object} copy of receiver or receiver
@deprecated Use `Object.freeze` instead.
@private
*/
frozenCopy: function () {
- if (_emberRuntimeMixinsFreezable.Freezable && _emberRuntimeMixinsFreezable.Freezable.detect(this)) {
+ if (_emberRuntimeMixinsFreezable.Freezable && _emberRuntimeMixinsFreezable.Freezable.detect(this)) {
return _emberMetalProperty_get.get(this, 'isFrozen') ? this : this.copy().freeze();
} else {
throw new _emberMetalError.default(this + ' does not support freezing');
}
}
@@ -31689,11 +32395,11 @@
has: function (name) {
return _emberMetalEvents.hasListeners(this, name);
}
});
});
-enifed('ember-runtime/mixins/freezable', ['exports', 'ember-metal/core', 'ember-metal/mixin', 'ember-metal/property_get', 'ember-metal/property_set'], function (exports, _emberMetalCore, _emberMetalMixin, _emberMetalProperty_get, _emberMetalProperty_set) {
+enifed('ember-runtime/mixins/freezable', ['exports', 'ember-metal/debug', 'ember-metal/mixin', 'ember-metal/property_get', 'ember-metal/property_set'], function (exports, _emberMetalDebug, _emberMetalMixin, _emberMetalProperty_get, _emberMetalProperty_set) {
/**
@module ember
@submodule ember-runtime
*/
@@ -31758,11 +32464,11 @@
@private
*/
var Freezable = _emberMetalMixin.Mixin.create({
init: function () {
- this._super.apply(this, arguments);
+ this._super.apply(this, arguments);
},
/**
Set to `true` when the object is frozen. Use this property to detect
whether your object is frozen or not.
@@ -32258,15 +32964,16 @@
_emberMetalProperty_events.endPropertyChanges(this);
return this;
}
});
});
-enifed('ember-runtime/mixins/observable', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/get_properties', 'ember-metal/set_properties', 'ember-metal/mixin', 'ember-metal/events', 'ember-metal/property_events', 'ember-metal/observer', 'ember-metal/computed', 'ember-metal/is_none'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalGet_properties, _emberMetalSet_properties, _emberMetalMixin, _emberMetalEvents, _emberMetalProperty_events, _emberMetalObserver, _emberMetalComputed, _emberMetalIs_none) {
+enifed('ember-runtime/mixins/observable', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/get_properties', 'ember-metal/set_properties', 'ember-metal/mixin', 'ember-metal/events', 'ember-metal/property_events', 'ember-metal/observer', 'ember-metal/computed', 'ember-metal/is_none'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalGet_properties, _emberMetalSet_properties, _emberMetalMixin, _emberMetalEvents, _emberMetalProperty_events, _emberMetalObserver, _emberMetalComputed, _emberMetalIs_none) {
/**
@module ember
@submodule ember-runtime
*/
+
'use strict';
/**
## Overview
@@ -32637,11 +33344,12 @@
*/
incrementProperty: function (keyName, increment) {
if (_emberMetalIs_none.default(increment)) {
increment = 1;
}
- return _emberMetalProperty_set.set(this, keyName, (parseFloat(_emberMetalProperty_get.get(this, keyName)) || 0) + increment);
+
+ return _emberMetalProperty_set.set(this, keyName, (parseFloat(_emberMetalProperty_get.get(this, keyName)) || 0) + increment);
},
/**
Set the value of a property to the current value minus some amount.
```javascript
@@ -32656,11 +33364,12 @@
*/
decrementProperty: function (keyName, decrement) {
if (_emberMetalIs_none.default(decrement)) {
decrement = 1;
}
- return _emberMetalProperty_set.set(this, keyName, (_emberMetalProperty_get.get(this, keyName) || 0) - decrement);
+
+ return _emberMetalProperty_set.set(this, keyName, (_emberMetalProperty_get.get(this, keyName) || 0) - decrement);
},
/**
Set the value of a boolean property to the opposite of its
current value.
@@ -32694,11 +33403,10 @@
observersForKey: function (keyName) {
return _emberMetalObserver.observersFor(this, keyName);
}
});
});
-// Ember.assert
enifed('ember-runtime/mixins/promise_proxy', ['exports', 'ember-metal/property_get', 'ember-metal/set_properties', 'ember-metal/computed', 'ember-metal/mixin', 'ember-metal/error'], function (exports, _emberMetalProperty_get, _emberMetalSet_properties, _emberMetalComputed, _emberMetalMixin, _emberMetalError) {
'use strict';
var not = _emberMetalComputed.computed.not;
var or = _emberMetalComputed.computed.or;
@@ -32887,11 +33595,11 @@
var promise = _emberMetalProperty_get.get(this, 'promise');
return promise[name].apply(promise, arguments);
};
}
});
-enifed('ember-runtime/mixins/registry_proxy', ['exports', 'ember-metal/core', 'ember-metal/mixin'], function (exports, _emberMetalCore, _emberMetalMixin) {
+enifed('ember-runtime/mixins/registry_proxy', ['exports', 'ember-metal/debug', 'ember-metal/mixin'], function (exports, _emberMetalDebug, _emberMetalMixin) {
/**
@module ember
@submodule ember-runtime
*/
@@ -33132,20 +33840,20 @@
return fakeRegistry;
}
function buildFakeRegistryFunction(instance, typeForMessage, deprecatedProperty, nonDeprecatedProperty) {
return function () {
-
return instance[nonDeprecatedProperty].apply(instance, arguments);
};
}
});
-enifed('ember-runtime/mixins/target_action_support', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/mixin', 'ember-metal/computed'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalMixin, _emberMetalComputed) {
+enifed('ember-runtime/mixins/target_action_support', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/mixin', 'ember-metal/computed'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalProperty_get, _emberMetalMixin, _emberMetalComputed) {
/**
@module ember
@submodule ember-runtime
*/
+
'use strict';
/**
`Ember.TargetActionSupport` is a mixin that can be included in a class
to add a `triggerAction` method with semantics similar to the Handlebars
@@ -33269,11 +33977,11 @@
var ret;
if (target.send) {
ret = target.send.apply(target, args(actionContext, action));
} else {
- ret = target[action].apply(target, args(actionContext));
+ ret = target[action].apply(target, args(actionContext));
}
if (ret !== false) {
ret = true;
}
@@ -33285,17 +33993,17 @@
}
});
exports.default = TargetActionSupport;
});
-// Ember.lookup, Ember.assert
+// Ember.lookup
enifed('ember-runtime/system/application', ['exports', 'ember-runtime/system/namespace'], function (exports, _emberRuntimeSystemNamespace) {
'use strict';
exports.default = _emberRuntimeSystemNamespace.default.extend();
});
-enifed('ember-runtime/system/array_proxy', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-runtime/utils', 'ember-metal/computed', 'ember-metal/mixin', 'ember-metal/property_events', 'ember-metal/error', 'ember-runtime/system/object', 'ember-runtime/mixins/mutable_array', 'ember-runtime/mixins/enumerable', 'ember-metal/alias'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberRuntimeUtils, _emberMetalComputed, _emberMetalMixin, _emberMetalProperty_events, _emberMetalError, _emberRuntimeSystemObject, _emberRuntimeMixinsMutable_array, _emberRuntimeMixinsEnumerable, _emberMetalAlias) {
+enifed('ember-runtime/system/array_proxy', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-runtime/utils', 'ember-metal/computed', 'ember-metal/mixin', 'ember-metal/property_events', 'ember-metal/error', 'ember-runtime/system/object', 'ember-runtime/mixins/mutable_array', 'ember-runtime/mixins/enumerable', 'ember-metal/alias'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberRuntimeUtils, _emberMetalComputed, _emberMetalMixin, _emberMetalProperty_events, _emberMetalError, _emberRuntimeSystemObject, _emberRuntimeMixinsMutable_array, _emberRuntimeMixinsEnumerable, _emberMetalAlias) {
'use strict';
/**
@module ember
@submodule ember-runtime
@@ -33450,20 +34158,19 @@
*/
_contentDidChange: _emberMetalMixin.observer('content', function () {
var content = _emberMetalProperty_get.get(this, 'content');
this._teardownContent(this._prevContent);
-
this._setupContent();
}),
_setupContent: function () {
var content = _emberMetalProperty_get.get(this, 'content');
this._prevContent = content;
if (content) {
-
+
content.addArrayObserver(this, {
willChange: 'contentArrayWillChange',
didChange: 'contentArrayDidChange'
});
}
@@ -33472,11 +34179,10 @@
_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;
-
this._setupArrangedContent();
this.arrangedContentDidChange(this);
this.arrangedContentArrayDidChange(this, 0, undefined, len);
}),
@@ -33484,11 +34190,11 @@
_setupArrangedContent: function () {
var arrangedContent = _emberMetalProperty_get.get(this, 'arrangedContent');
this._prevArrangedContent = arrangedContent;
if (arrangedContent) {
-
+
arrangedContent.addArrayObserver(this, {
willChange: 'arrangedContentArrayWillChange',
didChange: 'arrangedContentArrayDidChange'
});
}
@@ -33518,11 +34224,12 @@
// No dependencies since Enumerable notifies length of change
}),
_replace: function (idx, amt, objects) {
var content = _emberMetalProperty_get.get(this, 'content');
- if (content) {
+
+ if (content) {
this.replaceContent(idx, amt, objects);
}
return this;
},
@@ -33647,36 +34354,34 @@
}
});
exports.default = ArrayProxy;
});
-// Ember.assert
enifed('ember-runtime/system/container', ['exports', 'ember-metal/property_set', 'container/registry', 'container/container'], function (exports, _emberMetalProperty_set, _containerRegistry, _containerContainer) {
'use strict';
_containerRegistry.default.set = _emberMetalProperty_set.set;
_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/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) {
+enifed('ember-runtime/system/core_object', ['exports', 'ember-metal', 'ember-metal/debug', 'ember-metal/features', 'ember-metal/assign', '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, _emberMetalDebug, _emberMetalFeatures, _emberMetalAssign, _emberMetalProperty_get, _emberMetalUtils, _emberMetalMeta, _emberMetalChains, _emberMetalEvents, _emberMetalMixin, _emberMetalError, _emberRuntimeMixinsAction_handler, _emberMetalProperties, _emberMetalBinding, _emberMetalComputed, _emberMetalInjected_property, _emberMetalRun_loop, _emberMetalWatching, _emberMetalCore, _emberRuntimeInject) {
+ 'no use strict';
// Remove "use strict"; from transpiled module until
// https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
- //
-
- var _Mixin$create;
- 'REMOVE_USE_STRICT: true';
-
/**
@module ember
@submodule ember-runtime
*/
// using ember-metal/lib/main here to ensure that ember-debug is setup
// if present
+
+ var _Mixin$create;
+
var POST_INIT = _emberMetalUtils.symbol('POST_INIT');
exports.POST_INIT = POST_INIT;
var schedule = _emberMetalRun_loop.default.schedule;
var applyMixin = _emberMetalMixin.Mixin._apply;
var finishPartial = _emberMetalMixin.Mixin.finishPartial;
@@ -33687,11 +34392,11 @@
// 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;
- var initMixins, initProperties;
+ var initProperties;
var Class = function () {
if (!wasApplied) {
Class.proto(); // prepare prototype...
}
@@ -33702,16 +34407,10 @@
this.__defineNonEnumerable(_emberMetalUtils.GUID_KEY_PROPERTY);
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;
- initMixins = null;
- _emberMetalUtils.apply(this, this.reopen, mixins);
- }
if (initProperties) {
// capture locally so we can clear the closed over variable
var props = initProperties;
initProperties = null;
@@ -33719,11 +34418,10 @@
var mergedProperties = this.mergedProperties;
for (var i = 0, l = props.length; i < l; i++) {
var properties = props[i];
-
if (typeof properties !== 'object' && properties !== undefined) {
throw new _emberMetalError.default('Ember.Object.create only accepts objects.');
}
if (!properties) {
@@ -33735,17 +34433,16 @@
for (var j = 0, ll = keyNames.length; j < ll; j++) {
var keyName = keyNames[j];
var value = properties[keyName];
if (_emberMetalMixin.IS_BINDING.test(keyName)) {
- m.writableBindings()[keyName] = value;
+ m.writeBindings(keyName, value);
}
var possibleDesc = this[keyName];
var desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
-
if (concatenatedProperties && concatenatedProperties.length > 0 && concatenatedProperties.indexOf(keyName) >= 0) {
var baseValue = this[keyName];
if (baseValue) {
if ('function' === typeof baseValue.concat) {
@@ -33759,20 +34456,20 @@
}
if (mergedProperties && mergedProperties.length && mergedProperties.indexOf(keyName) >= 0) {
var originalValue = this[keyName];
- value = _emberMetalMerge.default(originalValue, value);
+ value = _emberMetalAssign.default(originalValue, value);
}
if (desc) {
desc.set(this, keyName, value);
} else {
if (typeof this.setUnknownProperty === 'function' && !(keyName in this)) {
this.setUnknownProperty(keyName, value);
} else {
- _emberMetalProperties.defineProperty(this, keyName, null, value); // setup mandatory setter
+ this[keyName] = value;
}
}
}
}
}
@@ -33808,13 +34505,11 @@
Class.PrototypeMixin = _emberMetalMixin.Mixin.create(Class.PrototypeMixin);
}
wasApplied = false;
};
- Class._initMixins = function (args) {
- initMixins = args;
- };
+
Class._initProperties = function (args) {
initProperties = args;
};
Class.proto = function () {
@@ -33939,18 +34634,20 @@
alert(thing);
}
});
```
This defines a new subclass of Ember.Object: `App.Person`. It contains one method: `say()`.
- You can also create a subclass from any existing class by calling its `extend()` method. For example, you might want to create a subclass of Ember's built-in `Ember.View` class:
+ You can also create a subclass from any existing class by calling its `extend()` method.
+ For example, you might want to create a subclass of Ember's built-in `Ember.View` class:
```javascript
App.PersonView = Ember.View.extend({
tagName: 'li',
classNameBindings: ['isAdministrator']
});
```
- When defining a subclass, you can override methods but still access the implementation of your parent class by calling the special `_super()` method:
+ When defining a subclass, you can override methods but still access the
+ implementation of your parent class by calling the special `_super()` method:
```javascript
App.Person = Ember.Object.extend({
say: function(thing) {
var name = this.get('name');
alert(name + ' says: ' + thing);
@@ -33959,19 +34656,21 @@
App.Soldier = App.Person.extend({
say: function(thing) {
this._super(thing + ", sir!");
},
march: function(numberOfHours) {
- alert(this.get('name') + ' marches for ' + numberOfHours + ' hours.')
+ alert(this.get('name') + ' marches for ' + numberOfHours + ' hours.');
}
});
var yehuda = App.Soldier.create({
name: "Yehuda Katz"
});
yehuda.say("Yes"); // alerts "Yehuda Katz says: Yes, sir!"
```
- The `create()` on line #17 creates an *instance* of the `App.Soldier` class. The `extend()` on line #8 creates a *subclass* of `App.Person`. Any instance of the `App.Person` class will *not* have the `march()` method.
+ The `create()` on line #17 creates an *instance* of the `App.Soldier` class.
+ The `extend()` on line #8 creates a *subclass* of `App.Person`. Any instance
+ of the `App.Person` class will *not* have the `march()` method.
You can also pass `Mixin` classes to add additional properties to the subclass.
```javascript
App.Person = Ember.Object.extend({
say: function(thing) {
alert(this.get('name') + ' says: ' + thing);
@@ -34100,12 +34799,12 @@
canBuild: false
});
MyObject.canBuild; // false
o = MyObject.create();
```
- In other words, this creates static properties and functions for the class. These are only available on the class
- and not on any instance of that class.
+ In other words, this creates static properties and functions for the class.
+ These are only available on the class and not on any instance of that class.
```javascript
App.Person = Ember.Object.extend({
name : "",
sayHello : function() {
alert("Hello. My name is " + this.get('name'));
@@ -34184,11 +34883,11 @@
metaForProperty: function (key) {
var proto = this.proto();
var possibleDesc = proto[key];
var desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
- return desc._meta || {};
+ return desc._meta || {};
},
_computedProperties: _emberMetalComputed.computed(function () {
hasCachedComputedProperties = true;
var proto = this.proto();
@@ -34229,14 +34928,12 @@
callback.call(binding || this, property.name, property.meta || empty);
}
}
};
- function injectedPropertyAssertion() {
- }
+ function injectedPropertyAssertion() {}
-
/**
Returns a hash of property names and container names that injected
properties will lookup on the container lazily.
@method _lazyInjections
@@ -34282,14 +34979,13 @@
});
exports.default = CoreObject;
});
-// Ember.assert, Ember.config
-
// NOTE: this object should never be included directly. Instead use `Ember.Object`.
// We only define this separately so that `Ember.Set` can depend on it.
+// setup mandatory setter
/**
Defines the properties that will be concatenated from the superclass
(instead of overridden).
By default, when you extend an Ember class a property defined in
@@ -34475,11 +35171,17 @@
```
@method toString
@return {String} string representation
@public
*/
-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) {
+
+/**
+ Provides lookup-time type validation for injected properties.
+ @private
+ @method _onLookup
+*/
+enifed('ember-runtime/system/each_proxy', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/observer', 'ember-metal/property_events', 'ember-metal/empty_object'], function (exports, _emberMetalDebug, _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
@@ -34488,11 +35190,11 @@
@private
*/
function EachProxy(content) {
this._content = content;
this._keys = undefined;
- this.__ember_meta__ = undefined;
+ this.__ember_meta__ = null;
}
EachProxy.prototype = {
__defineNonEnumerable: function (property) {
this[property.name] = property.descriptor.value;
@@ -34578,11 +35280,11 @@
function addObserverForContentKey(content, keyName, proxy, idx, loc) {
while (--loc >= idx) {
var item = content.objectAt(loc);
if (item) {
- _emberMetalObserver._addBeforeObserver(item, keyName, proxy, 'contentKeyWillChange');
+ _emberMetalObserver._addBeforeObserver(item, keyName, proxy, 'contentKeyWillChange');
_emberMetalObserver.addObserver(item, keyName, proxy, 'contentKeyDidChange');
}
}
}
@@ -34596,19 +35298,17 @@
}
}
exports.default = EachProxy;
});
-// Ember.assert
enifed('ember-runtime/system/lazy_load', ['exports', 'ember-metal/core', 'ember-runtime/system/native_array'], function (exports, _emberMetalCore, _emberRuntimeSystemNative_array) {
/*globals CustomEvent */
'use strict';
exports.onLoad = onLoad;
exports.runLoadHooks = runLoadHooks;
- // make sure Ember.A is setup.
/**
@module ember
@submodule ember-runtime
*/
@@ -34639,11 +35339,11 @@
*/
function onLoad(name, callback) {
var object = loaded[name];
- loadHooks[name] = loadHooks[name] || _emberMetalCore.default.A();
+ loadHooks[name] = loadHooks[name] || _emberRuntimeSystemNative_array.A();
loadHooks[name].pushObject(callback);
if (object) {
callback(object);
}
@@ -34680,11 +35380,11 @@
/**
@module ember
@submodule ember-runtime
*/
- // Ember.lookup, Ember.BOOTED, Ember.deprecate, Ember.NAME_KEY, Ember.anyUnprocessedMixins
+ // Ember.lookup, Ember.BOOTED, Ember.NAME_KEY, Ember.anyUnprocessedMixins
'use strict';
/**
A Namespace is an object usually used to contain other objects or methods
such as an application or framework. Create a namespace anytime you want
@@ -35081,10 +35781,36 @@
_emberMetalCore.default.A = A;exports.A = A;
exports.NativeArray = NativeArray;
exports.default = NativeArray;
});
// Ember.EXTEND_PROTOTYPES
+enifed('ember-runtime/system/object', ['exports', 'ember-runtime/system/core_object', 'ember-runtime/mixins/observable'], function (exports, _emberRuntimeSystemCore_object, _emberRuntimeMixinsObservable) {
+ /**
+ @module ember
+ @submodule ember-runtime
+ */
+
+ 'use strict';
+
+ /**
+ `Ember.Object` is the main base class for all Ember objects. It is a subclass
+ of `Ember.CoreObject` with the `Ember.Observable` mixin applied. For details,
+ see the documentation for each of these.
+
+ @class Object
+ @namespace Ember
+ @extends Ember.CoreObject
+ @uses Ember.Observable
+ @public
+ */
+ var EmberObject = _emberRuntimeSystemCore_object.default.extend(_emberRuntimeMixinsObservable.default);
+ EmberObject.toString = function () {
+ return 'Ember.Object';
+ };
+
+ exports.default = EmberObject;
+});
enifed('ember-runtime/system/object_proxy', ['exports', 'ember-runtime/system/object', 'ember-runtime/mixins/-proxy'], function (exports, _emberRuntimeSystemObject, _emberRuntimeMixinsProxy) {
'use strict';
/**
`Ember.ObjectProxy` forwards all properties not defined by the proxy itself
@@ -35156,36 +35882,10 @@
@public
*/
exports.default = _emberRuntimeSystemObject.default.extend(_emberRuntimeMixinsProxy.default);
});
-enifed('ember-runtime/system/object', ['exports', 'ember-runtime/system/core_object', 'ember-runtime/mixins/observable'], function (exports, _emberRuntimeSystemCore_object, _emberRuntimeMixinsObservable) {
- /**
- @module ember
- @submodule ember-runtime
- */
-
- 'use strict';
-
- /**
- `Ember.Object` is the main base class for all Ember objects. It is a subclass
- of `Ember.CoreObject` with the `Ember.Observable` mixin applied. For details,
- see the documentation for each of these.
-
- @class Object
- @namespace Ember
- @extends Ember.CoreObject
- @uses Ember.Observable
- @public
- */
- var EmberObject = _emberRuntimeSystemCore_object.default.extend(_emberRuntimeMixinsObservable.default);
- EmberObject.toString = function () {
- return 'Ember.Object';
- };
-
- exports.default = EmberObject;
-});
enifed('ember-runtime/system/service', ['exports', 'ember-runtime/system/object', 'ember-runtime/inject'], function (exports, _emberRuntimeSystemObject, _emberRuntimeInject) {
'use strict';
/**
Creates a property that lazily looks up a service in the container. There
@@ -35230,11 +35930,11 @@
isServiceFactory: true
});
exports.default = Service;
});
-enifed('ember-runtime/system/string', ['exports', 'ember-metal/core', 'ember-metal/utils', 'ember-runtime/utils', 'ember-metal/cache'], function (exports, _emberMetalCore, _emberMetalUtils, _emberRuntimeUtils, _emberMetalCache) {
+enifed('ember-runtime/system/string', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/utils', 'ember-runtime/utils', 'ember-metal/cache'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalUtils, _emberRuntimeUtils, _emberMetalCache) {
/**
@module ember
@submodule ember-runtime
*/
'use strict';
@@ -35316,11 +36016,11 @@
return s === null ? '(null)' : s === undefined ? '' : _emberMetalUtils.inspect(s);
});
}
function fmt(str, formats) {
- return _fmt.apply(undefined, arguments);
+ return _fmt.apply(undefined, arguments);
}
function loc(str, formats) {
if (!_emberRuntimeUtils.isArray(formats) || arguments.length > 2) {
formats = Array.prototype.slice.call(arguments, 1);
@@ -35698,47 +36398,96 @@
}
return ret;
}
});
-enifed('ember-template-compiler', ['exports', 'ember-metal', 'ember-template-compiler/system/precompile', 'ember-template-compiler/system/compile', 'ember-template-compiler/system/template', 'ember-template-compiler/plugins', 'ember-template-compiler/plugins/transform-old-binding-syntax', 'ember-template-compiler/plugins/transform-old-class-binding-syntax', 'ember-template-compiler/plugins/transform-item-class', 'ember-template-compiler/plugins/transform-component-attrs-into-mut', 'ember-template-compiler/plugins/transform-component-curly-to-readonly', 'ember-template-compiler/plugins/transform-angle-bracket-components', 'ember-template-compiler/plugins/transform-input-on-to-onEvent', 'ember-template-compiler/plugins/transform-top-level-components', 'ember-template-compiler/plugins/transform-each-into-collection', 'ember-template-compiler/plugins/transform-unescaped-inline-link-to', 'ember-template-compiler/plugins/assert-no-view-and-controller-paths', 'ember-template-compiler/plugins/assert-no-view-helper', 'ember-template-compiler/compat'], function (exports, _emberMetal, _emberTemplateCompilerSystemPrecompile, _emberTemplateCompilerSystemCompile, _emberTemplateCompilerSystemTemplate, _emberTemplateCompilerPlugins, _emberTemplateCompilerPluginsTransformOldBindingSyntax, _emberTemplateCompilerPluginsTransformOldClassBindingSyntax, _emberTemplateCompilerPluginsTransformItemClass, _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut, _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly, _emberTemplateCompilerPluginsTransformAngleBracketComponents, _emberTemplateCompilerPluginsTransformInputOnToOnEvent, _emberTemplateCompilerPluginsTransformTopLevelComponents, _emberTemplateCompilerPluginsTransformEachIntoCollection, _emberTemplateCompilerPluginsTransformUnescapedInlineLinkTo, _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths, _emberTemplateCompilerPluginsAssertNoViewHelper, _emberTemplateCompilerCompat) {
+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
+ */
+
+ // BEGIN IMPORTS
'use strict';
- _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldBindingSyntax.default);
- _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldClassBindingSyntax.default);
- _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformItemClass.default);
- _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut.default);
- _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly.default);
- _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformAngleBracketComponents.default);
- _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformInputOnToOnEvent.default);
- _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformTopLevelComponents.default);
- _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformUnescapedInlineLinkTo.default);
+ // END IMPORTS
- if (_emberMetal.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
- _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformEachIntoCollection.default);
- } else {
- _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths.default);
- _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsAssertNoViewHelper.default);
- }
+ // BEGIN EXPORTS
+ _emberMetal.default.compare = _emberRuntimeCompare.default;
+ _emberMetal.default.copy = _emberRuntimeCopy.default;
+ _emberMetal.default.isEqual = _emberRuntimeIsEqual.default;
- exports._Ember = _emberMetal.default;
- exports.precompile = _emberTemplateCompilerSystemPrecompile.default;
- exports.compile = _emberTemplateCompilerSystemCompile.default;
- exports.template = _emberTemplateCompilerSystemTemplate.default;
- exports.registerPlugin = _emberTemplateCompilerPlugins.registerPlugin;
-});
+ _emberMetal.default.inject = _emberRuntimeInject.default;
-// used for adding Ember.Handlebars.compile for backwards compat
-enifed('ember-template-compiler/compat', ['exports', 'ember-metal/core', 'ember-template-compiler/compat/precompile', 'ember-template-compiler/system/compile', 'ember-template-compiler/system/template'], function (exports, _emberMetalCore, _emberTemplateCompilerCompatPrecompile, _emberTemplateCompilerSystemCompile, _emberTemplateCompilerSystemTemplate) {
- 'use strict';
+ _emberMetal.default.Array = _emberRuntimeMixinsArray.default;
- var EmberHandlebars = _emberMetalCore.default.Handlebars = _emberMetalCore.default.Handlebars || {};
+ _emberMetal.default.Comparable = _emberRuntimeMixinsComparable.default;
+ _emberMetal.default.Copyable = _emberRuntimeMixinsCopyable.default;
- EmberHandlebars.precompile = _emberTemplateCompilerCompatPrecompile.default;
- EmberHandlebars.compile = _emberTemplateCompilerSystemCompile.default;
- EmberHandlebars.template = _emberTemplateCompilerSystemTemplate.default;
+ _emberMetal.default.Freezable = _emberRuntimeMixinsFreezable.Freezable;
+ _emberMetal.default.FROZEN_ERROR = _emberRuntimeMixinsFreezable.FROZEN_ERROR;
+
+ _emberMetal.default.MutableEnumerable = _emberRuntimeMixinsMutable_enumerable.default;
+ _emberMetal.default.MutableArray = _emberRuntimeMixinsMutable_array.default;
+
+ _emberMetal.default.TargetActionSupport = _emberRuntimeMixinsTarget_action_support.default;
+ _emberMetal.default.Evented = _emberRuntimeMixinsEvented.default;
+
+ _emberMetal.default.PromiseProxyMixin = _emberRuntimeMixinsPromise_proxy.default;
+
+ _emberMetal.default.Observable = _emberRuntimeMixinsObservable.default;
+
+ _emberMetal.default.typeOf = _emberRuntimeUtils.typeOf;
+ _emberMetal.default.isArray = _emberRuntimeUtils.isArray;
+
+ // ES6TODO: this seems a less than ideal way/place to add properties to Ember.computed
+ var EmComputed = _emberMetal.default.computed;
+
+ EmComputed.sum = _emberRuntimeComputedReduce_computed_macros.sum;
+ EmComputed.min = _emberRuntimeComputedReduce_computed_macros.min;
+ EmComputed.max = _emberRuntimeComputedReduce_computed_macros.max;
+ EmComputed.map = _emberRuntimeComputedReduce_computed_macros.map;
+ EmComputed.sort = _emberRuntimeComputedReduce_computed_macros.sort;
+ EmComputed.setDiff = _emberRuntimeComputedReduce_computed_macros.setDiff;
+ EmComputed.mapBy = _emberRuntimeComputedReduce_computed_macros.mapBy;
+ EmComputed.filter = _emberRuntimeComputedReduce_computed_macros.filter;
+ EmComputed.filterBy = _emberRuntimeComputedReduce_computed_macros.filterBy;
+ EmComputed.uniq = _emberRuntimeComputedReduce_computed_macros.uniq;
+ EmComputed.union = _emberRuntimeComputedReduce_computed_macros.union;
+ EmComputed.intersect = _emberRuntimeComputedReduce_computed_macros.intersect;
+
+ _emberMetal.default.String = _emberRuntimeSystemString.default;
+ _emberMetal.default.Object = _emberRuntimeSystemObject.default;
+ _emberMetal.default.Container = _emberRuntimeSystemContainer.Container;
+ _emberMetal.default.Registry = _emberRuntimeSystemContainer.Registry;
+ _emberMetal.default.Namespace = _emberRuntimeSystemNamespace.default;
+ _emberMetal.default.Enumerable = _emberRuntimeMixinsEnumerable.default;
+ _emberMetal.default.ArrayProxy = _emberRuntimeSystemArray_proxy.default;
+ _emberMetal.default.ObjectProxy = _emberRuntimeSystemObject_proxy.default;
+ _emberMetal.default.ActionHandler = _emberRuntimeMixinsAction_handler.default;
+ _emberMetal.default.CoreObject = _emberRuntimeSystemCore_object.default;
+ _emberMetal.default.NativeArray = _emberRuntimeSystemNative_array.default;
+ // ES6TODO: Currently we must rely on the global from ember-metal/core to avoid circular deps
+ // Ember.A = A;
+ _emberMetal.default.onLoad = _emberRuntimeSystemLazy_load.onLoad;
+ _emberMetal.default.runLoadHooks = _emberRuntimeSystemLazy_load.runLoadHooks;
+
+ _emberMetal.default.Controller = _emberRuntimeControllersController.default;
+ _emberMetal.default.ControllerMixin = _emberRuntimeMixinsController.default;
+
+ _emberMetal.default.Service = _emberRuntimeSystemService.default;
+
+ _emberMetal.default._ProxyMixin = _emberRuntimeMixinsProxy.default;
+
+ _emberMetal.default.RSVP = _emberRuntimeExtRsvp.default;
+ // END EXPORTS
+
+ exports.default = _emberMetal.default;
});
+// just for side effect of extending Ember.RSVP
+// just for side effect of extending String.prototype
+// just for side effect of extending Function.prototype
enifed('ember-template-compiler/compat/precompile', ['exports', 'ember-metal/core', 'ember-template-compiler/system/compile_options'], function (exports, _emberMetalCore, _emberTemplateCompilerSystemCompile_options) {
/**
@module ember
@submodule ember-template-compiler
*/
@@ -35762,45 +36511,20 @@
var compileFunc = asObject ? compile : compileSpec;
return compileFunc(string, _emberTemplateCompilerSystemCompile_options.default());
};
});
-enifed('ember-template-compiler/plugins', ['exports'], function (exports) {
- /**
- @module ember
- @submodule ember-template-compiler
- */
-
- /**
- @private
- @property helpers
- */
+enifed('ember-template-compiler/compat', ['exports', 'ember-metal/core', 'ember-template-compiler/compat/precompile', 'ember-template-compiler/system/compile', 'ember-template-compiler/system/template'], function (exports, _emberMetalCore, _emberTemplateCompilerCompatPrecompile, _emberTemplateCompilerSystemCompile, _emberTemplateCompilerSystemTemplate) {
'use strict';
- exports.registerPlugin = registerPlugin;
- var plugins = {
- ast: []
- };
+ var EmberHandlebars = _emberMetalCore.default.Handlebars = _emberMetalCore.default.Handlebars || {};
- /**
- Adds an AST plugin to be used by Ember.HTMLBars.compile.
-
- @private
- @method registerASTPlugin
- */
-
- function registerPlugin(type, Plugin) {
- if (!plugins[type]) {
- throw new Error('Attempting to register "' + Plugin + '" as "' + type + '" which is not a valid HTMLBars plugin type.');
- }
-
- plugins[type].push(Plugin);
- }
-
- exports.default = plugins;
+ EmberHandlebars.precompile = _emberTemplateCompilerCompatPrecompile.default;
+ EmberHandlebars.compile = _emberTemplateCompilerSystemCompile.default;
+ EmberHandlebars.template = _emberTemplateCompilerSystemTemplate.default;
});
-enifed('ember-template-compiler/plugins/assert-no-view-and-controller-paths', ['exports', 'ember-metal/core', 'ember-template-compiler/system/calculate-location-display'], function (exports, _emberMetalCore, _emberTemplateCompilerSystemCalculateLocationDisplay) {
+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) {
// set later within HTMLBars to the syntax package
this.syntax = null;
@@ -35850,20 +36574,19 @@
path = paths[i];
assertPath(moduleName, node, path);
}
}
- function assertPath(moduleName, node, path) {
- }
+ function assertPath(moduleName, node, path) {}
function validate(node) {
return node.type === 'MustacheStatement' || node.type === 'BlockStatement';
}
exports.default = AssertNoViewAndControllerPaths;
});
-enifed('ember-template-compiler/plugins/assert-no-view-helper', ['exports', 'ember-metal/core', 'ember-template-compiler/system/calculate-location-display'], function (exports, _emberMetalCore, _emberTemplateCompilerSystemCalculateLocationDisplay) {
+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) {
// set later within HTMLBars to the syntax package
this.syntax = null;
@@ -35896,12 +36619,11 @@
function assertHelper(moduleName, node) {
var paramValue = node.params.length && node.params[0].value;
if (!paramValue) {
return;
- } else {
- }
+ } else {}
}
function validate(node) {
return (node.type === 'MustacheStatement' || node.type === 'BlockStatement') && node.path.parts[0] === 'view';
}
@@ -36103,11 +36825,11 @@
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/core', 'ember-template-compiler/system/calculate-location-display'], function (exports, _emberMetalCore, _emberTemplateCompilerSystemCalculateLocationDisplay) {
+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;
function TransformEachIntoCollection(options) {
@@ -36126,11 +36848,10 @@
return;
}
var moduleInfo = _emberTemplateCompilerSystemCalculateLocationDisplay.default(moduleName, legacyHashKey.loc);
-
var list = node.params.shift();
node.path = b.path('collection');
node.params.unshift(b.string('-legacy-each'));
@@ -36165,11 +36886,11 @@
}
return false;
}
});
-enifed('ember-template-compiler/plugins/transform-input-on-to-onEvent', ['exports', 'ember-metal/core', 'ember-template-compiler/system/calculate-location-display'], function (exports, _emberMetalCore, _emberTemplateCompilerSystemCalculateLocationDisplay) {
+enifed('ember-template-compiler/plugins/transform-input-on-to-onEvent', ['exports', 'ember-metal/debug', 'ember-template-compiler/system/calculate-location-display'], function (exports, _emberMetalDebug, _emberTemplateCompilerSystemCalculateLocationDisplay) {
'use strict';
/**
@module ember
@submodule ember-htmlbars
@@ -36217,20 +36938,20 @@
var onEvent = hashPairForKey(node.hash, 'onEvent');
var normalizedOn = on || onEvent;
var moduleInfo = _emberTemplateCompilerSystemCalculateLocationDisplay.default(moduleName, node.loc);
if (normalizedOn && normalizedOn.value.type !== 'StringLiteral') {
-
+
normalizedOn.key = 'onEvent';
return; // exit early, as we cannot transform further
}
removeFromHash(node.hash, normalizedOn);
removeFromHash(node.hash, action);
if (!action) {
-
+
return; // exit early, if no action was available there is nothing to do
}
var specifiedOn = normalizedOn ? normalizedOn.key + '="' + normalizedOn.value.value + '" ' : '';
if (normalizedOn && normalizedOn.value.value === 'keyPress') {
@@ -36239,11 +36960,11 @@
normalizedOn.value.value = 'key-press';
}
var expected = (normalizedOn ? normalizedOn.value.value : 'enter') + '="' + action.value.original + '"';
- if (!normalizedOn) {
+ if (!normalizedOn) {
normalizedOn = b.pair('onEvent', b.string('enter'));
}
node.hash.pairs.push(b.pair(normalizedOn.value.value, action.value));
}
@@ -36333,11 +37054,11 @@
for (var i = 0, l = list.length; i < l; i++) {
callback(list[i]);
}
}
});
-enifed('ember-template-compiler/plugins/transform-old-binding-syntax', ['exports', 'ember-metal/core', 'ember-template-compiler/system/calculate-location-display'], function (exports, _emberMetalCore, _emberTemplateCompilerSystemCalculateLocationDisplay) {
+enifed('ember-template-compiler/plugins/transform-old-binding-syntax', ['exports', 'ember-metal/debug', 'ember-template-compiler/system/calculate-location-display'], function (exports, _emberMetalDebug, _emberTemplateCompilerSystemCalculateLocationDisplay) {
'use strict';
exports.default = TransformOldBindingSyntax;
function TransformOldBindingSyntax(options) {
@@ -36363,15 +37084,13 @@
if (key === 'classBinding') {
return;
}
-
if (key.substr(-7) === 'Binding') {
var newKey = key.slice(0, -7);
-
pair.key = newKey;
if (value.type === 'StringLiteral') {
pair.value = b.path(value.original);
}
}
@@ -36538,11 +37257,11 @@
}
return segments;
}
});
-enifed('ember-template-compiler/plugins/transform-top-level-components', ['exports'], function (exports) {
+enifed('ember-template-compiler/plugins/transform-top-level-components', ['exports', 'ember-metal/features'], function (exports, _emberMetalFeatures) {
'use strict';
function TransformTopLevelComponents() {
// set later within HTMLBars to the syntax package
this.syntax = null;
@@ -36552,18 +37271,44 @@
@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;
+ var b = this.syntax.builders;
+
+ hasSingleComponentNode(ast, function (component) {
+ if (component.type === 'ComponentNode') {
+ component.tag = '@' + component.tag;
+ component.isStatic = true;
+ }
+ }, function (element) {
+ var hasTripleCurlies = element.attributes.some(function (attr) {
+ return attr.value.escaped === false;
+ });
+
+ if (element.modifiers.length || hasTripleCurlies) {
+ return element;
+ } else {
+ // TODO: Properly copy loc from children
+ var program = b.program(element.children);
+ var component = b.component('@<' + element.tag + '>', element.attributes, program, element.loc);
+ component.isStatic = true;
+ return component;
+ }
});
return ast;
};
- function hasSingleComponentNode(body, callback) {
+ function hasSingleComponentNode(program, componentCallback, elementCallback) {
+ var loc = program.loc;
+ var body = program.body;
+
+ if (!loc || loc.start.line !== 1 || loc.start.column !== 0) {
+ return;
+ }
+
var lastComponentNode = undefined;
var lastIndex = undefined;
var nodeCount = 0;
for (var i = 0, l = body.length; i < l; i++) {
@@ -36588,11 +37333,11 @@
if (!lastComponentNode) {
return;
}
if (lastComponentNode.type === 'ComponentNode') {
- callback(lastComponentNode);
+ componentCallback(lastComponentNode);
}
}
exports.default = TransformTopLevelComponents;
});
@@ -36624,10 +37369,44 @@
function validate(node) {
return node.type === 'MustacheStatement' && node.path.original === 'link-to' && !node.escaped;
}
});
+enifed('ember-template-compiler/plugins', ['exports'], function (exports) {
+ /**
+ @module ember
+ @submodule ember-template-compiler
+ */
+
+ /**
+ @private
+ @property helpers
+ */
+ 'use strict';
+
+ exports.registerPlugin = registerPlugin;
+ var plugins = {
+ ast: []
+ };
+
+ /**
+ Adds an AST plugin to be used by Ember.HTMLBars.compile.
+
+ @private
+ @method registerASTPlugin
+ */
+
+ function registerPlugin(type, Plugin) {
+ if (!plugins[type]) {
+ throw new Error('Attempting to register "' + Plugin + '" as "' + type + '" which is not a valid HTMLBars plugin type.');
+ }
+
+ plugins[type].push(Plugin);
+ }
+
+ exports.default = plugins;
+});
enifed('ember-template-compiler/system/calculate-location-display', ['exports'], function (exports) {
'use strict';
exports.default = calculateLocationDisplay;
@@ -36657,10 +37436,45 @@
}
return moduleInfo;
}
});
+enifed('ember-template-compiler/system/compile', ['exports', 'ember-metal/core', 'ember-template-compiler/system/compile_options', 'ember-template-compiler/system/template'], function (exports, _emberMetalCore, _emberTemplateCompilerSystemCompile_options, _emberTemplateCompilerSystemTemplate) {
+ /**
+ @module ember
+ @submodule ember-template-compiler
+ */
+
+ 'use strict';
+
+ var compile;
+
+ /**
+ Uses HTMLBars `compile` function to process a string into a compiled template.
+
+ This is not present in production builds.
+
+ @private
+ @method compile
+ @param {String} templateString This is the string to be compiled by HTMLBars.
+ @param {Object} options This is an options hash to augment the compiler options.
+ */
+
+ exports.default = function (templateString, options) {
+ if (!compile && _emberMetalCore.default.__loader.registry['htmlbars-compiler/compiler']) {
+ compile = requireModule('htmlbars-compiler/compiler').compile;
+ }
+
+ if (!compile) {
+ throw new Error('Cannot call `compile` without the template compiler loaded. Please load `ember-template-compiler.js` prior to calling `compile`.');
+ }
+
+ var templateSpec = compile(templateString, _emberTemplateCompilerSystemCompile_options.default(options));
+
+ return _emberTemplateCompilerSystemTemplate.default(templateSpec);
+ };
+});
enifed('ember-template-compiler/system/compile_options', ['exports', 'ember-metal/features', 'ember-metal/assign', 'ember-template-compiler/plugins'], function (exports, _emberMetalFeatures, _emberMetalAssign, _emberTemplateCompilerPlugins) {
/**
@module ember
@submodule ember-template-compiler
*/
@@ -36696,101 +37510,77 @@
}
options.plugins = plugins;
options.buildMeta = function buildMeta(program) {
return {
- topLevel: detectTopLevel(program),
- revision: 'Ember@2.1.2',
+ fragmentReason: fragmentReason(program),
+ revision: 'Ember@2.2.0-beta.1',
loc: program.loc,
moduleName: options.moduleName
};
};
return options;
};
- function detectTopLevel(program) {
+ function fragmentReason(program) {
var loc = program.loc;
var body = program.body;
if (!loc || loc.start.line !== 1 || loc.start.column !== 0) {
- return null;
+ return false;
}
- var lastComponentNode = undefined;
- var lastIndex = undefined;
+ var candidate = undefined;
var nodeCount = 0;
+ var problems = {};
+
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;
+ problems['multiple-nodes'] = true;
}
if (curr.type === 'ComponentNode' || curr.type === 'ElementNode') {
- lastComponentNode = curr;
- lastIndex = i;
+ candidate = curr;
+ } else {
+ problems['wrong-type'] = true;
}
}
- if (!lastComponentNode) {
- return null;
+ if (nodeCount === 0) {
+ return { name: 'missing-wrapper', problems: ['empty-body'] };
}
- if (lastComponentNode.type === 'ComponentNode') {
- var tag = lastComponentNode.tag;
- if (tag.charAt(0) !== '<') {
- return null;
- }
- return tag.slice(1, -1);
+ var problemList = Object.keys(problems);
+ if (problemList.length) {
+ return { name: 'missing-wrapper', problems: problemList };
}
- return null;
+ if (candidate.type === 'ComponentNode') {
+ return false;
+ } else if (candidate.modifiers.length) {
+ return { name: 'modifiers', modifiers: candidate.modifiers.map(function (m) {
+ return m.path.original;
+ }) };
+ } else if (candidate.attributes.some(function (attr) {
+ return !attr.value.escaped;
+ })) {
+ return { name: 'triple-curlies' };
+ } else {
+ return false;
+ }
}
});
-enifed('ember-template-compiler/system/compile', ['exports', 'ember-metal/core', 'ember-template-compiler/system/compile_options', 'ember-template-compiler/system/template'], function (exports, _emberMetalCore, _emberTemplateCompilerSystemCompile_options, _emberTemplateCompilerSystemTemplate) {
- /**
- @module ember
- @submodule ember-template-compiler
- */
-
- 'use strict';
-
- var compile;
-
- /**
- Uses HTMLBars `compile` function to process a string into a compiled template.
-
- This is not present in production builds.
-
- @private
- @method compile
- @param {String} templateString This is the string to be compiled by HTMLBars.
- @param {Object} options This is an options hash to augment the compiler options.
- */
-
- exports.default = function (templateString, options) {
- if (!compile && _emberMetalCore.default.__loader.registry['htmlbars-compiler/compiler']) {
- compile = requireModule('htmlbars-compiler/compiler').compile;
- }
-
- if (!compile) {
- throw new Error('Cannot call `compile` without the template compiler loaded. Please load `ember-template-compiler.js` prior to calling `compile`.');
- }
-
- var templateSpec = compile(templateString, _emberTemplateCompilerSystemCompile_options.default(options));
-
- return _emberTemplateCompilerSystemTemplate.default(templateSpec);
- };
-});
enifed('ember-template-compiler/system/precompile', ['exports', 'ember-metal/core', 'ember-template-compiler/system/compile_options'], function (exports, _emberMetalCore, _emberTemplateCompilerSystemCompile_options) {
/**
@module ember
@submodule ember-template-compiler
*/
@@ -36847,80 +37637,39 @@
templateSpec.isMethod = false;
return templateSpec;
};
});
-enifed('ember-views', ['exports', 'ember-runtime', 'ember-views/system/jquery', 'ember-views/system/utils', 'ember-views/system/ext', 'ember-views/views/states', 'ember-metal-views/renderer', 'ember-views/views/core_view', 'ember-views/views/view', 'ember-views/views/container_view', 'ember-views/views/collection_view', 'ember-views/views/component', 'ember-views/system/event_dispatcher', 'ember-views/mixins/view_target_action_support', 'ember-views/component_lookup', 'ember-views/views/checkbox', 'ember-views/mixins/text_support', 'ember-views/views/text_field', 'ember-views/views/text_area', 'ember-views/views/select', 'ember-views/compat/metamorph_view', 'ember-views/views/legacy_each_view'], function (exports, _emberRuntime, _emberViewsSystemJquery, _emberViewsSystemUtils, _emberViewsSystemExt, _emberViewsViewsStates, _emberMetalViewsRenderer, _emberViewsViewsCore_view, _emberViewsViewsView, _emberViewsViewsContainer_view, _emberViewsViewsCollection_view, _emberViewsViewsComponent, _emberViewsSystemEvent_dispatcher, _emberViewsMixinsView_target_action_support, _emberViewsComponent_lookup, _emberViewsViewsCheckbox, _emberViewsMixinsText_support, _emberViewsViewsText_field, _emberViewsViewsText_area, _emberViewsViewsSelect, _emberViewsCompatMetamorph_view, _emberViewsViewsLegacy_each_view) {
- /**
- @module ember
- @submodule ember-views
- */
-
- // BEGIN IMPORTS
+enifed('ember-template-compiler', ['exports', 'ember-metal', 'ember-template-compiler/system/precompile', 'ember-template-compiler/system/compile', 'ember-template-compiler/system/template', 'ember-template-compiler/plugins', 'ember-template-compiler/plugins/transform-old-binding-syntax', 'ember-template-compiler/plugins/transform-old-class-binding-syntax', 'ember-template-compiler/plugins/transform-item-class', 'ember-template-compiler/plugins/transform-component-attrs-into-mut', 'ember-template-compiler/plugins/transform-component-curly-to-readonly', 'ember-template-compiler/plugins/transform-angle-bracket-components', 'ember-template-compiler/plugins/transform-input-on-to-onEvent', 'ember-template-compiler/plugins/transform-top-level-components', 'ember-template-compiler/plugins/transform-each-into-collection', 'ember-template-compiler/plugins/transform-unescaped-inline-link-to', 'ember-template-compiler/plugins/assert-no-view-and-controller-paths', 'ember-template-compiler/plugins/assert-no-view-helper', 'ember-template-compiler/compat'], function (exports, _emberMetal, _emberTemplateCompilerSystemPrecompile, _emberTemplateCompilerSystemCompile, _emberTemplateCompilerSystemTemplate, _emberTemplateCompilerPlugins, _emberTemplateCompilerPluginsTransformOldBindingSyntax, _emberTemplateCompilerPluginsTransformOldClassBindingSyntax, _emberTemplateCompilerPluginsTransformItemClass, _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut, _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly, _emberTemplateCompilerPluginsTransformAngleBracketComponents, _emberTemplateCompilerPluginsTransformInputOnToOnEvent, _emberTemplateCompilerPluginsTransformTopLevelComponents, _emberTemplateCompilerPluginsTransformEachIntoCollection, _emberTemplateCompilerPluginsTransformUnescapedInlineLinkTo, _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths, _emberTemplateCompilerPluginsAssertNoViewHelper, _emberTemplateCompilerCompat) {
'use strict';
- // END IMPORTS
+ _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldBindingSyntax.default);
+ _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldClassBindingSyntax.default);
+ _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformItemClass.default);
+ _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut.default);
+ _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly.default);
+ _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformAngleBracketComponents.default);
+ _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformInputOnToOnEvent.default);
+ _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformTopLevelComponents.default);
+ _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformUnescapedInlineLinkTo.default);
- /**
- Alias for jQuery
-
- @method $
- @for Ember
- @public
- */
-
- // BEGIN EXPORTS
- _emberRuntime.default.$ = _emberViewsSystemJquery.default;
-
- _emberRuntime.default.ViewTargetActionSupport = _emberViewsMixinsView_target_action_support.default;
-
- var ViewUtils = _emberRuntime.default.ViewUtils = {};
- ViewUtils.isSimpleClick = _emberViewsSystemUtils.isSimpleClick;
- ViewUtils.getViewClientRects = _emberViewsSystemUtils.getViewClientRects;
- ViewUtils.getViewBoundingClientRect = _emberViewsSystemUtils.getViewBoundingClientRect;
-
- if (_emberRuntime.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
- _emberRuntime.default.CoreView = _emberViewsViewsCore_view.DeprecatedCoreView;
- _emberRuntime.default.View = _emberViewsViewsView.DeprecatedView;
- _emberRuntime.default.View.states = _emberViewsViewsStates.states;
- _emberRuntime.default.View.cloneStates = _emberViewsViewsStates.cloneStates;
- _emberRuntime.default.View._Renderer = _emberMetalViewsRenderer.default;
- _emberRuntime.default.ContainerView = _emberViewsViewsContainer_view.DeprecatedContainerView;
- _emberRuntime.default.CollectionView = _emberViewsViewsCollection_view.DeprecatedCollectionView;
+ if (_emberMetal.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
+ _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformEachIntoCollection.default);
+ } else {
+ _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths.default);
+ _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsAssertNoViewHelper.default);
}
- _emberRuntime.default._Renderer = _emberMetalViewsRenderer.default;
-
- _emberRuntime.default.Checkbox = _emberViewsViewsCheckbox.default;
- _emberRuntime.default.TextField = _emberViewsViewsText_field.default;
- _emberRuntime.default.TextArea = _emberViewsViewsText_area.default;
-
- if (_emberRuntime.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
- _emberRuntime.default.Select = _emberViewsViewsSelect.Select;
- }
-
- _emberRuntime.default.SelectOption = _emberViewsViewsSelect.SelectOption;
- _emberRuntime.default.SelectOptgroup = _emberViewsViewsSelect.SelectOptgroup;
-
- _emberRuntime.default.TextSupport = _emberViewsMixinsText_support.default;
- _emberRuntime.default.ComponentLookup = _emberViewsComponent_lookup.default;
- _emberRuntime.default.Component = _emberViewsViewsComponent.default;
- _emberRuntime.default.EventDispatcher = _emberViewsSystemEvent_dispatcher.default;
-
- // Deprecated:
- if (_emberRuntime.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
- _emberRuntime.default._Metamorph = _emberViewsCompatMetamorph_view._Metamorph;
- _emberRuntime.default._MetamorphView = _emberViewsCompatMetamorph_view.default;
- _emberRuntime.default._LegacyEachView = _emberViewsViewsLegacy_each_view.default;
- }
-
- // END EXPORTS
-
- exports.default = _emberRuntime.default;
+ exports._Ember = _emberMetal.default;
+ exports.precompile = _emberTemplateCompilerSystemPrecompile.default;
+ exports.compile = _emberTemplateCompilerSystemCompile.default;
+ exports.template = _emberTemplateCompilerSystemTemplate.default;
+ exports.registerPlugin = _emberTemplateCompilerPlugins.registerPlugin;
});
-// for the side effect of extending Ember.run.queues
-enifed('ember-views/compat/attrs-proxy', ['exports', 'ember-metal/mixin', 'ember-metal/utils', 'ember-metal/property_events', 'ember-metal/events', 'ember-metal/empty_object'], function (exports, _emberMetalMixin, _emberMetalUtils, _emberMetalProperty_events, _emberMetalEvents, _emberMetalEmpty_object) {
+
+// used for adding Ember.Handlebars.compile for backwards compat
+enifed('ember-views/compat/attrs-proxy', ['exports', 'ember-metal/mixin', 'ember-metal/utils', 'ember-metal/property_events'], function (exports, _emberMetalMixin, _emberMetalUtils, _emberMetalProperty_events) {
'use strict';
exports.deprecation = deprecation;
function deprecation(key) {
@@ -36932,42 +37681,13 @@
exports.MUTABLE_CELL = MUTABLE_CELL;
function isCell(val) {
return val && val[MUTABLE_CELL];
}
- function setupAvoidPropagating(instance) {
- // This caches the list of properties to avoid setting onto the component instance
- // inside `_propagateAttrsToThis`. We cache them so that every instantiated component
- // does not have to pay the calculation penalty.
- var constructor = instance.constructor;
- if (!constructor.__avoidPropagating) {
- constructor.__avoidPropagating = new _emberMetalEmpty_object.default();
- var i = undefined,
- l = undefined;
- for (i = 0, l = instance.concatenatedProperties.length; i < l; i++) {
- var prop = instance.concatenatedProperties[i];
-
- constructor.__avoidPropagating[prop] = true;
- }
-
- for (i = 0, l = instance.mergedProperties.length; i < l; i++) {
- var prop = instance.mergedProperties[i];
-
- constructor.__avoidPropagating[prop] = true;
- }
- }
- }
-
var AttrsProxyMixin = {
attrs: null,
- init: function () {
- this._super.apply(this, arguments);
-
- setupAvoidPropagating(this);
- },
-
getAttr: function (key) {
var attrs = this.attrs;
if (!attrs) {
return;
}
@@ -36988,55 +37708,15 @@
}
val.update(value);
},
- _propagateAttrsToThis: function () {
- var attrs = this.attrs;
-
- for (var prop in attrs) {
- if (prop !== 'attrs' && !this.constructor.__avoidPropagating[prop]) {
- this.set(prop, this.getAttr(prop));
- }
- }
- },
-
- initializeShape: _emberMetalEvents.on('init', function () {
- this._isDispatchingAttrs = false;
- }),
-
- _internalDidReceiveAttrs: function () {
- this._super();
+ _propagateAttrsToThis: function (attrs) {
this._isDispatchingAttrs = true;
- this._propagateAttrsToThis();
+ this.setProperties(attrs);
this._isDispatchingAttrs = false;
- },
-
- unknownProperty: function (key) {
- if (this._isAngleBracket) {
- return;
- }
-
- var attrs = this.attrs;
-
- if (attrs && key in attrs) {
- // do not deprecate accessing `this[key]` at this time.
- // add this back when we have a proper migration path
- // Ember.deprecate(deprecation(key), { id: 'ember-views.', until: '3.0.0' });
- var possibleCell = attrs[key];
-
- if (possibleCell && possibleCell[MUTABLE_CELL]) {
- return possibleCell.value;
- }
-
- return possibleCell;
- }
}
-
- //setUnknownProperty(key) {
-
- //}
};
AttrsProxyMixin[_emberMetalProperty_events.PROPERTY_DID_CHANGE] = function (key) {
if (this._isAngleBracket) {
return;
@@ -37050,12 +37730,11 @@
}
};
exports.default = _emberMetalMixin.Mixin.create(AttrsProxyMixin);
});
-enifed('ember-views/compat/metamorph_view', ['exports', 'ember-metal/core', 'ember-views/views/view', 'ember-metal/mixin'], function (exports, _emberMetalCore, _emberViewsViewsView, _emberMetalMixin) {
- /*jshint newcap:false*/
+enifed('ember-views/compat/metamorph_view', ['exports', 'ember-metal/debug', 'ember-views/views/view', 'ember-metal/mixin'], function (exports, _emberMetalDebug, _emberViewsViewsView, _emberMetalMixin) {
'use strict';
/**
@module ember
@submodule ember-views
@@ -37075,12 +37754,11 @@
instrumentName: 'metamorph',
init: function () {
this._super.apply(this, arguments);
-
- }
+ }
});
exports._Metamorph = _Metamorph;
/**
@class _MetamorphView
@@ -37091,18 +37769,17 @@
*/
exports.default = _emberViewsViewsView.default.extend(_Metamorph, {
__metamorphType: 'Ember._MetamorphView'
});
});
-// Ember.deprecate
-enifed('ember-views/component_lookup', ['exports', 'ember-metal/core', 'ember-runtime/system/object', 'ember-htmlbars/system/lookup-helper'], function (exports, _emberMetalCore, _emberRuntimeSystemObject, _emberHtmlbarsSystemLookupHelper) {
+enifed('ember-views/component_lookup', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-runtime/system/object', 'ember-htmlbars/system/lookup-helper'], function (exports, _emberMetalCore, _emberMetalDebug, _emberRuntimeSystemObject, _emberHtmlbarsSystemLookupHelper) {
'use strict';
exports.default = _emberRuntimeSystemObject.default.extend({
invalidName: function (name) {
if (!_emberHtmlbarsSystemLookupHelper.CONTAINS_DASH_CACHE.get(name)) {
- return true;
+ return true;
}
},
lookupFactory: function (name, container) {
container = container || this.container;
@@ -37145,10 +37822,419 @@
var templateFullName = 'template:components/' + name;
return container.lookup(templateFullName);
}
});
});
+enifed('ember-views/components/component', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-runtime/mixins/target_action_support', 'ember-views/views/view', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/is_none', 'ember-metal/computed', 'ember-views/compat/attrs-proxy'], function (exports, _emberMetalCore, _emberMetalDebug, _emberRuntimeMixinsTarget_action_support, _emberViewsViewsView, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalIs_none, _emberMetalComputed, _emberViewsCompatAttrsProxy) {
+ 'use strict';
+
+ function validateAction(component, actionName) {
+ if (actionName && actionName[_emberViewsCompatAttrsProxy.MUTABLE_CELL]) {
+ actionName = actionName.value;
+ }
+
+ return actionName;
+ }
+
+ /**
+ @module ember
+ @submodule ember-views
+ */
+
+ /**
+ An `Ember.Component` is a view that is completely
+ isolated. Properties accessed in its templates go
+ to the view object and actions are targeted at
+ the view object. There is no access to the
+ surrounding context or outer controller; all
+ contextual information must be passed in.
+
+ The easiest way to create an `Ember.Component` is via
+ a template. If you name a template
+ `components/my-foo`, you will be able to use
+ `{{my-foo}}` in other templates, which will make
+ an instance of the isolated component.
+
+ ```handlebars
+ {{app-profile person=currentUser}}
+ ```
+
+ ```handlebars
+ <!-- app-profile template -->
+ <h1>{{person.title}}</h1>
+ <img src={{person.avatar}}>
+ <p class='signature'>{{person.signature}}</p>
+ ```
+
+ You can use `yield` inside a template to
+ include the **contents** of any block attached to
+ the component. The block will be executed in the
+ context of the surrounding context or outer controller:
+
+ ```handlebars
+ {{#app-profile person=currentUser}}
+ <p>Admin mode</p>
+ {{! Executed in the controller's context. }}
+ {{/app-profile}}
+ ```
+
+ ```handlebars
+ <!-- app-profile template -->
+ <h1>{{person.title}}</h1>
+ {{! Executed in the components context. }}
+ {{yield}} {{! block contents }}
+ ```
+
+ If you want to customize the component, in order to
+ handle events or actions, you implement a subclass
+ of `Ember.Component` named after the name of the
+ component. Note that `Component` needs to be appended to the name of
+ your subclass like `AppProfileComponent`.
+
+ For example, you could implement the action
+ `hello` for the `app-profile` component:
+
+ ```javascript
+ App.AppProfileComponent = Ember.Component.extend({
+ actions: {
+ hello: function(name) {
+ console.log("Hello", name);
+ }
+ }
+ });
+ ```
+
+ And then use it in the component's template:
+
+ ```handlebars
+ <!-- app-profile template -->
+
+ <h1>{{person.title}}</h1>
+ {{yield}} <!-- block contents -->
+
+ <button {{action 'hello' person.name}}>
+ Say Hello to {{person.name}}
+ </button>
+ ```
+
+ Components must have a `-` in their name to avoid
+ conflicts with built-in controls that wrap HTML
+ elements. This is consistent with the same
+ requirement in web components.
+
+ @class Component
+ @namespace Ember
+ @extends Ember.View
+ @public
+ */
+ var Component = _emberViewsViewsView.default.extend(_emberRuntimeMixinsTarget_action_support.default, {
+ isComponent: true,
+ /*
+ This is set so that the proto inspection in appendTemplatedView does not
+ think that it should set the components `context` to that of the parent view.
+ */
+ controller: null,
+ context: null,
+
+ instrumentName: 'component',
+ instrumentDisplay: _emberMetalComputed.computed(function () {
+ if (this._debugContainerKey) {
+ return '{{' + this._debugContainerKey.split(':')[1] + '}}';
+ }
+ }),
+
+ init: function () {
+ this._super.apply(this, arguments);
+ _emberMetalProperty_set.set(this, 'controller', this);
+ _emberMetalProperty_set.set(this, 'context', this);
+
+ if (!this.layout && this.layoutName && this.container) {
+ var layoutName = _emberMetalProperty_get.get(this, 'layoutName');
+
+ this.layout = this.templateForName(layoutName);
+ }
+
+ // If a `defaultLayout` was specified move it to the `layout` prop.
+ // `layout` is no longer a CP, so this just ensures that the `defaultLayout`
+ // logic is supported with a deprecation
+ if (this.defaultLayout && !this.layout) {
+
+ this.layout = this.defaultLayout;
+ }
+ },
+
+ template: null,
+ layoutName: null,
+ layout: null,
+
+ /**
+ If the component is currently inserted into the DOM of a parent view, this
+ property will point to the controller of the parent view.
+ @property targetObject
+ @type Ember.Controller
+ @default null
+ @private
+ */
+ targetObject: _emberMetalComputed.computed('controller', function (key) {
+ if (this._targetObject) {
+ return this._targetObject;
+ }
+ if (this._controller) {
+ return this._controller;
+ }
+ var parentView = _emberMetalProperty_get.get(this, 'parentView');
+ return parentView ? _emberMetalProperty_get.get(parentView, 'controller') : null;
+ }),
+
+ /**
+ Calls a action passed to a component.
+ For example a component for playing or pausing music may translate click events
+ into action notifications of "play" or "stop" depending on some internal state
+ of the component:
+ ```javascript
+ // app/components/play-button.js
+ export default Ember.Component.extend({
+ click() {
+ if (this.get('isPlaying')) {
+ this.sendAction('play');
+ } else {
+ this.sendAction('stop');
+ }
+ }
+ });
+ ```
+ The actions "play" and "stop" must be passed to this `play-button` component:
+ ```handlebars
+ {{! app/templates/application.hbs }}
+ {{play-button play=(action "musicStarted") stop=(action "musicStopped")}}
+ ```
+ When the component receives a browser `click` event it translate this
+ interaction into application-specific semantics ("play" or "stop") and
+ calls the specified action.
+ ```javascript
+ // app/controller/application.js
+ export default Ember.Controller.extend({
+ actions: {
+ musicStarted() {
+ // called when the play button is clicked
+ // and the music started playing
+ },
+ musicStopped() {
+ // called when the play button is clicked
+ // and the music stopped playing
+ }
+ }
+ });
+ ```
+ If no action is passed to `sendAction` a default name of "action"
+ is assumed.
+ ```javascript
+ // app/components/next-button.js
+ export default Ember.Component.extend({
+ click() {
+ this.sendAction();
+ }
+ });
+ ```
+ ```handlebars
+ {{! app/templates/application.hbs }}
+ {{next-button action=(action "playNextSongInAlbum")}}
+ ```
+ ```javascript
+ // app/controllers/application.js
+ App.ApplicationController = Ember.Controller.extend({
+ actions: {
+ playNextSongInAlbum() {
+ ...
+ }
+ }
+ });
+ ```
+ @method sendAction
+ @param [action] {String} the action to call
+ @param [params] {*} arguments for the action
+ @public
+ */
+ sendAction: function (action) {
+ for (var _len = arguments.length, contexts = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ contexts[_key - 1] = arguments[_key];
+ }
+
+ var actionName;
+
+ // Send the default action
+ if (action === undefined) {
+ action = 'action';
+ }
+ actionName = _emberMetalProperty_get.get(this, 'attrs.' + action) || _emberMetalProperty_get.get(this, action);
+ actionName = validateAction(this, actionName);
+
+ // If no action name for that action could be found, just abort.
+ if (actionName === undefined) {
+ return;
+ }
+
+ if (typeof actionName === 'function') {
+ actionName.apply(null, contexts);
+ } else {
+ this.triggerAction({
+ action: actionName,
+ actionContext: contexts
+ });
+ }
+ },
+
+ send: function (actionName) {
+ for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
+ args[_key2 - 1] = arguments[_key2];
+ }
+
+ var target;
+ var hasAction = this.actions && this.actions[actionName];
+
+ if (hasAction) {
+ var shouldBubble = this.actions[actionName].apply(this, args) === true;
+ if (!shouldBubble) {
+ return;
+ }
+ }
+
+ if (target = _emberMetalProperty_get.get(this, 'target')) {
+ var _target;
+
+ (_target = target).send.apply(_target, arguments);
+ } else {
+ if (!hasAction) {
+ throw new Error(_emberMetalCore.default.inspect(this) + ' had no action handler for: ' + actionName);
+ }
+ }
+ }
+
+ /**
+ Returns true when the component was invoked with a block template.
+ Example (`hasBlock` will be `false`):
+ ```hbs
+ {{! templates/application.hbs }}
+ {{foo-bar}}
+ {{! templates/components/foo-bar.hbs }}
+ {{#if hasBlock}}
+ This will not be printed, because no block was provided
+ {{/if}}
+ ```
+ Example (`hasBlock` will be `true`):
+ ```hbs
+ {{! templates/application.hbs }}
+ {{#foo-bar}}
+ Hi!
+ {{/foo-bar}}
+ {{! templates/components/foo-bar.hbs }}
+ {{#if hasBlock}}
+ This will be printed because a block was provided
+ {{yield}}
+ {{/if}}
+ ```
+ This helper accepts an argument with the name of the block we want to check the presence of.
+ This is useful for checking for the presence of the optional inverse block in components.
+ ```hbs
+ {{! templates/application.hbs }}
+ {{#foo-bar}}
+ Hi!
+ {{else}}
+ What's up?
+ {{/foo-bar}}
+ {{! templates/components/foo-bar.hbs }}
+ {{yield}}
+ {{#if (hasBlock "inverse")}}
+ {{yield to="inverse"}}
+ {{else}}
+ How are you?
+ {{/if}}
+ ```
+ @public
+ @property hasBlock
+ @param {String} [blockName="default"] The name of the block to check presence of.
+ @returns Boolean
+ */
+
+ /**
+ Returns true when the component was invoked with a block parameter
+ supplied.
+ Example (`hasBlockParams` will be `false`):
+ ```hbs
+ {{! templates/application.hbs }}
+ {{#foo-bar}}
+ No block parameter.
+ {{/foo-bar}}
+ {{! templates/components/foo-bar.hbs }}
+ {{#if hasBlockParams}}
+ This will not be printed, because no block was provided
+ {{yield this}}
+ {{/if}}
+ ```
+ Example (`hasBlockParams` will be `true`):
+ ```hbs
+ {{! templates/application.hbs }}
+ {{#foo-bar as |foo|}}
+ Hi!
+ {{/foo-bar}}
+ {{! templates/components/foo-bar.hbs }}
+ {{#if hasBlockParams}}
+ This will be printed because a block was provided
+ {{yield this}}
+ {{/if}}
+ ```
+ @public
+ @property hasBlockParams
+ @returns Boolean
+ */
+
+ /**
+ Enables components to take a list of parameters as arguments
+ For example a component that takes two parameters with the names
+ `name` and `age`:
+ ```javascript
+ let MyComponent = Ember.Component.extend;
+ MyComponent.reopenClass({
+ positionalParams: ['name', 'age']
+ });
+ ```
+ It can then be invoked like this:
+ ```hbs
+ {{my-component "John" 38}}
+ ```
+ The parameters can be refered to just like named parameters:
+ ```hbs
+ Name: {{attrs.name}}, Age: {{attrs.age}}.
+ ```
+ Using a string instead of an array allows for an arbitrary number of
+ parameters:
+ ```javascript
+ let MyComponent = Ember.Component.extend;
+ MyComponent.reopenClass({
+ positionalParams: 'names'
+ });
+ ```
+ It can then be invoked like this:
+ ```hbs
+ {{my-component "John" "Michael" "Scott"}}
+ ```
+ The parameters can then be refered to by enumerating over the list:
+ ```hbs
+ {{#each attrs.names as |name|}}{{name}}{{/each}}
+ ```
+ @static
+ @public
+ @property positionalParams
+ */
+ });
+
+ Component.reopenClass({
+ isComponentFactory: true
+ });
+
+ exports.default = Component;
+});
enifed('ember-views/mixins/aria_role_support', ['exports', 'ember-metal/mixin'], function (exports, _emberMetalMixin) {
/**
@module ember
@submodule ember-views
*/
@@ -37176,11 +38262,11 @@
@public
*/
ariaRole: null
});
});
-enifed('ember-views/mixins/class_names_support', ['exports', 'ember-metal/core', 'ember-metal/mixin', 'ember-runtime/system/native_array'], function (exports, _emberMetalCore, _emberMetalMixin, _emberRuntimeSystemNative_array) {
+enifed('ember-views/mixins/class_names_support', ['exports', 'ember-metal/debug', 'ember-metal/mixin', 'ember-runtime/system/native_array'], function (exports, _emberMetalDebug, _emberMetalMixin, _emberRuntimeSystemNative_array) {
/**
@module ember
@submodule ember-views
*/
'use strict';
@@ -37196,13 +38282,13 @@
concatenatedProperties: ['classNames', 'classNameBindings'],
init: function () {
this._super.apply(this, arguments);
- this.classNameBindings = _emberRuntimeSystemNative_array.A(this.classNameBindings.slice());
+ this.classNameBindings = _emberRuntimeSystemNative_array.A(this.classNameBindings.slice());
- this.classNames = _emberRuntimeSystemNative_array.A(this.classNames.slice());
+ this.classNames = _emberRuntimeSystemNative_array.A(this.classNames.slice());
},
/**
Standard CSS class names to apply to the view's outer element. This
property automatically inherits any class names defined by the view's
@@ -37345,11 +38431,31 @@
}
});
exports.default = InstrumentationSupport;
});
-enifed('ember-views/mixins/legacy_view_support', ['exports', 'ember-metal/core', 'ember-metal/mixin', 'ember-metal/property_get'], function (exports, _emberMetalCore, _emberMetalMixin, _emberMetalProperty_get) {
+enifed('ember-views/mixins/legacy_child_views_support', ['exports', 'ember-metal/mixin', 'ember-metal/property_get', 'ember-metal/property_set'], function (exports, _emberMetalMixin, _emberMetalProperty_get, _emberMetalProperty_set) {
+ 'use strict';
+
+ exports.default = _emberMetalMixin.Mixin.create({
+ linkChild: function (instance) {
+ instance.container = this.container;
+ if (_emberMetalProperty_get.get(instance, 'parentView') !== this) {
+ // linkChild should be idempotent
+ _emberMetalProperty_set.set(instance, 'parentView', this);
+ instance.trigger('parentViewDidChange');
+ }
+ instance.ownerView = this.ownerView;
+ },
+
+ unlinkChild: function (instance) {
+ _emberMetalProperty_set.set(instance, 'parentView', null);
+ instance.trigger('parentViewDidChange');
+ }
+ });
+});
+enifed('ember-views/mixins/legacy_view_support', ['exports', 'ember-metal/debug', 'ember-metal/mixin', 'ember-metal/property_get'], function (exports, _emberMetalDebug, _emberMetalMixin, _emberMetalProperty_get) {
/**
@module ember
@submodule ember-views
*/
'use strict';
@@ -37362,20 +38468,10 @@
var LegacyViewSupport = _emberMetalMixin.Mixin.create({
beforeRender: function (buffer) {},
afterRender: function (buffer) {},
- walkChildViews: function (callback) {
- var childViews = this.childViews.slice();
-
- while (childViews.length) {
- var view = childViews.pop();
- callback(view);
- childViews.push.apply(childViews, view.childViews);
- }
- },
-
mutateChildViews: function (callback) {
var childViews = _emberMetalProperty_get.get(this, 'childViews');
var idx = childViews.length;
var view;
@@ -37413,11 +38509,11 @@
@return Ember.View
@deprecated
@private
*/
nearestChildOf: function (klass) {
-
+
var view = _emberMetalProperty_get.get(this, 'parentView');
while (view) {
if (_emberMetalProperty_get.get(view, 'parentView') instanceof klass) {
return view;
@@ -37434,61 +38530,35 @@
@return Ember.View
@deprecated
@private
*/
nearestInstanceOf: function (klass) {
- var view = _emberMetalProperty_get.get(this, 'parentView');
+ var view = _emberMetalProperty_get.get(this, 'parentView');
+
while (view) {
if (view instanceof klass) {
return view;
}
view = _emberMetalProperty_get.get(view, 'parentView');
}
- }
+ },
+
+ /**
+ If a value that affects template rendering changes, the view should be
+ re-rendered to reflect the new value.
+ @method _contextDidChange
+ @private
+ @private
+ */
+ _contextDidChange: _emberMetalMixin.observer('context', function () {
+ this.rerender();
+ })
});
exports.default = LegacyViewSupport;
});
-enifed('ember-views/mixins/normalized_rerender_if_needed', ['exports', 'ember-metal/property_get', 'ember-metal/mixin', 'ember-metal/merge', 'ember-views/views/states'], function (exports, _emberMetalProperty_get, _emberMetalMixin, _emberMetalMerge, _emberViewsViewsStates) {
- /**
- @module ember
- @submodule ember-views
- */
-
- 'use strict';
-
- var states = _emberViewsViewsStates.cloneStates(_emberViewsViewsStates.states);
-
- _emberMetalMerge.default(states._default, {
- rerenderIfNeeded: function () {
- return this;
- }
- });
-
- _emberMetalMerge.default(states.inDOM, {
- rerenderIfNeeded: function (view) {
- if (view.normalizedValue() !== view._lastNormalizedValue) {
- view.rerender();
- }
- }
- });
-
- exports.default = _emberMetalMixin.Mixin.create({
- _states: states,
-
- normalizedValue: function () {
- var value = this.lazyValue.value();
- var valueNormalizer = _emberMetalProperty_get.get(this, 'valueNormalizerFunc');
- return valueNormalizer ? valueNormalizer(value) : value;
- },
-
- rerenderIfNeeded: function () {
- this.currentState.rerenderIfNeeded(this);
- }
- });
-});
enifed('ember-views/mixins/template_rendering_support', ['exports', 'ember-metal/mixin'], function (exports, _emberMetalMixin) {
/**
@module ember
@submodule ember-views
*/
@@ -37515,11 +38585,11 @@
@private
*/
renderBlock: function (block, renderNode) {
if (_renderView === undefined) {
- _renderView = eriuqer('ember-htmlbars/system/render-view');
+ _renderView = require('ember-htmlbars/system/render-view');
}
return _renderView.renderHTMLBarsBlock(this, block, renderNode);
}
});
@@ -37846,11 +38916,11 @@
}
}
exports.default = TextSupport;
});
-enifed('ember-views/mixins/view_child_views_support', ['exports', 'ember-metal/core', 'ember-metal/mixin', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/set_properties'], function (exports, _emberMetalCore, _emberMetalMixin, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalSet_properties) {
+enifed('ember-views/mixins/view_child_views_support', ['exports', 'ember-metal/debug', 'ember-metal/mixin', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/set_properties', 'ember-runtime/system/native_array'], function (exports, _emberMetalDebug, _emberMetalMixin, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalSet_properties, _emberRuntimeSystemNative_array) {
/**
@module ember
@submodule ember-views
*/
'use strict';
@@ -37871,11 +38941,11 @@
init: function () {
this._super.apply(this, arguments);
// setup child views. be sure to clone the child views array first
// 2.0TODO: Remove Ember.A() here
- this.childViews = _emberMetalCore.default.A(this.childViews.slice());
+ this.childViews = _emberRuntimeSystemNative_array.A(this.childViews.slice());
this.ownerView = this.ownerView || this;
},
appendChild: function (view) {
this.linkChild(view);
@@ -37953,15 +39023,14 @@
}
} else if ('string' === typeof maybeViewClass) {
var fullName = 'view:' + maybeViewClass;
var ViewKlass = this.container.lookupFactory(fullName);
-
view = ViewKlass.create(attrs);
} else {
view = maybeViewClass;
-
+
attrs.container = this.container;
_emberMetalSet_properties.default(view, attrs);
}
this.linkChild(view);
@@ -37969,21 +39038,16 @@
return view;
},
linkChild: function (instance) {
instance.container = this.container;
- if (_emberMetalProperty_get.get(instance, 'parentView') !== this) {
- // linkChild should be idempotentj
- _emberMetalProperty_set.set(instance, 'parentView', this);
- instance.trigger('parentViewDidChange');
- }
+ instance.parentView = this;
instance.ownerView = this.ownerView;
},
unlinkChild: function (instance) {
- _emberMetalProperty_set.set(instance, 'parentView', null);
- instance.trigger('parentViewDidChange');
+ instance.parentView = null;
}
});
});
enifed('ember-views/mixins/view_context_support', ['exports', 'ember-metal/mixin', 'ember-metal/computed', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-views/mixins/legacy_view_support', 'ember-metal/events'], function (exports, _emberMetalMixin, _emberMetalComputed, _emberMetalProperty_get, _emberMetalProperty_set, _emberViewsMixinsLegacy_view_support, _emberMetalEvents) {
/**
@@ -38068,11 +39132,11 @@
return value;
}
}),
_legacyControllerDidChange: _emberMetalMixin.observer('controller', function () {
- this.walkChildViews(function (view) {
+ this.childViews.forEach(function (view) {
return view.notifyPropertyChange('controller');
});
}),
_notifyControllerChange: _emberMetalEvents.on('parentViewDidChange', function () {
@@ -38080,16 +39144,16 @@
})
});
exports.default = ViewContextSupport;
});
-enifed('ember-views/mixins/view_state_support', ['exports', 'ember-metal/core', 'ember-metal/mixin'], function (exports, _emberMetalCore, _emberMetalMixin) {
+enifed('ember-views/mixins/view_state_support', ['exports', 'ember-metal/debug', 'ember-metal/mixin'], function (exports, _emberMetalDebug, _emberMetalMixin) {
'use strict';
var ViewStateSupport = _emberMetalMixin.Mixin.create({
transitionTo: function (state) {
- this._transitionTo(state);
+ this._transitionTo(state);
},
_transitionTo: function (state) {
var priorState = this._currentState;
var currentState = this._currentState = this._states[state];
@@ -38104,10 +39168,704 @@
}
});
exports.default = ViewStateSupport;
});
+enifed('ember-views/mixins/view_support', ['exports', 'ember-metal/debug', 'ember-metal/error', 'ember-metal/property_get', 'ember-metal/run_loop', 'ember-metal/observer', 'ember-metal/utils', 'ember-metal/computed', 'ember-metal/mixin', 'ember-runtime/system/core_object', 'ember-metal/features', 'ember-views/system/jquery'], function (exports, _emberMetalDebug, _emberMetalError, _emberMetalProperty_get, _emberMetalRun_loop, _emberMetalObserver, _emberMetalUtils, _emberMetalComputed, _emberMetalMixin, _emberRuntimeSystemCore_object, _emberMetalFeatures, _emberViewsSystemJquery) {
+ 'use strict';
+
+ var _Mixin$create;
+
+ var INIT_WAS_CALLED = _emberMetalUtils.symbol('INIT_WAS_CALLED');
+
+ function K() {
+ return this;
+ }
+
+ exports.default = _emberMetalMixin.Mixin.create((_Mixin$create = {
+ concatenatedProperties: ['attributeBindings'],
+
+ /**
+ @property isView
+ @type Boolean
+ @default true
+ @static
+ @private
+ */
+ isView: true,
+
+ // ..........................................................
+ // TEMPLATE SUPPORT
+ //
+
+ /**
+ The name of the template to lookup if no template is provided.
+ By default `Ember.View` will lookup a template with this name in
+ `Ember.TEMPLATES` (a shared global object).
+ @property templateName
+ @type String
+ @default null
+ @private
+ */
+ templateName: null,
+
+ /**
+ The name of the layout to lookup if no layout is provided.
+ By default `Ember.View` will lookup a template with this name in
+ `Ember.TEMPLATES` (a shared global object).
+ @property layoutName
+ @type String
+ @default null
+ @private
+ */
+ layoutName: null,
+
+ /**
+ The template used to render the view. This should be a function that
+ accepts an optional context parameter and returns a string of HTML that
+ will be inserted into the DOM relative to its parent view.
+ In general, you should set the `templateName` property instead of setting
+ the template yourself.
+ @property template
+ @type Function
+ @private
+ */
+ template: _emberMetalComputed.computed({
+ get: function () {
+ var templateName = _emberMetalProperty_get.get(this, 'templateName');
+ var template = this.templateForName(templateName, 'template');
+
+ return template || _emberMetalProperty_get.get(this, 'defaultTemplate');
+ },
+ set: function (key, value) {
+ if (value !== undefined) {
+ return value;
+ }
+ return _emberMetalProperty_get.get(this, key);
+ }
+ }),
+
+ /**
+ A view may contain a layout. A layout is a regular template but
+ supersedes the `template` property during rendering. It is the
+ responsibility of the layout template to retrieve the `template`
+ property from the view (or alternatively, call `Handlebars.helpers.yield`,
+ `{{yield}}`) to render it in the correct location.
+ This is useful for a view that has a shared wrapper, but which delegates
+ the rendering of the contents of the wrapper to the `template` property
+ on a subclass.
+ @property layout
+ @type Function
+ @private
+ */
+ layout: _emberMetalComputed.computed({
+ get: function (key) {
+ var layoutName = _emberMetalProperty_get.get(this, 'layoutName');
+ var layout = this.templateForName(layoutName, 'layout');
+
+ return layout || _emberMetalProperty_get.get(this, 'defaultLayout');
+ },
+
+ set: function (key, value) {
+ return value;
+ }
+ }),
+
+ templateForName: function (name, type) {
+ if (!name) {
+ return;
+ }
+
+ if (!this.container) {
+ throw new _emberMetalError.default('Container was not found when looking up a views template. ' + 'This is most likely due to manually instantiating an Ember.View. ' + 'See: http://git.io/EKPpnA');
+ }
+
+ return this.container.lookup('template:' + name);
+ },
+
+ /**
+ Return the nearest ancestor that is an instance of the provided
+ 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
+ */
+ nearestOfType: function (klass) {
+ var view = _emberMetalProperty_get.get(this, 'parentView');
+ var isOfType = klass instanceof _emberMetalMixin.Mixin ? function (view) {
+ return klass.detect(view);
+ } : function (view) {
+ return klass.detect(view.constructor);
+ };
+
+ while (view) {
+ if (isOfType(view)) {
+ return view;
+ }
+ view = _emberMetalProperty_get.get(view, 'parentView');
+ }
+ },
+
+ /**
+ Return the nearest ancestor that has a given property.
+ @method nearestWithProperty
+ @param {String} property A property name
+ @return Ember.View
+ @private
+ */
+ nearestWithProperty: function (property) {
+ var view = _emberMetalProperty_get.get(this, 'parentView');
+
+ while (view) {
+ if (property in view) {
+ return view;
+ }
+ view = _emberMetalProperty_get.get(view, 'parentView');
+ }
+ },
+
+ /**
+ Renders the view again. This will work regardless of whether the
+ view is already in the DOM or not. If the view is in the DOM, the
+ rendering process will be deferred to give bindings a chance
+ to synchronize.
+ If children were added during the rendering process using `appendChild`,
+ `rerender` will remove them, because they will be added again
+ if needed by the next `render`.
+ In general, if the display of your view changes, you should modify
+ the DOM element directly instead of manually calling `rerender`, which can
+ be slow.
+ @method rerender
+ @public
+ */
+ rerender: function () {
+ return this._currentState.rerender(this);
+ },
+
+ // ..........................................................
+ // ELEMENT SUPPORT
+ //
+
+ /**
+ Returns the current DOM element for the view.
+ @property element
+ @type DOMElement
+ @public
+ */
+ element: null,
+
+ /**
+ Returns a jQuery object for this view's element. If you pass in a selector
+ string, this method will return a jQuery object, using the current element
+ as its buffer.
+ For example, calling `view.$('li')` will return a jQuery object containing
+ all of the `li` elements inside the DOM element of this view.
+ @method $
+ @param {String} [selector] a jQuery-compatible selector string
+ @return {jQuery} the jQuery object for the DOM node
+ @public
+ */
+ $: function (sel) {
+ return this._currentState.$(this, sel);
+ },
+
+ forEachChildView: function (callback) {
+ var childViews = this.childViews;
+
+ if (!childViews) {
+ return this;
+ }
+
+ var len = childViews.length;
+ var view, idx;
+
+ for (idx = 0; idx < len; idx++) {
+ view = childViews[idx];
+ callback(view);
+ }
+
+ return this;
+ },
+
+ /**
+ Appends the view's element to the specified parent element.
+ If the view does not have an HTML representation yet, `createElement()`
+ will be called automatically.
+ Note that this method just schedules the view to be appended; the DOM
+ element will not be appended to the given element until all bindings have
+ finished synchronizing.
+ This is not typically a function that you will need to call directly when
+ building your application. You might consider using `Ember.ContainerView`
+ instead. If you do need to use `appendTo`, be sure that the target element
+ you are providing is associated with an `Ember.Application` and does not
+ have an ancestor element that is associated with an Ember view.
+ @method appendTo
+ @param {String|DOMElement|jQuery} A selector, element, HTML string, or jQuery object
+ @return {Ember.View} receiver
+ @private
+ */
+ appendTo: function (selector) {
+ var target = _emberViewsSystemJquery.default(selector);
+
+ this.renderer.appendTo(this, target[0]);
+
+ return this;
+ },
+
+ /**
+ @private
+ Creates a new DOM element, renders the view into it, then returns the
+ element.
+ By default, the element created and rendered into will be a `BODY` element,
+ since this is the default context that views are rendered into when being
+ inserted directly into the DOM.
+ ```js
+ var element = view.renderToElement();
+ element.tagName; // => "BODY"
+ ```
+ You can override the kind of element rendered into and returned by
+ specifying an optional tag name as the first argument.
+ ```js
+ var element = view.renderToElement('table');
+ element.tagName; // => "TABLE"
+ ```
+ This method is useful if you want to render the view into an element that
+ is not in the document's body. Instead, a new `body` element, detached from
+ the DOM is returned. FastBoot uses this to serialize the rendered view into
+ a string for transmission over the network.
+ ```js
+ app.visit('/').then(function(instance) {
+ var element;
+ Ember.run(function() {
+ element = renderToElement(instance);
+ });
+ res.send(serialize(element));
+ });
+ ```
+ @method renderToElement
+ @param {String} tagName The tag of the element to create and render into. Defaults to "body".
+ @return {HTMLBodyElement} element
+ @private
+ */
+ renderToElement: function (tagName) {
+ tagName = tagName || 'body';
+
+ var element = this.renderer._dom.createElement(tagName);
+
+ this.renderer.appendTo(this, element);
+ return element;
+ },
+
+ /**
+ Replaces the content of the specified parent element with this view's
+ element. If the view does not have an HTML representation yet,
+ the element will be generated automatically.
+ Note that this method just schedules the view to be appended; the DOM
+ element will not be appended to the given element until all bindings have
+ finished synchronizing
+ @method replaceIn
+ @param {String|DOMElement|jQuery} target A selector, element, HTML string, or jQuery object
+ @return {Ember.View} received
+ @private
+ */
+ replaceIn: function (selector) {
+ var target = _emberViewsSystemJquery.default(selector);
+
+ this.renderer.replaceIn(this, target[0]);
+
+ return this;
+ },
+
+ /**
+ Appends the view's element to the document body. If the view does
+ not have an HTML representation yet
+ the element will be generated automatically.
+ If your application uses the `rootElement` property, you must append
+ the view within that element. Rendering views outside of the `rootElement`
+ is not supported.
+ Note that this method just schedules the view to be appended; the DOM
+ element will not be appended to the document body until all bindings have
+ finished synchronizing.
+ @method append
+ @return {Ember.View} receiver
+ @private
+ */
+ append: function () {
+ return this.appendTo(document.body);
+ },
+
+ /**
+ Removes the view's element from the element to which it is attached.
+ @method remove
+ @return {Ember.View} receiver
+ @private
+ */
+ remove: function () {
+ // What we should really do here is wait until the end of the run loop
+ // to determine if the element has been re-appended to a different
+ // element.
+ // In the interim, we will just re-render if that happens. It is more
+ // important than elements get garbage collected.
+ if (!this.removedFromDOM) {
+ this.destroyElement();
+ }
+
+ // Set flag to avoid future renders
+ this._willInsert = false;
+ },
+
+ /**
+ The HTML `id` of the view's element in the DOM. You can provide this
+ value yourself but it must be unique (just as in HTML):
+ ```handlebars
+ {{my-component elementId="a-really-cool-id"}}
+ ```
+ If not manually set a default value will be provided by the framework.
+ Once rendered an element's `elementId` is considered immutable and you
+ should never change it. If you need to compute a dynamic value for the
+ `elementId`, you should do this when the component or element is being
+ instantiated:
+ ```javascript
+ export default Ember.Component.extend({
+ setElementId: Ember.on('init', function() {
+ var index = this.get('index');
+ this.set('elementId', 'component-id' + index);
+ })
+ });
+ ```
+ @property elementId
+ @type String
+ @public
+ */
+ elementId: null,
+
+ /**
+ Attempts to discover the element in the parent element. The default
+ implementation looks for an element with an ID of `elementId` (or the
+ view's guid if `elementId` is null). You can override this method to
+ provide your own form of lookup. For example, if you want to discover your
+ element using a CSS class name instead of an ID.
+ @method findElementInParentElement
+ @param {DOMElement} parentElement The parent's DOM element
+ @return {DOMElement} The discovered element
+ @private
+ */
+ findElementInParentElement: function (parentElem) {
+ var id = '#' + this.elementId;
+ return _emberViewsSystemJquery.default(id)[0] || _emberViewsSystemJquery.default(id, parentElem)[0];
+ },
+
+ /**
+ Creates a DOM representation of the view and all of its child views by
+ recursively calling the `render()` method. Once the element is created,
+ it sets the `element` property of the view to the rendered element.
+ After the element has been inserted into the DOM, `didInsertElement` will
+ be called on this view and all of its child views.
+ @method createElement
+ @return {Ember.View} receiver
+ @private
+ */
+ createElement: function () {
+ if (this.element) {
+ return this;
+ }
+
+ this.renderer.createElement(this);
+
+ return this;
+ },
+
+ /**
+ Called when a view is going to insert an element into the DOM.
+ @event willInsertElement
+ @public
+ */
+ willInsertElement: K,
+
+ /**
+ Called when the element of the view has been inserted into the DOM
+ or after the view was re-rendered. Override this function to do any
+ set up that requires an element in the document body.
+ When a view has children, didInsertElement will be called on the
+ child view(s) first, bubbling upwards through the hierarchy.
+ @event didInsertElement
+ @public
+ */
+ didInsertElement: K,
+
+ /**
+ Called when the view is about to rerender, but before anything has
+ been torn down. This is a good opportunity to tear down any manual
+ observers you have installed based on the DOM state
+ @event willClearRender
+ @public
+ */
+ willClearRender: K,
+
+ /**
+ Destroys any existing element along with the element for any child views
+ as well. If the view does not currently have a element, then this method
+ will do nothing.
+ If you implement `willDestroyElement()` on your view, then this method will
+ be invoked on your view before your element is destroyed to give you a
+ chance to clean up any event handlers, etc.
+ If you write a `willDestroyElement()` handler, you can assume that your
+ `didInsertElement()` handler was called earlier for the same element.
+ You should not call or override this method yourself, but you may
+ want to implement the above callbacks.
+ @method destroyElement
+ @return {Ember.View} receiver
+ @private
+ */
+ destroyElement: function () {
+ return this._currentState.destroyElement(this);
+ },
+
+ /**
+ Called when the element of the view is going to be destroyed. Override
+ this function to do any teardown that requires an element, like removing
+ event listeners.
+ Please note: any property changes made during this event will have no
+ effect on object observers.
+ @event willDestroyElement
+ @public
+ */
+ willDestroyElement: K,
+
+ /**
+ Called when the parentView property has changed.
+ @event parentViewDidChange
+ @private
+ */
+ parentViewDidChange: K,
+
+ // ..........................................................
+ // STANDARD RENDER PROPERTIES
+ //
+
+ /**
+ Tag name for the view's outer element. The tag name is only used when an
+ element is first created. If you change the `tagName` for an element, you
+ must destroy and recreate the view element.
+ By default, the render buffer will use a `<div>` tag for views.
+ @property tagName
+ @type String
+ @default null
+ @public
+ */
+
+ // We leave this null by default so we can tell the difference between
+ // the default case and a user-specified tag.
+ tagName: null,
+
+ /*
+ Used to specify a default tagName that can be overridden when extending
+ or invoking from a template.
+ @property _defaultTagName
+ @private
+ */
+
+ /**
+ Normally, Ember's component model is "write-only". The component takes a
+ bunch of attributes that it got passed in, and uses them to render its
+ template.
+ One nice thing about this model is that if you try to set a value to the
+ same thing as last time, Ember (through HTMLBars) will avoid doing any
+ work on the DOM.
+ This is not just a performance optimization. If an attribute has not
+ changed, it is important not to clobber the element's "hidden state".
+ For example, if you set an input's `value` to the same value as before,
+ it will clobber selection state and cursor position. In other words,
+ setting an attribute is not **always** idempotent.
+ This method provides a way to read an element's attribute and also
+ update the last value Ember knows about at the same time. This makes
+ setting an attribute idempotent.
+ In particular, what this means is that if you get an `<input>` element's
+ `value` attribute and then re-render the template with the same value,
+ it will avoid clobbering the cursor and selection position.
+ Since most attribute sets are idempotent in the browser, you typically
+ can get away with reading attributes using jQuery, but the most reliable
+ way to do so is through this method.
+ @method readDOMAttr
+ @param {String} name the name of the attribute
+ @return String
+ @public
+ */
+ readDOMAttr: function (name) {
+ var attr = this._renderNode.childNodes.filter(function (node) {
+ return node.attrName === name;
+ })[0];
+ if (!attr) {
+ return null;
+ }
+ return attr.getContent();
+ },
+
+ // .......................................................
+ // CORE DISPLAY METHODS
+ //
+
+ /**
+ Setup a view, but do not finish waking it up.
+ * configure `childViews`
+ * register the view with the global views hash, which is used for event
+ dispatch
+ @method init
+ @private
+ */
+ init: function () {
+ this._super.apply(this, arguments);
+
+ if (!this.elementId) {
+ this.elementId = _emberMetalUtils.guidFor(this);
+ }
+
+ this.scheduledRevalidation = false;
+
+ this[INIT_WAS_CALLED] = true;
+ }
+
+ }, _Mixin$create[_emberRuntimeSystemCore_object.POST_INIT] = function () {
+ this._super.apply(this, arguments);
+
+ this.renderer.componentInitAttrs(this, this.attrs || {});
+ }, _Mixin$create.__defineNonEnumerable = function (property) {
+ this[property.name] = property.descriptor.value;
+ }, _Mixin$create.revalidate = function () {
+ this.renderer.revalidateTopLevelView(this);
+ this.scheduledRevalidation = false;
+ }, _Mixin$create.scheduleRevalidate = function (node, label, manualRerender) {
+ if (node && !this._dispatching && this.env.renderedNodes.has(node)) {
+ if (manualRerender) {} else {}
+ _emberMetalRun_loop.default.scheduleOnce('render', this, this.revalidate);
+ return;
+ }
+
+ if (!this.scheduledRevalidation || this._dispatching) {
+ this.scheduledRevalidation = true;
+ _emberMetalRun_loop.default.scheduleOnce('render', this, this.revalidate);
+ }
+ }, _Mixin$create.templateRenderer = null, _Mixin$create.removeFromParent = function () {
+ var parent = this.parentView;
+
+ // Remove DOM element from parent
+ this.remove();
+
+ if (parent) {
+ parent.removeChild(this);
+ }
+ return this;
+ }, _Mixin$create.destroy = function () {
+ // get parentView before calling super because it'll be destroyed
+ var parentView = this.parentView;
+ var viewName = this.viewName;
+
+ if (!this._super.apply(this, arguments)) {
+ return;
+ }
+
+ // remove from non-virtual parent view if viewName was specified
+ if (viewName && parentView) {
+ parentView.set(viewName, null);
+ }
+
+ // Destroy HTMLbars template
+ if (this.lastResult) {
+ this.lastResult.destroy();
+ }
+
+ return this;
+ }, _Mixin$create.handleEvent = function (eventName, evt) {
+ return this._currentState.handleEvent(this, eventName, evt);
+ }, _Mixin$create._register = function () {
+ this._viewRegistry[this.elementId] = this;
+ }, _Mixin$create._unregister = function () {
+ delete this._viewRegistry[this.elementId];
+ }, _Mixin$create.registerObserver = function (root, path, target, observer) {
+ if (!observer && 'function' === typeof target) {
+ observer = target;
+ target = null;
+ }
+
+ if (!root || typeof root !== 'object') {
+ return;
+ }
+
+ var scheduledObserver = this._wrapAsScheduled(observer);
+
+ _emberMetalObserver.addObserver(root, path, target, scheduledObserver);
+
+ this.one('willClearRender', function () {
+ _emberMetalObserver.removeObserver(root, path, target, scheduledObserver);
+ });
+ }, _Mixin$create._wrapAsScheduled = function (fn) {
+ var view = this;
+ var stateCheckedFn = function () {
+ view._currentState.invokeObserver(this, fn);
+ };
+ var scheduledFn = function () {
+ _emberMetalRun_loop.default.scheduleOnce('render', this, stateCheckedFn);
+ };
+ return scheduledFn;
+ }, _Mixin$create));
+});
+/*
+ This is a special hook implemented in CoreObject, that allows Views/Components
+ to have a way to ensure that `init` fires before `didInitAttrs` / `didReceiveAttrs`
+ (so that `this._super` in init does not trigger `didReceiveAttrs` before the classes
+ own `init` is finished).
+ @method __postInitInitialization
+ @private
+ */
+
+/**
+ Removes the view from its `parentView`, if one is found. Otherwise
+ does nothing.
+ @method removeFromParent
+ @return {Ember.View} receiver
+ @private
+*/
+
+/**
+ You must call `destroy` on a view to destroy the view (and all of its
+ child views). This will remove the view from any parent node, then make
+ sure that the DOM element managed by the view can be released by the
+ memory manager.
+ @method destroy
+ @private
+*/
+
+// .......................................................
+// EVENT HANDLING
+//
+
+/**
+ Handle events from `Ember.EventDispatcher`
+ @method handleEvent
+ @param eventName {String}
+ @param evt {Event}
+ @private
+*/
+
+/**
+ Registers the view in the view registry, keyed on the view's `elementId`.
+ This is used by the EventDispatcher to locate the view in response to
+ events.
+ This method should only be called once the view has been inserted into the
+ DOM.
+ @method _register
+ @private
+*/
+
+/**
+ Removes the view from the view registry. This should be called when the
+ view is removed from DOM.
+ @method _unregister
+ @private
+*/
enifed('ember-views/mixins/view_target_action_support', ['exports', 'ember-metal/mixin', 'ember-runtime/mixins/target_action_support', 'ember-metal/alias'], function (exports, _emberMetalMixin, _emberRuntimeMixinsTarget_action_support, _emberMetalAlias) {
'use strict';
/**
`Ember.ViewTargetActionSupport` is a mixin that can be included in a
@@ -38273,11 +40031,11 @@
}
});
exports.default = VisibilitySupport;
});
-enifed('ember-views/streams/class_name_binding', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/utils', 'ember-metal/streams/utils', 'ember-runtime/system/string'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalUtils, _emberMetalStreamsUtils, _emberRuntimeSystemString) {
+enifed('ember-views/streams/class_name_binding', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/utils', 'ember-metal/streams/utils', 'ember-runtime/system/string'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberMetalUtils, _emberMetalStreamsUtils, _emberRuntimeSystemString) {
'use strict';
exports.parsePropertyPath = parsePropertyPath;
exports.classStringForValue = classStringForValue;
exports.streamifyClassNameBinding = streamifyClassNameBinding;
@@ -38391,67 +40149,41 @@
}
}
function streamifyClassNameBinding(view, classNameBinding, prefix) {
prefix = prefix || '';
- var parsedPath = parsePropertyPath(classNameBinding);
+
+ var parsedPath = parsePropertyPath(classNameBinding);
if (parsedPath.path === '') {
return classStringForValue(parsedPath.path, true, parsedPath.className, parsedPath.falsyClassName);
} else {
var pathValue = view.getStream(prefix + parsedPath.path);
return _emberMetalStreamsUtils.chain(pathValue, function () {
return classStringForValue(parsedPath.path, _emberMetalStreamsUtils.read(pathValue), parsedPath.className, parsedPath.falsyClassName);
});
}
}
});
-enifed('ember-views/streams/should_display', ['exports', 'ember-metal/core', 'ember-metal/merge', 'ember-metal/property_get', 'ember-runtime/utils', 'ember-metal/streams/stream', 'ember-metal/streams/utils'], function (exports, _emberMetalCore, _emberMetalMerge, _emberMetalProperty_get, _emberRuntimeUtils, _emberMetalStreamsStream, _emberMetalStreamsUtils) {
+enifed('ember-views/streams/should_display', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-runtime/utils', 'ember-metal/streams/stream', 'ember-metal/streams/utils'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberRuntimeUtils, _emberMetalStreamsStream, _emberMetalStreamsUtils) {
'use strict';
exports.default = shouldDisplay;
- function shouldDisplay(predicate) {
- if (_emberMetalStreamsUtils.isStream(predicate)) {
- return new ShouldDisplayStream(predicate);
- }
+ var ShouldDisplayStream = _emberMetalStreamsStream.default.extend({
+ init: function (predicate) {
- var type = typeof predicate;
+ var isTruthy = predicate.get('isTruthy');
- if (type === 'boolean') {
- return predicate;
- }
+ this.init();
+ this.predicate = predicate;
+ this.isTruthy = isTruthy;
+ this.lengthDep = null;
- if (type && type === 'object' && predicate !== null) {
- var isTruthy = _emberMetalProperty_get.get(predicate, 'isTruthy');
- if (typeof isTruthy === 'boolean') {
- return isTruthy;
- }
- }
+ this.addDependency(predicate);
+ this.addDependency(isTruthy);
+ },
- if (_emberRuntimeUtils.isArray(predicate)) {
- return _emberMetalProperty_get.get(predicate, 'length') !== 0;
- } else {
- return !!predicate;
- }
- }
-
- function ShouldDisplayStream(predicate) {
-
- var isTruthy = predicate.get('isTruthy');
-
- this.init();
- this.predicate = predicate;
- this.isTruthy = isTruthy;
- this.lengthDep = null;
-
- this.addDependency(predicate);
- this.addDependency(isTruthy);
- }
-
- ShouldDisplayStream.prototype = Object.create(_emberMetalStreamsStream.default.prototype);
-
- _emberMetalMerge.default(ShouldDisplayStream.prototype, {
compute: function () {
var truthy = _emberMetalStreamsUtils.read(this.isTruthy);
if (typeof truthy === 'boolean') {
return truthy;
@@ -38475,12 +40207,37 @@
this.lengthDep = null;
}
}
}
});
+
+ function shouldDisplay(predicate) {
+ if (_emberMetalStreamsUtils.isStream(predicate)) {
+ return new ShouldDisplayStream(predicate);
+ }
+
+ var type = typeof predicate;
+
+ if (type === 'boolean') {
+ return predicate;
+ }
+
+ if (type && type === 'object' && predicate !== null) {
+ var isTruthy = _emberMetalProperty_get.get(predicate, 'isTruthy');
+ if (typeof isTruthy === 'boolean') {
+ return isTruthy;
+ }
+ }
+
+ if (_emberRuntimeUtils.isArray(predicate)) {
+ return _emberMetalProperty_get.get(predicate, 'length') !== 0;
+ } else {
+ return !!predicate;
+ }
+ }
});
-enifed('ember-views/streams/utils', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-metal/streams/utils', 'ember-runtime/mixins/controller'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberMetalStreamsUtils, _emberRuntimeMixinsController) {
+enifed('ember-views/streams/utils', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/streams/utils', 'ember-runtime/mixins/controller'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberMetalStreamsUtils, _emberRuntimeMixinsController) {
'use strict';
exports.readViewFactory = readViewFactory;
exports.readComponentFactory = readComponentFactory;
exports.readUnwrappedModel = readUnwrappedModel;
@@ -38488,23 +40245,22 @@
function readViewFactory(object, container) {
var value = _emberMetalStreamsUtils.read(object);
var viewClass;
if (typeof value === 'string') {
- viewClass = container.lookupFactory('view:' + value);
+ viewClass = container.lookupFactory('view:' + value);
} else {
viewClass = value;
}
-
return viewClass;
}
function readComponentFactory(nameOrStream, container) {
var name = _emberMetalStreamsUtils.read(nameOrStream);
var componentLookup = container.lookup('component-lookup:main');
-
+
return componentLookup.lookupFactory(name, container);
}
function readUnwrappedModel(object) {
if (_emberMetalStreamsUtils.isStream(object)) {
@@ -38542,42 +40298,41 @@
*/
ActionManager.registeredActions = {};
exports.default = ActionManager;
});
-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) {
+enifed('ember-views/system/build-component-template', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/assign', 'htmlbars-runtime', 'ember-htmlbars/hooks/get-value', 'ember-metal/streams/utils'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberMetalAssign, _htmlbarsRuntime, _emberHtmlbarsHooksGetValue, _emberMetalStreamsUtils) {
'use strict';
exports.default = buildComponentTemplate;
+ exports.buildHTMLTemplate = buildHTMLTemplate;
function buildComponentTemplate(_ref, attrs, content) {
var component = _ref.component;
+ var tagName = _ref.tagName;
var layout = _ref.layout;
var isAngleBracket = _ref.isAngleBracket;
var isComponentElement = _ref.isComponentElement;
var outerAttrs = _ref.outerAttrs;
- var blockToRender, tagName, meta;
+ var blockToRender, 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, _attributes);
+ blockToRender = createLayoutBlock(layout.raw, yieldTo, content.self, component, attrs);
meta = layout.raw.meta;
} else if (content.templates && content.templates.default) {
- var _attributes2 = component && component._isAngleBracket ? normalizeComponentAttributes(component, true, attrs) : undefined;
- blockToRender = createContentBlock(content.templates.default, content.scope, content.self, component, _attributes2);
+ blockToRender = createContentBlock(content.templates.default, content.scope, content.self, component);
meta = content.templates.default.meta;
}
if (component && !component._isAngleBracket || isComponentElement) {
- tagName = tagNameFor(component);
+ tagName = 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 !== '') {
@@ -38599,10 +40354,34 @@
// * the falsy value "" if set explicitly on the component
// * an actual tagName set explicitly on the component
return { createdElement: !!tagName, block: blockToRender };
}
+ function buildHTMLTemplate(tagName, _attrs, content) {
+ var attrs = {};
+
+ for (var prop in _attrs) {
+ var val = _attrs[prop];
+
+ if (typeof val === 'string') {
+ attrs[prop] = val;
+ } else {
+ attrs[prop] = ['value', val];
+ }
+ }
+
+ var childTemplate = content.templates.default;
+ var elementTemplate = _htmlbarsRuntime.internal.manualElement(tagName, attrs, childTemplate.isEmpty);
+
+ if (childTemplate.isEmpty) {
+ return blockFor(elementTemplate, { scope: content.scope });
+ } else {
+ var blockToRender = blockFor(content.templates.default, content);
+ return blockFor(elementTemplate, { yieldTo: blockToRender, scope: content.scope });
+ }
+ }
+
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]], []];
@@ -38610,19 +40389,18 @@
return result;
}
function blockFor(template, options) {
- return _htmlbarsRuntime.internal.blockFor(_htmlbarsRuntime.render, template, options);
+ return _htmlbarsRuntime.internal.blockFor(_htmlbarsRuntime.render, template, options);
}
- function createContentBlock(template, scope, self, component, attributes) {
-
+ function createContentBlock(template, scope, self, component) {
+
return blockFor(template, {
scope: scope,
self: self,
- attributes: attributes,
options: { view: component }
});
}
function createContentBlocks(templates, scope, self, component) {
@@ -38639,14 +40417,13 @@
}
}
return output;
}
- function createLayoutBlock(template, yieldTo, self, component, attrs, attributes) {
+ function createLayoutBlock(template, yieldTo, self, component, attrs) {
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.
@@ -38667,11 +40444,11 @@
function tagNameFor(view) {
var tagName = view.tagName;
if (tagName !== null && typeof tagName === 'object' && tagName.isDescriptor) {
tagName = _emberMetalProperty_get.get(view, 'tagName');
- }
+ }
if (tagName === null || tagName === undefined) {
tagName = view._defaultTagName || 'div';
}
@@ -38681,10 +40458,11 @@
// Takes a component and builds a normalized set of attribute
// bindings consumable by HTMLBars' `attribute` hook.
function normalizeComponentAttributes(component, isAngleBracket, attrs) {
var normalized = {};
var attributeBindings = component.attributeBindings;
+ var streamBasePath = component.isComponent ? '' : 'view.';
var i, l;
if (attrs.id && _emberHtmlbarsHooksGetValue.default(attrs.id)) {
// Do not allow binding to the `id`
normalized.id = _emberHtmlbarsHooksGetValue.default(attrs.id);
@@ -38700,24 +40478,23 @@
var attrName, expression;
if (colonIndex !== -1) {
var attrProperty = attr.substring(0, colonIndex);
attrName = attr.substring(colonIndex + 1);
- expression = ['get', 'view.' + attrProperty];
+ expression = ['get', '' + streamBasePath + attrProperty];
} else if (attrs[attr]) {
// TODO: For compatibility with 1.x, we probably need to `set`
// the component's attribute here if it is a CP, but we also
// probably want to suspend observers and allow the
// willUpdateAttrs logic to trigger observers at the correct time.
attrName = attr;
expression = ['value', attrs[attr]];
} else {
attrName = attr;
- expression = ['get', 'view.' + attr];
+ expression = ['get', '' + streamBasePath + attr];
}
-
normalized[attrName] = expression;
}
}
if (isAngleBracket) {
@@ -38735,11 +40512,11 @@
if (attrs.tagName) {
component.tagName = attrs.tagName;
}
- var normalizedClass = normalizeClass(component, attrs);
+ var normalizedClass = normalizeClass(component, attrs, streamBasePath);
if (normalizedClass) {
normalized.class = normalizedClass;
}
@@ -38755,11 +40532,11 @@
}
return normalized;
}
- function normalizeClass(component, attrs) {
+ function normalizeClass(component, attrs, streamBasePath) {
var i, l;
var normalizedClass = [];
var classNames = _emberMetalProperty_get.get(component, 'classNames');
var classNameBindings = _emberMetalProperty_get.get(component, 'classNameBindings');
@@ -38770,34 +40547,34 @@
normalizedClass.push(attrs.class);
}
}
if (attrs.classBinding) {
- normalizeClasses(attrs.classBinding.split(' '), normalizedClass);
+ normalizeClasses(attrs.classBinding.split(' '), normalizedClass, streamBasePath);
}
if (classNames) {
for (i = 0, l = classNames.length; i < l; i++) {
normalizedClass.push(classNames[i]);
}
}
if (classNameBindings) {
- normalizeClasses(classNameBindings, normalizedClass);
+ normalizeClasses(classNameBindings, normalizedClass, streamBasePath);
}
if (normalizeClass.length) {
return ['subexpr', '-join-classes', normalizedClass, []];
}
}
- function normalizeClasses(classes, output) {
+ function normalizeClasses(classes, output, streamBasePath) {
var i, l;
for (i = 0, l = classes.length; i < l; i++) {
var className = classes[i];
-
+
var _className$split = className.split(':');
var propName = _className$split[0];
var activeClass = _className$split[1];
var inactiveClass = _className$split[2];
@@ -38806,31 +40583,33 @@
if (propName === '') {
output.push(activeClass);
continue;
}
- // 2.0TODO: Remove deprecated global path
- var prop = _emberMetalPath_cache.isGlobal(propName) ? propName : 'view.' + propName;
+ var prop = '' + streamBasePath + propName;
output.push(['subexpr', '-normalize-class', [
// params
['value', propName], ['get', prop]], [
// hash
'activeClass', activeClass, 'inactiveClass', inactiveClass]]);
}
}
- function validateTaglessComponent(component) {
- }
+ function validateTaglessComponent(component) {}
});
-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) {
+enifed('ember-views/system/event_dispatcher', ['exports', 'ember-metal/debug', '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, _emberMetalDebug, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalIs_none, _emberMetalRun_loop, _emberRuntimeSystemObject, _emberViewsSystemJquery, _emberViewsSystemAction_manager, _emberViewsViewsView, _emberMetalAssign) {
/**
@module ember
@submodule ember-views
*/
+
'use strict';
+ var ROOT_ELEMENT_CLASS = 'ember-application';
+ var ROOT_ELEMENT_SELECTOR = '.' + ROOT_ELEMENT_CLASS;
+
/**
`Ember.EventDispatcher` handles delegating browser events to their
corresponding `Ember.Views.` For example, when you click on a view,
`Ember.EventDispatcher` ensures that that view's `mouseDown` method gets
called.
@@ -38955,14 +40734,12 @@
_emberMetalProperty_set.set(this, 'rootElement', rootElement);
}
rootElement = _emberViewsSystemJquery.default(_emberMetalProperty_get.get(this, 'rootElement'));
-
- rootElement.addClass('ember-application');
+ rootElement.addClass(ROOT_ELEMENT_CLASS);
-
for (event in events) {
if (events.hasOwnProperty(event)) {
this.setupHandler(rootElement, event, events[event]);
}
}
@@ -39058,20 +40835,19 @@
return view.handleEvent(eventName, evt);
},
destroy: function () {
var rootElement = _emberMetalProperty_get.get(this, 'rootElement');
- _emberViewsSystemJquery.default(rootElement).off('.ember', '**').removeClass('ember-application');
+ _emberViewsSystemJquery.default(rootElement).off('.ember', '**').removeClass(ROOT_ELEMENT_CLASS);
return this._super.apply(this, arguments);
},
toString: function () {
return '(EventDispatcher)';
}
});
});
-// Ember.assert
enifed('ember-views/system/ext', ['exports', 'ember-metal/run_loop'], function (exports, _emberMetalRun_loop) {
/**
@module ember
@submodule ember-views
*/
@@ -39082,23 +40858,22 @@
// after bindings have synced, and a queue for scheduling actions
// that that should occur after view rendering.
_emberMetalRun_loop.default._addQueue('render', 'actions');
_emberMetalRun_loop.default._addQueue('afterRender', 'render');
});
-enifed('ember-views/system/jquery', ['exports', 'ember-metal/core', 'ember-metal/environment'], function (exports, _emberMetalCore, _emberMetalEnvironment) {
+enifed('ember-views/system/jquery', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/environment'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalEnvironment) {
'use strict';
var jQuery;
if (_emberMetalEnvironment.default.hasDOM) {
// mainContext is set in `package/loader/lib/main.js` to the `this` context before entering strict mode
jQuery = _emberMetalCore.default.imports && _emberMetalCore.default.imports.jQuery || mainContext && mainContext.jQuery; //jshint ignore:line
- if (!jQuery && typeof eriuqer === 'function') {
- jQuery = eriuqer('jquery');
+ if (!jQuery && typeof require === 'function') {
+ jQuery = require('jquery');
}
-
if (jQuery) {
// http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dndevents
var dragEvents = ['dragstart', 'drag', 'dragenter', 'dragleave', 'dragover', 'drop', 'dragend'];
// Copies the `dataTransfer` property from a browser event object onto the
@@ -39111,14 +40886,13 @@
}
}
exports.default = jQuery;
});
-// Ember.assert
// ES6TODO: the functions on EnumerableUtils need their own exports
-enifed('ember-views/system/lookup_partial', ['exports', 'ember-metal/core', 'ember-metal/error'], function (exports, _emberMetalCore, _emberMetalError) {
+enifed('ember-views/system/lookup_partial', ['exports', 'ember-metal/debug', 'ember-metal/error'], function (exports, _emberMetalDebug, _emberMetalError) {
'use strict';
exports.default = lookupPartial;
function lookupPartial(env, templateName) {
@@ -39132,27 +40906,25 @@
nameParts[nameParts.length - 1] = '_' + lastPart;
var underscoredName = nameParts.join('/');
var template = templateFor(env, underscoredName, templateName);
-
return template;
}
function templateFor(env, underscored, name) {
if (!name) {
return;
}
-
+
if (!env.container) {
throw new _emberMetalError.default('Container was not found when looking up a views template. ' + 'This is most likely due to manually instantiating an Ember.View. ' + 'See: http://git.io/EKPpnA');
}
return env.container.lookup('template:' + underscored) || env.container.lookup('template:' + name);
}
});
-// Ember.assert
enifed('ember-views/system/platform', ['exports', 'ember-metal/environment'], function (exports, _emberMetalEnvironment) {
'use strict';
// IE 6/7 have bugs around setting names on inputs during creation.
// From http://msdn.microsoft.com/en-us/library/ie/ms536389(v=vs.85).aspx:
@@ -39231,11 +41003,11 @@
function getViewBoundingClientRect(view) {
var range = getViewRange(view);
return range.getBoundingClientRect();
}
});
-enifed('ember-views/views/checkbox', ['exports', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-views/views/component'], function (exports, _emberMetalProperty_get, _emberMetalProperty_set, _emberViewsViewsComponent) {
+enifed('ember-views/views/checkbox', ['exports', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-views/components/component'], function (exports, _emberMetalProperty_get, _emberMetalProperty_set, _emberViewsComponentsComponent) {
'use strict';
/**
@module ember
@submodule ember-views
@@ -39264,11 +41036,11 @@
@class Checkbox
@namespace Ember
@extends Ember.Component
@public
*/
- exports.default = _emberViewsViewsComponent.default.extend({
+ exports.default = _emberViewsComponentsComponent.default.extend({
instrumentDisplay: '{{input type="checkbox"}}',
classNames: ['ember-checkbox'],
tagName: 'input',
@@ -39293,11 +41065,11 @@
_updateElementValue: function () {
_emberMetalProperty_set.set(this, 'checked', this.$().prop('checked'));
}
});
});
-enifed('ember-views/views/collection_view', ['exports', 'ember-metal/core', 'ember-views/views/container_view', 'ember-views/views/view', 'ember-runtime/mixins/array', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/computed', 'ember-metal/mixin', 'ember-views/streams/utils', 'ember-views/mixins/empty_view_support'], function (exports, _emberMetalCore, _emberViewsViewsContainer_view, _emberViewsViewsView, _emberRuntimeMixinsArray, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalComputed, _emberMetalMixin, _emberViewsStreamsUtils, _emberViewsMixinsEmpty_view_support) {
+enifed('ember-views/views/collection_view', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-views/views/container_view', 'ember-views/views/view', 'ember-runtime/mixins/array', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/computed', 'ember-metal/mixin', 'ember-views/streams/utils', 'ember-views/mixins/empty_view_support'], function (exports, _emberMetalCore, _emberMetalDebug, _emberViewsViewsContainer_view, _emberViewsViewsView, _emberRuntimeMixinsArray, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalComputed, _emberMetalMixin, _emberViewsStreamsUtils, _emberViewsMixinsEmpty_view_support) {
/**
@module ember
@submodule ember-views
*/
@@ -39529,12 +41301,11 @@
/**
Ensure that the content implements Ember.Array
@private
@method _assertArrayLike
*/
- _assertArrayLike: function (content) {
- },
+ _assertArrayLike: function (content) {},
/**
Removes the content and content observers.
@method destroy
@private
@@ -39717,12 +41488,11 @@
}
return props;
}
- function viewDeprecationMessage() {
- }
+ function viewDeprecationMessage() {}
var DeprecatedCollectionView = CollectionView.extend({
init: function () {
viewDeprecationMessage();
this._super.apply(this, arguments);
@@ -39738,430 +41508,21 @@
DeprecatedCollectionView.CONTAINER_MAP = CONTAINER_MAP;
exports.default = CollectionView;
exports.DeprecatedCollectionView = DeprecatedCollectionView;
});
-// Ember.assert
-enifed('ember-views/views/component', ['exports', 'ember-metal/core', 'ember-runtime/mixins/target_action_support', 'ember-views/views/view', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/is_none', 'ember-metal/computed', 'ember-views/compat/attrs-proxy'], function (exports, _emberMetalCore, _emberRuntimeMixinsTarget_action_support, _emberViewsViewsView, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalIs_none, _emberMetalComputed, _emberViewsCompatAttrsProxy) {
+enifed('ember-views/views/container_view', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-runtime/mixins/mutable_array', 'ember-runtime/system/native_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, _emberMetalDebug, _emberRuntimeMixinsMutable_array, _emberRuntimeSystemNative_array, _emberViewsViewsView, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalMixin, _emberMetalEvents, _emberHtmlbarsTemplatesContainerView) {
'use strict';
- function validateAction(component, actionName) {
- if (actionName && actionName[_emberViewsCompatAttrsProxy.MUTABLE_CELL]) {
- actionName = actionName.value;
- }
- return actionName;
- }
+ _emberHtmlbarsTemplatesContainerView.default.meta.revision = 'Ember@2.2.0-beta.1';
/**
@module ember
@submodule ember-views
*/
/**
- An `Ember.Component` is a view that is completely
- isolated. Properties accessed in its templates go
- to the view object and actions are targeted at
- the view object. There is no access to the
- surrounding context or outer controller; all
- contextual information must be passed in.
-
- The easiest way to create an `Ember.Component` is via
- a template. If you name a template
- `components/my-foo`, you will be able to use
- `{{my-foo}}` in other templates, which will make
- an instance of the isolated component.
-
- ```handlebars
- {{app-profile person=currentUser}}
- ```
-
- ```handlebars
- <!-- app-profile template -->
- <h1>{{person.title}}</h1>
- <img src={{person.avatar}}>
- <p class='signature'>{{person.signature}}</p>
- ```
-
- You can use `yield` inside a template to
- include the **contents** of any block attached to
- the component. The block will be executed in the
- context of the surrounding context or outer controller:
-
- ```handlebars
- {{#app-profile person=currentUser}}
- <p>Admin mode</p>
- {{! Executed in the controller's context. }}
- {{/app-profile}}
- ```
-
- ```handlebars
- <!-- app-profile template -->
- <h1>{{person.title}}</h1>
- {{! Executed in the components context. }}
- {{yield}} {{! block contents }}
- ```
-
- If you want to customize the component, in order to
- handle events or actions, you implement a subclass
- of `Ember.Component` named after the name of the
- component. Note that `Component` needs to be appended to the name of
- your subclass like `AppProfileComponent`.
-
- For example, you could implement the action
- `hello` for the `app-profile` component:
-
- ```javascript
- App.AppProfileComponent = Ember.Component.extend({
- actions: {
- hello: function(name) {
- console.log("Hello", name);
- }
- }
- });
- ```
-
- And then use it in the component's template:
-
- ```handlebars
- <!-- app-profile template -->
-
- <h1>{{person.title}}</h1>
- {{yield}} <!-- block contents -->
-
- <button {{action 'hello' person.name}}>
- Say Hello to {{person.name}}
- </button>
- ```
-
- Components must have a `-` in their name to avoid
- conflicts with built-in controls that wrap HTML
- elements. This is consistent with the same
- requirement in web components.
-
- @class Component
- @namespace Ember
- @extends Ember.View
- @public
- */
- var Component = _emberViewsViewsView.default.extend(_emberRuntimeMixinsTarget_action_support.default, {
- isComponent: true,
- /*
- This is set so that the proto inspection in appendTemplatedView does not
- think that it should set the components `context` to that of the parent view.
- */
- controller: null,
- context: null,
-
- instrumentName: 'component',
- instrumentDisplay: _emberMetalComputed.computed(function () {
- if (this._debugContainerKey) {
- return '{{' + this._debugContainerKey.split(':')[1] + '}}';
- }
- }),
-
- init: function () {
- this._super.apply(this, arguments);
- _emberMetalProperty_set.set(this, 'controller', this);
- _emberMetalProperty_set.set(this, 'context', this);
-
- if (!this.layout && this.layoutName && this.container) {
- var layoutName = _emberMetalProperty_get.get(this, 'layoutName');
-
- this.layout = this.templateForName(layoutName);
- }
-
- // If a `defaultLayout` was specified move it to the `layout` prop.
- // `layout` is no longer a CP, so this just ensures that the `defaultLayout`
- // logic is supported with a deprecation
- if (this.defaultLayout && !this.layout) {
-
- this.layout = this.defaultLayout;
- }
- },
-
- template: null,
- layoutName: null,
- layout: null,
-
- /**
- If the component is currently inserted into the DOM of a parent view, this
- property will point to the controller of the parent view.
- @property targetObject
- @type Ember.Controller
- @default null
- @private
- */
- targetObject: _emberMetalComputed.computed('controller', function (key) {
- if (this._targetObject) {
- return this._targetObject;
- }
- if (this._controller) {
- return this._controller;
- }
- var parentView = _emberMetalProperty_get.get(this, 'parentView');
- return parentView ? _emberMetalProperty_get.get(parentView, 'controller') : null;
- }),
-
- /**
- Calls a action passed to a component.
- For example a component for playing or pausing music may translate click events
- into action notifications of "play" or "stop" depending on some internal state
- of the component:
- ```javascript
- // app/components/play-button.js
- export default Ember.Component.extend({
- click() {
- if (this.get('isPlaying')) {
- this.sendAction('play');
- } else {
- this.sendAction('stop');
- }
- }
- });
- ```
- The actions "play" and "stop" must be passed to this `play-button` component:
- ```handlebars
- {{! app/templates/application.hbs }}
- {{play-button play=(action "musicStarted") stop=(action "musicStopped")}}
- ```
- When the component receives a browser `click` event it translate this
- interaction into application-specific semantics ("play" or "stop") and
- calls the specified action.
- ```javascript
- // app/controller/application.js
- export default Ember.Controller.extend({
- actions: {
- musicStarted() {
- // called when the play button is clicked
- // and the music started playing
- },
- musicStopped() {
- // called when the play button is clicked
- // and the music stopped playing
- }
- }
- });
- ```
- If no action is passed to `sendAction` a default name of "action"
- is assumed.
- ```javascript
- // app/components/next-button.js
- export default Ember.Component.extend({
- click() {
- this.sendAction();
- }
- });
- ```
- ```handlebars
- {{! app/templates/application.hbs }}
- {{next-button action=(action "playNextSongInAlbum")}}
- ```
- ```javascript
- // app/controllers/application.js
- App.ApplicationController = Ember.Controller.extend({
- actions: {
- playNextSongInAlbum() {
- ...
- }
- }
- });
- ```
- @method sendAction
- @param [action] {String} the action to call
- @param [params] {*} arguments for the action
- @public
- */
- sendAction: function (action) {
- for (var _len = arguments.length, contexts = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- contexts[_key - 1] = arguments[_key];
- }
-
- var actionName;
-
- // Send the default action
- if (action === undefined) {
- action = 'action';
- }
- actionName = _emberMetalProperty_get.get(this, 'attrs.' + action) || _emberMetalProperty_get.get(this, action);
- actionName = validateAction(this, actionName);
-
- // If no action name for that action could be found, just abort.
- if (actionName === undefined) {
- return;
- }
-
- if (typeof actionName === 'function') {
- actionName.apply(null, contexts);
- } else {
- this.triggerAction({
- action: actionName,
- actionContext: contexts
- });
- }
- },
-
- send: function (actionName) {
- for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
- args[_key2 - 1] = arguments[_key2];
- }
-
- var target;
- var hasAction = this.actions && this.actions[actionName];
-
- if (hasAction) {
- var shouldBubble = this.actions[actionName].apply(this, args) === true;
- if (!shouldBubble) {
- return;
- }
- }
-
- if (target = _emberMetalProperty_get.get(this, 'target')) {
- var _target;
-
- (_target = target).send.apply(_target, arguments);
- } else {
- if (!hasAction) {
- throw new Error(_emberMetalCore.default.inspect(this) + ' had no action handler for: ' + actionName);
- }
- }
- }
-
- /**
- Returns true when the component was invoked with a block template.
- Example (`hasBlock` will be `false`):
- ```hbs
- {{! templates/application.hbs }}
- {{foo-bar}}
- {{! templates/components/foo-bar.hbs }}
- {{#if hasBlock}}
- This will not be printed, because no block was provided
- {{/if}}
- ```
- Example (`hasBlock` will be `true`):
- ```hbs
- {{! templates/application.hbs }}
- {{#foo-bar}}
- Hi!
- {{/foo-bar}}
- {{! templates/components/foo-bar.hbs }}
- {{#if hasBlock}}
- This will be printed because a block was provided
- {{yield}}
- {{/if}}
- ```
- This helper accepts an argument with the name of the block we want to check the presence of.
- This is useful for checking for the presence of the optional inverse block in components.
- ```hbs
- {{! templates/application.hbs }}
- {{#foo-bar}}
- Hi!
- {{else}}
- What's up?
- {{/foo-bar}}
- {{! templates/components/foo-bar.hbs }}
- {{yield}}
- {{#if (hasBlock "inverse")}}
- {{yield to="inverse"}}
- {{else}}
- How are you?
- {{/if}}
- ```
- @public
- @property hasBlock
- @param {String} [blockName="default"] The name of the block to check presence of.
- @returns Boolean
- */
-
- /**
- Returns true when the component was invoked with a block parameter
- supplied.
- Example (`hasBlockParams` will be `false`):
- ```hbs
- {{! templates/application.hbs }}
- {{#foo-bar}}
- No block parameter.
- {{/foo-bar}}
- {{! templates/components/foo-bar.hbs }}
- {{#if hasBlockParams}}
- This will not be printed, because no block was provided
- {{yield this}}
- {{/if}}
- ```
- Example (`hasBlockParams` will be `true`):
- ```hbs
- {{! templates/application.hbs }}
- {{#foo-bar as |foo|}}
- Hi!
- {{/foo-bar}}
- {{! templates/components/foo-bar.hbs }}
- {{#if hasBlockParams}}
- This will be printed because a block was provided
- {{yield this}}
- {{/if}}
- ```
- @public
- @property hasBlockParams
- @returns Boolean
- */
-
- /**
- Enables components to take a list of parameters as arguments
- For example a component that takes two parameters with the names
- `name` and `age`:
- ```javascript
- let MyComponent = Ember.Component.extend;
- MyComponent.reopenClass({
- positionalParams: ['name', 'age']
- });
- ```
- It can then be invoked like this:
- ```hbs
- {{my-component "John" 38}}
- ```
- The parameters can be refered to just like named parameters:
- ```hbs
- Name: {{attrs.name}}, Age: {{attrs.age}}.
- ```
- Using a string instead of an array allows for an arbitrary number of
- parameters:
- ```javascript
- let MyComponent = Ember.Component.extend;
- MyComponent.reopenClass({
- positionalParams: 'names'
- });
- ```
- It can then be invoked like this:
- ```hbs
- {{my-component "John" "Michael" "Scott"}}
- ```
- The parameters can then be refered to by enumerating over the list:
- ```hbs
- {{#each attrs.names as |name|}}{{name}}{{/each}}
- ```
- @static
- @public
- @property positionalParams
- */
- });
-
- Component.reopenClass({
- isComponentFactory: true
- });
-
- exports.default = Component;
-});
-enifed('ember-views/views/container_view', ['exports', 'ember-metal/core', 'ember-runtime/mixins/mutable_array', 'ember-views/views/view', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/mixin', 'ember-metal/events', 'ember-htmlbars/templates/container-view'], function (exports, _emberMetalCore, _emberRuntimeMixinsMutable_array, _emberViewsViewsView, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalMixin, _emberMetalEvents, _emberHtmlbarsTemplatesContainerView) {
- 'use strict';
-
- _emberHtmlbarsTemplatesContainerView.default.meta.revision = 'Ember@2.1.2';
-
- /**
- @module ember
- @submodule ember-views
- */
-
- /**
A `ContainerView` is an `Ember.View` subclass that implements `Ember.MutableArray`
allowing programmatic management of its child views.
## Setting Initial Child Views
@@ -40310,24 +41671,23 @@
@extends Ember.View
@deprecated See http://emberjs.com/deprecations/v1.x/#toc_ember-containerview
@private
*/
var ContainerView = _emberViewsViewsView.default.extend(_emberRuntimeMixinsMutable_array.default, {
- willWatchProperty: function (prop) {
- },
+ willWatchProperty: function (prop) {},
init: function () {
var _this = this;
this._super.apply(this, arguments);
this._prevCurrentView = undefined;
var userChildViews = _emberMetalProperty_get.get(this, 'childViews');
-
+
// redefine view's childViews property that was obliterated
// 2.0TODO: Don't Ember.A() this so users disabling prototype extensions
// don't pay a penalty.
- var childViews = this.childViews = _emberMetalCore.default.A([]);
+ var childViews = this.childViews = _emberRuntimeSystemNative_array.A();
userChildViews.forEach(function (viewName, idx) {
var view;
if ('string' === typeof viewName) {
@@ -40342,11 +41702,11 @@
});
var currentView = _emberMetalProperty_get.get(this, 'currentView');
if (currentView) {
if (!childViews.length) {
- childViews = this.childViews = _emberMetalCore.default.A(this.childViews.slice());
+ childViews = this.childViews = _emberRuntimeSystemNative_array.A(this.childViews.slice());
}
childViews.push(this.createChildView(currentView));
}
_emberMetalProperty_set.set(this, 'length', childViews.length);
@@ -40371,11 +41731,11 @@
prevView.destroy();
}
var currentView = _emberMetalProperty_get.get(this, 'currentView');
this._prevCurrentView = currentView;
if (currentView) {
- this.pushObject(currentView);
+ this.pushObject(currentView);
}
}),
layout: _emberHtmlbarsTemplatesContainerView.default,
@@ -40385,11 +41745,10 @@
var addedViews = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2];
var addedCount = _emberMetalProperty_get.get(addedViews, 'length');
var childViews = _emberMetalProperty_get.get(this, 'childViews');
-
this.arrayContentWillChange(idx, removedCount, addedCount);
// Normally parentView and childViews are managed at render time. However,
// the ContainerView is an unusual legacy case. People expect to be able to
// push a child view into the ContainerView and have its parentView set
@@ -40409,11 +41768,11 @@
childViews.splice.apply(childViews, [idx, removedCount].concat(addedViews));
this.notifyPropertyChange('childViews');
this.arrayContentDidChange(idx, removedCount, addedCount);
- //Ember.assert("You can't add a child to a container - the child is already a child of another view", emberA(addedViews).every(function(item) { return !item.parentView || item.parentView === self; }));
+ // assert("You can't add a child to a container - the child is already a child of another view", emberA(addedViews).every(function(item) { return !item.parentView || item.parentView === self; }));
_emberMetalProperty_set.set(this, 'length', childViews.length);
return this;
},
@@ -40439,12 +41798,11 @@
}
}
})
});
- function containerViewDeprecationMessage() {
- }
+ function containerViewDeprecationMessage() {}
var DeprecatedContainerView = ContainerView.extend({
init: function () {
containerViewDeprecationMessage();
this._super.apply(this, arguments);
@@ -40458,11 +41816,11 @@
return this;
};
exports.default = ContainerView;
});
-enifed('ember-views/views/core_view', ['exports', 'ember-metal/core', 'ember-metal/property_get', 'ember-runtime/system/object', 'ember-runtime/mixins/evented', 'ember-runtime/mixins/action_handler', 'ember-runtime/utils', 'ember-metal-views/renderer', 'ember-views/views/states', 'htmlbars-runtime'], function (exports, _emberMetalCore, _emberMetalProperty_get, _emberRuntimeSystemObject, _emberRuntimeMixinsEvented, _emberRuntimeMixinsAction_handler, _emberRuntimeUtils, _emberMetalViewsRenderer, _emberViewsViewsStates, _htmlbarsRuntime) {
+enifed('ember-views/views/core_view', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-metal/property_get', 'ember-runtime/system/object', 'ember-runtime/mixins/evented', 'ember-runtime/mixins/action_handler', 'ember-runtime/utils', 'ember-metal-views/renderer', 'ember-views/views/states', 'htmlbars-runtime'], function (exports, _emberMetalCore, _emberMetalDebug, _emberMetalProperty_get, _emberRuntimeSystemObject, _emberRuntimeMixinsEvented, _emberRuntimeMixinsAction_handler, _emberRuntimeUtils, _emberMetalViewsRenderer, _emberViewsViewsStates, _htmlbarsRuntime) {
'use strict';
function K() {
return this;
}
@@ -40570,11 +41928,11 @@
// code and not via a change in the templating layer (like an {{if}}
// becoming falsy, for example). In this case, it is our responsibility to
// make sure that any render nodes created as part of the rendering process
// are cleaned up.
if (!this.ownerView._destroyingSubtreeForView && this._renderNode) {
- _htmlbarsRuntime.internal.clearMorph(this._renderNode, this.ownerView.env, true);
+ _htmlbarsRuntime.internal.clearMorph(this._renderNode, this.ownerView.env, true);
}
return this;
},
@@ -40589,11 +41947,11 @@
isViewFactory: true
});
var DeprecatedCoreView = CoreView.extend({
init: function () {
- this._super.apply(this, arguments);
+ this._super.apply(this, arguments);
}
});
exports.DeprecatedCoreView = DeprecatedCoreView;
var _domHelper;
@@ -41288,43 +42646,10 @@
exports.default = Select;
exports.Select = Select;
exports.SelectOption = SelectOption;
exports.SelectOptgroup = SelectOptgroup;
});
-enifed('ember-views/views/states', ['exports', 'ember-metal/merge', 'ember-views/views/states/default', 'ember-views/views/states/pre_render', 'ember-views/views/states/has_element', 'ember-views/views/states/in_dom', 'ember-views/views/states/destroying'], function (exports, _emberMetalMerge, _emberViewsViewsStatesDefault, _emberViewsViewsStatesPre_render, _emberViewsViewsStatesHas_element, _emberViewsViewsStatesIn_dom, _emberViewsViewsStatesDestroying) {
- 'use strict';
-
- exports.cloneStates = cloneStates;
-
- function cloneStates(from) {
- var into = {};
-
- into._default = {};
- into.preRender = Object.create(into._default);
- into.destroying = Object.create(into._default);
- into.hasElement = Object.create(into._default);
- into.inDOM = Object.create(into.hasElement);
-
- for (var stateName in from) {
- if (!from.hasOwnProperty(stateName)) {
- continue;
- }
- _emberMetalMerge.default(into[stateName], from[stateName]);
- }
-
- return into;
- }
-
- var states = {
- _default: _emberViewsViewsStatesDefault.default,
- preRender: _emberViewsViewsStatesPre_render.default,
- inDOM: _emberViewsViewsStatesIn_dom.default,
- hasElement: _emberViewsViewsStatesHas_element.default,
- destroying: _emberViewsViewsStatesDestroying.default
- };
- exports.states = states;
-});
enifed('ember-views/views/states/default', ['exports', 'ember-metal/error', 'ember-metal/property_get', 'ember-views/compat/attrs-proxy'], function (exports, _emberMetalError, _emberMetalProperty_get, _emberViewsCompatAttrsProxy) {
'use strict';
/**
@module ember
@@ -41371,21 +42696,21 @@
view.renderer.ensureViewNotRendering(view);
},
invokeObserver: function () {}
};
});
-enifed('ember-views/views/states/destroying', ['exports', 'ember-metal/merge', 'ember-views/views/states/default', 'ember-metal/error'], function (exports, _emberMetalMerge, _emberViewsViewsStatesDefault, _emberMetalError) {
+enifed('ember-views/views/states/destroying', ['exports', 'ember-metal/assign', 'ember-views/views/states/default', 'ember-metal/error'], function (exports, _emberMetalAssign, _emberViewsViewsStatesDefault, _emberMetalError) {
'use strict';
/**
@module ember
@submodule ember-views
*/
var destroying = Object.create(_emberViewsViewsStatesDefault.default);
- _emberMetalMerge.default(destroying, {
+ _emberMetalAssign.default(destroying, {
appendChild: function () {
throw new _emberMetalError.default('You can\'t call appendChild on a view being destroyed');
},
rerender: function () {
throw new _emberMetalError.default('You can\'t call rerender on a view being destroyed');
@@ -41395,16 +42720,16 @@
}
});
exports.default = destroying;
});
-enifed('ember-views/views/states/has_element', ['exports', 'ember-views/views/states/default', 'ember-metal/merge', 'ember-views/system/jquery', 'ember-metal/run_loop', 'ember-metal/property_get', 'htmlbars-runtime'], function (exports, _emberViewsViewsStatesDefault, _emberMetalMerge, _emberViewsSystemJquery, _emberMetalRun_loop, _emberMetalProperty_get, _htmlbarsRuntime) {
+enifed('ember-views/views/states/has_element', ['exports', 'ember-views/views/states/default', 'ember-metal/assign', 'ember-views/system/jquery', 'ember-metal/run_loop', 'ember-metal/property_get', 'htmlbars-runtime'], function (exports, _emberViewsViewsStatesDefault, _emberMetalAssign, _emberViewsSystemJquery, _emberMetalRun_loop, _emberMetalProperty_get, _htmlbarsRuntime) {
'use strict';
var hasElement = Object.create(_emberViewsViewsStatesDefault.default);
- _emberMetalMerge.default(hasElement, {
+ _emberMetalAssign.default(hasElement, {
$: function (view, sel) {
var elem = view.element;
return sel ? _emberViewsSystemJquery.default(sel, elem) : _emberViewsSystemJquery.default(elem);
},
@@ -41426,11 +42751,11 @@
var renderNode = view._renderNode;
renderNode.isDirty = true;
_htmlbarsRuntime.internal.visitChildren(renderNode.childNodes, function (node) {
- if (node.state && node.state.manager) {
+ if (node.getState().manager) {
node.shouldReceiveAttrs = true;
}
node.isDirty = true;
});
@@ -41471,54 +42796,86 @@
/**
@module ember
@submodule ember-views
*/
-enifed('ember-views/views/states/in_dom', ['exports', 'ember-metal/core', 'ember-metal/merge', 'ember-metal/error', 'ember-metal/observer', 'ember-views/views/states/has_element'], function (exports, _emberMetalCore, _emberMetalMerge, _emberMetalError, _emberMetalObserver, _emberViewsViewsStatesHas_element) {
+enifed('ember-views/views/states/in_dom', ['exports', 'ember-metal/debug', 'ember-metal/assign', 'ember-metal/error', 'ember-metal/observer', 'ember-views/views/states/has_element'], function (exports, _emberMetalDebug, _emberMetalAssign, _emberMetalError, _emberMetalObserver, _emberViewsViewsStatesHas_element) {
'use strict';
/**
@module ember
@submodule ember-views
*/
var inDOM = Object.create(_emberViewsViewsStatesHas_element.default);
- _emberMetalMerge.default(inDOM, {
+ _emberMetalAssign.default(inDOM, {
enter: function (view) {
// Register the view for event handling. This hash is used by
// Ember.EventDispatcher to dispatch incoming events.
if (view.tagName !== '') {
view._register();
}
+ },
- },
-
exit: function (view) {
view._unregister();
}
});
exports.default = inDOM;
});
-enifed('ember-views/views/states/pre_render', ['exports', 'ember-views/views/states/default', 'ember-metal/merge'], function (exports, _emberViewsViewsStatesDefault, _emberMetalMerge) {
+enifed('ember-views/views/states/pre_render', ['exports', 'ember-views/views/states/default', 'ember-metal/assign'], function (exports, _emberViewsViewsStatesDefault, _emberMetalAssign) {
'use strict';
/**
@module ember
@submodule ember-views
*/
var preRender = Object.create(_emberViewsViewsStatesDefault.default);
- _emberMetalMerge.default(preRender, {
+ _emberMetalAssign.default(preRender, {
legacyPropertyDidChange: function (view, key) {}
});
exports.default = preRender;
});
-enifed('ember-views/views/text_area', ['exports', 'ember-views/views/component', 'ember-views/mixins/text_support'], function (exports, _emberViewsViewsComponent, _emberViewsMixinsText_support) {
+enifed('ember-views/views/states', ['exports', 'ember-metal/assign', 'ember-views/views/states/default', 'ember-views/views/states/pre_render', 'ember-views/views/states/has_element', 'ember-views/views/states/in_dom', 'ember-views/views/states/destroying'], function (exports, _emberMetalAssign, _emberViewsViewsStatesDefault, _emberViewsViewsStatesPre_render, _emberViewsViewsStatesHas_element, _emberViewsViewsStatesIn_dom, _emberViewsViewsStatesDestroying) {
+ 'use strict';
+
+ exports.cloneStates = cloneStates;
+
+ function cloneStates(from) {
+ var into = {};
+
+ into._default = {};
+ into.preRender = Object.create(into._default);
+ into.destroying = Object.create(into._default);
+ into.hasElement = Object.create(into._default);
+ into.inDOM = Object.create(into.hasElement);
+
+ for (var stateName in from) {
+ if (!from.hasOwnProperty(stateName)) {
+ continue;
+ }
+ _emberMetalAssign.default(into[stateName], from[stateName]);
+ }
+
+ return into;
+ }
+
+ var states = {
+ _default: _emberViewsViewsStatesDefault.default,
+ preRender: _emberViewsViewsStatesPre_render.default,
+ inDOM: _emberViewsViewsStatesIn_dom.default,
+ hasElement: _emberViewsViewsStatesHas_element.default,
+ destroying: _emberViewsViewsStatesDestroying.default
+ };
+ exports.states = states;
+});
+enifed('ember-views/views/text_area', ['exports', 'ember-views/components/component', 'ember-views/mixins/text_support'], function (exports, _emberViewsComponentsComponent, _emberViewsMixinsText_support) {
/**
@module ember
@submodule ember-views
*/
'use strict';
@@ -41539,22 +42896,22 @@
@namespace Ember
@extends Ember.Component
@uses Ember.TextSupport
@public
*/
- exports.default = _emberViewsViewsComponent.default.extend(_emberViewsMixinsText_support.default, {
+ exports.default = _emberViewsComponentsComponent.default.extend(_emberViewsMixinsText_support.default, {
instrumentDisplay: '{{textarea}}',
classNames: ['ember-text-area'],
tagName: 'textarea',
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', 'ember-metal/empty_object'], function (exports, _emberMetalComputed, _emberMetalEnvironment, _emberViewsViewsComponent, _emberViewsMixinsText_support, _emberMetalEmpty_object) {
+enifed('ember-views/views/text_field', ['exports', 'ember-metal/computed', 'ember-metal/environment', 'ember-views/components/component', 'ember-views/mixins/text_support', 'ember-metal/empty_object'], function (exports, _emberMetalComputed, _emberMetalEnvironment, _emberViewsComponentsComponent, _emberViewsMixinsText_support, _emberMetalEmpty_object) {
/**
@module ember
@submodule ember-views
*/
'use strict';
@@ -41602,11 +42959,11 @@
@namespace Ember
@extends Ember.Component
@uses Ember.TextSupport
@public
*/
- exports.default = _emberViewsViewsComponent.default.extend(_emberViewsMixinsText_support.default, {
+ exports.default = _emberViewsComponentsComponent.default.extend(_emberViewsMixinsText_support.default, {
instrumentDisplay: '{{input type="text"}}',
classNames: ['ember-text-field'],
tagName: 'input',
attributeBindings: ['accept', 'autocomplete', 'autosave', 'dir', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget', 'height', 'inputmode', 'lang', 'list', 'max', 'min', 'multiple', 'name', 'pattern', 'size', 'step', 'type', 'value', 'width'],
@@ -41683,32 +43040,17 @@
@public
*/
max: null
});
});
-enifed('ember-views/views/view', ['exports', 'ember-metal/core', 'ember-metal/error', 'ember-metal/property_get', 'ember-metal/run_loop', 'ember-metal/observer', 'ember-metal/utils', 'ember-metal/computed', 'ember-metal/mixin', 'ember-views/system/jquery', 'ember-views/system/ext', 'ember-views/views/core_view', 'ember-views/mixins/view_context_support', 'ember-views/mixins/view_child_views_support', 'ember-views/mixins/view_state_support', 'ember-views/mixins/template_rendering_support', 'ember-views/mixins/class_names_support', 'ember-views/mixins/legacy_view_support', 'ember-views/mixins/instrumentation_support', 'ember-views/mixins/aria_role_support', 'ember-views/mixins/visibility_support', 'ember-views/compat/attrs-proxy', 'ember-metal/deprecate_property', 'ember-runtime/system/core_object'], function (exports, _emberMetalCore, _emberMetalError, _emberMetalProperty_get, _emberMetalRun_loop, _emberMetalObserver, _emberMetalUtils, _emberMetalComputed, _emberMetalMixin, _emberViewsSystemJquery, _emberViewsSystemExt, _emberViewsViewsCore_view, _emberViewsMixinsView_context_support, _emberViewsMixinsView_child_views_support, _emberViewsMixinsView_state_support, _emberViewsMixinsTemplate_rendering_support, _emberViewsMixinsClass_names_support, _emberViewsMixinsLegacy_view_support, _emberViewsMixinsInstrumentation_support, _emberViewsMixinsAria_role_support, _emberViewsMixinsVisibility_support, _emberViewsCompatAttrsProxy, _emberMetalDeprecate_property, _emberRuntimeSystemCore_object) {
- // Ember.assert, Ember.deprecate, Ember.warn, Ember.TEMPLATES,
+enifed('ember-views/views/view', ['exports', 'ember-metal/core', 'ember-metal/debug', 'ember-views/system/ext', 'ember-views/views/core_view', 'ember-views/mixins/view_context_support', 'ember-views/mixins/view_child_views_support', 'ember-views/mixins/legacy_child_views_support', 'ember-views/mixins/view_state_support', 'ember-views/mixins/template_rendering_support', 'ember-views/mixins/class_names_support', 'ember-views/mixins/legacy_view_support', 'ember-views/mixins/instrumentation_support', 'ember-views/mixins/aria_role_support', 'ember-views/mixins/visibility_support', 'ember-views/compat/attrs-proxy', 'ember-views/mixins/view_support', 'ember-metal/deprecate_property'], function (exports, _emberMetalCore, _emberMetalDebug, _emberViewsSystemExt, _emberViewsViewsCore_view, _emberViewsMixinsView_context_support, _emberViewsMixinsView_child_views_support, _emberViewsMixinsLegacy_child_views_support, _emberViewsMixinsView_state_support, _emberViewsMixinsTemplate_rendering_support, _emberViewsMixinsClass_names_support, _emberViewsMixinsLegacy_view_support, _emberViewsMixinsInstrumentation_support, _emberViewsMixinsAria_role_support, _emberViewsMixinsVisibility_support, _emberViewsCompatAttrsProxy, _emberViewsMixinsView_support, _emberMetalDeprecate_property) {
// jQuery, Ember.lookup,
// Ember.ContainerView circular dependency
// Ember.ENV
'use strict';
- var _CoreView$extend;
-
- var INIT_WAS_CALLED = _emberMetalUtils.symbol('INIT_WAS_CALLED');
-
- function K() {
- return this;
- }
-
/**
- @module ember
- @submodule ember-views
- */
-
-
- /**
Global hash of shared templates. This will automatically be populated
by the build tools so that you can store your Handlebars templates in
separate files that get loaded into JavaScript at buildtime.
@property TEMPLATES
@@ -42330,681 +43672,41 @@
@uses Ember.VisibilitySupport
@uses Ember.AriaRoleSupport
@public
*/
// jscs:disable validateIndentation
- var View = _emberViewsViewsCore_view.default.extend(_emberViewsMixinsView_context_support.default, _emberViewsMixinsView_child_views_support.default, _emberViewsMixinsView_state_support.default, _emberViewsMixinsTemplate_rendering_support.default, _emberViewsMixinsClass_names_support.default, _emberViewsMixinsLegacy_view_support.default, _emberViewsMixinsInstrumentation_support.default, _emberViewsMixinsVisibility_support.default, _emberViewsCompatAttrsProxy.default, _emberViewsMixinsAria_role_support.default, (_CoreView$extend = {
- concatenatedProperties: ['attributeBindings'],
+ var View = _emberViewsViewsCore_view.default.extend(_emberViewsMixinsView_context_support.default, _emberViewsMixinsView_child_views_support.default, _emberViewsMixinsLegacy_child_views_support.default, _emberViewsMixinsView_state_support.default, _emberViewsMixinsTemplate_rendering_support.default, _emberViewsMixinsClass_names_support.default, _emberViewsMixinsLegacy_view_support.default, _emberViewsMixinsInstrumentation_support.default, _emberViewsMixinsVisibility_support.default, _emberViewsCompatAttrsProxy.default, _emberViewsMixinsAria_role_support.default, _emberViewsMixinsView_support.default, {
+ init: function () {
+ this._super.apply(this, arguments);
- /**
- @property isView
- @type Boolean
- @default true
- @static
- @private
- */
- isView: true,
-
- // ..........................................................
- // TEMPLATE SUPPORT
- //
-
- /**
- The name of the template to lookup if no template is provided.
- By default `Ember.View` will lookup a template with this name in
- `Ember.TEMPLATES` (a shared global object).
- @property templateName
- @type String
- @default null
- @private
- */
- templateName: null,
-
- /**
- The name of the layout to lookup if no layout is provided.
- By default `Ember.View` will lookup a template with this name in
- `Ember.TEMPLATES` (a shared global object).
- @property layoutName
- @type String
- @default null
- @public
- */
- layoutName: null,
-
- /**
- The template used to render the view. This should be a function that
- accepts an optional context parameter and returns a string of HTML that
- will be inserted into the DOM relative to its parent view.
- In general, you should set the `templateName` property instead of setting
- the template yourself.
- @property template
- @type Function
- @private
- */
- template: _emberMetalComputed.computed({
- get: function () {
- var templateName = _emberMetalProperty_get.get(this, 'templateName');
- var template = this.templateForName(templateName, 'template');
- return template || _emberMetalProperty_get.get(this, 'defaultTemplate');
- },
- set: function (key, value) {
- if (value !== undefined) {
- return value;
- }
- return _emberMetalProperty_get.get(this, key);
+ if (!this._viewRegistry) {
+ this._viewRegistry = View.views;
}
- }),
-
- /**
- A view may contain a layout. A layout is a regular template but
- supersedes the `template` property during rendering. It is the
- responsibility of the layout template to retrieve the `template`
- property from the view (or alternatively, call `Handlebars.helpers.yield`,
- `{{yield}}`) to render it in the correct location.
- This is useful for a view that has a shared wrapper, but which delegates
- the rendering of the contents of the wrapper to the `template` property
- on a subclass.
- @property layout
- @type Function
- @public
- */
- layout: _emberMetalComputed.computed({
- get: function (key) {
- var layoutName = _emberMetalProperty_get.get(this, 'layoutName');
- var layout = this.templateForName(layoutName, 'layout');
-
-
- return layout || _emberMetalProperty_get.get(this, 'defaultLayout');
- },
-
- set: function (key, value) {
- return value;
- }
- }),
-
- templateForName: function (name, type) {
- if (!name) {
- return;
- }
-
- if (!this.container) {
- throw new _emberMetalError.default('Container was not found when looking up a views template. ' + 'This is most likely due to manually instantiating an Ember.View. ' + 'See: http://git.io/EKPpnA');
- }
-
- return this.container.lookup('template:' + name);
},
/**
- If a value that affects template rendering changes, the view should be
- re-rendered to reflect the new value.
- @method _contextDidChange
- @private
- @private
- */
- _contextDidChange: _emberMetalMixin.observer('context', function () {
- this.rerender();
- }),
-
- /**
- Return the nearest ancestor that is an instance of the provided
- 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
- @public
- */
- nearestOfType: function (klass) {
- var view = _emberMetalProperty_get.get(this, 'parentView');
- var isOfType = klass instanceof _emberMetalMixin.Mixin ? function (view) {
- return klass.detect(view);
- } : function (view) {
- return klass.detect(view.constructor);
- };
-
- while (view) {
- if (isOfType(view)) {
- return view;
- }
- view = _emberMetalProperty_get.get(view, 'parentView');
- }
- },
-
- /**
- Return the nearest ancestor that has a given property.
- @method nearestWithProperty
- @param {String} property A property name
- @return Ember.View
- @private
- */
- nearestWithProperty: function (property) {
- var view = _emberMetalProperty_get.get(this, 'parentView');
-
- while (view) {
- if (property in view) {
- return view;
- }
- view = _emberMetalProperty_get.get(view, 'parentView');
- }
- },
-
- /**
- Renders the view again. This will work regardless of whether the
- view is already in the DOM or not. If the view is in the DOM, the
- rendering process will be deferred to give bindings a chance
- to synchronize.
- If children were added during the rendering process using `appendChild`,
- `rerender` will remove them, because they will be added again
- if needed by the next `render`.
- In general, if the display of your view changes, you should modify
- the DOM element directly instead of manually calling `rerender`, which can
- be slow.
- @method rerender
- @public
- */
- rerender: function () {
- return this._currentState.rerender(this);
- },
-
- /**
Given a property name, returns a dasherized version of that
property name if the property evaluates to a non-falsy value.
For example, if the view has property `isUrgent` that evaluates to true,
passing `isUrgent` to this method will return `"is-urgent"`.
@method _classStringForProperty
@param property
@private
*/
_classStringForProperty: function (parsedPath) {
return View._classStringForValue(parsedPath.path, parsedPath.stream.value(), parsedPath.className, parsedPath.falsyClassName);
- },
-
- // ..........................................................
- // ELEMENT SUPPORT
- //
-
- /**
- Returns the current DOM element for the view.
- @property element
- @type DOMElement
- @public
- */
- element: null,
-
- /**
- Returns a jQuery object for this view's element. If you pass in a selector
- string, this method will return a jQuery object, using the current element
- as its buffer.
- For example, calling `view.$('li')` will return a jQuery object containing
- all of the `li` elements inside the DOM element of this view.
- @method $
- @param {String} [selector] a jQuery-compatible selector string
- @return {jQuery} the jQuery object for the DOM node
- @public
- */
- $: function (sel) {
- return this._currentState.$(this, sel);
- },
-
- forEachChildView: function (callback) {
- var childViews = this.childViews;
-
- if (!childViews) {
- return this;
- }
-
- var len = childViews.length;
- var view, idx;
-
- for (idx = 0; idx < len; idx++) {
- view = childViews[idx];
- callback(view);
- }
-
- return this;
- },
-
- /**
- Appends the view's element to the specified parent element.
- If the view does not have an HTML representation yet, `createElement()`
- will be called automatically.
- Note that this method just schedules the view to be appended; the DOM
- element will not be appended to the given element until all bindings have
- finished synchronizing.
- This is not typically a function that you will need to call directly when
- building your application. You might consider using `Ember.ContainerView`
- instead. If you do need to use `appendTo`, be sure that the target element
- you are providing is associated with an `Ember.Application` and does not
- have an ancestor element that is associated with an Ember view.
- @method appendTo
- @param {String|DOMElement|jQuery} A selector, element, HTML string, or jQuery object
- @return {Ember.View} receiver
- @private
- */
- appendTo: function (selector) {
- var target = _emberViewsSystemJquery.default(selector);
-
-
- this.renderer.appendTo(this, target[0]);
-
- return this;
- },
-
- /**
- @private
- Creates a new DOM element, renders the view into it, then returns the
- element.
- By default, the element created and rendered into will be a `BODY` element,
- since this is the default context that views are rendered into when being
- inserted directly into the DOM.
- ```js
- var element = view.renderToElement();
- element.tagName; // => "BODY"
- ```
- You can override the kind of element rendered into and returned by
- specifying an optional tag name as the first argument.
- ```js
- var element = view.renderToElement('table');
- element.tagName; // => "TABLE"
- ```
- This method is useful if you want to render the view into an element that
- is not in the document's body. Instead, a new `body` element, detached from
- the DOM is returned. FastBoot uses this to serialize the rendered view into
- a string for transmission over the network.
- ```js
- app.visit('/').then(function(instance) {
- var element;
- Ember.run(function() {
- element = renderToElement(instance);
- });
- res.send(serialize(element));
- });
- ```
- @method renderToElement
- @param {String} tagName The tag of the element to create and render into. Defaults to "body".
- @return {HTMLBodyElement} element
- @private
- */
- renderToElement: function (tagName) {
- tagName = tagName || 'body';
-
- var element = this.renderer._dom.createElement(tagName);
-
- this.renderer.appendTo(this, element);
- return element;
- },
-
- /**
- Replaces the content of the specified parent element with this view's
- element. If the view does not have an HTML representation yet,
- the element will be generated automatically.
- Note that this method just schedules the view to be appended; the DOM
- element will not be appended to the given element until all bindings have
- finished synchronizing
- @method replaceIn
- @param {String|DOMElement|jQuery} target A selector, element, HTML string, or jQuery object
- @return {Ember.View} received
- @private
- */
- replaceIn: function (selector) {
- var target = _emberViewsSystemJquery.default(selector);
-
-
- this.renderer.replaceIn(this, target[0]);
-
- return this;
- },
-
- /**
- Appends the view's element to the document body. If the view does
- not have an HTML representation yet
- the element will be generated automatically.
- If your application uses the `rootElement` property, you must append
- the view within that element. Rendering views outside of the `rootElement`
- is not supported.
- Note that this method just schedules the view to be appended; the DOM
- element will not be appended to the document body until all bindings have
- finished synchronizing.
- @method append
- @return {Ember.View} receiver
- @private
- */
- append: function () {
- return this.appendTo(document.body);
- },
-
- /**
- Removes the view's element from the element to which it is attached.
- @method remove
- @return {Ember.View} receiver
- @private
- */
- remove: function () {
- // What we should really do here is wait until the end of the run loop
- // to determine if the element has been re-appended to a different
- // element.
- // In the interim, we will just re-render if that happens. It is more
- // important than elements get garbage collected.
- if (!this.removedFromDOM) {
- this.destroyElement();
- }
-
- // Set flag to avoid future renders
- this._willInsert = false;
- },
-
- /**
- The HTML `id` of the view's element in the DOM. You can provide this
- value yourself but it must be unique (just as in HTML):
- ```handlebars
- {{my-component elementId="a-really-cool-id"}}
- ```
- If not manually set a default value will be provided by the framework.
- Once rendered an element's `elementId` is considered immutable and you
- should never change it. If you need to compute a dynamic value for the
- `elementId`, you should do this when the component or element is being
- instantiated:
- ```javascript
- export default Ember.Component.extend({
- setElementId: Ember.on('init', function() {
- var index = this.get('index');
- this.set('elementId', 'component-id' + index);
- })
- });
- ```
- @property elementId
- @type String
- @public
- */
- elementId: null,
-
- /**
- Attempts to discover the element in the parent element. The default
- implementation looks for an element with an ID of `elementId` (or the
- view's guid if `elementId` is null). You can override this method to
- provide your own form of lookup. For example, if you want to discover your
- element using a CSS class name instead of an ID.
- @method findElementInParentElement
- @param {DOMElement} parentElement The parent's DOM element
- @return {DOMElement} The discovered element
- @private
- */
- findElementInParentElement: function (parentElem) {
- var id = '#' + this.elementId;
- return _emberViewsSystemJquery.default(id)[0] || _emberViewsSystemJquery.default(id, parentElem)[0];
- },
-
- /**
- Creates a DOM representation of the view and all of its child views by
- recursively calling the `render()` method. Once the element is created,
- it sets the `element` property of the view to the rendered element.
- After the element has been inserted into the DOM, `didInsertElement` will
- be called on this view and all of its child views.
- @method createElement
- @return {Ember.View} receiver
- @private
- */
- createElement: function () {
- if (this.element) {
- return this;
- }
-
- this.renderer.createElement(this);
-
- return this;
- },
-
- /**
- Called when a view is going to insert an element into the DOM.
- @event willInsertElement
- @public
- */
- willInsertElement: K,
-
- /**
- Called when the element of the view has been inserted into the DOM
- or after the view was re-rendered. Override this function to do any
- set up that requires an element in the document body.
- When a view has children, didInsertElement will be called on the
- child view(s) first, bubbling upwards through the hierarchy.
- @event didInsertElement
- @public
- */
- didInsertElement: K,
-
- /**
- Called when the view is about to rerender, but before anything has
- been torn down. This is a good opportunity to tear down any manual
- observers you have installed based on the DOM state
- @event willClearRender
- @public
- */
- willClearRender: K,
-
- /**
- Destroys any existing element along with the element for any child views
- as well. If the view does not currently have a element, then this method
- will do nothing.
- If you implement `willDestroyElement()` on your view, then this method will
- be invoked on your view before your element is destroyed to give you a
- chance to clean up any event handlers, etc.
- If you write a `willDestroyElement()` handler, you can assume that your
- `didInsertElement()` handler was called earlier for the same element.
- You should not call or override this method yourself, but you may
- want to implement the above callbacks.
- @method destroyElement
- @return {Ember.View} receiver
- @private
- */
- destroyElement: function () {
- return this._currentState.destroyElement(this);
- },
-
- /**
- Called when the element of the view is going to be destroyed. Override
- this function to do any teardown that requires an element, like removing
- event listeners.
- Please note: any property changes made during this event will have no
- effect on object observers.
- @event willDestroyElement
- @public
- */
- willDestroyElement: K,
-
- /**
- Called when the parentView property has changed.
- @event parentViewDidChange
- @private
- */
- parentViewDidChange: K,
-
- // ..........................................................
- // STANDARD RENDER PROPERTIES
- //
-
- /**
- Tag name for the view's outer element. The tag name is only used when an
- element is first created. If you change the `tagName` for an element, you
- must destroy and recreate the view element.
- By default, the render buffer will use a `<div>` tag for views.
- @property tagName
- @type String
- @default null
- @public
- */
-
- // We leave this null by default so we can tell the difference between
- // the default case and a user-specified tag.
- tagName: null,
-
- /*
- Used to specify a default tagName that can be overridden when extending
- or invoking from a template.
- @property _defaultTagName
- @private
- */
-
- /**
- Normally, Ember's component model is "write-only". The component takes a
- bunch of attributes that it got passed in, and uses them to render its
- template.
- One nice thing about this model is that if you try to set a value to the
- same thing as last time, Ember (through HTMLBars) will avoid doing any
- work on the DOM.
- This is not just a performance optimization. If an attribute has not
- changed, it is important not to clobber the element's "hidden state".
- For example, if you set an input's `value` to the same value as before,
- it will clobber selection state and cursor position. In other words,
- setting an attribute is not **always** idempotent.
- This method provides a way to read an element's attribute and also
- update the last value Ember knows about at the same time. This makes
- setting an attribute idempotent.
- In particular, what this means is that if you get an `<input>` element's
- `value` attribute and then re-render the template with the same value,
- it will avoid clobbering the cursor and selection position.
- Since most attribute sets are idempotent in the browser, you typically
- can get away with reading attributes using jQuery, but the most reliable
- way to do so is through this method.
- @method readDOMAttr
- @param {String} name the name of the attribute
- @return String
- @public
- */
- readDOMAttr: function (name) {
- var attr = this._renderNode.childNodes.filter(function (node) {
- return node.attrName === name;
- })[0];
- if (!attr) {
- return null;
- }
- return attr.getContent();
- },
-
- // .......................................................
- // CORE DISPLAY METHODS
- //
-
- /**
- Setup a view, but do not finish waking it up.
- * configure `childViews`
- * register the view with the global views hash, which is used for event
- dispatch
- @method init
- @private
- */
- init: function () {
- this._super.apply(this, arguments);
-
- if (!this.elementId) {
- this.elementId = _emberMetalUtils.guidFor(this);
- }
-
- this.scheduledRevalidation = false;
-
- this[INIT_WAS_CALLED] = true;
-
- if (!this._viewRegistry) {
- this._viewRegistry = View.views;
- }
-
- }
-
- }, _CoreView$extend[_emberRuntimeSystemCore_object.POST_INIT] = function () {
- this._super.apply(this, arguments);
-
-
- this.renderer.componentInitAttrs(this, this.attrs || {});
- }, _CoreView$extend.__defineNonEnumerable = function (property) {
- this[property.name] = property.descriptor.value;
- }, _CoreView$extend.revalidate = function () {
- this.renderer.revalidateTopLevelView(this);
- this.scheduledRevalidation = false;
- }, _CoreView$extend.scheduleRevalidate = function (node, label, manualRerender) {
- if (node && !this._dispatching && node.guid in this.env.renderedNodes) {
- if (manualRerender) {
- } else {
- }
- _emberMetalRun_loop.default.scheduleOnce('render', this, this.revalidate);
- return;
}
+ });
-
- if (!this.scheduledRevalidation || this._dispatching) {
- this.scheduledRevalidation = true;
- _emberMetalRun_loop.default.scheduleOnce('render', this, this.revalidate);
- }
- }, _CoreView$extend.templateRenderer = null, _CoreView$extend.removeFromParent = function () {
- var parent = this.parentView;
-
- // Remove DOM element from parent
- this.remove();
-
- if (parent) {
- parent.removeChild(this);
- }
- return this;
- }, _CoreView$extend.destroy = function () {
- // get parentView before calling super because it'll be destroyed
- var parentView = this.parentView;
- var viewName = this.viewName;
-
- if (!this._super.apply(this, arguments)) {
- return;
- }
-
- // remove from non-virtual parent view if viewName was specified
- if (viewName && parentView) {
- parentView.set(viewName, null);
- }
-
- // Destroy HTMLbars template
- if (this.lastResult) {
- this.lastResult.destroy();
- }
-
- return this;
- }, _CoreView$extend.handleEvent = function (eventName, evt) {
- return this._currentState.handleEvent(this, eventName, evt);
- }, _CoreView$extend._register = function () {
- this._viewRegistry[this.elementId] = this;
- }, _CoreView$extend._unregister = function () {
- delete this._viewRegistry[this.elementId];
- }, _CoreView$extend.registerObserver = function (root, path, target, observer) {
- if (!observer && 'function' === typeof target) {
- observer = target;
- target = null;
- }
-
- if (!root || typeof root !== 'object') {
- return;
- }
-
- var scheduledObserver = this._wrapAsScheduled(observer);
-
- _emberMetalObserver.addObserver(root, path, target, scheduledObserver);
-
- this.one('willClearRender', function () {
- _emberMetalObserver.removeObserver(root, path, target, scheduledObserver);
- });
- }, _CoreView$extend._wrapAsScheduled = function (fn) {
- var view = this;
- var stateCheckedFn = function () {
- view._currentState.invokeObserver(this, fn);
- };
- var scheduledFn = function () {
- _emberMetalRun_loop.default.scheduleOnce('render', this, stateCheckedFn);
- };
- return scheduledFn;
- }, _CoreView$extend));
- // jscs:enable validateIndentation
-
_emberMetalDeprecate_property.deprecateProperty(View.prototype, 'currentState', '_currentState', {
id: 'ember-view.current-state',
until: '2.3.0',
url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-component-currentstate'
});
+ // jscs:enable validateIndentation
+
/*
Describe how the specified actions should behave in the various
states that a view can exist in. Possible states:
* preRender: when a view is first instantiated, and after its
@@ -43046,12 +43748,11 @@
// at view initialization time. This happens in Ember.ContainerView's init
// method.
childViewsProperty: _emberViewsMixinsView_child_views_support.childViewsProperty
});
- function viewDeprecationMessage() {
- }
+ function viewDeprecationMessage() {}
var DeprecatedView = View.extend({
init: function () {
viewDeprecationMessage();
this._super.apply(this, arguments);
@@ -43072,64 +43773,83 @@
exports.ClassNamesSupport = _emberViewsMixinsClass_names_support.default;
exports.DeprecatedView = DeprecatedView;
});
// for the side effect of extending Ember.run.queues
-/*
- This is a special hook implemented in CoreObject, that allows Views/Components
- to have a way to ensure that `init` fires before `didInitAttrs` / `didReceiveAttrs`
- (so that `this._super` in init does not trigger `didReceiveAttrs` before the classes
- own `init` is finished).
- @method __postInitInitialization
- @private
- */
-
/**
- Removes the view from its `parentView`, if one is found. Otherwise
- does nothing.
- @method removeFromParent
- @return {Ember.View} receiver
- @private
+@module ember
+@submodule ember-views
*/
+enifed('ember-views', ['exports', 'ember-runtime', 'ember-views/system/jquery', 'ember-views/system/utils', 'ember-views/system/ext', 'ember-views/views/states', 'ember-metal-views/renderer', 'ember-views/views/core_view', 'ember-views/views/view', 'ember-views/views/container_view', 'ember-views/views/collection_view', 'ember-views/components/component', 'ember-views/system/event_dispatcher', 'ember-views/mixins/view_target_action_support', 'ember-views/component_lookup', 'ember-views/views/checkbox', 'ember-views/mixins/text_support', 'ember-views/views/text_field', 'ember-views/views/text_area', 'ember-views/views/select', 'ember-views/compat/metamorph_view', 'ember-views/views/legacy_each_view'], function (exports, _emberRuntime, _emberViewsSystemJquery, _emberViewsSystemUtils, _emberViewsSystemExt, _emberViewsViewsStates, _emberMetalViewsRenderer, _emberViewsViewsCore_view, _emberViewsViewsView, _emberViewsViewsContainer_view, _emberViewsViewsCollection_view, _emberViewsComponentsComponent, _emberViewsSystemEvent_dispatcher, _emberViewsMixinsView_target_action_support, _emberViewsComponent_lookup, _emberViewsViewsCheckbox, _emberViewsMixinsText_support, _emberViewsViewsText_field, _emberViewsViewsText_area, _emberViewsViewsSelect, _emberViewsCompatMetamorph_view, _emberViewsViewsLegacy_each_view) {
+ /**
+ @module ember
+ @submodule ember-views
+ */
-/**
- You must call `destroy` on a view to destroy the view (and all of its
- child views). This will remove the view from any parent node, then make
- sure that the DOM element managed by the view can be released by the
- memory manager.
- @method destroy
- @private
-*/
+ // BEGIN IMPORTS
+ 'use strict';
-// .......................................................
-// EVENT HANDLING
-//
+ // END IMPORTS
-/**
- Handle events from `Ember.EventDispatcher`
- @method handleEvent
- @param eventName {String}
- @param evt {Event}
- @private
-*/
+ /**
+ Alias for jQuery
+
+ @method $
+ @for Ember
+ @public
+ */
-/**
- Registers the view in the view registry, keyed on the view's `elementId`.
- This is used by the EventDispatcher to locate the view in response to
- events.
- This method should only be called once the view has been inserted into the
- DOM.
- @method _register
- @private
-*/
+ // BEGIN EXPORTS
+ _emberRuntime.default.$ = _emberViewsSystemJquery.default;
-/**
- Removes the view from the view registry. This should be called when the
- view is removed from DOM.
- @method _unregister
- @private
-*/
+ _emberRuntime.default.ViewTargetActionSupport = _emberViewsMixinsView_target_action_support.default;
+
+ var ViewUtils = _emberRuntime.default.ViewUtils = {};
+ ViewUtils.isSimpleClick = _emberViewsSystemUtils.isSimpleClick;
+ ViewUtils.getViewClientRects = _emberViewsSystemUtils.getViewClientRects;
+ ViewUtils.getViewBoundingClientRect = _emberViewsSystemUtils.getViewBoundingClientRect;
+
+ if (_emberRuntime.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
+ _emberRuntime.default.CoreView = _emberViewsViewsCore_view.DeprecatedCoreView;
+ _emberRuntime.default.View = _emberViewsViewsView.DeprecatedView;
+ _emberRuntime.default.View.states = _emberViewsViewsStates.states;
+ _emberRuntime.default.View.cloneStates = _emberViewsViewsStates.cloneStates;
+ _emberRuntime.default.View._Renderer = _emberMetalViewsRenderer.default;
+ _emberRuntime.default.ContainerView = _emberViewsViewsContainer_view.DeprecatedContainerView;
+ _emberRuntime.default.CollectionView = _emberViewsViewsCollection_view.default;
+ }
+
+ _emberRuntime.default._Renderer = _emberMetalViewsRenderer.default;
+
+ _emberRuntime.default.Checkbox = _emberViewsViewsCheckbox.default;
+ _emberRuntime.default.TextField = _emberViewsViewsText_field.default;
+ _emberRuntime.default.TextArea = _emberViewsViewsText_area.default;
+
+ if (_emberRuntime.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
+ _emberRuntime.default.Select = _emberViewsViewsSelect.Select;
+ }
+
+ _emberRuntime.default.SelectOption = _emberViewsViewsSelect.SelectOption;
+ _emberRuntime.default.SelectOptgroup = _emberViewsViewsSelect.SelectOptgroup;
+
+ _emberRuntime.default.TextSupport = _emberViewsMixinsText_support.default;
+ _emberRuntime.default.ComponentLookup = _emberViewsComponent_lookup.default;
+ _emberRuntime.default.Component = _emberViewsComponentsComponent.default;
+ _emberRuntime.default.EventDispatcher = _emberViewsSystemEvent_dispatcher.default;
+
+ // Deprecated:
+ if (_emberRuntime.default.ENV._ENABLE_LEGACY_VIEW_SUPPORT) {
+ _emberRuntime.default._Metamorph = _emberViewsCompatMetamorph_view._Metamorph;
+ _emberRuntime.default._MetamorphView = _emberViewsCompatMetamorph_view.default;
+ _emberRuntime.default._LegacyEachView = _emberViewsViewsLegacy_each_view.default;
+ }
+
+ // END EXPORTS
+
+ exports.default = _emberRuntime.default;
+});
+// for the side effect of extending Ember.run.queues
enifed('ember', ['exports', 'ember-metal', 'ember-runtime', 'ember-views', 'ember-routing', 'ember-application', 'ember-extension-support', 'ember-htmlbars', 'ember-routing-htmlbars', 'ember-routing-views', 'ember-metal/core', 'ember-runtime/system/lazy_load'], function (exports, _emberMetal, _emberRuntime, _emberViews, _emberRouting, _emberApplication, _emberExtensionSupport, _emberHtmlbars, _emberRoutingHtmlbars, _emberRoutingViews, _emberMetalCore, _emberRuntimeSystemLazy_load) {
// require the main entry points for each of these packages
// this is so that the global exports occur properly
'use strict';
@@ -43147,28 +43867,10 @@
/**
@module ember
*/
});
-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: _htmlbarsUtilMorphUtils.validateChildMorphs,
- clearMorph: _htmlbarsUtilTemplateUtils.clearMorph
- };
-
- exports.hooks = _htmlbarsRuntimeHooks.default;
- exports.render = _htmlbarsRuntimeRender.default;
- exports.internal = internal;
-});
enifed('htmlbars-runtime/expression-visitor', ['exports'], function (exports) {
/**
# Expression Nodes:
These nodes are not directly responsible for any part of the DOM, but are
@@ -43257,11 +43959,11 @@
var parts = acceptParams(rawParts, env, scope);
return env.hooks.concat(env, parts);
}
});
-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) {
+enifed("htmlbars-runtime/hooks", ["exports", "htmlbars-runtime/render", "morph-range/morph-list", "htmlbars-util/object-utils", "htmlbars-util/morph-utils", "htmlbars-util/template-utils"], function (exports, _htmlbarsRuntimeRender, _morphRangeMorphList, _htmlbarsUtilObjectUtils, _htmlbarsUtilMorphUtils, _htmlbarsUtilTemplateUtils) {
"use strict";
exports.wrap = wrap;
exports.wrapForHelper = wrapForHelper;
exports.createScope = createScope;
@@ -43383,15 +44085,14 @@
arity: template.arity,
raw: template,
render: function (self, env, options, blockArguments) {
var scope = env.hooks.createFreshScope();
- options = options || {};
- options.self = self;
- options.blockArguments = blockArguments;
+ var contextualElement = options && options.contextualElement;
+ var renderOptions = new _htmlbarsRuntimeRender.RenderOptions(null, self, blockArguments, contextualElement);
- return _render.default(template, env, scope, options);
+ return _htmlbarsRuntimeRender.default(template, env, scope, renderOptions);
}
};
}
function wrapForHelper(template, env, scope, morph, renderState, visitor) {
@@ -43452,11 +44153,12 @@
}
morph.lastYielded = { self: self, template: template, shadowTemplate: null };
// Render the template that was selected by the helper
- _render.default(template, env, scope, { renderNode: morph, self: self, blockArguments: blockArguments });
+ var renderOptions = new _htmlbarsRuntimeRender.RenderOptions(morph, self, blockArguments);
+ _htmlbarsRuntimeRender.default(template, env, scope, renderOptions);
};
}
function yieldItem(template, env, parentScope, morph, renderState, visitor) {
// Initialize state that tracks multiple items being
@@ -43555,11 +44257,11 @@
}
handledMorphs[foundMorph.key] = foundMorph;
yieldTemplate(template, env, parentScope, foundMorph, renderState, visitor)(blockArguments, self);
} else {
- var childMorph = _render.createChildMorph(env.dom, morph);
+ var childMorph = _htmlbarsRuntimeRender.createChildMorph(env.dom, morph);
childMorph.key = key;
morphMap[key] = handledMorphs[key] = childMorph;
morphList.insertBeforeMorph(childMorph, currentMorph);
yieldTemplate(template, env, parentScope, childMorph, renderState, visitor)(blockArguments, self);
}
@@ -43882,17 +44584,17 @@
keyword.willRender(morph, env);
}
var lastState, newState;
if (keyword.setupState) {
- lastState = _htmlbarsUtilObjectUtils.shallowCopy(morph.state);
- newState = morph.state = keyword.setupState(lastState, env, scope, params, hash);
+ lastState = _htmlbarsUtilObjectUtils.shallowCopy(morph.getState());
+ newState = morph.setState(keyword.setupState(lastState, env, scope, params, hash));
}
if (keyword.childEnv) {
// Build the child environment...
- env = keyword.childEnv(morph.state, env);
+ env = keyword.childEnv(morph.getState(), env);
// ..then save off the child env builder on the render node. If the render
// node tree is re-rendered and this node is not dirty, the child env
// builder will still be invoked so that child dirty render nodes still get
// the correct child env.
@@ -43900,11 +44602,11 @@
}
var firstTime = !morph.rendered;
if (keyword.isEmpty) {
- var isEmpty = keyword.isEmpty(morph.state, env, scope, params, hash);
+ var isEmpty = keyword.isEmpty(morph.getState(), env, scope, params, hash);
if (isEmpty) {
if (!firstTime) {
_htmlbarsUtilTemplateUtils.clearMorph(morph, env, false);
}
@@ -44335,11 +45037,11 @@
function componentFallback(morph, env, scope, tagName, attrs, template) {
var element = env.dom.createElement(tagName);
for (var name in attrs) {
element.setAttribute(name, env.hooks.getValue(attrs[name]));
}
- var fragment = _render.default(template, env, scope, {}).fragment;
+ var fragment = _htmlbarsRuntimeRender.default(template, env, scope, {}).fragment;
element.appendChild(fragment);
morph.setNode(element);
}
function hasHelper(env, scope, helperName) {
@@ -44404,19 +45106,19 @@
inline: inline,
range: range,
keyword: keyword
};
});
-enifed("htmlbars-runtime/morph", ["exports", "../morph-range"], function (exports, _morphRange) {
+enifed("htmlbars-runtime/morph", ["exports", "morph-range"], function (exports, _morphRange) {
"use strict";
var guid = 1;
function HTMLBarsMorph(domHelper, contextualElement) {
this.super$constructor(domHelper, contextualElement);
- this.state = {};
+ this._state = undefined;
this.ownerNode = null;
this.isDirty = false;
this.isSubtreeDirty = false;
this.lastYielded = null;
this.lastResult = null;
@@ -44428,10 +45130,11 @@
this.linkedParams = null;
this.linkedResult = null;
this.childNodes = null;
this.rendered = false;
this.guid = "range" + guid++;
+ this.seen = false;
}
HTMLBarsMorph.empty = function (domHelper, contextualElement) {
var morph = new HTMLBarsMorph(domHelper, contextualElement);
morph.clear();
@@ -44452,13 +45155,27 @@
var prototype = HTMLBarsMorph.prototype = Object.create(_morphRange.default.prototype);
prototype.constructor = HTMLBarsMorph;
prototype.super$constructor = _morphRange.default;
+ prototype.getState = function () {
+ if (!this._state) {
+ this._state = {};
+ }
+
+ return this._state;
+ };
+
+ prototype.setState = function (newState) {
+ /*jshint -W093 */
+
+ return this._state = newState;
+ };
+
exports.default = HTMLBarsMorph;
});
-enifed("htmlbars-runtime/node-visitor", ["exports", "../htmlbars-util/morph-utils", "./expression-visitor"], function (exports, _htmlbarsUtilMorphUtils, _expressionVisitor) {
+enifed("htmlbars-runtime/node-visitor", ["exports", "htmlbars-util/morph-utils", "htmlbars-runtime/expression-visitor"], function (exports, _htmlbarsUtilMorphUtils, _htmlbarsRuntimeExpressionVisitor) {
"use strict";
/**
Node classification:
@@ -44482,12 +45199,12 @@
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);
+ params = params && _htmlbarsRuntimeExpressionVisitor.acceptParams(params, env, scope);
+ hash = hash && _htmlbarsRuntimeExpressionVisitor.acceptHash(hash, env, scope);
}
_htmlbarsUtilMorphUtils.linkParams(env, scope, morph, path, params, hash);
return [params, hash];
}
@@ -44641,24 +45358,25 @@
if (isDirty || isSubtreeDirty) {
callback(visitor);
} else {
if (morph.buildChildEnv) {
- env = morph.buildChildEnv(morph.state, env);
+ env = morph.buildChildEnv(morph.getState(), 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) {
+enifed("htmlbars-runtime/render", ["exports", "htmlbars-util/morph-utils", "htmlbars-runtime/node-visitor", "htmlbars-runtime/morph", "htmlbars-util/template-utils", "htmlbars-util/void-tag-names"], function (exports, _htmlbarsUtilMorphUtils, _htmlbarsRuntimeNodeVisitor, _htmlbarsRuntimeMorph, _htmlbarsUtilTemplateUtils, _htmlbarsUtilVoidTagNames) {
"use strict";
exports.default = render;
+ exports.RenderOptions = RenderOptions;
exports.manualElement = manualElement;
exports.attachAttributes = attachAttributes;
exports.createChildMorph = createChildMorph;
exports.getCachedFragment = getCachedFragment;
@@ -44682,10 +45400,17 @@
renderResult.render();
return renderResult;
}
+ function RenderOptions(renderNode, self, blockArguments, contextualElement) {
+ this.renderNode = renderNode || null;
+ this.self = self;
+ this.blockArguments = blockArguments || null;
+ this.contextualElement = contextualElement || null;
+ }
+
function RenderResult(env, scope, options, rootNode, ownerNode, nodes, fragment, template, shouldSetContent) {
this.root = rootNode;
this.fragment = fragment;
this.nodes = nodes;
@@ -44693,12 +45418,10 @@
this.statements = template.statements.slice();
this.env = env;
this.scope = scope;
this.shouldSetContent = shouldSetContent;
- this.bindScope();
-
if (options.self !== undefined) {
this.bindSelf(options.self);
}
if (options.blockArguments !== undefined) {
this.bindLocals(options.blockArguments);
@@ -44719,11 +45442,11 @@
ownerNode = rootNode.ownerNode;
shouldSetContent = true;
} else {
rootNode = dom.createMorph(null, fragment.firstChild, fragment.lastChild, contextualElement);
ownerNode = rootNode;
- initializeNode(rootNode, ownerNode);
+ rootNode.ownerNode = ownerNode;
shouldSetContent = false;
}
if (rootNode.childNodes) {
_htmlbarsUtilMorphUtils.visitChildren(rootNode.childNodes, function (node) {
@@ -44852,19 +45575,21 @@
return template;
}
RenderResult.prototype.initializeNodes = function (ownerNode) {
- _htmlbarsUtilArrayUtils.forEach(this.root.childNodes, function (node) {
- initializeNode(node, ownerNode);
- });
+ var childNodes = this.root.childNodes;
+
+ for (var i = 0, l = childNodes.length; i < l; i++) {
+ childNodes[i].ownerNode = ownerNode;
+ }
};
RenderResult.prototype.render = function () {
this.root.lastResult = this;
this.root.rendered = true;
- this.populateNodes(_nodeVisitor.AlwaysDirtyVisitor);
+ this.populateNodes(_htmlbarsRuntimeNodeVisitor.AlwaysDirtyVisitor);
if (this.shouldSetContent && this.root.setContent) {
this.root.setContent(this.fragment);
}
};
@@ -44874,15 +45599,15 @@
node.isDirty = true;
});
};
RenderResult.prototype.revalidate = function (env, self, blockArguments, scope) {
- this.revalidateWith(env, scope, self, blockArguments, _nodeVisitor.default);
+ this.revalidateWith(env, scope, self, blockArguments, _htmlbarsRuntimeNodeVisitor.default);
};
RenderResult.prototype.rerender = function (env, self, blockArguments, scope) {
- this.revalidateWith(env, scope, self, blockArguments, _nodeVisitor.AlwaysDirtyVisitor);
+ this.revalidateWith(env, scope, self, blockArguments, _htmlbarsRuntimeNodeVisitor.AlwaysDirtyVisitor);
};
RenderResult.prototype.revalidateWith = function (env, scope, self, blockArguments, visitor) {
if (env !== undefined) {
this.env = env;
@@ -44979,11 +45704,11 @@
function initializeNode(node, owner) {
node.ownerNode = owner;
}
function createChildMorph(dom, parentMorph, contextualElement) {
- var morph = _morph.default.empty(dom, contextualElement || parentMorph.contextualElement);
+ var morph = _htmlbarsRuntimeMorph.default.empty(dom, contextualElement || parentMorph.contextualElement);
initializeNode(morph, parentMorph.ownerNode);
return morph;
}
function getCachedFragment(template, env) {
@@ -45006,19 +45731,27 @@
}
return fragment;
}
});
-enifed('htmlbars-util', ['exports', './htmlbars-util/safe-string', './htmlbars-util/handlebars/utils', './htmlbars-util/namespaces', './htmlbars-util/morph-utils'], function (exports, _htmlbarsUtilSafeString, _htmlbarsUtilHandlebarsUtils, _htmlbarsUtilNamespaces, _htmlbarsUtilMorphUtils) {
+enifed('htmlbars-runtime', ['exports', 'htmlbars-runtime/hooks', 'htmlbars-runtime/render', 'htmlbars-util/morph-utils', 'htmlbars-util/template-utils'], function (exports, _htmlbarsRuntimeHooks, _htmlbarsRuntimeRender, _htmlbarsUtilMorphUtils, _htmlbarsUtilTemplateUtils) {
'use strict';
- exports.SafeString = _htmlbarsUtilSafeString.default;
- exports.escapeExpression = _htmlbarsUtilHandlebarsUtils.escapeExpression;
- exports.getAttrNamespace = _htmlbarsUtilNamespaces.getAttrNamespace;
- exports.validateChildMorphs = _htmlbarsUtilMorphUtils.validateChildMorphs;
- exports.linkParams = _htmlbarsUtilMorphUtils.linkParams;
- exports.dump = _htmlbarsUtilMorphUtils.dump;
+ var internal = {
+ blockFor: _htmlbarsUtilTemplateUtils.blockFor,
+ manualElement: _htmlbarsRuntimeRender.manualElement,
+ hostBlock: _htmlbarsRuntimeHooks.hostBlock,
+ continueBlock: _htmlbarsRuntimeHooks.continueBlock,
+ hostYieldWithShadowTemplate: _htmlbarsRuntimeHooks.hostYieldWithShadowTemplate,
+ visitChildren: _htmlbarsUtilMorphUtils.visitChildren,
+ validateChildMorphs: _htmlbarsUtilMorphUtils.validateChildMorphs,
+ clearMorph: _htmlbarsUtilTemplateUtils.clearMorph
+ };
+
+ exports.hooks = _htmlbarsRuntimeHooks.default;
+ exports.render = _htmlbarsRuntimeRender.default;
+ exports.internal = internal;
});
enifed('htmlbars-util/array-utils', ['exports'], function (exports) {
'use strict';
exports.forEach = forEach;
@@ -45314,11 +46047,15 @@
svg: 'http://www.w3.org/2000/svg',
xlink: 'http://www.w3.org/1999/xlink',
xml: 'http://www.w3.org/XML/1998/namespace'
};
- function getAttrNamespace(attrName) {
+ function getAttrNamespace(attrName, detectedNamespace) {
+ if (detectedNamespace) {
+ return detectedNamespace;
+ }
+
var namespace;
var colonIndex = attrName.indexOf(':');
if (colonIndex !== -1) {
var prefix = attrName.slice(0, colonIndex);
@@ -45410,16 +46147,16 @@
str += chars;
}
return str;
}
});
-enifed('htmlbars-util/safe-string', ['exports', './handlebars/safe-string'], function (exports, _handlebarsSafeString) {
+enifed('htmlbars-util/safe-string', ['exports', 'htmlbars-util/handlebars/safe-string'], function (exports, _htmlbarsUtilHandlebarsSafeString) {
'use strict';
- exports.default = _handlebarsSafeString.default;
+ exports.default = _htmlbarsUtilHandlebarsSafeString.default;
});
-enifed("htmlbars-util/template-utils", ["exports", "../htmlbars-util/morph-utils"], function (exports, _htmlbarsUtilMorphUtils) {
+enifed("htmlbars-util/template-utils", ["exports", "htmlbars-util/morph-utils", "htmlbars-runtime/render"], function (exports, _htmlbarsUtilMorphUtils, _htmlbarsRuntimeRender) {
"use strict";
exports.RenderState = RenderState;
exports.blockFor = blockFor;
exports.renderAndCleanup = renderAndCleanup;
@@ -45456,40 +46193,41 @@
this.template = template;
this.blockOptions = blockOptions;
this.arity = template.arity;
}
- Block.prototype.invoke = function (env, blockArguments, self, renderNode, parentScope, visitor) {
- var _this = this;
-
+ Block.prototype.invoke = function (env, blockArguments, _self, renderNode, parentScope, visitor) {
if (renderNode.lastResult) {
- renderNode.lastResult.revalidateWith(env, undefined, self, blockArguments, visitor);
+ renderNode.lastResult.revalidateWith(env, undefined, _self, blockArguments, visitor);
} else {
- (function () {
- var options = { renderState: new RenderState(renderNode) };
- var render = _this.render;
- var template = _this.template;
- var scope = _this.blockOptions.scope;
+ this._firstRender(env, blockArguments, _self, renderNode, parentScope);
+ }
+ };
- var shadowScope = scope ? env.hooks.createChildScope(scope) : env.hooks.createFreshScope();
+ Block.prototype._firstRender = function (env, blockArguments, _self, renderNode, parentScope) {
+ var options = { renderState: new RenderState(renderNode) };
+ var render = this.render;
+ var template = this.template;
+ var scope = this.blockOptions.scope;
- env.hooks.bindShadowScope(env, parentScope, shadowScope, _this.blockOptions.options);
+ var shadowScope = scope ? env.hooks.createChildScope(scope) : env.hooks.createFreshScope();
- if (self !== undefined) {
- env.hooks.bindSelf(env, shadowScope, self);
- } else if (_this.blockOptions.self !== undefined) {
- env.hooks.bindSelf(env, shadowScope, _this.blockOptions.self);
- }
+ env.hooks.bindShadowScope(env, parentScope, shadowScope, this.blockOptions.options);
- bindBlocks(env, shadowScope, _this.blockOptions.yieldTo);
-
- renderAndCleanup(renderNode, env, options, null, function () {
- options.renderState.morphToClear = null;
- render(template, env, shadowScope, { renderNode: renderNode, blockArguments: blockArguments });
- });
- })();
+ if (_self !== undefined) {
+ env.hooks.bindSelf(env, shadowScope, _self);
+ } else if (this.blockOptions.self !== undefined) {
+ env.hooks.bindSelf(env, shadowScope, this.blockOptions.self);
}
+
+ bindBlocks(env, shadowScope, this.blockOptions.yieldTo);
+
+ renderAndCleanup(renderNode, env, options, null, function () {
+ options.renderState.morphToClear = null;
+ var renderOptions = new _htmlbarsRuntimeRender.RenderOptions(renderNode, undefined, blockArguments);
+ render(template, env, shadowScope, renderOptions);
+ });
};
function blockFor(render, template, blockOptions) {
return new Block(render, template, blockOptions);
}
@@ -45616,27 +46354,101 @@
// Remove the MorphList from the morph.
morphList.clear();
morph.morphList = null;
}
});
-enifed("htmlbars-util/void-tag-names", ["exports", "./array-utils"], function (exports, _arrayUtils) {
+enifed("htmlbars-util/void-tag-names", ["exports", "htmlbars-util/array-utils"], function (exports, _htmlbarsUtilArrayUtils) {
"use strict";
// The HTML elements in this list are speced by
// http://www.w3.org/TR/html-markup/syntax.html#syntax-elements,
// and will be forced to close regardless of if they have a
// self-closing /> at the end.
var voidTagNames = "area base br col command embed hr img input keygen link meta param source track wbr";
var voidMap = {};
- _arrayUtils.forEach(voidTagNames.split(" "), function (tagName) {
+ _htmlbarsUtilArrayUtils.forEach(voidTagNames.split(" "), function (tagName) {
voidMap[tagName] = true;
});
exports.default = voidMap;
});
-enifed("morph-attr", ["exports", "./morph-attr/sanitize-attribute-value", "./dom-helper/prop", "./dom-helper/build-html-dom", "./htmlbars-util"], function (exports, _morphAttrSanitizeAttributeValue, _domHelperProp, _domHelperBuildHtmlDom, _htmlbarsUtil) {
+enifed('htmlbars-util', ['exports', 'htmlbars-util/safe-string', 'htmlbars-util/handlebars/utils', 'htmlbars-util/namespaces', 'htmlbars-util/morph-utils'], function (exports, _htmlbarsUtilSafeString, _htmlbarsUtilHandlebarsUtils, _htmlbarsUtilNamespaces, _htmlbarsUtilMorphUtils) {
+ 'use strict';
+
+ exports.SafeString = _htmlbarsUtilSafeString.default;
+ exports.escapeExpression = _htmlbarsUtilHandlebarsUtils.escapeExpression;
+ exports.getAttrNamespace = _htmlbarsUtilNamespaces.getAttrNamespace;
+ exports.validateChildMorphs = _htmlbarsUtilMorphUtils.validateChildMorphs;
+ exports.linkParams = _htmlbarsUtilMorphUtils.linkParams;
+ exports.dump = _htmlbarsUtilMorphUtils.dump;
+});
+enifed('morph-attr/sanitize-attribute-value', ['exports'], function (exports) {
+ /* jshint scripturl:true */
+
+ 'use strict';
+
+ exports.sanitizeAttributeValue = sanitizeAttributeValue;
+ var badProtocols = {
+ 'javascript:': true,
+ 'vbscript:': true
+ };
+
+ var badTags = {
+ 'A': true,
+ 'BODY': true,
+ 'LINK': true,
+ 'IMG': true,
+ 'IFRAME': true,
+ 'BASE': true,
+ 'FORM': true
+ };
+
+ var badTagsForDataURI = {
+ 'EMBED': true
+ };
+
+ var badAttributes = {
+ 'href': true,
+ 'src': true,
+ 'background': true,
+ 'action': true
+ };
+
+ exports.badAttributes = badAttributes;
+ var badAttributesForDataURI = {
+ 'src': true
+ };
+
+ function sanitizeAttributeValue(dom, element, attribute, value) {
+ var tagName;
+
+ if (!element) {
+ tagName = null;
+ } else {
+ tagName = element.tagName.toUpperCase();
+ }
+
+ if (value && value.toHTML) {
+ return value.toHTML();
+ }
+
+ if ((tagName === null || badTags[tagName]) && badAttributes[attribute]) {
+ var protocol = dom.protocolForURL(value);
+ if (badProtocols[protocol] === true) {
+ return 'unsafe:' + value;
+ }
+ }
+
+ if (badTagsForDataURI[tagName] && badAttributesForDataURI[attribute]) {
+ return 'unsafe:' + value;
+ }
+
+ return value;
+ }
+});
+enifed("morph-attr", ["exports", "morph-attr/sanitize-attribute-value", "dom-helper/prop", "dom-helper/build-html-dom", "htmlbars-util"], function (exports, _morphAttrSanitizeAttributeValue, _domHelperProp, _domHelperBuildHtmlDom, _htmlbarsUtil) {
"use strict";
function getProperty() {
return this.domHelper.getPropertyStrict(this.element, this.attrName);
}
@@ -45676,52 +46488,76 @@
var UNSET = { unset: true };
var guid = 1;
- function AttrMorph(element, attrName, domHelper, namespace) {
+ AttrMorph.create = function (element, attrName, domHelper, namespace) {
+ var ns = _htmlbarsUtil.getAttrNamespace(attrName, namespace);
+
+ if (ns) {
+ return new AttributeNSAttrMorph(element, attrName, domHelper, ns);
+ } else {
+ return createNonNamespacedAttrMorph(element, attrName, domHelper);
+ }
+ };
+
+ function createNonNamespacedAttrMorph(element, attrName, domHelper) {
+ var _normalizeProperty = _domHelperProp.normalizeProperty(element, attrName);
+
+ var normalized = _normalizeProperty.normalized;
+ var type = _normalizeProperty.type;
+
+ if (element.namespaceURI === _domHelperBuildHtmlDom.svgNamespace || attrName === 'style' || type === 'attr') {
+ return new AttributeAttrMorph(element, normalized, domHelper);
+ } else {
+ return new PropertyAttrMorph(element, normalized, domHelper);
+ }
+ }
+
+ function AttrMorph(element, attrName, domHelper) {
this.element = element;
this.domHelper = domHelper;
- this.namespace = namespace !== undefined ? namespace : _htmlbarsUtil.getAttrNamespace(attrName);
- this.state = {};
+ this.attrName = attrName;
+ this._state = undefined;
this.isDirty = false;
this.isSubtreeDirty = false;
this.escaped = true;
this.lastValue = UNSET;
this.lastResult = null;
this.lastYielded = null;
this.childNodes = null;
this.linkedParams = null;
this.linkedResult = null;
this.guid = "attr" + guid++;
+ this.seen = false;
this.ownerNode = null;
this.rendered = false;
this._renderedInitially = false;
+ this.namespace = undefined;
+ this.didInit();
+ }
- if (this.namespace) {
- this._update = updateAttributeNS;
- this._get = getAttributeNS;
- this.attrName = attrName;
- } else {
- var _normalizeProperty = _domHelperProp.normalizeProperty(this.element, attrName);
+ AttrMorph.prototype.getState = function () {
+ if (!this._state) {
+ this._state = {};
+ }
- var normalized = _normalizeProperty.normalized;
- var type = _normalizeProperty.type;
+ return this._state;
+ };
- if (element.namespaceURI === _domHelperBuildHtmlDom.svgNamespace || attrName === 'style' || type === 'attr') {
- this._update = updateAttribute;
- this._get = getAttribute;
- this.attrName = normalized;
- } else {
- this._update = updateProperty;
- this._get = getProperty;
- this.attrName = normalized;
- }
- }
- }
+ AttrMorph.prototype.setState = function (newState) {
+ /*jshint -W093 */
+ return this._state = newState;
+ };
+
+ AttrMorph.prototype.didInit = function () {};
+ AttrMorph.prototype.willSetContent = function () {};
+
AttrMorph.prototype.setContent = function (value) {
+ this.willSetContent(value);
+
if (this.lastValue === value) {
return;
}
this.lastValue = value;
@@ -45748,78 +46584,180 @@
AttrMorph.prototype.destroy = function () {
this.element = null;
this.domHelper = null;
};
+ AttrMorph.prototype._$superAttrMorph = AttrMorph;
+
+ function PropertyAttrMorph(element, attrName, domHelper) {
+ this._$superAttrMorph(element, attrName, domHelper);
+ }
+
+ PropertyAttrMorph.prototype = Object.create(AttrMorph.prototype);
+ PropertyAttrMorph.prototype._update = updateProperty;
+ PropertyAttrMorph.prototype._get = getProperty;
+
+ function AttributeNSAttrMorph(element, attrName, domHelper, namespace) {
+ this._$superAttrMorph(element, attrName, domHelper);
+ this.namespace = namespace;
+ }
+
+ AttributeNSAttrMorph.prototype = Object.create(AttrMorph.prototype);
+ AttributeNSAttrMorph.prototype._update = updateAttributeNS;
+ AttributeNSAttrMorph.prototype._get = getAttributeNS;
+
+ function AttributeAttrMorph(element, attrName, domHelper) {
+ this._$superAttrMorph(element, attrName, domHelper);
+ }
+
+ AttributeAttrMorph.prototype = Object.create(AttrMorph.prototype);
+ AttributeAttrMorph.prototype._update = updateAttribute;
+ AttributeAttrMorph.prototype._get = getAttribute;
+
exports.default = AttrMorph;
exports.sanitizeAttributeValue = _morphAttrSanitizeAttributeValue.sanitizeAttributeValue;
});
-enifed('morph-attr/sanitize-attribute-value', ['exports'], function (exports) {
- /* jshint scripturl:true */
-
+enifed('morph-range/morph-list', ['exports', 'morph-range/utils'], function (exports, _morphRangeUtils) {
'use strict';
- exports.sanitizeAttributeValue = sanitizeAttributeValue;
- var badProtocols = {
- 'javascript:': true,
- 'vbscript:': true
- };
+ function MorphList() {
+ // morph graph
+ this.firstChildMorph = null;
+ this.lastChildMorph = null;
- var badTags = {
- 'A': true,
- 'BODY': true,
- 'LINK': true,
- 'IMG': true,
- 'IFRAME': true,
- 'BASE': true,
- 'FORM': true
- };
+ this.mountedMorph = null;
+ }
- var badTagsForDataURI = {
- 'EMBED': true
- };
+ var prototype = MorphList.prototype;
- var badAttributes = {
- 'href': true,
- 'src': true,
- 'background': true,
- 'action': true
+ prototype.clear = function MorphList$clear() {
+ var current = this.firstChildMorph;
+
+ while (current) {
+ var next = current.nextMorph;
+ current.previousMorph = null;
+ current.nextMorph = null;
+ current.parentMorphList = null;
+ current = next;
+ }
+
+ this.firstChildMorph = this.lastChildMorph = null;
};
- exports.badAttributes = badAttributes;
- var badAttributesForDataURI = {
- 'src': true
+ prototype.destroy = function MorphList$destroy() {};
+
+ prototype.appendMorph = function MorphList$appendMorph(morph) {
+ this.insertBeforeMorph(morph, null);
};
- function sanitizeAttributeValue(dom, element, attribute, value) {
- var tagName;
+ prototype.insertBeforeMorph = function MorphList$insertBeforeMorph(morph, referenceMorph) {
+ if (morph.parentMorphList !== null) {
+ morph.unlink();
+ }
+ if (referenceMorph && referenceMorph.parentMorphList !== this) {
+ throw new Error('The morph before which the new morph is to be inserted is not a child of this morph.');
+ }
- if (!element) {
- tagName = null;
+ var mountedMorph = this.mountedMorph;
+
+ if (mountedMorph) {
+
+ var parentNode = mountedMorph.firstNode.parentNode;
+ var referenceNode = referenceMorph ? referenceMorph.firstNode : mountedMorph.lastNode.nextSibling;
+
+ _morphRangeUtils.insertBefore(parentNode, morph.firstNode, morph.lastNode, referenceNode);
+
+ // was not in list mode replace current content
+ if (!this.firstChildMorph) {
+ _morphRangeUtils.clear(this.mountedMorph.firstNode.parentNode, this.mountedMorph.firstNode, this.mountedMorph.lastNode);
+ }
+ }
+
+ morph.parentMorphList = this;
+
+ var previousMorph = referenceMorph ? referenceMorph.previousMorph : this.lastChildMorph;
+ if (previousMorph) {
+ previousMorph.nextMorph = morph;
+ morph.previousMorph = previousMorph;
} else {
- tagName = element.tagName.toUpperCase();
+ this.firstChildMorph = morph;
}
- if (value && value.toHTML) {
- return value.toHTML();
+ if (referenceMorph) {
+ referenceMorph.previousMorph = morph;
+ morph.nextMorph = referenceMorph;
+ } else {
+ this.lastChildMorph = morph;
}
- if ((tagName === null || badTags[tagName]) && badAttributes[attribute]) {
- var protocol = dom.protocolForURL(value);
- if (badProtocols[protocol] === true) {
- return 'unsafe:' + value;
- }
+ this.firstChildMorph._syncFirstNode();
+ this.lastChildMorph._syncLastNode();
+ };
+
+ prototype.removeChildMorph = function MorphList$removeChildMorph(morph) {
+ if (morph.parentMorphList !== this) {
+ throw new Error("Cannot remove a morph from a parent it is not inside of");
}
- if (badTagsForDataURI[tagName] && badAttributesForDataURI[attribute]) {
- return 'unsafe:' + value;
+ morph.destroy();
+ };
+
+ exports.default = MorphList;
+});
+enifed('morph-range/morph-list.umd', ['exports', 'morph-range/morph-list'], function (exports, _morphRangeMorphList) {
+ 'use strict';
+
+ (function (root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ define([], factory);
+ } else if (typeof exports === 'object') {
+ module.exports = factory();
+ } else {
+ root.MorphList = factory();
}
+ })(undefined, function () {
+ return _morphRangeMorphList.default;
+ });
+});
+enifed("morph-range/utils", ["exports"], function (exports) {
+ // inclusive of both nodes
+ "use strict";
- return value;
+ exports.clear = clear;
+ exports.insertBefore = insertBefore;
+
+ function clear(parentNode, firstNode, lastNode) {
+ if (!parentNode) {
+ return;
+ }
+
+ var node = firstNode;
+ var nextNode;
+ do {
+ nextNode = node.nextSibling;
+ parentNode.removeChild(node);
+ if (node === lastNode) {
+ break;
+ }
+ node = nextNode;
+ } while (node);
}
+
+ function insertBefore(parentNode, firstNode, lastNode, refNode) {
+ var node = firstNode;
+ var nextNode;
+ do {
+ nextNode = node.nextSibling;
+ parentNode.insertBefore(node, refNode);
+ if (node === lastNode) {
+ break;
+ }
+ node = nextNode;
+ } while (node);
+ }
});
-enifed('morph-range', ['exports', './morph-range/utils'], function (exports, _morphRangeUtils) {
+enifed('morph-range', ['exports', 'morph-range/utils'], function (exports, _morphRangeUtils) {
'use strict';
// constructor just initializes the fields
// use one of the static initializers to create a valid morph.
function Morph(domHelper, contextualElement) {
@@ -45873,25 +46811,40 @@
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 */
case 'boolean':
case 'number':
return this.setText(content.toString());
+ case 'function':
+ raiseCannotBindToFunction(content);
default:
throw new TypeError('unsupported content');
}
};
+ function raiseCannotBindToFunction(content) {
+ var functionName = content.name;
+ var message;
+
+ if (functionName) {
+ message = 'Unsupported Content: Cannot bind to function `' + functionName + '`';
+ } else {
+ message = 'Unsupported Content: Cannot bind to function';
+ }
+
+ throw new TypeError(message);
+ }
+
Morph.prototype.clear = function Morph$clear() {
var node = this.setNode(this.domHelper.createComment(''));
return node;
};
@@ -46079,150 +47032,119 @@
_morphRangeUtils.insertBefore(parentNode, this.firstNode, this.lastNode, null);
};
exports.default = Morph;
});
-enifed('morph-range/morph-list', ['exports', './utils'], function (exports, _utils) {
- 'use strict';
+enifed("route-recognizer/dsl", ["exports"], function (exports) {
+ "use strict";
- function MorphList() {
- // morph graph
- this.firstChildMorph = null;
- this.lastChildMorph = null;
-
- this.mountedMorph = null;
+ function Target(path, matcher, delegate) {
+ this.path = path;
+ this.matcher = matcher;
+ this.delegate = delegate;
}
- var prototype = MorphList.prototype;
+ Target.prototype = {
+ to: function (target, callback) {
+ var delegate = this.delegate;
- prototype.clear = function MorphList$clear() {
- var current = this.firstChildMorph;
+ if (delegate && delegate.willAddRoute) {
+ target = delegate.willAddRoute(this.matcher.target, target);
+ }
- while (current) {
- var next = current.nextMorph;
- current.previousMorph = null;
- current.nextMorph = null;
- current.parentMorphList = null;
- current = next;
- }
+ this.matcher.add(this.path, target);
- this.firstChildMorph = this.lastChildMorph = null;
+ if (callback) {
+ if (callback.length === 0) {
+ throw new Error("You must have an argument in the function passed to `to`");
+ }
+ this.matcher.addChild(this.path, target, callback, this.delegate);
+ }
+ return this;
+ }
};
- prototype.destroy = function MorphList$destroy() {};
+ function Matcher(target) {
+ this.routes = {};
+ this.children = {};
+ this.target = target;
+ }
- prototype.appendMorph = function MorphList$appendMorph(morph) {
- this.insertBeforeMorph(morph, null);
- };
+ Matcher.prototype = {
+ add: function (path, handler) {
+ this.routes[path] = handler;
+ },
- prototype.insertBeforeMorph = function MorphList$insertBeforeMorph(morph, referenceMorph) {
- if (morph.parentMorphList !== null) {
- morph.unlink();
- }
- if (referenceMorph && referenceMorph.parentMorphList !== this) {
- throw new Error('The morph before which the new morph is to be inserted is not a child of this morph.');
- }
+ addChild: function (path, target, callback, delegate) {
+ var matcher = new Matcher(target);
+ this.children[path] = matcher;
- var mountedMorph = this.mountedMorph;
+ var match = generateMatch(path, matcher, delegate);
- if (mountedMorph) {
-
- var parentNode = mountedMorph.firstNode.parentNode;
- var referenceNode = referenceMorph ? referenceMorph.firstNode : mountedMorph.lastNode.nextSibling;
-
- _utils.insertBefore(parentNode, morph.firstNode, morph.lastNode, referenceNode);
-
- // was not in list mode replace current content
- if (!this.firstChildMorph) {
- _utils.clear(this.mountedMorph.firstNode.parentNode, this.mountedMorph.firstNode, this.mountedMorph.lastNode);
+ if (delegate && delegate.contextEntered) {
+ delegate.contextEntered(target, match);
}
- }
- morph.parentMorphList = this;
-
- var previousMorph = referenceMorph ? referenceMorph.previousMorph : this.lastChildMorph;
- if (previousMorph) {
- previousMorph.nextMorph = morph;
- morph.previousMorph = previousMorph;
- } else {
- this.firstChildMorph = morph;
+ callback(match);
}
+ };
- if (referenceMorph) {
- referenceMorph.previousMorph = morph;
- morph.nextMorph = referenceMorph;
- } else {
- this.lastChildMorph = morph;
- }
+ function generateMatch(startingPath, matcher, delegate) {
+ return function (path, nestedCallback) {
+ var fullPath = startingPath + path;
- this.firstChildMorph._syncFirstNode();
- this.lastChildMorph._syncLastNode();
- };
+ if (nestedCallback) {
+ nestedCallback(generateMatch(fullPath, matcher, delegate));
+ } else {
+ return new Target(startingPath + path, matcher, delegate);
+ }
+ };
+ }
- prototype.removeChildMorph = function MorphList$removeChildMorph(morph) {
- if (morph.parentMorphList !== this) {
- throw new Error("Cannot remove a morph from a parent it is not inside of");
+ function addRoute(routeArray, path, handler) {
+ var len = 0;
+ for (var i = 0, l = routeArray.length; i < l; i++) {
+ len += routeArray[i].path.length;
}
- morph.destroy();
- };
+ path = path.substr(len);
+ var route = { path: path, handler: handler };
+ routeArray.push(route);
+ }
- exports.default = MorphList;
-});
-enifed('morph-range/morph-list.umd', ['exports', './morph-list'], function (exports, _morphList) {
- 'use strict';
+ function eachRoute(baseRoute, matcher, callback, binding) {
+ var routes = matcher.routes;
- (function (root, factory) {
- if (typeof enifed === 'function' && enifed.amd) {
- enifed([], factory);
- } else if (typeof exports === 'object') {
- module.exports = factory();
- } else {
- root.MorphList = factory();
+ for (var path in routes) {
+ if (routes.hasOwnProperty(path)) {
+ var routeArray = baseRoute.slice();
+ addRoute(routeArray, path, routes[path]);
+
+ if (matcher.children[path]) {
+ eachRoute(routeArray, matcher.children[path], callback, binding);
+ } else {
+ callback.call(binding, routeArray);
+ }
+ }
}
- })(undefined, function () {
- return _morphList.default;
- });
-});
-enifed("morph-range/utils", ["exports"], function (exports) {
- // inclusive of both nodes
- "use strict";
+ }
- exports.clear = clear;
- exports.insertBefore = insertBefore;
+ exports.default = function (callback, addRouteCallback) {
+ var matcher = new Matcher();
- function clear(parentNode, firstNode, lastNode) {
- if (!parentNode) {
- return;
- }
+ callback(generateMatch("", matcher, this.delegate));
- var node = firstNode;
- var nextNode;
- do {
- nextNode = node.nextSibling;
- parentNode.removeChild(node);
- if (node === lastNode) {
- break;
+ eachRoute([], matcher, function (route) {
+ if (addRouteCallback) {
+ addRouteCallback(this, route);
+ } else {
+ this.add(route);
}
- node = nextNode;
- } while (node);
- }
-
- function insertBefore(parentNode, firstNode, lastNode, refNode) {
- var node = firstNode;
- var nextNode;
- do {
- nextNode = node.nextSibling;
- parentNode.insertBefore(node, refNode);
- if (node === lastNode) {
- break;
- }
- node = nextNode;
- } while (node);
- }
+ }, this);
+ };
});
-enifed('route-recognizer', ['exports', './route-recognizer/dsl'], function (exports, _routeRecognizerDsl) {
+enifed('route-recognizer', ['exports', 'route-recognizer/dsl'], function (exports, _routeRecognizerDsl) {
'use strict';
var specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'];
var escapeRegex = new RegExp('(\\' + specials.join('|\\') + ')', 'g');
@@ -46817,129 +47739,139 @@
RouteRecognizer.VERSION = '0.1.5';
exports.default = RouteRecognizer;
});
-enifed("route-recognizer/dsl", ["exports"], function (exports) {
- "use strict";
+enifed('router/handler-info/factory', ['exports', 'router/handler-info/resolved-handler-info', 'router/handler-info/unresolved-handler-info-by-object', 'router/handler-info/unresolved-handler-info-by-param'], function (exports, _routerHandlerInfoResolvedHandlerInfo, _routerHandlerInfoUnresolvedHandlerInfoByObject, _routerHandlerInfoUnresolvedHandlerInfoByParam) {
+ 'use strict';
- function Target(path, matcher, delegate) {
- this.path = path;
- this.matcher = matcher;
- this.delegate = delegate;
+ handlerInfoFactory.klasses = {
+ resolved: _routerHandlerInfoResolvedHandlerInfo.default,
+ param: _routerHandlerInfoUnresolvedHandlerInfoByParam.default,
+ object: _routerHandlerInfoUnresolvedHandlerInfoByObject.default
+ };
+
+ function handlerInfoFactory(name, props) {
+ var Ctor = handlerInfoFactory.klasses[name],
+ handlerInfo = new Ctor(props || {});
+ handlerInfo.factory = handlerInfoFactory;
+ return handlerInfo;
}
- Target.prototype = {
- to: function (target, callback) {
- var delegate = this.delegate;
+ exports.default = handlerInfoFactory;
+});
+enifed('router/handler-info/resolved-handler-info', ['exports', 'router/handler-info', 'router/utils', 'rsvp/promise'], function (exports, _routerHandlerInfo, _routerUtils, _rsvpPromise) {
+ 'use strict';
- if (delegate && delegate.willAddRoute) {
- target = delegate.willAddRoute(this.matcher.target, target);
+ var ResolvedHandlerInfo = _routerUtils.subclass(_routerHandlerInfo.default, {
+ resolve: function (shouldContinue, payload) {
+ // A ResolvedHandlerInfo just resolved with itself.
+ if (payload && payload.resolvedModels) {
+ payload.resolvedModels[this.name] = this.context;
}
+ return _rsvpPromise.default.resolve(this, this.promiseLabel("Resolve"));
+ },
- this.matcher.add(this.path, target);
+ getUnresolved: function () {
+ return this.factory('param', {
+ name: this.name,
+ handler: this.handler,
+ params: this.params
+ });
+ },
- if (callback) {
- if (callback.length === 0) {
- throw new Error("You must have an argument in the function passed to `to`");
- }
- this.matcher.addChild(this.path, target, callback, this.delegate);
- }
- return this;
- }
- };
+ isResolved: true
+ });
- function Matcher(target) {
- this.routes = {};
- this.children = {};
- this.target = target;
- }
+ exports.default = ResolvedHandlerInfo;
+});
+enifed('router/handler-info/unresolved-handler-info-by-object', ['exports', 'router/handler-info', 'router/utils', 'rsvp/promise'], function (exports, _routerHandlerInfo, _routerUtils, _rsvpPromise) {
+ 'use strict';
- Matcher.prototype = {
- add: function (path, handler) {
- this.routes[path] = handler;
+ var UnresolvedHandlerInfoByObject = _routerUtils.subclass(_routerHandlerInfo.default, {
+ getModel: function (payload) {
+ this.log(payload, this.name + ": resolving provided model");
+ return _rsvpPromise.default.resolve(this.context);
},
- addChild: function (path, target, callback, delegate) {
- var matcher = new Matcher(target);
- this.children[path] = matcher;
+ initialize: function (props) {
+ this.names = props.names || [];
+ this.context = props.context;
+ },
- var match = generateMatch(path, matcher, delegate);
+ /**
+ @private
+ Serializes a handler using its custom `serialize` method or
+ by a default that looks up the expected property name from
+ the dynamic segment.
+ @param {Object} model the model to be serialized for this handler
+ */
+ serialize: function (_model) {
+ var model = _model || this.context,
+ names = this.names,
+ handler = this.handler;
- if (delegate && delegate.contextEntered) {
- delegate.contextEntered(target, match);
+ var object = {};
+ if (_routerUtils.isParam(model)) {
+ object[names[0]] = model;
+ return object;
}
- callback(match);
- }
- };
+ // Use custom serialize if it exists.
+ if (handler.serialize) {
+ return handler.serialize(model, names);
+ }
- function generateMatch(startingPath, matcher, delegate) {
- return function (path, nestedCallback) {
- var fullPath = startingPath + path;
+ if (names.length !== 1) {
+ return;
+ }
- if (nestedCallback) {
- nestedCallback(generateMatch(fullPath, matcher, delegate));
+ var name = names[0];
+
+ if (/_id$/.test(name)) {
+ object[name] = model.id;
} else {
- return new Target(startingPath + path, matcher, delegate);
+ object[name] = model;
}
- };
- }
-
- function addRoute(routeArray, path, handler) {
- var len = 0;
- for (var i = 0, l = routeArray.length; i < l; i++) {
- len += routeArray[i].path.length;
+ return object;
}
+ });
- path = path.substr(len);
- var route = { path: path, handler: handler };
- routeArray.push(route);
- }
+ exports.default = UnresolvedHandlerInfoByObject;
+});
+enifed('router/handler-info/unresolved-handler-info-by-param', ['exports', 'router/handler-info', 'router/utils'], function (exports, _routerHandlerInfo, _routerUtils) {
+ 'use strict';
- function eachRoute(baseRoute, matcher, callback, binding) {
- var routes = matcher.routes;
+ // Generated by URL transitions and non-dynamic route segments in named Transitions.
+ var UnresolvedHandlerInfoByParam = _routerUtils.subclass(_routerHandlerInfo.default, {
+ initialize: function (props) {
+ this.params = props.params || {};
+ },
- for (var path in routes) {
- if (routes.hasOwnProperty(path)) {
- var routeArray = baseRoute.slice();
- addRoute(routeArray, path, routes[path]);
-
- if (matcher.children[path]) {
- eachRoute(routeArray, matcher.children[path], callback, binding);
- } else {
- callback.call(binding, routeArray);
- }
+ getModel: function (payload) {
+ var fullParams = this.params;
+ if (payload && payload.queryParams) {
+ fullParams = {};
+ _routerUtils.merge(fullParams, this.params);
+ fullParams.queryParams = payload.queryParams;
}
- }
- }
- exports.default = function (callback, addRouteCallback) {
- var matcher = new Matcher();
+ var handler = this.handler;
+ var hookName = _routerUtils.resolveHook(handler, 'deserialize') || _routerUtils.resolveHook(handler, 'model');
- callback(generateMatch("", matcher, this.delegate));
+ return this.runSharedModelHook(payload, hookName, [fullParams]);
+ }
+ });
- eachRoute([], matcher, function (route) {
- if (addRouteCallback) {
- addRouteCallback(this, route);
- } else {
- this.add(route);
- }
- }, this);
- };
+ exports.default = UnresolvedHandlerInfoByParam;
});
-enifed('router', ['exports', './router/router'], function (exports, _routerRouter) {
+enifed('router/handler-info', ['exports', 'router/utils', 'rsvp/promise'], function (exports, _routerUtils, _rsvpPromise) {
'use strict';
- exports.default = _routerRouter.default;
-});
-enifed('router/handler-info', ['exports', './utils', 'rsvp/promise'], function (exports, _utils, _rsvpPromise) {
- 'use strict';
-
function HandlerInfo(_props) {
var props = _props || {};
- _utils.merge(this, props);
+ _routerUtils.merge(this, props);
this.initialize(props);
}
HandlerInfo.prototype = {
name: null,
@@ -46957,11 +47889,11 @@
payload.log(this.name + ': ' + message);
}
},
promiseLabel: function (label) {
- return _utils.promiseLabel("'" + this.name + "' " + label);
+ return _routerUtils.promiseLabel("'" + this.name + "' " + label);
},
getUnresolved: function () {
return this;
},
@@ -46969,15 +47901,15 @@
serialize: function () {
return this.params || {};
},
resolve: function (shouldContinue, payload) {
- var checkForAbort = _utils.bind(this, this.checkForAbort, shouldContinue),
- beforeModel = _utils.bind(this, this.runBeforeModelHook, payload),
- model = _utils.bind(this, this.getModel, payload),
- afterModel = _utils.bind(this, this.runAfterModelHook, payload),
- becomeResolved = _utils.bind(this, this.becomeResolved, payload);
+ var checkForAbort = _routerUtils.bind(this, this.checkForAbort, shouldContinue),
+ beforeModel = _routerUtils.bind(this, this.runBeforeModelHook, payload),
+ model = _routerUtils.bind(this, this.getModel, payload),
+ afterModel = _routerUtils.bind(this, this.runAfterModelHook, payload),
+ becomeResolved = _routerUtils.bind(this, this.becomeResolved, payload);
return _rsvpPromise.default.resolve(undefined, this.promiseLabel("Start handler")).then(checkForAbort, null, this.promiseLabel("Check for abort")).then(beforeModel, null, this.promiseLabel("Before model")).then(checkForAbort, null, this.promiseLabel("Check if aborted during 'beforeModel' hook")).then(model, null, this.promiseLabel("Model")).then(checkForAbort, null, this.promiseLabel("Check if aborted in 'model' hook")).then(afterModel, null, this.promiseLabel("After model")).then(checkForAbort, null, this.promiseLabel("Check if aborted in 'afterModel' hook")).then(becomeResolved, null, this.promiseLabel("Become resolved"));
},
runBeforeModelHook: function (payload) {
@@ -47008,11 +47940,11 @@
if (this.queryParams) {
args.push(this.queryParams);
}
args.push(payload);
- var result = _utils.applyHook(this.handler, hookName, args);
+ var result = _routerUtils.applyHook(this.handler, hookName, args);
if (result && result.isTransition) {
result = null;
}
@@ -47090,136 +48022,13 @@
return true;
}
exports.default = HandlerInfo;
});
-enifed('router/handler-info/factory', ['exports', 'router/handler-info/resolved-handler-info', 'router/handler-info/unresolved-handler-info-by-object', 'router/handler-info/unresolved-handler-info-by-param'], function (exports, _routerHandlerInfoResolvedHandlerInfo, _routerHandlerInfoUnresolvedHandlerInfoByObject, _routerHandlerInfoUnresolvedHandlerInfoByParam) {
+enifed('router/router', ['exports', 'route-recognizer', 'rsvp/promise', 'router/utils', 'router/transition-state', 'router/transition', 'router/transition-intent/named-transition-intent', 'router/transition-intent/url-transition-intent', 'router/handler-info'], function (exports, _routeRecognizer, _rsvpPromise, _routerUtils, _routerTransitionState, _routerTransition, _routerTransitionIntentNamedTransitionIntent, _routerTransitionIntentUrlTransitionIntent, _routerHandlerInfo) {
'use strict';
- handlerInfoFactory.klasses = {
- resolved: _routerHandlerInfoResolvedHandlerInfo.default,
- param: _routerHandlerInfoUnresolvedHandlerInfoByParam.default,
- object: _routerHandlerInfoUnresolvedHandlerInfoByObject.default
- };
-
- function handlerInfoFactory(name, props) {
- var Ctor = handlerInfoFactory.klasses[name],
- handlerInfo = new Ctor(props || {});
- handlerInfo.factory = handlerInfoFactory;
- return handlerInfo;
- }
-
- exports.default = handlerInfoFactory;
-});
-enifed('router/handler-info/resolved-handler-info', ['exports', '../handler-info', 'router/utils', 'rsvp/promise'], function (exports, _handlerInfo, _routerUtils, _rsvpPromise) {
- 'use strict';
-
- var ResolvedHandlerInfo = _routerUtils.subclass(_handlerInfo.default, {
- resolve: function (shouldContinue, payload) {
- // A ResolvedHandlerInfo just resolved with itself.
- if (payload && payload.resolvedModels) {
- payload.resolvedModels[this.name] = this.context;
- }
- return _rsvpPromise.default.resolve(this, this.promiseLabel("Resolve"));
- },
-
- getUnresolved: function () {
- return this.factory('param', {
- name: this.name,
- handler: this.handler,
- params: this.params
- });
- },
-
- isResolved: true
- });
-
- exports.default = ResolvedHandlerInfo;
-});
-enifed('router/handler-info/unresolved-handler-info-by-object', ['exports', '../handler-info', 'router/utils', 'rsvp/promise'], function (exports, _handlerInfo, _routerUtils, _rsvpPromise) {
- 'use strict';
-
- var UnresolvedHandlerInfoByObject = _routerUtils.subclass(_handlerInfo.default, {
- getModel: function (payload) {
- this.log(payload, this.name + ": resolving provided model");
- return _rsvpPromise.default.resolve(this.context);
- },
-
- initialize: function (props) {
- this.names = props.names || [];
- this.context = props.context;
- },
-
- /**
- @private
- Serializes a handler using its custom `serialize` method or
- by a default that looks up the expected property name from
- the dynamic segment.
- @param {Object} model the model to be serialized for this handler
- */
- serialize: function (_model) {
- var model = _model || this.context,
- names = this.names,
- handler = this.handler;
-
- var object = {};
- if (_routerUtils.isParam(model)) {
- object[names[0]] = model;
- return object;
- }
-
- // Use custom serialize if it exists.
- if (handler.serialize) {
- return handler.serialize(model, names);
- }
-
- if (names.length !== 1) {
- return;
- }
-
- var name = names[0];
-
- if (/_id$/.test(name)) {
- object[name] = model.id;
- } else {
- object[name] = model;
- }
- return object;
- }
- });
-
- exports.default = UnresolvedHandlerInfoByObject;
-});
-enifed('router/handler-info/unresolved-handler-info-by-param', ['exports', '../handler-info', 'router/utils'], function (exports, _handlerInfo, _routerUtils) {
- 'use strict';
-
- // Generated by URL transitions and non-dynamic route segments in named Transitions.
- var UnresolvedHandlerInfoByParam = _routerUtils.subclass(_handlerInfo.default, {
- initialize: function (props) {
- this.params = props.params || {};
- },
-
- getModel: function (payload) {
- var fullParams = this.params;
- if (payload && payload.queryParams) {
- fullParams = {};
- _routerUtils.merge(fullParams, this.params);
- fullParams.queryParams = payload.queryParams;
- }
-
- var handler = this.handler;
- var hookName = _routerUtils.resolveHook(handler, 'deserialize') || _routerUtils.resolveHook(handler, 'model');
-
- return this.runSharedModelHook(payload, hookName, [fullParams]);
- }
- });
-
- exports.default = UnresolvedHandlerInfoByParam;
-});
-enifed('router/router', ['exports', 'route-recognizer', 'rsvp/promise', './utils', './transition-state', './transition', './transition-intent/named-transition-intent', './transition-intent/url-transition-intent', './handler-info'], function (exports, _routeRecognizer, _rsvpPromise, _utils, _transitionState, _transition, _transitionIntentNamedTransitionIntent, _transitionIntentUrlTransitionIntent, _handlerInfo) {
- 'use strict';
-
var pop = Array.prototype.pop;
function Router(_options) {
var options = _options || {};
this.getHandler = options.getHandler || this.getHandler;
@@ -47239,11 +48048,11 @@
var wasTransitioning = !!this.activeTransition;
var oldState = wasTransitioning ? this.activeTransition.state : this.state;
var newTransition;
var newState = intent.applyToState(oldState, this.recognizer, this.getHandler, isIntermediate);
- var queryParamChangelist = _utils.getChangelist(oldState.queryParams, newState.queryParams);
+ var queryParamChangelist = _routerUtils.getChangelist(oldState.queryParams, newState.queryParams);
if (handlerInfosEqual(newState.handlerInfos, oldState.handlerInfos)) {
// This is a no-op transition. See if query params changed.
if (queryParamChangelist) {
@@ -47252,20 +48061,20 @@
return newTransition;
}
}
// No-op. No need to create a new transition.
- return this.activeTransition || new _transition.Transition(this);
+ return this.activeTransition || new _routerTransition.Transition(this);
}
if (isIntermediate) {
setupContexts(this, newState);
return;
}
// Create a new transition to the destination route.
- newTransition = new _transition.Transition(this, intent, newState);
+ newTransition = new _routerTransition.Transition(this, intent, newState);
// Abort and usurp any previously active transition.
if (this.activeTransition) {
this.activeTransition.abort();
}
@@ -47274,11 +48083,11 @@
// Transition promises by default resolve with resolved state.
// For our purposes, swap out the promise to resolve
// after the transition has been finalized.
newTransition.promise = newTransition.promise.then(function (result) {
return finalizeTransition(newTransition, result.state);
- }, null, _utils.promiseLabel("Settle transition promise when transition is finalized"));
+ }, null, _routerUtils.promiseLabel("Settle transition promise when transition is finalized"));
if (!wasTransitioning) {
notifyExistingHandlers(this, newState, newTransition);
}
@@ -47329,22 +48138,22 @@
// We have to return a noop transition that will
// perform a URL update at the end. This gives
// the user the ability to set the url update
// method (default is replaceState).
- var newTransition = new _transition.Transition(this);
+ var newTransition = new _routerTransition.Transition(this);
newTransition.queryParamsOnly = true;
oldState.queryParams = finalizeQueryParamChange(this, newState.handlerInfos, newState.queryParams, newTransition);
newTransition.promise = newTransition.promise.then(function (result) {
updateURL(newTransition, oldState, true);
if (router.didTransition) {
router.didTransition(router.currentHandlerInfos);
}
return result;
- }, null, _utils.promiseLabel("Transition complete"));
+ }, null, _routerUtils.promiseLabel("Transition complete"));
return newTransition;
}
},
// NOTE: this doesn't really belong here, but here
@@ -47352,28 +48161,28 @@
// handle cyclical deps.
transitionByIntent: function (intent, isIntermediate) {
try {
return getTransitionByIntent.apply(this, arguments);
} catch (e) {
- return new _transition.Transition(this, intent, null, e);
+ return new _routerTransition.Transition(this, intent, null, e);
}
},
/**
Clears the current and target route handlers and triggers exit
on each of them starting at the leaf and traversing up through
its ancestors.
*/
reset: function () {
if (this.state) {
- _utils.forEach(this.state.handlerInfos.slice().reverse(), function (handlerInfo) {
+ _routerUtils.forEach(this.state.handlerInfos.slice().reverse(), function (handlerInfo) {
var handler = handlerInfo.handler;
- _utils.callHook(handler, 'exit');
+ _routerUtils.callHook(handler, 'exit');
});
}
- this.state = new _transitionState.default();
+ this.state = new _routerTransitionState.default();
this.currentHandlerInfos = null;
},
activeTransition: null,
@@ -47387,11 +48196,11 @@
@return {Array} an Array of `[handler, parameter]` tuples
*/
handleURL: function (url) {
// Perform a URL-based transition, but don't change
// the URL afterward, since it already happened.
- var args = _utils.slice.call(arguments);
+ var args = _routerUtils.slice.call(arguments);
if (url.charAt(0) !== '/') {
args[0] = '/' + url;
}
return doTransition(this, args).method(null);
@@ -47435,12 +48244,12 @@
for (var i = 0, len = handlerInfos.length; i < len; ++i) {
var handlerInfo = handlerInfos[i];
params[handlerInfo.name] = handlerInfo.params || {};
}
- _utils.log(this, "Starting a refresh transition");
- var intent = new _transitionIntentNamedTransitionIntent.default({
+ _routerUtils.log(this, "Starting a refresh transition");
+ var intent = new _routerTransitionIntentNamedTransitionIntent.default({
name: handlerInfos[handlerInfos.length - 1].name,
pivotHandler: pivotHandler || handlerInfos[0].handler,
contexts: [], // TODO collect contexts...?
queryParams: this._changedQueryParams || state.queryParams || {}
});
@@ -47466,32 +48275,32 @@
@param {...Object} objects a list of objects to serialize
@return {String} a URL
*/
generate: function (handlerName) {
- var partitionedArgs = _utils.extractQueryParams(_utils.slice.call(arguments, 1)),
+ var partitionedArgs = _routerUtils.extractQueryParams(_routerUtils.slice.call(arguments, 1)),
suppliedParams = partitionedArgs[0],
queryParams = partitionedArgs[1];
// Construct a TransitionIntent with the provided params
// and apply it to the present state of the router.
- var intent = new _transitionIntentNamedTransitionIntent.default({ name: handlerName, contexts: suppliedParams });
+ var intent = new _routerTransitionIntentNamedTransitionIntent.default({ name: handlerName, contexts: suppliedParams });
var state = intent.applyToState(this.state, this.recognizer, this.getHandler);
var params = {};
for (var i = 0, len = state.handlerInfos.length; i < len; ++i) {
var handlerInfo = state.handlerInfos[i];
var handlerParams = handlerInfo.serialize();
- _utils.merge(params, handlerParams);
+ _routerUtils.merge(params, handlerParams);
}
params.queryParams = queryParams;
return this.recognizer.generate(handlerName, params);
},
applyIntent: function (handlerName, contexts) {
- var intent = new _transitionIntentNamedTransitionIntent.default({
+ var intent = new _routerTransitionIntentNamedTransitionIntent.default({
name: handlerName,
contexts: contexts
});
var state = this.activeTransition && this.activeTransition.state || this.state;
@@ -47527,15 +48336,15 @@
if (index === recogHandlers.length) {
// The provided route name isn't even in the route hierarchy.
return false;
}
- var testState = new _transitionState.default();
+ var testState = new _routerTransitionState.default();
testState.handlerInfos = targetHandlerInfos.slice(0, index + 1);
recogHandlers = recogHandlers.slice(0, index + 1);
- var intent = new _transitionIntentNamedTransitionIntent.default({
+ var intent = new _routerTransitionIntentNamedTransitionIntent.default({
name: targetHandler,
contexts: contexts
});
var newState = intent.applyToHandlers(testState, recogHandlers, this.getHandler, targetHandler, true, true);
@@ -47545,30 +48354,30 @@
return handlersEqual;
}
// Get a hash of QPs that will still be active on new route
var activeQPsOnNewHandler = {};
- _utils.merge(activeQPsOnNewHandler, queryParams);
+ _routerUtils.merge(activeQPsOnNewHandler, queryParams);
var activeQueryParams = state.queryParams;
for (var key in activeQueryParams) {
if (activeQueryParams.hasOwnProperty(key) && activeQPsOnNewHandler.hasOwnProperty(key)) {
activeQPsOnNewHandler[key] = activeQueryParams[key];
}
}
- return handlersEqual && !_utils.getChangelist(activeQPsOnNewHandler, queryParams);
+ return handlersEqual && !_routerUtils.getChangelist(activeQPsOnNewHandler, queryParams);
},
isActive: function (handlerName) {
- var partitionedArgs = _utils.extractQueryParams(_utils.slice.call(arguments, 1));
+ var partitionedArgs = _routerUtils.extractQueryParams(_routerUtils.slice.call(arguments, 1));
return this.isActiveIntent(handlerName, partitionedArgs[0], partitionedArgs[1]);
},
trigger: function (name) {
- var args = _utils.slice.call(arguments);
- _utils.trigger(this, this.currentHandlerInfos, false, args);
+ var args = _routerUtils.slice.call(arguments);
+ _routerUtils.trigger(this, this.currentHandlerInfos, false, args);
},
/**
Hook point for logging transition status updates.
@param {String} message The message to log.
@@ -47587,11 +48396,11 @@
// This is a little hacky but we need some way of storing
// changed query params given that no activeTransition
// is guaranteed to have occurred.
router._changedQueryParams = queryParamChangelist.all;
- _utils.trigger(router, newState.handlerInfos, true, ['queryParamsDidChange', queryParamChangelist.changed, queryParamChangelist.all, queryParamChangelist.removed]);
+ _routerUtils.trigger(router, newState.handlerInfos, true, ['queryParamsDidChange', queryParamChangelist.changed, queryParamChangelist.all, queryParamChangelist.removed]);
router._changedQueryParams = null;
}
}
/**
@@ -47641,22 +48450,22 @@
for (i = 0, l = partition.exited.length; i < l; i++) {
handler = partition.exited[i].handler;
delete handler.context;
- _utils.callHook(handler, 'reset', true, transition);
- _utils.callHook(handler, 'exit', transition);
+ _routerUtils.callHook(handler, 'reset', true, transition);
+ _routerUtils.callHook(handler, 'exit', transition);
}
var oldState = router.oldState = router.state;
router.state = newState;
var currentHandlerInfos = router.currentHandlerInfos = partition.unchanged.slice();
try {
for (i = 0, l = partition.reset.length; i < l; i++) {
handler = partition.reset[i].handler;
- _utils.callHook(handler, 'reset', false, transition);
+ _routerUtils.callHook(handler, 'reset', false, transition);
}
for (i = 0, l = partition.updatedContext.length; i < l; i++) {
handlerEnteredOrUpdated(currentHandlerInfos, partition.updatedContext[i], false, transition);
}
@@ -47683,22 +48492,22 @@
var handler = handlerInfo.handler,
context = handlerInfo.context;
if (enter) {
- _utils.callHook(handler, 'enter', transition);
+ _routerUtils.callHook(handler, 'enter', transition);
}
if (transition && transition.isAborted) {
- throw new _transition.TransitionAborted();
+ throw new _routerTransition.TransitionAborted();
}
handler.context = context;
- _utils.callHook(handler, 'contextDidChange');
+ _routerUtils.callHook(handler, 'contextDidChange');
- _utils.callHook(handler, 'setup', context, transition);
+ _routerUtils.callHook(handler, 'setup', context, transition);
if (transition && transition.isAborted) {
- throw new _transition.TransitionAborted();
+ throw new _routerTransition.TransitionAborted();
}
currentHandlerInfos.push(handlerInfo);
return true;
@@ -47804,11 +48613,11 @@
handlerName = handlerInfos[handlerInfos.length - 1].name,
params = {};
for (var i = handlerInfos.length - 1; i >= 0; --i) {
var handlerInfo = handlerInfos[i];
- _utils.merge(params, handlerInfo.params);
+ _routerUtils.merge(params, handlerInfo.params);
if (handlerInfo.handler.inaccessibleByURL) {
urlMethod = null;
}
}
@@ -47831,11 +48640,11 @@
to update the router's array of `currentHandlerInfos`.
*/
function finalizeTransition(transition, newState) {
try {
- _utils.log(transition.router, transition.sequence, "Resolved all models on destination route; finalizing transition.");
+ _routerUtils.log(transition.router, transition.sequence, "Resolved all models on destination route; finalizing transition.");
var router = transition.router,
handlerInfos = newState.handlerInfos,
seq = transition.sequence;
@@ -47844,30 +48653,30 @@
// Check if a redirect occurred in enter/setup
if (transition.isAborted) {
// TODO: cleaner way? distinguish b/w targetHandlerInfos?
router.state.handlerInfos = router.currentHandlerInfos;
- return _rsvpPromise.default.reject(_transition.logAbort(transition));
+ return _rsvpPromise.default.reject(_routerTransition.logAbort(transition));
}
updateURL(transition, newState, transition.intent.url);
transition.isActive = false;
router.activeTransition = null;
- _utils.trigger(router, router.currentHandlerInfos, true, ['didTransition']);
+ _routerUtils.trigger(router, router.currentHandlerInfos, true, ['didTransition']);
if (router.didTransition) {
router.didTransition(router.currentHandlerInfos);
}
- _utils.log(router, transition.sequence, "TRANSITION COMPLETE.");
+ _routerUtils.log(router, transition.sequence, "TRANSITION COMPLETE.");
// Resolve with the final handler.
return handlerInfos[handlerInfos.length - 1].handler;
} catch (e) {
- if (!(e instanceof _transition.TransitionAborted)) {
+ if (!(e instanceof _routerTransition.TransitionAborted)) {
//var erroneousHandler = handlerInfos.pop();
var infos = transition.state.handlerInfos;
transition.trigger(true, 'error', e, transition, infos[infos.length - 1].handler);
transition.abort();
}
@@ -47898,30 +48707,30 @@
}
var intent;
if (args.length === 0) {
- _utils.log(router, "Updating query params");
+ _routerUtils.log(router, "Updating query params");
// A query param update is really just a transition
// into the route you're already on.
var handlerInfos = router.state.handlerInfos;
- intent = new _transitionIntentNamedTransitionIntent.default({
+ intent = new _routerTransitionIntentNamedTransitionIntent.default({
name: handlerInfos[handlerInfos.length - 1].name,
contexts: [],
queryParams: queryParams
});
} else if (name.charAt(0) === '/') {
- _utils.log(router, "Attempting URL transition to " + name);
- intent = new _transitionIntentUrlTransitionIntent.default({ url: name });
+ _routerUtils.log(router, "Attempting URL transition to " + name);
+ intent = new _routerTransitionIntentUrlTransitionIntent.default({ url: name });
} else {
- _utils.log(router, "Attempting transition to " + name);
- intent = new _transitionIntentNamedTransitionIntent.default({
+ _routerUtils.log(router, "Attempting transition to " + name);
+ intent = new _routerTransitionIntentNamedTransitionIntent.default({
name: args[0],
- contexts: _utils.slice.call(args, 1),
+ contexts: _routerUtils.slice.call(args, 1),
queryParams: queryParams
});
}
return router.transitionByIntent(intent, isIntermediate);
@@ -47954,11 +48763,11 @@
delete newQueryParams[k];
}
}
var finalQueryParamsArray = [];
- _utils.trigger(router, resolvedHandlers, true, ['finalizeQueryParamChange', newQueryParams, finalQueryParamsArray, transition]);
+ _routerUtils.trigger(router, resolvedHandlers, true, ['finalizeQueryParamChange', newQueryParams, finalQueryParamsArray, transition]);
if (transition) {
transition._visibleQueryParams = {};
}
@@ -48009,40 +48818,23 @@
}
return false;
};
}
- _utils.trigger(router, oldHandlers, true, ['willTransition', newTransition]);
+ _routerUtils.trigger(router, oldHandlers, true, ['willTransition', newTransition]);
if (router.willTransition) {
router.willTransition(oldHandlers, newState.handlerInfos, newTransition);
}
}
exports.default = Router;
});
-enifed('router/transition-intent', ['exports', './utils'], function (exports, _utils) {
+enifed('router/transition-intent/named-transition-intent', ['exports', 'router/transition-intent', 'router/transition-state', 'router/handler-info/factory', 'router/utils'], function (exports, _routerTransitionIntent, _routerTransitionState, _routerHandlerInfoFactory, _routerUtils) {
'use strict';
- function TransitionIntent(props) {
- this.initialize(props);
-
- // TODO: wat
- this.data = this.data || {};
- }
-
- TransitionIntent.prototype = {
- initialize: null,
- applyToState: null
- };
-
- exports.default = TransitionIntent;
-});
-enifed('router/transition-intent/named-transition-intent', ['exports', '../transition-intent', '../transition-state', '../handler-info/factory', '../utils'], function (exports, _transitionIntent, _transitionState, _handlerInfoFactory, _utils) {
- 'use strict';
-
- exports.default = _utils.subclass(_transitionIntent.default, {
+ exports.default = _routerUtils.subclass(_routerTransitionIntent.default, {
name: null,
pivotHandler: null,
contexts: null,
queryParams: null,
@@ -48053,11 +48845,11 @@
this.queryParams = props.queryParams;
},
applyToState: function (oldState, recognizer, getHandler, isIntermediate) {
- var partitionedArgs = _utils.extractQueryParams([this.name].concat(this.contexts)),
+ var partitionedArgs = _routerUtils.extractQueryParams([this.name].concat(this.contexts)),
pureArgs = partitionedArgs[0],
queryParams = partitionedArgs[1],
handlers = recognizer.handlersFor(pureArgs[0]);
var targetRouteName = handlers[handlers.length - 1].handler;
@@ -48066,11 +48858,11 @@
},
applyToHandlers: function (oldState, handlers, getHandler, targetRouteName, isIntermediate, checkingIfActive) {
var i, len;
- var newState = new _transitionState.default();
+ var newState = new _routerTransitionState.default();
var objects = this.contexts.slice(0);
var invalidateIndex = handlers.length;
// Pivot handlers are provided for refresh transitions
@@ -48141,11 +48933,11 @@
if (!isIntermediate) {
this.invalidateChildren(newState.handlerInfos, invalidateIndex);
}
- _utils.merge(newState.queryParams, this.queryParams || {});
+ _routerUtils.merge(newState.queryParams, this.queryParams || {});
return newState;
},
invalidateChildren: function (handlerInfos, invalidateIndex) {
@@ -48161,11 +48953,11 @@
var objectToUse;
if (objects.length > 0) {
// Use the objects provided for this transition.
objectToUse = objects[objects.length - 1];
- if (_utils.isParam(objectToUse)) {
+ if (_routerUtils.isParam(objectToUse)) {
return this.createParamHandlerInfo(name, handler, names, objects, oldHandlerInfo);
} else {
objects.pop();
}
} else if (oldHandlerInfo && oldHandlerInfo.name === name) {
@@ -48185,11 +48977,11 @@
//throw new Error("Not enough context objects were provided to complete a transition to " + targetRouteName + ". Specifically, the " + name + " route needs an object that can be serialized into its dynamic URL segments [" + names.join(', ') + "]");
return oldHandlerInfo;
}
}
- return _handlerInfoFactory.default('object', {
+ return _routerHandlerInfoFactory.default('object', {
name: name,
handler: handler,
context: objectToUse,
names: names
});
@@ -48205,11 +48997,11 @@
// Only use old params if the names match with the new handler
var oldParams = oldHandlerInfo && name === oldHandlerInfo.name && oldHandlerInfo.params || {};
var peek = objects[objects.length - 1];
var paramName = names[numNames];
- if (_utils.isParam(peek)) {
+ if (_routerUtils.isParam(peek)) {
params[paramName] = "" + objects.pop();
} else {
// If we're here, this means only some of the params
// were string/number params, so try and use a param
// value from a previous handler.
@@ -48219,52 +49011,52 @@
throw new Error("You didn't provide enough string/numeric parameters to satisfy all of the dynamic segments for route " + name);
}
}
}
- return _handlerInfoFactory.default('param', {
+ return _routerHandlerInfoFactory.default('param', {
name: name,
handler: handler,
params: params
});
}
});
});
-enifed('router/transition-intent/url-transition-intent', ['exports', '../transition-intent', '../transition-state', '../handler-info/factory', '../utils', './../unrecognized-url-error'], function (exports, _transitionIntent, _transitionState, _handlerInfoFactory, _utils, _unrecognizedUrlError) {
+enifed('router/transition-intent/url-transition-intent', ['exports', 'router/transition-intent', 'router/transition-state', 'router/handler-info/factory', 'router/utils', 'router/unrecognized-url-error'], function (exports, _routerTransitionIntent, _routerTransitionState, _routerHandlerInfoFactory, _routerUtils, _routerUnrecognizedUrlError) {
'use strict';
- exports.default = _utils.subclass(_transitionIntent.default, {
+ exports.default = _routerUtils.subclass(_routerTransitionIntent.default, {
url: null,
initialize: function (props) {
this.url = props.url;
},
applyToState: function (oldState, recognizer, getHandler) {
- var newState = new _transitionState.default();
+ var newState = new _routerTransitionState.default();
var results = recognizer.recognize(this.url),
queryParams = {},
i,
len;
if (!results) {
- throw new _unrecognizedUrlError.default(this.url);
+ throw new _routerUnrecognizedUrlError.default(this.url);
}
var statesDiffer = false;
for (i = 0, len = results.length; i < len; ++i) {
var result = results[i];
var name = result.handler;
var handler = getHandler(name);
if (handler.inaccessibleByURL) {
- throw new _unrecognizedUrlError.default(this.url);
+ throw new _routerUnrecognizedUrlError.default(this.url);
}
- var newHandlerInfo = _handlerInfoFactory.default('param', {
+ var newHandlerInfo = _routerHandlerInfoFactory.default('param', {
name: name,
handler: handler,
params: result.params
});
@@ -48275,19 +49067,36 @@
} else {
newState.handlerInfos[i] = oldHandlerInfo;
}
}
- _utils.merge(newState.queryParams, results.queryParams);
+ _routerUtils.merge(newState.queryParams, results.queryParams);
return newState;
}
});
});
-enifed('router/transition-state', ['exports', './handler-info', './utils', 'rsvp/promise'], function (exports, _handlerInfo, _utils, _rsvpPromise) {
+enifed('router/transition-intent', ['exports', 'router/utils'], function (exports, _routerUtils) {
'use strict';
+ function TransitionIntent(props) {
+ this.initialize(props);
+
+ // TODO: wat
+ this.data = this.data || {};
+ }
+
+ TransitionIntent.prototype = {
+ initialize: null,
+ applyToState: null
+ };
+
+ exports.default = TransitionIntent;
+});
+enifed('router/transition-state', ['exports', 'router/handler-info', 'router/utils', 'rsvp/promise'], function (exports, _routerHandlerInfo, _routerUtils, _rsvpPromise) {
+ 'use strict';
+
function TransitionState(other) {
this.handlerInfos = [];
this.queryParams = {};
this.params = {};
}
@@ -48297,25 +49106,25 @@
queryParams: null,
params: null,
promiseLabel: function (label) {
var targetName = '';
- _utils.forEach(this.handlerInfos, function (handlerInfo) {
+ _routerUtils.forEach(this.handlerInfos, function (handlerInfo) {
if (targetName !== '') {
targetName += '.';
}
targetName += handlerInfo.name;
});
- return _utils.promiseLabel("'" + targetName + "': " + label);
+ return _routerUtils.promiseLabel("'" + targetName + "': " + label);
},
resolve: function (shouldContinue, payload) {
var self = this;
// First, calculate params for this state. This is useful
// information to provide to the various route hooks.
var params = this.params;
- _utils.forEach(this.handlerInfos, function (handlerInfo) {
+ _routerUtils.forEach(this.handlerInfos, function (handlerInfo) {
params[handlerInfo.name] = handlerInfo.params || {};
});
payload = payload || {};
payload.resolveIndex = 0;
@@ -48360,11 +49169,11 @@
// Call the redirect hook. The reason we call it here
// vs. afterModel is so that redirects into child
// routes don't re-run the model hooks for this
// already-resolved route.
var handler = resolvedHandlerInfo.handler;
- _utils.callHook(handler, 'redirect', resolvedHandlerInfo.context, payload);
+ _routerUtils.callHook(handler, 'redirect', resolvedHandlerInfo.context, payload);
}
// Proceed after ensuring that the redirect hook
// didn't abort this transition by transitioning elsewhere.
return innerShouldContinue().then(resolveOneHandlerInfo, null, currentState.promiseLabel('Resolve handler'));
@@ -48387,11 +49196,11 @@
}
};
exports.default = TransitionState;
});
-enifed('router/transition', ['exports', 'rsvp/promise', './handler-info', './utils'], function (exports, _rsvpPromise, _handlerInfo, _utils) {
+enifed('router/transition', ['exports', 'rsvp/promise', 'router/handler-info', 'router/utils'], function (exports, _rsvpPromise, _routerHandlerInfo, _routerUtils) {
'use strict';
/**
@private
@@ -48443,19 +49252,19 @@
} else {
transition.trigger('error', result.error, transition, result.handlerWithError);
transition.abort();
return _rsvpPromise.default.reject(result.error);
}
- }, _utils.promiseLabel('Handle Abort'));
+ }, _routerUtils.promiseLabel('Handle Abort'));
} else {
this.promise = _rsvpPromise.default.resolve(this.state);
this.params = {};
}
function checkForAbort() {
if (transition.isAborted) {
- return _rsvpPromise.default.reject(undefined, _utils.promiseLabel("Transition aborted - reject"));
+ return _rsvpPromise.default.reject(undefined, _routerUtils.promiseLabel("Transition aborted - reject"));
}
}
}
Transition.currentSequence = 0;
@@ -48561,11 +49370,11 @@
*/
abort: function () {
if (this.isAborted) {
return this;
}
- _utils.log(this.router, this.sequence, this.targetName + ": transition was aborted");
+ _routerUtils.log(this.router, this.sequence, this.targetName + ": transition was aborted");
this.intent.preTransitionState = this.router.state;
this.isAborted = true;
this.isActive = false;
this.router.activeTransition = null;
return this;
@@ -48612,18 +49421,18 @@
Note: This method is also aliased as `send`
@param {Boolean} [ignoreFailure=false] a boolean specifying whether unhandled events throw an error
@param {String} name the name of the event to fire
*/
trigger: function (ignoreFailure) {
- var args = _utils.slice.call(arguments);
+ var args = _routerUtils.slice.call(arguments);
if (typeof ignoreFailure === 'boolean') {
args.shift();
} else {
// Throw errors on unhandled trigger events by default
ignoreFailure = false;
}
- _utils.trigger(this.router, this.state.handlerInfos.slice(0, this.resolveIndex + 1), ignoreFailure, args);
+ _routerUtils.trigger(this.router, this.state.handlerInfos.slice(0, this.resolveIndex + 1), ignoreFailure, args);
},
/**
@public
Transitions are aborted and their promises rejected
@@ -48650,11 +49459,11 @@
/**
@private
*/
log: function (message) {
- _utils.log(this.router, this.sequence, message);
+ _routerUtils.log(this.router, this.sequence, message);
}
};
// Alias 'trigger' as 'send'
Transition.prototype.send = Transition.prototype.trigger;
@@ -48663,11 +49472,11 @@
@private
Logs and returns a TransitionAborted error.
*/
function logAbort(transition) {
- _utils.log(transition.router, transition.sequence, "detected abort.");
+ _routerUtils.log(transition.router, transition.sequence, "detected abort.");
return new TransitionAborted();
}
function TransitionAborted(message) {
this.message = message || "TransitionAborted";
@@ -48676,11 +49485,11 @@
exports.Transition = Transition;
exports.logAbort = logAbort;
exports.TransitionAborted = TransitionAborted;
});
-enifed("router/unrecognized-url-error", ["exports", "./utils"], function (exports, _utils) {
+enifed("router/unrecognized-url-error", ["exports", "router/utils"], function (exports, _routerUtils) {
"use strict";
/**
Promise reject reasons passed to promise rejection
handlers for failed transitions.
@@ -48689,11 +49498,11 @@
this.message = message || "UnrecognizedURLError";
this.name = "UnrecognizedURLError";
Error.call(this);
}
- UnrecognizedURLError.prototype = _utils.oCreate(Error.prototype);
+ UnrecognizedURLError.prototype = _routerUtils.oCreate(Error.prototype);
exports.default = UnrecognizedURLError;
});
enifed('router/utils', ['exports'], function (exports) {
'use strict';
@@ -48938,100 +49747,18 @@
exports.coerceQueryParamsToString = coerceQueryParamsToString;
exports.callHook = callHook;
exports.resolveHook = resolveHook;
exports.applyHook = applyHook;
});
-enifed('rsvp', ['exports', './rsvp/promise', './rsvp/events', './rsvp/node', './rsvp/all', './rsvp/all-settled', './rsvp/race', './rsvp/hash', './rsvp/hash-settled', './rsvp/rethrow', './rsvp/defer', './rsvp/config', './rsvp/map', './rsvp/resolve', './rsvp/reject', './rsvp/filter', './rsvp/asap'], function (exports, _rsvpPromise, _rsvpEvents, _rsvpNode, _rsvpAll, _rsvpAllSettled, _rsvpRace, _rsvpHash, _rsvpHashSettled, _rsvpRethrow, _rsvpDefer, _rsvpConfig, _rsvpMap, _rsvpResolve, _rsvpReject, _rsvpFilter, _rsvpAsap) {
+enifed('router', ['exports', 'router/router'], function (exports, _routerRouter) {
'use strict';
- // defaults
- _rsvpConfig.config.async = _rsvpAsap.default;
- _rsvpConfig.config.after = function (cb) {
- setTimeout(cb, 0);
- };
- var cast = _rsvpResolve.default;
- function async(callback, arg) {
- _rsvpConfig.config.async(callback, arg);
- }
-
- function on() {
- _rsvpConfig.config['on'].apply(_rsvpConfig.config, arguments);
- }
-
- function off() {
- _rsvpConfig.config['off'].apply(_rsvpConfig.config, arguments);
- }
-
- // Set up instrumentation through `window.__PROMISE_INTRUMENTATION__`
- if (typeof window !== 'undefined' && typeof window['__PROMISE_INSTRUMENTATION__'] === 'object') {
- var callbacks = window['__PROMISE_INSTRUMENTATION__'];
- _rsvpConfig.configure('instrument', true);
- for (var eventName in callbacks) {
- if (callbacks.hasOwnProperty(eventName)) {
- on(eventName, callbacks[eventName]);
- }
- }
- }
-
- exports.cast = cast;
- exports.Promise = _rsvpPromise.default;
- exports.EventTarget = _rsvpEvents.default;
- exports.all = _rsvpAll.default;
- exports.allSettled = _rsvpAllSettled.default;
- exports.race = _rsvpRace.default;
- exports.hash = _rsvpHash.default;
- exports.hashSettled = _rsvpHashSettled.default;
- exports.rethrow = _rsvpRethrow.default;
- exports.defer = _rsvpDefer.default;
- exports.denodeify = _rsvpNode.default;
- exports.configure = _rsvpConfig.configure;
- exports.on = on;
- exports.off = off;
- exports.resolve = _rsvpResolve.default;
- exports.reject = _rsvpReject.default;
- exports.async = async;
- exports.map = _rsvpMap.default;
- exports.filter = _rsvpFilter.default;
+ exports.default = _routerRouter.default;
});
-enifed('rsvp.umd', ['exports', './rsvp/platform', './rsvp'], function (exports, _rsvpPlatform, _rsvp) {
+enifed('rsvp/-internal', ['exports', 'rsvp/utils', 'rsvp/instrument', 'rsvp/config'], function (exports, _rsvpUtils, _rsvpInstrument, _rsvpConfig) {
'use strict';
- var RSVP = {
- 'race': _rsvp.race,
- 'Promise': _rsvp.Promise,
- 'allSettled': _rsvp.allSettled,
- 'hash': _rsvp.hash,
- 'hashSettled': _rsvp.hashSettled,
- 'denodeify': _rsvp.denodeify,
- 'on': _rsvp.on,
- 'off': _rsvp.off,
- 'map': _rsvp.map,
- 'filter': _rsvp.filter,
- 'resolve': _rsvp.resolve,
- 'reject': _rsvp.reject,
- 'all': _rsvp.all,
- 'rethrow': _rsvp.rethrow,
- 'defer': _rsvp.defer,
- 'EventTarget': _rsvp.EventTarget,
- 'configure': _rsvp.configure,
- 'async': _rsvp.async
- };
-
- /* global define:true module:true window: true */
- if (typeof enifed === 'function' && enifed['amd']) {
- enifed(function () {
- return RSVP;
- });
- } else if (typeof module !== 'undefined' && module['exports']) {
- module['exports'] = RSVP;
- } else if (typeof _rsvpPlatform.default !== 'undefined') {
- _rsvpPlatform.default['RSVP'] = RSVP;
- }
-});
-enifed('rsvp/-internal', ['exports', './utils', './instrument', './config'], function (exports, _utils, _instrument, _config) {
- 'use strict';
-
function withOwnPromise() {
return new TypeError('A promises callback cannot return that same promise.');
}
function noop() {}
@@ -49058,11 +49785,11 @@
return e;
}
}
function handleForeignThenable(promise, thenable, then) {
- _config.config.async(function (promise) {
+ _rsvpConfig.config.async(function (promise) {
var sealed = false;
var error = tryThen(then, thenable, function (value) {
if (sealed) {
return;
}
@@ -49115,22 +49842,22 @@
if (then === GET_THEN_ERROR) {
reject(promise, GET_THEN_ERROR.error);
} else if (then === undefined) {
fulfill(promise, maybeThenable);
- } else if (_utils.isFunction(then)) {
+ } else if (_rsvpUtils.isFunction(then)) {
handleForeignThenable(promise, maybeThenable, then);
} else {
fulfill(promise, maybeThenable);
}
}
}
function resolve(promise, value) {
if (promise === value) {
fulfill(promise, value);
- } else if (_utils.objectOrFunction(value)) {
+ } else if (_rsvpUtils.objectOrFunction(value)) {
handleMaybeThenable(promise, value);
} else {
fulfill(promise, value);
}
}
@@ -49150,25 +49877,25 @@
promise._result = value;
promise._state = FULFILLED;
if (promise._subscribers.length === 0) {
- if (_config.config.instrument) {
- _instrument.default('fulfilled', promise);
+ if (_rsvpConfig.config.instrument) {
+ _rsvpInstrument.default('fulfilled', promise);
}
} else {
- _config.config.async(publish, promise);
+ _rsvpConfig.config.async(publish, promise);
}
}
function reject(promise, reason) {
if (promise._state !== PENDING) {
return;
}
promise._state = REJECTED;
promise._result = reason;
- _config.config.async(publishRejection, promise);
+ _rsvpConfig.config.async(publishRejection, promise);
}
function subscribe(parent, child, onFulfillment, onRejection) {
var subscribers = parent._subscribers;
var length = subscribers.length;
@@ -49178,20 +49905,20 @@
subscribers[length] = child;
subscribers[length + FULFILLED] = onFulfillment;
subscribers[length + REJECTED] = onRejection;
if (length === 0 && parent._state) {
- _config.config.async(publish, parent);
+ _rsvpConfig.config.async(publish, parent);
}
}
function publish(promise) {
var subscribers = promise._subscribers;
var settled = promise._state;
- if (_config.config.instrument) {
- _instrument.default(settled === FULFILLED ? 'fulfilled' : 'rejected', promise);
+ if (_rsvpConfig.config.instrument) {
+ _rsvpInstrument.default(settled === FULFILLED ? 'fulfilled' : 'rejected', promise);
}
if (subscribers.length === 0) {
return;
}
@@ -49228,11 +49955,11 @@
return TRY_CATCH_ERROR;
}
}
function invokeCallback(settled, promise, callback, detail) {
- var hasCallback = _utils.isFunction(callback),
+ var hasCallback = _rsvpUtils.isFunction(callback),
value,
error,
succeeded,
failed;
@@ -49301,22 +50028,22 @@
exports.invokeCallback = invokeCallback;
exports.FULFILLED = FULFILLED;
exports.REJECTED = REJECTED;
exports.PENDING = PENDING;
});
-enifed('rsvp/all-settled', ['exports', './enumerator', './promise', './utils'], function (exports, _enumerator, _promise, _utils) {
+enifed('rsvp/all-settled', ['exports', 'rsvp/enumerator', 'rsvp/promise', 'rsvp/utils'], function (exports, _rsvpEnumerator, _rsvpPromise, _rsvpUtils) {
'use strict';
exports.default = allSettled;
function AllSettled(Constructor, entries, label) {
this._superConstructor(Constructor, entries, false, /* don't abort on reject */label);
}
- AllSettled.prototype = _utils.o_create(_enumerator.default.prototype);
- AllSettled.prototype._superConstructor = _enumerator.default;
- AllSettled.prototype._makeResult = _enumerator.makeSettledResult;
+ AllSettled.prototype = _rsvpUtils.o_create(_rsvpEnumerator.default.prototype);
+ AllSettled.prototype._superConstructor = _rsvpEnumerator.default;
+ AllSettled.prototype._makeResult = _rsvpEnumerator.makeSettledResult;
AllSettled.prototype._validationError = function () {
return new Error('allSettled must be called with an array');
};
/**
@@ -49370,14 +50097,14 @@
@return {Promise} promise that is fulfilled with an array of the settled
states of the constituent promises.
*/
function allSettled(entries, label) {
- return new AllSettled(_promise.default, entries, label).promise;
+ return new AllSettled(_rsvpPromise.default, entries, label).promise;
}
});
-enifed("rsvp/all", ["exports", "./promise"], function (exports, _promise) {
+enifed("rsvp/all", ["exports", "rsvp/promise"], function (exports, _rsvpPromise) {
"use strict";
exports.default = all;
/**
@@ -49390,11 +50117,11 @@
@param {String} label An optional label. This is useful
for tooling.
*/
function all(array, label) {
- return _promise.default.all(array, label);
+ return _rsvpPromise.default.all(array, label);
}
});
enifed('rsvp/asap', ['exports'], function (exports) {
'use strict';
@@ -49485,11 +50212,11 @@
len = 0;
}
function attemptVertex() {
try {
- var r = eriuqer;
+ var r = require;
var vertx = r('vertx');
vertxNext = vertx.runOnLoop || vertx.runOnContext;
return useVertxTimer();
} catch (e) {
return useSetTimeout();
@@ -49502,24 +50229,24 @@
scheduleFlush = useNextTick();
} else if (BrowserMutationObserver) {
scheduleFlush = useMutationObserver();
} else if (isWorker) {
scheduleFlush = useMessageChannel();
- } else if (browserWindow === undefined && typeof eriuqer === 'function') {
+ } else if (browserWindow === undefined && typeof require === 'function') {
scheduleFlush = attemptVertex();
} else {
scheduleFlush = useSetTimeout();
}
});
-enifed('rsvp/config', ['exports', './events'], function (exports, _events) {
+enifed('rsvp/config', ['exports', 'rsvp/events'], function (exports, _rsvpEvents) {
'use strict';
var config = {
instrument: false
};
- _events.default['mixin'](config);
+ _rsvpEvents.default['mixin'](config);
function configure(name, value) {
if (name === 'onerror') {
// handle for legacy users that expect the actual
// error to be passed to their function added via
@@ -49536,11 +50263,11 @@
}
exports.config = config;
exports.configure = configure;
});
-enifed('rsvp/defer', ['exports', './promise'], function (exports, _promise) {
+enifed('rsvp/defer', ['exports', 'rsvp/promise'], function (exports, _rsvpPromise) {
'use strict';
exports.default = defer;
/**
@@ -49577,25 +50304,25 @@
*/
function defer(label) {
var deferred = {};
- deferred['promise'] = new _promise.default(function (resolve, reject) {
+ deferred['promise'] = new _rsvpPromise.default(function (resolve, reject) {
deferred['resolve'] = resolve;
deferred['reject'] = reject;
}, label);
return deferred;
}
});
-enifed('rsvp/enumerator', ['exports', './utils', './-internal'], function (exports, _utils, _internal) {
+enifed('rsvp/enumerator', ['exports', 'rsvp/utils', 'rsvp/-internal'], function (exports, _rsvpUtils, _rsvpInternal) {
'use strict';
exports.makeSettledResult = makeSettledResult;
function makeSettledResult(state, position, value) {
- if (state === _internal.FULFILLED) {
+ if (state === _rsvpInternal.FULFILLED) {
return {
state: 'fulfilled',
value: value
};
} else {
@@ -49608,38 +50335,38 @@
function Enumerator(Constructor, input, abortOnReject, label) {
var enumerator = this;
enumerator._instanceConstructor = Constructor;
- enumerator.promise = new Constructor(_internal.noop, label);
+ enumerator.promise = new Constructor(_rsvpInternal.noop, label);
enumerator._abortOnReject = abortOnReject;
if (enumerator._validateInput(input)) {
enumerator._input = input;
enumerator.length = input.length;
enumerator._remaining = input.length;
enumerator._init();
if (enumerator.length === 0) {
- _internal.fulfill(enumerator.promise, enumerator._result);
+ _rsvpInternal.fulfill(enumerator.promise, enumerator._result);
} else {
enumerator.length = enumerator.length || 0;
enumerator._enumerate();
if (enumerator._remaining === 0) {
- _internal.fulfill(enumerator.promise, enumerator._result);
+ _rsvpInternal.fulfill(enumerator.promise, enumerator._result);
}
}
} else {
- _internal.reject(enumerator.promise, enumerator._validationError());
+ _rsvpInternal.reject(enumerator.promise, enumerator._validationError());
}
}
exports.default = Enumerator;
Enumerator.prototype._validateInput = function (input) {
- return _utils.isArray(input);
+ return _rsvpUtils.isArray(input);
};
Enumerator.prototype._validationError = function () {
return new Error('Array Methods must be provided an Array');
};
@@ -49652,61 +50379,61 @@
var enumerator = this;
var length = enumerator.length;
var promise = enumerator.promise;
var input = enumerator._input;
- for (var i = 0; promise._state === _internal.PENDING && i < length; i++) {
+ for (var i = 0; promise._state === _rsvpInternal.PENDING && i < length; i++) {
enumerator._eachEntry(input[i], i);
}
};
Enumerator.prototype._eachEntry = function (entry, i) {
var enumerator = this;
var c = enumerator._instanceConstructor;
- if (_utils.isMaybeThenable(entry)) {
- if (entry.constructor === c && entry._state !== _internal.PENDING) {
+ if (_rsvpUtils.isMaybeThenable(entry)) {
+ if (entry.constructor === c && entry._state !== _rsvpInternal.PENDING) {
entry._onError = null;
enumerator._settledAt(entry._state, i, entry._result);
} else {
enumerator._willSettleAt(c.resolve(entry), i);
}
} else {
enumerator._remaining--;
- enumerator._result[i] = enumerator._makeResult(_internal.FULFILLED, i, entry);
+ enumerator._result[i] = enumerator._makeResult(_rsvpInternal.FULFILLED, i, entry);
}
};
Enumerator.prototype._settledAt = function (state, i, value) {
var enumerator = this;
var promise = enumerator.promise;
- if (promise._state === _internal.PENDING) {
+ if (promise._state === _rsvpInternal.PENDING) {
enumerator._remaining--;
- if (enumerator._abortOnReject && state === _internal.REJECTED) {
- _internal.reject(promise, value);
+ if (enumerator._abortOnReject && state === _rsvpInternal.REJECTED) {
+ _rsvpInternal.reject(promise, value);
} else {
enumerator._result[i] = enumerator._makeResult(state, i, value);
}
}
if (enumerator._remaining === 0) {
- _internal.fulfill(promise, enumerator._result);
+ _rsvpInternal.fulfill(promise, enumerator._result);
}
};
Enumerator.prototype._makeResult = function (state, i, value) {
return value;
};
Enumerator.prototype._willSettleAt = function (promise, i) {
var enumerator = this;
- _internal.subscribe(promise, undefined, function (value) {
- enumerator._settledAt(_internal.FULFILLED, i, value);
+ _rsvpInternal.subscribe(promise, undefined, function (value) {
+ enumerator._settledAt(_rsvpInternal.FULFILLED, i, value);
}, function (reason) {
- enumerator._settledAt(_internal.REJECTED, i, reason);
+ enumerator._settledAt(_rsvpInternal.REJECTED, i, reason);
});
};
});
enifed('rsvp/events', ['exports'], function (exports) {
'use strict';
@@ -49896,11 +50623,11 @@
}
}
}
};
});
-enifed('rsvp/filter', ['exports', './promise', './utils'], function (exports, _promise, _utils) {
+enifed('rsvp/filter', ['exports', 'rsvp/promise', 'rsvp/utils'], function (exports, _rsvpPromise, _rsvpUtils) {
'use strict';
exports.default = filter;
/**
@@ -49988,23 +50715,23 @@
tooling.
@return {Promise}
*/
function filter(promises, filterFn, label) {
- return _promise.default.all(promises, label).then(function (values) {
- if (!_utils.isFunction(filterFn)) {
+ return _rsvpPromise.default.all(promises, label).then(function (values) {
+ if (!_rsvpUtils.isFunction(filterFn)) {
throw new TypeError("You must pass a function as filter's second argument.");
}
var length = values.length;
var filtered = new Array(length);
for (var i = 0; i < length; i++) {
filtered[i] = filterFn(values[i]);
}
- return _promise.default.all(filtered, label).then(function (filtered) {
+ return _rsvpPromise.default.all(filtered, label).then(function (filtered) {
var results = new Array(length);
var newLength = 0;
for (var i = 0; i < length; i++) {
if (filtered[i]) {
@@ -50018,22 +50745,22 @@
return results;
});
});
}
});
-enifed('rsvp/hash-settled', ['exports', './promise', './enumerator', './promise-hash', './utils'], function (exports, _promise, _enumerator, _promiseHash, _utils) {
+enifed('rsvp/hash-settled', ['exports', 'rsvp/promise', 'rsvp/enumerator', 'rsvp/promise-hash', 'rsvp/utils'], function (exports, _rsvpPromise, _rsvpEnumerator, _rsvpPromiseHash, _rsvpUtils) {
'use strict';
exports.default = hashSettled;
function HashSettled(Constructor, object, label) {
this._superConstructor(Constructor, object, false, label);
}
- HashSettled.prototype = _utils.o_create(_promiseHash.default.prototype);
- HashSettled.prototype._superConstructor = _enumerator.default;
- HashSettled.prototype._makeResult = _enumerator.makeSettledResult;
+ HashSettled.prototype = _rsvpUtils.o_create(_rsvpPromiseHash.default.prototype);
+ HashSettled.prototype._superConstructor = _rsvpEnumerator.default;
+ HashSettled.prototype._makeResult = _rsvpEnumerator.makeSettledResult;
HashSettled.prototype._validationError = function () {
return new Error('hashSettled must be called with an object');
};
@@ -50138,14 +50865,14 @@
have been settled.
@static
*/
function hashSettled(object, label) {
- return new HashSettled(_promise.default, object, label).promise;
+ return new HashSettled(_rsvpPromise.default, object, label).promise;
}
});
-enifed('rsvp/hash', ['exports', './promise', './promise-hash'], function (exports, _promise, _promiseHash) {
+enifed('rsvp/hash', ['exports', 'rsvp/promise', 'rsvp/promise-hash'], function (exports, _rsvpPromise, _rsvpPromiseHash) {
'use strict';
exports.default = hash;
/**
@@ -50236,14 +50963,14 @@
@return {Promise} promise that is fulfilled when all properties of `promises`
have been fulfilled, or rejected if any of them become rejected.
*/
function hash(object, label) {
- return new _promiseHash.default(_promise.default, object, label).promise;
+ return new _rsvpPromiseHash.default(_rsvpPromise.default, object, label).promise;
}
});
-enifed('rsvp/instrument', ['exports', './config', './utils'], function (exports, _config, _utils) {
+enifed('rsvp/instrument', ['exports', 'rsvp/config', 'rsvp/utils'], function (exports, _rsvpConfig, _rsvpUtils) {
'use strict';
exports.default = instrument;
var queue = [];
@@ -50260,11 +50987,11 @@
payload.childGuid = payload.key + payload.childId;
if (payload.error) {
payload.stack = payload.error.stack;
}
- _config.config['trigger'](entry.name, entry.payload);
+ _rsvpConfig.config['trigger'](entry.name, entry.payload);
}
queue.length = 0;
}, 50);
}
@@ -50276,18 +51003,18 @@
id: promise._id,
eventName: eventName,
detail: promise._result,
childId: child && child._id,
label: promise._label,
- timeStamp: _utils.now(),
- error: _config.config["instrument-with-stack"] ? new Error(promise._label) : null
+ timeStamp: _rsvpUtils.now(),
+ error: _rsvpConfig.config["instrument-with-stack"] ? new Error(promise._label) : null
} })) {
scheduleFlush();
}
}
});
-enifed('rsvp/map', ['exports', './promise', './utils'], function (exports, _promise, _utils) {
+enifed('rsvp/map', ['exports', 'rsvp/promise', 'rsvp/utils'], function (exports, _rsvpPromise, _rsvpUtils) {
'use strict';
exports.default = map;
/**
@@ -50368,27 +51095,27 @@
The promise will be rejected if any of the given `promises` become rejected.
@static
*/
function map(promises, mapFn, label) {
- return _promise.default.all(promises, label).then(function (values) {
- if (!_utils.isFunction(mapFn)) {
+ return _rsvpPromise.default.all(promises, label).then(function (values) {
+ if (!_rsvpUtils.isFunction(mapFn)) {
throw new TypeError("You must pass a function as map's second argument.");
}
var length = values.length;
var results = new Array(length);
for (var i = 0; i < length; i++) {
results[i] = mapFn(values[i]);
}
- return _promise.default.all(results, label);
+ return _rsvpPromise.default.all(results, label);
});
}
});
-enifed('rsvp/node', ['exports', './promise', './-internal', './utils'], function (exports, _promise, _internal, _utils) {
+enifed('rsvp/node', ['exports', 'rsvp/promise', 'rsvp/-internal', 'rsvp/utils'], function (exports, _rsvpPromise, _rsvpInternal, _rsvpUtils) {
'use strict';
exports.default = denodeify;
function Result() {
@@ -50596,24 +51323,24 @@
if (!promiseInput) {
// TODO: clean this up
promiseInput = needsPromiseInput(arg);
if (promiseInput === GET_THEN_ERROR) {
- var p = new _promise.default(_internal.noop);
- _internal.reject(p, GET_THEN_ERROR.value);
+ var p = new _rsvpPromise.default(_rsvpInternal.noop);
+ _rsvpInternal.reject(p, GET_THEN_ERROR.value);
return p;
} else if (promiseInput && promiseInput !== true) {
arg = wrapThenable(promiseInput, arg);
}
}
args[i] = arg;
}
- var promise = new _promise.default(_internal.noop);
+ var promise = new _rsvpPromise.default(_rsvpInternal.noop);
args[l] = function (err, val) {
- if (err) _internal.reject(promise, err);else if (options === undefined) _internal.resolve(promise, val);else if (options === true) _internal.resolve(promise, arrayResult(arguments));else if (_utils.isArray(options)) _internal.resolve(promise, makeObject(arguments, options));else _internal.resolve(promise, val);
+ if (err) _rsvpInternal.reject(promise, err);else if (options === undefined) _rsvpInternal.resolve(promise, val);else if (options === true) _rsvpInternal.resolve(promise, arrayResult(arguments));else if (_rsvpUtils.isArray(options)) _rsvpInternal.resolve(promise, makeObject(arguments, options));else _rsvpInternal.resolve(promise, val);
};
if (promiseInput) {
return handlePromiseInput(promise, args, nodeFunc, self);
} else {
@@ -50627,28 +51354,28 @@
}
function handleValueInput(promise, args, nodeFunc, self) {
var result = tryApply(nodeFunc, self, args);
if (result === ERROR) {
- _internal.reject(promise, result.value);
+ _rsvpInternal.reject(promise, result.value);
}
return promise;
}
function handlePromiseInput(promise, args, nodeFunc, self) {
- return _promise.default.all(args).then(function (args) {
+ return _rsvpPromise.default.all(args).then(function (args) {
var result = tryApply(nodeFunc, self, args);
if (result === ERROR) {
- _internal.reject(promise, result.value);
+ _rsvpInternal.reject(promise, result.value);
}
return promise;
});
}
function needsPromiseInput(arg) {
if (arg && typeof arg === 'object') {
- if (arg.constructor === _promise.default) {
+ if (arg.constructor === _rsvpPromise.default) {
return true;
} else {
return getThen(arg);
}
} else {
@@ -50672,21 +51399,278 @@
throw new Error('no global: `self` or `global` found');
}
exports.default = platform;
});
-enifed('rsvp/promise-hash', ['exports', './enumerator', './-internal', './utils'], function (exports, _enumerator, _internal, _utils) {
+enifed('rsvp/promise/all', ['exports', 'rsvp/enumerator'], function (exports, _rsvpEnumerator) {
'use strict';
+ exports.default = all;
+
+ /**
+ `RSVP.Promise.all` accepts an array of promises, and returns a new promise which
+ is fulfilled with an array of fulfillment values for the passed promises, or
+ rejected with the reason of the first passed promise to be rejected. It casts all
+ elements of the passed iterable to promises as it runs this algorithm.
+
+ Example:
+
+ ```javascript
+ var promise1 = RSVP.resolve(1);
+ var promise2 = RSVP.resolve(2);
+ var promise3 = RSVP.resolve(3);
+ var promises = [ promise1, promise2, promise3 ];
+
+ RSVP.Promise.all(promises).then(function(array){
+ // The array here would be [ 1, 2, 3 ];
+ });
+ ```
+
+ If any of the `promises` given to `RSVP.all` are rejected, the first promise
+ that is rejected will be given as an argument to the returned promises's
+ rejection handler. For example:
+
+ Example:
+
+ ```javascript
+ var promise1 = RSVP.resolve(1);
+ var promise2 = RSVP.reject(new Error("2"));
+ var promise3 = RSVP.reject(new Error("3"));
+ var promises = [ promise1, promise2, promise3 ];
+
+ RSVP.Promise.all(promises).then(function(array){
+ // Code here never runs because there are rejected promises!
+ }, function(error) {
+ // error.message === "2"
+ });
+ ```
+
+ @method all
+ @static
+ @param {Array} entries array of promises
+ @param {String} label optional string for labeling the promise.
+ Useful for tooling.
+ @return {Promise} promise that is fulfilled when all `promises` have been
+ fulfilled, or rejected if any of them become rejected.
+ @static
+ */
+
+ function all(entries, label) {
+ return new _rsvpEnumerator.default(this, entries, true, /* abort on reject */label).promise;
+ }
+});
+enifed('rsvp/promise/race', ['exports', 'rsvp/utils', 'rsvp/-internal'], function (exports, _rsvpUtils, _rsvpInternal) {
+ 'use strict';
+
+ exports.default = race;
+
+ /**
+ `RSVP.Promise.race` returns a new promise which is settled in the same way as the
+ first passed promise to settle.
+
+ Example:
+
+ ```javascript
+ var promise1 = new RSVP.Promise(function(resolve, reject){
+ setTimeout(function(){
+ resolve('promise 1');
+ }, 200);
+ });
+
+ var promise2 = new RSVP.Promise(function(resolve, reject){
+ setTimeout(function(){
+ resolve('promise 2');
+ }, 100);
+ });
+
+ RSVP.Promise.race([promise1, promise2]).then(function(result){
+ // result === 'promise 2' because it was resolved before promise1
+ // was resolved.
+ });
+ ```
+
+ `RSVP.Promise.race` is deterministic in that only the state of the first
+ settled promise matters. For example, even if other promises given to the
+ `promises` array argument are resolved, but the first settled promise has
+ become rejected before the other promises became fulfilled, the returned
+ promise will become rejected:
+
+ ```javascript
+ var promise1 = new RSVP.Promise(function(resolve, reject){
+ setTimeout(function(){
+ resolve('promise 1');
+ }, 200);
+ });
+
+ var promise2 = new RSVP.Promise(function(resolve, reject){
+ setTimeout(function(){
+ reject(new Error('promise 2'));
+ }, 100);
+ });
+
+ RSVP.Promise.race([promise1, promise2]).then(function(result){
+ // Code here never runs
+ }, function(reason){
+ // reason.message === 'promise 2' because promise 2 became rejected before
+ // promise 1 became fulfilled
+ });
+ ```
+
+ An example real-world use case is implementing timeouts:
+
+ ```javascript
+ RSVP.Promise.race([ajax('foo.json'), timeout(5000)])
+ ```
+
+ @method race
+ @static
+ @param {Array} entries array of promises to observe
+ @param {String} label optional string for describing the promise returned.
+ Useful for tooling.
+ @return {Promise} a promise which settles in the same way as the first passed
+ promise to settle.
+ */
+
+ function race(entries, label) {
+ /*jshint validthis:true */
+ var Constructor = this;
+
+ var promise = new Constructor(_rsvpInternal.noop, label);
+
+ if (!_rsvpUtils.isArray(entries)) {
+ _rsvpInternal.reject(promise, new TypeError('You must pass an array to race.'));
+ return promise;
+ }
+
+ var length = entries.length;
+
+ function onFulfillment(value) {
+ _rsvpInternal.resolve(promise, value);
+ }
+
+ function onRejection(reason) {
+ _rsvpInternal.reject(promise, reason);
+ }
+
+ for (var i = 0; promise._state === _rsvpInternal.PENDING && i < length; i++) {
+ _rsvpInternal.subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
+ }
+
+ return promise;
+ }
+});
+enifed('rsvp/promise/reject', ['exports', 'rsvp/-internal'], function (exports, _rsvpInternal) {
+ 'use strict';
+
+ exports.default = reject;
+
+ /**
+ `RSVP.Promise.reject` returns a promise rejected with the passed `reason`.
+ It is shorthand for the following:
+
+ ```javascript
+ var promise = new RSVP.Promise(function(resolve, reject){
+ reject(new Error('WHOOPS'));
+ });
+
+ promise.then(function(value){
+ // Code here doesn't run because the promise is rejected!
+ }, function(reason){
+ // reason.message === 'WHOOPS'
+ });
+ ```
+
+ Instead of writing the above, your code now simply becomes the following:
+
+ ```javascript
+ var promise = RSVP.Promise.reject(new Error('WHOOPS'));
+
+ promise.then(function(value){
+ // Code here doesn't run because the promise is rejected!
+ }, function(reason){
+ // reason.message === 'WHOOPS'
+ });
+ ```
+
+ @method reject
+ @static
+ @param {*} reason value that the returned promise will be rejected with.
+ @param {String} label optional string for identifying the returned promise.
+ Useful for tooling.
+ @return {Promise} a promise rejected with the given `reason`.
+ */
+
+ function reject(reason, label) {
+ /*jshint validthis:true */
+ var Constructor = this;
+ var promise = new Constructor(_rsvpInternal.noop, label);
+ _rsvpInternal.reject(promise, reason);
+ return promise;
+ }
+});
+enifed('rsvp/promise/resolve', ['exports', 'rsvp/-internal'], function (exports, _rsvpInternal) {
+ 'use strict';
+
+ exports.default = resolve;
+
+ /**
+ `RSVP.Promise.resolve` returns a promise that will become resolved with the
+ passed `value`. It is shorthand for the following:
+
+ ```javascript
+ var promise = new RSVP.Promise(function(resolve, reject){
+ resolve(1);
+ });
+
+ promise.then(function(value){
+ // value === 1
+ });
+ ```
+
+ Instead of writing the above, your code now simply becomes the following:
+
+ ```javascript
+ var promise = RSVP.Promise.resolve(1);
+
+ promise.then(function(value){
+ // value === 1
+ });
+ ```
+
+ @method resolve
+ @static
+ @param {*} object value that the returned promise will be resolved with
+ @param {String} label optional string for identifying the returned promise.
+ Useful for tooling.
+ @return {Promise} a promise that will become fulfilled with the given
+ `value`
+ */
+
+ function resolve(object, label) {
+ /*jshint validthis:true */
+ var Constructor = this;
+
+ if (object && typeof object === 'object' && object.constructor === Constructor) {
+ return object;
+ }
+
+ var promise = new Constructor(_rsvpInternal.noop, label);
+ _rsvpInternal.resolve(promise, object);
+ return promise;
+ }
+});
+enifed('rsvp/promise-hash', ['exports', 'rsvp/enumerator', 'rsvp/-internal', 'rsvp/utils'], function (exports, _rsvpEnumerator, _rsvpInternal, _rsvpUtils) {
+ 'use strict';
+
function PromiseHash(Constructor, object, label) {
this._superConstructor(Constructor, object, true, label);
}
exports.default = PromiseHash;
- PromiseHash.prototype = _utils.o_create(_enumerator.default.prototype);
- PromiseHash.prototype._superConstructor = _enumerator.default;
+ PromiseHash.prototype = _rsvpUtils.o_create(_rsvpEnumerator.default.prototype);
+ PromiseHash.prototype._superConstructor = _rsvpEnumerator.default;
PromiseHash.prototype._init = function () {
this._result = {};
};
PromiseHash.prototype._validateInput = function (input) {
@@ -50702,11 +51686,11 @@
var promise = enumerator.promise;
var input = enumerator._input;
var results = [];
for (var key in input) {
- if (promise._state === _internal.PENDING && Object.prototype.hasOwnProperty.call(input, key)) {
+ if (promise._state === _rsvpInternal.PENDING && Object.prototype.hasOwnProperty.call(input, key)) {
results.push({
position: key,
entry: input[key]
});
}
@@ -50714,22 +51698,22 @@
var length = results.length;
enumerator._remaining = length;
var result;
- for (var i = 0; promise._state === _internal.PENDING && i < length; i++) {
+ for (var i = 0; promise._state === _rsvpInternal.PENDING && i < length; i++) {
result = results[i];
enumerator._eachEntry(result.entry, result.position);
}
};
});
-enifed('rsvp/promise', ['exports', './config', './instrument', './utils', './-internal', './promise/all', './promise/race', './promise/resolve', './promise/reject'], function (exports, _config, _instrument, _utils, _internal, _promiseAll, _promiseRace, _promiseResolve, _promiseReject) {
+enifed('rsvp/promise', ['exports', 'rsvp/config', 'rsvp/instrument', 'rsvp/utils', 'rsvp/-internal', 'rsvp/promise/all', 'rsvp/promise/race', 'rsvp/promise/resolve', 'rsvp/promise/reject'], function (exports, _rsvpConfig, _rsvpInstrument, _rsvpUtils, _rsvpInternal, _rsvpPromiseAll, _rsvpPromiseRace, _rsvpPromiseResolve, _rsvpPromiseReject) {
'use strict';
exports.default = Promise;
- var guidKey = 'rsvp_' + _utils.now() + '-';
+ var guidKey = 'rsvp_' + _rsvpUtils.now() + '-';
var counter = 0;
function needsResolver() {
throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
}
@@ -50850,43 +51834,43 @@
promise._label = label;
promise._state = undefined;
promise._result = undefined;
promise._subscribers = [];
- if (_config.config.instrument) {
- _instrument.default('created', promise);
+ if (_rsvpConfig.config.instrument) {
+ _rsvpInstrument.default('created', promise);
}
- if (_internal.noop !== resolver) {
- if (!_utils.isFunction(resolver)) {
+ if (_rsvpInternal.noop !== resolver) {
+ if (!_rsvpUtils.isFunction(resolver)) {
needsResolver();
}
if (!(promise instanceof Promise)) {
needsNew();
}
- _internal.initializePromise(promise, resolver);
+ _rsvpInternal.initializePromise(promise, resolver);
}
}
- Promise.cast = _promiseResolve.default; // deprecated
- Promise.all = _promiseAll.default;
- Promise.race = _promiseRace.default;
- Promise.resolve = _promiseResolve.default;
- Promise.reject = _promiseReject.default;
+ Promise.cast = _rsvpPromiseResolve.default; // deprecated
+ Promise.all = _rsvpPromiseAll.default;
+ Promise.race = _rsvpPromiseRace.default;
+ Promise.resolve = _rsvpPromiseResolve.default;
+ Promise.reject = _rsvpPromiseReject.default;
Promise.prototype = {
constructor: Promise,
_guidKey: guidKey,
_onError: function (reason) {
var promise = this;
- _config.config.after(function () {
+ _rsvpConfig.config.after(function () {
if (promise._onError) {
- _config.config['trigger']('error', reason);
+ _rsvpConfig.config['trigger']('error', reason);
}
});
},
/**
@@ -51085,33 +52069,33 @@
*/
then: function (onFulfillment, onRejection, label) {
var parent = this;
var state = parent._state;
- if (state === _internal.FULFILLED && !onFulfillment || state === _internal.REJECTED && !onRejection) {
- if (_config.config.instrument) {
- _instrument.default('chained', parent, parent);
+ if (state === _rsvpInternal.FULFILLED && !onFulfillment || state === _rsvpInternal.REJECTED && !onRejection) {
+ if (_rsvpConfig.config.instrument) {
+ _rsvpInstrument.default('chained', parent, parent);
}
return parent;
}
parent._onError = null;
- var child = new parent.constructor(_internal.noop, label);
+ var child = new parent.constructor(_rsvpInternal.noop, label);
var result = parent._result;
- if (_config.config.instrument) {
- _instrument.default('chained', parent, child);
+ if (_rsvpConfig.config.instrument) {
+ _rsvpInstrument.default('chained', parent, child);
}
if (state) {
var callback = arguments[state - 1];
- _config.config.async(function () {
- _internal.invokeCallback(state, child, callback, result);
+ _rsvpConfig.config.async(function () {
+ _rsvpInternal.invokeCallback(state, child, callback, result);
});
} else {
- _internal.subscribe(parent, child, onFulfillment, onRejection);
+ _rsvpInternal.subscribe(parent, child, onFulfillment, onRejection);
}
return child;
},
@@ -51201,273 +52185,16 @@
});
}, label);
}
};
});
-enifed('rsvp/promise/all', ['exports', '../enumerator'], function (exports, _enumerator) {
+enifed('rsvp/race', ['exports', 'rsvp/promise'], function (exports, _rsvpPromise) {
'use strict';
- exports.default = all;
-
- /**
- `RSVP.Promise.all` accepts an array of promises, and returns a new promise which
- is fulfilled with an array of fulfillment values for the passed promises, or
- rejected with the reason of the first passed promise to be rejected. It casts all
- elements of the passed iterable to promises as it runs this algorithm.
-
- Example:
-
- ```javascript
- var promise1 = RSVP.resolve(1);
- var promise2 = RSVP.resolve(2);
- var promise3 = RSVP.resolve(3);
- var promises = [ promise1, promise2, promise3 ];
-
- RSVP.Promise.all(promises).then(function(array){
- // The array here would be [ 1, 2, 3 ];
- });
- ```
-
- If any of the `promises` given to `RSVP.all` are rejected, the first promise
- that is rejected will be given as an argument to the returned promises's
- rejection handler. For example:
-
- Example:
-
- ```javascript
- var promise1 = RSVP.resolve(1);
- var promise2 = RSVP.reject(new Error("2"));
- var promise3 = RSVP.reject(new Error("3"));
- var promises = [ promise1, promise2, promise3 ];
-
- RSVP.Promise.all(promises).then(function(array){
- // Code here never runs because there are rejected promises!
- }, function(error) {
- // error.message === "2"
- });
- ```
-
- @method all
- @static
- @param {Array} entries array of promises
- @param {String} label optional string for labeling the promise.
- Useful for tooling.
- @return {Promise} promise that is fulfilled when all `promises` have been
- fulfilled, or rejected if any of them become rejected.
- @static
- */
-
- function all(entries, label) {
- return new _enumerator.default(this, entries, true, /* abort on reject */label).promise;
- }
-});
-enifed('rsvp/promise/race', ['exports', '../utils', '../-internal'], function (exports, _utils, _internal) {
- 'use strict';
-
exports.default = race;
/**
- `RSVP.Promise.race` returns a new promise which is settled in the same way as the
- first passed promise to settle.
-
- Example:
-
- ```javascript
- var promise1 = new RSVP.Promise(function(resolve, reject){
- setTimeout(function(){
- resolve('promise 1');
- }, 200);
- });
-
- var promise2 = new RSVP.Promise(function(resolve, reject){
- setTimeout(function(){
- resolve('promise 2');
- }, 100);
- });
-
- RSVP.Promise.race([promise1, promise2]).then(function(result){
- // result === 'promise 2' because it was resolved before promise1
- // was resolved.
- });
- ```
-
- `RSVP.Promise.race` is deterministic in that only the state of the first
- settled promise matters. For example, even if other promises given to the
- `promises` array argument are resolved, but the first settled promise has
- become rejected before the other promises became fulfilled, the returned
- promise will become rejected:
-
- ```javascript
- var promise1 = new RSVP.Promise(function(resolve, reject){
- setTimeout(function(){
- resolve('promise 1');
- }, 200);
- });
-
- var promise2 = new RSVP.Promise(function(resolve, reject){
- setTimeout(function(){
- reject(new Error('promise 2'));
- }, 100);
- });
-
- RSVP.Promise.race([promise1, promise2]).then(function(result){
- // Code here never runs
- }, function(reason){
- // reason.message === 'promise 2' because promise 2 became rejected before
- // promise 1 became fulfilled
- });
- ```
-
- An example real-world use case is implementing timeouts:
-
- ```javascript
- RSVP.Promise.race([ajax('foo.json'), timeout(5000)])
- ```
-
- @method race
- @static
- @param {Array} entries array of promises to observe
- @param {String} label optional string for describing the promise returned.
- Useful for tooling.
- @return {Promise} a promise which settles in the same way as the first passed
- promise to settle.
- */
-
- function race(entries, label) {
- /*jshint validthis:true */
- var Constructor = this;
-
- var promise = new Constructor(_internal.noop, label);
-
- if (!_utils.isArray(entries)) {
- _internal.reject(promise, new TypeError('You must pass an array to race.'));
- return promise;
- }
-
- var length = entries.length;
-
- function onFulfillment(value) {
- _internal.resolve(promise, value);
- }
-
- function onRejection(reason) {
- _internal.reject(promise, reason);
- }
-
- for (var i = 0; promise._state === _internal.PENDING && i < length; i++) {
- _internal.subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
- }
-
- return promise;
- }
-});
-enifed('rsvp/promise/reject', ['exports', '../-internal'], function (exports, _internal) {
- 'use strict';
-
- exports.default = reject;
-
- /**
- `RSVP.Promise.reject` returns a promise rejected with the passed `reason`.
- It is shorthand for the following:
-
- ```javascript
- var promise = new RSVP.Promise(function(resolve, reject){
- reject(new Error('WHOOPS'));
- });
-
- promise.then(function(value){
- // Code here doesn't run because the promise is rejected!
- }, function(reason){
- // reason.message === 'WHOOPS'
- });
- ```
-
- Instead of writing the above, your code now simply becomes the following:
-
- ```javascript
- var promise = RSVP.Promise.reject(new Error('WHOOPS'));
-
- promise.then(function(value){
- // Code here doesn't run because the promise is rejected!
- }, function(reason){
- // reason.message === 'WHOOPS'
- });
- ```
-
- @method reject
- @static
- @param {*} reason value that the returned promise will be rejected with.
- @param {String} label optional string for identifying the returned promise.
- Useful for tooling.
- @return {Promise} a promise rejected with the given `reason`.
- */
-
- function reject(reason, label) {
- /*jshint validthis:true */
- var Constructor = this;
- var promise = new Constructor(_internal.noop, label);
- _internal.reject(promise, reason);
- return promise;
- }
-});
-enifed('rsvp/promise/resolve', ['exports', '../-internal'], function (exports, _internal) {
- 'use strict';
-
- exports.default = resolve;
-
- /**
- `RSVP.Promise.resolve` returns a promise that will become resolved with the
- passed `value`. It is shorthand for the following:
-
- ```javascript
- var promise = new RSVP.Promise(function(resolve, reject){
- resolve(1);
- });
-
- promise.then(function(value){
- // value === 1
- });
- ```
-
- Instead of writing the above, your code now simply becomes the following:
-
- ```javascript
- var promise = RSVP.Promise.resolve(1);
-
- promise.then(function(value){
- // value === 1
- });
- ```
-
- @method resolve
- @static
- @param {*} object value that the returned promise will be resolved with
- @param {String} label optional string for identifying the returned promise.
- Useful for tooling.
- @return {Promise} a promise that will become fulfilled with the given
- `value`
- */
-
- function resolve(object, label) {
- /*jshint validthis:true */
- var Constructor = this;
-
- if (object && typeof object === 'object' && object.constructor === Constructor) {
- return object;
- }
-
- var promise = new Constructor(_internal.noop, label);
- _internal.resolve(promise, object);
- return promise;
- }
-});
-enifed('rsvp/race', ['exports', './promise'], function (exports, _promise) {
- 'use strict';
-
- exports.default = race;
-
- /**
This is a convenient alias for `RSVP.Promise.race`.
@method race
@static
@for RSVP
@@ -51475,14 +52202,14 @@
@param {String} label An optional label. This is useful
for tooling.
*/
function race(array, label) {
- return _promise.default.race(array, label);
+ return _rsvpPromise.default.race(array, label);
}
});
-enifed('rsvp/reject', ['exports', './promise'], function (exports, _promise) {
+enifed('rsvp/reject', ['exports', 'rsvp/promise'], function (exports, _rsvpPromise) {
'use strict';
exports.default = reject;
/**
@@ -51496,14 +52223,14 @@
Useful for tooling.
@return {Promise} a promise rejected with the given `reason`.
*/
function reject(reason, label) {
- return _promise.default.reject(reason, label);
+ return _rsvpPromise.default.reject(reason, label);
}
});
-enifed('rsvp/resolve', ['exports', './promise'], function (exports, _promise) {
+enifed('rsvp/resolve', ['exports', 'rsvp/promise'], function (exports, _rsvpPromise) {
'use strict';
exports.default = resolve;
/**
@@ -51518,11 +52245,11 @@
@return {Promise} a promise that will become fulfilled with the given
`value`
*/
function resolve(value, label) {
- return _promise.default.resolve(value, label);
+ return _rsvpPromise.default.resolve(value, label);
}
});
enifed("rsvp/rethrow", ["exports"], function (exports) {
/**
`RSVP.rethrow` will rethrow an error on the next turn of the JavaScript event
@@ -51625,8 +52352,145 @@
F.prototype = o;
return new F();
};
exports.o_create = o_create;
});
+enifed('rsvp', ['exports', 'rsvp/promise', 'rsvp/events', 'rsvp/node', 'rsvp/all', 'rsvp/all-settled', 'rsvp/race', 'rsvp/hash', 'rsvp/hash-settled', 'rsvp/rethrow', 'rsvp/defer', 'rsvp/config', 'rsvp/map', 'rsvp/resolve', 'rsvp/reject', 'rsvp/filter', 'rsvp/asap'], function (exports, _rsvpPromise, _rsvpEvents, _rsvpNode, _rsvpAll, _rsvpAllSettled, _rsvpRace, _rsvpHash, _rsvpHashSettled, _rsvpRethrow, _rsvpDefer, _rsvpConfig, _rsvpMap, _rsvpResolve, _rsvpReject, _rsvpFilter, _rsvpAsap) {
+ 'use strict';
+
+ // defaults
+ _rsvpConfig.config.async = _rsvpAsap.default;
+ _rsvpConfig.config.after = function (cb) {
+ setTimeout(cb, 0);
+ };
+ var cast = _rsvpResolve.default;
+ function async(callback, arg) {
+ _rsvpConfig.config.async(callback, arg);
+ }
+
+ function on() {
+ _rsvpConfig.config['on'].apply(_rsvpConfig.config, arguments);
+ }
+
+ function off() {
+ _rsvpConfig.config['off'].apply(_rsvpConfig.config, arguments);
+ }
+
+ // Set up instrumentation through `window.__PROMISE_INTRUMENTATION__`
+ if (typeof window !== 'undefined' && typeof window['__PROMISE_INSTRUMENTATION__'] === 'object') {
+ var callbacks = window['__PROMISE_INSTRUMENTATION__'];
+ _rsvpConfig.configure('instrument', true);
+ for (var eventName in callbacks) {
+ if (callbacks.hasOwnProperty(eventName)) {
+ on(eventName, callbacks[eventName]);
+ }
+ }
+ }
+
+ exports.cast = cast;
+ exports.Promise = _rsvpPromise.default;
+ exports.EventTarget = _rsvpEvents.default;
+ exports.all = _rsvpAll.default;
+ exports.allSettled = _rsvpAllSettled.default;
+ exports.race = _rsvpRace.default;
+ exports.hash = _rsvpHash.default;
+ exports.hashSettled = _rsvpHashSettled.default;
+ exports.rethrow = _rsvpRethrow.default;
+ exports.defer = _rsvpDefer.default;
+ exports.denodeify = _rsvpNode.default;
+ exports.configure = _rsvpConfig.configure;
+ exports.on = on;
+ exports.off = off;
+ exports.resolve = _rsvpResolve.default;
+ exports.reject = _rsvpReject.default;
+ exports.async = async;
+ exports.map = _rsvpMap.default;
+ exports.filter = _rsvpFilter.default;
+});
+enifed('rsvp.umd', ['exports', 'rsvp/platform', 'rsvp'], function (exports, _rsvpPlatform, _rsvp) {
+ 'use strict';
+
+ var RSVP = {
+ 'race': _rsvp.race,
+ 'Promise': _rsvp.Promise,
+ 'allSettled': _rsvp.allSettled,
+ 'hash': _rsvp.hash,
+ 'hashSettled': _rsvp.hashSettled,
+ 'denodeify': _rsvp.denodeify,
+ 'on': _rsvp.on,
+ 'off': _rsvp.off,
+ 'map': _rsvp.map,
+ 'filter': _rsvp.filter,
+ 'resolve': _rsvp.resolve,
+ 'reject': _rsvp.reject,
+ 'all': _rsvp.all,
+ 'rethrow': _rsvp.rethrow,
+ 'defer': _rsvp.defer,
+ 'EventTarget': _rsvp.EventTarget,
+ 'configure': _rsvp.configure,
+ 'async': _rsvp.async
+ };
+
+ /* global define:true module:true window: true */
+ if (typeof define === 'function' && define['amd']) {
+ define(function () {
+ return RSVP;
+ });
+ } else if (typeof module !== 'undefined' && module['exports']) {
+ module['exports'] = RSVP;
+ } else if (typeof _rsvpPlatform.default !== 'undefined') {
+ _rsvpPlatform.default['RSVP'] = RSVP;
+ }
+});
+enifed("vertex", ["exports"], function (exports) {
+ /**
+ * DAG Vertex
+ *
+ * @class Vertex
+ * @constructor
+ */
+
+ "use strict";
+
+ exports.default = Vertex;
+
+ function Vertex(name) {
+ this.name = name;
+ this.incoming = {};
+ this.incomingNames = [];
+ this.hasOutgoing = false;
+ this.value = null;
+ }
+});
+enifed("visit", ["exports"], function (exports) {
+ "use strict";
+
+ exports.default = visit;
+
+ function visit(vertex, fn, visited, path) {
+ var name = vertex.name;
+ var vertices = vertex.incoming;
+ var names = vertex.incomingNames;
+ var len = names.length;
+ var i;
+
+ if (!visited) {
+ visited = {};
+ }
+ if (!path) {
+ path = [];
+ }
+ if (visited.hasOwnProperty(name)) {
+ return;
+ }
+ path.push(name);
+ visited[name] = true;
+ for (i = 0; i < len; i++) {
+ visit(vertices[names[i]], fn, visited, path);
+ }
+ fn(vertex, path);
+ path.pop();
+ }
+});
requireModule("ember");
-})();
\ No newline at end of file
+}());