ember-source 4.1.0-alpha.4 → 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.
- package/CHANGELOG.md +88 -56
- 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/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/validator.js +19 -51
- package/dist/ember-template-compiler.js +378 -696
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +1 -1
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +3299 -6328
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/container/index.js +1 -1
- package/dist/packages/@ember/-internals/environment/index.js +0 -15
- package/dist/packages/@ember/-internals/glimmer/index.js +4824 -6772
- package/dist/packages/@ember/-internals/metal/index.js +57 -103
- package/dist/packages/@ember/-internals/routing/lib/ext/controller.js +1 -0
- package/dist/packages/@ember/-internals/routing/lib/location/api.js +10 -1
- package/dist/packages/@ember/-internals/routing/lib/location/none_location.js +7 -2
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +8 -8
- package/dist/packages/@ember/-internals/routing/lib/services/routing.js +1 -1
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +5 -43
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +36 -46
- 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/utils/index.js +0 -3
- package/dist/packages/@ember/-internals/views/index.js +0 -1
- package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +4 -4
- package/dist/packages/@ember/application/lib/application.js +8 -9
- package/dist/packages/@ember/canary-features/index.js +1 -3
- package/dist/packages/@ember/component/index.js +1 -1
- package/dist/packages/@ember/deprecated-features/index.js +0 -1
- package/dist/packages/@ember/destroyable/index.js +15 -4
- package/dist/packages/@ember/engine/index.js +1 -2
- package/dist/packages/@ember/routing/index.js +1 -1
- package/dist/packages/@ember/service/index.js +19 -5
- package/dist/packages/@glimmer/tracking/index.js +203 -1
- package/dist/packages/ember/index.js +11 -63
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +459 -1384
- package/lib/index.js +13 -76
- package/package.json +19 -20
- package/dist/packages/@ember/-internals/views/lib/mixins/text_support.js +0 -345
- 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/jquery/index.js +0 -2
|
@@ -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;
|
|
@@ -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
|
-
|
|
240
|
+
arrayContentWillChange(this, 0, oldLength, newLength);
|
|
241
241
|
|
|
242
242
|
this._invalidate();
|
|
243
243
|
|
|
244
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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,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
|
|
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
|
|
176
|
-
assert(`You tried to append to a non-Element (${selector}) in an environment without
|
|
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
|
|
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
|
|
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
|
-
|
|
485
|
-
|
|
486
|
-
|
|
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
|
|
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 {
|
|
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;
|
|
@@ -16,11 +16,10 @@ export const DEFAULT_FEATURES = {
|
|
|
16
16
|
EMBER_NAMED_BLOCKS: true,
|
|
17
17
|
EMBER_GLIMMER_HELPER_MANAGER: true,
|
|
18
18
|
EMBER_GLIMMER_INVOKE_HELPER: true,
|
|
19
|
-
EMBER_MODERNIZED_BUILT_IN_COMPONENTS: true,
|
|
20
19
|
EMBER_STRICT_MODE: true,
|
|
21
20
|
EMBER_DYNAMIC_HELPERS_AND_MODIFIERS: true,
|
|
22
21
|
EMBER_ROUTING_ROUTER_SERVICE_REFRESH: null,
|
|
23
|
-
EMBER_CACHED:
|
|
22
|
+
EMBER_CACHED: true
|
|
24
23
|
};
|
|
25
24
|
/**
|
|
26
25
|
The hash of enabled Canary features. Add to this, any canary features
|
|
@@ -74,7 +73,6 @@ export const EMBER_IMPROVED_INSTRUMENTATION = featureValue(FEATURES.EMBER_IMPROV
|
|
|
74
73
|
export const EMBER_NAMED_BLOCKS = featureValue(FEATURES.EMBER_NAMED_BLOCKS);
|
|
75
74
|
export const EMBER_GLIMMER_HELPER_MANAGER = featureValue(FEATURES.EMBER_GLIMMER_HELPER_MANAGER);
|
|
76
75
|
export const EMBER_GLIMMER_INVOKE_HELPER = featureValue(FEATURES.EMBER_GLIMMER_INVOKE_HELPER);
|
|
77
|
-
export const EMBER_MODERNIZED_BUILT_IN_COMPONENTS = featureValue(FEATURES.EMBER_MODERNIZED_BUILT_IN_COMPONENTS);
|
|
78
76
|
export const EMBER_STRICT_MODE = featureValue(FEATURES.EMBER_STRICT_MODE);
|
|
79
77
|
export const EMBER_DYNAMIC_HELPERS_AND_MODIFIERS = featureValue(FEATURES.EMBER_DYNAMIC_HELPERS_AND_MODIFIERS);
|
|
80
78
|
export const EMBER_ROUTING_ROUTER_SERVICE_REFRESH = featureValue(FEATURES.EMBER_ROUTING_ROUTER_SERVICE_REFRESH);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { setComponentTemplate, getComponentTemplate } from '@glimmer/manager';
|
|
2
|
-
export { Component as default, Input } from '@ember/-internals/glimmer';
|
|
2
|
+
export { Component as default, Input, Textarea } from '@ember/-internals/glimmer';
|
|
3
3
|
export { componentCapabilities as capabilities, setComponentManager } from '@ember/-internals/glimmer';
|
|
@@ -22,7 +22,9 @@ import { registerDestructor as _registerDestructor, unregisterDestructor as _unr
|
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
24
|
class CustomSelect extends Component {
|
|
25
|
-
constructor() {
|
|
25
|
+
constructor(...args) {
|
|
26
|
+
super(...args);
|
|
27
|
+
|
|
26
28
|
// obj is now a child of the component. When the component is destroyed,
|
|
27
29
|
// obj will also be destroyed, and have all of its destructors triggered.
|
|
28
30
|
this.obj = associateDestroyableChild(this, {});
|
|
@@ -153,12 +155,15 @@ import { registerDestructor as _registerDestructor, unregisterDestructor as _unr
|
|
|
153
155
|
parent is destroyed, the destructor function will be called.
|
|
154
156
|
|
|
155
157
|
```js
|
|
158
|
+
import Component from '@glimmer/component';
|
|
156
159
|
import { registerDestructor } from '@ember/destroyable';
|
|
157
160
|
|
|
158
161
|
class Modal extends Component {
|
|
159
162
|
@service resize;
|
|
160
163
|
|
|
161
|
-
constructor() {
|
|
164
|
+
constructor(...args) {
|
|
165
|
+
super(...args);
|
|
166
|
+
|
|
162
167
|
this.resize.register(this, this.layout);
|
|
163
168
|
|
|
164
169
|
registerDestructor(this, () => this.resize.unregister(this));
|
|
@@ -175,6 +180,7 @@ import { registerDestructor as _registerDestructor, unregisterDestructor as _unr
|
|
|
175
180
|
than creating a closure function per destroyable.
|
|
176
181
|
|
|
177
182
|
```js
|
|
183
|
+
import Component from '@glimmer/component';
|
|
178
184
|
import { registerDestructor } from '@ember/destroyable';
|
|
179
185
|
|
|
180
186
|
function unregisterResize(instance) {
|
|
@@ -184,7 +190,9 @@ import { registerDestructor as _registerDestructor, unregisterDestructor as _unr
|
|
|
184
190
|
class Modal extends Component {
|
|
185
191
|
@service resize;
|
|
186
192
|
|
|
187
|
-
constructor() {
|
|
193
|
+
constructor(...args) {
|
|
194
|
+
super(...args);
|
|
195
|
+
|
|
188
196
|
this.resize.register(this, this.layout);
|
|
189
197
|
|
|
190
198
|
registerDestructor(this, unregisterResize);
|
|
@@ -208,12 +216,15 @@ export function registerDestructor(destroyable, destructor) {
|
|
|
208
216
|
from the destroyable.
|
|
209
217
|
|
|
210
218
|
```js
|
|
219
|
+
import Component from '@glimmer/component';
|
|
211
220
|
import { registerDestructor, unregisterDestructor } from '@ember/destroyable';
|
|
212
221
|
|
|
213
222
|
class Modal extends Component {
|
|
214
223
|
@service modals;
|
|
215
224
|
|
|
216
|
-
constructor() {
|
|
225
|
+
constructor(...args) {
|
|
226
|
+
super(...args);
|
|
227
|
+
|
|
217
228
|
this.modals.add(this);
|
|
218
229
|
|
|
219
230
|
this.modalDestructor = registerDestructor(this, () => this.modals.remove(this));
|
|
@@ -292,7 +292,6 @@ Engine.reopenClass({
|
|
|
292
292
|
and after.
|
|
293
293
|
Example instanceInitializer to preload data into the store.
|
|
294
294
|
```app/initializer/preload-data.js
|
|
295
|
-
import $ from 'jquery';
|
|
296
295
|
export function initialize(application) {
|
|
297
296
|
var userConfig, userConfigEncoded, store;
|
|
298
297
|
// We have a HTML escaped JSON representation of the user's basic
|
|
@@ -303,7 +302,7 @@ Engine.reopenClass({
|
|
|
303
302
|
// like all local models and data can be manipulated by the user, so it
|
|
304
303
|
// should not be relied upon for security or authorization.
|
|
305
304
|
// Grab the encoded data from the meta tag
|
|
306
|
-
userConfigEncoded =
|
|
305
|
+
userConfigEncoded = document.querySelector('head meta[name=app-user-config]').attr('content');
|
|
307
306
|
// Unescape the text, then parse the resulting JSON into a real object
|
|
308
307
|
userConfig = JSON.parse(unescape(userConfigEncoded));
|
|
309
308
|
// Lookup the store
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { LinkTo } from '@ember/-internals/glimmer';
|
|
@@ -5,6 +5,20 @@ import { inject as metalInject } from '@ember/-internals/metal';
|
|
|
5
5
|
@public
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
@method inject
|
|
10
|
+
@static
|
|
11
|
+
@since 1.10.0
|
|
12
|
+
@for @ember/service
|
|
13
|
+
@param {String} name (optional) name of the service to inject, defaults to
|
|
14
|
+
the property's name
|
|
15
|
+
@return {ComputedDecorator} injection decorator instance
|
|
16
|
+
@public
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export function inject() {
|
|
20
|
+
return metalInject('service', ...arguments);
|
|
21
|
+
}
|
|
8
22
|
/**
|
|
9
23
|
Creates a property that lazily looks up a service in the container. There are
|
|
10
24
|
no restrictions as to what objects a service can be injected into.
|
|
@@ -13,7 +27,7 @@ import { inject as metalInject } from '@ember/-internals/metal';
|
|
|
13
27
|
|
|
14
28
|
```app/routes/application.js
|
|
15
29
|
import Route from '@ember/routing/route';
|
|
16
|
-
import {
|
|
30
|
+
import { service } from '@ember/service';
|
|
17
31
|
|
|
18
32
|
export default class ApplicationRoute extends Route {
|
|
19
33
|
@service('auth') authManager;
|
|
@@ -28,7 +42,7 @@ import { inject as metalInject } from '@ember/-internals/metal';
|
|
|
28
42
|
|
|
29
43
|
```app/routes/application.js
|
|
30
44
|
import Route from '@ember/routing/route';
|
|
31
|
-
import {
|
|
45
|
+
import { service } from '@ember/service';
|
|
32
46
|
|
|
33
47
|
export default Route.extend({
|
|
34
48
|
authManager: service('auth'),
|
|
@@ -43,9 +57,9 @@ import { inject as metalInject } from '@ember/-internals/metal';
|
|
|
43
57
|
that looks up the `auth` service in the container, making it easily accessible
|
|
44
58
|
in the `model` hook.
|
|
45
59
|
|
|
46
|
-
@method
|
|
60
|
+
@method service
|
|
47
61
|
@static
|
|
48
|
-
@since 1.
|
|
62
|
+
@since 4.1.0
|
|
49
63
|
@for @ember/service
|
|
50
64
|
@param {String} name (optional) name of the service to inject, defaults to
|
|
51
65
|
the property's name
|
|
@@ -53,7 +67,7 @@ import { inject as metalInject } from '@ember/-internals/metal';
|
|
|
53
67
|
@public
|
|
54
68
|
*/
|
|
55
69
|
|
|
56
|
-
export function
|
|
70
|
+
export function service() {
|
|
57
71
|
return metalInject('service', ...arguments);
|
|
58
72
|
}
|
|
59
73
|
/**
|