import { ContextMenuCommandId, ContextMenuEntry } from 'pptx-viewer-shared'; import { EditorState } from './editor-state.svelte'; /** * What the canvas context menu offers, and what each command does. * * The item list is deliberately NOT decided here: `buildContextMenuEntries` in * `pptx-viewer-shared` owns the command ids, labels, order and separators for * all five bindings, so a command added there appears in all five at once. This * module only supplies the context (what is selected, which table cell was * right-clicked) and routes the chosen id at the editor's existing operations. * Svelte's menu used to hand-write its own items, which is exactly how it ended * up shipping without Group, Ungroup, Add Comment, Edit Hyperlink, or a single * table command. * * It lives in a plain `.ts` module rather than inside `ElementContextMenu.svelte` * so the SFC stays thin presentation (repo convention) and so the dispatch is * unit-testable without mounting a component. * * @module editor/context-menu-dispatch */ /** The table cell a right-click landed on, in model (unmerged) coordinates. */ export interface ContextMenuCellTarget { rowIndex: number; columnIndex: number; } /** Everything the menu needs to decide its items and to run one. */ export interface ContextMenuDispatchDeps { editor: EditorState; /** The right-clicked table cell, or null when the click was not in one. */ cell?: ContextMenuCellTarget | null; /** "Ask AI about this"; presence of either AI callback enables the AI block. */ onAskAi?: () => void; onFixAi?: () => void; /** Open the inspector's Comments tab (React's `case 'comment'`). */ onComment?: () => void; /** Open the hyperlink dialog for the selected element. */ onHyperlink?: () => void; } /** The table cell under `target`, or null when `target` is not inside one. */ export declare function readTableCellTarget(target: EventTarget | null): ContextMenuCellTarget | null; /** The menu for what is currently selected and right-clicked. */ export declare function buildEditorContextMenuEntries(deps: ContextMenuDispatchDeps): ContextMenuEntry[]; /** Route a chosen command id at the editor. Closing the menu is the caller's job. */ export declare function runContextMenuCommand(id: ContextMenuCommandId, deps: ContextMenuDispatchDeps): void; //# sourceMappingURL=context-menu-dispatch.d.ts.map