ember-source 4.3.0-alpha.3 → 4.4.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -2
- package/blueprints/acceptance-test/mocha-files/tests/acceptance/__name__-test.js +4 -4
- package/blueprints/acceptance-test/mocha-rfc-232-files/tests/acceptance/__name__-test.js +2 -2
- package/blueprints/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +2 -2
- package/blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +2 -2
- package/blueprints/component/index.js +2 -2
- package/blueprints/component-class/index.js +2 -2
- package/blueprints/component-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +4 -4
- package/blueprints/component-test/mocha-files/__root__/__testType__/__path__/__test__.js +7 -5
- package/blueprints/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +4 -4
- package/blueprints/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +4 -4
- package/blueprints/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +4 -4
- package/blueprints/controller/files/__root__/__path__/__name__.js +1 -2
- package/blueprints/controller-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/controller-test/mocha-files/__root__/__testType__/__path__/__test__.js +5 -3
- package/blueprints/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/controller-test/qunit-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/helper/files/__root__/__collection__/__name__.js +1 -1
- package/blueprints/helper/mu-files/__root__/__collection__/__name__.js +1 -1
- package/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +3 -3
- package/blueprints/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +6 -4
- package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -2
- package/blueprints/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +2 -2
- package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -2
- package/blueprints/initializer/files/__root__/initializers/__name__.js +2 -3
- package/blueprints/initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +6 -7
- package/blueprints/initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +5 -5
- package/blueprints/initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +3 -4
- package/blueprints/instance-initializer/files/__root__/instance-initializers/__name__.js +2 -3
- package/blueprints/instance-initializer-test/mocha-files/__root__/__testType__/__path__/__name__-test.js +5 -5
- package/blueprints/instance-initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +5 -5
- package/blueprints/instance-initializer-test/qunit-files/__root__/__testType__/__path__/__name__-test.js +2 -2
- package/blueprints/mixin/files/__root__/mixins/__name__.js +1 -2
- package/blueprints/mixin-test/mocha-files/__root__/__testType__/__name__-test.js +2 -2
- package/blueprints/mixin-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +2 -2
- package/blueprints/mixin-test/qunit-files/__root__/__testType__/__name__-test.js +1 -1
- package/blueprints/mixin-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +1 -1
- package/blueprints/route/files/__root__/__path__/__name__.js +2 -2
- package/blueprints/route-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/route-test/mocha-files/__root__/__testType__/__path__/__test__.js +5 -3
- package/blueprints/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/route-test/qunit-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/service/files/__root__/__path__/__name__.js +1 -2
- package/blueprints/service-test/mocha-0.12-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/service-test/mocha-files/__root__/__testType__/__path__/__test__.js +5 -3
- package/blueprints/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/service-test/qunit-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/util-test/mocha-files/__root__/__testType__/__name__-test.js +2 -2
- package/blueprints/util-test/mocha-rfc-232-files/__root__/__testType__/__name__-test.js +2 -2
- package/blueprints/util-test/qunit-files/__root__/__testType__/__name__-test.js +1 -1
- package/blueprints/util-test/qunit-rfc-232-files/__root__/__testType__/__name__-test.js +2 -3
- package/build-metadata.json +3 -3
- package/dist/dependencies/router_js.js +67 -32
- package/dist/ember-template-compiler.js +1168 -908
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +76 -43
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +3206 -2734
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/container/index.js +18 -13
- package/dist/packages/@ember/-internals/glimmer/index.js +128 -67
- package/dist/packages/@ember/-internals/meta/lib/meta.js +8 -9
- package/dist/packages/@ember/-internals/metal/index.js +58 -61
- package/dist/packages/@ember/-internals/routing/lib/ext/controller.js +10 -8
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +155 -191
- package/dist/packages/@ember/-internals/routing/lib/services/routing.js +2 -0
- package/dist/packages/@ember/-internals/routing/lib/system/generate_controller.js +3 -1
- package/dist/packages/@ember/-internals/routing/lib/system/route-info.js +2 -2
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +108 -380
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +65 -46
- package/dist/packages/@ember/-internals/routing/lib/utils.js +33 -21
- package/dist/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +32 -32
- package/dist/packages/@ember/-internals/runtime/lib/mixins/container_proxy.js +29 -29
- package/dist/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +51 -50
- package/dist/packages/@ember/-internals/utils/index.js +3 -1
- package/dist/packages/@ember/-internals/views/lib/system/utils.js +1 -0
- package/dist/packages/@ember/application/instance.js +3 -3
- package/dist/packages/@ember/canary-features/index.js +0 -10
- package/dist/packages/@ember/controller/index.js +3 -54
- package/dist/packages/@ember/debug/lib/capture-render-tree.js +2 -0
- package/dist/packages/@ember/instrumentation/index.js +9 -13
- package/dist/packages/@ember/routing/router-service.js +1 -0
- package/dist/packages/@ember/service/index.js +6 -73
- package/dist/packages/ember/index.js +3 -14
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +556 -504
- package/package.json +13 -13
package/dist/header/license.js
CHANGED
|
@@ -18,6 +18,7 @@ if (DEBUG) {
|
|
|
18
18
|
containers = new WeakSet();
|
|
19
19
|
return {
|
|
20
20
|
hasContainers() {
|
|
21
|
+
// @ts-expect-error We just checked if it is definied
|
|
21
22
|
gc();
|
|
22
23
|
return GetWeakSetValues(containers).length > 0;
|
|
23
24
|
},
|
|
@@ -123,7 +124,7 @@ class Container {
|
|
|
123
124
|
|
|
124
125
|
lookup(fullName, options) {
|
|
125
126
|
if (this.isDestroyed) {
|
|
126
|
-
throw new Error(`
|
|
127
|
+
throw new Error(`Cannot call \`.lookup\` after the owner has been destroyed`);
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
assert('fullName must be a proper full name', this.registry.isValidFullName(fullName));
|
|
@@ -186,19 +187,19 @@ class Container {
|
|
|
186
187
|
@public
|
|
187
188
|
@method factoryFor
|
|
188
189
|
@param {String} fullName
|
|
189
|
-
@param {Object} [options]
|
|
190
|
-
@param {String} [options.source] The fullname of the request source (used for local lookup)
|
|
191
190
|
@return {any}
|
|
192
191
|
*/
|
|
193
192
|
|
|
194
193
|
|
|
195
194
|
factoryFor(fullName) {
|
|
196
195
|
if (this.isDestroyed) {
|
|
197
|
-
throw new Error(`
|
|
196
|
+
throw new Error(`Cannot call \`.factoryFor\` after the owner has been destroyed`);
|
|
198
197
|
}
|
|
199
198
|
|
|
200
199
|
let normalizedName = this.registry.normalize(fullName);
|
|
201
|
-
assert('fullName must be a proper full name', this.registry.isValidFullName(normalizedName));
|
|
200
|
+
assert('fullName must be a proper full name', this.registry.isValidFullName(normalizedName)); // TODO: This needs to return a Factory to be compatible with Owner.
|
|
201
|
+
// We should correctly the types so that this cast is not necessary.
|
|
202
|
+
|
|
202
203
|
return factoryFor(this, normalizedName, fullName);
|
|
203
204
|
}
|
|
204
205
|
|
|
@@ -351,9 +352,9 @@ function destroyDestroyables(container) {
|
|
|
351
352
|
let cache = container.cache;
|
|
352
353
|
let keys = Object.keys(cache);
|
|
353
354
|
|
|
354
|
-
for (let
|
|
355
|
-
let key = keys[i];
|
|
355
|
+
for (let key of keys) {
|
|
356
356
|
let value = cache[key];
|
|
357
|
+
assert('has cached value', value);
|
|
357
358
|
|
|
358
359
|
if (value.destroy) {
|
|
359
360
|
value.destroy();
|
|
@@ -416,7 +417,7 @@ class FactoryManager {
|
|
|
416
417
|
} = this;
|
|
417
418
|
|
|
418
419
|
if (container.isDestroyed) {
|
|
419
|
-
throw new Error(`
|
|
420
|
+
throw new Error(`Cannot create new instances after the owner has been destroyed (you attempted to create ${this.fullName})`);
|
|
420
421
|
}
|
|
421
422
|
|
|
422
423
|
let props = {};
|
|
@@ -780,6 +781,8 @@ class Registry {
|
|
|
780
781
|
}
|
|
781
782
|
|
|
782
783
|
let type = fullName.split(':')[0];
|
|
784
|
+
assert('has type', type); // split always will have at least one value
|
|
785
|
+
|
|
783
786
|
options = this._typeOptions[type];
|
|
784
787
|
|
|
785
788
|
if (options && options[optionName] !== undefined) {
|
|
@@ -826,8 +829,7 @@ class Registry {
|
|
|
826
829
|
let localKnown = dictionary(null);
|
|
827
830
|
let registeredNames = Object.keys(this.registrations);
|
|
828
831
|
|
|
829
|
-
for (let
|
|
830
|
-
let fullName = registeredNames[index];
|
|
832
|
+
for (let fullName of registeredNames) {
|
|
831
833
|
let itemType = fullName.split(':')[0];
|
|
832
834
|
|
|
833
835
|
if (itemType === type) {
|
|
@@ -862,9 +864,11 @@ if (DEBUG) {
|
|
|
862
864
|
|
|
863
865
|
for (let key in hash) {
|
|
864
866
|
if (Object.prototype.hasOwnProperty.call(hash, key)) {
|
|
867
|
+
let value = hash[key];
|
|
868
|
+
assert('has value', value);
|
|
865
869
|
let {
|
|
866
870
|
specifier
|
|
867
|
-
} =
|
|
871
|
+
} = value;
|
|
868
872
|
assert(`Expected a proper full name, given '${specifier}'`, this.isValidFullName(specifier));
|
|
869
873
|
injections.push({
|
|
870
874
|
property: key,
|
|
@@ -881,10 +885,10 @@ if (DEBUG) {
|
|
|
881
885
|
return;
|
|
882
886
|
}
|
|
883
887
|
|
|
884
|
-
for (let
|
|
888
|
+
for (let injection of injections) {
|
|
885
889
|
let {
|
|
886
890
|
specifier
|
|
887
|
-
} =
|
|
891
|
+
} = injection;
|
|
888
892
|
assert(`Attempting to inject an unknown injection: '${specifier}'`, this.has(specifier));
|
|
889
893
|
}
|
|
890
894
|
};
|
|
@@ -928,6 +932,7 @@ function has(registry, fullName) {
|
|
|
928
932
|
const privateNames = dictionary(null);
|
|
929
933
|
const privateSuffix = `${Math.random()}${Date.now()}`.replace('.', '');
|
|
930
934
|
function privatize([fullName]) {
|
|
935
|
+
assert('has a single string argument', arguments.length === 1 && fullName);
|
|
931
936
|
let name = privateNames[fullName];
|
|
932
937
|
|
|
933
938
|
if (name) {
|
|
@@ -9,8 +9,9 @@ import { untrack, consumeTag, createCache, getValue, tagFor, beginUntrackFrame,
|
|
|
9
9
|
import { tracked, get, PROPERTY_DID_CHANGE, tagForObject, objectAt, tagForProperty, set, _getProp, _setProp } from '@ember/-internals/metal';
|
|
10
10
|
import { action } from '@ember/object';
|
|
11
11
|
import { hasDOM } from '@ember/-internals/browser-environment';
|
|
12
|
-
import { isSimpleClick, clearElementView, clearViewElement, getViewElement, MUTABLE_CELL, addChildView, setElementView, setViewElement, ActionSupport, ChildViewsSupport, ClassNamesSupport, CoreView, ViewMixin, ViewStateSupport, constructStyleDeprecationMessage, ActionManager, getViewId } from '@ember/-internals/views';
|
|
12
|
+
import { isSimpleClick, clearElementView, clearViewElement, getViewElement, MUTABLE_CELL, addChildView, setElementView, setViewElement, ActionSupport, ChildViewsSupport, ClassNamesSupport, CoreView, EventDispatcher, ViewMixin, ViewStateSupport, constructStyleDeprecationMessage, ActionManager, getViewId } from '@ember/-internals/views';
|
|
13
13
|
import { getEngineParent } from '@ember/engine';
|
|
14
|
+
import EngineInstance from '@ember/engine/instance';
|
|
14
15
|
import { flaggedInstrument, _instrumentStart } from '@ember/instrumentation';
|
|
15
16
|
import { service } from '@ember/service';
|
|
16
17
|
import { DEBUG } from '@glimmer/env';
|
|
@@ -1099,11 +1100,13 @@ class LinkTo extends InternalComponent {
|
|
|
1099
1100
|
}
|
|
1100
1101
|
|
|
1101
1102
|
get isEngine() {
|
|
1102
|
-
|
|
1103
|
+
let owner = this.owner;
|
|
1104
|
+
return owner instanceof EngineInstance && getEngineParent(owner) !== undefined;
|
|
1103
1105
|
}
|
|
1104
1106
|
|
|
1105
1107
|
get engineMountPoint() {
|
|
1106
|
-
|
|
1108
|
+
let owner = this.owner;
|
|
1109
|
+
return owner instanceof EngineInstance ? owner.mountPoint : undefined;
|
|
1107
1110
|
}
|
|
1108
1111
|
|
|
1109
1112
|
classFor(state) {
|
|
@@ -1505,7 +1508,11 @@ function installAttributeBinding(component, rootRef, parsed, operations) {
|
|
|
1505
1508
|
operations.setAttribute(attribute, reference, false, null);
|
|
1506
1509
|
}
|
|
1507
1510
|
function createClassNameBindingRef(rootRef, microsyntax, operations) {
|
|
1508
|
-
let
|
|
1511
|
+
let parts = microsyntax.split(':');
|
|
1512
|
+
let [prop, truthy, falsy] = parts; // NOTE: This could be an empty string
|
|
1513
|
+
|
|
1514
|
+
assert('has prop', prop !== undefined); // Will always have at least one part
|
|
1515
|
+
|
|
1509
1516
|
let isStatic = prop === '';
|
|
1510
1517
|
|
|
1511
1518
|
if (isStatic) {
|
|
@@ -1889,9 +1896,10 @@ var action$1 = internalHelper(args => {
|
|
|
1889
1896
|
// Anything else is an action argument.
|
|
1890
1897
|
|
|
1891
1898
|
let [context, action$$1, ...restArgs] = positional;
|
|
1899
|
+
assert('hash position arguments', context && action$$1);
|
|
1892
1900
|
let debugKey = action$$1.debugLabel;
|
|
1893
|
-
let target = 'target' in named ? named.target : context;
|
|
1894
|
-
let processArgs = makeArgsProcessor('value' in named && named.value, restArgs);
|
|
1901
|
+
let target = 'target' in named && named.target ? named.target : context;
|
|
1902
|
+
let processArgs = makeArgsProcessor('value' in named && named.value || false, restArgs);
|
|
1895
1903
|
let fn$$1;
|
|
1896
1904
|
|
|
1897
1905
|
if (isInvokableRef(action$$1)) {
|
|
@@ -2001,6 +2009,7 @@ function processComponentArgs(namedArgs) {
|
|
|
2001
2009
|
|
|
2002
2010
|
for (let name in namedArgs) {
|
|
2003
2011
|
let ref = namedArgs[name];
|
|
2012
|
+
assert('expected ref', ref);
|
|
2004
2013
|
let value = valueForRef(ref);
|
|
2005
2014
|
let isAction = typeof value === 'function' && ACTIONS.has(value);
|
|
2006
2015
|
|
|
@@ -2064,6 +2073,7 @@ function applyAttributeBindings(attributeBindings, component, rootRef, operation
|
|
|
2064
2073
|
|
|
2065
2074
|
while (i !== -1) {
|
|
2066
2075
|
let binding = attributeBindings[i];
|
|
2076
|
+
assert('has binding', binding);
|
|
2067
2077
|
let parsed = parseAttributeBinding(binding);
|
|
2068
2078
|
let attribute = parsed[1];
|
|
2069
2079
|
|
|
@@ -2143,8 +2153,9 @@ class CurlyComponentManager {
|
|
|
2143
2153
|
{
|
|
2144
2154
|
__ARGS__
|
|
2145
2155
|
} = _b,
|
|
2146
|
-
rest = __rest(_b, ["__ARGS__"]);
|
|
2156
|
+
rest = __rest(_b, ["__ARGS__"]);
|
|
2147
2157
|
|
|
2158
|
+
assert('[BUG] unexpectedly missing __ARGS__ after check', __ARGS__); // does this need to be untracked?
|
|
2148
2159
|
|
|
2149
2160
|
let __args__ = valueForRef(__ARGS__);
|
|
2150
2161
|
|
|
@@ -2178,14 +2189,8 @@ class CurlyComponentManager {
|
|
|
2178
2189
|
Object.assign(named, args.named.capture());
|
|
2179
2190
|
|
|
2180
2191
|
for (let i = 0; i < count; i++) {
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
// TS7022: 'name' implicitly has type 'any' because it does not have a type annotation and is
|
|
2184
|
-
// referenced directly or indirectly in its own initializer.
|
|
2185
|
-
//
|
|
2186
|
-
// This is almost certainly a TypeScript bug, feel free to try and remove the annotation after
|
|
2187
|
-
// upgrading if it is not needed anymore.
|
|
2188
|
-
const name = positionalParams[i];
|
|
2192
|
+
let name = positionalParams[i];
|
|
2193
|
+
assert('Expected at least one positional param', name);
|
|
2189
2194
|
assert(`You cannot specify both a positional param (at position ${i}) and the hash argument \`${name}\`.`, !args.named.has(name));
|
|
2190
2195
|
named[name] = args.positional.at(i);
|
|
2191
2196
|
}
|
|
@@ -2445,9 +2450,7 @@ function processComponentInitializationAssertions(component, props) {
|
|
|
2445
2450
|
classNameBindings
|
|
2446
2451
|
} = component;
|
|
2447
2452
|
|
|
2448
|
-
for (let
|
|
2449
|
-
let binding = classNameBindings[i];
|
|
2450
|
-
|
|
2453
|
+
for (let binding of classNameBindings) {
|
|
2451
2454
|
if (binding.split(' ').length > 1) {
|
|
2452
2455
|
return false;
|
|
2453
2456
|
}
|
|
@@ -3165,6 +3168,7 @@ const Component = CoreView.extend(ChildViewsSupport, ViewStateSupport, ClassName
|
|
|
3165
3168
|
|
|
3166
3169
|
if (owner.lookup('-environment:main').isInteractive) {
|
|
3167
3170
|
this.__dispatcher = owner.lookup('event_dispatcher:main');
|
|
3171
|
+
assert('Expected dispatcher to be an EventDispatcher', this.__dispatcher instanceof EventDispatcher);
|
|
3168
3172
|
} else {
|
|
3169
3173
|
// In FastBoot we have no EventDispatcher. Set to null to not try again to look it up.
|
|
3170
3174
|
this.__dispatcher = null;
|
|
@@ -3406,6 +3410,59 @@ const Component = CoreView.extend(ChildViewsSupport, ViewStateSupport, ClassName
|
|
|
3406
3410
|
@since 1.13.0
|
|
3407
3411
|
*/
|
|
3408
3412
|
didUpdate() {}
|
|
3413
|
+
/**
|
|
3414
|
+
Called when the component has updated and rerendered itself.
|
|
3415
|
+
Called only during a rerender, not during an initial render.
|
|
3416
|
+
@event didUpdate
|
|
3417
|
+
@public
|
|
3418
|
+
@since 1.13.0
|
|
3419
|
+
*/
|
|
3420
|
+
|
|
3421
|
+
/**
|
|
3422
|
+
Layout can be used to wrap content in a component.
|
|
3423
|
+
@property layout
|
|
3424
|
+
@type Function
|
|
3425
|
+
@public
|
|
3426
|
+
*/
|
|
3427
|
+
|
|
3428
|
+
/**
|
|
3429
|
+
The name of the layout to lookup if no layout is provided.
|
|
3430
|
+
By default `Component` will lookup a template with this name in
|
|
3431
|
+
`Ember.TEMPLATES` (a shared global object).
|
|
3432
|
+
@property layoutName
|
|
3433
|
+
@type String
|
|
3434
|
+
@default null
|
|
3435
|
+
@private
|
|
3436
|
+
*/
|
|
3437
|
+
|
|
3438
|
+
/**
|
|
3439
|
+
The HTML `id` of the component's element in the DOM. You can provide this
|
|
3440
|
+
value yourself but it must be unique (just as in HTML):
|
|
3441
|
+
```handlebars
|
|
3442
|
+
{{my-component elementId="a-really-cool-id"}}
|
|
3443
|
+
```
|
|
3444
|
+
```handlebars
|
|
3445
|
+
<MyComponent @elementId="a-really-cool-id" />
|
|
3446
|
+
```
|
|
3447
|
+
If not manually set a default value will be provided by the framework.
|
|
3448
|
+
Once rendered an element's `elementId` is considered immutable and you
|
|
3449
|
+
should never change it. If you need to compute a dynamic value for the
|
|
3450
|
+
`elementId`, you should do this when the component or element is being
|
|
3451
|
+
instantiated:
|
|
3452
|
+
```javascript
|
|
3453
|
+
export default Component.extend({
|
|
3454
|
+
init() {
|
|
3455
|
+
this._super(...arguments);
|
|
3456
|
+
var index = this.get('index');
|
|
3457
|
+
this.set('elementId', `component-id${index}`);
|
|
3458
|
+
}
|
|
3459
|
+
});
|
|
3460
|
+
```
|
|
3461
|
+
@property elementId
|
|
3462
|
+
@type String
|
|
3463
|
+
@public
|
|
3464
|
+
*/
|
|
3465
|
+
|
|
3409
3466
|
|
|
3410
3467
|
});
|
|
3411
3468
|
|
|
@@ -3734,11 +3791,9 @@ class OutletComponentManager {
|
|
|
3734
3791
|
let currentOwner = valueForRef(currentStateRef).render.owner;
|
|
3735
3792
|
|
|
3736
3793
|
if (parentOwner && parentOwner !== currentOwner) {
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
let mountPoint = engine.mountPoint;
|
|
3741
|
-
state.engine = engine;
|
|
3794
|
+
assert('Expected currentOwner to be an EngineInstance', currentOwner instanceof EngineInstance);
|
|
3795
|
+
let mountPoint = currentOwner.mountPoint;
|
|
3796
|
+
state.engine = currentOwner;
|
|
3742
3797
|
state.engineBucket = {
|
|
3743
3798
|
mountPoint
|
|
3744
3799
|
};
|
|
@@ -4095,7 +4150,8 @@ class EachInWrapper {
|
|
|
4095
4150
|
var eachIn = internalHelper(({
|
|
4096
4151
|
positional
|
|
4097
4152
|
}) => {
|
|
4098
|
-
|
|
4153
|
+
const inner = positional[0];
|
|
4154
|
+
assert('expected at least one positional arg', inner);
|
|
4099
4155
|
return createComputeRef(() => {
|
|
4100
4156
|
let iterable = valueForRef(inner);
|
|
4101
4157
|
consumeTag(tagForObject(iterable));
|
|
@@ -4234,18 +4290,14 @@ class ObjectIterator extends BoundedIterator {
|
|
|
4234
4290
|
|
|
4235
4291
|
static fromIndexable(obj) {
|
|
4236
4292
|
let keys = Object.keys(obj);
|
|
4237
|
-
let {
|
|
4238
|
-
length
|
|
4239
|
-
} = keys;
|
|
4240
4293
|
|
|
4241
|
-
if (length === 0) {
|
|
4294
|
+
if (keys.length === 0) {
|
|
4242
4295
|
return null;
|
|
4243
4296
|
} else {
|
|
4244
4297
|
let values = [];
|
|
4245
4298
|
|
|
4246
|
-
for (let
|
|
4299
|
+
for (let key of keys) {
|
|
4247
4300
|
let value;
|
|
4248
|
-
let key = keys[i];
|
|
4249
4301
|
value = obj[key]; // Add the tag of the returned value if it is an array, since arrays
|
|
4250
4302
|
// should always cause updates if they are consumed and then changed
|
|
4251
4303
|
|
|
@@ -4505,14 +4557,14 @@ var disallowDynamicResolution = internalHelper(({
|
|
|
4505
4557
|
positional,
|
|
4506
4558
|
named
|
|
4507
4559
|
}) => {
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
assert(`[BUG] expecting \`type\` named argument`, 'type' in named);
|
|
4511
|
-
assert(`[BUG] expecting \`loc\` named argument`, 'loc' in named);
|
|
4512
|
-
assert(`[BUG] expecting \`original\` named argument`, 'original' in named);
|
|
4560
|
+
const nameOrValueRef = positional[0];
|
|
4561
|
+
assert(`[BUG] wrong number of positional arguments, expecting 1, got ${positional.length}`, positional.length === 1 && nameOrValueRef);
|
|
4513
4562
|
let typeRef = named.type;
|
|
4514
4563
|
let locRef = named.loc;
|
|
4515
|
-
let originalRef = named.original;
|
|
4564
|
+
let originalRef = named.original;
|
|
4565
|
+
assert(`[BUG] expecting \`type\` named argument`, typeRef);
|
|
4566
|
+
assert(`[BUG] expecting \`loc\` named argument`, locRef);
|
|
4567
|
+
assert(`[BUG] expecting \`original\` named argument`, originalRef); // Bug: why do these fail?
|
|
4516
4568
|
// assert('[BUG] expecting a string literal for the `type` argument', isConstRef(typeRef));
|
|
4517
4569
|
// assert('[BUG] expecting a string literal for the `loc` argument', isConstRef(locRef));
|
|
4518
4570
|
// assert('[BUG] expecting a string literal for the `original` argument', isConstRef(originalRef));
|
|
@@ -4525,7 +4577,7 @@ var disallowDynamicResolution = internalHelper(({
|
|
|
4525
4577
|
assert('[BUG] expecting a string literal for the `original` argument', typeof original === 'string');
|
|
4526
4578
|
return createComputeRef(() => {
|
|
4527
4579
|
let nameOrValue = valueForRef(nameOrValueRef);
|
|
4528
|
-
assert(`Passing a dynamic string to the \`(${type})\` keyword is disallowed. ` + `(You specified \`(${type} ${original})\` and \`${original}\` evaluated into "${nameOrValue}".) ` + `This ensures we can statically analyze the template and determine which ${type}s are used. ` + `If the ${type} name is always the same, use a string literal instead, i.e. \`(${type} "${nameOrValue}")\`. ` + `Otherwise, import the ${type}s into JavaScript and pass them
|
|
4580
|
+
assert(`Passing a dynamic string to the \`(${type})\` keyword is disallowed. ` + `(You specified \`(${type} ${original})\` and \`${original}\` evaluated into "${nameOrValue}".) ` + `This ensures we can statically analyze the template and determine which ${type}s are used. ` + `If the ${type} name is always the same, use a string literal instead, i.e. \`(${type} "${nameOrValue}")\`. ` + `Otherwise, import the ${type}s into JavaScript and pass them directly. ` + 'See https://github.com/emberjs/rfcs/blob/master/text/0496-handlebars-strict-mode.md#4-no-dynamic-resolution for details. ' + loc, typeof nameOrValue !== 'string');
|
|
4529
4581
|
return nameOrValue;
|
|
4530
4582
|
});
|
|
4531
4583
|
});
|
|
@@ -4534,7 +4586,8 @@ let helper$1;
|
|
|
4534
4586
|
|
|
4535
4587
|
if (DEBUG) {
|
|
4536
4588
|
helper$1 = args => {
|
|
4537
|
-
|
|
4589
|
+
const inner = args.positional[0];
|
|
4590
|
+
assert('expected at least one positional arg', inner);
|
|
4538
4591
|
return createComputeRef(() => {
|
|
4539
4592
|
let value = valueForRef(inner);
|
|
4540
4593
|
assert('You cannot pass a null or undefined destination element to in-element', value !== null && value !== undefined);
|
|
@@ -4542,7 +4595,11 @@ if (DEBUG) {
|
|
|
4542
4595
|
});
|
|
4543
4596
|
};
|
|
4544
4597
|
} else {
|
|
4545
|
-
helper$1 = args =>
|
|
4598
|
+
helper$1 = args => {
|
|
4599
|
+
let arg = args.positional[0];
|
|
4600
|
+
assert('expected at least one positional arg', arg);
|
|
4601
|
+
return arg;
|
|
4602
|
+
};
|
|
4546
4603
|
}
|
|
4547
4604
|
|
|
4548
4605
|
var inElementNullCheckHelper = internalHelper(helper$1);
|
|
@@ -4551,9 +4608,14 @@ var normalizeClassHelper = internalHelper(({
|
|
|
4551
4608
|
positional
|
|
4552
4609
|
}) => {
|
|
4553
4610
|
return createComputeRef(() => {
|
|
4554
|
-
let
|
|
4611
|
+
let classNameArg = positional[0];
|
|
4612
|
+
let valueArg = positional[1];
|
|
4613
|
+
assert('expected at least two positional args', classNameArg && valueArg);
|
|
4614
|
+
let classNameParts = valueForRef(classNameArg).split('.');
|
|
4555
4615
|
let className = classNameParts[classNameParts.length - 1];
|
|
4556
|
-
|
|
4616
|
+
assert('has className', className); // Always at least one split result
|
|
4617
|
+
|
|
4618
|
+
let value = valueForRef(valueArg);
|
|
4557
4619
|
|
|
4558
4620
|
if (value === true) {
|
|
4559
4621
|
return dasherize(className);
|
|
@@ -4574,7 +4636,7 @@ var resolve = internalHelper(({
|
|
|
4574
4636
|
assert('[BUG] missing owner', owner);
|
|
4575
4637
|
assert(`[BUG] wrong number of positional arguments, expecting 1, got ${positional.length}`, positional.length === 1);
|
|
4576
4638
|
let fullNameRef = positional[0];
|
|
4577
|
-
assert('[BUG] expecting a string literal as argument', isConstRef(fullNameRef));
|
|
4639
|
+
assert('[BUG] expecting a string literal as argument', fullNameRef && isConstRef(fullNameRef));
|
|
4578
4640
|
let fullName = valueForRef(fullNameRef);
|
|
4579
4641
|
assert('[BUG] expecting a string literal as argument', typeof fullName === 'string');
|
|
4580
4642
|
assert('[BUG] expecting a valid full name', fullName.split(':').length === 2);
|
|
@@ -4599,7 +4661,8 @@ var resolve = internalHelper(({
|
|
|
4599
4661
|
var trackArray = internalHelper(({
|
|
4600
4662
|
positional
|
|
4601
4663
|
}) => {
|
|
4602
|
-
|
|
4664
|
+
const inner = positional[0];
|
|
4665
|
+
assert('expected at least one positional arg', inner);
|
|
4603
4666
|
return createComputeRef(() => {
|
|
4604
4667
|
let iterable = valueForRef(inner);
|
|
4605
4668
|
|
|
@@ -4691,7 +4754,8 @@ var trackArray = internalHelper(({
|
|
|
4691
4754
|
var mut = internalHelper(({
|
|
4692
4755
|
positional
|
|
4693
4756
|
}) => {
|
|
4694
|
-
let ref = positional[0];
|
|
4757
|
+
let ref = positional[0];
|
|
4758
|
+
assert('expected at least one positional arg', ref); // TODO: Improve this error message. This covers at least two distinct
|
|
4695
4759
|
// cases:
|
|
4696
4760
|
//
|
|
4697
4761
|
// 1. (mut "not a path") – passing a literal, result from a helper
|
|
@@ -4827,7 +4891,9 @@ var mut = internalHelper(({
|
|
|
4827
4891
|
var readonly = internalHelper(({
|
|
4828
4892
|
positional
|
|
4829
4893
|
}) => {
|
|
4830
|
-
|
|
4894
|
+
let firstArg = positional[0];
|
|
4895
|
+
assert('has first arg', firstArg);
|
|
4896
|
+
return createReadOnlyRef(firstArg);
|
|
4831
4897
|
});
|
|
4832
4898
|
|
|
4833
4899
|
/**
|
|
@@ -4866,7 +4932,7 @@ var unbound = internalHelper(({
|
|
|
4866
4932
|
named
|
|
4867
4933
|
}) => {
|
|
4868
4934
|
assert('unbound helper cannot be called with multiple params or hash params', positional.length === 1 && Object.keys(named).length === 0);
|
|
4869
|
-
return createUnboundRef(valueForRef(positional[0]), '(
|
|
4935
|
+
return createUnboundRef(valueForRef(positional[0]), '(result of an `unbound` helper)');
|
|
4870
4936
|
});
|
|
4871
4937
|
|
|
4872
4938
|
const MODIFIERS = ['alt', 'shift', 'meta', 'ctrl'];
|
|
@@ -5085,6 +5151,7 @@ class ActionModifierManager {
|
|
|
5085
5151
|
positional
|
|
5086
5152
|
} = actionState;
|
|
5087
5153
|
let actionNameRef = positional[1];
|
|
5154
|
+
assert('Expected at least one positional arg', actionNameRef);
|
|
5088
5155
|
|
|
5089
5156
|
if (!isInvokableRef(actionNameRef)) {
|
|
5090
5157
|
actionState.actionName = valueForRef(actionNameRef);
|
|
@@ -5100,6 +5167,7 @@ class ActionModifierManager {
|
|
|
5100
5167
|
|
|
5101
5168
|
ensureEventSetup(actionState) {
|
|
5102
5169
|
let dispatcher = actionState.owner.lookup('event_dispatcher:main');
|
|
5170
|
+
assert('Expected dispatcher to be an EventDispatcher', dispatcher instanceof EventDispatcher);
|
|
5103
5171
|
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.setupHandlerForEmberEvent(actionState.eventName);
|
|
5104
5172
|
}
|
|
5105
5173
|
|
|
@@ -5153,6 +5221,7 @@ class MountManager {
|
|
|
5153
5221
|
// mount is a runtime helper, this shouldn't use dynamic layout
|
|
5154
5222
|
// we should resolve the engine app template in the helper
|
|
5155
5223
|
// it also should use the owner that looked up the mount helper.
|
|
5224
|
+
assert('Expected owner to be an EngineInstance', owner instanceof EngineInstance);
|
|
5156
5225
|
let engine = owner.buildChildEngineInstance(name);
|
|
5157
5226
|
engine.boot();
|
|
5158
5227
|
let applicationFactory = engine.factoryFor(`controller:application`);
|
|
@@ -5365,26 +5434,17 @@ const mountHelper = internalHelper((args, owner) => {
|
|
|
5365
5434
|
Note: Your content __will not render__ if there isn't an `{{outlet}}` for it.
|
|
5366
5435
|
|
|
5367
5436
|
@method outlet
|
|
5368
|
-
@param {String} [name]
|
|
5369
5437
|
@for Ember.Templates.helpers
|
|
5370
5438
|
@public
|
|
5371
5439
|
*/
|
|
5372
5440
|
|
|
5373
|
-
const outletHelper = internalHelper((
|
|
5441
|
+
const outletHelper = internalHelper((_args, owner, scope) => {
|
|
5374
5442
|
assert('Expected owner to be present, {{outlet}} requires an owner', owner);
|
|
5375
5443
|
assert('Expected dynamic scope to be present. You may have attempted to use the {{outlet}} keyword dynamically. This keyword cannot be used dynamically.', scope);
|
|
5376
|
-
let nameRef;
|
|
5377
|
-
|
|
5378
|
-
if (args.positional.length === 0) {
|
|
5379
|
-
nameRef = createPrimitiveRef('main');
|
|
5380
|
-
} else {
|
|
5381
|
-
nameRef = args.positional[0];
|
|
5382
|
-
}
|
|
5383
|
-
|
|
5384
5444
|
let outletRef = createComputeRef(() => {
|
|
5385
5445
|
let state = valueForRef(scope.get('outletState'));
|
|
5386
5446
|
let outlets = state !== undefined ? state.outlets : undefined;
|
|
5387
|
-
return outlets !== undefined ? outlets
|
|
5447
|
+
return outlets !== undefined ? outlets.main : undefined;
|
|
5388
5448
|
});
|
|
5389
5449
|
let lastState = null;
|
|
5390
5450
|
let definition = null;
|
|
@@ -5474,9 +5534,9 @@ function instrumentationPayload$1(name) {
|
|
|
5474
5534
|
};
|
|
5475
5535
|
}
|
|
5476
5536
|
|
|
5477
|
-
function componentFor(name, owner
|
|
5537
|
+
function componentFor(name, owner) {
|
|
5478
5538
|
let fullName = `component:${name}`;
|
|
5479
|
-
return owner.factoryFor(fullName
|
|
5539
|
+
return owner.factoryFor(fullName) || null;
|
|
5480
5540
|
}
|
|
5481
5541
|
|
|
5482
5542
|
function layoutFor(name, owner, options) {
|
|
@@ -5485,7 +5545,7 @@ function layoutFor(name, owner, options) {
|
|
|
5485
5545
|
}
|
|
5486
5546
|
|
|
5487
5547
|
function lookupComponentPair(owner, name, options) {
|
|
5488
|
-
let component = componentFor(name, owner
|
|
5548
|
+
let component = componentFor(name, owner);
|
|
5489
5549
|
|
|
5490
5550
|
if (component !== null && component.class !== undefined) {
|
|
5491
5551
|
let layout = getComponentTemplate(component.class);
|
|
@@ -5818,8 +5878,8 @@ function deregister(renderer) {
|
|
|
5818
5878
|
}
|
|
5819
5879
|
|
|
5820
5880
|
function loopBegin() {
|
|
5821
|
-
for (let
|
|
5822
|
-
|
|
5881
|
+
for (let renderer of renderers) {
|
|
5882
|
+
renderer._scheduleRevalidate();
|
|
5823
5883
|
}
|
|
5824
5884
|
}
|
|
5825
5885
|
|
|
@@ -5864,12 +5924,12 @@ function resolveRenderPromise() {
|
|
|
5864
5924
|
let loops = 0;
|
|
5865
5925
|
|
|
5866
5926
|
function loopEnd() {
|
|
5867
|
-
for (let
|
|
5868
|
-
if (!
|
|
5927
|
+
for (let renderer of renderers) {
|
|
5928
|
+
if (!renderer._isValid()) {
|
|
5869
5929
|
if (loops > ENV._RERENDER_LOOP_LIMIT) {
|
|
5870
5930
|
loops = 0; // TODO: do something better
|
|
5871
5931
|
|
|
5872
|
-
|
|
5932
|
+
renderer.destroy();
|
|
5873
5933
|
throw new Error('infinite rendering invalidation detected');
|
|
5874
5934
|
}
|
|
5875
5935
|
|
|
@@ -5992,6 +6052,7 @@ class Renderer {
|
|
|
5992
6052
|
|
|
5993
6053
|
while (i--) {
|
|
5994
6054
|
let root = roots[i];
|
|
6055
|
+
assert('has root', root);
|
|
5995
6056
|
|
|
5996
6057
|
if (root.isFor(view)) {
|
|
5997
6058
|
root.destroy();
|
|
@@ -6063,6 +6124,7 @@ class Renderer {
|
|
|
6063
6124
|
// each root is processed
|
|
6064
6125
|
for (let i = 0; i < roots.length; i++) {
|
|
6065
6126
|
let root = roots[i];
|
|
6127
|
+
assert('has root', root);
|
|
6066
6128
|
|
|
6067
6129
|
if (root.destroyed) {
|
|
6068
6130
|
// add to the list of roots to be removed
|
|
@@ -6125,8 +6187,7 @@ class Renderer {
|
|
|
6125
6187
|
_clearAllRoots() {
|
|
6126
6188
|
let roots = this._roots;
|
|
6127
6189
|
|
|
6128
|
-
for (let
|
|
6129
|
-
let root = roots[i];
|
|
6190
|
+
for (let root of roots) {
|
|
6130
6191
|
root.destroy();
|
|
6131
6192
|
}
|
|
6132
6193
|
|
|
@@ -356,7 +356,8 @@ export class Meta {
|
|
|
356
356
|
sync
|
|
357
357
|
});
|
|
358
358
|
} else {
|
|
359
|
-
let listener = listeners[i];
|
|
359
|
+
let listener = listeners[i];
|
|
360
|
+
assert('has listener', listener); // If the listener is our own listener and we are trying to remove it, we
|
|
360
361
|
// want to splice it out entirely so we don't hold onto a reference.
|
|
361
362
|
|
|
362
363
|
if (kind === 2
|
|
@@ -447,8 +448,7 @@ export class Meta {
|
|
|
447
448
|
this._inheritedEnd = 0;
|
|
448
449
|
}
|
|
449
450
|
|
|
450
|
-
for (let
|
|
451
|
-
let listener = parentListeners[i];
|
|
451
|
+
for (let listener of parentListeners) {
|
|
452
452
|
let index = indexOfListener(listeners, listener.event, listener.target, listener.method);
|
|
453
453
|
|
|
454
454
|
if (index === -1) {
|
|
@@ -481,10 +481,9 @@ export class Meta {
|
|
|
481
481
|
}
|
|
482
482
|
|
|
483
483
|
if (listeners !== undefined) {
|
|
484
|
-
for (let
|
|
485
|
-
|
|
484
|
+
for (let listener of listeners) {
|
|
485
|
+
// REMOVE listeners are placeholders that tell us not to
|
|
486
486
|
// inherit, so they never match. Only ADD and ONCE can match.
|
|
487
|
-
|
|
488
487
|
if (listener.event === eventName && (listener.kind === 0
|
|
489
488
|
/* ADD */
|
|
490
489
|
|| listener.kind === 1
|
|
@@ -517,10 +516,9 @@ export class Meta {
|
|
|
517
516
|
}
|
|
518
517
|
|
|
519
518
|
if (listeners !== undefined) {
|
|
520
|
-
for (let
|
|
521
|
-
|
|
519
|
+
for (let listener of listeners) {
|
|
520
|
+
// REMOVE listeners are placeholders that tell us not to
|
|
522
521
|
// inherit, so they never match. Only ADD and ONCE can match.
|
|
523
|
-
|
|
524
522
|
if ((listener.kind === 0
|
|
525
523
|
/* ADD */
|
|
526
524
|
|| listener.kind === 1
|
|
@@ -642,6 +640,7 @@ export { counters };
|
|
|
642
640
|
function indexOfListener(listeners, event, target, method) {
|
|
643
641
|
for (let i = listeners.length - 1; i >= 0; i--) {
|
|
644
642
|
let listener = listeners[i];
|
|
643
|
+
assert('has listener', listener);
|
|
645
644
|
|
|
646
645
|
if (listener.event === event && listener.target === target && listener.method === method) {
|
|
647
646
|
return i;
|