@molecule/app-query-angular 1.3.1 → 1.4.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 +114 -13
- package/dist/query-content.component.d.ts +38 -8
- package/dist/query-content.component.d.ts.map +1 -1
- package/dist/query-content.component.js +71 -10
- package/dist/query-content.component.js.map +1 -1
- package/dist/types.d.ts +37 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/use-query.d.ts +2 -20
- package/dist/use-query.d.ts.map +1 -1
- package/dist/use-query.js.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-18T20:06:03.950Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-query-angular
|
|
@@ -503,7 +503,7 @@ interface QueryResource<T, Create = Partial<T>, Update = Partial<T>> {
|
|
|
503
503
|
): QueryOptions<Page>
|
|
504
504
|
/**
|
|
505
505
|
* `useQuery` options for one record, or null while `id` is not known yet (`useQuery(null)`
|
|
506
|
-
* observes nothing). A missing record resolves to null
|
|
506
|
+
* observes nothing). An empty ID is also unknown. A missing record resolves to null.
|
|
507
507
|
*/
|
|
508
508
|
detail(viewer: string, id: string | null | undefined): QueryOptions<T | null> | null
|
|
509
509
|
/** Creates a record, shows it in the cache and refreshes the lists on screen. */
|
|
@@ -515,7 +515,7 @@ interface QueryResource<T, Create = Partial<T>, Update = Partial<T>> {
|
|
|
515
515
|
/**
|
|
516
516
|
* Switches a flag the API models as a sub-path: `POST path/id/action` turns it on and
|
|
517
517
|
* `DELETE path/id/action` turns it off. Resolves with the saved record, so it is the `commit`
|
|
518
|
-
* of `useOptimisticValue`.
|
|
518
|
+
* of `useOptimisticValue`. Rejects an absent or empty record ID before sending a request.
|
|
519
519
|
* The saved detail is published before tracked lists finish refreshing; this promise waits
|
|
520
520
|
* for those refreshes. Render the shared controller's value and let it queue inverse clicks
|
|
521
521
|
* during that interval. A page-local busy guard can drop a click on the newly changed label.
|
|
@@ -636,6 +636,12 @@ interface QueryContentProps<T> {
|
|
|
636
636
|
|
|
637
637
|
/** State from useQuery, or any compatible query observer. */
|
|
638
638
|
query: Pick<QueryState<T>, 'data' | 'status' | 'error' | 'isPreviousData'>
|
|
639
|
+
/**
|
|
640
|
+
* Stable identity of the requested record, including the principal when needed.
|
|
641
|
+
* Use for record-specific state such as an edit form. Changing the key remounts the
|
|
642
|
+
* loaded branch and excludes data retained from a previous query key.
|
|
643
|
+
*/
|
|
644
|
+
recordKey?: PropertyKey
|
|
639
645
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
640
646
|
children: TemplateRef<QueryContentContext<T>> | null
|
|
641
647
|
/** Initial idle/loading content. Render a status template, never a fake item or action. */
|
|
@@ -647,6 +653,23 @@ interface QueryContentProps<T> {
|
|
|
647
653
|
}
|
|
648
654
|
```
|
|
649
655
|
|
|
656
|
+
#### `QueryRecordContentProps`
|
|
657
|
+
|
|
658
|
+
A loaded document and its verified identity, required to render the
|
|
659
|
+
record's actions.
|
|
660
|
+
|
|
661
|
+
```typescript
|
|
662
|
+
interface QueryRecordContentProps<T, Id extends string | number> extends Omit<
|
|
663
|
+
QueryContentProps<T>,
|
|
664
|
+
'children'
|
|
665
|
+
> {
|
|
666
|
+
/** Extracts the ID from the loaded document. Null, undefined and an empty string are pending. */
|
|
667
|
+
getRecordId: (data: QueryContentContext<T>['$implicit']) => Id | null | undefined
|
|
668
|
+
/** Receives the ID with the document. The branch remounts when the ID or recordKey changes. */
|
|
669
|
+
children: TemplateRef<QueryRecordContentContext<T, NoInfer<Id>>> | null
|
|
670
|
+
}
|
|
671
|
+
```
|
|
672
|
+
|
|
650
673
|
#### `IntentPrefetchProps`
|
|
651
674
|
|
|
652
675
|
The handlers {@link intentPrefetchProps} returns, named after the DOM events
|
|
@@ -683,6 +706,23 @@ type ListQueryInputs<Values> = {
|
|
|
683
706
|
}
|
|
684
707
|
```
|
|
685
708
|
|
|
709
|
+
#### `QueryOptionsInput`
|
|
710
|
+
|
|
711
|
+
What `useQuery` observes: the options for one key or `null` (nothing), as plain values or a signal of them.
|
|
712
|
+
|
|
713
|
+
```typescript
|
|
714
|
+
type QueryOptionsInput<T> = QueryOptions<T> | null | Signal<QueryOptions<T> | null>
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
#### `QueryContentSlots`
|
|
718
|
+
|
|
719
|
+
The content {@link QueryContentProps} renders for each state: the loaded-data branch, the
|
|
720
|
+
pending and missing content and the error renderer (the templates the component takes as inputs).
|
|
721
|
+
|
|
722
|
+
```typescript
|
|
723
|
+
type QueryContentSlots<T> = Pick<QueryContentProps<T>, 'children' | 'pending' | 'missing' | 'error'>
|
|
724
|
+
```
|
|
725
|
+
|
|
686
726
|
### Classes
|
|
687
727
|
|
|
688
728
|
#### `QueryContent`
|
|
@@ -694,17 +734,23 @@ a failed refresh. Status fallbacks belong outside the list or record
|
|
|
694
734
|
container rendered by `children`, and so does a refresh line; the default
|
|
695
735
|
fallbacks render nothing.
|
|
696
736
|
A previous key's empty or missing document renders pending/error until the current key answers.
|
|
737
|
+
Pass `recordKey` for an edit form: the form mounts with the current record and
|
|
738
|
+
resets when its identity changes, including a switch to a record already in cache.
|
|
739
|
+
Pass `getRecordId` to bind actions to the loaded document's identity: the branch
|
|
740
|
+
stays pending without a nonempty ID and receives the ID as template context `a1`
|
|
741
|
+
(`let-id="a1"`).
|
|
697
742
|
|
|
698
743
|
The templates receive the render arguments as template context: `children`
|
|
699
|
-
gets the document as `$implicit` and `a0` (`let-data`),
|
|
700
|
-
|
|
744
|
+
gets the document as `$implicit` and `a0` (`let-data`), the record-bound branch
|
|
745
|
+
also gets the ID as `a1` (`let-id`), `error` gets the error value
|
|
746
|
+
(`let-error`), and `pending`/`missing` render without a context.
|
|
701
747
|
|
|
702
748
|
```typescript
|
|
703
749
|
@Component({
|
|
704
750
|
selector: 'mol-query-content',
|
|
705
751
|
standalone: true,
|
|
706
752
|
template: '<ng-container #outlet></ng-container>',
|
|
707
|
-
inputs: ['query', 'pending', 'missing', 'children', 'error', 'empty'],
|
|
753
|
+
inputs: ['query', 'pending', 'missing', 'children', 'error', 'empty', 'recordKey', 'getRecordId'],
|
|
708
754
|
host: {
|
|
709
755
|
'data-parity-unwrap': '',
|
|
710
756
|
style: 'display: contents',
|
|
@@ -713,8 +759,21 @@ error value (`let-error`), and `pending`/`missing` render without a context.
|
|
|
713
759
|
export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
714
760
|
/** State from useQuery, or any compatible query observer. */
|
|
715
761
|
query: QueryContentProps<T>['query'] = { data: undefined, status: 'idle', error: undefined }
|
|
762
|
+
/**
|
|
763
|
+
* Stable identity of the requested record, including the principal when needed.
|
|
764
|
+
* Use for record-specific state such as an edit form. Changing the key remounts the
|
|
765
|
+
* loaded branch and excludes data retained from a previous query key.
|
|
766
|
+
*/
|
|
767
|
+
recordKey: QueryContentProps<T>['recordKey'] = undefined
|
|
768
|
+
/**
|
|
769
|
+
* Extracts the ID from the loaded document. Null, undefined and an empty string
|
|
770
|
+
* are pending. With it set, `children` receives the ID as template context `a1`.
|
|
771
|
+
*/
|
|
772
|
+
getRecordId: QueryRecordContentProps<T, string | number>['getRecordId'] | undefined = undefined
|
|
716
773
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
717
|
-
children:
|
|
774
|
+
children:
|
|
775
|
+
QueryContentProps<T>['children'] | QueryRecordContentProps<T, string | number>['children'] =
|
|
776
|
+
null
|
|
718
777
|
/** Initial idle/loading content. Render a status template, never a fake item or action. */
|
|
719
778
|
pending: TemplateRef<unknown> | null = null
|
|
720
779
|
/** Content for a loaded null record. Null is distinct from an unfinished request. */
|
|
@@ -733,6 +792,10 @@ export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
733
792
|
private readonly observer = signal<QueryContentProps<T>['query']>(this.query)
|
|
734
793
|
/** The template currently mounted. */
|
|
735
794
|
private current: TemplateRef<unknown> | null = null
|
|
795
|
+
/** The record the mounted branch belongs to (`recordKey` when it last mounted). */
|
|
796
|
+
private mountedRecord: PropertyKey | undefined = undefined
|
|
797
|
+
/** The document identity the mounted branch belongs to, when `getRecordId` is set. */
|
|
798
|
+
private mountedId: string | number | undefined = undefined
|
|
736
799
|
/** The context object the mounted view reads (updated in place). */
|
|
737
800
|
private readonly context: Record<string, unknown> = {}
|
|
738
801
|
/** The mounted branch view, when a template is showing. */
|
|
@@ -765,9 +828,14 @@ export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
765
828
|
*/
|
|
766
829
|
private branch(): Branch {
|
|
767
830
|
const query = this.query
|
|
831
|
+
const identified = typeof this.getRecordId === 'function'
|
|
768
832
|
if (
|
|
769
833
|
query?.data === undefined ||
|
|
770
|
-
(query.isPreviousData &&
|
|
834
|
+
(query.isPreviousData &&
|
|
835
|
+
(identified ||
|
|
836
|
+
this.recordKey !== undefined ||
|
|
837
|
+
query.data === null ||
|
|
838
|
+
this.empty?.when(query.data)))
|
|
771
839
|
) {
|
|
772
840
|
return query?.status === 'error' && this.error
|
|
773
841
|
? {
|
|
@@ -777,11 +845,38 @@ export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
777
845
|
: { template: this.pending ?? null, context: {} }
|
|
778
846
|
}
|
|
779
847
|
if (query.data === null) return { template: this.missing ?? null, context: {} }
|
|
848
|
+
const identifiedTemplate = identified ? this.children : null
|
|
849
|
+
if (identified) {
|
|
850
|
+
const id = this.recordIdentity()
|
|
851
|
+
// No identity means no record-specific action: the branch stays pending.
|
|
852
|
+
if (id === undefined) return { template: this.pending ?? null, context: {} }
|
|
853
|
+
if (this.empty?.when(query.data))
|
|
854
|
+
return { template: this.empty.render, context: { $implicit: query.data, a0: query.data } }
|
|
855
|
+
return {
|
|
856
|
+
template: identifiedTemplate,
|
|
857
|
+
context: { $implicit: query.data, a0: query.data, a1: id },
|
|
858
|
+
}
|
|
859
|
+
}
|
|
780
860
|
if (this.empty?.when(query.data))
|
|
781
861
|
return { template: this.empty.render, context: { $implicit: query.data, a0: query.data } }
|
|
782
862
|
return { template: this.children, context: { $implicit: query.data, a0: query.data } }
|
|
783
863
|
}
|
|
784
864
|
|
|
865
|
+
/**
|
|
866
|
+
* The loaded document's verified identity, when `getRecordId` is set: absent,
|
|
867
|
+
* null and an empty string are no identity.
|
|
868
|
+
*
|
|
869
|
+
* @returns The nonempty ID, or `undefined` without one.
|
|
870
|
+
*/
|
|
871
|
+
private recordIdentity(): string | number | undefined {
|
|
872
|
+
const getRecordId = this.getRecordId
|
|
873
|
+
if (typeof getRecordId !== 'function') return undefined
|
|
874
|
+
const data = this.query?.data
|
|
875
|
+
if (data === undefined || data === null) return undefined
|
|
876
|
+
const id = getRecordId(data as NonNullable<T>)
|
|
877
|
+
return id == null || id === '' ? undefined : id
|
|
878
|
+
}
|
|
879
|
+
|
|
785
880
|
/**
|
|
786
881
|
* Follows a replaced `query` prop: the reactivity effect subscribes to the
|
|
787
882
|
* new observer's own signals on its next run.
|
|
@@ -800,16 +895,22 @@ export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
800
895
|
}
|
|
801
896
|
|
|
802
897
|
/**
|
|
803
|
-
* Shows the branch the current query state describes: a different template
|
|
804
|
-
* replaces the mounted view, and a changed
|
|
805
|
-
* the context the mounted view reads.
|
|
898
|
+
* Shows the branch the current query state describes: a different template —
|
|
899
|
+
* or a changed record identity — replaces the mounted view, and a changed
|
|
900
|
+
* document (or error) is written into the context the mounted view reads.
|
|
901
|
+
* Replacing the view on a `recordKey` or ID change mounts the record's own
|
|
902
|
+
* state (an edit form) fresh, the way React's keyed Fragment does.
|
|
806
903
|
*/
|
|
807
904
|
private update(): void {
|
|
808
905
|
const next = this.branch()
|
|
809
|
-
|
|
906
|
+
const id = this.recordIdentity()
|
|
907
|
+
const recordChanged = this.recordKey !== this.mountedRecord || id !== this.mountedId
|
|
908
|
+
if (next.template !== this.current || recordChanged) {
|
|
810
909
|
this.view?.destroy()
|
|
811
910
|
this.view = undefined
|
|
812
911
|
this.current = next.template
|
|
912
|
+
this.mountedRecord = this.recordKey
|
|
913
|
+
this.mountedId = id
|
|
813
914
|
if (next.template) this.view = this.outlet.createEmbeddedView(next.template, this.context)
|
|
814
915
|
}
|
|
815
916
|
for (const key of Object.keys(this.context)) {
|
|
@@ -968,7 +1069,7 @@ from `@molecule/app-angular` in a control that is re-created per record) to keep
|
|
|
968
1069
|
their displayed label and queued clicks on the same state while a save finishes.
|
|
969
1070
|
|
|
970
1071
|
```typescript
|
|
971
|
-
function useQuery<T>(options:
|
|
1072
|
+
function useQuery<T>(options: QueryOptionsInput<T>): UseQueryResult<T>
|
|
972
1073
|
```
|
|
973
1074
|
|
|
974
1075
|
- `options` — Key, fetch, freshness, and optionally `principal` with `keepPreviousData`; or `null`; or a signal of either (the options a component recomputes on its own state — every change is followed on the same instance).
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
import { type DoCheck, type OnChanges, type TemplateRef } from '@angular/core';
|
|
10
|
-
import type {
|
|
10
|
+
import type { QueryContentErrorContext, QueryContentProps, QueryRecordContentProps } from './types.js';
|
|
11
11
|
import * as i0 from "@angular/core";
|
|
12
12
|
/**
|
|
13
13
|
* The loaded-data branch receives a non-null document. Pending, failed initial
|
|
@@ -17,16 +17,33 @@ import * as i0 from "@angular/core";
|
|
|
17
17
|
* container rendered by `children`, and so does a refresh line; the default
|
|
18
18
|
* fallbacks render nothing.
|
|
19
19
|
* A previous key's empty or missing document renders pending/error until the current key answers.
|
|
20
|
+
* Pass `recordKey` for an edit form: the form mounts with the current record and
|
|
21
|
+
* resets when its identity changes, including a switch to a record already in cache.
|
|
22
|
+
* Pass `getRecordId` to bind actions to the loaded document's identity: the branch
|
|
23
|
+
* stays pending without a nonempty ID and receives the ID as template context `a1`
|
|
24
|
+
* (`let-id="a1"`).
|
|
20
25
|
*
|
|
21
26
|
* The templates receive the render arguments as template context: `children`
|
|
22
|
-
* gets the document as `$implicit` and `a0` (`let-data`),
|
|
23
|
-
*
|
|
27
|
+
* gets the document as `$implicit` and `a0` (`let-data`), the record-bound branch
|
|
28
|
+
* also gets the ID as `a1` (`let-id`), `error` gets the error value
|
|
29
|
+
* (`let-error`), and `pending`/`missing` render without a context.
|
|
24
30
|
*/
|
|
25
31
|
export declare class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
26
32
|
/** State from useQuery, or any compatible query observer. */
|
|
27
33
|
query: QueryContentProps<T>['query'];
|
|
34
|
+
/**
|
|
35
|
+
* Stable identity of the requested record, including the principal when needed.
|
|
36
|
+
* Use for record-specific state such as an edit form. Changing the key remounts the
|
|
37
|
+
* loaded branch and excludes data retained from a previous query key.
|
|
38
|
+
*/
|
|
39
|
+
recordKey: QueryContentProps<T>['recordKey'];
|
|
40
|
+
/**
|
|
41
|
+
* Extracts the ID from the loaded document. Null, undefined and an empty string
|
|
42
|
+
* are pending. With it set, `children` receives the ID as template context `a1`.
|
|
43
|
+
*/
|
|
44
|
+
getRecordId: QueryRecordContentProps<T, string | number>['getRecordId'] | undefined;
|
|
28
45
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
29
|
-
children:
|
|
46
|
+
children: QueryContentProps<T>['children'] | QueryRecordContentProps<T, string | number>['children'];
|
|
30
47
|
/** Initial idle/loading content. Render a status template, never a fake item or action. */
|
|
31
48
|
pending: TemplateRef<unknown> | null;
|
|
32
49
|
/** Content for a loaded null record. Null is distinct from an unfinished request. */
|
|
@@ -43,6 +60,10 @@ export declare class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
43
60
|
private readonly observer;
|
|
44
61
|
/** The template currently mounted. */
|
|
45
62
|
private current;
|
|
63
|
+
/** The record the mounted branch belongs to (`recordKey` when it last mounted). */
|
|
64
|
+
private mountedRecord;
|
|
65
|
+
/** The document identity the mounted branch belongs to, when `getRecordId` is set. */
|
|
66
|
+
private mountedId;
|
|
46
67
|
/** The context object the mounted view reads (updated in place). */
|
|
47
68
|
private readonly context;
|
|
48
69
|
/** The mounted branch view, when a template is showing. */
|
|
@@ -53,6 +74,13 @@ export declare class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
53
74
|
* @returns The template and its context, or nothing.
|
|
54
75
|
*/
|
|
55
76
|
private branch;
|
|
77
|
+
/**
|
|
78
|
+
* The loaded document's verified identity, when `getRecordId` is set: absent,
|
|
79
|
+
* null and an empty string are no identity.
|
|
80
|
+
*
|
|
81
|
+
* @returns The nonempty ID, or `undefined` without one.
|
|
82
|
+
*/
|
|
83
|
+
private recordIdentity;
|
|
56
84
|
/**
|
|
57
85
|
* Follows a replaced `query` prop: the reactivity effect subscribes to the
|
|
58
86
|
* new observer's own signals on its next run.
|
|
@@ -65,12 +93,14 @@ export declare class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
65
93
|
*/
|
|
66
94
|
ngDoCheck(): void;
|
|
67
95
|
/**
|
|
68
|
-
* Shows the branch the current query state describes: a different template
|
|
69
|
-
* replaces the mounted view, and a changed
|
|
70
|
-
* the context the mounted view reads.
|
|
96
|
+
* Shows the branch the current query state describes: a different template —
|
|
97
|
+
* or a changed record identity — replaces the mounted view, and a changed
|
|
98
|
+
* document (or error) is written into the context the mounted view reads.
|
|
99
|
+
* Replacing the view on a `recordKey` or ID change mounts the record's own
|
|
100
|
+
* state (an edit form) fresh, the way React's keyed Fragment does.
|
|
71
101
|
*/
|
|
72
102
|
private update;
|
|
73
103
|
static ɵfac: i0.ɵɵFactoryDeclaration<QueryContent<any>, never>;
|
|
74
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<QueryContent<any>, "mol-query-content", never, { "query": { "alias": "query"; "required": false; }; "pending": { "alias": "pending"; "required": false; }; "missing": { "alias": "missing"; "required": false; }; "children": { "alias": "children"; "required": false; }; "error": { "alias": "error"; "required": false; }; "empty": { "alias": "empty"; "required": false; }; }, {}, never, never, true, never>;
|
|
104
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<QueryContent<any>, "mol-query-content", never, { "query": { "alias": "query"; "required": false; }; "pending": { "alias": "pending"; "required": false; }; "missing": { "alias": "missing"; "required": false; }; "children": { "alias": "children"; "required": false; }; "error": { "alias": "error"; "required": false; }; "empty": { "alias": "empty"; "required": false; }; "recordKey": { "alias": "recordKey"; "required": false; }; "getRecordId": { "alias": "getRecordId"; "required": false; }; }, {}, never, never, true, never>;
|
|
75
105
|
}
|
|
76
106
|
//# sourceMappingURL=query-content.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-content.component.d.ts","sourceRoot":"","sources":["../src/query-content.component.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAGL,KAAK,OAAO,EAIZ,KAAK,SAAS,EAEd,KAAK,WAAW,EAIjB,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"query-content.component.d.ts","sourceRoot":"","sources":["../src/query-content.component.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAGL,KAAK,OAAO,EAIZ,KAAK,SAAS,EAEd,KAAK,WAAW,EAIjB,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,YAAY,CAAA;;AAQnB;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAUa,YAAY,CAAC,CAAC,GAAG,OAAO,CAAE,YAAW,OAAO,EAAE,SAAS;IAClE,6DAA6D;IAC7D,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAwD;IAC5F;;;;OAIG;IACH,SAAS,EAAE,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OAMG;IACH,OAAO,CAAC,MAAM;yCAjJH,YAAY;2CAAZ,YAAY;CAmKxB"}
|
|
@@ -17,14 +17,31 @@ const _c0 = ["outlet"];
|
|
|
17
17
|
* container rendered by `children`, and so does a refresh line; the default
|
|
18
18
|
* fallbacks render nothing.
|
|
19
19
|
* A previous key's empty or missing document renders pending/error until the current key answers.
|
|
20
|
+
* Pass `recordKey` for an edit form: the form mounts with the current record and
|
|
21
|
+
* resets when its identity changes, including a switch to a record already in cache.
|
|
22
|
+
* Pass `getRecordId` to bind actions to the loaded document's identity: the branch
|
|
23
|
+
* stays pending without a nonempty ID and receives the ID as template context `a1`
|
|
24
|
+
* (`let-id="a1"`).
|
|
20
25
|
*
|
|
21
26
|
* The templates receive the render arguments as template context: `children`
|
|
22
|
-
* gets the document as `$implicit` and `a0` (`let-data`),
|
|
23
|
-
*
|
|
27
|
+
* gets the document as `$implicit` and `a0` (`let-data`), the record-bound branch
|
|
28
|
+
* also gets the ID as `a1` (`let-id`), `error` gets the error value
|
|
29
|
+
* (`let-error`), and `pending`/`missing` render without a context.
|
|
24
30
|
*/
|
|
25
31
|
export class QueryContent {
|
|
26
32
|
/** State from useQuery, or any compatible query observer. */
|
|
27
33
|
query = { data: undefined, status: 'idle', error: undefined };
|
|
34
|
+
/**
|
|
35
|
+
* Stable identity of the requested record, including the principal when needed.
|
|
36
|
+
* Use for record-specific state such as an edit form. Changing the key remounts the
|
|
37
|
+
* loaded branch and excludes data retained from a previous query key.
|
|
38
|
+
*/
|
|
39
|
+
recordKey = undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Extracts the ID from the loaded document. Null, undefined and an empty string
|
|
42
|
+
* are pending. With it set, `children` receives the ID as template context `a1`.
|
|
43
|
+
*/
|
|
44
|
+
getRecordId = undefined;
|
|
28
45
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
29
46
|
children = null;
|
|
30
47
|
/** Initial idle/loading content. Render a status template, never a fake item or action. */
|
|
@@ -44,6 +61,10 @@ export class QueryContent {
|
|
|
44
61
|
...(ngDevMode ? [{ debugName: "observer" }] : /* istanbul ignore next */ []));
|
|
45
62
|
/** The template currently mounted. */
|
|
46
63
|
current = null;
|
|
64
|
+
/** The record the mounted branch belongs to (`recordKey` when it last mounted). */
|
|
65
|
+
mountedRecord = undefined;
|
|
66
|
+
/** The document identity the mounted branch belongs to, when `getRecordId` is set. */
|
|
67
|
+
mountedId = undefined;
|
|
47
68
|
/** The context object the mounted view reads (updated in place). */
|
|
48
69
|
context = {};
|
|
49
70
|
/** The mounted branch view, when a template is showing. */
|
|
@@ -74,8 +95,13 @@ export class QueryContent {
|
|
|
74
95
|
*/
|
|
75
96
|
branch() {
|
|
76
97
|
const query = this.query;
|
|
98
|
+
const identified = typeof this.getRecordId === 'function';
|
|
77
99
|
if (query?.data === undefined ||
|
|
78
|
-
(query.isPreviousData &&
|
|
100
|
+
(query.isPreviousData &&
|
|
101
|
+
(identified ||
|
|
102
|
+
this.recordKey !== undefined ||
|
|
103
|
+
query.data === null ||
|
|
104
|
+
this.empty?.when(query.data)))) {
|
|
79
105
|
return query?.status === 'error' && this.error
|
|
80
106
|
? {
|
|
81
107
|
template: this.error,
|
|
@@ -85,10 +111,39 @@ export class QueryContent {
|
|
|
85
111
|
}
|
|
86
112
|
if (query.data === null)
|
|
87
113
|
return { template: this.missing ?? null, context: {} };
|
|
114
|
+
const identifiedTemplate = identified ? this.children : null;
|
|
115
|
+
if (identified) {
|
|
116
|
+
const id = this.recordIdentity();
|
|
117
|
+
// No identity means no record-specific action: the branch stays pending.
|
|
118
|
+
if (id === undefined)
|
|
119
|
+
return { template: this.pending ?? null, context: {} };
|
|
120
|
+
if (this.empty?.when(query.data))
|
|
121
|
+
return { template: this.empty.render, context: { $implicit: query.data, a0: query.data } };
|
|
122
|
+
return {
|
|
123
|
+
template: identifiedTemplate,
|
|
124
|
+
context: { $implicit: query.data, a0: query.data, a1: id },
|
|
125
|
+
};
|
|
126
|
+
}
|
|
88
127
|
if (this.empty?.when(query.data))
|
|
89
128
|
return { template: this.empty.render, context: { $implicit: query.data, a0: query.data } };
|
|
90
129
|
return { template: this.children, context: { $implicit: query.data, a0: query.data } };
|
|
91
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* The loaded document's verified identity, when `getRecordId` is set: absent,
|
|
133
|
+
* null and an empty string are no identity.
|
|
134
|
+
*
|
|
135
|
+
* @returns The nonempty ID, or `undefined` without one.
|
|
136
|
+
*/
|
|
137
|
+
recordIdentity() {
|
|
138
|
+
const getRecordId = this.getRecordId;
|
|
139
|
+
if (typeof getRecordId !== 'function')
|
|
140
|
+
return undefined;
|
|
141
|
+
const data = this.query?.data;
|
|
142
|
+
if (data === undefined || data === null)
|
|
143
|
+
return undefined;
|
|
144
|
+
const id = getRecordId(data);
|
|
145
|
+
return id == null || id === '' ? undefined : id;
|
|
146
|
+
}
|
|
92
147
|
/**
|
|
93
148
|
* Follows a replaced `query` prop: the reactivity effect subscribes to the
|
|
94
149
|
* new observer's own signals on its next run.
|
|
@@ -105,16 +160,22 @@ export class QueryContent {
|
|
|
105
160
|
this.update();
|
|
106
161
|
}
|
|
107
162
|
/**
|
|
108
|
-
* Shows the branch the current query state describes: a different template
|
|
109
|
-
* replaces the mounted view, and a changed
|
|
110
|
-
* the context the mounted view reads.
|
|
163
|
+
* Shows the branch the current query state describes: a different template —
|
|
164
|
+
* or a changed record identity — replaces the mounted view, and a changed
|
|
165
|
+
* document (or error) is written into the context the mounted view reads.
|
|
166
|
+
* Replacing the view on a `recordKey` or ID change mounts the record's own
|
|
167
|
+
* state (an edit form) fresh, the way React's keyed Fragment does.
|
|
111
168
|
*/
|
|
112
169
|
update() {
|
|
113
170
|
const next = this.branch();
|
|
114
|
-
|
|
171
|
+
const id = this.recordIdentity();
|
|
172
|
+
const recordChanged = this.recordKey !== this.mountedRecord || id !== this.mountedId;
|
|
173
|
+
if (next.template !== this.current || recordChanged) {
|
|
115
174
|
this.view?.destroy();
|
|
116
175
|
this.view = undefined;
|
|
117
176
|
this.current = next.template;
|
|
177
|
+
this.mountedRecord = this.recordKey;
|
|
178
|
+
this.mountedId = id;
|
|
118
179
|
if (next.template)
|
|
119
180
|
this.view = this.outlet.createEmbeddedView(next.template, this.context);
|
|
120
181
|
}
|
|
@@ -131,7 +192,7 @@ export class QueryContent {
|
|
|
131
192
|
} if (rf & 2) {
|
|
132
193
|
let _t;
|
|
133
194
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.outlet = _t.first);
|
|
134
|
-
} }, hostAttrs: ["data-parity-unwrap", "", 2, "display", "contents"], inputs: { query: "query", pending: "pending", missing: "missing", children: "children", error: "error", empty: "empty" }, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 0, consts: [["outlet", ""]], template: function QueryContent_Template(rf, ctx) { if (rf & 1) {
|
|
195
|
+
} }, hostAttrs: ["data-parity-unwrap", "", 2, "display", "contents"], inputs: { query: "query", pending: "pending", missing: "missing", children: "children", error: "error", empty: "empty", recordKey: "recordKey", getRecordId: "getRecordId" }, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 0, consts: [["outlet", ""]], template: function QueryContent_Template(rf, ctx) { if (rf & 1) {
|
|
135
196
|
i0.ɵɵdomElementContainer(0, null, 0);
|
|
136
197
|
} }, encapsulation: 2 });
|
|
137
198
|
}
|
|
@@ -141,7 +202,7 @@ export class QueryContent {
|
|
|
141
202
|
selector: 'mol-query-content',
|
|
142
203
|
standalone: true,
|
|
143
204
|
template: '<ng-container #outlet></ng-container>',
|
|
144
|
-
inputs: ['query', 'pending', 'missing', 'children', 'error', 'empty'],
|
|
205
|
+
inputs: ['query', 'pending', 'missing', 'children', 'error', 'empty', 'recordKey', 'getRecordId'],
|
|
145
206
|
host: {
|
|
146
207
|
'data-parity-unwrap': '',
|
|
147
208
|
style: 'display: contents',
|
|
@@ -151,5 +212,5 @@ export class QueryContent {
|
|
|
151
212
|
type: ViewChild,
|
|
152
213
|
args: ['outlet', { read: ViewContainerRef, static: true }]
|
|
153
214
|
}] }); })();
|
|
154
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(QueryContent, { className: "QueryContent", filePath: "query-content.component.ts", lineNumber:
|
|
215
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(QueryContent, { className: "QueryContent", filePath: "query-content.component.ts", lineNumber: 65 }); })();
|
|
155
216
|
//# sourceMappingURL=query-content.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-content.component.js","sourceRoot":"","sources":["../src/query-content.component.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,iBAAiB,EACjB,SAAS,EAET,MAAM,EAEN,MAAM,EAEN,MAAM,EAEN,SAAS,EACT,SAAS,EACT,gBAAgB,GACjB,MAAM,eAAe,CAAA;;;
|
|
1
|
+
{"version":3,"file":"query-content.component.js","sourceRoot":"","sources":["../src/query-content.component.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,iBAAiB,EACjB,SAAS,EAET,MAAM,EAEN,MAAM,EAEN,MAAM,EAEN,SAAS,EACT,SAAS,EACT,gBAAgB,GACjB,MAAM,eAAe,CAAA;;;AActB;;;;;;;;;;;;;;;;;;GAkBG;AAWH,MAAM,OAAO,YAAY;IACvB,6DAA6D;IAC7D,KAAK,GAAkC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;IAC5F;;;;OAIG;IACH,SAAS,GAAsC,SAAS,CAAA;IACxD;;;OAGG;IACH,WAAW,GAA2E,SAAS,CAAA;IAC/F,kFAAkF;IAClF,QAAQ,GAEN,IAAI,CAAA;IACN,2FAA2F;IAC3F,OAAO,GAAgC,IAAI,CAAA;IAC3C,qFAAqF;IACrF,OAAO,GAAgC,IAAI,CAAA;IAC3C,yEAAyE;IACzE,KAAK,GAAkC,SAAS,CAAA;IACh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C;gBACjD,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,CAAC;gBACjG,IAAI,EAAE;oBACJ,oBAAoB,EAAE,EAAE;oBACxB,KAAK,EAAE,mBAAmB;iBAC3B;aACF;;kBA6BE,SAAS;mBAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE;;kFA5BlD,YAAY"}
|
package/dist/types.d.ts
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
* Angular `TemplateRef`s.
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
|
-
import type { TemplateRef } from '@angular/core';
|
|
8
|
-
import type { QueryState } from '@molecule/app-query';
|
|
7
|
+
import type { Signal, TemplateRef } from '@angular/core';
|
|
8
|
+
import type { QueryOptions, QueryState } from '@molecule/app-query';
|
|
9
|
+
/** What `useQuery` observes: the options for one key or `null` (nothing), as plain values or a signal of them. */
|
|
10
|
+
export type QueryOptionsInput<T> = QueryOptions<T> | null | Signal<QueryOptions<T> | null>;
|
|
9
11
|
/**
|
|
10
12
|
* A mounted query's state and its explicit cache and refresh actions. The state
|
|
11
13
|
* fields read as plain values at read time (each reads the observer's current
|
|
@@ -44,6 +46,17 @@ export interface QueryContentContext<T> {
|
|
|
44
46
|
/** The same document, as the first render argument. */
|
|
45
47
|
a0: NonNullable<T>;
|
|
46
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* The context a record-bound children template receives: the loaded document
|
|
51
|
+
* as `$implicit`/`a0`, and its verified identity as `a1`.
|
|
52
|
+
*
|
|
53
|
+
* @template T - The document's shape.
|
|
54
|
+
* @template Id - The identity's type.
|
|
55
|
+
*/
|
|
56
|
+
interface QueryRecordContentContext<T, Id extends string | number> extends QueryContentContext<T> {
|
|
57
|
+
/** The document's verified, nonempty identity (the second render argument). */
|
|
58
|
+
a1: Id;
|
|
59
|
+
}
|
|
47
60
|
/**
|
|
48
61
|
* The context an error template receives: the failed read's error value, as
|
|
49
62
|
* `$implicit` and as the render function's first argument (`a0`).
|
|
@@ -68,6 +81,12 @@ export interface QueryContentProps<T> {
|
|
|
68
81
|
};
|
|
69
82
|
/** State from useQuery, or any compatible query observer. */
|
|
70
83
|
query: Pick<QueryState<T>, 'data' | 'status' | 'error' | 'isPreviousData'>;
|
|
84
|
+
/**
|
|
85
|
+
* Stable identity of the requested record, including the principal when needed.
|
|
86
|
+
* Use for record-specific state such as an edit form. Changing the key remounts the
|
|
87
|
+
* loaded branch and excludes data retained from a previous query key.
|
|
88
|
+
*/
|
|
89
|
+
recordKey?: PropertyKey;
|
|
71
90
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
72
91
|
children: TemplateRef<QueryContentContext<T>> | null;
|
|
73
92
|
/** Initial idle/loading content. Render a status template, never a fake item or action. */
|
|
@@ -77,4 +96,20 @@ export interface QueryContentProps<T> {
|
|
|
77
96
|
/** A failed initial read. Cached data stays visible if its refresh fails. */
|
|
78
97
|
error?: TemplateRef<QueryContentErrorContext> | null;
|
|
79
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* A loaded document and its verified identity, required to render the
|
|
101
|
+
* record's actions.
|
|
102
|
+
*/
|
|
103
|
+
export interface QueryRecordContentProps<T, Id extends string | number> extends Omit<QueryContentProps<T>, 'children'> {
|
|
104
|
+
/** Extracts the ID from the loaded document. Null, undefined and an empty string are pending. */
|
|
105
|
+
getRecordId: (data: QueryContentContext<T>['$implicit']) => Id | null | undefined;
|
|
106
|
+
/** Receives the ID with the document. The branch remounts when the ID or recordKey changes. */
|
|
107
|
+
children: TemplateRef<QueryRecordContentContext<T, NoInfer<Id>>> | null;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The content {@link QueryContentProps} renders for each state: the loaded-data branch, the
|
|
111
|
+
* pending and missing content and the error renderer (the templates the component takes as inputs).
|
|
112
|
+
*/
|
|
113
|
+
export type QueryContentSlots<T> = Pick<QueryContentProps<T>, 'children' | 'pending' | 'missing' | 'error'>;
|
|
114
|
+
export {};
|
|
80
115
|
//# sourceMappingURL=types.d.ts.map
|
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,WAAW,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEnE,kHAAkH;AAClH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;AAE1F;;;;;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;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACpC,yDAAyD;IACzD,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,CAAA;IACzB,uDAAuD;IACvD,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC,CAAA;CACnB;AAED;;;;;;GAMG;AAC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pB,UAAU,CACX;IACC,iGAAiG;IACjG,WAAW,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,IAAI,GAAG,SAAS,CAAA;IACjF,+FAA+F;IAC/F,QAAQ,EAAE,WAAW,CAAC,yBAAyB,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;CACxE;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"}
|
package/dist/use-query.d.ts
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Observe one document from the shared cache — the Angular counterpart of
|
|
3
|
-
* `useQuery` in `@molecule/app-query-react`.
|
|
4
|
-
*
|
|
5
|
-
* Call it in an injection context (a component field initializer or
|
|
6
|
-
* constructor). The options may be a plain object or a signal of one: a
|
|
7
|
-
* component that derives its options from an `input()` or `computed()` passes
|
|
8
|
-
* the signal, and a changed key (or principal, or `keepPreviousData` flag) is
|
|
9
|
-
* followed on the SAME hook instance, the way React's re-render follows a new
|
|
10
|
-
* options object.
|
|
11
|
-
*
|
|
12
|
-
* @module
|
|
13
|
-
*/
|
|
14
|
-
import { type Signal } from '@angular/core';
|
|
15
|
-
import type { QueryOptions } from '@molecule/app-query';
|
|
16
|
-
import type { UseQueryResult } from './types.js';
|
|
17
|
-
/** The options a query may arrive in: plain values, or a signal of them. */
|
|
18
|
-
type QueryOptionsSource<T> = QueryOptions<T> | null | Signal<QueryOptions<T> | null>;
|
|
1
|
+
import type { QueryOptionsInput, UseQueryResult } from './types.js';
|
|
19
2
|
/**
|
|
20
3
|
* The document for the options' key, kept current: cached data is read on the
|
|
21
4
|
* very first render (so a warmed page never flashes a loading state), a stale
|
|
@@ -67,6 +50,5 @@ type QueryOptionsSource<T> = QueryOptions<T> | null | Signal<QueryOptions<T> | n
|
|
|
67
50
|
* hook cannot tell a route change from a principal switch, so it refuses
|
|
68
51
|
* rather than risk showing one principal's document to another.
|
|
69
52
|
*/
|
|
70
|
-
export declare function useQuery<T>(options:
|
|
71
|
-
export {};
|
|
53
|
+
export declare function useQuery<T>(options: QueryOptionsInput<T>): UseQueryResult<T>;
|
|
72
54
|
//# sourceMappingURL=use-query.d.ts.map
|
package/dist/use-query.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-query.d.ts","sourceRoot":"","sources":["../src/use-query.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-query.d.ts","sourceRoot":"","sources":["../src/use-query.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAuBnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CA4M5E"}
|
package/dist/use-query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-query.js","sourceRoot":"","sources":["../src/use-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"use-query.js","sourceRoot":"","sources":["../src/use-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGvF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA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AAI,CAAA;IACvD,IAAI,YAAY,EAAE,CAAC;QACjB,MAAM,CAAC,GAAG,EAAE;YACV,MAAM,IAAI,GAAG,YAAY,EAAE,CAAA;YAC3B,SAAS,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE;QAChC,WAAW,EAAE,EAAE,CAAA;QACf,WAAW,GAAG,IAAI,CAAA;IACpB,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-query-angular",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Angular 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-angular",
|
|
6
6
|
"type": "module",
|
|
@@ -56,15 +56,15 @@
|
|
|
56
56
|
"@angular/compiler-cli": "22.2.3",
|
|
57
57
|
"@angular/core": "22.2.3",
|
|
58
58
|
"@angular/platform-browser": "22.2.3",
|
|
59
|
-
"@molecule/app-angular": "3.7.
|
|
59
|
+
"@molecule/app-angular": "3.7.2",
|
|
60
60
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
61
61
|
"@molecule/app-i18n": "1.2.2",
|
|
62
62
|
"@molecule/app-icons": "1.0.4",
|
|
63
|
-
"@molecule/app-query": "1.3.
|
|
63
|
+
"@molecule/app-query": "1.3.3",
|
|
64
64
|
"@molecule/app-query-memory": "1.1.0",
|
|
65
65
|
"@molecule/app-query-tanstack": "1.1.0",
|
|
66
66
|
"@molecule/app-ui": "1.4.0",
|
|
67
|
-
"@molecule/app-ui-angular": "1.2.
|
|
67
|
+
"@molecule/app-ui-angular": "1.2.1",
|
|
68
68
|
"@types/node": "26.6.5",
|
|
69
69
|
"jsdom": "30.1.3",
|
|
70
70
|
"rxjs": "7.8.2",
|