canvu-react 0.3.38 → 0.3.39
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-DrTOgDdd.d.ts → asset-hydration-DdFLdlqX.d.ts} +1 -1
- package/dist/{asset-hydration-EtEuBwb7.d.cts → asset-hydration-DowNdaOJ.d.cts} +1 -1
- package/dist/chatbot.d.cts +2 -2
- package/dist/chatbot.d.ts +2 -2
- package/dist/index.cjs +105 -0
- 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 +100 -1
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +32 -3
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +6 -6
- package/dist/react.d.ts +6 -6
- package/dist/react.js +32 -3
- package/dist/react.js.map +1 -1
- package/dist/realtime.d.cts +3 -3
- package/dist/realtime.d.ts +3 -3
- package/dist/{shape-builders-CsSXKCcs.d.ts → shape-builders-C7bxJBGR.d.ts} +40 -2
- package/dist/{shape-builders-CsbSRZnQ.d.cts → shape-builders-Dedcl6tw.d.cts} +40 -2
- package/dist/tldraw.cjs +134 -65
- package/dist/tldraw.cjs.map +1 -1
- package/dist/tldraw.js +134 -65
- package/dist/tldraw.js.map +1 -1
- package/dist/{types-B6PAYKzx.d.ts → types-BBb8KoyW.d.ts} +10 -1
- package/dist/{types-DWGk2_GZ.d.cts → types-DUW61Tjy.d.cts} +10 -1
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -6463,6 +6463,18 @@ var SvgVectorRenderer = class {
|
|
|
6463
6463
|
}
|
|
6464
6464
|
};
|
|
6465
6465
|
|
|
6466
|
+
// src/scene/link-item.ts
|
|
6467
|
+
var LINK_PLUGIN_KEY = "canvuLink";
|
|
6468
|
+
var isCanvuLinkData = (value) => {
|
|
6469
|
+
if (!value || typeof value !== "object") return false;
|
|
6470
|
+
const candidate = value;
|
|
6471
|
+
return typeof candidate.href === "string" && candidate.href.length > 0;
|
|
6472
|
+
};
|
|
6473
|
+
function getLinkData(item) {
|
|
6474
|
+
const entry = item.pluginData?.[LINK_PLUGIN_KEY];
|
|
6475
|
+
return isCanvuLinkData(entry) ? entry : null;
|
|
6476
|
+
}
|
|
6477
|
+
|
|
6466
6478
|
// src/scene/scene.ts
|
|
6467
6479
|
var VectorScene = class {
|
|
6468
6480
|
items = [];
|
|
@@ -7639,6 +7651,7 @@ var VectorViewport = react.forwardRef(
|
|
|
7639
7651
|
selectedIds: selectedIdsProp,
|
|
7640
7652
|
onSelectionChange,
|
|
7641
7653
|
onItemsChange: consumerOnItemsChange,
|
|
7654
|
+
onActivateLink,
|
|
7642
7655
|
onWorldPointerDown: consumerOnWorldPointerDown,
|
|
7643
7656
|
toolbar,
|
|
7644
7657
|
navMenu,
|
|
@@ -7819,6 +7832,8 @@ var VectorViewport = react.forwardRef(
|
|
|
7819
7832
|
const itemsRef = react.useRef(items);
|
|
7820
7833
|
const onWorldPointerDownRef = react.useRef(onWorldPointerDown);
|
|
7821
7834
|
const onItemsChangeRef = react.useRef(onItemsChange);
|
|
7835
|
+
const onActivateLinkRef = react.useRef(onActivateLink);
|
|
7836
|
+
onActivateLinkRef.current = onActivateLink;
|
|
7822
7837
|
const assetStoreRef = react.useRef(assetStore);
|
|
7823
7838
|
assetStoreRef.current = assetStore;
|
|
7824
7839
|
const customPlacementRef = react.useRef(customPlacement);
|
|
@@ -9094,13 +9109,27 @@ var VectorViewport = react.forwardRef(
|
|
|
9094
9109
|
);
|
|
9095
9110
|
const handleOverlayDoubleClick = react.useCallback(
|
|
9096
9111
|
(e) => {
|
|
9097
|
-
if (!interactiveRef.current || !onItemsChangeRef.current) return;
|
|
9098
|
-
if (toolIdRef.current !== "select") return;
|
|
9099
|
-
e.preventDefault();
|
|
9100
9112
|
const cam = cameraRef.current;
|
|
9101
9113
|
if (!cam) return;
|
|
9102
9114
|
const { worldX, worldY } = screenToWorld(e.clientX, e.clientY);
|
|
9103
9115
|
const lineHitWorld = 10 / cam.zoom;
|
|
9116
|
+
const linkHit = hitTestWorldPoint(resolvedItemsRef.current, worldX, worldY, {
|
|
9117
|
+
lineHitWorld,
|
|
9118
|
+
ignoreLocked: false
|
|
9119
|
+
});
|
|
9120
|
+
const link = linkHit ? getLinkData(linkHit) : null;
|
|
9121
|
+
if (linkHit && link) {
|
|
9122
|
+
e.preventDefault();
|
|
9123
|
+
if (onActivateLinkRef.current) {
|
|
9124
|
+
onActivateLinkRef.current({ link, item: linkHit });
|
|
9125
|
+
} else if (typeof window !== "undefined" && typeof window.open === "function") {
|
|
9126
|
+
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
9127
|
+
}
|
|
9128
|
+
return;
|
|
9129
|
+
}
|
|
9130
|
+
if (!interactiveRef.current || !onItemsChangeRef.current) return;
|
|
9131
|
+
if (toolIdRef.current !== "select") return;
|
|
9132
|
+
e.preventDefault();
|
|
9104
9133
|
const hit = hitTestWorldPoint(resolvedItemsRef.current, worldX, worldY, {
|
|
9105
9134
|
lineHitWorld,
|
|
9106
9135
|
ignoreLocked: true
|