@carlonicora/nextjs-jsonapi 1.98.0 → 1.100.0
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/{BlockNoteEditor-HWQHTLEB.mjs → BlockNoteEditor-QH3NPFYN.mjs} +2 -2
- package/dist/{BlockNoteEditor-3SXAMY6O.js → BlockNoteEditor-ZD2AMN72.js} +9 -9
- package/dist/{BlockNoteEditor-3SXAMY6O.js.map → BlockNoteEditor-ZD2AMN72.js.map} +1 -1
- package/dist/billing/index.js +299 -299
- package/dist/billing/index.mjs +1 -1
- package/dist/{chunk-S5LH5422.js → chunk-LIZ5C76W.js} +547 -343
- package/dist/chunk-LIZ5C76W.js.map +1 -0
- package/dist/{chunk-TLTENUI6.mjs → chunk-S34H33HJ.mjs} +312 -108
- package/dist/chunk-S34H33HJ.mjs.map +1 -0
- package/dist/client/index.d.mts +44 -1
- package/dist/client/index.d.ts +44 -1
- package/dist/client/index.js +6 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +5 -1
- package/dist/components/index.js +2 -2
- package/dist/components/index.mjs +1 -1
- package/dist/contexts/index.js +2 -2
- package/dist/contexts/index.mjs +1 -1
- package/package.json +3 -1
- package/src/hooks/__tests__/computeLayeredLayout.spec.ts +286 -0
- package/src/hooks/computeLayeredLayout.ts +209 -0
- package/src/hooks/index.ts +8 -0
- package/src/hooks/useCustomD3Graph.tsx +233 -140
- package/dist/chunk-S5LH5422.js.map +0 -1
- package/dist/chunk-TLTENUI6.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-HWQHTLEB.mjs.map → BlockNoteEditor-QH3NPFYN.mjs.map} +0 -0
|
@@ -6454,6 +6454,137 @@ import * as d3 from "d3";
|
|
|
6454
6454
|
import { Loader2 as Loader22 } from "lucide-react";
|
|
6455
6455
|
import { useCallback as useCallback9, useEffect as useEffect8, useMemo as useMemo8, useRef as useRef8 } from "react";
|
|
6456
6456
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
6457
|
+
|
|
6458
|
+
// src/hooks/computeLayeredLayout.ts
|
|
6459
|
+
import * as dagre from "dagre";
|
|
6460
|
+
var DEFAULT_RANKDIR = "LR";
|
|
6461
|
+
var DEFAULT_NODESEP = 50;
|
|
6462
|
+
var DEFAULT_RANKSEP = 120;
|
|
6463
|
+
var MIN_NODESEP = 20;
|
|
6464
|
+
var MAX_NODESEP = 400;
|
|
6465
|
+
var MIN_RANKSEP = 40;
|
|
6466
|
+
var MAX_RANKSEP = 600;
|
|
6467
|
+
var MIN_FACTOR = 0.25;
|
|
6468
|
+
var MAX_FACTOR = 4;
|
|
6469
|
+
var DEFAULT_TOLERANCE = 0.05;
|
|
6470
|
+
var DEFAULT_MAX_ITERATIONS = 4;
|
|
6471
|
+
var TITLE_PX_PER_CHAR_16 = 8;
|
|
6472
|
+
var NAME_PX_PER_CHAR_12 = 6.5;
|
|
6473
|
+
var NAME_PX_PER_CHAR_16_BOLD = 8;
|
|
6474
|
+
var SUBTITLE_PX_PER_CHAR_11 = 6;
|
|
6475
|
+
var LABEL_PADDING_PX = 16;
|
|
6476
|
+
function estimateLabelWidth(node) {
|
|
6477
|
+
if (node.subtitle) {
|
|
6478
|
+
const titleWidth = (node.name?.length ?? 0) * TITLE_PX_PER_CHAR_16;
|
|
6479
|
+
const subtitleWidth = node.subtitle.length * SUBTITLE_PX_PER_CHAR_11;
|
|
6480
|
+
return Math.max(titleWidth, subtitleWidth) + LABEL_PADDING_PX;
|
|
6481
|
+
}
|
|
6482
|
+
const perChar = node.bold ? NAME_PX_PER_CHAR_16_BOLD : NAME_PX_PER_CHAR_12;
|
|
6483
|
+
return (node.name?.length ?? 0) * perChar + LABEL_PADDING_PX;
|
|
6484
|
+
}
|
|
6485
|
+
__name(estimateLabelWidth, "estimateLabelWidth");
|
|
6486
|
+
function linkEndpointId(end) {
|
|
6487
|
+
return typeof end === "string" ? end : end.id;
|
|
6488
|
+
}
|
|
6489
|
+
__name(linkEndpointId, "linkEndpointId");
|
|
6490
|
+
function clamp(value, min, max) {
|
|
6491
|
+
return Math.min(Math.max(value, min), max);
|
|
6492
|
+
}
|
|
6493
|
+
__name(clamp, "clamp");
|
|
6494
|
+
function runDagreOnce(nodes, links, opts) {
|
|
6495
|
+
const rankdir = opts.rankdir ?? DEFAULT_RANKDIR;
|
|
6496
|
+
const nodesep = opts.nodesep ?? DEFAULT_NODESEP;
|
|
6497
|
+
const ranksep = opts.ranksep ?? DEFAULT_RANKSEP;
|
|
6498
|
+
const g = new dagre.graphlib.Graph({ directed: true });
|
|
6499
|
+
g.setGraph({ rankdir, nodesep, ranksep, marginx: 20, marginy: 20 });
|
|
6500
|
+
g.setDefaultEdgeLabel(() => ({}));
|
|
6501
|
+
for (const node of nodes) {
|
|
6502
|
+
const width = Math.max(opts.minNodeWidth, estimateLabelWidth(node));
|
|
6503
|
+
const height = opts.minNodeHeight;
|
|
6504
|
+
g.setNode(node.id, { width, height });
|
|
6505
|
+
}
|
|
6506
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6507
|
+
for (const link of links) {
|
|
6508
|
+
const sourceId = linkEndpointId(link.source);
|
|
6509
|
+
const targetId = linkEndpointId(link.target);
|
|
6510
|
+
if (!g.hasNode(sourceId) || !g.hasNode(targetId)) continue;
|
|
6511
|
+
const key = `${sourceId}->${targetId}`;
|
|
6512
|
+
if (seen.has(key)) continue;
|
|
6513
|
+
seen.add(key);
|
|
6514
|
+
g.setEdge(sourceId, targetId);
|
|
6515
|
+
}
|
|
6516
|
+
try {
|
|
6517
|
+
dagre.layout(g);
|
|
6518
|
+
} catch {
|
|
6519
|
+
return null;
|
|
6520
|
+
}
|
|
6521
|
+
const positions = /* @__PURE__ */ new Map();
|
|
6522
|
+
let xMin = Infinity;
|
|
6523
|
+
let xMax = -Infinity;
|
|
6524
|
+
let yMin = Infinity;
|
|
6525
|
+
let yMax = -Infinity;
|
|
6526
|
+
for (const node of nodes) {
|
|
6527
|
+
const laid = g.node(node.id);
|
|
6528
|
+
if (laid && Number.isFinite(laid.x) && Number.isFinite(laid.y)) {
|
|
6529
|
+
positions.set(node.id, { x: laid.x, y: laid.y });
|
|
6530
|
+
const halfW = (laid.width ?? opts.minNodeWidth) / 2;
|
|
6531
|
+
const halfH = (laid.height ?? opts.minNodeHeight) / 2;
|
|
6532
|
+
xMin = Math.min(xMin, laid.x - halfW);
|
|
6533
|
+
xMax = Math.max(xMax, laid.x + halfW);
|
|
6534
|
+
yMin = Math.min(yMin, laid.y - halfH);
|
|
6535
|
+
yMax = Math.max(yMax, laid.y + halfH);
|
|
6536
|
+
}
|
|
6537
|
+
}
|
|
6538
|
+
const bbox = positions.size === 0 ? { width: 0, height: 0 } : { width: Math.max(0, xMax - xMin), height: Math.max(0, yMax - yMin) };
|
|
6539
|
+
return { positions, bbox };
|
|
6540
|
+
}
|
|
6541
|
+
__name(runDagreOnce, "runDagreOnce");
|
|
6542
|
+
function computeLayeredLayout(nodes, links, opts) {
|
|
6543
|
+
if (nodes.length === 0) return /* @__PURE__ */ new Map();
|
|
6544
|
+
const result = runDagreOnce(nodes, links, opts);
|
|
6545
|
+
return result ? result.positions : null;
|
|
6546
|
+
}
|
|
6547
|
+
__name(computeLayeredLayout, "computeLayeredLayout");
|
|
6548
|
+
function fitLayeredLayoutToAspectRatio(nodes, links, opts) {
|
|
6549
|
+
if (nodes.length === 0) return /* @__PURE__ */ new Map();
|
|
6550
|
+
if (!Number.isFinite(opts.targetAspectRatio) || opts.targetAspectRatio <= 0) {
|
|
6551
|
+
return computeLayeredLayout(nodes, links, opts);
|
|
6552
|
+
}
|
|
6553
|
+
const maxIterations = opts.maxIterations ?? DEFAULT_MAX_ITERATIONS;
|
|
6554
|
+
const tolerance = opts.tolerance ?? DEFAULT_TOLERANCE;
|
|
6555
|
+
const rankdir = opts.rankdir ?? DEFAULT_RANKDIR;
|
|
6556
|
+
const isHorizontalFlow = rankdir === "LR" || rankdir === "RL";
|
|
6557
|
+
let nodesep = opts.nodesep ?? DEFAULT_NODESEP;
|
|
6558
|
+
let ranksep = opts.ranksep ?? DEFAULT_RANKSEP;
|
|
6559
|
+
let best = null;
|
|
6560
|
+
for (let i = 0; i < maxIterations; i++) {
|
|
6561
|
+
const result = runDagreOnce(nodes, links, {
|
|
6562
|
+
...opts,
|
|
6563
|
+
nodesep,
|
|
6564
|
+
ranksep
|
|
6565
|
+
});
|
|
6566
|
+
if (!result) return best ? best.positions : null;
|
|
6567
|
+
best = result;
|
|
6568
|
+
if (result.positions.size <= 1) return result.positions;
|
|
6569
|
+
const { width, height } = result.bbox;
|
|
6570
|
+
if (width === 0 || height === 0) return result.positions;
|
|
6571
|
+
const currentAspect = width / height;
|
|
6572
|
+
const ratio = opts.targetAspectRatio / currentAspect;
|
|
6573
|
+
if (Math.abs(ratio - 1) < tolerance) return result.positions;
|
|
6574
|
+
const factor = clamp(Math.sqrt(ratio), MIN_FACTOR, MAX_FACTOR);
|
|
6575
|
+
if (isHorizontalFlow) {
|
|
6576
|
+
ranksep = clamp(ranksep * factor, MIN_RANKSEP, MAX_RANKSEP);
|
|
6577
|
+
nodesep = clamp(nodesep / factor, MIN_NODESEP, MAX_NODESEP);
|
|
6578
|
+
} else {
|
|
6579
|
+
ranksep = clamp(ranksep / factor, MIN_RANKSEP, MAX_RANKSEP);
|
|
6580
|
+
nodesep = clamp(nodesep * factor, MIN_NODESEP, MAX_NODESEP);
|
|
6581
|
+
}
|
|
6582
|
+
}
|
|
6583
|
+
return best ? best.positions : null;
|
|
6584
|
+
}
|
|
6585
|
+
__name(fitLayeredLayoutToAspectRatio, "fitLayeredLayoutToAspectRatio");
|
|
6586
|
+
|
|
6587
|
+
// src/hooks/useCustomD3Graph.tsx
|
|
6457
6588
|
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
6458
6589
|
function useCustomD3Graph(nodes, links, onNodeClick, visibleNodeIds, options, loadingNodeIds, containerKey) {
|
|
6459
6590
|
const svgRef = useRef8(null);
|
|
@@ -6584,117 +6715,175 @@ function useCustomD3Graph(nodes, links, onNodeClick, visibleNodeIds, options, lo
|
|
|
6584
6715
|
});
|
|
6585
6716
|
zoomBehaviorRef.current = zoom2;
|
|
6586
6717
|
svg.call(zoom2).on("wheel.zoom", null).on("dblclick.zoom", null);
|
|
6587
|
-
const
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
}
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6718
|
+
const layoutMode = options?.layout ?? "radial";
|
|
6719
|
+
let layeredPositionsApplied = false;
|
|
6720
|
+
if (layoutMode === "layered") {
|
|
6721
|
+
const layeredOpts = options?.layered ?? {};
|
|
6722
|
+
const useFit = layeredOpts.fitContainer === true && width > 0 && height > 0;
|
|
6723
|
+
const positions = useFit ? fitLayeredLayoutToAspectRatio(visibleNodes, visibleLinks, {
|
|
6724
|
+
rankdir: layeredOpts.rankdir ?? "LR",
|
|
6725
|
+
nodesep: layeredOpts.nodesep,
|
|
6726
|
+
ranksep: layeredOpts.ranksep,
|
|
6727
|
+
minNodeWidth: nodeRadius * 2,
|
|
6728
|
+
minNodeHeight: nodeRadius * 2,
|
|
6729
|
+
targetAspectRatio: width / height
|
|
6730
|
+
}) : computeLayeredLayout(visibleNodes, visibleLinks, {
|
|
6731
|
+
rankdir: layeredOpts.rankdir ?? "LR",
|
|
6732
|
+
nodesep: layeredOpts.nodesep,
|
|
6733
|
+
ranksep: layeredOpts.ranksep,
|
|
6734
|
+
minNodeWidth: nodeRadius * 2,
|
|
6735
|
+
minNodeHeight: nodeRadius * 2
|
|
6736
|
+
});
|
|
6737
|
+
if (positions) {
|
|
6738
|
+
visibleNodes.forEach((node2) => {
|
|
6739
|
+
const saved = nodePositionsRef.current.get(node2.id);
|
|
6740
|
+
if (saved) {
|
|
6741
|
+
node2.fx = saved.x;
|
|
6742
|
+
node2.fy = saved.y;
|
|
6743
|
+
node2.x = saved.x;
|
|
6744
|
+
node2.y = saved.y;
|
|
6745
|
+
return;
|
|
6746
|
+
}
|
|
6747
|
+
const pos = positions.get(node2.id);
|
|
6748
|
+
if (pos) {
|
|
6749
|
+
node2.fx = pos.x;
|
|
6750
|
+
node2.fy = pos.y;
|
|
6751
|
+
node2.x = pos.x;
|
|
6752
|
+
node2.y = pos.y;
|
|
6753
|
+
nodePositionsRef.current.set(node2.id, { x: pos.x, y: pos.y });
|
|
6754
|
+
}
|
|
6755
|
+
});
|
|
6756
|
+
const nodeById = /* @__PURE__ */ new Map();
|
|
6757
|
+
visibleNodes.forEach((n) => nodeById.set(n.id, n));
|
|
6758
|
+
visibleLinks.forEach((link2) => {
|
|
6759
|
+
if (typeof link2.source === "string") {
|
|
6760
|
+
const src = nodeById.get(link2.source);
|
|
6761
|
+
if (src) link2.source = src;
|
|
6762
|
+
}
|
|
6763
|
+
if (typeof link2.target === "string") {
|
|
6764
|
+
const tgt = nodeById.get(link2.target);
|
|
6765
|
+
if (tgt) link2.target = tgt;
|
|
6766
|
+
}
|
|
6767
|
+
});
|
|
6768
|
+
layeredPositionsApplied = true;
|
|
6769
|
+
} else {
|
|
6770
|
+
console.warn("[useCustomD3Graph] Layered layout failed; falling back to radial.");
|
|
6625
6771
|
}
|
|
6626
|
-
}
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6772
|
+
}
|
|
6773
|
+
let simulation = null;
|
|
6774
|
+
if (!layeredPositionsApplied) {
|
|
6775
|
+
const childDistanceFromRoot = Math.min(width, height) * 0.4;
|
|
6776
|
+
const grandchildDistanceFromChild = nodeRadius * 10;
|
|
6777
|
+
const centralNodeId = nodes[0].id;
|
|
6778
|
+
const nodeHierarchy = /* @__PURE__ */ new Map();
|
|
6779
|
+
nodeHierarchy.set(centralNodeId, {
|
|
6780
|
+
depth: 0,
|
|
6781
|
+
parent: null,
|
|
6782
|
+
children: []
|
|
6783
|
+
});
|
|
6784
|
+
visibleLinks.forEach((link2) => {
|
|
6785
|
+
const sourceId = typeof link2.source === "string" ? link2.source : link2.source.id;
|
|
6786
|
+
const targetId = typeof link2.target === "string" ? link2.target : link2.target.id;
|
|
6787
|
+
if (sourceId === centralNodeId) {
|
|
6788
|
+
nodeHierarchy.set(targetId, { depth: 1, parent: centralNodeId, children: [] });
|
|
6789
|
+
const rootNode = nodeHierarchy.get(centralNodeId);
|
|
6790
|
+
if (rootNode) {
|
|
6791
|
+
rootNode.children.push(targetId);
|
|
6646
6792
|
}
|
|
6647
|
-
}
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6793
|
+
}
|
|
6794
|
+
});
|
|
6795
|
+
visibleLinks.forEach((link2) => {
|
|
6796
|
+
const sourceId = typeof link2.source === "string" ? link2.source : link2.source.id;
|
|
6797
|
+
const targetId = typeof link2.target === "string" ? link2.target : link2.target.id;
|
|
6798
|
+
const sourceNode = nodeHierarchy.get(sourceId);
|
|
6799
|
+
if (sourceNode && sourceNode.depth === 1 && !nodeHierarchy.has(targetId)) {
|
|
6800
|
+
nodeHierarchy.set(targetId, { depth: 2, parent: sourceId, children: [] });
|
|
6801
|
+
sourceNode.children.push(targetId);
|
|
6802
|
+
}
|
|
6803
|
+
});
|
|
6804
|
+
const rootChildren = nodeHierarchy.get(centralNodeId)?.children || [];
|
|
6805
|
+
const childAngleStep = 2 * Math.PI / Math.max(rootChildren.length, 1);
|
|
6806
|
+
rootChildren.forEach((childId, index) => {
|
|
6807
|
+
const childNode = nodeHierarchy.get(childId);
|
|
6808
|
+
if (childNode) {
|
|
6809
|
+
const angle = index * childAngleStep;
|
|
6810
|
+
childNode.angle = angle;
|
|
6811
|
+
childNode.x = width / 2 + childDistanceFromRoot * Math.cos(angle);
|
|
6812
|
+
childNode.y = height / 2 + childDistanceFromRoot * Math.sin(angle);
|
|
6813
|
+
}
|
|
6814
|
+
});
|
|
6815
|
+
for (const [_nodeId, node2] of nodeHierarchy.entries()) {
|
|
6816
|
+
if (node2.depth === 1 && node2.angle !== void 0 && node2.x !== void 0 && node2.y !== void 0) {
|
|
6817
|
+
const childAngle = node2.angle;
|
|
6818
|
+
const childX = node2.x;
|
|
6819
|
+
const childY = node2.y;
|
|
6820
|
+
const grandchildren = node2.children;
|
|
6821
|
+
if (grandchildren.length === 0) continue;
|
|
6822
|
+
const dirX = childX - width / 2;
|
|
6823
|
+
const dirY = childY - height / 2;
|
|
6824
|
+
const dirLength = Math.sqrt(dirX * dirX + dirY * dirY);
|
|
6825
|
+
const normDirX = dirX / dirLength;
|
|
6826
|
+
const normDirY = dirY / dirLength;
|
|
6827
|
+
if (grandchildren.length === 1) {
|
|
6828
|
+
const grandchildId = grandchildren[0];
|
|
6655
6829
|
const grandchildNode = nodeHierarchy.get(grandchildId);
|
|
6656
|
-
if (
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6830
|
+
if (grandchildNode) {
|
|
6831
|
+
grandchildNode.x = childX + normDirX * grandchildDistanceFromChild;
|
|
6832
|
+
grandchildNode.y = childY + normDirY * grandchildDistanceFromChild;
|
|
6833
|
+
grandchildNode.angle = childAngle;
|
|
6834
|
+
}
|
|
6835
|
+
} else {
|
|
6836
|
+
const numChildren = grandchildren.length;
|
|
6837
|
+
const minArc = Math.PI / 3;
|
|
6838
|
+
const maxArc = Math.PI;
|
|
6839
|
+
const arcProgress = Math.min(1, (numChildren - 2) / 5);
|
|
6840
|
+
const arcSpan = minArc + arcProgress * (maxArc - minArc);
|
|
6841
|
+
const startAngle = childAngle - arcSpan / 2;
|
|
6842
|
+
grandchildren.forEach((grandchildId, index) => {
|
|
6843
|
+
const grandchildNode = nodeHierarchy.get(grandchildId);
|
|
6844
|
+
if (!grandchildNode) return;
|
|
6845
|
+
const angleOffset = numChildren > 1 ? index / (numChildren - 1) * arcSpan : 0;
|
|
6846
|
+
const angle = startAngle + angleOffset;
|
|
6847
|
+
grandchildNode.x = childX + grandchildDistanceFromChild * Math.cos(angle);
|
|
6848
|
+
grandchildNode.y = childY + grandchildDistanceFromChild * Math.sin(angle);
|
|
6849
|
+
grandchildNode.angle = angle;
|
|
6850
|
+
});
|
|
6851
|
+
}
|
|
6663
6852
|
}
|
|
6664
6853
|
}
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6854
|
+
visibleNodes.forEach((node2) => {
|
|
6855
|
+
const savedPosition = nodePositionsRef.current.get(node2.id);
|
|
6856
|
+
if (savedPosition) {
|
|
6857
|
+
node2.fx = savedPosition.x;
|
|
6858
|
+
node2.fy = savedPosition.y;
|
|
6859
|
+
} else {
|
|
6860
|
+
const hierarchyNode = nodeHierarchy.get(node2.id);
|
|
6861
|
+
if (hierarchyNode && hierarchyNode.x !== void 0 && hierarchyNode.y !== void 0) {
|
|
6862
|
+
node2.fx = hierarchyNode.x;
|
|
6863
|
+
node2.fy = hierarchyNode.y;
|
|
6864
|
+
nodePositionsRef.current.set(node2.id, { x: hierarchyNode.x, y: hierarchyNode.y });
|
|
6865
|
+
} else if (node2.id === centralNodeId) {
|
|
6866
|
+
node2.fx = width / 2;
|
|
6867
|
+
node2.fy = height / 2;
|
|
6868
|
+
nodePositionsRef.current.set(node2.id, { x: width / 2, y: height / 2 });
|
|
6869
|
+
}
|
|
6681
6870
|
}
|
|
6871
|
+
});
|
|
6872
|
+
simulation = d3.forceSimulation(visibleNodes).force(
|
|
6873
|
+
"link",
|
|
6874
|
+
d3.forceLink(visibleLinks).id((d) => d.id).distance(nodeRadius * 3).strength(0.1)
|
|
6875
|
+
).force("charge", d3.forceManyBody().strength(-500).distanceMax(300)).force("collision", d3.forceCollide().radius(nodeRadius * 1.2)).force("center", d3.forceCenter(width / 2, height / 2).strength(0.1));
|
|
6876
|
+
simulation.stop();
|
|
6877
|
+
for (let i = 0; i < 100; i++) {
|
|
6878
|
+
simulation.tick();
|
|
6682
6879
|
}
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
simulation.tick();
|
|
6691
|
-
}
|
|
6692
|
-
visibleNodes.forEach((node2) => {
|
|
6693
|
-
if (node2.fx === void 0) {
|
|
6694
|
-
node2.fx = node2.x;
|
|
6695
|
-
node2.fy = node2.y;
|
|
6696
|
-
}
|
|
6697
|
-
});
|
|
6880
|
+
visibleNodes.forEach((node2) => {
|
|
6881
|
+
if (node2.fx === void 0) {
|
|
6882
|
+
node2.fx = node2.x;
|
|
6883
|
+
node2.fy = node2.y;
|
|
6884
|
+
}
|
|
6885
|
+
});
|
|
6886
|
+
}
|
|
6698
6887
|
const linkX2 = /* @__PURE__ */ __name((sx, sy, tx, ty) => {
|
|
6699
6888
|
if (!directed) return tx;
|
|
6700
6889
|
const dx = tx - sx;
|
|
@@ -6836,9 +7025,22 @@ function useCustomD3Graph(nodes, links, onNodeClick, visibleNodeIds, options, lo
|
|
|
6836
7025
|
}
|
|
6837
7026
|
});
|
|
6838
7027
|
return () => {
|
|
6839
|
-
simulation
|
|
7028
|
+
simulation?.stop();
|
|
6840
7029
|
};
|
|
6841
|
-
}, [
|
|
7030
|
+
}, [
|
|
7031
|
+
nodes,
|
|
7032
|
+
links,
|
|
7033
|
+
colorScale,
|
|
7034
|
+
visibleNodeIds,
|
|
7035
|
+
options?.directed,
|
|
7036
|
+
options?.layout,
|
|
7037
|
+
options?.layered?.rankdir,
|
|
7038
|
+
options?.layered?.nodesep,
|
|
7039
|
+
options?.layered?.ranksep,
|
|
7040
|
+
options?.layered?.fitContainer,
|
|
7041
|
+
loadingNodeIds,
|
|
7042
|
+
onNodeClick
|
|
7043
|
+
]);
|
|
6842
7044
|
const zoomIn = useCallback9(() => {
|
|
6843
7045
|
if (!svgRef.current || !zoomBehaviorRef.current) return;
|
|
6844
7046
|
const svg = d3.select(svgRef.current);
|
|
@@ -9273,7 +9475,7 @@ import { useRef as useRef15 } from "react";
|
|
|
9273
9475
|
import dynamic from "next/dynamic";
|
|
9274
9476
|
import React14 from "react";
|
|
9275
9477
|
import { jsx as jsx73 } from "react/jsx-runtime";
|
|
9276
|
-
var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-
|
|
9478
|
+
var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-QH3NPFYN.mjs"), {
|
|
9277
9479
|
ssr: false
|
|
9278
9480
|
});
|
|
9279
9481
|
var BlockNoteEditorContainer = React14.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
|
|
@@ -21687,6 +21889,8 @@ export {
|
|
|
21687
21889
|
useDebounce2 as useDebounce,
|
|
21688
21890
|
registerTableGenerator,
|
|
21689
21891
|
useTableGenerator,
|
|
21892
|
+
computeLayeredLayout,
|
|
21893
|
+
fitLayeredLayoutToAspectRatio,
|
|
21690
21894
|
useCustomD3Graph,
|
|
21691
21895
|
SocketContext,
|
|
21692
21896
|
SocketProvider,
|
|
@@ -22186,4 +22390,4 @@ export {
|
|
|
22186
22390
|
useOAuthClients,
|
|
22187
22391
|
useOAuthClient
|
|
22188
22392
|
};
|
|
22189
|
-
//# sourceMappingURL=chunk-
|
|
22393
|
+
//# sourceMappingURL=chunk-S34H33HJ.mjs.map
|