From 1d9ecb2298af9d8cc3287bffecf7ac7f0417cc3e Mon Sep 17 00:00:00 2001 From: Andy Little Date: Tue, 3 Feb 2026 10:38:45 +0000 Subject: [PATCH 1/5] WIP --- SPEC.md | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/SPEC.md b/SPEC.md index f172113..6168af0 100644 --- a/SPEC.md +++ b/SPEC.md @@ -859,9 +859,36 @@ interface InfoPair extends Parent { } ``` +### AudioPlayer +```ts + /** + * @sparkGenerateStoryblock true + **/ + type AudioPlayer = AudioPlayerV1 | AudioPlayerV2 | AudioPlayerV3; +interface AudioPlayerV1 extends Node { + type: "audio-player" + version: 1 + title: string + audioUrl: string +} +interface AudioPlayerV2 extends Node { + type: "audio-player" + version: 2 + title: string + audioId: string + external audio: AudioSet +} - - +interface AudioPlayerV3 extends Node { + type: "audio-player" + version: 3 + title: string + audioId: string + transcriptionId?: string + external audio: AudioSet + external transcription: TranscriptionSet +} +``` From 9e1b070ffe3c9a4c679f057f5bbc5276861db87e Mon Sep 17 00:00:00 2001 From: Andy Little Date: Wed, 4 Feb 2026 08:55:22 +0000 Subject: [PATCH 2/5] add support metadata --- SPEC.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SPEC.md b/SPEC.md index 6168af0..e83bd54 100644 --- a/SPEC.md +++ b/SPEC.md @@ -867,6 +867,7 @@ interface InfoPair extends Parent { **/ type AudioPlayer = AudioPlayerV1 | AudioPlayerV2 | AudioPlayerV3; +/** @support deprecated */ interface AudioPlayerV1 extends Node { type: "audio-player" version: 1 @@ -882,13 +883,14 @@ interface AudioPlayerV2 extends Node { external audio: AudioSet } +/** @support prerelease */ interface AudioPlayerV3 extends Node { type: "audio-player" version: 3 title: string audioId: string - transcriptionId?: string + transcriptionId: string external audio: AudioSet - external transcription: TranscriptionSet + external transcription: Transcription } ``` From b204d470f774f71d174d552a5957487abb7f332c Mon Sep 17 00:00:00 2001 From: Andy Little Date: Wed, 4 Feb 2026 08:57:51 +0000 Subject: [PATCH 3/5] update build script for demo purposes --- build.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.bash b/build.bash index f8e3fe3..4a7327d 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 --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 support sparkGenerateStoryblock --noExtraProps --required content-tree.ts ContentTree.full.Root > schemas/content-tree.schema.json +typescript-json-schema --validationKeywords support sparkGenerateStoryblock --noExtraProps --required content-tree.ts ContentTree.transit.Root > schemas/transit-tree.schema.json +typescript-json-schema --validationKeywords support sparkGenerateStoryblock --noExtraProps --required content-tree.ts ContentTree.transit.Body > schemas/body-tree.schema.json rm content-tree.ts rm content-tree.js From ee684aca04675e11f0a49921e60e803ef131a946 Mon Sep 17 00:00:00 2001 From: Andy Little Date: Wed, 4 Feb 2026 11:12:06 +0000 Subject: [PATCH 4/5] add undefined types so that demo is compilable --- SPEC.md | 14 + content-tree.d.ts | 675 +++++++++++++++++++------------ schemas/body-tree.schema.json | 96 +++++ schemas/content-tree.schema.json | 143 +++++++ schemas/transit-tree.schema.json | 96 +++++ 5 files changed, 761 insertions(+), 263 deletions(-) diff --git a/SPEC.md b/SPEC.md index e83bd54..31313c4 100644 --- a/SPEC.md +++ b/SPEC.md @@ -300,6 +300,7 @@ type StoryBlock = | Definition | InfoBox | InfoPair + | AudioPlayer ``` `StoryBlock` nodes are things that can be inserted into an article body. @@ -894,3 +895,16 @@ interface AudioPlayerV3 extends Node { external transcription: Transcription } ``` + +```ts +/** + * Demo placeholders so the AudioPlayer versioning example compiles. + */ +interface AudioSet extends Node { + url: string +} + +interface Transcription extends Node { + text: string +} +``` diff --git a/content-tree.d.ts b/content-tree.d.ts index 9e3c4b1..43bb236 100644 --- a/content-tree.d.ts +++ b/content-tree.d.ts @@ -1,94 +1,94 @@ export declare namespace ContentTree { - type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; - interface Node { + export type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; + export interface Node { type: string; data?: any; } - interface Parent extends Node { + export interface Parent extends Node { children: Node[]; } - interface Root extends Node { + export interface Root extends Node { type: "root"; body: Body; } - interface Body extends Parent { + export interface Body extends Parent { type: "body"; version: number; children: BodyBlock[]; } - type BodyBlock = FormattingBlock | StoryBlock; - type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; - interface Text extends Node { + export type BodyBlock = FormattingBlock | StoryBlock; + export type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; + export interface Text extends Node { type: "text"; value: string; } - type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; - interface Break extends Node { + export type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; + export interface Break extends Node { type: "break"; } - interface ThematicBreak extends Node { + export interface ThematicBreak extends Node { type: "thematic-break"; } - interface Paragraph extends Parent { + export interface Paragraph extends Parent { type: "paragraph"; children: Phrasing[]; } - interface Heading extends Parent { + export interface Heading extends Parent { type: "heading"; children: Text[]; level: "chapter" | "subheading" | "label"; fragmentIdentifier?: string; } - interface Strong extends Parent { + export interface Strong extends Parent { type: "strong"; children: Phrasing[]; } - interface Emphasis extends Parent { + export interface Emphasis extends Parent { type: "emphasis"; children: Phrasing[]; } - interface Strikethrough extends Parent { + export interface Strikethrough extends Parent { type: "strikethrough"; children: Phrasing[]; } - interface Link extends Parent { + export interface Link extends Parent { type: "link"; url: string; title: string; children: Phrasing[]; } - interface FindOutMoreLink extends Parent { + export interface FindOutMoreLink extends Parent { type: "find-out-more-link"; url: string; title: string; children: Phrasing[]; } - interface List extends Parent { + export interface List extends Parent { type: "list"; ordered: boolean; children: ListItem[]; } - interface ListItem extends Parent { + export interface ListItem extends Parent { type: "list-item"; children: (Paragraph | Phrasing)[]; } - interface Blockquote extends Parent { + export interface Blockquote extends Parent { type: "blockquote"; children: (Paragraph | Phrasing)[]; } - type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair; - interface Pullquote extends Node { + export type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | AudioPlayer; + export interface Pullquote extends Node { type: "pullquote"; text: string; source?: string; } - interface ImageSet extends Node { + export interface ImageSet extends Node { type: "image-set"; id: string; picture: ImageSetPicture; fragmentIdentifier?: string; } - type ImageSetPicture = { + export type ImageSetPicture = { layoutWidth: string; imageType: "image" | "graphic"; alt: string; @@ -97,7 +97,7 @@ export declare namespace ContentTree { images: Image[]; fallbackImage: Image; }; - type Image = { + export type Image = { id: string; width: number; height: number; @@ -105,24 +105,24 @@ export declare namespace ContentTree { url: string; sourceSet?: ImageSource[]; }; - type ImageSource = { + export type ImageSource = { url: string; width: number; dpr: number; }; - interface Recommended extends Node { + export interface Recommended extends Node { type: "recommended"; id: string; heading?: string; teaserTitleOverride?: string; teaser: Teaser; } - interface RecommendedList extends Node { + export interface RecommendedList extends Node { type: "recommended-list"; heading?: string; children: Recommended[]; } - type TeaserConcept = { + export type TeaserConcept = { apiUrl: string; directType: string; id: string; @@ -132,7 +132,7 @@ export declare namespace ContentTree { types: string[]; url: string; }; - type Teaser = { + export type Teaser = { id: string; url: string; type: "article" | "video" | "podcast" | "audio" | "package" | "liveblog" | "promoted-content" | "paid-post"; @@ -159,13 +159,13 @@ export declare namespace ContentTree { }; clientName?: string; }; - interface Tweet extends Node { + export interface Tweet extends Node { id: string; type: "tweet"; html: string; } - type FlourishLayoutWidth = Extract; - interface Flourish extends Node { + export type FlourishLayoutWidth = Extract; + export interface Flourish extends Node { type: "flourish"; id: string; layoutWidth: FlourishLayoutWidth; @@ -175,26 +175,26 @@ export declare namespace ContentTree { fallbackImage?: Image; fragmentIdentifier?: string; } - interface BigNumber extends Node { + export interface BigNumber extends Node { type: "big-number"; number: string; description: string; } - interface Video extends Node { + export interface Video extends Node { type: "video"; id: string; title: string; } - interface YoutubeVideo extends Node { + export interface YoutubeVideo extends Node { type: "youtube-video"; url: string; } - interface ScrollyBlock extends Parent { + export interface ScrollyBlock extends Parent { type: "scrolly-block"; theme: "sans" | "serif"; children: ScrollySection[]; } - interface ScrollySection extends Parent { + export interface ScrollySection extends Parent { type: "scrolly-section"; display: "dark-background" | "light-background"; noBox?: true; @@ -202,31 +202,31 @@ export declare namespace ContentTree { transition?: "delay-before" | "delay-after"; children: [ScrollyImage, ...ScrollyCopy[]]; } - interface ScrollyImage extends Node { + export interface ScrollyImage extends Node { type: "scrolly-image"; id: string; picture: ImageSetPicture; } - interface ScrollyCopy extends Parent { + export interface ScrollyCopy extends Parent { type: "scrolly-copy"; children: (ScrollyHeading | Paragraph)[]; } - interface ScrollyHeading extends Parent { + export interface ScrollyHeading extends Parent { type: "scrolly-heading"; level: "chapter" | "heading" | "subheading"; children: Text[]; } - interface Layout extends Parent { + export interface Layout extends Parent { type: "layout"; layoutName: "auto" | "card" | "timeline"; layoutWidth: string; children: [Heading, LayoutImage, ...LayoutSlot[]] | [Heading, ...LayoutSlot[]] | LayoutSlot[]; } - interface LayoutSlot extends Parent { + export interface LayoutSlot extends Parent { type: "layout-slot"; children: (Heading | Paragraph | LayoutImage)[]; } - interface LayoutImage extends Node { + export interface LayoutImage extends Node { type: "layout-image"; id: string; alt: string; @@ -234,36 +234,36 @@ export declare namespace ContentTree { credit: string; picture: ImageSetPicture; } - type TableColumnSettings = { + export type TableColumnSettings = { hideOnMobile: boolean; sortable: boolean; sortType: 'text' | 'number' | 'date' | 'currency' | 'percent'; }; - type TableLayoutWidth = Extract; - interface TableCaption extends Parent { + export type TableLayoutWidth = Extract; + export interface TableCaption extends Parent { type: 'table-caption'; children: Phrasing[]; } - interface TableCell extends Parent { + export interface TableCell extends Parent { type: 'table-cell'; heading?: boolean; columnSpan?: number; rowSpan?: number; children: Phrasing[]; } - interface TableRow extends Parent { + export interface TableRow extends Parent { type: 'table-row'; children: TableCell[]; } - interface TableBody extends Parent { + export interface TableBody extends Parent { type: 'table-body'; children: TableRow[]; } - interface TableFooter extends Parent { + export interface TableFooter extends Parent { type: 'table-footer'; children: Phrasing[]; } - interface Table extends Parent { + export interface Table extends Parent { type: 'table'; stripes: boolean; compact: boolean; @@ -273,10 +273,10 @@ export declare namespace ContentTree { children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody]; columnSettings: TableColumnSettings[]; } - type CustomCodeComponentAttributes = { + export type CustomCodeComponentAttributes = { [key: string]: string | boolean | undefined; }; - interface CustomCodeComponent extends Node { + export interface CustomCodeComponent extends Node { /** Component type */ type: "custom-code-component"; /** Id taken from the CAPI url */ @@ -292,14 +292,14 @@ export declare namespace ContentTree { /** Configuration data to be passed to the component. */ attributes: CustomCodeComponentAttributes; } - interface ImagePair extends Parent { + export interface ImagePair extends Parent { type: 'image-pair'; children: [ImageSet, ImageSet]; } /** * Timeline nodes display a timeline of events in arbitrary order. */ - interface Timeline extends Parent { + export interface Timeline extends Parent { type: "timeline"; /** The title for the timeline */ title: string; @@ -308,7 +308,7 @@ export declare namespace ContentTree { /** * TimelineEvent is the representation of a single event in a Timeline. */ - interface TimelineEvent extends Parent { + export interface TimelineEvent extends Parent { type: "timeline-event"; /** The title of the event */ title: string; @@ -318,7 +318,7 @@ export declare namespace ContentTree { /** * A definition has a term and a related description. It is used to describe a term. */ - interface Definition extends Node { + export interface Definition extends Node { type: "definition"; term: string; description: string; @@ -326,7 +326,7 @@ export declare namespace ContentTree { /** * InNumbers represents a set of numbers with related descriptions. */ - interface InNumbers extends Parent { + export interface InNumbers extends Parent { type: "in-numbers"; /** The title for the InNumbers */ title?: string; @@ -334,11 +334,11 @@ export declare namespace ContentTree { } /** Allowed children for a card */ - type CardChildren = ImageSet | Exclude; + export type CardChildren = ImageSet | Exclude; /** * A card describes a subject with images and text */ - interface Card extends Parent { + export interface Card extends Parent { type: "card"; /** The title of this card */ title?: string; @@ -347,11 +347,11 @@ export declare namespace ContentTree { /** * Allowed layout widths for an InfoBox. */ - type InfoBoxLayoutWidth = Extract; + export type InfoBoxLayoutWidth = Extract; /** * An info box describes a subject via a single card */ - interface InfoBox extends Parent { + export interface InfoBox extends Parent { type: "info-box"; /** The layout width supported by this node */ layoutWidth: InfoBoxLayoutWidth; @@ -360,103 +360,140 @@ export declare namespace ContentTree { /** * InfoPair provides exactly two cards. */ - interface InfoPair extends Parent { + export interface InfoPair extends Parent { type: "info-pair"; /** The title of the info pair */ title?: string; children: [Card, Card]; } - namespace full { - type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; - interface Node { + /** + * @sparkGenerateStoryblock true + **/ + type AudioPlayer = AudioPlayerV1 | AudioPlayerV2 | AudioPlayerV3; + /** @support deprecated */ + export interface AudioPlayerV1 extends Node { + type: "audio-player"; + version: 1; + title: string; + audioUrl: string; + } + export interface AudioPlayerV2 extends Node { + type: "audio-player"; + version: 2; + title: string; + audioId: string; + audio: AudioSet; + } + /** @support prerelease */ + export interface AudioPlayerV3 extends Node { + type: "audio-player"; + version: 3; + title: string; + audioId: string; + transcriptionId: string; + audio: AudioSet; + transcription: Transcription; + } + /** + * Demo placeholders so the AudioPlayer versioning example compiles. + */ + export interface AudioSet extends Node { + url: string; + } + export interface Transcription extends Node { + text: string; + } + export namespace full { + export type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; + export interface Node { type: string; data?: any; } - interface Parent extends Node { + export interface Parent extends Node { children: Node[]; } - interface Root extends Node { + export interface Root extends Node { type: "root"; body: Body; } - interface Body extends Parent { + export interface Body extends Parent { type: "body"; version: number; children: BodyBlock[]; } - type BodyBlock = FormattingBlock | StoryBlock; - type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; - interface Text extends Node { + export type BodyBlock = FormattingBlock | StoryBlock; + export type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; + export interface Text extends Node { type: "text"; value: string; } - type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; - interface Break extends Node { + export type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; + export interface Break extends Node { type: "break"; } - interface ThematicBreak extends Node { + export interface ThematicBreak extends Node { type: "thematic-break"; } - interface Paragraph extends Parent { + export interface Paragraph extends Parent { type: "paragraph"; children: Phrasing[]; } - interface Heading extends Parent { + export interface Heading extends Parent { type: "heading"; children: Text[]; level: "chapter" | "subheading" | "label"; fragmentIdentifier?: string; } - interface Strong extends Parent { + export interface Strong extends Parent { type: "strong"; children: Phrasing[]; } - interface Emphasis extends Parent { + export interface Emphasis extends Parent { type: "emphasis"; children: Phrasing[]; } - interface Strikethrough extends Parent { + export interface Strikethrough extends Parent { type: "strikethrough"; children: Phrasing[]; } - interface Link extends Parent { + export interface Link extends Parent { type: "link"; url: string; title: string; children: Phrasing[]; } - interface FindOutMoreLink extends Parent { + export interface FindOutMoreLink extends Parent { type: "find-out-more-link"; url: string; title: string; children: Phrasing[]; } - interface List extends Parent { + export interface List extends Parent { type: "list"; ordered: boolean; children: ListItem[]; } - interface ListItem extends Parent { + export interface ListItem extends Parent { type: "list-item"; children: (Paragraph | Phrasing)[]; } - interface Blockquote extends Parent { + export interface Blockquote extends Parent { type: "blockquote"; children: (Paragraph | Phrasing)[]; } - type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair; - interface Pullquote extends Node { + export type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | AudioPlayer; + export interface Pullquote extends Node { type: "pullquote"; text: string; source?: string; } - interface ImageSet extends Node { + export interface ImageSet extends Node { type: "image-set"; id: string; picture: ImageSetPicture; fragmentIdentifier?: string; } - type ImageSetPicture = { + export type ImageSetPicture = { layoutWidth: string; imageType: "image" | "graphic"; alt: string; @@ -465,7 +502,7 @@ export declare namespace ContentTree { images: Image[]; fallbackImage: Image; }; - type Image = { + export type Image = { id: string; width: number; height: number; @@ -473,24 +510,24 @@ export declare namespace ContentTree { url: string; sourceSet?: ImageSource[]; }; - type ImageSource = { + export type ImageSource = { url: string; width: number; dpr: number; }; - interface Recommended extends Node { + export interface Recommended extends Node { type: "recommended"; id: string; heading?: string; teaserTitleOverride?: string; teaser: Teaser; } - interface RecommendedList extends Node { + export interface RecommendedList extends Node { type: "recommended-list"; heading?: string; children: Recommended[]; } - type TeaserConcept = { + export type TeaserConcept = { apiUrl: string; directType: string; id: string; @@ -500,7 +537,7 @@ export declare namespace ContentTree { types: string[]; url: string; }; - type Teaser = { + export type Teaser = { id: string; url: string; type: "article" | "video" | "podcast" | "audio" | "package" | "liveblog" | "promoted-content" | "paid-post"; @@ -527,13 +564,13 @@ export declare namespace ContentTree { }; clientName?: string; }; - interface Tweet extends Node { + export interface Tweet extends Node { id: string; type: "tweet"; html: string; } - type FlourishLayoutWidth = Extract; - interface Flourish extends Node { + export type FlourishLayoutWidth = Extract; + export interface Flourish extends Node { type: "flourish"; id: string; layoutWidth: FlourishLayoutWidth; @@ -543,26 +580,26 @@ export declare namespace ContentTree { fallbackImage?: Image; fragmentIdentifier?: string; } - interface BigNumber extends Node { + export interface BigNumber extends Node { type: "big-number"; number: string; description: string; } - interface Video extends Node { + export interface Video extends Node { type: "video"; id: string; title: string; } - interface YoutubeVideo extends Node { + export interface YoutubeVideo extends Node { type: "youtube-video"; url: string; } - interface ScrollyBlock extends Parent { + export interface ScrollyBlock extends Parent { type: "scrolly-block"; theme: "sans" | "serif"; children: ScrollySection[]; } - interface ScrollySection extends Parent { + export interface ScrollySection extends Parent { type: "scrolly-section"; display: "dark-background" | "light-background"; noBox?: true; @@ -570,31 +607,31 @@ export declare namespace ContentTree { transition?: "delay-before" | "delay-after"; children: [ScrollyImage, ...ScrollyCopy[]]; } - interface ScrollyImage extends Node { + export interface ScrollyImage extends Node { type: "scrolly-image"; id: string; picture: ImageSetPicture; } - interface ScrollyCopy extends Parent { + export interface ScrollyCopy extends Parent { type: "scrolly-copy"; children: (ScrollyHeading | Paragraph)[]; } - interface ScrollyHeading extends Parent { + export interface ScrollyHeading extends Parent { type: "scrolly-heading"; level: "chapter" | "heading" | "subheading"; children: Text[]; } - interface Layout extends Parent { + export interface Layout extends Parent { type: "layout"; layoutName: "auto" | "card" | "timeline"; layoutWidth: string; children: [Heading, LayoutImage, ...LayoutSlot[]] | [Heading, ...LayoutSlot[]] | LayoutSlot[]; } - interface LayoutSlot extends Parent { + export interface LayoutSlot extends Parent { type: "layout-slot"; children: (Heading | Paragraph | LayoutImage)[]; } - interface LayoutImage extends Node { + export interface LayoutImage extends Node { type: "layout-image"; id: string; alt: string; @@ -602,36 +639,36 @@ export declare namespace ContentTree { credit: string; picture: ImageSetPicture; } - type TableColumnSettings = { + export type TableColumnSettings = { hideOnMobile: boolean; sortable: boolean; sortType: 'text' | 'number' | 'date' | 'currency' | 'percent'; }; - type TableLayoutWidth = Extract; - interface TableCaption extends Parent { + export type TableLayoutWidth = Extract; + export interface TableCaption extends Parent { type: 'table-caption'; children: Phrasing[]; } - interface TableCell extends Parent { + export interface TableCell extends Parent { type: 'table-cell'; heading?: boolean; columnSpan?: number; rowSpan?: number; children: Phrasing[]; } - interface TableRow extends Parent { + export interface TableRow extends Parent { type: 'table-row'; children: TableCell[]; } - interface TableBody extends Parent { + export interface TableBody extends Parent { type: 'table-body'; children: TableRow[]; } - interface TableFooter extends Parent { + export interface TableFooter extends Parent { type: 'table-footer'; children: Phrasing[]; } - interface Table extends Parent { + export interface Table extends Parent { type: 'table'; stripes: boolean; compact: boolean; @@ -641,10 +678,10 @@ export declare namespace ContentTree { children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody]; columnSettings: TableColumnSettings[]; } - type CustomCodeComponentAttributes = { + export type CustomCodeComponentAttributes = { [key: string]: string | boolean | undefined; }; - interface CustomCodeComponent extends Node { + export interface CustomCodeComponent extends Node { /** Component type */ type: "custom-code-component"; /** Id taken from the CAPI url */ @@ -660,14 +697,14 @@ export declare namespace ContentTree { /** Configuration data to be passed to the component. */ attributes: CustomCodeComponentAttributes; } - interface ImagePair extends Parent { + export interface ImagePair extends Parent { type: 'image-pair'; children: [ImageSet, ImageSet]; } /** * Timeline nodes display a timeline of events in arbitrary order. */ - interface Timeline extends Parent { + export interface Timeline extends Parent { type: "timeline"; /** The title for the timeline */ title: string; @@ -676,7 +713,7 @@ export declare namespace ContentTree { /** * TimelineEvent is the representation of a single event in a Timeline. */ - interface TimelineEvent extends Parent { + export interface TimelineEvent extends Parent { type: "timeline-event"; /** The title of the event */ title: string; @@ -686,7 +723,7 @@ export declare namespace ContentTree { /** * A definition has a term and a related description. It is used to describe a term. */ - interface Definition extends Node { + export interface Definition extends Node { type: "definition"; term: string; description: string; @@ -694,7 +731,7 @@ export declare namespace ContentTree { /** * InNumbers represents a set of numbers with related descriptions. */ - interface InNumbers extends Parent { + export interface InNumbers extends Parent { type: "in-numbers"; /** The title for the InNumbers */ title?: string; @@ -702,11 +739,11 @@ export declare namespace ContentTree { } /** Allowed children for a card */ - type CardChildren = ImageSet | Exclude; + export type CardChildren = ImageSet | Exclude; /** * A card describes a subject with images and text */ - interface Card extends Parent { + export interface Card extends Parent { type: "card"; /** The title of this card */ title?: string; @@ -715,11 +752,11 @@ export declare namespace ContentTree { /** * Allowed layout widths for an InfoBox. */ - type InfoBoxLayoutWidth = Extract; + export type InfoBoxLayoutWidth = Extract; /** * An info box describes a subject via a single card */ - interface InfoBox extends Parent { + export interface InfoBox extends Parent { type: "info-box"; /** The layout width supported by this node */ layoutWidth: InfoBoxLayoutWidth; @@ -728,103 +765,141 @@ export declare namespace ContentTree { /** * InfoPair provides exactly two cards. */ - interface InfoPair extends Parent { + export interface InfoPair extends Parent { type: "info-pair"; /** The title of the info pair */ title?: string; children: [Card, Card]; } + /** + * @sparkGenerateStoryblock true + **/ + type AudioPlayer = AudioPlayerV1 | AudioPlayerV2 | AudioPlayerV3; + /** @support deprecated */ + export interface AudioPlayerV1 extends Node { + type: "audio-player"; + version: 1; + title: string; + audioUrl: string; + } + export interface AudioPlayerV2 extends Node { + type: "audio-player"; + version: 2; + title: string; + audioId: string; + audio: AudioSet; + } + /** @support prerelease */ + export interface AudioPlayerV3 extends Node { + type: "audio-player"; + version: 3; + title: string; + audioId: string; + transcriptionId: string; + audio: AudioSet; + transcription: Transcription; + } + /** + * Demo placeholders so the AudioPlayer versioning example compiles. + */ + export interface AudioSet extends Node { + url: string; + } + export interface Transcription extends Node { + text: string; + } + export {}; } - namespace transit { - type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; - interface Node { + export namespace transit { + export type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; + export interface Node { type: string; data?: any; } - interface Parent extends Node { + export interface Parent extends Node { children: Node[]; } - interface Root extends Node { + export interface Root extends Node { type: "root"; body: Body; } - interface Body extends Parent { + export interface Body extends Parent { type: "body"; version: number; children: BodyBlock[]; } - type BodyBlock = FormattingBlock | StoryBlock; - type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; - interface Text extends Node { + export type BodyBlock = FormattingBlock | StoryBlock; + export type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; + export interface Text extends Node { type: "text"; value: string; } - type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; - interface Break extends Node { + export type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; + export interface Break extends Node { type: "break"; } - interface ThematicBreak extends Node { + export interface ThematicBreak extends Node { type: "thematic-break"; } - interface Paragraph extends Parent { + export interface Paragraph extends Parent { type: "paragraph"; children: Phrasing[]; } - interface Heading extends Parent { + export interface Heading extends Parent { type: "heading"; children: Text[]; level: "chapter" | "subheading" | "label"; fragmentIdentifier?: string; } - interface Strong extends Parent { + export interface Strong extends Parent { type: "strong"; children: Phrasing[]; } - interface Emphasis extends Parent { + export interface Emphasis extends Parent { type: "emphasis"; children: Phrasing[]; } - interface Strikethrough extends Parent { + export interface Strikethrough extends Parent { type: "strikethrough"; children: Phrasing[]; } - interface Link extends Parent { + export interface Link extends Parent { type: "link"; url: string; title: string; children: Phrasing[]; } - interface FindOutMoreLink extends Parent { + export interface FindOutMoreLink extends Parent { type: "find-out-more-link"; url: string; title: string; children: Phrasing[]; } - interface List extends Parent { + export interface List extends Parent { type: "list"; ordered: boolean; children: ListItem[]; } - interface ListItem extends Parent { + export interface ListItem extends Parent { type: "list-item"; children: (Paragraph | Phrasing)[]; } - interface Blockquote extends Parent { + export interface Blockquote extends Parent { type: "blockquote"; children: (Paragraph | Phrasing)[]; } - type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair; - interface Pullquote extends Node { + export type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | AudioPlayer; + export interface Pullquote extends Node { type: "pullquote"; text: string; source?: string; } - interface ImageSet extends Node { + export interface ImageSet extends Node { type: "image-set"; id: string; fragmentIdentifier?: string; } - type ImageSetPicture = { + export type ImageSetPicture = { layoutWidth: string; imageType: "image" | "graphic"; alt: string; @@ -833,7 +908,7 @@ export declare namespace ContentTree { images: Image[]; fallbackImage: Image; }; - type Image = { + export type Image = { id: string; width: number; height: number; @@ -841,23 +916,23 @@ export declare namespace ContentTree { url: string; sourceSet?: ImageSource[]; }; - type ImageSource = { + export type ImageSource = { url: string; width: number; dpr: number; }; - interface Recommended extends Node { + export interface Recommended extends Node { type: "recommended"; id: string; heading?: string; teaserTitleOverride?: string; } - interface RecommendedList extends Node { + export interface RecommendedList extends Node { type: "recommended-list"; heading?: string; children: Recommended[]; } - type TeaserConcept = { + export type TeaserConcept = { apiUrl: string; directType: string; id: string; @@ -867,7 +942,7 @@ export declare namespace ContentTree { types: string[]; url: string; }; - type Teaser = { + export type Teaser = { id: string; url: string; type: "article" | "video" | "podcast" | "audio" | "package" | "liveblog" | "promoted-content" | "paid-post"; @@ -894,12 +969,12 @@ export declare namespace ContentTree { }; clientName?: string; }; - interface Tweet extends Node { + export interface Tweet extends Node { id: string; type: "tweet"; } - type FlourishLayoutWidth = Extract; - interface Flourish extends Node { + export type FlourishLayoutWidth = Extract; + export interface Flourish extends Node { type: "flourish"; id: string; layoutWidth: FlourishLayoutWidth; @@ -908,25 +983,25 @@ export declare namespace ContentTree { timestamp?: string; fragmentIdentifier?: string; } - interface BigNumber extends Node { + export interface BigNumber extends Node { type: "big-number"; number: string; description: string; } - interface Video extends Node { + export interface Video extends Node { type: "video"; id: string; } - interface YoutubeVideo extends Node { + export interface YoutubeVideo extends Node { type: "youtube-video"; url: string; } - interface ScrollyBlock extends Parent { + export interface ScrollyBlock extends Parent { type: "scrolly-block"; theme: "sans" | "serif"; children: ScrollySection[]; } - interface ScrollySection extends Parent { + export interface ScrollySection extends Parent { type: "scrolly-section"; display: "dark-background" | "light-background"; noBox?: true; @@ -934,66 +1009,66 @@ export declare namespace ContentTree { transition?: "delay-before" | "delay-after"; children: [ScrollyImage, ...ScrollyCopy[]]; } - interface ScrollyImage extends Node { + export interface ScrollyImage extends Node { type: "scrolly-image"; id: string; } - interface ScrollyCopy extends Parent { + export interface ScrollyCopy extends Parent { type: "scrolly-copy"; children: (ScrollyHeading | Paragraph)[]; } - interface ScrollyHeading extends Parent { + export interface ScrollyHeading extends Parent { type: "scrolly-heading"; level: "chapter" | "heading" | "subheading"; children: Text[]; } - interface Layout extends Parent { + export interface Layout extends Parent { type: "layout"; layoutName: "auto" | "card" | "timeline"; layoutWidth: string; children: [Heading, LayoutImage, ...LayoutSlot[]] | [Heading, ...LayoutSlot[]] | LayoutSlot[]; } - interface LayoutSlot extends Parent { + export interface LayoutSlot extends Parent { type: "layout-slot"; children: (Heading | Paragraph | LayoutImage)[]; } - interface LayoutImage extends Node { + export interface LayoutImage extends Node { type: "layout-image"; id: string; alt: string; caption: string; credit: string; } - type TableColumnSettings = { + export type TableColumnSettings = { hideOnMobile: boolean; sortable: boolean; sortType: 'text' | 'number' | 'date' | 'currency' | 'percent'; }; - type TableLayoutWidth = Extract; - interface TableCaption extends Parent { + export type TableLayoutWidth = Extract; + export interface TableCaption extends Parent { type: 'table-caption'; children: Phrasing[]; } - interface TableCell extends Parent { + export interface TableCell extends Parent { type: 'table-cell'; heading?: boolean; columnSpan?: number; rowSpan?: number; children: Phrasing[]; } - interface TableRow extends Parent { + export interface TableRow extends Parent { type: 'table-row'; children: TableCell[]; } - interface TableBody extends Parent { + export interface TableBody extends Parent { type: 'table-body'; children: TableRow[]; } - interface TableFooter extends Parent { + export interface TableFooter extends Parent { type: 'table-footer'; children: Phrasing[]; } - interface Table extends Parent { + export interface Table extends Parent { type: 'table'; stripes: boolean; compact: boolean; @@ -1003,10 +1078,10 @@ export declare namespace ContentTree { children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody]; columnSettings: TableColumnSettings[]; } - type CustomCodeComponentAttributes = { + export type CustomCodeComponentAttributes = { [key: string]: string | boolean | undefined; }; - interface CustomCodeComponent extends Node { + export interface CustomCodeComponent extends Node { /** Component type */ type: "custom-code-component"; /** Id taken from the CAPI url */ @@ -1014,14 +1089,14 @@ export declare namespace ContentTree { /** How the component should be presented in the article page according to the column layout system */ layoutWidth: LayoutWidth; } - interface ImagePair extends Parent { + export interface ImagePair extends Parent { type: 'image-pair'; children: [ImageSet, ImageSet]; } /** * Timeline nodes display a timeline of events in arbitrary order. */ - interface Timeline extends Parent { + export interface Timeline extends Parent { type: "timeline"; /** The title for the timeline */ title: string; @@ -1030,7 +1105,7 @@ export declare namespace ContentTree { /** * TimelineEvent is the representation of a single event in a Timeline. */ - interface TimelineEvent extends Parent { + export interface TimelineEvent extends Parent { type: "timeline-event"; /** The title of the event */ title: string; @@ -1040,7 +1115,7 @@ export declare namespace ContentTree { /** * A definition has a term and a related description. It is used to describe a term. */ - interface Definition extends Node { + export interface Definition extends Node { type: "definition"; term: string; description: string; @@ -1048,7 +1123,7 @@ export declare namespace ContentTree { /** * InNumbers represents a set of numbers with related descriptions. */ - interface InNumbers extends Parent { + export interface InNumbers extends Parent { type: "in-numbers"; /** The title for the InNumbers */ title?: string; @@ -1056,11 +1131,11 @@ export declare namespace ContentTree { } /** Allowed children for a card */ - type CardChildren = ImageSet | Exclude; + export type CardChildren = ImageSet | Exclude; /** * A card describes a subject with images and text */ - interface Card extends Parent { + export interface Card extends Parent { type: "card"; /** The title of this card */ title?: string; @@ -1069,11 +1144,11 @@ export declare namespace ContentTree { /** * Allowed layout widths for an InfoBox. */ - type InfoBoxLayoutWidth = Extract; + export type InfoBoxLayoutWidth = Extract; /** * An info box describes a subject via a single card */ - interface InfoBox extends Parent { + export interface InfoBox extends Parent { type: "info-box"; /** The layout width supported by this node */ layoutWidth: InfoBoxLayoutWidth; @@ -1082,104 +1157,139 @@ export declare namespace ContentTree { /** * InfoPair provides exactly two cards. */ - interface InfoPair extends Parent { + export interface InfoPair extends Parent { type: "info-pair"; /** The title of the info pair */ title?: string; children: [Card, Card]; } + /** + * @sparkGenerateStoryblock true + **/ + type AudioPlayer = AudioPlayerV1 | AudioPlayerV2 | AudioPlayerV3; + /** @support deprecated */ + export interface AudioPlayerV1 extends Node { + type: "audio-player"; + version: 1; + title: string; + audioUrl: string; + } + export interface AudioPlayerV2 extends Node { + type: "audio-player"; + version: 2; + title: string; + audioId: string; + } + /** @support prerelease */ + export interface AudioPlayerV3 extends Node { + type: "audio-player"; + version: 3; + title: string; + audioId: string; + transcriptionId: string; + } + /** + * Demo placeholders so the AudioPlayer versioning example compiles. + */ + export interface AudioSet extends Node { + url: string; + } + export interface Transcription extends Node { + text: string; + } + export {}; } - namespace loose { - type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; - interface Node { + export namespace loose { + export type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; + export interface Node { type: string; data?: any; } - interface Parent extends Node { + export interface Parent extends Node { children: Node[]; } - interface Root extends Node { + export interface Root extends Node { type: "root"; body: Body; } - interface Body extends Parent { + export interface Body extends Parent { type: "body"; version: number; children: BodyBlock[]; } - type BodyBlock = FormattingBlock | StoryBlock; - type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; - interface Text extends Node { + export type BodyBlock = FormattingBlock | StoryBlock; + export type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; + export interface Text extends Node { type: "text"; value: string; } - type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; - interface Break extends Node { + export type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; + export interface Break extends Node { type: "break"; } - interface ThematicBreak extends Node { + export interface ThematicBreak extends Node { type: "thematic-break"; } - interface Paragraph extends Parent { + export interface Paragraph extends Parent { type: "paragraph"; children: Phrasing[]; } - interface Heading extends Parent { + export interface Heading extends Parent { type: "heading"; children: Text[]; level: "chapter" | "subheading" | "label"; fragmentIdentifier?: string; } - interface Strong extends Parent { + export interface Strong extends Parent { type: "strong"; children: Phrasing[]; } - interface Emphasis extends Parent { + export interface Emphasis extends Parent { type: "emphasis"; children: Phrasing[]; } - interface Strikethrough extends Parent { + export interface Strikethrough extends Parent { type: "strikethrough"; children: Phrasing[]; } - interface Link extends Parent { + export interface Link extends Parent { type: "link"; url: string; title: string; children: Phrasing[]; } - interface FindOutMoreLink extends Parent { + export interface FindOutMoreLink extends Parent { type: "find-out-more-link"; url: string; title: string; children: Phrasing[]; } - interface List extends Parent { + export interface List extends Parent { type: "list"; ordered: boolean; children: ListItem[]; } - interface ListItem extends Parent { + export interface ListItem extends Parent { type: "list-item"; children: (Paragraph | Phrasing)[]; } - interface Blockquote extends Parent { + export interface Blockquote extends Parent { type: "blockquote"; children: (Paragraph | Phrasing)[]; } - type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair; - interface Pullquote extends Node { + export type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | AudioPlayer; + export interface Pullquote extends Node { type: "pullquote"; text: string; source?: string; } - interface ImageSet extends Node { + export interface ImageSet extends Node { type: "image-set"; id: string; picture?: ImageSetPicture; fragmentIdentifier?: string; } - type ImageSetPicture = { + export type ImageSetPicture = { layoutWidth: string; imageType: "image" | "graphic"; alt: string; @@ -1188,7 +1298,7 @@ export declare namespace ContentTree { images: Image[]; fallbackImage: Image; }; - type Image = { + export type Image = { id: string; width: number; height: number; @@ -1196,24 +1306,24 @@ export declare namespace ContentTree { url: string; sourceSet?: ImageSource[]; }; - type ImageSource = { + export type ImageSource = { url: string; width: number; dpr: number; }; - interface Recommended extends Node { + export interface Recommended extends Node { type: "recommended"; id: string; heading?: string; teaserTitleOverride?: string; teaser?: Teaser; } - interface RecommendedList extends Node { + export interface RecommendedList extends Node { type: "recommended-list"; heading?: string; children: Recommended[]; } - type TeaserConcept = { + export type TeaserConcept = { apiUrl: string; directType: string; id: string; @@ -1223,7 +1333,7 @@ export declare namespace ContentTree { types: string[]; url: string; }; - type Teaser = { + export type Teaser = { id: string; url: string; type: "article" | "video" | "podcast" | "audio" | "package" | "liveblog" | "promoted-content" | "paid-post"; @@ -1250,13 +1360,13 @@ export declare namespace ContentTree { }; clientName?: string; }; - interface Tweet extends Node { + export interface Tweet extends Node { id: string; type: "tweet"; html?: string; } - type FlourishLayoutWidth = Extract; - interface Flourish extends Node { + export type FlourishLayoutWidth = Extract; + export interface Flourish extends Node { type: "flourish"; id: string; layoutWidth: FlourishLayoutWidth; @@ -1266,26 +1376,26 @@ export declare namespace ContentTree { fallbackImage?: Image; fragmentIdentifier?: string; } - interface BigNumber extends Node { + export interface BigNumber extends Node { type: "big-number"; number: string; description: string; } - interface Video extends Node { + export interface Video extends Node { type: "video"; id: string; title?: string; } - interface YoutubeVideo extends Node { + export interface YoutubeVideo extends Node { type: "youtube-video"; url: string; } - interface ScrollyBlock extends Parent { + export interface ScrollyBlock extends Parent { type: "scrolly-block"; theme: "sans" | "serif"; children: ScrollySection[]; } - interface ScrollySection extends Parent { + export interface ScrollySection extends Parent { type: "scrolly-section"; display: "dark-background" | "light-background"; noBox?: true; @@ -1293,31 +1403,31 @@ export declare namespace ContentTree { transition?: "delay-before" | "delay-after"; children: [ScrollyImage, ...ScrollyCopy[]]; } - interface ScrollyImage extends Node { + export interface ScrollyImage extends Node { type: "scrolly-image"; id: string; picture?: ImageSetPicture; } - interface ScrollyCopy extends Parent { + export interface ScrollyCopy extends Parent { type: "scrolly-copy"; children: (ScrollyHeading | Paragraph)[]; } - interface ScrollyHeading extends Parent { + export interface ScrollyHeading extends Parent { type: "scrolly-heading"; level: "chapter" | "heading" | "subheading"; children: Text[]; } - interface Layout extends Parent { + export interface Layout extends Parent { type: "layout"; layoutName: "auto" | "card" | "timeline"; layoutWidth: string; children: [Heading, LayoutImage, ...LayoutSlot[]] | [Heading, ...LayoutSlot[]] | LayoutSlot[]; } - interface LayoutSlot extends Parent { + export interface LayoutSlot extends Parent { type: "layout-slot"; children: (Heading | Paragraph | LayoutImage)[]; } - interface LayoutImage extends Node { + export interface LayoutImage extends Node { type: "layout-image"; id: string; alt: string; @@ -1325,36 +1435,36 @@ export declare namespace ContentTree { credit: string; picture?: ImageSetPicture; } - type TableColumnSettings = { + export type TableColumnSettings = { hideOnMobile: boolean; sortable: boolean; sortType: 'text' | 'number' | 'date' | 'currency' | 'percent'; }; - type TableLayoutWidth = Extract; - interface TableCaption extends Parent { + export type TableLayoutWidth = Extract; + export interface TableCaption extends Parent { type: 'table-caption'; children: Phrasing[]; } - interface TableCell extends Parent { + export interface TableCell extends Parent { type: 'table-cell'; heading?: boolean; columnSpan?: number; rowSpan?: number; children: Phrasing[]; } - interface TableRow extends Parent { + export interface TableRow extends Parent { type: 'table-row'; children: TableCell[]; } - interface TableBody extends Parent { + export interface TableBody extends Parent { type: 'table-body'; children: TableRow[]; } - interface TableFooter extends Parent { + export interface TableFooter extends Parent { type: 'table-footer'; children: Phrasing[]; } - interface Table extends Parent { + export interface Table extends Parent { type: 'table'; stripes: boolean; compact: boolean; @@ -1364,10 +1474,10 @@ export declare namespace ContentTree { children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody]; columnSettings: TableColumnSettings[]; } - type CustomCodeComponentAttributes = { + export type CustomCodeComponentAttributes = { [key: string]: string | boolean | undefined; }; - interface CustomCodeComponent extends Node { + export interface CustomCodeComponent extends Node { /** Component type */ type: "custom-code-component"; /** Id taken from the CAPI url */ @@ -1383,14 +1493,14 @@ export declare namespace ContentTree { /** Configuration data to be passed to the component. */ attributes?: CustomCodeComponentAttributes; } - interface ImagePair extends Parent { + export interface ImagePair extends Parent { type: 'image-pair'; children: [ImageSet, ImageSet]; } /** * Timeline nodes display a timeline of events in arbitrary order. */ - interface Timeline extends Parent { + export interface Timeline extends Parent { type: "timeline"; /** The title for the timeline */ title: string; @@ -1399,7 +1509,7 @@ export declare namespace ContentTree { /** * TimelineEvent is the representation of a single event in a Timeline. */ - interface TimelineEvent extends Parent { + export interface TimelineEvent extends Parent { type: "timeline-event"; /** The title of the event */ title: string; @@ -1409,7 +1519,7 @@ export declare namespace ContentTree { /** * A definition has a term and a related description. It is used to describe a term. */ - interface Definition extends Node { + export interface Definition extends Node { type: "definition"; term: string; description: string; @@ -1417,7 +1527,7 @@ export declare namespace ContentTree { /** * InNumbers represents a set of numbers with related descriptions. */ - interface InNumbers extends Parent { + export interface InNumbers extends Parent { type: "in-numbers"; /** The title for the InNumbers */ title?: string; @@ -1425,11 +1535,11 @@ export declare namespace ContentTree { } /** Allowed children for a card */ - type CardChildren = ImageSet | Exclude; + export type CardChildren = ImageSet | Exclude; /** * A card describes a subject with images and text */ - interface Card extends Parent { + export interface Card extends Parent { type: "card"; /** The title of this card */ title?: string; @@ -1438,11 +1548,11 @@ export declare namespace ContentTree { /** * Allowed layout widths for an InfoBox. */ - type InfoBoxLayoutWidth = Extract; + export type InfoBoxLayoutWidth = Extract; /** * An info box describes a subject via a single card */ - interface InfoBox extends Parent { + export interface InfoBox extends Parent { type: "info-box"; /** The layout width supported by this node */ layoutWidth: InfoBoxLayoutWidth; @@ -1451,11 +1561,50 @@ export declare namespace ContentTree { /** * InfoPair provides exactly two cards. */ - interface InfoPair extends Parent { + export interface InfoPair extends Parent { type: "info-pair"; /** The title of the info pair */ title?: string; children: [Card, Card]; } + /** + * @sparkGenerateStoryblock true + **/ + type AudioPlayer = AudioPlayerV1 | AudioPlayerV2 | AudioPlayerV3; + /** @support deprecated */ + export interface AudioPlayerV1 extends Node { + type: "audio-player"; + version: 1; + title: string; + audioUrl: string; + } + export interface AudioPlayerV2 extends Node { + type: "audio-player"; + version: 2; + title: string; + audioId: string; + audio?: AudioSet; + } + /** @support prerelease */ + export interface AudioPlayerV3 extends Node { + type: "audio-player"; + version: 3; + title: string; + audioId: string; + transcriptionId: string; + audio?: AudioSet; + transcription?: Transcription; + } + /** + * Demo placeholders so the AudioPlayer versioning example compiles. + */ + export interface AudioSet extends Node { + url: string; + } + export interface Transcription extends Node { + text: string; + } + export {}; } + export {}; } diff --git a/schemas/body-tree.schema.json b/schemas/body-tree.schema.json index c4c67ba..b1d0c1b 100644 --- a/schemas/body-tree.schema.json +++ b/schemas/body-tree.schema.json @@ -2,6 +2,93 @@ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { + "ContentTree.transit.AudioPlayerV1": { + "additionalProperties": false, + "properties": { + "audioUrl": { + "type": "string" + }, + "data": {}, + "title": { + "type": "string" + }, + "type": { + "const": "audio-player", + "type": "string" + }, + "version": { + "const": 1, + "type": "number" + } + }, + "required": [ + "audioUrl", + "title", + "type", + "version" + ], + "support": "deprecated", + "type": "object" + }, + "ContentTree.transit.AudioPlayerV2": { + "additionalProperties": false, + "properties": { + "audioId": { + "type": "string" + }, + "data": {}, + "title": { + "type": "string" + }, + "type": { + "const": "audio-player", + "type": "string" + }, + "version": { + "const": 2, + "type": "number" + } + }, + "required": [ + "audioId", + "title", + "type", + "version" + ], + "type": "object" + }, + "ContentTree.transit.AudioPlayerV3": { + "additionalProperties": false, + "properties": { + "audioId": { + "type": "string" + }, + "data": {}, + "title": { + "type": "string" + }, + "transcriptionId": { + "type": "string" + }, + "type": { + "const": "audio-player", + "type": "string" + }, + "version": { + "const": 3, + "type": "number" + } + }, + "required": [ + "audioId", + "title", + "transcriptionId", + "type", + "version" + ], + "support": "prerelease", + "type": "object" + }, "ContentTree.transit.BigNumber": { "additionalProperties": false, "properties": { @@ -146,6 +233,15 @@ }, { "$ref": "#/definitions/ContentTree.transit.InfoPair" + }, + { + "$ref": "#/definitions/ContentTree.transit.AudioPlayerV1" + }, + { + "$ref": "#/definitions/ContentTree.transit.AudioPlayerV2" + }, + { + "$ref": "#/definitions/ContentTree.transit.AudioPlayerV3" } ] }, diff --git a/schemas/content-tree.schema.json b/schemas/content-tree.schema.json index b9d165c..b524a0c 100644 --- a/schemas/content-tree.schema.json +++ b/schemas/content-tree.schema.json @@ -2,6 +2,123 @@ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { + "ContentTree.full.AudioPlayerV1": { + "additionalProperties": false, + "properties": { + "audioUrl": { + "type": "string" + }, + "data": {}, + "title": { + "type": "string" + }, + "type": { + "const": "audio-player", + "type": "string" + }, + "version": { + "const": 1, + "type": "number" + } + }, + "required": [ + "audioUrl", + "title", + "type", + "version" + ], + "support": "deprecated", + "type": "object" + }, + "ContentTree.full.AudioPlayerV2": { + "additionalProperties": false, + "properties": { + "audio": { + "$ref": "#/definitions/ContentTree.full.AudioSet" + }, + "audioId": { + "type": "string" + }, + "data": {}, + "title": { + "type": "string" + }, + "type": { + "const": "audio-player", + "type": "string" + }, + "version": { + "const": 2, + "type": "number" + } + }, + "required": [ + "audio", + "audioId", + "title", + "type", + "version" + ], + "type": "object" + }, + "ContentTree.full.AudioPlayerV3": { + "additionalProperties": false, + "properties": { + "audio": { + "$ref": "#/definitions/ContentTree.full.AudioSet" + }, + "audioId": { + "type": "string" + }, + "data": {}, + "title": { + "type": "string" + }, + "transcription": { + "$ref": "#/definitions/ContentTree.full.Transcription" + }, + "transcriptionId": { + "type": "string" + }, + "type": { + "const": "audio-player", + "type": "string" + }, + "version": { + "const": 3, + "type": "number" + } + }, + "required": [ + "audio", + "audioId", + "title", + "transcription", + "transcriptionId", + "type", + "version" + ], + "support": "prerelease", + "type": "object" + }, + "ContentTree.full.AudioSet": { + "additionalProperties": false, + "description": "Demo placeholders so the AudioPlayer versioning example compiles.", + "properties": { + "data": {}, + "type": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "required": [ + "type", + "url" + ], + "type": "object" + }, "ContentTree.full.BigNumber": { "additionalProperties": false, "properties": { @@ -171,6 +288,15 @@ }, { "$ref": "#/definitions/ContentTree.full.InfoPair" + }, + { + "$ref": "#/definitions/ContentTree.full.AudioPlayerV1" + }, + { + "$ref": "#/definitions/ContentTree.full.AudioPlayerV2" + }, + { + "$ref": "#/definitions/ContentTree.full.AudioPlayerV3" } ] }, @@ -2223,6 +2349,23 @@ ], "type": "object" }, + "ContentTree.full.Transcription": { + "additionalProperties": false, + "properties": { + "data": {}, + "text": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "type": "object" + }, "ContentTree.full.Tweet": { "additionalProperties": false, "properties": { diff --git a/schemas/transit-tree.schema.json b/schemas/transit-tree.schema.json index 114cc59..305815b 100644 --- a/schemas/transit-tree.schema.json +++ b/schemas/transit-tree.schema.json @@ -2,6 +2,93 @@ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "definitions": { + "ContentTree.transit.AudioPlayerV1": { + "additionalProperties": false, + "properties": { + "audioUrl": { + "type": "string" + }, + "data": {}, + "title": { + "type": "string" + }, + "type": { + "const": "audio-player", + "type": "string" + }, + "version": { + "const": 1, + "type": "number" + } + }, + "required": [ + "audioUrl", + "title", + "type", + "version" + ], + "support": "deprecated", + "type": "object" + }, + "ContentTree.transit.AudioPlayerV2": { + "additionalProperties": false, + "properties": { + "audioId": { + "type": "string" + }, + "data": {}, + "title": { + "type": "string" + }, + "type": { + "const": "audio-player", + "type": "string" + }, + "version": { + "const": 2, + "type": "number" + } + }, + "required": [ + "audioId", + "title", + "type", + "version" + ], + "type": "object" + }, + "ContentTree.transit.AudioPlayerV3": { + "additionalProperties": false, + "properties": { + "audioId": { + "type": "string" + }, + "data": {}, + "title": { + "type": "string" + }, + "transcriptionId": { + "type": "string" + }, + "type": { + "const": "audio-player", + "type": "string" + }, + "version": { + "const": 3, + "type": "number" + } + }, + "required": [ + "audioId", + "title", + "transcriptionId", + "type", + "version" + ], + "support": "prerelease", + "type": "object" + }, "ContentTree.transit.BigNumber": { "additionalProperties": false, "properties": { @@ -171,6 +258,15 @@ }, { "$ref": "#/definitions/ContentTree.transit.InfoPair" + }, + { + "$ref": "#/definitions/ContentTree.transit.AudioPlayerV1" + }, + { + "$ref": "#/definitions/ContentTree.transit.AudioPlayerV2" + }, + { + "$ref": "#/definitions/ContentTree.transit.AudioPlayerV3" } ] }, From 178bb82cbc907ffdec47d030c5e87616e91aef64 Mon Sep 17 00:00:00 2001 From: Andy Little Date: Wed, 4 Feb 2026 14:52:33 +0000 Subject: [PATCH 5/5] refactor add sparkGenerate to all versions --- SPEC.md | 20 +- content-tree.d.ts | 642 ++++++++++++++++--------------- schemas/body-tree.schema.json | 4 + schemas/content-tree.schema.json | 4 + schemas/transit-tree.schema.json | 4 + 5 files changed, 361 insertions(+), 313 deletions(-) diff --git a/SPEC.md b/SPEC.md index 31313c4..878cbc7 100644 --- a/SPEC.md +++ b/SPEC.md @@ -863,12 +863,12 @@ interface InfoPair extends Parent { ### AudioPlayer ```ts - /** - * @sparkGenerateStoryblock true - **/ - type AudioPlayer = AudioPlayerV1 | AudioPlayerV2 | AudioPlayerV3; +type AudioPlayer = AudioPlayerV1 | AudioPlayerV2 | AudioPlayerV3 -/** @support deprecated */ +/** + * @sparkGenerateStoryblock true + * @support deprecated + */ interface AudioPlayerV1 extends Node { type: "audio-player" version: 1 @@ -876,6 +876,11 @@ interface AudioPlayerV1 extends Node { audioUrl: string } +/** + * @sparkGenerateStoryblock true + * @sparkInsert true + * @support supported + */ interface AudioPlayerV2 extends Node { type: "audio-player" version: 2 @@ -884,7 +889,10 @@ interface AudioPlayerV2 extends Node { external audio: AudioSet } -/** @support prerelease */ +/** + * @sparkGenerateStoryblock true + * @support prerelease + */ interface AudioPlayerV3 extends Node { type: "audio-player" version: 3 diff --git a/content-tree.d.ts b/content-tree.d.ts index 43bb236..f9944ef 100644 --- a/content-tree.d.ts +++ b/content-tree.d.ts @@ -1,94 +1,94 @@ export declare namespace ContentTree { - export type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; - export interface Node { + type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; + interface Node { type: string; data?: any; } - export interface Parent extends Node { + interface Parent extends Node { children: Node[]; } - export interface Root extends Node { + interface Root extends Node { type: "root"; body: Body; } - export interface Body extends Parent { + interface Body extends Parent { type: "body"; version: number; children: BodyBlock[]; } - export type BodyBlock = FormattingBlock | StoryBlock; - export type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; - export interface Text extends Node { + type BodyBlock = FormattingBlock | StoryBlock; + type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; + interface Text extends Node { type: "text"; value: string; } - export type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; - export interface Break extends Node { + type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; + interface Break extends Node { type: "break"; } - export interface ThematicBreak extends Node { + interface ThematicBreak extends Node { type: "thematic-break"; } - export interface Paragraph extends Parent { + interface Paragraph extends Parent { type: "paragraph"; children: Phrasing[]; } - export interface Heading extends Parent { + interface Heading extends Parent { type: "heading"; children: Text[]; level: "chapter" | "subheading" | "label"; fragmentIdentifier?: string; } - export interface Strong extends Parent { + interface Strong extends Parent { type: "strong"; children: Phrasing[]; } - export interface Emphasis extends Parent { + interface Emphasis extends Parent { type: "emphasis"; children: Phrasing[]; } - export interface Strikethrough extends Parent { + interface Strikethrough extends Parent { type: "strikethrough"; children: Phrasing[]; } - export interface Link extends Parent { + interface Link extends Parent { type: "link"; url: string; title: string; children: Phrasing[]; } - export interface FindOutMoreLink extends Parent { + interface FindOutMoreLink extends Parent { type: "find-out-more-link"; url: string; title: string; children: Phrasing[]; } - export interface List extends Parent { + interface List extends Parent { type: "list"; ordered: boolean; children: ListItem[]; } - export interface ListItem extends Parent { + interface ListItem extends Parent { type: "list-item"; children: (Paragraph | Phrasing)[]; } - export interface Blockquote extends Parent { + interface Blockquote extends Parent { type: "blockquote"; children: (Paragraph | Phrasing)[]; } - export type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | AudioPlayer; - export interface Pullquote extends Node { + type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | AudioPlayer; + interface Pullquote extends Node { type: "pullquote"; text: string; source?: string; } - export interface ImageSet extends Node { + interface ImageSet extends Node { type: "image-set"; id: string; picture: ImageSetPicture; fragmentIdentifier?: string; } - export type ImageSetPicture = { + type ImageSetPicture = { layoutWidth: string; imageType: "image" | "graphic"; alt: string; @@ -97,7 +97,7 @@ export declare namespace ContentTree { images: Image[]; fallbackImage: Image; }; - export type Image = { + type Image = { id: string; width: number; height: number; @@ -105,24 +105,24 @@ export declare namespace ContentTree { url: string; sourceSet?: ImageSource[]; }; - export type ImageSource = { + type ImageSource = { url: string; width: number; dpr: number; }; - export interface Recommended extends Node { + interface Recommended extends Node { type: "recommended"; id: string; heading?: string; teaserTitleOverride?: string; teaser: Teaser; } - export interface RecommendedList extends Node { + interface RecommendedList extends Node { type: "recommended-list"; heading?: string; children: Recommended[]; } - export type TeaserConcept = { + type TeaserConcept = { apiUrl: string; directType: string; id: string; @@ -132,7 +132,7 @@ export declare namespace ContentTree { types: string[]; url: string; }; - export type Teaser = { + type Teaser = { id: string; url: string; type: "article" | "video" | "podcast" | "audio" | "package" | "liveblog" | "promoted-content" | "paid-post"; @@ -159,13 +159,13 @@ export declare namespace ContentTree { }; clientName?: string; }; - export interface Tweet extends Node { + interface Tweet extends Node { id: string; type: "tweet"; html: string; } - export type FlourishLayoutWidth = Extract; - export interface Flourish extends Node { + type FlourishLayoutWidth = Extract; + interface Flourish extends Node { type: "flourish"; id: string; layoutWidth: FlourishLayoutWidth; @@ -175,26 +175,26 @@ export declare namespace ContentTree { fallbackImage?: Image; fragmentIdentifier?: string; } - export interface BigNumber extends Node { + interface BigNumber extends Node { type: "big-number"; number: string; description: string; } - export interface Video extends Node { + interface Video extends Node { type: "video"; id: string; title: string; } - export interface YoutubeVideo extends Node { + interface YoutubeVideo extends Node { type: "youtube-video"; url: string; } - export interface ScrollyBlock extends Parent { + interface ScrollyBlock extends Parent { type: "scrolly-block"; theme: "sans" | "serif"; children: ScrollySection[]; } - export interface ScrollySection extends Parent { + interface ScrollySection extends Parent { type: "scrolly-section"; display: "dark-background" | "light-background"; noBox?: true; @@ -202,31 +202,31 @@ export declare namespace ContentTree { transition?: "delay-before" | "delay-after"; children: [ScrollyImage, ...ScrollyCopy[]]; } - export interface ScrollyImage extends Node { + interface ScrollyImage extends Node { type: "scrolly-image"; id: string; picture: ImageSetPicture; } - export interface ScrollyCopy extends Parent { + interface ScrollyCopy extends Parent { type: "scrolly-copy"; children: (ScrollyHeading | Paragraph)[]; } - export interface ScrollyHeading extends Parent { + interface ScrollyHeading extends Parent { type: "scrolly-heading"; level: "chapter" | "heading" | "subheading"; children: Text[]; } - export interface Layout extends Parent { + interface Layout extends Parent { type: "layout"; layoutName: "auto" | "card" | "timeline"; layoutWidth: string; children: [Heading, LayoutImage, ...LayoutSlot[]] | [Heading, ...LayoutSlot[]] | LayoutSlot[]; } - export interface LayoutSlot extends Parent { + interface LayoutSlot extends Parent { type: "layout-slot"; children: (Heading | Paragraph | LayoutImage)[]; } - export interface LayoutImage extends Node { + interface LayoutImage extends Node { type: "layout-image"; id: string; alt: string; @@ -234,36 +234,36 @@ export declare namespace ContentTree { credit: string; picture: ImageSetPicture; } - export type TableColumnSettings = { + type TableColumnSettings = { hideOnMobile: boolean; sortable: boolean; sortType: 'text' | 'number' | 'date' | 'currency' | 'percent'; }; - export type TableLayoutWidth = Extract; - export interface TableCaption extends Parent { + type TableLayoutWidth = Extract; + interface TableCaption extends Parent { type: 'table-caption'; children: Phrasing[]; } - export interface TableCell extends Parent { + interface TableCell extends Parent { type: 'table-cell'; heading?: boolean; columnSpan?: number; rowSpan?: number; children: Phrasing[]; } - export interface TableRow extends Parent { + interface TableRow extends Parent { type: 'table-row'; children: TableCell[]; } - export interface TableBody extends Parent { + interface TableBody extends Parent { type: 'table-body'; children: TableRow[]; } - export interface TableFooter extends Parent { + interface TableFooter extends Parent { type: 'table-footer'; children: Phrasing[]; } - export interface Table extends Parent { + interface Table extends Parent { type: 'table'; stripes: boolean; compact: boolean; @@ -273,10 +273,10 @@ export declare namespace ContentTree { children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody]; columnSettings: TableColumnSettings[]; } - export type CustomCodeComponentAttributes = { + type CustomCodeComponentAttributes = { [key: string]: string | boolean | undefined; }; - export interface CustomCodeComponent extends Node { + interface CustomCodeComponent extends Node { /** Component type */ type: "custom-code-component"; /** Id taken from the CAPI url */ @@ -292,14 +292,14 @@ export declare namespace ContentTree { /** Configuration data to be passed to the component. */ attributes: CustomCodeComponentAttributes; } - export interface ImagePair extends Parent { + interface ImagePair extends Parent { type: 'image-pair'; children: [ImageSet, ImageSet]; } /** * Timeline nodes display a timeline of events in arbitrary order. */ - export interface Timeline extends Parent { + interface Timeline extends Parent { type: "timeline"; /** The title for the timeline */ title: string; @@ -308,7 +308,7 @@ export declare namespace ContentTree { /** * TimelineEvent is the representation of a single event in a Timeline. */ - export interface TimelineEvent extends Parent { + interface TimelineEvent extends Parent { type: "timeline-event"; /** The title of the event */ title: string; @@ -318,7 +318,7 @@ export declare namespace ContentTree { /** * A definition has a term and a related description. It is used to describe a term. */ - export interface Definition extends Node { + interface Definition extends Node { type: "definition"; term: string; description: string; @@ -326,7 +326,7 @@ export declare namespace ContentTree { /** * InNumbers represents a set of numbers with related descriptions. */ - export interface InNumbers extends Parent { + interface InNumbers extends Parent { type: "in-numbers"; /** The title for the InNumbers */ title?: string; @@ -334,11 +334,11 @@ export declare namespace ContentTree { } /** Allowed children for a card */ - export type CardChildren = ImageSet | Exclude; + type CardChildren = ImageSet | Exclude; /** * A card describes a subject with images and text */ - export interface Card extends Parent { + interface Card extends Parent { type: "card"; /** The title of this card */ title?: string; @@ -347,11 +347,11 @@ export declare namespace ContentTree { /** * Allowed layout widths for an InfoBox. */ - export type InfoBoxLayoutWidth = Extract; + type InfoBoxLayoutWidth = Extract; /** * An info box describes a subject via a single card */ - export interface InfoBox extends Parent { + interface InfoBox extends Parent { type: "info-box"; /** The layout width supported by this node */ layoutWidth: InfoBoxLayoutWidth; @@ -360,32 +360,40 @@ export declare namespace ContentTree { /** * InfoPair provides exactly two cards. */ - export interface InfoPair extends Parent { + interface InfoPair extends Parent { type: "info-pair"; /** The title of the info pair */ title?: string; children: [Card, Card]; } - /** - * @sparkGenerateStoryblock true - **/ type AudioPlayer = AudioPlayerV1 | AudioPlayerV2 | AudioPlayerV3; - /** @support deprecated */ - export interface AudioPlayerV1 extends Node { + /** + * @sparkGenerateStoryblock true + * @support deprecated + */ + interface AudioPlayerV1 extends Node { type: "audio-player"; version: 1; title: string; audioUrl: string; } - export interface AudioPlayerV2 extends Node { + /** + * @sparkGenerateStoryblock true + * @sparkInsert true + * @support supported + */ + interface AudioPlayerV2 extends Node { type: "audio-player"; version: 2; title: string; audioId: string; audio: AudioSet; } - /** @support prerelease */ - export interface AudioPlayerV3 extends Node { + /** + * @sparkGenerateStoryblock true + * @support prerelease + */ + interface AudioPlayerV3 extends Node { type: "audio-player"; version: 3; title: string; @@ -397,103 +405,103 @@ export declare namespace ContentTree { /** * Demo placeholders so the AudioPlayer versioning example compiles. */ - export interface AudioSet extends Node { + interface AudioSet extends Node { url: string; } - export interface Transcription extends Node { + interface Transcription extends Node { text: string; } - export namespace full { - export type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; - export interface Node { + namespace full { + type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; + interface Node { type: string; data?: any; } - export interface Parent extends Node { + interface Parent extends Node { children: Node[]; } - export interface Root extends Node { + interface Root extends Node { type: "root"; body: Body; } - export interface Body extends Parent { + interface Body extends Parent { type: "body"; version: number; children: BodyBlock[]; } - export type BodyBlock = FormattingBlock | StoryBlock; - export type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; - export interface Text extends Node { + type BodyBlock = FormattingBlock | StoryBlock; + type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; + interface Text extends Node { type: "text"; value: string; } - export type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; - export interface Break extends Node { + type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; + interface Break extends Node { type: "break"; } - export interface ThematicBreak extends Node { + interface ThematicBreak extends Node { type: "thematic-break"; } - export interface Paragraph extends Parent { + interface Paragraph extends Parent { type: "paragraph"; children: Phrasing[]; } - export interface Heading extends Parent { + interface Heading extends Parent { type: "heading"; children: Text[]; level: "chapter" | "subheading" | "label"; fragmentIdentifier?: string; } - export interface Strong extends Parent { + interface Strong extends Parent { type: "strong"; children: Phrasing[]; } - export interface Emphasis extends Parent { + interface Emphasis extends Parent { type: "emphasis"; children: Phrasing[]; } - export interface Strikethrough extends Parent { + interface Strikethrough extends Parent { type: "strikethrough"; children: Phrasing[]; } - export interface Link extends Parent { + interface Link extends Parent { type: "link"; url: string; title: string; children: Phrasing[]; } - export interface FindOutMoreLink extends Parent { + interface FindOutMoreLink extends Parent { type: "find-out-more-link"; url: string; title: string; children: Phrasing[]; } - export interface List extends Parent { + interface List extends Parent { type: "list"; ordered: boolean; children: ListItem[]; } - export interface ListItem extends Parent { + interface ListItem extends Parent { type: "list-item"; children: (Paragraph | Phrasing)[]; } - export interface Blockquote extends Parent { + interface Blockquote extends Parent { type: "blockquote"; children: (Paragraph | Phrasing)[]; } - export type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | AudioPlayer; - export interface Pullquote extends Node { + type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | AudioPlayer; + interface Pullquote extends Node { type: "pullquote"; text: string; source?: string; } - export interface ImageSet extends Node { + interface ImageSet extends Node { type: "image-set"; id: string; picture: ImageSetPicture; fragmentIdentifier?: string; } - export type ImageSetPicture = { + type ImageSetPicture = { layoutWidth: string; imageType: "image" | "graphic"; alt: string; @@ -502,7 +510,7 @@ export declare namespace ContentTree { images: Image[]; fallbackImage: Image; }; - export type Image = { + type Image = { id: string; width: number; height: number; @@ -510,24 +518,24 @@ export declare namespace ContentTree { url: string; sourceSet?: ImageSource[]; }; - export type ImageSource = { + type ImageSource = { url: string; width: number; dpr: number; }; - export interface Recommended extends Node { + interface Recommended extends Node { type: "recommended"; id: string; heading?: string; teaserTitleOverride?: string; teaser: Teaser; } - export interface RecommendedList extends Node { + interface RecommendedList extends Node { type: "recommended-list"; heading?: string; children: Recommended[]; } - export type TeaserConcept = { + type TeaserConcept = { apiUrl: string; directType: string; id: string; @@ -537,7 +545,7 @@ export declare namespace ContentTree { types: string[]; url: string; }; - export type Teaser = { + type Teaser = { id: string; url: string; type: "article" | "video" | "podcast" | "audio" | "package" | "liveblog" | "promoted-content" | "paid-post"; @@ -564,13 +572,13 @@ export declare namespace ContentTree { }; clientName?: string; }; - export interface Tweet extends Node { + interface Tweet extends Node { id: string; type: "tweet"; html: string; } - export type FlourishLayoutWidth = Extract; - export interface Flourish extends Node { + type FlourishLayoutWidth = Extract; + interface Flourish extends Node { type: "flourish"; id: string; layoutWidth: FlourishLayoutWidth; @@ -580,26 +588,26 @@ export declare namespace ContentTree { fallbackImage?: Image; fragmentIdentifier?: string; } - export interface BigNumber extends Node { + interface BigNumber extends Node { type: "big-number"; number: string; description: string; } - export interface Video extends Node { + interface Video extends Node { type: "video"; id: string; title: string; } - export interface YoutubeVideo extends Node { + interface YoutubeVideo extends Node { type: "youtube-video"; url: string; } - export interface ScrollyBlock extends Parent { + interface ScrollyBlock extends Parent { type: "scrolly-block"; theme: "sans" | "serif"; children: ScrollySection[]; } - export interface ScrollySection extends Parent { + interface ScrollySection extends Parent { type: "scrolly-section"; display: "dark-background" | "light-background"; noBox?: true; @@ -607,31 +615,31 @@ export declare namespace ContentTree { transition?: "delay-before" | "delay-after"; children: [ScrollyImage, ...ScrollyCopy[]]; } - export interface ScrollyImage extends Node { + interface ScrollyImage extends Node { type: "scrolly-image"; id: string; picture: ImageSetPicture; } - export interface ScrollyCopy extends Parent { + interface ScrollyCopy extends Parent { type: "scrolly-copy"; children: (ScrollyHeading | Paragraph)[]; } - export interface ScrollyHeading extends Parent { + interface ScrollyHeading extends Parent { type: "scrolly-heading"; level: "chapter" | "heading" | "subheading"; children: Text[]; } - export interface Layout extends Parent { + interface Layout extends Parent { type: "layout"; layoutName: "auto" | "card" | "timeline"; layoutWidth: string; children: [Heading, LayoutImage, ...LayoutSlot[]] | [Heading, ...LayoutSlot[]] | LayoutSlot[]; } - export interface LayoutSlot extends Parent { + interface LayoutSlot extends Parent { type: "layout-slot"; children: (Heading | Paragraph | LayoutImage)[]; } - export interface LayoutImage extends Node { + interface LayoutImage extends Node { type: "layout-image"; id: string; alt: string; @@ -639,36 +647,36 @@ export declare namespace ContentTree { credit: string; picture: ImageSetPicture; } - export type TableColumnSettings = { + type TableColumnSettings = { hideOnMobile: boolean; sortable: boolean; sortType: 'text' | 'number' | 'date' | 'currency' | 'percent'; }; - export type TableLayoutWidth = Extract; - export interface TableCaption extends Parent { + type TableLayoutWidth = Extract; + interface TableCaption extends Parent { type: 'table-caption'; children: Phrasing[]; } - export interface TableCell extends Parent { + interface TableCell extends Parent { type: 'table-cell'; heading?: boolean; columnSpan?: number; rowSpan?: number; children: Phrasing[]; } - export interface TableRow extends Parent { + interface TableRow extends Parent { type: 'table-row'; children: TableCell[]; } - export interface TableBody extends Parent { + interface TableBody extends Parent { type: 'table-body'; children: TableRow[]; } - export interface TableFooter extends Parent { + interface TableFooter extends Parent { type: 'table-footer'; children: Phrasing[]; } - export interface Table extends Parent { + interface Table extends Parent { type: 'table'; stripes: boolean; compact: boolean; @@ -678,10 +686,10 @@ export declare namespace ContentTree { children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody]; columnSettings: TableColumnSettings[]; } - export type CustomCodeComponentAttributes = { + type CustomCodeComponentAttributes = { [key: string]: string | boolean | undefined; }; - export interface CustomCodeComponent extends Node { + interface CustomCodeComponent extends Node { /** Component type */ type: "custom-code-component"; /** Id taken from the CAPI url */ @@ -697,14 +705,14 @@ export declare namespace ContentTree { /** Configuration data to be passed to the component. */ attributes: CustomCodeComponentAttributes; } - export interface ImagePair extends Parent { + interface ImagePair extends Parent { type: 'image-pair'; children: [ImageSet, ImageSet]; } /** * Timeline nodes display a timeline of events in arbitrary order. */ - export interface Timeline extends Parent { + interface Timeline extends Parent { type: "timeline"; /** The title for the timeline */ title: string; @@ -713,7 +721,7 @@ export declare namespace ContentTree { /** * TimelineEvent is the representation of a single event in a Timeline. */ - export interface TimelineEvent extends Parent { + interface TimelineEvent extends Parent { type: "timeline-event"; /** The title of the event */ title: string; @@ -723,7 +731,7 @@ export declare namespace ContentTree { /** * A definition has a term and a related description. It is used to describe a term. */ - export interface Definition extends Node { + interface Definition extends Node { type: "definition"; term: string; description: string; @@ -731,7 +739,7 @@ export declare namespace ContentTree { /** * InNumbers represents a set of numbers with related descriptions. */ - export interface InNumbers extends Parent { + interface InNumbers extends Parent { type: "in-numbers"; /** The title for the InNumbers */ title?: string; @@ -739,11 +747,11 @@ export declare namespace ContentTree { } /** Allowed children for a card */ - export type CardChildren = ImageSet | Exclude; + type CardChildren = ImageSet | Exclude; /** * A card describes a subject with images and text */ - export interface Card extends Parent { + interface Card extends Parent { type: "card"; /** The title of this card */ title?: string; @@ -752,11 +760,11 @@ export declare namespace ContentTree { /** * Allowed layout widths for an InfoBox. */ - export type InfoBoxLayoutWidth = Extract; + type InfoBoxLayoutWidth = Extract; /** * An info box describes a subject via a single card */ - export interface InfoBox extends Parent { + interface InfoBox extends Parent { type: "info-box"; /** The layout width supported by this node */ layoutWidth: InfoBoxLayoutWidth; @@ -765,32 +773,40 @@ export declare namespace ContentTree { /** * InfoPair provides exactly two cards. */ - export interface InfoPair extends Parent { + interface InfoPair extends Parent { type: "info-pair"; /** The title of the info pair */ title?: string; children: [Card, Card]; } - /** - * @sparkGenerateStoryblock true - **/ type AudioPlayer = AudioPlayerV1 | AudioPlayerV2 | AudioPlayerV3; - /** @support deprecated */ - export interface AudioPlayerV1 extends Node { + /** + * @sparkGenerateStoryblock true + * @support deprecated + */ + interface AudioPlayerV1 extends Node { type: "audio-player"; version: 1; title: string; audioUrl: string; } - export interface AudioPlayerV2 extends Node { + /** + * @sparkGenerateStoryblock true + * @sparkInsert true + * @support supported + */ + interface AudioPlayerV2 extends Node { type: "audio-player"; version: 2; title: string; audioId: string; audio: AudioSet; } - /** @support prerelease */ - export interface AudioPlayerV3 extends Node { + /** + * @sparkGenerateStoryblock true + * @support prerelease + */ + interface AudioPlayerV3 extends Node { type: "audio-player"; version: 3; title: string; @@ -802,104 +818,103 @@ export declare namespace ContentTree { /** * Demo placeholders so the AudioPlayer versioning example compiles. */ - export interface AudioSet extends Node { + interface AudioSet extends Node { url: string; } - export interface Transcription extends Node { + interface Transcription extends Node { text: string; } - export {}; } - export namespace transit { - export type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; - export interface Node { + namespace transit { + type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; + interface Node { type: string; data?: any; } - export interface Parent extends Node { + interface Parent extends Node { children: Node[]; } - export interface Root extends Node { + interface Root extends Node { type: "root"; body: Body; } - export interface Body extends Parent { + interface Body extends Parent { type: "body"; version: number; children: BodyBlock[]; } - export type BodyBlock = FormattingBlock | StoryBlock; - export type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; - export interface Text extends Node { + type BodyBlock = FormattingBlock | StoryBlock; + type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; + interface Text extends Node { type: "text"; value: string; } - export type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; - export interface Break extends Node { + type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; + interface Break extends Node { type: "break"; } - export interface ThematicBreak extends Node { + interface ThematicBreak extends Node { type: "thematic-break"; } - export interface Paragraph extends Parent { + interface Paragraph extends Parent { type: "paragraph"; children: Phrasing[]; } - export interface Heading extends Parent { + interface Heading extends Parent { type: "heading"; children: Text[]; level: "chapter" | "subheading" | "label"; fragmentIdentifier?: string; } - export interface Strong extends Parent { + interface Strong extends Parent { type: "strong"; children: Phrasing[]; } - export interface Emphasis extends Parent { + interface Emphasis extends Parent { type: "emphasis"; children: Phrasing[]; } - export interface Strikethrough extends Parent { + interface Strikethrough extends Parent { type: "strikethrough"; children: Phrasing[]; } - export interface Link extends Parent { + interface Link extends Parent { type: "link"; url: string; title: string; children: Phrasing[]; } - export interface FindOutMoreLink extends Parent { + interface FindOutMoreLink extends Parent { type: "find-out-more-link"; url: string; title: string; children: Phrasing[]; } - export interface List extends Parent { + interface List extends Parent { type: "list"; ordered: boolean; children: ListItem[]; } - export interface ListItem extends Parent { + interface ListItem extends Parent { type: "list-item"; children: (Paragraph | Phrasing)[]; } - export interface Blockquote extends Parent { + interface Blockquote extends Parent { type: "blockquote"; children: (Paragraph | Phrasing)[]; } - export type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | AudioPlayer; - export interface Pullquote extends Node { + type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | AudioPlayer; + interface Pullquote extends Node { type: "pullquote"; text: string; source?: string; } - export interface ImageSet extends Node { + interface ImageSet extends Node { type: "image-set"; id: string; fragmentIdentifier?: string; } - export type ImageSetPicture = { + type ImageSetPicture = { layoutWidth: string; imageType: "image" | "graphic"; alt: string; @@ -908,7 +923,7 @@ export declare namespace ContentTree { images: Image[]; fallbackImage: Image; }; - export type Image = { + type Image = { id: string; width: number; height: number; @@ -916,23 +931,23 @@ export declare namespace ContentTree { url: string; sourceSet?: ImageSource[]; }; - export type ImageSource = { + type ImageSource = { url: string; width: number; dpr: number; }; - export interface Recommended extends Node { + interface Recommended extends Node { type: "recommended"; id: string; heading?: string; teaserTitleOverride?: string; } - export interface RecommendedList extends Node { + interface RecommendedList extends Node { type: "recommended-list"; heading?: string; children: Recommended[]; } - export type TeaserConcept = { + type TeaserConcept = { apiUrl: string; directType: string; id: string; @@ -942,7 +957,7 @@ export declare namespace ContentTree { types: string[]; url: string; }; - export type Teaser = { + type Teaser = { id: string; url: string; type: "article" | "video" | "podcast" | "audio" | "package" | "liveblog" | "promoted-content" | "paid-post"; @@ -969,12 +984,12 @@ export declare namespace ContentTree { }; clientName?: string; }; - export interface Tweet extends Node { + interface Tweet extends Node { id: string; type: "tweet"; } - export type FlourishLayoutWidth = Extract; - export interface Flourish extends Node { + type FlourishLayoutWidth = Extract; + interface Flourish extends Node { type: "flourish"; id: string; layoutWidth: FlourishLayoutWidth; @@ -983,25 +998,25 @@ export declare namespace ContentTree { timestamp?: string; fragmentIdentifier?: string; } - export interface BigNumber extends Node { + interface BigNumber extends Node { type: "big-number"; number: string; description: string; } - export interface Video extends Node { + interface Video extends Node { type: "video"; id: string; } - export interface YoutubeVideo extends Node { + interface YoutubeVideo extends Node { type: "youtube-video"; url: string; } - export interface ScrollyBlock extends Parent { + interface ScrollyBlock extends Parent { type: "scrolly-block"; theme: "sans" | "serif"; children: ScrollySection[]; } - export interface ScrollySection extends Parent { + interface ScrollySection extends Parent { type: "scrolly-section"; display: "dark-background" | "light-background"; noBox?: true; @@ -1009,66 +1024,66 @@ export declare namespace ContentTree { transition?: "delay-before" | "delay-after"; children: [ScrollyImage, ...ScrollyCopy[]]; } - export interface ScrollyImage extends Node { + interface ScrollyImage extends Node { type: "scrolly-image"; id: string; } - export interface ScrollyCopy extends Parent { + interface ScrollyCopy extends Parent { type: "scrolly-copy"; children: (ScrollyHeading | Paragraph)[]; } - export interface ScrollyHeading extends Parent { + interface ScrollyHeading extends Parent { type: "scrolly-heading"; level: "chapter" | "heading" | "subheading"; children: Text[]; } - export interface Layout extends Parent { + interface Layout extends Parent { type: "layout"; layoutName: "auto" | "card" | "timeline"; layoutWidth: string; children: [Heading, LayoutImage, ...LayoutSlot[]] | [Heading, ...LayoutSlot[]] | LayoutSlot[]; } - export interface LayoutSlot extends Parent { + interface LayoutSlot extends Parent { type: "layout-slot"; children: (Heading | Paragraph | LayoutImage)[]; } - export interface LayoutImage extends Node { + interface LayoutImage extends Node { type: "layout-image"; id: string; alt: string; caption: string; credit: string; } - export type TableColumnSettings = { + type TableColumnSettings = { hideOnMobile: boolean; sortable: boolean; sortType: 'text' | 'number' | 'date' | 'currency' | 'percent'; }; - export type TableLayoutWidth = Extract; - export interface TableCaption extends Parent { + type TableLayoutWidth = Extract; + interface TableCaption extends Parent { type: 'table-caption'; children: Phrasing[]; } - export interface TableCell extends Parent { + interface TableCell extends Parent { type: 'table-cell'; heading?: boolean; columnSpan?: number; rowSpan?: number; children: Phrasing[]; } - export interface TableRow extends Parent { + interface TableRow extends Parent { type: 'table-row'; children: TableCell[]; } - export interface TableBody extends Parent { + interface TableBody extends Parent { type: 'table-body'; children: TableRow[]; } - export interface TableFooter extends Parent { + interface TableFooter extends Parent { type: 'table-footer'; children: Phrasing[]; } - export interface Table extends Parent { + interface Table extends Parent { type: 'table'; stripes: boolean; compact: boolean; @@ -1078,10 +1093,10 @@ export declare namespace ContentTree { children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody]; columnSettings: TableColumnSettings[]; } - export type CustomCodeComponentAttributes = { + type CustomCodeComponentAttributes = { [key: string]: string | boolean | undefined; }; - export interface CustomCodeComponent extends Node { + interface CustomCodeComponent extends Node { /** Component type */ type: "custom-code-component"; /** Id taken from the CAPI url */ @@ -1089,14 +1104,14 @@ export declare namespace ContentTree { /** How the component should be presented in the article page according to the column layout system */ layoutWidth: LayoutWidth; } - export interface ImagePair extends Parent { + interface ImagePair extends Parent { type: 'image-pair'; children: [ImageSet, ImageSet]; } /** * Timeline nodes display a timeline of events in arbitrary order. */ - export interface Timeline extends Parent { + interface Timeline extends Parent { type: "timeline"; /** The title for the timeline */ title: string; @@ -1105,7 +1120,7 @@ export declare namespace ContentTree { /** * TimelineEvent is the representation of a single event in a Timeline. */ - export interface TimelineEvent extends Parent { + interface TimelineEvent extends Parent { type: "timeline-event"; /** The title of the event */ title: string; @@ -1115,7 +1130,7 @@ export declare namespace ContentTree { /** * A definition has a term and a related description. It is used to describe a term. */ - export interface Definition extends Node { + interface Definition extends Node { type: "definition"; term: string; description: string; @@ -1123,7 +1138,7 @@ export declare namespace ContentTree { /** * InNumbers represents a set of numbers with related descriptions. */ - export interface InNumbers extends Parent { + interface InNumbers extends Parent { type: "in-numbers"; /** The title for the InNumbers */ title?: string; @@ -1131,11 +1146,11 @@ export declare namespace ContentTree { } /** Allowed children for a card */ - export type CardChildren = ImageSet | Exclude; + type CardChildren = ImageSet | Exclude; /** * A card describes a subject with images and text */ - export interface Card extends Parent { + interface Card extends Parent { type: "card"; /** The title of this card */ title?: string; @@ -1144,11 +1159,11 @@ export declare namespace ContentTree { /** * Allowed layout widths for an InfoBox. */ - export type InfoBoxLayoutWidth = Extract; + type InfoBoxLayoutWidth = Extract; /** * An info box describes a subject via a single card */ - export interface InfoBox extends Parent { + interface InfoBox extends Parent { type: "info-box"; /** The layout width supported by this node */ layoutWidth: InfoBoxLayoutWidth; @@ -1157,31 +1172,39 @@ export declare namespace ContentTree { /** * InfoPair provides exactly two cards. */ - export interface InfoPair extends Parent { + interface InfoPair extends Parent { type: "info-pair"; /** The title of the info pair */ title?: string; children: [Card, Card]; } - /** - * @sparkGenerateStoryblock true - **/ type AudioPlayer = AudioPlayerV1 | AudioPlayerV2 | AudioPlayerV3; - /** @support deprecated */ - export interface AudioPlayerV1 extends Node { + /** + * @sparkGenerateStoryblock true + * @support deprecated + */ + interface AudioPlayerV1 extends Node { type: "audio-player"; version: 1; title: string; audioUrl: string; } - export interface AudioPlayerV2 extends Node { + /** + * @sparkGenerateStoryblock true + * @sparkInsert true + * @support supported + */ + interface AudioPlayerV2 extends Node { type: "audio-player"; version: 2; title: string; audioId: string; } - /** @support prerelease */ - export interface AudioPlayerV3 extends Node { + /** + * @sparkGenerateStoryblock true + * @support prerelease + */ + interface AudioPlayerV3 extends Node { type: "audio-player"; version: 3; title: string; @@ -1191,105 +1214,104 @@ export declare namespace ContentTree { /** * Demo placeholders so the AudioPlayer versioning example compiles. */ - export interface AudioSet extends Node { + interface AudioSet extends Node { url: string; } - export interface Transcription extends Node { + interface Transcription extends Node { text: string; } - export {}; } - export namespace loose { - export type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; - export interface Node { + namespace loose { + type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width"; + interface Node { type: string; data?: any; } - export interface Parent extends Node { + interface Parent extends Node { children: Node[]; } - export interface Root extends Node { + interface Root extends Node { type: "root"; body: Body; } - export interface Body extends Parent { + interface Body extends Parent { type: "body"; version: number; children: BodyBlock[]; } - export type BodyBlock = FormattingBlock | StoryBlock; - export type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; - export interface Text extends Node { + type BodyBlock = FormattingBlock | StoryBlock; + type FormattingBlock = Paragraph | Heading | List | Blockquote | ThematicBreak | Text; + interface Text extends Node { type: "text"; value: string; } - export type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; - export interface Break extends Node { + type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link | FindOutMoreLink; + interface Break extends Node { type: "break"; } - export interface ThematicBreak extends Node { + interface ThematicBreak extends Node { type: "thematic-break"; } - export interface Paragraph extends Parent { + interface Paragraph extends Parent { type: "paragraph"; children: Phrasing[]; } - export interface Heading extends Parent { + interface Heading extends Parent { type: "heading"; children: Text[]; level: "chapter" | "subheading" | "label"; fragmentIdentifier?: string; } - export interface Strong extends Parent { + interface Strong extends Parent { type: "strong"; children: Phrasing[]; } - export interface Emphasis extends Parent { + interface Emphasis extends Parent { type: "emphasis"; children: Phrasing[]; } - export interface Strikethrough extends Parent { + interface Strikethrough extends Parent { type: "strikethrough"; children: Phrasing[]; } - export interface Link extends Parent { + interface Link extends Parent { type: "link"; url: string; title: string; children: Phrasing[]; } - export interface FindOutMoreLink extends Parent { + interface FindOutMoreLink extends Parent { type: "find-out-more-link"; url: string; title: string; children: Phrasing[]; } - export interface List extends Parent { + interface List extends Parent { type: "list"; ordered: boolean; children: ListItem[]; } - export interface ListItem extends Parent { + interface ListItem extends Parent { type: "list-item"; children: (Paragraph | Phrasing)[]; } - export interface Blockquote extends Parent { + interface Blockquote extends Parent { type: "blockquote"; children: (Paragraph | Phrasing)[]; } - export type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | AudioPlayer; - export interface Pullquote extends Node { + type StoryBlock = ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | Pullquote | ScrollyBlock | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Timeline | ImagePair | InNumbers | Definition | InfoBox | InfoPair | AudioPlayer; + interface Pullquote extends Node { type: "pullquote"; text: string; source?: string; } - export interface ImageSet extends Node { + interface ImageSet extends Node { type: "image-set"; id: string; picture?: ImageSetPicture; fragmentIdentifier?: string; } - export type ImageSetPicture = { + type ImageSetPicture = { layoutWidth: string; imageType: "image" | "graphic"; alt: string; @@ -1298,7 +1320,7 @@ export declare namespace ContentTree { images: Image[]; fallbackImage: Image; }; - export type Image = { + type Image = { id: string; width: number; height: number; @@ -1306,24 +1328,24 @@ export declare namespace ContentTree { url: string; sourceSet?: ImageSource[]; }; - export type ImageSource = { + type ImageSource = { url: string; width: number; dpr: number; }; - export interface Recommended extends Node { + interface Recommended extends Node { type: "recommended"; id: string; heading?: string; teaserTitleOverride?: string; teaser?: Teaser; } - export interface RecommendedList extends Node { + interface RecommendedList extends Node { type: "recommended-list"; heading?: string; children: Recommended[]; } - export type TeaserConcept = { + type TeaserConcept = { apiUrl: string; directType: string; id: string; @@ -1333,7 +1355,7 @@ export declare namespace ContentTree { types: string[]; url: string; }; - export type Teaser = { + type Teaser = { id: string; url: string; type: "article" | "video" | "podcast" | "audio" | "package" | "liveblog" | "promoted-content" | "paid-post"; @@ -1360,13 +1382,13 @@ export declare namespace ContentTree { }; clientName?: string; }; - export interface Tweet extends Node { + interface Tweet extends Node { id: string; type: "tweet"; html?: string; } - export type FlourishLayoutWidth = Extract; - export interface Flourish extends Node { + type FlourishLayoutWidth = Extract; + interface Flourish extends Node { type: "flourish"; id: string; layoutWidth: FlourishLayoutWidth; @@ -1376,26 +1398,26 @@ export declare namespace ContentTree { fallbackImage?: Image; fragmentIdentifier?: string; } - export interface BigNumber extends Node { + interface BigNumber extends Node { type: "big-number"; number: string; description: string; } - export interface Video extends Node { + interface Video extends Node { type: "video"; id: string; title?: string; } - export interface YoutubeVideo extends Node { + interface YoutubeVideo extends Node { type: "youtube-video"; url: string; } - export interface ScrollyBlock extends Parent { + interface ScrollyBlock extends Parent { type: "scrolly-block"; theme: "sans" | "serif"; children: ScrollySection[]; } - export interface ScrollySection extends Parent { + interface ScrollySection extends Parent { type: "scrolly-section"; display: "dark-background" | "light-background"; noBox?: true; @@ -1403,31 +1425,31 @@ export declare namespace ContentTree { transition?: "delay-before" | "delay-after"; children: [ScrollyImage, ...ScrollyCopy[]]; } - export interface ScrollyImage extends Node { + interface ScrollyImage extends Node { type: "scrolly-image"; id: string; picture?: ImageSetPicture; } - export interface ScrollyCopy extends Parent { + interface ScrollyCopy extends Parent { type: "scrolly-copy"; children: (ScrollyHeading | Paragraph)[]; } - export interface ScrollyHeading extends Parent { + interface ScrollyHeading extends Parent { type: "scrolly-heading"; level: "chapter" | "heading" | "subheading"; children: Text[]; } - export interface Layout extends Parent { + interface Layout extends Parent { type: "layout"; layoutName: "auto" | "card" | "timeline"; layoutWidth: string; children: [Heading, LayoutImage, ...LayoutSlot[]] | [Heading, ...LayoutSlot[]] | LayoutSlot[]; } - export interface LayoutSlot extends Parent { + interface LayoutSlot extends Parent { type: "layout-slot"; children: (Heading | Paragraph | LayoutImage)[]; } - export interface LayoutImage extends Node { + interface LayoutImage extends Node { type: "layout-image"; id: string; alt: string; @@ -1435,36 +1457,36 @@ export declare namespace ContentTree { credit: string; picture?: ImageSetPicture; } - export type TableColumnSettings = { + type TableColumnSettings = { hideOnMobile: boolean; sortable: boolean; sortType: 'text' | 'number' | 'date' | 'currency' | 'percent'; }; - export type TableLayoutWidth = Extract; - export interface TableCaption extends Parent { + type TableLayoutWidth = Extract; + interface TableCaption extends Parent { type: 'table-caption'; children: Phrasing[]; } - export interface TableCell extends Parent { + interface TableCell extends Parent { type: 'table-cell'; heading?: boolean; columnSpan?: number; rowSpan?: number; children: Phrasing[]; } - export interface TableRow extends Parent { + interface TableRow extends Parent { type: 'table-row'; children: TableCell[]; } - export interface TableBody extends Parent { + interface TableBody extends Parent { type: 'table-body'; children: TableRow[]; } - export interface TableFooter extends Parent { + interface TableFooter extends Parent { type: 'table-footer'; children: Phrasing[]; } - export interface Table extends Parent { + interface Table extends Parent { type: 'table'; stripes: boolean; compact: boolean; @@ -1474,10 +1496,10 @@ export declare namespace ContentTree { children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody]; columnSettings: TableColumnSettings[]; } - export type CustomCodeComponentAttributes = { + type CustomCodeComponentAttributes = { [key: string]: string | boolean | undefined; }; - export interface CustomCodeComponent extends Node { + interface CustomCodeComponent extends Node { /** Component type */ type: "custom-code-component"; /** Id taken from the CAPI url */ @@ -1493,14 +1515,14 @@ export declare namespace ContentTree { /** Configuration data to be passed to the component. */ attributes?: CustomCodeComponentAttributes; } - export interface ImagePair extends Parent { + interface ImagePair extends Parent { type: 'image-pair'; children: [ImageSet, ImageSet]; } /** * Timeline nodes display a timeline of events in arbitrary order. */ - export interface Timeline extends Parent { + interface Timeline extends Parent { type: "timeline"; /** The title for the timeline */ title: string; @@ -1509,7 +1531,7 @@ export declare namespace ContentTree { /** * TimelineEvent is the representation of a single event in a Timeline. */ - export interface TimelineEvent extends Parent { + interface TimelineEvent extends Parent { type: "timeline-event"; /** The title of the event */ title: string; @@ -1519,7 +1541,7 @@ export declare namespace ContentTree { /** * A definition has a term and a related description. It is used to describe a term. */ - export interface Definition extends Node { + interface Definition extends Node { type: "definition"; term: string; description: string; @@ -1527,7 +1549,7 @@ export declare namespace ContentTree { /** * InNumbers represents a set of numbers with related descriptions. */ - export interface InNumbers extends Parent { + interface InNumbers extends Parent { type: "in-numbers"; /** The title for the InNumbers */ title?: string; @@ -1535,11 +1557,11 @@ export declare namespace ContentTree { } /** Allowed children for a card */ - export type CardChildren = ImageSet | Exclude; + type CardChildren = ImageSet | Exclude; /** * A card describes a subject with images and text */ - export interface Card extends Parent { + interface Card extends Parent { type: "card"; /** The title of this card */ title?: string; @@ -1548,11 +1570,11 @@ export declare namespace ContentTree { /** * Allowed layout widths for an InfoBox. */ - export type InfoBoxLayoutWidth = Extract; + type InfoBoxLayoutWidth = Extract; /** * An info box describes a subject via a single card */ - export interface InfoBox extends Parent { + interface InfoBox extends Parent { type: "info-box"; /** The layout width supported by this node */ layoutWidth: InfoBoxLayoutWidth; @@ -1561,32 +1583,40 @@ export declare namespace ContentTree { /** * InfoPair provides exactly two cards. */ - export interface InfoPair extends Parent { + interface InfoPair extends Parent { type: "info-pair"; /** The title of the info pair */ title?: string; children: [Card, Card]; } - /** - * @sparkGenerateStoryblock true - **/ type AudioPlayer = AudioPlayerV1 | AudioPlayerV2 | AudioPlayerV3; - /** @support deprecated */ - export interface AudioPlayerV1 extends Node { + /** + * @sparkGenerateStoryblock true + * @support deprecated + */ + interface AudioPlayerV1 extends Node { type: "audio-player"; version: 1; title: string; audioUrl: string; } - export interface AudioPlayerV2 extends Node { + /** + * @sparkGenerateStoryblock true + * @sparkInsert true + * @support supported + */ + interface AudioPlayerV2 extends Node { type: "audio-player"; version: 2; title: string; audioId: string; audio?: AudioSet; } - /** @support prerelease */ - export interface AudioPlayerV3 extends Node { + /** + * @sparkGenerateStoryblock true + * @support prerelease + */ + interface AudioPlayerV3 extends Node { type: "audio-player"; version: 3; title: string; @@ -1598,13 +1628,11 @@ export declare namespace ContentTree { /** * Demo placeholders so the AudioPlayer versioning example compiles. */ - export interface AudioSet extends Node { + interface AudioSet extends Node { url: string; } - export interface Transcription extends Node { + interface Transcription extends Node { text: string; } - export {}; } - export {}; } diff --git a/schemas/body-tree.schema.json b/schemas/body-tree.schema.json index b1d0c1b..2a5c2d0 100644 --- a/schemas/body-tree.schema.json +++ b/schemas/body-tree.schema.json @@ -27,6 +27,7 @@ "type", "version" ], + "sparkGenerateStoryblock": true, "support": "deprecated", "type": "object" }, @@ -55,6 +56,8 @@ "type", "version" ], + "sparkGenerateStoryblock": true, + "support": "supported", "type": "object" }, "ContentTree.transit.AudioPlayerV3": { @@ -86,6 +89,7 @@ "type", "version" ], + "sparkGenerateStoryblock": true, "support": "prerelease", "type": "object" }, diff --git a/schemas/content-tree.schema.json b/schemas/content-tree.schema.json index b524a0c..17cc477 100644 --- a/schemas/content-tree.schema.json +++ b/schemas/content-tree.schema.json @@ -27,6 +27,7 @@ "type", "version" ], + "sparkGenerateStoryblock": true, "support": "deprecated", "type": "object" }, @@ -59,6 +60,8 @@ "type", "version" ], + "sparkGenerateStoryblock": true, + "support": "supported", "type": "object" }, "ContentTree.full.AudioPlayerV3": { @@ -98,6 +101,7 @@ "type", "version" ], + "sparkGenerateStoryblock": true, "support": "prerelease", "type": "object" }, diff --git a/schemas/transit-tree.schema.json b/schemas/transit-tree.schema.json index 305815b..d8e80d3 100644 --- a/schemas/transit-tree.schema.json +++ b/schemas/transit-tree.schema.json @@ -27,6 +27,7 @@ "type", "version" ], + "sparkGenerateStoryblock": true, "support": "deprecated", "type": "object" }, @@ -55,6 +56,8 @@ "type", "version" ], + "sparkGenerateStoryblock": true, + "support": "supported", "type": "object" }, "ContentTree.transit.AudioPlayerV3": { @@ -86,6 +89,7 @@ "type", "version" ], + "sparkGenerateStoryblock": true, "support": "prerelease", "type": "object" },