@inditextech/weave-store-standalone 0.77.0 → 1.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.
- package/package.json +4 -3
- package/dist/client.cjs +0 -98
- package/dist/client.d.cts +0 -53
- package/dist/server.cjs +0 -98
- package/dist/server.d.cts +0 -53
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inditextech/weave-store-standalone",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"link": "npm link",
|
|
40
40
|
"lint:fix": "npm run lint -- --fix",
|
|
41
41
|
"lint": "eslint ./src",
|
|
42
|
+
"pack": "npm pack",
|
|
42
43
|
"publish:snapshot": "npm publish",
|
|
43
44
|
"release:perform": "npm publish --access public",
|
|
44
45
|
"release:prepare": "npm run verify",
|
|
@@ -50,11 +51,11 @@
|
|
|
50
51
|
},
|
|
51
52
|
"dependencies": {
|
|
52
53
|
"@syncedstore/core": "0.6.0",
|
|
53
|
-
"konva": "
|
|
54
|
+
"konva": "10.0.2",
|
|
54
55
|
"yjs": "13.6.27"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
|
-
"@inditextech/weave-sdk": "0.
|
|
58
|
+
"@inditextech/weave-sdk": "1.0.0",
|
|
58
59
|
"@types/lodash.debounce": "^4.0.9",
|
|
59
60
|
"@types/node": "^22.15.3",
|
|
60
61
|
"@typescript-eslint/eslint-plugin": "8.26.0",
|
package/dist/client.cjs
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//#region rolldown:runtime
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
-
get: ((k) => from[k]).bind(null, key),
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
-
value: mod,
|
|
21
|
-
enumerable: true
|
|
22
|
-
}) : target, mod));
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
const yjs = __toESM(require("yjs"));
|
|
26
|
-
const __inditextech_weave_sdk = __toESM(require("@inditextech/weave-sdk"));
|
|
27
|
-
require("konva");
|
|
28
|
-
|
|
29
|
-
//#region ../types/dist/types.js
|
|
30
|
-
const WEAVE_TRANSFORMER_ANCHORS = {
|
|
31
|
-
["TOP_LEFT"]: "top-left",
|
|
32
|
-
["TOP_CENTER"]: "top-center",
|
|
33
|
-
["TOP_RIGHT"]: "top-right",
|
|
34
|
-
["MIDDLE_RIGHT"]: "middle-right",
|
|
35
|
-
["MIDDLE_LEFT"]: "middle-left",
|
|
36
|
-
["BOTTOM_LEFT"]: "bottom-left",
|
|
37
|
-
["BOTTOM_CENTER"]: "bottom-center",
|
|
38
|
-
["BOTTOM_RIGHT"]: "bottom-right"
|
|
39
|
-
};
|
|
40
|
-
const WEAVE_DEFAULT_ENABLED_ANCHORS = Object.values(WEAVE_TRANSFORMER_ANCHORS);
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/constants.ts
|
|
44
|
-
const WEAVE_STORE_STANDALONE = "store-standalone";
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region src/default-initial-state.ts
|
|
48
|
-
const yjsLayer = function(id) {
|
|
49
|
-
const newLayerMap = new yjs.Map();
|
|
50
|
-
newLayerMap.set("key", id);
|
|
51
|
-
newLayerMap.set("type", "layer");
|
|
52
|
-
const newLayerMapProps = new yjs.Map();
|
|
53
|
-
newLayerMapProps.set("id", id);
|
|
54
|
-
newLayerMapProps.set("nodeType", "layer");
|
|
55
|
-
newLayerMapProps.set("children", new yjs.Array());
|
|
56
|
-
newLayerMap.set("props", newLayerMapProps);
|
|
57
|
-
return newLayerMap;
|
|
58
|
-
};
|
|
59
|
-
function defaultInitialState(doc) {
|
|
60
|
-
const children = new yjs.Array();
|
|
61
|
-
children.insert(0, [
|
|
62
|
-
yjsLayer("gridLayer"),
|
|
63
|
-
yjsLayer("mainLayer"),
|
|
64
|
-
yjsLayer("selectionLayer"),
|
|
65
|
-
yjsLayer("usersPointersLayer"),
|
|
66
|
-
yjsLayer("utilityLayer")
|
|
67
|
-
]);
|
|
68
|
-
const stageProps = new yjs.Map();
|
|
69
|
-
stageProps.set("id", "stage");
|
|
70
|
-
stageProps.set("children", children);
|
|
71
|
-
doc.getMap("weave").set("key", "stage");
|
|
72
|
-
doc.getMap("weave").set("type", "stage");
|
|
73
|
-
doc.getMap("weave").set("props", stageProps);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region src/store-standalone.ts
|
|
78
|
-
var WeaveStoreStandalone = class extends __inditextech_weave_sdk.WeaveStore {
|
|
79
|
-
name = WEAVE_STORE_STANDALONE;
|
|
80
|
-
supportsUndoManager = true;
|
|
81
|
-
constructor({ roomData, initialState }, storeOptions) {
|
|
82
|
-
super(storeOptions);
|
|
83
|
-
this.roomData = roomData;
|
|
84
|
-
this.initialState = initialState ?? defaultInitialState;
|
|
85
|
-
}
|
|
86
|
-
async connect() {
|
|
87
|
-
const roomDataSnapshot = Buffer.from(this.roomData, "base64");
|
|
88
|
-
if (roomDataSnapshot) yjs.applyUpdate(this.getDocument(), roomDataSnapshot);
|
|
89
|
-
else this.initialState(this.getDocument());
|
|
90
|
-
}
|
|
91
|
-
disconnect() {}
|
|
92
|
-
handleAwarenessChange() {}
|
|
93
|
-
setAwarenessInfo() {}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
//#endregion
|
|
97
|
-
exports.WEAVE_STORE_STANDALONE = WEAVE_STORE_STANDALONE
|
|
98
|
-
exports.WeaveStoreStandalone = WeaveStoreStandalone
|
package/dist/client.d.cts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { WeaveStore } from "@inditextech/weave-sdk";
|
|
2
|
-
import "konva";
|
|
3
|
-
import * as Y from "yjs";
|
|
4
|
-
import "konva/lib/types";
|
|
5
|
-
|
|
6
|
-
//#region ../types/dist/types.d.ts
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/base/store.d.ts
|
|
10
|
-
type WeaveStoreOptions = {
|
|
11
|
-
getUser: () => WeaveUser;
|
|
12
|
-
undoManagerOptions?: WeaveUndoManagerOptions;
|
|
13
|
-
};
|
|
14
|
-
type WeaveUser = {
|
|
15
|
-
id: string;
|
|
16
|
-
name: string;
|
|
17
|
-
email: string;
|
|
18
|
-
[key: string]: any;
|
|
19
|
-
};
|
|
20
|
-
type WeaveUndoManagerOptions = {
|
|
21
|
-
captureTimeout?: number;
|
|
22
|
-
trackedOrigins?: Set<any>;
|
|
23
|
-
}; //#endregion
|
|
24
|
-
//#region src/types.d.ts
|
|
25
|
-
type FetchInitialState = (doc: Y.Doc) => void;
|
|
26
|
-
type WeaveStoreStandaloneParams = {
|
|
27
|
-
roomData: string;
|
|
28
|
-
initialState?: FetchInitialState;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/store-standalone.d.ts
|
|
33
|
-
declare class WeaveStoreStandalone extends WeaveStore {
|
|
34
|
-
private roomData;
|
|
35
|
-
private initialState;
|
|
36
|
-
protected name: string;
|
|
37
|
-
protected supportsUndoManager: boolean;
|
|
38
|
-
constructor({
|
|
39
|
-
roomData,
|
|
40
|
-
initialState
|
|
41
|
-
}: WeaveStoreStandaloneParams, storeOptions: WeaveStoreOptions);
|
|
42
|
-
connect(): Promise<void>;
|
|
43
|
-
disconnect(): void;
|
|
44
|
-
handleAwarenessChange(): void;
|
|
45
|
-
setAwarenessInfo(): void;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/constants.d.ts
|
|
50
|
-
declare const WEAVE_STORE_STANDALONE = "store-standalone";
|
|
51
|
-
|
|
52
|
-
//#endregion
|
|
53
|
-
export { FetchInitialState, WEAVE_STORE_STANDALONE, WeaveStoreStandalone, WeaveStoreStandaloneParams };
|
package/dist/server.cjs
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//#region rolldown:runtime
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
-
get: ((k) => from[k]).bind(null, key),
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
-
value: mod,
|
|
21
|
-
enumerable: true
|
|
22
|
-
}) : target, mod));
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
const yjs = __toESM(require("yjs"));
|
|
26
|
-
const __inditextech_weave_sdk = __toESM(require("@inditextech/weave-sdk"));
|
|
27
|
-
require("konva");
|
|
28
|
-
|
|
29
|
-
//#region ../types/dist/types.js
|
|
30
|
-
const WEAVE_TRANSFORMER_ANCHORS = {
|
|
31
|
-
["TOP_LEFT"]: "top-left",
|
|
32
|
-
["TOP_CENTER"]: "top-center",
|
|
33
|
-
["TOP_RIGHT"]: "top-right",
|
|
34
|
-
["MIDDLE_RIGHT"]: "middle-right",
|
|
35
|
-
["MIDDLE_LEFT"]: "middle-left",
|
|
36
|
-
["BOTTOM_LEFT"]: "bottom-left",
|
|
37
|
-
["BOTTOM_CENTER"]: "bottom-center",
|
|
38
|
-
["BOTTOM_RIGHT"]: "bottom-right"
|
|
39
|
-
};
|
|
40
|
-
const WEAVE_DEFAULT_ENABLED_ANCHORS = Object.values(WEAVE_TRANSFORMER_ANCHORS);
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/constants.ts
|
|
44
|
-
const WEAVE_STORE_STANDALONE = "store-standalone";
|
|
45
|
-
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region src/default-initial-state.ts
|
|
48
|
-
const yjsLayer = function(id) {
|
|
49
|
-
const newLayerMap = new yjs.Map();
|
|
50
|
-
newLayerMap.set("key", id);
|
|
51
|
-
newLayerMap.set("type", "layer");
|
|
52
|
-
const newLayerMapProps = new yjs.Map();
|
|
53
|
-
newLayerMapProps.set("id", id);
|
|
54
|
-
newLayerMapProps.set("nodeType", "layer");
|
|
55
|
-
newLayerMapProps.set("children", new yjs.Array());
|
|
56
|
-
newLayerMap.set("props", newLayerMapProps);
|
|
57
|
-
return newLayerMap;
|
|
58
|
-
};
|
|
59
|
-
function defaultInitialState(doc) {
|
|
60
|
-
const children = new yjs.Array();
|
|
61
|
-
children.insert(0, [
|
|
62
|
-
yjsLayer("gridLayer"),
|
|
63
|
-
yjsLayer("mainLayer"),
|
|
64
|
-
yjsLayer("selectionLayer"),
|
|
65
|
-
yjsLayer("usersPointersLayer"),
|
|
66
|
-
yjsLayer("utilityLayer")
|
|
67
|
-
]);
|
|
68
|
-
const stageProps = new yjs.Map();
|
|
69
|
-
stageProps.set("id", "stage");
|
|
70
|
-
stageProps.set("children", children);
|
|
71
|
-
doc.getMap("weave").set("key", "stage");
|
|
72
|
-
doc.getMap("weave").set("type", "stage");
|
|
73
|
-
doc.getMap("weave").set("props", stageProps);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region src/store-standalone.ts
|
|
78
|
-
var WeaveStoreStandalone = class extends __inditextech_weave_sdk.WeaveStore {
|
|
79
|
-
name = WEAVE_STORE_STANDALONE;
|
|
80
|
-
supportsUndoManager = true;
|
|
81
|
-
constructor({ roomData, initialState }, storeOptions) {
|
|
82
|
-
super(storeOptions);
|
|
83
|
-
this.roomData = roomData;
|
|
84
|
-
this.initialState = initialState ?? defaultInitialState;
|
|
85
|
-
}
|
|
86
|
-
async connect() {
|
|
87
|
-
const roomDataSnapshot = Buffer.from(this.roomData, "base64");
|
|
88
|
-
if (roomDataSnapshot) yjs.applyUpdate(this.getDocument(), roomDataSnapshot);
|
|
89
|
-
else this.initialState(this.getDocument());
|
|
90
|
-
}
|
|
91
|
-
disconnect() {}
|
|
92
|
-
handleAwarenessChange() {}
|
|
93
|
-
setAwarenessInfo() {}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
//#endregion
|
|
97
|
-
exports.WEAVE_STORE_STANDALONE = WEAVE_STORE_STANDALONE
|
|
98
|
-
exports.WeaveStoreStandalone = WeaveStoreStandalone
|
package/dist/server.d.cts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { WeaveStore } from "@inditextech/weave-sdk";
|
|
2
|
-
import "konva";
|
|
3
|
-
import * as Y from "yjs";
|
|
4
|
-
import "konva/lib/types";
|
|
5
|
-
|
|
6
|
-
//#region ../types/dist/types.d.ts
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/base/store.d.ts
|
|
10
|
-
type WeaveStoreOptions = {
|
|
11
|
-
getUser: () => WeaveUser;
|
|
12
|
-
undoManagerOptions?: WeaveUndoManagerOptions;
|
|
13
|
-
};
|
|
14
|
-
type WeaveUser = {
|
|
15
|
-
id: string;
|
|
16
|
-
name: string;
|
|
17
|
-
email: string;
|
|
18
|
-
[key: string]: any;
|
|
19
|
-
};
|
|
20
|
-
type WeaveUndoManagerOptions = {
|
|
21
|
-
captureTimeout?: number;
|
|
22
|
-
trackedOrigins?: Set<any>;
|
|
23
|
-
}; //#endregion
|
|
24
|
-
//#region src/types.d.ts
|
|
25
|
-
type FetchInitialState = (doc: Y.Doc) => void;
|
|
26
|
-
type WeaveStoreStandaloneParams = {
|
|
27
|
-
roomData: string;
|
|
28
|
-
initialState?: FetchInitialState;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/store-standalone.d.ts
|
|
33
|
-
declare class WeaveStoreStandalone extends WeaveStore {
|
|
34
|
-
private roomData;
|
|
35
|
-
private initialState;
|
|
36
|
-
protected name: string;
|
|
37
|
-
protected supportsUndoManager: boolean;
|
|
38
|
-
constructor({
|
|
39
|
-
roomData,
|
|
40
|
-
initialState
|
|
41
|
-
}: WeaveStoreStandaloneParams, storeOptions: WeaveStoreOptions);
|
|
42
|
-
connect(): Promise<void>;
|
|
43
|
-
disconnect(): void;
|
|
44
|
-
handleAwarenessChange(): void;
|
|
45
|
-
setAwarenessInfo(): void;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/constants.d.ts
|
|
50
|
-
declare const WEAVE_STORE_STANDALONE = "store-standalone";
|
|
51
|
-
|
|
52
|
-
//#endregion
|
|
53
|
-
export { FetchInitialState, WEAVE_STORE_STANDALONE, WeaveStoreStandalone, WeaveStoreStandaloneParams };
|