11<script setup lang="ts">
22import { useIdle , useIntervalFn , useTimeoutFn } from ' @vueuse/core'
3- import waitFor from ' p-wait-for'
43
54import Badge from ' @/components/Badge.vue'
65import IconButton from ' @/components/IconButton.vue'
@@ -12,36 +11,22 @@ import CodeSection from '@/components/sections/CodeSection.vue'
1211import ErrorSection from ' @/components/sections/ErrorSection.vue'
1312import MetaSection from ' @/components/sections/MetaSection.vue'
1413import PrefSection from ' @/components/sections/PrefSection.vue'
15- import { syncSelection , useKeyLock , useSelection } from ' @/composables'
16- import { useMcp } from ' @/composables'
14+ import {
15+ syncSelection ,
16+ useFigmaAvailability ,
17+ useKeyLock ,
18+ useMcp ,
19+ useSelection
20+ } from ' @/composables'
1721import { layoutReady , options , runtimeMode , selection } from ' @/ui/state'
18- import { getCanvas , getLeftPanel } from ' @/utils'
22+ import { getCanvas } from ' @/utils'
1923
2024useSelection ()
2125useKeyLock ()
2226
23- const LAYOUT_CHECK_INTERVAL = 500
27+ const HINT_CHECK_INTERVAL = 500
2428
25- function isLayoutReady() {
26- return getCanvas () != null && getLeftPanel () != null
27- }
28-
29- useIntervalFn (
30- () => {
31- const ready = isLayoutReady ()
32- if (ready !== layoutReady .value ) {
33- layoutReady .value = ready
34- }
35- },
36- LAYOUT_CHECK_INTERVAL ,
37- { immediate: true }
38- )
39-
40- onMounted (() => {
41- waitFor (isLayoutReady ).then (() => {
42- layoutReady .value = true
43- })
44- })
29+ useFigmaAvailability ()
4530
4631const HINT_IDLE_MS = 10000
4732
@@ -120,7 +105,7 @@ function updateHintOverlap() {
120105 lowVisibility .value = overlapWidth < panelRect .width / 3
121106}
122107
123- useIntervalFn (updateHintOverlap , LAYOUT_CHECK_INTERVAL , { immediate: true })
108+ useIntervalFn (updateHintOverlap , HINT_CHECK_INTERVAL , { immediate: true })
124109
125110useTimeoutFn (() => {
126111 initialLock .value = false
@@ -147,6 +132,7 @@ function activateMcp() {
147132
148133<template >
149134 <Panel
135+ v-show =" layoutReady"
150136 class =" tp-main"
151137 :class =" { 'tp-main-minimized': options.minimized, 'tp-main-hint': showHint }"
152138 >
@@ -193,6 +179,7 @@ function activateMcp() {
193179
194180<style scoped>
195181.tp-main {
182+ overflow : hidden ;
196183 transition :
197184 height 0.2s cubic-bezier (0.87 , 0 , 0.13 , 1 ),
198185 box-shadow 0.2s cubic-bezier (0.87 , 0 , 0.13 , 1 );
0 commit comments