import Content from '../block/base/content'; import { type Diff } from 'fast-diff'; import { Config } from './dompurify'; type Union = { start: number; end: number; active?: boolean; }; type Constructor = new (...args: any[]) => {}; type Defer = { resolve: (value: T) => void; reject: (reason?: unknown) => void; promise: Promise; }; export declare const uniqueIdGenerator: () => Generator; export declare const getUniqueId: () => string; export declare const getLongUniqueId: () => string; export declare const noop: () => void; export declare const identity: (i: T) => T; export declare const isOdd: (n: number) => boolean; export declare const isEven: (n: number) => boolean; export declare const isLengthEven: (str?: string) => boolean; export declare const snakeToCamel: (name: string) => string; /** * Are two arrays have intersection */ export declare const conflict: (arr1: [number, number], arr2: [number, number]) => boolean; export declare const union: ({ start: tStart, end: tEnd }: Union, { start: lStart, end: lEnd, active }: Union) => { start: number; end: number; active: boolean | undefined; } | null; export declare const throttle: (func: any, wait?: number) => (this: any) => any; export declare const deepClone: (value: T) => T; export declare const escapeHTML: (str: string) => string; export declare const unescapeHTML: (str: string) => string; export declare const escapeInBlockHtml: (html: string) => string; export declare const wordCount: (markdown: string) => { word: number; paragraph: number; character: number; all: number; }; /** * [genUpper2LowerKeyHash generate constants map hash, the value is lowercase of the key, * also translate `_` to `-`] */ export declare const genUpper2LowerKeyHash: (keys: string[]) => Record; /** * generate constants map, the value is the key. */ export declare const generateKeyHash: (keys: string[]) => Record; export declare const sanitize: (html: string, purifyOptions: Config, disableHtml: boolean) => string | HTMLElement | DocumentFragment; /** * TODO: @jocs remove in the future, because it's not used. * @param ele * @param id * @returns */ export declare const getParagraphReference: (ele: HTMLElement, id: string) => { getBoundingClientRect(): { x: number; y: number; left: number; top: number; bottom: number; height: number; width: number; right: number; }; clientWidth: number; clientHeight: number; id: string; }; export type TDiff = (string | number | { d: string; }); /** * transform diff to text-unicode op * @param {array} diffs */ export declare function diffToTextOp(diffs: Diff[]): TDiff[]; export declare const getCursorReference: () => { getBoundingClientRect(): DOMRect; clientWidth: number; clientHeight: number; } | null; export declare const adjustOffset: (offset: number, block: T, event: KeyboardEvent) => number; export declare const verticalPositionInRect: (event: MouseEvent, rect: DOMRect) => "down" | "up"; export declare const hasPick: (c: any) => any; export declare const getDefer: () => Defer; export declare const methodMixins: (...objects: Record any>[]) => (constructor: Constructor) => void; export declare const mixins: (...constructors: Constructor[]) => (derivedCtor: Constructor) => void; export declare function isKeyboardEvent(event: Event): event is KeyboardEvent; export declare function isMouseEvent(event: Event): event is MouseEvent; export declare function isInputEvent(event: Event): event is InputEvent; export declare function isElement(node: Node): node is Element; export {};