@veltdev/lexical-velt-comments 4.5.2-beta.2 → 4.5.2-beta.3
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.
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/types/src/adapters/host/doc.d.ts +97 -0
- package/cjs/types/src/adapters/host/marks.d.ts +89 -0
- package/cjs/types/src/adapters/host/storage.d.ts +37 -0
- package/cjs/types/src/adapters/velt.d.ts +55 -0
- package/cjs/types/src/constants/common.d.ts +67 -0
- package/cjs/types/src/core/extension.d.ts +40 -0
- package/cjs/types/src/core/registry.d.ts +71 -0
- package/cjs/types/src/core/state.d.ts +86 -0
- package/cjs/types/src/features/addComment.d.ts +63 -0
- package/cjs/types/src/features/commentRenderer.d.ts +46 -0
- package/cjs/types/src/features/renderComments.d.ts +73 -0
- package/cjs/types/src/features/updateContent.d.ts +32 -0
- package/cjs/types/src/index.d.ts +26 -0
- package/cjs/types/src/types/common.d.ts +72 -0
- package/cjs/types/src/types/host.d.ts +65 -0
- package/cjs/types/src/types/state.d.ts +28 -0
- package/cjs/types/src/types/velt.d.ts +6 -0
- package/cjs/types/src/utils/common.d.ts +56 -0
- package/cjs/types/src/utils/console.d.ts +37 -0
- package/cjs/types/src/utils/host.d.ts +44 -0
- package/cjs/types/src/utils/serializer.d.ts +19 -0
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/types/src/adapters/host/doc.d.ts +97 -0
- package/esm/types/src/adapters/host/marks.d.ts +89 -0
- package/esm/types/src/adapters/host/storage.d.ts +37 -0
- package/esm/types/src/adapters/velt.d.ts +55 -0
- package/esm/types/src/constants/common.d.ts +67 -0
- package/esm/types/src/core/extension.d.ts +40 -0
- package/esm/types/src/core/registry.d.ts +71 -0
- package/esm/types/src/core/state.d.ts +86 -0
- package/esm/types/src/features/addComment.d.ts +63 -0
- package/esm/types/src/features/commentRenderer.d.ts +46 -0
- package/esm/types/src/features/renderComments.d.ts +73 -0
- package/esm/types/src/features/updateContent.d.ts +32 -0
- package/esm/types/src/index.d.ts +26 -0
- package/esm/types/src/types/common.d.ts +72 -0
- package/esm/types/src/types/host.d.ts +65 -0
- package/esm/types/src/types/state.d.ts +28 -0
- package/esm/types/src/types/velt.d.ts +6 -0
- package/esm/types/src/utils/common.d.ts +56 -0
- package/esm/types/src/utils/console.d.ts +37 -0
- package/esm/types/src/utils/host.d.ts +44 -0
- package/esm/types/src/utils/serializer.d.ts +19 -0
- package/index.d.ts +275 -26
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -0
- package/cjs/types/comment-node.d.ts +0 -23
- package/cjs/types/constants.d.ts +0 -6
- package/cjs/types/editor.d.ts +0 -166
- package/cjs/types/index.d.ts +0 -24
- package/cjs/types/plugin.d.ts +0 -14
- package/cjs/types/serializer.d.ts +0 -5
- package/cjs/types/store.d.ts +0 -39
- package/cjs/types/types.d.ts +0 -40
- package/cjs/types/utility.d.ts +0 -122
- package/cjs/types/velt.d.ts +0 -21
- package/esm/types/comment-node.d.ts +0 -23
- package/esm/types/constants.d.ts +0 -6
- package/esm/types/editor.d.ts +0 -166
- package/esm/types/index.d.ts +0 -24
- package/esm/types/plugin.d.ts +0 -14
- package/esm/types/serializer.d.ts +0 -5
- package/esm/types/store.d.ts +0 -39
- package/esm/types/types.d.ts +0 -40
- package/esm/types/utility.d.ts +0 -122
- package/esm/types/velt.d.ts +0 -21
package/esm/types/utility.d.ts
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { LexicalEditor, LexicalNode, RangeSelection, TextNode } from "lexical";
|
|
2
|
-
import { CommentNode } from "./comment-node";
|
|
3
|
-
export declare class UtilityService {
|
|
4
|
-
/**
|
|
5
|
-
* KMP Search implementation
|
|
6
|
-
*/
|
|
7
|
-
static kmpSearch(text: string, pattern: string, startPos?: number, maxOccurrences?: number): number[];
|
|
8
|
-
/**
|
|
9
|
-
* Compute KMP failure function
|
|
10
|
-
*/
|
|
11
|
-
static computeKMPTable(pattern: string): number[];
|
|
12
|
-
/**
|
|
13
|
-
* Collect all text content including paragraph breaks.
|
|
14
|
-
* This method creates a combined text representation of the entire document,
|
|
15
|
-
* inserting newline characters between paragraphs to maintain text structure
|
|
16
|
-
* for accurate multi-paragraph text matching.
|
|
17
|
-
*
|
|
18
|
-
* @param root - The root Lexical node to traverse
|
|
19
|
-
* @returns Object containing:
|
|
20
|
-
* - combinedText: Complete text with newlines between paragraphs
|
|
21
|
-
* - nodeMap: Array mapping each text node and paragraph break to its position
|
|
22
|
-
*/
|
|
23
|
-
static collectTextContent(root: LexicalNode): {
|
|
24
|
-
combinedText: string;
|
|
25
|
-
nodeMap: {
|
|
26
|
-
node: TextNode | null;
|
|
27
|
-
start: number;
|
|
28
|
-
end: number;
|
|
29
|
-
isParagraphBreak?: boolean;
|
|
30
|
-
}[];
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Get text nodes within a specific character range (Updated to handle paragraph breaks)
|
|
34
|
-
*/
|
|
35
|
-
static getTextNodesInRange(root: LexicalNode, fromPos: number, toPos: number, excludeAnnotationId?: string): {
|
|
36
|
-
node: TextNode;
|
|
37
|
-
startOffset: number;
|
|
38
|
-
endOffset: number;
|
|
39
|
-
isPartial: boolean;
|
|
40
|
-
}[];
|
|
41
|
-
/**
|
|
42
|
-
* Check if a text range is already wrapped (Updated to handle paragraph breaks)
|
|
43
|
-
*/
|
|
44
|
-
static isRangeAlreadyWrapped(root: LexicalNode, fromPos: number, toPos: number, annotationId: string): boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Find the paragraph parent of a text node.
|
|
47
|
-
* Traverses up the node hierarchy to find the paragraph element that contains this text node.
|
|
48
|
-
*
|
|
49
|
-
* @param node - The text node to find the paragraph parent for
|
|
50
|
-
* @returns The paragraph node or null if not found
|
|
51
|
-
*/
|
|
52
|
-
static findParagraphParent(node: TextNode): LexicalNode | null;
|
|
53
|
-
/**
|
|
54
|
-
* Get text content for a specific container
|
|
55
|
-
*/
|
|
56
|
-
static getContainerTextContent(containerElement: HTMLElement, editor: LexicalEditor, nodeMap: {
|
|
57
|
-
node: TextNode | null;
|
|
58
|
-
start: number;
|
|
59
|
-
end: number;
|
|
60
|
-
isParagraphBreak?: boolean;
|
|
61
|
-
}[], combinedText: string): {
|
|
62
|
-
text: string;
|
|
63
|
-
startOffset: number;
|
|
64
|
-
} | null;
|
|
65
|
-
/**
|
|
66
|
-
* Find common parent element with ID that contains both nodes
|
|
67
|
-
*/
|
|
68
|
-
static findCommonParentWithId(node1: HTMLElement, node2: HTMLElement, editorElement: HTMLElement): HTMLElement | null;
|
|
69
|
-
/**
|
|
70
|
-
* Helper method to find container with ID (fallback)
|
|
71
|
-
*/
|
|
72
|
-
static findContainerWithId(startNode: HTMLElement, editorElement: HTMLElement): HTMLElement | null;
|
|
73
|
-
/**
|
|
74
|
-
* Get the text range of current selection, accounting for paragraph breaks.
|
|
75
|
-
* This method maps Lexical selection positions to text offsets in the combined text
|
|
76
|
-
* representation that includes newline characters between paragraphs.
|
|
77
|
-
*
|
|
78
|
-
* @param editor - The Lexical editor instance
|
|
79
|
-
* @param selection - The current range selection
|
|
80
|
-
* @returns Object with start and end positions in the combined text
|
|
81
|
-
*/
|
|
82
|
-
static getSelectionTextRange(editor: LexicalEditor, selection: RangeSelection): {
|
|
83
|
-
start: number;
|
|
84
|
-
end: number;
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Wrap a partial text node (when selection is within the node) - PRESERVING FORMATTING
|
|
88
|
-
*/
|
|
89
|
-
static wrapPartialTextNode(textNode: TextNode, startOffset: number, endOffset: number, commentNode: CommentNode): void;
|
|
90
|
-
/**
|
|
91
|
-
* Wrap an entire text node - PRESERVING FORMATTING
|
|
92
|
-
*/
|
|
93
|
-
static wrapEntireTextNode(textNode: TextNode, commentNode: CommentNode): void;
|
|
94
|
-
/**
|
|
95
|
-
* Wrap multiple text nodes while preserving formatting and paragraph structure.
|
|
96
|
-
* This method groups text nodes by their paragraph parent and creates separate
|
|
97
|
-
* comment nodes for each paragraph to maintain document structure integrity.
|
|
98
|
-
*
|
|
99
|
-
* @param textNodesToWrap - Array of text nodes with their offset information
|
|
100
|
-
* @param commentNode - The base comment node to use (additional nodes will be created for other paragraphs)
|
|
101
|
-
*/
|
|
102
|
-
static wrapMultipleTextNodesWithFormatting(textNodesToWrap: {
|
|
103
|
-
node: TextNode;
|
|
104
|
-
startOffset: number;
|
|
105
|
-
endOffset: number;
|
|
106
|
-
isPartial: boolean;
|
|
107
|
-
}[], commentNode: CommentNode): void;
|
|
108
|
-
/**
|
|
109
|
-
* Wrap multiple text nodes within the same paragraph.
|
|
110
|
-
* This method handles complex scenarios where multiple text nodes need to be wrapped
|
|
111
|
-
* while maintaining their original formatting and order within the paragraph.
|
|
112
|
-
*
|
|
113
|
-
* @param nodesInParagraph - Array of text nodes within the same paragraph
|
|
114
|
-
* @param commentNode - The comment node to wrap the text nodes with
|
|
115
|
-
*/
|
|
116
|
-
static wrapMultipleNodesInSameParagraph(nodesInParagraph: {
|
|
117
|
-
node: TextNode;
|
|
118
|
-
startOffset: number;
|
|
119
|
-
endOffset: number;
|
|
120
|
-
isPartial: boolean;
|
|
121
|
-
}[], commentNode: CommentNode): void;
|
|
122
|
-
}
|
package/esm/types/velt.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Location } from '@veltdev/types';
|
|
2
|
-
import type { CommentAnnotationContext } from './types';
|
|
3
|
-
export declare class VeltService {
|
|
4
|
-
static selectedCommentsMap: Map<string, boolean>;
|
|
5
|
-
static subscribers: Map<string, (selectedCommentsMap: Map<string, boolean>) => void>;
|
|
6
|
-
static isSubscribed: boolean;
|
|
7
|
-
static getCommentElement: () => import("@veltdev/types").CommentElement | null;
|
|
8
|
-
static addManualComment: ({ context, location, }: {
|
|
9
|
-
context: CommentAnnotationContext;
|
|
10
|
-
location?: Location | undefined;
|
|
11
|
-
}) => Promise<any>;
|
|
12
|
-
static updateContext: ({ annotationId, context, }: {
|
|
13
|
-
annotationId: string;
|
|
14
|
-
context: CommentAnnotationContext;
|
|
15
|
-
}) => Promise<any> | undefined;
|
|
16
|
-
static subscribeToSelectedCommentsMap: (id: string, subscriber: (selectedCommentsMap: Map<string, boolean>) => void) => void;
|
|
17
|
-
static unsubscribeFromSelectedCommentsMap: (id: string) => void;
|
|
18
|
-
static catchError: (message: string, otherProperties?: any) => void;
|
|
19
|
-
static subscribeToSelectedAnnotationsMapSingleton: () => Map<any, any> | undefined;
|
|
20
|
-
private static updateSelectedCommentsMap;
|
|
21
|
-
}
|