@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/index.d.cts
CHANGED
|
@@ -1581,7 +1581,7 @@ interface Violation {
|
|
|
1581
1581
|
detail: string;
|
|
1582
1582
|
severity: "error" | "warn";
|
|
1583
1583
|
}
|
|
1584
|
-
type VisualAxis = "node-visibility" | "edge-label-overlap" | "edge-label-proximity" | "text-readability" | "row-format" | "alignment" | "clearance" | "arrow-endpoint-anchoring" | "label-char-range" | "node-overlap" | "edge-crossing" | "edge-node-cross" | "edge-segment-orthogonality" | "label-inside-viewbox" | "lane-cx-consistency" | "row-vertical-spacing" | "group-boundary-clearance" | "node-vertical-clearance" | "lane-lane-gap" | "arrow-marker-clearance" | "grid-alignment" | "phase-layout-stability" | "responsive-viewport" | "accessibility-basics" | "animation-frame-integrity" | "i18n-cjk-detection" | "contrast-basics" | "print-media-compat" | "color-blind-safety" | "marker-gradient-def-integrity" | "
|
|
1584
|
+
type VisualAxis = "node-visibility" | "edge-label-overlap" | "edge-label-proximity" | "text-readability" | "row-format" | "alignment" | "clearance" | "arrow-endpoint-anchoring" | "label-char-range" | "node-overlap" | "edge-crossing" | "edge-node-cross" | "edge-segment-orthogonality" | "label-inside-viewbox" | "lane-cx-consistency" | "row-vertical-spacing" | "group-boundary-clearance" | "node-vertical-clearance" | "lane-lane-gap" | "arrow-marker-clearance" | "grid-alignment" | "phase-layout-stability" | "responsive-viewport" | "accessibility-basics" | "animation-frame-integrity" | "i18n-cjk-detection" | "contrast-basics" | "print-media-compat" | "color-blind-safety" | "marker-gradient-def-integrity" | "dom-complexity-budget" | "reduced-motion-compat" | "touch-target-size" | "row-content-typing" | "terminal-safe-text" | "gpu-layer-efficiency" | "svg-injection-safety" | "seo-metadata-quality" | "bidi-hyphenation" | "structured-data-extraction" | "diagram-version-semver" | "migration-path-consistency" | "axis-coverage-meta" | "axis-documentation-completeness" | "fixture-drift-detection" | "locale-parity" | "validate-performance-budget" | "node-inside-viewbox" | "shape-label-dropped" | "box-line-dropped" | "node-inside-lane" | "edge-inside-viewbox" | "lane-label-inside-viewbox" | "lane-label-overlap" | "row-alignment" | "column-alignment" | "edge-stubout-min" | "fan-origin-single-point" | "detour-slot-distinct" | "arrow-endpoint-center" | "lane-border-clearance" | "row-gap-uniform" | "column-gap-uniform" | "rows-not-rendered" | "title-row-overlap" | "malformed-input" | "validation-interrupted";
|
|
1585
1585
|
/**
|
|
1586
1586
|
* 検査の用途。 用途によって見るべき軸が違う。
|
|
1587
1587
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1581,7 +1581,7 @@ interface Violation {
|
|
|
1581
1581
|
detail: string;
|
|
1582
1582
|
severity: "error" | "warn";
|
|
1583
1583
|
}
|
|
1584
|
-
type VisualAxis = "node-visibility" | "edge-label-overlap" | "edge-label-proximity" | "text-readability" | "row-format" | "alignment" | "clearance" | "arrow-endpoint-anchoring" | "label-char-range" | "node-overlap" | "edge-crossing" | "edge-node-cross" | "edge-segment-orthogonality" | "label-inside-viewbox" | "lane-cx-consistency" | "row-vertical-spacing" | "group-boundary-clearance" | "node-vertical-clearance" | "lane-lane-gap" | "arrow-marker-clearance" | "grid-alignment" | "phase-layout-stability" | "responsive-viewport" | "accessibility-basics" | "animation-frame-integrity" | "i18n-cjk-detection" | "contrast-basics" | "print-media-compat" | "color-blind-safety" | "marker-gradient-def-integrity" | "
|
|
1584
|
+
type VisualAxis = "node-visibility" | "edge-label-overlap" | "edge-label-proximity" | "text-readability" | "row-format" | "alignment" | "clearance" | "arrow-endpoint-anchoring" | "label-char-range" | "node-overlap" | "edge-crossing" | "edge-node-cross" | "edge-segment-orthogonality" | "label-inside-viewbox" | "lane-cx-consistency" | "row-vertical-spacing" | "group-boundary-clearance" | "node-vertical-clearance" | "lane-lane-gap" | "arrow-marker-clearance" | "grid-alignment" | "phase-layout-stability" | "responsive-viewport" | "accessibility-basics" | "animation-frame-integrity" | "i18n-cjk-detection" | "contrast-basics" | "print-media-compat" | "color-blind-safety" | "marker-gradient-def-integrity" | "dom-complexity-budget" | "reduced-motion-compat" | "touch-target-size" | "row-content-typing" | "terminal-safe-text" | "gpu-layer-efficiency" | "svg-injection-safety" | "seo-metadata-quality" | "bidi-hyphenation" | "structured-data-extraction" | "diagram-version-semver" | "migration-path-consistency" | "axis-coverage-meta" | "axis-documentation-completeness" | "fixture-drift-detection" | "locale-parity" | "validate-performance-budget" | "node-inside-viewbox" | "shape-label-dropped" | "box-line-dropped" | "node-inside-lane" | "edge-inside-viewbox" | "lane-label-inside-viewbox" | "lane-label-overlap" | "row-alignment" | "column-alignment" | "edge-stubout-min" | "fan-origin-single-point" | "detour-slot-distinct" | "arrow-endpoint-center" | "lane-border-clearance" | "row-gap-uniform" | "column-gap-uniform" | "rows-not-rendered" | "title-row-overlap" | "malformed-input" | "validation-interrupted";
|
|
1585
1585
|
/**
|
|
1586
1586
|
* 検査の用途。 用途によって見るべき軸が違う。
|
|
1587
1587
|
*
|
package/dist/index.js
CHANGED
|
@@ -15533,7 +15533,6 @@ function emptyCounts() {
|
|
|
15533
15533
|
"print-media-compat": 0,
|
|
15534
15534
|
"color-blind-safety": 0,
|
|
15535
15535
|
"marker-gradient-def-integrity": 0,
|
|
15536
|
-
"subpixel-precision": 0,
|
|
15537
15536
|
"dom-complexity-budget": 0,
|
|
15538
15537
|
"reduced-motion-compat": 0,
|
|
15539
15538
|
"touch-target-size": 0,
|
|
@@ -16928,7 +16927,10 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
|
|
|
16928
16927
|
} catch {
|
|
16929
16928
|
}
|
|
16930
16929
|
}
|
|
16931
|
-
const
|
|
16930
|
+
const RESPONSIVE_REF_CONTAINER_PX = 1100;
|
|
16931
|
+
const RESPONSIVE_MIN_ON_SCREEN_FONT_PX = 12;
|
|
16932
|
+
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;
|
|
16932
16934
|
const vbResp = laid.viewBox;
|
|
16933
16935
|
if (!(vbResp.w > 0) || !(vbResp.h > 0) || !Number.isFinite(vbResp.w) || !Number.isFinite(vbResp.h)) {
|
|
16934
16936
|
push(
|
|
@@ -16936,15 +16938,13 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
|
|
|
16936
16938
|
`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)`,
|
|
16937
16939
|
"warn"
|
|
16938
16940
|
);
|
|
16939
|
-
} else {
|
|
16940
|
-
const
|
|
16941
|
-
|
|
16942
|
-
|
|
16943
|
-
|
|
16944
|
-
|
|
16945
|
-
|
|
16946
|
-
);
|
|
16947
|
-
}
|
|
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
|
+
);
|
|
16948
16948
|
}
|
|
16949
16949
|
if (!(diag.topic?.trim() ?? "")) {
|
|
16950
16950
|
push(
|
|
@@ -17116,39 +17116,6 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
|
|
|
17116
17116
|
);
|
|
17117
17117
|
}
|
|
17118
17118
|
}
|
|
17119
|
-
const SUBPIXEL_TOL = 0.5;
|
|
17120
|
-
function isSubpixel(v) {
|
|
17121
|
-
const nearestHalf = Math.round(v * 2) / 2;
|
|
17122
|
-
return Math.abs(v - nearestHalf) > SUBPIXEL_TOL / 10;
|
|
17123
|
-
}
|
|
17124
|
-
for (const n of laid.nodes) {
|
|
17125
|
-
if (n.id.endsWith("-spacer") || /^s\d+-/.test(n.id)) continue;
|
|
17126
|
-
if (isSubpixel(n.cx) || isSubpixel(n.cy)) {
|
|
17127
|
-
push(
|
|
17128
|
-
"subpixel-precision",
|
|
17129
|
-
`node "${n.id}" \u5EA7\u6A19 (${n.cx.toFixed(2)}, ${n.cy.toFixed(2)}) \u304C\u975E\u6574\u6570\u3001 subpixel blur \u30EA\u30B9\u30AF`,
|
|
17130
|
-
"warn"
|
|
17131
|
-
);
|
|
17132
|
-
}
|
|
17133
|
-
}
|
|
17134
|
-
for (const e of laid.edges) {
|
|
17135
|
-
if (isSubpixel(e.labelX) || isSubpixel(e.labelY)) {
|
|
17136
|
-
push(
|
|
17137
|
-
"subpixel-precision",
|
|
17138
|
-
`edge "${e.id}" label \u5EA7\u6A19 (${e.labelX.toFixed(2)}, ${e.labelY.toFixed(2)}) \u304C\u975E\u6574\u6570\u3001 subpixel blur \u30EA\u30B9\u30AF`,
|
|
17139
|
-
"warn"
|
|
17140
|
-
);
|
|
17141
|
-
}
|
|
17142
|
-
}
|
|
17143
|
-
for (const l of laid.lanes) {
|
|
17144
|
-
if (isSubpixel(l.x) || isSubpixel(l.y)) {
|
|
17145
|
-
push(
|
|
17146
|
-
"subpixel-precision",
|
|
17147
|
-
`lane "${l.id}" \u5EA7\u6A19 (${l.x.toFixed(2)}, ${l.y.toFixed(2)}) \u304C\u975E\u6574\u6570\u3001 subpixel blur \u30EA\u30B9\u30AF`,
|
|
17148
|
-
"warn"
|
|
17149
|
-
);
|
|
17150
|
-
}
|
|
17151
|
-
}
|
|
17152
17119
|
const DOM_COMPLEXITY_BUDGET = 400;
|
|
17153
17120
|
const totalElements = laid.nodes.length + laid.edges.length + laid.lanes.length + diag.phases.length;
|
|
17154
17121
|
if (totalElements > DOM_COMPLEXITY_BUDGET) {
|
|
@@ -17779,7 +17746,6 @@ function validateMetaAxes(totalCounts, diagrams = [], durations = [], reports =
|
|
|
17779
17746
|
"print-media-compat",
|
|
17780
17747
|
"color-blind-safety",
|
|
17781
17748
|
"marker-gradient-def-integrity",
|
|
17782
|
-
"subpixel-precision",
|
|
17783
17749
|
"dom-complexity-budget",
|
|
17784
17750
|
"reduced-motion-compat",
|
|
17785
17751
|
"touch-target-size",
|
|
@@ -17848,7 +17814,6 @@ function validateMetaAxes(totalCounts, diagrams = [], durations = [], reports =
|
|
|
17848
17814
|
"print-media-compat",
|
|
17849
17815
|
"color-blind-safety",
|
|
17850
17816
|
"marker-gradient-def-integrity",
|
|
17851
|
-
"subpixel-precision",
|
|
17852
17817
|
"dom-complexity-budget",
|
|
17853
17818
|
"reduced-motion-compat",
|
|
17854
17819
|
"touch-target-size",
|
|
@@ -17896,7 +17861,7 @@ function validateMetaAxes(totalCounts, diagrams = [], durations = [], reports =
|
|
|
17896
17861
|
});
|
|
17897
17862
|
}
|
|
17898
17863
|
}
|
|
17899
|
-
const EXPECTED_AXIS_COUNT =
|
|
17864
|
+
const EXPECTED_AXIS_COUNT = 66;
|
|
17900
17865
|
if (allAxes.length !== EXPECTED_AXIS_COUNT) {
|
|
17901
17866
|
out.push({
|
|
17902
17867
|
axis: "axis-documentation-completeness",
|
|
@@ -20250,7 +20215,8 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
|
|
|
20250
20215
|
const nodeById = new Map(nodes.map((n) => [n.id, n]));
|
|
20251
20216
|
const sortedByX = [...layoutedLanes].sort((a, b) => a.x - b.x);
|
|
20252
20217
|
const laneIndexById = new Map(sortedByX.map((lane, i) => [lane.id, i]));
|
|
20253
|
-
const
|
|
20218
|
+
const requiredBoxWAdjacent = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
|
|
20219
|
+
const requiredBoxWSpanning = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
|
|
20254
20220
|
for (const edge of edges) {
|
|
20255
20221
|
const fromLane = nodeById.get(edge.from)?.lane;
|
|
20256
20222
|
const toLane = nodeById.get(edge.to)?.lane;
|
|
@@ -20262,23 +20228,33 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
|
|
|
20262
20228
|
if (labelBoxW === 0) continue;
|
|
20263
20229
|
const lo = Math.min(fi, ti);
|
|
20264
20230
|
const hi = Math.max(fi, ti);
|
|
20231
|
+
const \u8981\u6C42 = hi - lo === 1 ? requiredBoxWAdjacent : requiredBoxWSpanning;
|
|
20265
20232
|
for (let pair = lo; pair < hi; pair++) {
|
|
20266
|
-
if (labelBoxW >
|
|
20233
|
+
if (labelBoxW > \u8981\u6C42[pair]) \u8981\u6C42[pair] = labelBoxW;
|
|
20267
20234
|
}
|
|
20268
20235
|
}
|
|
20236
|
+
const \u7BB1\u306E\u534A\u5E45 = /* @__PURE__ */ new Map();
|
|
20237
|
+
for (const n of nodes) {
|
|
20238
|
+
const \u4ECA = \u7BB1\u306E\u534A\u5E45.get(n.lane) ?? 0;
|
|
20239
|
+
if (n.w / 2 > \u4ECA) \u7BB1\u306E\u534A\u5E45.set(n.lane, n.w / 2);
|
|
20240
|
+
}
|
|
20269
20241
|
const requiredPitchByPair = [];
|
|
20270
20242
|
for (let i = 0; i < sortedByX.length - 1; i++) {
|
|
20271
20243
|
const lane = sortedByX[i];
|
|
20272
20244
|
const rightLane = sortedByX[i + 1];
|
|
20273
|
-
const
|
|
20245
|
+
const laneHalfSum = lane.width / 2 + rightLane.width / 2;
|
|
20246
|
+
const nodeHalfSum = (\u7BB1\u306E\u534A\u5E45.get(lane.id) ?? 0) + (\u7BB1\u306E\u534A\u5E45.get(rightLane.id) ?? 0);
|
|
20274
20247
|
const currentPitch = rightLane.x + rightLane.width / 2 - (lane.x + lane.width / 2);
|
|
20275
|
-
const
|
|
20276
|
-
|
|
20248
|
+
const \u96A3 = requiredBoxWAdjacent[i];
|
|
20249
|
+
const \u8DE8 = requiredBoxWSpanning[i];
|
|
20250
|
+
if (\u96A3 === 0 && \u8DE8 === 0) {
|
|
20277
20251
|
requiredPitchByPair.push(currentPitch);
|
|
20278
20252
|
continue;
|
|
20279
20253
|
}
|
|
20280
|
-
const
|
|
20281
|
-
|
|
20254
|
+
const \u4E0A\u4E57\u305B = CLEARANCE_NODE_LABEL * 2 + EDGE_STUB_OUT * 2;
|
|
20255
|
+
const \u96A3\u306E\u8981\u6C42 = \u96A3 === 0 ? 0 : \u96A3 + \u4E0A\u4E57\u305B + nodeHalfSum;
|
|
20256
|
+
const \u8DE8\u306E\u8981\u6C42 = \u8DE8 === 0 ? 0 : \u8DE8 + \u4E0A\u4E57\u305B + laneHalfSum;
|
|
20257
|
+
requiredPitchByPair.push(Math.max(currentPitch, \u96A3\u306E\u8981\u6C42, \u8DE8\u306E\u8981\u6C42));
|
|
20282
20258
|
}
|
|
20283
20259
|
const targetPitch = Math.ceil(Math.max(...requiredPitchByPair));
|
|
20284
20260
|
const shiftedXById = /* @__PURE__ */ new Map();
|