@byyuurin/ui 0.0.9 → 0.0.10
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 +0 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/app/injections.d.ts +9299 -3
- package/dist/runtime/app/injections.js +35 -0
- package/dist/runtime/components/Accordion.vue +16 -20
- package/dist/runtime/components/Alert.vue +1 -1
- package/dist/runtime/components/Badge.vue +1 -1
- package/dist/runtime/components/Breadcrumb.vue +17 -21
- package/dist/runtime/components/Calendar.vue +15 -6
- package/dist/runtime/components/Carousel.vue +5 -3
- package/dist/runtime/components/Checkbox.vue +12 -7
- package/dist/runtime/components/Drawer.vue +12 -12
- package/dist/runtime/components/DropdownMenu.vue +143 -0
- package/dist/runtime/components/DropdownMenuContent.vue +188 -0
- package/dist/runtime/components/Form.vue +311 -0
- package/dist/runtime/components/FormItem.vue +129 -0
- package/dist/runtime/components/Input.vue +27 -13
- package/dist/runtime/components/InputNumber.vue +22 -14
- package/dist/runtime/components/Link.vue +17 -2
- package/dist/runtime/components/Modal.vue +11 -11
- package/dist/runtime/components/PinInput.vue +22 -13
- package/dist/runtime/components/Popover.vue +3 -3
- package/dist/runtime/components/RadioGroup.vue +50 -46
- package/dist/runtime/components/Select.vue +90 -80
- package/dist/runtime/components/Slider.vue +12 -7
- package/dist/runtime/components/Switch.vue +12 -6
- package/dist/runtime/components/Table.vue +21 -8
- package/dist/runtime/components/Tabs.vue +12 -11
- package/dist/runtime/components/Textarea.vue +19 -13
- package/dist/runtime/components/Toast.vue +6 -3
- package/dist/runtime/components/Tooltip.vue +3 -3
- package/dist/runtime/composables/useFormItem.d.ts +27 -0
- package/dist/runtime/composables/useFormItem.js +64 -0
- package/dist/runtime/composables/useTheme.js +2 -1
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.js +3 -0
- package/dist/runtime/theme/app.d.ts +1 -0
- package/dist/runtime/theme/app.js +2 -1
- package/dist/runtime/theme/badge.d.ts +21 -45
- package/dist/runtime/theme/breadcrumb.d.ts +3 -3
- package/dist/runtime/theme/button.d.ts +111 -57
- package/dist/runtime/theme/calendar.d.ts +2 -2
- package/dist/runtime/theme/chip.d.ts +11 -44
- package/dist/runtime/theme/drawer.d.ts +68 -33
- package/dist/runtime/theme/dropdown-menu.d.ts +71 -0
- package/dist/runtime/theme/dropdown-menu.js +83 -0
- package/dist/runtime/theme/form-item.d.ts +76 -0
- package/dist/runtime/theme/form-item.js +34 -0
- package/dist/runtime/theme/form.d.ts +8 -0
- package/dist/runtime/theme/form.js +7 -0
- package/dist/runtime/theme/index.d.ts +3 -0
- package/dist/runtime/theme/index.js +3 -0
- package/dist/runtime/theme/input-number.d.ts +41 -61
- package/dist/runtime/theme/input.d.ts +99 -71
- package/dist/runtime/theme/input.js +2 -2
- package/dist/runtime/theme/modal.d.ts +5 -33
- package/dist/runtime/theme/pinInput.d.ts +42 -42
- package/dist/runtime/theme/pinInput.js +1 -1
- package/dist/runtime/theme/progress.d.ts +117 -53
- package/dist/runtime/theme/select.d.ts +100 -84
- package/dist/runtime/theme/select.js +2 -1
- package/dist/runtime/theme/separator.d.ts +13 -28
- package/dist/runtime/theme/table.d.ts +3 -0
- package/dist/runtime/theme/table.js +2 -1
- package/dist/runtime/theme/tabs.d.ts +51 -68
- package/dist/runtime/theme/textarea.d.ts +37 -43
- package/dist/runtime/theme/textarea.js +1 -1
- package/dist/runtime/theme/toast-provider.d.ts +26 -41
- package/dist/runtime/types/components.d.ts +3 -0
- package/dist/runtime/types/form.d.ts +45 -0
- package/dist/runtime/types/form.js +0 -0
- package/dist/runtime/types/index.d.ts +5 -2
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/utils.d.ts +32 -11
- package/dist/runtime/utils/extend-theme.js +15 -4
- package/dist/runtime/utils/form.d.ts +5 -0
- package/dist/runtime/utils/form.js +24 -0
- package/dist/runtime/utils/index.d.ts +2 -0
- package/dist/runtime/utils/index.js +4 -0
- package/dist/runtime/utils/link.d.ts +4 -26
- package/dist/runtime/utils/link.js +10 -3
- package/dist/shared/ui.3e7fad19.mjs +5 -0
- package/dist/shared/ui.3e7fad19.mjs.map +1 -0
- package/dist/unocss.mjs +2 -2
- package/dist/unocss.mjs.map +1 -1
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +16 -14
- package/dist/shared/ui.1a1f119c.mjs +0 -5
- package/dist/shared/ui.1a1f119c.mjs.map +0 -1
|
@@ -73,78 +73,61 @@ declare const _default: {
|
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
|
-
compoundVariants:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
};
|
|
83
|
-
outline: {
|
|
84
|
-
list: string;
|
|
85
|
-
trigger: string[];
|
|
86
|
-
indicator: string;
|
|
87
|
-
};
|
|
88
|
-
soft: {
|
|
89
|
-
list: string;
|
|
90
|
-
trigger: string[];
|
|
91
|
-
indicator: string;
|
|
92
|
-
};
|
|
93
|
-
'soft-outline': {
|
|
94
|
-
list: string;
|
|
95
|
-
trigger: string[];
|
|
96
|
-
indicator: string;
|
|
97
|
-
};
|
|
98
|
-
link: {
|
|
99
|
-
list: string;
|
|
100
|
-
indicator: string;
|
|
101
|
-
trigger: string[];
|
|
102
|
-
};
|
|
76
|
+
compoundVariants: ({
|
|
77
|
+
size: ("xs" | "sm" | "md")[];
|
|
78
|
+
class: {
|
|
79
|
+
trigger: string;
|
|
80
|
+
indicator?: undefined;
|
|
81
|
+
list?: undefined;
|
|
103
82
|
};
|
|
104
|
-
orientation
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
list: string;
|
|
113
|
-
indicator: string;
|
|
114
|
-
trigger: string;
|
|
115
|
-
};
|
|
83
|
+
orientation?: undefined;
|
|
84
|
+
variant?: undefined;
|
|
85
|
+
} | {
|
|
86
|
+
size: ("lg" | "xl")[];
|
|
87
|
+
class: {
|
|
88
|
+
trigger: string;
|
|
89
|
+
indicator?: undefined;
|
|
90
|
+
list?: undefined;
|
|
116
91
|
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
};
|
|
127
|
-
lg: {
|
|
128
|
-
root: string;
|
|
129
|
-
};
|
|
130
|
-
xl: {
|
|
131
|
-
root: string;
|
|
132
|
-
};
|
|
92
|
+
orientation?: undefined;
|
|
93
|
+
variant?: undefined;
|
|
94
|
+
} | {
|
|
95
|
+
orientation: "horizontal";
|
|
96
|
+
variant: ("solid" | "outline" | "soft" | "soft-outline")[];
|
|
97
|
+
class: {
|
|
98
|
+
indicator: string;
|
|
99
|
+
trigger?: undefined;
|
|
100
|
+
list?: undefined;
|
|
133
101
|
};
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
102
|
+
size?: undefined;
|
|
103
|
+
} | {
|
|
104
|
+
orientation: "horizontal";
|
|
105
|
+
variant: "link";
|
|
106
|
+
class: {
|
|
107
|
+
list: string;
|
|
108
|
+
indicator: string;
|
|
109
|
+
trigger?: undefined;
|
|
138
110
|
};
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
111
|
+
size?: undefined;
|
|
112
|
+
} | {
|
|
113
|
+
orientation: "vertical";
|
|
114
|
+
variant: ("solid" | "outline" | "soft" | "soft-outline")[];
|
|
115
|
+
class: {
|
|
116
|
+
indicator: string;
|
|
117
|
+
list: string;
|
|
118
|
+
trigger?: undefined;
|
|
119
|
+
};
|
|
120
|
+
size?: undefined;
|
|
121
|
+
} | {
|
|
122
|
+
orientation: "vertical";
|
|
123
|
+
variant: "link";
|
|
124
|
+
class: {
|
|
125
|
+
list: string;
|
|
126
|
+
indicator: string;
|
|
127
|
+
trigger?: undefined;
|
|
128
|
+
};
|
|
129
|
+
size?: undefined;
|
|
130
|
+
})[];
|
|
148
131
|
defaultVariants: {
|
|
149
132
|
size: "md";
|
|
150
133
|
};
|
|
@@ -48,53 +48,47 @@ declare const _default: {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
|
-
compoundVariants:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
root: string;
|
|
58
|
-
};
|
|
59
|
-
md: {
|
|
60
|
-
root: string;
|
|
61
|
-
};
|
|
62
|
-
lg: {
|
|
63
|
-
root: string;
|
|
64
|
-
};
|
|
65
|
-
xl: {
|
|
66
|
-
root: string;
|
|
67
|
-
};
|
|
51
|
+
compoundVariants: ({
|
|
52
|
+
variant: ("soft" | "ghost" | "none")[];
|
|
53
|
+
highlight: false;
|
|
54
|
+
underline: true;
|
|
55
|
+
class: {
|
|
56
|
+
root: string[];
|
|
68
57
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
root: string[];
|
|
75
|
-
};
|
|
76
|
-
'soft-outline': {
|
|
77
|
-
root: string[];
|
|
78
|
-
};
|
|
79
|
-
ghost: {
|
|
80
|
-
root: string[];
|
|
81
|
-
};
|
|
82
|
-
none: {
|
|
83
|
-
root: string;
|
|
84
|
-
};
|
|
58
|
+
size?: undefined;
|
|
59
|
+
} | {
|
|
60
|
+
size: ("xs" | "sm" | "md")[];
|
|
61
|
+
class: {
|
|
62
|
+
root: string;
|
|
85
63
|
};
|
|
86
|
-
|
|
87
|
-
|
|
64
|
+
variant?: undefined;
|
|
65
|
+
highlight?: undefined;
|
|
66
|
+
underline?: undefined;
|
|
67
|
+
} | {
|
|
68
|
+
size: ("lg" | "xl")[];
|
|
69
|
+
class: {
|
|
70
|
+
root: string;
|
|
88
71
|
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
72
|
+
variant?: undefined;
|
|
73
|
+
highlight?: undefined;
|
|
74
|
+
underline?: undefined;
|
|
75
|
+
} | {
|
|
76
|
+
variant: ("soft" | "soft-outline" | "ghost" | "none")[];
|
|
77
|
+
highlight: true;
|
|
78
|
+
class: {
|
|
79
|
+
root: string;
|
|
93
80
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
81
|
+
underline?: undefined;
|
|
82
|
+
size?: undefined;
|
|
83
|
+
} | {
|
|
84
|
+
variant: "outline"[];
|
|
85
|
+
highlight: true;
|
|
86
|
+
class: {
|
|
87
|
+
root: string;
|
|
88
|
+
};
|
|
89
|
+
underline?: undefined;
|
|
90
|
+
size?: undefined;
|
|
91
|
+
})[];
|
|
98
92
|
defaultVariants: {
|
|
99
93
|
size: "md";
|
|
100
94
|
};
|
|
@@ -33,7 +33,7 @@ export default ct(
|
|
|
33
33
|
root: [
|
|
34
34
|
"color-ui-base/80 bg-ui-base ring ring-inset ring-ui-base/30",
|
|
35
35
|
"focus-within:ring-2 focus-within:ring-ui-base/50",
|
|
36
|
-
"aria-disabled:ring-ui-base/
|
|
36
|
+
"aria-disabled:ring-ui-base/15 hover:aria-disabled:ring-ui-base/15"
|
|
37
37
|
]
|
|
38
38
|
},
|
|
39
39
|
"soft": {
|
|
@@ -45,50 +45,35 @@ declare const _default: {
|
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
|
-
compoundVariants:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
compoundVariants: ({
|
|
49
|
+
position: ("top-right" | "top-left" | "top-center")[];
|
|
50
|
+
class: {
|
|
51
|
+
viewport: string;
|
|
52
|
+
base: string;
|
|
53
53
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
'top-right': {
|
|
62
|
-
viewport: string;
|
|
63
|
-
};
|
|
64
|
-
'bottom-left': {
|
|
65
|
-
viewport: string;
|
|
66
|
-
};
|
|
67
|
-
'bottom-center': {
|
|
68
|
-
viewport: string;
|
|
69
|
-
};
|
|
70
|
-
'bottom-right': {
|
|
71
|
-
viewport: string;
|
|
72
|
-
};
|
|
54
|
+
swipeDirection?: undefined;
|
|
55
|
+
} | {
|
|
56
|
+
position: ("bottom-right" | "bottom-left" | "bottom-center")[];
|
|
57
|
+
class: {
|
|
58
|
+
viewport: string;
|
|
59
|
+
base: string;
|
|
73
60
|
};
|
|
74
|
-
swipeDirection
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
81
|
-
down: {
|
|
82
|
-
base: string;
|
|
83
|
-
};
|
|
84
|
-
left: {
|
|
85
|
-
base: string;
|
|
86
|
-
};
|
|
61
|
+
swipeDirection?: undefined;
|
|
62
|
+
} | {
|
|
63
|
+
swipeDirection: ("left" | "right")[];
|
|
64
|
+
class: {
|
|
65
|
+
base: string[];
|
|
66
|
+
viewport?: undefined;
|
|
87
67
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
68
|
+
position?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
swipeDirection: ("up" | "down")[];
|
|
71
|
+
class: {
|
|
72
|
+
base: string[];
|
|
73
|
+
viewport?: undefined;
|
|
74
|
+
};
|
|
75
|
+
position?: undefined;
|
|
76
|
+
})[];
|
|
92
77
|
defaultVariants: import("@byyuurin/ui-kit").CVDefaultVariants<{
|
|
93
78
|
clickable: {
|
|
94
79
|
true: {
|
|
@@ -14,6 +14,9 @@ export type * from '../components/Checkbox.vue';
|
|
|
14
14
|
export type * from '../components/Chip.vue';
|
|
15
15
|
export type * from '../components/Collapsible.vue';
|
|
16
16
|
export type * from '../components/Drawer.vue';
|
|
17
|
+
export type * from '../components/DropdownMenu.vue';
|
|
18
|
+
export type * from '../components/Form.vue';
|
|
19
|
+
export type * from '../components/FormItem.vue';
|
|
17
20
|
export type * from '../components/Input.vue';
|
|
18
21
|
export type * from '../components/InputNumber.vue';
|
|
19
22
|
export type * from '../components/Kbd.vue';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
import type { FormExpose } from './components.js';
|
|
3
|
+
export type FormSchema<_T> = StandardSchemaV1;
|
|
4
|
+
export interface FormError<P extends string = string> {
|
|
5
|
+
name?: P;
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
export interface FormErrorWithId extends FormError {
|
|
9
|
+
id?: string;
|
|
10
|
+
}
|
|
11
|
+
export type FormInputEvents = 'input' | 'blur' | 'change' | 'focus';
|
|
12
|
+
export type FormEventType = FormInputEvents;
|
|
13
|
+
export type FormSubmitEvent<T> = SubmitEvent & {
|
|
14
|
+
data: T;
|
|
15
|
+
};
|
|
16
|
+
export interface FormChildAttachEvent {
|
|
17
|
+
type: 'attach';
|
|
18
|
+
formId: string | number;
|
|
19
|
+
validate: FormExpose<any>['validate'];
|
|
20
|
+
}
|
|
21
|
+
export interface FormChildDetachEvent {
|
|
22
|
+
type: 'detach';
|
|
23
|
+
formId: string | number;
|
|
24
|
+
}
|
|
25
|
+
export interface FormInputEvent<T extends object> {
|
|
26
|
+
type: FormEventType;
|
|
27
|
+
name: keyof T;
|
|
28
|
+
eager?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export type FormEvent<T extends object> = FormInputEvent<T> | FormChildAttachEvent | FormChildDetachEvent;
|
|
31
|
+
export interface FormValidationError {
|
|
32
|
+
errors: FormErrorWithId[];
|
|
33
|
+
children?: FormValidationError[];
|
|
34
|
+
}
|
|
35
|
+
export type FormErrorEvent = SubmitEvent & FormValidationError;
|
|
36
|
+
export interface ValidateReturnSchema<T> {
|
|
37
|
+
result: T;
|
|
38
|
+
errors: FormError[] | null;
|
|
39
|
+
}
|
|
40
|
+
export interface FormValidateOptions<T extends object> {
|
|
41
|
+
name?: keyof T | (keyof T)[];
|
|
42
|
+
silent?: boolean;
|
|
43
|
+
nested?: boolean;
|
|
44
|
+
transform?: boolean;
|
|
45
|
+
}
|
|
File without changes
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type * as theme from '../theme/index.js';
|
|
2
|
-
import type { PartialTheme } from './utils.js';
|
|
3
2
|
export * from './components.js';
|
|
3
|
+
export * from './form.js';
|
|
4
4
|
export * from './locale.js';
|
|
5
5
|
export * from './utils.js';
|
|
6
|
-
|
|
6
|
+
type MergeThemes<T> = {
|
|
7
|
+
[P in keyof T as T[P] extends undefined ? never : P]?: T[P] extends Array<infer V> ? V extends string ? string : V[] : T[P] extends object ? MergeThemes<T[P]> : T[P] extends string ? string : T[P];
|
|
8
|
+
};
|
|
9
|
+
export type ThemeExtension = MergeThemes<typeof theme>;
|
|
@@ -1,14 +1,39 @@
|
|
|
1
1
|
import type { ClassValue, CTReturn, CVReturnType, VariantProps } from '@byyuurin/ui-kit';
|
|
2
|
-
|
|
2
|
+
import type { AcceptableValue as RekaAcceptableValue } from 'reka-ui';
|
|
3
3
|
export type MaybeArray<T> = T | T[];
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export type AcceptableValue = Exclude<RekaAcceptableValue, Record<string, any>>;
|
|
5
|
+
export type EmitsToProps<T> = {
|
|
6
|
+
[K in keyof T as `on${Capitalize<string & K>}`]: T[K] extends [...args: infer Args] ? (...args: Args) => void : never;
|
|
7
|
+
};
|
|
8
|
+
type AllKeys<T> = T extends any ? keyof T : never;
|
|
9
|
+
type NonCommonKeys<T extends object> = Exclude<AllKeys<T>, keyof T>;
|
|
10
|
+
type PickTypeOf<T, K extends string | number | symbol> = K extends AllKeys<T> ? T extends {
|
|
11
|
+
[k in K]?: any;
|
|
12
|
+
} ? T[K] : undefined : never;
|
|
13
|
+
export type MergeTypes<T extends object> = {
|
|
14
|
+
[TK in keyof T]: PickTypeOf<T, TK>;
|
|
15
|
+
} & {
|
|
16
|
+
[TK in NonCommonKeys<T>]?: PickTypeOf<T, TK>;
|
|
8
17
|
};
|
|
9
18
|
export type DynamicSlots<T extends {
|
|
10
19
|
slot?: string;
|
|
11
|
-
},
|
|
20
|
+
}, SlotExtra extends string | undefined = undefined, SlotProps extends object = Record<string, never>> = {
|
|
21
|
+
[K in T['slot'] as K extends string ? SlotExtra extends string ? (K | `${K}-${SlotExtra}`) : K : never]?: (props: {
|
|
22
|
+
item: Extract<T, {
|
|
23
|
+
slot: K extends `${infer Base}-${SlotExtra}` ? Base : K;
|
|
24
|
+
}>;
|
|
25
|
+
} & Omit<SlotProps, 'item'>) => any;
|
|
26
|
+
};
|
|
27
|
+
export type ArrayOrNested<T> = T[] | T[][];
|
|
28
|
+
export type NestedItem<T> = T extends Array<infer I> ? NestedItem<I> : T;
|
|
29
|
+
export type GetItemKeys<T> = keyof Extract<NestedItem<T>, object>;
|
|
30
|
+
export type GetItemValue<I, VK extends GetItemKeys<I> | undefined, T extends NestedItem<I> = NestedItem<I>> = T extends object ? VK extends undefined ? T : VK extends keyof T ? T[VK] : never : T;
|
|
31
|
+
export type GetModelValue<T, VK extends GetItemKeys<T> | undefined, M extends boolean> = M extends true ? GetItemValue<T, VK>[] : GetItemValue<T, VK>;
|
|
32
|
+
export interface GetModelValueEmits<T, VK extends GetItemKeys<T> | undefined, M extends boolean> {
|
|
33
|
+
/** Event handler called when the value changes. */
|
|
34
|
+
'update:modelValue': [payload: GetModelValue<T, VK, M>];
|
|
35
|
+
}
|
|
36
|
+
export type GetObjectField<MaybeObject, Key extends string> = MaybeObject extends Record<string, any> ? MaybeObject[Key] : never;
|
|
12
37
|
export interface ComponentAttrs<T> {
|
|
13
38
|
class?: MaybeArray<string | Record<string, boolean>>;
|
|
14
39
|
ui?: T extends {
|
|
@@ -24,8 +49,4 @@ export interface StylerBaseProps {
|
|
|
24
49
|
export type StylerProps<T> = T extends CTReturn<infer V, any, any, infer B, infer S> ? Parameters<Styler<CVReturnType<V, S, B>>>[0] : never;
|
|
25
50
|
export type StylerReturnType<T> = T extends CVReturnType<infer V, infer S, infer B> ? ReturnType<CVReturnType<V, S, B>> : never;
|
|
26
51
|
export type Styler<T> = T extends CVReturnType<infer V, any, any> ? [keyof V] extends string[] ? (props: VariantProps<T> & StylerBaseProps) => StylerReturnType<T> : (props?: StylerBaseProps) => StylerReturnType<T> : never;
|
|
27
|
-
export
|
|
28
|
-
(event: 'update:modelValue', payload: SelectModelValue<T, V, M, DV>): void;
|
|
29
|
-
}
|
|
30
|
-
export type SelectModelValue<T, V, M extends boolean = false, DV = T> = (T extends Record<string, any> ? V extends keyof T ? T[V] : DV : T) extends infer U ? M extends true ? U[] : U : never;
|
|
31
|
-
export type SelectOptionKey<T> = T extends Record<string, any> ? keyof T : string;
|
|
52
|
+
export {};
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import { createDefu } from "defu";
|
|
1
|
+
import { createDefu, defu } from "defu";
|
|
2
2
|
export const extendTheme = createDefu((obj, key, value) => {
|
|
3
|
+
if (typeof obj[key] === "string" && typeof value !== "string") {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
if (key === "compoundVariants" && Array.isArray(value)) {
|
|
7
|
+
obj[key] = [...obj[key], ...value];
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
if (Array.isArray(value)) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
3
13
|
if (key === "app") {
|
|
4
|
-
obj[key] =
|
|
14
|
+
obj[key] = defu(value, obj[key]);
|
|
5
15
|
return true;
|
|
6
16
|
}
|
|
7
17
|
if (typeof obj[key] === "string" && typeof value === "string") {
|
|
@@ -9,8 +19,9 @@ export const extendTheme = createDefu((obj, key, value) => {
|
|
|
9
19
|
obj[key] += ` ${value}`;
|
|
10
20
|
return true;
|
|
11
21
|
}
|
|
12
|
-
if (Array.isArray(obj[key]) && typeof value === "string") {
|
|
13
|
-
|
|
22
|
+
if (Array.isArray(obj[key]) && typeof obj[key][0] === "string" && typeof value === "string") {
|
|
23
|
+
if (value.trim())
|
|
24
|
+
obj[key].push(value);
|
|
14
25
|
return true;
|
|
15
26
|
}
|
|
16
27
|
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
import type { FormSchema, ValidateReturnSchema } from '../types/form.js';
|
|
3
|
+
export declare function isStandardSchema(schema: any): schema is StandardSchemaV1;
|
|
4
|
+
export declare function validateStandardSchema(state: any, schema: StandardSchemaV1): Promise<ValidateReturnSchema<typeof state>>;
|
|
5
|
+
export declare function validateSchema<T extends object>(state: T, schema: FormSchema<T>): Promise<ValidateReturnSchema<typeof state>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function isStandardSchema(schema) {
|
|
2
|
+
return "~standard" in schema;
|
|
3
|
+
}
|
|
4
|
+
export async function validateStandardSchema(state, schema) {
|
|
5
|
+
const result = await schema["~standard"].validate(state);
|
|
6
|
+
if (result.issues) {
|
|
7
|
+
return {
|
|
8
|
+
errors: result.issues?.map((issue) => ({
|
|
9
|
+
name: issue.path?.map((item) => typeof item === "object" ? item.key : item).join(".") || "",
|
|
10
|
+
message: issue.message
|
|
11
|
+
})) || [],
|
|
12
|
+
result: null
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
errors: null,
|
|
17
|
+
result: result.value
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function validateSchema(state, schema) {
|
|
21
|
+
if (isStandardSchema(schema))
|
|
22
|
+
return validateStandardSchema(state, schema);
|
|
23
|
+
throw new Error("Form validation failed: Unsupported form schema");
|
|
24
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Messages } from '../types/index.js';
|
|
2
2
|
import type { Locale } from './translator.js';
|
|
3
3
|
export * from './extend-theme.js';
|
|
4
|
+
export * from './form.js';
|
|
4
5
|
export * from './link.js';
|
|
5
6
|
export * from './styler.js';
|
|
6
7
|
export * from './translator.js';
|
|
@@ -12,3 +13,4 @@ export declare function omit<Data extends object, Keys extends keyof Data>(data:
|
|
|
12
13
|
export declare function get(object: Record<string, any> | undefined, path: (string | number)[] | string, defaultValue?: any): any;
|
|
13
14
|
export declare function set(object: Record<string, any>, path: (string | number)[] | string, value: any): void;
|
|
14
15
|
export declare function compare<T>(value?: T, currentValue?: T, comparator?: string | ((a: T, b: T) => boolean)): boolean;
|
|
16
|
+
export declare function isArrayOfArray<T>(item: T[] | T[][]): item is T[][];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isEqual } from "ohash";
|
|
2
2
|
export * from "./extend-theme.js";
|
|
3
|
+
export * from "./form.js";
|
|
3
4
|
export * from "./link.js";
|
|
4
5
|
export * from "./styler.js";
|
|
5
6
|
export * from "./translator.js";
|
|
@@ -61,3 +62,6 @@ export function compare(value, currentValue, comparator) {
|
|
|
61
62
|
return get(value, comparator) === get(currentValue, comparator);
|
|
62
63
|
return isEqual(value, currentValue);
|
|
63
64
|
}
|
|
65
|
+
export function isArrayOfArray(item) {
|
|
66
|
+
return Array.isArray(item[0]);
|
|
67
|
+
}
|
|
@@ -1,30 +1,8 @@
|
|
|
1
1
|
import type { LinkProps } from '../types/index.js';
|
|
2
2
|
export declare function pickLinkProps(link: LinkProps & {
|
|
3
|
-
|
|
4
|
-
title?: string;
|
|
3
|
+
[key: string]: any;
|
|
5
4
|
}): {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
to: any;
|
|
10
|
-
type: any;
|
|
11
|
-
replace: any;
|
|
12
|
-
activeClass: any;
|
|
13
|
-
ariaCurrentValue: any;
|
|
14
|
-
ariaLabel: any;
|
|
15
|
-
as: any;
|
|
16
|
-
disableClass: any;
|
|
17
|
-
exact: any;
|
|
18
|
-
exactActiveClass: any;
|
|
19
|
-
exactHash: any;
|
|
20
|
-
exactQuery: any;
|
|
21
|
-
external: any;
|
|
22
|
-
href: any;
|
|
23
|
-
inactiveClass: any;
|
|
24
|
-
noPrefetch: any;
|
|
25
|
-
noRel: any;
|
|
26
|
-
prefetch: any;
|
|
27
|
-
prefetchedClass: any;
|
|
28
|
-
rel: any;
|
|
29
|
-
target: any;
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
[x: number]: any;
|
|
7
|
+
[x: symbol]: any;
|
|
30
8
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { reactivePick } from "@vueuse/core";
|
|
2
2
|
export function pickLinkProps(link) {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const keys = Object.keys(link);
|
|
4
|
+
const ariaKeys = keys.filter((key) => key.startsWith("aria-"));
|
|
5
|
+
const dataKeys = keys.filter((key) => key.startsWith("data-"));
|
|
6
|
+
const pickProps = [
|
|
5
7
|
"active",
|
|
6
8
|
"activeClass",
|
|
7
9
|
"ariaCurrentValue",
|
|
8
|
-
"ariaLabel",
|
|
9
10
|
"as",
|
|
10
11
|
"disabled",
|
|
11
12
|
"disableClass",
|
|
@@ -26,5 +27,11 @@ export function pickLinkProps(link) {
|
|
|
26
27
|
"to",
|
|
27
28
|
"type",
|
|
28
29
|
"title"
|
|
30
|
+
];
|
|
31
|
+
return reactivePick(
|
|
32
|
+
link,
|
|
33
|
+
...pickProps,
|
|
34
|
+
...ariaKeys,
|
|
35
|
+
...dataKeys
|
|
29
36
|
);
|
|
30
37
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.3e7fad19.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
package/dist/unocss.mjs
CHANGED
|
@@ -230,7 +230,7 @@ function transformUnoRules(userConfig = {}) {
|
|
|
230
230
|
};
|
|
231
231
|
for (const rule of rules) {
|
|
232
232
|
const [maybeString, maybeResult] = rule;
|
|
233
|
-
const ruleRE = typeof maybeString === "string" ? new RegExp(
|
|
233
|
+
const ruleRE = typeof maybeString === "string" ? new RegExp(`^(?:${maybeString})$`) : maybeString;
|
|
234
234
|
if (Array.isArray(maybeResult)) {
|
|
235
235
|
mergeRules.push([ruleRE, resolveCSSEntries(maybeResult)]);
|
|
236
236
|
continue;
|
|
@@ -257,7 +257,7 @@ function transformUnoRules(userConfig = {}) {
|
|
|
257
257
|
};
|
|
258
258
|
mergeRules.push([ruleRE, matcher]);
|
|
259
259
|
}
|
|
260
|
-
return mergeRules;
|
|
260
|
+
return mergeRules.sort(([r1], [r2]) => r2.source.length - r1.source.length);
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
export { cssColor, cssVar, cssVarsAll, cssVarsBase, cssVarsDynamic, cssVarsPrefix, preset, rules, theme, transformUnoRules };
|