@azx-pbc/axiom-react 0.0.0-stage → 0.0.6
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/LICENSE +21 -0
- package/README.md +604 -2
- package/dist/FormErrorBoundary.d.ts +37 -0
- package/dist/FormErrorBoundary.d.ts.map +1 -0
- package/dist/FormErrorBoundary.js +54 -0
- package/dist/FormErrorBoundary.js.map +1 -0
- package/dist/FormProvider.d.ts +197 -0
- package/dist/FormProvider.d.ts.map +1 -0
- package/dist/FormProvider.js +149 -0
- package/dist/FormProvider.js.map +1 -0
- package/dist/field-error.d.ts +154 -0
- package/dist/field-error.d.ts.map +1 -0
- package/dist/field-error.js +2 -0
- package/dist/field-error.js.map +1 -0
- package/dist/field-props.d.ts +362 -0
- package/dist/field-props.d.ts.map +1 -0
- package/dist/field-props.js +64 -0
- package/dist/field-props.js.map +1 -0
- package/dist/form-context.d.ts +31 -0
- package/dist/form-context.d.ts.map +1 -0
- package/dist/form-context.js +13 -0
- package/dist/form-context.js.map +1 -0
- package/dist/form-store.d.ts +784 -0
- package/dist/form-store.d.ts.map +1 -0
- package/dist/form-store.js +2179 -0
- package/dist/form-store.js.map +1 -0
- package/dist/hints.d.ts +60 -0
- package/dist/hints.d.ts.map +1 -0
- package/dist/hints.js +158 -0
- package/dist/hints.js.map +1 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/render/field-value.d.ts +92 -0
- package/dist/render/field-value.d.ts.map +1 -0
- package/dist/render/field-value.js +124 -0
- package/dist/render/field-value.js.map +1 -0
- package/dist/render/nodes.d.ts +303 -0
- package/dist/render/nodes.d.ts.map +1 -0
- package/dist/render/nodes.js +325 -0
- package/dist/render/nodes.js.map +1 -0
- package/dist/render/schema.d.ts +30 -0
- package/dist/render/schema.d.ts.map +1 -0
- package/dist/render/schema.js +40 -0
- package/dist/render/schema.js.map +1 -0
- package/dist/render/value-text.d.ts +59 -0
- package/dist/render/value-text.d.ts.map +1 -0
- package/dist/render/value-text.js +104 -0
- package/dist/render/value-text.js.map +1 -0
- package/dist/store/array-bindings.d.ts +110 -0
- package/dist/store/array-bindings.d.ts.map +1 -0
- package/dist/store/array-bindings.js +181 -0
- package/dist/store/array-bindings.js.map +1 -0
- package/dist/store/bindings.d.ts +12 -0
- package/dist/store/bindings.d.ts.map +1 -0
- package/dist/store/bindings.js +16 -0
- package/dist/store/bindings.js.map +1 -0
- package/dist/store/buffer-state.d.ts +42 -0
- package/dist/store/buffer-state.d.ts.map +1 -0
- package/dist/store/buffer-state.js +51 -0
- package/dist/store/buffer-state.js.map +1 -0
- package/dist/store/configure.d.ts +19 -0
- package/dist/store/configure.d.ts.map +1 -0
- package/dist/store/configure.js +28 -0
- package/dist/store/configure.js.map +1 -0
- package/dist/store/derive.d.ts +106 -0
- package/dist/store/derive.d.ts.map +1 -0
- package/dist/store/derive.js +417 -0
- package/dist/store/derive.js.map +1 -0
- package/dist/store/errors.d.ts +20 -0
- package/dist/store/errors.d.ts.map +1 -0
- package/dist/store/errors.js +101 -0
- package/dist/store/errors.js.map +1 -0
- package/dist/store/fields.d.ts +35 -0
- package/dist/store/fields.d.ts.map +1 -0
- package/dist/store/fields.js +81 -0
- package/dist/store/fields.js.map +1 -0
- package/dist/store/form-channel.d.ts +174 -0
- package/dist/store/form-channel.d.ts.map +1 -0
- package/dist/store/form-channel.js +411 -0
- package/dist/store/form-channel.js.map +1 -0
- package/dist/store/gates.d.ts +22 -0
- package/dist/store/gates.d.ts.map +1 -0
- package/dist/store/gates.js +44 -0
- package/dist/store/gates.js.map +1 -0
- package/dist/store/ids.d.ts +20 -0
- package/dist/store/ids.d.ts.map +1 -0
- package/dist/store/ids.js +28 -0
- package/dist/store/ids.js.map +1 -0
- package/dist/store/inputs.d.ts +114 -0
- package/dist/store/inputs.d.ts.map +1 -0
- package/dist/store/inputs.js +202 -0
- package/dist/store/inputs.js.map +1 -0
- package/dist/store/layout.d.ts +81 -0
- package/dist/store/layout.d.ts.map +1 -0
- package/dist/store/layout.js +285 -0
- package/dist/store/layout.js.map +1 -0
- package/dist/store/messages.d.ts +56 -0
- package/dist/store/messages.d.ts.map +1 -0
- package/dist/store/messages.js +157 -0
- package/dist/store/messages.js.map +1 -0
- package/dist/store/option-pages.d.ts +193 -0
- package/dist/store/option-pages.d.ts.map +1 -0
- package/dist/store/option-pages.js +598 -0
- package/dist/store/option-pages.js.map +1 -0
- package/dist/store/parse-print.d.ts +105 -0
- package/dist/store/parse-print.d.ts.map +1 -0
- package/dist/store/parse-print.js +415 -0
- package/dist/store/parse-print.js.map +1 -0
- package/dist/store/proposals.d.ts +114 -0
- package/dist/store/proposals.d.ts.map +1 -0
- package/dist/store/proposals.js +90 -0
- package/dist/store/proposals.js.map +1 -0
- package/dist/store/publish.d.ts +48 -0
- package/dist/store/publish.d.ts.map +1 -0
- package/dist/store/publish.js +96 -0
- package/dist/store/publish.js.map +1 -0
- package/dist/store/snapshots.d.ts +63 -0
- package/dist/store/snapshots.d.ts.map +1 -0
- package/dist/store/snapshots.js +154 -0
- package/dist/store/snapshots.js.map +1 -0
- package/dist/store/steps.d.ts +13 -0
- package/dist/store/steps.d.ts.map +1 -0
- package/dist/store/steps.js +31 -0
- package/dist/store/steps.js.map +1 -0
- package/dist/store/view.d.ts +124 -0
- package/dist/store/view.d.ts.map +1 -0
- package/dist/store/view.js +301 -0
- package/dist/store/view.js.map +1 -0
- package/dist/store/visibility.d.ts +68 -0
- package/dist/store/visibility.d.ts.map +1 -0
- package/dist/store/visibility.js +231 -0
- package/dist/store/visibility.js.map +1 -0
- package/dist/store/wizard-cursor.d.ts +43 -0
- package/dist/store/wizard-cursor.d.ts.map +1 -0
- package/dist/store/wizard-cursor.js +67 -0
- package/dist/store/wizard-cursor.js.map +1 -0
- package/dist/store/writes.d.ts +50 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +91 -0
- package/dist/store/writes.js.map +1 -0
- package/dist/typed.d.ts +134 -0
- package/dist/typed.d.ts.map +1 -0
- package/dist/typed.js +74 -0
- package/dist/typed.js.map +1 -0
- package/dist/useAsyncOptions.d.ts +20 -0
- package/dist/useAsyncOptions.d.ts.map +1 -0
- package/dist/useAsyncOptions.js +70 -0
- package/dist/useAsyncOptions.js.map +1 -0
- package/dist/useBufferedInput.d.ts +69 -0
- package/dist/useBufferedInput.d.ts.map +1 -0
- package/dist/useBufferedInput.js +132 -0
- package/dist/useBufferedInput.js.map +1 -0
- package/dist/useField.d.ts +42 -0
- package/dist/useField.d.ts.map +1 -0
- package/dist/useField.js +63 -0
- package/dist/useField.js.map +1 -0
- package/dist/useFieldArray.d.ts +25 -0
- package/dist/useFieldArray.d.ts.map +1 -0
- package/dist/useFieldArray.js +18 -0
- package/dist/useFieldArray.js.map +1 -0
- package/dist/useForm.d.ts +20 -0
- package/dist/useForm.d.ts.map +1 -0
- package/dist/useForm.js +9 -0
- package/dist/useForm.js.map +1 -0
- package/dist/useFormState.d.ts +23 -0
- package/dist/useFormState.d.ts.map +1 -0
- package/dist/useFormState.js +11 -0
- package/dist/useFormState.js.map +1 -0
- package/dist/useGate.d.ts +15 -0
- package/dist/useGate.d.ts.map +1 -0
- package/dist/useGate.js +21 -0
- package/dist/useGate.js.map +1 -0
- package/dist/useLayout.d.ts +29 -0
- package/dist/useLayout.d.ts.map +1 -0
- package/dist/useLayout.js +59 -0
- package/dist/useLayout.js.map +1 -0
- package/dist/useMessage.d.ts +58 -0
- package/dist/useMessage.d.ts.map +1 -0
- package/dist/useMessage.js +62 -0
- package/dist/useMessage.js.map +1 -0
- package/dist/useWatch.d.ts +19 -0
- package/dist/useWatch.d.ts.map +1 -0
- package/dist/useWatch.js +17 -0
- package/dist/useWatch.js.map +1 -0
- package/dist/useWizard.d.ts +166 -0
- package/dist/useWizard.d.ts.map +1 -0
- package/dist/useWizard.js +554 -0
- package/dist/useWizard.js.map +1 -0
- package/package.json +62 -3
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { sameWireValue } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import { deriveFieldProps, sameFieldProps } from './derive.js';
|
|
3
|
+
/**
|
|
4
|
+
* The per-binding `FieldProps` cache.
|
|
5
|
+
*
|
|
6
|
+
* It holds no facts of its own: the engine's per-binding state is the record, and this adds the
|
|
7
|
+
* session view and the host's display rules to it. An entry is replaced only when the engine's
|
|
8
|
+
* state object, the view or the display options change, and then only if the derivation states
|
|
9
|
+
* something different — which is what keeps a candidate session's fresh state objects from
|
|
10
|
+
* re-rendering every control after an access change.
|
|
11
|
+
*/
|
|
12
|
+
export class FieldSnapshots {
|
|
13
|
+
committed = new Map();
|
|
14
|
+
candidate;
|
|
15
|
+
signatures = 0;
|
|
16
|
+
/** The props of one binding, derived only when one of its three inputs changed. */
|
|
17
|
+
read(owner, committed, key, state, view, display, visibility, describe) {
|
|
18
|
+
const values = committed ? this.committed : this.candidateValues(owner);
|
|
19
|
+
const cached = values.get(key);
|
|
20
|
+
if (cached !== undefined &&
|
|
21
|
+
cached.state === state &&
|
|
22
|
+
cached.view === view &&
|
|
23
|
+
cached.display === display &&
|
|
24
|
+
cached.visibility === visibility) {
|
|
25
|
+
return cached.props;
|
|
26
|
+
}
|
|
27
|
+
this.signatures += 1;
|
|
28
|
+
const derived = deriveFieldProps({
|
|
29
|
+
...describe(),
|
|
30
|
+
state,
|
|
31
|
+
view,
|
|
32
|
+
display,
|
|
33
|
+
visibility,
|
|
34
|
+
signature: `${key}#${String(this.signatures)}`,
|
|
35
|
+
});
|
|
36
|
+
// A candidate may share the committed object when every published fact agrees, but it
|
|
37
|
+
// never replaces the committed entry before the commit boundary adopts it.
|
|
38
|
+
const previous = cached ?? this.committed.get(key);
|
|
39
|
+
const props = previous !== undefined && sameFieldProps(previous.props, derived)
|
|
40
|
+
? previous.props
|
|
41
|
+
: Object.freeze(derived);
|
|
42
|
+
values.set(key, { state, view, display, visibility, props });
|
|
43
|
+
return props;
|
|
44
|
+
}
|
|
45
|
+
/** Adopts the candidate entries a commit rendered; unread bindings keep their committed entry. */
|
|
46
|
+
commit(owner) {
|
|
47
|
+
if (this.candidate?.owner !== owner)
|
|
48
|
+
return;
|
|
49
|
+
for (const [key, snapshot] of this.candidate.values)
|
|
50
|
+
this.committed.set(key, snapshot);
|
|
51
|
+
this.candidate = undefined;
|
|
52
|
+
}
|
|
53
|
+
/** The props committed state last read, or `undefined` before its first read. */
|
|
54
|
+
current(key) {
|
|
55
|
+
return this.committed.get(key)?.props;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Drops one binding's entry. A row the record no longer addresses is not re-read, and the
|
|
59
|
+
* props it cached hold its value; a row that returns re-derives a fresh object.
|
|
60
|
+
*/
|
|
61
|
+
retire(key) {
|
|
62
|
+
this.committed.delete(key);
|
|
63
|
+
this.candidate?.values.delete(key);
|
|
64
|
+
}
|
|
65
|
+
/** How many entries the committed cache retains, so a churned list can be counted. */
|
|
66
|
+
retained() {
|
|
67
|
+
return this.committed.size;
|
|
68
|
+
}
|
|
69
|
+
/** Drops every entry, including one a render that will never commit left behind. */
|
|
70
|
+
clear() {
|
|
71
|
+
this.committed.clear();
|
|
72
|
+
this.candidate = undefined;
|
|
73
|
+
}
|
|
74
|
+
candidateValues(owner) {
|
|
75
|
+
if (this.candidate?.owner !== owner) {
|
|
76
|
+
this.candidate = { owner, values: new Map() };
|
|
77
|
+
}
|
|
78
|
+
return this.candidate.values;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The per-binding value-only cache `useWatch` reads.
|
|
83
|
+
*
|
|
84
|
+
* A watched value changes identity only when the value itself changes: a pass that moves a
|
|
85
|
+
* message or a sibling's fact re-derives the binding's state object, so the value is compared
|
|
86
|
+
* and the previous object returned. That is what makes a message-only change render nothing.
|
|
87
|
+
*/
|
|
88
|
+
export class ValueSnapshots {
|
|
89
|
+
committed = new Map();
|
|
90
|
+
candidate;
|
|
91
|
+
read(owner, committed, key, next) {
|
|
92
|
+
const values = committed ? this.committed : this.candidateValues(owner);
|
|
93
|
+
const cached = values.get(key) ?? this.committed.get(key);
|
|
94
|
+
const value = cached !== undefined && sameValueState(cached, next) ? cached : next;
|
|
95
|
+
values.set(key, value);
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
/** Keeps the value identities a committed render read, without adopting an aborted one. */
|
|
99
|
+
commit(owner) {
|
|
100
|
+
if (this.candidate?.owner !== owner)
|
|
101
|
+
return;
|
|
102
|
+
for (const [key, value] of this.candidate.values)
|
|
103
|
+
this.committed.set(key, value);
|
|
104
|
+
this.candidate = undefined;
|
|
105
|
+
}
|
|
106
|
+
/** Drops one binding's value identity; a binding that returns re-derives it. */
|
|
107
|
+
retire(key) {
|
|
108
|
+
this.committed.delete(key);
|
|
109
|
+
this.candidate?.values.delete(key);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Gives a value-only subscriber a new snapshot without changing the value it states.
|
|
113
|
+
*
|
|
114
|
+
* Declining a write is a repaint, not a record change. Cloning both live wrappers preserves
|
|
115
|
+
* their tagged value while letting `useSyncExternalStore` observe the deliberate repaint.
|
|
116
|
+
*/
|
|
117
|
+
repaint(key) {
|
|
118
|
+
const committed = this.committed.get(key);
|
|
119
|
+
if (committed !== undefined)
|
|
120
|
+
this.committed.set(key, Object.freeze({ ...committed }));
|
|
121
|
+
const values = this.candidate?.values;
|
|
122
|
+
const candidate = values?.get(key);
|
|
123
|
+
if (values !== undefined && candidate !== undefined) {
|
|
124
|
+
values.set(key, Object.freeze({ ...candidate }));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/** How many entries the committed cache retains, so a churned list can be counted. */
|
|
128
|
+
retained() {
|
|
129
|
+
return this.committed.size;
|
|
130
|
+
}
|
|
131
|
+
/** Drops every entry, including one a render that will never commit left behind. */
|
|
132
|
+
clear() {
|
|
133
|
+
this.committed.clear();
|
|
134
|
+
this.candidate = undefined;
|
|
135
|
+
}
|
|
136
|
+
candidateValues(owner) {
|
|
137
|
+
if (this.candidate?.owner !== owner) {
|
|
138
|
+
this.candidate = { owner, values: new Map() };
|
|
139
|
+
}
|
|
140
|
+
return this.candidate.values;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/** Whether two value states state the same fact. */
|
|
144
|
+
function sameValueState(left, right) {
|
|
145
|
+
if (left.kind !== right.kind)
|
|
146
|
+
return false;
|
|
147
|
+
if (left.kind === 'withheld' && right.kind === 'withheld')
|
|
148
|
+
return left.reason === right.reason;
|
|
149
|
+
if (left.kind === 'value' && right.kind === 'value') {
|
|
150
|
+
return sameWireValue(left.value, right.value);
|
|
151
|
+
}
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=snapshots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshots.js","sourceRoot":"","sources":["../../src/store/snapshots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAY/D;;;;;;;;GAQG;AACH,MAAM,OAAO,cAAc;IACR,SAAS,GAAG,IAAI,GAAG,EAAoB,CAAC;IACjD,SAAS,CAAiF;IAC1F,UAAU,GAAG,CAAC,CAAC;IAEvB,mFAAmF;IACnF,IAAI,CACF,KAAa,EACb,SAAkB,EAClB,GAAW,EACX,KAAuB,EACvB,IAAiB,EACjB,OAAuB,EACvB,UAA6B,EAC7B,QAA8F;QAE9F,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACxE,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,IACE,MAAM,KAAK,SAAS;YACpB,MAAM,CAAC,KAAK,KAAK,K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AAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED,sFAAsF;IACtF,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC7B,CAAC;IAED,oFAAoF;IACpF,KAAK;QACH,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAEO,eAAe,CAAC,KAAa;QACnC,IAAI,IAAI,CAAC,SAAS,EAAE,KAAK,KAAK,KAAK,EAAE,CAAC;YACpC,IAAI,CAAC,SAAS,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;QAChD,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IAC/B,CAAC;CACF;AAED,oDAAoD;AACpD,SAAS,cAAc,CAAC,IAAgB,EAAE,KAAiB;IACzD,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IAC3C,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC;IAC/F,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QACpD,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { sameWireValue } from '@azx-pbc/axiom-runtime';\nimport type { EngineFieldState, ValueState } from '@azx-pbc/axiom-runtime';\nimport type { FieldProps } from '../field-props.js';\nimport { deriveFieldProps, sameFieldProps } from './derive.js';\nimport type { BindingView, DeriveContext, DisplayOptions } from './derive.js';\nimport type { BindingVisibility } from './visibility.js';\n\ninterface Snapshot {\n readonly state: EngineFieldState;\n readonly view: BindingView;\n readonly display: DisplayOptions;\n readonly visibility: BindingVisibility;\n readonly props: FieldProps;\n}\n\n/**\n * The per-binding `FieldProps` cache.\n *\n * It holds no facts of its own: the engine's per-binding state is the record, and this adds the\n * session view and the host's display rules to it. An entry is replaced only when the engine's\n * state object, the view or the display options change, and then only if the derivation states\n * something different — which is what keeps a candidate session's fresh state objects from\n * re-rendering every control after an access change.\n */\nexport class FieldSnapshots {\n private readonly committed = new Map<string, Snapshot>();\n private candidate: { readonly owner: object; readonly values: Map<string, Snapshot> } | undefined;\n private signatures = 0;\n\n /** The props of one binding, derived only when one of its three inputs changed. */\n read(\n owner: object,\n committed: boolean,\n key: string,\n state: EngineFieldState,\n view: BindingView,\n display: DisplayOptions,\n visibility: BindingVisibility,\n describe: () => Omit<DeriveContext, 'state' | 'view' | 'display' | 'visibility' | 'signature'>,\n ): FieldProps {\n const values = committed ? this.committed : this.candidateValues(owner);\n const cached = values.get(key);\n if (\n cached !== undefined &&\n cached.state === state &&\n cached.view === view &&\n cached.display === display &&\n cached.visibility === visibility\n ) {\n return cached.props;\n }\n this.signatures += 1;\n const derived = deriveFieldProps({\n ...describe(),\n state,\n view,\n display,\n visibility,\n signature: `${key}#${String(this.signatures)}`,\n });\n // A candidate may share the committed object when every published fact agrees, but it\n // never replaces the committed entry before the commit boundary adopts it.\n const previous = cached ?? this.committed.get(key);\n const props =\n previous !== undefined && sameFieldProps(previous.props, derived)\n ? previous.props\n : Object.freeze(derived);\n values.set(key, { state, view, display, visibility, props });\n return props;\n }\n\n /** Adopts the candidate entries a commit rendered; unread bindings keep their committed entry. */\n commit(owner: object): void {\n if (this.candidate?.owner !== owner) return;\n for (const [key, snapshot] of this.candidate.values) this.committed.set(key, snapshot);\n this.candidate = undefined;\n }\n\n /** The props committed state last read, or `undefined` before its first read. */\n current(key: string): FieldProps | undefined {\n return this.committed.get(key)?.props;\n }\n\n /**\n * Drops one binding's entry. A row the record no longer addresses is not re-read, and the\n * props it cached hold its value; a row that returns re-derives a fresh object.\n */\n retire(key: string): void {\n this.committed.delete(key);\n this.candidate?.values.delete(key);\n }\n\n /** How many entries the committed cache retains, so a churned list can be counted. */\n retained(): number {\n return this.committed.size;\n }\n\n /** Drops every entry, including one a render that will never commit left behind. */\n clear(): void {\n this.committed.clear();\n this.candidate = undefined;\n }\n\n private candidateValues(owner: object): Map<string, Snapshot> {\n if (this.candidate?.owner !== owner) {\n this.candidate = { owner, values: new Map() };\n }\n return this.candidate.values;\n }\n}\n\n/**\n * The per-binding value-only cache `useWatch` reads.\n *\n * A watched value changes identity only when the value itself changes: a pass that moves a\n * message or a sibling's fact re-derives the binding's state object, so the value is compared\n * and the previous object returned. That is what makes a message-only change render nothing.\n */\nexport class ValueSnapshots {\n private readonly committed = new Map<string, ValueState>();\n private candidate:\n | { readonly owner: object; readonly values: Map<string, ValueState> }\n | undefined;\n\n read(owner: object, committed: boolean, key: string, next: ValueState): ValueState {\n const values = committed ? this.committed : this.candidateValues(owner);\n const cached = values.get(key) ?? this.committed.get(key);\n const value = cached !== undefined && sameValueState(cached, next) ? cached : next;\n values.set(key, value);\n return value;\n }\n\n /** Keeps the value identities a committed render read, without adopting an aborted one. */\n commit(owner: object): void {\n if (this.candidate?.owner !== owner) return;\n for (const [key, value] of this.candidate.values) this.committed.set(key, value);\n this.candidate = undefined;\n }\n\n /** Drops one binding's value identity; a binding that returns re-derives it. */\n retire(key: string): void {\n this.committed.delete(key);\n this.candidate?.values.delete(key);\n }\n\n /**\n * Gives a value-only subscriber a new snapshot without changing the value it states.\n *\n * Declining a write is a repaint, not a record change. Cloning both live wrappers preserves\n * their tagged value while letting `useSyncExternalStore` observe the deliberate repaint.\n */\n repaint(key: string): void {\n const committed = this.committed.get(key);\n if (committed !== undefined) this.committed.set(key, Object.freeze({ ...committed }));\n const values = this.candidate?.values;\n const candidate = values?.get(key);\n if (values !== undefined && candidate !== undefined) {\n values.set(key, Object.freeze({ ...candidate }));\n }\n }\n\n /** How many entries the committed cache retains, so a churned list can be counted. */\n retained(): number {\n return this.committed.size;\n }\n\n /** Drops every entry, including one a render that will never commit left behind. */\n clear(): void {\n this.committed.clear();\n this.candidate = undefined;\n }\n\n private candidateValues(owner: object): Map<string, ValueState> {\n if (this.candidate?.owner !== owner) {\n this.candidate = { owner, values: new Map() };\n }\n return this.candidate.values;\n }\n}\n\n/** Whether two value states state the same fact. */\nfunction sameValueState(left: ValueState, right: ValueState): boolean {\n if (left.kind !== right.kind) return false;\n if (left.kind === 'withheld' && right.kind === 'withheld') return left.reason === right.reason;\n if (left.kind === 'value' && right.kind === 'value') {\n return sameWireValue(left.value, right.value);\n }\n return true;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two pure step helpers a branching flow needs, `[MODEL-3.1.3]`.
|
|
3
|
+
*
|
|
4
|
+
* The cursor is the host's: these answer where a move lands, never move anything. A hidden
|
|
5
|
+
* step is skipped in both directions, so a wizard whose middle page a gate hid cannot strand
|
|
6
|
+
* the user between the page they left and the page they meant to reach. A cursor that names a
|
|
7
|
+
* step no longer in the flow starts from the flow's own order rather than failing.
|
|
8
|
+
*/
|
|
9
|
+
/** The first visible step after `from`, or `undefined` when `from` is the last one. */
|
|
10
|
+
export declare function nextVisibleStepId(steps: readonly string[], visible: ReadonlySet<string>, from: string): string | undefined;
|
|
11
|
+
/** The first visible step before `from`, or `undefined` when `from` is the first one. */
|
|
12
|
+
export declare function previousVisibleStepId(steps: readonly string[], visible: ReadonlySet<string>, from: string): string | undefined;
|
|
13
|
+
//# sourceMappingURL=steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/store/steps.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,uFAAuF;AACvF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,EAC5B,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAQpB;AAED,yFAAyF;AACzF,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,EAC5B,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAQpB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two pure step helpers a branching flow needs, `[MODEL-3.1.3]`.
|
|
3
|
+
*
|
|
4
|
+
* The cursor is the host's: these answer where a move lands, never move anything. A hidden
|
|
5
|
+
* step is skipped in both directions, so a wizard whose middle page a gate hid cannot strand
|
|
6
|
+
* the user between the page they left and the page they meant to reach. A cursor that names a
|
|
7
|
+
* step no longer in the flow starts from the flow's own order rather than failing.
|
|
8
|
+
*/
|
|
9
|
+
/** The first visible step after `from`, or `undefined` when `from` is the last one. */
|
|
10
|
+
export function nextVisibleStepId(steps, visible, from) {
|
|
11
|
+
const index = steps.indexOf(from);
|
|
12
|
+
const start = index < 0 ? -1 : index;
|
|
13
|
+
for (let cursor = start + 1; cursor < steps.length; cursor += 1) {
|
|
14
|
+
const stepId = steps[cursor];
|
|
15
|
+
if (stepId !== undefined && visible.has(stepId))
|
|
16
|
+
return stepId;
|
|
17
|
+
}
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
/** The first visible step before `from`, or `undefined` when `from` is the first one. */
|
|
21
|
+
export function previousVisibleStepId(steps, visible, from) {
|
|
22
|
+
const index = steps.indexOf(from);
|
|
23
|
+
const start = index < 0 ? steps.length : index;
|
|
24
|
+
for (let cursor = start - 1; cursor >= 0; cursor -= 1) {
|
|
25
|
+
const stepId = steps[cursor];
|
|
26
|
+
if (stepId !== undefined && visible.has(stepId))
|
|
27
|
+
return stepId;
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=steps.js.map
|
|
@@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AACnB,CAAC","sourcesContent":["/**\n * The two pure step helpers a branching flow needs, `[MODEL-3.1.3]`.\n *\n * The cursor is the host's: these answer where a move lands, never move anything. A hidden\n * step is skipped in both directions, so a wizard whose middle page a gate hid cannot strand\n * the user between the page they left and the page they meant to reach. A cursor that names a\n * step no longer in the flow starts from the flow's own order rather than failing.\n */\n\n/** The first visible step after `from`, or `undefined` when `from` is the last one. */\nexport function nextVisibleStepId(\n steps: readonly string[],\n visible: ReadonlySet<string>,\n from: string,\n): string | undefined {\n const index = steps.indexOf(from);\n const start = index < 0 ? -1 : index;\n for (let cursor = start + 1; cursor < steps.length; cursor += 1) {\n const stepId = steps[cursor];\n if (stepId !== undefined && visible.has(stepId)) return stepId;\n }\n return undefined;\n}\n\n/** The first visible step before `from`, or `undefined` when `from` is the first one. */\nexport function previousVisibleStepId(\n steps: readonly string[],\n visible: ReadonlySet<string>,\n from: string,\n): string | undefined {\n const index = steps.indexOf(from);\n const start = index < 0 ? steps.length : index;\n for (let cursor = start - 1; cursor >= 0; cursor -= 1) {\n const stepId = steps[cursor];\n if (stepId !== undefined && visible.has(stepId)) return stepId;\n }\n return undefined;\n}\n"]}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { FieldRef, FormState, WireValue } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import type { RowKeyFieldError } from '../field-error.js';
|
|
3
|
+
import type { BindingView } from './derive.js';
|
|
4
|
+
import type { FieldFacts } from './fields.js';
|
|
5
|
+
/**
|
|
6
|
+
* The session facts the engine does not own: what the user has touched, what a submit has
|
|
7
|
+
* attempted, and the baseline `dirty` is measured from.
|
|
8
|
+
*
|
|
9
|
+
* Baselines are keyed by binding key — the field plus the row's wire-typed identity — so moving
|
|
10
|
+
* a row never dirties it, and the integer row `1` and the text row `"1"` never share a baseline.
|
|
11
|
+
* A view object is replaced only when the facts it states change, which is what keeps a blur on
|
|
12
|
+
* one row from replacing every other row's props.
|
|
13
|
+
*/
|
|
14
|
+
/** What one binding held at the session's baseline: what the device could read, and the record. */
|
|
15
|
+
export interface Baseline {
|
|
16
|
+
/** The value the device was delivered, which is what `initialValue` reports. */
|
|
17
|
+
readonly visible: WireValue | undefined;
|
|
18
|
+
/** The value the record held. `dirty` compares against this, so access cannot move it. */
|
|
19
|
+
readonly held: WireValue | undefined;
|
|
20
|
+
}
|
|
21
|
+
export declare class SessionView {
|
|
22
|
+
/** Bindings an explicit blur recorded, keyed by the reference the summary can re-derive. */
|
|
23
|
+
private touched;
|
|
24
|
+
/** Bindings a user write recorded because the value actually moved from where it was. */
|
|
25
|
+
private edited;
|
|
26
|
+
/** Bindings a deliberate user write recorded, so a display rule can tell an edit from an opening value. */
|
|
27
|
+
private changed;
|
|
28
|
+
/** The last refused entry per binding, kept until that binding or its array moves again. */
|
|
29
|
+
private readonly refusals;
|
|
30
|
+
/**
|
|
31
|
+
* The failures this session has already painted, per binding.
|
|
32
|
+
*
|
|
33
|
+
* A key is removed only when the failure it names is corrected (or the session resets), so a
|
|
34
|
+
* failure that is still true never flickers out because a sibling operand was cleared. The set
|
|
35
|
+
* object is replaced only when its members change, because it is part of the published binding
|
|
36
|
+
* view's identity.
|
|
37
|
+
*/
|
|
38
|
+
private readonly revealed;
|
|
39
|
+
private baselines;
|
|
40
|
+
private readonly views;
|
|
41
|
+
private submitting;
|
|
42
|
+
/**
|
|
43
|
+
* Re-baselines every binding from committed state; a reset starts a new comparison.
|
|
44
|
+
*
|
|
45
|
+
* The baseline records both what the device may read and what the record held, because they
|
|
46
|
+
* answer different questions: `initialValue` reports the former, and `dirty` asks whether the
|
|
47
|
+
* *record* moved, which no access answer can cause.
|
|
48
|
+
*/
|
|
49
|
+
capture(form: FormState, held: ReadonlyMap<string, WireValue | undefined>): void;
|
|
50
|
+
/** What one binding held at the baseline; a binding the record gained since holds nothing. */
|
|
51
|
+
baselineOf(key: string): Baseline;
|
|
52
|
+
/**
|
|
53
|
+
* One binding's view, reusing the cached object while every fact it states holds.
|
|
54
|
+
*
|
|
55
|
+
* `submitted` comes from the session's submit count rather than a second flag here, so the
|
|
56
|
+
* control and the form summary cannot disagree about whether a submit was attempted.
|
|
57
|
+
*/
|
|
58
|
+
viewFor(key: string, submitted: boolean): BindingView;
|
|
59
|
+
/** Whether the user has visited or deliberately changed this binding. */
|
|
60
|
+
isAnswered(key: string): boolean;
|
|
61
|
+
/** Records that one control lost focus; the caller has already refused a no-op blur. */
|
|
62
|
+
markTouched(key: string, ref: FieldRef): void;
|
|
63
|
+
/** Records that one deliberate write moved this binding's value from what it held. */
|
|
64
|
+
markEdited(key: string, ref: FieldRef): void;
|
|
65
|
+
/** Records that the user wrote this binding, so `onChange` can reveal a failure it evaluated. */
|
|
66
|
+
markChanged(key: string, ref: FieldRef): void;
|
|
67
|
+
/** Keeps the entry the session refused, so the control can announce why it did not take. */
|
|
68
|
+
markRefused(key: string, refusal: RowKeyFieldError): void;
|
|
69
|
+
/** Forgets a refusal the binding's next successful write answered. */
|
|
70
|
+
clearRefused(key: string): void;
|
|
71
|
+
/** Forgets every refusal: a structural change moves the rows they were about. */
|
|
72
|
+
clearRefusals(): void;
|
|
73
|
+
/** States whether a submission is in flight, the one fact `aria-busy` may announce. */
|
|
74
|
+
setSubmitting(submitting: boolean): void;
|
|
75
|
+
/**
|
|
76
|
+
* Drops every fact one binding held. A row the record no longer addresses is not read again,
|
|
77
|
+
* and the view holds the value it showed at the session baseline; a row that returns re-derives
|
|
78
|
+
* it.
|
|
79
|
+
*
|
|
80
|
+
* The session facts go with the view. `touched` and `changed` are sets the user grows by using
|
|
81
|
+
* a control, and nothing else ever removes an entry: a list that churns rows an operator edits
|
|
82
|
+
* would otherwise keep one string per row it has ever shown, for the life of the session. The
|
|
83
|
+
* facts are equally meaningless for a key that no longer names a row — a returning row is a new
|
|
84
|
+
* row, and carrying its predecessor's baseline would make `dirty` compare it against a value it
|
|
85
|
+
* never held.
|
|
86
|
+
*/
|
|
87
|
+
retire(key: string): void;
|
|
88
|
+
/** How many binding views the cache retains, so a churned list can be counted. */
|
|
89
|
+
retained(): number;
|
|
90
|
+
/** How many bindings are recorded as touched, so a churned list can count what it left. */
|
|
91
|
+
touchedCount(): number;
|
|
92
|
+
/** How many bindings are recorded as changed, so a churned list can count what it left. */
|
|
93
|
+
changedCount(): number;
|
|
94
|
+
/** Records the bindings a failed submit named, so their failures are revealed. */
|
|
95
|
+
markTouchedAll(refs: readonly FieldRef[]): void;
|
|
96
|
+
/** Every touched binding, in binding-key order so the summary is a stable value. */
|
|
97
|
+
touchedBindings(): readonly string[];
|
|
98
|
+
/** Every binding the user has visited or deliberately changed, in stable key order. */
|
|
99
|
+
answeredBindings(): readonly string[];
|
|
100
|
+
/** The failures one binding has already painted, or the shared empty set. */
|
|
101
|
+
revealedOf(key: string): ReadonlySet<string>;
|
|
102
|
+
/** Replaces one binding's painted-failure set, keeping its identity while the members hold. */
|
|
103
|
+
setRevealed(ref: FieldRef, keys: ReadonlySet<string>): void;
|
|
104
|
+
/**
|
|
105
|
+
* The bindings whose reveal state a reconciliation must revisit: everything the user has
|
|
106
|
+
* answered and everything already painted. A binding outside both sets cannot start painting a
|
|
107
|
+
* failure without one of these facts changing first.
|
|
108
|
+
*/
|
|
109
|
+
revealCandidates(): readonly {
|
|
110
|
+
readonly key: string;
|
|
111
|
+
readonly ref: FieldRef;
|
|
112
|
+
}[];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The value the record holds at every binding, keyed by binding key.
|
|
116
|
+
*
|
|
117
|
+
* This is the baseline `dirty` compares against, and it is read from the record rather than from
|
|
118
|
+
* the delivery projection because the two answer different questions: a `masked` value is absent
|
|
119
|
+
* from what the device may read and present in the record, and only the record says whether the
|
|
120
|
+
* user changed anything. A row is located by its wire-typed key in the array's committed order,
|
|
121
|
+
* so a move re-keys nothing.
|
|
122
|
+
*/
|
|
123
|
+
export declare function heldValuesOf(record: Readonly<Record<string, WireValue>>, form: FormState, facts: ReadonlyMap<string, FieldFacts>): ReadonlyMap<string, WireValue | undefined>;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