Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 41 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ type BodyBlock =
| Video
| YoutubeVideo
| Text
| Timeline
| ImagePair
```

Expand Down Expand Up @@ -762,24 +763,24 @@ interface Table extends Parent {

```ts
type CustomCodeComponentAttributes = {
[key: string]: string | boolean | undefined
[key: string]: string | boolean | undefined
}

interface CustomCodeComponent extends Node {
/** Component type */
type: "custom-code-component"
/** Id taken from the CAPI url */
id: string
/** How the component should be presented in the article page according to the column layout system */
layoutWidth: LayoutWidth
/** Repository for the code of the component in the format "[github org]/[github repo]/[component name]". */
external path: string
/** Semantic version of the code of the component, e.g. "^0.3.5". */
external versionRange: string
/** Last date-time when the attributes for this block were modified, in ISO-8601 format. */
external attributesLastModified: string
/** Configuration data to be passed to the component. */
external attributes: CustomCodeComponentAttributes
/** Component type */
type: "custom-code-component"
/** Id taken from the CAPI url */
id: string
/** How the component should be presented in the article page according to the column layout system */
layoutWidth: LayoutWidth
/** Repository for the code of the component in the format "[github org]/[github repo]/[component name]". */
external path: string
/** Semantic version of the code of the component, e.g. "^0.3.5". */
external versionRange: string
/** Last date-time when the attributes for this block were modified, in ISO-8601 format. */
external attributesLastModified: string
/** Configuration data to be passed to the component. */
external attributes: CustomCodeComponentAttributes
}
```

Expand All @@ -799,6 +800,31 @@ interface ImagePair extends Parent {

**ImagePair** is a set of two images

### Timeline

```ts
/**
* Timeline nodes display a timeline of events in arbitrary order.
*/
interface Timeline extends Parent {
type: "timeline"
/** The title for the timeline */
title: string
children: TimelineEvent[]
}

/**
* TimelineEvent is the representation of a single event in a Timeline.
*/
interface TimelineEvent extends Parent {
type: "timeline-event"
/** The title of the event */
title: string
/** A paragraph, a paragraph and an image set, or just an image set */
children: [Paragraph] | [Paragraph, ImageSet] | [ImageSet];
}
```

## License

This software is published by the Financial Times under the [MIT licence](mit).
Expand Down
84 changes: 80 additions & 4 deletions content-tree.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export declare namespace ContentTree {
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | Timeline | ImagePair;
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
interface Node {
Expand Down Expand Up @@ -289,8 +289,27 @@ export declare namespace ContentTree {
type: 'image-pair';
children: [ImageSet, ImageSet];
}
/**
* Timeline nodes display a timeline of events in arbitrary order.
*/
interface Timeline extends Parent {
type: "timeline";
/** The title for the timeline */
title: string;
children: TimelineEvent[];
}
/**
* TimelineEvent is the representation of a single event in a Timeline.
*/
interface TimelineEvent extends Parent {
type: "timeline-event";
/** The title of the event */
title: string;
/** A paragraph, a paragraph and an image set, or just an image set */
children: [Paragraph] | [Paragraph, ImageSet] | [ImageSet];
}
namespace full {
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | Timeline | ImagePair;
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
interface Node {
Expand Down Expand Up @@ -580,9 +599,28 @@ export declare namespace ContentTree {
type: 'image-pair';
children: [ImageSet, ImageSet];
}
/**
* Timeline nodes display a timeline of events in arbitrary order.
*/
interface Timeline extends Parent {
type: "timeline";
/** The title for the timeline */
title: string;
children: TimelineEvent[];
}
/**
* TimelineEvent is the representation of a single event in a Timeline.
*/
interface TimelineEvent extends Parent {
type: "timeline-event";
/** The title of the event */
title: string;
/** A paragraph, a paragraph and an image set, or just an image set */
children: [Paragraph] | [Paragraph, ImageSet] | [ImageSet];
}
}
namespace transit {
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | Timeline | ImagePair;
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
interface Node {
Expand Down Expand Up @@ -857,9 +895,28 @@ export declare namespace ContentTree {
type: 'image-pair';
children: [ImageSet, ImageSet];
}
/**
* Timeline nodes display a timeline of events in arbitrary order.
*/
interface Timeline extends Parent {
type: "timeline";
/** The title for the timeline */
title: string;
children: TimelineEvent[];
}
/**
* TimelineEvent is the representation of a single event in a Timeline.
*/
interface TimelineEvent extends Parent {
type: "timeline-event";
/** The title of the event */
title: string;
/** A paragraph, a paragraph and an image set, or just an image set */
children: [Paragraph] | [Paragraph, ImageSet] | [ImageSet];
}
}
namespace loose {
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | Timeline | ImagePair;
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
interface Node {
Expand Down Expand Up @@ -1149,5 +1206,24 @@ export declare namespace ContentTree {
type: 'image-pair';
children: [ImageSet, ImageSet];
}
/**
* Timeline nodes display a timeline of events in arbitrary order.
*/
interface Timeline extends Parent {
type: "timeline";
/** The title for the timeline */
title: string;
children: TimelineEvent[];
}
/**
* TimelineEvent is the representation of a single event in a Timeline.
*/
interface TimelineEvent extends Parent {
type: "timeline-event";
/** The title of the event */
title: string;
/** A paragraph, a paragraph and an image set, or just an image set */
children: [Paragraph] | [Paragraph, ImageSet] | [ImageSet];
}
}
}
89 changes: 89 additions & 0 deletions schemas/body-tree.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
{
"$ref": "#/definitions/ContentTree.transit.Text"
},
{
"$ref": "#/definitions/ContentTree.transit.Timeline"
},
{
"$ref": "#/definitions/ContentTree.transit.ImagePair"
}
Expand Down Expand Up @@ -1151,6 +1154,92 @@
],
"type": "object"
},
"ContentTree.transit.Timeline": {
"additionalProperties": false,
"description": "Timeline nodes display a timeline of events in arbitrary order.",
"properties": {
"children": {
"items": {
"$ref": "#/definitions/ContentTree.transit.TimelineEvent"
},
"type": "array"
},
"data": {},
"title": {
"description": "The title for the timeline",
"type": "string"
},
"type": {
"const": "timeline",
"type": "string"
}
},
"required": [
"children",
"title",
"type"
],
"type": "object"
},
"ContentTree.transit.TimelineEvent": {
"additionalProperties": false,
"description": "TimelineEvent is the representation of a single event in a Timeline.",
"properties": {
"children": {
"anyOf": [
{
"items": [
{
"$ref": "#/definitions/ContentTree.transit.Paragraph"
}
],
"maxItems": 1,
"minItems": 1,
"type": "array"
},
{
"items": [
{
"$ref": "#/definitions/ContentTree.transit.Paragraph"
},
{
"$ref": "#/definitions/ContentTree.transit.ImageSet"
}
],
"maxItems": 2,
"minItems": 2,
"type": "array"
},
{
"items": [
{
"$ref": "#/definitions/ContentTree.transit.ImageSet"
}
],
"maxItems": 1,
"minItems": 1,
"type": "array"
}
],
"description": "A paragraph, a paragraph and an image set, or just an image set"
},
"data": {},
"title": {
"description": "The title of the event",
"type": "string"
},
"type": {
"const": "timeline-event",
"type": "string"
}
},
"required": [
"children",
"title",
"type"
],
"type": "object"
},
"ContentTree.transit.Tweet": {
"additionalProperties": false,
"properties": {
Expand Down
Loading
Loading