dist/ember.debug.js in ember-source-2.14.0.beta.1 vs dist/ember.debug.js in ember-source-2.14.0.beta.2

- old
+ new

@@ -4,11 +4,11 @@ * @copyright Copyright 2011-2017 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.14.0-beta.1 + * @version 2.14.0-beta.2 */ var enifed, requireModule, Ember; var mainContext = this; // Used in ember-environment/lib/global.js @@ -9714,10 +9714,14 @@ if (factory === undefined) { return; } + if (true && factory && typeof factory._onLookup === 'function') { + factory._onLookup(fullName); + } + var manager = new FactoryManager(this, factory, fullName, normalizedName); if (true) { manager = wrapManagerInDeprecationProxy(manager); } @@ -12029,14 +12033,10 @@ }, unregister: function (fullName) { this.__container__.reset(fullName); this._super.apply(this, arguments); }, - willDestroy: function () { - this._super.apply(this, arguments); - (0, _emberMetal.run)(this.__container__, 'destroy'); - }, buildChildEngineInstance: function (name) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var Engine = this.lookup('engine:' + name); @@ -17902,11 +17902,11 @@ return _references.UnboundReference.create(args.positional.at(0).value()); }; }); -enifed('ember-glimmer/index', ['exports', 'ember-glimmer/helpers/action', 'ember-glimmer/templates/root', 'ember-glimmer/template', 'ember-glimmer/components/checkbox', 'ember-glimmer/components/text_field', 'ember-glimmer/components/text_area', 'ember-glimmer/components/link-to', 'ember-glimmer/component', 'ember-glimmer/helper', 'ember-glimmer/environment', 'ember-glimmer/utils/string', 'ember-glimmer/renderer', 'ember-glimmer/template_registry', 'ember-glimmer/setup-registry', 'ember-glimmer/dom'], function (exports, _action, _root, _template, _checkbox, _text_field, _text_area, _linkTo, _component, _helper, _environment, _string, _renderer, _template_registry, _setupRegistry, _dom) { +enifed('ember-glimmer/index', ['exports', 'ember-glimmer/helpers/action', 'ember-glimmer/templates/root', 'ember-glimmer/template', 'ember-glimmer/components/checkbox', 'ember-glimmer/components/text_field', 'ember-glimmer/components/text_area', 'ember-glimmer/components/link-to', 'ember-glimmer/component', 'ember-glimmer/helper', 'ember-glimmer/environment', 'ember-glimmer/utils/string', 'ember-glimmer/renderer', 'ember-glimmer/template_registry', 'ember-glimmer/setup-registry', 'ember-glimmer/dom', 'ember-glimmer/syntax'], function (exports, _action, _root, _template, _checkbox, _text_field, _text_area, _linkTo, _component, _helper, _environment, _string, _renderer, _template_registry, _setupRegistry, _dom, _syntax) { 'use strict'; Object.defineProperty(exports, 'INVOKE', { enumerable: true, get: function () { @@ -18079,10 +18079,22 @@ enumerable: true, get: function () { return _dom.DOMTreeConstruction; } }); + Object.defineProperty(exports, '_registerMacros', { + enumerable: true, + get: function () { + return _syntax.registerMacros; + } + }); + Object.defineProperty(exports, '_experimentalMacros', { + enumerable: true, + get: function () { + return _syntax.experimentalMacros; + } + }); }); enifed('ember-glimmer/modifiers/action', ['exports', 'ember-babel', 'ember-utils', 'ember-metal', 'ember-debug', 'ember-views', 'ember-glimmer/helpers/action'], function (exports, _emberBabel, _emberUtils, _emberMetal, _emberDebug, _emberViews, _action) { 'use strict'; exports.ActionState = exports.ActionHelper = undefined; @@ -18893,10 +18905,11 @@ } }); enifed('ember-glimmer/syntax', ['exports', 'ember-glimmer/syntax/render', 'ember-glimmer/syntax/outlet', 'ember-glimmer/syntax/mount', 'ember-glimmer/syntax/dynamic-component', 'ember-glimmer/utils/bindings', 'ember-glimmer/syntax/-with-dynamic-vars', 'ember-glimmer/syntax/-in-element', 'ember-glimmer/syntax/input', 'ember-glimmer/syntax/-text-area', 'ember-debug'], function (exports, _render, _outlet, _mount, _dynamicComponent, _bindings, _withDynamicVars, _inElement, _input, _textArea, _emberDebug) { 'use strict'; + exports.experimentalMacros = undefined; exports.registerMacros = registerMacros; exports.populateMacros = populateMacros; function refineInlineSyntax(path, params, hash, builder) { @@ -18960,11 +18973,11 @@ return false; } - var experimentalMacros = []; + var experimentalMacros = exports.experimentalMacros = []; // This is a private API to allow for expiremental macros // to be created in user space. Registering a macro should // should be done in an initializer. function registerMacros(macro) { @@ -18987,12 +19000,10 @@ for (var i = 0; i < experimentalMacros.length; i++) { var macro = experimentalMacros[i]; macro(blocks, inlines); } - experimentalMacros = []; - return { blocks: blocks, inlines: inlines }; } }); enifed('ember-glimmer/syntax/-in-element', ['exports', '@glimmer/runtime', '@glimmer/util'], function (exports, _runtime, _util) { 'use strict'; @@ -24352,22 +24363,22 @@ Meta.prototype._getInherited = function _getInherited(key) { var pointer = this; while (pointer !== undefined) { var map = pointer[key]; - if (map) { + if (map !== undefined) { return map; } pointer = pointer.parent; } }; Meta.prototype._findInherited = function _findInherited(key, subkey) { var pointer = this; while (pointer !== undefined) { var map = pointer[key]; - if (map) { + if (map !== undefined) { var value = map[subkey]; if (value !== undefined) { return value; } } @@ -24382,23 +24393,23 @@ Meta.prototype.writeDeps = function writeDeps(subkey, itemkey, value) { true && emberDebug.assert('Cannot call writeDeps after the object is destroyed.', !this.isMetaDestroyed()); var outerMap = this._getOrCreateOwnMap('_deps'); var innerMap = outerMap[subkey]; - if (!innerMap) { + if (innerMap === undefined) { innerMap = outerMap[subkey] = Object.create(null); } innerMap[itemkey] = value; }; Meta.prototype.peekDeps = function peekDeps(subkey, itemkey) { var pointer = this; while (pointer !== undefined) { var map = pointer._deps; - if (map) { + if (map !== undefined) { var value = map[subkey]; - if (value) { + if (value !== undefined) { var itemvalue = value[itemkey]; if (itemvalue !== undefined) { return itemvalue; } } @@ -24408,11 +24419,12 @@ }; Meta.prototype.hasDeps = function hasDeps(subkey) { var pointer = this; while (pointer !== undefined) { - if (pointer._deps && pointer._deps[subkey]) { + var deps = pointer._deps; + if (deps !== undefined && deps[subkey] !== undefined) { return true; } pointer = pointer.parent; } return false; @@ -24426,26 +24438,26 @@ var pointer = this; var seen = void 0; var calls = void 0; while (pointer !== undefined) { var map = pointer[key]; - if (map) { + if (map !== undefined) { var innerMap = map[subkey]; - if (innerMap) { + if (innerMap !== undefined) { for (var innerKey in innerMap) { seen = seen || Object.create(null); - if (!seen[innerKey]) { + if (seen[innerKey] === undefined) { seen[innerKey] = true; calls = calls || []; calls.push([innerKey, innerMap[innerKey]]); } } } } pointer = pointer.parent; } - if (calls) { + if (calls !== undefined) { for (var i = 0; i < calls.length; i++) { var _calls$i = calls[i], _innerKey = _calls$i[0], value = _calls$i[1]; @@ -24459,11 +24471,11 @@ var pointer = this; while (pointer !== undefined) { var map = pointer[internalKey]; - if (map) { + if (map !== undefined) { var value = map[subkey]; if (value !== undefined || subkey in map) { return value; } } @@ -24473,11 +24485,11 @@ return UNDEFINED; }; Meta.prototype.writeValue = function writeValue(obj, key, value) { var descriptor = emberUtils.lookupDescriptor(obj, key); - var isMandatorySetter = descriptor && descriptor.set && descriptor.set.isMandatorySetter; + var isMandatorySetter = descriptor !== undefined && descriptor.set && descriptor.set.isMandatorySetter; if (isMandatorySetter) { this.writeValues(key, value); } else { obj[key] = value; @@ -24539,14 +24551,14 @@ Meta.prototype['forEach' + capitalized] = function (fn) { var pointer = this; var seen = void 0; while (pointer !== undefined) { var map = pointer[key]; - if (map) { + if (map !== undefined) { for (var _key in map) { seen = seen || Object.create(null); - if (!seen[_key]) { + if (seen[_key] === undefined) { seen[_key] = true; fn(_key, map[_key]); } } } @@ -24578,11 +24590,11 @@ var capitalized = capitalize(name); Meta.prototype['writable' + capitalized] = function (create) { true && emberDebug.assert('Cannot call writable' + capitalized + ' after the object is destroyed.', !this.isMetaDestroyed()); var ret = this[key]; - if (!ret) { + if (ret === undefined) { ret = this[key] = create(this.source); } return ret; }; Meta.prototype['readable' + capitalized] = function () { @@ -24598,11 +24610,11 @@ var capitalized = capitalize(name); Meta.prototype['writable' + capitalized] = function (create) { true && emberDebug.assert('Cannot call writable' + capitalized + ' after the object is destroyed.', !this.isMetaDestroyed()); var ret = this[key]; - if (!ret) { + if (ret === undefined) { if (this.parent) { ret = this[key] = this.parent['writable' + capitalized](create).copy(this.source); } else { ret = this[key] = create(this.source); } @@ -24644,11 +24656,11 @@ var pointer = this; while (pointer !== undefined) { var map = pointer[internalKey]; - if (map) { + if (map !== undefined) { var value = map[subkey]; if (value !== undefined || subkey in map) { return value; } } @@ -24658,11 +24670,11 @@ return UNDEFINED; }; Meta.prototype.writeValue = function (obj, key, value) { var descriptor = emberUtils.lookupDescriptor(obj, key); - var isMandatorySetter = descriptor && descriptor.set && descriptor.set.isMandatorySetter; + var isMandatorySetter = descriptor !== undefined && descriptor !== null && descriptor.set && descriptor.set.isMandatorySetter; if (isMandatorySetter) { this.writeValues(key, value); } else { obj[key] = value; @@ -24694,20 +24706,20 @@ }; exports.peekMeta = function WeakMap_peekParentMeta(obj) { var pointer = obj; var meta = void 0; - while (pointer) { + while (pointer !== undefined && pointer !== null) { meta = metaStore.get(pointer); // jshint loopfunc:true { counters.peekCalls++; } // stop if we find a `null` value, since // that means the meta was deleted // any other truthy value is a "real" meta - if (meta === null || meta) { + if (meta === null || meta !== undefined) { return meta; } pointer = getPrototypeOf(pointer); { @@ -24739,11 +24751,11 @@ { counters.deleteCalls++; } var meta = exports.peekMeta(obj); - if (meta) { + if (meta !== undefined) { meta.destroy(); } } /** @@ -24771,11 +24783,11 @@ var maybeMeta = exports.peekMeta(obj); var parent = void 0; // remove this code, in-favor of explicit parent - if (maybeMeta) { + if (maybeMeta !== undefined && maybeMeta !== null) { if (maybeMeta.source === obj) { return maybeMeta; } parent = maybeMeta; } @@ -25094,19 +25106,19 @@ obj.setUnknownProperty(keyName, value); } else if (currentValue === value) { /* no change */ return value; } else { - propertyWillChange(obj, keyName); + propertyWillChange(obj, keyName, meta$$1); if (ember_features.MANDATORY_SETTER) { setWithMandatorySetter(meta$$1, obj, keyName, value); } else { obj[keyName] = value; } - propertyDidChange(obj, keyName); + propertyDidChange(obj, keyName, meta$$1); } return value; } @@ -25761,11 +25773,11 @@ // allows setter to return the same value that is cached already if (hadCachedValue && cachedValue === ret) { return ret; } - propertyWillChange(obj, keyName); + propertyWillChange(obj, keyName, meta$$1); if (hadCachedValue) { cache[keyName] = undefined; } @@ -25777,11 +25789,11 @@ cache[keyName] = UNDEFINED; } else { cache[keyName] = ret; } - propertyDidChange(obj, keyName); + propertyDidChange(obj, keyName, meta$$1); return ret; }; /* called before property is overridden */ @@ -31377,16 +31389,16 @@ var controller = owner.lookup('controller:' + controllerName); var queryParameterConfiguraton = (0, _emberMetal.get)(this, 'queryParams'); var hasRouterDefinedQueryParams = !!Object.keys(queryParameterConfiguraton).length; if (controller) { - // the developer has authored a controller class in their application for this route - // access the prototype, find its query params and normalize their object shape - // them merge in the query params for the route. As a mergedProperty, Route#queryParams is always - // at least `{}` + // the developer has authored a controller class in their application for + // this route find its query params and normalize their object shape them + // merge in the query params for the route. As a mergedProperty, + // Route#queryParams is always at least `{}` - var controllerDefinedQueryParameterConfiguration = (0, _emberMetal.get)(controller, 'queryParams'); + var controllerDefinedQueryParameterConfiguration = (0, _emberMetal.get)(controller, 'queryParams') || {}; var normalizedControllerQueryParameterConfiguration = (0, _utils.normalizeControllerQueryParams)(controllerDefinedQueryParameterConfiguration); combinedQueryParameterConfiguration = mergeEachQueryParams(normalizedControllerQueryParameterConfiguration, queryParameterConfiguraton); } else if (hasRouterDefinedQueryParams) { // the developer has not defined a controller but *has* supplied route query params. // Generate a class for them so we can later insert default values @@ -32054,11 +32066,11 @@ }); } if (transition) { var qpValues = getQueryParamsFor(this, transition.state); - controller.setProperties(qpValues); + (0, _emberMetal.setProperties)(controller, qpValues); } this.setupController(controller, context, transition); if (this._environment.options.shouldRender) { @@ -33893,11 +33905,11 @@ } (0, _emberMetal.deprecateProperty)(EmberRouter.prototype, 'router', '_routerMicrolib', { id: 'ember-router.router', until: '2.16', - url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-router-router-renamed-to-ember-router-_routerMicrolib' + url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-router-router-renamed-to-ember-router-_routermicrolib' }); exports.default = EmberRouter; }); enifed('ember-routing/system/router_state', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime'], function (exports, _emberUtils, _emberMetal, _emberRuntime) { @@ -37230,16 +37242,16 @@ var meta = (0, _emberMetal.peekMeta)(array); var cache = meta && meta.readableCache(); if (cache) { if (cache.firstObject !== undefined && objectAt(array, 0) !== _emberMetal.cacheFor.get(cache, 'firstObject')) { - (0, _emberMetal.propertyWillChange)(array, 'firstObject'); - (0, _emberMetal.propertyDidChange)(array, 'firstObject'); + (0, _emberMetal.propertyWillChange)(array, 'firstObject', meta); + (0, _emberMetal.propertyDidChange)(array, 'firstObject', meta); } if (cache.lastObject !== undefined && objectAt(array, (0, _emberMetal.get)(array, 'length') - 1) !== _emberMetal.cacheFor.get(cache, 'lastObject')) { - (0, _emberMetal.propertyWillChange)(array, 'lastObject'); - (0, _emberMetal.propertyDidChange)(array, 'lastObject'); + (0, _emberMetal.propertyWillChange)(array, 'lastObject', meta); + (0, _emberMetal.propertyDidChange)(array, 'lastObject', meta); } } return array; } @@ -37439,25 +37451,29 @@ this[property.name] = property.descriptor.value; }, arrayWillChange: function (content, idx, removedCnt, addedCnt) { var keys = this._keys; var lim = removedCnt > 0 ? idx + removedCnt : -1; + var meta = void 0; for (var key in keys) { + meta = meta || (0, _emberMetal.peekMeta)(this); if (lim > 0) { removeObserverForContentKey(content, key, this, idx, lim); } - (0, _emberMetal.propertyWillChange)(this, key); + (0, _emberMetal.propertyWillChange)(this, key, meta); } }, arrayDidChange: function (content, idx, removedCnt, addedCnt) { var keys = this._keys; var lim = addedCnt > 0 ? idx + addedCnt : -1; + var meta = void 0; for (var key in keys) { + meta = meta || (0, _emberMetal.peekMeta)(this); if (lim > 0) { addObserverForContentKey(content, key, this, idx, lim); } - (0, _emberMetal.propertyDidChange)(this, key); + (0, _emberMetal.propertyDidChange)(this, key, meta); } }, willWatchProperty: function (property) { this.beginObservingContentKey(property); }, @@ -48028,11 +48044,11 @@ } }); enifed("ember/version", ["exports"], function (exports) { "use strict"; - exports.default = "2.14.0-beta.1"; + exports.default = "2.14.0-beta.2"; }); enifed("handlebars", ["exports"], function (exports) { "use strict"; /* istanbul ignore next */ @@ -49625,20 +49641,24 @@ return getParam(params, segment.value); }; generate[4 /* Epsilon */] = function () { return ""; }; + var EmptyObject = Object.freeze({}); + var EmptyArray = Object.freeze([]); // The `names` will be populated with the paramter name for each dynamic/star // segment. `shouldDecodes` will be populated with a boolean for each dyanamic/star // segment, indicating whether it should be decoded during recognition. - function parse(segments, route, names, types, shouldDecodes) { + function parse(segments, route, types) { // normalize route as not starting with a "/". Recognition will // also normalize. if (route.length > 0 && route.charCodeAt(0) === 47 /* SLASH */) { route = route.substr(1); } var parts = route.split("/"); + var names = undefined; + var shouldDecodes = undefined; for (var i = 0; i < parts.length; i++) { var part = parts[i]; var flags = 0; var type = 0; if (part === "") { @@ -49651,18 +49671,27 @@ type = 0 /* Static */; } flags = 2 << type; if (flags & 12 /* Named */) { part = part.slice(1); + names = names || []; names.push(part); + shouldDecodes = shouldDecodes || []; shouldDecodes.push((flags & 4 /* Decoded */) !== 0); } if (flags & 14 /* Counted */) { types[type]++; } - segments.push({ type: type, value: normalizeSegment(part) }); + segments.push({ + type: type, + value: normalizeSegment(part) + }); } + return { + names: names || EmptyArray, + shouldDecodes: shouldDecodes || EmptyArray + }; } function isEqualCharSpec(spec, char, negate) { return spec.char === char && spec.negate === negate; } // A State has a character specification and (`charSpec`) and a list of possible @@ -49836,21 +49865,32 @@ result.length = handlers.length; for (var i = 0; i < handlers.length; i++) { var handler = handlers[i]; var names = handler.names; var shouldDecodes = handler.shouldDecodes; - var params = {}; - for (var j = 0; j < names.length; j++) { - var name = names[j]; - var capture = captures && captures[currentCapture++]; - if (RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS && shouldDecodes[j]) { - params[name] = capture && decodeURIComponent(capture); - } else { - params[name] = capture; + var params = EmptyObject; + var isDynamic = false; + if (names !== EmptyArray && shouldDecodes !== EmptyArray) { + for (var j = 0; j < names.length; j++) { + isDynamic = true; + var name = names[j]; + var capture = captures && captures[currentCapture++]; + if (params === EmptyObject) { + params = {}; + } + if (RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS && shouldDecodes[j]) { + params[name] = capture && decodeURIComponent(capture); + } else { + params[name] = capture; + } } } - result[i] = { handler: handler.handler, params: params, isDynamic: !!names.length }; + result[i] = { + handler: handler.handler, + params: params, + isDynamic: isDynamic + }; } return result; } function decodeQueryParamPart(part) { // http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1 @@ -49879,13 +49919,13 @@ var allSegments = []; var isEmpty = true; var j = 0; for (var i = 0; i < routes.length; i++) { var route = routes[i]; - var names = []; - var shouldDecodes = []; - parse(allSegments, route.path, names, types, shouldDecodes); + var ref = parse(allSegments, route.path, types); + var names = ref.names; + var shouldDecodes = ref.shouldDecodes; // preserve j so it points to the start of newly added segments for (; j < allSegments.length; j++) { var segment = allSegments[j]; if (segment.type === 4 /* Epsilon */) { continue; @@ -49896,12 +49936,15 @@ pattern += "/"; // Add a representation of the segment to the NFA and regex currentState = eachChar[segment.type](segment, currentState); pattern += regex[segment.type](segment); } - var handler = { handler: route.handler, names: names, shouldDecodes: shouldDecodes }; - handlers[i] = handler; + handlers[i] = { + handler: route.handler, + names: names, + shouldDecodes: shouldDecodes + }; } if (isEmpty) { currentState = currentState.put(47 /* SLASH */, false, false); pattern += "/"; } @@ -49927,11 +49970,12 @@ if (!route) { throw new Error("There is no route named " + name); } var result = new Array(route.handlers.length); for (var i = 0; i < route.handlers.length; i++) { - result[i] = route.handlers[i]; + var handler = route.handlers[i]; + result[i] = handler; } return result; }; RouteRecognizer.prototype.hasRoute = function hasRoute(name) { return !!this.names[name]; @@ -50068,10 +50112,10 @@ } results = findHandler(state, originalPath, queryParams); } return results; }; - RouteRecognizer.VERSION = "0.3.2"; + RouteRecognizer.VERSION = "0.3.3"; // Set to false to opt-out of encoding and decoding path segments. // See https://github.com/tildeio/route-recognizer/pull/55 RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS = true; RouteRecognizer.Normalizer = { normalizeSegment: normalizeSegment, normalizePath: normalizePath, encodePathSegment: encodePathSegment