ember-source 4.5.0-alpha.2 → 4.5.0-alpha.5
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 +4 -0
- package/build-metadata.json +3 -3
- package/dist/dependencies/@glimmer/global-context.js +9 -1
- package/dist/dependencies/@glimmer/manager.js +276 -212
- package/dist/dependencies/@glimmer/runtime.js +2 -2
- package/dist/dependencies/@glimmer/util.js +1 -22
- package/dist/ember-template-compiler.js +35 -28
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +1 -1
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +1202 -1429
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/container/index.js +2 -2
- package/dist/packages/@ember/-internals/glimmer/index.js +24 -19
- package/dist/packages/@ember/-internals/metal/index.js +19 -7
- package/dist/packages/@ember/-internals/routing/lib/location/api.js +3 -3
- package/dist/packages/@ember/-internals/routing/lib/location/auto_location.js +5 -1
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +7 -6
- package/dist/packages/@ember/-internals/routing/lib/services/routing.js +9 -6
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +6 -9
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +4 -2
- package/dist/packages/@ember/-internals/routing/lib/utils.js +15 -25
- package/dist/packages/@ember/-internals/runtime/lib/compare.js +4 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +14 -15
- package/dist/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +32 -44
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +1 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/comparable.js +7 -22
- package/dist/packages/@ember/-internals/runtime/lib/mixins/container_proxy.js +34 -46
- package/dist/packages/@ember/-internals/runtime/lib/mixins/enumerable.js +2 -15
- package/dist/packages/@ember/-internals/runtime/lib/mixins/evented.js +13 -57
- package/dist/packages/@ember/-internals/runtime/lib/mixins/mutable_enumerable.js +2 -16
- package/dist/packages/@ember/-internals/runtime/lib/mixins/observable.js +64 -134
- package/dist/packages/@ember/-internals/runtime/lib/mixins/promise_proxy.js +28 -86
- package/dist/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +59 -61
- package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +17 -24
- package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +59 -85
- package/dist/packages/@ember/-internals/runtime/lib/system/object.js +9 -2
- package/dist/packages/@ember/-internals/runtime/lib/system/object_proxy.js +3 -77
- package/dist/packages/@ember/-internals/utils/index.js +1 -1
- package/dist/packages/@ember/-internals/utils/types.js +1 -0
- package/dist/packages/@ember/-internals/views/lib/compat/attrs.js +1 -2
- package/dist/packages/@ember/-internals/views/lib/component_lookup.js +2 -2
- package/dist/packages/@ember/-internals/views/lib/mixins/action_support.js +3 -9
- package/dist/packages/@ember/-internals/views/lib/mixins/child_views_support.js +4 -6
- package/dist/packages/@ember/-internals/views/lib/mixins/class_names_support.js +13 -18
- package/dist/packages/@ember/-internals/views/lib/mixins/view_state_support.js +3 -2
- package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +57 -58
- package/dist/packages/@ember/-internals/views/lib/system/event_dispatcher.js +142 -120
- package/dist/packages/@ember/-internals/views/lib/system/utils.js +1 -1
- package/dist/packages/@ember/-internals/views/lib/views/states/destroying.js +1 -1
- package/dist/packages/@ember/-internals/views/lib/views/states/has_element.js +2 -2
- package/dist/packages/@ember/-internals/views/lib/views/states/in_dom.js +3 -1
- package/dist/packages/@ember/application/instance.js +1 -0
- package/dist/packages/@ember/application/lib/application.js +8 -1
- package/dist/packages/@ember/canary-features/index.js +4 -2
- package/dist/packages/@ember/engine/instance.js +1 -1
- package/dist/packages/@ember/engine/lib/engine-parent.js +1 -5
- package/dist/packages/@ember/renderer/index.js +28 -0
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +823 -709
- package/package.json +17 -17
package/dist/header/license.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setOwner } from '@ember/-internals/owner';
|
|
2
|
-
import { dictionary,
|
|
2
|
+
import { dictionary, intern } from '@ember/-internals/utils';
|
|
3
3
|
import { assert, deprecate } from '@ember/debug';
|
|
4
4
|
import { DEBUG } from '@glimmer/env';
|
|
5
5
|
|
|
@@ -377,7 +377,7 @@ function resetMember(container, fullName) {
|
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
-
const INIT_FACTORY =
|
|
380
|
+
const INIT_FACTORY = Symbol('INIT_FACTORY');
|
|
381
381
|
function getFactoryFor(obj) {
|
|
382
382
|
return obj[INIT_FACTORY];
|
|
383
383
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { templateFactory, programCompilationContext } from '@glimmer/opcode-compiler';
|
|
2
2
|
export { templateFactory as template, templateCacheCounters } from '@glimmer/opcode-compiler';
|
|
3
3
|
import { setOwner, getOwner, isFactory } from '@ember/-internals/owner';
|
|
4
|
-
import { guidFor,
|
|
4
|
+
import { guidFor, enumerableSymbol, getDebugName, isProxy, isEmberArray, isObject, uuid } from '@ember/-internals/utils';
|
|
5
5
|
import { assert, warn, debugFreeze, inspect, deprecate } from '@ember/debug';
|
|
6
6
|
import { setComponentTemplate, setInternalComponentManager, setInternalHelperManager, getInternalHelperManager, helperCapabilities, setHelperManager, capabilityFlagsFrom, setInternalModifierManager, getComponentTemplate, getInternalComponentManager, componentCapabilities, modifierCapabilities, setComponentManager } from '@glimmer/manager';
|
|
7
7
|
import { createConstRef, isConstRef, valueForRef, isUpdatableRef, updateRef, childRefFor, childRefFromParts, createComputeRef, createPrimitiveRef, createUnboundRef, isInvokableRef, createInvokableRef, createReadOnlyRef, createDebugAliasRef, UNDEFINED_REFERENCE } from '@glimmer/reference';
|
|
@@ -2024,7 +2024,7 @@ function processComponentArgs(namedArgs) {
|
|
|
2024
2024
|
props.attrs = attrs;
|
|
2025
2025
|
return props;
|
|
2026
2026
|
}
|
|
2027
|
-
const REF =
|
|
2027
|
+
const REF = Symbol('REF');
|
|
2028
2028
|
|
|
2029
2029
|
class MutableCell {
|
|
2030
2030
|
constructor(ref, value) {
|
|
@@ -2051,9 +2051,9 @@ var __rest = undefined && undefined.__rest || function (s, e) {
|
|
|
2051
2051
|
};
|
|
2052
2052
|
const ARGS = enumerableSymbol('ARGS');
|
|
2053
2053
|
const HAS_BLOCK = enumerableSymbol('HAS_BLOCK');
|
|
2054
|
-
const DIRTY_TAG =
|
|
2055
|
-
const IS_DISPATCHING_ATTRS =
|
|
2056
|
-
const BOUNDS =
|
|
2054
|
+
const DIRTY_TAG = Symbol('DIRTY_TAG');
|
|
2055
|
+
const IS_DISPATCHING_ATTRS = Symbol('IS_DISPATCHING_ATTRS');
|
|
2056
|
+
const BOUNDS = Symbol('BOUNDS');
|
|
2057
2057
|
const EMBER_VIEW_REF = createPrimitiveRef('ember-view');
|
|
2058
2058
|
|
|
2059
2059
|
function aliasIdToElementId(args, props) {
|
|
@@ -2726,7 +2726,7 @@ setInternalComponentManager(CURLY_COMPONENT_MANAGER, Component);
|
|
|
2726
2726
|
@module @ember/component
|
|
2727
2727
|
*/
|
|
2728
2728
|
var _a;
|
|
2729
|
-
const RECOMPUTE_TAG =
|
|
2729
|
+
const RECOMPUTE_TAG = Symbol('RECOMPUTE_TAG');
|
|
2730
2730
|
const IS_CLASSIC_HELPER = Symbol('IS_CLASSIC_HELPER');
|
|
2731
2731
|
|
|
2732
2732
|
class Helper extends FrameworkObject {
|
|
@@ -3683,11 +3683,11 @@ class MapLikeNativeIterator extends NativeIterator {
|
|
|
3683
3683
|
}
|
|
3684
3684
|
|
|
3685
3685
|
function hasForEach(value) {
|
|
3686
|
-
return typeof value['forEach'] === 'function';
|
|
3686
|
+
return value != null && typeof value['forEach'] === 'function';
|
|
3687
3687
|
}
|
|
3688
3688
|
|
|
3689
3689
|
function isNativeIterable(value) {
|
|
3690
|
-
return typeof value[Symbol.iterator] === 'function';
|
|
3690
|
+
return value != null && typeof value[Symbol.iterator] === 'function';
|
|
3691
3691
|
}
|
|
3692
3692
|
|
|
3693
3693
|
function isIndexable(value) {
|
|
@@ -3711,6 +3711,12 @@ function toBool(predicate) {
|
|
|
3711
3711
|
// Setup global context
|
|
3712
3712
|
|
|
3713
3713
|
setGlobalContext({
|
|
3714
|
+
FEATURES: {
|
|
3715
|
+
DEFAULT_HELPER_MANAGER: Boolean(true
|
|
3716
|
+
/* EMBER_DEFAULT_HELPER_MANAGER */
|
|
3717
|
+
)
|
|
3718
|
+
},
|
|
3719
|
+
|
|
3714
3720
|
scheduleRevalidate() {
|
|
3715
3721
|
_backburner.ensureInstance();
|
|
3716
3722
|
},
|
|
@@ -4863,9 +4869,16 @@ const BUILTIN_KEYWORD_HELPERS = {
|
|
|
4863
4869
|
'-outlet': outletHelper,
|
|
4864
4870
|
'-in-el-null': inElementNullCheckHelper
|
|
4865
4871
|
};
|
|
4872
|
+
const BUILTIN_HELPERS = Object.assign(Object.assign({}, BUILTIN_KEYWORD_HELPERS), {
|
|
4873
|
+
array,
|
|
4874
|
+
concat,
|
|
4875
|
+
fn,
|
|
4876
|
+
get: get$1,
|
|
4877
|
+
hash
|
|
4878
|
+
});
|
|
4866
4879
|
|
|
4867
4880
|
if (DEBUG) {
|
|
4868
|
-
|
|
4881
|
+
BUILTIN_HELPERS['-disallow-dynamic-resolution'] = disallowDynamicResolution;
|
|
4869
4882
|
} else {
|
|
4870
4883
|
// Bug: this may be a quirk of our test setup?
|
|
4871
4884
|
// In prod builds, this is a no-op helper and is unused in practice. We shouldn't need
|
|
@@ -4875,17 +4888,9 @@ if (DEBUG) {
|
|
|
4875
4888
|
// not really harm anything, since it's just a no-op pass-through helper and the bytes
|
|
4876
4889
|
// has to be included anyway. In the future, perhaps we can avoid the latter by using
|
|
4877
4890
|
// `import(...)`?
|
|
4878
|
-
|
|
4891
|
+
BUILTIN_HELPERS['-disallow-dynamic-resolution'] = disallowDynamicResolution;
|
|
4879
4892
|
}
|
|
4880
4893
|
|
|
4881
|
-
const BUILTIN_HELPERS = Object.assign(Object.assign({}, BUILTIN_KEYWORD_HELPERS), {
|
|
4882
|
-
array,
|
|
4883
|
-
concat,
|
|
4884
|
-
fn,
|
|
4885
|
-
get: get$1,
|
|
4886
|
-
hash
|
|
4887
|
-
});
|
|
4888
|
-
|
|
4889
4894
|
{
|
|
4890
4895
|
BUILTIN_HELPERS['unique-id'] = uniqueId;
|
|
4891
4896
|
}
|
|
@@ -5463,7 +5468,7 @@ class Renderer {
|
|
|
5463
5468
|
|
|
5464
5469
|
getBounds(view) {
|
|
5465
5470
|
let bounds = view[BOUNDS];
|
|
5466
|
-
assert('object passed to getBounds must have the BOUNDS symbol as a property',
|
|
5471
|
+
assert('object passed to getBounds must have the BOUNDS symbol as a property', bounds);
|
|
5467
5472
|
let parentElement = bounds.parentElement();
|
|
5468
5473
|
let firstNode = bounds.firstNode();
|
|
5469
5474
|
let lastNode = bounds.lastNode();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { meta, peekMeta } from '@ember/-internals/meta';
|
|
2
|
-
import { setListeners, isObject, setupMandatorySetter, symbol, toString,
|
|
2
|
+
import { setListeners, isObject, setupMandatorySetter, symbol, toString, inspect, setWithMandatorySetter, Cache, isEmberArray, setProxy, lookupDescriptor, getName, setName, guidFor, makeArray, observerListenerMetaFor, ROOT, setObservers, wrap } from '@ember/-internals/utils';
|
|
3
3
|
import { assert, deprecate, debug, warn } from '@ember/debug';
|
|
4
4
|
import { ENV, context } from '@ember/-internals/environment';
|
|
5
5
|
import { schedule } from '@ember/runloop';
|
|
@@ -449,7 +449,10 @@ function markObjectAsDirty(obj, propertyKey) {
|
|
|
449
449
|
@private
|
|
450
450
|
*/
|
|
451
451
|
|
|
452
|
-
const PROPERTY_DID_CHANGE =
|
|
452
|
+
const PROPERTY_DID_CHANGE = Symbol('PROPERTY_DID_CHANGE');
|
|
453
|
+
function hasPropertyDidChange(obj) {
|
|
454
|
+
return obj != null && typeof obj === 'object' && typeof obj[PROPERTY_DID_CHANGE] === 'function';
|
|
455
|
+
}
|
|
453
456
|
let deferred = 0;
|
|
454
457
|
/**
|
|
455
458
|
This function is called just after an object property has changed.
|
|
@@ -484,9 +487,11 @@ function notifyPropertyChange(obj, keyName, _meta, value) {
|
|
|
484
487
|
}
|
|
485
488
|
|
|
486
489
|
if (PROPERTY_DID_CHANGE in obj) {
|
|
487
|
-
//
|
|
490
|
+
// It's redundant to do this here, but we don't want to check above so we can avoid an extra function call in prod.
|
|
491
|
+
assert('property did change hook is invalid', hasPropertyDidChange(obj)); // we need to check the arguments length here; there's a check in Component's `PROPERTY_DID_CHANGE`
|
|
488
492
|
// that checks its arguments length, so we have to explicitly not call this with `value`
|
|
489
493
|
// if it is not passed to `notifyPropertyChange`
|
|
494
|
+
|
|
490
495
|
if (arguments.length === 4) {
|
|
491
496
|
obj[PROPERTY_DID_CHANGE](keyName, value);
|
|
492
497
|
} else {
|
|
@@ -1377,8 +1382,9 @@ class ComputedProperty extends ComputedDescriptor {
|
|
|
1377
1382
|
// See GH#18147 / GH#19028 for details.
|
|
1378
1383
|
|
|
1379
1384
|
if ( // ensure that we only run this once, while the component is being instantiated
|
|
1380
|
-
meta$$1.isInitializing() && this._dependentKeys !== undefined && this._dependentKeys.length > 0 &&
|
|
1381
|
-
|
|
1385
|
+
meta$$1.isInitializing() && this._dependentKeys !== undefined && this._dependentKeys.length > 0 && typeof obj[PROPERTY_DID_CHANGE] === 'function' && obj.isComponent) {
|
|
1386
|
+
// It's redundant to do this here, but we don't want to check above so we can avoid an extra function call in prod.
|
|
1387
|
+
assert('property did change hook is invalid', hasPropertyDidChange(obj));
|
|
1382
1388
|
addObserver(obj, keyName, () => {
|
|
1383
1389
|
obj[PROPERTY_DID_CHANGE](keyName);
|
|
1384
1390
|
}, undefined, true);
|
|
@@ -2374,12 +2380,14 @@ LIBRARIES.registerCoreLibrary('Ember', VERSION);
|
|
|
2374
2380
|
|
|
2375
2381
|
function getProperties(obj, keys) {
|
|
2376
2382
|
let ret = {};
|
|
2377
|
-
let propertyNames
|
|
2383
|
+
let propertyNames;
|
|
2378
2384
|
let i = 1;
|
|
2379
2385
|
|
|
2380
2386
|
if (arguments.length === 2 && Array.isArray(keys)) {
|
|
2381
2387
|
i = 0;
|
|
2382
2388
|
propertyNames = arguments[1];
|
|
2389
|
+
} else {
|
|
2390
|
+
propertyNames = Array.from(arguments);
|
|
2383
2391
|
}
|
|
2384
2392
|
|
|
2385
2393
|
for (; i < propertyNames.length; i++) {
|
|
@@ -2546,7 +2554,7 @@ function _processNamespace(paths, root, seen) {
|
|
|
2546
2554
|
if (obj && getName(obj) === void 0) {
|
|
2547
2555
|
// Replace the class' `toString` with the dot-separated path
|
|
2548
2556
|
setName(obj, paths.join('.')); // Support nested namespaces
|
|
2549
|
-
} else if (obj && obj
|
|
2557
|
+
} else if (obj && isNamespace(obj)) {
|
|
2550
2558
|
// Skip aliased namespaces
|
|
2551
2559
|
if (seen.has(obj)) {
|
|
2552
2560
|
continue;
|
|
@@ -2561,6 +2569,10 @@ function _processNamespace(paths, root, seen) {
|
|
|
2561
2569
|
paths.length = idx; // cut out last item
|
|
2562
2570
|
}
|
|
2563
2571
|
|
|
2572
|
+
function isNamespace(obj) {
|
|
2573
|
+
return obj != null && typeof obj === 'object' && obj.isNamespace;
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2564
2576
|
function isUppercase(code) {
|
|
2565
2577
|
return code >= 65 && code <= 90 // A
|
|
2566
2578
|
; // Z
|
|
@@ -83,10 +83,10 @@ export default {
|
|
|
83
83
|
@private
|
|
84
84
|
*/
|
|
85
85
|
create(options) {
|
|
86
|
-
let implementation = options
|
|
87
|
-
assert("Location.create: you must specify a 'implementation' option",
|
|
86
|
+
let implementation = options === null || options === void 0 ? void 0 : options.implementation;
|
|
87
|
+
assert("Location.create: you must specify a 'implementation' option", implementation);
|
|
88
88
|
let implementationClass = this.implementations[implementation];
|
|
89
|
-
assert(`Location.create: ${implementation} is not a valid implementation`,
|
|
89
|
+
assert(`Location.create: ${implementation} is not a valid implementation`, implementationClass);
|
|
90
90
|
deprecate("Calling `create` on Location class is deprecated. Instead, use `container.lookup('location:my-location')` to lookup the location you need.", false, {
|
|
91
91
|
id: 'deprecate-auto-location',
|
|
92
92
|
until: '5.0.0',
|
|
@@ -123,7 +123,11 @@ function delegateToConcreteImplementation(methodName) {
|
|
|
123
123
|
let {
|
|
124
124
|
concreteImplementation
|
|
125
125
|
} = this;
|
|
126
|
-
assert("AutoLocation's detect() method should be called before calling any other hooks.", concreteImplementation);
|
|
126
|
+
assert("AutoLocation's detect() method should be called before calling any other hooks.", concreteImplementation); // We need this cast because `Parameters` is deferred so that it is not
|
|
127
|
+
// possible for TS to see it will always produce the right type. However,
|
|
128
|
+
// since `AnyFn` has a rest type, it is allowed. See discussion on [this
|
|
129
|
+
// issue](https://github.com/microsoft/TypeScript/issues/47615).
|
|
130
|
+
|
|
127
131
|
return (_a = concreteImplementation[methodName]) === null || _a === void 0 ? void 0 : _a.call(concreteImplementation, ...args);
|
|
128
132
|
};
|
|
129
133
|
}
|
|
@@ -8,14 +8,13 @@ var __decorate = this && this.__decorate || function (decorators, target, key, d
|
|
|
8
8
|
|
|
9
9
|
import { getOwner } from '@ember/-internals/owner';
|
|
10
10
|
import { Evented } from '@ember/-internals/runtime';
|
|
11
|
-
import { symbol } from '@ember/-internals/utils';
|
|
12
11
|
import { assert } from '@ember/debug';
|
|
13
12
|
import { readOnly } from '@ember/object/computed';
|
|
14
13
|
import Service from '@ember/service';
|
|
15
14
|
import { consumeTag, tagFor } from '@glimmer/validator';
|
|
16
15
|
import EmberRouter from '../system/router';
|
|
17
16
|
import { extractRouteArgs, resemblesURL, shallowEqual } from '../utils';
|
|
18
|
-
const ROUTER =
|
|
17
|
+
export const ROUTER = Symbol('ROUTER');
|
|
19
18
|
|
|
20
19
|
function cleanURL(url, rootURL) {
|
|
21
20
|
if (rootURL === '/') {
|
|
@@ -35,14 +34,16 @@ class RouterService extends Service.extend(Evented) {
|
|
|
35
34
|
|
|
36
35
|
let owner = getOwner(this);
|
|
37
36
|
assert('RouterService is unexpectedly missing an owner', owner);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
|
|
38
|
+
let _router = owner.lookup('router:main');
|
|
39
|
+
|
|
40
|
+
assert('ROUTER SERVICE BUG: Expected router to be an instance of EmberRouter', _router instanceof EmberRouter);
|
|
41
|
+
return this[ROUTER] = _router;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
willDestroy() {
|
|
44
45
|
super.willDestroy();
|
|
45
|
-
this[ROUTER] =
|
|
46
|
+
this[ROUTER] = undefined;
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
48
49
|
Transition the application into another route. The route may
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
@module ember
|
|
3
3
|
*/
|
|
4
4
|
import { getOwner } from '@ember/-internals/owner';
|
|
5
|
-
import { symbol } from '@ember/-internals/utils';
|
|
6
5
|
import { assert } from '@ember/debug';
|
|
7
6
|
import { readOnly } from '@ember/object/computed';
|
|
8
7
|
import Service from '@ember/service';
|
|
9
8
|
import EmberRouter from '../system/router';
|
|
10
|
-
|
|
9
|
+
import { ROUTER } from './router';
|
|
11
10
|
/**
|
|
12
11
|
The Routing service is used by LinkTo, and provides facilities for
|
|
13
12
|
the component/view layer to interact with the router.
|
|
@@ -29,10 +28,14 @@ export default class RoutingService extends Service {
|
|
|
29
28
|
|
|
30
29
|
let owner = getOwner(this);
|
|
31
30
|
assert('RoutingService is unexpectedly missing an owner', owner);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
|
|
32
|
+
let _router = owner.lookup('router:main');
|
|
33
|
+
|
|
34
|
+
assert('ROUTING SERVICE BUG: Expected router to be an instance of EmberRouter', _router instanceof EmberRouter);
|
|
35
|
+
|
|
36
|
+
_router.setupRouter();
|
|
37
|
+
|
|
38
|
+
return this[ROUTER] = _router;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
hasRoute(routeName) {
|
|
@@ -11,7 +11,7 @@ import { addObserver, computed, defineProperty, descriptorForProperty, flushAsyn
|
|
|
11
11
|
import { getOwner } from '@ember/-internals/owner';
|
|
12
12
|
import { BucketCache } from '@ember/-internals/routing';
|
|
13
13
|
import { A as emberA, ActionHandler, Evented, Object as EmberObject, typeOf } from '@ember/-internals/runtime';
|
|
14
|
-
import { isProxy, lookupDescriptor
|
|
14
|
+
import { isProxy, lookupDescriptor } from '@ember/-internals/utils';
|
|
15
15
|
import Controller from '@ember/controller';
|
|
16
16
|
import { assert, info, isTesting } from '@ember/debug';
|
|
17
17
|
import EngineInstance from '@ember/engine/instance';
|
|
@@ -23,7 +23,7 @@ import { calculateCacheKey, deprecateTransitionMethods, normalizeControllerQuery
|
|
|
23
23
|
import generateController from './generate_controller';
|
|
24
24
|
import EmberRouter from './router';
|
|
25
25
|
export const ROUTE_CONNECTIONS = new WeakMap();
|
|
26
|
-
const RENDER =
|
|
26
|
+
const RENDER = Symbol('render');
|
|
27
27
|
|
|
28
28
|
class Route extends EmberObject.extend(ActionHandler, Evented) {
|
|
29
29
|
constructor(owner) {
|
|
@@ -1131,7 +1131,7 @@ class Route extends EmberObject.extend(ActionHandler, Evented) {
|
|
|
1131
1131
|
|
|
1132
1132
|
|
|
1133
1133
|
get _qp() {
|
|
1134
|
-
let combinedQueryParameterConfiguration;
|
|
1134
|
+
let combinedQueryParameterConfiguration = {};
|
|
1135
1135
|
let controllerName = this.controllerName || this.routeName;
|
|
1136
1136
|
let owner = getOwner(this);
|
|
1137
1137
|
assert('Route is unexpectedly missing an owner', owner);
|
|
@@ -1172,6 +1172,7 @@ class Route extends EmberObject.extend(ActionHandler, Evented) {
|
|
|
1172
1172
|
}
|
|
1173
1173
|
|
|
1174
1174
|
let desc = combinedQueryParameterConfiguration[propName];
|
|
1175
|
+
assert(`[BUG] missing query parameter configuration for ${propName}`, desc);
|
|
1175
1176
|
let scope = desc.scope || 'model';
|
|
1176
1177
|
let parts = undefined;
|
|
1177
1178
|
|
|
@@ -1451,9 +1452,7 @@ function mergeEachQueryParams(controllerQP, routeQP) {
|
|
|
1451
1452
|
continue;
|
|
1452
1453
|
}
|
|
1453
1454
|
|
|
1454
|
-
|
|
1455
|
-
Object.assign(newControllerParameterConfiguration, controllerQP[cqpName], routeQP[cqpName]);
|
|
1456
|
-
qps[cqpName] = newControllerParameterConfiguration; // allows us to skip this QP when we check route QPs.
|
|
1455
|
+
qps[cqpName] = Object.assign(Object.assign({}, controllerQP[cqpName]), routeQP[cqpName]); // allows us to skip this QP when we check route QPs.
|
|
1457
1456
|
|
|
1458
1457
|
keysAlreadyMergedOrSkippable[cqpName] = true;
|
|
1459
1458
|
} // loop over all route qps, skipping those that were merged in the first pass
|
|
@@ -1465,9 +1464,7 @@ function mergeEachQueryParams(controllerQP, routeQP) {
|
|
|
1465
1464
|
continue;
|
|
1466
1465
|
}
|
|
1467
1466
|
|
|
1468
|
-
|
|
1469
|
-
Object.assign(newRouteParameterConfiguration, routeQP[rqpName], controllerQP[rqpName]);
|
|
1470
|
-
qps[rqpName] = newRouteParameterConfiguration;
|
|
1467
|
+
qps[rqpName] = Object.assign(Object.assign({}, routeQP[rqpName]), controllerQP[rqpName]);
|
|
1471
1468
|
}
|
|
1472
1469
|
|
|
1473
1470
|
return qps;
|
|
@@ -1468,7 +1468,7 @@ export function triggerEvent(routeInfos, ignoreFailure, name, args) {
|
|
|
1468
1468
|
|
|
1469
1469
|
for (let i = routeInfos.length - 1; i >= 0; i--) {
|
|
1470
1470
|
routeInfo = routeInfos[i];
|
|
1471
|
-
assert('
|
|
1471
|
+
assert('[BUG] Missing routeInfo', routeInfo);
|
|
1472
1472
|
handler = routeInfo.route;
|
|
1473
1473
|
actionHandler = handler && handler.actions && handler.actions[name];
|
|
1474
1474
|
|
|
@@ -1478,6 +1478,8 @@ export function triggerEvent(routeInfos, ignoreFailure, name, args) {
|
|
|
1478
1478
|
} else {
|
|
1479
1479
|
// Should only hit here if a non-bubbling error action is triggered on a route.
|
|
1480
1480
|
if (name === 'error') {
|
|
1481
|
+
assert('[BUG] Missing handler', handler);
|
|
1482
|
+
|
|
1481
1483
|
handler._router._markErrorAsHandled(args[0]);
|
|
1482
1484
|
}
|
|
1483
1485
|
|
|
@@ -1489,7 +1491,7 @@ export function triggerEvent(routeInfos, ignoreFailure, name, args) {
|
|
|
1489
1491
|
let defaultHandler = defaultActionHandlers[name];
|
|
1490
1492
|
|
|
1491
1493
|
if (defaultHandler) {
|
|
1492
|
-
defaultHandler.
|
|
1494
|
+
defaultHandler.call(this, routeInfos, ...args);
|
|
1493
1495
|
return;
|
|
1494
1496
|
}
|
|
1495
1497
|
|
|
@@ -169,35 +169,26 @@ export function normalizeControllerQueryParams(queryParams) {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
function accumulateQueryParamDescriptors(_desc, accum) {
|
|
172
|
-
let desc = _desc
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
if (typeof desc === 'string') {
|
|
176
|
-
tmp = {};
|
|
177
|
-
tmp[desc] = {
|
|
172
|
+
let desc = typeof _desc === 'string' ? {
|
|
173
|
+
[_desc]: {
|
|
178
174
|
as: null
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
}
|
|
175
|
+
}
|
|
176
|
+
} : _desc;
|
|
182
177
|
|
|
183
178
|
for (let key in desc) {
|
|
184
179
|
if (!Object.prototype.hasOwnProperty.call(desc, key)) {
|
|
185
180
|
return;
|
|
186
181
|
}
|
|
187
182
|
|
|
188
|
-
let
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
let val = accum[key] || {
|
|
183
|
+
let _singleDesc = desc[key];
|
|
184
|
+
let singleDesc = typeof _singleDesc === 'string' ? {
|
|
185
|
+
as: _singleDesc
|
|
186
|
+
} : _singleDesc;
|
|
187
|
+
let partialVal = accum[key] || {
|
|
197
188
|
as: null,
|
|
198
189
|
scope: 'model'
|
|
199
190
|
};
|
|
200
|
-
Object.assign(
|
|
191
|
+
let val = Object.assign(Object.assign({}, partialVal), singleDesc);
|
|
201
192
|
accum[key] = val;
|
|
202
193
|
}
|
|
203
194
|
}
|
|
@@ -237,13 +228,12 @@ export function prefixRouteNameArg(route, args) {
|
|
|
237
228
|
return args;
|
|
238
229
|
}
|
|
239
230
|
export function shallowEqual(a, b) {
|
|
240
|
-
let k;
|
|
241
231
|
let aCount = 0;
|
|
242
232
|
let bCount = 0;
|
|
243
233
|
|
|
244
|
-
for (
|
|
245
|
-
if (Object.prototype.hasOwnProperty.call(a,
|
|
246
|
-
if (a[
|
|
234
|
+
for (let kA in a) {
|
|
235
|
+
if (Object.prototype.hasOwnProperty.call(a, kA)) {
|
|
236
|
+
if (a[kA] !== b[kA]) {
|
|
247
237
|
return false;
|
|
248
238
|
}
|
|
249
239
|
|
|
@@ -251,8 +241,8 @@ export function shallowEqual(a, b) {
|
|
|
251
241
|
}
|
|
252
242
|
}
|
|
253
243
|
|
|
254
|
-
for (
|
|
255
|
-
if (Object.prototype.hasOwnProperty.call(b,
|
|
244
|
+
for (let kB in b) {
|
|
245
|
+
if (Object.prototype.hasOwnProperty.call(b, kB)) {
|
|
256
246
|
bCount++;
|
|
257
247
|
}
|
|
258
248
|
}
|
|
@@ -3,28 +3,34 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { meta } from '@ember/-internals/meta';
|
|
5
5
|
import { get, set, defineProperty, Mixin, tagForObject, computed, tagForProperty } from '@ember/-internals/metal';
|
|
6
|
-
import { setProxy, setupMandatorySetter, isObject } from '@ember/-internals/utils';
|
|
6
|
+
import { setProxy, setupMandatorySetter, isObject, isProxy } from '@ember/-internals/utils';
|
|
7
7
|
import { assert } from '@ember/debug';
|
|
8
8
|
import { DEBUG } from '@glimmer/env';
|
|
9
9
|
import { setCustomTagFor } from '@glimmer/manager';
|
|
10
10
|
import { combine, updateTag, tagFor, tagMetaFor } from '@glimmer/validator';
|
|
11
11
|
export function contentFor(proxy) {
|
|
12
|
-
let content = get(proxy, 'content');
|
|
12
|
+
let content = get(proxy, 'content'); // SAFETY: Ideally we'd assert instead of casting, but @glimmer/validator doesn't give us
|
|
13
|
+
// sufficient public types for this. Previously this code was .js and worked correctly so
|
|
14
|
+
// hopefully this is sufficiently reliable.
|
|
15
|
+
|
|
13
16
|
updateTag(tagForObject(proxy), tagForObject(content));
|
|
14
17
|
return content;
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
function customTagForProxy(proxy, key, addMandatorySetter) {
|
|
21
|
+
assert('Expected a proxy', isProxy(proxy));
|
|
18
22
|
let meta = tagMetaFor(proxy);
|
|
19
23
|
let tag = tagFor(proxy, key, meta);
|
|
20
24
|
|
|
21
25
|
if (DEBUG) {
|
|
22
26
|
// TODO: Replace this with something more first class for tracking tags in DEBUG
|
|
27
|
+
// SAFETY: This is not an officially supported property but setting shouldn't cause issues.
|
|
23
28
|
tag._propertyKey = key;
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
if (key in proxy) {
|
|
27
32
|
if (DEBUG && addMandatorySetter) {
|
|
33
|
+
assert('[BUG] setupMandatorySetter should be set when debugging', setupMandatorySetter);
|
|
28
34
|
setupMandatorySetter(tag, proxy, key);
|
|
29
35
|
}
|
|
30
36
|
|
|
@@ -40,20 +46,11 @@ function customTagForProxy(proxy, key, addMandatorySetter) {
|
|
|
40
46
|
return combine(tags);
|
|
41
47
|
}
|
|
42
48
|
}
|
|
43
|
-
/**
|
|
44
|
-
`Ember.ProxyMixin` forwards all properties not defined by the proxy itself
|
|
45
|
-
to a proxied `content` object. See ObjectProxy for more details.
|
|
46
|
-
|
|
47
|
-
@class ProxyMixin
|
|
48
|
-
@namespace Ember
|
|
49
|
-
@private
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
49
|
|
|
53
|
-
|
|
50
|
+
const ProxyMixin = Mixin.create({
|
|
54
51
|
/**
|
|
55
52
|
The object whose properties will be forwarded.
|
|
56
|
-
|
|
53
|
+
@property content
|
|
57
54
|
@type {unknown}
|
|
58
55
|
@default null
|
|
59
56
|
@public
|
|
@@ -97,8 +94,10 @@ export default Mixin.create({
|
|
|
97
94
|
}
|
|
98
95
|
|
|
99
96
|
let content = contentFor(this);
|
|
100
|
-
assert(`Cannot delegate set('${key}', ${value}) to the 'content' property of object proxy ${this}: its 'content' is undefined.`, content);
|
|
97
|
+
assert(`Cannot delegate set('${key}', ${value}) to the 'content' property of object proxy ${this}: its 'content' is undefined.`, content); // SAFETY: We don't actually guarantee that this is an object, so this isn't necessarily safe :(
|
|
98
|
+
|
|
101
99
|
return set(content, key, value);
|
|
102
100
|
}
|
|
103
101
|
|
|
104
|
-
});
|
|
102
|
+
});
|
|
103
|
+
export default ProxyMixin;
|