@cardenelabs/cdl 0.42.0 → 0.44.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
@@ -5880,10 +5880,16 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
5880
5880
  } catch {
5881
5881
  }
5882
5882
  }
5883
- const RESPONSIVE_REF_CONTAINER_PX = 1100;
5883
+ const RESPONSIVE_REF_FRAME_W_PX = 1200;
5884
+ const RESPONSIVE_REF_FRAME_BORDER_PX = 1;
5885
+ const RESPONSIVE_REF_FRAME_PAD_PX = 24;
5886
+ const RESPONSIVE_REF_CONTAINER_W_PX = RESPONSIVE_REF_FRAME_W_PX - RESPONSIVE_REF_FRAME_BORDER_PX * 2 - RESPONSIVE_REF_FRAME_PAD_PX * 2;
5887
+ const RESPONSIVE_REF_VIEWPORT_H_PX = 900;
5888
+ const RESPONSIVE_REF_FRAME_H_RATIO = 0.9;
5889
+ const RESPONSIVE_REF_CHROME_H_PX = 180;
5890
+ const RESPONSIVE_REF_CONTAINER_H_PX = RESPONSIVE_REF_VIEWPORT_H_PX * RESPONSIVE_REF_FRAME_H_RATIO - RESPONSIVE_REF_CHROME_H_PX;
5884
5891
  const RESPONSIVE_MIN_ON_SCREEN_FONT_PX = 12;
5885
5892
  const RESPONSIVE_BASE_FONT_WORLD = 22;
5886
- const RESPONSIVE_MAX_VIEWBOX_W = RESPONSIVE_BASE_FONT_WORLD * RESPONSIVE_REF_CONTAINER_PX / RESPONSIVE_MIN_ON_SCREEN_FONT_PX;
5887
5893
  const vbResp = laid.viewBox;
5888
5894
  if (!(vbResp.w > 0) || !(vbResp.h > 0) || !Number.isFinite(vbResp.w) || !Number.isFinite(vbResp.h)) {
5889
5895
  push(
@@ -5891,13 +5897,20 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
5891
5897
  `viewBox \u5BF8\u6CD5 ${vbResp.w}\xD7${vbResp.h} \u304C\u63CF\u753B\u4E0D\u80FD (\u6B63\u306E\u6709\u9650\u5024\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308B)`,
5892
5898
  "warn"
5893
5899
  );
5894
- } else if (vbResp.w > RESPONSIVE_MAX_VIEWBOX_W) {
5895
- const \u753B\u9762\u4E0A\u306E\u5B57 = RESPONSIVE_BASE_FONT_WORLD * RESPONSIVE_REF_CONTAINER_PX / vbResp.w;
5896
- push(
5897
- "responsive-viewport",
5898
- `viewBox width ${vbResp.w} \u304C\u4E0A\u9650 ${RESPONSIVE_MAX_VIEWBOX_W.toFixed(0)} \u8D85\u3048 (\u89AA\u5E45 ${RESPONSIVE_REF_CONTAINER_PX}px \u3067\u7BB1\u306E\u984C\u304C ${\u753B\u9762\u4E0A\u306E\u5B57.toFixed(1)}px\u3001 \u4E0B\u9650 ${RESPONSIVE_MIN_ON_SCREEN_FONT_PX}px)`,
5899
- "warn"
5900
- );
5900
+ } else {
5901
+ const \u6A2A\u306E\u500D\u7387 = RESPONSIVE_REF_CONTAINER_W_PX / vbResp.w;
5902
+ const \u7E26\u306E\u500D\u7387 = RESPONSIVE_REF_CONTAINER_H_PX / vbResp.h;
5903
+ const \u500D\u7387 = Math.min(\u6A2A\u306E\u500D\u7387, \u7E26\u306E\u500D\u7387);
5904
+ const \u753B\u9762\u4E0A\u306E\u5B57 = RESPONSIVE_BASE_FONT_WORLD * \u500D\u7387;
5905
+ if (\u753B\u9762\u4E0A\u306E\u5B57 < RESPONSIVE_MIN_ON_SCREEN_FONT_PX) {
5906
+ const \u52B9\u304F\u8FBA = \u6A2A\u306E\u500D\u7387 <= \u7E26\u306E\u500D\u7387 ? "\u6A2A" : "\u7E26";
5907
+ const \u53CE\u307E\u308B\u5BF8\u6CD5 = \u52B9\u304F\u8FBA === "\u6A2A" ? `\u5E45 ${(RESPONSIVE_REF_CONTAINER_W_PX * RESPONSIVE_BASE_FONT_WORLD / RESPONSIVE_MIN_ON_SCREEN_FONT_PX).toFixed(0)} \u4EE5\u4E0B` : `\u9AD8\u3055 ${(RESPONSIVE_REF_CONTAINER_H_PX * RESPONSIVE_BASE_FONT_WORLD / RESPONSIVE_MIN_ON_SCREEN_FONT_PX).toFixed(0)} \u4EE5\u4E0B`;
5908
+ push(
5909
+ "responsive-viewport",
5910
+ `viewBox ${vbResp.w}\xD7${vbResp.h} \u306F\u5668 ${RESPONSIVE_REF_CONTAINER_W_PX}\xD7${RESPONSIVE_REF_CONTAINER_H_PX}px \u3067 ${\u500D\u7387.toFixed(3)} \u500D\u306B\u7E2E\u307F\u3001 \u7BB1\u306E\u984C\u304C ${\u753B\u9762\u4E0A\u306E\u5B57.toFixed(1)}px \u306B\u306A\u308B (\u4E0B\u9650 ${RESPONSIVE_MIN_ON_SCREEN_FONT_PX}px\u3001 \u500D\u7387\u3092\u6C7A\u3081\u305F\u306E\u306F ${\u52B9\u304F\u8FBA}\u3001 ${\u53CE\u307E\u308B\u5BF8\u6CD5}\u306B\u3059\u308B\u3068\u5C4A\u304F)`,
5911
+ "warn"
5912
+ );
5913
+ }
5901
5914
  }
5902
5915
  if (!(diag.topic?.trim() ?? "")) {
5903
5916
  push(
@@ -8941,7 +8954,8 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
8941
8954
  const nodeById = new Map(nodes.map((n) => [n.id, n]));
8942
8955
  const sortedByX = [...layoutedLanes].sort((a, b) => a.x - b.x);
8943
8956
  const laneIndexById = new Map(sortedByX.map((lane, i) => [lane.id, i]));
8944
- const requiredBoxWByPair = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
8957
+ const requiredBoxWAdjacent = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
8958
+ const requiredBoxWSpanning = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
8945
8959
  for (const edge of edges) {
8946
8960
  const fromLane = nodeById.get(edge.from)?.lane;
8947
8961
  const toLane = nodeById.get(edge.to)?.lane;
@@ -8953,23 +8967,33 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
8953
8967
  if (labelBoxW === 0) continue;
8954
8968
  const lo = Math.min(fi, ti);
8955
8969
  const hi = Math.max(fi, ti);
8970
+ const \u8981\u6C42 = hi - lo === 1 ? requiredBoxWAdjacent : requiredBoxWSpanning;
8956
8971
  for (let pair = lo; pair < hi; pair++) {
8957
- if (labelBoxW > requiredBoxWByPair[pair]) requiredBoxWByPair[pair] = labelBoxW;
8972
+ if (labelBoxW > \u8981\u6C42[pair]) \u8981\u6C42[pair] = labelBoxW;
8958
8973
  }
8959
8974
  }
8975
+ const \u7BB1\u306E\u534A\u5E45 = /* @__PURE__ */ new Map();
8976
+ for (const n of nodes) {
8977
+ const \u4ECA = \u7BB1\u306E\u534A\u5E45.get(n.lane) ?? 0;
8978
+ if (n.w / 2 > \u4ECA) \u7BB1\u306E\u534A\u5E45.set(n.lane, n.w / 2);
8979
+ }
8960
8980
  const requiredPitchByPair = [];
8961
8981
  for (let i = 0; i < sortedByX.length - 1; i++) {
8962
8982
  const lane = sortedByX[i];
8963
8983
  const rightLane = sortedByX[i + 1];
8964
- const halfSum = lane.width / 2 + rightLane.width / 2;
8984
+ const laneHalfSum = lane.width / 2 + rightLane.width / 2;
8985
+ const nodeHalfSum = (\u7BB1\u306E\u534A\u5E45.get(lane.id) ?? 0) + (\u7BB1\u306E\u534A\u5E45.get(rightLane.id) ?? 0);
8965
8986
  const currentPitch = rightLane.x + rightLane.width / 2 - (lane.x + lane.width / 2);
8966
- const maxLabelBoxW = requiredBoxWByPair[i];
8967
- if (maxLabelBoxW === 0) {
8987
+ const \u96A3 = requiredBoxWAdjacent[i];
8988
+ const \u8DE8 = requiredBoxWSpanning[i];
8989
+ if (\u96A3 === 0 && \u8DE8 === 0) {
8968
8990
  requiredPitchByPair.push(currentPitch);
8969
8991
  continue;
8970
8992
  }
8971
- const requiredGap = maxLabelBoxW + CLEARANCE_NODE_LABEL * 2 + EDGE_STUB_OUT * 2;
8972
- requiredPitchByPair.push(Math.max(currentPitch, requiredGap + halfSum));
8993
+ const \u4E0A\u4E57\u305B = CLEARANCE_NODE_LABEL * 2 + EDGE_STUB_OUT * 2;
8994
+ const \u96A3\u306E\u8981\u6C42 = \u96A3 === 0 ? 0 : \u96A3 + \u4E0A\u4E57\u305B + nodeHalfSum;
8995
+ const \u8DE8\u306E\u8981\u6C42 = \u8DE8 === 0 ? 0 : \u8DE8 + \u4E0A\u4E57\u305B + laneHalfSum;
8996
+ requiredPitchByPair.push(Math.max(currentPitch, \u96A3\u306E\u8981\u6C42, \u8DE8\u306E\u8981\u6C42));
8973
8997
  }
8974
8998
  const targetPitch = Math.ceil(Math.max(...requiredPitchByPair));
8975
8999
  const shiftedXById = /* @__PURE__ */ new Map();