@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.
- package/README.md +3880 -1264
- package/dist/hooks/external-store.d.ts +32 -0
- package/dist/hooks/external-store.d.ts.map +1 -0
- package/dist/hooks/external-store.js +62 -0
- package/dist/hooks/external-store.js.map +1 -0
- package/dist/hooks/index.d.ts +24 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +24 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/use-ai-models.d.ts +46 -0
- package/dist/hooks/use-ai-models.d.ts.map +1 -0
- package/dist/hooks/use-ai-models.js +142 -0
- package/dist/hooks/use-ai-models.js.map +1 -0
- package/dist/hooks/use-async.d.ts +125 -0
- package/dist/hooks/use-async.d.ts.map +1 -0
- package/dist/hooks/use-async.js +189 -0
- package/dist/hooks/use-async.js.map +1 -0
- package/dist/hooks/use-auth-flows.d.ts +207 -0
- package/dist/hooks/use-auth-flows.d.ts.map +1 -0
- package/dist/hooks/use-auth-flows.js +460 -0
- package/dist/hooks/use-auth-flows.js.map +1 -0
- package/dist/hooks/use-auth.d.ts +80 -0
- package/dist/hooks/use-auth.d.ts.map +1 -0
- package/dist/hooks/use-auth.js +89 -0
- package/dist/hooks/use-auth.js.map +1 -0
- package/dist/hooks/use-forms.d.ts +177 -0
- package/dist/hooks/use-forms.d.ts.map +1 -0
- package/dist/hooks/use-forms.js +185 -0
- package/dist/hooks/use-forms.js.map +1 -0
- package/dist/hooks/use-http.d.ts +155 -0
- package/dist/hooks/use-http.d.ts.map +1 -0
- package/dist/hooks/use-http.js +212 -0
- package/dist/hooks/use-http.js.map +1 -0
- package/dist/hooks/use-ide.d.ts +208 -0
- package/dist/hooks/use-ide.d.ts.map +1 -0
- package/dist/hooks/use-ide.js +217 -0
- package/dist/hooks/use-ide.js.map +1 -0
- package/dist/hooks/use-logger.d.ts +40 -0
- package/dist/hooks/use-logger.d.ts.map +1 -0
- package/dist/hooks/use-logger.js +56 -0
- package/dist/hooks/use-logger.js.map +1 -0
- package/dist/hooks/use-native.d.ts +213 -0
- package/dist/hooks/use-native.d.ts.map +1 -0
- package/dist/hooks/use-native.js +158 -0
- package/dist/hooks/use-native.js.map +1 -0
- package/dist/hooks/use-profile-form.d.ts +113 -0
- package/dist/hooks/use-profile-form.d.ts.map +1 -0
- package/dist/hooks/use-profile-form.js +253 -0
- package/dist/hooks/use-profile-form.js.map +1 -0
- package/dist/hooks/use-router.d.ts +212 -0
- package/dist/hooks/use-router.d.ts.map +1 -0
- package/dist/hooks/use-router.js +251 -0
- package/dist/hooks/use-router.js.map +1 -0
- package/dist/hooks/use-storage.d.ts +128 -0
- package/dist/hooks/use-storage.d.ts.map +1 -0
- package/dist/hooks/use-storage.js +217 -0
- package/dist/hooks/use-storage.js.map +1 -0
- package/dist/hooks/use-store.d.ts +74 -0
- package/dist/hooks/use-store.d.ts.map +1 -0
- package/dist/hooks/use-store.js +103 -0
- package/dist/hooks/use-store.js.map +1 -0
- package/dist/hooks/use-theme.d.ts +59 -0
- package/dist/hooks/use-theme.d.ts.map +1 -0
- package/dist/hooks/use-theme.js +117 -0
- package/dist/hooks/use-theme.js.map +1 -0
- package/dist/hooks/use-translation.d.ts +86 -0
- package/dist/hooks/use-translation.d.ts.map +1 -0
- package/dist/hooks/use-translation.js +146 -0
- package/dist/hooks/use-translation.js.map +1 -0
- package/dist/hooks/use-verify-payment-return.d.ts +86 -0
- package/dist/hooks/use-verify-payment-return.d.ts.map +1 -0
- package/dist/hooks/use-verify-payment-return.js +167 -0
- package/dist/hooks/use-verify-payment-return.js.map +1 -0
- package/dist/hooks/use-version.d.ts +49 -0
- package/dist/hooks/use-version.d.ts.map +1 -0
- package/dist/hooks/use-version.js +70 -0
- package/dist/hooks/use-version.js.map +1 -0
- package/dist/i18n-reactive.d.ts +2 -5
- package/dist/i18n-reactive.d.ts.map +1 -1
- package/dist/i18n-reactive.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/inject.d.ts +24 -0
- package/dist/inject.d.ts.map +1 -0
- package/dist/inject.js +33 -0
- package/dist/inject.js.map +1 -0
- package/dist/providers.d.ts +24 -0
- package/dist/providers.d.ts.map +1 -1
- package/dist/providers.js +44 -3
- package/dist/providers.js.map +1 -1
- package/dist/session-ready.d.ts +41 -0
- package/dist/session-ready.d.ts.map +1 -0
- package/dist/session-ready.js +79 -0
- package/dist/session-ready.js.map +1 -0
- package/dist/site.d.ts +51 -0
- package/dist/site.d.ts.map +1 -0
- package/dist/site.js +69 -0
- package/dist/site.js.map +1 -0
- package/dist/tokens.d.ts +15 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +12 -0
- package/dist/tokens.js.map +1 -1
- package/dist/types.d.ts +14 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The external-store read discipline React's `useSyncExternalStore` hooks have,
|
|
3
|
+
* as a reusable bridge for the Angular hooks over providers that announce
|
|
4
|
+
* changes (`useVersion`, `useWorkspace`, `usePreview`).
|
|
5
|
+
*
|
|
6
|
+
* React reads the store twice while rendering, subscribes, then reads again to
|
|
7
|
+
* catch a change that landed in between; every notification re-reads once, and
|
|
8
|
+
* a notification that actually changed the snapshot re-reads three more times
|
|
9
|
+
* while React re-renders and re-checks. Service providers RECORD those reads,
|
|
10
|
+
* so a binding that reads a different number of times is a different client of
|
|
11
|
+
* the provider — this bridge keeps this package's read discipline identical to
|
|
12
|
+
* React's.
|
|
13
|
+
*
|
|
14
|
+
* The `read` passed in must cache its snapshot the way React's hook does (a
|
|
15
|
+
* stable object between notifications); the bridge compares snapshots by
|
|
16
|
+
* identity, exactly like `useSyncExternalStore`.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import { type Signal } from '@angular/core';
|
|
21
|
+
/**
|
|
22
|
+
* Subscribes to an external store and mirrors its value into a signal, with
|
|
23
|
+
* React's read discipline. Call it in an injection context.
|
|
24
|
+
*
|
|
25
|
+
* @param read - Reads the store's current snapshot (records on the provider);
|
|
26
|
+
* must return a stable object between notifications.
|
|
27
|
+
* @param subscribe - Subscribes to the store; receives the hook's own
|
|
28
|
+
* snapshot-invalidating callback and returns the unsubscribe function.
|
|
29
|
+
* @returns A signal of the store's current snapshot.
|
|
30
|
+
*/
|
|
31
|
+
export declare function useExternalStore<T>(read: () => T, subscribe: (notify: () => void) => () => void): Signal<T>;
|
|
32
|
+
//# sourceMappingURL=external-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-store.d.ts","sourceRoot":"","sources":["../../src/hooks/external-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAsB,KAAK,MAAM,EAAqB,MAAM,eAAe,CAAA;AAElF;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,IAAI,EAAE,MAAM,CAAC,EACb,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,GAC5C,MAAM,CAAC,CAAC,CAAC,CA2BX"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The external-store read discipline React's `useSyncExternalStore` hooks have,
|
|
3
|
+
* as a reusable bridge for the Angular hooks over providers that announce
|
|
4
|
+
* changes (`useVersion`, `useWorkspace`, `usePreview`).
|
|
5
|
+
*
|
|
6
|
+
* React reads the store twice while rendering, subscribes, then reads again to
|
|
7
|
+
* catch a change that landed in between; every notification re-reads once, and
|
|
8
|
+
* a notification that actually changed the snapshot re-reads three more times
|
|
9
|
+
* while React re-renders and re-checks. Service providers RECORD those reads,
|
|
10
|
+
* so a binding that reads a different number of times is a different client of
|
|
11
|
+
* the provider — this bridge keeps this package's read discipline identical to
|
|
12
|
+
* React's.
|
|
13
|
+
*
|
|
14
|
+
* The `read` passed in must cache its snapshot the way React's hook does (a
|
|
15
|
+
* stable object between notifications); the bridge compares snapshots by
|
|
16
|
+
* identity, exactly like `useSyncExternalStore`.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import { DestroyRef, inject, signal, untracked } from '@angular/core';
|
|
21
|
+
/**
|
|
22
|
+
* Subscribes to an external store and mirrors its value into a signal, with
|
|
23
|
+
* React's read discipline. Call it in an injection context.
|
|
24
|
+
*
|
|
25
|
+
* @param read - Reads the store's current snapshot (records on the provider);
|
|
26
|
+
* must return a stable object between notifications.
|
|
27
|
+
* @param subscribe - Subscribes to the store; receives the hook's own
|
|
28
|
+
* snapshot-invalidating callback and returns the unsubscribe function.
|
|
29
|
+
* @returns A signal of the store's current snapshot.
|
|
30
|
+
*/
|
|
31
|
+
export function useExternalStore(read, subscribe) {
|
|
32
|
+
// React reads the snapshot twice during its render phase.
|
|
33
|
+
read();
|
|
34
|
+
const state = signal(read(), /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
36
|
+
let reRenderScheduled = false;
|
|
37
|
+
const stop = subscribe(() => {
|
|
38
|
+
// Every notification re-reads once, changed or not.
|
|
39
|
+
const next = read();
|
|
40
|
+
if (Object.is(untracked(state), next))
|
|
41
|
+
return;
|
|
42
|
+
state.set(next);
|
|
43
|
+
if (reRenderScheduled)
|
|
44
|
+
return;
|
|
45
|
+
reRenderScheduled = true;
|
|
46
|
+
queueMicrotask(() => {
|
|
47
|
+
reRenderScheduled = false;
|
|
48
|
+
// React re-renders (one read) and its commit re-checks the snapshot
|
|
49
|
+
// (two more reads) once per update, however many notifications landed
|
|
50
|
+
// in the same flush.
|
|
51
|
+
state.set(read());
|
|
52
|
+
read();
|
|
53
|
+
read();
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
// A change between the first read and this subscription still shows: React
|
|
57
|
+
// reads again right after subscribing.
|
|
58
|
+
state.set(read());
|
|
59
|
+
inject(DestroyRef).onDestroy(stop);
|
|
60
|
+
return state.asReadonly();
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=external-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-store.js","sourceRoot":"","sources":["../../src/hooks/external-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAe,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAElF;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAa,EACb,SAA6C;IAE7C,0DAA0D;IAC1D,IAAI,EAAE,CAAA;IACN,MAAM,KAAK,GAAG,MAAM,CAAI,IAAI,EAAE;8EAAC,CAAA;IAC/B,IAAI,iBAAiB,GAAG,KAAK,CAAA;IAC7B,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,EAAE;QAC1B,oDAAoD;QACpD,MAAM,IAAI,GAAG,IAAI,EAAE,CAAA;QACnB,IAAI,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC;YAAE,OAAM;QAC7C,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACf,IAAI,iBAAiB;YAAE,OAAM;QAC7B,iBAAiB,GAAG,IAAI,CAAA;QACxB,cAAc,CAAC,GAAG,EAAE;YAClB,iBAAiB,GAAG,KAAK,CAAA;YACzB,oEAAoE;YACpE,sEAAsE;YACtE,qBAAqB;YACrB,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAA;YACjB,IAAI,EAAE,CAAA;YACN,IAAI,EAAE,CAAA;QACR,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IACF,2EAA2E;IAC3E,uCAAuC;IACvC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAA;IACjB,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAClC,OAAO,KAAK,CAAC,UAAU,EAAE,CAAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular functions mirroring every `@molecule/app-react` hook.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
export * from './external-store.js';
|
|
7
|
+
export * from './use-ai-models.js';
|
|
8
|
+
export * from './use-async.js';
|
|
9
|
+
export * from './use-auth.js';
|
|
10
|
+
export * from './use-auth-flows.js';
|
|
11
|
+
export * from './use-forms.js';
|
|
12
|
+
export * from './use-http.js';
|
|
13
|
+
export * from './use-ide.js';
|
|
14
|
+
export * from './use-logger.js';
|
|
15
|
+
export * from './use-native.js';
|
|
16
|
+
export * from './use-profile-form.js';
|
|
17
|
+
export * from './use-router.js';
|
|
18
|
+
export * from './use-storage.js';
|
|
19
|
+
export * from './use-store.js';
|
|
20
|
+
export * from './use-theme.js';
|
|
21
|
+
export * from './use-translation.js';
|
|
22
|
+
export * from './use-verify-payment-return.js';
|
|
23
|
+
export * from './use-version.js';
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular functions mirroring every `@molecule/app-react` hook.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
export * from './external-store.js';
|
|
7
|
+
export * from './use-ai-models.js';
|
|
8
|
+
export * from './use-async.js';
|
|
9
|
+
export * from './use-auth.js';
|
|
10
|
+
export * from './use-auth-flows.js';
|
|
11
|
+
export * from './use-forms.js';
|
|
12
|
+
export * from './use-http.js';
|
|
13
|
+
export * from './use-ide.js';
|
|
14
|
+
export * from './use-logger.js';
|
|
15
|
+
export * from './use-native.js';
|
|
16
|
+
export * from './use-profile-form.js';
|
|
17
|
+
export * from './use-router.js';
|
|
18
|
+
export * from './use-storage.js';
|
|
19
|
+
export * from './use-store.js';
|
|
20
|
+
export * from './use-theme.js';
|
|
21
|
+
export * from './use-translation.js';
|
|
22
|
+
export * from './use-verify-payment-return.js';
|
|
23
|
+
export * from './use-version.js';
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular function for the AI model catalog, mirroring `useAIModels` and
|
|
3
|
+
* `resetAIModelsCache` from `@molecule/app-react`.
|
|
4
|
+
*
|
|
5
|
+
* The catalog cache is a module-level singleton shared by every instance of
|
|
6
|
+
* this package, exactly like React's: the first mount of a scope fetches, and
|
|
7
|
+
* later mounts (including a re-created host at the same site) read the cache.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { type Signal } from '@angular/core';
|
|
12
|
+
import type { AppModelDefinition, AppModeModelDefaults } from '@molecule/app-ai-models';
|
|
13
|
+
/**
|
|
14
|
+
* Test-only: drops every cached model list so the next {@link useAIModels}
|
|
15
|
+
* call refetches. Exposed for unit tests; do not call from production code.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resetAIModelsCache(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Result returned by {@link useAIModels}: every field as a signal.
|
|
20
|
+
*/
|
|
21
|
+
export interface UseAIModelsResult {
|
|
22
|
+
/** Available models, or an empty array while loading. */
|
|
23
|
+
readonly models: Signal<AppModelDefinition[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Per-mode server default model ids for the requester's tier, or `undefined`
|
|
26
|
+
* while loading or on servers that don't provide them.
|
|
27
|
+
*/
|
|
28
|
+
readonly defaults: Signal<AppModeModelDefaults | undefined>;
|
|
29
|
+
/** The single model marked `freeTier: true`, or `undefined`. */
|
|
30
|
+
readonly freeTierModel: Signal<AppModelDefinition | undefined>;
|
|
31
|
+
/** `true` while the initial fetch is in flight. */
|
|
32
|
+
readonly loading: Signal<boolean>;
|
|
33
|
+
/** Error from the initial fetch, or `null`. */
|
|
34
|
+
readonly error: Signal<Error | null>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Subscribes to the cached AI model catalog. The first mount of a scope
|
|
38
|
+
* triggers a single `GET /ai/models` fetch; subsequent mounts return the
|
|
39
|
+
* cached result. Call it in an injection context.
|
|
40
|
+
*
|
|
41
|
+
* @param projectId - Optional project scope: includes that project's custom
|
|
42
|
+
* ("bring your own AI") models on servers that support them.
|
|
43
|
+
* @returns Models, free-tier model, loading flag, and error as signals.
|
|
44
|
+
*/
|
|
45
|
+
export declare function useAIModels(projectId?: string): UseAIModelsResult;
|
|
46
|
+
//# sourceMappingURL=use-ai-models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-ai-models.d.ts","sourceRoot":"","sources":["../../src/hooks/use-ai-models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAgC,KAAK,MAAM,EAAU,MAAM,eAAe,CAAA;AAEjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAkGvF;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CASzC;AAcD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,kBAAkB,EAAE,CAAC,CAAA;IAC7C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAAA;IAC3D,gEAAgE;IAChE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAAA;IAC9D,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;IACjC,+CAA+C;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,CAAA;CACrC;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,iBAAiB,CAgCjE"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular function for the AI model catalog, mirroring `useAIModels` and
|
|
3
|
+
* `resetAIModelsCache` from `@molecule/app-react`.
|
|
4
|
+
*
|
|
5
|
+
* The catalog cache is a module-level singleton shared by every instance of
|
|
6
|
+
* this package, exactly like React's: the first mount of a scope fetches, and
|
|
7
|
+
* later mounts (including a re-created host at the same site) read the cache.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { computed, DestroyRef, inject, signal } from '@angular/core';
|
|
12
|
+
import { loadAIModelCatalog, pickFreeTierModel } from '@molecule/app-ai-models';
|
|
13
|
+
import { useHttpClient } from './use-http.js';
|
|
14
|
+
/** One cache entry per scope — `''` for the unscoped catalog, else the projectId. */
|
|
15
|
+
const caches = new Map();
|
|
16
|
+
/**
|
|
17
|
+
* The cache entry for a scope, created on first use.
|
|
18
|
+
*
|
|
19
|
+
* @param scope - `''` for the unscoped catalog, else the projectId.
|
|
20
|
+
* @returns The scope's cache entry.
|
|
21
|
+
*/
|
|
22
|
+
function cacheFor(scope) {
|
|
23
|
+
let cache = caches.get(scope);
|
|
24
|
+
if (!cache) {
|
|
25
|
+
cache = { models: null, defaults: undefined, error: null, inFlight: null };
|
|
26
|
+
caches.set(scope, cache);
|
|
27
|
+
}
|
|
28
|
+
return cache;
|
|
29
|
+
}
|
|
30
|
+
/** Listeners keyed by the same scope as the cache they observe. */
|
|
31
|
+
const listenersByScope = new Map();
|
|
32
|
+
/**
|
|
33
|
+
* The listener set for a scope, created on first use.
|
|
34
|
+
*
|
|
35
|
+
* @param scope - The cache scope.
|
|
36
|
+
* @returns The scope's listener set.
|
|
37
|
+
*/
|
|
38
|
+
function listenersFor(scope) {
|
|
39
|
+
let set = listenersByScope.get(scope);
|
|
40
|
+
if (!set) {
|
|
41
|
+
set = new Set();
|
|
42
|
+
listenersByScope.set(scope, set);
|
|
43
|
+
}
|
|
44
|
+
return set;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Broadcasts a scope's current cache state to its subscribed listeners.
|
|
48
|
+
*
|
|
49
|
+
* @param scope - The cache scope to notify.
|
|
50
|
+
*/
|
|
51
|
+
function notify(scope) {
|
|
52
|
+
const cache = cacheFor(scope);
|
|
53
|
+
for (const listener of listenersFor(scope)) {
|
|
54
|
+
listener({ models: cache.models, defaults: cache.defaults, error: cache.error });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Triggers (or rejoins) the single in-flight fetch of `/ai/models` for a scope
|
|
59
|
+
* and stores the result in that scope's module-level cache.
|
|
60
|
+
*
|
|
61
|
+
* @param http - HTTP client used for the single fetch.
|
|
62
|
+
* @param scope - `''` for the unscoped catalog, else the projectId.
|
|
63
|
+
* @returns The fetched model list.
|
|
64
|
+
*/
|
|
65
|
+
async function fetchOnce(http, scope) {
|
|
66
|
+
const cache = cacheFor(scope);
|
|
67
|
+
if (cache.models)
|
|
68
|
+
return cache.models;
|
|
69
|
+
if (cache.inFlight)
|
|
70
|
+
return cache.inFlight;
|
|
71
|
+
cache.inFlight = loadAIModelCatalog(http, undefined, scope || undefined)
|
|
72
|
+
.then((catalog) => {
|
|
73
|
+
cache.models = catalog.models;
|
|
74
|
+
cache.defaults = catalog.defaults;
|
|
75
|
+
cache.error = null;
|
|
76
|
+
cache.inFlight = null;
|
|
77
|
+
notify(scope);
|
|
78
|
+
return catalog.models;
|
|
79
|
+
})
|
|
80
|
+
.catch((err) => {
|
|
81
|
+
cache.error = err instanceof Error ? err : new Error(String(err));
|
|
82
|
+
cache.inFlight = null;
|
|
83
|
+
notify(scope);
|
|
84
|
+
throw cache.error;
|
|
85
|
+
});
|
|
86
|
+
return cache.inFlight;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Test-only: drops every cached model list so the next {@link useAIModels}
|
|
90
|
+
* call refetches. Exposed for unit tests; do not call from production code.
|
|
91
|
+
*/
|
|
92
|
+
export function resetAIModelsCache() {
|
|
93
|
+
for (const [scope, cache] of caches) {
|
|
94
|
+
cache.models = null;
|
|
95
|
+
cache.defaults = undefined;
|
|
96
|
+
cache.error = null;
|
|
97
|
+
cache.inFlight = null;
|
|
98
|
+
notify(scope);
|
|
99
|
+
}
|
|
100
|
+
caches.clear();
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Subscribes to the cached AI model catalog. The first mount of a scope
|
|
104
|
+
* triggers a single `GET /ai/models` fetch; subsequent mounts return the
|
|
105
|
+
* cached result. Call it in an injection context.
|
|
106
|
+
*
|
|
107
|
+
* @param projectId - Optional project scope: includes that project's custom
|
|
108
|
+
* ("bring your own AI") models on servers that support them.
|
|
109
|
+
* @returns Models, free-tier model, loading flag, and error as signals.
|
|
110
|
+
*/
|
|
111
|
+
export function useAIModels(projectId) {
|
|
112
|
+
const http = useHttpClient();
|
|
113
|
+
const scope = projectId ?? '';
|
|
114
|
+
const destroyRef = inject(DestroyRef);
|
|
115
|
+
const cache = cacheFor(scope);
|
|
116
|
+
const snapshot = signal({
|
|
117
|
+
models: cache.models,
|
|
118
|
+
defaults: cache.defaults,
|
|
119
|
+
error: cache.error,
|
|
120
|
+
}, /* @ts-ignore */
|
|
121
|
+
...(ngDevMode ? [{ debugName: "snapshot" }] : /* istanbul ignore next */ []));
|
|
122
|
+
const listener = (next) => snapshot.set(next);
|
|
123
|
+
listenersFor(scope).add(listener);
|
|
124
|
+
destroyRef.onDestroy(() => {
|
|
125
|
+
listenersFor(scope).delete(listener);
|
|
126
|
+
});
|
|
127
|
+
if (!cache.models && !cache.error) {
|
|
128
|
+
fetchOnce(http, scope).catch((_error) => {
|
|
129
|
+
// fetchOnce mirrors the error into cache.error, which the listener delivers.
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
const models = computed(() => snapshot().models ?? [], /* @ts-ignore */
|
|
133
|
+
...(ngDevMode ? [{ debugName: "models" }] : /* istanbul ignore next */ []));
|
|
134
|
+
return {
|
|
135
|
+
models,
|
|
136
|
+
defaults: computed(() => snapshot().defaults),
|
|
137
|
+
freeTierModel: computed(() => pickFreeTierModel(models())),
|
|
138
|
+
loading: computed(() => !snapshot().models && !snapshot().error),
|
|
139
|
+
error: computed(() => snapshot().error),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=use-ai-models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-ai-models.js","sourceRoot":"","sources":["../../src/hooks/use-ai-models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAe,MAAM,EAAE,MAAM,eAAe,CAAA;AAGjF,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAG/E,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAS7C,qFAAqF;AACrF,MAAM,MAAM,GAAG,IAAI,GAAG,EAAsB,CAAA;AAE5C;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,KAAa;IAC7B,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,KAAK,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;QAC1E,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IAC1B,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAOD,mEAAmE;AACnE,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAyB,CAAA;AAEzD;;;;;GAKG;AACH,SAAS,YAAY,CAAC,KAAa;IACjC,IAAI,GAAG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,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACvD,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACjC,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE;QACxB,YAAY,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IACtC,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAClC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,MAAe,EAAE,EAAE;YAC/C,6EAA6E;QAC/E,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,IAAI,EAAE;+EAAC,CAAA;IACtD,OAAO;QACL,MAAM;QACN,QAAQ,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;QAC7C,aAAa,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC;QAC1D,OAAO,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC;QAChE,KAAK,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC;KACxC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Angular functions for async state, mirroring `usePromise`, `useAsyncState`
|
|
3
|
+
* and `useOptimisticValue` from `@molecule/app-react`.
|
|
4
|
+
*
|
|
5
|
+
* `usePromise` and `useAsyncState` return a plain mutable TUPLE whose state
|
|
6
|
+
* member is updated in place: the tuple is the mounted result for this
|
|
7
|
+
* component instance's whole lifetime, and every snapshot of it must show the
|
|
8
|
+
* state at that moment (React re-renders a new state object into the same
|
|
9
|
+
* tuple; this port mutates the same tuple's members).
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import { type Signal } from '@angular/core';
|
|
14
|
+
import type { OptimisticValue, OptimisticValueOptions } from '@molecule/app-state';
|
|
15
|
+
import type { PromiseStatus } from '@molecule/app-utilities';
|
|
16
|
+
/**
|
|
17
|
+
* The state of the latest {@link usePromise} call.
|
|
18
|
+
*
|
|
19
|
+
* @template T - The resolved value's shape.
|
|
20
|
+
*/
|
|
21
|
+
export interface UsePromiseState<T> {
|
|
22
|
+
/** `'idle'`, `'pending'`, `'resolved'` or `'rejected'`. */
|
|
23
|
+
status: PromiseStatus;
|
|
24
|
+
/** The resolved value, `null` before the first resolution and after a reset. */
|
|
25
|
+
value: T | null;
|
|
26
|
+
/** The rejection of the latest call, or the cancel message as an Error. */
|
|
27
|
+
error: Error | null;
|
|
28
|
+
/** Marks a pending call rejected; its late result is not shown. */
|
|
29
|
+
cancel: (message?: string) => void;
|
|
30
|
+
/** Returns the state to idle and clears value and error. */
|
|
31
|
+
reset: () => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Wraps an async function with the state of its latest call. Call it in an
|
|
35
|
+
* injection context (a component field initializer or constructor).
|
|
36
|
+
*
|
|
37
|
+
* For one UI action, pass `state.status === 'pending'` to a button's loading
|
|
38
|
+
* input. The control then refuses input while the request is pending and
|
|
39
|
+
* re-enables when the tracked call settles. Handle the returned promise's
|
|
40
|
+
* rejection; the hook also records the failure in `state.error`.
|
|
41
|
+
*
|
|
42
|
+
* This hook tracks the latest call: it does not serialize invocations or
|
|
43
|
+
* cancel their network requests. An explicit reset/cancel changes the tracked
|
|
44
|
+
* state, so it is not proof that an outstanding request has stopped. Use an
|
|
45
|
+
* app-owned queue when every click must be accepted in order.
|
|
46
|
+
*
|
|
47
|
+
* @param asyncFn - The async function to wrap.
|
|
48
|
+
* @returns A tuple of `[state, wrappedFunction]`; the state object is updated
|
|
49
|
+
* in place for this instance's lifetime.
|
|
50
|
+
*/
|
|
51
|
+
export declare const usePromise: <T extends (...args: never[]) => Promise<unknown>>(asyncFn: T) => [UsePromiseState<Awaited<ReturnType<T>>>, (...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>];
|
|
52
|
+
/**
|
|
53
|
+
* An async-capable setState function: a value, an updater receiving the
|
|
54
|
+
* previous state, or a promise resolving to either. Errors from a resolved
|
|
55
|
+
* promise are swallowed so they never surface as unhandled rejections.
|
|
56
|
+
*
|
|
57
|
+
* @template T - The state's shape.
|
|
58
|
+
*/
|
|
59
|
+
export type AsyncSetState<T> = (value: T | ((prev: T) => T) | Promise<T | ((prev: T) => T)>) => Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* An async-capable extendState function for partial updates.
|
|
62
|
+
*
|
|
63
|
+
* @template T - The state's shape.
|
|
64
|
+
*/
|
|
65
|
+
export type AsyncExtendState<T> = (partial: Partial<T> | ((prev: T) => Partial<T>) | Promise<Partial<T> | ((prev: T) => Partial<T>)>) => Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Like `useState` but accepts Promises and supports partial state extension.
|
|
68
|
+
* Call it in an injection context.
|
|
69
|
+
*
|
|
70
|
+
* There is NO latest-wins guard (pinned like React's): whatever settles last
|
|
71
|
+
* wins, even over a newer synchronous set.
|
|
72
|
+
*
|
|
73
|
+
* @param initialState - Initial state value.
|
|
74
|
+
* @returns A tuple of `[state, setState, extendState]`; the state member is
|
|
75
|
+
* replaced in place for this instance's lifetime.
|
|
76
|
+
*/
|
|
77
|
+
export declare const useAsyncState: <T>(initialState: T) => [T, AsyncSetState<T>, AsyncExtendState<T>];
|
|
78
|
+
/**
|
|
79
|
+
* What {@link useOptimisticValue} returns: the state to render (as signals —
|
|
80
|
+
* the same fields React's result carries as plain values) and the two ways to
|
|
81
|
+
* change it.
|
|
82
|
+
*
|
|
83
|
+
* @template T - The value's shape.
|
|
84
|
+
*/
|
|
85
|
+
export interface UseOptimisticValueResult<T> {
|
|
86
|
+
/** The newest chosen value, or the server's value when nothing is saving. */
|
|
87
|
+
readonly value: Signal<T>;
|
|
88
|
+
/** Whether a save is running or waiting to run. */
|
|
89
|
+
readonly pending: Signal<boolean>;
|
|
90
|
+
/** The failure of the newest change, after the value went back; `null` otherwise. */
|
|
91
|
+
readonly error: Signal<unknown>;
|
|
92
|
+
/**
|
|
93
|
+
* Shows `next` at once and saves it, after any save already running.
|
|
94
|
+
*
|
|
95
|
+
* @param next - The value the person chose.
|
|
96
|
+
*/
|
|
97
|
+
set: OptimisticValue<T>['set'];
|
|
98
|
+
/**
|
|
99
|
+
* Like `set`, computed from the value shown now (`update((on) => !on)`).
|
|
100
|
+
*
|
|
101
|
+
* @param change - Computes the next value from the value shown now.
|
|
102
|
+
*/
|
|
103
|
+
update: OptimisticValue<T>['update'];
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* A server-backed value — a favorite, follow, like or bookmark button, a
|
|
107
|
+
* rating, a quantity, a setting switch — that changes on the first read after
|
|
108
|
+
* a tap and is saved one change at a time, in order. Call it in an injection
|
|
109
|
+
* context.
|
|
110
|
+
*
|
|
111
|
+
* Only a failure of the newest change puts the server value back. A new server
|
|
112
|
+
* `value` is taken only while nothing is being saved, so a parent re-render or
|
|
113
|
+
* a refetch of older data never flips the control mid-save.
|
|
114
|
+
*
|
|
115
|
+
* Like React — whose component instance survives an argument change — the
|
|
116
|
+
* controller survives this site's re-creation (an input change to the hook):
|
|
117
|
+
* the destroyed instance parks it at the site and the next instance adopts it,
|
|
118
|
+
* feeding the new server value through `sync()`. See `site.ts`.
|
|
119
|
+
*
|
|
120
|
+
* @param options - The server's current value and how to save a change.
|
|
121
|
+
* @returns The value to render, whether a save is pending, the newest failure,
|
|
122
|
+
* and `set`/`update`.
|
|
123
|
+
*/
|
|
124
|
+
export declare const useOptimisticValue: <T>(options: OptimisticValueOptions<T>) => UseOptimisticValueResult<T>;
|
|
125
|
+
//# sourceMappingURL=use-async.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-async.d.ts","sourceRoot":"","sources":["../../src/hooks/use-async.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAA4C,KAAK,MAAM,EAAE,MAAM,eAAe,CAAA;AAErF,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAElF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAK5D;;;;GAIG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,2DAA2D;IAC3D,MAAM,EAAE,aAAa,CAAA;IACrB,gFAAgF;IAChF,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;IACf,2EAA2E;IAC3E,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,mEAAmE;IACnE,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,4DAA4D;IAC5D,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,EACzE,SAAS,CAAC,KACT,CACD,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EACvC,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAmE5D,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAC7B,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE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