@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/index.js CHANGED
@@ -16927,10 +16927,16 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
16927
16927
  } catch {
16928
16928
  }
16929
16929
  }
16930
- const RESPONSIVE_REF_CONTAINER_PX = 1100;
16930
+ const RESPONSIVE_REF_FRAME_W_PX = 1200;
16931
+ const RESPONSIVE_REF_FRAME_BORDER_PX = 1;
16932
+ const RESPONSIVE_REF_FRAME_PAD_PX = 24;
16933
+ const RESPONSIVE_REF_CONTAINER_W_PX = RESPONSIVE_REF_FRAME_W_PX - RESPONSIVE_REF_FRAME_BORDER_PX * 2 - RESPONSIVE_REF_FRAME_PAD_PX * 2;
16934
+ const RESPONSIVE_REF_VIEWPORT_H_PX = 900;
16935
+ const RESPONSIVE_REF_FRAME_H_RATIO = 0.9;
16936
+ const RESPONSIVE_REF_CHROME_H_PX = 180;
16937
+ const RESPONSIVE_REF_CONTAINER_H_PX = RESPONSIVE_REF_VIEWPORT_H_PX * RESPONSIVE_REF_FRAME_H_RATIO - RESPONSIVE_REF_CHROME_H_PX;
16931
16938
  const RESPONSIVE_MIN_ON_SCREEN_FONT_PX = 12;
16932
16939
  const RESPONSIVE_BASE_FONT_WORLD = 22;
16933
- const RESPONSIVE_MAX_VIEWBOX_W = RESPONSIVE_BASE_FONT_WORLD * RESPONSIVE_REF_CONTAINER_PX / RESPONSIVE_MIN_ON_SCREEN_FONT_PX;
16934
16940
  const vbResp = laid.viewBox;
16935
16941
  if (!(vbResp.w > 0) || !(vbResp.h > 0) || !Number.isFinite(vbResp.w) || !Number.isFinite(vbResp.h)) {
16936
16942
  push(
@@ -16938,13 +16944,20 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
16938
16944
  `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)`,
16939
16945
  "warn"
16940
16946
  );
16941
- } else if (vbResp.w > RESPONSIVE_MAX_VIEWBOX_W) {
16942
- const \u753B\u9762\u4E0A\u306E\u5B57 = RESPONSIVE_BASE_FONT_WORLD * RESPONSIVE_REF_CONTAINER_PX / vbResp.w;
16943
- push(
16944
- "responsive-viewport",
16945
- `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)`,
16946
- "warn"
16947
- );
16947
+ } else {
16948
+ const \u6A2A\u306E\u500D\u7387 = RESPONSIVE_REF_CONTAINER_W_PX / vbResp.w;
16949
+ const \u7E26\u306E\u500D\u7387 = RESPONSIVE_REF_CONTAINER_H_PX / vbResp.h;
16950
+ const \u500D\u7387 = Math.min(\u6A2A\u306E\u500D\u7387, \u7E26\u306E\u500D\u7387);
16951
+ const \u753B\u9762\u4E0A\u306E\u5B57 = RESPONSIVE_BASE_FONT_WORLD * \u500D\u7387;
16952
+ if (\u753B\u9762\u4E0A\u306E\u5B57 < RESPONSIVE_MIN_ON_SCREEN_FONT_PX) {
16953
+ const \u52B9\u304F\u8FBA = \u6A2A\u306E\u500D\u7387 <= \u7E26\u306E\u500D\u7387 ? "\u6A2A" : "\u7E26";
16954
+ 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`;
16955
+ push(
16956
+ "responsive-viewport",
16957
+ `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)`,
16958
+ "warn"
16959
+ );
16960
+ }
16948
16961
  }
16949
16962
  if (!(diag.topic?.trim() ?? "")) {
16950
16963
  push(
@@ -20215,7 +20228,8 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
20215
20228
  const nodeById = new Map(nodes.map((n) => [n.id, n]));
20216
20229
  const sortedByX = [...layoutedLanes].sort((a, b) => a.x - b.x);
20217
20230
  const laneIndexById = new Map(sortedByX.map((lane, i) => [lane.id, i]));
20218
- const requiredBoxWByPair = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
20231
+ const requiredBoxWAdjacent = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
20232
+ const requiredBoxWSpanning = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
20219
20233
  for (const edge of edges) {
20220
20234
  const fromLane = nodeById.get(edge.from)?.lane;
20221
20235
  const toLane = nodeById.get(edge.to)?.lane;
@@ -20227,23 +20241,33 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
20227
20241
  if (labelBoxW === 0) continue;
20228
20242
  const lo = Math.min(fi, ti);
20229
20243
  const hi = Math.max(fi, ti);
20244
+ const \u8981\u6C42 = hi - lo === 1 ? requiredBoxWAdjacent : requiredBoxWSpanning;
20230
20245
  for (let pair = lo; pair < hi; pair++) {
20231
- if (labelBoxW > requiredBoxWByPair[pair]) requiredBoxWByPair[pair] = labelBoxW;
20246
+ if (labelBoxW > \u8981\u6C42[pair]) \u8981\u6C42[pair] = labelBoxW;
20232
20247
  }
20233
20248
  }
20249
+ const \u7BB1\u306E\u534A\u5E45 = /* @__PURE__ */ new Map();
20250
+ for (const n of nodes) {
20251
+ const \u4ECA = \u7BB1\u306E\u534A\u5E45.get(n.lane) ?? 0;
20252
+ if (n.w / 2 > \u4ECA) \u7BB1\u306E\u534A\u5E45.set(n.lane, n.w / 2);
20253
+ }
20234
20254
  const requiredPitchByPair = [];
20235
20255
  for (let i = 0; i < sortedByX.length - 1; i++) {
20236
20256
  const lane = sortedByX[i];
20237
20257
  const rightLane = sortedByX[i + 1];
20238
- const halfSum = lane.width / 2 + rightLane.width / 2;
20258
+ const laneHalfSum = lane.width / 2 + rightLane.width / 2;
20259
+ const nodeHalfSum = (\u7BB1\u306E\u534A\u5E45.get(lane.id) ?? 0) + (\u7BB1\u306E\u534A\u5E45.get(rightLane.id) ?? 0);
20239
20260
  const currentPitch = rightLane.x + rightLane.width / 2 - (lane.x + lane.width / 2);
20240
- const maxLabelBoxW = requiredBoxWByPair[i];
20241
- if (maxLabelBoxW === 0) {
20261
+ const \u96A3 = requiredBoxWAdjacent[i];
20262
+ const \u8DE8 = requiredBoxWSpanning[i];
20263
+ if (\u96A3 === 0 && \u8DE8 === 0) {
20242
20264
  requiredPitchByPair.push(currentPitch);
20243
20265
  continue;
20244
20266
  }
20245
- const requiredGap = maxLabelBoxW + CLEARANCE_NODE_LABEL * 2 + EDGE_STUB_OUT * 2;
20246
- requiredPitchByPair.push(Math.max(currentPitch, requiredGap + halfSum));
20267
+ const \u4E0A\u4E57\u305B = CLEARANCE_NODE_LABEL * 2 + EDGE_STUB_OUT * 2;
20268
+ const \u96A3\u306E\u8981\u6C42 = \u96A3 === 0 ? 0 : \u96A3 + \u4E0A\u4E57\u305B + nodeHalfSum;
20269
+ const \u8DE8\u306E\u8981\u6C42 = \u8DE8 === 0 ? 0 : \u8DE8 + \u4E0A\u4E57\u305B + laneHalfSum;
20270
+ requiredPitchByPair.push(Math.max(currentPitch, \u96A3\u306E\u8981\u6C42, \u8DE8\u306E\u8981\u6C42));
20247
20271
  }
20248
20272
  const targetPitch = Math.ceil(Math.max(...requiredPitchByPair));
20249
20273
  const shiftedXById = /* @__PURE__ */ new Map();