import { EventEmitter } from 'eventemitter3'; import { App, ComponentPublicInstance } from 'vue'; import { Editor, SuperDoc, ToolbarCustomButton, ToolbarFontOption } from '../../core/types/index.js'; import { BorrowedSuperDocUI, CustomCommandRegistrationResult, SelectionCapture, StyleCatalogItem, ToolbarSnapshotSlice } from '../../public/ui/types.js'; import { ToolbarItem, ToolbarItemOption } from './built-in/use-toolbar-item.js'; import { HighContrastMode } from '../../composables/use-high-contrast-mode.js'; export type { ToolbarItem, ToolbarItemOption }; export type ToolbarCommandItem = Pick & Partial>; type CustomButtonPayload = { argument?: unknown; option?: unknown; }; type ToolbarGroupComposition = Record; type BuiltInToolbarConfig = { selector: string | HTMLElement | null; element?: string | HTMLElement | null; toolbarGroups: string[]; role: string; icons: Record; texts: Record; fonts: readonly ToolbarFontOption[] | null; hideButtons: boolean; responsiveToContainer: boolean; mode: string; excludeItems: readonly string[]; toolbarButtonsExclude: readonly string[]; groups: string[] | ToolbarGroupComposition | null; customButtons: readonly ToolbarCustomButton[]; showFormattingMarksButton: boolean; showTableOfContentsButton: boolean; showWatermarkButton: boolean; showPageNumberButton: boolean; uiDisplayFallbackFont?: string; }; type ToolbarSuperDoc = Partial>; type BuiltInToolbarOptions = { superdoc?: ToolbarSuperDoc | null; editor?: Editor | null; selector?: string | HTMLElement | null; element?: string | HTMLElement | null; role?: string; isDev?: boolean; hideButtons?: boolean; responsiveToContainer?: boolean; uiDisplayFallbackFont?: string; highContrastMode: HighContrastMode; [option: string]: unknown; }; /** * The rendered built-in toolbar. Shape-compatible with the historical * `superdoc.toolbar` (`SuperToolbar`) surface so existing docs, examples, the * proof lane, and behavior tests resolve against a real object. */ export declare class BuiltInToolbar extends EventEmitter { #private; config: BuiltInToolbarConfig; toolbarItems: ToolbarItem[]; overflowItems: ToolbarItem[]; pendingSelectionCapture: SelectionCapture | null | undefined; isDev: boolean; role: string; superdoc: ToolbarSuperDoc | null | undefined; toolbarContainer: HTMLElement | null; toolbar: ComponentPublicInstance | null; _detachFontsChanged: (() => void) | null; _linkedStyleOptions: import('vue').ShallowRef; app?: App | null; activeEditor: Editor | null; ui: BorrowedSuperDocUI | null; snapshot: Partial> | null; _unsubscribeController: (() => void) | null; _detachFormatPainterModeChange: (() => void) | null; _customCommandRegs: Map>; _reportedInvalidCustomItems: Set; _lastFontOptionsSignature: string; constructor(config: BuiltInToolbarOptions); getAvailableWidth(): number; getToolbarItemByGroup(groupName: string): ToolbarItem[]; getToolbarItemByName(name: string): ToolbarItem | undefined; /** * The available linked-style options for the linked-styles dropdown. Projected * from the shared controller's public `superdoc/ui` style catalogue * (`ui.styles.getQuickGallery()`), which reads the Document API style catalogue * (`styles.getCatalog`) and honors `w:qFormat` with a v1-style alphabetical * fallback. Returns normalized `StyleCatalogItem`s (`id`, `name`, optional * `preview.css`, visibility), never raw style-model shapes. Empty when the * styles surface is unreachable (viewing mode, worker-backed editor, pre-ready * editor). Applying a style still routes through the shared `linked-style` * command, which targets `styles.paragraph.setStyle`. */ getLinkedStyleOptions(): readonly StyleCatalogItem[]; /** * The stable style id active across the current selection's paragraph(s), or * `null` for a mixed selection / when the styles surface is unreachable. Used * to mark the active option in the linked-styles dropdown. */ getActiveLinkedStyleId(): string | null; updateLinkedStyleToMatchSelection(styleId: string): Promise; /** * Compatibility hook: `SuperDoc` calls this when the active editor changes. * The shared controller already tracks selection/transaction state, so this * just refreshes font options (the new document may carry different fonts) and * re-projects item state. */ setActiveEditor(editor: Editor | null): void; onToolbarResize: () => void; isCommandEnabled(commandId: string | undefined): boolean; updateToolbarState(): void; /** * Main toolbar command entry point used by the rendered components. */ emitCommand({ item, argument, option }: { item: ToolbarCommandItem; argument?: unknown; option?: unknown; }): void; destroy(): void; } /** * Create the rendered built-in toolbar for a `SuperDoc` instance. */ export declare function createBuiltInToolbar(config: BuiltInToolbarOptions): BuiltInToolbar;