ember-source 4.4.0-alpha.3 → 4.4.0-alpha.6
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 +5 -1
- package/blueprints/-addon-import.js +9 -0
- package/blueprints/-maybe-polyfill-typescript-blueprints.js +17 -0
- package/blueprints/acceptance-test/index.js +8 -0
- package/blueprints/acceptance-test/mocha-rfc-232-files/tests/acceptance/{__name__-test.js → __name__-test.ts} +1 -1
- package/blueprints/acceptance-test/qunit-rfc-232-files/tests/acceptance/{__name__-test.js → __name__-test.ts} +1 -1
- package/blueprints/component/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/component/index.js +6 -1
- package/blueprints/component-addon/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/component-addon/index.js +9 -0
- package/blueprints/component-class/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/component-class/index.js +5 -0
- package/blueprints/component-class-addon/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/component-class-addon/index.js +9 -0
- package/blueprints/component-test/index.js +8 -0
- package/blueprints/component-test/mocha-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +2 -2
- package/blueprints/component-test/qunit-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +3 -3
- package/blueprints/controller/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/controller/index.js +10 -0
- package/blueprints/controller-test/index.js +10 -0
- package/blueprints/controller-test/mocha-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +1 -1
- package/blueprints/controller-test/qunit-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +1 -1
- package/blueprints/helper/files/__root__/__collection__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/helper/index.js +9 -0
- package/blueprints/helper-addon/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/helper-test/index.js +9 -0
- package/blueprints/helper-test/mocha-rfc-232-files/__root__/__testType__/__collection__/{__name__-test.js → __name__-test.ts} +1 -1
- package/blueprints/helper-test/qunit-rfc-232-files/__root__/__testType__/__collection__/{__name__-test.js → __name__-test.ts} +1 -1
- package/blueprints/initializer/files/__root__/initializers/__name__.ts +6 -0
- package/blueprints/initializer/index.js +9 -0
- package/blueprints/initializer-addon/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/initializer-test/index.js +8 -0
- package/blueprints/initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/{__name__-test.js → __name__-test.ts} +3 -1
- package/blueprints/initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.ts +37 -0
- package/blueprints/instance-initializer/files/__root__/instance-initializers/__name__.ts +6 -0
- package/blueprints/instance-initializer/index.js +9 -0
- package/blueprints/instance-initializer-addon/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/instance-initializer-test/index.js +8 -0
- package/blueprints/instance-initializer-test/mocha-rfc-232-files/__root__/__testType__/__path__/{__name__-test.js → __name__-test.ts} +5 -1
- package/blueprints/instance-initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/{__name__-test.js → __name__-test.ts} +6 -1
- package/blueprints/route/files/__root__/__path__/{__name__.js → __name__.ts} +2 -4
- package/blueprints/route/index.js +9 -0
- package/blueprints/route-addon/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/route-addon/index.js +9 -0
- package/blueprints/route-test/index.js +9 -0
- package/blueprints/route-test/mocha-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +1 -1
- package/blueprints/route-test/qunit-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +1 -1
- package/blueprints/service/files/__root__/__path__/{__name__.js → __name__.ts} +0 -0
- package/blueprints/service/index.js +10 -0
- package/blueprints/service-test/index.js +8 -0
- package/blueprints/service-test/mocha-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +1 -1
- package/blueprints/service-test/qunit-rfc-232-files/__root__/__testType__/__path__/{__test__.js → __test__.ts} +1 -1
- package/blueprints/util/files/__root__/utils/{__name__.js → __name__.ts} +0 -0
- package/blueprints/util/index.js +10 -0
- package/blueprints/util-test/index.js +8 -0
- package/blueprints/util-test/mocha-rfc-232-files/__root__/__testType__/{__name__-test.js → __name__-test.ts} +0 -0
- package/blueprints/util-test/qunit-rfc-232-files/__root__/__testType__/{__name__-test.js → __name__-test.ts} +0 -0
- package/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +15 -13
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +8 -4
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +478 -1149
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/container/index.js +1 -25
- package/dist/packages/@ember/-internals/extension-support/lib/container_debug_adapter.js +10 -19
- package/dist/packages/@ember/-internals/extension-support/lib/data_adapter.js +113 -112
- package/dist/packages/@ember/-internals/glimmer/index.js +117 -749
- package/dist/packages/@ember/-internals/metal/index.js +17 -22
- package/dist/packages/@ember/-internals/routing/lib/services/router.js +140 -145
- package/dist/packages/@ember/-internals/routing/lib/system/router.js +3 -1
- package/dist/packages/@ember/-internals/runtime/lib/ext/rsvp.js +8 -4
- package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +1 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +1 -1
- package/dist/packages/@ember/-internals/runtime/lib/mixins/promise_proxy.js +16 -16
- package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +8 -8
- package/dist/packages/@ember/-internals/views/lib/system/utils.js +4 -2
- package/dist/packages/@ember/-internals/views/lib/views/core_view.js +5 -22
- package/dist/packages/@ember/canary-features/index.js +1 -5
- package/dist/packages/@ember/debug/index.js +1 -1
- package/dist/packages/@ember/debug/lib/deprecate.js +6 -2
- package/dist/packages/@ember/renderer/index.js +21 -0
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +447 -260
- package/package.json +15 -12
- package/blueprints/initializer/files/__root__/initializers/__name__.js +0 -5
- package/blueprints/initializer-test/qunit-rfc-232-files/__root__/__testType__/__path__/__name__-test.js +0 -34
- package/blueprints/instance-initializer/files/__root__/instance-initializers/__name__.js +0 -5
|
@@ -1755,9 +1755,6 @@ function isPath(path) {
|
|
|
1755
1755
|
return typeof path === 'string' && firstDotIndexCache.get(path) !== -1;
|
|
1756
1756
|
}
|
|
1757
1757
|
|
|
1758
|
-
/**
|
|
1759
|
-
@module @ember/object
|
|
1760
|
-
*/
|
|
1761
1758
|
const PROXY_CONTENT = symbol('PROXY_CONTENT');
|
|
1762
1759
|
let getPossibleMandatoryProxyValue;
|
|
1763
1760
|
|
|
@@ -2759,7 +2756,7 @@ function mergeMixins(mixins, meta$$1, descs, values, base, keys, keysWithSuper)
|
|
|
2759
2756
|
} else if (mixins !== undefined) {
|
|
2760
2757
|
mergeMixins(mixins, meta$$1, descs, values, base, keys, keysWithSuper);
|
|
2761
2758
|
|
|
2762
|
-
if (currentMixin._without !== undefined) {
|
|
2759
|
+
if (currentMixin instanceof Mixin && currentMixin._without !== undefined) {
|
|
2763
2760
|
currentMixin._without.forEach(keyName => {
|
|
2764
2761
|
// deleting the key means we won't process the value
|
|
2765
2762
|
let index = keys.indexOf(keyName);
|
|
@@ -3421,30 +3418,28 @@ class TrackedDescriptor {
|
|
|
3421
3418
|
// NOTE: copied from: https://github.com/glimmerjs/glimmer.js/pull/358
|
|
3422
3419
|
|
|
3423
3420
|
const cached = (...args) => {
|
|
3424
|
-
|
|
3425
|
-
const [target, key, descriptor] = args; // Error on `@cached()`, `@cached(...args)`, and `@cached propName = value;`
|
|
3421
|
+
const [target, key, descriptor] = args; // Error on `@cached()`, `@cached(...args)`, and `@cached propName = value;`
|
|
3426
3422
|
|
|
3427
|
-
|
|
3423
|
+
if (DEBUG && target === undefined) throwCachedExtraneousParens();
|
|
3428
3424
|
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3425
|
+
if (DEBUG && (typeof target !== 'object' || typeof key !== 'string' || typeof descriptor !== 'object' || args.length !== 3)) {
|
|
3426
|
+
throwCachedInvalidArgsError(args);
|
|
3427
|
+
}
|
|
3432
3428
|
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3429
|
+
if (DEBUG && (!('get' in descriptor) || typeof descriptor.get !== 'function')) {
|
|
3430
|
+
throwCachedGetterOnlyError(key);
|
|
3431
|
+
}
|
|
3436
3432
|
|
|
3437
|
-
|
|
3438
|
-
|
|
3433
|
+
const caches = new WeakMap();
|
|
3434
|
+
const getter = descriptor.get;
|
|
3439
3435
|
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3436
|
+
descriptor.get = function () {
|
|
3437
|
+
if (!caches.has(this)) {
|
|
3438
|
+
caches.set(this, createCache(getter.bind(this)));
|
|
3439
|
+
}
|
|
3444
3440
|
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
}
|
|
3441
|
+
return getValue(caches.get(this));
|
|
3442
|
+
};
|
|
3448
3443
|
};
|
|
3449
3444
|
|
|
3450
3445
|
function throwCachedExtraneousParens() {
|
|
@@ -26,151 +26,6 @@ function cleanURL(url, rootURL) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
class RouterService extends Service.extend(Evented) {
|
|
29
|
-
constructor() {
|
|
30
|
-
super(...arguments);
|
|
31
|
-
/**
|
|
32
|
-
You can register a listener for events emitted by this service with `.on()`:
|
|
33
|
-
```app/routes/contact-form.js
|
|
34
|
-
import Route from '@ember/routing';
|
|
35
|
-
import { service } from '@ember/service';
|
|
36
|
-
export default class extends Route {
|
|
37
|
-
@service router;
|
|
38
|
-
activate() {
|
|
39
|
-
this.router.on('routeWillChange', (transition) => {
|
|
40
|
-
if (!transition.to.find(route => route.name === this.routeName)) {
|
|
41
|
-
alert("Please save or cancel your changes.");
|
|
42
|
-
transition.abort();
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
@method on
|
|
49
|
-
@param {String} eventName
|
|
50
|
-
@param {Function} callback
|
|
51
|
-
@public
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
You can unregister a listener for events emitted by this service with `.off()`:
|
|
56
|
-
```app/routes/contact-form.js
|
|
57
|
-
import Route from '@ember/routing';
|
|
58
|
-
import { service } from '@ember/service';
|
|
59
|
-
export default class extends Route {
|
|
60
|
-
@service router;
|
|
61
|
-
callback = (transition) => {
|
|
62
|
-
if (!transition.to.find(route => route.name === this.routeName)) {
|
|
63
|
-
alert("Please save or cancel your changes.");
|
|
64
|
-
transition.abort();
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
activate() {
|
|
68
|
-
this.router.on('routeWillChange', this.callback);
|
|
69
|
-
}
|
|
70
|
-
deactivate() {
|
|
71
|
-
this.router.off('routeWillChange', this.callback);
|
|
72
|
-
}
|
|
73
|
-
```
|
|
74
|
-
@method off
|
|
75
|
-
@param {String} eventName
|
|
76
|
-
@param {Function} callback
|
|
77
|
-
@public
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
The `routeWillChange` event is fired at the beginning of any
|
|
82
|
-
attempted transition with a `Transition` object as the sole
|
|
83
|
-
argument. This action can be used for aborting, redirecting,
|
|
84
|
-
or decorating the transition from the currently active routes.
|
|
85
|
-
A good example is preventing navigation when a form is
|
|
86
|
-
half-filled out:
|
|
87
|
-
```app/routes/contact-form.js
|
|
88
|
-
import Route from '@ember/routing';
|
|
89
|
-
import { service } from '@ember/service';
|
|
90
|
-
export default class extends Route {
|
|
91
|
-
@service router;
|
|
92
|
-
activate() {
|
|
93
|
-
this.router.on('routeWillChange', (transition) => {
|
|
94
|
-
if (!transition.to.find(route => route.name === this.routeName)) {
|
|
95
|
-
alert("Please save or cancel your changes.");
|
|
96
|
-
transition.abort();
|
|
97
|
-
}
|
|
98
|
-
})
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
```
|
|
102
|
-
The `routeWillChange` event fires whenever a new route is chosen as the desired target of a transition. This includes `transitionTo`, `replaceWith`, all redirection for any reason including error handling, and abort. Aborting implies changing the desired target back to where you already were. Once a transition has completed, `routeDidChange` fires.
|
|
103
|
-
@event routeWillChange
|
|
104
|
-
@param {Transition} transition
|
|
105
|
-
@public
|
|
106
|
-
*/
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
The `routeDidChange` event only fires once a transition has settled.
|
|
110
|
-
This includes aborts and error substates. Like the `routeWillChange` event
|
|
111
|
-
it receives a Transition as the sole argument.
|
|
112
|
-
A good example is sending some analytics when the route has transitioned:
|
|
113
|
-
```app/routes/contact-form.js
|
|
114
|
-
import Route from '@ember/routing';
|
|
115
|
-
import { service } from '@ember/service';
|
|
116
|
-
export default class extends Route {
|
|
117
|
-
@service router;
|
|
118
|
-
activate() {
|
|
119
|
-
this.router.on('routeDidChange', (transition) => {
|
|
120
|
-
ga.send('pageView', {
|
|
121
|
-
current: transition.to.name,
|
|
122
|
-
from: transition.from.name
|
|
123
|
-
});
|
|
124
|
-
})
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
```
|
|
128
|
-
`routeDidChange` will be called after any `Route`'s
|
|
129
|
-
[didTransition](/ember/release/classes/Route/events/didTransition?anchor=didTransition)
|
|
130
|
-
action has been fired.
|
|
131
|
-
The updates of properties
|
|
132
|
-
[currentURL](/ember/release/classes/RouterService/properties/currentURL?anchor=currentURL),
|
|
133
|
-
[currentRouteName](/ember/release/classes/RouterService/properties/currentURL?anchor=currentRouteName)
|
|
134
|
-
and
|
|
135
|
-
[currentRoute](/ember/release/classes/RouterService/properties/currentURL?anchor=currentRoute)
|
|
136
|
-
are completed at the time `routeDidChange` is called.
|
|
137
|
-
@event routeDidChange
|
|
138
|
-
@param {Transition} transition
|
|
139
|
-
@public
|
|
140
|
-
*/
|
|
141
|
-
// Canary features
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Refreshes all currently active routes, doing a full transition.
|
|
145
|
-
* If a route name is provided and refers to a currently active route,
|
|
146
|
-
* it will refresh only that route and its descendents.
|
|
147
|
-
* Returns a promise that will be resolved once the refresh is complete.
|
|
148
|
-
* All resetController, beforeModel, model, afterModel, redirect, and setupController
|
|
149
|
-
* hooks will be called again. You will get new data from the model hook.
|
|
150
|
-
*
|
|
151
|
-
* @method refresh
|
|
152
|
-
* @param {String} [routeName] the route to refresh (along with all child routes)
|
|
153
|
-
* @return Transition
|
|
154
|
-
* @category EMBER_ROUTING_ROUTER_SERVICE_REFRESH
|
|
155
|
-
* @public
|
|
156
|
-
*/
|
|
157
|
-
|
|
158
|
-
this.refresh = true
|
|
159
|
-
/* EMBER_ROUTING_ROUTER_SERVICE_REFRESH */
|
|
160
|
-
? function (pivotRouteName) {
|
|
161
|
-
if (!pivotRouteName) {
|
|
162
|
-
return this._router._routerMicrolib.refresh();
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
assert(`The route "${pivotRouteName}" was not found`, this._router.hasRoute(pivotRouteName));
|
|
166
|
-
assert(`The route "${pivotRouteName}" is currently not active`, this.isActive(pivotRouteName));
|
|
167
|
-
let owner = getOwner(this);
|
|
168
|
-
assert('RouterService is unexpectedly missing an owner', owner);
|
|
169
|
-
let pivotRoute = owner.lookup(`route:${pivotRouteName}`);
|
|
170
|
-
return this._router._routerMicrolib.refresh(pivotRoute);
|
|
171
|
-
} : undefined;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
29
|
get _router() {
|
|
175
30
|
let router = this[ROUTER];
|
|
176
31
|
|
|
@@ -494,6 +349,146 @@ class RouterService extends Service.extend(Evented) {
|
|
|
494
349
|
let internalURL = cleanURL(url, this.rootURL);
|
|
495
350
|
return this._router._routerMicrolib.recognizeAndLoad(internalURL);
|
|
496
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
You can register a listener for events emitted by this service with `.on()`:
|
|
354
|
+
```app/routes/contact-form.js
|
|
355
|
+
import Route from '@ember/routing';
|
|
356
|
+
import { service } from '@ember/service';
|
|
357
|
+
export default class extends Route {
|
|
358
|
+
@service router;
|
|
359
|
+
activate() {
|
|
360
|
+
this.router.on('routeWillChange', (transition) => {
|
|
361
|
+
if (!transition.to.find(route => route.name === this.routeName)) {
|
|
362
|
+
alert("Please save or cancel your changes.");
|
|
363
|
+
transition.abort();
|
|
364
|
+
}
|
|
365
|
+
})
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
@method on
|
|
370
|
+
@param {String} eventName
|
|
371
|
+
@param {Function} callback
|
|
372
|
+
@public
|
|
373
|
+
*/
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
You can unregister a listener for events emitted by this service with `.off()`:
|
|
377
|
+
```app/routes/contact-form.js
|
|
378
|
+
import Route from '@ember/routing';
|
|
379
|
+
import { service } from '@ember/service';
|
|
380
|
+
export default class extends Route {
|
|
381
|
+
@service router;
|
|
382
|
+
callback = (transition) => {
|
|
383
|
+
if (!transition.to.find(route => route.name === this.routeName)) {
|
|
384
|
+
alert("Please save or cancel your changes.");
|
|
385
|
+
transition.abort();
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
activate() {
|
|
389
|
+
this.router.on('routeWillChange', this.callback);
|
|
390
|
+
}
|
|
391
|
+
deactivate() {
|
|
392
|
+
this.router.off('routeWillChange', this.callback);
|
|
393
|
+
}
|
|
394
|
+
```
|
|
395
|
+
@method off
|
|
396
|
+
@param {String} eventName
|
|
397
|
+
@param {Function} callback
|
|
398
|
+
@public
|
|
399
|
+
*/
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
The `routeWillChange` event is fired at the beginning of any
|
|
403
|
+
attempted transition with a `Transition` object as the sole
|
|
404
|
+
argument. This action can be used for aborting, redirecting,
|
|
405
|
+
or decorating the transition from the currently active routes.
|
|
406
|
+
A good example is preventing navigation when a form is
|
|
407
|
+
half-filled out:
|
|
408
|
+
```app/routes/contact-form.js
|
|
409
|
+
import Route from '@ember/routing';
|
|
410
|
+
import { service } from '@ember/service';
|
|
411
|
+
export default class extends Route {
|
|
412
|
+
@service router;
|
|
413
|
+
activate() {
|
|
414
|
+
this.router.on('routeWillChange', (transition) => {
|
|
415
|
+
if (!transition.to.find(route => route.name === this.routeName)) {
|
|
416
|
+
alert("Please save or cancel your changes.");
|
|
417
|
+
transition.abort();
|
|
418
|
+
}
|
|
419
|
+
})
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
```
|
|
423
|
+
The `routeWillChange` event fires whenever a new route is chosen as the desired target of a transition. This includes `transitionTo`, `replaceWith`, all redirection for any reason including error handling, and abort. Aborting implies changing the desired target back to where you already were. Once a transition has completed, `routeDidChange` fires.
|
|
424
|
+
@event routeWillChange
|
|
425
|
+
@param {Transition} transition
|
|
426
|
+
@public
|
|
427
|
+
*/
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
The `routeDidChange` event only fires once a transition has settled.
|
|
431
|
+
This includes aborts and error substates. Like the `routeWillChange` event
|
|
432
|
+
it receives a Transition as the sole argument.
|
|
433
|
+
A good example is sending some analytics when the route has transitioned:
|
|
434
|
+
```app/routes/contact-form.js
|
|
435
|
+
import Route from '@ember/routing';
|
|
436
|
+
import { service } from '@ember/service';
|
|
437
|
+
export default class extends Route {
|
|
438
|
+
@service router;
|
|
439
|
+
activate() {
|
|
440
|
+
this.router.on('routeDidChange', (transition) => {
|
|
441
|
+
ga.send('pageView', {
|
|
442
|
+
current: transition.to.name,
|
|
443
|
+
from: transition.from.name
|
|
444
|
+
});
|
|
445
|
+
})
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
```
|
|
449
|
+
`routeDidChange` will be called after any `Route`'s
|
|
450
|
+
[didTransition](/ember/release/classes/Route/events/didTransition?anchor=didTransition)
|
|
451
|
+
action has been fired.
|
|
452
|
+
The updates of properties
|
|
453
|
+
[currentURL](/ember/release/classes/RouterService/properties/currentURL?anchor=currentURL),
|
|
454
|
+
[currentRouteName](/ember/release/classes/RouterService/properties/currentURL?anchor=currentRouteName)
|
|
455
|
+
and
|
|
456
|
+
[currentRoute](/ember/release/classes/RouterService/properties/currentURL?anchor=currentRoute)
|
|
457
|
+
are completed at the time `routeDidChange` is called.
|
|
458
|
+
@event routeDidChange
|
|
459
|
+
@param {Transition} transition
|
|
460
|
+
@public
|
|
461
|
+
*/
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Refreshes all currently active routes, doing a full transition.
|
|
465
|
+
* If a route name is provided and refers to a currently active route,
|
|
466
|
+
* it will refresh only that route and its descendents.
|
|
467
|
+
* Returns a promise that will be resolved once the refresh is complete.
|
|
468
|
+
* All resetController, beforeModel, model, afterModel, redirect, and setupController
|
|
469
|
+
* hooks will be called again. You will get new data from the model hook.
|
|
470
|
+
*
|
|
471
|
+
* @method refresh
|
|
472
|
+
* @param {String} [routeName] the route to refresh (along with all child routes)
|
|
473
|
+
* @return Transition
|
|
474
|
+
* @public
|
|
475
|
+
*/
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
refresh(pivotRouteName) {
|
|
479
|
+
if (!pivotRouteName) {
|
|
480
|
+
return this._router._routerMicrolib.refresh();
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
assert(`The route "${pivotRouteName}" was not found`, this._router.hasRoute(pivotRouteName));
|
|
484
|
+
assert(`The route "${pivotRouteName}" is currently not active`, this.isActive(pivotRouteName));
|
|
485
|
+
let owner = getOwner(this);
|
|
486
|
+
assert('RouterService is unexpectedly missing an owner', owner);
|
|
487
|
+
let pivotRoute = owner.lookup(`route:${pivotRouteName}`); // R could be instantiated with a different sub-type
|
|
488
|
+
// @ts-ignore
|
|
489
|
+
|
|
490
|
+
return this._router._routerMicrolib.refresh(pivotRoute);
|
|
491
|
+
}
|
|
497
492
|
|
|
498
493
|
}
|
|
499
494
|
|
|
@@ -225,6 +225,8 @@ class EmberRouter extends EmberObject.extend(Evented) {
|
|
|
225
225
|
seen[name] = true;
|
|
226
226
|
|
|
227
227
|
if (!route) {
|
|
228
|
+
// SAFETY: this is configured in `commonSetupRegistry` in the
|
|
229
|
+
// `@ember/application/lib` package.
|
|
228
230
|
let DefaultRoute = routeOwner.factoryFor('route:basic').class;
|
|
229
231
|
routeOwner.register(fullRouteName, DefaultRoute.extend());
|
|
230
232
|
route = routeOwner.lookup(fullRouteName);
|
|
@@ -1629,7 +1631,7 @@ function representEmptyRoute(liveRoutes, defaultParentState, {
|
|
|
1629
1631
|
// Create an entry to represent our default template name,
|
|
1630
1632
|
// just so other routes can target it and inherit its place
|
|
1631
1633
|
// in the outlet hierarchy.
|
|
1632
|
-
defaultParentState.outlets
|
|
1634
|
+
defaultParentState.outlets['main'] = {
|
|
1633
1635
|
render: {
|
|
1634
1636
|
name: routeName,
|
|
1635
1637
|
outlet: 'main'
|
|
@@ -25,13 +25,17 @@ export function onerrorDefault(reason) {
|
|
|
25
25
|
|
|
26
26
|
function errorFor(reason) {
|
|
27
27
|
if (!reason) return;
|
|
28
|
+
let withErrorThrown = reason;
|
|
28
29
|
|
|
29
|
-
if (
|
|
30
|
-
return unwrapErrorThrown(
|
|
30
|
+
if (withErrorThrown.errorThrown) {
|
|
31
|
+
return unwrapErrorThrown(withErrorThrown);
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
let withName = reason;
|
|
35
|
+
|
|
36
|
+
if (withName.name === 'UnrecognizedURLError') {
|
|
37
|
+
assert(`The URL '${withName.message}' did not match any routes in your application`, false); // @ts-expect-error We'll hit this if the assert is stripped
|
|
38
|
+
|
|
35
39
|
return;
|
|
36
40
|
}
|
|
37
41
|
|
|
@@ -1351,7 +1351,7 @@ const MutableArray = Mixin.create(ArrayMixin, MutableEnumerable, {
|
|
|
1351
1351
|
colors.unshiftObjects('yellow'); // Type Error: 'undefined' is not a function
|
|
1352
1352
|
```
|
|
1353
1353
|
@method unshiftObjects
|
|
1354
|
-
@param {
|
|
1354
|
+
@param {Enumerable} objects the objects to add
|
|
1355
1355
|
@return {EmberArray} receiver
|
|
1356
1356
|
@public
|
|
1357
1357
|
*/
|
|
@@ -98,7 +98,7 @@ export default Mixin.create({
|
|
|
98
98
|
/**
|
|
99
99
|
If the proxied promise is rejected this will contain the reason
|
|
100
100
|
provided.
|
|
101
|
-
|
|
101
|
+
@property reason
|
|
102
102
|
@default null
|
|
103
103
|
@public
|
|
104
104
|
*/
|
|
@@ -106,7 +106,7 @@ export default Mixin.create({
|
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
108
|
Once the proxied promise has settled this will become `false`.
|
|
109
|
-
|
|
109
|
+
@property isPending
|
|
110
110
|
@default true
|
|
111
111
|
@public
|
|
112
112
|
*/
|
|
@@ -116,7 +116,7 @@ export default Mixin.create({
|
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
Once the proxied promise has settled this will become `true`.
|
|
119
|
-
|
|
119
|
+
@property isSettled
|
|
120
120
|
@default false
|
|
121
121
|
@public
|
|
122
122
|
*/
|
|
@@ -126,7 +126,7 @@ export default Mixin.create({
|
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
128
|
Will become `true` if the proxied promise is rejected.
|
|
129
|
-
|
|
129
|
+
@property isRejected
|
|
130
130
|
@default false
|
|
131
131
|
@public
|
|
132
132
|
*/
|
|
@@ -134,7 +134,7 @@ export default Mixin.create({
|
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
136
|
Will become `true` if the proxied promise is fulfilled.
|
|
137
|
-
|
|
137
|
+
@property isFulfilled
|
|
138
138
|
@default false
|
|
139
139
|
@public
|
|
140
140
|
*/
|
|
@@ -142,17 +142,17 @@ export default Mixin.create({
|
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
144
|
The promise whose fulfillment value is being proxied by this object.
|
|
145
|
-
|
|
145
|
+
This property must be specified upon creation, and should not be
|
|
146
146
|
changed once created.
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
Example:
|
|
148
|
+
```javascript
|
|
149
149
|
import ObjectProxy from '@ember/object/proxy';
|
|
150
150
|
import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
|
|
151
|
-
|
|
151
|
+
ObjectProxy.extend(PromiseProxyMixin).create({
|
|
152
152
|
promise: <thenable>
|
|
153
153
|
});
|
|
154
154
|
```
|
|
155
|
-
|
|
155
|
+
@property promise
|
|
156
156
|
@public
|
|
157
157
|
*/
|
|
158
158
|
promise: computed({
|
|
@@ -168,8 +168,8 @@ export default Mixin.create({
|
|
|
168
168
|
|
|
169
169
|
/**
|
|
170
170
|
An alias to the proxied promise's `then`.
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
See RSVP.Promise.then.
|
|
172
|
+
@method then
|
|
173
173
|
@param {Function} callback
|
|
174
174
|
@return {RSVP.Promise}
|
|
175
175
|
@public
|
|
@@ -178,8 +178,8 @@ export default Mixin.create({
|
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
180
|
An alias to the proxied promise's `catch`.
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
See RSVP.Promise.catch.
|
|
182
|
+
@method catch
|
|
183
183
|
@param {Function} callback
|
|
184
184
|
@return {RSVP.Promise}
|
|
185
185
|
@since 1.3.0
|
|
@@ -189,8 +189,8 @@ export default Mixin.create({
|
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
191
|
An alias to the proxied promise's `finally`.
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
See RSVP.Promise.finally.
|
|
193
|
+
@method finally
|
|
194
194
|
@param {Function} callback
|
|
195
195
|
@return {RSVP.Promise}
|
|
196
196
|
@since 1.3.0
|
|
@@ -41,9 +41,9 @@ const TargetActionSupport = Mixin.create({
|
|
|
41
41
|
/**
|
|
42
42
|
Send an `action` with an `actionContext` to a `target`. The action, actionContext
|
|
43
43
|
and target will be retrieved from properties of the object. For example:
|
|
44
|
-
|
|
44
|
+
```javascript
|
|
45
45
|
import { alias } from '@ember/object/computed';
|
|
46
|
-
|
|
46
|
+
App.SaveButtonView = Ember.View.extend(Ember.TargetActionSupport, {
|
|
47
47
|
target: alias('controller'),
|
|
48
48
|
action: 'save',
|
|
49
49
|
actionContext: alias('context'),
|
|
@@ -53,9 +53,9 @@ const TargetActionSupport = Mixin.create({
|
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
```
|
|
56
|
-
|
|
56
|
+
The `target`, `action`, and `actionContext` can be provided as properties of
|
|
57
57
|
an optional object argument to `triggerAction` as well.
|
|
58
|
-
|
|
58
|
+
```javascript
|
|
59
59
|
App.SaveButtonView = Ember.View.extend(Ember.TargetActionSupport, {
|
|
60
60
|
click() {
|
|
61
61
|
this.triggerAction({
|
|
@@ -67,12 +67,12 @@ const TargetActionSupport = Mixin.create({
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
```
|
|
70
|
-
|
|
70
|
+
The `actionContext` defaults to the object you are mixing `TargetActionSupport` into.
|
|
71
71
|
But `target` and `action` must be specified either as properties or with the argument
|
|
72
72
|
to `triggerAction`, or a combination:
|
|
73
|
-
|
|
73
|
+
```javascript
|
|
74
74
|
import { alias } from '@ember/object/computed';
|
|
75
|
-
|
|
75
|
+
App.SaveButtonView = Ember.View.extend(Ember.TargetActionSupport, {
|
|
76
76
|
target: alias('controller'),
|
|
77
77
|
click() {
|
|
78
78
|
this.triggerAction({
|
|
@@ -82,7 +82,7 @@ const TargetActionSupport = Mixin.create({
|
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
```
|
|
85
|
-
|
|
85
|
+
@method triggerAction
|
|
86
86
|
@param opts {Object} (optional, with the optional keys action, target and/or actionContext)
|
|
87
87
|
@return {Boolean} true if the action was sent successfully and did not return false
|
|
88
88
|
@private
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { getOwner } from '@ember/-internals/owner';
|
|
2
|
-
/* globals Element */
|
|
3
|
-
|
|
4
2
|
import { guidFor } from '@ember/-internals/utils';
|
|
5
3
|
import { assert } from '@ember/debug';
|
|
6
4
|
/**
|
|
@@ -8,6 +6,10 @@ import { assert } from '@ember/debug';
|
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
8
|
export function isSimpleClick(event) {
|
|
9
|
+
if (!(event instanceof MouseEvent)) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
|
|
11
13
|
let modifier = event.shiftKey || event.metaKey || event.altKey || event.ctrlKey;
|
|
12
14
|
let secondaryClick = event.which > 1; // IE9 may return undefined
|
|
13
15
|
|
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
import { inject } from '@ember/-internals/metal';
|
|
2
2
|
import { ActionHandler, Evented, FrameworkObject } from '@ember/-internals/runtime';
|
|
3
3
|
import states from './states';
|
|
4
|
-
/**
|
|
5
|
-
`Ember.CoreView` is an abstract class that exists to give view-like behavior
|
|
6
|
-
to both Ember's main view class `Component` and other classes that don't need
|
|
7
|
-
the full functionality of `Component`.
|
|
8
|
-
|
|
9
|
-
Unless you have specific needs for `CoreView`, you will use `Component`
|
|
10
|
-
in your applications.
|
|
11
|
-
|
|
12
|
-
@class CoreView
|
|
13
|
-
@namespace Ember
|
|
14
|
-
@extends EmberObject
|
|
15
|
-
@deprecated Use `Component` instead.
|
|
16
|
-
@uses Evented
|
|
17
|
-
@uses Ember.ActionHandler
|
|
18
|
-
@private
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
4
|
const CoreView = FrameworkObject.extend(Evented, ActionHandler, {
|
|
22
5
|
isView: true,
|
|
23
6
|
_states: states,
|
|
@@ -34,7 +17,7 @@ const CoreView = FrameworkObject.extend(Evented, ActionHandler, {
|
|
|
34
17
|
/**
|
|
35
18
|
If the view is currently inserted into the DOM of a parent view, this
|
|
36
19
|
property will point to the parent of the view.
|
|
37
|
-
|
|
20
|
+
@property parentView
|
|
38
21
|
@type Ember.View
|
|
39
22
|
@default null
|
|
40
23
|
@private
|
|
@@ -42,16 +25,16 @@ const CoreView = FrameworkObject.extend(Evented, ActionHandler, {
|
|
|
42
25
|
parentView: null,
|
|
43
26
|
|
|
44
27
|
instrumentDetails(hash) {
|
|
45
|
-
hash
|
|
46
|
-
hash
|
|
47
|
-
hash
|
|
28
|
+
hash['object'] = this.toString();
|
|
29
|
+
hash['containerKey'] = this._debugContainerKey;
|
|
30
|
+
hash['view'] = this;
|
|
48
31
|
return hash;
|
|
49
32
|
},
|
|
50
33
|
|
|
51
34
|
/**
|
|
52
35
|
Override the default event firing from `Evented` to
|
|
53
36
|
also call methods with the given name.
|
|
54
|
-
|
|
37
|
+
@method trigger
|
|
55
38
|
@param name {String}
|
|
56
39
|
@private
|
|
57
40
|
*/
|
|
@@ -13,9 +13,7 @@ import { ENV } from '@ember/-internals/environment';
|
|
|
13
13
|
export const DEFAULT_FEATURES = {
|
|
14
14
|
EMBER_LIBRARIES_ISREGISTERED: null,
|
|
15
15
|
EMBER_IMPROVED_INSTRUMENTATION: null,
|
|
16
|
-
|
|
17
|
-
EMBER_CACHED: true,
|
|
18
|
-
EMBER_UNIQUE_ID_HELPER: null
|
|
16
|
+
EMBER_UNIQUE_ID_HELPER: true
|
|
19
17
|
};
|
|
20
18
|
/**
|
|
21
19
|
The hash of enabled Canary features. Add to this, any canary features
|
|
@@ -66,6 +64,4 @@ function featureValue(value) {
|
|
|
66
64
|
|
|
67
65
|
export const EMBER_LIBRARIES_ISREGISTERED = featureValue(FEATURES.EMBER_LIBRARIES_ISREGISTERED);
|
|
68
66
|
export const EMBER_IMPROVED_INSTRUMENTATION = featureValue(FEATURES.EMBER_IMPROVED_INSTRUMENTATION);
|
|
69
|
-
export const EMBER_ROUTING_ROUTER_SERVICE_REFRESH = featureValue(FEATURES.EMBER_ROUTING_ROUTER_SERVICE_REFRESH);
|
|
70
|
-
export const EMBER_CACHED = featureValue(FEATURES.EMBER_CACHED);
|
|
71
67
|
export const EMBER_UNIQUE_ID_HELPER = featureValue(FEATURES.EMBER_UNIQUE_ID_HELPER);
|
|
@@ -260,7 +260,7 @@ let _warnIfUsingStrippedFeatureFlags;
|
|
|
260
260
|
if (DEBUG && !isTesting()) {
|
|
261
261
|
if (typeof window !== 'undefined' && (isFirefox || isChrome) && window.addEventListener) {
|
|
262
262
|
window.addEventListener('load', () => {
|
|
263
|
-
if (document.documentElement && document.documentElement.dataset && !document.documentElement.dataset
|
|
263
|
+
if (document.documentElement && document.documentElement.dataset && !document.documentElement.dataset['emberExtension']) {
|
|
264
264
|
let downloadURL;
|
|
265
265
|
|
|
266
266
|
if (isChrome) {
|