ember-source 5.11.0-beta.2 → 5.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/build-metadata.json +3 -3
  2. package/dist/ember-template-compiler.js +48 -42
  3. package/dist/ember-testing.js +1 -1
  4. package/dist/ember.debug.js +23102 -23100
  5. package/dist/ember.prod.js +31562 -31563
  6. package/dist/packages/@ember/-internals/container/index.js +1 -1
  7. package/dist/packages/@ember/-internals/deprecations/index.js +2 -1
  8. package/dist/packages/@ember/-internals/glimmer/index.js +2 -1
  9. package/dist/packages/@ember/-internals/meta/lib/meta.js +4 -3
  10. package/dist/packages/@ember/-internals/metal/index.js +9 -8
  11. package/dist/packages/@ember/-internals/routing/index.js +6 -5
  12. package/dist/packages/@ember/-internals/runtime/lib/ext/rsvp.js +3 -2
  13. package/dist/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +6 -5
  14. package/dist/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +4 -3
  15. package/dist/packages/@ember/-internals/runtime/lib/mixins/container_proxy.js +1 -1
  16. package/dist/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +2 -1
  17. package/dist/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +4 -3
  18. package/dist/packages/@ember/-internals/string/index.js +1 -1
  19. package/dist/packages/@ember/-internals/utils/index.js +4 -4
  20. package/dist/packages/@ember/-internals/views/index.js +1 -1
  21. package/dist/packages/@ember/-internals/views/lib/compat/fallback-view-registry.js +1 -1
  22. package/dist/packages/@ember/-internals/views/lib/component_lookup.js +1 -1
  23. package/dist/packages/@ember/-internals/views/lib/mixins/action_support.js +5 -3
  24. package/dist/packages/@ember/-internals/views/lib/mixins/child_views_support.js +3 -3
  25. package/dist/packages/@ember/-internals/views/lib/mixins/class_names_support.js +4 -3
  26. package/dist/packages/@ember/-internals/views/lib/mixins/view_support.js +4 -3
  27. package/dist/packages/@ember/-internals/views/lib/system/event_dispatcher.js +6 -12
  28. package/dist/packages/@ember/-internals/views/lib/system/utils.js +3 -2
  29. package/dist/packages/@ember/-internals/views/lib/views/core_view.js +76 -8
  30. package/dist/packages/@ember/-internals/views/lib/views/states.js +4 -3
  31. package/dist/packages/@ember/application/index.js +16 -7
  32. package/dist/packages/@ember/application/instance.js +13 -9
  33. package/dist/packages/@ember/application/namespace.js +7 -6
  34. package/dist/packages/@ember/array/index.js +617 -11
  35. package/dist/packages/@ember/array/make.js +1 -0
  36. package/dist/packages/@ember/array/mutable.js +1 -1
  37. package/dist/packages/@ember/array/proxy.js +8 -5
  38. package/dist/packages/@ember/component/helper.js +4 -4
  39. package/dist/packages/@ember/component/index.js +4 -4
  40. package/dist/packages/@ember/controller/index.js +6 -6
  41. package/dist/packages/@ember/debug/container-debug-adapter.js +5 -4
  42. package/dist/packages/@ember/debug/data-adapter.js +7 -4
  43. package/dist/packages/@ember/debug/index.js +213 -4
  44. package/dist/packages/@ember/debug/lib/assert.js +47 -0
  45. package/dist/packages/@ember/debug/lib/deprecate.js +194 -4
  46. package/dist/packages/@ember/debug/lib/inspect.js +120 -2
  47. package/dist/packages/@ember/debug/lib/warn.js +94 -3
  48. package/dist/packages/@ember/engine/index.js +440 -17
  49. package/dist/packages/@ember/engine/instance.js +175 -11
  50. package/dist/packages/@ember/engine/parent.js +1 -0
  51. package/dist/packages/@ember/helper/index.js +4 -4
  52. package/dist/packages/@ember/instrumentation/index.js +2 -1
  53. package/dist/packages/@ember/modifier/index.js +13 -5
  54. package/dist/packages/@ember/modifier/on.js +15 -0
  55. package/dist/packages/@ember/object/-internals.js +6 -5
  56. package/dist/packages/@ember/object/compat.js +4 -3
  57. package/dist/packages/@ember/object/computed.js +4 -4
  58. package/dist/packages/@ember/object/core.js +861 -14
  59. package/dist/packages/@ember/object/evented.js +4 -4
  60. package/dist/packages/@ember/object/events.js +3 -3
  61. package/dist/packages/@ember/object/index.js +260 -9
  62. package/dist/packages/@ember/object/internals.js +1 -1
  63. package/dist/packages/@ember/object/lib/computed/computed_macros.js +8 -6
  64. package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +8 -4
  65. package/dist/packages/@ember/object/mixin.js +6 -5
  66. package/dist/packages/@ember/object/observable.js +103 -9
  67. package/dist/packages/@ember/object/observers.js +3 -3
  68. package/dist/packages/@ember/object/promise-proxy-mixin.js +5 -5
  69. package/dist/packages/@ember/renderer/index.js +4 -4
  70. package/dist/packages/@ember/routing/-internals.js +3 -1
  71. package/dist/packages/@ember/routing/hash-location.js +2 -2
  72. package/dist/packages/@ember/routing/history-location.js +3 -2
  73. package/dist/packages/@ember/routing/index.js +4 -4
  74. package/dist/packages/@ember/routing/lib/dsl.js +2 -1
  75. package/dist/packages/@ember/routing/lib/generate_controller.js +4 -3
  76. package/dist/packages/@ember/routing/lib/router_state.js +26 -1
  77. package/dist/packages/@ember/routing/lib/routing-service.js +107 -9
  78. package/dist/packages/@ember/routing/lib/utils.js +238 -7
  79. package/dist/packages/@ember/routing/none-location.js +3 -2
  80. package/dist/packages/@ember/routing/route.js +1618 -22
  81. package/dist/packages/@ember/routing/router-service.js +638 -12
  82. package/dist/packages/@ember/routing/router.js +1449 -14
  83. package/dist/packages/@ember/runloop/index.js +760 -6
  84. package/dist/packages/@ember/service/index.js +3 -3
  85. package/dist/packages/@ember/template/index.js +4 -4
  86. package/dist/packages/@ember/utils/index.js +2 -1
  87. package/dist/packages/@ember/utils/lib/compare.js +159 -4
  88. package/dist/packages/@ember/utils/lib/is_empty.js +4 -4
  89. package/dist/packages/@ember/utils/lib/type-of.js +110 -1
  90. package/dist/packages/@glimmer/tracking/index.js +3 -3
  91. package/dist/packages/@glimmer/tracking/primitives/cache.js +3 -3
  92. package/dist/packages/ember/barrel.js +28 -13
  93. package/dist/packages/ember/version.js +1 -1
  94. package/dist/packages/ember-testing/lib/adapters/adapter.js +1 -1
  95. package/dist/packages/ember-testing/lib/adapters/qunit.js +2 -1
  96. package/dist/packages/ember-testing/lib/ext/application.js +2 -1
  97. package/dist/packages/ember-testing/lib/ext/rsvp.js +1 -1
  98. package/dist/packages/ember-testing/lib/helpers/and_then.js +2 -1
  99. package/dist/packages/ember-testing/lib/helpers/current_path.js +8 -6
  100. package/dist/packages/ember-testing/lib/helpers/current_route_name.js +8 -6
  101. package/dist/packages/ember-testing/lib/helpers/current_url.js +6 -5
  102. package/dist/packages/ember-testing/lib/helpers/pause_test.js +2 -1
  103. package/dist/packages/ember-testing/lib/helpers/visit.js +4 -3
  104. package/dist/packages/ember-testing/lib/helpers/wait.js +4 -3
  105. package/dist/packages/ember-testing/lib/initializers.js +15 -8
  106. package/dist/packages/ember-testing/lib/setup_for_testing.js +1 -1
  107. package/dist/packages/ember-testing/lib/test/run.js +1 -1
  108. package/dist/packages/router_js/index.js +2 -1
  109. package/dist/packages/shared-chunks/{alias-By_2yu5c.js → alias-Dri0koi2.js} +5 -3
  110. package/dist/packages/shared-chunks/array-3xbmc_4J.js +119 -0
  111. package/dist/packages/shared-chunks/{cache-gDE3bkXq.js → cache-BESCGvbE.js} +667 -1529
  112. package/dist/packages/shared-chunks/{core_view-Cxne2_wu.js → chunk-3SQBS3Y5-Cj4eryg1.js} +1 -88
  113. package/dist/packages/shared-chunks/{index-BXPoca1S.js → index-Llq6dmgX.js} +40 -4660
  114. package/dist/packages/shared-chunks/{is_proxy-Dmis-70B.js → is_proxy-DjvCKvd5.js} +1 -1
  115. package/dist/packages/shared-chunks/{mandatory-setter-1UQhiJOb.js → mandatory-setter-BiXq-dpN.js} +2 -1
  116. package/dist/packages/shared-chunks/{name-z9D9Yibn.js → name-Dx2bGFVv.js} +1 -1
  117. package/dist/packages/shared-chunks/{namespace_search-CBgHTkDh.js → namespace_search-btMaPM-_.js} +2 -2
  118. package/dist/packages/shared-chunks/{property_set-CW4q-uo4.js → property_set-BapAkp3X.js} +5 -4
  119. package/dist/packages/shared-chunks/{registry-DzfcDwii.js → registry-B8WARvkP.js} +3 -2
  120. package/dist/packages/shared-chunks/{router-B-Q1aYBn.js → router-DrLZsJeE.js} +2 -482
  121. package/dist/packages/shared-chunks/{set_properties-DvalyQdu.js → set_properties-BScfxzvI.js} +2 -2
  122. package/dist/packages/shared-chunks/setup-registry-du4pSGZi.js +48 -0
  123. package/dist/packages/shared-chunks/{to-string-D8i3mjEU.js → to-string-B1BmwUkt.js} +1 -1
  124. package/dist/packages/shared-chunks/unrecognized-url-error-zpz-JEoG.js +484 -0
  125. package/docs/data.json +152 -142
  126. package/package.json +4 -7
  127. package/types/stable/@ember/-internals/metal/lib/array.d.ts +1 -2
  128. package/types/stable/@ember/-internals/metal/lib/object-at.d.ts +4 -0
  129. package/types/stable/@ember/-internals/metal/lib/observer.d.ts +2 -1
  130. package/types/stable/@ember/array/index.d.ts +1 -1
  131. package/types/stable/@ember/array/make.d.ts +3 -0
  132. package/types/stable/@ember/debug/index.d.ts +3 -7
  133. package/types/stable/@ember/debug/lib/assert.d.ts +8 -0
  134. package/types/stable/@ember/engine/index.d.ts +1 -1
  135. package/types/stable/@ember/engine/instance.d.ts +2 -2
  136. package/types/stable/@ember/engine/parent.d.ts +3 -0
  137. package/types/stable/@ember/modifier/index.d.ts +1 -3
  138. package/types/stable/@ember/modifier/on.d.ts +5 -0
  139. package/types/stable/@ember/routing/lib/routing-service.d.ts +1 -1
  140. package/types/stable/@ember/routing/route.d.ts +2 -3
  141. package/types/stable/@ember/routing/router-service.d.ts +1 -1
  142. package/types/stable/@ember/routing/router.d.ts +4 -4
  143. package/types/stable/ember/barrel.d.ts +1 -1
  144. package/types/stable/ember/index.d.ts +1 -1
  145. package/types/stable/index.d.ts +5 -0
  146. package/dist/packages/shared-chunks/index-DTxy4Zgx.js +0 -641
  147. package/dist/packages/shared-chunks/index-PYiGj1jp.js +0 -2071
@@ -0,0 +1,484 @@
1
+ import { P as Promise$1 } from './rsvp-DaQAFb0W.js';
2
+ import { isDevelopingApp } from '@embroider/macros';
3
+
4
+ function buildTransitionAborted() {
5
+ let error = new Error('TransitionAborted');
6
+ error.name = 'TransitionAborted';
7
+ error.code = 'TRANSITION_ABORTED';
8
+ return error;
9
+ }
10
+ function isTransitionAborted(maybeError) {
11
+ return typeof maybeError === 'object' && maybeError !== null && maybeError.code === 'TRANSITION_ABORTED';
12
+ }
13
+ function isAbortable(maybeAbortable) {
14
+ return typeof maybeAbortable === 'object' && maybeAbortable !== null && typeof maybeAbortable.isAborted === 'boolean';
15
+ }
16
+ function throwIfAborted(maybe) {
17
+ if (isAbortable(maybe) && maybe.isAborted) {
18
+ throw buildTransitionAborted();
19
+ }
20
+ }
21
+
22
+ const slice = Array.prototype.slice;
23
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
24
+ /**
25
+ Determines if an object is Promise by checking if it is "thenable".
26
+ **/
27
+ function isPromise(p) {
28
+ return p !== null && typeof p === 'object' && typeof p.then === 'function';
29
+ }
30
+ function merge(hash, other) {
31
+ for (let prop in other) {
32
+ if (hasOwnProperty.call(other, prop)) {
33
+ hash[prop] = other[prop];
34
+ }
35
+ }
36
+ }
37
+ /**
38
+ @private
39
+
40
+ Extracts query params from the end of an array
41
+ **/
42
+ function extractQueryParams(array) {
43
+ let len = array && array.length,
44
+ head,
45
+ queryParams;
46
+ if (len && len > 0) {
47
+ let obj = array[len - 1];
48
+ if (isQueryParamsContainer(obj)) {
49
+ queryParams = obj.queryParams;
50
+ head = slice.call(array, 0, len - 1);
51
+ return [head, queryParams];
52
+ }
53
+ }
54
+ // SAFETY: We confirmed that the last item isn't a QP container
55
+ return [array, null];
56
+ }
57
+ // TODO: Actually check that Dict is QueryParams
58
+ function isQueryParamsContainer(obj) {
59
+ if (obj && typeof obj === 'object') {
60
+ let cast = obj;
61
+ return 'queryParams' in cast && Object.keys(cast.queryParams).every(k => typeof k === 'string');
62
+ }
63
+ return false;
64
+ }
65
+ /**
66
+ @private
67
+
68
+ Coerces query param properties and array elements into strings.
69
+ **/
70
+ function coerceQueryParamsToString(queryParams) {
71
+ for (let key in queryParams) {
72
+ let val = queryParams[key];
73
+ if (typeof val === 'number') {
74
+ queryParams[key] = '' + val;
75
+ } else if (Array.isArray(val)) {
76
+ for (let i = 0, l = val.length; i < l; i++) {
77
+ val[i] = '' + val[i];
78
+ }
79
+ }
80
+ }
81
+ }
82
+ /**
83
+ @private
84
+ */
85
+ function log(router, ...args) {
86
+ if (!router.log) {
87
+ return;
88
+ }
89
+ if (args.length === 2) {
90
+ let [sequence, msg] = args;
91
+ router.log('Transition #' + sequence + ': ' + msg);
92
+ } else {
93
+ let [msg] = args;
94
+ router.log(msg);
95
+ }
96
+ }
97
+ function isParam(object) {
98
+ return typeof object === 'string' || object instanceof String || typeof object === 'number' || object instanceof Number;
99
+ }
100
+ function forEach(array, callback) {
101
+ for (let i = 0, l = array.length; i < l && callback(array[i]) !== false; i++) {
102
+ // empty intentionally
103
+ }
104
+ }
105
+ function getChangelist(oldObject, newObject) {
106
+ let key;
107
+ let results = {
108
+ all: {},
109
+ changed: {},
110
+ removed: {}
111
+ };
112
+ merge(results.all, newObject);
113
+ let didChange = false;
114
+ coerceQueryParamsToString(oldObject);
115
+ coerceQueryParamsToString(newObject);
116
+ // Calculate removals
117
+ for (key in oldObject) {
118
+ if (hasOwnProperty.call(oldObject, key)) {
119
+ if (!hasOwnProperty.call(newObject, key)) {
120
+ didChange = true;
121
+ results.removed[key] = oldObject[key];
122
+ }
123
+ }
124
+ }
125
+ // Calculate changes
126
+ for (key in newObject) {
127
+ if (hasOwnProperty.call(newObject, key)) {
128
+ let oldElement = oldObject[key];
129
+ let newElement = newObject[key];
130
+ if (isArray(oldElement) && isArray(newElement)) {
131
+ if (oldElement.length !== newElement.length) {
132
+ results.changed[key] = newObject[key];
133
+ didChange = true;
134
+ } else {
135
+ for (let i = 0, l = oldElement.length; i < l; i++) {
136
+ if (oldElement[i] !== newElement[i]) {
137
+ results.changed[key] = newObject[key];
138
+ didChange = true;
139
+ }
140
+ }
141
+ }
142
+ } else if (oldObject[key] !== newObject[key]) {
143
+ results.changed[key] = newObject[key];
144
+ didChange = true;
145
+ }
146
+ }
147
+ }
148
+ return didChange ? results : undefined;
149
+ }
150
+ function isArray(obj) {
151
+ return Array.isArray(obj);
152
+ }
153
+ function promiseLabel(label) {
154
+ return 'Router: ' + label;
155
+ }
156
+
157
+ const STATE_SYMBOL = `__STATE__-2619860001345920-3322w3`;
158
+ const PARAMS_SYMBOL = `__PARAMS__-261986232992830203-23323`;
159
+ const QUERY_PARAMS_SYMBOL = `__QPS__-2619863929824844-32323`;
160
+ /**
161
+ A Transition is a thenable (a promise-like object) that represents
162
+ an attempt to transition to another route. It can be aborted, either
163
+ explicitly via `abort` or by attempting another transition while a
164
+ previous one is still underway. An aborted transition can also
165
+ be `retry()`d later.
166
+
167
+ @class Transition
168
+ @constructor
169
+ @param {Object} router
170
+ @param {Object} intent
171
+ @param {Object} state
172
+ @param {Object} error
173
+ @private
174
+ */
175
+ class Transition {
176
+ constructor(router, intent, state, error = undefined, previousTransition = undefined) {
177
+ this.from = null;
178
+ this.to = undefined;
179
+ this.isAborted = false;
180
+ this.isActive = true;
181
+ this.urlMethod = 'update';
182
+ this.resolveIndex = 0;
183
+ this.queryParamsOnly = false;
184
+ this.isTransition = true;
185
+ this.isCausedByAbortingTransition = false;
186
+ this.isCausedByInitialTransition = false;
187
+ this.isCausedByAbortingReplaceTransition = false;
188
+ this._visibleQueryParams = {};
189
+ this.isIntermediate = false;
190
+ this[STATE_SYMBOL] = state || router.state;
191
+ this.intent = intent;
192
+ this.router = router;
193
+ this.data = intent && intent.data || {};
194
+ this.resolvedModels = {};
195
+ this[QUERY_PARAMS_SYMBOL] = {};
196
+ this.promise = undefined;
197
+ this.error = undefined;
198
+ this[PARAMS_SYMBOL] = {};
199
+ this.routeInfos = [];
200
+ this.targetName = undefined;
201
+ this.pivotHandler = undefined;
202
+ this.sequence = -1;
203
+ if (isDevelopingApp()) {
204
+ let error = new Error(`Transition creation stack`);
205
+ this.debugCreationStack = () => error.stack;
206
+ // not aborted yet, will be replaced when `this.isAborted` is set
207
+ this.debugAbortStack = () => undefined;
208
+ this.debugPreviousTransition = previousTransition;
209
+ }
210
+ if (error) {
211
+ this.promise = Promise$1.reject(error);
212
+ this.error = error;
213
+ return;
214
+ }
215
+ // if you're doing multiple redirects, need the new transition to know if it
216
+ // is actually part of the first transition or not. Any further redirects
217
+ // in the initial transition also need to know if they are part of the
218
+ // initial transition
219
+ this.isCausedByAbortingTransition = !!previousTransition;
220
+ this.isCausedByInitialTransition = !!previousTransition && (previousTransition.isCausedByInitialTransition || previousTransition.sequence === 0);
221
+ // Every transition in the chain is a replace
222
+ this.isCausedByAbortingReplaceTransition = !!previousTransition && previousTransition.urlMethod === 'replace' && (!previousTransition.isCausedByAbortingTransition || previousTransition.isCausedByAbortingReplaceTransition);
223
+ if (state) {
224
+ this[PARAMS_SYMBOL] = state.params;
225
+ this[QUERY_PARAMS_SYMBOL] = state.queryParams;
226
+ this.routeInfos = state.routeInfos;
227
+ let len = state.routeInfos.length;
228
+ if (len) {
229
+ this.targetName = state.routeInfos[len - 1].name;
230
+ }
231
+ for (let i = 0; i < len; ++i) {
232
+ let handlerInfo = state.routeInfos[i];
233
+ // TODO: this all seems hacky
234
+ if (!handlerInfo.isResolved) {
235
+ break;
236
+ }
237
+ this.pivotHandler = handlerInfo.route;
238
+ }
239
+ this.sequence = router.currentSequence++;
240
+ this.promise = state.resolve(this).catch(result => {
241
+ let error = this.router.transitionDidError(result, this);
242
+ throw error;
243
+ }, promiseLabel('Handle Abort'));
244
+ } else {
245
+ this.promise = Promise$1.resolve(this[STATE_SYMBOL]);
246
+ this[PARAMS_SYMBOL] = {};
247
+ }
248
+ }
249
+ /**
250
+ The Transition's internal promise. Calling `.then` on this property
251
+ is that same as calling `.then` on the Transition object itself, but
252
+ this property is exposed for when you want to pass around a
253
+ Transition's promise, but not the Transition object itself, since
254
+ Transition object can be externally `abort`ed, while the promise
255
+ cannot.
256
+ @property promise
257
+ @type {Object}
258
+ @public
259
+ */
260
+ /**
261
+ Custom state can be stored on a Transition's `data` object.
262
+ This can be useful for decorating a Transition within an earlier
263
+ hook and shared with a later hook. Properties set on `data` will
264
+ be copied to new transitions generated by calling `retry` on this
265
+ transition.
266
+ @property data
267
+ @type {Object}
268
+ @public
269
+ */
270
+ /**
271
+ A standard promise hook that resolves if the transition
272
+ succeeds and rejects if it fails/redirects/aborts.
273
+ Forwards to the internal `promise` property which you can
274
+ use in situations where you want to pass around a thenable,
275
+ but not the Transition itself.
276
+ @method then
277
+ @param {Function} onFulfilled
278
+ @param {Function} onRejected
279
+ @param {String} label optional string for labeling the promise.
280
+ Useful for tooling.
281
+ @return {Promise}
282
+ @public
283
+ */
284
+ then(onFulfilled, onRejected, label) {
285
+ return this.promise.then(onFulfilled, onRejected, label);
286
+ }
287
+ /**
288
+ Forwards to the internal `promise` property which you can
289
+ use in situations where you want to pass around a thennable,
290
+ but not the Transition itself.
291
+ @method catch
292
+ @param {Function} onRejection
293
+ @param {String} label optional string for labeling the promise.
294
+ Useful for tooling.
295
+ @return {Promise}
296
+ @public
297
+ */
298
+ catch(onRejection, label) {
299
+ return this.promise.catch(onRejection, label);
300
+ }
301
+ /**
302
+ Forwards to the internal `promise` property which you can
303
+ use in situations where you want to pass around a thenable,
304
+ but not the Transition itself.
305
+ @method finally
306
+ @param {Function} callback
307
+ @param {String} label optional string for labeling the promise.
308
+ Useful for tooling.
309
+ @return {Promise}
310
+ @public
311
+ */
312
+ finally(callback, label) {
313
+ return this.promise.finally(callback, label);
314
+ }
315
+ /**
316
+ Aborts the Transition. Note you can also implicitly abort a transition
317
+ by initiating another transition while a previous one is underway.
318
+ @method abort
319
+ @return {Transition} this transition
320
+ @public
321
+ */
322
+ abort() {
323
+ this.rollback();
324
+ let transition = new Transition(this.router, undefined, undefined, undefined);
325
+ transition.to = this.from;
326
+ transition.from = this.from;
327
+ transition.isAborted = true;
328
+ this.router.routeWillChange(transition);
329
+ this.router.routeDidChange(transition);
330
+ return this;
331
+ }
332
+ rollback() {
333
+ if (!this.isAborted) {
334
+ log(this.router, this.sequence, this.targetName + ': transition was aborted');
335
+ if (isDevelopingApp()) {
336
+ let error = new Error(`Transition aborted stack`);
337
+ this.debugAbortStack = () => error.stack;
338
+ }
339
+ if (this.intent !== undefined && this.intent !== null) {
340
+ this.intent.preTransitionState = this.router.state;
341
+ }
342
+ this.isAborted = true;
343
+ this.isActive = false;
344
+ this.router.activeTransition = undefined;
345
+ }
346
+ }
347
+ redirect(newTransition) {
348
+ this.rollback();
349
+ this.router.routeWillChange(newTransition);
350
+ }
351
+ /**
352
+ Retries a previously-aborted transition (making sure to abort the
353
+ transition if it's still active). Returns a new transition that
354
+ represents the new attempt to transition.
355
+ @method retry
356
+ @return {Transition} new transition
357
+ @public
358
+ */
359
+ retry() {
360
+ // TODO: add tests for merged state retry()s
361
+ this.abort();
362
+ let newTransition = this.router.transitionByIntent(this.intent, false);
363
+ // inheriting a `null` urlMethod is not valid
364
+ // the urlMethod is only set to `null` when
365
+ // the transition is initiated *after* the url
366
+ // has been updated (i.e. `router.handleURL`)
367
+ //
368
+ // in that scenario, the url method cannot be
369
+ // inherited for a new transition because then
370
+ // the url would not update even though it should
371
+ if (this.urlMethod !== null) {
372
+ newTransition.method(this.urlMethod);
373
+ }
374
+ return newTransition;
375
+ }
376
+ /**
377
+ Sets the URL-changing method to be employed at the end of a
378
+ successful transition. By default, a new Transition will just
379
+ use `updateURL`, but passing 'replace' to this method will
380
+ cause the URL to update using 'replaceWith' instead. Omitting
381
+ a parameter will disable the URL change, allowing for transitions
382
+ that don't update the URL at completion (this is also used for
383
+ handleURL, since the URL has already changed before the
384
+ transition took place).
385
+ @method method
386
+ @param {String} method the type of URL-changing method to use
387
+ at the end of a transition. Accepted values are 'replace',
388
+ falsy values, or any other non-falsy value (which is
389
+ interpreted as an updateURL transition).
390
+ @return {Transition} this transition
391
+ @public
392
+ */
393
+ method(method) {
394
+ this.urlMethod = method;
395
+ return this;
396
+ }
397
+ // Alias 'trigger' as 'send'
398
+ send(ignoreFailure = false, _name, err, transition, handler) {
399
+ this.trigger(ignoreFailure, _name, err, transition, handler);
400
+ }
401
+ /**
402
+ Fires an event on the current list of resolved/resolving
403
+ handlers within this transition. Useful for firing events
404
+ on route hierarchies that haven't fully been entered yet.
405
+ Note: This method is also aliased as `send`
406
+ @method trigger
407
+ @param {Boolean} [ignoreFailure=false] a boolean specifying whether unhandled events throw an error
408
+ @param {String} name the name of the event to fire
409
+ @public
410
+ */
411
+ trigger(ignoreFailure = false, name, ...args) {
412
+ // TODO: Deprecate the current signature
413
+ if (typeof ignoreFailure === 'string') {
414
+ name = ignoreFailure;
415
+ ignoreFailure = false;
416
+ }
417
+ this.router.triggerEvent(this[STATE_SYMBOL].routeInfos.slice(0, this.resolveIndex + 1), ignoreFailure, name, args);
418
+ }
419
+ /**
420
+ Transitions are aborted and their promises rejected
421
+ when redirects occur; this method returns a promise
422
+ that will follow any redirects that occur and fulfill
423
+ with the value fulfilled by any redirecting transitions
424
+ that occur.
425
+ @method followRedirects
426
+ @return {Promise} a promise that fulfills with the same
427
+ value that the final redirecting transition fulfills with
428
+ @public
429
+ */
430
+ followRedirects() {
431
+ let router = this.router;
432
+ return this.promise.catch(function (reason) {
433
+ if (router.activeTransition) {
434
+ return router.activeTransition.followRedirects();
435
+ }
436
+ return Promise$1.reject(reason);
437
+ });
438
+ }
439
+ toString() {
440
+ return 'Transition (sequence ' + this.sequence + ')';
441
+ }
442
+ /**
443
+ @private
444
+ */
445
+ log(message) {
446
+ log(this.router, this.sequence, message);
447
+ }
448
+ }
449
+ /**
450
+ @private
451
+
452
+ Logs and returns an instance of TransitionAborted.
453
+ */
454
+ function logAbort(transition) {
455
+ log(transition.router, transition.sequence, 'detected abort.');
456
+ return buildTransitionAborted();
457
+ }
458
+ function isTransition(obj) {
459
+ return typeof obj === 'object' && obj instanceof Transition && obj.isTransition;
460
+ }
461
+ function prepareResult(obj) {
462
+ if (isTransition(obj)) {
463
+ return null;
464
+ }
465
+ return obj;
466
+ }
467
+
468
+ const UnrecognizedURLError = function () {
469
+ UnrecognizedURLError.prototype = Object.create(Error.prototype);
470
+ UnrecognizedURLError.prototype.constructor = UnrecognizedURLError;
471
+ function UnrecognizedURLError(message) {
472
+ let error = Error.call(this, message);
473
+ this.name = 'UnrecognizedURLError';
474
+ this.message = message || 'UnrecognizedURL';
475
+ if (Error.captureStackTrace) {
476
+ Error.captureStackTrace(this, UnrecognizedURLError);
477
+ } else {
478
+ this.stack = error.stack;
479
+ }
480
+ }
481
+ return UnrecognizedURLError;
482
+ }();
483
+
484
+ export { PARAMS_SYMBOL as P, QUERY_PARAMS_SYMBOL as Q, STATE_SYMBOL as S, Transition as T, UnrecognizedURLError as U, isPromise as a, isParam as b, promiseLabel as c, log as d, isTransitionAborted as e, forEach as f, getChangelist as g, extractQueryParams as h, isTransition as i, logAbort as l, merge as m, prepareResult as p, throwIfAborted as t };