import type { RefObject } from "react";
import { type ReactNode } from "react";
export interface TextareaToolHelpers {
    /** Current full text. */
    value: string;
    /** Current selection / caret state. */
    selection: {
        text: string;
        start: number;
        end: number;
        active: boolean;
    };
    /** Replace the entire textarea content. */
    setValue: (next: string) => void;
    /** Replace the selection with `text` (inserts at caret when no
     *  selection is active). Caret lands after the inserted text. */
    replace: (text: string) => void;
    /** Insert `text` at the caret without disturbing the selection's
     *  surrounding content. Identical to `replace` when nothing is
     *  selected. */
    insert: (text: string) => void;
    /** Wrap the selection with `open` / `close` strings. When no
     *  selection is active, drops the markers around an empty span at
     *  the caret. Caret ends up between them so the user can type. */
    wrap: (open: string, close?: string) => void;
    /** Prepend `prefix` to the start of every line that overlaps the
     *  selection (or just the caret's line when no selection). Useful for
     *  list / quote / heading tools. */
    prependLines: (prefix: string) => void;
    /** Programmatic undo / redo via the native execCommand bridge.
     *  Falls back silently when the browser doesn't expose it. */
    undo: () => void;
    redo: () => void;
    /** Direct access to the underlying DOM node for cases the abstraction
     *  doesn't cover. */
    getTextarea: () => HTMLTextAreaElement | null;
}
export interface TextareaTool {
    id: string;
    label: ReactNode;
    icon?: ReactNode;
    /** Title attribute for the toolbar button. Defaults to the `label`
     *  when it's a string. */
    title?: string;
    /** Visual treatment — `"divider"` renders a vertical separator
     *  instead of a button. Otherwise `"button"`. */
    kind?: "button" | "divider";
    /** Fires when the toolbar button is clicked. Receives a helpers
     *  bundle that proxies the editing primitives. Can be async. */
    onAction?: (helpers: TextareaToolHelpers) => void | Promise<void>;
    /** Hide the button when this predicate returns false. Re-evaluated
     *  on every value / selection change. Useful for "only show Link
     *  when something is selected" patterns. */
    isVisible?: (helpers: TextareaToolHelpers) => boolean;
}
export interface UseTextareaToolsOptions {
    textareaRef: RefObject<HTMLTextAreaElement | null>;
    value: string;
    onChange: (next: string) => void;
    tools: TextareaTool[];
}
export interface UseTextareaToolsReturn {
    /** Filtered + ready-to-render tools (visibility predicates applied). */
    tools: TextareaTool[];
    /** Invoke a tool by id. */
    runTool: (id: string) => Promise<void>;
    /** Snapshot helpers — same object passed into `onAction` so consumers
     *  can call them outside the toolbar (e.g. from a keyboard shortcut). */
    helpers: TextareaToolHelpers;
}
export declare function useTextareaTools({ textareaRef, value, onChange, tools, }: UseTextareaToolsOptions): UseTextareaToolsReturn;
export declare const textareaTools: {
    bold: () => TextareaTool;
    italic: () => TextareaTool;
    strikethrough: () => TextareaTool;
    code: () => TextareaTool;
    codeBlock: () => TextareaTool;
    link: () => TextareaTool;
    /** Heading. Defaults to H2. Pass a `level` (1–6) to override. */
    heading: (level?: 1 | 2 | 3 | 4 | 5 | 6) => TextareaTool;
    bulletList: () => TextareaTool;
    numberedList: () => TextareaTool;
    quote: () => TextareaTool;
    undo: () => TextareaTool;
    redo: () => TextareaTool;
    divider: (id?: string) => TextareaTool;
};
//# sourceMappingURL=useTextareaTools.d.ts.map