@haklex/rich-collab-loro 0.45.0 → 0.46.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/dist/index.mjs CHANGED
@@ -30,7 +30,7 @@ function shallow(json) {
30
30
  return stable(withoutDerived(json));
31
31
  }
32
32
  function $serialize(node) {
33
- const json = node.exportJSON();
33
+ const json = node.getLatest().exportJSON();
34
34
  if ($isElementNode(node)) json.children = node.getChildren().map($serialize);
35
35
  return json;
36
36
  }
@@ -47,8 +47,7 @@ function lcs(a, b) {
47
47
  }
48
48
  function $updateInPlace(node, target) {
49
49
  const props = withoutDerived(target);
50
- node.updateFromJSON(props);
51
- return shallow(node.exportJSON()) === shallow(target);
50
+ return shallow(node.updateFromJSON(props).exportJSON()) === shallow(target);
52
51
  }
53
52
  function $update(node, current, target) {
54
53
  if ($isTextNode(node)) {
@@ -147,7 +146,7 @@ function sameValue(a, b) {
147
146
  return a === b || stable(a) === stable(b);
148
147
  }
149
148
  function nodeProps(node) {
150
- const { children: _children, ...props } = node.exportJSON();
149
+ const { children: _children, ...props } = node.getLatest().exportJSON();
151
150
  if ($isTextNode(node)) delete props.text;
152
151
  return props;
153
152
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-collab-loro",
3
- "version": "0.45.0",
3
+ "version": "0.46.0",
4
4
  "description": "Loro CRDT binding for Lexical — bidirectional LoroTree sync for real-time collaboration and history",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,17 +21,17 @@
21
21
  "src"
22
22
  ],
23
23
  "devDependencies": {
24
- "@lexical/headless": "^0.49.0",
25
- "lexical": "^0.49.0",
24
+ "@lexical/headless": "^0.52.0",
25
+ "lexical": "^0.52.0",
26
26
  "loro-crdt": "^1.16.3",
27
27
  "typescript": "^7.0.2",
28
28
  "unplugin-dts": "^1.0.3",
29
29
  "vite": "^8.2.2",
30
- "@haklex/rich-headless": "0.45.0",
31
- "@haklex/rich-litexml": "0.45.0"
30
+ "@haklex/rich-litexml": "0.46.0",
31
+ "@haklex/rich-headless": "0.46.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "lexical": "^0.49.0",
34
+ "lexical": "^0.52.0",
35
35
  "loro-crdt": "^1.16.0"
36
36
  },
37
37
  "publishConfig": {
package/src/binding.ts CHANGED
@@ -41,7 +41,7 @@ function sameValue(a: unknown, b: unknown): boolean {
41
41
  }
42
42
 
43
43
  function nodeProps(node: LexicalNode): Props {
44
- const { children: _children, ...props } = node.exportJSON() as Props;
44
+ const { children: _children, ...props } = node.getLatest().exportJSON() as Props;
45
45
  if ($isTextNode(node)) delete props.text;
46
46
  return props;
47
47
  }
package/src/reconcile.ts CHANGED
@@ -35,7 +35,7 @@ function shallow(json: Json): string {
35
35
  }
36
36
 
37
37
  function $serialize(node: LexicalNode): Json {
38
- const json = node.exportJSON() as Json;
38
+ const json = node.getLatest().exportJSON() as Json;
39
39
  if ($isElementNode(node)) json.children = node.getChildren().map($serialize);
40
40
  return json;
41
41
  }
@@ -64,8 +64,8 @@ export function lcs(a: string[], b: string[]): Array<[number, number]> {
64
64
  // inserted concurrently; update in place whenever the node class can absorb the change.
65
65
  export function $updateInPlace(node: LexicalNode, target: Json): boolean {
66
66
  const props = withoutDerived(target);
67
- node.updateFromJSON(props as never);
68
- return shallow(node.exportJSON() as Json) === shallow(target);
67
+ const updated = node.updateFromJSON(props as never);
68
+ return shallow(updated.exportJSON() as Json) === shallow(target);
69
69
  }
70
70
 
71
71
  function $update(node: LexicalNode, current: Json, target: Json): LexicalNode {