@lehnihon/bit-form 2.2.7 → 2.2.8
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 +10 -8
- package/dist/angular/index.d.ts +10 -8
- package/dist/angular/index.js +1 -1
- package/dist/angular/index.js.map +1 -1
- package/dist/{array-controller-DtkmcnUr.d.ts → array-controller-B5bfXV1W.d.cts} +4 -4
- package/dist/{array-controller-C1A5VKYd.d.cts → array-controller-Cx-DMH7Y.d.ts} +4 -4
- package/dist/bus-B2VEKrPI.d.ts +19 -0
- package/dist/bus-ZLQeq4Vr.d.cts +19 -0
- package/dist/chunk-5NA2TFPG.js +1 -0
- package/dist/chunk-5NA2TFPG.js.map +1 -0
- package/dist/chunk-63OJBMKK.js +2 -0
- package/dist/chunk-63OJBMKK.js.map +1 -0
- package/dist/chunk-BSGJ3T5S.cjs +2 -0
- package/dist/chunk-BSGJ3T5S.cjs.map +1 -0
- package/dist/chunk-CPP7ELA5.js +2 -0
- package/dist/chunk-CPP7ELA5.js.map +1 -0
- package/dist/chunk-D7JQWF6V.cjs +2 -0
- package/dist/chunk-D7JQWF6V.cjs.map +1 -0
- package/dist/chunk-E2NZR44P.js +2 -0
- package/dist/chunk-E2NZR44P.js.map +1 -0
- package/dist/chunk-EQ55DKX2.js +2 -0
- package/dist/chunk-EQ55DKX2.js.map +1 -0
- package/dist/chunk-JC4R5WCC.js +2 -0
- package/dist/chunk-JC4R5WCC.js.map +1 -0
- package/dist/chunk-M6WBNHIT.cjs +2 -0
- package/dist/chunk-M6WBNHIT.cjs.map +1 -0
- package/dist/chunk-MFSQATNZ.cjs +2 -0
- package/dist/chunk-MFSQATNZ.cjs.map +1 -0
- package/dist/chunk-MFTWAFMG.cjs +2 -0
- package/dist/chunk-MFTWAFMG.cjs.map +1 -0
- package/dist/chunk-P2YWYBWG.cjs +2 -0
- package/dist/chunk-P2YWYBWG.cjs.map +1 -0
- package/dist/chunk-RD73EBSN.js +2 -0
- package/dist/chunk-RD73EBSN.js.map +1 -0
- package/dist/chunk-T2JRSWQU.cjs +2 -0
- package/dist/chunk-T2JRSWQU.cjs.map +1 -0
- package/dist/chunk-UQ3DSUWC.js +2 -0
- package/dist/chunk-UQ3DSUWC.js.map +1 -0
- package/dist/chunk-VZHG372Q.cjs +2 -0
- package/dist/chunk-VZHG372Q.cjs.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/core/bindings.cjs +2 -0
- package/dist/core/bindings.cjs.map +1 -0
- package/dist/core/bindings.d.cts +81 -0
- package/dist/core/bindings.d.ts +81 -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 +81 -0
- package/dist/core/utils.d.ts +81 -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.d.cts +2 -2
- package/dist/mask.d.ts +2 -2
- 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-D-ZHxzRy.d.cts +161 -0
- package/dist/store-api-types-DPi30jQF.d.ts +161 -0
- package/dist/{bus-DgilLszS.d.ts → types-CG5nYeRk.d.ts} +76 -45
- package/dist/{bus-rcUiufS7.d.cts → types-D6LhF5GC.d.cts} +76 -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/{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-BTwy8kvA.d.ts} +8 -6
- package/dist/{use-bit-persist-Bc06fmqZ.d.ts → use-bit-persist-C2LHNTVv.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 +32 -10
- 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<T extends object =
|
|
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> & {
|
|
@@ -115,7 +146,7 @@ interface DevToolsOptions {
|
|
|
115
146
|
}
|
|
116
147
|
type BitPluginHookSource = "beforeValidate" | "afterValidate" | "beforeSubmit" | "afterSubmit" | "onFieldChange" | "setup" | "teardown" | "submit";
|
|
117
148
|
type BitFieldChangeOrigin = "setField" | "rebase" | "replaceValues" | "hydrate" | "array";
|
|
118
|
-
type BitArrayOperation = "push" | "prepend" | "insert" | "remove" | "move" | "swap";
|
|
149
|
+
type BitArrayOperation = "push" | "prepend" | "insert" | "remove" | "move" | "swap" | "replace" | "clear";
|
|
119
150
|
interface BitFieldChangeMeta {
|
|
120
151
|
origin: BitFieldChangeOrigin;
|
|
121
152
|
operation?: BitArrayOperation;
|
|
@@ -123,7 +154,7 @@ interface BitFieldChangeMeta {
|
|
|
123
154
|
from?: number;
|
|
124
155
|
to?: number;
|
|
125
156
|
}
|
|
126
|
-
interface BitFieldChangeEvent<T extends object =
|
|
157
|
+
interface BitFieldChangeEvent<T extends object = Record<string, unknown>> {
|
|
127
158
|
path: string;
|
|
128
159
|
previousValue: unknown;
|
|
129
160
|
nextValue: unknown;
|
|
@@ -131,13 +162,13 @@ interface BitFieldChangeEvent<T extends object = any> {
|
|
|
131
162
|
state: Readonly<BitState<T>>;
|
|
132
163
|
meta: BitFieldChangeMeta;
|
|
133
164
|
}
|
|
134
|
-
interface BitBeforeValidateEvent<T extends object =
|
|
165
|
+
interface BitBeforeValidateEvent<T extends object = Record<string, unknown>> {
|
|
135
166
|
values: Readonly<T>;
|
|
136
167
|
state: Readonly<BitState<T>>;
|
|
137
168
|
scope?: string;
|
|
138
169
|
scopeFields?: string[];
|
|
139
170
|
}
|
|
140
|
-
interface BitAfterValidateEvent<T extends object =
|
|
171
|
+
interface BitAfterValidateEvent<T extends object = Record<string, unknown>> {
|
|
141
172
|
values: Readonly<T>;
|
|
142
173
|
state: Readonly<BitState<T>>;
|
|
143
174
|
scope?: string;
|
|
@@ -146,12 +177,12 @@ interface BitAfterValidateEvent<T extends object = any> {
|
|
|
146
177
|
result: boolean;
|
|
147
178
|
aborted?: boolean;
|
|
148
179
|
}
|
|
149
|
-
interface BitBeforeSubmitEvent<T extends object =
|
|
180
|
+
interface BitBeforeSubmitEvent<T extends object = Record<string, unknown>> {
|
|
150
181
|
values: Readonly<T>;
|
|
151
182
|
dirtyValues: Readonly<Partial<T>>;
|
|
152
183
|
state: Readonly<BitState<T>>;
|
|
153
184
|
}
|
|
154
|
-
interface BitAfterSubmitEvent<T extends object =
|
|
185
|
+
interface BitAfterSubmitEvent<T extends object = Record<string, unknown>> {
|
|
155
186
|
values: Readonly<T>;
|
|
156
187
|
dirtyValues: Readonly<Partial<T>>;
|
|
157
188
|
state: Readonly<BitState<T>>;
|
|
@@ -159,7 +190,7 @@ interface BitAfterSubmitEvent<T extends object = any> {
|
|
|
159
190
|
error?: unknown;
|
|
160
191
|
invalid?: boolean;
|
|
161
192
|
}
|
|
162
|
-
interface BitPluginErrorEvent<T extends object =
|
|
193
|
+
interface BitPluginErrorEvent<T extends object = Record<string, unknown>> {
|
|
163
194
|
source: BitPluginHookSource;
|
|
164
195
|
pluginName?: string;
|
|
165
196
|
error: unknown;
|
|
@@ -167,12 +198,12 @@ interface BitPluginErrorEvent<T extends object = any> {
|
|
|
167
198
|
values: Readonly<T>;
|
|
168
199
|
state: Readonly<BitState<T>>;
|
|
169
200
|
}
|
|
170
|
-
interface BitPluginContext<T extends object =
|
|
201
|
+
interface BitPluginContext<T extends object = Record<string, unknown>> {
|
|
171
202
|
storeId: string;
|
|
172
203
|
getState: () => Readonly<BitState<T>>;
|
|
173
204
|
getConfig: () => Readonly<BitConfig<T>>;
|
|
174
205
|
}
|
|
175
|
-
interface BitPluginHooks<T extends object =
|
|
206
|
+
interface BitPluginHooks<T extends object = Record<string, unknown>> {
|
|
176
207
|
beforeValidate?: (event: BitBeforeValidateEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
177
208
|
afterValidate?: (event: BitAfterValidateEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
178
209
|
beforeSubmit?: (event: BitBeforeSubmitEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
@@ -180,7 +211,7 @@ interface BitPluginHooks<T extends object = any> {
|
|
|
180
211
|
onFieldChange?: (event: BitFieldChangeEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
181
212
|
onError?: (event: BitPluginErrorEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
182
213
|
}
|
|
183
|
-
interface BitPlugin<T extends object =
|
|
214
|
+
interface BitPlugin<T extends object = Record<string, unknown>> {
|
|
184
215
|
name: string;
|
|
185
216
|
setup?: (context: BitPluginContext<T>) => void | (() => void);
|
|
186
217
|
hooks?: BitPluginHooks<T>;
|
|
@@ -192,7 +223,7 @@ interface BitPersistStorageAdapter {
|
|
|
192
223
|
removeItem(key: string): BitMaybePromise<void>;
|
|
193
224
|
}
|
|
194
225
|
type BitPersistMode = "values" | "dirtyValues";
|
|
195
|
-
interface BitPersistConfig<T extends object =
|
|
226
|
+
interface BitPersistConfig<T extends object = Record<string, unknown>> {
|
|
196
227
|
enabled?: boolean;
|
|
197
228
|
key?: string;
|
|
198
229
|
storage?: BitPersistStorageAdapter;
|
|
@@ -203,7 +234,7 @@ interface BitPersistConfig<T extends object = any> {
|
|
|
203
234
|
deserialize?: (raw: string) => Partial<T>;
|
|
204
235
|
onError?: (error: unknown) => void;
|
|
205
236
|
}
|
|
206
|
-
interface BitPersistResolvedConfig<T extends object =
|
|
237
|
+
interface BitPersistResolvedConfig<T extends object = Record<string, unknown>> {
|
|
207
238
|
enabled: boolean;
|
|
208
239
|
key: string;
|
|
209
240
|
storage?: BitPersistStorageAdapter;
|
|
@@ -232,7 +263,7 @@ interface BitHistoryConfig {
|
|
|
232
263
|
* BitConfig - store configuration.
|
|
233
264
|
* @see CHANGELOG for migration from features to fields in 2.0.
|
|
234
265
|
*/
|
|
235
|
-
interface BitConfig<T extends object =
|
|
266
|
+
interface BitConfig<T extends object = Record<string, unknown>> {
|
|
236
267
|
/** Core */
|
|
237
268
|
name?: string;
|
|
238
269
|
storeId?: string;
|
|
@@ -271,14 +302,30 @@ interface BitConfig<T extends object = any> {
|
|
|
271
302
|
* where a global singleton is unsafe (e.g. Next.js Edge Runtime).
|
|
272
303
|
*/
|
|
273
304
|
bus?: BitFormGlobal;
|
|
305
|
+
/**
|
|
306
|
+
* Handler opcional para erros operacionais não tratados internamente.
|
|
307
|
+
* Se não informado, o runtime usa fallback para `console.error`.
|
|
308
|
+
*/
|
|
309
|
+
onUnhandledError?: (error: unknown, source: "submit" | "validation" | "persist") => void;
|
|
274
310
|
}
|
|
275
|
-
|
|
311
|
+
type BitSubmitResult = {
|
|
312
|
+
status: "submitted";
|
|
313
|
+
} | {
|
|
314
|
+
status: "invalid";
|
|
315
|
+
} | {
|
|
316
|
+
status: "failed";
|
|
317
|
+
error: unknown;
|
|
318
|
+
} | {
|
|
319
|
+
status: "blocked";
|
|
320
|
+
reason: "isSubmitting" | "validating";
|
|
321
|
+
};
|
|
322
|
+
/** Return type of BitStore.getScopeStatus, used by useBitScope/injectBitScope. */
|
|
276
323
|
interface ScopeStatus {
|
|
277
324
|
hasErrors: boolean;
|
|
278
325
|
isDirty: boolean;
|
|
279
326
|
errors: Record<string, string>;
|
|
280
327
|
}
|
|
281
|
-
/** Return type of
|
|
328
|
+
/** Return type of scope validation helpers, used by useBitScope/injectBitScope. */
|
|
282
329
|
interface ValidateScopeResult {
|
|
283
330
|
valid: boolean;
|
|
284
331
|
errors: Record<string, string>;
|
|
@@ -293,23 +340,7 @@ type BitPath<T, Prefix extends string = ""> = T extends Primitive ? never : T ex
|
|
|
293
340
|
[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
341
|
}[keyof T & (string | number)];
|
|
295
342
|
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
|
|
343
|
+
type BitArrayPath<T> = BitPath<T> extends infer P ? P extends string ? BitPathValue<T, P> extends readonly unknown[] ? P : never : never : never;
|
|
297
344
|
type BitArrayItem<A> = A extends readonly (infer U)[] ? U : A extends (infer U)[] ? U : never;
|
|
298
345
|
|
|
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 };
|
|
346
|
+
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, 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 };
|
|
@@ -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<T extends object =
|
|
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> & {
|
|
@@ -115,7 +146,7 @@ interface DevToolsOptions {
|
|
|
115
146
|
}
|
|
116
147
|
type BitPluginHookSource = "beforeValidate" | "afterValidate" | "beforeSubmit" | "afterSubmit" | "onFieldChange" | "setup" | "teardown" | "submit";
|
|
117
148
|
type BitFieldChangeOrigin = "setField" | "rebase" | "replaceValues" | "hydrate" | "array";
|
|
118
|
-
type BitArrayOperation = "push" | "prepend" | "insert" | "remove" | "move" | "swap";
|
|
149
|
+
type BitArrayOperation = "push" | "prepend" | "insert" | "remove" | "move" | "swap" | "replace" | "clear";
|
|
119
150
|
interface BitFieldChangeMeta {
|
|
120
151
|
origin: BitFieldChangeOrigin;
|
|
121
152
|
operation?: BitArrayOperation;
|
|
@@ -123,7 +154,7 @@ interface BitFieldChangeMeta {
|
|
|
123
154
|
from?: number;
|
|
124
155
|
to?: number;
|
|
125
156
|
}
|
|
126
|
-
interface BitFieldChangeEvent<T extends object =
|
|
157
|
+
interface BitFieldChangeEvent<T extends object = Record<string, unknown>> {
|
|
127
158
|
path: string;
|
|
128
159
|
previousValue: unknown;
|
|
129
160
|
nextValue: unknown;
|
|
@@ -131,13 +162,13 @@ interface BitFieldChangeEvent<T extends object = any> {
|
|
|
131
162
|
state: Readonly<BitState<T>>;
|
|
132
163
|
meta: BitFieldChangeMeta;
|
|
133
164
|
}
|
|
134
|
-
interface BitBeforeValidateEvent<T extends object =
|
|
165
|
+
interface BitBeforeValidateEvent<T extends object = Record<string, unknown>> {
|
|
135
166
|
values: Readonly<T>;
|
|
136
167
|
state: Readonly<BitState<T>>;
|
|
137
168
|
scope?: string;
|
|
138
169
|
scopeFields?: string[];
|
|
139
170
|
}
|
|
140
|
-
interface BitAfterValidateEvent<T extends object =
|
|
171
|
+
interface BitAfterValidateEvent<T extends object = Record<string, unknown>> {
|
|
141
172
|
values: Readonly<T>;
|
|
142
173
|
state: Readonly<BitState<T>>;
|
|
143
174
|
scope?: string;
|
|
@@ -146,12 +177,12 @@ interface BitAfterValidateEvent<T extends object = any> {
|
|
|
146
177
|
result: boolean;
|
|
147
178
|
aborted?: boolean;
|
|
148
179
|
}
|
|
149
|
-
interface BitBeforeSubmitEvent<T extends object =
|
|
180
|
+
interface BitBeforeSubmitEvent<T extends object = Record<string, unknown>> {
|
|
150
181
|
values: Readonly<T>;
|
|
151
182
|
dirtyValues: Readonly<Partial<T>>;
|
|
152
183
|
state: Readonly<BitState<T>>;
|
|
153
184
|
}
|
|
154
|
-
interface BitAfterSubmitEvent<T extends object =
|
|
185
|
+
interface BitAfterSubmitEvent<T extends object = Record<string, unknown>> {
|
|
155
186
|
values: Readonly<T>;
|
|
156
187
|
dirtyValues: Readonly<Partial<T>>;
|
|
157
188
|
state: Readonly<BitState<T>>;
|
|
@@ -159,7 +190,7 @@ interface BitAfterSubmitEvent<T extends object = any> {
|
|
|
159
190
|
error?: unknown;
|
|
160
191
|
invalid?: boolean;
|
|
161
192
|
}
|
|
162
|
-
interface BitPluginErrorEvent<T extends object =
|
|
193
|
+
interface BitPluginErrorEvent<T extends object = Record<string, unknown>> {
|
|
163
194
|
source: BitPluginHookSource;
|
|
164
195
|
pluginName?: string;
|
|
165
196
|
error: unknown;
|
|
@@ -167,12 +198,12 @@ interface BitPluginErrorEvent<T extends object = any> {
|
|
|
167
198
|
values: Readonly<T>;
|
|
168
199
|
state: Readonly<BitState<T>>;
|
|
169
200
|
}
|
|
170
|
-
interface BitPluginContext<T extends object =
|
|
201
|
+
interface BitPluginContext<T extends object = Record<string, unknown>> {
|
|
171
202
|
storeId: string;
|
|
172
203
|
getState: () => Readonly<BitState<T>>;
|
|
173
204
|
getConfig: () => Readonly<BitConfig<T>>;
|
|
174
205
|
}
|
|
175
|
-
interface BitPluginHooks<T extends object =
|
|
206
|
+
interface BitPluginHooks<T extends object = Record<string, unknown>> {
|
|
176
207
|
beforeValidate?: (event: BitBeforeValidateEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
177
208
|
afterValidate?: (event: BitAfterValidateEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
178
209
|
beforeSubmit?: (event: BitBeforeSubmitEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
@@ -180,7 +211,7 @@ interface BitPluginHooks<T extends object = any> {
|
|
|
180
211
|
onFieldChange?: (event: BitFieldChangeEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
181
212
|
onError?: (event: BitPluginErrorEvent<T>, context: BitPluginContext<T>) => BitMaybePromise<void>;
|
|
182
213
|
}
|
|
183
|
-
interface BitPlugin<T extends object =
|
|
214
|
+
interface BitPlugin<T extends object = Record<string, unknown>> {
|
|
184
215
|
name: string;
|
|
185
216
|
setup?: (context: BitPluginContext<T>) => void | (() => void);
|
|
186
217
|
hooks?: BitPluginHooks<T>;
|
|
@@ -192,7 +223,7 @@ interface BitPersistStorageAdapter {
|
|
|
192
223
|
removeItem(key: string): BitMaybePromise<void>;
|
|
193
224
|
}
|
|
194
225
|
type BitPersistMode = "values" | "dirtyValues";
|
|
195
|
-
interface BitPersistConfig<T extends object =
|
|
226
|
+
interface BitPersistConfig<T extends object = Record<string, unknown>> {
|
|
196
227
|
enabled?: boolean;
|
|
197
228
|
key?: string;
|
|
198
229
|
storage?: BitPersistStorageAdapter;
|
|
@@ -203,7 +234,7 @@ interface BitPersistConfig<T extends object = any> {
|
|
|
203
234
|
deserialize?: (raw: string) => Partial<T>;
|
|
204
235
|
onError?: (error: unknown) => void;
|
|
205
236
|
}
|
|
206
|
-
interface BitPersistResolvedConfig<T extends object =
|
|
237
|
+
interface BitPersistResolvedConfig<T extends object = Record<string, unknown>> {
|
|
207
238
|
enabled: boolean;
|
|
208
239
|
key: string;
|
|
209
240
|
storage?: BitPersistStorageAdapter;
|
|
@@ -232,7 +263,7 @@ interface BitHistoryConfig {
|
|
|
232
263
|
* BitConfig - store configuration.
|
|
233
264
|
* @see CHANGELOG for migration from features to fields in 2.0.
|
|
234
265
|
*/
|
|
235
|
-
interface BitConfig<T extends object =
|
|
266
|
+
interface BitConfig<T extends object = Record<string, unknown>> {
|
|
236
267
|
/** Core */
|
|
237
268
|
name?: string;
|
|
238
269
|
storeId?: string;
|
|
@@ -271,14 +302,30 @@ interface BitConfig<T extends object = any> {
|
|
|
271
302
|
* where a global singleton is unsafe (e.g. Next.js Edge Runtime).
|
|
272
303
|
*/
|
|
273
304
|
bus?: BitFormGlobal;
|
|
305
|
+
/**
|
|
306
|
+
* Handler opcional para erros operacionais não tratados internamente.
|
|
307
|
+
* Se não informado, o runtime usa fallback para `console.error`.
|
|
308
|
+
*/
|
|
309
|
+
onUnhandledError?: (error: unknown, source: "submit" | "validation" | "persist") => void;
|
|
274
310
|
}
|
|
275
|
-
|
|
311
|
+
type BitSubmitResult = {
|
|
312
|
+
status: "submitted";
|
|
313
|
+
} | {
|
|
314
|
+
status: "invalid";
|
|
315
|
+
} | {
|
|
316
|
+
status: "failed";
|
|
317
|
+
error: unknown;
|
|
318
|
+
} | {
|
|
319
|
+
status: "blocked";
|
|
320
|
+
reason: "isSubmitting" | "validating";
|
|
321
|
+
};
|
|
322
|
+
/** Return type of BitStore.getScopeStatus, used by useBitScope/injectBitScope. */
|
|
276
323
|
interface ScopeStatus {
|
|
277
324
|
hasErrors: boolean;
|
|
278
325
|
isDirty: boolean;
|
|
279
326
|
errors: Record<string, string>;
|
|
280
327
|
}
|
|
281
|
-
/** Return type of
|
|
328
|
+
/** Return type of scope validation helpers, used by useBitScope/injectBitScope. */
|
|
282
329
|
interface ValidateScopeResult {
|
|
283
330
|
valid: boolean;
|
|
284
331
|
errors: Record<string, string>;
|
|
@@ -293,23 +340,7 @@ type BitPath<T, Prefix extends string = ""> = T extends Primitive ? never : T ex
|
|
|
293
340
|
[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
341
|
}[keyof T & (string | number)];
|
|
295
342
|
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
|
|
343
|
+
type BitArrayPath<T> = BitPath<T> extends infer P ? P extends string ? BitPathValue<T, P> extends readonly unknown[] ? P : never : never : never;
|
|
297
344
|
type BitArrayItem<A> = A extends readonly (infer U)[] ? U : A extends (infer U)[] ? U : never;
|
|
298
345
|
|
|
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 };
|
|
346
|
+
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, 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 };
|
|
@@ -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-DPi30jQF.js';
|
|
4
|
+
import './bus-B2VEKrPI.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-CG5nYeRk.js';
|
|
6
|
+
import { a as BitArrayBindingField } from './array-controller-Cx-DMH7Y.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-D-ZHxzRy.cjs';
|
|
4
|
+
import './bus-ZLQeq4Vr.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-D6LhF5GC.cjs';
|
|
6
|
+
import { a as BitArrayBindingField } from './array-controller-B5bfXV1W.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 _chunkT2JRSWQUcjs = require('./chunk-T2JRSWQU.cjs');exports.cleanPrefixedKeys = _chunkT2JRSWQUcjs.j; exports.extractServerErrors = _chunkT2JRSWQUcjs.m; exports.isValidationErrorShape = _chunkT2JRSWQUcjs.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"}
|
package/dist/utils.d.cts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare function cleanPrefixedKeys(obj: Record<string, any>, prefix: string): Record<string, any>;
|
|
2
|
+
|
|
3
|
+
declare function isValidationErrorShape(x: unknown): x is Record<string, string | string[]>;
|
|
4
|
+
declare function extractServerErrors(x: unknown): Record<string, string | string[]>;
|
|
5
|
+
|
|
6
|
+
export { cleanPrefixedKeys, extractServerErrors, isValidationErrorShape };
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare function cleanPrefixedKeys(obj: Record<string, any>, prefix: string): Record<string, any>;
|
|
2
|
+
|
|
3
|
+
declare function isValidationErrorShape(x: unknown): x is Record<string, string | string[]>;
|
|
4
|
+
declare function extractServerErrors(x: unknown): Record<string, string | string[]>;
|
|
5
|
+
|
|
6
|
+
export { cleanPrefixedKeys, extractServerErrors, isValidationErrorShape };
|