iter: d18 硬编码颜色门禁 + 清掉 ui.css 残留 #fff

This commit is contained in:
ui-arch-bot
2026-10-23 17:00:55 +08:00
parent bdc1fec3f9
commit 4012923ff1
7 changed files with 35 additions and 9 deletions
+5 -5
View File
@@ -28,7 +28,7 @@
.ua-btn-danger {
background: var(--ua-color-danger);
border-color: var(--ua-color-danger);
color: #fff;
color: var(--ua-color-bg);
}
.ua-input {
min-width: 200px;
@@ -207,7 +207,7 @@
width: 16px;
height: 16px;
border-radius: 50%;
background: #fff;
background: var(--ua-color-bg);
transition: left 0.2s;
}
.ua-switch-input:checked + .ua-switch-track {
@@ -652,15 +652,15 @@
}
.ua-badge-success {
background: var(--ua-color-success);
color: #fff;
color: var(--ua-color-bg);
}
.ua-badge-warning {
background: var(--ua-color-warning);
color: #fff;
color: var(--ua-color-bg);
}
.ua-badge-danger {
background: var(--ua-color-danger);
color: #fff;
color: var(--ua-color-bg);
}
/* —— 提示条 —— */
+18 -1
View File
@@ -560,6 +560,22 @@ function cmdStyle() {
console.log(`style OK (${files.length} files)`);
}
/*** 皮肤包硬编码颜色检查:#hex 字面量一律禁止,颜色必须走 --ua-* 令牌(rgba 仅限阴影/遮罩的透明度叠加) ***/
function checkSkinCss(pkg) {
const issues = [];
const dir = path.join(ROOT, pkg.dir);
if (!fs.existsSync(dir)) return issues;
for (const name of fs.readdirSync(dir)) {
if (!name.endsWith('.css')) continue; // 只查样式表
const file = path.join(dir, name);
const lines = fs.readFileSync(file, 'utf8').split(/\r?\n/);
lines.forEach((line, i) => {
if (/#[0-9a-fA-F]{3,8}\b/.test(line)) issues.push(`${pkg.dir}/${name}:${i + 1} 皮肤包禁止硬编码颜色,改用 --ua-* 令牌`);
});
}
return issues;
}
/*** 清单一致性校验:组件文档块的 id / props 说明 / demo 锚点必须与代码和演示产物对齐 ***/
function cmdVerify() {
const issues = [];
@@ -571,6 +587,7 @@ function cmdVerify() {
for (const pkg of collectManifests()) {
const comps = pkg.docs?.components ?? []; // 清单已被 collectManifests 摊平
const exports = pkg.api?.exports ?? [];
if (pkg.type === 'skin-dom') issues.push(...checkSkinCss(pkg));
if (comps.length && !exports.length) issues.push(`${pkg.name}: docs.components 有 ${comps.length} 项但 api.exports 为空`);
const seen = new Set(); // 组件 id 去重(同一清单内不允许重复)
@@ -598,7 +615,7 @@ function cmdVerify() {
console.error(`${issues.length} violation(s)`);
process.exit(1);
}
console.log('verify OK (manifest ↔ docs ↔ demo 一致)');
console.log('verify OK (manifest ↔ docs ↔ demo 一致,皮肤无硬编码颜色)');
}
// ---- 入口 ----