@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,36 +0,0 @@
1
- /**
2
- * A registry for parameter types.
3
- *
4
- * This registry manages the built-in (and custom) parameter types.
5
- *
6
- * The built-in parameter types are:
7
- *
8
- * - [[string]]
9
- * - [[path]]
10
- * - [[query]]
11
- * - [[hash]]
12
- * - [[int]]
13
- * - [[bool]]
14
- * - [[date]]
15
- * - [[json]]
16
- * - [[any]]
17
- *
18
- * To register custom parameter types, use [[UrlConfig.type]], i.e.,
19
- *
20
- * ```js
21
- * router.urlService.config.type(customType)
22
- * ```
23
- */
24
- export class ParamTypes {
25
- enqueue: boolean;
26
- typeQueue: any[];
27
- defaultTypes: {};
28
- types: any;
29
- /**
30
- * Registers a parameter type
31
- *
32
- * End users should call [[UrlMatcherFactory.type]], which delegates to this method.
33
- */
34
- type(name: any, definition: any, definitionFn: any): any;
35
- _flushTypeQueue(): void;
36
- }
@@ -1,71 +0,0 @@
1
- export type DefType = number;
2
- export namespace DefType {
3
- let PATH: number;
4
- let SEARCH: number;
5
- let CONFIG: number;
6
- }
7
- export class Param {
8
- static values(params: any, values?: {}): {};
9
- /**
10
- * Finds [[Param]] objects which have different param values
11
- *
12
- * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects
13
- *
14
- * @param params: The list of Param objects to filter
15
- * @param values1: The first set of parameter values
16
- * @param values2: the second set of parameter values
17
- *
18
- * @returns any Param objects whose values were different between values1 and values2
19
- */
20
- static changed(params: any, values1?: {}, values2?: {}): any;
21
- /**
22
- * Checks if two param value objects are equal (for a set of [[Param]] objects)
23
- *
24
- * @param params The list of [[Param]] objects to check
25
- * @param values1 The first set of param values
26
- * @param values2 The second set of param values
27
- *
28
- * @returns true if the param values in values1 and values2 are equal
29
- */
30
- static equals(params: any, values1?: {}, values2?: {}): boolean;
31
- /** Returns true if a the parameter values are valid, according to the Param definitions */
32
- static validates(params: any, values?: {}): any;
33
- /**
34
- *
35
- * @param {*} id
36
- * @param {*} type
37
- * @param {DefType} location
38
- * @param {import("../url/url-config.js").UrlConfigProvider} urlConfig
39
- * @param {*} state
40
- */
41
- constructor(
42
- id: any,
43
- type: any,
44
- location: DefType,
45
- urlConfig: import("../url/url-config.js").UrlConfigProvider,
46
- state: any,
47
- );
48
- isOptional: boolean;
49
- type: any;
50
- location: number;
51
- id: any;
52
- dynamic: boolean;
53
- raw: boolean;
54
- squash: any;
55
- replace: any;
56
- inherit: boolean;
57
- array: any;
58
- config: any;
59
- isDefaultValue(value: any): any;
60
- /**
61
- * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the
62
- * default value, which may be the result of an injectable function.
63
- */
64
- value(value: any): any;
65
- _defaultValueCache: {
66
- defaultValue: any;
67
- };
68
- isSearch(): boolean;
69
- validates(value: any): boolean;
70
- toString(): string;
71
- }
@@ -1,12 +0,0 @@
1
- export class StateParams {
2
- constructor(params?: {});
3
- /**
4
- * Merges a set of parameters with all parameters inherited between the common parents of the
5
- * current state and a given destination state.
6
- *
7
- * @param {Object} newParams The set of parameters which will be composited with inherited params.
8
- * @param {Object} $current Internal definition of object representing the current state.
9
- * @param {Object} $to Internal definition of object representing state to transition to.
10
- */
11
- $inherit(newParams: any, $current: any, $to: any): any;
12
- }
@@ -1,38 +0,0 @@
1
- /**
2
- * A node in a [[TreeChanges]] path
3
- *
4
- * For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path.
5
- * Each PathNode corresponds to a state being entered, exited, or retained.
6
- * The stateful information includes parameter values and resolve data.
7
- */
8
- export class PathNode {
9
- constructor(stateOrNode: any);
10
- state: any;
11
- paramSchema: any;
12
- paramValues: any;
13
- resolvables: any;
14
- views: any;
15
- clone(): PathNode;
16
- /** Sets [[paramValues]] for the node, from the values of an object hash */
17
- applyRawParams(params: any): this;
18
- /** Gets a specific [[Param]] metadata that belongs to the node */
19
- parameter(name: any): undefined;
20
- /**
21
- * @returns true if the state and parameter values for another PathNode are
22
- * equal to the state and param values for this PathNode
23
- */
24
- equals(node: any, paramsFn: any): boolean;
25
- /**
26
- * Finds Params with different parameter values on another PathNode.
27
- *
28
- * Given another node (of the same state), finds the parameter values which differ.
29
- * Returns the [[Param]] (schema objects) whose parameter values differ.
30
- *
31
- * Given another node for a different state, returns `false`
32
- *
33
- * @param node The node to compare to
34
- * @param paramsFn A function that returns which parameters should be compared.
35
- * @returns The [[Param]]s which differ, or null if the two nodes are for different states
36
- */
37
- diff(node: any, paramsFn: any): any;
38
- }
@@ -1,88 +0,0 @@
1
- /** Given a PathNode[], create an TargetState
2
- * @param {import("../state/state-registry.js").StateRegistryProvider} registry
3
- * @param {Array<PathNode>} path
4
- * @returns
5
- */
6
- export function makeTargetState(
7
- registry: import("../state/state-registry.js").StateRegistryProvider,
8
- path: Array<PathNode>,
9
- ): TargetState;
10
- /**
11
- * This class contains functions which convert TargetStates, Nodes and paths from one type to another.
12
- */
13
- export class PathUtils {
14
- static buildPath(targetState: any): any;
15
- /** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */
16
- static buildToPath(fromPath: any, targetState: any): any;
17
- /**
18
- * Creates ViewConfig objects and adds to nodes.
19
- *
20
- * On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state
21
- */
22
- static applyViewConfigs($view: any, path: any, states: any): void;
23
- /**
24
- * Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath
25
- *
26
- * For a parameter in a node to be inherited from the from path:
27
- * - The toPath's node must have a matching node in the fromPath (by state).
28
- * - The parameter name must not be found in the toKeys parameter array.
29
- *
30
- * Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some
31
- * caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams,
32
- * it is not inherited from the fromPath.
33
- */
34
- static inheritParams(fromPath: any, toPath: any, toKeys?: any[]): any;
35
- /**
36
- * Computes the tree changes (entering, exiting) between a fromPath and toPath.
37
- * @param {PathNode[]} fromPath
38
- * @param {PathNode[]} toPath
39
- * @param {boolean} [reloadState]
40
- * @returns {import("../transition/interface.js").TreeChanges}
41
- */
42
- static treeChanges(
43
- fromPath: PathNode[],
44
- toPath: PathNode[],
45
- reloadState?: boolean,
46
- ): import("../transition/interface.js").TreeChanges;
47
- /**
48
- * Returns a new path which is: the subpath of the first path which matches the second path.
49
- *
50
- * The new path starts from root and contains any nodes that match the nodes in the second path.
51
- * It stops before the first non-matching node.
52
- *
53
- * Nodes are compared using their state property and their parameter values.
54
- * If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes.
55
- *
56
- * @param pathA the first path
57
- * @param pathB the second path
58
- * @param paramsFn a function which returns the parameters to consider when comparing
59
- *
60
- * @returns an array of PathNodes from the first path which match the nodes in the second path
61
- */
62
- static matching(pathA: any, pathB: any, paramsFn: any): any[];
63
- /**
64
- * Returns true if two paths are identical.
65
- *
66
- * @param pathA
67
- * @param pathB
68
- * @param paramsFn a function which returns the parameters to consider when comparing
69
- * @returns true if the the states and parameter values for both paths are identical
70
- */
71
- static equals(pathA: any, pathB: any, paramsFn: any): boolean;
72
- /**
73
- * Return a subpath of a path, which stops at the first matching node
74
- *
75
- * Given an array of nodes, returns a subset of the array starting from the first node,
76
- * stopping when the first node matches the predicate.
77
- *
78
- * @param path a path of [[PathNode]]s
79
- * @param predicate a [[Predicate]] fn that matches [[PathNode]]s
80
- * @returns a subpath up to the matching node, or undefined if no match is found
81
- */
82
- static subPath(path: any, predicate: any): any;
83
- static nonDynamicParams(node: any): any;
84
- /** Gets the raw parameter values from a path */
85
- static paramValues(path: any): any;
86
- }
87
- import { PathNode } from "./path-node.js";
88
- import { TargetState } from "../state/target-state.js";
@@ -1,200 +0,0 @@
1
- /**
2
- * # The Resolve subsystem
3
- *
4
- * This subsystem is an asynchronous, hierarchical Dependency Injection system.
5
- *
6
- * Typically, resolve is configured on a state using a [[StateDeclaration.resolve]] declaration.
7
- *
8
- * @packageDocumentation
9
- */
10
- /**
11
- * An interface which is similar to an Angular 2 `Provider`
12
- */
13
- export interface ProviderLike {
14
- provide: any;
15
- useClass?: any;
16
- useFactory?: Function;
17
- useValue?: any;
18
- useExisting?: any;
19
- deps?: any[];
20
- }
21
- /**
22
- * A plain object used to describe a [[Resolvable]]
23
- *
24
- * These objects may be used in the [[StateDeclaration.resolve]] array to declare
25
- * async data that the state or substates require.
26
- *
27
- * #### Example:
28
- * ```js
29
- *
30
- * var state = {
31
- * name: 'main',
32
- * resolve: [
33
- * { token: 'myData', deps: [MyDataApi], resolveFn: (myDataApi) => myDataApi.getData() },
34
- * ],
35
- * }
36
- * ```
37
- */
38
- export interface ResolvableLiteral {
39
- /**
40
- * A Dependency Injection token
41
- *
42
- * This Resolvable's DI token.
43
- * The Resolvable will be injectable elsewhere using the token.
44
- */
45
- token: any;
46
- /**
47
- * A function which fetches the Resolvable's data
48
- *
49
- * A function which returns one of:
50
- *
51
- * - The resolved value (synchronously)
52
- * - A promise for the resolved value
53
- * - An Observable of the resolved value(s)
54
- *
55
- * This function will be provided the dependencies listed in [[deps]] as its arguments.
56
- * The resolve system will asynchronously fetch the dependencies before invoking this function.
57
- */
58
- resolveFn: Function;
59
- /**
60
- * Defines the Resolve Policy
61
- *
62
- * A policy that defines when to invoke the resolve,
63
- * and whether to wait for async and unwrap the data
64
- */
65
- policy?: ResolvePolicy;
66
- /**
67
- * The Dependency Injection tokens
68
- *
69
- * This is an array of Dependency Injection tokens for the dependencies of the [[resolveFn]].
70
- *
71
- * The DI tokens are references to other `Resolvables`, or to other
72
- * services from the native DI system.
73
- */
74
- deps?: any[];
75
- /** Pre-resolved data. */
76
- data?: any;
77
- }
78
- /**
79
- * Defines how a resolve is processed during a transition
80
- *
81
- * This object is the [[StateDeclaration.resolvePolicy]] property.
82
- *
83
- * #### Example:
84
- * ```js
85
- * // Fetched when the resolve's state is being entered.
86
- * // Wait for the promise to resolve.
87
- * var policy1 = { when: "LAZY", async: "WAIT" }
88
- *
89
- * // Fetched when the Transition is starting.
90
- * // Do not wait for the returned promise to resolve.
91
- * // Inject the raw promise/value
92
- * var policy2 = { when: "EAGER", async: "NOWAIT" }
93
- * ```
94
- *
95
- * The policy for a given Resolvable is merged from three sources (highest priority first):
96
- *
97
- * - 1) Individual resolve definition
98
- * - 2) State definition
99
- * - 3) Global default
100
- *
101
- * #### Example:
102
- * ```js
103
- * // Wait for an Observable to emit one item.
104
- * // Since `wait` is not specified, it uses the `wait`
105
- * // policy defined on the state, or the global default
106
- * // if no `wait` policy is defined on the state
107
- * import { RXWAIT } from '@uirouter/rx';
108
- *
109
- * var myResolvablePolicy = { async: RXWAIT }
110
- * ```
111
- */
112
- export interface ResolvePolicy {
113
- /**
114
- * Defines when a Resolvable is resolved (fetched) during a transition
115
- *
116
- * - `LAZY` (default)
117
- * - Resolved as the resolve's state is being entered
118
- * - `EAGER`
119
- * - Resolved as the transition is starting
120
- *
121
- * #### Example:
122
- * Resolves for `main` and `main.home` are fetched when each state is entered.
123
- * All of `main` resolves are processed before fetching `main.home` resolves.
124
- * ```js
125
- * var state = {
126
- * name: 'main',
127
- * resolve: mainResolves, // defined elsewhere
128
- * resolvePolicy: { when: 'LAZY' }, // default
129
- * }
130
- *
131
- * var state = {
132
- * name: 'main.home',
133
- * resolve: homeResolves, // defined elsewhere
134
- * resolvePolicy: { when: 'LAZY' }, // default
135
- * }
136
- * ```
137
- *
138
- * #### Example:
139
- * Resolves for `main` and `main.home` are fetched at the same time when the transition starts.
140
- * This happens earlier in the lifecycle than when states are entered.
141
- * All of the `main` and `main.home` resolves are fetched as soon as possible.
142
- * ```js
143
- * var mainState = {
144
- * name: 'main',
145
- * resolve: mainResolves, // defined elsewhere
146
- * resolvePolicy: { when: 'EAGER' },
147
- * }
148
- *
149
- * var homeState = {
150
- * name: 'main.home',
151
- * resolve: homeResolves, // defined elsewhere
152
- * resolvePolicy: { when: 'EAGER' },
153
- * }
154
- * ```
155
- */
156
- when?: PolicyWhen;
157
- /**
158
- * Determines the unwrapping behavior of asynchronous resolve values.
159
- *
160
- * - `WAIT` (default)
161
- * - If a promise is returned from the resolveFn, wait for the promise before proceeding
162
- * - The unwrapped value from the promise
163
- * - `NOWAIT`
164
- * - If a promise is returned from the resolve, do not wait for the promise.
165
- * - Any other value returned is wrapped in a promise.
166
- * - The promise will not be unwrapped.
167
- * - The promise itself will be provided when the resolve is injected or bound elsewhere.
168
- * - {@link CustomAsyncPolicy}
169
- * - You can define a custom function that will be called with the resolveFn value.
170
- * - This function must return a promise.
171
- * - The transition will wait for this promise before proceeding
172
- *
173
- * NOTE: The previous `RXWAIT` policy has become a CustomAsyncPolicy function exported in `@uirouter/rx` package.
174
- *
175
- * #### Example:
176
- * The `Transition` will not wait for the resolve promise(s) from `main` to settle before continuing.
177
- * Resolves for `main` will be provided to components wrapped in a `Promise`.
178
- *
179
- * The `Transition` will wait for the `main.home` resolve promises.
180
- * Resolved values will be unwrapped before being provided to components.
181
- * ```js
182
- * var mainState = {
183
- * name: 'main',
184
- * resolve: mainResolves, // defined elsewhere
185
- * resolvePolicy: { async: 'NOWAIT' },
186
- * }
187
- * var homeState = {
188
- * name: 'main.home',
189
- * resolve: homeResolves, // defined elsewhere
190
- * resolvePolicy: { async: 'WAIT' }, // default
191
- * }
192
- * ```
193
- */
194
- async?: PolicyAsync;
195
- }
196
- export type PolicyWhen = "LAZY" | "EAGER";
197
- export type PolicyAsync = "WAIT" | "NOWAIT" | CustomAsyncPolicy;
198
- export interface CustomAsyncPolicy {
199
- (data: any): Promise<any>;
200
- }
@@ -1,50 +0,0 @@
1
- export namespace defaultResolvePolicy {
2
- let when: string;
3
- let async: string;
4
- }
5
- /**
6
- * The basic building block for the resolve system.
7
- *
8
- * Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise),
9
- * and the unwrapped-when-complete (.data) result of the resolveFn.
10
- *
11
- * Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the
12
- * resolveFn) and returns the resulting promise.
13
- *
14
- * Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first
15
- * parameter to those fns.
16
- */
17
- export class Resolvable {
18
- constructor(arg1: any, resolveFn: any, deps: any, policy: any, data: any);
19
- resolved: boolean;
20
- promise: Promise<any>;
21
- token: any;
22
- policy: any;
23
- resolveFn: any;
24
- deps: any;
25
- data: any;
26
- getPolicy(state: any): {
27
- when: any;
28
- async: any;
29
- };
30
- /**
31
- * Asynchronously resolve this Resolvable's data
32
- *
33
- * Given a ResolveContext that this Resolvable is found in:
34
- * Wait for this Resolvable's dependencies, then invoke this Resolvable's function
35
- * and update the Resolvable's state
36
- */
37
- resolve(resolveContext: any, trans: any): Promise<any>;
38
- /**
39
- * Gets a promise for this Resolvable's data.
40
- *
41
- * Fetches the data and returns a promise.
42
- * Returns the existing promise if it has already been fetched once.
43
- */
44
- get(resolveContext: any, trans: any): Promise<any>;
45
- toString(): string;
46
- clone(): Resolvable;
47
- }
48
- export namespace Resolvable {
49
- function fromData(token: any, data: any): Resolvable;
50
- }
@@ -1,102 +0,0 @@
1
- export namespace resolvePolicies {
2
- namespace when {
3
- let LAZY: string;
4
- let EAGER: string;
5
- }
6
- namespace async {
7
- let WAIT: string;
8
- let NOWAIT: string;
9
- }
10
- }
11
- /**
12
- * Encapsulates Dependency Injection for a path of nodes
13
- *
14
- * ng-router states are organized as a tree.
15
- * A nested state has a path of ancestors to the root of the tree.
16
- * When a state is being activated, each element in the path is wrapped as a [[PathNode]].
17
- * A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated.
18
- *
19
- * The ResolveContext closes over the [[PathNode]]s, and provides DI for the last node in the path.
20
- */
21
- export class ResolveContext {
22
- constructor(_path: any);
23
- _path: any;
24
- /** Gets all the tokens found in the resolve context, de-duplicated */
25
- getTokens(): any;
26
- /**
27
- * Gets the Resolvable that matches the token
28
- *
29
- * Gets the last Resolvable that matches the token in this context, or undefined.
30
- * Throws an error if it doesn't exist in the ResolveContext
31
- */
32
- getResolvable(token: any): any;
33
- /** Returns the [[ResolvePolicy]] for the given [[Resolvable]] */
34
- getPolicy(resolvable: any): any;
35
- /**
36
- * Returns a ResolveContext that includes a portion of this one
37
- *
38
- * Given a state, this method creates a new ResolveContext from this one.
39
- * The new context starts at the first node (root) and stops at the node for the `state` parameter.
40
- *
41
- * #### Why
42
- *
43
- * When a transition is created, the nodes in the "To Path" are injected from a ResolveContext.
44
- * A ResolveContext closes over a path of [[PathNode]]s and processes the resolvables.
45
- * The "To State" can inject values from its own resolvables, as well as those from all its ancestor state's (node's).
46
- * This method is used to create a narrower context when injecting ancestor nodes.
47
- *
48
- * @example
49
- * `let ABCD = new ResolveContext([A, B, C, D]);`
50
- *
51
- * Given a path `[A, B, C, D]`, where `A`, `B`, `C` and `D` are nodes for states `a`, `b`, `c`, `d`:
52
- * When injecting `D`, `D` should have access to all resolvables from `A`, `B`, `C`, `D`.
53
- * However, `B` should only be able to access resolvables from `A`, `B`.
54
- *
55
- * When resolving for the `B` node, first take the full "To Path" Context `[A,B,C,D]` and limit to the subpath `[A,B]`.
56
- * `let AB = ABCD.subcontext(a)`
57
- */
58
- subContext(state: any): ResolveContext;
59
- /**
60
- * Adds Resolvables to the node that matches the state
61
- *
62
- * This adds a [[Resolvable]] (generally one created on the fly; not declared on a [[StateDeclaration.resolve]] block).
63
- * The resolvable is added to the node matching the `state` parameter.
64
- *
65
- * These new resolvables are not automatically fetched.
66
- * The calling code should either fetch them, fetch something that depends on them,
67
- * or rely on [[resolvePath]] being called when some state is being entered.
68
- *
69
- * Note: each resolvable's [[ResolvePolicy]] is merged with the state's policy, and the global default.
70
- *
71
- * @param {Resolvable[]} newResolvables the new Resolvables
72
- * @param state Used to find the node to put the resolvable on
73
- */
74
- addResolvables(newResolvables: Resolvable[], state: any): void;
75
- /**
76
- * Returns a promise for an array of resolved path Element promises
77
- *
78
- * @param {string} when
79
- * @param trans
80
- * @returns {Promise<any>|any}
81
- */
82
- resolvePath(when: string, trans: any): Promise<any> | any;
83
- injector(): UIInjectorImpl;
84
- _injector: UIInjectorImpl;
85
- findNode(resolvable: any): undefined;
86
- /**
87
- * Gets the async dependencies of a Resolvable
88
- *
89
- * Given a Resolvable, returns its dependencies as a Resolvable[]
90
- * @param {Resolvable} resolvable
91
- * @returns {Resolvable[]}
92
- */
93
- getDependencies(resolvable: Resolvable): Resolvable[];
94
- }
95
- import { Resolvable } from "./resolvable.js";
96
- declare class UIInjectorImpl {
97
- native: any;
98
- get(token: any): any;
99
- getAsync(token: any): Promise<any>;
100
- getNative(token: any): any;
101
- }
102
- export {};
@@ -1,47 +0,0 @@
1
- /** @typedef {import('../interface.ts').ServiceProvider} ServiceProvider } */
2
- /**
3
- * Global router state
4
- *
5
- * This is where we hold the global mutable state such as current state, current
6
- * params, current transition, etc.
7
- */
8
- export class Router {
9
- /**
10
- * Current parameter values
11
- *
12
- * The parameter values from the latest successful transition
13
- * @type {StateParams}
14
- */
15
- params: StateParams;
16
- /**
17
- * @type {number}
18
- */
19
- lastStartedTransitionId: number;
20
- /**
21
- * @type {Queue<import("./transition/transition.js").Transition>}
22
- */
23
- transitionHistory: Queue<import("./transition/transition.js").Transition>;
24
- /**
25
- * @type {Queue<import("./transition/transition.js").Transition>}
26
- */
27
- successfulTransitions: Queue<import("./transition/transition.js").Transition>;
28
- /**
29
- * @type {import("./state/interface.ts").StateDeclaration|undefined}
30
- */
31
- current: import("./state/interface.ts").StateDeclaration | undefined;
32
- /**
33
- * @type {import("./state/state-object.js").StateObject|undefined}
34
- */
35
- $current: import("./state/state-object.js").StateObject | undefined;
36
- /**
37
- * @type {import("./transition/transition.js").Transition|undefined}
38
- */
39
- transition: import("./transition/transition.js").Transition | undefined;
40
- $get: () => this;
41
- }
42
- /**
43
- * }
44
- */
45
- export type ServiceProvider = import("../interface.ts").ServiceProvider;
46
- import { StateParams } from "./params/state-params.js";
47
- import { Queue } from "../shared/queue.js";