-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Section specific Theme.json #40318
Copy link
Copy link
Open
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Block] GroupAffects the Group Block (and row, stack and grid variants)Affects the Group Block (and row, stack and grid variants)[Block] PatternAffects the Patterns BlockAffects the Patterns Block[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Metadata
Metadata
Assignees
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Block] GroupAffects the Group Block (and row, stack and grid variants)Affects the Group Block (and row, stack and grid variants)[Block] PatternAffects the Patterns BlockAffects the Patterns Block[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Part of: #39281
We already allow a block to have the style object of theme.json, but for now, we only accept styles affecting the block itself, not its descendants. E.g., in the group, we can not say the text color of paragraphs nested inside them is X.
We don’t have a settings object, so we can not say the color palette for this section is Y.
This task is about expanding the style shape to support everything theme.json does and a new settings object.
Although the implementation of the settings should be ready to support every setting, I guess we can lock it down at the start to change the color palette and allow to totally disable colors so patterns can provide a more locked experience inside them. I’m not totally sure if we should support every setting so having an initial locked implementation makes sense, and then we can progressively expand what we support and maybe even support everything if we find it makes sense.
There are multiple edge cases, e.g., the theme.json sets a palette specific to the paragraph block, and the section in a pattern sets a palette specific to pattern. A paragraph inside that pattern uses the color palette of the pattern or the global one of the paragraph?
I think the algorithm should be the block uses the closest style/setting specific to that block (first of the pattern than at the global) if there are no block particular values, it uses the closest global value. In the previous sample, it would use the global paragraph color.
In the first version, I expect that we can store styles and settings as just normal block attributes in the HTML comment blob like we do now for styles.
Tasks
Settings:
settingshook #40547Styles:
blockssection to hold and render them, alatheme.json.styleobject, e.g.: we should not store the font size value infontSizeif it's a preset value and instyles.typography,fontSizeif it's a custom value. We should use the style object for everything. Do so without modifying how is serialized (to classes if it's a preset value and as inline styles if it's a custom one).