-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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.jsonNeeds Dev NoteRequires a developer note for a major WordPress release cycleRequires a developer note for a major WordPress release cycle[Feature] Block APIAPI that allows to express the block paradigm.API that allows to express the block paradigm.[Type] Code QualityIssues or PRs that relate to code qualityIssues or PRs that relate to code quality[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Description
This issue tracks the current state of theme.json
related APIs from a quality point of view, so we can bring up, discuss and address the issues.
WordPress 6.2: shipped
Public API:
Performance:
wp_theme_has_theme_json
: cache output #45543wp_get_global_settings
: cache output #45372 #45971 #45969wp_get_global_stylesheet
: migrate from transient to object cache #45679wp_get_global_styles_svg_filters
: migrate from transient to object cache #47460 (done in core as the function was removed from Gutenberg)- While initially the cache was implemented as persistent across requests for the above methods, concerns were brought up to make it non-persistent and keep testing: #46150
Sync WordPress core <=> Gutenberg:
- Try: bundle
WP_Theme_JSON
class instead of inheriting per WordPress version #46579 - Try: bundle the
WP_Theme_JSON_Resolver
class instead of inheriting per WordPress version #46750
WordPress 6.3: shipped
Public API
- Add
gutenberg_get_remote_theme_patterns
function #49307 block.json
API: consider graduating__experimentalSelector
and__experimentalDuotone
from experimental to stable #45194wp_get_global_styles
: for custom props, it should return the CSS format not the shortened internal one #49693wp_get_global_styles
: return values instead of CSS Custom Properties #49712
WordPress 6.4: ongoing
Performance:
get_root_layout_rules
: remove unnecessary call tosanitize_title
#53568- Compute presets from
theme.json
: skip those without classes or variables #53574 - Font Face API: use
gutenberg_get_global_settings
instead of private API #53805 - Optimize
compute_style_properties
by reducing the number of iterations it performs #51983 - Try/improve get stylesheet performance #53351
- webfonts handler: use
wp_get_global_settings
instead of private API wordpress-develop#4980 - Try: reduce number of
WP_Theme_JSON
instances #53357 - Try:
get_style_nodes
: only return those that will be used #53575
Public API
- Add
wp_get_theme_data_template_parts
: create public API to accesstemplateParts
fromtheme.json
wordpress-develop#4971 - Add
wp_get_theme_data_custom_templates
wordpress-develop#5031
Next
Algorithm:
Public API:
- Make sure all current uses cases of
WP_Theme_JSON
orWP_Theme_JSON_Resolver
are covered by the addition of public methods. - Collocate
customTemplates
andtemplateAreas
metadata with the actual data they represent (templates and template parts provided by the theme asHTML
) and remove them fromtheme.json
. #42732 In testing #38984 we ran into an issue with valid HTML comments that don't belong to a block #47212 - Deprecate/Remove the
wp_theme_json_get_style_nodes
filter #45172 Filters, together with methods or thetheme.json
datum, are all part of the public API. We should aim to not expose private implementation details in the public API that prevent us from evolving it. wp_get_global_styles
: resolver the reference to the value #49715
Performance
- Make theme.json caches persistent across requests: Control whether theme (e.g.
theme.json
) cache usage is enabled through a dedicated function #45912 wp_get_global_styles
: add object cache.- Try caching stylesheets generated for the editor https://github.com/WordPress/gutenberg/pull/45679/files#r1024084613
wp_add_global_styles_for_blocks
: review status.- Styles generation: there are two points for styles,
get_stylesheet
(renders the top-level styles) andget_styles_for_block
(renders the block-level styles). Potential optimizations:- top-level styles: remove any operation that is not relevant for top-level.
- block-level styles: look for ways to only process the
theme.json
nodes of the blocks in use. At the moment all are processed (seewp_add_global_styles_for_blocks
), though only the blocks in use get enqueued.
mcsf, ockham, annezazu and tyxla
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.jsonNeeds Dev NoteRequires a developer note for a major WordPress release cycleRequires a developer note for a major WordPress release cycle[Feature] Block APIAPI that allows to express the block paradigm.API that allows to express the block paradigm.[Type] Code QualityIssues or PRs that relate to code qualityIssues or PRs that relate to code quality[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.