attaform 0.29.0 → 0.30.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.
Files changed (59) hide show
  1. package/dist/abstract.d.mts +5 -5
  2. package/dist/abstract.mjs +4 -4
  3. package/dist/dev/abstract.mjs +4 -4
  4. package/dist/dev/chunks/dev-key-collision-warnings.mjs +47 -8
  5. package/dist/dev/chunks/devtools.mjs +1 -1
  6. package/dist/dev/directive.mjs +1 -1
  7. package/dist/dev/history.mjs +1 -2
  8. package/dist/dev/index.mjs +5 -5
  9. package/dist/dev/runtime/plugins/attaform.mjs +3 -3
  10. package/dist/dev/shared/{attaform-dev.BO-71R54.mjs → attaform-dev.BK6Ge2qR.mjs} +34 -188
  11. package/dist/dev/shared/{attaform-dev.A-TpJW0B.mjs → attaform-dev.BQc5QV3Y.mjs} +1 -19
  12. package/dist/dev/shared/{attaform-dev.DrzObAZo.mjs → attaform-dev.BcNtyOmf.mjs} +4 -4
  13. package/dist/dev/shared/{attaform-dev.ButTkwHd.mjs → attaform-dev.BcYT6tFh.mjs} +7 -8
  14. package/dist/dev/shared/{attaform-dev.BgM6FdtA.mjs → attaform-dev.BisFstxh.mjs} +91 -59
  15. package/dist/dev/shared/{attaform-dev.DHuydLAC.mjs → attaform-dev.CQ2rJiAX.mjs} +560 -631
  16. package/dist/dev/shared/{attaform-dev.D8aoKb89.mjs → attaform-dev.D6CLvaQT.mjs} +8 -8
  17. package/dist/dev/shared/{attaform-dev.q6UutkCx.mjs → attaform-dev.DTrHonpc.mjs} +69 -120
  18. package/dist/dev/shared/{attaform-dev.DD5m2W51.mjs → attaform-dev.DUZckyV8.mjs} +1 -3
  19. package/dist/dev/zod-v3.mjs +6 -6
  20. package/dist/dev/zod-v4.mjs +6 -6
  21. package/dist/dev/zod.mjs +5 -5
  22. package/dist/directive.d.mts +2 -2
  23. package/dist/directive.mjs +1 -1
  24. package/dist/history.d.mts +1 -1
  25. package/dist/history.mjs +1 -2
  26. package/dist/index.d.mts +6 -6
  27. package/dist/index.mjs +5 -5
  28. package/dist/nuxt.d.mts +2 -11
  29. package/dist/nuxt.mjs +0 -1
  30. package/dist/runtime/plugins/attaform.mjs +3 -3
  31. package/dist/shared/{attaform.DffRL5pP.mjs → attaform.B3resMQ1.mjs} +8 -8
  32. package/dist/shared/{attaform.Cvao8bW5.mjs → attaform.BRDDQeHV.mjs} +6 -6
  33. package/dist/shared/{attaform.C2MVyuxC.mjs → attaform.BXneBxEj.mjs} +34 -188
  34. package/dist/shared/{attaform.BndjUUYX.mjs → attaform.ByWP6kSx.mjs} +4 -4
  35. package/dist/shared/{attaform.D1fnTifF.mjs → attaform.CJ8DpRGj.mjs} +69 -120
  36. package/dist/shared/{attaform.B0dKL8ST.mjs → attaform.CUfrMK7t.mjs} +91 -59
  37. package/dist/shared/{attaform.CZYt_5N_.mjs → attaform.CdZIEf7_.mjs} +1 -19
  38. package/dist/shared/{attaform.axHXVQO7.d.mts → attaform.Clz0ArIi.d.mts} +1 -1
  39. package/dist/shared/{attaform.CZMAYwSK.mjs → attaform.DNJOWjQw.mjs} +559 -588
  40. package/dist/shared/{attaform.CIWLMY-R.d.mts → attaform.Rc9u4Vfw.d.mts} +1 -1
  41. package/dist/shared/{attaform.DDtqHYv1.d.mts → attaform.UGyOK83T.d.mts} +115 -214
  42. package/dist/shared/{attaform.D0x-qSXm.mjs → attaform.WiGdIqgx.mjs} +1 -3
  43. package/dist/shared/{attaform.CsoeRi3P.d.mts → attaform.bKLzMU0o.d.mts} +99 -493
  44. package/dist/vite.mjs +5 -0
  45. package/dist/zod-v3.d.mts +4 -4
  46. package/dist/zod-v3.mjs +6 -6
  47. package/dist/zod-v4.d.mts +9 -9
  48. package/dist/zod-v4.mjs +6 -6
  49. package/dist/zod.d.mts +4 -4
  50. package/dist/zod.mjs +5 -5
  51. package/package.json +3 -2
  52. package/skills/attaform/SKILL.md +1 -1
  53. package/skills/attaform/references/custom-components.md +1 -1
  54. package/dist/chunks/fingerprint.mjs +0 -183
  55. package/dist/chunks/fingerprint2.mjs +0 -159
  56. package/dist/dev/chunks/fingerprint.mjs +0 -183
  57. package/dist/dev/chunks/fingerprint2.mjs +0 -159
  58. package/dist/dev/shared/attaform-dev.BxfsuwBR.mjs +0 -44
  59. package/dist/shared/attaform.BxfsuwBR.mjs +0 -44
package/dist/vite.mjs CHANGED
@@ -60,8 +60,13 @@ class SourceEditor {
60
60
  return out;
61
61
  }
62
62
  }
63
+ function canPossiblyInject(code) {
64
+ if (!code.includes("attaform")) return false;
65
+ return code.includes("useForm") || code.includes("injectForm");
66
+ }
63
67
  function transformSsrAccessed(code, id) {
64
68
  if (!id.endsWith(".vue")) return null;
69
+ if (!canPossiblyInject(code)) return null;
65
70
  const { descriptor } = parse(code, { filename: id });
66
71
  if (descriptor.scriptSetup === null || descriptor.template === null) return null;
67
72
  const scriptSource = descriptor.scriptSetup.content;
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, av as AcceptableDefaults, a as UseFormReturnType, ah as ValidateOnConfig, au as SchemaFactoryOptions, o as FieldMetaPayload } from './shared/attaform.CsoeRi3P.mjs';
2
+ import { G as GenericForm, F as FormKey, U as UseFormConfiguration, aq as AcceptableDefaults, a as UseFormReturnType, ac as ValidateOnConfig, ap as SchemaFactoryOptions, h as FieldMetaPayload } from './shared/attaform.bKLzMU0o.mjs';
3
3
  import { AbstractSchema } from './abstract.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, D as DefaultValuesInput, i as DefaultValuesResponse, j as DefaultValuesShape, k as DisplayCtx, l as DisplayMachine, m as DisplayState, E as ErrorInput, n as ErrorsProxyShape, 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, 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';
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 SchemaDefaultsResult, a0 as SchemaParseErrorWithData, a1 as SchemaParseErrorWithoutData, a2 as SchemaParseResult, a3 as SchemaParseSuccess, a4 as Segment, a5 as SetValueCallback, a6 as SetValuePayload, a7 as SettledValidationStatus, a8 as SlimPrimitiveKind, a9 as SubmitHandler, aa as Unset, ab as ValidateOn, ad as ValidationError, ae as ValidationResponse, af as ValidationResponseWithoutValue, ag as ValueOfUnion, ah as WriteMeta, ai as WriteShape, aj as canonicalizePath, ak as isPathPrefix, al as isUnset, am as parseDottedPath, an as unset } from './shared/attaform.bKLzMU0o.mjs';
5
5
  import { S as SupportedRootSchema, U as UnwrapZodRoot, a as StorageShape } from './shared/attaform.DRUT703x.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 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';
7
- export { v as vRegister } from './shared/attaform.axHXVQO7.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.UGyOK83T.mjs';
7
+ export { v as vRegister } from './shared/attaform.Clz0ArIi.mjs';
8
8
  import 'vue';
9
9
 
10
10
  /**
package/dist/zod-v3.mjs CHANGED
@@ -1,9 +1,9 @@
1
- export { i as isZodSchemaType, u as useForm, z as zodAdapter } from './shared/attaform.D1fnTifF.mjs';
2
- import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform.B0dKL8ST.mjs';
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.CZYt_5N_.mjs';
4
- 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.CZMAYwSK.mjs';
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.D0x-qSXm.mjs';
6
- export { a as assignKey, v as vRegister } from './shared/attaform.DffRL5pP.mjs';
1
+ export { i as isZodSchemaType, u as useForm, z as zodAdapter } from './shared/attaform.CJ8DpRGj.mjs';
2
+ import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform.CUfrMK7t.mjs';
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.CdZIEf7_.mjs';
4
+ export { A as AttaformErrorCode, 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.DNJOWjQw.mjs';
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.WiGdIqgx.mjs';
6
+ export { a as assignKey, v as vRegister } from './shared/attaform.B3resMQ1.mjs';
7
7
  export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
8
8
 
9
9
  const fieldMeta = installingFieldMetaStore;
package/dist/zod-v4.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { S as SupportedRootSchema } from './shared/attaform.CIWLMY-R.mjs';
2
- export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.CIWLMY-R.mjs';
3
- export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, 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';
4
- import { F as FormKey, au as SchemaFactoryOptions, o as FieldMetaPayload } from './shared/attaform.CsoeRi3P.mjs';
1
+ import { S as SupportedRootSchema } from './shared/attaform.Rc9u4Vfw.mjs';
2
+ export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.Rc9u4Vfw.mjs';
3
+ 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.UGyOK83T.mjs';
4
+ import { F as FormKey, ap as SchemaFactoryOptions, h as FieldMetaPayload } from './shared/attaform.bKLzMU0o.mjs';
5
5
  import { AbstractSchema } from './abstract.mjs';
6
- 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, D as DefaultValuesInput, i as DefaultValuesResponse, j as DefaultValuesShape, k as DisplayCtx, l as DisplayMachine, m as DisplayState, E as ErrorInput, n as ErrorsProxyShape, p as FieldState, q as FieldStateMap, r as FieldStateMapEntry, s as FlatPath, t as FormErrorRecord, u as FormErrorsSurface, v as FormMeta, G as GenericForm, 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, U as UseFormConfiguration, a as UseFormReturnType, 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';
7
- export { v as vRegister } from './shared/attaform.axHXVQO7.mjs';
6
+ 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 SchemaDefaultsResult, a0 as SchemaParseErrorWithData, a1 as SchemaParseErrorWithoutData, a2 as SchemaParseResult, a3 as SchemaParseSuccess, a4 as Segment, a5 as SetValueCallback, a6 as SetValuePayload, a7 as SettledValidationStatus, a8 as SlimPrimitiveKind, a9 as SubmitHandler, aa as Unset, U as UseFormConfiguration, a as UseFormReturnType, ab as ValidateOn, ac as ValidateOnConfig, ad as ValidationError, ae as ValidationResponse, af as ValidationResponseWithoutValue, ag as ValueOfUnion, ah as WriteMeta, ai as WriteShape, aj as canonicalizePath, ak as isPathPrefix, al as isUnset, am as parseDottedPath, an as unset } from './shared/attaform.bKLzMU0o.mjs';
7
+ export { v as vRegister } from './shared/attaform.Clz0ArIi.mjs';
8
8
  import { z } from 'zod';
9
9
  import 'vue';
10
10
 
@@ -19,8 +19,8 @@ import 'vue';
19
19
  *
20
20
  * The returned factory accepts per-form `SchemaFactoryOptions` (notably
21
21
  * `maxRecursionDepth`); the adapter closure bakes them into every
22
- * downstream walk so a per-form override can lift the cap without
23
- * touching the app-level default.
22
+ * downstream walk so a per-form override can lift the cap for that
23
+ * form alone.
24
24
  *
25
25
  * Throws if the schema isn't Zod v4, or if its root is not a shape
26
26
  * that can hold keys. No kind is refused anywhere BELOW the root: a
@@ -47,7 +47,7 @@ declare function zodV4Adapter<FormSchema extends SupportedRootSchema, Form exten
47
47
  * `kindOf(schema)`. Use when building a custom integration that
48
48
  * needs to branch on schema shape — most consumers don't need this.
49
49
  */
50
- type ZodKind = 'object' | 'array' | 'set' | 'record' | 'tuple' | 'union' | 'discriminated-union' | 'string' | 'number' | 'boolean' | 'bigint' | 'date' | 'enum' | 'literal' | 'null' | 'undefined' | 'any' | 'unknown' | 'optional' | 'nullable' | 'default' | 'pipe' | 'readonly' | 'nan' | 'void' | 'never' | 'lazy' | 'intersection' | 'catch' | 'promise' | 'custom' | 'template-literal' | 'transform' | 'file' | 'map' | 'symbol' | 'function';
50
+ type ZodKind = 'object' | 'array' | 'set' | 'record' | 'tuple' | 'union' | 'discriminated-union' | 'string' | 'number' | 'boolean' | 'bigint' | 'date' | 'enum' | 'literal' | 'null' | 'undefined' | 'any' | 'unknown' | 'optional' | 'nullable' | 'default' | 'pipe' | 'readonly' | 'nan' | 'void' | 'never' | 'lazy' | 'intersection' | 'catch' | 'promise' | 'custom' | 'template-literal' | 'transform' | 'file' | 'nonoptional' | 'success' | 'map' | 'symbol' | 'function';
51
51
  /**
52
52
  * Inspect a Zod v4 schema and return its `ZodKind`. Returns
53
53
  * `'unknown'` for non-Zod inputs and unrecognised shapes.
package/dist/zod-v4.mjs CHANGED
@@ -1,9 +1,9 @@
1
- export { a as assertZodVersion, k as kindOf, u as useForm, z as zodAdapter } from './shared/attaform.C2MVyuxC.mjs';
2
- import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform.B0dKL8ST.mjs';
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.CZYt_5N_.mjs';
4
- 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.CZMAYwSK.mjs';
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.D0x-qSXm.mjs';
6
- export { a as assignKey, v as vRegister } from './shared/attaform.DffRL5pP.mjs';
1
+ export { a as assertZodVersion, k as kindOf, u as useForm, z as zodAdapter } from './shared/attaform.BXneBxEj.mjs';
2
+ import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform.CUfrMK7t.mjs';
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.CdZIEf7_.mjs';
4
+ export { A as AttaformErrorCode, 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.DNJOWjQw.mjs';
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.WiGdIqgx.mjs';
6
+ export { a as assignKey, v as vRegister } from './shared/attaform.B3resMQ1.mjs';
7
7
  export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
8
8
 
9
9
  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 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';
2
- 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, D as DefaultValuesInput, 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, F as FormKey, v as FormMeta, G as GenericForm, 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, U as UseFormConfiguration, a as UseFormReturnType, 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';
3
- export { v as vRegister } from './shared/attaform.axHXVQO7.mjs';
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.UGyOK83T.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 SchemaDefaultsResult, a0 as SchemaParseErrorWithData, a1 as SchemaParseErrorWithoutData, a2 as SchemaParseResult, a3 as SchemaParseSuccess, a4 as Segment, a5 as SetValueCallback, a6 as SetValuePayload, a7 as SettledValidationStatus, a8 as SlimPrimitiveKind, a9 as SubmitHandler, aa as Unset, U as UseFormConfiguration, a as UseFormReturnType, ab as ValidateOn, ac as ValidateOnConfig, ad as ValidationError, ae as ValidationResponse, af as ValidationResponseWithoutValue, ag as ValueOfUnion, ah as WriteMeta, ai as WriteShape, aj as canonicalizePath, ak as isPathPrefix, al as isUnset, am as parseDottedPath, an as unset } from './shared/attaform.bKLzMU0o.mjs';
3
+ export { v as vRegister } from './shared/attaform.Clz0ArIi.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.CIWLMY-R.mjs';
5
+ export { P as PathInput, a as PathOutput } from './shared/attaform.Rc9u4Vfw.mjs';
6
6
  import 'vue';
7
7
  import './shared/attaform.DRUT703x.mjs';
8
8
  import 'zod';
package/dist/zod.mjs CHANGED
@@ -1,6 +1,6 @@
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.CZYt_5N_.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.CZMAYwSK.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';
5
- export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.BndjUUYX.mjs';
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.CdZIEf7_.mjs';
2
+ export { A as AttaformErrorCode, 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.DNJOWjQw.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.WiGdIqgx.mjs';
4
+ export { a as assignKey, v as vRegister } from './shared/attaform.B3resMQ1.mjs';
5
+ export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.ByWP6kSx.mjs';
6
6
  export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attaform",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
4
4
  "types": "./dist/index.d.mts",
5
5
  "files": [
6
6
  "dist",
@@ -186,7 +186,7 @@
186
186
  "nuxt": ">=3.0.0",
187
187
  "vite": ">=5.0.0",
188
188
  "vue": ">=3.5.0",
189
- "zod": ">=3.0.0"
189
+ "zod": ">=3.20.0"
190
190
  },
191
191
  "peerDependenciesMeta": {
192
192
  "@nuxt/devtools-kit": {
@@ -230,6 +230,7 @@
230
230
  "check:eager": "node scripts/check-eager-size.mjs",
231
231
  "check:coverage": "node scripts/run-with-webstorage-flag.mjs vitest run --coverage",
232
232
  "check:bench": "node scripts/check-bench.mjs",
233
+ "bench:delta": "node scripts/bench-delta.mjs",
233
234
  "check:bundled-types": "node scripts/check-bundled-types.mjs",
234
235
  "check:doc-snippets": "node scripts/check-doc-snippets.mjs",
235
236
  "check:site": "pnpm dev:prepare && pnpm --filter attaform-site typecheck",
@@ -83,7 +83,7 @@ Prefer an explicit `key` (`useForm({ schema, key: 'sign-in' })`): it makes the f
83
83
  - **Read errors through `field.showErrors` and `field.firstError?.message`.** The visibility heuristic lives in `showErrors`; reaching into `field.errors[0]` bypasses it. The async "checking" indicator is `field.showPending`.
84
84
  - **Route server errors through `form.setErrors(...)` inside the callback.** `setErrors` replaces the whole user-error layer, so call `form.clearErrors()` at the top of the submit for a fresh attempt. See `references/errors.md`.
85
85
  - **Banners read `form.meta.firstOwnError`,** the form's own error bucket, not `form.errors([])` (the whole-form aggregate). See `references/errors.md`.
86
- - **Accessibility is automatic.** `v-register` keeps `aria-invalid`, `aria-busy`, `aria-required`, and `aria-describedby` in sync and emits them during SSR. Put `form.fields.<path>.aria.errorId` on the error element so `aria-describedby` resolves. Author any ARIA attribute yourself to take it over, or pass `autoAria: false` to opt out.
86
+ - **Accessibility is automatic.** `v-register` keeps `aria-invalid`, `aria-busy`, `aria-required`, and `aria-describedby` in sync and emits them during SSR. Put `form.fields.<path>.aria.errorId` on the error element so `aria-describedby` resolves. Author any ARIA attribute yourself to take that one over.
87
87
  - **Reach with `?.` on injected forms.** `injectForm()` and `injectWizard()` return `T | null`; chain optional access (`form?.register('email')`) at every consumption site.
88
88
  - **Put labels on the schema, not the template.** `z.string().register(fieldMeta, { label: 'Email' })`; read it back through `form.fields.email.label` (resolved, with a humanized-path fallback).
89
89
  - **Native inputs first.** Bind `<input>`, `<select>`, `<textarea>` with `v-register`. Reach for `useRegister` only inside a custom input component. See `references/custom-components.md`.
@@ -48,7 +48,7 @@ For a **compound** component that binds _multiple_ paths (a date range exposing
48
48
  ## Let Attaform own display and ARIA
49
49
 
50
50
  - Read the display signals straight in the template: `field.showErrors` gates the error row, `field.showPending` gates an async "checking" indicator (it is anti-flash timed), `field.firstError?.message` is the text.
51
- - `v-register`'s `autoAria` (on by default) keeps `aria-invalid`, `aria-busy`, and `aria-required` in sync. It wires the _error_ id, and only while the field is in its error state, so author `aria-describedby` yourself if a _static_ hint should stay associated too.
51
+ - `v-register` keeps `aria-invalid`, `aria-busy`, and `aria-required` in sync. It wires the _error_ id, and only while the field is in its error state, so author `aria-describedby` yourself if a _static_ hint should stay associated too.
52
52
  - **`v-register` alone does binding, SSR value injection, and ARIA.** Do not stack a second _writer_ on it: no `v-model`, no handler that writes the field back, no `:reset-signal` prop, no redundant directive import. If a control seems to need that scaffolding, find the idiomatic shape rather than hand-rolling around it.
53
53
  - **An _observer_ is not a second writer.** A `@change` that only reads, or a `watch(form.toRef('path'), ...)`, is supported beside `v-register`. The directive attaches its own listener in the `created` hook, before Vue applies yours, so it writes the field first and your handler reads committed state. That is the shape for a surface that saves each decision as it is made instead of on submit; see `references/saving.md`.
54
54
 
@@ -1,183 +0,0 @@
1
- import { c as canonicalStringify } from '../shared/attaform.BxfsuwBR.mjs';
2
-
3
- const cyclicSentinel = "<cyclic>";
4
- function fingerprintZodSchema(schema) {
5
- const cache = /* @__PURE__ */ new WeakMap();
6
- const inProgress = /* @__PURE__ */ new WeakSet();
7
- return visit(schema, cache, inProgress);
8
- }
9
- function visit(schema, cache, inProgress) {
10
- const key = schema;
11
- const cached = cache.get(key);
12
- if (cached !== void 0) return cached;
13
- if (inProgress.has(key)) return cyclicSentinel;
14
- inProgress.add(key);
15
- try {
16
- const computed = computeFingerprint(schema, cache, inProgress);
17
- cache.set(key, computed);
18
- return computed;
19
- } finally {
20
- inProgress.delete(key);
21
- }
22
- }
23
- function getDef(schema) {
24
- return schema._def;
25
- }
26
- function computeFingerprint(schema, cache, inProgress) {
27
- const def = getDef(schema);
28
- const kind = def.typeName ?? "ZodUnknown";
29
- const recurse = (child) => visit(child, cache, inProgress);
30
- switch (kind) {
31
- case "ZodString":
32
- case "ZodNumber":
33
- case "ZodBigInt":
34
- case "ZodDate":
35
- return `${kind}${formatChecks(def.checks)}`;
36
- case "ZodBoolean":
37
- case "ZodNull":
38
- case "ZodUndefined":
39
- case "ZodAny":
40
- case "ZodUnknown":
41
- case "ZodNaN":
42
- case "ZodVoid":
43
- case "ZodNever":
44
- return kind;
45
- case "ZodLiteral":
46
- return `ZodLiteral:${canonicalStringify(def.value)}`;
47
- case "ZodEnum": {
48
- const values = Array.isArray(def.values) ? def.values : [];
49
- const sorted = [...values].sort((a, b) => {
50
- const as = String(a);
51
- const bs = String(b);
52
- return as < bs ? -1 : as > bs ? 1 : 0;
53
- });
54
- return `ZodEnum:${canonicalStringify(sorted)}`;
55
- }
56
- case "ZodNativeEnum": {
57
- const values = def.values && typeof def.values === "object" && !Array.isArray(def.values) ? Object.values(def.values) : [];
58
- const sorted = [...values].sort((a, b) => {
59
- const as = String(a);
60
- const bs = String(b);
61
- return as < bs ? -1 : as > bs ? 1 : 0;
62
- });
63
- return `ZodNativeEnum:${canonicalStringify(sorted)}`;
64
- }
65
- case "ZodObject": {
66
- const shape = readShapeSafely(def);
67
- const sortedEntries = Object.entries(shape).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${recurse(v)}`);
68
- return `ZodObject{${sortedEntries.join(",")}}${formatChecks(def.checks)}`;
69
- }
70
- case "ZodArray":
71
- return `ZodArray[${def.type === void 0 ? "?" : recurse(def.type)}]${formatChecks(def.checks)}`;
72
- case "ZodTuple": {
73
- const items = def.items ?? [];
74
- return `ZodTuple[${items.map(recurse).join(",")}]`;
75
- }
76
- case "ZodRecord": {
77
- const keyPart = def.keyType === void 0 ? "?" : recurse(def.keyType);
78
- const valuePart = def.valueType === void 0 ? "?" : recurse(def.valueType);
79
- return `ZodRecord<${keyPart},${valuePart}>`;
80
- }
81
- case "ZodUnion": {
82
- const options = (def.options ?? []).map(recurse).sort();
83
- return `ZodUnion(${options.join("|")})`;
84
- }
85
- case "ZodDiscriminatedUnion": {
86
- const disc = def.discriminator ?? "?";
87
- const options = (def.options ?? []).map(recurse).sort();
88
- return `ZodDiscriminatedUnion[${JSON.stringify(disc)}](${options.join("|")})`;
89
- }
90
- case "ZodOptional": {
91
- const inner = def.innerType;
92
- return inner === void 0 ? "ZodOptional(?)" : `ZodOptional(${recurse(inner)})`;
93
- }
94
- case "ZodNullable": {
95
- const inner = def.innerType;
96
- return inner === void 0 ? "ZodNullable(?)" : `ZodNullable(${recurse(inner)})`;
97
- }
98
- case "ZodDefault": {
99
- const inner = def.innerType;
100
- return `ZodDefault[${defaultFactoryRepr(def.defaultValue)}](${inner === void 0 ? "?" : recurse(inner)})`;
101
- }
102
- case "ZodReadonly": {
103
- const inner = def.innerType;
104
- return inner === void 0 ? "ZodReadonly(?)" : `ZodReadonly(${recurse(inner)})`;
105
- }
106
- case "ZodEffects": {
107
- const effectType = def.effect?.type ?? "effect";
108
- const inner = def.schema;
109
- return `ZodEffects:${effectType}:fn:*(${inner === void 0 ? "?" : recurse(inner)})`;
110
- }
111
- case "ZodPipeline": {
112
- const inner = def.in ?? def.out;
113
- return inner === void 0 ? "ZodPipeline(?)" : `ZodPipeline(${recurse(inner)})`;
114
- }
115
- case "ZodCatch": {
116
- const inner = def.innerType ?? def.schema;
117
- const catchRepr = defaultFactoryRepr(def.catchValue);
118
- return `ZodCatch[${catchRepr}](${inner === void 0 ? "?" : recurse(inner)})`;
119
- }
120
- case "ZodLazy": {
121
- const resolve = def.getter;
122
- if (typeof resolve !== "function") return "ZodLazy(?)";
123
- try {
124
- const inner = resolve();
125
- return `ZodLazy(${recurse(inner)})`;
126
- } catch {
127
- return "ZodLazy(?)";
128
- }
129
- }
130
- case "ZodIntersection": {
131
- const leftPart = def.left === void 0 ? "?" : recurse(def.left);
132
- const rightPart = def.right === void 0 ? "?" : recurse(def.right);
133
- const parts = [leftPart, rightPart].sort();
134
- return `ZodIntersection(${parts.join("&")})`;
135
- }
136
- case "ZodSet": {
137
- const inner = def.valueType;
138
- return inner === void 0 ? "ZodSet(?)" : `ZodSet<${recurse(inner)}>${formatChecks(def.checks)}`;
139
- }
140
- case "ZodBranded": {
141
- const inner = def.type;
142
- return inner === void 0 ? "ZodBranded(?)" : `ZodBranded(${recurse(inner)})`;
143
- }
144
- // Structural opacity — schemas whose runtime behaviour isn't
145
- // introspectable via `_def` fall here. Still distinguishable
146
- // from other kinds by the returned string.
147
- case "ZodPromise":
148
- case "ZodFunction":
149
- case "ZodMap":
150
- case "ZodSymbol":
151
- default:
152
- return `${kind}:*`;
153
- }
154
- }
155
- function readShapeSafely(def) {
156
- if (typeof def.shape !== "function") return {};
157
- try {
158
- return def.shape();
159
- } catch {
160
- return {};
161
- }
162
- }
163
- function defaultFactoryRepr(factory) {
164
- if (typeof factory !== "function") return "none";
165
- let first;
166
- let second;
167
- try {
168
- first = factory();
169
- second = factory();
170
- } catch {
171
- return "fn:*";
172
- }
173
- if (!Object.is(first, second)) return "fn:*";
174
- if (typeof first === "function") return "fn:*";
175
- return canonicalStringify(first);
176
- }
177
- function formatChecks(checks) {
178
- if (!Array.isArray(checks) || checks.length === 0) return "";
179
- const parts = checks.map((c) => canonicalStringify(c)).sort();
180
- return `[${parts.join(";")}]`;
181
- }
182
-
183
- export { fingerprintZodSchema };
@@ -1,159 +0,0 @@
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
-
4
- const cyclicSentinel = "<cyclic>";
5
- function fingerprintZodSchema(schema) {
6
- const cache = /* @__PURE__ */ new WeakMap();
7
- const inProgress = /* @__PURE__ */ new WeakSet();
8
- return visit(schema, cache, inProgress);
9
- }
10
- function visit(schema, cache, inProgress) {
11
- const cached = cache.get(schema);
12
- if (cached !== void 0) return cached;
13
- if (inProgress.has(schema)) return cyclicSentinel;
14
- inProgress.add(schema);
15
- try {
16
- const computed = computeFingerprint(schema, cache, inProgress);
17
- cache.set(schema, computed);
18
- return computed;
19
- } finally {
20
- inProgress.delete(schema);
21
- }
22
- }
23
- function computeFingerprint(schema, cache, inProgress) {
24
- const kind = kindOf(schema);
25
- const recurse = (child) => visit(child, cache, inProgress);
26
- switch (kind) {
27
- // Kind-only leaves: no further structure to descend into.
28
- case "boolean":
29
- case "null":
30
- case "undefined":
31
- case "any":
32
- case "unknown":
33
- case "nan":
34
- case "void":
35
- case "never":
36
- return kind;
37
- // Leaves with checks (min/max/email/regex/...). Checks are
38
- // canonicalised and sorted so `.min(3).max(10)` and `.max(10).min(3)`
39
- // produce identical fingerprints.
40
- case "string":
41
- case "number":
42
- case "bigint":
43
- case "date":
44
- return `${kind}${formatChecks(schema)}`;
45
- case "literal": {
46
- const values = [...getLiteralValues(schema)].sort((a, b) => {
47
- const as = canonicalStringify(a);
48
- const bs = canonicalStringify(b);
49
- return as < bs ? -1 : as > bs ? 1 : 0;
50
- });
51
- return `literal:${canonicalStringify(values)}`;
52
- }
53
- case "enum":
54
- return `enum:${canonicalStringify([...getEnumValues(schema)].sort((a, b) => compare(a, b)))}`;
55
- case "object": {
56
- const shape = getObjectShape(schema);
57
- const sortedEntries = Object.entries(shape).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => `${JSON.stringify(k)}:${recurse(v)}`);
58
- return `object{${sortedEntries.join(",")}}${formatChecks(schema)}`;
59
- }
60
- case "array":
61
- return `array[${recurse(getArrayElement(schema))}]${formatChecks(schema)}`;
62
- case "set":
63
- return `set<${recurse(getSetValueType(schema))}>${formatChecks(schema)}`;
64
- case "tuple":
65
- return `tuple[${getTupleItems(schema).map(recurse).join(",")}]`;
66
- case "record":
67
- return `record<${recurse(getRecordKeyType(schema))},${recurse(getRecordValueType(schema))}>`;
68
- case "union": {
69
- const options = getUnionOptions(schema).map(recurse).sort();
70
- return `union(${options.join("|")})`;
71
- }
72
- case "discriminated-union": {
73
- const disc = getDiscriminator(schema) ?? "?";
74
- const options = getDiscriminatedOptions(schema).map(recurse).sort();
75
- return `dunion[${JSON.stringify(disc)}](${options.join("|")})`;
76
- }
77
- case "optional": {
78
- const inner = unwrapInner(schema);
79
- return inner === void 0 ? "optional(?)" : `optional(${recurse(inner)})`;
80
- }
81
- case "nullable": {
82
- const inner = unwrapInner(schema);
83
- return inner === void 0 ? "nullable(?)" : `nullable(${recurse(inner)})`;
84
- }
85
- case "default": {
86
- const inner = unwrapInner(schema);
87
- return `default[${stableValueRepr(getDefaultValue, schema)}](${inner === void 0 ? "?" : recurse(inner)})`;
88
- }
89
- case "readonly": {
90
- const inner = unwrapInner(schema);
91
- return inner === void 0 ? "readonly(?)" : `readonly(${recurse(inner)})`;
92
- }
93
- case "pipe": {
94
- const inner = unwrapPipe(schema);
95
- return inner === void 0 ? "pipe(?)" : `pipe(${recurse(inner)})`;
96
- }
97
- case "catch": {
98
- const inner = unwrapInner(schema);
99
- return `catch[${stableValueRepr(getCatchDefault, schema)}](${inner === void 0 ? "?" : recurse(inner)})`;
100
- }
101
- case "lazy": {
102
- const inner = unwrapLazy(schema);
103
- return inner === void 0 ? "lazy(?)" : `lazy(${recurse(inner)})`;
104
- }
105
- case "intersection": {
106
- const left = getIntersectionLeft(schema);
107
- const right = getIntersectionRight(schema);
108
- const leftFp = left === void 0 ? "?" : recurse(left);
109
- const rightFp = right === void 0 ? "?" : recurse(right);
110
- const parts = [leftFp, rightFp].sort();
111
- return `intersection(${parts.join("&")})`;
112
- }
113
- // Structural shape isn't observable for these. Bucket them into
114
- // kind-only fingerprints — a schema-mismatch warning can't do
115
- // better than "both are `custom`" here, but that still catches
116
- // `object` vs `custom` mismatches. `map` / `symbol` / `function`
117
- // are rejected at adapter construction; kept here for exhaustive
118
- // switch safety when `fingerprintSchema` is called from tooling.
119
- case "promise":
120
- case "custom":
121
- case "template-literal":
122
- case "transform":
123
- case "file":
124
- case "map":
125
- case "symbol":
126
- case "function":
127
- return `${kind}:*`;
128
- default: {
129
- const _ = kind;
130
- return `unknown:${String(_)}`;
131
- }
132
- }
133
- }
134
- function stableValueRepr(get, schema) {
135
- const first = get(schema);
136
- const second = get(schema);
137
- if (!Object.is(first, second) || typeof first === "function") return "fn:*";
138
- return canonicalStringify(first);
139
- }
140
- function formatChecks(schema) {
141
- const checks = getChecks(schema);
142
- if (checks.length === 0) return "";
143
- const parts = checks.map((c) => serializeCheck(c)).sort();
144
- return `[${parts.join(";")}]`;
145
- }
146
- function serializeCheck(check) {
147
- if (check !== null && typeof check === "object") {
148
- const def = check._zod?.def;
149
- if (def !== void 0) return canonicalStringify(def);
150
- }
151
- return canonicalStringify(check);
152
- }
153
- function compare(a, b) {
154
- const as = String(a);
155
- const bs = String(b);
156
- return as < bs ? -1 : as > bs ? 1 : 0;
157
- }
158
-
159
- export { fingerprintZodSchema };