@1money/component-ui 0.0.75 → 0.0.76

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.
Files changed (71) hide show
  1. package/es/components/ProForm/ProForm.js +46 -33
  2. package/es/components/ProForm/ProFormDependency.js +6 -16
  3. package/es/components/ProForm/ProFormItem.js +5 -7
  4. package/es/components/ProForm/ProFormList.js +112 -40
  5. package/es/components/ProForm/core/constants.d.ts +2 -0
  6. package/es/components/ProForm/core/constants.js +7 -1
  7. package/es/components/ProForm/core/devWarning.d.ts +3 -0
  8. package/es/components/ProForm/core/devWarning.js +22 -0
  9. package/es/components/ProForm/core/formStore.d.ts +10 -2
  10. package/es/components/ProForm/core/formStore.js +21 -2
  11. package/es/components/ProForm/core/hooks/useForm.js +246 -103
  12. package/es/components/ProForm/core/hooks/useFormCore.js +134 -28
  13. package/es/components/ProForm/core/interface.d.ts +124 -49
  14. package/es/components/ProForm/core/runRules.d.ts +44 -12
  15. package/es/components/ProForm/core/runRules.js +584 -133
  16. package/es/components/ProForm/core/useFormItem.d.ts +6 -7
  17. package/es/components/ProForm/core/useFormItem.js +44 -22
  18. package/es/components/ProForm/core/validationError.d.ts +13 -0
  19. package/es/components/ProForm/core/validationError.js +29 -0
  20. package/es/components/ProForm/fields/ProFormCheckboxGroup.js +19 -5
  21. package/es/components/ProForm/fields/ProFormFieldSet.js +51 -12
  22. package/es/components/ProForm/fields/ProFormRadioGroup.js +8 -3
  23. package/es/components/ProForm/fields/ProFormSelect.js +13 -7
  24. package/es/components/ProForm/fields/createProFormField.js +18 -25
  25. package/es/components/ProForm/hooks/useFieldRequest.js +10 -8
  26. package/es/components/ProForm/index.d.ts +2 -1
  27. package/es/components/ProForm/index.js +4 -1
  28. package/es/components/ProForm/interface.d.ts +31 -40
  29. package/es/components/ProForm/layouts/QueryFilter.js +24 -16
  30. package/es/components/ProForm/utils.d.ts +8 -0
  31. package/es/components/ProForm/utils.js +51 -3
  32. package/es/components/Table/core/useTableSetup.js +2 -2
  33. package/es/components/Table/interface.d.ts +1 -1
  34. package/es/index.css +1 -1
  35. package/lib/components/ProForm/ProForm.js +45 -32
  36. package/lib/components/ProForm/ProFormDependency.js +5 -15
  37. package/lib/components/ProForm/ProFormItem.js +5 -7
  38. package/lib/components/ProForm/ProFormList.js +110 -38
  39. package/lib/components/ProForm/core/constants.d.ts +2 -0
  40. package/lib/components/ProForm/core/constants.js +8 -2
  41. package/lib/components/ProForm/core/devWarning.d.ts +3 -0
  42. package/lib/components/ProForm/core/devWarning.js +29 -0
  43. package/lib/components/ProForm/core/formStore.d.ts +10 -2
  44. package/lib/components/ProForm/core/formStore.js +23 -2
  45. package/lib/components/ProForm/core/hooks/useForm.js +242 -99
  46. package/lib/components/ProForm/core/hooks/useFormCore.js +133 -27
  47. package/lib/components/ProForm/core/interface.d.ts +124 -49
  48. package/lib/components/ProForm/core/runRules.d.ts +44 -12
  49. package/lib/components/ProForm/core/runRules.js +587 -133
  50. package/lib/components/ProForm/core/useFormItem.d.ts +6 -7
  51. package/lib/components/ProForm/core/useFormItem.js +43 -21
  52. package/lib/components/ProForm/core/validationError.d.ts +13 -0
  53. package/lib/components/ProForm/core/validationError.js +36 -0
  54. package/lib/components/ProForm/fields/ProFormCheckboxGroup.js +18 -4
  55. package/lib/components/ProForm/fields/ProFormFieldSet.js +51 -12
  56. package/lib/components/ProForm/fields/ProFormRadioGroup.js +7 -2
  57. package/lib/components/ProForm/fields/ProFormSelect.js +13 -7
  58. package/lib/components/ProForm/fields/createProFormField.js +18 -25
  59. package/lib/components/ProForm/hooks/useFieldRequest.js +10 -8
  60. package/lib/components/ProForm/index.d.ts +2 -1
  61. package/lib/components/ProForm/index.js +10 -1
  62. package/lib/components/ProForm/interface.d.ts +31 -40
  63. package/lib/components/ProForm/layouts/QueryFilter.js +24 -16
  64. package/lib/components/ProForm/utils.d.ts +8 -0
  65. package/lib/components/ProForm/utils.js +52 -3
  66. package/lib/components/Table/core/useTableSetup.js +2 -2
  67. package/lib/components/Table/interface.d.ts +1 -1
  68. package/lib/index.css +1 -1
  69. package/package.json +1 -1
  70. package/scripts/mcp-server/examples.generated.json +42 -36
  71. package/scripts/mcp-server/index.generated.json +23 -67
@@ -1,39 +1,101 @@
1
1
  import type React from 'react';
2
2
  import type { FC, ReactNode } from 'react';
3
3
  import type { FormSize, FormLayout, LabelAlign, ValidateStatus, ValidateTrigger } from './constants';
4
+ import { RULE_CONTEXT_READ_MEMBERS, RULE_CONTEXT_MUTATOR_MEMBERS } from './constants';
4
5
  export type { FormSize, FormLayout, LabelAlign, ValidateStatus, ValidateTrigger, };
6
+ /** Built-in `type` check names. */
7
+ export type RuleType = 'string' | 'number' | 'boolean' | 'method' | 'regexp' | 'integer' | 'float' | 'object' | 'array' | 'date' | 'url' | 'hex' | 'email' | 'enum';
5
8
  export interface Rule {
6
9
  /** Fails on undefined / null / '' / empty array */
7
10
  required?: boolean;
8
- message?: string;
11
+ /** Error content shown on failure — any ReactNode (falls back to a generated string) */
12
+ message?: ReactNode;
9
13
  /** For strings: min length; arrays: min item count; numbers: min value */
10
14
  min?: number;
11
15
  /** For strings: max length; arrays: max item count; numbers: max value */
12
16
  max?: number;
17
+ /** Exact string length / array item count / numeric value. Takes precedence over min/max */
18
+ len?: number;
13
19
  pattern?: RegExp;
14
- type?: 'number' | 'email' | 'url';
20
+ type?: RuleType;
15
21
  enum?: unknown[];
22
+ /** Fails a non-empty string consisting only of whitespace */
23
+ whitespace?: boolean;
24
+ /** Transform the value before every check (builtin and validator) of THIS rule */
25
+ transform?: (value: unknown) => unknown;
26
+ /** Deep rule(s) applied to every member of an array/object value */
27
+ defaultField?: Rule | Rule[];
28
+ /** Deep rules applied per key of an object/array value */
29
+ fields?: Record<string, Rule | Rule[]>;
16
30
  /** A failing rule produces a non-blocking warning instead of an error */
17
31
  warningOnly?: boolean;
18
32
  /**
19
- * Run this rule only on the given interactive trigger(s); rules without it
20
- * follow the form-level validateTrigger. Submit always runs every rule.
33
+ * Run this rule only on the given interactive event(s). It
34
+ * must be a subset of the item's effective triggers to fire interactively.
35
+ * Rules without it run on every effective trigger. Submit always runs
36
+ * every rule.
21
37
  */
22
38
  validateTrigger?: ValidateTrigger | ValidateTrigger[];
23
- validator?: (value: unknown, values: Record<string, unknown>) => boolean | string | Promise<boolean | string>;
39
+ /**
40
+ * Custom validator: resolve (or return undefined) to pass,
41
+ * reject/throw to fail. The failure message is taken from the rejection
42
+ * (Error.message or a plain string), then `rule.message`, then a generic
43
+ * fallback. Return values are ignored — returning `false` or a string does
44
+ * NOT fail the rule.
45
+ */
46
+ validator?: (rule: Rule, value: unknown) => Promise<void> | void;
24
47
  }
48
+ /**
49
+ * Form/Item-level validateTrigger config: a single event, a
50
+ * list of events, or `false` to disable interactive validation entirely
51
+ * (submit / validateFields still run every rule). Item-level overrides
52
+ * form-level.
53
+ */
54
+ export type ValidateTriggerProp = ValidateTrigger | ValidateTrigger[] | false;
55
+ /**
56
+ * The form context handed to function-form rules. The read helpers are
57
+ * always available (derived from the validation-time value snapshot). The
58
+ * remaining members are backed by the live form instance and are present
59
+ * whenever rules run inside a mounted form — they are only absent when the
60
+ * pure rule engine is invoked directly without an instance.
61
+ */
62
+ export interface RuleContext {
63
+ getFieldValue: (name: string) => unknown;
64
+ getFieldsValue: () => Record<string, unknown>;
65
+ setFieldValue?: (name: string, value: unknown) => void;
66
+ setFieldsValue?: (values: Record<string, unknown>) => void;
67
+ resetFields?: () => void;
68
+ getFieldError?: (name: string) => ReactNode | undefined;
69
+ getFieldWarning?: (name: string) => ReactNode | undefined;
70
+ isFieldTouched?: (name: string) => boolean;
71
+ isFieldValidating?: (name: string) => boolean;
72
+ }
73
+ /**
74
+ * A rule entry as consumers write it: a static Rule, or — for cross-field
75
+ * validation — a function of the form context returning a Rule (the
76
+ * `({ getFieldValue }) => ({ validator })` idiom).
77
+ */
78
+ export type FormRule = Rule | ((ctx: RuleContext) => Rule);
79
+ export type RuleContextReadMember = (typeof RULE_CONTEXT_READ_MEMBERS)[number];
80
+ export type RuleContextMutatorMember = (typeof RULE_CONTEXT_MUTATOR_MEMBERS)[number];
81
+ type AssertRuleContextMembers<T extends keyof RuleContext> = T;
82
+ /**
83
+ * Compile-time guard: the member lists in constants.ts must stay subsets of
84
+ * RuleContext — renaming or removing a member there breaks this line.
85
+ */
86
+ export type RuleContextInstanceMember = AssertRuleContextMembers<RuleContextReadMember | RuleContextMutatorMember>;
25
87
  export interface FieldProps {
26
88
  name: string;
27
89
  value: unknown;
28
- error?: string;
90
+ error?: ReactNode;
29
91
  touched?: boolean;
30
92
  validating?: boolean;
31
93
  onChange: (value: unknown) => void;
32
94
  onBlur: () => void;
33
95
  }
34
96
  export interface FieldOptions {
35
- rules?: Rule[];
36
- validateTrigger?: ValidateTrigger;
97
+ rules?: FormRule[];
98
+ validateTrigger?: ValidateTriggerProp;
37
99
  }
38
100
  export interface FieldComponentProps {
39
101
  children: ReactNode | ((props: FieldProps) => ReactNode);
@@ -44,14 +106,14 @@ export interface FormCoreInstance {
44
106
  submit: () => {
45
107
  success: boolean;
46
108
  values?: Record<string, unknown>;
47
- errors?: Record<string, string>;
109
+ errors?: Record<string, ReactNode>;
48
110
  };
49
111
  resetFields: () => void;
50
112
  getFieldValue: (name: string) => unknown;
51
113
  getFieldsValue: () => Record<string, unknown>;
52
114
  setFieldsValue: (values: Record<string, unknown>) => void;
53
115
  setFieldValue: (name: string, value: unknown) => void;
54
- validateFields: (fieldsRules?: Record<string, Rule[]>) => boolean;
116
+ validateFields: (fieldsRules?: Record<string, FormRule[]>) => boolean;
55
117
  }
56
118
  /**
57
119
  * Full form instance returned by useForm — extends FormCoreInstance with async
@@ -63,84 +125,84 @@ export interface FormInstance<Values = Record<string, unknown>> {
63
125
  getFieldsValue: (nameList?: string[]) => Values;
64
126
  setFieldValue: (name: string, value: unknown) => void;
65
127
  setFieldsValue: (values: Partial<Values>) => void;
66
- setFieldError: (name: string, error: string | null) => void;
67
- setFieldsError: (errors: Record<string, string>) => void;
128
+ setFieldError: (name: string, error: ReactNode | null) => void;
129
+ setFieldsError: (errors: Record<string, ReactNode>) => void;
68
130
  resetFields: (fields?: string[]) => void;
69
131
  validateFields: (nameList?: string[]) => Promise<Values>;
70
132
  submit: (callback?: (values: Values) => void | Promise<void>) => Promise<Values | undefined>;
71
- getFieldError: (name: string) => string | undefined;
72
- getFieldsError: (nameList?: string[]) => Record<string, string>;
73
- getFieldWarning: (name: string) => string | undefined;
133
+ getFieldError: (name: string) => ReactNode | undefined;
134
+ getFieldsError: (nameList?: string[]) => Record<string, ReactNode>;
135
+ getFieldWarning: (name: string) => ReactNode | undefined;
74
136
  isFieldTouched: (name: string) => boolean;
75
137
  isFieldsTouched: (nameList?: string[], allTouched?: boolean) => boolean;
76
138
  isFieldValidating: (name: string) => boolean;
77
139
  setFieldTouched: (name: string, isTouched?: boolean) => void;
78
140
  setFieldsTouched: (touched: Record<string, boolean>) => void;
79
141
  defineField: (name: string, options?: FieldOptions) => FC<FieldComponentProps>;
80
- registerField: (name: string, rules: Rule[]) => void;
142
+ registerField: (name: string, rules: FormRule[]) => void;
81
143
  unregisterField: (name: string) => void;
82
144
  }
83
145
  export interface UseFormOptions {
84
146
  onValuesChange?: (changedValues: Record<string, unknown>, allValues: Record<string, unknown>) => void;
85
- validateTrigger?: ValidateTrigger;
86
- rules?: Record<string, Rule[]>;
147
+ validateTrigger?: ValidateTriggerProp;
148
+ rules?: Record<string, FormRule[]>;
87
149
  }
88
150
  export interface UseFormCoreConfig<Values = Record<string, unknown>> {
89
151
  initialValues?: Partial<Values>;
90
152
  onFinish?: (values: Values) => void;
91
153
  onFinishFailed?: (errorInfo: {
92
154
  values: Values;
93
- errors: Record<string, string>;
155
+ errors: Record<string, ReactNode>;
94
156
  }) => void;
95
157
  onValuesChange?: (changedValues: Partial<Values>, allValues: Values) => void;
96
158
  onReset?: () => void;
97
159
  size?: FormSize;
98
160
  labelAlign?: LabelAlign;
99
161
  disabled?: boolean;
100
- colon?: boolean;
101
- requiredMark?: boolean;
102
- validateTrigger?: ValidateTrigger;
162
+ validateTrigger?: ValidateTriggerProp;
103
163
  }
104
164
  /** Internal shape of data produced by useFormCore, consumed by ProForm to build ProFormContext */
105
165
  export interface FormCoreContextShape {
106
166
  values: Record<string, unknown>;
107
- errors: Record<string, string>;
108
- warnings: Record<string, string>;
167
+ errors: Record<string, ReactNode>;
168
+ warnings: Record<string, ReactNode>;
109
169
  touched: Record<string, boolean>;
110
170
  formInstance: FormCoreInstance;
111
171
  setFieldValue: (name: string, value: unknown) => void;
112
- setFieldError: (name: string, error: string | null) => void;
113
- setFieldWarning: (name: string, warning: string | null) => void;
114
- validateField: (name: string, rules: Rule[], providedValue?: unknown) => boolean;
115
- registerField: (name: string, rules: Rule[]) => void;
172
+ setFieldError: (name: string, error: ReactNode | null) => void;
173
+ setFieldWarning: (name: string, warning: ReactNode | null) => void;
174
+ validateField: (name: string, rules: FormRule[], providedValue?: unknown) => boolean;
175
+ registerField: (name: string, rules: FormRule[]) => void;
116
176
  unregisterField: (name: string) => void;
117
177
  size: FormSize;
118
178
  labelAlign: LabelAlign;
119
179
  disabled: boolean;
120
- colon: boolean;
121
- requiredMark: boolean;
122
- validateTrigger: ValidateTrigger;
180
+ validateTrigger: ValidateTriggerProp;
123
181
  }
124
182
  /** Config for useForm — accepts all UseFormCoreConfig fields */
125
183
  export type UseFormConfig<Values = Record<string, unknown>> = UseFormCoreConfig<Values>;
126
184
  /** Internal state exposed by useForm for ProForm integration */
127
185
  export interface UseFormInternals {
128
186
  values: Record<string, unknown>;
129
- errors: Record<string, string>;
130
- warnings: Record<string, string>;
187
+ errors: Record<string, ReactNode>;
188
+ warnings: Record<string, ReactNode>;
131
189
  touched: Record<string, boolean>;
132
190
  validating: Record<string, boolean>;
133
- fieldRules: Record<string, Rule[]>;
191
+ fieldRules: Record<string, FormRule[]>;
134
192
  setFieldValue: (name: string, value: unknown) => void;
135
- setFieldError: (name: string, error: string | null) => void;
136
- setFieldWarning: (name: string, warning: string | null) => void;
137
- validateField: (name: string, rules: Rule[], providedValue?: unknown) => boolean;
138
- validateFieldAsync: (name: string, value: unknown, rules: Rule[]) => Promise<{
193
+ setFieldError: (name: string, error: ReactNode | null) => void;
194
+ setFieldWarning: (name: string, warning: ReactNode | null) => void;
195
+ validateField: (name: string, rules: FormRule[], providedValue?: unknown) => boolean;
196
+ validateFieldAsync: (name: string, value: unknown, rules: FormRule[]) => Promise<{
139
197
  isValid: boolean;
140
- error: string | null;
198
+ error: ReactNode | null;
141
199
  }>;
142
- registerField: (name: string, rules: Rule[]) => void;
200
+ registerField: (name: string, rules: FormRule[]) => void;
143
201
  unregisterField: (name: string) => void;
202
+ /** Count a mounted instance for `name` — pair with `releaseField` on unmount. */
203
+ retainField: (name: string) => void;
204
+ /** Drop one instance count; the field's rules are removed only at zero. */
205
+ releaseField: (name: string) => void;
144
206
  handleSubmit: (e?: React.FormEvent) => void;
145
207
  handleReset: (e?: React.FormEvent) => void;
146
208
  }
@@ -151,21 +213,34 @@ export interface UseFormReturn {
151
213
  }
152
214
  export interface UseFormCoreReturn {
153
215
  values: Record<string, unknown>;
154
- errors: Record<string, string>;
155
- warnings: Record<string, string>;
216
+ errors: Record<string, ReactNode>;
217
+ warnings: Record<string, ReactNode>;
156
218
  touched: Record<string, boolean>;
157
- fieldRules: Record<string, Rule[]>;
158
- getFieldRules: (name: string) => Rule[] | undefined;
219
+ fieldRules: Record<string, FormRule[]>;
220
+ getFieldRules: (name: string) => FormRule[] | undefined;
221
+ /** Instance handed to function-form rules; useForm upgrades it to the full form instance. */
222
+ getRuleContextInstance: () => Partial<RuleContext>;
223
+ setRuleContextInstance: (instance: Partial<RuleContext>) => void;
224
+ /** Bump and return the field's validation epoch — every run captures one. */
225
+ beginValidationRun: (name: string) => number;
226
+ /** True while no newer run has started for the field since `epoch` was issued. */
227
+ isValidationRunCurrent: (name: string, epoch: number) => boolean;
228
+ /** Invalidate in-flight runs (all fields, or the given ones) — e.g. on reset. */
229
+ invalidateValidationRuns: (names?: string[]) => void;
159
230
  setFieldValue: (name: string, value: unknown) => void;
160
- setFieldError: (name: string, error: string | null) => void;
161
- setFieldWarning: (name: string, warning: string | null) => void;
231
+ setFieldError: (name: string, error: ReactNode | null) => void;
232
+ setFieldWarning: (name: string, warning: ReactNode | null) => void;
162
233
  setFieldsValue: (values: Record<string, unknown>) => void;
163
234
  getFieldValue: (name: string) => unknown;
164
235
  getFieldsValue: () => Record<string, unknown>;
165
- validateField: (name: string, rules: Rule[], providedValue?: unknown) => boolean;
166
- validateFields: (fieldsRules?: Record<string, Rule[]>) => boolean;
167
- registerField: (name: string, rules: Rule[]) => void;
236
+ validateField: (name: string, rules: FormRule[], providedValue?: unknown) => boolean;
237
+ validateFields: (fieldsRules?: Record<string, FormRule[]>) => boolean;
238
+ registerField: (name: string, rules: FormRule[]) => void;
168
239
  unregisterField: (name: string) => void;
240
+ /** Count a mounted instance for `name` — pair with `releaseField` on unmount. */
241
+ retainField: (name: string) => void;
242
+ /** Drop one instance count; the field's rules are removed only at zero. */
243
+ releaseField: (name: string) => void;
169
244
  handleSubmit: (e?: React.FormEvent) => void;
170
245
  handleReset: (e?: React.FormEvent) => void;
171
246
  resetFields: () => void;
@@ -1,25 +1,57 @@
1
- import type { Rule, ValidateTrigger } from './interface';
1
+ import type { ReactNode } from 'react';
2
+ import type { FormRule, Rule, RuleContext, ValidateTrigger, ValidateTriggerProp } from './interface';
2
3
  export interface RuleRunResult {
3
- error: string | null;
4
- warning: string | null;
4
+ error: ReactNode | null;
5
+ warning: ReactNode | null;
5
6
  }
6
7
  /**
7
- * Filter rules applicable to an interactive trigger. A rule WITHOUT an
8
- * explicit `validateTrigger` follows the form-level trigger; a rule WITH one
9
- * runs on exactly those trigger(s), regardless of the form-level setting.
10
- * Submit-time validation bypasses this filter and runs every rule.
8
+ * Coerce a thrown/rejected reason into displayable failure content:
9
+ * a non-empty Error.message or a non-empty plain string otherwise null
10
+ * (caller picks its fallback). Shared with the form-level last-resort nets.
11
11
  */
12
- export declare function filterRulesByTrigger(rules: Rule[], trigger: ValidateTrigger, formTrigger: ValidateTrigger): Rule[];
12
+ export declare function coerceFailureReason(reason: unknown): ReactNode | null;
13
+ /**
14
+ * Resolve function-form rules into static rules. The
15
+ * context exposes the value snapshot the run was invoked with; function rules
16
+ * must be cheap and side-effect free — they may be resolved more than once
17
+ * per validation pass.
18
+ */
19
+ export declare function resolveRules(rules: FormRule[], values: Record<string, unknown>, instance?: Partial<RuleContext>): Rule[];
20
+ /**
21
+ * Normalize a form/item-level validateTrigger config into the effective
22
+ * interactive event list: item-level (when present) overrides form-level;
23
+ * `false` disables interactive validation entirely.
24
+ */
25
+ export declare function normalizeTriggers(itemTrigger: ValidateTriggerProp | undefined, formTrigger: ValidateTriggerProp): ValidateTrigger[];
26
+ /**
27
+ * Filter rules applicable to an interactive event: the event
28
+ * validates only when it is in the item's effective trigger set. Within the
29
+ * set, a rule WITHOUT `validateTrigger` runs on every event; a rule WITH one
30
+ * runs only on matching events — so a rule trigger outside the item's set
31
+ * never fires interactively. Submit-time validation bypasses this filter and
32
+ * runs every rule.
33
+ *
34
+ * Dev guard: a rule whose (non-empty) trigger set is fully OUTSIDE the
35
+ * active set can never fire interactively — usually a leftover of the
36
+ * pre-0.0.76 override semantics, so it warns once. `validateTrigger: []`
37
+ * is the deliberate submit-only idiom and stays silent.
38
+ */
39
+ export declare function filterRulesByTrigger(rules: Rule[], trigger: ValidateTrigger, activeTriggers: ValidateTrigger[], fieldName?: string): Rule[];
13
40
  /**
14
41
  * Synchronous rule run. A Promise-returning validator CANNOT be evaluated
15
42
  * here — it is deferred (treated as passing for this run; its rejection is
16
43
  * swallowed) and left to the async runs (blur/submit), which always await it.
17
44
  * Failing it instead would mis-report "Validation failed" on every keystroke
18
45
  * for perfectly valid input.
46
+ *
47
+ * The per-rule try/catch is the engine's totality choke point: NO input —
48
+ * including exotic values that break a builtin check — may escape as a throw;
49
+ * every failure surfaces through the error/warning channels.
19
50
  */
20
- export declare function runRulesSync(name: string, value: unknown, values: Record<string, unknown>, rules: Rule[]): RuleRunResult;
51
+ export declare function runRulesSync(name: string, value: unknown, values: Record<string, unknown>, rules: FormRule[], instance?: Partial<RuleContext>): RuleRunResult;
21
52
  /**
22
- * Asynchronous rule run. Custom validators are awaited (sync or async). A
23
- * validator returning `undefined` is treated as passing.
53
+ * Asynchronous rule run. Custom validators are awaited (sync or async):
54
+ * resolving passes, rejecting/throwing fails. Return values are ignored.
55
+ * Shares the totality choke point with runRulesSync.
24
56
  */
25
- export declare function runRulesAsync(name: string, value: unknown, values: Record<string, unknown>, rules: Rule[]): Promise<RuleRunResult>;
57
+ export declare function runRulesAsync(name: string, value: unknown, values: Record<string, unknown>, rules: FormRule[], instance?: Partial<RuleContext>): Promise<RuleRunResult>;