attaform 0.24.2 → 0.24.4

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 (82) hide show
  1. package/README.md +27 -122
  2. package/dist/chunks/devtools.cjs +1 -1
  3. package/dist/chunks/devtools.mjs +1 -1
  4. package/dist/chunks/fingerprint2.cjs +1 -1
  5. package/dist/chunks/fingerprint2.mjs +1 -1
  6. package/dist/index.cjs +3 -3
  7. package/dist/index.d.cts +4 -4
  8. package/dist/index.d.mts +4 -4
  9. package/dist/index.d.ts +4 -4
  10. package/dist/index.mjs +3 -3
  11. package/dist/nuxt.cjs +1 -1
  12. package/dist/nuxt.cjs.map +1 -1
  13. package/dist/nuxt.d.cts +1 -1
  14. package/dist/nuxt.d.mts +1 -1
  15. package/dist/nuxt.d.ts +1 -1
  16. package/dist/nuxt.mjs +1 -1
  17. package/dist/nuxt.mjs.map +1 -1
  18. package/dist/runtime/plugins/attaform.cjs +2 -2
  19. package/dist/runtime/plugins/attaform.mjs +2 -2
  20. package/dist/shared/{attaform.BOi6n2Pn.cjs → attaform.AkX9wzfY.cjs} +2 -2
  21. package/dist/shared/{attaform.BOi6n2Pn.cjs.map → attaform.AkX9wzfY.cjs.map} +1 -1
  22. package/dist/shared/{attaform.yqcYwt0d.d.ts → attaform.B1N47eDM.d.ts} +9 -1
  23. package/dist/shared/{attaform.D-gYGj5z.cjs → attaform.Bnm0FQaH.cjs} +4 -4
  24. package/dist/shared/{attaform.D-gYGj5z.cjs.map → attaform.Bnm0FQaH.cjs.map} +1 -1
  25. package/dist/shared/{attaform.Bos7wVZw.cjs → attaform.Buedl_UL.cjs} +66 -2
  26. package/dist/shared/attaform.Buedl_UL.cjs.map +1 -0
  27. package/dist/shared/{attaform.B7UdTs_o.cjs → attaform.CAVK56f8.cjs} +123 -3
  28. package/dist/shared/attaform.CAVK56f8.cjs.map +1 -0
  29. package/dist/shared/{attaform.DdfLrIgM.cjs → attaform.CBMI57RP.cjs} +3 -3
  30. package/dist/shared/{attaform.DdfLrIgM.cjs.map → attaform.CBMI57RP.cjs.map} +1 -1
  31. package/dist/shared/{attaform.B57G7ePY.cjs → attaform.CE-KJZ0j.cjs} +4 -4
  32. package/dist/shared/{attaform.B57G7ePY.cjs.map → attaform.CE-KJZ0j.cjs.map} +1 -1
  33. package/dist/shared/{attaform.0-00cYGw.mjs → attaform.CZpUm-2l.mjs} +2 -2
  34. package/dist/shared/{attaform.0-00cYGw.mjs.map → attaform.CZpUm-2l.mjs.map} +1 -1
  35. package/dist/shared/{attaform.K1MbxmIu.mjs → attaform.ChY7tIrn.mjs} +4 -4
  36. package/dist/shared/{attaform.K1MbxmIu.mjs.map → attaform.ChY7tIrn.mjs.map} +1 -1
  37. package/dist/shared/{attaform.0zueP54D.d.mts → attaform.CqW4gF_Z.d.cts} +9 -1
  38. package/dist/shared/{attaform.B_-nZHtM.mjs → attaform.CwqTCeTZ.mjs} +4 -4
  39. package/dist/shared/{attaform.B_-nZHtM.mjs.map → attaform.CwqTCeTZ.mjs.map} +1 -1
  40. package/dist/shared/{attaform.DvqdxvNU.d.mts → attaform.DTn1J0Eq.d.mts} +1 -1
  41. package/dist/shared/{attaform.DK6_Ctv7.cjs → attaform.DWKcw1ud.cjs} +82 -4
  42. package/dist/shared/attaform.DWKcw1ud.cjs.map +1 -0
  43. package/dist/shared/{attaform.C0au8oXd.mjs → attaform.DwsfkfSY.mjs} +123 -3
  44. package/dist/shared/attaform.DwsfkfSY.mjs.map +1 -0
  45. package/dist/shared/{attaform.BjiHiYAZ.d.ts → attaform.EeVCVnoH.d.ts} +1 -1
  46. package/dist/shared/{attaform.Bx6pgrIy.d.cts → attaform.Ib7oSpxj.d.cts} +1 -1
  47. package/dist/shared/{attaform.DUc6cetN.d.mts → attaform.QFrCtJBO.d.cts} +38 -0
  48. package/dist/shared/{attaform.DUc6cetN.d.cts → attaform.QFrCtJBO.d.mts} +38 -0
  49. package/dist/shared/{attaform.DUc6cetN.d.ts → attaform.QFrCtJBO.d.ts} +38 -0
  50. package/dist/shared/{attaform.DwCtxauq.mjs → attaform.QwLSdxuk.mjs} +82 -4
  51. package/dist/shared/attaform.QwLSdxuk.mjs.map +1 -0
  52. package/dist/shared/{attaform.DHjRN5JP.d.cts → attaform.f0l5ydy1.d.mts} +9 -1
  53. package/dist/shared/{attaform.BI7M3wK8.mjs → attaform.iJ4y3sHU.mjs} +67 -3
  54. package/dist/shared/attaform.iJ4y3sHU.mjs.map +1 -0
  55. package/dist/shared/{attaform.BjUaX7s8.mjs → attaform.lcTiMoma.mjs} +3 -3
  56. package/dist/shared/{attaform.BjUaX7s8.mjs.map → attaform.lcTiMoma.mjs.map} +1 -1
  57. package/dist/transforms.cjs +1 -1
  58. package/dist/transforms.mjs +1 -1
  59. package/dist/vite.cjs +1 -1
  60. package/dist/vite.mjs +1 -1
  61. package/dist/zod-v3.cjs +2 -2
  62. package/dist/zod-v3.d.cts +3 -3
  63. package/dist/zod-v3.d.mts +3 -3
  64. package/dist/zod-v3.d.ts +3 -3
  65. package/dist/zod-v3.mjs +2 -2
  66. package/dist/zod-v4.cjs +2 -2
  67. package/dist/zod-v4.d.cts +5 -5
  68. package/dist/zod-v4.d.mts +5 -5
  69. package/dist/zod-v4.d.ts +5 -5
  70. package/dist/zod-v4.mjs +2 -2
  71. package/dist/zod.cjs +5 -5
  72. package/dist/zod.d.cts +5 -5
  73. package/dist/zod.d.mts +5 -5
  74. package/dist/zod.d.ts +5 -5
  75. package/dist/zod.mjs +5 -5
  76. package/package.json +7 -3
  77. package/dist/shared/attaform.B7UdTs_o.cjs.map +0 -1
  78. package/dist/shared/attaform.BI7M3wK8.mjs.map +0 -1
  79. package/dist/shared/attaform.Bos7wVZw.cjs.map +0 -1
  80. package/dist/shared/attaform.C0au8oXd.mjs.map +0 -1
  81. package/dist/shared/attaform.DK6_Ctv7.cjs.map +0 -1
  82. package/dist/shared/attaform.DwCtxauq.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
- import { computed, ref, watchEffect, getCurrentScope, onScopeDispose, shallowReadonly, readonly, toRaw, reactive, watch, markRaw, triggerRef, shallowRef, getCurrentInstance, onServerPrefetch, provide, useId, inject, onBeforeMount, onBeforeUpdate, onMounted, effectScope, nextTick } from 'vue';
2
- import { n as pathsEqual, j as isPathPrefix, _ as __DEV__, f as canonicalizePath, s as segmentsForPathKey, o as keyForSegments, b as ROOT_PATH_KEY, S as SubmitErrorHandlerError, t as toError, q as INTERACTIVE_TAG_NAMES, R as ROOT_PATH, r as coerceToPathKey, a as InvalidUseFormConfigError, w as ensureAttaformInstalled, u as useRegistry, x as kFormContext, y as kFormInstanceId, d as ReservedFormKeyError, l as kAttaformWizardActiveStepResolver, z as kAttaformAncestorWizard } from './attaform.C0au8oXd.mjs';
1
+ import { computed, ref, watchEffect, getCurrentScope, onScopeDispose, shallowReadonly, nextTick, warn, readonly, toRaw, reactive, watch, markRaw, triggerRef, shallowRef, getCurrentInstance, onServerPrefetch, provide, useId, inject, onBeforeMount, onBeforeUpdate, onMounted, effectScope } from 'vue';
2
+ import { n as pathsEqual, j as isPathPrefix, _ as __DEV__, f as canonicalizePath, s as segmentsForPathKey, o as keyForSegments, b as ROOT_PATH_KEY, S as SubmitErrorHandlerError, t as toError, q as INTERACTIVE_TAG_NAMES, R as ROOT_PATH, r as coerceToPathKey, a as InvalidUseFormConfigError, w as ensureAttaformInstalled, u as useRegistry, x as kFormContext, y as kFormInstanceId, d as ReservedFormKeyError, l as kAttaformWizardActiveStepResolver, z as kAttaformAncestorWizard } from './attaform.DwsfkfSY.mjs';
3
3
  import { R as REGISTER_OWNER_MARKER, V as V_REGISTER_MARKER } from './attaform.WvcckZMD.mjs';
4
4
 
5
5
  function safeAssign(target, key, value) {
@@ -939,6 +939,15 @@ function buildContainerFieldStateBase(state, segments, key, formInstanceId) {
939
939
  if (since !== void 0 && (transformingSince === null || since < transformingSince))
940
940
  transformingSince = since;
941
941
  }
942
+ const ownRecord = state.fields.get(key);
943
+ if (ownRecord !== void 0) {
944
+ if (ownRecord.focused === true) focused = true;
945
+ if (ownRecord.blurred === true) blurred = true;
946
+ if (ownRecord.touched === true) touched = true;
947
+ if (ownRecord.interacted === true) interacted = true;
948
+ if (ownRecord.blurredAfterInteraction === true) blurredAfterInteraction = true;
949
+ if (ownRecord.connected === true) connected = true;
950
+ }
942
951
  const ownTransformError = state.transformErrors.get(key) ?? null;
943
952
  const gated = asyncPending && !state.firstValidationDone.value;
944
953
  const valid = !gated && errors.length === 0 && !validating;
@@ -2284,6 +2293,7 @@ function coerceValue(value, accepted, elementAccepted, index) {
2284
2293
  return coerceScalar(value, accepted, index);
2285
2294
  }
2286
2295
 
2296
+ const warnedMultiRootHosts = /* @__PURE__ */ new Set();
2287
2297
  const EMPTY_TRANSFORMS = Object.freeze([]);
2288
2298
  const attaformListenersSymbol = Symbol.for("attaform:focus-listeners");
2289
2299
  function attachFocusListeners(state, segments, element, instanceMeta) {
@@ -2388,6 +2398,24 @@ function buildRegister(state, formInstanceId, instanceConfig) {
2388
2398
  setValueWithInternalPath: (value, meta) => {
2389
2399
  return state.setValueAtPath(segments, value, withInstanceMeta(meta));
2390
2400
  },
2401
+ setValueFromHost: (value) => {
2402
+ state.markInteracted(segments);
2403
+ const accepted = state.setValueAtPath(segments, value, withInstanceMeta(void 0));
2404
+ if (__DEV__) {
2405
+ const dedupeKey = `${formInstanceId}:${pathKey}`;
2406
+ const isWired = () => (state.elements.get(pathKey)?.elements.size ?? 0) > 0 || state.getFieldRecord(segments)?.connected === true;
2407
+ if (!warnedMultiRootHosts.has(dedupeKey) && !isWired()) {
2408
+ warnedMultiRootHosts.add(dedupeKey);
2409
+ void nextTick(() => {
2410
+ if (isWired()) return;
2411
+ warn(
2412
+ `[attaform] v-register received a value update from a component it never attached to. Vue drops a runtime directive on a component with more than one root node (a fragment / multi-root template), so v-register's value binding works but its field state (connected, focus, aria, scroll-to-error) does not. Give the component a single element root, or wrap it so v-register lands on one element.`
2413
+ );
2414
+ });
2415
+ }
2416
+ }
2417
+ return accepted;
2418
+ },
2391
2419
  // Called by the `vRegisterHint` compile-time transform's wrapping
2392
2420
  // IIFE on every server-side render of `<element v-register="…">`.
2393
2421
  // Without it, every SSR'd FieldState serialises `connected: false`
@@ -2399,6 +2427,24 @@ function buildRegister(state, formInstanceId, instanceConfig) {
2399
2427
  markConnectedOptimistically: () => {
2400
2428
  state.markConnectedOptimistically(segments);
2401
2429
  },
2430
+ markHostConnected: (connected) => {
2431
+ state.markHostConnected(segments, connected);
2432
+ },
2433
+ markFocused: (focused) => {
2434
+ state.markFocused(
2435
+ segments,
2436
+ focused,
2437
+ instanceMeta !== void 0 ? { instance: instanceMeta } : void 0
2438
+ );
2439
+ },
2440
+ hasRegisteredDescendant: (hostElement) => {
2441
+ const record = state.elements.get(pathKey);
2442
+ if (record === void 0) return false;
2443
+ for (const element of record.elements) {
2444
+ if (hostElement.contains(element)) return true;
2445
+ }
2446
+ return false;
2447
+ },
2402
2448
  // --- Async transform lifecycle (internal; the directive's
2403
2449
  // deferred orchestrator is the only legitimate consumer). Thin
2404
2450
  // path-bound delegates to the store's per-path token / counter
@@ -4972,6 +5018,21 @@ function createFormStore(options) {
4972
5018
  blurred: current?.blurred ?? true
4973
5019
  });
4974
5020
  }
5021
+ function markHostConnected(path, connected) {
5022
+ const { key } = canonicalizePath(path);
5023
+ const current = fields.get(key);
5024
+ if (connected) {
5025
+ if (current?.connected === true) return;
5026
+ touchFieldRecord(key, path, {
5027
+ connected: true,
5028
+ focused: current?.focused ?? false,
5029
+ blurred: current?.blurred ?? true
5030
+ });
5031
+ } else {
5032
+ if (current?.connected !== true) return;
5033
+ touchFieldRecord(key, path, { connected: false, focused: null, blurred: null });
5034
+ }
5035
+ }
4975
5036
  function markFocused(path, focused, meta) {
4976
5037
  const { key } = canonicalizePath(path);
4977
5038
  const current = fields.get(key);
@@ -5381,6 +5442,7 @@ function createFormStore(options) {
5381
5442
  markInteracted,
5382
5443
  touchAtPath,
5383
5444
  markConnectedOptimistically,
5445
+ markHostConnected,
5384
5446
  isPristineAtPath,
5385
5447
  isPristineAtPathByKey,
5386
5448
  hasStructuralChangeUnder,
@@ -5979,6 +6041,8 @@ function useRegister() {
5979
6041
  }
5980
6042
  }
5981
6043
  if ("value" in rawAttrs) delete rawAttrs["value"];
6044
+ if ("modelValue" in rawAttrs) delete rawAttrs["modelValue"];
6045
+ if ("onUpdate:modelValue" in rawAttrs) delete rawAttrs["onUpdate:modelValue"];
5982
6046
  };
5983
6047
  refreshAndStripBridgeAttrs();
5984
6048
  onBeforeMount(refreshAndStripBridgeAttrs);
@@ -7100,4 +7164,4 @@ function warnIfAmbientWizardProviderHadDuplicates() {
7100
7164
  }
7101
7165
 
7102
7166
  export { AttaformErrorCode as A, DEFAULT_TIMINGS as D, injectWizard as a, isUnset as b, useRegister as c, useWizard as d, defaultCoercionRules as e, defaultDisplayState as f, defineCoercion as g, useAbstractForm as h, injectForm as i, isPlainRecord as j, safeAssign as k, lazy as l, makeDefaultDisplayState as m, slimKindOf as n, humanize as o, getAtPath as p, setAtPath as q, safeOwnRead as s, unset as u };
7103
- //# sourceMappingURL=attaform.BI7M3wK8.mjs.map
7167
+ //# sourceMappingURL=attaform.iJ4y3sHU.mjs.map