dist/ember.prod.js in ember-source-2.14.0.beta.1 vs dist/ember.prod.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 @@ -12064,14 +12064,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); @@ -17821,11 +17817,11 @@ false && (0, _emberDebug.assert)('unbound helper cannot be called with multiple params or hash params', args.positional.values.length === 1 && args.named.keys.length === 0); 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 () { @@ -17998,10 +17994,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-utils', 'ember-metal', 'ember-debug', 'ember-views', 'ember-glimmer/helpers/action'], function (exports, _emberUtils, _emberMetal, _emberDebug, _emberViews, _action) { 'use strict'; exports.ActionState = exports.ActionHelper = undefined; @@ -18813,10 +18821,11 @@ _templateObject3 = (0, _emberBabel.taggedTemplateLiteralLoose)(['component:-default'], ['component:-default']); }); 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 = // 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. @@ -18842,12 +18851,10 @@ macro = experimentalMacros[i]; macro(blocks, inlines); } - experimentalMacros = []; - return { blocks: blocks, inlines: inlines }; }; function refineInlineSyntax(path, params, hash, builder) { var name = path[0]; @@ -18906,11 +18913,11 @@ false && (0, _emberDebug.assert)('Helpers may not be used in the block form, for example {{#' + name + '}}{{/' + name + '}}. Please use a component, or alternatively use the helper in combination with a built-in Ember helper, for example {{#if (' + name + ')}}{{/if}}.', !builder.env.hasHelper(path, symbolTable)); return false; } - var experimentalMacros = []; + var experimentalMacros = exports.experimentalMacros = []; }); enifed('ember-glimmer/syntax/-in-element', ['exports', '@glimmer/runtime', '@glimmer/util'], function (exports, _runtime, _util) { 'use strict'; exports._inElementMacro = function (sexp, builder) { @@ -23502,11 +23509,11 @@ var capitalized = capitalize(name); Meta.prototype['writable' + capitalized] = function (create) { false && 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); } @@ -23666,11 +23673,11 @@ var pointer = this, map; while (pointer !== undefined) { map = pointer[key]; - if (map) { + if (map !== undefined) { return map; } pointer = pointer.parent; } }; @@ -23680,11 +23687,11 @@ map, value; while (pointer !== undefined) { map = pointer[key]; - if (map) { + if (map !== undefined) { value = map[subkey]; if (value !== undefined) { return value; } @@ -23700,11 +23707,11 @@ Meta.prototype.writeDeps = function (subkey, itemkey, value) { false && 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; }; @@ -23714,14 +23721,14 @@ value, itemvalue; while (pointer !== undefined) { map = pointer._deps; - if (map) { + if (map !== undefined) { value = map[subkey]; - if (value) { + if (value !== undefined) { itemvalue = value[itemkey]; if (itemvalue !== undefined) { return itemvalue; } @@ -23730,13 +23737,16 @@ pointer = pointer.parent; } }; Meta.prototype.hasDeps = function (subkey) { - var pointer = this; + var pointer = this, + deps; while (pointer !== undefined) { - if (pointer._deps && pointer._deps[subkey]) { + deps = pointer._deps; + + if (deps !== undefined && deps[subkey] !== undefined) { return true; } pointer = pointer.parent; } return false; @@ -23757,27 +23767,27 @@ var seen = void 0; var calls = void 0; while (pointer !== undefined) { map = pointer[key]; - if (map) { + if (map !== undefined) { 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 (i = 0; i < calls.length; i++) { _calls$i = calls[i], _innerKey = _calls$i[0], value = _calls$i[1]; fn(_innerKey, value); @@ -23792,11 +23802,11 @@ value; while (pointer !== undefined) { map = pointer['_' + key]; - if (map) { + if (map !== undefined) { value = map[subkey]; if (value !== undefined || subkey in map) { return value; } @@ -23807,11 +23817,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.set && descriptor.set.isMandatorySetter; if (isMandatorySetter) { this.writeValues(key, value); } else { obj[key] = value; @@ -23875,14 +23885,14 @@ map; var seen = void 0; while (pointer !== undefined) { 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]); } } } @@ -23914,11 +23924,11 @@ var capitalized = capitalize(name); Meta.prototype['writable' + capitalized] = function (create) { false && 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 () { @@ -23968,14 +23978,14 @@ }; exports.peekMeta = function (obj) { var pointer = obj; var meta = void 0; - while (pointer) { + while (pointer !== undefined && pointer !== null) { meta = metaStore.get(pointer); // jshint loopfunc:true - if (meta === null || meta) { + if (meta === null || meta !== undefined) { return meta; } pointer = getPrototypeOf(pointer); } @@ -24000,11 +24010,11 @@ }; } function deleteMeta(obj) { var meta = exports.peekMeta(obj); - if (meta) { + if (meta !== undefined) { meta.destroy(); } } /** @@ -24028,11 +24038,11 @@ function meta(obj) { 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; } @@ -24319,12 +24329,11 @@ if (isPath(keyName)) { return setPath(obj, keyName, value, tolerant); } - exports.peekMeta(obj); - + var meta$$1 = exports.peekMeta(obj); var possibleDesc = obj[keyName]; var desc = void 0, currentValue = void 0; if (possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor) { @@ -24343,17 +24352,17 @@ obj.setUnknownProperty(keyName, value); } else if (currentValue === value) { /* no change */ return value; } else { - propertyWillChange(obj, keyName); + propertyWillChange(obj, keyName, meta$$1); { obj[keyName] = value; } - propertyDidChange(obj, keyName); + propertyDidChange(obj, keyName, meta$$1); } return value; } @@ -24988,11 +24997,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; } @@ -25004,11 +25013,11 @@ cache[keyName] = UNDEFINED; } else { cache[keyName] = ret; } - propertyDidChange(obj, keyName); + propertyDidChange(obj, keyName, meta$$1); return ret; }; /* called before property is overridden */ @@ -30703,16 +30712,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 `{}` - controllerDefinedQueryParameterConfiguration = (0, _emberMetal.get)(controller, 'queryParams'); + controllerDefinedQueryParameterConfiguration = (0, _emberMetal.get)(controller, 'queryParams') || {}; 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. @@ -31415,11 +31424,11 @@ } if (transition) { qpValues = getQueryParamsFor(this, transition.state); - controller.setProperties(qpValues); + (0, _emberMetal.setProperties)(controller, qpValues); } this.setupController(controller, context, transition); if (this._environment.options.shouldRender) { @@ -33304,11 +33313,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) { @@ -36728,16 +36737,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; } @@ -36897,25 +36906,29 @@ this[property.name] = property.descriptor.value; }, arrayWillChange: function (content, idx, removedCnt) { 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); }, @@ -44316,11 +44329,11 @@ } }); enifed("ember/version", ["exports"], function (exports) { "use strict"; - exports.default = "2.14.0-beta.1"; + exports.default = "2.14.0-beta.2"; }); enifed('node-module', ['exports'], function(_exports) { var IS_NODE = typeof module === 'object' && typeof module.require === 'function'; if (IS_NODE) { _exports.require = module.require; @@ -44523,24 +44536,28 @@ 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("/"), i, part, flags, type; + var names = undefined; + var shouldDecodes = undefined; for (i = 0; i < parts.length; i++) { part = parts[i]; flags = 0; type = 0; @@ -44554,18 +44571,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 @@ -44746,10 +44772,11 @@ i, handler, names, shouldDecodes, params, + isDynamic, j, name, capture; var regex = state.regex(); if (!regex || !handlers) { @@ -44761,23 +44788,34 @@ result.length = handlers.length; for (i = 0; i < handlers.length; i++) { handler = handlers[i]; names = handler.names; shouldDecodes = handler.shouldDecodes; - params = {}; + params = EmptyObject; + isDynamic = false; - for (j = 0; j < names.length; j++) { - name = names[j]; - capture = captures && captures[currentCapture++]; + if (names !== EmptyArray && shouldDecodes !== EmptyArray) { + for (j = 0; j < names.length; j++) { + isDynamic = true; + name = names[j]; + capture = captures && captures[currentCapture++]; - if (RouteRecognizer.ENCODE_AND_DECODE_PATH_SEGMENTS && shouldDecodes[j]) { - params[name] = capture && decodeURIComponent(capture); - } else { - params[name] = capture; + 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 @@ -44800,27 +44838,27 @@ }; RouteRecognizer.prototype.add = function (routes, options) { var currentState = this.rootState, i, route, + ref, names, shouldDecodes, - segment, - handler; + segment; var pattern = "^"; var types = [0, 0, 0]; var handlers = new Array(routes.length); var allSegments = []; var isEmpty = true; var j = 0; for (i = 0; i < routes.length; i++) { route = routes[i]; - names = []; - shouldDecodes = []; - - parse(allSegments, route.path, names, types, shouldDecodes); + ref = parse(allSegments, route.path, types); + names = ref.names; + shouldDecodes = ref.shouldDecodes; // preserve j so it points to the start of newly added segments + for (; j < allSegments.length; j++) { segment = allSegments[j]; if (segment.type === 4 /* Epsilon */) { continue; @@ -44831,13 +44869,15 @@ pattern += "/"; // Add a representation of the segment to the NFA and regex currentState = eachChar[segment.type](segment, currentState); pattern += regex[segment.type](segment); } - 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 += "/"; } @@ -44858,17 +44898,20 @@ }; } }; RouteRecognizer.prototype.handlersFor = function (name) { var route = this.names[name], - i; + i, + handler; if (!route) { throw new Error("There is no route named " + name); } var result = new Array(route.handlers.length); for (i = 0; i < route.handlers.length; i++) { - result[i] = route.handlers[i]; + handler = route.handlers[i]; + + result[i] = handler; } return result; }; RouteRecognizer.prototype.hasRoute = function (name) { return !!this.names[name]; @@ -45021,10 +45064,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