World's first open-source enterprise world model.
Rust agent-memorybitemporalgraphragknowledge-baseknowledge-graphllmontologypgvectorpostgresqlragrustself-hostedsemantic-searchtemporal-knowledge-graphworld-model
The style guard knows every text-* class it allows (#426)
WaylandYangdc1fbec3face
diff --git a/web/scripts/style-guard.mjs b/web/scripts/style-guard.mjsindex 3f6888de..2f908b68 100644--- a/web/scripts/style-guard.mjs+++ b/web/scripts/style-guard.mjs@@ -17,14 +17,42 @@ const BASELINE = path.join(ROOT, "style-guard.baseline.json");const PALETTE ="neutral|zinc|gray|slate|stone|rose|amber|red|green|blue|sky|emerald|violet|indigo|purple|pink|orange|yellow|cyan|teal|lime";+// `text-*` 允许的词从 styles.css 里读:五档字号(--text-*)与颜色令牌(--color-*)。+// 令牌加一个这里自动认得;不用再改守卫。剩下的是 Tailwind 里不是字号也不是颜色的+// text- 工具(对齐、换行、省略)和几个颜色关键字+const STYLES = fs.readFileSync(path.join(SRC, "styles.css"), "utf8");+const TOKENS = [+ ...new Set([+ ...[...STYLES.matchAll(/--text-([a-z]+)(?![a-z-])/g)].map((m) => m[1]),+ ...[...STYLES.matchAll(/--color-([a-z0-9-]+)/g)].map((m) => m[1]),+ ]),+];+const TEXT_UTILITIES =+ "left|center|right|justify|start|end|ellipsis|clip|wrap|nowrap|balance|pretty|white|black|transparent|current|inherit";+const KNOWN_TEXT = [...TOKENS, ...TEXT_UTILITIES.split("|")]+ .sort((a, b) => b.length - a.length)+ .join("|");+/** 每条规矩:正则 + 一句话说明 + 是否也管组件目录 */const RULES = [{id: "type-scale",- re: /\btext-(xs|sm|base|lg|xl|2xl|3xl|4xl|\[[0-9.]+(px|rem)\])\b/g,+ re: /\btext-(xs|sm|base|lg|\d*xl|\[[0-9.]+(px|rem)\])\b/g,why: "字号只用五档:text-fine / small / body / title / display(规矩 1)",ui: true,},+ {+ id: "unknown-text",+ // 不在五档字号、颜色令牌、对齐/换行工具之内的 text-<词>:多半是编出来的+ // (text-caption、text-muted),没有定义,渲染成继承的字号或颜色,而且看不出来。+ // Tailwind 的默认字号另有上面那条报;模型名 text-embedding-* 不是类+ re: new RegExp(+ `\\btext-(?!(?:${KNOWN_TEXT}|xs|sm|base|lg|\\d*xl)(?![a-z0-9-])|embedding|\\[)[a-z][a-z0-9-]*\\b`,+ "g",+ ),+ why: "text-* 只能是五档字号、颜色令牌,或对齐/换行工具;别的没有定义(规矩 1、4)",+ ui: true,+ },{id: "raw-palette",re: new RegExp(diff --git a/web/src/pages/Login.tsx b/web/src/pages/Login.tsxindex b80fc1ab..9c607fa2 100644--- a/web/src/pages/Login.tsx+++ b/web/src/pages/Login.tsx@@ -64,7 +64,7 @@ export function Login() {className={`relative z-10 w-full max-w-sm ${leaving ? "u-depart" : ""}`}><div className="mb-8 text-center u-rise">- <h1 className="text-5xl font-normal">+ <h1 className="u-wordmark-hero font-normal"><Wordmark /></h1><p className="mt-2 text-body text-ink-2">diff --git a/web/src/pages/ServerDown.tsx b/web/src/pages/ServerDown.tsxindex f03fd016..96e87727 100644--- a/web/src/pages/ServerDown.tsx+++ b/web/src/pages/ServerDown.tsx@@ -21,7 +21,7 @@ function PunishmentPage({<div className="min-h-screen flex items-center justify-center px-4"><LoginScene /><div className="relative z-10 text-center u-rise">- <h1 className="text-5xl font-normal">+ <h1 className="u-wordmark-hero font-normal"><Wordmark /></h1><p className="u-balance mt-4 text-body text-ink-2">{message}</p>diff --git a/web/src/styles.css b/web/src/styles.cssindex dde3e094..c706c7d1 100644--- a/web/src/styles.css+++ b/web/src/styles.css@@ -1347,3 +1347,10 @@ a:hover > .u-mark-arrow {transition: none;}}++/* 登录页与故障页正中的字标。它是品牌元素,不是界面文字,所以不在五档字号里——+ 大小定在这里(等于从前的 text-5xl:48px / 1),页面只引这个名字 */+.u-wordmark-hero {+ font-size: 3rem;+ line-height: 1;+}