Skip to content

docs(protocol): widget-contract 的 Theme 段停止教 #3494 已删除的 density,token 词表按 #5021 重写 (#5291) - #5454

Merged
os-zhuang merged 1 commit into
mainfrom
claude/issue-5291-widget-theme-docs
Aug 5, 2026
Merged

docs(protocol): widget-contract 的 Theme 段停止教 #3494 已删除的 density,token 词表按 #5021 重写 (#5291)#5454
os-zhuang merged 1 commit into
mainfrom
claude/issue-5291-widget-theme-docs

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Fixes #5291

前提已核(against origin/main @ 01c0baef9)

issue 正文是线索不是规格,先证伪再动手。该页确实仍停在 #3494 之前:

派发口径的前置条件也已满足:PR #5289 已 MERGED,#5021 的退役面已在 origin/maintheme.zod.ts 上落定。

用可执行的方式钉住「照抄即失败」

把该页 ## Theme 段的 YAML fence 抽出来喂给真正的 ThemeSchema(即 defineTheme() / defineStack({ themes }) 跑的那一段)。方向是在跑之前定的:改前红、改后绿——这一单里被改的是示例本身,规则(ThemeSchema)没动,所以这是最普通的那个方向,没有反转。

改前(origin/main 的页面),两处失败而不是一处:

RESULT: ThemeSchema.safeParse -> FAILURE
  [invalid_type] path=["colors"] :: Invalid input: expected object, received null
  [unrecognized_keys] path=[] :: Unrecognized key(s) on this theme: `density`. …
  • `density` was removed in #3494 — no renderer read it. Express compact/comfortable spacing as your own tokens under `customVars`.

colors: 底下只有一行注释,YAML 解析成 null,而 colors 必填、其 primary 必填。issue 只点了 density,但「照抄本页 = 构建失败」这条主张实际由两个缺陷共同成立,所以两个一起修——只修 density 的话,照抄的人仍然拿到一次失败,缺陷的标题依旧成立。

改后(本分支):

RESULT: ThemeSchema.safeParse -> SUCCESS
parsed keys: borderRadius, colors, customVars, label, mode, name, shadows, typography

词表刷新:每条断言逐键核过,不是照抄 issue 正文

派发口径明确要求以 origin/main 的实际墓碑为准。退役面与活键都对着 theme.zod.ts、发出的 CSS 变量对着 objectui packages/core/src/theme/ThemeEngine.ts 核过:

  • COLOR_TO_CSS_MAP 确认改名:surface--cardtext--foregroundtextSecondary--muted-foregrounddisabled--mutederror--destructive
  • generateBorderRadiusVars / generateShadowVars 确认 base 发的是裸 --radius / --shadow
  • generateTypographyVars 确认 fontFamily.base--font-sans
  • customVars 确认逐字发出(缺 -- 前缀时补上)

并用第二个 harness 把页面的主张与 schema 对齐扫了一遍——16 个退役键必须被拒、10 个活键必须被接受:

## RETIRED at the theme level — each must be REJECTED
  spacing / breakpoints / logo / density / wcagContrast / rtl /
  touchTarget / keyboardNavigation / animation / zIndex        rejected
## RETIRED inside typography — each must be REJECTED
  fontSize / fontWeight / lineHeight / letterSpacing            rejected
  fontFamily.heading / fontFamily.mono                          rejected
## LIVE — the ten keys the doc enumerates, each must be ACCEPTED
  name / label / description / mode / colors / typography /
  borderRadius / shadows / customVars / extends                 accepted

OK — doc claims match the schema exactly.

两个 harness 都是一次性的,已在提交前删除,不进仓库。

改了什么

范围严格限定在该页 Theme 段。⛔ 未碰 content/docs/references/**(生成物)与 content/docs/releases/。同页其它段落不在本单范围。

门禁(真实输出)

✓ doc authoring guard: 362 files clean — no bare metadata literals.
check-role-word: OK (43 baselined file(s), no new occurrences).
✓ docs-accuracy-audit scope is in sync with content/docs/: 178 hand-written doc(s).
check-nul-bytes: OK (scanned 5443 tracked text file(s); … no raw NUL bytes).
✓ .changeset/config.json "fixed" group is in sync with 69 public workspace packages.

另外用 @mdx-js/mdx 单独编译了这一页(MDX compile OK),因为本次新增了表格与 Callout。grep -naP '[\x00-\x08\x0b\x0c\x0e-\x1f]' 自查该页无控制字节。

Changeset:.changeset/widget-contract-theme-token-vocabulary.md(docs-only,空 frontmatter,releases nothing——沿用 http-protocol-discovery-two-shapes.md 的先例)。


🤖 Generated with Claude Code

https://claude.ai/code/session_01GX3sL71LFq8m2usg6VqTSE


Generated by Claude Code

…en 词表按 #5021 重写 (#5291)

`content/docs/protocol/objectui/widget-contract.mdx` 的 Theme 段散文与 YAML 示例
都在教 `density`(「`density` is one of `compact`, `regular`, or `spacious`」+
示例里的 `density: regular`)。该键在 #3494 就被删了,而 `ThemeSchema` 自 #4001
批 15 起是 `.strict()` —— 照抄本页示例必然 parse 失败。拒绝本身是响亮且带处方的
(`THEME_RETIRED_KEY_GUIDANCE` 的 `density` 墓碑),问题在于平台自己的权威文档把
作者送进了那次拒绝;对从这一页取样写主题的 AI 作者尤其贵。

原示例其实有两处解析失败——除 `density` 外,`colors:` 下只有一行注释,YAML 解析成
`null`,而 `colors` 必填且其 `primary` 必填。现在的示例是一份真能通过 `ThemeSchema`
解析的完整主题。

同时把整段 token 词表刷新到 #5021 之后:

- 逐一列出 `ThemeSchema` 的十个可写键,并给出每个键实际落到 document 上的 CSS 变量
  ——`colors` 出门时的改名(`surface` → `--card`、`text` → `--foreground`、
  `error` → `--destructive` …)、`borderRadius.base` / `shadows.base` 发裸
  `--radius` / `--shadow`、`typography` 自 #5021 起只剩 `fontFamily.base`
  (发 `--font-sans`)、`customVars` 逐字发出。
- 新增 Callout 点名两批退役键:#3494 的八个,以及 #5021(`@objectstack/spec`
  17.0.0, ADR-0049)的 `animation` / `zIndex`、`typography` 四条排版标尺、
  `fontFamily.heading` / `mono`;处方统一是 `customVars`(逐字节等价替代),并给出
  `os migrate meta --from 16`。

每条断言都对着 `packages/spec/src/ui/theme.zod.ts` 与 objectui `ThemeEngine.ts`
逐键核过:16 个退役键全部被拒、10 个活键全部被接受。

不碰 `content/docs/references/**` 与 `content/docs/releases/`。Docs-only。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GX3sL71LFq8m2usg6VqTSE
@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectstack Ignored Ignored Aug 5, 2026 12:30pm

Request Review

@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tooling and removed size/s labels Aug 5, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review August 5, 2026 12:38
@os-zhuang
os-zhuang added this pull request to the merge queue Aug 5, 2026
Merged via the queue into main with commit 31b0537 Aug 5, 2026
20 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-5291-widget-theme-docs branch August 5, 2026 12:45
akarma-synetal pushed a commit to akarma-synetal/framework that referenced this pull request Aug 6, 2026
…talled the release (objectstack-ai#5292) (objectstack-ai#5467)

The gate's failure message offered "an empty changeset" and the
`skip-changeset` label as two equal ways out, and the comment above the
counter called them "on par". They are equal to THIS gate's counting, but
not downstream: the label is a gate-level exemption that produces no input
for changesets/action, while an empty-frontmatter changeset is a real input
to it. When every pending changeset is empty the action takes its
`hasChangesets && !hasNonEmptyChangesets` branch, prints "All changesets
are empty; not creating PR" and returns in 0 seconds -- no version PR, no
publish, Release run green. That is objectstack-ai#4898, which stalled 17.0.0-rc.2.

The message was therefore an active mis-prescription: it handed a known
release-stalling input to whoever had just hit the wall.

Rewritten to three ranked routes, with the label preferred and the empty
changeset demoted to a warned last resort that names objectstack-ai#4898. The counting
logic is untouched: an empty changeset still counts, so today's precedent
(objectstack-ai#5453 / objectstack-ai#5454, both merged behind empty changesets) stays valid.


Claude-Session: https://claude.ai/code/session_01GX3sL71LFq8m2usg6VqTSE

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

content/docs/protocol/objectui/widget-contract.mdx 的 Theme 段仍在教 #3494 已删除的 density(照抄文档即构建失败)

2 participants