lexical 0.1.10 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import type {LexicalNode, RangeSelection} from 'lexical';
10
+ import {LinkNode} from 'lexical/LinkNode';
11
+ export declare class AutoLinkNode extends LinkNode {
12
+ getType(): string;
13
+ // $FlowFixMe[incompatible-extend]
14
+ clone(node: AutoLinkNode): AutoLinkNode;
15
+ insertNewAfter(selection: RangeSelection): null | LexicalNode;
16
+ // $FlowFixMe[incompatible-extend]
17
+ canInsertTextAfter(): true;
18
+ }
19
+ export function $createAutoLinkNode(url: string): AutoLinkNode;
20
+ export function $isAutoLinkNode(node: LexicalNode | null | undefined): boolean;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ import type {LexicalNode, RangeSelection} from 'lexical';
11
+
12
+ import {LinkNode} from 'lexical/LinkNode';
13
+
14
+ declare export class AutoLinkNode extends LinkNode {
15
+ static getType(): string;
16
+ // $FlowFixMe[incompatible-extend]
17
+ static clone(node: AutoLinkNode): AutoLinkNode;
18
+ insertNewAfter(selection: RangeSelection): null | LexicalNode;
19
+ // $FlowFixMe[incompatible-extend]
20
+ canInsertTextAfter(): true;
21
+ }
22
+ declare export function $createAutoLinkNode(url: string): AutoLinkNode;
23
+ declare export function $isAutoLinkNode(
24
+ node: ?LexicalNode,
25
+ ): boolean %checks(node instanceof AutoLinkNode);
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import type {
10
+ EditorConfig,
11
+ EditorThemeClasses,
12
+ LexicalNode,
13
+ NodeKey,
14
+ } from 'lexical';
15
+ import {TextNode} from 'lexical';
16
+ export declare class CodeHighlightNode extends TextNode {
17
+ __highlightType: string | null | undefined;
18
+ constructor(text: string, highlightType?: string, key?: NodeKey);
19
+ getType(): string;
20
+ clone(node: CodeHighlightNode): CodeHighlightNode;
21
+ createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
22
+ updateDOM<EditorContext>( // $FlowFixMe
23
+ prevNode: CodeHighlightNode,
24
+ dom: HTMLElement,
25
+ config: EditorConfig<EditorContext>,
26
+ ): boolean;
27
+ setFormat(format: number): CodeHighlightNode;
28
+ }
29
+ declare function getHighlightThemeClass(
30
+ theme: EditorThemeClasses,
31
+ highlightType: string | null | undefined,
32
+ ): string | null | undefined;
33
+ export function $createCodeHighlightNode(
34
+ text: string,
35
+ highlightType?: string,
36
+ ): CodeHighlightNode;
37
+ export function $isCodeHighlightNode(
38
+ node: LexicalNode | null | undefined,
39
+ ): boolean;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ import type {
11
+ EditorConfig,
12
+ EditorThemeClasses,
13
+ LexicalNode,
14
+ NodeKey,
15
+ } from 'lexical';
16
+
17
+ import {TextNode} from 'lexical';
18
+
19
+ declare export class CodeHighlightNode extends TextNode {
20
+ __highlightType: ?string;
21
+ constructor(text: string, highlightType?: string, key?: NodeKey): void;
22
+ static getType(): string;
23
+ static clone(node: CodeHighlightNode): CodeHighlightNode;
24
+ createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
25
+ updateDOM<EditorContext>(
26
+ // $FlowFixMe
27
+ prevNode: CodeHighlightNode,
28
+ dom: HTMLElement,
29
+ config: EditorConfig<EditorContext>,
30
+ ): boolean;
31
+ setFormat(format: number): this;
32
+ }
33
+ declare function getHighlightThemeClass(
34
+ theme: EditorThemeClasses,
35
+ highlightType: ?string,
36
+ ): ?string;
37
+ declare export function $createCodeHighlightNode(
38
+ text: string,
39
+ highlightType?: string,
40
+ ): CodeHighlightNode;
41
+ declare export function $isCodeHighlightNode(
42
+ node: ?LexicalNode,
43
+ ): boolean %checks(node instanceof CodeHighlightNode);
package/CodeNode.d.ts ADDED
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import type {
10
+ EditorConfig,
11
+ LexicalNode,
12
+ NodeKey,
13
+ ParagraphNode,
14
+ RangeSelection,
15
+ } from 'lexical';
16
+ import type {CodeHighlightNode} from 'lexical/CodeHighlightNode';
17
+ import {ElementNode} from 'lexical';
18
+ export declare class CodeNode extends ElementNode {
19
+ getType(): string;
20
+ clone(node: CodeNode): CodeNode;
21
+ constructor(key?: NodeKey);
22
+ createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
23
+ updateDOM(prevNode: CodeNode, dom: HTMLElement): boolean;
24
+ insertNewAfter(
25
+ selection: RangeSelection,
26
+ ): null | ParagraphNode | CodeHighlightNode;
27
+ canInsertTab(): true;
28
+ collapseAtStart(): true;
29
+ setLanguage(language: string): void;
30
+ getLanguage(): string | void;
31
+ }
32
+ export function $createCodeNode(): CodeNode;
33
+ export function $isCodeNode(node: LexicalNode | null | undefined): boolean;
34
+ export function getFirstCodeHighlightNodeOfLine(
35
+ anchor: LexicalNode,
36
+ ): CodeHighlightNode | null | undefined;
37
+ export function getLastCodeHighlightNodeOfLine(
38
+ anchor: LexicalNode,
39
+ ): CodeHighlightNode | null | undefined;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ import type {
11
+ EditorConfig,
12
+ LexicalNode,
13
+ NodeKey,
14
+ ParagraphNode,
15
+ RangeSelection,
16
+ } from 'lexical';
17
+ import type {CodeHighlightNode} from 'lexical/CodeHighlightNode';
18
+
19
+ import {ElementNode} from 'lexical';
20
+
21
+ declare export class CodeNode extends ElementNode {
22
+ static getType(): string;
23
+ static clone(node: CodeNode): CodeNode;
24
+ constructor(key?: NodeKey): void;
25
+ createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
26
+ updateDOM(prevNode: CodeNode, dom: HTMLElement): boolean;
27
+ insertNewAfter(
28
+ selection: RangeSelection,
29
+ ): null | ParagraphNode | CodeHighlightNode;
30
+ canInsertTab(): true;
31
+ collapseAtStart(): true;
32
+ setLanguage(language: string): void;
33
+ getLanguage(): string | void;
34
+ }
35
+ declare export function $createCodeNode(): CodeNode;
36
+ declare export function $isCodeNode(
37
+ node: ?LexicalNode,
38
+ ): boolean %checks(node instanceof CodeNode);
39
+
40
+ declare export function getFirstCodeHighlightNodeOfLine(
41
+ anchor: LexicalNode,
42
+ ): ?CodeHighlightNode;
43
+
44
+ declare export function getLastCodeHighlightNodeOfLine(
45
+ anchor: LexicalNode,
46
+ ): ?CodeHighlightNode;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import {Class} from 'utility-types';
10
+ import type {LexicalNode} from 'lexical';
11
+ declare const ExtendedNodes: Array<Class<LexicalNode>>;
12
+
13
+ export default ExtendedNodes;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import type {EditorConfig, LexicalNode, NodeKey} from 'lexical';
10
+ import {TextNode} from 'lexical';
11
+ export declare class HashtagNode extends TextNode {
12
+ getType(): string;
13
+ clone(node: HashtagNode): HashtagNode;
14
+ constructor(text: string, key?: NodeKey);
15
+ createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
16
+ setTextContent(text: string): TextNode;
17
+ canInsertTextBefore(): boolean;
18
+ canInsertTextAfter(): boolean;
19
+ }
20
+ export function $toggleHashtag(node: TextNode): TextNode;
21
+ export function $createHashtagNode(text?: string): TextNode;
22
+ export function $isHashtagNode(node: LexicalNode | null | undefined): boolean;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ import type {EditorConfig, LexicalNode, NodeKey} from 'lexical';
11
+
12
+ import {TextNode} from 'lexical';
13
+
14
+ declare export class HashtagNode extends TextNode {
15
+ static getType(): string;
16
+ static clone(node: HashtagNode): HashtagNode;
17
+ constructor(text: string, key?: NodeKey): void;
18
+ createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
19
+ setTextContent(text: string): TextNode;
20
+ canInsertTextBefore(): boolean;
21
+ canInsertTextAfter(): boolean;
22
+ }
23
+ declare export function $toggleHashtag(node: TextNode): TextNode;
24
+ declare export function $createHashtagNode(text?: string): TextNode;
25
+ declare export function $isHashtagNode(
26
+ node: ?LexicalNode,
27
+ ): boolean %checks(node instanceof HashtagNode);
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import type {EditorConfig, LexicalNode, NodeKey, ParagraphNode} from 'lexical';
10
+ import {ElementNode} from 'lexical';
11
+ type HeadingTagType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5';
12
+ export declare class HeadingNode extends ElementNode {
13
+ __tag: HeadingTagType;
14
+ getType(): string;
15
+ clone(node: HeadingNode): HeadingNode;
16
+ constructor(tag: HeadingTagType, key?: NodeKey);
17
+ getTag(): HeadingTagType;
18
+ createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
19
+ updateDOM(prevNode: HeadingNode, dom: HTMLElement): boolean;
20
+ insertNewAfter(): ParagraphNode;
21
+ collapseAtStart(): true;
22
+ }
23
+ export function $createHeadingNode(headingTag: HeadingTagType): HeadingNode;
24
+ export function $isHeadingNode(node: LexicalNode | null | undefined): boolean;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ import type {EditorConfig, LexicalNode, NodeKey, ParagraphNode} from 'lexical';
11
+
12
+ import {ElementNode} from 'lexical';
13
+
14
+ type HeadingTagType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5';
15
+ declare export class HeadingNode extends ElementNode {
16
+ __tag: HeadingTagType;
17
+ static getType(): string;
18
+ static clone(node: HeadingNode): HeadingNode;
19
+ constructor(tag: HeadingTagType, key?: NodeKey): void;
20
+ getTag(): HeadingTagType;
21
+ createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
22
+ updateDOM(prevNode: HeadingNode, dom: HTMLElement): boolean;
23
+ insertNewAfter(): ParagraphNode;
24
+ collapseAtStart(): true;
25
+ }
26
+ declare export function $createHeadingNode(
27
+ headingTag: HeadingTagType,
28
+ ): HeadingNode;
29
+
30
+ declare export function $isHeadingNode(
31
+ node: ?LexicalNode,
32
+ ): boolean %checks(node instanceof HeadingNode);