import { Node } from "prosemirror-model"; import { EditorState, Transaction } from "prosemirror-state"; import { EditorView } from "prosemirror-view"; import { EditorSchema } from "./schema"; export declare type Dispatch = (tr: Transaction) => void; export declare type Command = (state: EditorState, dispatch?: Dispatch, view?: EditorView) => boolean; export declare type CommandPredicate = (state: EditorState) => boolean; /** * Nominal typing for any TypeScript interface or class. * * If T is an enum type, any type which includes this interface * will only match other types that are tagged with the same * enum type. * * See https://stackoverflow.com/a/37074697/253686 */ export interface Nominal { "nominal structural brand": T; } export interface NominalDocPos { "position in document brand": T; } export interface NominalTablePos { "position in table brand": T; } export declare namespace Tag { const enum DocPos { } const enum DocPosOfCell { } const enum TablePosOfCell { } const enum TableNode { } const enum DocNode { } const enum TableStart { } const enum TableRowIndex { } const enum TableRowEdgeIndex { } const enum TableColumnIndex { } const enum TableColumnEdgeIndex { } } export declare type DocPos = number & Nominal; export declare type DocPosOfCell = DocPos & NominalDocPos; export declare type DocNode = Node & Nominal; export declare type TablePosOfCell = number & NominalTablePos; export declare type TableNode = Node & Nominal; export declare type TableStart = DocPos & NominalDocPos; export declare type TableRowIndex = number & Nominal; export declare type TableRowEdgeIndex = number & Nominal; export declare type TableColumnIndex = number & Nominal; export declare type TableColumnEdgeIndex = number & Nominal; export interface PosRange { readonly from: T; readonly to: T; } /** * Position range of a doc. */ export interface DocPosRange extends PosRange { } export declare const enum TableAxis { ROW = 0, COLUMN = 1 } export declare const enum CartesianAxis { HORIZONTAL = 0, VERTICAL = 1 } export declare type DirString = "up" | "down" | "left" | "right" | "forward" | "backward"; export declare const enum Bias { FORWARD = "a", BACKWARD = "b" } export interface NodeTypeSpec { allowWedge?: boolean; } /** * A helper that translates an interface describing a ProseMirror node's * attributes, into the shape required for the NodeType's attrs spec. */ export declare type AttrsSpec = { [P in keyof T]-?: T[P] extends object | boolean | null | string | number ? { default?: T[P]; } : { default: T[P]; }; }; export declare type Omit = Pick>;