@cardenelabs/cdl 0.40.12 → 0.41.1
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 +55 -1
- package/dist/index.cjs +20 -43
- 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 +20 -43
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +0 -19
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +0 -19
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/visual-validate.ts +79 -55
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" | "subpixel-precision" | "dom-complexity-budget" | "reduced-motion-compat" | "touch-target-size" | "row-content-typing" | "terminal-safe-text" | "gpu-layer-efficiency" | "
|
|
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" | "subpixel-precision" | "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" | "subpixel-precision" | "dom-complexity-budget" | "reduced-motion-compat" | "touch-target-size" | "row-content-typing" | "terminal-safe-text" | "gpu-layer-efficiency" | "
|
|
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" | "subpixel-precision" | "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
|
@@ -15540,7 +15540,6 @@ function emptyCounts() {
|
|
|
15540
15540
|
"row-content-typing": 0,
|
|
15541
15541
|
"terminal-safe-text": 0,
|
|
15542
15542
|
"gpu-layer-efficiency": 0,
|
|
15543
|
-
"memory-budget": 0,
|
|
15544
15543
|
"svg-injection-safety": 0,
|
|
15545
15544
|
"seo-metadata-quality": 0,
|
|
15546
15545
|
"bidi-hyphenation": 0,
|
|
@@ -17283,24 +17282,6 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
|
|
|
17283
17282
|
"warn"
|
|
17284
17283
|
);
|
|
17285
17284
|
}
|
|
17286
|
-
const MEMORY_BUDGET = 1e6;
|
|
17287
|
-
let nodeMemUnit = 0;
|
|
17288
|
-
for (const n of laid.nodes) nodeMemUnit += n.w * n.h;
|
|
17289
|
-
let edgeMemUnit = 0;
|
|
17290
|
-
for (const e of laid.edges) {
|
|
17291
|
-
const segs = extractPathSegments(e.d);
|
|
17292
|
-
edgeMemUnit += segs.length * 100;
|
|
17293
|
-
}
|
|
17294
|
-
let phaseMemUnit = 0;
|
|
17295
|
-
for (const p of diag.phases) phaseMemUnit += (p.tweens.length + p.sets.length) * 50;
|
|
17296
|
-
const totalMemUnit = nodeMemUnit + edgeMemUnit + phaseMemUnit;
|
|
17297
|
-
if (totalMemUnit > MEMORY_BUDGET) {
|
|
17298
|
-
push(
|
|
17299
|
-
"memory-budget",
|
|
17300
|
-
`diagram memory unit \u63A8\u5B9A ${totalMemUnit.toFixed(0)} > budget ${MEMORY_BUDGET} (nodes=${nodeMemUnit.toFixed(0)} edges=${edgeMemUnit.toFixed(0)} phases=${phaseMemUnit.toFixed(0)})`,
|
|
17301
|
-
"warn"
|
|
17302
|
-
);
|
|
17303
|
-
}
|
|
17304
17285
|
const XSS_PATTERNS = [
|
|
17305
17286
|
{ re: /<script\b/i, label: "<script> tag" },
|
|
17306
17287
|
{ re: /javascript:/i, label: "javascript: URI" },
|
|
@@ -17724,6 +17705,24 @@ function visualValidateAll(diagrams, opts) {
|
|
|
17724
17705
|
metaViolations
|
|
17725
17706
|
};
|
|
17726
17707
|
}
|
|
17708
|
+
var PERF_BUDGET_TOTAL_MS = 5e3;
|
|
17709
|
+
var PERF_SLOWEST_SAMPLE = 5;
|
|
17710
|
+
function perfBudgetViolations(durations, diagrams = []) {
|
|
17711
|
+
const total = durations.reduce((s, d) => s + d, 0);
|
|
17712
|
+
if (total <= PERF_BUDGET_TOTAL_MS) return [];
|
|
17713
|
+
const \u91CD\u3044\u9806 = durations.map((ms, i) => ({ id: diagrams[i]?.id ?? "?", ms })).sort((a, b) => b.ms - a.ms);
|
|
17714
|
+
const \u629C\u7C8B = \u91CD\u3044\u9806.slice(0, PERF_SLOWEST_SAMPLE);
|
|
17715
|
+
const \u6B8B\u308A = \u91CD\u3044\u9806.length - \u629C\u7C8B.length;
|
|
17716
|
+
const \u5185\u8A33 = \u629C\u7C8B.map((d) => `"${d.id}" ${d.ms}ms`).join(" / ") + (\u6B8B\u308A > 0 ? `\u3001 \u6B8B\u308A ${\u6B8B\u308A} \u56F3\u306F\u51FA\u3057\u3066\u3044\u306A\u3044` : "");
|
|
17717
|
+
return [
|
|
17718
|
+
{
|
|
17719
|
+
axis: "validate-performance-budget",
|
|
17720
|
+
diagramId: "__meta__",
|
|
17721
|
+
detail: `visualValidateAll \u5168 ${durations.length} \u56F3\u306E\u7D2F\u8A08 ${total}ms > ${PERF_BUDGET_TOTAL_MS}ms budget (\u91CD\u3044\u9806 ${\u5185\u8A33})`,
|
|
17722
|
+
severity: "warn"
|
|
17723
|
+
}
|
|
17724
|
+
];
|
|
17725
|
+
}
|
|
17727
17726
|
function validateMetaAxes(totalCounts, diagrams = [], durations = [], reports = []) {
|
|
17728
17727
|
const out = [];
|
|
17729
17728
|
const totalErrors = reports.reduce(
|
|
@@ -17739,27 +17738,7 @@ function validateMetaAxes(totalCounts, diagrams = [], durations = [], reports =
|
|
|
17739
17738
|
severity: "warn"
|
|
17740
17739
|
});
|
|
17741
17740
|
}
|
|
17742
|
-
|
|
17743
|
-
const PERF_BUDGET_TOTAL_MS = 5e3;
|
|
17744
|
-
const overBudgetIdx = durations.findIndex((d) => d > PERF_BUDGET_PER_DIAGRAM_MS);
|
|
17745
|
-
if (overBudgetIdx >= 0) {
|
|
17746
|
-
const did = diagrams[overBudgetIdx]?.id ?? "?";
|
|
17747
|
-
out.push({
|
|
17748
|
-
axis: "validate-performance-budget",
|
|
17749
|
-
diagramId: did,
|
|
17750
|
-
detail: `diagram "${did}" validate ${durations[overBudgetIdx]}ms > ${PERF_BUDGET_PER_DIAGRAM_MS}ms budget`,
|
|
17751
|
-
severity: "warn"
|
|
17752
|
-
});
|
|
17753
|
-
}
|
|
17754
|
-
const totalDur = durations.reduce((s, d) => s + d, 0);
|
|
17755
|
-
if (totalDur > PERF_BUDGET_TOTAL_MS) {
|
|
17756
|
-
out.push({
|
|
17757
|
-
axis: "validate-performance-budget",
|
|
17758
|
-
diagramId: "__meta__",
|
|
17759
|
-
detail: `visualValidateAll \u5168 diagram \u7D2F\u8A08 ${totalDur}ms > ${PERF_BUDGET_TOTAL_MS}ms budget`,
|
|
17760
|
-
severity: "warn"
|
|
17761
|
-
});
|
|
17762
|
-
}
|
|
17741
|
+
out.push(...perfBudgetViolations(durations, diagrams));
|
|
17763
17742
|
const DEAD_ALLOWLIST = [
|
|
17764
17743
|
// catalog で自然発火なしを許容する security / migration / performance / meta / dev-quality axis 群。
|
|
17765
17744
|
// 実 diagram に該当データ (XSS / migration list / oversized / broken doc) が混入するのが稀なため。
|
|
@@ -17807,7 +17786,6 @@ function validateMetaAxes(totalCounts, diagrams = [], durations = [], reports =
|
|
|
17807
17786
|
"row-content-typing",
|
|
17808
17787
|
"terminal-safe-text",
|
|
17809
17788
|
"gpu-layer-efficiency",
|
|
17810
|
-
"memory-budget",
|
|
17811
17789
|
"svg-injection-safety",
|
|
17812
17790
|
"seo-metadata-quality",
|
|
17813
17791
|
"bidi-hyphenation",
|
|
@@ -17877,7 +17855,6 @@ function validateMetaAxes(totalCounts, diagrams = [], durations = [], reports =
|
|
|
17877
17855
|
"row-content-typing",
|
|
17878
17856
|
"terminal-safe-text",
|
|
17879
17857
|
"gpu-layer-efficiency",
|
|
17880
|
-
"memory-budget",
|
|
17881
17858
|
"svg-injection-safety",
|
|
17882
17859
|
"seo-metadata-quality",
|
|
17883
17860
|
"bidi-hyphenation",
|
|
@@ -17919,7 +17896,7 @@ function validateMetaAxes(totalCounts, diagrams = [], durations = [], reports =
|
|
|
17919
17896
|
});
|
|
17920
17897
|
}
|
|
17921
17898
|
}
|
|
17922
|
-
const EXPECTED_AXIS_COUNT =
|
|
17899
|
+
const EXPECTED_AXIS_COUNT = 67;
|
|
17923
17900
|
if (allAxes.length !== EXPECTED_AXIS_COUNT) {
|
|
17924
17901
|
out.push({
|
|
17925
17902
|
axis: "axis-documentation-completeness",
|