@lehnihon/bit-form 2.2.7 → 2.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/angular/index.cjs +1 -1
- package/dist/angular/index.cjs.map +1 -1
- package/dist/angular/index.d.cts +18 -15
- package/dist/angular/index.d.ts +18 -15
- package/dist/angular/index.js +1 -1
- package/dist/angular/index.js.map +1 -1
- package/dist/{array-controller-DtkmcnUr.d.ts → array-controller-C61ByyG6.d.ts} +5 -5
- package/dist/{array-controller-C1A5VKYd.d.cts → array-controller-CtlqjA0e.d.cts} +5 -5
- package/dist/bus-BKuMV3E7.d.ts +19 -0
- package/dist/bus-WOHGxuVy.d.cts +19 -0
- package/dist/chunk-2QLQPMCZ.js +2 -0
- package/dist/chunk-2QLQPMCZ.js.map +1 -0
- package/dist/chunk-3KI3GEU3.cjs +2 -0
- package/dist/chunk-3KI3GEU3.cjs.map +1 -0
- package/dist/chunk-5NA2TFPG.js +1 -0
- package/dist/chunk-5NA2TFPG.js.map +1 -0
- package/dist/chunk-6LNXTSZ6.cjs +2 -0
- package/dist/chunk-6LNXTSZ6.cjs.map +1 -0
- package/dist/chunk-BSGJ3T5S.cjs +2 -0
- package/dist/chunk-BSGJ3T5S.cjs.map +1 -0
- package/dist/chunk-GGZPA7AO.cjs +2 -0
- package/dist/chunk-GGZPA7AO.cjs.map +1 -0
- package/dist/chunk-ICYXODTQ.js +2 -0
- package/dist/chunk-ICYXODTQ.js.map +1 -0
- package/dist/chunk-J5ALITQW.cjs +2 -0
- package/dist/chunk-J5ALITQW.cjs.map +1 -0
- package/dist/chunk-J5GQLEVA.js +2 -0
- package/dist/chunk-J5GQLEVA.js.map +1 -0
- package/dist/chunk-KDHPLXZF.cjs +2 -0
- package/dist/chunk-KDHPLXZF.cjs.map +1 -0
- package/dist/chunk-N4HCGMMM.js +2 -0
- package/dist/chunk-N4HCGMMM.js.map +1 -0
- package/dist/chunk-OLQVH24Z.cjs +2 -0
- package/dist/chunk-OLQVH24Z.cjs.map +1 -0
- package/dist/chunk-QX2IVNMK.js +2 -0
- package/dist/chunk-QX2IVNMK.js.map +1 -0
- package/dist/chunk-RHMJPKNV.cjs +2 -0
- package/dist/chunk-RHMJPKNV.cjs.map +1 -0
- package/dist/chunk-UARLAXZX.js +2 -0
- package/dist/chunk-UARLAXZX.js.map +1 -0
- package/dist/chunk-UIKO6GGW.js +2 -0
- package/dist/chunk-UIKO6GGW.js.map +1 -0
- package/dist/chunk-W2E5UIXT.js +2 -0
- package/dist/chunk-W2E5UIXT.js.map +1 -0
- package/dist/chunk-W5CLDRRE.cjs +1 -0
- package/dist/chunk-W5CLDRRE.cjs.map +1 -0
- package/dist/chunk-X5UCRGYJ.cjs +2 -0
- package/dist/chunk-X5UCRGYJ.cjs.map +1 -0
- package/dist/chunk-Y3XVQGCU.js +2 -0
- package/dist/chunk-Y3XVQGCU.js.map +1 -0
- package/dist/cli/index.cjs +2 -2
- package/dist/core/bindings.cjs +2 -0
- package/dist/core/bindings.cjs.map +1 -0
- package/dist/core/bindings.d.cts +89 -0
- package/dist/core/bindings.d.ts +89 -0
- package/dist/core/bindings.js +2 -0
- package/dist/core/bindings.js.map +1 -0
- package/dist/core/status.cjs +2 -0
- package/dist/core/status.cjs.map +1 -0
- package/dist/core/status.d.cts +44 -0
- package/dist/core/status.d.ts +44 -0
- package/dist/core/status.js +2 -0
- package/dist/core/status.js.map +1 -0
- package/dist/core/store.cjs +2 -0
- package/dist/core/store.cjs.map +1 -0
- package/dist/core/store.d.cts +84 -0
- package/dist/core/store.d.ts +84 -0
- package/dist/core/store.js +2 -0
- package/dist/core/store.js.map +1 -0
- package/dist/core/utils.cjs +2 -0
- package/dist/core/utils.cjs.map +1 -0
- package/dist/core/utils.d.cts +74 -0
- package/dist/core/utils.d.ts +74 -0
- package/dist/core/utils.js +2 -0
- package/dist/core/utils.js.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +14 -122
- package/dist/core.d.ts +14 -122
- package/dist/core.js +1 -1
- package/dist/devtools/bridge.cjs +1 -1
- package/dist/devtools/bridge.cjs.map +1 -1
- package/dist/devtools/bridge.d.cts +3 -2
- package/dist/devtools/bridge.d.ts +3 -2
- package/dist/devtools/bridge.js +1 -1
- package/dist/devtools/index.cjs +2 -2
- package/dist/devtools/index.cjs.map +1 -1
- package/dist/devtools/index.d.cts +3 -2
- package/dist/devtools/index.d.ts +3 -2
- package/dist/devtools/index.js +1 -1
- package/dist/devtools/index.js.map +1 -1
- package/dist/{field-binding-X5TkvfUt.d.cts → field-binding-B_OX3bjp.d.cts} +1 -1
- package/dist/{field-binding-Bi1g-D8X.d.ts → field-binding-MX6jVQbT.d.ts} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -85
- package/dist/index.d.ts +8 -85
- package/dist/index.js +1 -1
- package/dist/mask.cjs +1 -1
- package/dist/mask.cjs.map +1 -1
- package/dist/mask.d.cts +2 -2
- package/dist/mask.d.ts +2 -2
- package/dist/mask.js +1 -1
- package/dist/mask.js.map +1 -1
- package/dist/meta-types-Bzmm21TP.d.cts +18 -0
- package/dist/meta-types-Bzmm21TP.d.ts +18 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +11 -9
- package/dist/react/index.d.ts +11 -9
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react-native/index.cjs +1 -1
- package/dist/react-native/index.cjs.map +1 -1
- package/dist/react-native/index.d.cts +9 -7
- package/dist/react-native/index.d.ts +9 -7
- package/dist/react-native/index.js +1 -1
- package/dist/react-native/index.js.map +1 -1
- package/dist/resolvers/index.cjs +1 -1
- package/dist/resolvers/index.cjs.map +1 -1
- package/dist/resolvers/index.d.cts +3 -2
- package/dist/resolvers/index.d.ts +3 -2
- package/dist/resolvers/index.js +1 -1
- package/dist/resolvers/joi.d.cts +3 -2
- package/dist/resolvers/joi.d.ts +3 -2
- package/dist/resolvers/yup.d.cts +3 -2
- package/dist/resolvers/yup.d.ts +3 -2
- package/dist/resolvers/zod.d.cts +3 -2
- package/dist/resolvers/zod.d.ts +3 -2
- package/dist/store-api-types-Bm3EAqR_.d.cts +161 -0
- package/dist/store-api-types-DfTFy2h4.d.ts +161 -0
- package/dist/{bus-DgilLszS.d.ts → types-CRCP4Pgq.d.ts} +82 -45
- package/dist/{types-CUXh7PqD.d.cts → types-D8DgIUhJ.d.cts} +1 -1
- package/dist/{types-CUXh7PqD.d.ts → types-D8DgIUhJ.d.ts} +1 -1
- package/dist/{bus-rcUiufS7.d.cts → types-SOg9xEce.d.cts} +82 -45
- package/dist/{upload-EXnJLq8k.d.cts → upload-C2mpfhp1.d.cts} +1 -1
- package/dist/{upload-EXnJLq8k.d.ts → upload-C2mpfhp1.d.ts} +1 -1
- package/dist/{use-bit-persist-CIKFwtdM.d.cts → use-bit-persist-BDMZmxBh.d.ts} +8 -6
- package/dist/{use-bit-persist-Bc06fmqZ.d.ts → use-bit-persist-CBTZIMc5.d.cts} +8 -6
- package/dist/utils.cjs +2 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +6 -0
- package/dist/utils.d.ts +6 -0
- package/dist/utils.js +2 -0
- package/dist/utils.js.map +1 -0
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.cts +9 -7
- package/dist/vue/index.d.ts +9 -7
- package/dist/vue/index.js +1 -1
- package/dist/vue/index.js.map +1 -1
- package/package.json +39 -14
- package/dist/chunk-DIEE6LUO.js +0 -2
- package/dist/chunk-DIEE6LUO.js.map +0 -1
- package/dist/chunk-FUUQB4DV.cjs +0 -2
- package/dist/chunk-FUUQB4DV.cjs.map +0 -1
- package/dist/chunk-KWLLYQOL.cjs +0 -2
- package/dist/chunk-KWLLYQOL.cjs.map +0 -1
- package/dist/chunk-LIYZPSWM.js +0 -2
- package/dist/chunk-LIYZPSWM.js.map +0 -1
- package/dist/chunk-QAL6J5GQ.cjs +0 -2
- package/dist/chunk-QAL6J5GQ.cjs.map +0 -1
- package/dist/chunk-SA47B5OP.js +0 -2
- package/dist/chunk-SA47B5OP.js.map +0 -1
- package/dist/store-api-types-9ipdute1.d.ts +0 -187
- package/dist/store-api-types-B6_bPoVI.d.cts +0 -187
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import { B as BitMask,
|
|
1
|
+
import { B as BitMask, a as BitMaskName } from './types-D8DgIUhJ.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface BitBusStorePort<T extends object = object> {
|
|
4
|
+
getState: () => Readonly<BitState<T>>;
|
|
5
|
+
getHistoryMetadata: () => {
|
|
6
|
+
canUndo: boolean;
|
|
7
|
+
canRedo: boolean;
|
|
8
|
+
historySize: number;
|
|
9
|
+
historyIndex: number;
|
|
10
|
+
};
|
|
11
|
+
undo: () => void;
|
|
12
|
+
redo: () => void;
|
|
13
|
+
reset: () => void;
|
|
14
|
+
}
|
|
15
|
+
type BitBusListener<T extends object = object> = (storeId: string, newState: BitState<T>) => void;
|
|
4
16
|
interface BitFormGlobal {
|
|
5
|
-
stores: Record<string,
|
|
17
|
+
stores: Record<string, BitBusStorePort<object>>;
|
|
6
18
|
listeners: Set<BitBusListener>;
|
|
7
|
-
dispatch: (storeId: string, state: BitState<
|
|
19
|
+
dispatch: (storeId: string, state: BitState<object>) => void;
|
|
8
20
|
subscribe: (fn: BitBusListener) => () => void;
|
|
9
21
|
}
|
|
10
22
|
/** Alias for {@link BitFormGlobal}. Prefer this name in user-facing APIs. */
|
|
@@ -36,8 +48,18 @@ type DeepPartial<T> = T extends object ? {
|
|
|
36
48
|
} : T;
|
|
37
49
|
type BitErrors<T extends object> = Partial<Record<BitPath<T>, string | undefined>>;
|
|
38
50
|
type BitTouched<T extends object> = Partial<Record<BitPath<T>, boolean | undefined>>;
|
|
39
|
-
type
|
|
40
|
-
|
|
51
|
+
type BitBivariantFn<TArgs extends unknown[], TResult> = {
|
|
52
|
+
bivarianceHack(...args: TArgs): TResult;
|
|
53
|
+
}["bivarianceHack"];
|
|
54
|
+
type BitComputedFn<T> = (values: T) => unknown;
|
|
55
|
+
type BitNormalizeFn<T> = BitBivariantFn<[
|
|
56
|
+
value: unknown,
|
|
57
|
+
allValues: T
|
|
58
|
+
], unknown>;
|
|
59
|
+
type BitTransformFn<T> = BitBivariantFn<[
|
|
60
|
+
value: unknown,
|
|
61
|
+
allValues: T
|
|
62
|
+
], unknown>;
|
|
41
63
|
interface BitPersistMetadata {
|
|
42
64
|
isSaving: boolean;
|
|
43
65
|
isRestoring: boolean;
|
|
@@ -60,7 +82,7 @@ interface BitState<T extends object> {
|
|
|
60
82
|
isSubmitting: boolean;
|
|
61
83
|
isDirty: boolean;
|
|
62
84
|
}
|
|
63
|
-
interface BitFieldState<
|
|
85
|
+
interface BitFieldState<_T extends object = Record<string, unknown>, TValue = unknown> {
|
|
64
86
|
value: TValue;
|
|
65
87
|
error: string | undefined;
|
|
66
88
|
touched: boolean;
|
|
@@ -73,7 +95,7 @@ type ValidatorFn<T extends object> = (values: T, options?: {
|
|
|
73
95
|
scopeFields?: string[];
|
|
74
96
|
}) => Promise<BitErrors<T>> | BitErrors<T>;
|
|
75
97
|
/** Conditional logic: visibility and dynamic required. */
|
|
76
|
-
interface BitFieldConditional<T extends object =
|
|
98
|
+
interface BitFieldConditional<T extends object = Record<string, unknown>> {
|
|
77
99
|
dependsOn?: string[];
|
|
78
100
|
showIf?: (values: T) => boolean;
|
|
79
101
|
requiredIf?: (values: T) => boolean;
|
|
@@ -81,18 +103,27 @@ interface BitFieldConditional<T extends object = any> {
|
|
|
81
103
|
requiredMessage?: string;
|
|
82
104
|
}
|
|
83
105
|
/** Field-level validation: async validation only. */
|
|
84
|
-
interface BitFieldValidation<T extends object =
|
|
106
|
+
interface BitFieldValidation<T extends object = Record<string, unknown>> {
|
|
85
107
|
/**
|
|
86
108
|
* Breaking change: async validation now defaults to `blur` instead of eager `change`.
|
|
87
109
|
* `validate()`/submit still execute async validators for the targeted fields.
|
|
88
110
|
*/
|
|
89
111
|
asyncValidateOn?: "change" | "blur";
|
|
90
|
-
asyncValidate?:
|
|
112
|
+
asyncValidate?: BitBivariantFn<[
|
|
113
|
+
value: unknown,
|
|
114
|
+
values: T
|
|
115
|
+
], Promise<string | null | undefined>>;
|
|
91
116
|
asyncValidateDelay?: number;
|
|
92
117
|
}
|
|
93
|
-
interface BitFieldDefinitionBase<T extends object =
|
|
118
|
+
interface BitFieldDefinitionBase<T extends object = Record<string, unknown>> {
|
|
94
119
|
conditional?: BitFieldConditional<T>;
|
|
95
120
|
validation?: BitFieldValidation<T>;
|
|
121
|
+
normalize?: BitNormalizeFn<T>;
|
|
122
|
+
/**
|
|
123
|
+
* Optional explicit dependencies for normalize re-evaluation.
|
|
124
|
+
* Defaults to the field own path when omitted.
|
|
125
|
+
*/
|
|
126
|
+
normalizeDependsOn?: string[];
|
|
96
127
|
transform?: BitTransformFn<T>;
|
|
97
128
|
/** Mask name (built-in or custom registry key) or BitMask instance. */
|
|
98
129
|
mask?: BitMask | BitMaskName;
|
|
@@ -100,7 +131,7 @@ interface BitFieldDefinitionBase<T extends object = any> {
|
|
|
100
131
|
scope?: string;
|
|
101
132
|
}
|
|
102
133
|
/** Full field definition: conditional, validation, transform, computed, mask, scope. */
|
|
103
|
-
type BitFieldDefinition<T extends object =
|
|
134
|
+
type BitFieldDefinition<T extends object = Record<string, unknown>> = (BitFieldDefinitionBase<T> & {
|
|
104
135
|
computed?: undefined;
|
|
105
136
|
computedDependsOn?: never;
|
|
106
137
|
}) | (BitFieldDefinitionBase<T> & {
|
|
@@ -114,8 +145,9 @@ interface DevToolsOptions {
|
|
|
114
145
|
url?: string;
|
|
115
146
|
}
|
|
116
147
|
type BitPluginHookSource = "beforeValidate" | "afterValidate" | "beforeSubmit" | "afterSubmit" | "onFieldChange" | "setup" | "teardown" | "submit";
|
|
148
|
+
type BitOperationalErrorSource = "submit" | "validation" | "persist" | (string & {});
|
|
117
149
|
type BitFieldChangeOrigin = "setField" | "rebase" | "replaceValues" | "hydrate" | "array";
|
|
118
|
-
type BitArrayOperation = "push" | "prepend" | "insert" | "remove" | "move" | "swap";
|
|
150
|
+
type BitArrayOperation = "push" | "prepend" | "insert" | "remove" | "move" | "swap" | "replace" | "clear";
|
|
119
151
|
interface BitFieldChangeMeta {
|
|
120
152
|
origin: BitFieldChangeOrigin;
|
|
121
153
|
operation?: BitArrayOperation;
|
|
@@ -123,7 +155,7 @@ interface BitFieldChangeMeta {
|
|
|
123
155
|
from?: number;
|
|
124
156
|
to?: number;
|
|
125
157
|
}
|
|
126
|
-
interface BitFieldChangeEvent<T extends object =
|
|
158
|
+
interface BitFieldChangeEvent<T extends object = Record<string, unknown>> {
|
|
127
159
|
path: string;
|
|
128
160
|
previousValue: unknown;
|
|
129
161
|
nextValue: unknown;
|
|
@@ -131,13 +163,13 @@ interface BitFieldChangeEvent<T extends object = any> {
|
|
|
131
163
|
state: Readonly<BitState<T>>;
|
|
132
164
|
meta: BitFieldChangeMeta;
|
|
133
165
|
}
|
|
134
|
-
interface BitBeforeValidateEvent<T extends object =
|
|
166
|
+
interface BitBeforeValidateEvent<T extends object = Record<string, unknown>> {
|
|
135
167
|
values: Readonly<T>;
|
|
136
168
|
state: Readonly<BitState<T>>;
|
|
137
169
|
scope?: string;
|
|
138
170
|
scopeFields?: string[];
|
|
139
171
|
}
|
|
140
|
-
interface BitAfterValidateEvent<T extends object =
|
|
172
|
+
interface BitAfterValidateEvent<T extends object = Record<string, unknown>> {
|
|
141
173
|
values: Readonly<T>;
|
|
142
174
|
state: Readonly<BitState<T>>;
|
|
143
175
|
scope?: string;
|
|
@@ -146,12 +178,12 @@ interface BitAfterValidateEvent<T extends object = any> {
|
|
|
146
178
|
result: boolean;
|
|
147
179
|
aborted?: boolean;
|
|
148
180
|
}
|
|
149
|
-
interface BitBeforeSubmitEvent<T extends object =
|
|
181
|
+
interface BitBeforeSubmitEvent<T extends object = Record<string, unknown>> {
|
|
150
182
|
values: Readonly<T>;
|
|
151
183
|
dirtyValues: Readonly<Partial<T>>;
|
|
152
184
|
state: Readonly<BitState<T>>;
|
|
153
185
|
}
|
|
154
|
-
interface BitAfterSubmitEvent<T extends object =
|
|
186
|
+
interface BitAfterSubmitEvent<T extends object = Record<string, unknown>> {
|
|
155
187
|
values: Readonly<T>;
|
|
156
188
|
dirtyValues: Readonly<Partial<T>>;
|
|
157
189
|
state: Readonly<BitState<T>>;
|
|
@@ -159,7 +191,7 @@ interface BitAfterSubmitEvent<T extends object = any> {
|
|
|
159
191
|
error?: unknown;
|
|
160
192
|
invalid?: boolean;
|
|
161
193
|
}
|
|
162
|
-
interface BitPluginErrorEvent<T extends object =
|
|
194
|
+
interface BitPluginErrorEvent<T extends object = Record<string, unknown>> {
|
|
163
195
|
source: BitPluginHookSource;
|
|
164
196
|
pluginName?: string;
|
|
165
197
|
error: unknown;
|
|
@@ -167,12 +199,12 @@ interface BitPluginErrorEvent<T extends object = any> {
|
|
|
167
199
|
values: Readonly<T>;
|
|
168
200
|
state: Readonly<BitState<T>>;
|
|
169
201
|
}
|
|
170
|
-
interface BitPluginContext<T extends object =
|
|
202
|
+
interface BitPluginContext<T extends object = Record<string, unknown>> {
|
|
171
203
|
storeId: string;
|
|
172
204
|
getState: () => Readonly<BitState<T>>;
|
|
173
205
|
getConfig: () => Readonly<BitConfig<T>>;
|
|
174
206
|
}
|
|
175
|
-
interface BitPluginHooks<T extends object =
|
|
207
|
+
interface BitPluginHooks<T extends object = Record<string, unknown>> {
|
|
176
208
|
beforeValidate?: (event: BitBeforeValidateEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
177
209
|
afterValidate?: (event: BitAfterValidateEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
178
210
|
beforeSubmit?: (event: BitBeforeSubmitEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
@@ -180,7 +212,7 @@ interface BitPluginHooks<T extends object = any> {
|
|
|
180
212
|
onFieldChange?: (event: BitFieldChangeEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
181
213
|
onError?: (event: BitPluginErrorEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
182
214
|
}
|
|
183
|
-
interface BitPlugin<T extends object =
|
|
215
|
+
interface BitPlugin<T extends object = Record<string, unknown>> {
|
|
184
216
|
name: string;
|
|
185
217
|
setup?: (context: BitPluginContext<T>) => void | (() => void);
|
|
186
218
|
hooks?: BitPluginHooks<T>;
|
|
@@ -192,7 +224,7 @@ interface BitPersistStorageAdapter {
|
|
|
192
224
|
removeItem(key: string): BitMaybePromise<void>;
|
|
193
225
|
}
|
|
194
226
|
type BitPersistMode = "values" | "dirtyValues";
|
|
195
|
-
interface BitPersistConfig<T extends object =
|
|
227
|
+
interface BitPersistConfig<T extends object = Record<string, unknown>> {
|
|
196
228
|
enabled?: boolean;
|
|
197
229
|
key?: string;
|
|
198
230
|
storage?: BitPersistStorageAdapter;
|
|
@@ -203,7 +235,7 @@ interface BitPersistConfig<T extends object = any> {
|
|
|
203
235
|
deserialize?: (raw: string) => Partial<T>;
|
|
204
236
|
onError?: (error: unknown) => void;
|
|
205
237
|
}
|
|
206
|
-
interface BitPersistResolvedConfig<T extends object =
|
|
238
|
+
interface BitPersistResolvedConfig<T extends object = Record<string, unknown>> {
|
|
207
239
|
enabled: boolean;
|
|
208
240
|
key: string;
|
|
209
241
|
storage?: BitPersistStorageAdapter;
|
|
@@ -232,7 +264,7 @@ interface BitHistoryConfig {
|
|
|
232
264
|
* BitConfig - store configuration.
|
|
233
265
|
* @see CHANGELOG for migration from features to fields in 2.0.
|
|
234
266
|
*/
|
|
235
|
-
interface BitConfig<T extends object =
|
|
267
|
+
interface BitConfig<T extends object = Record<string, unknown>> {
|
|
236
268
|
/** Core */
|
|
237
269
|
name?: string;
|
|
238
270
|
storeId?: string;
|
|
@@ -271,14 +303,35 @@ interface BitConfig<T extends object = any> {
|
|
|
271
303
|
* where a global singleton is unsafe (e.g. Next.js Edge Runtime).
|
|
272
304
|
*/
|
|
273
305
|
bus?: BitFormGlobal;
|
|
306
|
+
/**
|
|
307
|
+
* Enables advanced tracked selector subscriptions (`mode: "tracked"`).
|
|
308
|
+
* Disabled by default to keep observe semantics explicit and predictable.
|
|
309
|
+
*/
|
|
310
|
+
trackedSubscriptions?: boolean;
|
|
311
|
+
/**
|
|
312
|
+
* Handler opcional para erros operacionais não tratados internamente.
|
|
313
|
+
* Se não informado, o runtime usa fallback para `console.error`.
|
|
314
|
+
*/
|
|
315
|
+
onUnhandledError?: (error: unknown, source: BitOperationalErrorSource) => void;
|
|
274
316
|
}
|
|
275
|
-
|
|
317
|
+
type BitSubmitResult = {
|
|
318
|
+
status: "submitted";
|
|
319
|
+
} | {
|
|
320
|
+
status: "invalid";
|
|
321
|
+
} | {
|
|
322
|
+
status: "failed";
|
|
323
|
+
error: unknown;
|
|
324
|
+
} | {
|
|
325
|
+
status: "blocked";
|
|
326
|
+
reason: "isSubmitting" | "validating";
|
|
327
|
+
};
|
|
328
|
+
/** Return type of BitStore.getScopeStatus, used by useBitScope/injectBitScope. */
|
|
276
329
|
interface ScopeStatus {
|
|
277
330
|
hasErrors: boolean;
|
|
278
331
|
isDirty: boolean;
|
|
279
332
|
errors: Record<string, string>;
|
|
280
333
|
}
|
|
281
|
-
/** Return type of
|
|
334
|
+
/** Return type of scope validation helpers, used by useBitScope/injectBitScope. */
|
|
282
335
|
interface ValidateScopeResult {
|
|
283
336
|
valid: boolean;
|
|
284
337
|
errors: Record<string, string>;
|
|
@@ -293,23 +346,7 @@ type BitPath<T, Prefix extends string = ""> = T extends Primitive ? never : T ex
|
|
|
293
346
|
[K in keyof T & (string | number)]: T[K] extends Primitive ? Prefix extends "" ? `${K & (string | number)}` : `${Prefix}.${K & (string | number)}` : Prefix extends "" ? `${K & (string | number)}` | `${K & (string | number)}.${BitPath<T[K]>}` : `${Prefix}.${K & (string | number)}` | `${Prefix}.${K & (string | number)}.${BitPath<T[K]>}`;
|
|
294
347
|
}[keyof T & (string | number)];
|
|
295
348
|
type BitPathValue<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends `${number}` ? T extends readonly (infer U)[] ? BitPathValue<U, Rest> : never : K extends keyof T ? BitPathValue<T[K], Rest> : never : P extends `${number}` ? T extends readonly (infer U)[] ? U : never : P extends keyof T ? T[P] : never;
|
|
296
|
-
type BitArrayPath<T> = BitPath<T> extends infer P ? P extends string ? BitPathValue<T, P> extends readonly
|
|
349
|
+
type BitArrayPath<T> = BitPath<T> extends infer P ? P extends string ? BitPathValue<T, P> extends readonly unknown[] ? P : never : never : never;
|
|
297
350
|
type BitArrayItem<A> = A extends readonly (infer U)[] ? U : A extends (infer U)[] ? U : never;
|
|
298
351
|
|
|
299
|
-
|
|
300
|
-
var __BIT_FORM__: BitFormGlobal | undefined;
|
|
301
|
-
}
|
|
302
|
-
declare const bitBus: BitFormGlobal;
|
|
303
|
-
/**
|
|
304
|
-
* Creates an isolated bus instance — not connected to the browser global.
|
|
305
|
-
* Use this in SSR / Edge Runtime environments (e.g. Next.js Edge) where a
|
|
306
|
-
* shared `globalThis` singleton is unsafe across request contexts.
|
|
307
|
-
*
|
|
308
|
-
* @example
|
|
309
|
-
* // _app.tsx (SSR-safe)
|
|
310
|
-
* const bus = createBitBus();
|
|
311
|
-
* const store = createBitStore({ bus, initialValues: { ... } });
|
|
312
|
-
*/
|
|
313
|
-
declare function createBitBus(): BitFormGlobal;
|
|
314
|
-
|
|
315
|
-
export { type BitFieldConditional as A, type BitArrayPath as B, type BitFieldValidation as C, type DeepPartial as D, type BitHistoryConfig as E, type BitPersistConfig as F, type BitPersistMode as G, type BitPersistStorageAdapter as H, type BitPluginContext as I, type BitPluginErrorEvent as J, type BitPluginHooks as K, type BitTransformFn as L, type BitValidationConfig as M, bitBus as N, createBitBus as O, type ScopeStatus as S, type ValidateScopeResult as V, type BitArrayItem as a, type BitPathValue as b, type BitErrors as c, type BitBus as d, type BitPath as e, type BitState as f, type BitFieldState as g, type BitFieldDefinition as h, type BitPersistMetadata as i, type BitConfig as j, type ValidatorFn as k, type DevToolsOptions as l, type BitPersistResolvedConfig as m, type BitIdFactory as n, type BitPlugin as o, type BitScheduler as p, type BitFormGlobal as q, type BitTouched as r, type BitAfterSubmitEvent as s, type BitAfterValidateEvent as t, type BitBeforeSubmitEvent as u, type BitBeforeValidateEvent as v, type BitBusListener as w, type BitComputedFn as x, type BitFieldChangeEvent as y, type BitFieldChangeMeta as z };
|
|
352
|
+
export type { BitPlugin as A, BitAfterSubmitEvent as B, BitPluginContext as C, BitPluginErrorEvent as D, BitPluginHooks as E, BitScheduler as F, BitState as G, BitSubmitResult as H, BitTouched as I, BitTransformFn as J, BitValidationConfig as K, DeepPartial as L, DevToolsOptions as M, ValidatorFn as N, BitPersistResolvedConfig as O, BitIdFactory as P, BitOperationalErrorSource as Q, ScopeStatus as S, ValidateScopeResult as V, BitAfterValidateEvent as a, BitArrayItem as b, BitArrayPath as c, BitBeforeSubmitEvent as d, BitBeforeValidateEvent as e, BitBus as f, BitBusListener as g, BitBusStorePort as h, BitComputedFn as i, BitConfig as j, BitErrors as k, BitFieldChangeEvent as l, BitFieldChangeMeta as m, BitFieldConditional as n, BitFieldDefinition as o, BitFieldState as p, BitFieldValidation as q, BitFormGlobal as r, BitHistoryConfig as s, BitNormalizeFn as t, BitPath as u, BitPathValue as v, BitPersistConfig as w, BitPersistMetadata as x, BitPersistMode as y, BitPersistStorageAdapter as z };
|
|
@@ -24,4 +24,4 @@ interface DateMaskConfig extends PatternMaskOptions {
|
|
|
24
24
|
format?: "DD/MM/YYYY" | "YYYY-MM-DD";
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export type { BitMask as B, CurrencyMaskConfig as C, DateMaskConfig as D, PatternMaskOptions as P,
|
|
27
|
+
export type { BitMask as B, CurrencyMaskConfig as C, DateMaskConfig as D, PatternMaskOptions as P, BitMaskName as a, BitBuiltInMaskName as b };
|
|
@@ -24,4 +24,4 @@ interface DateMaskConfig extends PatternMaskOptions {
|
|
|
24
24
|
format?: "DD/MM/YYYY" | "YYYY-MM-DD";
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export type { BitMask as B, CurrencyMaskConfig as C, DateMaskConfig as D, PatternMaskOptions as P,
|
|
27
|
+
export type { BitMask as B, CurrencyMaskConfig as C, DateMaskConfig as D, PatternMaskOptions as P, BitMaskName as a, BitBuiltInMaskName as b };
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import { B as BitMask,
|
|
1
|
+
import { B as BitMask, a as BitMaskName } from './types-D8DgIUhJ.cjs';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface BitBusStorePort<T extends object = object> {
|
|
4
|
+
getState: () => Readonly<BitState<T>>;
|
|
5
|
+
getHistoryMetadata: () => {
|
|
6
|
+
canUndo: boolean;
|
|
7
|
+
canRedo: boolean;
|
|
8
|
+
historySize: number;
|
|
9
|
+
historyIndex: number;
|
|
10
|
+
};
|
|
11
|
+
undo: () => void;
|
|
12
|
+
redo: () => void;
|
|
13
|
+
reset: () => void;
|
|
14
|
+
}
|
|
15
|
+
type BitBusListener<T extends object = object> = (storeId: string, newState: BitState<T>) => void;
|
|
4
16
|
interface BitFormGlobal {
|
|
5
|
-
stores: Record<string,
|
|
17
|
+
stores: Record<string, BitBusStorePort<object>>;
|
|
6
18
|
listeners: Set<BitBusListener>;
|
|
7
|
-
dispatch: (storeId: string, state: BitState<
|
|
19
|
+
dispatch: (storeId: string, state: BitState<object>) => void;
|
|
8
20
|
subscribe: (fn: BitBusListener) => () => void;
|
|
9
21
|
}
|
|
10
22
|
/** Alias for {@link BitFormGlobal}. Prefer this name in user-facing APIs. */
|
|
@@ -36,8 +48,18 @@ type DeepPartial<T> = T extends object ? {
|
|
|
36
48
|
} : T;
|
|
37
49
|
type BitErrors<T extends object> = Partial<Record<BitPath<T>, string | undefined>>;
|
|
38
50
|
type BitTouched<T extends object> = Partial<Record<BitPath<T>, boolean | undefined>>;
|
|
39
|
-
type
|
|
40
|
-
|
|
51
|
+
type BitBivariantFn<TArgs extends unknown[], TResult> = {
|
|
52
|
+
bivarianceHack(...args: TArgs): TResult;
|
|
53
|
+
}["bivarianceHack"];
|
|
54
|
+
type BitComputedFn<T> = (values: T) => unknown;
|
|
55
|
+
type BitNormalizeFn<T> = BitBivariantFn<[
|
|
56
|
+
value: unknown,
|
|
57
|
+
allValues: T
|
|
58
|
+
], unknown>;
|
|
59
|
+
type BitTransformFn<T> = BitBivariantFn<[
|
|
60
|
+
value: unknown,
|
|
61
|
+
allValues: T
|
|
62
|
+
], unknown>;
|
|
41
63
|
interface BitPersistMetadata {
|
|
42
64
|
isSaving: boolean;
|
|
43
65
|
isRestoring: boolean;
|
|
@@ -60,7 +82,7 @@ interface BitState<T extends object> {
|
|
|
60
82
|
isSubmitting: boolean;
|
|
61
83
|
isDirty: boolean;
|
|
62
84
|
}
|
|
63
|
-
interface BitFieldState<
|
|
85
|
+
interface BitFieldState<_T extends object = Record<string, unknown>, TValue = unknown> {
|
|
64
86
|
value: TValue;
|
|
65
87
|
error: string | undefined;
|
|
66
88
|
touched: boolean;
|
|
@@ -73,7 +95,7 @@ type ValidatorFn<T extends object> = (values: T, options?: {
|
|
|
73
95
|
scopeFields?: string[];
|
|
74
96
|
}) => Promise<BitErrors<T>> | BitErrors<T>;
|
|
75
97
|
/** Conditional logic: visibility and dynamic required. */
|
|
76
|
-
interface BitFieldConditional<T extends object =
|
|
98
|
+
interface BitFieldConditional<T extends object = Record<string, unknown>> {
|
|
77
99
|
dependsOn?: string[];
|
|
78
100
|
showIf?: (values: T) => boolean;
|
|
79
101
|
requiredIf?: (values: T) => boolean;
|
|
@@ -81,18 +103,27 @@ interface BitFieldConditional<T extends object = any> {
|
|
|
81
103
|
requiredMessage?: string;
|
|
82
104
|
}
|
|
83
105
|
/** Field-level validation: async validation only. */
|
|
84
|
-
interface BitFieldValidation<T extends object =
|
|
106
|
+
interface BitFieldValidation<T extends object = Record<string, unknown>> {
|
|
85
107
|
/**
|
|
86
108
|
* Breaking change: async validation now defaults to `blur` instead of eager `change`.
|
|
87
109
|
* `validate()`/submit still execute async validators for the targeted fields.
|
|
88
110
|
*/
|
|
89
111
|
asyncValidateOn?: "change" | "blur";
|
|
90
|
-
asyncValidate?:
|
|
112
|
+
asyncValidate?: BitBivariantFn<[
|
|
113
|
+
value: unknown,
|
|
114
|
+
values: T
|
|
115
|
+
], Promise<string | null | undefined>>;
|
|
91
116
|
asyncValidateDelay?: number;
|
|
92
117
|
}
|
|
93
|
-
interface BitFieldDefinitionBase<T extends object =
|
|
118
|
+
interface BitFieldDefinitionBase<T extends object = Record<string, unknown>> {
|
|
94
119
|
conditional?: BitFieldConditional<T>;
|
|
95
120
|
validation?: BitFieldValidation<T>;
|
|
121
|
+
normalize?: BitNormalizeFn<T>;
|
|
122
|
+
/**
|
|
123
|
+
* Optional explicit dependencies for normalize re-evaluation.
|
|
124
|
+
* Defaults to the field own path when omitted.
|
|
125
|
+
*/
|
|
126
|
+
normalizeDependsOn?: string[];
|
|
96
127
|
transform?: BitTransformFn<T>;
|
|
97
128
|
/** Mask name (built-in or custom registry key) or BitMask instance. */
|
|
98
129
|
mask?: BitMask | BitMaskName;
|
|
@@ -100,7 +131,7 @@ interface BitFieldDefinitionBase<T extends object = any> {
|
|
|
100
131
|
scope?: string;
|
|
101
132
|
}
|
|
102
133
|
/** Full field definition: conditional, validation, transform, computed, mask, scope. */
|
|
103
|
-
type BitFieldDefinition<T extends object =
|
|
134
|
+
type BitFieldDefinition<T extends object = Record<string, unknown>> = (BitFieldDefinitionBase<T> & {
|
|
104
135
|
computed?: undefined;
|
|
105
136
|
computedDependsOn?: never;
|
|
106
137
|
}) | (BitFieldDefinitionBase<T> & {
|
|
@@ -114,8 +145,9 @@ interface DevToolsOptions {
|
|
|
114
145
|
url?: string;
|
|
115
146
|
}
|
|
116
147
|
type BitPluginHookSource = "beforeValidate" | "afterValidate" | "beforeSubmit" | "afterSubmit" | "onFieldChange" | "setup" | "teardown" | "submit";
|
|
148
|
+
type BitOperationalErrorSource = "submit" | "validation" | "persist" | (string & {});
|
|
117
149
|
type BitFieldChangeOrigin = "setField" | "rebase" | "replaceValues" | "hydrate" | "array";
|
|
118
|
-
type BitArrayOperation = "push" | "prepend" | "insert" | "remove" | "move" | "swap";
|
|
150
|
+
type BitArrayOperation = "push" | "prepend" | "insert" | "remove" | "move" | "swap" | "replace" | "clear";
|
|
119
151
|
interface BitFieldChangeMeta {
|
|
120
152
|
origin: BitFieldChangeOrigin;
|
|
121
153
|
operation?: BitArrayOperation;
|
|
@@ -123,7 +155,7 @@ interface BitFieldChangeMeta {
|
|
|
123
155
|
from?: number;
|
|
124
156
|
to?: number;
|
|
125
157
|
}
|
|
126
|
-
interface BitFieldChangeEvent<T extends object =
|
|
158
|
+
interface BitFieldChangeEvent<T extends object = Record<string, unknown>> {
|
|
127
159
|
path: string;
|
|
128
160
|
previousValue: unknown;
|
|
129
161
|
nextValue: unknown;
|
|
@@ -131,13 +163,13 @@ interface BitFieldChangeEvent<T extends object = any> {
|
|
|
131
163
|
state: Readonly<BitState<T>>;
|
|
132
164
|
meta: BitFieldChangeMeta;
|
|
133
165
|
}
|
|
134
|
-
interface BitBeforeValidateEvent<T extends object =
|
|
166
|
+
interface BitBeforeValidateEvent<T extends object = Record<string, unknown>> {
|
|
135
167
|
values: Readonly<T>;
|
|
136
168
|
state: Readonly<BitState<T>>;
|
|
137
169
|
scope?: string;
|
|
138
170
|
scopeFields?: string[];
|
|
139
171
|
}
|
|
140
|
-
interface BitAfterValidateEvent<T extends object =
|
|
172
|
+
interface BitAfterValidateEvent<T extends object = Record<string, unknown>> {
|
|
141
173
|
values: Readonly<T>;
|
|
142
174
|
state: Readonly<BitState<T>>;
|
|
143
175
|
scope?: string;
|
|
@@ -146,12 +178,12 @@ interface BitAfterValidateEvent<T extends object = any> {
|
|
|
146
178
|
result: boolean;
|
|
147
179
|
aborted?: boolean;
|
|
148
180
|
}
|
|
149
|
-
interface BitBeforeSubmitEvent<T extends object =
|
|
181
|
+
interface BitBeforeSubmitEvent<T extends object = Record<string, unknown>> {
|
|
150
182
|
values: Readonly<T>;
|
|
151
183
|
dirtyValues: Readonly<Partial<T>>;
|
|
152
184
|
state: Readonly<BitState<T>>;
|
|
153
185
|
}
|
|
154
|
-
interface BitAfterSubmitEvent<T extends object =
|
|
186
|
+
interface BitAfterSubmitEvent<T extends object = Record<string, unknown>> {
|
|
155
187
|
values: Readonly<T>;
|
|
156
188
|
dirtyValues: Readonly<Partial<T>>;
|
|
157
189
|
state: Readonly<BitState<T>>;
|
|
@@ -159,7 +191,7 @@ interface BitAfterSubmitEvent<T extends object = any> {
|
|
|
159
191
|
error?: unknown;
|
|
160
192
|
invalid?: boolean;
|
|
161
193
|
}
|
|
162
|
-
interface BitPluginErrorEvent<T extends object =
|
|
194
|
+
interface BitPluginErrorEvent<T extends object = Record<string, unknown>> {
|
|
163
195
|
source: BitPluginHookSource;
|
|
164
196
|
pluginName?: string;
|
|
165
197
|
error: unknown;
|
|
@@ -167,12 +199,12 @@ interface BitPluginErrorEvent<T extends object = any> {
|
|
|
167
199
|
values: Readonly<T>;
|
|
168
200
|
state: Readonly<BitState<T>>;
|
|
169
201
|
}
|
|
170
|
-
interface BitPluginContext<T extends object =
|
|
202
|
+
interface BitPluginContext<T extends object = Record<string, unknown>> {
|
|
171
203
|
storeId: string;
|
|
172
204
|
getState: () => Readonly<BitState<T>>;
|
|
173
205
|
getConfig: () => Readonly<BitConfig<T>>;
|
|
174
206
|
}
|
|
175
|
-
interface BitPluginHooks<T extends object =
|
|
207
|
+
interface BitPluginHooks<T extends object = Record<string, unknown>> {
|
|
176
208
|
beforeValidate?: (event: BitBeforeValidateEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
177
209
|
afterValidate?: (event: BitAfterValidateEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
178
210
|
beforeSubmit?: (event: BitBeforeSubmitEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
@@ -180,7 +212,7 @@ interface BitPluginHooks<T extends object = any> {
|
|
|
180
212
|
onFieldChange?: (event: BitFieldChangeEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
181
213
|
onError?: (event: BitPluginErrorEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
182
214
|
}
|
|
183
|
-
interface BitPlugin<T extends object =
|
|
215
|
+
interface BitPlugin<T extends object = Record<string, unknown>> {
|
|
184
216
|
name: string;
|
|
185
217
|
setup?: (context: BitPluginContext<T>) => void | (() => void);
|
|
186
218
|
hooks?: BitPluginHooks<T>;
|
|
@@ -192,7 +224,7 @@ interface BitPersistStorageAdapter {
|
|
|
192
224
|
removeItem(key: string): BitMaybePromise<void>;
|
|
193
225
|
}
|
|
194
226
|
type BitPersistMode = "values" | "dirtyValues";
|
|
195
|
-
interface BitPersistConfig<T extends object =
|
|
227
|
+
interface BitPersistConfig<T extends object = Record<string, unknown>> {
|
|
196
228
|
enabled?: boolean;
|
|
197
229
|
key?: string;
|
|
198
230
|
storage?: BitPersistStorageAdapter;
|
|
@@ -203,7 +235,7 @@ interface BitPersistConfig<T extends object = any> {
|
|
|
203
235
|
deserialize?: (raw: string) => Partial<T>;
|
|
204
236
|
onError?: (error: unknown) => void;
|
|
205
237
|
}
|
|
206
|
-
interface BitPersistResolvedConfig<T extends object =
|
|
238
|
+
interface BitPersistResolvedConfig<T extends object = Record<string, unknown>> {
|
|
207
239
|
enabled: boolean;
|
|
208
240
|
key: string;
|
|
209
241
|
storage?: BitPersistStorageAdapter;
|
|
@@ -232,7 +264,7 @@ interface BitHistoryConfig {
|
|
|
232
264
|
* BitConfig - store configuration.
|
|
233
265
|
* @see CHANGELOG for migration from features to fields in 2.0.
|
|
234
266
|
*/
|
|
235
|
-
interface BitConfig<T extends object =
|
|
267
|
+
interface BitConfig<T extends object = Record<string, unknown>> {
|
|
236
268
|
/** Core */
|
|
237
269
|
name?: string;
|
|
238
270
|
storeId?: string;
|
|
@@ -271,14 +303,35 @@ interface BitConfig<T extends object = any> {
|
|
|
271
303
|
* where a global singleton is unsafe (e.g. Next.js Edge Runtime).
|
|
272
304
|
*/
|
|
273
305
|
bus?: BitFormGlobal;
|
|
306
|
+
/**
|
|
307
|
+
* Enables advanced tracked selector subscriptions (`mode: "tracked"`).
|
|
308
|
+
* Disabled by default to keep observe semantics explicit and predictable.
|
|
309
|
+
*/
|
|
310
|
+
trackedSubscriptions?: boolean;
|
|
311
|
+
/**
|
|
312
|
+
* Handler opcional para erros operacionais não tratados internamente.
|
|
313
|
+
* Se não informado, o runtime usa fallback para `console.error`.
|
|
314
|
+
*/
|
|
315
|
+
onUnhandledError?: (error: unknown, source: BitOperationalErrorSource) => void;
|
|
274
316
|
}
|
|
275
|
-
|
|
317
|
+
type BitSubmitResult = {
|
|
318
|
+
status: "submitted";
|
|
319
|
+
} | {
|
|
320
|
+
status: "invalid";
|
|
321
|
+
} | {
|
|
322
|
+
status: "failed";
|
|
323
|
+
error: unknown;
|
|
324
|
+
} | {
|
|
325
|
+
status: "blocked";
|
|
326
|
+
reason: "isSubmitting" | "validating";
|
|
327
|
+
};
|
|
328
|
+
/** Return type of BitStore.getScopeStatus, used by useBitScope/injectBitScope. */
|
|
276
329
|
interface ScopeStatus {
|
|
277
330
|
hasErrors: boolean;
|
|
278
331
|
isDirty: boolean;
|
|
279
332
|
errors: Record<string, string>;
|
|
280
333
|
}
|
|
281
|
-
/** Return type of
|
|
334
|
+
/** Return type of scope validation helpers, used by useBitScope/injectBitScope. */
|
|
282
335
|
interface ValidateScopeResult {
|
|
283
336
|
valid: boolean;
|
|
284
337
|
errors: Record<string, string>;
|
|
@@ -293,23 +346,7 @@ type BitPath<T, Prefix extends string = ""> = T extends Primitive ? never : T ex
|
|
|
293
346
|
[K in keyof T & (string | number)]: T[K] extends Primitive ? Prefix extends "" ? `${K & (string | number)}` : `${Prefix}.${K & (string | number)}` : Prefix extends "" ? `${K & (string | number)}` | `${K & (string | number)}.${BitPath<T[K]>}` : `${Prefix}.${K & (string | number)}` | `${Prefix}.${K & (string | number)}.${BitPath<T[K]>}`;
|
|
294
347
|
}[keyof T & (string | number)];
|
|
295
348
|
type BitPathValue<T, P extends string> = P extends `${infer K}.${infer Rest}` ? K extends `${number}` ? T extends readonly (infer U)[] ? BitPathValue<U, Rest> : never : K extends keyof T ? BitPathValue<T[K], Rest> : never : P extends `${number}` ? T extends readonly (infer U)[] ? U : never : P extends keyof T ? T[P] : never;
|
|
296
|
-
type BitArrayPath<T> = BitPath<T> extends infer P ? P extends string ? BitPathValue<T, P> extends readonly
|
|
349
|
+
type BitArrayPath<T> = BitPath<T> extends infer P ? P extends string ? BitPathValue<T, P> extends readonly unknown[] ? P : never : never : never;
|
|
297
350
|
type BitArrayItem<A> = A extends readonly (infer U)[] ? U : A extends (infer U)[] ? U : never;
|
|
298
351
|
|
|
299
|
-
|
|
300
|
-
var __BIT_FORM__: BitFormGlobal | undefined;
|
|
301
|
-
}
|
|
302
|
-
declare const bitBus: BitFormGlobal;
|
|
303
|
-
/**
|
|
304
|
-
* Creates an isolated bus instance — not connected to the browser global.
|
|
305
|
-
* Use this in SSR / Edge Runtime environments (e.g. Next.js Edge) where a
|
|
306
|
-
* shared `globalThis` singleton is unsafe across request contexts.
|
|
307
|
-
*
|
|
308
|
-
* @example
|
|
309
|
-
* // _app.tsx (SSR-safe)
|
|
310
|
-
* const bus = createBitBus();
|
|
311
|
-
* const store = createBitStore({ bus, initialValues: { ... } });
|
|
312
|
-
*/
|
|
313
|
-
declare function createBitBus(): BitFormGlobal;
|
|
314
|
-
|
|
315
|
-
export { type BitFieldConditional as A, type BitArrayPath as B, type BitFieldValidation as C, type DeepPartial as D, type BitHistoryConfig as E, type BitPersistConfig as F, type BitPersistMode as G, type BitPersistStorageAdapter as H, type BitPluginContext as I, type BitPluginErrorEvent as J, type BitPluginHooks as K, type BitTransformFn as L, type BitValidationConfig as M, bitBus as N, createBitBus as O, type ScopeStatus as S, type ValidateScopeResult as V, type BitArrayItem as a, type BitPathValue as b, type BitErrors as c, type BitBus as d, type BitPath as e, type BitState as f, type BitFieldState as g, type BitFieldDefinition as h, type BitPersistMetadata as i, type BitConfig as j, type ValidatorFn as k, type DevToolsOptions as l, type BitPersistResolvedConfig as m, type BitIdFactory as n, type BitPlugin as o, type BitScheduler as p, type BitFormGlobal as q, type BitTouched as r, type BitAfterSubmitEvent as s, type BitAfterValidateEvent as t, type BitBeforeSubmitEvent as u, type BitBeforeValidateEvent as v, type BitBusListener as w, type BitComputedFn as x, type BitFieldChangeEvent as y, type BitFieldChangeMeta as z };
|
|
352
|
+
export type { BitPlugin as A, BitAfterSubmitEvent as B, BitPluginContext as C, BitPluginErrorEvent as D, BitPluginHooks as E, BitScheduler as F, BitState as G, BitSubmitResult as H, BitTouched as I, BitTransformFn as J, BitValidationConfig as K, DeepPartial as L, DevToolsOptions as M, ValidatorFn as N, BitPersistResolvedConfig as O, BitIdFactory as P, BitOperationalErrorSource as Q, ScopeStatus as S, ValidateScopeResult as V, BitAfterValidateEvent as a, BitArrayItem as b, BitArrayPath as c, BitBeforeSubmitEvent as d, BitBeforeValidateEvent as e, BitBus as f, BitBusListener as g, BitBusStorePort as h, BitComputedFn as i, BitConfig as j, BitErrors as k, BitFieldChangeEvent as l, BitFieldChangeMeta as m, BitFieldConditional as n, BitFieldDefinition as o, BitFieldState as p, BitFieldValidation as q, BitFormGlobal as r, BitHistoryConfig as s, BitNormalizeFn as t, BitPath as u, BitPathValue as v, BitPersistConfig as w, BitPersistMetadata as x, BitPersistMode as y, BitPersistStorageAdapter as z };
|
|
@@ -14,4 +14,4 @@ type BitUploadFn = (file: File) => Promise<BitUploadResult>;
|
|
|
14
14
|
/** Optional delete function contract. */
|
|
15
15
|
type BitDeleteUploadFn = (key: string) => Promise<void>;
|
|
16
16
|
|
|
17
|
-
export type {
|
|
17
|
+
export type { BitDeleteUploadFn as B, BitUploadFn as a, BitUploadResult as b };
|
|
@@ -14,4 +14,4 @@ type BitUploadFn = (file: File) => Promise<BitUploadResult>;
|
|
|
14
14
|
/** Optional delete function contract. */
|
|
15
15
|
type BitDeleteUploadFn = (key: string) => Promise<void>;
|
|
16
16
|
|
|
17
|
-
export type {
|
|
17
|
+
export type { BitDeleteUploadFn as B, BitUploadFn as a, BitUploadResult as b };
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { b as BitFrameworkStoreApi, e as BitStoreApi } from './store-api-types-DfTFy2h4.js';
|
|
4
|
+
import './bus-BKuMV3E7.js';
|
|
5
|
+
import { u as BitPath, v as BitPathValue, x as BitPersistMetadata, S as ScopeStatus, V as ValidateScopeResult, k as BitErrors, I as BitTouched, L as DeepPartial, c as BitArrayPath, b as BitArrayItem } from './types-CRCP4Pgq.js';
|
|
6
|
+
import { a as BitArrayBindingField } from './array-controller-C61ByyG6.js';
|
|
7
|
+
import { a as BitHistoryMetadata, b as BitValidationOptions } from './meta-types-Bzmm21TP.js';
|
|
8
|
+
import { B as BitFieldInputEvent } from './field-binding-MX6jVQbT.js';
|
|
7
9
|
|
|
8
10
|
declare const BitFormProvider: ({ store, children, }: {
|
|
9
|
-
store:
|
|
11
|
+
store: BitFrameworkStoreApi<any> | BitStoreApi<any>;
|
|
10
12
|
children: React.ReactNode;
|
|
11
13
|
}) => react_jsx_runtime.JSX.Element;
|
|
12
|
-
declare const useBitStore: <T extends object>() =>
|
|
14
|
+
declare const useBitStore: <T extends object>() => BitFrameworkStoreApi<T>;
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* Metadata describing the current state of a form field.
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { b as BitFrameworkStoreApi, e as BitStoreApi } from './store-api-types-Bm3EAqR_.cjs';
|
|
4
|
+
import './bus-WOHGxuVy.cjs';
|
|
5
|
+
import { u as BitPath, v as BitPathValue, x as BitPersistMetadata, S as ScopeStatus, V as ValidateScopeResult, k as BitErrors, I as BitTouched, L as DeepPartial, c as BitArrayPath, b as BitArrayItem } from './types-SOg9xEce.cjs';
|
|
6
|
+
import { a as BitArrayBindingField } from './array-controller-CtlqjA0e.cjs';
|
|
7
|
+
import { a as BitHistoryMetadata, b as BitValidationOptions } from './meta-types-Bzmm21TP.cjs';
|
|
8
|
+
import { B as BitFieldInputEvent } from './field-binding-B_OX3bjp.cjs';
|
|
7
9
|
|
|
8
10
|
declare const BitFormProvider: ({ store, children, }: {
|
|
9
|
-
store:
|
|
11
|
+
store: BitFrameworkStoreApi<any> | BitStoreApi<any>;
|
|
10
12
|
children: React.ReactNode;
|
|
11
13
|
}) => react_jsx_runtime.JSX.Element;
|
|
12
|
-
declare const useBitStore: <T extends object>() =>
|
|
14
|
+
declare const useBitStore: <T extends object>() => BitFrameworkStoreApi<T>;
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* Metadata describing the current state of a form field.
|
package/dist/utils.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk6LNXTSZ6cjs = require('./chunk-6LNXTSZ6.cjs');exports.cleanPrefixedKeys = _chunk6LNXTSZ6cjs.j; exports.extractServerErrors = _chunk6LNXTSZ6cjs.m; exports.isValidationErrorShape = _chunk6LNXTSZ6cjs.l;
|
|
2
|
+
//# sourceMappingURL=utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/bit-form/bit-form/dist/utils.cjs"],"names":[],"mappings":"AAAA,iIAAsD,yJAAoF","file":"/home/runner/work/bit-form/bit-form/dist/utils.cjs"}
|