From 354aa5f878a80e1b8d7851b19c679e036f4f29f6 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 9 Mar 2024 13:38:16 +0000 Subject: [PATCH] New properties and REST fields for 6.5. --- packages/wp-types/index.ts | 32 ++++++++++++++++++++++++++ schemas/block-type.json | 39 ++++++++++++++++++++++++++++++++ schemas/rest-api/attachment.json | 5 ++++ schemas/rest-api/block-type.json | 27 ++++++++++++++++++++++ 4 files changed, 103 insertions(+) diff --git a/packages/wp-types/index.ts b/packages/wp-types/index.ts index d974d84..1cdb9a0 100644 --- a/packages/wp-types/index.ts +++ b/packages/wp-types/index.ts @@ -308,6 +308,22 @@ export interface WP_Block_Type { | { [k: string]: string; }; + /** + * Allowed child block types. + */ + allowed_blocks: string[] | null; + /** + * Block variations callback. + */ + variation_callback: Callable | null; + /** + * Block type front end only script module IDs. + */ + view_script_module_ids: string[]; + /** + * Block type front end only style handles. + */ + view_style_handles: string[]; /** * Custom CSS selectors for theme.json style generation. */ @@ -2098,6 +2114,10 @@ export interface WP_REST_API_Attachment { * Unique identifier for the attachment. */ id: number; + /** + * The ID of the featured media for the post. + */ + featured_media: number; /** * URL to the attachment. */ @@ -2631,6 +2651,18 @@ export interface WP_REST_API_Block_Type { | { [k: string]: string; }; + /** + * Allowed child block types. + */ + allowed_blocks: string[] | null; + /** + * Block type front end only script module IDs. + */ + view_script_module_ids: string[]; + /** + * Block type front end only style handles. + */ + view_style_handles: string[]; /** * Public text domain. */ diff --git a/schemas/block-type.json b/schemas/block-type.json index 7366a15..803c666 100644 --- a/schemas/block-type.json +++ b/schemas/block-type.json @@ -22,6 +22,10 @@ "attributes", "uses_context", "block_hooks", + "allowed_blocks", + "variation_callback", + "view_script_module_ids", + "view_style_handles", "provides_context", "editor_script_handles", "script_handles", @@ -116,6 +120,41 @@ } ] }, + "allowed_blocks": { + "description": "Allowed child block types.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "variation_callback": { + "description": "Block variations callback.", + "anyOf": [ + { + "$ref": "properties/callable.json" + }, + { + "type": "null" + } + ] + }, + "view_script_module_ids": { + "description": "Block type front end only script module IDs.", + "type": "array", + "items": { + "type": "string" + } + }, + "view_style_handles": { + "description": "Block type front end only style handles.", + "type": "array", + "items": { + "type": "string" + } + }, "selectors": { "description": "Custom CSS selectors for theme.json style generation.", "oneOf": [ diff --git a/schemas/rest-api/attachment.json b/schemas/rest-api/attachment.json index 57306ad..14f5746 100644 --- a/schemas/rest-api/attachment.json +++ b/schemas/rest-api/attachment.json @@ -9,6 +9,7 @@ "date_gmt", "guid", "id", + "featured_media", "link", "modified", "modified_gmt", @@ -74,6 +75,10 @@ "description": "Unique identifier for the attachment.", "type": "integer" }, + "featured_media": { + "description": "The ID of the featured media for the post.", + "type": "integer" + }, "link": { "readOnly": true, "description": "URL to the attachment.", diff --git a/schemas/rest-api/block-type.json b/schemas/rest-api/block-type.json index 8433730..0f68b89 100644 --- a/schemas/rest-api/block-type.json +++ b/schemas/rest-api/block-type.json @@ -25,6 +25,9 @@ "styles", "variations", "block_hooks", + "allowed_blocks", + "view_script_module_ids", + "view_style_handles", "textdomain", "parent", "keywords", @@ -262,6 +265,30 @@ } ] }, + "allowed_blocks": { + "description": "Allowed child block types.", + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + } + }, + "view_script_module_ids": { + "description": "Block type front end only script module IDs.", + "type": "array", + "items": { + "type": "string" + } + }, + "view_style_handles": { + "description": "Block type front end only style handles.", + "type": "array", + "items": { + "type": "string" + } + }, "textdomain": { "description": "Public text domain.", "type": [