@kubuild/schema 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +117 -0
- package/dist/actions.d.ts +423 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/document.d.ts +23 -1
- package/dist/document.d.ts.map +1 -1
- package/dist/form.d.ts +129 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/index.cjs +920 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +870 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15379 -0
- package/dist/index.mjs.map +1 -0
- package/dist/json-schema.d.ts +782 -0
- package/dist/json-schema.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/form.d.ts
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Validation Rule Types
|
|
4
|
+
* Supported validation primitives for form inputs in KUBUILD.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ValidationRuleTypeSchema: z.ZodEnum<{
|
|
7
|
+
required: "required";
|
|
8
|
+
url: "url";
|
|
9
|
+
pattern: "pattern";
|
|
10
|
+
email: "email";
|
|
11
|
+
max_length: "max_length";
|
|
12
|
+
min_length: "min_length";
|
|
13
|
+
numeric_min: "numeric_min";
|
|
14
|
+
numeric_max: "numeric_max";
|
|
15
|
+
match_field: "match_field";
|
|
16
|
+
custom_regex: "custom_regex";
|
|
17
|
+
}>;
|
|
18
|
+
export type ValidationRuleType = z.infer<typeof ValidationRuleTypeSchema>;
|
|
19
|
+
/**
|
|
20
|
+
* Validation Trigger Timing
|
|
21
|
+
* Controls when field validation is evaluated.
|
|
22
|
+
*/
|
|
23
|
+
export declare const ValidateOnEventSchema: z.ZodEnum<{
|
|
24
|
+
change: "change";
|
|
25
|
+
blur: "blur";
|
|
26
|
+
submit: "submit";
|
|
27
|
+
}>;
|
|
28
|
+
export type ValidateOnEvent = z.infer<typeof ValidateOnEventSchema>;
|
|
29
|
+
/**
|
|
30
|
+
* Validation Rule Schema
|
|
31
|
+
* Defines an individual validation condition and its custom error message.
|
|
32
|
+
*/
|
|
33
|
+
export declare const ValidationRuleSchema: z.ZodObject<{
|
|
34
|
+
type: z.ZodEnum<{
|
|
35
|
+
required: "required";
|
|
36
|
+
url: "url";
|
|
37
|
+
pattern: "pattern";
|
|
38
|
+
email: "email";
|
|
39
|
+
max_length: "max_length";
|
|
40
|
+
min_length: "min_length";
|
|
41
|
+
numeric_min: "numeric_min";
|
|
42
|
+
numeric_max: "numeric_max";
|
|
43
|
+
match_field: "match_field";
|
|
44
|
+
custom_regex: "custom_regex";
|
|
45
|
+
}>;
|
|
46
|
+
value: z.ZodOptional<z.ZodUnknown>;
|
|
47
|
+
message: z.ZodString;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
export type ValidationRule = z.infer<typeof ValidationRuleSchema>;
|
|
50
|
+
/**
|
|
51
|
+
* Form Field Binding Schema
|
|
52
|
+
* Connects an input component to the form state runtime with validation rules and initial values.
|
|
53
|
+
*/
|
|
54
|
+
export declare const FormFieldBindingSchema: z.ZodObject<{
|
|
55
|
+
name: z.ZodString;
|
|
56
|
+
label: z.ZodOptional<z.ZodString>;
|
|
57
|
+
defaultValue: z.ZodOptional<z.ZodUnknown>;
|
|
58
|
+
rules: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
59
|
+
type: z.ZodEnum<{
|
|
60
|
+
required: "required";
|
|
61
|
+
url: "url";
|
|
62
|
+
pattern: "pattern";
|
|
63
|
+
email: "email";
|
|
64
|
+
max_length: "max_length";
|
|
65
|
+
min_length: "min_length";
|
|
66
|
+
numeric_min: "numeric_min";
|
|
67
|
+
numeric_max: "numeric_max";
|
|
68
|
+
match_field: "match_field";
|
|
69
|
+
custom_regex: "custom_regex";
|
|
70
|
+
}>;
|
|
71
|
+
value: z.ZodOptional<z.ZodUnknown>;
|
|
72
|
+
message: z.ZodString;
|
|
73
|
+
}, z.core.$strip>>>>;
|
|
74
|
+
validateOn: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
75
|
+
change: "change";
|
|
76
|
+
blur: "blur";
|
|
77
|
+
submit: "submit";
|
|
78
|
+
}>>>;
|
|
79
|
+
transform: z.ZodOptional<z.ZodEnum<{
|
|
80
|
+
number: "number";
|
|
81
|
+
trim: "trim";
|
|
82
|
+
lowercase: "lowercase";
|
|
83
|
+
uppercase: "uppercase";
|
|
84
|
+
}>>;
|
|
85
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
86
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
export type FormFieldBinding = z.infer<typeof FormFieldBindingSchema>;
|
|
89
|
+
/**
|
|
90
|
+
* Form Container Configuration Schema
|
|
91
|
+
* Configuration for form boundaries, submission behavior, and error focus.
|
|
92
|
+
*/
|
|
93
|
+
export declare const FormConfigSchema: z.ZodObject<{
|
|
94
|
+
formId: z.ZodString;
|
|
95
|
+
resetOnSubmit: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
96
|
+
scrollToFirstError: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
97
|
+
validateOn: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
98
|
+
change: "change";
|
|
99
|
+
blur: "blur";
|
|
100
|
+
submit: "submit";
|
|
101
|
+
}>>>;
|
|
102
|
+
initialValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
103
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
104
|
+
type: z.ZodEnum<{
|
|
105
|
+
required: "required";
|
|
106
|
+
url: "url";
|
|
107
|
+
pattern: "pattern";
|
|
108
|
+
email: "email";
|
|
109
|
+
max_length: "max_length";
|
|
110
|
+
min_length: "min_length";
|
|
111
|
+
numeric_min: "numeric_min";
|
|
112
|
+
numeric_max: "numeric_max";
|
|
113
|
+
match_field: "match_field";
|
|
114
|
+
custom_regex: "custom_regex";
|
|
115
|
+
}>;
|
|
116
|
+
value: z.ZodOptional<z.ZodUnknown>;
|
|
117
|
+
message: z.ZodString;
|
|
118
|
+
}, z.core.$strip>>>;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
export type FormConfig = z.infer<typeof FormConfigSchema>;
|
|
121
|
+
/**
|
|
122
|
+
* Type Guards
|
|
123
|
+
*/
|
|
124
|
+
export declare function isValidationRuleType(value: unknown): value is ValidationRuleType;
|
|
125
|
+
export declare function isValidationRule(value: unknown): value is ValidationRule;
|
|
126
|
+
export declare function isValidateOnEvent(value: unknown): value is ValidateOnEvent;
|
|
127
|
+
export declare function isFormFieldBinding(value: unknown): value is FormFieldBinding;
|
|
128
|
+
export declare function isFormConfig(value: unknown): value is FormConfig;
|
|
129
|
+
//# sourceMappingURL=form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../src/form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;EAWnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;EAAuC,CAAC;AAC1E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;iBAI/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,sBAAs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