import { EditorState, Transaction } from 'prosemirror-state';
import { DomPositionIndex } from '../../../dom-observer/DomPositionIndex.js';
/**
 * Bridges ProseMirror plugin decorations onto DomPainter-rendered elements.
 *
 * The layout engine renders into its own DOM tree, so PM decorations (which
 * target the hidden contenteditable) are invisible to the user. This bridge
 * reads inline decoration `class` and `data-*` attributes from eligible
 * external plugins and mirrors them onto the painted elements, with a full
 * add/update/remove reconciliation lifecycle.
 *
 * ## Ownership boundary
 * The bridge tracks exactly which classes and data-attributes it has applied
 * via a WeakMap keyed by DOM element. It never touches classes or attributes
 * owned by the painter or other systems.
 *
 * ## Merge semantics
 * - **Classes**: union of all classes from all overlapping decorations.
 * - **`data-*` attributes**: later plugin in `state.plugins` order wins for
 *   the same key on the same element.
 * - **`style`**: parsed into individual CSS properties and applied via
 *   `el.style.setProperty()` so painter-owned properties are never clobbered.
 *   Later plugin wins per CSS property name.
 */
export declare class DecorationBridge {
    #private;
    /**
     * Runs a full reconciliation pass: reads decoration state from eligible PM
     * plugins, maps them to painted DOM via the position index, and diffs
     * against previously applied state.
     *
     * @param options.restoreEmptyDecorations - When false, do not restore from
     *   previous ranges when a plugin returns empty (e.g. clearFocus); clears
     *   previousRanges so highlight is removed from DOM.
     * @returns `true` if any DOM mutations were made, `false` if skipped.
     */
    sync(state: EditorState, domIndex: DomPositionIndex, options?: {
        restoreEmptyDecorations?: boolean;
    }): boolean;
    /**
     * Records transaction context for stale-range remapping. Call this from the
     * editor transaction handler so bridge sync/collect can remap unchanged
     * decoration sets when plugins don't update their ranges on doc changes.
     */
    recordTransaction(transaction?: Transaction): void;
    /**
     * Checks whether any eligible plugin's DecorationSet has changed since the
     * last sync. Use this as a cheap gate before calling `sync()`.
     *
     * @returns `true` if at least one DecorationSet reference changed.
     */
    hasChanges(state: EditorState): boolean;
    /**
     * Returns true when the current plugin state still contains at least one
     * inline decoration range before any fallback restoration is applied.
     *
     * PresentationEditor uses this to tell "new/updated highlight" apart from an
     * explicit clear when a transaction listener fires without the original
     * transaction payload.
     */
    hasCurrentRanges(state: EditorState): boolean;
    /**
     * Collects all decoration ranges from eligible plugins for overlay rendering.
     * Returns an array of {from, to, classes, style} objects representing each
     * inline decoration that should be visually rendered.
     *
     * This is used by PresentationEditor to render character-accurate highlight
     * overlays using selectionToRects, bypassing the element-level granularity
     * limitation of the DOM-based sync approach.
     *
     * **Fallback behavior**: When a plugin returns empty/collapsed decoration ranges
     * but previously had valid ranges, and the previous positions are still within
     * document bounds, this method restores the previous ranges. This handles cases
     * where `calculateInlineRunPropertiesPlugin` splits runs (when applying marks)
     * and produces transaction mappings that incorrectly invalidate decorations.
     */
    collectDecorationRanges(state: EditorState): Array<{
        from: number;
        to: number;
        classes: string[];
        style: string | null;
        dataAttrs: Record<string, string>;
    }>;
    /**
     * Removes all bridge-owned classes and data-attributes from the DOM.
     * Called during teardown.
     */
    destroy(): void;
}
//# sourceMappingURL=DecorationBridge.d.ts.map