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.
- package/dist/{asset-hydration-BEG21hMp.d.ts → asset-hydration-DrTOgDdd.d.ts} +2 -2
- package/dist/{asset-hydration-3Iv5xHxM.d.cts → asset-hydration-EtEuBwb7.d.cts} +2 -2
- package/dist/{camera-KwCYYPhm.d.ts → camera-AoTwBSoE.d.ts} +1 -1
- package/dist/{camera-BwQjm5oh.d.cts → camera-Di5R_Rwl.d.cts} +1 -1
- package/dist/chatbot.d.cts +4 -4
- package/dist/chatbot.d.ts +4 -4
- package/dist/index.cjs +85 -1
- 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 +83 -2
- package/dist/index.js.map +1 -1
- package/dist/native.cjs +66 -0
- 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 +66 -0
- package/dist/native.js.map +1 -1
- package/dist/react.cjs +143 -7
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +15 -12
- package/dist/react.d.ts +15 -12
- package/dist/react.js +143 -8
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs +11 -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 +11 -0
- package/dist/realtime.js.map +1 -1
- package/dist/{shape-builders-DFudWDFI.d.cts → shape-builders-CsSXKCcs.d.ts} +43 -2
- package/dist/{shape-builders-ENwnK-zT.d.ts → shape-builders-CsbSRZnQ.d.cts} +43 -2
- package/dist/tldraw.cjs +68 -2
- 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 +68 -2
- package/dist/tldraw.js.map +1 -1
- package/dist/{types-DNwjgs5U.d.cts → types-B2Na677H.d.cts} +1 -1
- package/dist/{types-BLXR7g_L.d.cts → types-B6PAYKzx.d.ts} +4 -4
- package/dist/{types-CB0TZZuk.d.cts → types-Bnq2HtHQ.d.cts} +1 -1
- package/dist/{types-CB0TZZuk.d.ts → types-Bnq2HtHQ.d.ts} +1 -1
- package/dist/{types-Cm7IsgL4.d.ts → types-DWGk2_GZ.d.cts} +4 -4
- package/dist/{types-BtAJFS_-.d.ts → types-zmUah-vP.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as VectorSceneItem } from './types-
|
|
2
|
-
import {
|
|
1
|
+
import { V as VectorSceneItem } from './types-Bnq2HtHQ.js';
|
|
2
|
+
import { x as VectorViewportAssetStore } from './shape-builders-CsSXKCcs.js';
|
|
3
3
|
|
|
4
4
|
declare class IndexedDbImageStore {
|
|
5
5
|
private dbPromise;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as VectorSceneItem } from './types-
|
|
2
|
-
import {
|
|
1
|
+
import { V as VectorSceneItem } from './types-Bnq2HtHQ.cjs';
|
|
2
|
+
import { x as VectorViewportAssetStore } from './shape-builders-CsbSRZnQ.cjs';
|
|
3
3
|
|
|
4
4
|
declare class IndexedDbImageStore {
|
|
5
5
|
private dbPromise;
|
package/dist/chatbot.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { C as CanvasPlugin } from './types-
|
|
2
|
+
import { C as CanvasPlugin } from './types-DWGk2_GZ.cjs';
|
|
3
3
|
import 'react';
|
|
4
|
-
import './types-
|
|
5
|
-
import './camera-
|
|
6
|
-
import './shape-builders-
|
|
4
|
+
import './types-Bnq2HtHQ.cjs';
|
|
5
|
+
import './camera-Di5R_Rwl.cjs';
|
|
6
|
+
import './shape-builders-CsbSRZnQ.cjs';
|
|
7
7
|
|
|
8
8
|
type ChatbotPluginPanelProps = {
|
|
9
9
|
/**
|
package/dist/chatbot.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { C as CanvasPlugin } from './types-
|
|
2
|
+
import { C as CanvasPlugin } from './types-B6PAYKzx.js';
|
|
3
3
|
import 'react';
|
|
4
|
-
import './types-
|
|
5
|
-
import './camera-
|
|
6
|
-
import './shape-builders-
|
|
4
|
+
import './types-Bnq2HtHQ.js';
|
|
5
|
+
import './camera-AoTwBSoE.js';
|
|
6
|
+
import './shape-builders-CsSXKCcs.js';
|
|
7
7
|
|
|
8
8
|
type ChatbotPluginPanelProps = {
|
|
9
9
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -1045,6 +1045,22 @@ function resolveStrokeStyle(item) {
|
|
|
1045
1045
|
function strokeOpacityAttr(style) {
|
|
1046
1046
|
return style.strokeOpacity != null ? ` stroke-opacity="${style.strokeOpacity}"` : "";
|
|
1047
1047
|
}
|
|
1048
|
+
function svgNumber(value) {
|
|
1049
|
+
if (!Number.isFinite(value)) return "0";
|
|
1050
|
+
const rounded = Math.round(value * 100) / 100;
|
|
1051
|
+
return Number.isInteger(rounded) ? String(rounded) : String(rounded);
|
|
1052
|
+
}
|
|
1053
|
+
function approximateEllipsePerimeter(rx, ry) {
|
|
1054
|
+
if (rx <= 0 || ry <= 0) return 0;
|
|
1055
|
+
return Math.PI * (3 * (rx + ry) - Math.sqrt((3 * rx + ry) * (rx + 3 * ry)));
|
|
1056
|
+
}
|
|
1057
|
+
function architecturalCloudScallopCount(rx, ry, amplitude) {
|
|
1058
|
+
const perimeter = approximateEllipsePerimeter(rx, ry);
|
|
1059
|
+
const targetScallopLength = Math.max(10, amplitude * 2);
|
|
1060
|
+
let count = Math.max(12, Math.round(perimeter / targetScallopLength));
|
|
1061
|
+
if (count % 2 === 1) count += 1;
|
|
1062
|
+
return count;
|
|
1063
|
+
}
|
|
1048
1064
|
function buildRectSvg(width, height, style = DEFAULT_STROKE_STYLE) {
|
|
1049
1065
|
return `<rect width="${width}" height="${height}" fill="none" stroke="${style.stroke}" stroke-width="${style.strokeWidth}" rx="4"${strokeOpacityAttr(style)} />`;
|
|
1050
1066
|
}
|
|
@@ -1053,6 +1069,49 @@ function buildEllipseSvg(width, height, style = DEFAULT_STROKE_STYLE) {
|
|
|
1053
1069
|
const ry = height / 2;
|
|
1054
1070
|
return `<ellipse cx="${rx}" cy="${ry}" rx="${rx}" ry="${ry}" fill="none" stroke="${style.stroke}" stroke-width="${style.strokeWidth}"${strokeOpacityAttr(style)} />`;
|
|
1055
1071
|
}
|
|
1072
|
+
function buildArchitecturalCloudPathD(width, height, strokeWidth = DEFAULT_STROKE_STYLE.strokeWidth) {
|
|
1073
|
+
const w = Math.max(0, width);
|
|
1074
|
+
const h = Math.max(0, height);
|
|
1075
|
+
if (w <= 0 || h <= 0) return "";
|
|
1076
|
+
const inset = Math.max(0.5, strokeWidth / 2);
|
|
1077
|
+
const outerRx = Math.max(0, w / 2 - inset);
|
|
1078
|
+
const outerRy = Math.max(0, h / 2 - inset);
|
|
1079
|
+
if (outerRx <= 0 || outerRy <= 0) return "";
|
|
1080
|
+
const amplitude = Math.min(
|
|
1081
|
+
outerRx * 0.45,
|
|
1082
|
+
outerRy * 0.45,
|
|
1083
|
+
Math.max(2, Math.min(8, Math.min(w, h) * 0.04))
|
|
1084
|
+
);
|
|
1085
|
+
const innerRx = Math.max(0, outerRx - amplitude);
|
|
1086
|
+
const innerRy = Math.max(0, outerRy - amplitude);
|
|
1087
|
+
const scallopCount = architecturalCloudScallopCount(innerRx, innerRy, amplitude);
|
|
1088
|
+
const angleStep = Math.PI * 2 / scallopCount;
|
|
1089
|
+
const cx = w / 2;
|
|
1090
|
+
const cy = h / 2;
|
|
1091
|
+
const startAngle = -Math.PI / 2;
|
|
1092
|
+
const pointOnEllipse = (theta, radiusX, radiusY) => [
|
|
1093
|
+
cx + Math.cos(theta) * radiusX,
|
|
1094
|
+
cy + Math.sin(theta) * radiusY
|
|
1095
|
+
];
|
|
1096
|
+
const [startX, startY] = pointOnEllipse(startAngle, innerRx, innerRy);
|
|
1097
|
+
const segments = [`M${svgNumber(startX)} ${svgNumber(startY)}`];
|
|
1098
|
+
for (let index = 0; index < scallopCount; index += 1) {
|
|
1099
|
+
const segmentStart = startAngle + index * angleStep;
|
|
1100
|
+
const segmentMid = segmentStart + angleStep / 2;
|
|
1101
|
+
const segmentEnd = segmentStart + angleStep;
|
|
1102
|
+
const [controlX, controlY] = pointOnEllipse(segmentMid, outerRx, outerRy);
|
|
1103
|
+
const [endX, endY] = pointOnEllipse(segmentEnd, innerRx, innerRy);
|
|
1104
|
+
segments.push(
|
|
1105
|
+
`Q${svgNumber(controlX)} ${svgNumber(controlY)} ${svgNumber(endX)} ${svgNumber(endY)}`
|
|
1106
|
+
);
|
|
1107
|
+
}
|
|
1108
|
+
segments.push("Z");
|
|
1109
|
+
return segments.join(" ");
|
|
1110
|
+
}
|
|
1111
|
+
function buildArchitecturalCloudSvg(width, height, style = DEFAULT_STROKE_STYLE) {
|
|
1112
|
+
const d = buildArchitecturalCloudPathD(width, height, style.strokeWidth);
|
|
1113
|
+
return `<path d="${d}" fill="none" stroke="${style.stroke}" stroke-width="${style.strokeWidth}" stroke-linecap="round" stroke-linejoin="round"${strokeOpacityAttr(style)} />`;
|
|
1114
|
+
}
|
|
1056
1115
|
function buildLineSvg(line, style = DEFAULT_STROKE_STYLE) {
|
|
1057
1116
|
return `<line x1="${line.x1}" y1="${line.y1}" x2="${line.x2}" y2="${line.y2}" stroke="${style.stroke}" stroke-width="${style.strokeWidth}"${strokeOpacityAttr(style)} />`;
|
|
1058
1117
|
}
|
|
@@ -1195,6 +1254,13 @@ function rebuildItemSvg(item) {
|
|
|
1195
1254
|
childrenSvg: buildEllipseSvg(b.width, b.height, style)
|
|
1196
1255
|
};
|
|
1197
1256
|
}
|
|
1257
|
+
if (k === "architectural-cloud") {
|
|
1258
|
+
const b = normalizeRect(item.bounds);
|
|
1259
|
+
return {
|
|
1260
|
+
...item,
|
|
1261
|
+
childrenSvg: buildArchitecturalCloudSvg(b.width, b.height, style)
|
|
1262
|
+
};
|
|
1263
|
+
}
|
|
1198
1264
|
if ((k === "line" || k === "arrow") && item.line) {
|
|
1199
1265
|
const line = item.line;
|
|
1200
1266
|
const childrenSvg = k === "arrow" ? buildArrowSvg(item.id, line, style) : buildLineSvg(line, style);
|
|
@@ -1307,6 +1373,21 @@ function createEllipseItem(id, bounds, style) {
|
|
|
1307
1373
|
childrenSvg: ""
|
|
1308
1374
|
});
|
|
1309
1375
|
}
|
|
1376
|
+
function createArchitecturalCloudItem(id, bounds, style) {
|
|
1377
|
+
const r = normalizeRect(bounds);
|
|
1378
|
+
const s = { ...DEFAULT_STROKE_STYLE, ...style };
|
|
1379
|
+
return rebuildItemSvg({
|
|
1380
|
+
id,
|
|
1381
|
+
x: r.x,
|
|
1382
|
+
y: r.y,
|
|
1383
|
+
bounds: { ...r },
|
|
1384
|
+
toolKind: "architectural-cloud",
|
|
1385
|
+
stroke: s.stroke,
|
|
1386
|
+
strokeWidth: s.strokeWidth,
|
|
1387
|
+
...s.strokeOpacity != null ? { strokeOpacity: s.strokeOpacity } : {},
|
|
1388
|
+
childrenSvg: ""
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1310
1391
|
function createLineItem(id, bounds, line, toolKind, style, arrowBind) {
|
|
1311
1392
|
const r = normalizeRect(bounds);
|
|
1312
1393
|
const s = { ...DEFAULT_STROKE_STYLE, ...style };
|
|
@@ -1526,7 +1607,7 @@ function isArrowBindTarget(item) {
|
|
|
1526
1607
|
if (item.locked) return false;
|
|
1527
1608
|
const k = item.toolKind;
|
|
1528
1609
|
if (!k) return false;
|
|
1529
|
-
return k === "rect" || k === "ellipse" || k === "text" || k === "image" || k === "custom";
|
|
1610
|
+
return k === "rect" || k === "ellipse" || k === "architectural-cloud" || k === "text" || k === "image" || k === "custom";
|
|
1530
1611
|
}
|
|
1531
1612
|
function closestPointOnShapeBoundaryLocal(item, lx, ly, w, h) {
|
|
1532
1613
|
if (item.toolKind === "ellipse") {
|
|
@@ -2406,6 +2487,8 @@ exports.applyStrokeToItem = applyStrokeToItem;
|
|
|
2406
2487
|
exports.attachApplePencilNavigation = attachApplePencilNavigation;
|
|
2407
2488
|
exports.attachViewportInput = attachViewportInput;
|
|
2408
2489
|
exports.bakeArrowItemToAbsolute = bakeArrowItemToAbsolute;
|
|
2490
|
+
exports.buildArchitecturalCloudPathD = buildArchitecturalCloudPathD;
|
|
2491
|
+
exports.buildArchitecturalCloudSvg = buildArchitecturalCloudSvg;
|
|
2409
2492
|
exports.buildArrowSvg = buildArrowSvg;
|
|
2410
2493
|
exports.buildCustomShapeChildrenSvg = buildCustomShapeChildrenSvg;
|
|
2411
2494
|
exports.buildDrawDotSvg = buildDrawDotSvg;
|
|
@@ -2419,6 +2502,7 @@ exports.cloneVectorSceneItemsWithNewIds = cloneVectorSceneItemsWithNewIds;
|
|
|
2419
2502
|
exports.collectEraserTargetsAtWorldPoint = collectEraserTargetsAtWorldPoint;
|
|
2420
2503
|
exports.computeFreehandSvgPayload = computeFreehandSvgPayload;
|
|
2421
2504
|
exports.copyManagedImage = copyManagedImage;
|
|
2505
|
+
exports.createArchitecturalCloudItem = createArchitecturalCloudItem;
|
|
2422
2506
|
exports.createCustomShapeItem = createCustomShapeItem;
|
|
2423
2507
|
exports.createDrawDotItem = createDrawDotItem;
|
|
2424
2508
|
exports.createEllipseItem = createEllipseItem;
|