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

Utilize the new selectors API for duotone #49342

Open
ajlende opened this issue Mar 24, 2023 · 1 comment
Open

Utilize the new selectors API for duotone #49342

ajlende opened this issue Mar 24, 2023 · 1 comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality [Type] Enhancement A suggestion for improvement.

Comments

@ajlende
Copy link
Contributor

ajlende commented Mar 24, 2023

Duotone filter support has been added in block.json under the supports.color.__experimentalDuotone since it was introduced. It was marked as experimental because it required a special selector different from the supports.color.__experimentalSelector.

With the selectors API stabilized in #46496, the duotone supports can now utilize it.

Duotone filters were initially added under color support when they were only part of block supports and theme.json presets. Then, when global styles support was added, that functionality was nested under filter instead. #34667 (comment)

I lean towards styles.filters.duotone conceptually even if we were to have settings.color.palette.duotone for a palette definition it’s conceivable duotone palettes could be used for more than duotone filters either as gradient backgrounds or masks or something else

The new stabilized duotone block supports should be nested under filter following that reasoning.

Two changes to block.json (including the schema) are required:

  1. Add a boolean block support under supports.filter.duotone that enables/disables the feature. It was previously handled by supports.color.__experimentalDuotone being set to true to use the default block selector or supports.__experimentalSelector or set to a string if a custom selector was needed.
  2. Add selectors.filter.duotone that specifies the custom selector previously nested under supports.color.__experimentalDuotone for the case mentioned in 1.

Duotone uses the block.json metadata directly, unlike some of the other supports. And there were special cases added for __experimentalDuotone throughout the code. So anywhere that was using that should provide an upgrade path by providing a migration or continuing to support it if a migration isn't possible.

@ajlende ajlende added the [Type] Code Quality Issues or PRs that relate to code quality label Mar 24, 2023
@aaronrobertshaw
Copy link
Contributor

There was a PR created last week that begins updating Duotone to use the new Selectors API (#49325).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Code Quality Issues or PRs that relate to code quality [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants