canvu-react 0.3.29 → 0.3.31

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 +85 -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 +83 -2
  12. package/dist/index.js.map +1 -1
  13. package/dist/native.cjs +66 -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 +66 -0
  18. package/dist/native.js.map +1 -1
  19. package/dist/react.cjs +143 -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 +143 -8
  24. package/dist/react.js.map +1 -1
  25. package/dist/realtime.cjs +11 -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 +11 -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 +68 -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 +68 -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/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { C as Camera2D } from './camera-BwQjm5oh.cjs';
2
- export { a as Camera2DOptions } from './camera-BwQjm5oh.cjs';
3
- import { V as VectorSceneItem, A as ArrowEndpointBinding, R as Rect } from './types-CB0TZZuk.cjs';
4
- export { a as ArrowBindings, b as VectorPathPoint, n as normalizeRect, r as rectsIntersect } from './types-CB0TZZuk.cjs';
5
- export { H as HydratedSceneItemsWithAssetsResult, h as hydrateSceneItemsWithAssets } from './asset-hydration-3Iv5xHxM.cjs';
6
- export { D as DEFAULT_STROKE_STYLE, F as FreehandSvgPayload, S as StrokeStyle, a as applyStrokeToItem, b as buildArrowSvg, c as buildDrawDotSvg, d as buildEllipseSvg, e as buildFreehandPathSvg, f as buildLineSvg, g as buildRectSvg, h as computeFreehandSvgPayload, i as createDrawDotItem, j as createEllipseItem, k as createFreehandStrokeItem, l as createImageFromVectorTrace, m as createImageItem, n as createLineItem, o as createRectangleItem, p as createShapeId, q as createTextItem, r as lineEndpointsToLocal, s as rebuildItemSvg, t as resolveStrokeStyle } from './shape-builders-DFudWDFI.cjs';
1
+ import { C as Camera2D } from './camera-Di5R_Rwl.cjs';
2
+ export { a as Camera2DOptions } from './camera-Di5R_Rwl.cjs';
3
+ import { V as VectorSceneItem, A as ArrowEndpointBinding, R as Rect } from './types-Bnq2HtHQ.cjs';
4
+ export { a as ArrowBindings, b as VectorPathPoint, n as normalizeRect, r as rectsIntersect } from './types-Bnq2HtHQ.cjs';
5
+ export { H as HydratedSceneItemsWithAssetsResult, h as hydrateSceneItemsWithAssets } from './asset-hydration-EtEuBwb7.cjs';
6
+ export { D as DEFAULT_STROKE_STYLE, F as FreehandSvgPayload, S as StrokeStyle, a as applyStrokeToItem, b as buildArchitecturalCloudPathD, c as buildArchitecturalCloudSvg, d as buildArrowSvg, e as buildDrawDotSvg, f as buildEllipseSvg, g as buildFreehandPathSvg, h as buildLineSvg, i as buildRectSvg, j as computeFreehandSvgPayload, k as createArchitecturalCloudItem, l as createDrawDotItem, m as createEllipseItem, n as createFreehandStrokeItem, o as createImageFromVectorTrace, p as createImageItem, q as createLineItem, r as createRectangleItem, s as createShapeId, t as createTextItem, u as lineEndpointsToLocal, v as rebuildItemSvg, w as resolveStrokeStyle } from './shape-builders-CsbSRZnQ.cjs';
7
7
 
8
8
  type EncodeCanvasToBlobOptions = {
9
9
  mimeType?: string;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { C as Camera2D } from './camera-KwCYYPhm.js';
2
- export { a as Camera2DOptions } from './camera-KwCYYPhm.js';
3
- import { V as VectorSceneItem, A as ArrowEndpointBinding, R as Rect } from './types-CB0TZZuk.js';
4
- export { a as ArrowBindings, b as VectorPathPoint, n as normalizeRect, r as rectsIntersect } from './types-CB0TZZuk.js';
5
- export { H as HydratedSceneItemsWithAssetsResult, h as hydrateSceneItemsWithAssets } from './asset-hydration-BEG21hMp.js';
6
- export { D as DEFAULT_STROKE_STYLE, F as FreehandSvgPayload, S as StrokeStyle, a as applyStrokeToItem, b as buildArrowSvg, c as buildDrawDotSvg, d as buildEllipseSvg, e as buildFreehandPathSvg, f as buildLineSvg, g as buildRectSvg, h as computeFreehandSvgPayload, i as createDrawDotItem, j as createEllipseItem, k as createFreehandStrokeItem, l as createImageFromVectorTrace, m as createImageItem, n as createLineItem, o as createRectangleItem, p as createShapeId, q as createTextItem, r as lineEndpointsToLocal, s as rebuildItemSvg, t as resolveStrokeStyle } from './shape-builders-ENwnK-zT.js';
1
+ import { C as Camera2D } from './camera-AoTwBSoE.js';
2
+ export { a as Camera2DOptions } from './camera-AoTwBSoE.js';
3
+ import { V as VectorSceneItem, A as ArrowEndpointBinding, R as Rect } from './types-Bnq2HtHQ.js';
4
+ export { a as ArrowBindings, b as VectorPathPoint, n as normalizeRect, r as rectsIntersect } from './types-Bnq2HtHQ.js';
5
+ export { H as HydratedSceneItemsWithAssetsResult, h as hydrateSceneItemsWithAssets } from './asset-hydration-DrTOgDdd.js';
6
+ export { D as DEFAULT_STROKE_STYLE, F as FreehandSvgPayload, S as StrokeStyle, a as applyStrokeToItem, b as buildArchitecturalCloudPathD, c as buildArchitecturalCloudSvg, d as buildArrowSvg, e as buildDrawDotSvg, f as buildEllipseSvg, g as buildFreehandPathSvg, h as buildLineSvg, i as buildRectSvg, j as computeFreehandSvgPayload, k as createArchitecturalCloudItem, l as createDrawDotItem, m as createEllipseItem, n as createFreehandStrokeItem, o as createImageFromVectorTrace, p as createImageItem, q as createLineItem, r as createRectangleItem, s as createShapeId, t as createTextItem, u as lineEndpointsToLocal, v as rebuildItemSvg, w as resolveStrokeStyle } from './shape-builders-CsSXKCcs.js';
7
7
 
8
8
  type EncodeCanvasToBlobOptions = {
9
9
  mimeType?: string;
package/dist/index.js CHANGED
@@ -1038,6 +1038,22 @@ function resolveStrokeStyle(item) {
1038
1038
  function strokeOpacityAttr(style) {
1039
1039
  return style.strokeOpacity != null ? ` stroke-opacity="${style.strokeOpacity}"` : "";
1040
1040
  }
1041
+ function svgNumber(value) {
1042
+ if (!Number.isFinite(value)) return "0";
1043
+ const rounded = Math.round(value * 100) / 100;
1044
+ return Number.isInteger(rounded) ? String(rounded) : String(rounded);
1045
+ }
1046
+ function approximateEllipsePerimeter(rx, ry) {
1047
+ if (rx <= 0 || ry <= 0) return 0;
1048
+ return Math.PI * (3 * (rx + ry) - Math.sqrt((3 * rx + ry) * (rx + 3 * ry)));
1049
+ }
1050
+ function architecturalCloudScallopCount(rx, ry, amplitude) {
1051
+ const perimeter = approximateEllipsePerimeter(rx, ry);
1052
+ const targetScallopLength = Math.max(10, amplitude * 2);
1053
+ let count = Math.max(12, Math.round(perimeter / targetScallopLength));
1054
+ if (count % 2 === 1) count += 1;
1055
+ return count;
1056
+ }
1041
1057
  function buildRectSvg(width, height, style = DEFAULT_STROKE_STYLE) {
1042
1058
  return `<rect width="${width}" height="${height}" fill="none" stroke="${style.stroke}" stroke-width="${style.strokeWidth}" rx="4"${strokeOpacityAttr(style)} />`;
1043
1059
  }
@@ -1046,6 +1062,49 @@ function buildEllipseSvg(width, height, style = DEFAULT_STROKE_STYLE) {
1046
1062
  const ry = height / 2;
1047
1063
  return `<ellipse cx="${rx}" cy="${ry}" rx="${rx}" ry="${ry}" fill="none" stroke="${style.stroke}" stroke-width="${style.strokeWidth}"${strokeOpacityAttr(style)} />`;
1048
1064
  }
1065
+ function buildArchitecturalCloudPathD(width, height, strokeWidth = DEFAULT_STROKE_STYLE.strokeWidth) {
1066
+ const w = Math.max(0, width);
1067
+ const h = Math.max(0, height);
1068
+ if (w <= 0 || h <= 0) return "";
1069
+ const inset = Math.max(0.5, strokeWidth / 2);
1070
+ const outerRx = Math.max(0, w / 2 - inset);
1071
+ const outerRy = Math.max(0, h / 2 - inset);
1072
+ if (outerRx <= 0 || outerRy <= 0) return "";
1073
+ const amplitude = Math.min(
1074
+ outerRx * 0.45,
1075
+ outerRy * 0.45,
1076
+ Math.max(2, Math.min(8, Math.min(w, h) * 0.04))
1077
+ );
1078
+ const innerRx = Math.max(0, outerRx - amplitude);
1079
+ const innerRy = Math.max(0, outerRy - amplitude);
1080
+ const scallopCount = architecturalCloudScallopCount(innerRx, innerRy, amplitude);
1081
+ const angleStep = Math.PI * 2 / scallopCount;
1082
+ const cx = w / 2;
1083
+ const cy = h / 2;
1084
+ const startAngle = -Math.PI / 2;
1085
+ const pointOnEllipse = (theta, radiusX, radiusY) => [
1086
+ cx + Math.cos(theta) * radiusX,
1087
+ cy + Math.sin(theta) * radiusY
1088
+ ];
1089
+ const [startX, startY] = pointOnEllipse(startAngle, innerRx, innerRy);
1090
+ const segments = [`M${svgNumber(startX)} ${svgNumber(startY)}`];
1091
+ for (let index = 0; index < scallopCount; index += 1) {
1092
+ const segmentStart = startAngle + index * angleStep;
1093
+ const segmentMid = segmentStart + angleStep / 2;
1094
+ const segmentEnd = segmentStart + angleStep;
1095
+ const [controlX, controlY] = pointOnEllipse(segmentMid, outerRx, outerRy);
1096
+ const [endX, endY] = pointOnEllipse(segmentEnd, innerRx, innerRy);
1097
+ segments.push(
1098
+ `Q${svgNumber(controlX)} ${svgNumber(controlY)} ${svgNumber(endX)} ${svgNumber(endY)}`
1099
+ );
1100
+ }
1101
+ segments.push("Z");
1102
+ return segments.join(" ");
1103
+ }
1104
+ function buildArchitecturalCloudSvg(width, height, style = DEFAULT_STROKE_STYLE) {
1105
+ const d = buildArchitecturalCloudPathD(width, height, style.strokeWidth);
1106
+ return `<path d="${d}" fill="none" stroke="${style.stroke}" stroke-width="${style.strokeWidth}" stroke-linecap="round" stroke-linejoin="round"${strokeOpacityAttr(style)} />`;
1107
+ }
1049
1108
  function buildLineSvg(line, style = DEFAULT_STROKE_STYLE) {
1050
1109
  return `<line x1="${line.x1}" y1="${line.y1}" x2="${line.x2}" y2="${line.y2}" stroke="${style.stroke}" stroke-width="${style.strokeWidth}"${strokeOpacityAttr(style)} />`;
1051
1110
  }
@@ -1188,6 +1247,13 @@ function rebuildItemSvg(item) {
1188
1247
  childrenSvg: buildEllipseSvg(b.width, b.height, style)
1189
1248
  };
1190
1249
  }
1250
+ if (k === "architectural-cloud") {
1251
+ const b = normalizeRect(item.bounds);
1252
+ return {
1253
+ ...item,
1254
+ childrenSvg: buildArchitecturalCloudSvg(b.width, b.height, style)
1255
+ };
1256
+ }
1191
1257
  if ((k === "line" || k === "arrow") && item.line) {
1192
1258
  const line = item.line;
1193
1259
  const childrenSvg = k === "arrow" ? buildArrowSvg(item.id, line, style) : buildLineSvg(line, style);
@@ -1300,6 +1366,21 @@ function createEllipseItem(id, bounds, style) {
1300
1366
  childrenSvg: ""
1301
1367
  });
1302
1368
  }
1369
+ function createArchitecturalCloudItem(id, bounds, style) {
1370
+ const r = normalizeRect(bounds);
1371
+ const s = { ...DEFAULT_STROKE_STYLE, ...style };
1372
+ return rebuildItemSvg({
1373
+ id,
1374
+ x: r.x,
1375
+ y: r.y,
1376
+ bounds: { ...r },
1377
+ toolKind: "architectural-cloud",
1378
+ stroke: s.stroke,
1379
+ strokeWidth: s.strokeWidth,
1380
+ ...s.strokeOpacity != null ? { strokeOpacity: s.strokeOpacity } : {},
1381
+ childrenSvg: ""
1382
+ });
1383
+ }
1303
1384
  function createLineItem(id, bounds, line, toolKind, style, arrowBind) {
1304
1385
  const r = normalizeRect(bounds);
1305
1386
  const s = { ...DEFAULT_STROKE_STYLE, ...style };
@@ -1519,7 +1600,7 @@ function isArrowBindTarget(item) {
1519
1600
  if (item.locked) return false;
1520
1601
  const k = item.toolKind;
1521
1602
  if (!k) return false;
1522
- return k === "rect" || k === "ellipse" || k === "text" || k === "image" || k === "custom";
1603
+ return k === "rect" || k === "ellipse" || k === "architectural-cloud" || k === "text" || k === "image" || k === "custom";
1523
1604
  }
1524
1605
  function closestPointOnShapeBoundaryLocal(item, lx, ly, w, h) {
1525
1606
  if (item.toolKind === "ellipse") {
@@ -2386,6 +2467,6 @@ var VectorScene = class {
2386
2467
  }
2387
2468
  };
2388
2469
 
2389
- export { ARROW_BIND_SNAP_PX, Camera2D, DEFAULT_STROKE_STYLE, DEFAULT_TEXT_FONT_SIZE, MANAGED_KEY, MAX_RASTER_EMBED_DIMENSION, SvgVectorRenderer, VectorScene, addManagedImage, applyStrokeToItem, attachApplePencilNavigation, attachViewportInput, bakeArrowItemToAbsolute, buildArrowSvg, buildCustomShapeChildrenSvg, buildDrawDotSvg, buildEllipseSvg, buildFreehandPathSvg, buildLineSvg, buildRectSvg, buildTextSvg, cloneVectorSceneItemWithNewId, cloneVectorSceneItemsWithNewIds, collectEraserTargetsAtWorldPoint, computeFreehandSvgPayload, copyManagedImage, createCustomShapeItem, createDrawDotItem, createEllipseItem, createFreehandStrokeItem, createImageFromVectorTrace, createImageItem, createLineItem, createRectangleItem, createShapeId, createTextItem, cullItemsByViewport, deleteManagedImage, encodeCanvasToBlob, expandCustomShapeTemplate, formatCameraTransform, formatItemPlacementTransform, hitTestWorldPoint, hydrateSceneItemsWithAssets, isArrowBindTarget, isManagedImage, itemHitTestWorldPoint, lineEndpointsToLocal, loadImageFileAsRasterSceneSource, markImageAsManaged, normalizeRect, rebuildItemSvg, rectsIntersect, reorderManagedImages, resolveArrowBindingsInScene, resolveStrokeStyle, restackManagedImages, rotateManagedImage, snapArrowEndpointToShape };
2470
+ export { ARROW_BIND_SNAP_PX, Camera2D, DEFAULT_STROKE_STYLE, DEFAULT_TEXT_FONT_SIZE, MANAGED_KEY, MAX_RASTER_EMBED_DIMENSION, SvgVectorRenderer, VectorScene, addManagedImage, applyStrokeToItem, attachApplePencilNavigation, attachViewportInput, bakeArrowItemToAbsolute, buildArchitecturalCloudPathD, buildArchitecturalCloudSvg, buildArrowSvg, buildCustomShapeChildrenSvg, buildDrawDotSvg, buildEllipseSvg, buildFreehandPathSvg, buildLineSvg, buildRectSvg, buildTextSvg, cloneVectorSceneItemWithNewId, cloneVectorSceneItemsWithNewIds, collectEraserTargetsAtWorldPoint, computeFreehandSvgPayload, copyManagedImage, createArchitecturalCloudItem, createCustomShapeItem, createDrawDotItem, createEllipseItem, createFreehandStrokeItem, createImageFromVectorTrace, createImageItem, createLineItem, createRectangleItem, createShapeId, createTextItem, cullItemsByViewport, deleteManagedImage, encodeCanvasToBlob, expandCustomShapeTemplate, formatCameraTransform, formatItemPlacementTransform, hitTestWorldPoint, hydrateSceneItemsWithAssets, isArrowBindTarget, isManagedImage, itemHitTestWorldPoint, lineEndpointsToLocal, loadImageFileAsRasterSceneSource, markImageAsManaged, normalizeRect, rebuildItemSvg, rectsIntersect, reorderManagedImages, resolveArrowBindingsInScene, resolveStrokeStyle, restackManagedImages, rotateManagedImage, snapArrowEndpointToShape };
2390
2471
  //# sourceMappingURL=index.js.map
2391
2472
  //# sourceMappingURL=index.js.map