vuetify-nuxt-module 0.6.2 → 0.6.5

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.ts CHANGED
@@ -398,7 +398,7 @@ declare module '@nuxt/schema' {
398
398
  'vuetify:registerModule': (registerModule: (config: InlineModuleOptions) => void) => void;
399
399
  }
400
400
  }
401
- declare module '#app' {
401
+ declare module '#app/nuxt' {
402
402
  interface NuxtApp {
403
403
  $vuetify: ReturnType<typeof vuetify['createVuetify']>;
404
404
  /**
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.6.2"
7
+ "version": "0.6.5"
8
8
  }
package/dist/module.mjs CHANGED
@@ -15,7 +15,7 @@ import { parseQuery, parseURL } from 'ufo';
15
15
  import destr from 'destr';
16
16
  import { transformAssetUrls } from 'vite-plugin-vuetify';
17
17
 
18
- const version = "0.6.2";
18
+ const version = "0.6.5";
19
19
 
20
20
  const VIRTUAL_VUETIFY_CONFIGURATION = "virtual:vuetify-configuration";
21
21
  const RESOLVED_VIRTUAL_VUETIFY_CONFIGURATION = `/@nuxt-vuetify-configuration/${VIRTUAL_VUETIFY_CONFIGURATION.slice("virtual:".length)}`;
@@ -290,7 +290,7 @@ function prepareIcons(unocssPresent, logger, vuetifyOptions) {
290
290
  resolvedIcons.imports.push(`import {${defaultSet === "fa-svg" ? "aliases," : ""}fa} from 'vuetify/iconsets/fa-svg'`);
291
291
  resolvedIcons.imports.push("import { library } from '@fortawesome/fontawesome-svg-core'");
292
292
  resolvedIcons.imports.push("import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'");
293
- resolvedIcons.imports.push("import { useNuxtApp } from '#app'");
293
+ resolvedIcons.imports.push("import { useNuxtApp } from '#imports'");
294
294
  resolvedIcons.svg.fa = ["useNuxtApp().vueApp.component('font-awesome-icon', FontAwesomeIcon)"];
295
295
  faSvg.libraries.forEach(([defaultExport, name, library]) => {
296
296
  resolvedIcons.imports.push(`import ${defaultExport ? name : `{${name}}`} from '${library}'`);
@@ -598,6 +598,8 @@ function vuetifyStylesPlugin(options, logger) {
598
598
  }
599
599
  },
600
600
  configResolved(config) {
601
+ if (config.plugins.findIndex((plugin) => plugin.name === "vuetify:styles") > -1)
602
+ throw new Error("Remove vite-plugin-vuetify from your Nuxt config file, this module registers a modified version.");
601
603
  if (typeof options.styles === "object") {
602
604
  if (isAbsolute(options.styles.configFile))
603
605
  configFile = options.styles.configFile;
@@ -1210,10 +1212,10 @@ function parseId(id) {
1210
1212
  }
1211
1213
  function vuetifyImportPlugin() {
1212
1214
  return {
1213
- name: "vuetify:import",
1215
+ name: "vuetify:import:nuxt",
1214
1216
  configResolved(config) {
1215
- if (config.plugins.findIndex((plugin) => plugin.name === "vuetify:import") < config.plugins.findIndex((plugin) => plugin.name === "vite:vue"))
1216
- throw new Error("Vuetify plugin must be loaded after the vue plugin");
1217
+ if (config.plugins.findIndex((plugin) => plugin.name === "vuetify:import") > -1)
1218
+ throw new Error("Remove vite-plugin-vuetify from your Nuxt config file, this module registers a modified version.");
1217
1219
  },
1218
1220
  async transform(code, id) {
1219
1221
  const { query, path } = parseId(id);
@@ -1,6 +1,6 @@
1
1
  import { createVuetify } from "vuetify";
2
2
  import { isDev, vuetifyConfiguration } from "virtual:vuetify-configuration";
3
- import { useNuxtApp } from "#app";
3
+ import { useNuxtApp } from "#imports";
4
4
  export async function configureVuetify() {
5
5
  const nuxtApp = useNuxtApp();
6
6
  const vuetifyOptions = vuetifyConfiguration();
@@ -1,5 +1,5 @@
1
1
  import { adapter, dateConfiguration, enabled, i18n } from "virtual:vuetify-date-configuration";
2
- import { useNuxtApp } from "#app";
2
+ import { useNuxtApp } from "#imports";
3
3
  export function configureDate(vuetifyOptions) {
4
4
  if (adapter === "custom" || !enabled)
5
5
  return;
@@ -1,6 +1,6 @@
1
1
  import { ref, watch } from "vue";
2
2
  import { useI18n } from "vue-i18n";
3
- import { useNuxtApp } from "#app";
3
+ import { useNuxtApp } from "#imports";
4
4
  export function createAdapter(vuetifyOptions) {
5
5
  vuetifyOptions.locale = {};
6
6
  const nuxtApp = useNuxtApp();
@@ -50,8 +50,14 @@ export default defineNuxtPlugin((nuxtApp) => {
50
50
  clientHeight
51
51
  } : true;
52
52
  }
53
- if (prefersColorScheme && prefersColorSchemeOptions)
54
- vuetifyOptions.theme.defaultTheme = state.value.colorSchemeFromCookie ?? prefersColorSchemeOptions.defaultTheme;
53
+ if (prefersColorScheme && prefersColorSchemeOptions) {
54
+ if (vuetifyOptions.theme === false) {
55
+ vuetifyOptions.theme = { defaultTheme: state.value.colorSchemeFromCookie ?? prefersColorSchemeOptions.defaultTheme };
56
+ } else {
57
+ vuetifyOptions.theme = vuetifyOptions.theme ?? {};
58
+ vuetifyOptions.theme.defaultTheme = state.value.colorSchemeFromCookie ?? prefersColorSchemeOptions.defaultTheme;
59
+ }
60
+ }
55
61
  });
56
62
  if (prefersColorScheme && prefersColorSchemeOptions) {
57
63
  const themeCookie = state.value.colorSchemeCookie;
@@ -9,6 +9,7 @@ import {
9
9
  defineNuxtPlugin,
10
10
  useCookie,
11
11
  useNuxtApp,
12
+ useRequestEvent,
12
13
  useRequestHeaders,
13
14
  useState
14
15
  } from "#imports";
@@ -42,11 +43,20 @@ export default defineNuxtPlugin((nuxtApp) => {
42
43
  clientWidth,
43
44
  clientHeight
44
45
  } : true;
45
- if (clientHintsRequest.colorSchemeFromCookie)
46
- vuetifyOptions.theme.defaultTheme = clientHintsRequest.colorSchemeFromCookie;
46
+ if (clientHintsRequest.colorSchemeFromCookie) {
47
+ if (vuetifyOptions.theme === false) {
48
+ vuetifyOptions.theme = { defaultTheme: clientHintsRequest.colorSchemeFromCookie };
49
+ } else {
50
+ vuetifyOptions.theme ??= {};
51
+ vuetifyOptions.theme.defaultTheme = clientHintsRequest.colorSchemeFromCookie;
52
+ }
53
+ }
47
54
  await nuxtApp.hooks.callHook("vuetify:ssr-client-hints", {
48
55
  vuetifyOptions,
49
- ssrClientHintsConfiguration,
56
+ ssrClientHintsConfiguration: {
57
+ ...ssrClientHintsConfiguration,
58
+ enabled: true
59
+ },
50
60
  ssrClientHints: state.value
51
61
  });
52
62
  });
@@ -1,6 +1,5 @@
1
1
  import { configureVuetify } from "./config.mjs";
2
- import { defineNuxtPlugin } from "#imports";
3
- import { useNuxtApp } from "#app";
2
+ import { defineNuxtPlugin, useNuxtApp } from "#imports";
4
3
  export default defineNuxtPlugin({
5
4
  name: "vuetify:configuration:plugin",
6
5
  enforce: "post",
@@ -1,6 +1,5 @@
1
1
  import { configureVuetify } from "./config.mjs";
2
- import { defineNuxtPlugin } from "#imports";
3
- import { useNuxtApp } from "#app";
2
+ import { defineNuxtPlugin, useNuxtApp } from "#imports";
4
3
  export default defineNuxtPlugin({
5
4
  name: "vuetify:configuration:plugin",
6
5
  enforce: "post",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vuetify-nuxt-module",
3
3
  "type": "module",
4
- "version": "0.6.2",
4
+ "version": "0.6.5",
5
5
  "packageManager": "pnpm@8.10.2",
6
6
  "description": "Zero-Config Nuxt Module for Vuetify",
7
7
  "author": "userquin <userquin@gmail.com>",
@@ -43,30 +43,33 @@
43
43
  "*.mjs"
44
44
  ],
45
45
  "scripts": {
46
- "build": "pnpm dev:prepare && nuxt-module-build",
46
+ "prepack": "nuxt-module-build prepare && nuxt-module-build",
47
47
  "dev": "nuxi dev playground",
48
48
  "dev:multiple-json": "MULTIPLE_LANG_FILES=true nuxi dev playground",
49
- "dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
50
- "dev:prepare:multiple-json": "nuxt-module-build --stub && MULTIPLE_LANG_FILES=true nuxi prepare playground",
49
+ "dev:prepare": "nuxt-module-build --stub && nuxt-module-build prepare && nuxi prepare playground",
50
+ "dev:prepare:multiple-json": "nuxt-module-build --stub && nuxt-module-build prepare && MULTIPLE_LANG_FILES=true nuxi prepare playground",
51
51
  "dev:build": "nuxi build playground",
52
52
  "dev:generate": "nuxi generate playground",
53
53
  "dev:build:multiple-json": "MULTIPLE_LANG_FILES=true nuxi build playground",
54
54
  "dev:generate:multiple-json": "MULTIPLE_LANG_FILES=true nuxi generate playground",
55
55
  "dev:preview": "nuxi preview playground",
56
56
  "docs:dev": "pnpm -C docs run dev",
57
- "docs:build": "pnpm dev:prepare && pnpm -C docs run build",
57
+ "docs:build": "nuxt-module-build prepare && pnpm -C docs run build",
58
58
  "docs:serve": "pnpm -C docs run serve",
59
59
  "lint": "eslint .",
60
60
  "lint:fix": "nr lint --fix",
61
61
  "test": "vitest run",
62
62
  "test:watch": "vitest watch",
63
- "prepublishOnly": "pnpm build",
64
63
  "release": "bumpp && npm publish"
65
64
  },
66
65
  "dependencies": {
67
66
  "@nuxt/kit": "^3.6.2",
68
67
  "defu": "^6.1.2",
68
+ "destr": "^2.0.2",
69
+ "local-pkg": "^0.5.0",
70
+ "pathe": "^1.1.1",
69
71
  "perfect-debounce": "^1.0.0",
72
+ "ufo": "^1.3.1",
70
73
  "unconfig": "^0.3.9",
71
74
  "vite-plugin-vuetify": "^1.0.2",
72
75
  "vuetify": "^3.3.23"
@@ -127,6 +130,6 @@
127
130
  },
128
131
  "stackblitz": {
129
132
  "installDependencies": false,
130
- "startCommand": "node .stackblitz.js && pnpm install && pnpm run dev"
133
+ "startCommand": "node .stackblitz.js && pnpm install && pnpm dev:prepare && pnpm run dev"
131
134
  }
132
- }
135
+ }