attaform 0.14.0 → 0.15.1
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/chunks/devtools.cjs +3 -3
- package/dist/chunks/devtools.cjs.map +1 -1
- package/dist/chunks/devtools.mjs +3 -3
- package/dist/chunks/devtools.mjs.map +1 -1
- package/dist/chunks/indexeddb.cjs +1 -1
- package/dist/chunks/indexeddb.mjs +1 -1
- package/dist/chunks/local-storage.cjs +1 -1
- package/dist/chunks/local-storage.mjs +1 -1
- package/dist/chunks/session-storage.cjs +1 -1
- package/dist/chunks/session-storage.mjs +1 -1
- package/dist/index.cjs +5 -4
- package/dist/index.cjs.map +1 -1
- 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 +6 -6
- 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.DDXrY-1Q.d.mts → attaform.0Gxd_OOx.d.cts} +558 -174
- package/dist/shared/{attaform.DDXrY-1Q.d.ts → attaform.0Gxd_OOx.d.mts} +558 -174
- package/dist/shared/{attaform.DDXrY-1Q.d.cts → attaform.0Gxd_OOx.d.ts} +558 -174
- package/dist/shared/{attaform.xKWYHMdq.cjs → attaform.BOi138GE.cjs} +10 -2
- package/dist/shared/{attaform.xKWYHMdq.cjs.map → attaform.BOi138GE.cjs.map} +1 -1
- package/dist/shared/{attaform.CRgix6_n.cjs → attaform.BgYBU8gV.cjs} +18 -17
- package/dist/shared/attaform.BgYBU8gV.cjs.map +1 -0
- package/dist/shared/attaform.Bubm_slq.cjs.map +1 -1
- package/dist/shared/{attaform.CNJO3mME.cjs → attaform.CDJVeoJU.cjs} +633 -236
- package/dist/shared/attaform.CDJVeoJU.cjs.map +1 -0
- package/dist/shared/{attaform.DlgKK10S.mjs → attaform.CRk8NhlD.mjs} +18 -17
- package/dist/shared/attaform.CRk8NhlD.mjs.map +1 -0
- package/dist/shared/{attaform.CXZgUECn.d.cts → attaform.CVv9Oh0a.d.mts} +41 -9
- package/dist/shared/{attaform.BYc9kugA.d.ts → attaform.CWCx2r0x.d.ts} +41 -9
- package/dist/shared/attaform.CXpzmj38.mjs.map +1 -1
- package/dist/shared/{attaform.Cc93zNzD.mjs → attaform.DXye3JKf.mjs} +10 -3
- package/dist/shared/{attaform.Cc93zNzD.mjs.map → attaform.DXye3JKf.mjs.map} +1 -1
- package/dist/shared/{attaform.DOKOyb3Y.d.mts → attaform.Dq5BabH1.d.cts} +41 -9
- package/dist/shared/{attaform.B5GWYl76.cjs → attaform.RypIkgVy.cjs} +38 -7
- package/dist/shared/attaform.RypIkgVy.cjs.map +1 -0
- package/dist/shared/{attaform.al_rpt7_.mjs → attaform.a99dQV7Q.mjs} +39 -8
- package/dist/shared/attaform.a99dQV7Q.mjs.map +1 -0
- package/dist/shared/{attaform.BRTxpA3q.mjs → attaform.qxyip_aN.mjs} +634 -238
- package/dist/shared/attaform.qxyip_aN.mjs.map +1 -0
- package/dist/transforms.d.cts +2 -2
- package/dist/transforms.d.mts +2 -2
- package/dist/transforms.d.ts +2 -2
- package/dist/zod-v3.cjs +55 -3
- package/dist/zod-v3.cjs.map +1 -1
- package/dist/zod-v3.d.cts +77 -4
- package/dist/zod-v3.d.mts +77 -4
- package/dist/zod-v3.d.ts +77 -4
- package/dist/zod-v3.mjs +56 -6
- package/dist/zod-v3.mjs.map +1 -1
- package/dist/zod.cjs +372 -5
- package/dist/zod.cjs.map +1 -1
- package/dist/zod.d.cts +120 -4
- package/dist/zod.d.mts +120 -4
- package/dist/zod.d.ts +120 -4
- package/dist/zod.mjs +371 -8
- package/dist/zod.mjs.map +1 -1
- package/package.json +3 -1
- package/dist/shared/attaform.B5GWYl76.cjs.map +0 -1
- package/dist/shared/attaform.BRTxpA3q.mjs.map +0 -1
- package/dist/shared/attaform.CNJO3mME.cjs.map +0 -1
- package/dist/shared/attaform.CRgix6_n.cjs.map +0 -1
- package/dist/shared/attaform.DlgKK10S.mjs.map +0 -1
- package/dist/shared/attaform.al_rpt7_.mjs.map +0 -1
package/dist/transforms.d.cts
CHANGED
|
@@ -27,7 +27,7 @@ declare const selectNodeTransform: NodeTransform;
|
|
|
27
27
|
* Vue compiler node transform that wraps every `v-register`
|
|
28
28
|
* expression in a small IIFE so the directive can flag a field as
|
|
29
29
|
* connected during SSR. Eliminates the `false → true` flicker on
|
|
30
|
-
* `getFieldState(path).
|
|
30
|
+
* `getFieldState(path).connected` after hydration.
|
|
31
31
|
*
|
|
32
32
|
* Must run after `vRegisterPreambleTransform`. Wired automatically
|
|
33
33
|
* by `attaform/vite` and `attaform/nuxt`.
|
|
@@ -38,7 +38,7 @@ declare const vRegisterHintTransform: NodeTransform;
|
|
|
38
38
|
* Vue compiler node transform that hoists `v-register`'s SSR
|
|
39
39
|
* connection marks to the root of the template. Together with
|
|
40
40
|
* `vRegisterHintTransform`, ensures expressions earlier in the
|
|
41
|
-
* template that read `getFieldState(path).
|
|
41
|
+
* template that read `getFieldState(path).connected` see the
|
|
42
42
|
* correct value during the server's single-pass render.
|
|
43
43
|
*
|
|
44
44
|
* Must run before `vRegisterHintTransform`. Wired automatically
|
package/dist/transforms.d.mts
CHANGED
|
@@ -27,7 +27,7 @@ declare const selectNodeTransform: NodeTransform;
|
|
|
27
27
|
* Vue compiler node transform that wraps every `v-register`
|
|
28
28
|
* expression in a small IIFE so the directive can flag a field as
|
|
29
29
|
* connected during SSR. Eliminates the `false → true` flicker on
|
|
30
|
-
* `getFieldState(path).
|
|
30
|
+
* `getFieldState(path).connected` after hydration.
|
|
31
31
|
*
|
|
32
32
|
* Must run after `vRegisterPreambleTransform`. Wired automatically
|
|
33
33
|
* by `attaform/vite` and `attaform/nuxt`.
|
|
@@ -38,7 +38,7 @@ declare const vRegisterHintTransform: NodeTransform;
|
|
|
38
38
|
* Vue compiler node transform that hoists `v-register`'s SSR
|
|
39
39
|
* connection marks to the root of the template. Together with
|
|
40
40
|
* `vRegisterHintTransform`, ensures expressions earlier in the
|
|
41
|
-
* template that read `getFieldState(path).
|
|
41
|
+
* template that read `getFieldState(path).connected` see the
|
|
42
42
|
* correct value during the server's single-pass render.
|
|
43
43
|
*
|
|
44
44
|
* Must run before `vRegisterHintTransform`. Wired automatically
|
package/dist/transforms.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ declare const selectNodeTransform: NodeTransform;
|
|
|
27
27
|
* Vue compiler node transform that wraps every `v-register`
|
|
28
28
|
* expression in a small IIFE so the directive can flag a field as
|
|
29
29
|
* connected during SSR. Eliminates the `false → true` flicker on
|
|
30
|
-
* `getFieldState(path).
|
|
30
|
+
* `getFieldState(path).connected` after hydration.
|
|
31
31
|
*
|
|
32
32
|
* Must run after `vRegisterPreambleTransform`. Wired automatically
|
|
33
33
|
* by `attaform/vite` and `attaform/nuxt`.
|
|
@@ -38,7 +38,7 @@ declare const vRegisterHintTransform: NodeTransform;
|
|
|
38
38
|
* Vue compiler node transform that hoists `v-register`'s SSR
|
|
39
39
|
* connection marks to the root of the template. Together with
|
|
40
40
|
* `vRegisterHintTransform`, ensures expressions earlier in the
|
|
41
|
-
* template that read `getFieldState(path).
|
|
41
|
+
* template that read `getFieldState(path).connected` see the
|
|
42
42
|
* correct value during the server's single-pass render.
|
|
43
43
|
*
|
|
44
44
|
* Must run before `vRegisterHintTransform`. Wired automatically
|
package/dist/zod-v3.cjs
CHANGED
|
@@ -2,9 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
const lodashEs = require('lodash-es');
|
|
4
4
|
const zod = require('zod');
|
|
5
|
-
const useFormContext = require('./shared/attaform.
|
|
6
|
-
const paths = require('./shared/attaform.
|
|
7
|
-
const sensitiveNames = require('./shared/attaform.
|
|
5
|
+
const useFormContext = require('./shared/attaform.CDJVeoJU.cjs');
|
|
6
|
+
const paths = require('./shared/attaform.BOi138GE.cjs');
|
|
7
|
+
const sensitiveNames = require('./shared/attaform.RypIkgVy.cjs');
|
|
8
|
+
|
|
9
|
+
const store = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
const fieldMeta = {
|
|
11
|
+
add(schema, payload) {
|
|
12
|
+
store.set(schema, payload);
|
|
13
|
+
return fieldMeta;
|
|
14
|
+
},
|
|
15
|
+
get(schema) {
|
|
16
|
+
return store.get(schema);
|
|
17
|
+
},
|
|
18
|
+
has(schema) {
|
|
19
|
+
return store.has(schema);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
function withMeta(schema, payload) {
|
|
23
|
+
const existing = store.get(schema) ?? {};
|
|
24
|
+
const Ctor = schema.constructor;
|
|
25
|
+
const cloned = new Ctor(schema._def);
|
|
26
|
+
store.set(cloned, { ...existing, ...payload });
|
|
27
|
+
return cloned;
|
|
28
|
+
}
|
|
29
|
+
function getFieldMeta(schema) {
|
|
30
|
+
return store.get(schema);
|
|
31
|
+
}
|
|
8
32
|
|
|
9
33
|
class UnsupportedSchemaError extends sensitiveNames.AttaformError {
|
|
10
34
|
}
|
|
@@ -659,6 +683,9 @@ function zodAdapter(zodSchema) {
|
|
|
659
683
|
if (!leaf) return false;
|
|
660
684
|
return isLeafRequiredV3(leaf);
|
|
661
685
|
},
|
|
686
|
+
getFieldMetaAtPath(path) {
|
|
687
|
+
return resolveFieldMetaAtPathV3(_zodSchema, path);
|
|
688
|
+
},
|
|
662
689
|
getUnionDiscriminatorAtPath(path) {
|
|
663
690
|
const candidates = path.length === 0 ? [_zodSchema] : getNestedZodSchemasAtPath(_zodSchema, path);
|
|
664
691
|
let matchedUnion;
|
|
@@ -1486,6 +1513,29 @@ function getSlimSchema(config) {
|
|
|
1486
1513
|
const processedRootSchema = stripRootSchema(config.schema, config.stripConfig)[0];
|
|
1487
1514
|
return _getSlimSchema(processedRootSchema);
|
|
1488
1515
|
}
|
|
1516
|
+
function resolveFieldMetaAtPathV3(rootSchema, path) {
|
|
1517
|
+
const lastSegment = path.length === 0 ? "" : path[path.length - 1];
|
|
1518
|
+
const target = path.length === 0 ? rootSchema : walkV3ToLeafSchema(rootSchema, path);
|
|
1519
|
+
if (target === void 0) {
|
|
1520
|
+
return {
|
|
1521
|
+
label: useFormContext.humanize(lastSegment),
|
|
1522
|
+
description: void 0,
|
|
1523
|
+
placeholder: void 0,
|
|
1524
|
+
meta: Object.freeze({})
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
const peeled = peelV3Wrappers(target);
|
|
1528
|
+
const payload = getFieldMeta(target) ?? (peeled !== target ? getFieldMeta(peeled) : void 0);
|
|
1529
|
+
const targetDescription = typeof target.description === "string" ? target.description : void 0;
|
|
1530
|
+
const peeledDescription = peeled !== target && typeof peeled.description === "string" ? peeled.description : void 0;
|
|
1531
|
+
const schemaDescription = targetDescription ?? peeledDescription;
|
|
1532
|
+
return {
|
|
1533
|
+
label: payload?.label ?? useFormContext.humanize(lastSegment),
|
|
1534
|
+
description: payload?.description ?? schemaDescription ?? void 0,
|
|
1535
|
+
placeholder: payload?.placeholder ?? void 0,
|
|
1536
|
+
meta: Object.freeze({ ...payload ?? {} })
|
|
1537
|
+
};
|
|
1538
|
+
}
|
|
1489
1539
|
|
|
1490
1540
|
function useForm(configuration) {
|
|
1491
1541
|
function isZodType(value) {
|
|
@@ -1505,7 +1555,9 @@ exports.injectForm = useFormContext.injectForm;
|
|
|
1505
1555
|
exports.isUnset = useFormContext.isUnset;
|
|
1506
1556
|
exports.unset = useFormContext.unset;
|
|
1507
1557
|
exports.useRegister = sensitiveNames.useRegister;
|
|
1558
|
+
exports.fieldMeta = fieldMeta;
|
|
1508
1559
|
exports.isZodSchemaType = isZodSchemaType;
|
|
1509
1560
|
exports.useForm = useForm;
|
|
1561
|
+
exports.withMeta = withMeta;
|
|
1510
1562
|
exports.zodAdapter = zodAdapter;
|
|
1511
1563
|
//# sourceMappingURL=zod-v3.cjs.map
|