refactor: migrate UnoCSS attributify to class syntax across all components#436
Merged
Conversation
…nents Remove presetAttributify from the shared presetDevToolsUI preset and rewrite every component that relied on attributify mode to use plain class utilities instead. Covers packages/ui, rolldown, vite, oxc and the core playground. Grouped values are expanded to their canonical utilities (border="~ base rounded-lg" -> border border-base rounded-lg, flex="~ col gap-1" -> flex flex-col gap-1) and variant attributes to variant classes (hover="bg-active" -> hover:bg-active). Each converted file was checked to generate byte-identical CSS declarations before and after.
@vitejs/devtools
@vitejs/devtools-kit
@vitejs/devtools-oxc
@vitejs/devtools-rolldown
@vitejs/devtools-vite
@vitejs/devtools-vitest
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Migrates the entire codebase off UnoCSS attributify mode and onto plain
classutilities, then removespresetAttributify()from the sharedpresetDevToolsUIpreset (packages/ui/src/unocss/index.ts) — the single placeattributify was enabled.
126 components across
packages/ui,packages/rolldown,packages/vite,packages/oxcand the core playground were rewritten. The conversion was donewith a codemod that reuses the real UnoCSS extractor/variant semantics, so the
mapping matches what attributify itself produced:
classverbatim —flex items-center→class="flex items-center"border="~ base rounded-lg"→border border-base rounded-lg,flex="~ col gap-1"→flex flex-col gap-1,text="center xs"→text-center text-xshover="bg-active op100"→hover:bg-active hover:op100class, leaving:class/:style/directives untouchedCorrectness: every converted file was gated by a verifier that generates
CSS from the original (attributify) and the rewritten (class) template with the
real preset and asserts the resulting declarations are identical — 126/126 pass.
Component props that share a name with a utility (e.g.
<DisplayBadge text="initial">)are detected and left as props, not converted.
pnpm lint,pnpm typecheck,pnpm buildandpnpm test(256 passed) are all green.Linked Issues
Additional context
Reviewers may want to focus on:
attributify (they don't take the group prefix, and the element carried no
matching class):
w-fullinPluginFlowTimeline.vue(rolldown + vite),text-xsinDetailedList.vue(rolldown + vite),p1inDisplayModuleGraph.vue(ui). If those styles were actually intended, theyshould be re-added as standalone classes in a follow-up.
bg="base/10"inModuleFlamegraph.vue/PluginDetailsLoader.vue(vite)never resolved (opacity on a shortcut) and was left in place as-is; it renders
nothing today.
This PR was created with the help of an agent.