@nuxt/ui 4.11.1 → 4.11.2
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 +3 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Accordion.d.vue.ts +1 -1
- package/dist/runtime/components/Accordion.vue.d.ts +1 -1
- package/dist/runtime/components/Breadcrumb.d.vue.ts +1 -1
- package/dist/runtime/components/Breadcrumb.vue.d.ts +1 -1
- package/dist/runtime/components/Carousel.d.vue.ts +1 -1
- package/dist/runtime/components/Carousel.vue.d.ts +1 -1
- package/dist/runtime/components/CheckboxGroup.d.vue.ts +1 -1
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +1 -1
- package/dist/runtime/components/CommandPalette.d.vue.ts +1 -1
- package/dist/runtime/components/CommandPalette.vue.d.ts +1 -1
- package/dist/runtime/components/ContextMenu.d.vue.ts +1 -1
- package/dist/runtime/components/ContextMenu.vue.d.ts +1 -1
- package/dist/runtime/components/DashboardNavbar.vue +1 -1
- package/dist/runtime/components/DropdownMenu.d.vue.ts +1 -1
- package/dist/runtime/components/DropdownMenu.vue.d.ts +1 -1
- package/dist/runtime/components/FooterColumns.d.vue.ts +1 -1
- package/dist/runtime/components/FooterColumns.vue.d.ts +1 -1
- package/dist/runtime/components/Form.vue +1 -1
- package/dist/runtime/components/Input.vue +5 -5
- package/dist/runtime/components/InputDate.vue +12 -6
- package/dist/runtime/components/InputMenu.d.vue.ts +1 -1
- package/dist/runtime/components/InputMenu.vue +18 -7
- package/dist/runtime/components/InputMenu.vue.d.ts +1 -1
- package/dist/runtime/components/InputTime.vue +12 -6
- package/dist/runtime/components/LinkBase.vue +3 -1
- package/dist/runtime/components/Listbox.d.vue.ts +1 -1
- package/dist/runtime/components/Listbox.vue.d.ts +1 -1
- package/dist/runtime/components/NavigationMenu.d.vue.ts +1 -1
- package/dist/runtime/components/NavigationMenu.vue.d.ts +1 -1
- package/dist/runtime/components/PageAnchors.d.vue.ts +1 -1
- package/dist/runtime/components/PageAnchors.vue.d.ts +1 -1
- package/dist/runtime/components/PageLinks.d.vue.ts +1 -1
- package/dist/runtime/components/PageLinks.vue.d.ts +1 -1
- package/dist/runtime/components/PinInput.d.vue.ts +3 -1
- package/dist/runtime/components/PinInput.vue +15 -7
- package/dist/runtime/components/PinInput.vue.d.ts +3 -1
- package/dist/runtime/components/ProgressGroup.d.vue.ts +1 -1
- package/dist/runtime/components/ProgressGroup.vue.d.ts +1 -1
- package/dist/runtime/components/RadioGroup.d.vue.ts +1 -1
- package/dist/runtime/components/RadioGroup.vue.d.ts +1 -1
- package/dist/runtime/components/Select.d.vue.ts +1 -1
- package/dist/runtime/components/Select.vue.d.ts +1 -1
- package/dist/runtime/components/SelectMenu.d.vue.ts +1 -1
- package/dist/runtime/components/SelectMenu.vue +15 -2
- package/dist/runtime/components/SelectMenu.vue.d.ts +1 -1
- package/dist/runtime/components/Splitter.d.vue.ts +1 -1
- package/dist/runtime/components/Splitter.vue.d.ts +1 -1
- package/dist/runtime/components/Stepper.d.vue.ts +1 -1
- package/dist/runtime/components/Stepper.vue.d.ts +1 -1
- package/dist/runtime/components/Table.vue +24 -2
- package/dist/runtime/components/Tabs.d.vue.ts +1 -1
- package/dist/runtime/components/Tabs.vue.d.ts +1 -1
- package/dist/runtime/components/Textarea.vue +5 -5
- package/dist/runtime/components/Timeline.d.vue.ts +1 -1
- package/dist/runtime/components/Timeline.vue.d.ts +1 -1
- package/dist/runtime/components/Toaster.vue +1 -1
- package/dist/runtime/components/Tree.d.vue.ts +1 -1
- package/dist/runtime/components/Tree.vue +1 -1
- package/dist/runtime/components/Tree.vue.d.ts +1 -1
- package/dist/runtime/components/content/ContentNavigation.d.vue.ts +1 -1
- package/dist/runtime/components/content/ContentNavigation.vue.d.ts +1 -1
- package/dist/runtime/components/content/ContentSurround.d.vue.ts +1 -1
- package/dist/runtime/components/content/ContentSurround.vue.d.ts +1 -1
- package/dist/runtime/components/content/ContentToc.d.vue.ts +1 -1
- package/dist/runtime/components/content/ContentToc.vue.d.ts +1 -1
- package/dist/runtime/composables/useForwardProps.js +2 -2
- package/dist/runtime/composables/useResizable.js +1 -1
- package/dist/runtime/utils/virtualizer.d.ts +1 -1
- package/dist/runtime/utils/virtualizer.js +9 -11
- package/dist/runtime/vue/overrides/inertia/LinkBase.vue +3 -1
- package/dist/shared/{ui.DCJ9twx8.mjs → ui.oNygBd3N.mjs} +28 -1
- package/dist/unplugin.d.mts +2 -1
- package/dist/unplugin.mjs +22 -10
- package/dist/vite.mjs +1 -1
- package/package.json +55 -59
- package/cli/commands/make/component.mjs +0 -86
- package/cli/commands/make/index.mjs +0 -14
- package/cli/commands/make/locale.mjs +0 -93
- package/cli/index.mjs +0 -15
- package/cli/package.json +0 -13
- package/cli/templates.mjs +0 -256
- package/cli/utils.mjs +0 -50
package/dist/unplugin.d.mts
CHANGED
|
@@ -123,7 +123,8 @@ interface NuxtUIOptions extends Omit<ModuleOptions, 'fonts' | 'colorMode' | 'con
|
|
|
123
123
|
root?: string;
|
|
124
124
|
}
|
|
125
125
|
declare const runtimeDir: string;
|
|
126
|
+
declare const runtimeUrl: string;
|
|
126
127
|
declare const NuxtUIPlugin: unplugin.UnpluginInstance<NuxtUIOptions | undefined, boolean>;
|
|
127
128
|
|
|
128
|
-
export { NuxtUIPlugin, runtimeDir };
|
|
129
|
+
export { NuxtUIPlugin, runtimeDir, runtimeUrl };
|
|
129
130
|
export type { NuxtUIOptions };
|
package/dist/unplugin.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { fileURLToPath } from 'node:url';
|
|
1
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
2
2
|
import { join, normalize, relative } from 'pathe';
|
|
3
3
|
import { createUnplugin } from 'unplugin';
|
|
4
4
|
import { defu } from 'defu';
|
|
5
5
|
import tailwind from '@tailwindcss/vite';
|
|
6
|
-
import { e as getTemplates, h as resolveExtraScanDirs, b as detectUsedComponents, f as publicComposables, g as getClientBundleIcons, p as parseIconName, d as defaultOptions, r as resolveColors, c as getDefaultConfig } from './shared/ui.
|
|
6
|
+
import { e as getTemplates, h as resolveExtraScanDirs, b as detectUsedComponents, f as publicComposables, g as getClientBundleIcons, p as parseIconName, d as defaultOptions, r as resolveColors, c as getDefaultConfig } from './shared/ui.oNygBd3N.mjs';
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import { consola } from 'consola';
|
|
@@ -99,11 +99,11 @@ function TemplatePlugin(options, appConfig, componentDir) {
|
|
|
99
99
|
|
|
100
100
|
function PluginsPlugin(options) {
|
|
101
101
|
const plugins = globSync(["**/*", "!*.d.ts"], { cwd: join(runtimeDir, "plugins"), absolute: true });
|
|
102
|
-
plugins.unshift(resolvePathSync("
|
|
103
|
-
plugins.unshift(resolvePathSync("
|
|
104
|
-
plugins.unshift(resolvePathSync("
|
|
102
|
+
plugins.unshift(resolvePathSync("./vue/plugins/router", { extensions: [".ts", ".mjs", ".js"], url: runtimeUrl }));
|
|
103
|
+
plugins.unshift(resolvePathSync("./vue/plugins/head", { extensions: [".ts", ".mjs", ".js"], url: runtimeUrl }));
|
|
104
|
+
plugins.unshift(resolvePathSync("./vue/plugins/icons", { extensions: [".ts", ".mjs", ".js"], url: runtimeUrl }));
|
|
105
105
|
if (options.colorMode) {
|
|
106
|
-
plugins.push(resolvePathSync("
|
|
106
|
+
plugins.push(resolvePathSync("./vue/plugins/color-mode", { extensions: [".ts", ".mjs", ".js"], url: runtimeUrl }));
|
|
107
107
|
}
|
|
108
108
|
const proseComponents = options.prose || options.mdc ? globSync(["**/*.vue"], { cwd: join(runtimeDir, "components/prose"), absolute: true }) : [];
|
|
109
109
|
return {
|
|
@@ -222,7 +222,8 @@ function createComponentSource(cwd, prefix, ignore = []) {
|
|
|
222
222
|
const relativePath = paths.get(componentName);
|
|
223
223
|
if (!relativePath) return;
|
|
224
224
|
return join(cwd, relativePath);
|
|
225
|
-
}
|
|
225
|
+
},
|
|
226
|
+
resolvePath: (relativePath) => files.includes(relativePath) ? join(cwd, relativePath) : void 0
|
|
226
227
|
};
|
|
227
228
|
}
|
|
228
229
|
function ComponentImportPlugin(options, meta) {
|
|
@@ -239,6 +240,7 @@ function ComponentImportPlugin(options, meta) {
|
|
|
239
240
|
colorModeIgnore
|
|
240
241
|
);
|
|
241
242
|
const overrideSources = [routerOverrides[routerMode], unpluginComponents].filter((s) => !!s);
|
|
243
|
+
const componentsDir = `${join(runtimeDir, "components")}/`;
|
|
242
244
|
const internalResolverPlugin = {
|
|
243
245
|
/**
|
|
244
246
|
* This plugin aims to ensure we override certain components with Vue-compatible versions:
|
|
@@ -247,6 +249,15 @@ function ComponentImportPlugin(options, meta) {
|
|
|
247
249
|
name: "nuxt:ui:components",
|
|
248
250
|
enforce: "pre",
|
|
249
251
|
resolveId(id, importer) {
|
|
252
|
+
const normalizedId = normalize(id);
|
|
253
|
+
const packagePath = normalizedId.match(PACKAGE_IMPORT_RE)?.[1] ?? (normalizedId.startsWith(componentsDir) && normalizedId.endsWith(".vue") ? normalizedId.slice(componentsDir.length) : void 0);
|
|
254
|
+
if (packagePath) {
|
|
255
|
+
for (const source of overrideSources) {
|
|
256
|
+
const resolved = source.resolvePath(packagePath);
|
|
257
|
+
if (resolved) return resolved;
|
|
258
|
+
}
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
250
261
|
if (!importer || !normalize(importer).includes(runtimeDir)) {
|
|
251
262
|
return;
|
|
252
263
|
}
|
|
@@ -303,11 +314,11 @@ function ComponentImportPlugin(options, meta) {
|
|
|
303
314
|
];
|
|
304
315
|
}
|
|
305
316
|
const RELATIVE_IMPORT_RE = /^\.{1,2}\//;
|
|
317
|
+
const PACKAGE_IMPORT_RE = /(?:^|\/node_modules\/)@nuxt\/ui\/(?:dist\/)?(?:runtime\/)?components\/(.+\.vue)$/;
|
|
306
318
|
|
|
307
319
|
function NuxtEnvironmentPlugin(options) {
|
|
308
320
|
const routerMode = resolveRouterMode(options);
|
|
309
|
-
const
|
|
310
|
-
const stubPath = resolvePathSync(stubsPath, { extensions: [".ts", ".mjs", ".js"], url: import.meta.url });
|
|
321
|
+
const stubPath = resolvePathSync(`./vue/stubs/${routerMode}`, { extensions: [".ts", ".mjs", ".js"], url: runtimeUrl });
|
|
311
322
|
return {
|
|
312
323
|
name: "nuxt:ui",
|
|
313
324
|
enforce: "pre",
|
|
@@ -443,6 +454,7 @@ function IconsPlugin(options, appConfig) {
|
|
|
443
454
|
}
|
|
444
455
|
|
|
445
456
|
const runtimeDir = normalize(fileURLToPath(new URL("./runtime", import.meta.url)));
|
|
457
|
+
const runtimeUrl = pathToFileURL(`${runtimeDir}/`).href;
|
|
446
458
|
const NuxtUIPlugin = createUnplugin((_options = {}, meta) => {
|
|
447
459
|
const options = defu(_options, { fonts: false }, defaultOptions);
|
|
448
460
|
options.theme = options.theme || {};
|
|
@@ -475,4 +487,4 @@ const NuxtUIPlugin = createUnplugin((_options = {}, meta) => {
|
|
|
475
487
|
].flat(1);
|
|
476
488
|
});
|
|
477
489
|
|
|
478
|
-
export { NuxtUIPlugin, runtimeDir };
|
|
490
|
+
export { NuxtUIPlugin, runtimeDir, runtimeUrl };
|
package/dist/vite.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/ui",
|
|
3
3
|
"description": "A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.",
|
|
4
|
-
"version": "4.11.
|
|
5
|
-
"packageManager": "pnpm@11.25.0",
|
|
4
|
+
"version": "4.11.2",
|
|
6
5
|
"repository": {
|
|
7
6
|
"type": "git",
|
|
8
7
|
"url": "git+https://github.com/nuxt/ui.git"
|
|
@@ -93,9 +92,6 @@
|
|
|
93
92
|
"imports": {
|
|
94
93
|
"#build/ui.css": "./.nuxt/ui.static.css"
|
|
95
94
|
},
|
|
96
|
-
"bin": {
|
|
97
|
-
"nuxt-ui": "./cli/index.mjs"
|
|
98
|
-
},
|
|
99
95
|
"style": "./dist/runtime/index.css",
|
|
100
96
|
"main": "./dist/module.mjs",
|
|
101
97
|
"sideEffects": [
|
|
@@ -104,35 +100,11 @@
|
|
|
104
100
|
"files": [
|
|
105
101
|
".nuxt/ui.static.css",
|
|
106
102
|
"dist",
|
|
107
|
-
"cli",
|
|
108
103
|
"vue-plugin.d.ts"
|
|
109
104
|
],
|
|
110
|
-
"scripts": {
|
|
111
|
-
"build": "nuxt-module-build build",
|
|
112
|
-
"prepack": "pnpm build",
|
|
113
|
-
"dev": "nuxt dev playgrounds/nuxt --uiDev",
|
|
114
|
-
"dev:build": "nuxt build playgrounds/nuxt",
|
|
115
|
-
"dev:vue": "pnpm --filter './playgrounds/vue' dev -- --uiDev",
|
|
116
|
-
"dev:vue:build": "pnpm --filter './playgrounds/vue' build",
|
|
117
|
-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playgrounds/nuxt && nuxt prepare docs && pnpm dev:vue:build",
|
|
118
|
-
"repl": "pnpm --filter './playgrounds/repl' dev",
|
|
119
|
-
"repl:bundle": "pnpm --filter './playgrounds/repl' bundle",
|
|
120
|
-
"repl:build": "pnpm --filter './playgrounds/repl' build",
|
|
121
|
-
"repl:prepare": "nuxt-module-build build --stub && mkdir -p .nuxt && echo '{\"compilerOptions\":{}}' > .nuxt/tsconfig.json",
|
|
122
|
-
"docs": "nuxt dev docs --uiDev",
|
|
123
|
-
"docs:build": "nuxt build docs",
|
|
124
|
-
"lint": "eslint .",
|
|
125
|
-
"lint:fix": "eslint . --fix",
|
|
126
|
-
"typecheck": "vue-tsc --noEmit && nuxt typecheck playgrounds/nuxt && nuxt typecheck docs && cd playgrounds/vue && vue-tsc --noEmit",
|
|
127
|
-
"test": "vitest",
|
|
128
|
-
"test:vue": "vitest --project vue",
|
|
129
|
-
"test:nuxt": "vitest --project nuxt",
|
|
130
|
-
"bench": "vitest bench --project vue",
|
|
131
|
-
"release": "release-it"
|
|
132
|
-
},
|
|
133
105
|
"dependencies": {
|
|
134
106
|
"@floating-ui/dom": "^1.8.0",
|
|
135
|
-
"@iconify/vue": "^5.0.
|
|
107
|
+
"@iconify/vue": "^5.0.2",
|
|
136
108
|
"@internationalized/date": "^3.12.4",
|
|
137
109
|
"@internationalized/number": "^3.6.8",
|
|
138
110
|
"@nuxt/fonts": "^0.14.0",
|
|
@@ -144,7 +116,7 @@
|
|
|
144
116
|
"@tailwindcss/postcss": "^4.3.3",
|
|
145
117
|
"@tailwindcss/vite": "^4.3.3",
|
|
146
118
|
"@tanstack/vue-table": "^8.21.3",
|
|
147
|
-
"@tanstack/vue-virtual": "^3.13.
|
|
119
|
+
"@tanstack/vue-virtual": "^3.13.39",
|
|
148
120
|
"@tiptap/core": "^3.31.3",
|
|
149
121
|
"@tiptap/extension-bubble-menu": "^3.31.3",
|
|
150
122
|
"@tiptap/extension-code": "^3.31.3",
|
|
@@ -162,7 +134,7 @@
|
|
|
162
134
|
"@tiptap/starter-kit": "^3.31.3",
|
|
163
135
|
"@tiptap/suggestion": "^3.31.3",
|
|
164
136
|
"@tiptap/vue-3": "^3.31.3",
|
|
165
|
-
"@unhead/vue": "^3.4.
|
|
137
|
+
"@unhead/vue": "^3.4.1",
|
|
166
138
|
"@vueuse/core": "^14.4.0",
|
|
167
139
|
"@vueuse/integrations": "^14.4.0",
|
|
168
140
|
"@vueuse/shared": "^14.4.0",
|
|
@@ -177,21 +149,21 @@
|
|
|
177
149
|
"embla-carousel-vue": "^8.6.0",
|
|
178
150
|
"embla-carousel-wheel-gestures": "^8.1.0",
|
|
179
151
|
"fuse.js": "^7.5.0",
|
|
180
|
-
"hookable": "^6.1.
|
|
152
|
+
"hookable": "^6.1.2",
|
|
181
153
|
"knitwork": "^1.3.0",
|
|
182
|
-
"magic-string": "^1.
|
|
154
|
+
"magic-string": "^1.4.1",
|
|
183
155
|
"mlly": "^1.8.2",
|
|
184
|
-
"motion-v": "^2.4.
|
|
156
|
+
"motion-v": "^2.4.4",
|
|
185
157
|
"ohash": "^2.0.12",
|
|
186
158
|
"pathe": "^2.0.3",
|
|
187
159
|
"reka-ui": "2.10.4",
|
|
188
160
|
"scule": "^1.3.0",
|
|
189
|
-
"tailwind-merge": "^3.
|
|
161
|
+
"tailwind-merge": "^3.7.0",
|
|
190
162
|
"tailwind-variants": "^3.2.2",
|
|
191
163
|
"tailwindcss": "^4.3.3",
|
|
192
164
|
"tinyglobby": "^0.2.17",
|
|
193
165
|
"ufo": "^1.6.4",
|
|
194
|
-
"unplugin": "^3.
|
|
166
|
+
"unplugin": "^3.4.0",
|
|
195
167
|
"unplugin-auto-import": "^21.1.0",
|
|
196
168
|
"unplugin-vue-components": "^32.1.0",
|
|
197
169
|
"vaul-vue": "0.4.1",
|
|
@@ -201,29 +173,30 @@
|
|
|
201
173
|
"@codspeed/vitest-plugin": "^5.7.1",
|
|
202
174
|
"@nuxt/eslint-config": "^1.17.0",
|
|
203
175
|
"@nuxt/module-builder": "^1.0.3",
|
|
204
|
-
"@nuxt/test-utils": "^4.2
|
|
205
|
-
"@release-it/conventional-changelog": "^12.0.
|
|
176
|
+
"@nuxt/test-utils": "^4.3.2",
|
|
177
|
+
"@release-it/conventional-changelog": "^12.0.2",
|
|
206
178
|
"@tanstack/table-core": "^8.21.3",
|
|
207
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
208
|
-
"@vue/test-utils": "^2.5.
|
|
209
|
-
"ai": "^7.0.
|
|
179
|
+
"@vitejs/plugin-vue": "^6.0.9",
|
|
180
|
+
"@vue/test-utils": "^2.5.1",
|
|
181
|
+
"ai": "^7.0.107",
|
|
210
182
|
"embla-carousel": "^8.6.0",
|
|
211
|
-
"eslint": "^10.
|
|
212
|
-
"
|
|
183
|
+
"eslint": "^10.11.0",
|
|
184
|
+
"eslint-plugin-better-tailwindcss": "^4.7.0",
|
|
185
|
+
"happy-dom": "^20.14.5",
|
|
213
186
|
"nuxt": "^4.5.2",
|
|
214
|
-
"release-it": "^21.0
|
|
187
|
+
"release-it": "^21.1.0",
|
|
215
188
|
"unbuild": "^3.6.1",
|
|
216
189
|
"vitest": "^4.1.11",
|
|
217
190
|
"vitest-axe": "^0.1.0",
|
|
218
191
|
"vitest-environment-nuxt": "^2.0.0",
|
|
219
|
-
"vue": "^3.5.
|
|
192
|
+
"vue": "^3.5.43",
|
|
220
193
|
"vue-tsc": "^3.3.11"
|
|
221
194
|
},
|
|
222
195
|
"peerDependencies": {
|
|
223
|
-
"@inertiajs/vue3": "^2.0.7 || ^3
|
|
224
|
-
"@internationalized/date": "^3
|
|
225
|
-
"@internationalized/number": "^3
|
|
226
|
-
"@nuxt/content": "^3
|
|
196
|
+
"@inertiajs/vue3": "^2.0.7 || ^3",
|
|
197
|
+
"@internationalized/date": "^3",
|
|
198
|
+
"@internationalized/number": "^3",
|
|
199
|
+
"@nuxt/content": "^3",
|
|
227
200
|
"@tiptap/core": "^3",
|
|
228
201
|
"@tiptap/extension-bubble-menu": "^3",
|
|
229
202
|
"@tiptap/extension-code": "^3",
|
|
@@ -242,14 +215,14 @@
|
|
|
242
215
|
"@tiptap/suggestion": "^3",
|
|
243
216
|
"@tiptap/vue-3": "^3",
|
|
244
217
|
"ai": "^6 || ^7",
|
|
245
|
-
"joi": "^18
|
|
246
|
-
"superstruct": "^2
|
|
247
|
-
"tailwindcss": "^4
|
|
248
|
-
"typescript": "^5.6.3 || ^6
|
|
249
|
-
"valibot": "^1
|
|
250
|
-
"vue-router": "^4.5.0 || ^5
|
|
218
|
+
"joi": "^18",
|
|
219
|
+
"superstruct": "^2",
|
|
220
|
+
"tailwindcss": "^4",
|
|
221
|
+
"typescript": "^5.6.3 || ^6 || ^7",
|
|
222
|
+
"valibot": "^1",
|
|
223
|
+
"vue-router": "^4.5.0 || ^5",
|
|
251
224
|
"yup": "^1.7.0",
|
|
252
|
-
"zod": "^3.24.0 || ^4
|
|
225
|
+
"zod": "^3.24.0 || ^4"
|
|
253
226
|
},
|
|
254
227
|
"peerDependenciesMeta": {
|
|
255
228
|
"@inertiajs/vue3": {
|
|
@@ -301,5 +274,28 @@
|
|
|
301
274
|
"tailwind",
|
|
302
275
|
"framework",
|
|
303
276
|
"ui-framework"
|
|
304
|
-
]
|
|
305
|
-
|
|
277
|
+
],
|
|
278
|
+
"scripts": {
|
|
279
|
+
"build": "nuxt-module-build build",
|
|
280
|
+
"cli": "node ./cli/index.mjs",
|
|
281
|
+
"dev": "nuxt dev playgrounds/nuxt --uiDev",
|
|
282
|
+
"dev:build": "nuxt build playgrounds/nuxt",
|
|
283
|
+
"dev:vue": "pnpm --filter './playgrounds/vue' dev -- --uiDev",
|
|
284
|
+
"dev:vue:build": "pnpm --filter './playgrounds/vue' build",
|
|
285
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playgrounds/nuxt && nuxt prepare docs && pnpm dev:vue:build",
|
|
286
|
+
"repl": "pnpm --filter './playgrounds/repl' dev",
|
|
287
|
+
"repl:bundle": "pnpm --filter './playgrounds/repl' bundle",
|
|
288
|
+
"repl:build": "pnpm --filter './playgrounds/repl' build",
|
|
289
|
+
"repl:prepare": "nuxt-module-build build --stub && mkdir -p .nuxt && echo '{\"compilerOptions\":{}}' > .nuxt/tsconfig.json",
|
|
290
|
+
"docs": "nuxt dev docs --uiDev",
|
|
291
|
+
"docs:build": "nuxt build docs",
|
|
292
|
+
"lint": "eslint .",
|
|
293
|
+
"lint:fix": "eslint . --fix",
|
|
294
|
+
"typecheck": "vue-tsc --noEmit && nuxt typecheck playgrounds/nuxt && nuxt typecheck docs && cd playgrounds/vue && vue-tsc --noEmit",
|
|
295
|
+
"test": "vitest",
|
|
296
|
+
"test:vue": "vitest --project vue",
|
|
297
|
+
"test:nuxt": "vitest --project nuxt",
|
|
298
|
+
"bench": "vitest bench --project vue",
|
|
299
|
+
"release": "release-it"
|
|
300
|
+
}
|
|
301
|
+
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { existsSync, promises as fsp } from 'node:fs'
|
|
2
|
-
import { resolve } from 'pathe'
|
|
3
|
-
import { defineCommand } from 'citty'
|
|
4
|
-
import { consola } from 'consola'
|
|
5
|
-
import { splitByCase, upperFirst, camelCase, kebabCase } from 'scule'
|
|
6
|
-
import { appendFile, appendThemeDefault, sortFile } from '../../utils.mjs'
|
|
7
|
-
import templates from '../../templates.mjs'
|
|
8
|
-
|
|
9
|
-
export default defineCommand({
|
|
10
|
-
meta: {
|
|
11
|
-
name: 'component',
|
|
12
|
-
description: 'Make a new component.'
|
|
13
|
-
},
|
|
14
|
-
args: {
|
|
15
|
-
name: {
|
|
16
|
-
type: 'positional',
|
|
17
|
-
required: true,
|
|
18
|
-
description: 'Name of the component.'
|
|
19
|
-
},
|
|
20
|
-
primitive: {
|
|
21
|
-
type: 'boolean',
|
|
22
|
-
description: 'Create a primitive component.'
|
|
23
|
-
},
|
|
24
|
-
prose: {
|
|
25
|
-
type: 'boolean',
|
|
26
|
-
description: 'Create a prose component.'
|
|
27
|
-
},
|
|
28
|
-
content: {
|
|
29
|
-
type: 'boolean',
|
|
30
|
-
description: 'Create a content component.'
|
|
31
|
-
},
|
|
32
|
-
template: {
|
|
33
|
-
type: 'string',
|
|
34
|
-
description: 'Only generate template.'
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
async setup({ args }) {
|
|
38
|
-
const name = args.name
|
|
39
|
-
if (!name) {
|
|
40
|
-
consola.error('`name` argument is missing!')
|
|
41
|
-
process.exit(1)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const path = resolve('.')
|
|
45
|
-
|
|
46
|
-
for (const template of Object.keys(templates)) {
|
|
47
|
-
if (args.template && template !== args.template) {
|
|
48
|
-
continue
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const { filename, contents } = templates[template](args)
|
|
52
|
-
if (!contents) {
|
|
53
|
-
continue
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const filePath = resolve(path, filename)
|
|
57
|
-
|
|
58
|
-
if (existsSync(filePath)) {
|
|
59
|
-
consola.error(`🚨 ${filePath} already exists!`)
|
|
60
|
-
continue
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
await fsp.writeFile(filePath, contents.trim() + '\n')
|
|
64
|
-
|
|
65
|
-
consola.success(`🪄 Generated ${filePath}!`)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (args.template) {
|
|
69
|
-
return
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const themePath = resolve(path, `src/theme/${args.prose ? 'prose/' : ''}${args.content ? 'content/' : ''}index.ts`)
|
|
73
|
-
await appendFile(themePath, `export { default as ${camelCase(name)} } from './${kebabCase(name)}'`)
|
|
74
|
-
await sortFile(themePath)
|
|
75
|
-
|
|
76
|
-
if (!args.prose) {
|
|
77
|
-
const typesPath = resolve(path, 'src/runtime/types/index.ts')
|
|
78
|
-
const pascal = splitByCase(name).map(p => upperFirst(p)).join('')
|
|
79
|
-
await appendFile(typesPath, `export * from '../components/${args.content ? 'content/' : ''}${pascal}.vue'`)
|
|
80
|
-
await sortFile(typesPath)
|
|
81
|
-
|
|
82
|
-
const useComponentPropsPath = resolve(path, 'src/runtime/composables/useComponentProps.ts')
|
|
83
|
-
await appendThemeDefault(useComponentPropsPath, camelCase(name), `${pascal}Props`)
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
})
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { defineCommand } from 'citty'
|
|
2
|
-
import component from './component.mjs'
|
|
3
|
-
import locale from './locale.mjs'
|
|
4
|
-
|
|
5
|
-
export default defineCommand({
|
|
6
|
-
meta: {
|
|
7
|
-
name: 'make',
|
|
8
|
-
description: 'Commands to create new Nuxt UI entities.'
|
|
9
|
-
},
|
|
10
|
-
subCommands: {
|
|
11
|
-
component,
|
|
12
|
-
locale
|
|
13
|
-
}
|
|
14
|
-
})
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { existsSync, promises as fsp } from 'node:fs'
|
|
2
|
-
import { resolve } from 'pathe'
|
|
3
|
-
import { consola } from 'consola'
|
|
4
|
-
import { appendFile, sortFile, normalizeLocale } from '../../utils.mjs'
|
|
5
|
-
import { defineCommand } from 'citty'
|
|
6
|
-
|
|
7
|
-
export default defineCommand({
|
|
8
|
-
meta: {
|
|
9
|
-
name: 'locale',
|
|
10
|
-
description: 'Make a new locale.'
|
|
11
|
-
},
|
|
12
|
-
args: {
|
|
13
|
-
code: {
|
|
14
|
-
description: 'Locale code to create. For example: en or en_gb.',
|
|
15
|
-
required: true
|
|
16
|
-
},
|
|
17
|
-
name: {
|
|
18
|
-
description: 'Locale name in its own language. Defaults to the CLDR name for the code.'
|
|
19
|
-
},
|
|
20
|
-
dir: {
|
|
21
|
-
description: 'Locale direction. Defaults to the CLDR direction for the code.'
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
async setup({ args }) {
|
|
25
|
-
const path = resolve('.')
|
|
26
|
-
const localePath = resolve(path, `src/runtime/locale`)
|
|
27
|
-
|
|
28
|
-
const originLocaleFilePath = resolve(localePath, 'en.ts')
|
|
29
|
-
const newLocaleFilePath = resolve(localePath, `${args.code}.ts`)
|
|
30
|
-
|
|
31
|
-
// Validate locale code
|
|
32
|
-
if (existsSync(newLocaleFilePath)) {
|
|
33
|
-
consola.error(`🚨 ${args.code} already exists!`)
|
|
34
|
-
process.exit(1)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (!args.code.match(/^[a-z]{2,3}(?:_(?:[a-z]{2}|\d{3}))?$/)) {
|
|
38
|
-
consola.error(`🚨 ${args.code} is not a valid locale code!\nExample: en, en_gb or es_419`)
|
|
39
|
-
process.exit(1)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const code = normalizeLocale(args.code)
|
|
43
|
-
const language = code.split('-')[0]
|
|
44
|
-
|
|
45
|
-
// `Intl.DisplayNames` echoes the input back when the code is unknown to CLDR
|
|
46
|
-
if (new Intl.DisplayNames(['en'], { type: 'language' }).of(language) === language) {
|
|
47
|
-
consola.error(`🚨 ${language} is not a known ISO 639 language code!\nFor example, the code for Tajik is tg, not tj.`)
|
|
48
|
-
process.exit(1)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const region = code.split('-')[1]
|
|
52
|
-
if (region && new Intl.DisplayNames(['en'], { type: 'region' }).of(region) === region) {
|
|
53
|
-
consola.error(`🚨 ${region} is not a known region code!\nExample: en_gb or pt_br`)
|
|
54
|
-
process.exit(1)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
let name = args.name
|
|
58
|
-
if (!name) {
|
|
59
|
-
const cldrName = new Intl.DisplayNames([code], { type: 'language', languageDisplay: 'standard' }).of(code)
|
|
60
|
-
name = cldrName.charAt(0).toLocaleUpperCase(code) + cldrName.slice(1)
|
|
61
|
-
consola.info(`🌍 Using CLDR name for ${code}: ${name}`)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
let dir = args.dir
|
|
65
|
-
if (!dir) {
|
|
66
|
-
const intlLocale = new Intl.Locale(code)
|
|
67
|
-
dir = (intlLocale.getTextInfo?.() ?? intlLocale.textInfo)?.direction ?? 'ltr'
|
|
68
|
-
if (dir === 'rtl') {
|
|
69
|
-
consola.info(`🌍 Using CLDR direction for ${code}: ${dir}`)
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (!['ltr', 'rtl'].includes(dir)) {
|
|
74
|
-
consola.error(`🚨 Direction ${dir} not supported!`)
|
|
75
|
-
process.exit(1)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Create new locale export
|
|
79
|
-
const localeExportFile = resolve(localePath, `index.ts`)
|
|
80
|
-
await appendFile(localeExportFile, `export { default as ${args.code} } from './${args.code}'`)
|
|
81
|
-
await sortFile(localeExportFile)
|
|
82
|
-
|
|
83
|
-
// Create new locale file
|
|
84
|
-
await fsp.copyFile(originLocaleFilePath, newLocaleFilePath)
|
|
85
|
-
const localeFile = await fsp.readFile(newLocaleFilePath, 'utf-8')
|
|
86
|
-
const rewrittenLocaleFile = localeFile
|
|
87
|
-
.replace(/name: '(.*)',/, `name: '${name}',`)
|
|
88
|
-
.replace(/code: '(.*)',/, `code: '${code}',${dir !== 'ltr' ? `\n dir: '${dir}',` : ''}`)
|
|
89
|
-
await fsp.writeFile(newLocaleFilePath, rewrittenLocaleFile)
|
|
90
|
-
|
|
91
|
-
consola.success(`🪄 Generated ${newLocaleFilePath}`)
|
|
92
|
-
}
|
|
93
|
-
})
|
package/cli/index.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { defineCommand, runMain } from 'citty'
|
|
3
|
-
import make from './commands/make/index.mjs'
|
|
4
|
-
|
|
5
|
-
const main = defineCommand({
|
|
6
|
-
meta: {
|
|
7
|
-
name: 'nuxt-ui',
|
|
8
|
-
description: 'Nuxt UI CLI'
|
|
9
|
-
},
|
|
10
|
-
subCommands: {
|
|
11
|
-
make
|
|
12
|
-
}
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
runMain(main)
|