ember-source 4.4.0-alpha.2 → 4.4.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 +5 -1
- package/blueprints/acceptance-test/mocha-rfc-232-files/tests/acceptance/__name__-test.js +1 -1
- package/blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +1 -1
- package/blueprints/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +2 -2
- package/blueprints/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +1 -1
- package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +1 -1
- package/blueprints/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/blueprints/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/__test__.js +1 -1
- package/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +19 -8
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +9 -5
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +994 -1537
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/container/index.js +0 -16
- package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +10 -19
- package/dist/packages/@ember/-internals/extension-support/lib/data_adapter.js +113 -112
- package/dist/packages/@ember/-internals/glimmer/index.js +150 -749
- package/dist/packages/@ember/-internals/metal/index.js +6 -17
- package/dist/packages/@ember/-internals/routing/lib/location/hash_location.js +1 -1
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +65 -12
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +1 -1
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +11 -8
- package/dist/packages/@ember/-internals/runtime/lib/compare.js +19 -5
- package/dist/packages/@ember/-internals/runtime/lib/ext/rsvp.js +8 -4
- package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +1 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +1 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/comparable.js +4 -4
- package/dist/packages/@ember/-internals/runtime/lib/mixins/promise_proxy.js +16 -16
- package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +8 -8
- package/dist/packages/@ember/-internals/views/lib/system/utils.js +4 -2
- package/dist/packages/@ember/-internals/views/lib/views/core_view.js +5 -22
- package/dist/packages/@ember/canary-features/index.js +4 -2
- package/dist/packages/@ember/debug/index.js +1 -1
- package/dist/packages/@ember/debug/lib/deprecate.js +6 -2
- package/dist/packages/@ember/debug/lib/handlers.js +1 -1
- package/dist/packages/@ember/renderer/index.js +21 -0
- package/dist/packages/@ember/runloop/index.js +31 -528
- package/dist/packages/@ember/runloop/type-tests.ts/begin-end.test.js +5 -0
- package/dist/packages/@ember/runloop/type-tests.ts/bind.test.js +59 -0
- package/dist/packages/@ember/runloop/type-tests.ts/cancel.test.js +5 -0
- package/dist/packages/@ember/runloop/type-tests.ts/debounce.test.js +77 -0
- package/dist/packages/@ember/runloop/type-tests.ts/join.test.js +38 -0
- package/dist/packages/@ember/runloop/type-tests.ts/later.test.js +38 -0
- package/dist/packages/@ember/runloop/type-tests.ts/next.test.js +38 -0
- package/dist/packages/@ember/runloop/type-tests.ts/once.test.js +38 -0
- package/dist/packages/@ember/runloop/type-tests.ts/run.test.js +38 -0
- package/dist/packages/@ember/runloop/type-tests.ts/schedule-once.test.js +39 -0
- package/dist/packages/@ember/runloop/type-tests.ts/schedule.test.js +39 -0
- package/dist/packages/@ember/runloop/type-tests.ts/throttle.test.js +77 -0
- package/dist/packages/ember/index.js +1 -0
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +591 -300
- package/package.json +11 -11
|
@@ -145,7 +145,7 @@ function sendEvent(obj, eventName, params, actions, _meta) {
|
|
|
145
145
|
return true;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
|
-
@
|
|
148
|
+
@public
|
|
149
149
|
@method hasListeners
|
|
150
150
|
@static
|
|
151
151
|
@for @ember/object/events
|
|
@@ -1755,9 +1755,6 @@ function isPath(path) {
|
|
|
1755
1755
|
return typeof path === 'string' && firstDotIndexCache.get(path) !== -1;
|
|
1756
1756
|
}
|
|
1757
1757
|
|
|
1758
|
-
/**
|
|
1759
|
-
@module @ember/object
|
|
1760
|
-
*/
|
|
1761
1758
|
const PROXY_CONTENT = symbol('PROXY_CONTENT');
|
|
1762
1759
|
let getPossibleMandatoryProxyValue;
|
|
1763
1760
|
|
|
@@ -2125,7 +2122,6 @@ function eachProxyArrayDidChange(array, idx, removedCnt, addedCnt) {
|
|
|
2125
2122
|
confusing.
|
|
2126
2123
|
|
|
2127
2124
|
```javascript
|
|
2128
|
-
isNone(); // true
|
|
2129
2125
|
isNone(null); // true
|
|
2130
2126
|
isNone(undefined); // true
|
|
2131
2127
|
isNone(''); // false
|
|
@@ -2159,7 +2155,6 @@ function isNone(obj) {
|
|
|
2159
2155
|
to check emptiness.
|
|
2160
2156
|
|
|
2161
2157
|
```javascript
|
|
2162
|
-
isEmpty(); // true
|
|
2163
2158
|
isEmpty(null); // true
|
|
2164
2159
|
isEmpty(undefined); // true
|
|
2165
2160
|
isEmpty(''); // true
|
|
@@ -2183,19 +2178,15 @@ function isNone(obj) {
|
|
|
2183
2178
|
*/
|
|
2184
2179
|
|
|
2185
2180
|
function isEmpty(obj) {
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
if (none) {
|
|
2189
|
-
return none;
|
|
2181
|
+
if (obj === null || obj === undefined) {
|
|
2182
|
+
return true;
|
|
2190
2183
|
}
|
|
2191
2184
|
|
|
2192
2185
|
if (typeof obj.unknownProperty !== 'function' && typeof obj.size === 'number') {
|
|
2193
2186
|
return !obj.size;
|
|
2194
2187
|
}
|
|
2195
2188
|
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
if (objectType === 'object') {
|
|
2189
|
+
if (typeof obj === 'object') {
|
|
2199
2190
|
let size = get(obj, 'size');
|
|
2200
2191
|
|
|
2201
2192
|
if (typeof size === 'number') {
|
|
@@ -2209,7 +2200,7 @@ function isEmpty(obj) {
|
|
|
2209
2200
|
}
|
|
2210
2201
|
}
|
|
2211
2202
|
|
|
2212
|
-
if (typeof obj.length === 'number' &&
|
|
2203
|
+
if (typeof obj.length === 'number' && typeof obj !== 'function') {
|
|
2213
2204
|
return !obj.length;
|
|
2214
2205
|
}
|
|
2215
2206
|
|
|
@@ -2226,7 +2217,6 @@ function isEmpty(obj) {
|
|
|
2226
2217
|
```javascript
|
|
2227
2218
|
import { isBlank } from '@ember/utils';
|
|
2228
2219
|
|
|
2229
|
-
isBlank(); // true
|
|
2230
2220
|
isBlank(null); // true
|
|
2231
2221
|
isBlank(undefined); // true
|
|
2232
2222
|
isBlank(''); // true
|
|
@@ -2260,7 +2250,6 @@ function isBlank(obj) {
|
|
|
2260
2250
|
A value is present if it not `isBlank`.
|
|
2261
2251
|
|
|
2262
2252
|
```javascript
|
|
2263
|
-
isPresent(); // false
|
|
2264
2253
|
isPresent(null); // false
|
|
2265
2254
|
isPresent(undefined); // false
|
|
2266
2255
|
isPresent(''); // false
|
|
@@ -2767,7 +2756,7 @@ function mergeMixins(mixins, meta$$1, descs, values, base, keys, keysWithSuper)
|
|
|
2767
2756
|
} else if (mixins !== undefined) {
|
|
2768
2757
|
mergeMixins(mixins, meta$$1, descs, values, base, keys, keysWithSuper);
|
|
2769
2758
|
|
|
2770
|
-
if (currentMixin._without !== undefined) {
|
|
2759
|
+
if (currentMixin instanceof Mixin && currentMixin._without !== undefined) {
|
|
2771
2760
|
currentMixin._without.forEach(keyName => {
|
|
2772
2761
|
// deleting the key means we won't process the value
|
|
2773
2762
|
let index = keys.indexOf(keyName);
|
|
@@ -124,7 +124,7 @@ export default class HashLocation extends EmberObject {
|
|
|
124
124
|
onUpdateURL(callback) {
|
|
125
125
|
this._removeEventListener();
|
|
126
126
|
|
|
127
|
-
this._hashchangeHandler = bind(this, function () {
|
|
127
|
+
this._hashchangeHandler = bind(this, function (_event) {
|
|
128
128
|
let path = this.getURL();
|
|
129
129
|
|
|
130
130
|
if (this.lastSetURL === path) {
|
|
@@ -28,6 +28,55 @@ function cleanURL(url, rootURL) {
|
|
|
28
28
|
class RouterService extends Service.extend(Evented) {
|
|
29
29
|
constructor() {
|
|
30
30
|
super(...arguments);
|
|
31
|
+
/**
|
|
32
|
+
You can register a listener for events emitted by this service with `.on()`:
|
|
33
|
+
```app/routes/contact-form.js
|
|
34
|
+
import Route from '@ember/routing';
|
|
35
|
+
import { service } from '@ember/service';
|
|
36
|
+
export default class extends Route {
|
|
37
|
+
@service router;
|
|
38
|
+
activate() {
|
|
39
|
+
this.router.on('routeWillChange', (transition) => {
|
|
40
|
+
if (!transition.to.find(route => route.name === this.routeName)) {
|
|
41
|
+
alert("Please save or cancel your changes.");
|
|
42
|
+
transition.abort();
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
@method on
|
|
49
|
+
@param {String} eventName
|
|
50
|
+
@param {Function} callback
|
|
51
|
+
@public
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
You can unregister a listener for events emitted by this service with `.off()`:
|
|
56
|
+
```app/routes/contact-form.js
|
|
57
|
+
import Route from '@ember/routing';
|
|
58
|
+
import { service } from '@ember/service';
|
|
59
|
+
export default class extends Route {
|
|
60
|
+
@service router;
|
|
61
|
+
callback = (transition) => {
|
|
62
|
+
if (!transition.to.find(route => route.name === this.routeName)) {
|
|
63
|
+
alert("Please save or cancel your changes.");
|
|
64
|
+
transition.abort();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
activate() {
|
|
68
|
+
this.router.on('routeWillChange', this.callback);
|
|
69
|
+
}
|
|
70
|
+
deactivate() {
|
|
71
|
+
this.router.off('routeWillChange', this.callback);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
@method off
|
|
75
|
+
@param {String} eventName
|
|
76
|
+
@param {Function} callback
|
|
77
|
+
@public
|
|
78
|
+
*/
|
|
79
|
+
|
|
31
80
|
/**
|
|
32
81
|
The `routeWillChange` event is fired at the beginning of any
|
|
33
82
|
attempted transition with a `Transition` object as the sole
|
|
@@ -40,9 +89,8 @@ class RouterService extends Service.extend(Evented) {
|
|
|
40
89
|
import { service } from '@ember/service';
|
|
41
90
|
export default class extends Route {
|
|
42
91
|
@service router;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this.router.on('routeWillChange', (transition) => {
|
|
92
|
+
activate() {
|
|
93
|
+
this.router.on('routeWillChange', (transition) => {
|
|
46
94
|
if (!transition.to.find(route => route.name === this.routeName)) {
|
|
47
95
|
alert("Please save or cancel your changes.");
|
|
48
96
|
transition.abort();
|
|
@@ -67,9 +115,8 @@ class RouterService extends Service.extend(Evented) {
|
|
|
67
115
|
import { service } from '@ember/service';
|
|
68
116
|
export default class extends Route {
|
|
69
117
|
@service router;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
this.router.on('routeDidChange', (transition) => {
|
|
118
|
+
activate() {
|
|
119
|
+
this.router.on('routeDidChange', (transition) => {
|
|
73
120
|
ga.send('pageView', {
|
|
74
121
|
current: transition.to.name,
|
|
75
122
|
from: transition.from.name
|
|
@@ -197,7 +244,6 @@ class RouterService extends Service.extend(Evented) {
|
|
|
197
244
|
|
|
198
245
|
let transition = this._router._doTransition(routeName, models, queryParams, true);
|
|
199
246
|
|
|
200
|
-
transition['_keepDefaultQueryParamValues'] = true;
|
|
201
247
|
return transition;
|
|
202
248
|
}
|
|
203
249
|
/**
|
|
@@ -368,19 +414,26 @@ class RouterService extends Service.extend(Evented) {
|
|
|
368
414
|
let hasQueryParams = Object.keys(queryParams).length > 0;
|
|
369
415
|
|
|
370
416
|
if (hasQueryParams) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
this._router._prepareQueryParams( // UNSAFE: casting `routeName as string` here encodes the existing
|
|
417
|
+
// UNSAFE: casting `routeName as string` here encodes the existing
|
|
374
418
|
// assumption but may be wrong: `extractRouteArgs` correctly returns it
|
|
375
419
|
// as `string | undefined`. There may be bugs if `_prepareQueryParams`
|
|
376
420
|
// does not correctly account for `undefined` values for `routeName`.
|
|
377
421
|
// Spoilers: under the hood this currently uses router.js APIs which
|
|
378
422
|
// *do not* account for this being `undefined`.
|
|
379
|
-
|
|
423
|
+
let targetRouteName = routeName;
|
|
424
|
+
queryParams = Object.assign({}, queryParams);
|
|
425
|
+
|
|
426
|
+
this._router._prepareQueryParams(targetRouteName, models, queryParams, true
|
|
427
|
+
/* fromRouterService */
|
|
428
|
+
);
|
|
429
|
+
|
|
430
|
+
let currentQueryParams = Object.assign({}, routerMicrolib.state.queryParams);
|
|
431
|
+
|
|
432
|
+
this._router._prepareQueryParams(targetRouteName, models, currentQueryParams, true
|
|
380
433
|
/* fromRouterService */
|
|
381
434
|
);
|
|
382
435
|
|
|
383
|
-
return shallowEqual(queryParams,
|
|
436
|
+
return shallowEqual(queryParams, currentQueryParams);
|
|
384
437
|
}
|
|
385
438
|
|
|
386
439
|
return true;
|
|
@@ -1663,7 +1663,7 @@ Route.reopen({
|
|
|
1663
1663
|
qp.serializedValue = svalue;
|
|
1664
1664
|
let thisQueryParamHasDefaultValue = qp.serializedDefaultValue === svalue;
|
|
1665
1665
|
|
|
1666
|
-
if (!thisQueryParamHasDefaultValue
|
|
1666
|
+
if (!thisQueryParamHasDefaultValue) {
|
|
1667
1667
|
finalParams.push({
|
|
1668
1668
|
value: svalue,
|
|
1669
1669
|
visible: true,
|
|
@@ -94,6 +94,7 @@ class EmberRouter extends EmberObject.extend(Evented) {
|
|
|
94
94
|
this._handledErrors = new Set();
|
|
95
95
|
this._engineInstances = Object.create(null);
|
|
96
96
|
this._engineInfoByRoute = Object.create(null);
|
|
97
|
+
this._slowTransitionTimer = null;
|
|
97
98
|
this.currentState = null;
|
|
98
99
|
this.targetState = null;
|
|
99
100
|
|
|
@@ -701,11 +702,13 @@ class EmberRouter extends EmberObject.extend(Evented) {
|
|
|
701
702
|
let instances = this._engineInstances;
|
|
702
703
|
|
|
703
704
|
for (let name in instances) {
|
|
704
|
-
let
|
|
705
|
-
assert('has
|
|
705
|
+
let instanceMap = instances[name];
|
|
706
|
+
assert('has instanceMap', instanceMap);
|
|
706
707
|
|
|
707
|
-
for (let id in
|
|
708
|
-
|
|
708
|
+
for (let id in instanceMap) {
|
|
709
|
+
let instance = instanceMap[id];
|
|
710
|
+
assert('has instance', instance);
|
|
711
|
+
run(instance, 'destroy');
|
|
709
712
|
}
|
|
710
713
|
}
|
|
711
714
|
}
|
|
@@ -918,7 +921,7 @@ class EmberRouter extends EmberObject.extend(Evented) {
|
|
|
918
921
|
}
|
|
919
922
|
}
|
|
920
923
|
|
|
921
|
-
_doTransition(_targetRouteName, models, _queryParams,
|
|
924
|
+
_doTransition(_targetRouteName, models, _queryParams, _fromRouterService) {
|
|
922
925
|
let targetRouteName = _targetRouteName || getActiveTargetName(this._routerMicrolib);
|
|
923
926
|
|
|
924
927
|
assert(`The route ${targetRouteName} was not found`, Boolean(targetRouteName) && this._routerMicrolib.hasRoute(targetRouteName));
|
|
@@ -929,7 +932,7 @@ class EmberRouter extends EmberObject.extend(Evented) {
|
|
|
929
932
|
|
|
930
933
|
Object.assign(queryParams, _queryParams);
|
|
931
934
|
|
|
932
|
-
this._prepareQueryParams(targetRouteName, models, queryParams, Boolean(
|
|
935
|
+
this._prepareQueryParams(targetRouteName, models, queryParams, Boolean(_fromRouterService));
|
|
933
936
|
|
|
934
937
|
let transition = this._routerMicrolib.transitionTo(targetRouteName, ...models, {
|
|
935
938
|
queryParams
|
|
@@ -1167,7 +1170,7 @@ class EmberRouter extends EmberObject.extend(Evented) {
|
|
|
1167
1170
|
_scheduleLoadingEvent(transition, originRoute) {
|
|
1168
1171
|
this._cancelSlowTransitionTimer();
|
|
1169
1172
|
|
|
1170
|
-
this._slowTransitionTimer = scheduleOnce('routerTransitions', this,
|
|
1173
|
+
this._slowTransitionTimer = scheduleOnce('routerTransitions', this, this._handleSlowTransition, transition, originRoute);
|
|
1171
1174
|
}
|
|
1172
1175
|
|
|
1173
1176
|
_handleSlowTransition(transition, originRoute) {
|
|
@@ -1626,7 +1629,7 @@ function representEmptyRoute(liveRoutes, defaultParentState, {
|
|
|
1626
1629
|
// Create an entry to represent our default template name,
|
|
1627
1630
|
// just so other routes can target it and inherit its place
|
|
1628
1631
|
// in the outlet hierarchy.
|
|
1629
|
-
defaultParentState.outlets
|
|
1632
|
+
defaultParentState.outlets['main'] = {
|
|
1630
1633
|
render: {
|
|
1631
1634
|
name: routeName,
|
|
1632
1635
|
outlet: 'main'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { typeOf } from './type-of';
|
|
2
2
|
import Comparable from './mixins/comparable';
|
|
3
|
+
import { assert } from '@ember/debug';
|
|
3
4
|
const TYPE_ORDER = {
|
|
4
5
|
undefined: 0,
|
|
5
6
|
null: 1,
|
|
@@ -31,8 +32,9 @@ const TYPE_ORDER = {
|
|
|
31
32
|
// SSt `------'`
|
|
32
33
|
|
|
33
34
|
function spaceship(a, b) {
|
|
34
|
-
let diff = a - b;
|
|
35
|
-
|
|
35
|
+
let diff = a - b; // SAFETY: Number casts true into 1 and false into 0. Therefore, this must end up as one of the Compare values.
|
|
36
|
+
|
|
37
|
+
return Number(diff > 0) - Number(diff < 0);
|
|
36
38
|
}
|
|
37
39
|
/**
|
|
38
40
|
@module @ember/utils
|
|
@@ -94,11 +96,12 @@ export default function compare(v, w) {
|
|
|
94
96
|
let type1 = typeOf(v);
|
|
95
97
|
let type2 = typeOf(w);
|
|
96
98
|
|
|
97
|
-
if (type1 === 'instance' &&
|
|
99
|
+
if (type1 === 'instance' && isComparable(v) && v.constructor.compare) {
|
|
98
100
|
return v.constructor.compare(v, w);
|
|
99
101
|
}
|
|
100
102
|
|
|
101
|
-
if (type2 === 'instance' &&
|
|
103
|
+
if (type2 === 'instance' && isComparable(w) && w.constructor.compare) {
|
|
104
|
+
// SAFETY: Multiplying by a negative just changes the sign
|
|
102
105
|
return w.constructor.compare(w, v) * -1;
|
|
103
106
|
}
|
|
104
107
|
|
|
@@ -111,14 +114,20 @@ export default function compare(v, w) {
|
|
|
111
114
|
|
|
112
115
|
switch (type1) {
|
|
113
116
|
case 'boolean':
|
|
117
|
+
assert('both are boolean', typeof v === 'boolean' && typeof w === 'boolean');
|
|
118
|
+
return spaceship(Number(v), Number(w));
|
|
119
|
+
|
|
114
120
|
case 'number':
|
|
121
|
+
assert('both are numbers', typeof v === 'number' && typeof w === 'number');
|
|
115
122
|
return spaceship(v, w);
|
|
116
123
|
|
|
117
124
|
case 'string':
|
|
125
|
+
assert('both are strings', typeof v === 'string' && typeof w === 'string');
|
|
118
126
|
return spaceship(v.localeCompare(w), 0);
|
|
119
127
|
|
|
120
128
|
case 'array':
|
|
121
129
|
{
|
|
130
|
+
assert('both are arrays', Array.isArray(v) && Array.isArray(w));
|
|
122
131
|
let vLen = v.length;
|
|
123
132
|
let wLen = w.length;
|
|
124
133
|
let len = Math.min(vLen, wLen);
|
|
@@ -137,16 +146,21 @@ export default function compare(v, w) {
|
|
|
137
146
|
}
|
|
138
147
|
|
|
139
148
|
case 'instance':
|
|
140
|
-
if (
|
|
149
|
+
if (isComparable(v) && v.compare) {
|
|
141
150
|
return v.compare(v, w);
|
|
142
151
|
}
|
|
143
152
|
|
|
144
153
|
return 0;
|
|
145
154
|
|
|
146
155
|
case 'date':
|
|
156
|
+
assert('both are dates', v instanceof Date && w instanceof Date);
|
|
147
157
|
return spaceship(v.getTime(), w.getTime());
|
|
148
158
|
|
|
149
159
|
default:
|
|
150
160
|
return 0;
|
|
151
161
|
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function isComparable(value) {
|
|
165
|
+
return Comparable.detect(value);
|
|
152
166
|
}
|
|
@@ -25,13 +25,17 @@ export function onerrorDefault(reason) {
|
|
|
25
25
|
|
|
26
26
|
function errorFor(reason) {
|
|
27
27
|
if (!reason) return;
|
|
28
|
+
let withErrorThrown = reason;
|
|
28
29
|
|
|
29
|
-
if (
|
|
30
|
-
return unwrapErrorThrown(
|
|
30
|
+
if (withErrorThrown.errorThrown) {
|
|
31
|
+
return unwrapErrorThrown(withErrorThrown);
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
let withName = reason;
|
|
35
|
+
|
|
36
|
+
if (withName.name === 'UnrecognizedURLError') {
|
|
37
|
+
assert(`The URL '${withName.message}' did not match any routes in your application`, false); // @ts-expect-error We'll hit this if the assert is stripped
|
|
38
|
+
|
|
35
39
|
return;
|
|
36
40
|
}
|
|
37
41
|
|
|
@@ -1351,7 +1351,7 @@ const MutableArray = Mixin.create(ArrayMixin, MutableEnumerable, {
|
|
|
1351
1351
|
colors.unshiftObjects('yellow'); // Type Error: 'undefined' is not a function
|
|
1352
1352
|
```
|
|
1353
1353
|
@method unshiftObjects
|
|
1354
|
-
@param {
|
|
1354
|
+
@param {Enumerable} objects the objects to add
|
|
1355
1355
|
@return {EmberArray} receiver
|
|
1356
1356
|
@public
|
|
1357
1357
|
*/
|
|
@@ -18,13 +18,13 @@ import { Mixin } from '@ember/-internals/metal';
|
|
|
18
18
|
export default Mixin.create({
|
|
19
19
|
/**
|
|
20
20
|
__Required.__ You must implement this method to apply this mixin.
|
|
21
|
-
|
|
21
|
+
Override to return the result of the comparison of the two parameters. The
|
|
22
22
|
compare method should return:
|
|
23
|
-
|
|
23
|
+
- `-1` if `a < b`
|
|
24
24
|
- `0` if `a == b`
|
|
25
25
|
- `1` if `a > b`
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
Default implementation raises an exception.
|
|
27
|
+
@method compare
|
|
28
28
|
@param a {Object} the first object to compare
|
|
29
29
|
@param b {Object} the second object to compare
|
|
30
30
|
@return {Number} the result of the comparison
|
|
@@ -98,7 +98,7 @@ export default Mixin.create({
|
|
|
98
98
|
/**
|
|
99
99
|
If the proxied promise is rejected this will contain the reason
|
|
100
100
|
provided.
|
|
101
|
-
|
|
101
|
+
@property reason
|
|
102
102
|
@default null
|
|
103
103
|
@public
|
|
104
104
|
*/
|
|
@@ -106,7 +106,7 @@ export default Mixin.create({
|
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
108
|
Once the proxied promise has settled this will become `false`.
|
|
109
|
-
|
|
109
|
+
@property isPending
|
|
110
110
|
@default true
|
|
111
111
|
@public
|
|
112
112
|
*/
|
|
@@ -116,7 +116,7 @@ export default Mixin.create({
|
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
Once the proxied promise has settled this will become `true`.
|
|
119
|
-
|
|
119
|
+
@property isSettled
|
|
120
120
|
@default false
|
|
121
121
|
@public
|
|
122
122
|
*/
|
|
@@ -126,7 +126,7 @@ export default Mixin.create({
|
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
128
|
Will become `true` if the proxied promise is rejected.
|
|
129
|
-
|
|
129
|
+
@property isRejected
|
|
130
130
|
@default false
|
|
131
131
|
@public
|
|
132
132
|
*/
|
|
@@ -134,7 +134,7 @@ export default Mixin.create({
|
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
136
|
Will become `true` if the proxied promise is fulfilled.
|
|
137
|
-
|
|
137
|
+
@property isFulfilled
|
|
138
138
|
@default false
|
|
139
139
|
@public
|
|
140
140
|
*/
|
|
@@ -142,17 +142,17 @@ export default Mixin.create({
|
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
144
|
The promise whose fulfillment value is being proxied by this object.
|
|
145
|
-
|
|
145
|
+
This property must be specified upon creation, and should not be
|
|
146
146
|
changed once created.
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
Example:
|
|
148
|
+
```javascript
|
|
149
149
|
import ObjectProxy from '@ember/object/proxy';
|
|
150
150
|
import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
|
|
151
|
-
|
|
151
|
+
ObjectProxy.extend(PromiseProxyMixin).create({
|
|
152
152
|
promise: <thenable>
|
|
153
153
|
});
|
|
154
154
|
```
|
|
155
|
-
|
|
155
|
+
@property promise
|
|
156
156
|
@public
|
|
157
157
|
*/
|
|
158
158
|
promise: computed({
|
|
@@ -168,8 +168,8 @@ export default Mixin.create({
|
|
|
168
168
|
|
|
169
169
|
/**
|
|
170
170
|
An alias to the proxied promise's `then`.
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
See RSVP.Promise.then.
|
|
172
|
+
@method then
|
|
173
173
|
@param {Function} callback
|
|
174
174
|
@return {RSVP.Promise}
|
|
175
175
|
@public
|
|
@@ -178,8 +178,8 @@ export default Mixin.create({
|
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
180
|
An alias to the proxied promise's `catch`.
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
See RSVP.Promise.catch.
|
|
182
|
+
@method catch
|
|
183
183
|
@param {Function} callback
|
|
184
184
|
@return {RSVP.Promise}
|
|
185
185
|
@since 1.3.0
|
|
@@ -189,8 +189,8 @@ export default Mixin.create({
|
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
191
|
An alias to the proxied promise's `finally`.
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
See RSVP.Promise.finally.
|
|
193
|
+
@method finally
|
|
194
194
|
@param {Function} callback
|
|
195
195
|
@return {RSVP.Promise}
|
|
196
196
|
@since 1.3.0
|
|
@@ -41,9 +41,9 @@ const TargetActionSupport = Mixin.create({
|
|
|
41
41
|
/**
|
|
42
42
|
Send an `action` with an `actionContext` to a `target`. The action, actionContext
|
|
43
43
|
and target will be retrieved from properties of the object. For example:
|
|
44
|
-
|
|
44
|
+
```javascript
|
|
45
45
|
import { alias } from '@ember/object/computed';
|
|
46
|
-
|
|
46
|
+
App.SaveButtonView = Ember.View.extend(Ember.TargetActionSupport, {
|
|
47
47
|
target: alias('controller'),
|
|
48
48
|
action: 'save',
|
|
49
49
|
actionContext: alias('context'),
|
|
@@ -53,9 +53,9 @@ const TargetActionSupport = Mixin.create({
|
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
```
|
|
56
|
-
|
|
56
|
+
The `target`, `action`, and `actionContext` can be provided as properties of
|
|
57
57
|
an optional object argument to `triggerAction` as well.
|
|
58
|
-
|
|
58
|
+
```javascript
|
|
59
59
|
App.SaveButtonView = Ember.View.extend(Ember.TargetActionSupport, {
|
|
60
60
|
click() {
|
|
61
61
|
this.triggerAction({
|
|
@@ -67,12 +67,12 @@ const TargetActionSupport = Mixin.create({
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
```
|
|
70
|
-
|
|
70
|
+
The `actionContext` defaults to the object you are mixing `TargetActionSupport` into.
|
|
71
71
|
But `target` and `action` must be specified either as properties or with the argument
|
|
72
72
|
to `triggerAction`, or a combination:
|
|
73
|
-
|
|
73
|
+
```javascript
|
|
74
74
|
import { alias } from '@ember/object/computed';
|
|
75
|
-
|
|
75
|
+
App.SaveButtonView = Ember.View.extend(Ember.TargetActionSupport, {
|
|
76
76
|
target: alias('controller'),
|
|
77
77
|
click() {
|
|
78
78
|
this.triggerAction({
|
|
@@ -82,7 +82,7 @@ const TargetActionSupport = Mixin.create({
|
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
```
|
|
85
|
-
|
|
85
|
+
@method triggerAction
|
|
86
86
|
@param opts {Object} (optional, with the optional keys action, target and/or actionContext)
|
|
87
87
|
@return {Boolean} true if the action was sent successfully and did not return false
|
|
88
88
|
@private
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { getOwner } from '@ember/-internals/owner';
|
|
2
|
-
/* globals Element */
|
|
3
|
-
|
|
4
2
|
import { guidFor } from '@ember/-internals/utils';
|
|
5
3
|
import { assert } from '@ember/debug';
|
|
6
4
|
/**
|
|
@@ -8,6 +6,10 @@ import { assert } from '@ember/debug';
|
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
8
|
export function isSimpleClick(event) {
|
|
9
|
+
if (!(event instanceof MouseEvent)) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
|
|
11
13
|
let modifier = event.shiftKey || event.metaKey || event.altKey || event.ctrlKey;
|
|
12
14
|
let secondaryClick = event.which > 1; // IE9 may return undefined
|
|
13
15
|
|
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
import { inject } from '@ember/-internals/metal';
|
|
2
2
|
import { ActionHandler, Evented, FrameworkObject } from '@ember/-internals/runtime';
|
|
3
3
|
import states from './states';
|
|
4
|
-
/**
|
|
5
|
-
`Ember.CoreView` is an abstract class that exists to give view-like behavior
|
|
6
|
-
to both Ember's main view class `Component` and other classes that don't need
|
|
7
|
-
the full functionality of `Component`.
|
|
8
|
-
|
|
9
|
-
Unless you have specific needs for `CoreView`, you will use `Component`
|
|
10
|
-
in your applications.
|
|
11
|
-
|
|
12
|
-
@class CoreView
|
|
13
|
-
@namespace Ember
|
|
14
|
-
@extends EmberObject
|
|
15
|
-
@deprecated Use `Component` instead.
|
|
16
|
-
@uses Evented
|
|
17
|
-
@uses Ember.ActionHandler
|
|
18
|
-
@private
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
4
|
const CoreView = FrameworkObject.extend(Evented, ActionHandler, {
|
|
22
5
|
isView: true,
|
|
23
6
|
_states: states,
|
|
@@ -34,7 +17,7 @@ const CoreView = FrameworkObject.extend(Evented, ActionHandler, {
|
|
|
34
17
|
/**
|
|
35
18
|
If the view is currently inserted into the DOM of a parent view, this
|
|
36
19
|
property will point to the parent of the view.
|
|
37
|
-
|
|
20
|
+
@property parentView
|
|
38
21
|
@type Ember.View
|
|
39
22
|
@default null
|
|
40
23
|
@private
|
|
@@ -42,16 +25,16 @@ const CoreView = FrameworkObject.extend(Evented, ActionHandler, {
|
|
|
42
25
|
parentView: null,
|
|
43
26
|
|
|
44
27
|
instrumentDetails(hash) {
|
|
45
|
-
hash
|
|
46
|
-
hash
|
|
47
|
-
hash
|
|
28
|
+
hash['object'] = this.toString();
|
|
29
|
+
hash['containerKey'] = this._debugContainerKey;
|
|
30
|
+
hash['view'] = this;
|
|
48
31
|
return hash;
|
|
49
32
|
},
|
|
50
33
|
|
|
51
34
|
/**
|
|
52
35
|
Override the default event firing from `Evented` to
|
|
53
36
|
also call methods with the given name.
|
|
54
|
-
|
|
37
|
+
@method trigger
|
|
55
38
|
@param name {String}
|
|
56
39
|
@private
|
|
57
40
|
*/
|
|
@@ -14,7 +14,8 @@ export const DEFAULT_FEATURES = {
|
|
|
14
14
|
EMBER_LIBRARIES_ISREGISTERED: null,
|
|
15
15
|
EMBER_IMPROVED_INSTRUMENTATION: null,
|
|
16
16
|
EMBER_ROUTING_ROUTER_SERVICE_REFRESH: true,
|
|
17
|
-
EMBER_CACHED: true
|
|
17
|
+
EMBER_CACHED: true,
|
|
18
|
+
EMBER_UNIQUE_ID_HELPER: true
|
|
18
19
|
};
|
|
19
20
|
/**
|
|
20
21
|
The hash of enabled Canary features. Add to this, any canary features
|
|
@@ -66,4 +67,5 @@ function featureValue(value) {
|
|
|
66
67
|
export const EMBER_LIBRARIES_ISREGISTERED = featureValue(FEATURES.EMBER_LIBRARIES_ISREGISTERED);
|
|
67
68
|
export const EMBER_IMPROVED_INSTRUMENTATION = featureValue(FEATURES.EMBER_IMPROVED_INSTRUMENTATION);
|
|
68
69
|
export const EMBER_ROUTING_ROUTER_SERVICE_REFRESH = featureValue(FEATURES.EMBER_ROUTING_ROUTER_SERVICE_REFRESH);
|
|
69
|
-
export const EMBER_CACHED = featureValue(FEATURES.EMBER_CACHED);
|
|
70
|
+
export const EMBER_CACHED = featureValue(FEATURES.EMBER_CACHED);
|
|
71
|
+
export const EMBER_UNIQUE_ID_HELPER = featureValue(FEATURES.EMBER_UNIQUE_ID_HELPER);
|
|
@@ -260,7 +260,7 @@ let _warnIfUsingStrippedFeatureFlags;
|
|
|
260
260
|
if (DEBUG && !isTesting()) {
|
|
261
261
|
if (typeof window !== 'undefined' && (isFirefox || isChrome) && window.addEventListener) {
|
|
262
262
|
window.addEventListener('load', () => {
|
|
263
|
-
if (document.documentElement && document.documentElement.dataset && !document.documentElement.dataset
|
|
263
|
+
if (document.documentElement && document.documentElement.dataset && !document.documentElement.dataset['emberExtension']) {
|
|
264
264
|
let downloadURL;
|
|
265
265
|
|
|
266
266
|
if (isChrome) {
|