@prismicio/types-internal 3.7.0 → 3.8.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.
Files changed (33) hide show
  1. package/lib/content/Document.d.ts +114 -42
  2. package/lib/content/fields/RepeatableContent.d.ts +45 -47
  3. package/lib/content/fields/WidgetContent.d.ts +114 -42
  4. package/lib/content/fields/nestable/LinkContent.js +4 -16
  5. package/lib/content/fields/nestable/NestableContent.d.ts +19 -7
  6. package/lib/content/fields/nestable/RichTextContent/TextBlock.d.ts +192 -55
  7. package/lib/content/fields/nestable/RichTextContent/TextBlock.js +10 -10
  8. package/lib/content/fields/nestable/TableContent.d.ts +25 -9
  9. package/lib/content/fields/nestable/TableContent.js +8 -8
  10. package/lib/content/fields/slices/Slice/CompositeSliceContent.d.ts +38 -14
  11. package/lib/content/fields/slices/Slice/RepeatableContent.d.ts +7 -3
  12. package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +38 -14
  13. package/lib/content/fields/slices/Slice/SimpleSliceContent.d.ts +19 -7
  14. package/lib/content/fields/slices/Slice/SlicePrimaryContent.d.ts +19 -7
  15. package/lib/content/fields/slices/Slice/index.d.ts +65 -25
  16. package/lib/content/fields/slices/SliceItem.d.ts +65 -25
  17. package/lib/content/fields/slices/SlicesContent.d.ts +95 -35
  18. package/lib/content/utils.d.ts +4 -0
  19. package/lib/content/utils.js +16 -1
  20. package/lib/customtypes/widgets/slices/SliceWidget.d.ts +327 -0
  21. package/lib/customtypes/widgets/slices/SliceWidget.js +8 -0
  22. package/package.json +1 -1
  23. package/src/content/fields/nestable/LinkContent.ts +1 -20
  24. package/src/content/fields/nestable/TableContent.ts +37 -29
  25. package/src/content/utils.ts +20 -0
  26. package/lib/content/fields/nestable/RichTextContent/Block.d.ts +0 -1036
  27. package/lib/content/fields/nestable/RichTextContent/Block.js +0 -31
  28. package/lib/content/fields/nestable/RichTextContent/EmbedBlock.d.ts +0 -60
  29. package/lib/content/fields/nestable/RichTextContent/EmbedBlock.js +0 -53
  30. package/lib/content/fields/nestable/RichTextContent/ImageBlock.d.ts +0 -203
  31. package/lib/content/fields/nestable/RichTextContent/ImageBlock.js +0 -36
  32. package/lib/content/fields/nestable/RichTextContent/TableBlock.d.ts +0 -500
  33. package/lib/content/fields/nestable/RichTextContent/TableBlock.js +0 -21
@@ -2,26 +2,28 @@ import * as t from "io-ts";
2
2
  export declare const Span: t.UnionC<[t.ExactC<t.TypeC<{
3
3
  data: t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
4
4
  __TYPE__: t.LiteralC<"ImageLink">;
5
- }>>, t.IntersectionC<[t.ExactC<t.TypeC<{
6
- kind: t.Type<"image", "image", unknown>;
5
+ }>>, t.ExactC<t.IntersectionC<[t.TypeC<{
7
6
  id: t.StringC;
8
7
  url: t.StringC;
9
8
  height: t.StringC;
10
9
  width: t.StringC;
11
10
  size: t.StringC;
12
11
  name: t.StringC;
13
- }>>, t.ExactC<t.PartialC<{
12
+ kind: t.StringC;
13
+ }>, t.PartialC<{
14
14
  date: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
15
- }>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
16
- __TYPE__: t.LiteralC<"FileLink">;
17
- }>>, t.ExactC<t.IntersectionC<[t.TypeC<{
18
- kind: t.Type<"file", "file", unknown>;
15
+ }>]>>]>, t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
19
16
  id: t.StringC;
20
17
  url: t.StringC;
21
18
  name: t.StringC;
19
+ kind: t.StringC;
22
20
  size: t.StringC;
23
21
  }>, t.PartialC<{
24
22
  date: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
23
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
24
+ __TYPE__: t.LiteralC<"FileLink">;
25
+ }>, t.PartialC<{
26
+ size: t.StringC;
25
27
  }>]>>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
26
28
  __TYPE__: t.LiteralC<"DocumentLink">;
27
29
  }>>, t.ExactC<t.TypeC<{
@@ -41,40 +43,42 @@ export declare const Span: t.UnionC<[t.ExactC<t.TypeC<{
41
43
  }>]>>]>]> | t.UnionC<[t.Type<{
42
44
  __TYPE__: "ImageLink";
43
45
  } & {
44
- kind: "image";
45
46
  id: string;
46
47
  url: string;
47
48
  height: string;
48
49
  width: string;
49
50
  size: string;
50
51
  name: string;
52
+ kind: string;
51
53
  } & {
52
54
  date?: string | null | undefined;
53
55
  }, {
54
- kind: "image";
55
56
  id: string;
56
57
  url: string;
57
58
  height: string;
58
59
  width: string;
59
60
  size: string;
60
61
  name: string;
62
+ kind: string;
61
63
  } & {
62
64
  date?: string | null | undefined;
63
65
  }, unknown>, t.Type<{
64
- __TYPE__: "FileLink";
65
- } & {
66
- kind: "file";
67
66
  id: string;
68
67
  url: string;
69
68
  name: string;
69
+ kind: string;
70
70
  size: string;
71
71
  } & {
72
72
  date?: string | null | undefined;
73
+ } & {
74
+ __TYPE__: "FileLink";
75
+ } & {
76
+ size?: string;
73
77
  }, {
74
- kind: "file";
75
78
  id: string;
76
79
  url: string;
77
80
  name: string;
81
+ kind: string;
78
82
  size: string;
79
83
  } & {
80
84
  date?: string | null | undefined;
@@ -124,26 +128,28 @@ export declare type Span = t.TypeOf<typeof Span>;
124
128
  export declare const SpanLegacy: t.UnionC<[t.ExactC<t.TypeC<{
125
129
  data: t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
126
130
  __TYPE__: t.LiteralC<"ImageLink">;
127
- }>>, t.IntersectionC<[t.ExactC<t.TypeC<{
128
- kind: t.Type<"image", "image", unknown>;
131
+ }>>, t.ExactC<t.IntersectionC<[t.TypeC<{
129
132
  id: t.StringC;
130
133
  url: t.StringC;
131
134
  height: t.StringC;
132
135
  width: t.StringC;
133
136
  size: t.StringC;
134
137
  name: t.StringC;
135
- }>>, t.ExactC<t.PartialC<{
138
+ kind: t.StringC;
139
+ }>, t.PartialC<{
136
140
  date: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
137
- }>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
138
- __TYPE__: t.LiteralC<"FileLink">;
139
- }>>, t.ExactC<t.IntersectionC<[t.TypeC<{
140
- kind: t.Type<"file", "file", unknown>;
141
+ }>]>>]>, t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
141
142
  id: t.StringC;
142
143
  url: t.StringC;
143
144
  name: t.StringC;
145
+ kind: t.StringC;
144
146
  size: t.StringC;
145
147
  }>, t.PartialC<{
146
148
  date: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
149
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
150
+ __TYPE__: t.LiteralC<"FileLink">;
151
+ }>, t.PartialC<{
152
+ size: t.StringC;
147
153
  }>]>>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
148
154
  __TYPE__: t.LiteralC<"DocumentLink">;
149
155
  }>>, t.ExactC<t.TypeC<{
@@ -163,40 +169,42 @@ export declare const SpanLegacy: t.UnionC<[t.ExactC<t.TypeC<{
163
169
  }>]>>]>]> | t.UnionC<[t.Type<{
164
170
  __TYPE__: "ImageLink";
165
171
  } & {
166
- kind: "image";
167
172
  id: string;
168
173
  url: string;
169
174
  height: string;
170
175
  width: string;
171
176
  size: string;
172
177
  name: string;
178
+ kind: string;
173
179
  } & {
174
180
  date?: string | null | undefined;
175
181
  }, {
176
- kind: "image";
177
182
  id: string;
178
183
  url: string;
179
184
  height: string;
180
185
  width: string;
181
186
  size: string;
182
187
  name: string;
188
+ kind: string;
183
189
  } & {
184
190
  date?: string | null | undefined;
185
191
  }, unknown>, t.Type<{
186
- __TYPE__: "FileLink";
187
- } & {
188
- kind: "file";
189
192
  id: string;
190
193
  url: string;
191
194
  name: string;
195
+ kind: string;
192
196
  size: string;
193
197
  } & {
194
198
  date?: string | null | undefined;
199
+ } & {
200
+ __TYPE__: "FileLink";
201
+ } & {
202
+ size?: string;
195
203
  }, {
196
- kind: "file";
197
204
  id: string;
198
205
  url: string;
199
206
  name: string;
207
+ kind: string;
200
208
  size: string;
201
209
  } & {
202
210
  date?: string | null | undefined;
@@ -246,26 +254,28 @@ export declare type SpanLegacy = t.TypeOf<typeof SpanLegacy>;
246
254
  export declare const ValidatedSpans: <C extends t.UnionC<[t.ExactC<t.TypeC<{
247
255
  data: t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
248
256
  __TYPE__: t.LiteralC<"ImageLink">;
249
- }>>, t.IntersectionC<[t.ExactC<t.TypeC<{
250
- kind: t.Type<"image", "image", unknown>;
257
+ }>>, t.ExactC<t.IntersectionC<[t.TypeC<{
251
258
  id: t.StringC;
252
259
  url: t.StringC;
253
260
  height: t.StringC;
254
261
  width: t.StringC;
255
262
  size: t.StringC;
256
263
  name: t.StringC;
257
- }>>, t.ExactC<t.PartialC<{
264
+ kind: t.StringC;
265
+ }>, t.PartialC<{
258
266
  date: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
259
- }>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
260
- __TYPE__: t.LiteralC<"FileLink">;
261
- }>>, t.ExactC<t.IntersectionC<[t.TypeC<{
262
- kind: t.Type<"file", "file", unknown>;
267
+ }>]>>]>, t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
263
268
  id: t.StringC;
264
269
  url: t.StringC;
265
270
  name: t.StringC;
271
+ kind: t.StringC;
266
272
  size: t.StringC;
267
273
  }>, t.PartialC<{
268
274
  date: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
275
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
276
+ __TYPE__: t.LiteralC<"FileLink">;
277
+ }>, t.PartialC<{
278
+ size: t.StringC;
269
279
  }>]>>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
270
280
  __TYPE__: t.LiteralC<"DocumentLink">;
271
281
  }>>, t.ExactC<t.TypeC<{
@@ -285,40 +295,42 @@ export declare const ValidatedSpans: <C extends t.UnionC<[t.ExactC<t.TypeC<{
285
295
  }>]>>]>]> | t.UnionC<[t.Type<{
286
296
  __TYPE__: "ImageLink";
287
297
  } & {
288
- kind: "image";
289
298
  id: string;
290
299
  url: string;
291
300
  height: string;
292
301
  width: string;
293
302
  size: string;
294
303
  name: string;
304
+ kind: string;
295
305
  } & {
296
306
  date?: string | null | undefined;
297
307
  }, {
298
- kind: "image";
299
308
  id: string;
300
309
  url: string;
301
310
  height: string;
302
311
  width: string;
303
312
  size: string;
304
313
  name: string;
314
+ kind: string;
305
315
  } & {
306
316
  date?: string | null | undefined;
307
317
  }, unknown>, t.Type<{
308
- __TYPE__: "FileLink";
309
- } & {
310
- kind: "file";
311
318
  id: string;
312
319
  url: string;
313
320
  name: string;
321
+ kind: string;
314
322
  size: string;
315
323
  } & {
316
324
  date?: string | null | undefined;
325
+ } & {
326
+ __TYPE__: "FileLink";
327
+ } & {
328
+ size?: string;
317
329
  }, {
318
- kind: "file";
319
330
  id: string;
320
331
  url: string;
321
332
  name: string;
333
+ kind: string;
322
334
  size: string;
323
335
  } & {
324
336
  date?: string | null | undefined;
@@ -365,7 +377,7 @@ export declare const ValidatedSpans: <C extends t.UnionC<[t.ExactC<t.TypeC<{
365
377
  }>;
366
378
  }>>]>>(spanCodec: C) => t.Type<t.TypeOf<C>[], t.TypeOf<C>[], unknown>;
367
379
  export declare const TextBlock: t.ExactC<t.IntersectionC<[t.TypeC<{
368
- type: t.Type<"image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl" | "table", "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl" | "table", unknown>;
380
+ 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>;
369
381
  content: t.IntersectionC<[t.TypeC<{
370
382
  text: t.StringC;
371
383
  }>, t.PartialC<{
@@ -373,25 +385,27 @@ export declare const TextBlock: t.ExactC<t.IntersectionC<[t.TypeC<{
373
385
  data: ({
374
386
  __TYPE__: "ImageLink";
375
387
  } & {
376
- kind: "image";
377
388
  id: string;
378
389
  url: string;
379
390
  height: string;
380
391
  width: string;
381
392
  size: string;
382
393
  name: string;
394
+ kind: string;
383
395
  } & {
384
396
  date?: string | null | undefined;
385
397
  }) | ({
386
- __TYPE__: "FileLink";
387
- } & {
388
- kind: "file";
389
398
  id: string;
390
399
  url: string;
391
400
  name: string;
401
+ kind: string;
392
402
  size: string;
393
403
  } & {
394
404
  date?: string | null | undefined;
405
+ } & {
406
+ __TYPE__: "FileLink";
407
+ } & {
408
+ size?: string;
395
409
  }) | ({
396
410
  __TYPE__: "DocumentLink";
397
411
  } & {
@@ -423,25 +437,27 @@ export declare const TextBlock: t.ExactC<t.IntersectionC<[t.TypeC<{
423
437
  data: ({
424
438
  __TYPE__: "ImageLink";
425
439
  } & {
426
- kind: "image";
427
440
  id: string;
428
441
  url: string;
429
442
  height: string;
430
443
  width: string;
431
444
  size: string;
432
445
  name: string;
446
+ kind: string;
433
447
  } & {
434
448
  date?: string | null | undefined;
435
449
  }) | ({
436
- __TYPE__: "FileLink";
437
- } & {
438
- kind: "file";
439
450
  id: string;
440
451
  url: string;
441
452
  name: string;
453
+ kind: string;
442
454
  size: string;
443
455
  } & {
444
456
  date?: string | null | undefined;
457
+ } & {
458
+ __TYPE__: "FileLink";
459
+ } & {
460
+ size?: string;
445
461
  }) | ({
446
462
  __TYPE__: "DocumentLink";
447
463
  } & {
@@ -476,8 +492,9 @@ export declare const TextBlock: t.ExactC<t.IntersectionC<[t.TypeC<{
476
492
  direction: t.StringC;
477
493
  }>]>>;
478
494
  export declare type TextBlock = t.TypeOf<typeof TextBlock>;
479
- export declare const TextBlockLegacy: t.ExactC<t.IntersectionC<[t.TypeC<{
480
- type: t.Type<"image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl" | "table", "image" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "embed" | "list-item" | "o-list-item" | "rtl" | "table", unknown>;
495
+ /** A paragraph Text block. Paragraphs may contain spans. */
496
+ export declare const ParagraphBlock: t.ExactC<t.IntersectionC<[t.TypeC<{
497
+ 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>;
481
498
  content: t.IntersectionC<[t.TypeC<{
482
499
  text: t.StringC;
483
500
  }>, t.PartialC<{
@@ -485,25 +502,79 @@ export declare const TextBlockLegacy: t.ExactC<t.IntersectionC<[t.TypeC<{
485
502
  data: ({
486
503
  __TYPE__: "ImageLink";
487
504
  } & {
488
- kind: "image";
489
505
  id: string;
490
506
  url: string;
491
507
  height: string;
492
508
  width: string;
493
509
  size: string;
494
510
  name: string;
511
+ kind: string;
495
512
  } & {
496
513
  date?: string | null | undefined;
497
514
  }) | ({
515
+ id: string;
516
+ url: string;
517
+ name: string;
518
+ kind: string;
519
+ size: string;
520
+ } & {
521
+ date?: string | null | undefined;
522
+ } & {
498
523
  __TYPE__: "FileLink";
499
524
  } & {
500
- kind: "file";
525
+ size?: string;
526
+ }) | ({
527
+ __TYPE__: "DocumentLink";
528
+ } & {
529
+ id: string;
530
+ }) | ({
531
+ __TYPE__: "ExternalLink";
532
+ } & {
533
+ url: string;
534
+ } & {
535
+ kind?: "web";
536
+ target?: string | null | undefined;
537
+ preview?: {
538
+ title?: string;
539
+ } | null | undefined;
540
+ });
541
+ start: number;
542
+ end: number;
543
+ type: "hyperlink";
544
+ } | {
545
+ data: string;
546
+ start: number;
547
+ end: number;
548
+ type: "label";
549
+ } | {
550
+ start: number;
551
+ end: number;
552
+ type: "strong" | "em" | "list-item";
553
+ })[], ({
554
+ data: ({
555
+ __TYPE__: "ImageLink";
556
+ } & {
557
+ id: string;
558
+ url: string;
559
+ height: string;
560
+ width: string;
561
+ size: string;
562
+ name: string;
563
+ kind: string;
564
+ } & {
565
+ date?: string | null | undefined;
566
+ }) | ({
501
567
  id: string;
502
568
  url: string;
503
569
  name: string;
570
+ kind: string;
504
571
  size: string;
505
572
  } & {
506
573
  date?: string | null | undefined;
574
+ } & {
575
+ __TYPE__: "FileLink";
576
+ } & {
577
+ size?: string;
507
578
  }) | ({
508
579
  __TYPE__: "DocumentLink";
509
580
  } & {
@@ -531,29 +602,95 @@ export declare const TextBlockLegacy: t.ExactC<t.IntersectionC<[t.TypeC<{
531
602
  start: number;
532
603
  end: number;
533
604
  type: "strong" | "em" | "list-item";
534
- })[], ({
605
+ })[], unknown>;
606
+ }>]>;
607
+ }>, t.PartialC<{
608
+ label: t.StringC;
609
+ direction: t.StringC;
610
+ }>]>>;
611
+ export declare type ParagraphBlock = t.TypeOf<typeof ParagraphBlock>;
612
+ export declare const TextBlockLegacy: t.ExactC<t.IntersectionC<[t.TypeC<{
613
+ 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>;
614
+ content: t.IntersectionC<[t.TypeC<{
615
+ text: t.StringC;
616
+ }>, t.PartialC<{
617
+ spans: t.Type<({
535
618
  data: ({
536
619
  __TYPE__: "ImageLink";
537
620
  } & {
538
- kind: "image";
539
621
  id: string;
540
622
  url: string;
541
623
  height: string;
542
624
  width: string;
543
625
  size: string;
544
626
  name: string;
627
+ kind: string;
545
628
  } & {
546
629
  date?: string | null | undefined;
547
630
  }) | ({
631
+ id: string;
632
+ url: string;
633
+ name: string;
634
+ kind: string;
635
+ size: string;
636
+ } & {
637
+ date?: string | null | undefined;
638
+ } & {
548
639
  __TYPE__: "FileLink";
549
640
  } & {
550
- kind: "file";
641
+ size?: string;
642
+ }) | ({
643
+ __TYPE__: "DocumentLink";
644
+ } & {
551
645
  id: string;
646
+ }) | ({
647
+ __TYPE__: "ExternalLink";
648
+ } & {
552
649
  url: string;
650
+ } & {
651
+ kind?: "web";
652
+ target?: string | null | undefined;
653
+ preview?: {
654
+ title?: string;
655
+ } | null | undefined;
656
+ });
657
+ start: number;
658
+ end: number;
659
+ type: "hyperlink";
660
+ } | {
661
+ data: string;
662
+ start: number;
663
+ end: number;
664
+ type: "label";
665
+ } | {
666
+ start: number;
667
+ end: number;
668
+ type: "strong" | "em" | "list-item";
669
+ })[], ({
670
+ data: ({
671
+ __TYPE__: "ImageLink";
672
+ } & {
673
+ id: string;
674
+ url: string;
675
+ height: string;
676
+ width: string;
677
+ size: string;
553
678
  name: string;
679
+ kind: string;
680
+ } & {
681
+ date?: string | null | undefined;
682
+ }) | ({
683
+ id: string;
684
+ url: string;
685
+ name: string;
686
+ kind: string;
554
687
  size: string;
555
688
  } & {
556
689
  date?: string | null | undefined;
690
+ } & {
691
+ __TYPE__: "FileLink";
692
+ } & {
693
+ size?: string;
557
694
  }) | ({
558
695
  __TYPE__: "DocumentLink";
559
696
  } & {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TextBlockLegacy = exports.TextBlock = exports.ValidatedSpans = exports.SpanLegacy = exports.Span = void 0;
3
+ exports.TextBlockLegacy = exports.ParagraphBlock = exports.TextBlock = exports.ValidatedSpans = exports.SpanLegacy = exports.Span = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const Either_1 = require("fp-ts/lib/Either");
6
6
  const t = (0, tslib_1.__importStar)(require("io-ts"));
@@ -29,12 +29,8 @@ const basicSpan = t.strict({
29
29
  "list-item": null, // legacy case that should not happen, we shouldn't support this in new page builder or migration API
30
30
  }),
31
31
  });
32
- exports.Span = t.union([linkSpan(LinkContent_1.FilledLink), labelSpan, basicSpan]);
33
- exports.SpanLegacy = t.union([
34
- linkSpan(LinkContent_1.FilledLinkLegacy),
35
- labelSpan,
36
- basicSpan,
37
- ]);
32
+ exports.Span = t.union([linkSpan(LinkContent_1.Link), labelSpan, basicSpan]);
33
+ exports.SpanLegacy = t.union([linkSpan(LinkContent_1.LinkLegacy), labelSpan, basicSpan]);
38
34
  const ValidatedSpans = (spanCodec) => {
39
35
  return new t.Type("ValidatedSpans", (spans) => Array.isArray(spans) && spans.every(spanCodec.is), (spans, c) => {
40
36
  if (Array.isArray(spans)) {
@@ -58,9 +54,11 @@ const ValidatedSpans = (spanCodec) => {
58
54
  });
59
55
  };
60
56
  exports.ValidatedSpans = ValidatedSpans;
61
- const TextBlockCodec = (spanCodec) => t.exact(t.intersection([
57
+ const TextBlockCodec = (spanCodec, nodeFilter) => t.exact(t.intersection([
62
58
  t.type({
63
- type: (0, function_1.refineType)(nestable_1.RichTextNodeTypeCodec, `string which isn't ${nestable_1.RichTextNodeType.image} ${nestable_1.RichTextNodeType.embed}`, (s) => s !== nestable_1.RichTextNodeType.image && s !== nestable_1.RichTextNodeType.embed),
59
+ type: nodeFilter
60
+ ? (0, function_1.refineType)(nestable_1.RichTextNodeTypeCodec, `string which isn't ${nestable_1.RichTextNodeType.image} ${nestable_1.RichTextNodeType.embed}`, nodeFilter)
61
+ : nestable_1.RichTextNodeTypeCodec,
64
62
  content: t.intersection([
65
63
  t.type({
66
64
  text: t.string,
@@ -76,5 +74,7 @@ const TextBlockCodec = (spanCodec) => t.exact(t.intersection([
76
74
  }),
77
75
  ]));
78
76
  /* These Text block will decode codec A and encode from codec B to A */
79
- exports.TextBlock = TextBlockCodec(exports.Span);
77
+ exports.TextBlock = TextBlockCodec(exports.Span, (nodeType) => nodeType !== nestable_1.RichTextNodeType.image && nodeType !== nestable_1.RichTextNodeType.embed);
78
+ /** A paragraph Text block. Paragraphs may contain spans. */
79
+ exports.ParagraphBlock = TextBlockCodec(exports.Span, (nodeType) => nodeType === nestable_1.RichTextNodeType.paragraph);
80
80
  exports.TextBlockLegacy = TextBlockCodec(exports.SpanLegacy);
@@ -5,9 +5,13 @@ import type { LegacyContentCtx, WithTypes } from "../../LegacyContentCtx";
5
5
  export declare const TableContentType = "TableContent";
6
6
  export declare const isTableContent: (u: unknown) => u is {
7
7
  __TYPE__: "TableContent";
8
- content: {
8
+ content: ({
9
+ key: string;
10
+ } & {
9
11
  type: "tableRow";
10
12
  content: ({
13
+ key: string;
14
+ } & {
11
15
  type: "tableHeader" | "tableCell";
12
16
  content: {
13
17
  __TYPE__: "StructuredTextContent";
@@ -166,13 +170,17 @@ export declare const isTableContent: (u: unknown) => u is {
166
170
  } & {
167
171
  columnWidth?: number;
168
172
  })[];
169
- }[];
173
+ })[];
170
174
  };
171
175
  export declare const TableContent: t.ExactC<t.TypeC<{
172
176
  __TYPE__: t.LiteralC<"TableContent">;
173
- content: t.ArrayC<t.ExactC<t.TypeC<{
177
+ content: t.ArrayC<t.IntersectionC<[t.ExactC<t.TypeC<{
178
+ key: t.Type<string, string, unknown>;
179
+ }>>, t.ExactC<t.TypeC<{
174
180
  type: t.LiteralC<"tableRow">;
175
181
  content: t.ArrayC<t.IntersectionC<[t.ExactC<t.TypeC<{
182
+ key: t.Type<string, string, unknown>;
183
+ }>>, t.IntersectionC<[t.ExactC<t.TypeC<{
176
184
  type: t.UnionC<[t.LiteralC<"tableHeader">, t.LiteralC<"tableCell">]>;
177
185
  content: t.ExactC<t.TypeC<{
178
186
  __TYPE__: t.LiteralC<"StructuredTextContent">;
@@ -416,15 +424,19 @@ export declare const TableContent: t.ExactC<t.TypeC<{
416
424
  }>>;
417
425
  }>>, t.ExactC<t.PartialC<{
418
426
  columnWidth: t.NumberC;
419
- }>>]>>;
420
- }>>>;
427
+ }>>]>]>>;
428
+ }>>]>>;
421
429
  }>>;
422
430
  export declare type TableContent = t.TypeOf<typeof TableContent>;
423
431
  export declare const TableLegacy: (ctx: LegacyContentCtx) => t.Type<{
424
432
  __TYPE__: "TableContent";
425
- content: {
433
+ content: ({
434
+ key: string;
435
+ } & {
426
436
  type: "tableRow";
427
437
  content: ({
438
+ key: string;
439
+ } & {
428
440
  type: "tableHeader" | "tableCell";
429
441
  content: {
430
442
  __TYPE__: "StructuredTextContent";
@@ -583,11 +595,15 @@ export declare const TableLegacy: (ctx: LegacyContentCtx) => t.Type<{
583
595
  } & {
584
596
  columnWidth?: number;
585
597
  })[];
586
- }[];
598
+ })[];
587
599
  }, WithTypes<{
588
- content: {
600
+ content: ({
601
+ key: string;
602
+ } & {
589
603
  type: "tableRow";
590
604
  content: ({
605
+ key: string;
606
+ } & {
591
607
  type: "tableHeader" | "tableCell";
592
608
  content: (({
593
609
  type: "image";
@@ -743,7 +759,7 @@ export declare const TableLegacy: (ctx: LegacyContentCtx) => t.Type<{
743
759
  } & {
744
760
  columnWidth?: number;
745
761
  })[];
746
- }[];
762
+ })[];
747
763
  }>, unknown>;
748
764
  export declare function traverseTableContent({ path, key, apiId, model, content, }: {
749
765
  path: ContentPath;