@molecule/app-query-svelte 1.3.1 → 1.4.1

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 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-17T05:19:22.368Z
6
+ Generated: 2026-11-18T20:06:14.705Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-query-svelte
@@ -353,7 +353,7 @@ interface QueryResource<T, Create = Partial<T>, Update = Partial<T>> {
353
353
  ): QueryOptions<Page>
354
354
  /**
355
355
  * `useQuery` options for one record, or null while `id` is not known yet (`useQuery(null)`
356
- * observes nothing). A missing record resolves to null, not to an error.
356
+ * observes nothing). An empty ID is also unknown. A missing record resolves to null.
357
357
  */
358
358
  detail(viewer: string, id: string | null | undefined): QueryOptions<T | null> | null
359
359
  /** Creates a record, shows it in the cache and refreshes the lists on screen. */
@@ -365,7 +365,7 @@ interface QueryResource<T, Create = Partial<T>, Update = Partial<T>> {
365
365
  /**
366
366
  * Switches a flag the API models as a sub-path: `POST path/id/action` turns it on and
367
367
  * `DELETE path/id/action` turns it off. Resolves with the saved record, so it is the `commit`
368
- * of `useOptimisticValue`.
368
+ * of `useOptimisticValue`. Rejects an absent or empty record ID before sending a request.
369
369
  * The saved detail is published before tracked lists finish refreshing; this promise waits
370
370
  * for those refreshes. Render the shared controller's value and let it queue inverse clicks
371
371
  * during that interval. A page-local busy guard can drop a click on the newly changed label.
@@ -462,14 +462,37 @@ interface QueryContentProps<T> {
462
462
  query:
463
463
  | Readable<Pick<QueryState<T>, 'data' | 'status' | 'error' | 'isPreviousData'>>
464
464
  | Pick<QueryState<T>, 'data' | 'status' | 'error' | 'isPreviousData'>
465
+ /**
466
+ * Stable identity of the requested record, including the principal when needed.
467
+ * Use for record-specific state such as an edit form. Changing the key remounts the
468
+ * loaded branch and excludes data retained from a previous query key.
469
+ */
470
+ recordKey?: PropertyKey
465
471
  /** Mounted only with a real document, including false, zero and an empty list. */
466
- children: Snippet<[NonNullable<T>]>
472
+ children: Snippet<[QueryContentContext<T>]>
467
473
  /** Initial idle/loading content. Render a status snippet, never a fake item or action. */
468
474
  pending?: Snippet | null
469
475
  /** Content for a loaded null record. Null is distinct from an unfinished request. */
470
476
  missing?: Snippet | null
471
477
  /** A failed initial read. Cached data stays visible if its refresh fails. */
472
- error?: Snippet<[unknown]> | null
478
+ error?: Snippet<[QueryContentErrorContext]> | null
479
+ }
480
+ ```
481
+
482
+ #### `QueryRecordContentProps`
483
+
484
+ A loaded document and its verified identity, required to render the
485
+ record's actions.
486
+
487
+ ```typescript
488
+ interface QueryRecordContentProps<T, Id extends string | number> extends Omit<
489
+ QueryContentProps<T>,
490
+ 'children'
491
+ > {
492
+ /** Extracts the ID from the loaded document. Null, undefined and an empty string are pending. */
493
+ getRecordId: (data: QueryContentContext<T>) => Id | null | undefined
494
+ /** Receives the ID with the document. The branch remounts when the ID or recordKey changes. */
495
+ children: Snippet<[QueryContentContext<T>, NoInfer<Id>]>
473
496
  }
474
497
  ```
475
498
 
@@ -509,6 +532,39 @@ type ListQueryInputs<Values> = {
509
532
  }
510
533
  ```
511
534
 
535
+ #### `QueryOptionsInput`
536
+
537
+ What `useQuery` observes: the options for one key or `null` (nothing), as plain values or a store of them.
538
+
539
+ ```typescript
540
+ type QueryOptionsInput<T> = QueryOptions<T> | null | Readable<QueryOptions<T> | null>
541
+ ```
542
+
543
+ #### `QueryContentContext`
544
+
545
+ What {@link QueryContentProps.children} (the loaded-data branch) receives: the loaded document, as the snippet argument.
546
+
547
+ ```typescript
548
+ type QueryContentContext<T> = NonNullable<T>
549
+ ```
550
+
551
+ #### `QueryContentErrorContext`
552
+
553
+ What {@link QueryContentProps.error} receives: the error the failed initial read rejected with.
554
+
555
+ ```typescript
556
+ type QueryContentErrorContext = unknown
557
+ ```
558
+
559
+ #### `QueryContentSlots`
560
+
561
+ The content {@link QueryContentProps} renders for each state: the loaded-data branch, the
562
+ pending and missing content and the error renderer (the snippets the component takes).
563
+
564
+ ```typescript
565
+ type QueryContentSlots<T> = Pick<QueryContentProps<T>, 'children' | 'pending' | 'missing' | 'error'>
566
+ ```
567
+
512
568
  ### Functions
513
569
 
514
570
  #### `prefetchQuery(options)`
@@ -640,9 +696,7 @@ a local cache update. Render `data` directly; a component-local copy stops
640
696
  observing later server responses.
641
697
 
642
698
  ```typescript
643
- function useQuery<T>(
644
- options: QueryOptions<T> | null | Readable<QueryOptions<T> | null>,
645
- ): Readable<UseQueryResult<T>>
699
+ function useQuery<T>(options: QueryOptionsInput<T>): Readable<UseQueryResult<T>>
646
700
  ```
647
701
 
648
702
  - `options` — Key, fetch, freshness, and optionally `principal` with `keepPreviousData`; or `null`; or a readable store of either, so changed options are followed without remounting.
@@ -8,26 +8,37 @@
8
8
  list or record container rendered by `children`, and so does a refresh
9
9
  line; the default fallbacks render nothing. Headless: it owns no
10
10
  translations and no styling. A previous key's empty or missing document
11
- renders pending/error until the current key answers.
11
+ renders pending/error until the current key answers. Pass `recordKey` for an
12
+ edit form: the form mounts with the current record and resets when its
13
+ identity changes, including a switch to a record already in cache. Pass
14
+ `getRecordId` to bind actions to the loaded document's identity: the branch
15
+ stays pending without a nonempty ID and receives the ID as its second
16
+ argument.
12
17
  -->
13
18
  <script lang="ts" generics="T">
19
+ import type { Snippet } from 'svelte'
14
20
  import { type Readable, readonly, writable } from 'svelte/store'
15
21
 
16
22
  import type { QueryState } from '@molecule/app-query'
17
23
 
18
- import type { QueryContentProps } from './types.js'
24
+ import type { QueryContentContext, QueryContentProps } from './types.js'
19
25
 
20
26
  /** The part of a query state this component renders from. */
21
27
  type QueryView = Pick<QueryState<T>, 'data' | 'status' | 'error' | 'isPreviousData'>
22
-
23
- let {
24
- query,
25
- children,
26
- pending = null,
27
- missing = null,
28
- error = null,
29
- empty,
30
- }: QueryContentProps<T> = $props()
28
+ /**
29
+ * The props this component takes: the read-only shape plus the optional
30
+ * identity binder. `children` declares an optional second argument, so one
31
+ * snippet shape serves both branches — the verified ID is passed only when
32
+ * `getRecordId` is set. (The record-bound contract itself is
33
+ * `QueryRecordContentProps` in `./types.js`.) The type is inline because
34
+ * svelte2tsx exposes the component's parameter type.
35
+ */
36
+ let props: Omit<QueryContentProps<T>, 'children'> & {
37
+ /** Extracts the ID from the loaded document; null, undefined and '' are pending. */
38
+ getRecordId?: (data: QueryContentContext<T>) => string | number | null | undefined
39
+ /** Receives the document, and the verified ID when `getRecordId` is set. */
40
+ children: Snippet<[QueryContentContext<T>, (string | number)?]>
41
+ } = $props()
31
42
 
32
43
  /**
33
44
  * The state as a readable store, whichever prop form arrived: the store
@@ -36,22 +47,60 @@
36
47
  * `<QueryContent query={query}>` and `query={$query}` follow the query.
37
48
  */
38
49
  const view: Readable<QueryView> = $derived(
39
- typeof (query as Partial<Readable<QueryView>>).subscribe === 'function'
40
- ? (query as Readable<QueryView>)
41
- : readonly(writable(query as QueryView)),
50
+ typeof (props.query as Partial<Readable<QueryView>>).subscribe === 'function'
51
+ ? (props.query as Readable<QueryView>)
52
+ : readonly(writable(props.query as QueryView)),
42
53
  )
54
+
55
+ /** Whether the props bind the branch to the loaded document's identity. */
56
+ const identified = $derived(typeof props.getRecordId === 'function')
57
+
58
+ /** The valid identity of the loaded document: absent, null and '' are pending. */
59
+ const recordId = $derived.by(() => {
60
+ const getRecordId = props.getRecordId
61
+ if (typeof getRecordId !== 'function') return undefined
62
+ const data = $view.data
63
+ if (data === undefined || data === null) return undefined
64
+ const id = getRecordId(data)
65
+ return id == null || id === '' ? undefined : id
66
+ })
43
67
  </script>
44
68
 
45
- {#if $view.data === undefined || ($view.isPreviousData && ($view.data === null || empty?.when($view.data)))}
46
- {#if $view.status === 'error' && error}
47
- {@render error($view.error)}
48
- {:else if pending}
49
- {@render pending()}
69
+ {#if $view.data === undefined || ($view.isPreviousData && (identified || props.recordKey !== undefined || $view.data === null || (props.empty?.when($view.data) ?? false)))}
70
+ {#if $view.status === 'error' && props.error}
71
+ {@render props.error?.($view.error)}
72
+ {:else if props.pending}
73
+ {@render props.pending?.()}
50
74
  {/if}
51
75
  {:else if $view.data === null}
52
- {#if missing}{@render missing()}{/if}
53
- {:else if empty?.when($view.data)}
54
- {@render empty.render($view.data)}
76
+ {#if props.missing}{@render props.missing?.()}{/if}
77
+ {:else if identified}
78
+ {#if recordId === undefined}
79
+ {#if props.pending}{@render props.pending?.()}{/if}
80
+ {:else}
81
+ <!-- Keyed by the ID inside the viewer key, so either change starts the
82
+ loaded branch fresh (React's nested keyed Fragments). -->
83
+ {#key props.recordKey}
84
+ {#key recordId}
85
+ {#if props.empty?.when($view.data)}
86
+ {@render props.empty.render?.($view.data)}
87
+ {:else}
88
+ {@render props.children?.($view.data, recordId)}
89
+ {/if}
90
+ {/key}
91
+ {/key}
92
+ {/if}
93
+ {:else if props.recordKey !== undefined}
94
+ <!-- Keyed, so a changed record starts the loaded branch fresh (React's keyed Fragment). -->
95
+ {#key props.recordKey}
96
+ {#if props.empty?.when($view.data)}
97
+ {@render props.empty.render?.($view.data)}
98
+ {:else}
99
+ {@render props.children?.($view.data)}
100
+ {/if}
101
+ {/key}
102
+ {:else if props.empty?.when($view.data)}
103
+ {@render props.empty.render?.($view.data)}
55
104
  {:else}
56
- {@render children($view.data)}
105
+ {@render props.children?.($view.data)}
57
106
  {/if}
@@ -1,6 +1,12 @@
1
- import type { QueryContentProps } from './types.js';
1
+ import type { Snippet } from 'svelte';
2
+ import type { QueryContentContext, QueryContentProps } from './types.js';
2
3
  declare function $$render<T>(): {
3
- props: QueryContentProps<T>;
4
+ props: Omit<QueryContentProps<T>, "children"> & {
5
+ /** Extracts the ID from the loaded document; null, undefined and '' are pending. */
6
+ getRecordId?: (data: QueryContentContext<T>) => string | number | null | undefined;
7
+ /** Receives the document, and the verified ID when `getRecordId` is set. */
8
+ children: Snippet<[QueryContentContext<T>, (string | number)?]>;
9
+ };
4
10
  exports: {};
5
11
  bindings: "";
6
12
  slots: {};
@@ -1 +1 @@
1
- {"version":3,"file":"QueryContent.svelte.d.ts","sourceRoot":"","sources":["../src/QueryContent.svelte"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,iBAAS,QAAQ,CAAC,CAAC;WAiDU,iBAAiB,CAAC,CAAC,CAAC;;;;;EAA4E;AAC7H,cAAM,iBAAiB,CAAC,CAAC;IACrB,KAAK,IAAI,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAChD,MAAM,IAAI,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAClD,KAAK,IAAI,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAChD,QAAQ;IACR,OAAO;CACV;AAED,UAAU,qBAAqB;IAC3B,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAA;KAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,SAAS,CAA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} from '@molecule/app-query';
9
+ import type { QueryOptions, QueryState } from '@molecule/app-query';
10
+ /** What `useQuery` observes: the options for one key or `null` (nothing), as plain values or a store of them. */
11
+ export type QueryOptionsInput<T> = QueryOptions<T> | null | Readable<QueryOptions<T> | null>;
10
12
  /**
11
13
  * A mounted query's state and its explicit cache and refresh actions. The
12
14
  * Svelte hook hands this out as a readable store of these objects (one per
@@ -32,6 +34,10 @@ export interface UseQueryResult<T> extends QueryState<T> {
32
34
  */
33
35
  refetch: () => Promise<QueryState<T>>;
34
36
  }
37
+ /** What {@link QueryContentProps.children} (the loaded-data branch) receives: the loaded document, as the snippet argument. */
38
+ export type QueryContentContext<T> = NonNullable<T>;
39
+ /** What {@link QueryContentProps.error} receives: the error the failed initial read rejected with. */
40
+ export type QueryContentErrorContext = unknown;
35
41
  /** A loaded document owns its controls; absent documents expose only status content. */
36
42
  export interface QueryContentProps<T> {
37
43
  /**
@@ -49,15 +55,36 @@ export interface QueryContentProps<T> {
49
55
  * compatible observer's plain state object. Both follow the query.
50
56
  */
51
57
  query: Readable<Pick<QueryState<T>, 'data' | 'status' | 'error' | 'isPreviousData'>> | Pick<QueryState<T>, 'data' | 'status' | 'error' | 'isPreviousData'>;
58
+ /**
59
+ * Stable identity of the requested record, including the principal when needed.
60
+ * Use for record-specific state such as an edit form. Changing the key remounts the
61
+ * loaded branch and excludes data retained from a previous query key.
62
+ */
63
+ recordKey?: PropertyKey;
52
64
  /** Mounted only with a real document, including false, zero and an empty list. */
53
- children: Snippet<[NonNullable<T>]>;
65
+ children: Snippet<[QueryContentContext<T>]>;
54
66
  /** Initial idle/loading content. Render a status snippet, never a fake item or action. */
55
67
  pending?: Snippet | null;
56
68
  /** Content for a loaded null record. Null is distinct from an unfinished request. */
57
69
  missing?: Snippet | null;
58
70
  /** A failed initial read. Cached data stays visible if its refresh fails. */
59
- error?: Snippet<[unknown]> | null;
71
+ error?: Snippet<[QueryContentErrorContext]> | null;
60
72
  }
73
+ /**
74
+ * A loaded document and its verified identity, required to render the
75
+ * record's actions.
76
+ */
77
+ export interface QueryRecordContentProps<T, Id extends string | number> extends Omit<QueryContentProps<T>, 'children'> {
78
+ /** Extracts the ID from the loaded document. Null, undefined and an empty string are pending. */
79
+ getRecordId: (data: QueryContentContext<T>) => Id | null | undefined;
80
+ /** Receives the ID with the document. The branch remounts when the ID or recordKey changes. */
81
+ children: Snippet<[QueryContentContext<T>, NoInfer<Id>]>;
82
+ }
83
+ /**
84
+ * The content {@link QueryContentProps} renders for each state: the loaded-data branch, the
85
+ * pending and missing content and the error renderer (the snippets the component takes).
86
+ */
87
+ export type QueryContentSlots<T> = Pick<QueryContentProps<T>, 'children' | 'pending' | 'missing' | 'error'>;
61
88
  /**
62
89
  * The handlers {@link intentPrefetchProps} returns, in Svelte 5's listener
63
90
  * naming (lowercase DOM event attributes, spreadable onto an `<a>`).
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD;;;;GAIG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IACtD;;;;;;;;;OASG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,SAAS,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,IAAI,CAAA;IAC1E;;;;;OAKG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;CACtC;AAED,wFAAwF;AACxF,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC;;;;;OAKG;IACH,KAAK,CAAC,EAAE;QAC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OAAO,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3C,0FAA0F;IAC1F,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACxB,qFAAqF;IACrF,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;IACxB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,wBAAwB,CAAC,CAAC,GAAG,IAAI,CAAA;CACnD;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC,EAAE,EAAE,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,IAAI,CAClF,iBAAiB,CAAC,CAAC,CAAC,EACpB,UAAU,CACX;IACC,iGAAiG;IACjG,WAAW,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,IAAI,GAAG,SAAS,CAAA;IACpE,+FAA+F;IAC/F,QAAQ,EAAE,OAAO,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;CACzD;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,IAAI,CACrC,iBAAiB,CAAC,CAAC,CAAC,EACpB,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAC7C,CAAA;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,cAAc,EAAE,MAAM,IAAI,CAAA;IAC1B,4CAA4C;IAC5C,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,8CAA8C;IAC9C,YAAY,EAAE,MAAM,IAAI,CAAA;CACzB"}
@@ -9,8 +9,7 @@
9
9
  * @module
10
10
  */
11
11
  import { type Readable } from 'svelte/store';
12
- import type { QueryOptions } from '@molecule/app-query';
13
- import type { UseQueryResult } from './types.js';
12
+ import type { QueryOptionsInput, UseQueryResult } from './types.js';
14
13
  /**
15
14
  * The document for `options.key`, kept current: cached data is delivered on
16
15
  * the very first read (so a warmed page never flashes a loading state), a
@@ -68,5 +67,5 @@ import type { UseQueryResult } from './types.js';
68
67
  * {/if}
69
68
  * ```
70
69
  */
71
- export declare function useQuery<T>(options: QueryOptions<T> | null | Readable<QueryOptions<T> | null>): Readable<UseQueryResult<T>>;
70
+ export declare function useQuery<T>(options: QueryOptionsInput<T>): Readable<UseQueryResult<T>>;
72
71
  //# sourceMappingURL=useQuery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useQuery.d.ts","sourceRoot":"","sources":["../src/useQuery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAO,KAAK,QAAQ,EAA2B,MAAM,cAAc,CAAA;AAE1E,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAA;AAGnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAmDhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GACjE,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAiN7B"}
1
+ {"version":3,"file":"useQuery.d.ts","sourceRoot":"","sources":["../src/useQuery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAO,KAAK,QAAQ,EAA2B,MAAM,cAAc,CAAA;AAK1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAmDnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAiNtF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-query-svelte",
3
- "version": "1.3.1",
3
+ "version": "1.4.1",
4
4
  "description": "Svelte hooks for @molecule/app-query — read a cached document synchronously, observe it, and prefetch on intent",
5
5
  "homepage": "https://www.molecule.dev/packages/app-query-svelte",
6
6
  "type": "module",
@@ -58,16 +58,16 @@
58
58
  "@molecule/app-framework-conformance": "0.0.0",
59
59
  "@molecule/app-i18n": "1.2.2",
60
60
  "@molecule/app-icons": "1.0.4",
61
- "@molecule/app-query": "1.3.2",
61
+ "@molecule/app-query": "1.3.4",
62
62
  "@molecule/app-query-memory": "1.1.0",
63
63
  "@molecule/app-query-tanstack": "1.1.0",
64
- "@molecule/app-svelte": "3.7.1",
65
- "@molecule/app-ui": "1.4.0",
66
- "@molecule/app-ui-svelte": "1.1.6",
64
+ "@molecule/app-svelte": "3.13.0",
65
+ "@molecule/app-ui": "1.5.0",
66
+ "@molecule/app-ui-svelte": "1.4.1",
67
67
  "@sveltejs/package": "3.0.2",
68
68
  "@sveltejs/vite-plugin-svelte": "7.1.2",
69
69
  "@types/node": "26.6.5",
70
- "jsdom": "30.1.3",
70
+ "jsdom": "31.0.1",
71
71
  "svelte": "5.57.2",
72
72
  "svelte-check": "4.7.7",
73
73
  "typescript": "6.0.3",