@angular-wave/angular.ts 0.18.0 → 0.19.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.
Files changed (107) hide show
  1. package/@types/angular.d.ts +18 -6
  2. package/@types/animations/animate-css-driver.d.ts +2 -2
  3. package/@types/animations/animate-js-driver.d.ts +11 -1
  4. package/@types/animations/animate-js.d.ts +10 -2
  5. package/@types/animations/animate-swap.d.ts +4 -1
  6. package/@types/animations/animate.d.ts +11 -5
  7. package/@types/animations/animation.d.ts +7 -0
  8. package/@types/animations/css/animate-css.d.ts +16 -0
  9. package/@types/animations/interface.d.ts +308 -19
  10. package/@types/animations/queue/animate-queue.d.ts +16 -7
  11. package/@types/animations/queue/interface.d.ts +14 -7
  12. package/@types/core/compile/attributes.d.ts +1 -1
  13. package/@types/core/compile/compile.d.ts +25 -15
  14. package/@types/core/compile/interface.d.ts +209 -34
  15. package/@types/core/controller/controller.d.ts +30 -38
  16. package/@types/core/controller/interface.d.ts +12 -3
  17. package/@types/core/parse/interface.d.ts +2 -2
  18. package/@types/core/parse/interpreter.d.ts +110 -58
  19. package/@types/core/scope/interface.d.ts +6 -0
  20. package/@types/core/scope/scope.d.ts +2 -1
  21. package/@types/directive/aria/aria.d.ts +66 -26
  22. package/@types/directive/aria/interface.d.ts +9 -0
  23. package/@types/directive/class/class.d.ts +31 -0
  24. package/@types/directive/form/form.d.ts +54 -18
  25. package/@types/directive/input/input.d.ts +59 -18
  26. package/@types/directive/input/interface.d.ts +10 -0
  27. package/@types/directive/messages/messages.d.ts +63 -12
  28. package/@types/directive/model/interface.d.ts +19 -0
  29. package/@types/directive/model/model.d.ts +70 -33
  30. package/@types/directive/model-options/model-options.d.ts +1 -23
  31. package/@types/directive/repeat/repeat.d.ts +2 -3
  32. package/@types/directive/validators/validators.d.ts +1 -5
  33. package/@types/directive/worker/interface.d.ts +9 -0
  34. package/@types/docs.d.ts +24 -0
  35. package/@types/filters/json.d.ts +4 -0
  36. package/@types/interface.d.ts +22 -69
  37. package/@types/namespace.d.ts +66 -40
  38. package/@types/router/common/trace.d.ts +150 -42
  39. package/@types/router/directives/state-directives.d.ts +4 -4
  40. package/@types/router/directives/view-directive.d.ts +2 -5
  41. package/@types/router/hooks/core-resolvables.d.ts +11 -2
  42. package/@types/router/hooks/ignored-transition.d.ts +3 -1
  43. package/@types/router/hooks/invalid-transition.d.ts +3 -1
  44. package/@types/router/hooks/lazy-load.d.ts +17 -13
  45. package/@types/router/hooks/on-enter-exit-retain.d.ts +9 -3
  46. package/@types/router/hooks/redirect-to.d.ts +3 -3
  47. package/@types/router/hooks/resolve.d.ts +11 -3
  48. package/@types/router/hooks/views.d.ts +6 -4
  49. package/@types/router/params/interface.d.ts +3 -2
  50. package/@types/router/params/param-factory.d.ts +24 -3
  51. package/@types/router/params/param-type.d.ts +47 -11
  52. package/@types/router/params/param-types.d.ts +52 -0
  53. package/@types/router/params/param.d.ts +52 -28
  54. package/@types/router/params/state-params.d.ts +5 -3
  55. package/@types/router/path/interface.d.ts +3 -0
  56. package/@types/router/path/path-node.d.ts +34 -14
  57. package/@types/router/path/path-utils.d.ts +75 -25
  58. package/@types/router/resolve/resolvable.d.ts +34 -7
  59. package/@types/router/resolve/resolve-context.d.ts +52 -34
  60. package/@types/router/router.d.ts +10 -12
  61. package/@types/router/state/interface.d.ts +194 -31
  62. package/@types/router/state/state-builder.d.ts +29 -29
  63. package/@types/router/state/state-matcher.d.ts +29 -11
  64. package/@types/router/state/state-object.d.ts +67 -21
  65. package/@types/router/state/state-queue-manager.d.ts +19 -10
  66. package/@types/router/state/state-registry.d.ts +80 -28
  67. package/@types/router/state/state-service.d.ts +182 -123
  68. package/@types/router/state/target-state.d.ts +36 -27
  69. package/@types/router/state/views.d.ts +48 -19
  70. package/@types/router/template-factory.d.ts +8 -15
  71. package/@types/router/transition/hook-builder.d.ts +17 -6
  72. package/@types/router/transition/hook-registry.d.ts +80 -46
  73. package/@types/router/transition/interface.d.ts +138 -118
  74. package/@types/router/transition/reject-factory.d.ts +58 -22
  75. package/@types/router/transition/transition-event-type.d.ts +19 -8
  76. package/@types/router/transition/transition-hook.d.ts +50 -29
  77. package/@types/router/transition/transition-service.d.ts +186 -30
  78. package/@types/router/transition/transition.d.ts +201 -70
  79. package/@types/router/url/interface.d.ts +140 -0
  80. package/@types/router/url/url-config.d.ts +19 -16
  81. package/@types/router/url/url-matcher.d.ts +66 -46
  82. package/@types/router/url/url-rule.d.ts +58 -35
  83. package/@types/router/url/url-rules.d.ts +38 -28
  84. package/@types/router/url/url-service.d.ts +68 -41
  85. package/@types/router/view/interface.d.ts +10 -30
  86. package/@types/router/view/view.d.ts +35 -21
  87. package/@types/services/anchor-scroll/interface.d.ts +1 -1
  88. package/@types/services/http/http.d.ts +19 -22
  89. package/@types/services/http/interface.d.ts +11 -23
  90. package/@types/services/location/interface.d.ts +1 -4
  91. package/@types/services/location/location.d.ts +13 -13
  92. package/@types/services/sce/sce.d.ts +14 -8
  93. package/@types/services/template-request/template-request.d.ts +21 -4
  94. package/@types/shared/common.d.ts +5 -32
  95. package/@types/shared/dom.d.ts +10 -5
  96. package/@types/shared/interface.d.ts +4 -0
  97. package/@types/shared/utils.d.ts +17 -6
  98. package/dist/angular-ts.esm.js +6424 -2850
  99. package/dist/angular-ts.umd.js +6424 -2850
  100. package/dist/angular-ts.umd.min.js +1 -1
  101. package/dist/angular-ts.umd.min.js.gz +0 -0
  102. package/dist/angular-ts.umd.min.js.map +1 -1
  103. package/package.json +1 -2
  104. package/@types/animations/animate-css.d.ts +0 -11
  105. package/@types/filters/filters.d.ts +0 -38
  106. package/@types/router/hooks/update-globals.d.ts +0 -1
  107. package/@types/router/hooks/url.d.ts +0 -5
@@ -1,10 +1,13 @@
1
- import { StateDeclaration } from "../state/interface.ts";
1
+ import { BuiltStateDeclaration, StateDeclaration } from "../state/interface.ts";
2
2
  import { PredicateBinary } from "../../shared/interface.ts";
3
3
  import { Transition } from "./transition.js";
4
4
  import { StateObject } from "../state/state-object.js";
5
5
  import { PathNode } from "../path/path-node.js";
6
6
  import { TargetState } from "../state/target-state.js";
7
7
  import { RegisteredHook } from "./hook-registry.js";
8
+ import { TransitionHook } from "./transition-hook.js";
9
+ /** Deregistration function returned by hook registrations */
10
+ export type DeregisterFn = () => void;
8
11
  /**
9
12
  * The TransitionOptions object can be used to change the behavior of a transition.
10
13
  *
@@ -65,7 +68,7 @@ export interface TransitionOptions {
65
68
  /**
66
69
  * You can define your own Transition Options inside this property and use them, e.g., from a Transition Hook
67
70
  */
68
- custom?: any;
71
+ custom?: unknown;
69
72
  /**
70
73
  * This option may be used to cancel the active transition (if one is active) in favour of the this one.
71
74
  * This is the default behaviour or ui-router.
@@ -80,12 +83,15 @@ export interface TransitionOptions {
80
83
  supercede?: boolean;
81
84
  }
82
85
  export interface TransitionHookOptions {
83
- current?: () => Transition;
84
- transition?: Transition;
86
+ current: () => Transition | void;
87
+ transition?: Transition | null;
85
88
  hookType?: string;
86
- target?: any;
87
- traceData?: any;
88
- bind?: any;
89
+ target?: unknown;
90
+ traceData?: {
91
+ hookType?: string;
92
+ context?: any;
93
+ };
94
+ bind?: unknown;
89
95
  stateHook?: boolean;
90
96
  }
91
97
  /**
@@ -152,11 +158,6 @@ export interface TreeChanges {
152
158
  */
153
159
  entering: PathNode[];
154
160
  }
155
- export type IHookRegistration = (
156
- matchCriteria: HookMatchCriteria,
157
- callback: HookFn,
158
- options?: HookRegOptions,
159
- ) => Function;
160
161
  /**
161
162
  * The signature for Transition Hooks.
162
163
  *
@@ -175,7 +176,7 @@ export type IHookRegistration = (
175
176
  * - [[HookRegistry.onError]]
176
177
  *
177
178
  * @param transition the current [[Transition]]
178
- * @param injector (for ng1 or ng2 only) the injector service
179
+ * @param injector the injector service
179
180
  *
180
181
  * @returns a [[HookResult]] which may alter the transition
181
182
  *
@@ -223,7 +224,7 @@ export interface TransitionHookFn {
223
224
  * @returns an optional [[HookResult]] which may alter the transition
224
225
  */
225
226
  export interface TransitionStateHookFn {
226
- (...injectables: any[]): HookResult;
227
+ (transition: Transition, state: StateDeclaration): HookResult;
227
228
  }
228
229
  /**
229
230
  * The signature for Transition onCreate Hooks.
@@ -267,7 +268,7 @@ export interface HookRegOptions {
267
268
  * Sets the priority of the registered hook
268
269
  *
269
270
  * Hooks of the same type (onBefore, onStart, etc) are invoked in priority order. A hook with a higher priority
270
- * is invoked before a hook with a lower priority.
271
+ * is invoked before the hook with a lower priority.
271
272
  *
272
273
  * The default hook priority is 0
273
274
  */
@@ -275,13 +276,110 @@ export interface HookRegOptions {
275
276
  /**
276
277
  * Specifies what `this` is bound to during hook invocation.
277
278
  */
278
- bind?: any;
279
+ bind?: unknown;
279
280
  /**
280
281
  * Limits the number of times that the hook will be invoked.
281
282
  * Once the hook has been invoked this many times, it is automatically deregistered.
282
283
  */
283
284
  invokeLimit?: number;
284
285
  }
286
+ /** A predicate type which tests if a [[StateObject]] and [[Transition]] passes some test. Returns a boolean. */
287
+ export type IStateMatch = PredicateBinary<BuiltStateDeclaration, Transition>;
288
+ /**
289
+ * Hook Criterion used to match a transition.
290
+ *
291
+ * A [[Glob]] string that matches the name of a state.
292
+ *
293
+ * Or, a function with the signature `function(state, transition) { return matches; }`
294
+ * which should return a boolean to indicate if a state matches.
295
+ *
296
+ * Or, `true` to always match
297
+ */
298
+ export type HookMatchCriterion = string | IStateMatch | boolean;
299
+ /**
300
+ * This object is used to configure whether or not a Transition Hook is invoked for a particular transition,
301
+ * based on the Transition's "to state" and "from state".
302
+ *
303
+ * Each property (`to`, `from`, `exiting`, `retained`, and `entering`) can be a state [[Glob]] string,
304
+ * a boolean, or a function that takes a state and returns a boolean (see [[HookMatchCriterion]])
305
+ *
306
+ * All properties are optional. If any property is omitted, it is replaced with the value `true`, and always matches.
307
+ * To match any transition, use an empty criteria object `{}`.
308
+ *
309
+ * #### Example:
310
+ * ```js
311
+ * // This matches a transition coming from the `parent` state and going to the `parent.child` state.
312
+ * var match = {
313
+ * to: 'parent',
314
+ * from: 'parent.child'
315
+ * }
316
+ * ```
317
+ *
318
+ * #### Example:
319
+ * ```js
320
+ * // This matches a transition coming from any substate of `parent` and going directly to the `parent` state.
321
+ * var match = {
322
+ * to: 'parent',
323
+ * from: 'parent.**'
324
+ * }
325
+ * ```
326
+ *
327
+ * #### Example:
328
+ * ```js
329
+ * // This matches a transition coming from any state and going to any substate of `mymodule`
330
+ * var match = {
331
+ * to: 'mymodule.**'
332
+ * }
333
+ * ```
334
+ *
335
+ * #### Example:
336
+ * ```js
337
+ * // This matches a transition coming from any state and going to any state that has `data.authRequired`
338
+ * // set to a truthy value.
339
+ * var match = {
340
+ * to: function(state) {
341
+ * return state.data != null && state.data.authRequired === true;
342
+ * }
343
+ * }
344
+ * ```
345
+ * #### Example:
346
+ * ```js
347
+ * // This will match when route is just entered (initial load) or when the state is hard-refreshed
348
+ * // by specifying `{refresh: true}` as transition options.
349
+ * var match = {
350
+ * from: (state, transition) => state.self.name === '' || transition.options().reload
351
+ * }
352
+ * ```
353
+ *
354
+ * #### Example:
355
+ * ```js
356
+ * // This matches a transition that is exiting `parent.child`
357
+ * var match = {
358
+ * exiting: 'parent.child'
359
+ * }
360
+ * ```
361
+ */
362
+ export interface HookMatchCriteria {
363
+ [key: string]: HookMatchCriterion | undefined;
364
+ /** A [[HookMatchCriterion]] to match the destination state */
365
+ to?: HookMatchCriterion;
366
+ /** A [[HookMatchCriterion]] to match the original (from) state */
367
+ from?: HookMatchCriterion;
368
+ /** A [[HookMatchCriterion]] to match any state that would be exiting */
369
+ exiting?: HookMatchCriterion;
370
+ /** A [[HookMatchCriterion]] to match any state that would be retained */
371
+ retained?: HookMatchCriterion;
372
+ /** A [[HookMatchCriterion]] to match any state that would be entering */
373
+ entering?: HookMatchCriterion;
374
+ }
375
+ export interface IMatchingNodes {
376
+ [key: string]: PathNode[];
377
+ to: PathNode[];
378
+ from: PathNode[];
379
+ exiting: PathNode[];
380
+ retained: PathNode[];
381
+ entering: PathNode[];
382
+ }
285
383
  /**
286
384
  * This interface specifies the api for registering Transition Hooks. Both the
287
385
  * [[TransitionService]] and also the [[Transition]] object itself implement this interface.
@@ -329,7 +427,6 @@ export interface HookRegistry {
329
427
  *
330
428
  * @example
331
429
  * ```js
332
- * // ng2
333
430
  * transitionService.onBefore({ to: 'home' }, (trans: Transition) =>
334
431
  * trans.router.stateService.target("home.dashboard"));
335
432
  * ```
@@ -346,7 +443,7 @@ export interface HookRegistry {
346
443
  * // state declaration
347
444
  * {
348
445
  * name: 'home',
349
- * template: '<div ui-view/>',
446
+ * template: '<div ng-view/>',
350
447
  * defaultSubstate: 'home.dashboard'
351
448
  * }
352
449
  *
@@ -388,7 +485,7 @@ export interface HookRegistry {
388
485
  matchCriteria: HookMatchCriteria,
389
486
  callback: TransitionHookFn,
390
487
  options?: HookRegOptions,
391
- ): Function;
488
+ ): DeregisterFn;
392
489
  /**
393
490
  * Registers a [[TransitionHookFn]], called when a transition starts.
394
491
  *
@@ -460,7 +557,7 @@ export interface HookRegistry {
460
557
  matchCriteria: HookMatchCriteria,
461
558
  callback: TransitionHookFn,
462
559
  options?: HookRegOptions,
463
- ): Function;
560
+ ): DeregisterFn;
464
561
  /**
465
562
  * Registers a [[TransitionStateHookFn]], called when a specific state is entered.
466
563
  *
@@ -535,7 +632,7 @@ export interface HookRegistry {
535
632
  matchCriteria: HookMatchCriteria,
536
633
  callback: TransitionStateHookFn,
537
634
  options?: HookRegOptions,
538
- ): Function;
635
+ ): DeregisterFn;
539
636
  /**
540
637
  * Registers a [[TransitionStateHookFn]], called when a specific state is retained/kept.
541
638
  *
@@ -576,7 +673,7 @@ export interface HookRegistry {
576
673
  matchCriteria: HookMatchCriteria,
577
674
  callback: TransitionStateHookFn,
578
675
  options?: HookRegOptions,
579
- ): Function;
676
+ ): DeregisterFn;
580
677
  /**
581
678
  * Registers a [[TransitionStateHookFn]], called when a specific state is exited.
582
679
  *
@@ -619,7 +716,7 @@ export interface HookRegistry {
619
716
  matchCriteria: HookMatchCriteria,
620
717
  callback: TransitionStateHookFn,
621
718
  options?: HookRegOptions,
622
- ): Function;
719
+ ): DeregisterFn;
623
720
  /**
624
721
  * Registers a [[TransitionHookFn]], called *just before a transition finishes*.
625
722
  *
@@ -650,7 +747,7 @@ export interface HookRegistry {
650
747
  matchCriteria: HookMatchCriteria,
651
748
  callback: TransitionHookFn,
652
749
  options?: HookRegOptions,
653
- ): Function;
750
+ ): DeregisterFn;
654
751
  /**
655
752
  * Registers a [[TransitionHookFn]], called after a successful transition completed.
656
753
  *
@@ -680,7 +777,7 @@ export interface HookRegistry {
680
777
  matchCriteria: HookMatchCriteria,
681
778
  callback: TransitionHookFn,
682
779
  options?: HookRegOptions,
683
- ): Function;
780
+ ): DeregisterFn;
684
781
  /**
685
782
  * Registers a [[TransitionHookFn]], called after a transition has errored.
686
783
  *
@@ -726,7 +823,7 @@ export interface HookRegistry {
726
823
  matchCriteria: HookMatchCriteria,
727
824
  callback: TransitionHookFn,
728
825
  options?: HookRegOptions,
729
- ): Function;
826
+ ): DeregisterFn;
730
827
  /**
731
828
  * Returns all the registered hooks of a given `hookName` type
732
829
  *
@@ -737,100 +834,23 @@ export interface HookRegistry {
737
834
  */
738
835
  getHooks(hookName: string): RegisteredHook[];
739
836
  }
740
- /** A predicate type which tests if a [[StateObject]] and [[Transition]] passes some test. Returns a boolean. */
741
- export type IStateMatch = PredicateBinary<StateObject, Transition>;
742
837
  /**
743
- * This object is used to configure whether or not a Transition Hook is invoked for a particular transition,
744
- * based on the Transition's "to state" and "from state".
745
- *
746
- * Each property (`to`, `from`, `exiting`, `retained`, and `entering`) can be a state [[Glob]] string,
747
- * a boolean, or a function that takes a state and returns a boolean (see [[HookMatchCriterion]])
748
- *
749
- * All properties are optional. If any property is omitted, it is replaced with the value `true`, and always matches.
750
- * To match any transition, use an empty criteria object `{}`.
751
- *
752
- * #### Example:
753
- * ```js
754
- * // This matches a transition coming from the `parent` state and going to the `parent.child` state.
755
- * var match = {
756
- * to: 'parent',
757
- * from: 'parent.child'
758
- * }
759
- * ```
760
- *
761
- * #### Example:
762
- * ```js
763
- * // This matches a transition coming from any substate of `parent` and going directly to the `parent` state.
764
- * var match = {
765
- * to: 'parent',
766
- * from: 'parent.**'
767
- * }
768
- * ```
769
- *
770
- * #### Example:
771
- * ```js
772
- * // This matches a transition coming from any state and going to any substate of `mymodule`
773
- * var match = {
774
- * to: 'mymodule.**'
775
- * }
776
- * ```
777
- *
778
- * #### Example:
779
- * ```js
780
- * // This matches a transition coming from any state and going to any state that has `data.authRequired`
781
- * // set to a truthy value.
782
- * var match = {
783
- * to: function(state) {
784
- * return state.data != null && state.data.authRequired === true;
785
- * }
786
- * }
787
- * ```
788
- * #### Example:
789
- * ```js
790
- * // This will match when route is just entered (initial load) or when the state is hard-refreshed
791
- * // by specifying `{refresh: true}` as transition options.
792
- * var match = {
793
- * from: (state, transition) => state.self.name === '' || transition.options().reload
794
- * }
795
- * ```
838
+ * TODO: unite with TransitionProvider
839
+ * The runtime service instance returned from `TransitionProvider.$get`.
796
840
  *
797
- * #### Example:
798
- * ```js
799
- * // This matches a transition that is exiting `parent.child`
800
- * var match = {
801
- * exiting: 'parent.child'
802
- * }
803
- * ```
841
+ * Note: In this codebase, `$get` returns the provider instance (`return this;`),
842
+ * so the "service" surface includes both the public HookRegistry API and
843
+ * a set of internal fields/methods used by built-in hook registrations/plugins.
804
844
  */
805
- export interface HookMatchCriteria {
806
- [key: string]: HookMatchCriterion | undefined;
807
- /** A [[HookMatchCriterion]] to match the destination state */
808
- to?: HookMatchCriterion;
809
- /** A [[HookMatchCriterion]] to match the original (from) state */
810
- from?: HookMatchCriterion;
811
- /** A [[HookMatchCriterion]] to match any state that would be exiting */
812
- exiting?: HookMatchCriterion;
813
- /** A [[HookMatchCriterion]] to match any state that would be retained */
814
- retained?: HookMatchCriterion;
815
- /** A [[HookMatchCriterion]] to match any state that would be entering */
816
- entering?: HookMatchCriterion;
845
+ export interface TransitionService extends HookRegistry {
846
+ /**
847
+ * Internal factory used by StateService.
848
+ */
849
+ create(fromPath: PathNode[], targetState: TargetState): Transition;
850
+ _exceptionHandler: ng.ExceptionHandlerService;
817
851
  }
818
- export interface IMatchingNodes {
819
- [key: string]: PathNode[];
820
- to: PathNode[];
821
- from: PathNode[];
822
- exiting: PathNode[];
823
- retained: PathNode[];
824
- entering: PathNode[];
852
+ export interface HookTuple {
853
+ hook: RegisteredHook;
854
+ node: PathNode;
855
+ transitionHook: TransitionHook;
825
856
  }
826
- /**
827
- * Hook Criterion used to match a transition.
828
- *
829
- * A [[Glob]] string that matches the name of a state.
830
- *
831
- * Or, a function with the signature `function(state, transition) { return matches; }`
832
- * which should return a boolean to indicate if a state matches.
833
- *
834
- * Or, `true` to always match
835
- */
836
- export type HookMatchCriterion = string | IStateMatch | boolean;
@@ -10,29 +10,56 @@ export namespace RejectType {
10
10
  let _ERROR: number;
11
11
  }
12
12
  export class Rejection {
13
- /** Returns a Rejection due to transition superseded */
14
- static superseded(detail: any, options: any): Rejection;
15
- /** Returns a Rejection due to redirected transition
16
- * @param {any} detail @returns {Rejection}
13
+ /**
14
+ * Returns a Rejection due to transition superseded
15
+ *
16
+ * @param {any} [detail]
17
+ * @param {{ redirected?: boolean } | undefined} [options]
18
+ * @returns {Rejection}
17
19
  */
18
- static redirected(detail: any): Rejection;
19
- /** Returns a Rejection due to invalid transition
20
- * @param {any} detail @returns {Rejection}
20
+ static superseded(
21
+ detail?: any,
22
+ options?:
23
+ | {
24
+ redirected?: boolean;
25
+ }
26
+ | undefined,
27
+ ): Rejection;
28
+ /**
29
+ * Returns a Rejection due to redirected transition
30
+ *
31
+ * @param {any} [detail]
32
+ * @returns {Rejection}
33
+ */
34
+ static redirected(detail?: any): Rejection;
35
+ /**
36
+ * Returns a Rejection due to invalid transition
37
+ *
38
+ * @param {any} detail
39
+ * @returns {Rejection}
21
40
  */
22
41
  static invalid(detail: any): Rejection;
23
- /** Returns a Rejection due to ignored transition
24
- * @param {any} detail @returns {Rejection}
42
+ /**
43
+ * Returns a Rejection due to ignored transition
44
+ *
45
+ * @param {any} [detail]
46
+ * @returns {Rejection}
25
47
  */
26
- static ignored(detail: any): Rejection;
27
- /** Returns a Rejection due to aborted transition
28
- * @param {any} detail @returns {Rejection}
48
+ static ignored(detail?: any): Rejection;
49
+ /**
50
+ * Returns a Rejection due to aborted transition
51
+ *
52
+ * @param {any} [detail]
53
+ * @returns {Rejection}
29
54
  */
30
- static aborted(detail: any): Rejection;
31
- /** Returns a Rejection due to aborted transition
32
- * @param detail
55
+ static aborted(detail?: any): Rejection;
56
+ /**
57
+ * Returns a Rejection due to errored transition
58
+ *
59
+ * @param {any} [detail]
33
60
  * @returns {Rejection}
34
61
  */
35
- static errored(detail: any): Rejection;
62
+ static errored(detail?: any): Rejection;
36
63
  /**
37
64
  * Returns a Rejection
38
65
  *
@@ -40,25 +67,34 @@ export class Rejection {
40
67
  * If the value is already a Rejection, returns it.
41
68
  * Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR).
42
69
  *
43
- * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection.
70
+ * @param {any} detail
71
+ * @returns {Rejection} `detail` if it is already a `Rejection`, else returns an ERROR Rejection.
44
72
  */
45
- static normalize(detail: any): any;
73
+ static normalize(detail: any): Rejection;
46
74
  /**
47
75
  * @param {number} type
48
76
  * @param {string} message
49
- * @param {any} detail
77
+ * @param {any} [detail]
50
78
  */
51
- constructor(type: number, message: string, detail: any);
79
+ constructor(type: number, message: string, detail?: any);
52
80
  /** @type {number} */
53
81
  $id: number;
82
+ /** @type {number} */
54
83
  type: number;
84
+ /** @type {string} */
55
85
  message: string;
86
+ /** @type {any} */
56
87
  detail: any;
88
+ /** @type {boolean} */
57
89
  redirected: boolean;
58
- /** @returns {string} */
90
+ /**
91
+ * @returns {string}
92
+ */
59
93
  toString(): string;
60
94
  /**
61
- * @returns {Promise<any> & {_transitionRejection: Rejection}}
95
+ * Returns a rejected Promise annotated with `_transitionRejection` for identification.
96
+ *
97
+ * @returns {Promise<any> & { _transitionRejection: Rejection }}
62
98
  */
63
99
  toPromise(): Promise<any> & {
64
100
  _transitionRejection: Rejection;
@@ -3,22 +3,33 @@
3
3
  * Plugins can define custom hook types, such as sticky states does for `onInactive`.
4
4
  */
5
5
  export class TransitionEventType {
6
+ /**
7
+ * @param {string} name
8
+ * @param {number} hookPhase
9
+ * @param {number} hookOrder
10
+ * @param {any} criteriaMatchPath
11
+ */
6
12
  constructor(
7
- name: any,
8
- hookPhase: any,
9
- hookOrder: any,
13
+ name: string,
14
+ hookPhase: number,
15
+ hookOrder: number,
10
16
  criteriaMatchPath: any,
11
17
  reverseSort?: boolean,
12
- getResultHandler?: (hook: any) => (result: any) => any,
18
+ getResultHandler?: (
19
+ hook: TransitionHook,
20
+ ) => (result: import("./transition-hook.js").HookResult) => Promise<any>,
13
21
  getErrorHandler?: () => (error: any) => Promise<never>,
14
22
  synchronous?: boolean,
15
23
  );
16
- name: any;
17
- hookPhase: any;
18
- hookOrder: any;
24
+ name: string;
25
+ hookPhase: number;
26
+ hookOrder: number;
19
27
  criteriaMatchPath: any;
20
28
  reverseSort: boolean;
21
- getResultHandler: (hook: any) => (result: any) => any;
29
+ getResultHandler: (
30
+ hook: TransitionHook,
31
+ ) => (result: import("./transition-hook.js").HookResult) => Promise<any>;
22
32
  getErrorHandler: () => (error: any) => Promise<never>;
23
33
  synchronous: boolean;
24
34
  }
35
+ import { TransitionHook } from "./transition-hook.js";
@@ -32,52 +32,60 @@ export class TransitionHook {
32
32
  * promise.then(handleSuccess, handleError);
33
33
  * ```
34
34
  *
35
- * @param hooks the list of hooks to chain together
36
- * @param waitFor if provided, the chain is `.then()`'ed off this promise
35
+ * @param {TransitionHook[]} hooks the list of hooks to chain together
36
+ * @param {Promise<any>} [waitFor] if provided, the chain is `.then()`'ed off this promise
37
37
  * @returns a `Promise` for sequentially invoking the hooks (in order)
38
38
  */
39
- static chain(hooks: any, waitFor: any): any;
39
+ static chain(hooks: TransitionHook[], waitFor?: Promise<any>): Promise<any>;
40
40
  /**
41
41
  * Invokes all the provided TransitionHooks, in order.
42
42
  * Each hook's return value is checked.
43
43
  * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned.
44
44
  * If no hook returns a promise, then all hooks are processed synchronously.
45
45
  *
46
- * @param hooks the list of TransitionHooks to invoke
47
- * @param doneCallback a callback that is invoked after all the hooks have successfully completed
46
+ * @param {TransitionHook[]} hooks the list of TransitionHooks to invoke
47
+ * @param {() => Promise<any>} doneCallback a callback that is invoked after all the hooks have successfully completed
48
48
  *
49
- * @returns a promise for the async result, or the result of the callback
49
+ * @returns {Promise<any>} a promise for the async result, or the result of the callback
50
50
  */
51
- static invokeHooks(hooks: any, doneCallback: any): any;
51
+ static invokeHooks(
52
+ hooks: TransitionHook[],
53
+ doneCallback: () => Promise<any>,
54
+ ): Promise<any>;
52
55
  /**
53
56
  * Run all TransitionHooks, ignoring their return value.
57
+ * @param {TransitionHook[]} hooks
54
58
  */
55
- static runAllHooks(hooks: any): void;
59
+ static runAllHooks(hooks: TransitionHook[]): void;
56
60
  /**
57
61
  *
58
- * @param {*} transition
59
- * @param {*} stateContext
60
- * @param {*} registeredHook
61
- * @param {*} options
62
+ * @param {Transition} transition
63
+ * @param {import("../state/interface.ts").StateDeclaration | null} stateContext
64
+ * @param {RegisteredHook} registeredHook
65
+ * @param {TransitionHookOptions} options
62
66
  * @param {ng.ExceptionHandlerService} exceptionHandler
63
67
  */
64
68
  constructor(
65
- transition: any,
66
- stateContext: any,
67
- registeredHook: any,
68
- options: any,
69
+ transition: Transition,
70
+ stateContext: import("../state/interface.ts").StateDeclaration | null,
71
+ registeredHook: RegisteredHook,
72
+ options: TransitionHookOptions,
69
73
  exceptionHandler: ng.ExceptionHandlerService,
70
74
  );
71
- transition: any;
72
- stateContext: any;
73
- registeredHook: any;
74
- options: any;
75
+ transition: import("./transition.js").Transition;
76
+ stateContext: import("../state/interface.ts").StateDeclaration;
77
+ registeredHook: import("./hook-registry.js").RegisteredHook;
78
+ /** @type {TransitionHookOptions} */
79
+ options: TransitionHookOptions;
80
+ type: import("./transition-event-type.js").TransitionEventType;
75
81
  isSuperseded: () => boolean;
76
- type: any;
77
82
  /** @type {ng.ExceptionHandlerService} */
78
83
  _exceptionHandler: ng.ExceptionHandlerService;
79
- logError(err: any): void;
80
- invokeHook(): any;
84
+ /**
85
+ * @param {unknown} err
86
+ */
87
+ logError(err: unknown): void;
88
+ invokeHook(): Promise<any>;
81
89
  /**
82
90
  * This method handles the return value of a Transition Hook.
83
91
  *
@@ -86,8 +94,10 @@ export class TransitionHook {
86
94
  *
87
95
  * This also handles "transition superseded" -- when a new transition
88
96
  * was started while the hook was still running
97
+ * @param {HookResult} result
98
+ * @returns {Promise<any> | undefined}
89
99
  */
90
- handleHookResult(result: any): any;
100
+ handleHookResult(result: HookResult): Promise<any> | undefined;
91
101
  /**
92
102
  * Return a Rejection promise if the transition is no longer current due
93
103
  * a new transition has started and superseded this one.
@@ -102,18 +112,29 @@ export namespace TransitionHook {
102
112
  * These GetResultHandler(s) are used by [[invokeHook]] below
103
113
  * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]])
104
114
  */
105
- function HANDLE_RESULT(hook: any): (result: any) => any;
115
+ function HANDLE_RESULT(
116
+ hook: TransitionHook,
117
+ ): (/** @type {HookResult} */ result: HookResult) => Promise<any>;
106
118
  /**
107
119
  * If the result is a promise rejection, log it.
108
120
  * Otherwise, ignore the result.
109
121
  */
110
- function LOG_REJECTED_RESULT(hook: any): (result: any) => any;
122
+ function LOG_REJECTED_RESULT(hook: {
123
+ logError: (arg0: Rejection) => any;
124
+ }): (/** @type {HookResult} */ result: HookResult) => any;
111
125
  /**
112
126
  * These GetErrorHandler(s) are used by [[invokeHook]] below
113
127
  * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]])
114
128
  */
115
- function LOG_ERROR(hook: any): (error: any) => any;
116
- function REJECT_ERROR(): (error: any) => Promise<never>;
117
- function THROW_ERROR(): (error: any) => never;
129
+ function LOG_ERROR(hook?: {
130
+ logError: (arg0: any) => any;
131
+ }): (/** @type {any} */ error: any) => any;
132
+ function REJECT_ERROR(): (/** @type {any} */ error: any) => Promise<never>;
133
+ function THROW_ERROR(): (/** @type {any} */ error: any) => never;
118
134
  }
135
+ export type TransitionHookOptions =
136
+ import("./interface.ts").TransitionHookOptions;
137
+ export type HookResult = import("./interface.ts").HookResult;
138
+ export type Transition = import("./transition.js").Transition;
139
+ export type RegisteredHook = import("./hook-registry.js").RegisteredHook;
119
140
  import { Rejection } from "./reject-factory.js";