@prismicio/types-internal 3.4.0-alpha.8 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/content/Document.d.ts +433 -325
- package/lib/content/Document.js +8 -0
- package/lib/content/fields/GroupContent.d.ts +1 -1
- package/lib/content/fields/GroupContent.js +12 -1
- package/lib/content/fields/RepeatableContent.d.ts +123 -51
- package/lib/content/fields/RepeatableContent.js +14 -10
- package/lib/content/fields/WidgetContent.d.ts +432 -324
- package/lib/content/fields/nestable/NestableContent.d.ts +72 -54
- package/lib/content/fields/nestable/NestableContent.js +7 -0
- package/lib/content/fields/nestable/RepeatableContent.d.ts +2 -2
- package/lib/content/fields/nestable/RepeatableContent.js +5 -2
- package/lib/content/fields/nestable/RichTextContent/Blocks.d.ts +112 -0
- package/lib/content/fields/nestable/RichTextContent/Blocks.js +5 -5
- package/lib/content/fields/nestable/RichTextContent/index.d.ts +9 -641
- package/lib/content/fields/nestable/RichTextContent/index.js +4 -8
- package/lib/content/fields/nestable/TableContent.d.ts +536 -618
- package/lib/content/fields/nestable/TableContent.js +101 -15
- package/lib/content/fields/slices/Slice/CompositeSliceContent.d.ts +144 -108
- package/lib/content/fields/slices/Slice/RepeatableContent.d.ts +24 -18
- package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +144 -108
- package/lib/content/fields/slices/Slice/SharedSliceContent.js +12 -0
- package/lib/content/fields/slices/Slice/SimpleSliceContent.d.ts +72 -54
- package/lib/content/fields/slices/Slice/SlicePrimaryContent.d.ts +72 -54
- package/lib/content/fields/slices/Slice/index.d.ts +240 -180
- package/lib/content/fields/slices/SliceItem.d.ts +240 -180
- package/lib/content/fields/slices/SlicesContent.d.ts +360 -270
- package/lib/customtypes/CustomType.d.ts +108 -0
- package/lib/customtypes/Section.d.ts +108 -0
- package/lib/customtypes/diff/SharedSlice.d.ts +48 -0
- package/lib/customtypes/diff/Variation.d.ts +48 -0
- package/lib/customtypes/widgets/Group.d.ts +36 -0
- package/lib/customtypes/widgets/Widget.d.ts +126 -0
- package/lib/customtypes/widgets/nestable/NestableWidget.d.ts +6 -0
- package/lib/customtypes/widgets/nestable/NestableWidget.js +2 -0
- package/lib/customtypes/widgets/nestable/RichText.d.ts +0 -2
- package/lib/customtypes/widgets/nestable/RichText.js +0 -2
- package/lib/customtypes/widgets/nestable/Table.d.ts +6 -0
- package/lib/customtypes/widgets/nestable/Table.js +13 -1
- package/lib/customtypes/widgets/slices/CompositeSlice.d.ts +12 -0
- package/lib/customtypes/widgets/slices/LegacySlice.d.ts +12 -0
- package/lib/customtypes/widgets/slices/SharedSlice.d.ts +48 -0
- package/lib/customtypes/widgets/slices/SlicePrimaryWidget.d.ts +36 -0
- package/lib/customtypes/widgets/slices/Slices.d.ts +168 -0
- package/package.json +1 -1
- package/src/content/Document.ts +9 -0
- package/src/content/fields/GroupContent.ts +15 -1
- package/src/content/fields/nestable/NestableContent.ts +12 -0
- package/src/content/fields/nestable/RepeatableContent.ts +6 -2
- package/src/content/fields/nestable/RichTextContent/Blocks.ts +238 -0
- package/src/content/fields/nestable/RichTextContent/index.ts +3 -7
- package/src/content/fields/nestable/TableContent.ts +131 -14
- package/src/content/fields/slices/Slice/SharedSliceContent.ts +13 -0
- package/src/customtypes/widgets/nestable/NestableWidget.ts +2 -0
- package/src/customtypes/widgets/nestable/RichText.ts +0 -2
- package/src/customtypes/widgets/nestable/Table.ts +13 -0
- package/lib/content/fields/nestable/RichTextContent/Block.d.ts +0 -1036
- package/lib/content/fields/nestable/RichTextContent/Block.js +0 -31
- package/lib/content/fields/nestable/RichTextContent/EmbedBlock.d.ts +0 -60
- package/lib/content/fields/nestable/RichTextContent/EmbedBlock.js +0 -53
- package/lib/content/fields/nestable/RichTextContent/ImageBlock.d.ts +0 -203
- package/lib/content/fields/nestable/RichTextContent/ImageBlock.js +0 -36
- package/lib/content/fields/nestable/RichTextContent/TableBlock.d.ts +0 -500
- package/lib/content/fields/nestable/RichTextContent/TableBlock.js +0 -21
- package/lib/content/fields/nestable/RichTextContent/TextBlock.d.ts +0 -590
- package/lib/content/fields/nestable/RichTextContent/TextBlock.js +0 -80
- package/src/content/fields/nestable/RichTextContent/Block.ts +0 -35
- package/src/content/fields/nestable/RichTextContent/EmbedBlock.ts +0 -81
- package/src/content/fields/nestable/RichTextContent/ImageBlock.ts +0 -42
- package/src/content/fields/nestable/RichTextContent/TableBlock.ts +0 -36
- package/src/content/fields/nestable/RichTextContent/TextBlock.ts +0 -108
|
@@ -317,7 +317,7 @@ export declare const NestableContent: t.UnionC<[t.ExactC<t.TypeC<{
|
|
|
317
317
|
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
318
318
|
direction: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
319
319
|
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
320
|
-
type: t.Type<"image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl"
|
|
320
|
+
type: t.Type<"image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl", "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl", unknown>;
|
|
321
321
|
content: t.IntersectionC<[t.TypeC<{
|
|
322
322
|
text: t.StringC;
|
|
323
323
|
}>, t.PartialC<{
|
|
@@ -426,14 +426,19 @@ export declare const NestableContent: t.UnionC<[t.ExactC<t.TypeC<{
|
|
|
426
426
|
}>, t.PartialC<{
|
|
427
427
|
label: t.StringC;
|
|
428
428
|
direction: t.StringC;
|
|
429
|
-
}>]
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
429
|
+
}>]>>]>>;
|
|
430
|
+
}>>, t.ExactC<t.TypeC<{
|
|
431
|
+
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
432
|
+
}>>, t.ExactC<t.TypeC<{
|
|
433
|
+
__TYPE__: t.LiteralC<"TableContent">;
|
|
434
|
+
content: t.ArrayC<t.ExactC<t.TypeC<{
|
|
435
|
+
type: t.LiteralC<"tableRow">;
|
|
436
|
+
content: t.ArrayC<t.UnionC<[t.ExactC<t.TypeC<{
|
|
437
|
+
type: t.LiteralC<"tableHeader">;
|
|
438
|
+
content: t.ExactC<t.TypeC<{
|
|
439
|
+
__TYPE__: t.LiteralC<"StructuredTextContent">;
|
|
440
|
+
value: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
441
|
+
type: t.Type<"image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl", "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl", unknown>;
|
|
437
442
|
content: t.IntersectionC<[t.TypeC<{
|
|
438
443
|
text: t.StringC;
|
|
439
444
|
}>, t.PartialC<{
|
|
@@ -543,10 +548,13 @@ export declare const NestableContent: t.UnionC<[t.ExactC<t.TypeC<{
|
|
|
543
548
|
label: t.StringC;
|
|
544
549
|
direction: t.StringC;
|
|
545
550
|
}>]>>>;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
551
|
+
}>>;
|
|
552
|
+
}>>, t.ExactC<t.TypeC<{
|
|
553
|
+
type: t.LiteralC<"tableCell">;
|
|
554
|
+
content: t.ExactC<t.TypeC<{
|
|
555
|
+
__TYPE__: t.LiteralC<"StructuredTextContent">;
|
|
556
|
+
value: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
557
|
+
type: t.Type<"image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl", "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl", unknown>;
|
|
550
558
|
content: t.IntersectionC<[t.TypeC<{
|
|
551
559
|
text: t.StringC;
|
|
552
560
|
}>, t.PartialC<{
|
|
@@ -656,11 +664,9 @@ export declare const NestableContent: t.UnionC<[t.ExactC<t.TypeC<{
|
|
|
656
664
|
label: t.StringC;
|
|
657
665
|
direction: t.StringC;
|
|
658
666
|
}>]>>>;
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
}>>, t.ExactC<t.TypeC<{
|
|
663
|
-
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
667
|
+
}>>;
|
|
668
|
+
}>>]>>;
|
|
669
|
+
}>>>;
|
|
664
670
|
}>>, t.ExactC<t.TypeC<{
|
|
665
671
|
__TYPE__: t.LiteralC<"RepeatableContent">;
|
|
666
672
|
type: t.LiteralC<"Link">;
|
|
@@ -1105,7 +1111,7 @@ export declare const isNestableContent: (u: unknown) => u is {
|
|
|
1105
1111
|
label?: string | null | undefined;
|
|
1106
1112
|
direction?: string | null | undefined;
|
|
1107
1113
|
}) | ({
|
|
1108
|
-
type: "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl"
|
|
1114
|
+
type: "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl";
|
|
1109
1115
|
content: {
|
|
1110
1116
|
text: string;
|
|
1111
1117
|
} & {
|
|
@@ -1164,14 +1170,19 @@ export declare const isNestableContent: (u: unknown) => u is {
|
|
|
1164
1170
|
} & {
|
|
1165
1171
|
label?: string;
|
|
1166
1172
|
direction?: string;
|
|
1167
|
-
})
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1173
|
+
}))[];
|
|
1174
|
+
} | {
|
|
1175
|
+
__TYPE__: "SeparatorContent";
|
|
1176
|
+
} | {
|
|
1177
|
+
__TYPE__: "TableContent";
|
|
1178
|
+
content: {
|
|
1179
|
+
type: "tableRow";
|
|
1180
|
+
content: ({
|
|
1181
|
+
type: "tableHeader";
|
|
1182
|
+
content: {
|
|
1183
|
+
__TYPE__: "StructuredTextContent";
|
|
1184
|
+
value: ({
|
|
1185
|
+
type: "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl";
|
|
1175
1186
|
content: {
|
|
1176
1187
|
text: string;
|
|
1177
1188
|
} & {
|
|
@@ -1231,10 +1242,13 @@ export declare const isNestableContent: (u: unknown) => u is {
|
|
|
1231
1242
|
label?: string;
|
|
1232
1243
|
direction?: string;
|
|
1233
1244
|
})[];
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1245
|
+
};
|
|
1246
|
+
} | {
|
|
1247
|
+
type: "tableCell";
|
|
1248
|
+
content: {
|
|
1249
|
+
__TYPE__: "StructuredTextContent";
|
|
1250
|
+
value: ({
|
|
1251
|
+
type: "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl";
|
|
1238
1252
|
content: {
|
|
1239
1253
|
text: string;
|
|
1240
1254
|
} & {
|
|
@@ -1294,11 +1308,9 @@ export declare const isNestableContent: (u: unknown) => u is {
|
|
|
1294
1308
|
label?: string;
|
|
1295
1309
|
direction?: string;
|
|
1296
1310
|
})[];
|
|
1297
|
-
}
|
|
1298
|
-
}[];
|
|
1299
|
-
}
|
|
1300
|
-
} | {
|
|
1301
|
-
__TYPE__: "SeparatorContent";
|
|
1311
|
+
};
|
|
1312
|
+
})[];
|
|
1313
|
+
}[];
|
|
1302
1314
|
};
|
|
1303
1315
|
export declare const NestableLegacy: (ctx: LegacyContentCtx) => {
|
|
1304
1316
|
decode(value: unknown): import("fp-ts/lib/Either").Left<t.Errors> | import("fp-ts/lib/Either").Right<{
|
|
@@ -1660,7 +1672,7 @@ export declare const NestableLegacy: (ctx: LegacyContentCtx) => {
|
|
|
1660
1672
|
label?: string | null | undefined;
|
|
1661
1673
|
direction?: string | null | undefined;
|
|
1662
1674
|
}) | ({
|
|
1663
|
-
type: "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl"
|
|
1675
|
+
type: "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl";
|
|
1664
1676
|
content: {
|
|
1665
1677
|
text: string;
|
|
1666
1678
|
} & {
|
|
@@ -1719,14 +1731,19 @@ export declare const NestableLegacy: (ctx: LegacyContentCtx) => {
|
|
|
1719
1731
|
} & {
|
|
1720
1732
|
label?: string;
|
|
1721
1733
|
direction?: string;
|
|
1722
|
-
})
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1734
|
+
}))[];
|
|
1735
|
+
}> | import("fp-ts/lib/Either").Right<{
|
|
1736
|
+
__TYPE__: "SeparatorContent";
|
|
1737
|
+
}> | import("fp-ts/lib/Either").Right<{
|
|
1738
|
+
__TYPE__: "TableContent";
|
|
1739
|
+
content: {
|
|
1740
|
+
type: "tableRow";
|
|
1741
|
+
content: ({
|
|
1742
|
+
type: "tableHeader";
|
|
1743
|
+
content: {
|
|
1744
|
+
__TYPE__: "StructuredTextContent";
|
|
1745
|
+
value: ({
|
|
1746
|
+
type: "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl";
|
|
1730
1747
|
content: {
|
|
1731
1748
|
text: string;
|
|
1732
1749
|
} & {
|
|
@@ -1786,10 +1803,13 @@ export declare const NestableLegacy: (ctx: LegacyContentCtx) => {
|
|
|
1786
1803
|
label?: string;
|
|
1787
1804
|
direction?: string;
|
|
1788
1805
|
})[];
|
|
1789
|
-
}
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1806
|
+
};
|
|
1807
|
+
} | {
|
|
1808
|
+
type: "tableCell";
|
|
1809
|
+
content: {
|
|
1810
|
+
__TYPE__: "StructuredTextContent";
|
|
1811
|
+
value: ({
|
|
1812
|
+
type: "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl";
|
|
1793
1813
|
content: {
|
|
1794
1814
|
text: string;
|
|
1795
1815
|
} & {
|
|
@@ -1849,11 +1869,9 @@ export declare const NestableLegacy: (ctx: LegacyContentCtx) => {
|
|
|
1849
1869
|
label?: string;
|
|
1850
1870
|
direction?: string;
|
|
1851
1871
|
})[];
|
|
1852
|
-
}
|
|
1853
|
-
}[];
|
|
1854
|
-
}
|
|
1855
|
-
}> | import("fp-ts/lib/Either").Right<{
|
|
1856
|
-
__TYPE__: "SeparatorContent";
|
|
1872
|
+
};
|
|
1873
|
+
})[];
|
|
1874
|
+
}[];
|
|
1857
1875
|
}> | undefined;
|
|
1858
1876
|
encode(value: NestableContent): import("../../LegacyContentCtx").WithTypes<unknown> | undefined;
|
|
1859
1877
|
};
|
|
@@ -16,6 +16,7 @@ const LinkContent_1 = require("./LinkContent");
|
|
|
16
16
|
const RepeatableContent_1 = require("./RepeatableContent");
|
|
17
17
|
const RichTextContent_1 = require("./RichTextContent");
|
|
18
18
|
const SeparatorContent_1 = require("./SeparatorContent");
|
|
19
|
+
const TableContent_1 = require("./TableContent");
|
|
19
20
|
exports.NestableContent = t.union([
|
|
20
21
|
EmptyContent_1.EmptyContent,
|
|
21
22
|
BooleanContent_1.BooleanContent,
|
|
@@ -33,6 +34,7 @@ exports.NestableContent = t.union([
|
|
|
33
34
|
LinkContent_1.LinkContent,
|
|
34
35
|
RichTextContent_1.RichTextContent,
|
|
35
36
|
SeparatorContent_1.SeparatorContent,
|
|
37
|
+
TableContent_1.TableContent,
|
|
36
38
|
RepeatableContent_1.RepeatableContent,
|
|
37
39
|
]);
|
|
38
40
|
const NestableContentDefaultValue = (widgetDef) => {
|
|
@@ -61,6 +63,7 @@ const isNestableContent = (u) => (0, FieldContent_1.isTextContent)(u) ||
|
|
|
61
63
|
(0, IntegrationFieldContent_1.isIntegrationFieldContent)(u) ||
|
|
62
64
|
(0, LinkContent_1.isLinkContent)(u) ||
|
|
63
65
|
(0, SeparatorContent_1.isSeparatorContent)(u) ||
|
|
66
|
+
(0, TableContent_1.isTableContent)(u) ||
|
|
64
67
|
(0, EmptyContent_1.isEmptyContent)(u) ||
|
|
65
68
|
(0, RepeatableContent_1.isRepeatableContent)(u);
|
|
66
69
|
exports.isNestableContent = isNestableContent;
|
|
@@ -104,6 +107,8 @@ const NestableLegacy = (ctx) => {
|
|
|
104
107
|
return (0, LinkContent_1.LinkContentLegacy)(ctx);
|
|
105
108
|
case "Separator":
|
|
106
109
|
return (0, SeparatorContent_1.SeparatorLegacy)(ctx);
|
|
110
|
+
case "Table":
|
|
111
|
+
return (0, TableContent_1.TableLegacy)(ctx);
|
|
107
112
|
case "Repeatable.Link":
|
|
108
113
|
return (0, RepeatableContent_1.RepeatableLegacy)(ctx, "Link");
|
|
109
114
|
default:
|
|
@@ -149,6 +154,8 @@ const NestableLegacy = (ctx) => {
|
|
|
149
154
|
return (0, LinkContent_1.LinkContentLegacy)(ctx).encode(value);
|
|
150
155
|
case SeparatorContent_1.SeparatorContentType:
|
|
151
156
|
return (0, SeparatorContent_1.SeparatorLegacy)(ctx).encode(value);
|
|
157
|
+
case TableContent_1.TableContentType:
|
|
158
|
+
return (0, TableContent_1.TableLegacy)(ctx).encode(value);
|
|
152
159
|
case "RepeatableContent":
|
|
153
160
|
return (0, RepeatableContent_1.RepeatableLegacy)(ctx, value.type).encode(value);
|
|
154
161
|
default:
|
|
@@ -85,7 +85,7 @@ export declare const RepeatableContent: t.ExactC<t.TypeC<{
|
|
|
85
85
|
}>>]>>;
|
|
86
86
|
}>>;
|
|
87
87
|
export declare type RepeatableContent = t.TypeOf<typeof RepeatableContent>;
|
|
88
|
-
export declare const isRepeatableContent:
|
|
88
|
+
export declare const isRepeatableContent: (u: unknown) => u is {
|
|
89
89
|
__TYPE__: "RepeatableContent";
|
|
90
90
|
type: "Link";
|
|
91
91
|
value: ({
|
|
@@ -164,7 +164,7 @@ export declare const isRepeatableContent: t.Is<{
|
|
|
164
164
|
variant?: string;
|
|
165
165
|
});
|
|
166
166
|
})[];
|
|
167
|
-
}
|
|
167
|
+
};
|
|
168
168
|
export declare const RepeatableLegacy: (ctx: LegacyContentCtx, fieldType: "Link") => t.Type<RepeatableContent, WithTypes<Array<unknown>>, unknown>;
|
|
169
169
|
export declare type RepeatableCustomType = Link;
|
|
170
170
|
export declare function traverseRepeatableContent({ path, key, apiId, model, content, }: {
|
|
@@ -6,13 +6,16 @@ const fp_ts_1 = require("fp-ts");
|
|
|
6
6
|
const Either_1 = require("fp-ts/lib/Either");
|
|
7
7
|
const function_1 = require("fp-ts/lib/function");
|
|
8
8
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
9
10
|
const LinkContent_1 = require("./LinkContent");
|
|
11
|
+
const RepeatableContentType = "RepeatableContent";
|
|
10
12
|
exports.RepeatableContent = t.strict({
|
|
11
|
-
__TYPE__: t.literal(
|
|
13
|
+
__TYPE__: t.literal(RepeatableContentType),
|
|
12
14
|
type: t.literal("Link"),
|
|
13
15
|
value: t.array(LinkContent_1.LinkContent),
|
|
14
16
|
});
|
|
15
|
-
|
|
17
|
+
const isRepeatableContent = (u) => (0, utils_1.hasContentType)(u) && u.__TYPE__ === RepeatableContentType;
|
|
18
|
+
exports.isRepeatableContent = isRepeatableContent;
|
|
16
19
|
const RepeatableLegacy = (ctx, fieldType) => {
|
|
17
20
|
return new t.Type("RepeatableLegacy", exports.isRepeatableContent, (items) => {
|
|
18
21
|
const parsed = (0, function_1.pipe)(t.array(t.unknown).decode(items), fp_ts_1.either.map((items) => {
|
|
@@ -608,6 +608,118 @@ export declare const TextBlock: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
608
608
|
direction: t.StringC;
|
|
609
609
|
}>]>>;
|
|
610
610
|
export declare type TextBlock = t.TypeOf<typeof TextBlock>;
|
|
611
|
+
export declare const TextBlockLegacy: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
612
|
+
type: t.Type<"image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl", "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl", unknown>;
|
|
613
|
+
content: t.IntersectionC<[t.TypeC<{
|
|
614
|
+
text: t.StringC;
|
|
615
|
+
}>, t.PartialC<{
|
|
616
|
+
spans: t.Type<({
|
|
617
|
+
data: ({
|
|
618
|
+
__TYPE__: "ImageLink";
|
|
619
|
+
} & {
|
|
620
|
+
kind: "image";
|
|
621
|
+
id: string;
|
|
622
|
+
url: string;
|
|
623
|
+
height: string;
|
|
624
|
+
width: string;
|
|
625
|
+
size: string;
|
|
626
|
+
name: string;
|
|
627
|
+
} & {
|
|
628
|
+
date?: string | null | undefined;
|
|
629
|
+
}) | ({
|
|
630
|
+
__TYPE__: "FileLink";
|
|
631
|
+
} & {
|
|
632
|
+
kind: "file";
|
|
633
|
+
id: string;
|
|
634
|
+
url: string;
|
|
635
|
+
name: string;
|
|
636
|
+
size: string;
|
|
637
|
+
} & {
|
|
638
|
+
date?: string | null | undefined;
|
|
639
|
+
}) | ({
|
|
640
|
+
__TYPE__: "DocumentLink";
|
|
641
|
+
} & {
|
|
642
|
+
id: string;
|
|
643
|
+
}) | ({
|
|
644
|
+
__TYPE__: "ExternalLink";
|
|
645
|
+
} & {
|
|
646
|
+
url: string;
|
|
647
|
+
} & {
|
|
648
|
+
kind?: "web";
|
|
649
|
+
target?: string | null | undefined;
|
|
650
|
+
preview?: {
|
|
651
|
+
title?: string;
|
|
652
|
+
} | null | undefined;
|
|
653
|
+
});
|
|
654
|
+
start: number;
|
|
655
|
+
end: number;
|
|
656
|
+
type: "hyperlink";
|
|
657
|
+
} | {
|
|
658
|
+
data: string;
|
|
659
|
+
start: number;
|
|
660
|
+
end: number;
|
|
661
|
+
type: "label";
|
|
662
|
+
} | {
|
|
663
|
+
start: number;
|
|
664
|
+
end: number;
|
|
665
|
+
type: "strong" | "em" | "list-item";
|
|
666
|
+
})[], ({
|
|
667
|
+
data: ({
|
|
668
|
+
__TYPE__: "ImageLink";
|
|
669
|
+
} & {
|
|
670
|
+
kind: "image";
|
|
671
|
+
id: string;
|
|
672
|
+
url: string;
|
|
673
|
+
height: string;
|
|
674
|
+
width: string;
|
|
675
|
+
size: string;
|
|
676
|
+
name: string;
|
|
677
|
+
} & {
|
|
678
|
+
date?: string | null | undefined;
|
|
679
|
+
}) | ({
|
|
680
|
+
__TYPE__: "FileLink";
|
|
681
|
+
} & {
|
|
682
|
+
kind: "file";
|
|
683
|
+
id: string;
|
|
684
|
+
url: string;
|
|
685
|
+
name: string;
|
|
686
|
+
size: string;
|
|
687
|
+
} & {
|
|
688
|
+
date?: string | null | undefined;
|
|
689
|
+
}) | ({
|
|
690
|
+
__TYPE__: "DocumentLink";
|
|
691
|
+
} & {
|
|
692
|
+
id: string;
|
|
693
|
+
}) | ({
|
|
694
|
+
__TYPE__: "ExternalLink";
|
|
695
|
+
} & {
|
|
696
|
+
url: string;
|
|
697
|
+
} & {
|
|
698
|
+
kind?: "web";
|
|
699
|
+
target?: string | null | undefined;
|
|
700
|
+
preview?: {
|
|
701
|
+
title?: string;
|
|
702
|
+
} | null | undefined;
|
|
703
|
+
});
|
|
704
|
+
start: number;
|
|
705
|
+
end: number;
|
|
706
|
+
type: "hyperlink";
|
|
707
|
+
} | {
|
|
708
|
+
data: string;
|
|
709
|
+
start: number;
|
|
710
|
+
end: number;
|
|
711
|
+
type: "label";
|
|
712
|
+
} | {
|
|
713
|
+
start: number;
|
|
714
|
+
end: number;
|
|
715
|
+
type: "strong" | "em" | "list-item";
|
|
716
|
+
})[], unknown>;
|
|
717
|
+
}>]>;
|
|
718
|
+
}>, t.PartialC<{
|
|
719
|
+
label: t.StringC;
|
|
720
|
+
direction: t.StringC;
|
|
721
|
+
}>]>>;
|
|
722
|
+
export declare type TextBlockLegacy = t.TypeOf<typeof TextBlockLegacy>;
|
|
611
723
|
export declare const BlockLegacy: t.Type<({
|
|
612
724
|
type: "image";
|
|
613
725
|
data: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Block = exports.BlockLegacy = exports.TextBlock = exports.checkEmbedBlock = exports.EmbedBlock = exports.checkImageBlock = exports.ImageBlock = exports.ValidatedSpans = exports.SpanLegacy = exports.Span = void 0;
|
|
3
|
+
exports.Block = exports.BlockLegacy = exports.TextBlockLegacy = exports.TextBlock = exports.checkEmbedBlock = exports.EmbedBlock = exports.checkImageBlock = exports.ImageBlock = exports.ValidatedSpans = exports.SpanLegacy = exports.Span = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fp_ts_1 = require("fp-ts");
|
|
6
6
|
const Either_1 = require("fp-ts/lib/Either");
|
|
@@ -151,20 +151,20 @@ const TextBlockCodec = (spanCodec) => t.exact(t.intersection([
|
|
|
151
151
|
]));
|
|
152
152
|
/* These Text block will decode codec A and encode from codec B to A */
|
|
153
153
|
exports.TextBlock = TextBlockCodec(exports.Span);
|
|
154
|
-
|
|
154
|
+
exports.TextBlockLegacy = TextBlockCodec(exports.SpanLegacy);
|
|
155
155
|
const legacyBlockCodec = t.union([
|
|
156
156
|
EmbedBlockLegacy,
|
|
157
157
|
ImageBlockLegacy,
|
|
158
|
-
TextBlockLegacy,
|
|
158
|
+
exports.TextBlockLegacy,
|
|
159
159
|
]);
|
|
160
|
-
exports.BlockLegacy = new t.Type("BlockLegacy", (u) => EmbedBlockLegacy.is(u) || ImageBlockLegacy.is(u) || TextBlockLegacy.is(u), (legacyBlock) => legacyBlockCodec.decode(legacyBlock), (block) => {
|
|
160
|
+
exports.BlockLegacy = new t.Type("BlockLegacy", (u) => EmbedBlockLegacy.is(u) || ImageBlockLegacy.is(u) || exports.TextBlockLegacy.is(u), (legacyBlock) => legacyBlockCodec.decode(legacyBlock), (block) => {
|
|
161
161
|
return (() => {
|
|
162
162
|
if (exports.ImageBlock.is(block))
|
|
163
163
|
return ImageBlockLegacy.encode(block);
|
|
164
164
|
else if (exports.EmbedBlock.is(block))
|
|
165
165
|
return EmbedBlockLegacy.encode(block);
|
|
166
166
|
else
|
|
167
|
-
return TextBlockLegacy.encode(block);
|
|
167
|
+
return exports.TextBlockLegacy.encode(block);
|
|
168
168
|
})();
|
|
169
169
|
});
|
|
170
170
|
exports.Block = t.union([exports.ImageBlock, exports.EmbedBlock, exports.TextBlock]);
|