@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.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
|
|
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
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
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) {
|