@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/CHANGELOG.md +74 -1
- package/dist/index.cjs +40 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +40 -16
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +40 -16
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +40 -16
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/layout/lanes.ts +48 -11
- package/src/visual-validate.ts +54 -16
package/dist/react.js
CHANGED
|
@@ -5878,10 +5878,16 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
|
|
|
5878
5878
|
} catch {
|
|
5879
5879
|
}
|
|
5880
5880
|
}
|
|
5881
|
-
const
|
|
5881
|
+
const RESPONSIVE_REF_FRAME_W_PX = 1200;
|
|
5882
|
+
const RESPONSIVE_REF_FRAME_BORDER_PX = 1;
|
|
5883
|
+
const RESPONSIVE_REF_FRAME_PAD_PX = 24;
|
|
5884
|
+
const RESPONSIVE_REF_CONTAINER_W_PX = RESPONSIVE_REF_FRAME_W_PX - RESPONSIVE_REF_FRAME_BORDER_PX * 2 - RESPONSIVE_REF_FRAME_PAD_PX * 2;
|
|
5885
|
+
const RESPONSIVE_REF_VIEWPORT_H_PX = 900;
|
|
5886
|
+
const RESPONSIVE_REF_FRAME_H_RATIO = 0.9;
|
|
5887
|
+
const RESPONSIVE_REF_CHROME_H_PX = 180;
|
|
5888
|
+
const RESPONSIVE_REF_CONTAINER_H_PX = RESPONSIVE_REF_VIEWPORT_H_PX * RESPONSIVE_REF_FRAME_H_RATIO - RESPONSIVE_REF_CHROME_H_PX;
|
|
5882
5889
|
const RESPONSIVE_MIN_ON_SCREEN_FONT_PX = 12;
|
|
5883
5890
|
const RESPONSIVE_BASE_FONT_WORLD = 22;
|
|
5884
|
-
const RESPONSIVE_MAX_VIEWBOX_W = RESPONSIVE_BASE_FONT_WORLD * RESPONSIVE_REF_CONTAINER_PX / RESPONSIVE_MIN_ON_SCREEN_FONT_PX;
|
|
5885
5891
|
const vbResp = laid.viewBox;
|
|
5886
5892
|
if (!(vbResp.w > 0) || !(vbResp.h > 0) || !Number.isFinite(vbResp.w) || !Number.isFinite(vbResp.h)) {
|
|
5887
5893
|
push(
|
|
@@ -5889,13 +5895,20 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
|
|
|
5889
5895
|
`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
5896
|
"warn"
|
|
5891
5897
|
);
|
|
5892
|
-
} else
|
|
5893
|
-
const \
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5898
|
+
} else {
|
|
5899
|
+
const \u6A2A\u306E\u500D\u7387 = RESPONSIVE_REF_CONTAINER_W_PX / vbResp.w;
|
|
5900
|
+
const \u7E26\u306E\u500D\u7387 = RESPONSIVE_REF_CONTAINER_H_PX / vbResp.h;
|
|
5901
|
+
const \u500D\u7387 = Math.min(\u6A2A\u306E\u500D\u7387, \u7E26\u306E\u500D\u7387);
|
|
5902
|
+
const \u753B\u9762\u4E0A\u306E\u5B57 = RESPONSIVE_BASE_FONT_WORLD * \u500D\u7387;
|
|
5903
|
+
if (\u753B\u9762\u4E0A\u306E\u5B57 < RESPONSIVE_MIN_ON_SCREEN_FONT_PX) {
|
|
5904
|
+
const \u52B9\u304F\u8FBA = \u6A2A\u306E\u500D\u7387 <= \u7E26\u306E\u500D\u7387 ? "\u6A2A" : "\u7E26";
|
|
5905
|
+
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`;
|
|
5906
|
+
push(
|
|
5907
|
+
"responsive-viewport",
|
|
5908
|
+
`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)`,
|
|
5909
|
+
"warn"
|
|
5910
|
+
);
|
|
5911
|
+
}
|
|
5899
5912
|
}
|
|
5900
5913
|
if (!(diag.topic?.trim() ?? "")) {
|
|
5901
5914
|
push(
|
|
@@ -8939,7 +8952,8 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
|
|
|
8939
8952
|
const nodeById = new Map(nodes.map((n) => [n.id, n]));
|
|
8940
8953
|
const sortedByX = [...layoutedLanes].sort((a, b) => a.x - b.x);
|
|
8941
8954
|
const laneIndexById = new Map(sortedByX.map((lane, i) => [lane.id, i]));
|
|
8942
|
-
const
|
|
8955
|
+
const requiredBoxWAdjacent = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
|
|
8956
|
+
const requiredBoxWSpanning = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
|
|
8943
8957
|
for (const edge of edges) {
|
|
8944
8958
|
const fromLane = nodeById.get(edge.from)?.lane;
|
|
8945
8959
|
const toLane = nodeById.get(edge.to)?.lane;
|
|
@@ -8951,23 +8965,33 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
|
|
|
8951
8965
|
if (labelBoxW === 0) continue;
|
|
8952
8966
|
const lo = Math.min(fi, ti);
|
|
8953
8967
|
const hi = Math.max(fi, ti);
|
|
8968
|
+
const \u8981\u6C42 = hi - lo === 1 ? requiredBoxWAdjacent : requiredBoxWSpanning;
|
|
8954
8969
|
for (let pair = lo; pair < hi; pair++) {
|
|
8955
|
-
if (labelBoxW >
|
|
8970
|
+
if (labelBoxW > \u8981\u6C42[pair]) \u8981\u6C42[pair] = labelBoxW;
|
|
8956
8971
|
}
|
|
8957
8972
|
}
|
|
8973
|
+
const \u7BB1\u306E\u534A\u5E45 = /* @__PURE__ */ new Map();
|
|
8974
|
+
for (const n of nodes) {
|
|
8975
|
+
const \u4ECA = \u7BB1\u306E\u534A\u5E45.get(n.lane) ?? 0;
|
|
8976
|
+
if (n.w / 2 > \u4ECA) \u7BB1\u306E\u534A\u5E45.set(n.lane, n.w / 2);
|
|
8977
|
+
}
|
|
8958
8978
|
const requiredPitchByPair = [];
|
|
8959
8979
|
for (let i = 0; i < sortedByX.length - 1; i++) {
|
|
8960
8980
|
const lane = sortedByX[i];
|
|
8961
8981
|
const rightLane = sortedByX[i + 1];
|
|
8962
|
-
const
|
|
8982
|
+
const laneHalfSum = lane.width / 2 + rightLane.width / 2;
|
|
8983
|
+
const nodeHalfSum = (\u7BB1\u306E\u534A\u5E45.get(lane.id) ?? 0) + (\u7BB1\u306E\u534A\u5E45.get(rightLane.id) ?? 0);
|
|
8963
8984
|
const currentPitch = rightLane.x + rightLane.width / 2 - (lane.x + lane.width / 2);
|
|
8964
|
-
const
|
|
8965
|
-
|
|
8985
|
+
const \u96A3 = requiredBoxWAdjacent[i];
|
|
8986
|
+
const \u8DE8 = requiredBoxWSpanning[i];
|
|
8987
|
+
if (\u96A3 === 0 && \u8DE8 === 0) {
|
|
8966
8988
|
requiredPitchByPair.push(currentPitch);
|
|
8967
8989
|
continue;
|
|
8968
8990
|
}
|
|
8969
|
-
const
|
|
8970
|
-
|
|
8991
|
+
const \u4E0A\u4E57\u305B = CLEARANCE_NODE_LABEL * 2 + EDGE_STUB_OUT * 2;
|
|
8992
|
+
const \u96A3\u306E\u8981\u6C42 = \u96A3 === 0 ? 0 : \u96A3 + \u4E0A\u4E57\u305B + nodeHalfSum;
|
|
8993
|
+
const \u8DE8\u306E\u8981\u6C42 = \u8DE8 === 0 ? 0 : \u8DE8 + \u4E0A\u4E57\u305B + laneHalfSum;
|
|
8994
|
+
requiredPitchByPair.push(Math.max(currentPitch, \u96A3\u306E\u8981\u6C42, \u8DE8\u306E\u8981\u6C42));
|
|
8971
8995
|
}
|
|
8972
8996
|
const targetPitch = Math.ceil(Math.max(...requiredPitchByPair));
|
|
8973
8997
|
const shiftedXById = /* @__PURE__ */ new Map();
|