@molecule/app-svelte 3.16.0 → 4.0.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 +14 -313
- package/dist/ai-models.d.ts +2 -0
- package/dist/ai-models.d.ts.map +1 -0
- package/dist/ai-models.js +1 -0
- package/dist/chat/index.d.ts +6 -0
- package/dist/chat/index.d.ts.map +1 -0
- package/dist/chat/index.js +5 -0
- package/dist/chat-context.d.ts +13 -0
- package/dist/chat-context.d.ts.map +1 -0
- package/dist/chat-context.js +23 -0
- package/dist/chat-provider.d.ts +5 -0
- package/dist/chat-provider.d.ts.map +1 -0
- package/dist/chat-provider.js +5 -0
- package/dist/chat-types.d.ts +9 -0
- package/dist/chat-types.d.ts.map +1 -0
- package/dist/chat-types.js +1 -0
- package/dist/context.d.ts +1 -13
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -24
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +0 -2
- package/dist/hooks/useTranslation.d.ts +2 -4
- package/dist/hooks/useTranslation.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/providers/ChatProvider.svelte +4 -4
- package/dist/providers/ChatProvider.svelte.d.ts +1 -1
- package/dist/providers/ChatProvider.svelte.d.ts.map +1 -1
- package/dist/providers/ChatScope.svelte +13 -0
- package/dist/providers/ChatScope.svelte.d.ts +5 -0
- package/dist/providers/ChatScope.svelte.d.ts.map +1 -0
- package/dist/providers/MoleculeProvider.svelte +0 -2
- package/dist/providers/MoleculeProvider.svelte.d.ts.map +1 -1
- package/dist/providers/providers.d.ts +0 -4
- package/dist/providers/providers.d.ts.map +1 -1
- package/dist/providers/providers.js +0 -5
- package/dist/providers/services.d.ts.map +1 -1
- package/dist/providers/services.js +1 -4
- package/dist/push.d.ts +3 -0
- package/dist/push.d.ts.map +1 -0
- package/dist/push.js +2 -0
- package/dist/stores/chat.js +1 -1
- package/dist/stores/index.d.ts +0 -2
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/index.js +0 -2
- package/dist/types.d.ts +0 -9
- package/dist/types.d.ts.map +1 -1
- package/package.json +29 -4
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-28T05:21:58.912Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-svelte
|
|
@@ -157,7 +157,7 @@ signs the user out.
|
|
|
157
157
|
## Installation
|
|
158
158
|
|
|
159
159
|
```bash
|
|
160
|
-
npm install @molecule/app-svelte @molecule/app-
|
|
160
|
+
npm install @molecule/app-svelte @molecule/app-auth @molecule/app-device @molecule/app-forms @molecule/app-http @molecule/app-i18n @molecule/app-logger @molecule/app-platform @molecule/app-routing @molecule/app-state @molecule/app-storage @molecule/app-theme @molecule/app-ui @molecule/app-utilities @molecule/app-version svelte
|
|
161
161
|
```
|
|
162
162
|
|
|
163
163
|
## API
|
|
@@ -1209,31 +1209,6 @@ interface Theme {
|
|
|
1209
1209
|
}
|
|
1210
1210
|
```
|
|
1211
1211
|
|
|
1212
|
-
#### `UseAIModelsResult`
|
|
1213
|
-
|
|
1214
|
-
Result returned by `useAIModels`.
|
|
1215
|
-
|
|
1216
|
-
```typescript
|
|
1217
|
-
interface UseAIModelsResult {
|
|
1218
|
-
/**
|
|
1219
|
-
* Available models, or an empty array while loading or after a failed fetch, as a readable store. The list
|
|
1220
|
-
* keeps its identity until the catalog changes, the empty one included.
|
|
1221
|
-
*/
|
|
1222
|
-
models: Readable<AppModelDefinition[]>
|
|
1223
|
-
/**
|
|
1224
|
-
* Per-mode server default model ids for the requester's tier, or `undefined`
|
|
1225
|
-
* while loading or on servers that don't provide them.
|
|
1226
|
-
*/
|
|
1227
|
-
defaults: Readable<AppModeModelDefaults | undefined>
|
|
1228
|
-
/** The single model marked `freeTier: true`, or `undefined`. */
|
|
1229
|
-
freeTierModel: Readable<AppModelDefinition | undefined>
|
|
1230
|
-
/** `true` while the initial fetch is in flight. */
|
|
1231
|
-
loading: Readable<boolean>
|
|
1232
|
-
/** Error from the initial fetch, or `null`. */
|
|
1233
|
-
error: Readable<Error | null>
|
|
1234
|
-
}
|
|
1235
|
-
```
|
|
1236
|
-
|
|
1237
1212
|
#### `UseAuthOptions`
|
|
1238
1213
|
|
|
1239
1214
|
Options for {@link useAuth}.
|
|
@@ -1815,51 +1790,6 @@ interface UsePromiseState<T> {
|
|
|
1815
1790
|
}
|
|
1816
1791
|
```
|
|
1817
1792
|
|
|
1818
|
-
#### `UsePushResult`
|
|
1819
|
-
|
|
1820
|
-
Hook return type.
|
|
1821
|
-
|
|
1822
|
-
```typescript
|
|
1823
|
-
interface UsePushResult {
|
|
1824
|
-
/** The last permission status a check or request reported, null until one runs. */
|
|
1825
|
-
permission: Readable<PermissionStatus | null>
|
|
1826
|
-
/** The token register() resolved, null until a registration. */
|
|
1827
|
-
token: Readable<PushToken | null>
|
|
1828
|
-
/** Reads the permission status from the provider. */
|
|
1829
|
-
checkPermission: () => Promise<PermissionStatus>
|
|
1830
|
-
/** Asks the user for permission and stores the answer. */
|
|
1831
|
-
requestPermission: () => Promise<PermissionStatus>
|
|
1832
|
-
/** Registers for push and stores the token. */
|
|
1833
|
-
register: (options?: PushRegisterOptions) => Promise<PushToken>
|
|
1834
|
-
/** Unregisters and clears the token. */
|
|
1835
|
-
unregister: () => Promise<void>
|
|
1836
|
-
/** Subscribes a notification listener; returns its unsubscribe. */
|
|
1837
|
-
onNotificationReceived: (listener: NotificationReceivedListener) => () => void
|
|
1838
|
-
/** Subscribes a notification-action listener; returns its unsubscribe. */
|
|
1839
|
-
onNotificationAction: (listener: NotificationActionListener) => () => void
|
|
1840
|
-
/** Subscribes a token-change listener; returns its unsubscribe. */
|
|
1841
|
-
onTokenChange: (listener: TokenChangeListener) => () => void
|
|
1842
|
-
/** Sets the badge count. */
|
|
1843
|
-
setBadge: (count: number) => Promise<void>
|
|
1844
|
-
/** Clears the badge. */
|
|
1845
|
-
clearBadge: () => Promise<void>
|
|
1846
|
-
}
|
|
1847
|
-
```
|
|
1848
|
-
|
|
1849
|
-
#### `UsePushOptions`
|
|
1850
|
-
|
|
1851
|
-
Options for the usePush hook (e.g. check permission on mount).
|
|
1852
|
-
|
|
1853
|
-
```typescript
|
|
1854
|
-
interface UsePushOptions {
|
|
1855
|
-
/**
|
|
1856
|
-
* Whether to check permission status on mount, and again when the flag turns
|
|
1857
|
-
* on later on the same component.
|
|
1858
|
-
*/
|
|
1859
|
-
checkOnMount?: boolean
|
|
1860
|
-
}
|
|
1861
|
-
```
|
|
1862
|
-
|
|
1863
1793
|
#### `UseRouterResult`
|
|
1864
1794
|
|
|
1865
1795
|
What {@link useRouter} returns.
|
|
@@ -2342,8 +2272,6 @@ interface MoleculeConfig {
|
|
|
2342
2272
|
http?: HttpClient
|
|
2343
2273
|
storage?: StorageProvider
|
|
2344
2274
|
logger?: LoggerProvider
|
|
2345
|
-
/** The AI chat provider useChat and useChatProvider use. */
|
|
2346
|
-
chat?: ChatProvider
|
|
2347
2275
|
/** The IDE workspace provider useWorkspace and useWorkspaceProvider use. */
|
|
2348
2276
|
workspace?: WorkspaceProvider
|
|
2349
2277
|
/** The code editor provider useEditor and useEditorProvider use. */
|
|
@@ -2478,16 +2406,6 @@ interface LoggerProviderProps extends ProviderProps {
|
|
|
2478
2406
|
}
|
|
2479
2407
|
```
|
|
2480
2408
|
|
|
2481
|
-
#### `ChatProviderProps`
|
|
2482
|
-
|
|
2483
|
-
Props for the `ChatProvider` component.
|
|
2484
|
-
|
|
2485
|
-
```typescript
|
|
2486
|
-
interface ChatProviderProps extends ProviderProps {
|
|
2487
|
-
provider: ChatProvider
|
|
2488
|
-
}
|
|
2489
|
-
```
|
|
2490
|
-
|
|
2491
2409
|
#### `WorkspaceProviderProps`
|
|
2492
2410
|
|
|
2493
2411
|
Props for the `WorkspaceProvider` component.
|
|
@@ -2584,17 +2502,6 @@ URL query string parameter map (single values or arrays for repeated keys).
|
|
|
2584
2502
|
type QueryParams = Record<string, string | string[] | undefined>
|
|
2585
2503
|
```
|
|
2586
2504
|
|
|
2587
|
-
#### `AgentIdentity`
|
|
2588
|
-
|
|
2589
|
-
Display identity for the AI coding agent and the host product, used to
|
|
2590
|
-
interpolate the `{{agentName}}` / `{{productName}}` tokens in shared chat/IDE
|
|
2591
|
-
copy. A consuming app sets these to its own agent + product brand names; the
|
|
2592
|
-
shared packages fall back to {@link DEFAULT_AGENT_IDENTITY} when it does not.
|
|
2593
|
-
|
|
2594
|
-
```typescript
|
|
2595
|
-
type AgentIdentity = ChatAgentIdentity
|
|
2596
|
-
```
|
|
2597
|
-
|
|
2598
2505
|
#### `MaybeReadable`
|
|
2599
2506
|
|
|
2600
2507
|
A plain value or a readable store of one (a store of `undefined` stands for
|
|
@@ -2739,9 +2646,7 @@ Two compatible call forms:
|
|
|
2739
2646
|
English `defaultValue`, with optional `count` for pluralization.
|
|
2740
2647
|
|
|
2741
2648
|
```typescript
|
|
2742
|
-
type UseTFunction =
|
|
2743
|
-
(key: string, fallback: string, options?: UseTShorthandOptions): string
|
|
2744
|
-
}
|
|
2649
|
+
type UseTFunction = TranslateFunctionWithFallback
|
|
2745
2650
|
```
|
|
2746
2651
|
|
|
2747
2652
|
#### `VerifyPaymentReturnStatus`
|
|
@@ -2770,33 +2675,6 @@ Change password store type.
|
|
|
2770
2675
|
type ChangePasswordStore = PromiseStore<void, [string, string]>
|
|
2771
2676
|
```
|
|
2772
2677
|
|
|
2773
|
-
#### `UseChatOptions`
|
|
2774
|
-
|
|
2775
|
-
Options for {@link useChat} (the shared chat session's options).
|
|
2776
|
-
|
|
2777
|
-
```typescript
|
|
2778
|
-
type UseChatOptions = ChatSessionOptions
|
|
2779
|
-
```
|
|
2780
|
-
|
|
2781
|
-
#### `SendMessageOptions`
|
|
2782
|
-
|
|
2783
|
-
Options for one `sendMessage` call.
|
|
2784
|
-
|
|
2785
|
-
```typescript
|
|
2786
|
-
type SendMessageOptions = ChatSendOptions
|
|
2787
|
-
```
|
|
2788
|
-
|
|
2789
|
-
#### `UseChatResult`
|
|
2790
|
-
|
|
2791
|
-
What {@link useChat} returns: each chat state field as a readable store,
|
|
2792
|
-
and the session's controls as plain functions (stable for the component's life).
|
|
2793
|
-
|
|
2794
|
-
```typescript
|
|
2795
|
-
type UseChatResult = {
|
|
2796
|
-
readonly [K in keyof ChatSessionState]: Readable<ChatSessionState[K]>
|
|
2797
|
-
} & ChatSessionControls
|
|
2798
|
-
```
|
|
2799
|
-
|
|
2800
2678
|
#### `LoginStore`
|
|
2801
2679
|
|
|
2802
2680
|
Login store type.
|
|
@@ -2872,7 +2750,7 @@ until the session is decided, render `MoleculeProvider` (its `awaitSession`) or
|
|
|
2872
2750
|
function setMoleculeContext(config: MoleculeConfig): void
|
|
2873
2751
|
```
|
|
2874
2752
|
|
|
2875
|
-
- `config` — Provider instances to register (state, auth, theme, router, i18n, http, storage, logger,
|
|
2753
|
+
- `config` — Provider instances to register (state, auth, theme, router, i18n, http, storage, logger, workspace, editor, preview).
|
|
2876
2754
|
|
|
2877
2755
|
#### `setStateContext(provider)`
|
|
2878
2756
|
|
|
@@ -2956,16 +2834,6 @@ function setLoggerContext(provider: LoggerProvider): void
|
|
|
2956
2834
|
|
|
2957
2835
|
- `provider` — The logger provider to store in Svelte context.
|
|
2958
2836
|
|
|
2959
|
-
#### `setChatContext(provider)`
|
|
2960
|
-
|
|
2961
|
-
Sets the AI chat context.
|
|
2962
|
-
|
|
2963
|
-
```typescript
|
|
2964
|
-
function setChatContext(provider: ChatProvider): void
|
|
2965
|
-
```
|
|
2966
|
-
|
|
2967
|
-
- `provider` — The chat provider to store in Svelte context.
|
|
2968
|
-
|
|
2969
2837
|
#### `setWorkspaceContext(provider)`
|
|
2970
2838
|
|
|
2971
2839
|
Sets the IDE workspace context.
|
|
@@ -3079,16 +2947,6 @@ function getLoggerProvider(): LoggerProvider
|
|
|
3079
2947
|
|
|
3080
2948
|
**Returns:** The logger provider instance.
|
|
3081
2949
|
|
|
3082
|
-
#### `useChatProvider()`
|
|
3083
|
-
|
|
3084
|
-
Gets the AI chat provider from Svelte context (`setMoleculeContext({ chat })`).
|
|
3085
|
-
|
|
3086
|
-
```typescript
|
|
3087
|
-
function useChatProvider(): ChatProvider
|
|
3088
|
-
```
|
|
3089
|
-
|
|
3090
|
-
**Returns:** The chat provider instance.
|
|
3091
|
-
|
|
3092
2950
|
#### `useWorkspaceProvider()`
|
|
3093
2951
|
|
|
3094
2952
|
Gets the IDE workspace provider from Svelte context
|
|
@@ -3266,36 +3124,6 @@ function toReadable<T>(value: MaybeReadable<T>): Readable<T>
|
|
|
3266
3124
|
|
|
3267
3125
|
**Returns:** A readable store of the value.
|
|
3268
3126
|
|
|
3269
|
-
#### `resetAIModelsCache()`
|
|
3270
|
-
|
|
3271
|
-
Test-only: drops every cached model list so the next `useAIModels` call
|
|
3272
|
-
refetches. Exposed for unit tests; do not call from production code.
|
|
3273
|
-
|
|
3274
|
-
```typescript
|
|
3275
|
-
function resetAIModelsCache(): void
|
|
3276
|
-
```
|
|
3277
|
-
|
|
3278
|
-
#### `useAIModels(projectId)`
|
|
3279
|
-
|
|
3280
|
-
Subscribes to the cached AI model catalog, React's `useAIModels` in Svelte's
|
|
3281
|
-
idiom: call it during component init under `setMoleculeContext({ http })`.
|
|
3282
|
-
The first mount of a scope triggers a single `GET /ai/models` fetch;
|
|
3283
|
-
subsequent mounts return the cached result, and a scope whose fetch failed
|
|
3284
|
-
does not refetch on a later mount.
|
|
3285
|
-
|
|
3286
|
-
The project id may be a plain value or a readable store of one (a store
|
|
3287
|
-
holding `undefined` means the unscoped catalog): setting it resubscribes to
|
|
3288
|
-
the new scope's cache and fetches it if nobody has yet, on the same
|
|
3289
|
-
component, the way React's re-render does.
|
|
3290
|
-
|
|
3291
|
-
```typescript
|
|
3292
|
-
function useAIModels(projectId?: MaybeReadable<string | undefined>): UseAIModelsResult
|
|
3293
|
-
```
|
|
3294
|
-
|
|
3295
|
-
- `projectId` — Optional project scope: includes that project's custom ("bring your own AI") models on servers that support them (or a store of it).
|
|
3296
|
-
|
|
3297
|
-
**Returns:** Models, free-tier model, loading flag, and error, as stores.
|
|
3298
|
-
|
|
3299
3127
|
#### `useAsyncState(initialState)`
|
|
3300
3128
|
|
|
3301
3129
|
State that accepts Promises and partial updates, React's `useAsyncState` in
|
|
@@ -3844,24 +3672,6 @@ function usePromise<T, A extends unknown[]>(
|
|
|
3844
3672
|
|
|
3845
3673
|
**Returns:** A readable store of the [state, wrappedFunction] tuple.
|
|
3846
3674
|
|
|
3847
|
-
#### `usePush(options)`
|
|
3848
|
-
|
|
3849
|
-
Push notification state and actions, React's `usePush` in Svelte's idiom:
|
|
3850
|
-
called during component init, `permission` and `token` are readable stores
|
|
3851
|
-
the hook's own actions update, and the rest are plain functions.
|
|
3852
|
-
|
|
3853
|
-
Uses module-level `getProvider()` — push is a singleton, not
|
|
3854
|
-
context-provided. The provider's listeners are caller-managed: the returned
|
|
3855
|
-
`on*` unsubscribes are the caller's to call, like React's.
|
|
3856
|
-
|
|
3857
|
-
```typescript
|
|
3858
|
-
function usePush(options?: MaybeReadable<UsePushOptions | undefined>): UsePushResult
|
|
3859
|
-
```
|
|
3860
|
-
|
|
3861
|
-
- `options` — Hook options (or a store of them): setting `checkOnMount` later runs its check on the same component, the way React's re-render re-runs its effect.
|
|
3862
|
-
|
|
3863
|
-
**Returns:** Push notification state and action methods
|
|
3864
|
-
|
|
3865
3675
|
#### `useRouter()`
|
|
3866
3676
|
|
|
3867
3677
|
Routing state and navigation, React's `useRouter` in Svelte's idiom: call it
|
|
@@ -4399,25 +4209,6 @@ function createChangePasswordStore(): ChangePasswordStore
|
|
|
4399
4209
|
|
|
4400
4210
|
**Returns:** Change password promise store
|
|
4401
4211
|
|
|
4402
|
-
#### `useChat(options)`
|
|
4403
|
-
|
|
4404
|
-
AI chat with streaming: the transcript, loading and error state, mode, and
|
|
4405
|
-
the controls (send, abort, queue edits, history). Call it during component
|
|
4406
|
-
init.
|
|
4407
|
-
|
|
4408
|
-
The options may be a plain value or a readable store of one (a store holding
|
|
4409
|
-
`undefined` means no options): a new `endpoint` switches conversation and a
|
|
4410
|
-
new `projectId` moves to that project's transcript, on the same component,
|
|
4411
|
-
the way React re-renders `useChat`.
|
|
4412
|
-
|
|
4413
|
-
```typescript
|
|
4414
|
-
function useChat(options: UseChatOptions | Readable<UseChatOptions>): UseChatResult
|
|
4415
|
-
```
|
|
4416
|
-
|
|
4417
|
-
- `options` — Chat options (or a store of them): endpoint, project id, history loading, callbacks.
|
|
4418
|
-
|
|
4419
|
-
**Returns:** Each state field as a readable store, and the chat controls.
|
|
4420
|
-
|
|
4421
4212
|
#### `createDeviceStores()`
|
|
4422
4213
|
|
|
4423
4214
|
Create device stores from the module-level device provider.
|
|
@@ -4754,28 +4545,6 @@ function createPromiseStore<T, A extends unknown[]>(
|
|
|
4754
4545
|
|
|
4755
4546
|
**Returns:** Promise store with subscribe, call, cancel, and reset
|
|
4756
4547
|
|
|
4757
|
-
#### `createPushStores()`
|
|
4758
|
-
|
|
4759
|
-
Create push notification stores from the module-level push provider.
|
|
4760
|
-
|
|
4761
|
-
```typescript
|
|
4762
|
-
function createPushStores(): {
|
|
4763
|
-
permission: Readable<PermissionStatus | null>
|
|
4764
|
-
token: Readable<PushToken | null>
|
|
4765
|
-
checkPermission: () => Promise<PermissionStatus>
|
|
4766
|
-
requestPermission: () => Promise<PermissionStatus>
|
|
4767
|
-
register: (options?: PushRegisterOptions) => Promise<PushToken>
|
|
4768
|
-
unregister: () => Promise<void>
|
|
4769
|
-
onNotificationReceived: (listener: NotificationReceivedListener) => () => void
|
|
4770
|
-
onNotificationAction: (listener: NotificationActionListener) => () => void
|
|
4771
|
-
onTokenChange: (listener: TokenChangeListener) => () => void
|
|
4772
|
-
setBadge: (count: number) => Promise<void>
|
|
4773
|
-
clearBadge: () => Promise<void>
|
|
4774
|
-
}
|
|
4775
|
-
```
|
|
4776
|
-
|
|
4777
|
-
**Returns:** Push notification stores and actions
|
|
4778
|
-
|
|
4779
4548
|
#### `createRouterStores()`
|
|
4780
4549
|
|
|
4781
4550
|
Create router stores from the router in context.
|
|
@@ -5018,32 +4787,6 @@ const RoutedView: LegacyComponentType
|
|
|
5018
4787
|
const SessionReady: LegacyComponentType
|
|
5019
4788
|
```
|
|
5020
4789
|
|
|
5021
|
-
#### `DEFAULT_AGENT_NAME`
|
|
5022
|
-
|
|
5023
|
-
Neutral, product-agnostic agent name used when the host supplies none.
|
|
5024
|
-
|
|
5025
|
-
```typescript
|
|
5026
|
-
const DEFAULT_AGENT_NAME: typeof CHAT_DEFAULT_AGENT_NAME
|
|
5027
|
-
```
|
|
5028
|
-
|
|
5029
|
-
#### `DEFAULT_PRODUCT_NAME`
|
|
5030
|
-
|
|
5031
|
-
Neutral, product-agnostic product/IDE name used when the host supplies none.
|
|
5032
|
-
|
|
5033
|
-
```typescript
|
|
5034
|
-
const DEFAULT_PRODUCT_NAME: typeof CHAT_DEFAULT_PRODUCT_NAME
|
|
5035
|
-
```
|
|
5036
|
-
|
|
5037
|
-
#### `DEFAULT_AGENT_IDENTITY`
|
|
5038
|
-
|
|
5039
|
-
The neutral default identity ({@link DEFAULT_AGENT_NAME} +
|
|
5040
|
-
{@link DEFAULT_PRODUCT_NAME}) the shared packages use until a consuming app
|
|
5041
|
-
passes its own.
|
|
5042
|
-
|
|
5043
|
-
```typescript
|
|
5044
|
-
const DEFAULT_AGENT_IDENTITY: AgentIdentity
|
|
5045
|
-
```
|
|
5046
|
-
|
|
5047
4790
|
#### `MoleculeProvider`
|
|
5048
4791
|
|
|
5049
4792
|
Combined provider for every molecule service, as `@molecule/app-react`'s `MoleculeProvider`.
|
|
@@ -5124,14 +4867,6 @@ Provider for logging, as `@molecule/app-react`'s `LoggerProvider`.
|
|
|
5124
4867
|
const LoggerProvider: LegacyComponentType
|
|
5125
4868
|
```
|
|
5126
4869
|
|
|
5127
|
-
#### `ChatProvider`
|
|
5128
|
-
|
|
5129
|
-
Provider for AI chat, as `@molecule/app-react`'s `ChatProvider`.
|
|
5130
|
-
|
|
5131
|
-
```typescript
|
|
5132
|
-
const ChatProvider: LegacyComponentType
|
|
5133
|
-
```
|
|
5134
|
-
|
|
5135
4870
|
#### `WorkspaceProvider`
|
|
5136
4871
|
|
|
5137
4872
|
Provider for the IDE workspace, as `@molecule/app-react`'s `WorkspaceProvider`.
|
|
@@ -5156,62 +4891,25 @@ Provider for the live preview, as `@molecule/app-react`'s `PreviewProvider`.
|
|
|
5156
4891
|
const PreviewProvider: LegacyComponentType
|
|
5157
4892
|
```
|
|
5158
4893
|
|
|
5159
|
-
#### `convergeHistory`
|
|
5160
|
-
|
|
5161
|
-
Converges the local transcript with authoritative server history. See
|
|
5162
|
-
`convergeHistory` in `@molecule/app-ai-chat`.
|
|
5163
|
-
|
|
5164
|
-
```typescript
|
|
5165
|
-
const convergeHistory: typeof coreConvergeHistory
|
|
5166
|
-
```
|
|
5167
|
-
|
|
5168
|
-
- `prev` — The local transcript.
|
|
5169
|
-
- `history` — The server's history.
|
|
5170
|
-
|
|
5171
|
-
**Returns:** The converged transcript.
|
|
5172
|
-
|
|
5173
|
-
#### `localOnlyMessages`
|
|
5174
|
-
|
|
5175
|
-
The local messages server history does not carry yet. See
|
|
5176
|
-
`localOnlyMessages` in `@molecule/app-ai-chat`.
|
|
5177
|
-
|
|
5178
|
-
```typescript
|
|
5179
|
-
const localOnlyMessages: typeof coreLocalOnlyMessages
|
|
5180
|
-
```
|
|
5181
|
-
|
|
5182
|
-
- `prev` — The local transcript.
|
|
5183
|
-
- `history` — The server's history.
|
|
5184
|
-
|
|
5185
|
-
**Returns:** The local-only messages.
|
|
5186
|
-
|
|
5187
|
-
#### `resetChatStoresForTests`
|
|
5188
|
-
|
|
5189
|
-
Clears every chat session store. Tests only: each test starts with no
|
|
5190
|
-
transcript, queue or stream left by the previous one.
|
|
5191
|
-
|
|
5192
|
-
```typescript
|
|
5193
|
-
const resetChatStoresForTests: typeof coreResetChatStoresForTests
|
|
5194
|
-
```
|
|
5195
|
-
|
|
5196
4894
|
## Injection Notes
|
|
5197
4895
|
|
|
5198
4896
|
### Requirements
|
|
5199
4897
|
|
|
5200
4898
|
Peer dependencies:
|
|
5201
4899
|
|
|
5202
|
-
- `@molecule/app-ai-chat` ^1.8.0
|
|
5203
|
-
- `@molecule/app-ai-models` ^1.0.1
|
|
4900
|
+
- `@molecule/app-ai-chat` ^1.8.0 _(optional)_
|
|
4901
|
+
- `@molecule/app-ai-models` ^1.0.1 _(optional)_
|
|
5204
4902
|
- `@molecule/app-auth` ^3.0.0
|
|
5205
4903
|
- `@molecule/app-code-editor` ^1.0.1 _(optional)_
|
|
5206
4904
|
- `@molecule/app-device` ^1.0.1
|
|
5207
4905
|
- `@molecule/app-forms` ^2.4.0
|
|
5208
4906
|
- `@molecule/app-http` ^1.0.1
|
|
5209
|
-
- `@molecule/app-i18n` ^1.
|
|
4907
|
+
- `@molecule/app-i18n` ^1.4.0
|
|
5210
4908
|
- `@molecule/app-ide` ^1.1.0 _(optional)_
|
|
5211
4909
|
- `@molecule/app-live-preview` ^1.0.1 _(optional)_
|
|
5212
4910
|
- `@molecule/app-logger` ^1.0.1
|
|
5213
4911
|
- `@molecule/app-platform` ^1.0.1
|
|
5214
|
-
- `@molecule/app-push` ^1.0.1
|
|
4912
|
+
- `@molecule/app-push` ^1.0.1 _(optional)_
|
|
5215
4913
|
- `@molecule/app-routing` ^1.4.0
|
|
5216
4914
|
- `@molecule/app-routing-sveltekit` >=3.0.0 _(optional)_
|
|
5217
4915
|
- `@molecule/app-state` ^1.2.0
|
|
@@ -5224,8 +4922,8 @@ Peer dependencies:
|
|
|
5224
4922
|
|
|
5225
4923
|
### Runtime Dependencies
|
|
5226
4924
|
|
|
5227
|
-
- `@molecule/app-ai-chat`
|
|
5228
|
-
- `@molecule/app-ai-models`
|
|
4925
|
+
- `@molecule/app-ai-chat` _(optional)_
|
|
4926
|
+
- `@molecule/app-ai-models` _(optional)_
|
|
5229
4927
|
- `@molecule/app-auth`
|
|
5230
4928
|
- `@molecule/app-code-editor` _(optional)_
|
|
5231
4929
|
- `@molecule/app-device`
|
|
@@ -5236,7 +4934,7 @@ Peer dependencies:
|
|
|
5236
4934
|
- `@molecule/app-live-preview` _(optional)_
|
|
5237
4935
|
- `@molecule/app-logger`
|
|
5238
4936
|
- `@molecule/app-platform`
|
|
5239
|
-
- `@molecule/app-push`
|
|
4937
|
+
- `@molecule/app-push` _(optional)_
|
|
5240
4938
|
- `@molecule/app-routing`
|
|
5241
4939
|
- `@molecule/app-routing-sveltekit` _(optional)_
|
|
5242
4940
|
- `@molecule/app-state`
|
|
@@ -5264,6 +4962,9 @@ Peer dependencies:
|
|
|
5264
4962
|
placed it. Nothing renders on the server; `target` replaces the body and `null` renders
|
|
5265
4963
|
nothing until a target exists.
|
|
5266
4964
|
|
|
4965
|
+
Use `@molecule/app-svelte/chat`, `@molecule/app-svelte/ai-models`, and
|
|
4966
|
+
`@molecule/app-svelte/push` for those features.
|
|
4967
|
+
|
|
5267
4968
|
## Translations
|
|
5268
4969
|
|
|
5269
4970
|
Translation strings are provided by `@molecule/app-locales-svelte`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-models.d.ts","sourceRoot":"","sources":["../src/ai-models.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hooks/useAIModels.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/chat/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChatProvider } from '@molecule/app-ai-chat';
|
|
2
|
+
/**
|
|
3
|
+
* Sets the AI chat context.
|
|
4
|
+
* @param provider - The chat provider to store in Svelte context.
|
|
5
|
+
*/
|
|
6
|
+
export declare function setChatContext(provider: ChatProvider): void;
|
|
7
|
+
/**
|
|
8
|
+
* Gets the AI chat provider from Svelte context.
|
|
9
|
+
* @returns The chat provider instance.
|
|
10
|
+
* @throws {Error} If no chat provider has been set in context.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useChatProvider(): ChatProvider;
|
|
13
|
+
//# sourceMappingURL=chat-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-context.d.ts","sourceRoot":"","sources":["../src/chat-context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAKzD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAS9C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getContext, setContext } from 'svelte';
|
|
2
|
+
import { t } from '@molecule/app-i18n';
|
|
3
|
+
const CHAT_KEY = Symbol('molecule-chat');
|
|
4
|
+
/**
|
|
5
|
+
* Sets the AI chat context.
|
|
6
|
+
* @param provider - The chat provider to store in Svelte context.
|
|
7
|
+
*/
|
|
8
|
+
export function setChatContext(provider) {
|
|
9
|
+
setContext(CHAT_KEY, provider);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Gets the AI chat provider from Svelte context.
|
|
13
|
+
* @returns The chat provider instance.
|
|
14
|
+
* @throws {Error} If no chat provider has been set in context.
|
|
15
|
+
*/
|
|
16
|
+
export function useChatProvider() {
|
|
17
|
+
const provider = getContext(CHAT_KEY);
|
|
18
|
+
if (!provider)
|
|
19
|
+
throw new Error(t('svelte.error.useChatOutsideProvider', undefined, {
|
|
20
|
+
defaultValue: 'useChatProvider must be used within a ChatProvider',
|
|
21
|
+
}));
|
|
22
|
+
return provider;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-provider.d.ts","sourceRoot":"","sources":["../src/chat-provider.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,YAAY,iFAAwB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChatProvider } from '@molecule/app-ai-chat';
|
|
2
|
+
import type { ProviderProps } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the `ChatProvider` component.
|
|
5
|
+
*/
|
|
6
|
+
export interface ChatProviderProps extends ProviderProps {
|
|
7
|
+
provider: ChatProvider;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=chat-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-types.d.ts","sourceRoot":"","sources":["../src/chat-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE/C;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,QAAQ,EAAE,YAAY,CAAA;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/context.d.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Component } from 'svelte';
|
|
7
7
|
import { type Readable } from 'svelte/store';
|
|
8
|
-
import type { ChatProvider } from '@molecule/app-ai-chat';
|
|
9
8
|
import type { AuthClient, RegisterExtraShape } from '@molecule/app-auth';
|
|
10
9
|
import type { EditorProvider } from '@molecule/app-code-editor';
|
|
11
10
|
import type { HttpClient } from '@molecule/app-http';
|
|
@@ -43,7 +42,7 @@ import type { MoleculeConfig } from './types.js';
|
|
|
43
42
|
*
|
|
44
43
|
* <slot />
|
|
45
44
|
* ```
|
|
46
|
-
* @param config - Provider instances to register (state, auth, theme, router, i18n, http, storage, logger,
|
|
45
|
+
* @param config - Provider instances to register (state, auth, theme, router, i18n, http, storage, logger, workspace, editor, preview).
|
|
47
46
|
*/
|
|
48
47
|
export declare function setMoleculeContext(config: MoleculeConfig): void;
|
|
49
48
|
/**
|
|
@@ -91,11 +90,6 @@ export declare function setStorageContext(provider: StorageProvider): void;
|
|
|
91
90
|
* @param provider - The logger provider to store in Svelte context.
|
|
92
91
|
*/
|
|
93
92
|
export declare function setLoggerContext(provider: LoggerProvider): void;
|
|
94
|
-
/**
|
|
95
|
-
* Sets the AI chat context.
|
|
96
|
-
* @param provider - The chat provider to store in Svelte context.
|
|
97
|
-
*/
|
|
98
|
-
export declare function setChatContext(provider: ChatProvider): void;
|
|
99
93
|
/**
|
|
100
94
|
* Sets the IDE workspace context.
|
|
101
95
|
* @param provider - The workspace provider to store in Svelte context.
|
|
@@ -160,12 +154,6 @@ export declare function getStorageProvider(): StorageProvider;
|
|
|
160
154
|
* @throws {Error} If no logger provider has been set in context.
|
|
161
155
|
*/
|
|
162
156
|
export declare function getLoggerProvider(): LoggerProvider;
|
|
163
|
-
/**
|
|
164
|
-
* Gets the AI chat provider from Svelte context (`setMoleculeContext({ chat })`).
|
|
165
|
-
* @returns The chat provider instance.
|
|
166
|
-
* @throws {Error} If no chat provider has been set in context.
|
|
167
|
-
*/
|
|
168
|
-
export declare function useChatProvider(): ChatProvider;
|
|
169
157
|
/**
|
|
170
158
|
* Gets the IDE workspace provider from Svelte context
|
|
171
159
|
* (`setMoleculeContext({ workspace })`).
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,EAAO,KAAK,QAAQ,EAAY,MAAM,cAAc,CAAA;AAE3D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,EAAO,KAAK,QAAQ,EAAY,MAAM,cAAc,CAAA;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAmB,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAExD,OAAO,EAAE,KAAK,aAAa,EAAc,MAAM,2BAA2B,CAAA;AAE1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CA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;;GAIG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAS1C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,CASpD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CASlD;AAiBD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAShD"}
|
package/dist/context.js
CHANGED
|
@@ -19,7 +19,6 @@ const I18N_KEY = Symbol('molecule-i18n');
|
|
|
19
19
|
const HTTP_KEY = Symbol('molecule-http');
|
|
20
20
|
const STORAGE_KEY = Symbol('molecule-storage');
|
|
21
21
|
const LOGGER_KEY = Symbol('molecule-logger');
|
|
22
|
-
const CHAT_KEY = Symbol('molecule-chat');
|
|
23
22
|
const WORKSPACE_KEY = Symbol('molecule-workspace');
|
|
24
23
|
const EDITOR_KEY = Symbol('molecule-editor');
|
|
25
24
|
const PREVIEW_KEY = Symbol('molecule-preview');
|
|
@@ -47,7 +46,7 @@ const PREVIEW_KEY = Symbol('molecule-preview');
|
|
|
47
46
|
*
|
|
48
47
|
* <slot />
|
|
49
48
|
* ```
|
|
50
|
-
* @param config - Provider instances to register (state, auth, theme, router, i18n, http, storage, logger,
|
|
49
|
+
* @param config - Provider instances to register (state, auth, theme, router, i18n, http, storage, logger, workspace, editor, preview).
|
|
51
50
|
*/
|
|
52
51
|
export function setMoleculeContext(config) {
|
|
53
52
|
// A `state` option wins; otherwise the BONDED state provider, the singleton every
|
|
@@ -69,8 +68,6 @@ export function setMoleculeContext(config) {
|
|
|
69
68
|
setContext(STORAGE_KEY, config.storage);
|
|
70
69
|
if (config.logger)
|
|
71
70
|
setContext(LOGGER_KEY, config.logger);
|
|
72
|
-
if (config.chat)
|
|
73
|
-
setContext(CHAT_KEY, config.chat);
|
|
74
71
|
if (config.workspace)
|
|
75
72
|
setContext(WORKSPACE_KEY, config.workspace);
|
|
76
73
|
if (config.editor)
|
|
@@ -140,13 +137,6 @@ export function setStorageContext(provider) {
|
|
|
140
137
|
export function setLoggerContext(provider) {
|
|
141
138
|
setContext(LOGGER_KEY, provider);
|
|
142
139
|
}
|
|
143
|
-
/**
|
|
144
|
-
* Sets the AI chat context.
|
|
145
|
-
* @param provider - The chat provider to store in Svelte context.
|
|
146
|
-
*/
|
|
147
|
-
export function setChatContext(provider) {
|
|
148
|
-
setContext(CHAT_KEY, provider);
|
|
149
|
-
}
|
|
150
140
|
/**
|
|
151
141
|
* Sets the IDE workspace context.
|
|
152
142
|
* @param provider - The workspace provider to store in Svelte context.
|
|
@@ -272,19 +262,6 @@ export function getLoggerProvider() {
|
|
|
272
262
|
}));
|
|
273
263
|
return provider;
|
|
274
264
|
}
|
|
275
|
-
/**
|
|
276
|
-
* Gets the AI chat provider from Svelte context (`setMoleculeContext({ chat })`).
|
|
277
|
-
* @returns The chat provider instance.
|
|
278
|
-
* @throws {Error} If no chat provider has been set in context.
|
|
279
|
-
*/
|
|
280
|
-
export function useChatProvider() {
|
|
281
|
-
const provider = getContext(CHAT_KEY);
|
|
282
|
-
if (!provider)
|
|
283
|
-
throw new Error(t('svelte.error.useChatOutsideProvider', undefined, {
|
|
284
|
-
defaultValue: 'useChatProvider must be used within a ChatProvider',
|
|
285
|
-
}));
|
|
286
|
-
return provider;
|
|
287
|
-
}
|
|
288
265
|
/**
|
|
289
266
|
* Gets the IDE workspace provider from Svelte context
|
|
290
267
|
* (`setMoleculeContext({ workspace })`).
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
export * from './maybe-readable.js';
|
|
10
|
-
export * from './useAIModels.js';
|
|
11
10
|
export * from './useAsyncState.js';
|
|
12
11
|
export * from './useAuth.js';
|
|
13
12
|
export * from './useCapacitorApp.js';
|
|
@@ -26,7 +25,6 @@ export * from './usePlatform.js';
|
|
|
26
25
|
export * from './usePreview.js';
|
|
27
26
|
export * from './useProfileForm.js';
|
|
28
27
|
export * from './usePromise.js';
|
|
29
|
-
export * from './usePush.js';
|
|
30
28
|
export * from './useRouter.js';
|
|
31
29
|
export * from './useSignup.js';
|
|
32
30
|
export * from './useStorage.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
export * from './maybe-readable.js';
|
|
10
|
-
export * from './useAIModels.js';
|
|
11
10
|
export * from './useAsyncState.js';
|
|
12
11
|
export * from './useAuth.js';
|
|
13
12
|
export * from './useCapacitorApp.js';
|
|
@@ -26,7 +25,6 @@ export * from './usePlatform.js';
|
|
|
26
25
|
export * from './usePreview.js';
|
|
27
26
|
export * from './useProfileForm.js';
|
|
28
27
|
export * from './usePromise.js';
|
|
29
|
-
export * from './usePush.js';
|
|
30
28
|
export * from './useRouter.js';
|
|
31
29
|
export * from './useSignup.js';
|
|
32
30
|
export * from './useStorage.js';
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module
|
|
7
7
|
*/
|
|
8
8
|
import { type Readable } from 'svelte/store';
|
|
9
|
-
import type { I18nProvider, RichTranslateFunction, TranslateOptions } from '@molecule/app-i18n';
|
|
9
|
+
import type { I18nProvider, RichTranslateFunction, TranslateFunctionWithFallback, TranslateOptions } from '@molecule/app-i18n';
|
|
10
10
|
import { type MaybeReadable } from './maybe-readable.js';
|
|
11
11
|
/**
|
|
12
12
|
* Reads rich catalog messages from the active provider. Call the returned
|
|
@@ -28,9 +28,7 @@ export type UseTShorthandOptions = Omit<TranslateOptions, 'defaultValue'>;
|
|
|
28
28
|
* - `t(key, fallback, options?)` — a string second argument is the inline
|
|
29
29
|
* English `defaultValue`, with optional `count` for pluralization.
|
|
30
30
|
*/
|
|
31
|
-
export type UseTFunction =
|
|
32
|
-
(key: string, fallback: string, options?: UseTShorthandOptions): string;
|
|
33
|
-
};
|
|
31
|
+
export type UseTFunction = TranslateFunctionWithFallback;
|
|
34
32
|
/**
|
|
35
33
|
* What {@link useTranslation} returns: the locale-reactive values as readable
|
|
36
34
|
* stores and the provider's functions as plain functions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslation.d.ts","sourceRoot":"","sources":["../../src/hooks/useTranslation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAsB,KAAK,QAAQ,EAAY,MAAM,cAAc,CAAA;AAE1E,OAAO,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AAE,YAAY,CAAC,cAAc,CAAC,CAAA;IAC1C,4CAA4C;IAC5C,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,CAAA;IACtC,0CAA0C;IAC1C,SAAS,EAAE,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,CAAA;CACnC;AAqDD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,IAAI,oBAAoB,CAmBrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,IAAI,YAAY,CAenC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,QAAQ,CAAC,MAAM,CAAC,CAG5C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,CAGtD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,aAAa,CAAC,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC,GAC7C,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,CAazB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -153,9 +153,11 @@
|
|
|
153
153
|
* placed it. Nothing renders on the server; `target` replaces the body and `null` renders
|
|
154
154
|
* nothing until a target exists.
|
|
155
155
|
*
|
|
156
|
+
* Use `@molecule/app-svelte/chat`, `@molecule/app-svelte/ai-models`, and
|
|
157
|
+
* `@molecule/app-svelte/push` for those features.
|
|
158
|
+
*
|
|
156
159
|
* @module
|
|
157
160
|
*/
|
|
158
|
-
export * from './agent-identity.js';
|
|
159
161
|
export * from './components/index.js';
|
|
160
162
|
export * from './content.js';
|
|
161
163
|
export * from './context.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+JG;AAEH,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -153,9 +153,11 @@
|
|
|
153
153
|
* placed it. Nothing renders on the server; `target` replaces the body and `null` renders
|
|
154
154
|
* nothing until a target exists.
|
|
155
155
|
*
|
|
156
|
+
* Use `@molecule/app-svelte/chat`, `@molecule/app-svelte/ai-models`, and
|
|
157
|
+
* `@molecule/app-svelte/push` for those features.
|
|
158
|
+
*
|
|
156
159
|
* @module
|
|
157
160
|
*/
|
|
158
|
-
export * from './agent-identity.js';
|
|
159
161
|
export * from './components/index.js';
|
|
160
162
|
export * from './content.js';
|
|
161
163
|
export * from './context.js';
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Provider for AI chat, as @molecule/app-react's ChatProvider.
|
|
3
3
|
-->
|
|
4
4
|
<script lang="ts">
|
|
5
|
-
import type { ChatProviderProps } from '../types.js'
|
|
6
|
-
import
|
|
5
|
+
import type { ChatProviderProps } from '../chat-types.js'
|
|
6
|
+
import ChatScope from './ChatScope.svelte'
|
|
7
7
|
|
|
8
8
|
let { provider, children }: ChatProviderProps = $props()
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
11
|
{#key provider}
|
|
12
|
-
<
|
|
12
|
+
<ChatScope {provider}>
|
|
13
13
|
{@render children?.()}
|
|
14
|
-
</
|
|
14
|
+
</ChatScope>
|
|
15
15
|
{/key}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChatProviderProps } from '../types.js';
|
|
1
|
+
import type { ChatProviderProps } from '../chat-types.js';
|
|
2
2
|
declare const ChatProvider: import("svelte").Component<ChatProviderProps, {}, "">;
|
|
3
3
|
type ChatProvider = ReturnType<typeof ChatProvider>;
|
|
4
4
|
export default ChatProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatProvider.svelte.d.ts","sourceRoot":"","sources":["../../src/providers/ChatProvider.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ChatProvider.svelte.d.ts","sourceRoot":"","sources":["../../src/providers/ChatProvider.svelte"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAmBzD,QAAA,MAAM,YAAY,uDAAwC,CAAC;AAC3D,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AACpD,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { untrack } from 'svelte'
|
|
3
|
+
|
|
4
|
+
import { setChatContext } from '../chat-context.js'
|
|
5
|
+
import type { ChatProviderProps } from '../chat-types.js'
|
|
6
|
+
|
|
7
|
+
let { provider, children }: ChatProviderProps = $props()
|
|
8
|
+
|
|
9
|
+
// ChatProvider re-creates this scope when the provider changes.
|
|
10
|
+
untrack(() => setChatContext(provider))
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
{@render children?.()}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatScope.svelte.d.ts","sourceRoot":"","sources":["../../src/providers/ChatScope.svelte"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAkB1D,QAAA,MAAM,SAAS,uDAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoleculeProvider.svelte.d.ts","sourceRoot":"","sources":["../../src/providers/MoleculeProvider.svelte"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAkB,qBAAqB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"MoleculeProvider.svelte.d.ts","sourceRoot":"","sources":["../../src/providers/MoleculeProvider.svelte"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAkB,qBAAqB,EAAE,MAAM,aAAa,CAAA;AA8DxE,QAAA,MAAM,gBAAgB,2DAAwC,CAAC;AAC/D,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC5D,eAAe,gBAAgB,CAAC"}
|
|
@@ -114,10 +114,6 @@ export declare const LoggerProvider: import("svelte").Component<import("../types
|
|
|
114
114
|
* `@molecule/app-react`; import the interface from `@molecule/app-logger`.
|
|
115
115
|
*/
|
|
116
116
|
export type LoggerProvider = CoreLoggerProvider;
|
|
117
|
-
/**
|
|
118
|
-
* Provider for AI chat, as `@molecule/app-react`'s `ChatProvider`.
|
|
119
|
-
*/
|
|
120
|
-
export declare const ChatProvider: import("svelte").Component<import("../types.js").ChatProviderProps, {}, "">;
|
|
121
117
|
/**
|
|
122
118
|
* Provider for the IDE workspace, as `@molecule/app-react`'s `WorkspaceProvider`.
|
|
123
119
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/providers/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1E,OAAO,KAAK,EAAE,c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GAAG,gBAAgB,CAAA;AAE3C;;GAEG;AACH,eAAO,MAAM,YAAY,6EAAwB,CAAA;AAEjD;;GAEG;AACH,eAAO,MAAM,eAAe,gFAA2B,CAAA;AAEvD;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,mBAAmB,CAAA;AAEjD;;GAEG;AACH,eAAO,MAAM,cAAc,+EAA0B,CAAA;AAErD;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,iBAAiB,kFAA6B,CAAA;AAE3D;;GAEG;AACH,eAAO,MAAM,cAAc,+EAA0B,CAAA;AAErD;;GAEG;AACH,eAAO,MAAM,eAAe,gFAA2B,CAAA"}
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* @module
|
|
14
14
|
*/
|
|
15
15
|
import AuthProviderComponent from './AuthProvider.svelte';
|
|
16
|
-
import ChatProviderComponent from './ChatProvider.svelte';
|
|
17
16
|
import EditorProviderComponent from './EditorProvider.svelte';
|
|
18
17
|
import HttpProviderComponent from './HttpProvider.svelte';
|
|
19
18
|
import I18nProviderComponent from './I18nProvider.svelte';
|
|
@@ -87,10 +86,6 @@ export const StorageProvider = StorageProviderComponent;
|
|
|
87
86
|
* Provider for logging, as `@molecule/app-react`'s `LoggerProvider`.
|
|
88
87
|
*/
|
|
89
88
|
export const LoggerProvider = LoggerProviderComponent;
|
|
90
|
-
/**
|
|
91
|
-
* Provider for AI chat, as `@molecule/app-react`'s `ChatProvider`.
|
|
92
|
-
*/
|
|
93
|
-
export const ChatProvider = ChatProviderComponent;
|
|
94
89
|
/**
|
|
95
90
|
* Provider for the IDE workspace, as `@molecule/app-react`'s `WorkspaceProvider`.
|
|
96
91
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/providers/services.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/providers/services.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAYjE;AAqBD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAgB5D"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
|
-
import { setAuthContext,
|
|
7
|
+
import { setAuthContext, setEditorContext, setHttpContext, setI18nContext, setLoggerContext, setPreviewContext, setRouterContext, setStateContext, setStorageContext, setThemeContext, setWorkspaceContext, } from '../context.js';
|
|
8
8
|
/**
|
|
9
9
|
* Sets each service in `services` in Svelte context, and nothing for one that is absent (unlike
|
|
10
10
|
* `setMoleculeContext`, no state fallback: a single-service provider must not replace the
|
|
@@ -29,8 +29,6 @@ export function setServiceContexts(services) {
|
|
|
29
29
|
setStorageContext(services.storage);
|
|
30
30
|
if (services.logger)
|
|
31
31
|
setLoggerContext(services.logger);
|
|
32
|
-
if (services.chat)
|
|
33
|
-
setChatContext(services.chat);
|
|
34
32
|
if (services.workspace)
|
|
35
33
|
setWorkspaceContext(services.workspace);
|
|
36
34
|
if (services.editor)
|
|
@@ -76,7 +74,6 @@ export function servicesKey(services) {
|
|
|
76
74
|
services.http,
|
|
77
75
|
services.storage,
|
|
78
76
|
services.logger,
|
|
79
|
-
services.chat,
|
|
80
77
|
services.workspace,
|
|
81
78
|
services.editor,
|
|
82
79
|
services.preview,
|
package/dist/push.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../src/push.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
|
package/dist/push.js
ADDED
package/dist/stores/chat.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { onDestroy, onMount } from 'svelte';
|
|
8
8
|
import { derived, get, writable } from 'svelte/store';
|
|
9
9
|
import { convergeHistory as coreConvergeHistory, createChatSession, localOnlyMessages as coreLocalOnlyMessages, resetChatStoresForTests as coreResetChatStoresForTests, } from '@molecule/app-ai-chat';
|
|
10
|
-
import { useChatProvider } from '../context.js';
|
|
10
|
+
import { useChatProvider } from '../chat-context.js';
|
|
11
11
|
import { toReadable } from '../hooks/maybe-readable.js';
|
|
12
12
|
/**
|
|
13
13
|
* Converges the local transcript with authoritative server history. See
|
package/dist/stores/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export * from './async-state.js';
|
|
|
7
7
|
export * from './auth.js';
|
|
8
8
|
export * from './capacitor-app.js';
|
|
9
9
|
export * from './change-password.js';
|
|
10
|
-
export * from './chat.js';
|
|
11
10
|
export * from './device.js';
|
|
12
11
|
export * from './forms.js';
|
|
13
12
|
export * from './http.js';
|
|
@@ -18,7 +17,6 @@ export * from './oauth.js';
|
|
|
18
17
|
export * from './password-reset.js';
|
|
19
18
|
export * from './platform.js';
|
|
20
19
|
export * from './promise.js';
|
|
21
|
-
export * from './push.js';
|
|
22
20
|
export * from './router.js';
|
|
23
21
|
export * from './signup.js';
|
|
24
22
|
export * from './state.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stores/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stores/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA"}
|
package/dist/stores/index.js
CHANGED
|
@@ -7,7 +7,6 @@ export * from './async-state.js';
|
|
|
7
7
|
export * from './auth.js';
|
|
8
8
|
export * from './capacitor-app.js';
|
|
9
9
|
export * from './change-password.js';
|
|
10
|
-
export * from './chat.js';
|
|
11
10
|
export * from './device.js';
|
|
12
11
|
export * from './forms.js';
|
|
13
12
|
export * from './http.js';
|
|
@@ -18,7 +17,6 @@ export * from './oauth.js';
|
|
|
18
17
|
export * from './password-reset.js';
|
|
19
18
|
export * from './platform.js';
|
|
20
19
|
export * from './promise.js';
|
|
21
|
-
export * from './push.js';
|
|
22
20
|
export * from './router.js';
|
|
23
21
|
export * from './signup.js';
|
|
24
22
|
export * from './state.js';
|
package/dist/types.d.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Component, Snippet } from 'svelte';
|
|
7
7
|
import type { Readable, Writable } from 'svelte/store';
|
|
8
|
-
import type { ChatProvider } from '@molecule/app-ai-chat';
|
|
9
8
|
import type { AuthClient, AuthState } from '@molecule/app-auth';
|
|
10
9
|
import type { EditorProvider } from '@molecule/app-code-editor';
|
|
11
10
|
import type { FormController, FormOptions, FormResetOptions } from '@molecule/app-forms';
|
|
@@ -30,8 +29,6 @@ export interface MoleculeConfig {
|
|
|
30
29
|
http?: HttpClient;
|
|
31
30
|
storage?: StorageProvider;
|
|
32
31
|
logger?: LoggerProvider;
|
|
33
|
-
/** The AI chat provider useChat and useChatProvider use. */
|
|
34
|
-
chat?: ChatProvider;
|
|
35
32
|
/** The IDE workspace provider useWorkspace and useWorkspaceProvider use. */
|
|
36
33
|
workspace?: WorkspaceProvider;
|
|
37
34
|
/** The code editor provider useEditor and useEditorProvider use. */
|
|
@@ -124,12 +121,6 @@ export interface StorageProviderProps extends ProviderProps {
|
|
|
124
121
|
export interface LoggerProviderProps extends ProviderProps {
|
|
125
122
|
provider: LoggerProvider;
|
|
126
123
|
}
|
|
127
|
-
/**
|
|
128
|
-
* Props for the `ChatProvider` component.
|
|
129
|
-
*/
|
|
130
|
-
export interface ChatProviderProps extends ProviderProps {
|
|
131
|
-
provider: ChatProvider;
|
|
132
|
-
}
|
|
133
124
|
/**
|
|
134
125
|
* Props for the `WorkspaceProvider` component.
|
|
135
126
|
*/
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,KAAK,EA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EG;AACH,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IAC3D,QAAQ,EAAE,iBAAiB,CAAA;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,QAAQ,EAAE,cAAc,CAAA;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD,QAAQ,EAAE,eAAe,CAAA;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,aAAa,EAAE,cAAc;IAC1E;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,2GAA2G;IAC3G,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,IAAI,EAAE,CAAC,GAAG,IAAI,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,KAAK,EAAE,CAAC,GAAG,SAAS,CAAA;IACpB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CACpB;AAKD,YAAY,EACV,UAAU,EACV,SAAS,EACT,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,MAAM,EACN,aAAa,EACb,WAAW,EACX,QAAQ,EACR,aAAa,EACb,WAAW,EACX,MAAM,EACN,YAAY,EACZ,KAAK,EACL,WAAW,EACX,KAAK,EACL,QAAQ,GACT,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-svelte",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Svelte framework bindings for molecule.dev",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,7 +16,22 @@
|
|
|
16
16
|
"svelte": "./dist/link/index.js",
|
|
17
17
|
"default": "./dist/link/index.js"
|
|
18
18
|
},
|
|
19
|
-
"./package.json": "./package.json"
|
|
19
|
+
"./package.json": "./package.json",
|
|
20
|
+
"./chat": {
|
|
21
|
+
"types": "./dist/chat/index.d.ts",
|
|
22
|
+
"svelte": "./dist/chat/index.js",
|
|
23
|
+
"default": "./dist/chat/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./ai-models": {
|
|
26
|
+
"types": "./dist/ai-models.d.ts",
|
|
27
|
+
"svelte": "./dist/ai-models.js",
|
|
28
|
+
"default": "./dist/ai-models.js"
|
|
29
|
+
},
|
|
30
|
+
"./push": {
|
|
31
|
+
"types": "./dist/push.d.ts",
|
|
32
|
+
"svelte": "./dist/push.js",
|
|
33
|
+
"default": "./dist/push.js"
|
|
34
|
+
}
|
|
20
35
|
},
|
|
21
36
|
"svelte": "./dist/index.js",
|
|
22
37
|
"files": [
|
|
@@ -45,7 +60,7 @@
|
|
|
45
60
|
"@molecule/app-device": "^1.0.1",
|
|
46
61
|
"@molecule/app-forms": "^2.4.0",
|
|
47
62
|
"@molecule/app-http": "^1.0.1",
|
|
48
|
-
"@molecule/app-i18n": "^1.
|
|
63
|
+
"@molecule/app-i18n": "^1.4.0",
|
|
49
64
|
"@molecule/app-ide": "^1.1.0",
|
|
50
65
|
"@molecule/app-live-preview": "^1.0.1",
|
|
51
66
|
"@molecule/app-logger": "^1.0.1",
|
|
@@ -62,6 +77,12 @@
|
|
|
62
77
|
"svelte": "^5.43.15"
|
|
63
78
|
},
|
|
64
79
|
"peerDependenciesMeta": {
|
|
80
|
+
"@molecule/app-ai-chat": {
|
|
81
|
+
"optional": true
|
|
82
|
+
},
|
|
83
|
+
"@molecule/app-ai-models": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
65
86
|
"@molecule/app-code-editor": {
|
|
66
87
|
"optional": true
|
|
67
88
|
},
|
|
@@ -71,6 +92,9 @@
|
|
|
71
92
|
"@molecule/app-live-preview": {
|
|
72
93
|
"optional": true
|
|
73
94
|
},
|
|
95
|
+
"@molecule/app-push": {
|
|
96
|
+
"optional": true
|
|
97
|
+
},
|
|
74
98
|
"@molecule/app-routing-sveltekit": {
|
|
75
99
|
"optional": true
|
|
76
100
|
}
|
|
@@ -79,7 +103,8 @@
|
|
|
79
103
|
"@molecule/app-ai-chat": "1.8.1",
|
|
80
104
|
"@molecule/app-ai-models": "1.4.4",
|
|
81
105
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
82
|
-
"@molecule/app-
|
|
106
|
+
"@molecule/app-push": "1.2.3",
|
|
107
|
+
"@molecule/app-utilities": "1.1.0",
|
|
83
108
|
"@sveltejs/package": "3.0.2",
|
|
84
109
|
"@sveltejs/vite-plugin-svelte": "7.1.2",
|
|
85
110
|
"@types/node": "26.6.5",
|