@cardenelabs/cdl 0.41.0 → 0.42.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 +88 -1
- package/dist/index.cjs +31 -68
- 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 +31 -68
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +11 -44
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +11 -44
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/layout/spec.ts +8 -3
- package/src/visual-validate.ts +131 -104
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) {
|