import { EditorView } from 'prosemirror-view'; import { MarkType } from 'prosemirror-model'; import { RteInstanceImpl } from '../instance'; import { MenuItem } from '../../../menu-item/menu-item'; import { ListboxOption } from '../../../option/option'; import { Divider } from '../../../divider/divider'; import { TextField } from '../../../text-field/text-field'; type Prop = T | ((ctx: UiCtx) => T); type Props = { [P in keyof T]: Prop; }; type EventBinding = [ string, unknown, (value: unknown) => (event: Event) => void ]; type CtxProps = { popupPlacement: 'top' | 'bottom'; shouldReturnFocusToEditor: boolean; menuOffset?: number; disabled?: boolean; }; export declare class UiCtx { readonly view: EditorView; readonly rte: RteInstanceImpl; readonly props: Props; constructor(view: EditorView, rte: RteInstanceImpl, props: Props); evalProp(prop: Prop): T; private bindings; bindProp(prop: Prop | undefined, bindFn: (value: T) => void): void; updateBindings(): void; shouldReturnFocusToEditor(): boolean; bindToEl(target: T, props?: Partial>, events?: EventBinding[], children?: Array): void; } export declare const createDiv: (ctx: UiCtx, props: { className?: string; slot?: string; children: Array; }) => HTMLDivElement; export declare const createAnchor: (ctx: UiCtx, props: { href: Prop; target?: string; rel?: string; className?: string; children: Array; }) => HTMLAnchorElement; export declare const createOptionalTooltip: (ctx: UiCtx, props: { enabled: Prop; label: Prop; anchor: HTMLElement; slot?: string; }) => HTMLDivElement; export declare const createButton: (ctx: UiCtx, props: { variant?: Prop<"toolbar" | "toolbar-menu" | "popover" | "popover-primary">; label: Prop; icon?: Prop; noTooltip?: boolean; autofocus?: Prop; slot?: string; active?: Prop; disabled?: Prop; connotation?: Prop<"alert">; onClick?: (() => boolean) | (() => void); }) => HTMLDivElement; export declare const createMenu: (ctx: UiCtx, props: { label: Prop; trigger: HTMLElement; children: Array; }) => DocumentFragment; export declare const createMenuItem: (ctx: UiCtx, props: { text: Prop; checked: Prop; disabled?: Prop; onSelect: () => void; }) => MenuItem; export declare const createButtonGroup: (ctx: UiCtx, props: { slot?: string; children: Array; }) => HTMLDivElement; export declare const createMarkToggle: (ctx: UiCtx, props: { label: Prop; icon: string; markType: MarkType; }) => HTMLDivElement; export declare const createOption: (ctx: UiCtx, props: { text: Prop; value: string; disabled?: Prop; }) => ListboxOption; export declare const createSelect: (ctx: UiCtx, props: { label: Prop; value: Prop; children: Array; onSelect: (value: string) => void; }) => HTMLDivElement; export declare const createDivider: (ctx: UiCtx) => Divider; export declare const createTextField: (ctx: UiCtx, props: { label: Prop; value: Prop; placeholder?: Prop; slot?: string; autofocus?: boolean; type?: "url"; helperText?: Prop; onInput?: (value: string) => void; }) => TextField; export declare const createText: (ctx: UiCtx, props: { text: Prop; }) => Text; export declare const createSingleSlot: (ctx: UiCtx, props: { name: string; assignedProps: Record>; assignedEvents: Record void>; }) => HTMLSlotElement; export {};