ember-source 4.1.0-alpha.3 → 4.1.0-alpha.7

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/blueprints/acceptance-test/qunit-files/tests/acceptance/__name__-test.js +1 -1
  3. package/blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/__name__-test.js +1 -1
  4. package/blueprints/component-test/qunit-files/__root__/__testType__/__path__/__test__.js +3 -3
  5. package/blueprints/helper-test/index.js +4 -22
  6. package/blueprints/helper-test/mocha-0.12-files/__root__/__testType__/__collection__/__name__-test.js +1 -13
  7. package/blueprints/helper-test/mocha-files/__root__/__testType__/__collection__/__name__-test.js +0 -13
  8. package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -12
  9. package/blueprints/helper-test/qunit-files/__root__/__testType__/__collection__/__name__-test.js +2 -13
  10. package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/__name__-test.js +2 -14
  11. package/build-metadata.json +3 -3
  12. package/dist/dependencies/@glimmer/manager.js +19 -98
  13. package/dist/dependencies/@glimmer/opcode-compiler.js +9 -146
  14. package/dist/dependencies/@glimmer/validator.js +19 -51
  15. package/dist/ember-template-compiler.js +379 -696
  16. package/dist/ember-template-compiler.map +1 -1
  17. package/dist/ember-testing.js +3 -1
  18. package/dist/ember-testing.map +1 -1
  19. package/dist/ember.debug.js +3069 -5913
  20. package/dist/ember.debug.map +1 -1
  21. package/dist/header/license.js +1 -1
  22. package/dist/header/loader.js +1 -0
  23. package/dist/packages/@ember/-internals/container/index.js +1 -1
  24. package/dist/packages/@ember/-internals/environment/index.js +0 -15
  25. package/dist/packages/@ember/-internals/glimmer/index.js +4825 -6770
  26. package/dist/packages/@ember/-internals/metal/index.js +41 -73
  27. package/dist/packages/@ember/-internals/routing/lib/ext/controller.js +1 -0
  28. package/dist/packages/@ember/-internals/routing/lib/location/api.js +10 -1
  29. package/dist/packages/@ember/-internals/routing/lib/location/none_location.js +7 -2
  30. package/dist/packages/@ember/-internals/routing/lib/services/router.js +8 -8
  31. package/dist/packages/@ember/-internals/routing/lib/services/routing.js +1 -1
  32. package/dist/packages/@ember/-internals/routing/lib/system/route.js +3 -42
  33. package/dist/packages/@ember/-internals/routing/lib/system/router.js +36 -46
  34. package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -43
  35. package/dist/packages/@ember/-internals/utils/index.js +0 -3
  36. package/dist/packages/@ember/-internals/views/index.js +0 -1
  37. package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +4 -4
  38. package/dist/packages/@ember/application/lib/application.js +8 -9
  39. package/dist/packages/@ember/canary-features/index.js +1 -3
  40. package/dist/packages/@ember/component/index.js +1 -1
  41. package/dist/packages/@ember/deprecated-features/index.js +0 -1
  42. package/dist/packages/@ember/engine/index.js +1 -2
  43. package/dist/packages/@ember/routing/index.js +1 -1
  44. package/dist/packages/@ember/service/index.js +19 -5
  45. package/dist/packages/@glimmer/tracking/index.js +203 -1
  46. package/dist/packages/ember/index.js +11 -63
  47. package/dist/packages/ember/version.js +1 -1
  48. package/docs/data.json +355 -1147
  49. package/lib/index.js +11 -48
  50. package/package.json +20 -21
  51. package/dist/packages/@ember/-internals/views/lib/mixins/text_support.js +0 -345
  52. package/dist/packages/@ember/component/checkbox.js +0 -17
  53. package/dist/packages/@ember/component/text-area.js +0 -17
  54. package/dist/packages/@ember/component/text-field.js +0 -17
  55. package/dist/packages/@ember/routing/link-component.js +0 -17
  56. package/dist/packages/jquery/index.js +0 -2
@@ -4,7 +4,7 @@ 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, deprecateMutationsInTrackingTransaction, isTracking, trackedData } from '@glimmer/validator';
7
+ import { CURRENT_TAG, tagMetaFor, validateTag, valueForTag, CONSTANT_TAG, dirtyTagFor, tagFor, combine, createUpdatableTag, updateTag, ALLOW_CYCLES, consumeTag, track, untrack, isTracking, trackedData, createCache, getValue } 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';
@@ -1842,13 +1842,7 @@ function _getProp(obj, keyName) {
1842
1842
  }
1843
1843
 
1844
1844
  if (value === undefined && isObject$$1 && !(keyName in obj) && typeof obj.unknownProperty === 'function') {
1845
- if (DEBUG) {
1846
- deprecateMutationsInTrackingTransaction(() => {
1847
- value = obj.unknownProperty(keyName);
1848
- });
1849
- } else {
1850
- value = obj.unknownProperty(keyName);
1851
- }
1845
+ value = obj.unknownProperty(keyName);
1852
1846
  }
1853
1847
 
1854
1848
  if (isTracking()) {
@@ -2241,7 +2235,7 @@ function isEmpty(obj) {
2241
2235
  return none;
2242
2236
  }
2243
2237
 
2244
- if (typeof obj.size === 'number') {
2238
+ if (typeof obj.unknownProperty !== 'function' && typeof obj.size === 'number') {
2245
2239
  return !obj.size;
2246
2240
  }
2247
2241
 
@@ -3115,9 +3109,7 @@ class Mixin {
3115
3109
 
3116
3110
  guidFor(this);
3117
3111
 
3118
- if (true
3119
- /* EMBER_MODERNIZED_BUILT_IN_COMPONENTS */
3120
- && Mixin._disableDebugSeal !== true) {
3112
+ if (Mixin._disableDebugSeal !== true) {
3121
3113
  Object.seal(this);
3122
3114
  }
3123
3115
  }
@@ -3240,9 +3232,7 @@ class Mixin {
3240
3232
 
3241
3233
  }
3242
3234
 
3243
- if (DEBUG && true
3244
- /* EMBER_MODERNIZED_BUILT_IN_COMPONENTS */
3245
- ) {
3235
+ if (DEBUG) {
3246
3236
  Object.defineProperty(Mixin, '_disableDebugSeal', {
3247
3237
  configurable: true,
3248
3238
  enumerable: false,
@@ -3479,68 +3469,46 @@ class TrackedDescriptor {
3479
3469
  }
3480
3470
 
3481
3471
  // NOTE: copied from: https://github.com/glimmerjs/glimmer.js/pull/358
3482
- /**
3483
- * @decorator
3484
- *
3485
- * The `@cached` decorator can be used on getters in order to cache the return
3486
- * value of the getter. This is useful when a getter is expensive and used very
3487
- * often.
3488
- *
3489
- *
3490
- * @example
3491
- *
3492
- * in this guest list class, we have the `sortedGuests`
3493
- * getter that sorts the guests alphabetically:
3494
- *
3495
- * ```js
3496
- * import { tracked } from '@glimmer/tracking';
3497
- *
3498
- * class GuestList {
3499
- * @tracked guests = ['Zoey', 'Tomster'];
3500
- *
3501
- * get sortedGuests() {
3502
- * return this.guests.slice().sort()
3503
- * }
3504
- * }
3505
- * ```
3506
- *
3507
- * Every time `sortedGuests` is accessed, a new array will be created and sorted,
3508
- * because JavaScript getters do not cache by default. When the guest list is
3509
- * small, like the one in the example, this is not a problem. However, if the guest
3510
- * list were to grow very large, it would mean that we would be doing a large
3511
- * amount of work each time we accessed `sortedGetters`. With `@cached`, we can
3512
- * cache the value instead:
3513
- *
3514
- * ```js
3515
- * import { tracked, cached } from '@glimmer/tracking';
3516
- *
3517
- * class GuestList {
3518
- * @tracked guests = ['Zoey', 'Tomster'];
3519
- *
3520
- * @cached
3521
- * get sortedGuests() {
3522
- * return this.guests.slice().sort()
3523
- * }
3524
- * }
3525
- * ```
3526
- *
3527
- * Now the `sortedGuests` getter will be cached based on _autotracking_. It will
3528
- * only rerun and create a new sorted array when the `guests` tracked property is
3529
- * updated.
3530
- *
3531
- * In general, you should avoid using `@cached` unless you have confirmed that the
3532
- * getter you are decorating is computationally expensive. `@cached` adds a small
3533
- * amount of overhead to the getter, making it more expensive. While this overhead
3534
- * is small, if `@cached` is overused it can add up to a large impact overall in
3535
- * your app. Many getters and tracked properties are only accessed once, rendered,
3536
- * and then never rerendered, so adding `@cached` when it is unnecessary can
3537
- * negatively impact performance.
3538
- */
3539
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3540
3472
 
3541
3473
  const cached = (...args) => {
3474
+ {
3475
+ const [target, key, descriptor] = args; // Error on `@cached()`, `@cached(...args)`, and `@cached propName = value;`
3476
+
3477
+ if (DEBUG && target === undefined) throwCachedExtraneousParens();
3478
+
3479
+ if (DEBUG && (typeof target !== 'object' || typeof key !== 'string' || typeof descriptor !== 'object' || args.length !== 3)) {
3480
+ throwCachedInvalidArgsError(args);
3481
+ }
3482
+
3483
+ if (DEBUG && (!('get' in descriptor) || typeof descriptor.get !== 'function')) {
3484
+ throwCachedGetterOnlyError(key);
3485
+ }
3486
+
3487
+ const caches = new WeakMap();
3488
+ const getter = descriptor.get;
3489
+
3490
+ descriptor.get = function () {
3491
+ if (!caches.has(this)) {
3492
+ caches.set(this, createCache(getter.bind(this)));
3493
+ }
3494
+
3495
+ return getValue(caches.get(this));
3496
+ };
3497
+ }
3542
3498
  };
3543
3499
 
3500
+ function throwCachedExtraneousParens() {
3501
+ throw new Error('You attempted to use @cached(), which is not necessary nor supported. Remove the parentheses and you will be good to go!');
3502
+ }
3503
+
3504
+ function throwCachedGetterOnlyError(key) {
3505
+ throw new Error(`The @cached decorator must be applied to getters. '${key}' is not a getter.`);
3506
+ }
3507
+
3508
+ function throwCachedInvalidArgsError(args = []) {
3509
+ throw new Error(`You attempted to use @cached on with ${args.length > 1 ? 'arguments' : 'an argument'} ( @cached(${args.map(d => `'${d}'`).join(', ')}), which is not supported. Dependencies are automatically tracked, so you can just use ${'`@cached`'}`);
3510
+ }
3511
+
3544
3512
  /**
3545
3513
  Ember uses caching based on trackable values to avoid updating large portions
3546
3514
  of the application. This caching is exposed via a cache primitive that can be
@@ -197,6 +197,7 @@ ControllerMixin.reopen({
197
197
  @method replaceRoute
198
198
  @return {Transition} the transition object associated with this
199
199
  attempted transition
200
+ @deprecated Use replaceWith from the Router service instead.
200
201
  @public
201
202
  */
202
203
  replaceRoute(...args) {
@@ -1,4 +1,4 @@
1
- import { assert } from '@ember/debug';
1
+ import { assert, deprecate } from '@ember/debug';
2
2
  /**
3
3
  @module @ember/routing
4
4
  */
@@ -87,6 +87,15 @@ export default {
87
87
  assert("Location.create: you must specify a 'implementation' option", Boolean(implementation));
88
88
  let implementationClass = this.implementations[implementation];
89
89
  assert(`Location.create: ${implementation} is not a valid implementation`, Boolean(implementationClass));
90
+ deprecate("Calling `create` on Location class is deprecated. Instead, use `container.lookup('location:my-location')` to lookup the location you need.", false, {
91
+ id: 'deprecate-auto-location',
92
+ until: '5.0.0',
93
+ url: 'https://emberjs.com/deprecations/v3.x#toc_deprecate-auto-location',
94
+ for: 'ember-source',
95
+ since: {
96
+ enabled: '4.1.0'
97
+ }
98
+ });
90
99
  return implementationClass.create(...arguments);
91
100
  },
92
101
 
@@ -26,10 +26,15 @@ export default class NoneLocation extends EmberObject {
26
26
  this.implementation = 'none';
27
27
  }
28
28
 
29
- detect() {
29
+ initState() {
30
+ this._super(...arguments);
31
+
30
32
  let {
31
33
  rootURL
32
- } = this;
34
+ } = this; // This assert doesn't have anything to do with state initialization,
35
+ // but we're hijacking this method since it's called after the route has
36
+ // set the rootURL property on its Location instance.
37
+
33
38
  assert('rootURL must end with a trailing forward slash e.g. "/app/"', rootURL.charAt(rootURL.length - 1) === '/');
34
39
  }
35
40
  /**
@@ -28,7 +28,7 @@ function cleanURL(url, rootURL) {
28
28
  ```app/components/example.js
29
29
  import Component from '@glimmer/component';
30
30
  import { action } from '@ember/object';
31
- import { inject as service } from '@ember/service';
31
+ import { service } from '@ember/service';
32
32
 
33
33
  export default class ExampleComponent extends Component {
34
34
  @service router;
@@ -78,7 +78,7 @@ export default class RouterService extends Service {
78
78
  ```app/components/example.js
79
79
  import Component from '@glimmer/component';
80
80
  import { action } from '@ember/object';
81
- import { inject as service } from '@ember/service';
81
+ import { service } from '@ember/service';
82
82
  export default class extends Component {
83
83
  @service router;
84
84
  @action
@@ -172,7 +172,7 @@ export default class RouterService extends Service {
172
172
  ```
173
173
  ```app/components/copy-link.js
174
174
  import Component from '@glimmer/component';
175
- import { inject as service } from '@ember/service';
175
+ import { service } from '@ember/service';
176
176
  import { action } from '@ember/object';
177
177
  export default class CopyLinkComponent extends Component {
178
178
  @service router;
@@ -194,7 +194,7 @@ export default class RouterService extends Service {
194
194
  ```
195
195
  ```app/components/copy-link.js
196
196
  import Component from '@glimmer/component';
197
- import { inject as service } from '@ember/service';
197
+ import { service } from '@ember/service';
198
198
  import { action } from '@ember/object';
199
199
  export default class CopyLinkComponent extends Component {
200
200
  @service router;
@@ -234,7 +234,7 @@ export default class RouterService extends Service {
234
234
  In the following example, `isActive` will return `true` if the current route is `/posts`.
235
235
  ```app/components/posts.js
236
236
  import Component from '@glimmer/component';
237
- import { inject as service } from '@ember/service';
237
+ import { service } from '@ember/service';
238
238
  export default class extends Component {
239
239
  @service router;
240
240
  displayComments() {
@@ -246,7 +246,7 @@ export default class RouterService extends Service {
246
246
  assuming the post has an id of 1:
247
247
  ```app/components/posts.js
248
248
  import Component from '@glimmer/component';
249
- import { inject as service } from '@ember/service';
249
+ import { service } from '@ember/service';
250
250
  export default class extends Component {
251
251
  @service router;
252
252
  displayComments(post) {
@@ -325,7 +325,7 @@ export default class RouterService extends Service {
325
325
  application before transitioning to it.
326
326
  ```
327
327
  import Component from '@ember/component';
328
- import { inject as service } from '@ember/service';
328
+ import { service } from '@ember/service';
329
329
  export default class extends Component {
330
330
  @service router;
331
331
  path = '/';
@@ -520,7 +520,7 @@ RouterService.reopen(Evented, {
520
520
  Usage example:
521
521
  ```app/components/header.js
522
522
  import Component from '@glimmer/component';
523
- import { inject as service } from '@ember/service';
523
+ import { service } from '@ember/service';
524
524
  import { notEmpty } from '@ember/object/computed';
525
525
  export default class extends Component {
526
526
  @service router;
@@ -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 LinkComponent, and provides facilities for
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, deprecate, info, isTesting } from '@ember/debug';
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';
@@ -750,6 +749,7 @@ class Route extends EmberObject.extend(ActionHandler, Evented) {
750
749
  @return {Transition} the transition object associated with this
751
750
  attempted transition
752
751
  @since 1.0.0
752
+ @deprecated Use replaceWith from the Router service instead.
753
753
  @public
754
754
  */
755
755
 
@@ -1286,7 +1286,7 @@ class Route extends EmberObject.extend(ActionHandler, Evented) {
1286
1286
  ```
1287
1287
  ```app/routes/application.js
1288
1288
  import Route from '@ember/routing/route';
1289
- import { inject as service } from '@ember/service';
1289
+ import { service } from '@ember/service';
1290
1290
  export default class ApplicationRoute extends Route {
1291
1291
  @service router
1292
1292
  constructor() {
@@ -1945,43 +1945,4 @@ Route.reopen({
1945
1945
 
1946
1946
  }
1947
1947
  });
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
1948
  export default Route;
@@ -3,14 +3,13 @@ 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
5
  import { assert, deprecate, info } from '@ember/debug';
6
- import { ROUTER_EVENTS } from '@ember/deprecated-features';
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, ROUTER_EVENT_DEPRECATIONS } from './route';
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); // Put this in the runloop so url will be accurate. Seems
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, transition) {
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
- router.willTransition(oldInfos, newInfos, transition);
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) {
@@ -752,6 +722,18 @@ class EmberRouter extends EmberObject.extend(Evented) {
752
722
  if ('string' === typeof location) {
753
723
  let resolvedLocation = owner.lookup(`location:${location}`);
754
724
 
725
+ if (location === 'auto') {
726
+ deprecate("Router location 'auto' is deprecated. Most users will want to set `locationType` to 'history' in config/environment.js for no change in behavior. See deprecation docs for details.", false, {
727
+ id: 'deprecate-auto-location',
728
+ until: '5.0.0',
729
+ url: 'https://emberjs.com/deprecations/v3.x#toc_deprecate-auto-location',
730
+ for: 'ember-source',
731
+ since: {
732
+ enabled: '4.1.0'
733
+ }
734
+ });
735
+ }
736
+
755
737
  if (resolvedLocation !== undefined) {
756
738
  location = set(this, 'location', resolvedLocation);
757
739
  } else {
@@ -772,6 +754,18 @@ class EmberRouter extends EmberObject.extend(Evented) {
772
754
 
773
755
 
774
756
  if (typeof location.detect === 'function') {
757
+ if (this.location !== 'auto') {
758
+ deprecate('The `detect` method on the Location object is deprecated. If you need detection you can run your detection code in app.js, before setting the location type.', false, {
759
+ id: 'deprecate-auto-location',
760
+ until: '5.0.0',
761
+ url: 'https://emberjs.com/deprecations/v3.x#toc_deprecate-auto-location',
762
+ for: 'ember-source',
763
+ since: {
764
+ enabled: '4.1.0'
765
+ }
766
+ });
767
+ }
768
+
775
769
  location.detect();
776
770
  } // ensure that initState is called AFTER the rootURL is set on
777
771
  // the location instance
@@ -1415,7 +1409,8 @@ export function triggerEvent(routeInfos, ignoreFailure, name, args) {
1415
1409
  if (!routeInfos) {
1416
1410
  if (ignoreFailure) {
1417
1411
  return;
1418
- }
1412
+ } // TODO: update?
1413
+
1419
1414
 
1420
1415
  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.`);
1421
1416
  }
@@ -1624,9 +1619,4 @@ EmberRouter.reopen({
1624
1619
  return location.getURL();
1625
1620
  })
1626
1621
  });
1627
-
1628
- if (ROUTER_EVENTS) {
1629
- EmberRouter.reopen(ROUTER_EVENT_DEPRECATIONS);
1630
- }
1631
-
1632
1622
  export default EmberRouter;
@@ -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, deprecate } from '@ember/debug';
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 (true
155
- /* EMBER_MODERNIZED_BUILT_IN_COMPONENTS */
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;
@@ -74,9 +74,6 @@ function isObject(value) {
74
74
  */
75
75
 
76
76
  /**
77
- Previously we used `Ember.$.uuid`, however `$.uuid` has been removed from
78
- jQuery master. We'll just bootstrap our own uuid now.
79
-
80
77
  @private
81
78
  @return {Number} the uuid
82
79
  */
@@ -1,7 +1,6 @@
1
1
  export { addChildView, isSimpleClick, getViewBounds, getViewClientRects, getViewBoundingClientRect, getRootViews, getChildViews, getViewId, getElementView, getViewElement, setElementView, setViewElement, clearElementView, clearViewElement, constructStyleDeprecationMessage } from './lib/system/utils';
2
2
  export { default as EventDispatcher } from './lib/system/event_dispatcher';
3
3
  export { default as ComponentLookup } from './lib/component_lookup';
4
- export { default as TextSupport } from './lib/mixins/text_support';
5
4
  export { default as CoreView } from './lib/views/core_view';
6
5
  export { default as ClassNamesSupport } from './lib/mixins/class_names_support';
7
6
  export { default as ChildViewsSupport } from './lib/mixins/child_views_support';
@@ -146,7 +146,7 @@ let mixin = {
146
146
  the target element you are providing is associated with an `Application`
147
147
  and does not have an ancestor element that is associated with an Ember view.
148
148
  @method appendTo
149
- @param {String|DOMElement|jQuery} A selector, element, HTML string, or jQuery object
149
+ @param {String|DOMElement} A selector, element, HTML string
150
150
  @return {Ember.View} receiver
151
151
  @private
152
152
  */
@@ -172,8 +172,8 @@ let mixin = {
172
172
  })());
173
173
  } else {
174
174
  target = selector;
175
- assert(`You tried to append to a selector string (${selector}) in an environment without jQuery`, typeof target !== 'string');
176
- assert(`You tried to append to a non-Element (${selector}) in an environment without jQuery`, typeof selector.appendChild === 'function');
175
+ assert(`You tried to append to a selector string (${selector}) in an environment without a DOM`, typeof target !== 'string');
176
+ assert(`You tried to append to a non-Element (${selector}) in an environment without a DOM`, typeof selector.appendChild === 'function');
177
177
  }
178
178
 
179
179
  this.renderer.appendTo(this, target);
@@ -303,7 +303,7 @@ let mixin = {
303
303
  Component properties that depend on the presence of an outer element, such
304
304
  as `classNameBindings` and `attributeBindings`, do not work with tagless
305
305
  components. Tagless components cannot implement methods to handle events,
306
- and have no associated jQuery object to return with `$()`.
306
+ and their `element` property has a `null` value.
307
307
  @property tagName
308
308
  @type String
309
309
  @default null
@@ -110,7 +110,7 @@ import { RouterService } from '@ember/-internals/routing';
110
110
  });
111
111
  ```
112
112
 
113
- The `rootElement` can be either a DOM element or a jQuery-compatible selector
113
+ The `rootElement` can be either a DOM element or a CSS selector
114
114
  string. Note that *views appended to the DOM outside the root element will
115
115
  not receive events.* If you specify a custom root element, make sure you only
116
116
  append views inside it!
@@ -174,8 +174,7 @@ import { RouterService } from '@ember/-internals/routing';
174
174
  const Application = Engine.extend({
175
175
  /**
176
176
  The root DOM element of the Application. This can be specified as an
177
- element or a
178
- [jQuery-compatible selector string](http://api.jquery.com/category/selectors/).
177
+ element or a [selector string](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors#reference_table_of_selectors).
179
178
  This is the element that will be passed to the Application's,
180
179
  `eventDispatcher`, which sets up the listeners for event delegation. Every
181
180
  view in your application should be a child of the element you specify here.
@@ -481,10 +480,10 @@ const Application = Engine.extend({
481
480
  import Application from '@ember/application';
482
481
  let App = Application.create();
483
482
  App.deferReadiness();
484
- // $ is a reference to the jQuery object/function
485
- import $ from 'jquery;
486
- $.getJSON('/auth-token', function(token) {
487
- App.token = token;
483
+ fetch('/auth-token')
484
+ .then(response => response.json())
485
+ .then(data => {
486
+ App.token = data.token;
488
487
  App.advanceReadiness();
489
488
  });
490
489
  ```
@@ -831,7 +830,7 @@ const Application = Engine.extend({
831
830
  in the non-browser environment, the stand-in `document` object only needs to
832
831
  implement a limited subset of the full DOM API. The `SimpleDOM` library is known
833
832
  to work.
834
- Since there is no access to jQuery in the non-browser environment, you must also
833
+ Since there is no DOM access in the non-browser environment, you must also
835
834
  specify a DOM `Element` object in the same `document` for the `rootElement` option
836
835
  (as opposed to a selector string like `"body"`).
837
836
  See the documentation on the `isBrowser`, `document` and `rootElement` properties
@@ -862,7 +861,7 @@ const Application = Engine.extend({
862
861
  ```
863
862
  ```app/routes/post.js
864
863
  import Route from '@ember/routing/route';
865
- import { inject as service } from '@ember/service';
864
+ import { service } from '@ember/service';
866
865
  // An example of how the (hypothetical) service is used in routes.
867
866
  export default class IndexRoute extends Route {
868
867
  @service network;