@angular-wave/angular.ts 0.14.3 → 0.15.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.
- package/@types/angular.d.ts +27 -25
- package/@types/animations/animate-cache.d.ts +46 -2
- package/@types/animations/animate-children-directive.d.ts +4 -4
- package/@types/animations/animate-js.d.ts +1 -10
- package/@types/animations/animate.d.ts +6 -1
- package/@types/animations/interface.d.ts +15 -0
- package/@types/animations/runner/animate-runner.d.ts +73 -52
- package/@types/animations/shared.d.ts +0 -16
- package/@types/core/compile/attributes.d.ts +40 -10
- package/@types/core/compile/compile.d.ts +1 -1
- package/@types/core/compile/inteface.d.ts +5 -1
- package/@types/core/controller/controller.d.ts +1 -1
- package/@types/core/di/inteface.d.ts +11 -0
- package/@types/core/interpolate/interface.d.ts +1 -0
- package/@types/core/parse/ast/ast-node.d.ts +2 -0
- package/@types/core/parse/interface.d.ts +1 -1
- package/@types/core/parse/interpreter.d.ts +5 -3
- package/@types/core/parse/parse.d.ts +4 -1
- package/@types/core/scope/interface.d.ts +26 -0
- package/@types/core/scope/scope.d.ts +13 -13
- package/@types/directive/attrs/attrs.d.ts +2 -5
- package/@types/directive/bind/bind.d.ts +5 -7
- package/@types/directive/class/class.d.ts +3 -3
- package/@types/directive/controller/controller.d.ts +2 -2
- package/@types/directive/form/form.d.ts +16 -13
- package/@types/directive/include/include.d.ts +4 -4
- package/@types/directive/init/init.d.ts +2 -2
- package/@types/directive/input/input.d.ts +16 -0
- package/@types/directive/listener/listener.d.ts +4 -0
- package/@types/directive/messages/messages.d.ts +9 -8
- package/@types/directive/model/interface.d.ts +18 -0
- package/@types/directive/model/model.d.ts +25 -23
- package/@types/directive/non-bindable/non-bindable.d.ts +2 -2
- package/@types/directive/ref/ref.d.ts +5 -8
- package/@types/directive/repeat/repeat.d.ts +2 -4
- package/@types/directive/script/script.d.ts +2 -2
- package/@types/directive/select/select.d.ts +9 -10
- package/@types/directive/setter/setter.d.ts +2 -2
- package/@types/directive/show-hide/show-hide.d.ts +2 -4
- package/@types/directive/switch/switch.d.ts +4 -4
- package/@types/directive/validators/validators.d.ts +2 -2
- package/@types/injection-tokens.d.ts +3 -2
- package/@types/interface.d.ts +72 -23
- package/@types/namespace.d.ts +50 -6
- package/@types/router/directives/state-directives.d.ts +26 -24
- package/@types/router/directives/view-directive.d.ts +27 -131
- package/@types/router/glob/glob.d.ts +2 -6
- package/@types/router/router.d.ts +6 -4
- package/@types/router/scroll/interface.d.ts +3 -0
- package/@types/router/scroll/view-scroll.d.ts +8 -0
- package/@types/router/state/interface.d.ts +30 -126
- package/@types/router/state/state-builder.d.ts +14 -7
- package/@types/router/state/state-matcher.d.ts +11 -3
- package/@types/router/state/state-object.d.ts +5 -7
- package/@types/router/state/state-queue-manager.d.ts +14 -8
- package/@types/router/state/state-registry.d.ts +26 -12
- package/@types/router/state/state-service.d.ts +24 -12
- package/@types/router/template-factory.d.ts +2 -2
- package/@types/router/transition/hook-registry.d.ts +15 -5
- package/@types/router/transition/interface.d.ts +9 -9
- package/@types/router/transition/transition-hook.d.ts +11 -0
- package/@types/router/transition/transition-service.d.ts +12 -5
- package/@types/router/transition/transition.d.ts +20 -14
- package/@types/router/url/url-rule.d.ts +12 -9
- package/@types/router/url/url-rules.d.ts +3 -84
- package/@types/router/url/url-service.d.ts +23 -18
- package/@types/router/view/view.d.ts +4 -4
- package/@types/services/anchor-scroll/anchor-scroll.d.ts +2 -17
- package/@types/services/anchor-scroll/interface.d.ts +15 -0
- package/@types/services/cookie/cookie.d.ts +7 -13
- package/@types/services/exception/interface.d.ts +3 -3
- package/@types/services/http/http.d.ts +6 -31
- package/@types/services/http/interface.d.ts +22 -0
- package/@types/services/location/location.d.ts +14 -13
- package/@types/services/log/log.d.ts +7 -3
- package/@types/services/pubsub/pubsub.d.ts +18 -13
- package/@types/services/rest/rest.d.ts +7 -5
- package/@types/services/sce/interface.d.ts +25 -0
- package/@types/services/sce/sce.d.ts +9 -1
- package/@types/services/sse/interface.d.ts +8 -1
- package/@types/services/sse/sse.d.ts +10 -18
- package/@types/services/storage/storage.d.ts +6 -6
- package/@types/services/stream/interface.d.ts +1 -1
- package/@types/services/stream/stream.d.ts +98 -0
- package/@types/shared/common.d.ts +2 -2
- package/@types/shared/dom.d.ts +21 -42
- package/@types/shared/hof.d.ts +27 -37
- package/@types/shared/noderef.d.ts +3 -3
- package/@types/shared/strings.d.ts +31 -10
- package/@types/shared/utils.d.ts +207 -101
- package/@types/shared/validate.d.ts +20 -0
- package/dist/angular-ts.esm.js +2461 -2298
- package/dist/angular-ts.umd.js +2461 -2298
- package/dist/angular-ts.umd.min.js +1 -1
- package/dist/angular-ts.umd.min.js.gz +0 -0
- package/dist/angular-ts.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/@types/router/state-filters.d.ts +0 -39
- package/@types/router/view-scroll.d.ts +0 -12
- package/@types/shared/cache.d.ts +0 -7
|
@@ -14,7 +14,9 @@ import {
|
|
|
14
14
|
} from "../resolve/interface.ts";
|
|
15
15
|
import { Resolvable } from "../resolve/resolvable.js";
|
|
16
16
|
import { TargetState } from "./target-state.js";
|
|
17
|
+
import { Glob } from "../glob/glob.js";
|
|
17
18
|
export type StateOrName = string | StateDeclaration | StateObject;
|
|
19
|
+
export type StateStore = Record<string, StateObject | BuiltStateDeclaration>;
|
|
18
20
|
export interface TransitionPromise extends Promise<StateObject> {
|
|
19
21
|
transition: Transition;
|
|
20
22
|
}
|
|
@@ -352,7 +354,7 @@ export interface StateDeclaration {
|
|
|
352
354
|
* Note: [State] objects require unique names.
|
|
353
355
|
* The name is used like an id.
|
|
354
356
|
*/
|
|
355
|
-
name
|
|
357
|
+
name: string;
|
|
356
358
|
/**
|
|
357
359
|
* Abstract state indicator
|
|
358
360
|
*
|
|
@@ -385,131 +387,6 @@ export interface StateDeclaration {
|
|
|
385
387
|
* ```
|
|
386
388
|
*/
|
|
387
389
|
parent?: string | StateDeclaration;
|
|
388
|
-
/**
|
|
389
|
-
* Resolve - a mechanism to asynchronously fetch data, participating in the Transition lifecycle
|
|
390
|
-
*
|
|
391
|
-
* The `resolve:` property defines data (or other dependencies) to be fetched asynchronously when the state is being entered.
|
|
392
|
-
* After the data is fetched, it may be used in views, transition hooks or other resolves that belong to this state.
|
|
393
|
-
* The data may also be used in any views or resolves that belong to nested states.
|
|
394
|
-
*
|
|
395
|
-
* ### As an array
|
|
396
|
-
*
|
|
397
|
-
* Each array element should be a [[ResolvableLiteral]] object.
|
|
398
|
-
*
|
|
399
|
-
* #### Example:
|
|
400
|
-
* The `user` resolve injects the current `Transition` and the `UserService` (using its token, which is a string).
|
|
401
|
-
* The [[ResolvableLiteral.resolvePolicy]] sets how the resolve is processed.
|
|
402
|
-
* The `user` data, fetched asynchronously, can then be used in a view.
|
|
403
|
-
* ```js
|
|
404
|
-
* var state = {
|
|
405
|
-
* name: 'user',
|
|
406
|
-
* url: '/user/:userId
|
|
407
|
-
* resolve: [
|
|
408
|
-
* {
|
|
409
|
-
* token: 'user',
|
|
410
|
-
* policy: { when: 'EAGER' },
|
|
411
|
-
* deps: ['UserService', Transition],
|
|
412
|
-
* resolveFn: (userSvc, trans) => userSvc.fetchUser(trans.params().userId) },
|
|
413
|
-
* }
|
|
414
|
-
* ]
|
|
415
|
-
* }
|
|
416
|
-
* ```
|
|
417
|
-
*
|
|
418
|
-
* Note: an Angular 2 style [`useFactory` provider literal](https://angular.io/docs/ts/latest/cookbook/dependency-injection.html#!#provide)
|
|
419
|
-
* may also be used. See [[ProviderLike]].
|
|
420
|
-
* #### Example:
|
|
421
|
-
* ```
|
|
422
|
-
* resolve: [
|
|
423
|
-
* { provide: 'token', useFactory: (http) => http.get('/'), deps: [ Http ] },
|
|
424
|
-
* ]
|
|
425
|
-
* ```
|
|
426
|
-
*
|
|
427
|
-
* ### As an object
|
|
428
|
-
*
|
|
429
|
-
* The `resolve` property may be an object where:
|
|
430
|
-
* - Each key (string) is the name of the dependency.
|
|
431
|
-
* - Each value (function) is an injectable function which returns the dependency, or a promise for the dependency.
|
|
432
|
-
*
|
|
433
|
-
* This style is based on AngularTS injectable functions, but can be used with any UI-Router implementation.
|
|
434
|
-
* If your code will be minified, the function should be ["annotated" in the AngularTS manner](https://docs.angularjs.org/guide/di#dependency-annotation).
|
|
435
|
-
*
|
|
436
|
-
* #### AngularTS Example:
|
|
437
|
-
* ```js
|
|
438
|
-
* resolve: {
|
|
439
|
-
* // If you inject `myStateDependency` into a controller, you'll get "abc"
|
|
440
|
-
* myStateDependency: function() {
|
|
441
|
-
* return "abc";
|
|
442
|
-
* },
|
|
443
|
-
* // Dependencies are annotated in "Inline Array Annotation"
|
|
444
|
-
* myAsyncData: ['$http', '$transition$' function($http, $transition$) {
|
|
445
|
-
* // Return a promise (async) for the data
|
|
446
|
-
* return $http.get("/foos/" + $transition$.params().foo);
|
|
447
|
-
* }]
|
|
448
|
-
* }
|
|
449
|
-
* ```
|
|
450
|
-
*
|
|
451
|
-
* Note: You cannot specify a policy for each Resolvable, nor can you use non-string
|
|
452
|
-
* tokens when using the object style `resolve:` block.
|
|
453
|
-
*
|
|
454
|
-
* ### Lifecycle
|
|
455
|
-
*
|
|
456
|
-
* Since a resolve function can return a promise, the router will delay entering the state until the promises are ready.
|
|
457
|
-
* If any of the promises are rejected, the Transition is aborted with an Error.
|
|
458
|
-
*
|
|
459
|
-
* By default, resolves for a state are fetched just before that state is entered.
|
|
460
|
-
* Note that only states which are being *entered* during the `Transition` have their resolves fetched.
|
|
461
|
-
* States that are "retained" do not have their resolves re-fetched.
|
|
462
|
-
*
|
|
463
|
-
* If you are currently in a parent state `parent` and are transitioning to a child state `parent.child`, the
|
|
464
|
-
* previously resolved data for state `parent` can be injected into `parent.child` without delay.
|
|
465
|
-
*
|
|
466
|
-
* Any resolved data for `parent.child` is retained until `parent.child` is exited, e.g., by transitioning back to the `parent` state.
|
|
467
|
-
*
|
|
468
|
-
* Because of this scoping and lifecycle, resolves are a great place to fetch your application's primary data.
|
|
469
|
-
*
|
|
470
|
-
* ### Injecting resolves into other things
|
|
471
|
-
*
|
|
472
|
-
* During a transition, Resolve data can be injected into:
|
|
473
|
-
*
|
|
474
|
-
* - Views (the components which fill a `ui-view` tag)
|
|
475
|
-
* - Transition Hooks
|
|
476
|
-
* - Other resolves (a resolve may depend on asynchronous data from a different resolve)
|
|
477
|
-
*
|
|
478
|
-
* ### Injecting other things into resolves
|
|
479
|
-
*
|
|
480
|
-
* Resolve functions usually have dependencies on some other API(s).
|
|
481
|
-
* The dependencies are usually declared and injected into the resolve function.
|
|
482
|
-
* A common pattern is to inject a custom service such as `UserService`.
|
|
483
|
-
* The resolve then delegates to a service method, such as `UserService.list()`;
|
|
484
|
-
*
|
|
485
|
-
* #### Special injectable tokens
|
|
486
|
-
*
|
|
487
|
-
* - `UIRouter`: The [[UIRouter]] instance which has references to all the UI-Router services.
|
|
488
|
-
* - `Transition`: The current [[Transition]] object; information and API about the current transition, such as
|
|
489
|
-
* "to" and "from" State Parameters and transition options.
|
|
490
|
-
* - `'$transition$'`: A string alias for the `Transition` injectable
|
|
491
|
-
* - `'$state$'`: For `onEnter`/`onExit`/`onRetain`, the state being entered/exited/retained.
|
|
492
|
-
* - Other resolve tokens: A resolve can depend on another resolve, either from the same state, or from any parent state.
|
|
493
|
-
*
|
|
494
|
-
* #### Example:
|
|
495
|
-
* ```js
|
|
496
|
-
* // Injecting a resolve into another resolve
|
|
497
|
-
* resolve: [
|
|
498
|
-
* // Define a resolve 'allusers' which delegates to the UserService.list()
|
|
499
|
-
* // which returns a promise (async) for all the users
|
|
500
|
-
* { provide: 'allusers', useFactory: (UserService) => UserService.list(), deps: [UserService] },
|
|
501
|
-
*
|
|
502
|
-
* // Define a resolve 'user' which depends on the allusers resolve.
|
|
503
|
-
* // This resolve function is not called until 'allusers' is ready.
|
|
504
|
-
* { provide: 'user', (allusers, trans) => _.find(allusers, trans.params().userId, deps: ['allusers', Transition] }
|
|
505
|
-
* }
|
|
506
|
-
* ```
|
|
507
|
-
*/
|
|
508
|
-
resolve?:
|
|
509
|
-
| ResolveTypes[]
|
|
510
|
-
| {
|
|
511
|
-
[key: string]: Injectable<any>;
|
|
512
|
-
};
|
|
513
390
|
/**
|
|
514
391
|
* Sets the resolve policy defaults for all resolves on this state
|
|
515
392
|
*
|
|
@@ -928,6 +805,33 @@ export interface StateDeclaration {
|
|
|
928
805
|
*/
|
|
929
806
|
reloadOnSearch?: boolean;
|
|
930
807
|
}
|
|
808
|
+
/**
|
|
809
|
+
* Represents a fully built StateObject, after registration in the StateRegistry
|
|
810
|
+
* and application of all StateBuilder decorators.
|
|
811
|
+
*/
|
|
812
|
+
export type BuiltStateDeclaration = StateDeclaration & {
|
|
813
|
+
/** Reference to the original StateDeclaration */
|
|
814
|
+
self: StateDeclaration;
|
|
815
|
+
/** Array of Resolvables built from the resolve / resolvePolicy */
|
|
816
|
+
resolvables: Resolvable[];
|
|
817
|
+
/** Full path from root down to this state */
|
|
818
|
+
path: BuiltStateDeclaration[];
|
|
819
|
+
/** Fast lookup of included states for $state.includes() */
|
|
820
|
+
includes: Record<string, boolean>;
|
|
821
|
+
/** Closest ancestor state that has a URL (navigable) */
|
|
822
|
+
navigable?: BuiltStateDeclaration | null;
|
|
823
|
+
/** URL object built from url / parent / root */
|
|
824
|
+
url?: any;
|
|
825
|
+
/** Computed parameters of this state */
|
|
826
|
+
params?: Record<string, any>;
|
|
827
|
+
/** Optional parent state */
|
|
828
|
+
parent?: BuiltStateDeclaration | null;
|
|
829
|
+
/** Optional inherited data */
|
|
830
|
+
data?: any;
|
|
831
|
+
_stateObjectCache?: {
|
|
832
|
+
nameGlob: Glob;
|
|
833
|
+
} | null;
|
|
834
|
+
};
|
|
931
835
|
/**
|
|
932
836
|
* The return type of a [[StateDeclaration.lazyLoad]] function
|
|
933
837
|
*
|
|
@@ -38,8 +38,11 @@
|
|
|
38
38
|
* new Resolvable("myBarResolve", function(dep) { return dep.fetchSomethingAsPromise() }, [ "DependencyName" ]),
|
|
39
39
|
* { provide: "myBazResolve", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ "DependencyName" ] }
|
|
40
40
|
* ]
|
|
41
|
+
* @param {ng.StateObject & ng.StateDeclaration} state
|
|
41
42
|
*/
|
|
42
|
-
export function resolvablesBuilder(
|
|
43
|
+
export function resolvablesBuilder(
|
|
44
|
+
state: ng.StateObject & ng.StateDeclaration,
|
|
45
|
+
): any[];
|
|
43
46
|
/**
|
|
44
47
|
* A internal global service
|
|
45
48
|
*
|
|
@@ -55,18 +58,22 @@ export function resolvablesBuilder(state: any): any[];
|
|
|
55
58
|
export class StateBuilder {
|
|
56
59
|
/**
|
|
57
60
|
* @param {import('./state-matcher.js').StateMatcher} matcher
|
|
58
|
-
* @param urlService
|
|
61
|
+
* @param {ng.UrlService} urlService
|
|
59
62
|
*/
|
|
60
63
|
constructor(
|
|
61
64
|
matcher: import("./state-matcher.js").StateMatcher,
|
|
62
|
-
urlService:
|
|
65
|
+
urlService: ng.UrlService,
|
|
63
66
|
);
|
|
64
|
-
|
|
65
|
-
$injector: any;
|
|
66
|
-
|
|
67
|
+
_matcher: import("./state-matcher.js").StateMatcher;
|
|
68
|
+
_$injector: any;
|
|
69
|
+
_builders: {
|
|
67
70
|
name: ((state: any) => any)[];
|
|
68
71
|
self: (typeof selfBuilder)[];
|
|
69
|
-
parent: ((
|
|
72
|
+
parent: ((
|
|
73
|
+
state: any,
|
|
74
|
+
) =>
|
|
75
|
+
| import("./state-object.js").StateObject
|
|
76
|
+
| import("./interface.ts").BuiltStateDeclaration)[];
|
|
70
77
|
data: (typeof dataBuilder)[];
|
|
71
78
|
url: ((stateObject: any) => any)[];
|
|
72
79
|
navigable: ((state: any) => any)[];
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
export class StateMatcher {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/** @param {import("./interface.ts").StateStore} states */
|
|
3
|
+
constructor(states: import("./interface.ts").StateStore);
|
|
4
|
+
/** @type {import("./interface.ts").StateStore} */
|
|
5
|
+
_states: import("./interface.ts").StateStore;
|
|
4
6
|
isRelative(stateName: any): boolean;
|
|
5
|
-
find(
|
|
7
|
+
find(
|
|
8
|
+
stateOrName: any,
|
|
9
|
+
base: any,
|
|
10
|
+
matchGlob?: boolean,
|
|
11
|
+
):
|
|
12
|
+
| import("./state-object.js").StateObject
|
|
13
|
+
| import("./interface.ts").BuiltStateDeclaration;
|
|
6
14
|
resolvePath(name: any, base: any): string;
|
|
7
15
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** @typedef {import('./interface.ts').StateDeclaration} StateDeclaration */
|
|
2
1
|
/**
|
|
3
2
|
* Internal representation of a ng-router state.
|
|
4
3
|
*
|
|
@@ -8,9 +7,9 @@
|
|
|
8
7
|
*
|
|
9
8
|
* This class prototypally inherits from the corresponding [[StateDeclaration]].
|
|
10
9
|
* Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].
|
|
11
|
-
* @implements {StateDeclaration}
|
|
10
|
+
* @implements {ng.StateDeclaration}
|
|
12
11
|
*/
|
|
13
|
-
export class StateObject implements StateDeclaration {
|
|
12
|
+
export class StateObject implements ng.StateDeclaration {
|
|
14
13
|
/**
|
|
15
14
|
* @param {import('./interface.ts').StateDeclaration} config
|
|
16
15
|
*/
|
|
@@ -24,10 +23,10 @@ export class StateObject implements StateDeclaration {
|
|
|
24
23
|
includes: any;
|
|
25
24
|
$$state: () => this;
|
|
26
25
|
/**
|
|
27
|
-
* @type {
|
|
26
|
+
* @type {ng.StateDeclaration|ng.BuiltStateDeclaration}
|
|
28
27
|
*/
|
|
29
|
-
self:
|
|
30
|
-
|
|
28
|
+
self: ng.StateDeclaration | ng.BuiltStateDeclaration;
|
|
29
|
+
_stateObjectCache: {
|
|
31
30
|
nameGlob: Glob;
|
|
32
31
|
};
|
|
33
32
|
/**
|
|
@@ -79,5 +78,4 @@ export namespace StateObject {
|
|
|
79
78
|
/** Predicate which returns true if the object is an internal [[StateObject]] object */
|
|
80
79
|
function isState(obj: any): boolean;
|
|
81
80
|
}
|
|
82
|
-
export type StateDeclaration = import("./interface.ts").StateDeclaration;
|
|
83
81
|
import { Glob } from "../glob/glob.js";
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
export class StateQueueManager {
|
|
2
2
|
/**
|
|
3
3
|
* @param {import("./state-registry.js").StateRegistryProvider} stateRegistry
|
|
4
|
-
* @param {
|
|
5
|
-
* @param {
|
|
4
|
+
* @param {import("../url/url-rules.js").UrlRules} urlServiceRules
|
|
5
|
+
* @param {import("./interface.ts").StateStore} states
|
|
6
6
|
* @param {*} builder
|
|
7
7
|
* @param {*} listeners
|
|
8
8
|
*/
|
|
9
9
|
constructor(
|
|
10
10
|
stateRegistry: import("./state-registry.js").StateRegistryProvider,
|
|
11
|
-
urlServiceRules:
|
|
12
|
-
states:
|
|
11
|
+
urlServiceRules: import("../url/url-rules.js").UrlRules,
|
|
12
|
+
states: import("./interface.ts").StateStore,
|
|
13
13
|
builder: any,
|
|
14
14
|
listeners: any,
|
|
15
15
|
);
|
|
16
16
|
stateRegistry: import("./state-registry.js").StateRegistryProvider;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/** @type {import("../url/url-rules.js").UrlRules} */
|
|
18
|
+
urlServiceRules: import("../url/url-rules.js").UrlRules;
|
|
19
|
+
states: import("./interface.ts").StateStore;
|
|
19
20
|
builder: any;
|
|
20
21
|
listeners: any;
|
|
21
22
|
/**
|
|
@@ -23,7 +24,12 @@ export class StateQueueManager {
|
|
|
23
24
|
*/
|
|
24
25
|
queue: Array<StateObject>;
|
|
25
26
|
register(stateDecl: any): StateObject;
|
|
26
|
-
flush():
|
|
27
|
-
|
|
27
|
+
flush(): import("./interface.ts").StateStore;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {ng.StateDeclaration} state
|
|
31
|
+
* @returns {() => void} a function that deregisters the rule
|
|
32
|
+
*/
|
|
33
|
+
attachRoute(state: ng.StateDeclaration): () => void;
|
|
28
34
|
}
|
|
29
35
|
import { StateObject } from "./state-object.js";
|
|
@@ -8,20 +8,21 @@
|
|
|
8
8
|
export class StateRegistryProvider {
|
|
9
9
|
static $inject: string[];
|
|
10
10
|
/**
|
|
11
|
-
* @param urlService
|
|
12
|
-
* @param stateService
|
|
13
|
-
* @param {
|
|
14
|
-
* @param viewService
|
|
11
|
+
* @param {ng.UrlService} urlService
|
|
12
|
+
* @param {ng.StateService} stateService
|
|
13
|
+
* @param {ng.RouterService} globals
|
|
14
|
+
* @param {ng.ViewService} viewService
|
|
15
15
|
*/
|
|
16
16
|
constructor(
|
|
17
|
-
urlService:
|
|
18
|
-
stateService:
|
|
19
|
-
globals:
|
|
20
|
-
viewService:
|
|
17
|
+
urlService: ng.UrlService,
|
|
18
|
+
stateService: ng.StateService,
|
|
19
|
+
globals: ng.RouterService,
|
|
20
|
+
viewService: ng.ViewService,
|
|
21
21
|
);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
/** @type {import("./interface.ts").StateStore} */
|
|
23
|
+
states: import("./interface.ts").StateStore;
|
|
24
|
+
urlService: import("../url/url-service.js").UrlService;
|
|
25
|
+
urlServiceRules: import("../url/url-rules.js").UrlRules;
|
|
25
26
|
$injector: any;
|
|
26
27
|
listeners: any[];
|
|
27
28
|
matcher: StateMatcher;
|
|
@@ -110,7 +111,20 @@ export class StateRegistryProvider {
|
|
|
110
111
|
* @returns {import('./state-object').StateObject[]} a list of removed states
|
|
111
112
|
*/
|
|
112
113
|
deregister(stateOrName: any): any[];
|
|
113
|
-
|
|
114
|
+
/**
|
|
115
|
+
* @return {ng.BuiltStateDeclaration[]}
|
|
116
|
+
*/
|
|
117
|
+
getAll(): ng.BuiltStateDeclaration[];
|
|
118
|
+
get(
|
|
119
|
+
stateOrName: any,
|
|
120
|
+
base: any,
|
|
121
|
+
...args: any[]
|
|
122
|
+
):
|
|
123
|
+
| import("./interface.ts").StateDeclaration
|
|
124
|
+
| (
|
|
125
|
+
| import("./interface.ts").StateDeclaration
|
|
126
|
+
| import("./interface.ts").BuiltStateDeclaration
|
|
127
|
+
)[];
|
|
114
128
|
/**
|
|
115
129
|
* Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`).
|
|
116
130
|
* More than one BuilderFunction can be registered for a given property.
|
|
@@ -7,14 +7,14 @@ export class StateProvider {
|
|
|
7
7
|
static $inject: string[];
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {
|
|
12
|
-
* @param {
|
|
10
|
+
* @param {ng.RouterProvider} globals
|
|
11
|
+
* @param {ng.TransitionProvider} transitionService
|
|
12
|
+
* @param {ng.ExceptionHandlerProvider} exceptionHandlerProvider
|
|
13
13
|
*/
|
|
14
14
|
constructor(
|
|
15
|
-
globals:
|
|
16
|
-
transitionService:
|
|
17
|
-
|
|
15
|
+
globals: ng.RouterProvider,
|
|
16
|
+
transitionService: ng.TransitionProvider,
|
|
17
|
+
exceptionHandlerProvider: ng.ExceptionHandlerProvider,
|
|
18
18
|
);
|
|
19
19
|
/**
|
|
20
20
|
* The latest successful state parameters
|
|
@@ -34,14 +34,26 @@ export class StateProvider {
|
|
|
34
34
|
* @deprecated This is a passthrough through to [[Router.$current]]
|
|
35
35
|
*/
|
|
36
36
|
get $current(): import("./state-object.js").StateObject;
|
|
37
|
+
/**
|
|
38
|
+
* @type {ng.RouterProvider}
|
|
39
|
+
*/
|
|
40
|
+
globals: ng.RouterProvider;
|
|
41
|
+
/**
|
|
42
|
+
* @type {ng.TransitionProvider}
|
|
43
|
+
*/
|
|
44
|
+
transitionService: ng.TransitionProvider;
|
|
37
45
|
stateRegistry: any;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
$injector:
|
|
46
|
+
/** @type {ng.UrlService} */
|
|
47
|
+
urlService: ng.UrlService;
|
|
48
|
+
/** @type {ng.InjectorService} */
|
|
49
|
+
$injector: ng.InjectorService;
|
|
42
50
|
invalidCallbacks: any[];
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
/** @type {ng.ExceptionHandlerService} */
|
|
52
|
+
_defaultErrorHandler: ng.ExceptionHandlerService;
|
|
53
|
+
$get: (
|
|
54
|
+
| string
|
|
55
|
+
| (($injector: ng.InjectorService, $url: any) => StateProvider)
|
|
56
|
+
)[];
|
|
45
57
|
/**
|
|
46
58
|
* Decorates states when they are registered
|
|
47
59
|
*
|
|
@@ -19,9 +19,9 @@ export class TemplateFactoryProvider {
|
|
|
19
19
|
) => this)
|
|
20
20
|
)[];
|
|
21
21
|
$templateRequest: any;
|
|
22
|
-
$http: import("../interface.ts").HttpService;
|
|
22
|
+
$http: import("../services/http/interface.ts").HttpService;
|
|
23
23
|
$templateCache: ng.TemplateCacheService;
|
|
24
|
-
$injector: import("../
|
|
24
|
+
$injector: import("../core/di/internal-injector.js").InjectorService;
|
|
25
25
|
/**
|
|
26
26
|
* Forces the provider to use $http service directly
|
|
27
27
|
* @param {boolean} value
|
|
@@ -16,12 +16,22 @@ export function matchState(
|
|
|
16
16
|
criterion: any,
|
|
17
17
|
transition: any,
|
|
18
18
|
): boolean;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Return a registration function of the requested type.
|
|
21
|
+
* @param {ng.TransitionProvider| import("./transition.js").Transition} hookSource
|
|
22
|
+
* @param {ng.TransitionProvider} transitionService
|
|
23
|
+
* @param {import("./transition-event-type.js").TransitionEventType} eventType
|
|
24
|
+
* @returns {( matchObject: any, callback: Function, options?: Record<string, any> ) => () => void }
|
|
25
|
+
*/
|
|
20
26
|
export function makeEvent(
|
|
21
|
-
|
|
22
|
-
transitionService:
|
|
23
|
-
eventType:
|
|
24
|
-
): (
|
|
27
|
+
hookSource: ng.TransitionProvider | import("./transition.js").Transition,
|
|
28
|
+
transitionService: ng.TransitionProvider,
|
|
29
|
+
eventType: import("./transition-event-type.js").TransitionEventType,
|
|
30
|
+
): (
|
|
31
|
+
matchObject: any,
|
|
32
|
+
callback: Function,
|
|
33
|
+
options?: Record<string, any>,
|
|
34
|
+
) => () => void;
|
|
25
35
|
/**
|
|
26
36
|
* The registration data for a registered transition hook
|
|
27
37
|
*/
|
|
@@ -168,11 +168,11 @@ export type IHookRegistration = (
|
|
|
168
168
|
*
|
|
169
169
|
* #### See:
|
|
170
170
|
*
|
|
171
|
-
* - [[
|
|
172
|
-
* - [[
|
|
173
|
-
* - [[
|
|
174
|
-
* - [[
|
|
175
|
-
* - [[
|
|
171
|
+
* - [[HookRegistry.onBefore]]
|
|
172
|
+
* - [[HookRegistry.onStart]]
|
|
173
|
+
* - [[HookRegistry.onFinish]]
|
|
174
|
+
* - [[HookRegistry.onSuccess]]
|
|
175
|
+
* - [[HookRegistry.onError]]
|
|
176
176
|
*
|
|
177
177
|
* @param transition the current [[Transition]]
|
|
178
178
|
* @param injector (for ng1 or ng2 only) the injector service
|
|
@@ -196,9 +196,9 @@ export interface TransitionHookFn {
|
|
|
196
196
|
*
|
|
197
197
|
* #### See also:
|
|
198
198
|
*
|
|
199
|
-
* - [[
|
|
200
|
-
* - [[
|
|
201
|
-
* - [[
|
|
199
|
+
* - [[HookRegistry.onExit]]
|
|
200
|
+
* - [[HookRegistry.onRetain]]
|
|
201
|
+
* - [[HookRegistry.onEnter]]
|
|
202
202
|
*
|
|
203
203
|
* #### Example:
|
|
204
204
|
* ```js
|
|
@@ -287,7 +287,7 @@ export interface HookRegOptions {
|
|
|
287
287
|
* [[TransitionService]] and also the [[Transition]] object itself implement this interface.
|
|
288
288
|
* Note: the Transition object only allows hooks to be registered before the Transition is started.
|
|
289
289
|
*/
|
|
290
|
-
export interface
|
|
290
|
+
export interface HookRegistry {
|
|
291
291
|
/**
|
|
292
292
|
* Registers a [[TransitionHookFn]], called *before a transition starts*.
|
|
293
293
|
*
|
|
@@ -53,11 +53,20 @@ export class TransitionHook {
|
|
|
53
53
|
* Run all TransitionHooks, ignoring their return value.
|
|
54
54
|
*/
|
|
55
55
|
static runAllHooks(hooks: any): void;
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @param {*} transition
|
|
59
|
+
* @param {*} stateContext
|
|
60
|
+
* @param {*} registeredHook
|
|
61
|
+
* @param {*} options
|
|
62
|
+
* @param {ng.ExceptionHandlerService} exceptionHandler
|
|
63
|
+
*/
|
|
56
64
|
constructor(
|
|
57
65
|
transition: any,
|
|
58
66
|
stateContext: any,
|
|
59
67
|
registeredHook: any,
|
|
60
68
|
options: any,
|
|
69
|
+
exceptionHandler: ng.ExceptionHandlerService,
|
|
61
70
|
);
|
|
62
71
|
transition: any;
|
|
63
72
|
stateContext: any;
|
|
@@ -65,6 +74,8 @@ export class TransitionHook {
|
|
|
65
74
|
options: any;
|
|
66
75
|
isSuperseded: () => boolean;
|
|
67
76
|
type: any;
|
|
77
|
+
/** @type {ng.ExceptionHandlerService} */
|
|
78
|
+
_exceptionHandler: ng.ExceptionHandlerService;
|
|
68
79
|
logError(err: any): void;
|
|
69
80
|
invokeHook(): any;
|
|
70
81
|
/**
|
|
@@ -23,10 +23,15 @@ export namespace defaultTransOpts {
|
|
|
23
23
|
export class TransitionProvider {
|
|
24
24
|
static $inject: string[];
|
|
25
25
|
/**
|
|
26
|
-
* @param {
|
|
27
|
-
* @param viewService
|
|
26
|
+
* @param {ng.RouterService} globals
|
|
27
|
+
* @param {ng.ViewService} viewService
|
|
28
|
+
* @param {ng.ExceptionHandlerProvider} $exceptionHandler
|
|
28
29
|
*/
|
|
29
|
-
constructor(
|
|
30
|
+
constructor(
|
|
31
|
+
globals: ng.RouterService,
|
|
32
|
+
viewService: ng.ViewService,
|
|
33
|
+
$exceptionHandler: ng.ExceptionHandlerProvider,
|
|
34
|
+
);
|
|
30
35
|
_transitionCount: number;
|
|
31
36
|
/** The transition hook types, such as `onEnter`, `onStart`, etc */
|
|
32
37
|
_eventTypes: any[];
|
|
@@ -34,9 +39,11 @@ export class TransitionProvider {
|
|
|
34
39
|
_registeredHooks: {};
|
|
35
40
|
/** The paths on a criteria object */
|
|
36
41
|
_criteriaPaths: {};
|
|
37
|
-
globals: import("../router.js").
|
|
38
|
-
$view:
|
|
42
|
+
globals: import("../router.js").RouterProvider;
|
|
43
|
+
$view: import("../view/view.js").ViewService;
|
|
39
44
|
_deregisterHookFns: {};
|
|
45
|
+
/** @type {ng.ExceptionHandlerService} */
|
|
46
|
+
_$exceptionHandler: ng.ExceptionHandlerService;
|
|
40
47
|
$get: (
|
|
41
48
|
| string
|
|
42
49
|
| ((
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* This object contains all contextual information about the to/from states, parameters, resolves.
|
|
7
7
|
* It has information about all states being entered and exited as a result of the transition.
|
|
8
|
-
* @implements {
|
|
8
|
+
* @implements {HookRegistry}
|
|
9
9
|
*/
|
|
10
|
-
export class Transition implements
|
|
10
|
+
export class Transition implements HookRegistry {
|
|
11
11
|
/**
|
|
12
12
|
* Creates a new Transition object.
|
|
13
13
|
*
|
|
@@ -16,21 +16,23 @@ export class Transition implements IHookRegistry {
|
|
|
16
16
|
* @param {Array<import('../path/path-node.js').PathNode>} fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath`
|
|
17
17
|
* encapsulates the "from state".
|
|
18
18
|
* @param {import('../state/target-state.js').TargetState} targetState The target state and parameters being transitioned to (also, the transition options)
|
|
19
|
-
* @param {
|
|
20
|
-
* @param {
|
|
19
|
+
* @param {ng.TransitionProvider} transitionService The [[TransitionService]] instance
|
|
20
|
+
* @param {ng.RouterService} globals
|
|
21
21
|
*/
|
|
22
22
|
constructor(
|
|
23
23
|
fromPath: Array<import("../path/path-node.js").PathNode>,
|
|
24
24
|
targetState: import("../state/target-state.js").TargetState,
|
|
25
|
-
transitionService:
|
|
26
|
-
globals:
|
|
25
|
+
transitionService: ng.TransitionProvider,
|
|
26
|
+
globals: ng.RouterService,
|
|
27
27
|
);
|
|
28
28
|
/**
|
|
29
|
-
* @type {import('../router.js').
|
|
29
|
+
* @type {import('../router.js').RouterProvider}
|
|
30
30
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
_globals: import("../router.js").RouterProvider;
|
|
32
|
+
/** @type {ng.TransitionProvider} */
|
|
33
|
+
_transitionProvider: ng.TransitionProvider;
|
|
34
|
+
/** @type {PromiseWithResolvers<any>} */
|
|
35
|
+
_deferred: PromiseWithResolvers<any>;
|
|
34
36
|
/**
|
|
35
37
|
* This promise is resolved or rejected based on the outcome of the Transition.
|
|
36
38
|
*
|
|
@@ -77,7 +79,9 @@ export class Transition implements IHookRegistry {
|
|
|
77
79
|
*
|
|
78
80
|
* @returns The state declaration object for the Transition's ("from state").
|
|
79
81
|
*/
|
|
80
|
-
from():
|
|
82
|
+
from():
|
|
83
|
+
| import("../state/interface.ts").StateDeclaration
|
|
84
|
+
| import("../state/interface.ts").BuiltStateDeclaration;
|
|
81
85
|
/**
|
|
82
86
|
* Returns the "to state"
|
|
83
87
|
*
|
|
@@ -85,7 +89,9 @@ export class Transition implements IHookRegistry {
|
|
|
85
89
|
*
|
|
86
90
|
* @returns The state declaration object for the Transition's target state ("to state").
|
|
87
91
|
*/
|
|
88
|
-
to():
|
|
92
|
+
to():
|
|
93
|
+
| import("../state/interface.ts").StateDeclaration
|
|
94
|
+
| import("../state/interface.ts").BuiltStateDeclaration;
|
|
89
95
|
/**
|
|
90
96
|
* Gets the Target State
|
|
91
97
|
*
|
|
@@ -280,7 +286,7 @@ export class Transition implements IHookRegistry {
|
|
|
280
286
|
* @returns true if the Transition is ignored.
|
|
281
287
|
*/
|
|
282
288
|
ignored(): boolean;
|
|
283
|
-
_ignoredReason(): "
|
|
289
|
+
_ignoredReason(): "SameAsPending" | "SameAsCurrent";
|
|
284
290
|
/**
|
|
285
291
|
* Runs the transition
|
|
286
292
|
*
|
|
@@ -326,5 +332,5 @@ export class Transition implements IHookRegistry {
|
|
|
326
332
|
export namespace Transition {
|
|
327
333
|
export { Transition as diToken };
|
|
328
334
|
}
|
|
329
|
-
export type
|
|
335
|
+
export type HookRegistry = import("./interface.ts").HookRegistry;
|
|
330
336
|
import { HookBuilder } from "./hook-builder.js";
|