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.
- package/dist/abstract.cjs +2 -2
- package/dist/abstract.d.cts +4 -4
- package/dist/abstract.d.mts +4 -4
- package/dist/abstract.d.ts +4 -4
- package/dist/abstract.mjs +2 -2
- package/dist/chunks/devtools.cjs +1 -1
- package/dist/chunks/devtools.mjs +1 -1
- package/dist/chunks/fingerprint2.cjs +1 -1
- package/dist/chunks/fingerprint2.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +3 -3
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/runtime/plugins/attaform.cjs +1 -1
- package/dist/runtime/plugins/attaform.mjs +1 -1
- package/dist/shared/{attaform.Cjh6b6xU.d.cts → attaform.B3abZaCV.d.cts} +8 -2
- package/dist/shared/{attaform.B3spfqIA.cjs → attaform.Bh8A6YAc.cjs} +4 -4
- package/dist/shared/{attaform.B3spfqIA.cjs.map → attaform.Bh8A6YAc.cjs.map} +1 -1
- package/dist/shared/{attaform.BBaMFa-k.cjs → attaform.Biytrv0-.cjs} +3 -3
- package/dist/shared/{attaform.CgsQZdy1.mjs.map → attaform.Biytrv0-.cjs.map} +1 -1
- package/dist/shared/{attaform.CuUx4jWI.mjs → attaform.BypWgXRB.mjs} +51 -8
- package/dist/shared/attaform.BypWgXRB.mjs.map +1 -0
- package/dist/shared/{attaform.C9arOC5p.cjs → attaform.CF-EnyJn.cjs} +5 -5
- package/dist/shared/{attaform.C9arOC5p.cjs.map → attaform.CF-EnyJn.cjs.map} +1 -1
- package/dist/shared/{attaform.C8zVmank.d.ts → attaform.CIBMfxg9.d.ts} +1 -1
- package/dist/shared/{attaform.gj8dtOlx.d.mts → attaform.CJ1Z9Mz4.d.mts} +8 -2
- package/dist/shared/{attaform.a1GnhjVk.mjs → attaform.CTiZ9Rrv.mjs} +3 -3
- package/dist/shared/{attaform.a1GnhjVk.mjs.map → attaform.CTiZ9Rrv.mjs.map} +1 -1
- package/dist/shared/{attaform.Ib2seKUE.cjs → attaform.Cg1rUfcF.cjs} +51 -8
- package/dist/shared/attaform.Cg1rUfcF.cjs.map +1 -0
- package/dist/shared/{attaform.BrVzB14N.mjs → attaform.Cg_8gFQ7.mjs} +4 -4
- package/dist/shared/{attaform.BrVzB14N.mjs.map → attaform.Cg_8gFQ7.mjs.map} +1 -1
- package/dist/shared/{attaform.DXwJVUNS.cjs → attaform.Crv0RNiz.cjs} +4 -4
- package/dist/shared/{attaform.DXwJVUNS.cjs.map → attaform.Crv0RNiz.cjs.map} +1 -1
- package/dist/shared/{attaform.BIPSHY5U.d.cts → attaform.CzL2CZ8U.d.cts} +8 -1
- package/dist/shared/{attaform.BIPSHY5U.d.mts → attaform.CzL2CZ8U.d.mts} +8 -1
- package/dist/shared/{attaform.BIPSHY5U.d.ts → attaform.CzL2CZ8U.d.ts} +8 -1
- package/dist/shared/{attaform.C925L0WA.d.mts → attaform.DYwyM5Cp.d.cts} +1 -1
- package/dist/shared/{attaform.CC4KCx_q.mjs → attaform.Dc1mx48r.mjs} +5 -5
- package/dist/shared/{attaform.CC4KCx_q.mjs.map → attaform.Dc1mx48r.mjs.map} +1 -1
- package/dist/shared/{attaform.DKtXMaJB.d.ts → attaform.DcFDQVpa.d.ts} +8 -2
- package/dist/shared/{attaform.shkNCMEz.mjs → attaform.Dkjh_F30.mjs} +4 -4
- package/dist/shared/{attaform.shkNCMEz.mjs.map → attaform.Dkjh_F30.mjs.map} +1 -1
- package/dist/shared/{attaform.CnvbLiIO.d.cts → attaform.DrHOqB-d.d.mts} +1 -1
- package/dist/shared/{attaform.CX2NHAFs.cjs → attaform.f2zyNh5d.cjs} +3 -3
- package/dist/shared/{attaform.CX2NHAFs.cjs.map → attaform.f2zyNh5d.cjs.map} +1 -1
- package/dist/shared/{attaform.CgsQZdy1.mjs → attaform.nMaz2C5P.mjs} +3 -3
- package/dist/shared/{attaform.BBaMFa-k.cjs.map → attaform.nMaz2C5P.mjs.map} +1 -1
- package/dist/zod-v3.cjs +3 -3
- package/dist/zod-v3.d.cts +3 -3
- package/dist/zod-v3.d.mts +3 -3
- package/dist/zod-v3.d.ts +3 -3
- package/dist/zod-v3.mjs +3 -3
- package/dist/zod-v4.cjs +3 -3
- package/dist/zod-v4.d.cts +6 -6
- package/dist/zod-v4.d.mts +6 -6
- package/dist/zod-v4.d.ts +6 -6
- package/dist/zod-v4.mjs +3 -3
- package/dist/zod.cjs +3 -3
- package/dist/zod.d.cts +3 -3
- package/dist/zod.d.mts +3 -3
- package/dist/zod.d.ts +3 -3
- package/dist/zod.mjs +3 -3
- package/package.json +1 -1
- package/dist/shared/attaform.CuUx4jWI.mjs.map +0 -1
- package/dist/shared/attaform.Ib2seKUE.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const vue = require('vue');
|
|
4
|
-
const devtoolsShared = require('./attaform.
|
|
4
|
+
const devtoolsShared = require('./attaform.Biytrv0-.cjs');
|
|
5
5
|
const registerProtocol = require('./attaform.yUrz7C2z.cjs');
|
|
6
6
|
|
|
7
7
|
function safeAssign(target, key, value) {
|
|
@@ -2509,8 +2509,8 @@ function buildRegister(state, formInstanceId, instanceConfig) {
|
|
|
2509
2509
|
markConnectedOptimistically: () => {
|
|
2510
2510
|
state.markConnectedOptimistically(segments);
|
|
2511
2511
|
},
|
|
2512
|
-
markHostConnected: (connected) => {
|
|
2513
|
-
state.markHostConnected(segments, connected);
|
|
2512
|
+
markHostConnected: (connected, hostEl) => {
|
|
2513
|
+
state.markHostConnected(segments, connected, hostEl, formInstanceId);
|
|
2514
2514
|
},
|
|
2515
2515
|
markFocused: (focused) => {
|
|
2516
2516
|
state.markFocused(
|
|
@@ -4068,6 +4068,25 @@ function mergeObjectKeys(target, source, path, schema) {
|
|
|
4068
4068
|
}
|
|
4069
4069
|
|
|
4070
4070
|
const isContainer = (value) => Array.isArray(value) || isPlainRecord(value);
|
|
4071
|
+
const HOST_FOCUS_TARGET_SELECTOR = [
|
|
4072
|
+
'input:not([type="hidden"])',
|
|
4073
|
+
"select",
|
|
4074
|
+
"textarea",
|
|
4075
|
+
"button",
|
|
4076
|
+
"a[href]",
|
|
4077
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
4078
|
+
'[contenteditable="true"]'
|
|
4079
|
+
].join(", ");
|
|
4080
|
+
function resolveHostFocusTarget(hostRoot) {
|
|
4081
|
+
const candidates = hostRoot.querySelectorAll(HOST_FOCUS_TARGET_SELECTOR);
|
|
4082
|
+
for (const el of candidates) {
|
|
4083
|
+
if (!el.isConnected) continue;
|
|
4084
|
+
if (el.offsetParent === null) continue;
|
|
4085
|
+
if (el.matches(":disabled")) continue;
|
|
4086
|
+
return el;
|
|
4087
|
+
}
|
|
4088
|
+
return hostRoot;
|
|
4089
|
+
}
|
|
4071
4090
|
function isHydratedFieldRecord(value) {
|
|
4072
4091
|
if (typeof value !== "object" || value === null) return false;
|
|
4073
4092
|
const r = value;
|
|
@@ -4253,6 +4272,7 @@ function createFormStore(options) {
|
|
|
4253
4272
|
const fields = vue.reactive(/* @__PURE__ */ new Map());
|
|
4254
4273
|
const elements = vue.reactive(/* @__PURE__ */ new Map());
|
|
4255
4274
|
const elementToFormInstance = /* @__PURE__ */ new WeakMap();
|
|
4275
|
+
const hostTargets = /* @__PURE__ */ new Map();
|
|
4256
4276
|
let sortedRegistrationsCache = null;
|
|
4257
4277
|
const schemaErrors = vue.reactive(/* @__PURE__ */ new Map());
|
|
4258
4278
|
const userErrors = vue.reactive(/* @__PURE__ */ new Map());
|
|
@@ -5125,6 +5145,7 @@ function createFormStore(options) {
|
|
|
5125
5145
|
record.elements.add(raw);
|
|
5126
5146
|
}
|
|
5127
5147
|
elementToFormInstance.set(element, formInstanceId);
|
|
5148
|
+
hostTargets.delete(key);
|
|
5128
5149
|
sortedRegistrationsCache = null;
|
|
5129
5150
|
const current = fields.get(key);
|
|
5130
5151
|
touchFieldRecord(key, path, {
|
|
@@ -5162,10 +5183,14 @@ function createFormStore(options) {
|
|
|
5162
5183
|
blurred: current?.blurred ?? true
|
|
5163
5184
|
});
|
|
5164
5185
|
}
|
|
5165
|
-
function markHostConnected(path, connected) {
|
|
5186
|
+
function markHostConnected(path, connected, hostEl, formInstanceId) {
|
|
5166
5187
|
const { key } = devtoolsShared.canonicalizePath(path);
|
|
5167
5188
|
const current = fields.get(key);
|
|
5168
5189
|
if (connected) {
|
|
5190
|
+
if (!elements.has(key)) {
|
|
5191
|
+
hostTargets.set(key, { path, hostRoot: hostEl, formInstanceId });
|
|
5192
|
+
sortedRegistrationsCache = null;
|
|
5193
|
+
}
|
|
5169
5194
|
if (current?.connected === true) return;
|
|
5170
5195
|
touchFieldRecord(key, path, {
|
|
5171
5196
|
connected: true,
|
|
@@ -5173,6 +5198,7 @@ function createFormStore(options) {
|
|
|
5173
5198
|
blurred: current?.blurred ?? true
|
|
5174
5199
|
});
|
|
5175
5200
|
} else {
|
|
5201
|
+
if (hostTargets.delete(key)) sortedRegistrationsCache = null;
|
|
5176
5202
|
if (current?.connected !== true) return;
|
|
5177
5203
|
touchFieldRecord(key, path, { connected: false, focused: null, blurred: null });
|
|
5178
5204
|
}
|
|
@@ -5507,18 +5533,35 @@ function createFormStore(options) {
|
|
|
5507
5533
|
function getFirstErrorElement(formInstanceId) {
|
|
5508
5534
|
sortedRegistrationsCache ?? (sortedRegistrationsCache = rebuildSortedRegistrations());
|
|
5509
5535
|
for (const entry of sortedRegistrationsCache) {
|
|
5510
|
-
if (
|
|
5536
|
+
if (entry.formInstanceId !== formInstanceId) continue;
|
|
5511
5537
|
if (!entry.element.isConnected) continue;
|
|
5512
5538
|
if (entry.element.offsetParent === null) continue;
|
|
5513
5539
|
if (getErrorsForPath(entry.path).length === 0) continue;
|
|
5514
|
-
|
|
5540
|
+
const element = entry.host ? resolveHostFocusTarget(entry.element) : entry.element;
|
|
5541
|
+
return { path: entry.path, element };
|
|
5515
5542
|
}
|
|
5516
5543
|
return null;
|
|
5517
5544
|
}
|
|
5518
5545
|
function rebuildSortedRegistrations() {
|
|
5519
5546
|
const flat = [];
|
|
5520
5547
|
for (const [, record] of elements) {
|
|
5521
|
-
for (const el of record.elements)
|
|
5548
|
+
for (const el of record.elements) {
|
|
5549
|
+
flat.push({
|
|
5550
|
+
path: record.path,
|
|
5551
|
+
element: el,
|
|
5552
|
+
host: false,
|
|
5553
|
+
formInstanceId: elementToFormInstance.get(el) ?? ""
|
|
5554
|
+
});
|
|
5555
|
+
}
|
|
5556
|
+
}
|
|
5557
|
+
for (const [key, target] of hostTargets) {
|
|
5558
|
+
if (elements.has(key)) continue;
|
|
5559
|
+
flat.push({
|
|
5560
|
+
path: target.path,
|
|
5561
|
+
element: target.hostRoot,
|
|
5562
|
+
host: true,
|
|
5563
|
+
formInstanceId: target.formInstanceId
|
|
5564
|
+
});
|
|
5522
5565
|
}
|
|
5523
5566
|
flat.sort(
|
|
5524
5567
|
(a, b) => a.element.compareDocumentPosition(b.element) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1
|
|
@@ -7613,4 +7656,4 @@ exports.unset = unset;
|
|
|
7613
7656
|
exports.useAbstractForm = useAbstractForm;
|
|
7614
7657
|
exports.useRegister = useRegister;
|
|
7615
7658
|
exports.useWizard = useWizard;
|
|
7616
|
-
//# sourceMappingURL=attaform.
|
|
7659
|
+
//# sourceMappingURL=attaform.Cg1rUfcF.cjs.map
|