attaform 0.27.4 → 0.27.5

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 (70) hide show
  1. package/dist/abstract.cjs +2 -2
  2. package/dist/abstract.d.cts +4 -4
  3. package/dist/abstract.d.mts +4 -4
  4. package/dist/abstract.d.ts +4 -4
  5. package/dist/abstract.mjs +2 -2
  6. package/dist/chunks/devtools.cjs +1 -1
  7. package/dist/chunks/devtools.mjs +1 -1
  8. package/dist/chunks/fingerprint2.cjs +1 -1
  9. package/dist/chunks/fingerprint2.mjs +1 -1
  10. package/dist/index.cjs +3 -3
  11. package/dist/index.d.cts +5 -5
  12. package/dist/index.d.mts +5 -5
  13. package/dist/index.d.ts +5 -5
  14. package/dist/index.mjs +3 -3
  15. package/dist/nuxt.d.cts +1 -1
  16. package/dist/nuxt.d.mts +1 -1
  17. package/dist/nuxt.d.ts +1 -1
  18. package/dist/runtime/plugins/attaform.cjs +1 -1
  19. package/dist/runtime/plugins/attaform.mjs +1 -1
  20. package/dist/shared/{attaform.Cjh6b6xU.d.cts → attaform.B3abZaCV.d.cts} +8 -2
  21. package/dist/shared/{attaform.B3spfqIA.cjs → attaform.Bh8A6YAc.cjs} +4 -4
  22. package/dist/shared/{attaform.B3spfqIA.cjs.map → attaform.Bh8A6YAc.cjs.map} +1 -1
  23. package/dist/shared/{attaform.BBaMFa-k.cjs → attaform.Biytrv0-.cjs} +3 -3
  24. package/dist/shared/{attaform.CgsQZdy1.mjs.map → attaform.Biytrv0-.cjs.map} +1 -1
  25. package/dist/shared/{attaform.CuUx4jWI.mjs → attaform.BypWgXRB.mjs} +51 -8
  26. package/dist/shared/attaform.BypWgXRB.mjs.map +1 -0
  27. package/dist/shared/{attaform.C9arOC5p.cjs → attaform.CF-EnyJn.cjs} +5 -5
  28. package/dist/shared/{attaform.C9arOC5p.cjs.map → attaform.CF-EnyJn.cjs.map} +1 -1
  29. package/dist/shared/{attaform.C8zVmank.d.ts → attaform.CIBMfxg9.d.ts} +1 -1
  30. package/dist/shared/{attaform.gj8dtOlx.d.mts → attaform.CJ1Z9Mz4.d.mts} +8 -2
  31. package/dist/shared/{attaform.a1GnhjVk.mjs → attaform.CTiZ9Rrv.mjs} +3 -3
  32. package/dist/shared/{attaform.a1GnhjVk.mjs.map → attaform.CTiZ9Rrv.mjs.map} +1 -1
  33. package/dist/shared/{attaform.Ib2seKUE.cjs → attaform.Cg1rUfcF.cjs} +51 -8
  34. package/dist/shared/attaform.Cg1rUfcF.cjs.map +1 -0
  35. package/dist/shared/{attaform.BrVzB14N.mjs → attaform.Cg_8gFQ7.mjs} +4 -4
  36. package/dist/shared/{attaform.BrVzB14N.mjs.map → attaform.Cg_8gFQ7.mjs.map} +1 -1
  37. package/dist/shared/{attaform.DXwJVUNS.cjs → attaform.Crv0RNiz.cjs} +4 -4
  38. package/dist/shared/{attaform.DXwJVUNS.cjs.map → attaform.Crv0RNiz.cjs.map} +1 -1
  39. package/dist/shared/{attaform.BIPSHY5U.d.cts → attaform.CzL2CZ8U.d.cts} +8 -1
  40. package/dist/shared/{attaform.BIPSHY5U.d.mts → attaform.CzL2CZ8U.d.mts} +8 -1
  41. package/dist/shared/{attaform.BIPSHY5U.d.ts → attaform.CzL2CZ8U.d.ts} +8 -1
  42. package/dist/shared/{attaform.C925L0WA.d.mts → attaform.DYwyM5Cp.d.cts} +1 -1
  43. package/dist/shared/{attaform.CC4KCx_q.mjs → attaform.Dc1mx48r.mjs} +5 -5
  44. package/dist/shared/{attaform.CC4KCx_q.mjs.map → attaform.Dc1mx48r.mjs.map} +1 -1
  45. package/dist/shared/{attaform.DKtXMaJB.d.ts → attaform.DcFDQVpa.d.ts} +8 -2
  46. package/dist/shared/{attaform.shkNCMEz.mjs → attaform.Dkjh_F30.mjs} +4 -4
  47. package/dist/shared/{attaform.shkNCMEz.mjs.map → attaform.Dkjh_F30.mjs.map} +1 -1
  48. package/dist/shared/{attaform.CnvbLiIO.d.cts → attaform.DrHOqB-d.d.mts} +1 -1
  49. package/dist/shared/{attaform.CX2NHAFs.cjs → attaform.f2zyNh5d.cjs} +3 -3
  50. package/dist/shared/{attaform.CX2NHAFs.cjs.map → attaform.f2zyNh5d.cjs.map} +1 -1
  51. package/dist/shared/{attaform.CgsQZdy1.mjs → attaform.nMaz2C5P.mjs} +3 -3
  52. package/dist/shared/{attaform.BBaMFa-k.cjs.map → attaform.nMaz2C5P.mjs.map} +1 -1
  53. package/dist/zod-v3.cjs +3 -3
  54. package/dist/zod-v3.d.cts +3 -3
  55. package/dist/zod-v3.d.mts +3 -3
  56. package/dist/zod-v3.d.ts +3 -3
  57. package/dist/zod-v3.mjs +3 -3
  58. package/dist/zod-v4.cjs +3 -3
  59. package/dist/zod-v4.d.cts +6 -6
  60. package/dist/zod-v4.d.mts +6 -6
  61. package/dist/zod-v4.d.ts +6 -6
  62. package/dist/zod-v4.mjs +3 -3
  63. package/dist/zod.cjs +3 -3
  64. package/dist/zod.d.cts +3 -3
  65. package/dist/zod.d.mts +3 -3
  66. package/dist/zod.d.ts +3 -3
  67. package/dist/zod.mjs +3 -3
  68. package/package.json +1 -1
  69. package/dist/shared/attaform.CuUx4jWI.mjs.map +0 -1
  70. package/dist/shared/attaform.Ib2seKUE.cjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { computed, ref, watchEffect, getCurrentScope, onScopeDispose, shallowReadonly, nextTick, warn, readonly, toRaw, reactive, toValue, watch, markRaw, triggerRef, shallowRef, getCurrentInstance, onServerPrefetch, provide, useId, inject, onBeforeMount, onBeforeUpdate, onMounted, effectScope } from 'vue';
2
- import { n as pathsEqual, k 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 normalizeErrorInput, w as INTERACTIVE_TAG_NAMES, R as ROOT_PATH, x as normalizeErrorInputs, y as coerceToPathKey, a as InvalidUseFormConfigError, z as ensureAttaformInstalled, u as useRegistry, B as kFormContext, C as kFormInstanceId, d as ReservedFormKeyError, m as kAttaformWizardActiveStepResolver, E as kAttaformAncestorWizard } from './attaform.CgsQZdy1.mjs';
2
+ import { n as pathsEqual, k 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 normalizeErrorInput, w as INTERACTIVE_TAG_NAMES, R as ROOT_PATH, x as normalizeErrorInputs, y as coerceToPathKey, a as InvalidUseFormConfigError, z as ensureAttaformInstalled, u as useRegistry, B as kFormContext, C as kFormInstanceId, d as ReservedFormKeyError, m as kAttaformWizardActiveStepResolver, E as kAttaformAncestorWizard } from './attaform.nMaz2C5P.mjs';
3
3
  import { R as REGISTER_OWNER_MARKER, b as V_REGISTER_MARKER } from './attaform.KvlEedlF.mjs';
4
4
 
5
5
  function safeAssign(target, key, value) {
@@ -2507,8 +2507,8 @@ function buildRegister(state, formInstanceId, instanceConfig) {
2507
2507
  markConnectedOptimistically: () => {
2508
2508
  state.markConnectedOptimistically(segments);
2509
2509
  },
2510
- markHostConnected: (connected) => {
2511
- state.markHostConnected(segments, connected);
2510
+ markHostConnected: (connected, hostEl) => {
2511
+ state.markHostConnected(segments, connected, hostEl, formInstanceId);
2512
2512
  },
2513
2513
  markFocused: (focused) => {
2514
2514
  state.markFocused(
@@ -4066,6 +4066,25 @@ function mergeObjectKeys(target, source, path, schema) {
4066
4066
  }
4067
4067
 
4068
4068
  const isContainer = (value) => Array.isArray(value) || isPlainRecord(value);
4069
+ const HOST_FOCUS_TARGET_SELECTOR = [
4070
+ 'input:not([type="hidden"])',
4071
+ "select",
4072
+ "textarea",
4073
+ "button",
4074
+ "a[href]",
4075
+ '[tabindex]:not([tabindex="-1"])',
4076
+ '[contenteditable="true"]'
4077
+ ].join(", ");
4078
+ function resolveHostFocusTarget(hostRoot) {
4079
+ const candidates = hostRoot.querySelectorAll(HOST_FOCUS_TARGET_SELECTOR);
4080
+ for (const el of candidates) {
4081
+ if (!el.isConnected) continue;
4082
+ if (el.offsetParent === null) continue;
4083
+ if (el.matches(":disabled")) continue;
4084
+ return el;
4085
+ }
4086
+ return hostRoot;
4087
+ }
4069
4088
  function isHydratedFieldRecord(value) {
4070
4089
  if (typeof value !== "object" || value === null) return false;
4071
4090
  const r = value;
@@ -4251,6 +4270,7 @@ function createFormStore(options) {
4251
4270
  const fields = reactive(/* @__PURE__ */ new Map());
4252
4271
  const elements = reactive(/* @__PURE__ */ new Map());
4253
4272
  const elementToFormInstance = /* @__PURE__ */ new WeakMap();
4273
+ const hostTargets = /* @__PURE__ */ new Map();
4254
4274
  let sortedRegistrationsCache = null;
4255
4275
  const schemaErrors = reactive(/* @__PURE__ */ new Map());
4256
4276
  const userErrors = reactive(/* @__PURE__ */ new Map());
@@ -5123,6 +5143,7 @@ function createFormStore(options) {
5123
5143
  record.elements.add(raw);
5124
5144
  }
5125
5145
  elementToFormInstance.set(element, formInstanceId);
5146
+ hostTargets.delete(key);
5126
5147
  sortedRegistrationsCache = null;
5127
5148
  const current = fields.get(key);
5128
5149
  touchFieldRecord(key, path, {
@@ -5160,10 +5181,14 @@ function createFormStore(options) {
5160
5181
  blurred: current?.blurred ?? true
5161
5182
  });
5162
5183
  }
5163
- function markHostConnected(path, connected) {
5184
+ function markHostConnected(path, connected, hostEl, formInstanceId) {
5164
5185
  const { key } = canonicalizePath(path);
5165
5186
  const current = fields.get(key);
5166
5187
  if (connected) {
5188
+ if (!elements.has(key)) {
5189
+ hostTargets.set(key, { path, hostRoot: hostEl, formInstanceId });
5190
+ sortedRegistrationsCache = null;
5191
+ }
5167
5192
  if (current?.connected === true) return;
5168
5193
  touchFieldRecord(key, path, {
5169
5194
  connected: true,
@@ -5171,6 +5196,7 @@ function createFormStore(options) {
5171
5196
  blurred: current?.blurred ?? true
5172
5197
  });
5173
5198
  } else {
5199
+ if (hostTargets.delete(key)) sortedRegistrationsCache = null;
5174
5200
  if (current?.connected !== true) return;
5175
5201
  touchFieldRecord(key, path, { connected: false, focused: null, blurred: null });
5176
5202
  }
@@ -5505,18 +5531,35 @@ function createFormStore(options) {
5505
5531
  function getFirstErrorElement(formInstanceId) {
5506
5532
  sortedRegistrationsCache ?? (sortedRegistrationsCache = rebuildSortedRegistrations());
5507
5533
  for (const entry of sortedRegistrationsCache) {
5508
- if (elementToFormInstance.get(entry.element) !== formInstanceId) continue;
5534
+ if (entry.formInstanceId !== formInstanceId) continue;
5509
5535
  if (!entry.element.isConnected) continue;
5510
5536
  if (entry.element.offsetParent === null) continue;
5511
5537
  if (getErrorsForPath(entry.path).length === 0) continue;
5512
- return { path: entry.path, element: entry.element };
5538
+ const element = entry.host ? resolveHostFocusTarget(entry.element) : entry.element;
5539
+ return { path: entry.path, element };
5513
5540
  }
5514
5541
  return null;
5515
5542
  }
5516
5543
  function rebuildSortedRegistrations() {
5517
5544
  const flat = [];
5518
5545
  for (const [, record] of elements) {
5519
- for (const el of record.elements) flat.push({ path: record.path, element: el });
5546
+ for (const el of record.elements) {
5547
+ flat.push({
5548
+ path: record.path,
5549
+ element: el,
5550
+ host: false,
5551
+ formInstanceId: elementToFormInstance.get(el) ?? ""
5552
+ });
5553
+ }
5554
+ }
5555
+ for (const [key, target] of hostTargets) {
5556
+ if (elements.has(key)) continue;
5557
+ flat.push({
5558
+ path: target.path,
5559
+ element: target.hostRoot,
5560
+ host: true,
5561
+ formInstanceId: target.formInstanceId
5562
+ });
5520
5563
  }
5521
5564
  flat.sort(
5522
5565
  (a, b) => a.element.compareDocumentPosition(b.element) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1
@@ -7589,4 +7632,4 @@ function escapeForInlineScript(json) {
7589
7632
  }
7590
7633
 
7591
7634
  export { AttaformErrorCode as A, DEFAULT_TIMINGS as D, defaultDisplayState as a, defineCoercion as b, injectWizard as c, defaultCoercionRules as d, escapeForInlineScript as e, isUnset as f, gate as g, useAbstractForm as h, injectForm as i, useRegister as j, useWizard as k, lazy as l, makeDefaultDisplayState as m, isPlainRecord as n, safeAssign as o, slimKindOf as p, humanize as q, getAtPath as r, safeOwnRead as s, setAtPath as t, unset as u };
7592
- //# sourceMappingURL=attaform.CuUx4jWI.mjs.map
7635
+ //# sourceMappingURL=attaform.BypWgXRB.mjs.map