@angular-wave/angular.ts 0.13.0 → 0.14.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 (50) hide show
  1. package/@types/angular.d.ts +1 -1
  2. package/@types/animations/animation.d.ts +1 -1
  3. package/@types/core/compile/attributes.d.ts +1 -1
  4. package/@types/core/di/ng-module/ng-module.d.ts +14 -29
  5. package/@types/core/filter/filter.d.ts +12 -13
  6. package/@types/core/scope/interface.d.ts +1 -1
  7. package/@types/core/scope/scope.d.ts +9 -10
  8. package/@types/directive/aria/aria.d.ts +3 -3
  9. package/@types/directive/class/class.d.ts +3 -3
  10. package/@types/directive/events/events.d.ts +2 -2
  11. package/@types/directive/form/form.d.ts +12 -2
  12. package/@types/directive/input/input.d.ts +2 -2
  13. package/@types/directive/messages/messages.d.ts +1 -1
  14. package/@types/directive/model/model.d.ts +12 -6
  15. package/@types/directive/model-options/model-options.d.ts +4 -1
  16. package/@types/directive/select/select.d.ts +1 -1
  17. package/@types/directive/style/style.d.ts +2 -2
  18. package/@types/directive/worker/interface.d.ts +2 -0
  19. package/@types/directive/worker/worker.d.ts +2 -0
  20. package/@types/filters/interface.d.ts +7 -1
  21. package/@types/interface.d.ts +3 -33
  22. package/@types/namespace.d.ts +35 -10
  23. package/@types/router/common/trace.d.ts +1 -0
  24. package/@types/router/directives/view-directive.d.ts +2 -2
  25. package/@types/router/transition/transition.d.ts +0 -1
  26. package/@types/router/url/url-config.d.ts +1 -1
  27. package/@types/router/url/url-rule.d.ts +0 -10
  28. package/@types/router/url/url-service.d.ts +2 -2
  29. package/@types/router/view/view.d.ts +0 -16
  30. package/@types/services/anchor-scroll/anchor-scroll.d.ts +1 -1
  31. package/@types/services/cookie/cookie.d.ts +2 -0
  32. package/@types/services/exception/exception.d.ts +1 -1
  33. package/@types/services/exception/interface.d.ts +2 -1
  34. package/@types/services/http/http.d.ts +10 -2
  35. package/@types/services/location/location.d.ts +10 -6
  36. package/@types/services/pubsub/pubsub.d.ts +2 -1
  37. package/@types/services/rest/rest.d.ts +4 -8
  38. package/@types/services/sce/sce.d.ts +1 -1
  39. package/@types/shared/common.d.ts +1 -1
  40. package/@types/shared/dom.d.ts +2 -2
  41. package/@types/shared/hof.d.ts +2 -2
  42. package/@types/shared/interface.d.ts +1 -0
  43. package/@types/shared/noderef.d.ts +1 -0
  44. package/@types/shared/strings.d.ts +6 -8
  45. package/@types/shared/utils.d.ts +70 -25
  46. package/LICENSE +1 -0
  47. package/dist/angular-ts.esm.js +9108 -5782
  48. package/dist/angular-ts.umd.js +9109 -5783
  49. package/dist/angular-ts.umd.min.js +1 -1
  50. package/package.json +1 -6
@@ -1,19 +1,3 @@
1
- /**
2
- * The View service
3
- *
4
- * This service pairs existing `ng-view` components (which live in the DOM)
5
- * with view configs (from the state declaration objects: [[StateDeclaration.views]]).
6
- *
7
- * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]].
8
- * The views from exited states are deactivated via [[deactivateViewConfig]].
9
- * (See: the [[registerActivateViews]] Transition Hook)
10
- *
11
- * - As `ng-view` components pop in and out of existence, they register themselves using [[registerUIView]].
12
- *
13
- * - When the [[sync]] function is called, the registered `ng-view`(s) ([[ActiveUIView]])
14
- * are configured with the matching [[ViewConfig]](s)
15
- *
16
- */
17
1
  export class ViewService {
18
2
  _ngViews: any[];
19
3
  _viewConfigs: any[];
@@ -14,7 +14,7 @@ export class AnchorScrollProvider {
14
14
  | string
15
15
  | ((
16
16
  $location: import("../../services/location/location.js").Location,
17
- $rootScope: import("../../core/scope/scope.js").Scope,
17
+ $rootScope: ng.Scope,
18
18
  ) => AnchorScrollFunction)
19
19
  )[];
20
20
  }
@@ -34,6 +34,7 @@ export class CookieService {
34
34
  *
35
35
  * @param {string} key
36
36
  * @returns {string|null}
37
+ * @throws {URIError} – If decodeURIComponent fails.
37
38
  */
38
39
  get(key: string): string | null;
39
40
  /**
@@ -49,6 +50,7 @@ export class CookieService {
49
50
  * Returns an object containing all raw cookies.
50
51
  *
51
52
  * @returns {Record<string, string>}
53
+ * @throws {URIError} – If decodeURIComponent fails
52
54
  */
53
55
  getAll(): Record<string, string>;
54
56
  /**
@@ -37,7 +37,7 @@
37
37
  * }
38
38
  * ```
39
39
  *
40
- * @see {@link ng.ExceptionHandlerService ExceptionHandlerService}
40
+ * @see {@link ng.ExceptionHandlerService} ExceptionHandlerService
41
41
  */
42
42
  /**
43
43
  * Provider for the `$exceptionHandler` service.
@@ -2,5 +2,6 @@
2
2
  * A callback type for handling errors.
3
3
  *
4
4
  * @param {Error} exception - The exception associated with the error.
5
+ * @throws {Error}
5
6
  */
6
- export type ExceptionHandler = (exception: Error) => void;
7
+ export type ExceptionHandler = (exception: Error) => never;
@@ -25,7 +25,7 @@ export function HttpProvider(): void;
25
25
  export class HttpProvider {
26
26
  defaults: {
27
27
  transformResponse: (typeof defaultHttpResponseTransform)[];
28
- transformRequest: ((d: any) => any)[];
28
+ transformRequest: ((data: any) => any)[];
29
29
  headers: {
30
30
  common: {
31
31
  Accept: string;
@@ -108,6 +108,7 @@ export class HttpProvider {
108
108
  | ((
109
109
  $injector: ng.InjectorService,
110
110
  $sce: any,
111
+ $cookie: ng.CookieService,
111
112
  ) => {
112
113
  (requestConfig: any): Promise<any>;
113
114
  pendingRequests: any[];
@@ -119,7 +120,7 @@ export class HttpProvider {
119
120
  */
120
121
  defaults: {
121
122
  transformResponse: (typeof defaultHttpResponseTransform)[];
122
- transformRequest: ((d: any) => any)[];
123
+ transformRequest: ((data: any) => any)[];
123
124
  headers: {
124
125
  common: {
125
126
  Accept: string;
@@ -170,3 +171,10 @@ export function http(
170
171
  eventHandlers?: Record<string, EventListener>,
171
172
  uploadEventHandlers?: Record<string, EventListener>,
172
173
  ): void;
174
+ export const Http: Readonly<{
175
+ OK: 200;
176
+ MultipleChoices: 300;
177
+ BadRequest: 400;
178
+ NotFound: 404;
179
+ ErrorMax: 599;
180
+ }>;
@@ -94,10 +94,10 @@ export function parseAppUrl(url: string, html5Mode: boolean): void;
94
94
  * Returns `undefined` if `url` does not start with `base`.
95
95
  * @param {string} base
96
96
  * @param {string} url
97
- * @returns {string} returns text from `url` after `base` or `undefined` if it does not begin with
97
+ * @returns {string|undefined} returns text from `url` after `base` or `undefined` if it does not begin with
98
98
  * the expected string.
99
99
  */
100
- export function stripBaseUrl(base: string, url: string): string;
100
+ export function stripBaseUrl(base: string, url: string): string | undefined;
101
101
  /**
102
102
  * @ignore
103
103
  * Removes the hash fragment (including the '#') from the given URL string.
@@ -143,11 +143,11 @@ export function serverBase(url: string): string;
143
143
  * Determine if two URLs are equal despite potential differences in encoding,
144
144
  * trailing slashes, or empty hash fragments, such as between $location.absUrl() and $browser.url().
145
145
  *
146
- * @param {string} a - First URL to compare.
147
- * @param {string} b - Second URL to compare.
146
+ * @param {string} x - First URL to compare.
147
+ * @param {string} y - Second URL to compare.
148
148
  * @returns {boolean} True if URLs are equivalent after normalization.
149
149
  */
150
- export function urlsEqual(a: string, b: string): boolean;
150
+ export function urlsEqual(x: string, y: string): boolean;
151
151
  export class Location {
152
152
  /**
153
153
  * @param {string} appBase application base URL
@@ -321,7 +321,11 @@ export class LocationProvider {
321
321
  lastCachedState: any;
322
322
  $get: (
323
323
  | string
324
- | (($rootScope: ng.Scope, $rootElement: Element) => Location)
324
+ | ((
325
+ $rootScope: ng.Scope,
326
+ $rootElement: Element,
327
+ $exceptionHandler: ng.ExceptionHandlerService,
328
+ ) => Location)
325
329
  )[];
326
330
  #private;
327
331
  }
@@ -15,6 +15,7 @@ export class PubSubProvider {
15
15
  $get: () => PubSub;
16
16
  }
17
17
  export class PubSub {
18
+ static $nonscope: any;
18
19
  /**
19
20
  * Runs a function asynchronously.
20
21
  *
@@ -153,7 +154,7 @@ export class PubSub {
153
154
  * the order in which they were added, passing all arguments along.
154
155
  *
155
156
  * If this object was created with async=true, subscribed functions are called
156
- * via Promise.resolve(). Otherwise, the functions are called directly, and if
157
+ * via `queueMicrotask`. Otherwise, the functions are called directly, and if
157
158
  * any of them throw an uncaught error, publishing is aborted.
158
159
  *
159
160
  * @param {string} topic Topic to publish to.
@@ -9,18 +9,14 @@ export class RestService<T, ID> {
9
9
  *
10
10
  * @param {ng.HttpService} $http Angular-like $http service
11
11
  * @param {string} baseUrl Base URL or URI template
12
- * @param {{new(data: any): T}=} entityClass Optional constructor to map JSON to objects
13
- * @param {Object=} options Optional settings (interceptors, headers, etc.)
12
+ * @param {ng.EntityClass<T>} [entityClass] Optional constructor to map JSON to objects
13
+ * @param {Object} [options] Optional settings (interceptors, headers, etc.)
14
14
  */
15
15
  constructor(
16
16
  $http: ng.HttpService,
17
17
  baseUrl: string,
18
- entityClass?:
19
- | {
20
- new (data: any): T;
21
- }
22
- | undefined,
23
- options?: any | undefined,
18
+ entityClass?: ng.EntityClass<T>,
19
+ options?: any,
24
20
  );
25
21
  /** @private */
26
22
  private $http;
@@ -1,4 +1,4 @@
1
- export function escapeForRegexp(s: any): any;
1
+ export function escapeForRegexp(str: any): any;
2
2
  export function adjustMatcher(matcher: any): any;
3
3
  export function SceProvider(): void;
4
4
  export class SceProvider {
@@ -1,4 +1,4 @@
1
- export function equals(o1: any, o2: any): any;
1
+ export function equals(o1: any, o2: any): boolean;
2
2
  /**
3
3
  * prototypal inheritance helper.
4
4
  * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it
@@ -149,13 +149,13 @@ export function getInheritedData(element: Node, name: string): any;
149
149
  * @param {Node} element
150
150
  * @param {string|string[]} name
151
151
  * @param {any} [value]
152
- * @returns
152
+ * @returns {any|undefined}
153
153
  */
154
154
  export function setInheritedData(
155
155
  element: Node,
156
156
  name: string | string[],
157
157
  value?: any,
158
- ): any;
158
+ ): any | undefined;
159
159
  /**
160
160
  *
161
161
  * @param {Element} element
@@ -46,7 +46,7 @@ export function curry(fn: any): any | (() => any | any);
46
46
  * let composed = compose(f,g,h)
47
47
  * then, composed is: f(g(h(x)))
48
48
  */
49
- export function compose(...args: any[]): () => any;
49
+ export function compose(...fns: any[]): (...args: any[]) => any;
50
50
  /**
51
51
  * Given a class constructor, returns a predicate function that checks
52
52
  * whether a given object is an instance of that class.
@@ -105,4 +105,4 @@ export function pattern(struct: any): (arg0: any) => any;
105
105
  */
106
106
  export const propEq: any;
107
107
  export function parse(path: any): (obj: any) => any;
108
- export function val(v: any): () => any;
108
+ export function val(value: any): () => any;
@@ -17,3 +17,4 @@ export interface ErrorHandlingConfig {
17
17
  */
18
18
  urlErrorParamsEnabled?: boolean;
19
19
  }
20
+ export type Validator = (value: unknown) => boolean;
@@ -3,6 +3,7 @@
3
3
  * Provides guarantees around presence and access.
4
4
  */
5
5
  export class NodeRef {
6
+ static $nonscope: boolean;
6
7
  /**
7
8
  * @param {Node | Element | string | NodeList | Node[]} element - The DOM node(s) or HTML string to wrap.
8
9
  * @throws {Error} If the argument is invalid or cannot be wrapped properly.
@@ -1,16 +1,14 @@
1
- /**
2
- * Functions that manipulate strings
3
- */
4
1
  /**
5
2
  * Returns a string shortened to a maximum length
6
3
  *
7
4
  * If the string is already less than the `max` length, return the string.
8
5
  * Else return the string, shortened to `max - 3` and append three dots ("...").
9
6
  *
10
- * @param max the maximum length of the string to return
11
- * @param str the input string
7
+ * @param {number} max the maximum length of the string to return
8
+ * @param {string} str the input string
9
+ * @returns {string}
12
10
  */
13
- export function maxLength(max: any, str: any): any;
11
+ export function maxLength(max: number, str: string): string;
14
12
  /**
15
13
  * Returns a string, with spaces added to the end, up to a desired str length
16
14
  *
@@ -24,7 +22,7 @@ export function padString(length: any, str: any): any;
24
22
  export function kebobString(camelCase: any): any;
25
23
  export function functionToString(fn: any): any;
26
24
  export function fnToString(fn: any): any;
27
- export function stringify(o: any): any;
25
+ export function stringify(value: any): any;
28
26
  /**
29
27
  * Splits on a delimiter, but returns the delimiters in the array
30
28
  *
@@ -48,5 +46,5 @@ export function splitOnDelim(delim: any): (str: any) => any;
48
46
  * arr.reduce(joinNeighborsR, []) // ["foobar", 1, "bazqux" ]
49
47
  * ```
50
48
  */
51
- export function joinNeighborsR(acc: any, x: any): any;
49
+ export function joinNeighborsR(acc: any, str: any): any;
52
50
  export function stripLastPathElement(str: any): any;
@@ -57,13 +57,7 @@ export function isObject(value: any): boolean;
57
57
  * @returns {boolean} True if `value` is an `Object` with a null prototype
58
58
  */
59
59
  export function isBlankObject(value: any): boolean;
60
- /**
61
- * Determines if a reference is a `String`.
62
- *
63
- * @param {*} value Reference to check.
64
- * @returns {boolean} True if `value` is a `String`.
65
- */
66
- export function isString(value: any): boolean;
60
+ export function isString(value: unknown): boolean;
67
61
  /**
68
62
  * Determines if a reference is a null.
69
63
  *
@@ -78,6 +72,13 @@ export function isNull(value: any): boolean;
78
72
  * @returns {boolean} True if `value` is null or undefined.
79
73
  */
80
74
  export function isNullOrUndefined(obj: any): boolean;
75
+ /**
76
+ * Determines if a reference is not null or undefined.
77
+ *
78
+ * @param {*} obj Reference to check.
79
+ * @returns {boolean} True if `value` is null or undefined.
80
+ */
81
+ export function notNullOrUndefined(obj: any): boolean;
81
82
  /**
82
83
  * Determines if a reference is a `Number`.
83
84
  *
@@ -180,10 +181,30 @@ export function snakeCase(name: any, separator: any): any;
180
181
  /**
181
182
  * Set or clear the hashkey for an object.
182
183
  * @param obj object
183
- * @param h the hashkey (!truthy to delete the hashkey)
184
- */
185
- export function setHashKey(obj: any, h: any): void;
186
- export function baseExtend(dst: any, objs: any, deep: any): any;
184
+ * @param hashkey the hashkey (!truthy to delete the hashkey)
185
+ */
186
+ export function setHashKey(obj: any, hashkey: any): void;
187
+ /**
188
+ * Deeply extends a destination object with one or more source objects.
189
+ * Safely handles Dates, RegExps, DOM nodes, arrays, and nested objects.
190
+ * Ignores the `__proto__` key to prevent prototype pollution.
191
+ *
192
+ * @param {Object<string, any>} dst - The destination object to extend.
193
+ * @param {Array<Object<string, any>>} objs - Array of source objects to copy properties from.
194
+ * @param {boolean} [deep=false] - Whether to perform a deep merge of nested objects.
195
+ * @returns {Object<string, any>} The extended destination object.
196
+ */
197
+ export function baseExtend(
198
+ dst: {
199
+ [x: string]: any;
200
+ },
201
+ objs: Array<{
202
+ [x: string]: any;
203
+ }>,
204
+ deep?: boolean,
205
+ ): {
206
+ [x: string]: any;
207
+ };
187
208
  /**
188
209
  * Extends the destination object `dst` by copying own enumerable properties from the `src` object(s)
189
210
  * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so
@@ -227,7 +248,7 @@ export function includes(array: any, obj: any): boolean;
227
248
  * @returns {number} - The index of the removed value, or -1 if the value was not found.
228
249
  */
229
250
  export function arrayRemove<T>(array: Array<T>, value: T): number;
230
- export function simpleCompare(a: any, b: any): boolean;
251
+ export function simpleCompare(val1: any, val2: any): boolean;
231
252
  /**
232
253
  * Determines if two objects or two values are equivalent. Supports value types, regular
233
254
  * expressions, arrays and objects.
@@ -286,7 +307,6 @@ export function simpleCompare(a: any, b: any): boolean;
286
307
  </example>
287
308
  */
288
309
  export function equals(o1: any, o2: any): boolean;
289
- export function csp(): any;
290
310
  /**
291
311
  * throw error if the name given is hasOwnProperty
292
312
  * @param {string} name the name to test
@@ -373,9 +393,9 @@ export function toKeyValue(obj: any): string;
373
393
  * Tries to decode the URI component without throwing an exception.
374
394
  *
375
395
  * @param {string} value potential URI component to check.
376
- * @returns {string|void}
396
+ * @returns {string|undefined}
377
397
  */
378
- export function tryDecodeURIComponent(value: string): string | void;
398
+ export function tryDecodeURIComponent(value: string): string | undefined;
379
399
  /**
380
400
  * We need our custom method because encodeURIComponent is too aggressive and doesn't follow
381
401
  * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
@@ -414,6 +434,31 @@ export function shallowCopy(src: any, dst: any): any;
414
434
  * @param {string} errorMsg
415
435
  */
416
436
  export function assert(argument: boolean, errorMsg?: string): void;
437
+ /**
438
+ * Validate a value using a predicate function.
439
+ * Throws if the predicate returns false.
440
+ *
441
+ * @param {ng.Validator} fn - Predicate validator function.
442
+ * @param {*} arg - The value to validate.
443
+ * @param {string} name - Parameter name (included in error message).
444
+ * @returns {*} The validated value.
445
+ * @throws {TypeError} If the value does not satisfy the validator.
446
+ */
447
+ export function validate(fn: ng.Validator, arg: any, name: string): any;
448
+ /**
449
+ * @param {*} arg - The value to validate.
450
+ * @param {string} name - Parameter name (included in error message).
451
+ * @returns {*} The validated value.
452
+ * @throws {TypeError} If the value does not satisfy the validator.
453
+ */
454
+ export function validateRequired(arg: any, name: string): any;
455
+ /**
456
+ * @param {*} arg - The value to validate.
457
+ * @param {string} name - Parameter name (included in error message).
458
+ * @returns {*} The validated value.
459
+ * @throws {TypeError} If the value does not satisfy the validator.
460
+ */
461
+ export function validateArray(arg: any, name: string): any;
417
462
  /**
418
463
  * Throw error if the argument is falsy.
419
464
  */
@@ -429,12 +474,12 @@ export function assertArgFn(
429
474
  *
430
475
  * Omitted or undefined options will leave the corresponding configuration values unchanged.
431
476
  *
432
- * @param {import("./interface.ts").ErrorHandlingConfig} [config]
433
- * @returns {import("./interface.ts").ErrorHandlingConfig}
477
+ * @param {ng.ErrorHandlingConfig} [config]
478
+ * @returns {ng.ErrorHandlingConfig}
434
479
  */
435
480
  export function errorHandlingConfig(
436
- config?: import("./interface.ts").ErrorHandlingConfig,
437
- ): import("./interface.ts").ErrorHandlingConfig;
481
+ config?: ng.ErrorHandlingConfig,
482
+ ): ng.ErrorHandlingConfig;
438
483
  /**
439
484
  * This object provides a utility for producing rich Error messages within
440
485
  * AngularTS. It can be called as follows:
@@ -479,13 +524,13 @@ export function hashKey(obj: any): string;
479
524
  * Merges two class name values into a single space-separated string.
480
525
  * Accepts strings, arrays of strings, or null/undefined values.
481
526
  *
482
- * @param {string | string[] | null | undefined} a - The first class name(s).
483
- * @param {string | string[] | null | undefined} b - The second class name(s).
527
+ * @param {string | string[] | null | undefined} firstClass - The first class name(s).
528
+ * @param {string | string[] | null | undefined} secondClass - The second class name(s).
484
529
  * @returns {string} A single string containing all class names separated by spaces.
485
530
  */
486
531
  export function mergeClasses(
487
- a: string | string[] | null | undefined,
488
- b: string | string[] | null | undefined,
532
+ firstClass: string | string[] | null | undefined,
533
+ secondClass: string | string[] | null | undefined,
489
534
  ): string;
490
535
  /**
491
536
  * Converts all accepted directives format into proper directive name.
@@ -538,10 +583,10 @@ export function callBackAfterFirst(fn: Function): Function;
538
583
  /**
539
584
  * Delays execution for a specified number of milliseconds.
540
585
  *
541
- * @param {number} [t=0] - The number of milliseconds to wait. Defaults to 0.
586
+ * @param {number} [timeout=0] - The number of milliseconds to wait. Defaults to 0.
542
587
  * @returns {Promise<void>} A promise that resolves after the delay.
543
588
  */
544
- export function wait(t?: number): Promise<void>;
589
+ export function wait(timeout?: number): Promise<void>;
545
590
  /**
546
591
  * Checks if a given string starts with a specified substring.
547
592
  *
package/LICENSE CHANGED
@@ -1,6 +1,7 @@
1
1
  The MIT License
2
2
 
3
3
  Copyright (c) 2010-2020 Google LLC. http://angularjs.org
4
+ Copyright (c) 2021-present Angular Wave contributors. https://angular-wave.github.io/angular.ts/
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal