@vueless/nuxt 0.0.9-beta.3 → 0.0.9-beta.31
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 +20 -24
- package/dist/runtime/plugin.js +59 -3
- package/dist/types.d.mts +2 -2
- package/package.json +20 -24
- 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.9-beta.
|
|
3
|
+
"version": "0.0.9-beta.31",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Nuxt Styleless UI Component Library, powered by Tailwind CSS.",
|
|
6
6
|
"keywords": [
|
|
@@ -27,21 +27,20 @@
|
|
|
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 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
|
-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
45
44
|
"prepack": "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",
|
|
@@ -55,26 +54,24 @@
|
|
|
55
54
|
"install": "npx nuxi prepare"
|
|
56
55
|
},
|
|
57
56
|
"dependencies": {
|
|
58
|
-
"@nuxt/kit": "^3.
|
|
59
|
-
"
|
|
60
|
-
"tailwindcss": "^4.0.14",
|
|
61
|
-
"vueless": "^0.0.825-beta.17"
|
|
57
|
+
"@nuxt/kit": "^3.17.4",
|
|
58
|
+
"vueless": "^0.0.825-beta.186"
|
|
62
59
|
},
|
|
63
60
|
"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.
|
|
61
|
+
"@material-symbols/svg-500": "^0.31.4",
|
|
62
|
+
"@nuxt/devtools": "^2.4.1",
|
|
63
|
+
"@nuxt/eslint-config": "^1.4.1",
|
|
64
|
+
"@nuxt/module-builder": "^1.0.1",
|
|
65
|
+
"@nuxt/schema": "^3.17.4",
|
|
66
|
+
"@nuxt/test-utils": "^3.19.1",
|
|
70
67
|
"@types/node": "latest",
|
|
71
68
|
"changelogen": "^0.5.5",
|
|
72
|
-
"eslint": "^9.
|
|
73
|
-
"nuxt": "^3.
|
|
74
|
-
"release-it": "^
|
|
69
|
+
"eslint": "^9.27.0",
|
|
70
|
+
"nuxt": "^3.17.4",
|
|
71
|
+
"release-it": "^19.0.2",
|
|
75
72
|
"typescript": "latest",
|
|
76
|
-
"vitest": "^3.
|
|
77
|
-
"vue-tsc": "^2.
|
|
73
|
+
"vitest": "^3.1.4",
|
|
74
|
+
"vue-tsc": "^2.2.10"
|
|
78
75
|
},
|
|
79
76
|
"repository": {
|
|
80
77
|
"type": "git",
|
|
@@ -82,6 +79,5 @@
|
|
|
82
79
|
},
|
|
83
80
|
"bugs": {
|
|
84
81
|
"url": "https://github.com/vuelessjs/vueless-module-nuxt/issues"
|
|
85
|
-
}
|
|
86
|
-
"web-types": "./node_modules/vueless/web-types.json"
|
|
82
|
+
}
|
|
87
83
|
}
|
package/dist/runtime/plugin.js
CHANGED
|
@@ -1,16 +1,72 @@
|
|
|
1
1
|
import { createVueless, setTheme } from "vueless";
|
|
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";
|
|
15
|
+
import { ColorMode } from "vueless/types";
|
|
2
16
|
import vClickOutside from "vueless/directives/clickOutside/vClickOutside";
|
|
3
17
|
import vTooltip from "vueless/directives/tooltip/vTooltip";
|
|
18
|
+
import { vuelessConfig } from "vueless/utils/ui";
|
|
19
|
+
import { useRuntimeConfig } from "#imports";
|
|
4
20
|
import { defineNuxtPlugin } from "#app";
|
|
21
|
+
function parseCookies(cookieHeader) {
|
|
22
|
+
if (!cookieHeader) return {};
|
|
23
|
+
return cookieHeader.split(";").reduce((acc, cookie) => {
|
|
24
|
+
const [key, value] = cookie.trim().split("=");
|
|
25
|
+
if (key) acc[key] = value;
|
|
26
|
+
return acc;
|
|
27
|
+
}, {});
|
|
28
|
+
}
|
|
5
29
|
export default defineNuxtPlugin((_nuxtApp) => {
|
|
6
|
-
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);
|
|
7
38
|
_nuxtApp.vueApp.use(vueless, []);
|
|
8
39
|
_nuxtApp.vueApp.directive("clickOutside", vClickOutside);
|
|
9
40
|
_nuxtApp.vueApp.directive("tooltip", vTooltip);
|
|
10
41
|
if (import.meta.server) {
|
|
11
|
-
const
|
|
42
|
+
const event = _nuxtApp.ssrContext?.event;
|
|
43
|
+
const cookies = parseCookies(event?.node.req.headers.cookie);
|
|
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;
|
|
64
|
+
const isCachedAutoMode = Boolean(Number(cookies?.[AUTO_MODE_KEY]));
|
|
65
|
+
const themeRootVariables = setTheme({ primary, neutral, text, outline, rounding, disabledOpacity, colorMode }, isCachedAutoMode);
|
|
66
|
+
const colorModeClass = colorMode === ColorMode.Dark ? DARK_MODE_CLASS : LIGHT_MODE_CLASS;
|
|
12
67
|
_nuxtApp.ssrContext?.head.push({
|
|
13
|
-
style: [{ innerHTML: themeRootVariables }]
|
|
68
|
+
style: [{ innerHTML: themeRootVariables }],
|
|
69
|
+
htmlAttrs: { class: colorModeClass }
|
|
14
70
|
});
|
|
15
71
|
}
|
|
16
72
|
});
|
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.9-beta.
|
|
3
|
+
"version": "0.0.9-beta.31",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Nuxt Styleless UI Component Library, powered by Tailwind CSS.",
|
|
6
6
|
"keywords": [
|
|
@@ -27,21 +27,20 @@
|
|
|
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 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
|
-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
45
44
|
"prepack": "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",
|
|
@@ -55,26 +54,24 @@
|
|
|
55
54
|
"install": "npx nuxi prepare"
|
|
56
55
|
},
|
|
57
56
|
"dependencies": {
|
|
58
|
-
"@nuxt/kit": "^3.
|
|
59
|
-
"
|
|
60
|
-
"tailwindcss": "^4.0.14",
|
|
61
|
-
"vueless": "^0.0.825-beta.17"
|
|
57
|
+
"@nuxt/kit": "^3.17.4",
|
|
58
|
+
"vueless": "^0.0.825-beta.186"
|
|
62
59
|
},
|
|
63
60
|
"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.
|
|
61
|
+
"@material-symbols/svg-500": "^0.31.4",
|
|
62
|
+
"@nuxt/devtools": "^2.4.1",
|
|
63
|
+
"@nuxt/eslint-config": "^1.4.1",
|
|
64
|
+
"@nuxt/module-builder": "^1.0.1",
|
|
65
|
+
"@nuxt/schema": "^3.17.4",
|
|
66
|
+
"@nuxt/test-utils": "^3.19.1",
|
|
70
67
|
"@types/node": "latest",
|
|
71
68
|
"changelogen": "^0.5.5",
|
|
72
|
-
"eslint": "^9.
|
|
73
|
-
"nuxt": "^3.
|
|
74
|
-
"release-it": "^
|
|
69
|
+
"eslint": "^9.27.0",
|
|
70
|
+
"nuxt": "^3.17.4",
|
|
71
|
+
"release-it": "^19.0.2",
|
|
75
72
|
"typescript": "latest",
|
|
76
|
-
"vitest": "^3.
|
|
77
|
-
"vue-tsc": "^2.
|
|
73
|
+
"vitest": "^3.1.4",
|
|
74
|
+
"vue-tsc": "^2.2.10"
|
|
78
75
|
},
|
|
79
76
|
"repository": {
|
|
80
77
|
"type": "git",
|
|
@@ -82,6 +79,5 @@
|
|
|
82
79
|
},
|
|
83
80
|
"bugs": {
|
|
84
81
|
"url": "https://github.com/vuelessjs/vueless-module-nuxt/issues"
|
|
85
|
-
}
|
|
86
|
-
"web-types": "./node_modules/vueless/web-types.json"
|
|
82
|
+
}
|
|
87
83
|
}
|
package/dist/module.cjs
DELETED
package/dist/module.d.ts
DELETED
package/dist/types.d.ts
DELETED