@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.
Files changed (191) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +604 -2
  3. package/dist/FormErrorBoundary.d.ts +37 -0
  4. package/dist/FormErrorBoundary.d.ts.map +1 -0
  5. package/dist/FormErrorBoundary.js +54 -0
  6. package/dist/FormErrorBoundary.js.map +1 -0
  7. package/dist/FormProvider.d.ts +197 -0
  8. package/dist/FormProvider.d.ts.map +1 -0
  9. package/dist/FormProvider.js +149 -0
  10. package/dist/FormProvider.js.map +1 -0
  11. package/dist/field-error.d.ts +154 -0
  12. package/dist/field-error.d.ts.map +1 -0
  13. package/dist/field-error.js +2 -0
  14. package/dist/field-error.js.map +1 -0
  15. package/dist/field-props.d.ts +362 -0
  16. package/dist/field-props.d.ts.map +1 -0
  17. package/dist/field-props.js +64 -0
  18. package/dist/field-props.js.map +1 -0
  19. package/dist/form-context.d.ts +31 -0
  20. package/dist/form-context.d.ts.map +1 -0
  21. package/dist/form-context.js +13 -0
  22. package/dist/form-context.js.map +1 -0
  23. package/dist/form-store.d.ts +784 -0
  24. package/dist/form-store.d.ts.map +1 -0
  25. package/dist/form-store.js +2179 -0
  26. package/dist/form-store.js.map +1 -0
  27. package/dist/hints.d.ts +60 -0
  28. package/dist/hints.d.ts.map +1 -0
  29. package/dist/hints.js +158 -0
  30. package/dist/hints.js.map +1 -0
  31. package/dist/index.d.ts +57 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +36 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/render/field-value.d.ts +92 -0
  36. package/dist/render/field-value.d.ts.map +1 -0
  37. package/dist/render/field-value.js +124 -0
  38. package/dist/render/field-value.js.map +1 -0
  39. package/dist/render/nodes.d.ts +303 -0
  40. package/dist/render/nodes.d.ts.map +1 -0
  41. package/dist/render/nodes.js +325 -0
  42. package/dist/render/nodes.js.map +1 -0
  43. package/dist/render/schema.d.ts +30 -0
  44. package/dist/render/schema.d.ts.map +1 -0
  45. package/dist/render/schema.js +40 -0
  46. package/dist/render/schema.js.map +1 -0
  47. package/dist/render/value-text.d.ts +59 -0
  48. package/dist/render/value-text.d.ts.map +1 -0
  49. package/dist/render/value-text.js +104 -0
  50. package/dist/render/value-text.js.map +1 -0
  51. package/dist/store/array-bindings.d.ts +110 -0
  52. package/dist/store/array-bindings.d.ts.map +1 -0
  53. package/dist/store/array-bindings.js +181 -0
  54. package/dist/store/array-bindings.js.map +1 -0
  55. package/dist/store/bindings.d.ts +12 -0
  56. package/dist/store/bindings.d.ts.map +1 -0
  57. package/dist/store/bindings.js +16 -0
  58. package/dist/store/bindings.js.map +1 -0
  59. package/dist/store/buffer-state.d.ts +42 -0
  60. package/dist/store/buffer-state.d.ts.map +1 -0
  61. package/dist/store/buffer-state.js +51 -0
  62. package/dist/store/buffer-state.js.map +1 -0
  63. package/dist/store/configure.d.ts +19 -0
  64. package/dist/store/configure.d.ts.map +1 -0
  65. package/dist/store/configure.js +28 -0
  66. package/dist/store/configure.js.map +1 -0
  67. package/dist/store/derive.d.ts +106 -0
  68. package/dist/store/derive.d.ts.map +1 -0
  69. package/dist/store/derive.js +417 -0
  70. package/dist/store/derive.js.map +1 -0
  71. package/dist/store/errors.d.ts +20 -0
  72. package/dist/store/errors.d.ts.map +1 -0
  73. package/dist/store/errors.js +101 -0
  74. package/dist/store/errors.js.map +1 -0
  75. package/dist/store/fields.d.ts +35 -0
  76. package/dist/store/fields.d.ts.map +1 -0
  77. package/dist/store/fields.js +81 -0
  78. package/dist/store/fields.js.map +1 -0
  79. package/dist/store/form-channel.d.ts +174 -0
  80. package/dist/store/form-channel.d.ts.map +1 -0
  81. package/dist/store/form-channel.js +411 -0
  82. package/dist/store/form-channel.js.map +1 -0
  83. package/dist/store/gates.d.ts +22 -0
  84. package/dist/store/gates.d.ts.map +1 -0
  85. package/dist/store/gates.js +44 -0
  86. package/dist/store/gates.js.map +1 -0
  87. package/dist/store/ids.d.ts +20 -0
  88. package/dist/store/ids.d.ts.map +1 -0
  89. package/dist/store/ids.js +28 -0
  90. package/dist/store/ids.js.map +1 -0
  91. package/dist/store/inputs.d.ts +114 -0
  92. package/dist/store/inputs.d.ts.map +1 -0
  93. package/dist/store/inputs.js +202 -0
  94. package/dist/store/inputs.js.map +1 -0
  95. package/dist/store/layout.d.ts +81 -0
  96. package/dist/store/layout.d.ts.map +1 -0
  97. package/dist/store/layout.js +285 -0
  98. package/dist/store/layout.js.map +1 -0
  99. package/dist/store/messages.d.ts +56 -0
  100. package/dist/store/messages.d.ts.map +1 -0
  101. package/dist/store/messages.js +157 -0
  102. package/dist/store/messages.js.map +1 -0
  103. package/dist/store/option-pages.d.ts +193 -0
  104. package/dist/store/option-pages.d.ts.map +1 -0
  105. package/dist/store/option-pages.js +598 -0
  106. package/dist/store/option-pages.js.map +1 -0
  107. package/dist/store/parse-print.d.ts +105 -0
  108. package/dist/store/parse-print.d.ts.map +1 -0
  109. package/dist/store/parse-print.js +415 -0
  110. package/dist/store/parse-print.js.map +1 -0
  111. package/dist/store/proposals.d.ts +114 -0
  112. package/dist/store/proposals.d.ts.map +1 -0
  113. package/dist/store/proposals.js +90 -0
  114. package/dist/store/proposals.js.map +1 -0
  115. package/dist/store/publish.d.ts +48 -0
  116. package/dist/store/publish.d.ts.map +1 -0
  117. package/dist/store/publish.js +96 -0
  118. package/dist/store/publish.js.map +1 -0
  119. package/dist/store/snapshots.d.ts +63 -0
  120. package/dist/store/snapshots.d.ts.map +1 -0
  121. package/dist/store/snapshots.js +154 -0
  122. package/dist/store/snapshots.js.map +1 -0
  123. package/dist/store/steps.d.ts +13 -0
  124. package/dist/store/steps.d.ts.map +1 -0
  125. package/dist/store/steps.js +31 -0
  126. package/dist/store/steps.js.map +1 -0
  127. package/dist/store/view.d.ts +124 -0
  128. package/dist/store/view.d.ts.map +1 -0
  129. package/dist/store/view.js +301 -0
  130. package/dist/store/view.js.map +1 -0
  131. package/dist/store/visibility.d.ts +68 -0
  132. package/dist/store/visibility.d.ts.map +1 -0
  133. package/dist/store/visibility.js +231 -0
  134. package/dist/store/visibility.js.map +1 -0
  135. package/dist/store/wizard-cursor.d.ts +43 -0
  136. package/dist/store/wizard-cursor.d.ts.map +1 -0
  137. package/dist/store/wizard-cursor.js +67 -0
  138. package/dist/store/wizard-cursor.js.map +1 -0
  139. package/dist/store/writes.d.ts +50 -0
  140. package/dist/store/writes.d.ts.map +1 -0
  141. package/dist/store/writes.js +91 -0
  142. package/dist/store/writes.js.map +1 -0
  143. package/dist/typed.d.ts +134 -0
  144. package/dist/typed.d.ts.map +1 -0
  145. package/dist/typed.js +74 -0
  146. package/dist/typed.js.map +1 -0
  147. package/dist/useAsyncOptions.d.ts +20 -0
  148. package/dist/useAsyncOptions.d.ts.map +1 -0
  149. package/dist/useAsyncOptions.js +70 -0
  150. package/dist/useAsyncOptions.js.map +1 -0
  151. package/dist/useBufferedInput.d.ts +69 -0
  152. package/dist/useBufferedInput.d.ts.map +1 -0
  153. package/dist/useBufferedInput.js +132 -0
  154. package/dist/useBufferedInput.js.map +1 -0
  155. package/dist/useField.d.ts +42 -0
  156. package/dist/useField.d.ts.map +1 -0
  157. package/dist/useField.js +63 -0
  158. package/dist/useField.js.map +1 -0
  159. package/dist/useFieldArray.d.ts +25 -0
  160. package/dist/useFieldArray.d.ts.map +1 -0
  161. package/dist/useFieldArray.js +18 -0
  162. package/dist/useFieldArray.js.map +1 -0
  163. package/dist/useForm.d.ts +20 -0
  164. package/dist/useForm.d.ts.map +1 -0
  165. package/dist/useForm.js +9 -0
  166. package/dist/useForm.js.map +1 -0
  167. package/dist/useFormState.d.ts +23 -0
  168. package/dist/useFormState.d.ts.map +1 -0
  169. package/dist/useFormState.js +11 -0
  170. package/dist/useFormState.js.map +1 -0
  171. package/dist/useGate.d.ts +15 -0
  172. package/dist/useGate.d.ts.map +1 -0
  173. package/dist/useGate.js +21 -0
  174. package/dist/useGate.js.map +1 -0
  175. package/dist/useLayout.d.ts +29 -0
  176. package/dist/useLayout.d.ts.map +1 -0
  177. package/dist/useLayout.js +59 -0
  178. package/dist/useLayout.js.map +1 -0
  179. package/dist/useMessage.d.ts +58 -0
  180. package/dist/useMessage.d.ts.map +1 -0
  181. package/dist/useMessage.js +62 -0
  182. package/dist/useMessage.js.map +1 -0
  183. package/dist/useWatch.d.ts +19 -0
  184. package/dist/useWatch.d.ts.map +1 -0
  185. package/dist/useWatch.js +17 -0
  186. package/dist/useWatch.js.map +1 -0
  187. package/dist/useWizard.d.ts +166 -0
  188. package/dist/useWizard.d.ts.map +1 -0
  189. package/dist/useWizard.js +554 -0
  190. package/dist/useWizard.js.map +1 -0
  191. package/package.json +62 -3
@@ -0,0 +1,181 @@
1
+ import { permitsUserWrite } from '@azx-pbc/axiom-runtime';
2
+ import { bindingKey } from './bindings.js';
3
+ const NO_MUTATIONS = Object.freeze({
4
+ append: false,
5
+ insert: false,
6
+ remove: false,
7
+ move: false,
8
+ replace: false,
9
+ });
10
+ function sameRowOrder(left, right) {
11
+ return (left.length === right.length &&
12
+ left.every((row, index) => {
13
+ const other = right[index];
14
+ return other !== undefined && other.bindingKey === row.bindingKey;
15
+ }));
16
+ }
17
+ function sameMutations(left, right) {
18
+ return (left.append === right.append &&
19
+ left.insert === right.insert &&
20
+ left.remove === right.remove &&
21
+ left.move === right.move &&
22
+ left.replace === right.replace);
23
+ }
24
+ const COMPOSITE = new WeakMap();
25
+ export function fieldArrayOf(view, controls) {
26
+ const cached = COMPOSITE.get(view);
27
+ if (cached !== undefined)
28
+ return cached;
29
+ const array = Object.freeze({ ...view, ...controls });
30
+ COMPOSITE.set(view, array);
31
+ return array;
32
+ }
33
+ /** The controls of each array field, built once so a memoised row sees a stable callback. */
34
+ export class ArrayWriters {
35
+ controls = new Map();
36
+ for(fieldId, build) {
37
+ const cached = this.controls.get(fieldId);
38
+ if (cached !== undefined)
39
+ return cached;
40
+ const controls = build();
41
+ this.controls.set(fieldId, controls);
42
+ return controls;
43
+ }
44
+ }
45
+ /**
46
+ * The committed array views, and the per-row identities behind them.
47
+ *
48
+ * A candidate read keeps its own map until the commit boundary adopts it, so a render React
49
+ * discards cannot replace the view a committed subscriber last read.
50
+ */
51
+ export class ArrayBindings {
52
+ committed = new Map();
53
+ rows = new Map();
54
+ candidate;
55
+ /** The view of one array field, reusing every row object the ordered identity still holds. */
56
+ read(owner, committed, engine, fieldId) {
57
+ const keys = engine
58
+ .getFormState()
59
+ .fields.find((field) => field.fieldId === fieldId)?.addressableRows;
60
+ const state = engine.getField(fieldId);
61
+ const mutations = mutationsOf(state.access, state.enabled, keys?.length ?? 0);
62
+ const views = committed ? this.committed : this.candidateViews(owner);
63
+ const previous = views.get(fieldId) ?? this.committed.get(fieldId);
64
+ const rows = committed
65
+ ? this.committedRowsOf(fieldId, keys ?? [], state.rowAddressing)
66
+ : this.rowObjectsOf(fieldId, keys ?? [], state.rowAddressing);
67
+ if (previous !== undefined &&
68
+ sameRowOrder(previous.rows, rows) &&
69
+ sameMutations(previous.mutations, mutations)) {
70
+ return previous;
71
+ }
72
+ const view = Object.freeze({ fieldId, rows, mutations });
73
+ views.set(fieldId, view);
74
+ return view;
75
+ }
76
+ /**
77
+ * Drops one row's identity object. A row that left the array is never rendered again, and the
78
+ * object it was given holds its key; a row that returns is handed a fresh one.
79
+ */
80
+ retireRow(fieldId, rowKey) {
81
+ if (rowKey === undefined)
82
+ return;
83
+ this.rows.delete(bindingKey(fieldId, rowKey));
84
+ }
85
+ /** How many row identities are retained, so a churned list can be counted. */
86
+ retainedRows() {
87
+ return this.rows.size;
88
+ }
89
+ /** Drops every row identity and view; a reset starts from the new record's rows. */
90
+ clear() {
91
+ this.committed.clear();
92
+ this.rows.clear();
93
+ this.candidate = undefined;
94
+ }
95
+ /** Adopts the views a committed render read; unread fields keep their committed view. */
96
+ commit(owner) {
97
+ if (this.candidate?.owner !== owner)
98
+ return;
99
+ for (const [fieldId, view] of this.candidate.views)
100
+ this.committed.set(fieldId, view);
101
+ this.candidate = undefined;
102
+ }
103
+ /** The view committed state last read, or `undefined` before its first read. */
104
+ current(fieldId) {
105
+ return this.committed.get(fieldId);
106
+ }
107
+ /**
108
+ * Forgets one array's published view while keeping the identity of every row it still holds.
109
+ *
110
+ * A declined structural write moves no committed row, but its controlled list still repaints.
111
+ */
112
+ retireView(fieldId) {
113
+ this.committed.delete(fieldId);
114
+ this.candidate?.views.delete(fieldId);
115
+ }
116
+ row(fieldId, rowKey, addressing) {
117
+ const key = bindingKey(fieldId, rowKey);
118
+ const cached = this.rows.get(key);
119
+ if (cached !== undefined)
120
+ return cached;
121
+ const rowName = addressing === 'natural' || addressing === 'value' ? String(rowKey) : undefined;
122
+ const row = Object.freeze({
123
+ rowKey,
124
+ bindingKey: key,
125
+ ...(rowName === undefined ? {} : { rowName }),
126
+ });
127
+ this.rows.set(key, row);
128
+ return row;
129
+ }
130
+ /**
131
+ * The row objects one field's committed keys name, with the identities of rows it no longer
132
+ * holds dropped first. A list that appends and removes rows must not keep one `RowRef` per row
133
+ * it has ever shown.
134
+ *
135
+ * Only a committed read prunes: a candidate render may be discarded, and the row it dropped
136
+ * from its own tree was never actually removed from the list a committed subscriber shows.
137
+ */
138
+ committedRowsOf(fieldId, keys, addressing) {
139
+ const live = new Set(keys.map((rowKey) => bindingKey(fieldId, rowKey)));
140
+ const prefix = `${fieldId}@`;
141
+ for (const key of this.rows.keys()) {
142
+ if (key.startsWith(prefix) && !live.has(key))
143
+ this.rows.delete(key);
144
+ }
145
+ return this.rowObjectsOf(fieldId, keys, addressing);
146
+ }
147
+ rowObjectsOf(fieldId, keys, addressing) {
148
+ return Object.freeze(keys.map((rowKey) => this.row(fieldId, rowKey, addressing)));
149
+ }
150
+ candidateViews(owner) {
151
+ if (this.candidate?.owner !== owner)
152
+ this.candidate = { owner, views: new Map() };
153
+ return this.candidate.views;
154
+ }
155
+ }
156
+ /**
157
+ * What the container's access and enabled answers permit.
158
+ *
159
+ * The predicate is the runtime's own `permitsUserWrite`, the one the engine's structural guard
160
+ * calls, so the advertisement and the answer cannot diverge: `read_write` and the append-only
161
+ * `write_only` both permit a structural write, and a failed `enabled` rule permits none. A
162
+ * disabled container therefore offers nothing, while a `write_only` one offers exactly what a
163
+ * `read_write` one does. Row count only narrows which of the four are meaningful.
164
+ */
165
+ function mutationsOf(access, enabled, rowCount) {
166
+ if (!permitsUserWrite(access) || !enabled)
167
+ return NO_MUTATIONS;
168
+ if (rowCount === 0) {
169
+ // There is no row to remove or move yet; a row can still be added, or the whole list
170
+ // replaced with one that has some.
171
+ return Object.freeze({ append: true, insert: true, remove: false, move: false, replace: true });
172
+ }
173
+ return Object.freeze({
174
+ append: true,
175
+ insert: true,
176
+ remove: true,
177
+ move: rowCount > 1,
178
+ replace: true,
179
+ });
180
+ }
181
+ //# sourceMappingURL=array-bindings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array-bindings.js","sourceRoot":"","sources":["../../src/store/array-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA6C3C,MAAM,YAAY,GAAwB,MAAM,CAAC,MAAM,CAAC;IACtD,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,KAAK;IACX,OAAO,EAAE,KAAK;CACf,CAAC,CAAC;AAEH,SAAS,YAAY,CAAC,IAAuB,EAAE,KAAwB;IACrE,OAAO,CACL,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;QAC5B,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YACxB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;YAC3B,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,CAAC,UAAU,CAAC;Q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engine, FieldAccess, RowAddressing, WireValue } from '@azx-pbc/axiom-runtime';\nimport { bindingKey } from './bindings.js';\n\n/**\n * One row of an array binding, addressed by the identity the engine holds for it.\n *\n * The object is reused for as long as the row exists at any position, so a reorder changes the\n * order of the list and the identities of its entries, not the entries themselves. A React\n * `key`, a memo boundary and the engine's own row baseline therefore all agree across a move.\n */\nexport interface RowRef {\n readonly rowKey: string | number;\n /** `fieldId@<wire-typed row key>`: the key a row control binds under. */\n readonly bindingKey: string;\n /**\n * The row's own name, when its key is authored text rather than an id the host minted.\n *\n * A renderer paints this name or falls back to the row's position. It never inspects the key's\n * spelling, because the declaration's addressing is the one place that answer is known.\n */\n readonly rowName?: string;\n}\n\n/** Which structural operations the container's committed state permits. */\nexport interface FieldArrayMutations {\n readonly append: boolean;\n readonly insert: boolean;\n readonly remove: boolean;\n readonly move: boolean;\n /** Replace every row at once; a whole-container write, gated like `append`. */\n readonly replace: boolean;\n}\n\n/**\n * One array binding's committed structure: its rows in order and what may be done to them.\n *\n * The view is what `useFieldArray` publishes. Its identity changes only when the ordered row\n * identities or the mutation permissions change, never when one row's value changes — which is\n * what keeps an edit to row three from re-rendering the list that holds it.\n */\nexport interface FieldArrayView {\n readonly fieldId: string;\n readonly rows: readonly RowRef[];\n readonly mutations: FieldArrayMutations;\n}\n\nconst NO_MUTATIONS: FieldArrayMutations = Object.freeze({\n append: false,\n insert: false,\n remove: false,\n move: false,\n replace: false,\n});\n\nfunction sameRowOrder(left: readonly RowRef[], right: readonly RowRef[]): boolean {\n return (\n left.length === right.length &&\n left.every((row, index) => {\n const other = right[index];\n return other !== undefined && other.bindingKey === row.bindingKey;\n })\n );\n}\n\nfunction sameMutations(left: FieldArrayMutations, right: FieldArrayMutations): boolean {\n return (\n left.append === right.append &&\n left.insert === right.insert &&\n left.remove === right.remove &&\n left.move === right.move &&\n left.replace === right.replace\n );\n}\n\n/** The five structural operations one array binding is handed, with stable identities. */\nexport interface FieldArrayControls {\n readonly append: (value: WireValue) => void;\n readonly insert: (index: number, value: WireValue) => void;\n readonly remove: (rowKey: string | number) => void;\n readonly move: (fromIndex: number, toIndex: number) => void;\n readonly moveRow: (rowKey: string | number, toIndex: number) => void;\n /** React Hook Form's `replace`: the whole list in one write. */\n readonly replace: (values: readonly WireValue[]) => void;\n}\n\n/**\n * The object one `useFieldArray` consumer renders: the view plus the callbacks.\n *\n * The composite is memoised by the view identity, so the snapshot `useSyncExternalStore`\n * compares is the same object until the structure or a permission actually moved.\n */\nexport interface FieldArray extends FieldArrayView, FieldArrayControls {}\n\nconst COMPOSITE = new WeakMap<FieldArrayView, FieldArray>();\n\nexport function fieldArrayOf(view: FieldArrayView, controls: FieldArrayControls): FieldArray {\n const cached = COMPOSITE.get(view);\n if (cached !== undefined) return cached;\n const array: FieldArray = Object.freeze({ ...view, ...controls });\n COMPOSITE.set(view, array);\n return array;\n}\n\n/** The controls of each array field, built once so a memoised row sees a stable callback. */\nexport class ArrayWriters {\n private readonly controls = new Map<string, FieldArrayControls>();\n\n for(fieldId: string, build: () => FieldArrayControls): FieldArrayControls {\n const cached = this.controls.get(fieldId);\n if (cached !== undefined) return cached;\n const controls = build();\n this.controls.set(fieldId, controls);\n return controls;\n }\n}\n\n/**\n * The committed array views, and the per-row identities behind them.\n *\n * A candidate read keeps its own map until the commit boundary adopts it, so a render React\n * discards cannot replace the view a committed subscriber last read.\n */\nexport class ArrayBindings {\n private readonly committed = new Map<string, FieldArrayView>();\n private readonly rows = new Map<string, RowRef>();\n private candidate:\n | { readonly owner: object; readonly views: Map<string, FieldArrayView> }\n | undefined;\n\n /** The view of one array field, reusing every row object the ordered identity still holds. */\n read(owner: object, committed: boolean, engine: Engine, fieldId: string): FieldArrayView {\n const keys = engine\n .getFormState()\n .fields.find((field) => field.fieldId === fieldId)?.addressableRows;\n const state = engine.getField(fieldId);\n const mutations = mutationsOf(state.access, state.enabled, keys?.length ?? 0);\n const views = committed ? this.committed : this.candidateViews(owner);\n const previous = views.get(fieldId) ?? this.committed.get(fieldId);\n const rows = committed\n ? this.committedRowsOf(fieldId, keys ?? [], state.rowAddressing)\n : this.rowObjectsOf(fieldId, keys ?? [], state.rowAddressing);\n if (\n previous !== undefined &&\n sameRowOrder(previous.rows, rows) &&\n sameMutations(previous.mutations, mutations)\n ) {\n return previous;\n }\n const view: FieldArrayView = Object.freeze({ fieldId, rows, mutations });\n views.set(fieldId, view);\n return view;\n }\n\n /**\n * Drops one row's identity object. A row that left the array is never rendered again, and the\n * object it was given holds its key; a row that returns is handed a fresh one.\n */\n retireRow(fieldId: string, rowKey: string | number | undefined): void {\n if (rowKey === undefined) return;\n this.rows.delete(bindingKey(fieldId, rowKey));\n }\n\n /** How many row identities are retained, so a churned list can be counted. */\n retainedRows(): number {\n return this.rows.size;\n }\n\n /** Drops every row identity and view; a reset starts from the new record's rows. */\n clear(): void {\n this.committed.clear();\n this.rows.clear();\n this.candidate = undefined;\n }\n\n /** Adopts the views a committed render read; unread fields keep their committed view. */\n commit(owner: object): void {\n if (this.candidate?.owner !== owner) return;\n for (const [fieldId, view] of this.candidate.views) this.committed.set(fieldId, view);\n this.candidate = undefined;\n }\n\n /** The view committed state last read, or `undefined` before its first read. */\n current(fieldId: string): FieldArrayView | undefined {\n return this.committed.get(fieldId);\n }\n\n /**\n * Forgets one array's published view while keeping the identity of every row it still holds.\n *\n * A declined structural write moves no committed row, but its controlled list still repaints.\n */\n retireView(fieldId: string): void {\n this.committed.delete(fieldId);\n this.candidate?.views.delete(fieldId);\n }\n\n private row(\n fieldId: string,\n rowKey: string | number,\n addressing: RowAddressing | undefined,\n ): RowRef {\n const key = bindingKey(fieldId, rowKey);\n const cached = this.rows.get(key);\n if (cached !== undefined) return cached;\n const rowName = addressing === 'natural' || addressing === 'value' ? String(rowKey) : undefined;\n const row: RowRef = Object.freeze({\n rowKey,\n bindingKey: key,\n ...(rowName === undefined ? {} : { rowName }),\n });\n this.rows.set(key, row);\n return row;\n }\n\n /**\n * The row objects one field's committed keys name, with the identities of rows it no longer\n * holds dropped first. A list that appends and removes rows must not keep one `RowRef` per row\n * it has ever shown.\n *\n * Only a committed read prunes: a candidate render may be discarded, and the row it dropped\n * from its own tree was never actually removed from the list a committed subscriber shows.\n */\n private committedRowsOf(\n fieldId: string,\n keys: readonly (string | number)[],\n addressing: RowAddressing | undefined,\n ): readonly RowRef[] {\n const live = new Set(keys.map((rowKey) => bindingKey(fieldId, rowKey)));\n const prefix = `${fieldId}@`;\n for (const key of this.rows.keys()) {\n if (key.startsWith(prefix) && !live.has(key)) this.rows.delete(key);\n }\n return this.rowObjectsOf(fieldId, keys, addressing);\n }\n\n private rowObjectsOf(\n fieldId: string,\n keys: readonly (string | number)[],\n addressing: RowAddressing | undefined,\n ): readonly RowRef[] {\n return Object.freeze(keys.map((rowKey) => this.row(fieldId, rowKey, addressing)));\n }\n\n private candidateViews(owner: object): Map<string, FieldArrayView> {\n if (this.candidate?.owner !== owner) this.candidate = { owner, views: new Map() };\n return this.candidate.views;\n }\n}\n\n/**\n * What the container's access and enabled answers permit.\n *\n * The predicate is the runtime's own `permitsUserWrite`, the one the engine's structural guard\n * calls, so the advertisement and the answer cannot diverge: `read_write` and the append-only\n * `write_only` both permit a structural write, and a failed `enabled` rule permits none. A\n * disabled container therefore offers nothing, while a `write_only` one offers exactly what a\n * `read_write` one does. Row count only narrows which of the four are meaningful.\n */\nfunction mutationsOf(access: FieldAccess, enabled: boolean, rowCount: number): FieldArrayMutations {\n if (!permitsUserWrite(access) || !enabled) return NO_MUTATIONS;\n if (rowCount === 0) {\n // There is no row to remove or move yet; a row can still be added, or the whole list\n // replaced with one that has some.\n return Object.freeze({ append: true, insert: true, remove: false, move: false, replace: true });\n }\n return Object.freeze({\n append: true,\n insert: true,\n remove: true,\n move: rowCount > 1,\n replace: true,\n });\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import type { FieldRef } from '@azx-pbc/axiom-runtime';
2
+ /**
3
+ * The key one binding is registered, cached and summarised under.
4
+ *
5
+ * It is the runtime's own `fieldKey`, so the integer row `1` and the text row `"1"` are two
6
+ * bindings (`[IDENT-4.1.3]`) and a React cache cannot collapse two rows the engine keeps apart.
7
+ * A field binding is keyed by its id alone; a row binding carries the row's wire-typed key.
8
+ */
9
+ export declare function bindingKey(fieldId: string, rowKey: string | number | undefined): string;
10
+ /** The reference a binding key names. */
11
+ export declare function bindingRef(fieldId: string, rowKey: string | number | undefined): FieldRef;
12
+ //# sourceMappingURL=bindings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../../src/store/bindings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAEvF;AAED,yCAAyC;AACzC,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAEzF"}
@@ -0,0 +1,16 @@
1
+ import { fieldKey } from '@azx-pbc/axiom-runtime';
2
+ /**
3
+ * The key one binding is registered, cached and summarised under.
4
+ *
5
+ * It is the runtime's own `fieldKey`, so the integer row `1` and the text row `"1"` are two
6
+ * bindings (`[IDENT-4.1.3]`) and a React cache cannot collapse two rows the engine keeps apart.
7
+ * A field binding is keyed by its id alone; a row binding carries the row's wire-typed key.
8
+ */
9
+ export function bindingKey(fieldId, rowKey) {
10
+ return fieldKey(rowKey === undefined ? { fieldId } : { fieldId, rowKey });
11
+ }
12
+ /** The reference a binding key names. */
13
+ export function bindingRef(fieldId, rowKey) {
14
+ return rowKey === undefined ? { fieldId } : { fieldId, rowKey };
15
+ }
16
+ //# sourceMappingURL=bindings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindings.js","sourceRoot":"","sources":["../../src/store/bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,MAAmC;IAC7E,OAAO,QAAQ,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED,yCAAyC;AACzC,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,MAAmC;IAC7E,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAClE,CAAC","sourcesContent":["import { fieldKey } from '@azx-pbc/axiom-runtime';\nimport type { FieldRef } from '@azx-pbc/axiom-runtime';\n\n/**\n * The key one binding is registered, cached and summarised under.\n *\n * It is the runtime's own `fieldKey`, so the integer row `1` and the text row `\"1\"` are two\n * bindings (`[IDENT-4.1.3]`) and a React cache cannot collapse two rows the engine keeps apart.\n * A field binding is keyed by its id alone; a row binding carries the row's wire-typed key.\n */\nexport function bindingKey(fieldId: string, rowKey: string | number | undefined): string {\n return fieldKey(rowKey === undefined ? { fieldId } : { fieldId, rowKey });\n}\n\n/** The reference a binding key names. */\nexport function bindingRef(fieldId: string, rowKey: string | number | undefined): FieldRef {\n return rowKey === undefined ? { fieldId } : { fieldId, rowKey };\n}\n"]}
@@ -0,0 +1,42 @@
1
+ import type { WireValue } from '@azx-pbc/axiom-runtime';
2
+ import type { FormatContract, ParseOutcome } from './parse-print.js';
3
+ /**
4
+ * The text one buffered control holds, the committed value it last edited against, and the
5
+ * contract it was read under.
6
+ *
7
+ * The committed wire value is authoritative. Text exists only while the entry is still being
8
+ * typed or while it differs from the printed value, and the baseline is what makes that
9
+ * decision: a buffer that was clean when the value changed is resynced, and a buffer the user
10
+ * is mid-way through is never clobbered. The contract is carried so a change of locale marks is
11
+ * visible to the buffer: the punctuation a text was typed under is part of its identity.
12
+ */
13
+ export interface BufferState {
14
+ readonly text: string;
15
+ /** The committed value the text was entered against. */
16
+ readonly baseline: WireValue | undefined;
17
+ /** The contract the text was read and printed under. */
18
+ readonly contract: FormatContract;
19
+ }
20
+ /** A fresh buffer showing the committed value. */
21
+ export declare function startBuffer(value: WireValue | undefined, contract: FormatContract): BufferState;
22
+ /** The user's entry: the text is kept as typed, beside the value it was typed against. */
23
+ export declare function editBuffer(text: string, value: WireValue | undefined, contract: FormatContract): BufferState;
24
+ /**
25
+ * The text to show: the typed entry, unless the value changed underneath a clean buffer or the
26
+ * control reads another punctuation.
27
+ *
28
+ * A clean buffer is one the committed value already answers — `0.50` typed for `0.5`, or the
29
+ * printed text itself — so an external update replaces it. A buffer that holds an entry the
30
+ * value does not answer is the user's, and the update leaves it alone.
31
+ *
32
+ * A contract change is a different question with the same test: a clean buffer was the printed
33
+ * text under the old marks, so it is re-printed under the new ones (`123.45` becomes `123,45`).
34
+ * A dirty buffer keeps exactly what the user typed, because the value does not answer it and the
35
+ * new marks must not rewrite a half-typed entry.
36
+ */
37
+ export declare function bufferText(state: BufferState, committed: WireValue | undefined, contract: FormatContract): string;
38
+ /** What the text on screen means, so a commit and a control read one answer. */
39
+ export declare function bufferParse(state: BufferState, committed: WireValue | undefined, contract: FormatContract): ParseOutcome;
40
+ /** Whether one parse states the committed value: a held or refused entry states none. */
41
+ export declare function entryDirty(parsed: ParseOutcome, committed: WireValue | undefined): boolean;
42
+ //# sourceMappingURL=buffer-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buffer-state.d.ts","sourceRoot":"","sources":["../../src/store/buffer-state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErE;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,CAAC;IACzC,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACnC;AAED,kDAAkD;AAClD,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,EAAE,QAAQ,EAAE,cAAc,GAAG,WAAW,CAE/F;AAED,0FAA0F;AAC1F,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,GAAG,SAAS,EAC5B,QAAQ,EAAE,cAAc,GACvB,WAAW,CAEb;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,QAAQ,EAAE,cAAc,GACvB,MAAM,CAIR;AAgBD,gFAAgF;AAChF,wBAAgB,WAAW,CACzB,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,QAAQ,EAAE,cAAc,GACvB,YAAY,CAEd;AAED,yFAAyF;AACzF,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAE1F"}
@@ -0,0 +1,51 @@
1
+ import { sameWireValue } from '@azx-pbc/axiom-runtime';
2
+ import { contractSignature, parseEntry, printEntry } from './parse-print.js';
3
+ /** A fresh buffer showing the committed value. */
4
+ export function startBuffer(value, contract) {
5
+ return { text: printEntry(value, contract), baseline: value, contract };
6
+ }
7
+ /** The user's entry: the text is kept as typed, beside the value it was typed against. */
8
+ export function editBuffer(text, value, contract) {
9
+ return { text, baseline: value, contract };
10
+ }
11
+ /**
12
+ * The text to show: the typed entry, unless the value changed underneath a clean buffer or the
13
+ * control reads another punctuation.
14
+ *
15
+ * A clean buffer is one the committed value already answers — `0.50` typed for `0.5`, or the
16
+ * printed text itself — so an external update replaces it. A buffer that holds an entry the
17
+ * value does not answer is the user's, and the update leaves it alone.
18
+ *
19
+ * A contract change is a different question with the same test: a clean buffer was the printed
20
+ * text under the old marks, so it is re-printed under the new ones (`123.45` becomes `123,45`).
21
+ * A dirty buffer keeps exactly what the user typed, because the value does not answer it and the
22
+ * new marks must not rewrite a half-typed entry.
23
+ */
24
+ export function bufferText(state, committed, contract) {
25
+ const sameContract = contractSignature(state.contract) === contractSignature(contract);
26
+ if (sameContract && sameBufferValue(state.baseline, committed))
27
+ return state.text;
28
+ return bufferClean(state) ? printEntry(committed, contract) : state.text;
29
+ }
30
+ /** Whether the buffer's text names exactly the value it was entered against. */
31
+ function bufferClean(state) {
32
+ const parsed = parseEntry(state.text, state.contract);
33
+ return parsed.kind === 'value' && sameBufferValue(parsed.value, state.baseline);
34
+ }
35
+ /** `empty()` semantics first: the authored `null` and an absent value are one empty state. */
36
+ function sameBufferValue(left, right) {
37
+ const emptyLeft = left === undefined || left === null;
38
+ const emptyRight = right === undefined || right === null;
39
+ if (emptyLeft || emptyRight)
40
+ return emptyLeft && emptyRight;
41
+ return sameWireValue(left, right);
42
+ }
43
+ /** What the text on screen means, so a commit and a control read one answer. */
44
+ export function bufferParse(state, committed, contract) {
45
+ return parseEntry(bufferText(state, committed, contract), contract);
46
+ }
47
+ /** Whether one parse states the committed value: a held or refused entry states none. */
48
+ export function entryDirty(parsed, committed) {
49
+ return parsed.kind === 'value' ? !sameBufferValue(parsed.value, committed) : true;
50
+ }
51
+ //# sourceMappingURL=buffer-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buffer-state.js","sourceRoot":"","sources":["../../src/store/buffer-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAqB7E,kDAAkD;AAClD,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AAK,KAAK,IAAI,CAAC;IACzD,IAAI,SAAS,IAAI,UAAU;QAAE,OAAO,SAAS,IAAI,UAAU,CAAC;IAC5D,OAAO,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACpC,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,WAAW,CACzB,KAAkB,EAClB,SAAgC,EAChC,QAAwB;IAExB,OAAO,UAAU,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;AACtE,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,UAAU,CAAC,MAAoB,EAAE,SAAgC;IAC/E,OAAO,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpF,CAAC","sourcesContent":["import { sameWireValue } from '@azx-pbc/axiom-runtime';\nimport type { WireValue } from '@azx-pbc/axiom-runtime';\nimport { contractSignature, parseEntry, printEntry } from './parse-print.js';\nimport type { FormatContract, ParseOutcome } from './parse-print.js';\n\n/**\n * The text one buffered control holds, the committed value it last edited against, and the\n * contract it was read under.\n *\n * The committed wire value is authoritative. Text exists only while the entry is still being\n * typed or while it differs from the printed value, and the baseline is what makes that\n * decision: a buffer that was clean when the value changed is resynced, and a buffer the user\n * is mid-way through is never clobbered. The contract is carried so a change of locale marks is\n * visible to the buffer: the punctuation a text was typed under is part of its identity.\n */\nexport interface BufferState {\n readonly text: string;\n /** The committed value the text was entered against. */\n readonly baseline: WireValue | undefined;\n /** The contract the text was read and printed under. */\n readonly contract: FormatContract;\n}\n\n/** A fresh buffer showing the committed value. */\nexport function startBuffer(value: WireValue | undefined, contract: FormatContract): BufferState {\n return { text: printEntry(value, contract), baseline: value, contract };\n}\n\n/** The user's entry: the text is kept as typed, beside the value it was typed against. */\nexport function editBuffer(\n text: string,\n value: WireValue | undefined,\n contract: FormatContract,\n): BufferState {\n return { text, baseline: value, contract };\n}\n\n/**\n * The text to show: the typed entry, unless the value changed underneath a clean buffer or the\n * control reads another punctuation.\n *\n * A clean buffer is one the committed value already answers — `0.50` typed for `0.5`, or the\n * printed text itself — so an external update replaces it. A buffer that holds an entry the\n * value does not answer is the user's, and the update leaves it alone.\n *\n * A contract change is a different question with the same test: a clean buffer was the printed\n * text under the old marks, so it is re-printed under the new ones (`123.45` becomes `123,45`).\n * A dirty buffer keeps exactly what the user typed, because the value does not answer it and the\n * new marks must not rewrite a half-typed entry.\n */\nexport function bufferText(\n state: BufferState,\n committed: WireValue | undefined,\n contract: FormatContract,\n): string {\n const sameContract = contractSignature(state.contract) === contractSignature(contract);\n if (sameContract && sameBufferValue(state.baseline, committed)) return state.text;\n return bufferClean(state) ? printEntry(committed, contract) : state.text;\n}\n\n/** Whether the buffer's text names exactly the value it was entered against. */\nfunction bufferClean(state: BufferState): boolean {\n const parsed = parseEntry(state.text, state.contract);\n return parsed.kind === 'value' && sameBufferValue(parsed.value, state.baseline);\n}\n\n/** `empty()` semantics first: the authored `null` and an absent value are one empty state. */\nfunction sameBufferValue(left: WireValue | undefined, right: WireValue | undefined): boolean {\n const emptyLeft = left === undefined || left === null;\n const emptyRight = right === undefined || right === null;\n if (emptyLeft || emptyRight) return emptyLeft && emptyRight;\n return sameWireValue(left, right);\n}\n\n/** What the text on screen means, so a commit and a control read one answer. */\nexport function bufferParse(\n state: BufferState,\n committed: WireValue | undefined,\n contract: FormatContract,\n): ParseOutcome {\n return parseEntry(bufferText(state, committed, contract), contract);\n}\n\n/** Whether one parse states the committed value: a held or refused entry states none. */\nexport function entryDirty(parsed: ParseOutcome, committed: WireValue | undefined): boolean {\n return parsed.kind === 'value' ? !sameBufferValue(parsed.value, committed) : true;\n}\n"]}
@@ -0,0 +1,19 @@
1
+ import type { CompiledSchema, Engine, IdFactory, WireValue } from '@azx-pbc/axiom-runtime';
2
+ import type { FieldRef } from '@azx-pbc/axiom-runtime';
3
+ import type { SessionInputs } from './inputs.js';
4
+ /**
5
+ * Opens the one engine a session's resolved inputs describe.
6
+ *
7
+ * The engine is the only evaluation path: the React layer never evaluates the record itself,
8
+ * so a control's state and the guard that judges its write cannot come from two answers. The
9
+ * host's resolved inputs travel in the engine's input, which is where the access vocabulary,
10
+ * the redaction list and the session's writes belong; the ports carry the row-id factory a
11
+ * session with an assigned-row array needs, and nothing stands in for one the host did not
12
+ * supply.
13
+ *
14
+ * A refused record raises the engine's own boundary error — `SessionRefusedError` for an
15
+ * identity refusal, the runtime's `AxiomError` for a malformed value — before any state is
16
+ * adopted, so a session is never left half-opened.
17
+ */
18
+ export declare function openEngine(compiled: CompiledSchema, inputs: SessionInputs, values: Readonly<Record<string, WireValue>>, sessionWrites: readonly FieldRef[], idFactory: IdFactory | undefined, identity: Readonly<Record<string, readonly string[]>> | undefined): Engine;
19
+ //# sourceMappingURL=configure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../src/store/configure.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,EAC3C,aAAa,EAAE,SAAS,QAAQ,EAAE,EAClC,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS,GAChE,MAAM,CAUR"}
@@ -0,0 +1,28 @@
1
+ import { createEngine } from '@azx-pbc/axiom-runtime';
2
+ import { evaluationInputOf } from './inputs.js';
3
+ /**
4
+ * Opens the one engine a session's resolved inputs describe.
5
+ *
6
+ * The engine is the only evaluation path: the React layer never evaluates the record itself,
7
+ * so a control's state and the guard that judges its write cannot come from two answers. The
8
+ * host's resolved inputs travel in the engine's input, which is where the access vocabulary,
9
+ * the redaction list and the session's writes belong; the ports carry the row-id factory a
10
+ * session with an assigned-row array needs, and nothing stands in for one the host did not
11
+ * supply.
12
+ *
13
+ * A refused record raises the engine's own boundary error — `SessionRefusedError` for an
14
+ * identity refusal, the runtime's `AxiomError` for a malformed value — before any state is
15
+ * adopted, so a session is never left half-opened.
16
+ */
17
+ export function openEngine(compiled, inputs, values, sessionWrites, idFactory, identity) {
18
+ return createEngine(compiled, {
19
+ input: evaluationInputOf(inputs, values, sessionWrites),
20
+ env: inputs.env,
21
+ ...(identity === undefined ? {} : { identity }),
22
+ ports: {
23
+ ...(idFactory === undefined ? {} : { idFactory }),
24
+ ...(inputs.optionDomains === undefined ? {} : { optionDomains: inputs.optionDomains }),
25
+ },
26
+ });
27
+ }
28
+ //# sourceMappingURL=configure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.js","sourceRoot":"","sources":["../../src/store/configure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,UAAU,CACxB,QAAwB,EACxB,MAAqB,EACrB,MAA2C,EAC3C,aAAkC,EAClC,SAAgC,EAChC,QAAiE;IAEjE,OAAO,YAAY,CAAC,QAAQ,EAAE;QAC5B,KAAK,EAAE,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC;QACvD,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;QAC/C,KAAK,EAAE;YACL,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;YACjD,GAAG,CAAC,MAAM,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;SACvF;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { createEngine } from '@azx-pbc/axiom-runtime';\nimport type { CompiledSchema, Engine, IdFactory, WireValue } from '@azx-pbc/axiom-runtime';\nimport type { FieldRef } from '@azx-pbc/axiom-runtime';\nimport { evaluationInputOf } from './inputs.js';\nimport type { SessionInputs } from './inputs.js';\n\n/**\n * Opens the one engine a session's resolved inputs describe.\n *\n * The engine is the only evaluation path: the React layer never evaluates the record itself,\n * so a control's state and the guard that judges its write cannot come from two answers. The\n * host's resolved inputs travel in the engine's input, which is where the access vocabulary,\n * the redaction list and the session's writes belong; the ports carry the row-id factory a\n * session with an assigned-row array needs, and nothing stands in for one the host did not\n * supply.\n *\n * A refused record raises the engine's own boundary error — `SessionRefusedError` for an\n * identity refusal, the runtime's `AxiomError` for a malformed value — before any state is\n * adopted, so a session is never left half-opened.\n */\nexport function openEngine(\n compiled: CompiledSchema,\n inputs: SessionInputs,\n values: Readonly<Record<string, WireValue>>,\n sessionWrites: readonly FieldRef[],\n idFactory: IdFactory | undefined,\n identity: Readonly<Record<string, readonly string[]>> | undefined,\n): Engine {\n return createEngine(compiled, {\n input: evaluationInputOf(inputs, values, sessionWrites),\n env: inputs.env,\n ...(identity === undefined ? {} : { identity }),\n ports: {\n ...(idFactory === undefined ? {} : { idFactory }),\n ...(inputs.optionDomains === undefined ? {} : { optionDomains: inputs.optionDomains }),\n },\n });\n}\n"]}
@@ -0,0 +1,106 @@
1
+ import type { CompiledField, EngineFieldState, EvaluatedSuggestion, ScreenReason, WireValue } from '@azx-pbc/axiom-runtime';
2
+ import type { FieldProps } from '../field-props.js';
3
+ import type { FieldError } from '../field-error.js';
4
+ import type { ValueDisplay } from '../render/value-text.js';
5
+ import type { RowKeyFieldError } from '../field-error.js';
6
+ import type { BindingVisibility, ShowErrorsPolicy } from './visibility.js';
7
+ /** The display-only inputs a provider supplies; none of them reaches an evaluation. */
8
+ export interface DisplayOptions {
9
+ /** When a decided failure is painted; the one policy that governs every binding. */
10
+ readonly reveal: ShowErrorsPolicy;
11
+ readonly maskedDisplay: Readonly<Record<string, string>> | undefined;
12
+ /**
13
+ * The host's display formatter for a value a control shows but does not edit.
14
+ *
15
+ * It answers the text a boolean, a list, a money amount or any other value reads as in the
16
+ * host's locale. The library ships no words of its own: without this port a boolean and a list
17
+ * render as empty text rather than as the English `true`/`false` or a comma-joined list.
18
+ */
19
+ readonly valueDisplay: ValueDisplay | undefined;
20
+ /**
21
+ * The prefix every element id this session emits begins with.
22
+ *
23
+ * It is what keeps two providers over one artifact from emitting the same `id`, `htmlFor` and
24
+ * `aria-describedby` values: `bindingKey` is identical in both, so the session has to state
25
+ * its own identity. `FormProvider` settles it once per mount — the host's `idPrefix` when it
26
+ * names one, `useId()` otherwise — and the store carries it on every display it derives, so
27
+ * the id of a binding never depends on which pass or which hook read it.
28
+ */
29
+ readonly idPrefix: string;
30
+ }
31
+ /** The session facts the engine does not own, per binding. */
32
+ export interface BindingView {
33
+ /** Whether the user has visited this binding: a blur, or a deliberate write. */
34
+ readonly touched: boolean;
35
+ /** Whether an explicit blur recorded the visit, which the legacy `onBlur` mode reads. */
36
+ readonly blurred: boolean;
37
+ /** Whether the user deliberately wrote this binding. */
38
+ readonly changed: boolean;
39
+ /** Whether a submit has been attempted in this session. */
40
+ readonly submitted: boolean;
41
+ /** Whether a submission is in flight, the state `aria-busy` announces for a deferred binding. */
42
+ readonly submitting: boolean;
43
+ /** The last entry the session refused because it would break row identity. */
44
+ readonly refusal: RowKeyFieldError | undefined;
45
+ /** The failures this binding has already painted, which stay painted while they are true. */
46
+ readonly revealed: ReadonlySet<string>;
47
+ /** The value the device was delivered at the baseline, which `initialValue` reports. */
48
+ readonly initialValue: WireValue | undefined;
49
+ /** The value the *record* held at the baseline; `dirty` compares against this one. */
50
+ readonly initialHeld: WireValue | undefined;
51
+ }
52
+ /** The stable callbacks one binding's control is handed. */
53
+ export interface BindingWriters {
54
+ readonly setValue: (value: WireValue) => void;
55
+ readonly setNull: () => void;
56
+ readonly removeValue: () => void;
57
+ readonly onBlur: () => void;
58
+ }
59
+ /** Everything one binding's props are derived from. */
60
+ export interface DeriveContext {
61
+ readonly state: EngineFieldState;
62
+ readonly descriptor: CompiledField;
63
+ readonly bindingKey: string;
64
+ readonly view: BindingView;
65
+ readonly display: DisplayOptions;
66
+ readonly visibility: BindingVisibility;
67
+ readonly writers: BindingWriters;
68
+ readonly signature: string;
69
+ }
70
+ /**
71
+ * Maps one engine binding state to the props a control renders.
72
+ *
73
+ * The engine owns visibility, access, delivery, the computed value and the messages; this adds
74
+ * only what a session and a host own — the value's move from its baseline, the touch flag, the
75
+ * display rule and the input hints — so there is no second classifier and no second access
76
+ * resolver here.
77
+ */
78
+ export declare function deriveFieldProps(context: DeriveContext): FieldProps;
79
+ /**
80
+ * Whether a binding's value moved from the session's baseline, with `empty()` semantics.
81
+ *
82
+ * The comparison is against the value the *record* held, which no access answer can change: a
83
+ * value that becomes readable was always there, so widening a mask over an untouched record is
84
+ * not an edit. A value a writer owns is derived from the record rather than entered in it, so it
85
+ * is never an edit either. A value this device may not read is one it cannot compare — and one
86
+ * the submission projection would not carry — so it is reported as unmoved rather than guessed at.
87
+ */
88
+ export declare function dirtyOf(state: EngineFieldState, view: BindingView): boolean;
89
+ /** Whether two derivations say the same thing, so a re-derivation keeps the props identity. */
90
+ export declare function sameFieldProps(left: FieldProps, right: FieldProps): boolean;
91
+ /** Whether two message parameter sets state the same arguments, at any depth. */
92
+ export declare function sameWireParams(left: Readonly<Record<string, WireValue>> | undefined, right: Readonly<Record<string, WireValue>> | undefined): boolean;
93
+ /** Whether two evaluated alternatives state the same operations and concrete values. */
94
+ export declare function sameSuggestions(left: readonly EvaluatedSuggestion[] | undefined, right: readonly EvaluatedSuggestion[] | undefined): boolean;
95
+ /** Whether two media limits name the same admitted types or the same byte bound. */
96
+ export declare function sameMediaLimit(left: readonly string[] | number, right: readonly string[] | number): boolean;
97
+ /** Whether two derived error lists state the same reasons, which a new engine rebuilds. */
98
+ export declare function sameFieldErrors(left: readonly FieldError[], right: readonly FieldError[]): boolean;
99
+ /**
100
+ * Whether two screens state the same reasons, in the same order, with the same bindings.
101
+ *
102
+ * Exported because `sameFormSummary` compares the same value; a weaker comparator beside this
103
+ * one would let two screens a reader sees as different compare equal in the memo.
104
+ */
105
+ export declare function sameScreenReasons(left: readonly ScreenReason[], right: readonly ScreenReason[]): boolean;
106
+ //# sourceMappingURL=derive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/store/derive.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAGhB,mBAAmB,EACnB,YAAY,EAGZ,SAAS,EACV,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAa,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAIpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAG3E,uFAAuF;AACvF,MAAM,WAAW,cAAc;IAC7B,oFAAoF;IACpF,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ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