11import type { DevframeDockEntry , DevframeViewLauncher } from '@devframes/hub/types'
22import { connectDevframe } from '@devframes/hub/client'
33import { createIframePanes } from 'iframe-pane'
4- import { iconClass } from './icons'
4+ import { fillIcon , iconClass } from './icons'
55import 'virtual:uno.css'
66import '@antfu/design/styles.css'
77
@@ -67,7 +67,7 @@ function dockIcon(entry: DevframeDockEntry): string {
6767 if ( cls )
6868 return `<span class="${ cls } shrink-0 text-lg"></span>`
6969 const initial = ( entry . title ?. [ 0 ] ?? '?' ) . toUpperCase ( )
70- return `<span class="grid h-5 w-5 shrink-0 place-items-center rounded bg-active text-[0.7rem] font-bold">${ initial } </span>`
70+ return `<span data-dock-icon=" ${ entry . id } " class="grid h-5 w-5 shrink-0 place-items-center rounded bg-active text-[0.7rem] font-bold">${ initial } </span>`
7171}
7272
7373function overlay ( html : string ) {
@@ -79,7 +79,7 @@ function overlay(html: string) {
7979function launcherTile ( entry : LauncherDock ) : string {
8080 const l = entry . launcher
8181 const cls = iconClass ( l . icon ?? entry . icon )
82- const glyph = cls ? `<span class="${ cls } text-4xl color-active"></span>` : '<span class="i-ph-books-duotone text-4xl op-fade"></span>'
82+ const glyph = cls ? `<span class="${ cls } text-4xl color-active"></span>` : '<span data-launcher-icon class="w-10 h-10"><span class=" i-ph-books-duotone text-4xl op-fade"></span ></span>'
8383 return `
8484 ${ glyph }
8585 <div class="text-base font-medium">${ l . title } </div>
@@ -148,6 +148,7 @@ function updateStage() {
148148
149149 if ( entry && isLauncherDock ( entry ) ) {
150150 overlay ( launcherStageTile ( entry , rt , title ) )
151+ void fillIcon ( overlayEl . querySelector ( '[data-launcher-icon]' ) , entry . launcher . icon ?? entry . icon )
151152 return
152153 }
153154
@@ -248,6 +249,10 @@ async function main() {
248249 `<li><button type="button" data-dock-id="${ d . id } " class="relative inline-flex items-center gap-2.5 w-full px-2 py-1 rounded-md border border-transparent text-sm op-fade select-none cursor-pointer transition hover:op100 hover:bg-active${ d . id === selectedId ? ' op100! bg-active border-base! color-base' : '' } " title="${ d . title } ">${ dockIcon ( d ) } <span class="truncate">${ d . title } </span></button></li>` ) . join ( '' )
249250 return `<li class="px2 pt2 pb1 text-[0.68rem] uppercase tracking-wider color-muted">${ category } </li>${ buttons } `
250251 } ) . join ( '' )
252+ for ( const element of docksEl . querySelectorAll < HTMLElement > ( '[data-dock-icon]' ) ) {
253+ const entry = docks . find ( dock => dock . id === element . dataset . dockIcon )
254+ void fillIcon ( element , entry ?. icon )
255+ }
251256 }
252257
253258 // Docks, read from `devframe:docks` shared state, keeping launcher (Storybook)
0 commit comments