@angular-wave/angular.ts 0.0.38 → 0.0.39

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 (151) hide show
  1. package/Makefile +6 -5
  2. package/dist/angular-ts.esm.js +2 -1
  3. package/dist/angular-ts.umd.js +1 -1
  4. package/package.json +2 -4
  5. package/rollup.config.js +5 -1
  6. package/src/core/scope/scope.js +4 -7
  7. package/src/index.js +307 -1
  8. package/src/loader.js +13 -6
  9. package/src/public.js +7 -2
  10. package/src/src.test.js +10 -0
  11. package/tsconfig.json +1 -1
  12. package/tsconfig.types.json +11 -0
  13. package/types/animations/animate-cache.d.ts +7 -7
  14. package/types/animations/animate-children-directive.d.ts +3 -6
  15. package/types/animations/animate-swap.d.ts +7 -16
  16. package/types/animations/animation.d.ts +2 -11
  17. package/types/animations/raf-scheduler.d.ts +3 -3
  18. package/types/animations/shared.d.ts +8 -23
  19. package/types/core/{animate-css.d.ts → animate/animate-css.d.ts} +2 -8
  20. package/types/core/{cache.d.ts → cache/cache.d.ts} +5 -5
  21. package/types/core/compile/compile.d.ts +173 -0
  22. package/types/core/controller/controller.d.ts +32 -0
  23. package/types/core/exception-handler.d.ts +1 -1
  24. package/types/core/filter/filter.d.ts +9 -0
  25. package/types/core/{interpolate.d.ts → interpolate/interpolate.d.ts} +23 -39
  26. package/types/core/interval/interval-factory.d.ts +4 -0
  27. package/types/core/{interval.d.ts → interval/interval.d.ts} +1 -1
  28. package/types/core/location/location.d.ts +209 -0
  29. package/types/core/pubsub/pubsub.d.ts +156 -0
  30. package/types/core/q/q.d.ts +31 -0
  31. package/types/core/sanitize/sanitize-uri.d.ts +53 -0
  32. package/types/core/{sce.d.ts → sce/sce.d.ts} +80 -86
  33. package/types/core/scope/scope.d.ts +727 -0
  34. package/types/core/task-tracker-factory.d.ts +29 -29
  35. package/types/core/timeout/timeout.d.ts +20 -0
  36. package/types/core/{urlUtils.d.ts → url-utils/url-utils.d.ts} +2 -7
  37. package/types/directive/{bind.d.ts → bind/bind.d.ts} +4 -10
  38. package/types/directive/{class.d.ts → class/class.d.ts} +12 -21
  39. package/types/directive/controller/controller.d.ts +6 -0
  40. package/types/directive/events/events.d.ts +5 -0
  41. package/types/directive/form/form.d.ts +200 -0
  42. package/types/directive/if/if.d.ts +8 -0
  43. package/types/directive/include/include.d.ts +14 -0
  44. package/types/directive/{input.d.ts → input/input.d.ts} +20 -69
  45. package/types/directive/{model.d.ts → model/model.d.ts} +256 -279
  46. package/types/directive/options/options.d.ts +9 -0
  47. package/types/directive/ref/ref.d.ts +5 -0
  48. package/types/directive/repeat/repeat.d.ts +8 -0
  49. package/types/directive/{script.d.ts → script/script.d.ts} +5 -8
  50. package/types/directive/{show-hide.d.ts → show-hide/show-hide.d.ts} +10 -16
  51. package/types/directive/switch/switch.d.ts +17 -0
  52. package/types/directive/transclude/transclude.d.ts +4 -0
  53. package/types/directive/{validators.d.ts → validators/validators.d.ts} +20 -35
  54. package/types/filters/filters.d.ts +10 -16
  55. package/types/filters/order-by.d.ts +2 -4
  56. package/types/index.d.ts +117 -0
  57. package/types/injector.d.ts +12 -0
  58. package/types/public.d.ts +5 -0
  59. package/types/router/common/coreservices.d.ts +2 -2
  60. package/types/router/common/glob.d.ts +9 -9
  61. package/types/router/common/queue.d.ts +13 -13
  62. package/types/router/common/trace.d.ts +43 -43
  63. package/types/router/directives/view-directive.d.ts +13 -32
  64. package/types/router/globals.d.ts +20 -20
  65. package/types/router/hooks/lazy-load.d.ts +2 -11
  66. package/types/router/hooks/redirect-to.d.ts +1 -4
  67. package/types/router/hooks/url.d.ts +1 -5
  68. package/types/router/hooks/views.d.ts +1 -4
  69. package/types/router/params/param-factory.d.ts +5 -5
  70. package/types/router/params/param-type.d.ts +35 -35
  71. package/types/router/params/param-types.d.ts +11 -11
  72. package/types/router/params/param.d.ts +38 -38
  73. package/types/router/params/state-params.d.ts +10 -10
  74. package/types/router/path/path-node.d.ts +34 -34
  75. package/types/router/path/path-utils.d.ts +73 -77
  76. package/types/router/resolve/resolvable.d.ts +32 -32
  77. package/types/router/resolve/resolve-context.d.ts +84 -84
  78. package/types/router/services.d.ts +4 -9
  79. package/types/router/state/state-builder.d.ts +27 -27
  80. package/types/router/state/state-matcher.d.ts +5 -5
  81. package/types/router/state/state-object.d.ts +58 -58
  82. package/types/router/state/state-queue-manager.d.ts +10 -16
  83. package/types/router/state/state-registry.d.ts +100 -107
  84. package/types/router/state/state-service.d.ts +411 -411
  85. package/types/router/state/target-state.d.ts +64 -69
  86. package/types/router/state/views.d.ts +31 -37
  87. package/types/router/state-filters.d.ts +7 -7
  88. package/types/router/state-provider.d.ts +105 -105
  89. package/types/router/template-factory.d.ts +83 -112
  90. package/types/router/transition/hook-builder.d.ts +25 -25
  91. package/types/router/transition/hook-registry.d.ts +68 -83
  92. package/types/router/transition/interface.d.ts +7 -7
  93. package/types/router/transition/reject-factory.d.ts +34 -34
  94. package/types/router/transition/transition-event-type.d.ts +9 -18
  95. package/types/router/transition/transition-hook.d.ts +77 -82
  96. package/types/router/transition/transition-service.d.ts +82 -99
  97. package/types/router/transition/transition.d.ts +369 -377
  98. package/types/router/url/url-config.d.ts +84 -84
  99. package/types/router/url/url-matcher.d.ts +115 -119
  100. package/types/router/url/url-rule.d.ts +114 -124
  101. package/types/router/url/url-rules.d.ts +217 -217
  102. package/types/router/url/url-service.d.ts +264 -269
  103. package/types/router/view/view.d.ts +114 -117
  104. package/types/router/view-scroll.d.ts +2 -2
  105. package/types/services/anchor-scroll.d.ts +2 -8
  106. package/types/services/browser.d.ts +122 -130
  107. package/types/services/cache-factory.d.ts +25 -25
  108. package/types/services/cookie-reader.d.ts +2 -2
  109. package/types/services/document.d.ts +2 -2
  110. package/types/services/http/http.d.ts +145 -0
  111. package/types/services/{http-backend.d.ts → http-backend/http-backend.d.ts} +3 -35
  112. package/types/services/log.d.ts +49 -49
  113. package/types/services/template-request.d.ts +44 -53
  114. package/types/shared/common.d.ts +4 -19
  115. package/types/{constants.d.ts → shared/constants.d.ts} +6 -6
  116. package/types/shared/hof.d.ts +1 -1
  117. package/types/{jqLite.d.ts → shared/jqlite/jqlite.d.ts} +11 -11
  118. package/types/shared/test-utils.d.ts +11 -0
  119. package/types/shared/utils.d.ts +7 -24
  120. package/types-back/global.d.ts +3 -1
  121. package/types-back/index.d.ts +2 -221
  122. package/types/core/compile.d.ts +0 -206
  123. package/types/core/controller.d.ts +0 -42
  124. package/types/core/filter.d.ts +0 -9
  125. package/types/core/interval-factory.d.ts +0 -21
  126. package/types/core/location.d.ts +0 -234
  127. package/types/core/pubsub.d.ts +0 -164
  128. package/types/core/q.d.ts +0 -33
  129. package/types/core/root-scope.d.ts +0 -754
  130. package/types/core/sanitize-uri.d.ts +0 -57
  131. package/types/core/timeout.d.ts +0 -31
  132. package/types/directive/controller.d.ts +0 -6
  133. package/types/directive/events.d.ts +0 -12
  134. package/types/directive/form.d.ts +0 -230
  135. package/types/directive/if.d.ts +0 -17
  136. package/types/directive/include.d.ts +0 -33
  137. package/types/directive/options.d.ts +0 -16
  138. package/types/directive/ref.d.ts +0 -11
  139. package/types/directive/repeat.d.ts +0 -23
  140. package/types/directive/switch.d.ts +0 -23
  141. package/types/directive/transclude.d.ts +0 -15
  142. package/types/services/http.d.ts +0 -157
  143. /package/types/directive/{attrs.d.ts → attrs/attrs.d.ts} +0 -0
  144. /package/types/directive/{change.d.ts → change/change.d.ts} +0 -0
  145. /package/types/directive/{cloak.d.ts → cloak/cloak.d.ts} +0 -0
  146. /package/types/directive/{init.d.ts → init/init.d.ts} +0 -0
  147. /package/types/directive/{list.d.ts → list/list.d.ts} +0 -0
  148. /package/types/directive/{non-bindable.d.ts → non-bindable/non-bindable.d.ts} +0 -0
  149. /package/types/directive/{style.d.ts → style/style.d.ts} +0 -0
  150. /package/types/exts/{aria.d.ts → aria/aria.d.ts} +0 -0
  151. /package/types/exts/{messages.d.ts → messages/messages.d.ts} +0 -0
@@ -7,384 +7,376 @@
7
7
  * It has information about all states being entered and exited as a result of the transition.
8
8
  */
9
9
  export class Transition {
10
- /**
11
- * Creates a new Transition object.
12
- *
13
- * If the target state is not valid, an error is thrown.
14
- *
15
- * @internal
16
- *
17
- * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`
18
- * encapsulates the "from state".
19
- * @param targetState The target state and parameters being transitioned to (also, the transition options)
20
- * @param {import('../transition/transition-service').TransitionService} transitionService The [[TransitionService]] instance
21
- * @internal
22
- */
23
- constructor(
24
- fromPath: any,
25
- targetState: any,
26
- transitionService: import("../transition/transition-service").TransitionService,
27
- globals: any,
28
- );
29
- globals: any;
30
- transitionService: import("../transition/transition-service").TransitionService;
31
- _deferred: any;
32
- /**
33
- * This promise is resolved or rejected based on the outcome of the Transition.
34
- *
35
- * When the transition is successful, the promise is resolved
36
- * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error
37
- */
38
- promise: any;
39
- /** @internal Holds the hook registration functions such as those passed to Transition.onStart() */
40
- _registeredHooks: {};
41
- _hookBuilder: HookBuilder;
42
- /** Checks if this transition is currently active/running. */
43
- isActive: () => boolean;
44
- _targetState: any;
45
- _options: any;
46
- $id: number;
47
- _treeChanges: {
48
- from: any;
49
- to: any;
50
- retained: any;
51
- retainedWithToParams: any;
52
- exiting: any;
53
- entering: any;
54
- };
55
- /**
56
- * Creates the transition-level hook registration functions
57
- * (which can then be used to register hooks)
58
- */
59
- createTransitionHookRegFns(): void;
60
- getHooks(hookName: any): any;
61
- applyViewConfigs(): void;
62
- /**
63
- * @internal
64
- * @returns the internal from [State] object
65
- */
66
- $from(): any;
67
- /**
68
- * @internal
69
- * @returns the internal to [State] object
70
- */
71
- $to(): any;
72
- /**
73
- * Returns the "from state"
74
- *
75
- * Returns the state that the transition is coming *from*.
76
- *
77
- * @returns The state declaration object for the Transition's ("from state").
78
- */
79
- from(): any;
80
- /**
81
- * Returns the "to state"
82
- *
83
- * Returns the state that the transition is going *to*.
84
- *
85
- * @returns The state declaration object for the Transition's target state ("to state").
86
- */
87
- to(): any;
88
- /**
89
- * Gets the Target State
90
- *
91
- * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object.
92
- *
93
- * @returns the [[TargetState]] of this Transition
94
- */
95
- targetState(): any;
96
- /**
97
- * Determines whether two transitions are equivalent.
98
- * @deprecated
99
- */
100
- is(compare: any): any;
101
- params(pathname?: string): any;
102
- paramsChanged(): any;
103
- /**
104
- * Creates a [[UIInjector]] Dependency Injector
105
- *
106
- * Returns a Dependency Injector for the Transition's target state (to state).
107
- * The injector provides resolve values which the target state has access to.
108
- *
109
- * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2).
110
- *
111
- * #### Example:
112
- * ```js
113
- * .onEnter({ entering: 'myState' }, trans => {
114
- * var myResolveValue = trans.injector().get('myResolve');
115
- * // Inject a global service from the global/native injector (if it exists)
116
- * var MyService = trans.injector().get('MyService');
117
- * })
118
- * ```
119
- *
120
- * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched.
121
- * You can use [[UIInjector.getAsync]] to get a promise for the data.
122
- * #### Example:
123
- * ```js
124
- * .onBefore({}, trans => {
125
- * return trans.injector().getAsync('myResolve').then(myResolveValue =>
126
- * return myResolveValue !== 'ABORT';
127
- * });
128
- * });
129
- * ```
130
- *
131
- * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to.
132
- * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`.
133
- * #### Example:
134
- * ```js
135
- * .onEnter({ to: 'foo.bar' }, trans => {
136
- * // returns result of `foo` state's `myResolve` resolve
137
- * // even though `foo.bar` also has a `myResolve` resolve
138
- * var fooData = trans.injector('foo').get('myResolve');
139
- * });
140
- * ```
141
- *
142
- * If you need resolve data from the exiting states, pass `'from'` as `pathName`.
143
- * The resolve data from the `from` path will be returned.
144
- * #### Example:
145
- * ```js
146
- * .onExit({ exiting: 'foo.bar' }, trans => {
147
- * // Gets the resolve value of `myResolve` from the state being exited
148
- * var fooData = trans.injector(null, 'from').get('myResolve');
149
- * });
150
- * ```
151
- *
152
- *
153
- * @param state Limits the resolves provided to only the resolves the provided state has access to.
154
- * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states.
155
- *
156
- * @returns a [[UIInjector]]
157
- */
158
- injector(
159
- state: any,
160
- pathName?: string,
161
- ): {
162
- context: any;
163
- native: any;
164
- get(token: any): any;
165
- getAsync(token: any): any;
166
- getNative(token: any): any;
167
- };
168
- /**
169
- * Gets all available resolve tokens (keys)
170
- *
171
- * This method can be used in conjunction with [[injector]] to inspect the resolve values
172
- * available to the Transition.
173
- *
174
- * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states
175
- * in the Transition's [[TreeChanges.to]] path.
176
- *
177
- * #### Example:
178
- * This example logs all resolve values
179
- * ```js
180
- * let tokens = trans.getResolveTokens();
181
- * tokens.forEach(token => console.log(token + " = " + trans.injector().get(token)));
182
- * ```
183
- *
184
- * #### Example:
185
- * This example creates promises for each resolve value.
186
- * This triggers fetches of resolves (if any have not yet been fetched).
187
- * When all promises have all settled, it logs the resolve values.
188
- * ```js
189
- * let tokens = trans.getResolveTokens();
190
- * let promise = tokens.map(token => trans.injector().getAsync(token));
191
- * Promise.all(promises).then(values => console.log("Resolved values: " + values));
192
- * ```
193
- *
194
- * Note: Angular 1 users whould use `$q.all()`
195
- *
196
- * @param pathname resolve context's path name (e.g., `to` or `from`)
197
- *
198
- * @returns an array of resolve tokens (keys)
199
- */
200
- getResolveTokens(pathname?: string): any;
201
- /**
202
- * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition.
203
- *
204
- * Allows a transition hook to dynamically add a Resolvable to this Transition.
205
- *
206
- * Use the [[Transition.injector]] to retrieve the resolved data in subsequent hooks ([[UIInjector.get]]).
207
- *
208
- * If a `state` argument is provided, the Resolvable is processed when that state is being entered.
209
- * If no `state` is provided then the root state is used.
210
- * If the given `state` has already been entered, the Resolvable is processed when any child state is entered.
211
- * If no child states will be entered, the Resolvable is processed during the `onFinish` phase of the Transition.
212
- *
213
- * The `state` argument also scopes the resolved data.
214
- * The resolved data is available from the injector for that `state` and any children states.
215
- *
216
- * #### Example:
217
- * ```js
218
- * transitionService.onBefore({}, transition => {
219
- * transition.addResolvable({
220
- * token: 'myResolve',
221
- * deps: ['MyService'],
222
- * resolveFn: myService => myService.getData()
223
- * });
224
- * });
225
- * ```
226
- *
227
- * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]])
228
- * @param state the state in the "to path" which should receive the new resolve (otherwise, the root state)
229
- */
230
- addResolvable(resolvable: any, state?: string): void;
231
- /**
232
- * Gets the transition from which this transition was redirected.
233
- *
234
- * If the current transition is a redirect, this method returns the transition that was redirected.
235
- *
236
- * #### Example:
237
- * ```js
238
- * let transitionA = $state.go('A').transition
239
- * transitionA.onStart({}, () => $state.target('B'));
240
- * $transitions.onSuccess({ to: 'B' }, (trans) => {
241
- * trans.to().name === 'B'; // true
242
- * trans.redirectedFrom() === transitionA; // true
243
- * });
244
- * ```
245
- *
246
- * @returns The previous Transition, or null if this Transition is not the result of a redirection
247
- */
248
- redirectedFrom(): any;
249
- /**
250
- * Gets the original transition in a redirect chain
251
- *
252
- * A transition might belong to a long chain of multiple redirects.
253
- * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain.
254
- *
255
- * #### Example:
256
- * ```js
257
- * // states
258
- * registry.register({ name: 'A', redirectTo: 'B' });
259
- * registry.register({ name: 'B', redirectTo: 'C' });
260
- * registry.register({ name: 'C', redirectTo: 'D' });
261
- * registry.register({ name: 'D' });
262
- *
263
- * let transitionA = $state.go('A').transition
264
- *
265
- * $transitions.onSuccess({ to: 'D' }, (trans) => {
266
- * trans.to().name === 'D'; // true
267
- * trans.redirectedFrom().to().name === 'C'; // true
268
- * trans.originalTransition() === transitionA; // true
269
- * trans.originalTransition().to().name === 'A'; // true
270
- * });
271
- * ```
272
- *
273
- * @returns The original Transition that started a redirect chain
274
- */
275
- originalTransition(): any;
276
- /**
277
- * Get the transition options
278
- *
279
- * @returns the options for this Transition.
280
- */
281
- options(): any;
282
- /**
283
- * Gets the states being entered.
284
- *
285
- * @returns an array of states that will be entered during this transition.
286
- */
287
- entering(): any;
288
- /**
289
- * Gets the states being exited.
290
- *
291
- * @returns an array of states that will be exited during this transition.
292
- */
293
- exiting(): any;
294
- /**
295
- * Gets the states being retained.
296
- *
297
- * @returns an array of states that are already entered from a previous Transition, that will not be
298
- * exited during this Transition
299
- */
300
- retained(): any;
301
- /**
302
- * Get the [[ViewConfig]]s associated with this Transition
303
- *
304
- * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects.
305
- * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., "to" or "entering").
306
- *
307
- * @param pathname the name of the path to fetch views for:
308
- * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)
309
- * @param state If provided, only returns the `ViewConfig`s for a single state in the path
310
- *
311
- * @returns a list of ViewConfig objects for the given path.
312
- */
313
- views(pathname: string, state: any): any;
314
- treeChanges(pathname: any): any;
315
- /**
316
- * Creates a new transition that is a redirection of the current one.
317
- *
318
- * This transition can be returned from a [[TransitionService]] hook to
319
- * redirect a transition to a new state and/or set of parameters.
320
- *
321
- * @internal
322
- *
323
- * @returns Returns a new [[Transition]] instance.
324
- */
325
- redirect(targetState: any): Transition;
326
- /** @internal If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */
327
- _changedParams(): any;
328
- /**
329
- * Returns true if the transition is dynamic.
330
- *
331
- * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed.
332
- *
333
- * @returns true if the Transition is dynamic
334
- */
335
- dynamic(): any;
336
- /**
337
- * Returns true if the transition is ignored.
338
- *
339
- * A transition is ignored if no states are entered nor exited, and no parameter values have changed.
340
- *
341
- * @returns true if the Transition is ignored.
342
- */
343
- ignored(): boolean;
344
- _ignoredReason(): "SameAsPending" | "SameAsCurrent";
345
- /**
346
- * Runs the transition
347
- *
348
- * This method is generally called from the [[StateService.transitionTo]]
349
- *
350
- * @internal
351
- *
352
- * @returns a promise for a successful transition.
353
- */
354
- run(): any;
355
- success: boolean;
356
- _error: any;
357
- /**
358
- * Checks if the Transition is valid
359
- *
360
- * @returns true if the Transition is valid
361
- */
362
- valid(): boolean;
363
- /**
364
- * Aborts this transition
365
- *
366
- * Imperative API to abort a Transition.
367
- * This only applies to Transitions that are not yet complete.
368
- */
369
- abort(): void;
370
- _aborted: boolean;
371
- /**
372
- * The Transition error reason.
373
- *
374
- * If the transition is invalid (and could not be run), returns the reason the transition is invalid.
375
- * If the transition was valid and ran, but was not successful, returns the reason the transition failed.
376
- *
377
- * @returns a transition rejection explaining why the transition is invalid, or the reason the transition failed.
378
- */
379
- error(): any;
380
- /**
381
- * A string representation of the Transition
382
- *
383
- * @returns A string representation of the Transition
384
- */
385
- toString(): string;
10
+ /**
11
+ * Creates a new Transition object.
12
+ *
13
+ * If the target state is not valid, an error is thrown.
14
+ *
15
+ * @internal
16
+ *
17
+ * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`
18
+ * encapsulates the "from state".
19
+ * @param targetState The target state and parameters being transitioned to (also, the transition options)
20
+ * @param {import('../transition/transition-service').TransitionService} transitionService The [[TransitionService]] instance
21
+ * @internal
22
+ */
23
+ constructor(fromPath: any, targetState: any, transitionService: import("../transition/transition-service").TransitionService, globals: any);
24
+ globals: any;
25
+ transitionService: import("../transition/transition-service").TransitionService;
26
+ _deferred: any;
27
+ /**
28
+ * This promise is resolved or rejected based on the outcome of the Transition.
29
+ *
30
+ * When the transition is successful, the promise is resolved
31
+ * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error
32
+ */
33
+ promise: any;
34
+ /** @internal Holds the hook registration functions such as those passed to Transition.onStart() */
35
+ _registeredHooks: {};
36
+ _hookBuilder: HookBuilder;
37
+ /** Checks if this transition is currently active/running. */
38
+ isActive: () => boolean;
39
+ _targetState: any;
40
+ _options: any;
41
+ $id: number;
42
+ _treeChanges: {
43
+ from: any;
44
+ to: any;
45
+ retained: any;
46
+ retainedWithToParams: any;
47
+ exiting: any;
48
+ entering: any;
49
+ };
50
+ /**
51
+ * Creates the transition-level hook registration functions
52
+ * (which can then be used to register hooks)
53
+ */
54
+ createTransitionHookRegFns(): void;
55
+ getHooks(hookName: any): any;
56
+ applyViewConfigs(): void;
57
+ /**
58
+ * @internal
59
+ * @returns the internal from [State] object
60
+ */
61
+ $from(): any;
62
+ /**
63
+ * @internal
64
+ * @returns the internal to [State] object
65
+ */
66
+ $to(): any;
67
+ /**
68
+ * Returns the "from state"
69
+ *
70
+ * Returns the state that the transition is coming *from*.
71
+ *
72
+ * @returns The state declaration object for the Transition's ("from state").
73
+ */
74
+ from(): any;
75
+ /**
76
+ * Returns the "to state"
77
+ *
78
+ * Returns the state that the transition is going *to*.
79
+ *
80
+ * @returns The state declaration object for the Transition's target state ("to state").
81
+ */
82
+ to(): any;
83
+ /**
84
+ * Gets the Target State
85
+ *
86
+ * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object.
87
+ *
88
+ * @returns the [[TargetState]] of this Transition
89
+ */
90
+ targetState(): any;
91
+ /**
92
+ * Determines whether two transitions are equivalent.
93
+ * @deprecated
94
+ */
95
+ is(compare: any): any;
96
+ params(pathname?: string): any;
97
+ paramsChanged(): any;
98
+ /**
99
+ * Creates a [[UIInjector]] Dependency Injector
100
+ *
101
+ * Returns a Dependency Injector for the Transition's target state (to state).
102
+ * The injector provides resolve values which the target state has access to.
103
+ *
104
+ * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2).
105
+ *
106
+ * #### Example:
107
+ * ```js
108
+ * .onEnter({ entering: 'myState' }, trans => {
109
+ * var myResolveValue = trans.injector().get('myResolve');
110
+ * // Inject a global service from the global/native injector (if it exists)
111
+ * var MyService = trans.injector().get('MyService');
112
+ * })
113
+ * ```
114
+ *
115
+ * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched.
116
+ * You can use [[UIInjector.getAsync]] to get a promise for the data.
117
+ * #### Example:
118
+ * ```js
119
+ * .onBefore({}, trans => {
120
+ * return trans.injector().getAsync('myResolve').then(myResolveValue =>
121
+ * return myResolveValue !== 'ABORT';
122
+ * });
123
+ * });
124
+ * ```
125
+ *
126
+ * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to.
127
+ * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`.
128
+ * #### Example:
129
+ * ```js
130
+ * .onEnter({ to: 'foo.bar' }, trans => {
131
+ * // returns result of `foo` state's `myResolve` resolve
132
+ * // even though `foo.bar` also has a `myResolve` resolve
133
+ * var fooData = trans.injector('foo').get('myResolve');
134
+ * });
135
+ * ```
136
+ *
137
+ * If you need resolve data from the exiting states, pass `'from'` as `pathName`.
138
+ * The resolve data from the `from` path will be returned.
139
+ * #### Example:
140
+ * ```js
141
+ * .onExit({ exiting: 'foo.bar' }, trans => {
142
+ * // Gets the resolve value of `myResolve` from the state being exited
143
+ * var fooData = trans.injector(null, 'from').get('myResolve');
144
+ * });
145
+ * ```
146
+ *
147
+ *
148
+ * @param state Limits the resolves provided to only the resolves the provided state has access to.
149
+ * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states.
150
+ *
151
+ * @returns a [[UIInjector]]
152
+ */
153
+ injector(state: any, pathName?: string): {
154
+ context: any;
155
+ native: any;
156
+ get(token: any): any;
157
+ getAsync(token: any): any;
158
+ getNative(token: any): any;
159
+ };
160
+ /**
161
+ * Gets all available resolve tokens (keys)
162
+ *
163
+ * This method can be used in conjunction with [[injector]] to inspect the resolve values
164
+ * available to the Transition.
165
+ *
166
+ * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states
167
+ * in the Transition's [[TreeChanges.to]] path.
168
+ *
169
+ * #### Example:
170
+ * This example logs all resolve values
171
+ * ```js
172
+ * let tokens = trans.getResolveTokens();
173
+ * tokens.forEach(token => console.log(token + " = " + trans.injector().get(token)));
174
+ * ```
175
+ *
176
+ * #### Example:
177
+ * This example creates promises for each resolve value.
178
+ * This triggers fetches of resolves (if any have not yet been fetched).
179
+ * When all promises have all settled, it logs the resolve values.
180
+ * ```js
181
+ * let tokens = trans.getResolveTokens();
182
+ * let promise = tokens.map(token => trans.injector().getAsync(token));
183
+ * Promise.all(promises).then(values => console.log("Resolved values: " + values));
184
+ * ```
185
+ *
186
+ * Note: Angular 1 users whould use `$q.all()`
187
+ *
188
+ * @param pathname resolve context's path name (e.g., `to` or `from`)
189
+ *
190
+ * @returns an array of resolve tokens (keys)
191
+ */
192
+ getResolveTokens(pathname?: string): any;
193
+ /**
194
+ * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition.
195
+ *
196
+ * Allows a transition hook to dynamically add a Resolvable to this Transition.
197
+ *
198
+ * Use the [[Transition.injector]] to retrieve the resolved data in subsequent hooks ([[UIInjector.get]]).
199
+ *
200
+ * If a `state` argument is provided, the Resolvable is processed when that state is being entered.
201
+ * If no `state` is provided then the root state is used.
202
+ * If the given `state` has already been entered, the Resolvable is processed when any child state is entered.
203
+ * If no child states will be entered, the Resolvable is processed during the `onFinish` phase of the Transition.
204
+ *
205
+ * The `state` argument also scopes the resolved data.
206
+ * The resolved data is available from the injector for that `state` and any children states.
207
+ *
208
+ * #### Example:
209
+ * ```js
210
+ * transitionService.onBefore({}, transition => {
211
+ * transition.addResolvable({
212
+ * token: 'myResolve',
213
+ * deps: ['MyService'],
214
+ * resolveFn: myService => myService.getData()
215
+ * });
216
+ * });
217
+ * ```
218
+ *
219
+ * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]])
220
+ * @param state the state in the "to path" which should receive the new resolve (otherwise, the root state)
221
+ */
222
+ addResolvable(resolvable: any, state?: string): void;
223
+ /**
224
+ * Gets the transition from which this transition was redirected.
225
+ *
226
+ * If the current transition is a redirect, this method returns the transition that was redirected.
227
+ *
228
+ * #### Example:
229
+ * ```js
230
+ * let transitionA = $state.go('A').transition
231
+ * transitionA.onStart({}, () => $state.target('B'));
232
+ * $transitions.onSuccess({ to: 'B' }, (trans) => {
233
+ * trans.to().name === 'B'; // true
234
+ * trans.redirectedFrom() === transitionA; // true
235
+ * });
236
+ * ```
237
+ *
238
+ * @returns The previous Transition, or null if this Transition is not the result of a redirection
239
+ */
240
+ redirectedFrom(): any;
241
+ /**
242
+ * Gets the original transition in a redirect chain
243
+ *
244
+ * A transition might belong to a long chain of multiple redirects.
245
+ * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain.
246
+ *
247
+ * #### Example:
248
+ * ```js
249
+ * // states
250
+ * registry.register({ name: 'A', redirectTo: 'B' });
251
+ * registry.register({ name: 'B', redirectTo: 'C' });
252
+ * registry.register({ name: 'C', redirectTo: 'D' });
253
+ * registry.register({ name: 'D' });
254
+ *
255
+ * let transitionA = $state.go('A').transition
256
+ *
257
+ * $transitions.onSuccess({ to: 'D' }, (trans) => {
258
+ * trans.to().name === 'D'; // true
259
+ * trans.redirectedFrom().to().name === 'C'; // true
260
+ * trans.originalTransition() === transitionA; // true
261
+ * trans.originalTransition().to().name === 'A'; // true
262
+ * });
263
+ * ```
264
+ *
265
+ * @returns The original Transition that started a redirect chain
266
+ */
267
+ originalTransition(): any;
268
+ /**
269
+ * Get the transition options
270
+ *
271
+ * @returns the options for this Transition.
272
+ */
273
+ options(): any;
274
+ /**
275
+ * Gets the states being entered.
276
+ *
277
+ * @returns an array of states that will be entered during this transition.
278
+ */
279
+ entering(): any;
280
+ /**
281
+ * Gets the states being exited.
282
+ *
283
+ * @returns an array of states that will be exited during this transition.
284
+ */
285
+ exiting(): any;
286
+ /**
287
+ * Gets the states being retained.
288
+ *
289
+ * @returns an array of states that are already entered from a previous Transition, that will not be
290
+ * exited during this Transition
291
+ */
292
+ retained(): any;
293
+ /**
294
+ * Get the [[ViewConfig]]s associated with this Transition
295
+ *
296
+ * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects.
297
+ * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., "to" or "entering").
298
+ *
299
+ * @param pathname the name of the path to fetch views for:
300
+ * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)
301
+ * @param state If provided, only returns the `ViewConfig`s for a single state in the path
302
+ *
303
+ * @returns a list of ViewConfig objects for the given path.
304
+ */
305
+ views(pathname: string, state: any): any;
306
+ treeChanges(pathname: any): any;
307
+ /**
308
+ * Creates a new transition that is a redirection of the current one.
309
+ *
310
+ * This transition can be returned from a [[TransitionService]] hook to
311
+ * redirect a transition to a new state and/or set of parameters.
312
+ *
313
+ * @internal
314
+ *
315
+ * @returns Returns a new [[Transition]] instance.
316
+ */
317
+ redirect(targetState: any): Transition;
318
+ /** @internal If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */
319
+ _changedParams(): any;
320
+ /**
321
+ * Returns true if the transition is dynamic.
322
+ *
323
+ * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed.
324
+ *
325
+ * @returns true if the Transition is dynamic
326
+ */
327
+ dynamic(): any;
328
+ /**
329
+ * Returns true if the transition is ignored.
330
+ *
331
+ * A transition is ignored if no states are entered nor exited, and no parameter values have changed.
332
+ *
333
+ * @returns true if the Transition is ignored.
334
+ */
335
+ ignored(): boolean;
336
+ _ignoredReason(): "SameAsPending" | "SameAsCurrent";
337
+ /**
338
+ * Runs the transition
339
+ *
340
+ * This method is generally called from the [[StateService.transitionTo]]
341
+ *
342
+ * @internal
343
+ *
344
+ * @returns a promise for a successful transition.
345
+ */
346
+ run(): any;
347
+ success: boolean;
348
+ _error: any;
349
+ /**
350
+ * Checks if the Transition is valid
351
+ *
352
+ * @returns true if the Transition is valid
353
+ */
354
+ valid(): boolean;
355
+ /**
356
+ * Aborts this transition
357
+ *
358
+ * Imperative API to abort a Transition.
359
+ * This only applies to Transitions that are not yet complete.
360
+ */
361
+ abort(): void;
362
+ _aborted: boolean;
363
+ /**
364
+ * The Transition error reason.
365
+ *
366
+ * If the transition is invalid (and could not be run), returns the reason the transition is invalid.
367
+ * If the transition was valid and ran, but was not successful, returns the reason the transition failed.
368
+ *
369
+ * @returns a transition rejection explaining why the transition is invalid, or the reason the transition failed.
370
+ */
371
+ error(): any;
372
+ /**
373
+ * A string representation of the Transition
374
+ *
375
+ * @returns A string representation of the Transition
376
+ */
377
+ toString(): string;
386
378
  }
387
379
  export namespace Transition {
388
- export { Transition as diToken };
380
+ export { Transition as diToken };
389
381
  }
390
382
  import { HookBuilder } from "./hook-builder";