@angular-wave/angular.ts 0.15.0 → 0.15.2

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 (62) hide show
  1. package/@types/angular.d.ts +4 -1
  2. package/@types/core/compile/attributes.d.ts +28 -4
  3. package/@types/core/compile/inteface.d.ts +5 -1
  4. package/@types/core/di/inteface.d.ts +11 -0
  5. package/@types/core/parse/ast/ast-node.d.ts +2 -0
  6. package/@types/core/parse/parse.d.ts +4 -1
  7. package/@types/core/scope/interface.d.ts +26 -0
  8. package/@types/core/scope/scope.d.ts +16 -24
  9. package/@types/directive/bind/bind.d.ts +5 -7
  10. package/@types/directive/form/form.d.ts +12 -9
  11. package/@types/directive/init/init.d.ts +2 -2
  12. package/@types/directive/input/input.d.ts +8 -24
  13. package/@types/directive/listener/listener.d.ts +4 -0
  14. package/@types/directive/model/interface.d.ts +18 -0
  15. package/@types/directive/model/model.d.ts +20 -18
  16. package/@types/directive/non-bindable/non-bindable.d.ts +2 -2
  17. package/@types/directive/select/select.d.ts +2 -2
  18. package/@types/directive/setter/setter.d.ts +2 -2
  19. package/@types/directive/show-hide/show-hide.d.ts +3 -4
  20. package/@types/directive/switch/switch.d.ts +4 -4
  21. package/@types/interface.d.ts +22 -1
  22. package/@types/namespace.d.ts +16 -2
  23. package/@types/router/router.d.ts +5 -3
  24. package/@types/router/scroll/interface.d.ts +1 -1
  25. package/@types/router/state/interface.d.ts +5 -0
  26. package/@types/router/state/state-builder.d.ts +10 -6
  27. package/@types/router/state/state-matcher.d.ts +11 -3
  28. package/@types/router/state/state-object.d.ts +3 -5
  29. package/@types/router/state/state-queue-manager.d.ts +14 -8
  30. package/@types/router/state/state-registry.d.ts +12 -3
  31. package/@types/router/state/state-service.d.ts +8 -2
  32. package/@types/router/transition/hook-registry.d.ts +15 -5
  33. package/@types/router/transition/transition.d.ts +4 -2
  34. package/@types/router/url/url-rules.d.ts +3 -84
  35. package/@types/router/url/url-service.d.ts +9 -8
  36. package/@types/services/cookie/cookie.d.ts +3 -11
  37. package/@types/services/http/http.d.ts +6 -31
  38. package/@types/services/http/interface.d.ts +22 -7
  39. package/@types/services/location/location.d.ts +14 -13
  40. package/@types/services/sce/interface.d.ts +25 -0
  41. package/@types/services/sse/interface.d.ts +8 -1
  42. package/@types/services/sse/sse.d.ts +10 -18
  43. package/@types/services/storage/storage.d.ts +6 -6
  44. package/@types/services/stream/interface.d.ts +1 -1
  45. package/@types/services/stream/stream.d.ts +98 -0
  46. package/@types/services/template-request/interface.d.ts +2 -9
  47. package/@types/services/template-request/template-request.d.ts +7 -40
  48. package/@types/shared/common.d.ts +2 -2
  49. package/@types/shared/dom.d.ts +21 -42
  50. package/@types/shared/hof.d.ts +27 -37
  51. package/@types/shared/noderef.d.ts +2 -2
  52. package/@types/shared/strings.d.ts +13 -4
  53. package/@types/shared/utils.d.ts +123 -76
  54. package/@types/shared/validate.d.ts +7 -0
  55. package/dist/angular-ts.esm.js +1129 -1407
  56. package/dist/angular-ts.umd.js +1129 -1407
  57. package/dist/angular-ts.umd.min.js +1 -1
  58. package/dist/angular-ts.umd.min.js.gz +0 -0
  59. package/dist/angular-ts.umd.min.js.map +1 -1
  60. package/package.json +1 -1
  61. package/@types/router/state-filters.d.ts +0 -39
  62. package/@types/shared/cache.d.ts +0 -7
@@ -182,13 +182,13 @@ export class Location {
182
182
  * Current url
183
183
  * @type {string}
184
184
  */
185
- $$url: string;
185
+ _url: string;
186
186
  /**
187
187
  * @ignore
188
188
  * Callback to update browser url
189
- * @type {Function}
189
+ * @type {Function | undefined}
190
190
  */
191
- $$updateBrowser: Function;
191
+ _updateBrowser: Function | undefined;
192
192
  /**
193
193
  * Change path, search and hash, when called with parameter and return `$location`.
194
194
  *
@@ -249,7 +249,7 @@ export class Location {
249
249
  * @private
250
250
  * Compose url and update `url` and `absUrl` property
251
251
  */
252
- private $$compose;
252
+ private _compose;
253
253
  /**
254
254
  * Change the history state object when called with one parameter and return `$location`.
255
255
  * The state object is later passed to `pushState` or `replaceState`.
@@ -285,15 +285,16 @@ export class LocationProvider {
285
285
  hashPrefixConf: string;
286
286
  /** @type {import("./interface.ts").Html5Mode} */
287
287
  html5ModeConf: import("./interface.ts").Html5Mode;
288
- /** @type {Array<import("./interface.ts").UrlChangeListener>} */
289
- urlChangeListeners: Array<import("./interface.ts").UrlChangeListener>;
290
- urlChangeInit: boolean;
291
- /** @type {History['state']} */
292
- cachedState: History["state"];
293
- /** @type {History['state']} */
294
- lastHistoryState: History["state"];
295
- /** @type {string} */
296
- lastBrowserUrl: string;
288
+ /** @private @type {Array<import("./interface.ts").UrlChangeListener>} */
289
+ private _urlChangeListeners;
290
+ /** @private */
291
+ private _urlChangeInit;
292
+ /** @private @type {History['state']} */
293
+ private _cachedState;
294
+ /** @private @type {History['state']} */
295
+ private _lastHistoryState;
296
+ /** @private @type {string} */
297
+ private _lastBrowserUrl;
297
298
  /**
298
299
  * Updates the browser's current URL and history state.
299
300
  *
@@ -0,0 +1,25 @@
1
+ export interface SCEService {
2
+ getTrusted(type: string, mayBeTrusted: any): any;
3
+ getTrustedCss(value: any): any;
4
+ getTrustedHtml(value: any): any;
5
+ getTrustedJs(value: any): any;
6
+ getTrustedResourceUrl(value: any): any;
7
+ getTrustedUrl(value: any): any;
8
+ parse(type: string, expression: string): (context: any, locals: any) => any;
9
+ parseAsCss(expression: string): (context: any, locals: any) => any;
10
+ parseAsHtml(expression: string): (context: any, locals: any) => any;
11
+ parseAsJs(expression: string): (context: any, locals: any) => any;
12
+ parseAsResourceUrl(expression: string): (context: any, locals: any) => any;
13
+ parseAsUrl(expression: string): (context: any, locals: any) => any;
14
+ trustAs(type: string, value: any): any;
15
+ trustAsHtml(value: any): any;
16
+ trustAsJs(value: any): any;
17
+ trustAsResourceUrl(value: any): any;
18
+ trustAsUrl(value: any): any;
19
+ isEnabled(): boolean;
20
+ }
21
+ export interface SCEDelegateService {
22
+ getTrusted(type: string, mayBeTrusted: any): any;
23
+ trustAs(type: string, value: any): any;
24
+ valueOf(value: any): any;
25
+ }
@@ -32,11 +32,18 @@ export interface SseConfig {
32
32
  export interface SseConnection {
33
33
  /** Manually close the SSE connection and stop all reconnect attempts */
34
34
  close(): void;
35
- /** Manually restart the SSE connection */
35
+ /**
36
+ * Manually restart the SSE connection.
37
+ * @remarks
38
+ * Any previous event listeners are preserved; reconnects use the original configuration.
39
+ */
36
40
  connect(): void;
37
41
  }
38
42
  /**
39
43
  * $sse service type
40
44
  * Returns a managed SSE connection that automatically reconnects when needed.
45
+ * @param url - The endpoint to connect to
46
+ * @param config - Optional configuration object
47
+ * @throws {URIError} If the URL is invalid
41
48
  */
42
49
  export type SseService = (url: string, config?: SseConfig) => SseConnection;
@@ -1,23 +1,15 @@
1
- /**
2
- * SSE Provider
3
- *
4
- * Usage:
5
- * const source = $sse('/events', {
6
- * onMessage: (data) => console.log(data),
7
- * onError: (err) => console.error(err),
8
- * retryDelay: 2000,
9
- * heartbeatTimeout: 10000,
10
- * });
11
- *
12
- * source.close();
13
- */
14
1
  export class SseProvider {
15
- /**
16
- * Optional provider-level defaults
17
- * @type {ng.SseConfig}
18
- */
2
+ /** @type {ng.SseConfig} */
19
3
  defaults: ng.SseConfig;
20
- $get: (string | ((log: ng.LogService) => ng.SseService))[];
4
+ $get: (
5
+ | string
6
+ | ((
7
+ log: ng.LogService,
8
+ ) => (
9
+ url: string,
10
+ config?: import("./interface.ts").SseConfig,
11
+ ) => import("./interface.ts").SseConnection)
12
+ )[];
21
13
  _$log: import("../log/interface.ts").LogService;
22
14
  #private;
23
15
  }
@@ -2,18 +2,18 @@
2
2
  * Creates a proxy that automatically persists an object's state
3
3
  * into a storage backend whenever a property is set.
4
4
  *
5
- * @param {object} target - The object to wrap
5
+ * @param {Record<PropertyKey, any>} target - The object to wrap
6
6
  * @param {string} key - The storage key
7
- * @param {object} storage - Any storage-like object with getItem/setItem/removeItem
7
+ * @param {import("../../core/di/inteface").StorageLike & import("../../core/di/inteface").PersistentStoreConfig} storage - Any storage-like object with getItem/setItem/removeItem
8
8
  * @param {{serialize?: function, deserialize?: function}} [options] - Optional custom (de)serialization
9
- * @returns {Proxy}
9
+ * @returns {Record<PropertyKey, any>}
10
10
  */
11
11
  export function createPersistentProxy(
12
- target: object,
12
+ target: Record<PropertyKey, any>,
13
13
  key: string,
14
- storage: object,
14
+ storage: any & any,
15
15
  options?: {
16
16
  serialize?: Function;
17
17
  deserialize?: Function;
18
18
  },
19
- ): ProxyConstructor;
19
+ ): Record<PropertyKey, any>;
@@ -2,7 +2,7 @@ export interface StreamConnectionConfig {
2
2
  /** Called when the connection opens */
3
3
  onOpen?: (event: Event) => void;
4
4
  /** Called when a message is received */
5
- onMessage?: (data: any, event: Event) => void;
5
+ onMessage?: (data: any, event: Event | MessageEvent) => void;
6
6
  /** Called when an error occurs */
7
7
  onError?: (err: any) => void;
8
8
  /** Called when a reconnect attempt happens */
@@ -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
+ }
@@ -7,16 +7,9 @@ export interface TemplateRequestService {
7
7
  * empty then a $compile error will be thrown (unless
8
8
  * {ignoreRequestError} is set to true).
9
9
  *
10
- * @param tpl The template URL.
11
- * @param ignoreRequestError Whether or not to ignore the exception
12
- * when the request fails or the template is
13
- * empty.
10
+ * @param templateUrl The template URL.
14
11
  *
15
12
  * @return A promise whose value is the template content.
16
13
  */
17
- (tpl: string, ignoreRequestError?: boolean): Promise<string>;
18
- /**
19
- * total amount of pending template requests being downloaded.
20
- */
21
- totalPendingRequests: number;
14
+ (templateUrl: string): Promise<string>;
22
15
  }
@@ -1,52 +1,19 @@
1
1
  /**
2
- * Used to configure the options passed to the {@link $http} service when making a template request.
2
+ * Provider for the `$templateRequest` service.
3
3
  *
4
- * For example, it can be used for specifying the "Accept" header that is sent to the server, when
5
- * requesting a template.
4
+ * Fetches templates via HTTP and caches them in `$templateCache`.
5
+ * Templates are assumed trusted. This provider allows configuring
6
+ * per-request `$http` options such as headers, timeout, or transform functions.
6
7
  */
7
- export function TemplateRequestProvider(): void;
8
8
  export class TemplateRequestProvider {
9
- /**
10
- * The options to be passed to the {@link $http} service when making the request.
11
- * You can use this to override options such as the "Accept" header for template requests.
12
- * The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the
13
- * options if not overridden here.
14
- *
15
- * @param {string=} val new value for the {@link $http} options.
16
- * @returns {string|TemplateRequestProvider} Returns the {@link $http} options when used as getter and self if used as setter.
17
- */
18
- httpOptions: (val?: string | undefined) => string | TemplateRequestProvider;
19
- /**
20
- * The `$templateRequest` service runs security checks then downloads the provided template using
21
- * `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request
22
- * fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the
23
- * exception can be thwarted by setting the 2nd parameter of the function to true). Note that the
24
- * contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted
25
- * when `tpl` is of type string and `$templateCache` has the matching entry.
26
- *
27
- * If you want to pass custom options to the `$http` service, such as setting the Accept header you
28
- * can configure this via {@link $templateRequestProvider#httpOptions}.
29
- *
30
- * `$templateRequest` is used internally by {@link $compile}, {@link ngRoute.$route}, and directives such
31
- * as {@link ngInclude} to download and cache templates.
32
- *
33
- * 3rd party modules should use `$templateRequest` if their services or directives are loading
34
- * templates.
35
- *
36
- * @param {string} tpl The HTTP request template URL
37
- * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty
38
- *
39
- * @return {Promise} a promise for the HTTP response data of the given URL.
40
- *
41
- * @property {number} totalPendingRequests total amount of pending template requests being downloaded.
42
- */
9
+ /** @type {ng.RequestShortcutConfig|undefined} */
10
+ httpOptions: ng.RequestShortcutConfig | undefined;
11
+ /** @returns {Array} DI tokens for Angular.ts injection */
43
12
  $get: (
44
13
  | string
45
14
  | ((
46
- $exceptionHandler: ng.ExceptionHandlerService,
47
15
  $templateCache: ng.TemplateCacheService,
48
16
  $http: ng.HttpService,
49
- $sce: any,
50
17
  ) => ng.TemplateRequestService)
51
18
  )[];
52
19
  }
@@ -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 {T[]} arr - The input array.
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: T[]): T | undefined;
119
+ export function tail<T>(arr: any[] | string): T | undefined;
120
120
  /**
121
121
  * shallow copy from src to dest
122
122
  */
@@ -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 {Element} the inputted object or a JQLite collection containing the nodes
153
+ * @returns {*[]|Array<Node>} the inputted object or a JQLite collection containing the nodes
176
154
  */
177
- export function getBlockNodes(nodes: Array<Node>): Element;
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 {HTMLElement | Element | null} [afterElement]
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?: HTMLElement | Element | null,
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[]}
@@ -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: any): any | (() => any | any);
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
- * @example
74
- * ```
75
- *
76
- * // Here's a 2-tuple where the first element is the isString predicate
77
- * // and the second element is a function that returns a description of the input
78
- * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];
79
- *
80
- * // Second tuple: predicate "isNumber", mapfn returns a description
81
- * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];
82
- *
83
- * let third = [ (input) => input === null, (input) => `Oh, null...` ];
84
- *
85
- * let fourth = [ (input) => input === undefined, (input) => `notdefined` ];
86
- *
87
- * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);
88
- *
89
- * console.log(descriptionOf(undefined)); // 'notdefined'
90
- * console.log(descriptionOf(55)); // '(55) That's a number!'
91
- * console.log(descriptionOf("foo")); // 'Here's your string foo'
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: any): (obj: any) => any;
108
- export function val(value: any): () => any;
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 | null} */
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> | undefined} a stable list on nodes */
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
- export function stringify(value: any): any;
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(delim: any): (str: any) => any;
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: any): any;
62
- export function stripLastPathElement(str: any): any;
70
+ export function joinNeighborsR(acc: string | any[], str: unknown): any;
71
+ export function stripLastPathElement(str: string): string;