ember-source 4.3.0-alpha.2 → 4.4.0-alpha.1
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/build-metadata.json +3 -3
- package/dist/dependencies/router_js.js +66 -31
- package/dist/ember-template-compiler.js +1169 -779
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +74 -43
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +3290 -2760
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/container/index.js +15 -11
- package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +3 -3
- package/dist/packages/@ember/-internals/extension-support/lib/data_adapter.js +52 -52
- package/dist/packages/@ember/-internals/glimmer/index.js +139 -103
- package/dist/packages/@ember/-internals/meta/lib/meta.js +8 -9
- package/dist/packages/@ember/-internals/metal/index.js +44 -45
- package/dist/packages/@ember/-internals/routing/lib/ext/controller.js +10 -8
- package/dist/packages/@ember/-internals/routing/lib/location/auto_location.js +3 -1
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +155 -190
- package/dist/packages/@ember/-internals/routing/lib/services/routing.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 +110 -378
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +74 -36
- package/dist/packages/@ember/-internals/routing/lib/utils.js +33 -21
- package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +1 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +1 -0
- package/dist/packages/@ember/-internals/runtime/lib/mixins/comparable.js +4 -4
- package/dist/packages/@ember/-internals/runtime/lib/mixins/container_proxy.js +29 -29
- package/dist/packages/@ember/-internals/runtime/lib/mixins/promise_proxy.js +16 -16
- package/dist/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +48 -48
- package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +8 -8
- package/dist/packages/@ember/-internals/runtime/lib/system/namespace.js +1 -2
- package/dist/packages/@ember/-internals/runtime/lib/type-of.js +1 -1
- package/dist/packages/@ember/-internals/utils/index.js +10 -8
- package/dist/packages/@ember/-internals/views/lib/system/utils.js +2 -0
- package/dist/packages/@ember/array/index.js +1 -1
- package/dist/packages/@ember/controller/index.js +3 -54
- package/dist/packages/@ember/instrumentation/index.js +9 -13
- package/dist/packages/@ember/object/compat.js +16 -7
- package/dist/packages/@ember/routing/router-service.js +1 -0
- package/dist/packages/@ember/service/index.js +6 -73
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +571 -521
- package/package.json +13 -13
|
@@ -685,8 +685,7 @@ function finishLazyChains(meta$$1, key, value) {
|
|
|
685
685
|
}
|
|
686
686
|
|
|
687
687
|
if (isObject(value)) {
|
|
688
|
-
for (let
|
|
689
|
-
let [tag, deps] = lazyTags[i];
|
|
688
|
+
for (let [tag, deps] of lazyTags) {
|
|
690
689
|
updateTag(tag, getChainTagsForKey(value, deps, tagMetaFor(value), peekMeta(value)));
|
|
691
690
|
}
|
|
692
691
|
}
|
|
@@ -696,8 +695,8 @@ function finishLazyChains(meta$$1, key, value) {
|
|
|
696
695
|
function getChainTagsForKeys(obj, keys, tagMeta, meta$$1) {
|
|
697
696
|
let tags = [];
|
|
698
697
|
|
|
699
|
-
for (let
|
|
700
|
-
getChainTags(tags, obj,
|
|
698
|
+
for (let key of keys) {
|
|
699
|
+
getChainTags(tags, obj, key, tagMeta, meta$$1);
|
|
701
700
|
}
|
|
702
701
|
|
|
703
702
|
return combine(tags);
|
|
@@ -1313,8 +1312,8 @@ class ComputedProperty extends ComputedDescriptor {
|
|
|
1313
1312
|
args.push(property);
|
|
1314
1313
|
}
|
|
1315
1314
|
|
|
1316
|
-
for (let
|
|
1317
|
-
expandProperties(
|
|
1315
|
+
for (let arg of passedArgs) {
|
|
1316
|
+
expandProperties(arg, addArg);
|
|
1318
1317
|
}
|
|
1319
1318
|
|
|
1320
1319
|
this._dependentKeys = args;
|
|
@@ -1603,13 +1602,16 @@ function computed(...args) {
|
|
|
1603
1602
|
assert(`@computed can only be used directly as a native decorator. If you're using tracked in classic classes, add parenthesis to call it like a function: computed()`, !(isElementDescriptor(args.slice(0, 3)) && args.length === 5 && args[4] === true));
|
|
1604
1603
|
|
|
1605
1604
|
if (isElementDescriptor(args)) {
|
|
1605
|
+
// SAFETY: We passed in the impl for this class
|
|
1606
1606
|
let decorator = makeComputedDecorator(new ComputedProperty([]), ComputedDecoratorImpl);
|
|
1607
1607
|
return decorator(args[0], args[1], args[2]);
|
|
1608
|
-
}
|
|
1608
|
+
} // SAFETY: We passed in the impl for this class
|
|
1609
|
+
|
|
1609
1610
|
|
|
1610
1611
|
return makeComputedDecorator(new ComputedProperty(args), ComputedDecoratorImpl);
|
|
1611
1612
|
}
|
|
1612
1613
|
function autoComputed(...config) {
|
|
1614
|
+
// SAFETY: We passed in the impl for this class
|
|
1613
1615
|
return makeComputedDecorator(new AutoComputedProperty(config), ComputedDecoratorImpl);
|
|
1614
1616
|
}
|
|
1615
1617
|
/**
|
|
@@ -1816,12 +1818,12 @@ function _getPath(root, path) {
|
|
|
1816
1818
|
let obj = root;
|
|
1817
1819
|
let parts = typeof path === 'string' ? path.split('.') : path;
|
|
1818
1820
|
|
|
1819
|
-
for (let
|
|
1821
|
+
for (let part of parts) {
|
|
1820
1822
|
if (obj === undefined || obj === null || obj.isDestroyed) {
|
|
1821
1823
|
return undefined;
|
|
1822
1824
|
}
|
|
1823
1825
|
|
|
1824
|
-
obj = _getProp(obj,
|
|
1826
|
+
obj = _getProp(obj, part);
|
|
1825
1827
|
}
|
|
1826
1828
|
|
|
1827
1829
|
return obj;
|
|
@@ -1973,7 +1975,8 @@ function trySet(root, path, value) {
|
|
|
1973
1975
|
}
|
|
1974
1976
|
|
|
1975
1977
|
function alias(altKey) {
|
|
1976
|
-
assert('You attempted to use @alias as a decorator directly, but it requires a `altKey` parameter', !isElementDescriptor(Array.prototype.slice.call(arguments)));
|
|
1978
|
+
assert('You attempted to use @alias as a decorator directly, but it requires a `altKey` parameter', !isElementDescriptor(Array.prototype.slice.call(arguments))); // SAFETY: We passed in the impl for this class
|
|
1979
|
+
|
|
1977
1980
|
return makeComputedDecorator(new AliasedProperty(altKey), AliasDecoratorImpl);
|
|
1978
1981
|
} // TODO: This class can be svelted once `meta` has been deprecated
|
|
1979
1982
|
|
|
@@ -2312,11 +2315,10 @@ class Libraries {
|
|
|
2312
2315
|
|
|
2313
2316
|
_getLibraryByName(name) {
|
|
2314
2317
|
let libs = this._registry;
|
|
2315
|
-
let count = libs.length;
|
|
2316
2318
|
|
|
2317
|
-
for (let
|
|
2318
|
-
if (
|
|
2319
|
-
return
|
|
2319
|
+
for (let lib of libs) {
|
|
2320
|
+
if (lib.name === name) {
|
|
2321
|
+
return lib;
|
|
2320
2322
|
}
|
|
2321
2323
|
}
|
|
2322
2324
|
|
|
@@ -2368,8 +2370,7 @@ if (DEBUG) {
|
|
|
2368
2370
|
let maxNameLength = Math.max.apply(null, nameLengths);
|
|
2369
2371
|
debug('-------------------------------');
|
|
2370
2372
|
|
|
2371
|
-
for (let
|
|
2372
|
-
let lib = libs[i];
|
|
2373
|
+
for (let lib of libs) {
|
|
2373
2374
|
let spaces = new Array(maxNameLength - lib.name.length + 1).join(' ');
|
|
2374
2375
|
debug([lib.name, spaces, ' : ', lib.version].join(''));
|
|
2375
2376
|
}
|
|
@@ -2434,10 +2435,8 @@ function setProperties(obj, properties) {
|
|
|
2434
2435
|
|
|
2435
2436
|
changeProperties(() => {
|
|
2436
2437
|
let props = Object.keys(properties);
|
|
2437
|
-
let propertyName;
|
|
2438
2438
|
|
|
2439
|
-
for (let
|
|
2440
|
-
propertyName = props[i];
|
|
2439
|
+
for (let propertyName of props) {
|
|
2441
2440
|
set(obj, propertyName, properties[propertyName]);
|
|
2442
2441
|
}
|
|
2443
2442
|
});
|
|
@@ -2484,9 +2483,8 @@ function findNamespaces() {
|
|
|
2484
2483
|
let lookup = context.lookup;
|
|
2485
2484
|
let keys = Object.keys(lookup);
|
|
2486
2485
|
|
|
2487
|
-
for (let
|
|
2488
|
-
|
|
2489
|
-
|
|
2486
|
+
for (let key of keys) {
|
|
2487
|
+
// Only process entities that start with uppercase A-Z
|
|
2490
2488
|
if (!isUppercase(key.charCodeAt(0))) {
|
|
2491
2489
|
continue;
|
|
2492
2490
|
}
|
|
@@ -2519,8 +2517,8 @@ function processAllNamespaces() {
|
|
|
2519
2517
|
if (unprocessedNamespaces || unprocessedMixins) {
|
|
2520
2518
|
let namespaces = NAMESPACES;
|
|
2521
2519
|
|
|
2522
|
-
for (let
|
|
2523
|
-
processNamespace(
|
|
2520
|
+
for (let namespace of namespaces) {
|
|
2521
|
+
processNamespace(namespace);
|
|
2524
2522
|
}
|
|
2525
2523
|
|
|
2526
2524
|
unprocessedMixins = false;
|
|
@@ -2596,10 +2594,7 @@ const {
|
|
|
2596
2594
|
|
|
2597
2595
|
function extractAccessors(properties) {
|
|
2598
2596
|
if (properties !== undefined) {
|
|
2599
|
-
let
|
|
2600
|
-
|
|
2601
|
-
for (let i = 0; i < keys.length; i++) {
|
|
2602
|
-
let key = keys[i];
|
|
2597
|
+
for (let key of Object.keys(properties)) {
|
|
2603
2598
|
let desc = Object.getOwnPropertyDescriptor(properties, key);
|
|
2604
2599
|
|
|
2605
2600
|
if (desc.get !== undefined || desc.set !== undefined) {
|
|
@@ -2681,7 +2676,8 @@ function giveDecoratorSuper(key, decorator, property, descs) {
|
|
|
2681
2676
|
}]);
|
|
2682
2677
|
newProperty._readOnly = property._readOnly;
|
|
2683
2678
|
newProperty._meta = property._meta;
|
|
2684
|
-
newProperty.enumerable = property.enumerable;
|
|
2679
|
+
newProperty.enumerable = property.enumerable; // SAFETY: We passed in the impl for this class
|
|
2680
|
+
|
|
2685
2681
|
return makeComputedDecorator(newProperty, ComputedProperty);
|
|
2686
2682
|
}
|
|
2687
2683
|
|
|
@@ -2732,8 +2728,7 @@ function applyMergedProperties(key, value, values) {
|
|
|
2732
2728
|
let hasFunction = false;
|
|
2733
2729
|
let props = Object.keys(value);
|
|
2734
2730
|
|
|
2735
|
-
for (let
|
|
2736
|
-
let prop = props[i];
|
|
2731
|
+
for (let prop of props) {
|
|
2737
2732
|
let propValue = value[prop];
|
|
2738
2733
|
|
|
2739
2734
|
if (typeof propValue === 'function') {
|
|
@@ -2796,8 +2791,7 @@ function mergeProps(meta$$1, props, descs, values, base, keys, keysWithSuper) {
|
|
|
2796
2791
|
let mergings = concatenatedMixinProperties('mergedProperties', props, values, base);
|
|
2797
2792
|
let propKeys = Object.keys(props);
|
|
2798
2793
|
|
|
2799
|
-
for (let
|
|
2800
|
-
let key = propKeys[i];
|
|
2794
|
+
for (let key of propKeys) {
|
|
2801
2795
|
let value = props[key];
|
|
2802
2796
|
if (value === undefined) continue;
|
|
2803
2797
|
|
|
@@ -2860,16 +2854,16 @@ function updateObserversAndListeners(obj, key, fn, add) {
|
|
|
2860
2854
|
if (observers !== undefined) {
|
|
2861
2855
|
let updateObserver = add ? addObserver : removeObserver;
|
|
2862
2856
|
|
|
2863
|
-
for (let
|
|
2864
|
-
updateObserver(obj,
|
|
2857
|
+
for (let path of observers.paths) {
|
|
2858
|
+
updateObserver(obj, path, null, key, observers.sync);
|
|
2865
2859
|
}
|
|
2866
2860
|
}
|
|
2867
2861
|
|
|
2868
2862
|
if (listeners !== undefined) {
|
|
2869
2863
|
let updateListener = add ? addListener : removeListener;
|
|
2870
2864
|
|
|
2871
|
-
for (let
|
|
2872
|
-
updateListener(obj,
|
|
2865
|
+
for (let listener of listeners) {
|
|
2866
|
+
updateListener(obj, listener, null, key);
|
|
2873
2867
|
}
|
|
2874
2868
|
}
|
|
2875
2869
|
}
|
|
@@ -2890,8 +2884,7 @@ function applyMixin(obj, mixins, _hideKeys = false) {
|
|
|
2890
2884
|
|
|
2891
2885
|
mergeMixins(mixins, meta$$1, descs, values, obj, keys, keysWithSuper);
|
|
2892
2886
|
|
|
2893
|
-
for (let
|
|
2894
|
-
let key = keys[i];
|
|
2887
|
+
for (let key of keys) {
|
|
2895
2888
|
let value = values[key];
|
|
2896
2889
|
let desc = descs[key];
|
|
2897
2890
|
|
|
@@ -3288,8 +3281,8 @@ function observer(...args) {
|
|
|
3288
3281
|
assert('observer called without sync', typeof sync === 'boolean');
|
|
3289
3282
|
let paths = [];
|
|
3290
3283
|
|
|
3291
|
-
for (let
|
|
3292
|
-
expandProperties(
|
|
3284
|
+
for (let dependentKey of dependentKeys) {
|
|
3285
|
+
expandProperties(dependentKey, path => paths.push(path));
|
|
3293
3286
|
}
|
|
3294
3287
|
|
|
3295
3288
|
setObservers(func, {
|
|
@@ -3307,8 +3300,14 @@ if (DEBUG) {
|
|
|
3307
3300
|
|
|
3308
3301
|
function inject(type, ...args) {
|
|
3309
3302
|
assert('a string type must be provided to inject', typeof type === 'string');
|
|
3310
|
-
let
|
|
3311
|
-
let name
|
|
3303
|
+
let elementDescriptor;
|
|
3304
|
+
let name;
|
|
3305
|
+
|
|
3306
|
+
if (isElementDescriptor(args)) {
|
|
3307
|
+
elementDescriptor = args;
|
|
3308
|
+
} else if (typeof args[0] === 'string') {
|
|
3309
|
+
name = args[0];
|
|
3310
|
+
}
|
|
3312
3311
|
|
|
3313
3312
|
let getInjection = function (propertyName) {
|
|
3314
3313
|
let owner = getOwner(this) || this.container; // fallback to `container` for backwards compat
|
|
@@ -3333,8 +3332,8 @@ function inject(type, ...args) {
|
|
|
3333
3332
|
|
|
3334
3333
|
});
|
|
3335
3334
|
|
|
3336
|
-
if (
|
|
3337
|
-
return decorator(
|
|
3335
|
+
if (elementDescriptor) {
|
|
3336
|
+
return decorator(elementDescriptor[0], elementDescriptor[1], elementDescriptor[2]);
|
|
3338
3337
|
} else {
|
|
3339
3338
|
return decorator;
|
|
3340
3339
|
}
|
|
@@ -131,16 +131,16 @@ ControllerMixin.reopen({
|
|
|
131
131
|
aController.transitionToRoute({ queryParams: { sort: 'date' } });
|
|
132
132
|
```
|
|
133
133
|
See also [replaceRoute](/ember/release/classes/Ember.ControllerMixin/methods/replaceRoute?anchor=replaceRoute).
|
|
134
|
-
@
|
|
134
|
+
@for Ember.ControllerMixin
|
|
135
|
+
@method transitionToRoute
|
|
136
|
+
@deprecated Use transitionTo from the Router service instead.
|
|
137
|
+
@param {String} [name] the name of the route or a URL
|
|
135
138
|
@param {...Object} models the model(s) or identifier(s) to be used
|
|
136
139
|
while transitioning to the route.
|
|
137
140
|
@param {Object} [options] optional hash with a queryParams property
|
|
138
141
|
containing a mapping of query parameters
|
|
139
|
-
@for Ember.ControllerMixin
|
|
140
|
-
@method transitionToRoute
|
|
141
142
|
@return {Transition} the transition object associated with this
|
|
142
143
|
attempted transition
|
|
143
|
-
@deprecated Use transitionTo from the Router service instead.
|
|
144
144
|
@public
|
|
145
145
|
*/
|
|
146
146
|
transitionToRoute(...args) {
|
|
@@ -195,14 +195,16 @@ ControllerMixin.reopen({
|
|
|
195
195
|
aController.replaceRoute('/');
|
|
196
196
|
aController.replaceRoute('/blog/post/1/comment/13');
|
|
197
197
|
```
|
|
198
|
-
@
|
|
198
|
+
@for Ember.ControllerMixin
|
|
199
|
+
@method replaceRoute
|
|
200
|
+
@deprecated Use replaceWith from the Router service instead.
|
|
201
|
+
@param {String} [name] the name of the route or a URL
|
|
199
202
|
@param {...Object} models the model(s) or identifier(s) to be used
|
|
200
203
|
while transitioning to the route.
|
|
201
|
-
@
|
|
202
|
-
|
|
204
|
+
@param {Object} [options] optional hash with a queryParams property
|
|
205
|
+
containing a mapping of query parameters
|
|
203
206
|
@return {Transition} the transition object associated with this
|
|
204
207
|
attempted transition
|
|
205
|
-
@deprecated Use replaceWith from the Router service instead.
|
|
206
208
|
@public
|
|
207
209
|
*/
|
|
208
210
|
replaceRoute(...args) {
|
|
@@ -82,7 +82,9 @@ export default class AutoLocation extends EmberObject {
|
|
|
82
82
|
implementation = 'none';
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
let
|
|
85
|
+
let owner = getOwner(this);
|
|
86
|
+
assert('AutoLocation is unexpectedly missing an owner', owner);
|
|
87
|
+
let concrete = owner.lookup(`location:${implementation}`);
|
|
86
88
|
assert(`Could not find location '${implementation}'.`, concrete !== undefined);
|
|
87
89
|
set(concrete, 'rootURL', rootURL);
|
|
88
90
|
set(this, 'concreteImplementation', concrete);
|