Skip to content
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

[feature] Implement useTheme processor #94

Closed
wants to merge 1 commit into from

Conversation

brijeshb42
Copy link
Contributor

@brijeshb42 brijeshb42 commented May 20, 2024

to replace the useTheme function calls with an import from Pigment package.
Also re-export RtlProvider from @mui/system.

Fixes mui/material-ui#42260

There will be a follow-up PR to implement the runtime part from a generated source at build-time.

@brijeshb42 brijeshb42 added the new feature New feature or request label May 20, 2024
@brijeshb42 brijeshb42 changed the title [core] Implement useTheme processor [feature] Implement useTheme processor May 20, 2024
to replace the useTheme function calls with an import from Pigment
package
@@ -0,0 +1,117 @@
import { useTheme as _useTheme } from '@pigment-css/react';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the runtime useTheme?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the main PR now - #105

See the description.


export type TemplateCallback = (params: Record<string, unknown> | undefined) => string | number;

export class UseThemeProcessor extends BaseProcessor {
Copy link
Member

@siriwatknp siriwatknp May 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that we were going with option B (babel plugin instead of tagProcessor) from https://www.notion.so/mui-org/material-ui-pigment-non-processor-replacement-0c7e4b150c90499b93cd8fc17c31a009?pvs=4

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realised that tagProcessor handles all the different kinds of imports that we can have, ie,

import * as lib from 'lib';
import {useTheme} from 'lib';
require('lib')
interopRequire(require('lib'));

Doing it ourselves might miss something especially for library code where most of the code is transpiled.

@brijeshb42
Copy link
Contributor Author

Closing in favor or #105

@brijeshb42 brijeshb42 closed this May 28, 2024
@brijeshb42 brijeshb42 deleted the core/use-theme branch May 28, 2024 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[material-ui][pigment-css] useTheme integration
2 participants