ember-source 4.0.0-beta.1 → 4.0.0-beta.10
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 +72 -0
- package/blueprints/acceptance-test/qunit-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/qunit-files/__root__/__testType__/__path__/__test__.js +3 -3
- package/blueprints/helper-test/index.js +4 -22
- package/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +1 -13
- package/blueprints/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +0 -13
- package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -12
- package/blueprints/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +2 -13
- package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -14
- package/blueprints/initializer/files/__root__/initializers/__name__.js +0 -1
- package/blueprints/instance-initializer/files/__root__/instance-initializers/__name__.js +0 -1
- package/build-metadata.json +3 -3
- package/dist/dependencies/@glimmer/manager.js +19 -98
- package/dist/dependencies/@glimmer/opcode-compiler.js +9 -146
- package/dist/dependencies/@glimmer/runtime.js +1 -55
- package/dist/dependencies/@glimmer/validator.js +19 -51
- package/dist/ember-template-compiler.js +383 -961
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +4 -513
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +3246 -8084
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/container/index.js +17 -183
- package/dist/packages/@ember/-internals/environment/index.js +0 -27
- package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +7 -0
- package/dist/packages/@ember/-internals/glimmer/index.js +4827 -6812
- package/dist/packages/@ember/-internals/metal/index.js +21 -45
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +8 -0
- package/dist/packages/@ember/-internals/routing/lib/services/routing.js +1 -1
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +1 -41
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +22 -91
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +2 -173
- package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -43
- package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +8 -15
- package/dist/packages/@ember/-internals/runtime/lib/system/core_object.js +4 -90
- package/dist/packages/@ember/-internals/utils/index.js +0 -3
- package/dist/packages/@ember/-internals/views/index.js +0 -2
- package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +4 -4
- package/dist/packages/@ember/-internals/views/lib/system/event_dispatcher.js +22 -72
- package/dist/packages/@ember/application/instance.js +1 -22
- package/dist/packages/@ember/application/lib/application.js +14 -32
- package/dist/packages/@ember/canary-features/index.js +0 -2
- package/dist/packages/@ember/component/index.js +1 -1
- package/dist/packages/@ember/deprecated-features/index.js +0 -4
- package/dist/packages/@ember/engine/index.js +2 -7
- package/dist/packages/@ember/engine/instance.js +0 -4
- package/dist/packages/@ember/object/lib/computed/computed_macros.js +0 -373
- package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +0 -351
- package/dist/packages/@ember/routing/index.js +1 -1
- package/dist/packages/ember/index.js +9 -62
- package/dist/packages/ember/version.js +1 -1
- package/dist/packages/ember-testing/index.js +0 -2
- package/dist/packages/ember-testing/lib/helpers.js +0 -12
- package/dist/packages/ember-testing/lib/setup_for_testing.js +0 -10
- package/docs/data.json +598 -1901
- package/lib/index.js +13 -51
- package/package.json +18 -18
- package/dist/packages/@ember/-internals/views/lib/mixins/text_support.js +0 -345
- package/dist/packages/@ember/-internals/views/lib/system/jquery.js +0 -26
- package/dist/packages/@ember/component/checkbox.js +0 -17
- package/dist/packages/@ember/component/text-area.js +0 -17
- package/dist/packages/@ember/component/text-field.js +0 -17
- package/dist/packages/@ember/routing/link-component.js +0 -17
- package/dist/packages/ember-testing/lib/events.js +0 -101
- package/dist/packages/ember-testing/lib/helpers/-is-form-control.js +0 -19
- package/dist/packages/ember-testing/lib/helpers/click.js +0 -32
- package/dist/packages/ember-testing/lib/helpers/fill_in.js +0 -47
- package/dist/packages/ember-testing/lib/helpers/find.js +0 -40
- package/dist/packages/ember-testing/lib/helpers/find_with_assert.js +0 -37
- package/dist/packages/ember-testing/lib/helpers/key_event.js +0 -37
- package/dist/packages/ember-testing/lib/helpers/trigger_event.js +0 -61
- package/dist/packages/ember-testing/lib/support.js +0 -57
- package/dist/packages/jquery/index.js +0 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { meta, peekMeta } from '@ember/-internals/meta';
|
|
2
|
-
import { setListeners, isObject, setupMandatorySetter, symbol, toString, enumerableSymbol,
|
|
2
|
+
import { setListeners, isObject, setupMandatorySetter, symbol, toString, enumerableSymbol, 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';
|
|
6
6
|
import { registerDestructor, isDestroyed } from '@glimmer/destroyable';
|
|
7
|
-
import { CURRENT_TAG, tagMetaFor, validateTag, valueForTag, CONSTANT_TAG, dirtyTagFor, tagFor, combine, createUpdatableTag, updateTag, ALLOW_CYCLES, consumeTag, track, untrack,
|
|
7
|
+
import { CURRENT_TAG, tagMetaFor, validateTag, valueForTag, CONSTANT_TAG, dirtyTagFor, tagFor, combine, createUpdatableTag, updateTag, ALLOW_CYCLES, consumeTag, track, untrack, isTracking, trackedData } from '@glimmer/validator';
|
|
8
8
|
export { createCache, getValue, isConst } from '@glimmer/validator';
|
|
9
9
|
import { DEBUG } from '@glimmer/env';
|
|
10
10
|
import { getCustomTagFor } from '@glimmer/manager';
|
|
@@ -651,43 +651,29 @@ function replaceInNativeArray(array, start, deleteCount, items) {
|
|
|
651
651
|
arrayContentDidChange(array, start, deleteCount, items.length);
|
|
652
652
|
}
|
|
653
653
|
|
|
654
|
-
function arrayObserversHelper(obj, target, opts, operation
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
let
|
|
654
|
+
function arrayObserversHelper(obj, target, opts, operation) {
|
|
655
|
+
var _a;
|
|
656
|
+
|
|
657
|
+
let {
|
|
658
|
+
willChange,
|
|
659
|
+
didChange
|
|
660
|
+
} = opts;
|
|
658
661
|
operation(obj, '@array:before', target, willChange);
|
|
659
662
|
operation(obj, '@array:change', target, didChange);
|
|
663
|
+
/*
|
|
664
|
+
* Array proxies have a `_revalidate` method which must be called to set
|
|
665
|
+
* up their internal array observation systems.
|
|
666
|
+
*/
|
|
660
667
|
|
|
661
|
-
|
|
662
|
-
notifyPropertyChange(obj, 'hasArrayObservers');
|
|
663
|
-
}
|
|
664
|
-
|
|
668
|
+
(_a = obj._revalidate) === null || _a === void 0 ? void 0 : _a.call(obj);
|
|
665
669
|
return obj;
|
|
666
670
|
}
|
|
667
671
|
|
|
668
|
-
function addArrayObserver(array, target, opts
|
|
669
|
-
|
|
670
|
-
id: 'array-observers',
|
|
671
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_array-observers',
|
|
672
|
-
until: '4.0.0',
|
|
673
|
-
for: 'ember-source',
|
|
674
|
-
since: {
|
|
675
|
-
enabled: '3.26.0-beta.1'
|
|
676
|
-
}
|
|
677
|
-
});
|
|
678
|
-
return arrayObserversHelper(array, target, opts, addListener, false);
|
|
672
|
+
function addArrayObserver(array, target, opts) {
|
|
673
|
+
return arrayObserversHelper(array, target, opts, addListener);
|
|
679
674
|
}
|
|
680
|
-
function removeArrayObserver(array, target, opts
|
|
681
|
-
|
|
682
|
-
id: 'array-observers',
|
|
683
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_array-observers',
|
|
684
|
-
until: '4.0.0',
|
|
685
|
-
for: 'ember-source',
|
|
686
|
-
since: {
|
|
687
|
-
enabled: '3.26.0-beta.1'
|
|
688
|
-
}
|
|
689
|
-
});
|
|
690
|
-
return arrayObserversHelper(array, target, opts, removeListener, true);
|
|
675
|
+
function removeArrayObserver(array, target, opts) {
|
|
676
|
+
return arrayObserversHelper(array, target, opts, removeListener);
|
|
691
677
|
}
|
|
692
678
|
|
|
693
679
|
const CHAIN_PASS_THROUGH = new _WeakSet();
|
|
@@ -1842,13 +1828,7 @@ function _getProp(obj, keyName) {
|
|
|
1842
1828
|
}
|
|
1843
1829
|
|
|
1844
1830
|
if (value === undefined && isObject$$1 && !(keyName in obj) && typeof obj.unknownProperty === 'function') {
|
|
1845
|
-
|
|
1846
|
-
deprecateMutationsInTrackingTransaction(() => {
|
|
1847
|
-
value = obj.unknownProperty(keyName);
|
|
1848
|
-
});
|
|
1849
|
-
} else {
|
|
1850
|
-
value = obj.unknownProperty(keyName);
|
|
1851
|
-
}
|
|
1831
|
+
value = obj.unknownProperty(keyName);
|
|
1852
1832
|
}
|
|
1853
1833
|
|
|
1854
1834
|
if (isTracking()) {
|
|
@@ -3115,9 +3095,7 @@ class Mixin {
|
|
|
3115
3095
|
|
|
3116
3096
|
guidFor(this);
|
|
3117
3097
|
|
|
3118
|
-
if (true
|
|
3119
|
-
/* EMBER_MODERNIZED_BUILT_IN_COMPONENTS */
|
|
3120
|
-
&& Mixin._disableDebugSeal !== true) {
|
|
3098
|
+
if (Mixin._disableDebugSeal !== true) {
|
|
3121
3099
|
Object.seal(this);
|
|
3122
3100
|
}
|
|
3123
3101
|
}
|
|
@@ -3240,9 +3218,7 @@ class Mixin {
|
|
|
3240
3218
|
|
|
3241
3219
|
}
|
|
3242
3220
|
|
|
3243
|
-
if (DEBUG
|
|
3244
|
-
/* EMBER_MODERNIZED_BUILT_IN_COMPONENTS */
|
|
3245
|
-
) {
|
|
3221
|
+
if (DEBUG) {
|
|
3246
3222
|
Object.defineProperty(Mixin, '_disableDebugSeal', {
|
|
3247
3223
|
configurable: true,
|
|
3248
3224
|
enumerable: false,
|
|
@@ -223,6 +223,8 @@ export default class RouterService extends Service {
|
|
|
223
223
|
|
|
224
224
|
|
|
225
225
|
urlFor(routeName, ...args) {
|
|
226
|
+
this._router.setupRouter();
|
|
227
|
+
|
|
226
228
|
return this._router.generate(routeName, ...args);
|
|
227
229
|
}
|
|
228
230
|
/**
|
|
@@ -342,6 +344,9 @@ export default class RouterService extends Service {
|
|
|
342
344
|
|
|
343
345
|
recognize(url) {
|
|
344
346
|
assert(`You must pass a url that begins with the application's rootURL "${this.rootURL}"`, url.indexOf(this.rootURL) === 0);
|
|
347
|
+
|
|
348
|
+
this._router.setupRouter();
|
|
349
|
+
|
|
345
350
|
let internalURL = cleanURL(url, this.rootURL);
|
|
346
351
|
return this._router._routerMicrolib.recognize(internalURL);
|
|
347
352
|
}
|
|
@@ -359,6 +364,9 @@ export default class RouterService extends Service {
|
|
|
359
364
|
|
|
360
365
|
recognizeAndLoad(url) {
|
|
361
366
|
assert(`You must pass a url that begins with the application's rootURL "${this.rootURL}"`, url.indexOf(this.rootURL) === 0);
|
|
367
|
+
|
|
368
|
+
this._router.setupRouter();
|
|
369
|
+
|
|
362
370
|
let internalURL = cleanURL(url, this.rootURL);
|
|
363
371
|
return this._router._routerMicrolib.recognizeAndLoad(internalURL);
|
|
364
372
|
}
|
|
@@ -7,7 +7,7 @@ import { readOnly } from '@ember/object/computed';
|
|
|
7
7
|
import Service from '@ember/service';
|
|
8
8
|
const ROUTER = symbol('ROUTER');
|
|
9
9
|
/**
|
|
10
|
-
The Routing service is used by
|
|
10
|
+
The Routing service is used by LinkTo, and provides facilities for
|
|
11
11
|
the component/view layer to interact with the router.
|
|
12
12
|
|
|
13
13
|
This is a private service for internal usage only. For public usage,
|
|
@@ -11,8 +11,7 @@ import { addObserver, computed, defineProperty, descriptorForProperty, flushAsyn
|
|
|
11
11
|
import { getOwner } from '@ember/-internals/owner';
|
|
12
12
|
import { A as emberA, ActionHandler, Evented, Object as EmberObject, typeOf } from '@ember/-internals/runtime';
|
|
13
13
|
import { isProxy, lookupDescriptor, symbol } from '@ember/-internals/utils';
|
|
14
|
-
import { assert,
|
|
15
|
-
import { ROUTER_EVENTS } from '@ember/deprecated-features';
|
|
14
|
+
import { assert, info, isTesting } from '@ember/debug';
|
|
16
15
|
import { dependentKeyCompat } from '@ember/object/compat';
|
|
17
16
|
import { once } from '@ember/runloop';
|
|
18
17
|
import { classify } from '@ember/string';
|
|
@@ -1945,43 +1944,4 @@ Route.reopen({
|
|
|
1945
1944
|
|
|
1946
1945
|
}
|
|
1947
1946
|
});
|
|
1948
|
-
export let ROUTER_EVENT_DEPRECATIONS;
|
|
1949
|
-
|
|
1950
|
-
if (ROUTER_EVENTS) {
|
|
1951
|
-
ROUTER_EVENT_DEPRECATIONS = {
|
|
1952
|
-
on(name) {
|
|
1953
|
-
this._super(...arguments);
|
|
1954
|
-
|
|
1955
|
-
let hasDidTransition = name === 'didTransition';
|
|
1956
|
-
let hasWillTransition = name === 'willTransition';
|
|
1957
|
-
|
|
1958
|
-
if (hasDidTransition) {
|
|
1959
|
-
deprecate('You attempted to listen to the "didTransition" event which is deprecated. Please inject the router service and listen to the "routeDidChange" event.', false, {
|
|
1960
|
-
id: 'deprecate-router-events',
|
|
1961
|
-
until: '4.0.0',
|
|
1962
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_deprecate-router-events',
|
|
1963
|
-
for: 'ember-source',
|
|
1964
|
-
since: {
|
|
1965
|
-
enabled: '3.11.0'
|
|
1966
|
-
}
|
|
1967
|
-
});
|
|
1968
|
-
}
|
|
1969
|
-
|
|
1970
|
-
if (hasWillTransition) {
|
|
1971
|
-
deprecate('You attempted to listen to the "willTransition" event which is deprecated. Please inject the router service and listen to the "routeWillChange" event.', false, {
|
|
1972
|
-
id: 'deprecate-router-events',
|
|
1973
|
-
until: '4.0.0',
|
|
1974
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_deprecate-router-events',
|
|
1975
|
-
for: 'ember-source',
|
|
1976
|
-
since: {
|
|
1977
|
-
enabled: '3.11.0'
|
|
1978
|
-
}
|
|
1979
|
-
});
|
|
1980
|
-
}
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
};
|
|
1984
|
-
Route.reopen(ROUTER_EVENT_DEPRECATIONS);
|
|
1985
|
-
}
|
|
1986
|
-
|
|
1987
1947
|
export default Route;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { privatize as P } from '@ember/-internals/container';
|
|
2
|
-
import { computed, get,
|
|
2
|
+
import { computed, get, set } from '@ember/-internals/metal';
|
|
3
3
|
import { getOwner } from '@ember/-internals/owner';
|
|
4
4
|
import { A as emberA, Evented, Object as EmberObject, typeOf } from '@ember/-internals/runtime';
|
|
5
|
-
import { assert,
|
|
6
|
-
import { APP_CTRL_ROUTER_PROPS, ROUTER_EVENTS } from '@ember/deprecated-features';
|
|
5
|
+
import { assert, info } from '@ember/debug';
|
|
7
6
|
import EmberError from '@ember/error';
|
|
8
7
|
import { cancel, once, run, scheduleOnce } from '@ember/runloop';
|
|
9
8
|
import { DEBUG } from '@glimmer/env';
|
|
10
9
|
import EmberLocation from '../location/api';
|
|
11
10
|
import { calculateCacheKey, extractRouteArgs, getActiveTargetName, resemblesURL } from '../utils';
|
|
12
11
|
import DSL from './dsl';
|
|
13
|
-
import { defaultSerialize, getFullQueryParams, hasDefaultSerialize, ROUTE_CONNECTIONS
|
|
12
|
+
import { defaultSerialize, getFullQueryParams, hasDefaultSerialize, ROUTE_CONNECTIONS } from './route';
|
|
14
13
|
import RouterState from './router_state';
|
|
15
14
|
import Router, { logAbort, STATE_SYMBOL } from 'router_js';
|
|
16
15
|
|
|
@@ -20,10 +19,7 @@ function defaultDidTransition(infos) {
|
|
|
20
19
|
this._cancelSlowTransitionTimer();
|
|
21
20
|
|
|
22
21
|
this.notifyPropertyChange('url');
|
|
23
|
-
this.set('currentState', this.targetState);
|
|
24
|
-
// less surprising than didTransition being out of sync.
|
|
25
|
-
|
|
26
|
-
once(this, this.trigger, 'didTransition');
|
|
22
|
+
this.set('currentState', this.targetState);
|
|
27
23
|
|
|
28
24
|
if (DEBUG) {
|
|
29
25
|
// @ts-expect-error namespace isn't public
|
|
@@ -34,9 +30,7 @@ function defaultDidTransition(infos) {
|
|
|
34
30
|
}
|
|
35
31
|
}
|
|
36
32
|
|
|
37
|
-
function defaultWillTransition(oldInfos, newInfos
|
|
38
|
-
once(this, this.trigger, 'willTransition', transition);
|
|
39
|
-
|
|
33
|
+
function defaultWillTransition(oldInfos, newInfos) {
|
|
40
34
|
if (DEBUG) {
|
|
41
35
|
// @ts-expect-error namespace isn't public
|
|
42
36
|
if (this.namespace.LOG_TRANSITIONS) {
|
|
@@ -256,42 +250,18 @@ class EmberRouter extends EmberObject.extend(Evented) {
|
|
|
256
250
|
location.setURL(path);
|
|
257
251
|
set(router, 'currentURL', path);
|
|
258
252
|
});
|
|
259
|
-
}
|
|
253
|
+
} // TODO: merge into routeDidChange
|
|
260
254
|
|
|
261
|
-
didTransition(infos) {
|
|
262
|
-
if (ROUTER_EVENTS) {
|
|
263
|
-
if (router.didTransition !== defaultDidTransition) {
|
|
264
|
-
deprecate('You attempted to override the "didTransition" method which is deprecated. Please inject the router service and listen to the "routeDidChange" event.', false, {
|
|
265
|
-
id: 'deprecate-router-events',
|
|
266
|
-
until: '4.0.0',
|
|
267
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_deprecate-router-events',
|
|
268
|
-
for: 'ember-source',
|
|
269
|
-
since: {
|
|
270
|
-
enabled: '3.11.0'
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
255
|
|
|
256
|
+
didTransition(infos) {
|
|
257
|
+
assert('You attempted to override the "didTransition" method which has been deprecated. Please inject the router service and listen to the "routeDidChange" event.', router.didTransition === defaultDidTransition);
|
|
276
258
|
router.didTransition(infos);
|
|
277
|
-
}
|
|
259
|
+
} // TODO: merge into routeWillChange
|
|
278
260
|
|
|
279
|
-
willTransition(oldInfos, newInfos, transition) {
|
|
280
|
-
if (ROUTER_EVENTS) {
|
|
281
|
-
if (router.willTransition !== defaultWillTransition) {
|
|
282
|
-
deprecate('You attempted to override the "willTransition" method which is deprecated. Please inject the router service and listen to the "routeWillChange" event.', false, {
|
|
283
|
-
id: 'deprecate-router-events',
|
|
284
|
-
until: '4.0.0',
|
|
285
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_deprecate-router-events',
|
|
286
|
-
for: 'ember-source',
|
|
287
|
-
since: {
|
|
288
|
-
enabled: '3.11.0'
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
261
|
|
|
294
|
-
|
|
262
|
+
willTransition(oldInfos, newInfos) {
|
|
263
|
+
assert('You attempted to override the "willTransition" method which has been deprecated. Please inject the router service and listen to the "routeWillChange" event.', router.willTransition === defaultWillTransition);
|
|
264
|
+
router.willTransition(oldInfos, newInfos);
|
|
295
265
|
}
|
|
296
266
|
|
|
297
267
|
triggerEvent(routeInfos, ignoreFailure, name, args) {
|
|
@@ -534,7 +504,14 @@ class EmberRouter extends EmberObject.extend(Evented) {
|
|
|
534
504
|
if (!this._toplevelView) {
|
|
535
505
|
let owner = getOwner(this);
|
|
536
506
|
let OutletView = owner.factoryFor('view:-outlet');
|
|
537
|
-
|
|
507
|
+
let application = owner.lookup('application:main');
|
|
508
|
+
let environment = owner.lookup('-environment:main');
|
|
509
|
+
let template = owner.lookup('template:-outlet');
|
|
510
|
+
this._toplevelView = OutletView.create({
|
|
511
|
+
environment,
|
|
512
|
+
template,
|
|
513
|
+
application
|
|
514
|
+
});
|
|
538
515
|
|
|
539
516
|
this._toplevelView.setOutletState(liveRoutes);
|
|
540
517
|
|
|
@@ -1408,7 +1385,8 @@ export function triggerEvent(routeInfos, ignoreFailure, name, args) {
|
|
|
1408
1385
|
if (!routeInfos) {
|
|
1409
1386
|
if (ignoreFailure) {
|
|
1410
1387
|
return;
|
|
1411
|
-
}
|
|
1388
|
+
} // TODO: update?
|
|
1389
|
+
|
|
1412
1390
|
|
|
1413
1391
|
throw new EmberError(`Can't trigger action '${name}' because your app hasn't finished transitioning into its first route. To trigger an action on destination routes during a transition, you can call \`.send()\` on the \`Transition\` object passed to the \`model/beforeModel/afterModel\` hooks.`);
|
|
1414
1392
|
}
|
|
@@ -1492,48 +1470,6 @@ function updatePaths(router) {
|
|
|
1492
1470
|
// actually been entered at that point.
|
|
1493
1471
|
return;
|
|
1494
1472
|
}
|
|
1495
|
-
|
|
1496
|
-
if (APP_CTRL_ROUTER_PROPS) {
|
|
1497
|
-
if (!('currentPath' in appController)) {
|
|
1498
|
-
Object.defineProperty(appController, 'currentPath', {
|
|
1499
|
-
get() {
|
|
1500
|
-
deprecate('Accessing `currentPath` on `controller:application` is deprecated, use the `currentPath` property on `service:router` instead.', false, {
|
|
1501
|
-
id: 'application-controller.router-properties',
|
|
1502
|
-
until: '4.0.0',
|
|
1503
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_application-controller-router-properties',
|
|
1504
|
-
for: 'ember-source',
|
|
1505
|
-
since: {
|
|
1506
|
-
enabled: '3.10.0-beta.1'
|
|
1507
|
-
}
|
|
1508
|
-
});
|
|
1509
|
-
return get(router, 'currentPath');
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
});
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
notifyPropertyChange(appController, 'currentPath');
|
|
1516
|
-
|
|
1517
|
-
if (!('currentRouteName' in appController)) {
|
|
1518
|
-
Object.defineProperty(appController, 'currentRouteName', {
|
|
1519
|
-
get() {
|
|
1520
|
-
deprecate('Accessing `currentRouteName` on `controller:application` is deprecated, use the `currentRouteName` property on `service:router` instead.', false, {
|
|
1521
|
-
id: 'application-controller.router-properties',
|
|
1522
|
-
until: '4.0.0',
|
|
1523
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_application-controller-router-properties',
|
|
1524
|
-
for: 'ember-source',
|
|
1525
|
-
since: {
|
|
1526
|
-
enabled: '3.10.0-beta.1'
|
|
1527
|
-
}
|
|
1528
|
-
});
|
|
1529
|
-
return get(router, 'currentRouteName');
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
});
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
notifyPropertyChange(appController, 'currentRouteName');
|
|
1536
|
-
}
|
|
1537
1473
|
}
|
|
1538
1474
|
|
|
1539
1475
|
function didBeginTransition(transition, router) {
|
|
@@ -1659,9 +1595,4 @@ EmberRouter.reopen({
|
|
|
1659
1595
|
return location.getURL();
|
|
1660
1596
|
})
|
|
1661
1597
|
});
|
|
1662
|
-
|
|
1663
|
-
if (ROUTER_EVENTS) {
|
|
1664
|
-
EmberRouter.reopen(ROUTER_EVENT_DEPRECATIONS);
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
1598
|
export default EmberRouter;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { DEBUG } from '@glimmer/env';
|
|
5
5
|
import { PROXY_CONTENT } from '@ember/-internals/metal';
|
|
6
6
|
import { setEmberArray } from '@ember/-internals/utils';
|
|
7
|
-
import { get, set, objectAt, replaceInNativeArray, replace, computed, Mixin,
|
|
7
|
+
import { get, set, objectAt, replaceInNativeArray, replace, computed, Mixin, beginPropertyChanges, endPropertyChanges } from '@ember/-internals/metal';
|
|
8
8
|
import { assert } from '@ember/debug';
|
|
9
9
|
import Enumerable from './enumerable';
|
|
10
10
|
import compare from '../compare';
|
|
@@ -441,177 +441,6 @@ const ArrayMixin = Mixin.create(Enumerable, {
|
|
|
441
441
|
return -1;
|
|
442
442
|
},
|
|
443
443
|
|
|
444
|
-
// ..........................................................
|
|
445
|
-
// ARRAY OBSERVERS
|
|
446
|
-
//
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
Adds an array observer to the receiving array. The array observer object
|
|
450
|
-
normally must implement two methods:
|
|
451
|
-
* `willChange(observedObj, start, removeCount, addCount)` - This method will be
|
|
452
|
-
called just before the array is modified.
|
|
453
|
-
* `didChange(observedObj, start, removeCount, addCount)` - This method will be
|
|
454
|
-
called just after the array is modified.
|
|
455
|
-
Both callbacks will be passed the observed object, starting index of the
|
|
456
|
-
change as well as a count of the items to be removed and added. You can use
|
|
457
|
-
these callbacks to optionally inspect the array during the change, clear
|
|
458
|
-
caches, or do any other bookkeeping necessary.
|
|
459
|
-
In addition to passing a target, you can also include an options hash
|
|
460
|
-
which you can use to override the method names that will be invoked on the
|
|
461
|
-
target.
|
|
462
|
-
@method addArrayObserver
|
|
463
|
-
@param {Object} target The observer object.
|
|
464
|
-
@param {Object} opts Optional hash of configuration options including
|
|
465
|
-
`willChange` and `didChange` option.
|
|
466
|
-
@return {EmberArray} receiver
|
|
467
|
-
@public
|
|
468
|
-
@example
|
|
469
|
-
import Service from '@ember/service';
|
|
470
|
-
export default Service.extend({
|
|
471
|
-
data: Ember.A(),
|
|
472
|
-
init() {
|
|
473
|
-
this._super(...arguments);
|
|
474
|
-
this.data.addArrayObserver(this, {
|
|
475
|
-
willChange: 'dataWillChange',
|
|
476
|
-
didChange: 'dataDidChange'
|
|
477
|
-
});
|
|
478
|
-
},
|
|
479
|
-
dataWillChange(array, start, removeCount, addCount) {
|
|
480
|
-
console.log('array will change', array, start, removeCount, addCount);
|
|
481
|
-
},
|
|
482
|
-
dataDidChange(array, start, removeCount, addCount) {
|
|
483
|
-
console.log('array did change', array, start, removeCount, addCount);
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
*/
|
|
487
|
-
addArrayObserver(target, opts) {
|
|
488
|
-
return addArrayObserver(this, target, opts);
|
|
489
|
-
},
|
|
490
|
-
|
|
491
|
-
/**
|
|
492
|
-
Removes an array observer from the object if the observer is current
|
|
493
|
-
registered. Calling this method multiple times with the same object will
|
|
494
|
-
have no effect.
|
|
495
|
-
@method removeArrayObserver
|
|
496
|
-
@param {Object} target The object observing the array.
|
|
497
|
-
@param {Object} opts Optional hash of configuration options including
|
|
498
|
-
`willChange` and `didChange` option.
|
|
499
|
-
@return {EmberArray} receiver
|
|
500
|
-
@public
|
|
501
|
-
*/
|
|
502
|
-
removeArrayObserver(target, opts) {
|
|
503
|
-
return removeArrayObserver(this, target, opts);
|
|
504
|
-
},
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
Becomes true whenever the array currently has observers watching changes
|
|
508
|
-
on the array.
|
|
509
|
-
```javascript
|
|
510
|
-
let arr = [1, 2, 3, 4, 5];
|
|
511
|
-
arr.hasArrayObservers; // false
|
|
512
|
-
arr.addArrayObserver(this, {
|
|
513
|
-
willChange() {
|
|
514
|
-
console.log('willChange');
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
arr.hasArrayObservers; // true
|
|
518
|
-
```
|
|
519
|
-
@property {Boolean} hasArrayObservers
|
|
520
|
-
@public
|
|
521
|
-
*/
|
|
522
|
-
hasArrayObservers: descriptor({
|
|
523
|
-
configurable: true,
|
|
524
|
-
enumerable: false,
|
|
525
|
-
|
|
526
|
-
get() {
|
|
527
|
-
return hasListeners(this, '@array:change') || hasListeners(this, '@array:before');
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
}),
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
If you are implementing an object that supports `EmberArray`, call this
|
|
534
|
-
method just before the array content changes to notify any observers and
|
|
535
|
-
invalidate any related properties. Pass the starting index of the change
|
|
536
|
-
as well as a delta of the amounts to change.
|
|
537
|
-
```app/components/show-post.js
|
|
538
|
-
import Component from '@ember/component';
|
|
539
|
-
import EmberObject from '@ember/object';
|
|
540
|
-
const Post = EmberObject.extend({
|
|
541
|
-
body: '',
|
|
542
|
-
save() {}
|
|
543
|
-
})
|
|
544
|
-
export default Component.extend({
|
|
545
|
-
attemptsToModify: 0,
|
|
546
|
-
successfulModifications: 0,
|
|
547
|
-
posts: null,
|
|
548
|
-
init() {
|
|
549
|
-
this._super(...arguments);
|
|
550
|
-
this.posts = [1, 2, 3].map(i => Post.create({ body: i }));
|
|
551
|
-
this.posts.addArrayObserver(this, {
|
|
552
|
-
willChange() {
|
|
553
|
-
this.incrementProperty('attemptsToModify');
|
|
554
|
-
},
|
|
555
|
-
didChange() {
|
|
556
|
-
this.incrementProperty('successfulModifications');
|
|
557
|
-
}
|
|
558
|
-
});
|
|
559
|
-
},
|
|
560
|
-
actions: {
|
|
561
|
-
editPost(post, newContent) {
|
|
562
|
-
let oldContent = post.body,
|
|
563
|
-
postIndex = this.posts.indexOf(post);
|
|
564
|
-
this.posts.arrayContentWillChange(postIndex, 0, 0); // attemptsToModify = 1
|
|
565
|
-
post.set('body', newContent);
|
|
566
|
-
post.save()
|
|
567
|
-
.then(response => {
|
|
568
|
-
this.posts.arrayContentDidChange(postIndex, 0, 0); // successfulModifications = 1
|
|
569
|
-
})
|
|
570
|
-
.catch(error => {
|
|
571
|
-
post.set('body', oldContent);
|
|
572
|
-
})
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
});
|
|
576
|
-
```
|
|
577
|
-
@method arrayContentWillChange
|
|
578
|
-
@param {Number} startIdx The starting index in the array that will change.
|
|
579
|
-
@param {Number} removeAmt The number of items that will be removed. If you
|
|
580
|
-
pass `null` assumes 0
|
|
581
|
-
@param {Number} addAmt The number of items that will be added. If you
|
|
582
|
-
pass `null` assumes 0.
|
|
583
|
-
@return {EmberArray} receiver
|
|
584
|
-
@public
|
|
585
|
-
*/
|
|
586
|
-
arrayContentWillChange(startIdx, removeAmt, addAmt) {
|
|
587
|
-
return arrayContentWillChange(this, startIdx, removeAmt, addAmt);
|
|
588
|
-
},
|
|
589
|
-
|
|
590
|
-
/**
|
|
591
|
-
If you are implementing an object that supports `EmberArray`, call this
|
|
592
|
-
method just after the array content changes to notify any observers and
|
|
593
|
-
invalidate any related properties. Pass the starting index of the change
|
|
594
|
-
as well as a delta of the amounts to change.
|
|
595
|
-
```javascript
|
|
596
|
-
let arr = [1, 2, 3, 4, 5];
|
|
597
|
-
arr.copyWithin(-2); // [1, 2, 3, 1, 2]
|
|
598
|
-
// arr.lastObject = 5
|
|
599
|
-
arr.arrayContentDidChange(3, 2, 2);
|
|
600
|
-
// arr.lastObject = 2
|
|
601
|
-
```
|
|
602
|
-
@method arrayContentDidChange
|
|
603
|
-
@param {Number} startIdx The starting index in the array that did change.
|
|
604
|
-
@param {Number} removeAmt The number of items that were removed. If you
|
|
605
|
-
pass `null` assumes 0
|
|
606
|
-
@param {Number} addAmt The number of items that were added. If you
|
|
607
|
-
pass `null` assumes 0.
|
|
608
|
-
@return {EmberArray} receiver
|
|
609
|
-
@public
|
|
610
|
-
*/
|
|
611
|
-
arrayContentDidChange(startIdx, removeAmt, addAmt) {
|
|
612
|
-
return arrayContentDidChange(this, startIdx, removeAmt, addAmt);
|
|
613
|
-
},
|
|
614
|
-
|
|
615
444
|
/**
|
|
616
445
|
Iterates through the array, calling the passed function on each
|
|
617
446
|
item. This method corresponds to the `forEach()` method defined in
|
|
@@ -1339,7 +1168,7 @@ const MutableArray = Mixin.create(ArrayMixin, MutableEnumerable, {
|
|
|
1339
1168
|
__Required.__ You must implement this method to apply this mixin.
|
|
1340
1169
|
This is one of the primitives you must implement to support `Array`.
|
|
1341
1170
|
You should replace amt objects started at idx with the objects in the
|
|
1342
|
-
passed array.
|
|
1171
|
+
passed array.
|
|
1343
1172
|
Note that this method is expected to validate the type(s) of objects that it expects.
|
|
1344
1173
|
@method replace
|
|
1345
1174
|
@param {Number} idx Starting index in the array to replace. If
|
|
@@ -3,14 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { context } from '@ember/-internals/environment';
|
|
5
5
|
import { get, Mixin, computed } from '@ember/-internals/metal';
|
|
6
|
-
import { assert
|
|
6
|
+
import { assert } from '@ember/debug';
|
|
7
7
|
import { DEBUG } from '@glimmer/env';
|
|
8
|
-
|
|
9
|
-
if (DEBUG && true
|
|
10
|
-
/* EMBER_MODERNIZED_BUILT_IN_COMPONENTS */
|
|
11
|
-
) {
|
|
12
|
-
Mixin._disableDebugSeal = true;
|
|
13
|
-
}
|
|
14
8
|
/**
|
|
15
9
|
`Ember.TargetActionSupport` is a mixin that can be included in a class
|
|
16
10
|
to add a `triggerAction` method with semantics similar to the Handlebars
|
|
@@ -24,7 +18,6 @@ doing more complex event handling in Components.
|
|
|
24
18
|
@private
|
|
25
19
|
*/
|
|
26
20
|
|
|
27
|
-
|
|
28
21
|
const TargetActionSupport = Mixin.create({
|
|
29
22
|
target: null,
|
|
30
23
|
action: null,
|
|
@@ -151,41 +144,8 @@ function getTarget(instance) {
|
|
|
151
144
|
return null;
|
|
152
145
|
}
|
|
153
146
|
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
) {
|
|
157
|
-
Object.defineProperty(TargetActionSupport, '_wasReopened', {
|
|
158
|
-
configurable: true,
|
|
159
|
-
enumerable: false,
|
|
160
|
-
writable: true,
|
|
161
|
-
value: false
|
|
162
|
-
});
|
|
163
|
-
Object.defineProperty(TargetActionSupport, 'reopen', {
|
|
164
|
-
configurable: true,
|
|
165
|
-
enumerable: false,
|
|
166
|
-
writable: true,
|
|
167
|
-
value: function reopen(...args) {
|
|
168
|
-
if (this === TargetActionSupport) {
|
|
169
|
-
deprecate('Reopening Ember.TargetActionSupport is deprecated.', false, {
|
|
170
|
-
id: 'ember.built-in-components.reopen',
|
|
171
|
-
for: 'ember-source',
|
|
172
|
-
since: {
|
|
173
|
-
enabled: '3.27.0'
|
|
174
|
-
},
|
|
175
|
-
until: '4.0.0',
|
|
176
|
-
url: 'https://deprecations.emberjs.com/v3.x#toc_ember-built-in-components-reopen'
|
|
177
|
-
});
|
|
178
|
-
TargetActionSupport._wasReopened = true;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return Mixin.prototype.reopen.call(this, ...args);
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
if (DEBUG) {
|
|
186
|
-
Object.seal(TargetActionSupport);
|
|
187
|
-
Mixin._disableDebugSeal = false;
|
|
188
|
-
}
|
|
147
|
+
if (DEBUG) {
|
|
148
|
+
Object.seal(TargetActionSupport);
|
|
189
149
|
}
|
|
190
150
|
|
|
191
151
|
export default TargetActionSupport;
|