canvu-react 0.3.25 → 0.3.27
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/chatbot.d.cts +1 -1
- package/dist/chatbot.d.ts +1 -1
- package/dist/react.cjs +81 -31
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +81 -31
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs +211 -59
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/realtime.js +207 -59
- package/dist/realtime.js.map +1 -1
- package/dist/{types-7kfWcm0L.d.cts → types-BLXR7g_L.d.cts} +7 -0
- package/dist/{types-C4k_AMvi.d.ts → types-Cm7IsgL4.d.ts} +7 -0
- package/package.json +1 -1
package/dist/chatbot.d.cts
CHANGED
package/dist/chatbot.d.ts
CHANGED
package/dist/react.cjs
CHANGED
|
@@ -6455,6 +6455,7 @@ function InteractionOverlay({
|
|
|
6455
6455
|
}
|
|
6456
6456
|
);
|
|
6457
6457
|
}
|
|
6458
|
+
init_shape_builders();
|
|
6458
6459
|
|
|
6459
6460
|
// src/react/presence/peer-color.ts
|
|
6460
6461
|
function defaultPresenceColorForId(id) {
|
|
@@ -6480,6 +6481,9 @@ function strokePaint(tool, fallback) {
|
|
|
6480
6481
|
return { stroke: fallback, strokeOpacity: 0.95, widthWorld: 3.5 };
|
|
6481
6482
|
}
|
|
6482
6483
|
}
|
|
6484
|
+
function isFreehandTool(tool) {
|
|
6485
|
+
return tool === "draw" || tool === "marker" || tool === "pencil" || tool === "brush";
|
|
6486
|
+
}
|
|
6483
6487
|
function PresenceRemoteLayer({
|
|
6484
6488
|
camera,
|
|
6485
6489
|
cameraVersion: _cameraVersion,
|
|
@@ -6515,35 +6519,78 @@ function PresenceRemoteLayer({
|
|
|
6515
6519
|
const markup = peer.markupStroke;
|
|
6516
6520
|
let strokeNode = null;
|
|
6517
6521
|
if (markup && markup.points.length > 0) {
|
|
6518
|
-
const
|
|
6519
|
-
const
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6522
|
+
const fallbackPaint = strokePaint(markup.tool, color);
|
|
6523
|
+
const paint = {
|
|
6524
|
+
stroke: markup.stroke ?? fallbackPaint.stroke,
|
|
6525
|
+
strokeOpacity: markup.strokeOpacity ?? fallbackPaint.strokeOpacity,
|
|
6526
|
+
widthWorld: markup.strokeWidth ?? fallbackPaint.widthWorld
|
|
6527
|
+
};
|
|
6528
|
+
if (markup.tool === "laser") {
|
|
6529
|
+
const d = markup.points.length >= 2 ? smoothFreehandPointsToPathD([...markup.points]) : null;
|
|
6530
|
+
if (d) {
|
|
6531
|
+
strokeNode = /* @__PURE__ */ jsxRuntime.jsx(
|
|
6532
|
+
"path",
|
|
6533
|
+
{
|
|
6534
|
+
d,
|
|
6535
|
+
fill: "none",
|
|
6536
|
+
stroke: paint.stroke,
|
|
6537
|
+
strokeOpacity: paint.strokeOpacity,
|
|
6538
|
+
strokeWidth: Math.max(paint.widthWorld / z, overlayStrokePx),
|
|
6539
|
+
strokeLinecap: "round",
|
|
6540
|
+
strokeLinejoin: "round",
|
|
6541
|
+
shapeRendering: "geometricPrecision",
|
|
6542
|
+
vectorEffect: "non-scaling-stroke"
|
|
6543
|
+
}
|
|
6544
|
+
);
|
|
6545
|
+
}
|
|
6546
|
+
} else if (isFreehandTool(markup.tool)) {
|
|
6547
|
+
const style = {
|
|
6548
|
+
stroke: paint.stroke,
|
|
6549
|
+
strokeWidth: paint.widthWorld,
|
|
6550
|
+
...paint.strokeOpacity != null ? { strokeOpacity: paint.strokeOpacity } : {}
|
|
6551
|
+
};
|
|
6552
|
+
const payload = computeFreehandSvgPayload(
|
|
6553
|
+
markup.points.map((p) => ({ x: p.x, y: p.y })),
|
|
6554
|
+
style,
|
|
6555
|
+
markup.tool,
|
|
6556
|
+
false
|
|
6534
6557
|
);
|
|
6535
|
-
|
|
6536
|
-
const p0 = markup.points[0];
|
|
6537
|
-
if (p0) {
|
|
6558
|
+
if (payload?.kind === "circle") {
|
|
6538
6559
|
strokeNode = /* @__PURE__ */ jsxRuntime.jsx(
|
|
6539
6560
|
"circle",
|
|
6540
6561
|
{
|
|
6541
|
-
cx:
|
|
6542
|
-
cy:
|
|
6543
|
-
r:
|
|
6544
|
-
fill:
|
|
6545
|
-
fillOpacity:
|
|
6546
|
-
|
|
6562
|
+
cx: payload.cx,
|
|
6563
|
+
cy: payload.cy,
|
|
6564
|
+
r: payload.r,
|
|
6565
|
+
fill: payload.fill,
|
|
6566
|
+
...payload.fillOpacity != null ? { fillOpacity: payload.fillOpacity } : {},
|
|
6567
|
+
shapeRendering: "geometricPrecision"
|
|
6568
|
+
}
|
|
6569
|
+
);
|
|
6570
|
+
} else if (payload?.kind === "fillPath") {
|
|
6571
|
+
strokeNode = /* @__PURE__ */ jsxRuntime.jsx(
|
|
6572
|
+
"path",
|
|
6573
|
+
{
|
|
6574
|
+
d: payload.d,
|
|
6575
|
+
fill: payload.fill,
|
|
6576
|
+
fillRule: "nonzero",
|
|
6577
|
+
stroke: "none",
|
|
6578
|
+
...payload.fillOpacity != null ? { fillOpacity: payload.fillOpacity } : {},
|
|
6579
|
+
shapeRendering: "geometricPrecision"
|
|
6580
|
+
}
|
|
6581
|
+
);
|
|
6582
|
+
} else if (payload?.kind === "strokePath") {
|
|
6583
|
+
strokeNode = /* @__PURE__ */ jsxRuntime.jsx(
|
|
6584
|
+
"path",
|
|
6585
|
+
{
|
|
6586
|
+
d: payload.d,
|
|
6587
|
+
fill: "none",
|
|
6588
|
+
stroke: payload.stroke,
|
|
6589
|
+
strokeWidth: payload.strokeWidth,
|
|
6590
|
+
...payload.strokeOpacity != null ? { strokeOpacity: payload.strokeOpacity } : {},
|
|
6591
|
+
strokeLinecap: "round",
|
|
6592
|
+
strokeLinejoin: "round",
|
|
6593
|
+
shapeRendering: "geometricPrecision"
|
|
6547
6594
|
}
|
|
6548
6595
|
);
|
|
6549
6596
|
}
|
|
@@ -7424,14 +7471,15 @@ var VectorViewport = react.forwardRef(
|
|
|
7424
7471
|
const directRemoteStrokePreviewRef = react.useRef(false);
|
|
7425
7472
|
const remoteStrokePreviewFrameRef = react.useRef(null);
|
|
7426
7473
|
const pendingRemoteStrokePreviewRef = react.useRef(null);
|
|
7427
|
-
const
|
|
7474
|
+
const flushRemoteStrokePreviewWithStyle = react.useCallback(() => {
|
|
7428
7475
|
remoteStrokePreviewFrameRef.current = null;
|
|
7429
7476
|
const pending = pendingRemoteStrokePreviewRef.current;
|
|
7430
7477
|
if (!pending) return;
|
|
7431
7478
|
onPlacementPreviewChangeRef.current?.({
|
|
7432
7479
|
kind: "stroke",
|
|
7433
7480
|
tool: pending.tool,
|
|
7434
|
-
points: pending.points
|
|
7481
|
+
points: pending.points,
|
|
7482
|
+
style: { ...strokeStyleRef.current }
|
|
7435
7483
|
});
|
|
7436
7484
|
}, []);
|
|
7437
7485
|
const emitRemoteStrokePreview = react.useCallback(
|
|
@@ -7441,10 +7489,10 @@ var VectorViewport = react.forwardRef(
|
|
|
7441
7489
|
pendingRemoteStrokePreviewRef.current = { tool, points };
|
|
7442
7490
|
if (remoteStrokePreviewFrameRef.current != null) return;
|
|
7443
7491
|
remoteStrokePreviewFrameRef.current = requestAnimationFrame(
|
|
7444
|
-
|
|
7492
|
+
flushRemoteStrokePreviewWithStyle
|
|
7445
7493
|
);
|
|
7446
7494
|
},
|
|
7447
|
-
[
|
|
7495
|
+
[flushRemoteStrokePreviewWithStyle]
|
|
7448
7496
|
);
|
|
7449
7497
|
const emitRemoteStrokePreviewClear = react.useCallback(() => {
|
|
7450
7498
|
if (remoteStrokePreviewFrameRef.current != null) {
|
|
@@ -8707,7 +8755,8 @@ var VectorViewport = react.forwardRef(
|
|
|
8707
8755
|
setPlacementPreview({
|
|
8708
8756
|
kind: "stroke",
|
|
8709
8757
|
tool,
|
|
8710
|
-
points: [startPoint]
|
|
8758
|
+
points: [startPoint],
|
|
8759
|
+
style: { ...strokeStyleRef.current }
|
|
8711
8760
|
});
|
|
8712
8761
|
}
|
|
8713
8762
|
captureInteractionPointer(e.currentTarget, e.pointerId);
|
|
@@ -9074,7 +9123,8 @@ var VectorViewport = react.forwardRef(
|
|
|
9074
9123
|
setPlacementPreview({
|
|
9075
9124
|
kind: "stroke",
|
|
9076
9125
|
tool: st.tool,
|
|
9077
|
-
points: interpolated
|
|
9126
|
+
points: interpolated,
|
|
9127
|
+
style: { ...strokeStyleRef.current }
|
|
9078
9128
|
});
|
|
9079
9129
|
}
|
|
9080
9130
|
return;
|