@@ -17,13 +17,14 @@ function createOverlay () {
1717 overlayContent . style . position = 'fixed'
1818 overlayContent . style . zIndex = '99999999999999'
1919 overlayContent . style . pointerEvents = 'none'
20- overlayContent . style . backgroundColor = 'rgba(65, 184, 131, 0.9) '
20+ overlayContent . style . backgroundColor = 'white '
2121 overlayContent . style . fontFamily = 'monospace'
2222 overlayContent . style . fontSize = '11px'
23- overlayContent . style . padding = '2px 3px '
23+ overlayContent . style . padding = '4px 8px '
2424 overlayContent . style . borderRadius = '3px'
25- overlayContent . style . color = 'white '
25+ overlayContent . style . color = '#333 '
2626 overlayContent . style . textAlign = 'center'
27+ overlayContent . style . border = '#42B983 1px solid'
2728}
2829
2930// Use a job queue to preserve highlight/unhighlight calls order
@@ -36,16 +37,33 @@ export async function highlight (instance, ctx: BackendContext) {
3637
3738 const bounds = await ctx . api . getComponentBounds ( instance )
3839 if ( bounds ) {
39- const name = ( await ctx . api . getComponentName ( instance ) ) || 'Anonymous'
4040 createOverlay ( )
41+
42+ // Name
43+ const name = ( await ctx . api . getComponentName ( instance ) ) || 'Anonymous'
4144 const pre = document . createElement ( 'span' )
4245 pre . style . opacity = '0.6'
4346 pre . innerText = '<'
44- const text = document . createTextNode ( name )
47+ const text = document . createElement ( 'span' )
48+ text . style . fontWeight = 'bold'
49+ text . style . color = '#09ab56'
50+ text . innerText = name
4551 const post = document . createElement ( 'span' )
4652 post . style . opacity = '0.6'
4753 post . innerText = '>'
48- await showOverlay ( bounds , [ pre , text , post ] )
54+
55+ // Size
56+ const size = document . createElement ( 'span' )
57+ size . style . opacity = '0.5'
58+ size . style . marginLeft = '6px'
59+ size . appendChild ( document . createTextNode ( ( Math . round ( bounds . width * 100 ) / 100 ) . toString ( ) ) )
60+ const multiply = document . createElement ( 'span' )
61+ multiply . style . marginLeft = multiply . style . marginRight = '2px'
62+ multiply . innerText = '×'
63+ size . appendChild ( multiply )
64+ size . appendChild ( document . createTextNode ( ( Math . round ( bounds . height * 100 ) / 100 ) . toString ( ) ) )
65+
66+ await showOverlay ( bounds , [ pre , text , post , size ] )
4967 }
5068 } )
5169}
0 commit comments