import { EditorView } from 'wordgard/view';
import { EditorState, Transaction, Extension } from 'wordgard/state';
import { Mark } from 'wordgard/doc';

type MenuLabelWidget = {
    render: (view: EditorView) => HTMLElement;
    rerender?: (tr: Transaction) => boolean;
    update?: (elt: HTMLElement, view: EditorView) => void;
};
type MenuLabel = string | {
    icon: string;
    directional?: boolean;
} | MenuLabelWidget;
declare function isMenuLabelWidget(label: MenuLabel): label is MenuLabelWidget;
interface MenuItemSpec {
    select?: (state: EditorState) => boolean;
    enable?: (state: EditorState) => boolean;
    /**
    By default, state predicates (`select`, `enable`, and `active`)
    are re-checked whenever the document or selection changes. If an
    item is sensitive to other aspects of the state, provide a test
    here that returns `true` for transactions that might affect the
    item state.
    */
    updateFor?: (tr: Transaction) => boolean;
    parent?: MenuGroup | Submenu;
    rank?: number;
    description?: string;
}
declare class MenuButton implements MenuItemSpec {
    select: ((state: EditorState) => boolean) | undefined;
    enable: ((state: EditorState) => boolean) | undefined;
    updateFor: ((tr: Transaction) => boolean) | undefined;
    parent: MenuGroup | Submenu | undefined;
    rank: number;
    description: string | undefined;
    label: MenuLabel;
    run: (view: EditorView) => void;
    active: ((state: EditorState) => boolean) | undefined;
    extension: Extension;
    constructor(spec: {
        run: (view: EditorView) => void;
        active?: (state: EditorState) => boolean;
        label: MenuLabel;
    } & MenuItemSpec);
}
declare class Submenu implements MenuItemSpec {
    select: ((state: EditorState) => boolean) | undefined;
    enable: ((state: EditorState) => boolean) | undefined;
    updateFor: ((tr: Transaction) => boolean) | undefined;
    parent: MenuGroup | Submenu | undefined;
    rank: number;
    description: string | undefined;
    label: MenuLabel | undefined;
    defaultLabel: MenuLabel | undefined;
    arrow: boolean;
    width: number | undefined;
    extension: Extension;
    constructor(spec: {
        label?: MenuLabel;
        defaultLabel?: MenuLabel;
        arrow?: boolean;
        width?: number;
    } & MenuItemSpec);
    template(...content: (MenuTemplate | MenuItem | "...")[]): MenuTemplate;
}
declare class MenuGroup {
    margin: boolean;
    extension: Extension;
    parent: MenuGroup | Submenu | undefined;
    rank: number;
    constructor(spec?: {
        margin?: boolean;
        parent?: MenuGroup | Submenu;
        rank?: number;
    });
    template(...content: (MenuTemplate | MenuItem | "...")[]): MenuTemplate;
}
type MenuItem = MenuButton | Submenu | MenuGroup;
declare const menuItem: any;
declare class MenuTemplate {
    readonly item: MenuGroup | Submenu;
    readonly content: readonly (MenuTemplate | MenuItem | "...")[];
    parent: MenuGroup | Submenu | null;
    rank: number;
    constructor(item: MenuGroup | Submenu, content?: readonly (MenuTemplate | MenuItem | "...")[]);
}
declare const Top: MenuGroup;
declare const Commands: MenuGroup;
declare const InlineStyles: MenuGroup;
declare const BlockMenu: MenuGroup;
declare function toggleInlineMark(config: {
    mark: Mark<any>;
    parent?: MenuGroup | Submenu;
    rank?: number;
    description?: string;
    label: MenuLabel;
}): MenuButton;
declare const ToggleStrong: MenuButton;
declare const ToggleEmphasis: MenuButton;
declare const ToggleCode: MenuButton;
declare const ToggleUnderline: MenuButton;
declare const ToggleSuperscript: MenuButton;
declare const ToggleSubscript: MenuButton;
declare const ToggleLink: MenuButton;
declare const Undo: MenuButton;
declare const Redo: MenuButton;
declare const TextblockStyle: Submenu;
declare const ParagraphButton: MenuButton;
declare const CodeBlockButton: MenuButton;
declare const Heading1: MenuButton;
declare const Heading2: MenuButton;
declare const Heading3: MenuButton;
declare const BulletListButton: MenuButton;
declare const OrderedListButton: MenuButton;
declare const BlockquoteButton: MenuButton;
declare const AlignmentMenu: Submenu;
declare const AlignStart: MenuButton;
declare const AlignEnd: MenuButton;
declare const AlignCenter: MenuButton;
declare const staticMenu: Extension[];
type ResolvedMenuItem = MenuButton | "|" | ResolvedSubmenu;
declare class ResolvedSubmenu {
    readonly item: Submenu;
    readonly content: readonly ResolvedMenuItem[];
    constructor(item: Submenu, content: readonly ResolvedMenuItem[]);
}
declare function resolveMenu(items: readonly MenuItem[], template?: MenuTemplate | readonly MenuTemplate[], suppress?: readonly MenuItem[]): readonly ResolvedMenuItem[];

declare function menuBar(config?: {
    template?: MenuTemplate | readonly MenuTemplate[];
}): Extension;

declare const iconAlignLeft: MenuLabel;
declare const iconAlignRight: MenuLabel;
declare const iconAlignCenter: MenuLabel;
declare const iconOrderedList: MenuLabel;
declare const iconBulletList: MenuLabel;
declare const iconQuote: MenuLabel;
declare const iconBold: MenuLabel;
declare const iconItalic: MenuLabel;
declare const iconUnderline: MenuLabel;
declare const iconCode: MenuLabel;
declare const iconSuperscript: MenuLabel;
declare const iconSubscript: MenuLabel;
declare const iconLink: MenuLabel;
declare const iconImage: MenuLabel;
declare const iconUndo: MenuLabel;
declare const iconRedo: MenuLabel;
declare const iconIndent: MenuLabel;
declare const iconDedent: MenuLabel;
declare const iconVerticalDots: MenuLabel;

export { AlignCenter, AlignEnd, AlignStart, AlignmentMenu, BlockMenu, BlockquoteButton, BulletListButton, CodeBlockButton, Commands, Heading1, Heading2, Heading3, InlineStyles, MenuButton, MenuGroup, MenuTemplate, OrderedListButton, ParagraphButton, Redo, ResolvedSubmenu, Submenu, TextblockStyle, ToggleCode, ToggleEmphasis, ToggleLink, ToggleStrong, ToggleSubscript, ToggleSuperscript, ToggleUnderline, Top, Undo, iconAlignCenter, iconAlignLeft, iconAlignRight, iconBold, iconBulletList, iconCode, iconDedent, iconImage, iconIndent, iconItalic, iconLink, iconOrderedList, iconQuote, iconRedo, iconSubscript, iconSuperscript, iconUnderline, iconUndo, iconVerticalDots, isMenuLabelWidget, menuBar, menuItem, resolveMenu, staticMenu, toggleInlineMark };
export type { MenuItem, MenuItemSpec, MenuLabel, MenuLabelWidget, ResolvedMenuItem };
