@molecule/app-query-solid 1.2.1 → 1.3.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 +20 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/query-content.d.ts.map +1 -1
- package/dist/query-content.jsx +2 -2
- package/dist/query-content.jsx.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -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-16T21:21:15.394Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-query-solid
|
|
@@ -436,6 +436,8 @@ interface QueryResource<T, Create = Partial<T>, Update = Partial<T>> {
|
|
|
436
436
|
/**
|
|
437
437
|
* `useQuery` options for the collection. `viewer` is who the answer is for (the signed-in id,
|
|
438
438
|
* or `'anonymous'`); a page or filter change keeps the rows on screen until the next answer.
|
|
439
|
+
* One record per URL identity, retaining the first occurrence. Equal values without an
|
|
440
|
+
* addressable id remain separate. Writes already refresh the collection.
|
|
439
441
|
*/
|
|
440
442
|
list(viewer: string, params?: Record<string, unknown>): QueryOptions<T[]>
|
|
441
443
|
/**
|
|
@@ -546,6 +548,16 @@ A loaded document owns its controls; absent documents expose only status content
|
|
|
546
548
|
|
|
547
549
|
```typescript
|
|
548
550
|
interface QueryContentProps<T> {
|
|
551
|
+
/**
|
|
552
|
+
* One optional empty branch, exclusive with children. The pure predicate reads the
|
|
553
|
+
* loaded document (an array or an application-owned envelope); render selects the
|
|
554
|
+
* current view's message and recovery action. Omit it to keep empty arrays as data.
|
|
555
|
+
*/
|
|
556
|
+
empty?: {
|
|
557
|
+
when: (data: NonNullable<T>) => boolean
|
|
558
|
+
render: NonNullable<QueryContentProps<T>['children']>
|
|
559
|
+
}
|
|
560
|
+
|
|
549
561
|
/** State from useQuery, or any compatible query observer. */
|
|
550
562
|
query: Pick<QueryState<T>, 'data' | 'status' | 'error'>
|
|
551
563
|
/**
|
|
@@ -877,3 +889,10 @@ a reader that finds the container and reads its paragraph must read the record,
|
|
|
877
889
|
Keep every resource identity in the query key. A boundary cannot correct a query that supplies
|
|
878
890
|
another record's cached data. For a list, map real rows inside the child; never style a status
|
|
879
891
|
placeholder as a row. QueryContent is headless and owns no translations or styling.
|
|
892
|
+
|
|
893
|
+
For a collection, `QueryContent` also accepts one `empty` branch:
|
|
894
|
+
`{ when: page => page.rows.length === 0, render: page => selectedEmptyState }`.
|
|
895
|
+
It is exclusive with loaded children, so a selected view chooses its message and
|
|
896
|
+
recovery action once rather than rendering a general empty message beside it.
|
|
897
|
+
`when` receives a loaded document; empty arrays remain data when this prop is omitted.
|
|
898
|
+
The render value uses this framework's existing children function, snippet or template.
|
package/dist/index.d.ts
CHANGED
|
@@ -424,6 +424,13 @@
|
|
|
424
424
|
* another record's cached data. For a list, map real rows inside the child; never style a status
|
|
425
425
|
* placeholder as a row. QueryContent is headless and owns no translations or styling.
|
|
426
426
|
*
|
|
427
|
+
* For a collection, `QueryContent` also accepts one `empty` branch:
|
|
428
|
+
* `{ when: page => page.rows.length === 0, render: page => selectedEmptyState }`.
|
|
429
|
+
* It is exclusive with loaded children, so a selected view chooses its message and
|
|
430
|
+
* recovery action once rather than rendering a general empty message beside it.
|
|
431
|
+
* `when` receives a loaded document; empty arrays remain data when this prop is omitted.
|
|
432
|
+
* The render value uses this framework's existing children function, snippet or template.
|
|
433
|
+
*
|
|
427
434
|
* @module
|
|
428
435
|
*/
|
|
429
436
|
export * from './list-query.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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkbG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -424,6 +424,13 @@
|
|
|
424
424
|
* another record's cached data. For a list, map real rows inside the child; never style a status
|
|
425
425
|
* placeholder as a row. QueryContent is headless and owns no translations or styling.
|
|
426
426
|
*
|
|
427
|
+
* For a collection, `QueryContent` also accepts one `empty` branch:
|
|
428
|
+
* `{ when: page => page.rows.length === 0, render: page => selectedEmptyState }`.
|
|
429
|
+
* It is exclusive with loaded children, so a selected view chooses its message and
|
|
430
|
+
* recovery action once rather than rendering a general empty message beside it.
|
|
431
|
+
* `when` receives a loaded document; empty arrays remain data when this prop is omitted.
|
|
432
|
+
* The render value uses this framework's existing children function, snippet or template.
|
|
433
|
+
*
|
|
427
434
|
* @module
|
|
428
435
|
*/
|
|
429
436
|
export * from './list-query.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkbG;AAEH,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-content.d.ts","sourceRoot":"","sources":["../src/query-content.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAc,KAAK,GAAG,EAAQ,MAAM,UAAU,CAAA;AAErD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"query-content.d.ts","sourceRoot":"","sources":["../src/query-content.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAc,KAAK,GAAG,EAAQ,MAAM,UAAU,CAAA;AAErD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAsBxE"}
|
package/dist/query-content.jsx
CHANGED
|
@@ -26,7 +26,7 @@ export function QueryContent(props) {
|
|
|
26
26
|
// Boxed, so a loaded `false`, `0` or `''` is still a truthy `when` for <Show>.
|
|
27
27
|
const loaded = createMemo(() => {
|
|
28
28
|
const data = props.query.data;
|
|
29
|
-
return data === undefined || data === null ? undefined : { data };
|
|
29
|
+
return data === undefined || data === null || props.empty?.when(data) ? undefined : { data };
|
|
30
30
|
});
|
|
31
31
|
// Rendered only while nothing is loaded: a failed REFRESH of cached data never calls `error`.
|
|
32
32
|
const fallback = createMemo(() => {
|
|
@@ -35,7 +35,7 @@ export function QueryContent(props) {
|
|
|
35
35
|
if (data === null)
|
|
36
36
|
return props.missing ?? null;
|
|
37
37
|
if (data !== undefined)
|
|
38
|
-
return null;
|
|
38
|
+
return props.empty?.when(data) ? props.empty.render(() => props.query.data) : null;
|
|
39
39
|
return query.status === 'error' && props.error
|
|
40
40
|
? props.error(query.error)
|
|
41
41
|
: (props.pending ?? null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-content.jsx","sourceRoot":"","sources":["../src/query-content.tsx"],"names":[],"mappings":"AAAA;;;;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E,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QACrF,OAAO,KAAK,CAAC,MAAM,KAAK,OAAO,IAAI,KAAK,CAAC,KAAK;YAC5C,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;YAC1B,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,CAAA;IAC7B,CAAC,CAAC,CAAA;IACF,OAAO,CACL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CACzC;MAAA,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAC5C;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -34,6 +34,15 @@ export interface UseQueryResult<T> extends QueryState<T> {
|
|
|
34
34
|
}
|
|
35
35
|
/** A loaded document owns its controls; absent documents expose only status content. */
|
|
36
36
|
export interface QueryContentProps<T> {
|
|
37
|
+
/**
|
|
38
|
+
* One optional empty branch, exclusive with children. The pure predicate reads the
|
|
39
|
+
* loaded document (an array or an application-owned envelope); render selects the
|
|
40
|
+
* current view's message and recovery action. Omit it to keep empty arrays as data.
|
|
41
|
+
*/
|
|
42
|
+
empty?: {
|
|
43
|
+
when: (data: NonNullable<T>) => boolean;
|
|
44
|
+
render: NonNullable<QueryContentProps<T>['children']>;
|
|
45
|
+
};
|
|
37
46
|
/** State from useQuery, or any compatible query observer. */
|
|
38
47
|
query: Pick<QueryState<T>, 'data' | 'status' | 'error'>;
|
|
39
48
|
/**
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD;;;;;GAKG;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,6DAA6D;IAC7D,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAA;IACvD;;;;OAIG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,CAAA;IACzD,uFAAuF;IACvF,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,qFAAqF;IACrF,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACrB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,GAAG,CAAC,OAAO,CAAA;CACxC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,QAAQ,EAA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2
|
"name": "@molecule/app-query-solid",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Solid 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-solid",
|
|
6
6
|
"type": "module",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
53
53
|
"@molecule/app-i18n": "1.2.2",
|
|
54
54
|
"@molecule/app-icons": "1.0.4",
|
|
55
|
-
"@molecule/app-query": "1.
|
|
56
|
-
"@molecule/app-query-memory": "1.0
|
|
57
|
-
"@molecule/app-query-tanstack": "1.0
|
|
55
|
+
"@molecule/app-query": "1.3.1",
|
|
56
|
+
"@molecule/app-query-memory": "1.1.0",
|
|
57
|
+
"@molecule/app-query-tanstack": "1.1.0",
|
|
58
58
|
"@molecule/app-solid": "3.7.1",
|
|
59
59
|
"@molecule/app-ui": "1.4.0",
|
|
60
60
|
"@molecule/app-ui-solid": "1.1.4",
|