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