@nuxt/ui 2.13.0 → 2.14.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/README.md +8 -8
- package/dist/module.d.mts +61 -2
- package/dist/module.d.ts +61 -2
- package/dist/module.json +2 -2
- package/dist/module.mjs +131 -144
- package/dist/runtime/components/data/Table.vue +16 -4
- package/dist/runtime/components/data/Table.vue.d.ts +21 -3
- package/dist/runtime/components/elements/Accordion.vue +11 -2
- package/dist/runtime/components/elements/Accordion.vue.d.ts +1 -1
- package/dist/runtime/components/elements/Alert.vue +2 -2
- package/dist/runtime/components/elements/Alert.vue.d.ts +4 -3
- package/dist/runtime/components/elements/Avatar.vue.d.ts +1 -1
- package/dist/runtime/components/elements/AvatarGroup.d.ts +1 -1
- package/dist/runtime/components/elements/Badge.vue.d.ts +2 -2
- package/dist/runtime/components/elements/Button.vue.d.ts +63 -37
- package/dist/runtime/components/elements/ButtonGroup.d.ts +1 -1
- package/dist/runtime/components/elements/Carousel.vue +19 -12
- package/dist/runtime/components/elements/Carousel.vue.d.ts +4 -4
- package/dist/runtime/components/elements/Chip.vue.d.ts +2 -2
- package/dist/runtime/components/elements/Dropdown.vue +3 -1
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +3 -3
- package/dist/runtime/components/elements/Icon.vue.d.ts +1 -1
- package/dist/runtime/components/elements/Kbd.vue.d.ts +1 -1
- package/dist/runtime/components/elements/Link.vue +1 -1
- package/dist/runtime/components/elements/Link.vue.d.ts +62 -36
- package/dist/runtime/components/elements/Meter.vue +4 -0
- package/dist/runtime/components/elements/Meter.vue.d.ts +1 -1
- package/dist/runtime/components/elements/MeterGroup.d.ts +1 -1
- package/dist/runtime/components/elements/Progress.vue +4 -1
- package/dist/runtime/components/elements/Progress.vue.d.ts +5 -5
- package/dist/runtime/components/forms/Checkbox.vue +1 -6
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +6 -15
- package/dist/runtime/components/forms/Form.vue +6 -3
- package/dist/runtime/components/forms/Form.vue.d.ts +1 -1
- package/dist/runtime/components/forms/FormGroup.vue +20 -17
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +2 -2
- package/dist/runtime/components/forms/Input.vue +1 -0
- package/dist/runtime/components/forms/Input.vue.d.ts +6 -6
- package/dist/runtime/components/forms/InputMenu.vue +4 -1
- package/dist/runtime/components/forms/InputMenu.vue.d.ts +7 -7
- package/dist/runtime/components/forms/Radio.vue +5 -11
- package/dist/runtime/components/forms/Radio.vue.d.ts +6 -6
- package/dist/runtime/components/forms/RadioGroup.vue +1 -0
- package/dist/runtime/components/forms/RadioGroup.vue.d.ts +4 -4
- package/dist/runtime/components/forms/Range.vue.d.ts +4 -4
- package/dist/runtime/components/forms/Select.vue.d.ts +6 -6
- package/dist/runtime/components/forms/SelectMenu.vue +4 -1
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +7 -7
- package/dist/runtime/components/forms/Textarea.vue +5 -1
- package/dist/runtime/components/forms/Textarea.vue.d.ts +15 -6
- package/dist/runtime/components/forms/Toggle.vue +3 -1
- package/dist/runtime/components/forms/Toggle.vue.d.ts +4 -4
- package/dist/runtime/components/layout/Card.vue +1 -1
- package/dist/runtime/components/layout/Card.vue.d.ts +1 -1
- package/dist/runtime/components/layout/Container.vue.d.ts +1 -1
- package/dist/runtime/components/layout/Divider.vue +8 -1
- package/dist/runtime/components/layout/Divider.vue.d.ts +15 -4
- package/dist/runtime/components/layout/Skeleton.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/CommandPalette.vue +3 -1
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +2 -2
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue +3 -1
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/HorizontalNavigation.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/Tabs.vue +8 -8
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +10 -1
- package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +3 -3
- package/dist/runtime/components/overlays/Modal.vue +3 -1
- package/dist/runtime/components/overlays/Modal.vue.d.ts +5 -5
- package/dist/runtime/components/overlays/Modals.client.vue +12 -0
- package/dist/runtime/components/overlays/Notification.vue +2 -2
- package/dist/runtime/components/overlays/Notification.vue.d.ts +4 -3
- package/dist/runtime/components/overlays/Notifications.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/Popover.vue +3 -1
- package/dist/runtime/components/overlays/Popover.vue.d.ts +3 -3
- package/dist/runtime/components/overlays/Slideover.vue +3 -1
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +5 -5
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +2 -2
- package/dist/runtime/composables/useFormGroup.d.ts +1 -1
- package/dist/runtime/composables/useFormGroup.mjs +9 -12
- package/dist/runtime/composables/useModal.d.ts +12 -0
- package/dist/runtime/composables/useModal.mjs +37 -0
- package/dist/runtime/plugins/modals.d.ts +2 -0
- package/dist/runtime/plugins/modals.mjs +10 -0
- package/dist/runtime/types/component.d.ts +14 -0
- package/dist/runtime/types/divider.d.ts +3 -0
- package/dist/runtime/types/form.d.ts +2 -1
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/types/modal.d.ts +18 -0
- package/dist/runtime/types/progress.d.ts +2 -0
- package/dist/runtime/types/range.d.ts +2 -0
- package/dist/runtime/types/toggle.d.ts +2 -0
- package/dist/runtime/ui.config/data/table.d.ts +7 -0
- package/dist/runtime/ui.config/data/table.mjs +10 -3
- package/dist/runtime/ui.config/elements/accordion.d.ts +1 -0
- package/dist/runtime/ui.config/elements/accordion.mjs +1 -0
- package/dist/runtime/ui.config/forms/formGroup.d.ts +1 -0
- package/dist/runtime/ui.config/forms/formGroup.mjs +1 -0
- package/dist/runtime/ui.config/forms/input.d.ts +11 -0
- package/dist/runtime/ui.config/forms/input.mjs +11 -0
- package/dist/runtime/ui.config/forms/select.d.ts +11 -0
- package/dist/runtime/ui.config/forms/textarea.d.ts +11 -0
- package/dist/runtime/ui.config/layout/divider.d.ts +19 -2
- package/dist/runtime/ui.config/layout/divider.mjs +20 -3
- package/dist/runtime/utils/colors.d.ts +3 -0
- package/dist/runtime/utils/colors.mjs +261 -0
- package/dist/runtime/utils/index.mjs +9 -0
- package/dist/runtime/utils/link.d.ts +24 -11
- package/dist/runtime/utils/link.mjs +26 -13
- package/package.json +21 -19
- package/dist/runtime/utils/uid.d.ts +0 -1
- package/dist/runtime/utils/uid.mjs +0 -5
|
@@ -2,7 +2,7 @@ export default {
|
|
|
2
2
|
wrapper: "relative overflow-x-auto",
|
|
3
3
|
base: "min-w-full table-fixed",
|
|
4
4
|
divide: "divide-y divide-gray-300 dark:divide-gray-700",
|
|
5
|
-
thead: "",
|
|
5
|
+
thead: "relative",
|
|
6
6
|
tbody: "divide-y divide-gray-200 dark:divide-gray-800",
|
|
7
7
|
tr: {
|
|
8
8
|
base: "",
|
|
@@ -11,14 +11,14 @@ export default {
|
|
|
11
11
|
},
|
|
12
12
|
th: {
|
|
13
13
|
base: "text-left rtl:text-right",
|
|
14
|
-
padding: "px-
|
|
14
|
+
padding: "px-4 py-3.5",
|
|
15
15
|
color: "text-gray-900 dark:text-white",
|
|
16
16
|
font: "font-semibold",
|
|
17
17
|
size: "text-sm"
|
|
18
18
|
},
|
|
19
19
|
td: {
|
|
20
20
|
base: "whitespace-nowrap",
|
|
21
|
-
padding: "px-
|
|
21
|
+
padding: "px-4 py-4",
|
|
22
22
|
color: "text-gray-500 dark:text-gray-400",
|
|
23
23
|
font: "",
|
|
24
24
|
size: "text-sm"
|
|
@@ -36,6 +36,9 @@ export default {
|
|
|
36
36
|
label: "text-sm text-center text-gray-900 dark:text-white",
|
|
37
37
|
icon: "w-6 h-6 mx-auto text-gray-400 dark:text-gray-500 mb-4"
|
|
38
38
|
},
|
|
39
|
+
progress: {
|
|
40
|
+
wrapper: "absolute inset-x-0 -bottom-[0.5px] p-0"
|
|
41
|
+
},
|
|
39
42
|
default: {
|
|
40
43
|
sortAscIcon: "i-heroicons-bars-arrow-up-20-solid",
|
|
41
44
|
sortDescIcon: "i-heroicons-bars-arrow-down-20-solid",
|
|
@@ -47,6 +50,10 @@ export default {
|
|
|
47
50
|
variant: "ghost",
|
|
48
51
|
class: "-m-1.5"
|
|
49
52
|
},
|
|
53
|
+
progress: {
|
|
54
|
+
color: "primary",
|
|
55
|
+
animation: "carousel"
|
|
56
|
+
},
|
|
50
57
|
loadingState: {
|
|
51
58
|
icon: "i-heroicons-arrow-path-20-solid",
|
|
52
59
|
label: "Loading..."
|
|
@@ -4,6 +4,17 @@ declare const _default: {
|
|
|
4
4
|
form: string;
|
|
5
5
|
rounded: string;
|
|
6
6
|
placeholder: string;
|
|
7
|
+
file: {
|
|
8
|
+
base: string;
|
|
9
|
+
padding: {
|
|
10
|
+
'2xs': string;
|
|
11
|
+
xs: string;
|
|
12
|
+
sm: string;
|
|
13
|
+
md: string;
|
|
14
|
+
lg: string;
|
|
15
|
+
xl: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
7
18
|
size: {
|
|
8
19
|
'2xs': string;
|
|
9
20
|
xs: string;
|
|
@@ -4,6 +4,17 @@ export default {
|
|
|
4
4
|
form: "form-input",
|
|
5
5
|
rounded: "rounded-md",
|
|
6
6
|
placeholder: "placeholder-gray-400 dark:placeholder-gray-500",
|
|
7
|
+
file: {
|
|
8
|
+
base: "file:cursor-pointer file:rounded-l-md file:absolute file:left-0 file:inset-y-0 file:font-medium file:m-0 file:border-0 file:ring-1 file:ring-gray-300 dark:file:ring-gray-700 file:text-gray-900 dark:file:text-white file:bg-gray-50 hover:file:bg-gray-100 dark:file:bg-gray-800 dark:hover:file:bg-gray-700/50",
|
|
9
|
+
padding: {
|
|
10
|
+
"2xs": "ps-[85px]",
|
|
11
|
+
xs: "ps-[87px]",
|
|
12
|
+
sm: "ps-[96px]",
|
|
13
|
+
md: "ps-[98px]",
|
|
14
|
+
lg: "ps-[100px]",
|
|
15
|
+
xl: "ps-[109px]"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
7
18
|
size: {
|
|
8
19
|
"2xs": "text-xs",
|
|
9
20
|
xs: "text-xs",
|
|
@@ -11,6 +11,17 @@ declare const _default: {
|
|
|
11
11
|
wrapper: string;
|
|
12
12
|
base: string;
|
|
13
13
|
rounded: string;
|
|
14
|
+
file: {
|
|
15
|
+
base: string;
|
|
16
|
+
padding: {
|
|
17
|
+
'2xs': string;
|
|
18
|
+
xs: string;
|
|
19
|
+
sm: string;
|
|
20
|
+
md: string;
|
|
21
|
+
lg: string;
|
|
22
|
+
xl: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
14
25
|
size: {
|
|
15
26
|
'2xs': string;
|
|
16
27
|
xs: string;
|
|
@@ -9,6 +9,17 @@ declare const _default: {
|
|
|
9
9
|
base: string;
|
|
10
10
|
rounded: string;
|
|
11
11
|
placeholder: string;
|
|
12
|
+
file: {
|
|
13
|
+
base: string;
|
|
14
|
+
padding: {
|
|
15
|
+
'2xs': string;
|
|
16
|
+
xs: string;
|
|
17
|
+
sm: string;
|
|
18
|
+
md: string;
|
|
19
|
+
lg: string;
|
|
20
|
+
xl: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
12
23
|
size: {
|
|
13
24
|
'2xs': string;
|
|
14
25
|
xs: string;
|
|
@@ -14,8 +14,22 @@ declare const _default: {
|
|
|
14
14
|
horizontal: string;
|
|
15
15
|
vertical: string;
|
|
16
16
|
size: {
|
|
17
|
-
horizontal:
|
|
18
|
-
|
|
17
|
+
horizontal: {
|
|
18
|
+
'2xs': string;
|
|
19
|
+
xs: string;
|
|
20
|
+
sm: string;
|
|
21
|
+
md: string;
|
|
22
|
+
lg: string;
|
|
23
|
+
xl: string;
|
|
24
|
+
};
|
|
25
|
+
vertical: {
|
|
26
|
+
'2xs': string;
|
|
27
|
+
xs: string;
|
|
28
|
+
sm: string;
|
|
29
|
+
md: string;
|
|
30
|
+
lg: string;
|
|
31
|
+
xl: string;
|
|
32
|
+
};
|
|
19
33
|
};
|
|
20
34
|
type: {
|
|
21
35
|
solid: string;
|
|
@@ -31,5 +45,8 @@ declare const _default: {
|
|
|
31
45
|
size: "2xs";
|
|
32
46
|
};
|
|
33
47
|
label: string;
|
|
48
|
+
default: {
|
|
49
|
+
size: "2xs";
|
|
50
|
+
};
|
|
34
51
|
};
|
|
35
52
|
export default _default;
|
|
@@ -14,8 +14,22 @@ export default {
|
|
|
14
14
|
horizontal: "w-full",
|
|
15
15
|
vertical: "h-full",
|
|
16
16
|
size: {
|
|
17
|
-
horizontal:
|
|
18
|
-
|
|
17
|
+
horizontal: {
|
|
18
|
+
"2xs": "border-t",
|
|
19
|
+
xs: "border-t-[2px]",
|
|
20
|
+
sm: "border-t-[3px]",
|
|
21
|
+
md: "border-t-[4px]",
|
|
22
|
+
lg: "border-t-[5px]",
|
|
23
|
+
xl: "border-t-[6px]"
|
|
24
|
+
},
|
|
25
|
+
vertical: {
|
|
26
|
+
"2xs": "border-s",
|
|
27
|
+
xs: "border-s-[2px]",
|
|
28
|
+
sm: "border-s-[3px]",
|
|
29
|
+
md: "border-s-[4px]",
|
|
30
|
+
lg: "border-s-[5px]",
|
|
31
|
+
xl: "border-s-[6px]"
|
|
32
|
+
}
|
|
19
33
|
},
|
|
20
34
|
type: {
|
|
21
35
|
solid: "border-solid",
|
|
@@ -30,5 +44,8 @@ export default {
|
|
|
30
44
|
base: "flex-shrink-0",
|
|
31
45
|
size: "2xs"
|
|
32
46
|
},
|
|
33
|
-
label: "text-sm"
|
|
47
|
+
label: "text-sm",
|
|
48
|
+
default: {
|
|
49
|
+
size: "2xs"
|
|
50
|
+
}
|
|
34
51
|
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const excludeColors: (colors: object) => string[];
|
|
2
|
+
export declare const generateSafelist: (colors: string[], globalColors: any) => any[];
|
|
3
|
+
export declare const customSafelistExtractor: (prefix: any, content: string, colors: string[], safelistColors: string[]) => string[];
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { omit } from "./lodash.mjs";
|
|
2
|
+
import { kebabCase, camelCase, upperFirst } from "scule";
|
|
3
|
+
const colorsToExclude = [
|
|
4
|
+
"inherit",
|
|
5
|
+
"transparent",
|
|
6
|
+
"current",
|
|
7
|
+
"white",
|
|
8
|
+
"black",
|
|
9
|
+
"slate",
|
|
10
|
+
"gray",
|
|
11
|
+
"zinc",
|
|
12
|
+
"neutral",
|
|
13
|
+
"stone",
|
|
14
|
+
"cool"
|
|
15
|
+
];
|
|
16
|
+
const safelistByComponent = {
|
|
17
|
+
alert: (colorsAsRegex2) => [{
|
|
18
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-50`)
|
|
19
|
+
}, {
|
|
20
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
21
|
+
variants: ["dark"]
|
|
22
|
+
}, {
|
|
23
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
24
|
+
}, {
|
|
25
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
26
|
+
variants: ["dark"]
|
|
27
|
+
}, {
|
|
28
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
29
|
+
}, {
|
|
30
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
31
|
+
variants: ["dark"]
|
|
32
|
+
}, {
|
|
33
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`)
|
|
34
|
+
}],
|
|
35
|
+
avatar: (colorsAsRegex2) => [{
|
|
36
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
37
|
+
variants: ["dark"]
|
|
38
|
+
}, {
|
|
39
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
40
|
+
}],
|
|
41
|
+
badge: (colorsAsRegex2) => [{
|
|
42
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-50`)
|
|
43
|
+
}, {
|
|
44
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
45
|
+
variants: ["dark"]
|
|
46
|
+
}, {
|
|
47
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
48
|
+
}, {
|
|
49
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
50
|
+
variants: ["dark"]
|
|
51
|
+
}, {
|
|
52
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
53
|
+
}, {
|
|
54
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
55
|
+
variants: ["dark"]
|
|
56
|
+
}, {
|
|
57
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`)
|
|
58
|
+
}],
|
|
59
|
+
button: (colorsAsRegex2) => [{
|
|
60
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-50`),
|
|
61
|
+
variants: ["hover", "disabled"]
|
|
62
|
+
}, {
|
|
63
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-100`),
|
|
64
|
+
variants: ["hover"]
|
|
65
|
+
}, {
|
|
66
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
67
|
+
variants: ["dark", "dark:disabled"]
|
|
68
|
+
}, {
|
|
69
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`),
|
|
70
|
+
variants: ["disabled", "dark:hover"]
|
|
71
|
+
}, {
|
|
72
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-600`),
|
|
73
|
+
variants: ["hover"]
|
|
74
|
+
}, {
|
|
75
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-900`),
|
|
76
|
+
variants: ["dark:hover"]
|
|
77
|
+
}, {
|
|
78
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-950`),
|
|
79
|
+
variants: ["dark", "dark:hover", "dark:disabled"]
|
|
80
|
+
}, {
|
|
81
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
82
|
+
variants: ["dark", "dark:disabled"]
|
|
83
|
+
}, {
|
|
84
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`),
|
|
85
|
+
variants: ["dark:hover", "disabled"]
|
|
86
|
+
}, {
|
|
87
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-600`),
|
|
88
|
+
variants: ["hover"]
|
|
89
|
+
}, {
|
|
90
|
+
pattern: new RegExp(`outline-(${colorsAsRegex2})-400`),
|
|
91
|
+
variants: ["dark:focus-visible"]
|
|
92
|
+
}, {
|
|
93
|
+
pattern: new RegExp(`outline-(${colorsAsRegex2})-500`),
|
|
94
|
+
variants: ["focus-visible"]
|
|
95
|
+
}, {
|
|
96
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
97
|
+
variants: ["dark:focus-visible"]
|
|
98
|
+
}, {
|
|
99
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
100
|
+
variants: ["focus-visible"]
|
|
101
|
+
}],
|
|
102
|
+
input: (colorsAsRegex2) => [{
|
|
103
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
104
|
+
variants: ["dark"]
|
|
105
|
+
}, {
|
|
106
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
107
|
+
}, {
|
|
108
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
109
|
+
variants: ["dark", "dark:focus"]
|
|
110
|
+
}, {
|
|
111
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
112
|
+
variants: ["focus"]
|
|
113
|
+
}],
|
|
114
|
+
radio: (colorsAsRegex2) => [{
|
|
115
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
116
|
+
variants: ["dark"]
|
|
117
|
+
}, {
|
|
118
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
119
|
+
}, {
|
|
120
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
121
|
+
variants: ["dark:focus-visible"]
|
|
122
|
+
}, {
|
|
123
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
124
|
+
variants: ["focus-visible"]
|
|
125
|
+
}],
|
|
126
|
+
checkbox: (colorsAsRegex2) => [{
|
|
127
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
128
|
+
variants: ["dark"]
|
|
129
|
+
}, {
|
|
130
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
131
|
+
}, {
|
|
132
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
133
|
+
variants: ["dark:focus-visible"]
|
|
134
|
+
}, {
|
|
135
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
136
|
+
variants: ["focus-visible"]
|
|
137
|
+
}],
|
|
138
|
+
toggle: (colorsAsRegex2) => [{
|
|
139
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
140
|
+
variants: ["dark"]
|
|
141
|
+
}, {
|
|
142
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
143
|
+
}, {
|
|
144
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
145
|
+
variants: ["dark"]
|
|
146
|
+
}, {
|
|
147
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
148
|
+
}, {
|
|
149
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
150
|
+
variants: ["dark:focus-visible"]
|
|
151
|
+
}, {
|
|
152
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
153
|
+
variants: ["focus-visible"]
|
|
154
|
+
}],
|
|
155
|
+
range: (colorsAsRegex2) => [{
|
|
156
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
157
|
+
variants: ["dark"]
|
|
158
|
+
}, {
|
|
159
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
160
|
+
}, {
|
|
161
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
162
|
+
variants: ["dark"]
|
|
163
|
+
}, {
|
|
164
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
165
|
+
}, {
|
|
166
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
167
|
+
variants: ["dark:focus-visible"]
|
|
168
|
+
}, {
|
|
169
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
170
|
+
variants: ["focus-visible"]
|
|
171
|
+
}],
|
|
172
|
+
progress: (colorsAsRegex2) => [{
|
|
173
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
174
|
+
variants: ["dark"]
|
|
175
|
+
}, {
|
|
176
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
177
|
+
}],
|
|
178
|
+
meter: (colorsAsRegex2) => [{
|
|
179
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
180
|
+
variants: ["dark"]
|
|
181
|
+
}, {
|
|
182
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
183
|
+
}, {
|
|
184
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
185
|
+
variants: ["dark"]
|
|
186
|
+
}, {
|
|
187
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
188
|
+
}],
|
|
189
|
+
notification: (colorsAsRegex2) => [{
|
|
190
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
191
|
+
variants: ["dark"]
|
|
192
|
+
}, {
|
|
193
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
194
|
+
}, {
|
|
195
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
196
|
+
variants: ["dark"]
|
|
197
|
+
}, {
|
|
198
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
199
|
+
}],
|
|
200
|
+
chip: (colorsAsRegex2) => [{
|
|
201
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
202
|
+
variants: ["dark"]
|
|
203
|
+
}, {
|
|
204
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
205
|
+
}]
|
|
206
|
+
};
|
|
207
|
+
const safelistComponentAliasesMap = {
|
|
208
|
+
"USelect": "UInput",
|
|
209
|
+
"USelectMenu": "UInput",
|
|
210
|
+
"UTextarea": "UInput",
|
|
211
|
+
"URadioGroup": "URadio",
|
|
212
|
+
"UMeterGroup": "UMeter"
|
|
213
|
+
};
|
|
214
|
+
const colorsAsRegex = (colors) => colors.join("|");
|
|
215
|
+
export const excludeColors = (colors) => {
|
|
216
|
+
return Object.entries(omit(colors, colorsToExclude)).filter(([, value]) => typeof value === "object").map(([key]) => kebabCase(key));
|
|
217
|
+
};
|
|
218
|
+
export const generateSafelist = (colors, globalColors) => {
|
|
219
|
+
const baseSafelist = Object.keys(safelistByComponent).flatMap((component) => safelistByComponent[component](colorsAsRegex(colors)));
|
|
220
|
+
const formsSafelist = ["input", "radio", "checkbox", "toggle", "range"].flatMap((component) => safelistByComponent[component](colorsAsRegex(["red"])));
|
|
221
|
+
return [
|
|
222
|
+
...baseSafelist,
|
|
223
|
+
...formsSafelist,
|
|
224
|
+
// Ensure all global colors are safelisted for the Notification (toast.add)
|
|
225
|
+
...safelistByComponent["notification"](colorsAsRegex(globalColors)),
|
|
226
|
+
// Gray safelist for Avatar & Notification
|
|
227
|
+
"bg-gray-500",
|
|
228
|
+
"dark:bg-gray-400",
|
|
229
|
+
"text-gray-500",
|
|
230
|
+
"dark:text-gray-400"
|
|
231
|
+
];
|
|
232
|
+
};
|
|
233
|
+
export const customSafelistExtractor = (prefix, content, colors, safelistColors) => {
|
|
234
|
+
const classes = [];
|
|
235
|
+
const regex = /<([A-Za-z][A-Za-z0-9]*(?:-[A-Za-z][A-Za-z0-9]*)*)\s+(?![^>]*:color\b)[^>]*\bcolor=["']([^"']+)["'][^>]*>/gs;
|
|
236
|
+
const matches = content.matchAll(regex);
|
|
237
|
+
const components = Object.keys(safelistByComponent).map((component) => `${prefix}${component.charAt(0).toUpperCase() + component.slice(1)}`);
|
|
238
|
+
for (const match of matches) {
|
|
239
|
+
const [, component, color] = match;
|
|
240
|
+
const camelComponent = upperFirst(camelCase(component));
|
|
241
|
+
if (!colors.includes(color) || safelistColors.includes(color)) {
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
let name = safelistComponentAliasesMap[camelComponent] ? safelistComponentAliasesMap[camelComponent] : camelComponent;
|
|
245
|
+
if (!components.includes(name)) {
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
name = name.replace(prefix, "").toLowerCase();
|
|
249
|
+
const matchClasses = safelistByComponent[name](color).flatMap((group) => {
|
|
250
|
+
return ["", ...group.variants || []].flatMap((variant) => {
|
|
251
|
+
const matches2 = group.pattern.source.match(/\(([^)]+)\)/g);
|
|
252
|
+
return matches2.map((match2) => {
|
|
253
|
+
const colorOptions = match2.substring(1, match2.length - 1).split("|");
|
|
254
|
+
return colorOptions.map((color2) => `${variant ? variant + ":" : ""}` + group.pattern.source.replace(match2, color2));
|
|
255
|
+
}).flat();
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
classes.push(...matchClasses);
|
|
259
|
+
}
|
|
260
|
+
return classes;
|
|
261
|
+
};
|
|
@@ -11,9 +11,18 @@ const defuTwMerge = createDefu((obj, key, value, namespace) => {
|
|
|
11
11
|
if (namespace === "default" || namespace.startsWith("default.")) {
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
14
|
+
if (namespace === "popper" || namespace.startsWith("popper.")) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
14
17
|
if (namespace.endsWith("avatar") && key === "size") {
|
|
15
18
|
return false;
|
|
16
19
|
}
|
|
20
|
+
if (namespace.endsWith("chip") && key === "size") {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (namespace.endsWith("badge") && key === "size" || key === "color" || key === "variant") {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
17
26
|
if (typeof obj[key] === "string" && typeof value === "string" && obj[key] && value) {
|
|
18
27
|
obj[key] = customTwMerge(obj[key], value);
|
|
19
28
|
return true;
|
|
@@ -3,54 +3,67 @@ export declare const nuxtLinkProps: {
|
|
|
3
3
|
readonly to: {
|
|
4
4
|
readonly type: PropType<RouteLocationRaw>;
|
|
5
5
|
readonly default: undefined;
|
|
6
|
+
readonly required: false;
|
|
6
7
|
};
|
|
7
8
|
readonly href: {
|
|
8
9
|
readonly type: PropType<RouteLocationRaw>;
|
|
9
10
|
readonly default: undefined;
|
|
11
|
+
readonly required: false;
|
|
10
12
|
};
|
|
11
13
|
readonly target: {
|
|
12
|
-
readonly type: PropType<
|
|
14
|
+
readonly type: PropType<NuxtLinkProps>;
|
|
13
15
|
readonly default: undefined;
|
|
16
|
+
readonly required: false;
|
|
14
17
|
};
|
|
15
18
|
readonly rel: {
|
|
16
|
-
readonly type: PropType<
|
|
19
|
+
readonly type: PropType<NuxtLinkProps>;
|
|
17
20
|
readonly default: undefined;
|
|
21
|
+
readonly required: false;
|
|
18
22
|
};
|
|
19
23
|
readonly noRel: {
|
|
20
|
-
readonly type:
|
|
24
|
+
readonly type: PropType<NuxtLinkProps>;
|
|
21
25
|
readonly default: undefined;
|
|
26
|
+
readonly required: false;
|
|
22
27
|
};
|
|
23
28
|
readonly prefetch: {
|
|
24
|
-
readonly type:
|
|
29
|
+
readonly type: PropType<NuxtLinkProps>;
|
|
25
30
|
readonly default: undefined;
|
|
31
|
+
readonly required: false;
|
|
26
32
|
};
|
|
27
33
|
readonly noPrefetch: {
|
|
28
|
-
readonly type:
|
|
34
|
+
readonly type: PropType<NuxtLinkProps>;
|
|
29
35
|
readonly default: undefined;
|
|
36
|
+
readonly required: false;
|
|
30
37
|
};
|
|
31
38
|
readonly activeClass: {
|
|
32
|
-
readonly type:
|
|
39
|
+
readonly type: PropType<NuxtLinkProps>;
|
|
33
40
|
readonly default: undefined;
|
|
41
|
+
readonly required: false;
|
|
34
42
|
};
|
|
35
43
|
readonly exactActiveClass: {
|
|
36
|
-
readonly type:
|
|
44
|
+
readonly type: PropType<NuxtLinkProps>;
|
|
37
45
|
readonly default: undefined;
|
|
46
|
+
readonly required: false;
|
|
38
47
|
};
|
|
39
48
|
readonly prefetchedClass: {
|
|
40
|
-
readonly type:
|
|
49
|
+
readonly type: PropType<NuxtLinkProps>;
|
|
41
50
|
readonly default: undefined;
|
|
51
|
+
readonly required: false;
|
|
42
52
|
};
|
|
43
53
|
readonly replace: {
|
|
44
|
-
readonly type:
|
|
54
|
+
readonly type: PropType<NuxtLinkProps>;
|
|
45
55
|
readonly default: undefined;
|
|
56
|
+
readonly required: false;
|
|
46
57
|
};
|
|
47
58
|
readonly ariaCurrentValue: {
|
|
48
|
-
readonly type:
|
|
59
|
+
readonly type: PropType<NuxtLinkProps>;
|
|
49
60
|
readonly default: undefined;
|
|
61
|
+
readonly required: false;
|
|
50
62
|
};
|
|
51
63
|
readonly external: {
|
|
52
|
-
readonly type:
|
|
64
|
+
readonly type: PropType<NuxtLinkProps>;
|
|
53
65
|
readonly default: undefined;
|
|
66
|
+
readonly required: false;
|
|
54
67
|
};
|
|
55
68
|
};
|
|
56
69
|
export declare const getNuxtLinkProps: (props: any) => {};
|
|
@@ -1,60 +1,73 @@
|
|
|
1
1
|
export const nuxtLinkProps = {
|
|
2
2
|
to: {
|
|
3
3
|
type: [String, Object],
|
|
4
|
-
default: void 0
|
|
4
|
+
default: void 0,
|
|
5
|
+
required: false
|
|
5
6
|
},
|
|
6
7
|
href: {
|
|
7
8
|
type: [String, Object],
|
|
8
|
-
default: void 0
|
|
9
|
+
default: void 0,
|
|
10
|
+
required: false
|
|
9
11
|
},
|
|
10
12
|
// Attributes
|
|
11
13
|
target: {
|
|
12
14
|
type: String,
|
|
13
|
-
default: void 0
|
|
15
|
+
default: void 0,
|
|
16
|
+
required: false
|
|
14
17
|
},
|
|
15
18
|
rel: {
|
|
16
19
|
type: String,
|
|
17
|
-
default: void 0
|
|
20
|
+
default: void 0,
|
|
21
|
+
required: false
|
|
18
22
|
},
|
|
19
23
|
noRel: {
|
|
20
24
|
type: Boolean,
|
|
21
|
-
default: void 0
|
|
25
|
+
default: void 0,
|
|
26
|
+
required: false
|
|
22
27
|
},
|
|
23
28
|
// Prefetching
|
|
24
29
|
prefetch: {
|
|
25
30
|
type: Boolean,
|
|
26
|
-
default: void 0
|
|
31
|
+
default: void 0,
|
|
32
|
+
required: false
|
|
27
33
|
},
|
|
28
34
|
noPrefetch: {
|
|
29
35
|
type: Boolean,
|
|
30
|
-
default: void 0
|
|
36
|
+
default: void 0,
|
|
37
|
+
required: false
|
|
31
38
|
},
|
|
32
39
|
// Styling
|
|
33
40
|
activeClass: {
|
|
34
41
|
type: String,
|
|
35
|
-
default: void 0
|
|
42
|
+
default: void 0,
|
|
43
|
+
required: false
|
|
36
44
|
},
|
|
37
45
|
exactActiveClass: {
|
|
38
46
|
type: String,
|
|
39
|
-
default: void 0
|
|
47
|
+
default: void 0,
|
|
48
|
+
required: false
|
|
40
49
|
},
|
|
41
50
|
prefetchedClass: {
|
|
42
51
|
type: String,
|
|
43
|
-
default: void 0
|
|
52
|
+
default: void 0,
|
|
53
|
+
required: false
|
|
44
54
|
},
|
|
45
55
|
// Vue Router's `<RouterLink>` additional props
|
|
46
56
|
replace: {
|
|
47
57
|
type: Boolean,
|
|
48
|
-
default: void 0
|
|
58
|
+
default: void 0,
|
|
59
|
+
required: false
|
|
49
60
|
},
|
|
50
61
|
ariaCurrentValue: {
|
|
51
62
|
type: String,
|
|
52
|
-
default: void 0
|
|
63
|
+
default: void 0,
|
|
64
|
+
required: false
|
|
53
65
|
},
|
|
54
66
|
// Edge cases handling
|
|
55
67
|
external: {
|
|
56
68
|
type: Boolean,
|
|
57
|
-
default: void 0
|
|
69
|
+
default: void 0,
|
|
70
|
+
required: false
|
|
58
71
|
}
|
|
59
72
|
};
|
|
60
73
|
const uLinkProps = {
|