Skip to content
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

theme.json schema: fix styles.background definition #59595

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions docs/reference-guides/theme-json-reference/theme-json-living.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,19 +204,6 @@ Generate custom CSS custom properties of the form `--wp--custom--{key}--{nested-
## Styles


### background

Background styles

| Property | Type | Props |
| --- | --- |--- |
| backgroundImage | string, object | |
| backgroundPosition | string, object | |
| backgroundRepeat | string, object | |
| backgroundSize | string, object | |

---

Comment on lines -207 to -219
Copy link
Contributor Author

@t-hamano t-hamano Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, if we update the JSON schema correctly, the background section will be missing from the documentation 😅 This is because the script that generates the documentation relies only on stylesProperties and does not consider which level the properties are available.

We may need to make major changes to the logic of the script, or the overall design of the JSON schema, to ensure that it also generates the documentation correctly.

Personally, I think it's better not to have a background property at this point, because if there is a background property in the document, there is a risk of misunderstanding that this property is available at all levels.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Thanks for noticing this detail!

### border

Border styles.
Expand Down
136 changes: 68 additions & 68 deletions schemas/json/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -1110,74 +1110,6 @@
"stylesProperties": {
"type": "object",
"properties": {
"background": {
"description": "Background styles",
"type": "object",
"properties": {
"backgroundImage": {
"description": "Sets the `background-image` CSS property.",
"oneOf": [
{
"description": "A valid CSS value for the background-image property.",
"type": "string"
},
{
"type": "object",
"properties": {
"source": {
"description": "The origin of the image. 'file' denotes that the 'url' is a path to an image or other file.",
"type": "string",
"enum": [ "file" ],
"default": "file"
},
"url": {
"description": "A URL to an image file.",
"type": "string"
}
},
"additionalProperties": false
},
{
"$ref": "#/definitions/refComplete"
}
]
},
"backgroundPosition": {
"description": "Sets the `background-position` CSS property.",
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/refComplete"
}
]
},
"backgroundRepeat": {
"description": "Sets the `background-repeat` CSS property.",
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/refComplete"
}
]
},
"backgroundSize": {
"description": "Sets the `background-size` CSS property.",
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/refComplete"
}
]
}
},
"additionalProperties": false
},
"border": {
"description": "Border styles.",
"type": "object",
Expand Down Expand Up @@ -2365,6 +2297,74 @@
"blocks": {
"description": "Styles defined on a per-block basis using the block's selector.",
"$ref": "#/definitions/stylesBlocksPropertiesComplete"
},
"background": {
"description": "Background styles.",
"type": "object",
"properties": {
"backgroundImage": {
"description": "Sets the `background-image` CSS property.",
"oneOf": [
{
"description": "A valid CSS value for the background-image property.",
"type": "string"
},
{
"type": "object",
"properties": {
"source": {
"description": "The origin of the image. 'file' denotes that the 'url' is a path to an image or other file.",
"type": "string",
"enum": [ "file" ],
"default": "file"
},
"url": {
"description": "A URL to an image file.",
"type": "string"
}
},
"additionalProperties": false
},
{
"$ref": "#/definitions/refComplete"
}
]
},
"backgroundPosition": {
"description": "Sets the `background-position` CSS property.",
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/refComplete"
}
]
},
"backgroundRepeat": {
"description": "Sets the `background-repeat` CSS property.",
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/refComplete"
}
]
},
"backgroundSize": {
"description": "Sets the `background-size` CSS property.",
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/refComplete"
}
]
}
},
"additionalProperties": false
}
},
"additionalProperties": false
Expand Down
Loading