@lvce-editor/virtual-dom-worker 6.10.0 → 6.11.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.d.ts CHANGED
@@ -54,11 +54,15 @@ export interface ReplacePatch {
54
54
  readonly nodes: readonly VirtualDomNode[];
55
55
  readonly type: 2;
56
56
  }
57
+ export interface SetReferenceNodeUidPatch {
58
+ readonly type: 11;
59
+ readonly uid: string;
60
+ }
57
61
  export interface TextPatch {
58
62
  readonly type: 1;
59
63
  readonly value: string;
60
64
  }
61
- export type Patch = TextPatch | AttributePatch | ReplacePatch | RemoveAttributePatch | RemovePatch | AddPatch | NavigateChildPatch | NavigateParentPatch | RemoveChildPatch | NavigateSiblingPatch;
65
+ export type Patch = TextPatch | AttributePatch | ReplacePatch | RemoveAttributePatch | RemovePatch | AddPatch | NavigateChildPatch | NavigateParentPatch | RemoveChildPatch | NavigateSiblingPatch | SetReferenceNodeUidPatch;
62
66
  export declare const diff: (oldNodes: readonly VirtualDomNode[], newNodes: readonly VirtualDomNode[]) => readonly Patch[];
63
67
  export declare const diffTree: (oldNodes: readonly VirtualDomNode[], newNodes: readonly VirtualDomNode[]) => readonly Patch[];
64
68
 
@@ -8,3 +8,4 @@ export const NavigateChild = 7;
8
8
  export const NavigateParent = 8;
9
9
  export const RemoveChild = 9;
10
10
  export const NavigateSibling = 10;
11
+ export const SetReferenceNodeUid = 11;
@@ -8,6 +8,16 @@ export const compareNodes = (oldNode, newNode) => {
8
8
  if (oldNode.type !== newNode.type) {
9
9
  return null;
10
10
  }
11
+ // Handle reference nodes - special handling for uid changes
12
+ if (oldNode.type === VirtualDomElements.Reference) {
13
+ if (oldNode.uid !== newNode.uid) {
14
+ patches.push({
15
+ type: PatchType.SetReferenceNodeUid,
16
+ uid: newNode.uid,
17
+ });
18
+ }
19
+ return patches;
20
+ }
11
21
  // Handle text nodes
12
22
  if (oldNode.type === VirtualDomElements.Text &&
13
23
  newNode.type === VirtualDomElements.Text) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/virtual-dom-worker",
3
- "version": "6.10.0",
3
+ "version": "6.11.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lvce-editor/virtual-dom.git"