refactor(ui-kit): refs 瘦身,只留 theme ref #77

Merged
arnold.cui merged 1 commits from refactor/slim-tokens-refs into main 2026-12-01 14:19:35 +00:00
Member

背景

排查 tokens/refs.ts 是否仍有必要。结论:文件有必要,但 2/3 是死代码——palette、site 两个 ref 全仓零消费;theme ref 被 7 个 site-ui-kit css.ts 文件、80+ 处引用,是其它包消费语义 token 的唯一合法通道(跨包 import ui-kit 的 ve .css.ts 会编译进第二个变量作用域、引用悬空,README 明文禁止),且 Refs<typeof themeVars> 提供改名即断的 typecheck 护栏。

变更内容

  • refs.ts 删除 palette、site 两个死导出及其 type 导入,只留 theme 与 Refs 类型工具;
  • tokens/index.ts 相应只导出 theme。

自测结果

  • 全仓 grep 确认 palette/site ref 无任何 import(含 e2e、stack-plugins、examples、docs)。
  • format:check 绿;三个 typecheck 全绿(tutorial tsc -b、ui-kit、site-ui-kit——后者是 theme ref 的消费方)。
  • yarn workspace @stack/tutorial build 全量构建绿:24/24 页预渲染。
  • 提交作者与签名核对:arnold.cui-agent <arnold.cui-agent@idealjs.com> G。
  • CI / check (pull_request) 绿:run #729,2m33s。
## 背景 排查 `tokens/refs.ts` 是否仍有必要。结论:文件有必要,但 2/3 是死代码——`palette`、`site` 两个 ref 全仓零消费;`theme` ref 被 7 个 site-ui-kit css.ts 文件、80+ 处引用,是其它包消费语义 token 的唯一合法通道(跨包 import ui-kit 的 ve `.css.ts` 会编译进第二个变量作用域、引用悬空,README 明文禁止),且 `Refs<typeof themeVars>` 提供改名即断的 typecheck 护栏。 ## 变更内容 - `refs.ts` 删除 `palette`、`site` 两个死导出及其 type 导入,只留 `theme` 与 `Refs` 类型工具; - `tokens/index.ts` 相应只导出 `theme`。 ## 自测结果 - 全仓 grep 确认 `palette`/`site` ref 无任何 import(含 e2e、stack-plugins、examples、docs)。 - `format:check` 绿;三个 typecheck 全绿(tutorial `tsc -b`、ui-kit、site-ui-kit——后者是 theme ref 的消费方)。 - `yarn workspace @stack/tutorial build` 全量构建绿:24/24 页预渲染。 - 提交作者与签名核对:`arnold.cui-agent <arnold.cui-agent@idealjs.com> G`。 - CI / check (pull_request) 绿:[run \#729](https://gitea.idealjs.com/idealjs/stack/actions/runs/729/jobs/815),2m33s。
arnold.cui-agent added 1 commit 2026-11-30 13:19:58 +00:00
refactor(ui-kit): refs 瘦身,只留 theme ref
CI / check (pull_request) Successful in 2m33s
a6cff95ff7
palette 与 site ref 全仓零消费,theme ref 是其它包消费语义 token
的唯一合法通道(跨包 import ve .css.ts 会编译进第二个作用域),
保留并维持 Refs<typeof themeVars> 改名即断的类型护栏。
tokens barrel 相应只导出 theme。
arnold.cui merged commit 07587aee1a into main 2026-12-01 14:19:35 +00:00
arnold.cui deleted branch refactor/slim-tokens-refs 2026-12-01 14:19:37 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: idealjs/stack#77