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.
- package/dist/abstract.d.mts +5 -5
- package/dist/abstract.mjs +3 -3
- package/dist/dev/abstract.mjs +3 -3
- package/dist/dev/chunks/devtools.mjs +2 -2
- package/dist/dev/directive.mjs +1 -1
- package/dist/dev/history.mjs +1 -1
- package/dist/dev/index.mjs +4 -4
- package/dist/dev/runtime/plugins/attaform.mjs +1 -1
- package/dist/dev/shared/{attaform-dev.Chm4D6SJ.mjs → attaform-dev.B1q-x9R9.mjs} +2 -2
- package/dist/dev/shared/{attaform-dev.BUIFcTYf.mjs → attaform-dev.Caibt7sb.mjs} +11 -10
- package/dist/dev/shared/{attaform-dev.CT7MDjPy.mjs → attaform-dev.CtyqGia7.mjs} +152 -227
- package/dist/dev/shared/{attaform-dev.BJK1kqHY.mjs → attaform-dev.DJ3nsWw6.mjs} +74 -110
- package/dist/dev/shared/{attaform-dev.DuEE4GU1.mjs → attaform-dev.DlaT4xGd.mjs} +3 -3
- package/dist/dev/shared/{attaform-dev.BMQ3GcgD.mjs → attaform-dev.k5X47GMD.mjs} +474 -336
- package/dist/dev/shared/{attaform-dev.DxHdkkPG.mjs → attaform-dev.y9x9Vp9F.mjs} +206 -127
- package/dist/dev/zod-v3.mjs +5 -5
- package/dist/dev/zod-v4.mjs +5 -5
- package/dist/dev/zod.mjs +4 -4
- package/dist/directive.d.mts +2 -2
- package/dist/directive.mjs +1 -1
- package/dist/history.d.mts +1 -1
- package/dist/history.mjs +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +4 -4
- package/dist/runtime/components/AttaformDevtoolsPanel.vue +3 -3
- package/dist/runtime/plugins/attaform.mjs +1 -1
- package/dist/shared/{attaform.CO918TdU.mjs → attaform.BWUn8Kjy.mjs} +74 -110
- package/dist/shared/{attaform.WiGdIqgx.mjs → attaform.C4shmwyJ.mjs} +2 -2
- package/dist/shared/{attaform.2FslhB9R.d.mts → attaform.CRVe8s82.d.mts} +1 -1
- package/dist/shared/{attaform.L0kUn3vL.d.mts → attaform.D9RqPgGu.d.mts} +1 -1
- package/dist/shared/{attaform.BcQwgWaq.d.mts → attaform.DAo0QBmS.d.mts} +28 -8
- package/dist/shared/{attaform.ZYn2ahzJ.mjs → attaform.DBCbxlyk.mjs} +59 -1
- package/dist/shared/{attaform.DRsANMok.mjs → attaform.DL2nl_QR.mjs} +11 -10
- package/dist/shared/{attaform.BIWicztt.mjs → attaform.DNPJPOO7.mjs} +204 -125
- package/dist/shared/{attaform.Br8EBn5B.d.mts → attaform.DZnrDrNb.d.mts} +136 -32
- package/dist/shared/{attaform.D_f1WgYf.mjs → attaform.DxKQsqFZ.mjs} +456 -318
- package/dist/shared/{attaform.B2iebkPA.mjs → attaform.L011tHgJ.mjs} +3 -3
- package/dist/shared/{attaform.D_pt1gOj.mjs → attaform.LUPC-2Qg.mjs} +152 -227
- package/dist/transforms.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/zod-v3.d.mts +4 -4
- package/dist/zod-v3.mjs +5 -5
- package/dist/zod-v4.d.mts +13 -11
- package/dist/zod-v4.mjs +5 -5
- package/dist/zod.d.mts +4 -4
- package/dist/zod.mjs +4 -4
- package/package.json +1 -1
- package/skills/attaform/SKILL.md +1 -1
- package/skills/attaform/references/custom-components.md +4 -0
package/dist/dev/zod-v3.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { i as isZodSchemaType, u as useForm, z as zodAdapter } from './shared/attaform-dev.
|
|
2
|
-
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.
|
|
1
|
+
export { i as isZodSchemaType, u as useForm, z as zodAdapter } from './shared/attaform-dev.CtyqGia7.mjs';
|
|
2
|
+
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.Caibt7sb.mjs';
|
|
3
3
|
export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform-dev.zlvDr0WB.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-dev.
|
|
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-dev.
|
|
6
|
-
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.
|
|
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-dev.y9x9Vp9F.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-dev.B1q-x9R9.mjs';
|
|
6
|
+
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.k5X47GMD.mjs';
|
|
7
7
|
|
|
8
8
|
const fieldMeta = installingFieldMetaStore;
|
|
9
9
|
function withMeta(schema, payload) {
|
package/dist/dev/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-dev.
|
|
2
|
-
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.
|
|
1
|
+
export { a as assertZodVersion, k as kindOf, u as useForm, z as zodAdapter } from './shared/attaform-dev.DJ3nsWw6.mjs';
|
|
2
|
+
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.Caibt7sb.mjs';
|
|
3
3
|
export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform-dev.zlvDr0WB.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-dev.
|
|
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-dev.
|
|
6
|
-
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.
|
|
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-dev.y9x9Vp9F.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-dev.B1q-x9R9.mjs';
|
|
6
|
+
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.k5X47GMD.mjs';
|
|
7
7
|
|
|
8
8
|
const fieldMeta = installingFieldMetaStore;
|
|
9
9
|
function withMeta(schema, payload) {
|
package/dist/dev/zod.mjs
CHANGED
|
@@ -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.
|
|
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.
|
|
4
|
-
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.
|
|
5
|
-
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform-dev.
|
|
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';
|
package/dist/directive.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { i as installVRegister, v as vRegister } from './shared/attaform.
|
|
2
|
-
import {
|
|
1
|
+
export { i as installVRegister, v as vRegister } from './shared/attaform.D9RqPgGu.mjs';
|
|
2
|
+
import { an as RegisterModelDynamicCustomDirective } from './shared/attaform.DZnrDrNb.mjs';
|
|
3
3
|
import 'vue';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/directive.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { i as installVRegister, v as vRegister, b as vRegisterFile } from './shared/attaform.
|
|
1
|
+
export { i as installVRegister, v as vRegister, b as vRegisterFile } from './shared/attaform.DxKQsqFZ.mjs';
|
package/dist/history.d.mts
CHANGED
package/dist/history.mjs
CHANGED
|
@@ -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()]);
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEVTOOLS_WINDOW_KEY, F as FormStatus, f as FormStatusSeed, G as GateMarker, I as InjectWizardInput, g as InvalidPathError, h as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, i as ReservedFormKeyError, S as SerializedAttaformState, j as SerializedFormData, k as StepSlot, l as SubmitErrorHandlerError, U as UseRegisterOptions, m as UseRegisterReturn, n as UseWizardReturnType, W as WizardAggregateError, o as WizardCtx, p as WizardCtxForm, q as WizardOnError, r as WizardOnSubmit, s as WizardOptions, t as WizardPersistFn, u as WizardRestoreFn, v as WizardRestoreState, w as WizardStatusesProxy, x as WizardSubmitContext, y as assignKey, z as createAttaform, B as createRegistry, E as escapeForInlineScript, H as gate, J as getRegistryFromApp, K as hydrateAttaformState, M as injectForm, N as injectWizard, P as isRegisterValue, Q as kAttaformRegistry, T as lazy, V as renderAttaformState, X as useRegister, Y as useRegistry, Z as useWizard } from './shared/attaform.
|
|
2
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration,
|
|
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.DAo0QBmS.mjs';
|
|
2
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, ap as AcceptableDefaults, ab as ValidateOnConfig, a as UseFormReturnType, D as DefaultValuesInput, h as FieldMetaPayload } from './shared/attaform.DZnrDrNb.mjs';
|
|
3
3
|
import { AbstractSchema } from './abstract.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, 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
|
|
5
|
-
export { v as vRegister } from './shared/attaform.
|
|
6
|
-
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.
|
|
7
|
-
export { P as PathInput, a as PathOutput } from './shared/attaform.
|
|
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, i as FieldState, j as FieldStateMap, k as FieldStateMapEntry, l as FlatPath, m as FormErrorRecord, n as FormErrorsSurface, o as FormMeta, H as HandleSubmit, p as HistoryPlugin, I as IsTuple, q as IsUnion, J as JoinSegments, r as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, s as NestedType, O as OnError, t as OnSubmit, P as ParseOptions, u as PartialFlatPath, v as Path, w as PathKey, x as PendingValidationStatus, y as Primitive, R as ROOT_PATH, z as ROOT_PATH_KEY, B as ReactiveValidationStatus, Q as RecordPath, S as RecordValue, T as RegisterDirective, V as RegisterFlatPath, W as RegisterOptions, X as RegisterSelectModifier, Y as RegisterTextModifier, Z as RegisterTransform, _ as RegisterValue, $ as SchemaParseErrorWithData, a0 as SchemaParseErrorWithoutData, a1 as SchemaParseResult, a2 as SchemaParseSuccess, a3 as Segment, a4 as SetValueCallback, a5 as SetValuePayload, a6 as SettledValidationStatus, a7 as SlimPrimitiveKind, a8 as SubmitHandler, a9 as Unset, aa as ValidateOn, ac as ValidationError, ad as ValidationResponse, ae as ValidationResponseWithoutValue, af as ValueOfUnion, ag as WriteMeta, ah as WriteShape, ai as canonicalizePath, aj as isPathPrefix, ak as isUnset, al as parseDottedPath, am as unset } from './shared/attaform.DZnrDrNb.mjs';
|
|
5
|
+
export { v as vRegister } from './shared/attaform.D9RqPgGu.mjs';
|
|
6
|
+
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.CRVe8s82.mjs';
|
|
7
|
+
export { P as PathInput, a as PathOutput } from './shared/attaform.CRVe8s82.mjs';
|
|
8
8
|
import { S as SupportedRootSchema$1, a as StorageShape$1 } from './shared/attaform.B-Tb62qV.mjs';
|
|
9
9
|
import { UnwrapZodRoot } from './zod-v3.mjs';
|
|
10
10
|
import { z } from 'zod';
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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.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.
|
|
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.
|
|
4
|
-
export { a as assignKey, v as vRegister } from './shared/attaform.
|
|
5
|
-
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.
|
|
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.DNPJPOO7.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
|
+
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.L011tHgJ.mjs';
|
|
6
6
|
export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
|
|
@@ -72,7 +72,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
72
72
|
void updateTick.value
|
|
73
73
|
const form = activeForm.value
|
|
74
74
|
if (form === null) return []
|
|
75
|
-
return Array.from(form.errorCells.entries())
|
|
75
|
+
return Array.from(form.errorCells().entries())
|
|
76
76
|
.filter(([, cell]) => cell.schema.length > 0)
|
|
77
77
|
.map(([key, cell]) => [key, cell.schema] as const)
|
|
78
78
|
})
|
|
@@ -81,7 +81,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
81
81
|
void updateTick.value
|
|
82
82
|
const form = activeForm.value
|
|
83
83
|
if (form === null) return []
|
|
84
|
-
return Array.from(form.errorCells.entries())
|
|
84
|
+
return Array.from(form.errorCells().entries())
|
|
85
85
|
.filter(([, cell]) => cell.user.length > 0)
|
|
86
86
|
.map(([key, cell]) => [key, cell.user] as const)
|
|
87
87
|
})
|
|
@@ -221,7 +221,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
221
221
|
value = (value as Record<string | number, unknown>)[seg]
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
const cell = form.errorCells.get(canonicalKey)
|
|
224
|
+
const cell = form.errorCells().get(canonicalKey)
|
|
225
225
|
const schemaEntries =
|
|
226
226
|
(cell?.schema as ReadonlyArray<{ message: string; code: string }> | undefined) ?? []
|
|
227
227
|
const userEntries =
|
|
@@ -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.
|
|
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.C4shmwyJ.mjs';
|
|
3
3
|
|
|
4
4
|
var attaform_default = defineNuxtPlugin({
|
|
5
5
|
// `enforce: 'pre'` makes the "we run before any component's setup" claim
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { j as humanize, c as useAbstractForm } from './attaform.
|
|
1
|
+
import { j as humanize, c as useAbstractForm } from './attaform.DNPJPOO7.mjs';
|
|
2
2
|
import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform.CdZIEf7_.mjs';
|
|
3
|
-
import { s as slimPrimitivesWalk, d as deriveDefaultWalk, m as mergeDeep, f as fixStructuralDefaults, w as walkPathSegments, c as createAbstractSchema, a as createSharedSchemaStore, b as buildFieldMetaPathMap, e as getFieldMetaListForSchema, g as getFieldMetaForSchema } from './attaform.
|
|
3
|
+
import { s as slimPrimitivesWalk, d as deriveDefaultWalk, m as mergeDeep, f as fixStructuralDefaults, w as walkPathSegments, c as createAbstractSchema, a as createSharedSchemaStore, b as buildFieldMetaPathMap, e as getFieldMetaListForSchema, g as getFieldMetaForSchema } from './attaform.DL2nl_QR.mjs';
|
|
4
4
|
import { c as callConsumerFn } from './attaform.8mfKZCwH.mjs';
|
|
5
5
|
|
|
6
6
|
function readDef(schema) {
|
|
@@ -119,9 +119,7 @@ function isCoercePrimitive(schema) {
|
|
|
119
119
|
return readDef(schema)?.coerce === true;
|
|
120
120
|
}
|
|
121
121
|
function isPreprocessNode(schema) {
|
|
122
|
-
|
|
123
|
-
const pipeIn = unwrapPipeIn(schema);
|
|
124
|
-
return pipeIn !== void 0 && kindOf(pipeIn) === "transform";
|
|
122
|
+
return kindOf(schema) === "pipe" && kindOf(readDef(schema)?.in) === "transform";
|
|
125
123
|
}
|
|
126
124
|
function unwrapPipeOut(schema) {
|
|
127
125
|
const def = readDef(schema);
|
|
@@ -200,60 +198,6 @@ const DESCEND_SINGLE = [
|
|
|
200
198
|
];
|
|
201
199
|
const DESCEND_RECORD = ["shape", "entries"];
|
|
202
200
|
const DESCEND_LIST = ["options", "items"];
|
|
203
|
-
function walkSchemaTree(schema, visit, seen) {
|
|
204
|
-
const visited = seen ?? /* @__PURE__ */ new WeakSet();
|
|
205
|
-
const candidate = schema;
|
|
206
|
-
if (typeof candidate !== "object" || candidate === null) return false;
|
|
207
|
-
if (visited.has(candidate)) return false;
|
|
208
|
-
visited.add(candidate);
|
|
209
|
-
if (visit(schema)) return true;
|
|
210
|
-
const def = readDef(schema);
|
|
211
|
-
if (def === void 0) return false;
|
|
212
|
-
const slots = def;
|
|
213
|
-
for (const key of DESCEND_SINGLE) {
|
|
214
|
-
const child = slots[key];
|
|
215
|
-
if (child !== void 0 && walkSchemaTree(child, visit, visited)) return true;
|
|
216
|
-
}
|
|
217
|
-
for (const key of DESCEND_RECORD) {
|
|
218
|
-
const record = slots[key];
|
|
219
|
-
if (record !== void 0) {
|
|
220
|
-
for (const sub of Object.values(record)) {
|
|
221
|
-
if (walkSchemaTree(sub, visit, visited)) return true;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
for (const key of DESCEND_LIST) {
|
|
226
|
-
const list = slots[key];
|
|
227
|
-
if (list !== void 0) {
|
|
228
|
-
for (const sub of list) {
|
|
229
|
-
if (walkSchemaTree(sub, visit, visited)) return true;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
if (typeof def.getter === "function") {
|
|
234
|
-
try {
|
|
235
|
-
const inner = def.getter();
|
|
236
|
-
if (walkSchemaTree(inner, visit, visited)) return true;
|
|
237
|
-
} catch {
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return false;
|
|
241
|
-
}
|
|
242
|
-
function containsDiscriminatedUnion(schema, seen) {
|
|
243
|
-
return walkSchemaTree(schema, (node) => kindOf(node) === "discriminated-union", seen);
|
|
244
|
-
}
|
|
245
|
-
function containsAsyncRefine(schema, seen) {
|
|
246
|
-
return walkSchemaTree(
|
|
247
|
-
schema,
|
|
248
|
-
(node) => {
|
|
249
|
-
for (const check of getChecks(node)) {
|
|
250
|
-
if (isAsyncCheck(check)) return true;
|
|
251
|
-
}
|
|
252
|
-
return false;
|
|
253
|
-
},
|
|
254
|
-
seen
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
201
|
const CONTAINER_SLOTS = [
|
|
258
202
|
"shape",
|
|
259
203
|
"entries",
|
|
@@ -265,31 +209,55 @@ const CONTAINER_SLOTS = [
|
|
|
265
209
|
"left",
|
|
266
210
|
"right"
|
|
267
211
|
];
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
);
|
|
212
|
+
const capabilityMemo = /* @__PURE__ */ new WeakMap();
|
|
213
|
+
function capabilitiesOf(schema) {
|
|
214
|
+
let capabilities = capabilityMemo.get(schema);
|
|
215
|
+
if (capabilities === void 0) {
|
|
216
|
+
capabilities = scanCapabilities(schema);
|
|
217
|
+
const key = schema;
|
|
218
|
+
if (typeof key === "object" && key !== null) capabilityMemo.set(key, capabilities);
|
|
219
|
+
}
|
|
220
|
+
return capabilities;
|
|
221
|
+
}
|
|
222
|
+
function scanCapabilities(schema) {
|
|
223
|
+
const capabilities = {
|
|
224
|
+
asyncRefine: false,
|
|
225
|
+
asyncTransform: false,
|
|
226
|
+
discriminatedUnion: false,
|
|
227
|
+
containerOrRootRefine: false,
|
|
228
|
+
preprocessOrCoerce: false
|
|
229
|
+
};
|
|
230
|
+
walkCapabilities(schema, capabilities, /* @__PURE__ */ new WeakSet());
|
|
231
|
+
return capabilities;
|
|
232
|
+
}
|
|
233
|
+
function walkCapabilities(node, capabilities, visited) {
|
|
234
|
+
if (typeof node !== "object" || node === null || visited.has(node)) return;
|
|
235
|
+
visited.add(node);
|
|
236
|
+
const def = readDef(node);
|
|
237
|
+
if (def === void 0) return;
|
|
238
|
+
const checks = getChecks(node);
|
|
239
|
+
if (checks.some(isAsyncCheck)) capabilities.asyncRefine = true;
|
|
240
|
+
if (checks.length > 0 && CONTAINER_SLOTS.some((key) => def[key] !== void 0)) {
|
|
241
|
+
capabilities.containerOrRootRefine = true;
|
|
242
|
+
}
|
|
243
|
+
if (typeof def.transform === "function" && def.transform.constructor.name === "AsyncFunction") {
|
|
244
|
+
capabilities.asyncTransform = true;
|
|
245
|
+
}
|
|
246
|
+
if (kindOf(node) === "discriminated-union") capabilities.discriminatedUnion = true;
|
|
247
|
+
if (isCoercePrimitive(node) || isPreprocessNode(node)) capabilities.preprocessOrCoerce = true;
|
|
248
|
+
for (const key of DESCEND_SINGLE) walkCapabilities(def[key], capabilities, visited);
|
|
249
|
+
for (const key of DESCEND_RECORD) {
|
|
250
|
+
for (const sub of Object.values(def[key] ?? {})) walkCapabilities(sub, capabilities, visited);
|
|
251
|
+
}
|
|
252
|
+
for (const key of DESCEND_LIST) {
|
|
253
|
+
for (const sub of def[key] ?? []) walkCapabilities(sub, capabilities, visited);
|
|
254
|
+
}
|
|
255
|
+
if (typeof def.getter === "function") {
|
|
256
|
+
try {
|
|
257
|
+
walkCapabilities(def.getter(), capabilities, visited);
|
|
258
|
+
} catch {
|
|
259
|
+
}
|
|
260
|
+
}
|
|
293
261
|
}
|
|
294
262
|
function isAsyncCheck(check) {
|
|
295
263
|
if (typeof check !== "object" || check === null) return false;
|
|
@@ -354,10 +322,7 @@ const V4_INTROSPECTOR = {
|
|
|
354
322
|
getLiteralValues,
|
|
355
323
|
isPreprocessNode,
|
|
356
324
|
isCoercePrimitive,
|
|
357
|
-
|
|
358
|
-
containsAsyncTransform,
|
|
359
|
-
containsDiscriminatedUnion,
|
|
360
|
-
hasContainerOrRootRefine,
|
|
325
|
+
capabilitiesOf,
|
|
361
326
|
// Walker accessors (D2 / D3 / D5).
|
|
362
327
|
getArrayElement: (schema) => {
|
|
363
328
|
if (kindOf(schema) !== "array") return void 0;
|
|
@@ -384,7 +349,7 @@ const V4_INTROSPECTOR = {
|
|
|
384
349
|
};
|
|
385
350
|
|
|
386
351
|
function slimPrimitivesOf(schema, maxRecursionDepth) {
|
|
387
|
-
return
|
|
352
|
+
return slimPrimitivesWalk(schema, V4_INTROSPECTOR, maxRecursionDepth);
|
|
388
353
|
}
|
|
389
354
|
|
|
390
355
|
function deriveDefault(schema, useDefault, maxRecursionDepth) {
|
|
@@ -540,6 +505,7 @@ function buildV4Services() {
|
|
|
540
505
|
slimPrimitivesOf: (schema, maxRecursionDepth) => slimPrimitivesOf(schema, maxRecursionDepth),
|
|
541
506
|
deriveDefault: (schema, useDefault, maxRecursionDepth) => deriveDefault(schema, useDefault, maxRecursionDepth),
|
|
542
507
|
runGetDefaults: (schema, config, maxRecursionDepth) => runGetDefaultsV4(schema, config, maxRecursionDepth),
|
|
508
|
+
validateSync: (schema, data) => validateSyncV4(schema, data),
|
|
543
509
|
unwrapStructuralWrappers: (schema) => unwrapStructuralWrappers(schema),
|
|
544
510
|
unwrapToDiscriminatedUnion: (schema) => unwrapToDiscriminatedUnion(schema),
|
|
545
511
|
peelAllWrappers: (schema) => peelAllWrappers(schema),
|
|
@@ -558,37 +524,35 @@ function buildV4Services() {
|
|
|
558
524
|
};
|
|
559
525
|
}
|
|
560
526
|
function runGetDefaultsV4(rootSchema, config, maxRecursionDepth) {
|
|
561
|
-
|
|
527
|
+
return getDefaultValuesFromZodSchema({
|
|
562
528
|
schema: rootSchema,
|
|
563
529
|
useDefaultSchemaValues: config.useDefaultSchemaValues,
|
|
564
530
|
constraints: config.constraints,
|
|
565
531
|
maxRecursionDepth
|
|
566
|
-
});
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
532
|
+
}).data;
|
|
533
|
+
}
|
|
534
|
+
const verdictRan = /* @__PURE__ */ new WeakMap();
|
|
535
|
+
function validateSyncV4(rootSchema, data) {
|
|
536
|
+
const { asyncRefine, asyncTransform } = capabilitiesOf(rootSchema);
|
|
537
|
+
if (asyncRefine || asyncTransform) return [];
|
|
570
538
|
try {
|
|
571
|
-
const
|
|
572
|
-
if (
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
return {
|
|
576
|
-
data,
|
|
577
|
-
errors: zodIssuesToValidationErrors(parseResult.error.issues),
|
|
578
|
-
success: false
|
|
579
|
-
};
|
|
539
|
+
const jitless = !verdictRan.has(rootSchema);
|
|
540
|
+
if (jitless) verdictRan.set(rootSchema, true);
|
|
541
|
+
const parseResult = rootSchema.safeParse(data, { jitless });
|
|
542
|
+
return parseResult.success ? [] : zodIssuesToValidationErrors(parseResult.error.issues);
|
|
580
543
|
} catch {
|
|
581
|
-
return
|
|
544
|
+
return [];
|
|
582
545
|
}
|
|
583
546
|
}
|
|
584
547
|
function buildSubSchemaStubV4(schema, maxRecursionDepth) {
|
|
585
548
|
return {
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
}
|
|
549
|
+
// Async work of either kind, as the root's `needsAsyncValidation`
|
|
550
|
+
// counts it: the field's `valid` waits for the first async pass.
|
|
551
|
+
needsAsyncValidation: () => {
|
|
552
|
+
const { asyncRefine, asyncTransform } = scanCapabilities(schema);
|
|
553
|
+
return asyncRefine || asyncTransform;
|
|
554
|
+
},
|
|
555
|
+
getDefaultValues: () => deriveDefault(schema, true, maxRecursionDepth),
|
|
592
556
|
getSchemasAtPath: () => [],
|
|
593
557
|
validateAtPath: async (data) => {
|
|
594
558
|
const result = await schema.safeParseAsync(data);
|
|
@@ -168,8 +168,8 @@ function renderAttaformState(app) {
|
|
|
168
168
|
// The wire shape stays two per-source arrays; the tagged store
|
|
169
169
|
// splits at the boundary and the client replays each side into
|
|
170
170
|
// its cell half.
|
|
171
|
-
schemaErrors: [...state.errorCells.entries()].filter(([, cell]) => cell.schema.length > 0).map(([key2, cell]) => [key2, cell.schema]),
|
|
172
|
-
userErrors: [...state.errorCells.entries()].filter(([, cell]) => cell.user.length > 0).map(([key2, cell]) => [key2, cell.user]),
|
|
171
|
+
schemaErrors: [...state.errorCells().entries()].filter(([, cell]) => cell.schema.length > 0).map(([key2, cell]) => [key2, cell.schema]),
|
|
172
|
+
userErrors: [...state.errorCells().entries()].filter(([, cell]) => cell.user.length > 0).map(([key2, cell]) => [key2, cell.user]),
|
|
173
173
|
fields: Array.from(state.fields.entries()),
|
|
174
174
|
...transientList.length > 0 ? { blankPaths: transientList } : {}
|
|
175
175
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GenericForm, l as FlatPath, s as NestedType, F as FormKey, U as UseFormConfiguration, A as AbstractSchema,
|
|
2
|
+
import { G as GenericForm, l as FlatPath, s as NestedType, F as FormKey, U as UseFormConfiguration, A as AbstractSchema, ap as AcceptableDefaults, ab as ValidateOnConfig, a as UseFormReturnType } from './attaform.DZnrDrNb.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The Zod v4 schema roots `useForm` accepts. A fixed-shape
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { an as RegisterModelDynamicCustomDirective } from './attaform.DZnrDrNb.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The `v-register` directive. Bind a form field to a native input, select,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GenericForm, F as FormKey, a as UseFormReturnType, _ as RegisterValue, v as Path, w as PathKey,
|
|
1
|
+
import { G as GenericForm, F as FormKey, a as UseFormReturnType, _ as RegisterValue, v as Path, w as PathKey, aq as DisplayCtx, ar as GetDisplayState, as as DisplayMachine, at as FieldRecord, au as ErrorCell, ac as ValidationError, av as OriginalsRecord, A as AbstractSchema, ag as WriteMeta, d as DeepPartial, ah as WriteShape, aw as AttaformDomBinding, ax as TransformAbortHolder } from './attaform.DZnrDrNb.mjs';
|
|
2
2
|
import { Ref, ComputedRef, ShallowRef, App, InjectionKey, Plugin } from 'vue';
|
|
3
3
|
|
|
4
4
|
/** Options accepted by `injectForm` in place of a bare key string. */
|
|
@@ -48,6 +48,10 @@ type InjectFormInput = {
|
|
|
48
48
|
* Pass the `Form` generic explicitly, since Vue's provide/inject erases
|
|
49
49
|
* generics. The form stays alive for this component's lifetime and is
|
|
50
50
|
* cleaned up once every consumer has unmounted.
|
|
51
|
+
*
|
|
52
|
+
* Components whose nearest `useForm`-calling ancestor is the same one get
|
|
53
|
+
* the same form object for the same form: `injectForm('cart')` in two of
|
|
54
|
+
* its descendants returns one form, with one set of field caches.
|
|
51
55
|
*/
|
|
52
56
|
declare function injectForm<Form extends GenericForm, GetValueFormType extends GenericForm = Form>(input?: FormKey | InjectFormInput): UseFormReturnType<Form, GetValueFormType> | null;
|
|
53
57
|
|
|
@@ -135,6 +139,10 @@ type UseRegisterOptions = {
|
|
|
135
139
|
* `.value` unwrap. Reads inside a `computed` or `watchEffect` re-run
|
|
136
140
|
* when the parent rebinds to a different path.
|
|
137
141
|
*
|
|
142
|
+
* Modifiers on the parent's binding apply at the inner control, so
|
|
143
|
+
* `<MyInput v-register.trim="form.register('email')" />` trims there,
|
|
144
|
+
* together with any the wrapper writes on its own `v-register`.
|
|
145
|
+
*
|
|
138
146
|
* When no parent bound, every field reads `undefined`, so reach for
|
|
139
147
|
* `rv?.path`. `v-register="rv"` is still safe. A wrapper that is meant
|
|
140
148
|
* to render both with and without a form declares it with
|
|
@@ -159,9 +167,10 @@ type DynamicPathSweep = {
|
|
|
159
167
|
* `PathKey` of a path the form no longer has, and deletes whatever it
|
|
160
168
|
* files under that path. A cache keying by more than the path (a
|
|
161
169
|
* shape sigil, say) deletes every variant; a key it never held is a
|
|
162
|
-
* no-op.
|
|
170
|
+
* no-op. Returns the release, which a registrant that does not live
|
|
171
|
+
* as long as the form must call.
|
|
163
172
|
*/
|
|
164
|
-
readonly onEvict: (evict: (key: PathKey) => void) => void;
|
|
173
|
+
readonly onEvict: (evict: (key: PathKey) => void) => () => void;
|
|
165
174
|
};
|
|
166
175
|
|
|
167
176
|
/**
|
|
@@ -290,8 +299,14 @@ type FormStore<F extends GenericForm, G extends GenericForm = F> = {
|
|
|
290
299
|
* mutated so Vue's per-key Map tracking fires for either side. Derived blank
|
|
291
300
|
* entries are not stored here; they synthesize at read
|
|
292
301
|
* (`derivedBlankErrors`).
|
|
302
|
+
*
|
|
303
|
+
* A method, not a property, because it is also the gate on the
|
|
304
|
+
* construction seed: the first call runs it (see `createErrorCells`). A
|
|
305
|
+
* getter on the store object would gate a property read the same way,
|
|
306
|
+
* but V8 builds an object literal holding an accessor in dictionary mode,
|
|
307
|
+
* and every kernel read of the store would then pay a hash lookup.
|
|
293
308
|
*/
|
|
294
|
-
readonly errorCells: Map<PathKey, ErrorCell>;
|
|
309
|
+
readonly errorCells: () => Map<PathKey, ErrorCell>;
|
|
295
310
|
/**
|
|
296
311
|
* Reactively-derived "No value supplied" errors: a pure function of
|
|
297
312
|
* `(blankPaths, schema.isRequiredAtPath)` with no writers and no clears.
|
|
@@ -492,10 +507,15 @@ type FormStore<F extends GenericForm, G extends GenericForm = F> = {
|
|
|
492
507
|
* side, because no errors at frame 1 means "not checked yet", not "checked
|
|
493
508
|
* and clean".
|
|
494
509
|
*
|
|
495
|
-
* The window it closes:
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
* so
|
|
510
|
+
* The window it closes: a schema with async work gets no verdict from the
|
|
511
|
+
* construction parse (v4 skips it for an async refine or transform; v3 skips
|
|
512
|
+
* it for an async transform and mounts clean when it throws over an async
|
|
513
|
+
* refine), so no construction errors land, and until the queued async pass
|
|
514
|
+
* runs, frame 1 would paint the form valid a tick before the real verdict.
|
|
515
|
+
* A sync-only schema's construction parse seeds its verdict synchronously,
|
|
516
|
+
* before the first read of its errors returns, so its gate starts open. v3
|
|
517
|
+
* reports every `.refine` as async, so a v3 schema with a sync refine
|
|
518
|
+
* starts gated and seeded.
|
|
499
519
|
*
|
|
500
520
|
* `reset()` restores it to the same construction-time seed, so the post-reset
|
|
501
521
|
* window gates exactly like the post-mount one.
|
|
@@ -119,6 +119,20 @@ const NATIVE_FORM_TAGS = /* @__PURE__ */ new Set([
|
|
|
119
119
|
"label",
|
|
120
120
|
"button"
|
|
121
121
|
]);
|
|
122
|
+
const HOST_MODIFIERS = ["lazy", "trim", "number"];
|
|
123
|
+
function hostModifiersLiteral(registerDirective) {
|
|
124
|
+
const present = HOST_MODIFIERS.filter(
|
|
125
|
+
(name) => registerDirective?.modifiers.some((m) => m.content === name) === true
|
|
126
|
+
);
|
|
127
|
+
return present.length === 0 ? "{}" : `{ ${present.map((name) => `${name}: true`).join(", ")} }`;
|
|
128
|
+
}
|
|
129
|
+
function isInputListenerSlot(prop) {
|
|
130
|
+
if (prop.type !== NodeTypes.DIRECTIVE || prop.name !== "on" && prop.name !== "bind") {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
if (prop.arg === void 0) return true;
|
|
134
|
+
return prop.arg.type === NodeTypes.SIMPLE_EXPRESSION && prop.arg.content === (prop.name === "on" ? "input" : "onInput");
|
|
135
|
+
}
|
|
122
136
|
function inferOptionValueFromChildren(node) {
|
|
123
137
|
if (!("children" in node)) return null;
|
|
124
138
|
const children = node.children;
|
|
@@ -275,6 +289,11 @@ const componentBridgeTransform = (node, context) => {
|
|
|
275
289
|
node.props.push(valueProp);
|
|
276
290
|
}
|
|
277
291
|
if (isPlainComponentHost) {
|
|
292
|
+
const hostModifiers = hostModifiersLiteral(
|
|
293
|
+
node.props.find(
|
|
294
|
+
(p) => p.type === NodeTypes.DIRECTIVE && p.name === "register"
|
|
295
|
+
)
|
|
296
|
+
);
|
|
278
297
|
removePropsByName(node.props, [
|
|
279
298
|
"model",
|
|
280
299
|
"modelValue",
|
|
@@ -317,7 +336,7 @@ const componentBridgeTransform = (node, context) => {
|
|
|
317
336
|
const updateInitExpression = createCompoundExpression([
|
|
318
337
|
"$event => (",
|
|
319
338
|
...modelValuePropExpArray,
|
|
320
|
-
|
|
339
|
+
`)?.setValueFromHost?.($event, ${hostModifiers})`
|
|
321
340
|
]);
|
|
322
341
|
const updateSimpleExpression = createSimpleExpression(
|
|
323
342
|
flattenExpression(updateInitExpression),
|
|
@@ -346,6 +365,45 @@ const componentBridgeTransform = (node, context) => {
|
|
|
346
365
|
loc: selectLoc
|
|
347
366
|
};
|
|
348
367
|
node.props.push(updateModelValueProp);
|
|
368
|
+
const inputAlreadyInjected = node.props.some(
|
|
369
|
+
(p) => p.type === NodeTypes.DIRECTIVE && p.name === "bind" && p.arg?.type === NodeTypes.SIMPLE_EXPRESSION && p.arg.content === "onInput" && p.exp !== void 0 && flattenExpression(p.exp).includes("setValueFromHostInput")
|
|
370
|
+
);
|
|
371
|
+
if (!inputAlreadyInjected) {
|
|
372
|
+
const inputInitExpression = createCompoundExpression([
|
|
373
|
+
"$event => (",
|
|
374
|
+
...modelValuePropExpArray,
|
|
375
|
+
`)?.setValueFromHostInput?.($event, ${hostModifiers})`
|
|
376
|
+
]);
|
|
377
|
+
const inputSimpleExpression = createSimpleExpression(
|
|
378
|
+
flattenExpression(inputInitExpression),
|
|
379
|
+
false
|
|
380
|
+
);
|
|
381
|
+
let inputOutputExp;
|
|
382
|
+
try {
|
|
383
|
+
inputOutputExp = processExpression(inputSimpleExpression, {
|
|
384
|
+
...context,
|
|
385
|
+
prefixIdentifiers: false
|
|
386
|
+
});
|
|
387
|
+
} catch (err) {
|
|
388
|
+
console.error(
|
|
389
|
+
"[attaform] component-bridge transform: processExpression failed for onInput; falling back to the unprocessed expression.",
|
|
390
|
+
err
|
|
391
|
+
);
|
|
392
|
+
inputOutputExp = inputSimpleExpression;
|
|
393
|
+
}
|
|
394
|
+
const inputProp = {
|
|
395
|
+
rawName: "@input",
|
|
396
|
+
arg: createSimpleExpression("onInput", true),
|
|
397
|
+
exp: inputOutputExp,
|
|
398
|
+
name: "bind",
|
|
399
|
+
modifiers: [],
|
|
400
|
+
type: NodeTypes.DIRECTIVE,
|
|
401
|
+
loc: selectLoc
|
|
402
|
+
};
|
|
403
|
+
const authorListenerIndex = node.props.findIndex(isInputListenerSlot);
|
|
404
|
+
if (authorListenerIndex === -1) node.props.push(inputProp);
|
|
405
|
+
else node.props.splice(authorListenerIndex, 0, inputProp);
|
|
406
|
+
}
|
|
349
407
|
}
|
|
350
408
|
const registerExprArray = Array.isArray(registerSummarizedProp?.value) ? registerSummarizedProp.value : [registerSummarizedProp?.value ?? "undefined"];
|
|
351
409
|
const hasAuthorDisabled = selectSummarizedProps.findIndex((p) => isExactKey(p.key, "disabled")) !== -1;
|