canvu-react 0.3.28 → 0.3.30

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-BEG21hMp.d.ts → asset-hydration-DrTOgDdd.d.ts} +2 -2
  2. package/dist/{asset-hydration-3Iv5xHxM.d.cts → asset-hydration-EtEuBwb7.d.cts} +2 -2
  3. package/dist/{camera-KwCYYPhm.d.ts → camera-AoTwBSoE.d.ts} +1 -1
  4. package/dist/{camera-BwQjm5oh.d.cts → camera-Di5R_Rwl.d.cts} +1 -1
  5. package/dist/chatbot.d.cts +4 -4
  6. package/dist/chatbot.d.ts +4 -4
  7. package/dist/index.cjs +118 -1
  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 +116 -2
  12. package/dist/index.js.map +1 -1
  13. package/dist/native.cjs +99 -0
  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 +99 -0
  18. package/dist/native.js.map +1 -1
  19. package/dist/react.cjs +183 -7
  20. package/dist/react.cjs.map +1 -1
  21. package/dist/react.d.cts +15 -12
  22. package/dist/react.d.ts +15 -12
  23. package/dist/react.js +183 -8
  24. package/dist/react.js.map +1 -1
  25. package/dist/realtime.cjs +10 -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 +10 -0
  30. package/dist/realtime.js.map +1 -1
  31. package/dist/{shape-builders-DFudWDFI.d.cts → shape-builders-CsSXKCcs.d.ts} +43 -2
  32. package/dist/{shape-builders-ENwnK-zT.d.ts → shape-builders-CsbSRZnQ.d.cts} +43 -2
  33. package/dist/tldraw.cjs +101 -2
  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 +101 -2
  38. package/dist/tldraw.js.map +1 -1
  39. package/dist/{types-DNwjgs5U.d.cts → types-B2Na677H.d.cts} +1 -1
  40. package/dist/{types-BLXR7g_L.d.cts → types-B6PAYKzx.d.ts} +4 -4
  41. package/dist/{types-CB0TZZuk.d.cts → types-Bnq2HtHQ.d.cts} +1 -1
  42. package/dist/{types-CB0TZZuk.d.ts → types-Bnq2HtHQ.d.ts} +1 -1
  43. package/dist/{types-Cm7IsgL4.d.ts → types-DWGk2_GZ.d.cts} +4 -4
  44. package/dist/{types-BtAJFS_-.d.ts → types-zmUah-vP.d.ts} +1 -1
  45. package/package.json +1 -1
package/dist/native.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Camera2D } from './camera-BwQjm5oh.cjs';
3
- import { V as VectorSceneItem, R as Rect } from './types-CB0TZZuk.cjs';
2
+ import { C as Camera2D } from './camera-Di5R_Rwl.cjs';
3
+ import { V as VectorSceneItem, R as Rect } from './types-Bnq2HtHQ.cjs';
4
4
  import * as react from 'react';
5
5
 
6
6
  type PlacementPreview = {
package/dist/native.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Camera2D } from './camera-KwCYYPhm.js';
3
- import { V as VectorSceneItem, R as Rect } from './types-CB0TZZuk.js';
2
+ import { C as Camera2D } from './camera-AoTwBSoE.js';
3
+ import { V as VectorSceneItem, R as Rect } from './types-Bnq2HtHQ.js';
4
4
  import * as react from 'react';
5
5
 
6
6
  type PlacementPreview = {
package/dist/native.js CHANGED
@@ -343,6 +343,41 @@ function resolveStrokeStyle(item) {
343
343
  function strokeOpacityAttr(style) {
344
344
  return style.strokeOpacity != null ? ` stroke-opacity="${style.strokeOpacity}"` : "";
345
345
  }
346
+ function clampNumber(value, min, max) {
347
+ return Math.min(max, Math.max(min, value));
348
+ }
349
+ function svgNumber(value) {
350
+ if (!Number.isFinite(value)) return "0";
351
+ return Number(value.toFixed(3)).toString();
352
+ }
353
+ function architecturalCloudScallopCount(length, depth) {
354
+ if (length <= 1e-6) return 0;
355
+ return Math.max(1, Math.round(length / Math.max(depth * 2.05, 8)));
356
+ }
357
+ function appendHorizontalScallops(segments, startX, endX, y, controlY, count) {
358
+ if (count <= 0) return;
359
+ const step = (endX - startX) / count;
360
+ for (let index = 1; index <= count; index += 1) {
361
+ const x0 = startX + step * (index - 1);
362
+ const x1 = index === count ? endX : startX + step * index;
363
+ const cx = (x0 + x1) / 2;
364
+ segments.push(
365
+ `Q${svgNumber(cx)} ${svgNumber(controlY)} ${svgNumber(x1)} ${svgNumber(y)}`
366
+ );
367
+ }
368
+ }
369
+ function appendVerticalScallops(segments, startY, endY, x, controlX, count) {
370
+ if (count <= 0) return;
371
+ const step = (endY - startY) / count;
372
+ for (let index = 1; index <= count; index += 1) {
373
+ const y0 = startY + step * (index - 1);
374
+ const y1 = index === count ? endY : startY + step * index;
375
+ const cy = (y0 + y1) / 2;
376
+ segments.push(
377
+ `Q${svgNumber(controlX)} ${svgNumber(cy)} ${svgNumber(x)} ${svgNumber(y1)}`
378
+ );
379
+ }
380
+ }
346
381
  function buildRectSvg(width, height, style = DEFAULT_STROKE_STYLE) {
347
382
  return `<rect width="${width}" height="${height}" fill="none" stroke="${style.stroke}" stroke-width="${style.strokeWidth}" rx="4"${strokeOpacityAttr(style)} />`;
348
383
  }
@@ -351,6 +386,63 @@ function buildEllipseSvg(width, height, style = DEFAULT_STROKE_STYLE) {
351
386
  const ry = height / 2;
352
387
  return `<ellipse cx="${rx}" cy="${ry}" rx="${rx}" ry="${ry}" fill="none" stroke="${style.stroke}" stroke-width="${style.strokeWidth}"${strokeOpacityAttr(style)} />`;
353
388
  }
389
+ function buildArchitecturalCloudPathD(width, height, strokeWidth = DEFAULT_STROKE_STYLE.strokeWidth) {
390
+ const w = Math.max(0, width);
391
+ const h = Math.max(0, height);
392
+ if (w <= 0 || h <= 0) return "";
393
+ const inset = Math.min(w / 2, h / 2, Math.max(0.5, strokeWidth / 2));
394
+ const x0 = inset;
395
+ const y0 = inset;
396
+ const x1 = Math.max(x0, w - inset);
397
+ const y1 = Math.max(y0, h - inset);
398
+ const innerW = Math.max(0, x1 - x0);
399
+ const innerH = Math.max(0, y1 - y0);
400
+ if (innerW <= 0 || innerH <= 0) return "";
401
+ const maxDepth = Math.max(0.5, Math.min(innerW, innerH) * 0.18);
402
+ const depth = clampNumber(Math.min(w, h) * 0.08, 2, Math.min(12, maxDepth));
403
+ const corner = Math.min(depth * 1.2, innerW / 2, innerH / 2);
404
+ const topStart = x0 + corner;
405
+ const topEnd = x1 - corner;
406
+ const rightStart = y0 + corner;
407
+ const rightEnd = y1 - corner;
408
+ const bottomStart = x1 - corner;
409
+ const bottomEnd = x0 + corner;
410
+ const leftStart = y1 - corner;
411
+ const leftEnd = y0 + corner;
412
+ const topCount = architecturalCloudScallopCount(topEnd - topStart, depth);
413
+ const rightCount = architecturalCloudScallopCount(rightEnd - rightStart, depth);
414
+ const bottomCount = architecturalCloudScallopCount(bottomStart - bottomEnd, depth);
415
+ const leftCount = architecturalCloudScallopCount(leftStart - leftEnd, depth);
416
+ const segments = [`M${svgNumber(topStart)} ${svgNumber(y0)}`];
417
+ appendHorizontalScallops(segments, topStart, topEnd, y0, y0 + depth, topCount);
418
+ segments.push(
419
+ `Q${svgNumber(x1)} ${svgNumber(y0)} ${svgNumber(x1)} ${svgNumber(rightStart)}`
420
+ );
421
+ appendVerticalScallops(segments, rightStart, rightEnd, x1, x1 - depth, rightCount);
422
+ segments.push(
423
+ `Q${svgNumber(x1)} ${svgNumber(y1)} ${svgNumber(bottomStart)} ${svgNumber(y1)}`
424
+ );
425
+ appendHorizontalScallops(
426
+ segments,
427
+ bottomStart,
428
+ bottomEnd,
429
+ y1,
430
+ y1 - depth,
431
+ bottomCount
432
+ );
433
+ segments.push(
434
+ `Q${svgNumber(x0)} ${svgNumber(y1)} ${svgNumber(x0)} ${svgNumber(leftStart)}`
435
+ );
436
+ appendVerticalScallops(segments, leftStart, leftEnd, x0, x0 + depth, leftCount);
437
+ segments.push(
438
+ `Q${svgNumber(x0)} ${svgNumber(y0)} ${svgNumber(topStart)} ${svgNumber(y0)} Z`
439
+ );
440
+ return segments.join(" ");
441
+ }
442
+ function buildArchitecturalCloudSvg(width, height, style = DEFAULT_STROKE_STYLE) {
443
+ const d = buildArchitecturalCloudPathD(width, height, style.strokeWidth);
444
+ return `<path d="${d}" fill="none" stroke="${style.stroke}" stroke-width="${style.strokeWidth}" stroke-linecap="round" stroke-linejoin="round"${strokeOpacityAttr(style)} />`;
445
+ }
354
446
  function buildLineSvg(line, style = DEFAULT_STROKE_STYLE) {
355
447
  return `<line x1="${line.x1}" y1="${line.y1}" x2="${line.x2}" y2="${line.y2}" stroke="${style.stroke}" stroke-width="${style.strokeWidth}"${strokeOpacityAttr(style)} />`;
356
448
  }
@@ -484,6 +576,13 @@ function rebuildItemSvg(item) {
484
576
  childrenSvg: buildEllipseSvg(b.width, b.height, style)
485
577
  };
486
578
  }
579
+ if (k === "architectural-cloud") {
580
+ const b = normalizeRect(item.bounds);
581
+ return {
582
+ ...item,
583
+ childrenSvg: buildArchitecturalCloudSvg(b.width, b.height, style)
584
+ };
585
+ }
487
586
  if ((k === "line" || k === "arrow") && item.line) {
488
587
  const line = item.line;
489
588
  const childrenSvg = k === "arrow" ? buildArrowSvg(item.id, line, style) : buildLineSvg(line, style);