@angular-wave/angular.ts 0.0.21 → 0.0.23
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.
- package/Makefile +1 -1
- package/TODO.md +14 -0
- package/dist/angular-ts.esm.js +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/index.html +8 -2
- package/package.json +1 -1
- package/src/animations/animate-css-driver.js +2 -2
- package/src/animations/animate-css.js +15 -6
- package/src/animations/animate-js.js +1 -1
- package/src/animations/animate-queue.js +1 -1
- package/src/animations/shared.js +0 -14
- package/src/core/compile.js +6 -3
- package/src/directive/if.js +0 -79
- package/src/directive/if.md +80 -0
- package/src/directive/include.js +0 -82
- package/src/directive/include.md +86 -0
- package/src/directive/repeat.js +0 -1
- package/src/filters/order-by.js +8 -8
- package/src/loader.js +0 -1
- package/src/router/common/trace.js +1 -1
- package/src/router/directives/stateDirectives.js +16 -14
- package/src/router/directives/viewDirective.js +5 -13
- package/src/router/hooks/resolve.js +3 -4
- package/src/router/hooks/views.js +3 -2
- package/src/router/state/stateService.js +1 -2
- package/src/router/stateProvider.js +8 -0
- package/src/router/templateFactory.js +13 -7
- package/src/router/transition/interface.js +14 -14
- package/src/router/transition/rejectFactory.js +29 -20
- package/src/router/transition/transition.js +5 -1
- package/src/router/transition/transitionHook.js +5 -5
- package/src/router/url/urlMatcher.js +1 -2
- package/src/router/url/urlRule.js +10 -2
- package/src/router/url/urlRules.js +1 -1
- package/src/services/browser.js +3 -18
- package/src/shared/common.js +0 -1
- package/test/module-test.html +44 -12
- package/test/router/ng-state-builder.spec.js +81 -0
- package/test/router/services.spec.js +70 -0
- package/test/router/state-directives.spec.js +1182 -0
- package/test/router/template-factory.spec.js +146 -0
- package/test/router/url-matcher-factory.spec.js +1313 -0
- package/test/router/view-directive.spec.js +2013 -0
- package/test/router/view-hook.spec.js +217 -0
- package/test/router/view-scroll.spec.js +77 -0
- package/test/router/view.spec.js +117 -0
- package/types/angular.d.ts +132 -124
- package/types/index.d.ts +2350 -2187
- package/types/jqlite.d.ts +463 -418
- package/types/router/core/common/common.d.ts +70 -24
- package/types/router/core/common/coreservices.d.ts +30 -32
- package/types/router/core/common/glob.d.ts +9 -9
- package/types/router/core/common/hof.d.ts +12 -4
- package/types/router/core/common/index.d.ts +8 -8
- package/types/router/core/common/predicates.d.ts +1 -1
- package/types/router/core/common/queue.d.ts +13 -13
- package/types/router/core/common/safeConsole.d.ts +3 -3
- package/types/router/core/common/strings.d.ts +4 -2
- package/types/router/core/common/trace.d.ts +94 -82
- package/types/router/core/globals.d.ts +37 -37
- package/types/router/core/hooks/coreResolvables.d.ts +5 -3
- package/types/router/core/hooks/ignoredTransition.d.ts +4 -2
- package/types/router/core/hooks/invalidTransition.d.ts +4 -2
- package/types/router/core/hooks/lazyLoad.d.ts +10 -5
- package/types/router/core/hooks/onEnterExitRetain.d.ts +10 -4
- package/types/router/core/hooks/redirectTo.d.ts +4 -2
- package/types/router/core/hooks/resolve.d.ts +10 -4
- package/types/router/core/hooks/updateGlobals.d.ts +4 -2
- package/types/router/core/hooks/url.d.ts +4 -2
- package/types/router/core/hooks/views.d.ts +7 -3
- package/types/router/core/index.d.ts +11 -12
- package/types/router/core/interface.d.ts +83 -81
- package/types/router/core/params/index.d.ts +5 -5
- package/types/router/core/params/interface.d.ts +439 -439
- package/types/router/core/params/param.d.ts +72 -60
- package/types/router/core/params/paramType.d.ts +40 -40
- package/types/router/core/params/paramTypes.d.ts +169 -165
- package/types/router/core/params/stateParams.d.ts +13 -13
- package/types/router/core/path/index.d.ts +2 -2
- package/types/router/core/path/pathNode.d.ts +49 -49
- package/types/router/core/path/pathUtils.d.ts +100 -74
- package/types/router/core/resolve/index.d.ts +3 -3
- package/types/router/core/resolve/interface.d.ts +137 -137
- package/types/router/core/resolve/resolvable.d.ts +60 -54
- package/types/router/core/resolve/resolveContext.d.ts +84 -79
- package/types/router/core/router.d.ts +95 -86
- package/types/router/core/state/index.d.ts +8 -8
- package/types/router/core/state/interface.d.ts +667 -643
- package/types/router/core/state/stateBuilder.d.ts +41 -38
- package/types/router/core/state/stateMatcher.d.ts +11 -9
- package/types/router/core/state/stateObject.d.ts +154 -139
- package/types/router/core/state/stateQueueManager.d.ts +26 -21
- package/types/router/core/state/stateRegistry.d.ts +124 -121
- package/types/router/core/state/stateService.d.ts +380 -343
- package/types/router/core/state/targetState.d.ts +74 -69
- package/types/router/core/transition/hookBuilder.d.ts +34 -30
- package/types/router/core/transition/hookRegistry.d.ts +96 -74
- package/types/router/core/transition/index.d.ts +8 -8
- package/types/router/core/transition/interface.d.ts +652 -609
- package/types/router/core/transition/rejectFactory.d.ts +97 -97
- package/types/router/core/transition/transition.d.ts +565 -517
- package/types/router/core/transition/transitionEventType.d.ts +20 -11
- package/types/router/core/transition/transitionHook.d.ts +90 -82
- package/types/router/core/transition/transitionService.d.ts +228 -161
- package/types/router/core/url/index.d.ts +8 -8
- package/types/router/core/url/interface.d.ts +100 -87
- package/types/router/core/url/urlConfig.d.ts +130 -126
- package/types/router/core/url/urlMatcher.d.ts +132 -127
- package/types/router/core/url/urlMatcherFactory.d.ts +46 -42
- package/types/router/core/url/urlRouter.d.ts +91 -75
- package/types/router/core/url/urlRule.d.ts +123 -100
- package/types/router/core/url/urlRules.d.ts +240 -232
- package/types/router/core/url/urlService.d.ts +201 -201
- package/types/router/core/view/index.d.ts +2 -2
- package/types/router/core/view/interface.d.ts +26 -26
- package/types/router/core/view/view.d.ts +152 -143
- package/types/router/directives/viewDirective.d.ts +12 -11
- package/types/router/index.d.ts +11 -12
- package/types/router/interface.d.ts +361 -351
- package/types/router/legacy/resolveService.d.ts +44 -40
- package/types/router/legacy/stateEvents.d.ts +1 -1
- package/types/router/locationServices.d.ts +45 -37
- package/types/router/services.d.ts +9 -9
- package/types/router/stateFilters.d.ts +3 -3
- package/types/router/stateProvider.d.ts +240 -235
- package/types/router/statebuilders/onEnterExitRetain.d.ts +4 -2
- package/types/router/statebuilders/views.d.ts +35 -22
- package/types/router/templateFactory.d.ts +99 -79
- package/types/router/viewScroll.d.ts +7 -7
- package/src/directive/a.js +0 -37
- package/types/router/angular.d.ts +0 -1
- package/types/router/core/vanilla.d.ts +0 -1
- package/types/router/directives/stateDirectives.d.ts +0 -3
- package/types/router/injectables.d.ts +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { StateObject } from
|
|
2
|
-
import { RawParams } from
|
|
3
|
-
import { Param } from
|
|
4
|
-
import { Resolvable } from
|
|
5
|
-
import { ViewConfig } from
|
|
1
|
+
import { StateObject } from "../state/stateObject";
|
|
2
|
+
import { RawParams } from "../params/interface";
|
|
3
|
+
import { Param } from "../params/param";
|
|
4
|
+
import { Resolvable } from "../resolve/resolvable";
|
|
5
|
+
import { ViewConfig } from "../view/interface";
|
|
6
6
|
/**
|
|
7
7
|
* A node in a [[TreeChanges]] path
|
|
8
8
|
*
|
|
@@ -11,50 +11,50 @@ import { ViewConfig } from '../view/interface';
|
|
|
11
11
|
* The stateful information includes parameter values and resolve data.
|
|
12
12
|
*/
|
|
13
13
|
export declare class PathNode {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
14
|
+
/** The state being entered, exited, or retained */
|
|
15
|
+
state: StateObject;
|
|
16
|
+
/** The parameters declared on the state */
|
|
17
|
+
paramSchema: Param[];
|
|
18
|
+
/** The parameter values that belong to the state */
|
|
19
|
+
paramValues: {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
};
|
|
22
|
+
/** The individual (stateful) resolvable objects that belong to the state */
|
|
23
|
+
resolvables: Resolvable[];
|
|
24
|
+
/** The state's declared view configuration objects */
|
|
25
|
+
views: ViewConfig[];
|
|
26
|
+
/**
|
|
27
|
+
* Returns a clone of the PathNode
|
|
28
|
+
* @deprecated use instance method `node.clone()`
|
|
29
|
+
*/
|
|
30
|
+
static clone: (node: PathNode) => PathNode;
|
|
31
|
+
/** Creates a copy of a PathNode */
|
|
32
|
+
constructor(node: PathNode);
|
|
33
|
+
/** Creates a new (empty) PathNode for a State */
|
|
34
|
+
constructor(state: StateObject);
|
|
35
|
+
clone(): PathNode;
|
|
36
|
+
/** Sets [[paramValues]] for the node, from the values of an object hash */
|
|
37
|
+
applyRawParams(params: RawParams): PathNode;
|
|
38
|
+
/** Gets a specific [[Param]] metadata that belongs to the node */
|
|
39
|
+
parameter(name: string): Param;
|
|
40
|
+
/**
|
|
41
|
+
* @returns true if the state and parameter values for another PathNode are
|
|
42
|
+
* equal to the state and param values for this PathNode
|
|
43
|
+
*/
|
|
44
|
+
equals(node: PathNode, paramsFn?: GetParamsFn): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Finds Params with different parameter values on another PathNode.
|
|
47
|
+
*
|
|
48
|
+
* Given another node (of the same state), finds the parameter values which differ.
|
|
49
|
+
* Returns the [[Param]] (schema objects) whose parameter values differ.
|
|
50
|
+
*
|
|
51
|
+
* Given another node for a different state, returns `false`
|
|
52
|
+
*
|
|
53
|
+
* @param node The node to compare to
|
|
54
|
+
* @param paramsFn A function that returns which parameters should be compared.
|
|
55
|
+
* @returns The [[Param]]s which differ, or null if the two nodes are for different states
|
|
56
|
+
*/
|
|
57
|
+
diff(node: PathNode, paramsFn?: GetParamsFn): Param[] | false;
|
|
58
58
|
}
|
|
59
59
|
/** @internal */
|
|
60
60
|
export declare type GetParamsFn = (pathNode: PathNode) => Param[];
|
|
@@ -1,79 +1,105 @@
|
|
|
1
|
-
import { Predicate } from
|
|
2
|
-
import { TreeChanges } from
|
|
3
|
-
import { StateObject } from
|
|
4
|
-
import { TargetState } from
|
|
5
|
-
import { GetParamsFn, PathNode } from
|
|
6
|
-
import { ViewService } from
|
|
7
|
-
import { Param } from
|
|
8
|
-
import { StateRegistry } from
|
|
1
|
+
import { Predicate } from "../common/common";
|
|
2
|
+
import { TreeChanges } from "../transition/interface";
|
|
3
|
+
import { StateObject } from "../state/stateObject";
|
|
4
|
+
import { TargetState } from "../state/targetState";
|
|
5
|
+
import { GetParamsFn, PathNode } from "./pathNode";
|
|
6
|
+
import { ViewService } from "../view/view";
|
|
7
|
+
import { Param } from "../params/param";
|
|
8
|
+
import { StateRegistry } from "../state";
|
|
9
9
|
/**
|
|
10
10
|
* This class contains functions which convert TargetStates, Nodes and paths from one type to another.
|
|
11
11
|
*/
|
|
12
12
|
export declare class PathUtils {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
13
|
+
/** Given a PathNode[], create an TargetState */
|
|
14
|
+
static makeTargetState(
|
|
15
|
+
registry: StateRegistry,
|
|
16
|
+
path: PathNode[],
|
|
17
|
+
): TargetState;
|
|
18
|
+
static buildPath(targetState: TargetState): PathNode[];
|
|
19
|
+
/** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */
|
|
20
|
+
static buildToPath(
|
|
21
|
+
fromPath: PathNode[],
|
|
22
|
+
targetState: TargetState,
|
|
23
|
+
): PathNode[];
|
|
24
|
+
/**
|
|
25
|
+
* Creates ViewConfig objects and adds to nodes.
|
|
26
|
+
*
|
|
27
|
+
* On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state
|
|
28
|
+
*/
|
|
29
|
+
static applyViewConfigs(
|
|
30
|
+
$view: ViewService,
|
|
31
|
+
path: PathNode[],
|
|
32
|
+
states: StateObject[],
|
|
33
|
+
): void;
|
|
34
|
+
/**
|
|
35
|
+
* Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath
|
|
36
|
+
*
|
|
37
|
+
* For a parameter in a node to be inherited from the from path:
|
|
38
|
+
* - The toPath's node must have a matching node in the fromPath (by state).
|
|
39
|
+
* - The parameter name must not be found in the toKeys parameter array.
|
|
40
|
+
*
|
|
41
|
+
* Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some
|
|
42
|
+
* caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams,
|
|
43
|
+
* it is not inherited from the fromPath.
|
|
44
|
+
*/
|
|
45
|
+
static inheritParams(
|
|
46
|
+
fromPath: PathNode[],
|
|
47
|
+
toPath: PathNode[],
|
|
48
|
+
toKeys?: string[],
|
|
49
|
+
): PathNode[];
|
|
50
|
+
static nonDynamicParams: (node: PathNode) => Param[];
|
|
51
|
+
/**
|
|
52
|
+
* Computes the tree changes (entering, exiting) between a fromPath and toPath.
|
|
53
|
+
*/
|
|
54
|
+
static treeChanges(
|
|
55
|
+
fromPath: PathNode[],
|
|
56
|
+
toPath: PathNode[],
|
|
57
|
+
reloadState: StateObject,
|
|
58
|
+
): TreeChanges;
|
|
59
|
+
/**
|
|
60
|
+
* Returns a new path which is: the subpath of the first path which matches the second path.
|
|
61
|
+
*
|
|
62
|
+
* The new path starts from root and contains any nodes that match the nodes in the second path.
|
|
63
|
+
* It stops before the first non-matching node.
|
|
64
|
+
*
|
|
65
|
+
* Nodes are compared using their state property and their parameter values.
|
|
66
|
+
* If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes.
|
|
67
|
+
*
|
|
68
|
+
* @param pathA the first path
|
|
69
|
+
* @param pathB the second path
|
|
70
|
+
* @param paramsFn a function which returns the parameters to consider when comparing
|
|
71
|
+
*
|
|
72
|
+
* @returns an array of PathNodes from the first path which match the nodes in the second path
|
|
73
|
+
*/
|
|
74
|
+
static matching(
|
|
75
|
+
pathA: PathNode[],
|
|
76
|
+
pathB: PathNode[],
|
|
77
|
+
paramsFn?: GetParamsFn,
|
|
78
|
+
): PathNode[];
|
|
79
|
+
/**
|
|
80
|
+
* Returns true if two paths are identical.
|
|
81
|
+
*
|
|
82
|
+
* @param pathA
|
|
83
|
+
* @param pathB
|
|
84
|
+
* @param paramsFn a function which returns the parameters to consider when comparing
|
|
85
|
+
* @returns true if the the states and parameter values for both paths are identical
|
|
86
|
+
*/
|
|
87
|
+
static equals(
|
|
88
|
+
pathA: PathNode[],
|
|
89
|
+
pathB: PathNode[],
|
|
90
|
+
paramsFn?: GetParamsFn,
|
|
91
|
+
): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Return a subpath of a path, which stops at the first matching node
|
|
94
|
+
*
|
|
95
|
+
* Given an array of nodes, returns a subset of the array starting from the first node,
|
|
96
|
+
* stopping when the first node matches the predicate.
|
|
97
|
+
*
|
|
98
|
+
* @param path a path of [[PathNode]]s
|
|
99
|
+
* @param predicate a [[Predicate]] fn that matches [[PathNode]]s
|
|
100
|
+
* @returns a subpath up to the matching node, or undefined if no match is found
|
|
101
|
+
*/
|
|
102
|
+
static subPath(path: PathNode[], predicate: Predicate<PathNode>): PathNode[];
|
|
103
|
+
/** Gets the raw parameter values from a path */
|
|
104
|
+
static paramValues: (path: PathNode[]) => any;
|
|
79
105
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./interface";
|
|
2
|
+
export * from "./resolvable";
|
|
3
|
+
export * from "./resolveContext";
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
* An interface which is similar to an Angular 2 `Provider`
|
|
12
12
|
*/
|
|
13
13
|
export interface ProviderLike {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
provide: any;
|
|
15
|
+
useClass?: any;
|
|
16
|
+
useFactory?: Function;
|
|
17
|
+
useValue?: any;
|
|
18
|
+
useExisting?: any;
|
|
19
|
+
deps?: any[];
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* A plain object used to describe a [[Resolvable]]
|
|
@@ -36,44 +36,44 @@ export interface ProviderLike {
|
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
38
|
export interface ResolvableLiteral {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Defines how a resolve is processed during a transition
|
|
@@ -110,101 +110,101 @@ export interface ResolvableLiteral {
|
|
|
110
110
|
* ```
|
|
111
111
|
*/
|
|
112
112
|
export interface ResolvePolicy {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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
195
|
}
|
|
196
|
-
export declare type PolicyWhen =
|
|
197
|
-
export declare type PolicyAsync =
|
|
196
|
+
export declare type PolicyWhen = "LAZY" | "EAGER";
|
|
197
|
+
export declare type PolicyAsync = "WAIT" | "NOWAIT" | CustomAsyncPolicy;
|
|
198
198
|
export interface CustomAsyncPolicy {
|
|
199
|
-
|
|
199
|
+
(data: any): Promise<any>;
|
|
200
200
|
}
|
|
201
201
|
export declare let resolvePolicies: {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
202
|
+
when: {
|
|
203
|
+
LAZY: string;
|
|
204
|
+
EAGER: string;
|
|
205
|
+
};
|
|
206
|
+
async: {
|
|
207
|
+
WAIT: string;
|
|
208
|
+
NOWAIT: string;
|
|
209
|
+
};
|
|
210
210
|
};
|