@molecule/app-query-angular 1.3.1 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +127 -18
- package/dist/query-content.component.d.ts +45 -10
- package/dist/query-content.component.d.ts.map +1 -1
- package/dist/query-content.component.js +87 -17
- 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 +7 -6
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-23T14:53:39.904Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-query-angular
|
|
@@ -410,7 +410,7 @@ removeFromPage adapter; no row or total property is guessed.
|
|
|
410
410
|
## Installation
|
|
411
411
|
|
|
412
412
|
```bash
|
|
413
|
-
npm install @molecule/app-query-angular @angular/common @angular/core @angular/platform-browser @molecule/app-query
|
|
413
|
+
npm install @molecule/app-query-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-query
|
|
414
414
|
```
|
|
415
415
|
|
|
416
416
|
## API
|
|
@@ -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,27 +734,43 @@ 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,
|
|
752
|
+
hostDirectives: [MolPlacement],
|
|
706
753
|
template: '<ng-container #outlet></ng-container>',
|
|
707
|
-
inputs: ['query', 'pending', 'missing', 'children', 'error', 'empty'],
|
|
708
|
-
host: {
|
|
709
|
-
'data-parity-unwrap': '',
|
|
710
|
-
style: 'display: contents',
|
|
711
|
-
},
|
|
754
|
+
inputs: ['query', 'pending', 'missing', 'children', 'error', 'empty', 'recordKey', 'getRecordId'],
|
|
712
755
|
})
|
|
713
756
|
export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
714
757
|
/** State from useQuery, or any compatible query observer. */
|
|
715
758
|
query: QueryContentProps<T>['query'] = { data: undefined, status: 'idle', error: undefined }
|
|
759
|
+
/**
|
|
760
|
+
* Stable identity of the requested record, including the principal when needed.
|
|
761
|
+
* Use for record-specific state such as an edit form. Changing the key remounts the
|
|
762
|
+
* loaded branch and excludes data retained from a previous query key.
|
|
763
|
+
*/
|
|
764
|
+
recordKey: QueryContentProps<T>['recordKey'] = undefined
|
|
765
|
+
/**
|
|
766
|
+
* Extracts the ID from the loaded document. Null, undefined and an empty string
|
|
767
|
+
* are pending. With it set, `children` receives the ID as template context `a1`.
|
|
768
|
+
*/
|
|
769
|
+
getRecordId: QueryRecordContentProps<T, string | number>['getRecordId'] | undefined = undefined
|
|
716
770
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
717
|
-
children:
|
|
771
|
+
children:
|
|
772
|
+
QueryContentProps<T>['children'] | QueryRecordContentProps<T, string | number>['children'] =
|
|
773
|
+
null
|
|
718
774
|
/** Initial idle/loading content. Render a status template, never a fake item or action. */
|
|
719
775
|
pending: TemplateRef<unknown> | null = null
|
|
720
776
|
/** Content for a loaded null record. Null is distinct from an unfinished request. */
|
|
@@ -733,12 +789,25 @@ export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
733
789
|
private readonly observer = signal<QueryContentProps<T>['query']>(this.query)
|
|
734
790
|
/** The template currently mounted. */
|
|
735
791
|
private current: TemplateRef<unknown> | null = null
|
|
792
|
+
/** The record the mounted branch belongs to (`recordKey` when it last mounted). */
|
|
793
|
+
private mountedRecord: PropertyKey | undefined = undefined
|
|
794
|
+
/** The document identity the mounted branch belongs to, when `getRecordId` is set. */
|
|
795
|
+
private mountedId: string | number | undefined = undefined
|
|
736
796
|
/** The context object the mounted view reads (updated in place). */
|
|
737
797
|
private readonly context: Record<string, unknown> = {}
|
|
738
798
|
/** The mounted branch view, when a template is showing. */
|
|
739
799
|
private view?: EmbeddedViewRef<unknown>
|
|
740
800
|
|
|
801
|
+
/** The component's host element (React renders the branch and nothing of its own). */
|
|
802
|
+
private readonly host: ElementRef<HTMLElement> = inject(ElementRef)
|
|
803
|
+
|
|
741
804
|
constructor() {
|
|
805
|
+
// The branch renders in front of the host's place and the host leaves the page, so the
|
|
806
|
+
// DOM is exactly the branch's own (React returns the branch element directly).
|
|
807
|
+
usePlacement(() => {
|
|
808
|
+
placeContentBefore(this.host.nativeElement, this.host.nativeElement)
|
|
809
|
+
setElementPresent(this.host.nativeElement, false)
|
|
810
|
+
})
|
|
742
811
|
// A `useQuery` result exposes its state through getters that read the
|
|
743
812
|
// observer's own signals. React re-renders a `QueryContent`'s parent on
|
|
744
813
|
// every state change; Angular only re-checks a view something marked, and
|
|
@@ -765,9 +834,14 @@ export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
765
834
|
*/
|
|
766
835
|
private branch(): Branch {
|
|
767
836
|
const query = this.query
|
|
837
|
+
const identified = typeof this.getRecordId === 'function'
|
|
768
838
|
if (
|
|
769
839
|
query?.data === undefined ||
|
|
770
|
-
(query.isPreviousData &&
|
|
840
|
+
(query.isPreviousData &&
|
|
841
|
+
(identified ||
|
|
842
|
+
this.recordKey !== undefined ||
|
|
843
|
+
query.data === null ||
|
|
844
|
+
this.empty?.when(query.data)))
|
|
771
845
|
) {
|
|
772
846
|
return query?.status === 'error' && this.error
|
|
773
847
|
? {
|
|
@@ -777,11 +851,38 @@ export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
777
851
|
: { template: this.pending ?? null, context: {} }
|
|
778
852
|
}
|
|
779
853
|
if (query.data === null) return { template: this.missing ?? null, context: {} }
|
|
854
|
+
const identifiedTemplate = identified ? this.children : null
|
|
855
|
+
if (identified) {
|
|
856
|
+
const id = this.recordIdentity()
|
|
857
|
+
// No identity means no record-specific action: the branch stays pending.
|
|
858
|
+
if (id === undefined) return { template: this.pending ?? null, context: {} }
|
|
859
|
+
if (this.empty?.when(query.data))
|
|
860
|
+
return { template: this.empty.render, context: { $implicit: query.data, a0: query.data } }
|
|
861
|
+
return {
|
|
862
|
+
template: identifiedTemplate,
|
|
863
|
+
context: { $implicit: query.data, a0: query.data, a1: id },
|
|
864
|
+
}
|
|
865
|
+
}
|
|
780
866
|
if (this.empty?.when(query.data))
|
|
781
867
|
return { template: this.empty.render, context: { $implicit: query.data, a0: query.data } }
|
|
782
868
|
return { template: this.children, context: { $implicit: query.data, a0: query.data } }
|
|
783
869
|
}
|
|
784
870
|
|
|
871
|
+
/**
|
|
872
|
+
* The loaded document's verified identity, when `getRecordId` is set: absent,
|
|
873
|
+
* null and an empty string are no identity.
|
|
874
|
+
*
|
|
875
|
+
* @returns The nonempty ID, or `undefined` without one.
|
|
876
|
+
*/
|
|
877
|
+
private recordIdentity(): string | number | undefined {
|
|
878
|
+
const getRecordId = this.getRecordId
|
|
879
|
+
if (typeof getRecordId !== 'function') return undefined
|
|
880
|
+
const data = this.query?.data
|
|
881
|
+
if (data === undefined || data === null) return undefined
|
|
882
|
+
const id = getRecordId(data as NonNullable<T>)
|
|
883
|
+
return id == null || id === '' ? undefined : id
|
|
884
|
+
}
|
|
885
|
+
|
|
785
886
|
/**
|
|
786
887
|
* Follows a replaced `query` prop: the reactivity effect subscribes to the
|
|
787
888
|
* new observer's own signals on its next run.
|
|
@@ -800,16 +901,22 @@ export class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
800
901
|
}
|
|
801
902
|
|
|
802
903
|
/**
|
|
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.
|
|
904
|
+
* Shows the branch the current query state describes: a different template —
|
|
905
|
+
* or a changed record identity — replaces the mounted view, and a changed
|
|
906
|
+
* document (or error) is written into the context the mounted view reads.
|
|
907
|
+
* Replacing the view on a `recordKey` or ID change mounts the record's own
|
|
908
|
+
* state (an edit form) fresh, the way React's keyed Fragment does.
|
|
806
909
|
*/
|
|
807
910
|
private update(): void {
|
|
808
911
|
const next = this.branch()
|
|
809
|
-
|
|
912
|
+
const id = this.recordIdentity()
|
|
913
|
+
const recordChanged = this.recordKey !== this.mountedRecord || id !== this.mountedId
|
|
914
|
+
if (next.template !== this.current || recordChanged) {
|
|
810
915
|
this.view?.destroy()
|
|
811
916
|
this.view = undefined
|
|
812
917
|
this.current = next.template
|
|
918
|
+
this.mountedRecord = this.recordKey
|
|
919
|
+
this.mountedId = id
|
|
813
920
|
if (next.template) this.view = this.outlet.createEmbeddedView(next.template, this.context)
|
|
814
921
|
}
|
|
815
922
|
for (const key of Object.keys(this.context)) {
|
|
@@ -968,7 +1075,7 @@ from `@molecule/app-angular` in a control that is re-created per record) to keep
|
|
|
968
1075
|
their displayed label and queued clicks on the same state while a save finishes.
|
|
969
1076
|
|
|
970
1077
|
```typescript
|
|
971
|
-
function useQuery<T>(options:
|
|
1078
|
+
function useQuery<T>(options: QueryOptionsInput<T>): UseQueryResult<T>
|
|
972
1079
|
```
|
|
973
1080
|
|
|
974
1081
|
- `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).
|
|
@@ -984,6 +1091,7 @@ Peer dependencies:
|
|
|
984
1091
|
- `@angular/common` ^22.0.0
|
|
985
1092
|
- `@angular/core` ^22.0.0
|
|
986
1093
|
- `@angular/platform-browser` ^22.0.0
|
|
1094
|
+
- `@molecule/app-angular` ^3.13.0
|
|
987
1095
|
- `@molecule/app-query` ^1.2.0
|
|
988
1096
|
|
|
989
1097
|
### Runtime Dependencies
|
|
@@ -991,6 +1099,7 @@ Peer dependencies:
|
|
|
991
1099
|
- `@angular/common`
|
|
992
1100
|
- `@angular/core`
|
|
993
1101
|
- `@angular/platform-browser`
|
|
1102
|
+
- `@molecule/app-angular`
|
|
994
1103
|
- `@molecule/app-query`
|
|
995
1104
|
|
|
996
1105
|
- **`useQuery` reads the cache synchronously on the first render.** A
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
* Render resource-dependent content only after its document exists — the
|
|
3
3
|
* Angular counterpart of `QueryContent` in `@molecule/app-query-react`, with
|
|
4
4
|
* the node-valued props as `TemplateRef`s. The component is headless: it owns
|
|
5
|
-
* no translations and no styling, and
|
|
6
|
-
* host
|
|
5
|
+
* no translations and no styling, and renders the chosen branch in front of the
|
|
6
|
+
* host's place and takes its own element out of the DOM
|
|
7
|
+
* (`placeContentBefore` + `setElementPresent`), so the DOM is exactly the
|
|
8
|
+
* branch's own.
|
|
7
9
|
* @module
|
|
8
10
|
*/
|
|
9
11
|
import { type DoCheck, type OnChanges, type TemplateRef } from '@angular/core';
|
|
10
|
-
import type {
|
|
12
|
+
import type { QueryContentErrorContext, QueryContentProps, QueryRecordContentProps } from './types.js';
|
|
11
13
|
import * as i0 from "@angular/core";
|
|
14
|
+
import * as i1 from "@molecule/app-angular";
|
|
12
15
|
/**
|
|
13
16
|
* The loaded-data branch receives a non-null document. Pending, failed initial
|
|
14
17
|
* reads and missing records never mount that branch, so its actions cannot
|
|
@@ -17,16 +20,33 @@ import * as i0 from "@angular/core";
|
|
|
17
20
|
* container rendered by `children`, and so does a refresh line; the default
|
|
18
21
|
* fallbacks render nothing.
|
|
19
22
|
* A previous key's empty or missing document renders pending/error until the current key answers.
|
|
23
|
+
* Pass `recordKey` for an edit form: the form mounts with the current record and
|
|
24
|
+
* resets when its identity changes, including a switch to a record already in cache.
|
|
25
|
+
* Pass `getRecordId` to bind actions to the loaded document's identity: the branch
|
|
26
|
+
* stays pending without a nonempty ID and receives the ID as template context `a1`
|
|
27
|
+
* (`let-id="a1"`).
|
|
20
28
|
*
|
|
21
29
|
* The templates receive the render arguments as template context: `children`
|
|
22
|
-
* gets the document as `$implicit` and `a0` (`let-data`),
|
|
23
|
-
*
|
|
30
|
+
* gets the document as `$implicit` and `a0` (`let-data`), the record-bound branch
|
|
31
|
+
* also gets the ID as `a1` (`let-id`), `error` gets the error value
|
|
32
|
+
* (`let-error`), and `pending`/`missing` render without a context.
|
|
24
33
|
*/
|
|
25
34
|
export declare class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
26
35
|
/** State from useQuery, or any compatible query observer. */
|
|
27
36
|
query: QueryContentProps<T>['query'];
|
|
37
|
+
/**
|
|
38
|
+
* Stable identity of the requested record, including the principal when needed.
|
|
39
|
+
* Use for record-specific state such as an edit form. Changing the key remounts the
|
|
40
|
+
* loaded branch and excludes data retained from a previous query key.
|
|
41
|
+
*/
|
|
42
|
+
recordKey: QueryContentProps<T>['recordKey'];
|
|
43
|
+
/**
|
|
44
|
+
* Extracts the ID from the loaded document. Null, undefined and an empty string
|
|
45
|
+
* are pending. With it set, `children` receives the ID as template context `a1`.
|
|
46
|
+
*/
|
|
47
|
+
getRecordId: QueryRecordContentProps<T, string | number>['getRecordId'] | undefined;
|
|
28
48
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
29
|
-
children:
|
|
49
|
+
children: QueryContentProps<T>['children'] | QueryRecordContentProps<T, string | number>['children'];
|
|
30
50
|
/** Initial idle/loading content. Render a status template, never a fake item or action. */
|
|
31
51
|
pending: TemplateRef<unknown> | null;
|
|
32
52
|
/** Content for a loaded null record. Null is distinct from an unfinished request. */
|
|
@@ -43,16 +63,29 @@ export declare class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
43
63
|
private readonly observer;
|
|
44
64
|
/** The template currently mounted. */
|
|
45
65
|
private current;
|
|
66
|
+
/** The record the mounted branch belongs to (`recordKey` when it last mounted). */
|
|
67
|
+
private mountedRecord;
|
|
68
|
+
/** The document identity the mounted branch belongs to, when `getRecordId` is set. */
|
|
69
|
+
private mountedId;
|
|
46
70
|
/** The context object the mounted view reads (updated in place). */
|
|
47
71
|
private readonly context;
|
|
48
72
|
/** The mounted branch view, when a template is showing. */
|
|
49
73
|
private view?;
|
|
74
|
+
/** The component's host element (React renders the branch and nothing of its own). */
|
|
75
|
+
private readonly host;
|
|
50
76
|
constructor();
|
|
51
77
|
/**
|
|
52
78
|
* The branch the current query state shows.
|
|
53
79
|
* @returns The template and its context, or nothing.
|
|
54
80
|
*/
|
|
55
81
|
private branch;
|
|
82
|
+
/**
|
|
83
|
+
* The loaded document's verified identity, when `getRecordId` is set: absent,
|
|
84
|
+
* null and an empty string are no identity.
|
|
85
|
+
*
|
|
86
|
+
* @returns The nonempty ID, or `undefined` without one.
|
|
87
|
+
*/
|
|
88
|
+
private recordIdentity;
|
|
56
89
|
/**
|
|
57
90
|
* Follows a replaced `query` prop: the reactivity effect subscribes to the
|
|
58
91
|
* new observer's own signals on its next run.
|
|
@@ -65,12 +98,14 @@ export declare class QueryContent<T = unknown> implements DoCheck, OnChanges {
|
|
|
65
98
|
*/
|
|
66
99
|
ngDoCheck(): void;
|
|
67
100
|
/**
|
|
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.
|
|
101
|
+
* Shows the branch the current query state describes: a different template —
|
|
102
|
+
* or a changed record identity — replaces the mounted view, and a changed
|
|
103
|
+
* document (or error) is written into the context the mounted view reads.
|
|
104
|
+
* Replacing the view on a `recordKey` or ID change mounts the record's own
|
|
105
|
+
* state (an edit form) fresh, the way React's keyed Fragment does.
|
|
71
106
|
*/
|
|
72
107
|
private update;
|
|
73
108
|
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,
|
|
109
|
+
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, [{ directive: typeof i1.MolPlacement; inputs: {}; outputs: {}; }]>;
|
|
75
110
|
}
|
|
76
111
|
//# 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
|
|
1
|
+
{"version":3,"file":"query-content.component.d.ts","sourceRoot":"","sources":["../src/query-content.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAC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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;IAEvC,sFAAsF;IACtF,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA8C;;IA6BnE;;;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;yCA1JH,YAAY;2CAAZ,YAAY;CA4KxB"}
|
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
* Render resource-dependent content only after its document exists — the
|
|
3
3
|
* Angular counterpart of `QueryContent` in `@molecule/app-query-react`, with
|
|
4
4
|
* the node-valued props as `TemplateRef`s. The component is headless: it owns
|
|
5
|
-
* no translations and no styling, and
|
|
6
|
-
* host
|
|
5
|
+
* no translations and no styling, and renders the chosen branch in front of the
|
|
6
|
+
* host's place and takes its own element out of the DOM
|
|
7
|
+
* (`placeContentBefore` + `setElementPresent`), so the DOM is exactly the
|
|
8
|
+
* branch's own.
|
|
7
9
|
* @module
|
|
8
10
|
*/
|
|
9
|
-
import { ChangeDetectorRef, Component, effect, inject, signal, untracked, ViewChild, ViewContainerRef, } from '@angular/core';
|
|
11
|
+
import { ChangeDetectorRef, Component, effect, ElementRef, inject, signal, untracked, ViewChild, ViewContainerRef, } from '@angular/core';
|
|
12
|
+
import { MolPlacement, placeContentBefore, setElementPresent, usePlacement, } from '@molecule/app-angular';
|
|
10
13
|
import * as i0 from "@angular/core";
|
|
14
|
+
import * as i1 from "@molecule/app-angular";
|
|
11
15
|
const _c0 = ["outlet"];
|
|
12
16
|
/**
|
|
13
17
|
* The loaded-data branch receives a non-null document. Pending, failed initial
|
|
@@ -17,14 +21,31 @@ const _c0 = ["outlet"];
|
|
|
17
21
|
* container rendered by `children`, and so does a refresh line; the default
|
|
18
22
|
* fallbacks render nothing.
|
|
19
23
|
* A previous key's empty or missing document renders pending/error until the current key answers.
|
|
24
|
+
* Pass `recordKey` for an edit form: the form mounts with the current record and
|
|
25
|
+
* resets when its identity changes, including a switch to a record already in cache.
|
|
26
|
+
* Pass `getRecordId` to bind actions to the loaded document's identity: the branch
|
|
27
|
+
* stays pending without a nonempty ID and receives the ID as template context `a1`
|
|
28
|
+
* (`let-id="a1"`).
|
|
20
29
|
*
|
|
21
30
|
* The templates receive the render arguments as template context: `children`
|
|
22
|
-
* gets the document as `$implicit` and `a0` (`let-data`),
|
|
23
|
-
*
|
|
31
|
+
* gets the document as `$implicit` and `a0` (`let-data`), the record-bound branch
|
|
32
|
+
* also gets the ID as `a1` (`let-id`), `error` gets the error value
|
|
33
|
+
* (`let-error`), and `pending`/`missing` render without a context.
|
|
24
34
|
*/
|
|
25
35
|
export class QueryContent {
|
|
26
36
|
/** State from useQuery, or any compatible query observer. */
|
|
27
37
|
query = { data: undefined, status: 'idle', error: undefined };
|
|
38
|
+
/**
|
|
39
|
+
* Stable identity of the requested record, including the principal when needed.
|
|
40
|
+
* Use for record-specific state such as an edit form. Changing the key remounts the
|
|
41
|
+
* loaded branch and excludes data retained from a previous query key.
|
|
42
|
+
*/
|
|
43
|
+
recordKey = undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Extracts the ID from the loaded document. Null, undefined and an empty string
|
|
46
|
+
* are pending. With it set, `children` receives the ID as template context `a1`.
|
|
47
|
+
*/
|
|
48
|
+
getRecordId = undefined;
|
|
28
49
|
/** Mounted only with a real document, including false, zero and an empty list. */
|
|
29
50
|
children = null;
|
|
30
51
|
/** Initial idle/loading content. Render a status template, never a fake item or action. */
|
|
@@ -44,11 +65,23 @@ export class QueryContent {
|
|
|
44
65
|
...(ngDevMode ? [{ debugName: "observer" }] : /* istanbul ignore next */ []));
|
|
45
66
|
/** The template currently mounted. */
|
|
46
67
|
current = null;
|
|
68
|
+
/** The record the mounted branch belongs to (`recordKey` when it last mounted). */
|
|
69
|
+
mountedRecord = undefined;
|
|
70
|
+
/** The document identity the mounted branch belongs to, when `getRecordId` is set. */
|
|
71
|
+
mountedId = undefined;
|
|
47
72
|
/** The context object the mounted view reads (updated in place). */
|
|
48
73
|
context = {};
|
|
49
74
|
/** The mounted branch view, when a template is showing. */
|
|
50
75
|
view;
|
|
76
|
+
/** The component's host element (React renders the branch and nothing of its own). */
|
|
77
|
+
host = inject(ElementRef);
|
|
51
78
|
constructor() {
|
|
79
|
+
// The branch renders in front of the host's place and the host leaves the page, so the
|
|
80
|
+
// DOM is exactly the branch's own (React returns the branch element directly).
|
|
81
|
+
usePlacement(() => {
|
|
82
|
+
placeContentBefore(this.host.nativeElement, this.host.nativeElement);
|
|
83
|
+
setElementPresent(this.host.nativeElement, false);
|
|
84
|
+
});
|
|
52
85
|
// A `useQuery` result exposes its state through getters that read the
|
|
53
86
|
// observer's own signals. React re-renders a `QueryContent`'s parent on
|
|
54
87
|
// every state change; Angular only re-checks a view something marked, and
|
|
@@ -74,8 +107,13 @@ export class QueryContent {
|
|
|
74
107
|
*/
|
|
75
108
|
branch() {
|
|
76
109
|
const query = this.query;
|
|
110
|
+
const identified = typeof this.getRecordId === 'function';
|
|
77
111
|
if (query?.data === undefined ||
|
|
78
|
-
(query.isPreviousData &&
|
|
112
|
+
(query.isPreviousData &&
|
|
113
|
+
(identified ||
|
|
114
|
+
this.recordKey !== undefined ||
|
|
115
|
+
query.data === null ||
|
|
116
|
+
this.empty?.when(query.data)))) {
|
|
79
117
|
return query?.status === 'error' && this.error
|
|
80
118
|
? {
|
|
81
119
|
template: this.error,
|
|
@@ -85,10 +123,39 @@ export class QueryContent {
|
|
|
85
123
|
}
|
|
86
124
|
if (query.data === null)
|
|
87
125
|
return { template: this.missing ?? null, context: {} };
|
|
126
|
+
const identifiedTemplate = identified ? this.children : null;
|
|
127
|
+
if (identified) {
|
|
128
|
+
const id = this.recordIdentity();
|
|
129
|
+
// No identity means no record-specific action: the branch stays pending.
|
|
130
|
+
if (id === undefined)
|
|
131
|
+
return { template: this.pending ?? null, context: {} };
|
|
132
|
+
if (this.empty?.when(query.data))
|
|
133
|
+
return { template: this.empty.render, context: { $implicit: query.data, a0: query.data } };
|
|
134
|
+
return {
|
|
135
|
+
template: identifiedTemplate,
|
|
136
|
+
context: { $implicit: query.data, a0: query.data, a1: id },
|
|
137
|
+
};
|
|
138
|
+
}
|
|
88
139
|
if (this.empty?.when(query.data))
|
|
89
140
|
return { template: this.empty.render, context: { $implicit: query.data, a0: query.data } };
|
|
90
141
|
return { template: this.children, context: { $implicit: query.data, a0: query.data } };
|
|
91
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* The loaded document's verified identity, when `getRecordId` is set: absent,
|
|
145
|
+
* null and an empty string are no identity.
|
|
146
|
+
*
|
|
147
|
+
* @returns The nonempty ID, or `undefined` without one.
|
|
148
|
+
*/
|
|
149
|
+
recordIdentity() {
|
|
150
|
+
const getRecordId = this.getRecordId;
|
|
151
|
+
if (typeof getRecordId !== 'function')
|
|
152
|
+
return undefined;
|
|
153
|
+
const data = this.query?.data;
|
|
154
|
+
if (data === undefined || data === null)
|
|
155
|
+
return undefined;
|
|
156
|
+
const id = getRecordId(data);
|
|
157
|
+
return id == null || id === '' ? undefined : id;
|
|
158
|
+
}
|
|
92
159
|
/**
|
|
93
160
|
* Follows a replaced `query` prop: the reactivity effect subscribes to the
|
|
94
161
|
* new observer's own signals on its next run.
|
|
@@ -105,16 +172,22 @@ export class QueryContent {
|
|
|
105
172
|
this.update();
|
|
106
173
|
}
|
|
107
174
|
/**
|
|
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.
|
|
175
|
+
* Shows the branch the current query state describes: a different template —
|
|
176
|
+
* or a changed record identity — replaces the mounted view, and a changed
|
|
177
|
+
* document (or error) is written into the context the mounted view reads.
|
|
178
|
+
* Replacing the view on a `recordKey` or ID change mounts the record's own
|
|
179
|
+
* state (an edit form) fresh, the way React's keyed Fragment does.
|
|
111
180
|
*/
|
|
112
181
|
update() {
|
|
113
182
|
const next = this.branch();
|
|
114
|
-
|
|
183
|
+
const id = this.recordIdentity();
|
|
184
|
+
const recordChanged = this.recordKey !== this.mountedRecord || id !== this.mountedId;
|
|
185
|
+
if (next.template !== this.current || recordChanged) {
|
|
115
186
|
this.view?.destroy();
|
|
116
187
|
this.view = undefined;
|
|
117
188
|
this.current = next.template;
|
|
189
|
+
this.mountedRecord = this.recordKey;
|
|
190
|
+
this.mountedId = id;
|
|
118
191
|
if (next.template)
|
|
119
192
|
this.view = this.outlet.createEmbeddedView(next.template, this.context);
|
|
120
193
|
}
|
|
@@ -131,7 +204,7 @@ export class QueryContent {
|
|
|
131
204
|
} if (rf & 2) {
|
|
132
205
|
let _t;
|
|
133
206
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.outlet = _t.first);
|
|
134
|
-
} },
|
|
207
|
+
} }, inputs: { query: "query", pending: "pending", missing: "missing", children: "children", error: "error", empty: "empty", recordKey: "recordKey", getRecordId: "getRecordId" }, features: [i0.ɵɵHostDirectivesFeature([i1.MolPlacement]), i0.ɵɵNgOnChangesFeature], decls: 2, vars: 0, consts: [["outlet", ""]], template: function QueryContent_Template(rf, ctx) { if (rf & 1) {
|
|
135
208
|
i0.ɵɵdomElementContainer(0, null, 0);
|
|
136
209
|
} }, encapsulation: 2 });
|
|
137
210
|
}
|
|
@@ -140,16 +213,13 @@ export class QueryContent {
|
|
|
140
213
|
args: [{
|
|
141
214
|
selector: 'mol-query-content',
|
|
142
215
|
standalone: true,
|
|
216
|
+
hostDirectives: [MolPlacement],
|
|
143
217
|
template: '<ng-container #outlet></ng-container>',
|
|
144
|
-
inputs: ['query', 'pending', 'missing', 'children', 'error', 'empty'],
|
|
145
|
-
host: {
|
|
146
|
-
'data-parity-unwrap': '',
|
|
147
|
-
style: 'display: contents',
|
|
148
|
-
},
|
|
218
|
+
inputs: ['query', 'pending', 'missing', 'children', 'error', 'empty', 'recordKey', 'getRecordId'],
|
|
149
219
|
}]
|
|
150
220
|
}], () => [], { outlet: [{
|
|
151
221
|
type: ViewChild,
|
|
152
222
|
args: ['outlet', { read: ViewContainerRef, static: true }]
|
|
153
223
|
}] }); })();
|
|
154
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(QueryContent, { className: "QueryContent", filePath: "query-content.component.ts", lineNumber:
|
|
224
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(QueryContent, { className: "QueryContent", filePath: "query-content.component.ts", lineNumber: 72 }); })();
|
|
155
225
|
//# 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
|
|
1
|
+
{"version":3,"file":"query-content.component.js","sourceRoot":"","sources":["../src/query-content.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,iBAAiB,EACjB,SAAS,EAET,MAAM,EACN,UAAU,EAEV,MAAM,EAEN,MAAM,EAEN,SAAS,EACT,SAAS,EACT,gBAAgB,GACjB,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,GACb,MAAM,uBAAuB,CAAA;;;;AAc9B;;;;;;;;;;;;;;;;;;GAkBG;AAQH,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,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AAO,CAAC,CAAA;QAC5F,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC;gBAAE,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACtD,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;QACzC,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,CAAA;IAC3B,CAAC;sGA3KU,YAAY;6DAAZ,YAAY;mCA4BM,gBAAgB;;;;;YA/BlC,oCAAqC;;;iFAGrC,YAAY;cAPxB,SAAS;eAAC;gBACT,QAAQ,EAAE,mBAAmB;gBAC7B,UAAU,EAAE,IAAI;gBAChB,cAAc,EAAE,CAAC,YAAY,CAAC;gBAC9B,QAAQ,EAAE,uCAAuC;gBACjD,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,CAAC;aAClG;;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;;;;;GA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;;OAIG;IACH,SAAS,CAAC,EAAE,WAAW,CAAA;IACvB,kFAAkF;IAClF,QAAQ,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;IACpD,2FAA2F;IAC3F,OAAO,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;IACrC,qFAAqF;IACrF,OAAO,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;IACrC,6EAA6E;IAC7E,KAAK,CAAC,EAAE,WAAW,CAAC,wBAAwB,CAAC,GAAG,IAAI,CAAA;CACrD;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC,EAAE,EAAE,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,IAAI,CAClF,iBAAiB,CAAC,CAAC,CAAC,EACpB,UAAU,CACX;IACC,iGAAiG;IACjG,WAAW,EAAE,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,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;AAIlE,MAAM,IAAI,GAAsB;IAC9B,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,SAAS;CACrB,CAAA;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,UAAU,QAAQ,CAAI,OAA6B;IACvD,MAAM,WAAW,GAAG,GAA2B,EAAE,CAC/C,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAC1D,oEAAoE;IACpE,MAAM,QAAQ,GAAG,CAAC,KAA6B,EAAQ,EAAE;QACvD,IAAI,KAAK,EAAE,gBAAgB,KAAK,IAAI,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACtE,MAAM,IAAI,KAAK,CACb,uPAAuP,CACxP,CAAA;QACH,CAAC;IACH,CAAC,CAAA;IAED,MAAM,OAAO,GAAG,WAAW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,EAAE,OAAO,CAAC,CAAA;YAC5D,CAAC;iBAAM,CAAC;gBACN,UAAU,GAAG,IAAqB,CAAA;gBAClC,SAAS,GAAG,EAAE,CAAA;YAChB,CAAC;QACH,CAAC;QACD,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;IACtB,CAAC,CAAA;IAED,0EAA0E;IAC1E,0EAA0E;IAC1E,2BAA2B;IAC3B,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;IACpB,YAAY,CAAC,KAAK,CAAC,CAAA;IACnB,IAAI,OAAO,EAAE,CAAC;QACZ,WAAW,GAAG,cAAc,EAAE,CAAC,SAAS,CAAI,OAAO,EAAE,OAAO,CAAC,CAAA;IAC/D,CAAC;IAED,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,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.1",
|
|
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",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"@angular/common": "^22.0.0",
|
|
49
49
|
"@angular/core": "^22.0.0",
|
|
50
50
|
"@angular/platform-browser": "^22.0.0",
|
|
51
|
+
"@molecule/app-angular": "^3.13.0",
|
|
51
52
|
"@molecule/app-query": "^1.2.0"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
@@ -56,17 +57,17 @@
|
|
|
56
57
|
"@angular/compiler-cli": "22.2.3",
|
|
57
58
|
"@angular/core": "22.2.3",
|
|
58
59
|
"@angular/platform-browser": "22.2.3",
|
|
59
|
-
"@molecule/app-angular": "3.
|
|
60
|
+
"@molecule/app-angular": "3.13.0",
|
|
60
61
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
61
62
|
"@molecule/app-i18n": "1.2.2",
|
|
62
63
|
"@molecule/app-icons": "1.0.4",
|
|
63
|
-
"@molecule/app-query": "1.3.
|
|
64
|
+
"@molecule/app-query": "1.3.4",
|
|
64
65
|
"@molecule/app-query-memory": "1.1.0",
|
|
65
66
|
"@molecule/app-query-tanstack": "1.1.0",
|
|
66
|
-
"@molecule/app-ui": "1.
|
|
67
|
-
"@molecule/app-ui-angular": "1.
|
|
67
|
+
"@molecule/app-ui": "1.5.0",
|
|
68
|
+
"@molecule/app-ui-angular": "1.5.1",
|
|
68
69
|
"@types/node": "26.6.5",
|
|
69
|
-
"jsdom": "
|
|
70
|
+
"jsdom": "31.0.1",
|
|
70
71
|
"rxjs": "7.8.2",
|
|
71
72
|
"typescript": "6.0.3",
|
|
72
73
|
"vitest": "4.1.12",
|