From 4d65cbb97871c7813c7c9be1f062f46bda98d81e Mon Sep 17 00:00:00 2001 From: lastHokage Date: Wed, 30 Jul 2025 14:39:09 +0100 Subject: [PATCH 1/9] feat: create a new unstable Gallery for a poc work. this will be the new way of adding storyblock to spark. --- README.md | 69 ++++++- build.bash | 1 + content-tree.d.ts | 164 +++++++++++++++- schemas/body-tree.schema.json | 229 +++++++++++++++++------ schemas/content-tree.schema.json | 229 +++++++++++++++++------ schemas/transit-tree.schema.json | 229 +++++++++++++++++------ schemas/unstable-body-blocks.schema.json | 119 ++++++++++++ 7 files changed, 858 insertions(+), 182 deletions(-) create mode 100644 schemas/unstable-body-blocks.schema.json diff --git a/README.md b/README.md index 066c433..d8defb2 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ when the `content-tree` is in from its [ecosystem of utilities][unist-utilities]. `content-tree` relates to [JavaScript][js] in that it has an [ecosystem of -utilities][unist-utilities] for working with trees in JavaScript. However, +utilities][unist-utilities] for working with trees in JavaScript. However, `content-tree` is not limited to JavaScript and can be used in other programming languages. @@ -176,13 +176,21 @@ interface Root extends Node { **Root** can be used as the _[root][term-root]_ of a _[tree][term-tree]_. +### UnstableBodyBlocks + +```ts +type UnstableBodyBlocks = UnstableGallery; +``` + +`UnstableBodyBlocks` nodes are also valid body blocks, but like, experimental. you can add more unstable nodes to this block like `UnstableGallery | UnstableComponent`. + ### `Body` ```ts interface Body extends Parent { type: "body" version: number - children: BodyBlock[] + children: (BodyBlock | UnstableBodyBlocks)[] } ``` @@ -346,7 +354,6 @@ _non normative note:_ the reason this is string properties and not children is that it is more confusing if a pullquote falls back to text than if it doesn't. The text is taken from elsewhere in the article. - ### `ImageSet` ```ts @@ -409,10 +416,8 @@ type ImageSource = { **ImageSource** defines a single resource for an [image](#image). - ### `Recommended` - ```ts interface Recommended extends Node { type: "recommended" @@ -488,7 +493,6 @@ type Teaser = { } ``` - ### `Tweet` ```ts @@ -632,7 +636,6 @@ The `layoutName` acts as a sort of theme for the component. ### `LayoutSlot` - ```ts interface LayoutSlot extends Parent { type: "layout-slot" @@ -679,7 +682,7 @@ interface TableCaption extends Parent { } interface TableCell extends Parent { - type: 'table-cell' + type: 'table-cell' heading?: boolean children: Phrasing[] } @@ -722,7 +725,7 @@ interface Table extends Parent { ```ts type CustomCodeComponentAttributes = { - [key: string]: string | boolean | undefined + [key: string]: string | boolean | undefined } interface CustomCodeComponent extends Node { @@ -743,11 +746,57 @@ interface CustomCodeComponent extends Node { } ``` -- The **CustomCodeComponent*** allows for more experimental forms of journalism, allowing editors to provide properties via Spark. +- The **CustomCodeComponent\*** allows for more experimental forms of journalism, allowing editors to provide properties via Spark. - The component itself lives off-platform, and an example might be a git repository with a standard structure. This structure would include the rendering instructions, and the data structure that is expected to be provided to the component for it to render if necessary. - The basic interface in Spark to make reference to this system above (eg. the git repo URL or a public S3 bucket), and provide some data for it if necessary. This will be the Custom Component storyblock. - The data Spark receives from entering a specific ID will be used to render dynamic fields (the `attributes`). +### ExperimentalGallery + +```ts +type galleryItem = { + /** + * @description link for the image + */ + imageLink?: "text" + /** + * @description this is the first Image + * @default false + */ + firstImage: boolean + /** + * @description image description + */ + + imageDescription?: string + /** + * @description select or upload image + */ + picture?: Image +} + +interface UnstableGallery extends Node { + type: "Gallery" + + /** + * @description gallery description + * @default default text for the source field + */ + galleryDescription?: string + /** + * @description autoplay the gallery + * @default false + */ + autoPlay?: boolean + + /** + * @description each gallery item + * @maxItems 10 + * @minItems 1 + */ + galleryItems: [galleryItem] +} +``` ## License diff --git a/build.bash b/build.bash index 7f7860a..b54f1e5 100755 --- a/build.bash +++ b/build.bash @@ -4,5 +4,6 @@ tsc -d content-tree.ts typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.full.Root > schemas/content-tree.schema.json typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/transit-tree.schema.json typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Body > schemas/body-tree.schema.json +typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.UnstableBodyBlocks > schemas/unstable-body-blocks.schema.json rm content-tree.ts rm content-tree.js diff --git a/content-tree.d.ts b/content-tree.d.ts index 27c8b7d..5d61826 100644 --- a/content-tree.d.ts +++ b/content-tree.d.ts @@ -13,10 +13,11 @@ export declare namespace ContentTree { type: "root"; body: Body; } + type UnstableBodyBlocks = UnstableGallery; interface Body extends Parent { type: "body"; version: number; - children: BodyBlock[]; + children: (BodyBlock | UnstableBodyBlocks)[]; } interface Text extends Node { type: "text"; @@ -271,6 +272,44 @@ export declare namespace ContentTree { /** Configuration data to be passed to the component. */ attributes: CustomCodeComponentAttributes; } + type galleryItem = { + /** + * @description link for the image + */ + imageLink?: "text"; + /** + * @description this is the first Image + * @default false + */ + firstImage: boolean; + /** + * @description image description + */ + imageDescription?: string; + /** + * @description select or upload image + */ + picture?: Image; + }; + interface UnstableGallery extends Node { + type: "Gallery"; + /** + * @description gallery description + * @default default text for the source field + */ + galleryDescription?: string; + /** + * @description autoplay the gallery + * @default false + */ + autoPlay?: boolean; + /** + * @description each gallery item + * @maxItems 10 + * @minItems 1 + */ + galleryItems: [galleryItem]; + } namespace full { type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo; type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; @@ -286,10 +325,11 @@ export declare namespace ContentTree { type: "root"; body: Body; } + type UnstableBodyBlocks = UnstableGallery; interface Body extends Parent { type: "body"; version: number; - children: BodyBlock[]; + children: (BodyBlock | UnstableBodyBlocks)[]; } interface Text extends Node { type: "text"; @@ -544,6 +584,44 @@ export declare namespace ContentTree { /** Configuration data to be passed to the component. */ attributes: CustomCodeComponentAttributes; } + type galleryItem = { + /** + * @description link for the image + */ + imageLink?: "text"; + /** + * @description this is the first Image + * @default false + */ + firstImage: boolean; + /** + * @description image description + */ + imageDescription?: string; + /** + * @description select or upload image + */ + picture?: Image; + }; + interface UnstableGallery extends Node { + type: "Gallery"; + /** + * @description gallery description + * @default default text for the source field + */ + galleryDescription?: string; + /** + * @description autoplay the gallery + * @default false + */ + autoPlay?: boolean; + /** + * @description each gallery item + * @maxItems 10 + * @minItems 1 + */ + galleryItems: [galleryItem]; + } } namespace transit { type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo; @@ -560,10 +638,11 @@ export declare namespace ContentTree { type: "root"; body: Body; } + type UnstableBodyBlocks = UnstableGallery; interface Body extends Parent { type: "body"; version: number; - children: BodyBlock[]; + children: (BodyBlock | UnstableBodyBlocks)[]; } interface Text extends Node { type: "text"; @@ -805,6 +884,44 @@ export declare namespace ContentTree { /** How the component should be presented in the article page according to the column layout system */ layoutWidth: LayoutWidth; } + type galleryItem = { + /** + * @description link for the image + */ + imageLink?: "text"; + /** + * @description this is the first Image + * @default false + */ + firstImage: boolean; + /** + * @description image description + */ + imageDescription?: string; + /** + * @description select or upload image + */ + picture?: Image; + }; + interface UnstableGallery extends Node { + type: "Gallery"; + /** + * @description gallery description + * @default default text for the source field + */ + galleryDescription?: string; + /** + * @description autoplay the gallery + * @default false + */ + autoPlay?: boolean; + /** + * @description each gallery item + * @maxItems 10 + * @minItems 1 + */ + galleryItems: [galleryItem]; + } } namespace loose { type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo; @@ -821,10 +938,11 @@ export declare namespace ContentTree { type: "root"; body: Body; } + type UnstableBodyBlocks = UnstableGallery; interface Body extends Parent { type: "body"; version: number; - children: BodyBlock[]; + children: (BodyBlock | UnstableBodyBlocks)[]; } interface Text extends Node { type: "text"; @@ -1079,5 +1197,43 @@ export declare namespace ContentTree { /** Configuration data to be passed to the component. */ attributes?: CustomCodeComponentAttributes; } + type galleryItem = { + /** + * @description link for the image + */ + imageLink?: "text"; + /** + * @description this is the first Image + * @default false + */ + firstImage: boolean; + /** + * @description image description + */ + imageDescription?: string; + /** + * @description select or upload image + */ + picture?: Image; + }; + interface UnstableGallery extends Node { + type: "Gallery"; + /** + * @description gallery description + * @default default text for the source field + */ + galleryDescription?: string; + /** + * @description autoplay the gallery + * @default false + */ + autoPlay?: boolean; + /** + * @description each gallery item + * @maxItems 10 + * @minItems 1 + */ + galleryItems: [galleryItem]; + } } } diff --git a/schemas/body-tree.schema.json b/schemas/body-tree.schema.json index f82b5b6..daa7a55 100644 --- a/schemas/body-tree.schema.json +++ b/schemas/body-tree.schema.json @@ -67,61 +67,6 @@ ], "type": "object" }, - "ContentTree.transit.BodyBlock": { - "anyOf": [ - { - "$ref": "#/definitions/ContentTree.transit.Paragraph" - }, - { - "$ref": "#/definitions/ContentTree.transit.Heading" - }, - { - "$ref": "#/definitions/ContentTree.transit.ImageSet" - }, - { - "$ref": "#/definitions/ContentTree.transit.Flourish" - }, - { - "$ref": "#/definitions/ContentTree.transit.BigNumber" - }, - { - "$ref": "#/definitions/ContentTree.transit.CustomCodeComponent" - }, - { - "$ref": "#/definitions/ContentTree.transit.Layout" - }, - { - "$ref": "#/definitions/ContentTree.transit.List" - }, - { - "$ref": "#/definitions/ContentTree.transit.Blockquote" - }, - { - "$ref": "#/definitions/ContentTree.transit.Pullquote" - }, - { - "$ref": "#/definitions/ContentTree.transit.ScrollyBlock" - }, - { - "$ref": "#/definitions/ContentTree.transit.ThematicBreak" - }, - { - "$ref": "#/definitions/ContentTree.transit.Table" - }, - { - "$ref": "#/definitions/ContentTree.transit.Recommended" - }, - { - "$ref": "#/definitions/ContentTree.transit.Tweet" - }, - { - "$ref": "#/definitions/ContentTree.transit.Video" - }, - { - "$ref": "#/definitions/ContentTree.transit.YoutubeVideo" - } - ] - }, "ContentTree.transit.Break": { "additionalProperties": false, "properties": { @@ -1139,6 +1084,123 @@ ], "type": "object" }, + "ContentTree.transit.UnstableGallery": { + "additionalProperties": false, + "properties": { + "autoPlay": { + "default": false, + "description": "autoplay the gallery", + "type": "boolean" + }, + "data": {}, + "galleryDescription": { + "default": "default text for the source field", + "description": "gallery description", + "type": "string" + }, + "galleryItems": { + "description": "each gallery item", + "items": [ + { + "additionalProperties": false, + "properties": { + "firstImage": { + "default": false, + "description": "this is the first Image", + "type": "boolean" + }, + "imageDescription": { + "description": "image description", + "type": "string" + }, + "imageLink": { + "const": "text", + "description": "link for the image", + "type": "string" + }, + "picture": { + "additionalProperties": false, + "description": "select or upload image", + "properties": { + "format": { + "enum": [ + "desktop", + "mobile", + "square", + "square-ftedit", + "standard", + "standard-inline", + "wide" + ], + "type": "string" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "sourceSet": { + "items": { + "additionalProperties": false, + "properties": { + "dpr": { + "type": "number" + }, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "dpr", + "url", + "width" + ], + "type": "object" + }, + "type": "array" + }, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "format", + "height", + "id", + "url", + "width" + ], + "type": "object" + } + }, + "required": [ + "firstImage" + ], + "type": "object" + } + ], + "maxItems": 1, + "minItems": 1, + "type": "array" + }, + "type": { + "const": "Gallery", + "type": "string" + } + }, + "required": [ + "galleryItems", + "type" + ], + "type": "object" + }, "ContentTree.transit.Video": { "additionalProperties": false, "properties": { @@ -1183,7 +1245,62 @@ "properties": { "children": { "items": { - "$ref": "#/definitions/ContentTree.transit.BodyBlock" + "anyOf": [ + { + "$ref": "#/definitions/ContentTree.transit.Paragraph" + }, + { + "$ref": "#/definitions/ContentTree.transit.Heading" + }, + { + "$ref": "#/definitions/ContentTree.transit.ImageSet" + }, + { + "$ref": "#/definitions/ContentTree.transit.Flourish" + }, + { + "$ref": "#/definitions/ContentTree.transit.BigNumber" + }, + { + "$ref": "#/definitions/ContentTree.transit.CustomCodeComponent" + }, + { + "$ref": "#/definitions/ContentTree.transit.Layout" + }, + { + "$ref": "#/definitions/ContentTree.transit.List" + }, + { + "$ref": "#/definitions/ContentTree.transit.Blockquote" + }, + { + "$ref": "#/definitions/ContentTree.transit.Pullquote" + }, + { + "$ref": "#/definitions/ContentTree.transit.ScrollyBlock" + }, + { + "$ref": "#/definitions/ContentTree.transit.ThematicBreak" + }, + { + "$ref": "#/definitions/ContentTree.transit.Table" + }, + { + "$ref": "#/definitions/ContentTree.transit.Recommended" + }, + { + "$ref": "#/definitions/ContentTree.transit.Tweet" + }, + { + "$ref": "#/definitions/ContentTree.transit.Video" + }, + { + "$ref": "#/definitions/ContentTree.transit.YoutubeVideo" + }, + { + "$ref": "#/definitions/ContentTree.transit.UnstableGallery" + } + ] }, "type": "array" }, diff --git a/schemas/content-tree.schema.json b/schemas/content-tree.schema.json index 7a976f7..127be85 100644 --- a/schemas/content-tree.schema.json +++ b/schemas/content-tree.schema.json @@ -72,7 +72,62 @@ "properties": { "children": { "items": { - "$ref": "#/definitions/ContentTree.full.BodyBlock" + "anyOf": [ + { + "$ref": "#/definitions/ContentTree.full.Paragraph" + }, + { + "$ref": "#/definitions/ContentTree.full.Heading" + }, + { + "$ref": "#/definitions/ContentTree.full.ImageSet" + }, + { + "$ref": "#/definitions/ContentTree.full.Flourish" + }, + { + "$ref": "#/definitions/ContentTree.full.BigNumber" + }, + { + "$ref": "#/definitions/ContentTree.full.CustomCodeComponent" + }, + { + "$ref": "#/definitions/ContentTree.full.Layout" + }, + { + "$ref": "#/definitions/ContentTree.full.List" + }, + { + "$ref": "#/definitions/ContentTree.full.Blockquote" + }, + { + "$ref": "#/definitions/ContentTree.full.Pullquote" + }, + { + "$ref": "#/definitions/ContentTree.full.ScrollyBlock" + }, + { + "$ref": "#/definitions/ContentTree.full.ThematicBreak" + }, + { + "$ref": "#/definitions/ContentTree.full.Table" + }, + { + "$ref": "#/definitions/ContentTree.full.Recommended" + }, + { + "$ref": "#/definitions/ContentTree.full.Tweet" + }, + { + "$ref": "#/definitions/ContentTree.full.Video" + }, + { + "$ref": "#/definitions/ContentTree.full.YoutubeVideo" + }, + { + "$ref": "#/definitions/ContentTree.full.UnstableGallery" + } + ] }, "type": "array" }, @@ -92,61 +147,6 @@ ], "type": "object" }, - "ContentTree.full.BodyBlock": { - "anyOf": [ - { - "$ref": "#/definitions/ContentTree.full.Paragraph" - }, - { - "$ref": "#/definitions/ContentTree.full.Heading" - }, - { - "$ref": "#/definitions/ContentTree.full.ImageSet" - }, - { - "$ref": "#/definitions/ContentTree.full.Flourish" - }, - { - "$ref": "#/definitions/ContentTree.full.BigNumber" - }, - { - "$ref": "#/definitions/ContentTree.full.CustomCodeComponent" - }, - { - "$ref": "#/definitions/ContentTree.full.Layout" - }, - { - "$ref": "#/definitions/ContentTree.full.List" - }, - { - "$ref": "#/definitions/ContentTree.full.Blockquote" - }, - { - "$ref": "#/definitions/ContentTree.full.Pullquote" - }, - { - "$ref": "#/definitions/ContentTree.full.ScrollyBlock" - }, - { - "$ref": "#/definitions/ContentTree.full.ThematicBreak" - }, - { - "$ref": "#/definitions/ContentTree.full.Table" - }, - { - "$ref": "#/definitions/ContentTree.full.Recommended" - }, - { - "$ref": "#/definitions/ContentTree.full.Tweet" - }, - { - "$ref": "#/definitions/ContentTree.full.Video" - }, - { - "$ref": "#/definitions/ContentTree.full.YoutubeVideo" - } - ] - }, "ContentTree.full.Break": { "additionalProperties": false, "properties": { @@ -1861,6 +1861,123 @@ ], "type": "object" }, + "ContentTree.full.UnstableGallery": { + "additionalProperties": false, + "properties": { + "autoPlay": { + "default": false, + "description": "autoplay the gallery", + "type": "boolean" + }, + "data": {}, + "galleryDescription": { + "default": "default text for the source field", + "description": "gallery description", + "type": "string" + }, + "galleryItems": { + "description": "each gallery item", + "items": [ + { + "additionalProperties": false, + "properties": { + "firstImage": { + "default": false, + "description": "this is the first Image", + "type": "boolean" + }, + "imageDescription": { + "description": "image description", + "type": "string" + }, + "imageLink": { + "const": "text", + "description": "link for the image", + "type": "string" + }, + "picture": { + "additionalProperties": false, + "description": "select or upload image", + "properties": { + "format": { + "enum": [ + "desktop", + "mobile", + "square", + "square-ftedit", + "standard", + "standard-inline", + "wide" + ], + "type": "string" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "sourceSet": { + "items": { + "additionalProperties": false, + "properties": { + "dpr": { + "type": "number" + }, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "dpr", + "url", + "width" + ], + "type": "object" + }, + "type": "array" + }, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "format", + "height", + "id", + "url", + "width" + ], + "type": "object" + } + }, + "required": [ + "firstImage" + ], + "type": "object" + } + ], + "maxItems": 1, + "minItems": 1, + "type": "array" + }, + "type": { + "const": "Gallery", + "type": "string" + } + }, + "required": [ + "galleryItems", + "type" + ], + "type": "object" + }, "ContentTree.full.Video": { "additionalProperties": false, "properties": { diff --git a/schemas/transit-tree.schema.json b/schemas/transit-tree.schema.json index 1152a2b..bf33b64 100644 --- a/schemas/transit-tree.schema.json +++ b/schemas/transit-tree.schema.json @@ -72,7 +72,62 @@ "properties": { "children": { "items": { - "$ref": "#/definitions/ContentTree.transit.BodyBlock" + "anyOf": [ + { + "$ref": "#/definitions/ContentTree.transit.Paragraph" + }, + { + "$ref": "#/definitions/ContentTree.transit.Heading" + }, + { + "$ref": "#/definitions/ContentTree.transit.ImageSet" + }, + { + "$ref": "#/definitions/ContentTree.transit.Flourish" + }, + { + "$ref": "#/definitions/ContentTree.transit.BigNumber" + }, + { + "$ref": "#/definitions/ContentTree.transit.CustomCodeComponent" + }, + { + "$ref": "#/definitions/ContentTree.transit.Layout" + }, + { + "$ref": "#/definitions/ContentTree.transit.List" + }, + { + "$ref": "#/definitions/ContentTree.transit.Blockquote" + }, + { + "$ref": "#/definitions/ContentTree.transit.Pullquote" + }, + { + "$ref": "#/definitions/ContentTree.transit.ScrollyBlock" + }, + { + "$ref": "#/definitions/ContentTree.transit.ThematicBreak" + }, + { + "$ref": "#/definitions/ContentTree.transit.Table" + }, + { + "$ref": "#/definitions/ContentTree.transit.Recommended" + }, + { + "$ref": "#/definitions/ContentTree.transit.Tweet" + }, + { + "$ref": "#/definitions/ContentTree.transit.Video" + }, + { + "$ref": "#/definitions/ContentTree.transit.YoutubeVideo" + }, + { + "$ref": "#/definitions/ContentTree.transit.UnstableGallery" + } + ] }, "type": "array" }, @@ -92,61 +147,6 @@ ], "type": "object" }, - "ContentTree.transit.BodyBlock": { - "anyOf": [ - { - "$ref": "#/definitions/ContentTree.transit.Paragraph" - }, - { - "$ref": "#/definitions/ContentTree.transit.Heading" - }, - { - "$ref": "#/definitions/ContentTree.transit.ImageSet" - }, - { - "$ref": "#/definitions/ContentTree.transit.Flourish" - }, - { - "$ref": "#/definitions/ContentTree.transit.BigNumber" - }, - { - "$ref": "#/definitions/ContentTree.transit.CustomCodeComponent" - }, - { - "$ref": "#/definitions/ContentTree.transit.Layout" - }, - { - "$ref": "#/definitions/ContentTree.transit.List" - }, - { - "$ref": "#/definitions/ContentTree.transit.Blockquote" - }, - { - "$ref": "#/definitions/ContentTree.transit.Pullquote" - }, - { - "$ref": "#/definitions/ContentTree.transit.ScrollyBlock" - }, - { - "$ref": "#/definitions/ContentTree.transit.ThematicBreak" - }, - { - "$ref": "#/definitions/ContentTree.transit.Table" - }, - { - "$ref": "#/definitions/ContentTree.transit.Recommended" - }, - { - "$ref": "#/definitions/ContentTree.transit.Tweet" - }, - { - "$ref": "#/definitions/ContentTree.transit.Video" - }, - { - "$ref": "#/definitions/ContentTree.transit.YoutubeVideo" - } - ] - }, "ContentTree.transit.Break": { "additionalProperties": false, "properties": { @@ -1164,6 +1164,123 @@ ], "type": "object" }, + "ContentTree.transit.UnstableGallery": { + "additionalProperties": false, + "properties": { + "autoPlay": { + "default": false, + "description": "autoplay the gallery", + "type": "boolean" + }, + "data": {}, + "galleryDescription": { + "default": "default text for the source field", + "description": "gallery description", + "type": "string" + }, + "galleryItems": { + "description": "each gallery item", + "items": [ + { + "additionalProperties": false, + "properties": { + "firstImage": { + "default": false, + "description": "this is the first Image", + "type": "boolean" + }, + "imageDescription": { + "description": "image description", + "type": "string" + }, + "imageLink": { + "const": "text", + "description": "link for the image", + "type": "string" + }, + "picture": { + "additionalProperties": false, + "description": "select or upload image", + "properties": { + "format": { + "enum": [ + "desktop", + "mobile", + "square", + "square-ftedit", + "standard", + "standard-inline", + "wide" + ], + "type": "string" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "sourceSet": { + "items": { + "additionalProperties": false, + "properties": { + "dpr": { + "type": "number" + }, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "dpr", + "url", + "width" + ], + "type": "object" + }, + "type": "array" + }, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "format", + "height", + "id", + "url", + "width" + ], + "type": "object" + } + }, + "required": [ + "firstImage" + ], + "type": "object" + } + ], + "maxItems": 1, + "minItems": 1, + "type": "array" + }, + "type": { + "const": "Gallery", + "type": "string" + } + }, + "required": [ + "galleryItems", + "type" + ], + "type": "object" + }, "ContentTree.transit.Video": { "additionalProperties": false, "properties": { diff --git a/schemas/unstable-body-blocks.schema.json b/schemas/unstable-body-blocks.schema.json new file mode 100644 index 0000000..041b7c6 --- /dev/null +++ b/schemas/unstable-body-blocks.schema.json @@ -0,0 +1,119 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "additionalProperties": false, + "properties": { + "autoPlay": { + "default": false, + "description": "autoplay the gallery", + "type": "boolean" + }, + "data": {}, + "galleryDescription": { + "default": "default text for the source field", + "description": "gallery description", + "type": "string" + }, + "galleryItems": { + "description": "each gallery item", + "items": [ + { + "additionalProperties": false, + "properties": { + "firstImage": { + "default": false, + "description": "this is the first Image", + "type": "boolean" + }, + "imageDescription": { + "description": "image description", + "type": "string" + }, + "imageLink": { + "const": "text", + "description": "link for the image", + "type": "string" + }, + "picture": { + "additionalProperties": false, + "description": "select or upload image", + "properties": { + "format": { + "enum": [ + "desktop", + "mobile", + "square", + "square-ftedit", + "standard", + "standard-inline", + "wide" + ], + "type": "string" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "sourceSet": { + "items": { + "additionalProperties": false, + "properties": { + "dpr": { + "type": "number" + }, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "dpr", + "url", + "width" + ], + "type": "object" + }, + "type": "array" + }, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "format", + "height", + "id", + "url", + "width" + ], + "type": "object" + } + }, + "required": [ + "firstImage" + ], + "type": "object" + } + ], + "maxItems": 1, + "minItems": 1, + "type": "array" + }, + "type": { + "const": "Gallery", + "type": "string" + } + }, + "required": [ + "galleryItems", + "type" + ], + "type": "object" +} + From 0cddef0e24f4464ea5f24db5f628b48578664995 Mon Sep 17 00:00:00 2001 From: lastHokage Date: Tue, 26 Aug 2025 15:10:03 +0100 Subject: [PATCH 2/9] feat: remove unstable from the Gallery defenition, remove the s from unstableBodyBloks and move it's location in the readme --- README.md | 20 +- build.bash | 2 +- content-tree.d.ts | 24 +- schemas/body-tree.schema.json | 236 +++++++++--------- schemas/content-tree.schema.json | 236 +++++++++--------- schemas/transit-tree.schema.json | 236 +++++++++--------- ...a.json => unstable-body-block.schema.json} | 0 7 files changed, 377 insertions(+), 377 deletions(-) rename schemas/{unstable-body-blocks.schema.json => unstable-body-block.schema.json} (100%) diff --git a/README.md b/README.md index d8defb2..a004d69 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,14 @@ type BodyBlock = `BodyBlock` nodes are the only things that are valid as the top level of a `Body`. +### UnstableBodyBlock + +```ts +type UnstableBodyBlock = Gallery ; +``` + +`UnstableBodyBlocks` nodes are also valid body blocks, but like, experimental. you can add more unstable nodes to this block like `UnstableGallery | UnstableComponent`. + ### `LayoutWidth` ```ts @@ -176,21 +184,13 @@ interface Root extends Node { **Root** can be used as the _[root][term-root]_ of a _[tree][term-tree]_. -### UnstableBodyBlocks - -```ts -type UnstableBodyBlocks = UnstableGallery; -``` - -`UnstableBodyBlocks` nodes are also valid body blocks, but like, experimental. you can add more unstable nodes to this block like `UnstableGallery | UnstableComponent`. - ### `Body` ```ts interface Body extends Parent { type: "body" version: number - children: (BodyBlock | UnstableBodyBlocks)[] + children: (BodyBlock | UnstableBodyBlock)[] } ``` @@ -775,7 +775,7 @@ type galleryItem = { picture?: Image } -interface UnstableGallery extends Node { +interface Gallery extends Node { type: "Gallery" /** diff --git a/build.bash b/build.bash index b54f1e5..3c6ee6d 100755 --- a/build.bash +++ b/build.bash @@ -4,6 +4,6 @@ tsc -d content-tree.ts typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.full.Root > schemas/content-tree.schema.json typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/transit-tree.schema.json typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Body > schemas/body-tree.schema.json -typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.UnstableBodyBlocks > schemas/unstable-body-blocks.schema.json +typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.UnstableBodyBlock > schemas/unstable-body-block.schema.json rm content-tree.ts rm content-tree.js diff --git a/content-tree.d.ts b/content-tree.d.ts index 5d61826..965fe4b 100644 --- a/content-tree.d.ts +++ b/content-tree.d.ts @@ -1,5 +1,6 @@ export declare namespace ContentTree { type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo; + type UnstableBodyBlock = Gallery; 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 { @@ -13,11 +14,10 @@ export declare namespace ContentTree { type: "root"; body: Body; } - type UnstableBodyBlocks = UnstableGallery; interface Body extends Parent { type: "body"; version: number; - children: (BodyBlock | UnstableBodyBlocks)[]; + children: (BodyBlock | UnstableBodyBlock)[]; } interface Text extends Node { type: "text"; @@ -291,7 +291,7 @@ export declare namespace ContentTree { */ picture?: Image; }; - interface UnstableGallery extends Node { + interface Gallery extends Node { type: "Gallery"; /** * @description gallery description @@ -312,6 +312,7 @@ export declare namespace ContentTree { } namespace full { type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo; + type UnstableBodyBlock = Gallery; 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 { @@ -325,11 +326,10 @@ export declare namespace ContentTree { type: "root"; body: Body; } - type UnstableBodyBlocks = UnstableGallery; interface Body extends Parent { type: "body"; version: number; - children: (BodyBlock | UnstableBodyBlocks)[]; + children: (BodyBlock | UnstableBodyBlock)[]; } interface Text extends Node { type: "text"; @@ -603,7 +603,7 @@ export declare namespace ContentTree { */ picture?: Image; }; - interface UnstableGallery extends Node { + interface Gallery extends Node { type: "Gallery"; /** * @description gallery description @@ -625,6 +625,7 @@ export declare namespace ContentTree { } namespace transit { type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo; + type UnstableBodyBlock = Gallery; 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 { @@ -638,11 +639,10 @@ export declare namespace ContentTree { type: "root"; body: Body; } - type UnstableBodyBlocks = UnstableGallery; interface Body extends Parent { type: "body"; version: number; - children: (BodyBlock | UnstableBodyBlocks)[]; + children: (BodyBlock | UnstableBodyBlock)[]; } interface Text extends Node { type: "text"; @@ -903,7 +903,7 @@ export declare namespace ContentTree { */ picture?: Image; }; - interface UnstableGallery extends Node { + interface Gallery extends Node { type: "Gallery"; /** * @description gallery description @@ -925,6 +925,7 @@ export declare namespace ContentTree { } namespace loose { type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo; + type UnstableBodyBlock = Gallery; 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 { @@ -938,11 +939,10 @@ export declare namespace ContentTree { type: "root"; body: Body; } - type UnstableBodyBlocks = UnstableGallery; interface Body extends Parent { type: "body"; version: number; - children: (BodyBlock | UnstableBodyBlocks)[]; + children: (BodyBlock | UnstableBodyBlock)[]; } interface Text extends Node { type: "text"; @@ -1216,7 +1216,7 @@ export declare namespace ContentTree { */ picture?: Image; }; - interface UnstableGallery extends Node { + interface Gallery extends Node { type: "Gallery"; /** * @description gallery description diff --git a/schemas/body-tree.schema.json b/schemas/body-tree.schema.json index daa7a55..9e36366 100644 --- a/schemas/body-tree.schema.json +++ b/schemas/body-tree.schema.json @@ -219,6 +219,123 @@ ], "type": "object" }, + "ContentTree.transit.Gallery": { + "additionalProperties": false, + "properties": { + "autoPlay": { + "default": false, + "description": "autoplay the gallery", + "type": "boolean" + }, + "data": {}, + "galleryDescription": { + "default": "default text for the source field", + "description": "gallery description", + "type": "string" + }, + "galleryItems": { + "description": "each gallery item", + "items": [ + { + "additionalProperties": false, + "properties": { + "firstImage": { + "default": false, + "description": "this is the first Image", + "type": "boolean" + }, + "imageDescription": { + "description": "image description", + "type": "string" + }, + "imageLink": { + "const": "text", + "description": "link for the image", + "type": "string" + }, + "picture": { + "additionalProperties": false, + "description": "select or upload image", + "properties": { + "format": { + "enum": [ + "desktop", + "mobile", + "square", + "square-ftedit", + "standard", + "standard-inline", + "wide" + ], + "type": "string" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "sourceSet": { + "items": { + "additionalProperties": false, + "properties": { + "dpr": { + "type": "number" + }, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "dpr", + "url", + "width" + ], + "type": "object" + }, + "type": "array" + }, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "format", + "height", + "id", + "url", + "width" + ], + "type": "object" + } + }, + "required": [ + "firstImage" + ], + "type": "object" + } + ], + "maxItems": 1, + "minItems": 1, + "type": "array" + }, + "type": { + "const": "Gallery", + "type": "string" + } + }, + "required": [ + "galleryItems", + "type" + ], + "type": "object" + }, "ContentTree.transit.Heading": { "additionalProperties": false, "properties": { @@ -1084,123 +1201,6 @@ ], "type": "object" }, - "ContentTree.transit.UnstableGallery": { - "additionalProperties": false, - "properties": { - "autoPlay": { - "default": false, - "description": "autoplay the gallery", - "type": "boolean" - }, - "data": {}, - "galleryDescription": { - "default": "default text for the source field", - "description": "gallery description", - "type": "string" - }, - "galleryItems": { - "description": "each gallery item", - "items": [ - { - "additionalProperties": false, - "properties": { - "firstImage": { - "default": false, - "description": "this is the first Image", - "type": "boolean" - }, - "imageDescription": { - "description": "image description", - "type": "string" - }, - "imageLink": { - "const": "text", - "description": "link for the image", - "type": "string" - }, - "picture": { - "additionalProperties": false, - "description": "select or upload image", - "properties": { - "format": { - "enum": [ - "desktop", - "mobile", - "square", - "square-ftedit", - "standard", - "standard-inline", - "wide" - ], - "type": "string" - }, - "height": { - "type": "number" - }, - "id": { - "type": "string" - }, - "sourceSet": { - "items": { - "additionalProperties": false, - "properties": { - "dpr": { - "type": "number" - }, - "url": { - "type": "string" - }, - "width": { - "type": "number" - } - }, - "required": [ - "dpr", - "url", - "width" - ], - "type": "object" - }, - "type": "array" - }, - "url": { - "type": "string" - }, - "width": { - "type": "number" - } - }, - "required": [ - "format", - "height", - "id", - "url", - "width" - ], - "type": "object" - } - }, - "required": [ - "firstImage" - ], - "type": "object" - } - ], - "maxItems": 1, - "minItems": 1, - "type": "array" - }, - "type": { - "const": "Gallery", - "type": "string" - } - }, - "required": [ - "galleryItems", - "type" - ], - "type": "object" - }, "ContentTree.transit.Video": { "additionalProperties": false, "properties": { @@ -1298,7 +1298,7 @@ "$ref": "#/definitions/ContentTree.transit.YoutubeVideo" }, { - "$ref": "#/definitions/ContentTree.transit.UnstableGallery" + "$ref": "#/definitions/ContentTree.transit.Gallery" } ] }, diff --git a/schemas/content-tree.schema.json b/schemas/content-tree.schema.json index 127be85..77fb1c7 100644 --- a/schemas/content-tree.schema.json +++ b/schemas/content-tree.schema.json @@ -125,7 +125,7 @@ "$ref": "#/definitions/ContentTree.full.YoutubeVideo" }, { - "$ref": "#/definitions/ContentTree.full.UnstableGallery" + "$ref": "#/definitions/ContentTree.full.Gallery" } ] }, @@ -325,6 +325,123 @@ ], "type": "object" }, + "ContentTree.full.Gallery": { + "additionalProperties": false, + "properties": { + "autoPlay": { + "default": false, + "description": "autoplay the gallery", + "type": "boolean" + }, + "data": {}, + "galleryDescription": { + "default": "default text for the source field", + "description": "gallery description", + "type": "string" + }, + "galleryItems": { + "description": "each gallery item", + "items": [ + { + "additionalProperties": false, + "properties": { + "firstImage": { + "default": false, + "description": "this is the first Image", + "type": "boolean" + }, + "imageDescription": { + "description": "image description", + "type": "string" + }, + "imageLink": { + "const": "text", + "description": "link for the image", + "type": "string" + }, + "picture": { + "additionalProperties": false, + "description": "select or upload image", + "properties": { + "format": { + "enum": [ + "desktop", + "mobile", + "square", + "square-ftedit", + "standard", + "standard-inline", + "wide" + ], + "type": "string" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "sourceSet": { + "items": { + "additionalProperties": false, + "properties": { + "dpr": { + "type": "number" + }, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "dpr", + "url", + "width" + ], + "type": "object" + }, + "type": "array" + }, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "format", + "height", + "id", + "url", + "width" + ], + "type": "object" + } + }, + "required": [ + "firstImage" + ], + "type": "object" + } + ], + "maxItems": 1, + "minItems": 1, + "type": "array" + }, + "type": { + "const": "Gallery", + "type": "string" + } + }, + "required": [ + "galleryItems", + "type" + ], + "type": "object" + }, "ContentTree.full.Heading": { "additionalProperties": false, "properties": { @@ -1861,123 +1978,6 @@ ], "type": "object" }, - "ContentTree.full.UnstableGallery": { - "additionalProperties": false, - "properties": { - "autoPlay": { - "default": false, - "description": "autoplay the gallery", - "type": "boolean" - }, - "data": {}, - "galleryDescription": { - "default": "default text for the source field", - "description": "gallery description", - "type": "string" - }, - "galleryItems": { - "description": "each gallery item", - "items": [ - { - "additionalProperties": false, - "properties": { - "firstImage": { - "default": false, - "description": "this is the first Image", - "type": "boolean" - }, - "imageDescription": { - "description": "image description", - "type": "string" - }, - "imageLink": { - "const": "text", - "description": "link for the image", - "type": "string" - }, - "picture": { - "additionalProperties": false, - "description": "select or upload image", - "properties": { - "format": { - "enum": [ - "desktop", - "mobile", - "square", - "square-ftedit", - "standard", - "standard-inline", - "wide" - ], - "type": "string" - }, - "height": { - "type": "number" - }, - "id": { - "type": "string" - }, - "sourceSet": { - "items": { - "additionalProperties": false, - "properties": { - "dpr": { - "type": "number" - }, - "url": { - "type": "string" - }, - "width": { - "type": "number" - } - }, - "required": [ - "dpr", - "url", - "width" - ], - "type": "object" - }, - "type": "array" - }, - "url": { - "type": "string" - }, - "width": { - "type": "number" - } - }, - "required": [ - "format", - "height", - "id", - "url", - "width" - ], - "type": "object" - } - }, - "required": [ - "firstImage" - ], - "type": "object" - } - ], - "maxItems": 1, - "minItems": 1, - "type": "array" - }, - "type": { - "const": "Gallery", - "type": "string" - } - }, - "required": [ - "galleryItems", - "type" - ], - "type": "object" - }, "ContentTree.full.Video": { "additionalProperties": false, "properties": { diff --git a/schemas/transit-tree.schema.json b/schemas/transit-tree.schema.json index bf33b64..dd9cdeb 100644 --- a/schemas/transit-tree.schema.json +++ b/schemas/transit-tree.schema.json @@ -125,7 +125,7 @@ "$ref": "#/definitions/ContentTree.transit.YoutubeVideo" }, { - "$ref": "#/definitions/ContentTree.transit.UnstableGallery" + "$ref": "#/definitions/ContentTree.transit.Gallery" } ] }, @@ -299,6 +299,123 @@ ], "type": "object" }, + "ContentTree.transit.Gallery": { + "additionalProperties": false, + "properties": { + "autoPlay": { + "default": false, + "description": "autoplay the gallery", + "type": "boolean" + }, + "data": {}, + "galleryDescription": { + "default": "default text for the source field", + "description": "gallery description", + "type": "string" + }, + "galleryItems": { + "description": "each gallery item", + "items": [ + { + "additionalProperties": false, + "properties": { + "firstImage": { + "default": false, + "description": "this is the first Image", + "type": "boolean" + }, + "imageDescription": { + "description": "image description", + "type": "string" + }, + "imageLink": { + "const": "text", + "description": "link for the image", + "type": "string" + }, + "picture": { + "additionalProperties": false, + "description": "select or upload image", + "properties": { + "format": { + "enum": [ + "desktop", + "mobile", + "square", + "square-ftedit", + "standard", + "standard-inline", + "wide" + ], + "type": "string" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "sourceSet": { + "items": { + "additionalProperties": false, + "properties": { + "dpr": { + "type": "number" + }, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "dpr", + "url", + "width" + ], + "type": "object" + }, + "type": "array" + }, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "format", + "height", + "id", + "url", + "width" + ], + "type": "object" + } + }, + "required": [ + "firstImage" + ], + "type": "object" + } + ], + "maxItems": 1, + "minItems": 1, + "type": "array" + }, + "type": { + "const": "Gallery", + "type": "string" + } + }, + "required": [ + "galleryItems", + "type" + ], + "type": "object" + }, "ContentTree.transit.Heading": { "additionalProperties": false, "properties": { @@ -1164,123 +1281,6 @@ ], "type": "object" }, - "ContentTree.transit.UnstableGallery": { - "additionalProperties": false, - "properties": { - "autoPlay": { - "default": false, - "description": "autoplay the gallery", - "type": "boolean" - }, - "data": {}, - "galleryDescription": { - "default": "default text for the source field", - "description": "gallery description", - "type": "string" - }, - "galleryItems": { - "description": "each gallery item", - "items": [ - { - "additionalProperties": false, - "properties": { - "firstImage": { - "default": false, - "description": "this is the first Image", - "type": "boolean" - }, - "imageDescription": { - "description": "image description", - "type": "string" - }, - "imageLink": { - "const": "text", - "description": "link for the image", - "type": "string" - }, - "picture": { - "additionalProperties": false, - "description": "select or upload image", - "properties": { - "format": { - "enum": [ - "desktop", - "mobile", - "square", - "square-ftedit", - "standard", - "standard-inline", - "wide" - ], - "type": "string" - }, - "height": { - "type": "number" - }, - "id": { - "type": "string" - }, - "sourceSet": { - "items": { - "additionalProperties": false, - "properties": { - "dpr": { - "type": "number" - }, - "url": { - "type": "string" - }, - "width": { - "type": "number" - } - }, - "required": [ - "dpr", - "url", - "width" - ], - "type": "object" - }, - "type": "array" - }, - "url": { - "type": "string" - }, - "width": { - "type": "number" - } - }, - "required": [ - "format", - "height", - "id", - "url", - "width" - ], - "type": "object" - } - }, - "required": [ - "firstImage" - ], - "type": "object" - } - ], - "maxItems": 1, - "minItems": 1, - "type": "array" - }, - "type": { - "const": "Gallery", - "type": "string" - } - }, - "required": [ - "galleryItems", - "type" - ], - "type": "object" - }, "ContentTree.transit.Video": { "additionalProperties": false, "properties": { diff --git a/schemas/unstable-body-blocks.schema.json b/schemas/unstable-body-block.schema.json similarity index 100% rename from schemas/unstable-body-blocks.schema.json rename to schemas/unstable-body-block.schema.json From 7c0c492a2bdb32890d16545b3b12d86c7a760387 Mon Sep 17 00:00:00 2001 From: lastHokage Date: Wed, 27 Aug 2025 13:30:13 +0100 Subject: [PATCH 3/9] feat: remove that extra file that we generated for the spark and use the --validationKeywords flag to add a sparkGenerateStoryblock to the gallery --- README.md | 3 + build.bash | 3 +- content-tree.d.ts | 12 +++ schemas/transit-tree.schema.json | 1 + schemas/unstable-body-block.schema.json | 119 ------------------------ 5 files changed, 17 insertions(+), 121 deletions(-) delete mode 100644 schemas/unstable-body-block.schema.json diff --git a/README.md b/README.md index a004d69..2ff0953 100644 --- a/README.md +++ b/README.md @@ -775,6 +775,9 @@ type galleryItem = { picture?: Image } +/** + * @sparkGenerateStoryblock true + */ interface Gallery extends Node { type: "Gallery" diff --git a/build.bash b/build.bash index 3c6ee6d..af2a750 100755 --- a/build.bash +++ b/build.bash @@ -2,8 +2,7 @@ node tools/maketypes content-tree.ts tsc -d content-tree.ts typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.full.Root > schemas/content-tree.schema.json -typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/transit-tree.schema.json +typescript-json-schema --validationKeywords sparkGenerateStoryblock --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/transit-tree.schema.json typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Body > schemas/body-tree.schema.json -typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.UnstableBodyBlock > schemas/unstable-body-block.schema.json rm content-tree.ts rm content-tree.js diff --git a/content-tree.d.ts b/content-tree.d.ts index 965fe4b..7689107 100644 --- a/content-tree.d.ts +++ b/content-tree.d.ts @@ -291,6 +291,9 @@ export declare namespace ContentTree { */ picture?: Image; }; + /** + * @sparkGenerateStoryblock true + */ interface Gallery extends Node { type: "Gallery"; /** @@ -603,6 +606,9 @@ export declare namespace ContentTree { */ picture?: Image; }; + /** + * @sparkGenerateStoryblock true + */ interface Gallery extends Node { type: "Gallery"; /** @@ -903,6 +909,9 @@ export declare namespace ContentTree { */ picture?: Image; }; + /** + * @sparkGenerateStoryblock true + */ interface Gallery extends Node { type: "Gallery"; /** @@ -1216,6 +1225,9 @@ export declare namespace ContentTree { */ picture?: Image; }; + /** + * @sparkGenerateStoryblock true + */ interface Gallery extends Node { type: "Gallery"; /** diff --git a/schemas/transit-tree.schema.json b/schemas/transit-tree.schema.json index dd9cdeb..17a63b4 100644 --- a/schemas/transit-tree.schema.json +++ b/schemas/transit-tree.schema.json @@ -414,6 +414,7 @@ "galleryItems", "type" ], + "sparkGenerateStoryblock": true, "type": "object" }, "ContentTree.transit.Heading": { diff --git a/schemas/unstable-body-block.schema.json b/schemas/unstable-body-block.schema.json deleted file mode 100644 index 041b7c6..0000000 --- a/schemas/unstable-body-block.schema.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "additionalProperties": false, - "properties": { - "autoPlay": { - "default": false, - "description": "autoplay the gallery", - "type": "boolean" - }, - "data": {}, - "galleryDescription": { - "default": "default text for the source field", - "description": "gallery description", - "type": "string" - }, - "galleryItems": { - "description": "each gallery item", - "items": [ - { - "additionalProperties": false, - "properties": { - "firstImage": { - "default": false, - "description": "this is the first Image", - "type": "boolean" - }, - "imageDescription": { - "description": "image description", - "type": "string" - }, - "imageLink": { - "const": "text", - "description": "link for the image", - "type": "string" - }, - "picture": { - "additionalProperties": false, - "description": "select or upload image", - "properties": { - "format": { - "enum": [ - "desktop", - "mobile", - "square", - "square-ftedit", - "standard", - "standard-inline", - "wide" - ], - "type": "string" - }, - "height": { - "type": "number" - }, - "id": { - "type": "string" - }, - "sourceSet": { - "items": { - "additionalProperties": false, - "properties": { - "dpr": { - "type": "number" - }, - "url": { - "type": "string" - }, - "width": { - "type": "number" - } - }, - "required": [ - "dpr", - "url", - "width" - ], - "type": "object" - }, - "type": "array" - }, - "url": { - "type": "string" - }, - "width": { - "type": "number" - } - }, - "required": [ - "format", - "height", - "id", - "url", - "width" - ], - "type": "object" - } - }, - "required": [ - "firstImage" - ], - "type": "object" - } - ], - "maxItems": 1, - "minItems": 1, - "type": "array" - }, - "type": { - "const": "Gallery", - "type": "string" - } - }, - "required": [ - "galleryItems", - "type" - ], - "type": "object" -} - From 5ca22de7e2419f89c8382a1080b3ac0839d6268f Mon Sep 17 00:00:00 2001 From: lastHokage Date: Tue, 9 Sep 2025 16:05:56 +0100 Subject: [PATCH 4/9] feat: remove the unstable and add the validationKeywords to the rest of the build scripts --- README.md | 11 +-- build.bash | 4 +- content-tree.d.ts | 20 +++--- schemas/body-tree.schema.json | 116 ++++++++++++++++--------------- schemas/content-tree.schema.json | 116 ++++++++++++++++--------------- schemas/transit-tree.schema.json | 115 +++++++++++++++--------------- 6 files changed, 191 insertions(+), 191 deletions(-) diff --git a/README.md b/README.md index 2ff0953..cc5e04f 100644 --- a/README.md +++ b/README.md @@ -105,18 +105,11 @@ type BodyBlock = | Tweet | Video | YoutubeVideo + | Gallery ``` `BodyBlock` nodes are the only things that are valid as the top level of a `Body`. -### UnstableBodyBlock - -```ts -type UnstableBodyBlock = Gallery ; -``` - -`UnstableBodyBlocks` nodes are also valid body blocks, but like, experimental. you can add more unstable nodes to this block like `UnstableGallery | UnstableComponent`. - ### `LayoutWidth` ```ts @@ -190,7 +183,7 @@ interface Root extends Node { interface Body extends Parent { type: "body" version: number - children: (BodyBlock | UnstableBodyBlock)[] + children: BodyBlock[] } ``` diff --git a/build.bash b/build.bash index af2a750..b24769f 100755 --- a/build.bash +++ b/build.bash @@ -1,8 +1,8 @@ #!/bin/bash node tools/maketypes content-tree.ts tsc -d content-tree.ts -typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.full.Root > schemas/content-tree.schema.json +typescript-json-schema --validationKeywords sparkGenerateStoryblock --noExtraProps --required content-tree.ts ContentTree.full.Root > schemas/content-tree.schema.json typescript-json-schema --validationKeywords sparkGenerateStoryblock --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/transit-tree.schema.json -typescript-json-schema --noExtraProps --required content-tree.ts ContentTree.transit.Body > schemas/body-tree.schema.json +typescript-json-schema --validationKeywords sparkGenerateStoryblock --noExtraProps --required content-tree.ts ContentTree.transit.Body > schemas/body-tree.schema.json rm content-tree.ts rm content-tree.js diff --git a/content-tree.d.ts b/content-tree.d.ts index 7689107..49d87fe 100644 --- a/content-tree.d.ts +++ b/content-tree.d.ts @@ -1,6 +1,5 @@ export declare namespace ContentTree { - type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo; - type UnstableBodyBlock = Gallery; + type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Gallery; 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 { @@ -17,7 +16,7 @@ export declare namespace ContentTree { interface Body extends Parent { type: "body"; version: number; - children: (BodyBlock | UnstableBodyBlock)[]; + children: BodyBlock[]; } interface Text extends Node { type: "text"; @@ -314,8 +313,7 @@ export declare namespace ContentTree { galleryItems: [galleryItem]; } namespace full { - type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo; - type UnstableBodyBlock = Gallery; + type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Gallery; 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 { @@ -332,7 +330,7 @@ export declare namespace ContentTree { interface Body extends Parent { type: "body"; version: number; - children: (BodyBlock | UnstableBodyBlock)[]; + children: BodyBlock[]; } interface Text extends Node { type: "text"; @@ -630,8 +628,7 @@ export declare namespace ContentTree { } } namespace transit { - type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo; - type UnstableBodyBlock = Gallery; + type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Gallery; 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 { @@ -648,7 +645,7 @@ export declare namespace ContentTree { interface Body extends Parent { type: "body"; version: number; - children: (BodyBlock | UnstableBodyBlock)[]; + children: BodyBlock[]; } interface Text extends Node { type: "text"; @@ -933,8 +930,7 @@ export declare namespace ContentTree { } } namespace loose { - type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo; - type UnstableBodyBlock = Gallery; + type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Gallery; 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 { @@ -951,7 +947,7 @@ export declare namespace ContentTree { interface Body extends Parent { type: "body"; version: number; - children: (BodyBlock | UnstableBodyBlock)[]; + children: BodyBlock[]; } interface Text extends Node { type: "text"; diff --git a/schemas/body-tree.schema.json b/schemas/body-tree.schema.json index 9e36366..2f12a30 100644 --- a/schemas/body-tree.schema.json +++ b/schemas/body-tree.schema.json @@ -67,6 +67,64 @@ ], "type": "object" }, + "ContentTree.transit.BodyBlock": { + "anyOf": [ + { + "$ref": "#/definitions/ContentTree.transit.Paragraph" + }, + { + "$ref": "#/definitions/ContentTree.transit.Heading" + }, + { + "$ref": "#/definitions/ContentTree.transit.ImageSet" + }, + { + "$ref": "#/definitions/ContentTree.transit.Flourish" + }, + { + "$ref": "#/definitions/ContentTree.transit.BigNumber" + }, + { + "$ref": "#/definitions/ContentTree.transit.CustomCodeComponent" + }, + { + "$ref": "#/definitions/ContentTree.transit.Layout" + }, + { + "$ref": "#/definitions/ContentTree.transit.List" + }, + { + "$ref": "#/definitions/ContentTree.transit.Blockquote" + }, + { + "$ref": "#/definitions/ContentTree.transit.Pullquote" + }, + { + "$ref": "#/definitions/ContentTree.transit.ScrollyBlock" + }, + { + "$ref": "#/definitions/ContentTree.transit.ThematicBreak" + }, + { + "$ref": "#/definitions/ContentTree.transit.Table" + }, + { + "$ref": "#/definitions/ContentTree.transit.Recommended" + }, + { + "$ref": "#/definitions/ContentTree.transit.Tweet" + }, + { + "$ref": "#/definitions/ContentTree.transit.Video" + }, + { + "$ref": "#/definitions/ContentTree.transit.YoutubeVideo" + }, + { + "$ref": "#/definitions/ContentTree.transit.Gallery" + } + ] + }, "ContentTree.transit.Break": { "additionalProperties": false, "properties": { @@ -334,6 +392,7 @@ "galleryItems", "type" ], + "sparkGenerateStoryblock": true, "type": "object" }, "ContentTree.transit.Heading": { @@ -1245,62 +1304,7 @@ "properties": { "children": { "items": { - "anyOf": [ - { - "$ref": "#/definitions/ContentTree.transit.Paragraph" - }, - { - "$ref": "#/definitions/ContentTree.transit.Heading" - }, - { - "$ref": "#/definitions/ContentTree.transit.ImageSet" - }, - { - "$ref": "#/definitions/ContentTree.transit.Flourish" - }, - { - "$ref": "#/definitions/ContentTree.transit.BigNumber" - }, - { - "$ref": "#/definitions/ContentTree.transit.CustomCodeComponent" - }, - { - "$ref": "#/definitions/ContentTree.transit.Layout" - }, - { - "$ref": "#/definitions/ContentTree.transit.List" - }, - { - "$ref": "#/definitions/ContentTree.transit.Blockquote" - }, - { - "$ref": "#/definitions/ContentTree.transit.Pullquote" - }, - { - "$ref": "#/definitions/ContentTree.transit.ScrollyBlock" - }, - { - "$ref": "#/definitions/ContentTree.transit.ThematicBreak" - }, - { - "$ref": "#/definitions/ContentTree.transit.Table" - }, - { - "$ref": "#/definitions/ContentTree.transit.Recommended" - }, - { - "$ref": "#/definitions/ContentTree.transit.Tweet" - }, - { - "$ref": "#/definitions/ContentTree.transit.Video" - }, - { - "$ref": "#/definitions/ContentTree.transit.YoutubeVideo" - }, - { - "$ref": "#/definitions/ContentTree.transit.Gallery" - } - ] + "$ref": "#/definitions/ContentTree.transit.BodyBlock" }, "type": "array" }, diff --git a/schemas/content-tree.schema.json b/schemas/content-tree.schema.json index 77fb1c7..a968742 100644 --- a/schemas/content-tree.schema.json +++ b/schemas/content-tree.schema.json @@ -72,62 +72,7 @@ "properties": { "children": { "items": { - "anyOf": [ - { - "$ref": "#/definitions/ContentTree.full.Paragraph" - }, - { - "$ref": "#/definitions/ContentTree.full.Heading" - }, - { - "$ref": "#/definitions/ContentTree.full.ImageSet" - }, - { - "$ref": "#/definitions/ContentTree.full.Flourish" - }, - { - "$ref": "#/definitions/ContentTree.full.BigNumber" - }, - { - "$ref": "#/definitions/ContentTree.full.CustomCodeComponent" - }, - { - "$ref": "#/definitions/ContentTree.full.Layout" - }, - { - "$ref": "#/definitions/ContentTree.full.List" - }, - { - "$ref": "#/definitions/ContentTree.full.Blockquote" - }, - { - "$ref": "#/definitions/ContentTree.full.Pullquote" - }, - { - "$ref": "#/definitions/ContentTree.full.ScrollyBlock" - }, - { - "$ref": "#/definitions/ContentTree.full.ThematicBreak" - }, - { - "$ref": "#/definitions/ContentTree.full.Table" - }, - { - "$ref": "#/definitions/ContentTree.full.Recommended" - }, - { - "$ref": "#/definitions/ContentTree.full.Tweet" - }, - { - "$ref": "#/definitions/ContentTree.full.Video" - }, - { - "$ref": "#/definitions/ContentTree.full.YoutubeVideo" - }, - { - "$ref": "#/definitions/ContentTree.full.Gallery" - } - ] + "$ref": "#/definitions/ContentTree.full.BodyBlock" }, "type": "array" }, @@ -147,6 +92,64 @@ ], "type": "object" }, + "ContentTree.full.BodyBlock": { + "anyOf": [ + { + "$ref": "#/definitions/ContentTree.full.Paragraph" + }, + { + "$ref": "#/definitions/ContentTree.full.Heading" + }, + { + "$ref": "#/definitions/ContentTree.full.ImageSet" + }, + { + "$ref": "#/definitions/ContentTree.full.Flourish" + }, + { + "$ref": "#/definitions/ContentTree.full.BigNumber" + }, + { + "$ref": "#/definitions/ContentTree.full.CustomCodeComponent" + }, + { + "$ref": "#/definitions/ContentTree.full.Layout" + }, + { + "$ref": "#/definitions/ContentTree.full.List" + }, + { + "$ref": "#/definitions/ContentTree.full.Blockquote" + }, + { + "$ref": "#/definitions/ContentTree.full.Pullquote" + }, + { + "$ref": "#/definitions/ContentTree.full.ScrollyBlock" + }, + { + "$ref": "#/definitions/ContentTree.full.ThematicBreak" + }, + { + "$ref": "#/definitions/ContentTree.full.Table" + }, + { + "$ref": "#/definitions/ContentTree.full.Recommended" + }, + { + "$ref": "#/definitions/ContentTree.full.Tweet" + }, + { + "$ref": "#/definitions/ContentTree.full.Video" + }, + { + "$ref": "#/definitions/ContentTree.full.YoutubeVideo" + }, + { + "$ref": "#/definitions/ContentTree.full.Gallery" + } + ] + }, "ContentTree.full.Break": { "additionalProperties": false, "properties": { @@ -440,6 +443,7 @@ "galleryItems", "type" ], + "sparkGenerateStoryblock": true, "type": "object" }, "ContentTree.full.Heading": { diff --git a/schemas/transit-tree.schema.json b/schemas/transit-tree.schema.json index 17a63b4..8de9e10 100644 --- a/schemas/transit-tree.schema.json +++ b/schemas/transit-tree.schema.json @@ -72,62 +72,7 @@ "properties": { "children": { "items": { - "anyOf": [ - { - "$ref": "#/definitions/ContentTree.transit.Paragraph" - }, - { - "$ref": "#/definitions/ContentTree.transit.Heading" - }, - { - "$ref": "#/definitions/ContentTree.transit.ImageSet" - }, - { - "$ref": "#/definitions/ContentTree.transit.Flourish" - }, - { - "$ref": "#/definitions/ContentTree.transit.BigNumber" - }, - { - "$ref": "#/definitions/ContentTree.transit.CustomCodeComponent" - }, - { - "$ref": "#/definitions/ContentTree.transit.Layout" - }, - { - "$ref": "#/definitions/ContentTree.transit.List" - }, - { - "$ref": "#/definitions/ContentTree.transit.Blockquote" - }, - { - "$ref": "#/definitions/ContentTree.transit.Pullquote" - }, - { - "$ref": "#/definitions/ContentTree.transit.ScrollyBlock" - }, - { - "$ref": "#/definitions/ContentTree.transit.ThematicBreak" - }, - { - "$ref": "#/definitions/ContentTree.transit.Table" - }, - { - "$ref": "#/definitions/ContentTree.transit.Recommended" - }, - { - "$ref": "#/definitions/ContentTree.transit.Tweet" - }, - { - "$ref": "#/definitions/ContentTree.transit.Video" - }, - { - "$ref": "#/definitions/ContentTree.transit.YoutubeVideo" - }, - { - "$ref": "#/definitions/ContentTree.transit.Gallery" - } - ] + "$ref": "#/definitions/ContentTree.transit.BodyBlock" }, "type": "array" }, @@ -147,6 +92,64 @@ ], "type": "object" }, + "ContentTree.transit.BodyBlock": { + "anyOf": [ + { + "$ref": "#/definitions/ContentTree.transit.Paragraph" + }, + { + "$ref": "#/definitions/ContentTree.transit.Heading" + }, + { + "$ref": "#/definitions/ContentTree.transit.ImageSet" + }, + { + "$ref": "#/definitions/ContentTree.transit.Flourish" + }, + { + "$ref": "#/definitions/ContentTree.transit.BigNumber" + }, + { + "$ref": "#/definitions/ContentTree.transit.CustomCodeComponent" + }, + { + "$ref": "#/definitions/ContentTree.transit.Layout" + }, + { + "$ref": "#/definitions/ContentTree.transit.List" + }, + { + "$ref": "#/definitions/ContentTree.transit.Blockquote" + }, + { + "$ref": "#/definitions/ContentTree.transit.Pullquote" + }, + { + "$ref": "#/definitions/ContentTree.transit.ScrollyBlock" + }, + { + "$ref": "#/definitions/ContentTree.transit.ThematicBreak" + }, + { + "$ref": "#/definitions/ContentTree.transit.Table" + }, + { + "$ref": "#/definitions/ContentTree.transit.Recommended" + }, + { + "$ref": "#/definitions/ContentTree.transit.Tweet" + }, + { + "$ref": "#/definitions/ContentTree.transit.Video" + }, + { + "$ref": "#/definitions/ContentTree.transit.YoutubeVideo" + }, + { + "$ref": "#/definitions/ContentTree.transit.Gallery" + } + ] + }, "ContentTree.transit.Break": { "additionalProperties": false, "properties": { From 7d882fc63d5ba26827d40f88d9d201974d074461 Mon Sep 17 00:00:00 2001 From: lastHokage Date: Thu, 11 Sep 2025 12:55:06 +0100 Subject: [PATCH 5/9] fix: remove exprimental and add a little bit of about the Gallery --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bb40998..4631c09 100644 --- a/README.md +++ b/README.md @@ -752,7 +752,7 @@ interface CustomCodeComponent extends Node { - The basic interface in Spark to make reference to this system above (eg. the git repo URL or a public S3 bucket), and provide some data for it if necessary. This will be the Custom Component storyblock. - The data Spark receives from entering a specific ID will be used to render dynamic fields (the `attributes`). -### ExperimentalGallery +### Gallery ```ts type galleryItem = { @@ -801,6 +801,13 @@ interface Gallery extends Node { galleryItems: [galleryItem] } ``` +- The **Gallery\*** is the first story block in Spark to be powered entirely by the schema-driven structure of the ContentTree system.Instead of hardcoding its configuration, Spark dynamically inspects the BodyBlock definition in the ContentTree schema and extracts all block types annotated with the @sparkGenerateStoryblock: true flag.These block definitions are automatically converted into ProseMirror node specs and injected into the editor's schema at runtime. The following ContentTree types are currently mapped to Spark components: + +- "string" → Rich text +- "text" → Text input +- "Image" → Responsive image container +- "Flourish" → Flourish chart +- "Video" → Video block ## License From cfdaac0900dbafed68ecb3d37f32f177a20d121f Mon Sep 17 00:00:00 2001 From: lastHokage Date: Mon, 6 Oct 2025 15:38:18 +0000 Subject: [PATCH 6/9] Update TypeScript definition file --- schemas/body-tree.schema.json | 14 +++++++------- schemas/content-tree.schema.json | 14 +++++++------- schemas/transit-tree.schema.json | 14 +++++++------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/schemas/body-tree.schema.json b/schemas/body-tree.schema.json index b7e8f9d..fe0ef73 100644 --- a/schemas/body-tree.schema.json +++ b/schemas/body-tree.schema.json @@ -223,6 +223,13 @@ ], "type": "object" }, + "ContentTree.transit.FlourishLayoutWidth": { + "enum": [ + "full-grid", + "in-line" + ], + "type": "string" + }, "ContentTree.transit.Gallery": { "additionalProperties": false, "properties": { @@ -341,13 +348,6 @@ "sparkGenerateStoryblock": true, "type": "object" }, - "ContentTree.transit.FlourishLayoutWidth": { - "enum": [ - "full-grid", - "in-line" - ], - "type": "string" - }, "ContentTree.transit.Heading": { "additionalProperties": false, "properties": { diff --git a/schemas/content-tree.schema.json b/schemas/content-tree.schema.json index b539ef1..df95b09 100644 --- a/schemas/content-tree.schema.json +++ b/schemas/content-tree.schema.json @@ -334,6 +334,13 @@ ], "type": "object" }, + "ContentTree.full.FlourishLayoutWidth": { + "enum": [ + "full-grid", + "in-line" + ], + "type": "string" + }, "ContentTree.full.Gallery": { "additionalProperties": false, "properties": { @@ -452,13 +459,6 @@ "sparkGenerateStoryblock": true, "type": "object" }, - "ContentTree.full.FlourishLayoutWidth": { - "enum": [ - "full-grid", - "in-line" - ], - "type": "string" - }, "ContentTree.full.Heading": { "additionalProperties": false, "properties": { diff --git a/schemas/transit-tree.schema.json b/schemas/transit-tree.schema.json index e3ac7a8..743bc35 100644 --- a/schemas/transit-tree.schema.json +++ b/schemas/transit-tree.schema.json @@ -248,6 +248,13 @@ ], "type": "object" }, + "ContentTree.transit.FlourishLayoutWidth": { + "enum": [ + "full-grid", + "in-line" + ], + "type": "string" + }, "ContentTree.transit.Gallery": { "additionalProperties": false, "properties": { @@ -366,13 +373,6 @@ "sparkGenerateStoryblock": true, "type": "object" }, - "ContentTree.transit.FlourishLayoutWidth": { - "enum": [ - "full-grid", - "in-line" - ], - "type": "string" - }, "ContentTree.transit.Heading": { "additionalProperties": false, "properties": { From d15969fed440f3676266f4c4d279567842bc9dae Mon Sep 17 00:00:00 2001 From: lastHokage Date: Wed, 5 Nov 2025 11:53:58 +0000 Subject: [PATCH 7/9] fix: add AudioPlayer for design team to play with it in spark --- README.md | 24 +++- content-tree.d.ts | 88 +++++++++++-- schemas/body-tree.schema.json | 214 ++++++++++++++++++------------- schemas/content-tree.schema.json | 214 ++++++++++++++++++------------- schemas/transit-tree.schema.json | 214 ++++++++++++++++++------------- server.js | 16 +++ 6 files changed, 491 insertions(+), 279 deletions(-) create mode 100644 server.js diff --git a/README.md b/README.md index 3b49d1b..1e9f882 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,7 @@ type BodyBlock = | YoutubeVideo | Text | Gallery + | AudioPlayer ``` `BodyBlock` nodes are the only things that are valid as the top level of a `Body`. @@ -804,7 +805,7 @@ interface Gallery extends Node { * @maxItems 10 * @minItems 1 */ - galleryItems: [galleryItem] + galleryItems: galleryItem[] } ``` - The **Gallery\*** is the first story block in Spark to be powered entirely by the schema-driven structure of the ContentTree system.Instead of hardcoding its configuration, Spark dynamically inspects the BodyBlock definition in the ContentTree schema and extracts all block types annotated with the @sparkGenerateStoryblock: true flag.These block definitions are automatically converted into ProseMirror node specs and injected into the editor's schema at runtime. The following ContentTree types are currently mapped to Spark components: @@ -815,6 +816,27 @@ interface Gallery extends Node { - "Flourish" → Flourish chart - "Video" → Video block + +```ts +/** + * @sparkGenerateStoryblock true + */ +interface AudioPlayer extends Node { + type: "AudioPlayer"; + /** + * @description Name of the Author + */ + author: "text"; + /** + * @description description of audio file + */ + description: "text"; + /** + * @description Url of the audio file + */ + audioFile: "text"; +} +``` ## License This software is published by the Financial Times under the [MIT licence](mit). diff --git a/content-tree.d.ts b/content-tree.d.ts index d42ed90..4dcff96 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 | Tweet | Video | YoutubeVideo | Text | Gallery; + type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Text | Gallery | AudioPlayer; 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 { @@ -317,10 +317,28 @@ export declare namespace ContentTree { * @maxItems 10 * @minItems 1 */ - galleryItems: [galleryItem]; + galleryItems: galleryItem[]; + } + /** + * @sparkGenerateStoryblock true + */ + interface AudioPlayer extends Node { + type: "AudioPlayer"; + /** + * @description Name of the Author + */ + author: "text"; + /** + * @description description of audio file + */ + description: "text"; + /** + * @description Url of the audio file + */ + audioFile: "text"; } namespace full { - type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Text | Gallery; + type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Text | Gallery | AudioPlayer; 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 { @@ -638,11 +656,29 @@ export declare namespace ContentTree { * @maxItems 10 * @minItems 1 */ - galleryItems: [galleryItem]; + galleryItems: galleryItem[]; + } + /** + * @sparkGenerateStoryblock true + */ + interface AudioPlayer extends Node { + type: "AudioPlayer"; + /** + * @description Name of the Author + */ + author: "text"; + /** + * @description description of audio file + */ + description: "text"; + /** + * @description Url of the audio file + */ + audioFile: "text"; } } namespace transit { - type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Text | Gallery; + type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Text | Gallery | AudioPlayer; 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 { @@ -945,11 +981,29 @@ export declare namespace ContentTree { * @maxItems 10 * @minItems 1 */ - galleryItems: [galleryItem]; + galleryItems: galleryItem[]; + } + /** + * @sparkGenerateStoryblock true + */ + interface AudioPlayer extends Node { + type: "AudioPlayer"; + /** + * @description Name of the Author + */ + author: "text"; + /** + * @description description of audio file + */ + description: "text"; + /** + * @description Url of the audio file + */ + audioFile: "text"; } } namespace loose { - type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Text | Gallery; + type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Text | Gallery | AudioPlayer; 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 { @@ -1267,7 +1321,25 @@ export declare namespace ContentTree { * @maxItems 10 * @minItems 1 */ - galleryItems: [galleryItem]; + galleryItems: galleryItem[]; + } + /** + * @sparkGenerateStoryblock true + */ + interface AudioPlayer extends Node { + type: "AudioPlayer"; + /** + * @description Name of the Author + */ + author: "text"; + /** + * @description description of audio file + */ + description: "text"; + /** + * @description Url of the audio file + */ + audioFile: "text"; } } } diff --git a/schemas/body-tree.schema.json b/schemas/body-tree.schema.json index b7e8f9d..4c98715 100644 --- a/schemas/body-tree.schema.json +++ b/schemas/body-tree.schema.json @@ -2,6 +2,39 @@ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { + "ContentTree.transit.AudioPlayer": { + "additionalProperties": false, + "properties": { + "audioFile": { + "const": "text", + "description": "Url of the audio file", + "type": "string" + }, + "author": { + "const": "text", + "description": "Name of the Author", + "type": "string" + }, + "data": {}, + "description": { + "const": "text", + "description": "description of audio file", + "type": "string" + }, + "type": { + "const": "AudioPlayer", + "type": "string" + } + }, + "required": [ + "audioFile", + "author", + "description", + "type" + ], + "sparkGenerateStoryblock": true, + "type": "object" + }, "ContentTree.transit.BigNumber": { "additionalProperties": false, "properties": { @@ -125,6 +158,9 @@ }, { "$ref": "#/definitions/ContentTree.transit.Gallery" + }, + { + "$ref": "#/definitions/ContentTree.transit.AudioPlayer" } ] }, @@ -223,6 +259,13 @@ ], "type": "object" }, + "ContentTree.transit.FlourishLayoutWidth": { + "enum": [ + "full-grid", + "in-line" + ], + "type": "string" + }, "ContentTree.transit.Gallery": { "additionalProperties": false, "properties": { @@ -239,93 +282,91 @@ }, "galleryItems": { "description": "each gallery item", - "items": [ - { - "additionalProperties": false, - "properties": { - "firstImage": { - "default": false, - "description": "this is the first Image", - "type": "boolean" - }, - "imageDescription": { - "description": "image description", - "type": "string" - }, - "imageLink": { - "const": "text", - "description": "link for the image", - "type": "string" - }, - "picture": { - "additionalProperties": false, - "description": "select or upload image", - "properties": { - "format": { - "enum": [ - "desktop", - "mobile", - "square", - "square-ftedit", - "standard", - "standard-inline", - "wide" - ], - "type": "string" - }, - "height": { - "type": "number" - }, - "id": { - "type": "string" - }, - "sourceSet": { - "items": { - "additionalProperties": false, - "properties": { - "dpr": { - "type": "number" - }, - "url": { - "type": "string" - }, - "width": { - "type": "number" - } + "items": { + "additionalProperties": false, + "properties": { + "firstImage": { + "default": false, + "description": "this is the first Image", + "type": "boolean" + }, + "imageDescription": { + "description": "image description", + "type": "string" + }, + "imageLink": { + "const": "text", + "description": "link for the image", + "type": "string" + }, + "picture": { + "additionalProperties": false, + "description": "select or upload image", + "properties": { + "format": { + "enum": [ + "desktop", + "mobile", + "square", + "square-ftedit", + "standard", + "standard-inline", + "wide" + ], + "type": "string" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "sourceSet": { + "items": { + "additionalProperties": false, + "properties": { + "dpr": { + "type": "number" }, - "required": [ - "dpr", - "url", - "width" - ], - "type": "object" + "url": { + "type": "string" + }, + "width": { + "type": "number" + } }, - "type": "array" - }, - "url": { - "type": "string" + "required": [ + "dpr", + "url", + "width" + ], + "type": "object" }, - "width": { - "type": "number" - } + "type": "array" }, - "required": [ - "format", - "height", - "id", - "url", - "width" - ], - "type": "object" - } - }, - "required": [ - "firstImage" - ], - "type": "object" - } - ], - "maxItems": 1, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "format", + "height", + "id", + "url", + "width" + ], + "type": "object" + } + }, + "required": [ + "firstImage" + ], + "type": "object" + }, + "maxItems": 10, "minItems": 1, "type": "array" }, @@ -341,13 +382,6 @@ "sparkGenerateStoryblock": true, "type": "object" }, - "ContentTree.transit.FlourishLayoutWidth": { - "enum": [ - "full-grid", - "in-line" - ], - "type": "string" - }, "ContentTree.transit.Heading": { "additionalProperties": false, "properties": { diff --git a/schemas/content-tree.schema.json b/schemas/content-tree.schema.json index b539ef1..0fb4211 100644 --- a/schemas/content-tree.schema.json +++ b/schemas/content-tree.schema.json @@ -2,6 +2,39 @@ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { + "ContentTree.full.AudioPlayer": { + "additionalProperties": false, + "properties": { + "audioFile": { + "const": "text", + "description": "Url of the audio file", + "type": "string" + }, + "author": { + "const": "text", + "description": "Name of the Author", + "type": "string" + }, + "data": {}, + "description": { + "const": "text", + "description": "description of audio file", + "type": "string" + }, + "type": { + "const": "AudioPlayer", + "type": "string" + } + }, + "required": [ + "audioFile", + "author", + "description", + "type" + ], + "sparkGenerateStoryblock": true, + "type": "object" + }, "ContentTree.full.BigNumber": { "additionalProperties": false, "properties": { @@ -150,6 +183,9 @@ }, { "$ref": "#/definitions/ContentTree.full.Gallery" + }, + { + "$ref": "#/definitions/ContentTree.full.AudioPlayer" } ] }, @@ -334,6 +370,13 @@ ], "type": "object" }, + "ContentTree.full.FlourishLayoutWidth": { + "enum": [ + "full-grid", + "in-line" + ], + "type": "string" + }, "ContentTree.full.Gallery": { "additionalProperties": false, "properties": { @@ -350,93 +393,91 @@ }, "galleryItems": { "description": "each gallery item", - "items": [ - { - "additionalProperties": false, - "properties": { - "firstImage": { - "default": false, - "description": "this is the first Image", - "type": "boolean" - }, - "imageDescription": { - "description": "image description", - "type": "string" - }, - "imageLink": { - "const": "text", - "description": "link for the image", - "type": "string" - }, - "picture": { - "additionalProperties": false, - "description": "select or upload image", - "properties": { - "format": { - "enum": [ - "desktop", - "mobile", - "square", - "square-ftedit", - "standard", - "standard-inline", - "wide" - ], - "type": "string" - }, - "height": { - "type": "number" - }, - "id": { - "type": "string" - }, - "sourceSet": { - "items": { - "additionalProperties": false, - "properties": { - "dpr": { - "type": "number" - }, - "url": { - "type": "string" - }, - "width": { - "type": "number" - } + "items": { + "additionalProperties": false, + "properties": { + "firstImage": { + "default": false, + "description": "this is the first Image", + "type": "boolean" + }, + "imageDescription": { + "description": "image description", + "type": "string" + }, + "imageLink": { + "const": "text", + "description": "link for the image", + "type": "string" + }, + "picture": { + "additionalProperties": false, + "description": "select or upload image", + "properties": { + "format": { + "enum": [ + "desktop", + "mobile", + "square", + "square-ftedit", + "standard", + "standard-inline", + "wide" + ], + "type": "string" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "sourceSet": { + "items": { + "additionalProperties": false, + "properties": { + "dpr": { + "type": "number" }, - "required": [ - "dpr", - "url", - "width" - ], - "type": "object" + "url": { + "type": "string" + }, + "width": { + "type": "number" + } }, - "type": "array" - }, - "url": { - "type": "string" + "required": [ + "dpr", + "url", + "width" + ], + "type": "object" }, - "width": { - "type": "number" - } + "type": "array" }, - "required": [ - "format", - "height", - "id", - "url", - "width" - ], - "type": "object" - } - }, - "required": [ - "firstImage" - ], - "type": "object" - } - ], - "maxItems": 1, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "format", + "height", + "id", + "url", + "width" + ], + "type": "object" + } + }, + "required": [ + "firstImage" + ], + "type": "object" + }, + "maxItems": 10, "minItems": 1, "type": "array" }, @@ -452,13 +493,6 @@ "sparkGenerateStoryblock": true, "type": "object" }, - "ContentTree.full.FlourishLayoutWidth": { - "enum": [ - "full-grid", - "in-line" - ], - "type": "string" - }, "ContentTree.full.Heading": { "additionalProperties": false, "properties": { diff --git a/schemas/transit-tree.schema.json b/schemas/transit-tree.schema.json index e3ac7a8..51732ca 100644 --- a/schemas/transit-tree.schema.json +++ b/schemas/transit-tree.schema.json @@ -2,6 +2,39 @@ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { + "ContentTree.transit.AudioPlayer": { + "additionalProperties": false, + "properties": { + "audioFile": { + "const": "text", + "description": "Url of the audio file", + "type": "string" + }, + "author": { + "const": "text", + "description": "Name of the Author", + "type": "string" + }, + "data": {}, + "description": { + "const": "text", + "description": "description of audio file", + "type": "string" + }, + "type": { + "const": "AudioPlayer", + "type": "string" + } + }, + "required": [ + "audioFile", + "author", + "description", + "type" + ], + "sparkGenerateStoryblock": true, + "type": "object" + }, "ContentTree.transit.BigNumber": { "additionalProperties": false, "properties": { @@ -150,6 +183,9 @@ }, { "$ref": "#/definitions/ContentTree.transit.Gallery" + }, + { + "$ref": "#/definitions/ContentTree.transit.AudioPlayer" } ] }, @@ -248,6 +284,13 @@ ], "type": "object" }, + "ContentTree.transit.FlourishLayoutWidth": { + "enum": [ + "full-grid", + "in-line" + ], + "type": "string" + }, "ContentTree.transit.Gallery": { "additionalProperties": false, "properties": { @@ -264,93 +307,91 @@ }, "galleryItems": { "description": "each gallery item", - "items": [ - { - "additionalProperties": false, - "properties": { - "firstImage": { - "default": false, - "description": "this is the first Image", - "type": "boolean" - }, - "imageDescription": { - "description": "image description", - "type": "string" - }, - "imageLink": { - "const": "text", - "description": "link for the image", - "type": "string" - }, - "picture": { - "additionalProperties": false, - "description": "select or upload image", - "properties": { - "format": { - "enum": [ - "desktop", - "mobile", - "square", - "square-ftedit", - "standard", - "standard-inline", - "wide" - ], - "type": "string" - }, - "height": { - "type": "number" - }, - "id": { - "type": "string" - }, - "sourceSet": { - "items": { - "additionalProperties": false, - "properties": { - "dpr": { - "type": "number" - }, - "url": { - "type": "string" - }, - "width": { - "type": "number" - } + "items": { + "additionalProperties": false, + "properties": { + "firstImage": { + "default": false, + "description": "this is the first Image", + "type": "boolean" + }, + "imageDescription": { + "description": "image description", + "type": "string" + }, + "imageLink": { + "const": "text", + "description": "link for the image", + "type": "string" + }, + "picture": { + "additionalProperties": false, + "description": "select or upload image", + "properties": { + "format": { + "enum": [ + "desktop", + "mobile", + "square", + "square-ftedit", + "standard", + "standard-inline", + "wide" + ], + "type": "string" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "sourceSet": { + "items": { + "additionalProperties": false, + "properties": { + "dpr": { + "type": "number" }, - "required": [ - "dpr", - "url", - "width" - ], - "type": "object" + "url": { + "type": "string" + }, + "width": { + "type": "number" + } }, - "type": "array" - }, - "url": { - "type": "string" + "required": [ + "dpr", + "url", + "width" + ], + "type": "object" }, - "width": { - "type": "number" - } + "type": "array" }, - "required": [ - "format", - "height", - "id", - "url", - "width" - ], - "type": "object" - } - }, - "required": [ - "firstImage" - ], - "type": "object" - } - ], - "maxItems": 1, + "url": { + "type": "string" + }, + "width": { + "type": "number" + } + }, + "required": [ + "format", + "height", + "id", + "url", + "width" + ], + "type": "object" + } + }, + "required": [ + "firstImage" + ], + "type": "object" + }, + "maxItems": 10, "minItems": 1, "type": "array" }, @@ -366,13 +407,6 @@ "sparkGenerateStoryblock": true, "type": "object" }, - "ContentTree.transit.FlourishLayoutWidth": { - "enum": [ - "full-grid", - "in-line" - ], - "type": "string" - }, "ContentTree.transit.Heading": { "additionalProperties": false, "properties": { diff --git a/server.js b/server.js new file mode 100644 index 0000000..da4c5cf --- /dev/null +++ b/server.js @@ -0,0 +1,16 @@ +const http = require('http'); +const jsonFile = require('./schemas/content-tree.schema.json') + +const server = http.createServer((req, res) => { + if (req.url === '/content-tree' && req.method === 'GET') { + res.writeHead(200, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify(jsonFile, null, 2)); + } else { + res.writeHead(404); + res.end(); + } +}); + +server.listen(3000, () => { + console.log('Server running at http://localhost:5000'); +}); From 1f51c45cd4a26224ac48727a804236f0384aa56b Mon Sep 17 00:00:00 2001 From: Andy Little Date: Tue, 16 Dec 2025 10:34:45 +0000 Subject: [PATCH 8/9] update beta component definitions based on SP-5621 --- README.md | 8 ++++---- content-tree.d.ts | 32 ++++++++++++++++---------------- schemas/body-tree.schema.json | 7 ++----- schemas/content-tree.schema.json | 7 ++----- schemas/transit-tree.schema.json | 7 ++----- 5 files changed, 26 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 1e9f882..3941f55 100644 --- a/README.md +++ b/README.md @@ -793,7 +793,7 @@ interface Gallery extends Node { * @description gallery description * @default default text for the source field */ - galleryDescription?: string + galleryDescription?: Paragraph /** * @description autoplay the gallery * @default false @@ -826,15 +826,15 @@ interface AudioPlayer extends Node { /** * @description Name of the Author */ - author: "text"; + author: string; /** * @description description of audio file */ - description: "text"; + description: string; /** * @description Url of the audio file */ - audioFile: "text"; + audioFile: string; } ``` ## License diff --git a/content-tree.d.ts b/content-tree.d.ts index 4dcff96..b457d9b 100644 --- a/content-tree.d.ts +++ b/content-tree.d.ts @@ -306,7 +306,7 @@ export declare namespace ContentTree { * @description gallery description * @default default text for the source field */ - galleryDescription?: string; + galleryDescription?: Paragraph; /** * @description autoplay the gallery * @default false @@ -327,15 +327,15 @@ export declare namespace ContentTree { /** * @description Name of the Author */ - author: "text"; + author: string; /** * @description description of audio file */ - description: "text"; + description: string; /** * @description Url of the audio file */ - audioFile: "text"; + audioFile: string; } namespace full { type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Text | Gallery | AudioPlayer; @@ -645,7 +645,7 @@ export declare namespace ContentTree { * @description gallery description * @default default text for the source field */ - galleryDescription?: string; + galleryDescription?: Paragraph; /** * @description autoplay the gallery * @default false @@ -666,15 +666,15 @@ export declare namespace ContentTree { /** * @description Name of the Author */ - author: "text"; + author: string; /** * @description description of audio file */ - description: "text"; + description: string; /** * @description Url of the audio file */ - audioFile: "text"; + audioFile: string; } } namespace transit { @@ -970,7 +970,7 @@ export declare namespace ContentTree { * @description gallery description * @default default text for the source field */ - galleryDescription?: string; + galleryDescription?: Paragraph; /** * @description autoplay the gallery * @default false @@ -991,15 +991,15 @@ export declare namespace ContentTree { /** * @description Name of the Author */ - author: "text"; + author: string; /** * @description description of audio file */ - description: "text"; + description: string; /** * @description Url of the audio file */ - audioFile: "text"; + audioFile: string; } } namespace loose { @@ -1310,7 +1310,7 @@ export declare namespace ContentTree { * @description gallery description * @default default text for the source field */ - galleryDescription?: string; + galleryDescription?: Paragraph; /** * @description autoplay the gallery * @default false @@ -1331,15 +1331,15 @@ export declare namespace ContentTree { /** * @description Name of the Author */ - author: "text"; + author: string; /** * @description description of audio file */ - description: "text"; + description: string; /** * @description Url of the audio file */ - audioFile: "text"; + audioFile: string; } } } diff --git a/schemas/body-tree.schema.json b/schemas/body-tree.schema.json index 4c98715..bb591b5 100644 --- a/schemas/body-tree.schema.json +++ b/schemas/body-tree.schema.json @@ -6,18 +6,15 @@ "additionalProperties": false, "properties": { "audioFile": { - "const": "text", "description": "Url of the audio file", "type": "string" }, "author": { - "const": "text", "description": "Name of the Author", "type": "string" }, "data": {}, "description": { - "const": "text", "description": "description of audio file", "type": "string" }, @@ -276,9 +273,9 @@ }, "data": {}, "galleryDescription": { + "$ref": "#/definitions/ContentTree.transit.Paragraph", "default": "default text for the source field", - "description": "gallery description", - "type": "string" + "description": "gallery description" }, "galleryItems": { "description": "each gallery item", diff --git a/schemas/content-tree.schema.json b/schemas/content-tree.schema.json index 0fb4211..5eec65e 100644 --- a/schemas/content-tree.schema.json +++ b/schemas/content-tree.schema.json @@ -6,18 +6,15 @@ "additionalProperties": false, "properties": { "audioFile": { - "const": "text", "description": "Url of the audio file", "type": "string" }, "author": { - "const": "text", "description": "Name of the Author", "type": "string" }, "data": {}, "description": { - "const": "text", "description": "description of audio file", "type": "string" }, @@ -387,9 +384,9 @@ }, "data": {}, "galleryDescription": { + "$ref": "#/definitions/ContentTree.full.Paragraph", "default": "default text for the source field", - "description": "gallery description", - "type": "string" + "description": "gallery description" }, "galleryItems": { "description": "each gallery item", diff --git a/schemas/transit-tree.schema.json b/schemas/transit-tree.schema.json index 51732ca..b26071f 100644 --- a/schemas/transit-tree.schema.json +++ b/schemas/transit-tree.schema.json @@ -6,18 +6,15 @@ "additionalProperties": false, "properties": { "audioFile": { - "const": "text", "description": "Url of the audio file", "type": "string" }, "author": { - "const": "text", "description": "Name of the Author", "type": "string" }, "data": {}, "description": { - "const": "text", "description": "description of audio file", "type": "string" }, @@ -301,9 +298,9 @@ }, "data": {}, "galleryDescription": { + "$ref": "#/definitions/ContentTree.transit.Paragraph", "default": "default text for the source field", - "description": "gallery description", - "type": "string" + "description": "gallery description" }, "galleryItems": { "description": "each gallery item", From 3f3fe9a2ab0046d2cf7cfdd701b0d80f1d172876 Mon Sep 17 00:00:00 2001 From: Andy Little Date: Wed, 7 Jan 2026 14:14:00 +0000 Subject: [PATCH 9/9] update audio player --- README.md | 9 +++----- build.bash | 2 +- content-tree.d.ts | 36 +++++++++++--------------------- schemas/body-tree.schema.json | 11 +++------- schemas/content-tree.schema.json | 11 +++------- schemas/transit-tree.schema.json | 12 ++++------- 6 files changed, 26 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 3941f55..053c8c9 100644 --- a/README.md +++ b/README.md @@ -828,13 +828,10 @@ interface AudioPlayer extends Node { */ author: string; /** - * @description description of audio file + * @sparkUploadField true + * @description url of audio file */ - description: string; - /** - * @description Url of the audio file - */ - audioFile: string; + audioUrl: string; } ``` ## License diff --git a/build.bash b/build.bash index b24769f..b20b104 100755 --- a/build.bash +++ b/build.bash @@ -2,7 +2,7 @@ node tools/maketypes content-tree.ts tsc -d content-tree.ts typescript-json-schema --validationKeywords sparkGenerateStoryblock --noExtraProps --required content-tree.ts ContentTree.full.Root > schemas/content-tree.schema.json -typescript-json-schema --validationKeywords sparkGenerateStoryblock --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/transit-tree.schema.json +typescript-json-schema --validationKeywords sparkGenerateStoryblock sparkUploadField --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/transit-tree.schema.json typescript-json-schema --validationKeywords sparkGenerateStoryblock --noExtraProps --required content-tree.ts ContentTree.transit.Body > schemas/body-tree.schema.json rm content-tree.ts rm content-tree.js diff --git a/content-tree.d.ts b/content-tree.d.ts index b457d9b..3f420dc 100644 --- a/content-tree.d.ts +++ b/content-tree.d.ts @@ -329,13 +329,10 @@ export declare namespace ContentTree { */ author: string; /** - * @description description of audio file + * @sparkUploadField true + * @description url of audio file */ - description: string; - /** - * @description Url of the audio file - */ - audioFile: string; + audioUrl: string; } namespace full { type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | Tweet | Video | YoutubeVideo | Text | Gallery | AudioPlayer; @@ -668,13 +665,10 @@ export declare namespace ContentTree { */ author: string; /** - * @description description of audio file - */ - description: string; - /** - * @description Url of the audio file + * @sparkUploadField true + * @description url of audio file */ - audioFile: string; + audioUrl: string; } } namespace transit { @@ -993,13 +987,10 @@ export declare namespace ContentTree { */ author: string; /** - * @description description of audio file + * @sparkUploadField true + * @description url of audio file */ - description: string; - /** - * @description Url of the audio file - */ - audioFile: string; + audioUrl: string; } } namespace loose { @@ -1333,13 +1324,10 @@ export declare namespace ContentTree { */ author: string; /** - * @description description of audio file - */ - description: string; - /** - * @description Url of the audio file + * @sparkUploadField true + * @description url of audio file */ - audioFile: string; + audioUrl: string; } } } diff --git a/schemas/body-tree.schema.json b/schemas/body-tree.schema.json index bb591b5..82fe898 100644 --- a/schemas/body-tree.schema.json +++ b/schemas/body-tree.schema.json @@ -5,8 +5,8 @@ "ContentTree.transit.AudioPlayer": { "additionalProperties": false, "properties": { - "audioFile": { - "description": "Url of the audio file", + "audioUrl": { + "description": "url of audio file", "type": "string" }, "author": { @@ -14,19 +14,14 @@ "type": "string" }, "data": {}, - "description": { - "description": "description of audio file", - "type": "string" - }, "type": { "const": "AudioPlayer", "type": "string" } }, "required": [ - "audioFile", + "audioUrl", "author", - "description", "type" ], "sparkGenerateStoryblock": true, diff --git a/schemas/content-tree.schema.json b/schemas/content-tree.schema.json index 5eec65e..b185fdf 100644 --- a/schemas/content-tree.schema.json +++ b/schemas/content-tree.schema.json @@ -5,8 +5,8 @@ "ContentTree.full.AudioPlayer": { "additionalProperties": false, "properties": { - "audioFile": { - "description": "Url of the audio file", + "audioUrl": { + "description": "url of audio file", "type": "string" }, "author": { @@ -14,19 +14,14 @@ "type": "string" }, "data": {}, - "description": { - "description": "description of audio file", - "type": "string" - }, "type": { "const": "AudioPlayer", "type": "string" } }, "required": [ - "audioFile", + "audioUrl", "author", - "description", "type" ], "sparkGenerateStoryblock": true, diff --git a/schemas/transit-tree.schema.json b/schemas/transit-tree.schema.json index b26071f..907fb44 100644 --- a/schemas/transit-tree.schema.json +++ b/schemas/transit-tree.schema.json @@ -5,8 +5,9 @@ "ContentTree.transit.AudioPlayer": { "additionalProperties": false, "properties": { - "audioFile": { - "description": "Url of the audio file", + "audioUrl": { + "description": "url of audio file", + "sparkUploadField": true, "type": "string" }, "author": { @@ -14,19 +15,14 @@ "type": "string" }, "data": {}, - "description": { - "description": "description of audio file", - "type": "string" - }, "type": { "const": "AudioPlayer", "type": "string" } }, "required": [ - "audioFile", + "audioUrl", "author", - "description", "type" ], "sparkGenerateStoryblock": true,