Comparing version 0.3.5 to 0.3.6
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
export type { CommandListenerPriority, EditorConfig, EditorThemeClasses, IntentionallyMarkedAsDirtyElement, LexicalCommand, LexicalEditor, NodeMutation, ReadOnlyListener, SerializedEditor, Spread, } from './LexicalEditor'; | ||
export type { CommandListenerPriority, EditorConfig, EditorThemeClasses, IntentionallyMarkedAsDirtyElement, Klass, LexicalCommand, LexicalEditor, NodeMutation, ReadOnlyListener, SerializedEditor, Spread, } from './LexicalEditor'; | ||
export type { EditorState, SerializedEditorState } from './LexicalEditorState'; | ||
@@ -11,0 +11,0 @@ export type { DOMChildConversion, DOMConversion, DOMConversionFn, DOMConversionMap, DOMConversionOutput, DOMExportOutput, LexicalNode, NodeKey, NodeMap, SerializedLexicalNode, } from './LexicalNode'; |
@@ -9,3 +9,3 @@ /** | ||
import type { ElementFormatType } from './nodes/LexicalElementNode'; | ||
import type { TextFormatType, TextModeType } from './nodes/LexicalTextNode'; | ||
import type { TextDetailType, TextFormatType, TextModeType } from './nodes/LexicalTextNode'; | ||
export declare const DOM_ELEMENT_TYPE = 1; | ||
@@ -39,6 +39,7 @@ export declare const DOM_TEXT_TYPE = 3; | ||
export declare const LTR_REGEX: RegExp; | ||
export declare const TEXT_TYPE_TO_FORMAT: Record<TextFormatType, number>; | ||
export declare const ELEMENT_TYPE_TO_FORMAT: Omit<Record<ElementFormatType, number>, ''>; | ||
export declare const TEXT_TYPE_TO_FORMAT: Record<TextFormatType | string, number>; | ||
export declare const DETAIL_TYPE_TO_DETAIL: Record<TextDetailType | string, number>; | ||
export declare const ELEMENT_TYPE_TO_FORMAT: Record<Exclude<ElementFormatType, ''>, number>; | ||
export declare const ELEMENT_FORMAT_TO_TYPE: Record<number, ElementFormatType>; | ||
export declare const TEXT_MODE_TO_TYPE: Record<TextModeType, 0 | 1 | 2 | 3>; | ||
export declare const TEXT_TYPE_TO_MODE: Record<number, TextModeType>; |
@@ -10,4 +10,6 @@ /** | ||
import type { DOMConversion, LexicalNode, NodeKey } from './LexicalNode'; | ||
import type { Klass } from 'shared/types'; | ||
export declare type Spread<T1, T2> = Omit<T2, keyof T1> & T1; | ||
export declare type Klass<T extends LexicalNode> = { | ||
new (...args: any[]): T; | ||
} & Omit<LexicalNode, 'constructor'>; | ||
export declare type EditorThemeClassName = string; | ||
@@ -34,2 +36,3 @@ export declare type TextNodeThemeClasses = { | ||
export declare type EditorThemeClasses = { | ||
characterLimit?: EditorThemeClassName; | ||
code?: EditorThemeClassName; | ||
@@ -77,7 +80,3 @@ codeHighlight?: Record<string, EditorThemeClassName>; | ||
}; | ||
[key: string]: EditorThemeClassName | TextNodeThemeClasses | { | ||
[key: string]: Array<EditorThemeClassName> | EditorThemeClassName | TextNodeThemeClasses | { | ||
[key: string]: EditorThemeClassName; | ||
}; | ||
}; | ||
[key: string]: any; | ||
}; | ||
@@ -94,3 +93,3 @@ export declare type EditorConfig = { | ||
}; | ||
export declare type Transform<T> = (node: T) => void; | ||
export declare type Transform<T extends LexicalNode> = (node: T) => void; | ||
export declare type ErrorHandler = (error: Error) => void; | ||
@@ -108,3 +107,3 @@ export declare type MutationListeners = Map<MutationListener, Klass<LexicalNode>>; | ||
}) => void; | ||
export declare type DecoratorListener<T = unknown> = (decorator: Record<NodeKey, T>) => void; | ||
export declare type DecoratorListener<T = never> = (decorator: Record<NodeKey, T>) => void; | ||
export declare type RootListener = (rootElement: null | HTMLElement, prevRootElement: null | HTMLElement) => void; | ||
@@ -121,3 +120,3 @@ export declare type TextContentListener = (text: string) => void; | ||
export declare const COMMAND_PRIORITY_CRITICAL = 4; | ||
export declare type LexicalCommand<T> = Readonly<Record<string, unknown>>; | ||
export declare type LexicalCommand<T = never> = Readonly<Record<string, unknown>>; | ||
declare type Commands = Map<LexicalCommand<unknown>, Array<Set<CommandListener<unknown>>>>; | ||
@@ -160,3 +159,3 @@ declare type Listeners = { | ||
_keyToDOMMap: Map<NodeKey, HTMLElement>; | ||
_updates: Array<[() => void, EditorUpdateOptions]>; | ||
_updates: Array<[() => void, EditorUpdateOptions | undefined]>; | ||
_updating: boolean; | ||
@@ -163,0 +162,0 @@ _listeners: Listeners; |
@@ -18,9 +18,9 @@ /** | ||
export declare function $getNodeByKeyOrThrow<N extends LexicalNode>(key: NodeKey): N; | ||
export declare type DOMConversion = { | ||
conversion: DOMConversionFn; | ||
export declare type DOMConversion<T extends HTMLElement = HTMLElement> = { | ||
conversion: DOMConversionFn<T>; | ||
priority: 0 | 1 | 2 | 3 | 4; | ||
}; | ||
export declare type DOMConversionFn = (element: Node, parent?: Node) => DOMConversionOutput; | ||
export declare type DOMChildConversion = (lexicalNode: LexicalNode, parentLexicalNode: LexicalNode | null) => LexicalNode | null | void; | ||
export declare type DOMConversionMap = Record<NodeName, (node: Node) => DOMConversion | null>; | ||
export declare type DOMConversionFn<T extends HTMLElement = HTMLElement> = (element: T, parent?: Node) => DOMConversionOutput | null; | ||
export declare type DOMChildConversion = (lexicalNode: LexicalNode, parentLexicalNode: LexicalNode | null | undefined) => LexicalNode | null | undefined; | ||
export declare type DOMConversionMap<T extends HTMLElement = HTMLElement> = Record<NodeName, (node: T) => DOMConversion<T> | null>; | ||
declare type NodeName = string; | ||
@@ -40,3 +40,3 @@ export declare type DOMConversionOutput = { | ||
__type: string; | ||
__key: NodeKey; | ||
__key: string; | ||
__parent: null | NodeKey; | ||
@@ -55,3 +55,3 @@ static getType(): string; | ||
getTopLevelElementOrThrow(): ElementNode | this; | ||
getParents<T extends ElementNode>(): Array<T>; | ||
getParents(): Array<ElementNode>; | ||
getParentKeys(): Array<NodeKey>; | ||
@@ -58,0 +58,0 @@ getPreviousSibling<T extends LexicalNode>(): T | null; |
@@ -17,5 +17,5 @@ /** | ||
getNode: () => TextNode; | ||
is: (PointType: any) => boolean; | ||
is: (point: PointType) => boolean; | ||
isAtNodeEnd: () => boolean; | ||
isBefore: (PointType: any) => boolean; | ||
isBefore: (point: PointType) => boolean; | ||
key: NodeKey; | ||
@@ -29,5 +29,5 @@ offset: number; | ||
getNode: () => ElementNode; | ||
is: (PointType: any) => boolean; | ||
is: (point: PointType) => boolean; | ||
isAtNodeEnd: () => boolean; | ||
isBefore: (PointType: any) => boolean; | ||
isBefore: (point: PointType) => boolean; | ||
key: NodeKey; | ||
@@ -43,3 +43,3 @@ offset: number; | ||
type: 'text' | 'element'; | ||
_selection: RangeSelection | GridSelection; | ||
_selection: RangeSelection | GridSelection | null; | ||
constructor(key: NodeKey, offset: number, type: 'text' | 'element'); | ||
@@ -90,3 +90,3 @@ is(point: PointType): boolean; | ||
dirty: boolean; | ||
_cachedNodes: Array<LexicalNode>; | ||
_cachedNodes: Array<LexicalNode> | null; | ||
constructor(gridKey: NodeKey, anchor: PointType, focus: PointType); | ||
@@ -93,0 +93,0 @@ is(selection: null | RangeSelection | NodeSelection | GridSelection): boolean; |
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
import type { LexicalCommand, MutatedNodes, MutationListeners, NodeMutation, RegisteredNode, RegisteredNodes } from './LexicalEditor'; | ||
import type { EditorThemeClasses, Klass, LexicalCommand, MutatedNodes, MutationListeners, NodeMutation, RegisteredNode, RegisteredNodes } from './LexicalEditor'; | ||
import type { EditorState } from './LexicalEditorState'; | ||
@@ -15,4 +15,3 @@ import type { LexicalNode, NodeKey } from './LexicalNode'; | ||
import type { TextFormatType, TextNode } from './nodes/LexicalTextNode'; | ||
import type { Klass } from 'shared/types'; | ||
import { ElementNode } from '.'; | ||
import { DecoratorNode, ElementNode, LineBreakNode } from '.'; | ||
import { LexicalEditor } from './LexicalEditor'; | ||
@@ -32,3 +31,3 @@ export declare const emptyFunction: () => void; | ||
export declare function toggleTextFormatType(format: number, type: TextFormatType, alignWithFormat: null | number): number; | ||
export declare function $isLeafNode(node: LexicalNode | null | undefined): boolean; | ||
export declare function $isLeafNode(node: LexicalNode | null | undefined): node is TextNode | LineBreakNode | DecoratorNode<unknown>; | ||
export declare function $setNodeKey(node: LexicalNode, existingKey: NodeKey | null | undefined): void; | ||
@@ -44,3 +43,3 @@ export declare function removeFromParent(writableNode: LexicalNode): void; | ||
export declare function cloneDecorators(editor: LexicalEditor): Record<NodeKey, unknown>; | ||
export declare function getEditorStateTextContent(editorState: any): string; | ||
export declare function getEditorStateTextContent(editorState: EditorState): string; | ||
export declare function markAllNodesAsDirty(editor: LexicalEditor, type: string): void; | ||
@@ -89,5 +88,5 @@ export declare function $getRoot(): RootNode; | ||
export declare function isDelete(keyCode: number): boolean; | ||
export declare function getCachedClassNameArray<T>(classNamesTheme: T, classNameThemeType: string): Array<string>; | ||
export declare function getCachedClassNameArray(classNamesTheme: EditorThemeClasses, classNameThemeType: string): Array<string>; | ||
export declare function setMutatedNode(mutatedNodes: MutatedNodes, registeredNodes: RegisteredNodes, mutationListeners: MutationListeners, node: LexicalNode, mutation: NodeMutation): void; | ||
export declare function $nodesOfType<T extends LexicalNode>(klass: Klass<T>): Array<T>; | ||
export declare function $nodesOfType<T extends LexicalNode>(klass: Klass<T>): Array<LexicalNode>; | ||
export declare function $getDecoratorNode(focus: PointType, isBackward: boolean): null | LexicalNode; | ||
@@ -94,0 +93,0 @@ export declare function isFirefoxClipboardEvents(): boolean; |
@@ -8,2 +8,2 @@ /** | ||
*/ | ||
export declare const VERSION = "0.3.5"; | ||
export declare const VERSION = "0.3.6"; |
@@ -69,4 +69,4 @@ /** | ||
canMergeWith(node: ElementNode): boolean; | ||
extractWithChild(child: LexicalNode, selection: RangeSelection | NodeSelection | GridSelection, destination: 'clone' | 'html'): boolean; | ||
extractWithChild(child: LexicalNode, selection: RangeSelection | NodeSelection | GridSelection | null, destination: 'clone' | 'html'): boolean; | ||
} | ||
export declare function $isElementNode(node: LexicalNode | null | undefined): node is ElementNode; |
@@ -21,2 +21,3 @@ /** | ||
export declare type TextFormatType = 'bold' | 'underline' | 'strikethrough' | 'italic' | 'code' | 'subscript' | 'superscript'; | ||
export declare type TextDetailType = 'directionless' | 'unmergable'; | ||
export declare type TextModeType = 'normal' | 'token' | 'segmented' | 'inert'; | ||
@@ -58,4 +59,4 @@ export declare type TextMark = { | ||
selectionTransform(prevSelection: null | RangeSelection | NodeSelection | GridSelection, nextSelection: RangeSelection): void; | ||
setFormat(format: number): this; | ||
setDetail(detail: number): this; | ||
setFormat(format: TextFormatType | number): this; | ||
setDetail(detail: TextDetailType | number): this; | ||
setStyle(style: string): this; | ||
@@ -62,0 +63,0 @@ toggleFormat(type: TextFormatType): this; |
@@ -12,3 +12,3 @@ { | ||
"license": "MIT", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"main": "Lexical.js", | ||
@@ -19,6 +19,3 @@ "repository": { | ||
"directory": "packages/lexical" | ||
}, | ||
"devDependencies": { | ||
"utility-types": "^3.10.0" | ||
} | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
436819
0
8734