@angular-wave/angular.ts 0.9.9 → 0.11.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 (61) hide show
  1. package/@types/angular.d.ts +24 -11
  2. package/@types/animations/animate-css-driver.d.ts +0 -1
  3. package/@types/animations/animate-css.d.ts +0 -1
  4. package/@types/animations/animate-js-driver.d.ts +1 -7
  5. package/@types/animations/animate-js.d.ts +1 -4
  6. package/@types/animations/animate-queue.d.ts +2 -4
  7. package/@types/animations/animate-swap.d.ts +2 -4
  8. package/@types/animations/animate.d.ts +24 -24
  9. package/@types/animations/animation.d.ts +2 -2
  10. package/@types/animations/interface.d.ts +12 -0
  11. package/@types/animations/raf-scheduler.d.ts +4 -4
  12. package/@types/animations/runner/animate-runner.d.ts +99 -0
  13. package/@types/animations/shared.d.ts +30 -2
  14. package/@types/core/compile/attributes.d.ts +5 -8
  15. package/@types/core/compile/compile.d.ts +4 -4
  16. package/@types/core/controller/controller.d.ts +1 -1
  17. package/@types/core/di/ng-module.d.ts +14 -14
  18. package/@types/core/filter/filter.d.ts +2 -2
  19. package/@types/core/scope/interface.d.ts +18 -0
  20. package/@types/core/scope/scope.d.ts +19 -95
  21. package/@types/directive/aria/aria.d.ts +11 -13
  22. package/@types/directive/attrs/attrs.d.ts +2 -2
  23. package/@types/directive/class/class.d.ts +3 -3
  24. package/@types/directive/events/events.d.ts +0 -2
  25. package/@types/directive/http/http.d.ts +4 -22
  26. package/@types/directive/if/if.d.ts +2 -4
  27. package/@types/directive/include/include.d.ts +2 -2
  28. package/@types/directive/inject/inject.d.ts +2 -2
  29. package/@types/directive/input/input.d.ts +10 -10
  30. package/@types/directive/messages/messages.d.ts +4 -4
  31. package/@types/directive/observe/observe.d.ts +2 -5
  32. package/@types/directive/worker/worker.d.ts +15 -0
  33. package/@types/interface.d.ts +40 -11
  34. package/@types/namespace.d.ts +11 -1
  35. package/@types/ng.d.ts +3 -5
  36. package/@types/router/directives/view-directive.d.ts +2 -2
  37. package/@types/router/params/interface.d.ts +0 -25
  38. package/@types/router/path/path-utils.d.ts +2 -2
  39. package/@types/router/state/interface.d.ts +0 -9
  40. package/@types/router/state/state-object.d.ts +6 -6
  41. package/@types/router/state/state-service.d.ts +3 -3
  42. package/@types/router/template-factory.d.ts +1 -1
  43. package/@types/router/transition/hook-builder.d.ts +1 -1
  44. package/@types/router/transition/interface.d.ts +0 -44
  45. package/@types/router/transition/transition-hook.d.ts +31 -0
  46. package/@types/router/transition/transition-service.d.ts +1 -1
  47. package/@types/router/transition/transition.d.ts +2 -2
  48. package/@types/services/pubsub/pubsub.d.ts +2 -2
  49. package/@types/services/sse/interface.d.ts +27 -1
  50. package/@types/services/sse/sse.d.ts +4 -3
  51. package/@types/services/worker/interface.d.ts +12 -0
  52. package/@types/services/worker/worker.d.ts +31 -0
  53. package/@types/shared/dom.d.ts +4 -5
  54. package/@types/shared/url-utils/url-utils.d.ts +14 -14
  55. package/README.md +1 -1
  56. package/dist/angular-ts.esm.js +1517 -1125
  57. package/dist/angular-ts.umd.js +1517 -1125
  58. package/dist/angular-ts.umd.min.js +1 -1
  59. package/dist/angular.css +1 -1
  60. package/package.json +1 -2
  61. package/@types/animations/animate-runner.d.ts +0 -31
@@ -37,13 +37,13 @@ export class PathUtils {
37
37
  * @param {PathNode[]} fromPath
38
38
  * @param {PathNode[]} toPath
39
39
  * @param {boolean} [reloadState]
40
- * @returns {import("../transition/interface.js").TreeChanges}
40
+ * @returns {import("../transition/interface.ts").TreeChanges}
41
41
  */
42
42
  static treeChanges(
43
43
  fromPath: PathNode[],
44
44
  toPath: PathNode[],
45
45
  reloadState?: boolean,
46
- ): import("../transition/interface.js").TreeChanges;
46
+ ): import("../transition/interface.ts").TreeChanges;
47
47
  /**
48
48
  * Returns a new path which is: the subpath of the first path which matches the second path.
49
49
  *
@@ -385,15 +385,6 @@ export interface StateDeclaration {
385
385
  * ```
386
386
  */
387
387
  parent?: string | StateDeclaration;
388
- /**
389
- * Gets the internal State object API
390
- *
391
- * Gets the *internal API* for a registered state.
392
- *
393
- * Note: the internal [[StateObject]] API is subject to change without notice
394
- * @internal
395
- */
396
- $$state?: () => StateObject;
397
388
  /**
398
389
  * Resolve - a mechanism to asynchronously fetch data, participating in the Transition lifecycle
399
390
  *
@@ -1,4 +1,4 @@
1
- /** @typedef {import('./interface.js').StateDeclaration} StateDeclaration */
1
+ /** @typedef {import('./interface.ts').StateDeclaration} StateDeclaration */
2
2
  /**
3
3
  * Internal representation of a ng-router state.
4
4
  *
@@ -12,9 +12,9 @@
12
12
  */
13
13
  export class StateObject implements StateDeclaration {
14
14
  /**
15
- * @param {import('./interface.js').StateDeclaration} config
15
+ * @param {import('./interface.ts').StateDeclaration} config
16
16
  */
17
- constructor(config: import("./interface.js").StateDeclaration);
17
+ constructor(config: import("./interface.ts").StateDeclaration);
18
18
  name: any;
19
19
  navigable: any;
20
20
  /** @type {?StateObject} */
@@ -24,9 +24,9 @@ export class StateObject implements StateDeclaration {
24
24
  includes: any;
25
25
  $$state: () => this;
26
26
  /**
27
- * @type {import('./interface.js').StateDeclaration}
27
+ * @type {import('./interface.ts').StateDeclaration}
28
28
  */
29
- self: import("./interface.js").StateDeclaration;
29
+ self: import("./interface.ts").StateDeclaration;
30
30
  __stateObjectCache: {
31
31
  nameGlob: Glob;
32
32
  };
@@ -79,5 +79,5 @@ export namespace StateObject {
79
79
  /** Predicate which returns true if the object is an internal [[StateObject]] object */
80
80
  function isState(obj: any): boolean;
81
81
  }
82
- export type StateDeclaration = import("./interface.js").StateDeclaration;
82
+ export type StateDeclaration = import("./interface.ts").StateDeclaration;
83
83
  import { Glob } from "../glob/glob.js";
@@ -27,7 +27,7 @@ export class StateProvider {
27
27
  *
28
28
  * @deprecated This is a passthrough through to [[Router.current]]
29
29
  */
30
- get current(): import("./interface.js").StateDeclaration;
30
+ get current(): import("./interface.ts").StateDeclaration;
31
31
  /**
32
32
  * The current [[StateObject]] (an internal API)
33
33
  *
@@ -134,9 +134,9 @@ export class StateProvider {
134
134
  decorator(name: string, func: object): object;
135
135
  /**
136
136
  *
137
- * @param {import("./interface.js").StateDeclaration} definition
137
+ * @param {import("./interface.ts").StateDeclaration} definition
138
138
  */
139
- state(definition: import("./interface.js").StateDeclaration): this;
139
+ state(definition: import("./interface.ts").StateDeclaration): this;
140
140
  /**
141
141
  * Handler for when [[transitionTo]] is called with an invalid state.
142
142
  *
@@ -21,7 +21,7 @@ export class TemplateFactoryProvider {
21
21
  $templateRequest: any;
22
22
  $http: import("../interface.ts").HttpService;
23
23
  $templateCache: ng.TemplateCacheService;
24
- $injector: import("../core/di/internal-injector.js").InjectorService;
24
+ $injector: import("../interface.ts").InjectorService;
25
25
  /**
26
26
  * Forces the provider to use $http service directly
27
27
  * @param {boolean} value
@@ -45,4 +45,4 @@ export class HookBuilder {
45
45
  */
46
46
  getMatchingHooks(hookType: any, treeChanges: any, transition: any): any;
47
47
  }
48
- import { TransitionHookPhase } from "./interface.js";
48
+ import { TransitionHookPhase } from "./transition-hook.js";
@@ -78,16 +78,6 @@ export interface TransitionOptions {
78
78
  * @default `true`
79
79
  */
80
80
  supercede?: boolean;
81
- /** @internal */
82
- reloadState?: StateObject;
83
- /** @internal
84
- * If this transition is a redirect, this property should be the original Transition (which was redirected to this one)
85
- */
86
- redirectedFrom?: Transition;
87
- /** @internal */
88
- current?: () => Transition;
89
- /** @internal */
90
- source?: "sref" | "url" | "redirect" | "otherwise" | "unknown";
91
81
  }
92
82
  export interface TransitionHookOptions {
93
83
  current?: () => Transition;
@@ -298,10 +288,6 @@ export interface HookRegOptions {
298
288
  * Note: the Transition object only allows hooks to be registered before the Transition is started.
299
289
  */
300
290
  export interface IHookRegistry {
301
- /** @internal place to store the hooks */
302
- _registeredHooks: {
303
- [key: string]: RegisteredHook[];
304
- };
305
291
  /**
306
292
  * Registers a [[TransitionHookFn]], called *before a transition starts*.
307
293
  *
@@ -837,24 +823,6 @@ export interface IMatchingNodes {
837
823
  retained: PathNode[];
838
824
  entering: PathNode[];
839
825
  }
840
- /** @internal */
841
- export interface RegisteredHooks {
842
- [key: string]: RegisteredHook[];
843
- }
844
- /** @internal */
845
- export interface PathTypes {
846
- [key: string]: PathType;
847
- to: PathType;
848
- from: PathType;
849
- exiting: PathType;
850
- retained: PathType;
851
- entering: PathType;
852
- }
853
- /** @internal */
854
- export interface PathType {
855
- name: string;
856
- scope: TransitionHookScope;
857
- }
858
826
  /**
859
827
  * Hook Criterion used to match a transition.
860
828
  *
@@ -866,15 +834,3 @@ export interface PathType {
866
834
  * Or, `true` to always match
867
835
  */
868
836
  export type HookMatchCriterion = string | IStateMatch | boolean;
869
- declare enum TransitionHookPhase {
870
- CREATE = 0,
871
- BEFORE = 1,
872
- RUN = 2,
873
- SUCCESS = 3,
874
- ERROR = 4,
875
- }
876
- declare enum TransitionHookScope {
877
- TRANSITION = 0,
878
- STATE = 1,
879
- }
880
- export { TransitionHookPhase, TransitionHookScope };
@@ -1,3 +1,34 @@
1
+ /**
2
+ * Enum representing the different phases of a transition hook.
3
+ */
4
+ export type TransitionHookPhase = number;
5
+ /**
6
+ * Enum representing the different phases of a transition hook.
7
+ *
8
+ * @readonly
9
+ * @enum {number}
10
+ */
11
+ export const TransitionHookPhase: Readonly<{
12
+ CREATE: 0;
13
+ BEFORE: 1;
14
+ RUN: 2;
15
+ SUCCESS: 3;
16
+ ERROR: 4;
17
+ }>;
18
+ /**
19
+ * Enum representing the scope in which a transition hook operates.
20
+ */
21
+ export type TransitionHookScope = number;
22
+ /**
23
+ * Enum representing the scope in which a transition hook operates.
24
+ *
25
+ * @readonly
26
+ * @enum {number}
27
+ */
28
+ export const TransitionHookScope: Readonly<{
29
+ TRANSITION: 0;
30
+ STATE: 1;
31
+ }>;
1
32
  export class TransitionHook {
2
33
  /**
3
34
  * Chains together an array of TransitionHooks.
@@ -117,4 +117,4 @@ export class TransitionProvider {
117
117
  _registerCoreTransitionHooks(): void;
118
118
  }
119
119
  import { Transition } from "./transition.js";
120
- import { TransitionHookPhase } from "./interface.js";
120
+ import { TransitionHookPhase } from "./transition-hook.js";
@@ -47,7 +47,7 @@ export class Transition implements IHookRegistry {
47
47
  _targetState: import("../state/target-state.js").TargetState;
48
48
  _options: any;
49
49
  $id: number;
50
- _treeChanges: import("./interface.js").TreeChanges;
50
+ _treeChanges: import("./interface.ts").TreeChanges;
51
51
  onStart: any;
52
52
  onBefore: any;
53
53
  onSuccess: any;
@@ -251,7 +251,7 @@ export class Transition implements IHookRegistry {
251
251
  pathname: any,
252
252
  ):
253
253
  | import("../path/path-node.js").PathNode[]
254
- | import("./interface.js").TreeChanges;
254
+ | import("./interface.ts").TreeChanges;
255
255
  /**
256
256
  * Creates a new transition that is a redirection of the current one.
257
257
  *
@@ -1,4 +1,4 @@
1
- /** @typedef {import('../../interface.js').ServiceProvider} ServiceProvider
1
+ /** @typedef {import('../../interface.ts').ServiceProvider} ServiceProvider
2
2
 
3
3
  /**
4
4
  * Configurable provider for an injectable event bus
@@ -182,4 +182,4 @@ export const EventBus: PubSub;
182
182
  * /**
183
183
  * Configurable provider for an injectable event bus
184
184
  */
185
- export type ServiceProvider = import("../../interface.js").ServiceProvider;
185
+ export type ServiceProvider = import("../../interface.ts").ServiceProvider;
@@ -2,15 +2,41 @@
2
2
  * Configuration object for SSE
3
3
  */
4
4
  export interface SseConfig {
5
+ /** Include cookies/credentials when connecting */
5
6
  withCredentials?: boolean;
7
+ /** Custom headers (Note: EventSource doesn't natively support headers; handled at app level if needed) */
6
8
  headers?: Record<string, string>;
9
+ /** Called when the connection is successfully opened */
7
10
  onOpen?: (event: Event) => void;
11
+ /** Called when a message event is received */
8
12
  onMessage?: (data: any, event: MessageEvent) => void;
13
+ /** Called on connection error */
9
14
  onError?: (err: Event) => void;
15
+ /** Transform raw SSE message data (default: JSON.parse if possible) */
10
16
  transformMessage?: (data: string) => any;
17
+ /** Optional query parameters appended to the URL */
11
18
  params?: Record<string, any>;
19
+ /** Called when the connection is being re-established */
20
+ onReconnect?: (attempt: number) => void;
21
+ /** Delay in milliseconds before attempting to reconnect (default: 1000ms) */
22
+ retryDelay?: number;
23
+ /** Maximum number of reconnect attempts (default: Infinity) */
24
+ maxRetries?: number;
25
+ /** Heartbeat timeout in milliseconds; reconnect if no message within this time */
26
+ heartbeatTimeout?: number;
27
+ }
28
+ /**
29
+ * Managed SSE connection object returned by $sse.
30
+ * Provides a safe way to close the connection and stop reconnection attempts.
31
+ */
32
+ export interface SseConnection {
33
+ /** Manually close the SSE connection and stop all reconnect attempts */
34
+ close(): void;
35
+ /** Manually restart the SSE connection */
36
+ connect(): void;
12
37
  }
13
38
  /**
14
39
  * $sse service type
40
+ * Returns a managed SSE connection that automatically reconnects when needed.
15
41
  */
16
- export type SseService = (url: string, config?: SseConfig) => EventSource;
42
+ export type SseService = (url: string, config?: SseConfig) => SseConnection;
@@ -5,10 +5,10 @@
5
5
  * const source = $sse('/events', {
6
6
  * onMessage: (data) => console.log(data),
7
7
  * onError: (err) => console.error(err),
8
- * withCredentials: true
8
+ * retryDelay: 2000,
9
+ * heartbeatTimeout: 10000,
9
10
  * });
10
11
  *
11
- * // later:
12
12
  * source.close();
13
13
  */
14
14
  export class SseProvider {
@@ -21,6 +21,7 @@ export class SseProvider {
21
21
  * Returns the $sse service function
22
22
  * @returns {ng.SseService}
23
23
  */
24
- $get: () => ng.SseService;
24
+ $get: any[];
25
+ $log: import("../log/interface.ts").LogService;
25
26
  #private;
26
27
  }
@@ -0,0 +1,12 @@
1
+ export interface WorkerConfig {
2
+ onMessage?: (data: any, event: MessageEvent) => void;
3
+ onError?: (err: ErrorEvent) => void;
4
+ autoRestart?: boolean;
5
+ autoTerminate?: boolean;
6
+ transformMessage?: (data: any) => any;
7
+ }
8
+ export interface WorkerConnection {
9
+ post(data: any): void;
10
+ terminate(): void;
11
+ restart(): void;
12
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Worker Provider
3
+ *
4
+ * Usage:
5
+ * const worker = $worker('./math.worker.js', {
6
+ * onMessage: (data) => console.log('Result:', data),
7
+ * onError: (err) => console.error('Worker error:', err),
8
+ * autoTerminate: false,
9
+ * transformMessage: (d) => d,
10
+ * });
11
+ *
12
+ * worker.post({ action: 'fib', n: 20 });
13
+ * worker.terminate();
14
+ */
15
+ export class WorkerProvider {
16
+ /**
17
+ * @type {ng.LogService}
18
+ */
19
+ $log: ng.LogService;
20
+ /**
21
+ * Optional provider-level defaults
22
+ * @type {ng.WorkerConfig}
23
+ */
24
+ defaults: ng.WorkerConfig;
25
+ /**
26
+ * Returns the $worker service function
27
+ * @returns {ng.WorkerService}
28
+ */
29
+ $get: any[];
30
+ #private;
31
+ }
@@ -133,7 +133,7 @@ export function setIsolateScope(
133
133
  * Gets the controller instance for a given element, if exists. Defaults to "ngControllerController"
134
134
  *
135
135
  * @param {Element} element - The DOM element to get data from.
136
- * @param {string} [name] - The DOM element to get data from.
136
+ * @param {string} [name] - Controller name.
137
137
  * @returns {import("../core/scope/scope.js").Scope|undefined} - The retrieved data
138
138
  */
139
139
  export function getController(
@@ -198,11 +198,9 @@ export function cleanElementData(nodes: NodeListOf<Element> | Element[]): void;
198
198
  /**
199
199
  * Return instance of InjectorService attached to element
200
200
  * @param {Element} element
201
- * @returns {import('../core/di/internal-injector.js').InjectorService}
201
+ * @returns {ng.InjectorService}
202
202
  */
203
- export function getInjector(
204
- element: Element,
205
- ): import("../core/di/internal-injector.js").InjectorService;
203
+ export function getInjector(element: Element): ng.InjectorService;
206
204
  /**
207
205
  * Creates a DOM element from an HTML string.
208
206
  * @param {string} htmlString - A string representing the HTML to parse. Must have only one root element.
@@ -240,6 +238,7 @@ export function domInsert(
240
238
  parentElement: any,
241
239
  afterElement: any,
242
240
  ): void;
241
+ export function animatedomInsert(element: any, parent: any, after: any): void;
243
242
  /**
244
243
  * Returns the base href of the document.
245
244
  *
@@ -1,20 +1,20 @@
1
1
  /**
2
- * @param {import("./interface.js").ResolvableUrl} url
3
- * @return {import("./interface.js").ParsedUrl}
2
+ * @param {import("./interface.ts").ResolvableUrl} url
3
+ * @return {import("./interface.ts").ParsedUrl}
4
4
  */
5
5
  export function urlResolve(
6
- url: import("./interface.js").ResolvableUrl,
7
- ): import("./interface.js").ParsedUrl;
6
+ url: import("./interface.ts").ResolvableUrl,
7
+ ): import("./interface.ts").ParsedUrl;
8
8
  /**
9
9
  * Parse a request URL and determine whether this is a same-origin request as the application
10
10
  * document.
11
11
  *
12
- * @param {import("./interface.js").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
12
+ * @param {import("./interface.ts").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
13
13
  * or a parsed URL object.
14
14
  * @returns {boolean} Whether the request is for the same origin as the application document.
15
15
  */
16
16
  export function urlIsSameOrigin(
17
- requestUrl: import("./interface.js").ResolvableUrl,
17
+ requestUrl: import("./interface.ts").ResolvableUrl,
18
18
  ): boolean;
19
19
  /**
20
20
  * Parse a request URL and determine whether it is same-origin as the current document base URL.
@@ -22,12 +22,12 @@ export function urlIsSameOrigin(
22
22
  * Note: The base URL is usually the same as the document location (`location.href`) but can
23
23
  * be overriden by using the `<base>` tag.
24
24
  *
25
- * @param {import("./interface.js").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
25
+ * @param {import("./interface.ts").ResolvableUrl} requestUrl The url of the request as a string that will be resolved
26
26
  * or a parsed URL object.
27
27
  * @returns {boolean} Whether the URL is same-origin as the document base URL.
28
28
  */
29
29
  export function urlIsSameOriginAsBaseUrl(
30
- requestUrl: import("./interface.js").ResolvableUrl,
30
+ requestUrl: import("./interface.ts").ResolvableUrl,
31
31
  ): boolean;
32
32
  /**
33
33
  * Create a function that can check a URL's origin against a list of allowed/trusted origins.
@@ -35,25 +35,25 @@ export function urlIsSameOriginAsBaseUrl(
35
35
  *
36
36
  * @param {string[]} trustedOriginUrls - A list of URLs (strings), whose origins are trusted.
37
37
  *
38
- * @returns {(url: import("./interface.js").ResolvableUrl) => boolean } - A function that receives a URL (string or parsed URL object) and returns
38
+ * @returns {(url: import("./interface.ts").ResolvableUrl) => boolean } - A function that receives a URL (string or parsed URL object) and returns
39
39
  * whether it is of an allowed origin.
40
40
  */
41
41
  export function urlIsAllowedOriginFactory(
42
42
  trustedOriginUrls: string[],
43
- ): (url: import("./interface.js").ResolvableUrl) => boolean;
43
+ ): (url: import("./interface.ts").ResolvableUrl) => boolean;
44
44
  /**
45
45
  * Determine if two URLs share the same origin.
46
46
  *
47
- * @param {import("./interface.js").ResolvableUrl} url1 - First URL to compare as a string or a normalized URL in the form of
47
+ * @param {import("./interface.ts").ResolvableUrl} url1 - First URL to compare as a string or a normalized URL in the form of
48
48
  * a dictionary object returned by `urlResolve()`.
49
- * @param {import("./interface.js").ResolvableUrl} url2 - Second URL to compare as a string or a normalized URL in the form
49
+ * @param {import("./interface.ts").ResolvableUrl} url2 - Second URL to compare as a string or a normalized URL in the form
50
50
  * of a dictionary object returned by `urlResolve()`.
51
51
  *
52
52
  * @returns {boolean} - True if both URLs have the same origin, and false otherwise.
53
53
  */
54
54
  export function urlsAreSameOrigin(
55
- url1: import("./interface.js").ResolvableUrl,
56
- url2: import("./interface.js").ResolvableUrl,
55
+ url1: import("./interface.ts").ResolvableUrl,
56
+ url2: import("./interface.ts").ResolvableUrl,
57
57
  ): boolean;
58
58
  /**
59
59
  * Removes a trailing hash ('#') from the given URL if it exists.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## AngularTS
2
2
 
3
- ![Build status](https://github.com/angular-qave/angular.ts/actions/workflows/ci.yml/badge.svg)
3
+ ![Build status](https://github.com/angular-wave/angular.ts/actions/workflows/ci.yml/badge.svg)
4
4
  [![stats](https://data.jsdelivr.com/v1/package/npm/@angular-wave/angular.ts/badge?style=rounded)](https://www.jsdelivr.com/package/npm/@angular-wave/angular.ts)
5
5
 
6
6
  This project preserves, modernises and expands the original [AngularJS](https://angularjs.org/)