ember-source 4.2.0-alpha.7 → 4.3.0-alpha.3
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 +4 -0
- package/blueprints/component-addon/index.js +2 -3
- package/blueprints/component-class-addon/index.js +2 -3
- package/blueprints/controller/files/__root__/__path__/__name__.js +2 -2
- package/blueprints/controller/index.js +2 -4
- package/blueprints/route/files/__root__/__path__/__name__.js +3 -3
- package/blueprints/route/index.js +2 -3
- package/blueprints/service/files/__root__/__path__/__name__.js +2 -2
- package/blueprints/service/index.js +2 -4
- package/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +89 -90
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +15 -14
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +795 -752
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/header/loader.js +0 -1
- package/dist/packages/@ember/-internals/bootstrap/index.js +0 -2
- package/dist/packages/@ember/-internals/container/index.js +1 -1
- package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +3 -3
- package/dist/packages/@ember/-internals/extension-support/lib/data_adapter.js +52 -52
- package/dist/packages/@ember/-internals/glimmer/index.js +49 -81
- package/dist/packages/@ember/-internals/meta/lib/meta.js +59 -2
- package/dist/packages/@ember/-internals/metal/index.js +51 -76
- package/dist/packages/@ember/-internals/routing/lib/ext/controller.js +14 -4
- package/dist/packages/@ember/-internals/routing/lib/location/api.js +1 -0
- package/dist/packages/@ember/-internals/routing/lib/location/auto_location.js +3 -1
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +7 -49
- package/dist/packages/@ember/-internals/routing/lib/services/routing.js +3 -1
- package/dist/packages/@ember/-internals/routing/lib/system/route.js +57 -33
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +22 -7
- package/dist/packages/@ember/-internals/routing/lib/utils.js +23 -11
- package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +1 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +32 -32
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +1 -0
- package/dist/packages/@ember/-internals/runtime/lib/mixins/comparable.js +4 -4
- package/dist/packages/@ember/-internals/runtime/lib/mixins/container_proxy.js +29 -29
- package/dist/packages/@ember/-internals/runtime/lib/mixins/promise_proxy.js +16 -16
- package/dist/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +48 -48
- package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +8 -8
- package/dist/packages/@ember/-internals/runtime/lib/system/namespace.js +1 -2
- package/dist/packages/@ember/-internals/runtime/lib/type-of.js +1 -1
- package/dist/packages/@ember/-internals/utils/index.js +9 -9
- package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +2 -4
- package/dist/packages/@ember/-internals/views/lib/system/utils.js +1 -0
- package/dist/packages/@ember/application/lib/application.js +0 -2
- package/dist/packages/@ember/array/index.js +1 -1
- package/dist/packages/@ember/debug/index.js +1 -1
- package/dist/packages/@ember/debug/lib/deprecate.js +12 -10
- package/dist/packages/@ember/object/compat.js +16 -7
- package/dist/packages/@ember/polyfills/lib/assign.js +1 -0
- package/dist/packages/@ember/runloop/index.js +9 -9
- package/dist/packages/@ember/string/index.js +1 -0
- package/dist/packages/ember/index.js +1 -2
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +2375 -1676
- package/package.json +21 -21
- package/blueprints/component-addon/native-files/__root__/__path__/__name__.js +0 -1
- package/blueprints/component-class-addon/native-files/__root__/__path__/__name__.js +0 -1
- package/blueprints/controller/native-files/__root__/__path__/__name__.js +0 -4
- package/blueprints/edition-detector.js +0 -13
- package/blueprints/route/native-files/__root__/__path__/__name__.js +0 -11
- package/blueprints/route/native-files/__root__/__templatepath__/__templatename__.hbs +0 -2
- package/blueprints/service/native-files/__root__/__path__/__name__.js +0 -4
package/dist/header/license.js
CHANGED
package/dist/header/loader.js
CHANGED
|
@@ -2,9 +2,7 @@ import require from 'require';
|
|
|
2
2
|
|
|
3
3
|
(function bootstrap() {
|
|
4
4
|
// Bootstrap Node module
|
|
5
|
-
// eslint-disable-next-line no-undef
|
|
6
5
|
if (typeof module === 'object' && typeof module.require === 'function') {
|
|
7
|
-
// tslint:disable-next-line: no-require-imports
|
|
8
6
|
module.exports = require('ember').default;
|
|
9
7
|
}
|
|
10
8
|
})();
|
|
@@ -386,7 +386,6 @@ function getFactoryFor(obj) {
|
|
|
386
386
|
function setFactoryFor(obj, factory) {
|
|
387
387
|
obj[INIT_FACTORY] = factory;
|
|
388
388
|
}
|
|
389
|
-
|
|
390
389
|
class FactoryManager {
|
|
391
390
|
constructor(container, factory, fullName, normalizedName) {
|
|
392
391
|
this.container = container;
|
|
@@ -811,6 +810,7 @@ class Registry {
|
|
|
811
810
|
url: 'https://deprecations.emberjs.com/v4.x#toc_implicit-injections',
|
|
812
811
|
for: 'ember-source',
|
|
813
812
|
since: {
|
|
813
|
+
available: '4.0.0',
|
|
814
814
|
enabled: '4.0.0'
|
|
815
815
|
}
|
|
816
816
|
});
|
|
@@ -51,7 +51,7 @@ export default EmberObject.extend({
|
|
|
51
51
|
The resolver instance of the application
|
|
52
52
|
being debugged. This property will be injected
|
|
53
53
|
on creation.
|
|
54
|
-
|
|
54
|
+
@property resolver
|
|
55
55
|
@default null
|
|
56
56
|
@public
|
|
57
57
|
*/
|
|
@@ -60,7 +60,7 @@ export default EmberObject.extend({
|
|
|
60
60
|
/**
|
|
61
61
|
Returns true if it is possible to catalog a list of available
|
|
62
62
|
classes in the resolver for a given type.
|
|
63
|
-
|
|
63
|
+
@method canCatalogEntriesByType
|
|
64
64
|
@param {String} type The type. e.g. "model", "controller", "route".
|
|
65
65
|
@return {boolean} whether a list is available for this type.
|
|
66
66
|
@public
|
|
@@ -75,7 +75,7 @@ export default EmberObject.extend({
|
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
Returns the available classes a given type.
|
|
78
|
-
|
|
78
|
+
@method catalogEntriesByType
|
|
79
79
|
@param {String} type The type. e.g. "model", "controller", "route".
|
|
80
80
|
@return {Array} An array of strings.
|
|
81
81
|
@public
|
|
@@ -16,25 +16,6 @@ function iterate(arr, fn) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
class RecordsWatcher {
|
|
19
|
-
getCacheForItem(record) {
|
|
20
|
-
let recordCache = this.recordCaches.get(record);
|
|
21
|
-
|
|
22
|
-
if (!recordCache) {
|
|
23
|
-
let hasBeenAdded = false;
|
|
24
|
-
recordCache = createCache(() => {
|
|
25
|
-
if (!hasBeenAdded) {
|
|
26
|
-
this.added.push(this.wrapRecord(record));
|
|
27
|
-
hasBeenAdded = true;
|
|
28
|
-
} else {
|
|
29
|
-
this.updated.push(this.wrapRecord(record));
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
this.recordCaches.set(record, recordCache);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return recordCache;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
19
|
constructor(records, recordsAdded, recordsUpdated, recordsRemoved, wrapRecord, release) {
|
|
39
20
|
this.recordCaches = new Map();
|
|
40
21
|
this.added = [];
|
|
@@ -78,6 +59,25 @@ class RecordsWatcher {
|
|
|
78
59
|
});
|
|
79
60
|
}
|
|
80
61
|
|
|
62
|
+
getCacheForItem(record) {
|
|
63
|
+
let recordCache = this.recordCaches.get(record);
|
|
64
|
+
|
|
65
|
+
if (!recordCache) {
|
|
66
|
+
let hasBeenAdded = false;
|
|
67
|
+
recordCache = createCache(() => {
|
|
68
|
+
if (!hasBeenAdded) {
|
|
69
|
+
this.added.push(this.wrapRecord(record));
|
|
70
|
+
hasBeenAdded = true;
|
|
71
|
+
} else {
|
|
72
|
+
this.updated.push(this.wrapRecord(record));
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
this.recordCaches.set(record, recordCache);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return recordCache;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
81
|
revalidate() {
|
|
82
82
|
getValue(this.recordArrayCache);
|
|
83
83
|
}
|
|
@@ -168,7 +168,7 @@ export default EmberObject.extend({
|
|
|
168
168
|
/**
|
|
169
169
|
The container-debug-adapter which is used
|
|
170
170
|
to list all models.
|
|
171
|
-
|
|
171
|
+
@property containerDebugAdapter
|
|
172
172
|
@default undefined
|
|
173
173
|
@since 1.5.0
|
|
174
174
|
@public
|
|
@@ -178,7 +178,7 @@ export default EmberObject.extend({
|
|
|
178
178
|
The number of attributes to send
|
|
179
179
|
as columns. (Enough to make the record
|
|
180
180
|
identifiable).
|
|
181
|
-
|
|
181
|
+
@private
|
|
182
182
|
@property attributeLimit
|
|
183
183
|
@default 3
|
|
184
184
|
@since 1.3.0
|
|
@@ -189,24 +189,24 @@ export default EmberObject.extend({
|
|
|
189
189
|
Ember Data > v1.0.0-beta.18
|
|
190
190
|
requires string model names to be passed
|
|
191
191
|
around instead of the actual factories.
|
|
192
|
-
|
|
192
|
+
This is a stamp for the Ember Inspector
|
|
193
193
|
to differentiate between the versions
|
|
194
194
|
to be able to support older versions too.
|
|
195
|
-
|
|
195
|
+
@public
|
|
196
196
|
@property acceptsModelName
|
|
197
197
|
*/
|
|
198
198
|
acceptsModelName: true,
|
|
199
199
|
|
|
200
200
|
/**
|
|
201
201
|
Map from records arrays to RecordsWatcher instances
|
|
202
|
-
|
|
202
|
+
@private
|
|
203
203
|
@property recordsWatchers
|
|
204
204
|
@since 3.26.0
|
|
205
205
|
*/
|
|
206
206
|
|
|
207
207
|
/**
|
|
208
208
|
Map from records arrays to TypeWatcher instances
|
|
209
|
-
|
|
209
|
+
@private
|
|
210
210
|
@property typeWatchers
|
|
211
211
|
@since 3.26.0
|
|
212
212
|
*/
|
|
@@ -214,15 +214,15 @@ export default EmberObject.extend({
|
|
|
214
214
|
/**
|
|
215
215
|
Callback that is currently scheduled on backburner end to flush and check
|
|
216
216
|
all active watchers.
|
|
217
|
-
|
|
217
|
+
@private
|
|
218
218
|
@property flushWatchers
|
|
219
219
|
@since 3.26.0
|
|
220
|
-
|
|
220
|
+
*/
|
|
221
221
|
|
|
222
222
|
/**
|
|
223
223
|
Stores all methods that clear observers.
|
|
224
224
|
These methods will be called on destruction.
|
|
225
|
-
|
|
225
|
+
@private
|
|
226
226
|
@property releaseMethods
|
|
227
227
|
@since 1.3.0
|
|
228
228
|
*/
|
|
@@ -231,7 +231,7 @@ export default EmberObject.extend({
|
|
|
231
231
|
Specifies how records can be filtered.
|
|
232
232
|
Records returned will need to have a `filterValues`
|
|
233
233
|
property with a key for every name in the returned array.
|
|
234
|
-
|
|
234
|
+
@public
|
|
235
235
|
@method getFilters
|
|
236
236
|
@return {Array} List of objects defining filters.
|
|
237
237
|
The object should have a `name` and `desc` property.
|
|
@@ -242,13 +242,13 @@ export default EmberObject.extend({
|
|
|
242
242
|
|
|
243
243
|
/**
|
|
244
244
|
Fetch the model types and observe them for changes.
|
|
245
|
-
|
|
245
|
+
@public
|
|
246
246
|
@method watchModelTypes
|
|
247
|
-
|
|
247
|
+
@param {Function} typesAdded Callback to call to add types.
|
|
248
248
|
Takes an array of objects containing wrapped types (returned from `wrapModelType`).
|
|
249
|
-
|
|
249
|
+
@param {Function} typesUpdated Callback to call when a type has changed.
|
|
250
250
|
Takes an array of objects containing wrapped types.
|
|
251
|
-
|
|
251
|
+
@return {Function} Method to call to remove all observers
|
|
252
252
|
*/
|
|
253
253
|
watchModelTypes(typesAdded, typesUpdated) {
|
|
254
254
|
let modelTypes = this.getModelTypes();
|
|
@@ -283,19 +283,19 @@ export default EmberObject.extend({
|
|
|
283
283
|
|
|
284
284
|
/**
|
|
285
285
|
Fetch the records of a given type and observe them for changes.
|
|
286
|
-
|
|
286
|
+
@public
|
|
287
287
|
@method watchRecords
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
@param {String} modelName The model name.
|
|
289
|
+
@param {Function} recordsAdded Callback to call to add records.
|
|
290
290
|
Takes an array of objects containing wrapped records.
|
|
291
291
|
The object should have the following properties:
|
|
292
292
|
columnValues: {Object} The key and value of a table cell.
|
|
293
293
|
object: {Object} The actual record object.
|
|
294
|
-
|
|
294
|
+
@param {Function} recordsUpdated Callback to call when a record has changed.
|
|
295
295
|
Takes an array of objects containing wrapped records.
|
|
296
|
-
|
|
296
|
+
@param {Function} recordsRemoved Callback to call when a record has removed.
|
|
297
297
|
Takes an array of objects containing wrapped records.
|
|
298
|
-
|
|
298
|
+
@return {Function} Method to call to remove all observers.
|
|
299
299
|
*/
|
|
300
300
|
watchRecords(modelName, recordsAdded, recordsUpdated, recordsRemoved) {
|
|
301
301
|
let klass = this._nameToClass(modelName);
|
|
@@ -355,9 +355,9 @@ export default EmberObject.extend({
|
|
|
355
355
|
|
|
356
356
|
/**
|
|
357
357
|
Detect whether a class is a model.
|
|
358
|
-
|
|
358
|
+
Test that against the model class
|
|
359
359
|
of your persistence library.
|
|
360
|
-
|
|
360
|
+
@public
|
|
361
361
|
@method detect
|
|
362
362
|
@return boolean Whether the class is a model class or not.
|
|
363
363
|
*/
|
|
@@ -367,7 +367,7 @@ export default EmberObject.extend({
|
|
|
367
367
|
|
|
368
368
|
/**
|
|
369
369
|
Get the columns for a given model type.
|
|
370
|
-
|
|
370
|
+
@public
|
|
371
371
|
@method columnsForType
|
|
372
372
|
@return {Array} An array of columns of the following format:
|
|
373
373
|
name: {String} The name of the column.
|
|
@@ -379,7 +379,7 @@ export default EmberObject.extend({
|
|
|
379
379
|
|
|
380
380
|
/**
|
|
381
381
|
Adds observers to a model type class.
|
|
382
|
-
|
|
382
|
+
@private
|
|
383
383
|
@method observeModelType
|
|
384
384
|
@param {String} modelName The model type name.
|
|
385
385
|
@param {Function} typesUpdated Called when a type is modified.
|
|
@@ -414,7 +414,7 @@ export default EmberObject.extend({
|
|
|
414
414
|
|
|
415
415
|
/**
|
|
416
416
|
Wraps a given model type and observes changes to it.
|
|
417
|
-
|
|
417
|
+
@private
|
|
418
418
|
@method wrapModelType
|
|
419
419
|
@param {Class} klass A model class.
|
|
420
420
|
@param {String} modelName Name of the class.
|
|
@@ -442,7 +442,7 @@ export default EmberObject.extend({
|
|
|
442
442
|
|
|
443
443
|
/**
|
|
444
444
|
Fetches all models defined in the application.
|
|
445
|
-
|
|
445
|
+
@private
|
|
446
446
|
@method getModelTypes
|
|
447
447
|
@return {Array} Array of model types.
|
|
448
448
|
*/
|
|
@@ -470,7 +470,7 @@ export default EmberObject.extend({
|
|
|
470
470
|
/**
|
|
471
471
|
Loops over all namespaces and all objects
|
|
472
472
|
attached to them.
|
|
473
|
-
|
|
473
|
+
@private
|
|
474
474
|
@method _getObjectsOnNamespaces
|
|
475
475
|
@return {Array} Array of model type strings.
|
|
476
476
|
*/
|
|
@@ -498,7 +498,7 @@ export default EmberObject.extend({
|
|
|
498
498
|
|
|
499
499
|
/**
|
|
500
500
|
Fetches all loaded records for a given type.
|
|
501
|
-
|
|
501
|
+
@public
|
|
502
502
|
@method getRecords
|
|
503
503
|
@return {Array} An array of records.
|
|
504
504
|
This array will be observed for changes,
|
|
@@ -510,7 +510,7 @@ export default EmberObject.extend({
|
|
|
510
510
|
|
|
511
511
|
/**
|
|
512
512
|
Wraps a record and observers changes to it.
|
|
513
|
-
|
|
513
|
+
@private
|
|
514
514
|
@method wrapRecord
|
|
515
515
|
@param {Object} record The record instance.
|
|
516
516
|
@return {Object} The wrapped record. Format:
|
|
@@ -530,7 +530,7 @@ export default EmberObject.extend({
|
|
|
530
530
|
|
|
531
531
|
/**
|
|
532
532
|
Gets the values for each column.
|
|
533
|
-
|
|
533
|
+
@public
|
|
534
534
|
@method getRecordColumnValues
|
|
535
535
|
@return {Object} Keys should match column names defined
|
|
536
536
|
by the model type.
|
|
@@ -541,7 +541,7 @@ export default EmberObject.extend({
|
|
|
541
541
|
|
|
542
542
|
/**
|
|
543
543
|
Returns keywords to match when searching records.
|
|
544
|
-
|
|
544
|
+
@public
|
|
545
545
|
@method getRecordKeywords
|
|
546
546
|
@return {Array} Relevant keywords for search.
|
|
547
547
|
*/
|
|
@@ -551,7 +551,7 @@ export default EmberObject.extend({
|
|
|
551
551
|
|
|
552
552
|
/**
|
|
553
553
|
Returns the values of filters defined by `getFilters`.
|
|
554
|
-
|
|
554
|
+
@public
|
|
555
555
|
@method getRecordFilterValues
|
|
556
556
|
@param {Object} record The record instance.
|
|
557
557
|
@return {Object} The filter values.
|
|
@@ -562,7 +562,7 @@ export default EmberObject.extend({
|
|
|
562
562
|
|
|
563
563
|
/**
|
|
564
564
|
Each record can have a color that represents its state.
|
|
565
|
-
|
|
565
|
+
@public
|
|
566
566
|
@method getRecordColor
|
|
567
567
|
@param {Object} record The record instance
|
|
568
568
|
@return {String} The records color.
|
|
@@ -2,11 +2,11 @@ import { templateFactory, programCompilationContext } from '@glimmer/opcode-comp
|
|
|
2
2
|
export { templateFactory as template, templateCacheCounters } from '@glimmer/opcode-compiler';
|
|
3
3
|
import { setOwner, getOwner } from '@ember/-internals/owner';
|
|
4
4
|
import { guidFor, symbol, enumerableSymbol, getDebugName, isProxy, isEmberArray, isObject, uuid } from '@ember/-internals/utils';
|
|
5
|
-
import { assert, warn, debugFreeze, deprecate } from '@ember/debug';
|
|
5
|
+
import { assert, warn, debugFreeze, inspect, deprecate } from '@ember/debug';
|
|
6
6
|
import { setComponentTemplate, setInternalComponentManager, setInternalHelperManager, getInternalHelperManager, helperCapabilities, setHelperManager, capabilityFlagsFrom, setInternalModifierManager, getComponentTemplate, getInternalComponentManager, componentCapabilities, modifierCapabilities, setComponentManager } from '@glimmer/manager';
|
|
7
7
|
import { createConstRef, isConstRef, valueForRef, isUpdatableRef, updateRef, childRefFor, childRefFromParts, createComputeRef, createPrimitiveRef, createUnboundRef, isInvokableRef, createInvokableRef, createReadOnlyRef, createDebugAliasRef, UNDEFINED_REFERENCE } from '@glimmer/reference';
|
|
8
8
|
import { untrack, consumeTag, createCache, getValue, tagFor, beginUntrackFrame, endUntrackFrame, valueForTag, beginTrackFrame, endTrackFrame, validateTag, createTag, dirtyTag, CONSTANT_TAG, isTracking, setTrackingTransactionEnv, createUpdatableTag, CURRENT_TAG } from '@glimmer/validator';
|
|
9
|
-
import { tracked, get, PROPERTY_DID_CHANGE, tagForObject, objectAt, tagForProperty, _getProp, _setProp
|
|
9
|
+
import { tracked, get, PROPERTY_DID_CHANGE, tagForObject, objectAt, tagForProperty, set, _getProp, _setProp } from '@ember/-internals/metal';
|
|
10
10
|
import { action } from '@ember/object';
|
|
11
11
|
import { hasDOM } from '@ember/-internals/browser-environment';
|
|
12
12
|
import { isSimpleClick, clearElementView, clearViewElement, getViewElement, MUTABLE_CELL, addChildView, setElementView, setViewElement, ActionSupport, ChildViewsSupport, ClassNamesSupport, CoreView, ViewMixin, ViewStateSupport, constructStyleDeprecationMessage, ActionManager, getViewId } from '@ember/-internals/views';
|
|
@@ -16,9 +16,9 @@ import { service } from '@ember/service';
|
|
|
16
16
|
import { DEBUG } from '@glimmer/env';
|
|
17
17
|
import { dasherize } from '@ember/string';
|
|
18
18
|
import { registerDestructor, associateDestroyableChild, destroy } from '@glimmer/destroyable';
|
|
19
|
-
import { join,
|
|
19
|
+
import { join, schedule, _backburner, _getCurrentRunLoop } from '@ember/runloop';
|
|
20
20
|
import { _WeakSet, EMPTY_ARRAY, unwrapTemplate, dict } from '@glimmer/util';
|
|
21
|
-
import { reifyPositional, normalizeProperty, EMPTY_ARGS, createCapturedArgs, curry, EMPTY_POSITIONAL, array, concat, fn, get as get$1, hash, on,
|
|
21
|
+
import { reifyPositional, normalizeProperty, EMPTY_ARGS, createCapturedArgs, curry, EMPTY_POSITIONAL, array, concat, fn, get as get$1, hash, on, templateOnlyComponent, TEMPLATE_ONLY_COMPONENT_MANAGER, clientBuilder, DOMChanges, DOMTreeConstruction, inTransaction, renderMain, runtimeContext, rehydrationBuilder } from '@glimmer/runtime';
|
|
22
22
|
export { DOMChanges, DOMTreeConstruction, isSerializationFirstNode } from '@glimmer/runtime';
|
|
23
23
|
import { TargetActionSupport, FrameworkObject, _contentFor, isArray } from '@ember/-internals/runtime';
|
|
24
24
|
import { ENV } from '@ember/-internals/environment';
|
|
@@ -975,9 +975,15 @@ class LinkTo extends InternalComponent {
|
|
|
975
975
|
try {
|
|
976
976
|
return routing.generateURL(route, models, query);
|
|
977
977
|
} catch (e) {
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
978
|
+
let details = e instanceof Error ? e.message : inspect(e);
|
|
979
|
+
let message = `While generating link to route "${route}": ${details}`;
|
|
980
|
+
|
|
981
|
+
if (e instanceof Error) {
|
|
982
|
+
e.message = message;
|
|
983
|
+
throw e;
|
|
984
|
+
} else {
|
|
985
|
+
throw message;
|
|
986
|
+
}
|
|
981
987
|
}
|
|
982
988
|
} else {
|
|
983
989
|
return routing.generateURL(route, models, query);
|
|
@@ -1023,8 +1029,7 @@ class LinkTo extends InternalComponent {
|
|
|
1023
1029
|
transition: undefined
|
|
1024
1030
|
};
|
|
1025
1031
|
flaggedInstrument('interaction.link-to', payload, () => {
|
|
1026
|
-
assert('[BUG] route can only be missing if isLoading is true', isPresent(route));
|
|
1027
|
-
|
|
1032
|
+
assert('[BUG] route can only be missing if isLoading is true', isPresent(route));
|
|
1028
1033
|
payload.transition = routing.transitionTo(route, models, query, replace);
|
|
1029
1034
|
});
|
|
1030
1035
|
}
|
|
@@ -1054,8 +1059,7 @@ class LinkTo extends InternalComponent {
|
|
|
1054
1059
|
} else {
|
|
1055
1060
|
return EMPTY_ARRAY$1;
|
|
1056
1061
|
}
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1062
|
+
}
|
|
1059
1063
|
|
|
1060
1064
|
get query() {
|
|
1061
1065
|
if ('query' in this.args.named) {
|
|
@@ -1155,8 +1159,7 @@ class LinkTo extends InternalComponent {
|
|
|
1155
1159
|
query,
|
|
1156
1160
|
routing
|
|
1157
1161
|
} = this;
|
|
1158
|
-
assert('[BUG] route can only be missing if isLoading is true', isPresent(route));
|
|
1159
|
-
|
|
1162
|
+
assert('[BUG] route can only be missing if isLoading is true', isPresent(route));
|
|
1160
1163
|
return routing.isActiveForRoute(models, query, route, state);
|
|
1161
1164
|
}
|
|
1162
1165
|
}
|
|
@@ -1491,8 +1494,8 @@ function installAttributeBinding(component, rootRef, parsed, operations) {
|
|
|
1491
1494
|
elementId = component.elementId;
|
|
1492
1495
|
}
|
|
1493
1496
|
|
|
1494
|
-
|
|
1495
|
-
operations.setAttribute('id',
|
|
1497
|
+
let elementIdRef = createPrimitiveRef(elementId);
|
|
1498
|
+
operations.setAttribute('id', elementIdRef, true, null);
|
|
1496
1499
|
return;
|
|
1497
1500
|
}
|
|
1498
1501
|
|
|
@@ -1962,7 +1965,6 @@ function makeClosureAction(context, target, action$$1, processArgs, debugKey) {
|
|
|
1962
1965
|
self = context;
|
|
1963
1966
|
fn$$1 = action$$1;
|
|
1964
1967
|
} else {
|
|
1965
|
-
// tslint:disable-next-line:max-line-length
|
|
1966
1968
|
assert(`An action could not be made for \`${debugKey || action$$1}\` in ${target}. Please confirm that you are using either a quoted action name (i.e. \`(action '${debugKey || 'myAction'}')\`) or a function available in ${target}.`, false);
|
|
1967
1969
|
}
|
|
1968
1970
|
|
|
@@ -2048,7 +2050,6 @@ const EMBER_VIEW_REF = createPrimitiveRef('ember-view');
|
|
|
2048
2050
|
|
|
2049
2051
|
function aliasIdToElementId(args, props) {
|
|
2050
2052
|
if (args.named.has('id')) {
|
|
2051
|
-
// tslint:disable-next-line:max-line-length
|
|
2052
2053
|
assert(`You cannot invoke a component with both 'id' and 'elementId' at the same time.`, !args.named.has('elementId'));
|
|
2053
2054
|
props.elementId = props.id;
|
|
2054
2055
|
}
|
|
@@ -2089,6 +2090,7 @@ class CurlyComponentManager {
|
|
|
2089
2090
|
layoutName
|
|
2090
2091
|
} = component;
|
|
2091
2092
|
let owner = getOwner(component);
|
|
2093
|
+
assert('Component is unexpectedly missing an owner', owner);
|
|
2092
2094
|
let factory;
|
|
2093
2095
|
|
|
2094
2096
|
if (layout === undefined) {
|
|
@@ -3141,7 +3143,7 @@ const Component = CoreView.extend(ChildViewsSupport, ViewStateSupport, ClassName
|
|
|
3141
3143
|
|
|
3142
3144
|
if (DEBUG && eventDispatcher && this.renderer._isInteractive && this.tagName === '') {
|
|
3143
3145
|
let eventNames = [];
|
|
3144
|
-
let events = eventDispatcher.finalEventNameMapping;
|
|
3146
|
+
let events = eventDispatcher.finalEventNameMapping;
|
|
3145
3147
|
|
|
3146
3148
|
for (let key in events) {
|
|
3147
3149
|
let methodName = events[key];
|
|
@@ -3152,14 +3154,14 @@ const Component = CoreView.extend(ChildViewsSupport, ViewStateSupport, ClassName
|
|
|
3152
3154
|
} // If in a tagless component, assert that no event handlers are defined
|
|
3153
3155
|
|
|
3154
3156
|
|
|
3155
|
-
assert(
|
|
3156
|
-
`You can not define \`${eventNames}\` function(s) to handle DOM event in the \`${this}\` tagless component since it doesn't have any DOM element.`, !eventNames.length);
|
|
3157
|
+
assert(`You can not define \`${eventNames}\` function(s) to handle DOM event in the \`${this}\` tagless component since it doesn't have any DOM element.`, !eventNames.length);
|
|
3157
3158
|
}
|
|
3158
3159
|
},
|
|
3159
3160
|
|
|
3160
3161
|
get _dispatcher() {
|
|
3161
3162
|
if (this.__dispatcher === undefined) {
|
|
3162
3163
|
let owner = getOwner(this);
|
|
3164
|
+
assert('Component is unexpectedly missing an owner', owner);
|
|
3163
3165
|
|
|
3164
3166
|
if (owner.lookup('-environment:main').isInteractive) {
|
|
3165
3167
|
this.__dispatcher = owner.lookup('event_dispatcher:main');
|
|
@@ -3418,60 +3420,15 @@ setInternalComponentManager(CURLY_COMPONENT_MANAGER, Component);
|
|
|
3418
3420
|
/**
|
|
3419
3421
|
@module @ember/component
|
|
3420
3422
|
*/
|
|
3423
|
+
var _a;
|
|
3421
3424
|
const RECOMPUTE_TAG = symbol('RECOMPUTE_TAG');
|
|
3422
|
-
|
|
3423
|
-
Ember Helpers are functions that can compute values, and are used in templates.
|
|
3424
|
-
For example, this code calls a helper named `format-currency`:
|
|
3425
|
-
|
|
3426
|
-
```app/templates/application.hbs
|
|
3427
|
-
<Cost @cents={{230}} />
|
|
3428
|
-
```
|
|
3425
|
+
const IS_CLASSIC_HELPER = Symbol('IS_CLASSIC_HELPER');
|
|
3429
3426
|
|
|
3430
|
-
|
|
3431
|
-
<div>{{format-currency @cents currency="$"}}</div>
|
|
3432
|
-
```
|
|
3433
|
-
|
|
3434
|
-
Additionally a helper can be called as a nested helper.
|
|
3435
|
-
In this example, we show the formatted currency value if the `showMoney`
|
|
3436
|
-
named argument is truthy.
|
|
3437
|
-
|
|
3438
|
-
```handlebars
|
|
3439
|
-
{{if @showMoney (format-currency @cents currency="$")}}
|
|
3440
|
-
```
|
|
3441
|
-
|
|
3442
|
-
Helpers defined using a class must provide a `compute` function. For example:
|
|
3443
|
-
|
|
3444
|
-
```app/helpers/format-currency.js
|
|
3445
|
-
import Helper from '@ember/component/helper';
|
|
3446
|
-
|
|
3447
|
-
export default class extends Helper {
|
|
3448
|
-
compute([cents], { currency }) {
|
|
3449
|
-
return `${currency}${cents * 0.01}`;
|
|
3450
|
-
}
|
|
3451
|
-
}
|
|
3452
|
-
```
|
|
3453
|
-
|
|
3454
|
-
Each time the input to a helper changes, the `compute` function will be
|
|
3455
|
-
called again.
|
|
3456
|
-
|
|
3457
|
-
As instances, these helpers also have access to the container and will accept
|
|
3458
|
-
injected dependencies.
|
|
3459
|
-
|
|
3460
|
-
Additionally, class helpers can call `recompute` to force a new computation.
|
|
3461
|
-
|
|
3462
|
-
@class Helper
|
|
3463
|
-
@extends CoreObject
|
|
3464
|
-
@public
|
|
3465
|
-
@since 1.13.0
|
|
3466
|
-
*/
|
|
3467
|
-
|
|
3468
|
-
let Helper = FrameworkObject.extend({
|
|
3427
|
+
class Helper extends FrameworkObject {
|
|
3469
3428
|
init() {
|
|
3470
|
-
|
|
3471
|
-
|
|
3429
|
+
super.init();
|
|
3472
3430
|
this[RECOMPUTE_TAG] = createTag();
|
|
3473
|
-
}
|
|
3474
|
-
|
|
3431
|
+
}
|
|
3475
3432
|
/**
|
|
3476
3433
|
On a class-based helper, it may be useful to force a recomputation of that
|
|
3477
3434
|
helpers value. This is akin to `rerender` on a component.
|
|
@@ -3495,14 +3452,17 @@ let Helper = FrameworkObject.extend({
|
|
|
3495
3452
|
@public
|
|
3496
3453
|
@since 1.13.0
|
|
3497
3454
|
*/
|
|
3455
|
+
|
|
3456
|
+
|
|
3498
3457
|
recompute() {
|
|
3499
3458
|
join(() => dirtyTag(this[RECOMPUTE_TAG]));
|
|
3500
3459
|
}
|
|
3501
3460
|
|
|
3502
|
-
}
|
|
3503
|
-
|
|
3461
|
+
}
|
|
3462
|
+
|
|
3463
|
+
_a = IS_CLASSIC_HELPER;
|
|
3504
3464
|
Helper.isHelperFactory = true;
|
|
3505
|
-
Helper[
|
|
3465
|
+
Helper[_a] = true;
|
|
3506
3466
|
function isClassicHelper(obj) {
|
|
3507
3467
|
return obj[IS_CLASSIC_HELPER] === true;
|
|
3508
3468
|
}
|
|
@@ -3519,7 +3479,7 @@ class ClassicHelperManager {
|
|
|
3519
3479
|
}
|
|
3520
3480
|
|
|
3521
3481
|
createHelper(definition, args) {
|
|
3522
|
-
let instance = definition
|
|
3482
|
+
let instance = isFactoryManager(definition) ? definition.create() : definition.create(this.ownerInjection);
|
|
3523
3483
|
return {
|
|
3524
3484
|
instance,
|
|
3525
3485
|
args
|
|
@@ -3546,11 +3506,15 @@ class ClassicHelperManager {
|
|
|
3546
3506
|
}
|
|
3547
3507
|
|
|
3548
3508
|
getDebugName(definition) {
|
|
3549
|
-
return getDebugName(definition.class['prototype']);
|
|
3509
|
+
return getDebugName((definition.class || definition)['prototype']);
|
|
3550
3510
|
}
|
|
3551
3511
|
|
|
3552
3512
|
}
|
|
3553
3513
|
|
|
3514
|
+
function isFactoryManager(obj) {
|
|
3515
|
+
return obj != null && 'class' in obj;
|
|
3516
|
+
}
|
|
3517
|
+
|
|
3554
3518
|
setHelperManager(owner => {
|
|
3555
3519
|
return new ClassicHelperManager(owner);
|
|
3556
3520
|
}, Helper);
|
|
@@ -4516,6 +4480,7 @@ const VM_DEPRECATION_OVERRIDES = [{
|
|
|
4516
4480
|
until: '4.4.0',
|
|
4517
4481
|
for: 'ember-source',
|
|
4518
4482
|
since: {
|
|
4483
|
+
available: '3.28.0',
|
|
4519
4484
|
enabled: '3.28.0'
|
|
4520
4485
|
}
|
|
4521
4486
|
}];
|
|
@@ -5744,13 +5709,11 @@ class DynamicScope {
|
|
|
5744
5709
|
}
|
|
5745
5710
|
|
|
5746
5711
|
get(key) {
|
|
5747
|
-
// tslint:disable-next-line:max-line-length
|
|
5748
5712
|
assert(`Using \`-get-dynamic-scope\` is only supported for \`outletState\` (you used \`${key}\`).`, key === 'outletState');
|
|
5749
5713
|
return this.outletState;
|
|
5750
5714
|
}
|
|
5751
5715
|
|
|
5752
5716
|
set(key, value) {
|
|
5753
|
-
// tslint:disable-next-line:max-line-length
|
|
5754
5717
|
assert(`Using \`-with-dynamic-scope\` is only supported for \`outletState\` (you used \`${key}\`).`, key === 'outletState');
|
|
5755
5718
|
this.outletState = value;
|
|
5756
5719
|
return value;
|
|
@@ -5773,6 +5736,7 @@ function errorLoopTransaction(fn$$1) {
|
|
|
5773
5736
|
// Noop the function so that we won't keep calling it and causing
|
|
5774
5737
|
// infinite looping failures;
|
|
5775
5738
|
fn$$1 = () => {
|
|
5739
|
+
// eslint-disable-next-line no-console
|
|
5776
5740
|
console.warn('Attempted to rerender, but the Ember application has had an unrecoverable error occur during render. You should reload the application after fixing the cause of the error.');
|
|
5777
5741
|
};
|
|
5778
5742
|
}
|
|
@@ -5949,12 +5913,13 @@ class Renderer {
|
|
|
5949
5913
|
let {
|
|
5950
5914
|
_viewRegistry
|
|
5951
5915
|
} = props;
|
|
5952
|
-
let document = getOwner(props).lookup('service:-document');
|
|
5953
|
-
let env = getOwner(props).lookup('-environment:main');
|
|
5954
5916
|
let owner = getOwner(props);
|
|
5917
|
+
assert('Renderer is unexpectedly missing an owner', owner);
|
|
5918
|
+
let document = owner.lookup('service:-document');
|
|
5919
|
+
let env = owner.lookup('-environment:main');
|
|
5955
5920
|
let rootTemplate = owner.lookup(privatize`template:-root`);
|
|
5956
5921
|
let builder = owner.lookup('service:-dom-builder');
|
|
5957
|
-
return new this(
|
|
5922
|
+
return new this(owner, document, env, rootTemplate, _viewRegistry, builder);
|
|
5958
5923
|
}
|
|
5959
5924
|
|
|
5960
5925
|
get debugRenderTree() {
|
|
@@ -6282,6 +6247,7 @@ class OutletView {
|
|
|
6282
6247
|
template: templateFactory$$1
|
|
6283
6248
|
} = options;
|
|
6284
6249
|
let owner = getOwner(options);
|
|
6250
|
+
assert('OutletView is unexpectedly missing an owner', owner);
|
|
6285
6251
|
let template = templateFactory$$1(owner);
|
|
6286
6252
|
return new OutletView(_environment, owner, template, namespace);
|
|
6287
6253
|
}
|
|
@@ -6319,7 +6285,9 @@ function setupApplicationRegistry(registry) {
|
|
|
6319
6285
|
// association won't leak
|
|
6320
6286
|
registry.register('service:-dom-builder', {
|
|
6321
6287
|
create(props) {
|
|
6322
|
-
let
|
|
6288
|
+
let owner = getOwner(props);
|
|
6289
|
+
assert('DomBuilderService is unexpectedly missing an owner', owner);
|
|
6290
|
+
let env = owner.lookup('-environment:main');
|
|
6323
6291
|
|
|
6324
6292
|
switch (env._renderMode) {
|
|
6325
6293
|
case 'serialize':
|