pulse-ui-client 0.1.26 → 0.1.28
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.bun.js +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/index.node.js +3 -3
- package/dist/renderer.d.ts +8 -15
- package/dist/vdom.d.ts +16 -31
- package/package.json +1 -1
package/dist/renderer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { type ComponentType } from "react";
|
|
2
|
-
import type { ComponentRegistry, VDOMNode, VDOMUpdate } from "./vdom";
|
|
2
|
+
import type { ComponentRegistry, VDOMNode, VDOMUpdate, PathDelta } from "./vdom";
|
|
3
3
|
import type { PulseSocketIOClient } from "./client";
|
|
4
4
|
export declare class VDOMRenderer {
|
|
5
5
|
private client;
|
|
@@ -10,29 +10,22 @@ export declare class VDOMRenderer {
|
|
|
10
10
|
private callbackCache;
|
|
11
11
|
private renderPropKeys;
|
|
12
12
|
private cssProps;
|
|
13
|
+
private callbackList;
|
|
13
14
|
constructor(client: PulseSocketIOClient, path: string, components: ComponentRegistry, cssModules: Record<string, Record<string, string>>, initialCallbacks?: string[], initialRenderProps?: string[], initialCssRefs?: string[]);
|
|
15
|
+
hasCallbackPath(path: string): boolean;
|
|
16
|
+
hasRenderPropPath(path: string): boolean;
|
|
17
|
+
hasAnyCallbackUnder(prefix: string): boolean;
|
|
14
18
|
setCallbacks(keys: string[]): void;
|
|
15
19
|
setRenderProps(keys: string[]): void;
|
|
16
20
|
setCssRefs(entries: string[]): void;
|
|
17
|
-
applyCallbackDelta(delta:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}): void;
|
|
21
|
-
applyRenderPropsDelta(delta: {
|
|
22
|
-
add?: string[];
|
|
23
|
-
remove?: string[];
|
|
24
|
-
}): void;
|
|
25
|
-
applyCssRefsDelta(delta: {
|
|
26
|
-
set?: string[];
|
|
27
|
-
remove?: string[];
|
|
28
|
-
}): void;
|
|
21
|
+
applyCallbackDelta(delta: PathDelta): void;
|
|
22
|
+
applyRenderPropsDelta(delta: PathDelta): void;
|
|
23
|
+
applyCssRefsDelta(delta: PathDelta): void;
|
|
29
24
|
getCallback(path: string, prop: string): Function;
|
|
30
25
|
renderNode(node: VDOMNode, currentPath?: string): React.ReactNode;
|
|
31
26
|
private propPath;
|
|
32
27
|
transformValue(path: string, key: string, value: any): any;
|
|
33
28
|
private resolveCssToken;
|
|
34
|
-
private updateCallbacksOnTree;
|
|
35
|
-
private setsEqual;
|
|
36
29
|
}
|
|
37
30
|
export declare function applyUpdates(initialTree: React.ReactNode, updates: VDOMUpdate[], renderer: VDOMRenderer): React.ReactNode;
|
|
38
31
|
export declare function RenderLazy(component: () => Promise<{
|
package/dist/vdom.d.ts
CHANGED
|
@@ -13,20 +13,9 @@ export interface VDOMElement {
|
|
|
13
13
|
export type PrimitiveNode = string | number | boolean;
|
|
14
14
|
export type VDOMNode = PrimitiveNode | VDOMElement;
|
|
15
15
|
export type VDOM = VDOMNode;
|
|
16
|
-
export type UpdateType = "insert" | "remove" | "replace" | "update_props" | "move" | "update_callbacks" | "update_render_props" | "update_css_refs";
|
|
17
16
|
export interface VDOMUpdateBase {
|
|
18
|
-
type:
|
|
17
|
+
type: string;
|
|
19
18
|
path: string;
|
|
20
|
-
data?: any;
|
|
21
|
-
}
|
|
22
|
-
export interface InsertUpdate extends VDOMUpdateBase {
|
|
23
|
-
type: "insert";
|
|
24
|
-
data: VDOMNode;
|
|
25
|
-
idx: number;
|
|
26
|
-
}
|
|
27
|
-
export interface RemoveUpdate extends VDOMUpdateBase {
|
|
28
|
-
type: "remove";
|
|
29
|
-
idx: number;
|
|
30
19
|
}
|
|
31
20
|
export interface ReplaceUpdate extends VDOMUpdateBase {
|
|
32
21
|
type: "replace";
|
|
@@ -39,35 +28,31 @@ export interface UpdatePropsUpdate extends VDOMUpdateBase {
|
|
|
39
28
|
remove?: string[];
|
|
40
29
|
};
|
|
41
30
|
}
|
|
42
|
-
export interface
|
|
43
|
-
type: "
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
31
|
+
export interface ReconciliationUpdate {
|
|
32
|
+
type: "reconciliation";
|
|
33
|
+
path: string;
|
|
34
|
+
N: number;
|
|
35
|
+
new: [number[], VDOM[]];
|
|
36
|
+
reuse: [number[], number[]];
|
|
37
|
+
}
|
|
38
|
+
export interface PathDelta {
|
|
39
|
+
add?: string[];
|
|
40
|
+
remove?: string[];
|
|
48
41
|
}
|
|
49
42
|
export interface UpdateCallbacksUpdate extends VDOMUpdateBase {
|
|
50
43
|
type: "update_callbacks";
|
|
51
|
-
data:
|
|
52
|
-
add?: string[];
|
|
53
|
-
remove?: string[];
|
|
54
|
-
};
|
|
44
|
+
data: PathDelta;
|
|
55
45
|
}
|
|
56
46
|
export interface UpdateRenderPropsUpdate extends VDOMUpdateBase {
|
|
57
47
|
type: "update_render_props";
|
|
58
|
-
data:
|
|
59
|
-
add?: string[];
|
|
60
|
-
remove?: string[];
|
|
61
|
-
};
|
|
48
|
+
data: PathDelta;
|
|
62
49
|
}
|
|
63
50
|
export interface UpdateCssRefsUpdate extends VDOMUpdateBase {
|
|
64
51
|
type: "update_css_refs";
|
|
65
|
-
data:
|
|
66
|
-
set?: string[];
|
|
67
|
-
remove?: string[];
|
|
68
|
-
};
|
|
52
|
+
data: PathDelta;
|
|
69
53
|
}
|
|
70
|
-
export type VDOMUpdate =
|
|
54
|
+
export type VDOMUpdate = ReplaceUpdate | UpdatePropsUpdate | ReconciliationUpdate | UpdateCallbacksUpdate | UpdateRenderPropsUpdate | UpdateCssRefsUpdate;
|
|
55
|
+
export type UpdateType = VDOMUpdate["type"];
|
|
71
56
|
export declare function isElementNode(node: VDOMNode): node is VDOMElement;
|
|
72
57
|
export declare function isMountPointNode(node: VDOMNode): node is VDOMElement;
|
|
73
58
|
export declare function isTextNode(node: VDOMNode): node is string;
|