dist/ember.prod.js in ember-source-2.4.3 vs dist/ember.prod.js in ember-source-2.4.4

- old
+ new

@@ -4,11 +4,11 @@ * @copyright Copyright 2011-2016 Tilde Inc. and contributors * Portions Copyright 2006-2011 Strobe Inc. * Portions Copyright 2008-2011 Apple Inc. All rights reserved. * @license Licensed under MIT license * See https://raw.github.com/emberjs/ember.js/master/LICENSE - * @version 2.4.3 + * @version 2.4.4 */ var enifed, requireModule, require, requirejs, Ember; var mainContext = this; @@ -6822,11 +6822,11 @@ ``` Each time the input to a helper changes, the `compute` function will be called again. - As instances, these helpers also have access to the container an will accept + As instances, these helpers also have access to the container and will accept injected dependencies. Additionally, class helpers can call `recompute` to force a new computation. @class Ember.Helper @@ -7335,11 +7335,11 @@ You can also specify a template to show if the property is falsey by using the `else` helper. ```handlebars - {{!Is it raining outside?}} + {{! is it raining outside?}} {{#if isRaining}} Yes, grab an umbrella! {{else}} No, it's lovely outside! {{/if}} @@ -9901,11 +9901,11 @@ @submodule ember-templates */ 'use strict'; - _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.4.3'; + _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.4.4'; /** 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: @@ -14695,11 +14695,11 @@ this.firstName = 'Betty'; this.lastName = 'Jones'; }, - fullName: Ember.computed({ + fullName: Ember.computed('firstName', 'lastName', { get(key) { return `${this.get('firstName')} ${this.get('lastName')}`; }, set(key, value) { let [firstName, lastName] = value.split(/\s+/); @@ -15481,11 +15481,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.4.3 + @version 2.4.4 @public */ if ('undefined' === typeof Ember) { // Create core object. Make it act like an instance of Ember.Namespace so that @@ -15523,15 +15523,15 @@ /** The semantic version. @property VERSION @type String - @default '2.4.3' + @default '2.4.4' @static @public */ - Ember.VERSION = '2.4.3'; + Ember.VERSION = '2.4.4'; /** 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 @@ -25483,11 +25483,11 @@ var qpMap = _emberMetalProperty_get.get(this, '_qp').map; var totalChanged = Object.keys(changed).concat(Object.keys(removed)); for (var i = 0, len = totalChanged.length; i < len; ++i) { var qp = qpMap[totalChanged[i]]; - if (qp && _emberMetalProperty_get.get(this._optionsForQueryParam(qp), 'refreshModel')) { + if (qp && _emberMetalProperty_get.get(this._optionsForQueryParam(qp), 'refreshModel') && this.router.currentState) { this.refresh(); } } return true; @@ -26522,11 +26522,11 @@ the Route calls `render`: ```javascript // this.render('post', { // the template name associated with 'post' Route into: 'application', // the parent route to 'post' Route - outlet: 'main', // {{outlet}} and {{outlet 'main' are synonymous}}, + outlet: 'main', // {{outlet}} and {{outlet 'main'}} are synonymous, view: 'post', // the view associated with the 'post' Route controller: 'post', // the controller associated with the 'post' Route }) ``` By default the controller's `model` will be the route's model, so it does not @@ -27465,10 +27465,16 @@ _doTransition: function (_targetRouteName, models, _queryParams) { var targetRouteName = _targetRouteName || _emberRoutingUtils.getActiveTargetName(this.router); var queryParams = {}; + // merge in any queryParams from the active transition which could include + // queryparams from the url on initial load. + if (this.router.activeTransition) { + _emberMetalAssign.default(queryParams, this.router.activeTransition.queryParams); + } + _emberMetalAssign.default(queryParams, _queryParams); this._prepareQueryParams(targetRouteName, models, queryParams); var transitionArgs = _emberRoutingUtils.routeArgs(targetRouteName, models, queryParams); var transition = this.router.transitionTo.apply(this.router, transitionArgs); @@ -28476,11 +28482,12 @@ 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. + `{{action}}` helpers called in element space can control event bubbling. Note + that the closure style actions cannot. 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: @@ -28496,10 +28503,32 @@ ```handlebars <button {{action 'edit' post bubbles=false}}>Edit</button> ``` + To disable bubbling with closure style actions you must create your own + wrapper helper that makes use of `event.stopPropagation()`: + + ```handlebars + <div onclick={{disable-bubbling (action "sayHello")}}>Hello</div> + ``` + + ```js + // app/helpers/disable-bubbling.js + import Ember from 'ember'; + + export function disableBubbling([action]) { + return function(event) { + event.stopPropagation(); + + return action(event); + }; + } + + export default Ember.Helper.helper(disableBubbling); + ``` + 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 @@ -28616,10 +28645,13 @@ } if (!action) { throw new _emberMetalError.default('An action named \'' + actionName + '\' was not found in ' + target + '.'); } + } else if (action && typeof action[INVOKE] === 'function') { + target = action; + action = action[INVOKE]; } 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 + '.'); } } @@ -28974,28 +29006,29 @@ controllerName = name; controllerFullName = 'controller:' + controllerName; } var parentController = _emberMetalStreamsUtils.read(scope.getLocal('controller')); + var target = parentController || router; var controller; // choose name if (params.length > 1) { var factory = owner._lookupFactory(controllerFullName) || _emberRoutingSystemGenerate_controller.generateControllerFactory(owner, controllerName); controller = factory.create({ model: _emberMetalStreamsUtils.read(context), parentController: parentController, - target: parentController + target: target }); node.addDestruction(controller); } else { controller = owner.lookup(controllerFullName) || _emberRoutingSystemGenerate_controller.default(owner, controllerName); controller.setProperties({ - target: parentController, + target: target, parentController: parentController }); } if (view) { @@ -29413,11 +29446,11 @@ @submodule ember-routing-views */ 'use strict'; - _emberHtmlbarsTemplatesLinkTo.default.meta.revision = 'Ember@2.4.3'; + _emberHtmlbarsTemplatesLinkTo.default.meta.revision = 'Ember@2.4.4'; /** `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. @@ -29849,11 +29882,11 @@ // Do not mutate params in place var params = _emberMetalProperty_get.get(this, 'params').slice(); var disabledWhen = _emberMetalProperty_get.get(this, 'disabledWhen'); - if (disabledWhen) { + if (disabledWhen !== undefined) { this.set('disabled', disabledWhen); } // Process the positional arguments, in order. // 1. Inline link title comes first, if present. @@ -29913,11 +29946,11 @@ @submodule ember-routing-views */ 'use strict'; - _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.4.3'; + _emberHtmlbarsTemplatesTopLevelView.default.meta.revision = 'Ember@2.4.4'; var CoreOutletView = _emberViewsViewsView.default.extend({ defaultTemplate: _emberHtmlbarsTemplatesTopLevelView.default, init: function () { @@ -32349,12 +32382,23 @@ /** Returns a special object that can be used to observe individual properties on the array. Just get an equivalent property on this object and it will return an enumerable that maps automatically to the named key on the member objects. - If you merely want to watch for any items being added or removed to the array, - use the `[]` property instead of `@each`. + @each should only be used in a non-terminal context. Example: + ```javascript + myMethod: computed('posts.@each.author', function(){ + ... + }); + ``` + If you merely want to watch for the array being changed, like an object being + replaced, added or removed, use `[]` instead of `@each`. + ```javascript + myMethod: computed('posts.[]', function(){ + ... + }); + ``` @property @each @public */ '@each': _emberMetalComputed.computed(function () { // TODO use Symbol or add to meta @@ -37820,16 +37864,17 @@ EmberHandlebars.precompile = _emberTemplateCompilerCompatPrecompile.default; EmberHandlebars.compile = _emberTemplateCompilerSystemCompile.default; EmberHandlebars.template = _emberTemplateCompilerSystemTemplate.default; }); -enifed('ember-template-compiler/index', ['exports', 'ember-metal', 'ember-template-compiler/system/precompile', 'ember-template-compiler/system/compile', 'ember-template-compiler/system/template', 'ember-template-compiler/plugins', 'ember-template-compiler/plugins/transform-old-binding-syntax', 'ember-template-compiler/plugins/transform-old-class-binding-syntax', 'ember-template-compiler/plugins/transform-item-class', 'ember-template-compiler/plugins/transform-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-template-compiler/index', ['exports', 'ember-metal', 'ember-template-compiler/system/precompile', 'ember-template-compiler/system/compile', 'ember-template-compiler/system/template', 'ember-template-compiler/plugins', 'ember-template-compiler/plugins/transform-old-binding-syntax', 'ember-template-compiler/plugins/transform-old-class-binding-syntax', 'ember-template-compiler/plugins/transform-item-class', 'ember-template-compiler/plugins/transform-closure-component-attrs-into-mut', 'ember-template-compiler/plugins/transform-component-attrs-into-mut', 'ember-template-compiler/plugins/transform-component-curly-to-readonly', 'ember-template-compiler/plugins/transform-angle-bracket-components', 'ember-template-compiler/plugins/transform-input-on-to-onEvent', 'ember-template-compiler/plugins/transform-top-level-components', 'ember-template-compiler/plugins/transform-each-into-collection', 'ember-template-compiler/plugins/transform-unescaped-inline-link-to', 'ember-template-compiler/plugins/assert-no-view-and-controller-paths', 'ember-template-compiler/plugins/assert-no-view-helper', 'ember-template-compiler/compat'], function (exports, _emberMetal, _emberTemplateCompilerSystemPrecompile, _emberTemplateCompilerSystemCompile, _emberTemplateCompilerSystemTemplate, _emberTemplateCompilerPlugins, _emberTemplateCompilerPluginsTransformOldBindingSyntax, _emberTemplateCompilerPluginsTransformOldClassBindingSyntax, _emberTemplateCompilerPluginsTransformItemClass, _emberTemplateCompilerPluginsTransformClosureComponentAttrsIntoMut, _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut, _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly, _emberTemplateCompilerPluginsTransformAngleBracketComponents, _emberTemplateCompilerPluginsTransformInputOnToOnEvent, _emberTemplateCompilerPluginsTransformTopLevelComponents, _emberTemplateCompilerPluginsTransformEachIntoCollection, _emberTemplateCompilerPluginsTransformUnescapedInlineLinkTo, _emberTemplateCompilerPluginsAssertNoViewAndControllerPaths, _emberTemplateCompilerPluginsAssertNoViewHelper, _emberTemplateCompilerCompat) { 'use strict'; _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldBindingSyntax.default); _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformOldClassBindingSyntax.default); _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformItemClass.default); + _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformClosureComponentAttrsIntoMut.default); _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentAttrsIntoMut.default); _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformComponentCurlyToReadonly.default); _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformAngleBracketComponents.default); _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformInputOnToOnEvent.default); _emberTemplateCompilerPlugins.registerPlugin('ast', _emberTemplateCompilerPluginsTransformTopLevelComponents.default); @@ -37989,10 +38034,92 @@ return node.type === 'ComponentNode'; } exports.default = TransformAngleBracketComponents; }); +enifed('ember-template-compiler/plugins/transform-closure-component-attrs-into-mut', ['exports'], function (exports) { + 'use strict'; + + function TransformClosureComponentAttrsIntoMut() { + // set later within HTMLBars to the syntax package + this.syntax = null; + } + + /** + @private + @method transform + @param {AST} ast The AST to be transformed. + */ + TransformClosureComponentAttrsIntoMut.prototype.transform = function TransformClosureComponentAttrsIntoMut_transform(ast) { + var b = this.syntax.builders; + var walker = new this.syntax.Walker(); + + walker.visit(ast, function (node) { + if (validate(node)) { + processExpression(b, node); + } + }); + + return ast; + }; + + function processExpression(builder, node) { + processSubExpressionsInNode(builder, node); + + if (isComponentClosure(node)) { + mutParameters(builder, node); + } + } + + function processSubExpressionsInNode(builder, node) { + for (var i = 0; i < node.params.length; i++) { + if (node.params[i].type === 'SubExpression') { + processExpression(builder, node.params[i]); + } + } + + each(node.hash.pairs, function (pair) { + var value = pair.value; + + if (value.type === 'SubExpression') { + processExpression(builder, value); + } + }); + } + + function isComponentClosure(node) { + return node.type === 'SubExpression' && node.path.original === 'component'; + } + + function mutParameters(builder, node) { + for (var i = 1; i < node.params.length; i++) { + if (node.params[i].type === 'PathExpression') { + node.params[i] = builder.sexpr(builder.path('@mut'), [node.params[i]]); + } + } + + each(node.hash.pairs, function (pair) { + var value = pair.value; + + if (value.type === 'PathExpression') { + pair.value = builder.sexpr(builder.path('@mut'), [pair.value]); + } + }); + } + + function validate(node) { + return node.type === 'BlockStatement' || node.type === 'MustacheStatement'; + } + + function each(list, callback) { + for (var i = 0, l = list.length; i < l; i++) { + callback(list[i]); + } + } + + exports.default = TransformClosureComponentAttrsIntoMut; +}); enifed('ember-template-compiler/plugins/transform-component-attrs-into-mut', ['exports'], function (exports) { 'use strict'; function TransformComponentAttrsIntoMut() { // set later within HTMLBars to the syntax package @@ -38839,11 +38966,11 @@ options.plugins = plugins; options.buildMeta = function buildMeta(program) { return { fragmentReason: fragmentReason(program), - revision: 'Ember@2.4.3', + revision: 'Ember@2.4.4', loc: program.loc, moduleName: options.moduleName }; }; @@ -39222,10 +39349,11 @@ requirement in web components. @class Component @namespace Ember @extends Ember.View + @uses Ember.ViewTargetActionSupport @public */ var Component = _emberViewsViewsView.default.extend(_emberRuntimeMixinsTarget_action_support.default, { isComponent: true, /* @@ -42905,11 +43033,11 @@ exports.DeprecatedCollectionView = DeprecatedCollectionView; }); 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'; - _emberHtmlbarsTemplatesContainerView.default.meta.revision = 'Ember@2.4.3'; + _emberHtmlbarsTemplatesContainerView.default.meta.revision = 'Ember@2.4.4'; /** @module ember @submodule ember-views */ @@ -44686,25 +44814,24 @@ ```html <use xlink:href="#triangle"></use> ``` If the return value of an `attributeBindings` monitored property is a boolean - the property will follow HTML's pattern of repeating the attribute's name as - its value: + the property's value will be set as a coerced string: ```javascript MyTextInput = Ember.View.extend({ tagName: 'input', attributeBindings: ['disabled'], - disabled: true + disabled: false }); ``` - Will result in view instances with an HTML representation of: + Will result in a view instance with an HTML representation of: ```html - <input id="ember1" class="ember-view" disabled="disabled" /> + <input id="ember1" class="ember-view" disabled="false" /> ``` `attributeBindings` can refer to computed properties: ```javascript @@ -44719,10 +44846,21 @@ } }) }); ``` + To prevent setting an attribute altogether, use `null` or `undefined` as the + return value of the `attributeBindings` monitored property: + + ```javascript + MyTextInput = Ember.View.extend({ + tagName: 'form', + attributeBindings: ['novalidate'], + novalidate: null + }); + ``` + Updates to the property of an attribute binding will result in automatic update of the HTML attribute in the view's rendered HTML representation. `attributeBindings` is a concatenated property. See [Ember.Object](/api/classes/Ember.Object.html) documentation for more information about concatenated properties. @@ -45047,9 +45185,10 @@ @class View @namespace Ember @extends Ember.CoreView @deprecated See http://emberjs.com/deprecations/v1.x/#toc_ember-view + @uses Ember.ViewSupport @uses Ember.ViewContextSupport @uses Ember.ViewChildViewsSupport @uses Ember.TemplateRenderingSupport @uses Ember.ClassNamesSupport @uses Ember.AttributeBindingsSupport