ember-source 3.28.5 → 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.
Files changed (115) hide show
  1. package/CHANGELOG.md +113 -10
  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/blueprints/initializer/files/__root__/initializers/__name__.js +0 -1
  12. package/blueprints/instance-initializer/files/__root__/instance-initializers/__name__.js +0 -1
  13. package/build-metadata.json +3 -3
  14. package/dist/dependencies/@glimmer/manager.js +19 -98
  15. package/dist/dependencies/@glimmer/opcode-compiler.js +9 -146
  16. package/dist/dependencies/@glimmer/runtime.js +1 -55
  17. package/dist/dependencies/@glimmer/validator.js +19 -51
  18. package/dist/ember-template-compiler.js +3692 -5667
  19. package/dist/ember-template-compiler.map +1 -1
  20. package/dist/ember-testing.js +12 -560
  21. package/dist/ember-testing.map +1 -1
  22. package/dist/ember.debug.js +4357 -12470
  23. package/dist/ember.debug.map +1 -1
  24. package/dist/header/license.js +1 -1
  25. package/dist/packages/@ember/-internals/bootstrap/index.js +2 -55
  26. package/dist/packages/@ember/-internals/container/index.js +35 -206
  27. package/dist/packages/@ember/-internals/environment/index.js +3 -46
  28. package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +7 -0
  29. package/dist/packages/@ember/-internals/extension-support/lib/data_adapter.js +1 -2
  30. package/dist/packages/@ember/-internals/glimmer/index.js +4774 -7035
  31. package/dist/packages/@ember/-internals/meta/lib/meta.js +2 -50
  32. package/dist/packages/@ember/-internals/metal/index.js +785 -1109
  33. package/dist/packages/@ember/-internals/overrides/index.js +1 -3
  34. package/dist/packages/@ember/-internals/owner/index.js +1 -19
  35. package/dist/packages/@ember/-internals/routing/lib/location/auto_location.js +1 -51
  36. package/dist/packages/@ember/-internals/routing/lib/location/hash_location.js +1 -0
  37. package/dist/packages/@ember/-internals/routing/lib/location/history_location.js +3 -1
  38. package/dist/packages/@ember/-internals/routing/lib/location/none_location.js +0 -7
  39. package/dist/packages/@ember/-internals/routing/lib/services/router.js +34 -2
  40. package/dist/packages/@ember/-internals/routing/lib/services/routing.js +2 -3
  41. package/dist/packages/@ember/-internals/routing/lib/system/dsl.js +5 -6
  42. package/dist/packages/@ember/-internals/routing/lib/system/route.js +192 -652
  43. package/dist/packages/@ember/-internals/routing/lib/system/router.js +119 -248
  44. package/dist/packages/@ember/-internals/routing/lib/system/router_state.js +1 -2
  45. package/dist/packages/@ember/-internals/routing/lib/utils.js +1 -2
  46. package/dist/packages/@ember/-internals/runtime/index.js +1 -4
  47. package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +4 -175
  48. package/dist/packages/@ember/-internals/runtime/lib/mixins/observable.js +1 -18
  49. package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -43
  50. package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +8 -15
  51. package/dist/packages/@ember/-internals/runtime/lib/system/core_object.js +10 -141
  52. package/dist/packages/@ember/-internals/utils/index.js +3 -59
  53. package/dist/packages/@ember/-internals/views/index.js +0 -2
  54. package/dist/packages/@ember/-internals/views/lib/mixins/action_support.js +1 -121
  55. package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +4 -40
  56. package/dist/packages/@ember/-internals/views/lib/system/event_dispatcher.js +115 -190
  57. package/dist/packages/@ember/-internals/views/lib/views/states/destroying.js +1 -2
  58. package/dist/packages/@ember/-internals/views/lib/views/states/has_element.js +1 -2
  59. package/dist/packages/@ember/-internals/views/lib/views/states/in_dom.js +1 -2
  60. package/dist/packages/@ember/-internals/views/lib/views/states/pre_render.js +1 -2
  61. package/dist/packages/@ember/application/instance.js +3 -25
  62. package/dist/packages/@ember/application/lib/application.js +14 -32
  63. package/dist/packages/@ember/canary-features/index.js +5 -6
  64. package/dist/packages/@ember/component/index.js +1 -1
  65. package/dist/packages/@ember/component/template-only.js +2 -0
  66. package/dist/packages/@ember/debug/lib/deprecate.js +7 -41
  67. package/dist/packages/@ember/deprecated-features/index.js +1 -14
  68. package/dist/packages/@ember/engine/index.js +3 -17
  69. package/dist/packages/@ember/engine/instance.js +0 -4
  70. package/dist/packages/@ember/helper/index.js +12 -4
  71. package/dist/packages/@ember/object/index.js +3 -101
  72. package/dist/packages/@ember/object/internals.js +0 -1
  73. package/dist/packages/@ember/object/lib/computed/computed_macros.js +12 -384
  74. package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +9 -360
  75. package/dist/packages/@ember/polyfills/index.js +1 -6
  76. package/dist/packages/@ember/polyfills/lib/assign.js +12 -28
  77. package/dist/packages/@ember/routing/index.js +1 -1
  78. package/dist/packages/@ember/runloop/index.js +1 -83
  79. package/dist/packages/@ember/string/index.js +1 -206
  80. package/dist/packages/@ember/utils/index.js +0 -1
  81. package/dist/packages/ember/index.js +17 -180
  82. package/dist/packages/ember/version.js +1 -1
  83. package/dist/packages/ember-testing/index.js +0 -2
  84. package/dist/packages/ember-testing/lib/helpers.js +0 -12
  85. package/dist/packages/ember-testing/lib/setup_for_testing.js +0 -10
  86. package/docs/data.json +1637 -3659
  87. package/lib/index.js +14 -59
  88. package/lib/overrides.js +0 -61
  89. package/lib/transforms/inject-babel-helpers.js +1 -3
  90. package/package.json +27 -23
  91. package/dist/packages/@ember/-internals/console/index.js +0 -190
  92. package/dist/packages/@ember/-internals/runtime/lib/copy.js +0 -119
  93. package/dist/packages/@ember/-internals/runtime/lib/ext/function.js +0 -155
  94. package/dist/packages/@ember/-internals/runtime/lib/mixins/copyable.js +0 -31
  95. package/dist/packages/@ember/-internals/views/lib/mixins/text_support.js +0 -357
  96. package/dist/packages/@ember/-internals/views/lib/system/jquery.js +0 -26
  97. package/dist/packages/@ember/-internals/views/lib/system/jquery_event_deprecation.js +0 -60
  98. package/dist/packages/@ember/application/deprecations.js +0 -25
  99. package/dist/packages/@ember/application/globals-resolver.js +0 -434
  100. package/dist/packages/@ember/application/resolver.js +0 -1
  101. package/dist/packages/@ember/component/checkbox.js +0 -17
  102. package/dist/packages/@ember/component/text-area.js +0 -17
  103. package/dist/packages/@ember/component/text-field.js +0 -17
  104. package/dist/packages/@ember/polyfills/lib/merge.js +0 -50
  105. package/dist/packages/@ember/routing/link-component.js +0 -17
  106. package/dist/packages/ember-testing/lib/events.js +0 -102
  107. package/dist/packages/ember-testing/lib/helpers/-is-form-control.js +0 -19
  108. package/dist/packages/ember-testing/lib/helpers/click.js +0 -32
  109. package/dist/packages/ember-testing/lib/helpers/fill_in.js +0 -47
  110. package/dist/packages/ember-testing/lib/helpers/find.js +0 -40
  111. package/dist/packages/ember-testing/lib/helpers/find_with_assert.js +0 -37
  112. package/dist/packages/ember-testing/lib/helpers/key_event.js +0 -37
  113. package/dist/packages/ember-testing/lib/helpers/trigger_event.js +0 -61
  114. package/dist/packages/ember-testing/lib/support.js +0 -57
  115. package/dist/packages/jquery/index.js +0 -2
@@ -3,8 +3,8 @@
3
3
  */
4
4
  import { DEBUG } from '@glimmer/env';
5
5
  import { PROXY_CONTENT } from '@ember/-internals/metal';
6
- import { setEmberArray, HAS_NATIVE_PROXY } from '@ember/-internals/utils';
7
- import { get, set, objectAt, replaceInNativeArray, replace, computed, Mixin, hasListeners, beginPropertyChanges, endPropertyChanges, addArrayObserver, removeArrayObserver, arrayContentWillChange, arrayContentDidChange, nativeDescDecorator as descriptor } from '@ember/-internals/metal';
6
+ import { setEmberArray } from '@ember/-internals/utils';
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';
@@ -126,7 +126,7 @@ function insertAt(array, index, item) {
126
126
  export function isArray(_obj) {
127
127
  let obj = _obj;
128
128
 
129
- if (DEBUG && HAS_NATIVE_PROXY && typeof _obj === 'object' && _obj !== null) {
129
+ if (DEBUG && typeof _obj === 'object' && _obj !== null) {
130
130
  let possibleProxyContent = _obj[PROXY_CONTENT];
131
131
 
132
132
  if (possibleProxyContent !== undefined) {
@@ -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. You should also call `this.arrayContentDidChange()`
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
@@ -2,7 +2,7 @@
2
2
  @module @ember/object
3
3
  */
4
4
  import { peekMeta } from '@ember/-internals/meta';
5
- import { get, getWithDefault, set, getProperties, setProperties, Mixin, hasListeners, beginPropertyChanges, notifyPropertyChange, endPropertyChanges, addObserver, removeObserver } from '@ember/-internals/metal';
5
+ import { get, set, getProperties, setProperties, Mixin, hasListeners, beginPropertyChanges, notifyPropertyChange, endPropertyChanges, addObserver, removeObserver } from '@ember/-internals/metal';
6
6
  import { assert } from '@ember/debug';
7
7
  /**
8
8
  ## Overview
@@ -339,23 +339,6 @@ export default Mixin.create({
339
339
  return hasListeners(this, `${key}:change`);
340
340
  },
341
341
 
342
- /**
343
- Retrieves the value of a property, or a default value in the case that the
344
- property returns `undefined`.
345
- ```javascript
346
- person.getWithDefault('lastName', 'Doe');
347
- ```
348
- @method getWithDefault
349
- @param {String} keyName The name of the property to retrieve
350
- @param {Object} defaultValue The value to return if the property value is undefined
351
- @return {Object} The property value or the defaultValue.
352
- @public
353
- @deprecated
354
- */
355
- getWithDefault(keyName, defaultValue) {
356
- return getWithDefault(this, keyName, defaultValue);
357
- },
358
-
359
342
  /**
360
343
  Set the value of a property to the current value plus some amount.
361
344
  ```javascript
@@ -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;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  @module @ember/array
3
3
  */
4
- import { get, objectAt, alias, PROPERTY_DID_CHANGE, addArrayObserver, removeArrayObserver, replace, arrayContentDidChange, tagForProperty } from '@ember/-internals/metal';
4
+ import { get, objectAt, alias, PROPERTY_DID_CHANGE, addArrayObserver, removeArrayObserver, replace, arrayContentDidChange, arrayContentWillChange, tagForProperty } from '@ember/-internals/metal';
5
5
  import { isObject } from '@ember/-internals/utils';
6
6
  import EmberObject from './object';
7
7
  import { isArray, MutableArray } from '../mixins/array';
@@ -237,11 +237,11 @@ export default class ArrayProxy extends EmberObject {
237
237
 
238
238
  this._removeArrangedContentArrayObserver();
239
239
 
240
- this.arrayContentWillChange(0, oldLength, newLength);
240
+ arrayContentWillChange(this, 0, oldLength, newLength);
241
241
 
242
242
  this._invalidate();
243
243
 
244
- this.arrayContentDidChange(0, oldLength, newLength);
244
+ arrayContentDidChange(this, 0, oldLength, newLength, false);
245
245
 
246
246
  this._addArrangedContentArrayObserver(arrangedContent);
247
247
  }
@@ -250,21 +250,21 @@ export default class ArrayProxy extends EmberObject {
250
250
  if (arrangedContent && !arrangedContent.isDestroyed) {
251
251
  assert("Can't set ArrayProxy's content to itself", arrangedContent !== this);
252
252
  assert(`ArrayProxy expects an Array or ArrayProxy, but you passed ${typeof arrangedContent}`, isArray(arrangedContent) || arrangedContent.isDestroyed);
253
- addArrayObserver(arrangedContent, this, ARRAY_OBSERVER_MAPPING, true);
253
+ addArrayObserver(arrangedContent, this, ARRAY_OBSERVER_MAPPING);
254
254
  this._arrangedContent = arrangedContent;
255
255
  }
256
256
  }
257
257
 
258
258
  _removeArrangedContentArrayObserver() {
259
259
  if (this._arrangedContent) {
260
- removeArrayObserver(this._arrangedContent, this, ARRAY_OBSERVER_MAPPING, true);
260
+ removeArrayObserver(this._arrangedContent, this, ARRAY_OBSERVER_MAPPING);
261
261
  }
262
262
  }
263
263
 
264
264
  _arrangedContentArrayWillChange() {}
265
265
 
266
266
  _arrangedContentArrayDidChange(proxy, idx, removedCnt, addedCnt) {
267
- this.arrayContentWillChange(idx, removedCnt, addedCnt);
267
+ arrayContentWillChange(this, idx, removedCnt, addedCnt);
268
268
  let dirtyIndex = idx;
269
269
 
270
270
  if (dirtyIndex < 0) {
@@ -277,7 +277,7 @@ export default class ArrayProxy extends EmberObject {
277
277
  }
278
278
 
279
279
  this._lengthDirty = true;
280
- this.arrayContentDidChange(idx, removedCnt, addedCnt);
280
+ arrayContentDidChange(this, idx, removedCnt, addedCnt, false);
281
281
  }
282
282
 
283
283
  _invalidate() {
@@ -324,12 +324,5 @@ ArrayProxy.reopen(MutableArray, {
324
324
  @property arrangedContent
325
325
  @public
326
326
  */
327
- arrangedContent: alias('content'),
328
-
329
- // Array proxies don't need to notify when they change since their `[]` tag is
330
- // already dependent on the `[]` tag of `arrangedContent`
331
- arrayContentDidChange(startIdx, removeAmt, addAmt) {
332
- return arrayContentDidChange(this, startIdx, removeAmt, addAmt, false);
333
- }
334
-
327
+ arrangedContent: alias('content')
335
328
  });
@@ -1,14 +1,13 @@
1
1
  /**
2
2
  @module @ember/object
3
3
  */
4
- import { getFactoryFor, setFactoryFor, INIT_FACTORY } from '@ember/-internals/container';
5
- import { getOwner, LEGACY_OWNER } from '@ember/-internals/owner';
6
- import { assign } from '@ember/polyfills';
7
- import { guidFor, lookupDescriptor, inspect, makeArray, HAS_NATIVE_PROXY, HAS_NATIVE_SYMBOL, isInternalSymbol } from '@ember/-internals/utils';
4
+ import { getFactoryFor, setFactoryFor } from '@ember/-internals/container';
5
+ import { getOwner } from '@ember/-internals/owner';
6
+ import { guidFor, makeArray, isInternalSymbol } from '@ember/-internals/utils';
8
7
  import { meta } from '@ember/-internals/meta';
9
- import { PROXY_CONTENT, sendEvent, Mixin, activateObserver, applyMixin, defineProperty, descriptorForProperty, isClassicDecorator, DEBUG_INJECTION_FUNCTIONS, TrackedDescriptor } from '@ember/-internals/metal';
8
+ import { PROXY_CONTENT, sendEvent, Mixin, activateObserver, applyMixin, defineProperty, descriptorForProperty, isClassicDecorator, DEBUG_INJECTION_FUNCTIONS } from '@ember/-internals/metal';
10
9
  import ActionHandler from '../mixins/action_handler';
11
- import { assert, deprecate } from '@ember/debug';
10
+ import { assert } from '@ember/debug';
12
11
  import { DEBUG } from '@glimmer/env';
13
12
  import { _WeakSet as WeakSet } from '@glimmer/util';
14
13
  import { destroy, isDestroying, isDestroyed, registerDestructor } from '@glimmer/destroyable';
@@ -32,22 +31,6 @@ function initialize(obj, properties) {
32
31
  if (properties !== undefined) {
33
32
  assert('EmberObject.create only accepts objects.', typeof properties === 'object' && properties !== null);
34
33
  assert('EmberObject.create no longer supports mixing in other ' + 'definitions, use .extend & .create separately instead.', !(properties instanceof Mixin));
35
- let injectedProperties;
36
-
37
- if (DEBUG) {
38
- // these are all the implicit injectinos
39
- injectedProperties = [];
40
- let factory = getFactoryFor(obj);
41
-
42
- if (factory) {
43
- for (let injection in factory.injections) {
44
- if (factory.injections[injection] === properties[injection]) {
45
- injectedProperties.push(injection);
46
- }
47
- }
48
- }
49
- }
50
-
51
34
  let concatenatedProperties = obj.concatenatedProperties;
52
35
  let mergedProperties = obj.mergedProperties;
53
36
  let hasConcatenatedProps = concatenatedProperties !== undefined && concatenatedProperties.length > 0;
@@ -76,58 +59,17 @@ function initialize(obj, properties) {
76
59
 
77
60
  if (hasMergedProps && mergedProperties.indexOf(keyName) > -1) {
78
61
  let baseValue = obj[keyName];
79
- value = assign({}, baseValue, value);
62
+ value = Object.assign({}, baseValue, value);
80
63
  }
81
64
  }
82
65
 
83
66
  if (isDescriptor) {
84
- if (DEBUG && injectedProperties.indexOf(keyName) !== -1) {
85
- // need to check if implicit injection owner.inject('component:my-component', 'foo', 'service:bar') does not match explicit injection @service foo
86
- // implicit injection takes precedence so need to tell user to rename property on obj
87
- let isInjectedProperty = DEBUG_INJECTION_FUNCTIONS.has(possibleDesc._getter);
88
-
89
- if (isInjectedProperty && value !== possibleDesc.get(obj, keyName)) {
90
- implicitInjectionDeprecation(keyName, `You have explicitly defined a service injection for the '${keyName}' property on ${inspect(obj)}. However, a different service or value was injected via implicit injections which overrode your explicit injection. Implicit injections have been deprecated, and will be removed in the near future. In order to prevent breakage, you should inject the same value explicitly that is currently being injected implicitly.`);
91
- } else if (possibleDesc instanceof TrackedDescriptor) {
92
- let descValue = possibleDesc.get(obj, keyName);
93
-
94
- if (value !== descValue) {
95
- implicitInjectionDeprecation(keyName, `A value was injected implicitly on the '${keyName}' tracked property of an instance of ${inspect(obj)}, overwriting the original value which was ${inspect(descValue)}. Implicit injection is now deprecated, please add an explicit injection for this value. If the injected value is a service, consider using the @service decorator.`);
96
- }
97
- } else if (possibleDesc._setter === undefined) {
98
- implicitInjectionDeprecation(keyName, `A value was injected implicitly on the '${keyName}' computed property of an instance of ${inspect(obj)}. Implicit injection is now deprecated, please add an explicit injection for this value. If the injected value is a service, consider using the @service decorator.`);
99
- }
100
- }
101
-
102
67
  possibleDesc.set(obj, keyName, value);
103
68
  } else if (typeof obj.setUnknownProperty === 'function' && !(keyName in obj)) {
104
69
  obj.setUnknownProperty(keyName, value);
105
70
  } else {
106
71
  if (DEBUG) {
107
- // If deprecation, either 1) an accessor descriptor or 2) class field declaration 3) only an implicit injection
108
- let desc = lookupDescriptor(obj, keyName);
109
-
110
- if (injectedProperties.indexOf(keyName) === -1) {
111
- // Value was not an injected property, define in like normal
112
- defineProperty(obj, keyName, null, value, m); // setup mandatory setter
113
- } else if (desc) {
114
- // If the property is a value prop, and it isn't the expected value,
115
- // then we can warn the user when they attempt to use the value
116
- if ('value' in desc && desc.value !== value) {
117
- // implicit injection does not match value descriptor set on object
118
- defineSelfDestructingImplicitInjectionGetter(obj, keyName, value, `A value was injected implicitly on the '${keyName}' property of an instance of ${inspect(obj)}, overwriting the original value which was ${inspect(desc.value)}. Implicit injection is now deprecated, please add an explicit injection for this value. If the injected value is a service, consider using the @service decorator.`);
119
- } else {
120
- // Otherwise, the value is either a getter/setter, or it is the correct value.
121
- // If it is a getter/setter, then we don't know what activating it might do - it could
122
- // be that the user only defined a getter, and so the value will not be set at all. It
123
- // could be that the setter is a no-op that does nothing. Both of these are valid ways
124
- // to "override" an implicit injection, so we can't really warn here. So, assign the
125
- // value like we would normally.
126
- obj[keyName] = value;
127
- }
128
- } else {
129
- defineSelfDestructingImplicitInjectionGetter(obj, keyName, value, `A value was injected implicitly on the '${keyName}' property of an instance of ${inspect(obj)}. Implicit injection is now deprecated, please add an explicit injection for this value. If the injected value is a service, consider using the @service decorator.`);
130
- }
72
+ defineProperty(obj, keyName, null, value, m); // setup mandatory setter
131
73
  } else {
132
74
  obj[keyName] = value;
133
75
  }
@@ -152,23 +94,6 @@ function initialize(obj, properties) {
152
94
 
153
95
  sendEvent(obj, 'init', undefined, undefined, undefined, m);
154
96
  }
155
-
156
- function defineSelfDestructingImplicitInjectionGetter(obj, keyName, value, message) {
157
- Object.defineProperty(obj, keyName, {
158
- configurable: true,
159
- enumerable: true,
160
-
161
- get() {
162
- // only want to deprecate on first access so we make this self destructing
163
- Object.defineProperty(obj, keyName, {
164
- value
165
- });
166
- implicitInjectionDeprecation(keyName, message);
167
- return value;
168
- }
169
-
170
- });
171
- }
172
97
  /**
173
98
  `CoreObject` is the base class for all Ember constructs. It establishes a
174
99
  class system based on Ember's Mixin system, and provides the basis for the
@@ -234,15 +159,12 @@ function defineSelfDestructingImplicitInjectionGetter(obj, keyName, value, messa
234
159
 
235
160
  class CoreObject {
236
161
  constructor(owner) {
237
- // setOwner has to set both OWNER and LEGACY_OWNER for backwards compatibility, and
238
- // LEGACY_OWNER is enumerable, so setting it would add an enumerable property to the object,
239
- // so we just set `OWNER` directly here.
240
162
  this[OWNER] = owner; // prepare prototype...
241
163
 
242
164
  this.constructor.proto();
243
165
  let self = this;
244
166
 
245
- if (DEBUG && HAS_NATIVE_PROXY && typeof self.unknownProperty === 'function') {
167
+ if (DEBUG && typeof self.unknownProperty === 'function') {
246
168
  let messageFor = (obj, property) => {
247
169
  return `You attempted to access the \`${String(property)}\` property (of ${obj}).\n` + `Since Ember 3.1, this is usually fine as you no longer need to use \`.get()\`\n` + `to access computed properties. However, in this case, the object in question\n` + `is a special kind of Ember object (a proxy). Therefore, it is still necessary\n` + `to use \`.get('${String(property)}')\` in this case.\n\n` + `If you encountered this error because of third-party code that you don't control,\n` + `there is more information at https://github.com/emberjs/ember.js/issues/16148, and\n` + `you can help us improve this error message by telling us more about what happened in\n` + `this situation.`;
248
170
  };
@@ -277,11 +199,7 @@ class CoreObject {
277
199
  if (DEBUG && self !== this) {
278
200
  return self;
279
201
  }
280
- } // Empty setter for absorbing setting the LEGACY_OWNER, which should _not_
281
- // become an enumerable property, and should not be used in general.
282
-
283
-
284
- set [LEGACY_OWNER](value) {}
202
+ }
285
203
 
286
204
  reopen(...args) {
287
205
  applyMixin(this, args);
@@ -928,7 +846,7 @@ function flattenProps(...props) {
928
846
 
929
847
  if (hasMergedProps && mergedProperties.indexOf(keyName) > -1) {
930
848
  let baseValue = initProperties[keyName];
931
- value = assign({}, baseValue, value);
849
+ value = Object.assign({}, baseValue, value);
932
850
  }
933
851
 
934
852
  initProperties[keyName] = value;
@@ -993,53 +911,4 @@ if (DEBUG) {
993
911
  };
994
912
  }
995
913
 
996
- if (!HAS_NATIVE_SYMBOL) {
997
- // Allows OWNER and INIT_FACTORY to be non-enumerable in IE11
998
- let instanceOwner = new WeakMap();
999
- let instanceFactory = new WeakMap();
1000
- Object.defineProperty(CoreObject.prototype, OWNER, {
1001
- get() {
1002
- return instanceOwner.get(this);
1003
- },
1004
-
1005
- set(value) {
1006
- instanceOwner.set(this, value);
1007
- }
1008
-
1009
- });
1010
- Object.defineProperty(CoreObject.prototype, INIT_FACTORY, {
1011
- get() {
1012
- return instanceFactory.get(this);
1013
- },
1014
-
1015
- set(value) {
1016
- instanceFactory.set(this, value);
1017
- }
1018
-
1019
- });
1020
- Object.defineProperty(CoreObject, INIT_FACTORY, {
1021
- get() {
1022
- return instanceFactory.get(this);
1023
- },
1024
-
1025
- set(value) {
1026
- instanceFactory.set(this, value);
1027
- },
1028
-
1029
- enumerable: false
1030
- });
1031
- }
1032
-
1033
- function implicitInjectionDeprecation(keyName, msg = null) {
1034
- deprecate(msg, false, {
1035
- id: 'implicit-injections',
1036
- until: '4.0.0',
1037
- url: 'https://deprecations.emberjs.com/v3.x#toc_implicit-injections',
1038
- for: 'ember-source',
1039
- since: {
1040
- enabled: '3.26.0'
1041
- }
1042
- });
1043
- }
1044
-
1045
914
  export default CoreObject;