@nuxt/ui 2.15.1 → 2.16.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 +1 -18
- package/dist/module.d.mts +4 -24
- package/dist/module.d.ts +4 -24
- package/dist/module.json +1 -1
- package/dist/module.mjs +108 -329
- package/dist/runtime/components/data/Table.vue +35 -4
- package/dist/runtime/components/data/Table.vue.d.ts +25 -35
- package/dist/runtime/components/elements/Accordion.vue +25 -7
- package/dist/runtime/components/elements/Accordion.vue.d.ts +10 -1
- package/dist/runtime/components/elements/Alert.vue.d.ts +6 -6
- package/dist/runtime/components/elements/Avatar.vue.d.ts +10 -10
- package/dist/runtime/components/elements/Badge.vue.d.ts +5 -5
- package/dist/runtime/components/elements/Button.vue.d.ts +9 -9
- package/dist/runtime/components/elements/Carousel.vue +10 -4
- package/dist/runtime/components/elements/Carousel.vue.d.ts +3 -3
- package/dist/runtime/components/elements/Chip.vue.d.ts +8 -8
- package/dist/runtime/components/elements/Dropdown.vue +2 -2
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +2 -2
- package/dist/runtime/components/elements/Kbd.vue.d.ts +2 -2
- package/dist/runtime/components/elements/Link.vue.d.ts +3 -3
- package/dist/runtime/components/elements/Meter.vue.d.ts +5 -5
- package/dist/runtime/components/elements/Progress.vue.d.ts +3 -3
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +10 -10
- package/dist/runtime/components/forms/Form.vue.d.ts +2 -2
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +7 -7
- package/dist/runtime/components/forms/Input.vue +1 -1
- package/dist/runtime/components/forms/Input.vue.d.ts +14 -14
- package/dist/runtime/components/forms/InputMenu.vue +6 -0
- package/dist/runtime/components/forms/InputMenu.vue.d.ts +30 -21
- package/dist/runtime/components/forms/Radio.vue.d.ts +11 -11
- package/dist/runtime/components/forms/RadioGroup.vue.d.ts +8 -8
- package/dist/runtime/components/forms/Range.vue.d.ts +8 -8
- package/dist/runtime/components/forms/Select.vue.d.ts +13 -13
- package/dist/runtime/components/forms/SelectMenu.vue +6 -0
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +30 -21
- package/dist/runtime/components/forms/Textarea.vue.d.ts +12 -12
- package/dist/runtime/components/forms/Toggle.vue.d.ts +7 -7
- 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.d.ts +5 -5
- package/dist/runtime/components/layout/Skeleton.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/Breadcrumb.vue +1 -0
- package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +10 -10
- package/dist/runtime/components/navigation/HorizontalNavigation.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/Pagination.vue +5 -0
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +10 -1
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +2 -2
- 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 +6 -2
- package/dist/runtime/components/overlays/Modal.vue.d.ts +7 -5
- package/dist/runtime/components/overlays/Modals.client.vue +8 -2
- package/dist/runtime/components/overlays/Notification.vue +8 -3
- package/dist/runtime/components/overlays/Notification.vue.d.ts +8 -8
- package/dist/runtime/components/overlays/Notifications.vue.d.ts +3 -1
- package/dist/runtime/components/overlays/Popover.vue +2 -2
- package/dist/runtime/components/overlays/Popover.vue.d.ts +3 -3
- package/dist/runtime/components/overlays/Slideover.vue +6 -2
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +10 -8
- package/dist/runtime/components/overlays/Slideovers.client.vue +2 -1
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +2 -2
- package/dist/runtime/composables/useFormGroup.d.ts +1 -1
- package/dist/runtime/composables/useModal.d.ts +3 -2
- package/dist/runtime/composables/useModal.mjs +13 -3
- package/dist/runtime/composables/usePopper.d.ts +8 -8
- package/dist/runtime/composables/useSlideover.d.ts +2 -1
- package/dist/runtime/composables/useSlideover.mjs +8 -1
- package/dist/runtime/composables/useToast.d.ts +2 -0
- package/dist/runtime/composables/useToast.mjs +13 -1
- package/dist/runtime/types/slideover.d.ts +11 -12
- package/dist/runtime/ui.config/data/table.d.ts +4 -0
- package/dist/runtime/ui.config/data/table.mjs +4 -0
- package/dist/runtime/ui.config/forms/input.d.ts +0 -8
- package/dist/runtime/ui.config/forms/input.mjs +1 -9
- package/dist/runtime/ui.config/forms/select.d.ts +0 -8
- package/dist/runtime/ui.config/forms/textarea.d.ts +0 -8
- package/dist/runtime/ui.config/navigation/breadcrumb.mjs +1 -1
- package/dist/runtime/utils/colors.d.ts +11 -0
- package/dist/runtime/utils/colors.mjs +299 -0
- package/package.json +22 -25
package/README.md
CHANGED
|
@@ -27,24 +27,7 @@ Read more on [ui.nuxt.com](https://ui.nuxt.com)
|
|
|
27
27
|
## Installation
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
|
|
31
|
-
npm install @nuxt/ui
|
|
32
|
-
# yarn
|
|
33
|
-
yarn add @nuxt/ui
|
|
34
|
-
# pnpm
|
|
35
|
-
pnpm add @nuxt/ui
|
|
36
|
-
# bun
|
|
37
|
-
bun add @nuxt/ui
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Then, register the module in your `nuxt.config.ts`:
|
|
41
|
-
|
|
42
|
-
```js
|
|
43
|
-
export default defineNuxtConfig({
|
|
44
|
-
modules: [
|
|
45
|
-
'@nuxt/ui'
|
|
46
|
-
]
|
|
47
|
-
})
|
|
30
|
+
npx nuxi@latest module add ui
|
|
48
31
|
```
|
|
49
32
|
|
|
50
33
|
If you want latest updates, please use `@nuxt/ui-edge` in your `package.json`:
|
package/dist/module.d.mts
CHANGED
|
@@ -7,6 +7,7 @@ declare const _default$H: {
|
|
|
7
7
|
divide: string;
|
|
8
8
|
thead: string;
|
|
9
9
|
tbody: string;
|
|
10
|
+
caption: string;
|
|
10
11
|
tr: {
|
|
11
12
|
base: string;
|
|
12
13
|
selected: string;
|
|
@@ -53,6 +54,9 @@ declare const _default$H: {
|
|
|
53
54
|
variant: "ghost";
|
|
54
55
|
class: string;
|
|
55
56
|
};
|
|
57
|
+
checkbox: {
|
|
58
|
+
color: "primary";
|
|
59
|
+
};
|
|
56
60
|
progress: {
|
|
57
61
|
color: "primary";
|
|
58
62
|
animation: "carousel";
|
|
@@ -763,14 +767,6 @@ declare const _default$s: {
|
|
|
763
767
|
placeholder: string;
|
|
764
768
|
file: {
|
|
765
769
|
base: string;
|
|
766
|
-
padding: {
|
|
767
|
-
'2xs': string;
|
|
768
|
-
xs: string;
|
|
769
|
-
sm: string;
|
|
770
|
-
md: string;
|
|
771
|
-
lg: string;
|
|
772
|
-
xl: string;
|
|
773
|
-
};
|
|
774
770
|
};
|
|
775
771
|
size: {
|
|
776
772
|
'2xs': string;
|
|
@@ -976,14 +972,6 @@ declare const _default$p: {
|
|
|
976
972
|
placeholder: string;
|
|
977
973
|
file: {
|
|
978
974
|
base: string;
|
|
979
|
-
padding: {
|
|
980
|
-
'2xs': string;
|
|
981
|
-
xs: string;
|
|
982
|
-
sm: string;
|
|
983
|
-
md: string;
|
|
984
|
-
lg: string;
|
|
985
|
-
xl: string;
|
|
986
|
-
};
|
|
987
975
|
};
|
|
988
976
|
size: {
|
|
989
977
|
'2xs': string;
|
|
@@ -1095,14 +1083,6 @@ declare const _default$o: {
|
|
|
1095
1083
|
rounded: string;
|
|
1096
1084
|
file: {
|
|
1097
1085
|
base: string;
|
|
1098
|
-
padding: {
|
|
1099
|
-
'2xs': string;
|
|
1100
|
-
xs: string;
|
|
1101
|
-
sm: string;
|
|
1102
|
-
md: string;
|
|
1103
|
-
lg: string;
|
|
1104
|
-
xl: string;
|
|
1105
|
-
};
|
|
1106
1086
|
};
|
|
1107
1087
|
size: {
|
|
1108
1088
|
'2xs': string;
|
package/dist/module.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ declare const _default$H: {
|
|
|
7
7
|
divide: string;
|
|
8
8
|
thead: string;
|
|
9
9
|
tbody: string;
|
|
10
|
+
caption: string;
|
|
10
11
|
tr: {
|
|
11
12
|
base: string;
|
|
12
13
|
selected: string;
|
|
@@ -53,6 +54,9 @@ declare const _default$H: {
|
|
|
53
54
|
variant: "ghost";
|
|
54
55
|
class: string;
|
|
55
56
|
};
|
|
57
|
+
checkbox: {
|
|
58
|
+
color: "primary";
|
|
59
|
+
};
|
|
56
60
|
progress: {
|
|
57
61
|
color: "primary";
|
|
58
62
|
animation: "carousel";
|
|
@@ -763,14 +767,6 @@ declare const _default$s: {
|
|
|
763
767
|
placeholder: string;
|
|
764
768
|
file: {
|
|
765
769
|
base: string;
|
|
766
|
-
padding: {
|
|
767
|
-
'2xs': string;
|
|
768
|
-
xs: string;
|
|
769
|
-
sm: string;
|
|
770
|
-
md: string;
|
|
771
|
-
lg: string;
|
|
772
|
-
xl: string;
|
|
773
|
-
};
|
|
774
770
|
};
|
|
775
771
|
size: {
|
|
776
772
|
'2xs': string;
|
|
@@ -976,14 +972,6 @@ declare const _default$p: {
|
|
|
976
972
|
placeholder: string;
|
|
977
973
|
file: {
|
|
978
974
|
base: string;
|
|
979
|
-
padding: {
|
|
980
|
-
'2xs': string;
|
|
981
|
-
xs: string;
|
|
982
|
-
sm: string;
|
|
983
|
-
md: string;
|
|
984
|
-
lg: string;
|
|
985
|
-
xl: string;
|
|
986
|
-
};
|
|
987
975
|
};
|
|
988
976
|
size: {
|
|
989
977
|
'2xs': string;
|
|
@@ -1095,14 +1083,6 @@ declare const _default$o: {
|
|
|
1095
1083
|
rounded: string;
|
|
1096
1084
|
file: {
|
|
1097
1085
|
base: string;
|
|
1098
|
-
padding: {
|
|
1099
|
-
'2xs': string;
|
|
1100
|
-
xs: string;
|
|
1101
|
-
sm: string;
|
|
1102
|
-
md: string;
|
|
1103
|
-
lg: string;
|
|
1104
|
-
xl: string;
|
|
1105
|
-
};
|
|
1106
1086
|
};
|
|
1107
1087
|
size: {
|
|
1108
1088
|
'2xs': string;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import { addTemplate, useNuxt,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { kebabCase
|
|
2
|
+
import { addTemplate, useNuxt, installModule, createResolver, defineNuxtModule, addPlugin, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
3
|
+
import { join } from 'pathe';
|
|
4
|
+
import { defu } from 'defu';
|
|
5
|
+
import { kebabCase } from 'scule';
|
|
6
|
+
import defaultColors$1 from 'tailwindcss/colors.js';
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
@@ -14,7 +15,7 @@ const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
|
14
15
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
15
16
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
16
17
|
const name = "@nuxt/ui";
|
|
17
|
-
const version = "2.
|
|
18
|
+
const version = "2.16.0";
|
|
18
19
|
|
|
19
20
|
function createTemplates(nuxt = useNuxt()) {
|
|
20
21
|
const template = addTemplate({
|
|
@@ -54,254 +55,113 @@ const colorsToExclude = [
|
|
|
54
55
|
"stone",
|
|
55
56
|
"cool"
|
|
56
57
|
];
|
|
57
|
-
const safelistByComponent = {
|
|
58
|
-
alert: (colorsAsRegex2) => [{
|
|
59
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-50`)
|
|
60
|
-
}, {
|
|
61
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
62
|
-
variants: ["dark"]
|
|
63
|
-
}, {
|
|
64
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
65
|
-
}, {
|
|
66
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
67
|
-
variants: ["dark"]
|
|
68
|
-
}, {
|
|
69
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
70
|
-
}, {
|
|
71
|
-
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
72
|
-
variants: ["dark"]
|
|
73
|
-
}, {
|
|
74
|
-
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`)
|
|
75
|
-
}],
|
|
76
|
-
avatar: (colorsAsRegex2) => [{
|
|
77
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
78
|
-
variants: ["dark"]
|
|
79
|
-
}, {
|
|
80
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
81
|
-
}],
|
|
82
|
-
badge: (colorsAsRegex2) => [{
|
|
83
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-50`)
|
|
84
|
-
}, {
|
|
85
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
86
|
-
variants: ["dark"]
|
|
87
|
-
}, {
|
|
88
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
89
|
-
}, {
|
|
90
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
91
|
-
variants: ["dark"]
|
|
92
|
-
}, {
|
|
93
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
94
|
-
}, {
|
|
95
|
-
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
96
|
-
variants: ["dark"]
|
|
97
|
-
}, {
|
|
98
|
-
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`)
|
|
99
|
-
}],
|
|
100
|
-
button: (colorsAsRegex2) => [{
|
|
101
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-50`),
|
|
102
|
-
variants: ["hover", "disabled"]
|
|
103
|
-
}, {
|
|
104
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-100`),
|
|
105
|
-
variants: ["hover"]
|
|
106
|
-
}, {
|
|
107
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
108
|
-
variants: ["dark", "dark:disabled"]
|
|
109
|
-
}, {
|
|
110
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`),
|
|
111
|
-
variants: ["disabled", "dark:hover"]
|
|
112
|
-
}, {
|
|
113
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-600`),
|
|
114
|
-
variants: ["hover"]
|
|
115
|
-
}, {
|
|
116
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-900`),
|
|
117
|
-
variants: ["dark:hover"]
|
|
118
|
-
}, {
|
|
119
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-950`),
|
|
120
|
-
variants: ["dark", "dark:hover", "dark:disabled"]
|
|
121
|
-
}, {
|
|
122
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
123
|
-
variants: ["dark", "dark:disabled"]
|
|
124
|
-
}, {
|
|
125
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-500`),
|
|
126
|
-
variants: ["dark:hover", "disabled"]
|
|
127
|
-
}, {
|
|
128
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-600`),
|
|
129
|
-
variants: ["hover"]
|
|
130
|
-
}, {
|
|
131
|
-
pattern: new RegExp(`outline-(${colorsAsRegex2})-400`),
|
|
132
|
-
variants: ["dark:focus-visible"]
|
|
133
|
-
}, {
|
|
134
|
-
pattern: new RegExp(`outline-(${colorsAsRegex2})-500`),
|
|
135
|
-
variants: ["focus-visible"]
|
|
136
|
-
}, {
|
|
137
|
-
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
138
|
-
variants: ["dark:focus-visible"]
|
|
139
|
-
}, {
|
|
140
|
-
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
141
|
-
variants: ["focus-visible"]
|
|
142
|
-
}],
|
|
143
|
-
input: (colorsAsRegex2) => [{
|
|
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", "dark:focus"]
|
|
151
|
-
}, {
|
|
152
|
-
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
153
|
-
variants: ["focus"]
|
|
154
|
-
}],
|
|
155
|
-
radio: (colorsAsRegex2) => [{
|
|
156
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
157
|
-
variants: ["dark"]
|
|
158
|
-
}, {
|
|
159
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
160
|
-
}, {
|
|
161
|
-
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
162
|
-
variants: ["dark:focus-visible"]
|
|
163
|
-
}, {
|
|
164
|
-
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
165
|
-
variants: ["focus-visible"]
|
|
166
|
-
}],
|
|
167
|
-
checkbox: (colorsAsRegex2) => [{
|
|
168
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
169
|
-
variants: ["dark"]
|
|
170
|
-
}, {
|
|
171
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
172
|
-
}, {
|
|
173
|
-
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
174
|
-
variants: ["dark:focus-visible"]
|
|
175
|
-
}, {
|
|
176
|
-
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
177
|
-
variants: ["focus-visible"]
|
|
178
|
-
}],
|
|
179
|
-
toggle: (colorsAsRegex2) => [{
|
|
180
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
181
|
-
variants: ["dark"]
|
|
182
|
-
}, {
|
|
183
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
184
|
-
}, {
|
|
185
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
186
|
-
variants: ["dark"]
|
|
187
|
-
}, {
|
|
188
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
189
|
-
}, {
|
|
190
|
-
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
191
|
-
variants: ["dark:focus-visible"]
|
|
192
|
-
}, {
|
|
193
|
-
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
194
|
-
variants: ["focus-visible"]
|
|
195
|
-
}],
|
|
196
|
-
range: (colorsAsRegex2) => [{
|
|
197
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
198
|
-
variants: ["dark"]
|
|
199
|
-
}, {
|
|
200
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
201
|
-
}, {
|
|
202
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
203
|
-
variants: ["dark"]
|
|
204
|
-
}, {
|
|
205
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
206
|
-
}, {
|
|
207
|
-
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
208
|
-
variants: ["dark:focus-visible"]
|
|
209
|
-
}, {
|
|
210
|
-
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
211
|
-
variants: ["focus-visible"]
|
|
212
|
-
}],
|
|
213
|
-
progress: (colorsAsRegex2) => [{
|
|
214
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
215
|
-
variants: ["dark"]
|
|
216
|
-
}, {
|
|
217
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
218
|
-
}],
|
|
219
|
-
meter: (colorsAsRegex2) => [{
|
|
220
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
221
|
-
variants: ["dark"]
|
|
222
|
-
}, {
|
|
223
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
224
|
-
}, {
|
|
225
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
226
|
-
variants: ["dark"]
|
|
227
|
-
}, {
|
|
228
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
229
|
-
}],
|
|
230
|
-
notification: (colorsAsRegex2) => [{
|
|
231
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
232
|
-
variants: ["dark"]
|
|
233
|
-
}, {
|
|
234
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
235
|
-
}, {
|
|
236
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
237
|
-
variants: ["dark"]
|
|
238
|
-
}, {
|
|
239
|
-
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
240
|
-
}],
|
|
241
|
-
chip: (colorsAsRegex2) => [{
|
|
242
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
243
|
-
variants: ["dark"]
|
|
244
|
-
}, {
|
|
245
|
-
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
246
|
-
}]
|
|
247
|
-
};
|
|
248
|
-
const safelistComponentAliasesMap = {
|
|
249
|
-
"USelect": "UInput",
|
|
250
|
-
"USelectMenu": "UInput",
|
|
251
|
-
"UTextarea": "UInput",
|
|
252
|
-
"URadioGroup": "URadio",
|
|
253
|
-
"UMeterGroup": "UMeter"
|
|
254
|
-
};
|
|
255
|
-
const colorsAsRegex = (colors) => colors.join("|");
|
|
256
58
|
const excludeColors = (colors) => {
|
|
257
59
|
return Object.entries(omit(colors, colorsToExclude)).filter(([, value]) => typeof value === "object").map(([key]) => kebabCase(key));
|
|
258
60
|
};
|
|
259
|
-
const
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
"
|
|
269
|
-
"
|
|
270
|
-
"
|
|
271
|
-
"
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
const [, component, color] = match;
|
|
281
|
-
const camelComponent = upperFirst(camelCase(component));
|
|
282
|
-
if (!colors.includes(color) || safelistColors.includes(color)) {
|
|
283
|
-
continue;
|
|
284
|
-
}
|
|
285
|
-
let name = safelistComponentAliasesMap[camelComponent] ? safelistComponentAliasesMap[camelComponent] : camelComponent;
|
|
286
|
-
if (!components.includes(name)) {
|
|
287
|
-
continue;
|
|
288
|
-
}
|
|
289
|
-
name = name.replace(prefix, "").toLowerCase();
|
|
290
|
-
const matchClasses = safelistByComponent[name](color).flatMap((group) => {
|
|
291
|
-
return ["", ...group.variants || []].flatMap((variant) => {
|
|
292
|
-
const matches2 = group.pattern.source.match(/\(([^)]+)\)/g);
|
|
293
|
-
return matches2.map((match2) => {
|
|
294
|
-
const colorOptions = match2.substring(1, match2.length - 1).split("|");
|
|
295
|
-
return colorOptions.map((color2) => `${variant ? variant + ":" : ""}` + group.pattern.source.replace(match2, color2));
|
|
296
|
-
}).flat();
|
|
297
|
-
});
|
|
298
|
-
});
|
|
299
|
-
classes.push(...matchClasses);
|
|
61
|
+
const setGlobalColors = (theme) => {
|
|
62
|
+
const globalColors = {
|
|
63
|
+
...theme.colors || defaultColors$1,
|
|
64
|
+
...theme.extend?.colors
|
|
65
|
+
};
|
|
66
|
+
globalColors.primary = theme.extend.colors.primary = {
|
|
67
|
+
50: "rgb(var(--color-primary-50) / <alpha-value>)",
|
|
68
|
+
100: "rgb(var(--color-primary-100) / <alpha-value>)",
|
|
69
|
+
200: "rgb(var(--color-primary-200) / <alpha-value>)",
|
|
70
|
+
300: "rgb(var(--color-primary-300) / <alpha-value>)",
|
|
71
|
+
400: "rgb(var(--color-primary-400) / <alpha-value>)",
|
|
72
|
+
500: "rgb(var(--color-primary-500) / <alpha-value>)",
|
|
73
|
+
600: "rgb(var(--color-primary-600) / <alpha-value>)",
|
|
74
|
+
700: "rgb(var(--color-primary-700) / <alpha-value>)",
|
|
75
|
+
800: "rgb(var(--color-primary-800) / <alpha-value>)",
|
|
76
|
+
900: "rgb(var(--color-primary-900) / <alpha-value>)",
|
|
77
|
+
950: "rgb(var(--color-primary-950) / <alpha-value>)",
|
|
78
|
+
DEFAULT: "rgb(var(--color-primary-DEFAULT) / <alpha-value>)"
|
|
79
|
+
};
|
|
80
|
+
if (globalColors.gray) {
|
|
81
|
+
globalColors.cool = theme.extend.colors.cool = defaultColors$1.gray;
|
|
300
82
|
}
|
|
301
|
-
|
|
83
|
+
globalColors.gray = theme.extend.colors.gray = {
|
|
84
|
+
50: "rgb(var(--color-gray-50) / <alpha-value>)",
|
|
85
|
+
100: "rgb(var(--color-gray-100) / <alpha-value>)",
|
|
86
|
+
200: "rgb(var(--color-gray-200) / <alpha-value>)",
|
|
87
|
+
300: "rgb(var(--color-gray-300) / <alpha-value>)",
|
|
88
|
+
400: "rgb(var(--color-gray-400) / <alpha-value>)",
|
|
89
|
+
500: "rgb(var(--color-gray-500) / <alpha-value>)",
|
|
90
|
+
600: "rgb(var(--color-gray-600) / <alpha-value>)",
|
|
91
|
+
700: "rgb(var(--color-gray-700) / <alpha-value>)",
|
|
92
|
+
800: "rgb(var(--color-gray-800) / <alpha-value>)",
|
|
93
|
+
900: "rgb(var(--color-gray-900) / <alpha-value>)",
|
|
94
|
+
950: "rgb(var(--color-gray-950) / <alpha-value>)"
|
|
95
|
+
};
|
|
96
|
+
return excludeColors(globalColors);
|
|
302
97
|
};
|
|
303
98
|
|
|
304
|
-
|
|
99
|
+
async function installTailwind(moduleOptions, nuxt = useNuxt(), resolve = createResolver(import.meta.url).resolve) {
|
|
100
|
+
const runtimeDir = resolve("./runtime");
|
|
101
|
+
nuxt.hook("tailwindcss:config", function(tailwindConfig) {
|
|
102
|
+
tailwindConfig.theme = tailwindConfig.theme || {};
|
|
103
|
+
tailwindConfig.theme.extend = tailwindConfig.theme.extend || {};
|
|
104
|
+
tailwindConfig.theme.extend.colors = tailwindConfig.theme.extend.colors || {};
|
|
105
|
+
const colors = setGlobalColors(tailwindConfig.theme);
|
|
106
|
+
nuxt.options.appConfig.ui = {
|
|
107
|
+
primary: "green",
|
|
108
|
+
gray: "cool",
|
|
109
|
+
colors,
|
|
110
|
+
strategy: "merge"
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
const configTemplate = addTemplate({
|
|
114
|
+
filename: "nuxtui-tailwind.config.cjs",
|
|
115
|
+
write: true,
|
|
116
|
+
getContents: ({ nuxt: nuxt2 }) => `
|
|
117
|
+
const { defaultExtractor: createDefaultExtractor } = require('tailwindcss/lib/lib/defaultExtractor.js')
|
|
118
|
+
const { customSafelistExtractor, generateSafelist } = require(${JSON.stringify(resolve(runtimeDir, "utils", "colors"))})
|
|
119
|
+
const { iconsPlugin, getIconCollections } = require('@egoist/tailwindcss-icons')
|
|
120
|
+
|
|
121
|
+
const defaultExtractor = createDefaultExtractor({ tailwindConfig: { separator: ':' } })
|
|
122
|
+
|
|
123
|
+
module.exports = {
|
|
124
|
+
plugins: [
|
|
125
|
+
require('@tailwindcss/forms')({ strategy: 'class' }),
|
|
126
|
+
require('@tailwindcss/aspect-ratio'),
|
|
127
|
+
require('@tailwindcss/typography'),
|
|
128
|
+
require('@tailwindcss/container-queries'),
|
|
129
|
+
require('@headlessui/tailwindcss'),
|
|
130
|
+
iconsPlugin(${Array.isArray(moduleOptions.icons) || moduleOptions.icons === "all" ? `{ collections: getIconCollections(${JSON.stringify(moduleOptions.icons)}) }` : typeof moduleOptions.icons === "object" ? JSON.stringify(moduleOptions.icons) : {}})
|
|
131
|
+
],
|
|
132
|
+
content: {
|
|
133
|
+
files: [
|
|
134
|
+
${JSON.stringify(resolve(runtimeDir, "components/**/*.{vue,mjs,ts}"))},
|
|
135
|
+
${JSON.stringify(resolve(runtimeDir, "ui.config/**/*.{mjs,js,ts}"))}
|
|
136
|
+
],
|
|
137
|
+
transform: {
|
|
138
|
+
vue: (content) => {
|
|
139
|
+
return content.replaceAll(/(?:\\r\\n|\\r|\\n)/g, ' ')
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
extract: {
|
|
143
|
+
vue: (content) => {
|
|
144
|
+
return [
|
|
145
|
+
...defaultExtractor(content),
|
|
146
|
+
...customSafelistExtractor(${JSON.stringify(moduleOptions.prefix)}, content, ${JSON.stringify(nuxt2.options.appConfig.ui.colors)}, ${JSON.stringify(moduleOptions.safelistColors)})
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
safelist: generateSafelist(${JSON.stringify(moduleOptions.safelistColors || [])}, ${JSON.stringify(nuxt2.options.appConfig.ui.colors)}),
|
|
152
|
+
}
|
|
153
|
+
`
|
|
154
|
+
});
|
|
155
|
+
await installModule("@nuxtjs/tailwindcss", defu({
|
|
156
|
+
exposeConfig: true,
|
|
157
|
+
config: { darkMode: "class" },
|
|
158
|
+
configPath: [
|
|
159
|
+
configTemplate.dst,
|
|
160
|
+
join(nuxt.options.rootDir, "tailwind.config")
|
|
161
|
+
]
|
|
162
|
+
}, nuxt.options.tailwindcss));
|
|
163
|
+
}
|
|
164
|
+
|
|
305
165
|
const _require = createRequire(import.meta.url);
|
|
306
166
|
const defaultColors = _require("tailwindcss/colors.js");
|
|
307
167
|
delete defaultColors.lightBlue;
|
|
@@ -333,91 +193,10 @@ const module = defineNuxtModule({
|
|
|
333
193
|
if (!options.disableGlobalStyles) {
|
|
334
194
|
nuxt.options.css.push(resolve(runtimeDir, "ui.css"));
|
|
335
195
|
}
|
|
336
|
-
nuxt.hook("tailwindcss:config", function(tailwindConfig) {
|
|
337
|
-
tailwindConfig.theme = tailwindConfig.theme || {};
|
|
338
|
-
tailwindConfig.theme.extend = tailwindConfig.theme.extend || {};
|
|
339
|
-
tailwindConfig.theme.extend.colors = tailwindConfig.theme.extend.colors || {};
|
|
340
|
-
const globalColors = {
|
|
341
|
-
...tailwindConfig.theme.colors || defaultColors,
|
|
342
|
-
...tailwindConfig.theme.extend?.colors
|
|
343
|
-
};
|
|
344
|
-
globalColors.primary = tailwindConfig.theme.extend.colors.primary = {
|
|
345
|
-
50: "rgb(var(--color-primary-50) / <alpha-value>)",
|
|
346
|
-
100: "rgb(var(--color-primary-100) / <alpha-value>)",
|
|
347
|
-
200: "rgb(var(--color-primary-200) / <alpha-value>)",
|
|
348
|
-
300: "rgb(var(--color-primary-300) / <alpha-value>)",
|
|
349
|
-
400: "rgb(var(--color-primary-400) / <alpha-value>)",
|
|
350
|
-
500: "rgb(var(--color-primary-500) / <alpha-value>)",
|
|
351
|
-
600: "rgb(var(--color-primary-600) / <alpha-value>)",
|
|
352
|
-
700: "rgb(var(--color-primary-700) / <alpha-value>)",
|
|
353
|
-
800: "rgb(var(--color-primary-800) / <alpha-value>)",
|
|
354
|
-
900: "rgb(var(--color-primary-900) / <alpha-value>)",
|
|
355
|
-
950: "rgb(var(--color-primary-950) / <alpha-value>)",
|
|
356
|
-
DEFAULT: "rgb(var(--color-primary-DEFAULT) / <alpha-value>)"
|
|
357
|
-
};
|
|
358
|
-
if (globalColors.gray) {
|
|
359
|
-
globalColors.cool = tailwindConfig.theme.extend.colors.cool = defaultColors.gray;
|
|
360
|
-
}
|
|
361
|
-
globalColors.gray = tailwindConfig.theme.extend.colors.gray = {
|
|
362
|
-
50: "rgb(var(--color-gray-50) / <alpha-value>)",
|
|
363
|
-
100: "rgb(var(--color-gray-100) / <alpha-value>)",
|
|
364
|
-
200: "rgb(var(--color-gray-200) / <alpha-value>)",
|
|
365
|
-
300: "rgb(var(--color-gray-300) / <alpha-value>)",
|
|
366
|
-
400: "rgb(var(--color-gray-400) / <alpha-value>)",
|
|
367
|
-
500: "rgb(var(--color-gray-500) / <alpha-value>)",
|
|
368
|
-
600: "rgb(var(--color-gray-600) / <alpha-value>)",
|
|
369
|
-
700: "rgb(var(--color-gray-700) / <alpha-value>)",
|
|
370
|
-
800: "rgb(var(--color-gray-800) / <alpha-value>)",
|
|
371
|
-
900: "rgb(var(--color-gray-900) / <alpha-value>)",
|
|
372
|
-
950: "rgb(var(--color-gray-950) / <alpha-value>)"
|
|
373
|
-
};
|
|
374
|
-
const colors = excludeColors(globalColors);
|
|
375
|
-
nuxt.options.appConfig.ui = {
|
|
376
|
-
primary: "green",
|
|
377
|
-
gray: "cool",
|
|
378
|
-
colors,
|
|
379
|
-
strategy: "merge"
|
|
380
|
-
};
|
|
381
|
-
tailwindConfig.safelist = tailwindConfig.safelist || [];
|
|
382
|
-
tailwindConfig.safelist.push(...generateSafelist(options.safelistColors || [], colors));
|
|
383
|
-
});
|
|
384
196
|
createTemplates(nuxt);
|
|
385
197
|
await installModule("nuxt-icon");
|
|
386
198
|
await installModule("@nuxtjs/color-mode", { classSuffix: "" });
|
|
387
|
-
await
|
|
388
|
-
exposeConfig: true,
|
|
389
|
-
config: {
|
|
390
|
-
darkMode: "class",
|
|
391
|
-
plugins: [
|
|
392
|
-
require("@tailwindcss/forms")({ strategy: "class" }),
|
|
393
|
-
require("@tailwindcss/aspect-ratio"),
|
|
394
|
-
require("@tailwindcss/typography"),
|
|
395
|
-
require("@tailwindcss/container-queries"),
|
|
396
|
-
require("@headlessui/tailwindcss"),
|
|
397
|
-
iconsPlugin(Array.isArray(options.icons) || options.icons === "all" ? { collections: getIconCollections(options.icons) } : typeof options.icons === "object" ? options.icons : {})
|
|
398
|
-
],
|
|
399
|
-
content: {
|
|
400
|
-
files: [
|
|
401
|
-
resolve(runtimeDir, "components/**/*.{vue,mjs,ts}"),
|
|
402
|
-
resolve(runtimeDir, "ui.config/**/*.{mjs,js,ts}")
|
|
403
|
-
],
|
|
404
|
-
transform: {
|
|
405
|
-
vue: (content) => {
|
|
406
|
-
return content.replaceAll(/(?:\r\n|\r|\n)/g, " ");
|
|
407
|
-
}
|
|
408
|
-
},
|
|
409
|
-
extract: {
|
|
410
|
-
vue: (content) => {
|
|
411
|
-
return [
|
|
412
|
-
...defaultExtractor(content),
|
|
413
|
-
// @ts-ignore
|
|
414
|
-
...customSafelistExtractor(options.prefix, content, nuxt.options.appConfig.ui.colors, options.safelistColors)
|
|
415
|
-
];
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
});
|
|
199
|
+
await installTailwind(options, nuxt, resolve);
|
|
421
200
|
addPlugin({
|
|
422
201
|
src: resolve(runtimeDir, "plugins", "colors")
|
|
423
202
|
});
|