@angular-wave/angular.ts 0.15.1 → 0.16.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 (66) hide show
  1. package/@types/angular.d.ts +3 -0
  2. package/@types/animations/interface.d.ts +4 -0
  3. package/@types/animations/runner/animate-runner.d.ts +2 -1
  4. package/@types/animations/shared.d.ts +100 -44
  5. package/@types/core/compile/attributes.d.ts +34 -18
  6. package/@types/core/compile/compile.d.ts +4 -5
  7. package/@types/core/controller/interface.d.ts +1 -1
  8. package/@types/core/di/di.d.ts +0 -10
  9. package/@types/core/di/interface.d.ts +28 -0
  10. package/@types/core/di/internal-injector.d.ts +28 -19
  11. package/@types/core/di/ng-module/ng-module.d.ts +35 -4
  12. package/@types/core/interpolate/interpolate.d.ts +1 -1
  13. package/@types/core/parse/ast/ast.d.ts +6 -12
  14. package/@types/core/parse/ast-type.d.ts +1 -1
  15. package/@types/core/parse/interface.d.ts +8 -40
  16. package/@types/core/parse/interpreter.d.ts +4 -3
  17. package/@types/core/parse/lexer/lexer.d.ts +2 -30
  18. package/@types/core/parse/parse.d.ts +1 -34
  19. package/@types/core/parse/parser/parser.d.ts +2 -13
  20. package/@types/core/sanitize/sanitize-uri.d.ts +2 -2
  21. package/@types/core/scope/interface.d.ts +1 -0
  22. package/@types/core/scope/scope.d.ts +25 -28
  23. package/@types/directive/form/form.d.ts +8 -40
  24. package/@types/directive/input/input.d.ts +8 -40
  25. package/@types/directive/model/model.d.ts +34 -30
  26. package/@types/directive/model-options/model-options.d.ts +1 -2
  27. package/@types/directive/show-hide/show-hide.d.ts +2 -1
  28. package/@types/directive/validators/validators.d.ts +5 -7
  29. package/@types/filters/order-by.d.ts +2 -1
  30. package/@types/interface.d.ts +3 -2
  31. package/@types/namespace.d.ts +25 -3
  32. package/@types/router/state/state-object.d.ts +2 -2
  33. package/@types/router/state/state-service.d.ts +1 -0
  34. package/@types/router/template-factory.d.ts +4 -5
  35. package/@types/router/transition/reject-factory.d.ts +32 -9
  36. package/@types/router/transition/transition-event-type.d.ts +2 -2
  37. package/@types/router/transition/transition-hook.d.ts +5 -2
  38. package/@types/router/transition/transition-service.d.ts +2 -2
  39. package/@types/router/transition/transition.d.ts +2 -2
  40. package/@types/router/view/view.d.ts +4 -4
  41. package/@types/services/http/http.d.ts +1 -1
  42. package/@types/services/http/interface.d.ts +0 -7
  43. package/@types/services/pubsub/pubsub.d.ts +2 -2
  44. package/@types/services/sce/interface.d.ts +8 -0
  45. package/@types/services/sce/sce.d.ts +10 -7
  46. package/@types/services/sse/interface.d.ts +5 -20
  47. package/@types/services/storage/storage.d.ts +2 -2
  48. package/@types/services/stream/interface.d.ts +1 -0
  49. package/@types/services/stream/stream.d.ts +1 -1
  50. package/@types/services/template-request/interface.d.ts +2 -9
  51. package/@types/services/template-request/template-request.d.ts +6 -40
  52. package/@types/services/websocket/interface.d.ts +16 -0
  53. package/@types/services/websocket/websocket.d.ts +20 -0
  54. package/@types/shared/common.d.ts +48 -27
  55. package/@types/shared/constants.d.ts +2 -8
  56. package/@types/shared/dom.d.ts +33 -19
  57. package/@types/shared/utils.d.ts +8 -18
  58. package/README.md +15 -7
  59. package/dist/angular-ts.esm.js +4336 -4850
  60. package/dist/angular-ts.umd.js +4336 -4850
  61. package/dist/angular-ts.umd.min.js +1 -1
  62. package/dist/angular-ts.umd.min.js.gz +0 -0
  63. package/dist/angular-ts.umd.min.js.map +1 -1
  64. package/package.json +1 -1
  65. package/@types/core/di/inteface.d.ts +0 -11
  66. /package/@types/core/compile/{inteface.d.ts → interface.d.ts} +0 -0
@@ -0,0 +1,20 @@
1
+ /**
2
+ * WebSocketProvider
3
+ * Provides a pre-configured WebSocket connection as an injectable.
4
+ */
5
+ export class WebSocketProvider {
6
+ /** @type {ng.WebSocketConfig} */
7
+ defaults: ng.WebSocketConfig;
8
+ $get: (
9
+ | string
10
+ | ((
11
+ log: ng.LogService,
12
+ ) => (
13
+ url: string,
14
+ protocols?: string[],
15
+ config?: import("./interface.ts").WebSocketConfig,
16
+ ) => StreamConnection)
17
+ )[];
18
+ _$log: import("../log/interface.ts").LogService;
19
+ }
20
+ import { StreamConnection } from "../stream/stream.js";
@@ -1,4 +1,8 @@
1
- export function equals(o1: any, o2: any): boolean;
1
+ /**
2
+ * @param {unknown} o1
3
+ * @param {unknown} o2
4
+ */
5
+ export function equals(o1: unknown, o2: unknown): boolean;
2
6
  /**
3
7
  * prototypal inheritance helper.
4
8
  * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it
@@ -15,25 +19,46 @@ export function inherit(parent: any, extra?: any): any;
15
19
  /**
16
20
  * Given an array, and an item, if the item is found in the array, it removes it (in-place).
17
21
  * The same array is returned
18
- * @param {Array} array
22
+ * @param {Array<any>} array
19
23
  * @param {any} obj
20
- * @returns {Array}
24
+ * @returns {Array<any>}
21
25
  */
22
- export function removeFrom(array: any[], obj: any): any[];
26
+ export function removeFrom(array: Array<any>, obj: any): Array<any>;
23
27
  /**
24
28
  * Applies a set of defaults to an options object. The options object is filtered
25
29
  * to only those properties of the objects in the defaultsList.
26
30
  * Earlier objects in the defaultsList take precedence when applying defaults.
31
+ * @param {{}} opts
32
+ * @param {{ current?: (() => void) | (() => null); transition?: null; traceData?: {}; bind?: null; inherit?: boolean; matchingKeys?: null; state?: { params: {}; }; strict?: boolean; caseInsensitive?: boolean; relative?: import("../router/state/state-object.js").StateObject | null | undefined; location?: boolean; notify?: boolean; reload?: boolean; supercede?: boolean; custom?: {}; source?: string; lossy?: boolean; absolute?: boolean; }[]} defaultsList
27
33
  */
28
- export function defaults(opts: any, ...defaultsList: any[]): any;
29
- /**
30
- * Finds the common ancestor path between two states.
31
- *
32
- * @param {Object} first The first state.
33
- * @param {Object} second The second state.
34
- * @return {Array} Returns an array of state names in descending order, not including the root.
35
- */
36
- export function ancestors(first: any, second: any): any[];
34
+ export function defaults(
35
+ opts: {},
36
+ ...defaultsList: {
37
+ current?: (() => void) | (() => null);
38
+ transition?: null;
39
+ traceData?: {};
40
+ bind?: null;
41
+ inherit?: boolean;
42
+ matchingKeys?: null;
43
+ state?: {
44
+ params: {};
45
+ };
46
+ strict?: boolean;
47
+ caseInsensitive?: boolean;
48
+ relative?:
49
+ | import("../router/state/state-object.js").StateObject
50
+ | null
51
+ | undefined;
52
+ location?: boolean;
53
+ notify?: boolean;
54
+ reload?: boolean;
55
+ supercede?: boolean;
56
+ custom?: {};
57
+ source?: string;
58
+ lossy?: boolean;
59
+ absolute?: boolean;
60
+ }[]
61
+ ): any;
37
62
  /**
38
63
  * Return a copy of the object only containing the whitelisted properties.
39
64
  *
@@ -77,18 +102,17 @@ export function assertFn(
77
102
  /**
78
103
  * Given two or more parallel arrays, returns an array of tuples where
79
104
  * each tuple is composed of [ a[i], b[i], ... z[i] ]
80
- *
81
- * @example
82
- * ```
83
- *
84
- * let foo = [ 0, 2, 4, 6 ];
85
- * let bar = [ 1, 3, 5, 7 ];
86
- * let baz = [ 10, 30, 50, 70 ];
87
- * arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ]
88
- * arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ]
89
- * ```
105
+ * @example ```
106
+
107
+ let foo = [ 0, 2, 4, 6 ];
108
+ let bar = [ 1, 3, 5, 7 ];
109
+ let baz = [ 10, 30, 50, 70 ];
110
+ arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ]
111
+ arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ]
112
+ ```
113
+ * @param {any[][]} args
90
114
  */
91
- export function arrayTuples(...args: any[]): any[][];
115
+ export function arrayTuples(...args: any[][]): any[][];
92
116
  /**
93
117
  * Reduce function which builds an object from an array of [key, value] pairs.
94
118
  *
@@ -131,6 +155,3 @@ export function assertPredicate(
131
155
  predicateOrMap: any,
132
156
  errMsg?: string,
133
157
  ): (obj: any) => any;
134
- export function pairs(obj: any): any[][];
135
- export function silenceUncaughtInPromise(promise: any): any;
136
- export function silentRejection(error: any): any;
@@ -8,11 +8,5 @@ export const EMPTY_CLASS: "ng-empty";
8
8
  export const NOT_EMPTY_CLASS: "ng-not-empty";
9
9
  export const PREFIX_REGEXP: RegExp;
10
10
  export const SPECIAL_CHARS_REGEXP: RegExp;
11
- export namespace ALIASED_ATTR {
12
- let ngMinlength: string;
13
- let ngMaxlength: string;
14
- let ngMin: string;
15
- let ngMax: string;
16
- let ngPattern: string;
17
- let ngStep: string;
18
- }
11
+ /** @type {Record<string, string>} */
12
+ export const ALIASED_ATTR: Record<string, string>;
@@ -11,24 +11,24 @@ export function kebabToCamel(name: string): string;
11
11
  */
12
12
  export function snakeToCamel(name: string): string;
13
13
  /**
14
- * Removes expando data from this element. If key is provided, only
15
- * its field is removed. If data is empty, also removes `ExpandoStore`
16
- * from cache.
17
- * @param {Element} element
18
- * @param {string} [name] - key of field to remove
14
+ * @param {Element & Record<string, any>} element
15
+ * @param {string} [name]
19
16
  */
20
- export function removeElementData(element: Element, name?: string): void;
17
+ export function removeElementData(
18
+ element: Element & Record<string, any>,
19
+ name?: string,
20
+ ): void;
21
21
  /**
22
22
  * Stores data associated with an element inside the expando property of the DOM element.
23
23
  *
24
24
  * @see {@link https://developer.mozilla.org/en-US/docs/Glossary/Expando MDN Glossary: Expando}
25
25
  *
26
- * @param {Element} element
26
+ * @param {Element & Record<string, any> } element
27
27
  * @param {boolean} [createIfNecessary=false]
28
28
  * @returns {import("../interface.ts").ExpandoStore}
29
29
  */
30
30
  export function getExpando(
31
- element: Element,
31
+ element: Element & Record<string, any>,
32
32
  createIfNecessary?: boolean,
33
33
  ): import("../interface.ts").ExpandoStore;
34
34
  /**
@@ -38,22 +38,30 @@ export function getExpando(
38
38
  */
39
39
  export function isTextNode(html: string): boolean;
40
40
  /**
41
- * @param {Element} element
41
+ * @param {Element & Record<string, any>} element
42
+ * @param {Element & Record<string, any>} element
42
43
  * @param {boolean} [onlyDescendants]
43
44
  * @returns {void}
44
45
  */
45
- export function dealoc(element: Element, onlyDescendants?: boolean): void;
46
+ export function dealoc(
47
+ element: Element & Record<string, any>,
48
+ onlyDescendants?: boolean,
49
+ ): void;
46
50
  /**
47
51
  * Gets or sets cache data for a given element.
48
52
  *
49
53
  * @param {Element} element - The DOM element to get or set data on.
50
- * @param {string|Object} key - The key (as a string) to get/set or an object for mass-setting.
54
+ * @param {string|Object.<string, any>} key - The key to get/set or an object for mass-setting.
51
55
  * @param {*} [value] - The value to set. If not provided, the function acts as a getter.
52
- * @returns {*} - The retrieved data if acting as a getter. Otherwise, returns undefined.
56
+ * @returns {*} - The retrieved data if acting as a getter. Otherwise, undefined.
53
57
  */
54
58
  export function getOrSetCacheData(
55
59
  element: Element,
56
- key: string | any,
60
+ key:
61
+ | string
62
+ | {
63
+ [x: string]: any;
64
+ },
57
65
  value?: any,
58
66
  ): any;
59
67
  /**
@@ -128,10 +136,11 @@ export function getController(
128
136
  name?: string,
129
137
  ): ng.Scope | undefined;
130
138
  /**
139
+ * Walk up the DOM tree (including Shadow DOM) to get inherited data.
131
140
  *
132
- * @param {Node} element
133
- * @param {string} name
134
- * @returns
141
+ * @param {Node} element - The starting element (or document/document fragment)
142
+ * @param {string} name - The data key to look up
143
+ * @returns {any} - The found value, or undefined if not found
135
144
  */
136
145
  export function getInheritedData(element: Node, name: string): any;
137
146
  /**
@@ -149,10 +158,10 @@ export function removeElement(element: Element, keepData?: boolean): void;
149
158
  export function startingTag(elementOrStr: string | Element | Node): string;
150
159
  /**
151
160
  * Return the DOM siblings between the first and last node in the given array.
152
- * @param {Array<Node>} nodes An array-like object
153
- * @returns {*[]|Array<Node>} the inputted object or a JQLite collection containing the nodes
161
+ * @param {Node[]} nodes
162
+ * @returns {Node[]}
154
163
  */
155
- export function getBlockNodes(nodes: Array<Node>): any[] | Array<Node>;
164
+ export function getBlockNodes(nodes: Node[]): Node[];
156
165
  /**
157
166
  * Gets the name of a boolean attribute if it exists on a given element.
158
167
  *
@@ -230,6 +239,11 @@ export function animatedomInsert(
230
239
  * @returns {string} The base href.
231
240
  */
232
241
  export function getBaseHref(): string;
242
+ /**
243
+ * @param {NodeList|Node} element
244
+ * @returns {Node | undefined}
245
+ */
246
+ export function extractElementNode(element: NodeList | Node): Node | undefined;
233
247
  /**
234
248
  * Expando cache for adding properties to DOM nodes with JavaScript.
235
249
  * This used to be an Object in JQLite decorator, but swapped out for a Map
@@ -23,14 +23,14 @@ export function deProxy<T>(
23
23
  export function nextUid(): number;
24
24
  /**
25
25
  *
26
- * @description Converts the specified string to lowercase.
26
+ * Converts the specified string to lowercase.
27
27
  * @param {string} string String to be converted to lowercase.
28
28
  * @returns {string} Lowercased string.
29
29
  */
30
30
  export function lowercase(string: string): string;
31
31
  /**
32
32
  *
33
- * @description Converts the specified string to uppercase.
33
+ * Converts the specified string to uppercase.
34
34
  * @param {string} string String to be converted to uppercase.
35
35
  * @returns {string} Uppercased string.
36
36
  */
@@ -133,9 +133,9 @@ export function isNumber(value: unknown): value is number;
133
133
  * Determines if a value is a date.
134
134
  *
135
135
  * @param {*} value Reference to check.
136
- * @returns {boolean} True if `value` is a `Date`.
136
+ * @returns {value is Date} True if `value` is a `Date`.
137
137
  */
138
- export function isDate(value: any): boolean;
138
+ export function isDate(value: any): value is Date;
139
139
  /**
140
140
  * Determines if a reference is an `Error`.
141
141
  * Loosely based on https://www.npmjs.com/package/iserror
@@ -148,16 +148,16 @@ export function isError(value: any): value is Error;
148
148
  * Determines if a reference is a `Function`.
149
149
  *
150
150
  * @param {*} value Reference to check.
151
- * @returns {boolean} True if `value` is a `Function`.
151
+ * @returns {value is Function} True if `value` is a `Function`.
152
152
  */
153
- export function isFunction(value: any): boolean;
153
+ export function isFunction(value: any): value is Function;
154
154
  /**
155
155
  * Determines if a value is a regular expression object.
156
156
  *
157
157
  * @param {*} value Reference to check.
158
- * @returns {boolean} True if `value` is a `RegExp`.
158
+ * @returns {value is RegExp} True if `value` is a `RegExp`.
159
159
  */
160
- export function isRegExp(value: any): boolean;
160
+ export function isRegExp(value: any): value is RegExp;
161
161
  /**
162
162
  * Checks if `obj` is a window object.
163
163
  *
@@ -195,16 +195,6 @@ export function isBoolean(value: any): boolean;
195
195
  * @returns {boolean}
196
196
  */
197
197
  export function isPromiseLike(obj: any): boolean;
198
- /**
199
- * @param {*} value
200
- * @returns {boolean}
201
- */
202
- export function isTypedArray(value: any): boolean;
203
- /**
204
- * @param {*} obj
205
- * @returns {boolean}
206
- */
207
- export function isArrayBuffer(obj: any): boolean;
208
198
  /**
209
199
  * @param {*} value
210
200
  * @returns {string | *}
package/README.md CHANGED
@@ -3,12 +3,13 @@
3
3
  ![Build status](https://github.com/angular-wave/angular.ts/actions/workflows/ci.yml/badge.svg)
4
4
  [![stats](https://data.jsdelivr.com/v1/package/npm/@angular-wave/angular.ts/badge?style=rounded)](https://www.jsdelivr.com/package/npm/@angular-wave/angular.ts)
5
5
 
6
- This project preserves, modernises and expands the original [AngularJS](https://angularjs.org/)
6
+ This project preserves, modernizes and expands the original [AngularJS](https://angularjs.org/)
7
7
  framework. AngularTS is "AngularJS: The Good Parts". It takes the three core pillars of the original &ndash; a string-interpolation engine,
8
- dependency injection, two-way data-binding &ndash; and adds a reactive change-detection model on top of modern build tooling with strong typechecking of TypeScript.
8
+ dependency injection, two-way data-binding &ndash; and adds a reactive change-detection model on top of modern build tooling
9
+ with strong typechecking of TypeScript.
9
10
 
10
- With AngularJS, you get a decade-long optimization effort of Angular Team at Google, plus a massive testing suite, required for applications like Google Cloud and Kubernetes.
11
- AngularTS adds:
11
+ With AngularJS, you get a decade-long optimization effort of Angular Team at Google, plus a massive testing suite.
12
+ AngularTS builds on that foundation and adds:
12
13
 
13
14
  - a fully reactive change-detection model without digests or virtual DOMs, like `Vue`
14
15
  - access to native DOM APIs at component and directive level (no `JQuery`or `JQLite`)
@@ -16,10 +17,17 @@ AngularTS adds:
16
17
  - built-in enterprise-level router (`ui-router` ported as `ng-router`)
17
18
  - built-in animations (`animate`)
18
19
  - new directives, inspired by `HTMX`
19
- - new injectables for REST resources, persistent stores, Web Workers and WASM modules
20
+ - new injectables for REST resources, persistent stores, Web Workers, EventSources, WebSockets and WASM modules
20
21
 
21
- The result is a high-performance, buildless, progressive and battle-tested JS framework that stays as close to Web standards as possible.
22
- If you write server-rendered web applications for desktop and mobile, and do not wish to leave the comfort of your tech-stack, this is your new secret weapon.
22
+ The result is a high-performance, buildless, multi-paradigm and battle-tested JS framework that stays as close to Web standards as possible.
23
+
24
+ If you:
25
+
26
+ - Build server-rendered web applications for desktop and mobile
27
+ - Want a tools that is easy to get started with, yet remains expert-friendly at scale
28
+ - Make no compromises on performance (think McMaster-Carr)
29
+
30
+ then AngularTS is your new (old) secret weapon.
23
31
 
24
32
  ### Getting started
25
33