UNPKG

@dossierhq/core

Version:

The core Dossier library used by clients and server alike, used to interact with schema and entities directly, as well as remotely through a client.

73 lines (72 loc) 2.62 kB
export type Spread<T1, T2> = Omit<T2, keyof T1> & T1; export interface SerializedEditorState<T extends SerializedLexicalNode = SerializedLexicalNode> { root: SerializedRootNode<T>; } export type SerializedRootNode<T extends SerializedLexicalNode = SerializedLexicalNode> = SerializedElementNode<T>; export interface SerializedLexicalNode { type: string; version: number; } export type SerializedElementNode<T extends SerializedLexicalNode = SerializedLexicalNode> = Spread<{ children: T[]; direction: 'ltr' | 'rtl' | null; format: ElementFormatType; indent: number; }, SerializedLexicalNode>; type ElementFormatType = 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; export type SerializedTextNode = Spread<{ detail: number; format: number; mode: TextModeType; style: string; text: string; }, SerializedLexicalNode>; export type TextFormatType = 'bold' | 'underline' | 'strikethrough' | 'italic' | 'highlight' | 'code' | 'subscript' | 'superscript'; type TextModeType = 'normal' | 'token' | 'segmented'; export type SerializedLineBreakNode = SerializedLexicalNode; export type SerializedParagraphNode = SerializedElementNode; export type SerializedTabNode = SerializedTextNode; export declare const IS_UNMERGEABLE = 2; export declare const TEXT_TYPE_TO_FORMAT: { bold: number; code: number; highlight: number; italic: number; strikethrough: number; subscript: number; superscript: number; underline: number; }; export type SerializedCodeNode = Spread<{ language: string | null | undefined; }, SerializedElementNode>; export type SerializedCodeHighlightNode = Spread<{ highlightType: string | null | undefined; }, SerializedTextNode>; interface LinkAttributes { rel?: null | string; target?: null | string; title?: null | string; } export type SerializedLinkNode = Spread<{ url: string; }, Spread<LinkAttributes, SerializedElementNode>>; export type SerializedListNode = Spread<{ listType: ListType; start: number; tag: ListNodeTagType; }, SerializedElementNode>; type ListType = 'number' | 'bullet' | 'check'; type ListNodeTagType = 'ul' | 'ol'; export type SerializedListItemNode = Spread<{ checked: boolean | undefined; value: number; }, SerializedElementNode>; export type SerializedDecoratorBlockNode = Spread<{ format: ElementFormatType; }, SerializedLexicalNode>; export declare type SerializedHeadingNode = Spread<{ tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'; }, SerializedElementNode>; export type HeadingTagType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'; export {};