canvu-react 0.3.38 → 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-EtEuBwb7.d.cts → asset-hydration-B7yMDQE-.d.cts} +2 -2
  2. package/dist/{asset-hydration-DrTOgDdd.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 +164 -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 +159 -16
  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 +731 -258
  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 +731 -258
  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-CsbSRZnQ.d.cts → shape-builders-BAWu-PxX.d.cts} +46 -4
  32. package/dist/{shape-builders-CsSXKCcs.d.ts → shape-builders-ClKv9tz9.d.ts} +46 -4
  33. package/dist/tldraw.cjs +189 -78
  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 +189 -78
  38. package/dist/tldraw.js.map +1 -1
  39. package/dist/{types-DWGk2_GZ.d.cts → types-BC9Xgfu6.d.cts} +20 -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-B6PAYKzx.d.ts → types-DlSVGX0w.d.ts} +20 -6
  45. package/package.json +1 -1
package/dist/realtime.cjs CHANGED
@@ -155,6 +155,30 @@ function perfectFreehandOptions(toolKind, style, strokeComplete, pressureAware =
155
155
  simulatePressure: true
156
156
  };
157
157
  }
158
+ function dashArrayForDrawStroke(strokeWidth) {
159
+ const dash = Math.max(strokeWidth * 1.8, 4);
160
+ const gap = Math.max(strokeWidth * 1.4, 3);
161
+ return `${dash} ${gap}`;
162
+ }
163
+ function buildSmoothedCenterlinePath(points) {
164
+ if (points.length < 2) return null;
165
+ const first = points[0];
166
+ if (!first) return null;
167
+ let d = `M ${first.x} ${first.y}`;
168
+ for (let i = 1; i < points.length - 1; i++) {
169
+ const a = points[i];
170
+ const b = points[i + 1];
171
+ if (!a || !b) continue;
172
+ const midX = (a.x + b.x) / 2;
173
+ const midY = (a.y + b.y) / 2;
174
+ d += ` Q ${a.x} ${a.y} ${midX} ${midY}`;
175
+ }
176
+ const last = points[points.length - 1];
177
+ if (last) {
178
+ d += ` L ${last.x} ${last.y}`;
179
+ }
180
+ return d;
181
+ }
158
182
  function computeFreehandSvgPayload(pathPointsLocal, style, toolKind, strokeComplete = true) {
159
183
  if (pathPointsLocal.length === 0) return null;
160
184
  if (pathPointsLocal.length === 1) {
@@ -169,6 +193,18 @@ function computeFreehandSvgPayload(pathPointsLocal, style, toolKind, strokeCompl
169
193
  fillOpacity: style.strokeOpacity
170
194
  };
171
195
  }
196
+ if (style.strokeDash === "dashed" && (toolKind === "draw" || toolKind === "pencil")) {
197
+ const d2 = buildSmoothedCenterlinePath(pathPointsLocal);
198
+ if (!d2) return null;
199
+ return {
200
+ kind: "strokePath",
201
+ d: d2,
202
+ stroke: style.stroke,
203
+ strokeWidth: style.strokeWidth,
204
+ strokeOpacity: style.strokeOpacity,
205
+ strokeDasharray: dashArrayForDrawStroke(style.strokeWidth)
206
+ };
207
+ }
172
208
  const hasPressure = pathPointsLocal.some(
173
209
  (p) => p.pressure != null && Number.isFinite(p.pressure)
174
210
  );