@mml-io/networked-dom-protocol 0.0.42
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/build/index.d.ts +1 -0
- package/build/index.js +18 -0
- package/build/index.js.map +7 -0
- package/package.json +18 -0
- package/src/index.ts +1 -0
- package/src/networked-dom-v0.1/from-client.ts +14 -0
- package/src/networked-dom-v0.1/from-server.ts +66 -0
- package/src/networked-dom-v0.1/index.ts +2 -0
package/build/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../src/index";
|
package/build/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/index.ts
|
|
16
|
+
var src_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(src_exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mml-io/networked-dom-protocol",
|
|
3
|
+
"version": "0.0.42",
|
|
4
|
+
"main": "./build/index.js",
|
|
5
|
+
"types": "./build/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"/build",
|
|
8
|
+
"/src"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"type-check": "tsc --noEmit",
|
|
12
|
+
"build": "node ./build.js --build",
|
|
13
|
+
"iterate": "node ./build.js --watch",
|
|
14
|
+
"npm-publish": "npm run build && publish-if-not-exists --access=public",
|
|
15
|
+
"lint": "eslint \"./src/**/*.{js,jsx,ts,tsx}\" --max-warnings 0",
|
|
16
|
+
"lint-fix": "eslint \"./src/**/*.{js,jsx,ts,tsx}\" --fix"
|
|
17
|
+
}
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./networked-dom-v0.1";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type ElementNodeDescription = {
|
|
2
|
+
type: "element";
|
|
3
|
+
nodeId: number;
|
|
4
|
+
tag: string;
|
|
5
|
+
attributes: { [key: string]: string };
|
|
6
|
+
children: Array<NodeDescription>;
|
|
7
|
+
text?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type TextNodeDescription = {
|
|
11
|
+
type: "text";
|
|
12
|
+
nodeId: number;
|
|
13
|
+
text: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type NodeDescription = ElementNodeDescription | TextNodeDescription;
|
|
17
|
+
|
|
18
|
+
export type SnapshotMessage = {
|
|
19
|
+
type: "snapshot";
|
|
20
|
+
snapshot: NodeDescription;
|
|
21
|
+
documentTime: number;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type ChildrenChangedDiff = {
|
|
25
|
+
type: "childrenChanged";
|
|
26
|
+
nodeId: number;
|
|
27
|
+
previousNodeId: number | null;
|
|
28
|
+
addedNodes: Array<NodeDescription>;
|
|
29
|
+
removedNodes: Array<number>;
|
|
30
|
+
documentTime?: number;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type TextChangedDiff = {
|
|
34
|
+
type: "textChanged";
|
|
35
|
+
nodeId: number;
|
|
36
|
+
text: string;
|
|
37
|
+
documentTime?: number;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type AttributeChangedDiff = {
|
|
41
|
+
type: "attributeChange";
|
|
42
|
+
nodeId: number;
|
|
43
|
+
attribute: string;
|
|
44
|
+
newValue: string | null;
|
|
45
|
+
documentTime?: number;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type Diff = ChildrenChangedDiff | AttributeChangedDiff | TextChangedDiff;
|
|
49
|
+
|
|
50
|
+
export type PingMessage = {
|
|
51
|
+
type: "ping";
|
|
52
|
+
ping: number;
|
|
53
|
+
documentTime: number;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type ErrorMessage = {
|
|
57
|
+
type: "error";
|
|
58
|
+
message: string;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type WarningMessage = {
|
|
62
|
+
type: "warning";
|
|
63
|
+
message: string;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export type ServerMessage = SnapshotMessage | Diff | PingMessage | ErrorMessage | WarningMessage;
|