@lvce-editor/virtual-dom-worker 6.10.0 → 7.0.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.
Files changed (36) hide show
  1. package/dist/index.d.ts +1 -81
  2. package/dist/parts/AddPatch/AddPatch.d.ts +5 -0
  3. package/dist/parts/ApplyPendingPatches/ApplyPendingPatches.d.ts +2 -0
  4. package/dist/parts/AriaLive/AriaLive.d.ts +1 -0
  5. package/dist/parts/AttributePatch/AttributePatch.d.ts +5 -0
  6. package/dist/parts/DomEventListener/DomEventListener.d.ts +6 -0
  7. package/dist/parts/GetKeys/GetKeys.d.ts +2 -0
  8. package/dist/parts/GetTotalChildCount/GetTotalChildCount.d.ts +2 -0
  9. package/dist/parts/IsKey/IsKey.d.ts +1 -0
  10. package/dist/parts/Main/Main.d.ts +8 -0
  11. package/dist/parts/MergeClassNames/MergeClassNames.d.ts +1 -0
  12. package/dist/parts/NavigateChildPatch/NavigateChildPatch.d.ts +4 -0
  13. package/dist/parts/NavigateParentPatch/NavigateParentPatch.d.ts +3 -0
  14. package/dist/parts/NavigateSiblingPatch/NavigateSiblingPatch.d.ts +4 -0
  15. package/dist/parts/Patch/Patch.d.ts +12 -0
  16. package/dist/parts/PatchType/PatchType.d.ts +11 -0
  17. package/dist/parts/PatchType/PatchType.js +1 -0
  18. package/dist/parts/Px/Px.d.ts +2 -0
  19. package/dist/parts/RemoveAttributePatch/RemoveAttributePatch.d.ts +4 -0
  20. package/dist/parts/RemoveChildPatch/RemoveChildPatch.d.ts +4 -0
  21. package/dist/parts/RemovePatch/RemovePatch.d.ts +4 -0
  22. package/dist/parts/ReplacePatch/ReplacePatch.d.ts +5 -0
  23. package/dist/parts/SetReferenceNodeUidPatch/SetReferenceNodeUidPatch.d.ts +4 -0
  24. package/dist/parts/SetReferenceNodeUidPatch/SetReferenceNodeUidPatch.js +1 -0
  25. package/dist/parts/Text/Text.d.ts +2 -0
  26. package/dist/parts/TextPatch/TextPatch.d.ts +4 -0
  27. package/dist/parts/VirtualDomDiff/VirtualDomDiff.d.ts +3 -0
  28. package/dist/parts/VirtualDomDiffTree/CompareNodes.d.ts +3 -0
  29. package/dist/parts/VirtualDomDiffTree/CompareNodes.js +10 -0
  30. package/dist/parts/VirtualDomDiffTree/DiffTrees.d.ts +3 -0
  31. package/dist/parts/VirtualDomDiffTree/RemoveTrailingNavigationPatches.d.ts +2 -0
  32. package/dist/parts/VirtualDomDiffTree/TreeToArray.d.ts +3 -0
  33. package/dist/parts/VirtualDomDiffTree/VirtualDomDiffTree.d.ts +3 -0
  34. package/dist/parts/VirtualDomNode/VirtualDomNode.d.ts +4 -0
  35. package/dist/parts/VirtualDomTree/VirtualDomTree.d.ts +6 -0
  36. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,81 +1 @@
1
- // Generated by dts-bundle-generator v9.5.1
2
-
3
- export { AriaRoles, ClassNames, InputEventType, KeyCode, KeyModifier, MouseEventType, VirtualDomElements, WhenExpression } from './parts/Main/Main.ts';
4
- import { AriaRoles, ClassNames, InputEventType, KeyCode, KeyModifier, MouseEventType, VirtualDomElements, WhenExpression } from '@lvce-editor/constants';
5
-
6
- declare const Polite = "polite";
7
- export interface DomEventListener {
8
- readonly name: string | number;
9
- readonly params: readonly (string | number)[];
10
- readonly passive?: boolean;
11
- readonly preventDefault?: boolean;
12
- }
13
- export declare const mergeClassNames: (...classNames: readonly string[]) => string;
14
- export declare const px: (value: number) => string;
15
- export declare const position: (x: number, y: number) => string;
16
- export interface VirtualDomNode {
17
- readonly [key: string]: any;
18
- readonly type: number;
19
- }
20
- export declare const text: (data: string) => VirtualDomNode;
21
- export interface AddPatch {
22
- readonly nodes: readonly VirtualDomNode[];
23
- readonly type: 6;
24
- }
25
- export interface AttributePatch {
26
- readonly key: string;
27
- readonly type: 3;
28
- readonly value: any;
29
- }
30
- export type NavigateChildPatch = {
31
- readonly type: 7;
32
- readonly index: number;
33
- };
34
- export type NavigateParentPatch = {
35
- readonly type: 8;
36
- };
37
- export type NavigateSiblingPatch = {
38
- readonly type: 10;
39
- readonly index: number;
40
- };
41
- export interface RemoveAttributePatch {
42
- readonly key: string;
43
- readonly type: 4;
44
- }
45
- export interface RemoveChildPatch {
46
- readonly index: number;
47
- readonly type: 9;
48
- }
49
- export interface RemovePatch {
50
- readonly index: number;
51
- readonly type: 5;
52
- }
53
- export interface ReplacePatch {
54
- readonly nodes: readonly VirtualDomNode[];
55
- readonly type: 2;
56
- }
57
- export interface TextPatch {
58
- readonly type: 1;
59
- readonly value: string;
60
- }
61
- export type Patch = TextPatch | AttributePatch | ReplacePatch | RemoveAttributePatch | RemovePatch | AddPatch | NavigateChildPatch | NavigateParentPatch | RemoveChildPatch | NavigateSiblingPatch;
62
- export declare const diff: (oldNodes: readonly VirtualDomNode[], newNodes: readonly VirtualDomNode[]) => readonly Patch[];
63
- export declare const diffTree: (oldNodes: readonly VirtualDomNode[], newNodes: readonly VirtualDomNode[]) => readonly Patch[];
64
-
65
- declare namespace AriaLive {
66
- export { Polite };
67
- }
68
-
69
- export {
70
- AriaLive,
71
- AriaRoles,
72
- ClassNames,
73
- InputEventType,
74
- KeyCode,
75
- KeyModifier,
76
- MouseEventType,
77
- VirtualDomElements,
78
- WhenExpression,
79
- };
80
-
81
- export {};
1
+ export * from './parts/Main/Main.ts';
@@ -0,0 +1,5 @@
1
+ import type { VirtualDomNode } from '../VirtualDomNode/VirtualDomNode.ts';
2
+ export interface AddPatch {
3
+ readonly nodes: readonly VirtualDomNode[];
4
+ readonly type: 6;
5
+ }
@@ -0,0 +1,2 @@
1
+ import type { Patch } from '../Patch/Patch.ts';
2
+ export declare const applyPendingPatches: (patches: Patch[], pendingPatches: number[], skip: number) => void;
@@ -0,0 +1 @@
1
+ export declare const Polite = "polite";
@@ -0,0 +1,5 @@
1
+ export interface AttributePatch {
2
+ readonly key: string;
3
+ readonly type: 3;
4
+ readonly value: any;
5
+ }
@@ -0,0 +1,6 @@
1
+ export interface DomEventListener {
2
+ readonly name: string | number;
3
+ readonly params: readonly (string | number)[];
4
+ readonly passive?: boolean;
5
+ readonly preventDefault?: boolean;
6
+ }
@@ -0,0 +1,2 @@
1
+ import type { VirtualDomNode } from '../VirtualDomNode/VirtualDomNode.ts';
2
+ export declare const getKeys: (node: VirtualDomNode) => readonly string[];
@@ -0,0 +1,2 @@
1
+ import type { VirtualDomNode } from '../VirtualDomNode/VirtualDomNode.ts';
2
+ export declare const getTotalChildCount: (nodes: readonly VirtualDomNode[], index: number) => number;
@@ -0,0 +1 @@
1
+ export declare const isKey: (key: string) => boolean;
@@ -0,0 +1,8 @@
1
+ export { AriaRoles, ClassNames, InputEventType, KeyCode, KeyModifier, MouseEventType, VirtualDomElements, WhenExpression, } from '@lvce-editor/constants';
2
+ export * as AriaLive from '../AriaLive/AriaLive.ts';
3
+ export type * from '../DomEventListener/DomEventListener.ts';
4
+ export * from '../MergeClassNames/MergeClassNames.ts';
5
+ export * from '../Px/Px.ts';
6
+ export * from '../Text/Text.ts';
7
+ export { diff } from '../VirtualDomDiff/VirtualDomDiff.ts';
8
+ export { diffTree } from '../VirtualDomDiffTree/VirtualDomDiffTree.ts';
@@ -0,0 +1 @@
1
+ export declare const mergeClassNames: (...classNames: readonly string[]) => string;
@@ -0,0 +1,4 @@
1
+ export type NavigateChildPatch = {
2
+ readonly type: 7;
3
+ readonly index: number;
4
+ };
@@ -0,0 +1,3 @@
1
+ export type NavigateParentPatch = {
2
+ readonly type: 8;
3
+ };
@@ -0,0 +1,4 @@
1
+ export type NavigateSiblingPatch = {
2
+ readonly type: 10;
3
+ readonly index: number;
4
+ };
@@ -0,0 +1,12 @@
1
+ import type { AddPatch } from '../AddPatch/AddPatch.ts';
2
+ import type { AttributePatch } from '../AttributePatch/AttributePatch.ts';
3
+ import type { NavigateChildPatch } from '../NavigateChildPatch/NavigateChildPatch.ts';
4
+ import type { NavigateParentPatch } from '../NavigateParentPatch/NavigateParentPatch.ts';
5
+ import type { NavigateSiblingPatch } from '../NavigateSiblingPatch/NavigateSiblingPatch.ts';
6
+ import type { RemoveAttributePatch } from '../RemoveAttributePatch/RemoveAttributePatch.ts';
7
+ import type { RemoveChildPatch } from '../RemoveChildPatch/RemoveChildPatch.ts';
8
+ import type { RemovePatch } from '../RemovePatch/RemovePatch.ts';
9
+ import type { ReplacePatch } from '../ReplacePatch/ReplacePatch.ts';
10
+ import type { SetReferenceNodeUidPatch } from '../SetReferenceNodeUidPatch/SetReferenceNodeUidPatch.ts';
11
+ import type { TextPatch } from '../TextPatch/TextPatch.ts';
12
+ export type Patch = TextPatch | AttributePatch | ReplacePatch | RemoveAttributePatch | RemovePatch | AddPatch | NavigateChildPatch | NavigateParentPatch | RemoveChildPatch | NavigateSiblingPatch | SetReferenceNodeUidPatch;
@@ -0,0 +1,11 @@
1
+ export declare const SetText = 1;
2
+ export declare const Replace = 2;
3
+ export declare const SetAttribute = 3;
4
+ export declare const RemoveAttribute = 4;
5
+ export declare const Remove = 5;
6
+ export declare const Add = 6;
7
+ export declare const NavigateChild = 7;
8
+ export declare const NavigateParent = 8;
9
+ export declare const RemoveChild = 9;
10
+ export declare const NavigateSibling = 10;
11
+ export declare const SetReferenceNodeUid = 11;
@@ -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;
@@ -0,0 +1,2 @@
1
+ export declare const px: (value: number) => string;
2
+ export declare const position: (x: number, y: number) => string;
@@ -0,0 +1,4 @@
1
+ export interface RemoveAttributePatch {
2
+ readonly key: string;
3
+ readonly type: 4;
4
+ }
@@ -0,0 +1,4 @@
1
+ export interface RemoveChildPatch {
2
+ readonly index: number;
3
+ readonly type: 9;
4
+ }
@@ -0,0 +1,4 @@
1
+ export interface RemovePatch {
2
+ readonly index: number;
3
+ readonly type: 5;
4
+ }
@@ -0,0 +1,5 @@
1
+ import type { VirtualDomNode } from '../VirtualDomNode/VirtualDomNode.ts';
2
+ export interface ReplacePatch {
3
+ readonly nodes: readonly VirtualDomNode[];
4
+ readonly type: 2;
5
+ }
@@ -0,0 +1,4 @@
1
+ export interface SetReferenceNodeUidPatch {
2
+ readonly type: 11;
3
+ readonly uid: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ import type { VirtualDomNode } from '../VirtualDomNode/VirtualDomNode.ts';
2
+ export declare const text: (data: string) => VirtualDomNode;
@@ -0,0 +1,4 @@
1
+ export interface TextPatch {
2
+ readonly type: 1;
3
+ readonly value: string;
4
+ }
@@ -0,0 +1,3 @@
1
+ import type { Patch } from '../Patch/Patch.ts';
2
+ import type { VirtualDomNode } from '../VirtualDomNode/VirtualDomNode.ts';
3
+ export declare const diff: (oldNodes: readonly VirtualDomNode[], newNodes: readonly VirtualDomNode[]) => readonly Patch[];
@@ -0,0 +1,3 @@
1
+ import type { Patch } from '../Patch/Patch.ts';
2
+ import type { VirtualDomNode } from '../VirtualDomNode/VirtualDomNode.ts';
3
+ export declare const compareNodes: (oldNode: VirtualDomNode, newNode: VirtualDomNode) => Patch[] | null;
@@ -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) {
@@ -0,0 +1,3 @@
1
+ import type { Patch } from '../Patch/Patch.ts';
2
+ import type * as VirtualDomTree from '../VirtualDomTree/VirtualDomTree.ts';
3
+ export declare const diffTrees: (oldTree: readonly VirtualDomTree.VirtualDomTreeNode[], newTree: readonly VirtualDomTree.VirtualDomTreeNode[], patches: Patch[], path: number[]) => void;
@@ -0,0 +1,2 @@
1
+ import type { Patch } from '../Patch/Patch.ts';
2
+ export declare const removeTrailingNavigationPatches: (patches: Patch[]) => Patch[];
@@ -0,0 +1,3 @@
1
+ import type { VirtualDomNode } from '../VirtualDomNode/VirtualDomNode.ts';
2
+ import type { VirtualDomTreeNode } from '../VirtualDomTree/VirtualDomTree.ts';
3
+ export declare const treeToArray: (node: VirtualDomTreeNode) => readonly VirtualDomNode[];
@@ -0,0 +1,3 @@
1
+ import type { Patch } from '../Patch/Patch.ts';
2
+ import type { VirtualDomNode } from '../VirtualDomNode/VirtualDomNode.ts';
3
+ export declare const diffTree: (oldNodes: readonly VirtualDomNode[], newNodes: readonly VirtualDomNode[]) => readonly Patch[];
@@ -0,0 +1,4 @@
1
+ export interface VirtualDomNode {
2
+ readonly [key: string]: any;
3
+ readonly type: number;
4
+ }
@@ -0,0 +1,6 @@
1
+ import type { VirtualDomNode } from '../VirtualDomNode/VirtualDomNode.ts';
2
+ export interface VirtualDomTreeNode {
3
+ readonly children: readonly VirtualDomTreeNode[];
4
+ readonly node: VirtualDomNode;
5
+ }
6
+ export declare const arrayToTree: (nodes: readonly VirtualDomNode[]) => readonly VirtualDomTreeNode[];
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": "7.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lvce-editor/virtual-dom.git"