Skip to content

refactor(css): wrap styles.css rules into @layer base + components (Round A, #253) - #257

Merged
likun666661 merged 1 commit into
apache:mainfrom
somewan820:css-round-a-layer-components
Jun 25, 2026
Merged

refactor(css): wrap styles.css rules into @layer base + components (Round A, #253)#257
likun666661 merged 1 commit into
apache:mainfrom
somewan820:css-round-a-layer-components

Conversation

@somewan820

Copy link
Copy Markdown
Contributor

Wrap global resets (body, scrollbars, button reset, sr-only, reduced-motion, visual-smoke) into @layer base, and all component rules into @layer components, aligning with maka-tokens.css which already declares the same three layers (base / utilities / components).

This is the prerequisite for later rounds: unlayered styles.css had higher priority than any @layer, so 47 !important declarations were cascade hacks. With components-layered rules, tailwind utilities now override components by layer order, removing the need for most of those hacks (actual !important removal is Round H).

No rule, selector, property, or !important is changed — pure structural wrapping. Verified: comment balance 300/300, brace balance 1901/1901, lightningcss parse VALID.

Part of issue #253 Round A.

…ound A, apache#253)
Wrap global resets (body, scrollbars, button reset, sr-only,
reduced-motion, visual-smoke) into @layer base, and all component
rules into @layer components, aligning with maka-tokens.css which
already declares the same three layers (base / utilities / components).
This is the prerequisite for later rounds: unlayered styles.css had
higher priority than any @layer, so 47 !important declarations were
cascade hacks. With components-layered rules, tailwind utilities now
override components by layer order, removing the need for most of
those hacks (actual !important removal is Round H).
No rule, selector, property, or !important is changed — pure
structural wrapping. Verified: comment balance 300/300, brace
balance 1901/1901, lightningcss parse VALID.
Part of issue apache#253 Round A.
@likun666661
likun666661 merged commit cbdf108 into apache:mainJun 25, 2026
Astro-Han added a commit that referenced this pull request Jun 25, 2026
…260)
* Revert "refactor(css): wrap styles.css rules into @layer base + components (Round A, #253) (#257)"
This reverts commit cbdf108.
#257 wrapped styles.css component rules into @layer base/components. Tailwind v4 orders the cascade base, components, utilities, so layered rules lose to utilities. The sidebar nav rows render as <UiButton size="nav" className="maka-nav-row">; the cva button base always carries inline-flex items-center justify-center utilities, and .maka-nav-row (display: grid + text-align: left) only overrode them while it stayed unlayered. Layered, it lost — collapsing every sidebar button (nav rows, session rows, settings) to flex-centered content for users whose sidebar is wide enough to show the gap.
Restore the unlayered cascade. The Round A cleanup needs a different approach (overrides must sit above utilities) before it can re-land.
* test(styles): guard .maka-nav-row stays unlayered so it beats Tailwind button utilities
Regression lock for #257: a node:test contract that fails if .maka-nav-row is nested in any @layer in styles.css (which would let the cva button base's inline-flex/justify-center utilities win and re-center the sidebar). Red on cbdf108, green after the revert.
Sign up for freeto 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

@somewan820@likun666661