import type { LinkResolver } from 'alinea/core/db/LinkResolver';
import * as Y from 'yjs';
import type { Label } from '../Label.js';
import type { Shape } from '../Shape.js';
import { Node, type TextDoc } from '../TextDoc.js';
import { RecordShape } from './RecordShape.js';
export declare enum RichTextElements {
    h1 = "h1",
    h2 = "h2",
    h3 = "h3",
    h4 = "h4",
    h5 = "h5",
    h6 = "h6",
    p = "p",
    b = "b",
    i = "i",
    ul = "ul",
    ol = "ol",
    li = "li",
    a = "a",
    blockquote = "blockquote",
    hr = "hr",
    br = "br",
    small = "small",
    sup = "sup",
    sub = "sub",
    table = "table",
    tbody = "tbody",
    td = "td",
    th = "th",
    tr = "tr"
}
export type RichTextMutator<R> = {
    map: Y.Map<any>;
    fragment: Y.XmlFragment;
    insert: (id: string, block: string) => void;
};
export interface TextDocStorage<Blocks> {
    doc: TextDoc<Blocks>;
    linked: Array<string>;
}
export interface TextDocSelected<Blocks> {
    doc: TextDoc<Blocks>;
    linked: Array<{
        id: string;
        url: string;
    }>;
}
export declare class RichTextShape<Blocks> implements Shape<TextDoc<Blocks>, RichTextMutator<Blocks>> {
    label: Label;
    shapes?: Record<string, RecordShape> | undefined;
    initialValue?: TextDoc<Blocks> | undefined;
    searchable?: boolean | undefined;
    blocks: Record<string, RecordShape>;
    constructor(label: Label, shapes?: Record<string, RecordShape> | undefined, initialValue?: TextDoc<Blocks> | undefined, searchable?: boolean | undefined);
    create(): TextDoc<Blocks>;
    toXml(rows: TextDoc<Blocks>): (Y.XmlElement<{
        [key: string]: string;
    }> | Y.XmlText)[];
    toV1(value: any): TextDoc<Blocks>;
    private normalizeRow;
    toY(value: TextDoc<Blocks>): Y.Map<unknown>;
    fromY(map: Y.Map<any>): TextDoc<Blocks>;
    applyY(value: TextDoc<Blocks>, parent: Y.Map<any>, key: string): void;
    init(parent: Y.Map<any>, key: string): void;
    watch(parent: Y.Map<any>, key: string): (fun: () => void) => () => void;
    mutator(parent: Y.Map<any>, key: string): {
        map: any;
        fragment: any;
        insert: (id: string, block: string) => void;
    };
    applyLinks(doc: TextDoc<Blocks>, loader: LinkResolver): Promise<void>;
    searchableText(value: TextDoc<Blocks>): string;
    textOf(node: Node): string;
}
