attaform 0.24.0 → 0.24.2
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 +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 +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 +4 -3
- package/dist/index.mjs.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/runtime/plugins/attaform.cjs +2 -2
- package/dist/runtime/plugins/attaform.mjs +2 -2
- package/dist/shared/{attaform.CAWKNCzc.mjs → attaform.0-00cYGw.mjs} +2 -2
- package/dist/shared/{attaform.CAWKNCzc.mjs.map → attaform.0-00cYGw.mjs.map} +1 -1
- package/dist/shared/{attaform.DdUYEhkV.d.cts → attaform.0zueP54D.d.mts} +33 -15
- package/dist/shared/{attaform.Z1qTwOYE.cjs → attaform.B57G7ePY.cjs} +4 -4
- package/dist/shared/{attaform.BJ_W7q3U.mjs.map → attaform.B57G7ePY.cjs.map} +1 -1
- package/dist/shared/{attaform.DwkU0oY9.cjs → attaform.B7UdTs_o.cjs} +79 -75
- package/dist/shared/attaform.B7UdTs_o.cjs.map +1 -0
- package/dist/shared/{attaform.CuBdtfbe.mjs → attaform.BI7M3wK8.mjs} +88 -16
- package/dist/shared/attaform.BI7M3wK8.mjs.map +1 -0
- package/dist/shared/{attaform.nycEksJn.cjs → attaform.BOi6n2Pn.cjs} +2 -2
- package/dist/shared/{attaform.nycEksJn.cjs.map → attaform.BOi6n2Pn.cjs.map} +1 -1
- package/dist/shared/{attaform.BJ_W7q3U.mjs → attaform.B_-nZHtM.mjs} +4 -4
- package/dist/shared/{attaform.Z1qTwOYE.cjs.map → attaform.B_-nZHtM.mjs.map} +1 -1
- package/dist/shared/{attaform.o95Kjd3U.mjs → attaform.BjUaX7s8.mjs} +3 -3
- package/dist/shared/{attaform.o95Kjd3U.mjs.map → attaform.BjUaX7s8.mjs.map} +1 -1
- package/dist/shared/{attaform.BNmkKz0q.d.mts → attaform.BjiHiYAZ.d.ts} +3 -2
- package/dist/shared/{attaform.C42wL7EJ.cjs → attaform.Bos7wVZw.cjs} +90 -18
- package/dist/shared/attaform.Bos7wVZw.cjs.map +1 -0
- package/dist/shared/{attaform.CwFZGv5-.d.ts → attaform.Bx6pgrIy.d.cts} +3 -2
- package/dist/shared/{attaform.Df-s8j1X.mjs → attaform.C0au8oXd.mjs} +36 -29
- package/dist/shared/attaform.C0au8oXd.mjs.map +1 -0
- package/dist/shared/attaform.CjdepGnw.cjs +27 -0
- package/dist/shared/attaform.CjdepGnw.cjs.map +1 -0
- package/dist/shared/{attaform.BnUXV01g.cjs → attaform.D-gYGj5z.cjs} +4 -4
- package/dist/shared/{attaform.C-dAB90u.mjs.map → attaform.D-gYGj5z.cjs.map} +1 -1
- package/dist/shared/{attaform.C6eE50re.d.ts → attaform.DHjRN5JP.d.cts} +33 -15
- package/dist/shared/{attaform.CR6wGvNu.cjs → attaform.DK6_Ctv7.cjs} +10 -4
- package/dist/shared/attaform.DK6_Ctv7.cjs.map +1 -0
- package/dist/shared/{attaform.GJbSmwLB.d.mts → attaform.DUc6cetN.d.cts} +62 -13
- package/dist/shared/{attaform.GJbSmwLB.d.cts → attaform.DUc6cetN.d.mts} +62 -13
- package/dist/shared/{attaform.GJbSmwLB.d.ts → attaform.DUc6cetN.d.ts} +62 -13
- package/dist/shared/{attaform.BV_HyaMO.cjs → attaform.DdfLrIgM.cjs} +3 -3
- package/dist/shared/{attaform.BV_HyaMO.cjs.map → attaform.DdfLrIgM.cjs.map} +1 -1
- package/dist/shared/{attaform.K-3glmiT.d.cts → attaform.DvqdxvNU.d.mts} +3 -2
- package/dist/shared/{attaform.BFWb6hDk.mjs → attaform.DwCtxauq.mjs} +10 -4
- package/dist/shared/attaform.DwCtxauq.mjs.map +1 -0
- package/dist/shared/{attaform.C-dAB90u.mjs → attaform.K1MbxmIu.mjs} +4 -4
- package/dist/shared/{attaform.BnUXV01g.cjs.map → attaform.K1MbxmIu.mjs.map} +1 -1
- package/dist/shared/attaform.WvcckZMD.mjs +21 -0
- package/dist/shared/attaform.WvcckZMD.mjs.map +1 -0
- package/dist/shared/{attaform.DiWNbKWa.d.mts → attaform.yqcYwt0d.d.ts} +33 -15
- package/dist/transforms.cjs +1 -1
- package/dist/transforms.d.cts +4 -1
- package/dist/transforms.d.mts +4 -1
- package/dist/transforms.d.ts +4 -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 +8 -5
- package/dist/zod-v3.d.mts +8 -5
- package/dist/zod-v3.d.ts +8 -5
- 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.cjs.map +1 -1
- package/dist/zod.d.cts +23 -7
- package/dist/zod.d.mts +23 -7
- package/dist/zod.d.ts +23 -7
- package/dist/zod.mjs +5 -5
- package/dist/zod.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/shared/attaform.BFWb6hDk.mjs.map +0 -1
- package/dist/shared/attaform.C42wL7EJ.cjs.map +0 -1
- package/dist/shared/attaform.CR6wGvNu.cjs.map +0 -1
- package/dist/shared/attaform.CuBdtfbe.mjs.map +0 -1
- package/dist/shared/attaform.Df-s8j1X.mjs.map +0 -1
- package/dist/shared/attaform.DwkU0oY9.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const paths = require('./attaform.
|
|
3
|
+
const paths = require('./attaform.B7UdTs_o.cjs');
|
|
4
4
|
|
|
5
5
|
function renderAttaformState(app) {
|
|
6
6
|
const registry = paths.getRegistryFromApp(app);
|
|
@@ -36,4 +36,4 @@ const DEVTOOLS_WINDOW_KEY = "__attaform_devtools__";
|
|
|
36
36
|
exports.DEVTOOLS_WINDOW_KEY = DEVTOOLS_WINDOW_KEY;
|
|
37
37
|
exports.hydrateAttaformState = hydrateAttaformState;
|
|
38
38
|
exports.renderAttaformState = renderAttaformState;
|
|
39
|
-
//# sourceMappingURL=attaform.
|
|
39
|
+
//# sourceMappingURL=attaform.BOi6n2Pn.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attaform.
|
|
1
|
+
{"version":3,"file":"attaform.BOi6n2Pn.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,6 +1,6 @@
|
|
|
1
|
-
import { f as fieldMetaStore, g as getFieldMetaForSchema, a as getFieldMetaListForSchema, s as slimPrimitivesWalk, c as createAbstractSchema, w as walkPathSegments, d as deriveDefaultWalk, b as getFieldMetaPathMap, m as mergeDeep, p as peelEmbeddedDefault, N as NO_EMBEDDED_DEFAULT } from './attaform.
|
|
2
|
-
import { o as humanize, p as getAtPath, n as slimKindOf, q as setAtPath, h as useAbstractForm } from './attaform.
|
|
3
|
-
import { A as AttaformError, _ as __DEV__, f as canonicalizePath, a as InvalidUseFormConfigError } from './attaform.
|
|
1
|
+
import { f as fieldMetaStore, g as getFieldMetaForSchema, a as getFieldMetaListForSchema, s as slimPrimitivesWalk, c as createAbstractSchema, w as walkPathSegments, d as deriveDefaultWalk, b as getFieldMetaPathMap, m as mergeDeep, p as peelEmbeddedDefault, N as NO_EMBEDDED_DEFAULT } from './attaform.BjUaX7s8.mjs';
|
|
2
|
+
import { o as humanize, p as getAtPath, n as slimKindOf, q as setAtPath, h as useAbstractForm } from './attaform.BI7M3wK8.mjs';
|
|
3
|
+
import { A as AttaformError, _ as __DEV__, f as canonicalizePath, a as InvalidUseFormConfigError } from './attaform.C0au8oXd.mjs';
|
|
4
4
|
|
|
5
5
|
const fieldMeta = fieldMetaStore;
|
|
6
6
|
function withMeta(schema, payload) {
|
|
@@ -1628,4 +1628,4 @@ function useForm(configuration) {
|
|
|
1628
1628
|
}
|
|
1629
1629
|
|
|
1630
1630
|
export { fieldMeta as f, isZodSchemaType as i, useForm as u, withMeta as w, zodAdapter as z };
|
|
1631
|
-
//# sourceMappingURL=attaform.
|
|
1631
|
+
//# sourceMappingURL=attaform.B_-nZHtM.mjs.map
|