import type { LocaleText } from '../locale/index.js'; import type { AttrValue, ElementNode, NabiDoc, NabiNode } from '../schema/index.js'; import type { EditEnv } from '../doc/index.js'; import type { Selection } from '../caret/index.js'; import type { HtmlBuilder, ParseElement } from '../html/index.js'; import type { IoFilter, MdBuilder, MdBuilders } from '../io/index.js'; import type { Command, CommandOutcome, Nabi } from '../editor/index.js'; export type WingPlace = 'mark' | 'void' | 'container' | 'attr' | 'tool'; export interface StructureDecl { readonly holds: 'blocks' | 'inline'; readonly singleParagraph?: boolean; readonly boolAttrs?: readonly string[]; readonly attrs?: readonly string[]; } export type KeyName = 'enter' | 'tab' | 'shiftTab' | 'backspace' | 'delete' | 'arrow'; export type ArrowDir = 'left' | 'right' | 'up' | 'down'; export interface KeyIntent { readonly key: KeyName; readonly dir?: ArrowDir; } export interface OwnerAt { readonly path: readonly number[]; readonly node: ElementNode; } export type OnKey = (intent: KeyIntent, doc: NabiDoc, sel: Selection, env: EditEnv, owner: OwnerAt) => CommandOutcome | null; export interface AttachHost { readonly root: HTMLElement; readonly nabi: Nabi; doc(): NabiDoc; readonly env: EditEnv; pathOfKey(id: string): readonly number[] | null; onDispose(dispose: () => void): void; } export type Attach = (host: AttachHost) => () => void; export interface InputRule { readonly trigger: 'space' | 'enter'; readonly scope?: 'block' | 'word'; readonly pattern: RegExp; readonly run: (match: RegExpMatchArray) => { readonly name: string; readonly args?: Readonly>; }; } export interface WingChoice { readonly value: string | number; readonly label?: LocaleText; readonly tip?: LocaleText; readonly svg?: string; readonly swatch?: string; } export interface WingField { readonly name: string; readonly label?: LocaleText; readonly kind?: 'text' | 'url'; readonly optional?: boolean; readonly attr?: string; readonly initial?: () => string; readonly validate?: (value: string) => boolean; } export type WingAction = { readonly kind: 'command'; readonly command: string; readonly args?: Readonly>; } | { readonly kind: 'mark'; } | { readonly kind: 'menu'; readonly command: string; readonly argKey: string; readonly values: readonly WingChoice[]; } | { readonly kind: 'grid'; readonly command: string; readonly rowsKey: string; readonly colsKey: string; readonly max?: number; } | { readonly kind: 'prompt'; readonly command: string; readonly fields: readonly WingField[]; } | { readonly kind: 'file'; readonly accept?: string; readonly multiple?: boolean; } | { readonly kind: 'host'; }; export interface WingButton { readonly group: string; readonly svg?: string; readonly label?: LocaleText; readonly shortcut?: string; readonly accelerator?: string; readonly action?: WingAction; readonly value?: string | number; readonly name?: string; readonly accelerated?: WingAction; } interface ContextBase { readonly name: string; readonly label?: LocaleText; readonly svg?: string; readonly tip?: LocaleText; readonly visible?: (node: ElementNode) => boolean; } export type ContextControl = (ContextBase & { readonly kind: 'button'; readonly command: string; readonly args?: Readonly>; }) | (ContextBase & { readonly kind: 'toggle'; readonly command: string; readonly args?: Readonly>; readonly token: string; }) | (ContextBase & { readonly kind: 'select'; readonly command: string; readonly argKey: string; readonly values: readonly WingChoice[]; readonly attr?: string; }) | (ContextBase & { readonly kind: 'range'; readonly command: string; readonly argKey: string; readonly values: readonly WingChoice[]; readonly attr?: string; readonly rest?: string; readonly readout?: boolean; }) | (ContextBase & { readonly kind: 'text'; readonly command: string; readonly argKey: string; readonly attr?: string; readonly initial?: (node: ElementNode) => string | undefined; readonly placeholder?: LocaleText; readonly validate?: (value: string) => boolean; }) | (ContextBase & { readonly kind: 'prompt'; readonly command: string; readonly fields: readonly WingField[]; }) | (ContextBase & { readonly kind: 'lightbox'; readonly src: string; readonly alt?: string; }); export interface WingContext { readonly title?: LocaleText; readonly controls: readonly ContextControl[]; } export interface Wing { readonly w: string; readonly place: WingPlace; readonly basic?: boolean; readonly holds?: 'blocks' | 'inline'; readonly singleParagraph?: boolean; readonly boolAttrs?: readonly string[]; readonly attrs?: readonly string[]; readonly clearable?: boolean; readonly parts?: Readonly>; readonly allows?: readonly string[]; readonly noAlign?: boolean; readonly requiresAnyOf?: readonly string[]; readonly attrKey?: string; readonly attrValues?: readonly AttrValue[]; readonly onKey?: OnKey; readonly commands?: Readonly>; readonly toHtml?: HtmlBuilder; readonly partHtml?: Readonly>; readonly toMd?: MdBuilder; readonly partMd?: MdBuilders; readonly claim?: (el: ParseElement, inner: (block: boolean) => NabiNode[]) => NabiNode[] | null; readonly ioFilter?: IoFilter; readonly repair?: (node: ElementNode) => ElementNode | null; readonly partRepair?: Readonly ElementNode>>; readonly currentValue?: (node: ElementNode) => string | undefined; readonly escapeKeys?: readonly string[]; readonly doubleKeys?: Readonly>; readonly attach?: Attach; readonly inputRules?: readonly InputRule[]; readonly button?: WingButton; readonly buttons?: readonly WingButton[]; readonly context?: WingContext; readonly styles?: string; } export declare function erectsNode(place: WingPlace): boolean; export {}; //# sourceMappingURL=contract.d.ts.map