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

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.
@@ -6,7 +6,7 @@
6
6
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
7
7
  * @license Licensed under MIT license
8
8
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
9
- * @version 4.1.0-alpha.7
9
+ * @version 4.1.0-alpha.8
10
10
  */
11
11
  /* eslint-disable no-var */
12
12
 
@@ -6707,6 +6707,11 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
6707
6707
  var {
6708
6708
  id
6709
6709
  } = options;
6710
+
6711
+ if (id === 'argument-less-helper-paren-less-invocation') {
6712
+ throw new Error(`A resolved helper cannot be passed as a named argument as the syntax is ` + `ambiguously a pass-by-reference or invocation. Use the ` + `\`{{helper 'foo-helper}}\` helper to pass by reference or explicitly ` + `invoke the helper with parens: \`{{(fooHelper)}}\`.`);
6713
+ }
6714
+
6710
6715
  var override = VM_DEPRECATION_OVERRIDES.filter(o => o.id === id)[0];
6711
6716
  if (!override) throw new Error(`deprecation override for ${id} not found`); // allow deprecations to be disabled in the VM_DEPRECATION_OVERRIDES array below
6712
6717
 
@@ -6733,14 +6738,6 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
6733
6738
 
6734
6739
 
6735
6740
  var VM_DEPRECATION_OVERRIDES = [{
6736
- id: 'argument-less-helper-paren-less-invocation',
6737
- url: 'https://deprecations.emberjs.com/v3.x#toc_argument-less-helper-paren-less-invocation',
6738
- until: '4.0.0',
6739
- for: 'ember-source',
6740
- since: {
6741
- enabled: '3.27.0'
6742
- }
6743
- }, {
6744
6741
  id: 'setting-on-hash',
6745
6742
  until: '4.4.0',
6746
6743
  for: 'ember-source',
@@ -10147,44 +10144,30 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
10147
10144
  arrayContentDidChange(array, start, deleteCount, items.length);
10148
10145
  }
10149
10146
 
10150
- function arrayObserversHelper(obj, target, opts, operation, notify) {
10151
- var willChange = opts && opts.willChange || 'arrayWillChange';
10152
- var didChange = opts && opts.didChange || 'arrayDidChange';
10153
- var hasObservers = obj.hasArrayObservers;
10147
+ function arrayObserversHelper(obj, target, opts, operation) {
10148
+ var _a;
10149
+
10150
+ var {
10151
+ willChange,
10152
+ didChange
10153
+ } = opts;
10154
10154
  operation(obj, '@array:before', target, willChange);
10155
10155
  operation(obj, '@array:change', target, didChange);
10156
+ /*
10157
+ * Array proxies have a `_revalidate` method which must be called to set
10158
+ * up their internal array observation systems.
10159
+ */
10156
10160
 
10157
- if (hasObservers === notify) {
10158
- notifyPropertyChange(obj, 'hasArrayObservers');
10159
- }
10160
-
10161
+ (_a = obj._revalidate) === null || _a === void 0 ? void 0 : _a.call(obj);
10161
10162
  return obj;
10162
10163
  }
10163
10164
 
10164
- function addArrayObserver(array, target, opts, suppress = false) {
10165
- (true && !(suppress) && (0, _debug.deprecate)(`Array observers have been deprecated. Added an array observer to ${_utils.getDebugName === null || _utils.getDebugName === void 0 ? void 0 : (0, _utils.getDebugName)(array)}.`, suppress, {
10166
- id: 'array-observers',
10167
- url: 'https://deprecations.emberjs.com/v3.x#toc_array-observers',
10168
- until: '4.0.0',
10169
- for: 'ember-source',
10170
- since: {
10171
- enabled: '3.26.0-beta.1'
10172
- }
10173
- }));
10174
- return arrayObserversHelper(array, target, opts, addListener, false);
10165
+ function addArrayObserver(array, target, opts) {
10166
+ return arrayObserversHelper(array, target, opts, addListener);
10175
10167
  }
10176
10168
 
10177
- function removeArrayObserver(array, target, opts, suppress = false) {
10178
- (true && !(suppress) && (0, _debug.deprecate)(`Array observers have been deprecated. Removed an array observer from ${_utils.getDebugName === null || _utils.getDebugName === void 0 ? void 0 : (0, _utils.getDebugName)(array)}.`, suppress, {
10179
- id: 'array-observers',
10180
- url: 'https://deprecations.emberjs.com/v3.x#toc_array-observers',
10181
- until: '4.0.0',
10182
- for: 'ember-source',
10183
- since: {
10184
- enabled: '3.26.0-beta.1'
10185
- }
10186
- }));
10187
- return arrayObserversHelper(array, target, opts, removeListener, true);
10169
+ function removeArrayObserver(array, target, opts) {
10170
+ return arrayObserversHelper(array, target, opts, removeListener);
10188
10171
  }
10189
10172
 
10190
10173
  var CHAIN_PASS_THROUGH = new _util._WeakSet();
@@ -16262,7 +16245,8 @@ define("@ember/-internals/routing/lib/system/route", ["exports", "@ember/-intern
16262
16245
 
16263
16246
 
16264
16247
  _optionsForQueryParam(qp) {
16265
- return (0, _metal.get)(this, `queryParams.${qp.urlKey}`) || (0, _metal.get)(this, `queryParams.${qp.prop}`) || {};
16248
+ var queryParams = (0, _metal.get)(this, 'queryParams');
16249
+ return (0, _metal.get)(queryParams, qp.urlKey) || (0, _metal.get)(queryParams, qp.prop) || queryParams[qp.urlKey] || queryParams[qp.prop] || {};
16266
16250
  }
16267
16251
  /**
16268
16252
  A hook you can use to reset controller values either when the model
@@ -21356,177 +21340,6 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
21356
21340
  return -1;
21357
21341
  },
21358
21342
 
21359
- // ..........................................................
21360
- // ARRAY OBSERVERS
21361
- //
21362
-
21363
- /**
21364
- Adds an array observer to the receiving array. The array observer object
21365
- normally must implement two methods:
21366
- * `willChange(observedObj, start, removeCount, addCount)` - This method will be
21367
- called just before the array is modified.
21368
- * `didChange(observedObj, start, removeCount, addCount)` - This method will be
21369
- called just after the array is modified.
21370
- Both callbacks will be passed the observed object, starting index of the
21371
- change as well as a count of the items to be removed and added. You can use
21372
- these callbacks to optionally inspect the array during the change, clear
21373
- caches, or do any other bookkeeping necessary.
21374
- In addition to passing a target, you can also include an options hash
21375
- which you can use to override the method names that will be invoked on the
21376
- target.
21377
- @method addArrayObserver
21378
- @param {Object} target The observer object.
21379
- @param {Object} opts Optional hash of configuration options including
21380
- `willChange` and `didChange` option.
21381
- @return {EmberArray} receiver
21382
- @public
21383
- @example
21384
- import Service from '@ember/service';
21385
- export default Service.extend({
21386
- data: Ember.A(),
21387
- init() {
21388
- this._super(...arguments);
21389
- this.data.addArrayObserver(this, {
21390
- willChange: 'dataWillChange',
21391
- didChange: 'dataDidChange'
21392
- });
21393
- },
21394
- dataWillChange(array, start, removeCount, addCount) {
21395
- console.log('array will change', array, start, removeCount, addCount);
21396
- },
21397
- dataDidChange(array, start, removeCount, addCount) {
21398
- console.log('array did change', array, start, removeCount, addCount);
21399
- }
21400
- });
21401
- */
21402
- addArrayObserver(target, opts) {
21403
- return (0, _metal.addArrayObserver)(this, target, opts);
21404
- },
21405
-
21406
- /**
21407
- Removes an array observer from the object if the observer is current
21408
- registered. Calling this method multiple times with the same object will
21409
- have no effect.
21410
- @method removeArrayObserver
21411
- @param {Object} target The object observing the array.
21412
- @param {Object} opts Optional hash of configuration options including
21413
- `willChange` and `didChange` option.
21414
- @return {EmberArray} receiver
21415
- @public
21416
- */
21417
- removeArrayObserver(target, opts) {
21418
- return (0, _metal.removeArrayObserver)(this, target, opts);
21419
- },
21420
-
21421
- /**
21422
- Becomes true whenever the array currently has observers watching changes
21423
- on the array.
21424
- ```javascript
21425
- let arr = [1, 2, 3, 4, 5];
21426
- arr.hasArrayObservers; // false
21427
- arr.addArrayObserver(this, {
21428
- willChange() {
21429
- console.log('willChange');
21430
- }
21431
- });
21432
- arr.hasArrayObservers; // true
21433
- ```
21434
- @property {Boolean} hasArrayObservers
21435
- @public
21436
- */
21437
- hasArrayObservers: (0, _metal.nativeDescDecorator)({
21438
- configurable: true,
21439
- enumerable: false,
21440
-
21441
- get() {
21442
- return (0, _metal.hasListeners)(this, '@array:change') || (0, _metal.hasListeners)(this, '@array:before');
21443
- }
21444
-
21445
- }),
21446
-
21447
- /**
21448
- If you are implementing an object that supports `EmberArray`, call this
21449
- method just before the array content changes to notify any observers and
21450
- invalidate any related properties. Pass the starting index of the change
21451
- as well as a delta of the amounts to change.
21452
- ```app/components/show-post.js
21453
- import Component from '@ember/component';
21454
- import EmberObject from '@ember/object';
21455
- const Post = EmberObject.extend({
21456
- body: '',
21457
- save() {}
21458
- })
21459
- export default Component.extend({
21460
- attemptsToModify: 0,
21461
- successfulModifications: 0,
21462
- posts: null,
21463
- init() {
21464
- this._super(...arguments);
21465
- this.posts = [1, 2, 3].map(i => Post.create({ body: i }));
21466
- this.posts.addArrayObserver(this, {
21467
- willChange() {
21468
- this.incrementProperty('attemptsToModify');
21469
- },
21470
- didChange() {
21471
- this.incrementProperty('successfulModifications');
21472
- }
21473
- });
21474
- },
21475
- actions: {
21476
- editPost(post, newContent) {
21477
- let oldContent = post.body,
21478
- postIndex = this.posts.indexOf(post);
21479
- this.posts.arrayContentWillChange(postIndex, 0, 0); // attemptsToModify = 1
21480
- post.set('body', newContent);
21481
- post.save()
21482
- .then(response => {
21483
- this.posts.arrayContentDidChange(postIndex, 0, 0); // successfulModifications = 1
21484
- })
21485
- .catch(error => {
21486
- post.set('body', oldContent);
21487
- })
21488
- }
21489
- }
21490
- });
21491
- ```
21492
- @method arrayContentWillChange
21493
- @param {Number} startIdx The starting index in the array that will change.
21494
- @param {Number} removeAmt The number of items that will be removed. If you
21495
- pass `null` assumes 0
21496
- @param {Number} addAmt The number of items that will be added. If you
21497
- pass `null` assumes 0.
21498
- @return {EmberArray} receiver
21499
- @public
21500
- */
21501
- arrayContentWillChange(startIdx, removeAmt, addAmt) {
21502
- return (0, _metal.arrayContentWillChange)(this, startIdx, removeAmt, addAmt);
21503
- },
21504
-
21505
- /**
21506
- If you are implementing an object that supports `EmberArray`, call this
21507
- method just after the array content changes to notify any observers and
21508
- invalidate any related properties. Pass the starting index of the change
21509
- as well as a delta of the amounts to change.
21510
- ```javascript
21511
- let arr = [1, 2, 3, 4, 5];
21512
- arr.copyWithin(-2); // [1, 2, 3, 1, 2]
21513
- // arr.lastObject = 5
21514
- arr.arrayContentDidChange(3, 2, 2);
21515
- // arr.lastObject = 2
21516
- ```
21517
- @method arrayContentDidChange
21518
- @param {Number} startIdx The starting index in the array that did change.
21519
- @param {Number} removeAmt The number of items that were removed. If you
21520
- pass `null` assumes 0
21521
- @param {Number} addAmt The number of items that were added. If you
21522
- pass `null` assumes 0.
21523
- @return {EmberArray} receiver
21524
- @public
21525
- */
21526
- arrayContentDidChange(startIdx, removeAmt, addAmt) {
21527
- return (0, _metal.arrayContentDidChange)(this, startIdx, removeAmt, addAmt);
21528
- },
21529
-
21530
21343
  /**
21531
21344
  Iterates through the array, calling the passed function on each
21532
21345
  item. This method corresponds to the `forEach()` method defined in
@@ -22255,7 +22068,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
22255
22068
  __Required.__ You must implement this method to apply this mixin.
22256
22069
  This is one of the primitives you must implement to support `Array`.
22257
22070
  You should replace amt objects started at idx with the objects in the
22258
- passed array. You should also call `this.arrayContentDidChange()`
22071
+ passed array.
22259
22072
  Note that this method is expected to validate the type(s) of objects that it expects.
22260
22073
  @method replace
22261
22074
  @param {Number} idx Starting index in the array to replace. If
@@ -24312,11 +24125,11 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
24312
24125
 
24313
24126
  this._removeArrangedContentArrayObserver();
24314
24127
 
24315
- this.arrayContentWillChange(0, oldLength, newLength);
24128
+ (0, _metal.arrayContentWillChange)(this, 0, oldLength, newLength);
24316
24129
 
24317
24130
  this._invalidate();
24318
24131
 
24319
- this.arrayContentDidChange(0, oldLength, newLength);
24132
+ (0, _metal.arrayContentDidChange)(this, 0, oldLength, newLength, false);
24320
24133
 
24321
24134
  this._addArrangedContentArrayObserver(arrangedContent);
24322
24135
  }
@@ -24325,21 +24138,21 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
24325
24138
  if (arrangedContent && !arrangedContent.isDestroyed) {
24326
24139
  (true && !(arrangedContent !== this) && (0, _debug.assert)("Can't set ArrayProxy's content to itself", arrangedContent !== this));
24327
24140
  (true && !((0, _array.isArray)(arrangedContent) || arrangedContent.isDestroyed) && (0, _debug.assert)(`ArrayProxy expects an Array or ArrayProxy, but you passed ${typeof arrangedContent}`, (0, _array.isArray)(arrangedContent) || arrangedContent.isDestroyed));
24328
- (0, _metal.addArrayObserver)(arrangedContent, this, ARRAY_OBSERVER_MAPPING, true);
24141
+ (0, _metal.addArrayObserver)(arrangedContent, this, ARRAY_OBSERVER_MAPPING);
24329
24142
  this._arrangedContent = arrangedContent;
24330
24143
  }
24331
24144
  }
24332
24145
 
24333
24146
  _removeArrangedContentArrayObserver() {
24334
24147
  if (this._arrangedContent) {
24335
- (0, _metal.removeArrayObserver)(this._arrangedContent, this, ARRAY_OBSERVER_MAPPING, true);
24148
+ (0, _metal.removeArrayObserver)(this._arrangedContent, this, ARRAY_OBSERVER_MAPPING);
24336
24149
  }
24337
24150
  }
24338
24151
 
24339
24152
  _arrangedContentArrayWillChange() {}
24340
24153
 
24341
24154
  _arrangedContentArrayDidChange(proxy, idx, removedCnt, addedCnt) {
24342
- this.arrayContentWillChange(idx, removedCnt, addedCnt);
24155
+ (0, _metal.arrayContentWillChange)(this, idx, removedCnt, addedCnt);
24343
24156
  var dirtyIndex = idx;
24344
24157
 
24345
24158
  if (dirtyIndex < 0) {
@@ -24352,7 +24165,7 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
24352
24165
  }
24353
24166
 
24354
24167
  this._lengthDirty = true;
24355
- this.arrayContentDidChange(idx, removedCnt, addedCnt);
24168
+ (0, _metal.arrayContentDidChange)(this, idx, removedCnt, addedCnt, false);
24356
24169
  }
24357
24170
 
24358
24171
  _invalidate() {
@@ -24401,14 +24214,7 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
24401
24214
  @property arrangedContent
24402
24215
  @public
24403
24216
  */
24404
- arrangedContent: (0, _metal.alias)('content'),
24405
-
24406
- // Array proxies don't need to notify when they change since their `[]` tag is
24407
- // already dependent on the `[]` tag of `arrangedContent`
24408
- arrayContentDidChange(startIdx, removeAmt, addAmt) {
24409
- return (0, _metal.arrayContentDidChange)(this, startIdx, removeAmt, addAmt, false);
24410
- }
24411
-
24217
+ arrangedContent: (0, _metal.alias)('content')
24412
24218
  });
24413
24219
  });
24414
24220
  define("@ember/-internals/runtime/lib/system/core_object", ["exports", "@ember/-internals/container", "@ember/-internals/owner", "@ember/-internals/utils", "@ember/-internals/meta", "@ember/-internals/metal", "@ember/-internals/runtime/lib/mixins/action_handler", "@ember/debug", "@glimmer/util", "@glimmer/destroyable", "@glimmer/owner"], function (_exports, _container, _owner, _utils, _meta2, _metal, _action_handler, _debug, _util, _destroyable, _owner2) {
@@ -30969,7 +30775,9 @@ define("@ember/destroyable/index", ["exports", "@glimmer/destroyable"], function
30969
30775
 
30970
30776
  ```js
30971
30777
  class CustomSelect extends Component {
30972
- constructor() {
30778
+ constructor(...args) {
30779
+ super(...args);
30780
+
30973
30781
  // obj is now a child of the component. When the component is destroyed,
30974
30782
  // obj will also be destroyed, and have all of its destructors triggered.
30975
30783
  this.obj = associateDestroyableChild(this, {});
@@ -31100,12 +30908,15 @@ define("@ember/destroyable/index", ["exports", "@glimmer/destroyable"], function
31100
30908
  parent is destroyed, the destructor function will be called.
31101
30909
 
31102
30910
  ```js
30911
+ import Component from '@glimmer/component';
31103
30912
  import { registerDestructor } from '@ember/destroyable';
31104
30913
 
31105
30914
  class Modal extends Component {
31106
30915
  @service resize;
31107
30916
 
31108
- constructor() {
30917
+ constructor(...args) {
30918
+ super(...args);
30919
+
31109
30920
  this.resize.register(this, this.layout);
31110
30921
 
31111
30922
  registerDestructor(this, () => this.resize.unregister(this));
@@ -31122,6 +30933,7 @@ define("@ember/destroyable/index", ["exports", "@glimmer/destroyable"], function
31122
30933
  than creating a closure function per destroyable.
31123
30934
 
31124
30935
  ```js
30936
+ import Component from '@glimmer/component';
31125
30937
  import { registerDestructor } from '@ember/destroyable';
31126
30938
 
31127
30939
  function unregisterResize(instance) {
@@ -31131,7 +30943,9 @@ define("@ember/destroyable/index", ["exports", "@glimmer/destroyable"], function
31131
30943
  class Modal extends Component {
31132
30944
  @service resize;
31133
30945
 
31134
- constructor() {
30946
+ constructor(...args) {
30947
+ super(...args);
30948
+
31135
30949
  this.resize.register(this, this.layout);
31136
30950
 
31137
30951
  registerDestructor(this, unregisterResize);
@@ -31154,12 +30968,15 @@ define("@ember/destroyable/index", ["exports", "@glimmer/destroyable"], function
31154
30968
  from the destroyable.
31155
30969
 
31156
30970
  ```js
30971
+ import Component from '@glimmer/component';
31157
30972
  import { registerDestructor, unregisterDestructor } from '@ember/destroyable';
31158
30973
 
31159
30974
  class Modal extends Component {
31160
30975
  @service modals;
31161
30976
 
31162
- constructor() {
30977
+ constructor(...args) {
30978
+ super(...args);
30979
+
31163
30980
  this.modals.add(this);
31164
30981
 
31165
30982
  this.modalDestructor = registerDestructor(this, () => this.modals.remove(this));
@@ -55398,7 +55215,7 @@ define("ember/version", ["exports"], function (_exports) {
55398
55215
  value: true
55399
55216
  });
55400
55217
  _exports.default = void 0;
55401
- var _default = "4.1.0-alpha.7";
55218
+ var _default = "4.1.0-alpha.8";
55402
55219
  _exports.default = _default;
55403
55220
  });
55404
55221
  define("route-recognizer", ["exports"], function (_exports) {