canvu-react 0.4.54 → 0.4.56
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/chatbot.d.cts +3 -3
- package/dist/chatbot.d.ts +3 -3
- package/dist/index.cjs +30 -252
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +30 -252
- package/dist/index.js.map +1 -1
- package/dist/native.cjs +39 -260
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.cts +3 -3
- package/dist/native.d.ts +3 -3
- package/dist/native.js +39 -260
- package/dist/native.js.map +1 -1
- package/dist/react.cjs +31 -253
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +4 -4
- package/dist/react.d.ts +4 -4
- package/dist/react.js +31 -253
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +4 -4
- package/dist/realtime.d.ts +4 -4
- package/dist/realtime.js.map +1 -1
- package/dist/realtimeNative.d.cts +2 -2
- package/dist/realtimeNative.d.ts +2 -2
- package/dist/{shape-builders-BmLS8CNh.d.cts → shape-builders-DzhCOuzo.d.cts} +1 -1
- package/dist/{shape-builders-BCOAG0pS.d.ts → shape-builders-xG3A66sv.d.ts} +1 -1
- package/dist/tldraw.cjs +30 -252
- package/dist/tldraw.cjs.map +1 -1
- package/dist/tldraw.js +30 -252
- package/dist/tldraw.js.map +1 -1
- package/dist/{types-uzeExFkd.d.cts → types-BFZpRGyr.d.cts} +2 -2
- package/dist/{types-BMMPUak7.d.ts → types-BXa2CIrc.d.ts} +1 -1
- package/dist/{types-BAEHaIYO.d.ts → types-D2zesNI8.d.ts} +2 -2
- package/dist/{types-BOQLWyCw.d.cts → types-DqsqQQVf.d.cts} +1 -1
- package/package.json +1 -1
package/dist/chatbot.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { a as CanvasPlugin } from './types-
|
|
2
|
+
import { a as CanvasPlugin } from './types-BFZpRGyr.cjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
import './types-fJNwEnHf.cjs';
|
|
5
|
-
import './shape-builders-
|
|
5
|
+
import './shape-builders-DzhCOuzo.cjs';
|
|
6
6
|
import './link-item-BMV3VUCr.cjs';
|
|
7
7
|
import './asset-store-35ysK28r.cjs';
|
|
8
|
-
import './types-
|
|
8
|
+
import './types-DqsqQQVf.cjs';
|
|
9
9
|
|
|
10
10
|
type ChatbotPluginPanelProps = {
|
|
11
11
|
/**
|
package/dist/chatbot.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { a as CanvasPlugin } from './types-
|
|
2
|
+
import { a as CanvasPlugin } from './types-D2zesNI8.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import './types-fJNwEnHf.js';
|
|
5
|
-
import './shape-builders-
|
|
5
|
+
import './shape-builders-xG3A66sv.js';
|
|
6
6
|
import './link-item-COoNNvCu.js';
|
|
7
7
|
import './asset-store-D_FjW_CN.js';
|
|
8
|
-
import './types-
|
|
8
|
+
import './types-BXa2CIrc.js';
|
|
9
9
|
|
|
10
10
|
type ChatbotPluginPanelProps = {
|
|
11
11
|
/**
|
package/dist/index.cjs
CHANGED
|
@@ -1349,203 +1349,6 @@ function svgNumber(value) {
|
|
|
1349
1349
|
return Number.isInteger(rounded) ? String(rounded) : String(rounded);
|
|
1350
1350
|
}
|
|
1351
1351
|
var ARCHITECTURAL_CLOUD_RADIUS = 38;
|
|
1352
|
-
var ARCHITECTURAL_CLOUD_TARGET_SPACING = 50;
|
|
1353
|
-
var ARCHITECTURAL_CLOUD_FLAT_RADIUS_RATIO = 0.38;
|
|
1354
|
-
var ARCHITECTURAL_CLOUD_ROUNDED_RADIUS = 72;
|
|
1355
|
-
var ARCHITECTURAL_CLOUD_ROUNDED_MIN_RADIUS = 44;
|
|
1356
|
-
var ARCHITECTURAL_CLOUD_ROUNDED_TARGET_SPACING = 98;
|
|
1357
|
-
function architecturalCloudCenterCount(edgeLength, radius) {
|
|
1358
|
-
const targetSpacing = Math.min(
|
|
1359
|
-
ARCHITECTURAL_CLOUD_TARGET_SPACING,
|
|
1360
|
-
Math.max(1, radius * 1.3)
|
|
1361
|
-
);
|
|
1362
|
-
return Math.max(2, Math.round(edgeLength / targetSpacing) + 1);
|
|
1363
|
-
}
|
|
1364
|
-
function distributeRange(start, end, count) {
|
|
1365
|
-
if (count <= 1) return [start];
|
|
1366
|
-
const step = (end - start) / (count - 1);
|
|
1367
|
-
return Array.from({ length: count }, (_, index) => start + step * index);
|
|
1368
|
-
}
|
|
1369
|
-
function lineCloudPathSegment(start, end) {
|
|
1370
|
-
const dx = end[0] - start[0];
|
|
1371
|
-
const dy = end[1] - start[1];
|
|
1372
|
-
const length = Math.hypot(dx, dy);
|
|
1373
|
-
return {
|
|
1374
|
-
length,
|
|
1375
|
-
pointAt: (t) => [start[0] + dx * t, start[1] + dy * t]
|
|
1376
|
-
};
|
|
1377
|
-
}
|
|
1378
|
-
function ellipsePoint(centerX, centerY, radiusX, radiusY, angle) {
|
|
1379
|
-
return [centerX + Math.cos(angle) * radiusX, centerY + Math.sin(angle) * radiusY];
|
|
1380
|
-
}
|
|
1381
|
-
function approximateEllipseArcLength(radiusX, radiusY, startAngle, endAngle) {
|
|
1382
|
-
const steps = Math.max(
|
|
1383
|
-
4,
|
|
1384
|
-
Math.ceil(Math.abs(endAngle - startAngle) / (Math.PI / 16))
|
|
1385
|
-
);
|
|
1386
|
-
let length = 0;
|
|
1387
|
-
let previous = ellipsePoint(0, 0, radiusX, radiusY, startAngle);
|
|
1388
|
-
for (let index = 1; index <= steps; index += 1) {
|
|
1389
|
-
const angle = startAngle + (endAngle - startAngle) * index / steps;
|
|
1390
|
-
const next = ellipsePoint(0, 0, radiusX, radiusY, angle);
|
|
1391
|
-
length += Math.hypot(next[0] - previous[0], next[1] - previous[1]);
|
|
1392
|
-
previous = next;
|
|
1393
|
-
}
|
|
1394
|
-
return length;
|
|
1395
|
-
}
|
|
1396
|
-
function ellipseCloudPathSegment(centerX, centerY, radiusX, radiusY, startAngle, endAngle) {
|
|
1397
|
-
return {
|
|
1398
|
-
length: approximateEllipseArcLength(radiusX, radiusY, startAngle, endAngle),
|
|
1399
|
-
pointAt: (t) => ellipsePoint(
|
|
1400
|
-
centerX,
|
|
1401
|
-
centerY,
|
|
1402
|
-
radiusX,
|
|
1403
|
-
radiusY,
|
|
1404
|
-
startAngle + (endAngle - startAngle) * t
|
|
1405
|
-
)
|
|
1406
|
-
};
|
|
1407
|
-
}
|
|
1408
|
-
function cloudPathPerimeter(segments) {
|
|
1409
|
-
const usableSegments = segments.filter((segment) => segment.length > 1e-9);
|
|
1410
|
-
return usableSegments.reduce((sum, segment) => sum + segment.length, 0);
|
|
1411
|
-
}
|
|
1412
|
-
function pointOnCloudPath(segments, distance) {
|
|
1413
|
-
const perimeter = cloudPathPerimeter(segments);
|
|
1414
|
-
if (perimeter <= 0) return [0, 0];
|
|
1415
|
-
let remaining = (distance % perimeter + perimeter) % perimeter;
|
|
1416
|
-
for (const segment of segments) {
|
|
1417
|
-
if (segment.length <= 1e-9) continue;
|
|
1418
|
-
if (remaining <= segment.length) {
|
|
1419
|
-
const t = remaining / segment.length;
|
|
1420
|
-
return segment.pointAt(t);
|
|
1421
|
-
}
|
|
1422
|
-
remaining -= segment.length;
|
|
1423
|
-
}
|
|
1424
|
-
const fallback = segments.find((segment) => segment.length > 1e-9);
|
|
1425
|
-
return fallback?.pointAt(0) ?? [0, 0];
|
|
1426
|
-
}
|
|
1427
|
-
function buildRoundedCapsulePathSegments(width, height, inset) {
|
|
1428
|
-
const left = inset;
|
|
1429
|
-
const top = inset;
|
|
1430
|
-
const right = width - inset;
|
|
1431
|
-
const bottom = height - inset;
|
|
1432
|
-
const capsuleWidth = Math.max(0, right - left);
|
|
1433
|
-
const capsuleHeight = Math.max(0, bottom - top);
|
|
1434
|
-
const radius = Math.min(capsuleWidth, capsuleHeight) / 2;
|
|
1435
|
-
if (radius <= 0) return [];
|
|
1436
|
-
const leftCenterX = left + radius;
|
|
1437
|
-
const rightCenterX = right - radius;
|
|
1438
|
-
const topCenterY = top + radius;
|
|
1439
|
-
const bottomCenterY = bottom - radius;
|
|
1440
|
-
return [
|
|
1441
|
-
lineCloudPathSegment([leftCenterX, top], [rightCenterX, top]),
|
|
1442
|
-
ellipseCloudPathSegment(
|
|
1443
|
-
rightCenterX,
|
|
1444
|
-
topCenterY,
|
|
1445
|
-
radius,
|
|
1446
|
-
radius,
|
|
1447
|
-
-Math.PI / 2,
|
|
1448
|
-
0
|
|
1449
|
-
),
|
|
1450
|
-
lineCloudPathSegment([right, topCenterY], [right, bottomCenterY]),
|
|
1451
|
-
ellipseCloudPathSegment(
|
|
1452
|
-
rightCenterX,
|
|
1453
|
-
bottomCenterY,
|
|
1454
|
-
radius,
|
|
1455
|
-
radius,
|
|
1456
|
-
0,
|
|
1457
|
-
Math.PI / 2
|
|
1458
|
-
),
|
|
1459
|
-
lineCloudPathSegment([rightCenterX, bottom], [leftCenterX, bottom]),
|
|
1460
|
-
ellipseCloudPathSegment(
|
|
1461
|
-
leftCenterX,
|
|
1462
|
-
bottomCenterY,
|
|
1463
|
-
radius,
|
|
1464
|
-
radius,
|
|
1465
|
-
Math.PI / 2,
|
|
1466
|
-
Math.PI
|
|
1467
|
-
),
|
|
1468
|
-
lineCloudPathSegment([left, bottomCenterY], [left, topCenterY]),
|
|
1469
|
-
ellipseCloudPathSegment(
|
|
1470
|
-
leftCenterX,
|
|
1471
|
-
topCenterY,
|
|
1472
|
-
radius,
|
|
1473
|
-
radius,
|
|
1474
|
-
Math.PI,
|
|
1475
|
-
Math.PI * 1.5
|
|
1476
|
-
)
|
|
1477
|
-
];
|
|
1478
|
-
}
|
|
1479
|
-
function buildRoundedArcCloudPathD(cloudWidth, cloudHeight, center) {
|
|
1480
|
-
const minDimension = Math.min(cloudWidth, cloudHeight);
|
|
1481
|
-
const radius = Math.min(
|
|
1482
|
-
ARCHITECTURAL_CLOUD_ROUNDED_RADIUS,
|
|
1483
|
-
Math.max(ARCHITECTURAL_CLOUD_ROUNDED_MIN_RADIUS, minDimension * 0.16)
|
|
1484
|
-
);
|
|
1485
|
-
const centerPath = buildRoundedCapsulePathSegments(
|
|
1486
|
-
cloudWidth,
|
|
1487
|
-
cloudHeight,
|
|
1488
|
-
radius
|
|
1489
|
-
);
|
|
1490
|
-
const centerPerimeter = cloudPathPerimeter(centerPath);
|
|
1491
|
-
if (centerPerimeter <= 0) return "";
|
|
1492
|
-
const lobeCount = Math.max(
|
|
1493
|
-
8,
|
|
1494
|
-
Math.round(centerPerimeter / ARCHITECTURAL_CLOUD_ROUNDED_TARGET_SPACING)
|
|
1495
|
-
);
|
|
1496
|
-
const centers = Array.from(
|
|
1497
|
-
{ length: lobeCount },
|
|
1498
|
-
(_, index) => pointOnCloudPath(centerPath, centerPerimeter * index / lobeCount)
|
|
1499
|
-
);
|
|
1500
|
-
const points = centers.map((point, index) => {
|
|
1501
|
-
const previous = centers[(index - 1 + centers.length) % centers.length] ?? point;
|
|
1502
|
-
return cloudCircleIntersection(previous, point, radius, center);
|
|
1503
|
-
});
|
|
1504
|
-
const [startX, startY] = points[0] ?? [0, 0];
|
|
1505
|
-
const segments = [`M${svgNumber(startX)} ${svgNumber(startY)}`];
|
|
1506
|
-
for (const [endX, endY] of points.slice(1)) {
|
|
1507
|
-
segments.push(
|
|
1508
|
-
`A ${svgNumber(radius)} ${svgNumber(radius)} 0 0 1 ${svgNumber(endX)} ${svgNumber(endY)}`
|
|
1509
|
-
);
|
|
1510
|
-
}
|
|
1511
|
-
segments.push(
|
|
1512
|
-
`A ${svgNumber(radius)} ${svgNumber(radius)} 0 0 1 ${svgNumber(startX)} ${svgNumber(startY)}`
|
|
1513
|
-
);
|
|
1514
|
-
segments.push("Z");
|
|
1515
|
-
return segments.join(" ");
|
|
1516
|
-
}
|
|
1517
|
-
function cloudCircleIntersection(a, b, radius, center) {
|
|
1518
|
-
const midX = (a[0] + b[0]) / 2;
|
|
1519
|
-
const midY = (a[1] + b[1]) / 2;
|
|
1520
|
-
const dx = b[0] - a[0];
|
|
1521
|
-
const dy = b[1] - a[1];
|
|
1522
|
-
const distance = Math.hypot(dx, dy);
|
|
1523
|
-
if (distance <= 1e-9) return [midX, midY];
|
|
1524
|
-
const halfDistance = distance / 2;
|
|
1525
|
-
const offset = Math.sqrt(
|
|
1526
|
-
Math.max(0, radius * radius - halfDistance * halfDistance)
|
|
1527
|
-
);
|
|
1528
|
-
const normalX = -dy / distance;
|
|
1529
|
-
const normalY = dx / distance;
|
|
1530
|
-
const first = [midX + normalX * offset, midY + normalY * offset];
|
|
1531
|
-
const second = [
|
|
1532
|
-
midX - normalX * offset,
|
|
1533
|
-
midY - normalY * offset
|
|
1534
|
-
];
|
|
1535
|
-
const firstDistance = (first[0] - center[0]) * (first[0] - center[0]) + (first[1] - center[1]) * (first[1] - center[1]);
|
|
1536
|
-
const secondDistance = (second[0] - center[0]) * (second[0] - center[0]) + (second[1] - center[1]) * (second[1] - center[1]);
|
|
1537
|
-
return firstDistance >= secondDistance ? first : second;
|
|
1538
|
-
}
|
|
1539
|
-
function cloudEllipseIntersection(a, b, radiusX, radiusY, center) {
|
|
1540
|
-
const scaleY = radiusX / radiusY;
|
|
1541
|
-
const [x, y] = cloudCircleIntersection(
|
|
1542
|
-
[a[0], a[1] * scaleY],
|
|
1543
|
-
[b[0], b[1] * scaleY],
|
|
1544
|
-
radiusX,
|
|
1545
|
-
[center[0], center[1] * scaleY]
|
|
1546
|
-
);
|
|
1547
|
-
return [x, y / scaleY];
|
|
1548
|
-
}
|
|
1549
1352
|
function buildRectSvg(width, height, style = DEFAULT_STROKE_STYLE) {
|
|
1550
1353
|
return `<rect width="${width}" height="${height}" fill="none" stroke="${style.stroke}" stroke-width="${style.strokeWidth}" rx="4"${strokeOpacityAttr(style)} />`;
|
|
1551
1354
|
}
|
|
@@ -1554,67 +1357,42 @@ function buildEllipseSvg(width, height, style = DEFAULT_STROKE_STYLE) {
|
|
|
1554
1357
|
const ry = height / 2;
|
|
1555
1358
|
return `<ellipse cx="${rx}" cy="${ry}" rx="${rx}" ry="${ry}" fill="none" stroke="${style.stroke}" stroke-width="${style.strokeWidth}"${strokeOpacityAttr(style)} />`;
|
|
1556
1359
|
}
|
|
1557
|
-
function buildArchitecturalCloudPathD(width, height, strokeWidth = DEFAULT_STROKE_STYLE.strokeWidth) {
|
|
1558
|
-
const w = Math.max(0, width);
|
|
1559
|
-
const h = Math.max(0, height);
|
|
1560
|
-
if (w <= 0 || h <= 0) return "";
|
|
1360
|
+
function buildArchitecturalCloudPathD(width, height, strokeWidth = DEFAULT_STROKE_STYLE.strokeWidth, arcRadius = ARCHITECTURAL_CLOUD_RADIUS, bulge = 1) {
|
|
1561
1361
|
const padding = Math.max(0, strokeWidth * 2);
|
|
1562
|
-
const cloudWidth = Math.max(0,
|
|
1563
|
-
const cloudHeight = Math.max(0,
|
|
1564
|
-
if (cloudWidth <= 0 || cloudHeight <= 0) return "";
|
|
1565
|
-
const
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
cloudHeight * ARCHITECTURAL_CLOUD_FLAT_RADIUS_RATIO
|
|
1572
|
-
);
|
|
1573
|
-
if (radiusX <= 0 || radiusY <= 0) return "";
|
|
1574
|
-
const center = [cloudWidth / 2, cloudHeight / 2];
|
|
1575
|
-
const leftCenterX = radiusX;
|
|
1576
|
-
const rightCenterX = cloudWidth - radiusX;
|
|
1577
|
-
const topCenterY = radiusY;
|
|
1578
|
-
const bottomCenterY = cloudHeight - radiusY;
|
|
1579
|
-
const horizontalCenters = distributeRange(
|
|
1580
|
-
leftCenterX,
|
|
1581
|
-
rightCenterX,
|
|
1582
|
-
architecturalCloudCenterCount(Math.max(0, rightCenterX - leftCenterX), radiusX)
|
|
1583
|
-
);
|
|
1584
|
-
const verticalCenters = distributeRange(
|
|
1585
|
-
topCenterY,
|
|
1586
|
-
bottomCenterY,
|
|
1587
|
-
architecturalCloudCenterCount(Math.max(0, bottomCenterY - topCenterY), radiusY)
|
|
1588
|
-
);
|
|
1589
|
-
if (horizontalCenters.length > 3 && verticalCenters.length > 3) {
|
|
1590
|
-
const roundedArcCloudPath = buildRoundedArcCloudPathD(
|
|
1591
|
-
cloudWidth,
|
|
1592
|
-
cloudHeight,
|
|
1593
|
-
center
|
|
1594
|
-
);
|
|
1595
|
-
if (roundedArcCloudPath !== "") return roundedArcCloudPath;
|
|
1596
|
-
}
|
|
1597
|
-
const rectangularCenters = [
|
|
1598
|
-
...horizontalCenters.map((x) => [x, topCenterY]),
|
|
1599
|
-
...verticalCenters.slice(1).map((y) => [rightCenterX, y]),
|
|
1600
|
-
...horizontalCenters.slice(0, -1).reverse().map((x) => [x, bottomCenterY]),
|
|
1601
|
-
...verticalCenters.slice(1, -1).reverse().map((y) => [leftCenterX, y])
|
|
1362
|
+
const cloudWidth = Math.max(0, width - padding);
|
|
1363
|
+
const cloudHeight = Math.max(0, height - padding);
|
|
1364
|
+
if (cloudWidth <= 0 || cloudHeight <= 0 || arcRadius <= 0 || bulge <= 0) return "";
|
|
1365
|
+
const offset = padding / 2;
|
|
1366
|
+
const corners = [
|
|
1367
|
+
[offset, offset],
|
|
1368
|
+
[offset + cloudWidth, offset],
|
|
1369
|
+
[offset + cloudWidth, offset + cloudHeight],
|
|
1370
|
+
[offset, offset + cloudHeight]
|
|
1602
1371
|
];
|
|
1603
|
-
const
|
|
1604
|
-
|
|
1605
|
-
const
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1372
|
+
const points = [];
|
|
1373
|
+
for (let index = 0; index < corners.length; index += 1) {
|
|
1374
|
+
const [startX2, startY2] = corners[index] ?? [0, 0];
|
|
1375
|
+
const [endX, endY] = corners[(index + 1) % corners.length] ?? [0, 0];
|
|
1376
|
+
const edgeLength = Math.hypot(endX - startX2, endY - startY2);
|
|
1377
|
+
const arcCount = Math.max(1, Math.round(edgeLength / (2 * arcRadius)));
|
|
1378
|
+
const chord = edgeLength / arcCount;
|
|
1379
|
+
for (let arcIndex = 1; arcIndex <= arcCount; arcIndex += 1) {
|
|
1380
|
+
const t = arcIndex / arcCount;
|
|
1381
|
+
points.push([
|
|
1382
|
+
startX2 + (endX - startX2) * t,
|
|
1383
|
+
startY2 + (endY - startY2) * t,
|
|
1384
|
+
chord
|
|
1385
|
+
]);
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
const [startX, startY] = corners[0] ?? [0, 0];
|
|
1609
1389
|
const segments = [`M${svgNumber(startX)} ${svgNumber(startY)}`];
|
|
1610
|
-
for (const [
|
|
1390
|
+
for (const [pointX, pointY, chord] of points) {
|
|
1391
|
+
const radius = chord / 2 * bulge;
|
|
1611
1392
|
segments.push(
|
|
1612
|
-
`A ${svgNumber(
|
|
1393
|
+
`A ${svgNumber(radius)} ${svgNumber(radius)} 0 0 1 ${svgNumber(pointX)} ${svgNumber(pointY)}`
|
|
1613
1394
|
);
|
|
1614
1395
|
}
|
|
1615
|
-
segments.push(
|
|
1616
|
-
`A ${svgNumber(radiusX)} ${svgNumber(radiusY)} 0 0 1 ${svgNumber(startX)} ${svgNumber(startY)}`
|
|
1617
|
-
);
|
|
1618
1396
|
segments.push("Z");
|
|
1619
1397
|
return segments.join(" ");
|
|
1620
1398
|
}
|