@lexical/yjs 0.36.2 → 0.36.3-nightly.20251003.0
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/Bindings.d.ts +22 -6
- package/CollabV2Mapping.d.ts +24 -0
- package/LexicalYjs.dev.js +993 -60
- package/LexicalYjs.dev.mjs +993 -63
- package/LexicalYjs.js.flow +1 -1
- package/LexicalYjs.mjs +4 -1
- package/LexicalYjs.node.mjs +4 -1
- package/LexicalYjs.prod.js +1 -1
- package/LexicalYjs.prod.mjs +1 -1
- package/SyncCursors.d.ts +15 -6
- package/SyncEditorStates.d.ts +5 -1
- package/SyncV2.d.ts +14 -0
- package/Utils.d.ts +7 -3
- package/index.d.ts +6 -6
- package/package.json +4 -4
package/Bindings.d.ts
CHANGED
|
@@ -11,22 +11,38 @@ import type { CollabLineBreakNode } from './CollabLineBreakNode';
|
|
|
11
11
|
import type { CollabTextNode } from './CollabTextNode';
|
|
12
12
|
import type { Cursor } from './SyncCursors';
|
|
13
13
|
import type { LexicalEditor, NodeKey } from 'lexical';
|
|
14
|
-
import type { Doc } from 'yjs';
|
|
15
14
|
import { Klass, LexicalNode } from 'lexical';
|
|
15
|
+
import { Doc, XmlElement } from 'yjs';
|
|
16
16
|
import { Provider } from '.';
|
|
17
|
+
import { CollabV2Mapping } from './CollabV2Mapping';
|
|
17
18
|
export type ClientID = number;
|
|
18
|
-
export
|
|
19
|
+
export interface BaseBinding {
|
|
19
20
|
clientID: number;
|
|
20
|
-
collabNodeMap: Map<NodeKey, CollabElementNode | CollabTextNode | CollabDecoratorNode | CollabLineBreakNode>;
|
|
21
21
|
cursors: Map<ClientID, Cursor>;
|
|
22
22
|
cursorsContainer: null | HTMLElement;
|
|
23
23
|
doc: Doc;
|
|
24
24
|
docMap: Map<string, Doc>;
|
|
25
25
|
editor: LexicalEditor;
|
|
26
26
|
id: string;
|
|
27
|
-
nodeProperties: Map<string,
|
|
28
|
-
|
|
27
|
+
nodeProperties: Map<string, {
|
|
28
|
+
[property: string]: unknown;
|
|
29
|
+
}>;
|
|
29
30
|
excludedProperties: ExcludedProperties;
|
|
30
|
-
}
|
|
31
|
+
}
|
|
32
|
+
export interface Binding extends BaseBinding {
|
|
33
|
+
collabNodeMap: Map<NodeKey, CollabElementNode | CollabTextNode | CollabDecoratorNode | CollabLineBreakNode>;
|
|
34
|
+
root: CollabElementNode;
|
|
35
|
+
}
|
|
36
|
+
export interface BindingV2 extends BaseBinding {
|
|
37
|
+
mapping: CollabV2Mapping;
|
|
38
|
+
root: XmlElement;
|
|
39
|
+
}
|
|
40
|
+
export type AnyBinding = Binding | BindingV2;
|
|
31
41
|
export type ExcludedProperties = Map<Klass<LexicalNode>, Set<string>>;
|
|
32
42
|
export declare function createBinding(editor: LexicalEditor, provider: Provider, id: string, doc: Doc | null | undefined, docMap: Map<string, Doc>, excludedProperties?: ExcludedProperties): Binding;
|
|
43
|
+
export declare function createBindingV2__EXPERIMENTAL(editor: LexicalEditor, id: string, doc: Doc | null | undefined, docMap: Map<string, Doc>, options?: {
|
|
44
|
+
excludedProperties?: ExcludedProperties;
|
|
45
|
+
rootName?: string;
|
|
46
|
+
}): BindingV2;
|
|
47
|
+
export declare function isBindingV1(binding: BaseBinding): binding is Binding;
|
|
48
|
+
export declare function isBindingV2(binding: BaseBinding): binding is BindingV2;
|
|
@@ -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
|
+
import { type LexicalNode, NodeKey, type TextNode } from 'lexical';
|
|
9
|
+
import { XmlElement, XmlText } from 'yjs';
|
|
10
|
+
type SharedType = XmlElement | XmlText;
|
|
11
|
+
export declare class CollabV2Mapping {
|
|
12
|
+
private _nodeMap;
|
|
13
|
+
private _sharedTypeToNodeKeys;
|
|
14
|
+
private _nodeKeyToSharedType;
|
|
15
|
+
set(sharedType: SharedType, node: LexicalNode | TextNode[]): void;
|
|
16
|
+
get(sharedType: XmlElement): LexicalNode | undefined;
|
|
17
|
+
get(sharedType: XmlText): TextNode[] | undefined;
|
|
18
|
+
get(sharedType: SharedType): LexicalNode | Array<TextNode> | undefined;
|
|
19
|
+
getSharedType(node: LexicalNode): SharedType | undefined;
|
|
20
|
+
delete(sharedType: SharedType): void;
|
|
21
|
+
deleteNode(nodeKey: NodeKey): void;
|
|
22
|
+
has(sharedType: SharedType): boolean;
|
|
23
|
+
}
|
|
24
|
+
export {};
|