@angular-wave/angular.ts 0.0.60 → 0.0.62

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 (128) hide show
  1. package/README.md +1 -1
  2. package/dist/angular-ts.esm.js +2 -2
  3. package/dist/angular-ts.umd.js +2 -2
  4. package/package.json +2 -1
  5. package/src/angular.spec.js +2 -2
  6. package/src/core/parser/parse.js +14 -0
  7. package/src/core/parser/parse.spec.js +7 -5
  8. package/src/core/parser/parser.js +1 -1
  9. package/src/core/q/q.js +46 -289
  10. package/src/core/q/q.md +229 -0
  11. package/src/core/sanitize/sanitize-uri.js +2 -3
  12. package/src/core/scope/scope.js +18 -8
  13. package/src/directive/if/if.js +6 -1
  14. package/src/filters/limit-to.js +5 -2
  15. package/src/filters/order-by.js +1 -2
  16. package/src/index.js +1 -1
  17. package/src/loader.js +1 -55
  18. package/src/router/params/param-type.js +2 -1
  19. package/src/router/state/views.js +3 -0
  20. package/src/router/state-provider.js +1 -1
  21. package/src/router/transition/reject-factory.js +1 -0
  22. package/src/router/url/url-rule.js +1 -1
  23. package/src/router/url/url-service.js +4 -4
  24. package/src/router/url/url-service.spec.js +4 -3
  25. package/src/services/http/http.js +7 -5
  26. package/src/services/template-request.js +2 -7
  27. package/src/shared/common.js +1 -1
  28. package/src/shared/utils.js +2 -11
  29. package/src/types.js +9 -1
  30. package/types/core/parser/parse.d.ts +3 -4
  31. package/types/core/parser/parser.d.ts +1 -1
  32. package/types/core/q/q.d.ts +2 -2
  33. package/types/core/sanitize/sanitize-uri.d.ts +4 -5
  34. package/types/core/scope/scope.d.ts +19 -7
  35. package/types/index.d.ts +5 -1
  36. package/types/loader.d.ts +0 -52
  37. package/types/router/params/param-type.d.ts +2 -1
  38. package/types/router/state/views.d.ts +2 -0
  39. package/types/router/state-provider.d.ts +1 -1
  40. package/types/router/transition/reject-factory.d.ts +1 -0
  41. package/types/router/url/url-rule.d.ts +0 -1
  42. package/types/router/url/url-service.d.ts +7 -7
  43. package/types/services/template-request.d.ts +4 -9
  44. package/types/shared/utils.d.ts +1 -7
  45. package/types/types.d.ts +6 -1
  46. package/types-back/README.md +0 -2
  47. package/types-back/angular.d.ts +0 -146
  48. package/types-back/index.d.ts +0 -2126
  49. package/types-back/jqlite.d.ts +0 -374
  50. package/types-back/router/core/common/common.d.ts +0 -416
  51. package/types-back/router/core/common/coreservices.d.ts +0 -77
  52. package/types-back/router/core/common/glob.d.ts +0 -60
  53. package/types-back/router/core/common/hof.d.ts +0 -168
  54. package/types-back/router/core/common/index.d.ts +0 -8
  55. package/types-back/router/core/common/predicates.d.ts +0 -25
  56. package/types-back/router/core/common/queue.d.ts +0 -15
  57. package/types-back/router/core/common/safeConsole.d.ts +0 -5
  58. package/types-back/router/core/common/strings.d.ts +0 -66
  59. package/types-back/router/core/common/trace.d.ts +0 -126
  60. package/types-back/router/core/globals.d.ts +0 -43
  61. package/types-back/router/core/hooks/coreResolvables.d.ts +0 -6
  62. package/types-back/router/core/hooks/ignoredTransition.d.ts +0 -4
  63. package/types-back/router/core/hooks/invalidTransition.d.ts +0 -4
  64. package/types-back/router/core/hooks/lazyLoad.d.ts +0 -17
  65. package/types-back/router/core/hooks/onEnterExitRetain.d.ts +0 -10
  66. package/types-back/router/core/hooks/redirectTo.d.ts +0 -4
  67. package/types-back/router/core/hooks/resolve.d.ts +0 -11
  68. package/types-back/router/core/hooks/updateGlobals.d.ts +0 -4
  69. package/types-back/router/core/hooks/url.d.ts +0 -4
  70. package/types-back/router/core/hooks/views.d.ts +0 -7
  71. package/types-back/router/core/index.d.ts +0 -11
  72. package/types-back/router/core/interface.d.ts +0 -91
  73. package/types-back/router/core/params/index.d.ts +0 -12
  74. package/types-back/router/core/params/interface.d.ts +0 -606
  75. package/types-back/router/core/params/param.d.ts +0 -77
  76. package/types-back/router/core/params/paramType.d.ts +0 -65
  77. package/types-back/router/core/params/paramTypes.d.ts +0 -193
  78. package/types-back/router/core/params/stateParams.d.ts +0 -15
  79. package/types-back/router/core/path/index.d.ts +0 -2
  80. package/types-back/router/core/path/pathNode.d.ts +0 -60
  81. package/types-back/router/core/path/pathUtils.d.ts +0 -105
  82. package/types-back/router/core/resolve/index.d.ts +0 -3
  83. package/types-back/router/core/resolve/interface.d.ts +0 -210
  84. package/types-back/router/core/resolve/resolvable.d.ts +0 -75
  85. package/types-back/router/core/resolve/resolveContext.d.ts +0 -97
  86. package/types-back/router/core/router.d.ts +0 -57
  87. package/types-back/router/core/state/index.d.ts +0 -28
  88. package/types-back/router/core/state/interface.d.ts +0 -732
  89. package/types-back/router/core/state/stateBuilder.d.ts +0 -107
  90. package/types-back/router/core/state/stateMatcher.d.ts +0 -13
  91. package/types-back/router/core/state/stateObject.d.ts +0 -170
  92. package/types-back/router/core/state/stateQueueManager.d.ts +0 -27
  93. package/types-back/router/core/state/stateRegistry.d.ts +0 -138
  94. package/types-back/router/core/state/stateService.d.ts +0 -386
  95. package/types-back/router/core/state/targetState.d.ts +0 -105
  96. package/types-back/router/core/transition/hookBuilder.d.ts +0 -49
  97. package/types-back/router/core/transition/hookRegistry.d.ts +0 -115
  98. package/types-back/router/core/transition/index.d.ts +0 -20
  99. package/types-back/router/core/transition/interface.d.ts +0 -862
  100. package/types-back/router/core/transition/rejectFactory.d.ts +0 -103
  101. package/types-back/router/core/transition/transition.d.ts +0 -575
  102. package/types-back/router/core/transition/transitionEventType.d.ts +0 -26
  103. package/types-back/router/core/transition/transitionHook.d.ts +0 -96
  104. package/types-back/router/core/transition/transitionService.d.ts +0 -253
  105. package/types-back/router/core/url/index.d.ts +0 -8
  106. package/types-back/router/core/url/interface.d.ts +0 -169
  107. package/types-back/router/core/url/urlConfig.d.ts +0 -144
  108. package/types-back/router/core/url/urlMatcher.d.ts +0 -185
  109. package/types-back/router/core/url/urlMatcherFactory.d.ts +0 -56
  110. package/types-back/router/core/url/urlRouter.d.ts +0 -101
  111. package/types-back/router/core/url/urlRule.d.ts +0 -143
  112. package/types-back/router/core/url/urlRules.d.ts +0 -251
  113. package/types-back/router/core/url/urlService.d.ts +0 -205
  114. package/types-back/router/core/view/index.d.ts +0 -2
  115. package/types-back/router/core/view/interface.d.ts +0 -46
  116. package/types-back/router/core/view/view.d.ts +0 -176
  117. package/types-back/router/directives/viewDirective.d.ts +0 -144
  118. package/types-back/router/index.d.ts +0 -17
  119. package/types-back/router/interface.d.ts +0 -500
  120. package/types-back/router/legacy/resolveService.d.ts +0 -47
  121. package/types-back/router/legacy/stateEvents.d.ts +0 -124
  122. package/types-back/router/services.d.ts +0 -15
  123. package/types-back/router/stateFilters.d.ts +0 -10
  124. package/types-back/router/stateProvider.d.ts +0 -258
  125. package/types-back/router/statebuilders/onEnterExitRetain.d.ts +0 -13
  126. package/types-back/router/statebuilders/views.d.ts +0 -53
  127. package/types-back/router/templateFactory.d.ts +0 -104
  128. package/types-back/router/viewScroll.d.ts +0 -9
@@ -1,386 +0,0 @@
1
- import { HookResult, TransitionOptions } from "../transition/interface";
2
- import { Transition } from "../transition/transition";
3
- import {
4
- HrefOptions,
5
- LazyLoadResult,
6
- StateDeclaration,
7
- StateOrName,
8
- TransitionPromise,
9
- } from "./interface";
10
- import { StateObject } from "./stateObject";
11
- import { TargetState } from "./targetState";
12
- import { RawParams } from "../params/interface";
13
- import { Router } from "../router";
14
- import { NGInjector } from "../interface";
15
- import { StateParams } from "../params/stateParams";
16
- export declare type OnInvalidCallback = (
17
- toState?: TargetState,
18
- fromState?: TargetState,
19
- injector?: NGInjector,
20
- ) => HookResult;
21
- /**
22
- * Provides services related to ui-router states.
23
- *
24
- * This API is located at `router.stateService` ([[Router.stateService]])
25
- */
26
- export declare class StateService {
27
- private router;
28
- /** @internal */
29
- invalidCallbacks: OnInvalidCallback[];
30
- /**
31
- * The [[Transition]] currently in progress (or null)
32
- *
33
- * @deprecated This is a passthrough through to [[RouterGlobals.transition]]
34
- */
35
- transition: Transition;
36
- /**
37
- * The latest successful state parameters
38
- *
39
- * @deprecated This is a passthrough through to [[RouterGlobals.params]]
40
- */
41
- params: StateParams;
42
- /**
43
- * The current [[StateDeclaration]]
44
- *
45
- * @deprecated This is a passthrough through to [[RouterGlobals.current]]
46
- */
47
- current: StateDeclaration;
48
- /**
49
- * The current [[StateObject]] (an internal API)
50
- *
51
- * @deprecated This is a passthrough through to [[RouterGlobals.$current]]
52
- */
53
- $current: StateObject;
54
- /** @internal */
55
- constructor(/** @internal */ router: Router);
56
-
57
- /**
58
- * Handler for when [[transitionTo]] is called with an invalid state.
59
- *
60
- * Invokes the [[onInvalid]] callbacks, in natural order.
61
- * Each callback's return value is checked in sequence until one of them returns an instance of TargetState.
62
- * The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises.
63
- *
64
- * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned.
65
- *
66
- * @internal
67
- */
68
- private _handleInvalidTargetState;
69
- /**
70
- * Registers an Invalid State handler
71
- *
72
- * Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]]
73
- * has been called with an invalid state reference parameter
74
- *
75
- * Example:
76
- * ```js
77
- * stateService.onInvalid(function(to, from, injector) {
78
- * if (to.name() === 'foo') {
79
- * let lazyLoader = injector.get('LazyLoadService');
80
- * return lazyLoader.load('foo')
81
- * .then(() => stateService.target('foo'));
82
- * }
83
- * });
84
- * ```
85
- *
86
- * @param {function} callback invoked when the toState is invalid
87
- * This function receives the (invalid) toState, the fromState, and an injector.
88
- * The function may optionally return a [[TargetState]] or a Promise for a TargetState.
89
- * If one is returned, it is treated as a redirect.
90
- *
91
- * @returns a function which deregisters the callback
92
- */
93
- onInvalid(callback: OnInvalidCallback): Function;
94
- /**
95
- * Reloads the current state
96
- *
97
- * A method that force reloads the current state, or a partial state hierarchy.
98
- * All resolves are re-resolved, and components reinstantiated.
99
- *
100
- * #### Example:
101
- * ```js
102
- * let app angular.module('app', ['ng.router']);
103
- *
104
- * app.controller('ctrl', function ($scope, $state) {
105
- * $scope.reload = function(){
106
- * $state.reload();
107
- * }
108
- * });
109
- * ```
110
- *
111
- * Note: `reload()` is just an alias for:
112
- *
113
- * ```js
114
- * $state.transitionTo($state.current, $state.params, {
115
- * reload: true, inherit: false
116
- * });
117
- * ```
118
- *
119
- * @param reloadState A state name or a state object.
120
- * If present, this state and all its children will be reloaded, but ancestors will not reload.
121
- *
122
- * #### Example:
123
- * ```js
124
- * //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item'
125
- * //and current state is 'contacts.detail.item'
126
- * let app angular.module('app', ['ng.router']);
127
- *
128
- * app.controller('ctrl', function ($scope, $state) {
129
- * $scope.reload = function(){
130
- * //will reload 'contact.detail' and nested 'contact.detail.item' states
131
- * $state.reload('contact.detail');
132
- * }
133
- * });
134
- * ```
135
- *
136
- * @returns A promise representing the state of the new transition. See [[StateService.go]]
137
- */
138
- reload(reloadState?: StateOrName): Promise<StateObject>;
139
- /**
140
- * Transition to a different state and/or parameters
141
- *
142
- * Convenience method for transitioning to a new state.
143
- *
144
- * `$state.go` calls `$state.transitionTo` internally but automatically sets options to
145
- * `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`.
146
- * This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`).
147
- * It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters
148
- * inherit from the current parameter values (because of `inherit: true`).
149
- *
150
- * #### Example:
151
- * ```js
152
- * let app = angular.module('app', ['ng.router']);
153
- *
154
- * app.controller('ctrl', function ($scope, $state) {
155
- * $scope.changeState = function () {
156
- * $state.go('contact.detail');
157
- * };
158
- * });
159
- * ```
160
- *
161
- * @param to Absolute state name, state object, or relative state path (relative to current state).
162
- *
163
- * Some examples:
164
- *
165
- * - `$state.go('contact.detail')` - will go to the `contact.detail` state
166
- * - `$state.go('^')` - will go to the parent state
167
- * - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state
168
- * - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state
169
- *
170
- * @param params A map of the parameters that will be sent to the state, will populate $stateParams.
171
- *
172
- * Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`).
173
- * This allows, for example, going to a sibling state that shares parameters defined by a parent state.
174
- *
175
- * @param options Transition options
176
- *
177
- * @returns {promise} A promise representing the state of the new transition.
178
- */
179
- go(
180
- to: StateOrName,
181
- params?: RawParams,
182
- options?: TransitionOptions,
183
- ): TransitionPromise;
184
- /**
185
- * Creates a [[TargetState]]
186
- *
187
- * This is a factory method for creating a TargetState
188
- *
189
- * This may be returned from a Transition Hook to redirect a transition, for example.
190
- */
191
- target(
192
- identifier: StateOrName,
193
- params?: RawParams,
194
- options?: TransitionOptions,
195
- ): TargetState;
196
- /** @internal */
197
- private getCurrentPath;
198
- /**
199
- * Low-level method for transitioning to a new state.
200
- *
201
- * The [[go]] method (which uses `transitionTo` internally) is recommended in most situations.
202
- *
203
- * #### Example:
204
- * ```js
205
- * let app = angular.module('app', ['ng.router']);
206
- *
207
- * app.controller('ctrl', function ($scope, $state) {
208
- * $scope.changeState = function () {
209
- * $state.transitionTo('contact.detail');
210
- * };
211
- * });
212
- * ```
213
- *
214
- * @param to State name or state object.
215
- * @param toParams A map of the parameters that will be sent to the state,
216
- * will populate $stateParams.
217
- * @param options Transition options
218
- *
219
- * @returns A promise representing the state of the new transition. See [[go]]
220
- */
221
- transitionTo(
222
- to: StateOrName,
223
- toParams?: RawParams,
224
- options?: TransitionOptions,
225
- ): TransitionPromise;
226
- /**
227
- * Checks if the current state *is* the provided state
228
- *
229
- * Similar to [[includes]] but only checks for the full state name.
230
- * If params is supplied then it will be tested for strict equality against the current
231
- * active params object, so all params must match with none missing and no extras.
232
- *
233
- * #### Example:
234
- * ```js
235
- * $state.$current.name = 'contacts.details.item';
236
- *
237
- * // absolute name
238
- * $state.is('contact.details.item'); // returns true
239
- * $state.is(contactDetailItemStateObject); // returns true
240
- * ```
241
- *
242
- * // relative name (. and ^), typically from a template
243
- * // E.g. from the 'contacts.details' template
244
- * ```html
245
- * <div ng-class="{highlighted: $state.is('.item')}">Item</div>
246
- * ```
247
- *
248
- * @param stateOrName The state name (absolute or relative) or state object you'd like to check.
249
- * @param params A param object, e.g. `{sectionId: section.id}`, that you'd like
250
- * to test against the current active state.
251
- * @param options An options object. The options are:
252
- * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will
253
- * test relative to `options.relative` state (or name).
254
- *
255
- * @returns Returns true if it is the state.
256
- */
257
- is(
258
- stateOrName: StateOrName,
259
- params?: RawParams,
260
- options?: {
261
- relative?: StateOrName;
262
- },
263
- ): boolean;
264
- /**
265
- * Checks if the current state *includes* the provided state
266
- *
267
- * A method to determine if the current active state is equal to or is the child of the
268
- * state stateName. If any params are passed then they will be tested for a match as well.
269
- * Not all the parameters need to be passed, just the ones you'd like to test for equality.
270
- *
271
- * #### Example when `$state.$current.name === 'contacts.details.item'`
272
- * ```js
273
- * // Using partial names
274
- * $state.includes("contacts"); // returns true
275
- * $state.includes("contacts.details"); // returns true
276
- * $state.includes("contacts.details.item"); // returns true
277
- * $state.includes("contacts.list"); // returns false
278
- * $state.includes("about"); // returns false
279
- * ```
280
- *
281
- * #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`:
282
- * ```js
283
- * $state.includes("*.details.*.*"); // returns true
284
- * $state.includes("*.details.**"); // returns true
285
- * $state.includes("**.item.**"); // returns true
286
- * $state.includes("*.details.item.url"); // returns true
287
- * $state.includes("*.details.*.url"); // returns true
288
- * $state.includes("*.details.*"); // returns false
289
- * $state.includes("item.**"); // returns false
290
- * ```
291
- *
292
- * @param stateOrName A partial name, relative name, glob pattern,
293
- * or state object to be searched for within the current state name.
294
- * @param params A param object, e.g. `{sectionId: section.id}`,
295
- * that you'd like to test against the current active state.
296
- * @param options An options object. The options are:
297
- * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will
298
- * test relative to `options.relative` state (or name).
299
- *
300
- * @returns {boolean} Returns true if it does include the state
301
- */
302
- includes(
303
- stateOrName: StateOrName,
304
- params?: RawParams,
305
- options?: TransitionOptions,
306
- ): boolean;
307
- /**
308
- * Generates a URL for a state and parameters
309
- *
310
- * Returns the url for the given state populated with the given params.
311
- *
312
- * #### Example:
313
- * ```js
314
- * expect($state.href("about.person", { person: "bob" })).toEqual("/about/bob");
315
- * ```
316
- *
317
- * @param stateOrName The state name or state object you'd like to generate a url from.
318
- * @param params An object of parameter values to fill the state's required parameters.
319
- * @param options Options object. The options are:
320
- *
321
- * @returns {string} compiled state url
322
- */
323
- href(
324
- stateOrName: StateOrName,
325
- params?: RawParams,
326
- options?: HrefOptions,
327
- ): string;
328
- /** @internal */
329
- private _defaultErrorHandler;
330
- /**
331
- * Sets or gets the default [[transitionTo]] error handler.
332
- *
333
- * The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition.
334
- * This includes errors caused by resolves and transition hooks.
335
- *
336
- * Note:
337
- * This handler does not receive certain Transition rejections.
338
- * Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]].
339
- *
340
- * The built-in default error handler logs the error to the console.
341
- *
342
- * You can provide your own custom handler.
343
- *
344
- * #### Example:
345
- * ```js
346
- * stateService.defaultErrorHandler(function() {
347
- * // Do not log transitionTo errors
348
- * });
349
- * ```
350
- *
351
- * @param handler a global error handler function
352
- * @returns the current global error handler
353
- */
354
- defaultErrorHandler(handler?: (error: any) => void): (error: any) => void;
355
- /**
356
- * Gets a registered [[StateDeclaration]] object
357
- *
358
- * Returns the state declaration object for any specific state, or for all registered states.
359
- *
360
- * @param stateOrName (absolute or relative) If provided, will only get the declaration object for the requested state.
361
- * If not provided, returns an array of ALL states.
362
- * @param base When `stateOrName` is a relative state reference (such as `.bar.baz`), the state will be retrieved relative to this state.
363
- *
364
- * @returns a [[StateDeclaration]] object (or array of all registered [[StateDeclaration]] objects.)
365
- * @deprecated use [[StateRegistry.get]]
366
- */
367
- get(stateOrName: StateOrName, base: StateOrName): StateDeclaration;
368
- get(stateOrName: StateOrName): StateDeclaration;
369
- get(): StateDeclaration[];
370
- /**
371
- * Lazy loads a state
372
- *
373
- * Explicitly runs a state's [[StateDeclaration.lazyLoad]] function.
374
- *
375
- * @param stateOrName the state that should be lazy loaded
376
- * @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc)
377
- * Note: If no transition is provided, a noop transition is created using the from the current state to the current state.
378
- * This noop transition is not actually run.
379
- *
380
- * @returns a promise to lazy load
381
- */
382
- lazyLoad(
383
- stateOrName: StateOrName,
384
- transition?: Transition,
385
- ): Promise<LazyLoadResult>;
386
- }
@@ -1,105 +0,0 @@
1
- import { StateDeclaration, StateOrName, TargetStateDef } from "./interface";
2
- import { TransitionOptions } from "../transition/interface";
3
- import { StateObject } from "./stateObject";
4
- import { StateRegistry } from "./stateRegistry";
5
- import { RawParams } from "../params";
6
- /**
7
- * Encapsulate the target (destination) state/params/options of a [[Transition]].
8
- *
9
- * This class is frequently used to redirect a transition to a new destination.
10
- *
11
- * See:
12
- *
13
- * - [[HookResult]]
14
- * - [[TransitionHookFn]]
15
- * - [[TransitionService.onStart]]
16
- *
17
- * To create a `TargetState`, use [[StateService.target]].
18
- *
19
- * ---
20
- *
21
- * This class wraps:
22
- *
23
- * 1) an identifier for a state
24
- * 2) a set of parameters
25
- * 3) and transition options
26
- * 4) the registered state object (the [[StateDeclaration]])
27
- *
28
- * Many Router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can
29
- * either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string).
30
- * The `TargetState` class normalizes those options.
31
- *
32
- * A `TargetState` may be valid (the state being targeted exists in the registry)
33
- * or invalid (the state being targeted is not registered).
34
- */
35
- export declare class TargetState {
36
- private _stateRegistry;
37
- private _identifier;
38
- private _definition;
39
- private _params;
40
- private _options;
41
- /** Returns true if the object has a state property that might be a state or state name */
42
- static isDef: (obj: any) => obj is TargetStateDef;
43
- /**
44
- * The TargetState constructor
45
- *
46
- * Note: Do not construct a `TargetState` manually.
47
- * To create a `TargetState`, use the [[StateService.target]] factory method.
48
- *
49
- * @param _stateRegistry The StateRegistry to use to look up the _definition
50
- * @param _identifier An identifier for a state.
51
- * Either a fully-qualified state name, or the object used to define the state.
52
- * @param _params Parameters for the target state
53
- * @param _options Transition options.
54
- *
55
- * @internal
56
- */
57
- constructor(
58
- _stateRegistry: StateRegistry,
59
- _identifier: StateOrName,
60
- _params?: RawParams,
61
- _options?: TransitionOptions,
62
- );
63
- /** The name of the state this object targets */
64
- name(): string;
65
- /** The identifier used when creating this TargetState */
66
- identifier(): StateOrName;
67
- /** The target parameter values */
68
- params(): RawParams;
69
- /** The internal state object (if it was found) */
70
- $state(): StateObject;
71
- /** The internal state declaration (if it was found) */
72
- state(): StateDeclaration;
73
- /** The target options */
74
- options(): TransitionOptions;
75
- /** True if the target state was found */
76
- exists(): boolean;
77
- /** True if the object is valid */
78
- valid(): boolean;
79
- /** If the object is invalid, returns the reason why */
80
- error(): string;
81
- toString(): string;
82
- /**
83
- * Returns a copy of this TargetState which targets a different state.
84
- * The new TargetState has the same parameter values and transition options.
85
- *
86
- * @param state The new state that should be targeted
87
- */
88
- withState(state: StateOrName): TargetState;
89
- /**
90
- * Returns a copy of this TargetState, using the specified parameter values.
91
- *
92
- * @param params the new parameter values to use
93
- * @param replace When false (default) the new parameter values will be merged with the current values.
94
- * When true the parameter values will be used instead of the current values.
95
- */
96
- withParams(params: RawParams, replace?: boolean): TargetState;
97
- /**
98
- * Returns a copy of this TargetState, using the specified Transition Options.
99
- *
100
- * @param options the new options to use
101
- * @param replace When false (default) the new options will be merged with the current options.
102
- * When true the options will be used instead of the current options.
103
- */
104
- withOptions(options: TransitionOptions, replace?: boolean): TargetState;
105
- }
@@ -1,49 +0,0 @@
1
- import { TreeChanges, TransitionHookPhase } from "./interface";
2
- import { Transition } from "./transition";
3
- import { TransitionHook } from "./transitionHook";
4
- import { TransitionEventType } from "./transitionEventType";
5
- import { RegisteredHook } from "./hookRegistry";
6
- /**
7
- * This class returns applicable TransitionHooks for a specific Transition instance.
8
- *
9
- * Hooks ([[RegisteredHook]]) may be registered globally, e.g., $transitions.onEnter(...), or locally, e.g.
10
- * myTransition.onEnter(...). The HookBuilder finds matching RegisteredHooks (where the match criteria is
11
- * determined by the type of hook)
12
- *
13
- * The HookBuilder also converts RegisteredHooks objects to TransitionHook objects, which are used to run a Transition.
14
- *
15
- * The HookBuilder constructor is given the $transitions service and a Transition instance. Thus, a HookBuilder
16
- * instance may only be used for one specific Transition object. (side note: the _treeChanges accessor is private
17
- * in the Transition class, so we must also provide the Transition's _treeChanges)
18
- */
19
- export declare class HookBuilder {
20
- private transition;
21
- constructor(transition: Transition);
22
- buildHooksForPhase(phase: TransitionHookPhase): TransitionHook[];
23
- /**
24
- * Returns an array of newly built TransitionHook objects.
25
- *
26
- * - Finds all RegisteredHooks registered for the given `hookType` which matched the transition's [[TreeChanges]].
27
- * - Finds [[PathNode]] (or `PathNode[]`) to use as the TransitionHook context(s)
28
- * - For each of the [[PathNode]]s, creates a TransitionHook
29
- *
30
- * @param hookType the type of the hook registration function, e.g., 'onEnter', 'onFinish'.
31
- */
32
- buildHooks(hookType: TransitionEventType): TransitionHook[];
33
- /**
34
- * Finds all RegisteredHooks from:
35
- * - The Transition object instance hook registry
36
- * - The TransitionService ($transitions) global hook registry
37
- *
38
- * which matched:
39
- * - the eventType
40
- * - the matchCriteria (to, from, exiting, retained, entering)
41
- *
42
- * @returns an array of matched [[RegisteredHook]]s
43
- */
44
- getMatchingHooks(
45
- hookType: TransitionEventType,
46
- treeChanges: TreeChanges,
47
- transition: Transition,
48
- ): RegisteredHook[];
49
- }
@@ -1,115 +0,0 @@
1
- import { IHookRegistry } from "./interface";
2
- import {
3
- HookRegOptions,
4
- HookMatchCriteria,
5
- TreeChanges,
6
- HookMatchCriterion,
7
- IMatchingNodes,
8
- HookFn,
9
- } from "./interface";
10
- import { Transition } from "./transition";
11
- import { StateObject } from "../state/stateObject";
12
- import { TransitionEventType } from "./transitionEventType";
13
- import { TransitionService } from "./transitionService";
14
- /**
15
- * Determines if the given state matches the matchCriteria
16
- *
17
- * @internal
18
- *
19
- * @param state a State Object to test against
20
- * @param criterion
21
- * - If a string, matchState uses the string as a glob-matcher against the state name
22
- * - If an array (of strings), matchState uses each string in the array as a glob-matchers against the state name
23
- * and returns a positive match if any of the globs match.
24
- * - If a function, matchState calls the function with the state and returns true if the function's result is truthy.
25
- * @returns {boolean}
26
- */
27
- export declare function matchState(
28
- state: StateObject,
29
- criterion: HookMatchCriterion,
30
- transition: Transition,
31
- ): boolean;
32
- /**
33
- * The registration data for a registered transition hook
34
- */
35
- export declare class RegisteredHook {
36
- tranSvc: TransitionService;
37
- eventType: TransitionEventType;
38
- callback: HookFn;
39
- matchCriteria: HookMatchCriteria;
40
- removeHookFromRegistry: (hook: RegisteredHook) => void;
41
- priority: number;
42
- bind: any;
43
- invokeCount: number;
44
- invokeLimit: number;
45
- _deregistered: boolean;
46
- constructor(
47
- tranSvc: TransitionService,
48
- eventType: TransitionEventType,
49
- callback: HookFn,
50
- matchCriteria: HookMatchCriteria,
51
- removeHookFromRegistry: (hook: RegisteredHook) => void,
52
- options?: HookRegOptions,
53
- );
54
- /**
55
- * Gets the matching [[PathNode]]s
56
- *
57
- * Given an array of [[PathNode]]s, and a [[HookMatchCriterion]], returns an array containing
58
- * the [[PathNode]]s that the criteria matches, or `null` if there were no matching nodes.
59
- *
60
- * Returning `null` is significant to distinguish between the default
61
- * "match-all criterion value" of `true` compared to a `() => true` function,
62
- * when the nodes is an empty array.
63
- *
64
- * This is useful to allow a transition match criteria of `entering: true`
65
- * to still match a transition, even when `entering === []`. Contrast that
66
- * with `entering: (state) => true` which only matches when a state is actually
67
- * being entered.
68
- */
69
- private _matchingNodes;
70
- /**
71
- * Gets the default match criteria (all `true`)
72
- *
73
- * Returns an object which has all the criteria match paths as keys and `true` as values, i.e.:
74
- *
75
- * ```js
76
- * {
77
- * to: true,
78
- * from: true,
79
- * entering: true,
80
- * exiting: true,
81
- * retained: true,
82
- * }
83
- */
84
- private _getDefaultMatchCriteria;
85
- /**
86
- * Gets matching nodes as [[IMatchingNodes]]
87
- *
88
- * Create a IMatchingNodes object from the TransitionHookTypes that is roughly equivalent to:
89
- *
90
- * ```js
91
- * let matches: IMatchingNodes = {
92
- * to: _matchingNodes([tail(treeChanges.to)], mc.to),
93
- * from: _matchingNodes([tail(treeChanges.from)], mc.from),
94
- * exiting: _matchingNodes(treeChanges.exiting, mc.exiting),
95
- * retained: _matchingNodes(treeChanges.retained, mc.retained),
96
- * entering: _matchingNodes(treeChanges.entering, mc.entering),
97
- * };
98
- * ```
99
- */
100
- private _getMatchingNodes;
101
- /**
102
- * Determines if this hook's [[matchCriteria]] match the given [[TreeChanges]]
103
- *
104
- * @returns an IMatchingNodes object, or null. If an IMatchingNodes object is returned, its values
105
- * are the matching [[PathNode]]s for each [[HookMatchCriterion]] (to, from, exiting, retained, entering)
106
- */
107
- matches(treeChanges: TreeChanges, transition: Transition): IMatchingNodes;
108
- deregister(): void;
109
- }
110
- /** Return a registration function of the requested type. */
111
- export declare function makeEvent(
112
- registry: IHookRegistry,
113
- transitionService: TransitionService,
114
- eventType: TransitionEventType,
115
- ): (matchObject: any, callback: any, options?: {}) => any;
@@ -1,20 +0,0 @@
1
- /**
2
- * # Transition subsystem
3
- *
4
- * This module contains APIs related to a Transition.
5
- *
6
- * See:
7
- * - [[TransitionService]]
8
- * - [[Transition]]
9
- * - [[HookFn]], [[TransitionHookFn]], [[TransitionStateHookFn]], [[HookMatchCriteria]], [[HookResult]]
10
- *
11
- * @packageDocumentation @preferred
12
- */
13
- export * from "./interface";
14
- export * from "./hookBuilder";
15
- export * from "./hookRegistry";
16
- export * from "./rejectFactory";
17
- export * from "./transition";
18
- export * from "./transitionHook";
19
- export * from "./transitionEventType";
20
- export * from "./transitionService";