Skip to content

Commit

Permalink
Add selectors to block.json schema
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw authored and oandregal committed Dec 27, 2022
1 parent eb0e61d commit dc532d5
Showing 1 changed file with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions schemas/json/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,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",
Expand Down

0 comments on commit dc532d5

Please sign in to comment.