-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add duotone theme.json styles support #34667
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
bbdd7ab
Add duotone theme.json styles support
ajlende 5ec2efe
Add support for generating duotone CSS variables
ajlende 3c0a97e
Add value_func and value_args metadata to compute duotone
ajlende ec86c0b
Update phpunit tests
ajlende 358c456
Fix duotone filter id on css variables
ajlende 8c421cc
Exmplain why !important is needed
ajlende e9abc0b
Fix get_settings_values_by_slug example
ajlende cebab75
Add color.duotone to PATHS_WITH_MERGE
ajlende 5956f18
Rename $meta to $preset_meta to be more descriptive
ajlende c15c1cf
Render duotone styles when settings are disabled
ajlende 3c2c166
Improve mechanism to declare a selector for the property
oandregal 220d86d
Revert "Improve mechanism to declare a selector for the property"
oandregal a0134b1
Merge branch 'trunk' into add/duotone-theme-json-styles
ajlende 537d608
duotone-filter to just duotone css var infix
ajlende 23cd929
Merge branch 'trunk' into add/duotone-theme-json-styles
ajlende 775717e
Revert duotone SVG to be inside the footer
ajlende 2a6a7e8
Simplify value_func args
ajlende c147b04
Additionally strip multiple spaces in SVG
ajlende e31fa8e
Improve code quality and inline docs
ajlende 8aaa12f
Fix value_func after rename
ajlende c793a69
Improve inline docs
ajlende df50ef0
Update duotone-filter -> duotone for generated ids
ajlende 53b154b
Rename preset_meta -> preset_metadata
ajlende 008c5d5
Move duotone styles from color -> filter
ajlende File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be safe to add specificity by prepending this with
.wp-site-blocks
instead of using!important
? Can I count on having that as a container? Is it weird to usebody
instead of that class if it's not available?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can rely on
.wp-site-blocks
, but i do wonder if this is a valid use of!important
- since this is a setting on an individual block, I think it should always take precedence over other CSS.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was mention of a similar situation for elements block supports in the #core-editor Slack today.
The linked issue is #33437 and there's a fix by removing
!important
in #34689. That issue is caused by the cascade and because sometimes buttons, that we want to style differently, use the<a>
tag.The filter property doesn't cascade the same way, so we're probably fine here. But the elements block supports goes to show that just because we're setting an individual block,
!important
still might not be safe to use.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific need for the duotone filters to be enqueued before the global styles?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, if we can make it work without the
!important
is nice.The issue with #33437 was that
.wp-element-* a
targeted anya
element in a container (group with paragraph with link + button + social link blocks). So the issue was about how unspecific the selector was. Which makes me think: is it possible that the container with the.wp-duotone-ID
has an image with duotone and another without it? I'm just not familiar with all the blocks this can affect to. I can't think of any off the top of my head.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More context about where we use
!important
: we use it in the preset classes, such as.has-{value}-color
to make sure the user selection is respected despite its low specificity. More context #29533In the case of the link color, it was probably too much due to the wide reach of the selector and side-effects. We're reverting it in this case if the current PR seems solid.