@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.
Files changed (85) hide show
  1. package/@types/angular.d.ts +28 -25
  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 +17 -2
  7. package/@types/animations/queue/animate-queue.d.ts +0 -1
  8. package/@types/animations/raf-scheduler.d.ts +3 -3
  9. package/@types/animations/runner/animate-runner.d.ts +81 -57
  10. package/@types/animations/shared.d.ts +0 -16
  11. package/@types/core/compile/attributes.d.ts +13 -10
  12. package/@types/core/compile/compile.d.ts +2 -2
  13. package/@types/core/controller/controller.d.ts +1 -1
  14. package/@types/core/di/ng-module/ng-module.d.ts +8 -7
  15. package/@types/core/filter/filter.d.ts +1 -1
  16. package/@types/core/interpolate/interface.d.ts +1 -0
  17. package/@types/core/parse/ast/ast.d.ts +30 -39
  18. package/@types/core/parse/ast-type.d.ts +16 -16
  19. package/@types/core/parse/interface.d.ts +1 -1
  20. package/@types/core/parse/interpreter.d.ts +6 -29
  21. package/@types/core/parse/lexer/lexer.d.ts +19 -19
  22. package/@types/core/parse/parser/parser.d.ts +4 -9
  23. package/@types/core/scope/interface.d.ts +0 -6
  24. package/@types/core/scope/scope.d.ts +13 -13
  25. package/@types/directive/attrs/attrs.d.ts +2 -5
  26. package/@types/directive/class/class.d.ts +3 -3
  27. package/@types/directive/controller/controller.d.ts +2 -2
  28. package/@types/directive/form/form.d.ts +4 -4
  29. package/@types/directive/include/include.d.ts +4 -4
  30. package/@types/directive/messages/messages.d.ts +9 -8
  31. package/@types/directive/model/model.d.ts +5 -5
  32. package/@types/directive/ref/ref.d.ts +5 -8
  33. package/@types/directive/repeat/repeat.d.ts +2 -4
  34. package/@types/directive/script/script.d.ts +2 -2
  35. package/@types/directive/select/select.d.ts +7 -8
  36. package/@types/directive/validators/validators.d.ts +2 -2
  37. package/@types/injection-tokens.d.ts +3 -2
  38. package/@types/interface.d.ts +50 -22
  39. package/@types/namespace.d.ts +42 -6
  40. package/@types/router/common/trace.d.ts +5 -5
  41. package/@types/router/directives/state-directives.d.ts +26 -24
  42. package/@types/router/directives/view-directive.d.ts +27 -131
  43. package/@types/router/glob/glob.d.ts +2 -6
  44. package/@types/router/params/interface.d.ts +2 -2
  45. package/@types/router/params/param.d.ts +3 -3
  46. package/@types/router/router.d.ts +1 -1
  47. package/@types/router/scroll/interface.d.ts +3 -0
  48. package/@types/router/scroll/view-scroll.d.ts +8 -0
  49. package/@types/router/state/interface.d.ts +25 -126
  50. package/@types/router/state/state-builder.d.ts +4 -1
  51. package/@types/router/state/state-object.d.ts +2 -2
  52. package/@types/router/state/state-queue-manager.d.ts +4 -4
  53. package/@types/router/state/state-registry.d.ts +16 -11
  54. package/@types/router/state/state-service.d.ts +18 -12
  55. package/@types/router/template-factory.d.ts +2 -2
  56. package/@types/router/transition/interface.d.ts +9 -9
  57. package/@types/router/transition/reject-factory.d.ts +5 -5
  58. package/@types/router/transition/transition-hook.d.ts +22 -23
  59. package/@types/router/transition/transition-service.d.ts +12 -5
  60. package/@types/router/transition/transition.d.ts +17 -13
  61. package/@types/router/url/url-rule.d.ts +12 -9
  62. package/@types/router/url/url-service.d.ts +14 -10
  63. package/@types/router/view/view.d.ts +4 -4
  64. package/@types/services/anchor-scroll/anchor-scroll.d.ts +2 -17
  65. package/@types/services/anchor-scroll/interface.d.ts +15 -0
  66. package/@types/services/cookie/cookie.d.ts +6 -4
  67. package/@types/services/exception/interface.d.ts +3 -3
  68. package/@types/services/http/http.d.ts +8 -7
  69. package/@types/services/log/log.d.ts +7 -3
  70. package/@types/services/pubsub/pubsub.d.ts +18 -14
  71. package/@types/services/rest/rest.d.ts +12 -10
  72. package/@types/services/sce/sce.d.ts +9 -1
  73. package/@types/services/sse/sse.d.ts +1 -1
  74. package/@types/shared/node.d.ts +8 -0
  75. package/@types/shared/noderef.d.ts +11 -14
  76. package/@types/shared/strings.d.ts +18 -6
  77. package/@types/shared/utils.d.ts +111 -73
  78. package/@types/shared/validate.d.ts +49 -0
  79. package/dist/angular-ts.esm.js +2581 -2619
  80. package/dist/angular-ts.umd.js +2581 -2619
  81. package/dist/angular-ts.umd.min.js +2 -1
  82. package/dist/angular-ts.umd.min.js.gz +0 -0
  83. package/dist/angular-ts.umd.min.js.map +1 -0
  84. package/package.json +1 -1
  85. package/@types/router/view-scroll.d.ts +0 -12
@@ -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,20 +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.
57
+ */
58
+ export function isDefined<T>(value: T | undefined): value is T;
59
+ /**
60
+ * @template T
61
+ * @param {any} array
62
+ * @returns {array is T[]} true if array is an Array
43
63
  */
44
- export function isDefined(value: any): boolean;
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;
45
75
  /**
46
76
  * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not
47
77
  * considered to be objects. Note that JavaScript arrays are objects.
48
78
  *
49
- * @param {*} value Reference to check.
50
- * @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`.
51
82
  */
52
- export function isObject(value: any): boolean;
83
+ export function isObject<T>(value: T): value is T & object;
53
84
  /**
54
85
  * Determines if a value is an object with a null prototype
55
86
  *
@@ -57,21 +88,27 @@ export function isObject(value: any): boolean;
57
88
  * @returns {boolean} True if `value` is an `Object` with a null prototype
58
89
  */
59
90
  export function isBlankObject(value: any): boolean;
60
- 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;
61
98
  /**
62
99
  * Determines if a reference is a null.
63
100
  *
64
- * @param {*} value Reference to check.
65
- * @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.
66
103
  */
67
- export function isNull(value: any): boolean;
104
+ export function isNull(value: unknown): value is null;
68
105
  /**
69
106
  * Determines if a reference is null or undefined.
70
107
  *
71
- * @param {*} obj Reference to check.
72
- * @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.
73
110
  */
74
- export function isNullOrUndefined(obj: any): boolean;
111
+ export function isNullOrUndefined(obj: unknown): obj is null | undefined;
75
112
  /**
76
113
  * Determines if a reference is not null or undefined.
77
114
  *
@@ -88,10 +125,10 @@ export function notNullOrUndefined(obj: any): boolean;
88
125
  * [`isFinite'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite)
89
126
  * method.
90
127
  *
91
- * @param {*} value Reference to check.
92
- * @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`.
93
130
  */
94
- export function isNumber(value: any): boolean;
131
+ export function isNumber(value: unknown): value is number;
95
132
  /**
96
133
  *
97
134
  * Determines if a value is a date.
@@ -105,9 +142,9 @@ export function isDate(value: any): boolean;
105
142
  * Loosely based on https://www.npmjs.com/package/iserror
106
143
  *
107
144
  * @param {*} value Reference to check.
108
- * @returns {boolean} True if `value` is an `Error`.
145
+ * @returns {value is Error} True if `value` is an `Error`.
109
146
  */
110
- export function isError(value: any): boolean;
147
+ export function isError(value: any): value is Error;
111
148
  /**
112
149
  * Determines if a reference is a `Function`.
113
150
  *
@@ -125,10 +162,10 @@ export function isRegExp(value: any): boolean;
125
162
  /**
126
163
  * Checks if `obj` is a window object.
127
164
  *
128
- * @param {*} obj Object to check
129
- * @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.
130
167
  */
131
- export function isWindow(obj: any): boolean;
168
+ export function isWindow(obj: unknown): obj is Window;
132
169
  /**
133
170
  * @param {*} obj
134
171
  * @returns {boolean}
@@ -418,7 +455,6 @@ export function encodeUriSegment(val: string): string;
418
455
  * / "*" / "+" / "," / ";" / "="
419
456
  */
420
457
  export function encodeUriQuery(val: any, pctEncodeSpaces: any): string;
421
- export function getNgAttribute(element: any, ngAttr: any): any;
422
458
  /**
423
459
  * Creates a shallow copy of an object, an array or a primitive.
424
460
  *
@@ -431,39 +467,6 @@ export function shallowCopy(src: any, dst: any): any;
431
467
  * @param {string} errorMsg
432
468
  */
433
469
  export function assert(argument: boolean, errorMsg?: string): void;
434
- /**
435
- * Validate a value using a predicate function.
436
- * Throws if the predicate returns false.
437
- * IMPORTANT: use this function only for developper errors and not for user/data errors
438
- *
439
- * @param {ng.Validator} fn - Predicate validator function.
440
- * @param {*} arg - The value to validate.
441
- * @param {string} name - Parameter name (included in error message).
442
- * @returns {*} The validated value.
443
- * @throws {TypeError} If the value does not satisfy the validator.
444
- */
445
- export function validate(fn: ng.Validator, arg: any, name: string): any;
446
- /**
447
- * @param {*} arg - The value to validate.
448
- * @param {string} name - Parameter name (included in error message).
449
- * @returns {*} The validated value.
450
- * @throws {TypeError} If the value does not satisfy the validator.
451
- */
452
- export function validateRequired(arg: any, name: string): any;
453
- /**
454
- * @param {*} arg - The value to validate.
455
- * @param {string} name - Parameter name (included in error message).
456
- * @returns {*} The validated value.
457
- * @throws {TypeError} If the value does not satisfy the validator.
458
- */
459
- export function validateArray(arg: any, name: string): any;
460
- /**
461
- * @param {*} arg - The value to validate.
462
- * @param {string} name - Parameter name (included in error message).
463
- * @returns {*} The validated value.
464
- * @throws {TypeError} If the value does not satisfy the validator.
465
- */
466
- export function validateIsString(arg: any, name: string): any;
467
470
  /**
468
471
  * Throw error if the argument is falsy.
469
472
  */
@@ -511,7 +514,14 @@ export function errorHandlingConfig(
511
514
  * @returns {function(string, ...*): Error} minErr instance
512
515
  */
513
516
  export function minErr(module: string): (arg0: string, ...args: any[]) => Error;
514
- 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;
515
525
  /**
516
526
  * Computes a hash of an 'obj'.
517
527
  * Hash of a:
@@ -569,22 +579,51 @@ export function isObjectEmpty(obj: any | null | undefined): boolean;
569
579
  * hasOwn({}, 'bar'); // false
570
580
  */
571
581
  export function hasOwn(obj: object, key: string | number | symbol): boolean;
582
+ /**
583
+ * @param {Object} obj
584
+ * @returns {string[]}
585
+ */
586
+ export function keys(obj: any): string[];
587
+ /**
588
+ * @template T
589
+ * @param {{ [s: string]: T; } | ArrayLike<T>} obj
590
+ * @returns {[string, T][]}
591
+ */
592
+ export function entries<T>(
593
+ obj:
594
+ | {
595
+ [s: string]: T;
596
+ }
597
+ | ArrayLike<T>,
598
+ ): [string, T][];
572
599
  /**
573
600
  * Wraps a function so it can only be called once.
574
601
  * Subsequent calls do nothing and return undefined.
575
602
  *
576
- * @param {Function} fn - The function to wrap.
577
- * @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}
578
606
  */
579
- 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;
580
613
  /**
581
614
  * Wraps a function so it will only be called starting from the second invocation.
582
615
  * The first call does nothing and returns undefined.
583
616
  *
584
- * @param {Function} fn - The function to wrap.
585
- * @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}
586
620
  */
587
- 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;
588
627
  /**
589
628
  * Delays execution for a specified number of milliseconds.
590
629
  *
@@ -622,10 +661,12 @@ export function startsWith(str: string, search: string): boolean;
622
661
  /**
623
662
  * Loads and instantiates a WebAssembly module.
624
663
  * Tries streaming first, then falls back.
664
+ * @param {string} src
665
+ * @param {WebAssembly.Imports} imports
625
666
  */
626
667
  export function instantiateWasm(
627
- src: any,
628
- imports?: {},
668
+ src: string,
669
+ imports?: WebAssembly.Imports,
629
670
  ): Promise<{
630
671
  instance: WebAssembly.Instance;
631
672
  exports: WebAssembly.Exports;
@@ -637,7 +678,4 @@ export function instantiateWasm(
637
678
  */
638
679
  export function isArrowFunction(fn: any): boolean;
639
680
  export const isProxySymbol: unique symbol;
640
- export const BADARG: "badarg";
641
- export const BADARGKEY: "badarg: key";
642
- export const BADARGVALUE: "badarg: value";
643
681
  export const ngAttrPrefixes: string[];
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Validate a value using a predicate function.
3
+ * Throws if the predicate returns false.
4
+ * IMPORTANT: use this function only for developper errors and not for user/data errors
5
+ *
6
+ * @param {ng.Validator} fn - Predicate validator function.
7
+ * @param {*} arg - The value to validate.
8
+ * @param {string} name - Parameter name (included in error message).
9
+ * @returns {*} The validated value.
10
+ * @throws {TypeError} If the value does not satisfy the validator.
11
+ */
12
+ export function validate(fn: ng.Validator, arg: any, name: string): any;
13
+ /**
14
+ * @param {*} arg - The value to validate.
15
+ * @param {string} name - Parameter name (included in error message).
16
+ * @returns {*} The validated value.
17
+ * @throws {TypeError} If the value does not satisfy the validator.
18
+ */
19
+ export function validateRequired(arg: any, name: string): any;
20
+ /**
21
+ * @param {*} arg - The value to validate.
22
+ * @param {string} name - Parameter name (included in error message).
23
+ * @returns {*} The validated value.
24
+ * @throws {TypeError} If the value does not satisfy the validator.
25
+ */
26
+ export function validateArray(arg: any, name: string): any;
27
+ /**
28
+ * @param {*} arg - The value to validate.
29
+ * @param {string} name - Parameter name (included in error message).
30
+ * @returns {*} The validated value.
31
+ * @throws {TypeError} If the value does not satisfy the validator.
32
+ */
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;
47
+ export const BADARG: "badarg";
48
+ export const BADARGKEY: "badarg: key";
49
+ export const BADARGVALUE: "badarg: value";