attaform 0.24.1 → 0.24.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/fingerprint2.cjs +1 -1
- package/dist/chunks/fingerprint2.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +1 -1
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/shared/{attaform.BwAcpoRw.d.mts → attaform.0zueP54D.d.mts} +10 -1
- package/dist/shared/{attaform.Cn6JoG9o.cjs → attaform.B57G7ePY.cjs} +3 -3
- package/dist/shared/{attaform.FY5r1BpA.mjs.map → attaform.B57G7ePY.cjs.map} +1 -1
- package/dist/shared/{attaform.NWrEGrNo.mjs → attaform.BI7M3wK8.mjs} +36 -1
- package/dist/shared/attaform.BI7M3wK8.mjs.map +1 -0
- package/dist/shared/{attaform.FY5r1BpA.mjs → attaform.B_-nZHtM.mjs} +3 -3
- package/dist/shared/{attaform.Cn6JoG9o.cjs.map → attaform.B_-nZHtM.mjs.map} +1 -1
- package/dist/shared/{attaform.C-tQKknW.mjs → attaform.BjUaX7s8.mjs} +2 -2
- package/dist/shared/{attaform.C-tQKknW.mjs.map → attaform.BjUaX7s8.mjs.map} +1 -1
- package/dist/shared/{attaform.4zesozTg.d.mts → attaform.BjiHiYAZ.d.ts} +3 -2
- package/dist/shared/{attaform.DRQjF16I.cjs → attaform.Bos7wVZw.cjs} +36 -1
- package/dist/shared/attaform.Bos7wVZw.cjs.map +1 -0
- package/dist/shared/{attaform.Bk7vnQhG.d.cts → attaform.Bx6pgrIy.d.cts} +3 -2
- package/dist/shared/{attaform.CrrIaHM8.cjs → attaform.D-gYGj5z.cjs} +3 -3
- package/dist/shared/{attaform.BunnTiTw.mjs.map → attaform.D-gYGj5z.cjs.map} +1 -1
- package/dist/shared/{attaform.Bq6Copxn.d.cts → attaform.DHjRN5JP.d.cts} +10 -1
- package/dist/shared/{attaform.DwLw3Kzv.cjs → attaform.DK6_Ctv7.cjs} +4 -4
- package/dist/shared/attaform.DK6_Ctv7.cjs.map +1 -0
- package/dist/shared/{attaform.DBhrKb2j.d.mts → attaform.DUc6cetN.d.cts} +37 -1
- package/dist/shared/{attaform.DBhrKb2j.d.cts → attaform.DUc6cetN.d.mts} +37 -1
- package/dist/shared/{attaform.DBhrKb2j.d.ts → attaform.DUc6cetN.d.ts} +37 -1
- package/dist/shared/{attaform.C-1W0T1n.cjs → attaform.DdfLrIgM.cjs} +2 -2
- package/dist/shared/{attaform.C-1W0T1n.cjs.map → attaform.DdfLrIgM.cjs.map} +1 -1
- package/dist/shared/{attaform.Df4xXKbE.d.ts → attaform.DvqdxvNU.d.mts} +3 -2
- package/dist/shared/{attaform.DhXl0Kdr.mjs → attaform.DwCtxauq.mjs} +4 -4
- package/dist/shared/attaform.DwCtxauq.mjs.map +1 -0
- package/dist/shared/{attaform.BunnTiTw.mjs → attaform.K1MbxmIu.mjs} +3 -3
- package/dist/shared/{attaform.CrrIaHM8.cjs.map → attaform.K1MbxmIu.mjs.map} +1 -1
- package/dist/shared/{attaform.BrFPMFgi.d.ts → attaform.yqcYwt0d.d.ts} +10 -1
- package/dist/transforms.cjs +1 -1
- package/dist/transforms.d.cts +4 -1
- package/dist/transforms.d.mts +4 -1
- package/dist/transforms.d.ts +4 -1
- package/dist/transforms.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/zod-v3.cjs +2 -2
- package/dist/zod-v3.d.cts +8 -5
- package/dist/zod-v3.d.mts +8 -5
- package/dist/zod-v3.d.ts +8 -5
- package/dist/zod-v3.mjs +2 -2
- package/dist/zod-v4.cjs +2 -2
- package/dist/zod-v4.d.cts +5 -5
- package/dist/zod-v4.d.mts +5 -5
- package/dist/zod-v4.d.ts +5 -5
- package/dist/zod-v4.mjs +2 -2
- package/dist/zod.cjs +4 -4
- package/dist/zod.cjs.map +1 -1
- package/dist/zod.d.cts +23 -7
- package/dist/zod.d.mts +23 -7
- package/dist/zod.d.ts +23 -7
- package/dist/zod.mjs +4 -4
- package/dist/zod.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/shared/attaform.DRQjF16I.cjs.map +0 -1
- package/dist/shared/attaform.DhXl0Kdr.mjs.map +0 -1
- package/dist/shared/attaform.DwLw3Kzv.cjs.map +0 -1
- package/dist/shared/attaform.NWrEGrNo.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GenericForm, u as FlatPath, O as NestedType, F as FormKey, U as UseFormConfiguration, a as AbstractSchema,
|
|
2
|
+
import { G as GenericForm, u as FlatPath, O as NestedType, F as FormKey, U as UseFormConfiguration, a as AbstractSchema, ar as AcceptableDefaults, af as ValidateOnConfig, b as UseFormReturnType } from './attaform.DUc6cetN.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The shape `form.values.<key>` returns at runtime.
|
|
@@ -223,8 +223,9 @@ type PathOutput<Schema extends z.ZodType, Path extends string> = z.output<Schema
|
|
|
223
223
|
type FormOf<Schema extends SupportedRootSchema> = z.input<Schema> extends GenericForm ? z.input<Schema> : never;
|
|
224
224
|
type OutOf<Schema extends SupportedRootSchema> = z.output<Schema> extends GenericForm ? z.output<Schema> : never;
|
|
225
225
|
type ReadOf<Schema extends SupportedRootSchema> = StorageShape<Schema> extends GenericForm ? StorageShape<Schema> : never;
|
|
226
|
-
declare function useForm<Schema extends SupportedRootSchema, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<FormOf<Schema>, OutOf<Schema>, AbstractSchema<FormOf<Schema>, OutOf<Schema>>,
|
|
226
|
+
declare function useForm<Schema extends SupportedRootSchema, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<FormOf<Schema>, OutOf<Schema>, AbstractSchema<FormOf<Schema>, OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
|
|
227
227
|
schema: Schema;
|
|
228
|
+
defaultValues?: AcceptableDefaults<FormOf<Schema>, z.input<Schema>>;
|
|
228
229
|
} & ValidateOnConfig): UseFormReturnType<FormOf<Schema>, OutOf<Schema>, ReadOf<Schema>, K>;
|
|
229
230
|
|
|
230
231
|
export { useForm as u };
|
|
@@ -916,6 +916,10 @@ function buildContainerFieldStateBase(state, segments, key, formInstanceId) {
|
|
|
916
916
|
pristine = false;
|
|
917
917
|
dirty = true;
|
|
918
918
|
}
|
|
919
|
+
if (!dirty && state.hasRemovedSubtreeUnder(segments)) {
|
|
920
|
+
pristine = false;
|
|
921
|
+
dirty = true;
|
|
922
|
+
}
|
|
919
923
|
const errors = aggregateErrorsAt(state, segments);
|
|
920
924
|
const revealedDescendantError = errors.length > 0 && errors.some((e) => {
|
|
921
925
|
const ePath = e.path;
|
|
@@ -3902,6 +3906,7 @@ function mergeObjectKeys(target, source, path, schema) {
|
|
|
3902
3906
|
return out;
|
|
3903
3907
|
}
|
|
3904
3908
|
|
|
3909
|
+
const isContainer = (value) => Array.isArray(value) || isPlainRecord(value);
|
|
3905
3910
|
function isHydratedFieldRecord(value) {
|
|
3906
3911
|
if (typeof value !== "object" || value === null) return false;
|
|
3907
3912
|
const r = value;
|
|
@@ -4091,6 +4096,7 @@ function createFormStore(options) {
|
|
|
4091
4096
|
const schemaErrors = vue.reactive(/* @__PURE__ */ new Map());
|
|
4092
4097
|
const userErrors = vue.reactive(/* @__PURE__ */ new Map());
|
|
4093
4098
|
const originals = vue.reactive(/* @__PURE__ */ new Map());
|
|
4099
|
+
const removedSubtrees = /* @__PURE__ */ new Set();
|
|
4094
4100
|
const initialTransientList = hydration?.blankPaths ?? options.initialBlankPaths ?? [];
|
|
4095
4101
|
const blankPaths = vue.reactive(/* @__PURE__ */ new Set());
|
|
4096
4102
|
const originalBlankPaths = /* @__PURE__ */ new Set();
|
|
@@ -4576,6 +4582,9 @@ function createFormStore(options) {
|
|
|
4576
4582
|
return true;
|
|
4577
4583
|
}
|
|
4578
4584
|
const oldArrayLength = Array.isArray(currentValue) ? currentValue.length : 0;
|
|
4585
|
+
if (meta?.arrayOp === void 0 && Array.isArray(value) && Array.isArray(currentValue)) {
|
|
4586
|
+
arrayIdentity.realign(path);
|
|
4587
|
+
}
|
|
4579
4588
|
applyTargetedWrite(path, completedValue, meta);
|
|
4580
4589
|
if (meta?.arrayOp !== void 0) {
|
|
4581
4590
|
const remap = remapForOp(meta.arrayOp, oldArrayLength);
|
|
@@ -4588,6 +4597,10 @@ function createFormStore(options) {
|
|
|
4588
4597
|
} else if (Array.isArray(value) && Array.isArray(currentValue)) {
|
|
4589
4598
|
variantMemory.clearUnderPath(path);
|
|
4590
4599
|
arrayIdentity.realign(path);
|
|
4600
|
+
} else if (isContainer(currentValue) && !isContainer(value)) {
|
|
4601
|
+
if (subtreeHadRealBaseline(path, currentValue)) {
|
|
4602
|
+
removedSubtrees.add(paths.canonicalizePath(path).key);
|
|
4603
|
+
}
|
|
4591
4604
|
}
|
|
4592
4605
|
const effectiveModeAfterWrite = meta?.instance?.validateOn ?? fieldValidationMode;
|
|
4593
4606
|
if (effectiveModeAfterWrite === "change") {
|
|
@@ -5121,6 +5134,7 @@ function createFormStore(options) {
|
|
|
5121
5134
|
rebuildAuthoredPaths(resetSource, next);
|
|
5122
5135
|
applyFormReplacement(next);
|
|
5123
5136
|
arrayIdentity.rebaselineAll();
|
|
5137
|
+
removedSubtrees.clear();
|
|
5124
5138
|
originals.clear();
|
|
5125
5139
|
diffAndApply({}, next, [], (patch) => {
|
|
5126
5140
|
if (patch.kind !== "added") return;
|
|
@@ -5257,6 +5271,26 @@ function createFormStore(options) {
|
|
|
5257
5271
|
function hasStructuralChangeUnder(path) {
|
|
5258
5272
|
return arrayIdentity.hasStructuralChangeUnder(path);
|
|
5259
5273
|
}
|
|
5274
|
+
function subtreeHadRealBaseline(prefix, removedValue) {
|
|
5275
|
+
let had = false;
|
|
5276
|
+
diffAndApply(removedValue, void 0, prefix, (patch) => {
|
|
5277
|
+
if (had || patch.kind !== "removed") return;
|
|
5278
|
+
const record = originals.get(paths.canonicalizePath(patch.path).key);
|
|
5279
|
+
if (record?.value !== void 0) had = true;
|
|
5280
|
+
});
|
|
5281
|
+
return had;
|
|
5282
|
+
}
|
|
5283
|
+
function hasRemovedSubtreeUnder(prefix) {
|
|
5284
|
+
if (removedSubtrees.size === 0) return false;
|
|
5285
|
+
for (const key of removedSubtrees) {
|
|
5286
|
+
const segments = paths.segmentsForPathKey(key);
|
|
5287
|
+
if (segments === null) continue;
|
|
5288
|
+
if (!paths.isPathPrefix(prefix, segments)) continue;
|
|
5289
|
+
if (isContainer(getAtPath(vue.toRaw(form.value), segments))) continue;
|
|
5290
|
+
return true;
|
|
5291
|
+
}
|
|
5292
|
+
return false;
|
|
5293
|
+
}
|
|
5260
5294
|
function getFieldRecord(path) {
|
|
5261
5295
|
const { key } = paths.canonicalizePath(path);
|
|
5262
5296
|
return fields.get(key);
|
|
@@ -5352,6 +5386,7 @@ function createFormStore(options) {
|
|
|
5352
5386
|
isPristineAtPath,
|
|
5353
5387
|
isPristineAtPathByKey,
|
|
5354
5388
|
hasStructuralChangeUnder,
|
|
5389
|
+
hasRemovedSubtreeUnder,
|
|
5355
5390
|
getFieldRecord,
|
|
5356
5391
|
getOriginalAtPath,
|
|
5357
5392
|
getFirstErrorElement,
|
|
@@ -7087,4 +7122,4 @@ exports.unset = unset;
|
|
|
7087
7122
|
exports.useAbstractForm = useAbstractForm;
|
|
7088
7123
|
exports.useRegister = useRegister;
|
|
7089
7124
|
exports.useWizard = useWizard;
|
|
7090
|
-
//# sourceMappingURL=attaform.
|
|
7125
|
+
//# sourceMappingURL=attaform.Bos7wVZw.cjs.map
|