@prismicio/types-internal 3.3.0-alpha.0 → 3.3.0-alpha.2

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.
@@ -129,10 +129,7 @@ export declare const SlicePrimaryWidget: t.UnionC<[t.UnionC<[t.ExactC<t.Intersec
129
129
  allowTargetBlank: t.BooleanC;
130
130
  allowText: t.BooleanC;
131
131
  repeat: t.BooleanC;
132
- variant: t.ExactC<t.TypeC<{
133
- options: t.ArrayC<t.StringC>;
134
- default_value: t.StringC;
135
- }>>;
132
+ variants: t.ArrayC<t.StringC>;
136
133
  }>>;
137
134
  }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
138
135
  type: t.LiteralC<"Image">;
@@ -300,10 +297,7 @@ export declare const SlicePrimaryWidget: t.UnionC<[t.UnionC<[t.ExactC<t.Intersec
300
297
  allowTargetBlank: t.BooleanC;
301
298
  allowText: t.BooleanC;
302
299
  repeat: t.BooleanC;
303
- variant: t.ExactC<t.TypeC<{
304
- options: t.ArrayC<t.StringC>;
305
- default_value: t.StringC;
306
- }>>;
300
+ variants: t.ArrayC<t.StringC>;
307
301
  }>>;
308
302
  }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
309
303
  type: t.LiteralC<"Image">;
@@ -471,10 +465,7 @@ export declare const SlicePrimaryWidget: t.UnionC<[t.UnionC<[t.ExactC<t.Intersec
471
465
  allowTargetBlank: t.BooleanC;
472
466
  allowText: t.BooleanC;
473
467
  repeat: t.BooleanC;
474
- variant: t.ExactC<t.TypeC<{
475
- options: t.ArrayC<t.StringC>;
476
- default_value: t.StringC;
477
- }>>;
468
+ variants: t.ArrayC<t.StringC>;
478
469
  }>>;
479
470
  }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
480
471
  type: t.LiteralC<"Image">;
@@ -594,10 +585,7 @@ export declare const isSlicePrimaryWidget: (u: unknown) => u is ({
594
585
  allowTargetBlank?: boolean;
595
586
  allowText?: boolean;
596
587
  repeat?: boolean;
597
- variant?: {
598
- options: string[];
599
- default_value: string;
600
- };
588
+ variants?: string[];
601
589
  };
602
590
  }) | ({
603
591
  type: "Number";
@@ -766,10 +754,7 @@ export declare const isSlicePrimaryWidget: (u: unknown) => u is ({
766
754
  allowTargetBlank?: boolean;
767
755
  allowText?: boolean;
768
756
  repeat?: boolean;
769
- variant?: {
770
- options: string[];
771
- default_value: string;
772
- };
757
+ variants?: string[];
773
758
  };
774
759
  }) | ({
775
760
  type: "Number";
@@ -938,10 +923,7 @@ export declare const isSlicePrimaryWidget: (u: unknown) => u is ({
938
923
  allowTargetBlank?: boolean;
939
924
  allowText?: boolean;
940
925
  repeat?: boolean;
941
- variant?: {
942
- options: string[];
943
- default_value: string;
944
- };
926
+ variants?: string[];
945
927
  };
946
928
  }) | ({
947
929
  type: "Number";
@@ -146,10 +146,7 @@ export declare function slicesConfigReader<T extends SharedSlice | SharedSliceRe
146
146
  allowTargetBlank: t.BooleanC;
147
147
  allowText: t.BooleanC;
148
148
  repeat: t.BooleanC;
149
- variant: t.ExactC<t.TypeC<{
150
- options: t.ArrayC<t.StringC>;
151
- default_value: t.StringC;
152
- }>>;
149
+ variants: t.ArrayC<t.StringC>;
153
150
  }>>;
154
151
  }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
155
152
  type: t.LiteralC<"Image">;
@@ -317,10 +314,7 @@ export declare function slicesConfigReader<T extends SharedSlice | SharedSliceRe
317
314
  allowTargetBlank: t.BooleanC;
318
315
  allowText: t.BooleanC;
319
316
  repeat: t.BooleanC;
320
- variant: t.ExactC<t.TypeC<{
321
- options: t.ArrayC<t.StringC>;
322
- default_value: t.StringC;
323
- }>>;
317
+ variants: t.ArrayC<t.StringC>;
324
318
  }>>;
325
319
  }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
326
320
  type: t.LiteralC<"Image">;
@@ -488,10 +482,7 @@ export declare function slicesConfigReader<T extends SharedSlice | SharedSliceRe
488
482
  allowTargetBlank: t.BooleanC;
489
483
  allowText: t.BooleanC;
490
484
  repeat: t.BooleanC;
491
- variant: t.ExactC<t.TypeC<{
492
- options: t.ArrayC<t.StringC>;
493
- default_value: t.StringC;
494
- }>>;
485
+ variants: t.ArrayC<t.StringC>;
495
486
  }>>;
496
487
  }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
497
488
  type: t.LiteralC<"Image">;
@@ -651,10 +642,7 @@ export declare function slicesConfigReader<T extends SharedSlice | SharedSliceRe
651
642
  allowTargetBlank: t.BooleanC;
652
643
  allowText: t.BooleanC;
653
644
  repeat: t.BooleanC;
654
- variant: t.ExactC<t.TypeC<{
655
- options: t.ArrayC<t.StringC>;
656
- default_value: t.StringC;
657
- }>>;
645
+ variants: t.ArrayC<t.StringC>;
658
646
  }>>;
659
647
  }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
660
648
  type: t.LiteralC<"Image">;
@@ -826,10 +814,7 @@ export declare const StaticSlicesConfig: t.ExactC<t.PartialC<{
826
814
  allowTargetBlank: t.BooleanC;
827
815
  allowText: t.BooleanC;
828
816
  repeat: t.BooleanC;
829
- variant: t.ExactC<t.TypeC<{
830
- options: t.ArrayC<t.StringC>;
831
- default_value: t.StringC;
832
- }>>;
817
+ variants: t.ArrayC<t.StringC>;
833
818
  }>>;
834
819
  }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
835
820
  type: t.LiteralC<"Image">;
@@ -997,10 +982,7 @@ export declare const StaticSlicesConfig: t.ExactC<t.PartialC<{
997
982
  allowTargetBlank: t.BooleanC;
998
983
  allowText: t.BooleanC;
999
984
  repeat: t.BooleanC;
1000
- variant: t.ExactC<t.TypeC<{
1001
- options: t.ArrayC<t.StringC>;
1002
- default_value: t.StringC;
1003
- }>>;
985
+ variants: t.ArrayC<t.StringC>;
1004
986
  }>>;
1005
987
  }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
1006
988
  type: t.LiteralC<"Image">;
@@ -1168,10 +1150,7 @@ export declare const StaticSlicesConfig: t.ExactC<t.PartialC<{
1168
1150
  allowTargetBlank: t.BooleanC;
1169
1151
  allowText: t.BooleanC;
1170
1152
  repeat: t.BooleanC;
1171
- variant: t.ExactC<t.TypeC<{
1172
- options: t.ArrayC<t.StringC>;
1173
- default_value: t.StringC;
1174
- }>>;
1153
+ variants: t.ArrayC<t.StringC>;
1175
1154
  }>>;
1176
1155
  }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
1177
1156
  type: t.LiteralC<"Image">;
@@ -1331,10 +1310,7 @@ export declare const StaticSlicesConfig: t.ExactC<t.PartialC<{
1331
1310
  allowTargetBlank: t.BooleanC;
1332
1311
  allowText: t.BooleanC;
1333
1312
  repeat: t.BooleanC;
1334
- variant: t.ExactC<t.TypeC<{
1335
- options: t.ArrayC<t.StringC>;
1336
- default_value: t.StringC;
1337
- }>>;
1313
+ variants: t.ArrayC<t.StringC>;
1338
1314
  }>>;
1339
1315
  }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
1340
1316
  type: t.LiteralC<"Image">;
@@ -1465,10 +1441,7 @@ export declare const StaticSlicesConfig: t.ExactC<t.PartialC<{
1465
1441
  allowTargetBlank?: boolean;
1466
1442
  allowText?: boolean;
1467
1443
  repeat?: boolean;
1468
- variant?: {
1469
- options: string[];
1470
- default_value: string;
1471
- };
1444
+ variants?: string[];
1472
1445
  };
1473
1446
  }) | ({
1474
1447
  type: "Number";
@@ -1637,10 +1610,7 @@ export declare const StaticSlicesConfig: t.ExactC<t.PartialC<{
1637
1610
  allowTargetBlank?: boolean;
1638
1611
  allowText?: boolean;
1639
1612
  repeat?: boolean;
1640
- variant?: {
1641
- options: string[];
1642
- default_value: string;
1643
- };
1613
+ variants?: string[];
1644
1614
  };
1645
1615
  }) | ({
1646
1616
  type: "Number";
@@ -1809,10 +1779,7 @@ export declare const StaticSlicesConfig: t.ExactC<t.PartialC<{
1809
1779
  allowTargetBlank?: boolean;
1810
1780
  allowText?: boolean;
1811
1781
  repeat?: boolean;
1812
- variant?: {
1813
- options: string[];
1814
- default_value: string;
1815
- };
1782
+ variants?: string[];
1816
1783
  };
1817
1784
  }) | ({
1818
1785
  type: "Number";
@@ -1980,10 +1947,7 @@ export declare const StaticSlicesConfig: t.ExactC<t.PartialC<{
1980
1947
  allowTargetBlank?: boolean;
1981
1948
  allowText?: boolean;
1982
1949
  repeat?: boolean;
1983
- variant?: {
1984
- options: string[];
1985
- default_value: string;
1986
- };
1950
+ variants?: string[];
1987
1951
  };
1988
1952
  }) | ({
1989
1953
  type: "Number";
@@ -2206,10 +2170,7 @@ export declare const DynamicSlicesConfig: t.ExactC<t.PartialC<{
2206
2170
  allowTargetBlank: t.BooleanC;
2207
2171
  allowText: t.BooleanC;
2208
2172
  repeat: t.BooleanC;
2209
- variant: t.ExactC<t.TypeC<{
2210
- options: t.ArrayC<t.StringC>;
2211
- default_value: t.StringC;
2212
- }>>;
2173
+ variants: t.ArrayC<t.StringC>;
2213
2174
  }>>;
2214
2175
  }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
2215
2176
  type: t.LiteralC<"Image">;
@@ -2377,10 +2338,7 @@ export declare const DynamicSlicesConfig: t.ExactC<t.PartialC<{
2377
2338
  allowTargetBlank: t.BooleanC;
2378
2339
  allowText: t.BooleanC;
2379
2340
  repeat: t.BooleanC;
2380
- variant: t.ExactC<t.TypeC<{
2381
- options: t.ArrayC<t.StringC>;
2382
- default_value: t.StringC;
2383
- }>>;
2341
+ variants: t.ArrayC<t.StringC>;
2384
2342
  }>>;
2385
2343
  }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
2386
2344
  type: t.LiteralC<"Image">;
@@ -2548,10 +2506,7 @@ export declare const DynamicSlicesConfig: t.ExactC<t.PartialC<{
2548
2506
  allowTargetBlank: t.BooleanC;
2549
2507
  allowText: t.BooleanC;
2550
2508
  repeat: t.BooleanC;
2551
- variant: t.ExactC<t.TypeC<{
2552
- options: t.ArrayC<t.StringC>;
2553
- default_value: t.StringC;
2554
- }>>;
2509
+ variants: t.ArrayC<t.StringC>;
2555
2510
  }>>;
2556
2511
  }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
2557
2512
  type: t.LiteralC<"Image">;
@@ -2711,10 +2666,7 @@ export declare const DynamicSlicesConfig: t.ExactC<t.PartialC<{
2711
2666
  allowTargetBlank: t.BooleanC;
2712
2667
  allowText: t.BooleanC;
2713
2668
  repeat: t.BooleanC;
2714
- variant: t.ExactC<t.TypeC<{
2715
- options: t.ArrayC<t.StringC>;
2716
- default_value: t.StringC;
2717
- }>>;
2669
+ variants: t.ArrayC<t.StringC>;
2718
2670
  }>>;
2719
2671
  }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
2720
2672
  type: t.LiteralC<"Image">;
@@ -2862,10 +2814,7 @@ export declare const StaticSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
2862
2814
  allowTargetBlank?: boolean;
2863
2815
  allowText?: boolean;
2864
2816
  repeat?: boolean;
2865
- variant?: {
2866
- options: string[];
2867
- default_value: string;
2868
- };
2817
+ variants?: string[];
2869
2818
  };
2870
2819
  }) | ({
2871
2820
  type: "Number";
@@ -3034,10 +2983,7 @@ export declare const StaticSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
3034
2983
  allowTargetBlank?: boolean;
3035
2984
  allowText?: boolean;
3036
2985
  repeat?: boolean;
3037
- variant?: {
3038
- options: string[];
3039
- default_value: string;
3040
- };
2986
+ variants?: string[];
3041
2987
  };
3042
2988
  }) | ({
3043
2989
  type: "Number";
@@ -3207,10 +3153,7 @@ export declare const StaticSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
3207
3153
  allowTargetBlank?: boolean;
3208
3154
  allowText?: boolean;
3209
3155
  repeat?: boolean;
3210
- variant?: {
3211
- options: string[];
3212
- default_value: string;
3213
- };
3156
+ variants?: string[];
3214
3157
  };
3215
3158
  }) | ({
3216
3159
  type: "Number";
@@ -3372,10 +3315,7 @@ export declare const StaticSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
3372
3315
  allowTargetBlank?: boolean;
3373
3316
  allowText?: boolean;
3374
3317
  repeat?: boolean;
3375
- variant?: {
3376
- options: string[];
3377
- default_value: string;
3378
- };
3318
+ variants?: string[];
3379
3319
  };
3380
3320
  }) | ({
3381
3321
  type: "Number";
@@ -3553,10 +3493,7 @@ export declare const StaticSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
3553
3493
  allowTargetBlank?: boolean;
3554
3494
  allowText?: boolean;
3555
3495
  repeat?: boolean;
3556
- variant?: {
3557
- options: string[];
3558
- default_value: string;
3559
- };
3496
+ variants?: string[];
3560
3497
  };
3561
3498
  }) | ({
3562
3499
  type: "Number";
@@ -3725,10 +3662,7 @@ export declare const StaticSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
3725
3662
  allowTargetBlank?: boolean;
3726
3663
  allowText?: boolean;
3727
3664
  repeat?: boolean;
3728
- variant?: {
3729
- options: string[];
3730
- default_value: string;
3731
- };
3665
+ variants?: string[];
3732
3666
  };
3733
3667
  }) | ({
3734
3668
  type: "Number";
@@ -3897,10 +3831,7 @@ export declare const StaticSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
3897
3831
  allowTargetBlank?: boolean;
3898
3832
  allowText?: boolean;
3899
3833
  repeat?: boolean;
3900
- variant?: {
3901
- options: string[];
3902
- default_value: string;
3903
- };
3834
+ variants?: string[];
3904
3835
  };
3905
3836
  }) | ({
3906
3837
  type: "Number";
@@ -4068,10 +3999,7 @@ export declare const StaticSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
4068
3999
  allowTargetBlank?: boolean;
4069
4000
  allowText?: boolean;
4070
4001
  repeat?: boolean;
4071
- variant?: {
4072
- options: string[];
4073
- default_value: string;
4074
- };
4002
+ variants?: string[];
4075
4003
  };
4076
4004
  }) | ({
4077
4005
  type: "Number";
@@ -4260,10 +4188,7 @@ export declare const DynamicSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
4260
4188
  allowTargetBlank?: boolean;
4261
4189
  allowText?: boolean;
4262
4190
  repeat?: boolean;
4263
- variant?: {
4264
- options: string[];
4265
- default_value: string;
4266
- };
4191
+ variants?: string[];
4267
4192
  };
4268
4193
  }) | ({
4269
4194
  type: "Number";
@@ -4432,10 +4357,7 @@ export declare const DynamicSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
4432
4357
  allowTargetBlank?: boolean;
4433
4358
  allowText?: boolean;
4434
4359
  repeat?: boolean;
4435
- variant?: {
4436
- options: string[];
4437
- default_value: string;
4438
- };
4360
+ variants?: string[];
4439
4361
  };
4440
4362
  }) | ({
4441
4363
  type: "Number";
@@ -4605,10 +4527,7 @@ export declare const DynamicSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
4605
4527
  allowTargetBlank?: boolean;
4606
4528
  allowText?: boolean;
4607
4529
  repeat?: boolean;
4608
- variant?: {
4609
- options: string[];
4610
- default_value: string;
4611
- };
4530
+ variants?: string[];
4612
4531
  };
4613
4532
  }) | ({
4614
4533
  type: "Number";
@@ -4770,10 +4689,7 @@ export declare const DynamicSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
4770
4689
  allowTargetBlank?: boolean;
4771
4690
  allowText?: boolean;
4772
4691
  repeat?: boolean;
4773
- variant?: {
4774
- options: string[];
4775
- default_value: string;
4776
- };
4692
+ variants?: string[];
4777
4693
  };
4778
4694
  }) | ({
4779
4695
  type: "Number";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/types-internal",
3
- "version": "3.3.0-alpha.0",
3
+ "version": "3.3.0-alpha.2",
4
4
  "description": "Prismic types for Custom Types and Prismic Data",
5
5
  "keywords": [
6
6
  "typescript",
@@ -299,10 +299,7 @@ export function traverseDocument({
299
299
  path,
300
300
  key,
301
301
  apiId: key,
302
- model:
303
- fieldModel?.type === "Link" && fieldModel.config?.repeat
304
- ? fieldModel
305
- : undefined,
302
+ model: fieldModel?.type === "Link" ? fieldModel : undefined,
306
303
  content,
307
304
  })(transformWidget)
308
305
  default:
@@ -241,8 +241,7 @@ export function traverseGroupItemsContent({
241
241
  content: fieldContent,
242
242
  })(transform)
243
243
  } else if (
244
- (!fieldDef ||
245
- (fieldDef?.type === "Link" && fieldDef.config?.repeat)) &&
244
+ (!fieldDef || fieldDef?.type === "Link") &&
246
245
  fieldContent.__TYPE__ === "RepeatableContent"
247
246
  ) {
248
247
  transformedField = traverseRepeatableContent({
@@ -113,11 +113,20 @@ export function traverseRepeatableContent({
113
113
  { key: index.toString(), type: "Widget" },
114
114
  ])
115
115
 
116
+ // Content inside repeatable can't be repeatable.
117
+ const newModel =
118
+ model?.type === "Link" && model.config
119
+ ? {
120
+ ...model,
121
+ config: { ...model.config, repeat: false },
122
+ }
123
+ : model
124
+
116
125
  const transformedField = transform({
117
126
  path: itemPath,
118
127
  key: key,
119
128
  apiId: apiId,
120
- model: model,
129
+ model: newModel,
121
130
  content: fieldContent,
122
131
  })
123
132
 
@@ -228,10 +228,7 @@ export function traverseSharedSliceContent({
228
228
  key: fieldKey,
229
229
  apiId: fieldKey,
230
230
  content: fieldContent,
231
- model:
232
- fieldDef?.type === "Link" && fieldDef.config?.repeat
233
- ? fieldDef
234
- : undefined,
231
+ model: fieldDef?.type === "Link" ? fieldDef : undefined,
235
232
  })(transformWidget)
236
233
  } else if (isNestableContent(fieldContent)) {
237
234
  return transformWidget({
@@ -86,10 +86,11 @@ export const LinkConfig = t.exact(
86
86
  */
87
87
  repeat: t.boolean,
88
88
 
89
- variant: t.strict({
90
- options: t.array(t.string),
91
- default_value: t.string,
92
- }),
89
+ /**
90
+ * `variants` allows an option to be picked from a list (e.g. "primary"). To
91
+ * be considered, the list must have at least one item.
92
+ */
93
+ variants: t.array(t.string),
93
94
  }),
94
95
  )
95
96
  export type LinkConfig = t.TypeOf<typeof LinkConfig>