import { DeesElement, type TemplateResult, customElement, html, css, cssManager, state, } from '@design.estate/dees-element'; import { themeDefaultStyles } from '../../00theme.js'; import '../../dees-icon/dees-icon.js'; import { DeesContextmenu } from '../../dees-contextmenu/dees-contextmenu.js'; import type { IBottomBarWidget, IBottomBarAction, IBottomBarAPI, } from '../../interfaces/appconfig.js'; import { demoFunc } from './dees-appui-bottombar.demo.js'; declare global { interface HTMLElementTagNameMap { 'dees-appui-bottombar': DeesAppuiBottombar; } } @customElement('dees-appui-bottombar') export class DeesAppuiBottombar extends DeesElement implements IBottomBarAPI { public static demo = demoFunc; // INSTANCE PROPERTIES @state() accessor widgets: IBottomBarWidget[] = []; @state() accessor actions: IBottomBarAction[] = []; public static styles = [ themeDefaultStyles, cssManager.defaultStyles, css` :host { display: block; height: 24px; flex-shrink: 0; user-select: none; } .bottom-bar { height: 24px; display: flex; align-items: center; padding: 0 8px; gap: 4px; background: ${cssManager.bdTheme('hsl(0 0% 94%)', 'hsl(0 0% 6%)')}; border-top: 1px solid ${cssManager.bdTheme('hsl(0 0% 85%)', 'hsl(0 0% 15%)')}; font-size: 11px; color: ${cssManager.bdTheme('hsl(0 0% 40%)', 'hsl(0 0% 60%)')}; } .widget { display: flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 3px; cursor: pointer; transition: background 0.15s ease, color 0.15s ease; white-space: nowrap; } .widget:hover { background: ${cssManager.bdTheme('hsl(0 0% 88%)', 'hsl(0 0% 12%)')}; color: ${cssManager.bdTheme('hsl(0 0% 20%)', 'hsl(0 0% 80%)')}; } .widget dees-icon { flex-shrink: 0; } .widget-separator { width: 1px; height: 14px; background: ${cssManager.bdTheme('hsl(0 0% 80%)', 'hsl(0 0% 20%)')}; margin: 0 4px; } /* Status colors matching dees-workspace-bottombar */ .widget.active { color: ${cssManager.bdTheme('hsl(210 100% 45%)', 'hsl(210 100% 60%)')}; } .widget.success { color: ${cssManager.bdTheme('hsl(142 70% 35%)', 'hsl(142 70% 50%)')}; } .widget.warning { color: ${cssManager.bdTheme('hsl(38 92% 45%)', 'hsl(38 92% 55%)')}; } .widget.error { color: ${cssManager.bdTheme('hsl(0 70% 50%)', 'hsl(0 70% 60%)')}; } @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } .spinning { animation: spin 1s linear infinite; } .spacer { flex: 1; } .action-button { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 3px; cursor: pointer; transition: background 0.15s ease; color: ${cssManager.bdTheme('hsl(0 0% 40%)', 'hsl(0 0% 60%)')}; } .action-button:hover { background: ${cssManager.bdTheme('hsl(0 0% 88%)', 'hsl(0 0% 12%)')}; color: ${cssManager.bdTheme('hsl(0 0% 20%)', 'hsl(0 0% 80%)')}; } .action-button.disabled { opacity: 0.5; cursor: not-allowed; } .action-button.disabled:hover { background: transparent; color: ${cssManager.bdTheme('hsl(0 0% 40%)', 'hsl(0 0% 60%)')}; } `, ]; public render(): TemplateResult { const leftWidgets = this.widgets .filter(w => w.position !== 'right') .sort((a, b) => (a.order || 0) - (b.order || 0)); const rightWidgets = this.widgets .filter(w => w.position === 'right') .sort((a, b) => (a.order || 0) - (b.order || 0)); const leftActions = this.actions.filter(a => a.position === 'left'); const rightActions = this.actions.filter(a => a.position !== 'left'); return html`
`; } private renderWidget(widget: IBottomBarWidget): TemplateResult { const statusClass = widget.status && widget.status !== 'idle' ? widget.status : ''; const iconName = widget.iconName ? (widget.iconName.startsWith('lucide:') ? widget.iconName : `lucide:${widget.iconName}`) : ''; return html` `; } private renderAction(action: IBottomBarAction): TemplateResult { const iconName = action.iconName.startsWith('lucide:') ? action.iconName : `lucide:${action.iconName}`; return html` `; } private async handleWidgetContextMenu(e: MouseEvent, widget: IBottomBarWidget): Promise