@particle-academy/fancy-3d 0.1.6 → 0.3.3
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/README.md +64 -7
- package/dist/babylon.cjs +86 -0
- package/dist/babylon.cjs.map +1 -1
- package/dist/babylon.d.cts +93 -2
- package/dist/babylon.d.ts +93 -2
- package/dist/babylon.js +83 -3
- package/dist/babylon.js.map +1 -1
- package/dist/canvas/index.cjs +802 -0
- package/dist/canvas/index.cjs.map +1 -0
- package/dist/canvas/index.d.cts +205 -0
- package/dist/canvas/index.d.ts +205 -0
- package/dist/canvas/index.js +4 -0
- package/dist/canvas/index.js.map +1 -0
- package/dist/chunk-DGUM43GV.js +10 -0
- package/dist/chunk-DGUM43GV.js.map +1 -0
- package/dist/chunk-USH43TOO.js +791 -0
- package/dist/chunk-USH43TOO.js.map +1 -0
- package/dist/dom.d.cts +1 -1
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +1 -1
- package/dist/index.cjs +798 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -188
- package/dist/index.d.ts +4 -188
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +2 -2
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +3 -3
- package/dist/react.js.map +1 -1
- package/dist/scene-ChcFkvmm.d.cts +188 -0
- package/dist/scene-ChcFkvmm.d.ts +188 -0
- package/docs/Canvas.md +154 -0
- package/package.json +11 -1
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
7
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
8
|
+
}) : x)(function(x) {
|
|
9
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
10
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// src/utils/cn.ts
|
|
14
|
+
function flatten(value) {
|
|
15
|
+
if (!value) return "";
|
|
16
|
+
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
17
|
+
if (Array.isArray(value)) return value.map(flatten).filter(Boolean).join(" ");
|
|
18
|
+
if (typeof value === "object") {
|
|
19
|
+
return Object.entries(value).filter(([, v]) => Boolean(v)).map(([k]) => k).join(" ");
|
|
20
|
+
}
|
|
21
|
+
return "";
|
|
22
|
+
}
|
|
23
|
+
function cn(...inputs) {
|
|
24
|
+
return inputs.map(flatten).filter(Boolean).join(" ");
|
|
25
|
+
}
|
|
26
|
+
function useControllableState(controlledValue, defaultValue, onChange) {
|
|
27
|
+
const [uncontrolledValue, setUncontrolledValue] = react.useState(defaultValue);
|
|
28
|
+
const isControlled = controlledValue !== void 0;
|
|
29
|
+
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
30
|
+
const onChangeRef = react.useRef(onChange);
|
|
31
|
+
onChangeRef.current = onChange;
|
|
32
|
+
const setValue = react.useCallback(
|
|
33
|
+
(next) => {
|
|
34
|
+
const nextValue = typeof next === "function" ? next(value) : next;
|
|
35
|
+
if (!isControlled) {
|
|
36
|
+
setUncontrolledValue(nextValue);
|
|
37
|
+
}
|
|
38
|
+
onChangeRef.current?.(nextValue);
|
|
39
|
+
},
|
|
40
|
+
[isControlled, value]
|
|
41
|
+
);
|
|
42
|
+
return [value, setValue];
|
|
43
|
+
}
|
|
44
|
+
function usePanZoom({
|
|
45
|
+
viewport,
|
|
46
|
+
setViewport,
|
|
47
|
+
minZoom,
|
|
48
|
+
maxZoom,
|
|
49
|
+
pannable,
|
|
50
|
+
zoomable,
|
|
51
|
+
containerRef
|
|
52
|
+
}) {
|
|
53
|
+
const isPanningRef = react.useRef(false);
|
|
54
|
+
const startRef = react.useRef({ x: 0, y: 0, panX: 0, panY: 0 });
|
|
55
|
+
const viewportRef = react.useRef(viewport);
|
|
56
|
+
viewportRef.current = viewport;
|
|
57
|
+
const setViewportRef = react.useRef(setViewport);
|
|
58
|
+
setViewportRef.current = setViewport;
|
|
59
|
+
const zoomableRef = react.useRef(zoomable);
|
|
60
|
+
zoomableRef.current = zoomable;
|
|
61
|
+
const minZoomRef = react.useRef(minZoom);
|
|
62
|
+
minZoomRef.current = minZoom;
|
|
63
|
+
const maxZoomRef = react.useRef(maxZoom);
|
|
64
|
+
maxZoomRef.current = maxZoom;
|
|
65
|
+
react.useEffect(() => {
|
|
66
|
+
const container = containerRef.current;
|
|
67
|
+
if (!container) return;
|
|
68
|
+
function handleWheel(e) {
|
|
69
|
+
if (!zoomableRef.current) return;
|
|
70
|
+
if (!e.ctrlKey && !e.metaKey) return;
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
const rect = container.getBoundingClientRect();
|
|
73
|
+
const mouseX = e.clientX - rect.left;
|
|
74
|
+
const mouseY = e.clientY - rect.top;
|
|
75
|
+
setViewportRef.current((prev) => {
|
|
76
|
+
const factor = 1 - e.deltaY * 1e-3;
|
|
77
|
+
const newZoom = Math.min(maxZoomRef.current, Math.max(minZoomRef.current, prev.zoom * factor));
|
|
78
|
+
const ratio = newZoom / prev.zoom;
|
|
79
|
+
return {
|
|
80
|
+
zoom: newZoom,
|
|
81
|
+
panX: mouseX - (mouseX - prev.panX) * ratio,
|
|
82
|
+
panY: mouseY - (mouseY - prev.panY) * ratio
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
container.addEventListener("wheel", handleWheel, { passive: false });
|
|
87
|
+
return () => {
|
|
88
|
+
container.removeEventListener("wheel", handleWheel);
|
|
89
|
+
};
|
|
90
|
+
}, [containerRef]);
|
|
91
|
+
const onPointerDown = react.useCallback(
|
|
92
|
+
(e) => {
|
|
93
|
+
if (!pannable) return;
|
|
94
|
+
if (e.button !== 0) return;
|
|
95
|
+
const target = e.target;
|
|
96
|
+
if (target !== containerRef.current && !target.hasAttribute("data-canvas-bg")) return;
|
|
97
|
+
isPanningRef.current = true;
|
|
98
|
+
startRef.current = { x: e.clientX, y: e.clientY, panX: viewport.panX, panY: viewport.panY };
|
|
99
|
+
e.target.setPointerCapture(e.pointerId);
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
},
|
|
102
|
+
[pannable, viewport.panX, viewport.panY, containerRef]
|
|
103
|
+
);
|
|
104
|
+
const onPointerMove = react.useCallback(
|
|
105
|
+
(e) => {
|
|
106
|
+
if (!isPanningRef.current) return;
|
|
107
|
+
const dx = e.clientX - startRef.current.x;
|
|
108
|
+
const dy = e.clientY - startRef.current.y;
|
|
109
|
+
setViewport((prev) => ({
|
|
110
|
+
...prev,
|
|
111
|
+
panX: startRef.current.panX + dx,
|
|
112
|
+
panY: startRef.current.panY + dy
|
|
113
|
+
}));
|
|
114
|
+
},
|
|
115
|
+
[setViewport]
|
|
116
|
+
);
|
|
117
|
+
const onPointerUp = react.useCallback(() => {
|
|
118
|
+
isPanningRef.current = false;
|
|
119
|
+
}, []);
|
|
120
|
+
return {
|
|
121
|
+
containerProps: { onPointerDown, onPointerMove, onPointerUp },
|
|
122
|
+
isPanning: isPanningRef.current
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function useNodeRegistry() {
|
|
126
|
+
const rectsRef = react.useRef(/* @__PURE__ */ new Map());
|
|
127
|
+
const [version, setVersion] = react.useState(0);
|
|
128
|
+
const registerNode = react.useCallback((id, rect) => {
|
|
129
|
+
rectsRef.current.set(id, rect);
|
|
130
|
+
setVersion((v) => v + 1);
|
|
131
|
+
}, []);
|
|
132
|
+
const unregisterNode = react.useCallback((id) => {
|
|
133
|
+
rectsRef.current.delete(id);
|
|
134
|
+
setVersion((v) => v + 1);
|
|
135
|
+
}, []);
|
|
136
|
+
return { registerNode, unregisterNode, nodeRects: rectsRef.current, version };
|
|
137
|
+
}
|
|
138
|
+
var CanvasContext = react.createContext(null);
|
|
139
|
+
function useCanvas() {
|
|
140
|
+
const ctx = react.useContext(CanvasContext);
|
|
141
|
+
if (!ctx) throw new Error("useCanvas must be used within a Canvas component");
|
|
142
|
+
return ctx;
|
|
143
|
+
}
|
|
144
|
+
function CanvasNode({ children, id, x, y, draggable, onPositionChange, className, style }) {
|
|
145
|
+
const { registerNode, unregisterNode, viewport, gridSize, snapToGrid } = useCanvas();
|
|
146
|
+
const nodeRef = react.useRef(null);
|
|
147
|
+
const isDragging = react.useRef(false);
|
|
148
|
+
const dragStart = react.useRef({ mouseX: 0, mouseY: 0, nodeX: 0, nodeY: 0 });
|
|
149
|
+
react.useEffect(() => {
|
|
150
|
+
const el = nodeRef.current;
|
|
151
|
+
if (!el) return;
|
|
152
|
+
const updateRect = () => {
|
|
153
|
+
registerNode(id, { x, y, width: el.offsetWidth, height: el.offsetHeight });
|
|
154
|
+
};
|
|
155
|
+
updateRect();
|
|
156
|
+
const observer = new ResizeObserver(updateRect);
|
|
157
|
+
observer.observe(el);
|
|
158
|
+
return () => {
|
|
159
|
+
observer.disconnect();
|
|
160
|
+
unregisterNode(id);
|
|
161
|
+
};
|
|
162
|
+
}, [id, x, y, registerNode, unregisterNode]);
|
|
163
|
+
const handlePointerDown = react.useCallback(
|
|
164
|
+
(e) => {
|
|
165
|
+
if (!draggable || e.button !== 0) return;
|
|
166
|
+
e.stopPropagation();
|
|
167
|
+
isDragging.current = true;
|
|
168
|
+
dragStart.current = { mouseX: e.clientX, mouseY: e.clientY, nodeX: x, nodeY: y };
|
|
169
|
+
e.target.setPointerCapture(e.pointerId);
|
|
170
|
+
},
|
|
171
|
+
[draggable, x, y]
|
|
172
|
+
);
|
|
173
|
+
const handlePointerMove = react.useCallback(
|
|
174
|
+
(e) => {
|
|
175
|
+
if (!isDragging.current) return;
|
|
176
|
+
const dx = (e.clientX - dragStart.current.mouseX) / viewport.zoom;
|
|
177
|
+
const dy = (e.clientY - dragStart.current.mouseY) / viewport.zoom;
|
|
178
|
+
let nx = dragStart.current.nodeX + dx;
|
|
179
|
+
let ny = dragStart.current.nodeY + dy;
|
|
180
|
+
if (snapToGrid && gridSize > 0) {
|
|
181
|
+
nx = Math.round(nx / gridSize) * gridSize;
|
|
182
|
+
ny = Math.round(ny / gridSize) * gridSize;
|
|
183
|
+
}
|
|
184
|
+
onPositionChange?.(nx, ny);
|
|
185
|
+
},
|
|
186
|
+
[viewport.zoom, onPositionChange, snapToGrid, gridSize]
|
|
187
|
+
);
|
|
188
|
+
const handlePointerUp = react.useCallback(() => {
|
|
189
|
+
isDragging.current = false;
|
|
190
|
+
}, []);
|
|
191
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
192
|
+
"div",
|
|
193
|
+
{
|
|
194
|
+
ref: nodeRef,
|
|
195
|
+
"data-react-fancy-canvas-node": "",
|
|
196
|
+
"data-node-id": id,
|
|
197
|
+
className: cn("absolute", draggable && "cursor-grab active:cursor-grabbing", className),
|
|
198
|
+
style: { left: x, top: y, ...style },
|
|
199
|
+
onPointerDown: handlePointerDown,
|
|
200
|
+
onPointerMove: handlePointerMove,
|
|
201
|
+
onPointerUp: handlePointerUp,
|
|
202
|
+
children
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
CanvasNode.displayName = "CanvasNode";
|
|
207
|
+
|
|
208
|
+
// src/canvas/canvas.utils.ts
|
|
209
|
+
function getAnchorPoint(rect, anchor, otherRect) {
|
|
210
|
+
const cx = rect.x + rect.width / 2;
|
|
211
|
+
const cy = rect.y + rect.height / 2;
|
|
212
|
+
if (anchor === "auto" && otherRect) {
|
|
213
|
+
const ocx = otherRect.x + otherRect.width / 2;
|
|
214
|
+
const ocy = otherRect.y + otherRect.height / 2;
|
|
215
|
+
const dx = ocx - cx;
|
|
216
|
+
const dy = ocy - cy;
|
|
217
|
+
if (Math.abs(dx) > Math.abs(dy)) {
|
|
218
|
+
return dx > 0 ? { x: rect.x + rect.width, y: cy } : { x: rect.x, y: cy };
|
|
219
|
+
}
|
|
220
|
+
return dy > 0 ? { x: cx, y: rect.y + rect.height } : { x: cx, y: rect.y };
|
|
221
|
+
}
|
|
222
|
+
switch (anchor) {
|
|
223
|
+
case "top":
|
|
224
|
+
return { x: cx, y: rect.y };
|
|
225
|
+
case "bottom":
|
|
226
|
+
return { x: cx, y: rect.y + rect.height };
|
|
227
|
+
case "left":
|
|
228
|
+
return { x: rect.x, y: cy };
|
|
229
|
+
case "right":
|
|
230
|
+
return { x: rect.x + rect.width, y: cy };
|
|
231
|
+
case "center":
|
|
232
|
+
return { x: cx, y: cy };
|
|
233
|
+
default:
|
|
234
|
+
return { x: cx, y: cy };
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function bezierPath(from, to) {
|
|
238
|
+
const dx = Math.abs(to.x - from.x);
|
|
239
|
+
const dy = Math.abs(to.y - from.y);
|
|
240
|
+
if (dx > dy) {
|
|
241
|
+
const offset2 = dx * 0.5;
|
|
242
|
+
const cp1x = from.x + (to.x > from.x ? offset2 : -offset2);
|
|
243
|
+
const cp2x = to.x + (to.x > from.x ? -offset2 : offset2);
|
|
244
|
+
return `M${from.x},${from.y} C${cp1x},${from.y} ${cp2x},${to.y} ${to.x},${to.y}`;
|
|
245
|
+
}
|
|
246
|
+
const offset = Math.max(dy * 0.5, 30);
|
|
247
|
+
const cp1y = from.y + (to.y > from.y ? offset : -offset);
|
|
248
|
+
const cp2y = to.y + (to.y > from.y ? -offset : offset);
|
|
249
|
+
return `M${from.x},${from.y} C${from.x},${cp1y} ${to.x},${cp2y} ${to.x},${to.y}`;
|
|
250
|
+
}
|
|
251
|
+
function stepPath(from, to) {
|
|
252
|
+
const midX = (from.x + to.x) / 2;
|
|
253
|
+
return `M${from.x},${from.y} H${midX} V${to.y} H${to.x}`;
|
|
254
|
+
}
|
|
255
|
+
function straightPath(from, to) {
|
|
256
|
+
return `M${from.x},${from.y} L${to.x},${to.y}`;
|
|
257
|
+
}
|
|
258
|
+
function getEdgePath(from, to, curve = "bezier") {
|
|
259
|
+
switch (curve) {
|
|
260
|
+
case "bezier":
|
|
261
|
+
return bezierPath(from, to);
|
|
262
|
+
case "step":
|
|
263
|
+
return stepPath(from, to);
|
|
264
|
+
case "straight":
|
|
265
|
+
return straightPath(from, to);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
function CanvasEdge({
|
|
269
|
+
from,
|
|
270
|
+
to,
|
|
271
|
+
fromAnchor = "auto",
|
|
272
|
+
toAnchor = "auto",
|
|
273
|
+
curve = "bezier",
|
|
274
|
+
color = "currentColor",
|
|
275
|
+
strokeWidth = 2,
|
|
276
|
+
dashed = false,
|
|
277
|
+
animated = false,
|
|
278
|
+
label,
|
|
279
|
+
className,
|
|
280
|
+
markerStart,
|
|
281
|
+
markerEnd
|
|
282
|
+
}) {
|
|
283
|
+
const { nodeRects, registryVersion } = useCanvas();
|
|
284
|
+
const path = react.useMemo(() => {
|
|
285
|
+
const fromRect = nodeRects.get(from);
|
|
286
|
+
const toRect = nodeRects.get(to);
|
|
287
|
+
if (!fromRect || !toRect) return null;
|
|
288
|
+
const fromPt = getAnchorPoint(fromRect, fromAnchor, toRect);
|
|
289
|
+
const toPt = getAnchorPoint(toRect, toAnchor, fromRect);
|
|
290
|
+
return {
|
|
291
|
+
d: getEdgePath(fromPt, toPt, curve),
|
|
292
|
+
midX: (fromPt.x + toPt.x) / 2,
|
|
293
|
+
midY: (fromPt.y + toPt.y) / 2
|
|
294
|
+
};
|
|
295
|
+
}, [from, to, fromAnchor, toAnchor, curve, nodeRects, registryVersion]);
|
|
296
|
+
if (!path) return null;
|
|
297
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-react-fancy-canvas-edge": "", className: cn("text-zinc-300 dark:text-zinc-600", className), children: [
|
|
298
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
299
|
+
"path",
|
|
300
|
+
{
|
|
301
|
+
d: path.d,
|
|
302
|
+
fill: "none",
|
|
303
|
+
stroke: color,
|
|
304
|
+
strokeWidth,
|
|
305
|
+
strokeDasharray: dashed ? "6 4" : void 0,
|
|
306
|
+
markerStart: markerStart ? `url(#${markerStart})` : void 0,
|
|
307
|
+
markerEnd: markerEnd ? `url(#${markerEnd})` : void 0,
|
|
308
|
+
className: animated ? "animate-[dash_1s_linear_infinite]" : "",
|
|
309
|
+
style: animated ? { strokeDasharray: "8 4" } : void 0
|
|
310
|
+
}
|
|
311
|
+
),
|
|
312
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("foreignObject", { x: path.midX - 40, y: path.midY - 12, width: 80, height: 24, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center text-xs text-zinc-500", children: label }) })
|
|
313
|
+
] });
|
|
314
|
+
}
|
|
315
|
+
CanvasEdge.displayName = "CanvasEdge";
|
|
316
|
+
function CanvasMinimap({ width = 150, height = 100, className }) {
|
|
317
|
+
const { nodeRects, registryVersion, viewport } = useCanvas();
|
|
318
|
+
const bounds = react.useMemo(() => {
|
|
319
|
+
if (nodeRects.size === 0) return { minX: 0, minY: 0, maxX: 500, maxY: 300 };
|
|
320
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
321
|
+
nodeRects.forEach((r) => {
|
|
322
|
+
minX = Math.min(minX, r.x);
|
|
323
|
+
minY = Math.min(minY, r.y);
|
|
324
|
+
maxX = Math.max(maxX, r.x + r.width);
|
|
325
|
+
maxY = Math.max(maxY, r.y + r.height);
|
|
326
|
+
});
|
|
327
|
+
const padding = 50;
|
|
328
|
+
return { minX: minX - padding, minY: minY - padding, maxX: maxX + padding, maxY: maxY + padding };
|
|
329
|
+
}, [nodeRects, registryVersion]);
|
|
330
|
+
const scaleX = width / (bounds.maxX - bounds.minX || 1);
|
|
331
|
+
const scaleY = height / (bounds.maxY - bounds.minY || 1);
|
|
332
|
+
const scale = Math.min(scaleX, scaleY);
|
|
333
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
334
|
+
"div",
|
|
335
|
+
{
|
|
336
|
+
"data-react-fancy-canvas-minimap": "",
|
|
337
|
+
className: cn(
|
|
338
|
+
"absolute right-3 bottom-3 overflow-hidden rounded-lg border border-zinc-200 bg-white/90 dark:border-zinc-700 dark:bg-zinc-900/90",
|
|
339
|
+
className
|
|
340
|
+
),
|
|
341
|
+
style: { width, height },
|
|
342
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width, height, children: [
|
|
343
|
+
Array.from(nodeRects.entries()).map(([id, rect]) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
344
|
+
"rect",
|
|
345
|
+
{
|
|
346
|
+
x: (rect.x - bounds.minX) * scale,
|
|
347
|
+
y: (rect.y - bounds.minY) * scale,
|
|
348
|
+
width: Math.max(rect.width * scale, 4),
|
|
349
|
+
height: Math.max(rect.height * scale, 3),
|
|
350
|
+
rx: 1,
|
|
351
|
+
className: "fill-blue-400/60"
|
|
352
|
+
},
|
|
353
|
+
id
|
|
354
|
+
)),
|
|
355
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
356
|
+
"rect",
|
|
357
|
+
{
|
|
358
|
+
x: (-viewport.panX / viewport.zoom - bounds.minX) * scale,
|
|
359
|
+
y: (-viewport.panY / viewport.zoom - bounds.minY) * scale,
|
|
360
|
+
width: (width / viewport.zoom / scale > 0 ? width / viewport.zoom : width) * scale / (bounds.maxX - bounds.minX || 1) * (bounds.maxX - bounds.minX),
|
|
361
|
+
height: (height / viewport.zoom / scale > 0 ? height / viewport.zoom : height) * scale / (bounds.maxY - bounds.minY || 1) * (bounds.maxY - bounds.minY),
|
|
362
|
+
fill: "none",
|
|
363
|
+
stroke: "currentColor",
|
|
364
|
+
strokeWidth: 1,
|
|
365
|
+
className: "text-blue-500"
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
] })
|
|
369
|
+
}
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
CanvasMinimap.displayName = "CanvasMinimap";
|
|
373
|
+
|
|
374
|
+
// node_modules/lucide-react/dist/esm/shared/src/utils.js
|
|
375
|
+
var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
376
|
+
var toCamelCase = (string) => string.replace(
|
|
377
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
378
|
+
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
379
|
+
);
|
|
380
|
+
var toPascalCase = (string) => {
|
|
381
|
+
const camelCase = toCamelCase(string);
|
|
382
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
383
|
+
};
|
|
384
|
+
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
385
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
386
|
+
}).join(" ").trim();
|
|
387
|
+
var hasA11yProp = (props) => {
|
|
388
|
+
for (const prop in props) {
|
|
389
|
+
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
390
|
+
return true;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
// node_modules/lucide-react/dist/esm/defaultAttributes.js
|
|
396
|
+
var defaultAttributes = {
|
|
397
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
398
|
+
width: 24,
|
|
399
|
+
height: 24,
|
|
400
|
+
viewBox: "0 0 24 24",
|
|
401
|
+
fill: "none",
|
|
402
|
+
stroke: "currentColor",
|
|
403
|
+
strokeWidth: 2,
|
|
404
|
+
strokeLinecap: "round",
|
|
405
|
+
strokeLinejoin: "round"
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
// node_modules/lucide-react/dist/esm/Icon.js
|
|
409
|
+
var Icon = react.forwardRef(
|
|
410
|
+
({
|
|
411
|
+
color = "currentColor",
|
|
412
|
+
size = 24,
|
|
413
|
+
strokeWidth = 2,
|
|
414
|
+
absoluteStrokeWidth,
|
|
415
|
+
className = "",
|
|
416
|
+
children,
|
|
417
|
+
iconNode,
|
|
418
|
+
...rest
|
|
419
|
+
}, ref) => react.createElement(
|
|
420
|
+
"svg",
|
|
421
|
+
{
|
|
422
|
+
ref,
|
|
423
|
+
...defaultAttributes,
|
|
424
|
+
width: size,
|
|
425
|
+
height: size,
|
|
426
|
+
stroke: color,
|
|
427
|
+
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
428
|
+
className: mergeClasses("lucide", className),
|
|
429
|
+
...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
|
|
430
|
+
...rest
|
|
431
|
+
},
|
|
432
|
+
[
|
|
433
|
+
...iconNode.map(([tag, attrs]) => react.createElement(tag, attrs)),
|
|
434
|
+
...Array.isArray(children) ? children : [children]
|
|
435
|
+
]
|
|
436
|
+
)
|
|
437
|
+
);
|
|
438
|
+
|
|
439
|
+
// node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
440
|
+
var createLucideIcon = (iconName, iconNode) => {
|
|
441
|
+
const Component = react.forwardRef(
|
|
442
|
+
({ className, ...props }, ref) => react.createElement(Icon, {
|
|
443
|
+
ref,
|
|
444
|
+
iconNode,
|
|
445
|
+
className: mergeClasses(
|
|
446
|
+
`lucide-${toKebabCase(toPascalCase(iconName))}`,
|
|
447
|
+
`lucide-${iconName}`,
|
|
448
|
+
className
|
|
449
|
+
),
|
|
450
|
+
...props
|
|
451
|
+
})
|
|
452
|
+
);
|
|
453
|
+
Component.displayName = toPascalCase(iconName);
|
|
454
|
+
return Component;
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
// node_modules/lucide-react/dist/esm/icons/maximize.js
|
|
458
|
+
var __iconNode = [
|
|
459
|
+
["path", { d: "M8 3H5a2 2 0 0 0-2 2v3", key: "1dcmit" }],
|
|
460
|
+
["path", { d: "M21 8V5a2 2 0 0 0-2-2h-3", key: "1e4gt3" }],
|
|
461
|
+
["path", { d: "M3 16v3a2 2 0 0 0 2 2h3", key: "wsl5sc" }],
|
|
462
|
+
["path", { d: "M16 21h3a2 2 0 0 0 2-2v-3", key: "18trek" }]
|
|
463
|
+
];
|
|
464
|
+
var Maximize = createLucideIcon("maximize", __iconNode);
|
|
465
|
+
|
|
466
|
+
// node_modules/lucide-react/dist/esm/icons/rotate-ccw.js
|
|
467
|
+
var __iconNode2 = [
|
|
468
|
+
["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
|
|
469
|
+
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
470
|
+
];
|
|
471
|
+
var RotateCcw = createLucideIcon("rotate-ccw", __iconNode2);
|
|
472
|
+
|
|
473
|
+
// node_modules/lucide-react/dist/esm/icons/zoom-in.js
|
|
474
|
+
var __iconNode3 = [
|
|
475
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
476
|
+
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
|
477
|
+
["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
|
|
478
|
+
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
|
|
479
|
+
];
|
|
480
|
+
var ZoomIn = createLucideIcon("zoom-in", __iconNode3);
|
|
481
|
+
|
|
482
|
+
// node_modules/lucide-react/dist/esm/icons/zoom-out.js
|
|
483
|
+
var __iconNode4 = [
|
|
484
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
485
|
+
["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
|
|
486
|
+
["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
|
|
487
|
+
];
|
|
488
|
+
var ZoomOut = createLucideIcon("zoom-out", __iconNode4);
|
|
489
|
+
function CanvasControls({
|
|
490
|
+
className,
|
|
491
|
+
showZoomIn = true,
|
|
492
|
+
showZoomOut = true,
|
|
493
|
+
showReset = true,
|
|
494
|
+
showFitAll = true
|
|
495
|
+
}) {
|
|
496
|
+
const { setViewport, nodeRects, containerRef } = useCanvas();
|
|
497
|
+
const zoomIn = () => setViewport((v) => ({ ...v, zoom: Math.min(3, v.zoom * 1.25) }));
|
|
498
|
+
const zoomOut = () => setViewport((v) => ({ ...v, zoom: Math.max(0.1, v.zoom / 1.25) }));
|
|
499
|
+
const reset = () => setViewport({ panX: 0, panY: 0, zoom: 1 });
|
|
500
|
+
const fitAll = () => {
|
|
501
|
+
const container = containerRef.current;
|
|
502
|
+
if (!container || nodeRects.size === 0) return reset();
|
|
503
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
504
|
+
nodeRects.forEach((r) => {
|
|
505
|
+
minX = Math.min(minX, r.x);
|
|
506
|
+
minY = Math.min(minY, r.y);
|
|
507
|
+
maxX = Math.max(maxX, r.x + r.width);
|
|
508
|
+
maxY = Math.max(maxY, r.y + r.height);
|
|
509
|
+
});
|
|
510
|
+
const padding = 40;
|
|
511
|
+
const contentW = maxX - minX + padding * 2;
|
|
512
|
+
const contentH = maxY - minY + padding * 2;
|
|
513
|
+
const cw = container.clientWidth;
|
|
514
|
+
const ch = container.clientHeight;
|
|
515
|
+
const zoom = Math.min(cw / contentW, ch / contentH, 1.5);
|
|
516
|
+
const panX = (cw - contentW * zoom) / 2 - minX * zoom + padding * zoom;
|
|
517
|
+
const panY = (ch - contentH * zoom) / 2 - minY * zoom + padding * zoom;
|
|
518
|
+
setViewport({ panX, panY, zoom });
|
|
519
|
+
};
|
|
520
|
+
const btnClass = "flex h-8 w-8 items-center justify-center rounded-md text-zinc-500 hover:bg-zinc-100 hover:text-zinc-700 dark:hover:bg-zinc-800 dark:hover:text-zinc-300 transition-colors";
|
|
521
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
522
|
+
"div",
|
|
523
|
+
{
|
|
524
|
+
"data-react-fancy-canvas-controls": "",
|
|
525
|
+
className: cn(
|
|
526
|
+
"absolute bottom-3 left-3 flex gap-1 rounded-lg border border-zinc-200 bg-white/90 p-1 shadow-sm dark:border-zinc-700 dark:bg-zinc-900/90",
|
|
527
|
+
className
|
|
528
|
+
),
|
|
529
|
+
children: [
|
|
530
|
+
showZoomIn && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: zoomIn, className: btnClass, "aria-label": "Zoom in", children: /* @__PURE__ */ jsxRuntime.jsx(ZoomIn, { size: 16 }) }),
|
|
531
|
+
showZoomOut && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: zoomOut, className: btnClass, "aria-label": "Zoom out", children: /* @__PURE__ */ jsxRuntime.jsx(ZoomOut, { size: 16 }) }),
|
|
532
|
+
showReset && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: reset, className: btnClass, "aria-label": "Reset view", children: /* @__PURE__ */ jsxRuntime.jsx(RotateCcw, { size: 16 }) }),
|
|
533
|
+
showFitAll && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: fitAll, className: btnClass, "aria-label": "Fit all", children: /* @__PURE__ */ jsxRuntime.jsx(Maximize, { size: 16 }) })
|
|
534
|
+
]
|
|
535
|
+
}
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
CanvasControls.displayName = "CanvasControls";
|
|
539
|
+
|
|
540
|
+
// src/canvas/engines/dom.ts
|
|
541
|
+
var domEngine = {
|
|
542
|
+
name: "dom",
|
|
543
|
+
mount(host, _viewport) {
|
|
544
|
+
return {
|
|
545
|
+
name: "dom",
|
|
546
|
+
root: host,
|
|
547
|
+
updateViewport: () => {
|
|
548
|
+
},
|
|
549
|
+
dispose: () => {
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
// src/canvas/engines/babylon.ts
|
|
556
|
+
var babylonEngine = {
|
|
557
|
+
name: "babylon",
|
|
558
|
+
mount(host, viewport) {
|
|
559
|
+
const BABYLON = __require("@babylonjs/core");
|
|
560
|
+
const overlay = document.createElement("canvas");
|
|
561
|
+
overlay.style.position = "absolute";
|
|
562
|
+
overlay.style.inset = "0";
|
|
563
|
+
overlay.style.width = "100%";
|
|
564
|
+
overlay.style.height = "100%";
|
|
565
|
+
overlay.style.pointerEvents = "none";
|
|
566
|
+
overlay.dataset.fancy3dCanvasEngine = "babylon";
|
|
567
|
+
host.appendChild(overlay);
|
|
568
|
+
const engine = new BABYLON.Engine(overlay, true, { preserveDrawingBuffer: true, stencil: true });
|
|
569
|
+
const scene = new BABYLON.Scene(engine);
|
|
570
|
+
scene.clearColor = new BABYLON.Color4(0, 0, 0, 0);
|
|
571
|
+
const camera = new BABYLON.ArcRotateCamera(
|
|
572
|
+
"fancy3d-canvas-camera",
|
|
573
|
+
Math.PI / 2,
|
|
574
|
+
Math.PI / 2.5,
|
|
575
|
+
8,
|
|
576
|
+
BABYLON.Vector3.Zero(),
|
|
577
|
+
scene
|
|
578
|
+
);
|
|
579
|
+
camera.attachControl(overlay, false);
|
|
580
|
+
new BABYLON.HemisphericLight("fancy3d-canvas-light", new BABYLON.Vector3(0, 1, 0), scene);
|
|
581
|
+
const observer = engine.runRenderLoop(() => scene.render());
|
|
582
|
+
function updateViewport(_v) {
|
|
583
|
+
}
|
|
584
|
+
function dispose() {
|
|
585
|
+
try {
|
|
586
|
+
engine.stopRenderLoop(observer);
|
|
587
|
+
} catch {
|
|
588
|
+
}
|
|
589
|
+
scene.dispose();
|
|
590
|
+
engine.dispose();
|
|
591
|
+
if (overlay.parentElement === host) host.removeChild(overlay);
|
|
592
|
+
}
|
|
593
|
+
return {
|
|
594
|
+
name: "babylon",
|
|
595
|
+
root: scene,
|
|
596
|
+
updateViewport,
|
|
597
|
+
dispose
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
function resolveEngine(spec) {
|
|
602
|
+
if (!spec || spec === "dom") return domEngine;
|
|
603
|
+
if (spec === "babylon") return babylonEngine;
|
|
604
|
+
return spec;
|
|
605
|
+
}
|
|
606
|
+
var DEFAULT_VIEWPORT = { panX: 0, panY: 0, zoom: 1 };
|
|
607
|
+
function CanvasRoot({
|
|
608
|
+
children,
|
|
609
|
+
viewport: controlledViewport,
|
|
610
|
+
defaultViewport = DEFAULT_VIEWPORT,
|
|
611
|
+
onViewportChange,
|
|
612
|
+
minZoom = 0.1,
|
|
613
|
+
maxZoom = 3,
|
|
614
|
+
pannable = true,
|
|
615
|
+
zoomable = true,
|
|
616
|
+
showGrid = false,
|
|
617
|
+
gridStyle = "dots",
|
|
618
|
+
gridSize = 20,
|
|
619
|
+
gridColor = "rgb(161 161 170 / 0.3)",
|
|
620
|
+
snapToGrid = false,
|
|
621
|
+
fitOnMount = false,
|
|
622
|
+
engine: engineSpec,
|
|
623
|
+
className,
|
|
624
|
+
style
|
|
625
|
+
}) {
|
|
626
|
+
const containerRef = react.useRef(null);
|
|
627
|
+
const [viewport, setViewport] = useControllableState(controlledViewport, defaultViewport, onViewportChange);
|
|
628
|
+
const { registerNode, unregisterNode, nodeRects, version: registryVersion } = useNodeRegistry();
|
|
629
|
+
const [engineHandle, setEngineHandle] = react.useState(null);
|
|
630
|
+
react.useEffect(() => {
|
|
631
|
+
const host = containerRef.current;
|
|
632
|
+
if (!host) return;
|
|
633
|
+
const resolved = resolveEngine(engineSpec);
|
|
634
|
+
let handle = null;
|
|
635
|
+
try {
|
|
636
|
+
handle = resolved.mount(host, viewport);
|
|
637
|
+
setEngineHandle(handle);
|
|
638
|
+
} catch (err) {
|
|
639
|
+
console.error(`[fancy-3d] Canvas engine "${resolved.name}" failed to mount:`, err);
|
|
640
|
+
setEngineHandle(null);
|
|
641
|
+
}
|
|
642
|
+
return () => {
|
|
643
|
+
try {
|
|
644
|
+
handle?.dispose();
|
|
645
|
+
} catch (err) {
|
|
646
|
+
console.error(`[fancy-3d] Canvas engine "${handle?.name}" failed to dispose:`, err);
|
|
647
|
+
}
|
|
648
|
+
setEngineHandle(null);
|
|
649
|
+
};
|
|
650
|
+
}, [engineSpec]);
|
|
651
|
+
react.useEffect(() => {
|
|
652
|
+
engineHandle?.updateViewport(viewport);
|
|
653
|
+
}, [engineHandle, viewport]);
|
|
654
|
+
const { containerProps } = usePanZoom({
|
|
655
|
+
viewport,
|
|
656
|
+
setViewport,
|
|
657
|
+
minZoom,
|
|
658
|
+
maxZoom,
|
|
659
|
+
pannable,
|
|
660
|
+
zoomable,
|
|
661
|
+
containerRef
|
|
662
|
+
});
|
|
663
|
+
const ctx = react.useMemo(
|
|
664
|
+
() => ({ viewport, setViewport, registerNode, unregisterNode, nodeRects, registryVersion, containerRef, gridSize, snapToGrid, engine: engineHandle }),
|
|
665
|
+
[viewport, setViewport, registerNode, unregisterNode, nodeRects, registryVersion, gridSize, snapToGrid, engineHandle]
|
|
666
|
+
);
|
|
667
|
+
const hasFitted = react.useRef(false);
|
|
668
|
+
react.useEffect(() => {
|
|
669
|
+
if (!fitOnMount || hasFitted.current || nodeRects.size === 0) return;
|
|
670
|
+
const container = containerRef.current;
|
|
671
|
+
if (!container || container.clientWidth === 0) return;
|
|
672
|
+
hasFitted.current = true;
|
|
673
|
+
requestAnimationFrame(() => {
|
|
674
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
675
|
+
nodeRects.forEach((r) => {
|
|
676
|
+
minX = Math.min(minX, r.x);
|
|
677
|
+
minY = Math.min(minY, r.y);
|
|
678
|
+
maxX = Math.max(maxX, r.x + r.width);
|
|
679
|
+
maxY = Math.max(maxY, r.y + r.height);
|
|
680
|
+
});
|
|
681
|
+
const padding = 40;
|
|
682
|
+
const contentW = maxX - minX + padding * 2;
|
|
683
|
+
const contentH = maxY - minY + padding * 2;
|
|
684
|
+
const cw = container.clientWidth;
|
|
685
|
+
const ch = container.clientHeight;
|
|
686
|
+
const zoom = Math.min(cw / contentW, ch / contentH, 1.5);
|
|
687
|
+
const panX = (cw - contentW * zoom) / 2 - minX * zoom + padding * zoom;
|
|
688
|
+
const panY = (ch - contentH * zoom) / 2 - minY * zoom + padding * zoom;
|
|
689
|
+
setViewport({ panX, panY, zoom });
|
|
690
|
+
});
|
|
691
|
+
}, [fitOnMount, nodeRects, registryVersion, setViewport]);
|
|
692
|
+
const edges = [];
|
|
693
|
+
const others = [];
|
|
694
|
+
const overlays = [];
|
|
695
|
+
react.Children.forEach(children, (child) => {
|
|
696
|
+
const el = child;
|
|
697
|
+
if (!el || !el.type) return;
|
|
698
|
+
const elType = el.type;
|
|
699
|
+
if (elType === CanvasEdge || elType?._isCanvasEdge) {
|
|
700
|
+
edges.push(el);
|
|
701
|
+
} else if (elType === CanvasMinimap || elType === CanvasControls) {
|
|
702
|
+
overlays.push(el);
|
|
703
|
+
} else {
|
|
704
|
+
others.push(el);
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CanvasContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
708
|
+
"div",
|
|
709
|
+
{
|
|
710
|
+
ref: containerRef,
|
|
711
|
+
"data-react-fancy-canvas": "",
|
|
712
|
+
className: cn("relative overflow-hidden", className),
|
|
713
|
+
style: { touchAction: "none", ...style },
|
|
714
|
+
...containerProps,
|
|
715
|
+
children: [
|
|
716
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
717
|
+
"div",
|
|
718
|
+
{
|
|
719
|
+
"data-canvas-bg": "",
|
|
720
|
+
className: "absolute inset-0",
|
|
721
|
+
style: showGrid && gridStyle !== "none" ? gridStyle === "lines" ? {
|
|
722
|
+
backgroundImage: `linear-gradient(to right, ${gridColor} 1px, transparent 1px), linear-gradient(to bottom, ${gridColor} 1px, transparent 1px)`,
|
|
723
|
+
backgroundSize: `${gridSize * viewport.zoom}px ${gridSize * viewport.zoom}px`,
|
|
724
|
+
backgroundPosition: `${viewport.panX}px ${viewport.panY}px`
|
|
725
|
+
} : {
|
|
726
|
+
backgroundImage: `radial-gradient(circle, ${gridColor} 1px, transparent 1px)`,
|
|
727
|
+
backgroundSize: `${gridSize * viewport.zoom}px ${gridSize * viewport.zoom}px`,
|
|
728
|
+
backgroundPosition: `${viewport.panX}px ${viewport.panY}px`
|
|
729
|
+
} : void 0
|
|
730
|
+
}
|
|
731
|
+
),
|
|
732
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
733
|
+
"div",
|
|
734
|
+
{
|
|
735
|
+
className: "absolute origin-top-left",
|
|
736
|
+
style: {
|
|
737
|
+
transform: `translate(${viewport.panX}px, ${viewport.panY}px) scale(${viewport.zoom})`
|
|
738
|
+
},
|
|
739
|
+
children: others
|
|
740
|
+
}
|
|
741
|
+
),
|
|
742
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
743
|
+
"svg",
|
|
744
|
+
{
|
|
745
|
+
className: "pointer-events-none absolute inset-0 h-full w-full",
|
|
746
|
+
style: {
|
|
747
|
+
transform: `translate(${viewport.panX}px, ${viewport.panY}px) scale(${viewport.zoom})`,
|
|
748
|
+
transformOrigin: "0 0"
|
|
749
|
+
},
|
|
750
|
+
children: [
|
|
751
|
+
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
752
|
+
/* @__PURE__ */ jsxRuntime.jsx("marker", { id: "canvas-arrow", viewBox: "0 0 10 10", refX: "10", refY: "5", markerWidth: "8", markerHeight: "8", orient: "auto", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0,0 L10,5 L0,10 Z", fill: "#71717a" }) }),
|
|
753
|
+
/* @__PURE__ */ jsxRuntime.jsx("marker", { id: "canvas-circle", viewBox: "0 0 10 10", refX: "5", refY: "5", markerWidth: "8", markerHeight: "8", orient: "auto", children: /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "5", cy: "5", r: "3.5", fill: "#71717a" }) }),
|
|
754
|
+
/* @__PURE__ */ jsxRuntime.jsx("marker", { id: "canvas-diamond", viewBox: "0 0 12 12", refX: "6", refY: "6", markerWidth: "10", markerHeight: "10", orient: "auto", children: /* @__PURE__ */ jsxRuntime.jsx("polygon", { points: "6,0 12,6 6,12 0,6", fill: "none", stroke: "#71717a", strokeWidth: "1.5" }) }),
|
|
755
|
+
/* @__PURE__ */ jsxRuntime.jsx("marker", { id: "canvas-one", viewBox: "0 0 2 16", refX: "1", refY: "8", markerWidth: "2", markerHeight: "14", orient: "auto", children: /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "1", y1: "0", x2: "1", y2: "16", stroke: "#71717a", strokeWidth: "2" }) }),
|
|
756
|
+
/* @__PURE__ */ jsxRuntime.jsxs("marker", { id: "canvas-crow-foot", viewBox: "0 0 16 16", refX: "16", refY: "8", markerWidth: "14", markerHeight: "14", orient: "auto", children: [
|
|
757
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "16", y1: "8", x2: "0", y2: "0", stroke: "#71717a", strokeWidth: "2", strokeLinecap: "round" }),
|
|
758
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "16", y1: "8", x2: "0", y2: "8", stroke: "#71717a", strokeWidth: "2", strokeLinecap: "round" }),
|
|
759
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "16", y1: "8", x2: "0", y2: "16", stroke: "#71717a", strokeWidth: "2", strokeLinecap: "round" }),
|
|
760
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "16", y1: "0", x2: "16", y2: "16", stroke: "#71717a", strokeWidth: "2", strokeLinecap: "round" })
|
|
761
|
+
] })
|
|
762
|
+
] }),
|
|
763
|
+
edges
|
|
764
|
+
]
|
|
765
|
+
}
|
|
766
|
+
),
|
|
767
|
+
overlays
|
|
768
|
+
]
|
|
769
|
+
}
|
|
770
|
+
) });
|
|
771
|
+
}
|
|
772
|
+
var Canvas = Object.assign(CanvasRoot, {
|
|
773
|
+
Node: CanvasNode,
|
|
774
|
+
Edge: CanvasEdge,
|
|
775
|
+
Minimap: CanvasMinimap,
|
|
776
|
+
Controls: CanvasControls
|
|
777
|
+
});
|
|
778
|
+
/*! Bundled license information:
|
|
779
|
+
|
|
780
|
+
lucide-react/dist/esm/shared/src/utils.js:
|
|
781
|
+
lucide-react/dist/esm/defaultAttributes.js:
|
|
782
|
+
lucide-react/dist/esm/Icon.js:
|
|
783
|
+
lucide-react/dist/esm/createLucideIcon.js:
|
|
784
|
+
lucide-react/dist/esm/icons/maximize.js:
|
|
785
|
+
lucide-react/dist/esm/icons/rotate-ccw.js:
|
|
786
|
+
lucide-react/dist/esm/icons/zoom-in.js:
|
|
787
|
+
lucide-react/dist/esm/icons/zoom-out.js:
|
|
788
|
+
lucide-react/dist/esm/lucide-react.js:
|
|
789
|
+
(**
|
|
790
|
+
* @license lucide-react v0.511.0 - ISC
|
|
791
|
+
*
|
|
792
|
+
* This source code is licensed under the ISC license.
|
|
793
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
794
|
+
*)
|
|
795
|
+
*/
|
|
796
|
+
|
|
797
|
+
exports.Canvas = Canvas;
|
|
798
|
+
exports.babylonEngine = babylonEngine;
|
|
799
|
+
exports.domEngine = domEngine;
|
|
800
|
+
exports.useCanvas = useCanvas;
|
|
801
|
+
//# sourceMappingURL=index.cjs.map
|
|
802
|
+
//# sourceMappingURL=index.cjs.map
|