@molecule/app-query-angular 1.3.0 → 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 +122 -15
- package/dist/query-content.component.d.ts +39 -8
- package/dist/query-content.component.d.ts.map +1 -1
- package/dist/query-content.component.js +74 -10
- package/dist/query-content.component.js.map +1 -1
- package/dist/types.d.ts +40 -4
- 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.
|
|
@@ -626,7 +626,8 @@ interface QueryContentProps<T> {
|
|
|
626
626
|
/**
|
|
627
627
|
* One optional empty branch, exclusive with children. The pure predicate reads the
|
|
628
628
|
* loaded document (an array or an application-owned envelope); render selects the
|
|
629
|
-
* current view's message and recovery action.
|
|
629
|
+
* current view's message and recovery action. A previous key's empty document uses
|
|
630
|
+
* pending/error instead. Omit it to keep empty arrays as data.
|
|
630
631
|
*/
|
|
631
632
|
empty?: {
|
|
632
633
|
when: (data: NonNullable<T>) => boolean
|
|
@@ -634,7 +635,13 @@ interface QueryContentProps<T> {
|
|
|
634
635
|
}
|
|
635
636
|
|
|
636
637
|
/** State from useQuery, or any compatible query observer. */
|
|
637
|
-
query: Pick<QueryState<T>, 'data' | 'status' | 'error'>
|
|
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
|
|
638
645
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
639
646
|
children: TemplateRef<QueryContentContext<T>> | null
|
|
640
647
|
/** Initial idle/loading content. Render a status template, never a fake item or action. */
|
|
@@ -646,6 +653,23 @@ interface QueryContentProps<T> {
|
|
|
646
653
|
}
|
|
647
654
|
```
|
|
648
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
|
+
|
|
649
673
|
#### `IntentPrefetchProps`
|
|
650
674
|
|
|
651
675
|
The handlers {@link intentPrefetchProps} returns, named after the DOM events
|
|
@@ -682,6 +706,23 @@ type ListQueryInputs<Values> = {
|
|
|
682
706
|
}
|
|
683
707
|
```
|
|
684
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
|
+
|
|
685
726
|
### Classes
|
|
686
727
|
|
|
687
728
|
#### `QueryContent`
|
|
@@ -692,17 +733,24 @@ swallow an early click. Cached data remains mounted during refresh, including
|
|
|
692
733
|
a failed refresh. Status fallbacks belong outside the list or record
|
|
693
734
|
container rendered by `children`, and so does a refresh line; the default
|
|
694
735
|
fallbacks render nothing.
|
|
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"`).
|
|
695
742
|
|
|
696
743
|
The templates receive the render arguments as template context: `children`
|
|
697
|
-
gets the document as `$implicit` and `a0` (`let-data`),
|
|
698
|
-
|
|
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.
|
|
699
747
|
|
|
700
748
|
```typescript
|
|
701
749
|
@Component({
|
|
702
750
|
selector: 'mol-query-content',
|
|
703
751
|
standalone: true,
|
|
704
752
|
template: '<ng-container #outlet></ng-container>',
|
|
705
|
-
inputs: ['query', 'pending', 'missing', 'children', 'error', 'empty'],
|
|
753
|
+
inputs: ['query', 'pending', 'missing', 'children', 'error', 'empty', 'recordKey', 'getRecordId'],
|
|
706
754
|
host: {
|
|
707
755
|
'data-parity-unwrap': '',
|
|
708
756
|
style: 'display: contents',
|
|
@@ -711,8 +759,21 @@ error value (`let-error`), and `pending`/`missing` render without a context.
|
|
|
711
759
|
export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
712
760
|
/** State from useQuery, or any compatible query observer. */
|
|
713
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
|
|
714
773
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
715
|
-
children:
|
|
774
|
+
children:
|
|
775
|
+
QueryContentProps<T>['children'] | QueryRecordContentProps<T, string | number>['children'] =
|
|
776
|
+
null
|
|
716
777
|
/** Initial idle/loading content. Render a status template, never a fake item or action. */
|
|
717
778
|
pending: TemplateRef<unknown> | null = null
|
|
718
779
|
/** Content for a loaded null record. Null is distinct from an unfinished request. */
|
|
@@ -731,6 +792,10 @@ export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
731
792
|
private readonly observer = signal<QueryContentProps<T>['query']>(this.query)
|
|
732
793
|
/** The template currently mounted. */
|
|
733
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
|
|
734
799
|
/** The context object the mounted view reads (updated in place). */
|
|
735
800
|
private readonly context: Record<string, unknown> = {}
|
|
736
801
|
/** The mounted branch view, when a template is showing. */
|
|
@@ -749,6 +814,7 @@ export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
749
814
|
void query?.data
|
|
750
815
|
void query?.status
|
|
751
816
|
void query?.error
|
|
817
|
+
void query?.isPreviousData
|
|
752
818
|
untracked(() => {
|
|
753
819
|
this.update()
|
|
754
820
|
this.changeDetector.markForCheck()
|
|
@@ -762,7 +828,15 @@ export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
762
828
|
*/
|
|
763
829
|
private branch(): Branch {
|
|
764
830
|
const query = this.query
|
|
765
|
-
|
|
831
|
+
const identified = typeof this.getRecordId === 'function'
|
|
832
|
+
if (
|
|
833
|
+
query?.data === undefined ||
|
|
834
|
+
(query.isPreviousData &&
|
|
835
|
+
(identified ||
|
|
836
|
+
this.recordKey !== undefined ||
|
|
837
|
+
query.data === null ||
|
|
838
|
+
this.empty?.when(query.data)))
|
|
839
|
+
) {
|
|
766
840
|
return query?.status === 'error' && this.error
|
|
767
841
|
? {
|
|
768
842
|
template: this.error,
|
|
@@ -771,11 +845,38 @@ export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
771
845
|
: { template: this.pending ?? null, context: {} }
|
|
772
846
|
}
|
|
773
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
|
+
}
|
|
774
860
|
if (this.empty?.when(query.data))
|
|
775
861
|
return { template: this.empty.render, context: { $implicit: query.data, a0: query.data } }
|
|
776
862
|
return { template: this.children, context: { $implicit: query.data, a0: query.data } }
|
|
777
863
|
}
|
|
778
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
|
+
|
|
779
880
|
/**
|
|
780
881
|
* Follows a replaced `query` prop: the reactivity effect subscribes to the
|
|
781
882
|
* new observer's own signals on its next run.
|
|
@@ -794,16 +895,22 @@ export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
794
895
|
}
|
|
795
896
|
|
|
796
897
|
/**
|
|
797
|
-
* Shows the branch the current query state describes: a different template
|
|
798
|
-
* replaces the mounted view, and a changed
|
|
799
|
-
* 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.
|
|
800
903
|
*/
|
|
801
904
|
private update(): void {
|
|
802
905
|
const next = this.branch()
|
|
803
|
-
|
|
906
|
+
const id = this.recordIdentity()
|
|
907
|
+
const recordChanged = this.recordKey !== this.mountedRecord || id !== this.mountedId
|
|
908
|
+
if (next.template !== this.current || recordChanged) {
|
|
804
909
|
this.view?.destroy()
|
|
805
910
|
this.view = undefined
|
|
806
911
|
this.current = next.template
|
|
912
|
+
this.mountedRecord = this.recordKey
|
|
913
|
+
this.mountedId = id
|
|
807
914
|
if (next.template) this.view = this.outlet.createEmbeddedView(next.template, this.context)
|
|
808
915
|
}
|
|
809
916
|
for (const key of Object.keys(this.context)) {
|
|
@@ -962,7 +1069,7 @@ from `@molecule/app-angular` in a control that is re-created per record) to keep
|
|
|
962
1069
|
their displayed label and queued clicks on the same state while a save finishes.
|
|
963
1070
|
|
|
964
1071
|
```typescript
|
|
965
|
-
function useQuery<T>(options:
|
|
1072
|
+
function useQuery<T>(options: QueryOptionsInput<T>): UseQueryResult<T>
|
|
966
1073
|
```
|
|
967
1074
|
|
|
968
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
|
|
@@ -16,16 +16,34 @@ import * as i0 from "@angular/core";
|
|
|
16
16
|
* a failed refresh. Status fallbacks belong outside the list or record
|
|
17
17
|
* container rendered by `children`, and so does a refresh line; the default
|
|
18
18
|
* fallbacks render nothing.
|
|
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"`).
|
|
19
25
|
*
|
|
20
26
|
* The templates receive the render arguments as template context: `children`
|
|
21
|
-
* gets the document as `$implicit` and `a0` (`let-data`),
|
|
22
|
-
*
|
|
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.
|
|
23
30
|
*/
|
|
24
31
|
export declare class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
25
32
|
/** State from useQuery, or any compatible query observer. */
|
|
26
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;
|
|
27
45
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
28
|
-
children:
|
|
46
|
+
children: QueryContentProps<T>['children'] | QueryRecordContentProps<T, string | number>['children'];
|
|
29
47
|
/** Initial idle/loading content. Render a status template, never a fake item or action. */
|
|
30
48
|
pending: TemplateRef<unknown> | null;
|
|
31
49
|
/** Content for a loaded null record. Null is distinct from an unfinished request. */
|
|
@@ -42,6 +60,10 @@ export declare class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
42
60
|
private readonly observer;
|
|
43
61
|
/** The template currently mounted. */
|
|
44
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;
|
|
45
67
|
/** The context object the mounted view reads (updated in place). */
|
|
46
68
|
private readonly context;
|
|
47
69
|
/** The mounted branch view, when a template is showing. */
|
|
@@ -52,6 +74,13 @@ export declare class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
52
74
|
* @returns The template and its context, or nothing.
|
|
53
75
|
*/
|
|
54
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;
|
|
55
84
|
/**
|
|
56
85
|
* Follows a replaced `query` prop: the reactivity effect subscribes to the
|
|
57
86
|
* new observer's own signals on its next run.
|
|
@@ -64,12 +93,14 @@ export declare class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
64
93
|
*/
|
|
65
94
|
ngDoCheck(): void;
|
|
66
95
|
/**
|
|
67
|
-
* Shows the branch the current query state describes: a different template
|
|
68
|
-
* replaces the mounted view, and a changed
|
|
69
|
-
* 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.
|
|
70
101
|
*/
|
|
71
102
|
private update;
|
|
72
103
|
static ɵfac: i0.ɵɵFactoryDeclaration<QueryContent<any>, never>;
|
|
73
|
-
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>;
|
|
74
105
|
}
|
|
75
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,iBAAiB,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAY;IACxD;;;OAGG;IACH,WAAW,EAAE,uBAAuB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,aAAa,CAAC,GAAG,SAAS,CAAY;IAC/F,kFAAkF;IAClF,QAAQ,EACN,iBAAiB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,uBAAuB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,UAAU,CAAC,CACtF;IACN,2FAA2F;IAC3F,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI,CAAO;IAC3C,qFAAqF;IACrF,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI,CAAO;IAC3C,yEAAyE;IACzE,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAY;IAChD,6EAA6E;IAC7E,KAAK,EAAE,WAAW,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAO;IAE1D,uCAAuC;IAEvC,OAAO,CAAC,MAAM,CAAmB;IACjC,sEAAsE;IACtE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA4B;IAC3D,yFAAyF;IACzF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoD;IAC7E,sCAAsC;IACtC,OAAO,CAAC,OAAO,CAAoC;IACnD,mFAAmF;IACnF,OAAO,CAAC,aAAa,CAAqC;IAC1D,sFAAsF;IACtF,OAAO,CAAC,SAAS,CAAyC;IAC1D,oEAAoE;IACpE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;IACtD,2DAA2D;IAC3D,OAAO,CAAC,IAAI,CAAC,CAA0B;;IAuBvC;;;OAGG;IACH,OAAO,CAAC,MAAM;IAoCd;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAStB;;;OAGG;IACH,WAAW,IAAI,IAAI;IAInB;;;;OAIG;IACH,SAAS,IAAI,IAAI;IAIjB;;;;;;OAMG;IACH,OAAO,CAAC,MAAM;yCAjJH,YAAY;2CAAZ,YAAY;CAmKxB"}
|
|
@@ -16,14 +16,32 @@ const _c0 = ["outlet"];
|
|
|
16
16
|
* a failed refresh. Status fallbacks belong outside the list or record
|
|
17
17
|
* container rendered by `children`, and so does a refresh line; the default
|
|
18
18
|
* fallbacks render nothing.
|
|
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"`).
|
|
19
25
|
*
|
|
20
26
|
* The templates receive the render arguments as template context: `children`
|
|
21
|
-
* gets the document as `$implicit` and `a0` (`let-data`),
|
|
22
|
-
*
|
|
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.
|
|
23
30
|
*/
|
|
24
31
|
export class QueryContent {
|
|
25
32
|
/** State from useQuery, or any compatible query observer. */
|
|
26
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;
|
|
27
45
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
28
46
|
children = null;
|
|
29
47
|
/** Initial idle/loading content. Render a status template, never a fake item or action. */
|
|
@@ -43,6 +61,10 @@ export class QueryContent {
|
|
|
43
61
|
...(ngDevMode ? [{ debugName: "observer" }] : /* istanbul ignore next */ []));
|
|
44
62
|
/** The template currently mounted. */
|
|
45
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;
|
|
46
68
|
/** The context object the mounted view reads (updated in place). */
|
|
47
69
|
context = {};
|
|
48
70
|
/** The mounted branch view, when a template is showing. */
|
|
@@ -60,6 +82,7 @@ export class QueryContent {
|
|
|
60
82
|
void query?.data;
|
|
61
83
|
void query?.status;
|
|
62
84
|
void query?.error;
|
|
85
|
+
void query?.isPreviousData;
|
|
63
86
|
untracked(() => {
|
|
64
87
|
this.update();
|
|
65
88
|
this.changeDetector.markForCheck();
|
|
@@ -72,7 +95,13 @@ export class QueryContent {
|
|
|
72
95
|
*/
|
|
73
96
|
branch() {
|
|
74
97
|
const query = this.query;
|
|
75
|
-
|
|
98
|
+
const identified = typeof this.getRecordId === 'function';
|
|
99
|
+
if (query?.data === undefined ||
|
|
100
|
+
(query.isPreviousData &&
|
|
101
|
+
(identified ||
|
|
102
|
+
this.recordKey !== undefined ||
|
|
103
|
+
query.data === null ||
|
|
104
|
+
this.empty?.when(query.data)))) {
|
|
76
105
|
return query?.status === 'error' && this.error
|
|
77
106
|
? {
|
|
78
107
|
template: this.error,
|
|
@@ -82,10 +111,39 @@ export class QueryContent {
|
|
|
82
111
|
}
|
|
83
112
|
if (query.data === null)
|
|
84
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
|
+
}
|
|
85
127
|
if (this.empty?.when(query.data))
|
|
86
128
|
return { template: this.empty.render, context: { $implicit: query.data, a0: query.data } };
|
|
87
129
|
return { template: this.children, context: { $implicit: query.data, a0: query.data } };
|
|
88
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
|
+
}
|
|
89
147
|
/**
|
|
90
148
|
* Follows a replaced `query` prop: the reactivity effect subscribes to the
|
|
91
149
|
* new observer's own signals on its next run.
|
|
@@ -102,16 +160,22 @@ export class QueryContent {
|
|
|
102
160
|
this.update();
|
|
103
161
|
}
|
|
104
162
|
/**
|
|
105
|
-
* Shows the branch the current query state describes: a different template
|
|
106
|
-
* replaces the mounted view, and a changed
|
|
107
|
-
* 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.
|
|
108
168
|
*/
|
|
109
169
|
update() {
|
|
110
170
|
const next = this.branch();
|
|
111
|
-
|
|
171
|
+
const id = this.recordIdentity();
|
|
172
|
+
const recordChanged = this.recordKey !== this.mountedRecord || id !== this.mountedId;
|
|
173
|
+
if (next.template !== this.current || recordChanged) {
|
|
112
174
|
this.view?.destroy();
|
|
113
175
|
this.view = undefined;
|
|
114
176
|
this.current = next.template;
|
|
177
|
+
this.mountedRecord = this.recordKey;
|
|
178
|
+
this.mountedId = id;
|
|
115
179
|
if (next.template)
|
|
116
180
|
this.view = this.outlet.createEmbeddedView(next.template, this.context);
|
|
117
181
|
}
|
|
@@ -128,7 +192,7 @@ export class QueryContent {
|
|
|
128
192
|
} if (rf & 2) {
|
|
129
193
|
let _t;
|
|
130
194
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.outlet = _t.first);
|
|
131
|
-
} }, 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) {
|
|
132
196
|
i0.ɵɵdomElementContainer(0, null, 0);
|
|
133
197
|
} }, encapsulation: 2 });
|
|
134
198
|
}
|
|
@@ -138,7 +202,7 @@ export class QueryContent {
|
|
|
138
202
|
selector: 'mol-query-content',
|
|
139
203
|
standalone: true,
|
|
140
204
|
template: '<ng-container #outlet></ng-container>',
|
|
141
|
-
inputs: ['query', 'pending', 'missing', 'children', 'error', 'empty'],
|
|
205
|
+
inputs: ['query', 'pending', 'missing', 'children', 'error', 'empty', 'recordKey', 'getRecordId'],
|
|
142
206
|
host: {
|
|
143
207
|
'data-parity-unwrap': '',
|
|
144
208
|
style: 'display: contents',
|
|
@@ -148,5 +212,5 @@ export class QueryContent {
|
|
|
148
212
|
type: ViewChild,
|
|
149
213
|
args: ['outlet', { read: ViewContainerRef, static: true }]
|
|
150
214
|
}] }); })();
|
|
151
|
-
(() => { (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 }); })();
|
|
152
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;IAChD,6EAA6E;IAC7E,KAAK,GAAiD,IAAI,CAAA;IAE1D,uCAAuC;IAE/B,MAAM,CAAmB;IACjC,sEAAsE;IACrD,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAA;IAC3D,yFAAyF;IACxE,QAAQ,GAAG,MAAM,CAAgC,IAAI,CAAC,KAAK;iFAAC,CAAA;IAC7E,sCAAsC;IAC9B,OAAO,GAAgC,IAAI,CAAA;IACnD,mFAAmF;IAC3E,aAAa,GAA4B,SAAS,CAAA;IAC1D,sFA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ist/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`).
|
|
@@ -59,14 +72,21 @@ export interface QueryContentProps<T> {
|
|
|
59
72
|
/**
|
|
60
73
|
* One optional empty branch, exclusive with children. The pure predicate reads the
|
|
61
74
|
* loaded document (an array or an application-owned envelope); render selects the
|
|
62
|
-
* current view's message and recovery action.
|
|
75
|
+
* current view's message and recovery action. A previous key's empty document uses
|
|
76
|
+
* pending/error instead. Omit it to keep empty arrays as data.
|
|
63
77
|
*/
|
|
64
78
|
empty?: {
|
|
65
79
|
when: (data: NonNullable<T>) => boolean;
|
|
66
80
|
render: NonNullable<QueryContentProps<T>['children']>;
|
|
67
81
|
};
|
|
68
82
|
/** State from useQuery, or any compatible query observer. */
|
|
69
|
-
query: Pick<QueryState<T>, 'data' | 'status' | 'error'>;
|
|
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;
|
|
70
90
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
71
91
|
children: TemplateRef<QueryContentContext<T>> | null;
|
|
72
92
|
/** Initial idle/loading content. Render a status template, never a fake item or action. */
|
|
@@ -76,4 +96,20 @@ export interface QueryContentProps<T> {
|
|
|
76
96
|
/** A failed initial read. Cached data stays visible if its refresh fails. */
|
|
77
97
|
error?: TemplateRef<QueryContentErrorContext> | null;
|
|
78
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 {};
|
|
79
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,C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,CAClF,iBAAiB,CAAC,CAAC,CAAC,EACpB,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,E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AAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,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",
|