attaform 0.24.3 → 0.25.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 (89) hide show
  1. package/dist/chunks/devtools.cjs +1 -1
  2. package/dist/chunks/devtools.mjs +1 -1
  3. package/dist/chunks/fingerprint2.cjs +1 -1
  4. package/dist/chunks/fingerprint2.mjs +1 -1
  5. package/dist/index.cjs +4 -4
  6. package/dist/index.d.cts +4 -4
  7. package/dist/index.d.mts +4 -4
  8. package/dist/index.d.ts +4 -4
  9. package/dist/index.mjs +4 -4
  10. package/dist/nuxt.d.cts +1 -1
  11. package/dist/nuxt.d.mts +1 -1
  12. package/dist/nuxt.d.ts +1 -1
  13. package/dist/runtime/plugins/attaform.cjs +2 -2
  14. package/dist/runtime/plugins/attaform.mjs +2 -2
  15. package/dist/shared/{attaform.DQcdvxKZ.cjs → attaform.3heDHayA.cjs} +146 -3
  16. package/dist/shared/attaform.3heDHayA.cjs.map +1 -0
  17. package/dist/shared/{attaform.yqcYwt0d.d.ts → attaform.8vmdOURQ.d.mts} +124 -56
  18. package/dist/shared/{attaform.BjiHiYAZ.d.ts → attaform.B3cgZE3c.d.ts} +1 -1
  19. package/dist/shared/{attaform.DHjRN5JP.d.cts → attaform.B5GFS3Su.d.cts} +124 -56
  20. package/dist/shared/{attaform.BVjueUPu.cjs → attaform.B5YcWrKi.cjs} +3 -3
  21. package/dist/shared/{attaform.BVjueUPu.cjs.map → attaform.B5YcWrKi.cjs.map} +1 -1
  22. package/dist/shared/{attaform.Bx6pgrIy.d.cts → attaform.BJt4ZCkM.d.mts} +1 -1
  23. package/dist/shared/{attaform.DK6_Ctv7.cjs → attaform.BRzKBj2g.cjs} +182 -7
  24. package/dist/shared/attaform.BRzKBj2g.cjs.map +1 -0
  25. package/dist/shared/{attaform.CB1kYKUB.cjs → attaform.BkUzunyB.cjs} +180 -38
  26. package/dist/shared/attaform.BkUzunyB.cjs.map +1 -0
  27. package/dist/shared/{attaform.Dbzwtn4g.mjs → attaform.CN4ZEGo6.mjs} +4 -4
  28. package/dist/shared/{attaform.Dbzwtn4g.mjs.map → attaform.CN4ZEGo6.mjs.map} +1 -1
  29. package/dist/shared/{attaform.C5qkSN6t.mjs → attaform.CqwcTExO.mjs} +146 -3
  30. package/dist/shared/attaform.CqwcTExO.mjs.map +1 -0
  31. package/dist/shared/{attaform.D4ebpNbS.mjs → attaform.CwXXbZIQ.mjs} +3 -3
  32. package/dist/shared/{attaform.D4ebpNbS.mjs.map → attaform.CwXXbZIQ.mjs.map} +1 -1
  33. package/dist/shared/{attaform.B_F61Rx1.mjs → attaform.DK3xUBkj.mjs} +181 -39
  34. package/dist/shared/attaform.DK3xUBkj.mjs.map +1 -0
  35. package/dist/shared/{attaform.ByIB7i15.mjs → attaform.DMNnfQq_.mjs} +4 -4
  36. package/dist/shared/{attaform.ByIB7i15.mjs.map → attaform.DMNnfQq_.mjs.map} +1 -1
  37. package/dist/shared/{attaform.0zueP54D.d.mts → attaform.DS_zBcdr.d.ts} +124 -56
  38. package/dist/shared/{attaform.DvqdxvNU.d.mts → attaform.DmKLa4tL.d.cts} +1 -1
  39. package/dist/shared/{attaform.DgbHNLf_.mjs → attaform.OLtKd9gM.mjs} +2 -2
  40. package/dist/shared/{attaform.DgbHNLf_.mjs.map → attaform.OLtKd9gM.mjs.map} +1 -1
  41. package/dist/shared/{attaform.WvcckZMD.mjs → attaform.Vp2-CWZB.mjs} +3 -2
  42. package/dist/shared/attaform.Vp2-CWZB.mjs.map +1 -0
  43. package/dist/shared/{attaform.CqlLImc1.cjs → attaform.Xe8dATED.cjs} +4 -4
  44. package/dist/shared/{attaform.CqlLImc1.cjs.map → attaform.Xe8dATED.cjs.map} +1 -1
  45. package/dist/shared/{attaform.CjdepGnw.cjs → attaform.ZXZ6dH72.cjs} +3 -1
  46. package/dist/shared/attaform.ZXZ6dH72.cjs.map +1 -0
  47. package/dist/shared/{attaform.DUc6cetN.d.cts → attaform.i_LA3X9o.d.cts} +54 -2
  48. package/dist/shared/{attaform.DUc6cetN.d.ts → attaform.i_LA3X9o.d.mts} +54 -2
  49. package/dist/shared/{attaform.DUc6cetN.d.mts → attaform.i_LA3X9o.d.ts} +54 -2
  50. package/dist/shared/{attaform.DwCtxauq.mjs → attaform.k9V0py0s.mjs} +182 -8
  51. package/dist/shared/attaform.k9V0py0s.mjs.map +1 -0
  52. package/dist/shared/{attaform.DfnwaGW2.cjs → attaform.sks1MFVO.cjs} +4 -4
  53. package/dist/shared/{attaform.DfnwaGW2.cjs.map → attaform.sks1MFVO.cjs.map} +1 -1
  54. package/dist/shared/{attaform.DRWrVSkH.cjs → attaform.xBDo0Ko0.cjs} +2 -2
  55. package/dist/shared/{attaform.DRWrVSkH.cjs.map → attaform.xBDo0Ko0.cjs.map} +1 -1
  56. package/dist/transforms.cjs +2 -1
  57. package/dist/transforms.cjs.map +1 -1
  58. package/dist/transforms.d.cts +13 -1
  59. package/dist/transforms.d.mts +13 -1
  60. package/dist/transforms.d.ts +13 -1
  61. package/dist/transforms.mjs +1 -1
  62. package/dist/vite.cjs +2 -1
  63. package/dist/vite.cjs.map +1 -1
  64. package/dist/vite.mjs +2 -1
  65. package/dist/vite.mjs.map +1 -1
  66. package/dist/zod-v3.cjs +2 -2
  67. package/dist/zod-v3.d.cts +3 -3
  68. package/dist/zod-v3.d.mts +3 -3
  69. package/dist/zod-v3.d.ts +3 -3
  70. package/dist/zod-v3.mjs +2 -2
  71. package/dist/zod-v4.cjs +2 -2
  72. package/dist/zod-v4.d.cts +5 -5
  73. package/dist/zod-v4.d.mts +5 -5
  74. package/dist/zod-v4.d.ts +5 -5
  75. package/dist/zod-v4.mjs +2 -2
  76. package/dist/zod.cjs +5 -5
  77. package/dist/zod.d.cts +5 -5
  78. package/dist/zod.d.mts +5 -5
  79. package/dist/zod.d.ts +5 -5
  80. package/dist/zod.mjs +5 -5
  81. package/package.json +6 -2
  82. package/dist/shared/attaform.B_F61Rx1.mjs.map +0 -1
  83. package/dist/shared/attaform.C5qkSN6t.mjs.map +0 -1
  84. package/dist/shared/attaform.CB1kYKUB.cjs.map +0 -1
  85. package/dist/shared/attaform.CjdepGnw.cjs.map +0 -1
  86. package/dist/shared/attaform.DK6_Ctv7.cjs.map +0 -1
  87. package/dist/shared/attaform.DQcdvxKZ.cjs.map +0 -1
  88. package/dist/shared/attaform.DwCtxauq.mjs.map +0 -1
  89. package/dist/shared/attaform.WvcckZMD.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { shallowReactive, getCurrentInstance, inject, effectScope, watch, warn, nextTick } from 'vue';
2
- import { i as isRegisterValue, a as isTransforming, S as SSR_COMPONENT_HOST_MODIFIER, R as REGISTER_OWNER_MARKER, V as V_REGISTER_MARKER } from './attaform.WvcckZMD.mjs';
2
+ import { i as isRegisterValue, a as isTransforming, S as SSR_COMPONENT_HOST_MODIFIER, R as REGISTER_OWNER_MARKER, V as V_REGISTER_COMPILED_MODIFIER, b as V_REGISTER_MARKER } from './attaform.Vp2-CWZB.mjs';
3
3
 
4
4
  const __DEV__ = (typeof process !== "undefined" ? process.env.NODE_ENV : "production") !== "production";
5
5
 
@@ -338,6 +338,28 @@ function setupAria(el, rv, vnode) {
338
338
  });
339
339
  el[ariaScopeKey] = () => scope.stop();
340
340
  }
341
+ function seedLocksFromDom(el) {
342
+ let locks = el[ariaLockKey];
343
+ if (locks === void 0) {
344
+ locks = /* @__PURE__ */ new Set();
345
+ el[ariaLockKey] = locks;
346
+ }
347
+ for (const attr of MANAGED_ARIA_ATTRS) {
348
+ if (el.hasAttribute(attr)) locks.add(attr);
349
+ }
350
+ }
351
+ function setupAriaLive(el, rv) {
352
+ if (rv.ariaEnabled !== true || rv.ariaDisplayState === void 0) return;
353
+ if (!INTERACTIVE_TAG_NAMES.has(el.tagName)) return;
354
+ seedLocksFromDom(el);
355
+ applyAria(el, rv, null);
356
+ const displayState = rv.ariaDisplayState;
357
+ const scope = effectScope(true);
358
+ scope.run(() => {
359
+ watch(displayState, () => applyAria(el, rv, null), { flush: "post" });
360
+ });
361
+ el[ariaScopeKey] = () => scope.stop();
362
+ }
341
363
  function getSSRAriaProps(rv, vnode) {
342
364
  if (rv.ariaEnabled !== true || rv.ariaDisplayState === void 0) return void 0;
343
365
  const props = vnode?.props ?? null;
@@ -1178,13 +1200,100 @@ function getCheckboxValue(el, checked) {
1178
1200
  return key in el ? el[key] : checked;
1179
1201
  }
1180
1202
  const warnedUnsupportedElements = __DEV__ ? /* @__PURE__ */ new WeakSet() : null;
1203
+ const warnedRedundantBindings = __DEV__ ? /* @__PURE__ */ new Set() : null;
1204
+ const componentHostLatch = /* @__PURE__ */ new WeakMap();
1205
+ const hostFocusListeners = /* @__PURE__ */ new WeakMap();
1206
+ const hostHealObservers = /* @__PURE__ */ new WeakMap();
1207
+ const SELF_HEAL_MAX_MUTATION_BATCHES = 20;
1208
+ const HOST_CONTROL_SELECTOR = "input:not([type=hidden]), select, textarea";
1209
+ function isLatchableControl(el) {
1210
+ return el.getAttribute("tabindex") !== "-1" && el.getAttribute("aria-hidden") !== "true";
1211
+ }
1212
+ function findHostControl(el) {
1213
+ const descendants = Array.from(el.querySelectorAll(HOST_CONTROL_SELECTOR)).filter(
1214
+ isLatchableControl
1215
+ );
1216
+ return descendants.length === 1 ? descendants[0] : null;
1217
+ }
1218
+ function latchHostControl(el, rv, control) {
1219
+ rv.registerElement(control);
1220
+ setupAriaLive(control, rv);
1221
+ componentHostLatch.set(el, control);
1222
+ }
1223
+ function setupNoLatchHost(el, rv) {
1224
+ rv.markHostConnected(true);
1225
+ const focusin = (event) => {
1226
+ const from = event.relatedTarget;
1227
+ if (from instanceof Node && el.contains(from)) return;
1228
+ rv.markFocused(true);
1229
+ };
1230
+ const focusout = (event) => {
1231
+ const to = event.relatedTarget;
1232
+ if (to instanceof Node && el.contains(to)) return;
1233
+ rv.markFocused(false);
1234
+ };
1235
+ addTrackedListener(el, "focusin", focusin);
1236
+ addTrackedListener(el, "focusout", focusout);
1237
+ hostFocusListeners.set(el, { focusin, focusout });
1238
+ componentHostLatch.set(el, null);
1239
+ }
1240
+ function trySupersedeHostLatch(el, rv) {
1241
+ const control = findHostControl(el);
1242
+ if (control === null) return false;
1243
+ const focusListeners = hostFocusListeners.get(el);
1244
+ if (focusListeners !== void 0) {
1245
+ el.removeEventListener("focusin", focusListeners.focusin);
1246
+ el.removeEventListener("focusout", focusListeners.focusout);
1247
+ hostFocusListeners.delete(el);
1248
+ }
1249
+ latchHostControl(el, rv, control);
1250
+ return true;
1251
+ }
1252
+ function scheduleHostSelfHeal(el, rv) {
1253
+ void nextTick(() => {
1254
+ if (componentHostLatch.get(el) !== null || !el.isConnected) return;
1255
+ if (trySupersedeHostLatch(el, rv)) return;
1256
+ observeForLateHostControl(el, rv);
1257
+ });
1258
+ }
1259
+ function observeForLateHostControl(el, rv) {
1260
+ let batches = 0;
1261
+ const observer = new MutationObserver(() => {
1262
+ const done = componentHostLatch.get(el) !== null || !el.isConnected || trySupersedeHostLatch(el, rv) || ++batches >= SELF_HEAL_MAX_MUTATION_BATCHES;
1263
+ if (done) {
1264
+ observer.disconnect();
1265
+ hostHealObservers.delete(el);
1266
+ }
1267
+ });
1268
+ observer.observe(el, { childList: true, subtree: true });
1269
+ hostHealObservers.set(el, observer);
1270
+ }
1271
+ function activateComponentHost(el, rv) {
1272
+ if (rv.hasRegisteredDescendant(el))
1273
+ return;
1274
+ el[REGISTER_OWNER_MARKER] = true;
1275
+ if (!el.tagName.includes("-")) {
1276
+ el.removeAttribute("registerValue");
1277
+ }
1278
+ const control = findHostControl(el);
1279
+ if (control !== null) {
1280
+ latchHostControl(el, rv, control);
1281
+ return;
1282
+ }
1283
+ setupNoLatchHost(el, rv);
1284
+ scheduleHostSelfHeal(el, rv);
1285
+ }
1181
1286
  const vRegisterDynamic = {
1182
1287
  created(el, binding, vnode) {
1183
1288
  callModelHook(el, binding, vnode, null, "created");
1184
1289
  if (isRegisterValue(binding.value)) setupAria(el, binding.value, vnode);
1290
+ if (__DEV__) warnRedundantStateBinding(el, binding, vnode);
1185
1291
  },
1186
1292
  mounted(el, binding, vnode) {
1187
1293
  callModelHook(el, binding, vnode, null, "mounted");
1294
+ if (binding.modifiers[SSR_COMPONENT_HOST_MODIFIER] === true && isRegisterValue(binding.value)) {
1295
+ activateComponentHost(el, binding.value);
1296
+ }
1188
1297
  if (__DEV__ && warnedUnsupportedElements !== null && !INTERACTIVE_TAG_NAMES.has(el.tagName) && !warnedUnsupportedElements.has(el)) {
1189
1298
  void nextTick(() => {
1190
1299
  if (warnedUnsupportedElements.has(el)) return;
@@ -1228,6 +1337,19 @@ const vRegisterDynamic = {
1228
1337
  teardownValueSync(el);
1229
1338
  if (!isRegisterValue(value)) return;
1230
1339
  value.deregisterElement(el);
1340
+ if (componentHostLatch.has(el)) {
1341
+ const healObserver = hostHealObservers.get(el);
1342
+ if (healObserver !== void 0) {
1343
+ healObserver.disconnect();
1344
+ hostHealObservers.delete(el);
1345
+ }
1346
+ const latchedControl = componentHostLatch.get(el);
1347
+ if (latchedControl != null) {
1348
+ teardownAria(latchedControl);
1349
+ value.deregisterElement(latchedControl);
1350
+ } else value.markHostConnected(false);
1351
+ componentHostLatch.delete(el);
1352
+ }
1231
1353
  delete el.composing;
1232
1354
  delete el._assigning;
1233
1355
  delete el._syncFromStorage;
@@ -1249,7 +1371,7 @@ const vRegisterDynamic = {
1249
1371
  const isComponentHostModifier = modifiers?.[SSR_COMPONENT_HOST_MODIFIER] === true;
1250
1372
  const suppressHostAria = isComponentHostModifier || realVnode !== null && !isInteractiveElementVnode;
1251
1373
  const ariaProps = suppressHostAria ? void 0 : getSSRAriaProps(rv, realVnode);
1252
- const formStateProps = realVnode !== null ? getSSRFormStateProps(rv, realVnode) : void 0;
1374
+ const formStateProps = realVnode !== null && !isComponentHostModifier ? getSSRFormStateProps(rv, realVnode) : void 0;
1253
1375
  if (ariaProps === void 0 && formStateProps === void 0) return void 0;
1254
1376
  return { ...ariaProps, ...formStateProps };
1255
1377
  }
@@ -1263,6 +1385,27 @@ function resolveDynamicModel(tagName, type) {
1263
1385
  if (type === "radio") return vRegisterRadio;
1264
1386
  return vRegisterText;
1265
1387
  }
1388
+ function warnRedundantStateBinding(el, binding, vnode) {
1389
+ if (warnedRedundantBindings === null) return;
1390
+ if (!INTERACTIVE_TAG_NAMES.has(el.tagName)) return;
1391
+ if (binding.modifiers[V_REGISTER_COMPILED_MODIFIER] === true) return;
1392
+ const props = vnode.props;
1393
+ if (props == null) return;
1394
+ const variant = resolveDynamicModel(el.tagName, props["type"]);
1395
+ if (variant === vRegisterFile) return;
1396
+ const hasVModel = "onUpdate:modelValue" in props;
1397
+ const stateAttr = variant === vRegisterCheckbox || variant === vRegisterRadio ? "checked" : "value";
1398
+ const hasStateAttr = stateAttr in props;
1399
+ if (!hasVModel && !hasStateAttr) return;
1400
+ const tag = el.tagName.toLowerCase();
1401
+ const redundant = hasVModel ? "v-model" : `:${stateAttr}`;
1402
+ const signature = `${tag}:${String(props["type"] ?? "")}:${redundant}`;
1403
+ if (warnedRedundantBindings.has(signature)) return;
1404
+ warnedRedundantBindings.add(signature);
1405
+ warn(
1406
+ `[attaform] \`${redundant}\` is redundant beside v-register on <${tag}>. v-register already drives this field's value, so keep v-register alone and drop \`${redundant}\`. (An identity \`:value\` on a radio or <option> is expected and stays silent.)`
1407
+ );
1408
+ }
1266
1409
  function ssrCheckboxProps(rv, props) {
1267
1410
  const model = rv.innerRef.value;
1268
1411
  const optionValue = props?.["value"];
@@ -1450,4 +1593,4 @@ function pathsEqual(a, b) {
1450
1593
  }
1451
1594
 
1452
1595
  export { AttaformError as A, InvalidPathError as I, OutsideSetupError as O, ROOT_PATH as R, SubmitErrorHandlerError as S, __DEV__ as _, InvalidUseFormConfigError as a, ROOT_PATH_KEY as b, RegistryNotInstalledError as c, ReservedFormKeyError as d, assignKey as e, canonicalizePath as f, createAttaform as g, createRegistry as h, getRegistryFromApp as i, isPathPrefix as j, kAttaformRegistry as k, kAttaformWizardActiveStepResolver as l, pathKeyToDotted as m, pathsEqual as n, keyForSegments as o, parseDottedPath as p, INTERACTIVE_TAG_NAMES as q, coerceToPathKey as r, segmentsForPathKey as s, toError as t, useRegistry as u, vRegister as v, ensureAttaformInstalled as w, kFormContext as x, kFormInstanceId as y, kAttaformAncestorWizard as z };
1453
- //# sourceMappingURL=attaform.C5qkSN6t.mjs.map
1596
+ //# sourceMappingURL=attaform.CqwcTExO.mjs.map