jsonisch 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,188 @@
1
+ import { A as EnvelopeState, B as EnvelopeSlot, E as DerivationState, I as AmountOrPercentSlot, O as DerivationSlot, P as validateFormInput, T as visibilityKey, U as EstimateSlot, a as ChecksState, g as BaggerState, k as derivationKey, o as checksKey, v as baggerKey } from "../plugin-BCsAE8RK.js";
2
+ import { B as createSignal, D as InternalFieldStore, E as InternalBaseStore, F as ReadonlySignal, H as getListener, I as Signal, K as Path, L as Tracker, O as InternalObjectStore, P as Listener, R as batch, S as FieldElement, T as InternalArrayStore, U as untrack, V as createTracker, W as withListener, _ as WireContract, a as InternalFormStore, b as PluginKey, c as PluginDriver, d as hasPluginDirtyField, f as pluginsDirty, h as PluginCtx, k as InternalValueStore, l as encodeFieldValue, m as JsonischPlugin, n as internalOf, p as unwrapLeafInput, u as fieldPluginDirty, v as WireEnvelope, x as ContainerInput, y as FieldSlotKey, z as computed } from "../form-ref-D_xHSaqL.js";
3
+
4
+ //#region src/core/field/focus-field-element.d.ts
5
+
6
+ /**
7
+ * Focuses the first focusable element of a field store. The elements are
8
+ * tried in order and the first one that actually receives focus wins, so
9
+ * detached, disabled or hidden elements are skipped. The browser decides
10
+ * focusability, which is read back via the element's root `activeElement`
11
+ * so elements in a shadow root or another document are handled correctly.
12
+ *
13
+ * Hint: a `display: none` or `hidden` element is correctly skipped in real
14
+ * browsers, but jsdom has no layout and focuses it anyway, so that case
15
+ * cannot be covered by unit tests.
16
+ *
17
+ * @param internalFieldStore The field store to focus.
18
+ *
19
+ * @returns Whether an element was focused.
20
+ */
21
+ declare function focusFieldElement(internalFieldStore: InternalFieldStore): boolean;
22
+ //#endregion
23
+ //#region src/core/field/get-field-bool.d.ts
24
+ /**
25
+ * Returns whether the specified boolean property is true for the field
26
+ * store or any of its nested children.
27
+ *
28
+ * @param internalFieldStore The field store to check.
29
+ * @param type The boolean property type to check.
30
+ *
31
+ * @returns Whether the property is true.
32
+ */
33
+ declare function getFieldBool(internalFieldStore: InternalFieldStore, type: "errors" | "validationErrors" | "isTouched" | "isEdited" | "isDirty"): boolean;
34
+ //#endregion
35
+ //#region src/core/field/get-field-input.d.ts
36
+ /**
37
+ * Returns the current input of the field store. For arrays and objects,
38
+ * recursively collects input from all children (the tree is the allow-list:
39
+ * only declared fields can ever appear in the result). Returns `null` or
40
+ * `undefined` for nullish container inputs, or the leaf value for value
41
+ * fields.
42
+ *
43
+ * @param internalFieldStore The field store to get input from.
44
+ *
45
+ * @returns The field input.
46
+ */
47
+ declare function getFieldInput(internalFieldStore: InternalFieldStore): unknown;
48
+ //#endregion
49
+ //#region src/core/field/get-field-store.d.ts
50
+ /**
51
+ * Returns the field store at the specified path. See `getFieldStoreChain`
52
+ * for the resolution and throw semantics.
53
+ *
54
+ * @param internalFormStore The form store to traverse.
55
+ * @param path The path to the field store.
56
+ *
57
+ * @returns The field store.
58
+ */
59
+ declare function getFieldStore(internalFormStore: InternalFormStore, path: Path): InternalFieldStore;
60
+ //#endregion
61
+ //#region src/core/field/walk-field-store.d.ts
62
+ /**
63
+ * Walks through the field store and all nested children, calling the
64
+ * callback for each field store in depth-first order. The callback may
65
+ * return `true` to stop the walk early, in which case `walkFieldStore`
66
+ * returns `true` as well.
67
+ *
68
+ * The walk reads array `items` reactively, so a reactive caller subscribes
69
+ * to structural changes naturally. Imperative callers that must not
70
+ * subscribe should wrap the call in `untrack`.
71
+ *
72
+ * @param internalFieldStore The field store to walk.
73
+ * @param callback The callback to invoke for each field store. Return `true` to stop the walk early.
74
+ *
75
+ * @returns Whether the walk was stopped early by the callback.
76
+ */
77
+ declare function walkFieldStore(internalFieldStore: InternalFieldStore, callback: (internalFieldStore: InternalFieldStore) => boolean | void): boolean;
78
+ //#endregion
79
+ //#region src/core/field/get-dirty-field-input.d.ts
80
+ /**
81
+ * Returns only the dirty input of the field store. Arrays are treated as
82
+ * atomic and returned in full if any item is dirty, while object keys
83
+ * without a dirty descendant are omitted. Returns `undefined` if no
84
+ * descendant is dirty.
85
+ *
86
+ * Plugin state serializes THROUGH the field's own entry (the LOS-573
87
+ * envelope): a dirty estimate/amount-or-percent leaf emits
88
+ * kind envelope in place of its bare value — a mode flip
89
+ * with an unchanged value still produces a payload. Inside an emitted
90
+ * array every envelope leaf is wrapped COMPLETE, dirty or not: rows
91
+ * persist wholesale, and a bare value would clobber the persisted meta
92
+ * half of its envelope.
93
+ *
94
+ * @param internalFormStore The form store (plugin state lives here).
95
+ * @param internalFieldStore The field store to get dirty input from.
96
+ *
97
+ * @returns The dirty input, or `undefined` if no descendant is dirty.
98
+ */
99
+ declare function getDirtyFieldInput(internalFormStore: InternalFormStore, internalFieldStore: InternalFieldStore): unknown;
100
+ /**
101
+ * Wraps the envelope leaves of an emitted subtree value: rows and nested
102
+ * objects keep their shape, but every value leaf claimed by a plugin's
103
+ * `encodeValue` (estimate/amount-or-percent) is replaced with its COMPLETE
104
+ * envelope — the whole-array emission convention. The supplied value is
105
+ * never mutated.
106
+ */
107
+ declare function encodeScopeValues(internalFormStore: InternalFormStore, internalFieldStore: InternalFieldStore | undefined, value: unknown): unknown;
108
+ //#endregion
109
+ //#region src/plugins/envelopes/key.d.ts
110
+ /**
111
+ * The envelopes plugin's slot key. Other plugins read envelope state
112
+ * through this identity (the derivation plugin pins on `mode`), never
113
+ * through the envelopes implementation.
114
+ */
115
+ declare const envelopesKey: FieldSlotKey<EnvelopeSlot>;
116
+ //#endregion
117
+ //#region src/plugins/derivation/row-scope.d.ts
118
+ /**
119
+ * Returns the INNERMOST array-item object store containing the field at the
120
+ * given path, or `undefined` when the path is not inside an array row (a
121
+ * root-level field, or a field under a plain nested object).
122
+ *
123
+ * Tolerant on purpose: an unresolvable segment stops the walk and returns
124
+ * whatever row was found so far, so a stale path (a row removed mid-render)
125
+ * degrades to a scope lookup instead of throwing.
126
+ *
127
+ * @param internalFormStore The form store.
128
+ * @param path The path to the field.
129
+ *
130
+ * @returns The row store, or `undefined`.
131
+ */
132
+ declare function findRowStore(internalFormStore: InternalFormStore, path: Path): InternalObjectStore | undefined;
133
+ /**
134
+ * Resolves a row's CANONICAL record: the server row from `offFormValues`
135
+ * that carries the full column set (core columns the write model never
136
+ * holds, plus the server's pre-evaluated derived values). The row's
137
+ * collection is read by walking the row's own path into `offFormValues`
138
+ * (`["assets", 0]` → `offFormValues.assets`), and the row is matched by
139
+ * `id` — index is not identity, rows reorder.
140
+ *
141
+ * Reads signals (`offFormValues`, the row's `id` input), so callers get
142
+ * re-resolution for free inside a computed.
143
+ *
144
+ * @param internalFormStore The form store.
145
+ * @param rowStore The array-item object store.
146
+ *
147
+ * @returns The canonical row, or `undefined`.
148
+ */
149
+ declare function canonicalRowOf(internalFormStore: InternalFormStore, rowStore: InternalObjectStore): Record<string, unknown> | undefined;
150
+ /**
151
+ * Resolves a row-scope dependency once the LIVE row value is already in
152
+ * hand — the precedence a per-row formula evaluates in:
153
+ *
154
+ * 1. the root-record alias (`form.rootRecordAlias`) from `offFormValues` (it
155
+ * wins outright: a row column named like the alias is never the
156
+ * root record),
157
+ * 2. the live sibling value in the SAME row (an explicit `null` counts —
158
+ * only `undefined` means "the row does not hold this"),
159
+ * 3. the canonical row's column.
160
+ *
161
+ * A row scope deliberately does NOT see root-level form fields or other
162
+ * `offFormValues` keys: a row's formula is evaluated against its own record
163
+ * plus the root record, exactly as the server evaluates it.
164
+ *
165
+ * @param internalFormStore The form store.
166
+ * @param rowStore The array-item object store the formula lives in.
167
+ * @param key The dependency identifier.
168
+ * @param formValue The live value the row holds for `key`, or `undefined`.
169
+ *
170
+ * @returns The resolved value, or `undefined`.
171
+ */
172
+ declare function resolveRowFallback(internalFormStore: InternalFormStore, rowStore: InternalObjectStore, key: string, formValue: unknown): unknown;
173
+ /**
174
+ * Resolves a single identifier in the scope of a row: the same precedence
175
+ * `buildDerivation` evaluates a row formula's dependencies in, with the
176
+ * live sibling read derived-aware (a sibling formula resolves through its
177
+ * own derived signal, so the read is always fresh; an erroring sibling
178
+ * resolves `undefined`, never a stale number).
179
+ *
180
+ * @param internalFormStore The form store.
181
+ * @param rowStore The array-item object store.
182
+ * @param key The identifier to resolve.
183
+ *
184
+ * @returns The resolved value, or `undefined`.
185
+ */
186
+ declare function resolveRowScopeValue(internalFormStore: InternalFormStore, rowStore: InternalObjectStore, key: string): unknown;
187
+ //#endregion
188
+ export { type AmountOrPercentSlot, type BaggerState, type ChecksState, type ContainerInput, type DerivationSlot, type DerivationState, type EnvelopeSlot, type EnvelopeState, type EstimateSlot, type FieldElement, FieldSlotKey, type InternalArrayStore, type InternalBaseStore, type InternalFieldStore, type InternalFormStore, type InternalObjectStore, type InternalValueStore, type JsonischPlugin, type Listener, type PluginCtx, type PluginDriver, PluginKey, type ReadonlySignal, type Signal, type Tracker, type WireContract, type WireEnvelope, baggerKey, batch, canonicalRowOf, checksKey, computed, createSignal, createTracker, derivationKey, encodeFieldValue, encodeScopeValues, envelopesKey, fieldPluginDirty, findRowStore, focusFieldElement, getDirtyFieldInput, getFieldBool, getFieldInput, getFieldStore, getListener, hasPluginDirtyField, internalOf, pluginsDirty, resolveRowFallback, resolveRowScopeValue, untrack, unwrapLeafInput, validateFormInput, visibilityKey, walkFieldStore, withListener };
@@ -0,0 +1,4 @@
1
+ import { A as unwrapLeafInput, B as getFieldBool, D as fieldPluginDirty, E as encodeFieldValue, F as createTracker, I as getListener, L as untrack, M as batch, N as computed, O as hasPluginDirtyField, P as createSignal, R as withListener, V as walkFieldStore, a as getFieldStore, i as focusFieldElement, k as pluginsDirty, n as validateFormInput, r as getFieldInput, t as internalOf } from "../form-ref-BEri3JKv.js";
2
+ import { D as FieldSlotKey, E as envelopesKey, H as getDirtyFieldInput, O as PluginKey, T as derivationKey, V as encodeScopeValues, _ as resolveRowFallback, a as checksKey, f as visibilityKey, g as findRowStore, h as canonicalRowOf, s as baggerKey, v as resolveRowScopeValue } from "../plugin-Qka-vaO1.js";
3
+
4
+ export { FieldSlotKey, PluginKey, baggerKey, batch, canonicalRowOf, checksKey, computed, createSignal, createTracker, derivationKey, encodeFieldValue, encodeScopeValues, envelopesKey, fieldPluginDirty, findRowStore, focusFieldElement, getDirtyFieldInput, getFieldBool, getFieldInput, getFieldStore, getListener, hasPluginDirtyField, internalOf, pluginsDirty, resolveRowFallback, resolveRowScopeValue, untrack, unwrapLeafInput, validateFormInput, visibilityKey, walkFieldStore, withListener };