@vielzeug/forge 1.3.0 → 1.4.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/dist/_utils.cjs +1 -1
- package/dist/_utils.cjs.map +1 -1
- package/dist/_utils.d.ts.map +1 -1
- package/dist/_utils.js +1 -0
- package/dist/_utils.js.map +1 -1
- package/dist/core/array.cjs +1 -1
- package/dist/core/array.cjs.map +1 -1
- package/dist/core/array.d.ts.map +1 -1
- package/dist/core/array.js +63 -32
- package/dist/core/array.js.map +1 -1
- package/dist/core/asyncQueue.cjs.map +1 -1
- package/dist/core/asyncQueue.d.ts +2 -2
- package/dist/core/asyncQueue.js.map +1 -1
- package/dist/core/context.cjs +1 -1
- package/dist/core/context.cjs.map +1 -1
- package/dist/core/context.d.ts +2 -5
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/context.js +72 -109
- package/dist/core/context.js.map +1 -1
- package/dist/core/fields.cjs +2 -0
- package/dist/core/fields.cjs.map +1 -0
- package/dist/core/fields.d.ts +52 -0
- package/dist/core/fields.d.ts.map +1 -0
- package/dist/core/fields.js +310 -0
- package/dist/core/fields.js.map +1 -0
- package/dist/core/lifecycle.cjs +1 -1
- package/dist/core/lifecycle.cjs.map +1 -1
- package/dist/core/lifecycle.d.ts +3 -1
- package/dist/core/lifecycle.d.ts.map +1 -1
- package/dist/core/lifecycle.js +10 -14
- package/dist/core/lifecycle.js.map +1 -1
- package/dist/core/notifier.cjs +2 -0
- package/dist/core/notifier.cjs.map +1 -0
- package/dist/core/notifier.d.ts +33 -0
- package/dist/core/notifier.d.ts.map +1 -0
- package/dist/core/notifier.js +78 -0
- package/dist/core/notifier.js.map +1 -0
- package/dist/core/observe.cjs +1 -1
- package/dist/core/observe.cjs.map +1 -1
- package/dist/core/observe.d.ts +8 -6
- package/dist/core/observe.d.ts.map +1 -1
- package/dist/core/observe.js +34 -45
- package/dist/core/observe.js.map +1 -1
- package/dist/core/scope.cjs +1 -1
- package/dist/core/scope.cjs.map +1 -1
- package/dist/core/scope.d.ts +6 -3
- package/dist/core/scope.d.ts.map +1 -1
- package/dist/core/scope.js +105 -156
- package/dist/core/scope.js.map +1 -1
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +3 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -2
- 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.cjs +1 -1
- package/dist/form.cjs.map +1 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +45 -56
- package/dist/form.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/types.cjs +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +53 -36
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -2
- package/dist/types.js.map +1 -1
- package/package.json +4 -4
- package/dist/core/validation.cjs +0 -2
- package/dist/core/validation.cjs.map +0 -1
- package/dist/core/validation.d.ts +0 -23
- package/dist/core/validation.d.ts.map +0 -1
- package/dist/core/validation.js +0 -173
- package/dist/core/validation.js.map +0 -1
- package/dist/core/values.cjs +0 -2
- package/dist/core/values.cjs.map +0 -1
- package/dist/core/values.d.ts +0 -31
- package/dist/core/values.d.ts.map +0 -1
- package/dist/core/values.js +0 -149
- package/dist/core/values.js.map +0 -1
package/dist/form.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./_dev.cjs"),t=require("./_utils.cjs"),n=require("./core/context.cjs"),r=require("./core/
|
|
1
|
+
const e=require("./_dev.cjs"),t=require("./_utils.cjs"),n=require("./core/context.cjs"),r=require("./core/fields.cjs"),i=require("./core/lifecycle.cjs"),a=require("./core/observe.cjs"),o=require("./core/scope.cjs");function s(s={}){let c=n.createFormContext(s),l=r.createFieldOps(c),u=a.createObserveOps(c,{connectDefaults:s.connect??{},set:l.set,touch:l.touch,validateFields:l.validateFields}),d=new Map,f=i.createLifecycleOps(c,{onDispose:()=>d.clear()});typeof s.defaultValues==`function`&&s.defaultValues().then(e=>{c.loadingState=!1,!c.disposed&&l.replace(e)}).catch(n=>{c.loadingState=!1,!c.disposed&&(e.warn(`defaultValues factory rejected. Form will be empty. Error: ${t.sanitizeForLog(String(n))}`),s.onLoadError?.(n),c.requestNotify())});let{listFields:p,patchKeys:m,registerField:h,removeField:g,replaceKeys:_,resetErrorsKeys:v,resetKeys:y,runValidationCore:b,setValidator:x,touchAllKeys:S,untouchAllKeys:C,...w}=l,{restore:T,snapshot:E,...D}=f,O={...w,...u,...D,batch:c.batch,get disposalSignal(){return c.disposeController.signal},get disposed(){return c.disposed},fields:{list:p,register:h,remove:g,setValidator:x},history:{restore:T,snapshot:E},get isLoading(){return c.loadingState},get isSubmitting(){return c.isSubmittingState},scope(e){let t=e,n=d.get(t);if(n)return n;let r=o.createScopedForm({ctx:c,fieldOps:{patchKeys:m,replaceKeys:_,resetErrorsKeys:v,resetKeys:y,runValidationCore:b,touchAllKeys:S,untouchAllKeys:C},root:O},e);return d.set(t,r),r},get state(){return c.getStateSnapshot()},[Symbol.dispose](){this.dispose()}};return O}exports.createForm=s;
|
|
2
2
|
//# sourceMappingURL=form.cjs.map
|
package/dist/form.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.cjs","names":[],"sources":["../src/form.ts"],"sourcesContent":["import { warn } from './_dev';\nimport { sanitizeForLog } from './_utils';\nimport { createFormContext } from './core/context';\nimport {
|
|
1
|
+
{"version":3,"file":"form.cjs","names":[],"sources":["../src/form.ts"],"sourcesContent":["import { warn } from './_dev';\nimport { sanitizeForLog } from './_utils';\nimport { createFormContext } from './core/context';\nimport { createFieldOps } from './core/fields';\nimport { createLifecycleOps } from './core/lifecycle';\nimport { createObserveOps } from './core/observe';\nimport { createScopedForm, type ScopeContext } from './core/scope';\nimport { type FlatKeyOf, type Form, type FormOptions, type ScopedValues } from './types';\n\n/* -------------------- createForm -------------------- */\n\nexport function createForm<TInit extends object>(\n init: Omit<FormOptions<TInit & Record<string, unknown>>, 'defaultValues'> & {\n defaultValues: TInit | (() => Promise<TInit>);\n },\n): Form<TInit & Record<string, unknown>>;\nexport function createForm<TValues extends Record<string, unknown> = Record<string, unknown>>(\n init?: FormOptions<TValues>,\n): Form<TValues>;\nexport function createForm<TValues extends Record<string, unknown> = Record<string, unknown>>(\n init: FormOptions<TValues> = {},\n): Form<TValues> {\n const ctx = createFormContext<TValues>(init);\n const fieldOps = createFieldOps(ctx);\n const observeOps = createObserveOps(ctx, {\n connectDefaults: init.connect ?? {},\n set: fieldOps.set,\n touch: fieldOps.touch,\n validateFields: fieldOps.validateFields,\n });\n // scope() results are memoized per prefix — not part of the shared FormContext bag since\n // it's purely a Form-object-level cache, not state any core/*.ts module needs to read.\n const scopeCache = new Map<string, Form<never>>();\n const lifecycleOps = createLifecycleOps(ctx, { onDispose: () => scopeCache.clear() });\n\n /* ---- Async defaultValues ---- */\n\n if (typeof init.defaultValues === 'function') {\n void init\n .defaultValues()\n .then((resolved) => {\n ctx.loadingState = false;\n\n if (ctx.disposed) return;\n\n fieldOps.replace(resolved);\n })\n .catch((err: unknown) => {\n ctx.loadingState = false;\n\n if (ctx.disposed) return;\n\n warn(`defaultValues factory rejected. Form will be empty. Error: ${sanitizeForLog(String(err))}`);\n init.onLoadError?.(err);\n ctx.requestNotify();\n });\n }\n\n /* ======== Public form object ======== */\n\n // registerField/removeField/setValidator/listFields are nested under `fields`, not top-level.\n // patchKeys/replaceKeys/resetErrorsKeys/resetKeys/runValidationCore/touchAllKeys/untouchAllKeys\n // are internal-only — scope() below passes a slice of them to createScopedForm() so scoped\n // bulk operations share these primitives instead of reimplementing each loop a second time.\n const {\n listFields,\n patchKeys,\n registerField,\n removeField,\n replaceKeys,\n resetErrorsKeys,\n resetKeys,\n runValidationCore,\n setValidator,\n touchAllKeys,\n untouchAllKeys,\n ...publicFieldOps\n } = fieldOps;\n // snapshot/restore are nested under `history`, not top-level.\n const { restore, snapshot, ...publicLifecycleOps } = lifecycleOps;\n\n // `scope` is defined as a method on publicForm so that `const publicForm` can capture itself\n // via closure without a forward-reference lint disable.\n const publicForm: Form<TValues> = {\n ...publicFieldOps,\n ...observeOps,\n ...publicLifecycleOps,\n batch: ctx.batch,\n get disposalSignal() {\n return ctx.disposeController.signal;\n },\n get disposed() {\n return ctx.disposed;\n },\n fields: {\n list: listFields,\n register: registerField,\n remove: removeField,\n setValidator,\n },\n history: { restore, snapshot },\n get isLoading() {\n return ctx.loadingState;\n },\n get isSubmitting() {\n return ctx.isSubmittingState;\n },\n scope<P extends FlatKeyOf<TValues>>(prefix: P): Form<ScopedValues<TValues, P>> {\n const key = prefix as string;\n const cached = scopeCache.get(key);\n\n if (cached) return cached as Form<ScopedValues<TValues, P>>;\n\n const scopeCtx: ScopeContext<TValues> = {\n ctx,\n fieldOps: {\n patchKeys,\n replaceKeys,\n resetErrorsKeys,\n resetKeys,\n runValidationCore,\n touchAllKeys,\n untouchAllKeys,\n },\n root: publicForm,\n };\n\n const scoped = createScopedForm<TValues, P>(scopeCtx, prefix) as Form<ScopedValues<TValues, P>>;\n\n scopeCache.set(key, scoped as Form<never>);\n\n return scoped;\n },\n get state() {\n return ctx.getStateSnapshot();\n },\n [Symbol.dispose]() {\n this.dispose();\n },\n };\n\n return publicForm;\n}\n"],"mappings":"uNAmBA,SAAgB,EACd,EAA6B,CAAC,EACf,CACf,IAAM,EAAM,EAAA,kBAA2B,CAAI,EACrC,EAAW,EAAA,eAAe,CAAG,EAC7B,EAAa,EAAA,iBAAiB,EAAK,CACvC,gBAAiB,EAAK,SAAW,CAAC,EAClC,IAAK,EAAS,IACd,MAAO,EAAS,MAChB,eAAgB,EAAS,cAC3B,CAAC,EAGK,EAAa,IAAI,IACjB,EAAe,EAAA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@@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../src/form.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../src/form.ts"],"names":[],"mappings":"AAOA,OAAO,EAAkB,KAAK,IAAI,EAAE,KAAK,WAAW,EAAqB,MAAM,SAAS,CAAC;AAIzF,wBAAgB,UAAU,CAAC,KAAK,SAAS,MAAM,EAC7C,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,eAAe,CAAC,GAAG;IAC1E,aAAa,EAAE,KAAK,GAAG,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;CAC/C,GACA,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AACzC,wBAAgB,UAAU,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1F,IAAI,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,GAC1B,IAAI,CAAC,OAAO,CAAC,CAAC"}
|
package/dist/form.js
CHANGED
|
@@ -1,89 +1,78 @@
|
|
|
1
1
|
import { warn as e } from "./_dev.js";
|
|
2
2
|
import { sanitizeForLog as t } from "./_utils.js";
|
|
3
3
|
import { createFormContext as n } from "./core/context.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { createValueOps as s } from "./core/values.js";
|
|
4
|
+
import { createFieldOps as r } from "./core/fields.js";
|
|
5
|
+
import { createLifecycleOps as i } from "./core/lifecycle.js";
|
|
6
|
+
import { createObserveOps as a } from "./core/observe.js";
|
|
7
|
+
import { createScopedForm as o } from "./core/scope.js";
|
|
9
8
|
//#region src/form.ts
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
typeof c.defaultValues == "function" && c.defaultValues().then((e) => {
|
|
20
|
-
l.loadingState = !1, !l.disposed && u.replace(e);
|
|
9
|
+
function s(s = {}) {
|
|
10
|
+
let c = n(s), l = r(c), u = a(c, {
|
|
11
|
+
connectDefaults: s.connect ?? {},
|
|
12
|
+
set: l.set,
|
|
13
|
+
touch: l.touch,
|
|
14
|
+
validateFields: l.validateFields
|
|
15
|
+
}), d = /* @__PURE__ */ new Map(), f = i(c, { onDispose: () => d.clear() });
|
|
16
|
+
typeof s.defaultValues == "function" && s.defaultValues().then((e) => {
|
|
17
|
+
c.loadingState = !1, !c.disposed && l.replace(e);
|
|
21
18
|
}).catch((n) => {
|
|
22
|
-
|
|
19
|
+
c.loadingState = !1, !c.disposed && (e(`defaultValues factory rejected. Form will be empty. Error: ${t(String(n))}`), s.onLoadError?.(n), c.requestNotify());
|
|
23
20
|
});
|
|
24
|
-
let { listFields: m, registerField: h, removeField: g,
|
|
25
|
-
...
|
|
26
|
-
...
|
|
27
|
-
...
|
|
28
|
-
|
|
29
|
-
batch: l.batch,
|
|
21
|
+
let { listFields: p, patchKeys: m, registerField: h, removeField: g, replaceKeys: _, resetErrorsKeys: v, resetKeys: y, runValidationCore: b, setValidator: x, touchAllKeys: S, untouchAllKeys: C, ...w } = l, { restore: T, snapshot: E, ...D } = f, O = {
|
|
22
|
+
...w,
|
|
23
|
+
...u,
|
|
24
|
+
...D,
|
|
25
|
+
batch: c.batch,
|
|
30
26
|
get disposalSignal() {
|
|
31
|
-
return
|
|
27
|
+
return c.disposeController.signal;
|
|
32
28
|
},
|
|
33
29
|
get disposed() {
|
|
34
|
-
return
|
|
30
|
+
return c.disposed;
|
|
35
31
|
},
|
|
36
32
|
fields: {
|
|
37
|
-
list:
|
|
33
|
+
list: p,
|
|
38
34
|
register: h,
|
|
39
35
|
remove: g,
|
|
40
|
-
setValidator:
|
|
36
|
+
setValidator: x
|
|
37
|
+
},
|
|
38
|
+
history: {
|
|
39
|
+
restore: T,
|
|
40
|
+
snapshot: E
|
|
41
41
|
},
|
|
42
42
|
get isLoading() {
|
|
43
|
-
return
|
|
43
|
+
return c.loadingState;
|
|
44
44
|
},
|
|
45
45
|
get isSubmitting() {
|
|
46
|
-
return
|
|
46
|
+
return c.isSubmittingState;
|
|
47
47
|
},
|
|
48
48
|
scope(e) {
|
|
49
|
-
let t = e, n =
|
|
49
|
+
let t = e, n = d.get(t);
|
|
50
50
|
if (n) return n;
|
|
51
|
-
let r =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
invalidateErrors: l.invalidateErrors,
|
|
62
|
-
isDisposed: () => l.disposed,
|
|
63
|
-
isSubmitting: () => l.isSubmittingState,
|
|
64
|
-
requestNotify: l.requestNotify,
|
|
65
|
-
root: x,
|
|
66
|
-
runValidationCore: y,
|
|
67
|
-
setSubmitting: (e) => {
|
|
68
|
-
l.isSubmittingState = e;
|
|
51
|
+
let r = o({
|
|
52
|
+
ctx: c,
|
|
53
|
+
fieldOps: {
|
|
54
|
+
patchKeys: m,
|
|
55
|
+
replaceKeys: _,
|
|
56
|
+
resetErrorsKeys: v,
|
|
57
|
+
resetKeys: y,
|
|
58
|
+
runValidationCore: b,
|
|
59
|
+
touchAllKeys: S,
|
|
60
|
+
untouchAllKeys: C
|
|
69
61
|
},
|
|
70
|
-
|
|
71
|
-
touched: l.touched,
|
|
72
|
-
validators: l.validators
|
|
62
|
+
root: O
|
|
73
63
|
}, e);
|
|
74
|
-
return
|
|
64
|
+
return d.set(t, r), r;
|
|
75
65
|
},
|
|
76
66
|
get state() {
|
|
77
|
-
return
|
|
67
|
+
return c.getStateSnapshot();
|
|
78
68
|
},
|
|
79
|
-
subscribeScoped: f.subscribe,
|
|
80
69
|
[Symbol.dispose]() {
|
|
81
70
|
this.dispose();
|
|
82
71
|
}
|
|
83
72
|
};
|
|
84
|
-
return
|
|
73
|
+
return O;
|
|
85
74
|
}
|
|
86
75
|
//#endregion
|
|
87
|
-
export {
|
|
76
|
+
export { s as createForm };
|
|
88
77
|
|
|
89
78
|
//# sourceMappingURL=form.js.map
|
package/dist/form.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.js","names":[],"sources":["../src/form.ts"],"sourcesContent":["import { warn } from './_dev';\nimport { sanitizeForLog } from './_utils';\nimport { createFormContext } from './core/context';\nimport {
|
|
1
|
+
{"version":3,"file":"form.js","names":[],"sources":["../src/form.ts"],"sourcesContent":["import { warn } from './_dev';\nimport { sanitizeForLog } from './_utils';\nimport { createFormContext } from './core/context';\nimport { createFieldOps } from './core/fields';\nimport { createLifecycleOps } from './core/lifecycle';\nimport { createObserveOps } from './core/observe';\nimport { createScopedForm, type ScopeContext } from './core/scope';\nimport { type FlatKeyOf, type Form, type FormOptions, type ScopedValues } from './types';\n\n/* -------------------- createForm -------------------- */\n\nexport function createForm<TInit extends object>(\n init: Omit<FormOptions<TInit & Record<string, unknown>>, 'defaultValues'> & {\n defaultValues: TInit | (() => Promise<TInit>);\n },\n): Form<TInit & Record<string, unknown>>;\nexport function createForm<TValues extends Record<string, unknown> = Record<string, unknown>>(\n init?: FormOptions<TValues>,\n): Form<TValues>;\nexport function createForm<TValues extends Record<string, unknown> = Record<string, unknown>>(\n init: FormOptions<TValues> = {},\n): Form<TValues> {\n const ctx = createFormContext<TValues>(init);\n const fieldOps = createFieldOps(ctx);\n const observeOps = createObserveOps(ctx, {\n connectDefaults: init.connect ?? {},\n set: fieldOps.set,\n touch: fieldOps.touch,\n validateFields: fieldOps.validateFields,\n });\n // scope() results are memoized per prefix — not part of the shared FormContext bag since\n // it's purely a Form-object-level cache, not state any core/*.ts module needs to read.\n const scopeCache = new Map<string, Form<never>>();\n const lifecycleOps = createLifecycleOps(ctx, { onDispose: () => scopeCache.clear() });\n\n /* ---- Async defaultValues ---- */\n\n if (typeof init.defaultValues === 'function') {\n void init\n .defaultValues()\n .then((resolved) => {\n ctx.loadingState = false;\n\n if (ctx.disposed) return;\n\n fieldOps.replace(resolved);\n })\n .catch((err: unknown) => {\n ctx.loadingState = false;\n\n if (ctx.disposed) return;\n\n warn(`defaultValues factory rejected. Form will be empty. Error: ${sanitizeForLog(String(err))}`);\n init.onLoadError?.(err);\n ctx.requestNotify();\n });\n }\n\n /* ======== Public form object ======== */\n\n // registerField/removeField/setValidator/listFields are nested under `fields`, not top-level.\n // patchKeys/replaceKeys/resetErrorsKeys/resetKeys/runValidationCore/touchAllKeys/untouchAllKeys\n // are internal-only — scope() below passes a slice of them to createScopedForm() so scoped\n // bulk operations share these primitives instead of reimplementing each loop a second time.\n const {\n listFields,\n patchKeys,\n registerField,\n removeField,\n replaceKeys,\n resetErrorsKeys,\n resetKeys,\n runValidationCore,\n setValidator,\n touchAllKeys,\n untouchAllKeys,\n ...publicFieldOps\n } = fieldOps;\n // snapshot/restore are nested under `history`, not top-level.\n const { restore, snapshot, ...publicLifecycleOps } = lifecycleOps;\n\n // `scope` is defined as a method on publicForm so that `const publicForm` can capture itself\n // via closure without a forward-reference lint disable.\n const publicForm: Form<TValues> = {\n ...publicFieldOps,\n ...observeOps,\n ...publicLifecycleOps,\n batch: ctx.batch,\n get disposalSignal() {\n return ctx.disposeController.signal;\n },\n get disposed() {\n return ctx.disposed;\n },\n fields: {\n list: listFields,\n register: registerField,\n remove: removeField,\n setValidator,\n },\n history: { restore, snapshot },\n get isLoading() {\n return ctx.loadingState;\n },\n get isSubmitting() {\n return ctx.isSubmittingState;\n },\n scope<P extends FlatKeyOf<TValues>>(prefix: P): Form<ScopedValues<TValues, P>> {\n const key = prefix as string;\n const cached = scopeCache.get(key);\n\n if (cached) return cached as Form<ScopedValues<TValues, P>>;\n\n const scopeCtx: ScopeContext<TValues> = {\n ctx,\n fieldOps: {\n patchKeys,\n replaceKeys,\n resetErrorsKeys,\n resetKeys,\n runValidationCore,\n touchAllKeys,\n untouchAllKeys,\n },\n root: publicForm,\n };\n\n const scoped = createScopedForm<TValues, P>(scopeCtx, prefix) as Form<ScopedValues<TValues, P>>;\n\n scopeCache.set(key, scoped as Form<never>);\n\n return scoped;\n },\n get state() {\n return ctx.getStateSnapshot();\n },\n [Symbol.dispose]() {\n this.dispose();\n },\n };\n\n return publicForm;\n}\n"],"mappings":";;;;;;;;AAmBA,SAAgB,EACd,IAA6B,CAAC,GACf;CACf,IAAM,IAAM,EAA2B,CAAI,GACrC,IAAW,EAAe,CAAG,GAC7B,IAAa,EAAiB,GAAK;EACvC,iBAAiB,EAAK,WAAW,CAAC;EAClC,KAAK,EAAS;EACd,OAAO,EAAS;EAChB,gBAAgB,EAAS;CAC3B,CAAC,GAGK,oBAAa,IAAI,IAAyB,GAC1C,IAAe,EAAmB,GAAK,EAAE,iBAAiB,EAAW,MAAM,EAAE,CAAC;CAIpF,AAAI,OAAO,EAAK,iBAAkB,cAChC,EACG,cAAc,CAAC,CACf,MAAM,MAAa;EAClB,EAAI,eAAe,IAEf,GAAI,YAER,EAAS,QAAQ,CAAQ;CAC3B,CAAC,CAAC,CACD,OAAO,MAAiB;EACvB,EAAI,eAAe,IAEf,GAAI,aAER,EAAK,8DAA8D,EAAe,OAAO,CAAG,CAAC,GAAG,GAChG,EAAK,cAAc,CAAG,GACtB,EAAI,cAAc;CACpB,CAAC;CASL,IAAM,EACJ,eACA,cACA,kBACA,gBACA,gBACA,oBACA,cACA,sBACA,iBACA,iBACA,mBACA,GAAG,MACD,GAEE,EAAE,YAAS,aAAU,GAAG,MAAuB,GAI/C,IAA4B;EAChC,GAAG;EACH,GAAG;EACH,GAAG;EACH,OAAO,EAAI;EACX,IAAI,iBAAiB;GACnB,OAAO,EAAI,kBAAkB;EAC/B;EACA,IAAI,WAAW;GACb,OAAO,EAAI;EACb;EACA,QAAQ;GACN,MAAM;GACN,UAAU;GACV,QAAQ;GACR;EACF;EACA,SAAS;GAAE;GAAS;EAAS;EAC7B,IAAI,YAAY;GACd,OAAO,EAAI;EACb;EACA,IAAI,eAAe;GACjB,OAAO,EAAI;EACb;EACA,MAAoC,GAA2C;GAC7E,IAAM,IAAM,GACN,IAAS,EAAW,IAAI,CAAG;GAEjC,IAAI,GAAQ,OAAO;GAgBnB,IAAM,IAAS,EAA6B;IAb1C;IACA,UAAU;KACR;KACA;KACA;KACA;KACA;KACA;KACA;IACF;IACA,MAAM;GAGoC,GAAU,CAAM;GAI5D,OAFA,EAAW,IAAI,GAAK,CAAqB,GAElC;EACT;EACA,IAAI,QAAQ;GACV,OAAO,EAAI,iBAAiB;EAC9B;EACA,CAAC,OAAO,WAAW;GACjB,KAAK,QAAQ;EACf;CACF;CAEA,OAAO;AACT"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./errors.cjs"),t=require("./types.cjs"),n=require("./form.cjs"),r=require("./adapters/form-data.cjs");exports.FORM_ERROR=t.FORM_ERROR,exports.ForgeConfigError=e.ForgeConfigError,exports.ForgeDisposedError=e.ForgeDisposedError,exports.ForgeError=e.ForgeError,exports.ForgeSubmitError=e.ForgeSubmitError,exports.ForgeValidationError=e.ForgeValidationError,exports.ValidationModes=t.ValidationModes,exports.createForm=n.createForm,exports.toFormData=r.toFormData;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./errors.cjs"),t=require("./types.cjs"),n=require("./form.cjs"),r=require("./adapters/form-data.cjs");exports.FORM_ERROR=t.FORM_ERROR,exports.ForgeConfigError=e.ForgeConfigError,exports.ForgeDisposedError=e.ForgeDisposedError,exports.ForgeError=e.ForgeError,exports.ForgeSubmitError=e.ForgeSubmitError,exports.ForgeValidationError=e.ForgeValidationError,exports.MAX_TYPED_PATH_DEPTH=t.MAX_TYPED_PATH_DEPTH,exports.ValidationModes=t.ValidationModes,exports.createForm=n.createForm,exports.toFormData=r.toFormData;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ForgeConfigError as e, ForgeDisposedError as t, ForgeError as n, ForgeSubmitError as r, ForgeValidationError as i } from "./errors.js";
|
|
2
|
-
import { FORM_ERROR as a,
|
|
3
|
-
import { createForm as
|
|
4
|
-
import { toFormData as
|
|
5
|
-
export { a as FORM_ERROR, e as ForgeConfigError, t as ForgeDisposedError, n as ForgeError, r as ForgeSubmitError, i as ForgeValidationError, o as
|
|
2
|
+
import { FORM_ERROR as a, MAX_TYPED_PATH_DEPTH as o, ValidationModes as s } from "./types.js";
|
|
3
|
+
import { createForm as c } from "./form.js";
|
|
4
|
+
import { toFormData as l } from "./adapters/form-data.js";
|
|
5
|
+
export { a as FORM_ERROR, e as ForgeConfigError, t as ForgeDisposedError, n as ForgeError, r as ForgeSubmitError, i as ForgeValidationError, o as MAX_TYPED_PATH_DEPTH, s as ValidationModes, c as createForm, l as toFormData };
|
package/dist/types.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=`_form`,t={onBlur:{touchOnBlur:!0,validateOnBlur:!0},onChange:{touchOnBlur:!0,validateOnChange:!0},onSubmit:{},onTouched:{touchOnBlur:!0,validateOnBlur:!0,validateOnTouch:!0}};exports.FORM_ERROR=e,exports.ValidationModes=
|
|
1
|
+
var e=`_form`,t=5,n={onBlur:{touchOnBlur:!0,validateOnBlur:!0},onChange:{touchOnBlur:!0,validateOnChange:!0},onSubmit:{},onTouched:{touchOnBlur:!0,validateOnBlur:!0,validateOnTouch:!0}};exports.FORM_ERROR=e,exports.MAX_TYPED_PATH_DEPTH=t,exports.ValidationModes=n;
|
|
2
2
|
//# sourceMappingURL=types.cjs.map
|
package/dist/types.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["/** A callback to remove a subscription. */\nexport type Unsubscribe = () => void;\n\nexport type MaybePromise<T> = T | PromiseLike<T>;\n\nexport type FieldValidator<V = unknown> = (value: V, signal?: AbortSignal) => MaybePromise<string | undefined>;\n\nexport type FormValidator<TValues extends Record<string, unknown> = Record<string, unknown>> = (\n values: TValues,\n signal?: AbortSignal,\n) => MaybePromise<Partial<Record<ErrorKeyOf<TValues>, string>> | undefined>;\n\nexport type SetOptions = {\n /** Whether to mark the field as touched. Default: false. */\n touched?: boolean;\n};\n\nexport type FormState = {\n errors: Readonly<Record<string, string> & { [FORM_ERROR]?: string }>;\n isDirty: boolean;\n /** `true` while an async `defaultValues` factory is resolving. */\n isLoading: boolean;\n isSubmitting: boolean;\n isTouched: boolean;\n isValid: boolean;\n isValidating: boolean;\n submitCount: number;\n /**\n * Field names that are currently touched, as full dot-notation paths.\n * On a scoped form these are still full paths (e.g. `\"address.city\"`, not `\"city\"`).\n * Prefer calling `scopedForm.validate()` to run scoped validation rather than\n * passing `state.touchedFields` directly — scoped `validate(fields[])` expects relative paths.\n */\n touchedFields: readonly string[];\n /** Field names that currently have an active async validation run. Useful for per-field loading indicators. */\n validatingFields: readonly string[];\n};\n\nexport type SubscribeOptions = {\n /** Call the listener immediately with the current state on subscription. Default: false. */\n sync?: boolean;\n};\n\n/** Shared field key for root-level / form-level validation errors. */\nexport const FORM_ERROR = '_form' as const;\n\nexport type ValidateResult = {\n errors: Readonly<Record<string, string>>;\n valid: boolean;\n};\n\nexport type SubmitResult<TResult = void> =\n { ok: true; value: TResult } | { errors: Record<string, string>; ok: false; type: 'validation' };\n\n/* -------------------- Utility Types -------------------- */\n\n/**\n * Recursively makes all properties optional.\n * Used by `form.patch()` to accept partial nested updates.\n */\nexport type DeepPartial<T> = T extends Record<string, unknown> ? { [K in keyof T]?: DeepPartial<T[K]> } : T;\n\n/**\n * Recursively extracts all dot-notation leaf keys from a values shape.\n * Depth-limited to 5: TypeScript compilation time grows non-linearly beyond this point.\n */\nexport type FlatKeyOf<\n T extends Record<string, unknown>,\n P extends string = '',\n D extends readonly 0[] = [],\n> = D['length'] extends 5\n ? string\n : {\n [K in keyof T & string]: T[K] extends unknown[] | File | Blob | Date\n ? P extends ''\n ? K\n : `${P}.${K}`\n : T[K] extends Record<string, unknown>\n ? FlatKeyOf<T[K] & Record<string, unknown>, P extends '' ? K : `${P}.${K}`, [...D, 0]>\n : P extends ''\n ? K\n : `${P}.${K}`;\n }[keyof T & string];\n\n/** Resolves the value type at a dot-notation path within a values shape. */\nexport type TypeAtPath<T, K extends string> = K extends `${infer Head}.${infer Tail}`\n ? Head extends keyof T\n ? T[Head] extends Record<string, unknown>\n ? TypeAtPath<T[Head], Tail>\n : unknown\n : unknown\n : K extends keyof T\n ? T[K]\n : unknown;\n\n/** Field error keys include field paths plus the reserved `_form` key for root-level issues. */\nexport type ErrorKeyOf<TValues extends Record<string, unknown>> = FlatKeyOf<TValues> | typeof FORM_ERROR;\n\n/**\n * Structural interface for safeParse-compatible schemas.\n * Works with `@vielzeug/spell`, Zod, Valibot, and any Standard Schema compliant library.\n */\nexport type SafeParseSchema = {\n safeParse(\n data: unknown,\n ): { success: true } | { error: { issues: { message: string; path: (string | number)[] }[] }; success: false };\n};\n\n/** The type of values accessible at a scoped sub-form prefix. */\nexport type ScopedValues<TValues, P extends string> =\n TypeAtPath<TValues, P> extends Record<string, unknown>\n ? TypeAtPath<TValues, P> & Record<string, unknown>\n : Record<string, unknown>;\n\n/**\n * The live connection object returned by `form.connect()`.\n * Getters re-evaluate on every property access — store the object once per field, do not destructure.\n * Call `dispose()` to cancel any pending debounce timers when the field unmounts.\n */\nexport type ConnectionResult<V = unknown> = {\n [Symbol.dispose](): void;\n readonly dirty: boolean;\n /** Cancels the debounce timer owned by this specific binding. Safe to call multiple times. */\n dispose(): void;\n /** `true` after `dispose()` has been called on this binding. */\n readonly disposed: boolean;\n readonly error: string | undefined;\n onBlur(): void;\n onChange(value: V): void;\n readonly touched: boolean;\n readonly value: V;\n};\n\n/** Per-field or global validation trigger configuration. */\nexport type ConnectOptions = {\n /**\n * Debounce auto-triggered validation by this many milliseconds.\n * Each `connect()` call owns its own timer — cancelling one binding does not affect others.\n * Default: 0.\n */\n debounce?: number;\n /** Auto-mark the field as touched when it loses focus. Default: false. */\n touchOnBlur?: boolean;\n /** Validate the field automatically when it loses focus. Default: false. */\n validateOnBlur?: boolean;\n /** Validate the field automatically after each value change. Default: false. */\n validateOnChange?: boolean;\n /** Validate on change only after the field has been touched at least once. */\n validateOnTouch?: boolean;\n};\n\n// Resolves the element type of an array, or `unknown` for non-arrays.\ntype ElementOf<T> = T extends readonly (infer E)[] ? E : unknown;\n\nexport type ArrayField<T = unknown> = {\n append(value: T): void;\n insert(index: number, value: T): void;\n move(from: number, to: number): void;\n prepend(value: T): void;\n remove(index: number): void;\n replace(index: number, value: T): void;\n swap(a: number, b: number): void;\n};\n\nexport type FieldState<V = unknown> = {\n dirty: boolean;\n error: string | undefined;\n /** `true` when `error` is not `undefined`. Convenience alias for `error !== undefined`. */\n hasError: boolean;\n touched: boolean;\n value: V;\n};\n\n/**\n * Options for registering a dynamic field. Both properties are optional;\n * omitting `defaultValue` leaves the field uninitialized and omitting `validator`\n * skips field-level validation.\n */\nexport type RegisterFieldOptions<V = unknown> = {\n /** Initial value. Also becomes the baseline, so the field starts clean. */\n defaultValue?: V;\n /** Field-level validator to attach. */\n validator?: FieldValidator<V>;\n};\n\n/**\n * A complete snapshot of form state that can be restored via `form.restore()`.\n * `store` and `baseline` keys are the flattened dot-notation paths used internally.\n * Typed with `TValues` for nominal clarity — structurally both are `Record<string, unknown>`.\n */\nexport type FormSnapshot<TValues extends Record<string, unknown> = Record<string, unknown>> = {\n readonly baseline: Partial<Record<FlatKeyOf<TValues>, unknown>>;\n readonly dirty: readonly string[];\n readonly errors: Readonly<Record<string, string>>;\n readonly store: Partial<Record<FlatKeyOf<TValues>, unknown>>;\n readonly submitCount: number;\n readonly touched: readonly string[];\n};\n\nexport type FormOptions<TValues extends Record<string, unknown> = Record<string, unknown>> = {\n /**\n * Default connect behavior applied when `connect(name, config)` omits specific options.\n * Use `ValidationModes` presets for common strategies:\n * - `ValidationModes.onSubmit` (default) — validates only on submit, no touch-on-blur\n * - `ValidationModes.onBlur` — validates each field on blur\n * - `ValidationModes.onChange` — validates each field on every change\n * - `ValidationModes.onTouched` — validates on blur first, then on every change once touched\n */\n connect?: ConnectOptions;\n /**\n * Initial form values. May be a static object or an async factory function.\n * While a factory is pending, `form.isLoading` is `true` and the form is read-only.\n */\n defaultValues?: { [K in keyof TValues]: TValues[K] } | (() => Promise<{ [K in keyof TValues]: TValues[K] }>);\n /**\n * Called when an async `defaultValues` factory rejects.\n * Use to show an error UI or retry logic. In development, a warning is also emitted via `console.warn`.\n */\n onLoadError?: (error: unknown) => void;\n /**\n * Form-level validator. Accepts either:\n * - A `FormValidator` function\n * - Any `safeParse`-compatible schema (auto-detected, works with `@vielzeug/spell`, Zod, Valibot)\n */\n validator?: FormValidator<TValues> | SafeParseSchema;\n /** Field-level validators keyed by field name or dot-notation path. */\n validators?: Partial<Record<FlatKeyOf<TValues>, FieldValidator>>;\n};\n\n/**\n * Named presets for common validation trigger strategies.\n * Pass to `createForm({ connect: ValidationModes.onBlur })`.\n *\n * - `onSubmit` — no automatic validation or touch. Clean until the user submits.\n * - `onBlur` — validates and marks touched on blur.\n * - `onChange` — validates on every keystroke (marks touched on blur).\n * - `onTouched` — validates on blur first, then on every change once touched.\n */\nexport const ValidationModes = {\n onBlur: { touchOnBlur: true, validateOnBlur: true },\n onChange: { touchOnBlur: true, validateOnChange: true },\n onSubmit: {},\n onTouched: { touchOnBlur: true, validateOnBlur: true, validateOnTouch: true },\n} as const satisfies Record<string, ConnectOptions>;\n\nexport interface Form<TValues extends Record<string, unknown> = Record<string, unknown>> {\n /** Returns a cached typed `ArrayField` helper for mutating array-valued fields. */\n array<K extends FlatKeyOf<TValues>>(name: K): ArrayField<ElementOf<TypeAtPath<TValues, K>>>;\n batch(fn: () => void): void;\n /** Clear a single field error. No-op if the field has no error. */\n clearError(name: ErrorKeyOf<TValues>): void;\n /**\n * Returns a live connection object for a field (DOM event handlers + live getters).\n * Each call to `connect()` creates a new object with its own debounce timer.\n * Call `binding.dispose()` on unmount to cancel any pending debounce timer.\n * Do not destructure: getters re-evaluate on every property access.\n */\n connect<K extends FlatKeyOf<TValues>>(name: K, config?: ConnectOptions): ConnectionResult<TypeAtPath<TValues, K>>;\n dispose(): void;\n /** Aborted when `dispose()` is called. Use to cancel async work tied to this form's lifetime. */\n readonly disposalSignal: AbortSignal;\n readonly disposed: boolean;\n field<K extends FlatKeyOf<TValues>>(name: K): FieldState<TypeAtPath<TValues, K>>;\n get<K extends FlatKeyOf<TValues>>(name: K): TypeAtPath<TValues, K>;\n /** `true` while an async `defaultValues` factory is resolving. Mirrors `state.isLoading`. */\n readonly isLoading: boolean;\n /** `true` while a `submit()` call is in progress. Mirrors `state.isSubmitting`. */\n readonly isSubmitting: boolean;\n /**\n * Merge a partial server response into the form: updates both the store and the baseline\n * for each provided field, marking them clean. Fields not included in `partial` are untouched.\n */\n patch(partial: DeepPartial<TValues>): void;\n /**\n * Field-lifecycle namespace — use to dynamically register/remove fields and manage validators.\n *\n * @example\n * const unsub = form.fields.register('email', { defaultValue: '', validator: required });\n * form.fields.setValidator('email', (v) => v ? undefined : 'Required');\n * form.fields.remove('email');\n */\n fields: {\n /**\n * Enumerate all currently-known field paths: the deduplicated union of populated store\n * keys and keys with a registered validator (the same definition `touchAll()` uses).\n * On a scoped form, paths are relative to the scope's prefix — matching `scope.state`'s\n * relative-path convention, not `state.touchedFields`'s absolute-path convention.\n */\n list(): readonly string[];\n /**\n * Declare a dynamic field with an optional default value and validator.\n * If the field does not yet exist in the store, `defaultValue` is written to both the\n * store and the baseline so the field starts clean (not dirty).\n * Returns an **unregister** callback that calls `fields.remove()` on the same field.\n */\n register<K extends FlatKeyOf<TValues>>(\n name: K,\n options?: RegisterFieldOptions<TypeAtPath<TValues, K>>,\n ): Unsubscribe;\n /** Remove a field entirely: drops value, dirty, touched, error, and any registered validator. */\n remove(name: FlatKeyOf<TValues>): void;\n /**\n * Add, replace, or remove a field validator.\n * Removing a validator (passing `undefined`) also immediately clears any existing error for that field.\n */\n setValidator(name: FlatKeyOf<TValues>, validator?: FieldValidator): void;\n };\n /** Replace values and baseline in one operation. Aborts any in-flight validation. */\n replace(newValues: TValues): void;\n /** Restore values from the current baseline and clear errors/touched/dirty. Aborts any in-flight validation. */\n reset(): void;\n resetField(name: FlatKeyOf<TValues>): void;\n /** Replace the entire error map. Use `undefined` values to omit entries. */\n resetErrors(errors?: Partial<Record<ErrorKeyOf<TValues>, string | undefined>>): void;\n /**\n * Returns a scoped sub-form whose field paths are relative to `prefix`.\n * `scopedForm.get('city')` is equivalent to `form.get('${prefix}.city')`.\n * The scoped form shares state and lifecycle with the parent — `dispose()` on a scoped\n * form is a no-op; call `parentForm.dispose()` to tear down the whole form.\n *\n * Results are memoized — calling `scope(prefix)` multiple times with the same prefix\n * returns the same object. Safe to call on every render.\n *\n * **`state`** returns a scoped projection: `errors`, `touchedFields`, `validatingFields`,\n * `isValid`, `isDirty`, and `isTouched` reflect only fields within this prefix.\n * `isSubmitting`, `isLoading`, `isValidating`, and `submitCount` reflect the full form.\n */\n scope<P extends FlatKeyOf<TValues>>(prefix: P): Form<ScopedValues<TValues, P>>;\n set<K extends FlatKeyOf<TValues>>(name: K, value: TypeAtPath<TValues, K>, options?: SetOptions): void;\n /** Set a field error. */\n setError(name: ErrorKeyOf<TValues>, message: string): void;\n /**\n * Capture the complete form state into a snapshot that can be passed to `restore()`.\n * Useful for undo/redo, draft saving, and \"discard changes\" flows.\n */\n snapshot(): FormSnapshot<TValues>;\n /**\n * Restore the form to a previously captured snapshot. Replaces all state:\n * values, baseline, errors, touched, dirty, and submitCount.\n * Aborts any in-flight validation.\n */\n restore(snapshot: FormSnapshot<TValues>): void;\n readonly state: FormState;\n submit<TResult = void>(handler: (values: TValues) => MaybePromise<TResult>): Promise<SubmitResult<TResult>>;\n /**\n * Like `submit()` but throws a `ForgeValidationError` when validation fails instead of returning\n * `{ ok: false, ... }`. Use when you prefer a throw-based control flow.\n *\n * @throws {ForgeValidationError} when validation fails.\n * @throws {Error} when `submit()` is already in progress.\n */\n submitOrThrow<TResult = void>(handler: (values: TValues) => MaybePromise<TResult>): Promise<TResult>;\n subscribe(listener: (state: FormState) => void, options?: SubscribeOptions): Unsubscribe;\n /**\n * Subscribe to form state changes filtered to this scope's prefix.\n * `errors`, `touchedFields`, and `validatingFields` are remapped to relative paths;\n * all other state flags reflect the full form.\n * The listener fires only when the scoped projection changes — unrelated field mutations\n * outside this prefix are suppressed.\n * On a root form, behaves identically to `subscribe` — no prefix filtering is applied.\n */\n subscribeScoped(listener: (state: FormState) => void, options?: SubscribeOptions): Unsubscribe;\n subscribeField<K extends FlatKeyOf<TValues>>(\n name: K,\n listener: (state: FieldState<TypeAtPath<TValues, K>>) => void,\n options?: SubscribeOptions,\n ): Unsubscribe;\n /**\n * Iterate over form state changes via `for await`.\n * Yields the current state immediately, then once per mutation until the iterator\n * is returned or the form is disposed.\n *\n * @example\n * for await (const state of form) {\n * if (state.isSubmitting) showSpinner();\n * }\n */\n [Symbol.asyncIterator](): AsyncIterableIterator<FormState>;\n /** Delegates to `dispose()`. Enables `using` declarations. */\n [Symbol.dispose](): void;\n /** Mark a field as touched. */\n touch(name: FlatKeyOf<TValues>): void;\n /** Mark all known fields (store + validators) as touched. */\n touchAll(): void;\n /** Mark a field as untouched. No-op if the field is not currently touched. */\n untouch(name: FlatKeyOf<TValues>): void;\n /** Mark all fields as untouched. */\n untouchAll(): void;\n /**\n * Validate all registered field validators and the optional form validator.\n *\n * On a scoped form: validates only the fields within the scope and does not run the\n * form-level validator. Errors and `valid` reflect only scoped fields.\n */\n validate(signal?: AbortSignal): Promise<ValidateResult>;\n /**\n * Validate a single named field. Preserves other fields' errors. Does not run the form-level validator.\n * Returns a `ValidateResult` scoped to that field — `errors` contains at most one entry.\n */\n validate(name: FlatKeyOf<TValues>, signal?: AbortSignal): Promise<ValidateResult>;\n /**\n * Validate a specific set of fields. Preserves other fields' errors. Does not run the form-level validator.\n * Returns a `ValidateResult` scoped to the requested fields.\n */\n validate(fields: FlatKeyOf<TValues>[], signal?: AbortSignal): Promise<ValidateResult>;\n /**\n * Streaming validation — yields each field result as soon as its validator resolves.\n * The final item in the stream is the form-level validator result (field: '_form'), if configured.\n *\n * @example\n * for await (const result of form.validateStream()) {\n * console.log(result.field, result.error ?? 'ok');\n * }\n */\n validateStream(signal?: AbortSignal): AsyncIterableIterator<{ error: string | undefined; field: string }>;\n values(): TValues;\n}\n"],"mappings":"AA4CA,IAAa,EAAa,QAkMb,EAAkB,CAC7B,OAAQ,CAAE,YAAa,GAAM,eAAgB,EAAK,EAClD,SAAU,CAAE,YAAa,GAAM,iBAAkB,EAAK,EACtD,SAAU,CAAC,EACX,UAAW,CAAE,YAAa,GAAM,eAAgB,GAAM,gBAAiB,EAAK,CAC9E"}
|
|
1
|
+
{"version":3,"file":"types.cjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["/** A callback to remove a subscription. */\nexport type Unsubscribe = () => void;\n\nexport type MaybePromise<T> = T | PromiseLike<T>;\n\nexport type FieldValidator<V = unknown> = (value: V, signal?: AbortSignal) => MaybePromise<string | undefined>;\n\nexport type FormValidator<TValues extends Record<string, unknown> = Record<string, unknown>> = (\n values: TValues,\n signal?: AbortSignal,\n) => MaybePromise<Partial<Record<ErrorKeyOf<TValues>, string>> | undefined>;\n\nexport type SetOptions = {\n /** Whether to mark the field as touched. Default: false. */\n touched?: boolean;\n};\n\nexport type FormState = {\n errors: Readonly<Record<string, string> & { [FORM_ERROR]?: string }>;\n isDirty: boolean;\n /** `true` while an async `defaultValues` factory is resolving. */\n isLoading: boolean;\n isSubmitting: boolean;\n isTouched: boolean;\n isValid: boolean;\n isValidating: boolean;\n submitCount: number;\n /**\n * Field names that are currently touched, as full dot-notation paths.\n * On a scoped form these are still full paths (e.g. `\"address.city\"`, not `\"city\"`).\n * Prefer calling `scopedForm.validate()` to run scoped validation rather than\n * passing `state.touchedFields` directly — scoped `validate(fields[])` expects relative paths.\n */\n touchedFields: readonly string[];\n /** Field names that currently have an active async validation run. Useful for per-field loading indicators. */\n validatingFields: readonly string[];\n};\n\nexport type SubscribeOptions = {\n /** Call the listener immediately with the current state on subscription. Default: false. */\n sync?: boolean;\n};\n\n/** Shared field key for root-level / form-level validation errors. */\nexport const FORM_ERROR = '_form' as const;\n\nexport type ValidateResult = {\n errors: Readonly<Record<string, string>>;\n valid: boolean;\n};\n\nexport type SubmitResult<TResult = void> =\n { ok: true; value: TResult } | { errors: Record<string, string>; ok: false; type: 'validation' };\n\n/* -------------------- Utility Types -------------------- */\n\n/**\n * Recursively makes all properties optional.\n * Used by `form.patch()` to accept partial nested updates.\n */\nexport type DeepPartial<T> = T extends Record<string, unknown> ? { [K in keyof T]?: DeepPartial<T[K]> } : T;\n\n/**\n * Single source of truth for the typed-path depth ceiling, shared by `FlatKeyOf`'s\n * type-level cutoff below and `_utils.ts`'s matching runtime dev-warning threshold —\n * one named constant instead of two hardcoded `5`s that could silently drift apart.\n *\n * Deliberately not a per-form generic parameter (e.g. `Form<TValues, MaxDepth>`): the\n * whole point of this cutoff is protecting TypeScript compile time, which is a\n * repo-wide concern, not a per-form preference. Making it user-configurable would let\n * one form's type param silently regress compile performance for everyone who imports\n * it. If a real shape needs deeper typed paths, flatten it or accept `string` typing\n * for those leaves — `FlatKeyOf` already falls back to `string` gracefully past this\n * depth, so nothing is a hard error either way.\n */\nexport const MAX_TYPED_PATH_DEPTH = 5 as const;\n\n/**\n * Recursively extracts all dot-notation leaf keys from a values shape.\n * Depth-limited to {@link MAX_TYPED_PATH_DEPTH}: TypeScript compilation time grows\n * non-linearly beyond this point.\n */\nexport type FlatKeyOf<\n T extends Record<string, unknown>,\n P extends string = '',\n D extends readonly 0[] = [],\n> = D['length'] extends typeof MAX_TYPED_PATH_DEPTH\n ? string\n : {\n [K in keyof T & string]: T[K] extends unknown[] | File | Blob | Date\n ? P extends ''\n ? K\n : `${P}.${K}`\n : T[K] extends Record<string, unknown>\n ? FlatKeyOf<T[K] & Record<string, unknown>, P extends '' ? K : `${P}.${K}`, [...D, 0]>\n : P extends ''\n ? K\n : `${P}.${K}`;\n }[keyof T & string];\n\n/** Resolves the value type at a dot-notation path within a values shape. */\nexport type TypeAtPath<T, K extends string> = K extends `${infer Head}.${infer Tail}`\n ? Head extends keyof T\n ? T[Head] extends Record<string, unknown>\n ? TypeAtPath<T[Head], Tail>\n : unknown\n : unknown\n : K extends keyof T\n ? T[K]\n : unknown;\n\n/** Field error keys include field paths plus the reserved `_form` key for root-level issues. */\nexport type ErrorKeyOf<TValues extends Record<string, unknown>> = FlatKeyOf<TValues> | typeof FORM_ERROR;\n\n/**\n * Structural interface for safeParse-compatible schemas.\n * Works with `@vielzeug/spell`, Zod, Valibot, and any Standard Schema compliant library.\n */\nexport type SafeParseSchema = {\n safeParse(\n data: unknown,\n ): { success: true } | { error: { issues: { message: string; path: (string | number)[] }[] }; success: false };\n};\n\n/** The type of values accessible at a scoped sub-form prefix. */\nexport type ScopedValues<TValues, P extends string> =\n TypeAtPath<TValues, P> extends Record<string, unknown>\n ? TypeAtPath<TValues, P> & Record<string, unknown>\n : Record<string, unknown>;\n\n/**\n * The live connection object returned by `form.connect()`.\n * Getters re-evaluate on every property access — store the object once per field, do not destructure.\n * Call `dispose()` to cancel any pending debounce timers when the field unmounts.\n */\nexport type ConnectionResult<V = unknown> = {\n [Symbol.dispose](): void;\n readonly dirty: boolean;\n /** Cancels the debounce timer owned by this specific binding. Safe to call multiple times. */\n dispose(): void;\n /** `true` after `dispose()` has been called on this binding. */\n readonly disposed: boolean;\n readonly error: string | undefined;\n onBlur(): void;\n onChange(value: V): void;\n readonly touched: boolean;\n readonly value: V;\n};\n\n/** Per-field or global validation trigger configuration. */\nexport type ConnectOptions = {\n /**\n * Debounce auto-triggered validation by this many milliseconds.\n * Each `connect()` call owns its own timer — cancelling one binding does not affect others.\n * Default: 0.\n */\n debounce?: number;\n /** Auto-mark the field as touched when it loses focus. Default: false. */\n touchOnBlur?: boolean;\n /** Validate the field automatically when it loses focus. Default: false. */\n validateOnBlur?: boolean;\n /** Validate the field automatically after each value change. Default: false. */\n validateOnChange?: boolean;\n /** Validate on change only after the field has been touched at least once. */\n validateOnTouch?: boolean;\n};\n\n// Resolves the element type of an array, or `unknown` for non-arrays.\ntype ElementOf<T> = T extends readonly (infer E)[] ? E : unknown;\n\nexport type ArrayField<T = unknown> = {\n append(value: T): void;\n insert(index: number, value: T): void;\n move(from: number, to: number): void;\n prepend(value: T): void;\n remove(index: number): void;\n replace(index: number, value: T): void;\n swap(a: number, b: number): void;\n};\n\nexport type FieldState<V = unknown> = {\n dirty: boolean;\n error: string | undefined;\n /** `true` when `error` is not `undefined`. Convenience alias for `error !== undefined`. */\n hasError: boolean;\n touched: boolean;\n value: V;\n};\n\n/**\n * Options for registering a dynamic field. Both properties are optional;\n * omitting `defaultValue` leaves the field uninitialized and omitting `validator`\n * skips field-level validation.\n */\nexport type RegisterFieldOptions<V = unknown> = {\n /** Initial value. Also becomes the baseline, so the field starts clean. */\n defaultValue?: V;\n /** Field-level validator to attach. */\n validator?: FieldValidator<V>;\n};\n\n/**\n * A complete snapshot of form state that can be restored via `form.history.restore()`.\n * `store` and `baseline` keys are the flattened dot-notation paths used internally.\n * Typed with `TValues` for nominal clarity — structurally both are `Record<string, unknown>`.\n */\nexport type FormSnapshot<TValues extends Record<string, unknown> = Record<string, unknown>> = {\n readonly baseline: Partial<Record<FlatKeyOf<TValues>, unknown>>;\n readonly dirty: readonly string[];\n readonly errors: Readonly<Record<string, string>>;\n readonly store: Partial<Record<FlatKeyOf<TValues>, unknown>>;\n readonly submitCount: number;\n readonly touched: readonly string[];\n};\n\n/**\n * Undo/redo-style snapshotting, namespaced off the main `Form<T>` surface since it's a\n * distinctly less common operation than reading/writing values — grouped the same way\n * `fields` already groups dynamic-field-lifecycle operations.\n */\nexport type FormHistory<TValues extends Record<string, unknown> = Record<string, unknown>> = {\n /**\n * Restore the form to a previously captured snapshot. Replaces all state:\n * values, baseline, errors, touched, dirty, and submitCount.\n * Aborts any in-flight validation.\n */\n restore(snapshot: FormSnapshot<TValues>): void;\n /**\n * Capture the complete form state into a snapshot that can be passed to `restore()`.\n * Useful for undo/redo, draft saving, and \"discard changes\" flows.\n */\n snapshot(): FormSnapshot<TValues>;\n};\n\nexport type FormOptions<TValues extends Record<string, unknown> = Record<string, unknown>> = {\n /**\n * Default connect behavior applied when `connect(name, config)` omits specific options.\n * Use `ValidationModes` presets for common strategies:\n * - `ValidationModes.onSubmit` (default) — validates only on submit, no touch-on-blur\n * - `ValidationModes.onBlur` — validates each field on blur\n * - `ValidationModes.onChange` — validates each field on every change\n * - `ValidationModes.onTouched` — validates on blur first, then on every change once touched\n */\n connect?: ConnectOptions;\n /**\n * Initial form values. May be a static object or an async factory function.\n * While a factory is pending, `form.isLoading` is `true` and the form is read-only.\n */\n defaultValues?: { [K in keyof TValues]: TValues[K] } | (() => Promise<{ [K in keyof TValues]: TValues[K] }>);\n /**\n * Called when an async `defaultValues` factory rejects.\n * Use to show an error UI or retry logic. In development, a warning is also emitted via `console.warn`.\n */\n onLoadError?: (error: unknown) => void;\n /**\n * Form-level validator. Accepts either:\n * - A `FormValidator` function\n * - Any `safeParse`-compatible schema (auto-detected, works with `@vielzeug/spell`, Zod, Valibot)\n */\n validator?: FormValidator<TValues> | SafeParseSchema;\n /** Field-level validators keyed by field name or dot-notation path. */\n validators?: Partial<Record<FlatKeyOf<TValues>, FieldValidator>>;\n};\n\n/**\n * Named presets for common validation trigger strategies.\n * Pass to `createForm({ connect: ValidationModes.onBlur })`.\n *\n * - `onSubmit` — no automatic validation or touch. Clean until the user submits.\n * - `onBlur` — validates and marks touched on blur.\n * - `onChange` — validates on every keystroke (marks touched on blur).\n * - `onTouched` — validates on blur first, then on every change once touched.\n */\nexport const ValidationModes = {\n onBlur: { touchOnBlur: true, validateOnBlur: true },\n onChange: { touchOnBlur: true, validateOnChange: true },\n onSubmit: {},\n onTouched: { touchOnBlur: true, validateOnBlur: true, validateOnTouch: true },\n} as const satisfies Record<string, ConnectOptions>;\n\nexport interface Form<TValues extends Record<string, unknown> = Record<string, unknown>> {\n /** Returns a cached typed `ArrayField` helper for mutating array-valued fields. */\n array<K extends FlatKeyOf<TValues>>(name: K): ArrayField<ElementOf<TypeAtPath<TValues, K>>>;\n batch(fn: () => void): void;\n /** Clear a single field error. No-op if the field has no error. */\n clearError(name: ErrorKeyOf<TValues>): void;\n /**\n * Returns a live connection object for a field (DOM event handlers + live getters).\n * Each call to `connect()` creates a new object with its own debounce timer.\n * Call `binding.dispose()` on unmount to cancel any pending debounce timer.\n * Do not destructure: getters re-evaluate on every property access.\n */\n connect<K extends FlatKeyOf<TValues>>(name: K, config?: ConnectOptions): ConnectionResult<TypeAtPath<TValues, K>>;\n dispose(): void;\n /** Aborted when `dispose()` is called. Use to cancel async work tied to this form's lifetime. */\n readonly disposalSignal: AbortSignal;\n readonly disposed: boolean;\n field<K extends FlatKeyOf<TValues>>(name: K): FieldState<TypeAtPath<TValues, K>>;\n get<K extends FlatKeyOf<TValues>>(name: K): TypeAtPath<TValues, K>;\n /** `true` while an async `defaultValues` factory is resolving. Mirrors `state.isLoading`. */\n readonly isLoading: boolean;\n /** `true` while a `submit()` call is in progress. Mirrors `state.isSubmitting`. */\n readonly isSubmitting: boolean;\n /**\n * Merge a partial server response into the form: updates both the store and the baseline\n * for each provided field, marking them clean. Fields not included in `partial` are untouched.\n */\n patch(partial: DeepPartial<TValues>): void;\n /**\n * Field-lifecycle namespace — use to dynamically register/remove fields and manage validators.\n *\n * @example\n * const unsub = form.fields.register('email', { defaultValue: '', validator: required });\n * form.fields.setValidator('email', (v) => v ? undefined : 'Required');\n * form.fields.remove('email');\n */\n fields: {\n /**\n * Enumerate all currently-known field paths: the deduplicated union of populated store\n * keys and keys with a registered validator (the same definition `touchAll()` uses).\n * On a scoped form, paths are relative to the scope's prefix — matching `scope.state`'s\n * relative-path convention, not `state.touchedFields`'s absolute-path convention.\n */\n list(): readonly string[];\n /**\n * Declare a dynamic field with an optional default value and validator.\n * If the field does not yet exist in the store, `defaultValue` is written to both the\n * store and the baseline so the field starts clean (not dirty).\n * Returns an **unregister** callback that calls `fields.remove()` on the same field.\n */\n register<K extends FlatKeyOf<TValues>>(\n name: K,\n options?: RegisterFieldOptions<TypeAtPath<TValues, K>>,\n ): Unsubscribe;\n /** Remove a field entirely: drops value, dirty, touched, error, and any registered validator. */\n remove(name: FlatKeyOf<TValues>): void;\n /**\n * Add, replace, or remove a field validator.\n * Removing a validator (passing `undefined`) also immediately clears any existing error for that field.\n */\n setValidator(name: FlatKeyOf<TValues>, validator?: FieldValidator): void;\n };\n /**\n * Undo/redo-style snapshotting — see {@link FormHistory}. Namespaced off the main surface\n * since it's a distinctly less common operation than reading/writing values.\n *\n * @example\n * const before = form.history.snapshot();\n * form.patch({ status: 'archived' });\n * form.history.restore(before); // undo\n */\n history: FormHistory<TValues>;\n /** Replace values and baseline in one operation. Aborts any in-flight validation. */\n replace(newValues: TValues): void;\n /** Restore values from the current baseline and clear errors/touched/dirty. Aborts any in-flight validation. */\n reset(): void;\n resetField(name: FlatKeyOf<TValues>): void;\n /** Replace the entire error map. Use `undefined` values to omit entries. */\n resetErrors(errors?: Partial<Record<ErrorKeyOf<TValues>, string | undefined>>): void;\n /**\n * Returns a scoped sub-form whose field paths are relative to `prefix`.\n * `scopedForm.get('city')` is equivalent to `form.get('${prefix}.city')`.\n * The scoped form shares state and lifecycle with the parent — `dispose()` on a scoped\n * form is a no-op; call `parentForm.dispose()` to tear down the whole form.\n *\n * Results are memoized — calling `scope(prefix)` multiple times with the same prefix\n * returns the same object. Safe to call on every render.\n *\n * **`state`** returns a scoped projection: `errors`, `touchedFields`, `validatingFields`,\n * `isValid`, `isDirty`, and `isTouched` reflect only fields within this prefix.\n * `isSubmitting`, `isLoading`, `isValidating`, and `submitCount` reflect the full form.\n */\n scope<P extends FlatKeyOf<TValues>>(prefix: P): Form<ScopedValues<TValues, P>>;\n set<K extends FlatKeyOf<TValues>>(name: K, value: TypeAtPath<TValues, K>, options?: SetOptions): void;\n /** Set a field error. */\n setError(name: ErrorKeyOf<TValues>, message: string): void;\n readonly state: FormState;\n submit<TResult = void>(handler: (values: TValues) => MaybePromise<TResult>): Promise<SubmitResult<TResult>>;\n /**\n * Like `submit()` but throws a `ForgeValidationError` when validation fails instead of returning\n * `{ ok: false, ... }`. Use when you prefer a throw-based control flow.\n *\n * @throws {ForgeValidationError} when validation fails.\n * @throws {ForgeSubmitError} when `submit()` is already in progress.\n */\n submitOrThrow<TResult = void>(handler: (values: TValues) => MaybePromise<TResult>): Promise<TResult>;\n /**\n * Subscribe to form state changes.\n * On a scoped form (`form.scope(prefix)`), `errors`, `touchedFields`, and `validatingFields`\n * are remapped to relative paths, and the listener fires only when the scoped projection\n * changes — mutations outside the scope's prefix are suppressed. On a root form, no\n * filtering is applied.\n */\n subscribe(listener: (state: FormState) => void, options?: SubscribeOptions): Unsubscribe;\n subscribeField<K extends FlatKeyOf<TValues>>(\n name: K,\n listener: (state: FieldState<TypeAtPath<TValues, K>>) => void,\n options?: SubscribeOptions,\n ): Unsubscribe;\n /**\n * Iterate over form state changes via `for await`.\n * Yields the current state immediately, then once per mutation until the iterator\n * is returned or the form is disposed.\n *\n * @example\n * for await (const state of form) {\n * if (state.isSubmitting) showSpinner();\n * }\n */\n [Symbol.asyncIterator](): AsyncIterableIterator<FormState>;\n /** Delegates to `dispose()`. Enables `using` declarations. */\n [Symbol.dispose](): void;\n /** Mark a field as touched. */\n touch(name: FlatKeyOf<TValues>): void;\n /** Mark all known fields (store + validators) as touched. */\n touchAll(): void;\n /** Mark a field as untouched. No-op if the field is not currently touched. */\n untouch(name: FlatKeyOf<TValues>): void;\n /** Mark all fields as untouched. */\n untouchAll(): void;\n /**\n * Validate all registered field validators and the optional form validator.\n *\n * On a scoped form: validates only the fields within the scope and does not run the\n * form-level validator. Errors and `valid` reflect only scoped fields.\n */\n validate(signal?: AbortSignal): Promise<ValidateResult>;\n /**\n * Validate a single named field. Preserves other fields' errors. Does not run the form-level validator.\n * Returns a `ValidateResult` scoped to that field — `errors` contains at most one entry.\n */\n validate(name: FlatKeyOf<TValues>, signal?: AbortSignal): Promise<ValidateResult>;\n /**\n * Validate a specific set of fields. Preserves other fields' errors. Does not run the form-level validator.\n * Returns a `ValidateResult` scoped to the requested fields.\n */\n validate(fields: FlatKeyOf<TValues>[], signal?: AbortSignal): Promise<ValidateResult>;\n values(): TValues;\n}\n"],"mappings":"AA4CA,IAAa,EAAa,QA+Bb,EAAuB,EAsMvB,EAAkB,CAC7B,OAAQ,CAAE,YAAa,GAAM,eAAgB,EAAK,EAClD,SAAU,CAAE,YAAa,GAAM,iBAAkB,EAAK,EACtD,SAAU,CAAC,EACX,UAAW,CAAE,YAAa,GAAM,eAAgB,GAAM,gBAAiB,EAAK,CAC9E"}
|
package/dist/types.d.ts
CHANGED
|
@@ -54,11 +54,26 @@ export type SubmitResult<TResult = void> = {
|
|
|
54
54
|
export type DeepPartial<T> = T extends Record<string, unknown> ? {
|
|
55
55
|
[K in keyof T]?: DeepPartial<T[K]>;
|
|
56
56
|
} : T;
|
|
57
|
+
/**
|
|
58
|
+
* Single source of truth for the typed-path depth ceiling, shared by `FlatKeyOf`'s
|
|
59
|
+
* type-level cutoff below and `_utils.ts`'s matching runtime dev-warning threshold —
|
|
60
|
+
* one named constant instead of two hardcoded `5`s that could silently drift apart.
|
|
61
|
+
*
|
|
62
|
+
* Deliberately not a per-form generic parameter (e.g. `Form<TValues, MaxDepth>`): the
|
|
63
|
+
* whole point of this cutoff is protecting TypeScript compile time, which is a
|
|
64
|
+
* repo-wide concern, not a per-form preference. Making it user-configurable would let
|
|
65
|
+
* one form's type param silently regress compile performance for everyone who imports
|
|
66
|
+
* it. If a real shape needs deeper typed paths, flatten it or accept `string` typing
|
|
67
|
+
* for those leaves — `FlatKeyOf` already falls back to `string` gracefully past this
|
|
68
|
+
* depth, so nothing is a hard error either way.
|
|
69
|
+
*/
|
|
70
|
+
export declare const MAX_TYPED_PATH_DEPTH: 5;
|
|
57
71
|
/**
|
|
58
72
|
* Recursively extracts all dot-notation leaf keys from a values shape.
|
|
59
|
-
* Depth-limited to
|
|
73
|
+
* Depth-limited to {@link MAX_TYPED_PATH_DEPTH}: TypeScript compilation time grows
|
|
74
|
+
* non-linearly beyond this point.
|
|
60
75
|
*/
|
|
61
|
-
export type FlatKeyOf<T extends Record<string, unknown>, P extends string = '', D extends readonly 0[] = []> = D['length'] extends
|
|
76
|
+
export type FlatKeyOf<T extends Record<string, unknown>, P extends string = '', D extends readonly 0[] = []> = D['length'] extends typeof MAX_TYPED_PATH_DEPTH ? string : {
|
|
62
77
|
[K in keyof T & string]: T[K] extends unknown[] | File | Blob | Date ? P extends '' ? K : `${P}.${K}` : T[K] extends Record<string, unknown> ? FlatKeyOf<T[K] & Record<string, unknown>, P extends '' ? K : `${P}.${K}`, [...D, 0]> : P extends '' ? K : `${P}.${K}`;
|
|
63
78
|
}[keyof T & string];
|
|
64
79
|
/** Resolves the value type at a dot-notation path within a values shape. */
|
|
@@ -149,7 +164,7 @@ export type RegisterFieldOptions<V = unknown> = {
|
|
|
149
164
|
validator?: FieldValidator<V>;
|
|
150
165
|
};
|
|
151
166
|
/**
|
|
152
|
-
* A complete snapshot of form state that can be restored via `form.restore()`.
|
|
167
|
+
* A complete snapshot of form state that can be restored via `form.history.restore()`.
|
|
153
168
|
* `store` and `baseline` keys are the flattened dot-notation paths used internally.
|
|
154
169
|
* Typed with `TValues` for nominal clarity — structurally both are `Record<string, unknown>`.
|
|
155
170
|
*/
|
|
@@ -161,6 +176,24 @@ export type FormSnapshot<TValues extends Record<string, unknown> = Record<string
|
|
|
161
176
|
readonly submitCount: number;
|
|
162
177
|
readonly touched: readonly string[];
|
|
163
178
|
};
|
|
179
|
+
/**
|
|
180
|
+
* Undo/redo-style snapshotting, namespaced off the main `Form<T>` surface since it's a
|
|
181
|
+
* distinctly less common operation than reading/writing values — grouped the same way
|
|
182
|
+
* `fields` already groups dynamic-field-lifecycle operations.
|
|
183
|
+
*/
|
|
184
|
+
export type FormHistory<TValues extends Record<string, unknown> = Record<string, unknown>> = {
|
|
185
|
+
/**
|
|
186
|
+
* Restore the form to a previously captured snapshot. Replaces all state:
|
|
187
|
+
* values, baseline, errors, touched, dirty, and submitCount.
|
|
188
|
+
* Aborts any in-flight validation.
|
|
189
|
+
*/
|
|
190
|
+
restore(snapshot: FormSnapshot<TValues>): void;
|
|
191
|
+
/**
|
|
192
|
+
* Capture the complete form state into a snapshot that can be passed to `restore()`.
|
|
193
|
+
* Useful for undo/redo, draft saving, and "discard changes" flows.
|
|
194
|
+
*/
|
|
195
|
+
snapshot(): FormSnapshot<TValues>;
|
|
196
|
+
};
|
|
164
197
|
export type FormOptions<TValues extends Record<string, unknown> = Record<string, unknown>> = {
|
|
165
198
|
/**
|
|
166
199
|
* Default connect behavior applied when `connect(name, config)` omits specific options.
|
|
@@ -278,6 +311,16 @@ export interface Form<TValues extends Record<string, unknown> = Record<string, u
|
|
|
278
311
|
*/
|
|
279
312
|
setValidator(name: FlatKeyOf<TValues>, validator?: FieldValidator): void;
|
|
280
313
|
};
|
|
314
|
+
/**
|
|
315
|
+
* Undo/redo-style snapshotting — see {@link FormHistory}. Namespaced off the main surface
|
|
316
|
+
* since it's a distinctly less common operation than reading/writing values.
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* const before = form.history.snapshot();
|
|
320
|
+
* form.patch({ status: 'archived' });
|
|
321
|
+
* form.history.restore(before); // undo
|
|
322
|
+
*/
|
|
323
|
+
history: FormHistory<TValues>;
|
|
281
324
|
/** Replace values and baseline in one operation. Aborts any in-flight validation. */
|
|
282
325
|
replace(newValues: TValues): void;
|
|
283
326
|
/** Restore values from the current baseline and clear errors/touched/dirty. Aborts any in-flight validation. */
|
|
@@ -302,17 +345,6 @@ export interface Form<TValues extends Record<string, unknown> = Record<string, u
|
|
|
302
345
|
set<K extends FlatKeyOf<TValues>>(name: K, value: TypeAtPath<TValues, K>, options?: SetOptions): void;
|
|
303
346
|
/** Set a field error. */
|
|
304
347
|
setError(name: ErrorKeyOf<TValues>, message: string): void;
|
|
305
|
-
/**
|
|
306
|
-
* Capture the complete form state into a snapshot that can be passed to `restore()`.
|
|
307
|
-
* Useful for undo/redo, draft saving, and "discard changes" flows.
|
|
308
|
-
*/
|
|
309
|
-
snapshot(): FormSnapshot<TValues>;
|
|
310
|
-
/**
|
|
311
|
-
* Restore the form to a previously captured snapshot. Replaces all state:
|
|
312
|
-
* values, baseline, errors, touched, dirty, and submitCount.
|
|
313
|
-
* Aborts any in-flight validation.
|
|
314
|
-
*/
|
|
315
|
-
restore(snapshot: FormSnapshot<TValues>): void;
|
|
316
348
|
readonly state: FormState;
|
|
317
349
|
submit<TResult = void>(handler: (values: TValues) => MaybePromise<TResult>): Promise<SubmitResult<TResult>>;
|
|
318
350
|
/**
|
|
@@ -320,19 +352,17 @@ export interface Form<TValues extends Record<string, unknown> = Record<string, u
|
|
|
320
352
|
* `{ ok: false, ... }`. Use when you prefer a throw-based control flow.
|
|
321
353
|
*
|
|
322
354
|
* @throws {ForgeValidationError} when validation fails.
|
|
323
|
-
* @throws {
|
|
355
|
+
* @throws {ForgeSubmitError} when `submit()` is already in progress.
|
|
324
356
|
*/
|
|
325
357
|
submitOrThrow<TResult = void>(handler: (values: TValues) => MaybePromise<TResult>): Promise<TResult>;
|
|
326
|
-
subscribe(listener: (state: FormState) => void, options?: SubscribeOptions): Unsubscribe;
|
|
327
358
|
/**
|
|
328
|
-
* Subscribe to form state changes
|
|
329
|
-
* `errors`, `touchedFields`, and `validatingFields`
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
* On a root form, behaves identically to `subscribe` — no prefix filtering is applied.
|
|
359
|
+
* Subscribe to form state changes.
|
|
360
|
+
* On a scoped form (`form.scope(prefix)`), `errors`, `touchedFields`, and `validatingFields`
|
|
361
|
+
* are remapped to relative paths, and the listener fires only when the scoped projection
|
|
362
|
+
* changes — mutations outside the scope's prefix are suppressed. On a root form, no
|
|
363
|
+
* filtering is applied.
|
|
334
364
|
*/
|
|
335
|
-
|
|
365
|
+
subscribe(listener: (state: FormState) => void, options?: SubscribeOptions): Unsubscribe;
|
|
336
366
|
subscribeField<K extends FlatKeyOf<TValues>>(name: K, listener: (state: FieldState<TypeAtPath<TValues, K>>) => void, options?: SubscribeOptions): Unsubscribe;
|
|
337
367
|
/**
|
|
338
368
|
* Iterate over form state changes via `for await`.
|
|
@@ -372,19 +402,6 @@ export interface Form<TValues extends Record<string, unknown> = Record<string, u
|
|
|
372
402
|
* Returns a `ValidateResult` scoped to the requested fields.
|
|
373
403
|
*/
|
|
374
404
|
validate(fields: FlatKeyOf<TValues>[], signal?: AbortSignal): Promise<ValidateResult>;
|
|
375
|
-
/**
|
|
376
|
-
* Streaming validation — yields each field result as soon as its validator resolves.
|
|
377
|
-
* The final item in the stream is the form-level validator result (field: '_form'), if configured.
|
|
378
|
-
*
|
|
379
|
-
* @example
|
|
380
|
-
* for await (const result of form.validateStream()) {
|
|
381
|
-
* console.log(result.field, result.error ?? 'ok');
|
|
382
|
-
* }
|
|
383
|
-
*/
|
|
384
|
-
validateStream(signal?: AbortSignal): AsyncIterableIterator<{
|
|
385
|
-
error: string | undefined;
|
|
386
|
-
field: string;
|
|
387
|
-
}>;
|
|
388
405
|
values(): TValues;
|
|
389
406
|
}
|
|
390
407
|
export {};
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC;AAErC,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAA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,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACxD;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAClF;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACtF,MAAM,IAAI,OAAO,CAAC;CACnB"}
|
package/dist/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/types.ts
|
|
2
|
-
var e = "_form", t = {
|
|
2
|
+
var e = "_form", t = 5, n = {
|
|
3
3
|
onBlur: {
|
|
4
4
|
touchOnBlur: !0,
|
|
5
5
|
validateOnBlur: !0
|
|
@@ -16,6 +16,6 @@ var e = "_form", t = {
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
19
|
-
export { e as FORM_ERROR, t as ValidationModes };
|
|
19
|
+
export { e as FORM_ERROR, t as MAX_TYPED_PATH_DEPTH, n as ValidationModes };
|
|
20
20
|
|
|
21
21
|
//# sourceMappingURL=types.js.map
|