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

Expose flattenColorPalette #15318

Merged
merged 4 commits into from
Dec 9, 2024
Merged

Expose flattenColorPalette #15318

merged 4 commits into from
Dec 9, 2024

Conversation

philipp-spiess
Copy link
Member

@philipp-spiess philipp-spiess commented Dec 6, 2024

Resolves #15315

It looks like we implemented this in Core but forgot to expose it from the distributed package (the references are only used for testing plugins internally right now). This exposes flattenColorPalette under the old import path of tailwindcss/lib/util/flattenColorPalette.

Test Plan

Added the following plugin to the Vite example and ensured it works as expected:

import flattenColorPalette from 'tailwindcss/lib/util/flattenColorPalette'
import plugin from 'tailwindcss/plugin'

export default plugin(({ matchUtilities, theme }) => {
  matchUtilities(
    {
      'hover-bg': (value) => {
        return {
          '&:hover': {
            backgroundColor: value,
          },
        }
      },
    },
    { values: flattenColorPalette(theme('colors')) },
  )
})
Screenshot 2024-12-06 at 11 47 44

@philipp-spiess philipp-spiess changed the title Expose flattenColorPalette Expose flattenColorPalette Dec 6, 2024
@philipp-spiess philipp-spiess force-pushed the feat/flattenColorPalette branch from a9bf926 to e69dd35 Compare December 6, 2024 10:48
@philipp-spiess philipp-spiess force-pushed the feat/flattenColorPalette branch from e69dd35 to 8eeaeda Compare December 6, 2024 10:50
@philipp-spiess philipp-spiess marked this pull request as ready for review December 6, 2024 10:50
@philipp-spiess philipp-spiess requested a review from a team as a code owner December 6, 2024 10:50
"./lib/util/flattenColorPalette": {
"require": "./src/compat/flatten-color-palette.cts",
"import": "./src/compat/flatten-color-palette.ts"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

ngl kinda sad we have to export this one but makes sense.

Copy link
Contributor

@thecrypticace thecrypticace left a comment

Choose a reason for hiding this comment

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

Left some notes about stuff but generally looks good

Comment on lines +14 to +16
### Fixed

- Fix dependency related warnings when using `@tailwindcss/postcss` on Windows ([#15321](https://github.com/tailwindlabs/tailwindcss/pull/15321))
Copy link
Member

Choose a reason for hiding this comment

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

Was a bit confused by this one, but makes sense!

Copy link
Member Author

Choose a reason for hiding this comment

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

lol yeah my bad when I merged the other one 😕

@philipp-spiess philipp-spiess merged commit a7ebc9c into next Dec 9, 2024
1 check passed
@philipp-spiess philipp-spiess deleted the feat/flattenColorPalette branch December 9, 2024 10:33
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.

Trying to upgrade a plugin to v4
3 participants