Skip to content

feat(unocss): use ant-* prefixed keys for font-size tokens to avoid colliding with built-in rem scale#4

Merged
ayangweb merged 1 commit intomainfrom
copilot/add-font-size-mapping
Apr 27, 2026
Merged

feat(unocss): use ant-* prefixed keys for font-size tokens to avoid colliding with built-in rem scale#4
ayangweb merged 1 commit intomainfrom
copilot/add-font-size-mapping

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 27, 2026

buildFontSizeTheme/buildTextTheme used bare keys (sm, lg, xl, h1…) that, when allowUnprefixed: true, generated text-sm/text-lg rules that silently overrode the UnoCSS/Tailwind built-in rem scale.

Changes

  • common/theme.ts — Rename all font-size/text theme keys to ant-* (ant-sm, ant-base, ant-lg, ant-xl, ant-h1, ant-h2, ant-h3). The DEFAULT key is replaced by ant-base.
  • common/autocomplete.ts — Update FONT_ENUM / TEXT_ENUM to reflect the new key names.
  • preset.test.ts — Add assertions that bare keys (sm, lg, DEFAULT) are absent from the theme, ant-* keys resolve to the correct var(--ant-font-size-*) values, and the rule regex matches text-ant-sm / a-text-ant-sm.
  • README.md — Document new text-ant-* utility names and explain the coexistence design.

Before / After

<!-- before: overrides UnoCSS built-in 0.875rem -->
<span class="text-sm"></span>

<!-- after: built-in scale untouched; Ant token opt-in -->
<span class="text-sm"></span>          <!-- → 0.875rem (UnoCSS built-in) ✅ -->
<span class="text-ant-sm"></span>      <!-- → var(--ant-font-size-sm)     ✅ -->
<span class="a-text-ant-lg"></span>    <!-- → var(--ant-font-size-lg)     ✅ -->

No changes to spacing, color, shadow, or border-radius tokens — only the font-size key namespace is affected.

…lt-in collision

Agent-Logs-Url: https://github.com/ayangweb/css-plugin/sessions/b0b71875-5b57-40e9-be4d-8c9baa7b88ba

Co-authored-by: ayangweb <75017711+ayangweb@users.noreply.github.com>
@ayangweb ayangweb marked this pull request as ready for review April 27, 2026 09:34
@ayangweb ayangweb merged commit 236b49f into main Apr 27, 2026
@ayangweb
Copy link
Copy Markdown
Owner

@copilot 我刚才忘了问你,tailwindcss 需要改吗?会不会也有冲突?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants