@nuxt/ui 0.4.1 → 2.8.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.md +9 -0
- package/README.md +63 -50
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +1234 -0
- package/dist/module.d.ts +1234 -0
- package/dist/module.json +8 -0
- package/dist/module.mjs +407 -0
- package/dist/runtime/app.config.d.ts +1203 -0
- package/dist/runtime/app.config.mjs +1057 -0
- package/dist/runtime/components/data/Table.vue +251 -0
- package/dist/runtime/components/data/Table.vue.d.ts +215 -0
- package/dist/runtime/components/elements/Accordion.vue +138 -0
- package/dist/runtime/components/elements/Accordion.vue.d.ts +80 -0
- package/dist/runtime/components/elements/Alert.vue +120 -0
- package/dist/runtime/components/elements/Alert.vue.d.ts +107 -0
- package/dist/runtime/components/elements/Avatar.vue +149 -0
- package/dist/runtime/components/elements/Avatar.vue.d.ts +115 -0
- package/dist/runtime/components/elements/AvatarGroup.d.ts +37 -0
- package/dist/runtime/components/elements/AvatarGroup.mjs +53 -0
- package/dist/runtime/components/elements/Badge.vue +69 -0
- package/dist/runtime/components/elements/Badge.vue.d.ts +63 -0
- package/dist/runtime/components/elements/Button.vue +182 -0
- package/dist/runtime/components/elements/Button.vue.d.ts +187 -0
- package/dist/runtime/components/elements/ButtonGroup.d.ts +39 -0
- package/dist/runtime/components/elements/ButtonGroup.mjs +70 -0
- package/dist/runtime/components/elements/Dropdown.vue +172 -0
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +96 -0
- package/dist/runtime/components/elements/Icon.vue +15 -0
- package/dist/runtime/components/elements/Icon.vue.d.ts +12 -0
- package/dist/runtime/components/elements/Kbd.vue +55 -0
- package/dist/runtime/components/elements/Kbd.vue.d.ts +42 -0
- package/dist/runtime/components/elements/Link.vue +80 -0
- package/dist/runtime/components/elements/Link.vue.d.ts +9 -0
- package/dist/runtime/components/forms/Checkbox.vue +136 -0
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +129 -0
- package/dist/runtime/components/forms/Form.vue +186 -0
- package/dist/runtime/components/forms/Form.vue.d.ts +50 -0
- package/dist/runtime/components/forms/FormGroup.vue +97 -0
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +98 -0
- package/dist/runtime/components/forms/Input.vue +250 -0
- package/dist/runtime/components/forms/Input.vue.d.ts +214 -0
- package/dist/runtime/components/forms/Radio.vue +122 -0
- package/dist/runtime/components/forms/Radio.vue.d.ts +109 -0
- package/dist/runtime/components/forms/Range.vue +163 -0
- package/dist/runtime/components/forms/Range.vue.d.ts +119 -0
- package/dist/runtime/components/forms/Select.vue +307 -0
- package/dist/runtime/components/forms/Select.vue.d.ts +229 -0
- package/dist/runtime/components/forms/SelectMenu.vue +429 -0
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +330 -0
- package/dist/runtime/components/forms/Textarea.vue +184 -0
- package/dist/runtime/components/forms/Textarea.vue.d.ts +161 -0
- package/dist/runtime/components/forms/Toggle.vue +113 -0
- package/dist/runtime/components/forms/Toggle.vue.d.ts +83 -0
- package/dist/runtime/components/layout/Card.vue +58 -0
- package/dist/runtime/components/layout/Card.vue.d.ts +31 -0
- package/dist/runtime/components/layout/Container.vue +43 -0
- package/dist/runtime/components/layout/Container.vue.d.ts +31 -0
- package/dist/runtime/components/layout/Skeleton.vue +37 -0
- package/dist/runtime/components/layout/Skeleton.vue.d.ts +22 -0
- package/dist/runtime/components/navigation/CommandPalette.vue +304 -0
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +224 -0
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue +152 -0
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +63 -0
- package/dist/runtime/components/navigation/Pagination.vue +197 -0
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +125 -0
- package/dist/runtime/components/navigation/Tabs.vue +138 -0
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +69 -0
- package/dist/runtime/components/navigation/VerticalNavigation.vue +79 -0
- package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +37 -0
- package/dist/runtime/components/overlays/ContextMenu.vue +74 -0
- package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +54 -0
- package/dist/runtime/components/overlays/Modal.vue +113 -0
- package/dist/runtime/components/overlays/Modal.vue.d.ts +82 -0
- package/dist/runtime/components/overlays/Notification.vue +197 -0
- package/dist/runtime/components/overlays/Notification.vue.d.ts +126 -0
- package/dist/runtime/components/overlays/Notifications.vue +61 -0
- package/dist/runtime/components/overlays/Notifications.vue.d.ts +41 -0
- package/dist/runtime/components/overlays/Popover.vue +139 -0
- package/dist/runtime/components/overlays/Popover.vue.d.ts +82 -0
- package/dist/runtime/components/overlays/Slideover.vue +103 -0
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +84 -0
- package/dist/runtime/components/overlays/Tooltip.vue +118 -0
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +82 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +13 -0
- package/dist/runtime/composables/defineShortcuts.mjs +108 -0
- package/dist/runtime/composables/useCopyToClipboard.d.ts +10 -0
- package/dist/runtime/composables/useCopyToClipboard.mjs +26 -0
- package/dist/runtime/composables/useFormGroup.d.ts +6 -0
- package/dist/runtime/composables/useFormGroup.mjs +30 -0
- package/dist/runtime/composables/usePopper.d.ts +232 -0
- package/dist/runtime/composables/usePopper.mjs +78 -0
- package/dist/runtime/composables/useShortcuts.d.ts +12 -0
- package/dist/runtime/composables/useShortcuts.mjs +24 -0
- package/dist/runtime/composables/useTimer.d.ts +8 -0
- package/dist/runtime/composables/useTimer.mjs +51 -0
- package/dist/runtime/composables/useToast.d.ts +18 -0
- package/dist/runtime/composables/useToast.mjs +22 -0
- package/dist/runtime/plugins/colors.d.ts +2 -0
- package/dist/runtime/plugins/colors.mjs +46 -0
- package/dist/runtime/types/accordion.d.ts +9 -0
- package/dist/runtime/types/avatar.d.ts +9 -0
- package/dist/runtime/types/button.d.ts +23 -0
- package/dist/runtime/types/clipboard.d.ts +3 -0
- package/dist/runtime/types/command-palette.d.ts +26 -0
- package/dist/runtime/types/dropdown.d.ts +13 -0
- package/dist/runtime/types/form.d.ts +21 -0
- package/dist/runtime/types/index.d.ts +12 -0
- package/dist/runtime/types/link.d.ts +8 -0
- package/dist/runtime/types/notification.d.ts +22 -0
- package/dist/runtime/types/popper.d.ts +14 -0
- package/dist/runtime/types/tabs.d.ts +6 -0
- package/dist/runtime/types/vertical-navigation.d.ts +11 -0
- package/dist/runtime/ui.css +13 -0
- package/dist/runtime/utils/StateEmitter.d.ts +17 -0
- package/dist/runtime/utils/StateEmitter.mjs +21 -0
- package/dist/runtime/utils/index.d.ts +11 -0
- package/dist/runtime/utils/index.mjs +33 -0
- package/dist/types.d.mts +15 -0
- package/dist/types.d.ts +15 -0
- package/package.json +56 -39
- package/LICENSE +0 -21
- package/dist/assets/styles.css +0 -14
- package/dist/components/NButton.vue +0 -22
- package/dist/components/NCard.vue +0 -5
- package/dist/components/NCheckbox.vue +0 -35
- package/dist/components/NDarkToggle.vue +0 -28
- package/dist/components/NDialog.vue +0 -59
- package/dist/components/NDropdown.vue +0 -31
- package/dist/components/NIcon.vue +0 -9
- package/dist/components/NLink.vue +0 -20
- package/dist/components/NRadio.vue +0 -40
- package/dist/components/NSwitch.vue +0 -37
- package/dist/components/NTextInput.vue +0 -34
- package/dist/components/NTip.vue +0 -16
- package/dist/components/NuxtContentLogo.vue +0 -7
- package/dist/components/NuxtExampleLayout.vue +0 -82
- package/dist/components/NuxtLogo.vue +0 -20
- package/dist/components/nuxt/NDarkToggle.vue +0 -28
- package/dist/nuxt.d.ts +0 -16
- package/dist/nuxt.mjs +0 -36
- package/dist/unocss.d.ts +0 -7
- package/dist/unocss.mjs +0 -127
- package/nuxt.cjs +0 -7
package/dist/module.json
ADDED
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import { defineNuxtModule, createResolver, resolvePath, installModule, addPlugin, addComponentsDir, addImportsDir } from '@nuxt/kit';
|
|
2
|
+
import defaultColors from 'tailwindcss/colors.js';
|
|
3
|
+
import { defaultExtractor as defaultExtractor$1 } from 'tailwindcss/lib/lib/defaultExtractor.js';
|
|
4
|
+
import { iconsPlugin, getIconCollections } from '@egoist/tailwindcss-icons';
|
|
5
|
+
import { omit, kebabCase, upperFirst, camelCase } from 'lodash-es';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// -- Unbuild CommonJS Shims --
|
|
10
|
+
import __cjs_url__ from 'url';
|
|
11
|
+
import __cjs_path__ from 'path';
|
|
12
|
+
import __cjs_mod__ from 'module';
|
|
13
|
+
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = __cjs_path__.dirname(__filename);
|
|
15
|
+
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
16
|
+
const name = "@nuxt/ui";
|
|
17
|
+
const version = "2.8.0";
|
|
18
|
+
|
|
19
|
+
const colorsToExclude = [
|
|
20
|
+
"inherit",
|
|
21
|
+
"transparent",
|
|
22
|
+
"current",
|
|
23
|
+
"white",
|
|
24
|
+
"black",
|
|
25
|
+
"slate",
|
|
26
|
+
"gray",
|
|
27
|
+
"zinc",
|
|
28
|
+
"neutral",
|
|
29
|
+
"stone",
|
|
30
|
+
"cool"
|
|
31
|
+
];
|
|
32
|
+
const safelistByComponent = {
|
|
33
|
+
alert: (colorsAsRegex2) => [{
|
|
34
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-50`)
|
|
35
|
+
}, {
|
|
36
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
37
|
+
variants: ["dark"]
|
|
38
|
+
}, {
|
|
39
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
40
|
+
}, {
|
|
41
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
42
|
+
variants: ["dark"]
|
|
43
|
+
}, {
|
|
44
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
45
|
+
}, {
|
|
46
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
47
|
+
variants: ["dark"]
|
|
48
|
+
}, {
|
|
49
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`)
|
|
50
|
+
}],
|
|
51
|
+
avatar: (colorsAsRegex2) => [{
|
|
52
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
53
|
+
variants: ["dark"]
|
|
54
|
+
}, {
|
|
55
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
56
|
+
}],
|
|
57
|
+
badge: (colorsAsRegex2) => [{
|
|
58
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-50`)
|
|
59
|
+
}, {
|
|
60
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
61
|
+
variants: ["dark"]
|
|
62
|
+
}, {
|
|
63
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
64
|
+
}, {
|
|
65
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
66
|
+
variants: ["dark"]
|
|
67
|
+
}, {
|
|
68
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
69
|
+
}, {
|
|
70
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
71
|
+
variants: ["dark"]
|
|
72
|
+
}, {
|
|
73
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`)
|
|
74
|
+
}],
|
|
75
|
+
button: (colorsAsRegex2) => [{
|
|
76
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-50`),
|
|
77
|
+
variants: ["hover", "disabled"]
|
|
78
|
+
}, {
|
|
79
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-100`),
|
|
80
|
+
variants: ["hover"]
|
|
81
|
+
}, {
|
|
82
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
83
|
+
variants: ["dark", "dark:disabled"]
|
|
84
|
+
}, {
|
|
85
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`),
|
|
86
|
+
variants: ["disabled", "dark:hover"]
|
|
87
|
+
}, {
|
|
88
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-600`),
|
|
89
|
+
variants: ["hover"]
|
|
90
|
+
}, {
|
|
91
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-900`),
|
|
92
|
+
variants: ["dark:hover"]
|
|
93
|
+
}, {
|
|
94
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-950`),
|
|
95
|
+
variants: ["dark", "dark:hover", "dark:disabled"]
|
|
96
|
+
}, {
|
|
97
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
98
|
+
variants: ["dark", "dark:disabled"]
|
|
99
|
+
}, {
|
|
100
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`),
|
|
101
|
+
variants: ["dark:hover", "disabled"]
|
|
102
|
+
}, {
|
|
103
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-600`),
|
|
104
|
+
variants: ["hover"]
|
|
105
|
+
}, {
|
|
106
|
+
pattern: new RegExp(`outline-(${colorsAsRegex2})-400`),
|
|
107
|
+
variants: ["dark:focus-visible"]
|
|
108
|
+
}, {
|
|
109
|
+
pattern: new RegExp(`outline-(${colorsAsRegex2})-500`),
|
|
110
|
+
variants: ["focus-visible"]
|
|
111
|
+
}, {
|
|
112
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
113
|
+
variants: ["dark:focus-visible"]
|
|
114
|
+
}, {
|
|
115
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
116
|
+
variants: ["focus-visible"]
|
|
117
|
+
}],
|
|
118
|
+
input: (colorsAsRegex2) => [{
|
|
119
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
120
|
+
variants: ["dark"]
|
|
121
|
+
}, {
|
|
122
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
123
|
+
}, {
|
|
124
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
125
|
+
variants: ["dark", "dark:focus"]
|
|
126
|
+
}, {
|
|
127
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
128
|
+
variants: ["focus"]
|
|
129
|
+
}],
|
|
130
|
+
radio: (colorsAsRegex2) => [{
|
|
131
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
132
|
+
variants: ["dark"]
|
|
133
|
+
}, {
|
|
134
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
135
|
+
}, {
|
|
136
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
137
|
+
variants: ["dark:focus-visible"]
|
|
138
|
+
}, {
|
|
139
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
140
|
+
variants: ["focus-visible"]
|
|
141
|
+
}],
|
|
142
|
+
checkbox: (colorsAsRegex2) => [{
|
|
143
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
144
|
+
variants: ["dark"]
|
|
145
|
+
}, {
|
|
146
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
147
|
+
}, {
|
|
148
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
149
|
+
variants: ["dark:focus-visible"]
|
|
150
|
+
}, {
|
|
151
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
152
|
+
variants: ["focus-visible"]
|
|
153
|
+
}],
|
|
154
|
+
toggle: (colorsAsRegex2) => [{
|
|
155
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
156
|
+
variants: ["dark"]
|
|
157
|
+
}, {
|
|
158
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
159
|
+
}, {
|
|
160
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
161
|
+
variants: ["dark"]
|
|
162
|
+
}, {
|
|
163
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
164
|
+
}, {
|
|
165
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
166
|
+
variants: ["dark:focus-visible"]
|
|
167
|
+
}, {
|
|
168
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
169
|
+
variants: ["focus-visible"]
|
|
170
|
+
}],
|
|
171
|
+
range: (colorsAsRegex2) => [{
|
|
172
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
173
|
+
variants: ["dark"]
|
|
174
|
+
}, {
|
|
175
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
176
|
+
}, {
|
|
177
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
178
|
+
variants: ["dark"]
|
|
179
|
+
}, {
|
|
180
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
181
|
+
}, {
|
|
182
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-400`),
|
|
183
|
+
variants: ["dark:focus-visible"]
|
|
184
|
+
}, {
|
|
185
|
+
pattern: new RegExp(`ring-(${colorsAsRegex2})-500`),
|
|
186
|
+
variants: ["focus-visible"]
|
|
187
|
+
}],
|
|
188
|
+
notification: (colorsAsRegex2) => [{
|
|
189
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-400`),
|
|
190
|
+
variants: ["dark"]
|
|
191
|
+
}, {
|
|
192
|
+
pattern: new RegExp(`bg-(${colorsAsRegex2})-500`)
|
|
193
|
+
}, {
|
|
194
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-400`),
|
|
195
|
+
variants: ["dark"]
|
|
196
|
+
}, {
|
|
197
|
+
pattern: new RegExp(`text-(${colorsAsRegex2})-500`)
|
|
198
|
+
}]
|
|
199
|
+
};
|
|
200
|
+
const safelistComponentAliasesMap = {
|
|
201
|
+
"USelect": "UInput",
|
|
202
|
+
"USelectMenu": "UInput",
|
|
203
|
+
"UTextarea": "UInput"
|
|
204
|
+
};
|
|
205
|
+
const colorsAsRegex = (colors) => colors.join("|");
|
|
206
|
+
const excludeColors = (colors) => {
|
|
207
|
+
return Object.entries(omit(colors, colorsToExclude)).filter(([, value]) => typeof value === "object").map(([key]) => kebabCase(key));
|
|
208
|
+
};
|
|
209
|
+
const generateSafelist = (colors, globalColors) => {
|
|
210
|
+
const baseSafelist = Object.keys(safelistByComponent).flatMap((component) => safelistByComponent[component](colorsAsRegex(colors)));
|
|
211
|
+
const formsSafelist = ["input", "radio", "checkbox", "toggle", "range"].flatMap((component) => safelistByComponent[component](colorsAsRegex(["red"])));
|
|
212
|
+
return [
|
|
213
|
+
...baseSafelist,
|
|
214
|
+
...formsSafelist,
|
|
215
|
+
// Ensure all global colors are safelisted for the Notification (toast.add)
|
|
216
|
+
...safelistByComponent["notification"](colorsAsRegex(globalColors)),
|
|
217
|
+
// Gray safelist for Avatar & Notification
|
|
218
|
+
"bg-gray-500",
|
|
219
|
+
"dark:bg-gray-400",
|
|
220
|
+
"text-gray-500",
|
|
221
|
+
"dark:text-gray-400"
|
|
222
|
+
];
|
|
223
|
+
};
|
|
224
|
+
const customSafelistExtractor = (prefix, content, colors, safelistColors) => {
|
|
225
|
+
const classes = [];
|
|
226
|
+
const regex = /<([A-Za-z][A-Za-z0-9]*(?:-[A-Za-z][A-Za-z0-9]*)*)\s+(?![^>]*:color\b)[^>]*\bcolor=["']([^"']+)["'][^>]*>/gs;
|
|
227
|
+
const matches = content.matchAll(regex);
|
|
228
|
+
const components = Object.keys(safelistByComponent).map((component) => `${prefix}${component.charAt(0).toUpperCase() + component.slice(1)}`);
|
|
229
|
+
for (const match of matches) {
|
|
230
|
+
const [, component, color] = match;
|
|
231
|
+
const camelComponent = upperFirst(camelCase(component));
|
|
232
|
+
if (!colors.includes(color) || safelistColors.includes(color)) {
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
let name = safelistComponentAliasesMap[camelComponent] ? safelistComponentAliasesMap[camelComponent] : camelComponent;
|
|
236
|
+
if (!components.includes(name)) {
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
name = name.replace(prefix, "").toLowerCase();
|
|
240
|
+
const matchClasses = safelistByComponent[name](color).flatMap((group) => {
|
|
241
|
+
return ["", ...group.variants || []].flatMap((variant) => {
|
|
242
|
+
const matches2 = group.pattern.source.match(/\(([^)]+)\)/g);
|
|
243
|
+
return matches2.map((match2) => {
|
|
244
|
+
const colorOptions = match2.substring(1, match2.length - 1).split("|");
|
|
245
|
+
return colorOptions.map((color2) => `${variant ? variant + ":" : ""}` + group.pattern.source.replace(match2, color2));
|
|
246
|
+
}).flat();
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
classes.push(...matchClasses);
|
|
250
|
+
}
|
|
251
|
+
return classes;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
const defaultExtractor = defaultExtractor$1({ tailwindConfig: { separator: ":" } });
|
|
255
|
+
delete defaultColors.lightBlue;
|
|
256
|
+
delete defaultColors.warmGray;
|
|
257
|
+
delete defaultColors.trueGray;
|
|
258
|
+
delete defaultColors.coolGray;
|
|
259
|
+
delete defaultColors.blueGray;
|
|
260
|
+
const module = defineNuxtModule({
|
|
261
|
+
meta: {
|
|
262
|
+
name,
|
|
263
|
+
version,
|
|
264
|
+
configKey: "ui",
|
|
265
|
+
compatibility: {
|
|
266
|
+
nuxt: "^3.0.0-rc.8"
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
defaults: {
|
|
270
|
+
prefix: "U",
|
|
271
|
+
icons: ["heroicons"],
|
|
272
|
+
safelistColors: ["primary"]
|
|
273
|
+
},
|
|
274
|
+
async setup(options, nuxt) {
|
|
275
|
+
const { resolve } = createResolver(import.meta.url);
|
|
276
|
+
const runtimeDir = resolve("./runtime");
|
|
277
|
+
nuxt.options.build.transpile.push(runtimeDir);
|
|
278
|
+
nuxt.options.build.transpile.push("@popperjs/core", "@headlessui/vue");
|
|
279
|
+
nuxt.options.css.push(resolve(runtimeDir, "ui.css"));
|
|
280
|
+
const appConfigFile = await resolvePath(resolve(runtimeDir, "app.config"));
|
|
281
|
+
nuxt.hook("app:resolve", (app) => {
|
|
282
|
+
app.configs.push(appConfigFile);
|
|
283
|
+
});
|
|
284
|
+
nuxt.hook("tailwindcss:config", function(tailwindConfig) {
|
|
285
|
+
const globalColors = {
|
|
286
|
+
...tailwindConfig.theme.colors || defaultColors,
|
|
287
|
+
...tailwindConfig.theme.extend?.colors
|
|
288
|
+
};
|
|
289
|
+
tailwindConfig.theme.extend.colors = tailwindConfig.theme.extend.colors || {};
|
|
290
|
+
globalColors.primary = tailwindConfig.theme.extend.colors.primary = {
|
|
291
|
+
50: "rgb(var(--color-primary-50) / <alpha-value>)",
|
|
292
|
+
100: "rgb(var(--color-primary-100) / <alpha-value>)",
|
|
293
|
+
200: "rgb(var(--color-primary-200) / <alpha-value>)",
|
|
294
|
+
300: "rgb(var(--color-primary-300) / <alpha-value>)",
|
|
295
|
+
400: "rgb(var(--color-primary-400) / <alpha-value>)",
|
|
296
|
+
500: "rgb(var(--color-primary-500) / <alpha-value>)",
|
|
297
|
+
600: "rgb(var(--color-primary-600) / <alpha-value>)",
|
|
298
|
+
700: "rgb(var(--color-primary-700) / <alpha-value>)",
|
|
299
|
+
800: "rgb(var(--color-primary-800) / <alpha-value>)",
|
|
300
|
+
900: "rgb(var(--color-primary-900) / <alpha-value>)",
|
|
301
|
+
950: "rgb(var(--color-primary-950) / <alpha-value>)",
|
|
302
|
+
DEFAULT: "rgb(var(--color-primary-DEFAULT) / <alpha-value>)"
|
|
303
|
+
};
|
|
304
|
+
if (globalColors.gray) {
|
|
305
|
+
globalColors.cool = tailwindConfig.theme.extend.colors.cool = defaultColors.gray;
|
|
306
|
+
}
|
|
307
|
+
globalColors.gray = tailwindConfig.theme.extend.colors.gray = {
|
|
308
|
+
50: "rgb(var(--color-gray-50) / <alpha-value>)",
|
|
309
|
+
100: "rgb(var(--color-gray-100) / <alpha-value>)",
|
|
310
|
+
200: "rgb(var(--color-gray-200) / <alpha-value>)",
|
|
311
|
+
300: "rgb(var(--color-gray-300) / <alpha-value>)",
|
|
312
|
+
400: "rgb(var(--color-gray-400) / <alpha-value>)",
|
|
313
|
+
500: "rgb(var(--color-gray-500) / <alpha-value>)",
|
|
314
|
+
600: "rgb(var(--color-gray-600) / <alpha-value>)",
|
|
315
|
+
700: "rgb(var(--color-gray-700) / <alpha-value>)",
|
|
316
|
+
800: "rgb(var(--color-gray-800) / <alpha-value>)",
|
|
317
|
+
900: "rgb(var(--color-gray-900) / <alpha-value>)",
|
|
318
|
+
950: "rgb(var(--color-gray-950) / <alpha-value>)"
|
|
319
|
+
};
|
|
320
|
+
const colors = excludeColors(globalColors);
|
|
321
|
+
nuxt.options.appConfig.ui = {
|
|
322
|
+
...nuxt.options.appConfig.ui,
|
|
323
|
+
primary: "green",
|
|
324
|
+
gray: "cool",
|
|
325
|
+
colors
|
|
326
|
+
};
|
|
327
|
+
tailwindConfig.safelist = tailwindConfig.safelist || [];
|
|
328
|
+
tailwindConfig.safelist.push(...generateSafelist(options.safelistColors, colors));
|
|
329
|
+
tailwindConfig.plugins = tailwindConfig.plugins || [];
|
|
330
|
+
tailwindConfig.plugins.push(iconsPlugin({ collections: getIconCollections(options.icons) }));
|
|
331
|
+
});
|
|
332
|
+
await installModule("@nuxtjs/color-mode", { classSuffix: "" });
|
|
333
|
+
await installModule("@nuxtjs/tailwindcss", {
|
|
334
|
+
exposeConfig: true,
|
|
335
|
+
config: {
|
|
336
|
+
darkMode: "class",
|
|
337
|
+
plugins: [
|
|
338
|
+
require("@tailwindcss/forms")({ strategy: "class" }),
|
|
339
|
+
require("@tailwindcss/aspect-ratio"),
|
|
340
|
+
require("@tailwindcss/typography"),
|
|
341
|
+
require("@tailwindcss/container-queries")
|
|
342
|
+
],
|
|
343
|
+
content: {
|
|
344
|
+
files: [
|
|
345
|
+
resolve(runtimeDir, "components/**/*.{vue,mjs,ts}"),
|
|
346
|
+
resolve(runtimeDir, "*.{mjs,js,ts}")
|
|
347
|
+
],
|
|
348
|
+
transform: {
|
|
349
|
+
vue: (content) => {
|
|
350
|
+
return content.replaceAll(/(?:\r\n|\r|\n)/g, " ");
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
extract: {
|
|
354
|
+
vue: (content) => {
|
|
355
|
+
return [
|
|
356
|
+
...defaultExtractor(content),
|
|
357
|
+
...customSafelistExtractor(options.prefix, content, nuxt.options.appConfig.ui.colors, options.safelistColors)
|
|
358
|
+
];
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
addPlugin({
|
|
365
|
+
src: resolve(runtimeDir, "plugins", "colors")
|
|
366
|
+
});
|
|
367
|
+
addComponentsDir({
|
|
368
|
+
path: resolve(runtimeDir, "components", "elements"),
|
|
369
|
+
prefix: options.prefix,
|
|
370
|
+
global: options.global,
|
|
371
|
+
watch: false
|
|
372
|
+
});
|
|
373
|
+
addComponentsDir({
|
|
374
|
+
path: resolve(runtimeDir, "components", "forms"),
|
|
375
|
+
prefix: options.prefix,
|
|
376
|
+
global: options.global,
|
|
377
|
+
watch: false
|
|
378
|
+
});
|
|
379
|
+
addComponentsDir({
|
|
380
|
+
path: resolve(runtimeDir, "components", "data"),
|
|
381
|
+
prefix: options.prefix,
|
|
382
|
+
global: options.global,
|
|
383
|
+
watch: false
|
|
384
|
+
});
|
|
385
|
+
addComponentsDir({
|
|
386
|
+
path: resolve(runtimeDir, "components", "layout"),
|
|
387
|
+
prefix: options.prefix,
|
|
388
|
+
global: options.global,
|
|
389
|
+
watch: false
|
|
390
|
+
});
|
|
391
|
+
addComponentsDir({
|
|
392
|
+
path: resolve(runtimeDir, "components", "navigation"),
|
|
393
|
+
prefix: options.prefix,
|
|
394
|
+
global: options.global,
|
|
395
|
+
watch: false
|
|
396
|
+
});
|
|
397
|
+
addComponentsDir({
|
|
398
|
+
path: resolve(runtimeDir, "components", "overlays"),
|
|
399
|
+
prefix: options.prefix,
|
|
400
|
+
global: options.global,
|
|
401
|
+
watch: false
|
|
402
|
+
});
|
|
403
|
+
addImportsDir(resolve(runtimeDir, "composables"));
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
export { module as default };
|