@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/CHANGELOG.md +93 -1
- package/dist/index.cjs +30 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +30 -54
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +29 -51
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +29 -51
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/layout/lanes.ts +48 -11
- package/src/layout/spec.ts +8 -3
- package/src/visual-validate.ts +55 -81
package/dist/react.js
CHANGED
|
@@ -4521,7 +4521,6 @@ function emptyCounts() {
|
|
|
4521
4521
|
"print-media-compat": 0,
|
|
4522
4522
|
"color-blind-safety": 0,
|
|
4523
4523
|
"marker-gradient-def-integrity": 0,
|
|
4524
|
-
"subpixel-precision": 0,
|
|
4525
4524
|
"dom-complexity-budget": 0,
|
|
4526
4525
|
"reduced-motion-compat": 0,
|
|
4527
4526
|
"touch-target-size": 0,
|
|
@@ -5879,7 +5878,10 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
|
|
|
5879
5878
|
} catch {
|
|
5880
5879
|
}
|
|
5881
5880
|
}
|
|
5882
|
-
const
|
|
5881
|
+
const RESPONSIVE_REF_CONTAINER_PX = 1100;
|
|
5882
|
+
const RESPONSIVE_MIN_ON_SCREEN_FONT_PX = 12;
|
|
5883
|
+
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;
|
|
5883
5885
|
const vbResp = laid.viewBox;
|
|
5884
5886
|
if (!(vbResp.w > 0) || !(vbResp.h > 0) || !Number.isFinite(vbResp.w) || !Number.isFinite(vbResp.h)) {
|
|
5885
5887
|
push(
|
|
@@ -5887,15 +5889,13 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
|
|
|
5887
5889
|
`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)`,
|
|
5888
5890
|
"warn"
|
|
5889
5891
|
);
|
|
5890
|
-
} else {
|
|
5891
|
-
const
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
);
|
|
5898
|
-
}
|
|
5892
|
+
} else if (vbResp.w > RESPONSIVE_MAX_VIEWBOX_W) {
|
|
5893
|
+
const \u753B\u9762\u4E0A\u306E\u5B57 = RESPONSIVE_BASE_FONT_WORLD * RESPONSIVE_REF_CONTAINER_PX / vbResp.w;
|
|
5894
|
+
push(
|
|
5895
|
+
"responsive-viewport",
|
|
5896
|
+
`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)`,
|
|
5897
|
+
"warn"
|
|
5898
|
+
);
|
|
5899
5899
|
}
|
|
5900
5900
|
if (!(diag.topic?.trim() ?? "")) {
|
|
5901
5901
|
push(
|
|
@@ -6067,39 +6067,6 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
|
|
|
6067
6067
|
);
|
|
6068
6068
|
}
|
|
6069
6069
|
}
|
|
6070
|
-
const SUBPIXEL_TOL = 0.5;
|
|
6071
|
-
function isSubpixel(v) {
|
|
6072
|
-
const nearestHalf = Math.round(v * 2) / 2;
|
|
6073
|
-
return Math.abs(v - nearestHalf) > SUBPIXEL_TOL / 10;
|
|
6074
|
-
}
|
|
6075
|
-
for (const n of laid.nodes) {
|
|
6076
|
-
if (n.id.endsWith("-spacer") || /^s\d+-/.test(n.id)) continue;
|
|
6077
|
-
if (isSubpixel(n.cx) || isSubpixel(n.cy)) {
|
|
6078
|
-
push(
|
|
6079
|
-
"subpixel-precision",
|
|
6080
|
-
`node "${n.id}" \u5EA7\u6A19 (${n.cx.toFixed(2)}, ${n.cy.toFixed(2)}) \u304C\u975E\u6574\u6570\u3001 subpixel blur \u30EA\u30B9\u30AF`,
|
|
6081
|
-
"warn"
|
|
6082
|
-
);
|
|
6083
|
-
}
|
|
6084
|
-
}
|
|
6085
|
-
for (const e of laid.edges) {
|
|
6086
|
-
if (isSubpixel(e.labelX) || isSubpixel(e.labelY)) {
|
|
6087
|
-
push(
|
|
6088
|
-
"subpixel-precision",
|
|
6089
|
-
`edge "${e.id}" label \u5EA7\u6A19 (${e.labelX.toFixed(2)}, ${e.labelY.toFixed(2)}) \u304C\u975E\u6574\u6570\u3001 subpixel blur \u30EA\u30B9\u30AF`,
|
|
6090
|
-
"warn"
|
|
6091
|
-
);
|
|
6092
|
-
}
|
|
6093
|
-
}
|
|
6094
|
-
for (const l of laid.lanes) {
|
|
6095
|
-
if (isSubpixel(l.x) || isSubpixel(l.y)) {
|
|
6096
|
-
push(
|
|
6097
|
-
"subpixel-precision",
|
|
6098
|
-
`lane "${l.id}" \u5EA7\u6A19 (${l.x.toFixed(2)}, ${l.y.toFixed(2)}) \u304C\u975E\u6574\u6570\u3001 subpixel blur \u30EA\u30B9\u30AF`,
|
|
6099
|
-
"warn"
|
|
6100
|
-
);
|
|
6101
|
-
}
|
|
6102
|
-
}
|
|
6103
6070
|
const DOM_COMPLEXITY_BUDGET = 400;
|
|
6104
6071
|
const totalElements = laid.nodes.length + laid.edges.length + laid.lanes.length + diag.phases.length;
|
|
6105
6072
|
if (totalElements > DOM_COMPLEXITY_BUDGET) {
|
|
@@ -8972,7 +8939,8 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
|
|
|
8972
8939
|
const nodeById = new Map(nodes.map((n) => [n.id, n]));
|
|
8973
8940
|
const sortedByX = [...layoutedLanes].sort((a, b) => a.x - b.x);
|
|
8974
8941
|
const laneIndexById = new Map(sortedByX.map((lane, i) => [lane.id, i]));
|
|
8975
|
-
const
|
|
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);
|
|
8976
8944
|
for (const edge of edges) {
|
|
8977
8945
|
const fromLane = nodeById.get(edge.from)?.lane;
|
|
8978
8946
|
const toLane = nodeById.get(edge.to)?.lane;
|
|
@@ -8984,23 +8952,33 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
|
|
|
8984
8952
|
if (labelBoxW === 0) continue;
|
|
8985
8953
|
const lo = Math.min(fi, ti);
|
|
8986
8954
|
const hi = Math.max(fi, ti);
|
|
8955
|
+
const \u8981\u6C42 = hi - lo === 1 ? requiredBoxWAdjacent : requiredBoxWSpanning;
|
|
8987
8956
|
for (let pair = lo; pair < hi; pair++) {
|
|
8988
|
-
if (labelBoxW >
|
|
8957
|
+
if (labelBoxW > \u8981\u6C42[pair]) \u8981\u6C42[pair] = labelBoxW;
|
|
8989
8958
|
}
|
|
8990
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
|
+
}
|
|
8991
8965
|
const requiredPitchByPair = [];
|
|
8992
8966
|
for (let i = 0; i < sortedByX.length - 1; i++) {
|
|
8993
8967
|
const lane = sortedByX[i];
|
|
8994
8968
|
const rightLane = sortedByX[i + 1];
|
|
8995
|
-
const
|
|
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);
|
|
8996
8971
|
const currentPitch = rightLane.x + rightLane.width / 2 - (lane.x + lane.width / 2);
|
|
8997
|
-
const
|
|
8998
|
-
|
|
8972
|
+
const \u96A3 = requiredBoxWAdjacent[i];
|
|
8973
|
+
const \u8DE8 = requiredBoxWSpanning[i];
|
|
8974
|
+
if (\u96A3 === 0 && \u8DE8 === 0) {
|
|
8999
8975
|
requiredPitchByPair.push(currentPitch);
|
|
9000
8976
|
continue;
|
|
9001
8977
|
}
|
|
9002
|
-
const
|
|
9003
|
-
|
|
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));
|
|
9004
8982
|
}
|
|
9005
8983
|
const targetPitch = Math.ceil(Math.max(...requiredPitchByPair));
|
|
9006
8984
|
const shiftedXById = /* @__PURE__ */ new Map();
|