attaform 0.31.1 → 0.31.2
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/dist/abstract.d.mts +5 -5
- package/dist/abstract.mjs +3 -2
- package/dist/dev/abstract.mjs +3 -2
- package/dist/dev/directive.mjs +1 -1
- package/dist/dev/history.mjs +118 -11
- package/dist/dev/index.mjs +4 -3
- package/dist/dev/shared/{attaform-dev.OceE0X3v.mjs → attaform-dev.BKWPjEB2.mjs} +4 -3
- package/dist/dev/shared/{attaform-dev.D7lKyM_7.mjs → attaform-dev.BnLLxX2l.mjs} +3 -3
- package/dist/dev/shared/{attaform-dev.Cbx0AiQF.mjs → attaform-dev.CKSqs_xQ.mjs} +1 -1
- package/dist/dev/shared/{attaform-dev.BpVGFSFa.mjs → attaform-dev.Cf_hZfbT.mjs} +3 -3
- package/dist/dev/shared/{attaform-dev.3uTCYwy8.mjs → attaform-dev.DLk51W7-.mjs} +111 -909
- package/dist/dev/shared/{attaform-dev.CwYTWyPX.mjs → attaform-dev.DoG8mZTq.mjs} +8 -1
- package/dist/dev/shared/attaform-dev.G-3XDl9F.mjs +1192 -0
- package/dist/dev/shared/{attaform-dev.PTGM9KE1.mjs → attaform-dev.oguHqv1W.mjs} +7 -6
- package/dist/dev/zod-v3.mjs +5 -4
- package/dist/dev/zod-v4.mjs +5 -4
- package/dist/dev/zod.mjs +4 -3
- package/dist/directive.d.mts +2 -2
- package/dist/directive.mjs +1 -1
- package/dist/history.d.mts +1 -1
- package/dist/history.mjs +118 -11
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +4 -3
- package/dist/shared/{attaform.j9xI_ObC.mjs → attaform.3kV6PqVJ.mjs} +7 -6
- package/dist/shared/{attaform.KEfNRDot.mjs → attaform.BJeiuJE2.mjs} +3 -3
- package/dist/shared/{attaform._1Zp3mDG.mjs → attaform.BNUhW4qC.mjs} +8 -1
- package/dist/shared/{attaform.B5b-HmhH.mjs → attaform.BlAmZ-WU.mjs} +3 -3
- package/dist/shared/{attaform.u6jfHoed.mjs → attaform.CMzc4bPI.mjs} +4 -3
- package/dist/shared/attaform.CgyyJVuq.mjs +1187 -0
- package/dist/shared/{attaform.CYlF4P6X.d.mts → attaform.CibLYe9-.d.mts} +185 -165
- package/dist/shared/{attaform.DAf4ehIe.mjs → attaform.DCUJCKyG.mjs} +111 -909
- package/dist/shared/{attaform.DZOynI6c.d.mts → attaform.DCyZT7u-.d.mts} +1 -1
- package/dist/shared/{attaform.B9PYKlhB.d.mts → attaform.DD0Y8krq.d.mts} +1 -1
- package/dist/shared/{attaform.BPMOl562.mjs → attaform.T0YjhjPU.mjs} +1 -1
- package/dist/shared/{attaform.i13OEHJF.d.mts → attaform.bI_4nKZp.d.mts} +61 -3
- package/dist/zod-v3.d.mts +4 -4
- package/dist/zod-v3.mjs +5 -4
- package/dist/zod-v4.d.mts +6 -6
- package/dist/zod-v4.mjs +5 -4
- package/dist/zod.d.mts +4 -4
- package/dist/zod.mjs +4 -3
- package/package.json +1 -1
- package/dist/dev/shared/attaform-dev.n6n00owJ.mjs +0 -279
- package/dist/shared/attaform.BPSqtU7a.mjs +0 -274
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
|
-
import { an as RegisterModelDynamicCustomDirective } from './attaform.
|
|
2
|
+
import { an as RegisterModelDynamicCustomDirective } from './attaform.bI_4nKZp.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The `v-register` directive. Bind a form field to a native input, select,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GenericForm, l as FlatPath, s as NestedType, F as FormKey, U as UseFormConfiguration, A as AbstractSchema, ap as AcceptableDefaults, ab as ValidateOnConfig, a as UseFormReturnType } from './attaform.
|
|
2
|
+
import { G as GenericForm, l as FlatPath, s as NestedType, F as FormKey, U as UseFormConfiguration, A as AbstractSchema, ap as AcceptableDefaults, ab as ValidateOnConfig, a as UseFormReturnType } from './attaform.bI_4nKZp.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A Zod v4 schema whose core definition matches `Def`, named by the
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { toRaw, reactive, markRaw, effectScope, watch, nextTick } from 'vue';
|
|
2
2
|
import { i as isRegisterValue, a as isTransforming, S as SSR_COMPONENT_HOST_MODIFIER, R as REGISTER_OWNER_MARKER, b as V_REGISTER_MARKER } from './attaform.KvlEedlF.mjs';
|
|
3
3
|
import { e as canonicalizePath } from './attaform.BhtAZysa.mjs';
|
|
4
|
-
import {
|
|
4
|
+
import { d as safeOwnHas } from './attaform.BNUhW4qC.mjs';
|
|
5
5
|
|
|
6
6
|
function activeElementOf(node) {
|
|
7
7
|
const rootNode = node.getRootNode();
|
|
@@ -763,6 +763,50 @@ type DefaultValuesInput<T> = T extends string ? string | Unset : T extends numbe
|
|
|
763
763
|
type AcceptableDefaults<Form, SchemaInput> = AcceptableDefaultsOf<DefaultValuesInput<Form>, SchemaInput>;
|
|
764
764
|
type AcceptableDefaultsOf<DVI, SchemaInput> = DVI | SchemaInput | (() => DVI | SchemaInput) | (() => Promise<DVI | SchemaInput>);
|
|
765
765
|
|
|
766
|
+
/**
|
|
767
|
+
* The arrays engine: everything keeping per-element state truthful across a
|
|
768
|
+
* structural array mutation, in one module around one permutation core.
|
|
769
|
+
*
|
|
770
|
+
* A structural mutation, which the typed helpers below tag with an `arrayOp`,
|
|
771
|
+
* is decoded exactly once into an {@link IndexRemap}, and `remapForOp` is the
|
|
772
|
+
* single source of permutation truth. Every consumer derives from that remap:
|
|
773
|
+
*
|
|
774
|
+
* - the identity tracker replays it onto its token lists (`permuteList`);
|
|
775
|
+
* - per-element state relocation walks it (`migrateMapSubtree` /
|
|
776
|
+
* `migrateSetSubtree`);
|
|
777
|
+
* - derived-state eviction, schema verdicts and variant memory, drops at its
|
|
778
|
+
* `changedIndices`;
|
|
779
|
+
* - the write funnel scopes its per-element work to `remap.fresh`.
|
|
780
|
+
*
|
|
781
|
+
* One decode and many readers, so the permutation cannot drift between the
|
|
782
|
+
* consumer-facing `:key` token and the state that must travel with it.
|
|
783
|
+
*/
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* The exact index permutation an array operation produced, recovered from
|
|
787
|
+
* its `arrayOp` hint. Three disjoint facts drive every downstream rewrite:
|
|
788
|
+
*
|
|
789
|
+
* - `moved`: an old element index and the new index it now sits at.
|
|
790
|
+
* Identity entries (`i -> i`) are omitted, so an unmoved element's state
|
|
791
|
+
* is left untouched in place.
|
|
792
|
+
* - `vacated`: old indices whose element no longer exists (a `remove`
|
|
793
|
+
* target, or the outgoing occupant of a `replace-at`). Their non-derived
|
|
794
|
+
* state is dropped, not relocated.
|
|
795
|
+
* - `fresh`: new indices holding a brand-new element (an `insert` slot, or
|
|
796
|
+
* a `replace-at` target). They start with no carried-over state.
|
|
797
|
+
*
|
|
798
|
+
* `oldLen` / `newLen` carry the array's pre- and post-op lengths so a
|
|
799
|
+
* consumer replaying the permutation (the identity tracker's token
|
|
800
|
+
* lists) never re-derives them from the op kind.
|
|
801
|
+
*/
|
|
802
|
+
type IndexRemap = {
|
|
803
|
+
readonly moved: ReadonlyMap<number, number>;
|
|
804
|
+
readonly vacated: ReadonlySet<number>;
|
|
805
|
+
readonly fresh: ReadonlySet<number>;
|
|
806
|
+
readonly oldLen: number;
|
|
807
|
+
readonly newLen: number;
|
|
808
|
+
};
|
|
809
|
+
|
|
766
810
|
/**
|
|
767
811
|
* Identifier for a form: the string passed to `useForm({ key })`, used
|
|
768
812
|
* to look a form up by name from a distant component and to label
|
|
@@ -1641,13 +1685,16 @@ type WriteMeta = {
|
|
|
1641
1685
|
type HistoryKernel = {
|
|
1642
1686
|
readonly form: Ref<unknown>;
|
|
1643
1687
|
readonly blankPaths: Set<PathKey>;
|
|
1688
|
+
readonly fields: ReadonlyMap<PathKey, FieldRecord>;
|
|
1644
1689
|
readonly errorCells: () => Map<PathKey, ErrorCell>;
|
|
1645
1690
|
onFormChange(listener: (next: unknown, meta?: WriteMeta) => void): () => void;
|
|
1646
1691
|
onReset(listener: () => void): () => void;
|
|
1647
1692
|
applyFormReplacement(next: unknown): void;
|
|
1648
1693
|
restoreErrorCells(entries: ReadonlyArray<readonly [PathKey, ErrorCell]>): void;
|
|
1649
1694
|
captureStructure(): StructureSnapshot;
|
|
1650
|
-
restoreStructure(snapshot: StructureSnapshot): void;
|
|
1695
|
+
restoreStructure(snapshot: StructureSnapshot, remaps: ReadonlyArray<readonly [Path, IndexRemap]>, returning: readonly FieldRecord[]): void;
|
|
1696
|
+
/** Set while attached: hears the records each removal releases. */
|
|
1697
|
+
noteReleased?: ((records: readonly FieldRecord[]) => void) | undefined;
|
|
1651
1698
|
};
|
|
1652
1699
|
/**
|
|
1653
1700
|
* The live undo/redo runtime a {@link HistoryPlugin} attaches to one
|
|
@@ -2982,6 +3029,13 @@ type PathSetValuePayload<Leaf> = IsAny<Leaf> extends true ? any : unknown extend
|
|
|
2982
3029
|
*/
|
|
2983
3030
|
type FieldState<Value = unknown> = {
|
|
2984
3031
|
readonly value: Value;
|
|
3032
|
+
/**
|
|
3033
|
+
* The value this path started as: the defaults, re-seated by `reset()` and
|
|
3034
|
+
* by async defaults. At a container, the subtree it started as, each row
|
|
3035
|
+
* read at its own baseline wherever the typed array ops have moved it, and
|
|
3036
|
+
* frozen, since every read shares it. `undefined` for a field or row added
|
|
3037
|
+
* since.
|
|
3038
|
+
*/
|
|
2985
3039
|
readonly original: Value;
|
|
2986
3040
|
readonly pristine: boolean;
|
|
2987
3041
|
readonly dirty: boolean;
|
|
@@ -4548,6 +4602,8 @@ type UseFormReturnType<Form extends GenericForm, GetValueFormType extends Generi
|
|
|
4548
4602
|
* form.touch() // every leaf in the form
|
|
4549
4603
|
* ```
|
|
4550
4604
|
*
|
|
4605
|
+
* An empty list under `path` is marked too, though it holds no leaf.
|
|
4606
|
+
*
|
|
4551
4607
|
* **This does not reveal errors under the default display
|
|
4552
4608
|
* heuristic.** `touched` also flips on a bare focus and blur with no
|
|
4553
4609
|
* edit, so the library-default gate ignores it and reads
|
|
@@ -4585,7 +4641,9 @@ type UseFormReturnType<Form extends GenericForm, GetValueFormType extends Generi
|
|
|
4585
4641
|
*
|
|
4586
4642
|
* Walks schema leaves, so it reaches fields that are currently
|
|
4587
4643
|
* `v-if`'d away or were never mounted; the flags are sticky, so
|
|
4588
|
-
* such a subtree stays revealed when it remounts.
|
|
4644
|
+
* such a subtree stays revealed when it remounts. An empty list
|
|
4645
|
+
* under `path` is marked too, so its own error (a `.min(1)`)
|
|
4646
|
+
* reveals.
|
|
4589
4647
|
*
|
|
4590
4648
|
* Flags land synchronously, and the returned promise resolves once
|
|
4591
4649
|
* the subtree's validation has committed, so an awaiting caller reads
|
|
@@ -4707,4 +4765,4 @@ type UseFormReturnType<Form extends GenericForm, GetValueFormType extends Generi
|
|
|
4707
4765
|
};
|
|
4708
4766
|
|
|
4709
4767
|
export { ROOT_PATH as R, canonicalizePath as ai, isPathPrefix as aj, isUnset as ak, parseDottedPath as al, unset as am, ROOT_PATH_KEY as z };
|
|
4710
|
-
export type { SchemaParseErrorWithData as $, AbstractSchema as A, ReactiveValidationStatus as B, CustomDirectiveRegisterAssignerFn as C, DefaultValuesInput as D, ErrorInput as E, FormKey as F, GenericForm as G, HandleSubmit as H, IsTuple as I, JoinSegments as J, KeyofUnion as K, LiftedValueShape as L, MetaTrackerValue as M, NestedReadType as N, OnError as O, ParseOptions as P, RecordPath as Q, RecordValue as S, RegisterDirective as T, UseFormConfiguration as U, RegisterFlatPath as V, RegisterOptions as W, RegisterSelectModifier as X, RegisterTextModifier as Y, RegisterTransform as Z, RegisterValue as _, UseFormReturnType as a, SchemaParseErrorWithoutData as a0, SchemaParseResult as a1, SchemaParseSuccess as a2, Segment as a3, SetValueCallback as a4, SetValuePayload as a5, SettledValidationStatus as a6, SlimPrimitiveKind as a7, SubmitHandler as a8, Unset as a9, ValidateOn as aa, ValidateOnConfig as ab, ValidationError as ac, ValidationResponse as ad, ValidationResponseWithoutValue as ae, ValueOfUnion as af, WriteMeta as ag, WriteShape as ah, RegisterModelDynamicCustomDirective as an, SchemaFactoryOptions as ao, AcceptableDefaults as ap, DisplayCtx as aq, GetDisplayState as ar, DisplayMachine as as, FieldRecord as at, ErrorCell as au, OriginalsRecord as av, StructureSnapshot as aw,
|
|
4768
|
+
export type { SchemaParseErrorWithData as $, AbstractSchema as A, ReactiveValidationStatus as B, CustomDirectiveRegisterAssignerFn as C, DefaultValuesInput as D, ErrorInput as E, FormKey as F, GenericForm as G, HandleSubmit as H, IsTuple as I, JoinSegments as J, KeyofUnion as K, LiftedValueShape as L, MetaTrackerValue as M, NestedReadType as N, OnError as O, ParseOptions as P, RecordPath as Q, RecordValue as S, RegisterDirective as T, UseFormConfiguration as U, RegisterFlatPath as V, RegisterOptions as W, RegisterSelectModifier as X, RegisterTextModifier as Y, RegisterTransform as Z, RegisterValue as _, UseFormReturnType as a, SchemaParseErrorWithoutData as a0, SchemaParseResult as a1, SchemaParseSuccess as a2, Segment as a3, SetValueCallback as a4, SetValuePayload as a5, SettledValidationStatus as a6, SlimPrimitiveKind as a7, SubmitHandler as a8, Unset as a9, ValidateOn as aa, ValidateOnConfig as ab, ValidationError as ac, ValidationResponse as ad, ValidationResponseWithoutValue as ae, ValueOfUnion as af, WriteMeta as ag, WriteShape as ah, RegisterModelDynamicCustomDirective as an, SchemaFactoryOptions as ao, AcceptableDefaults as ap, DisplayCtx as aq, GetDisplayState as ar, DisplayMachine as as, FieldRecord as at, ErrorCell as au, OriginalsRecord as av, StructureSnapshot as aw, IndexRemap as ax, AttaformDomBinding as ay, TransformAbortHolder as az, ArrayItem as b, ArrayPath as c, DeepPartial as d, DefaultValuesShape as e, DisplayState as f, ErrorsProxyShape as g, FieldMetaPayload as h, FieldState as i, FieldStateMap as j, FieldStateMapEntry as k, FlatPath as l, FormErrorRecord as m, FormErrorsSurface as n, FormMeta as o, HistoryPlugin as p, IsUnion as q, Json as r, NestedType as s, OnSubmit as t, PartialFlatPath as u, Path as v, PathKey as w, PendingValidationStatus as x, Primitive as y };
|
package/dist/zod-v3.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, ap as AcceptableDefaults, a as UseFormReturnType, ab as ValidateOnConfig, ao as SchemaFactoryOptions, h as FieldMetaPayload } from './shared/attaform.
|
|
2
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, ap as AcceptableDefaults, a as UseFormReturnType, ab as ValidateOnConfig, ao as SchemaFactoryOptions, h as FieldMetaPayload } from './shared/attaform.bI_4nKZp.mjs';
|
|
3
3
|
import { AbstractSchema } from './abstract.mjs';
|
|
4
|
-
export { b as ArrayItem, c as ArrayPath, C as CustomDirectiveRegisterAssignerFn, d as DeepPartial, D as DefaultValuesInput, e as DefaultValuesShape, f as DisplayState, E as ErrorInput, g as ErrorsProxyShape, i as FieldState, j as FieldStateMap, k as FieldStateMapEntry, l as FlatPath, m as FormErrorRecord, n as FormErrorsSurface, o as FormMeta, H as HandleSubmit, p as HistoryPlugin, I as IsTuple, q as IsUnion, J as JoinSegments, r as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, s as NestedType, O as OnError, t as OnSubmit, P as ParseOptions, u as PartialFlatPath, v as Path, w as PathKey, x as PendingValidationStatus, y as Primitive, R as ROOT_PATH, z as ROOT_PATH_KEY, B as ReactiveValidationStatus, Q as RecordPath, S as RecordValue, T as RegisterDirective, V as RegisterFlatPath, W as RegisterOptions, X as RegisterSelectModifier, Y as RegisterTextModifier, Z as RegisterTransform, _ as RegisterValue, $ as SchemaParseErrorWithData, a0 as SchemaParseErrorWithoutData, a1 as SchemaParseResult, a2 as SchemaParseSuccess, a3 as Segment, a4 as SetValueCallback, a5 as SetValuePayload, a6 as SettledValidationStatus, a7 as SlimPrimitiveKind, a8 as SubmitHandler, a9 as Unset, aa as ValidateOn, ac as ValidationError, ad as ValidationResponse, ae as ValidationResponseWithoutValue, af as ValueOfUnion, ag as WriteMeta, ah as WriteShape, ai as canonicalizePath, aj as isPathPrefix, ak as isUnset, al as parseDottedPath, am as unset } from './shared/attaform.
|
|
4
|
+
export { b as ArrayItem, c as ArrayPath, C as CustomDirectiveRegisterAssignerFn, d as DeepPartial, D as DefaultValuesInput, e as DefaultValuesShape, f as DisplayState, E as ErrorInput, g as ErrorsProxyShape, i as FieldState, j as FieldStateMap, k as FieldStateMapEntry, l as FlatPath, m as FormErrorRecord, n as FormErrorsSurface, o as FormMeta, H as HandleSubmit, p as HistoryPlugin, I as IsTuple, q as IsUnion, J as JoinSegments, r as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, s as NestedType, O as OnError, t as OnSubmit, P as ParseOptions, u as PartialFlatPath, v as Path, w as PathKey, x as PendingValidationStatus, y as Primitive, R as ROOT_PATH, z as ROOT_PATH_KEY, B as ReactiveValidationStatus, Q as RecordPath, S as RecordValue, T as RegisterDirective, V as RegisterFlatPath, W as RegisterOptions, X as RegisterSelectModifier, Y as RegisterTextModifier, Z as RegisterTransform, _ as RegisterValue, $ as SchemaParseErrorWithData, a0 as SchemaParseErrorWithoutData, a1 as SchemaParseResult, a2 as SchemaParseSuccess, a3 as Segment, a4 as SetValueCallback, a5 as SetValuePayload, a6 as SettledValidationStatus, a7 as SlimPrimitiveKind, a8 as SubmitHandler, a9 as Unset, aa as ValidateOn, ac as ValidationError, ad as ValidationResponse, ae as ValidationResponseWithoutValue, af as ValueOfUnion, ag as WriteMeta, ah as WriteShape, ai as canonicalizePath, aj as isPathPrefix, ak as isUnset, al as parseDottedPath, am as unset } from './shared/attaform.bI_4nKZp.mjs';
|
|
5
5
|
import { S as SupportedRootSchema, U as UnwrapZodRoot, a as StorageShape } from './shared/attaform.B-Tb62qV.mjs';
|
|
6
|
-
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEVTOOLS_WINDOW_KEY, F as FormStatus, f as FormStatusSeed, G as GateMarker, I as InjectWizardInput, g as InvalidPathError, h as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, i as ReservedFormKeyError, S as SerializedAttaformState, j as SerializedFormData, k as StepSlot, l as SubmitErrorHandlerError, U as UseRegisterOptions, m as UseRegisterReturn, n as UseWizardReturnType, W as WizardAggregateError, o as WizardCtx, p as WizardCtxForm, q as WizardOnError, r as WizardOnSubmit, s as WizardOptions, t as WizardPersistFn, u as WizardRestoreFn, v as WizardRestoreState, w as WizardStatusesProxy, x as WizardSubmitContext, y as assignKey, z as createAttaform, B as createRegistry, E as escapeForInlineScript, H as gate, J as getRegistryFromApp, K as hydrateAttaformState, M as injectForm, N as injectWizard, P as isRegisterValue, Q as kAttaformRegistry, T as lazy, V as renderAttaformState, X as useRegister, Y as useRegistry, Z as useWizard } from './shared/attaform.
|
|
7
|
-
export { v as vRegister } from './shared/attaform.
|
|
6
|
+
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEVTOOLS_WINDOW_KEY, F as FormStatus, f as FormStatusSeed, G as GateMarker, I as InjectWizardInput, g as InvalidPathError, h as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, i as ReservedFormKeyError, S as SerializedAttaformState, j as SerializedFormData, k as StepSlot, l as SubmitErrorHandlerError, U as UseRegisterOptions, m as UseRegisterReturn, n as UseWizardReturnType, W as WizardAggregateError, o as WizardCtx, p as WizardCtxForm, q as WizardOnError, r as WizardOnSubmit, s as WizardOptions, t as WizardPersistFn, u as WizardRestoreFn, v as WizardRestoreState, w as WizardStatusesProxy, x as WizardSubmitContext, y as assignKey, z as createAttaform, B as createRegistry, E as escapeForInlineScript, H as gate, J as getRegistryFromApp, K as hydrateAttaformState, M as injectForm, N as injectWizard, P as isRegisterValue, Q as kAttaformRegistry, T as lazy, V as renderAttaformState, X as useRegister, Y as useRegistry, Z as useWizard } from './shared/attaform.CibLYe9-.mjs';
|
|
7
|
+
export { v as vRegister } from './shared/attaform.DCyZT7u-.mjs';
|
|
8
8
|
import 'vue';
|
|
9
9
|
|
|
10
10
|
/**
|
package/dist/zod-v3.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export { i as isZodSchemaType, u as useForm, z as zodAdapter } from './shared/attaform.
|
|
2
|
-
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform.
|
|
1
|
+
export { i as isZodSchemaType, u as useForm, z as zodAdapter } from './shared/attaform.CMzc4bPI.mjs';
|
|
2
|
+
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform.3kV6PqVJ.mjs';
|
|
3
3
|
export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform.BhtAZysa.mjs';
|
|
4
|
-
export { A as AttaformErrorCode
|
|
4
|
+
export { A as AttaformErrorCode } from './shared/attaform.CgyyJVuq.mjs';
|
|
5
5
|
export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform.CdA9bfRv.mjs';
|
|
6
|
-
export { a as assignKey, v as vRegister } from './shared/attaform.
|
|
6
|
+
export { a as assignKey, v as vRegister } from './shared/attaform.T0YjhjPU.mjs';
|
|
7
|
+
export { e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform.DCUJCKyG.mjs';
|
|
7
8
|
export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
|
|
8
9
|
|
|
9
10
|
const fieldMeta = installingFieldMetaStore;
|
package/dist/zod-v4.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { S as SupportedRootSchema, Z as ZodV4Schema } from './shared/attaform.
|
|
2
|
-
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.
|
|
3
|
-
import { F as FormKey, ao as SchemaFactoryOptions, h as FieldMetaPayload } from './shared/attaform.
|
|
1
|
+
import { S as SupportedRootSchema, Z as ZodV4Schema } from './shared/attaform.DD0Y8krq.mjs';
|
|
2
|
+
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.DD0Y8krq.mjs';
|
|
3
|
+
import { F as FormKey, ao as SchemaFactoryOptions, h as FieldMetaPayload } from './shared/attaform.bI_4nKZp.mjs';
|
|
4
4
|
import { AbstractSchema } from './abstract.mjs';
|
|
5
|
-
export { b as ArrayItem, c as ArrayPath, C as CustomDirectiveRegisterAssignerFn, d as DeepPartial, D as DefaultValuesInput, e as DefaultValuesShape, f as DisplayState, E as ErrorInput, g as ErrorsProxyShape, i as FieldState, j as FieldStateMap, k as FieldStateMapEntry, l as FlatPath, m as FormErrorRecord, n as FormErrorsSurface, o as FormMeta, G as GenericForm, H as HandleSubmit, p as HistoryPlugin, I as IsTuple, q as IsUnion, J as JoinSegments, r as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, s as NestedType, O as OnError, t as OnSubmit, P as ParseOptions, u as PartialFlatPath, v as Path, w as PathKey, x as PendingValidationStatus, y as Primitive, R as ROOT_PATH, z as ROOT_PATH_KEY, B as ReactiveValidationStatus, Q as RecordPath, S as RecordValue, T as RegisterDirective, V as RegisterFlatPath, W as RegisterOptions, X as RegisterSelectModifier, Y as RegisterTextModifier, Z as RegisterTransform, _ as RegisterValue, $ as SchemaParseErrorWithData, a0 as SchemaParseErrorWithoutData, a1 as SchemaParseResult, a2 as SchemaParseSuccess, a3 as Segment, a4 as SetValueCallback, a5 as SetValuePayload, a6 as SettledValidationStatus, a7 as SlimPrimitiveKind, a8 as SubmitHandler, a9 as Unset, U as UseFormConfiguration, a as UseFormReturnType, aa as ValidateOn, ab as ValidateOnConfig, ac as ValidationError, ad as ValidationResponse, ae as ValidationResponseWithoutValue, af as ValueOfUnion, ag as WriteMeta, ah as WriteShape, ai as canonicalizePath, aj as isPathPrefix, ak as isUnset, al as parseDottedPath, am as unset } from './shared/attaform.
|
|
6
|
-
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEVTOOLS_WINDOW_KEY, F as FormStatus, f as FormStatusSeed, G as GateMarker, I as InjectWizardInput, g as InvalidPathError, h as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, i as ReservedFormKeyError, S as SerializedAttaformState, j as SerializedFormData, k as StepSlot, l as SubmitErrorHandlerError, U as UseRegisterOptions, m as UseRegisterReturn, n as UseWizardReturnType, W as WizardAggregateError, o as WizardCtx, p as WizardCtxForm, q as WizardOnError, r as WizardOnSubmit, s as WizardOptions, t as WizardPersistFn, u as WizardRestoreFn, v as WizardRestoreState, w as WizardStatusesProxy, x as WizardSubmitContext, y as assignKey, z as createAttaform, B as createRegistry, E as escapeForInlineScript, H as gate, J as getRegistryFromApp, K as hydrateAttaformState, M as injectForm, N as injectWizard, P as isRegisterValue, Q as kAttaformRegistry, T as lazy, V as renderAttaformState, X as useRegister, Y as useRegistry, Z as useWizard } from './shared/attaform.
|
|
7
|
-
export { v as vRegister } from './shared/attaform.
|
|
5
|
+
export { b as ArrayItem, c as ArrayPath, C as CustomDirectiveRegisterAssignerFn, d as DeepPartial, D as DefaultValuesInput, e as DefaultValuesShape, f as DisplayState, E as ErrorInput, g as ErrorsProxyShape, i as FieldState, j as FieldStateMap, k as FieldStateMapEntry, l as FlatPath, m as FormErrorRecord, n as FormErrorsSurface, o as FormMeta, G as GenericForm, H as HandleSubmit, p as HistoryPlugin, I as IsTuple, q as IsUnion, J as JoinSegments, r as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, s as NestedType, O as OnError, t as OnSubmit, P as ParseOptions, u as PartialFlatPath, v as Path, w as PathKey, x as PendingValidationStatus, y as Primitive, R as ROOT_PATH, z as ROOT_PATH_KEY, B as ReactiveValidationStatus, Q as RecordPath, S as RecordValue, T as RegisterDirective, V as RegisterFlatPath, W as RegisterOptions, X as RegisterSelectModifier, Y as RegisterTextModifier, Z as RegisterTransform, _ as RegisterValue, $ as SchemaParseErrorWithData, a0 as SchemaParseErrorWithoutData, a1 as SchemaParseResult, a2 as SchemaParseSuccess, a3 as Segment, a4 as SetValueCallback, a5 as SetValuePayload, a6 as SettledValidationStatus, a7 as SlimPrimitiveKind, a8 as SubmitHandler, a9 as Unset, U as UseFormConfiguration, a as UseFormReturnType, aa as ValidateOn, ab as ValidateOnConfig, ac as ValidationError, ad as ValidationResponse, ae as ValidationResponseWithoutValue, af as ValueOfUnion, ag as WriteMeta, ah as WriteShape, ai as canonicalizePath, aj as isPathPrefix, ak as isUnset, al as parseDottedPath, am as unset } from './shared/attaform.bI_4nKZp.mjs';
|
|
6
|
+
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEVTOOLS_WINDOW_KEY, F as FormStatus, f as FormStatusSeed, G as GateMarker, I as InjectWizardInput, g as InvalidPathError, h as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, i as ReservedFormKeyError, S as SerializedAttaformState, j as SerializedFormData, k as StepSlot, l as SubmitErrorHandlerError, U as UseRegisterOptions, m as UseRegisterReturn, n as UseWizardReturnType, W as WizardAggregateError, o as WizardCtx, p as WizardCtxForm, q as WizardOnError, r as WizardOnSubmit, s as WizardOptions, t as WizardPersistFn, u as WizardRestoreFn, v as WizardRestoreState, w as WizardStatusesProxy, x as WizardSubmitContext, y as assignKey, z as createAttaform, B as createRegistry, E as escapeForInlineScript, H as gate, J as getRegistryFromApp, K as hydrateAttaformState, M as injectForm, N as injectWizard, P as isRegisterValue, Q as kAttaformRegistry, T as lazy, V as renderAttaformState, X as useRegister, Y as useRegistry, Z as useWizard } from './shared/attaform.CibLYe9-.mjs';
|
|
7
|
+
export { v as vRegister } from './shared/attaform.DCyZT7u-.mjs';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import 'vue';
|
|
10
10
|
|
package/dist/zod-v4.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export { a as assertZodVersion, k as kindOf, u as useForm, z as zodAdapter } from './shared/attaform.
|
|
2
|
-
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform.
|
|
1
|
+
export { a as assertZodVersion, k as kindOf, u as useForm, z as zodAdapter } from './shared/attaform.BlAmZ-WU.mjs';
|
|
2
|
+
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform.3kV6PqVJ.mjs';
|
|
3
3
|
export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform.BhtAZysa.mjs';
|
|
4
|
-
export { A as AttaformErrorCode
|
|
4
|
+
export { A as AttaformErrorCode } from './shared/attaform.CgyyJVuq.mjs';
|
|
5
5
|
export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform.CdA9bfRv.mjs';
|
|
6
|
-
export { a as assignKey, v as vRegister } from './shared/attaform.
|
|
6
|
+
export { a as assignKey, v as vRegister } from './shared/attaform.T0YjhjPU.mjs';
|
|
7
|
+
export { e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform.DCUJCKyG.mjs';
|
|
7
8
|
export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
|
|
8
9
|
|
|
9
10
|
const fieldMeta = installingFieldMetaStore;
|
package/dist/zod.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEVTOOLS_WINDOW_KEY, F as FormStatus, f as FormStatusSeed, G as GateMarker, I as InjectWizardInput, g as InvalidPathError, h as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, i as ReservedFormKeyError, S as SerializedAttaformState, j as SerializedFormData, k as StepSlot, l as SubmitErrorHandlerError, U as UseRegisterOptions, m as UseRegisterReturn, n as UseWizardReturnType, W as WizardAggregateError, o as WizardCtx, p as WizardCtxForm, q as WizardOnError, r as WizardOnSubmit, s as WizardOptions, t as WizardPersistFn, u as WizardRestoreFn, v as WizardRestoreState, w as WizardStatusesProxy, x as WizardSubmitContext, y as assignKey, z as createAttaform, B as createRegistry, E as escapeForInlineScript, H as gate, J as getRegistryFromApp, K as hydrateAttaformState, M as injectForm, N as injectWizard, P as isRegisterValue, Q as kAttaformRegistry, T as lazy, V as renderAttaformState, X as useRegister, Y as useRegistry, Z as useWizard } from './shared/attaform.
|
|
2
|
-
export { b as ArrayItem, c as ArrayPath, C as CustomDirectiveRegisterAssignerFn, d as DeepPartial, D as DefaultValuesInput, e as DefaultValuesShape, f as DisplayState, E as ErrorInput, g as ErrorsProxyShape, h as FieldMetaPayload, i as FieldState, j as FieldStateMap, k as FieldStateMapEntry, l as FlatPath, m as FormErrorRecord, n as FormErrorsSurface, F as FormKey, o as FormMeta, G as GenericForm, H as HandleSubmit, p as HistoryPlugin, I as IsTuple, q as IsUnion, J as JoinSegments, r as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, s as NestedType, O as OnError, t as OnSubmit, P as ParseOptions, u as PartialFlatPath, v as Path, w as PathKey, x as PendingValidationStatus, y as Primitive, R as ROOT_PATH, z as ROOT_PATH_KEY, B as ReactiveValidationStatus, Q as RecordPath, S as RecordValue, T as RegisterDirective, V as RegisterFlatPath, W as RegisterOptions, X as RegisterSelectModifier, Y as RegisterTextModifier, Z as RegisterTransform, _ as RegisterValue, $ as SchemaParseErrorWithData, a0 as SchemaParseErrorWithoutData, a1 as SchemaParseResult, a2 as SchemaParseSuccess, a3 as Segment, a4 as SetValueCallback, a5 as SetValuePayload, a6 as SettledValidationStatus, a7 as SlimPrimitiveKind, a8 as SubmitHandler, a9 as Unset, U as UseFormConfiguration, a as UseFormReturnType, aa as ValidateOn, ab as ValidateOnConfig, ac as ValidationError, ad as ValidationResponse, ae as ValidationResponseWithoutValue, af as ValueOfUnion, ag as WriteMeta, ah as WriteShape, ai as canonicalizePath, aj as isPathPrefix, ak as isUnset, al as parseDottedPath, am as unset } from './shared/attaform.
|
|
3
|
-
export { v as vRegister } from './shared/attaform.
|
|
1
|
+
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEVTOOLS_WINDOW_KEY, F as FormStatus, f as FormStatusSeed, G as GateMarker, I as InjectWizardInput, g as InvalidPathError, h as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, i as ReservedFormKeyError, S as SerializedAttaformState, j as SerializedFormData, k as StepSlot, l as SubmitErrorHandlerError, U as UseRegisterOptions, m as UseRegisterReturn, n as UseWizardReturnType, W as WizardAggregateError, o as WizardCtx, p as WizardCtxForm, q as WizardOnError, r as WizardOnSubmit, s as WizardOptions, t as WizardPersistFn, u as WizardRestoreFn, v as WizardRestoreState, w as WizardStatusesProxy, x as WizardSubmitContext, y as assignKey, z as createAttaform, B as createRegistry, E as escapeForInlineScript, H as gate, J as getRegistryFromApp, K as hydrateAttaformState, M as injectForm, N as injectWizard, P as isRegisterValue, Q as kAttaformRegistry, T as lazy, V as renderAttaformState, X as useRegister, Y as useRegistry, Z as useWizard } from './shared/attaform.CibLYe9-.mjs';
|
|
2
|
+
export { b as ArrayItem, c as ArrayPath, C as CustomDirectiveRegisterAssignerFn, d as DeepPartial, D as DefaultValuesInput, e as DefaultValuesShape, f as DisplayState, E as ErrorInput, g as ErrorsProxyShape, h as FieldMetaPayload, i as FieldState, j as FieldStateMap, k as FieldStateMapEntry, l as FlatPath, m as FormErrorRecord, n as FormErrorsSurface, F as FormKey, o as FormMeta, G as GenericForm, H as HandleSubmit, p as HistoryPlugin, I as IsTuple, q as IsUnion, J as JoinSegments, r as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, s as NestedType, O as OnError, t as OnSubmit, P as ParseOptions, u as PartialFlatPath, v as Path, w as PathKey, x as PendingValidationStatus, y as Primitive, R as ROOT_PATH, z as ROOT_PATH_KEY, B as ReactiveValidationStatus, Q as RecordPath, S as RecordValue, T as RegisterDirective, V as RegisterFlatPath, W as RegisterOptions, X as RegisterSelectModifier, Y as RegisterTextModifier, Z as RegisterTransform, _ as RegisterValue, $ as SchemaParseErrorWithData, a0 as SchemaParseErrorWithoutData, a1 as SchemaParseResult, a2 as SchemaParseSuccess, a3 as Segment, a4 as SetValueCallback, a5 as SetValuePayload, a6 as SettledValidationStatus, a7 as SlimPrimitiveKind, a8 as SubmitHandler, a9 as Unset, U as UseFormConfiguration, a as UseFormReturnType, aa as ValidateOn, ab as ValidateOnConfig, ac as ValidationError, ad as ValidationResponse, ae as ValidationResponseWithoutValue, af as ValueOfUnion, ag as WriteMeta, ah as WriteShape, ai as canonicalizePath, aj as isPathPrefix, ak as isUnset, al as parseDottedPath, am as unset } from './shared/attaform.bI_4nKZp.mjs';
|
|
3
|
+
export { v as vRegister } from './shared/attaform.DCyZT7u-.mjs';
|
|
4
4
|
export { UseFormConfig, UseFormConfigV3, UseFormConfigV4, UseFormReturn, UseFormReturnV3, UseFormReturnV4, fieldMeta, useForm, withMeta } from './index.mjs';
|
|
5
|
-
export { P as PathInput, a as PathOutput } from './shared/attaform.
|
|
5
|
+
export { P as PathInput, a as PathOutput } from './shared/attaform.DD0Y8krq.mjs';
|
|
6
6
|
import 'vue';
|
|
7
7
|
import './shared/attaform.B-Tb62qV.mjs';
|
|
8
8
|
import 'zod';
|
package/dist/zod.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform.BhtAZysa.mjs';
|
|
2
|
-
export { A as AttaformErrorCode
|
|
2
|
+
export { A as AttaformErrorCode } from './shared/attaform.CgyyJVuq.mjs';
|
|
3
3
|
export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform.CdA9bfRv.mjs';
|
|
4
|
-
export { a as assignKey, v as vRegister } from './shared/attaform.
|
|
5
|
-
export {
|
|
4
|
+
export { a as assignKey, v as vRegister } from './shared/attaform.T0YjhjPU.mjs';
|
|
5
|
+
export { e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform.DCUJCKyG.mjs';
|
|
6
|
+
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.BJeiuJE2.mjs';
|
|
6
7
|
export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
|
package/package.json
CHANGED
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import { s as safeAssign, a as safeOwnRead, r as readConsumerIndex, c as consumerKeys, b as readConsumerProp } from './attaform-dev.CwYTWyPX.mjs';
|
|
2
|
-
import { m as mapSegmentKeys, f as pathsEqual, i as isPathPrefix } from './attaform-dev.04aupFBW.mjs';
|
|
3
|
-
|
|
4
|
-
const DEFAULT_FIELD_VALIDATION_DEBOUNCE_MS = 0;
|
|
5
|
-
const DEFAULT_HISTORY_MAX_SNAPSHOTS = 128;
|
|
6
|
-
const RESERVED_KEY_PREFIX = "__atta:";
|
|
7
|
-
const ANONYMOUS_FORM_KEY_PREFIX = `${RESERVED_KEY_PREFIX}anon:`;
|
|
8
|
-
const ANONYMOUS_WIZARD_KEY_PREFIX = `${RESERVED_KEY_PREFIX}anon-wizard:`;
|
|
9
|
-
const DEFAULT_MAX_RECURSION_DEPTH = 64;
|
|
10
|
-
function normalizeNumericOption(config) {
|
|
11
|
-
const { value, source, min, defaultValue } = config;
|
|
12
|
-
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
13
|
-
{
|
|
14
|
-
console.warn(
|
|
15
|
-
`[attaform] ${source} must be a non-negative finite integer; got ${String(value)}. Falling back to ${String(defaultValue)}.`
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
return defaultValue;
|
|
19
|
-
}
|
|
20
|
-
return Math.max(min, Math.floor(value));
|
|
21
|
-
}
|
|
22
|
-
function pickDefined(bag) {
|
|
23
|
-
const out = {};
|
|
24
|
-
for (const key of Object.keys(bag)) {
|
|
25
|
-
if (bag[key] !== void 0) out[key] = bag[key];
|
|
26
|
-
}
|
|
27
|
-
return out;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function isDescendable(value) {
|
|
31
|
-
if (value === null || typeof value !== "object") return false;
|
|
32
|
-
if (Array.isArray(value)) return true;
|
|
33
|
-
if (value instanceof Map) return mapSegmentKeys(value) !== null;
|
|
34
|
-
const proto = Object.getPrototypeOf(value);
|
|
35
|
-
return proto === null || proto === Object.prototype;
|
|
36
|
-
}
|
|
37
|
-
function isBarePatch(patch) {
|
|
38
|
-
return patch.kind === "added" ? isDescendable(patch.newValue) : patch.kind === "removed" && isDescendable(patch.oldValue);
|
|
39
|
-
}
|
|
40
|
-
function appendSegment(prefix, segment) {
|
|
41
|
-
const next = new Array(prefix.length + 1);
|
|
42
|
-
for (let i = 0; i < prefix.length; i++) {
|
|
43
|
-
const s = prefix[i];
|
|
44
|
-
next[i] = s;
|
|
45
|
-
}
|
|
46
|
-
next[prefix.length] = segment;
|
|
47
|
-
return next;
|
|
48
|
-
}
|
|
49
|
-
function diffAndApply(oldValue, newValue, prefix, visit) {
|
|
50
|
-
if (Object.is(oldValue, newValue)) return;
|
|
51
|
-
const oldIsDescendable = isDescendable(oldValue);
|
|
52
|
-
const newIsDescendable = isDescendable(newValue);
|
|
53
|
-
if (oldValue === void 0 && newIsDescendable) {
|
|
54
|
-
walkDescendable(newValue, prefix, visit, true);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
if (oldIsDescendable && newValue === void 0) {
|
|
58
|
-
walkDescendable(oldValue, prefix, visit, false);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (oldIsDescendable && newIsDescendable) {
|
|
62
|
-
const oldIsMap = oldValue instanceof Map;
|
|
63
|
-
const newIsMap = newValue instanceof Map;
|
|
64
|
-
if (oldIsMap && newIsMap) {
|
|
65
|
-
diffMapsLockstep(oldValue, newValue, prefix, visit);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (oldIsMap !== newIsMap) {
|
|
69
|
-
visit({ kind: "changed", path: prefix, oldValue, newValue });
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const oldIsArray = Array.isArray(oldValue);
|
|
73
|
-
const newIsArray = Array.isArray(newValue);
|
|
74
|
-
if (oldIsArray && newIsArray) {
|
|
75
|
-
diffArraysLockstep(oldValue, newValue, prefix, visit);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
if (!oldIsArray && !newIsArray) {
|
|
79
|
-
diffObjectsLockstep(
|
|
80
|
-
oldValue,
|
|
81
|
-
newValue,
|
|
82
|
-
prefix,
|
|
83
|
-
visit
|
|
84
|
-
);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
visit({ kind: "changed", path: prefix, oldValue, newValue });
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (oldIsDescendable && !newIsDescendable) {
|
|
91
|
-
visit({ kind: "changed", path: prefix, oldValue, newValue });
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
if (!oldIsDescendable && newIsDescendable) {
|
|
95
|
-
visit({ kind: "changed", path: prefix, oldValue, newValue });
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (oldValue === void 0) {
|
|
99
|
-
visit({ kind: "added", path: prefix, newValue });
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (newValue === void 0) {
|
|
103
|
-
visit({ kind: "removed", path: prefix, oldValue });
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
visit({ kind: "changed", path: prefix, oldValue, newValue });
|
|
107
|
-
}
|
|
108
|
-
function walkDescendable(value, prefix, visit, arrived) {
|
|
109
|
-
let reported = false;
|
|
110
|
-
if (Array.isArray(value)) {
|
|
111
|
-
for (let i = 0; i < value.length; i++) {
|
|
112
|
-
diffSlot(readConsumerIndex(value, i), appendSegment(prefix, i), visit, arrived);
|
|
113
|
-
}
|
|
114
|
-
reported = value.length > 0;
|
|
115
|
-
} else if (value instanceof Map) {
|
|
116
|
-
for (const [key, entry] of value) {
|
|
117
|
-
diffSlot(entry, appendSegment(prefix, key), visit, arrived);
|
|
118
|
-
}
|
|
119
|
-
reported = value.size > 0;
|
|
120
|
-
} else {
|
|
121
|
-
const rec = value;
|
|
122
|
-
for (const k of consumerKeys(rec)) {
|
|
123
|
-
const entry = readConsumerProp(rec, k);
|
|
124
|
-
if (entry === void 0) continue;
|
|
125
|
-
reported = true;
|
|
126
|
-
if (arrived) diffAndApply(void 0, entry, appendSegment(prefix, k), visit);
|
|
127
|
-
else diffAndApply(entry, void 0, appendSegment(prefix, k), visit);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
if (!reported) visit(presencePatch(arrived, prefix, value));
|
|
131
|
-
}
|
|
132
|
-
function diffSlot(entry, path, visit, arrived) {
|
|
133
|
-
if (entry === void 0) visit(presencePatch(arrived, path, entry));
|
|
134
|
-
else if (arrived) diffAndApply(void 0, entry, path, visit);
|
|
135
|
-
else diffAndApply(entry, void 0, path, visit);
|
|
136
|
-
}
|
|
137
|
-
function presencePatch(arrived, path, value) {
|
|
138
|
-
return arrived ? { kind: "added", path, newValue: value } : { kind: "removed", path, oldValue: value };
|
|
139
|
-
}
|
|
140
|
-
function diffMapsLockstep(oldMap, newMap, prefix, visit) {
|
|
141
|
-
for (const [key, entry] of newMap) {
|
|
142
|
-
const path = appendSegment(prefix, key);
|
|
143
|
-
if (oldMap.has(key)) diffAndApply(oldMap.get(key), entry, path, visit);
|
|
144
|
-
else diffSlot(entry, path, visit, true);
|
|
145
|
-
}
|
|
146
|
-
for (const [key, entry] of oldMap) {
|
|
147
|
-
if (!newMap.has(key)) diffSlot(entry, appendSegment(prefix, key), visit, false);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function diffArraysLockstep(oldArr, newArr, prefix, visit) {
|
|
151
|
-
const min = Math.min(oldArr.length, newArr.length);
|
|
152
|
-
for (let i = 0; i < min; i++) {
|
|
153
|
-
diffAndApply(
|
|
154
|
-
readConsumerIndex(oldArr, i),
|
|
155
|
-
readConsumerIndex(newArr, i),
|
|
156
|
-
appendSegment(prefix, i),
|
|
157
|
-
visit
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
for (let i = min; i < newArr.length; i++) {
|
|
161
|
-
diffSlot(readConsumerIndex(newArr, i), appendSegment(prefix, i), visit, true);
|
|
162
|
-
}
|
|
163
|
-
for (let i = min; i < oldArr.length; i++) {
|
|
164
|
-
diffSlot(readConsumerIndex(oldArr, i), appendSegment(prefix, i), visit, false);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
function diffObjectsLockstep(oldRec, newRec, prefix, visit) {
|
|
168
|
-
const seen = /* @__PURE__ */ new Set();
|
|
169
|
-
for (const k of consumerKeys(oldRec)) {
|
|
170
|
-
seen.add(k);
|
|
171
|
-
diffAndApply(
|
|
172
|
-
readConsumerProp(oldRec, k),
|
|
173
|
-
readConsumerProp(newRec, k),
|
|
174
|
-
appendSegment(prefix, k),
|
|
175
|
-
visit
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
for (const k of consumerKeys(newRec)) {
|
|
179
|
-
if (seen.has(k)) continue;
|
|
180
|
-
diffAndApply(
|
|
181
|
-
readConsumerProp(oldRec, k),
|
|
182
|
-
readConsumerProp(newRec, k),
|
|
183
|
-
appendSegment(prefix, k),
|
|
184
|
-
visit
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
function applyChangedKeys(target, source, arrayOpPath, currentPath, patches) {
|
|
189
|
-
if (!isDescendable(target) || !isDescendable(source)) return false;
|
|
190
|
-
if (target instanceof Map || source instanceof Map) return false;
|
|
191
|
-
const targetIsArray = Array.isArray(target);
|
|
192
|
-
const sourceIsArray = Array.isArray(source);
|
|
193
|
-
if (targetIsArray !== sourceIsArray) return false;
|
|
194
|
-
const depth = currentPath.length;
|
|
195
|
-
const changedFirstSegments = /* @__PURE__ */ new Set();
|
|
196
|
-
for (const patch of patches) {
|
|
197
|
-
if (patch.path.length === depth) return false;
|
|
198
|
-
changedFirstSegments.add(patch.path[depth]);
|
|
199
|
-
}
|
|
200
|
-
if (targetIsArray) {
|
|
201
|
-
const t = target;
|
|
202
|
-
const s = source;
|
|
203
|
-
if (arrayOpPath === null || pathsEqual(currentPath, arrayOpPath)) {
|
|
204
|
-
if (t.length > s.length) t.length = s.length;
|
|
205
|
-
for (const idx of changedFirstSegments) {
|
|
206
|
-
const i = typeof idx === "number" ? idx : Number(idx);
|
|
207
|
-
if (i >= s.length) continue;
|
|
208
|
-
t[i] = s[i];
|
|
209
|
-
}
|
|
210
|
-
} else {
|
|
211
|
-
for (const idx of changedFirstSegments) {
|
|
212
|
-
const i = typeof idx === "number" ? idx : Number(idx);
|
|
213
|
-
if (i >= s.length) continue;
|
|
214
|
-
const childPath = appendSegment(currentPath, i);
|
|
215
|
-
const curEl = t[i];
|
|
216
|
-
const nextEl = s[i];
|
|
217
|
-
if (isPathPrefix(childPath, arrayOpPath) && isDescendable(curEl) && isDescendable(nextEl) && applyChangedKeys(
|
|
218
|
-
curEl,
|
|
219
|
-
nextEl,
|
|
220
|
-
arrayOpPath,
|
|
221
|
-
childPath,
|
|
222
|
-
patches.filter((p) => isPathPrefix(childPath, p.path))
|
|
223
|
-
)) {
|
|
224
|
-
continue;
|
|
225
|
-
}
|
|
226
|
-
t[i] = nextEl;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
} else {
|
|
230
|
-
const t = target;
|
|
231
|
-
const s = source;
|
|
232
|
-
const sourceKeys = new Set(Object.keys(s));
|
|
233
|
-
for (const k of Object.keys(t)) {
|
|
234
|
-
if (!sourceKeys.has(k)) delete t[k];
|
|
235
|
-
}
|
|
236
|
-
for (const k of changedFirstSegments) {
|
|
237
|
-
const key = String(k);
|
|
238
|
-
const nextVal = safeOwnRead(s, key);
|
|
239
|
-
if (arrayOpPath !== null) {
|
|
240
|
-
const curVal = safeOwnRead(t, key);
|
|
241
|
-
const childPath = appendSegment(currentPath, key);
|
|
242
|
-
if (isDescendable(curVal) && isDescendable(nextVal) && applyChangedKeys(
|
|
243
|
-
curVal,
|
|
244
|
-
nextVal,
|
|
245
|
-
arrayOpPath,
|
|
246
|
-
childPath,
|
|
247
|
-
patches.filter((p) => isPathPrefix(childPath, p.path))
|
|
248
|
-
)) {
|
|
249
|
-
continue;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
safeAssign(t, key, nextVal);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
return true;
|
|
256
|
-
}
|
|
257
|
-
function structuralSnapshot(value) {
|
|
258
|
-
if (!isDescendable(value)) return value;
|
|
259
|
-
if (value instanceof Map) {
|
|
260
|
-
const out2 = /* @__PURE__ */ new Map();
|
|
261
|
-
for (const [k, v] of value) out2.set(k, structuralSnapshot(v));
|
|
262
|
-
return out2;
|
|
263
|
-
}
|
|
264
|
-
if (Array.isArray(value)) {
|
|
265
|
-
const out2 = new Array(value.length);
|
|
266
|
-
for (let i = 0; i < value.length; i++) {
|
|
267
|
-
out2[i] = structuralSnapshot(value[i]);
|
|
268
|
-
}
|
|
269
|
-
return out2;
|
|
270
|
-
}
|
|
271
|
-
const src = value;
|
|
272
|
-
const out = {};
|
|
273
|
-
for (const k of Object.keys(src)) {
|
|
274
|
-
safeAssign(out, k, structuralSnapshot(safeOwnRead(src, k)));
|
|
275
|
-
}
|
|
276
|
-
return out;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
export { ANONYMOUS_FORM_KEY_PREFIX as A, DEFAULT_HISTORY_MAX_SNAPSHOTS as D, RESERVED_KEY_PREFIX as R, DEFAULT_FIELD_VALIDATION_DEBOUNCE_MS as a, isDescendable as b, applyChangedKeys as c, diffAndApply as d, DEFAULT_MAX_RECURSION_DEPTH as e, ANONYMOUS_WIZARD_KEY_PREFIX as f, isBarePatch as i, normalizeNumericOption as n, pickDefined as p, structuralSnapshot as s };
|