@angular-wave/angular.ts 0.13.0 → 0.14.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.
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 +16 -31
  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 +45 -149
  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 +83 -28
  46. package/LICENSE +1 -0
  47. package/dist/angular-ts.esm.js +9177 -5990
  48. package/dist/angular-ts.umd.js +9177 -5990
  49. package/dist/angular-ts.umd.min.js +1 -1
  50. package/package.json +1 -6
@@ -231,11 +231,11 @@ export class UrlService {
231
231
  /**
232
232
  * Creates a [[UrlMatcher]] for the specified pattern.
233
233
  *
234
- * @param pattern The URL pattern.
234
+ * @param urlPattern The URL pattern.
235
235
  * @param config The config object hash.
236
236
  * @returns The UrlMatcher.
237
237
  */
238
- compile(pattern: any, config: any): UrlMatcher;
238
+ compile(urlPattern: any, config: any): UrlMatcher;
239
239
  /**
240
240
  * Returns true if the specified object is a [[UrlMatcher]], or false otherwise.
241
241
  *
@@ -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
  }
@@ -9,173 +9,69 @@ export class PubSubProvider {
9
9
  * @type {PubSub}
10
10
  */
11
11
  eventBus: PubSub;
12
- /**
13
- * @returns {PubSub}
14
- */
15
- $get: () => PubSub;
12
+ $get: any[];
13
+ $exceptionHandler: import("../exception/interface.ts").ExceptionHandler;
16
14
  }
17
15
  export class PubSub {
16
+ /** @private {Object<string, Array<{fn: Function, context: any}>>} */
17
+ private _topics;
18
+ /** @private */
19
+ private _disposed;
20
+ /** @type {ng.ExceptionHandlerService} */
21
+ $exceptionHandler: ng.ExceptionHandlerService;
18
22
  /**
19
- * Runs a function asynchronously.
20
- *
21
- * @private
22
- * @param {Function} fn Function to run.
23
- * @param {Object} context Context in which to run the function.
24
- * @param {Array} args Arguments to pass to the function.
25
- */
26
- private static runAsync_;
27
- /**
28
- * Topic-based publish/subscribe channel. Maintains a map of topics to
29
- * subscriptions. When a message is published to a topic, all functions
30
- * subscribed to that topic are invoked in the order they were added.
31
- * Uncaught errors abort publishing.
32
- *
33
- * Topics may be identified by any nonempty string, <strong>except</strong>
34
- * strings corresponding to native Object properties, e.g. "constructor",
35
- * "toString", "hasOwnProperty", etc.
36
- *
37
- * @param {boolean=} async Enable asynchronous behavior. Recommended for
38
- * new code. See notes on the publish() method.
39
- */
40
- constructor(async?: boolean | undefined);
41
- disposed: boolean;
42
- /**
43
- * The next available subscription key. Internally, this is an index into the
44
- * sparse array of subscriptions.
45
- *
46
- * @private {number}
47
- */
48
- private key;
49
- /**
50
- * Array of subscription keys pending removal once publishing is done.
51
- *
52
- * @private {!Array<number>}
53
- * @const
54
- */
55
- private pendingKeys;
56
- /**
57
- * Lock to prevent the removal of subscriptions during publishing. Incremented
58
- * at the beginning of {@link #publish}, and decremented at the end.
59
- *
60
- * @private {number}
23
+ * Set instance to initial state
61
24
  */
62
- private publishDepth;
25
+ reset(): void;
63
26
  /**
64
- * Sparse array of subscriptions. Each subscription is represented by a tuple
65
- * comprising a topic identifier, a function, and an optional context object.
66
- * Each tuple occupies three consecutive positions in the array, with the
67
- * topic identifier at index n, the function at index (n + 1), the context
68
- * object at index (n + 2), the next topic at index (n + 3), etc. (This
69
- * representation minimizes the number of object allocations and has been
70
- * shown to be faster than an array of objects with three key-value pairs or
71
- * three parallel arrays, especially on IE.) Once a subscription is removed
72
- * via {@link unsubscribe} or {@link unsubscribeByKey}, the three
73
- * corresponding array elements are deleted, and never reused. This means the
74
- * total number of subscriptions during the lifetime of the pubsub channel is
75
- * limited by the maximum length of a JavaScript array to (2^32 - 1) / 3 =
76
- * 1,431,655,765 subscriptions, which should suffice for most applications.
77
- *
78
- * @private {!Array<?>}
79
- * @const
27
+ * Checks if instance has been disposed.
28
+ * @returns {boolean} True if disposed.
80
29
  */
81
- private subscriptions;
82
- /**
83
- * Map of topics to arrays of subscription keys.
84
- *
85
- * @private {!Object<!Array<number>>}
86
- */
87
- private topics;
88
- /**
89
- * @private @const {boolean}
90
- */
91
- private async_;
92
- /**
93
- * Subscribes a function to a topic. The function is invoked as a method on
94
- * the given `opt_context` object, or in the global scope if no context
95
- * is specified. Subscribing the same function to the same topic multiple
96
- * times will result in multiple function invocations while publishing.
97
- * Returns a subscription key that can be used to unsubscribe the function from
98
- * the topic via {@link unsubscribeByKey}.
99
- *
100
- * @param {string} topic Topic to subscribe to.
101
- * @param {Function} fn Function to be invoked when a message is published to
102
- * the given topic.
103
- * @param {Object=} opt_context Object in whose context the function is to be
104
- * called (the global scope if none).
105
- * @return {number} Subscription key.
106
- */
107
- subscribe(topic: string, fn: Function, opt_context?: any | undefined): number;
30
+ isDisposed(): boolean;
108
31
  /**
109
- * Subscribes a single-use function to a topic. The function is invoked as a
110
- * method on the given `opt_context` object, or in the global scope if
111
- * no context is specified, and is then unsubscribed. Returns a subscription
112
- * key that can be used to unsubscribe the function from the topic via
113
- * {@link unsubscribeByKey}.
114
- *
115
- * @param {string} topic Topic to subscribe to.
116
- * @param {Function} fn Function to be invoked once and then unsubscribed when
117
- * a message is published to the given topic.
118
- * @param {Object=} opt_context Object in whose context the function is to be
119
- * called (the global scope if none).
120
- * @return {number} Subscription key.
32
+ * Dispose the instance, removing all topics and listeners.
121
33
  */
122
- subscribeOnce(
123
- topic: string,
124
- fn: Function,
125
- opt_context?: any | undefined,
126
- ): number;
34
+ dispose(): void;
127
35
  /**
128
- * Unsubscribes a function from a topic. Only deletes the first match found.
129
- * Returns a Boolean indicating whether a subscription was removed.
130
- *
131
- * @param {string} topic Topic to unsubscribe from.
132
- * @param {Function} fn Function to unsubscribe.
133
- * @param {Object=} opt_context Object in whose context the function was to be
134
- * called (the global scope if none).
135
- * @return {boolean} Whether a matching subscription was removed.
36
+ * Subscribe a function to a topic.
37
+ * @param {string} topic - The topic to subscribe to.
38
+ * @param {Function} fn - The callback function to invoke when published.
39
+ * @param {*} [context] - Optional `this` context for the callback.
40
+ * @returns {() => boolean} A function that unsubscribes this listener.
136
41
  */
137
- unsubscribe(
138
- topic: string,
139
- fn: Function,
140
- opt_context?: any | undefined,
141
- ): boolean;
42
+ subscribe(topic: string, fn: Function, context?: any): () => boolean;
142
43
  /**
143
- * Removes a subscription based on the key returned by {@link subscribe}.
144
- * No-op if no matching subscription is found. Returns a Boolean indicating
145
- * whether a subscription was removed.
146
- *
147
- * @param {number} key Subscription key.
148
- * @return {boolean} Whether a matching subscription was removed.
44
+ * Subscribe a function to a topic only once.
45
+ * Listener is removed before the first invocation.
46
+ * @param {string} topic - The topic to subscribe to.
47
+ * @param {Function} fn - The callback function.
48
+ * @param {*} [context] - Optional `this` context for the callback.
49
+ * @returns {() => boolean} A function that unsubscribes this listener.
149
50
  */
150
- unsubscribeByKey(key: number): boolean;
51
+ subscribeOnce(topic: string, fn: Function, context?: any): () => boolean;
151
52
  /**
152
- * Publishes a message to a topic. Calls functions subscribed to the topic in
153
- * the order in which they were added, passing all arguments along.
154
- *
155
- * 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
- * any of them throw an uncaught error, publishing is aborted.
158
- *
159
- * @param {string} topic Topic to publish to.
160
- * @param {...*} var_args Arguments that are applied to each subscription
161
- * function.
162
- * @return {boolean} Whether any subscriptions were called.
53
+ * Unsubscribe a specific function from a topic.
54
+ * Matches by function reference and optional context.
55
+ * @param {string} topic - The topic to unsubscribe from.
56
+ * @param {Function} fn - The listener function.
57
+ * @param {*} [context] - Optional `this` context.
58
+ * @returns {boolean} True if the listener was found and removed.
163
59
  */
164
- publish(topic: string, ...var_args: any[]): boolean;
60
+ unsubscribe(topic: string, fn: Function, context?: any): boolean;
165
61
  /**
166
- * Clears the subscription list for a topic, or all topics if unspecified.
167
- * @param {string=} opt_topic Topic to clear (all topics if unspecified).
62
+ * Get the number of subscribers for a topic.
63
+ * @param {string} topic
64
+ * @returns {number}
168
65
  */
169
- clear(opt_topic?: string | undefined): void;
66
+ getCount(topic: string): number;
170
67
  /**
171
- * Returns the number of subscriptions to the given topic (or all topics if
172
- * unspecified). This number will not change while publishing any messages.
173
- * @param {string=} opt_topic The topic (all topics if unspecified).
174
- * @return {number} Number of subscriptions to the topic.
68
+ * Publish a value to a topic asynchronously.
69
+ * All listeners are invoked in the order they were added.
70
+ * @param {string} topic - The topic to publish.
71
+ * @param {...*} args - Arguments to pass to listeners.
72
+ * @returns {boolean} True if any listeners exist for this topic.
175
73
  */
176
- getCount(opt_topic?: string | undefined): number;
177
- isDisposed(): boolean;
178
- dispose(): void;
74
+ publish(topic: string, ...args: any[]): boolean;
179
75
  }
180
76
  export const EventBus: PubSub;
181
77
  /**
@@ -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;