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.
Files changed (45) hide show
  1. package/dist/{asset-hydration-DowNdaOJ.d.cts → asset-hydration-B7yMDQE-.d.cts} +2 -2
  2. package/dist/{asset-hydration-DdFLdlqX.d.ts → asset-hydration-CbwQVAwh.d.ts} +2 -2
  3. package/dist/{camera-Di5R_Rwl.d.cts → camera-CVVG7z56.d.cts} +1 -1
  4. package/dist/{camera-AoTwBSoE.d.ts → camera-CoRYN_IV.d.ts} +1 -1
  5. package/dist/chatbot.d.cts +4 -4
  6. package/dist/chatbot.d.ts +4 -4
  7. package/dist/index.cjs +59 -15
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +6 -6
  10. package/dist/index.d.ts +6 -6
  11. package/dist/index.js +59 -15
  12. package/dist/index.js.map +1 -1
  13. package/dist/native.cjs +57 -14
  14. package/dist/native.cjs.map +1 -1
  15. package/dist/native.d.cts +2 -2
  16. package/dist/native.d.ts +2 -2
  17. package/dist/native.js +57 -14
  18. package/dist/native.js.map +1 -1
  19. package/dist/react.cjs +699 -255
  20. package/dist/react.cjs.map +1 -1
  21. package/dist/react.d.cts +10 -10
  22. package/dist/react.d.ts +10 -10
  23. package/dist/react.js +699 -255
  24. package/dist/react.js.map +1 -1
  25. package/dist/realtime.cjs +36 -0
  26. package/dist/realtime.cjs.map +1 -1
  27. package/dist/realtime.d.cts +6 -6
  28. package/dist/realtime.d.ts +6 -6
  29. package/dist/realtime.js +36 -0
  30. package/dist/realtime.js.map +1 -1
  31. package/dist/{shape-builders-Dedcl6tw.d.cts → shape-builders-BAWu-PxX.d.cts} +7 -3
  32. package/dist/{shape-builders-C7bxJBGR.d.ts → shape-builders-ClKv9tz9.d.ts} +7 -3
  33. package/dist/tldraw.cjs +56 -14
  34. package/dist/tldraw.cjs.map +1 -1
  35. package/dist/tldraw.d.cts +1 -1
  36. package/dist/tldraw.d.ts +1 -1
  37. package/dist/tldraw.js +56 -14
  38. package/dist/tldraw.js.map +1 -1
  39. package/dist/{types-DUW61Tjy.d.cts → types-BC9Xgfu6.d.cts} +11 -6
  40. package/dist/{types-Bnq2HtHQ.d.cts → types-BCCvY6ie.d.cts} +2 -0
  41. package/dist/{types-Bnq2HtHQ.d.ts → types-BCCvY6ie.d.ts} +2 -0
  42. package/dist/{types-B2Na677H.d.cts → types-BUPc2Zgw.d.cts} +1 -1
  43. package/dist/{types-zmUah-vP.d.ts → types-CYtq9Pr9.d.ts} +1 -1
  44. package/dist/{types-BBb8KoyW.d.ts → types-DlSVGX0w.d.ts} +11 -6
  45. package/package.json +1 -1
@@ -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-DUW61Tjy.cjs';
2
- export { F as PresenceOverlayRenderContext } from './types-DUW61Tjy.cjs';
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-Di5R_Rwl.cjs';
5
- import { V as VectorSceneItem, R as Rect } from './types-Bnq2HtHQ.cjs';
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-B2Na677H.cjs';
8
- import './shape-builders-Dedcl6tw.cjs';
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.
@@ -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-BBb8KoyW.js';
2
- export { F as PresenceOverlayRenderContext } from './types-BBb8KoyW.js';
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-AoTwBSoE.js';
5
- import { V as VectorSceneItem, R as Rect } from './types-Bnq2HtHQ.js';
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-zmUah-vP.js';
8
- import './shape-builders-C7bxJBGR.js';
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
  );