@cardenelabs/cdl 0.41.1 → 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
@@ -4523,7 +4523,6 @@ function emptyCounts() {
4523
4523
  "print-media-compat": 0,
4524
4524
  "color-blind-safety": 0,
4525
4525
  "marker-gradient-def-integrity": 0,
4526
- "subpixel-precision": 0,
4527
4526
  "dom-complexity-budget": 0,
4528
4527
  "reduced-motion-compat": 0,
4529
4528
  "touch-target-size": 0,
@@ -5881,7 +5880,10 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
5881
5880
  } catch {
5882
5881
  }
5883
5882
  }
5884
- const RESPONSIVE_MAX_ASPECT = 6;
5883
+ const RESPONSIVE_REF_CONTAINER_PX = 1100;
5884
+ const RESPONSIVE_MIN_ON_SCREEN_FONT_PX = 12;
5885
+ 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;
5885
5887
  const vbResp = laid.viewBox;
5886
5888
  if (!(vbResp.w > 0) || !(vbResp.h > 0) || !Number.isFinite(vbResp.w) || !Number.isFinite(vbResp.h)) {
5887
5889
  push(
@@ -5889,15 +5891,13 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
5889
5891
  `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)`,
5890
5892
  "warn"
5891
5893
  );
5892
- } else {
5893
- const worstAspect = Math.max(vbResp.w / vbResp.h, vbResp.h / vbResp.w);
5894
- if (worstAspect > RESPONSIVE_MAX_ASPECT) {
5895
- push(
5896
- "responsive-viewport",
5897
- `viewBox aspect ${worstAspect.toFixed(1)}:1 \u304C RESPONSIVE_MAX_ASPECT ${RESPONSIVE_MAX_ASPECT}:1 \u8D85\u3048`,
5898
- "warn"
5899
- );
5900
- }
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
+ );
5901
5901
  }
5902
5902
  if (!(diag.topic?.trim() ?? "")) {
5903
5903
  push(
@@ -6069,39 +6069,6 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
6069
6069
  );
6070
6070
  }
6071
6071
  }
6072
- const SUBPIXEL_TOL = 0.5;
6073
- function isSubpixel(v) {
6074
- const nearestHalf = Math.round(v * 2) / 2;
6075
- return Math.abs(v - nearestHalf) > SUBPIXEL_TOL / 10;
6076
- }
6077
- for (const n of laid.nodes) {
6078
- if (n.id.endsWith("-spacer") || /^s\d+-/.test(n.id)) continue;
6079
- if (isSubpixel(n.cx) || isSubpixel(n.cy)) {
6080
- push(
6081
- "subpixel-precision",
6082
- `node "${n.id}" \u5EA7\u6A19 (${n.cx.toFixed(2)}, ${n.cy.toFixed(2)}) \u304C\u975E\u6574\u6570\u3001 subpixel blur \u30EA\u30B9\u30AF`,
6083
- "warn"
6084
- );
6085
- }
6086
- }
6087
- for (const e of laid.edges) {
6088
- if (isSubpixel(e.labelX) || isSubpixel(e.labelY)) {
6089
- push(
6090
- "subpixel-precision",
6091
- `edge "${e.id}" label \u5EA7\u6A19 (${e.labelX.toFixed(2)}, ${e.labelY.toFixed(2)}) \u304C\u975E\u6574\u6570\u3001 subpixel blur \u30EA\u30B9\u30AF`,
6092
- "warn"
6093
- );
6094
- }
6095
- }
6096
- for (const l of laid.lanes) {
6097
- if (isSubpixel(l.x) || isSubpixel(l.y)) {
6098
- push(
6099
- "subpixel-precision",
6100
- `lane "${l.id}" \u5EA7\u6A19 (${l.x.toFixed(2)}, ${l.y.toFixed(2)}) \u304C\u975E\u6574\u6570\u3001 subpixel blur \u30EA\u30B9\u30AF`,
6101
- "warn"
6102
- );
6103
- }
6104
- }
6105
6072
  const DOM_COMPLEXITY_BUDGET = 400;
6106
6073
  const totalElements = laid.nodes.length + laid.edges.length + laid.lanes.length + diag.phases.length;
6107
6074
  if (totalElements > DOM_COMPLEXITY_BUDGET) {
@@ -8974,7 +8941,8 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
8974
8941
  const nodeById = new Map(nodes.map((n) => [n.id, n]));
8975
8942
  const sortedByX = [...layoutedLanes].sort((a, b) => a.x - b.x);
8976
8943
  const laneIndexById = new Map(sortedByX.map((lane, i) => [lane.id, i]));
8977
- 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);
8978
8946
  for (const edge of edges) {
8979
8947
  const fromLane = nodeById.get(edge.from)?.lane;
8980
8948
  const toLane = nodeById.get(edge.to)?.lane;
@@ -8986,23 +8954,33 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
8986
8954
  if (labelBoxW === 0) continue;
8987
8955
  const lo = Math.min(fi, ti);
8988
8956
  const hi = Math.max(fi, ti);
8957
+ const \u8981\u6C42 = hi - lo === 1 ? requiredBoxWAdjacent : requiredBoxWSpanning;
8989
8958
  for (let pair = lo; pair < hi; pair++) {
8990
- if (labelBoxW > requiredBoxWByPair[pair]) requiredBoxWByPair[pair] = labelBoxW;
8959
+ if (labelBoxW > \u8981\u6C42[pair]) \u8981\u6C42[pair] = labelBoxW;
8991
8960
  }
8992
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
+ }
8993
8967
  const requiredPitchByPair = [];
8994
8968
  for (let i = 0; i < sortedByX.length - 1; i++) {
8995
8969
  const lane = sortedByX[i];
8996
8970
  const rightLane = sortedByX[i + 1];
8997
- 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);
8998
8973
  const currentPitch = rightLane.x + rightLane.width / 2 - (lane.x + lane.width / 2);
8999
- const maxLabelBoxW = requiredBoxWByPair[i];
9000
- if (maxLabelBoxW === 0) {
8974
+ const \u96A3 = requiredBoxWAdjacent[i];
8975
+ const \u8DE8 = requiredBoxWSpanning[i];
8976
+ if (\u96A3 === 0 && \u8DE8 === 0) {
9001
8977
  requiredPitchByPair.push(currentPitch);
9002
8978
  continue;
9003
8979
  }
9004
- const requiredGap = maxLabelBoxW + CLEARANCE_NODE_LABEL * 2 + EDGE_STUB_OUT * 2;
9005
- 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));
9006
8984
  }
9007
8985
  const targetPitch = Math.ceil(Math.max(...requiredPitchByPair));
9008
8986
  const shiftedXById = /* @__PURE__ */ new Map();