From 59da9c496d9f538c6bf3d34a6506b7335b07bc0c Mon Sep 17 00:00:00 2001 From: Hannah Mehreteab Date: Tue, 2 Dec 2025 07:45:34 +0000 Subject: [PATCH] add audio node --- README.md | 12 ++++++++++++ content-tree.d.ts | 28 ++++++++++++++++++++++++---- schemas/body-tree.schema.json | 25 +++++++++++++++++++++++++ schemas/content-tree.schema.json | 25 +++++++++++++++++++++++++ schemas/transit-tree.schema.json | 25 +++++++++++++++++++++++++ 5 files changed, 111 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 51b18dd..1f22170 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,7 @@ type BodyBlock = | Recommended | RecommendedList | Tweet + | Audio | Video | YoutubeVideo | Text @@ -562,6 +563,17 @@ interface BigNumber extends Node { **BigNumber** represents a big number. +### `Audio` + +```ts +interface Audio extends Node { + type: "audio" + src: string + title: string +} +``` +**Audio** represents an audio clip. + ### `Video` ```ts diff --git a/content-tree.d.ts b/content-tree.d.ts index a72b240..7c19156 100644 --- a/content-tree.d.ts +++ b/content-tree.d.ts @@ -1,5 +1,5 @@ export declare namespace ContentTree { - type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair; + type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Audio | Video | YoutubeVideo | Text | ImagePair; type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link; interface Node { @@ -173,6 +173,11 @@ export declare namespace ContentTree { number: string; description: string; } + interface Audio extends Node { + type: "audio"; + src: string; + title: string; + } interface Video extends Node { type: "video"; id: string; @@ -290,7 +295,7 @@ export declare namespace ContentTree { children: [ImageSet, ImageSet]; } namespace full { - type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair; + type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Audio | Video | YoutubeVideo | Text | ImagePair; type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link; interface Node { @@ -464,6 +469,11 @@ export declare namespace ContentTree { number: string; description: string; } + interface Audio extends Node { + type: "audio"; + src: string; + title: string; + } interface Video extends Node { type: "video"; id: string; @@ -582,7 +592,7 @@ export declare namespace ContentTree { } } namespace transit { - type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair; + type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Audio | Video | YoutubeVideo | Text | ImagePair; type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link; interface Node { @@ -752,6 +762,11 @@ export declare namespace ContentTree { number: string; description: string; } + interface Audio extends Node { + type: "audio"; + src: string; + title: string; + } interface Video extends Node { type: "video"; id: string; @@ -859,7 +874,7 @@ export declare namespace ContentTree { } } namespace loose { - type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair; + type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Audio | Video | YoutubeVideo | Text | ImagePair; type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link; interface Node { @@ -1033,6 +1048,11 @@ export declare namespace ContentTree { number: string; description: string; } + interface Audio extends Node { + type: "audio"; + src: string; + title: string; + } interface Video extends Node { type: "video"; id: string; diff --git a/schemas/body-tree.schema.json b/schemas/body-tree.schema.json index fbbb767..f56e6f0 100644 --- a/schemas/body-tree.schema.json +++ b/schemas/body-tree.schema.json @@ -2,6 +2,28 @@ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { + "ContentTree.transit.Audio": { + "additionalProperties": false, + "properties": { + "data": {}, + "src": { + "type": "string" + }, + "title": { + "type": "string" + }, + "type": { + "const": "audio", + "type": "string" + } + }, + "required": [ + "src", + "title", + "type" + ], + "type": "object" + }, "ContentTree.transit.BigNumber": { "additionalProperties": false, "properties": { @@ -117,6 +139,9 @@ { "$ref": "#/definitions/ContentTree.transit.Tweet" }, + { + "$ref": "#/definitions/ContentTree.transit.Audio" + }, { "$ref": "#/definitions/ContentTree.transit.Video" }, diff --git a/schemas/content-tree.schema.json b/schemas/content-tree.schema.json index c58cc64..7513152 100644 --- a/schemas/content-tree.schema.json +++ b/schemas/content-tree.schema.json @@ -2,6 +2,28 @@ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { + "ContentTree.full.Audio": { + "additionalProperties": false, + "properties": { + "data": {}, + "src": { + "type": "string" + }, + "title": { + "type": "string" + }, + "type": { + "const": "audio", + "type": "string" + } + }, + "required": [ + "src", + "title", + "type" + ], + "type": "object" + }, "ContentTree.full.BigNumber": { "additionalProperties": false, "properties": { @@ -142,6 +164,9 @@ { "$ref": "#/definitions/ContentTree.full.Tweet" }, + { + "$ref": "#/definitions/ContentTree.full.Audio" + }, { "$ref": "#/definitions/ContentTree.full.Video" }, diff --git a/schemas/transit-tree.schema.json b/schemas/transit-tree.schema.json index 8bebc00..a2049f4 100644 --- a/schemas/transit-tree.schema.json +++ b/schemas/transit-tree.schema.json @@ -2,6 +2,28 @@ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { + "ContentTree.transit.Audio": { + "additionalProperties": false, + "properties": { + "data": {}, + "src": { + "type": "string" + }, + "title": { + "type": "string" + }, + "type": { + "const": "audio", + "type": "string" + } + }, + "required": [ + "src", + "title", + "type" + ], + "type": "object" + }, "ContentTree.transit.BigNumber": { "additionalProperties": false, "properties": { @@ -142,6 +164,9 @@ { "$ref": "#/definitions/ContentTree.transit.Tweet" }, + { + "$ref": "#/definitions/ContentTree.transit.Audio" + }, { "$ref": "#/definitions/ContentTree.transit.Video" },