attaform 0.27.6 → 0.29.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.
- package/dist/abstract.d.mts +5 -4
- package/dist/abstract.mjs +4 -3
- package/dist/chunks/fingerprint.mjs +1 -2
- package/dist/chunks/fingerprint2.mjs +2 -3
- package/dist/dev/abstract.mjs +4 -0
- package/dist/{chunks → dev/chunks}/dev-key-collision-warnings.mjs +0 -1
- package/dist/{chunks → dev/chunks}/devtools.mjs +5 -6
- package/dist/{chunks/fingerprint.cjs → dev/chunks/fingerprint.mjs} +7 -10
- package/dist/{chunks/fingerprint2.cjs → dev/chunks/fingerprint2.mjs} +32 -35
- package/dist/dev/directive.mjs +1 -0
- package/dist/dev/history.mjs +89 -0
- package/dist/dev/index.mjs +5 -0
- package/dist/dev/runtime/plugins/attaform.mjs +40 -0
- package/dist/dev/shared/attaform-dev.A-TpJW0B.mjs +207 -0
- package/dist/dev/shared/attaform-dev.BO-71R54.mjs +820 -0
- package/dist/{shared/attaform.D6tk90Rc.cjs → dev/shared/attaform-dev.BgM6FdtA.mjs} +324 -73
- package/dist/dev/shared/attaform-dev.ButTkwHd.mjs +375 -0
- package/dist/{shared/attaform.BJGA_UOS.mjs → dev/shared/attaform-dev.BxfsuwBR.mjs} +8 -1
- package/dist/{shared/attaform.nMaz2C5P.mjs → dev/shared/attaform-dev.D8aoKb89.mjs} +190 -400
- package/dist/dev/shared/attaform-dev.DD5m2W51.mjs +220 -0
- package/dist/{shared/attaform.CKH2lGdL.mjs → dev/shared/attaform-dev.DHuydLAC.mjs} +3867 -4731
- package/dist/{shared/attaform.DYEr28Pt.mjs → dev/shared/attaform-dev.DrzObAZo.mjs} +6 -7
- package/dist/{shared/attaform.B1ZYt2Li.mjs → dev/shared/attaform-dev.q6UutkCx.mjs} +274 -672
- package/dist/dev/zod-v3.mjs +17 -0
- package/dist/dev/zod-v4.mjs +16 -0
- package/dist/dev/zod.mjs +5 -0
- package/dist/directive.d.mts +20 -0
- package/dist/directive.mjs +1 -0
- package/dist/esbuild.mjs +0 -1
- package/dist/history.d.mts +59 -0
- package/dist/history.mjs +89 -0
- package/dist/index.d.mts +14 -6
- package/dist/index.mjs +5 -4
- package/dist/nuxt.d.mts +10 -10
- package/dist/nuxt.mjs +5 -2
- package/dist/rollup.mjs +0 -1
- package/dist/rspack.d.mts +6 -1
- package/dist/rspack.mjs +0 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue +9 -8
- package/dist/runtime/plugins/attaform.mjs +1 -2
- package/dist/shared/{attaform.CoR4mWfv.mjs → attaform.B0dKL8ST.mjs} +309 -46
- package/dist/shared/{attaform.Cs2Rbdlo.mjs → attaform.BK0cgu2K.mjs} +123 -140
- package/dist/shared/{attaform.B9Wyhfro.cjs → attaform.BndjUUYX.mjs} +11 -16
- package/dist/shared/{attaform.CQN9R62B.cjs → attaform.BxfsuwBR.mjs} +9 -4
- package/dist/shared/attaform.C2MVyuxC.mjs +811 -0
- package/dist/shared/{attaform.Fp3sCrVs.d.ts → attaform.CIWLMY-R.d.mts} +2 -2
- package/dist/shared/attaform.CZMAYwSK.mjs +6383 -0
- package/dist/shared/attaform.CZYt_5N_.mjs +207 -0
- package/dist/shared/{attaform.DniawQLP.d.cts → attaform.CsoeRi3P.d.mts} +490 -98
- package/dist/shared/attaform.Cvao8bW5.mjs +358 -0
- package/dist/shared/attaform.D0x-qSXm.mjs +197 -0
- package/dist/shared/{attaform.D8kliaKw.cjs → attaform.D1fnTifF.mjs} +279 -692
- package/dist/shared/{attaform.CHlJLAiv.d.mts → attaform.DDtqHYv1.d.mts} +155 -184
- package/dist/shared/{attaform.Biytrv0-.cjs → attaform.DffRL5pP.mjs} +215 -547
- package/dist/shared/attaform.DhnPb6nK.mjs +0 -1
- package/dist/shared/attaform.KvlEedlF.mjs +0 -1
- package/dist/shared/attaform.axHXVQO7.d.mts +44 -0
- package/dist/shared/attaform.v0fQtWyA.mjs +0 -1
- package/dist/transforms.d.mts +0 -22
- package/dist/transforms.mjs +1 -2
- package/dist/vite.d.mts +30 -9
- package/dist/vite.mjs +27 -4
- package/dist/webpack.d.mts +6 -1
- package/dist/webpack.mjs +0 -1
- package/dist/zod-v3.d.mts +13 -6
- package/dist/zod-v3.mjs +17 -4
- package/dist/zod-v4.d.mts +19 -26
- package/dist/zod-v4.mjs +16 -4
- package/dist/zod.d.mts +4 -3
- package/dist/zod.mjs +5 -4
- package/package.json +38 -20
- package/skills/attaform/SKILL.md +6 -2
- package/skills/attaform/references/custom-components.md +7 -2
- package/skills/attaform/references/errors.md +8 -3
- package/skills/attaform/references/saving.md +77 -0
- package/skills/attaform/references/wizards.md +10 -8
- package/dist/abstract.cjs +0 -48
- package/dist/abstract.cjs.map +0 -1
- package/dist/abstract.d.cts +0 -42
- package/dist/abstract.d.ts +0 -42
- package/dist/abstract.mjs.map +0 -1
- package/dist/chunks/dev-key-collision-warnings.cjs +0 -25
- package/dist/chunks/dev-key-collision-warnings.cjs.map +0 -1
- package/dist/chunks/dev-key-collision-warnings.mjs.map +0 -1
- package/dist/chunks/devtools.cjs +0 -157
- package/dist/chunks/devtools.cjs.map +0 -1
- package/dist/chunks/devtools.mjs.map +0 -1
- package/dist/chunks/fingerprint.cjs.map +0 -1
- package/dist/chunks/fingerprint.mjs.map +0 -1
- package/dist/chunks/fingerprint2.cjs.map +0 -1
- package/dist/chunks/fingerprint2.mjs.map +0 -1
- package/dist/esbuild.cjs +0 -28
- package/dist/esbuild.cjs.map +0 -1
- package/dist/esbuild.d.cts +0 -56
- package/dist/esbuild.d.ts +0 -56
- package/dist/esbuild.mjs.map +0 -1
- package/dist/index.cjs +0 -51
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -249
- package/dist/index.d.ts +0 -249
- package/dist/index.mjs.map +0 -1
- package/dist/nuxt.cjs +0 -84
- package/dist/nuxt.cjs.map +0 -1
- package/dist/nuxt.d.cts +0 -66
- package/dist/nuxt.d.ts +0 -66
- package/dist/nuxt.mjs.map +0 -1
- package/dist/rollup.cjs +0 -24
- package/dist/rollup.cjs.map +0 -1
- package/dist/rollup.d.cts +0 -35
- package/dist/rollup.d.ts +0 -35
- package/dist/rollup.mjs.map +0 -1
- package/dist/rspack.cjs +0 -10
- package/dist/rspack.cjs.map +0 -1
- package/dist/rspack.d.cts +0 -40
- package/dist/rspack.d.ts +0 -40
- package/dist/rspack.mjs.map +0 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue.d.ts +0 -7
- package/dist/runtime/components/DevtoolsValueTree.vue.d.ts +0 -35
- package/dist/runtime/plugins/attaform.cjs +0 -43
- package/dist/runtime/plugins/attaform.cjs.map +0 -1
- package/dist/runtime/plugins/attaform.d.cts +0 -5
- package/dist/runtime/plugins/attaform.d.ts +0 -5
- package/dist/runtime/plugins/attaform.mjs.map +0 -1
- package/dist/shared/attaform.B1ZYt2Li.mjs.map +0 -1
- package/dist/shared/attaform.B9Wyhfro.cjs.map +0 -1
- package/dist/shared/attaform.BGDV42hI.d.cts +0 -232
- package/dist/shared/attaform.BJGA_UOS.mjs.map +0 -1
- package/dist/shared/attaform.Biytrv0-.cjs.map +0 -1
- package/dist/shared/attaform.Bn0IzhD_.cjs +0 -800
- package/dist/shared/attaform.Bn0IzhD_.cjs.map +0 -1
- package/dist/shared/attaform.C9fPTxjB.d.cts +0 -41
- package/dist/shared/attaform.C9fPTxjB.d.ts +0 -41
- package/dist/shared/attaform.CKH2lGdL.mjs.map +0 -1
- package/dist/shared/attaform.CQN9R62B.cjs.map +0 -1
- package/dist/shared/attaform.CoR4mWfv.mjs.map +0 -1
- package/dist/shared/attaform.Cs2Rbdlo.mjs.map +0 -1
- package/dist/shared/attaform.D6tk90Rc.cjs.map +0 -1
- package/dist/shared/attaform.D8kliaKw.cjs.map +0 -1
- package/dist/shared/attaform.DLknk9nF.d.mts +0 -232
- package/dist/shared/attaform.DMxM2kol.mjs +0 -1275
- package/dist/shared/attaform.DMxM2kol.mjs.map +0 -1
- package/dist/shared/attaform.DRUT703x.d.cts +0 -56
- package/dist/shared/attaform.DRUT703x.d.ts +0 -56
- package/dist/shared/attaform.DYEr28Pt.mjs.map +0 -1
- package/dist/shared/attaform.DdQN7sgN.cjs +0 -1302
- package/dist/shared/attaform.DdQN7sgN.cjs.map +0 -1
- package/dist/shared/attaform.DhnPb6nK.mjs.map +0 -1
- package/dist/shared/attaform.DniawQLP.d.mts +0 -4763
- package/dist/shared/attaform.DniawQLP.d.ts +0 -4763
- package/dist/shared/attaform.DoQm_Vkd.cjs +0 -58
- package/dist/shared/attaform.DoQm_Vkd.cjs.map +0 -1
- package/dist/shared/attaform.DrvMscNX.cjs +0 -7697
- package/dist/shared/attaform.DrvMscNX.cjs.map +0 -1
- package/dist/shared/attaform.F2Q8iv38.d.ts +0 -2494
- package/dist/shared/attaform.FmqKO1Ex.d.cts +0 -2494
- package/dist/shared/attaform.KvlEedlF.mjs.map +0 -1
- package/dist/shared/attaform.RaTzp1WF.cjs +0 -26
- package/dist/shared/attaform.RaTzp1WF.cjs.map +0 -1
- package/dist/shared/attaform.nMaz2C5P.mjs.map +0 -1
- package/dist/shared/attaform.v0fQtWyA.mjs.map +0 -1
- package/dist/shared/attaform.yUrz7C2z.cjs +0 -29
- package/dist/shared/attaform.yUrz7C2z.cjs.map +0 -1
- package/dist/transforms.cjs +0 -12
- package/dist/transforms.cjs.map +0 -1
- package/dist/transforms.d.cts +0 -73
- package/dist/transforms.d.ts +0 -73
- package/dist/transforms.mjs.map +0 -1
- package/dist/vite.cjs +0 -363
- package/dist/vite.cjs.map +0 -1
- package/dist/vite.d.cts +0 -133
- package/dist/vite.d.ts +0 -133
- package/dist/vite.mjs.map +0 -1
- package/dist/webpack.cjs +0 -10
- package/dist/webpack.cjs.map +0 -1
- package/dist/webpack.d.cts +0 -37
- package/dist/webpack.d.ts +0 -37
- package/dist/webpack.mjs.map +0 -1
- package/dist/zod-v3.cjs +0 -53
- package/dist/zod-v3.cjs.map +0 -1
- package/dist/zod-v3.d.cts +0 -246
- package/dist/zod-v3.d.ts +0 -246
- package/dist/zod-v3.mjs.map +0 -1
- package/dist/zod-v4.cjs +0 -55
- package/dist/zod-v4.cjs.map +0 -1
- package/dist/zod-v4.d.cts +0 -172
- package/dist/zod-v4.d.ts +0 -172
- package/dist/zod-v4.mjs.map +0 -1
- package/dist/zod.cjs +0 -51
- package/dist/zod.cjs.map +0 -1
- package/dist/zod.d.cts +0 -7
- package/dist/zod.d.ts +0 -7
- package/dist/zod.mjs.map +0 -1
package/dist/abstract.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { A as AttaformRegistry } from './shared/attaform.
|
|
2
|
-
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, C as CompiledStep, D as DEFAULT_TIMINGS, f as DEVTOOLS_WINDOW_KEY, g as DisplayTimings, F as FormStatus, h as FormStatusSeed, G as GateMarker, I as InjectWizardInput, i as InvalidPathError, j as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, k as ReservedFormKeyError, S as SerializedAttaformState, l as SerializedFormData, m as StepSlot, n as SubmitErrorHandlerError, U as
|
|
3
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, A as AbstractSchema, D as DefaultValuesInput, a as UseFormReturnType } from './shared/attaform.
|
|
4
|
-
export { b as ArrayItem, c as ArrayPath, d as AttaformDefaults, C as CoercionEntry, e as CoercionRegistry, f as CoercionResult, g as CustomDirectiveRegisterAssignerFn, h as DeepPartial, i as DefaultValuesResponse, j as DefaultValuesShape, k as DisplayCtx, l as DisplayMachine, m as DisplayState, E as ErrorInput, n as ErrorsProxyShape, o as FieldMetaPayload, p as FieldState, q as FieldStateMap, r as FieldStateMapEntry, s as FlatPath, t as FormErrorRecord, u as FormErrorsSurface, v as FormMeta, w as GetDisplayState, H as HandleSubmit, x as
|
|
1
|
+
import { A as AttaformRegistry } from './shared/attaform.DDtqHYv1.mjs';
|
|
2
|
+
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, C as CompiledStep, D as DEFAULT_TIMINGS, f as DEVTOOLS_WINDOW_KEY, g as DisplayTimings, F as FormStatus, h as FormStatusSeed, G as GateMarker, I as InjectWizardInput, i as InvalidPathError, j as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, k as ReservedFormKeyError, S as SerializedAttaformState, l as SerializedFormData, m as StepSlot, n as SubmitErrorHandlerError, U as UseRegisterOptions, o as UseRegisterReturn, p as UseWizardReturnType, W as WizardAggregateError, q as WizardCtx, r as WizardCtxForm, s as WizardOnError, t as WizardOnSubmit, u as WizardOptions, v as WizardPersistFn, w as WizardRestoreFn, x as WizardRestoreState, y as WizardStatusesProxy, z as WizardSubmitContext, B as assignKey, E as createAttaform, H as createRegistry, J as defaultCoercionRules, K as defaultDisplayState, M as defineCoercion, N as escapeForInlineScript, P as gate, Q as getRegistryFromApp, T as hydrateAttaformState, V as injectForm, X as injectWizard, Y as isRegisterValue, Z as kAttaformRegistry, _ as lazy, $ as makeDefaultDisplayState, a0 as renderAttaformState, a1 as useRegister, a2 as useRegistry, a3 as useWizard } from './shared/attaform.DDtqHYv1.mjs';
|
|
3
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, A as AbstractSchema, D as DefaultValuesInput, a as UseFormReturnType } from './shared/attaform.CsoeRi3P.mjs';
|
|
4
|
+
export { b as ArrayItem, c as ArrayPath, d as AttaformDefaults, C as CoercionEntry, e as CoercionRegistry, f as CoercionResult, g as CustomDirectiveRegisterAssignerFn, h as DeepPartial, i as DefaultValuesResponse, j as DefaultValuesShape, k as DisplayCtx, l as DisplayMachine, m as DisplayState, E as ErrorInput, n as ErrorsProxyShape, o as FieldMetaPayload, p as FieldState, q as FieldStateMap, r as FieldStateMapEntry, s as FlatPath, t as FormErrorRecord, u as FormErrorsSurface, v as FormMeta, w as GetDisplayState, H as HandleSubmit, x as HistoryPlugin, I as IsTuple, y as IsUnion, J as JoinSegments, z as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, B as NestedType, O as OnError, P as OnInvalidSubmitPolicy, Q as OnSubmit, R as ParseOptions, S as PartialFlatPath, T as Path, V as PathKey, W as PendingValidationStatus, X as Primitive, Y as ROOT_PATH, Z as ROOT_PATH_KEY, _ as ReactiveValidationStatus, $ as RecordPath, a0 as RecordValue, a1 as RegisterDirective, a2 as RegisterFlatPath, a3 as RegisterOptions, a4 as RegisterSelectModifier, a5 as RegisterTextModifier, a6 as RegisterTransform, a7 as RegisterValue, a8 as Segment, a9 as SetValueCallback, aa as SetValuePayload, ab as SettledValidationStatus, ac as SlimPrimitiveKind, ad as SlimRuntimeOf, ae as SubmitHandler, af as Unset, ag as ValidateOn, ah as ValidateOnConfig, ai as ValidationError, aj as ValidationResponse, ak as ValidationResponseWithoutValue, al as ValueOfUnion, am as WriteMeta, an as WriteShape, ao as canonicalizePath, ap as isPathPrefix, aq as isUnset, ar as parseDottedPath, as as unset } from './shared/attaform.CsoeRi3P.mjs';
|
|
5
|
+
export { v as vRegister } from './shared/attaform.axHXVQO7.mjs';
|
|
5
6
|
import 'vue';
|
|
6
7
|
|
|
7
8
|
/**
|
package/dist/abstract.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, h as useAbstractForm, j as useRegister, k as useWizard } from './shared/attaform.
|
|
2
|
-
export { A as AttaformError,
|
|
1
|
+
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, h as useAbstractForm, j as useRegister, k as useWizard } from './shared/attaform.CZMAYwSK.mjs';
|
|
2
|
+
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.CZYt_5N_.mjs';
|
|
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.D0x-qSXm.mjs';
|
|
4
|
+
export { a as assignKey, v as vRegister } from './shared/attaform.DffRL5pP.mjs';
|
|
3
5
|
export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
|
|
4
|
-
//# sourceMappingURL=abstract.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as canonicalStringify } from '../shared/attaform.
|
|
1
|
+
import { c as canonicalStringify } from '../shared/attaform.BxfsuwBR.mjs';
|
|
2
2
|
|
|
3
3
|
const cyclicSentinel = "<cyclic>";
|
|
4
4
|
function fingerprintZodSchema(schema) {
|
|
@@ -181,4 +181,3 @@ function formatChecks(checks) {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
export { fingerprintZodSchema };
|
|
184
|
-
//# sourceMappingURL=fingerprint.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as canonicalStringify } from '../shared/attaform.
|
|
2
|
-
import { k as kindOf, g as getIntersectionLeft, b as getIntersectionRight, c as unwrapLazy, d as unwrapInner, e as unwrapPipe,
|
|
1
|
+
import { c as canonicalStringify } from '../shared/attaform.BxfsuwBR.mjs';
|
|
2
|
+
import { k as kindOf, g as getIntersectionLeft, b as getIntersectionRight, c as unwrapLazy, d as unwrapInner, e as unwrapPipe, f as getDiscriminator, h as getDiscriminatedOptions, i as getUnionOptions, j as getRecordKeyType, l as getRecordValueType, m as getTupleItems, n as getSetValueType, o as getArrayElement, p as getObjectShape, q as getEnumValues, r as getLiteralValues, s as getChecks, t as getCatchDefault, v as getDefaultValue } from '../shared/attaform.C2MVyuxC.mjs';
|
|
3
3
|
|
|
4
4
|
const cyclicSentinel = "<cyclic>";
|
|
5
5
|
function fingerprintZodSchema(schema) {
|
|
@@ -157,4 +157,3 @@ function compare(a, b) {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
export { fingerprintZodSchema };
|
|
160
|
-
//# sourceMappingURL=fingerprint2.mjs.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, h as useAbstractForm, j as useRegister, k as useWizard } from './shared/attaform-dev.DHuydLAC.mjs';
|
|
2
|
+
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-dev.A-TpJW0B.mjs';
|
|
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-dev.DD5m2W51.mjs';
|
|
4
|
+
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.D8aoKb89.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { e as canonicalizePath } from '../shared/attaform-dev.A-TpJW0B.mjs';
|
|
2
2
|
|
|
3
3
|
const INSPECTOR_ID = "attaform";
|
|
4
4
|
const TIMELINE_LAYER_ID = "attaform:events";
|
|
@@ -114,15 +114,15 @@ function wire(api, app, registry) {
|
|
|
114
114
|
}
|
|
115
115
|
];
|
|
116
116
|
payload.state["Schema Errors"] = [
|
|
117
|
-
...[...state.
|
|
117
|
+
...[...state.errorCells.entries()].filter(([, cell]) => cell.schema.length > 0).map(([k, cell]) => ({
|
|
118
118
|
key: String(k),
|
|
119
|
-
value:
|
|
119
|
+
value: cell.schema
|
|
120
120
|
}))
|
|
121
121
|
];
|
|
122
122
|
payload.state["User Errors"] = [
|
|
123
|
-
...[...state.
|
|
123
|
+
...[...state.errorCells.entries()].filter(([, cell]) => cell.user.length > 0).map(([k, cell]) => ({
|
|
124
124
|
key: String(k),
|
|
125
|
-
value:
|
|
125
|
+
value: cell.user
|
|
126
126
|
}))
|
|
127
127
|
];
|
|
128
128
|
payload.state["Aggregates"] = [
|
|
@@ -152,4 +152,3 @@ function wire(api, app, registry) {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
export { setupAttaformDevtools };
|
|
155
|
-
//# sourceMappingURL=devtools.mjs.map
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const canonicalStringify = require('../shared/attaform.CQN9R62B.cjs');
|
|
1
|
+
import { c as canonicalStringify } from '../shared/attaform-dev.BxfsuwBR.mjs';
|
|
4
2
|
|
|
5
3
|
const cyclicSentinel = "<cyclic>";
|
|
6
4
|
function fingerprintZodSchema(schema) {
|
|
@@ -45,7 +43,7 @@ function computeFingerprint(schema, cache, inProgress) {
|
|
|
45
43
|
case "ZodNever":
|
|
46
44
|
return kind;
|
|
47
45
|
case "ZodLiteral":
|
|
48
|
-
return `ZodLiteral:${canonicalStringify
|
|
46
|
+
return `ZodLiteral:${canonicalStringify(def.value)}`;
|
|
49
47
|
case "ZodEnum": {
|
|
50
48
|
const values = Array.isArray(def.values) ? def.values : [];
|
|
51
49
|
const sorted = [...values].sort((a, b) => {
|
|
@@ -53,7 +51,7 @@ function computeFingerprint(schema, cache, inProgress) {
|
|
|
53
51
|
const bs = String(b);
|
|
54
52
|
return as < bs ? -1 : as > bs ? 1 : 0;
|
|
55
53
|
});
|
|
56
|
-
return `ZodEnum:${canonicalStringify
|
|
54
|
+
return `ZodEnum:${canonicalStringify(sorted)}`;
|
|
57
55
|
}
|
|
58
56
|
case "ZodNativeEnum": {
|
|
59
57
|
const values = def.values && typeof def.values === "object" && !Array.isArray(def.values) ? Object.values(def.values) : [];
|
|
@@ -62,7 +60,7 @@ function computeFingerprint(schema, cache, inProgress) {
|
|
|
62
60
|
const bs = String(b);
|
|
63
61
|
return as < bs ? -1 : as > bs ? 1 : 0;
|
|
64
62
|
});
|
|
65
|
-
return `ZodNativeEnum:${canonicalStringify
|
|
63
|
+
return `ZodNativeEnum:${canonicalStringify(sorted)}`;
|
|
66
64
|
}
|
|
67
65
|
case "ZodObject": {
|
|
68
66
|
const shape = readShapeSafely(def);
|
|
@@ -174,13 +172,12 @@ function defaultFactoryRepr(factory) {
|
|
|
174
172
|
}
|
|
175
173
|
if (!Object.is(first, second)) return "fn:*";
|
|
176
174
|
if (typeof first === "function") return "fn:*";
|
|
177
|
-
return canonicalStringify
|
|
175
|
+
return canonicalStringify(first);
|
|
178
176
|
}
|
|
179
177
|
function formatChecks(checks) {
|
|
180
178
|
if (!Array.isArray(checks) || checks.length === 0) return "";
|
|
181
|
-
const parts = checks.map((c) => canonicalStringify
|
|
179
|
+
const parts = checks.map((c) => canonicalStringify(c)).sort();
|
|
182
180
|
return `[${parts.join(";")}]`;
|
|
183
181
|
}
|
|
184
182
|
|
|
185
|
-
|
|
186
|
-
//# sourceMappingURL=fingerprint.cjs.map
|
|
183
|
+
export { fingerprintZodSchema };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const canonicalStringify = require('../shared/attaform.CQN9R62B.cjs');
|
|
4
|
-
const index = require('../shared/attaform.DdQN7sgN.cjs');
|
|
1
|
+
import { c as canonicalStringify } from '../shared/attaform-dev.BxfsuwBR.mjs';
|
|
2
|
+
import { k as kindOf, g as getIntersectionLeft, b as getIntersectionRight, c as unwrapLazy, d as unwrapInner, e as unwrapPipe, f as getDiscriminator, h as getDiscriminatedOptions, i as getUnionOptions, j as getRecordKeyType, l as getRecordValueType, m as getTupleItems, n as getSetValueType, o as getArrayElement, p as getObjectShape, q as getEnumValues, r as getLiteralValues, s as getChecks, t as getCatchDefault, v as getDefaultValue } from '../shared/attaform-dev.BO-71R54.mjs';
|
|
5
3
|
|
|
6
4
|
const cyclicSentinel = "<cyclic>";
|
|
7
5
|
function fingerprintZodSchema(schema) {
|
|
@@ -23,7 +21,7 @@ function visit(schema, cache, inProgress) {
|
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
23
|
function computeFingerprint(schema, cache, inProgress) {
|
|
26
|
-
const kind =
|
|
24
|
+
const kind = kindOf(schema);
|
|
27
25
|
const recurse = (child) => visit(child, cache, inProgress);
|
|
28
26
|
switch (kind) {
|
|
29
27
|
// Kind-only leaves: no further structure to descend into.
|
|
@@ -45,68 +43,68 @@ function computeFingerprint(schema, cache, inProgress) {
|
|
|
45
43
|
case "date":
|
|
46
44
|
return `${kind}${formatChecks(schema)}`;
|
|
47
45
|
case "literal": {
|
|
48
|
-
const values = [...
|
|
49
|
-
const as = canonicalStringify
|
|
50
|
-
const bs = canonicalStringify
|
|
46
|
+
const values = [...getLiteralValues(schema)].sort((a, b) => {
|
|
47
|
+
const as = canonicalStringify(a);
|
|
48
|
+
const bs = canonicalStringify(b);
|
|
51
49
|
return as < bs ? -1 : as > bs ? 1 : 0;
|
|
52
50
|
});
|
|
53
|
-
return `literal:${canonicalStringify
|
|
51
|
+
return `literal:${canonicalStringify(values)}`;
|
|
54
52
|
}
|
|
55
53
|
case "enum":
|
|
56
|
-
return `enum:${canonicalStringify
|
|
54
|
+
return `enum:${canonicalStringify([...getEnumValues(schema)].sort((a, b) => compare(a, b)))}`;
|
|
57
55
|
case "object": {
|
|
58
|
-
const shape =
|
|
56
|
+
const shape = getObjectShape(schema);
|
|
59
57
|
const sortedEntries = Object.entries(shape).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${recurse(v)}`);
|
|
60
58
|
return `object{${sortedEntries.join(",")}}${formatChecks(schema)}`;
|
|
61
59
|
}
|
|
62
60
|
case "array":
|
|
63
|
-
return `array[${recurse(
|
|
61
|
+
return `array[${recurse(getArrayElement(schema))}]${formatChecks(schema)}`;
|
|
64
62
|
case "set":
|
|
65
|
-
return `set<${recurse(
|
|
63
|
+
return `set<${recurse(getSetValueType(schema))}>${formatChecks(schema)}`;
|
|
66
64
|
case "tuple":
|
|
67
|
-
return `tuple[${
|
|
65
|
+
return `tuple[${getTupleItems(schema).map(recurse).join(",")}]`;
|
|
68
66
|
case "record":
|
|
69
|
-
return `record<${recurse(
|
|
67
|
+
return `record<${recurse(getRecordKeyType(schema))},${recurse(getRecordValueType(schema))}>`;
|
|
70
68
|
case "union": {
|
|
71
|
-
const options =
|
|
69
|
+
const options = getUnionOptions(schema).map(recurse).sort();
|
|
72
70
|
return `union(${options.join("|")})`;
|
|
73
71
|
}
|
|
74
72
|
case "discriminated-union": {
|
|
75
|
-
const disc =
|
|
76
|
-
const options =
|
|
73
|
+
const disc = getDiscriminator(schema) ?? "?";
|
|
74
|
+
const options = getDiscriminatedOptions(schema).map(recurse).sort();
|
|
77
75
|
return `dunion[${JSON.stringify(disc)}](${options.join("|")})`;
|
|
78
76
|
}
|
|
79
77
|
case "optional": {
|
|
80
|
-
const inner =
|
|
78
|
+
const inner = unwrapInner(schema);
|
|
81
79
|
return inner === void 0 ? "optional(?)" : `optional(${recurse(inner)})`;
|
|
82
80
|
}
|
|
83
81
|
case "nullable": {
|
|
84
|
-
const inner =
|
|
82
|
+
const inner = unwrapInner(schema);
|
|
85
83
|
return inner === void 0 ? "nullable(?)" : `nullable(${recurse(inner)})`;
|
|
86
84
|
}
|
|
87
85
|
case "default": {
|
|
88
|
-
const inner =
|
|
89
|
-
return `default[${stableValueRepr(
|
|
86
|
+
const inner = unwrapInner(schema);
|
|
87
|
+
return `default[${stableValueRepr(getDefaultValue, schema)}](${inner === void 0 ? "?" : recurse(inner)})`;
|
|
90
88
|
}
|
|
91
89
|
case "readonly": {
|
|
92
|
-
const inner =
|
|
90
|
+
const inner = unwrapInner(schema);
|
|
93
91
|
return inner === void 0 ? "readonly(?)" : `readonly(${recurse(inner)})`;
|
|
94
92
|
}
|
|
95
93
|
case "pipe": {
|
|
96
|
-
const inner =
|
|
94
|
+
const inner = unwrapPipe(schema);
|
|
97
95
|
return inner === void 0 ? "pipe(?)" : `pipe(${recurse(inner)})`;
|
|
98
96
|
}
|
|
99
97
|
case "catch": {
|
|
100
|
-
const inner =
|
|
101
|
-
return `catch[${stableValueRepr(
|
|
98
|
+
const inner = unwrapInner(schema);
|
|
99
|
+
return `catch[${stableValueRepr(getCatchDefault, schema)}](${inner === void 0 ? "?" : recurse(inner)})`;
|
|
102
100
|
}
|
|
103
101
|
case "lazy": {
|
|
104
|
-
const inner =
|
|
102
|
+
const inner = unwrapLazy(schema);
|
|
105
103
|
return inner === void 0 ? "lazy(?)" : `lazy(${recurse(inner)})`;
|
|
106
104
|
}
|
|
107
105
|
case "intersection": {
|
|
108
|
-
const left =
|
|
109
|
-
const right =
|
|
106
|
+
const left = getIntersectionLeft(schema);
|
|
107
|
+
const right = getIntersectionRight(schema);
|
|
110
108
|
const leftFp = left === void 0 ? "?" : recurse(left);
|
|
111
109
|
const rightFp = right === void 0 ? "?" : recurse(right);
|
|
112
110
|
const parts = [leftFp, rightFp].sort();
|
|
@@ -137,10 +135,10 @@ function stableValueRepr(get, schema) {
|
|
|
137
135
|
const first = get(schema);
|
|
138
136
|
const second = get(schema);
|
|
139
137
|
if (!Object.is(first, second) || typeof first === "function") return "fn:*";
|
|
140
|
-
return canonicalStringify
|
|
138
|
+
return canonicalStringify(first);
|
|
141
139
|
}
|
|
142
140
|
function formatChecks(schema) {
|
|
143
|
-
const checks =
|
|
141
|
+
const checks = getChecks(schema);
|
|
144
142
|
if (checks.length === 0) return "";
|
|
145
143
|
const parts = checks.map((c) => serializeCheck(c)).sort();
|
|
146
144
|
return `[${parts.join(";")}]`;
|
|
@@ -148,9 +146,9 @@ function formatChecks(schema) {
|
|
|
148
146
|
function serializeCheck(check) {
|
|
149
147
|
if (check !== null && typeof check === "object") {
|
|
150
148
|
const def = check._zod?.def;
|
|
151
|
-
if (def !== void 0) return canonicalStringify
|
|
149
|
+
if (def !== void 0) return canonicalStringify(def);
|
|
152
150
|
}
|
|
153
|
-
return canonicalStringify
|
|
151
|
+
return canonicalStringify(check);
|
|
154
152
|
}
|
|
155
153
|
function compare(a, b) {
|
|
156
154
|
const as = String(a);
|
|
@@ -158,5 +156,4 @@ function compare(a, b) {
|
|
|
158
156
|
return as < bs ? -1 : as > bs ? 1 : 0;
|
|
159
157
|
}
|
|
160
158
|
|
|
161
|
-
|
|
162
|
-
//# sourceMappingURL=fingerprint2.cjs.map
|
|
159
|
+
export { fingerprintZodSchema };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { b as installVRegister, v as vRegister, c as vRegisterFile } from './shared/attaform-dev.D8aoKb89.mjs';
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { shallowRef, computed } from 'vue';
|
|
2
|
+
import { n as normalizeNumericOption, D as DEFAULT_HISTORY_MAX_SNAPSHOTS, s as structuralSnapshot } from './shared/attaform-dev.ButTkwHd.mjs';
|
|
3
|
+
|
|
4
|
+
function captureErrorCells(map) {
|
|
5
|
+
const out = [];
|
|
6
|
+
for (const [k, cell] of map) {
|
|
7
|
+
out.push([k, { schema: [...cell.schema], user: [...cell.user] }]);
|
|
8
|
+
}
|
|
9
|
+
return out;
|
|
10
|
+
}
|
|
11
|
+
function createHistoryRuntime(kernel, max) {
|
|
12
|
+
const capacity = Math.max(1, max);
|
|
13
|
+
function captureSnapshot() {
|
|
14
|
+
return {
|
|
15
|
+
form: structuralSnapshot(kernel.form.value),
|
|
16
|
+
blankPaths: [...kernel.blankPaths],
|
|
17
|
+
errorCells: captureErrorCells(kernel.errorCells)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const positions = shallowRef([captureSnapshot()]);
|
|
21
|
+
const cursor = shallowRef(0);
|
|
22
|
+
let suppressNext = false;
|
|
23
|
+
const unsubscribeChange = kernel.onFormChange((_next, meta) => {
|
|
24
|
+
if (suppressNext) {
|
|
25
|
+
suppressNext = false;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (meta?.hydration === true) {
|
|
29
|
+
clear();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const next = positions.value.slice(0, cursor.value + 1);
|
|
33
|
+
next.push(captureSnapshot());
|
|
34
|
+
while (next.length > capacity) next.shift();
|
|
35
|
+
positions.value = next;
|
|
36
|
+
cursor.value = next.length - 1;
|
|
37
|
+
});
|
|
38
|
+
function restorePosition(snap) {
|
|
39
|
+
suppressNext = true;
|
|
40
|
+
kernel.blankPaths.clear();
|
|
41
|
+
for (const key of snap.blankPaths) kernel.blankPaths.add(key);
|
|
42
|
+
kernel.applyFormReplacement(structuralSnapshot(snap.form));
|
|
43
|
+
kernel.restoreErrorCells(snap.errorCells);
|
|
44
|
+
}
|
|
45
|
+
function stepTo(nextCursor) {
|
|
46
|
+
const snap = positions.value[nextCursor];
|
|
47
|
+
if (snap === void 0) return false;
|
|
48
|
+
cursor.value = nextCursor;
|
|
49
|
+
restorePosition(snap);
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
function undo() {
|
|
53
|
+
return cursor.value > 0 && stepTo(cursor.value - 1);
|
|
54
|
+
}
|
|
55
|
+
function redo() {
|
|
56
|
+
return cursor.value < positions.value.length - 1 && stepTo(cursor.value + 1);
|
|
57
|
+
}
|
|
58
|
+
function clear() {
|
|
59
|
+
positions.value = [captureSnapshot()];
|
|
60
|
+
cursor.value = 0;
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
undo,
|
|
64
|
+
redo,
|
|
65
|
+
clear,
|
|
66
|
+
canUndo: computed(() => cursor.value > 0),
|
|
67
|
+
canRedo: computed(() => cursor.value < positions.value.length - 1),
|
|
68
|
+
historySize: computed(() => positions.value.length),
|
|
69
|
+
dispose() {
|
|
70
|
+
unsubscribeChange();
|
|
71
|
+
positions.value = positions.value.slice(cursor.value, cursor.value + 1);
|
|
72
|
+
cursor.value = 0;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function historyPlugin(options) {
|
|
77
|
+
const max = normalizeNumericOption({
|
|
78
|
+
value: options?.max ?? DEFAULT_HISTORY_MAX_SNAPSHOTS,
|
|
79
|
+
source: "historyPlugin({ max })",
|
|
80
|
+
allowInfinity: false,
|
|
81
|
+
min: 0,
|
|
82
|
+
defaultValue: DEFAULT_HISTORY_MAX_SNAPSHOTS
|
|
83
|
+
});
|
|
84
|
+
return {
|
|
85
|
+
attach: (kernel) => createHistoryRuntime(kernel, max)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { historyPlugin };
|
|
@@ -0,0 +1,5 @@
|
|
|
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-dev.A-TpJW0B.mjs';
|
|
2
|
+
export { A as AttaformErrorCode, D as DEFAULT_TIMINGS, d as defaultCoercionRules, a as defaultDisplayState, b as defineCoercion, e as escapeForInlineScript, g as gate, i as injectForm, c as injectWizard, f as isUnset, l as lazy, m as makeDefaultDisplayState, u as unset, j as useRegister, k as useWizard } from './shared/attaform-dev.DHuydLAC.mjs';
|
|
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-dev.DD5m2W51.mjs';
|
|
4
|
+
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.D8aoKb89.mjs';
|
|
5
|
+
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform-dev.DrzObAZo.mjs';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { defineNuxtPlugin, useRuntimeConfig, useRoute } from 'nuxt/app';
|
|
2
|
+
import { c as createAttaform, b as kAttaformWizardActiveStepResolver, r as renderAttaformState, h as hydrateAttaformState, g as getRegistryFromApp, D as DEVTOOLS_WINDOW_KEY } from '../../shared/attaform-dev.DD5m2W51.mjs';
|
|
3
|
+
|
|
4
|
+
var attaform_default = defineNuxtPlugin({
|
|
5
|
+
// `enforce: 'pre'` makes the "we run before any component's setup" claim
|
|
6
|
+
// explicit. Combined with `prepend: true` on the addPlugin call in
|
|
7
|
+
// src/nuxt.ts, this guarantees hydration is staged into pendingHydration
|
|
8
|
+
// before any user plugin or page can call `useForm`. Without it, a user
|
|
9
|
+
// plugin running first would observe an empty registry and skip hydration.
|
|
10
|
+
enforce: "pre",
|
|
11
|
+
setup(nuxtApp) {
|
|
12
|
+
const isServer = import.meta.server;
|
|
13
|
+
const config = useRuntimeConfig().public;
|
|
14
|
+
const { defaults, version } = config.attaform;
|
|
15
|
+
nuxtApp.vueApp.use(createAttaform({ ssr: isServer, defaults }));
|
|
16
|
+
nuxtApp.vueApp.provide(kAttaformWizardActiveStepResolver, (param) => {
|
|
17
|
+
const value = useRoute().query[param];
|
|
18
|
+
if (typeof value === "string") return value;
|
|
19
|
+
if (Array.isArray(value) && typeof value[0] === "string") return value[0];
|
|
20
|
+
return void 0;
|
|
21
|
+
});
|
|
22
|
+
if (isServer) {
|
|
23
|
+
nuxtApp.hook("app:rendered", () => {
|
|
24
|
+
const state = renderAttaformState(nuxtApp.vueApp);
|
|
25
|
+
nuxtApp.payload.attaform = state;
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
const serialized = nuxtApp.payload.attaform;
|
|
29
|
+
if (serialized !== void 0) {
|
|
30
|
+
hydrateAttaformState(nuxtApp.vueApp, serialized);
|
|
31
|
+
}
|
|
32
|
+
if (import.meta.dev) {
|
|
33
|
+
const registry = getRegistryFromApp(nuxtApp.vueApp);
|
|
34
|
+
window[DEVTOOLS_WINDOW_KEY] = { registry, version };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export { attaform_default as default };
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
class AttaformError extends Error {
|
|
2
|
+
constructor(message, options) {
|
|
3
|
+
super(message, options);
|
|
4
|
+
this.name = new.target.name;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
class InvalidPathError extends AttaformError {
|
|
8
|
+
}
|
|
9
|
+
class InvalidUseFormConfigError extends AttaformError {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(
|
|
12
|
+
"[attaform] useForm received an invalid configuration (a schema directly, no argument, or no `schema` field). Pass it as `useForm({ schema })` \u2014 the schema is one of several configuration options. See https://attaform.dev/docs/reading-the-form/the-form for the full configuration shape."
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
class SubmitErrorHandlerError extends AttaformError {
|
|
17
|
+
}
|
|
18
|
+
function toError(value) {
|
|
19
|
+
if (value instanceof Error) return value;
|
|
20
|
+
const message = typeof value === "string" && value.length > 0 ? value : `Submit callback threw a non-Error value (${typeof value})`;
|
|
21
|
+
return new Error(message, { cause: value });
|
|
22
|
+
}
|
|
23
|
+
function normalizeErrorInput(item, scope, defaultCode) {
|
|
24
|
+
if (item instanceof Error) {
|
|
25
|
+
return {
|
|
26
|
+
message: item.message.length > 0 ? item.message : "Unknown error",
|
|
27
|
+
path: scope !== void 0 ? [...scope] : [],
|
|
28
|
+
code: defaultCode
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const entry = {
|
|
32
|
+
message: typeof item.message === "string" && item.message.length > 0 ? item.message : "Unknown error",
|
|
33
|
+
path: scope !== void 0 ? [...scope] : Array.isArray(item.path) ? [...item.path] : [],
|
|
34
|
+
code: typeof item.code === "string" && item.code.length > 0 ? item.code : defaultCode
|
|
35
|
+
};
|
|
36
|
+
if (item.data !== void 0) entry.data = item.data;
|
|
37
|
+
return entry;
|
|
38
|
+
}
|
|
39
|
+
function normalizeErrorInputs(input, scope, defaultCode) {
|
|
40
|
+
const items = Array.isArray(input) ? input : [input];
|
|
41
|
+
return items.map((item) => normalizeErrorInput(item, scope, defaultCode));
|
|
42
|
+
}
|
|
43
|
+
function* cellEntriesFor(cells, side) {
|
|
44
|
+
for (const [key, cell] of cells) {
|
|
45
|
+
const list = cell[side];
|
|
46
|
+
if (list.length > 0) yield [key, list];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
class RegistryNotInstalledError extends AttaformError {
|
|
50
|
+
constructor() {
|
|
51
|
+
super(
|
|
52
|
+
"[attaform] No registry attached to this Vue app. Component-level useForm / injectForm / useRegister auto-install the registry, but SSR helpers (renderAttaformState, hydrateAttaformState) run outside setup and require an explicit `app.use(createAttaform())` at server-render time. Add it to your SSR entry, before `renderToString`."
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
class OutsideSetupError extends AttaformError {
|
|
57
|
+
constructor() {
|
|
58
|
+
super(
|
|
59
|
+
"[attaform] useForm / injectForm called outside Vue setup(). Move into setup or mount a child component to trigger from an event."
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
class ReservedFormKeyError extends AttaformError {
|
|
64
|
+
constructor(key) {
|
|
65
|
+
super(
|
|
66
|
+
`[attaform] Form key "${key}" uses the reserved "__atta:" namespace. Use a different prefix \u2014 "__atta:" is for library-internal synthetic keys (anonymous useForm() calls without an explicit key).`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function groupErrorsByKey(entries) {
|
|
71
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
72
|
+
for (const raw of entries) {
|
|
73
|
+
const { key } = canonicalizePath(raw.path);
|
|
74
|
+
const list = grouped.get(key);
|
|
75
|
+
if (list === void 0) grouped.set(key, [raw]);
|
|
76
|
+
else list.push(raw);
|
|
77
|
+
}
|
|
78
|
+
return grouped;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const INTEGER_SEGMENT = /^(?:0|[1-9]\d*)$/;
|
|
82
|
+
const SET_MEMBER_SEGMENT = "__atta:member";
|
|
83
|
+
function mapSegmentKeys(value) {
|
|
84
|
+
const keys = [];
|
|
85
|
+
for (const key of value.keys()) {
|
|
86
|
+
if (typeof key === "string") keys.push(key);
|
|
87
|
+
else if (typeof key === "number" && Number.isInteger(key) && key >= 0) keys.push(key);
|
|
88
|
+
else return null;
|
|
89
|
+
}
|
|
90
|
+
return keys;
|
|
91
|
+
}
|
|
92
|
+
function normalizeSegment(raw) {
|
|
93
|
+
if (typeof raw === "number") {
|
|
94
|
+
if (!Number.isInteger(raw) || raw < 0) {
|
|
95
|
+
throw new InvalidPathError(
|
|
96
|
+
`Path segments must be non-negative integers when numeric; got ${String(raw)}`
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
return raw;
|
|
100
|
+
}
|
|
101
|
+
if (INTEGER_SEGMENT.test(raw)) return Number(raw);
|
|
102
|
+
return raw;
|
|
103
|
+
}
|
|
104
|
+
function parseDottedPath(path) {
|
|
105
|
+
if (path.length === 0) return [""];
|
|
106
|
+
const rawSegments = path.split(".");
|
|
107
|
+
const segments = [];
|
|
108
|
+
for (const raw of rawSegments) {
|
|
109
|
+
if (raw.length === 0) {
|
|
110
|
+
throw new InvalidPathError(
|
|
111
|
+
`Path '${path}' has an empty segment; use the array form for empty keys.`
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
segments.push(normalizeSegment(raw));
|
|
115
|
+
}
|
|
116
|
+
return segments;
|
|
117
|
+
}
|
|
118
|
+
const CANONICAL_STRING_CACHE_MAX = 128;
|
|
119
|
+
const canonicalStringCache = /* @__PURE__ */ new Map();
|
|
120
|
+
const PATHKEY_TO_SEGMENTS_MAX = 4096;
|
|
121
|
+
const pathKeyToSegments = /* @__PURE__ */ new Map();
|
|
122
|
+
function rememberSegmentsForPathKey(key, segments) {
|
|
123
|
+
if (!pathKeyToSegments.has(key) && pathKeyToSegments.size >= PATHKEY_TO_SEGMENTS_MAX) {
|
|
124
|
+
const oldest = pathKeyToSegments.keys().next().value;
|
|
125
|
+
if (oldest !== void 0) pathKeyToSegments.delete(oldest);
|
|
126
|
+
}
|
|
127
|
+
pathKeyToSegments.set(key, segments);
|
|
128
|
+
}
|
|
129
|
+
function segmentsForPathKey(key) {
|
|
130
|
+
const cached = pathKeyToSegments.get(key);
|
|
131
|
+
if (cached !== void 0) return cached;
|
|
132
|
+
let parsed;
|
|
133
|
+
try {
|
|
134
|
+
parsed = JSON.parse(key);
|
|
135
|
+
} catch {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
if (!Array.isArray(parsed)) return null;
|
|
139
|
+
const segments = [];
|
|
140
|
+
for (const raw of parsed) {
|
|
141
|
+
if (typeof raw !== "string" && typeof raw !== "number") return null;
|
|
142
|
+
segments.push(normalizeSegment(raw));
|
|
143
|
+
}
|
|
144
|
+
rememberSegmentsForPathKey(key, segments);
|
|
145
|
+
return segments;
|
|
146
|
+
}
|
|
147
|
+
function canonicalizePath(input) {
|
|
148
|
+
if (typeof input === "string") {
|
|
149
|
+
const cached = canonicalStringCache.get(input);
|
|
150
|
+
if (cached !== void 0) return cached;
|
|
151
|
+
const segments = parseDottedPath(input);
|
|
152
|
+
const key = JSON.stringify(segments);
|
|
153
|
+
const entry = { segments, key };
|
|
154
|
+
if (canonicalStringCache.size >= CANONICAL_STRING_CACHE_MAX) {
|
|
155
|
+
const oldest = canonicalStringCache.keys().next().value;
|
|
156
|
+
if (oldest !== void 0) canonicalStringCache.delete(oldest);
|
|
157
|
+
}
|
|
158
|
+
canonicalStringCache.set(input, entry);
|
|
159
|
+
rememberSegmentsForPathKey(key, segments);
|
|
160
|
+
return entry;
|
|
161
|
+
}
|
|
162
|
+
return keyForSegments(input);
|
|
163
|
+
}
|
|
164
|
+
function keyForSegments(input) {
|
|
165
|
+
const segments = Array.from(input).map(normalizeSegment);
|
|
166
|
+
const key = JSON.stringify(segments);
|
|
167
|
+
rememberSegmentsForPathKey(key, segments);
|
|
168
|
+
return { segments, key };
|
|
169
|
+
}
|
|
170
|
+
function segmentsToDotted(segments) {
|
|
171
|
+
return segments.join(".");
|
|
172
|
+
}
|
|
173
|
+
function pathKeyToDotted(key) {
|
|
174
|
+
const segments = segmentsForPathKey(key);
|
|
175
|
+
if (segments === null) return null;
|
|
176
|
+
return segmentsToDotted(segments);
|
|
177
|
+
}
|
|
178
|
+
function coerceToPathKey(input) {
|
|
179
|
+
if (input.length > 0 && input.charCodeAt(0) === 91) {
|
|
180
|
+
try {
|
|
181
|
+
const parsed = JSON.parse(input);
|
|
182
|
+
if (Array.isArray(parsed) && parsed.every((s) => typeof s === "string" || typeof s === "number")) {
|
|
183
|
+
return input;
|
|
184
|
+
}
|
|
185
|
+
} catch {
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return canonicalizePath(input).key;
|
|
189
|
+
}
|
|
190
|
+
const ROOT_PATH = Object.freeze([]);
|
|
191
|
+
const ROOT_PATH_KEY = "[]";
|
|
192
|
+
function isPathPrefix(prefix, path) {
|
|
193
|
+
if (path.length < prefix.length) return false;
|
|
194
|
+
for (let i = 0; i < prefix.length; i++) {
|
|
195
|
+
if (path[i] !== prefix[i]) return false;
|
|
196
|
+
}
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
function pathsEqual(a, b) {
|
|
200
|
+
if (a.length !== b.length) return false;
|
|
201
|
+
for (let i = 0; i < a.length; i++) {
|
|
202
|
+
if (a[i] !== b[i]) return false;
|
|
203
|
+
}
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export { AttaformError as A, InvalidPathError as I, OutsideSetupError as O, ROOT_PATH as R, SubmitErrorHandlerError as S, InvalidUseFormConfigError as a, ROOT_PATH_KEY as b, RegistryNotInstalledError as c, ReservedFormKeyError as d, canonicalizePath as e, pathsEqual as f, pathKeyToDotted as g, SET_MEMBER_SEGMENT as h, isPathPrefix as i, cellEntriesFor as j, keyForSegments as k, groupErrorsByKey as l, mapSegmentKeys as m, normalizeErrorInput as n, normalizeErrorInputs as o, parseDottedPath as p, coerceToPathKey as q, segmentsForPathKey as s, toError as t };
|