nuxtseo-layer-devtools 0.3.6 → 0.3.7
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/composables/rpc.ts
CHANGED
|
@@ -28,9 +28,9 @@ export function useDevtoolsConnection(options: DevtoolsConnectionOptions = {}):
|
|
|
28
28
|
onDevtoolsClientConnected(async (client) => {
|
|
29
29
|
isConnected.value = true
|
|
30
30
|
// @ts-expect-error untyped
|
|
31
|
-
appFetch.value = client.host
|
|
31
|
+
appFetch.value = client.host?.app?.$fetch
|
|
32
32
|
watchEffect(() => {
|
|
33
|
-
colorMode.value = client.host
|
|
33
|
+
colorMode.value = client.host?.app?.colorMode?.value ?? (
|
|
34
34
|
window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
|
|
35
35
|
)
|
|
36
36
|
})
|
|
@@ -38,14 +38,18 @@ export function useDevtoolsConnection(options: DevtoolsConnectionOptions = {}):
|
|
|
38
38
|
options.onConnected?.(client)
|
|
39
39
|
|
|
40
40
|
if (options.onRouteChange) {
|
|
41
|
-
const $route = client.host
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
const $route = client.host?.nuxt?.vueApp?.config?.globalProperties?.$route
|
|
42
|
+
if ($route)
|
|
43
|
+
options.onRouteChange($route)
|
|
44
|
+
const $router = client.host?.nuxt?.$router
|
|
45
|
+
if ($router) {
|
|
46
|
+
const removeAfterEach = $router.afterEach((route: any) => {
|
|
47
|
+
options.onRouteChange!(route)
|
|
48
|
+
})
|
|
49
|
+
// Clean up when devtools client disconnects
|
|
50
|
+
// @ts-expect-error app:unmount exists at runtime but is not in RuntimeNuxtHooks
|
|
51
|
+
client.host.nuxt.hook('app:unmount', removeAfterEach)
|
|
52
|
+
}
|
|
49
53
|
}
|
|
50
54
|
})
|
|
51
55
|
|
package/package.json
CHANGED
|
@@ -8,8 +8,8 @@ export default defineNuxtPlugin(() => {
|
|
|
8
8
|
|
|
9
9
|
useDevtoolsConnection({
|
|
10
10
|
onConnected(client) {
|
|
11
|
-
const props = client.host
|
|
12
|
-
base.value = props?.$router?.options?.history?.base || client.host
|
|
11
|
+
const props = client.host?.nuxt?.vueApp?.config?.globalProperties
|
|
12
|
+
base.value = props?.$router?.options?.history?.base || client.host?.app?.baseURL || '/'
|
|
13
13
|
const $route = props?.$route
|
|
14
14
|
if ($route) {
|
|
15
15
|
path.value = $route.path || '/'
|