@vueless/nuxt 0.0.9-beta.8 → 1.0.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/dist/module.d.mts +2 -0
- package/dist/module.json +3 -3
- package/dist/module.mjs +63 -12
- package/dist/package.json +22 -27
- package/dist/runtime/plugin.js +45 -8
- package/dist/types.d.mts +2 -2
- package/package.json +22 -27
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -11
- package/dist/types.d.ts +0 -7
package/dist/module.d.mts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { cwd } from 'node:process';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import { defineNuxtModule, createResolver, hasNuxtModule, addPlugin, addComponent, addImportsDir } from '@nuxt/kit';
|
|
5
|
+
import { TailwindCSS, Vueless } from 'vueless/plugin-vite.js';
|
|
6
|
+
import { cacheMergedConfigs } from 'vueless/utils/node/helper.js';
|
|
7
|
+
import { NUXT_MODULE_ENV, VUELESS_PACKAGE_DIR, COMPONENTS, VUELESS_CONFIG_FILE_NAME } from 'vueless/constants.js';
|
|
7
8
|
|
|
8
9
|
const module = defineNuxtModule({
|
|
9
10
|
meta: {
|
|
@@ -14,23 +15,45 @@ const module = defineNuxtModule({
|
|
|
14
15
|
}
|
|
15
16
|
},
|
|
16
17
|
defaults: {
|
|
18
|
+
include: [],
|
|
17
19
|
mirrorCacheDir: "",
|
|
18
20
|
debug: false
|
|
19
21
|
},
|
|
20
22
|
async setup(_options, _nuxt) {
|
|
23
|
+
const { include, mirrorCacheDir, debug } = _options;
|
|
21
24
|
const { resolve } = createResolver(import.meta.url);
|
|
22
|
-
const {
|
|
25
|
+
const { vuelessConfig, dependencies } = await getVuelessConfig();
|
|
26
|
+
_nuxt.options.runtimeConfig.public.vueless = vuelessConfig;
|
|
23
27
|
_nuxt.options.build.transpile.push("vueless");
|
|
24
|
-
|
|
28
|
+
if (hasNuxtModule("@nuxtjs/i18n")) {
|
|
29
|
+
_nuxt.hook("i18n:registerModule", (register) => {
|
|
30
|
+
register({
|
|
31
|
+
langDir: resolve("../node_modules/vueless/locales"),
|
|
32
|
+
locales: [
|
|
33
|
+
{ code: "en", name: "English", file: "en.json" }
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
_nuxt.hook("vite:extendConfig", async (config) => {
|
|
25
39
|
config.plugins = config.plugins || [];
|
|
26
40
|
config.plugins.push(
|
|
27
41
|
TailwindCSS(),
|
|
28
|
-
Vueless({
|
|
42
|
+
Vueless({ env: NUXT_MODULE_ENV, mirrorCacheDir, debug, include })
|
|
29
43
|
);
|
|
30
44
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
45
|
+
if (_nuxt.options.dev) {
|
|
46
|
+
const chokidarPath = require.resolve("chokidar");
|
|
47
|
+
const chokidar = await import(chokidarPath);
|
|
48
|
+
const watcher = chokidar.watch(dependencies, { ignoreInitial: true });
|
|
49
|
+
watcher.on("change", async () => {
|
|
50
|
+
const { dependencies: newDependencies } = await getVuelessConfig();
|
|
51
|
+
watcher.unwatch(dependencies);
|
|
52
|
+
watcher.add(newDependencies);
|
|
53
|
+
_nuxt.callHook("restart");
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
await cacheMergedConfigs(VUELESS_PACKAGE_DIR);
|
|
34
57
|
addPlugin(resolve("./runtime/plugin"));
|
|
35
58
|
for (const componentName in COMPONENTS) {
|
|
36
59
|
addComponent({
|
|
@@ -42,5 +65,33 @@ const module = defineNuxtModule({
|
|
|
42
65
|
addImportsDir("vueless/utils");
|
|
43
66
|
}
|
|
44
67
|
});
|
|
68
|
+
async function getVuelessConfig() {
|
|
69
|
+
const esbuildPath = require.resolve("esbuild");
|
|
70
|
+
const esbuild = await import(esbuildPath);
|
|
71
|
+
const esbuildConfig = {
|
|
72
|
+
bundle: true,
|
|
73
|
+
platform: "node",
|
|
74
|
+
format: "esm",
|
|
75
|
+
target: "ESNext",
|
|
76
|
+
loader: { ".ts": "ts" },
|
|
77
|
+
write: false,
|
|
78
|
+
metafile: true
|
|
79
|
+
// Generate dependency tree
|
|
80
|
+
};
|
|
81
|
+
const configPathJs = path.join(cwd(), `${VUELESS_CONFIG_FILE_NAME}.js`);
|
|
82
|
+
const configPathTs = path.join(cwd(), `${VUELESS_CONFIG_FILE_NAME}.ts`);
|
|
83
|
+
let result = null;
|
|
84
|
+
if (fs.existsSync(configPathJs)) {
|
|
85
|
+
result = await esbuild.build({ ...esbuildConfig, entryPoints: [configPathJs] });
|
|
86
|
+
}
|
|
87
|
+
if (fs.existsSync(configPathTs)) {
|
|
88
|
+
result = await esbuild.build({ ...esbuildConfig, entryPoints: [configPathTs] });
|
|
89
|
+
}
|
|
90
|
+
const code = result?.outputFiles?.[0]?.text || "";
|
|
91
|
+
return {
|
|
92
|
+
vuelessConfig: (await import(`data:text/javascript,${encodeURIComponent(code)}`)).default || {},
|
|
93
|
+
dependencies: Object.keys(result?.metafile?.inputs || {})
|
|
94
|
+
};
|
|
95
|
+
}
|
|
45
96
|
|
|
46
97
|
export { module as default };
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueless/nuxt",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Nuxt Styleless UI Component Library, powered by Tailwind CSS.",
|
|
6
6
|
"keywords": [
|
|
@@ -27,22 +27,21 @@
|
|
|
27
27
|
},
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
30
|
-
"types": "./dist/types.d.
|
|
30
|
+
"types": "./dist/types.d.mts",
|
|
31
31
|
"import": "./dist/module.mjs",
|
|
32
|
-
"require": "./dist/module.
|
|
32
|
+
"require": "./dist/module.mjs"
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
"main": "./dist/module.
|
|
36
|
-
"types": "./dist/types.d.ts",
|
|
35
|
+
"main": "./dist/module.mjs",
|
|
37
36
|
"files": [
|
|
38
37
|
"dist"
|
|
39
38
|
],
|
|
40
39
|
"scripts": {
|
|
41
|
-
"dev": "nuxi dev playground",
|
|
40
|
+
"dev": "npm run dev:prepare && nuxi dev playground",
|
|
41
|
+
"dev:prepare": "nuxi cleanup && nuxi prepare && nuxi cleanup playground && nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
42
42
|
"dev:build": "nuxi build playground",
|
|
43
43
|
"dev:preview": "nuxi preview playground",
|
|
44
|
-
"
|
|
45
|
-
"prepack": "nuxt-module-build build && cp package.json LICENSE README.md dist/",
|
|
44
|
+
"prepack": "nuxi prepare && nuxt-module-build build && cp package.json LICENSE README.md dist/",
|
|
46
45
|
"release:beta": "release-it --ci --npm.publish --preRelease=beta --increment=prerelease",
|
|
47
46
|
"release:patch": "release-it patch --ci --npm.publish",
|
|
48
47
|
"release:minor": "release-it minor --ci --npm.publish --git.tag --github.release",
|
|
@@ -51,30 +50,27 @@
|
|
|
51
50
|
"lint:ci": "eslint --no-fix --max-warnings=0",
|
|
52
51
|
"test": "vitest run",
|
|
53
52
|
"test:watch": "vitest watch",
|
|
54
|
-
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
55
|
-
"install": "npx nuxi prepare"
|
|
53
|
+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
56
54
|
},
|
|
57
55
|
"dependencies": {
|
|
58
|
-
"@nuxt/kit": "^3.
|
|
59
|
-
"
|
|
60
|
-
"tailwindcss": "^4.0.14",
|
|
61
|
-
"vueless": "^0.0.825-beta.47"
|
|
56
|
+
"@nuxt/kit": "^3.17.4",
|
|
57
|
+
"vueless": "^1.0.1"
|
|
62
58
|
},
|
|
63
59
|
"devDependencies": {
|
|
64
|
-
"@material-symbols/svg-500": "^0.
|
|
65
|
-
"@nuxt/devtools": "^
|
|
66
|
-
"@nuxt/eslint-config": "^
|
|
67
|
-
"@nuxt/module-builder": "^0.
|
|
68
|
-
"@nuxt/schema": "^3.
|
|
69
|
-
"@nuxt/test-utils": "^3.
|
|
60
|
+
"@material-symbols/svg-500": "^0.31.4",
|
|
61
|
+
"@nuxt/devtools": "^2.4.1",
|
|
62
|
+
"@nuxt/eslint-config": "^1.4.1",
|
|
63
|
+
"@nuxt/module-builder": "^1.0.1",
|
|
64
|
+
"@nuxt/schema": "^3.17.4",
|
|
65
|
+
"@nuxt/test-utils": "^3.19.1",
|
|
70
66
|
"@types/node": "latest",
|
|
71
67
|
"changelogen": "^0.5.5",
|
|
72
|
-
"eslint": "^9.
|
|
73
|
-
"nuxt": "^3.
|
|
74
|
-
"release-it": "^
|
|
68
|
+
"eslint": "^9.27.0",
|
|
69
|
+
"nuxt": "^3.17.4",
|
|
70
|
+
"release-it": "^19.0.2",
|
|
75
71
|
"typescript": "latest",
|
|
76
|
-
"vitest": "^3.
|
|
77
|
-
"vue-tsc": "^2.
|
|
72
|
+
"vitest": "^3.1.4",
|
|
73
|
+
"vue-tsc": "^2.2.10"
|
|
78
74
|
},
|
|
79
75
|
"repository": {
|
|
80
76
|
"type": "git",
|
|
@@ -82,6 +78,5 @@
|
|
|
82
78
|
},
|
|
83
79
|
"bugs": {
|
|
84
80
|
"url": "https://github.com/vuelessjs/vueless-module-nuxt/issues"
|
|
85
|
-
}
|
|
86
|
-
"web-types": "./node_modules/vueless/web-types.json"
|
|
81
|
+
}
|
|
87
82
|
}
|
package/dist/runtime/plugin.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { createVueless, setTheme } from "vueless";
|
|
2
|
-
import
|
|
2
|
+
import createVueI18nAdapter from "vueless/adapter.locale/vue-i18n";
|
|
3
|
+
import {
|
|
4
|
+
TEXT,
|
|
5
|
+
OUTLINE,
|
|
6
|
+
ROUNDING,
|
|
7
|
+
PRIMARY_COLOR,
|
|
8
|
+
NEUTRAL_COLOR,
|
|
9
|
+
AUTO_MODE_KEY,
|
|
10
|
+
COLOR_MODE_KEY,
|
|
11
|
+
DARK_MODE_CLASS,
|
|
12
|
+
LIGHT_MODE_CLASS,
|
|
13
|
+
DISABLED_OPACITY
|
|
14
|
+
} from "vueless/constants";
|
|
3
15
|
import { ColorMode } from "vueless/types";
|
|
4
16
|
import vClickOutside from "vueless/directives/clickOutside/vClickOutside";
|
|
5
17
|
import vTooltip from "vueless/directives/tooltip/vTooltip";
|
|
18
|
+
import { vuelessConfig } from "vueless/utils/ui";
|
|
19
|
+
import { useRuntimeConfig } from "#imports";
|
|
6
20
|
import { defineNuxtPlugin } from "#app";
|
|
7
21
|
function parseCookies(cookieHeader) {
|
|
8
22
|
if (!cookieHeader) return {};
|
|
@@ -13,20 +27,43 @@ function parseCookies(cookieHeader) {
|
|
|
13
27
|
}, {});
|
|
14
28
|
}
|
|
15
29
|
export default defineNuxtPlugin((_nuxtApp) => {
|
|
16
|
-
const
|
|
30
|
+
const config = useRuntimeConfig().public.vueless;
|
|
31
|
+
const vuelessOptions = { config };
|
|
32
|
+
if ("$i18n" in _nuxtApp) {
|
|
33
|
+
vuelessOptions.i18n = {
|
|
34
|
+
adapter: createVueI18nAdapter({ global: _nuxtApp.$i18n })
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const vueless = createVueless(vuelessOptions);
|
|
17
38
|
_nuxtApp.vueApp.use(vueless, []);
|
|
18
39
|
_nuxtApp.vueApp.directive("clickOutside", vClickOutside);
|
|
19
40
|
_nuxtApp.vueApp.directive("tooltip", vTooltip);
|
|
20
41
|
if (import.meta.server) {
|
|
21
42
|
const event = _nuxtApp.ssrContext?.event;
|
|
22
43
|
const cookies = parseCookies(event?.node.req.headers.cookie);
|
|
23
|
-
const primary = cookies?.[
|
|
24
|
-
const neutral = cookies?.[
|
|
25
|
-
const
|
|
26
|
-
|
|
44
|
+
const primary = cookies?.[`vl-${PRIMARY_COLOR}`];
|
|
45
|
+
const neutral = cookies?.[`vl-${NEUTRAL_COLOR}`];
|
|
46
|
+
const text = {
|
|
47
|
+
xs: cookies?.[`vl-${TEXT}-xs`],
|
|
48
|
+
sm: cookies?.[`vl-${TEXT}-sm`],
|
|
49
|
+
md: cookies?.[`vl-${TEXT}-md`],
|
|
50
|
+
lg: cookies?.[`vl-${TEXT}-lg`]
|
|
51
|
+
};
|
|
52
|
+
const outline = {
|
|
53
|
+
sm: cookies?.[`vl-${OUTLINE}-sm`],
|
|
54
|
+
md: cookies?.[`vl-${OUTLINE}-md`],
|
|
55
|
+
lg: cookies?.[`vl-${OUTLINE}-lg`]
|
|
56
|
+
};
|
|
57
|
+
const rounding = {
|
|
58
|
+
sm: cookies?.[`vl-${ROUNDING}-sm`],
|
|
59
|
+
md: cookies?.[`vl-${ROUNDING}-md`],
|
|
60
|
+
lg: cookies?.[`vl-${ROUNDING}-lg`]
|
|
61
|
+
};
|
|
62
|
+
const disabledOpacity = cookies?.[`vl-${DISABLED_OPACITY}`];
|
|
63
|
+
const colorMode = cookies?.[COLOR_MODE_KEY] || vuelessConfig.colorMode || ColorMode.Light;
|
|
27
64
|
const isCachedAutoMode = Boolean(Number(cookies?.[AUTO_MODE_KEY]));
|
|
28
|
-
const themeRootVariables = setTheme({ primary, neutral, rounding, colorMode }, isCachedAutoMode);
|
|
29
|
-
const colorModeClass = colorMode === ColorMode.Dark ?
|
|
65
|
+
const themeRootVariables = setTheme({ primary, neutral, text, outline, rounding, disabledOpacity, colorMode }, isCachedAutoMode);
|
|
66
|
+
const colorModeClass = colorMode === ColorMode.Dark ? DARK_MODE_CLASS : LIGHT_MODE_CLASS;
|
|
30
67
|
_nuxtApp.ssrContext?.head.push({
|
|
31
68
|
style: [{ innerHTML: themeRootVariables }],
|
|
32
69
|
htmlAttrs: { class: colorModeClass }
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NuxtModule } from '@nuxt/schema'
|
|
2
2
|
|
|
3
|
-
import type { default as Module } from './module.
|
|
3
|
+
import type { default as Module } from './module.mjs'
|
|
4
4
|
|
|
5
5
|
export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
|
|
6
6
|
|
|
7
|
-
export { default } from './module.
|
|
7
|
+
export { default } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vueless/nuxt",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Nuxt Styleless UI Component Library, powered by Tailwind CSS.",
|
|
6
6
|
"keywords": [
|
|
@@ -27,22 +27,21 @@
|
|
|
27
27
|
},
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
30
|
-
"types": "./dist/types.d.
|
|
30
|
+
"types": "./dist/types.d.mts",
|
|
31
31
|
"import": "./dist/module.mjs",
|
|
32
|
-
"require": "./dist/module.
|
|
32
|
+
"require": "./dist/module.mjs"
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
"main": "./dist/module.
|
|
36
|
-
"types": "./dist/types.d.ts",
|
|
35
|
+
"main": "./dist/module.mjs",
|
|
37
36
|
"files": [
|
|
38
37
|
"dist"
|
|
39
38
|
],
|
|
40
39
|
"scripts": {
|
|
41
|
-
"dev": "nuxi dev playground",
|
|
40
|
+
"dev": "npm run dev:prepare && nuxi dev playground",
|
|
41
|
+
"dev:prepare": "nuxi cleanup && nuxi prepare && nuxi cleanup playground && nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
42
42
|
"dev:build": "nuxi build playground",
|
|
43
43
|
"dev:preview": "nuxi preview playground",
|
|
44
|
-
"
|
|
45
|
-
"prepack": "nuxt-module-build build && cp package.json LICENSE README.md dist/",
|
|
44
|
+
"prepack": "nuxi prepare && nuxt-module-build build && cp package.json LICENSE README.md dist/",
|
|
46
45
|
"release:beta": "release-it --ci --npm.publish --preRelease=beta --increment=prerelease",
|
|
47
46
|
"release:patch": "release-it patch --ci --npm.publish",
|
|
48
47
|
"release:minor": "release-it minor --ci --npm.publish --git.tag --github.release",
|
|
@@ -51,30 +50,27 @@
|
|
|
51
50
|
"lint:ci": "eslint --no-fix --max-warnings=0",
|
|
52
51
|
"test": "vitest run",
|
|
53
52
|
"test:watch": "vitest watch",
|
|
54
|
-
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
55
|
-
"install": "npx nuxi prepare"
|
|
53
|
+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
56
54
|
},
|
|
57
55
|
"dependencies": {
|
|
58
|
-
"@nuxt/kit": "^3.
|
|
59
|
-
"
|
|
60
|
-
"tailwindcss": "^4.0.14",
|
|
61
|
-
"vueless": "^0.0.825-beta.47"
|
|
56
|
+
"@nuxt/kit": "^3.17.4",
|
|
57
|
+
"vueless": "^1.0.1"
|
|
62
58
|
},
|
|
63
59
|
"devDependencies": {
|
|
64
|
-
"@material-symbols/svg-500": "^0.
|
|
65
|
-
"@nuxt/devtools": "^
|
|
66
|
-
"@nuxt/eslint-config": "^
|
|
67
|
-
"@nuxt/module-builder": "^0.
|
|
68
|
-
"@nuxt/schema": "^3.
|
|
69
|
-
"@nuxt/test-utils": "^3.
|
|
60
|
+
"@material-symbols/svg-500": "^0.31.4",
|
|
61
|
+
"@nuxt/devtools": "^2.4.1",
|
|
62
|
+
"@nuxt/eslint-config": "^1.4.1",
|
|
63
|
+
"@nuxt/module-builder": "^1.0.1",
|
|
64
|
+
"@nuxt/schema": "^3.17.4",
|
|
65
|
+
"@nuxt/test-utils": "^3.19.1",
|
|
70
66
|
"@types/node": "latest",
|
|
71
67
|
"changelogen": "^0.5.5",
|
|
72
|
-
"eslint": "^9.
|
|
73
|
-
"nuxt": "^3.
|
|
74
|
-
"release-it": "^
|
|
68
|
+
"eslint": "^9.27.0",
|
|
69
|
+
"nuxt": "^3.17.4",
|
|
70
|
+
"release-it": "^19.0.2",
|
|
75
71
|
"typescript": "latest",
|
|
76
|
-
"vitest": "^3.
|
|
77
|
-
"vue-tsc": "^2.
|
|
72
|
+
"vitest": "^3.1.4",
|
|
73
|
+
"vue-tsc": "^2.2.10"
|
|
78
74
|
},
|
|
79
75
|
"repository": {
|
|
80
76
|
"type": "git",
|
|
@@ -82,6 +78,5 @@
|
|
|
82
78
|
},
|
|
83
79
|
"bugs": {
|
|
84
80
|
"url": "https://github.com/vuelessjs/vueless-module-nuxt/issues"
|
|
85
|
-
}
|
|
86
|
-
"web-types": "./node_modules/vueless/web-types.json"
|
|
81
|
+
}
|
|
87
82
|
}
|
package/dist/module.cjs
DELETED
package/dist/module.d.ts
DELETED
package/dist/types.d.ts
DELETED