@angular-wave/angular.ts 0.9.8 → 0.10.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 (53) hide show
  1. package/@types/angular.d.ts +2 -2
  2. package/@types/animations/animate-js.d.ts +1 -1
  3. package/@types/animations/animate-queue.d.ts +0 -1
  4. package/@types/animations/animate-swap.d.ts +2 -4
  5. package/@types/animations/animate.d.ts +2 -2
  6. package/@types/animations/raf-scheduler.d.ts +4 -4
  7. package/@types/animations/shared.d.ts +30 -2
  8. package/@types/core/compile/attributes.d.ts +5 -8
  9. package/@types/core/compile/compile.d.ts +6 -63
  10. package/@types/core/compile/inteface.d.ts +82 -0
  11. package/@types/core/controller/controller.d.ts +1 -1
  12. package/@types/core/di/ng-module.d.ts +14 -14
  13. package/@types/core/scope/interface.d.ts +18 -0
  14. package/@types/core/scope/scope.d.ts +16 -97
  15. package/@types/directive/aria/aria.d.ts +11 -13
  16. package/@types/directive/attrs/attrs.d.ts +2 -2
  17. package/@types/directive/channel/channel.d.ts +3 -5
  18. package/@types/directive/cloak/cloak.d.ts +2 -2
  19. package/@types/directive/events/events.d.ts +16 -0
  20. package/@types/directive/http/http.d.ts +4 -22
  21. package/@types/directive/if/if.d.ts +2 -4
  22. package/@types/directive/include/include.d.ts +4 -4
  23. package/@types/directive/messages/messages.d.ts +3 -3
  24. package/@types/directive/observe/observe.d.ts +2 -5
  25. package/@types/directive/options/options.d.ts +2 -2
  26. package/@types/directive/transclude/transclude.d.ts +4 -4
  27. package/@types/directive/viewport/viewport.d.ts +4 -0
  28. package/@types/directive/worker/worker.d.ts +15 -0
  29. package/@types/interface.d.ts +6 -5
  30. package/@types/namespace.d.ts +69 -40
  31. package/@types/router/directives/view-directive.d.ts +2 -2
  32. package/@types/router/path/path-utils.d.ts +2 -2
  33. package/@types/router/state/state-object.d.ts +6 -6
  34. package/@types/router/state/state-service.d.ts +3 -3
  35. package/@types/router/template-factory.d.ts +1 -1
  36. package/@types/router/transition/hook-builder.d.ts +1 -1
  37. package/@types/router/transition/interface.d.ts +1 -12
  38. package/@types/router/transition/transition-hook.d.ts +31 -0
  39. package/@types/router/transition/transition-service.d.ts +1 -1
  40. package/@types/router/transition/transition.d.ts +2 -2
  41. package/@types/services/pubsub/pubsub.d.ts +2 -2
  42. package/@types/services/sse/interface.d.ts +27 -1
  43. package/@types/services/sse/sse.d.ts +4 -3
  44. package/@types/services/worker/interface.d.ts +12 -0
  45. package/@types/services/worker/worker.d.ts +31 -0
  46. package/@types/shared/url-utils/url-utils.d.ts +14 -14
  47. package/README.md +2 -2
  48. package/dist/angular-ts.esm.js +1462 -1147
  49. package/dist/angular-ts.umd.js +1462 -1147
  50. package/dist/angular-ts.umd.min.js +1 -1
  51. package/dist/angular.css +1 -0
  52. package/package.json +4 -3
  53. package/css/angular.css +0 -16
@@ -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
+ }
@@ -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-Wave/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/)
@@ -43,7 +43,7 @@ Initialize your app
43
43
  <div ng-app ng-init="x='world'">Hello {{ x }}</div>
44
44
  ```
45
45
 
46
- Or check out the updated [Angular seed](https://github.com/Angular-Wave/angular-seed), which can serve as a solid starting point
46
+ Or check out the updated [Angular seed](https://github.com/angular-qave/angular-seed), which can serve as a solid starting point
47
47
  or a source of inspiration for new ideas.
48
48
 
49
49
  New docs website is coming!