Skip to content

Commit 67054db

Browse files
authored
Merge pull request #101 from Financial-Times/flourish-layout-width
fix: use stricter layoutWidth definition for flourish
2 parents 7f75574 + f10f86c commit 67054db

File tree

5 files changed

+87
-43
lines changed

5 files changed

+87
-43
lines changed

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ interface Strong extends Parent {
263263
```
264264

265265
**Strong** represents contents with strong importance, seriousness or urgency.
266-
266+
267267
### `Emphasis`
268268

269269
```ts
@@ -507,10 +507,13 @@ interface Tweet extends Node {
507507
### `Flourish`
508508

509509
```ts
510+
511+
type FlourishLayoutWidth = Extract<LayoutWidth, "full-grid" | "in-line">
512+
510513
interface Flourish extends Node {
511514
type: "flourish"
512515
id: string
513-
layoutWidth: string
516+
layoutWidth: FlourishLayoutWidth
514517
flourishType: string
515518
description?: string
516519
timestamp?: string
@@ -679,6 +682,14 @@ type TableColumnSettings = {
679682
sortType: 'text' | 'number' | 'date' | 'currency' | 'percent'
680683
}
681684

685+
type TableLayoutWidth = Extract<LayoutWidth,
686+
| 'auto'
687+
| 'full-grid'
688+
| 'inset-left'
689+
| 'inset-right'
690+
| 'full-bleed'>
691+
692+
682693
interface TableCaption extends Parent {
683694
type: 'table-caption'
684695
children: Phrasing[]
@@ -711,12 +722,7 @@ interface Table extends Parent {
711722
type: 'table'
712723
stripes: boolean
713724
compact: boolean
714-
layoutWidth:
715-
| 'auto'
716-
| 'full-grid'
717-
| 'inset-left'
718-
| 'inset-right'
719-
| 'full-bleed'
725+
layoutWidth: TableLayoutWidth
720726
collapseAfterHowManyRows?: number
721727
responsiveStyle: 'overflow' | 'flat' | 'scroll'
722728
children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody]

content-tree.d.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,11 @@ export declare namespace ContentTree {
150150
type: "tweet";
151151
html: string;
152152
}
153+
type FlourishLayoutWidth = Extract<LayoutWidth, "full-grid" | "in-line">;
153154
interface Flourish extends Node {
154155
type: "flourish";
155156
id: string;
156-
layoutWidth: string;
157+
layoutWidth: FlourishLayoutWidth;
157158
flourishType: string;
158159
description?: string;
159160
timestamp?: string;
@@ -224,6 +225,7 @@ export declare namespace ContentTree {
224225
sortable: boolean;
225226
sortType: 'text' | 'number' | 'date' | 'currency' | 'percent';
226227
};
228+
type TableLayoutWidth = Extract<LayoutWidth, 'auto' | 'full-grid' | 'inset-left' | 'inset-right' | 'full-bleed'>;
227229
interface TableCaption extends Parent {
228230
type: 'table-caption';
229231
children: Phrasing[];
@@ -251,7 +253,7 @@ export declare namespace ContentTree {
251253
type: 'table';
252254
stripes: boolean;
253255
compact: boolean;
254-
layoutWidth: 'auto' | 'full-grid' | 'inset-left' | 'inset-right' | 'full-bleed';
256+
layoutWidth: TableLayoutWidth;
255257
collapseAfterHowManyRows?: number;
256258
responsiveStyle: 'overflow' | 'flat' | 'scroll';
257259
children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody];
@@ -428,10 +430,11 @@ export declare namespace ContentTree {
428430
type: "tweet";
429431
html: string;
430432
}
433+
type FlourishLayoutWidth = Extract<LayoutWidth, "full-grid" | "in-line">;
431434
interface Flourish extends Node {
432435
type: "flourish";
433436
id: string;
434-
layoutWidth: string;
437+
layoutWidth: FlourishLayoutWidth;
435438
flourishType: string;
436439
description?: string;
437440
timestamp?: string;
@@ -502,6 +505,7 @@ export declare namespace ContentTree {
502505
sortable: boolean;
503506
sortType: 'text' | 'number' | 'date' | 'currency' | 'percent';
504507
};
508+
type TableLayoutWidth = Extract<LayoutWidth, 'auto' | 'full-grid' | 'inset-left' | 'inset-right' | 'full-bleed'>;
505509
interface TableCaption extends Parent {
506510
type: 'table-caption';
507511
children: Phrasing[];
@@ -529,7 +533,7 @@ export declare namespace ContentTree {
529533
type: 'table';
530534
stripes: boolean;
531535
compact: boolean;
532-
layoutWidth: 'auto' | 'full-grid' | 'inset-left' | 'inset-right' | 'full-bleed';
536+
layoutWidth: TableLayoutWidth;
533537
collapseAfterHowManyRows?: number;
534538
responsiveStyle: 'overflow' | 'flat' | 'scroll';
535539
children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody];
@@ -704,10 +708,11 @@ export declare namespace ContentTree {
704708
id: string;
705709
type: "tweet";
706710
}
711+
type FlourishLayoutWidth = Extract<LayoutWidth, "full-grid" | "in-line">;
707712
interface Flourish extends Node {
708713
type: "flourish";
709714
id: string;
710-
layoutWidth: string;
715+
layoutWidth: FlourishLayoutWidth;
711716
flourishType: string;
712717
description?: string;
713718
timestamp?: string;
@@ -774,6 +779,7 @@ export declare namespace ContentTree {
774779
sortable: boolean;
775780
sortType: 'text' | 'number' | 'date' | 'currency' | 'percent';
776781
};
782+
type TableLayoutWidth = Extract<LayoutWidth, 'auto' | 'full-grid' | 'inset-left' | 'inset-right' | 'full-bleed'>;
777783
interface TableCaption extends Parent {
778784
type: 'table-caption';
779785
children: Phrasing[];
@@ -801,7 +807,7 @@ export declare namespace ContentTree {
801807
type: 'table';
802808
stripes: boolean;
803809
compact: boolean;
804-
layoutWidth: 'auto' | 'full-grid' | 'inset-left' | 'inset-right' | 'full-bleed';
810+
layoutWidth: TableLayoutWidth;
805811
collapseAfterHowManyRows?: number;
806812
responsiveStyle: 'overflow' | 'flat' | 'scroll';
807813
children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody];
@@ -971,10 +977,11 @@ export declare namespace ContentTree {
971977
type: "tweet";
972978
html?: string;
973979
}
980+
type FlourishLayoutWidth = Extract<LayoutWidth, "full-grid" | "in-line">;
974981
interface Flourish extends Node {
975982
type: "flourish";
976983
id: string;
977-
layoutWidth: string;
984+
layoutWidth: FlourishLayoutWidth;
978985
flourishType: string;
979986
description?: string;
980987
timestamp?: string;
@@ -1045,6 +1052,7 @@ export declare namespace ContentTree {
10451052
sortable: boolean;
10461053
sortType: 'text' | 'number' | 'date' | 'currency' | 'percent';
10471054
};
1055+
type TableLayoutWidth = Extract<LayoutWidth, 'auto' | 'full-grid' | 'inset-left' | 'inset-right' | 'full-bleed'>;
10481056
interface TableCaption extends Parent {
10491057
type: 'table-caption';
10501058
children: Phrasing[];
@@ -1072,7 +1080,7 @@ export declare namespace ContentTree {
10721080
type: 'table';
10731081
stripes: boolean;
10741082
compact: boolean;
1075-
layoutWidth: 'auto' | 'full-grid' | 'inset-left' | 'inset-right' | 'full-bleed';
1083+
layoutWidth: TableLayoutWidth;
10761084
collapseAfterHowManyRows?: number;
10771085
responsiveStyle: 'overflow' | 'flat' | 'scroll';
10781086
children: [TableCaption, TableBody, TableFooter] | [TableCaption, TableBody] | [TableBody, TableFooter] | [TableBody];

schemas/body-tree.schema.json

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
"type": "string"
203203
},
204204
"layoutWidth": {
205-
"type": "string"
205+
"$ref": "#/definitions/ContentTree.transit.FlourishLayoutWidth"
206206
},
207207
"timestamp": {
208208
"type": "string"
@@ -220,6 +220,13 @@
220220
],
221221
"type": "object"
222222
},
223+
"ContentTree.transit.FlourishLayoutWidth": {
224+
"enum": [
225+
"full-grid",
226+
"in-line"
227+
],
228+
"type": "string"
229+
},
223230
"ContentTree.transit.Heading": {
224231
"additionalProperties": false,
225232
"properties": {
@@ -897,14 +904,7 @@
897904
},
898905
"data": {},
899906
"layoutWidth": {
900-
"enum": [
901-
"auto",
902-
"full-bleed",
903-
"full-grid",
904-
"inset-left",
905-
"inset-right"
906-
],
907-
"type": "string"
907+
"$ref": "#/definitions/ContentTree.transit.TableLayoutWidth"
908908
},
909909
"responsiveStyle": {
910910
"enum": [
@@ -1026,6 +1026,16 @@
10261026
],
10271027
"type": "object"
10281028
},
1029+
"ContentTree.transit.TableLayoutWidth": {
1030+
"enum": [
1031+
"auto",
1032+
"full-bleed",
1033+
"full-grid",
1034+
"inset-left",
1035+
"inset-right"
1036+
],
1037+
"type": "string"
1038+
},
10291039
"ContentTree.transit.TableRow": {
10301040
"additionalProperties": false,
10311041
"properties": {

schemas/content-tree.schema.json

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@
313313
"type": "string"
314314
},
315315
"layoutWidth": {
316-
"type": "string"
316+
"$ref": "#/definitions/ContentTree.full.FlourishLayoutWidth"
317317
},
318318
"timestamp": {
319319
"type": "string"
@@ -331,6 +331,13 @@
331331
],
332332
"type": "object"
333333
},
334+
"ContentTree.full.FlourishLayoutWidth": {
335+
"enum": [
336+
"full-grid",
337+
"in-line"
338+
],
339+
"type": "string"
340+
},
334341
"ContentTree.full.Heading": {
335342
"additionalProperties": false,
336343
"properties": {
@@ -1675,14 +1682,7 @@
16751682
},
16761683
"data": {},
16771684
"layoutWidth": {
1678-
"enum": [
1679-
"auto",
1680-
"full-bleed",
1681-
"full-grid",
1682-
"inset-left",
1683-
"inset-right"
1684-
],
1685-
"type": "string"
1685+
"$ref": "#/definitions/ContentTree.full.TableLayoutWidth"
16861686
},
16871687
"responsiveStyle": {
16881688
"enum": [
@@ -1804,6 +1804,16 @@
18041804
],
18051805
"type": "object"
18061806
},
1807+
"ContentTree.full.TableLayoutWidth": {
1808+
"enum": [
1809+
"auto",
1810+
"full-bleed",
1811+
"full-grid",
1812+
"inset-left",
1813+
"inset-right"
1814+
],
1815+
"type": "string"
1816+
},
18071817
"ContentTree.full.TableRow": {
18081818
"additionalProperties": false,
18091819
"properties": {

schemas/transit-tree.schema.json

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
"type": "string"
228228
},
229229
"layoutWidth": {
230-
"type": "string"
230+
"$ref": "#/definitions/ContentTree.transit.FlourishLayoutWidth"
231231
},
232232
"timestamp": {
233233
"type": "string"
@@ -245,6 +245,13 @@
245245
],
246246
"type": "object"
247247
},
248+
"ContentTree.transit.FlourishLayoutWidth": {
249+
"enum": [
250+
"full-grid",
251+
"in-line"
252+
],
253+
"type": "string"
254+
},
248255
"ContentTree.transit.Heading": {
249256
"additionalProperties": false,
250257
"properties": {
@@ -922,14 +929,7 @@
922929
},
923930
"data": {},
924931
"layoutWidth": {
925-
"enum": [
926-
"auto",
927-
"full-bleed",
928-
"full-grid",
929-
"inset-left",
930-
"inset-right"
931-
],
932-
"type": "string"
932+
"$ref": "#/definitions/ContentTree.transit.TableLayoutWidth"
933933
},
934934
"responsiveStyle": {
935935
"enum": [
@@ -1051,6 +1051,16 @@
10511051
],
10521052
"type": "object"
10531053
},
1054+
"ContentTree.transit.TableLayoutWidth": {
1055+
"enum": [
1056+
"auto",
1057+
"full-bleed",
1058+
"full-grid",
1059+
"inset-left",
1060+
"inset-right"
1061+
],
1062+
"type": "string"
1063+
},
10541064
"ContentTree.transit.TableRow": {
10551065
"additionalProperties": false,
10561066
"properties": {

0 commit comments

Comments
 (0)