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.
- 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 +118 -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 +116 -2
- package/dist/index.js.map +1 -1
- package/dist/native.cjs +99 -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 +99 -0
- package/dist/native.js.map +1 -1
- package/dist/react.cjs +183 -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 +183 -8
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs +10 -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 +10 -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 +101 -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 +101 -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,41 @@ function resolveStrokeStyle(item) {
|
|
|
1045
1045
|
function strokeOpacityAttr(style) {
|
|
1046
1046
|
return style.strokeOpacity != null ? ` stroke-opacity="${style.strokeOpacity}"` : "";
|
|
1047
1047
|
}
|
|
1048
|
+
function clampNumber(value, min, max) {
|
|
1049
|
+
return Math.min(max, Math.max(min, value));
|
|
1050
|
+
}
|
|
1051
|
+
function svgNumber(value) {
|
|
1052
|
+
if (!Number.isFinite(value)) return "0";
|
|
1053
|
+
return Number(value.toFixed(3)).toString();
|
|
1054
|
+
}
|
|
1055
|
+
function architecturalCloudScallopCount(length, depth) {
|
|
1056
|
+
if (length <= 1e-6) return 0;
|
|
1057
|
+
return Math.max(1, Math.round(length / Math.max(depth * 2.05, 8)));
|
|
1058
|
+
}
|
|
1059
|
+
function appendHorizontalScallops(segments, startX, endX, y, controlY, count) {
|
|
1060
|
+
if (count <= 0) return;
|
|
1061
|
+
const step = (endX - startX) / count;
|
|
1062
|
+
for (let index = 1; index <= count; index += 1) {
|
|
1063
|
+
const x0 = startX + step * (index - 1);
|
|
1064
|
+
const x1 = index === count ? endX : startX + step * index;
|
|
1065
|
+
const cx = (x0 + x1) / 2;
|
|
1066
|
+
segments.push(
|
|
1067
|
+
`Q${svgNumber(cx)} ${svgNumber(controlY)} ${svgNumber(x1)} ${svgNumber(y)}`
|
|
1068
|
+
);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
function appendVerticalScallops(segments, startY, endY, x, controlX, count) {
|
|
1072
|
+
if (count <= 0) return;
|
|
1073
|
+
const step = (endY - startY) / count;
|
|
1074
|
+
for (let index = 1; index <= count; index += 1) {
|
|
1075
|
+
const y0 = startY + step * (index - 1);
|
|
1076
|
+
const y1 = index === count ? endY : startY + step * index;
|
|
1077
|
+
const cy = (y0 + y1) / 2;
|
|
1078
|
+
segments.push(
|
|
1079
|
+
`Q${svgNumber(controlX)} ${svgNumber(cy)} ${svgNumber(x)} ${svgNumber(y1)}`
|
|
1080
|
+
);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1048
1083
|
function buildRectSvg(width, height, style = DEFAULT_STROKE_STYLE) {
|
|
1049
1084
|
return `<rect width="${width}" height="${height}" fill="none" stroke="${style.stroke}" stroke-width="${style.strokeWidth}" rx="4"${strokeOpacityAttr(style)} />`;
|
|
1050
1085
|
}
|
|
@@ -1053,6 +1088,63 @@ function buildEllipseSvg(width, height, style = DEFAULT_STROKE_STYLE) {
|
|
|
1053
1088
|
const ry = height / 2;
|
|
1054
1089
|
return `<ellipse cx="${rx}" cy="${ry}" rx="${rx}" ry="${ry}" fill="none" stroke="${style.stroke}" stroke-width="${style.strokeWidth}"${strokeOpacityAttr(style)} />`;
|
|
1055
1090
|
}
|
|
1091
|
+
function buildArchitecturalCloudPathD(width, height, strokeWidth = DEFAULT_STROKE_STYLE.strokeWidth) {
|
|
1092
|
+
const w = Math.max(0, width);
|
|
1093
|
+
const h = Math.max(0, height);
|
|
1094
|
+
if (w <= 0 || h <= 0) return "";
|
|
1095
|
+
const inset = Math.min(w / 2, h / 2, Math.max(0.5, strokeWidth / 2));
|
|
1096
|
+
const x0 = inset;
|
|
1097
|
+
const y0 = inset;
|
|
1098
|
+
const x1 = Math.max(x0, w - inset);
|
|
1099
|
+
const y1 = Math.max(y0, h - inset);
|
|
1100
|
+
const innerW = Math.max(0, x1 - x0);
|
|
1101
|
+
const innerH = Math.max(0, y1 - y0);
|
|
1102
|
+
if (innerW <= 0 || innerH <= 0) return "";
|
|
1103
|
+
const maxDepth = Math.max(0.5, Math.min(innerW, innerH) * 0.18);
|
|
1104
|
+
const depth = clampNumber(Math.min(w, h) * 0.08, 2, Math.min(12, maxDepth));
|
|
1105
|
+
const corner = Math.min(depth * 1.2, innerW / 2, innerH / 2);
|
|
1106
|
+
const topStart = x0 + corner;
|
|
1107
|
+
const topEnd = x1 - corner;
|
|
1108
|
+
const rightStart = y0 + corner;
|
|
1109
|
+
const rightEnd = y1 - corner;
|
|
1110
|
+
const bottomStart = x1 - corner;
|
|
1111
|
+
const bottomEnd = x0 + corner;
|
|
1112
|
+
const leftStart = y1 - corner;
|
|
1113
|
+
const leftEnd = y0 + corner;
|
|
1114
|
+
const topCount = architecturalCloudScallopCount(topEnd - topStart, depth);
|
|
1115
|
+
const rightCount = architecturalCloudScallopCount(rightEnd - rightStart, depth);
|
|
1116
|
+
const bottomCount = architecturalCloudScallopCount(bottomStart - bottomEnd, depth);
|
|
1117
|
+
const leftCount = architecturalCloudScallopCount(leftStart - leftEnd, depth);
|
|
1118
|
+
const segments = [`M${svgNumber(topStart)} ${svgNumber(y0)}`];
|
|
1119
|
+
appendHorizontalScallops(segments, topStart, topEnd, y0, y0 + depth, topCount);
|
|
1120
|
+
segments.push(
|
|
1121
|
+
`Q${svgNumber(x1)} ${svgNumber(y0)} ${svgNumber(x1)} ${svgNumber(rightStart)}`
|
|
1122
|
+
);
|
|
1123
|
+
appendVerticalScallops(segments, rightStart, rightEnd, x1, x1 - depth, rightCount);
|
|
1124
|
+
segments.push(
|
|
1125
|
+
`Q${svgNumber(x1)} ${svgNumber(y1)} ${svgNumber(bottomStart)} ${svgNumber(y1)}`
|
|
1126
|
+
);
|
|
1127
|
+
appendHorizontalScallops(
|
|
1128
|
+
segments,
|
|
1129
|
+
bottomStart,
|
|
1130
|
+
bottomEnd,
|
|
1131
|
+
y1,
|
|
1132
|
+
y1 - depth,
|
|
1133
|
+
bottomCount
|
|
1134
|
+
);
|
|
1135
|
+
segments.push(
|
|
1136
|
+
`Q${svgNumber(x0)} ${svgNumber(y1)} ${svgNumber(x0)} ${svgNumber(leftStart)}`
|
|
1137
|
+
);
|
|
1138
|
+
appendVerticalScallops(segments, leftStart, leftEnd, x0, x0 + depth, leftCount);
|
|
1139
|
+
segments.push(
|
|
1140
|
+
`Q${svgNumber(x0)} ${svgNumber(y0)} ${svgNumber(topStart)} ${svgNumber(y0)} Z`
|
|
1141
|
+
);
|
|
1142
|
+
return segments.join(" ");
|
|
1143
|
+
}
|
|
1144
|
+
function buildArchitecturalCloudSvg(width, height, style = DEFAULT_STROKE_STYLE) {
|
|
1145
|
+
const d = buildArchitecturalCloudPathD(width, height, style.strokeWidth);
|
|
1146
|
+
return `<path d="${d}" fill="none" stroke="${style.stroke}" stroke-width="${style.strokeWidth}" stroke-linecap="round" stroke-linejoin="round"${strokeOpacityAttr(style)} />`;
|
|
1147
|
+
}
|
|
1056
1148
|
function buildLineSvg(line, style = DEFAULT_STROKE_STYLE) {
|
|
1057
1149
|
return `<line x1="${line.x1}" y1="${line.y1}" x2="${line.x2}" y2="${line.y2}" stroke="${style.stroke}" stroke-width="${style.strokeWidth}"${strokeOpacityAttr(style)} />`;
|
|
1058
1150
|
}
|
|
@@ -1195,6 +1287,13 @@ function rebuildItemSvg(item) {
|
|
|
1195
1287
|
childrenSvg: buildEllipseSvg(b.width, b.height, style)
|
|
1196
1288
|
};
|
|
1197
1289
|
}
|
|
1290
|
+
if (k === "architectural-cloud") {
|
|
1291
|
+
const b = normalizeRect(item.bounds);
|
|
1292
|
+
return {
|
|
1293
|
+
...item,
|
|
1294
|
+
childrenSvg: buildArchitecturalCloudSvg(b.width, b.height, style)
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1198
1297
|
if ((k === "line" || k === "arrow") && item.line) {
|
|
1199
1298
|
const line = item.line;
|
|
1200
1299
|
const childrenSvg = k === "arrow" ? buildArrowSvg(item.id, line, style) : buildLineSvg(line, style);
|
|
@@ -1307,6 +1406,21 @@ function createEllipseItem(id, bounds, style) {
|
|
|
1307
1406
|
childrenSvg: ""
|
|
1308
1407
|
});
|
|
1309
1408
|
}
|
|
1409
|
+
function createArchitecturalCloudItem(id, bounds, style) {
|
|
1410
|
+
const r = normalizeRect(bounds);
|
|
1411
|
+
const s = { ...DEFAULT_STROKE_STYLE, ...style };
|
|
1412
|
+
return rebuildItemSvg({
|
|
1413
|
+
id,
|
|
1414
|
+
x: r.x,
|
|
1415
|
+
y: r.y,
|
|
1416
|
+
bounds: { ...r },
|
|
1417
|
+
toolKind: "architectural-cloud",
|
|
1418
|
+
stroke: s.stroke,
|
|
1419
|
+
strokeWidth: s.strokeWidth,
|
|
1420
|
+
...s.strokeOpacity != null ? { strokeOpacity: s.strokeOpacity } : {},
|
|
1421
|
+
childrenSvg: ""
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1310
1424
|
function createLineItem(id, bounds, line, toolKind, style, arrowBind) {
|
|
1311
1425
|
const r = normalizeRect(bounds);
|
|
1312
1426
|
const s = { ...DEFAULT_STROKE_STYLE, ...style };
|
|
@@ -1526,7 +1640,7 @@ function isArrowBindTarget(item) {
|
|
|
1526
1640
|
if (item.locked) return false;
|
|
1527
1641
|
const k = item.toolKind;
|
|
1528
1642
|
if (!k) return false;
|
|
1529
|
-
return k === "rect" || k === "ellipse" || k === "text" || k === "image" || k === "custom";
|
|
1643
|
+
return k === "rect" || k === "ellipse" || k === "architectural-cloud" || k === "text" || k === "image" || k === "custom";
|
|
1530
1644
|
}
|
|
1531
1645
|
function closestPointOnShapeBoundaryLocal(item, lx, ly, w, h) {
|
|
1532
1646
|
if (item.toolKind === "ellipse") {
|
|
@@ -2406,6 +2520,8 @@ exports.applyStrokeToItem = applyStrokeToItem;
|
|
|
2406
2520
|
exports.attachApplePencilNavigation = attachApplePencilNavigation;
|
|
2407
2521
|
exports.attachViewportInput = attachViewportInput;
|
|
2408
2522
|
exports.bakeArrowItemToAbsolute = bakeArrowItemToAbsolute;
|
|
2523
|
+
exports.buildArchitecturalCloudPathD = buildArchitecturalCloudPathD;
|
|
2524
|
+
exports.buildArchitecturalCloudSvg = buildArchitecturalCloudSvg;
|
|
2409
2525
|
exports.buildArrowSvg = buildArrowSvg;
|
|
2410
2526
|
exports.buildCustomShapeChildrenSvg = buildCustomShapeChildrenSvg;
|
|
2411
2527
|
exports.buildDrawDotSvg = buildDrawDotSvg;
|
|
@@ -2419,6 +2535,7 @@ exports.cloneVectorSceneItemsWithNewIds = cloneVectorSceneItemsWithNewIds;
|
|
|
2419
2535
|
exports.collectEraserTargetsAtWorldPoint = collectEraserTargetsAtWorldPoint;
|
|
2420
2536
|
exports.computeFreehandSvgPayload = computeFreehandSvgPayload;
|
|
2421
2537
|
exports.copyManagedImage = copyManagedImage;
|
|
2538
|
+
exports.createArchitecturalCloudItem = createArchitecturalCloudItem;
|
|
2422
2539
|
exports.createCustomShapeItem = createCustomShapeItem;
|
|
2423
2540
|
exports.createDrawDotItem = createDrawDotItem;
|
|
2424
2541
|
exports.createEllipseItem = createEllipseItem;
|