1 | import { IHookRegistry, TransitionOptions, TransitionHookScope, TransitionHookPhase, TransitionCreateHookFn, HookMatchCriteria, HookRegOptions, PathTypes, PathType, RegisteredHooks, TransitionHookFn, TransitionStateHookFn } from './interface';
|
2 | import { Transition } from './transition';
|
3 | import { RegisteredHook } from './hookRegistry';
|
4 | import { TargetState } from '../state/targetState';
|
5 | import { PathNode } from '../path/pathNode';
|
6 | import { ViewService } from '../view/view';
|
7 | import { UIRouter } from '../router';
|
8 | import { TransitionEventType } from './transitionEventType';
|
9 | import { GetResultHandler, GetErrorHandler } from './transitionHook';
|
10 | import { Disposable } from '../interface';
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | export declare let defaultTransOpts: TransitionOptions;
|
19 |
|
20 |
|
21 |
|
22 | export interface TransitionServicePluginAPI {
|
23 | |
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | _definePathType(name: string, hookScope: TransitionHookScope): any;
|
35 | |
36 |
|
37 |
|
38 | _getPathTypes(): PathTypes;
|
39 | |
40 |
|
41 |
|
42 |
|
43 | _defineEvent(name: string, hookPhase: TransitionHookPhase, hookOrder: number, criteriaMatchPath: PathType, reverseSort?: boolean, getResultHandler?: GetResultHandler, getErrorHandler?: GetErrorHandler, rejectIfSuperseded?: boolean): any;
|
44 | |
45 |
|
46 |
|
47 |
|
48 | _getEvents(phase?: TransitionHookPhase): TransitionEventType[];
|
49 |
|
50 | getHooks(hookName: string): RegisteredHook[];
|
51 | }
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 | export declare class TransitionService implements IHookRegistry, Disposable {
|
64 |
|
65 | _transitionCount: number;
|
66 |
|
67 | $view: ViewService;
|
68 |
|
69 | private _eventTypes;
|
70 |
|
71 | _registeredHooks: RegisteredHooks;
|
72 |
|
73 | private _criteriaPaths;
|
74 | private _router;
|
75 |
|
76 | _pluginapi: TransitionServicePluginAPI;
|
77 | |
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 | _deregisterHookFns: {
|
84 | addCoreResolves: Function;
|
85 | ignored: Function;
|
86 | invalid: Function;
|
87 | redirectTo: Function;
|
88 | onExit: Function;
|
89 | onRetain: Function;
|
90 | onEnter: Function;
|
91 | eagerResolve: Function;
|
92 | lazyResolve: Function;
|
93 | resolveAll: Function;
|
94 | loadViews: Function;
|
95 | activateViews: Function;
|
96 | updateGlobals: Function;
|
97 | updateUrl: Function;
|
98 | lazyLoad: Function;
|
99 | };
|
100 |
|
101 | constructor(_router: UIRouter);
|
102 | /**
|
103 | * Registers a [[TransitionHookFn]], called *while a transition is being constructed*.
|
104 | *
|
105 | * Registers a transition lifecycle hook, which is invoked during transition construction.
|
106 | *
|
107 | * This low level hook should only be used by plugins.
|
108 | * This can be a useful time for plugins to add resolves or mutate the transition as needed.
|
109 | * The Sticky States plugin uses this hook to modify the treechanges.
|
110 | *
|
111 | * ### Lifecycle
|
112 | *
|
113 | * `onCreate` hooks are invoked *while a transition is being constructed*.
|
114 | *
|
115 | * ### Return value
|
116 | *
|
117 | * The hook's return value is ignored
|
118 | *
|
119 | * @internal
|
120 | * @param criteria defines which Transitions the Hook should be invoked for.
|
121 | * @param callback the hook function which will be invoked.
|
122 | * @param options the registration options
|
123 | * @returns a function which deregisters the hook.
|
124 | */
|
125 | onCreate(criteria: HookMatchCriteria, callback: TransitionCreateHookFn, options?: HookRegOptions): Function;
|
126 | /** @inheritdoc */
|
127 | onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;
|
128 | /** @inheritdoc */
|
129 | onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;
|
130 | /** @inheritdoc */
|
131 | onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;
|
132 | /** @inheritdoc */
|
133 | onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;
|
134 | /** @inheritdoc */
|
135 | onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;
|
136 | /** @inheritdoc */
|
137 | onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;
|
138 | /** @inheritdoc */
|
139 | onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;
|
140 | /** @inheritdoc */
|
141 | onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;
|
142 | /**
|
143 | * dispose
|
144 | * @internal
|
145 | */
|
146 | dispose(router: UIRouter): void;
|
147 | /**
|
148 | * Creates a new [[Transition]] object
|
149 | *
|
150 | * This is a factory function for creating new Transition objects.
|
151 | * It is used internally by the [[StateService]] and should generally not be called by application code.
|
152 | *
|
153 | * @internal
|
154 | * @param fromPath the path to the current state (the from state)
|
155 | * @param targetState the target state (destination)
|
156 | * @returns a Transition
|
157 | */
|
158 | create(fromPath: PathNode[], targetState: TargetState): Transition;
|
159 | /** @internal */
|
160 | private _defineCoreEvents;
|
161 | /** @internal */
|
162 | private _defineCorePaths;
|
163 | /** @internal */
|
164 | _defineEvent(name: string, hookPhase: TransitionHookPhase, hookOrder: number, criteriaMatchPath: PathType, reverseSort?: boolean, getResultHandler?: GetResultHandler, getErrorHandler?: GetErrorHandler, synchronous?: boolean): void;
|
165 | /** @internal */
|
166 | private _getEvents;
|
167 | /**
|
168 | * Adds a Path to be used as a criterion against a TreeChanges path
|
169 | *
|
170 | * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.
|
171 | * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`
|
172 | * Each state in the exiting path is checked against the criteria and returned as part of the match.
|
173 | *
|
174 | * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.
|
175 | * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`
|
176 | * Only the tail of the `to` path is checked against the criteria and returned as part of the match.
|
177 | *
|
178 | * @internal
|
179 | */
|
180 | private _definePathType;
|
181 | /** @internal */
|
182 | private _getPathTypes;
|
183 | /** @internal */
|
184 | getHooks(hookName: string): RegisteredHook[];
|
185 | /** @internal */
|
186 | private _registerCoreTransitionHooks;
|
187 | }
|