@angular-wave/angular.ts 0.9.0 → 0.9.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 (208) hide show
  1. package/@types/core/scope/scope.d.ts +1 -4
  2. package/@types/interface.d.ts +17 -3
  3. package/@types/shared/interface.d.ts +17 -0
  4. package/@types/shared/utils.d.ts +4 -19
  5. package/dist/angular-ts.esm.js +29 -152
  6. package/dist/angular-ts.umd.js +29 -152
  7. package/dist/angular-ts.umd.min.js +1 -1
  8. package/docs/layouts/shortcodes/version.html +1 -1
  9. package/docs/static/typedoc/assets/hierarchy.js +1 -1
  10. package/docs/static/typedoc/assets/main.js +2 -2
  11. package/docs/static/typedoc/assets/navigation.js +1 -1
  12. package/docs/static/typedoc/assets/search.js +1 -1
  13. package/docs/static/typedoc/classes/Location.html +20 -20
  14. package/docs/static/typedoc/classes/LocationProvider.html +5 -5
  15. package/docs/static/typedoc/classes/LogProvider.html +3 -3
  16. package/docs/static/typedoc/classes/PubSub.html +21 -21
  17. package/docs/static/typedoc/classes/PubSubProvider.html +1 -1
  18. package/docs/static/typedoc/classes/TemplateCacheProvider.html +2 -2
  19. package/docs/static/typedoc/hierarchy.html +1 -1
  20. package/docs/static/typedoc/index.html +1 -1
  21. package/docs/static/typedoc/interfaces/ChangesObject.html +3 -3
  22. package/docs/static/typedoc/interfaces/ComponentOptions.html +8 -8
  23. package/docs/static/typedoc/interfaces/Controller.html +6 -6
  24. package/docs/static/typedoc/interfaces/DefaultPorts.html +1 -1
  25. package/docs/static/typedoc/interfaces/Directive.html +18 -18
  26. package/docs/static/typedoc/interfaces/DirectivePrePost.html +1 -1
  27. package/docs/static/typedoc/interfaces/Html5Mode.html +1 -1
  28. package/docs/static/typedoc/interfaces/HttpProviderDefaults.html +7 -7
  29. package/docs/static/typedoc/interfaces/HttpService.html +21 -21
  30. package/docs/static/typedoc/interfaces/LogService.html +6 -6
  31. package/docs/static/typedoc/interfaces/NgModelController.html +15 -15
  32. package/docs/static/typedoc/interfaces/NgModelOptions.html +8 -8
  33. package/docs/static/typedoc/interfaces/Provider.html +17 -17
  34. package/docs/static/typedoc/interfaces/RequestConfig.html +15 -15
  35. package/docs/static/typedoc/interfaces/RequestShortcutConfig.html +11 -11
  36. package/docs/static/typedoc/interfaces/ServiceProvider.html +1 -1
  37. package/docs/static/typedoc/interfaces/TemplateCache.html +1 -1
  38. package/docs/static/typedoc/interfaces/TranscludeFunctionObject.html +4 -4
  39. package/docs/static/typedoc/interfaces/UrlParts.html +4 -4
  40. package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
  41. package/docs/static/typedoc/types/CloneAttachFunction.html +1 -1
  42. package/docs/static/typedoc/types/ControllerConstructor.html +1 -1
  43. package/docs/static/typedoc/types/DirectiveCompileFn.html +1 -1
  44. package/docs/static/typedoc/types/DirectiveController.html +1 -1
  45. package/docs/static/typedoc/types/DirectiveFactoryFn.html +1 -1
  46. package/docs/static/typedoc/types/DirectiveLinkFn.html +1 -1
  47. package/docs/static/typedoc/types/Expression.html +1 -1
  48. package/docs/static/typedoc/types/FilterFactory.html +1 -1
  49. package/docs/static/typedoc/types/FilterFn.html +1 -1
  50. package/docs/static/typedoc/types/Injectable.html +1 -1
  51. package/docs/static/typedoc/types/InjectableFactory.html +1 -1
  52. package/docs/static/typedoc/types/LogCall.html +1 -1
  53. package/docs/static/typedoc/types/LogServiceFactory.html +1 -1
  54. package/docs/static/typedoc/types/OnChangesObject.html +1 -1
  55. package/docs/static/typedoc/types/SwapModeType.html +1 -1
  56. package/docs/static/typedoc/types/TController.html +1 -1
  57. package/docs/static/typedoc/types/UrlChangeListener.html +4 -4
  58. package/docs/static/typedoc/variables/SwapMode.html +10 -10
  59. package/legacy.d.ts +0 -82
  60. package/package.json +2 -2
  61. package/src/animations/animate-js.js +2 -1
  62. package/src/animations/animate-queue.js +7 -6
  63. package/src/core/scope/scope.js +8 -10
  64. package/src/directive/http/form-router-test.html +44 -0
  65. package/src/directive/options/options-example.html +7 -3
  66. package/src/directive/options/options.js +1 -0
  67. package/src/directive/options/options.spec.js +117 -170
  68. package/src/interface.ts +20 -3
  69. package/src/router/directives/view-directive.js +0 -1
  70. package/src/router/resolve/resolve-context.js +0 -19
  71. package/src/router/state/state-registry.js +3 -10
  72. package/src/router/state/state-service.js +5 -5
  73. package/src/router/transition/transition.js +1 -86
  74. package/src/router/view-hook.spec.js +1 -1
  75. package/src/shared/interface.ts +19 -0
  76. package/src/shared/utils.js +3 -12
  77. package/tsconfig.types.json +2 -2
  78. package/@types/angular.d.ts +0 -150
  79. package/@types/animations/animate-cache.d.ts +0 -50
  80. package/@types/animations/animate-children-directive.d.ts +0 -10
  81. package/@types/animations/animate-css-driver.d.ts +0 -18
  82. package/@types/animations/animate-css.d.ts +0 -18
  83. package/@types/animations/animate-js-driver.d.ts +0 -14
  84. package/@types/animations/animate-js.d.ts +0 -23
  85. package/@types/animations/animate-queue.d.ts +0 -28
  86. package/@types/animations/animate-runner.d.ts +0 -31
  87. package/@types/animations/animate-swap.d.ts +0 -9
  88. package/@types/animations/animate.d.ts +0 -450
  89. package/@types/animations/animation.d.ts +0 -14
  90. package/@types/animations/interface.d.ts +0 -17
  91. package/@types/animations/raf-scheduler.d.ts +0 -37
  92. package/@types/animations/shared.d.ts +0 -74
  93. package/@types/core/compile/compile.d.ts +0 -201
  94. package/@types/core/controller/controller.d.ts +0 -54
  95. package/@types/core/di/injector.d.ts +0 -22
  96. package/@types/core/filter/filter.d.ts +0 -23
  97. package/@types/core/interpolate/interpolate.d.ts +0 -38
  98. package/@types/core/parse/ast/ast-node.d.ts +0 -56
  99. package/@types/core/parse/ast/ast.d.ts +0 -164
  100. package/@types/core/parse/lexer/lexer.d.ts +0 -119
  101. package/@types/core/parse/lexer/token.d.ts +0 -17
  102. package/@types/core/parse/parse.d.ts +0 -33
  103. package/@types/core/parse/parser/parser.d.ts +0 -41
  104. package/@types/core/sanitize/interface.d.ts +0 -10
  105. package/@types/core/sanitize/sanitize-uri.d.ts +0 -40
  106. package/@types/directive/aria/aria.d.ts +0 -104
  107. package/@types/directive/attrs/attrs.d.ts +0 -8
  108. package/@types/directive/bind/bind.d.ts +0 -18
  109. package/@types/directive/channel/channel.d.ts +0 -10
  110. package/@types/directive/class/class.d.ts +0 -3
  111. package/@types/directive/cloak/cloak.d.ts +0 -4
  112. package/@types/directive/controller/controller.d.ts +0 -4
  113. package/@types/directive/events/events.d.ts +0 -21
  114. package/@types/directive/form/form.d.ts +0 -264
  115. package/@types/directive/http/http.d.ts +0 -46
  116. package/@types/directive/if/if.d.ts +0 -10
  117. package/@types/directive/include/include.d.ts +0 -28
  118. package/@types/directive/init/init.d.ts +0 -4
  119. package/@types/directive/input/input.d.ts +0 -70
  120. package/@types/directive/messages/messages.d.ts +0 -63
  121. package/@types/directive/model/model.d.ts +0 -515
  122. package/@types/directive/model-options/model-options.d.ts +0 -56
  123. package/@types/directive/non-bindable/non-bindable.d.ts +0 -4
  124. package/@types/directive/observe/observe.d.ts +0 -9
  125. package/@types/directive/options/options.d.ts +0 -13
  126. package/@types/directive/ref/ref.d.ts +0 -11
  127. package/@types/directive/repeat/repeat.d.ts +0 -11
  128. package/@types/directive/script/script.d.ts +0 -10
  129. package/@types/directive/select/select.d.ts +0 -15
  130. package/@types/directive/setter/setter.d.ts +0 -12
  131. package/@types/directive/show-hide/show-hide.d.ts +0 -19
  132. package/@types/directive/style/style.d.ts +0 -4
  133. package/@types/directive/switch/switch.d.ts +0 -18
  134. package/@types/directive/transclude/transclude.d.ts +0 -10
  135. package/@types/directive/validators/validators.d.ts +0 -149
  136. package/@types/filters/filter.d.ts +0 -4
  137. package/@types/filters/filters.d.ts +0 -38
  138. package/@types/filters/limit-to.d.ts +0 -4
  139. package/@types/filters/order-by.d.ts +0 -7
  140. package/@types/index.d.ts +0 -2
  141. package/@types/ng.d.ts +0 -8
  142. package/@types/router/common/trace.d.ts +0 -66
  143. package/@types/router/directives/state-directives.d.ts +0 -46
  144. package/@types/router/directives/view-directive.d.ts +0 -138
  145. package/@types/router/glob/glob.d.ts +0 -81
  146. package/@types/router/hooks/core-resolvables.d.ts +0 -2
  147. package/@types/router/hooks/ignored-transition.d.ts +0 -1
  148. package/@types/router/hooks/invalid-transition.d.ts +0 -1
  149. package/@types/router/hooks/lazy-load.d.ts +0 -42
  150. package/@types/router/hooks/on-enter-exit-retain.d.ts +0 -3
  151. package/@types/router/hooks/redirect-to.d.ts +0 -4
  152. package/@types/router/hooks/resolve.d.ts +0 -4
  153. package/@types/router/hooks/update-globals.d.ts +0 -1
  154. package/@types/router/hooks/url.d.ts +0 -5
  155. package/@types/router/hooks/views.d.ts +0 -5
  156. package/@types/router/params/interface.d.ts +0 -606
  157. package/@types/router/params/param-factory.d.ts +0 -16
  158. package/@types/router/params/param-type.d.ts +0 -59
  159. package/@types/router/params/param-types.d.ts +0 -36
  160. package/@types/router/params/param.d.ts +0 -71
  161. package/@types/router/params/state-params.d.ts +0 -12
  162. package/@types/router/path/path-node.d.ts +0 -38
  163. package/@types/router/path/path-utils.d.ts +0 -88
  164. package/@types/router/resolve/interface.d.ts +0 -200
  165. package/@types/router/resolve/resolvable.d.ts +0 -50
  166. package/@types/router/resolve/resolve-context.d.ts +0 -102
  167. package/@types/router/router.d.ts +0 -47
  168. package/@types/router/state/interface.d.ts +0 -983
  169. package/@types/router/state/state-builder.d.ts +0 -95
  170. package/@types/router/state/state-matcher.d.ts +0 -7
  171. package/@types/router/state/state-object.d.ts +0 -83
  172. package/@types/router/state/state-queue-manager.d.ts +0 -29
  173. package/@types/router/state/state-registry.d.ts +0 -134
  174. package/@types/router/state/state-service.d.ts +0 -419
  175. package/@types/router/state/target-state.d.ts +0 -102
  176. package/@types/router/state/views.d.ts +0 -58
  177. package/@types/router/state-filters.d.ts +0 -39
  178. package/@types/router/template-factory.d.ts +0 -117
  179. package/@types/router/transition/hook-builder.d.ts +0 -45
  180. package/@types/router/transition/hook-registry.d.ts +0 -102
  181. package/@types/router/transition/interface.d.ts +0 -880
  182. package/@types/router/transition/reject-factory.d.ts +0 -43
  183. package/@types/router/transition/transition-event-type.d.ts +0 -24
  184. package/@types/router/transition/transition-hook.d.ts +0 -86
  185. package/@types/router/transition/transition-service.d.ts +0 -116
  186. package/@types/router/transition/transition.d.ts +0 -396
  187. package/@types/router/url/url-config.d.ts +0 -99
  188. package/@types/router/url/url-matcher.d.ts +0 -174
  189. package/@types/router/url/url-rule.d.ts +0 -161
  190. package/@types/router/url/url-rules.d.ts +0 -249
  191. package/@types/router/url/url-service.d.ts +0 -254
  192. package/@types/router/view/interface.d.ts +0 -44
  193. package/@types/router/view/view.d.ts +0 -149
  194. package/@types/router/view-scroll.d.ts +0 -10
  195. package/@types/services/anchor-scroll.d.ts +0 -25
  196. package/@types/services/cookie-reader.d.ts +0 -4
  197. package/@types/services/http/http.d.ts +0 -134
  198. package/@types/services/http-backend/http-backend.d.ts +0 -58
  199. package/@types/services/sce/sce.d.ts +0 -238
  200. package/@types/services/template-request.d.ts +0 -55
  201. package/@types/shared/common.d.ts +0 -197
  202. package/@types/shared/hof.d.ts +0 -108
  203. package/@types/shared/predicates.d.ts +0 -17
  204. package/@types/shared/queue.d.ts +0 -64
  205. package/@types/shared/strings.d.ts +0 -58
  206. package/@types/shared/test-utils.d.ts +0 -18
  207. package/docs/static/typedoc/classes/NgModule.html +0 -32
  208. package/src/router/params/README.md +0 -8
@@ -1,43 +0,0 @@
1
- /**
2
- * An object for Transition Rejection reasons.
3
- */
4
- export type RejectType = number;
5
- export namespace RejectType {
6
- let SUPERSEDED: number;
7
- let ABORTED: number;
8
- let INVALID: number;
9
- let IGNORED: number;
10
- let ERROR: number;
11
- }
12
- export class Rejection {
13
- /** Returns a Rejection due to transition superseded */
14
- static superseded(detail: any, options: any): Rejection;
15
- /** Returns a Rejection due to redirected transition */
16
- static redirected(detail: any): Rejection;
17
- /** Returns a Rejection due to invalid transition */
18
- static invalid(detail: any): Rejection;
19
- /** Returns a Rejection due to ignored transition */
20
- static ignored(detail: any): Rejection;
21
- /** Returns a Rejection due to aborted transition */
22
- static aborted(detail: any): Rejection;
23
- /** Returns a Rejection due to aborted transition */
24
- static errored(detail: any): Rejection;
25
- /**
26
- * Returns a Rejection
27
- *
28
- * Normalizes a value as a Rejection.
29
- * If the value is already a Rejection, returns it.
30
- * Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR).
31
- *
32
- * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection.
33
- */
34
- static normalize(detail: any): any;
35
- constructor(type: any, message: any, detail: any);
36
- $id: number;
37
- type: any;
38
- message: any;
39
- detail: any;
40
- redirected: boolean;
41
- toString(): string;
42
- toPromise(): any;
43
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * This class defines a type of hook, such as `onBefore` or `onEnter`.
3
- * Plugins can define custom hook types, such as sticky states does for `onInactive`.
4
- */
5
- export class TransitionEventType {
6
- constructor(
7
- name: any,
8
- hookPhase: any,
9
- hookOrder: any,
10
- criteriaMatchPath: any,
11
- reverseSort?: boolean,
12
- getResultHandler?: (hook: any) => (result: any) => any,
13
- getErrorHandler?: () => (error: any) => any,
14
- synchronous?: boolean,
15
- );
16
- name: any;
17
- hookPhase: any;
18
- hookOrder: any;
19
- criteriaMatchPath: any;
20
- reverseSort: boolean;
21
- getResultHandler: (hook: any) => (result: any) => any;
22
- getErrorHandler: () => (error: any) => any;
23
- synchronous: boolean;
24
- }
@@ -1,86 +0,0 @@
1
- export class TransitionHook {
2
- /**
3
- * Chains together an array of TransitionHooks.
4
- *
5
- * Given a list of [[TransitionHook]] objects, chains them together.
6
- * Each hook is invoked after the previous one completes.
7
- *
8
- * #### Example:
9
- * ```js
10
- * var hooks: TransitionHook[] = getHooks();
11
- * let promise: Promise<any> = TransitionHook.chain(hooks);
12
- *
13
- * promise.then(handleSuccess, handleError);
14
- * ```
15
- *
16
- * @param hooks the list of hooks to chain together
17
- * @param waitFor if provided, the chain is `.then()`'ed off this promise
18
- * @returns a `Promise` for sequentially invoking the hooks (in order)
19
- */
20
- static chain(hooks: any, waitFor: any): any;
21
- /**
22
- * Invokes all the provided TransitionHooks, in order.
23
- * Each hook's return value is checked.
24
- * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned.
25
- * If no hook returns a promise, then all hooks are processed synchronously.
26
- *
27
- * @param hooks the list of TransitionHooks to invoke
28
- * @param doneCallback a callback that is invoked after all the hooks have successfully completed
29
- *
30
- * @returns a promise for the async result, or the result of the callback
31
- */
32
- static invokeHooks(hooks: any, doneCallback: any): any;
33
- /**
34
- * Run all TransitionHooks, ignoring their return value.
35
- */
36
- static runAllHooks(hooks: any): void;
37
- constructor(
38
- transition: any,
39
- stateContext: any,
40
- registeredHook: any,
41
- options: any,
42
- );
43
- transition: any;
44
- stateContext: any;
45
- registeredHook: any;
46
- options: any;
47
- isSuperseded: () => boolean;
48
- type: any;
49
- logError(err: any): void;
50
- invokeHook(): any;
51
- /**
52
- * This method handles the return value of a Transition Hook.
53
- *
54
- * A hook can return false (cancel), a TargetState (redirect),
55
- * or a promise (which may later resolve to false or a redirect)
56
- *
57
- * This also handles "transition superseded" -- when a new transition
58
- * was started while the hook was still running
59
- */
60
- handleHookResult(result: any): any;
61
- /**
62
- * Return a Rejection promise if the transition is no longer current due
63
- * a new transition has started and superseded this one.
64
- */
65
- getNotCurrentRejection(): any;
66
- toString(): string;
67
- }
68
- export namespace TransitionHook {
69
- /**
70
- * These GetResultHandler(s) are used by [[invokeHook]] below
71
- * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]])
72
- */
73
- function HANDLE_RESULT(hook: any): (result: any) => any;
74
- /**
75
- * If the result is a promise rejection, log it.
76
- * Otherwise, ignore the result.
77
- */
78
- function LOG_REJECTED_RESULT(hook: any): (result: any) => any;
79
- /**
80
- * These GetErrorHandler(s) are used by [[invokeHook]] below
81
- * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]])
82
- */
83
- function LOG_ERROR(hook: any): (error: any) => any;
84
- function REJECT_ERROR(): (error: any) => any;
85
- function THROW_ERROR(): (error: any) => never;
86
- }
@@ -1,116 +0,0 @@
1
- export namespace defaultTransOpts {
2
- let location: boolean;
3
- let relative: any;
4
- let inherit: boolean;
5
- let notify: boolean;
6
- let reload: boolean;
7
- let supercede: boolean;
8
- let custom: {};
9
- function current(): any;
10
- let source: string;
11
- }
12
- /**
13
- * This class provides services related to Transitions.
14
- *
15
- * - Most importantly, it allows global Transition Hooks to be registered.
16
- * - It allows the default transition error handler to be set.
17
- * - It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]).
18
- *
19
- * At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class.
20
- *
21
- * This API is located at `router.transitionService` ([[UIRouter.transitionService]])
22
- */
23
- export class TransitionProvider {
24
- static $inject: string[];
25
- /**
26
- * @param {import('../router.js').Router} globals
27
- * @param viewService
28
- */
29
- constructor(globals: import("../router.js").Router, viewService: any);
30
- _transitionCount: number;
31
- /** The transition hook types, such as `onEnter`, `onStart`, etc */
32
- _eventTypes: any[];
33
- /** @internal The registered transition hooks */
34
- _registeredHooks: {};
35
- /** The paths on a criteria object */
36
- _criteriaPaths: {};
37
- globals: import("../router.js").Router;
38
- $view: any;
39
- _deregisterHookFns: {};
40
- _pluginapi: any;
41
- $get: (
42
- | string
43
- | ((
44
- stateService: any,
45
- urlService: any,
46
- stateRegistry: any,
47
- viewService: any,
48
- ) => this)
49
- )[];
50
- /**
51
- * Registers a [[TransitionHookFn]], called *while a transition is being constructed*.
52
- *
53
- * Registers a transition lifecycle hook, which is invoked during transition construction.
54
- *
55
- * This low level hook should only be used by plugins.
56
- * This can be a useful time for plugins to add resolves or mutate the transition as needed.
57
- * The Sticky States plugin uses this hook to modify the treechanges.
58
- *
59
- * ### Lifecycle
60
- *
61
- * `onCreate` hooks are invoked *while a transition is being constructed*.
62
- *
63
- * ### Return value
64
- *
65
- * The hook's return value is ignored
66
- *
67
- * @internal
68
- * @param criteria defines which Transitions the Hook should be invoked for.
69
- * @param callback the hook function which will be invoked.
70
- * @param options the registration options
71
- * @returns a function which deregisters the hook.
72
- */
73
- /**
74
- * Creates a new [[Transition]] object
75
- *
76
- * This is a factory function for creating new Transition objects.
77
- * It is used internally by the [[StateService]] and should generally not be called by application code.
78
- *
79
- * @internal
80
- * @param fromPath the path to the current state (the from state)
81
- * @param targetState the target state (destination)
82
- * @returns a Transition
83
- */
84
- create(fromPath: any, targetState: any): Transition;
85
- _defineCoreEvents(): void;
86
- _defineCorePaths(): void;
87
- _defineEvent(
88
- name: any,
89
- hookPhase: any,
90
- hookOrder: any,
91
- criteriaMatchPath: any,
92
- reverseSort?: boolean,
93
- getResultHandler?: (hook: any) => (result: any) => any,
94
- getErrorHandler?: () => (error: any) => any,
95
- synchronous?: boolean,
96
- ): void;
97
- _getEvents(phase: any): any[];
98
- /**
99
- * Adds a Path to be used as a criterion against a TreeChanges path
100
- *
101
- * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.
102
- * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`
103
- * Each state in the exiting path is checked against the criteria and returned as part of the match.
104
- *
105
- * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.
106
- * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`
107
- * Only the tail of the `to` path is checked against the criteria and returned as part of the match.
108
- *
109
- * @internal
110
- */
111
- _definePathType(name: any, hookScope: any): void;
112
- _getPathTypes(): {};
113
- getHooks(hookName: any): any;
114
- _registerCoreTransitionHooks(): void;
115
- }
116
- import { Transition } from "./transition.js";
@@ -1,396 +0,0 @@
1
- /** @typedef {import('./interface.ts').IHookRegistry} IHookRegistry */
2
- /**
3
- * Represents a transition between two states.
4
- *
5
- * When navigating to a state, we are transitioning **from** the current state **to** the new state.
6
- *
7
- * This object contains all contextual information about the to/from states, parameters, resolves.
8
- * It has information about all states being entered and exited as a result of the transition.
9
- * @implements {IHookRegistry}
10
- */
11
- export class Transition implements IHookRegistry {
12
- /**
13
- * Creates a new Transition object.
14
- *
15
- * If the target state is not valid, an error is thrown.
16
- *
17
- * @param {Array<import('../path/path-node.js').PathNode>} 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 {import('../state/target-state.js').TargetState} targetState The target state and parameters being transitioned to (also, the transition options)
20
- * @param {import('../transition/transition-service.js').TransitionProvider} transitionService The [[TransitionService]] instance
21
- * @param {import('../router.js').Router} globals
22
- */
23
- constructor(
24
- fromPath: Array<import("../path/path-node.js").PathNode>,
25
- targetState: import("../state/target-state.js").TargetState,
26
- transitionService: import("../transition/transition-service.js").TransitionProvider,
27
- globals: import("../router.js").Router,
28
- );
29
- /**
30
- * @type {import('../router.js').Router}
31
- */
32
- globals: import("../router.js").Router;
33
- transitionService: import("../transition/transition-service.js").TransitionProvider;
34
- _deferred: any;
35
- /**
36
- * This promise is resolved or rejected based on the outcome of the Transition.
37
- *
38
- * When the transition is successful, the promise is resolved
39
- * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error
40
- */
41
- promise: any;
42
- /** @internal Holds the hook registration functions such as those passed to Transition.onStart() */
43
- _registeredHooks: {};
44
- _hookBuilder: HookBuilder;
45
- /** Checks if this transition is currently active/running. */
46
- isActive: () => boolean;
47
- _targetState: import("../state/target-state.js").TargetState;
48
- _options: any;
49
- $id: number;
50
- _treeChanges: import("./interface.js").TreeChanges;
51
- onStart: any;
52
- onBefore: any;
53
- onSuccess: any;
54
- onEnter: any;
55
- onRetain: any;
56
- onExit: any;
57
- onFinish: any;
58
- onError: any;
59
- /**
60
- * Creates the transition-level hook registration functions
61
- * (which can then be used to register hooks)
62
- */
63
- createTransitionHookRegFns(): void;
64
- getHooks(hookName: any): any;
65
- applyViewConfigs(): void;
66
- /**
67
- * @returns {import('../state/state-object.js').StateObject} the internal from [State] object
68
- */
69
- $from(): import("../state/state-object.js").StateObject;
70
- /**
71
- * @returns {import('../state/state-object.js').StateObject} the internal to [State] object
72
- */
73
- $to(): import("../state/state-object.js").StateObject;
74
- /**
75
- * Returns the "from state"
76
- *
77
- * Returns the state that the transition is coming *from*.
78
- *
79
- * @returns The state declaration object for the Transition's ("from state").
80
- */
81
- from(): import("../state/interface.ts").StateDeclaration;
82
- /**
83
- * Returns the "to state"
84
- *
85
- * Returns the state that the transition is going *to*.
86
- *
87
- * @returns The state declaration object for the Transition's target state ("to state").
88
- */
89
- to(): import("../state/interface.ts").StateDeclaration;
90
- /**
91
- * Gets the Target State
92
- *
93
- * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object.
94
- *
95
- * @returns the [[TargetState]] of this Transition
96
- */
97
- targetState(): import("../state/target-state.js").TargetState;
98
- /**
99
- * Determines whether two transitions are equivalent.
100
- * @deprecated
101
- */
102
- is(compare: any): any;
103
- params(pathname?: string): any;
104
- paramsChanged(): any;
105
- /**
106
- * Creates a [[UIInjector]] Dependency Injector
107
- *
108
- * Returns a Dependency Injector for the Transition's target state (to state).
109
- * The injector provides resolve values which the target state has access to.
110
- *
111
- * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2).
112
- *
113
- * #### Example:
114
- * ```js
115
- * .onEnter({ entering: 'myState' }, trans => {
116
- * var myResolveValue = trans.injector().get('myResolve');
117
- * // Inject a global service from the global/native injector (if it exists)
118
- * var MyService = trans.injector().get('MyService');
119
- * })
120
- * ```
121
- *
122
- * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched.
123
- * You can use [[UIInjector.getAsync]] to get a promise for the data.
124
- * #### Example:
125
- * ```js
126
- * .onBefore({}, trans => {
127
- * return trans.injector().getAsync('myResolve').then(myResolveValue =>
128
- * return myResolveValue !== 'ABORT';
129
- * });
130
- * });
131
- * ```
132
- *
133
- * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to.
134
- * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`.
135
- * #### Example:
136
- * ```js
137
- * .onEnter({ to: 'foo.bar' }, trans => {
138
- * // returns result of `foo` state's `myResolve` resolve
139
- * // even though `foo.bar` also has a `myResolve` resolve
140
- * var fooData = trans.injector('foo').get('myResolve');
141
- * });
142
- * ```
143
- *
144
- * If you need resolve data from the exiting states, pass `'from'` as `pathName`.
145
- * The resolve data from the `from` path will be returned.
146
- * #### Example:
147
- * ```js
148
- * .onExit({ exiting: 'foo.bar' }, trans => {
149
- * // Gets the resolve value of `myResolve` from the state being exited
150
- * var fooData = trans.injector(null, 'from').get('myResolve');
151
- * });
152
- * ```
153
- *
154
- *
155
- * @param state Limits the resolves provided to only the resolves the provided state has access to.
156
- * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states.
157
- *
158
- * @returns a [[UIInjector]]
159
- */
160
- injector(
161
- state: any,
162
- pathName?: string,
163
- ): {
164
- native: any;
165
- get(token: any): any;
166
- getAsync(token: any): Promise<any>;
167
- getNative(token: any): any;
168
- };
169
- /**
170
- * Gets all available resolve tokens (keys)
171
- *
172
- * This method can be used in conjunction with [[injector]] to inspect the resolve values
173
- * available to the Transition.
174
- *
175
- * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states
176
- * in the Transition's [[TreeChanges.to]] path.
177
- *
178
- * #### Example:
179
- * This example logs all resolve values
180
- * ```js
181
- * let tokens = trans.getResolveTokens();
182
- * tokens.forEach(token => console.log(token + " = " + trans.injector().get(token)));
183
- * ```
184
- *
185
- * #### Example:
186
- * This example creates promises for each resolve value.
187
- * This triggers fetches of resolves (if any have not yet been fetched).
188
- * When all promises have all settled, it logs the resolve values.
189
- * ```js
190
- * let tokens = trans.getResolveTokens();
191
- * let promise = tokens.map(token => trans.injector().getAsync(token));
192
- * Promise.all(promises).then(values => console.log("Resolved values: " + values));
193
- * ```
194
- *
195
- * Note: Angular 1 users whould use `$q.all()`
196
- *
197
- * @param pathname resolve context's path name (e.g., `to` or `from`)
198
- *
199
- * @returns an array of resolve tokens (keys)
200
- */
201
- getResolveTokens(pathname?: string): any;
202
- /**
203
- * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition.
204
- *
205
- * Allows a transition hook to dynamically add a Resolvable to this Transition.
206
- *
207
- * Use the [[Transition.injector]] to retrieve the resolved data in subsequent hooks ([[UIInjector.get]]).
208
- *
209
- * If a `state` argument is provided, the Resolvable is processed when that state is being entered.
210
- * If no `state` is provided then the root state is used.
211
- * If the given `state` has already been entered, the Resolvable is processed when any child state is entered.
212
- * If no child states will be entered, the Resolvable is processed during the `onFinish` phase of the Transition.
213
- *
214
- * The `state` argument also scopes the resolved data.
215
- * The resolved data is available from the injector for that `state` and any children states.
216
- *
217
- * #### Example:
218
- * ```js
219
- * transitionService.onBefore({}, transition => {
220
- * transition.addResolvable({
221
- * token: 'myResolve',
222
- * deps: ['MyService'],
223
- * resolveFn: myService => myService.getData()
224
- * });
225
- * });
226
- * ```
227
- *
228
- * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]])
229
- * @param state the state in the "to path" which should receive the new resolve (otherwise, the root state)
230
- */
231
- addResolvable(resolvable: any, state: any): void;
232
- /**
233
- * Gets the transition from which this transition was redirected.
234
- *
235
- * If the current transition is a redirect, this method returns the transition that was redirected.
236
- *
237
- * #### Example:
238
- * ```js
239
- * let transitionA = $state.go('A').transition
240
- * transitionA.onStart({}, () => $state.target('B'));
241
- * $transitions.onSuccess({ to: 'B' }, (trans) => {
242
- * trans.to().name === 'B'; // true
243
- * trans.redirectedFrom() === transitionA; // true
244
- * });
245
- * ```
246
- *
247
- * @returns The previous Transition, or null if this Transition is not the result of a redirection
248
- */
249
- redirectedFrom(): any;
250
- /**
251
- * Gets the original transition in a redirect chain
252
- *
253
- * A transition might belong to a long chain of multiple redirects.
254
- * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain.
255
- *
256
- * #### Example:
257
- * ```js
258
- * // states
259
- * registry.register({ name: 'A', redirectTo: 'B' });
260
- * registry.register({ name: 'B', redirectTo: 'C' });
261
- * registry.register({ name: 'C', redirectTo: 'D' });
262
- * registry.register({ name: 'D' });
263
- *
264
- * let transitionA = $state.go('A').transition
265
- *
266
- * $transitions.onSuccess({ to: 'D' }, (trans) => {
267
- * trans.to().name === 'D'; // true
268
- * trans.redirectedFrom().to().name === 'C'; // true
269
- * trans.originalTransition() === transitionA; // true
270
- * trans.originalTransition().to().name === 'A'; // true
271
- * });
272
- * ```
273
- *
274
- * @returns The original Transition that started a redirect chain
275
- */
276
- originalTransition(): any;
277
- /**
278
- * Get the transition options
279
- *
280
- * @returns the options for this Transition.
281
- */
282
- options(): any;
283
- /**
284
- * Gets the states being entered.
285
- *
286
- * @returns an array of states that will be entered during this transition.
287
- */
288
- entering(): any;
289
- /**
290
- * Gets the states being exited.
291
- *
292
- * @returns an array of states that will be exited during this transition.
293
- */
294
- exiting(): any;
295
- /**
296
- * Gets the states being retained.
297
- *
298
- * @returns an array of states that are already entered from a previous Transition, that will not be
299
- * exited during this Transition
300
- */
301
- retained(): any;
302
- /**
303
- * Get the [[ViewConfig]]s associated with this Transition
304
- *
305
- * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects.
306
- * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., "to" or "entering").
307
- *
308
- * @param pathname the name of the path to fetch views for:
309
- * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)
310
- * @param state If provided, only returns the `ViewConfig`s for a single state in the path
311
- *
312
- * @returns a list of ViewConfig objects for the given path.
313
- */
314
- views(pathname: string, state: any): any;
315
- treeChanges(
316
- pathname: any,
317
- ):
318
- | import("../path/path-node.js").PathNode[]
319
- | import("./interface.js").TreeChanges;
320
- /**
321
- * Creates a new transition that is a redirection of the current one.
322
- *
323
- * This transition can be returned from a [[TransitionService]] hook to
324
- * redirect a transition to a new state and/or set of parameters.
325
- *
326
- * @internal
327
- *
328
- * @returns Returns a new [[Transition]] instance.
329
- */
330
- redirect(targetState: any): Transition;
331
- /** @internal If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */
332
- _changedParams(): any;
333
- /**
334
- * Returns true if the transition is dynamic.
335
- *
336
- * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed.
337
- *
338
- * @returns true if the Transition is dynamic
339
- */
340
- dynamic(): any;
341
- /**
342
- * Returns true if the transition is ignored.
343
- *
344
- * A transition is ignored if no states are entered nor exited, and no parameter values have changed.
345
- *
346
- * @returns true if the Transition is ignored.
347
- */
348
- ignored(): boolean;
349
- _ignoredReason(): "SameAsCurrent" | "SameAsPending";
350
- /**
351
- * Runs the transition
352
- *
353
- * This method is generally called from the [[StateService.transitionTo]]
354
- *
355
- * @internal
356
- *
357
- * @returns a promise for a successful transition.
358
- */
359
- run(): any;
360
- success: boolean;
361
- _error: any;
362
- /**
363
- * Checks if the Transition is valid
364
- *
365
- * @returns true if the Transition is valid
366
- */
367
- valid(): boolean;
368
- /**
369
- * Aborts this transition
370
- *
371
- * Imperative API to abort a Transition.
372
- * This only applies to Transitions that are not yet complete.
373
- */
374
- abort(): void;
375
- _aborted: boolean;
376
- /**
377
- * The Transition error reason.
378
- *
379
- * If the transition is invalid (and could not be run), returns the reason the transition is invalid.
380
- * If the transition was valid and ran, but was not successful, returns the reason the transition failed.
381
- *
382
- * @returns a transition rejection explaining why the transition is invalid, or the reason the transition failed.
383
- */
384
- error(): any;
385
- /**
386
- * A string representation of the Transition
387
- *
388
- * @returns A string representation of the Transition
389
- */
390
- toString(): string;
391
- }
392
- export namespace Transition {
393
- export { Transition as diToken };
394
- }
395
- export type IHookRegistry = import("./interface.ts").IHookRegistry;
396
- import { HookBuilder } from "./hook-builder.js";