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.
- package/README.md +27 -122
- 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 +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +3 -3
- package/dist/nuxt.cjs +1 -1
- package/dist/nuxt.cjs.map +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/nuxt.mjs +1 -1
- package/dist/nuxt.mjs.map +1 -1
- package/dist/runtime/plugins/attaform.cjs +2 -2
- package/dist/runtime/plugins/attaform.mjs +2 -2
- package/dist/shared/{attaform.BOi6n2Pn.cjs → attaform.AkX9wzfY.cjs} +2 -2
- package/dist/shared/{attaform.BOi6n2Pn.cjs.map → attaform.AkX9wzfY.cjs.map} +1 -1
- package/dist/shared/{attaform.yqcYwt0d.d.ts → attaform.B1N47eDM.d.ts} +9 -1
- package/dist/shared/{attaform.D-gYGj5z.cjs → attaform.Bnm0FQaH.cjs} +4 -4
- package/dist/shared/{attaform.D-gYGj5z.cjs.map → attaform.Bnm0FQaH.cjs.map} +1 -1
- package/dist/shared/{attaform.Bos7wVZw.cjs → attaform.Buedl_UL.cjs} +66 -2
- package/dist/shared/attaform.Buedl_UL.cjs.map +1 -0
- package/dist/shared/{attaform.B7UdTs_o.cjs → attaform.CAVK56f8.cjs} +123 -3
- package/dist/shared/attaform.CAVK56f8.cjs.map +1 -0
- package/dist/shared/{attaform.DdfLrIgM.cjs → attaform.CBMI57RP.cjs} +3 -3
- package/dist/shared/{attaform.DdfLrIgM.cjs.map → attaform.CBMI57RP.cjs.map} +1 -1
- package/dist/shared/{attaform.B57G7ePY.cjs → attaform.CE-KJZ0j.cjs} +4 -4
- package/dist/shared/{attaform.B57G7ePY.cjs.map → attaform.CE-KJZ0j.cjs.map} +1 -1
- package/dist/shared/{attaform.0-00cYGw.mjs → attaform.CZpUm-2l.mjs} +2 -2
- package/dist/shared/{attaform.0-00cYGw.mjs.map → attaform.CZpUm-2l.mjs.map} +1 -1
- package/dist/shared/{attaform.K1MbxmIu.mjs → attaform.ChY7tIrn.mjs} +4 -4
- package/dist/shared/{attaform.K1MbxmIu.mjs.map → attaform.ChY7tIrn.mjs.map} +1 -1
- package/dist/shared/{attaform.0zueP54D.d.mts → attaform.CqW4gF_Z.d.cts} +9 -1
- package/dist/shared/{attaform.B_-nZHtM.mjs → attaform.CwqTCeTZ.mjs} +4 -4
- package/dist/shared/{attaform.B_-nZHtM.mjs.map → attaform.CwqTCeTZ.mjs.map} +1 -1
- package/dist/shared/{attaform.DvqdxvNU.d.mts → attaform.DTn1J0Eq.d.mts} +1 -1
- package/dist/shared/{attaform.DK6_Ctv7.cjs → attaform.DWKcw1ud.cjs} +82 -4
- package/dist/shared/attaform.DWKcw1ud.cjs.map +1 -0
- package/dist/shared/{attaform.C0au8oXd.mjs → attaform.DwsfkfSY.mjs} +123 -3
- package/dist/shared/attaform.DwsfkfSY.mjs.map +1 -0
- package/dist/shared/{attaform.BjiHiYAZ.d.ts → attaform.EeVCVnoH.d.ts} +1 -1
- package/dist/shared/{attaform.Bx6pgrIy.d.cts → attaform.Ib7oSpxj.d.cts} +1 -1
- package/dist/shared/{attaform.DUc6cetN.d.mts → attaform.QFrCtJBO.d.cts} +38 -0
- package/dist/shared/{attaform.DUc6cetN.d.cts → attaform.QFrCtJBO.d.mts} +38 -0
- package/dist/shared/{attaform.DUc6cetN.d.ts → attaform.QFrCtJBO.d.ts} +38 -0
- package/dist/shared/{attaform.DwCtxauq.mjs → attaform.QwLSdxuk.mjs} +82 -4
- package/dist/shared/attaform.QwLSdxuk.mjs.map +1 -0
- package/dist/shared/{attaform.DHjRN5JP.d.cts → attaform.f0l5ydy1.d.mts} +9 -1
- package/dist/shared/{attaform.BI7M3wK8.mjs → attaform.iJ4y3sHU.mjs} +67 -3
- package/dist/shared/attaform.iJ4y3sHU.mjs.map +1 -0
- package/dist/shared/{attaform.BjUaX7s8.mjs → attaform.lcTiMoma.mjs} +3 -3
- package/dist/shared/{attaform.BjUaX7s8.mjs.map → attaform.lcTiMoma.mjs.map} +1 -1
- package/dist/transforms.cjs +1 -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 +3 -3
- package/dist/zod-v3.d.mts +3 -3
- package/dist/zod-v3.d.ts +3 -3
- 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 +5 -5
- package/dist/zod.d.cts +5 -5
- package/dist/zod.d.mts +5 -5
- package/dist/zod.d.ts +5 -5
- package/dist/zod.mjs +5 -5
- package/package.json +7 -3
- package/dist/shared/attaform.B7UdTs_o.cjs.map +0 -1
- package/dist/shared/attaform.BI7M3wK8.mjs.map +0 -1
- package/dist/shared/attaform.Bos7wVZw.cjs.map +0 -1
- package/dist/shared/attaform.C0au8oXd.mjs.map +0 -1
- package/dist/shared/attaform.DK6_Ctv7.cjs.map +0 -1
- package/dist/shared/attaform.DwCtxauq.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const vue = require('vue');
|
|
4
|
-
const paths = require('./attaform.
|
|
4
|
+
const paths = require('./attaform.CAVK56f8.cjs');
|
|
5
5
|
const registerProtocol = require('./attaform.CjdepGnw.cjs');
|
|
6
6
|
|
|
7
7
|
function safeAssign(target, key, value) {
|
|
@@ -941,6 +941,15 @@ function buildContainerFieldStateBase(state, segments, key, formInstanceId) {
|
|
|
941
941
|
if (since !== void 0 && (transformingSince === null || since < transformingSince))
|
|
942
942
|
transformingSince = since;
|
|
943
943
|
}
|
|
944
|
+
const ownRecord = state.fields.get(key);
|
|
945
|
+
if (ownRecord !== void 0) {
|
|
946
|
+
if (ownRecord.focused === true) focused = true;
|
|
947
|
+
if (ownRecord.blurred === true) blurred = true;
|
|
948
|
+
if (ownRecord.touched === true) touched = true;
|
|
949
|
+
if (ownRecord.interacted === true) interacted = true;
|
|
950
|
+
if (ownRecord.blurredAfterInteraction === true) blurredAfterInteraction = true;
|
|
951
|
+
if (ownRecord.connected === true) connected = true;
|
|
952
|
+
}
|
|
944
953
|
const ownTransformError = state.transformErrors.get(key) ?? null;
|
|
945
954
|
const gated = asyncPending && !state.firstValidationDone.value;
|
|
946
955
|
const valid = !gated && errors.length === 0 && !validating;
|
|
@@ -2286,6 +2295,7 @@ function coerceValue(value, accepted, elementAccepted, index) {
|
|
|
2286
2295
|
return coerceScalar(value, accepted, index);
|
|
2287
2296
|
}
|
|
2288
2297
|
|
|
2298
|
+
const warnedMultiRootHosts = /* @__PURE__ */ new Set();
|
|
2289
2299
|
const EMPTY_TRANSFORMS = Object.freeze([]);
|
|
2290
2300
|
const attaformListenersSymbol = Symbol.for("attaform:focus-listeners");
|
|
2291
2301
|
function attachFocusListeners(state, segments, element, instanceMeta) {
|
|
@@ -2390,6 +2400,24 @@ function buildRegister(state, formInstanceId, instanceConfig) {
|
|
|
2390
2400
|
setValueWithInternalPath: (value, meta) => {
|
|
2391
2401
|
return state.setValueAtPath(segments, value, withInstanceMeta(meta));
|
|
2392
2402
|
},
|
|
2403
|
+
setValueFromHost: (value) => {
|
|
2404
|
+
state.markInteracted(segments);
|
|
2405
|
+
const accepted = state.setValueAtPath(segments, value, withInstanceMeta(void 0));
|
|
2406
|
+
if (paths.__DEV__) {
|
|
2407
|
+
const dedupeKey = `${formInstanceId}:${pathKey}`;
|
|
2408
|
+
const isWired = () => (state.elements.get(pathKey)?.elements.size ?? 0) > 0 || state.getFieldRecord(segments)?.connected === true;
|
|
2409
|
+
if (!warnedMultiRootHosts.has(dedupeKey) && !isWired()) {
|
|
2410
|
+
warnedMultiRootHosts.add(dedupeKey);
|
|
2411
|
+
void vue.nextTick(() => {
|
|
2412
|
+
if (isWired()) return;
|
|
2413
|
+
vue.warn(
|
|
2414
|
+
`[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.`
|
|
2415
|
+
);
|
|
2416
|
+
});
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
return accepted;
|
|
2420
|
+
},
|
|
2393
2421
|
// Called by the `vRegisterHint` compile-time transform's wrapping
|
|
2394
2422
|
// IIFE on every server-side render of `<element v-register="…">`.
|
|
2395
2423
|
// Without it, every SSR'd FieldState serialises `connected: false`
|
|
@@ -2401,6 +2429,24 @@ function buildRegister(state, formInstanceId, instanceConfig) {
|
|
|
2401
2429
|
markConnectedOptimistically: () => {
|
|
2402
2430
|
state.markConnectedOptimistically(segments);
|
|
2403
2431
|
},
|
|
2432
|
+
markHostConnected: (connected) => {
|
|
2433
|
+
state.markHostConnected(segments, connected);
|
|
2434
|
+
},
|
|
2435
|
+
markFocused: (focused) => {
|
|
2436
|
+
state.markFocused(
|
|
2437
|
+
segments,
|
|
2438
|
+
focused,
|
|
2439
|
+
instanceMeta !== void 0 ? { instance: instanceMeta } : void 0
|
|
2440
|
+
);
|
|
2441
|
+
},
|
|
2442
|
+
hasRegisteredDescendant: (hostElement) => {
|
|
2443
|
+
const record = state.elements.get(pathKey);
|
|
2444
|
+
if (record === void 0) return false;
|
|
2445
|
+
for (const element of record.elements) {
|
|
2446
|
+
if (hostElement.contains(element)) return true;
|
|
2447
|
+
}
|
|
2448
|
+
return false;
|
|
2449
|
+
},
|
|
2404
2450
|
// --- Async transform lifecycle (internal; the directive's
|
|
2405
2451
|
// deferred orchestrator is the only legitimate consumer). Thin
|
|
2406
2452
|
// path-bound delegates to the store's per-path token / counter
|
|
@@ -4974,6 +5020,21 @@ function createFormStore(options) {
|
|
|
4974
5020
|
blurred: current?.blurred ?? true
|
|
4975
5021
|
});
|
|
4976
5022
|
}
|
|
5023
|
+
function markHostConnected(path, connected) {
|
|
5024
|
+
const { key } = paths.canonicalizePath(path);
|
|
5025
|
+
const current = fields.get(key);
|
|
5026
|
+
if (connected) {
|
|
5027
|
+
if (current?.connected === true) return;
|
|
5028
|
+
touchFieldRecord(key, path, {
|
|
5029
|
+
connected: true,
|
|
5030
|
+
focused: current?.focused ?? false,
|
|
5031
|
+
blurred: current?.blurred ?? true
|
|
5032
|
+
});
|
|
5033
|
+
} else {
|
|
5034
|
+
if (current?.connected !== true) return;
|
|
5035
|
+
touchFieldRecord(key, path, { connected: false, focused: null, blurred: null });
|
|
5036
|
+
}
|
|
5037
|
+
}
|
|
4977
5038
|
function markFocused(path, focused, meta) {
|
|
4978
5039
|
const { key } = paths.canonicalizePath(path);
|
|
4979
5040
|
const current = fields.get(key);
|
|
@@ -5383,6 +5444,7 @@ function createFormStore(options) {
|
|
|
5383
5444
|
markInteracted,
|
|
5384
5445
|
touchAtPath,
|
|
5385
5446
|
markConnectedOptimistically,
|
|
5447
|
+
markHostConnected,
|
|
5386
5448
|
isPristineAtPath,
|
|
5387
5449
|
isPristineAtPathByKey,
|
|
5388
5450
|
hasStructuralChangeUnder,
|
|
@@ -5981,6 +6043,8 @@ function useRegister() {
|
|
|
5981
6043
|
}
|
|
5982
6044
|
}
|
|
5983
6045
|
if ("value" in rawAttrs) delete rawAttrs["value"];
|
|
6046
|
+
if ("modelValue" in rawAttrs) delete rawAttrs["modelValue"];
|
|
6047
|
+
if ("onUpdate:modelValue" in rawAttrs) delete rawAttrs["onUpdate:modelValue"];
|
|
5984
6048
|
};
|
|
5985
6049
|
refreshAndStripBridgeAttrs();
|
|
5986
6050
|
vue.onBeforeMount(refreshAndStripBridgeAttrs);
|
|
@@ -7122,4 +7186,4 @@ exports.unset = unset;
|
|
|
7122
7186
|
exports.useAbstractForm = useAbstractForm;
|
|
7123
7187
|
exports.useRegister = useRegister;
|
|
7124
7188
|
exports.useWizard = useWizard;
|
|
7125
|
-
//# sourceMappingURL=attaform.
|
|
7189
|
+
//# sourceMappingURL=attaform.Buedl_UL.cjs.map
|