@angular-wave/angular.ts 0.14.2 → 0.15.0
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 +28 -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 +17 -2
- package/@types/animations/queue/animate-queue.d.ts +0 -1
- package/@types/animations/raf-scheduler.d.ts +3 -3
- package/@types/animations/runner/animate-runner.d.ts +81 -57
- package/@types/animations/shared.d.ts +0 -16
- package/@types/core/compile/attributes.d.ts +13 -10
- package/@types/core/compile/compile.d.ts +2 -2
- package/@types/core/controller/controller.d.ts +1 -1
- package/@types/core/di/ng-module/ng-module.d.ts +8 -7
- package/@types/core/filter/filter.d.ts +1 -1
- package/@types/core/interpolate/interface.d.ts +1 -0
- package/@types/core/parse/ast/ast.d.ts +30 -39
- package/@types/core/parse/ast-type.d.ts +16 -16
- package/@types/core/parse/interface.d.ts +1 -1
- package/@types/core/parse/interpreter.d.ts +6 -29
- package/@types/core/parse/lexer/lexer.d.ts +19 -19
- package/@types/core/parse/parser/parser.d.ts +4 -9
- package/@types/core/scope/interface.d.ts +0 -6
- package/@types/core/scope/scope.d.ts +13 -13
- package/@types/directive/attrs/attrs.d.ts +2 -5
- 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 +4 -4
- package/@types/directive/include/include.d.ts +4 -4
- package/@types/directive/messages/messages.d.ts +9 -8
- package/@types/directive/model/model.d.ts +5 -5
- 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 +7 -8
- package/@types/directive/validators/validators.d.ts +2 -2
- package/@types/injection-tokens.d.ts +3 -2
- package/@types/interface.d.ts +50 -22
- package/@types/namespace.d.ts +42 -6
- package/@types/router/common/trace.d.ts +5 -5
- 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/params/interface.d.ts +2 -2
- package/@types/router/params/param.d.ts +3 -3
- package/@types/router/router.d.ts +1 -1
- 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 +25 -126
- package/@types/router/state/state-builder.d.ts +4 -1
- package/@types/router/state/state-object.d.ts +2 -2
- package/@types/router/state/state-queue-manager.d.ts +4 -4
- package/@types/router/state/state-registry.d.ts +16 -11
- package/@types/router/state/state-service.d.ts +18 -12
- package/@types/router/template-factory.d.ts +2 -2
- package/@types/router/transition/interface.d.ts +9 -9
- package/@types/router/transition/reject-factory.d.ts +5 -5
- package/@types/router/transition/transition-hook.d.ts +22 -23
- package/@types/router/transition/transition-service.d.ts +12 -5
- package/@types/router/transition/transition.d.ts +17 -13
- package/@types/router/url/url-rule.d.ts +12 -9
- package/@types/router/url/url-service.d.ts +14 -10
- 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 +6 -4
- package/@types/services/exception/interface.d.ts +3 -3
- package/@types/services/http/http.d.ts +8 -7
- package/@types/services/log/log.d.ts +7 -3
- package/@types/services/pubsub/pubsub.d.ts +18 -14
- package/@types/services/rest/rest.d.ts +12 -10
- package/@types/services/sce/sce.d.ts +9 -1
- package/@types/services/sse/sse.d.ts +1 -1
- package/@types/shared/node.d.ts +8 -0
- package/@types/shared/noderef.d.ts +11 -14
- package/@types/shared/strings.d.ts +18 -6
- package/@types/shared/utils.d.ts +111 -73
- package/@types/shared/validate.d.ts +49 -0
- package/dist/angular-ts.esm.js +2581 -2619
- package/dist/angular-ts.umd.js +2581 -2619
- package/dist/angular-ts.umd.min.js +2 -1
- package/dist/angular-ts.umd.min.js.gz +0 -0
- package/dist/angular-ts.umd.min.js.map +1 -0
- package/package.json +1 -1
- package/@types/router/view-scroll.d.ts +0 -12
|
@@ -352,7 +352,7 @@ export interface StateDeclaration {
|
|
|
352
352
|
* Note: [State] objects require unique names.
|
|
353
353
|
* The name is used like an id.
|
|
354
354
|
*/
|
|
355
|
-
name
|
|
355
|
+
name: string;
|
|
356
356
|
/**
|
|
357
357
|
* Abstract state indicator
|
|
358
358
|
*
|
|
@@ -385,131 +385,6 @@ export interface StateDeclaration {
|
|
|
385
385
|
* ```
|
|
386
386
|
*/
|
|
387
387
|
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
388
|
/**
|
|
514
389
|
* Sets the resolve policy defaults for all resolves on this state
|
|
515
390
|
*
|
|
@@ -928,6 +803,30 @@ export interface StateDeclaration {
|
|
|
928
803
|
*/
|
|
929
804
|
reloadOnSearch?: boolean;
|
|
930
805
|
}
|
|
806
|
+
/**
|
|
807
|
+
* Represents a fully built StateObject, after registration in the StateRegistry
|
|
808
|
+
* and application of all StateBuilder decorators.
|
|
809
|
+
*/
|
|
810
|
+
export type BuiltStateDeclaration = StateDeclaration & {
|
|
811
|
+
/** Reference to the original StateDeclaration */
|
|
812
|
+
self: StateDeclaration;
|
|
813
|
+
/** Array of Resolvables built from the resolve / resolvePolicy */
|
|
814
|
+
resolvables: Resolvable[];
|
|
815
|
+
/** Full path from root down to this state */
|
|
816
|
+
path: BuiltStateDeclaration[];
|
|
817
|
+
/** Fast lookup of included states for $state.includes() */
|
|
818
|
+
includes: Record<string, boolean>;
|
|
819
|
+
/** Closest ancestor state that has a URL (navigable) */
|
|
820
|
+
navigable?: BuiltStateDeclaration | null;
|
|
821
|
+
/** URL object built from url / parent / root */
|
|
822
|
+
url?: any;
|
|
823
|
+
/** Computed parameters of this state */
|
|
824
|
+
params?: Record<string, any>;
|
|
825
|
+
/** Optional parent state */
|
|
826
|
+
parent?: BuiltStateDeclaration | null;
|
|
827
|
+
/** Optional inherited data */
|
|
828
|
+
data?: any;
|
|
829
|
+
};
|
|
931
830
|
/**
|
|
932
831
|
* The return type of a [[StateDeclaration.lazyLoad]] function
|
|
933
832
|
*
|
|
@@ -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
|
*
|
|
@@ -24,9 +24,9 @@ export class StateObject implements StateDeclaration {
|
|
|
24
24
|
includes: any;
|
|
25
25
|
$$state: () => this;
|
|
26
26
|
/**
|
|
27
|
-
* @type {
|
|
27
|
+
* @type {ng.StateDeclaration|ng.BuiltStateDeclaration}
|
|
28
28
|
*/
|
|
29
|
-
self:
|
|
29
|
+
self: ng.StateDeclaration | ng.BuiltStateDeclaration;
|
|
30
30
|
__stateObjectCache: {
|
|
31
31
|
nameGlob: Glob;
|
|
32
32
|
};
|
|
@@ -2,20 +2,20 @@ export class StateQueueManager {
|
|
|
2
2
|
/**
|
|
3
3
|
* @param {import("./state-registry.js").StateRegistryProvider} stateRegistry
|
|
4
4
|
* @param {*} urlServiceRules
|
|
5
|
-
* @param {
|
|
5
|
+
* @param {Record<string, ng.StateObject>} states
|
|
6
6
|
* @param {*} builder
|
|
7
7
|
* @param {*} listeners
|
|
8
8
|
*/
|
|
9
9
|
constructor(
|
|
10
10
|
stateRegistry: import("./state-registry.js").StateRegistryProvider,
|
|
11
11
|
urlServiceRules: any,
|
|
12
|
-
states:
|
|
12
|
+
states: Record<string, ng.StateObject>,
|
|
13
13
|
builder: any,
|
|
14
14
|
listeners: any,
|
|
15
15
|
);
|
|
16
16
|
stateRegistry: import("./state-registry.js").StateRegistryProvider;
|
|
17
17
|
urlServiceRules: any;
|
|
18
|
-
states:
|
|
18
|
+
states: Record<string, StateObject>;
|
|
19
19
|
builder: any;
|
|
20
20
|
listeners: any;
|
|
21
21
|
/**
|
|
@@ -23,7 +23,7 @@ export class StateQueueManager {
|
|
|
23
23
|
*/
|
|
24
24
|
queue: Array<StateObject>;
|
|
25
25
|
register(stateDecl: any): StateObject;
|
|
26
|
-
flush():
|
|
26
|
+
flush(): Record<string, StateObject>;
|
|
27
27
|
attachRoute(state: any): void;
|
|
28
28
|
}
|
|
29
29
|
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 {Record<string, import("./state-object.js").StateObject>} */
|
|
23
|
+
states: Record<string, import("./state-object.js").StateObject>;
|
|
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,6 +111,10 @@ export class StateRegistryProvider {
|
|
|
110
111
|
* @returns {import('./state-object').StateObject[]} a list of removed states
|
|
111
112
|
*/
|
|
112
113
|
deregister(stateOrName: any): any[];
|
|
114
|
+
/**
|
|
115
|
+
* @return {ng.BuiltStateDeclaration[]}
|
|
116
|
+
*/
|
|
117
|
+
getAll(): ng.BuiltStateDeclaration[];
|
|
113
118
|
get(stateOrName: any, base: any, ...args: any[]): any;
|
|
114
119
|
/**
|
|
115
120
|
* Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`).
|
|
@@ -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,20 @@ 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
|
+
globals: import("../router.js").RouterProvider;
|
|
38
|
+
transitionService: import("../transition/transition-service.js").TransitionProvider;
|
|
37
39
|
stateRegistry: any;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
$injector:
|
|
40
|
+
/** @type {ng.UrlService} */
|
|
41
|
+
urlService: ng.UrlService;
|
|
42
|
+
/** @type {ng.InjectorService} */
|
|
43
|
+
$injector: ng.InjectorService;
|
|
42
44
|
invalidCallbacks: any[];
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
/** @type {ng.ExceptionHandlerService} */
|
|
46
|
+
_defaultErrorHandler: ng.ExceptionHandlerService;
|
|
47
|
+
$get: (
|
|
48
|
+
| string
|
|
49
|
+
| (($injector: ng.InjectorService, $url: any) => StateProvider)
|
|
50
|
+
)[];
|
|
45
51
|
/**
|
|
46
52
|
* Decorates states when they are registered
|
|
47
53
|
*
|
|
@@ -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
|
|
@@ -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
|
*
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export type RejectType = number;
|
|
5
5
|
export namespace RejectType {
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
let
|
|
6
|
+
let _SUPERSEDED: number;
|
|
7
|
+
let _ABORTED: number;
|
|
8
|
+
let _INVALID: number;
|
|
9
|
+
let _IGNORED: number;
|
|
10
|
+
let _ERROR: number;
|
|
11
11
|
}
|
|
12
12
|
export class Rejection {
|
|
13
13
|
/** Returns a Rejection due to transition superseded */
|
|
@@ -2,33 +2,21 @@
|
|
|
2
2
|
* Enum representing the different phases of a transition hook.
|
|
3
3
|
*/
|
|
4
4
|
export type TransitionHookPhase = number;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
CREATE: 0;
|
|
13
|
-
BEFORE: 1;
|
|
14
|
-
RUN: 2;
|
|
15
|
-
SUCCESS: 3;
|
|
16
|
-
ERROR: 4;
|
|
17
|
-
}>;
|
|
5
|
+
export namespace TransitionHookPhase {
|
|
6
|
+
let _CREATE: number;
|
|
7
|
+
let _BEFORE: number;
|
|
8
|
+
let _RUN: number;
|
|
9
|
+
let _SUCCESS: number;
|
|
10
|
+
let _ERROR: number;
|
|
11
|
+
}
|
|
18
12
|
/**
|
|
19
13
|
* Enum representing the scope in which a transition hook operates.
|
|
20
14
|
*/
|
|
21
15
|
export type TransitionHookScope = number;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* @enum {number}
|
|
27
|
-
*/
|
|
28
|
-
export const TransitionHookScope: Readonly<{
|
|
29
|
-
TRANSITION: 0;
|
|
30
|
-
STATE: 1;
|
|
31
|
-
}>;
|
|
16
|
+
export namespace TransitionHookScope {
|
|
17
|
+
let _TRANSITION: number;
|
|
18
|
+
let _STATE: number;
|
|
19
|
+
}
|
|
32
20
|
export class TransitionHook {
|
|
33
21
|
/**
|
|
34
22
|
* Chains together an array of TransitionHooks.
|
|
@@ -65,11 +53,20 @@ export class TransitionHook {
|
|
|
65
53
|
* Run all TransitionHooks, ignoring their return value.
|
|
66
54
|
*/
|
|
67
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
|
+
*/
|
|
68
64
|
constructor(
|
|
69
65
|
transition: any,
|
|
70
66
|
stateContext: any,
|
|
71
67
|
registeredHook: any,
|
|
72
68
|
options: any,
|
|
69
|
+
exceptionHandler: ng.ExceptionHandlerService,
|
|
73
70
|
);
|
|
74
71
|
transition: any;
|
|
75
72
|
stateContext: any;
|
|
@@ -77,6 +74,8 @@ export class TransitionHook {
|
|
|
77
74
|
options: any;
|
|
78
75
|
isSuperseded: () => boolean;
|
|
79
76
|
type: any;
|
|
77
|
+
/** @type {ng.ExceptionHandlerService} */
|
|
78
|
+
_exceptionHandler: ng.ExceptionHandlerService;
|
|
80
79
|
logError(err: any): void;
|
|
81
80
|
invokeHook(): any;
|
|
82
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,20 +16,20 @@ 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
|
-
|
|
31
|
+
_globals: import("../router.js").RouterProvider;
|
|
32
|
+
_transitionService: import("./transition-service.js").TransitionProvider;
|
|
33
33
|
_deferred: any;
|
|
34
34
|
/**
|
|
35
35
|
* This promise is resolved or rejected based on the outcome of the Transition.
|
|
@@ -77,7 +77,9 @@ export class Transition implements IHookRegistry {
|
|
|
77
77
|
*
|
|
78
78
|
* @returns The state declaration object for the Transition's ("from state").
|
|
79
79
|
*/
|
|
80
|
-
from():
|
|
80
|
+
from():
|
|
81
|
+
| import("../state/interface.ts").StateDeclaration
|
|
82
|
+
| import("../state/interface.ts").BuiltStateDeclaration;
|
|
81
83
|
/**
|
|
82
84
|
* Returns the "to state"
|
|
83
85
|
*
|
|
@@ -85,7 +87,9 @@ export class Transition implements IHookRegistry {
|
|
|
85
87
|
*
|
|
86
88
|
* @returns The state declaration object for the Transition's target state ("to state").
|
|
87
89
|
*/
|
|
88
|
-
to():
|
|
90
|
+
to():
|
|
91
|
+
| import("../state/interface.ts").StateDeclaration
|
|
92
|
+
| import("../state/interface.ts").BuiltStateDeclaration;
|
|
89
93
|
/**
|
|
90
94
|
* Gets the Target State
|
|
91
95
|
*
|
|
@@ -280,7 +284,7 @@ export class Transition implements IHookRegistry {
|
|
|
280
284
|
* @returns true if the Transition is ignored.
|
|
281
285
|
*/
|
|
282
286
|
ignored(): boolean;
|
|
283
|
-
_ignoredReason(): "
|
|
287
|
+
_ignoredReason(): "SameAsPending" | "SameAsCurrent";
|
|
284
288
|
/**
|
|
285
289
|
* Runs the transition
|
|
286
290
|
*
|
|
@@ -326,5 +330,5 @@ export class Transition implements IHookRegistry {
|
|
|
326
330
|
export namespace Transition {
|
|
327
331
|
export { Transition as diToken };
|
|
328
332
|
}
|
|
329
|
-
export type
|
|
333
|
+
export type HookRegistry = import("./interface.ts").HookRegistry;
|
|
330
334
|
import { HookBuilder } from "./hook-builder.js";
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
export class UrlRuleFactory {
|
|
2
2
|
/**
|
|
3
|
-
* @param {
|
|
4
|
-
* @param {
|
|
5
|
-
* @param {
|
|
3
|
+
* @param {ng.UrlService} urlService
|
|
4
|
+
* @param {ng.StateService} stateService
|
|
5
|
+
* @param {ng.RouterService} routerGlobals
|
|
6
6
|
*/
|
|
7
7
|
constructor(
|
|
8
|
-
urlService:
|
|
9
|
-
stateService:
|
|
10
|
-
routerGlobals:
|
|
8
|
+
urlService: ng.UrlService,
|
|
9
|
+
stateService: ng.StateService,
|
|
10
|
+
routerGlobals: ng.RouterService,
|
|
11
11
|
);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/** @type {ng.UrlService} */
|
|
13
|
+
urlService: ng.UrlService;
|
|
14
|
+
/** @type {ng.StateService} */
|
|
15
|
+
stateService: ng.StateService;
|
|
16
|
+
/** @type {ng.RouterService} */
|
|
17
|
+
routerGlobals: ng.RouterService;
|
|
15
18
|
/**
|
|
16
19
|
*
|
|
17
20
|
* @param {*} what
|