@angular-wave/angular.ts 0.9.1 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/@types/angular.d.ts +150 -0
  2. package/@types/animations/animate-cache.d.ts +50 -0
  3. package/@types/animations/animate-children-directive.d.ts +10 -0
  4. package/@types/animations/animate-css-driver.d.ts +18 -0
  5. package/@types/animations/animate-css.d.ts +18 -0
  6. package/@types/animations/animate-js-driver.d.ts +14 -0
  7. package/@types/animations/animate-js.d.ts +23 -0
  8. package/@types/animations/animate-queue.d.ts +28 -0
  9. package/@types/animations/animate-runner.d.ts +31 -0
  10. package/@types/animations/animate-swap.d.ts +9 -0
  11. package/@types/animations/animate.d.ts +450 -0
  12. package/@types/animations/animation.d.ts +14 -0
  13. package/@types/animations/interface.d.ts +17 -0
  14. package/@types/animations/raf-scheduler.d.ts +37 -0
  15. package/@types/animations/shared.d.ts +74 -0
  16. package/@types/core/compile/compile.d.ts +201 -0
  17. package/@types/core/controller/controller.d.ts +54 -0
  18. package/@types/core/di/injector.d.ts +22 -0
  19. package/@types/core/filter/filter.d.ts +23 -0
  20. package/@types/core/interpolate/interpolate.d.ts +38 -0
  21. package/@types/core/parse/ast/ast-node.d.ts +56 -0
  22. package/@types/core/parse/ast/ast.d.ts +164 -0
  23. package/@types/core/parse/lexer/lexer.d.ts +119 -0
  24. package/@types/core/parse/lexer/token.d.ts +17 -0
  25. package/@types/core/parse/parse.d.ts +33 -0
  26. package/@types/core/parse/parser/parser.d.ts +41 -0
  27. package/@types/core/sanitize/sanitize-uri.d.ts +40 -0
  28. package/@types/directive/aria/aria.d.ts +104 -0
  29. package/@types/directive/attrs/attrs.d.ts +8 -0
  30. package/@types/directive/bind/bind.d.ts +18 -0
  31. package/@types/directive/channel/channel.d.ts +10 -0
  32. package/@types/directive/class/class.d.ts +3 -0
  33. package/@types/directive/cloak/cloak.d.ts +4 -0
  34. package/@types/directive/controller/controller.d.ts +4 -0
  35. package/@types/directive/events/events.d.ts +21 -0
  36. package/@types/directive/form/form.d.ts +264 -0
  37. package/@types/directive/http/http.d.ts +46 -0
  38. package/@types/directive/if/if.d.ts +10 -0
  39. package/@types/directive/include/include.d.ts +28 -0
  40. package/@types/directive/init/init.d.ts +4 -0
  41. package/@types/directive/input/input.d.ts +70 -0
  42. package/@types/directive/messages/messages.d.ts +63 -0
  43. package/@types/directive/model/model.d.ts +515 -0
  44. package/@types/directive/model-options/model-options.d.ts +56 -0
  45. package/@types/directive/non-bindable/non-bindable.d.ts +4 -0
  46. package/@types/directive/observe/observe.d.ts +9 -0
  47. package/@types/directive/options/options.d.ts +13 -0
  48. package/@types/directive/ref/ref.d.ts +11 -0
  49. package/@types/directive/repeat/repeat.d.ts +11 -0
  50. package/@types/directive/script/script.d.ts +10 -0
  51. package/@types/directive/select/select.d.ts +15 -0
  52. package/@types/directive/setter/setter.d.ts +12 -0
  53. package/@types/directive/show-hide/show-hide.d.ts +19 -0
  54. package/@types/directive/style/style.d.ts +4 -0
  55. package/@types/directive/switch/switch.d.ts +18 -0
  56. package/@types/directive/transclude/transclude.d.ts +10 -0
  57. package/@types/directive/validators/validators.d.ts +149 -0
  58. package/@types/filters/filter.d.ts +4 -0
  59. package/@types/filters/filters.d.ts +38 -0
  60. package/@types/filters/limit-to.d.ts +4 -0
  61. package/@types/filters/order-by.d.ts +7 -0
  62. package/@types/index.d.ts +2 -0
  63. package/@types/interface.d.ts +5 -4
  64. package/@types/ng.d.ts +8 -0
  65. package/@types/router/common/trace.d.ts +66 -0
  66. package/@types/router/directives/state-directives.d.ts +46 -0
  67. package/@types/router/directives/view-directive.d.ts +138 -0
  68. package/@types/router/glob/glob.d.ts +81 -0
  69. package/@types/router/hooks/core-resolvables.d.ts +2 -0
  70. package/@types/router/hooks/ignored-transition.d.ts +1 -0
  71. package/@types/router/hooks/invalid-transition.d.ts +1 -0
  72. package/@types/router/hooks/lazy-load.d.ts +42 -0
  73. package/@types/router/hooks/on-enter-exit-retain.d.ts +3 -0
  74. package/@types/router/hooks/redirect-to.d.ts +4 -0
  75. package/@types/router/hooks/resolve.d.ts +4 -0
  76. package/@types/router/hooks/update-globals.d.ts +1 -0
  77. package/@types/router/hooks/url.d.ts +5 -0
  78. package/@types/router/hooks/views.d.ts +5 -0
  79. package/@types/router/params/interface.d.ts +606 -0
  80. package/@types/router/params/param-factory.d.ts +16 -0
  81. package/@types/router/params/param-type.d.ts +59 -0
  82. package/@types/router/params/param.d.ts +71 -0
  83. package/@types/router/params/state-params.d.ts +12 -0
  84. package/@types/router/path/path-node.d.ts +38 -0
  85. package/@types/router/path/path-utils.d.ts +88 -0
  86. package/@types/router/resolve/interface.d.ts +200 -0
  87. package/@types/router/resolve/resolvable.d.ts +50 -0
  88. package/@types/router/resolve/resolve-context.d.ts +93 -0
  89. package/@types/router/router.d.ts +47 -0
  90. package/@types/router/state/interface.d.ts +983 -0
  91. package/@types/router/state/state-builder.d.ts +95 -0
  92. package/@types/router/state/state-matcher.d.ts +7 -0
  93. package/@types/router/state/state-object.d.ts +83 -0
  94. package/@types/router/state/state-queue-manager.d.ts +29 -0
  95. package/@types/router/state/state-registry.d.ts +133 -0
  96. package/@types/router/state/state-service.d.ts +425 -0
  97. package/@types/router/state/target-state.d.ts +102 -0
  98. package/@types/router/state/views.d.ts +58 -0
  99. package/@types/router/state-filters.d.ts +39 -0
  100. package/@types/router/template-factory.d.ts +117 -0
  101. package/@types/router/transition/hook-builder.d.ts +45 -0
  102. package/@types/router/transition/hook-registry.d.ts +102 -0
  103. package/@types/router/transition/interface.d.ts +880 -0
  104. package/@types/router/transition/reject-factory.d.ts +43 -0
  105. package/@types/router/transition/transition-event-type.d.ts +24 -0
  106. package/@types/router/transition/transition-hook.d.ts +86 -0
  107. package/@types/router/transition/transition-service.d.ts +116 -0
  108. package/@types/router/transition/transition.d.ts +331 -0
  109. package/@types/router/url/url-config.d.ts +99 -0
  110. package/@types/router/url/url-matcher.d.ts +174 -0
  111. package/@types/router/url/url-rule.d.ts +161 -0
  112. package/@types/router/url/url-rules.d.ts +249 -0
  113. package/@types/router/url/url-service.d.ts +254 -0
  114. package/@types/router/view/interface.d.ts +44 -0
  115. package/@types/router/view/view.d.ts +149 -0
  116. package/@types/router/view-scroll.d.ts +10 -0
  117. package/@types/services/anchor-scroll.d.ts +25 -0
  118. package/@types/services/cookie-reader.d.ts +4 -0
  119. package/@types/services/http/http.d.ts +134 -0
  120. package/@types/services/http-backend/http-backend.d.ts +58 -0
  121. package/@types/services/sce/sce.d.ts +238 -0
  122. package/@types/services/template-request.d.ts +55 -0
  123. package/@types/shared/common.d.ts +197 -0
  124. package/@types/shared/hof.d.ts +108 -0
  125. package/@types/shared/predicates.d.ts +17 -0
  126. package/@types/shared/queue.d.ts +64 -0
  127. package/@types/shared/strings.d.ts +58 -0
  128. package/dist/angular-ts.esm.js +2 -3
  129. package/dist/angular-ts.umd.js +2 -3
  130. package/dist/angular-ts.umd.min.js +1 -1
  131. package/docs/layouts/shortcodes/version.html +1 -1
  132. package/package.json +1 -1
  133. package/src/interface.ts +5 -4
  134. package/src/services/pubsub/pubsub.js +0 -1
@@ -0,0 +1,43 @@
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
+ }
@@ -0,0 +1,24 @@
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
+ }
@@ -0,0 +1,86 @@
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
+ }
@@ -0,0 +1,116 @@
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";
@@ -0,0 +1,331 @@
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
+ /**
105
+ * Gets all available resolve tokens (keys)
106
+ *
107
+ * This method can be used in conjunction with [[injector]] to inspect the resolve values
108
+ * available to the Transition.
109
+ *
110
+ * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states
111
+ * in the Transition's [[TreeChanges.to]] path.
112
+ *
113
+ * #### Example:
114
+ * This example logs all resolve values
115
+ * ```js
116
+ * let tokens = trans.getResolveTokens();
117
+ * tokens.forEach(token => console.log(token + " = " + trans.injector().get(token)));
118
+ * ```
119
+ *
120
+ * #### Example:
121
+ * This example creates promises for each resolve value.
122
+ * This triggers fetches of resolves (if any have not yet been fetched).
123
+ * When all promises have all settled, it logs the resolve values.
124
+ * ```js
125
+ * let tokens = trans.getResolveTokens();
126
+ * let promise = tokens.map(token => trans.injector().getAsync(token));
127
+ * Promise.all(promises).then(values => console.log("Resolved values: " + values));
128
+ * ```
129
+ *
130
+ * Note: Angular 1 users whould use `$q.all()`
131
+ *
132
+ * @param pathname resolve context's path name (e.g., `to` or `from`)
133
+ *
134
+ * @returns an array of resolve tokens (keys)
135
+ */
136
+ getResolveTokens(pathname?: string): any;
137
+ /**
138
+ * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition.
139
+ *
140
+ * Allows a transition hook to dynamically add a Resolvable to this Transition.
141
+ *
142
+ * Use the [[Transition.injector]] to retrieve the resolved data in subsequent hooks ([[UIInjector.get]]).
143
+ *
144
+ * If a `state` argument is provided, the Resolvable is processed when that state is being entered.
145
+ * If no `state` is provided then the root state is used.
146
+ * If the given `state` has already been entered, the Resolvable is processed when any child state is entered.
147
+ * If no child states will be entered, the Resolvable is processed during the `onFinish` phase of the Transition.
148
+ *
149
+ * The `state` argument also scopes the resolved data.
150
+ * The resolved data is available from the injector for that `state` and any children states.
151
+ *
152
+ * #### Example:
153
+ * ```js
154
+ * transitionService.onBefore({}, transition => {
155
+ * transition.addResolvable({
156
+ * token: 'myResolve',
157
+ * deps: ['MyService'],
158
+ * resolveFn: myService => myService.getData()
159
+ * });
160
+ * });
161
+ * ```
162
+ *
163
+ * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]])
164
+ * @param state the state in the "to path" which should receive the new resolve (otherwise, the root state)
165
+ */
166
+ addResolvable(resolvable: any, state: any): void;
167
+ /**
168
+ * Gets the transition from which this transition was redirected.
169
+ *
170
+ * If the current transition is a redirect, this method returns the transition that was redirected.
171
+ *
172
+ * #### Example:
173
+ * ```js
174
+ * let transitionA = $state.go('A').transition
175
+ * transitionA.onStart({}, () => $state.target('B'));
176
+ * $transitions.onSuccess({ to: 'B' }, (trans) => {
177
+ * trans.to().name === 'B'; // true
178
+ * trans.redirectedFrom() === transitionA; // true
179
+ * });
180
+ * ```
181
+ *
182
+ * @returns The previous Transition, or null if this Transition is not the result of a redirection
183
+ */
184
+ redirectedFrom(): any;
185
+ /**
186
+ * Gets the original transition in a redirect chain
187
+ *
188
+ * A transition might belong to a long chain of multiple redirects.
189
+ * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain.
190
+ *
191
+ * #### Example:
192
+ * ```js
193
+ * // states
194
+ * registry.register({ name: 'A', redirectTo: 'B' });
195
+ * registry.register({ name: 'B', redirectTo: 'C' });
196
+ * registry.register({ name: 'C', redirectTo: 'D' });
197
+ * registry.register({ name: 'D' });
198
+ *
199
+ * let transitionA = $state.go('A').transition
200
+ *
201
+ * $transitions.onSuccess({ to: 'D' }, (trans) => {
202
+ * trans.to().name === 'D'; // true
203
+ * trans.redirectedFrom().to().name === 'C'; // true
204
+ * trans.originalTransition() === transitionA; // true
205
+ * trans.originalTransition().to().name === 'A'; // true
206
+ * });
207
+ * ```
208
+ *
209
+ * @returns The original Transition that started a redirect chain
210
+ */
211
+ originalTransition(): any;
212
+ /**
213
+ * Get the transition options
214
+ *
215
+ * @returns the options for this Transition.
216
+ */
217
+ options(): any;
218
+ /**
219
+ * Gets the states being entered.
220
+ *
221
+ * @returns an array of states that will be entered during this transition.
222
+ */
223
+ entering(): any;
224
+ /**
225
+ * Gets the states being exited.
226
+ *
227
+ * @returns an array of states that will be exited during this transition.
228
+ */
229
+ exiting(): any;
230
+ /**
231
+ * Gets the states being retained.
232
+ *
233
+ * @returns an array of states that are already entered from a previous Transition, that will not be
234
+ * exited during this Transition
235
+ */
236
+ retained(): any;
237
+ /**
238
+ * Get the [[ViewConfig]]s associated with this Transition
239
+ *
240
+ * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects.
241
+ * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., "to" or "entering").
242
+ *
243
+ * @param pathname the name of the path to fetch views for:
244
+ * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)
245
+ * @param state If provided, only returns the `ViewConfig`s for a single state in the path
246
+ *
247
+ * @returns a list of ViewConfig objects for the given path.
248
+ */
249
+ views(pathname: string, state: any): any;
250
+ treeChanges(
251
+ pathname: any,
252
+ ):
253
+ | import("../path/path-node.js").PathNode[]
254
+ | import("./interface.js").TreeChanges;
255
+ /**
256
+ * Creates a new transition that is a redirection of the current one.
257
+ *
258
+ * This transition can be returned from a [[TransitionService]] hook to
259
+ * redirect a transition to a new state and/or set of parameters.
260
+ *
261
+ * @internal
262
+ *
263
+ * @returns Returns a new [[Transition]] instance.
264
+ */
265
+ redirect(targetState: any): Transition;
266
+ /** @internal If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */
267
+ _changedParams(): any;
268
+ /**
269
+ * Returns true if the transition is dynamic.
270
+ *
271
+ * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed.
272
+ *
273
+ * @returns true if the Transition is dynamic
274
+ */
275
+ dynamic(): any;
276
+ /**
277
+ * Returns true if the transition is ignored.
278
+ *
279
+ * A transition is ignored if no states are entered nor exited, and no parameter values have changed.
280
+ *
281
+ * @returns true if the Transition is ignored.
282
+ */
283
+ ignored(): boolean;
284
+ _ignoredReason(): "SameAsCurrent" | "SameAsPending";
285
+ /**
286
+ * Runs the transition
287
+ *
288
+ * This method is generally called from the [[StateService.transitionTo]]
289
+ *
290
+ * @internal
291
+ *
292
+ * @returns a promise for a successful transition.
293
+ */
294
+ run(): any;
295
+ success: boolean;
296
+ _error: any;
297
+ /**
298
+ * Checks if the Transition is valid
299
+ *
300
+ * @returns true if the Transition is valid
301
+ */
302
+ valid(): boolean;
303
+ /**
304
+ * Aborts this transition
305
+ *
306
+ * Imperative API to abort a Transition.
307
+ * This only applies to Transitions that are not yet complete.
308
+ */
309
+ abort(): void;
310
+ _aborted: boolean;
311
+ /**
312
+ * The Transition error reason.
313
+ *
314
+ * If the transition is invalid (and could not be run), returns the reason the transition is invalid.
315
+ * If the transition was valid and ran, but was not successful, returns the reason the transition failed.
316
+ *
317
+ * @returns a transition rejection explaining why the transition is invalid, or the reason the transition failed.
318
+ */
319
+ error(): any;
320
+ /**
321
+ * A string representation of the Transition
322
+ *
323
+ * @returns A string representation of the Transition
324
+ */
325
+ toString(): string;
326
+ }
327
+ export namespace Transition {
328
+ export { Transition as diToken };
329
+ }
330
+ export type IHookRegistry = import("./interface.ts").IHookRegistry;
331
+ import { HookBuilder } from "./hook-builder.js";
@@ -0,0 +1,99 @@
1
+ /**
2
+ * An API to customize the URL behavior and retrieve URL configuration
3
+ *
4
+ * This API is used to customize the behavior of the URL.
5
+ * This includes optional trailing slashes ([[strictMode]]), case sensitivity ([[caseInsensitive]]),
6
+ * and custom parameter encoding (custom [[type]]).
7
+ *
8
+ * It also has information about the location (url) configuration such as [[port]] and [[baseHref]].
9
+ * This information can be used to build absolute URLs, such as
10
+ * `https://example.com:443/basepath/state/substate?param1=a#hashvalue`;
11
+ *
12
+ * This API is found at `router.urlService.config` (see: [[UIRouter.urlService]], [[URLService.config]])
13
+ */
14
+ export class UrlConfigProvider {
15
+ /** @type {ParamTypes} */
16
+ paramTypes: ParamTypes;
17
+ /** @type {boolean} */
18
+ _isCaseInsensitive: boolean;
19
+ /** @type {boolean} */
20
+ _isStrictMode: boolean;
21
+ /** @type {boolean} */
22
+ _defaultSquashPolicy: boolean;
23
+ $get: (() => any)[];
24
+ /**
25
+ * Defines whether URL matching should be case sensitive (the default behavior), or not.
26
+ *
27
+ * #### Example:
28
+ * ```js
29
+ * // Allow case insensitive url matches
30
+ * urlService.config.caseInsensitive(true);
31
+ * ```
32
+ *
33
+ * @param value `false` to match URL in a case sensitive manner; otherwise `true`;
34
+ * @returns the current value of caseInsensitive
35
+ */
36
+ caseInsensitive(value: any): any;
37
+ /**
38
+ * Sets the default behavior when generating or matching URLs with default parameter values.
39
+ *
40
+ * #### Example:
41
+ * ```js
42
+ * // Remove default parameter values from the url
43
+ * urlService.config.defaultSquashPolicy(true);
44
+ * ```
45
+ *
46
+ * @param value A string that defines the default parameter URL squashing behavior.
47
+ * - `nosquash`: When generating an href with a default parameter value, do not squash the parameter value from the URL
48
+ * - `slash`: When generating an href with a default parameter value, squash (remove) the parameter value, and, if the
49
+ * parameter is surrounded by slashes, squash (remove) one slash from the URL
50
+ * - any other string, e.g. "~": When generating an href with a default parameter value, squash (remove)
51
+ * the parameter value from the URL and replace it with this string.
52
+ * @returns the current value of defaultSquashPolicy
53
+ */
54
+ defaultSquashPolicy(value: any): any;
55
+ /**
56
+ * Defines whether URLs should match trailing slashes, or not (the default behavior).
57
+ *
58
+ * #### Example:
59
+ * ```js
60
+ * // Allow optional trailing slashes
61
+ * urlService.config.strictMode(false);
62
+ * ```
63
+ *
64
+ * @param value `false` to match trailing slashes in URLs, otherwise `true`.
65
+ * @returns the current value of strictMode
66
+ */
67
+ strictMode(value: any): any;
68
+ /**
69
+ * Creates and registers a custom [[ParamType]] object
70
+ *
71
+ * A custom parameter type can be used to generate URLs with typed parameters or custom encoding/decoding.
72
+ *
73
+ * #### Note: Register custom types *before using them* in a state definition.
74
+ *
75
+ * #### Example:
76
+ * ```js
77
+ * // Encode object parameter as JSON string
78
+ * urlService.config.type('myjson', {
79
+ * encode: (obj) => JSON.stringify(obj),
80
+ * decode: (str) => JSON.parse(str),
81
+ * is: (val) => typeof(val) === 'object',
82
+ * pattern: /[^/]+/,
83
+ * equals: (a, b) => _.isEqual(a, b),
84
+ * });
85
+ * ```
86
+ *
87
+ * See [[ParamTypeDefinition]] for more examples
88
+ *
89
+ * @param name The type name.
90
+ * @param definition The type definition. See [[ParamTypeDefinition]] for information on the values accepted.
91
+ * @param definitionFn A function that is injected before the app runtime starts.
92
+ * The result of this function should be a [[ParamTypeDefinition]].
93
+ * The result is merged into the existing `definition`.
94
+ * See [[ParamType]] for information on the values accepted.
95
+ *
96
+ * @returns if only the `name` parameter was specified: the currently registered [[ParamType]] object, or undefined
97
+ */
98
+ type(name: any, definition: any, definitionFn: any): any;
99
+ }