Comparing version 0.12.5 to 0.12.6
@@ -10,6 +10,6 @@ /** @module lexical */ | ||
export type { PasteCommandType } from './LexicalCommands'; | ||
export type { CommandListener, CommandListenerPriority, CommandPayloadType, CreateEditorArgs, EditableListener, EditorConfig, EditorThemeClasses, HTMLConfig, Klass, LexicalCommand, LexicalEditor, LexicalNodeReplacement, MutationListener, NodeMutation, SerializedEditor, Spread, } from './LexicalEditor'; | ||
export type { CommandListener, CommandListenerPriority, CommandPayloadType, CreateEditorArgs, EditableListener, EditorConfig, EditorThemeClasses, HTMLConfig, Klass, KlassConstructor, LexicalCommand, LexicalEditor, LexicalNodeReplacement, MutationListener, NodeMutation, SerializedEditor, Spread, } from './LexicalEditor'; | ||
export type { EditorState, SerializedEditorState } from './LexicalEditorState'; | ||
export type { DOMChildConversion, DOMConversion, DOMConversionFn, DOMConversionMap, DOMConversionOutput, DOMExportOutput, LexicalNode, NodeKey, NodeMap, SerializedLexicalNode, } from './LexicalNode'; | ||
export type { BaseSelection, ElementPointType as ElementPoint, GridMapType, GridMapValueType, GridSelection, GridSelectionShape, INTERNAL_PointSelection, NodeSelection, Point, RangeSelection, TextPointType as TextPoint, } from './LexicalSelection'; | ||
export type { BaseSelection, ElementPointType as ElementPoint, GridMapType, GridMapValueType, NodeSelection, Point, PointType, RangeSelection, TextPointType as TextPoint, } from './LexicalSelection'; | ||
export type { ElementFormatType, SerializedElementNode, } from './nodes/LexicalElementNode'; | ||
@@ -19,8 +19,8 @@ export type { SerializedGridCellNode } from './nodes/LexicalGridCellNode'; | ||
export type { SerializedTextNode, TextFormatType, TextModeType, } from './nodes/LexicalTextNode'; | ||
export { BLUR_COMMAND, CAN_REDO_COMMAND, CAN_UNDO_COMMAND, CLEAR_EDITOR_COMMAND, CLEAR_HISTORY_COMMAND, CLICK_COMMAND, CONTROLLED_TEXT_INSERTION_COMMAND, COPY_COMMAND, createCommand, CUT_COMMAND, DELETE_CHARACTER_COMMAND, DELETE_LINE_COMMAND, DELETE_WORD_COMMAND, DRAGEND_COMMAND, DRAGOVER_COMMAND, DRAGSTART_COMMAND, DROP_COMMAND, FOCUS_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, INDENT_CONTENT_COMMAND, INSERT_LINE_BREAK_COMMAND, INSERT_PARAGRAPH_COMMAND, INSERT_TAB_COMMAND, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, KEY_DOWN_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND, KEY_MODIFIER_COMMAND, KEY_SPACE_COMMAND, KEY_TAB_COMMAND, MOVE_TO_END, MOVE_TO_START, OUTDENT_CONTENT_COMMAND, PASTE_COMMAND, REDO_COMMAND, REMOVE_TEXT_COMMAND, SELECT_ALL_COMMAND, SELECTION_CHANGE_COMMAND, UNDO_COMMAND, } from './LexicalCommands'; | ||
export { BLUR_COMMAND, CAN_REDO_COMMAND, CAN_UNDO_COMMAND, CLEAR_EDITOR_COMMAND, CLEAR_HISTORY_COMMAND, CLICK_COMMAND, CONTROLLED_TEXT_INSERTION_COMMAND, COPY_COMMAND, createCommand, CUT_COMMAND, DELETE_CHARACTER_COMMAND, DELETE_LINE_COMMAND, DELETE_WORD_COMMAND, DRAGEND_COMMAND, DRAGOVER_COMMAND, DRAGSTART_COMMAND, DROP_COMMAND, FOCUS_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, INDENT_CONTENT_COMMAND, INSERT_LINE_BREAK_COMMAND, INSERT_PARAGRAPH_COMMAND, INSERT_TAB_COMMAND, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, KEY_DOWN_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND, KEY_MODIFIER_COMMAND, KEY_SPACE_COMMAND, KEY_TAB_COMMAND, MOVE_TO_END, MOVE_TO_START, OUTDENT_CONTENT_COMMAND, PASTE_COMMAND, REDO_COMMAND, REMOVE_TEXT_COMMAND, SELECT_ALL_COMMAND, SELECTION_CHANGE_COMMAND, SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, UNDO_COMMAND, } from './LexicalCommands'; | ||
export { COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, COMMAND_PRIORITY_NORMAL, createEditor, } from './LexicalEditor'; | ||
export type { EventHandler } from './LexicalEvents'; | ||
export { $normalizeSelection as $normalizeSelection__EXPERIMENTAL } from './LexicalNormalization'; | ||
export { $createNodeSelection, $createRangeSelection, $getPreviousSelection, $getSelection, $getTextContent, $insertNodes, $INTERNAL_isPointSelection, $isBlockElementNode, $isNodeSelection, $isRangeSelection, DEPRECATED_$computeGridMap, DEPRECATED_$createGridSelection, DEPRECATED_$getGridCellNodeRect, DEPRECATED_$getNodeTriplet, DEPRECATED_$isGridSelection, } from './LexicalSelection'; | ||
export { $parseSerializedNode } from './LexicalUpdates'; | ||
export { $createNodeSelection, $createPoint, $createRangeSelection, $getPreviousSelection, $getSelection, $getTextContent, $insertNodes, $INTERNAL_isPointSelection, $isBlockElementNode, $isNodeSelection, $isRangeSelection, DEPRECATED_$computeGridMap, DEPRECATED_$getGridCellNodeRect, DEPRECATED_$getNodeTriplet, INTERNAL_PointSelection, } from './LexicalSelection'; | ||
export { $parseSerializedNode, isCurrentlyReadOnlyMode } from './LexicalUpdates'; | ||
export { $addUpdateTag, $applyNodeReplacement, $copyNode, $getAdjacentNode, $getNearestNodeFromDOMNode, $getNearestRootOrShadowRoot, $getNodeByKey, $getRoot, $hasAncestor, $hasUpdateTag, $isInlineElementOrDecoratorNode, $isLeafNode, $isRootOrShadowRoot, $nodesOfType, $selectAll, $setCompositionKey, $setSelection, $splitNode, getNearestEditorFromDOMNode, isHTMLAnchorElement, isHTMLElement, isSelectionCapturedInDecoratorInput, isSelectionWithinEditor, } from './LexicalUtils'; | ||
@@ -27,0 +27,0 @@ export { $isDecoratorNode, DecoratorNode } from './nodes/LexicalDecoratorNode'; |
@@ -8,6 +8,10 @@ /** | ||
*/ | ||
import type { ElementFormatType, LexicalCommand, TextFormatType } from 'lexical'; | ||
import type { BaseSelection, ElementFormatType, LexicalCommand, LexicalNode, TextFormatType } from 'lexical'; | ||
export type PasteCommandType = ClipboardEvent | InputEvent | KeyboardEvent; | ||
export declare function createCommand<T>(type?: string): LexicalCommand<T>; | ||
export declare const SELECTION_CHANGE_COMMAND: LexicalCommand<void>; | ||
export declare const SELECTION_INSERT_CLIPBOARD_NODES_COMMAND: LexicalCommand<{ | ||
nodes: Array<LexicalNode>; | ||
selection: BaseSelection; | ||
}>; | ||
export declare const CLICK_COMMAND: LexicalCommand<MouseEvent>; | ||
@@ -14,0 +18,0 @@ export declare const DELETE_CHARACTER_COMMAND: LexicalCommand<boolean>; |
@@ -12,5 +12,7 @@ /** | ||
export type Spread<T1, T2> = Omit<T2, keyof T1> & T1; | ||
export type Klass<T extends LexicalNode> = { | ||
new (...args: any[]): T; | ||
} & Omit<LexicalNode, 'constructor'>; | ||
export type KlassConstructor<Cls extends GenericConstructor<any>> = GenericConstructor<InstanceType<Cls>> & { | ||
[k in keyof Cls]: Cls[k]; | ||
}; | ||
type GenericConstructor<T> = new (...args: any[]) => T; | ||
export type Klass<T extends LexicalNode> = InstanceType<T['constructor']> extends T ? T['constructor'] : GenericConstructor<T> & T['constructor']; | ||
export type EditorThemeClassName = string; | ||
@@ -28,2 +30,3 @@ export type TextNodeThemeClasses = { | ||
underlineStrikethrough?: EditorThemeClassName; | ||
[key: string]: EditorThemeClassName | undefined; | ||
}; | ||
@@ -216,2 +219,3 @@ export type EditorUpdateOptions = { | ||
export declare class LexicalEditor { | ||
['constructor']: KlassConstructor<typeof LexicalEditor>; | ||
/** @internal */ | ||
@@ -218,0 +222,0 @@ _headless: boolean; |
@@ -9,5 +9,5 @@ /** | ||
import type { LexicalEditor } from './LexicalEditor'; | ||
export declare function getIsProcesssingMutations(): boolean; | ||
export declare function getIsProcessingMutations(): boolean; | ||
export declare function $flushMutations(editor: LexicalEditor, mutations: Array<MutationRecord>, observer: MutationObserver): void; | ||
export declare function flushRootMutations(editor: LexicalEditor): void; | ||
export declare function initMutationObserver(editor: LexicalEditor): void; |
@@ -10,2 +10,3 @@ /** | ||
import type { BaseSelection, RangeSelection } from './LexicalSelection'; | ||
import type { KlassConstructor } from 'lexical'; | ||
import { ElementNode } from '.'; | ||
@@ -20,3 +21,3 @@ export type NodeMap = Map<NodeKey, LexicalNode>; | ||
conversion: DOMConversionFn<T>; | ||
priority: 0 | 1 | 2 | 3 | 4; | ||
priority?: 0 | 1 | 2 | 3 | 4; | ||
}; | ||
@@ -38,3 +39,3 @@ export type DOMConversionFn<T extends HTMLElement = HTMLElement> = (element: T) => DOMConversionOutput | null; | ||
export declare class LexicalNode { | ||
[x: string]: any; | ||
['constructor']: KlassConstructor<typeof LexicalNode>; | ||
/** @internal */ | ||
@@ -64,2 +65,3 @@ __type: string; | ||
static clone(_data: unknown): LexicalNode; | ||
static importDOM?: () => DOMConversionMap<any> | null; | ||
constructor(key?: NodeKey); | ||
@@ -70,2 +72,3 @@ /** | ||
getType(): string; | ||
isInline(): boolean; | ||
/** | ||
@@ -106,3 +109,3 @@ * Returns true if there is a path between this node and the RootNode, false otherwise. | ||
*/ | ||
getTopLevelElement(): ElementNode | this | null; | ||
getTopLevelElement(): ElementNode | null; | ||
/** | ||
@@ -113,3 +116,3 @@ * Returns the highest (in the EditorState tree) | ||
*/ | ||
getTopLevelElementOrThrow(): ElementNode | this; | ||
getTopLevelElementOrThrow(): ElementNode; | ||
/** | ||
@@ -300,3 +303,3 @@ * Returns a list of the every ancestor of this node, | ||
* | ||
* @param nodeToInsert - The node to insert after this one. | ||
* @param nodeToInsert - The node to insert before this one. | ||
* @param restoreSelection - Whether or not to attempt to resolve the | ||
@@ -303,0 +306,0 @@ * selection to the appropriate place after the operation is complete. |
@@ -53,2 +53,3 @@ /** | ||
} | ||
export declare function $createPoint(key: NodeKey, offset: number, type: 'text' | 'element'): PointType; | ||
export declare function $moveSelectionPointToEnd(point: PointType, node: LexicalNode): void; | ||
@@ -125,8 +126,2 @@ export interface BaseSelection { | ||
export declare function $INTERNAL_isPointSelection(x: unknown): x is INTERNAL_PointSelection; | ||
export type GridSelectionShape = { | ||
fromX: number; | ||
fromY: number; | ||
toX: number; | ||
toY: number; | ||
}; | ||
export declare function DEPRECATED_$getGridCellNodeRect(GridCellNode: DEPRECATED_GridCellNode): { | ||
@@ -138,20 +133,2 @@ rowIndex: number; | ||
} | null; | ||
export declare class GridSelection extends INTERNAL_PointSelection { | ||
gridKey: NodeKey; | ||
constructor(gridKey: NodeKey, anchor: PointType, focus: PointType); | ||
getCachedNodes(): LexicalNode[] | null; | ||
setCachedNodes(nodes: LexicalNode[] | null): void; | ||
is(selection: null | BaseSelection): boolean; | ||
set(gridKey: NodeKey, anchorCellKey: NodeKey, focusCellKey: NodeKey): void; | ||
clone(): GridSelection; | ||
isCollapsed(): boolean; | ||
extract(): Array<LexicalNode>; | ||
insertRawText(text: string): void; | ||
insertText(): void; | ||
insertNodes(nodes: Array<LexicalNode>): void; | ||
getShape(): GridSelectionShape; | ||
getNodes(): Array<LexicalNode>; | ||
getTextContent(): string; | ||
} | ||
export declare function DEPRECATED_$isGridSelection(x: unknown): x is GridSelection; | ||
export declare class RangeSelection extends INTERNAL_PointSelection { | ||
@@ -161,4 +138,2 @@ format: number; | ||
constructor(anchor: PointType, focus: PointType, format: number, style: string); | ||
getCachedNodes(): LexicalNode[] | null; | ||
setCachedNodes(nodes: LexicalNode[] | null): void; | ||
/** | ||
@@ -321,5 +296,4 @@ * Used to check if the provided selections is equal to this one by value, | ||
export declare function $createNodeSelection(): NodeSelection; | ||
export declare function DEPRECATED_$createGridSelection(): GridSelection; | ||
export declare function internalCreateSelection(editor: LexicalEditor): null | BaseSelection; | ||
export declare function internalCreateRangeSelection(lastSelection: null | BaseSelection, domSelection: Selection | null, editor: LexicalEditor): null | RangeSelection; | ||
export declare function internalCreateRangeSelection(lastSelection: null | BaseSelection, domSelection: Selection | null, editor: LexicalEditor, event: UIEvent | Event | null): null | RangeSelection; | ||
export declare function $getSelection(): null | BaseSelection; | ||
@@ -326,0 +300,0 @@ export declare function $getPreviousSelection(): null | BaseSelection; |
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
import type { CommandPayloadType, EditorThemeClasses, Klass, LexicalCommand, MutatedNodes, MutationListeners, NodeMutation, RegisteredNode, RegisteredNodes } from './LexicalEditor'; | ||
import type { CommandPayloadType, EditorThemeClasses, Klass, LexicalCommand, MutatedNodes, MutationListeners, NodeMutation, RegisteredNode, RegisteredNodes, Spread } from './LexicalEditor'; | ||
import type { EditorState } from './LexicalEditorState'; | ||
@@ -107,3 +107,8 @@ import type { LexicalNode, NodeKey } from './LexicalNode'; | ||
export declare function $getNearestRootOrShadowRoot(node: LexicalNode): RootNode | ElementNode; | ||
export declare function $isRootOrShadowRoot(node: null | LexicalNode): boolean; | ||
declare const ShadowRootNodeBrand: unique symbol; | ||
type ShadowRootNode = Spread<{ | ||
isShadowRoot(): true; | ||
[ShadowRootNodeBrand]: never; | ||
}, ElementNode>; | ||
export declare function $isRootOrShadowRoot(node: null | LexicalNode): node is RootNode | ShadowRootNode; | ||
export declare function $copyNode<T extends LexicalNode>(node: T): T; | ||
@@ -118,3 +123,2 @@ export declare function $applyNodeReplacement<N extends LexicalNode>(node: LexicalNode): N; | ||
export declare function $findMatchingParent(startingNode: LexicalNode, findFn: (node: LexicalNode) => boolean): LexicalNode | null; | ||
export declare function $getChildrenRecursively(node: LexicalNode): Array<LexicalNode>; | ||
/** | ||
@@ -136,1 +140,2 @@ * @param x - The element being tested | ||
export declare function $getAncestor<NodeType extends LexicalNode = LexicalNode>(node: LexicalNode, predicate: (ancestor: LexicalNode) => ancestor is NodeType): NodeType | null; | ||
export {}; |
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
import type { LexicalEditor } from '../LexicalEditor'; | ||
import type { KlassConstructor, LexicalEditor } from '../LexicalEditor'; | ||
import type { NodeKey } from '../LexicalNode'; | ||
@@ -15,2 +15,3 @@ import { EditorConfig } from 'lexical'; | ||
export declare class DecoratorNode<T> extends LexicalNode { | ||
['constructor']: KlassConstructor<typeof DecoratorNode<T>>; | ||
constructor(key?: NodeKey); | ||
@@ -17,0 +18,0 @@ /** |
@@ -10,3 +10,3 @@ /** | ||
import type { BaseSelection, RangeSelection } from '../LexicalSelection'; | ||
import type { Spread } from 'lexical'; | ||
import type { KlassConstructor, Spread } from 'lexical'; | ||
import { TextNode } from '../'; | ||
@@ -23,2 +23,3 @@ import { LexicalNode } from '../LexicalNode'; | ||
export declare class ElementNode extends LexicalNode { | ||
['constructor']: KlassConstructor<typeof ElementNode>; | ||
/** @internal */ | ||
@@ -25,0 +26,0 @@ __first: null | NodeKey; |
@@ -8,2 +8,3 @@ /** | ||
*/ | ||
import type { KlassConstructor } from '../LexicalEditor'; | ||
import type { DOMConversionMap, NodeKey, SerializedLexicalNode } from '../LexicalNode'; | ||
@@ -14,2 +15,3 @@ import { LexicalNode } from '../LexicalNode'; | ||
export declare class LineBreakNode extends LexicalNode { | ||
['constructor']: KlassConstructor<typeof LineBreakNode>; | ||
static getType(): string; | ||
@@ -16,0 +18,0 @@ static clone(node: LineBreakNode): LineBreakNode; |
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
import type { EditorConfig, LexicalEditor, Spread } from '../LexicalEditor'; | ||
import type { EditorConfig, KlassConstructor, LexicalEditor, Spread } from '../LexicalEditor'; | ||
import type { DOMConversionMap, DOMExportOutput, NodeKey, SerializedLexicalNode } from '../LexicalNode'; | ||
@@ -31,2 +31,3 @@ import type { BaseSelection, RangeSelection } from '../LexicalSelection'; | ||
export declare class TextNode extends LexicalNode { | ||
['constructor']: KlassConstructor<typeof TextNode>; | ||
__text: string; | ||
@@ -132,3 +133,3 @@ /** @internal */ | ||
getFormatFlags(type: TextFormatType, alignWithFormat: null | number): number; | ||
createDOM(config: EditorConfig): HTMLElement; | ||
createDOM(config: EditorConfig, editor?: LexicalEditor): HTMLElement; | ||
updateDOM(prevNode: TextNode, dom: HTMLElement, config: EditorConfig): boolean; | ||
@@ -135,0 +136,0 @@ static importDOM(): DOMConversionMap | null; |
@@ -12,3 +12,3 @@ { | ||
"license": "MIT", | ||
"version": "0.12.5", | ||
"version": "0.12.6", | ||
"main": "Lexical.js", | ||
@@ -15,0 +15,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
578900
12070