@vielzeug/forge 3.1.0 → 3.1.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/_field.cjs +1 -1
- package/dist/_field.cjs.map +1 -1
- package/dist/_field.js +1 -63
- package/dist/_field.js.map +1 -1
- package/dist/_notify.cjs +1 -1
- package/dist/_notify.cjs.map +1 -1
- package/dist/_notify.js +1 -52
- package/dist/_notify.js.map +1 -1
- package/dist/core/path.cjs +1 -1
- package/dist/core/path.cjs.map +1 -1
- package/dist/core/path.js +1 -219
- package/dist/core/path.js.map +1 -1
- package/dist/dom.cjs +1 -1
- package/dist/dom.cjs.map +1 -1
- package/dist/dom.js +1 -23
- package/dist/dom.js.map +1 -1
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +0 -5
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -21
- package/dist/errors.js.map +1 -1
- package/dist/forge.cjs +1 -1
- package/dist/forge.cjs.map +1 -1
- package/dist/forge.iife.js +1 -1
- package/dist/forge.iife.js.map +1 -1
- package/dist/forge.js +1 -1
- package/dist/forge.js.map +1 -1
- package/dist/form-data.cjs +1 -1
- package/dist/form-data.cjs.map +1 -1
- package/dist/form-data.js +1 -29
- package/dist/form-data.js.map +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.cjs.map +1 -1
- package/dist/form.js +1 -236
- package/dist/form.js.map +1 -1
- package/dist/index.js +1 -4
- package/dist/persist.cjs +1 -1
- package/dist/persist.cjs.map +1 -1
- package/dist/persist.js +1 -18
- package/dist/persist.js.map +1 -1
- package/dist/plain.cjs +1 -1
- package/dist/plain.cjs.map +1 -1
- package/dist/plain.js +1 -8
- package/dist/plain.js.map +1 -1
- package/dist/schema.cjs +1 -1
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.js +1 -25
- package/dist/schema.js.map +1 -1
- package/package.json +6 -6
package/dist/plain.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plain.cjs","names":[],"sources":["../src/plain.ts"],"sourcesContent":["import { toPlainValues as flattenValue } from './core/path.js';\n\n/**\n * Deeply converts a value into the plain shape Forge accepts: primitives pass through,\n * `Date` is cloned, `File`/`Blob` keep identity, arrays map, and class instances flatten to\n * their own enumerable entries. Unsafe keys (`__proto__`, `constructor`, `prototype`) are\n * dropped, so the output always passes value validation. Use as the `normalize` option of\n * `createForm` to hold domain-model classes in form state.\n *\n * Lossy conversions, applied instead of the error an un-normalized write would throw:\n * `Map`, `Set`, and other keyless built-ins flatten to `{}` (their entries live on the\n * prototype); sparse array slots are dropped, which shifts later indexes; `NaN`, `Infinity`,\n * functions, and circular branches become `undefined`. Normalize model classes, not\n * arbitrary graphs. The type parameter is a convenience cast — the flattened shape differs\n * from the input type whenever class instances are present.\n *\n * This is a public wrapper so the emitted declaration does not name `@vielzeug/arsenal`\n * symbols: exporting the `core/path.ts` original directly pulls arsenal's extensionless\n * re-exports into the NodeNext declaration graph that `test:types` compiles. Keep the\n * implementation in `core/path.ts` beside the `immutable()` leaf rules it mirrors.\n */\nexport function toPlainValues<T>(value: T): T {\n return flattenValue(value);\n}\n"],"mappings":"mCAqBA,SAAgB,
|
|
1
|
+
{"version":3,"file":"plain.cjs","names":[],"sources":["../src/plain.ts"],"sourcesContent":["import { toPlainValues as flattenValue } from './core/path.js';\n\n/**\n * Deeply converts a value into the plain shape Forge accepts: primitives pass through,\n * `Date` is cloned, `File`/`Blob` keep identity, arrays map, and class instances flatten to\n * their own enumerable entries. Unsafe keys (`__proto__`, `constructor`, `prototype`) are\n * dropped, so the output always passes value validation. Use as the `normalize` option of\n * `createForm` to hold domain-model classes in form state.\n *\n * Lossy conversions, applied instead of the error an un-normalized write would throw:\n * `Map`, `Set`, and other keyless built-ins flatten to `{}` (their entries live on the\n * prototype); sparse array slots are dropped, which shifts later indexes; `NaN`, `Infinity`,\n * functions, and circular branches become `undefined`. Normalize model classes, not\n * arbitrary graphs. The type parameter is a convenience cast — the flattened shape differs\n * from the input type whenever class instances are present.\n *\n * This is a public wrapper so the emitted declaration does not name `@vielzeug/arsenal`\n * symbols: exporting the `core/path.ts` original directly pulls arsenal's extensionless\n * re-exports into the NodeNext declaration graph that `test:types` compiles. Keep the\n * implementation in `core/path.ts` beside the `immutable()` leaf rules it mirrors.\n */\nexport function toPlainValues<T>(value: T): T {\n return flattenValue(value);\n}\n"],"mappings":"mCAqBA,SAAgB,cAAiB,EAAa,CAC5C,OAAO,EAAA,cAAa,CAAK,CAC3B"}
|
package/dist/plain.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/plain.ts
|
|
3
|
-
function t(t) {
|
|
4
|
-
return e(t);
|
|
5
|
-
}
|
|
6
|
-
//#endregion
|
|
7
|
-
export { t as toPlainValues };
|
|
8
|
-
|
|
1
|
+
import{toPlainValues as e}from"./core/path.js";function toPlainValues(t){return e(t)}export{toPlainValues};
|
|
9
2
|
//# sourceMappingURL=plain.js.map
|
package/dist/plain.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plain.js","names":[],"sources":["../src/plain.ts"],"sourcesContent":["import { toPlainValues as flattenValue } from './core/path.js';\n\n/**\n * Deeply converts a value into the plain shape Forge accepts: primitives pass through,\n * `Date` is cloned, `File`/`Blob` keep identity, arrays map, and class instances flatten to\n * their own enumerable entries. Unsafe keys (`__proto__`, `constructor`, `prototype`) are\n * dropped, so the output always passes value validation. Use as the `normalize` option of\n * `createForm` to hold domain-model classes in form state.\n *\n * Lossy conversions, applied instead of the error an un-normalized write would throw:\n * `Map`, `Set`, and other keyless built-ins flatten to `{}` (their entries live on the\n * prototype); sparse array slots are dropped, which shifts later indexes; `NaN`, `Infinity`,\n * functions, and circular branches become `undefined`. Normalize model classes, not\n * arbitrary graphs. The type parameter is a convenience cast — the flattened shape differs\n * from the input type whenever class instances are present.\n *\n * This is a public wrapper so the emitted declaration does not name `@vielzeug/arsenal`\n * symbols: exporting the `core/path.ts` original directly pulls arsenal's extensionless\n * re-exports into the NodeNext declaration graph that `test:types` compiles. Keep the\n * implementation in `core/path.ts` beside the `immutable()` leaf rules it mirrors.\n */\nexport function toPlainValues<T>(value: T): T {\n return flattenValue(value);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plain.js","names":[],"sources":["../src/plain.ts"],"sourcesContent":["import { toPlainValues as flattenValue } from './core/path.js';\n\n/**\n * Deeply converts a value into the plain shape Forge accepts: primitives pass through,\n * `Date` is cloned, `File`/`Blob` keep identity, arrays map, and class instances flatten to\n * their own enumerable entries. Unsafe keys (`__proto__`, `constructor`, `prototype`) are\n * dropped, so the output always passes value validation. Use as the `normalize` option of\n * `createForm` to hold domain-model classes in form state.\n *\n * Lossy conversions, applied instead of the error an un-normalized write would throw:\n * `Map`, `Set`, and other keyless built-ins flatten to `{}` (their entries live on the\n * prototype); sparse array slots are dropped, which shifts later indexes; `NaN`, `Infinity`,\n * functions, and circular branches become `undefined`. Normalize model classes, not\n * arbitrary graphs. The type parameter is a convenience cast — the flattened shape differs\n * from the input type whenever class instances are present.\n *\n * This is a public wrapper so the emitted declaration does not name `@vielzeug/arsenal`\n * symbols: exporting the `core/path.ts` original directly pulls arsenal's extensionless\n * re-exports into the NodeNext declaration graph that `test:types` compiles. Keep the\n * implementation in `core/path.ts` beside the `immutable()` leaf rules it mirrors.\n */\nexport function toPlainValues<T>(value: T): T {\n return flattenValue(value);\n}\n"],"mappings":"+CAqBA,SAAgB,cAAiB,EAAa,CAC5C,OAAO,EAAa,CAAK,CAC3B"}
|
package/dist/schema.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@vielzeug/arsenal");var
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@vielzeug/arsenal");var toPath=e=>{let t=[];for(let n of e??[]){let e=typeof n==`object`&&n&&`key`in n?n.key:n;if(typeof e==`string`)t.push(e);else if(typeof e==`number`&&Number.isSafeInteger(e)&&e>=0)t.push(e);else return[]}return t};function schemaValidator(t){return async(n,r)=>{if(r.aborted)return;let i=await(0,e.abortable)(Promise.resolve(t[`~standard`].validate(n)),r);if(!(r.aborted||`value`in i))return i.issues.map(e=>({message:e.message,path:toPath(e.path)}))}}exports.schemaValidator=schemaValidator;
|
|
2
2
|
//# sourceMappingURL=schema.cjs.map
|
package/dist/schema.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.cjs","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { abortable } from '@vielzeug/arsenal';\n\nimport type { FormValidator, ValidationIssue } from './types.js';\n\nexport type StandardSchemaLike<Output> = {\n readonly '~standard': {\n readonly validate: (\n value: unknown,\n ) =>\n | PromiseLike<\n | { readonly issues: readonly { readonly message: string; readonly path?: readonly unknown[] }[] }\n | { readonly value: Output }\n >\n | { readonly issues: readonly { readonly message: string; readonly path?: readonly unknown[] }[] }\n | { readonly value: Output };\n };\n};\n\nconst toPath = (path: readonly unknown[] | undefined): ValidationIssue['path'] => {\n const result: Array<string | number> = [];\n\n for (const part of path ?? []) {\n const key = typeof part === 'object' && part !== null && 'key' in part ? part.key : part;\n if (typeof key === 'string') result.push(key);\n else if (typeof key === 'number' && Number.isSafeInteger(key) && key >= 0) result.push(key);\n else return [];\n }\n\n return result;\n};\n\nexport function schemaValidator<TValues extends Record<string, unknown>>(\n schema: StandardSchemaLike<TValues>,\n): FormValidator<TValues> {\n return async (values, signal) => {\n if (signal.aborted) return undefined;\n\n const result = await abortable(Promise.resolve(schema['~standard'].validate(values)), signal);\n\n if (signal.aborted || 'value' in result) return undefined;\n\n return result.issues.map((issue) => ({ message: issue.message, path: toPath(issue.path) }));\n };\n}\n"],"mappings":"sGAkBA,IAAM,
|
|
1
|
+
{"version":3,"file":"schema.cjs","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { abortable } from '@vielzeug/arsenal';\n\nimport type { FormValidator, ValidationIssue } from './types.js';\n\nexport type StandardSchemaLike<Output> = {\n readonly '~standard': {\n readonly validate: (\n value: unknown,\n ) =>\n | PromiseLike<\n | { readonly issues: readonly { readonly message: string; readonly path?: readonly unknown[] }[] }\n | { readonly value: Output }\n >\n | { readonly issues: readonly { readonly message: string; readonly path?: readonly unknown[] }[] }\n | { readonly value: Output };\n };\n};\n\nconst toPath = (path: readonly unknown[] | undefined): ValidationIssue['path'] => {\n const result: Array<string | number> = [];\n\n for (const part of path ?? []) {\n const key = typeof part === 'object' && part !== null && 'key' in part ? part.key : part;\n if (typeof key === 'string') result.push(key);\n else if (typeof key === 'number' && Number.isSafeInteger(key) && key >= 0) result.push(key);\n else return [];\n }\n\n return result;\n};\n\nexport function schemaValidator<TValues extends Record<string, unknown>>(\n schema: StandardSchemaLike<TValues>,\n): FormValidator<TValues> {\n return async (values, signal) => {\n if (signal.aborted) return undefined;\n\n const result = await abortable(Promise.resolve(schema['~standard'].validate(values)), signal);\n\n if (signal.aborted || 'value' in result) return undefined;\n\n return result.issues.map((issue) => ({ message: issue.message, path: toPath(issue.path) }));\n };\n}\n"],"mappings":"sGAkBA,IAAM,OAAU,GAAkE,CAChF,IAAM,EAAiC,CAAC,EAExC,IAAK,IAAM,KAAQ,GAAQ,CAAC,EAAG,CAC7B,IAAM,EAAM,OAAO,GAAS,UAAY,GAAiB,QAAS,EAAO,EAAK,IAAM,EACpF,GAAI,OAAO,GAAQ,SAAU,EAAO,KAAK,CAAG,OACvC,GAAI,OAAO,GAAQ,UAAY,OAAO,cAAc,CAAG,GAAK,GAAO,EAAG,EAAO,KAAK,CAAG,OACrF,MAAO,CAAC,CACf,CAEA,OAAO,CACT,EAEA,SAAgB,gBACd,EACwB,CACxB,OAAO,MAAO,EAAQ,IAAW,CAC/B,GAAI,EAAO,QAAS,OAEpB,IAAM,EAAS,MAAA,EAAM,EAAA,UAAA,CAAU,QAAQ,QAAQ,EAAO,YAAY,CAAC,SAAS,CAAM,CAAC,EAAG,CAAM,EAExF,OAAO,SAAW,UAAW,GAEjC,OAAO,EAAO,OAAO,IAAK,IAAW,CAAE,QAAS,EAAM,QAAS,KAAM,OAAO,EAAM,IAAI,CAAE,EAAE,CAC5F,CACF"}
|
package/dist/schema.js
CHANGED
|
@@ -1,26 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/schema.ts
|
|
3
|
-
var t = (e) => {
|
|
4
|
-
let t = [];
|
|
5
|
-
for (let n of e ?? []) {
|
|
6
|
-
let e = typeof n == "object" && n && "key" in n ? n.key : n;
|
|
7
|
-
if (typeof e == "string") t.push(e);
|
|
8
|
-
else if (typeof e == "number" && Number.isSafeInteger(e) && e >= 0) t.push(e);
|
|
9
|
-
else return [];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
function n(n) {
|
|
14
|
-
return async (r, i) => {
|
|
15
|
-
if (i.aborted) return;
|
|
16
|
-
let a = await e(Promise.resolve(n["~standard"].validate(r)), i);
|
|
17
|
-
if (!(i.aborted || "value" in a)) return a.issues.map((e) => ({
|
|
18
|
-
message: e.message,
|
|
19
|
-
path: t(e.path)
|
|
20
|
-
}));
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
export { n as schemaValidator };
|
|
25
|
-
|
|
1
|
+
import{abortable as e}from"@vielzeug/arsenal";var toPath=e=>{let t=[];for(let n of e??[]){let e=typeof n==`object`&&n&&`key`in n?n.key:n;if(typeof e==`string`)t.push(e);else if(typeof e==`number`&&Number.isSafeInteger(e)&&e>=0)t.push(e);else return[]}return t};function schemaValidator(t){return async(n,r)=>{if(r.aborted)return;let i=await e(Promise.resolve(t[`~standard`].validate(n)),r);if(!(r.aborted||`value`in i))return i.issues.map(e=>({message:e.message,path:toPath(e.path)}))}}export{schemaValidator};
|
|
26
2
|
//# sourceMappingURL=schema.js.map
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { abortable } from '@vielzeug/arsenal';\n\nimport type { FormValidator, ValidationIssue } from './types.js';\n\nexport type StandardSchemaLike<Output> = {\n readonly '~standard': {\n readonly validate: (\n value: unknown,\n ) =>\n | PromiseLike<\n | { readonly issues: readonly { readonly message: string; readonly path?: readonly unknown[] }[] }\n | { readonly value: Output }\n >\n | { readonly issues: readonly { readonly message: string; readonly path?: readonly unknown[] }[] }\n | { readonly value: Output };\n };\n};\n\nconst toPath = (path: readonly unknown[] | undefined): ValidationIssue['path'] => {\n const result: Array<string | number> = [];\n\n for (const part of path ?? []) {\n const key = typeof part === 'object' && part !== null && 'key' in part ? part.key : part;\n if (typeof key === 'string') result.push(key);\n else if (typeof key === 'number' && Number.isSafeInteger(key) && key >= 0) result.push(key);\n else return [];\n }\n\n return result;\n};\n\nexport function schemaValidator<TValues extends Record<string, unknown>>(\n schema: StandardSchemaLike<TValues>,\n): FormValidator<TValues> {\n return async (values, signal) => {\n if (signal.aborted) return undefined;\n\n const result = await abortable(Promise.resolve(schema['~standard'].validate(values)), signal);\n\n if (signal.aborted || 'value' in result) return undefined;\n\n return result.issues.map((issue) => ({ message: issue.message, path: toPath(issue.path) }));\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { abortable } from '@vielzeug/arsenal';\n\nimport type { FormValidator, ValidationIssue } from './types.js';\n\nexport type StandardSchemaLike<Output> = {\n readonly '~standard': {\n readonly validate: (\n value: unknown,\n ) =>\n | PromiseLike<\n | { readonly issues: readonly { readonly message: string; readonly path?: readonly unknown[] }[] }\n | { readonly value: Output }\n >\n | { readonly issues: readonly { readonly message: string; readonly path?: readonly unknown[] }[] }\n | { readonly value: Output };\n };\n};\n\nconst toPath = (path: readonly unknown[] | undefined): ValidationIssue['path'] => {\n const result: Array<string | number> = [];\n\n for (const part of path ?? []) {\n const key = typeof part === 'object' && part !== null && 'key' in part ? part.key : part;\n if (typeof key === 'string') result.push(key);\n else if (typeof key === 'number' && Number.isSafeInteger(key) && key >= 0) result.push(key);\n else return [];\n }\n\n return result;\n};\n\nexport function schemaValidator<TValues extends Record<string, unknown>>(\n schema: StandardSchemaLike<TValues>,\n): FormValidator<TValues> {\n return async (values, signal) => {\n if (signal.aborted) return undefined;\n\n const result = await abortable(Promise.resolve(schema['~standard'].validate(values)), signal);\n\n if (signal.aborted || 'value' in result) return undefined;\n\n return result.issues.map((issue) => ({ message: issue.message, path: toPath(issue.path) }));\n };\n}\n"],"mappings":"8CAkBA,IAAM,OAAU,GAAkE,CAChF,IAAM,EAAiC,CAAC,EAExC,IAAK,IAAM,KAAQ,GAAQ,CAAC,EAAG,CAC7B,IAAM,EAAM,OAAO,GAAS,UAAY,GAAiB,QAAS,EAAO,EAAK,IAAM,EACpF,GAAI,OAAO,GAAQ,SAAU,EAAO,KAAK,CAAG,OACvC,GAAI,OAAO,GAAQ,UAAY,OAAO,cAAc,CAAG,GAAK,GAAO,EAAG,EAAO,KAAK,CAAG,OACrF,MAAO,CAAC,CACf,CAEA,OAAO,CACT,EAEA,SAAgB,gBACd,EACwB,CACxB,OAAO,MAAO,EAAQ,IAAW,CAC/B,GAAI,EAAO,QAAS,OAEpB,IAAM,EAAS,MAAM,EAAU,QAAQ,QAAQ,EAAO,YAAY,CAAC,SAAS,CAAM,CAAC,EAAG,CAAM,EAExF,OAAO,SAAW,UAAW,GAEjC,OAAO,EAAO,OAAO,IAAK,IAAW,CAAE,QAAS,EAAM,QAAS,KAAM,OAAO,EAAM,IAAI,CAAE,EAAE,CAC5F,CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vielzeug/forge",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Typed form state, validation, submission",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -81,11 +81,11 @@
|
|
|
81
81
|
"@vielzeug/arsenal": "3.0.0"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@types/node": "^26.
|
|
85
|
-
"@vielzeug/spell": "3.1.
|
|
86
|
-
"@vielzeug/vault": "3.0.
|
|
84
|
+
"@types/node": "^26.6.2",
|
|
85
|
+
"@vielzeug/spell": "3.1.1",
|
|
86
|
+
"@vielzeug/vault": "3.0.3",
|
|
87
87
|
"typescript": "^6.0.3",
|
|
88
|
-
"vite": "^8.
|
|
89
|
-
"vitest": "^5.0.
|
|
88
|
+
"vite": "^8.3.0",
|
|
89
|
+
"vitest": "^5.0.1"
|
|
90
90
|
}
|
|
91
91
|
}
|