vuetify-nuxt-module 0.5.16 → 0.6.0

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.16"
7
+ "version": "0.6.0"
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.16";
15
+ const version = "0.6.0";
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)}`;
@@ -5,7 +5,7 @@ export interface ClientHintRequestFeatures {
5
5
  viewportHeightAvailable: boolean;
6
6
  viewportWidthAvailable: boolean;
7
7
  }
8
- export interface ClientHintsRequest extends ClientHintRequestFeatures {
8
+ export interface SSRClientHints extends ClientHintRequestFeatures {
9
9
  prefersColorScheme?: 'dark' | 'light' | 'no-preference';
10
10
  prefersReducedMotion?: 'no-preference' | 'reduce';
11
11
  viewportHeight?: number;
@@ -13,7 +13,4 @@ export interface ClientHintsRequest extends ClientHintRequestFeatures {
13
13
  colorSchemeFromCookie?: string;
14
14
  colorSchemeCookie?: string;
15
15
  }
16
- export interface SSRClientHints {
17
- ssrClientHints: ClientHintsRequest;
18
- }
19
16
  export declare const VuetifyHTTPClientHints = "vuetify:nuxt:ssr-client-hints";
@@ -10,7 +10,7 @@ export default defineNuxtPlugin((nuxtApp) => {
10
10
  prefersReducedMotionAvailable,
11
11
  viewportHeightAvailable,
12
12
  viewportWidthAvailable
13
- } = state.value.ssrClientHints;
13
+ } = state.value;
14
14
  const {
15
15
  reloadOnFirstRequest,
16
16
  viewportSize,
@@ -20,12 +20,12 @@ export default defineNuxtPlugin((nuxtApp) => {
20
20
  } = ssrClientHintsConfiguration;
21
21
  if (firstRequest && reloadOnFirstRequest) {
22
22
  if (prefersColorScheme) {
23
- const themeCookie = state.value.ssrClientHints.colorSchemeCookie;
23
+ const themeCookie = state.value.colorSchemeCookie;
24
24
  if (prefersColorSchemeOptions && themeCookie) {
25
25
  const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
26
26
  const cookieName = prefersColorSchemeOptions.cookieName;
27
27
  const parseCookieName = `${cookieName}=`;
28
- const cookieEntry = `${parseCookieName}${state.value.ssrClientHints.colorSchemeFromCookie ?? prefersColorSchemeOptions.defaultTheme};`;
28
+ const cookieEntry = `${parseCookieName}${state.value.colorSchemeFromCookie ?? prefersColorSchemeOptions.defaultTheme};`;
29
29
  const newThemeName = prefersDark ? prefersColorSchemeOptions.darkThemeName : prefersColorSchemeOptions.lightThemeName;
30
30
  document.cookie = themeCookie.replace(cookieEntry, `${cookieName}=${newThemeName};`);
31
31
  window.location.reload();
@@ -43,24 +43,24 @@ export default defineNuxtPlugin((nuxtApp) => {
43
43
  if (viewportSize || prefersColorScheme && prefersColorSchemeOptions) {
44
44
  nuxtApp.hook("vuetify:before-create", ({ vuetifyOptions }) => {
45
45
  if (viewportSize) {
46
- const clientWidth = state.value.ssrClientHints.viewportWidth;
47
- const clientHeight = state.value.ssrClientHints.viewportHeight;
46
+ const clientWidth = state.value.viewportWidth;
47
+ const clientHeight = state.value.viewportHeight;
48
48
  vuetifyOptions.ssr = typeof clientWidth === "number" ? {
49
49
  clientWidth,
50
50
  clientHeight
51
51
  } : true;
52
52
  }
53
53
  if (prefersColorScheme && prefersColorSchemeOptions)
54
- vuetifyOptions.theme.defaultTheme = state.value.ssrClientHints.colorSchemeFromCookie ?? prefersColorSchemeOptions.defaultTheme;
54
+ vuetifyOptions.theme.defaultTheme = state.value.colorSchemeFromCookie ?? prefersColorSchemeOptions.defaultTheme;
55
55
  });
56
56
  if (prefersColorScheme && prefersColorSchemeOptions) {
57
- const themeCookie = state.value.ssrClientHints.colorSchemeCookie;
57
+ const themeCookie = state.value.colorSchemeCookie;
58
58
  if (themeCookie) {
59
59
  nuxtApp.hook("app:beforeMount", () => {
60
60
  const vuetify = useNuxtApp().$vuetify;
61
61
  const cookieName = prefersColorSchemeOptions.cookieName;
62
62
  const parseCookieName = `${cookieName}=`;
63
- const cookieEntry = `${parseCookieName}${state.value.ssrClientHints.colorSchemeFromCookie ?? prefersColorSchemeOptions.defaultTheme};`;
63
+ const cookieEntry = `${parseCookieName}${state.value.colorSchemeFromCookie ?? prefersColorSchemeOptions.defaultTheme};`;
64
64
  watch(vuetify.theme.global.name, (newThemeName) => {
65
65
  document.cookie = themeCookie.replace(cookieEntry, `${cookieName}=${newThemeName};`);
66
66
  });
@@ -21,10 +21,8 @@ export default defineNuxtPlugin((nuxtApp) => {
21
21
  const userAgent = userAgentHeader ? parseUserAgent(userAgentHeader) : null;
22
22
  const clientHintsRequest = collectClientHints(userAgent, ssrClientHintsConfiguration, requestHeaders);
23
23
  writeClientHintsResponseHeaders(clientHintsRequest, ssrClientHintsConfiguration, response);
24
- state.value = {
25
- ssrClientHints: clientHintsRequest
26
- };
27
- state.value.ssrClientHints.colorSchemeCookie = writeThemeCookie(
24
+ state.value = clientHintsRequest;
25
+ state.value.colorSchemeCookie = writeThemeCookie(
28
26
  clientHintsRequest,
29
27
  ssrClientHintsConfiguration
30
28
  );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vuetify-nuxt-module",
3
3
  "type": "module",
4
- "version": "0.5.16",
4
+ "version": "0.6.0",
5
5
  "packageManager": "pnpm@8.9.2",
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
+ }