@vueless/nuxt 0.0.9-beta.1 → 0.0.9-beta.11

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.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.13.0"
6
6
  },
7
- "version": "0.0.9-beta.1",
7
+ "version": "0.0.9-beta.11",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -1,9 +1,10 @@
1
+ import { existsSync, copyFileSync } from 'node:fs';
1
2
  import { defineNuxtModule, createResolver, addPlugin, addComponent, addImportsDir } from '@nuxt/kit';
2
3
  import TailwindCSS from '@tailwindcss/vite';
3
- import { COMPONENTS } from 'vueless/constants.js';
4
4
  import { Vueless } from 'vueless/plugin-vite.js';
5
5
  import { getNuxtDirs } from 'vueless/utils/node/helper.js';
6
6
  import { createTailwindSafelist } from 'vueless/utils/node/tailwindSafelist.js';
7
+ import { VUELESS_CACHE_DIR, VUELESS_CONFIG_FILE_NAME, COMPONENTS } from 'vueless/constants.js';
7
8
 
8
9
  const module = defineNuxtModule({
9
10
  meta: {
@@ -28,6 +29,13 @@ const module = defineNuxtModule({
28
29
  Vueless({ mode: "nuxt-module", mirrorCacheDir, debug })
29
30
  );
30
31
  });
32
+ _nuxt.hook("nitro:build:public-assets", () => {
33
+ const source = resolve(process.cwd(), `${VUELESS_CACHE_DIR}/${VUELESS_CONFIG_FILE_NAME}.mjs`);
34
+ const destination = resolve(process.cwd(), `.output/${VUELESS_CONFIG_FILE_NAME}.js`);
35
+ if (existsSync(source)) {
36
+ copyFileSync(source, destination);
37
+ }
38
+ });
31
39
  await createTailwindSafelist({
32
40
  targetFiles: getNuxtDirs()
33
41
  });
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueless/nuxt",
3
- "version": "0.0.9-beta.1",
3
+ "version": "0.0.9-beta.11",
4
4
  "license": "MIT",
5
5
  "description": "Nuxt Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -58,7 +58,7 @@
58
58
  "@nuxt/kit": "^3.13.1",
59
59
  "@tailwindcss/vite": "^4.0.14",
60
60
  "tailwindcss": "^4.0.14",
61
- "vueless": "^0.0.825-beta.7"
61
+ "vueless": "^0.0.825-beta.55"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@material-symbols/svg-500": "^0.29.1",
@@ -1,16 +1,35 @@
1
1
  import { createVueless, setTheme } from "vueless";
2
+ import { COLOR_MODE_KEY, AUTO_MODE_KEY, LIGHT_MODE_SELECTOR, DARK_MODE_SELECTOR, PRIMARY_COLOR_KEY, NEUTRAL_COLOR_KEY, ROUNDING_KEY } from "vueless/constants";
3
+ import { ColorMode } from "vueless/types";
2
4
  import vClickOutside from "vueless/directives/clickOutside/vClickOutside";
3
5
  import vTooltip from "vueless/directives/tooltip/vTooltip";
4
6
  import { defineNuxtPlugin } from "#app";
7
+ function parseCookies(cookieHeader) {
8
+ if (!cookieHeader) return {};
9
+ return cookieHeader.split(";").reduce((acc, cookie) => {
10
+ const [key, value] = cookie.trim().split("=");
11
+ if (key) acc[key] = value;
12
+ return acc;
13
+ }, {});
14
+ }
5
15
  export default defineNuxtPlugin((_nuxtApp) => {
6
16
  const vueless = createVueless();
7
17
  _nuxtApp.vueApp.use(vueless, []);
8
18
  _nuxtApp.vueApp.directive("clickOutside", vClickOutside);
9
19
  _nuxtApp.vueApp.directive("tooltip", vTooltip);
10
20
  if (import.meta.server) {
11
- const themeRootVariables = setTheme();
21
+ const event = _nuxtApp.ssrContext?.event;
22
+ const cookies = parseCookies(event?.node.req.headers.cookie);
23
+ const primary = cookies?.[PRIMARY_COLOR_KEY];
24
+ const neutral = cookies?.[NEUTRAL_COLOR_KEY];
25
+ const rounding = cookies?.[ROUNDING_KEY];
26
+ const colorMode = cookies?.[COLOR_MODE_KEY];
27
+ const isCachedAutoMode = Boolean(Number(cookies?.[AUTO_MODE_KEY]));
28
+ const themeRootVariables = setTheme({ primary, neutral, rounding, colorMode }, isCachedAutoMode);
29
+ const colorModeClass = colorMode === ColorMode.Dark ? DARK_MODE_SELECTOR : LIGHT_MODE_SELECTOR;
12
30
  _nuxtApp.ssrContext?.head.push({
13
- style: [{ innerHTML: themeRootVariables }]
31
+ style: [{ innerHTML: themeRootVariables }],
32
+ htmlAttrs: { class: colorModeClass }
14
33
  });
15
34
  }
16
35
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vueless/nuxt",
3
- "version": "0.0.9-beta.1",
3
+ "version": "0.0.9-beta.11",
4
4
  "license": "MIT",
5
5
  "description": "Nuxt Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -58,7 +58,7 @@
58
58
  "@nuxt/kit": "^3.13.1",
59
59
  "@tailwindcss/vite": "^4.0.14",
60
60
  "tailwindcss": "^4.0.14",
61
- "vueless": "^0.0.825-beta.7"
61
+ "vueless": "^0.0.825-beta.55"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@material-symbols/svg-500": "^0.29.1",