canvu-react 0.3.39 → 0.3.40
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/{asset-hydration-DowNdaOJ.d.cts → asset-hydration-B7yMDQE-.d.cts} +2 -2
- package/dist/{asset-hydration-DdFLdlqX.d.ts → asset-hydration-CbwQVAwh.d.ts} +2 -2
- package/dist/{camera-Di5R_Rwl.d.cts → camera-CVVG7z56.d.cts} +1 -1
- package/dist/{camera-AoTwBSoE.d.ts → camera-CoRYN_IV.d.ts} +1 -1
- package/dist/chatbot.d.cts +4 -4
- package/dist/chatbot.d.ts +4 -4
- package/dist/index.cjs +59 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +59 -15
- package/dist/index.js.map +1 -1
- package/dist/native.cjs +57 -14
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.cts +2 -2
- package/dist/native.d.ts +2 -2
- package/dist/native.js +57 -14
- package/dist/native.js.map +1 -1
- package/dist/react.cjs +699 -255
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +10 -10
- package/dist/react.d.ts +10 -10
- package/dist/react.js +699 -255
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs +36 -0
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +6 -6
- package/dist/realtime.d.ts +6 -6
- package/dist/realtime.js +36 -0
- package/dist/realtime.js.map +1 -1
- package/dist/{shape-builders-Dedcl6tw.d.cts → shape-builders-BAWu-PxX.d.cts} +7 -3
- package/dist/{shape-builders-C7bxJBGR.d.ts → shape-builders-ClKv9tz9.d.ts} +7 -3
- package/dist/tldraw.cjs +56 -14
- package/dist/tldraw.cjs.map +1 -1
- package/dist/tldraw.d.cts +1 -1
- package/dist/tldraw.d.ts +1 -1
- package/dist/tldraw.js +56 -14
- package/dist/tldraw.js.map +1 -1
- package/dist/{types-DUW61Tjy.d.cts → types-BC9Xgfu6.d.cts} +11 -6
- package/dist/{types-Bnq2HtHQ.d.cts → types-BCCvY6ie.d.cts} +2 -0
- package/dist/{types-Bnq2HtHQ.d.ts → types-BCCvY6ie.d.ts} +2 -0
- package/dist/{types-B2Na677H.d.cts → types-BUPc2Zgw.d.cts} +1 -1
- package/dist/{types-zmUah-vP.d.ts → types-CYtq9Pr9.d.ts} +1 -1
- package/dist/{types-BBb8KoyW.d.ts → types-DlSVGX0w.d.ts} +11 -6
- package/package.json +1 -1
package/dist/realtime.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { P as PlacementPreview, R as RemotePresenceMarkupStroke, A as RemotePresencePeer, D as RemotePresenceCamera, E as RealtimeConnectionState, q as VectorViewportHandle, V as VectorToolDefinition, r as VectorViewportProps, C as CanvasPlugin, e as CanvasPluginRenderContext } from './types-
|
|
2
|
-
export { F as PresenceOverlayRenderContext } from './types-
|
|
1
|
+
import { P as PlacementPreview, R as RemotePresenceMarkupStroke, A as RemotePresencePeer, D as RemotePresenceCamera, E as RealtimeConnectionState, q as VectorViewportHandle, V as VectorToolDefinition, r as VectorViewportProps, C as CanvasPlugin, e as CanvasPluginRenderContext } from './types-BC9Xgfu6.cjs';
|
|
2
|
+
export { F as PresenceOverlayRenderContext } from './types-BC9Xgfu6.cjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { C as Camera2D } from './camera-
|
|
5
|
-
import { V as VectorSceneItem, R as Rect } from './types-
|
|
4
|
+
import { C as Camera2D } from './camera-CVVG7z56.cjs';
|
|
5
|
+
import { V as VectorSceneItem, R as Rect } from './types-BCCvY6ie.cjs';
|
|
6
6
|
import { ReactNode, RefObject } from 'react';
|
|
7
|
-
import { a as VectorCanvasRemoteAdapter } from './types-
|
|
8
|
-
import './shape-builders-
|
|
7
|
+
import { a as VectorCanvasRemoteAdapter } from './types-BUPc2Zgw.cjs';
|
|
8
|
+
import './shape-builders-BAWu-PxX.cjs';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Maps a local {@link PlacementPreview} stroke to {@link RemotePresenceMarkupStroke} for broadcasting.
|
package/dist/realtime.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { P as PlacementPreview, R as RemotePresenceMarkupStroke, A as RemotePresencePeer, D as RemotePresenceCamera, E as RealtimeConnectionState, q as VectorViewportHandle, V as VectorToolDefinition, r as VectorViewportProps, C as CanvasPlugin, e as CanvasPluginRenderContext } from './types-
|
|
2
|
-
export { F as PresenceOverlayRenderContext } from './types-
|
|
1
|
+
import { P as PlacementPreview, R as RemotePresenceMarkupStroke, A as RemotePresencePeer, D as RemotePresenceCamera, E as RealtimeConnectionState, q as VectorViewportHandle, V as VectorToolDefinition, r as VectorViewportProps, C as CanvasPlugin, e as CanvasPluginRenderContext } from './types-DlSVGX0w.js';
|
|
2
|
+
export { F as PresenceOverlayRenderContext } from './types-DlSVGX0w.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { C as Camera2D } from './camera-
|
|
5
|
-
import { V as VectorSceneItem, R as Rect } from './types-
|
|
4
|
+
import { C as Camera2D } from './camera-CoRYN_IV.js';
|
|
5
|
+
import { V as VectorSceneItem, R as Rect } from './types-BCCvY6ie.js';
|
|
6
6
|
import { ReactNode, RefObject } from 'react';
|
|
7
|
-
import { a as VectorCanvasRemoteAdapter } from './types-
|
|
8
|
-
import './shape-builders-
|
|
7
|
+
import { a as VectorCanvasRemoteAdapter } from './types-CYtq9Pr9.js';
|
|
8
|
+
import './shape-builders-ClKv9tz9.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Maps a local {@link PlacementPreview} stroke to {@link RemotePresenceMarkupStroke} for broadcasting.
|
package/dist/realtime.js
CHANGED
|
@@ -149,6 +149,30 @@ function perfectFreehandOptions(toolKind, style, strokeComplete, pressureAware =
|
|
|
149
149
|
simulatePressure: true
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
|
+
function dashArrayForDrawStroke(strokeWidth) {
|
|
153
|
+
const dash = Math.max(strokeWidth * 1.8, 4);
|
|
154
|
+
const gap = Math.max(strokeWidth * 1.4, 3);
|
|
155
|
+
return `${dash} ${gap}`;
|
|
156
|
+
}
|
|
157
|
+
function buildSmoothedCenterlinePath(points) {
|
|
158
|
+
if (points.length < 2) return null;
|
|
159
|
+
const first = points[0];
|
|
160
|
+
if (!first) return null;
|
|
161
|
+
let d = `M ${first.x} ${first.y}`;
|
|
162
|
+
for (let i = 1; i < points.length - 1; i++) {
|
|
163
|
+
const a = points[i];
|
|
164
|
+
const b = points[i + 1];
|
|
165
|
+
if (!a || !b) continue;
|
|
166
|
+
const midX = (a.x + b.x) / 2;
|
|
167
|
+
const midY = (a.y + b.y) / 2;
|
|
168
|
+
d += ` Q ${a.x} ${a.y} ${midX} ${midY}`;
|
|
169
|
+
}
|
|
170
|
+
const last = points[points.length - 1];
|
|
171
|
+
if (last) {
|
|
172
|
+
d += ` L ${last.x} ${last.y}`;
|
|
173
|
+
}
|
|
174
|
+
return d;
|
|
175
|
+
}
|
|
152
176
|
function computeFreehandSvgPayload(pathPointsLocal, style, toolKind, strokeComplete = true) {
|
|
153
177
|
if (pathPointsLocal.length === 0) return null;
|
|
154
178
|
if (pathPointsLocal.length === 1) {
|
|
@@ -163,6 +187,18 @@ function computeFreehandSvgPayload(pathPointsLocal, style, toolKind, strokeCompl
|
|
|
163
187
|
fillOpacity: style.strokeOpacity
|
|
164
188
|
};
|
|
165
189
|
}
|
|
190
|
+
if (style.strokeDash === "dashed" && (toolKind === "draw" || toolKind === "pencil")) {
|
|
191
|
+
const d2 = buildSmoothedCenterlinePath(pathPointsLocal);
|
|
192
|
+
if (!d2) return null;
|
|
193
|
+
return {
|
|
194
|
+
kind: "strokePath",
|
|
195
|
+
d: d2,
|
|
196
|
+
stroke: style.stroke,
|
|
197
|
+
strokeWidth: style.strokeWidth,
|
|
198
|
+
strokeOpacity: style.strokeOpacity,
|
|
199
|
+
strokeDasharray: dashArrayForDrawStroke(style.strokeWidth)
|
|
200
|
+
};
|
|
201
|
+
}
|
|
166
202
|
const hasPressure = pathPointsLocal.some(
|
|
167
203
|
(p) => p.pressure != null && Number.isFinite(p.pressure)
|
|
168
204
|
);
|