@prismicio/types-internal 2.9.0-alpha.0 → 2.9.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.
- package/lib/content/Document.d.ts +19 -19
- package/lib/content/Document.js +11 -0
- package/lib/content/LegacyContentCtx.d.ts +2 -17
- package/lib/content/LegacyContentCtx.js +4 -1
- package/lib/content/fields/GroupContent.js +13 -0
- package/lib/content/fields/RepeatableContent.d.ts +4 -78
- package/lib/content/fields/RepeatableContent.js +10 -14
- package/lib/content/fields/WidgetContent.d.ts +18 -18
- package/lib/content/fields/index.d.ts +1 -0
- package/lib/content/fields/index.js +1 -0
- package/lib/content/fields/nestable/NestableContent.d.ts +6 -6
- package/lib/content/fields/nestable/NestableContent.js +5 -17
- package/lib/content/fields/nestable/RichTextContent/TextBlock.d.ts +727 -0
- package/lib/content/fields/nestable/RichTextContent/TextBlock.js +80 -0
- package/lib/content/fields/slices/Slice/CompositeSliceContent.d.ts +6 -6
- package/lib/content/fields/slices/Slice/RepeatableContent.d.ts +1 -1
- package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +6 -6
- package/lib/content/fields/slices/Slice/SharedSliceContent.js +20 -4
- package/lib/content/fields/slices/Slice/SimpleSliceContent.d.ts +5 -5
- package/lib/content/fields/slices/Slice/SlicePrimaryContent.d.ts +5 -5
- package/lib/content/fields/slices/Slice/index.d.ts +10 -10
- package/lib/content/fields/slices/SliceItem.d.ts +10 -10
- package/lib/content/fields/slices/SlicesContent.d.ts +15 -15
- package/lib/customtypes/widgets/Widget.d.ts +0 -15
- package/lib/customtypes/widgets/Widget.js +0 -15
- package/lib/customtypes/widgets/nestable/Link.d.ts +8 -0
- package/lib/customtypes/widgets/nestable/Link.js +6 -5
- package/lib/customtypes/widgets/nestable/NestableWidget.d.ts +1 -2
- package/lib/customtypes/widgets/nestable/NestableWidget.js +1 -18
- package/lib/customtypes/widgets/slices/SliceWidget.d.ts +327 -0
- package/lib/customtypes/widgets/slices/SliceWidget.js +8 -0
- package/package.json +1 -1
- package/src/content/Document.ts +12 -0
- package/src/content/LegacyContentCtx.ts +4 -1
- package/src/content/fields/GroupContent.ts +13 -0
- package/src/content/fields/RepeatableContent.ts +29 -38
- package/src/content/fields/index.ts +1 -0
- package/src/content/fields/nestable/NestableContent.ts +6 -20
- package/src/content/fields/slices/Slice/SharedSliceContent.ts +18 -0
- package/src/customtypes/widgets/Widget.ts +0 -15
- package/src/customtypes/widgets/nestable/Link.ts +7 -5
- package/src/customtypes/widgets/nestable/NestableWidget.ts +16 -34
|
@@ -191,7 +191,7 @@ export declare const isSlicesContent: (u: unknown) => u is {
|
|
|
191
191
|
});
|
|
192
192
|
} | {
|
|
193
193
|
__TYPE__: "RepeatableContent";
|
|
194
|
-
type: "
|
|
194
|
+
type: "Link";
|
|
195
195
|
value: {
|
|
196
196
|
__TYPE__: "LinkContent";
|
|
197
197
|
value: ({
|
|
@@ -601,7 +601,7 @@ export declare const isSlicesContent: (u: unknown) => u is {
|
|
|
601
601
|
});
|
|
602
602
|
} | {
|
|
603
603
|
__TYPE__: "RepeatableContent";
|
|
604
|
-
type: "
|
|
604
|
+
type: "Link";
|
|
605
605
|
value: {
|
|
606
606
|
__TYPE__: "LinkContent";
|
|
607
607
|
value: ({
|
|
@@ -1012,7 +1012,7 @@ export declare const isSlicesContent: (u: unknown) => u is {
|
|
|
1012
1012
|
});
|
|
1013
1013
|
} | {
|
|
1014
1014
|
__TYPE__: "RepeatableContent";
|
|
1015
|
-
type: "
|
|
1015
|
+
type: "Link";
|
|
1016
1016
|
value: {
|
|
1017
1017
|
__TYPE__: "LinkContent";
|
|
1018
1018
|
value: ({
|
|
@@ -1425,7 +1425,7 @@ export declare const isSlicesContent: (u: unknown) => u is {
|
|
|
1425
1425
|
});
|
|
1426
1426
|
} | {
|
|
1427
1427
|
__TYPE__: "RepeatableContent";
|
|
1428
|
-
type: "
|
|
1428
|
+
type: "Link";
|
|
1429
1429
|
value: {
|
|
1430
1430
|
__TYPE__: "LinkContent";
|
|
1431
1431
|
value: ({
|
|
@@ -1836,7 +1836,7 @@ export declare const isSlicesContent: (u: unknown) => u is {
|
|
|
1836
1836
|
});
|
|
1837
1837
|
} | {
|
|
1838
1838
|
__TYPE__: "RepeatableContent";
|
|
1839
|
-
type: "
|
|
1839
|
+
type: "Link";
|
|
1840
1840
|
value: {
|
|
1841
1841
|
__TYPE__: "LinkContent";
|
|
1842
1842
|
value: ({
|
|
@@ -2255,7 +2255,7 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
2255
2255
|
});
|
|
2256
2256
|
} | {
|
|
2257
2257
|
__TYPE__: "RepeatableContent";
|
|
2258
|
-
type: "
|
|
2258
|
+
type: "Link";
|
|
2259
2259
|
value: {
|
|
2260
2260
|
__TYPE__: "LinkContent";
|
|
2261
2261
|
value: ({
|
|
@@ -2665,7 +2665,7 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
2665
2665
|
});
|
|
2666
2666
|
} | {
|
|
2667
2667
|
__TYPE__: "RepeatableContent";
|
|
2668
|
-
type: "
|
|
2668
|
+
type: "Link";
|
|
2669
2669
|
value: {
|
|
2670
2670
|
__TYPE__: "LinkContent";
|
|
2671
2671
|
value: ({
|
|
@@ -3076,7 +3076,7 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
3076
3076
|
});
|
|
3077
3077
|
} | {
|
|
3078
3078
|
__TYPE__: "RepeatableContent";
|
|
3079
|
-
type: "
|
|
3079
|
+
type: "Link";
|
|
3080
3080
|
value: {
|
|
3081
3081
|
__TYPE__: "LinkContent";
|
|
3082
3082
|
value: ({
|
|
@@ -3489,7 +3489,7 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
3489
3489
|
});
|
|
3490
3490
|
} | {
|
|
3491
3491
|
__TYPE__: "RepeatableContent";
|
|
3492
|
-
type: "
|
|
3492
|
+
type: "Link";
|
|
3493
3493
|
value: {
|
|
3494
3494
|
__TYPE__: "LinkContent";
|
|
3495
3495
|
value: ({
|
|
@@ -3900,7 +3900,7 @@ export declare const SlicesLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
3900
3900
|
});
|
|
3901
3901
|
} | {
|
|
3902
3902
|
__TYPE__: "RepeatableContent";
|
|
3903
|
-
type: "
|
|
3903
|
+
type: "Link";
|
|
3904
3904
|
value: {
|
|
3905
3905
|
__TYPE__: "LinkContent";
|
|
3906
3906
|
value: ({
|
|
@@ -4561,7 +4561,7 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
4561
4561
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
4562
4562
|
}>>, t.ExactC<t.TypeC<{
|
|
4563
4563
|
__TYPE__: t.LiteralC<"RepeatableContent">;
|
|
4564
|
-
type: t.
|
|
4564
|
+
type: t.LiteralC<"Link">;
|
|
4565
4565
|
value: t.ArrayC<t.ExactC<t.TypeC<{
|
|
4566
4566
|
__TYPE__: t.LiteralC<"LinkContent">;
|
|
4567
4567
|
value: t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
@@ -5059,7 +5059,7 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
5059
5059
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
5060
5060
|
}>>, t.ExactC<t.TypeC<{
|
|
5061
5061
|
__TYPE__: t.LiteralC<"RepeatableContent">;
|
|
5062
|
-
type: t.
|
|
5062
|
+
type: t.LiteralC<"Link">;
|
|
5063
5063
|
value: t.ArrayC<t.ExactC<t.TypeC<{
|
|
5064
5064
|
__TYPE__: t.LiteralC<"LinkContent">;
|
|
5065
5065
|
value: t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
@@ -5559,7 +5559,7 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
5559
5559
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
5560
5560
|
}>>, t.ExactC<t.TypeC<{
|
|
5561
5561
|
__TYPE__: t.LiteralC<"RepeatableContent">;
|
|
5562
|
-
type: t.
|
|
5562
|
+
type: t.LiteralC<"Link">;
|
|
5563
5563
|
value: t.ArrayC<t.ExactC<t.TypeC<{
|
|
5564
5564
|
__TYPE__: t.LiteralC<"LinkContent">;
|
|
5565
5565
|
value: t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
@@ -6057,7 +6057,7 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
6057
6057
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
6058
6058
|
}>>, t.ExactC<t.TypeC<{
|
|
6059
6059
|
__TYPE__: t.LiteralC<"RepeatableContent">;
|
|
6060
|
-
type: t.
|
|
6060
|
+
type: t.LiteralC<"Link">;
|
|
6061
6061
|
value: t.ArrayC<t.ExactC<t.TypeC<{
|
|
6062
6062
|
__TYPE__: t.LiteralC<"LinkContent">;
|
|
6063
6063
|
value: t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
@@ -6554,7 +6554,7 @@ export declare const SlicesContent: t.TypeC<{
|
|
|
6554
6554
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
6555
6555
|
}>>, t.ExactC<t.TypeC<{
|
|
6556
6556
|
__TYPE__: t.LiteralC<"RepeatableContent">;
|
|
6557
|
-
type: t.
|
|
6557
|
+
type: t.LiteralC<"Link">;
|
|
6558
6558
|
value: t.ArrayC<t.ExactC<t.TypeC<{
|
|
6559
6559
|
__TYPE__: t.LiteralC<"LinkContent">;
|
|
6560
6560
|
value: t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
@@ -3582,21 +3582,6 @@ export declare const FieldType: t.KeyofC<{
|
|
|
3582
3582
|
Group: null;
|
|
3583
3583
|
Slices: null;
|
|
3584
3584
|
Choice: null;
|
|
3585
|
-
"Repeatable.Color": null;
|
|
3586
|
-
"Repeatable.Boolean": null;
|
|
3587
|
-
"Repeatable.Number": null;
|
|
3588
|
-
"Repeatable.Embed": null;
|
|
3589
|
-
"Repeatable.GeoPoint": null;
|
|
3590
|
-
"Repeatable.Date": null;
|
|
3591
|
-
"Repeatable.Range": null;
|
|
3592
|
-
"Repeatable.StructuredText": null;
|
|
3593
|
-
"Repeatable.Select": null;
|
|
3594
|
-
"Repeatable.Separator": null;
|
|
3595
|
-
"Repeatable.Text": null;
|
|
3596
|
-
"Repeatable.Timestamp": null;
|
|
3597
|
-
"Repeatable.Link": null;
|
|
3598
|
-
"Repeatable.Image": null;
|
|
3599
|
-
"Repeatable.IntegrationFields": null;
|
|
3600
3585
|
}>;
|
|
3601
3586
|
export declare type FieldType = t.TypeOf<typeof FieldType>;
|
|
3602
3587
|
export declare const Widgets: {
|
|
@@ -34,21 +34,6 @@ exports.FieldType = t.keyof({
|
|
|
34
34
|
[Group_1.GroupFieldType]: null,
|
|
35
35
|
[Slices_1.SlicesFieldType]: null,
|
|
36
36
|
[Slices_1.LegacySlicesFieldType]: null,
|
|
37
|
-
[`Repeatable.Color`]: null,
|
|
38
|
-
[`Repeatable.Boolean`]: null,
|
|
39
|
-
[`Repeatable.Number`]: null,
|
|
40
|
-
[`Repeatable.Embed`]: null,
|
|
41
|
-
[`Repeatable.GeoPoint`]: null,
|
|
42
|
-
[`Repeatable.Date`]: null,
|
|
43
|
-
[`Repeatable.Range`]: null,
|
|
44
|
-
[`Repeatable.StructuredText`]: null,
|
|
45
|
-
[`Repeatable.Select`]: null,
|
|
46
|
-
[`Repeatable.Separator`]: null,
|
|
47
|
-
[`Repeatable.Text`]: null,
|
|
48
|
-
[`Repeatable.Timestamp`]: null,
|
|
49
|
-
[`Repeatable.Link`]: null,
|
|
50
|
-
[`Repeatable.Image`]: null,
|
|
51
|
-
[`Repeatable.IntegrationFields`]: null,
|
|
52
37
|
});
|
|
53
38
|
exports.Widgets = {
|
|
54
39
|
toStatic(widget, sharedSlices) {
|
|
@@ -10,6 +10,10 @@ export declare const LinkConfig: t.ExactC<t.PartialC<{
|
|
|
10
10
|
tags: t.Type<readonly string[], object, unknown>;
|
|
11
11
|
allowTargetBlank: t.BooleanC;
|
|
12
12
|
allowText: t.BooleanC;
|
|
13
|
+
/**
|
|
14
|
+
* `repeat` property is used to allow multiple links to be added.
|
|
15
|
+
* `undefined` means that the field is not repeatable (hence repeat = false).
|
|
16
|
+
*/
|
|
13
17
|
repeat: t.BooleanC;
|
|
14
18
|
}>>;
|
|
15
19
|
export declare type LinkConfig = t.TypeOf<typeof LinkConfig>;
|
|
@@ -27,6 +31,10 @@ export declare const Link: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
27
31
|
tags: t.Type<readonly string[], object, unknown>;
|
|
28
32
|
allowTargetBlank: t.BooleanC;
|
|
29
33
|
allowText: t.BooleanC;
|
|
34
|
+
/**
|
|
35
|
+
* `repeat` property is used to allow multiple links to be added.
|
|
36
|
+
* `undefined` means that the field is not repeatable (hence repeat = false).
|
|
37
|
+
*/
|
|
30
38
|
repeat: t.BooleanC;
|
|
31
39
|
}>>;
|
|
32
40
|
}>]>>;
|
|
@@ -43,7 +43,11 @@ exports.LinkConfig = t.exact(t.partial({
|
|
|
43
43
|
tags: MasksArrayString,
|
|
44
44
|
allowTargetBlank: t.boolean,
|
|
45
45
|
allowText: t.boolean,
|
|
46
|
-
|
|
46
|
+
/**
|
|
47
|
+
* `repeat` property is used to allow multiple links to be added.
|
|
48
|
+
* `undefined` means that the field is not repeatable (hence repeat = false).
|
|
49
|
+
*/
|
|
50
|
+
repeat: t.boolean,
|
|
47
51
|
}));
|
|
48
52
|
exports.Link = t.exact(t.intersection([
|
|
49
53
|
t.type({
|
|
@@ -51,9 +55,6 @@ exports.Link = t.exact(t.intersection([
|
|
|
51
55
|
}),
|
|
52
56
|
t.partial({
|
|
53
57
|
fieldset: validators_1.StringOrNull,
|
|
54
|
-
config:
|
|
55
|
-
select: null,
|
|
56
|
-
repeat: false,
|
|
57
|
-
}),
|
|
58
|
+
config: exports.LinkConfig,
|
|
58
59
|
}),
|
|
59
60
|
]));
|
|
@@ -159,5 +159,4 @@ export declare const NestableWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC
|
|
|
159
159
|
}>>;
|
|
160
160
|
}>]>>]>;
|
|
161
161
|
export declare type NestableWidget = t.TypeOf<typeof NestableWidget>;
|
|
162
|
-
export declare
|
|
163
|
-
export declare type NestableFieldTypes = t.TypeOf<typeof NestableFieldTypes>;
|
|
162
|
+
export declare type NestableFieldTypes = NestableWidget["type"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.NestableWidget = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
6
|
const BooleanField_1 = require("./BooleanField");
|
|
@@ -35,20 +35,3 @@ exports.NestableWidget = t.union([
|
|
|
35
35
|
Image_1.Image,
|
|
36
36
|
IntegrationField_1.IntegrationField,
|
|
37
37
|
]);
|
|
38
|
-
exports.NestableFieldTypes = t.union([
|
|
39
|
-
t.literal(Color_1.ColorFieldType),
|
|
40
|
-
t.literal(BooleanField_1.BooleanFieldType),
|
|
41
|
-
t.literal(Embed_1.EmbedFieldType),
|
|
42
|
-
t.literal(GeoPoint_1.GeoPointFieldType),
|
|
43
|
-
t.literal(Date_1.DateFieldType),
|
|
44
|
-
t.literal(Number_1.NumberFieldType),
|
|
45
|
-
t.literal(Range_1.RangeFieldType),
|
|
46
|
-
t.literal(RichText_1.RichTextFieldType),
|
|
47
|
-
t.literal(Select_1.SelectFieldType),
|
|
48
|
-
t.literal(Separator_1.SeparatorFieldType),
|
|
49
|
-
t.literal(Text_1.TextFieldType),
|
|
50
|
-
t.literal(Timestamp_1.TimestampFieldType),
|
|
51
|
-
t.literal(Link_1.LinkFieldType),
|
|
52
|
-
t.literal(Image_1.ImageFieldType),
|
|
53
|
-
t.literal(IntegrationField_1.IntegrationFieldType),
|
|
54
|
-
]);
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
export declare const SliceWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
3
|
+
type: t.LiteralC<"Group">;
|
|
4
|
+
}>, t.PartialC<{
|
|
5
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
6
|
+
icon: t.StringC;
|
|
7
|
+
description: t.StringC;
|
|
8
|
+
config: t.ExactC<t.PartialC<{
|
|
9
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
10
|
+
repeat: t.BooleanC;
|
|
11
|
+
fields: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
12
|
+
type: t.LiteralC<"Color">;
|
|
13
|
+
}>, t.PartialC<{
|
|
14
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
15
|
+
config: t.ExactC<t.PartialC<{
|
|
16
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
17
|
+
placeholder: t.StringC;
|
|
18
|
+
}>>;
|
|
19
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
20
|
+
type: t.LiteralC<"Boolean">;
|
|
21
|
+
}>, t.PartialC<{
|
|
22
|
+
config: t.ExactC<t.PartialC<{
|
|
23
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
24
|
+
default_value: t.BooleanC;
|
|
25
|
+
placeholder_true: t.StringC;
|
|
26
|
+
placeholder_false: t.StringC;
|
|
27
|
+
}>>;
|
|
28
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
29
|
+
type: t.LiteralC<"Embed">;
|
|
30
|
+
}>, t.PartialC<{
|
|
31
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
32
|
+
config: t.ExactC<t.PartialC<{
|
|
33
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
34
|
+
placeholder: t.StringC;
|
|
35
|
+
useAsTitle: t.BooleanC;
|
|
36
|
+
}>>;
|
|
37
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
38
|
+
type: t.LiteralC<"GeoPoint">;
|
|
39
|
+
}>, t.PartialC<{
|
|
40
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
41
|
+
config: t.ExactC<t.PartialC<{
|
|
42
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
43
|
+
}>>;
|
|
44
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
45
|
+
type: t.LiteralC<"Date">;
|
|
46
|
+
}>, t.PartialC<{
|
|
47
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
48
|
+
config: t.ExactC<t.PartialC<{
|
|
49
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
50
|
+
placeholder: t.StringC;
|
|
51
|
+
default: t.StringC;
|
|
52
|
+
}>>;
|
|
53
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
54
|
+
type: t.LiteralC<"Number">;
|
|
55
|
+
}>, t.PartialC<{
|
|
56
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
57
|
+
config: t.ExactC<t.PartialC<{
|
|
58
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
59
|
+
placeholder: t.StringC;
|
|
60
|
+
min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
61
|
+
max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
62
|
+
step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
63
|
+
}>>;
|
|
64
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
65
|
+
type: t.LiteralC<"Range">;
|
|
66
|
+
}>, t.PartialC<{
|
|
67
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
68
|
+
config: t.ExactC<t.PartialC<{
|
|
69
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
70
|
+
placeholder: t.StringC;
|
|
71
|
+
min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
72
|
+
max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
73
|
+
step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
74
|
+
}>>;
|
|
75
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
76
|
+
type: t.LiteralC<"StructuredText">;
|
|
77
|
+
}>, t.PartialC<{
|
|
78
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
79
|
+
config: t.ExactC<t.PartialC<{
|
|
80
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
81
|
+
placeholder: t.StringC;
|
|
82
|
+
useAsTitle: t.BooleanC;
|
|
83
|
+
single: t.Type<string, string, unknown>;
|
|
84
|
+
multi: t.Type<string, string, unknown>;
|
|
85
|
+
imageConstraint: t.PartialC<{
|
|
86
|
+
width: t.Type<number | null, unknown, unknown>;
|
|
87
|
+
height: t.Type<number | null, unknown, unknown>;
|
|
88
|
+
}>;
|
|
89
|
+
labels: t.Type<readonly string[], object, unknown>;
|
|
90
|
+
allowTargetBlank: t.BooleanC;
|
|
91
|
+
}>>;
|
|
92
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
93
|
+
type: t.LiteralC<"Select">;
|
|
94
|
+
}>, t.PartialC<{
|
|
95
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
96
|
+
config: t.ExactC<t.PartialC<{
|
|
97
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
98
|
+
placeholder: t.StringC;
|
|
99
|
+
default_value: t.StringC;
|
|
100
|
+
options: t.ReadonlyArrayC<t.UnionC<[t.StringC, t.Type<string, string, unknown>, t.Type<string, string, unknown>]>>;
|
|
101
|
+
}>>;
|
|
102
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
103
|
+
type: t.LiteralC<"Separator">;
|
|
104
|
+
}>, t.PartialC<{
|
|
105
|
+
config: t.ExactC<t.PartialC<{
|
|
106
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
107
|
+
}>>;
|
|
108
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
109
|
+
type: t.LiteralC<"Text">;
|
|
110
|
+
}>, t.PartialC<{
|
|
111
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
112
|
+
config: t.ExactC<t.PartialC<{
|
|
113
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
114
|
+
useAsTitle: t.BooleanC;
|
|
115
|
+
placeholder: t.StringC;
|
|
116
|
+
}>>;
|
|
117
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
118
|
+
type: t.LiteralC<"Timestamp">;
|
|
119
|
+
}>, t.PartialC<{
|
|
120
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
121
|
+
config: t.ExactC<t.PartialC<{
|
|
122
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
123
|
+
placeholder: t.StringC;
|
|
124
|
+
default: t.StringC;
|
|
125
|
+
}>>;
|
|
126
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
127
|
+
type: t.LiteralC<"Link">;
|
|
128
|
+
}>, t.PartialC<{
|
|
129
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
130
|
+
config: t.ExactC<t.PartialC<{
|
|
131
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
132
|
+
useAsTitle: t.BooleanC;
|
|
133
|
+
placeholder: t.StringC;
|
|
134
|
+
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
135
|
+
customtypes: t.ReadonlyArrayC<t.StringC>;
|
|
136
|
+
masks: t.Type<readonly string[], object, unknown>;
|
|
137
|
+
tags: t.Type<readonly string[], object, unknown>;
|
|
138
|
+
allowTargetBlank: t.BooleanC;
|
|
139
|
+
}>>;
|
|
140
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
141
|
+
type: t.LiteralC<"Image">;
|
|
142
|
+
}>, t.PartialC<{
|
|
143
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
144
|
+
config: t.ExactC<t.PartialC<{
|
|
145
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
146
|
+
placeholder: t.StringC;
|
|
147
|
+
constraint: t.PartialC<{
|
|
148
|
+
width: t.Type<number | null, unknown, unknown>;
|
|
149
|
+
height: t.Type<number | null, unknown, unknown>;
|
|
150
|
+
}>;
|
|
151
|
+
thumbnails: t.ReadonlyArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
152
|
+
name: t.StringC;
|
|
153
|
+
}>, t.PartialC<{
|
|
154
|
+
width: t.Type<number | null, unknown, unknown>;
|
|
155
|
+
height: t.Type<number | null, unknown, unknown>;
|
|
156
|
+
}>]>>>;
|
|
157
|
+
}>>;
|
|
158
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
159
|
+
type: t.LiteralC<"IntegrationFields">;
|
|
160
|
+
}>, t.PartialC<{
|
|
161
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
162
|
+
config: t.ExactC<t.PartialC<{
|
|
163
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
164
|
+
placeholder: t.StringC;
|
|
165
|
+
catalog: t.StringC;
|
|
166
|
+
}>>;
|
|
167
|
+
}>]>>]>>;
|
|
168
|
+
}>>;
|
|
169
|
+
}>]>>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
170
|
+
type: t.LiteralC<"Color">;
|
|
171
|
+
}>, t.PartialC<{
|
|
172
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
173
|
+
config: t.ExactC<t.PartialC<{
|
|
174
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
175
|
+
placeholder: t.StringC;
|
|
176
|
+
}>>;
|
|
177
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
178
|
+
type: t.LiteralC<"Boolean">;
|
|
179
|
+
}>, t.PartialC<{
|
|
180
|
+
config: t.ExactC<t.PartialC<{
|
|
181
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
182
|
+
default_value: t.BooleanC;
|
|
183
|
+
placeholder_true: t.StringC;
|
|
184
|
+
placeholder_false: t.StringC;
|
|
185
|
+
}>>;
|
|
186
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
187
|
+
type: t.LiteralC<"Embed">;
|
|
188
|
+
}>, t.PartialC<{
|
|
189
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
190
|
+
config: t.ExactC<t.PartialC<{
|
|
191
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
192
|
+
placeholder: t.StringC;
|
|
193
|
+
useAsTitle: t.BooleanC;
|
|
194
|
+
}>>;
|
|
195
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
196
|
+
type: t.LiteralC<"GeoPoint">;
|
|
197
|
+
}>, t.PartialC<{
|
|
198
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
199
|
+
config: t.ExactC<t.PartialC<{
|
|
200
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
201
|
+
}>>;
|
|
202
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
203
|
+
type: t.LiteralC<"Date">;
|
|
204
|
+
}>, t.PartialC<{
|
|
205
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
206
|
+
config: t.ExactC<t.PartialC<{
|
|
207
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
208
|
+
placeholder: t.StringC;
|
|
209
|
+
default: t.StringC;
|
|
210
|
+
}>>;
|
|
211
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
212
|
+
type: t.LiteralC<"Number">;
|
|
213
|
+
}>, t.PartialC<{
|
|
214
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
215
|
+
config: t.ExactC<t.PartialC<{
|
|
216
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
217
|
+
placeholder: t.StringC;
|
|
218
|
+
min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
219
|
+
max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
220
|
+
step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
221
|
+
}>>;
|
|
222
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
223
|
+
type: t.LiteralC<"Range">;
|
|
224
|
+
}>, t.PartialC<{
|
|
225
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
226
|
+
config: t.ExactC<t.PartialC<{
|
|
227
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
228
|
+
placeholder: t.StringC;
|
|
229
|
+
min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
230
|
+
max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
231
|
+
step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
|
|
232
|
+
}>>;
|
|
233
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
234
|
+
type: t.LiteralC<"StructuredText">;
|
|
235
|
+
}>, t.PartialC<{
|
|
236
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
237
|
+
config: t.ExactC<t.PartialC<{
|
|
238
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
239
|
+
placeholder: t.StringC;
|
|
240
|
+
useAsTitle: t.BooleanC;
|
|
241
|
+
single: t.Type<string, string, unknown>;
|
|
242
|
+
multi: t.Type<string, string, unknown>;
|
|
243
|
+
imageConstraint: t.PartialC<{
|
|
244
|
+
width: t.Type<number | null, unknown, unknown>;
|
|
245
|
+
height: t.Type<number | null, unknown, unknown>;
|
|
246
|
+
}>;
|
|
247
|
+
labels: t.Type<readonly string[], object, unknown>;
|
|
248
|
+
allowTargetBlank: t.BooleanC;
|
|
249
|
+
}>>;
|
|
250
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
251
|
+
type: t.LiteralC<"Select">;
|
|
252
|
+
}>, t.PartialC<{
|
|
253
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
254
|
+
config: t.ExactC<t.PartialC<{
|
|
255
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
256
|
+
placeholder: t.StringC;
|
|
257
|
+
default_value: t.StringC;
|
|
258
|
+
options: t.ReadonlyArrayC<t.UnionC<[t.StringC, t.Type<string, string, unknown>, t.Type<string, string, unknown>]>>;
|
|
259
|
+
}>>;
|
|
260
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
261
|
+
type: t.LiteralC<"Separator">;
|
|
262
|
+
}>, t.PartialC<{
|
|
263
|
+
config: t.ExactC<t.PartialC<{
|
|
264
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
265
|
+
}>>;
|
|
266
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
267
|
+
type: t.LiteralC<"Text">;
|
|
268
|
+
}>, t.PartialC<{
|
|
269
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
270
|
+
config: t.ExactC<t.PartialC<{
|
|
271
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
272
|
+
useAsTitle: t.BooleanC;
|
|
273
|
+
placeholder: t.StringC;
|
|
274
|
+
}>>;
|
|
275
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
276
|
+
type: t.LiteralC<"Timestamp">;
|
|
277
|
+
}>, t.PartialC<{
|
|
278
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
279
|
+
config: t.ExactC<t.PartialC<{
|
|
280
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
281
|
+
placeholder: t.StringC;
|
|
282
|
+
default: t.StringC;
|
|
283
|
+
}>>;
|
|
284
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
285
|
+
type: t.LiteralC<"Link">;
|
|
286
|
+
}>, t.PartialC<{
|
|
287
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
288
|
+
config: t.ExactC<t.PartialC<{
|
|
289
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
290
|
+
useAsTitle: t.BooleanC;
|
|
291
|
+
placeholder: t.StringC;
|
|
292
|
+
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
|
|
293
|
+
customtypes: t.ReadonlyArrayC<t.StringC>;
|
|
294
|
+
masks: t.Type<readonly string[], object, unknown>;
|
|
295
|
+
tags: t.Type<readonly string[], object, unknown>;
|
|
296
|
+
allowTargetBlank: t.BooleanC;
|
|
297
|
+
}>>;
|
|
298
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
299
|
+
type: t.LiteralC<"Image">;
|
|
300
|
+
}>, t.PartialC<{
|
|
301
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
302
|
+
config: t.ExactC<t.PartialC<{
|
|
303
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
304
|
+
placeholder: t.StringC;
|
|
305
|
+
constraint: t.PartialC<{
|
|
306
|
+
width: t.Type<number | null, unknown, unknown>;
|
|
307
|
+
height: t.Type<number | null, unknown, unknown>;
|
|
308
|
+
}>;
|
|
309
|
+
thumbnails: t.ReadonlyArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
310
|
+
name: t.StringC;
|
|
311
|
+
}>, t.PartialC<{
|
|
312
|
+
width: t.Type<number | null, unknown, unknown>;
|
|
313
|
+
height: t.Type<number | null, unknown, unknown>;
|
|
314
|
+
}>]>>>;
|
|
315
|
+
}>>;
|
|
316
|
+
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
317
|
+
type: t.LiteralC<"IntegrationFields">;
|
|
318
|
+
}>, t.PartialC<{
|
|
319
|
+
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
320
|
+
config: t.ExactC<t.PartialC<{
|
|
321
|
+
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
322
|
+
placeholder: t.StringC;
|
|
323
|
+
catalog: t.StringC;
|
|
324
|
+
}>>;
|
|
325
|
+
}>]>>]>]>;
|
|
326
|
+
export declare type SliceWidget = t.TypeOf<typeof SliceWidget>;
|
|
327
|
+
export declare type SliceFieldTypes = SliceWidget["type"];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SliceWidget = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
+
const Group_1 = require("../Group");
|
|
7
|
+
const nestable_1 = require("../nestable");
|
|
8
|
+
exports.SliceWidget = t.union([Group_1.Group, nestable_1.NestableWidget]);
|
package/package.json
CHANGED
package/src/content/Document.ts
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
NestableContentDefaultValue,
|
|
25
25
|
slicesContentWithDefaultValues,
|
|
26
26
|
traverseGroupContent,
|
|
27
|
+
traverseRepeatableContent,
|
|
27
28
|
traverseSlices,
|
|
28
29
|
WidgetContent,
|
|
29
30
|
WidgetLegacy,
|
|
@@ -293,6 +294,17 @@ export function traverseDocument({
|
|
|
293
294
|
model: fieldModel?.type === "Group" ? fieldModel : undefined,
|
|
294
295
|
content,
|
|
295
296
|
})(transformWidget)
|
|
297
|
+
case "RepeatableContent":
|
|
298
|
+
return traverseRepeatableContent({
|
|
299
|
+
path,
|
|
300
|
+
key,
|
|
301
|
+
apiId: key,
|
|
302
|
+
model:
|
|
303
|
+
fieldModel?.type === "Link" && fieldModel.config?.repeat
|
|
304
|
+
? fieldModel
|
|
305
|
+
: undefined,
|
|
306
|
+
content,
|
|
307
|
+
})(transformWidget)
|
|
296
308
|
default:
|
|
297
309
|
return transformWidget({
|
|
298
310
|
path,
|
|
@@ -2,7 +2,10 @@ import * as t from "io-ts"
|
|
|
2
2
|
|
|
3
3
|
import { FieldType, SlicesTypes } from "../customtypes/widgets"
|
|
4
4
|
|
|
5
|
-
export const FieldOrSliceType = t.union([
|
|
5
|
+
export const FieldOrSliceType = t.union([
|
|
6
|
+
t.union([FieldType, SlicesTypes]),
|
|
7
|
+
t.literal("Repeatable.Link"),
|
|
8
|
+
])
|
|
6
9
|
export type FieldOrSliceType = t.TypeOf<typeof FieldOrSliceType>
|
|
7
10
|
export class LegacyContentCtx {
|
|
8
11
|
fieldKey: string
|