From 9d073cf07e412b70014ad41151dcdfe2557591c6 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Tue, 13 Dec 2022 15:51:53 +0800 Subject: [PATCH] Add selectors to block.json schema --- schemas/json/block.json | 98 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/schemas/json/block.json b/schemas/json/block.json index ad3bb45516b9f..f4b8df11690af 100644 --- a/schemas/json/block.json +++ b/schemas/json/block.json @@ -428,6 +428,104 @@ }, "additionalProperties": true }, + "selectors": { + "type": "object", + "description": "Provides custom CSS selectors and mappings for the block. Selectors may be set for the block itself or per-feature e.g. typography.", + "properties": { + "root": { + "type": "string", + "description": "The primary CSS class to apply to the block. This replaces the `.wp-block-name` class if set. " + }, + "border": { + "description": "Custom CSS selector used to generate rules for the block's theme.json border styles.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "root": { "type": "string" }, + "color": { "type": "string" }, + "radius": { "type": "string" }, + "style": { "type": "string" }, + "width": { "type": "string" } + } + } + ] + }, + "color": { + "description": "Custom CSS selector used to generate rules for the block's theme.json color styles.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "root": { "type": "string" }, + "text": { "type": "string" }, + "background": { "type": "string" } + } + } + ] + }, + "dimensions": { + "description": "Custom CSS selector used to generate rules for the block's theme.json dimensions styles.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "root": { "type": "string" }, + "minHeight": { "type": "string" } + } + } + ] + }, + "spacing": { + "description": "Custom CSS selector used to generate rules for the block's theme.json spacing styles.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "root": { "type": "string" }, + "blockGap": { "type": "string" }, + "padding": { "type": "string" }, + "margin": { "type": "string" } + } + } + ] + }, + "typography": { + "description": "Custom CSS selector used to generate rules for the block's theme.json typography styles.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "root": { "type": "string" }, + "fontFamily": { "type": "string" }, + "fontSize": { "type": "string" }, + "fontStyle": { "type": "string" }, + "fontWeight": { "type": "string" }, + "lineHeight": { "type": "string" }, + "letterSpacing": { "type": "string" }, + "textDecoration": { "type": "string" }, + "textTransform": { "type": "string" } + } + } + ] + } + } + }, "styles": { "type": "array", "description": "Block styles can be used to provide alternative styles to block. It works by adding a class name to the block’s wrapper. Using CSS, a theme developer can target the class name for the block style if it is selected.\n\nPlugins and Themes can also register custom block style for existing blocks.\n\nhttps://developer.wordpress.org/block-editor/reference-guides/block-api/block-styles",