@cardenelabs/cdl 0.42.0 → 0.43.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/react.cjs CHANGED
@@ -8941,7 +8941,8 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
8941
8941
  const nodeById = new Map(nodes.map((n) => [n.id, n]));
8942
8942
  const sortedByX = [...layoutedLanes].sort((a, b) => a.x - b.x);
8943
8943
  const laneIndexById = new Map(sortedByX.map((lane, i) => [lane.id, i]));
8944
- const requiredBoxWByPair = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
8944
+ const requiredBoxWAdjacent = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
8945
+ const requiredBoxWSpanning = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
8945
8946
  for (const edge of edges) {
8946
8947
  const fromLane = nodeById.get(edge.from)?.lane;
8947
8948
  const toLane = nodeById.get(edge.to)?.lane;
@@ -8953,23 +8954,33 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
8953
8954
  if (labelBoxW === 0) continue;
8954
8955
  const lo = Math.min(fi, ti);
8955
8956
  const hi = Math.max(fi, ti);
8957
+ const \u8981\u6C42 = hi - lo === 1 ? requiredBoxWAdjacent : requiredBoxWSpanning;
8956
8958
  for (let pair = lo; pair < hi; pair++) {
8957
- if (labelBoxW > requiredBoxWByPair[pair]) requiredBoxWByPair[pair] = labelBoxW;
8959
+ if (labelBoxW > \u8981\u6C42[pair]) \u8981\u6C42[pair] = labelBoxW;
8958
8960
  }
8959
8961
  }
8962
+ const \u7BB1\u306E\u534A\u5E45 = /* @__PURE__ */ new Map();
8963
+ for (const n of nodes) {
8964
+ const \u4ECA = \u7BB1\u306E\u534A\u5E45.get(n.lane) ?? 0;
8965
+ if (n.w / 2 > \u4ECA) \u7BB1\u306E\u534A\u5E45.set(n.lane, n.w / 2);
8966
+ }
8960
8967
  const requiredPitchByPair = [];
8961
8968
  for (let i = 0; i < sortedByX.length - 1; i++) {
8962
8969
  const lane = sortedByX[i];
8963
8970
  const rightLane = sortedByX[i + 1];
8964
- const halfSum = lane.width / 2 + rightLane.width / 2;
8971
+ const laneHalfSum = lane.width / 2 + rightLane.width / 2;
8972
+ const nodeHalfSum = (\u7BB1\u306E\u534A\u5E45.get(lane.id) ?? 0) + (\u7BB1\u306E\u534A\u5E45.get(rightLane.id) ?? 0);
8965
8973
  const currentPitch = rightLane.x + rightLane.width / 2 - (lane.x + lane.width / 2);
8966
- const maxLabelBoxW = requiredBoxWByPair[i];
8967
- if (maxLabelBoxW === 0) {
8974
+ const \u96A3 = requiredBoxWAdjacent[i];
8975
+ const \u8DE8 = requiredBoxWSpanning[i];
8976
+ if (\u96A3 === 0 && \u8DE8 === 0) {
8968
8977
  requiredPitchByPair.push(currentPitch);
8969
8978
  continue;
8970
8979
  }
8971
- const requiredGap = maxLabelBoxW + CLEARANCE_NODE_LABEL * 2 + EDGE_STUB_OUT * 2;
8972
- requiredPitchByPair.push(Math.max(currentPitch, requiredGap + halfSum));
8980
+ const \u4E0A\u4E57\u305B = CLEARANCE_NODE_LABEL * 2 + EDGE_STUB_OUT * 2;
8981
+ const \u96A3\u306E\u8981\u6C42 = \u96A3 === 0 ? 0 : \u96A3 + \u4E0A\u4E57\u305B + nodeHalfSum;
8982
+ const \u8DE8\u306E\u8981\u6C42 = \u8DE8 === 0 ? 0 : \u8DE8 + \u4E0A\u4E57\u305B + laneHalfSum;
8983
+ requiredPitchByPair.push(Math.max(currentPitch, \u96A3\u306E\u8981\u6C42, \u8DE8\u306E\u8981\u6C42));
8973
8984
  }
8974
8985
  const targetPitch = Math.ceil(Math.max(...requiredPitchByPair));
8975
8986
  const shiftedXById = /* @__PURE__ */ new Map();