-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pigment-css] theme does not contain other properties except vars
#130
Comments
This can be limited to exposing |
There's API to remove properties based on developers' decision. |
I think that's the developer/lib decision. I'm talking about Pigment CSS should not concern and limit the theme structure (except some special method that Pigment CSS is looking for, e.g. I think Pigment CSS should not "iterate over the whole theme object" but maybe call a method (e.g. diff --git a/packages/pigment-css-react/src/utils/generateCss.ts b/packages/pigment-css-react/src/utils/generateCss.ts
index 9920373613..3464f00061 100644
--- a/packages/pigment-css-react/src/utils/generateCss.ts
+++ b/packages/pigment-css-react/src/utils/generateCss.ts
@@ -11,11 +11,5 @@ export function generateThemeTokens(theme: Theme) {
if (!theme || typeof theme !== 'object') {
return {};
}
- // is created using extendTheme
- if ('vars' in theme && theme.vars) {
- return {
- vars: theme.vars,
- };
- }
- return {};
+ return theme.toRuntime?.() || {};
}
I meant for the whole theme, not just |
Related to mui/material-ui#43443. |
Summary
import theme from '@pigment-css/react/theme'
should return the configured theme passed to the Pigment config by default without altering or removing any keys.Pigment CSS should not optimize the theme by default, instead provide docs and API to remove properties based on developers' decision.
Examples
No response
Motivation
I have this issue while migrating Material UI components but the idea applies to others in general.
Some Material UI components use
useTheme()
to get values from the theme, e.g. the Dialog:To support Pigment CSS, a
useTheme
can be exported from Pigment CSS with simple implementation like:Search keywords: pigment theme
Search keywords:
The text was updated successfully, but these errors were encountered: