/* * toolbar.ts — toolbar manager for the ribbit editor. * * Resolves tags and macros into toolbar buttons. Renders the toolbar * DOM. Manages button state (active/disabled/visible). * * Usage: * const toolbar = editor.toolbar; * toolbar.buttons.get('bold').click(); * toolbar.buttons.get('table').hide(); * document.body.prepend(toolbar.render()); */ import type { Tag, ToolbarSlot, Button } from './types'; import type { MacroDef } from './macros'; class ButtonImpl implements Button { id: string; label: string; icon?: string; shortcut?: string; action: 'wrap' | 'prefix' | 'insert' | 'custom'; delimiter?: string; template?: string; replaceSelection: boolean; visible: boolean; element?: HTMLElement; handler?: () => void; constructor(def: Partial