@angular-wave/angular.ts 0.14.3 → 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.
Files changed (69) hide show
  1. package/@types/angular.d.ts +26 -24
  2. package/@types/animations/animate-cache.d.ts +46 -2
  3. package/@types/animations/animate-children-directive.d.ts +4 -4
  4. package/@types/animations/animate-js.d.ts +1 -10
  5. package/@types/animations/animate.d.ts +6 -1
  6. package/@types/animations/interface.d.ts +15 -0
  7. package/@types/animations/runner/animate-runner.d.ts +73 -52
  8. package/@types/animations/shared.d.ts +0 -16
  9. package/@types/core/compile/attributes.d.ts +12 -6
  10. package/@types/core/compile/compile.d.ts +1 -1
  11. package/@types/core/controller/controller.d.ts +1 -1
  12. package/@types/core/interpolate/interface.d.ts +1 -0
  13. package/@types/core/parse/interface.d.ts +1 -1
  14. package/@types/core/parse/interpreter.d.ts +5 -3
  15. package/@types/core/scope/scope.d.ts +13 -13
  16. package/@types/directive/attrs/attrs.d.ts +2 -5
  17. package/@types/directive/class/class.d.ts +3 -3
  18. package/@types/directive/controller/controller.d.ts +2 -2
  19. package/@types/directive/form/form.d.ts +4 -4
  20. package/@types/directive/include/include.d.ts +4 -4
  21. package/@types/directive/messages/messages.d.ts +9 -8
  22. package/@types/directive/model/model.d.ts +5 -5
  23. package/@types/directive/ref/ref.d.ts +5 -8
  24. package/@types/directive/repeat/repeat.d.ts +2 -4
  25. package/@types/directive/script/script.d.ts +2 -2
  26. package/@types/directive/select/select.d.ts +7 -8
  27. package/@types/directive/validators/validators.d.ts +2 -2
  28. package/@types/injection-tokens.d.ts +3 -2
  29. package/@types/interface.d.ts +50 -22
  30. package/@types/namespace.d.ts +42 -6
  31. package/@types/router/directives/state-directives.d.ts +26 -24
  32. package/@types/router/directives/view-directive.d.ts +27 -131
  33. package/@types/router/glob/glob.d.ts +2 -6
  34. package/@types/router/router.d.ts +1 -1
  35. package/@types/router/scroll/interface.d.ts +3 -0
  36. package/@types/router/scroll/view-scroll.d.ts +8 -0
  37. package/@types/router/state/interface.d.ts +25 -126
  38. package/@types/router/state/state-builder.d.ts +4 -1
  39. package/@types/router/state/state-object.d.ts +2 -2
  40. package/@types/router/state/state-queue-manager.d.ts +4 -4
  41. package/@types/router/state/state-registry.d.ts +16 -11
  42. package/@types/router/state/state-service.d.ts +18 -12
  43. package/@types/router/template-factory.d.ts +2 -2
  44. package/@types/router/transition/interface.d.ts +9 -9
  45. package/@types/router/transition/transition-hook.d.ts +11 -0
  46. package/@types/router/transition/transition-service.d.ts +12 -5
  47. package/@types/router/transition/transition.d.ts +17 -13
  48. package/@types/router/url/url-rule.d.ts +12 -9
  49. package/@types/router/url/url-service.d.ts +14 -10
  50. package/@types/router/view/view.d.ts +4 -4
  51. package/@types/services/anchor-scroll/anchor-scroll.d.ts +2 -17
  52. package/@types/services/anchor-scroll/interface.d.ts +15 -0
  53. package/@types/services/cookie/cookie.d.ts +6 -4
  54. package/@types/services/exception/interface.d.ts +3 -3
  55. package/@types/services/log/log.d.ts +7 -3
  56. package/@types/services/pubsub/pubsub.d.ts +18 -13
  57. package/@types/services/rest/rest.d.ts +7 -5
  58. package/@types/services/sce/sce.d.ts +9 -1
  59. package/@types/shared/noderef.d.ts +3 -3
  60. package/@types/shared/strings.d.ts +18 -6
  61. package/@types/shared/utils.d.ts +88 -39
  62. package/@types/shared/validate.d.ts +13 -0
  63. package/dist/angular-ts.esm.js +1522 -1527
  64. package/dist/angular-ts.umd.js +1522 -1527
  65. package/dist/angular-ts.umd.min.js +1 -1
  66. package/dist/angular-ts.umd.min.js.gz +0 -0
  67. package/dist/angular-ts.umd.min.js.map +1 -1
  68. package/package.json +1 -1
  69. package/@types/router/view-scroll.d.ts +0 -12
@@ -0,0 +1,15 @@
1
+ export interface AnchorScrollObject {
2
+ /**
3
+ * Vertical scroll offset.
4
+ * Can be a number, a function returning a number,
5
+ * or an Element whose offsetTop will be used.
6
+ */
7
+ yOffset?: number | (() => number) | Element;
8
+ }
9
+ export type AnchorScrollFunction = (hash?: string) => void;
10
+ /**
11
+ * AngularJS $anchorScroll service
12
+ *
13
+ * Callable as a function and also exposes properties.
14
+ */
15
+ export type AnchorScrollService = AnchorScrollFunction | AnchorScrollObject;
@@ -3,7 +3,8 @@
3
3
  * @type {ng.ServiceProvider}
4
4
  */
5
5
  export class CookieProvider {
6
- defaults: {};
6
+ /** @type {ng.CookieOptions} */
7
+ defaults: ng.CookieOptions;
7
8
  $get: (
8
9
  | string
9
10
  | (($exceptionHandler: ng.ExceptionHandlerService) => CookieService)
@@ -26,9 +27,10 @@ export class CookieService {
26
27
  defaults: ng.CookieOptions,
27
28
  $exceptionHandler: ng.ExceptionHandlerService,
28
29
  );
29
- /** @type {ng.CookieOptions} */
30
- _defaults: ng.CookieOptions;
31
- _$exceptionHandler: import("../exception/interface.ts").ExceptionHandler;
30
+ /** @private @type {ng.CookieOptions} */
31
+ private _defaults;
32
+ /** @private @type {ng.ExceptionHandlerService} */
33
+ private _$exceptionHandler;
32
34
  /**
33
35
  * Retrieves a raw cookie value.
34
36
  *
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * A callback type for handling errors.
3
3
  *
4
- * @param {Error} exception - The exception associated with the error.
5
- * @throws {Error}
4
+ * @param {unknown} exception - The exception associated with the error.
5
+ * @throws {unknown}
6
6
  */
7
- export type ExceptionHandler = (exception: Error) => never;
7
+ export type ExceptionHandler = (exception: unknown) => never;
@@ -11,13 +11,17 @@ export class LogProvider {
11
11
  * @param {import("./interface.ts").LogServiceFactory} fn
12
12
  */
13
13
  setLogger(fn: import("./interface.ts").LogServiceFactory): void;
14
- /** @private */
15
- private formatError;
14
+ /**
15
+ * @private
16
+ * @param {unknown} arg
17
+ *
18
+ */
19
+ private _formatError;
16
20
  /**
17
21
  * @private
18
22
  * @param {string} type
19
23
  */
20
- private consoleLog;
24
+ private _consoleLog;
21
25
  /**
22
26
  * @returns {ng.LogService}
23
27
  */
@@ -1,23 +1,34 @@
1
- /** @typedef {import('../../interface.ts').ServiceProvider} ServiceProvider
2
-
3
1
  /**
4
2
  * Configurable provider for an injectable event bus
5
- * @extends {ServiceProvider}
3
+ * @implements {ng.ServiceProvider}
6
4
  */
7
- export class PubSubProvider {
5
+ export class PubSubProvider implements ng.ServiceProvider {
6
+ static $inject: string[];
7
+ /**
8
+ * @param {ng.ExceptionHandlerProvider} $exceptionHandler
9
+ * @param {ng.ServiceProvider} angularProvider
10
+ */
11
+ constructor(
12
+ $exceptionHandler: ng.ExceptionHandlerProvider,
13
+ angularProvider: ng.ServiceProvider,
14
+ );
8
15
  /**
9
16
  * @type {PubSub}
10
17
  */
11
18
  eventBus: PubSub;
12
- $get: any[];
19
+ $get: () => PubSub;
13
20
  }
14
21
  export class PubSub {
22
+ /**
23
+ * @param {ng.ExceptionHandlerService} $exceptionHandler
24
+ */
25
+ constructor($exceptionHandler: ng.ExceptionHandlerService);
15
26
  /** @private {Object<string, Array<{fn: Function, context: any}>>} */
16
27
  private _topics;
17
28
  /** @private */
18
29
  private _disposed;
19
- /** @type {ng.ExceptionHandlerService} */
20
- _$exceptionHandler: ng.ExceptionHandlerService;
30
+ /** @public @type {ng.ExceptionHandlerService} */
31
+ public $exceptionHandler: ng.ExceptionHandlerService;
21
32
  /**
22
33
  * Set instance to initial state
23
34
  */
@@ -72,9 +83,3 @@ export class PubSub {
72
83
  */
73
84
  publish(topic: string, ...args: any[]): boolean;
74
85
  }
75
- export const EventBus: PubSub;
76
- /**
77
- * /**
78
- * Configurable provider for an injectable event bus
79
- */
80
- export type ServiceProvider = import("../../interface.ts").ServiceProvider;
@@ -97,10 +97,12 @@ export class RestProvider {
97
97
  */
98
98
  $get: (
99
99
  | string
100
- | (($http: any) => {
101
- (baseUrl: any, entityClass: any, options?: {}): RestService<any, any>;
102
- get(name: any): any;
103
- listNames(): any[];
104
- })
100
+ | ((
101
+ $http: ng.HttpService,
102
+ ) => (
103
+ baseUrl: string,
104
+ entityClass?: ng.EntityClass<T>,
105
+ options?: object,
106
+ ) => RestService<T, ID>)
105
107
  )[];
106
108
  }
@@ -1,5 +1,13 @@
1
1
  export function escapeForRegexp(str: any): any;
2
- export function adjustMatcher(matcher: any): any;
2
+ /**
3
+ * Adjusts a matcher string or RegExp into a proper RegExp.
4
+ *
5
+ * @param {string | RegExp | "self"} matcher
6
+ * @returns {RegExp | "self"}
7
+ */
8
+ export function adjustMatcher(
9
+ matcher: string | RegExp | "self",
10
+ ): RegExp | "self";
3
11
  export function SceProvider(): void;
4
12
  export class SceProvider {
5
13
  /**
@@ -11,9 +11,9 @@ export class NodeRef {
11
11
  constructor(element: Node | Element | string | NodeList | Node[]);
12
12
  /** @private @type {Node | ChildNode | null} */
13
13
  private _node;
14
- /** @private @type {Element | undefined} */
15
- private _element;
16
- /** @private @type {Array<Node>} a stable list on nodes */
14
+ /** @type {Element | undefined} */
15
+ _element: Element | undefined;
16
+ /** @private @type {Array<Node> | undefined} a stable list on nodes */
17
17
  private _nodes;
18
18
  /** @type {boolean} */
19
19
  _isList: boolean;
@@ -15,13 +15,25 @@ export function maxLength(max: number, str: string): string;
15
15
  * If the string is already longer than the desired length, return the string.
16
16
  * Else returns the string, with extra spaces on the end, such that it reaches `length` characters.
17
17
  *
18
- * @param length the desired length of the string to return
19
- * @param str the input string
18
+ * @param {number} length the desired length of the string to return
19
+ * @param {string} str the input string
20
+ */
21
+ export function padString(length: number, str: string): string;
22
+ /**
23
+ * @param {string} camelCase
24
+ * @returns {string}
25
+ */
26
+ export function kebobString(camelCase: string): string;
27
+ /**
28
+ * @param {Function} fn
29
+ * @returns {string}
30
+ */
31
+ export function functionToString(fn: Function): string;
32
+ /**
33
+ * @param {[]|Function} fn
34
+ * @returns {string}
20
35
  */
21
- export function padString(length: any, str: any): any;
22
- export function kebobString(camelCase: any): any;
23
- export function functionToString(fn: any): any;
24
- export function fnToString(fn: any): any;
36
+ export function fnToString(fn: [] | Function): string;
25
37
  export function stringify(value: any): any;
26
38
  /**
27
39
  * Splits on a delimiter, but returns the delimiters in the array
@@ -1,9 +1,22 @@
1
1
  /**
2
+ * @param {any} value
3
+ * @returns {value is Proxy<ng.Scope> | ng.Scope}
4
+ */
5
+ export function isProxy(value: any): value is ProxyConstructor | ng.Scope;
6
+ /**
7
+ * Unwraps a proxy if the value is a proxy, otherwise returns the value as-is.
2
8
  *
3
- * @param {*} value
4
- * @returns {boolean}
9
+ * @template T
10
+ * @param {T | (T & { $target: T })} val - A value that might be a proxy.
11
+ * @returns {T} The unproxied value.
5
12
  */
6
- export function isProxy(value: any): boolean;
13
+ export function deProxy<T>(
14
+ val:
15
+ | T
16
+ | (T & {
17
+ $target: T;
18
+ }),
19
+ ): T;
7
20
  /**
8
21
  * @returns {number} an unique alpha-numeric string
9
22
  */
@@ -23,11 +36,11 @@ export function lowercase(string: string): string;
23
36
  */
24
37
  export function uppercase(string: string): string;
25
38
  /**
26
- * @param {*} obj Reference to check.
39
+ * @param {unknown} obj Reference to check.
27
40
  * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments,
28
41
  * String ...)
29
42
  */
30
- export function isArrayLike(obj: any): boolean;
43
+ export function isArrayLike(obj: unknown): boolean;
31
44
  /**
32
45
  * Determines if a reference is undefined.
33
46
  *
@@ -36,28 +49,38 @@ export function isArrayLike(obj: any): boolean;
36
49
  */
37
50
  export function isUndefined(value: any): boolean;
38
51
  /**
39
- * Determines if a reference is defined.
52
+ * Determines if a reference is defined (not `undefined`).
40
53
  *
41
- * @param {*} value Reference to check.
42
- * @returns {boolean} True if `value` is defined.
54
+ * @template T
55
+ * @param {T | undefined} value - Reference to check.
56
+ * @returns {value is T} True if `value` is defined.
43
57
  */
44
- export function isDefined(value: any): boolean;
58
+ export function isDefined<T>(value: T | undefined): value is T;
45
59
  /**
46
- * Wrapper for minification
47
- *
48
60
  * @template T
49
61
  * @param {any} array
50
62
  * @returns {array is T[]} true if array is an Array
51
63
  */
52
64
  export function isArray<T>(array: any): array is T[];
65
+ /**
66
+ * @template T
67
+ * @param {any} val
68
+ * @param {new (...args: any[]) => T} type The constructor to test against
69
+ * @returns {val is T}
70
+ */
71
+ export function isIntanceOf<T>(
72
+ val: any,
73
+ type: new (...args: any[]) => T,
74
+ ): val is T;
53
75
  /**
54
76
  * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not
55
77
  * considered to be objects. Note that JavaScript arrays are objects.
56
78
  *
57
- * @param {*} value Reference to check.
58
- * @returns {boolean} True if `value` is an `Object` but not `null`.
79
+ * @template T
80
+ * @param {T} value - Reference to check.
81
+ * @returns {value is T & object} True if `value` is an `Object` but not `null`.
59
82
  */
60
- export function isObject(value: any): boolean;
83
+ export function isObject<T>(value: T): value is T & object;
61
84
  /**
62
85
  * Determines if a value is an object with a null prototype
63
86
  *
@@ -65,21 +88,27 @@ export function isObject(value: any): boolean;
65
88
  * @returns {boolean} True if `value` is an `Object` with a null prototype
66
89
  */
67
90
  export function isBlankObject(value: any): boolean;
68
- export function isString(value: unknown): boolean;
91
+ /**
92
+ * Determines if a reference is a `string`.
93
+ *
94
+ * @param value - The value to check.
95
+ * @returns {value is string} True if `value` is a string.
96
+ */
97
+ export function isString(value: any): value is string;
69
98
  /**
70
99
  * Determines if a reference is a null.
71
100
  *
72
- * @param {*} value Reference to check.
73
- * @returns {boolean} True if `value` is a null.
101
+ * @param {unknown} value Reference to check.
102
+ * @returns {value is null} True if `value` is a null.
74
103
  */
75
- export function isNull(value: any): boolean;
104
+ export function isNull(value: unknown): value is null;
76
105
  /**
77
106
  * Determines if a reference is null or undefined.
78
107
  *
79
- * @param {*} obj Reference to check.
80
- * @returns {boolean} True if `value` is null or undefined.
108
+ * @param {unknown} obj Reference to check.
109
+ * @returns {obj is null | undefined} True if `value` is null or undefined.
81
110
  */
82
- export function isNullOrUndefined(obj: any): boolean;
111
+ export function isNullOrUndefined(obj: unknown): obj is null | undefined;
83
112
  /**
84
113
  * Determines if a reference is not null or undefined.
85
114
  *
@@ -96,10 +125,10 @@ export function notNullOrUndefined(obj: any): boolean;
96
125
  * [`isFinite'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite)
97
126
  * method.
98
127
  *
99
- * @param {*} value Reference to check.
100
- * @returns {boolean} True if `value` is a `Number`.
128
+ * @param {unknown} value Reference to check.
129
+ * @returns {value is number} True if `value` is a `Number`.
101
130
  */
102
- export function isNumber(value: any): boolean;
131
+ export function isNumber(value: unknown): value is number;
103
132
  /**
104
133
  *
105
134
  * Determines if a value is a date.
@@ -113,9 +142,9 @@ export function isDate(value: any): boolean;
113
142
  * Loosely based on https://www.npmjs.com/package/iserror
114
143
  *
115
144
  * @param {*} value Reference to check.
116
- * @returns {boolean} True if `value` is an `Error`.
145
+ * @returns {value is Error} True if `value` is an `Error`.
117
146
  */
118
- export function isError(value: any): boolean;
147
+ export function isError(value: any): value is Error;
119
148
  /**
120
149
  * Determines if a reference is a `Function`.
121
150
  *
@@ -133,10 +162,10 @@ export function isRegExp(value: any): boolean;
133
162
  /**
134
163
  * Checks if `obj` is a window object.
135
164
  *
136
- * @param {*} obj Object to check
137
- * @returns {boolean} True if `obj` is a window obj.
165
+ * @param {unknown} obj Object to check
166
+ * @returns {obj is Window} True if `obj` is a window obj.
138
167
  */
139
- export function isWindow(obj: any): boolean;
168
+ export function isWindow(obj: unknown): obj is Window;
140
169
  /**
141
170
  * @param {*} obj
142
171
  * @returns {boolean}
@@ -426,7 +455,6 @@ export function encodeUriSegment(val: string): string;
426
455
  * / "*" / "+" / "," / ";" / "="
427
456
  */
428
457
  export function encodeUriQuery(val: any, pctEncodeSpaces: any): string;
429
- export function getNgAttribute(element: any, ngAttr: any): any;
430
458
  /**
431
459
  * Creates a shallow copy of an object, an array or a primitive.
432
460
  *
@@ -486,7 +514,14 @@ export function errorHandlingConfig(
486
514
  * @returns {function(string, ...*): Error} minErr instance
487
515
  */
488
516
  export function minErr(module: string): (arg0: string, ...args: any[]) => Error;
489
- export function toDebugString(obj: any): any;
517
+ /**
518
+ * Converts a value into a simplified debug-friendly string.
519
+ *
520
+ * @template T
521
+ * @param {T|ng.Scope} obj
522
+ * @returns {string}
523
+ */
524
+ export function toDebugString<T>(obj: T | ng.Scope): string;
490
525
  /**
491
526
  * Computes a hash of an 'obj'.
492
527
  * Hash of a:
@@ -565,18 +600,30 @@ export function entries<T>(
565
600
  * Wraps a function so it can only be called once.
566
601
  * Subsequent calls do nothing and return undefined.
567
602
  *
568
- * @param {Function} fn - The function to wrap.
569
- * @returns {Function} A new function that will call `fn` only once.
603
+ * @template {(...args: any[]) => any} F
604
+ * @param {F} fn - The function to wrap.
605
+ * @returns {(this: ThisParameterType<F>, ...args: Parameters<F>) => ReturnType<F> | undefined}
570
606
  */
571
- export function callBackOnce(fn: Function): Function;
607
+ export function callBackOnce<F extends (...args: any[]) => any>(
608
+ fn: F,
609
+ ): (
610
+ this: ThisParameterType<F>,
611
+ ...args: Parameters<F>
612
+ ) => ReturnType<F> | undefined;
572
613
  /**
573
614
  * Wraps a function so it will only be called starting from the second invocation.
574
615
  * The first call does nothing and returns undefined.
575
616
  *
576
- * @param {Function} fn - The function to wrap.
577
- * @returns {Function} A new function that will skip the first call.
617
+ * @template {(...args: any[]) => any} F
618
+ * @param {F} fn - The function to wrap.
619
+ * @returns {(this: ThisParameterType<F>, ...args: Parameters<F>) => ReturnType<F> | undefined}
578
620
  */
579
- export function callBackAfterFirst(fn: Function): Function;
621
+ export function callBackAfterFirst<F extends (...args: any[]) => any>(
622
+ fn: F,
623
+ ): (
624
+ this: ThisParameterType<F>,
625
+ ...args: Parameters<F>
626
+ ) => ReturnType<F> | undefined;
580
627
  /**
581
628
  * Delays execution for a specified number of milliseconds.
582
629
  *
@@ -614,10 +661,12 @@ export function startsWith(str: string, search: string): boolean;
614
661
  /**
615
662
  * Loads and instantiates a WebAssembly module.
616
663
  * Tries streaming first, then falls back.
664
+ * @param {string} src
665
+ * @param {WebAssembly.Imports} imports
617
666
  */
618
667
  export function instantiateWasm(
619
- src: any,
620
- imports?: {},
668
+ src: string,
669
+ imports?: WebAssembly.Imports,
621
670
  ): Promise<{
622
671
  instance: WebAssembly.Instance;
623
672
  exports: WebAssembly.Exports;
@@ -31,6 +31,19 @@ export function validateArray(arg: any, name: string): any;
31
31
  * @throws {TypeError} If the value does not satisfy the validator.
32
32
  */
33
33
  export function validateIsString(arg: any, name: string): any;
34
+ /**
35
+ * @template T
36
+ * @param {unknown} arg - The value to validate.
37
+ * @param {new (...args: any[]) => T} type - The constructor to check against.
38
+ * @param {string} name - Parameter name (included in error message).
39
+ * @returns {T} The validated instance.
40
+ * @throws {TypeError} If the value is not an instance of the specified type.
41
+ */
42
+ export function validateInstanceOf<T>(
43
+ arg: unknown,
44
+ type: new (...args: any[]) => T,
45
+ name: string,
46
+ ): T;
34
47
  export const BADARG: "badarg";
35
48
  export const BADARGKEY: "badarg: key";
36
49
  export const BADARGVALUE: "badarg: value";