|
2 | 2 | import type { DocksContext } from '@vitejs/devtools-kit/client' |
3 | 3 | import { useEventListener, useScreenSafeArea } from '@vueuse/core' |
4 | 4 | import { computed, onMounted, reactive, ref, useTemplateRef, watchEffect } from 'vue' |
| 5 | +import { BUILTIN_ENTRY_CLIENT_AUTH_NOTICE } from '../constants' |
5 | 6 | import DockEntries from './DockEntries.vue' |
6 | 7 | import BracketLeft from './icons/BracketLeft.vue' |
7 | 8 | import BracketRight from './icons/BracketRight.vue' |
@@ -64,6 +65,13 @@ function onPointerDown(e: PointerEvent) { |
64 | 65 | draggingOffset.y = e.clientY - top - height / 2 |
65 | 66 | } |
66 | 67 |
|
| 68 | +const isRpcTrusted = ref(context.rpc.isTrusted) |
| 69 | +context.rpc.events.on('rpc:is-trusted:updated', (isTrusted) => { |
| 70 | + isRpcTrusted.value = isTrusted |
| 71 | + if (isTrusted && context.docks.selected?.id === BUILTIN_ENTRY_CLIENT_AUTH_NOTICE.id) |
| 72 | + context.docks.switchEntry(null) |
| 73 | +}) |
| 74 | +
|
67 | 75 | onMounted(() => { |
68 | 76 | windowSize.width = window.innerWidth |
69 | 77 | windowSize.height = window.innerHeight |
@@ -220,7 +228,10 @@ const panelStyle = computed(() => { |
220 | 228 | }) |
221 | 229 |
|
222 | 230 | onMounted(() => { |
223 | | - bringUp() |
| 231 | + if (context.panel.store.open && !isRpcTrusted.value) |
| 232 | + context.panel.store.open = false |
| 233 | + if (isRpcTrusted.value) |
| 234 | + bringUp() |
224 | 235 | recalculateCounter.value++ |
225 | 236 | }) |
226 | 237 | </script> |
@@ -264,13 +275,39 @@ onMounted(() => { |
264 | 275 | class="vite-devtools-dock-bracket absolute right--1 top-1/2 translate-y--1/2 bottom-0 w-2.5 op75 transition-opacity duration-300" |
265 | 276 | :class="context.panel.isVertical ? 'scale-y--100' : ''" |
266 | 277 | /> |
267 | | - <VitePlusCore |
| 278 | + <div |
268 | 279 | class="w-3 h-3 absolute left-1/2 top-1/2 translate-x--1/2 translate-y--1/2 transition-opacity duration-300" |
269 | | - :class="isMinimized ? 'op100' : 'op0'" |
270 | | - /> |
| 280 | + :class="[ |
| 281 | + isMinimized ? 'op100' : 'op0', |
| 282 | + context.panel.isVertical ? 'rotate-270' : 'rotate-0', |
| 283 | + ]" |
| 284 | + > |
| 285 | + <VitePlusCore /> |
| 286 | + <div v-if="!isRpcTrusted" class="i-fluent-emoji-flat-warning absolute bottom-0 right--1px w-1.5 h-1.5" /> |
| 287 | + </div> |
| 288 | + <div |
| 289 | + v-if="!isRpcTrusted" |
| 290 | + class="transition duration-300 delay-200" |
| 291 | + :class="isMinimized ? 'opacity-0 pointer-events-none ws-nowrap text-sm text-orange of-hidden' : 'opacity-100'" |
| 292 | + > |
| 293 | + <button |
| 294 | + class="p2 transition hover:bg-active rounded-full px4" |
| 295 | + @click="context.docks.toggleEntry(BUILTIN_ENTRY_CLIENT_AUTH_NOTICE.id)" |
| 296 | + > |
| 297 | + <div class="flex items-center gap-1"> |
| 298 | + <div |
| 299 | + class="i-fluent-emoji-flat-warning flex-none" |
| 300 | + :class="context.panel.isVertical ? 'rotate-270' : 'rotate-0'" |
| 301 | + /> |
| 302 | + <div class="ws-nowrap text-amber"> |
| 303 | + Unauthorized |
| 304 | + </div> |
| 305 | + </div> |
| 306 | + </button> |
| 307 | + </div> |
271 | 308 | <DockEntries |
272 | 309 | :entries="context.docks.entries" |
273 | | - class="transition duration-200 flex items-center w-full h-full justify-center" |
| 310 | + class="transition duration-200 flex items-center w-full h-full justify-center px3" |
274 | 311 | :class="isMinimized ? 'opacity-0 pointer-events-none' : 'opacity-100'" |
275 | 312 | :is-vertical="context.panel.isVertical" |
276 | 313 | :selected="context.docks.selected" |
|
0 commit comments