@inditextech/weave-sdk 0.54.0 → 0.55.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/sdk.cjs +67 -56
- package/dist/sdk.d.cts +166 -160
- package/dist/sdk.d.cts.map +1 -1
- package/dist/sdk.d.ts +166 -160
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +80 -67
- package/dist/sdk.js.map +1 -1
- package/package.json +2 -2
package/dist/sdk.js
CHANGED
|
@@ -5884,7 +5884,7 @@ var require_lodash = __commonJS({ "../../node_modules/lodash/lodash.js"(exports,
|
|
|
5884
5884
|
* @returns {Function} Returns the new memoized function.
|
|
5885
5885
|
*/
|
|
5886
5886
|
function memoizeCapped(func) {
|
|
5887
|
-
var result$1 = memoize(func, function(key) {
|
|
5887
|
+
var result$1 = memoize$1(func, function(key) {
|
|
5888
5888
|
if (cache.size === MAX_MEMOIZE_SIZE) cache.clear();
|
|
5889
5889
|
return key;
|
|
5890
5890
|
});
|
|
@@ -9544,7 +9544,7 @@ var require_lodash = __commonJS({ "../../node_modules/lodash/lodash.js"(exports,
|
|
|
9544
9544
|
* // Replace `_.memoize.Cache`.
|
|
9545
9545
|
* _.memoize.Cache = WeakMap;
|
|
9546
9546
|
*/
|
|
9547
|
-
function memoize(func, resolver) {
|
|
9547
|
+
function memoize$1(func, resolver) {
|
|
9548
9548
|
if (typeof func != "function" || resolver != null && typeof resolver != "function") throw new TypeError$1(FUNC_ERROR_TEXT);
|
|
9549
9549
|
var memoized = function() {
|
|
9550
9550
|
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
|
|
@@ -9553,10 +9553,10 @@ var require_lodash = __commonJS({ "../../node_modules/lodash/lodash.js"(exports,
|
|
|
9553
9553
|
memoized.cache = cache.set(key, result$1) || cache;
|
|
9554
9554
|
return result$1;
|
|
9555
9555
|
};
|
|
9556
|
-
memoized.cache = new (memoize.Cache || MapCache)();
|
|
9556
|
+
memoized.cache = new (memoize$1.Cache || MapCache)();
|
|
9557
9557
|
return memoized;
|
|
9558
9558
|
}
|
|
9559
|
-
memoize.Cache = MapCache;
|
|
9559
|
+
memoize$1.Cache = MapCache;
|
|
9560
9560
|
/**
|
|
9561
9561
|
* Creates a function that negates the result of the predicate `func`. The
|
|
9562
9562
|
* `func` predicate is invoked with the `this` binding and arguments of the
|
|
@@ -15063,7 +15063,7 @@ var require_lodash = __commonJS({ "../../node_modules/lodash/lodash.js"(exports,
|
|
|
15063
15063
|
lodash.mapValues = mapValues;
|
|
15064
15064
|
lodash.matches = matches;
|
|
15065
15065
|
lodash.matchesProperty = matchesProperty;
|
|
15066
|
-
lodash.memoize = memoize;
|
|
15066
|
+
lodash.memoize = memoize$1;
|
|
15067
15067
|
lodash.merge = merge;
|
|
15068
15068
|
lodash.mergeWith = mergeWith;
|
|
15069
15069
|
lodash.method = method;
|
|
@@ -15494,6 +15494,7 @@ var require_lodash = __commonJS({ "../../node_modules/lodash/lodash.js"(exports,
|
|
|
15494
15494
|
} else root._ = _;
|
|
15495
15495
|
}).call(exports);
|
|
15496
15496
|
} });
|
|
15497
|
+
var import_lodash$1 = __toESM(require_lodash());
|
|
15497
15498
|
var import_lodash = __toESM(require_lodash(), 1);
|
|
15498
15499
|
|
|
15499
15500
|
//#endregion
|
|
@@ -15588,12 +15589,12 @@ var WeaveStore = class {
|
|
|
15588
15589
|
node: JSON.parse(JSON.stringify(nodeInfo.node))
|
|
15589
15590
|
});
|
|
15590
15591
|
}
|
|
15591
|
-
if (!this.isRoomLoaded && !(0, import_lodash.isEmpty)(this.state.weave)) {
|
|
15592
|
+
if (!this.isRoomLoaded && !(0, import_lodash$1.isEmpty)(this.state.weave)) {
|
|
15592
15593
|
this.instance.setupRenderer();
|
|
15593
15594
|
this.isRoomLoaded = true;
|
|
15594
15595
|
this.instance.emitEvent("onRoomLoaded", this.isRoomLoaded);
|
|
15595
15596
|
}
|
|
15596
|
-
if (this.isRoomLoaded && !(0, import_lodash.isEmpty)(this.state.weave)) this.instance.render();
|
|
15597
|
+
if (this.isRoomLoaded && !(0, import_lodash$1.isEmpty)(this.state.weave)) this.instance.render();
|
|
15597
15598
|
});
|
|
15598
15599
|
}
|
|
15599
15600
|
canUndoStateStep() {
|
|
@@ -15718,26 +15719,6 @@ function moveNodeToContainer(instance, node, containerToMove, invalidOriginsType
|
|
|
15718
15719
|
}
|
|
15719
15720
|
return false;
|
|
15720
15721
|
}
|
|
15721
|
-
function getContrastTextColor(hex) {
|
|
15722
|
-
const cleaned = hex.replace(/^#/, "");
|
|
15723
|
-
const r = parseInt(cleaned.slice(0, 2), 16);
|
|
15724
|
-
const g = parseInt(cleaned.slice(2, 4), 16);
|
|
15725
|
-
const b = parseInt(cleaned.slice(4, 6), 16);
|
|
15726
|
-
const luminance = (.299 * r + .587 * g + .114 * b) / 255;
|
|
15727
|
-
return luminance > .5 ? "black" : "white";
|
|
15728
|
-
}
|
|
15729
|
-
function stringToColor(str) {
|
|
15730
|
-
let hash = 0;
|
|
15731
|
-
str.split("").forEach((char) => {
|
|
15732
|
-
hash = char.charCodeAt(0) + ((hash << 5) - hash);
|
|
15733
|
-
});
|
|
15734
|
-
let color = "#";
|
|
15735
|
-
for (let i = 0; i < 3; i++) {
|
|
15736
|
-
const value = hash >> i * 8 & 255;
|
|
15737
|
-
color += value.toString(16).padStart(2, "0");
|
|
15738
|
-
}
|
|
15739
|
-
return color;
|
|
15740
|
-
}
|
|
15741
15722
|
function getExportBoundingBox(stage, nodes) {
|
|
15742
15723
|
if (nodes.length === 0) return {
|
|
15743
15724
|
x: 0,
|
|
@@ -15946,6 +15927,16 @@ function getVisibleNodes(instance, stage, nodeParent, skipNodes, referenceLayer)
|
|
|
15946
15927
|
if (nodesSelection) nodesSelection.getTransformer().show();
|
|
15947
15928
|
return finalVisibleNodes;
|
|
15948
15929
|
}
|
|
15930
|
+
function memoize(fn) {
|
|
15931
|
+
const cache = new Map();
|
|
15932
|
+
return function(...args) {
|
|
15933
|
+
const key = JSON.stringify(args);
|
|
15934
|
+
if (cache.has(key)) return cache.get(key);
|
|
15935
|
+
const result = fn(...args);
|
|
15936
|
+
cache.set(key, result);
|
|
15937
|
+
return result;
|
|
15938
|
+
};
|
|
15939
|
+
}
|
|
15949
15940
|
|
|
15950
15941
|
//#endregion
|
|
15951
15942
|
//#region src/actions/selection-tool/constants.ts
|
|
@@ -16395,7 +16386,7 @@ var WeaveNodesSelectionPlugin = class extends WeavePlugin {
|
|
|
16395
16386
|
if (moved) this.getContextMenuPlugin()?.cancelLongPressTimer();
|
|
16396
16387
|
this.triggerSelectedNodesEvent();
|
|
16397
16388
|
};
|
|
16398
|
-
tr.on("transform", (0, import_lodash.throttle)(handleTransform, 50));
|
|
16389
|
+
tr.on("transform", (0, import_lodash$1.throttle)(handleTransform, 50));
|
|
16399
16390
|
tr.on("transformend", () => {
|
|
16400
16391
|
this.triggerSelectedNodesEvent();
|
|
16401
16392
|
});
|
|
@@ -17085,29 +17076,11 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
17085
17076
|
}
|
|
17086
17077
|
});
|
|
17087
17078
|
if (catcher) {
|
|
17088
|
-
document.addEventListener("paste", (e) => {
|
|
17079
|
+
document.addEventListener("paste", async (e) => {
|
|
17089
17080
|
e.preventDefault();
|
|
17090
17081
|
const dataList = e.clipboardData?.items;
|
|
17091
17082
|
if (!dataList) return;
|
|
17092
|
-
if (dataList?.length > 0)
|
|
17093
|
-
const container = stage.container();
|
|
17094
|
-
const scale = stage.scale();
|
|
17095
|
-
const position = stage.position();
|
|
17096
|
-
const width = container.clientWidth;
|
|
17097
|
-
const height = container.clientHeight;
|
|
17098
|
-
const centerX = (width / 2 - position.x) / scale.x;
|
|
17099
|
-
const centerY = (height / 2 - position.y) / scale.y;
|
|
17100
|
-
const pastePosition = {
|
|
17101
|
-
x: centerX,
|
|
17102
|
-
y: centerY
|
|
17103
|
-
};
|
|
17104
|
-
this.instance.emitEvent("onPasteExternal", {
|
|
17105
|
-
positionCalculated: true,
|
|
17106
|
-
position: pastePosition,
|
|
17107
|
-
dataList,
|
|
17108
|
-
items: void 0
|
|
17109
|
-
});
|
|
17110
|
-
}
|
|
17083
|
+
if (dataList?.length > 0) this.sendExternalPasteEvent(dataList);
|
|
17111
17084
|
});
|
|
17112
17085
|
catcher.addEventListener("paste", async (e) => {
|
|
17113
17086
|
e.preventDefault();
|
|
@@ -17122,10 +17095,34 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
|
|
|
17122
17095
|
const continueToPaste = this.isWeaveData(readText);
|
|
17123
17096
|
if (continueToPaste) hasWeaveData = true;
|
|
17124
17097
|
}
|
|
17125
|
-
if (hasWeaveData)
|
|
17098
|
+
if (hasWeaveData) {
|
|
17099
|
+
this.handlePaste();
|
|
17100
|
+
return;
|
|
17101
|
+
}
|
|
17102
|
+
this.sendExternalPasteEvent(void 0, items);
|
|
17126
17103
|
});
|
|
17127
17104
|
}
|
|
17128
17105
|
}
|
|
17106
|
+
sendExternalPasteEvent(dataList, items) {
|
|
17107
|
+
const stage = this.instance.getStage();
|
|
17108
|
+
const container = stage.container();
|
|
17109
|
+
const scale = stage.scale();
|
|
17110
|
+
const position = stage.position();
|
|
17111
|
+
const width = container.clientWidth;
|
|
17112
|
+
const height = container.clientHeight;
|
|
17113
|
+
const centerX = (width / 2 - position.x) / scale.x;
|
|
17114
|
+
const centerY = (height / 2 - position.y) / scale.y;
|
|
17115
|
+
const pastePosition = {
|
|
17116
|
+
x: centerX,
|
|
17117
|
+
y: centerY
|
|
17118
|
+
};
|
|
17119
|
+
this.instance.emitEvent("onPasteExternal", {
|
|
17120
|
+
positionCalculated: true,
|
|
17121
|
+
position: pastePosition,
|
|
17122
|
+
dataList,
|
|
17123
|
+
items
|
|
17124
|
+
});
|
|
17125
|
+
}
|
|
17129
17126
|
isWeaveData(text) {
|
|
17130
17127
|
try {
|
|
17131
17128
|
const object = JSON.parse(text);
|
|
@@ -17507,7 +17504,7 @@ var WeaveNode = class {
|
|
|
17507
17504
|
if (nodesSelectionPlugin && this.isSelecting() && this.isNodeSelected(node$1)) nodesSelectionPlugin.getTransformer().forceUpdate();
|
|
17508
17505
|
if (nodesEdgeSnappingPlugin && transforming && this.isSelecting() && this.isNodeSelected(node$1)) nodesEdgeSnappingPlugin.evaluateGuidelines(e);
|
|
17509
17506
|
};
|
|
17510
|
-
node.on("transform", (0, import_lodash.throttle)(handleTransform, 100));
|
|
17507
|
+
node.on("transform", (0, import_lodash$1.throttle)(handleTransform, 100));
|
|
17511
17508
|
node.on("transformend", (e) => {
|
|
17512
17509
|
const node$1 = e.target;
|
|
17513
17510
|
this.instance.emitEvent("onTransform", null);
|
|
@@ -17561,7 +17558,7 @@ var WeaveNode = class {
|
|
|
17561
17558
|
if (layerToMove && !hasFrames(node) && node.isDragging()) layerToMove.fire(WEAVE_NODE_CUSTOM_EVENTS.onTargetEnter, { bubbles: true });
|
|
17562
17559
|
}
|
|
17563
17560
|
};
|
|
17564
|
-
node.on("dragmove", (0, import_lodash.throttle)(handleDragMove, 100));
|
|
17561
|
+
node.on("dragmove", (0, import_lodash$1.throttle)(handleDragMove, 100));
|
|
17565
17562
|
node.on("dragend", (e) => {
|
|
17566
17563
|
if (!this.didMove) return;
|
|
17567
17564
|
const isErasing = this.instance.getActiveAction() === "eraseTool";
|
|
@@ -19274,7 +19271,7 @@ var WeaveRegisterManager = class {
|
|
|
19274
19271
|
|
|
19275
19272
|
//#endregion
|
|
19276
19273
|
//#region package.json
|
|
19277
|
-
var version = "0.
|
|
19274
|
+
var version = "0.55.0";
|
|
19278
19275
|
|
|
19279
19276
|
//#endregion
|
|
19280
19277
|
//#region src/managers/setup.ts
|
|
@@ -20482,7 +20479,7 @@ var WeaveTextNode = class extends WeaveNode {
|
|
|
20482
20479
|
text.on("transformstart", (e) => {
|
|
20483
20480
|
this.instance.emitEvent("onTransform", e.target);
|
|
20484
20481
|
});
|
|
20485
|
-
text.on("transform", (0, import_lodash.throttle)(handleTextTransform, 50));
|
|
20482
|
+
text.on("transform", (0, import_lodash$1.throttle)(handleTextTransform, 50));
|
|
20486
20483
|
text.on("transformend", () => {
|
|
20487
20484
|
this.instance.emitEvent("onTransform", null);
|
|
20488
20485
|
});
|
|
@@ -21790,7 +21787,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
21790
21787
|
const stage = this.instance.getStage();
|
|
21791
21788
|
const image = stage.findOne(`#${imageAttrs.id}`);
|
|
21792
21789
|
const internalImage = image?.findOne(`#${imageAttrs.id}-image`);
|
|
21793
|
-
if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo && !(0, import_lodash.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
|
|
21790
|
+
if (image && internalImage && !imageAttrs.adding && imageAttrs.cropInfo && !(0, import_lodash$1.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
|
|
21794
21791
|
const actualScale = imageAttrs.uncroppedImage.width / imageAttrs.imageInfo.width;
|
|
21795
21792
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
21796
21793
|
internalImage.height(imageAttrs.uncroppedImage.height);
|
|
@@ -21807,7 +21804,7 @@ var WeaveImageNode = class extends WeaveNode {
|
|
|
21807
21804
|
internalImage.height(imageAttrs.cropSize.height);
|
|
21808
21805
|
this.cachedCropInfo[imageAttrs.id ?? ""] = imageAttrs.cropInfo;
|
|
21809
21806
|
}
|
|
21810
|
-
if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo && !(0, import_lodash.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
|
|
21807
|
+
if (image && internalImage && !imageAttrs.adding && !imageAttrs.cropInfo && !(0, import_lodash$1.isEqual)(imageAttrs.cropInfo, this.cachedCropInfo[imageAttrs.id ?? ""])) {
|
|
21811
21808
|
internalImage.width(imageAttrs.uncroppedImage.width);
|
|
21812
21809
|
internalImage.height(imageAttrs.uncroppedImage.height);
|
|
21813
21810
|
internalImage.rotation(0);
|
|
@@ -22553,7 +22550,7 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
22553
22550
|
constructor(params) {
|
|
22554
22551
|
super();
|
|
22555
22552
|
const { config } = params ?? {};
|
|
22556
|
-
this.config = (0, import_lodash.merge)(WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, config);
|
|
22553
|
+
this.config = (0, import_lodash$1.merge)(WEAVE_STAGE_ZOOM_DEFAULT_CONFIG, config);
|
|
22557
22554
|
if (!this.config.zoomSteps.includes(this.config.defaultZoom)) throw new Error(`Default zoom ${this.config.defaultZoom} is not in zoom steps`);
|
|
22558
22555
|
this.pinching = false;
|
|
22559
22556
|
this.isTrackpad = false;
|
|
@@ -22581,7 +22578,7 @@ var WeaveStageZoomPlugin = class extends WeavePlugin {
|
|
|
22581
22578
|
this.config.zoomSteps = [minimumZoom, ...this.config.zoomSteps];
|
|
22582
22579
|
}
|
|
22583
22580
|
};
|
|
22584
|
-
mainLayer?.on("draw", (0, import_lodash.throttle)(handleDraw, 50));
|
|
22581
|
+
mainLayer?.on("draw", (0, import_lodash$1.throttle)(handleDraw, 50));
|
|
22585
22582
|
this.setZoom(this.config.zoomSteps[this.actualStep]);
|
|
22586
22583
|
}
|
|
22587
22584
|
setZoom(scale, centered = true, pointer) {
|
|
@@ -24011,6 +24008,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
24011
24008
|
});
|
|
24012
24009
|
const handlePointerDown = (e) => {
|
|
24013
24010
|
if (this.state !== BRUSH_TOOL_STATE.IDLE) return;
|
|
24011
|
+
if (this.getZoomPlugin()?.isPinching()) return;
|
|
24014
24012
|
const pointPressure = this.getPointPressure(e);
|
|
24015
24013
|
this.handleStartStroke(pointPressure);
|
|
24016
24014
|
e.evt.stopPropagation();
|
|
@@ -24018,6 +24016,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
24018
24016
|
stage.on("pointerdown touchstart", handlePointerDown);
|
|
24019
24017
|
const handlePointerMove = (e) => {
|
|
24020
24018
|
if (this.state !== BRUSH_TOOL_STATE.DEFINE_STROKE) return;
|
|
24019
|
+
if (this.getZoomPlugin()?.isPinching()) return;
|
|
24021
24020
|
stage.container().style.cursor = "crosshair";
|
|
24022
24021
|
const pointPressure = this.getPointPressure(e);
|
|
24023
24022
|
this.handleMovement(pointPressure);
|
|
@@ -24026,6 +24025,7 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
24026
24025
|
stage.on("pointermove touchmove", handlePointerMove);
|
|
24027
24026
|
const handlePointerUp = (e) => {
|
|
24028
24027
|
if (this.state !== BRUSH_TOOL_STATE.DEFINE_STROKE) return;
|
|
24028
|
+
if (this.getZoomPlugin()?.isPinching()) return;
|
|
24029
24029
|
this.handleEndStroke();
|
|
24030
24030
|
e.evt.stopPropagation();
|
|
24031
24031
|
};
|
|
@@ -24172,6 +24172,10 @@ var WeaveBrushToolAction = class extends WeaveAction {
|
|
|
24172
24172
|
this.clickPoint = null;
|
|
24173
24173
|
this.setState(BRUSH_TOOL_STATE.INACTIVE);
|
|
24174
24174
|
}
|
|
24175
|
+
getZoomPlugin() {
|
|
24176
|
+
const zoomPlugin = this.instance.getPlugin("stageZoom");
|
|
24177
|
+
return zoomPlugin;
|
|
24178
|
+
}
|
|
24175
24179
|
};
|
|
24176
24180
|
|
|
24177
24181
|
//#endregion
|
|
@@ -25475,7 +25479,7 @@ var WeaveStageGridPlugin = class extends WeavePlugin {
|
|
|
25475
25479
|
if (!this.enabled || !(this.isSpaceKeyPressed || this.isMouseMiddleButtonPressed || this.moveToolActive)) return;
|
|
25476
25480
|
this.onRender();
|
|
25477
25481
|
};
|
|
25478
|
-
stage.on("pointermove", (0, import_lodash.throttle)(handleMouseMove, 50));
|
|
25482
|
+
stage.on("pointermove", (0, import_lodash$1.throttle)(handleMouseMove, 50));
|
|
25479
25483
|
stage.on("pointermove", () => {
|
|
25480
25484
|
if (this.enabled) this.onRender();
|
|
25481
25485
|
});
|
|
@@ -25954,7 +25958,7 @@ var WeaveConnectedUsersPlugin = class extends WeavePlugin {
|
|
|
25954
25958
|
newConnectedUsers[userInformation.id] = userInformation;
|
|
25955
25959
|
}
|
|
25956
25960
|
}
|
|
25957
|
-
if (!(0, import_lodash.isEqual)(this.connectedUsers, newConnectedUsers)) this.instance.emitEvent("onConnectedUsersChange", newConnectedUsers);
|
|
25961
|
+
if (!(0, import_lodash$1.isEqual)(this.connectedUsers, newConnectedUsers)) this.instance.emitEvent("onConnectedUsersChange", newConnectedUsers);
|
|
25958
25962
|
this.connectedUsers = newConnectedUsers;
|
|
25959
25963
|
});
|
|
25960
25964
|
}
|
|
@@ -25974,6 +25978,8 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
25974
25978
|
super();
|
|
25975
25979
|
const { config } = params;
|
|
25976
25980
|
this.config = config;
|
|
25981
|
+
this.config.getUser = memoize(this.config.getUser);
|
|
25982
|
+
this.config.getUserColor = memoize(this.config.getUserColor);
|
|
25977
25983
|
this.usersSelection = {};
|
|
25978
25984
|
}
|
|
25979
25985
|
getName() {
|
|
@@ -26027,6 +26033,7 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
26027
26033
|
const userInfo = this.config.getUser();
|
|
26028
26034
|
const store = this.instance.getStore();
|
|
26029
26035
|
store.setAwarenessInfo(WEAVE_USER_SELECTION_KEY, {
|
|
26036
|
+
rawUser: userInfo,
|
|
26030
26037
|
user: userInfo.id,
|
|
26031
26038
|
nodes: tr.nodes().map((node) => node.getAttrs().id)
|
|
26032
26039
|
});
|
|
@@ -26082,6 +26089,7 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
26082
26089
|
listening: false
|
|
26083
26090
|
});
|
|
26084
26091
|
userSelectorNode.moveToBottom();
|
|
26092
|
+
const userColor = this.config.getUserColor(userSelector.rawUser);
|
|
26085
26093
|
const userSelectorRect = new Konva.Rect({
|
|
26086
26094
|
x: -this.padding / stage.scaleX(),
|
|
26087
26095
|
y: -this.padding / stage.scaleY(),
|
|
@@ -26090,7 +26098,7 @@ var WeaveUsersSelectionPlugin = class extends WeavePlugin {
|
|
|
26090
26098
|
height: (selectionRect.height + 2 * this.padding) / stage.scaleY(),
|
|
26091
26099
|
fill: "transparent",
|
|
26092
26100
|
listening: false,
|
|
26093
|
-
stroke:
|
|
26101
|
+
stroke: userColor,
|
|
26094
26102
|
strokeWidth: 3,
|
|
26095
26103
|
strokeScaleEnabled: false
|
|
26096
26104
|
});
|
|
@@ -26140,6 +26148,9 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
26140
26148
|
super();
|
|
26141
26149
|
const { config } = params;
|
|
26142
26150
|
this.config = config;
|
|
26151
|
+
this.config.getUser = memoize(this.config.getUser);
|
|
26152
|
+
this.config.getUserBackgroundColor = memoize(this.config.getUserBackgroundColor);
|
|
26153
|
+
this.config.getUserForegroundColor = memoize(this.config.getUserForegroundColor);
|
|
26143
26154
|
this.uiConfig = {
|
|
26144
26155
|
...WEAVE_USER_POINTERS_DEFAULT_PROPS,
|
|
26145
26156
|
...this.config.ui
|
|
@@ -26193,6 +26204,7 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
26193
26204
|
const userInfo = this.config.getUser();
|
|
26194
26205
|
const mousePos = stage.getRelativePointerPosition();
|
|
26195
26206
|
if (mousePos) store.setAwarenessInfo(WEAVE_USER_POINTER_KEY, {
|
|
26207
|
+
rawUser: userInfo,
|
|
26196
26208
|
user: userInfo.id,
|
|
26197
26209
|
name: userInfo.name,
|
|
26198
26210
|
x: mousePos.x,
|
|
@@ -26203,6 +26215,7 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
26203
26215
|
const userInfo = this.config.getUser();
|
|
26204
26216
|
const mousePos = stage.getRelativePointerPosition();
|
|
26205
26217
|
if (mousePos) store.setAwarenessInfo(WEAVE_USER_POINTER_KEY, {
|
|
26218
|
+
rawUser: userInfo,
|
|
26206
26219
|
user: userInfo.id,
|
|
26207
26220
|
name: userInfo.name,
|
|
26208
26221
|
x: mousePos.x,
|
|
@@ -26231,14 +26244,14 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
26231
26244
|
});
|
|
26232
26245
|
userPointerNode.moveToTop();
|
|
26233
26246
|
const { separation, pointer: { circleRadius, circleStrokeWidth }, name: { fontFamily, fontSize, backgroundCornerRadius, backgroundPaddingX, backgroundPaddingY } } = this.uiConfig;
|
|
26234
|
-
const
|
|
26235
|
-
const
|
|
26247
|
+
const userBackgroundColor = this.config.getUserBackgroundColor(userPointer.rawUser);
|
|
26248
|
+
const userForegroundColor = this.config.getUserForegroundColor(userPointer.rawUser);
|
|
26236
26249
|
const userPointNode = new Konva.Circle({
|
|
26237
26250
|
id: `pointer_${userPointer.user}_userPoint`,
|
|
26238
26251
|
x: 0,
|
|
26239
26252
|
y: 0,
|
|
26240
26253
|
radius: circleRadius,
|
|
26241
|
-
fill:
|
|
26254
|
+
fill: userBackgroundColor,
|
|
26242
26255
|
stroke: "black",
|
|
26243
26256
|
strokeWidth: circleStrokeWidth,
|
|
26244
26257
|
strokeScaleEnabled: false,
|
|
@@ -26252,7 +26265,7 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
26252
26265
|
fontSize,
|
|
26253
26266
|
fontFamily,
|
|
26254
26267
|
lineHeight: .9,
|
|
26255
|
-
fill:
|
|
26268
|
+
fill: userForegroundColor,
|
|
26256
26269
|
align: "center",
|
|
26257
26270
|
verticalAlign: "middle",
|
|
26258
26271
|
listening: false,
|
|
@@ -26270,7 +26283,7 @@ var WeaveUsersPointersPlugin = class extends WeavePlugin {
|
|
|
26270
26283
|
width: textWidth + backgroundPaddingX * 2,
|
|
26271
26284
|
height: textHeight + backgroundPaddingY * 2,
|
|
26272
26285
|
cornerRadius: backgroundCornerRadius,
|
|
26273
|
-
fill:
|
|
26286
|
+
fill: userBackgroundColor,
|
|
26274
26287
|
listening: false
|
|
26275
26288
|
});
|
|
26276
26289
|
userPointNode.setAttrs({ y: userNameBackground.y() + userNameBackground.height() / 2 });
|
|
@@ -26665,7 +26678,7 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
26665
26678
|
const { config } = params ?? {};
|
|
26666
26679
|
this.enterSnappingTolerance = config?.enterSnappingTolerance ?? GUIDE_ENTER_SNAPPING_TOLERANCE;
|
|
26667
26680
|
this.exitSnappingTolerance = config?.exitSnappingTolerance ?? GUIDE_EXIT_SNAPPING_TOLERANCE;
|
|
26668
|
-
this.uiConfig = import_lodash.default.merge(GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, config?.ui);
|
|
26681
|
+
this.uiConfig = import_lodash$1.default.merge(GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, config?.ui);
|
|
26669
26682
|
this.enabled = true;
|
|
26670
26683
|
}
|
|
26671
26684
|
getName() {
|
|
@@ -27172,5 +27185,5 @@ var WeaveNodesDistanceSnappingPlugin = class extends WeavePlugin {
|
|
|
27172
27185
|
};
|
|
27173
27186
|
|
|
27174
27187
|
//#endregion
|
|
27175
|
-
export { ALIGN_NODES_ALIGN_TO, ALIGN_NODES_TOOL_ACTION_NAME, ALIGN_NODES_TOOL_STATE, ARROW_TOOL_ACTION_NAME, ARROW_TOOL_STATE, BRUSH_TOOL_ACTION_NAME, BRUSH_TOOL_STATE, COPY_PASTE_NODES_PLUGIN_STATE, ELLIPSE_TOOL_ACTION_NAME, ELLIPSE_TOOL_STATE, ERASER_TOOL_ACTION_NAME, ERASER_TOOL_STATE, FRAME_TOOL_ACTION_NAME, FRAME_TOOL_STATE, GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, GUIDE_ENTER_SNAPPING_TOLERANCE, GUIDE_EXIT_SNAPPING_TOLERANCE, GUIDE_HORIZONTAL_LINE_NAME, GUIDE_LINE_DEFAULT_CONFIG, GUIDE_LINE_DRAG_SNAPPING_THRESHOLD, GUIDE_LINE_NAME, GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD, GUIDE_ORIENTATION, GUIDE_VERTICAL_LINE_NAME, IMAGE_TOOL_ACTION_NAME, IMAGE_TOOL_STATE, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, NODE_SNAP, NODE_SNAP_HORIZONTAL, NODE_SNAP_VERTICAL, PEN_TOOL_ACTION_NAME, PEN_TOOL_STATE, RECTANGLE_TOOL_ACTION_NAME, RECTANGLE_TOOL_STATE, REGULAR_POLYGON_TOOL_ACTION_NAME, REGULAR_POLYGON_TOOL_STATE, SELECTION_TOOL_ACTION_NAME, SELECTION_TOOL_STATE, STAR_TOOL_ACTION_NAME, STAR_TOOL_STATE, TEXT_LAYOUT, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, WEAVE_ARROW_NODE_TYPE, WEAVE_COPY_PASTE_CONFIG_DEFAULT, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_COPY_PASTE_PASTE_CATCHER_ID, WEAVE_COPY_PASTE_PASTE_MODES, WEAVE_DEFAULT_USER_INFO_FUNCTION, WEAVE_ELLIPSE_NODE_TYPE, WEAVE_FRAME_NODE_DEFAULT_CONFIG, WEAVE_FRAME_NODE_DEFAULT_PROPS, WEAVE_FRAME_NODE_TYPE, WEAVE_GRID_DEFAULT_COLOR, WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS, WEAVE_GRID_DEFAULT_MAJOR_DOT_RATIO, WEAVE_GRID_DEFAULT_MAJOR_EVERY, WEAVE_GRID_DEFAULT_MAJOR_LINE_RATIO, WEAVE_GRID_DEFAULT_ORIGIN_COLOR, WEAVE_GRID_DEFAULT_RADIUS, WEAVE_GRID_DEFAULT_SIZE, WEAVE_GRID_DEFAULT_STROKE, WEAVE_GRID_DEFAULT_TYPE, WEAVE_GRID_LAYER_ID, WEAVE_GRID_TYPES, WEAVE_GROUP_NODE_TYPE, WEAVE_IMAGE_CROP_END_TYPE, WEAVE_IMAGE_NODE_TYPE, WEAVE_LAYER_NODE_TYPE, WEAVE_LINE_NODE_TYPE, WEAVE_NODES_DISTANCE_SNAPPING_PLUGIN_KEY, WEAVE_NODES_EDGE_SNAPPING_PLUGIN_KEY, WEAVE_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_RECTANGLE_NODE_TYPE, WEAVE_REGULAR_POLYGON_NODE_TYPE, WEAVE_STAGE_DEFAULT_MODE, WEAVE_STAGE_GRID_KEY, WEAVE_STAGE_NODE_TYPE, WEAVE_STAR_NODE_TYPE, WEAVE_STROKE_NODE_TYPE, WEAVE_TEXT_NODE_TYPE, WEAVE_USERS_POINTERS_KEY, WEAVE_USERS_SELECTION_KEY, WEAVE_USER_POINTERS_DEFAULT_PROPS, WEAVE_USER_POINTER_KEY, WEAVE_USER_SELECTION_KEY, Weave, WeaveAction, WeaveAlignNodesToolAction, WeaveArrowNode, WeaveArrowToolAction, WeaveBrushToolAction, WeaveConnectedUsersPlugin, WeaveContextMenuPlugin, WeaveCopyPasteNodesPlugin, WeaveEllipseNode, WeaveEllipseToolAction, WeaveEraserToolAction, WeaveExportNodesToolAction, WeaveExportStageToolAction, WeaveFitToScreenToolAction, WeaveFitToSelectionToolAction, WeaveFrameNode, WeaveFrameToolAction, WeaveGroupNode, WeaveImageNode, WeaveImageToolAction, WeaveLayerNode, WeaveLineNode, WeaveMoveToolAction, WeaveNode, WeaveNodesDistanceSnappingPlugin, WeaveNodesEdgeSnappingPlugin, WeaveNodesSelectionPlugin, WeavePenToolAction, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveRegularPolygonNode, WeaveRegularPolygonToolAction, WeaveSelectionToolAction, WeaveStageDropAreaPlugin, WeaveStageGridPlugin, WeaveStageNode, WeaveStagePanningPlugin, WeaveStageResizePlugin, WeaveStageZoomPlugin, WeaveStarNode, WeaveStarToolAction, WeaveStore, WeaveStrokeNode, WeaveTextNode, WeaveTextToolAction, WeaveUsersPointersPlugin, WeaveUsersSelectionPlugin, WeaveZoomInToolAction, WeaveZoomOutToolAction, clearContainerTargets, containerOverCursor, containsNodeDeep, getBoundingBox, getClosestParentWithId,
|
|
27188
|
+
export { ALIGN_NODES_ALIGN_TO, ALIGN_NODES_TOOL_ACTION_NAME, ALIGN_NODES_TOOL_STATE, ARROW_TOOL_ACTION_NAME, ARROW_TOOL_STATE, BRUSH_TOOL_ACTION_NAME, BRUSH_TOOL_STATE, COPY_PASTE_NODES_PLUGIN_STATE, ELLIPSE_TOOL_ACTION_NAME, ELLIPSE_TOOL_STATE, ERASER_TOOL_ACTION_NAME, ERASER_TOOL_STATE, FRAME_TOOL_ACTION_NAME, FRAME_TOOL_STATE, GUIDE_DISTANCE_LINE_DEFAULT_CONFIG, GUIDE_ENTER_SNAPPING_TOLERANCE, GUIDE_EXIT_SNAPPING_TOLERANCE, GUIDE_HORIZONTAL_LINE_NAME, GUIDE_LINE_DEFAULT_CONFIG, GUIDE_LINE_DRAG_SNAPPING_THRESHOLD, GUIDE_LINE_NAME, GUIDE_LINE_TRANSFORM_SNAPPING_THRESHOLD, GUIDE_ORIENTATION, GUIDE_VERTICAL_LINE_NAME, IMAGE_TOOL_ACTION_NAME, IMAGE_TOOL_STATE, MOVE_TOOL_ACTION_NAME, MOVE_TOOL_STATE, NODE_SNAP, NODE_SNAP_HORIZONTAL, NODE_SNAP_VERTICAL, PEN_TOOL_ACTION_NAME, PEN_TOOL_STATE, RECTANGLE_TOOL_ACTION_NAME, RECTANGLE_TOOL_STATE, REGULAR_POLYGON_TOOL_ACTION_NAME, REGULAR_POLYGON_TOOL_STATE, SELECTION_TOOL_ACTION_NAME, SELECTION_TOOL_STATE, STAR_TOOL_ACTION_NAME, STAR_TOOL_STATE, TEXT_LAYOUT, TEXT_TOOL_ACTION_NAME, TEXT_TOOL_STATE, WEAVE_ARROW_NODE_TYPE, WEAVE_COPY_PASTE_CONFIG_DEFAULT, WEAVE_COPY_PASTE_NODES_KEY, WEAVE_COPY_PASTE_PASTE_CATCHER_ID, WEAVE_COPY_PASTE_PASTE_MODES, WEAVE_DEFAULT_USER_INFO_FUNCTION, WEAVE_ELLIPSE_NODE_TYPE, WEAVE_FRAME_NODE_DEFAULT_CONFIG, WEAVE_FRAME_NODE_DEFAULT_PROPS, WEAVE_FRAME_NODE_TYPE, WEAVE_GRID_DEFAULT_COLOR, WEAVE_GRID_DEFAULT_DOT_MAX_DOTS_PER_AXIS, WEAVE_GRID_DEFAULT_MAJOR_DOT_RATIO, WEAVE_GRID_DEFAULT_MAJOR_EVERY, WEAVE_GRID_DEFAULT_MAJOR_LINE_RATIO, WEAVE_GRID_DEFAULT_ORIGIN_COLOR, WEAVE_GRID_DEFAULT_RADIUS, WEAVE_GRID_DEFAULT_SIZE, WEAVE_GRID_DEFAULT_STROKE, WEAVE_GRID_DEFAULT_TYPE, WEAVE_GRID_LAYER_ID, WEAVE_GRID_TYPES, WEAVE_GROUP_NODE_TYPE, WEAVE_IMAGE_CROP_END_TYPE, WEAVE_IMAGE_NODE_TYPE, WEAVE_LAYER_NODE_TYPE, WEAVE_LINE_NODE_TYPE, WEAVE_NODES_DISTANCE_SNAPPING_PLUGIN_KEY, WEAVE_NODES_EDGE_SNAPPING_PLUGIN_KEY, WEAVE_NODES_SELECTION_KEY, WEAVE_NODES_SELECTION_LAYER_ID, WEAVE_RECTANGLE_NODE_TYPE, WEAVE_REGULAR_POLYGON_NODE_TYPE, WEAVE_STAGE_DEFAULT_MODE, WEAVE_STAGE_GRID_KEY, WEAVE_STAGE_NODE_TYPE, WEAVE_STAR_NODE_TYPE, WEAVE_STROKE_NODE_TYPE, WEAVE_TEXT_NODE_TYPE, WEAVE_USERS_POINTERS_KEY, WEAVE_USERS_SELECTION_KEY, WEAVE_USER_POINTERS_DEFAULT_PROPS, WEAVE_USER_POINTER_KEY, WEAVE_USER_SELECTION_KEY, Weave, WeaveAction, WeaveAlignNodesToolAction, WeaveArrowNode, WeaveArrowToolAction, WeaveBrushToolAction, WeaveConnectedUsersPlugin, WeaveContextMenuPlugin, WeaveCopyPasteNodesPlugin, WeaveEllipseNode, WeaveEllipseToolAction, WeaveEraserToolAction, WeaveExportNodesToolAction, WeaveExportStageToolAction, WeaveFitToScreenToolAction, WeaveFitToSelectionToolAction, WeaveFrameNode, WeaveFrameToolAction, WeaveGroupNode, WeaveImageNode, WeaveImageToolAction, WeaveLayerNode, WeaveLineNode, WeaveMoveToolAction, WeaveNode, WeaveNodesDistanceSnappingPlugin, WeaveNodesEdgeSnappingPlugin, WeaveNodesSelectionPlugin, WeavePenToolAction, WeavePlugin, WeaveRectangleNode, WeaveRectangleToolAction, WeaveRegularPolygonNode, WeaveRegularPolygonToolAction, WeaveSelectionToolAction, WeaveStageDropAreaPlugin, WeaveStageGridPlugin, WeaveStageNode, WeaveStagePanningPlugin, WeaveStageResizePlugin, WeaveStageZoomPlugin, WeaveStarNode, WeaveStarToolAction, WeaveStore, WeaveStrokeNode, WeaveTextNode, WeaveTextToolAction, WeaveUsersPointersPlugin, WeaveUsersSelectionPlugin, WeaveZoomInToolAction, WeaveZoomOutToolAction, clearContainerTargets, containerOverCursor, containsNodeDeep, getBoundingBox, getClosestParentWithId, getExportBoundingBox, getSelectedNodesMetadata, getTargetAndSkipNodes, getTargetedNode, getTopmostShadowHost, getVisibleNodes, getVisibleNodesInViewport, hasFrames, hasImages, intersectArrays, isInShadowDOM, isNodeInSelection, memoize, moveNodeToContainer, resetScale };
|
|
27176
27189
|
//# sourceMappingURL=sdk.js.map
|