Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(design-system): DS-10 间距报告纳入 space-x/y 任意值

Kirozenga4bad4e6a749
diff --git a/scripts/__tests__/hardcoded-color-audit.test.mjs b/scripts/__tests__/hardcoded-color-audit.test.mjs
index f67d51c627..91dfaa2e3b 100644
--- a/scripts/__tests__/hardcoded-color-audit.test.mjs
+++ b/scripts/__tests__/hardcoded-color-audit.test.mjs
@@ -154,6 +154,8 @@ test('spacing reports distinguish real generated references, unknown variables a
['p-[env(safe-area-inset-top)]', 'unclassified-spacing'],
['p-[calc(100%-4px)]', 'unclassified-spacing'],
['mt-[var(--space-4)]', 'spacing-source-reference'],
+ ['space-x-[var(--space-4)]', 'spacing-source-reference'],
+ ['space-y-[4px]', 'literal-spacing'],
['ms-[var(--space-4,initial)]', 'mixed-spacing-expression'],
['mt-[3px]', 'literal-spacing'],
['mx-[7px]', 'literal-spacing'],
@@ -172,7 +174,7 @@ test('spacing reports distinguish real generated references, unknown variables a
assert.match(hit.suggestion, /foundations.spacing/);
assert.doesNotMatch(hit.suggestion, /radius overrides/);
}
- for (const value of ['p-4', 'm-4', 'mt-2', 'gap-x-2', 'gap-y-2', 'gapx-[13px]', 'gapy-[13px]']) {
+ for (const value of ['p-4', 'm-4', 'mt-2', 'gap-x-2', 'gap-y-2', 'space-x-2', 'space-y-reverse', 'gapx-[13px]', 'gapy-[13px]']) {
assert.deepEqual(inspect(file, `<div className="${value}" />`), [], value);
}
const source = '// gap-x-[13px]\n<div className="gap-x-[13px]" />\n<div className="p-[var(--space-4)]" />';
diff --git a/scripts/shared/design-layer-report.mjs b/scripts/shared/design-layer-report.mjs
index 7306d6991c..0940a7f631 100644
--- a/scripts/shared/design-layer-report.mjs
+++ b/scripts/shared/design-layer-report.mjs
@@ -89,7 +89,7 @@ export function classifyDesignLayer({ member, layer, radius, evidence = false })
export function reportDesignLayers(file, source, changed, locate, spacingVariables) {
const findings = [];
- const patterns = /\brounded(?:-(?:\[[^\]\n]+\]|[\w-]+))?|\bborder(?:-radius|Radius)\s*:\s*[^;,}\n]+|\b(?:[pm][xytrblse]?|gap(?:-[xy])?)-\[[^\]\n]+\]/g;
+ const patterns = /\brounded(?:-(?:\[[^\]\n]+\]|[\w-]+))?|\bborder(?:-radius|Radius)\s*:\s*[^;,}\n]+|\b(?:[pm][xytrblse]?|gap(?:-[xy])?|space-[xy])-\[[^\]\n]+\]/g;
for (const match of source.matchAll(patterns)) {
const pos = locate(match.index);
if (!changed.has(pos.line)) continue;
@@ -113,7 +113,7 @@ export function reportDesignLayers(file, source, changed, locate, spacingVariabl
value: match[0], disposition: 'report', ...judgement,
suggestion: isRadius
? 'Review the visible frame, contained mark and hit/indicator layers separately against DESIGN §5 and governance §13; register missing evidence/decisions. Do not change user radius overrides.'
- : 'Use the existing p/px/py, m/mx/my and gap/gap-x/gap-y scales from desktop-bindings.json foundations.spacing and the component treatment in DESIGN §4/5. Verify unknown variables, calculations and fallbacks; do not infer button spacing from a DOM tag.' });
+ : 'Use the existing p/px/py, m/mx/my, gap/gap-x/gap-y and space-x/space-y scales from desktop-bindings.json foundations.spacing and the component treatment in DESIGN §4/5. Verify unknown variables, calculations and fallbacks; do not infer button spacing from a DOM tag.' });
}
if (/components\/settings\/.*(?:Dialog|Wizard)\.tsx$/.test(file) && changed.size) {
findings.push({ file, line: Math.min(...changed), column: 1, rule: 'form-adoption', disposition: 'report',