11<script setup lang="ts">
22import type { DocksContext } from ' @vitejs/devtools-kit/client'
33import { getDevToolsRpcClient } from ' @vitejs/devtools-kit/client'
4- import { markRaw , useTemplateRef } from ' vue'
4+ import { markRaw , ref , useTemplateRef , watch } from ' vue'
55import DockEntries from ' ../webcomponents/components/DockEntries.vue'
66import VitePlus from ' ../webcomponents/components/icons/VitePlus.vue'
7+ import ViewBuiltinClientAuthNotice from ' ../webcomponents/components/ViewBuiltinClientAuthNotice.vue'
78import ViewEntry from ' ../webcomponents/components/ViewEntry.vue'
89import { createDocksContext } from ' ../webcomponents/state/context'
910import { PersistedDomViewsManager } from ' ../webcomponents/utils/PersistedDomViewsManager'
@@ -21,11 +22,25 @@ const context: DocksContext = await createDocksContext(
2122 rpc ,
2223)
2324
24- context .docks .selectedId || = context .docks .entries [0 ]?.id ?? null
25+ const isRpcTrusted = ref (context .rpc .isTrusted )
26+ context .rpc .events .on (' rpc:is-trusted:updated' , (isTrusted ) => {
27+ isRpcTrusted .value = isTrusted
28+ })
29+
30+ watch (
31+ () => context .docks .entries ,
32+ () => {
33+ context .docks .selectedId || = context .docks .entries [0 ]?.id ?? null
34+ },
35+ { immediate: true },
36+ )
2537 </script >
2638
2739<template >
28- <div class =" h-screen w-screen of-hidden grid cols-[max-content_1fr]" >
40+ <div v-if =" !isRpcTrusted" class =" h-screen w-screen of-hidden" >
41+ <ViewBuiltinClientAuthNotice :context =" context" />
42+ </div >
43+ <div v-else class =" h-screen w-screen of-hidden grid cols-[max-content_1fr]" >
2944 <div class =" border-r border-base flex flex-col" >
3045 <div class =" p2 border-b border-base flex" >
3146 <VitePlus class =" w-7 h-7 ma" />
0 commit comments