import type { Descendant, NodeEntry, Path, Point, Range as SlateRange, Selection } from 'slate'; import type { ReactEditor } from 'slate-react'; import type { YooptaMark } from '../marks'; import type { decreaseBlockDepth } from './blocks/decreaseBlockDepth'; import type { deleteBlock } from './blocks/deleteBlock'; import type { duplicateBlock } from './blocks/duplicateBlock'; import type { focusBlock } from './blocks/focusBlock'; import type { GetBlockOptions } from './blocks/getBlock'; import type { increaseBlockDepth } from './blocks/increaseBlockDepth'; import type { insertBlock } from './blocks/insertBlock'; import type { mergeBlock } from './blocks/mergeBlock'; import type { toggleBlock } from './blocks/toggleBlock'; import type { EditorBlurOptions } from './core/blur'; import type { HistoryStack, HistoryStackName, YooptaHistory } from './core/history'; import type { getEmail } from '../parsers/getEmail'; import type { getHTML } from '../parsers/getHTML'; import type { getYooptaJSON } from '../parsers/getYooptaJSON'; import type { WithoutFirstArg } from '../utils/types'; import type { moveBlock } from './blocks/moveBlock'; import type { SplitBlockOptions } from './blocks/splitBlock'; import type { updateBlock } from './blocks/updateBlock'; import type { YooptaOperation, applyTransforms } from './core/applyTransforms'; import type { setEditorValue } from './core/setEditorValue'; import type { getMarkdown } from '../parsers/getMarkdown'; import type { getPlainText } from '../parsers/getPlainText'; import type { Plugin, PluginElementProps, PluginElementsMap, PluginOptions } from '../plugins/types'; import type { ElementStructureOptions, TextNodeOptions } from './elements/create-element-structure'; import type { deleteElement } from './elements/deleteElement'; import type { getElement } from './elements/getElement'; import type { getElementChildren } from './elements/getElementChildren'; import type { getElementEntry } from './elements/getElementEntry'; import type { getElementPath } from './elements/getElementPath'; import type { getElementRect } from './elements/getElementRect'; import type { getElements } from './elements/getElements'; import type { getParentElementPath } from './elements/getParentElementPath'; import type { insertElement } from './elements/insertElement'; import type { isElementEmpty } from './elements/isElementEmpty'; import type { updateElement } from './elements/updateElement'; export type YooptaBlockData = { id: string; value: T[]; type: string; meta: YooptaBlockBaseMeta; }; export type YooptaBlockBaseMeta = { order: number; depth: number; align?: 'left' | 'center' | 'right' | undefined; }; export type YooptaContentValue = Record; export type SlateEditor = ReactEditor; export type FocusAt = Path | Point; export type YooptaPluginsEditorMap = Record; export type YooptaPathIndex = number | null; export type YooptaPath = { current: YooptaPathIndex; selected?: number[] | null; selection?: Selection | null; source?: null | 'selection-box' | 'native-selection' | 'mousemove' | 'keyboard' | 'copy-paste'; }; export type TextFormat = { type: string; hotkey?: string; getValue: () => null | any; isActive: () => boolean; toggle: () => void; update: (props?: any) => void; }; export type YooptaBlock = { type: string; options?: PluginOptions; elements: PluginElementsMap; isActive: () => boolean; }; export type YooptaBlocks = Record; export type YooptaFormats = Record; export type YooptaEditorEventKeys = 'change' | 'focus' | 'blur' | 'block:copy' | 'path-change' | 'decorations:change'; export type YooptaEventChangePayload = { operations: YooptaOperation[]; value: YooptaContentValue; }; export type YooptaEventsMap = { change: YooptaEventChangePayload; focus: boolean; blur: boolean; 'block:copy': YooptaBlockData; 'path-change': YooptaPath; 'decorations:change': undefined; }; export type DecoratorFn = (blockId: string, entry: NodeEntry) => SlateRange[]; export type LeafDecoratorRenderFn = (leaf: Record, children: unknown) => unknown; export type BaseCommands = Record any>; export type YooEditor = { id: string; readOnly: boolean; isEmpty: () => boolean; insertBlock: WithoutFirstArg; updateBlock: WithoutFirstArg; deleteBlock: WithoutFirstArg; duplicateBlock: WithoutFirstArg; toggleBlock: WithoutFirstArg; increaseBlockDepth: WithoutFirstArg; decreaseBlockDepth: WithoutFirstArg; moveBlock: WithoutFirstArg; focusBlock: WithoutFirstArg; mergeBlock: WithoutFirstArg; splitBlock: (options?: SplitBlockOptions) => string | undefined; getBlock: (options: GetBlockOptions) => YooptaBlockData | null; insertElement: WithoutFirstArg; updateElement: WithoutFirstArg; deleteElement: WithoutFirstArg; getElement: WithoutFirstArg; getElements: WithoutFirstArg; getElementEntry: WithoutFirstArg; getElementPath: WithoutFirstArg; getElementRect: WithoutFirstArg; getParentElementPath: WithoutFirstArg; getElementChildren: WithoutFirstArg; isElementEmpty: WithoutFirstArg; y: ((type: string, options?: ElementStructureOptions) => SlateElement) & { text: (text: string, marks?: TextNodeOptions) => SlateElementTextNode; inline: (type: string, options?: ElementStructureOptions) => SlateElement; }; path: YooptaPath; setPath: (path: YooptaPath) => void; children: YooptaContentValue; getEditorValue: () => YooptaContentValue; setEditorValue: WithoutFirstArg; blockEditorsMap: YooptaPluginsEditorMap; /** Optional factory override for building Slate editors — used by collaboration to inject withYjs */ buildSlateEditorFn?: (blockId: string) => SlateEditor; /** Returns true if the given Slate editor is currently applying a remote collaborative change */ isRemoteSlateOp?: (slate: SlateEditor) => boolean; formats: YooptaFormats; marks: YooptaMark[]; plugins: Record, unknown>>; applyTransforms: WithoutFirstArg; batchOperations: (fn: () => void) => void; on: (event: K, fn: (payload: YooptaEventsMap[K]) => void) => void; once: (event: K, fn: (payload: YooptaEventsMap[K]) => void) => void; off: (event: K, fn: (payload: YooptaEventsMap[K]) => void) => void; emit: (event: K, payload: YooptaEventsMap[K]) => void; isFocused: () => boolean; blur: (options?: EditorBlurOptions) => void; focus: () => void; getHTML: WithoutFirstArg; getMarkdown: WithoutFirstArg; getPlainText: WithoutFirstArg; getEmail: WithoutFirstArg; getYooptaJSON: WithoutFirstArg; historyStack: Record; isSavingHistory: WithoutFirstArg; isMergingHistory: WithoutFirstArg; withoutSavingHistory: WithoutFirstArg; withoutMergingHistory: WithoutFirstArg; withMergingHistory: WithoutFirstArg; withSavingHistory: WithoutFirstArg; redo: WithoutFirstArg; undo: WithoutFirstArg; refElement: HTMLElement | null; decorators: Map; leafDecorators: Map; }; export type SlateElementTextNode = { text: string; bold?: boolean; italic?: boolean; underline?: boolean; code?: boolean; strike?: boolean; highlight?: any; }; export type SlateElement = { id: string; type: K; children: Descendant[]; props?: PluginElementProps; }; //# sourceMappingURL=types.d.ts.map