@vueless/nuxt 1.0.1-beta.1 → 1.0.1-beta.10

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 CHANGED
@@ -3,11 +3,15 @@ import * as _nuxt_schema from '@nuxt/schema';
3
3
  declare const _default: _nuxt_schema.NuxtModule<{
4
4
  include: never[];
5
5
  mirrorCacheDir: string;
6
+ srcDir: undefined;
6
7
  debug: boolean;
8
+ postcss: boolean;
7
9
  }, {
8
10
  include: never[];
9
11
  mirrorCacheDir: string;
12
+ srcDir: undefined;
10
13
  debug: boolean;
14
+ postcss: boolean;
11
15
  }, false>;
12
16
 
13
17
  export { _default as default };
package/dist/module.json CHANGED
@@ -4,9 +4,9 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.13.0"
6
6
  },
7
- "version": "1.0.1-beta.1",
7
+ "version": "1.0.1-beta.10",
8
8
  "builder": {
9
- "@nuxt/module-builder": "1.0.1",
10
- "unbuild": "3.5.0"
9
+ "@nuxt/module-builder": "1.0.2",
10
+ "unbuild": "3.6.1"
11
11
  }
12
12
  }
package/dist/module.mjs CHANGED
@@ -1,13 +1,8 @@
1
- import path from 'node:path';
2
- import { cwd } from 'node:process';
3
- import fs from 'node:fs';
4
- import { createRequire } from 'node:module';
5
1
  import { defineNuxtModule, createResolver, hasNuxtModule, addPlugin, addComponent, addImportsDir } from '@nuxt/kit';
6
- import { TailwindCSS, Vueless } from 'vueless/plugin-vite.js';
7
- import { cacheMergedConfigs } from 'vueless/utils/node/helper.js';
8
- import { NUXT_MODULE_ENV, VUELESS_PACKAGE_DIR, COMPONENTS, VUELESS_CONFIG_FILE_NAME } from 'vueless/constants.js';
2
+ import { TailwindCSS, Vueless } from 'vueless/plugin-vite';
3
+ import { autoImportUserConfigs, cacheMergedConfigs } from 'vueless/utils/node/helper.js';
4
+ import { NUXT_MODULE_ENV, VUELESS_PACKAGE_DIR, COMPONENTS } from 'vueless/constants';
9
5
 
10
- const require = createRequire(import.meta.url);
11
6
  const module = defineNuxtModule({
12
7
  meta: {
13
8
  name: "@vueless/nuxt",
@@ -19,14 +14,16 @@ const module = defineNuxtModule({
19
14
  defaults: {
20
15
  include: [],
21
16
  mirrorCacheDir: "",
22
- debug: false
17
+ srcDir: void 0,
18
+ debug: false,
19
+ postcss: false
23
20
  },
24
21
  async setup(_options, _nuxt) {
25
- const { include, mirrorCacheDir, debug } = _options;
22
+ const { include, mirrorCacheDir, debug, postcss, srcDir } = _options;
26
23
  const { resolve } = createResolver(import.meta.url);
27
- const { vuelessConfig, dependencies } = await getVuelessConfig();
28
- _nuxt.options.runtimeConfig.public.vueless = vuelessConfig;
29
- _nuxt.options.build.transpile.push("vueless");
24
+ if (srcDir !== void 0) {
25
+ await autoImportUserConfigs(srcDir);
26
+ }
30
27
  if (hasNuxtModule("@nuxtjs/i18n")) {
31
28
  _nuxt.hook("i18n:registerModule", (register) => {
32
29
  register({
@@ -40,60 +37,21 @@ const module = defineNuxtModule({
40
37
  _nuxt.hook("vite:extendConfig", async (config) => {
41
38
  config.plugins = config.plugins || [];
42
39
  config.plugins.push(
43
- TailwindCSS(),
40
+ TailwindCSS({ postcss }),
44
41
  Vueless({ env: NUXT_MODULE_ENV, mirrorCacheDir, debug, include })
45
42
  );
46
43
  });
47
- if (_nuxt.options.dev) {
48
- const chokidarPath = require.resolve("chokidar");
49
- const chokidar = await import(chokidarPath);
50
- const watcher = chokidar.watch(dependencies, { ignoreInitial: true });
51
- watcher.on("change", async () => {
52
- const { dependencies: newDependencies } = await getVuelessConfig();
53
- watcher.unwatch(dependencies);
54
- watcher.add(newDependencies);
55
- _nuxt.callHook("restart");
56
- });
57
- }
58
44
  await cacheMergedConfigs(VUELESS_PACKAGE_DIR);
59
45
  addPlugin(resolve("./runtime/plugin"));
60
- for (const componentName in COMPONENTS) {
46
+ for (const [componentName, componentPath] of Object.entries(COMPONENTS)) {
61
47
  addComponent({
62
48
  name: componentName,
63
- filePath: `vueless/${COMPONENTS[componentName]}/${componentName}.vue`
49
+ filePath: `vueless/${componentPath}/${componentName}.vue`
64
50
  });
65
51
  }
66
52
  addImportsDir("vueless/composables");
67
53
  addImportsDir("vueless/utils");
68
54
  }
69
55
  });
70
- async function getVuelessConfig() {
71
- const esbuildPath = require.resolve("esbuild");
72
- const esbuild = await import(esbuildPath);
73
- const esbuildConfig = {
74
- bundle: true,
75
- platform: "node",
76
- format: "esm",
77
- target: "ESNext",
78
- loader: { ".ts": "ts" },
79
- write: false,
80
- metafile: true
81
- // Generate dependency tree
82
- };
83
- const configPathJs = path.join(cwd(), `${VUELESS_CONFIG_FILE_NAME}.js`);
84
- const configPathTs = path.join(cwd(), `${VUELESS_CONFIG_FILE_NAME}.ts`);
85
- let result = null;
86
- if (fs.existsSync(configPathJs)) {
87
- result = await esbuild.build({ ...esbuildConfig, entryPoints: [configPathJs] });
88
- }
89
- if (fs.existsSync(configPathTs)) {
90
- result = await esbuild.build({ ...esbuildConfig, entryPoints: [configPathTs] });
91
- }
92
- const code = result?.outputFiles?.[0]?.text || "";
93
- return {
94
- vuelessConfig: (await import(`data:text/javascript,${encodeURIComponent(code)}`)).default || {},
95
- dependencies: Object.keys(result?.metafile?.inputs || {})
96
- };
97
- }
98
56
 
99
57
  export { module as default };
package/dist/package.json CHANGED
@@ -1,26 +1,10 @@
1
1
  {
2
2
  "name": "@vueless/nuxt",
3
- "version": "1.0.1-beta.1",
4
- "license": "MIT",
3
+ "version": "1.0.1-beta.10",
5
4
  "description": "Nuxt Styleless UI Component Library, powered by Tailwind CSS.",
6
- "keywords": [
7
- "vueless",
8
- "nuxt",
9
- "nuxt.js",
10
- "nuxt3",
11
- "ui library",
12
- "component library",
13
- "nuxt framework",
14
- "design system",
15
- "tailwind",
16
- "tailwindcss",
17
- "unstyled",
18
- "styleless",
19
- "headlessui",
20
- "ui"
21
- ],
5
+ "author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
22
6
  "homepage": "https://vueless.com",
23
- "author": "Johnny Grid",
7
+ "license": "MIT",
24
8
  "type": "module",
25
9
  "publishConfig": {
26
10
  "access": "public"
@@ -43,35 +27,35 @@
43
27
  "dev:preview": "nuxi preview playground",
44
28
  "prepack": "nuxi prepare && nuxt-module-build build && cp package.json LICENSE README.md dist/",
45
29
  "release:beta": "release-it --ci --npm.publish --preRelease=beta --increment=prerelease",
46
- "release:patch": "release-it patch --ci --npm.publish",
30
+ "release:patch": "release-it patch --ci --npm.publish --git.tag --github.release",
47
31
  "release:minor": "release-it minor --ci --npm.publish --git.tag --github.release",
48
32
  "release:major": "release-it major --ci --npm.publish --git.tag --github.release",
33
+ "ts:check": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
49
34
  "lint": "eslint . --no-fix",
50
35
  "lint:fix": "eslint . --fix",
51
36
  "lint:ci": "eslint . --no-fix --max-warnings=0",
52
37
  "test": "vitest run",
53
- "test:watch": "vitest watch",
54
- "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
38
+ "test:watch": "vitest watch"
55
39
  },
56
40
  "dependencies": {
57
- "@nuxt/kit": "^3.17.4",
58
- "vueless": "^1.0.1"
41
+ "vueless": "^1.1.1-beta.49"
59
42
  },
60
43
  "devDependencies": {
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",
44
+ "@material-symbols/svg-500": "^0.34.1",
45
+ "@nuxt/devtools": "^2.6.2",
46
+ "@nuxt/eslint-config": "^1.8.0",
47
+ "@nuxt/kit": "^4.0.3",
48
+ "@nuxt/module-builder": "^1.0.2",
49
+ "@nuxt/schema": "^4.0.3",
50
+ "@nuxt/test-utils": "^3.19.2",
67
51
  "@types/node": "latest",
68
- "changelogen": "^0.5.5",
69
- "eslint": "^9.27.0",
70
- "nuxt": "^3.17.4",
71
- "release-it": "^19.0.2",
52
+ "changelogen": "^0.6.2",
53
+ "eslint": "^9.33.0",
54
+ "nuxt": "^4.0.3",
55
+ "release-it": "^19.0.4",
72
56
  "typescript": "latest",
73
- "vitest": "^3.1.4",
74
- "vue-tsc": "^2.2.10"
57
+ "vitest": "^3.2.4",
58
+ "vue-tsc": "^3.0.5"
75
59
  },
76
60
  "repository": {
77
61
  "type": "git",
@@ -79,5 +63,22 @@
79
63
  },
80
64
  "bugs": {
81
65
  "url": "https://github.com/vuelessjs/vueless-module-nuxt/issues"
82
- }
66
+ },
67
+ "keywords": [
68
+ "vueless",
69
+ "nuxt",
70
+ "nuxt.js",
71
+ "nuxt3",
72
+ "nuxt4",
73
+ "ui library",
74
+ "component library",
75
+ "nuxt framework",
76
+ "design system",
77
+ "tailwind",
78
+ "tailwindcss",
79
+ "unstyled",
80
+ "styleless",
81
+ "headlessui",
82
+ "ui"
83
+ ]
83
84
  }
@@ -1,5 +1,4 @@
1
- import { createVueless, setTheme } from "vueless";
2
- import createVueI18nAdapter from "vueless/adapter.locale/vue-i18n";
1
+ import { createVueless, createVueI18nAdapter, setTheme, ColorMode, vClickOutside, vTooltip, vuelessConfig } from "vueless";
3
2
  import {
4
3
  TEXT,
5
4
  OUTLINE,
@@ -12,23 +11,19 @@ import {
12
11
  LIGHT_MODE_CLASS,
13
12
  DISABLED_OPACITY
14
13
  } from "vueless/constants";
15
- import { ColorMode } from "vueless/types";
16
- import vClickOutside from "vueless/directives/clickOutside/vClickOutside";
17
- import vTooltip from "vueless/directives/tooltip/vTooltip";
18
- import { vuelessConfig } from "vueless/utils/ui";
19
- import { useRuntimeConfig } from "#imports";
20
14
  import { defineNuxtPlugin } from "#app";
21
15
  function parseCookies(cookieHeader) {
22
16
  if (!cookieHeader) return {};
23
17
  return cookieHeader.split(";").reduce((acc, cookie) => {
24
18
  const [key, value] = cookie.trim().split("=");
25
- if (key) acc[key] = value;
19
+ if (key) {
20
+ acc[key] = value || "";
21
+ }
26
22
  return acc;
27
23
  }, {});
28
24
  }
29
25
  export default defineNuxtPlugin((_nuxtApp) => {
30
- const config = useRuntimeConfig().public.vueless;
31
- const vuelessOptions = { config };
26
+ const vuelessOptions = {};
32
27
  if ("$i18n" in _nuxtApp) {
33
28
  vuelessOptions.i18n = {
34
29
  adapter: createVueI18nAdapter({ global: _nuxtApp.$i18n })
@@ -43,25 +38,37 @@ export default defineNuxtPlugin((_nuxtApp) => {
43
38
  const cookies = parseCookies(event?.node.req.headers.cookie);
44
39
  const primary = cookies?.[`vl-${PRIMARY_COLOR}`];
45
40
  const neutral = cookies?.[`vl-${NEUTRAL_COLOR}`];
41
+ const textXs = Number(cookies?.[`vl-${TEXT}-xs`]);
42
+ const textSm = Number(cookies?.[`vl-${TEXT}-sm`]);
43
+ const textMd = Number(cookies?.[`vl-${TEXT}-md`]);
44
+ const textLg = Number(cookies?.[`vl-${TEXT}-lg`]);
46
45
  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`]
46
+ xs: !Number.isNaN(textXs) ? textXs : void 0,
47
+ sm: !Number.isNaN(textSm) ? textSm : void 0,
48
+ md: !Number.isNaN(textMd) ? textMd : void 0,
49
+ lg: !Number.isNaN(textLg) ? textLg : void 0
51
50
  };
51
+ const outlineSm = Number(cookies?.[`vl-${OUTLINE}-sm`]);
52
+ const outlineMd = Number(cookies?.[`vl-${OUTLINE}-md`]);
53
+ const outlineLg = Number(cookies?.[`vl-${OUTLINE}-lg`]);
52
54
  const outline = {
53
- sm: cookies?.[`vl-${OUTLINE}-sm`],
54
- md: cookies?.[`vl-${OUTLINE}-md`],
55
- lg: cookies?.[`vl-${OUTLINE}-lg`]
55
+ sm: !Number.isNaN(outlineSm) ? outlineSm : void 0,
56
+ md: !Number.isNaN(outlineMd) ? outlineMd : void 0,
57
+ lg: !Number.isNaN(outlineLg) ? outlineLg : void 0
56
58
  };
59
+ const roundingSm = Number(cookies?.[`vl-${ROUNDING}-sm`]);
60
+ const roundingMd = Number(cookies?.[`vl-${ROUNDING}-md`]);
61
+ const roundingLg = Number(cookies?.[`vl-${ROUNDING}-lg`]);
57
62
  const rounding = {
58
- sm: cookies?.[`vl-${ROUNDING}-sm`],
59
- md: cookies?.[`vl-${ROUNDING}-md`],
60
- lg: cookies?.[`vl-${ROUNDING}-lg`]
63
+ sm: !Number.isNaN(roundingSm) ? roundingSm : void 0,
64
+ md: !Number.isNaN(roundingMd) ? roundingMd : void 0,
65
+ lg: !Number.isNaN(roundingLg) ? roundingLg : void 0
61
66
  };
62
- const disabledOpacity = cookies?.[`vl-${DISABLED_OPACITY}`];
67
+ const disabledOpacityValue = Number(cookies?.[`vl-${DISABLED_OPACITY}`]);
68
+ const disabledOpacity = !Number.isNaN(disabledOpacityValue) ? disabledOpacityValue : void 0;
63
69
  const colorMode = cookies?.[COLOR_MODE_KEY] || vuelessConfig.colorMode || ColorMode.Light;
64
- const isCachedAutoMode = Boolean(Number(cookies?.[AUTO_MODE_KEY]));
70
+ const autoModeValue = Number(cookies?.[AUTO_MODE_KEY]);
71
+ const isCachedAutoMode = Boolean(!Number.isNaN(autoModeValue) ? autoModeValue : void 0);
65
72
  const themeRootVariables = setTheme({ primary, neutral, text, outline, rounding, disabledOpacity, colorMode }, isCachedAutoMode);
66
73
  const colorModeClass = colorMode === ColorMode.Dark ? DARK_MODE_CLASS : LIGHT_MODE_CLASS;
67
74
  _nuxtApp.ssrContext?.head.push({
package/package.json CHANGED
@@ -1,26 +1,10 @@
1
1
  {
2
2
  "name": "@vueless/nuxt",
3
- "version": "1.0.1-beta.1",
4
- "license": "MIT",
3
+ "version": "1.0.1-beta.10",
5
4
  "description": "Nuxt Styleless UI Component Library, powered by Tailwind CSS.",
6
- "keywords": [
7
- "vueless",
8
- "nuxt",
9
- "nuxt.js",
10
- "nuxt3",
11
- "ui library",
12
- "component library",
13
- "nuxt framework",
14
- "design system",
15
- "tailwind",
16
- "tailwindcss",
17
- "unstyled",
18
- "styleless",
19
- "headlessui",
20
- "ui"
21
- ],
5
+ "author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
22
6
  "homepage": "https://vueless.com",
23
- "author": "Johnny Grid",
7
+ "license": "MIT",
24
8
  "type": "module",
25
9
  "publishConfig": {
26
10
  "access": "public"
@@ -43,35 +27,35 @@
43
27
  "dev:preview": "nuxi preview playground",
44
28
  "prepack": "nuxi prepare && nuxt-module-build build && cp package.json LICENSE README.md dist/",
45
29
  "release:beta": "release-it --ci --npm.publish --preRelease=beta --increment=prerelease",
46
- "release:patch": "release-it patch --ci --npm.publish",
30
+ "release:patch": "release-it patch --ci --npm.publish --git.tag --github.release",
47
31
  "release:minor": "release-it minor --ci --npm.publish --git.tag --github.release",
48
32
  "release:major": "release-it major --ci --npm.publish --git.tag --github.release",
33
+ "ts:check": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
49
34
  "lint": "eslint . --no-fix",
50
35
  "lint:fix": "eslint . --fix",
51
36
  "lint:ci": "eslint . --no-fix --max-warnings=0",
52
37
  "test": "vitest run",
53
- "test:watch": "vitest watch",
54
- "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
38
+ "test:watch": "vitest watch"
55
39
  },
56
40
  "dependencies": {
57
- "@nuxt/kit": "^3.17.4",
58
- "vueless": "^1.0.1"
41
+ "vueless": "^1.1.1-beta.49"
59
42
  },
60
43
  "devDependencies": {
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",
44
+ "@material-symbols/svg-500": "^0.34.1",
45
+ "@nuxt/devtools": "^2.6.2",
46
+ "@nuxt/eslint-config": "^1.8.0",
47
+ "@nuxt/kit": "^4.0.3",
48
+ "@nuxt/module-builder": "^1.0.2",
49
+ "@nuxt/schema": "^4.0.3",
50
+ "@nuxt/test-utils": "^3.19.2",
67
51
  "@types/node": "latest",
68
- "changelogen": "^0.5.5",
69
- "eslint": "^9.27.0",
70
- "nuxt": "^3.17.4",
71
- "release-it": "^19.0.2",
52
+ "changelogen": "^0.6.2",
53
+ "eslint": "^9.33.0",
54
+ "nuxt": "^4.0.3",
55
+ "release-it": "^19.0.4",
72
56
  "typescript": "latest",
73
- "vitest": "^3.1.4",
74
- "vue-tsc": "^2.2.10"
57
+ "vitest": "^3.2.4",
58
+ "vue-tsc": "^3.0.5"
75
59
  },
76
60
  "repository": {
77
61
  "type": "git",
@@ -79,5 +63,22 @@
79
63
  },
80
64
  "bugs": {
81
65
  "url": "https://github.com/vuelessjs/vueless-module-nuxt/issues"
82
- }
66
+ },
67
+ "keywords": [
68
+ "vueless",
69
+ "nuxt",
70
+ "nuxt.js",
71
+ "nuxt3",
72
+ "nuxt4",
73
+ "ui library",
74
+ "component library",
75
+ "nuxt framework",
76
+ "design system",
77
+ "tailwind",
78
+ "tailwindcss",
79
+ "unstyled",
80
+ "styleless",
81
+ "headlessui",
82
+ "ui"
83
+ ]
83
84
  }