Skip to content

Commit aa5cf13

Browse files
umbobaboleannecornish-ft
authored andcommitted
feat: add timeline and event nodes
1 parent 4ed1162 commit aa5cf13

5 files changed

Lines changed: 316 additions & 19 deletions

File tree

README.md

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ type BodyBlock =
114114
| Video
115115
| YoutubeVideo
116116
| Text
117+
| Timeline
117118
| ImagePair
118119
```
119120
@@ -762,24 +763,24 @@ interface Table extends Parent {
762763

763764
```ts
764765
type CustomCodeComponentAttributes = {
765-
[key: string]: string | boolean | undefined
766+
[key: string]: string | boolean | undefined
766767
}
767768

768769
interface CustomCodeComponent extends Node {
769-
/** Component type */
770-
type: "custom-code-component"
771-
/** Id taken from the CAPI url */
772-
id: string
773-
/** How the component should be presented in the article page according to the column layout system */
774-
layoutWidth: LayoutWidth
775-
/** Repository for the code of the component in the format "[github org]/[github repo]/[component name]". */
776-
external path: string
777-
/** Semantic version of the code of the component, e.g. "^0.3.5". */
778-
external versionRange: string
779-
/** Last date-time when the attributes for this block were modified, in ISO-8601 format. */
780-
external attributesLastModified: string
781-
/** Configuration data to be passed to the component. */
782-
external attributes: CustomCodeComponentAttributes
770+
/** Component type */
771+
type: "custom-code-component"
772+
/** Id taken from the CAPI url */
773+
id: string
774+
/** How the component should be presented in the article page according to the column layout system */
775+
layoutWidth: LayoutWidth
776+
/** Repository for the code of the component in the format "[github org]/[github repo]/[component name]". */
777+
external path: string
778+
/** Semantic version of the code of the component, e.g. "^0.3.5". */
779+
external versionRange: string
780+
/** Last date-time when the attributes for this block were modified, in ISO-8601 format. */
781+
external attributesLastModified: string
782+
/** Configuration data to be passed to the component. */
783+
external attributes: CustomCodeComponentAttributes
783784
}
784785
```
785786

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

800801
**ImagePair** is a set of two images
801802

803+
### Timeline
804+
805+
```ts
806+
/**
807+
* Timeline nodes display a timeline of events in arbitrary order.
808+
*/
809+
interface Timeline extends Parent {
810+
type: "timeline"
811+
/** The title for the timeline */
812+
title: string
813+
children: TimelineEvent[]
814+
}
815+
816+
/**
817+
* TimelineEvent is the representation of a single event in a Timeline.
818+
*/
819+
interface TimelineEvent extends Parent {
820+
type: "timeline-event"
821+
/** The title of the event */
822+
title: string
823+
/** Any combination of paragraphs and image sets */
824+
children: (Paragraph | ImageSet)[];
825+
}
826+
```
827+
802828
## License
803829

804830
This software is published by the Financial Times under the [MIT licence](mit).

content-tree.d.ts

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export declare namespace ContentTree {
2-
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
2+
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | Timeline | ImagePair;
33
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
44
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
55
interface Node {
@@ -289,8 +289,27 @@ export declare namespace ContentTree {
289289
type: 'image-pair';
290290
children: [ImageSet, ImageSet];
291291
}
292+
/**
293+
* Timeline nodes display a timeline of events in arbitrary order.
294+
*/
295+
interface Timeline extends Parent {
296+
type: "timeline";
297+
/** The title for the timeline */
298+
title: string;
299+
children: TimelineEvent[];
300+
}
301+
/**
302+
* TimelineEvent is the representation of a single event in a Timeline.
303+
*/
304+
interface TimelineEvent extends Parent {
305+
type: "timeline-event";
306+
/** The title of the event */
307+
title: string;
308+
/** Any combination of paragraphs and image sets */
309+
children: (Paragraph | ImageSet)[];
310+
}
292311
namespace full {
293-
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
312+
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | Timeline | ImagePair;
294313
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
295314
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
296315
interface Node {
@@ -580,9 +599,28 @@ export declare namespace ContentTree {
580599
type: 'image-pair';
581600
children: [ImageSet, ImageSet];
582601
}
602+
/**
603+
* Timeline nodes display a timeline of events in arbitrary order.
604+
*/
605+
interface Timeline extends Parent {
606+
type: "timeline";
607+
/** The title for the timeline */
608+
title: string;
609+
children: TimelineEvent[];
610+
}
611+
/**
612+
* TimelineEvent is the representation of a single event in a Timeline.
613+
*/
614+
interface TimelineEvent extends Parent {
615+
type: "timeline-event";
616+
/** The title of the event */
617+
title: string;
618+
/** Any combination of paragraphs and image sets */
619+
children: (Paragraph | ImageSet)[];
620+
}
583621
}
584622
namespace transit {
585-
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
623+
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | Timeline | ImagePair;
586624
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
587625
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
588626
interface Node {
@@ -857,9 +895,28 @@ export declare namespace ContentTree {
857895
type: 'image-pair';
858896
children: [ImageSet, ImageSet];
859897
}
898+
/**
899+
* Timeline nodes display a timeline of events in arbitrary order.
900+
*/
901+
interface Timeline extends Parent {
902+
type: "timeline";
903+
/** The title for the timeline */
904+
title: string;
905+
children: TimelineEvent[];
906+
}
907+
/**
908+
* TimelineEvent is the representation of a single event in a Timeline.
909+
*/
910+
interface TimelineEvent extends Parent {
911+
type: "timeline-event";
912+
/** The title of the event */
913+
title: string;
914+
/** Any combination of paragraphs and image sets */
915+
children: (Paragraph | ImageSet)[];
916+
}
860917
}
861918
namespace loose {
862-
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | ImagePair;
919+
type BodyBlock = Paragraph | Heading | ImageSet | Flourish | BigNumber | CustomCodeComponent | Layout | List | Blockquote | Pullquote | ScrollyBlock | ThematicBreak | Table | Recommended | RecommendedList | Tweet | Video | YoutubeVideo | Text | Timeline | ImagePair;
863920
type LayoutWidth = "auto" | "in-line" | "inset-left" | "inset-right" | "full-bleed" | "full-grid" | "mid-grid" | "full-width";
864921
type Phrasing = Text | Break | Strong | Emphasis | Strikethrough | Link;
865922
interface Node {
@@ -1149,5 +1206,24 @@ export declare namespace ContentTree {
11491206
type: 'image-pair';
11501207
children: [ImageSet, ImageSet];
11511208
}
1209+
/**
1210+
* Timeline nodes display a timeline of events in arbitrary order.
1211+
*/
1212+
interface Timeline extends Parent {
1213+
type: "timeline";
1214+
/** The title for the timeline */
1215+
title: string;
1216+
children: TimelineEvent[];
1217+
}
1218+
/**
1219+
* TimelineEvent is the representation of a single event in a Timeline.
1220+
*/
1221+
interface TimelineEvent extends Parent {
1222+
type: "timeline-event";
1223+
/** The title of the event */
1224+
title: string;
1225+
/** Any combination of paragraphs and image sets */
1226+
children: (Paragraph | ImageSet)[];
1227+
}
11521228
}
11531229
}

schemas/body-tree.schema.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@
126126
{
127127
"$ref": "#/definitions/ContentTree.transit.Text"
128128
},
129+
{
130+
"$ref": "#/definitions/ContentTree.transit.Timeline"
131+
},
129132
{
130133
"$ref": "#/definitions/ContentTree.transit.ImagePair"
131134
}
@@ -1151,6 +1154,68 @@
11511154
],
11521155
"type": "object"
11531156
},
1157+
"ContentTree.transit.Timeline": {
1158+
"additionalProperties": false,
1159+
"description": "Timeline nodes display a timeline of events in arbitrary order.",
1160+
"properties": {
1161+
"children": {
1162+
"items": {
1163+
"$ref": "#/definitions/ContentTree.transit.TimelineEvent"
1164+
},
1165+
"type": "array"
1166+
},
1167+
"data": {},
1168+
"title": {
1169+
"description": "The title for the timeline",
1170+
"type": "string"
1171+
},
1172+
"type": {
1173+
"const": "timeline",
1174+
"type": "string"
1175+
}
1176+
},
1177+
"required": [
1178+
"children",
1179+
"title",
1180+
"type"
1181+
],
1182+
"type": "object"
1183+
},
1184+
"ContentTree.transit.TimelineEvent": {
1185+
"additionalProperties": false,
1186+
"description": "TimelineEvent is the representation of a single event in a Timeline.",
1187+
"properties": {
1188+
"children": {
1189+
"description": "Any combination of paragraphs and image sets",
1190+
"items": {
1191+
"anyOf": [
1192+
{
1193+
"$ref": "#/definitions/ContentTree.transit.Paragraph"
1194+
},
1195+
{
1196+
"$ref": "#/definitions/ContentTree.transit.ImageSet"
1197+
}
1198+
]
1199+
},
1200+
"type": "array"
1201+
},
1202+
"data": {},
1203+
"title": {
1204+
"description": "The title of the event",
1205+
"type": "string"
1206+
},
1207+
"type": {
1208+
"const": "timeline-event",
1209+
"type": "string"
1210+
}
1211+
},
1212+
"required": [
1213+
"children",
1214+
"title",
1215+
"type"
1216+
],
1217+
"type": "object"
1218+
},
11541219
"ContentTree.transit.Tweet": {
11551220
"additionalProperties": false,
11561221
"properties": {

schemas/content-tree.schema.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@
151151
{
152152
"$ref": "#/definitions/ContentTree.full.Text"
153153
},
154+
{
155+
"$ref": "#/definitions/ContentTree.full.Timeline"
156+
},
154157
{
155158
"$ref": "#/definitions/ContentTree.full.ImagePair"
156159
}
@@ -1932,6 +1935,68 @@
19321935
],
19331936
"type": "object"
19341937
},
1938+
"ContentTree.full.Timeline": {
1939+
"additionalProperties": false,
1940+
"description": "Timeline nodes display a timeline of events in arbitrary order.",
1941+
"properties": {
1942+
"children": {
1943+
"items": {
1944+
"$ref": "#/definitions/ContentTree.full.TimelineEvent"
1945+
},
1946+
"type": "array"
1947+
},
1948+
"data": {},
1949+
"title": {
1950+
"description": "The title for the timeline",
1951+
"type": "string"
1952+
},
1953+
"type": {
1954+
"const": "timeline",
1955+
"type": "string"
1956+
}
1957+
},
1958+
"required": [
1959+
"children",
1960+
"title",
1961+
"type"
1962+
],
1963+
"type": "object"
1964+
},
1965+
"ContentTree.full.TimelineEvent": {
1966+
"additionalProperties": false,
1967+
"description": "TimelineEvent is the representation of a single event in a Timeline.",
1968+
"properties": {
1969+
"children": {
1970+
"description": "Any combination of paragraphs and image sets",
1971+
"items": {
1972+
"anyOf": [
1973+
{
1974+
"$ref": "#/definitions/ContentTree.full.Paragraph"
1975+
},
1976+
{
1977+
"$ref": "#/definitions/ContentTree.full.ImageSet"
1978+
}
1979+
]
1980+
},
1981+
"type": "array"
1982+
},
1983+
"data": {},
1984+
"title": {
1985+
"description": "The title of the event",
1986+
"type": "string"
1987+
},
1988+
"type": {
1989+
"const": "timeline-event",
1990+
"type": "string"
1991+
}
1992+
},
1993+
"required": [
1994+
"children",
1995+
"title",
1996+
"type"
1997+
],
1998+
"type": "object"
1999+
},
19352000
"ContentTree.full.Tweet": {
19362001
"additionalProperties": false,
19372002
"properties": {

0 commit comments

Comments
 (0)