@molecule/app-angular 3.3.1 → 3.5.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 (107) hide show
  1. package/README.md +3880 -1264
  2. package/dist/hooks/external-store.d.ts +32 -0
  3. package/dist/hooks/external-store.d.ts.map +1 -0
  4. package/dist/hooks/external-store.js +62 -0
  5. package/dist/hooks/external-store.js.map +1 -0
  6. package/dist/hooks/index.d.ts +24 -0
  7. package/dist/hooks/index.d.ts.map +1 -0
  8. package/dist/hooks/index.js +24 -0
  9. package/dist/hooks/index.js.map +1 -0
  10. package/dist/hooks/use-ai-models.d.ts +46 -0
  11. package/dist/hooks/use-ai-models.d.ts.map +1 -0
  12. package/dist/hooks/use-ai-models.js +142 -0
  13. package/dist/hooks/use-ai-models.js.map +1 -0
  14. package/dist/hooks/use-async.d.ts +125 -0
  15. package/dist/hooks/use-async.d.ts.map +1 -0
  16. package/dist/hooks/use-async.js +189 -0
  17. package/dist/hooks/use-async.js.map +1 -0
  18. package/dist/hooks/use-auth-flows.d.ts +207 -0
  19. package/dist/hooks/use-auth-flows.d.ts.map +1 -0
  20. package/dist/hooks/use-auth-flows.js +460 -0
  21. package/dist/hooks/use-auth-flows.js.map +1 -0
  22. package/dist/hooks/use-auth.d.ts +80 -0
  23. package/dist/hooks/use-auth.d.ts.map +1 -0
  24. package/dist/hooks/use-auth.js +89 -0
  25. package/dist/hooks/use-auth.js.map +1 -0
  26. package/dist/hooks/use-forms.d.ts +177 -0
  27. package/dist/hooks/use-forms.d.ts.map +1 -0
  28. package/dist/hooks/use-forms.js +185 -0
  29. package/dist/hooks/use-forms.js.map +1 -0
  30. package/dist/hooks/use-http.d.ts +155 -0
  31. package/dist/hooks/use-http.d.ts.map +1 -0
  32. package/dist/hooks/use-http.js +212 -0
  33. package/dist/hooks/use-http.js.map +1 -0
  34. package/dist/hooks/use-ide.d.ts +208 -0
  35. package/dist/hooks/use-ide.d.ts.map +1 -0
  36. package/dist/hooks/use-ide.js +217 -0
  37. package/dist/hooks/use-ide.js.map +1 -0
  38. package/dist/hooks/use-logger.d.ts +40 -0
  39. package/dist/hooks/use-logger.d.ts.map +1 -0
  40. package/dist/hooks/use-logger.js +56 -0
  41. package/dist/hooks/use-logger.js.map +1 -0
  42. package/dist/hooks/use-native.d.ts +213 -0
  43. package/dist/hooks/use-native.d.ts.map +1 -0
  44. package/dist/hooks/use-native.js +158 -0
  45. package/dist/hooks/use-native.js.map +1 -0
  46. package/dist/hooks/use-profile-form.d.ts +113 -0
  47. package/dist/hooks/use-profile-form.d.ts.map +1 -0
  48. package/dist/hooks/use-profile-form.js +253 -0
  49. package/dist/hooks/use-profile-form.js.map +1 -0
  50. package/dist/hooks/use-router.d.ts +212 -0
  51. package/dist/hooks/use-router.d.ts.map +1 -0
  52. package/dist/hooks/use-router.js +251 -0
  53. package/dist/hooks/use-router.js.map +1 -0
  54. package/dist/hooks/use-storage.d.ts +128 -0
  55. package/dist/hooks/use-storage.d.ts.map +1 -0
  56. package/dist/hooks/use-storage.js +217 -0
  57. package/dist/hooks/use-storage.js.map +1 -0
  58. package/dist/hooks/use-store.d.ts +74 -0
  59. package/dist/hooks/use-store.d.ts.map +1 -0
  60. package/dist/hooks/use-store.js +103 -0
  61. package/dist/hooks/use-store.js.map +1 -0
  62. package/dist/hooks/use-theme.d.ts +59 -0
  63. package/dist/hooks/use-theme.d.ts.map +1 -0
  64. package/dist/hooks/use-theme.js +117 -0
  65. package/dist/hooks/use-theme.js.map +1 -0
  66. package/dist/hooks/use-translation.d.ts +86 -0
  67. package/dist/hooks/use-translation.d.ts.map +1 -0
  68. package/dist/hooks/use-translation.js +146 -0
  69. package/dist/hooks/use-translation.js.map +1 -0
  70. package/dist/hooks/use-verify-payment-return.d.ts +86 -0
  71. package/dist/hooks/use-verify-payment-return.d.ts.map +1 -0
  72. package/dist/hooks/use-verify-payment-return.js +167 -0
  73. package/dist/hooks/use-verify-payment-return.js.map +1 -0
  74. package/dist/hooks/use-version.d.ts +49 -0
  75. package/dist/hooks/use-version.d.ts.map +1 -0
  76. package/dist/hooks/use-version.js +70 -0
  77. package/dist/hooks/use-version.js.map +1 -0
  78. package/dist/i18n-reactive.d.ts +2 -5
  79. package/dist/i18n-reactive.d.ts.map +1 -1
  80. package/dist/i18n-reactive.js.map +1 -1
  81. package/dist/index.d.ts +2 -0
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +2 -0
  84. package/dist/index.js.map +1 -1
  85. package/dist/inject.d.ts +24 -0
  86. package/dist/inject.d.ts.map +1 -0
  87. package/dist/inject.js +33 -0
  88. package/dist/inject.js.map +1 -0
  89. package/dist/providers.d.ts +24 -0
  90. package/dist/providers.d.ts.map +1 -1
  91. package/dist/providers.js +44 -3
  92. package/dist/providers.js.map +1 -1
  93. package/dist/session-ready.d.ts +41 -0
  94. package/dist/session-ready.d.ts.map +1 -0
  95. package/dist/session-ready.js +79 -0
  96. package/dist/session-ready.js.map +1 -0
  97. package/dist/site.d.ts +51 -0
  98. package/dist/site.d.ts.map +1 -0
  99. package/dist/site.js +69 -0
  100. package/dist/site.js.map +1 -0
  101. package/dist/tokens.d.ts +15 -0
  102. package/dist/tokens.d.ts.map +1 -1
  103. package/dist/tokens.js +12 -0
  104. package/dist/tokens.js.map +1 -1
  105. package/dist/types.d.ts +14 -1
  106. package/dist/types.d.ts.map +1 -1
  107. package/package.json +5 -5
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Angular functions for loggers, mirroring `useLogger`, `useLoggerProvider`,
3
+ * `useRootLogger` and `useChildLogger` from `@molecule/app-react`.
4
+ *
5
+ * @module
6
+ */
7
+ import type { Logger, LoggerConfig, LoggerProvider } from '@molecule/app-logger';
8
+ /**
9
+ * The logger provider registered by `provideMolecule({ logger })` or
10
+ * `provideLogger`. Call it in an injection context.
11
+ *
12
+ * @returns The logger provider.
13
+ * @throws {Error} When no logger provider is registered.
14
+ */
15
+ export declare function useLoggerProvider(): LoggerProvider;
16
+ /**
17
+ * A named logger from the registered provider. Call it in an injection
18
+ * context.
19
+ *
20
+ * @param name - Logger name (usually the component or module name).
21
+ * @param config - Optional configuration; a `name` in it wins over `name`.
22
+ * @returns The logger instance.
23
+ */
24
+ export declare function useLogger(name: string, config?: Partial<LoggerConfig>): Logger;
25
+ /**
26
+ * The provider's unnamed root logger. Call it in an injection context.
27
+ *
28
+ * @returns The root logger instance.
29
+ */
30
+ export declare function useRootLogger(): Logger;
31
+ /**
32
+ * A child logger whose context rides every call. Call it in an injection
33
+ * context.
34
+ *
35
+ * @param parentName - The parent logger's name.
36
+ * @param context - Additional context included in every log call.
37
+ * @returns The child logger instance.
38
+ */
39
+ export declare function useChildLogger(parentName: string, context: Record<string, unknown>): Logger;
40
+ //# sourceMappingURL=use-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-logger.d.ts","sourceRoot":"","sources":["../../src/hooks/use-logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAKhF;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAMlD;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,MAAM,CAM9E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAGtC;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAI3F"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Angular functions for loggers, mirroring `useLogger`, `useLoggerProvider`,
3
+ * `useRootLogger` and `useChildLogger` from `@molecule/app-react`.
4
+ *
5
+ * @module
6
+ */
7
+ import { injectProvider } from '../inject.js';
8
+ import { LOGGER_PROVIDER } from '../tokens.js';
9
+ /**
10
+ * The logger provider registered by `provideMolecule({ logger })` or
11
+ * `provideLogger`. Call it in an injection context.
12
+ *
13
+ * @returns The logger provider.
14
+ * @throws {Error} When no logger provider is registered.
15
+ */
16
+ export function useLoggerProvider() {
17
+ return injectProvider(LOGGER_PROVIDER, 'useLoggerOutsideProvider', 'useLoggerProvider must be used within a LoggerProvider');
18
+ }
19
+ /**
20
+ * A named logger from the registered provider. Call it in an injection
21
+ * context.
22
+ *
23
+ * @param name - Logger name (usually the component or module name).
24
+ * @param config - Optional configuration; a `name` in it wins over `name`.
25
+ * @returns The logger instance.
26
+ */
27
+ export function useLogger(name, config) {
28
+ const provider = useLoggerProvider();
29
+ if (config) {
30
+ return provider.createLogger({ name, ...config });
31
+ }
32
+ return provider.getLogger(name);
33
+ }
34
+ /**
35
+ * The provider's unnamed root logger. Call it in an injection context.
36
+ *
37
+ * @returns The root logger instance.
38
+ */
39
+ export function useRootLogger() {
40
+ const provider = useLoggerProvider();
41
+ return provider.getLogger();
42
+ }
43
+ /**
44
+ * A child logger whose context rides every call. Call it in an injection
45
+ * context.
46
+ *
47
+ * @param parentName - The parent logger's name.
48
+ * @param context - Additional context included in every log call.
49
+ * @returns The child logger instance.
50
+ */
51
+ export function useChildLogger(parentName, context) {
52
+ const provider = useLoggerProvider();
53
+ const parent = provider.getLogger(parentName);
54
+ return parent.withContext(context);
55
+ }
56
+ //# sourceMappingURL=use-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-logger.js","sourceRoot":"","sources":["../../src/hooks/use-logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,cAAc,CACnB,eAAe,EACf,0BAA0B,EAC1B,wDAAwD,CACzD,CAAA;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,MAA8B;IACpE,MAAM,QAAQ,GAAG,iBAAiB,EAAE,CAAA;IACpC,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;IACnD,CAAC;IACD,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;AACjC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,QAAQ,GAAG,iBAAiB,EAAE,CAAA;IACpC,OAAO,QAAQ,CAAC,SAAS,EAAE,CAAA;AAC7B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,UAAkB,EAAE,OAAgC;IACjF,MAAM,QAAQ,GAAG,iBAAiB,EAAE,CAAA;IACpC,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;IAC7C,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;AACpC,CAAC"}
@@ -0,0 +1,213 @@
1
+ /**
2
+ * Angular functions for native capabilities, mirroring `useDevice`,
3
+ * `usePlatform`, `useCapacitorApp` and `usePush` from `@molecule/app-react`.
4
+ *
5
+ * @module
6
+ */
7
+ import { type Signal } from '@angular/core';
8
+ import type { DeviceInfo, FeatureSupport, HardwareInfo, ScreenInfo } from '@molecule/app-device';
9
+ import type { Platform } from '@molecule/app-platform';
10
+ import { type CapacitorAppOptions } from '@molecule/app-platform';
11
+ import type { NotificationActionListener, NotificationReceivedListener, PermissionStatus, PushRegisterOptions, PushToken, TokenChangeListener } from '@molecule/app-push';
12
+ /**
13
+ * What {@link useDevice} returns: the provider's info objects and its two
14
+ * helpers.
15
+ */
16
+ export interface UseDeviceResult {
17
+ /** The device info. */
18
+ deviceInfo: DeviceInfo;
19
+ /** The screen info. */
20
+ screenInfo: ScreenInfo;
21
+ /** The hardware info. */
22
+ hardwareInfo: HardwareInfo;
23
+ /** Which features this device supports. */
24
+ featureSupport: FeatureSupport;
25
+ /**
26
+ * Whether a feature is supported.
27
+ *
28
+ * @param feature - The feature to check.
29
+ * @returns Whether the feature is supported.
30
+ */
31
+ supports: (feature: keyof FeatureSupport) => boolean;
32
+ /**
33
+ * Whether the device is online.
34
+ *
35
+ * @returns Whether the device is online.
36
+ */
37
+ isOnline: () => boolean;
38
+ /**
39
+ * Whether the app runs standalone (installed).
40
+ *
41
+ * @returns Whether the app is standalone.
42
+ */
43
+ isStandalone: () => boolean;
44
+ /** The primary language tag. */
45
+ language: string;
46
+ /** The preferred language tags. */
47
+ languages: string[];
48
+ }
49
+ /**
50
+ * Device information and utility methods. Call it in an injection context.
51
+ *
52
+ * Uses module-level `getProvider()` — device info is a singleton, not
53
+ * registration-provided. Device info is static and doesn't change at runtime,
54
+ * so it is read once, like React's memoized hook.
55
+ *
56
+ * @returns Device information and utility methods.
57
+ */
58
+ export declare function useDevice(): UseDeviceResult;
59
+ /**
60
+ * What {@link usePlatform} returns: the detected platform's info and the
61
+ * `isPlatform` helper.
62
+ */
63
+ export interface UsePlatformResult {
64
+ /** The detected platform. */
65
+ platform: Platform;
66
+ /** Whether the app runs in a native container. */
67
+ isNative: boolean;
68
+ /** Whether the platform is mobile. */
69
+ isMobile: boolean;
70
+ /** Whether the platform is desktop. */
71
+ isDesktop: boolean;
72
+ /** Whether the platform is the web. */
73
+ isWeb: boolean;
74
+ /** Whether the app runs in development. */
75
+ isDevelopment: boolean;
76
+ /** Whether the app runs in production. */
77
+ isProduction: boolean;
78
+ /**
79
+ * Whether the current platform is one of the candidates.
80
+ *
81
+ * @param platforms - The candidate platforms.
82
+ * @returns Whether any candidate matches.
83
+ */
84
+ isPlatform: (...platforms: Platform[]) => boolean;
85
+ }
86
+ /**
87
+ * Platform detection. Call it in an injection context.
88
+ *
89
+ * Uses module-level functions — platform is a singleton, not
90
+ * registration-provided. Platform info is static and doesn't change at
91
+ * runtime, so it is read once, like React's memoized hook.
92
+ *
93
+ * @returns Platform information and utility methods.
94
+ */
95
+ export declare function usePlatform(): UsePlatformResult;
96
+ /**
97
+ * What {@link useCapacitorApp} returns: every state field as a signal and
98
+ * `initialize` as a plain function.
99
+ */
100
+ export interface UseCapacitorAppResult {
101
+ /** Whether the app is fully initialized. */
102
+ readonly ready: Signal<boolean>;
103
+ /** Whether device ready has fired. */
104
+ readonly deviceReady: Signal<boolean>;
105
+ /** Whether push notifications are initialized. */
106
+ readonly pushReady: Signal<boolean>;
107
+ /** The initialization error, if any. */
108
+ readonly error: Signal<Error | null>;
109
+ /**
110
+ * Runs initialization again (manual re-initialization).
111
+ *
112
+ * @returns Resolves once initialization finished.
113
+ */
114
+ initialize: () => Promise<void>;
115
+ }
116
+ /**
117
+ * Capacitor app initialization and state management. Call it in an injection
118
+ * context (a component field initializer or constructor).
119
+ *
120
+ * Creates a `CapacitorApp` coordinator, subscribes to state changes, and
121
+ * auto-initializes. Cleans up on destroy via `destroy()`.
122
+ *
123
+ * @param options - Capacitor app configuration options.
124
+ * @returns The current app state as signals and an `initialize` function.
125
+ */
126
+ export declare function useCapacitorApp(options?: CapacitorAppOptions): UseCapacitorAppResult;
127
+ /**
128
+ * Options for {@link usePush} (e.g. check permission on mount).
129
+ */
130
+ export interface UsePushOptions {
131
+ /** Whether to check permission status on mount. */
132
+ checkOnMount?: boolean;
133
+ }
134
+ /**
135
+ * What {@link usePush} returns: the permission and token as signals and every
136
+ * action as a plain function.
137
+ */
138
+ export interface UsePushResult {
139
+ /** The known permission status, `null` until one is read. */
140
+ readonly permission: Signal<PermissionStatus | null>;
141
+ /** The registered token, `null` while unregistered. */
142
+ readonly token: Signal<PushToken | null>;
143
+ /**
144
+ * Reads the permission status and stores it.
145
+ *
146
+ * @returns The status.
147
+ */
148
+ checkPermission: () => Promise<PermissionStatus>;
149
+ /**
150
+ * Asks for permission and stores the status.
151
+ *
152
+ * @returns The status.
153
+ */
154
+ requestPermission: () => Promise<PermissionStatus>;
155
+ /**
156
+ * Registers for push notifications and stores the token.
157
+ *
158
+ * @param options - Registration options.
159
+ * @returns The token.
160
+ */
161
+ register: (options?: PushRegisterOptions) => Promise<PushToken>;
162
+ /**
163
+ * Unregisters and clears the token.
164
+ *
165
+ * @returns Resolves once unregistered.
166
+ */
167
+ unregister: () => Promise<void>;
168
+ /**
169
+ * Subscribes to received notifications.
170
+ *
171
+ * @param listener - Called for every notification.
172
+ * @returns A function that removes the listener.
173
+ */
174
+ onNotificationReceived: (listener: NotificationReceivedListener) => () => void;
175
+ /**
176
+ * Subscribes to notification actions.
177
+ *
178
+ * @param listener - Called for every action.
179
+ * @returns A function that removes the listener.
180
+ */
181
+ onNotificationAction: (listener: NotificationActionListener) => () => void;
182
+ /**
183
+ * Subscribes to token changes.
184
+ *
185
+ * @param listener - Called for every new token.
186
+ * @returns A function that removes the listener.
187
+ */
188
+ onTokenChange: (listener: TokenChangeListener) => () => void;
189
+ /**
190
+ * Sets the badge count.
191
+ *
192
+ * @param count - The count to set.
193
+ * @returns Resolves once set.
194
+ */
195
+ setBadge: (count: number) => Promise<void>;
196
+ /**
197
+ * Clears the badge count.
198
+ *
199
+ * @returns Resolves once cleared.
200
+ */
201
+ clearBadge: () => Promise<void>;
202
+ }
203
+ /**
204
+ * Push notification state and actions. Call it in an injection context.
205
+ *
206
+ * Uses module-level `getProvider()` — push is a singleton, not
207
+ * registration-provided.
208
+ *
209
+ * @param options - Hook options.
210
+ * @returns The permission and token as signals and the action functions.
211
+ */
212
+ export declare function usePush(options?: UsePushOptions): UsePushResult;
213
+ //# sourceMappingURL=use-native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-native.d.ts","sourceRoot":"","sources":["../../src/hooks/use-native.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAgC,KAAK,MAAM,EAAU,MAAM,eAAe,CAAA;AAEjF,OAAO,KAAK,EAAE,UAAU,EAAE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IAC/D;;;;OAIG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/B;;;;;OAKG;IACH,sBAAsB,EAAE,CAAC,QAAQ,EAAE,4BAA4B,KAAK,MAAM,IAAI,CAAA;IAC9E;;;;;OAKG;IACH,oBAAoB,EAAE,CAAC,QAAQ,EAAE,0BAA0B,KAAK,MAAM,IAAI,CAAA;IAC1E;;;;;OAKG;IACH,aAAa,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,MAAM,IAAI,CAAA;IAC5D;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1C;;;;OAIG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,aAAa,CAsE/D"}
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Angular functions for native capabilities, mirroring `useDevice`,
3
+ * `usePlatform`, `useCapacitorApp` and `usePush` from `@molecule/app-react`.
4
+ *
5
+ * @module
6
+ */
7
+ import { computed, DestroyRef, inject, signal } from '@angular/core';
8
+ import { getProvider as getDeviceProvider } from '@molecule/app-device';
9
+ import { getLogger } from '@molecule/app-logger';
10
+ import { createCapacitorApp, isPlatform as isPlatformOn, platform as platformInfo, } from '@molecule/app-platform';
11
+ import { getProvider as getPushProvider } from '@molecule/app-push';
12
+ /**
13
+ * Device information and utility methods. Call it in an injection context.
14
+ *
15
+ * Uses module-level `getProvider()` — device info is a singleton, not
16
+ * registration-provided. Device info is static and doesn't change at runtime,
17
+ * so it is read once, like React's memoized hook.
18
+ *
19
+ * @returns Device information and utility methods.
20
+ */
21
+ export function useDevice() {
22
+ const provider = getDeviceProvider();
23
+ return {
24
+ deviceInfo: provider.getDeviceInfo(),
25
+ screenInfo: provider.getScreenInfo(),
26
+ hardwareInfo: provider.getHardwareInfo(),
27
+ featureSupport: provider.getFeatureSupport(),
28
+ supports: (feature) => provider.supports(feature),
29
+ isOnline: () => provider.isOnline(),
30
+ isStandalone: () => provider.isStandalone(),
31
+ language: provider.getLanguage(),
32
+ languages: provider.getLanguages(),
33
+ };
34
+ }
35
+ /**
36
+ * Platform detection. Call it in an injection context.
37
+ *
38
+ * Uses module-level functions — platform is a singleton, not
39
+ * registration-provided. Platform info is static and doesn't change at
40
+ * runtime, so it is read once, like React's memoized hook.
41
+ *
42
+ * @returns Platform information and utility methods.
43
+ */
44
+ export function usePlatform() {
45
+ const info = platformInfo();
46
+ return {
47
+ platform: info.platform,
48
+ isNative: info.isNative,
49
+ isMobile: info.isMobile,
50
+ isDesktop: info.isDesktop,
51
+ isWeb: info.isWeb,
52
+ isDevelopment: info.isDevelopment,
53
+ isProduction: info.isProduction,
54
+ isPlatform: (...platforms) => isPlatformOn(...platforms),
55
+ };
56
+ }
57
+ /**
58
+ * Capacitor app initialization and state management. Call it in an injection
59
+ * context (a component field initializer or constructor).
60
+ *
61
+ * Creates a `CapacitorApp` coordinator, subscribes to state changes, and
62
+ * auto-initializes. Cleans up on destroy via `destroy()`.
63
+ *
64
+ * @param options - Capacitor app configuration options.
65
+ * @returns The current app state as signals and an `initialize` function.
66
+ */
67
+ export function useCapacitorApp(options = {}) {
68
+ const app = createCapacitorApp(options);
69
+ const state = signal(app.getState(), /* @ts-ignore */
70
+ ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
71
+ const stop = app.subscribe((newState) => state.set(newState));
72
+ const initialize = async () => {
73
+ await app.initialize();
74
+ };
75
+ const destroyRef = inject(DestroyRef);
76
+ destroyRef.onDestroy(stop);
77
+ destroyRef.onDestroy(() => app.destroy());
78
+ // Auto-initialize; the coordinator puts a failure in state, which this hook returns.
79
+ app.initialize().catch((_error) => {
80
+ // Reported through the coordinator's `error` state field above.
81
+ });
82
+ return {
83
+ ready: computed(() => state().ready),
84
+ deviceReady: computed(() => state().deviceReady),
85
+ pushReady: computed(() => state().pushReady),
86
+ error: computed(() => state().error),
87
+ initialize,
88
+ };
89
+ }
90
+ /**
91
+ * Push notification state and actions. Call it in an injection context.
92
+ *
93
+ * Uses module-level `getProvider()` — push is a singleton, not
94
+ * registration-provided.
95
+ *
96
+ * @param options - Hook options.
97
+ * @returns The permission and token as signals and the action functions.
98
+ */
99
+ export function usePush(options) {
100
+ const { checkOnMount = false } = options ?? {};
101
+ const provider = getPushProvider();
102
+ const permission = signal(null, /* @ts-ignore */
103
+ ...(ngDevMode ? [{ debugName: "permission" }] : /* istanbul ignore next */ []));
104
+ const token = signal(null, /* @ts-ignore */
105
+ ...(ngDevMode ? [{ debugName: "token" }] : /* istanbul ignore next */ []));
106
+ // Check permission on mount if requested.
107
+ if (checkOnMount) {
108
+ provider
109
+ .checkPermission()
110
+ .then((status) => permission.set(status))
111
+ .catch((error) => {
112
+ // The permission stays unknown until checkPermission() is called again.
113
+ getLogger('usePush').warn('Checking push permission on mount failed', { error });
114
+ });
115
+ }
116
+ const checkPermission = async () => {
117
+ const status = await provider.checkPermission();
118
+ permission.set(status);
119
+ return status;
120
+ };
121
+ const requestPermission = async () => {
122
+ const status = await provider.requestPermission();
123
+ permission.set(status);
124
+ return status;
125
+ };
126
+ const register = async (registerOptions) => {
127
+ const pushToken = await provider.register(registerOptions);
128
+ token.set(pushToken);
129
+ return pushToken;
130
+ };
131
+ const unregister = async () => {
132
+ await provider.unregister();
133
+ token.set(null);
134
+ };
135
+ const onNotificationReceived = (listener) => provider.onNotificationReceived(listener);
136
+ const onNotificationAction = (listener) => provider.onNotificationAction(listener);
137
+ const onTokenChange = (listener) => provider.onTokenChange(listener);
138
+ const setBadge = async (count) => {
139
+ await provider.setBadge(count);
140
+ };
141
+ const clearBadge = async () => {
142
+ await provider.clearBadge();
143
+ };
144
+ return {
145
+ permission: permission.asReadonly(),
146
+ token: token.asReadonly(),
147
+ checkPermission,
148
+ requestPermission,
149
+ register,
150
+ unregister,
151
+ onNotificationReceived,
152
+ onNotificationAction,
153
+ onTokenChange,
154
+ setBadge,
155
+ clearBadge,
156
+ };
157
+ }
158
+ //# sourceMappingURL=use-native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-native.js","sourceRoot":"","sources":["../../src/hooks/use-native.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAe,MAAM,EAAE,MAAM,eAAe,CAAA;AAGjF,OAAO,EAAE,WAAW,IAAI,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAEhD,OAAO,EAIL,kBAAkB,EAClB,UAAU,IAAI,YAAY,EAC1B,QAAQ,IAAI,YAAY,GACzB,MAAM,wBAAwB,CAAA;AAS/B,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAwCnE;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,QAAQ,GAAG,iBAAiB,EAAE,CAAA;IAEpC,OAAO;QACL,UAAU,EAAE,QAAQ,CAAC,aAAa,EAAE;QACpC,UAAU,EAAE,QAAQ,CAAC,aAAa,EAAE;QACpC,YAAY,EAAE,QAAQ,CAAC,eAAe,EAAE;QACxC,cAAc,EAAE,QAAQ,CAAC,iBAAiB,EAAE;QAC5C,QAAQ,EAAE,CAAC,OAA6B,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC;QACvE,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE;QACnC,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE;QAC3C,QAAQ,EAAE,QAAQ,CAAC,WAAW,EAAE;QAChC,SAAS,EAAE,QAAQ,CAAC,YAAY,EAAE;KACnC,CAAA;AACH,CAAC;AA8BD;;;;;;;;GAQG;AACH,MAAM,UA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Q;QACR,UAAU;KACX,CAAA;AACH,CAAC"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Profile editing over the app's bonded form and auth clients, mirroring
3
+ * `useProfileForm` from `@molecule/app-react`.
4
+ *
5
+ * @module
6
+ */
7
+ import { type Signal } from '@angular/core';
8
+ import type { FieldRegistration, FormValuesConstraint } from '@molecule/app-forms';
9
+ import { type UseFormOptions, type UseFormResult } from './use-forms.js';
10
+ /**
11
+ * Configuration for a profile form; transport stays in the auth bond.
12
+ *
13
+ * `TValues` is the page's own controlled-values type, named once as an
14
+ * `interface` or a type alias — both satisfy the shared form-values constraint.
15
+ */
16
+ export interface UseProfileFormOptions<TUser, TValues extends FormValuesConstraint<TValues>> extends Omit<UseFormOptions<TValues>, 'defaultValues'> {
17
+ /** Complete controlled-field defaults, including blank write-only fields. */
18
+ defaultValues: TValues;
19
+ /**
20
+ * Optional additional account identity check; changing it discards prior edits.
21
+ * By default ownership follows the auth client's session revision, so editable
22
+ * fields can change during a save. Providers without getSessionRevision must
23
+ * supply this callback with an identity that remains stable across profile edits.
24
+ *
25
+ * @param user - The current user.
26
+ * @returns The account identity.
27
+ */
28
+ getIdentity?: (user: TUser) => string;
29
+ /**
30
+ * Maps the current/saved user into controlled values, e.g. nullable text to ''.
31
+ *
32
+ * @param user - The current user.
33
+ * @returns The controlled values.
34
+ */
35
+ toValues: (user: TUser) => TValues;
36
+ /**
37
+ * Maps ONLY changed fields into an API patch. Omit blank optional credentials
38
+ * here; preserve undefined/absent fields rather than turning them into null.
39
+ * The second argument is the complete value snapshot taken at submit time.
40
+ *
41
+ * @param changes - The changed fields.
42
+ * @param values - The complete submit-time snapshot.
43
+ * @returns The API patch.
44
+ */
45
+ toPatch: (changes: Partial<TValues>, values: Readonly<TValues>) => Partial<TUser>;
46
+ /**
47
+ * Propagates the server's saved user to other caches, then navigates if needed.
48
+ * Awaited before submission finishes. The auth client already persists and
49
+ * publishes the saved user; never seed caches from the submitted patch.
50
+ *
51
+ * @param user - The saved user.
52
+ * @returns Resolves when propagation finished.
53
+ */
54
+ onSaved?: (user: TUser) => void | Promise<void>;
55
+ }
56
+ /** Controlled profile form state and native form bindings. */
57
+ export interface UseProfileFormResult<TUser, TValues extends FormValuesConstraint<TValues>> extends Omit<UseFormResult<TValues>, 'register' | 'handleSubmit' | 'reset'> {
58
+ /** The shared auth user's current profile. */
59
+ readonly user: Signal<TUser | null>;
60
+ /** A user has been loaded; disable submission until this is true. */
61
+ readonly ready: Signal<boolean>;
62
+ /**
63
+ * The latest save/propagation failure. Rejected saves retain edits; a failed
64
+ * onSaved callback can be retried by submit without repeating the mutation.
65
+ */
66
+ readonly error: Signal<unknown>;
67
+ /**
68
+ * Native input/textarea bindings with the field's concrete value type.
69
+ *
70
+ * @param name - The field's name.
71
+ * @param options - Registration options.
72
+ * @returns The registration, with edits tracked for the dirty rebase.
73
+ */
74
+ register: <K extends keyof TValues>(name: K, options?: Parameters<UseFormResult<TValues>['register']>[1]) => Omit<FieldRegistration, 'value'> & {
75
+ value: TValues[K];
76
+ };
77
+ /** Bind to the native form, with a type="submit" button inside it. */
78
+ formProps: {
79
+ onSubmit: (event: {
80
+ preventDefault: () => void;
81
+ }) => void;
82
+ };
83
+ /**
84
+ * Validates and saves one submit-time snapshot. Concurrent submits share the
85
+ * same promise. Resolves undefined on validation, save or propagation failure.
86
+ *
87
+ * @returns The saved user, or `undefined` on failure.
88
+ */
89
+ submit: () => Promise<TUser | undefined>;
90
+ /** Discards edits and restores the newest loaded/saved profile baseline. */
91
+ reset: () => void;
92
+ }
93
+ /**
94
+ * Owns load → edit → submit → publish for the signed-in user's profile. Call
95
+ * it in an injection context (a component field initializer or constructor).
96
+ *
97
+ * Same-account background updates refresh untouched fields but preserve dirty
98
+ * controls. Session ownership comes from the auth client, independently of
99
+ * mutable profile fields; an explicit getIdentity adds the caller's identity
100
+ * check. Submission snapshots the registered values before asynchronous
101
+ * validation, sends only changed fields through `toPatch`, and uses the auth
102
+ * client's configured updateProfile transport. The saved server response
103
+ * becomes the clean baseline; edits made while saving remain dirty. No request
104
+ * is made for a patch with no fields. A failed request retains the edits and
105
+ * shared user.
106
+ *
107
+ * @param options - Controlled defaults, identity and wire adapters, optional
108
+ * cache/navigation callback.
109
+ * @returns Form state, typed control bindings, native submit binding and save
110
+ * error.
111
+ */
112
+ export declare function useProfileForm<TUser, TValues extends FormValuesConstraint<TValues>>(options: UseProfileFormOptions<TUser, TValues>): UseProfileFormResult<TUser, TValues>;
113
+ //# sourceMappingURL=use-profile-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-profile-form.d.ts","sourceRoot":"","sources":["../../src/hooks/use-profile-form.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAwC,KAAK,MAAM,EAAU,MAAM,eAAe,CAAA;AAEzF,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAIlF,OAAO,EAAW,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAgBjF;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB,CACpC,KAAK,EACL,OAAO,SAAS,oBAAoB,CAAC,OAAO,CAAC,CAC7C,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC;IACtD,6EAA6E;IAC7E,aAAa,EAAE,OAAO,CAAA;IACtB;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAA;IACrC;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,OAAO,CAAA;IAClC;;;;;;;;OAQG;IACH,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,KAAK,CAAC,CAAA;IACjF;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,CAAC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