import { type ReactNode } from 'react'; import type { Editor } from '@tiptap/react'; import { Extension } from '@tiptap/core'; import { PluginKey } from '@tiptap/pm/state'; /** * The selection, kept visible while something else has the focus — Peek's * `src/extensions/keptSelection.ts` (PEE-19), moved into the package with the * `SelectionToolbar` that needs it (UIG-31, Katerina's ruling 29 September). * * The toolbar's address field takes the focus, and with it the document's * one selection, so the words being linked lost their highlight the moment * the field opened (measured 2026-09-07). Linear keeps it, and Katerina asked * for the same. The editor's own selection never moved — ProseMirror keeps it * while unfocused — so this only *draws* it: an inline decoration over the * range, in `bg-selected` — the token Peek's composer paints `::selection` in, * mapped through edits and cleared when the field closes. * * A decoration rather than a second selection, because a document has one * and the field needs it. Editor-internal by design (the editor owns its own * drawing); nothing here floats, focuses or handles a key. */ export interface KeptRange { from: number; to: number; } /** The plugin's key: read what is being kept, or dispatch a change to it. */ export declare const keptSelectionKey: PluginKey; /** The extension an editor registers so a selection can stay drawn while a field has the focus. */ export declare const KeptSelection: Extension; /** Draw the selection as it is now, until `releaseSelection`. */ export declare function keepSelection(editor: Editor): void; /** Stop drawing it. Nothing kept, nothing dispatched. */ export declare function releaseSelection(editor: Editor): void; /** What is being drawn, or null. */ export declare function keptSelection(editor: Editor): KeptRange | null; /** A mark the strip can toggle — the suite's inline vocabulary (SPEC §13.1) less link and reference. */ export type MarkId = 'bold' | 'italic' | 'underline' | 'code'; /** The address the selection sits in, or '' — what the link field opens with. */ export declare function currentLink(editor: Editor): string; /** * What somebody typed into the link field → an `href`, or null when it cannot * be one. A bare host (`google.com`) gets `https://`. A scheme is kept only when * SPEC §13.1 lets a reader follow it (http, https, mailto); `javascript:` and * the like are refused here. `localhost:5173` is a host and a port: a scheme is * never followed by a digit. */ export declare function normalizeHref(raw: string): string | null; /** * Apply the link field to the selection. Empty removes the link; an address * sets it, over the whole link when the caret sits inside one. `false` means * the text could not be an address, and the field should stay open. */ export declare function applyLink(editor: Editor, raw: string): boolean; export interface SelectionToolbarProps { /** The editor whose selection the strip follows. `null` while it loads. */ editor: Editor | null; /** Which marks the strip toggles, in order. Default bold, italic, underline. */ marks?: readonly MarkId[]; /** The Link button and its address field. Needs a link mark in the editor and `KeptSelection`. Default off. */ link?: boolean; /** * More of the strip, after the marks: the app's own `ToolbarButton`s for what * is selected — a chip's card, say. Each keeps the selection by preventing * its press's default, as the marks do. Nothing is added when it renders * nothing. */ children?: ReactNode; /** * The app's own buttons after the marks, past a separator: "Comment". Each * runs with the selection still in place, and the strip closes after it. */ actions?: readonly SelectionAction[]; } /** One of the app's buttons in the strip. */ export interface SelectionAction { /** Says what it does: the tooltip and the button's name. */ label: string; /** A 16px icon. */ icon: ReactNode; /** The keys that do the same, shown in the tooltip ("Mod-Shift-M"). */ keys?: string; /** What it does, with the selection as it is. */ run: (editor: Editor) => void; } export declare function SelectionToolbar({ editor, marks, link, children, actions }: SelectionToolbarProps): import("react").JSX.Element | null; //# sourceMappingURL=SelectionToolbar.d.ts.map