vuetify-nuxt-module 0.5.10 → 0.5.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,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.5.10"
7
+ "version": "0.5.11"
8
8
  }
package/dist/module.mjs CHANGED
@@ -12,7 +12,7 @@ import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';
12
12
  import { isAbsolute, join, relative } from 'pathe';
13
13
  import { normalizePath as normalizePath$1 } from 'vite';
14
14
 
15
- const version = "0.5.10";
15
+ const version = "0.5.11";
16
16
 
17
17
  const VIRTUAL_VUETIFY_CONFIGURATION = "virtual:vuetify-configuration";
18
18
  const RESOLVED_VIRTUAL_VUETIFY_CONFIGURATION = `/@nuxt-vuetify-configuration/${VIRTUAL_VUETIFY_CONFIGURATION.slice("virtual:".length)}`;
@@ -1,7 +1,7 @@
1
1
  import { ssrClientHintsConfiguration } from "virtual:vuetify-ssr-client-hints-configuration";
2
+ import { reactive, watch } from "vue";
2
3
  import { VuetifyHTTPClientHints } from "./client-hints.mjs";
3
- import { defineNuxtPlugin } from "#imports";
4
- import { useNuxtApp } from "#app";
4
+ import { defineNuxtPlugin, useNuxtApp, useState } from "#imports";
5
5
  export default defineNuxtPlugin((nuxtApp) => {
6
6
  const state = useState(VuetifyHTTPClientHints);
7
7
  const {
@@ -67,9 +67,9 @@ export default defineNuxtPlugin((nuxtApp) => {
67
67
  if (prefersColorSchemeOptions.useBrowserThemeOnly) {
68
68
  const { darkThemeName, lightThemeName } = prefersColorSchemeOptions;
69
69
  const prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
70
- const prefersLight = window.matchMedia("(prefers-color-scheme: light)");
71
- prefersDark.addEventListener("change", (e) => switchTheme(e, darkThemeName, vuetify));
72
- prefersLight.addEventListener("change", (e) => switchTheme(e, lightThemeName, vuetify));
70
+ prefersDark.addEventListener("change", (e) => {
71
+ vuetify.theme.global.name.value = e.matches ? darkThemeName : lightThemeName;
72
+ });
73
73
  }
74
74
  });
75
75
  }
@@ -81,6 +81,3 @@ export default defineNuxtPlugin((nuxtApp) => {
81
81
  })
82
82
  };
83
83
  });
84
- function switchTheme(e, newThemeName, vuetify) {
85
- e.matches && (vuetify.theme.global.name.value = newThemeName);
86
- }
@@ -1,7 +1,16 @@
1
- import { ssrClientHintsConfiguration } from "virtual:vuetify-ssr-client-hints-configuration";
1
+ import {
2
+ ssrClientHintsConfiguration
3
+ } from "virtual:vuetify-ssr-client-hints-configuration";
4
+ import { reactive } from "vue";
2
5
  import { parseUserAgent } from "./detect-browser.mjs";
3
6
  import { VuetifyHTTPClientHints } from "./client-hints.mjs";
4
- import { defineNuxtPlugin, useNuxtApp } from "#imports";
7
+ import {
8
+ defineNuxtPlugin,
9
+ useCookie,
10
+ useNuxtApp,
11
+ useRequestEvent,
12
+ useState
13
+ } from "#imports";
5
14
  export default defineNuxtPlugin((nuxtApp) => {
6
15
  const event = useRequestEvent();
7
16
  const state = useState(VuetifyHTTPClientHints);
@@ -185,6 +194,14 @@ function writeClientHintHeaders(key, headers) {
185
194
  headers[header] = (headers[header] ? headers[header] : []).concat(key);
186
195
  });
187
196
  }
197
+ function withNuxtAppRendered(callback) {
198
+ const nuxtApp = useNuxtApp();
199
+ const unhook = nuxtApp.hooks.hookOnce("app:rendered", callback);
200
+ nuxtApp.hooks.hookOnce("app:error", () => {
201
+ unhook();
202
+ return callback();
203
+ });
204
+ }
188
205
  function writeClientHintsResponseHeaders(clientHintsRequest, ssrClientHintsConfiguration2, response) {
189
206
  const headers = {};
190
207
  if (ssrClientHintsConfiguration2.prefersColorScheme && clientHintsRequest.prefersColorSchemeAvailable)
@@ -203,14 +220,6 @@ function writeClientHintsResponseHeaders(clientHintsRequest, ssrClientHintsConfi
203
220
  });
204
221
  });
205
222
  }
206
- function withNuxtAppRendered(callback) {
207
- const nuxtApp = useNuxtApp();
208
- const unhook = nuxtApp.hooks.hookOnce("app:rendered", callback);
209
- nuxtApp.hooks.hookOnce("app:error", () => {
210
- unhook();
211
- return callback();
212
- });
213
- }
214
223
  function writeThemeCookie(clientHintsRequest, ssrClientHintsConfiguration2) {
215
224
  if (!ssrClientHintsConfiguration2.prefersColorScheme || !ssrClientHintsConfiguration2.prefersColorSchemeOptions)
216
225
  return;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vuetify-nuxt-module",
3
3
  "type": "module",
4
- "version": "0.5.10",
4
+ "version": "0.5.11",
5
5
  "packageManager": "pnpm@8.7.6",
6
6
  "description": "Zero-Config Nuxt Module for Vuetify",
7
7
  "author": "userquin <userquin@gmail.com>",
@@ -128,4 +128,4 @@
128
128
  "installDependencies": false,
129
129
  "startCommand": "node .stackblitz.js && pnpm install && pnpm run dev"
130
130
  }
131
- }
131
+ }