attaform 0.25.0 → 0.27.0
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 +21 -11
- package/bin/attaform.mjs +78 -0
- package/dist/abstract.cjs +47 -0
- package/dist/abstract.cjs.map +1 -0
- package/dist/abstract.d.cts +42 -0
- package/dist/abstract.d.mts +42 -0
- package/dist/abstract.d.ts +42 -0
- package/dist/abstract.mjs +4 -0
- package/dist/abstract.mjs.map +1 -0
- package/dist/chunks/devtools.cjs +2 -2
- package/dist/chunks/devtools.cjs.map +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/esbuild.cjs +2 -2
- package/dist/esbuild.cjs.map +1 -1
- package/dist/esbuild.d.cts +3 -3
- package/dist/esbuild.d.mts +3 -3
- package/dist/esbuild.d.ts +3 -3
- package/dist/esbuild.mjs +2 -2
- package/dist/esbuild.mjs.map +1 -1
- package/dist/index.cjs +41 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +194 -282
- package/dist/index.d.mts +194 -282
- package/dist/index.d.ts +194 -282
- package/dist/index.mjs +4 -25
- package/dist/index.mjs.map +1 -1
- package/dist/nuxt.cjs +3 -1
- package/dist/nuxt.cjs.map +1 -1
- package/dist/nuxt.d.cts +17 -4
- package/dist/nuxt.d.mts +17 -4
- package/dist/nuxt.d.ts +17 -4
- package/dist/nuxt.mjs +4 -2
- package/dist/nuxt.mjs.map +1 -1
- package/dist/rollup.cjs +2 -2
- package/dist/rollup.cjs.map +1 -1
- package/dist/rollup.d.cts +3 -3
- package/dist/rollup.d.mts +3 -3
- package/dist/rollup.d.ts +3 -3
- package/dist/rollup.mjs +2 -2
- package/dist/rollup.mjs.map +1 -1
- package/dist/rspack.cjs +1 -1
- package/dist/rspack.d.cts +1 -1
- package/dist/rspack.d.mts +1 -1
- package/dist/rspack.d.ts +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/runtime/plugins/attaform.cjs +4 -5
- package/dist/runtime/plugins/attaform.cjs.map +1 -1
- package/dist/runtime/plugins/attaform.mjs +1 -2
- package/dist/runtime/plugins/attaform.mjs.map +1 -1
- package/dist/shared/{attaform.BRzKBj2g.cjs → attaform.8tFZu1Ub.cjs} +2 -2
- package/dist/shared/{attaform.BRzKBj2g.cjs.map → attaform.8tFZu1Ub.cjs.map} +1 -1
- package/dist/shared/{attaform.k9V0py0s.mjs → attaform.BERt5YMU.mjs} +2 -2
- package/dist/shared/{attaform.k9V0py0s.mjs.map → attaform.BERt5YMU.mjs.map} +1 -1
- package/dist/shared/{attaform.CN4ZEGo6.mjs → attaform.BceJrhQ7.mjs} +5 -5
- package/dist/shared/{attaform.CN4ZEGo6.mjs.map → attaform.BceJrhQ7.mjs.map} +1 -1
- package/dist/shared/{attaform.i_LA3X9o.d.cts → attaform.C3WnCDXz.d.cts} +81 -24
- package/dist/shared/{attaform.i_LA3X9o.d.ts → attaform.C3WnCDXz.d.mts} +81 -24
- package/dist/shared/{attaform.i_LA3X9o.d.mts → attaform.C3WnCDXz.d.ts} +81 -24
- package/dist/shared/{attaform.DuzQYscR.d.ts → attaform.C9fPTxjB.d.cts} +5 -5
- package/dist/shared/{attaform.DuzQYscR.d.cts → attaform.C9fPTxjB.d.mts} +5 -5
- package/dist/shared/{attaform.DuzQYscR.d.mts → attaform.C9fPTxjB.d.ts} +5 -5
- package/dist/shared/{attaform.B3cgZE3c.d.ts → attaform.CC_y1_Ej.d.ts} +33 -33
- package/dist/shared/{attaform.DS_zBcdr.d.ts → attaform.CEXUlUkc.d.ts} +1588 -1190
- package/dist/shared/{attaform.Xe8dATED.cjs → attaform.C__F01CE.cjs} +15 -15
- package/dist/shared/{attaform.Xe8dATED.cjs.map → attaform.C__F01CE.cjs.map} +1 -1
- package/dist/shared/{attaform.3heDHayA.cjs → attaform.Co5LNRnv.cjs} +186 -129
- package/dist/shared/attaform.Co5LNRnv.cjs.map +1 -0
- package/dist/shared/{attaform.BJt4ZCkM.d.mts → attaform.CpXHK60W.d.cts} +33 -33
- package/dist/shared/{attaform.DmKLa4tL.d.cts → attaform.CvVYOvZF.d.mts} +33 -33
- package/dist/shared/{attaform.DK3xUBkj.mjs → attaform.CyQxTOdX.mjs} +162 -79
- package/dist/shared/attaform.CyQxTOdX.mjs.map +1 -0
- package/dist/shared/{attaform.B5GFS3Su.d.cts → attaform.D99pd7JG.d.cts} +1588 -1190
- package/dist/shared/{attaform.CwXXbZIQ.mjs → attaform.DDAmSFnl.mjs} +4 -4
- package/dist/shared/{attaform.CwXXbZIQ.mjs.map → attaform.DDAmSFnl.mjs.map} +1 -1
- package/dist/shared/{attaform.BkUzunyB.cjs → attaform.DQT7_-FO.cjs} +371 -287
- package/dist/shared/attaform.DQT7_-FO.cjs.map +1 -0
- package/dist/shared/{attaform.CqwcTExO.mjs → attaform.Da8EdI2t.mjs} +182 -129
- package/dist/shared/attaform.Da8EdI2t.mjs.map +1 -0
- package/dist/shared/{attaform.sks1MFVO.cjs → attaform.DhVgG2jh.cjs} +16 -16
- package/dist/shared/{attaform.sks1MFVO.cjs.map → attaform.DhVgG2jh.cjs.map} +1 -1
- package/dist/shared/{attaform.sHkHv_98.mjs → attaform.DhnPb6nK.mjs} +6 -3
- package/dist/shared/attaform.DhnPb6nK.mjs.map +1 -0
- package/dist/shared/attaform.DkD0DR7R.mjs +42 -0
- package/dist/shared/attaform.DkD0DR7R.mjs.map +1 -0
- package/dist/shared/{attaform.DMNnfQq_.mjs → attaform.DlSu08F5.mjs} +4 -4
- package/dist/shared/{attaform.DMNnfQq_.mjs.map → attaform.DlSu08F5.mjs.map} +1 -1
- package/dist/shared/{attaform.LEWUFqUw.cjs → attaform.DoQm_Vkd.cjs} +7 -3
- package/dist/shared/attaform.DoQm_Vkd.cjs.map +1 -0
- package/dist/shared/{attaform.B5YcWrKi.cjs → attaform.Drsi43GG.cjs} +19 -19
- package/dist/shared/{attaform.B5YcWrKi.cjs.map → attaform.Drsi43GG.cjs.map} +1 -1
- package/dist/shared/attaform.K6Thc6By.cjs +46 -0
- package/dist/shared/attaform.K6Thc6By.cjs.map +1 -0
- package/dist/shared/{attaform.Vp2-CWZB.mjs → attaform.KvlEedlF.mjs} +3 -3
- package/dist/shared/{attaform.Vp2-CWZB.mjs.map → attaform.KvlEedlF.mjs.map} +1 -1
- package/dist/shared/{attaform.BRGIpZo4.cjs → attaform.RaTzp1WF.cjs} +3 -3
- package/dist/shared/attaform.RaTzp1WF.cjs.map +1 -0
- package/dist/shared/{attaform.8vmdOURQ.d.mts → attaform.kBkYlKP_.d.mts} +1588 -1190
- package/dist/shared/{attaform.C3Doa9Pt.mjs → attaform.v0fQtWyA.mjs} +3 -3
- package/dist/shared/attaform.v0fQtWyA.mjs.map +1 -0
- package/dist/shared/{attaform.ZXZ6dH72.cjs → attaform.yUrz7C2z.cjs} +3 -3
- package/dist/shared/{attaform.ZXZ6dH72.cjs.map → attaform.yUrz7C2z.cjs.map} +1 -1
- package/dist/transforms.cjs +1 -1
- package/dist/transforms.mjs +1 -1
- package/dist/vite.cjs +21 -3
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.cts +70 -17
- package/dist/vite.d.mts +70 -17
- package/dist/vite.d.ts +70 -17
- package/dist/vite.mjs +20 -4
- package/dist/vite.mjs.map +1 -1
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.mjs +1 -1
- package/dist/zod-v3.cjs +41 -10
- package/dist/zod-v3.cjs.map +1 -1
- package/dist/zod-v3.d.cts +5 -5
- package/dist/zod-v3.d.mts +5 -5
- package/dist/zod-v3.d.ts +5 -5
- package/dist/zod-v3.mjs +4 -2
- package/dist/zod-v3.mjs.map +1 -1
- package/dist/zod-v4.cjs +41 -10
- package/dist/zod-v4.cjs.map +1 -1
- package/dist/zod-v4.d.cts +7 -7
- package/dist/zod-v4.d.mts +7 -7
- package/dist/zod-v4.d.ts +7 -7
- package/dist/zod-v4.mjs +4 -2
- package/dist/zod-v4.mjs.map +1 -1
- package/dist/zod.cjs +44 -49
- package/dist/zod.cjs.map +1 -1
- package/dist/zod.d.cts +6 -248
- package/dist/zod.d.mts +6 -248
- package/dist/zod.d.ts +6 -248
- package/dist/zod.mjs +4 -42
- package/dist/zod.mjs.map +1 -1
- package/package.json +12 -2
- package/skills/attaform/SKILL.md +128 -0
- package/skills/attaform/references/custom-components.md +72 -0
- package/skills/attaform/references/errors.md +62 -0
- package/skills/attaform/references/ssr.md +26 -0
- package/skills/attaform/references/validation.md +40 -0
- package/skills/attaform/references/wizards.md +104 -0
- package/dist/shared/attaform.3heDHayA.cjs.map +0 -1
- package/dist/shared/attaform.BRGIpZo4.cjs.map +0 -1
- package/dist/shared/attaform.BkUzunyB.cjs.map +0 -1
- package/dist/shared/attaform.C3Doa9Pt.mjs.map +0 -1
- package/dist/shared/attaform.CO0e7YVY.d.cts +0 -94
- package/dist/shared/attaform.CO0e7YVY.d.mts +0 -94
- package/dist/shared/attaform.CO0e7YVY.d.ts +0 -94
- package/dist/shared/attaform.CqwcTExO.mjs.map +0 -1
- package/dist/shared/attaform.DK3xUBkj.mjs.map +0 -1
- package/dist/shared/attaform.LEWUFqUw.cjs.map +0 -1
- package/dist/shared/attaform.OLtKd9gM.mjs +0 -35
- package/dist/shared/attaform.OLtKd9gM.mjs.map +0 -1
- package/dist/shared/attaform.sHkHv_98.mjs.map +0 -1
- package/dist/shared/attaform.xBDo0Ko0.cjs +0 -39
- package/dist/shared/attaform.xBDo0Ko0.cjs.map +0 -1
- package/dist/shared/{attaform.DdjDqTah.d.mts → attaform.DRUT703x.d.cts} +14 -14
- package/dist/shared/{attaform.DdjDqTah.d.ts → attaform.DRUT703x.d.mts} +14 -14
- package/dist/shared/{attaform.DdjDqTah.d.cts → attaform.DRUT703x.d.ts} +14 -14
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attaform.LEWUFqUw.cjs","sources":["../../src/core/detect-zod-major.ts"],"sourcesContent":["/**\n * Shared build-time Zod-major detection and `attaform/zod` alias\n * resolution for the bundler plugins (`attaform/vite`, `attaform/rollup`,\n * `attaform/esbuild`, `attaform/webpack`, `attaform/rspack`).\n *\n * The unified `attaform/zod` entry runtime-dispatches between the v3 and\n * v4 adapters, so a bundler that does not rewrite the import ships BOTH.\n * Each plugin rewrites `attaform/zod` to the single matching adapter\n * subpath (`attaform/zod-v3` or `attaform/zod-v4`) based on the Zod major\n * resolved from the consumer's project, so the consumer bundle carries\n * one adapter instead of two. This module holds the detection (pure Node,\n * no bundler API) plus the shared diagnostic copy so every plugin behaves\n * and reads identically.\n *\n * Build-time only: imported by the build-tool entries at `src/*.ts`,\n * never by runtime code, so it never reaches a consumer's browser bundle.\n */\nimport { readFileSync } from 'node:fs'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport { join } from 'node:path'\n\nexport const ZOD_UNIFIED_SPECIFIER = 'attaform/zod'\nexport const ZOD_V3_SPECIFIER = 'attaform/zod-v3'\nexport const ZOD_V4_SPECIFIER = 'attaform/zod-v4'\n\nexport type ZodMajorDetection =\n | { major: 3 }\n | { major: 4 }\n | { major: 'missing' }\n | { major: 'unknown' }\n\n/**\n * Read the consumer's installed Zod major by resolving\n * `zod/package.json` from their project root. ESM resolution\n * (`import.meta.resolve`) is sync and stable on Node 20.6+, follows\n * pnpm symlinks, and works with attaform's ESM-only `exports` map.\n *\n * Returns:\n * - `{ major: 3 | 4 }` when zod is resolvable AND its `version`\n * field parses to a known major;\n * - `{ major: 'missing' }` when zod can't be resolved at all;\n * - `{ major: 'unknown' }` for any other failure (corrupted\n * package.json, unexpected version string, monorepo edge case).\n */\nexport function detectZodMajor(consumerRootDir: string): ZodMajorDetection {\n const consumerURL = pathToFileURL(join(consumerRootDir, 'package.json')).href\n let resolved: string\n try {\n resolved = import.meta.resolve('zod/package.json', consumerURL)\n } catch {\n return { major: 'missing' }\n }\n try {\n const pkg = JSON.parse(readFileSync(fileURLToPath(resolved), 'utf8')) as { version?: unknown }\n const version = pkg.version\n if (typeof version !== 'string') return { major: 'unknown' }\n const major = Number.parseInt(version.split('.')[0] ?? '', 10)\n if (major === 3) return { major: 3 }\n if (major === 4) return { major: 4 }\n return { major: 'unknown' }\n } catch {\n return { major: 'unknown' }\n }\n}\n\n/**\n * One-shot latch so a plugin warns about an unclassifiable Zod version\n * only once, however many times its detection runs across a build.\n */\nexport interface ZodDetectionWarnState {\n warned: boolean\n}\n\nfunction missingZodError(tag: string): string {\n return (\n `[${tag}] zod is not installed. attaform requires zod as a peer dependency. ` +\n 'Install `zod@^3` or `zod@^4`, OR pass `attaform({ resolveZodAlias: false })` ' +\n 'to keep the runtime-dispatch unified entry (and silence this check).'\n )\n}\n\nfunction unclassifiableZodWarning(tag: string): string {\n return (\n `[${tag}] Could not classify the installed Zod major (corrupted package.json, ` +\n 'monorepo edge case, or an unexpected version string). Falling through to runtime ' +\n 'dispatch — both Zod adapters will ship in the bundle. ' +\n 'Pass `attaform({ resolveZodAlias: false })` to silence this warning.'\n )\n}\n\n/**\n * Resolve the rewrite target for the unified `attaform/zod` specifier,\n * shared by every bundler plugin so they diagnose identically:\n * - returns `attaform/zod-v3` / `attaform/zod-v4` when the consumer's\n * Zod major is detected;\n * - returns `null` to leave `attaform/zod` on its runtime-dispatch\n * entry, either because `resolveZodAlias` is off or because the\n * version could not be classified (warned once via `warnState`);\n * - throws when zod is not installed at all, a fatal misconfiguration\n * the consumer must fix.\n *\n * `tag` brands the diagnostics (`attaform/vite`, `attaform/rollup`, etc).\n * `resolveZodAlias` and `warnState` are supplied by the calling plugin:\n * its consumer-facing default and its per-instance warn latch live at the\n * plugin surface, not here.\n */\nexport function resolveZodAliasTarget(\n consumerRootDir: string,\n tag: string,\n resolveZodAlias: boolean,\n warnState: ZodDetectionWarnState\n): string | null {\n if (!resolveZodAlias) return null\n const detection = detectZodMajor(consumerRootDir)\n if (detection.major === 'missing') {\n throw new Error(missingZodError(tag))\n }\n if (detection.major === 'unknown') {\n if (!warnState.warned) {\n warnState.warned = true\n console.warn(unclassifiableZodWarning(tag))\n }\n return null\n }\n return detection.major === 4 ? ZOD_V4_SPECIFIER : ZOD_V3_SPECIFIER\n}\n"],"names":["pathToFileURL","join","readFileSync","fileURLToPath"],"mappings":";;;;;;AAqBO,MAAM,qBAAA,GAAwB;AAC9B,MAAM,gBAAA,GAAmB,iBAAA;AACzB,MAAM,gBAAA,GAAmB,iBAAA;AAqBzB,SAAS,eAAe,eAAA,EAA4C;AACzE,EAAA,MAAM,cAAcA,sBAAA,CAAcC,cAAA,CAAK,eAAA,EAAiB,cAAc,CAAC,CAAA,CAAE,IAAA;AACzE,EAAA,IAAI,QAAA;AACJ,EAAA,IAAI;AACF,IAAA,QAAA,GAAW,SAAY,CAAQ,kBAAA,EAAoB,WAAW,CAAA;AAAA,EAChE,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAE,OAAO,SAAA,EAAU;AAAA,EAC5B;AACA,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,KAAK,KAAA,CAAMC,oBAAA,CAAaC,uBAAc,QAAQ,CAAA,EAAG,MAAM,CAAC,CAAA;AACpE,IAAA,MAAM,UAAU,GAAA,CAAI,OAAA;AACpB,IAAA,IAAI,OAAO,OAAA,KAAY,QAAA,EAAU,OAAO,EAAE,OAAO,SAAA,EAAU;AAC3D,IAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,QAAA,CAAS,OAAA,CAAQ,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,IAAK,EAAA,EAAI,EAAE,CAAA;AAC7D,IAAA,IAAI,KAAA,KAAU,CAAA,EAAG,OAAO,EAAE,OAAO,CAAA,EAAE;AACnC,IAAA,IAAI,KAAA,KAAU,CAAA,EAAG,OAAO,EAAE,OAAO,CAAA,EAAE;AACnC,IAAA,OAAO,EAAE,OAAO,SAAA,EAAU;AAAA,EAC5B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAE,OAAO,SAAA,EAAU;AAAA,EAC5B;AACF;AAUA,SAAS,gBAAgB,GAAA,EAAqB;AAC5C,EAAA,OACE,IAAI,GAAG,CAAA,2NAAA,CAAA;AAIX;AAEA,SAAS,yBAAyB,GAAA,EAAqB;AACrD,EAAA,OACE,IAAI,GAAG,CAAA,wRAAA,CAAA;AAKX;AAkBO,SAAS,qBAAA,CACd,eAAA,EACA,GAAA,EACA,eAAA,EACA,SAAA,EACe;AACf,EAAA,IAAI,CAAC,iBAAiB,OAAO,IAAA;AAC7B,EAAA,MAAM,SAAA,GAAY,eAAe,eAAe,CAAA;AAChD,EAAA,IAAI,SAAA,CAAU,UAAU,SAAA,EAAW;AACjC,IAAA,MAAM,IAAI,KAAA,CAAM,eAAA,CAAgB,GAAG,CAAC,CAAA;AAAA,EACtC;AACA,EAAA,IAAI,SAAA,CAAU,UAAU,SAAA,EAAW;AACjC,IAAA,IAAI,CAAC,UAAU,MAAA,EAAQ;AACrB,MAAA,SAAA,CAAU,MAAA,GAAS,IAAA;AACnB,MAAA,OAAA,CAAQ,IAAA,CAAK,wBAAA,CAAyB,GAAG,CAAC,CAAA;AAAA,IAC5C;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,OAAO,SAAA,CAAU,KAAA,KAAU,CAAA,GAAI,gBAAA,GAAmB,gBAAA;AACpD;;;;;"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { i as getRegistryFromApp, m as pathKeyToDotted } from './attaform.CqwcTExO.mjs';
|
|
2
|
-
|
|
3
|
-
function renderAttaformState(app) {
|
|
4
|
-
const registry = getRegistryFromApp(app);
|
|
5
|
-
const forms = [];
|
|
6
|
-
for (const [key, state] of registry.forms) {
|
|
7
|
-
const transientList = [];
|
|
8
|
-
for (const pk of state.blankPaths) {
|
|
9
|
-
const d = pathKeyToDotted(pk);
|
|
10
|
-
if (d !== null) transientList.push(d);
|
|
11
|
-
}
|
|
12
|
-
forms.push([
|
|
13
|
-
key,
|
|
14
|
-
{
|
|
15
|
-
form: state.form.value,
|
|
16
|
-
schemaErrors: Array.from(state.schemaErrors.entries()),
|
|
17
|
-
userErrors: Array.from(state.userErrors.entries()),
|
|
18
|
-
fields: Array.from(state.fields.entries()),
|
|
19
|
-
...transientList.length > 0 ? { blankPaths: transientList } : {}
|
|
20
|
-
}
|
|
21
|
-
]);
|
|
22
|
-
}
|
|
23
|
-
return { forms };
|
|
24
|
-
}
|
|
25
|
-
function hydrateAttaformState(app, payload) {
|
|
26
|
-
const registry = getRegistryFromApp(app);
|
|
27
|
-
for (const [key, data] of payload.forms) {
|
|
28
|
-
registry.pendingHydration.set(key, data);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const DEVTOOLS_WINDOW_KEY = "__attaform_devtools__";
|
|
33
|
-
|
|
34
|
-
export { DEVTOOLS_WINDOW_KEY as D, hydrateAttaformState as h, renderAttaformState as r };
|
|
35
|
-
//# sourceMappingURL=attaform.OLtKd9gM.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attaform.OLtKd9gM.mjs","sources":["../../src/runtime/core/serialize.ts","../../src/runtime/core/devtools-shared.ts"],"sourcesContent":["import type { App } from 'vue'\nimport type { FormKey } from '../types/types-api'\nimport { pathKeyToDotted, type PathKey } from './paths'\nimport { getRegistryFromApp, type SerializedFormData } from './registry'\n\n/**\n * Serialised snapshot of every form in a Vue app, produced by\n * `renderAttaformState` and consumed by `hydrateAttaformState`.\n *\n * JSON-safe — pass to `JSON.stringify`, `devalue`, or any other\n * serialiser before embedding in your SSR payload.\n */\nexport type SerializedAttaformState = {\n /** Tuples of `[formKey, snapshot]` for every form in the app. */\n readonly forms: ReadonlyArray<readonly [FormKey, SerializedFormData]>\n}\n\n/**\n * Snapshot every form on a Vue app for SSR. Call from your server\n * entry after rendering the app:\n *\n * ```ts\n * import { renderToString } from '@vue/server-renderer'\n * import { renderAttaformState, escapeForInlineScript } from 'attaform'\n *\n * const html = await renderToString(app)\n * const state = renderAttaformState(app)\n * const payload = escapeForInlineScript(JSON.stringify(state))\n *\n * return `\n * ${html}\n * <script>window.__ATTAFORM_STATE__ = ${payload}</script>\n * `\n * ```\n *\n * Pair with `hydrateAttaformState` on the client to restore the\n * forms in their server-rendered state. Nuxt users don't need this —\n * `attaform/nuxt` wires SSR automatically.\n */\nexport function renderAttaformState(app: App): SerializedAttaformState {\n const registry = getRegistryFromApp(app)\n const forms: Array<readonly [FormKey, SerializedFormData]> = []\n for (const [key, state] of registry.forms) {\n // Skip the blank field when the set is empty so the\n // wire payload stays minimal for forms that don't use it. The\n // optional shape on the consuming side handles the absence\n // cleanly (defaults to \"no blank paths\"). PathKey → dotted at\n // the boundary so the wire shape matches the rest of the\n // public path notation.\n const transientList: string[] = []\n for (const pk of state.blankPaths) {\n const d = pathKeyToDotted(pk as PathKey)\n if (d !== null) transientList.push(d)\n }\n forms.push([\n key,\n {\n form: state.form.value,\n schemaErrors: Array.from(state.schemaErrors.entries()),\n userErrors: Array.from(state.userErrors.entries()),\n fields: Array.from(state.fields.entries()),\n ...(transientList.length > 0 ? { blankPaths: transientList } : {}),\n },\n ])\n }\n return { forms }\n}\n\n/**\n * Restore forms from a server-rendered snapshot on the client. Call\n * from your client entry before mounting:\n *\n * ```ts\n * import { createApp } from 'vue'\n * import { createAttaform, hydrateAttaformState } from 'attaform'\n *\n * const app = createApp(App).use(createAttaform())\n * hydrateAttaformState(app, window.__ATTAFORM_STATE__)\n * app.mount('#app')\n * ```\n *\n * The next `useForm({ key })` call for each serialised form picks up\n * the snapshot transparently — no further action is required.\n */\nexport function hydrateAttaformState(app: App, payload: SerializedAttaformState): void {\n const registry = getRegistryFromApp(app)\n for (const [key, data] of payload.forms) {\n registry.pendingHydration.set(key, data)\n }\n}\n","/**\n * Shared building blocks for Attaform's two devtools surfaces — the Vue\n * DevTools (Chrome-extension) inspector wired up in `./devtools.ts`, and\n * the Nuxt DevTools (overlay) panel wired up via `../../nuxt.ts` +\n * `../pages/_attaform_devtools.vue`.\n *\n * Houses the window-bridge contract both surfaces consume so a new\n * bridge field lands in one file. Both surfaces render RAW form values\n * by design — DevTools is a dev-only surface, and redaction across every\n * place a value surfaces is impractical security theater rather than a\n * real safeguard.\n */\nimport type { AttaformRegistry } from './registry'\n\n/**\n * Property key on `window` that the Nuxt-side dev plugin attaches the\n * bridge object to. The iframe-mounted overlay panel reads\n * `window.parent[DEVTOOLS_WINDOW_KEY]` to reach the host app's registry.\n *\n * Underscored + namespaced to make accidental collision with consumer\n * globals vanishingly unlikely. Stable across versions — bumping it\n * would silently disconnect older library builds from newer overlay\n * panels in the same browser tab during a library upgrade.\n */\nexport const DEVTOOLS_WINDOW_KEY = '__attaform_devtools__'\n\n/**\n * Shape of the object the host plugin attaches to `window` in dev mode.\n * The iframe overlay panel reads this to discover the live registry and\n * render its forms.\n *\n * Single-registry assumption: the latest `createAttaform()` install\n * wins. Multi-app pages (rare; typically only seen in micro-frontend\n * setups) will only see one app's forms in the panel. Documented but\n * not actively supported — the alternative (a Set of registries with\n * union-rendering) is a future call if a real consumer hits it.\n */\nexport interface AttaformDevtoolsBridge {\n registry: AttaformRegistry\n /**\n * The library version, surfaced in the panel's footer for support /\n * bug-report context. Read from `package.json` at host-plugin init.\n */\n version: string\n}\n\ndeclare global {\n interface Window {\n [DEVTOOLS_WINDOW_KEY]?: AttaformDevtoolsBridge\n }\n}\n"],"names":[],"mappings":";;AAuCO,SAAS,oBAAoB,GAAA,EAAmC;AACrE,EAAA,MAAM,QAAA,GAAW,mBAAmB,GAAG,CAAA;AACvC,EAAA,MAAM,QAAuD,EAAC;AAC9D,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,CAAA,IAAK,SAAS,KAAA,EAAO;AAOzC,IAAA,MAAM,gBAA0B,EAAC;AACjC,IAAA,KAAA,MAAW,EAAA,IAAM,MAAM,UAAA,EAAY;AACjC,MAAA,MAAM,CAAA,GAAI,gBAAgB,EAAa,CAAA;AACvC,MAAA,IAAI,CAAA,KAAM,IAAA,EAAM,aAAA,CAAc,IAAA,CAAK,CAAC,CAAA;AAAA,IACtC;AACA,IAAA,KAAA,CAAM,IAAA,CAAK;AAAA,MACT,GAAA;AAAA,MACA;AAAA,QACE,IAAA,EAAM,MAAM,IAAA,CAAK,KAAA;AAAA,QACjB,cAAc,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,YAAA,CAAa,SAAS,CAAA;AAAA,QACrD,YAAY,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,UAAA,CAAW,SAAS,CAAA;AAAA,QACjD,QAAQ,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,MAAA,CAAO,SAAS,CAAA;AAAA,QACzC,GAAI,cAAc,MAAA,GAAS,CAAA,GAAI,EAAE,UAAA,EAAY,aAAA,KAAkB;AAAC;AAClE,KACD,CAAA;AAAA,EACH;AACA,EAAA,OAAO,EAAE,KAAA,EAAM;AACjB;AAkBO,SAAS,oBAAA,CAAqB,KAAU,OAAA,EAAwC;AACrF,EAAA,MAAM,QAAA,GAAW,mBAAmB,GAAG,CAAA;AACvC,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,IAAI,CAAA,IAAK,QAAQ,KAAA,EAAO;AACvC,IAAA,QAAA,CAAS,gBAAA,CAAiB,GAAA,CAAI,GAAA,EAAK,IAAI,CAAA;AAAA,EACzC;AACF;;ACjEO,MAAM,mBAAA,GAAsB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attaform.sHkHv_98.mjs","sources":["../../src/core/detect-zod-major.ts"],"sourcesContent":["/**\n * Shared build-time Zod-major detection and `attaform/zod` alias\n * resolution for the bundler plugins (`attaform/vite`, `attaform/rollup`,\n * `attaform/esbuild`, `attaform/webpack`, `attaform/rspack`).\n *\n * The unified `attaform/zod` entry runtime-dispatches between the v3 and\n * v4 adapters, so a bundler that does not rewrite the import ships BOTH.\n * Each plugin rewrites `attaform/zod` to the single matching adapter\n * subpath (`attaform/zod-v3` or `attaform/zod-v4`) based on the Zod major\n * resolved from the consumer's project, so the consumer bundle carries\n * one adapter instead of two. This module holds the detection (pure Node,\n * no bundler API) plus the shared diagnostic copy so every plugin behaves\n * and reads identically.\n *\n * Build-time only: imported by the build-tool entries at `src/*.ts`,\n * never by runtime code, so it never reaches a consumer's browser bundle.\n */\nimport { readFileSync } from 'node:fs'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport { join } from 'node:path'\n\nexport const ZOD_UNIFIED_SPECIFIER = 'attaform/zod'\nexport const ZOD_V3_SPECIFIER = 'attaform/zod-v3'\nexport const ZOD_V4_SPECIFIER = 'attaform/zod-v4'\n\nexport type ZodMajorDetection =\n | { major: 3 }\n | { major: 4 }\n | { major: 'missing' }\n | { major: 'unknown' }\n\n/**\n * Read the consumer's installed Zod major by resolving\n * `zod/package.json` from their project root. ESM resolution\n * (`import.meta.resolve`) is sync and stable on Node 20.6+, follows\n * pnpm symlinks, and works with attaform's ESM-only `exports` map.\n *\n * Returns:\n * - `{ major: 3 | 4 }` when zod is resolvable AND its `version`\n * field parses to a known major;\n * - `{ major: 'missing' }` when zod can't be resolved at all;\n * - `{ major: 'unknown' }` for any other failure (corrupted\n * package.json, unexpected version string, monorepo edge case).\n */\nexport function detectZodMajor(consumerRootDir: string): ZodMajorDetection {\n const consumerURL = pathToFileURL(join(consumerRootDir, 'package.json')).href\n let resolved: string\n try {\n resolved = import.meta.resolve('zod/package.json', consumerURL)\n } catch {\n return { major: 'missing' }\n }\n try {\n const pkg = JSON.parse(readFileSync(fileURLToPath(resolved), 'utf8')) as { version?: unknown }\n const version = pkg.version\n if (typeof version !== 'string') return { major: 'unknown' }\n const major = Number.parseInt(version.split('.')[0] ?? '', 10)\n if (major === 3) return { major: 3 }\n if (major === 4) return { major: 4 }\n return { major: 'unknown' }\n } catch {\n return { major: 'unknown' }\n }\n}\n\n/**\n * One-shot latch so a plugin warns about an unclassifiable Zod version\n * only once, however many times its detection runs across a build.\n */\nexport interface ZodDetectionWarnState {\n warned: boolean\n}\n\nfunction missingZodError(tag: string): string {\n return (\n `[${tag}] zod is not installed. attaform requires zod as a peer dependency. ` +\n 'Install `zod@^3` or `zod@^4`, OR pass `attaform({ resolveZodAlias: false })` ' +\n 'to keep the runtime-dispatch unified entry (and silence this check).'\n )\n}\n\nfunction unclassifiableZodWarning(tag: string): string {\n return (\n `[${tag}] Could not classify the installed Zod major (corrupted package.json, ` +\n 'monorepo edge case, or an unexpected version string). Falling through to runtime ' +\n 'dispatch — both Zod adapters will ship in the bundle. ' +\n 'Pass `attaform({ resolveZodAlias: false })` to silence this warning.'\n )\n}\n\n/**\n * Resolve the rewrite target for the unified `attaform/zod` specifier,\n * shared by every bundler plugin so they diagnose identically:\n * - returns `attaform/zod-v3` / `attaform/zod-v4` when the consumer's\n * Zod major is detected;\n * - returns `null` to leave `attaform/zod` on its runtime-dispatch\n * entry, either because `resolveZodAlias` is off or because the\n * version could not be classified (warned once via `warnState`);\n * - throws when zod is not installed at all, a fatal misconfiguration\n * the consumer must fix.\n *\n * `tag` brands the diagnostics (`attaform/vite`, `attaform/rollup`, etc).\n * `resolveZodAlias` and `warnState` are supplied by the calling plugin:\n * its consumer-facing default and its per-instance warn latch live at the\n * plugin surface, not here.\n */\nexport function resolveZodAliasTarget(\n consumerRootDir: string,\n tag: string,\n resolveZodAlias: boolean,\n warnState: ZodDetectionWarnState\n): string | null {\n if (!resolveZodAlias) return null\n const detection = detectZodMajor(consumerRootDir)\n if (detection.major === 'missing') {\n throw new Error(missingZodError(tag))\n }\n if (detection.major === 'unknown') {\n if (!warnState.warned) {\n warnState.warned = true\n console.warn(unclassifiableZodWarning(tag))\n }\n return null\n }\n return detection.major === 4 ? ZOD_V4_SPECIFIER : ZOD_V3_SPECIFIER\n}\n"],"names":[],"mappings":";;;;AAqBO,MAAM,qBAAA,GAAwB;AAC9B,MAAM,gBAAA,GAAmB,iBAAA;AACzB,MAAM,gBAAA,GAAmB,iBAAA;AAqBzB,SAAS,eAAe,eAAA,EAA4C;AACzE,EAAA,MAAM,cAAc,aAAA,CAAc,IAAA,CAAK,eAAA,EAAiB,cAAc,CAAC,CAAA,CAAE,IAAA;AACzE,EAAA,IAAI,QAAA;AACJ,EAAA,IAAI;AACF,IAAA,QAAA,GAAW,MAAA,CAAA,IAAA,CAAY,OAAA,CAAQ,kBAAA,EAAoB,WAAW,CAAA;AAAA,EAChE,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAE,OAAO,SAAA,EAAU;AAAA,EAC5B;AACA,EAAA,IAAI;AACF,IAAA,MAAM,GAAA,GAAM,KAAK,KAAA,CAAM,YAAA,CAAa,cAAc,QAAQ,CAAA,EAAG,MAAM,CAAC,CAAA;AACpE,IAAA,MAAM,UAAU,GAAA,CAAI,OAAA;AACpB,IAAA,IAAI,OAAO,OAAA,KAAY,QAAA,EAAU,OAAO,EAAE,OAAO,SAAA,EAAU;AAC3D,IAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,QAAA,CAAS,OAAA,CAAQ,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,IAAK,EAAA,EAAI,EAAE,CAAA;AAC7D,IAAA,IAAI,KAAA,KAAU,CAAA,EAAG,OAAO,EAAE,OAAO,CAAA,EAAE;AACnC,IAAA,IAAI,KAAA,KAAU,CAAA,EAAG,OAAO,EAAE,OAAO,CAAA,EAAE;AACnC,IAAA,OAAO,EAAE,OAAO,SAAA,EAAU;AAAA,EAC5B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,EAAE,OAAO,SAAA,EAAU;AAAA,EAC5B;AACF;AAUA,SAAS,gBAAgB,GAAA,EAAqB;AAC5C,EAAA,OACE,IAAI,GAAG,CAAA,2NAAA,CAAA;AAIX;AAEA,SAAS,yBAAyB,GAAA,EAAqB;AACrD,EAAA,OACE,IAAI,GAAG,CAAA,wRAAA,CAAA;AAKX;AAkBO,SAAS,qBAAA,CACd,eAAA,EACA,GAAA,EACA,eAAA,EACA,SAAA,EACe;AACf,EAAA,IAAI,CAAC,iBAAiB,OAAO,IAAA;AAC7B,EAAA,MAAM,SAAA,GAAY,eAAe,eAAe,CAAA;AAChD,EAAA,IAAI,SAAA,CAAU,UAAU,SAAA,EAAW;AACjC,IAAA,MAAM,IAAI,KAAA,CAAM,eAAA,CAAgB,GAAG,CAAC,CAAA;AAAA,EACtC;AACA,EAAA,IAAI,SAAA,CAAU,UAAU,SAAA,EAAW;AACjC,IAAA,IAAI,CAAC,UAAU,MAAA,EAAQ;AACrB,MAAA,SAAA,CAAU,MAAA,GAAS,IAAA;AACnB,MAAA,OAAA,CAAQ,IAAA,CAAK,wBAAA,CAAyB,GAAG,CAAC,CAAA;AAAA,IAC5C;AACA,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,OAAO,SAAA,CAAU,KAAA,KAAU,CAAA,GAAI,gBAAA,GAAmB,gBAAA;AACpD;;;;"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const paths = require('./attaform.3heDHayA.cjs');
|
|
4
|
-
|
|
5
|
-
function renderAttaformState(app) {
|
|
6
|
-
const registry = paths.getRegistryFromApp(app);
|
|
7
|
-
const forms = [];
|
|
8
|
-
for (const [key, state] of registry.forms) {
|
|
9
|
-
const transientList = [];
|
|
10
|
-
for (const pk of state.blankPaths) {
|
|
11
|
-
const d = paths.pathKeyToDotted(pk);
|
|
12
|
-
if (d !== null) transientList.push(d);
|
|
13
|
-
}
|
|
14
|
-
forms.push([
|
|
15
|
-
key,
|
|
16
|
-
{
|
|
17
|
-
form: state.form.value,
|
|
18
|
-
schemaErrors: Array.from(state.schemaErrors.entries()),
|
|
19
|
-
userErrors: Array.from(state.userErrors.entries()),
|
|
20
|
-
fields: Array.from(state.fields.entries()),
|
|
21
|
-
...transientList.length > 0 ? { blankPaths: transientList } : {}
|
|
22
|
-
}
|
|
23
|
-
]);
|
|
24
|
-
}
|
|
25
|
-
return { forms };
|
|
26
|
-
}
|
|
27
|
-
function hydrateAttaformState(app, payload) {
|
|
28
|
-
const registry = paths.getRegistryFromApp(app);
|
|
29
|
-
for (const [key, data] of payload.forms) {
|
|
30
|
-
registry.pendingHydration.set(key, data);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const DEVTOOLS_WINDOW_KEY = "__attaform_devtools__";
|
|
35
|
-
|
|
36
|
-
exports.DEVTOOLS_WINDOW_KEY = DEVTOOLS_WINDOW_KEY;
|
|
37
|
-
exports.hydrateAttaformState = hydrateAttaformState;
|
|
38
|
-
exports.renderAttaformState = renderAttaformState;
|
|
39
|
-
//# sourceMappingURL=attaform.xBDo0Ko0.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attaform.xBDo0Ko0.cjs","sources":["../../src/runtime/core/serialize.ts","../../src/runtime/core/devtools-shared.ts"],"sourcesContent":["import type { App } from 'vue'\nimport type { FormKey } from '../types/types-api'\nimport { pathKeyToDotted, type PathKey } from './paths'\nimport { getRegistryFromApp, type SerializedFormData } from './registry'\n\n/**\n * Serialised snapshot of every form in a Vue app, produced by\n * `renderAttaformState` and consumed by `hydrateAttaformState`.\n *\n * JSON-safe — pass to `JSON.stringify`, `devalue`, or any other\n * serialiser before embedding in your SSR payload.\n */\nexport type SerializedAttaformState = {\n /** Tuples of `[formKey, snapshot]` for every form in the app. */\n readonly forms: ReadonlyArray<readonly [FormKey, SerializedFormData]>\n}\n\n/**\n * Snapshot every form on a Vue app for SSR. Call from your server\n * entry after rendering the app:\n *\n * ```ts\n * import { renderToString } from '@vue/server-renderer'\n * import { renderAttaformState, escapeForInlineScript } from 'attaform'\n *\n * const html = await renderToString(app)\n * const state = renderAttaformState(app)\n * const payload = escapeForInlineScript(JSON.stringify(state))\n *\n * return `\n * ${html}\n * <script>window.__ATTAFORM_STATE__ = ${payload}</script>\n * `\n * ```\n *\n * Pair with `hydrateAttaformState` on the client to restore the\n * forms in their server-rendered state. Nuxt users don't need this —\n * `attaform/nuxt` wires SSR automatically.\n */\nexport function renderAttaformState(app: App): SerializedAttaformState {\n const registry = getRegistryFromApp(app)\n const forms: Array<readonly [FormKey, SerializedFormData]> = []\n for (const [key, state] of registry.forms) {\n // Skip the blank field when the set is empty so the\n // wire payload stays minimal for forms that don't use it. The\n // optional shape on the consuming side handles the absence\n // cleanly (defaults to \"no blank paths\"). PathKey → dotted at\n // the boundary so the wire shape matches the rest of the\n // public path notation.\n const transientList: string[] = []\n for (const pk of state.blankPaths) {\n const d = pathKeyToDotted(pk as PathKey)\n if (d !== null) transientList.push(d)\n }\n forms.push([\n key,\n {\n form: state.form.value,\n schemaErrors: Array.from(state.schemaErrors.entries()),\n userErrors: Array.from(state.userErrors.entries()),\n fields: Array.from(state.fields.entries()),\n ...(transientList.length > 0 ? { blankPaths: transientList } : {}),\n },\n ])\n }\n return { forms }\n}\n\n/**\n * Restore forms from a server-rendered snapshot on the client. Call\n * from your client entry before mounting:\n *\n * ```ts\n * import { createApp } from 'vue'\n * import { createAttaform, hydrateAttaformState } from 'attaform'\n *\n * const app = createApp(App).use(createAttaform())\n * hydrateAttaformState(app, window.__ATTAFORM_STATE__)\n * app.mount('#app')\n * ```\n *\n * The next `useForm({ key })` call for each serialised form picks up\n * the snapshot transparently — no further action is required.\n */\nexport function hydrateAttaformState(app: App, payload: SerializedAttaformState): void {\n const registry = getRegistryFromApp(app)\n for (const [key, data] of payload.forms) {\n registry.pendingHydration.set(key, data)\n }\n}\n","/**\n * Shared building blocks for Attaform's two devtools surfaces — the Vue\n * DevTools (Chrome-extension) inspector wired up in `./devtools.ts`, and\n * the Nuxt DevTools (overlay) panel wired up via `../../nuxt.ts` +\n * `../pages/_attaform_devtools.vue`.\n *\n * Houses the window-bridge contract both surfaces consume so a new\n * bridge field lands in one file. Both surfaces render RAW form values\n * by design — DevTools is a dev-only surface, and redaction across every\n * place a value surfaces is impractical security theater rather than a\n * real safeguard.\n */\nimport type { AttaformRegistry } from './registry'\n\n/**\n * Property key on `window` that the Nuxt-side dev plugin attaches the\n * bridge object to. The iframe-mounted overlay panel reads\n * `window.parent[DEVTOOLS_WINDOW_KEY]` to reach the host app's registry.\n *\n * Underscored + namespaced to make accidental collision with consumer\n * globals vanishingly unlikely. Stable across versions — bumping it\n * would silently disconnect older library builds from newer overlay\n * panels in the same browser tab during a library upgrade.\n */\nexport const DEVTOOLS_WINDOW_KEY = '__attaform_devtools__'\n\n/**\n * Shape of the object the host plugin attaches to `window` in dev mode.\n * The iframe overlay panel reads this to discover the live registry and\n * render its forms.\n *\n * Single-registry assumption: the latest `createAttaform()` install\n * wins. Multi-app pages (rare; typically only seen in micro-frontend\n * setups) will only see one app's forms in the panel. Documented but\n * not actively supported — the alternative (a Set of registries with\n * union-rendering) is a future call if a real consumer hits it.\n */\nexport interface AttaformDevtoolsBridge {\n registry: AttaformRegistry\n /**\n * The library version, surfaced in the panel's footer for support /\n * bug-report context. Read from `package.json` at host-plugin init.\n */\n version: string\n}\n\ndeclare global {\n interface Window {\n [DEVTOOLS_WINDOW_KEY]?: AttaformDevtoolsBridge\n }\n}\n"],"names":["getRegistryFromApp","pathKeyToDotted"],"mappings":";;;;AAuCO,SAAS,oBAAoB,GAAA,EAAmC;AACrE,EAAA,MAAM,QAAA,GAAWA,yBAAmB,GAAG,CAAA;AACvC,EAAA,MAAM,QAAuD,EAAC;AAC9D,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,CAAA,IAAK,SAAS,KAAA,EAAO;AAOzC,IAAA,MAAM,gBAA0B,EAAC;AACjC,IAAA,KAAA,MAAW,EAAA,IAAM,MAAM,UAAA,EAAY;AACjC,MAAA,MAAM,CAAA,GAAIC,sBAAgB,EAAa,CAAA;AACvC,MAAA,IAAI,CAAA,KAAM,IAAA,EAAM,aAAA,CAAc,IAAA,CAAK,CAAC,CAAA;AAAA,IACtC;AACA,IAAA,KAAA,CAAM,IAAA,CAAK;AAAA,MACT,GAAA;AAAA,MACA;AAAA,QACE,IAAA,EAAM,MAAM,IAAA,CAAK,KAAA;AAAA,QACjB,cAAc,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,YAAA,CAAa,SAAS,CAAA;AAAA,QACrD,YAAY,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,UAAA,CAAW,SAAS,CAAA;AAAA,QACjD,QAAQ,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,MAAA,CAAO,SAAS,CAAA;AAAA,QACzC,GAAI,cAAc,MAAA,GAAS,CAAA,GAAI,EAAE,UAAA,EAAY,aAAA,KAAkB;AAAC;AAClE,KACD,CAAA;AAAA,EACH;AACA,EAAA,OAAO,EAAE,KAAA,EAAM;AACjB;AAkBO,SAAS,oBAAA,CAAqB,KAAU,OAAA,EAAwC;AACrF,EAAA,MAAM,QAAA,GAAWD,yBAAmB,GAAG,CAAA;AACvC,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,IAAI,CAAA,IAAK,QAAQ,KAAA,EAAO;AACvC,IAAA,QAAA,CAAS,gBAAA,CAAiB,GAAA,CAAI,GAAA,EAAK,IAAI,CAAA;AAAA,EACzC;AACF;;ACjEO,MAAM,mBAAA,GAAsB;;;;;;"}
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Peel `.optional()` / `.nullable()` / `.default()` / `.refine()` /
|
|
5
|
-
* `.transform()` wrappers off a Zod v3 schema to reach the form root,
|
|
6
|
-
* then return it: a `ZodObject` (fixed-shape form), a `ZodRecord`
|
|
7
|
-
* (dictionary form), or a `ZodDiscriminatedUnion` (variant form).
|
|
8
|
-
* Returns `never` for any other root, which makes the `useForm`
|
|
9
|
-
* projections collapse to `never` so the call fails to typecheck
|
|
10
|
-
* rather than producing a misshapen form type.
|
|
11
|
-
*
|
|
12
|
-
* Used internally by the v3 `useForm` overload to project an arbitrary
|
|
13
|
-
* supported root to its input / output / storage-read shapes.
|
|
14
|
-
*/
|
|
15
|
-
type UnwrapZodRoot<T> = T extends z.ZodEffects<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodOptional<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodNullable<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodDefault<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodObject<infer Shape> ? z.ZodObject<Shape> : T extends z.ZodRecord<infer Key, infer Value> ? z.ZodRecord<Key, Value> : T extends z.ZodDiscriminatedUnion<infer Disc, infer Options> ? z.ZodDiscriminatedUnion<Disc, Options> : never;
|
|
16
|
-
|
|
17
3
|
/**
|
|
18
4
|
* The Zod v3 schema roots `useForm` accepts. Mirror of the v4
|
|
19
5
|
* `SupportedRootSchema`, expressed in v3's type vocabulary: a
|
|
@@ -53,4 +39,18 @@ type StorageShape<S extends z.ZodTypeAny> = S extends z.ZodObject<infer Shape> ?
|
|
|
53
39
|
[K in keyof Shape]-?: Shape[K] extends z.ZodEffects<z.ZodTypeAny> | z.ZodPipeline<z.ZodTypeAny, z.ZodTypeAny> ? z.input<Shape[K]> : z.output<Shape[K]>;
|
|
54
40
|
} : z.input<S>;
|
|
55
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Peel `.optional()` / `.nullable()` / `.default()` / `.refine()` /
|
|
44
|
+
* `.transform()` wrappers off a Zod v3 schema to reach the form root,
|
|
45
|
+
* then return it: a `ZodObject` (fixed-shape form), a `ZodRecord`
|
|
46
|
+
* (dictionary form), or a `ZodDiscriminatedUnion` (variant form).
|
|
47
|
+
* Returns `never` for any other root, which makes the `useForm`
|
|
48
|
+
* projections collapse to `never` so the call fails to typecheck
|
|
49
|
+
* rather than producing a misshapen form type.
|
|
50
|
+
*
|
|
51
|
+
* Used internally by the v3 `useForm` overload to project an arbitrary
|
|
52
|
+
* supported root to its input / output / storage-read shapes.
|
|
53
|
+
*/
|
|
54
|
+
type UnwrapZodRoot<T> = T extends z.ZodEffects<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodOptional<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodNullable<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodDefault<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodObject<infer Shape> ? z.ZodObject<Shape> : T extends z.ZodRecord<infer Key, infer Value> ? z.ZodRecord<Key, Value> : T extends z.ZodDiscriminatedUnion<infer Disc, infer Options> ? z.ZodDiscriminatedUnion<Disc, Options> : never;
|
|
55
|
+
|
|
56
56
|
export type { SupportedRootSchema as S, UnwrapZodRoot as U, StorageShape as a };
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Peel `.optional()` / `.nullable()` / `.default()` / `.refine()` /
|
|
5
|
-
* `.transform()` wrappers off a Zod v3 schema to reach the form root,
|
|
6
|
-
* then return it: a `ZodObject` (fixed-shape form), a `ZodRecord`
|
|
7
|
-
* (dictionary form), or a `ZodDiscriminatedUnion` (variant form).
|
|
8
|
-
* Returns `never` for any other root, which makes the `useForm`
|
|
9
|
-
* projections collapse to `never` so the call fails to typecheck
|
|
10
|
-
* rather than producing a misshapen form type.
|
|
11
|
-
*
|
|
12
|
-
* Used internally by the v3 `useForm` overload to project an arbitrary
|
|
13
|
-
* supported root to its input / output / storage-read shapes.
|
|
14
|
-
*/
|
|
15
|
-
type UnwrapZodRoot<T> = T extends z.ZodEffects<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodOptional<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodNullable<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodDefault<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodObject<infer Shape> ? z.ZodObject<Shape> : T extends z.ZodRecord<infer Key, infer Value> ? z.ZodRecord<Key, Value> : T extends z.ZodDiscriminatedUnion<infer Disc, infer Options> ? z.ZodDiscriminatedUnion<Disc, Options> : never;
|
|
16
|
-
|
|
17
3
|
/**
|
|
18
4
|
* The Zod v3 schema roots `useForm` accepts. Mirror of the v4
|
|
19
5
|
* `SupportedRootSchema`, expressed in v3's type vocabulary: a
|
|
@@ -53,4 +39,18 @@ type StorageShape<S extends z.ZodTypeAny> = S extends z.ZodObject<infer Shape> ?
|
|
|
53
39
|
[K in keyof Shape]-?: Shape[K] extends z.ZodEffects<z.ZodTypeAny> | z.ZodPipeline<z.ZodTypeAny, z.ZodTypeAny> ? z.input<Shape[K]> : z.output<Shape[K]>;
|
|
54
40
|
} : z.input<S>;
|
|
55
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Peel `.optional()` / `.nullable()` / `.default()` / `.refine()` /
|
|
44
|
+
* `.transform()` wrappers off a Zod v3 schema to reach the form root,
|
|
45
|
+
* then return it: a `ZodObject` (fixed-shape form), a `ZodRecord`
|
|
46
|
+
* (dictionary form), or a `ZodDiscriminatedUnion` (variant form).
|
|
47
|
+
* Returns `never` for any other root, which makes the `useForm`
|
|
48
|
+
* projections collapse to `never` so the call fails to typecheck
|
|
49
|
+
* rather than producing a misshapen form type.
|
|
50
|
+
*
|
|
51
|
+
* Used internally by the v3 `useForm` overload to project an arbitrary
|
|
52
|
+
* supported root to its input / output / storage-read shapes.
|
|
53
|
+
*/
|
|
54
|
+
type UnwrapZodRoot<T> = T extends z.ZodEffects<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodOptional<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodNullable<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodDefault<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodObject<infer Shape> ? z.ZodObject<Shape> : T extends z.ZodRecord<infer Key, infer Value> ? z.ZodRecord<Key, Value> : T extends z.ZodDiscriminatedUnion<infer Disc, infer Options> ? z.ZodDiscriminatedUnion<Disc, Options> : never;
|
|
55
|
+
|
|
56
56
|
export type { SupportedRootSchema as S, UnwrapZodRoot as U, StorageShape as a };
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Peel `.optional()` / `.nullable()` / `.default()` / `.refine()` /
|
|
5
|
-
* `.transform()` wrappers off a Zod v3 schema to reach the form root,
|
|
6
|
-
* then return it: a `ZodObject` (fixed-shape form), a `ZodRecord`
|
|
7
|
-
* (dictionary form), or a `ZodDiscriminatedUnion` (variant form).
|
|
8
|
-
* Returns `never` for any other root, which makes the `useForm`
|
|
9
|
-
* projections collapse to `never` so the call fails to typecheck
|
|
10
|
-
* rather than producing a misshapen form type.
|
|
11
|
-
*
|
|
12
|
-
* Used internally by the v3 `useForm` overload to project an arbitrary
|
|
13
|
-
* supported root to its input / output / storage-read shapes.
|
|
14
|
-
*/
|
|
15
|
-
type UnwrapZodRoot<T> = T extends z.ZodEffects<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodOptional<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodNullable<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodDefault<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodObject<infer Shape> ? z.ZodObject<Shape> : T extends z.ZodRecord<infer Key, infer Value> ? z.ZodRecord<Key, Value> : T extends z.ZodDiscriminatedUnion<infer Disc, infer Options> ? z.ZodDiscriminatedUnion<Disc, Options> : never;
|
|
16
|
-
|
|
17
3
|
/**
|
|
18
4
|
* The Zod v3 schema roots `useForm` accepts. Mirror of the v4
|
|
19
5
|
* `SupportedRootSchema`, expressed in v3's type vocabulary: a
|
|
@@ -53,4 +39,18 @@ type StorageShape<S extends z.ZodTypeAny> = S extends z.ZodObject<infer Shape> ?
|
|
|
53
39
|
[K in keyof Shape]-?: Shape[K] extends z.ZodEffects<z.ZodTypeAny> | z.ZodPipeline<z.ZodTypeAny, z.ZodTypeAny> ? z.input<Shape[K]> : z.output<Shape[K]>;
|
|
54
40
|
} : z.input<S>;
|
|
55
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Peel `.optional()` / `.nullable()` / `.default()` / `.refine()` /
|
|
44
|
+
* `.transform()` wrappers off a Zod v3 schema to reach the form root,
|
|
45
|
+
* then return it: a `ZodObject` (fixed-shape form), a `ZodRecord`
|
|
46
|
+
* (dictionary form), or a `ZodDiscriminatedUnion` (variant form).
|
|
47
|
+
* Returns `never` for any other root, which makes the `useForm`
|
|
48
|
+
* projections collapse to `never` so the call fails to typecheck
|
|
49
|
+
* rather than producing a misshapen form type.
|
|
50
|
+
*
|
|
51
|
+
* Used internally by the v3 `useForm` overload to project an arbitrary
|
|
52
|
+
* supported root to its input / output / storage-read shapes.
|
|
53
|
+
*/
|
|
54
|
+
type UnwrapZodRoot<T> = T extends z.ZodEffects<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodOptional<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodNullable<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodDefault<infer Inner> ? UnwrapZodRoot<Inner> : T extends z.ZodObject<infer Shape> ? z.ZodObject<Shape> : T extends z.ZodRecord<infer Key, infer Value> ? z.ZodRecord<Key, Value> : T extends z.ZodDiscriminatedUnion<infer Disc, infer Options> ? z.ZodDiscriminatedUnion<Disc, Options> : never;
|
|
55
|
+
|
|
56
56
|
export type { SupportedRootSchema as S, UnwrapZodRoot as U, StorageShape as a };
|