nuxtseo-layer-devtools 0.3.1 → 0.3.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.
@@ -33,7 +33,9 @@ export function useDevtoolsConnection(options: DevtoolsConnectionOptions = {}):
33
33
  // @ts-expect-error untyped
34
34
  appFetch.value = client.host.app.$fetch
35
35
  watchEffect(() => {
36
- colorMode.value = client.host.app.colorMode.value
36
+ colorMode.value = client.host.app.colorMode?.value ?? (
37
+ window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
38
+ )
37
39
  })
38
40
  devtools.value = client.devtools
39
41
  options.onConnected?.(client)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxtseo-layer-devtools",
3
3
  "type": "module",
4
- "version": "0.3.1",
4
+ "version": "0.3.5",
5
5
  "description": "Shared Nuxt layer for Nuxt SEO devtools clients.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -22,6 +22,7 @@
22
22
  "components",
23
23
  "composables",
24
24
  "nuxt.config.ts",
25
+ "plugins",
25
26
  "skills"
26
27
  ],
27
28
  "dependencies": {
@@ -0,0 +1,19 @@
1
+ export default defineNuxtPlugin(() => {
2
+ useDevtoolsConnection({
3
+ onConnected(client) {
4
+ const props = client.host.nuxt.vueApp.config.globalProperties
5
+ base.value = props?.$router?.options?.history?.base || client.host.app.baseURL || '/'
6
+ const $route = props?.$route
7
+ if ($route) {
8
+ path.value = $route.path || '/'
9
+ query.value = $route.query
10
+ }
11
+ refreshSources()
12
+ },
13
+ onRouteChange(route) {
14
+ path.value = route.path
15
+ query.value = route.query
16
+ refreshSources()
17
+ },
18
+ })
19
+ })