@angular-wave/angular.ts 0.15.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/angular.d.ts +1 -1
- package/@types/core/compile/attributes.d.ts +28 -4
- package/@types/core/compile/inteface.d.ts +5 -1
- package/@types/core/di/inteface.d.ts +11 -0
- package/@types/core/parse/ast/ast-node.d.ts +2 -0
- package/@types/core/parse/parse.d.ts +4 -1
- package/@types/core/scope/interface.d.ts +26 -0
- package/@types/directive/bind/bind.d.ts +5 -7
- package/@types/directive/form/form.d.ts +12 -9
- package/@types/directive/init/init.d.ts +2 -2
- package/@types/directive/input/input.d.ts +16 -0
- package/@types/directive/listener/listener.d.ts +4 -0
- package/@types/directive/model/interface.d.ts +18 -0
- package/@types/directive/model/model.d.ts +20 -18
- package/@types/directive/non-bindable/non-bindable.d.ts +2 -2
- package/@types/directive/select/select.d.ts +2 -2
- package/@types/directive/setter/setter.d.ts +2 -2
- package/@types/directive/show-hide/show-hide.d.ts +2 -4
- package/@types/directive/switch/switch.d.ts +4 -4
- package/@types/interface.d.ts +22 -1
- package/@types/namespace.d.ts +9 -1
- package/@types/router/router.d.ts +5 -3
- package/@types/router/scroll/interface.d.ts +1 -1
- package/@types/router/state/interface.d.ts +5 -0
- package/@types/router/state/state-builder.d.ts +10 -6
- package/@types/router/state/state-matcher.d.ts +11 -3
- package/@types/router/state/state-object.d.ts +3 -5
- package/@types/router/state/state-queue-manager.d.ts +14 -8
- package/@types/router/state/state-registry.d.ts +12 -3
- package/@types/router/state/state-service.d.ts +8 -2
- package/@types/router/transition/hook-registry.d.ts +15 -5
- package/@types/router/transition/transition.d.ts +4 -2
- package/@types/router/url/url-rules.d.ts +3 -84
- package/@types/router/url/url-service.d.ts +9 -8
- package/@types/services/cookie/cookie.d.ts +3 -11
- package/@types/services/http/http.d.ts +6 -31
- package/@types/services/http/interface.d.ts +22 -0
- package/@types/services/location/location.d.ts +14 -13
- package/@types/services/sce/interface.d.ts +25 -0
- package/@types/services/sse/interface.d.ts +8 -1
- package/@types/services/sse/sse.d.ts +10 -18
- package/@types/services/storage/storage.d.ts +6 -6
- package/@types/services/stream/interface.d.ts +1 -1
- package/@types/services/stream/stream.d.ts +98 -0
- package/@types/shared/common.d.ts +2 -2
- package/@types/shared/dom.d.ts +21 -42
- package/@types/shared/hof.d.ts +27 -37
- package/@types/shared/noderef.d.ts +2 -2
- package/@types/shared/strings.d.ts +13 -4
- package/@types/shared/utils.d.ts +123 -66
- package/@types/shared/validate.d.ts +7 -0
- package/dist/angular-ts.esm.js +980 -812
- package/dist/angular-ts.umd.js +980 -812
- package/dist/angular-ts.umd.min.js +1 -1
- package/dist/angular-ts.umd.min.js.gz +0 -0
- package/dist/angular-ts.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/@types/router/state-filters.d.ts +0 -39
- package/@types/shared/cache.d.ts +0 -7
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Stream Connection Manager
|
|
3
|
+
* Handles reconnect, heartbeat, and event callbacks for SSE or WebSocket
|
|
4
|
+
*/
|
|
5
|
+
export class StreamConnection {
|
|
6
|
+
/**
|
|
7
|
+
* @param {() => EventSource | WebSocket} createFn - Function that creates a new EventSource or WebSocket.
|
|
8
|
+
* @param {ng.StreamConnectionConfig} config - Configuration object with callbacks, retries, heartbeat, transformMessage.
|
|
9
|
+
* @param {ng.LogService} log - Optional logger (default: console).
|
|
10
|
+
*/
|
|
11
|
+
constructor(
|
|
12
|
+
createFn: () => EventSource | WebSocket,
|
|
13
|
+
config?: ng.StreamConnectionConfig,
|
|
14
|
+
log?: ng.LogService,
|
|
15
|
+
);
|
|
16
|
+
/** @private @type {() => EventSource | WebSocket} */
|
|
17
|
+
private _createFn;
|
|
18
|
+
_config: {
|
|
19
|
+
onOpen?: (event: Event) => void;
|
|
20
|
+
onMessage?: (data: any, event: Event | MessageEvent) => void;
|
|
21
|
+
onError?: (err: any) => void;
|
|
22
|
+
onReconnect?: (attempt: number) => void;
|
|
23
|
+
retryDelay: number;
|
|
24
|
+
maxRetries: number;
|
|
25
|
+
heartbeatTimeout: number;
|
|
26
|
+
transformMessage: (data: string) => any;
|
|
27
|
+
};
|
|
28
|
+
_log: import("../log/interface.ts").LogService;
|
|
29
|
+
_retryCount: number;
|
|
30
|
+
_closed: boolean;
|
|
31
|
+
_heartbeatTimer: number;
|
|
32
|
+
/** @type {EventSource | WebSocket | null} */
|
|
33
|
+
_connection: EventSource | WebSocket | null;
|
|
34
|
+
/**
|
|
35
|
+
* Establishes a new connection using the provided createFn.
|
|
36
|
+
* Closes any existing connection before creating a new one.
|
|
37
|
+
*/
|
|
38
|
+
connect(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Sends data over a WebSocket connection.
|
|
41
|
+
* Logs a warning if called on a non-WebSocket connection.
|
|
42
|
+
* @param {any} data - Data to send.
|
|
43
|
+
*/
|
|
44
|
+
send(data: any): void;
|
|
45
|
+
/**
|
|
46
|
+
* Closes the connection manually and clears the heartbeat timer.
|
|
47
|
+
*/
|
|
48
|
+
close(): void;
|
|
49
|
+
/**
|
|
50
|
+
* @private
|
|
51
|
+
* Binds event handlers to the underlying connection (EventSource or WebSocket)
|
|
52
|
+
* for open, message, error, and close events.
|
|
53
|
+
*/
|
|
54
|
+
private _bindEvents;
|
|
55
|
+
/**
|
|
56
|
+
* @private
|
|
57
|
+
* Handles the open event from the connection.
|
|
58
|
+
* @param {Event} event - The open event.
|
|
59
|
+
*/
|
|
60
|
+
private _handleOpen;
|
|
61
|
+
/**
|
|
62
|
+
* @private
|
|
63
|
+
* Handles incoming messages, applies the transformMessage function,
|
|
64
|
+
* and calls the onMessage callback.
|
|
65
|
+
* @param {any} data - Raw message data.
|
|
66
|
+
* @param {Event} event - The message event.
|
|
67
|
+
*/
|
|
68
|
+
private _handleMessage;
|
|
69
|
+
/**
|
|
70
|
+
* @private
|
|
71
|
+
* Handles errors emitted from the connection.
|
|
72
|
+
* Calls onError callback and schedules a reconnect.
|
|
73
|
+
* @param {any} err - Error object or message.
|
|
74
|
+
*/
|
|
75
|
+
private _handleError;
|
|
76
|
+
/**
|
|
77
|
+
* @private
|
|
78
|
+
* Handles close events for WebSocket connections.
|
|
79
|
+
* Triggers reconnect logic.
|
|
80
|
+
*/
|
|
81
|
+
private _handleClose;
|
|
82
|
+
/**
|
|
83
|
+
* @private
|
|
84
|
+
* Schedules a reconnect attempt based on retryCount and config.maxRetries.
|
|
85
|
+
* Calls onReconnect callback if reconnecting.
|
|
86
|
+
*/
|
|
87
|
+
private _scheduleReconnect;
|
|
88
|
+
/**
|
|
89
|
+
* @private
|
|
90
|
+
* Resets the heartbeat timer. If the timer expires, the connection is closed
|
|
91
|
+
* and a reconnect is attempted.
|
|
92
|
+
*/
|
|
93
|
+
private _resetHeartbeat;
|
|
94
|
+
/**
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
private _closeInternal;
|
|
98
|
+
}
|
|
@@ -113,10 +113,10 @@ export function applyPairs(memo: any, keyValTuple: any): any;
|
|
|
113
113
|
/**
|
|
114
114
|
* Returns the last element of an array, or undefined if the array is empty.
|
|
115
115
|
* @template T
|
|
116
|
-
* @param {
|
|
116
|
+
* @param {any[]|string} arr - The input array.
|
|
117
117
|
* @returns {T | undefined} The last element or undefined.
|
|
118
118
|
*/
|
|
119
|
-
export function tail<T>(arr:
|
|
119
|
+
export function tail<T>(arr: any[] | string): T | undefined;
|
|
120
120
|
/**
|
|
121
121
|
* shallow copy from src to dest
|
|
122
122
|
*/
|
package/@types/shared/dom.d.ts
CHANGED
|
@@ -37,16 +37,6 @@ export function getExpando(
|
|
|
37
37
|
* @returns {boolean} True if the string is plain text, false if it contains HTML tags or entities.
|
|
38
38
|
*/
|
|
39
39
|
export function isTextNode(html: string): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* @param {string} html
|
|
42
|
-
* @returns {DocumentFragment}
|
|
43
|
-
*/
|
|
44
|
-
export function buildFragment(html: string): DocumentFragment;
|
|
45
|
-
/**
|
|
46
|
-
* @param {string} html
|
|
47
|
-
* @returns {NodeListOf<ChildNode> | HTMLElement[]}
|
|
48
|
-
*/
|
|
49
|
-
export function parseHtml(html: string): NodeListOf<ChildNode> | HTMLElement[];
|
|
50
40
|
/**
|
|
51
41
|
* @param {Element} element
|
|
52
42
|
* @param {boolean} [onlyDescendants]
|
|
@@ -144,18 +134,6 @@ export function getController(
|
|
|
144
134
|
* @returns
|
|
145
135
|
*/
|
|
146
136
|
export function getInheritedData(element: Node, name: string): any;
|
|
147
|
-
/**
|
|
148
|
-
*
|
|
149
|
-
* @param {Node} element
|
|
150
|
-
* @param {string|string[]} name
|
|
151
|
-
* @param {any} [value]
|
|
152
|
-
* @returns {any|undefined}
|
|
153
|
-
*/
|
|
154
|
-
export function setInheritedData(
|
|
155
|
-
element: Node,
|
|
156
|
-
name: string | string[],
|
|
157
|
-
value?: any,
|
|
158
|
-
): any | undefined;
|
|
159
137
|
/**
|
|
160
138
|
*
|
|
161
139
|
* @param {Element} element
|
|
@@ -172,9 +150,9 @@ export function startingTag(elementOrStr: string | Element | Node): string;
|
|
|
172
150
|
/**
|
|
173
151
|
* Return the DOM siblings between the first and last node in the given array.
|
|
174
152
|
* @param {Array<Node>} nodes An array-like object
|
|
175
|
-
* @returns {
|
|
153
|
+
* @returns {*[]|Array<Node>} the inputted object or a JQLite collection containing the nodes
|
|
176
154
|
*/
|
|
177
|
-
export function getBlockNodes(nodes: Array<Node>):
|
|
155
|
+
export function getBlockNodes(nodes: Array<Node>): any[] | Array<Node>;
|
|
178
156
|
/**
|
|
179
157
|
* Gets the name of a boolean attribute if it exists on a given element.
|
|
180
158
|
*
|
|
@@ -210,26 +188,11 @@ export function createElementFromHTML(htmlString: string): Element;
|
|
|
210
188
|
* @returns {NodeList} - The parsed DOM element.
|
|
211
189
|
*/
|
|
212
190
|
export function createNodelistFromHTML(htmlString: string): NodeList;
|
|
213
|
-
/**
|
|
214
|
-
* Appends nodes or an HTML string to a given DOM element.
|
|
215
|
-
* @param {Element} element - The element to append nodes to.
|
|
216
|
-
* @param {Node | Node[] | string} nodes - Nodes or HTML string to append.
|
|
217
|
-
*/
|
|
218
|
-
export function appendNodesToElement(
|
|
219
|
-
element: Element,
|
|
220
|
-
nodes: Node | Node[] | string,
|
|
221
|
-
): void;
|
|
222
191
|
/**
|
|
223
192
|
* Remove element from the DOM and clear Cache data, associated with the node.
|
|
224
193
|
* @param {Element} element
|
|
225
194
|
*/
|
|
226
195
|
export function emptyElement(element: Element): void;
|
|
227
|
-
/**
|
|
228
|
-
* Checks if the element is root
|
|
229
|
-
* @param {Element} element
|
|
230
|
-
* @returns {boolean}
|
|
231
|
-
*/
|
|
232
|
-
export function isRoot(element: Element): boolean;
|
|
233
196
|
/**
|
|
234
197
|
* Inserts a DOM element before or at the beginning of a parent element.
|
|
235
198
|
*
|
|
@@ -239,7 +202,7 @@ export function isRoot(element: Element): boolean;
|
|
|
239
202
|
* @param {HTMLElement | Element} parentElement
|
|
240
203
|
* The parent element that will receive the inserted element.
|
|
241
204
|
*
|
|
242
|
-
* @param {
|
|
205
|
+
* @param {ChildNode | Element | null} [afterElement]
|
|
243
206
|
* An optional sibling element — if present and valid, `element`
|
|
244
207
|
* will be inserted after it. If omitted or invalid, `element`
|
|
245
208
|
* is prepended to `parentElement`.
|
|
@@ -249,15 +212,31 @@ export function isRoot(element: Element): boolean;
|
|
|
249
212
|
export function domInsert(
|
|
250
213
|
element: HTMLElement | Element,
|
|
251
214
|
parentElement: HTMLElement | Element,
|
|
252
|
-
afterElement?:
|
|
215
|
+
afterElement?: ChildNode | Element | null,
|
|
216
|
+
): void;
|
|
217
|
+
/**
|
|
218
|
+
* @param {HTMLElement} element
|
|
219
|
+
* @param {HTMLElement} parent
|
|
220
|
+
* @param {ChildNode | null | undefined} after
|
|
221
|
+
*/
|
|
222
|
+
export function animatedomInsert(
|
|
223
|
+
element: HTMLElement,
|
|
224
|
+
parent: HTMLElement,
|
|
225
|
+
after: ChildNode | null | undefined,
|
|
253
226
|
): void;
|
|
254
|
-
export function animatedomInsert(element: any, parent: any, after: any): void;
|
|
255
227
|
/**
|
|
256
228
|
* Returns the base href of the document.
|
|
257
229
|
*
|
|
258
230
|
* @returns {string} The base href.
|
|
259
231
|
*/
|
|
260
232
|
export function getBaseHref(): string;
|
|
233
|
+
/**
|
|
234
|
+
* Expando cache for adding properties to DOM nodes with JavaScript.
|
|
235
|
+
* This used to be an Object in JQLite decorator, but swapped out for a Map
|
|
236
|
+
*
|
|
237
|
+
* @type {Map<number, import('../interface.ts').ExpandoStore>}
|
|
238
|
+
*/
|
|
239
|
+
export const Cache: Map<number, import("../interface.ts").ExpandoStore>;
|
|
261
240
|
/**
|
|
262
241
|
* A list of boolean attributes in HTML.
|
|
263
242
|
* @type {string[]}
|
package/@types/shared/hof.d.ts
CHANGED
|
@@ -36,17 +36,10 @@
|
|
|
36
36
|
*
|
|
37
37
|
* ```
|
|
38
38
|
*
|
|
39
|
-
* @param fn
|
|
39
|
+
* @param {Function} fn
|
|
40
40
|
* @returns {*|function(): (*|any)}
|
|
41
41
|
*/
|
|
42
|
-
export function curry(fn:
|
|
43
|
-
/**
|
|
44
|
-
* Given a varargs list of functions, returns a function that composes the argument functions, right-to-left
|
|
45
|
-
* given: f(x), g(x), h(x)
|
|
46
|
-
* let composed = compose(f,g,h)
|
|
47
|
-
* then, composed is: f(g(h(x)))
|
|
48
|
-
*/
|
|
49
|
-
export function compose(...fns: any[]): (...args: any[]) => any;
|
|
42
|
+
export function curry(fn: Function): any | (() => any | any);
|
|
50
43
|
/**
|
|
51
44
|
* Given a class constructor, returns a predicate function that checks
|
|
52
45
|
* whether a given object is an instance of that class.
|
|
@@ -69,33 +62,30 @@ export function is(ctor: new (...args: any[]) => any): (obj: any) => boolean;
|
|
|
69
62
|
* of size 2: [ predicate, mapFn ]
|
|
70
63
|
*
|
|
71
64
|
* These 2-tuples should be put in an outer array.
|
|
72
|
-
*
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
*
|
|
92
|
-
|
|
93
|
-
*
|
|
94
|
-
* @param struct A 2D array. Each element of the array should be an array, a 2-tuple,
|
|
95
|
-
* with a Predicate and a mapping/output function
|
|
96
|
-
* @returns {function(any): *}
|
|
65
|
+
* @example ```
|
|
66
|
+
|
|
67
|
+
// Here's a 2-tuple where the first element is the isString predicate
|
|
68
|
+
// and the second element is a function that returns a description of the input
|
|
69
|
+
let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];
|
|
70
|
+
|
|
71
|
+
// Second tuple: predicate "isNumber", mapfn returns a description
|
|
72
|
+
let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];
|
|
73
|
+
|
|
74
|
+
let third = [ (input) => input === null, (input) => `Oh, null...` ];
|
|
75
|
+
|
|
76
|
+
let fourth = [ (input) => input === undefined, (input) => `notdefined` ];
|
|
77
|
+
|
|
78
|
+
let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);
|
|
79
|
+
|
|
80
|
+
console.log(descriptionOf(undefined)); // 'notdefined'
|
|
81
|
+
console.log(descriptionOf(55)); // '(55) That's a number!'
|
|
82
|
+
console.log(descriptionOf("foo")); // 'Here's your string foo'
|
|
83
|
+
```
|
|
84
|
+
* @param {string | any[]} struct A 2D array. Each element of the array should be an array, a 2-tuple,
|
|
85
|
+
with a Predicate and a mapping/output function
|
|
86
|
+
* @returns {function(any):*}
|
|
97
87
|
*/
|
|
98
|
-
export function pattern(struct: any): (arg0: any) => any;
|
|
88
|
+
export function pattern(struct: string | any[]): (arg0: any) => any;
|
|
99
89
|
/**
|
|
100
90
|
* Given a property name and a value, returns a function that returns a boolean based on whether
|
|
101
91
|
* the passed object has a property that matches the value
|
|
@@ -104,5 +94,5 @@ export function pattern(struct: any): (arg0: any) => any;
|
|
|
104
94
|
* getName(obj) === true
|
|
105
95
|
*/
|
|
106
96
|
export const propEq: any;
|
|
107
|
-
export function parse(path:
|
|
108
|
-
export function val(value:
|
|
97
|
+
export function parse(path: string): (/** @type {any} */ obj: any) => any;
|
|
98
|
+
export function val<T>(value: T): () => T;
|
|
@@ -9,11 +9,11 @@ export class NodeRef {
|
|
|
9
9
|
* @throws {Error} If the argument is invalid or cannot be wrapped properly.
|
|
10
10
|
*/
|
|
11
11
|
constructor(element: Node | Element | string | NodeList | Node[]);
|
|
12
|
-
/** @private @type {Node | ChildNode |
|
|
12
|
+
/** @private @type {Node | ChildNode | undefined} */
|
|
13
13
|
private _node;
|
|
14
14
|
/** @type {Element | undefined} */
|
|
15
15
|
_element: Element | undefined;
|
|
16
|
-
/** @private @type {Array<Node>
|
|
16
|
+
/** @private @type {Array<Node>} a stable list on nodes */
|
|
17
17
|
private _nodes;
|
|
18
18
|
/** @type {boolean} */
|
|
19
19
|
_isList: boolean;
|
|
@@ -34,7 +34,11 @@ export function functionToString(fn: Function): string;
|
|
|
34
34
|
* @returns {string}
|
|
35
35
|
*/
|
|
36
36
|
export function fnToString(fn: [] | Function): string;
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* @param {any} value
|
|
39
|
+
* @returns {string|*|string}
|
|
40
|
+
*/
|
|
41
|
+
export function stringify(value: any): string | any | string;
|
|
38
42
|
/**
|
|
39
43
|
* Splits on a delimiter, but returns the delimiters in the array
|
|
40
44
|
*
|
|
@@ -44,8 +48,11 @@ export function stringify(value: any): any;
|
|
|
44
48
|
* splitOnSlashes("/foo"); // ["/", "foo"]
|
|
45
49
|
* splitOnSlashes("/foo/"); // ["/", "foo", "/"]
|
|
46
50
|
* ```
|
|
51
|
+
* @param {string} delim
|
|
47
52
|
*/
|
|
48
|
-
export function splitOnDelim(
|
|
53
|
+
export function splitOnDelim(
|
|
54
|
+
delim: string,
|
|
55
|
+
): (/** @type {string} */ str: string) => string[];
|
|
49
56
|
/**
|
|
50
57
|
* Reduce fn that joins neighboring strings
|
|
51
58
|
*
|
|
@@ -57,6 +64,8 @@ export function splitOnDelim(delim: any): (str: any) => any;
|
|
|
57
64
|
* let arr = ["foo", "bar", 1, "baz", "", "qux" ];
|
|
58
65
|
* arr.reduce(joinNeighborsR, []) // ["foobar", 1, "bazqux" ]
|
|
59
66
|
* ```
|
|
67
|
+
* @param {string | any[]} acc
|
|
68
|
+
* @param {unknown} str
|
|
60
69
|
*/
|
|
61
|
-
export function joinNeighborsR(acc: any, str:
|
|
62
|
-
export function stripLastPathElement(str:
|
|
70
|
+
export function joinNeighborsR(acc: string | any[], str: unknown): any;
|
|
71
|
+
export function stripLastPathElement(str: string): string;
|
package/@types/shared/utils.d.ts
CHANGED
|
@@ -68,7 +68,7 @@ export function isArray<T>(array: any): array is T[];
|
|
|
68
68
|
* @param {new (...args: any[]) => T} type The constructor to test against
|
|
69
69
|
* @returns {val is T}
|
|
70
70
|
*/
|
|
71
|
-
export function
|
|
71
|
+
export function isInstanceOf<T>(
|
|
72
72
|
val: any,
|
|
73
73
|
type: new (...args: any[]) => T,
|
|
74
74
|
): val is T;
|
|
@@ -90,11 +90,10 @@ export function isObject<T>(value: T): value is T & object;
|
|
|
90
90
|
export function isBlankObject(value: any): boolean;
|
|
91
91
|
/**
|
|
92
92
|
* Determines if a reference is a `string`.
|
|
93
|
-
*
|
|
94
|
-
* @param value - The value to check.
|
|
93
|
+
* @param {unknown} value - The value to check.
|
|
95
94
|
* @returns {value is string} True if `value` is a string.
|
|
96
95
|
*/
|
|
97
|
-
export function isString(value:
|
|
96
|
+
export function isString(value: unknown): value is string;
|
|
98
97
|
/**
|
|
99
98
|
* Determines if a reference is a null.
|
|
100
99
|
*
|
|
@@ -211,13 +210,23 @@ export function isArrayBuffer(obj: any): boolean;
|
|
|
211
210
|
* @returns {string | *}
|
|
212
211
|
*/
|
|
213
212
|
export function trim(value: any): string | any;
|
|
214
|
-
|
|
213
|
+
/**
|
|
214
|
+
* @param {string} name
|
|
215
|
+
* @param {string} separator
|
|
216
|
+
*/
|
|
217
|
+
export function snakeCase(name: string, separator: string): string;
|
|
215
218
|
/**
|
|
216
219
|
* Set or clear the hashkey for an object.
|
|
217
|
-
* @param obj object
|
|
218
|
-
* @param hashkey the hashkey (!truthy to delete the hashkey)
|
|
220
|
+
* @param {{ [x: string]: any; _hashKey?: any; }} obj object
|
|
221
|
+
* @param {any} hashkey the hashkey (!truthy to delete the hashkey)
|
|
219
222
|
*/
|
|
220
|
-
export function setHashKey(
|
|
223
|
+
export function setHashKey(
|
|
224
|
+
obj: {
|
|
225
|
+
[x: string]: any;
|
|
226
|
+
_hashKey?: any;
|
|
227
|
+
},
|
|
228
|
+
hashkey: any,
|
|
229
|
+
): void;
|
|
221
230
|
/**
|
|
222
231
|
* Deeply extends a destination object with one or more source objects.
|
|
223
232
|
* Safely handles Dates, RegExps, DOM nodes, arrays, and nested objects.
|
|
@@ -262,17 +271,25 @@ export function isNumberNaN(num: any): boolean;
|
|
|
262
271
|
* @returns {Object}
|
|
263
272
|
*/
|
|
264
273
|
export function inherit(parent: any, extra: any): any;
|
|
265
|
-
|
|
274
|
+
/**
|
|
275
|
+
* @param {{ toString: () => string; }} obj
|
|
276
|
+
* @returns {boolean}
|
|
277
|
+
*/
|
|
278
|
+
export function hasCustomToString(obj: { toString: () => string }): boolean;
|
|
266
279
|
/**
|
|
267
280
|
* Returns a string appropriate for the type of node.
|
|
268
281
|
*
|
|
269
282
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/nodeName)
|
|
270
283
|
*
|
|
271
284
|
* @param {Element} element
|
|
272
|
-
* @returns
|
|
285
|
+
* @returns {string}
|
|
273
286
|
*/
|
|
274
287
|
export function getNodeName(element: Element): string;
|
|
275
|
-
|
|
288
|
+
/**
|
|
289
|
+
* @param {any} array
|
|
290
|
+
* @param {string} obj
|
|
291
|
+
*/
|
|
292
|
+
export function includes(array: any, obj: string): boolean;
|
|
276
293
|
/**
|
|
277
294
|
* Removes the first occurrence of a specified value from an array.
|
|
278
295
|
*
|
|
@@ -282,7 +299,11 @@ export function includes(array: any, obj: any): boolean;
|
|
|
282
299
|
* @returns {number} - The index of the removed value, or -1 if the value was not found.
|
|
283
300
|
*/
|
|
284
301
|
export function arrayRemove<T>(array: Array<T>, value: T): number;
|
|
285
|
-
|
|
302
|
+
/**
|
|
303
|
+
* @param {unknown} val1
|
|
304
|
+
* @param {unknown} val2
|
|
305
|
+
*/
|
|
306
|
+
export function simpleCompare(val1: unknown, val2: unknown): boolean;
|
|
286
307
|
/**
|
|
287
308
|
* Determines if two objects or two values are equivalent. Supports value types, regular
|
|
288
309
|
* expressions, arrays and objects.
|
|
@@ -347,14 +368,34 @@ export function equals(o1: any, o2: any): boolean;
|
|
|
347
368
|
* @param {string} context the context in which the name is used, such as module or directive
|
|
348
369
|
*/
|
|
349
370
|
export function assertNotHasOwnProperty(name: string, context: string): void;
|
|
350
|
-
|
|
371
|
+
/**
|
|
372
|
+
* @param {unknown} value
|
|
373
|
+
* @returns {string | unknown}
|
|
374
|
+
*/
|
|
375
|
+
export function stringify(value: unknown): string | unknown;
|
|
351
376
|
/**
|
|
352
377
|
* @param {Number} maxDepth
|
|
353
378
|
* @return {boolean}
|
|
354
379
|
*/
|
|
355
380
|
export function isValidObjectMaxDepth(maxDepth: number): boolean;
|
|
356
|
-
|
|
357
|
-
|
|
381
|
+
/**
|
|
382
|
+
* @param {any[]} array1
|
|
383
|
+
* @param {IArguments | any[] | NodeListOf<ChildNode>} array2
|
|
384
|
+
* @param {number | undefined} [index]
|
|
385
|
+
*/
|
|
386
|
+
export function concat(
|
|
387
|
+
array1: any[],
|
|
388
|
+
array2: IArguments | any[] | NodeListOf<ChildNode>,
|
|
389
|
+
index?: number | undefined,
|
|
390
|
+
): any[];
|
|
391
|
+
/**
|
|
392
|
+
* @param {IArguments | [string, ...any[]]} args
|
|
393
|
+
* @param {number} startIndex
|
|
394
|
+
*/
|
|
395
|
+
export function sliceArgs(
|
|
396
|
+
args: IArguments | [string, ...any[]],
|
|
397
|
+
startIndex: number,
|
|
398
|
+
): any;
|
|
358
399
|
/**
|
|
359
400
|
* Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for
|
|
360
401
|
* `fn`). You can supply optional `args` that are prebound to the function. This feature is also
|
|
@@ -367,62 +408,53 @@ export function sliceArgs(args: any, startIndex: any): any;
|
|
|
367
408
|
*/
|
|
368
409
|
export function bind(context: any, fn: any, ...args: any[]): Function;
|
|
369
410
|
/**
|
|
370
|
-
* Serializes input into a JSON-formatted string. Properties with leading
|
|
371
|
-
* stripped since AngularTS uses this notation internally.
|
|
372
|
-
*
|
|
373
|
-
* @param {Object|Array
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
* object with an invalid date value. The only reliable way to prevent this is to monkeypatch the
|
|
381
|
-
* `Date.prototype.toJSON` method as follows:
|
|
382
|
-
*
|
|
383
|
-
* ```
|
|
384
|
-
* let _DatetoJSON = Date.prototype.toJSON;
|
|
385
|
-
* Date.prototype.toJSON = function() {
|
|
386
|
-
* try {
|
|
387
|
-
* return _DatetoJSON.call(this);
|
|
388
|
-
* } catch(e) {
|
|
389
|
-
* if (e instanceof RangeError) {
|
|
390
|
-
* return null;
|
|
391
|
-
* }
|
|
392
|
-
* throw e;
|
|
393
|
-
* }
|
|
394
|
-
* };
|
|
395
|
-
* ```
|
|
396
|
-
*
|
|
397
|
-
* See https://github.com/angular/angular.js/pull/14221 for more information.
|
|
411
|
+
* Serializes input into a JSON-formatted string. Properties with leading `$$` characters
|
|
412
|
+
* will be stripped since AngularTS uses this notation internally.
|
|
413
|
+
*
|
|
414
|
+
* @param {Object|Array<any>|Date|string|number|boolean} obj
|
|
415
|
+
* Input to be serialized into JSON.
|
|
416
|
+
* @param {boolean|number} [pretty=2]
|
|
417
|
+
* If `true`, the JSON output will contain newlines and whitespace (2 spaces).
|
|
418
|
+
* If a number, the JSON output will contain that many spaces per indentation.
|
|
419
|
+
* @returns {string|undefined}
|
|
420
|
+
* JSON-ified string representing `obj`, or `undefined` if `obj` is undefined.
|
|
398
421
|
*/
|
|
399
422
|
export function toJson(
|
|
400
|
-
obj: any | any
|
|
423
|
+
obj: any | Array<any> | Date | string | number | boolean,
|
|
401
424
|
pretty?: boolean | number,
|
|
402
425
|
): string | undefined;
|
|
403
426
|
/**
|
|
404
427
|
* Deserializes a JSON string.
|
|
405
428
|
*
|
|
406
429
|
* @param {string} json JSON string to deserialize.
|
|
407
|
-
* @returns {Object|Array
|
|
430
|
+
* @returns {Object|Array<any>|string|number} Deserialized JSON string.
|
|
431
|
+
*/
|
|
432
|
+
export function fromJson(json: string): any | Array<any> | string | number;
|
|
433
|
+
/**
|
|
434
|
+
* @param {Date} date
|
|
435
|
+
* @param {number} minutes
|
|
408
436
|
*/
|
|
409
|
-
export function
|
|
410
|
-
export function timezoneToOffset(timezone: any, fallback: any): any;
|
|
411
|
-
export function addDateMinutes(date: any, minutes: any): Date;
|
|
412
|
-
export function convertTimezoneToLocal(
|
|
413
|
-
date: any,
|
|
414
|
-
timezone: any,
|
|
415
|
-
reverse: any,
|
|
416
|
-
): Date;
|
|
437
|
+
export function addDateMinutes(date: Date, minutes: number): Date;
|
|
417
438
|
/**
|
|
418
439
|
* Parses an escaped url query string into key-value pairs.
|
|
419
440
|
* @param {string} keyValue
|
|
420
|
-
* @returns {Object.<string,boolean|Array
|
|
441
|
+
* @returns {Object.<string,boolean|Array<any>>}
|
|
421
442
|
*/
|
|
422
443
|
export function parseKeyValue(keyValue: string): {
|
|
423
444
|
[x: string]: boolean | any[];
|
|
424
445
|
};
|
|
425
|
-
|
|
446
|
+
/**
|
|
447
|
+
* @param {string | { [s: string]: any; } | ArrayLike<any> | null} obj
|
|
448
|
+
*/
|
|
449
|
+
export function toKeyValue(
|
|
450
|
+
obj:
|
|
451
|
+
| string
|
|
452
|
+
| {
|
|
453
|
+
[s: string]: any;
|
|
454
|
+
}
|
|
455
|
+
| ArrayLike<any>
|
|
456
|
+
| null,
|
|
457
|
+
): string;
|
|
426
458
|
/**
|
|
427
459
|
* Tries to decode the URI component without throwing an exception.
|
|
428
460
|
*
|
|
@@ -453,14 +485,27 @@ export function encodeUriSegment(val: string): string;
|
|
|
453
485
|
* pct-encoded = "%" HEXDIG HEXDIG
|
|
454
486
|
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
|
|
455
487
|
* / "*" / "+" / "," / ";" / "="
|
|
488
|
+
* @param {string | number | boolean} val
|
|
489
|
+
* @param {boolean | undefined} [pctEncodeSpaces]
|
|
456
490
|
*/
|
|
457
|
-
export function encodeUriQuery(
|
|
491
|
+
export function encodeUriQuery(
|
|
492
|
+
val: string | number | boolean,
|
|
493
|
+
pctEncodeSpaces?: boolean | undefined,
|
|
494
|
+
): string;
|
|
458
495
|
/**
|
|
459
|
-
* Creates a shallow copy of an object, an array or
|
|
496
|
+
* Creates a shallow copy of an object, an array, or returns primitives as-is.
|
|
460
497
|
*
|
|
461
|
-
* Assumes
|
|
498
|
+
* Assumes there are no proto properties.
|
|
499
|
+
*
|
|
500
|
+
* @template T
|
|
501
|
+
* @param {T} src
|
|
502
|
+
* @param {T extends any[] ? T : Record<string, unknown>} [dst]
|
|
503
|
+
* @returns {T}
|
|
462
504
|
*/
|
|
463
|
-
export function shallowCopy(
|
|
505
|
+
export function shallowCopy<T>(
|
|
506
|
+
src: T,
|
|
507
|
+
dst?: T extends any[] ? T : Record<string, unknown>,
|
|
508
|
+
): T;
|
|
464
509
|
/**
|
|
465
510
|
* Throw error if the argument is false
|
|
466
511
|
* @param {boolean} argument
|
|
@@ -469,13 +514,25 @@ export function shallowCopy(src: any, dst: any): any;
|
|
|
469
514
|
export function assert(argument: boolean, errorMsg?: string): void;
|
|
470
515
|
/**
|
|
471
516
|
* Throw error if the argument is falsy.
|
|
517
|
+
* @param {string | boolean | Object} arg
|
|
518
|
+
* @param {string} name
|
|
519
|
+
* @param {string | undefined} [reason]
|
|
520
|
+
*/
|
|
521
|
+
export function assertArg(
|
|
522
|
+
arg: string | boolean | any,
|
|
523
|
+
name: string,
|
|
524
|
+
reason?: string | undefined,
|
|
525
|
+
): any;
|
|
526
|
+
/**
|
|
527
|
+
* @param {string | Function | any[]} arg
|
|
528
|
+
* @param {string} name
|
|
529
|
+
* @param {boolean | undefined} [acceptArrayAnnotation]
|
|
472
530
|
*/
|
|
473
|
-
export function assertArg(arg: any, name: any, reason: any): any;
|
|
474
531
|
export function assertArgFn(
|
|
475
|
-
arg: any,
|
|
476
|
-
name:
|
|
477
|
-
acceptArrayAnnotation
|
|
478
|
-
): any;
|
|
532
|
+
arg: string | Function | any[],
|
|
533
|
+
name: string,
|
|
534
|
+
acceptArrayAnnotation?: boolean | undefined,
|
|
535
|
+
): string | Function | any[];
|
|
479
536
|
/**
|
|
480
537
|
* Configure several aspects of error handling if used as a setter or return the
|
|
481
538
|
* current configuration if used as a getter.
|
|
@@ -527,8 +584,8 @@ export function toDebugString<T>(obj: T | ng.Scope): string;
|
|
|
527
584
|
* Hash of a:
|
|
528
585
|
* string is string
|
|
529
586
|
* number is number as string
|
|
530
|
-
* object is either result of calling
|
|
531
|
-
* that is also assigned to the
|
|
587
|
+
* object is either result of calling _hashKey function on the object or uniquely generated id,
|
|
588
|
+
* that is also assigned to the _hashKey property of the object.
|
|
532
589
|
*
|
|
533
590
|
* @param {*} obj
|
|
534
591
|
* @returns {string} hash string such that the same input will have the same hash string.
|
|
@@ -31,6 +31,13 @@ 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
|
+
* @param {*} arg - The value to validate.
|
|
36
|
+
* @param {string} name - Parameter name (included in error message).
|
|
37
|
+
* @returns {number} The validated value.
|
|
38
|
+
* @throws {TypeError} If the value is not a number.
|
|
39
|
+
*/
|
|
40
|
+
export function validateIsNumber(arg: any, name: string): number;
|
|
34
41
|
/**
|
|
35
42
|
* @template T
|
|
36
43
|
* @param {unknown} arg - The value to validate.
|