Skip to content

Put components into an extra layer when using the legacy JS API #17918

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

Closed
wants to merge 1 commit into from

Conversation

philipp-spiess
Copy link
Member

@philipp-spiess philipp-spiess commented May 7, 2025

This PR changes the way how legacy JS addComponents() and matchComponents() CSS is handled. In v3, these were conceptually added to the @layer components so that each utility defined in @layer utility is able to overwrite it.

In order to improve backwards compatibility, this PR tries to recreate the same behavior by relying on layer nesting. This means that as far as core is concerned, there is still only one utility layer, however utilities added via these APIs will now create a nested @layer components. Since all utilities that are in the @layer utilities alone will have have a higher presedenc than the components defined in @layer utilities.components, this will emulate the legacy behavior.

Test plan

  • Added unit tests
  • Added a UI test to ensure the layers are resolved correctly

@philipp-spiess philipp-spiess force-pushed the feat/add-components-should-be-layered branch from f2701fa to a01c866 Compare May 7, 2025 16:32
@philipp-spiess philipp-spiess force-pushed the feat/add-components-should-be-layered branch from a01c866 to 56c3b68 Compare May 7, 2025 16:36
@philipp-spiess
Copy link
Member Author

This approach has several issues:

Another "quick fix" that was considered is to use the --tw-sort property but even that isn't working unfortunately due to that screwing up the order then. Seems like the only way to properly fix is is to require additional core changes.

Sign up for free to 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.

1 participant