attaform 0.30.1 → 0.31.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 (49) hide show
  1. package/dist/abstract.d.mts +5 -5
  2. package/dist/abstract.mjs +3 -3
  3. package/dist/dev/abstract.mjs +3 -3
  4. package/dist/dev/chunks/devtools.mjs +2 -2
  5. package/dist/dev/directive.mjs +1 -1
  6. package/dist/dev/history.mjs +1 -1
  7. package/dist/dev/index.mjs +4 -4
  8. package/dist/dev/runtime/plugins/attaform.mjs +1 -1
  9. package/dist/dev/shared/{attaform-dev.Chm4D6SJ.mjs → attaform-dev.B1q-x9R9.mjs} +2 -2
  10. package/dist/dev/shared/{attaform-dev.BUIFcTYf.mjs → attaform-dev.Caibt7sb.mjs} +11 -10
  11. package/dist/dev/shared/{attaform-dev.CT7MDjPy.mjs → attaform-dev.CtyqGia7.mjs} +152 -227
  12. package/dist/dev/shared/{attaform-dev.BJK1kqHY.mjs → attaform-dev.DJ3nsWw6.mjs} +74 -110
  13. package/dist/dev/shared/{attaform-dev.DuEE4GU1.mjs → attaform-dev.DlaT4xGd.mjs} +3 -3
  14. package/dist/dev/shared/{attaform-dev.BMQ3GcgD.mjs → attaform-dev.k5X47GMD.mjs} +474 -336
  15. package/dist/dev/shared/{attaform-dev.DxHdkkPG.mjs → attaform-dev.y9x9Vp9F.mjs} +206 -127
  16. package/dist/dev/zod-v3.mjs +5 -5
  17. package/dist/dev/zod-v4.mjs +5 -5
  18. package/dist/dev/zod.mjs +4 -4
  19. package/dist/directive.d.mts +2 -2
  20. package/dist/directive.mjs +1 -1
  21. package/dist/history.d.mts +1 -1
  22. package/dist/history.mjs +1 -1
  23. package/dist/index.d.mts +6 -6
  24. package/dist/index.mjs +4 -4
  25. package/dist/runtime/components/AttaformDevtoolsPanel.vue +3 -3
  26. package/dist/runtime/plugins/attaform.mjs +1 -1
  27. package/dist/shared/{attaform.CO918TdU.mjs → attaform.BWUn8Kjy.mjs} +74 -110
  28. package/dist/shared/{attaform.WiGdIqgx.mjs → attaform.C4shmwyJ.mjs} +2 -2
  29. package/dist/shared/{attaform.2FslhB9R.d.mts → attaform.CRVe8s82.d.mts} +1 -1
  30. package/dist/shared/{attaform.L0kUn3vL.d.mts → attaform.D9RqPgGu.d.mts} +1 -1
  31. package/dist/shared/{attaform.BcQwgWaq.d.mts → attaform.DAo0QBmS.d.mts} +28 -8
  32. package/dist/shared/{attaform.ZYn2ahzJ.mjs → attaform.DBCbxlyk.mjs} +59 -1
  33. package/dist/shared/{attaform.DRsANMok.mjs → attaform.DL2nl_QR.mjs} +11 -10
  34. package/dist/shared/{attaform.BIWicztt.mjs → attaform.DNPJPOO7.mjs} +204 -125
  35. package/dist/shared/{attaform.Br8EBn5B.d.mts → attaform.DZnrDrNb.d.mts} +136 -32
  36. package/dist/shared/{attaform.D_f1WgYf.mjs → attaform.DxKQsqFZ.mjs} +456 -318
  37. package/dist/shared/{attaform.B2iebkPA.mjs → attaform.L011tHgJ.mjs} +3 -3
  38. package/dist/shared/{attaform.D_pt1gOj.mjs → attaform.LUPC-2Qg.mjs} +152 -227
  39. package/dist/transforms.mjs +1 -1
  40. package/dist/vite.mjs +1 -1
  41. package/dist/zod-v3.d.mts +4 -4
  42. package/dist/zod-v3.mjs +5 -5
  43. package/dist/zod-v4.d.mts +13 -11
  44. package/dist/zod-v4.mjs +5 -5
  45. package/dist/zod.d.mts +4 -4
  46. package/dist/zod.mjs +4 -4
  47. package/package.json +1 -1
  48. package/skills/attaform/SKILL.md +1 -1
  49. package/skills/attaform/references/custom-components.md +4 -0
@@ -1,8 +1,8 @@
1
- import { A as AttaformRegistry } from './shared/attaform.BcQwgWaq.mjs';
2
- export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, 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.BcQwgWaq.mjs';
3
- import { G as GenericForm, F as FormKey, U as UseFormConfiguration, A as AbstractSchema, D as DefaultValuesInput, a as UseFormReturnType } from './shared/attaform.Br8EBn5B.mjs';
4
- export { b as ArrayItem, c as ArrayPath, C as CustomDirectiveRegisterAssignerFn, d as DeepPartial, 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, 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, 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.Br8EBn5B.mjs';
5
- export { v as vRegister } from './shared/attaform.L0kUn3vL.mjs';
1
+ import { A as AttaformRegistry } from './shared/attaform.DAo0QBmS.mjs';
2
+ export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, 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.DAo0QBmS.mjs';
3
+ import { G as GenericForm, F as FormKey, U as UseFormConfiguration, A as AbstractSchema, D as DefaultValuesInput, a as UseFormReturnType } from './shared/attaform.DZnrDrNb.mjs';
4
+ export { b as ArrayItem, c as ArrayPath, C as CustomDirectiveRegisterAssignerFn, d as DeepPartial, 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, o as FormMeta, H as HandleSubmit, p as HistoryPlugin, I as IsTuple, q as IsUnion, J as JoinSegments, r as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, s as NestedType, O as OnError, t as OnSubmit, P as ParseOptions, u as PartialFlatPath, v as Path, w as PathKey, x as PendingValidationStatus, y as Primitive, R as ROOT_PATH, z as ROOT_PATH_KEY, B as ReactiveValidationStatus, Q as RecordPath, S as RecordValue, T as RegisterDirective, V as RegisterFlatPath, W as RegisterOptions, X as RegisterSelectModifier, Y as RegisterTextModifier, Z as RegisterTransform, _ as RegisterValue, $ as SchemaParseErrorWithData, a0 as SchemaParseErrorWithoutData, a1 as SchemaParseResult, a2 as SchemaParseSuccess, a3 as Segment, a4 as SetValueCallback, a5 as SetValuePayload, a6 as SettledValidationStatus, a7 as SlimPrimitiveKind, a8 as SubmitHandler, a9 as Unset, aa as ValidateOn, ab as ValidateOnConfig, ac as ValidationError, ad as ValidationResponse, ae as ValidationResponseWithoutValue, af as ValueOfUnion, ag as WriteMeta, ah as WriteShape, ai as canonicalizePath, aj as isPathPrefix, ak as isUnset, al as parseDottedPath, am as unset } from './shared/attaform.DZnrDrNb.mjs';
5
+ export { v as vRegister } from './shared/attaform.D9RqPgGu.mjs';
6
6
  import 'vue';
7
7
 
8
8
  /**
package/dist/abstract.mjs CHANGED
@@ -1,5 +1,5 @@
1
- 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, c as useAbstractForm, d as useRegister, f as useWizard } from './shared/attaform.BIWicztt.mjs';
1
+ 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, c as useAbstractForm, d as useRegister, f as useWizard } from './shared/attaform.DNPJPOO7.mjs';
2
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.CdZIEf7_.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.D_f1WgYf.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.C4shmwyJ.mjs';
4
+ export { a as assignKey, v as vRegister } from './shared/attaform.DxKQsqFZ.mjs';
5
5
  export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
@@ -1,4 +1,4 @@
1
- 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, c as useAbstractForm, d as useRegister, f as useWizard } from './shared/attaform-dev.DxHdkkPG.mjs';
1
+ 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, c as useAbstractForm, d as useRegister, f as useWizard } from './shared/attaform-dev.y9x9Vp9F.mjs';
2
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.zlvDr0WB.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.Chm4D6SJ.mjs';
4
- export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.BMQ3GcgD.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.B1q-x9R9.mjs';
4
+ export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.k5X47GMD.mjs';
@@ -114,13 +114,13 @@ function wire(api, app, registry) {
114
114
  }
115
115
  ];
116
116
  payload.state["Schema Errors"] = [
117
- ...[...state.errorCells.entries()].filter(([, cell]) => cell.schema.length > 0).map(([k, cell]) => ({
117
+ ...[...state.errorCells().entries()].filter(([, cell]) => cell.schema.length > 0).map(([k, cell]) => ({
118
118
  key: String(k),
119
119
  value: cell.schema
120
120
  }))
121
121
  ];
122
122
  payload.state["User Errors"] = [
123
- ...[...state.errorCells.entries()].filter(([, cell]) => cell.user.length > 0).map(([k, cell]) => ({
123
+ ...[...state.errorCells().entries()].filter(([, cell]) => cell.user.length > 0).map(([k, cell]) => ({
124
124
  key: String(k),
125
125
  value: cell.user
126
126
  }))
@@ -1 +1 @@
1
- export { b as installVRegister, v as vRegister, c as vRegisterFile } from './shared/attaform-dev.BMQ3GcgD.mjs';
1
+ export { b as installVRegister, v as vRegister, c as vRegisterFile } from './shared/attaform-dev.k5X47GMD.mjs';
@@ -14,7 +14,7 @@ function createHistoryRuntime(kernel, max) {
14
14
  return {
15
15
  form: structuralSnapshot(kernel.form.value),
16
16
  blankPaths: [...kernel.blankPaths],
17
- errorCells: captureErrorCells(kernel.errorCells)
17
+ errorCells: captureErrorCells(kernel.errorCells())
18
18
  };
19
19
  }
20
20
  const positions = shallowRef([captureSnapshot()]);
@@ -1,5 +1,5 @@
1
1
  export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform-dev.zlvDr0WB.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-dev.DxHdkkPG.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.Chm4D6SJ.mjs';
4
- export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.BMQ3GcgD.mjs';
5
- export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform-dev.DuEE4GU1.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-dev.y9x9Vp9F.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.B1q-x9R9.mjs';
4
+ export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.k5X47GMD.mjs';
5
+ export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform-dev.DlaT4xGd.mjs';
@@ -1,5 +1,5 @@
1
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.Chm4D6SJ.mjs';
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.B1q-x9R9.mjs';
3
3
 
4
4
  var attaform_default = defineNuxtPlugin({
5
5
  // `enforce: 'pre'` makes the "we run before any component's setup" claim
@@ -182,8 +182,8 @@ function renderAttaformState(app) {
182
182
  // The wire shape stays two per-source arrays; the tagged store
183
183
  // splits at the boundary and the client replays each side into
184
184
  // its cell half.
185
- schemaErrors: [...state.errorCells.entries()].filter(([, cell]) => cell.schema.length > 0).map(([key2, cell]) => [key2, cell.schema]),
186
- userErrors: [...state.errorCells.entries()].filter(([, cell]) => cell.user.length > 0).map(([key2, cell]) => [key2, cell.user]),
185
+ schemaErrors: [...state.errorCells().entries()].filter(([, cell]) => cell.schema.length > 0).map(([key2, cell]) => [key2, cell.schema]),
186
+ userErrors: [...state.errorCells().entries()].filter(([, cell]) => cell.user.length > 0).map(([key2, cell]) => [key2, cell.user]),
187
187
  fields: Array.from(state.fields.entries()),
188
188
  ...transientList.length > 0 ? { blankPaths: transientList } : {}
189
189
  }
@@ -1,4 +1,4 @@
1
- import { A as AttaformErrorCode, k as isPlainRecord, s as slimKindOf } from './attaform-dev.DxHdkkPG.mjs';
1
+ import { A as AttaformErrorCode, k as isPlainRecord, s as slimKindOf } from './attaform-dev.y9x9Vp9F.mjs';
2
2
  import { e as canonicalizePath, h as SET_MEMBER_SEGMENT } from './attaform-dev.zlvDr0WB.mjs';
3
3
  import { a as safeOwnRead, b as safeAssign } from './attaform-dev.CZz4GYZ6.mjs';
4
4
 
@@ -37,9 +37,6 @@ function createAbstractSchema(rootSchema, intro, services, options) {
37
37
  const discriminatorCache = /* @__PURE__ */ new Map();
38
38
  const entryKeyKindCache = /* @__PURE__ */ new Map();
39
39
  const slimKindsCache = /* @__PURE__ */ new Map();
40
- let asyncValidationFlag = null;
41
- let containerRefineFlag = null;
42
- let discriminatedUnionFlag = null;
43
40
  function mapKeySegmentKind(schema) {
44
41
  const keyType = intro.getMapKeyType(schema);
45
42
  if (keyType === void 0) return void 0;
@@ -92,20 +89,24 @@ function createAbstractSchema(rootSchema, intro, services, options) {
92
89
  }
93
90
  const abstractSchema = {
94
91
  needsAsyncValidation() {
95
- asyncValidationFlag ?? (asyncValidationFlag = intro.containsAsyncRefine(rootSchema) || intro.containsAsyncTransform(rootSchema));
96
- return asyncValidationFlag;
92
+ const { asyncRefine, asyncTransform } = intro.capabilitiesOf(rootSchema);
93
+ return asyncRefine || asyncTransform;
97
94
  },
98
95
  hasContainerOrRootRefine() {
99
- containerRefineFlag ?? (containerRefineFlag = intro.hasContainerOrRootRefine(rootSchema));
100
- return containerRefineFlag;
96
+ return intro.capabilitiesOf(rootSchema).containerOrRootRefine;
101
97
  },
102
98
  hasDiscriminatedUnions() {
103
- discriminatedUnionFlag ?? (discriminatedUnionFlag = intro.containsDiscriminatedUnion(rootSchema));
104
- return discriminatedUnionFlag;
99
+ return intro.capabilitiesOf(rootSchema).discriminatedUnion;
100
+ },
101
+ hasPreprocessOrCoerce() {
102
+ return intro.capabilitiesOf(rootSchema).preprocessOrCoerce;
105
103
  },
106
104
  getDefaultValues(config) {
107
105
  return services.runGetDefaults(rootSchema, config, maxRecursionDepth);
108
106
  },
107
+ validateSync(data) {
108
+ return services.validateSync(rootSchema, data);
109
+ },
109
110
  getDefaultAtPath(path) {
110
111
  if (path.length === 0) {
111
112
  return services.deriveDefault(rootSchema, true, maxRecursionDepth);
@@ -1,5 +1,5 @@
1
- import { w as walkPathSegments, s as slimPrimitivesWalk, c as createAbstractSchema, a as createSharedSchemaStore, b as buildFieldMetaPathMap, g as getFieldMetaForSchema, f as fixStructuralDefaults, m as mergeDeep, d as deriveDefaultWalk, e as getFieldMetaListForSchema } from './attaform-dev.BUIFcTYf.mjs';
2
- import { h as getAtPath, j as humanize, c as useAbstractForm } from './attaform-dev.DxHdkkPG.mjs';
1
+ import { w as walkPathSegments, s as slimPrimitivesWalk, c as createAbstractSchema, a as createSharedSchemaStore, b as buildFieldMetaPathMap, g as getFieldMetaForSchema, f as fixStructuralDefaults, m as mergeDeep, d as deriveDefaultWalk, e as getFieldMetaListForSchema } from './attaform-dev.Caibt7sb.mjs';
2
+ import { h as getAtPath, j as humanize, c as useAbstractForm } from './attaform-dev.y9x9Vp9F.mjs';
3
3
  import { c as callConsumerFn } from './attaform-dev.CZz4GYZ6.mjs';
4
4
  import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform-dev.zlvDr0WB.mjs';
5
5
 
@@ -196,104 +196,6 @@ function isAsyncEffect(schema) {
196
196
  if (typeof fn !== "function") return false;
197
197
  return fn.constructor.name === "AsyncFunction";
198
198
  }
199
- function containsAsyncRefine(schema, seen) {
200
- return walkForTarget(schema, "refinement", seen ?? /* @__PURE__ */ new WeakSet());
201
- }
202
- function containsMapOrSet(schema, seen) {
203
- return walkForTarget(schema, "map-or-set", /* @__PURE__ */ new WeakSet());
204
- }
205
- function containsDiscriminatedUnion(schema, seen) {
206
- return walkForTarget(schema, "discriminated-union", seen ?? /* @__PURE__ */ new WeakSet());
207
- }
208
- function containsAsyncTransform(schema, seen) {
209
- return walkForTarget(schema, "transform-or-preprocess", seen ?? /* @__PURE__ */ new WeakSet());
210
- }
211
- function walkForTarget(schema, target, visited) {
212
- const candidate = schema;
213
- if (typeof candidate !== "object" || candidate === null) return false;
214
- if (visited.has(candidate)) return false;
215
- visited.add(candidate);
216
- if (isZodSchemaType(schema, "ZodEffects")) {
217
- const kind = getEffectsKind(schema);
218
- if (target === "refinement" && kind === "refinement") return true;
219
- if (target === "transform-or-preprocess" && (kind === "transform" || kind === "preprocess") && isAsyncEffect(schema)) {
220
- return true;
221
- }
222
- const inner = unwrapEffectsSource(schema);
223
- return inner !== void 0 && walkForTarget(inner, target, visited);
224
- }
225
- if (isZodSchemaType(schema, "ZodOptional") || isZodSchemaType(schema, "ZodNullable") || isZodSchemaType(schema, "ZodDefault") || isZodSchemaType(schema, "ZodCatch") || isZodSchemaType(schema, "ZodReadonly")) {
226
- const inner = unwrapInner(schema);
227
- return inner !== void 0 && walkForTarget(inner, target, visited);
228
- }
229
- if (isZodSchemaType(schema, "ZodBranded")) {
230
- const inner = unwrapBranded(schema);
231
- return inner !== void 0 && walkForTarget(inner, target, visited);
232
- }
233
- if (isZodSchemaType(schema, "ZodLazy")) {
234
- const inner = unwrapLazy(schema);
235
- return inner !== void 0 && walkForTarget(inner, target, visited);
236
- }
237
- if (isZodSchemaType(schema, "ZodPipeline")) {
238
- const inSide = unwrapPipeIn(schema);
239
- if (inSide !== void 0 && walkForTarget(inSide, target, visited)) return true;
240
- const outSide = unwrapPipeOut(schema);
241
- if (outSide !== void 0 && walkForTarget(outSide, target, visited)) return true;
242
- return false;
243
- }
244
- if (isZodSchemaType(schema, "ZodObject")) {
245
- for (const sub of Object.values(getObjectShape(schema))) {
246
- if (walkForTarget(sub, target, visited)) return true;
247
- }
248
- return false;
249
- }
250
- if (isZodSchemaType(schema, "ZodArray")) {
251
- const elem = getArrayElement(schema);
252
- return elem !== void 0 && walkForTarget(elem, target, visited);
253
- }
254
- if (isZodSchemaType(schema, "ZodTuple")) {
255
- for (const it of getTupleItems(schema)) {
256
- if (walkForTarget(it, target, visited)) return true;
257
- }
258
- return false;
259
- }
260
- if (isZodSchemaType(schema, "ZodUnion") || isZodSchemaType(schema, "ZodDiscriminatedUnion")) {
261
- if (target === "discriminated-union" && isZodSchemaType(schema, "ZodDiscriminatedUnion")) {
262
- return true;
263
- }
264
- for (const opt of getUnionOptions(schema)) {
265
- if (walkForTarget(opt, target, visited)) return true;
266
- }
267
- return false;
268
- }
269
- if (isZodSchemaType(schema, "ZodIntersection")) {
270
- const left = getIntersectionLeft(schema);
271
- if (left !== void 0 && walkForTarget(left, target, visited)) return true;
272
- const right = getIntersectionRight(schema);
273
- if (right !== void 0 && walkForTarget(right, target, visited)) return true;
274
- return false;
275
- }
276
- if (isZodSchemaType(schema, "ZodRecord")) {
277
- const keyType = getRecordKeyType(schema);
278
- if (keyType !== void 0 && walkForTarget(keyType, target, visited)) return true;
279
- const valueType = getRecordValueType(schema);
280
- if (valueType !== void 0 && walkForTarget(valueType, target, visited)) return true;
281
- return false;
282
- }
283
- if (isZodSchemaType(schema, "ZodSet")) {
284
- if (target === "map-or-set") return true;
285
- const elem = getSetValueType(schema);
286
- return elem !== void 0 && walkForTarget(elem, target, visited);
287
- }
288
- if (isZodSchemaType(schema, "ZodMap")) {
289
- if (target === "map-or-set") return true;
290
- const keyType = getMapKeyType(schema);
291
- if (keyType !== void 0 && walkForTarget(keyType, target, visited)) return true;
292
- const valueType = getMapValueType(schema);
293
- return valueType !== void 0 && walkForTarget(valueType, target, visited);
294
- }
295
- return false;
296
- }
297
199
  function unwrapPipeIn(schema) {
298
200
  const def = readDef(schema);
299
201
  return def?.in;
@@ -335,99 +237,136 @@ function hasCatchValue(schema) {
335
237
  const def = readDef(schema);
336
238
  return typeof def?.catchValue === "function";
337
239
  }
338
- function hasContainerOrRootRefine(schema, seen) {
339
- const visited = seen ?? /* @__PURE__ */ new WeakSet();
240
+ const capabilityMemo = /* @__PURE__ */ new WeakMap();
241
+ function capabilitiesOf(schema) {
242
+ let capabilities = capabilityMemo.get(schema);
243
+ if (capabilities === void 0) {
244
+ capabilities = scanCapabilities(schema);
245
+ const key = schema;
246
+ if (typeof key === "object" && key !== null) capabilityMemo.set(key, capabilities);
247
+ }
248
+ return capabilities;
249
+ }
250
+ function scanCapabilities(schema) {
251
+ const capabilities = {
252
+ asyncRefine: false,
253
+ asyncTransform: false,
254
+ discriminatedUnion: false,
255
+ containerOrRootRefine: false,
256
+ preprocessOrCoerce: false,
257
+ mapOrSet: false
258
+ };
259
+ walkCapabilities(schema, capabilities, /* @__PURE__ */ new WeakSet());
260
+ return capabilities;
261
+ }
262
+ function walkCapabilities(schema, capabilities, visited) {
263
+ if (schema === void 0) return;
340
264
  const candidate = schema;
341
- if (typeof candidate !== "object" || candidate === null) return false;
342
- if (visited.has(candidate)) return false;
265
+ if (typeof candidate !== "object" || candidate === null || visited.has(candidate)) return;
343
266
  visited.add(candidate);
344
- if (isZodSchemaType(schema, "ZodEffects")) {
345
- const inner = unwrapEffectsSource(schema);
346
- if (inner === void 0) return false;
347
- if (isContainerAfterWrapperPeel(inner)) return true;
348
- return hasContainerOrRootRefine(inner, visited);
349
- }
350
- if (isZodSchemaType(schema, "ZodOptional") || isZodSchemaType(schema, "ZodNullable") || isZodSchemaType(schema, "ZodDefault") || isZodSchemaType(schema, "ZodCatch") || isZodSchemaType(schema, "ZodReadonly")) {
351
- const inner = unwrapInner(schema);
352
- return inner !== void 0 && hasContainerOrRootRefine(inner, visited);
353
- }
354
- if (isZodSchemaType(schema, "ZodBranded")) {
355
- const inner = unwrapBranded(schema);
356
- return inner !== void 0 && hasContainerOrRootRefine(inner, visited);
357
- }
358
- if (isZodSchemaType(schema, "ZodLazy")) {
359
- const inner = unwrapLazy(schema);
360
- return inner !== void 0 && hasContainerOrRootRefine(inner, visited);
361
- }
362
- if (isZodSchemaType(schema, "ZodPipeline")) {
363
- const inSide = unwrapPipeIn(schema);
364
- if (inSide !== void 0 && hasContainerOrRootRefine(inSide, visited)) return true;
365
- const outSide = unwrapPipeOut(schema);
366
- if (outSide !== void 0 && hasContainerOrRootRefine(outSide, visited)) return true;
367
- return false;
368
- }
369
- if (isZodSchemaType(schema, "ZodObject")) {
370
- for (const sub of Object.values(getObjectShape(schema))) {
371
- if (hasContainerOrRootRefine(sub, visited)) return true;
372
- }
373
- return false;
374
- }
375
- if (isZodSchemaType(schema, "ZodArray")) {
376
- const elem = getArrayElement(schema);
377
- return elem !== void 0 && hasContainerOrRootRefine(elem, visited);
378
- }
379
- if (isZodSchemaType(schema, "ZodTuple")) {
380
- for (const it of getTupleItems(schema)) {
381
- if (hasContainerOrRootRefine(it, visited)) return true;
382
- }
383
- return false;
384
- }
385
- if (isZodSchemaType(schema, "ZodUnion") || isZodSchemaType(schema, "ZodDiscriminatedUnion")) {
386
- for (const opt of getUnionOptions(schema)) {
387
- if (hasContainerOrRootRefine(opt, visited)) return true;
267
+ if (isCoercePrimitive(schema)) capabilities.preprocessOrCoerce = true;
268
+ const typeName = getTypeName(schema) ?? "";
269
+ switch (typeName) {
270
+ case "ZodEffects": {
271
+ const kind = getEffectsKind(schema);
272
+ if (kind === "refinement") capabilities.asyncRefine = true;
273
+ else if ((kind === "transform" || kind === "preprocess") && isAsyncEffect(schema)) {
274
+ capabilities.asyncTransform = true;
275
+ }
276
+ if (kind === "preprocess") capabilities.preprocessOrCoerce = true;
277
+ const inner = unwrapEffectsSource(schema);
278
+ if (!capabilities.containerOrRootRefine && inner !== void 0 && isContainerAfterWrapperPeel(inner)) {
279
+ capabilities.containerOrRootRefine = true;
280
+ }
281
+ walkCapabilities(inner, capabilities, visited);
282
+ return;
388
283
  }
389
- return false;
390
- }
391
- if (isZodSchemaType(schema, "ZodIntersection")) {
392
- const left = getIntersectionLeft(schema);
393
- if (left !== void 0 && hasContainerOrRootRefine(left, visited)) return true;
394
- const right = getIntersectionRight(schema);
395
- if (right !== void 0 && hasContainerOrRootRefine(right, visited)) return true;
396
- return false;
397
- }
398
- if (isZodSchemaType(schema, "ZodRecord")) {
399
- const keyType = getRecordKeyType(schema);
400
- if (keyType !== void 0 && hasContainerOrRootRefine(keyType, visited)) return true;
401
- const valueType = getRecordValueType(schema);
402
- if (valueType !== void 0 && hasContainerOrRootRefine(valueType, visited)) return true;
403
- return false;
404
- }
405
- if (isZodSchemaType(schema, "ZodSet")) {
406
- const elem = getSetValueType(schema);
407
- return elem !== void 0 && hasContainerOrRootRefine(elem, visited);
284
+ case "ZodOptional":
285
+ case "ZodNullable":
286
+ case "ZodDefault":
287
+ case "ZodCatch":
288
+ case "ZodReadonly":
289
+ walkCapabilities(unwrapInner(schema), capabilities, visited);
290
+ return;
291
+ case "ZodBranded":
292
+ walkCapabilities(unwrapBranded(schema), capabilities, visited);
293
+ return;
294
+ case "ZodLazy":
295
+ walkCapabilities(unwrapLazy(schema), capabilities, visited);
296
+ return;
297
+ case "ZodPipeline":
298
+ walkCapabilities(unwrapPipeIn(schema), capabilities, visited);
299
+ walkCapabilities(unwrapPipeOut(schema), capabilities, visited);
300
+ return;
301
+ case "ZodObject":
302
+ for (const sub of Object.values(getObjectShape(schema))) {
303
+ walkCapabilities(sub, capabilities, visited);
304
+ }
305
+ return;
306
+ case "ZodArray":
307
+ walkCapabilities(getArrayElement(schema), capabilities, visited);
308
+ return;
309
+ case "ZodTuple":
310
+ for (const item of getTupleItems(schema)) walkCapabilities(item, capabilities, visited);
311
+ return;
312
+ case "ZodUnion":
313
+ case "ZodDiscriminatedUnion":
314
+ if (typeName === "ZodDiscriminatedUnion") capabilities.discriminatedUnion = true;
315
+ for (const option of getUnionOptions(schema)) walkCapabilities(option, capabilities, visited);
316
+ return;
317
+ case "ZodIntersection":
318
+ walkCapabilities(getIntersectionLeft(schema), capabilities, visited);
319
+ walkCapabilities(getIntersectionRight(schema), capabilities, visited);
320
+ return;
321
+ case "ZodRecord":
322
+ walkCapabilities(getRecordKeyType(schema), capabilities, visited);
323
+ walkCapabilities(getRecordValueType(schema), capabilities, visited);
324
+ return;
325
+ case "ZodSet":
326
+ capabilities.mapOrSet = true;
327
+ walkCapabilities(getSetValueType(schema), capabilities, visited);
328
+ return;
329
+ case "ZodMap":
330
+ capabilities.mapOrSet = true;
331
+ walkCapabilities(getMapKeyType(schema), capabilities, visited);
332
+ walkCapabilities(getMapValueType(schema), capabilities, visited);
333
+ return;
408
334
  }
409
- return false;
410
335
  }
336
+ const CONTAINER_TYPE_NAMES = /* @__PURE__ */ new Set([
337
+ "ZodObject",
338
+ "ZodArray",
339
+ "ZodTuple",
340
+ "ZodIntersection",
341
+ "ZodUnion",
342
+ "ZodDiscriminatedUnion",
343
+ "ZodRecord",
344
+ "ZodMap",
345
+ "ZodSet"
346
+ ]);
411
347
  function isContainerAfterWrapperPeel(schema) {
412
348
  let cur = schema;
413
- for (let i = 0; i < MAX_UNWRAP_STEPS$1; i++) {
414
- if (isZodSchemaType(cur, "ZodOptional") || isZodSchemaType(cur, "ZodNullable") || isZodSchemaType(cur, "ZodDefault") || isZodSchemaType(cur, "ZodCatch") || isZodSchemaType(cur, "ZodReadonly")) {
415
- const inner = unwrapInner(cur);
416
- if (inner === void 0) return false;
417
- cur = inner;
418
- } else if (isZodSchemaType(cur, "ZodBranded")) {
419
- const inner = unwrapBranded(cur);
420
- if (inner === void 0) return false;
421
- cur = inner;
422
- } else if (isZodSchemaType(cur, "ZodLazy")) {
423
- const inner = unwrapLazy(cur);
424
- if (inner === void 0) return false;
425
- cur = inner;
426
- } else {
427
- break;
349
+ for (let i = 0; i < MAX_UNWRAP_STEPS$1 && cur !== void 0; i++) {
350
+ const typeName = getTypeName(cur) ?? "";
351
+ switch (typeName) {
352
+ case "ZodOptional":
353
+ case "ZodNullable":
354
+ case "ZodDefault":
355
+ case "ZodCatch":
356
+ case "ZodReadonly":
357
+ cur = unwrapInner(cur);
358
+ break;
359
+ case "ZodBranded":
360
+ cur = unwrapBranded(cur);
361
+ break;
362
+ case "ZodLazy":
363
+ cur = unwrapLazy(cur);
364
+ break;
365
+ default:
366
+ return CONTAINER_TYPE_NAMES.has(typeName);
428
367
  }
429
368
  }
430
- return isZodSchemaType(cur, "ZodObject") || isZodSchemaType(cur, "ZodArray") || isZodSchemaType(cur, "ZodTuple") || isZodSchemaType(cur, "ZodIntersection") || isZodSchemaType(cur, "ZodUnion") || isZodSchemaType(cur, "ZodDiscriminatedUnion") || isZodSchemaType(cur, "ZodRecord") || isZodSchemaType(cur, "ZodSet");
369
+ return false;
431
370
  }
432
371
 
433
372
  const V3_INTROSPECTOR = {
@@ -439,10 +378,7 @@ const V3_INTROSPECTOR = {
439
378
  getLiteralValues,
440
379
  isPreprocessNode,
441
380
  isCoercePrimitive,
442
- containsAsyncRefine,
443
- containsAsyncTransform,
444
- containsDiscriminatedUnion,
445
- hasContainerOrRootRefine,
381
+ capabilitiesOf,
446
382
  // Walker accessors (D2 / D3 / D5).
447
383
  getArrayElement,
448
384
  getSetValueType,
@@ -467,6 +403,10 @@ const V3_INTROSPECTOR = {
467
403
  getCatchDefault,
468
404
  hasCatchValue
469
405
  };
406
+ const V3_SUB_SCHEMA_INTROSPECTOR = {
407
+ ...V3_INTROSPECTOR,
408
+ capabilitiesOf: scanCapabilities
409
+ };
470
410
 
471
411
  function mapKeyAt(value, index) {
472
412
  if (!(value instanceof Map)) return void 0;
@@ -534,7 +474,7 @@ function normalizeOne(path, rootSchema, data, maxRecursionDepth, peel) {
534
474
  }
535
475
 
536
476
  function slimPrimitivesV3(schema) {
537
- return new Set(slimPrimitivesWalk(schema, V3_INTROSPECTOR, 64));
477
+ return slimPrimitivesWalk(schema, V3_INTROSPECTOR, 64);
538
478
  }
539
479
 
540
480
  function rebuildWithDef(original, defPatch) {
@@ -603,6 +543,9 @@ function rebuildDiscriminatedUnion(original, options) {
603
543
  }
604
544
  return rebuildWithDef(original, { options, optionsMap });
605
545
  }
546
+ function rebuildPipeline(original, inSide, outSide) {
547
+ return rebuildWithDef(original, { in: inSide, out: outSide });
548
+ }
606
549
  function rebuildEffects(original, source, effect) {
607
550
  return rebuildWithDef(original, { schema: source, effect });
608
551
  }
@@ -678,7 +621,9 @@ function walkEffects(schema) {
678
621
  }
679
622
  if (isZodSchemaType(s, "ZodPipeline")) {
680
623
  const inSide = unwrapPipeIn(s);
681
- return inSide === void 0 ? s : recurse(inSide);
624
+ const outSide = unwrapPipeOut(s);
625
+ if (inSide === void 0 || outSide === void 0) return s;
626
+ return rebuildPipeline(s, recurse(inSide), recurse(outSide));
682
627
  }
683
628
  if (isZodSchemaType(s, "ZodObject")) {
684
629
  const shape = getObjectShape(s);
@@ -817,16 +762,22 @@ function syncSafe(schema) {
817
762
  return wrapped;
818
763
  }
819
764
  function buildV3Services(maxRecursionDepth) {
820
- const mapOrSetBySchema = /* @__PURE__ */ new WeakMap();
821
765
  const refileIssues = (schema, data, issues) => {
822
- let hasMapOrSet = mapOrSetBySchema.get(schema);
823
- if (hasMapOrSet === void 0) {
824
- hasMapOrSet = containsMapOrSet(schema);
825
- mapOrSetBySchema.set(schema, hasMapOrSet);
766
+ if (!issues.some((issue) => issue.path.some((segment) => typeof segment === "number"))) {
767
+ return issues;
826
768
  }
827
- if (!hasMapOrSet) return issues;
769
+ if (!capabilitiesOf(schema).mapOrSet) return issues;
828
770
  return normalizeIssuePaths(issues, schema, data, maxRecursionDepth, peelAllV3Wrappers);
829
771
  };
772
+ const validateSync = (schema, data) => {
773
+ if (capabilitiesOf(schema).asyncTransform) return [];
774
+ try {
775
+ const result = syncSafe(schema).safeParse(data);
776
+ return result.success ? [] : zodIssuesToValidationErrors(refileIssues(schema, data, result.error.issues));
777
+ } catch {
778
+ return [];
779
+ }
780
+ };
830
781
  return {
831
782
  getNestedSchemasAtPath: (schema, path, maxRecursionDepth2) => getNestedZodSchemasAtPath(schema, path, maxRecursionDepth2),
832
783
  // The shared path walker peels wrappers and effects inline, so the
@@ -836,6 +787,7 @@ function buildV3Services(maxRecursionDepth) {
836
787
  slimPrimitivesOf: (schema, _maxRecursionDepth) => slimPrimitivesV3(schema),
837
788
  deriveDefault: (schema, useDefault) => getDefaultValuesFromZodSchema(schema, useDefault),
838
789
  runGetDefaults: (schema, config, maxRecursionDepth2) => runGetDefaultsV3(schema, config, maxRecursionDepth2),
790
+ validateSync,
839
791
  unwrapStructuralWrappers: (schema) => unwrapStructuralLeafV3(schema),
840
792
  unwrapToDiscriminatedUnion: (schema) => unwrapToDiscriminatedUnion(schema),
841
793
  peelAllWrappers: (schema) => peelAllV3Wrappers(schema),
@@ -853,10 +805,10 @@ function buildV3Services(maxRecursionDepth) {
853
805
  // A `getSchemasAtPath` consumer may probe any method on the result,
854
806
  // so a sub-schema comes back as a full recursive AbstractSchema: the
855
807
  // factory call rebuilds the whole surface against it, with its own
856
- // per-form caches.
808
+ // per-form caches, and walks its capabilities without the memo.
857
809
  makeSubSchema: (sub, maxRecursionDepth2) => createAbstractSchema(
858
810
  sub,
859
- V3_INTROSPECTOR,
811
+ V3_SUB_SCHEMA_INTROSPECTOR,
860
812
  buildV3Services(maxRecursionDepth2),
861
813
  { maxRecursionDepth: maxRecursionDepth2 }
862
814
  )
@@ -1112,7 +1064,8 @@ function runGetDefaultsV3(rootSchema, config, maxRecursionDepth) {
1112
1064
  rootSchema,
1113
1065
  config.useDefaultSchemaValues
1114
1066
  );
1115
- const rawDefaultValues = config.constraints === void 0 ? defaultValuesWithoutConstraints : fixStructuralDefaults(
1067
+ if (config.constraints === void 0) return defaultValuesWithoutConstraints;
1068
+ return fixStructuralDefaults(
1116
1069
  rootSchema,
1117
1070
  mergeDeep(defaultValuesWithoutConstraints, config.constraints),
1118
1071
  config.useDefaultSchemaValues,
@@ -1124,34 +1077,6 @@ function runGetDefaultsV3(rootSchema, config, maxRecursionDepth) {
1124
1077
  unwrapToDiscriminatedUnion: (s) => unwrapToDiscriminatedUnion(s)
1125
1078
  }
1126
1079
  ).data;
1127
- if (containsAsyncTransform(rootSchema)) {
1128
- return {
1129
- data: rawDefaultValues,
1130
- errors: void 0,
1131
- success: true
1132
- };
1133
- }
1134
- try {
1135
- const parseResult = syncSafe(rootSchema).safeParse(rawDefaultValues);
1136
- if (parseResult.success) {
1137
- return {
1138
- data: rawDefaultValues,
1139
- errors: void 0,
1140
- success: true
1141
- };
1142
- }
1143
- return {
1144
- data: rawDefaultValues,
1145
- errors: zodIssuesToValidationErrors(parseResult.error.issues),
1146
- success: false
1147
- };
1148
- } catch {
1149
- return {
1150
- data: rawDefaultValues,
1151
- errors: void 0,
1152
- success: true
1153
- };
1154
- }
1155
1080
  }
1156
1081
 
1157
1082
  function useForm(configuration) {