From 752310de567b429bc76ca80a2105230ea21568e9 Mon Sep 17 00:00:00 2001 From: Carlos Bravo Date: Tue, 30 May 2023 18:33:36 +0200 Subject: [PATCH 01/18] Initial commit --- schemas/json/theme.json | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/schemas/json/theme.json b/schemas/json/theme.json index 7f0e712283b60..b25386a0acf57 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -801,7 +801,14 @@ "$ref": "#/definitions/settingsPropertiesComplete" }, "core/image": { - "$ref": "#/definitions/settingsPropertiesComplete" + "$ref": "#/definitions/settingsPropertiesComplete", + "behaviors": { + "lightbox": { + "description": "Allow users to open the image in a lightbox.", + "type": "boolean", + "default": true + } + } }, "core/latest-comments": { "$ref": "#/definitions/settingsPropertiesComplete" @@ -2069,6 +2076,21 @@ "type": "string", "description": "Description of the global styles variation." }, + "behaviors": { + "type": "object", + "description": "Behaviors for individual blocks. Define if the Behaviors UI should appear in the block inspector.", + "properties": { + "blocks": { + "core/image": { + "lightbox": { + "type": "boolean", + "description": "Whether the lightbox should be enabled for the image block.", + "default": true + } + } + } + } + }, "settings": { "description": "Settings for the block editor and individual blocks. These include things like:\n- Which customization options should be available to the user. \n- The default colors, font sizes... available to the user. \n- CSS custom properties and class names used in styles.\n- And the default layout of the editor (widths and available alignments).", "type": "object", From 612dd0fd9b986f6a86353226027083d8bd1e7a09 Mon Sep 17 00:00:00 2001 From: Carlos Bravo Date: Thu, 1 Jun 2023 10:54:51 +0200 Subject: [PATCH 02/18] Commit to check CI schema validation --- schemas/json/theme.json | 43 ++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/schemas/json/theme.json b/schemas/json/theme.json index b25386a0acf57..40eb2f44c8fd1 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -801,14 +801,26 @@ "$ref": "#/definitions/settingsPropertiesComplete" }, "core/image": { - "$ref": "#/definitions/settingsPropertiesComplete", - "behaviors": { - "lightbox": { - "description": "Allow users to open the image in a lightbox.", - "type": "boolean", - "default": true + "type": "object", + "allOf": [ + { "$ref": "#/definitions/settingsPropertiesComplete" }, + { + "type": "object", + "properties": { + "behaviors": { + "description": "Settings related to behaviors.", + "type": "object", + "properties": { + "lightbox": { + "description": "Allow users to control lightbox.", + "type": "boolean", + "default": false + } + } + } + } } - } + ] }, "core/latest-comments": { "$ref": "#/definitions/settingsPropertiesComplete" @@ -2077,15 +2089,20 @@ "description": "Description of the global styles variation." }, "behaviors": { + "description": "Behaviors for individual blocks.", "type": "object", - "description": "Behaviors for individual blocks. Define if the Behaviors UI should appear in the block inspector.", "properties": { "blocks": { - "core/image": { - "lightbox": { - "type": "boolean", - "description": "Whether the lightbox should be enabled for the image block.", - "default": true + "type": "object", + "properties": { + "core/image": { + "type": "object", + "properties": { + "lightbox": { + "type": "boolean", + "description": "Whether to enable the lightbox feature." + } + } } } } From dba075fed57328663bbbbdc2f6b58aa2cd48913b Mon Sep 17 00:00:00 2001 From: Carlos Bravo Date: Thu, 1 Jun 2023 13:21:52 +0200 Subject: [PATCH 03/18] Improve descriptions --- schemas/json/theme.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/schemas/json/theme.json b/schemas/json/theme.json index 40eb2f44c8fd1..d2e34b29a22d0 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -808,7 +808,7 @@ "type": "object", "properties": { "behaviors": { - "description": "Settings related to behaviors.", + "description": "Array of behaviors applied to the image block.", "type": "object", "properties": { "lightbox": { @@ -2089,7 +2089,7 @@ "description": "Description of the global styles variation." }, "behaviors": { - "description": "Behaviors for individual blocks.", + "description": "An array of blocks that have behaviors included. Behaviors are also defined here.", "type": "object", "properties": { "blocks": { @@ -2100,7 +2100,7 @@ "properties": { "lightbox": { "type": "boolean", - "description": "Whether to enable the lightbox feature." + "description": "Whether to show the lightbox behavior UI in the block sidebar." } } } From dbe36285d418d62f38a2935bbd82171384636850 Mon Sep 17 00:00:00 2001 From: Carlos Bravo Date: Tue, 6 Jun 2023 16:54:45 +0200 Subject: [PATCH 04/18] Correct schema version --- schemas/json/theme.json | 71 ++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/schemas/json/theme.json b/schemas/json/theme.json index d2e34b29a22d0..b06037987a611 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -7,6 +7,24 @@ "createTheme": "https://developer.wordpress.org/block-editor/how-to-guides/themes/create-block-theme/", "reference": "https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-json/" }, + "behaviorsBlocksPropertiesComplete": { + "type": "object", + "properties": { + "behaviors": { + "description": "List of behaviors applied to the image block.", + "type": "object", + "properties": { + "lightbox": { + "description": "Allow users to control lightbox.", + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, "refComplete": { "type": "object", "properties": { @@ -649,9 +667,27 @@ } } }, + "settingsPropertiesBehaviors": { + "type": "object", + "properties": { + "behaviors": { + "description": "Settings related to behaviors.", + "type": "object", + "properties": { + "lightbox": { + "description": "Allow users to enable/disable lightbox.", + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + } + }, "settingsProperties": { "allOf": [ { "$ref": "#/definitions/settingsPropertiesAppearanceTools" }, + { "$ref": "#/definitions/settingsPropertiesBehaviors" }, { "$ref": "#/definitions/settingsPropertiesBorder" }, { "$ref": "#/definitions/settingsPropertiesColor" }, { "$ref": "#/definitions/settingsPropertiesDimensions" }, @@ -672,6 +708,7 @@ { "properties": { "appearanceTools": {}, + "behaviors": {}, "border": {}, "color": {}, "dimensions": {}, @@ -801,26 +838,7 @@ "$ref": "#/definitions/settingsPropertiesComplete" }, "core/image": { - "type": "object", - "allOf": [ - { "$ref": "#/definitions/settingsPropertiesComplete" }, - { - "type": "object", - "properties": { - "behaviors": { - "description": "Array of behaviors applied to the image block.", - "type": "object", - "properties": { - "lightbox": { - "description": "Allow users to control lightbox.", - "type": "boolean", - "default": false - } - } - } - } - } - ] + "$ref": "#/definitions/settingsPropertiesComplete" }, "core/latest-comments": { "$ref": "#/definitions/settingsPropertiesComplete" @@ -2089,22 +2107,17 @@ "description": "Description of the global styles variation." }, "behaviors": { - "description": "An array of blocks that have behaviors included. Behaviors are also defined here.", + "description": "A list of blocks that have behaviors. These setting controls the display of the behaviors UI in the block editor.", "type": "object", "properties": { "blocks": { "type": "object", "properties": { "core/image": { - "type": "object", - "properties": { - "lightbox": { - "type": "boolean", - "description": "Whether to show the lightbox behavior UI in the block sidebar." - } - } + "$ref": "#/definitions/behaviorsBlocksPropertiesComplete" } - } + }, + "additionalProperties": false } } }, From f8a55553b06547864068c554773bf4d2f939c5a3 Mon Sep 17 00:00:00 2001 From: Carlos Bravo Date: Tue, 6 Jun 2023 17:09:52 +0200 Subject: [PATCH 05/18] Improve description --- schemas/json/theme.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/json/theme.json b/schemas/json/theme.json index b06037987a611..71f1b1faa3e35 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -11,7 +11,7 @@ "type": "object", "properties": { "behaviors": { - "description": "List of behaviors applied to the image block.", + "description": "List of behaviors applied to each individual block.", "type": "object", "properties": { "lightbox": { From 09b3005a71c718c4743e1b01332fa5efe9e66e74 Mon Sep 17 00:00:00 2001 From: Carlos Bravo Date: Wed, 7 Jun 2023 00:34:34 +0200 Subject: [PATCH 06/18] Update theme.json schema --- .../theme-json-reference/theme-json-living.md | 10 ++++++++++ lib/theme.json | 1 + schemas/json/theme.json | 15 ++++----------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/docs/reference-guides/theme-json-reference/theme-json-living.md b/docs/reference-guides/theme-json-reference/theme-json-living.md index a2e88320cf58b..da08b4fe9eac1 100644 --- a/docs/reference-guides/theme-json-reference/theme-json-living.md +++ b/docs/reference-guides/theme-json-reference/theme-json-living.md @@ -171,6 +171,16 @@ Settings related to typography. Generate custom CSS custom properties of the form `--wp--custom--{key}--{nested-key}: {value};`. `camelCased` keys are transformed to `kebab-case` as to follow the CSS property naming schema. Keys at different depth levels are separated by `--`, so keys should not include `--` in the name. +--- + +### behaviors + +Settings related to behaviors. + +| Property | Type | Default | Props | +| --- | --- | --- |--- | +| lightbox | boolean | false | | + --- ## Styles diff --git a/lib/theme.json b/lib/theme.json index 5c64526b1a253..ca9e63431a073 100644 --- a/lib/theme.json +++ b/lib/theme.json @@ -1,5 +1,6 @@ { "version": 2, + "$schema": "file:/Users/carlosbravo/repos/gutenberg/schemas/json/theme.json", "behaviors": { "blocks": { "core/image": { diff --git a/schemas/json/theme.json b/schemas/json/theme.json index 71f1b1faa3e35..400041ee028a6 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -10,17 +10,10 @@ "behaviorsBlocksPropertiesComplete": { "type": "object", "properties": { - "behaviors": { - "description": "List of behaviors applied to each individual block.", - "type": "object", - "properties": { - "lightbox": { - "description": "Allow users to control lightbox.", - "type": "boolean", - "default": false - } - }, - "additionalProperties": false + "lightbox": { + "description": "Allow users to control lightbox.", + "type": "boolean", + "default": false } }, "additionalProperties": false From a9e379f4a42ee9eafdd82a4b564f1e321d1f48fb Mon Sep 17 00:00:00 2001 From: Carlos Bravo Date: Thu, 8 Jun 2023 12:50:08 +0300 Subject: [PATCH 07/18] Remove local link --- lib/theme.json | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/theme.json b/lib/theme.json index ca9e63431a073..5c64526b1a253 100644 --- a/lib/theme.json +++ b/lib/theme.json @@ -1,6 +1,5 @@ { "version": 2, - "$schema": "file:/Users/carlosbravo/repos/gutenberg/schemas/json/theme.json", "behaviors": { "blocks": { "core/image": { From 232dc4f89b9cb8cd307bc91fbf2de1e4ef251951 Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Thu, 6 Jul 2023 18:06:05 +0100 Subject: [PATCH 08/18] Remove the (now unnecessary) behaviors schemas for the settings. --- schemas/json/theme.json | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/schemas/json/theme.json b/schemas/json/theme.json index 400041ee028a6..665b44a4d02c6 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -660,27 +660,9 @@ } } }, - "settingsPropertiesBehaviors": { - "type": "object", - "properties": { - "behaviors": { - "description": "Settings related to behaviors.", - "type": "object", - "properties": { - "lightbox": { - "description": "Allow users to enable/disable lightbox.", - "type": "boolean", - "default": false - } - }, - "additionalProperties": false - } - } - }, "settingsProperties": { "allOf": [ { "$ref": "#/definitions/settingsPropertiesAppearanceTools" }, - { "$ref": "#/definitions/settingsPropertiesBehaviors" }, { "$ref": "#/definitions/settingsPropertiesBorder" }, { "$ref": "#/definitions/settingsPropertiesColor" }, { "$ref": "#/definitions/settingsPropertiesDimensions" }, @@ -701,7 +683,6 @@ { "properties": { "appearanceTools": {}, - "behaviors": {}, "border": {}, "color": {}, "dimensions": {}, From a9c44057a9102c7ab3086b4bfd0802b59eef448f Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Thu, 6 Jul 2023 18:09:43 +0100 Subject: [PATCH 09/18] Add the types for lightbox animation --- schemas/json/theme.json | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/schemas/json/theme.json b/schemas/json/theme.json index 665b44a4d02c6..bdf9a582e9471 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -12,8 +12,19 @@ "properties": { "lightbox": { "description": "Allow users to control lightbox.", - "type": "boolean", - "default": false + "type": "object", + "properties": { + "enabled": { + "description": "Allow users to enable lightbox.", + "type": "boolean", + "default": false + }, + "animation": { + "description": "Allow users to set lightbox animation.", + "type": "string", + "enum": [ "fade", "zoom" ] + } + } } }, "additionalProperties": false From 21a344ccfd509422da2672bee36b5285b512fdc9 Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Thu, 6 Jul 2023 19:29:14 +0100 Subject: [PATCH 10/18] Add an allowed empty value for animation --- schemas/json/theme.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/json/theme.json b/schemas/json/theme.json index bdf9a582e9471..fb545d972c939 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -22,7 +22,7 @@ "animation": { "description": "Allow users to set lightbox animation.", "type": "string", - "enum": [ "fade", "zoom" ] + "enum": [ "fade", "zoom", "" ] } } } From 6ca3a129baeea090609ba1a490be532515ce6670 Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Thu, 6 Jul 2023 19:33:01 +0100 Subject: [PATCH 11/18] Prohibit additional properties from behaviorsBlocksPropertiesComplete --- schemas/json/theme.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/schemas/json/theme.json b/schemas/json/theme.json index fb545d972c939..e8a5057d8dbc1 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -24,7 +24,8 @@ "type": "string", "enum": [ "fade", "zoom", "" ] } - } + }, + "additionalProperties": false } }, "additionalProperties": false From b2d4d63fd154ad4af4e61a709dec24d32df8d679 Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Thu, 6 Jul 2023 19:33:17 +0100 Subject: [PATCH 12/18] Revert "Remove the (now unnecessary) behaviors schemas for the settings." This reverts commit 232dc4f89b9cb8cd307bc91fbf2de1e4ef251951. --- schemas/json/theme.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/schemas/json/theme.json b/schemas/json/theme.json index e8a5057d8dbc1..139e09d5c241c 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -672,9 +672,27 @@ } } }, + "settingsPropertiesBehaviors": { + "type": "object", + "properties": { + "behaviors": { + "description": "Settings related to behaviors.", + "type": "object", + "properties": { + "lightbox": { + "description": "Allow users to enable/disable lightbox.", + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + } + }, "settingsProperties": { "allOf": [ { "$ref": "#/definitions/settingsPropertiesAppearanceTools" }, + { "$ref": "#/definitions/settingsPropertiesBehaviors" }, { "$ref": "#/definitions/settingsPropertiesBorder" }, { "$ref": "#/definitions/settingsPropertiesColor" }, { "$ref": "#/definitions/settingsPropertiesDimensions" }, @@ -695,6 +713,7 @@ { "properties": { "appearanceTools": {}, + "behaviors": {}, "border": {}, "color": {}, "dimensions": {}, From 39bcbbbd4d472e1eaa08aaf923bf6cf1a5404976 Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Thu, 6 Jul 2023 19:34:58 +0100 Subject: [PATCH 13/18] Revert "Revert "Remove the (now unnecessary) behaviors schemas for the settings."" This reverts commit b2d4d63fd154ad4af4e61a709dec24d32df8d679. --- schemas/json/theme.json | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/schemas/json/theme.json b/schemas/json/theme.json index 139e09d5c241c..e8a5057d8dbc1 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -672,27 +672,9 @@ } } }, - "settingsPropertiesBehaviors": { - "type": "object", - "properties": { - "behaviors": { - "description": "Settings related to behaviors.", - "type": "object", - "properties": { - "lightbox": { - "description": "Allow users to enable/disable lightbox.", - "type": "boolean", - "default": false - } - }, - "additionalProperties": false - } - } - }, "settingsProperties": { "allOf": [ { "$ref": "#/definitions/settingsPropertiesAppearanceTools" }, - { "$ref": "#/definitions/settingsPropertiesBehaviors" }, { "$ref": "#/definitions/settingsPropertiesBorder" }, { "$ref": "#/definitions/settingsPropertiesColor" }, { "$ref": "#/definitions/settingsPropertiesDimensions" }, @@ -713,7 +695,6 @@ { "properties": { "appearanceTools": {}, - "behaviors": {}, "border": {}, "color": {}, "dimensions": {}, From 94eeca1dd6f6e360ab27ec8a81dea6497c6a2bb4 Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Thu, 6 Jul 2023 19:35:44 +0100 Subject: [PATCH 14/18] Remove the settings from `lib/theme.json` --- lib/theme.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/theme.json b/lib/theme.json index 5c64526b1a253..31256b91ca9d1 100644 --- a/lib/theme.json +++ b/lib/theme.json @@ -290,11 +290,6 @@ "style": true, "width": true } - }, - "core/image": { - "behaviors": { - "lightbox": true - } } } }, From cc2c764ebab47169c17c68e4353d06be1e484cfa Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Thu, 6 Jul 2023 20:00:46 +0100 Subject: [PATCH 15/18] Revert "Revert "Revert "Remove the (now unnecessary) behaviors schemas for the settings.""" This reverts commit 39bcbbbd4d472e1eaa08aaf923bf6cf1a5404976. --- schemas/json/theme.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/schemas/json/theme.json b/schemas/json/theme.json index e8a5057d8dbc1..139e09d5c241c 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -672,9 +672,27 @@ } } }, + "settingsPropertiesBehaviors": { + "type": "object", + "properties": { + "behaviors": { + "description": "Settings related to behaviors.", + "type": "object", + "properties": { + "lightbox": { + "description": "Allow users to enable/disable lightbox.", + "type": "boolean", + "default": false + } + }, + "additionalProperties": false + } + } + }, "settingsProperties": { "allOf": [ { "$ref": "#/definitions/settingsPropertiesAppearanceTools" }, + { "$ref": "#/definitions/settingsPropertiesBehaviors" }, { "$ref": "#/definitions/settingsPropertiesBorder" }, { "$ref": "#/definitions/settingsPropertiesColor" }, { "$ref": "#/definitions/settingsPropertiesDimensions" }, @@ -695,6 +713,7 @@ { "properties": { "appearanceTools": {}, + "behaviors": {}, "border": {}, "color": {}, "dimensions": {}, From 219e6168ceb5e8b44eb5960163cd0a634c44dd2d Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Thu, 6 Jul 2023 20:01:05 +0100 Subject: [PATCH 16/18] Revert "Remove the settings from `lib/theme.json`" This reverts commit 94eeca1dd6f6e360ab27ec8a81dea6497c6a2bb4. --- lib/theme.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/theme.json b/lib/theme.json index 31256b91ca9d1..5c64526b1a253 100644 --- a/lib/theme.json +++ b/lib/theme.json @@ -290,6 +290,11 @@ "style": true, "width": true } + }, + "core/image": { + "behaviors": { + "lightbox": true + } } } }, From 87adace380ab4571a25011ea104c20cab6bc4f2d Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Thu, 6 Jul 2023 20:03:34 +0100 Subject: [PATCH 17/18] Update the wording --- schemas/json/theme.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/json/theme.json b/schemas/json/theme.json index 139e09d5c241c..6646ec80cebdf 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -2112,7 +2112,7 @@ "description": "Description of the global styles variation." }, "behaviors": { - "description": "A list of blocks that have behaviors. These setting controls the display of the behaviors UI in the block editor.", + "description": "A list of blocks that have behaviors. This setting controls the display of the Behaviors UI in the block editor.", "type": "object", "properties": { "blocks": { From 079316684625c9b12f90286685c836a8e655fdf8 Mon Sep 17 00:00:00 2001 From: Michal Czaplinski Date: Thu, 6 Jul 2023 20:05:53 +0100 Subject: [PATCH 18/18] Update more schema wordings --- schemas/json/theme.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/schemas/json/theme.json b/schemas/json/theme.json index 6646ec80cebdf..5959b4a4a2d28 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -11,16 +11,16 @@ "type": "object", "properties": { "lightbox": { - "description": "Allow users to control lightbox.", + "description": "Settings related to the lightbox behavior.", "type": "object", "properties": { "enabled": { - "description": "Allow users to enable lightbox.", + "description": "Allow users to enable the lightbox behavior.", "type": "boolean", "default": false }, "animation": { - "description": "Allow users to set lightbox animation.", + "description": "Set lightbox animation. Possible values: `fade`, `zoom`, `''` (empty string).", "type": "string", "enum": [ "fade", "zoom", "" ] }