refactor(theme): move CSS custom property defaults to :root - #357
Merged
ankit-thesys merged 5 commits intoMar 20, 2026
Conversation
Instead of embedding fallback values in every var() call across all component SCSS files, define all --openui-* defaults once in a :root block via a new auto-generated openui-defaults.scss. This produces cleaner compiled CSS, a single source of truth for defaults, and follows the standard CSS custom property pattern where ThemeProvider overrides at body/scoped selectors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
abhithesys
approved these changes
Mar 19, 2026
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.
Summary
--openui-*CSS custom property defaults from inlinevar()fallbacks to a single:rootblock in a new auto-generatedopenui-defaults.scsscssUtils.scssvariables to barevar(--openui-*)without fallbacks:rootdefaults in the bundledcomponents.cssvia@useinindex.scss./defaults.cssfor consumers using individual component CSS importsMotivation
Previously every
var()call in compiled CSS carried an inline fallback value, duplicated across all 50+ component stylesheets. This change::rootdefaults, scoped overrides)body/scoped selectors which naturally cascade over:rootFiles changed
src/scripts/generate-css-utils.tscssUtils.scss(no fallbacks) andopenui-defaults.scss(:rootblock)src/cssUtils.scssvar()callssrc/openui-defaults.scss:root { --openui-*: defaults }src/components/index.scss@use "../openui-defaults.scss"at topsrc/scripts/scss-import.js@usewhen regeneratingcp-css.jsopenui-defaults.csstodist/styles/package.json./defaults.cssexportTest plan
pnpm --filter @openuidev/react-ui buildsucceedsdist/openui-defaults.csscontains:root { --openui-*: ... }dist/components/index.cssstarts with:rootblockvar()without fallbacksdist/styles/openui-defaults.cssexists and is importable🤖 Generated with Claude Code