@prismicio/types-internal 0.2.2 → 0.2.6
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/customtypes/CustomType.d.ts +4 -21
- package/lib/customtypes/CustomType.js +38 -27
- package/lib/customtypes/Format.js +5 -2
- package/lib/customtypes/Section.d.ts +4 -31
- package/lib/customtypes/Section.js +14 -9
- package/lib/customtypes/index.js +9 -4
- package/lib/customtypes/widgets/Group.js +12 -9
- package/lib/customtypes/widgets/UID.js +10 -7
- package/lib/customtypes/widgets/Widget.d.ts +4 -31
- package/lib/customtypes/widgets/Widget.js +19 -14
- package/lib/customtypes/widgets/WidgetTypes.js +3 -1
- package/lib/customtypes/widgets/index.js +14 -7
- package/lib/customtypes/widgets/nestable/BooleanField.js +9 -6
- package/lib/customtypes/widgets/nestable/Color.js +10 -7
- package/lib/customtypes/widgets/nestable/Date.js +10 -7
- package/lib/customtypes/widgets/nestable/Embed.js +10 -7
- package/lib/customtypes/widgets/nestable/GeoPoint.js +10 -7
- package/lib/customtypes/widgets/nestable/Image.js +13 -10
- package/lib/customtypes/widgets/nestable/IntegrationField.js +10 -7
- package/lib/customtypes/widgets/nestable/Link.js +14 -11
- package/lib/customtypes/widgets/nestable/NestableWidget.js +35 -32
- package/lib/customtypes/widgets/nestable/Number.js +14 -11
- package/lib/customtypes/widgets/nestable/Range.js +14 -11
- package/lib/customtypes/widgets/nestable/RichText.d.ts +22 -3
- package/lib/customtypes/widgets/nestable/RichText.js +78 -35
- package/lib/customtypes/widgets/nestable/Select.js +11 -8
- package/lib/customtypes/widgets/nestable/Separator.js +9 -6
- package/lib/customtypes/widgets/nestable/Text.js +10 -7
- package/lib/customtypes/widgets/nestable/Timestamp.js +10 -7
- package/lib/customtypes/widgets/nestable/index.d.ts +2 -1
- package/lib/customtypes/widgets/nestable/index.js +35 -15
- package/lib/customtypes/widgets/shared/ImageConstraint.js +12 -9
- package/lib/customtypes/widgets/shared/index.js +8 -1
- package/lib/customtypes/widgets/slices/CompositeSlice.js +13 -10
- package/lib/customtypes/widgets/slices/LegacySlice.d.ts +1 -10
- package/lib/customtypes/widgets/slices/LegacySlice.js +8 -6
- package/lib/customtypes/widgets/slices/SharedSlice.d.ts +327 -3
- package/lib/customtypes/widgets/slices/SharedSlice.js +15 -12
- package/lib/customtypes/widgets/slices/SharedSliceRef.js +7 -4
- package/lib/customtypes/widgets/slices/Slice.d.ts +1 -1
- package/lib/customtypes/widgets/slices/Slice.js +2 -1
- package/lib/customtypes/widgets/slices/Slices.d.ts +7 -61
- package/lib/customtypes/widgets/slices/Slices.js +33 -27
- package/lib/customtypes/widgets/slices/SlicesTypes.js +3 -1
- package/lib/customtypes/widgets/slices/index.d.ts +1 -1
- package/lib/customtypes/widgets/slices/index.js +15 -7
- package/lib/documents/DocumentData.js +7 -4
- package/lib/documents/index.js +7 -2
- package/lib/documents/widgets/EmptyContent.js +6 -3
- package/lib/documents/widgets/GroupContent.js +14 -10
- package/lib/documents/widgets/SimpleWidgetContent.d.ts +2 -2
- package/lib/documents/widgets/SimpleWidgetContent.js +32 -27
- package/lib/documents/widgets/StaticWidgetContent.js +11 -8
- package/lib/documents/widgets/UIDContent.js +8 -4
- package/lib/documents/widgets/index.d.ts +18 -18
- package/lib/documents/widgets/index.js +27 -22
- package/lib/documents/widgets/nestable/BooleanContent.js +10 -6
- package/lib/documents/widgets/nestable/EmbedContent.d.ts +6 -3
- package/lib/documents/widgets/nestable/EmbedContent.js +23 -20
- package/lib/documents/widgets/nestable/FieldContent.d.ts +3 -2
- package/lib/documents/widgets/nestable/FieldContent.js +10 -6
- package/lib/documents/widgets/nestable/GeoPointContent.js +9 -5
- package/lib/documents/widgets/nestable/ImageContent.js +16 -12
- package/lib/documents/widgets/nestable/IntegrationFieldsContent.js +10 -6
- package/lib/documents/widgets/nestable/Link/DocumentLink.js +12 -7
- package/lib/documents/widgets/nestable/Link/ExternalLink.js +15 -10
- package/lib/documents/widgets/nestable/Link/FileLink.js +15 -10
- package/lib/documents/widgets/nestable/Link/ImageLink.js +14 -9
- package/lib/documents/widgets/nestable/Link/LinkContent.js +13 -9
- package/lib/documents/widgets/nestable/Link/index.d.ts +5 -5
- package/lib/documents/widgets/nestable/Link/index.js +33 -24
- package/lib/documents/widgets/nestable/SeparatorContent.js +5 -2
- package/lib/documents/widgets/nestable/StructuredTextContent/Block.d.ts +2 -3
- package/lib/documents/widgets/nestable/StructuredTextContent/Block.js +39 -33
- package/lib/documents/widgets/nestable/StructuredTextContent/index.js +11 -7
- package/lib/documents/widgets/nestable/index.d.ts +15 -15
- package/lib/documents/widgets/nestable/index.js +38 -28
- package/lib/documents/widgets/slices/CompositeSliceContent.js +13 -9
- package/lib/documents/widgets/slices/SharedSliceContent.js +16 -12
- package/lib/documents/widgets/slices/SimpleSliceContent.js +6 -2
- package/lib/documents/widgets/slices/SliceWidgetContent.js +12 -8
- package/lib/documents/widgets/slices/SlicesContent.js +17 -13
- package/lib/documents/widgets/slices/index.js +8 -5
- package/lib/index.js +7 -3
- package/lib/validators/DateFromString.js +7 -4
- package/lib/validators/DateFromStringOrNumber.js +7 -4
- package/lib/validators/DateFromTsMs.js +7 -4
- package/lib/validators/IntFromNumber.js +7 -4
- package/lib/validators/IntFromPixels.js +7 -4
- package/lib/validators/NonEmptyString.js +6 -3
- package/lib/validators/NonEmptyStringOrNull.js +10 -7
- package/lib/validators/NumberOrNull.js +6 -3
- package/lib/validators/StringFromBoolean.js +7 -4
- package/lib/validators/StringFromNumber.js +7 -4
- package/lib/validators/StringOrNull.js +6 -3
- package/lib/validators/function.js +28 -15
- package/lib/validators/index.js +27 -12
- package/package.json +1 -1
- package/src/customtypes/CustomType.ts +8 -7
- package/src/customtypes/Section.ts +1 -1
- package/src/customtypes/widgets/Widget.ts +1 -1
- package/src/customtypes/widgets/nestable/NestableWidget.ts +1 -1
- package/src/customtypes/widgets/nestable/RichText.ts +64 -24
- package/src/customtypes/widgets/nestable/index.ts +2 -1
- package/src/customtypes/widgets/slices/LegacySlice.ts +1 -2
- package/src/customtypes/widgets/slices/SharedSlice.ts +4 -6
- package/src/customtypes/widgets/slices/Slice.ts +1 -1
- package/src/customtypes/widgets/slices/Slices.ts +1 -1
- package/src/customtypes/widgets/slices/index.ts +1 -1
- package/src/documents/widgets/SimpleWidgetContent.ts +4 -4
- package/src/documents/widgets/index.ts +1 -1
- package/src/documents/widgets/nestable/EmbedContent.ts +8 -6
- package/src/documents/widgets/nestable/FieldContent.ts +10 -2
- package/src/documents/widgets/nestable/Link/index.ts +1 -1
- package/src/documents/widgets/nestable/StructuredTextContent/Block.ts +1 -1
- package/src/documents/widgets/nestable/index.ts +2 -2
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
5
|
+
const validators_1 = require("../../../validators");
|
|
6
|
+
const WidgetTypes_1 = (0, tslib_1.__importDefault)(require("../WidgetTypes"));
|
|
4
7
|
const GeoPointConfig = t.exact(t.partial({
|
|
5
|
-
label: StringOrNull,
|
|
8
|
+
label: validators_1.StringOrNull,
|
|
6
9
|
}));
|
|
7
10
|
const GeoPoint = t.exact(t.intersection([
|
|
8
11
|
t.type({
|
|
9
|
-
type: t.literal(
|
|
12
|
+
type: t.literal(WidgetTypes_1.default.GeoPoint),
|
|
10
13
|
}),
|
|
11
14
|
t.partial({
|
|
12
|
-
fieldset: StringOrNull,
|
|
15
|
+
fieldset: validators_1.StringOrNull,
|
|
13
16
|
config: GeoPointConfig,
|
|
14
17
|
}),
|
|
15
18
|
]));
|
|
16
|
-
|
|
19
|
+
exports.default = GeoPoint;
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
5
|
+
const validators_1 = require("../../../validators");
|
|
6
|
+
const ImageConstraint_1 = (0, tslib_1.__importDefault)(require("../shared/ImageConstraint"));
|
|
7
|
+
const WidgetTypes_1 = (0, tslib_1.__importDefault)(require("../WidgetTypes"));
|
|
5
8
|
const Thumbnail = t.exact(t.intersection([
|
|
6
9
|
t.type({
|
|
7
10
|
name: t.string,
|
|
8
11
|
}),
|
|
9
|
-
|
|
12
|
+
ImageConstraint_1.default,
|
|
10
13
|
]));
|
|
11
14
|
const ImageConfig = t.exact(t.partial({
|
|
12
|
-
label: StringOrNull,
|
|
15
|
+
label: validators_1.StringOrNull,
|
|
13
16
|
placeholder: t.string,
|
|
14
|
-
constraint:
|
|
17
|
+
constraint: ImageConstraint_1.default,
|
|
15
18
|
thumbnails: t.array(Thumbnail),
|
|
16
19
|
}));
|
|
17
20
|
const Image = t.exact(t.intersection([
|
|
18
21
|
t.type({
|
|
19
|
-
type: t.literal(
|
|
22
|
+
type: t.literal(WidgetTypes_1.default.Image),
|
|
20
23
|
}),
|
|
21
24
|
t.partial({
|
|
22
|
-
fieldset: StringOrNull,
|
|
25
|
+
fieldset: validators_1.StringOrNull,
|
|
23
26
|
config: ImageConfig,
|
|
24
27
|
}),
|
|
25
28
|
]));
|
|
26
|
-
|
|
29
|
+
exports.default = Image;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
5
|
+
const validators_1 = require("../../../validators");
|
|
6
|
+
const WidgetTypes_1 = (0, tslib_1.__importDefault)(require("../WidgetTypes"));
|
|
4
7
|
const IntegrationFieldConfig = t.exact(t.partial({
|
|
5
|
-
label: StringOrNull,
|
|
8
|
+
label: validators_1.StringOrNull,
|
|
6
9
|
placeholder: t.string,
|
|
7
10
|
catalog: t.string,
|
|
8
11
|
}));
|
|
9
12
|
const IntegrationField = t.exact(t.intersection([
|
|
10
13
|
t.type({
|
|
11
|
-
type: t.literal(
|
|
14
|
+
type: t.literal(WidgetTypes_1.default.IntegrationField),
|
|
12
15
|
}),
|
|
13
16
|
t.partial({
|
|
14
|
-
fieldset: StringOrNull,
|
|
17
|
+
fieldset: validators_1.StringOrNull,
|
|
15
18
|
config: IntegrationFieldConfig,
|
|
16
19
|
}),
|
|
17
20
|
]));
|
|
18
|
-
|
|
21
|
+
exports.default = IntegrationField;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const Either_1 = require("fp-ts/lib/Either");
|
|
5
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
+
const withFallback_1 = require("io-ts-types/lib/withFallback");
|
|
7
|
+
const validators_1 = require("../../../validators");
|
|
8
|
+
const WidgetTypes_1 = (0, tslib_1.__importDefault)(require("../WidgetTypes"));
|
|
6
9
|
const arrayString = (entries) => {
|
|
7
10
|
if (entries instanceof Array) {
|
|
8
11
|
const isValidEntries = entries.reduce((acc, l) => acc && typeof l === "string", true);
|
|
@@ -20,15 +23,15 @@ const plainString = (entries) => {
|
|
|
20
23
|
const MasksArrayString = new t.Type("MasksArrayString", (u) => {
|
|
21
24
|
return u instanceof Array;
|
|
22
25
|
}, (u, context) => {
|
|
23
|
-
return either.chain(t.union([t.array(t.string), t.string]).validate(u, context), (masks) => {
|
|
26
|
+
return Either_1.either.chain(t.union([t.array(t.string), t.string]).validate(u, context), (masks) => {
|
|
24
27
|
return arrayString(masks) || plainString(masks) || t.failure(u, context);
|
|
25
28
|
});
|
|
26
29
|
}, (res) => res);
|
|
27
30
|
const LinkConfig = t.exact(t.partial({
|
|
28
|
-
label: StringOrNull,
|
|
31
|
+
label: validators_1.StringOrNull,
|
|
29
32
|
useAsTitle: t.boolean,
|
|
30
33
|
placeholder: t.string,
|
|
31
|
-
select: withFallback(t.union([
|
|
34
|
+
select: (0, withFallback_1.withFallback)(t.union([
|
|
32
35
|
t.literal("media"),
|
|
33
36
|
t.literal("document"),
|
|
34
37
|
t.literal("web"),
|
|
@@ -41,11 +44,11 @@ const LinkConfig = t.exact(t.partial({
|
|
|
41
44
|
}));
|
|
42
45
|
const Link = t.exact(t.intersection([
|
|
43
46
|
t.type({
|
|
44
|
-
type: t.literal(
|
|
47
|
+
type: t.literal(WidgetTypes_1.default.Link),
|
|
45
48
|
}),
|
|
46
49
|
t.partial({
|
|
47
|
-
fieldset: StringOrNull,
|
|
50
|
+
fieldset: validators_1.StringOrNull,
|
|
48
51
|
config: LinkConfig,
|
|
49
52
|
}),
|
|
50
53
|
]));
|
|
51
|
-
|
|
54
|
+
exports.default = Link;
|
|
@@ -1,34 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
5
|
+
const BooleanField_1 = (0, tslib_1.__importDefault)(require("./BooleanField"));
|
|
6
|
+
const Color_1 = (0, tslib_1.__importDefault)(require("./Color"));
|
|
7
|
+
const Date_1 = (0, tslib_1.__importDefault)(require("./Date"));
|
|
8
|
+
const Embed_1 = (0, tslib_1.__importDefault)(require("./Embed"));
|
|
9
|
+
const GeoPoint_1 = (0, tslib_1.__importDefault)(require("./GeoPoint"));
|
|
10
|
+
const Image_1 = (0, tslib_1.__importDefault)(require("./Image"));
|
|
11
|
+
const IntegrationField_1 = (0, tslib_1.__importDefault)(require("./IntegrationField"));
|
|
12
|
+
const Link_1 = (0, tslib_1.__importDefault)(require("./Link"));
|
|
13
|
+
const Number_1 = (0, tslib_1.__importDefault)(require("./Number"));
|
|
14
|
+
const Range_1 = (0, tslib_1.__importDefault)(require("./Range"));
|
|
15
|
+
const RichText_1 = require("./RichText");
|
|
16
|
+
const Select_1 = (0, tslib_1.__importDefault)(require("./Select"));
|
|
17
|
+
const Separator_1 = (0, tslib_1.__importDefault)(require("./Separator"));
|
|
18
|
+
const Text_1 = (0, tslib_1.__importDefault)(require("./Text"));
|
|
19
|
+
const Timestamp_1 = (0, tslib_1.__importDefault)(require("./Timestamp"));
|
|
17
20
|
const NestableWidget = t.union([
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
RichText,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
Color_1.default,
|
|
22
|
+
BooleanField_1.default,
|
|
23
|
+
Embed_1.default,
|
|
24
|
+
GeoPoint_1.default,
|
|
25
|
+
Date_1.default,
|
|
26
|
+
Number_1.default,
|
|
27
|
+
Range_1.default,
|
|
28
|
+
RichText_1.RichText,
|
|
29
|
+
Select_1.default,
|
|
30
|
+
Separator_1.default,
|
|
31
|
+
Text_1.default,
|
|
32
|
+
Timestamp_1.default,
|
|
33
|
+
Link_1.default,
|
|
34
|
+
Image_1.default,
|
|
35
|
+
IntegrationField_1.default,
|
|
33
36
|
]);
|
|
34
|
-
|
|
37
|
+
exports.default = NestableWidget;
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
5
|
+
const NumberFromString_1 = require("io-ts-types/lib/NumberFromString");
|
|
6
|
+
const validators_1 = require("../../../validators");
|
|
7
|
+
const WidgetTypes_1 = (0, tslib_1.__importDefault)(require("../WidgetTypes"));
|
|
5
8
|
const NumberConfig = t.exact(t.partial({
|
|
6
|
-
label: StringOrNull,
|
|
9
|
+
label: validators_1.StringOrNull,
|
|
7
10
|
placeholder: t.string,
|
|
8
|
-
min: t.union([t.number, NumberFromString]),
|
|
9
|
-
max: t.union([t.number, NumberFromString]),
|
|
10
|
-
step: t.union([t.number, NumberFromString]),
|
|
11
|
+
min: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
12
|
+
max: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
13
|
+
step: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
11
14
|
}));
|
|
12
15
|
const Number = t.exact(t.intersection([
|
|
13
16
|
t.type({
|
|
14
|
-
type: t.literal(
|
|
17
|
+
type: t.literal(WidgetTypes_1.default.Number),
|
|
15
18
|
}),
|
|
16
19
|
t.partial({
|
|
17
|
-
fieldset: StringOrNull,
|
|
20
|
+
fieldset: validators_1.StringOrNull,
|
|
18
21
|
config: NumberConfig,
|
|
19
22
|
}),
|
|
20
23
|
]));
|
|
21
|
-
|
|
24
|
+
exports.default = Number;
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
5
|
+
const NumberFromString_1 = require("io-ts-types/lib/NumberFromString");
|
|
6
|
+
const validators_1 = require("../../../validators");
|
|
7
|
+
const WidgetTypes_1 = (0, tslib_1.__importDefault)(require("../WidgetTypes"));
|
|
5
8
|
const RangeConfig = t.exact(t.partial({
|
|
6
|
-
label: StringOrNull,
|
|
9
|
+
label: validators_1.StringOrNull,
|
|
7
10
|
placeholder: t.string,
|
|
8
|
-
min: t.union([t.number, NumberFromString]),
|
|
9
|
-
max: t.union([t.number, NumberFromString]),
|
|
10
|
-
step: t.union([t.number, NumberFromString]),
|
|
11
|
+
min: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
12
|
+
max: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
13
|
+
step: t.union([t.number, NumberFromString_1.NumberFromString]),
|
|
11
14
|
}));
|
|
12
15
|
const Range = t.exact(t.intersection([
|
|
13
16
|
t.type({
|
|
14
|
-
type: t.literal(
|
|
17
|
+
type: t.literal(WidgetTypes_1.default.Range),
|
|
15
18
|
}),
|
|
16
19
|
t.partial({
|
|
17
|
-
fieldset: StringOrNull,
|
|
20
|
+
fieldset: validators_1.StringOrNull,
|
|
18
21
|
config: RangeConfig,
|
|
19
22
|
}),
|
|
20
23
|
]));
|
|
21
|
-
|
|
24
|
+
exports.default = Range;
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import WidgetTypes from "../WidgetTypes";
|
|
3
|
-
declare const
|
|
3
|
+
export declare const DEFAULT_OPTION = "paragraph";
|
|
4
|
+
export declare enum RichTextNodeType {
|
|
5
|
+
heading1 = "heading1",
|
|
6
|
+
heading2 = "heading2",
|
|
7
|
+
heading3 = "heading3",
|
|
8
|
+
heading4 = "heading4",
|
|
9
|
+
heading5 = "heading5",
|
|
10
|
+
heading6 = "heading6",
|
|
11
|
+
paragraph = "paragraph",
|
|
12
|
+
strong = "strong",
|
|
13
|
+
em = "em",
|
|
14
|
+
preformatted = "preformatted",
|
|
15
|
+
hyperlink = "hyperlink",
|
|
16
|
+
image = "image",
|
|
17
|
+
embed = "embed",
|
|
18
|
+
list = "list-item",
|
|
19
|
+
orderedList = "o-list-item",
|
|
20
|
+
rtl = "rtl"
|
|
21
|
+
}
|
|
22
|
+
export declare function parseRichTextNodeType(str: string): RichTextNodeType | undefined;
|
|
23
|
+
export declare const RichText: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
4
24
|
type: t.LiteralC<WidgetTypes.RichText>;
|
|
5
25
|
}>, t.PartialC<{
|
|
6
26
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -18,5 +38,4 @@ declare const RichText: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
18
38
|
allowTargetBlank: t.BooleanC;
|
|
19
39
|
}>>;
|
|
20
40
|
}>]>>;
|
|
21
|
-
declare type RichText = t.TypeOf<typeof RichText>;
|
|
22
|
-
export default RichText;
|
|
41
|
+
export declare type RichText = t.TypeOf<typeof RichText>;
|
|
@@ -1,35 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
];
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RichText = exports.parseRichTextNodeType = exports.RichTextNodeType = exports.DEFAULT_OPTION = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const Either_1 = require("fp-ts/lib/Either");
|
|
6
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
7
|
+
const validators_1 = require("../../../validators");
|
|
8
|
+
const ImageConstraint_1 = (0, tslib_1.__importDefault)(require("../shared/ImageConstraint"));
|
|
9
|
+
const WidgetTypes_1 = (0, tslib_1.__importDefault)(require("../WidgetTypes"));
|
|
10
|
+
exports.DEFAULT_OPTION = "paragraph";
|
|
11
|
+
var RichTextNodeType;
|
|
12
|
+
(function (RichTextNodeType) {
|
|
13
|
+
RichTextNodeType["heading1"] = "heading1";
|
|
14
|
+
RichTextNodeType["heading2"] = "heading2";
|
|
15
|
+
RichTextNodeType["heading3"] = "heading3";
|
|
16
|
+
RichTextNodeType["heading4"] = "heading4";
|
|
17
|
+
RichTextNodeType["heading5"] = "heading5";
|
|
18
|
+
RichTextNodeType["heading6"] = "heading6";
|
|
19
|
+
RichTextNodeType["paragraph"] = "paragraph";
|
|
20
|
+
RichTextNodeType["strong"] = "strong";
|
|
21
|
+
RichTextNodeType["em"] = "em";
|
|
22
|
+
RichTextNodeType["preformatted"] = "preformatted";
|
|
23
|
+
RichTextNodeType["hyperlink"] = "hyperlink";
|
|
24
|
+
RichTextNodeType["image"] = "image";
|
|
25
|
+
RichTextNodeType["embed"] = "embed";
|
|
26
|
+
RichTextNodeType["list"] = "list-item";
|
|
27
|
+
RichTextNodeType["orderedList"] = "o-list-item";
|
|
28
|
+
RichTextNodeType["rtl"] = "rtl";
|
|
29
|
+
})(RichTextNodeType = exports.RichTextNodeType || (exports.RichTextNodeType = {}));
|
|
30
|
+
function parseRichTextNodeType(str) {
|
|
31
|
+
switch (str) {
|
|
32
|
+
case RichTextNodeType.heading1:
|
|
33
|
+
return RichTextNodeType.heading1;
|
|
34
|
+
case RichTextNodeType.heading2:
|
|
35
|
+
return RichTextNodeType.heading2;
|
|
36
|
+
case RichTextNodeType.heading3:
|
|
37
|
+
return RichTextNodeType.heading3;
|
|
38
|
+
case RichTextNodeType.heading4:
|
|
39
|
+
return RichTextNodeType.heading4;
|
|
40
|
+
case RichTextNodeType.heading5:
|
|
41
|
+
return RichTextNodeType.heading5;
|
|
42
|
+
case RichTextNodeType.heading6:
|
|
43
|
+
return RichTextNodeType.heading6;
|
|
44
|
+
case RichTextNodeType.paragraph:
|
|
45
|
+
return RichTextNodeType.paragraph;
|
|
46
|
+
case RichTextNodeType.strong:
|
|
47
|
+
return RichTextNodeType.strong;
|
|
48
|
+
case RichTextNodeType.em:
|
|
49
|
+
return RichTextNodeType.em;
|
|
50
|
+
case RichTextNodeType.preformatted:
|
|
51
|
+
return RichTextNodeType.preformatted;
|
|
52
|
+
case RichTextNodeType.hyperlink:
|
|
53
|
+
return RichTextNodeType.hyperlink;
|
|
54
|
+
case RichTextNodeType.image:
|
|
55
|
+
return RichTextNodeType.image;
|
|
56
|
+
case RichTextNodeType.embed:
|
|
57
|
+
return RichTextNodeType.embed;
|
|
58
|
+
case RichTextNodeType.list:
|
|
59
|
+
return RichTextNodeType.list;
|
|
60
|
+
case RichTextNodeType.orderedList:
|
|
61
|
+
return RichTextNodeType.orderedList;
|
|
62
|
+
case RichTextNodeType.rtl:
|
|
63
|
+
return RichTextNodeType.rtl;
|
|
64
|
+
default:
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.parseRichTextNodeType = parseRichTextNodeType;
|
|
25
69
|
const RichTextOptions = new t.Type("RichTextOptions", (u) => typeof u === "string", (u, context) => {
|
|
26
|
-
return either.chain(t.union([t.string, t.null]).validate(u, context), (s) => {
|
|
70
|
+
return Either_1.either.chain(t.union([t.string, t.null]).validate(u, context), (s) => {
|
|
27
71
|
if (!s)
|
|
28
|
-
return t.success(DEFAULT_OPTION);
|
|
72
|
+
return t.success(exports.DEFAULT_OPTION);
|
|
29
73
|
const entries = s.split(",").map((e) => e.trim());
|
|
30
|
-
const filtered = entries.filter((entry) =>
|
|
74
|
+
const filtered = entries.filter((entry) => parseRichTextNodeType(entry));
|
|
31
75
|
if (!filtered.length)
|
|
32
|
-
return t.success(DEFAULT_OPTION);
|
|
76
|
+
return t.success(exports.DEFAULT_OPTION);
|
|
33
77
|
return t.success(filtered.join(","));
|
|
34
78
|
});
|
|
35
79
|
}, (a) => a);
|
|
@@ -76,7 +120,7 @@ const RichTextLabels = new t.Type("RichTextLabels", (u) => {
|
|
|
76
120
|
}, (u, context) => {
|
|
77
121
|
const legacyValidator = t.record(t.string, t.array(t.record(t.literal("name"), t.string)));
|
|
78
122
|
const validator = t.array(t.string);
|
|
79
|
-
return either.chain(t
|
|
123
|
+
return Either_1.either.chain(t
|
|
80
124
|
.union([legacyValidator, validator, t.string, t.null])
|
|
81
125
|
.validate(u, context), (labels) => {
|
|
82
126
|
return (NoLabels(labels) ||
|
|
@@ -87,22 +131,21 @@ const RichTextLabels = new t.Type("RichTextLabels", (u) => {
|
|
|
87
131
|
});
|
|
88
132
|
}, (res) => res);
|
|
89
133
|
const RichTextConfig = t.exact(t.partial({
|
|
90
|
-
label: StringOrNull,
|
|
134
|
+
label: validators_1.StringOrNull,
|
|
91
135
|
placeholder: t.string,
|
|
92
136
|
useAsTitle: t.boolean,
|
|
93
137
|
single: RichTextOptions,
|
|
94
138
|
multi: RichTextOptions,
|
|
95
|
-
imageConstraint:
|
|
139
|
+
imageConstraint: ImageConstraint_1.default,
|
|
96
140
|
labels: RichTextLabels,
|
|
97
141
|
allowTargetBlank: t.boolean,
|
|
98
142
|
}));
|
|
99
|
-
|
|
143
|
+
exports.RichText = t.exact(t.intersection([
|
|
100
144
|
t.type({
|
|
101
|
-
type: t.literal(
|
|
145
|
+
type: t.literal(WidgetTypes_1.default.RichText),
|
|
102
146
|
}),
|
|
103
147
|
t.partial({
|
|
104
|
-
fieldset: StringOrNull,
|
|
148
|
+
fieldset: validators_1.StringOrNull,
|
|
105
149
|
config: RichTextConfig,
|
|
106
150
|
}),
|
|
107
151
|
]));
|
|
108
|
-
export default RichText;
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
5
|
+
const validators_1 = require("../../../validators");
|
|
6
|
+
const WidgetTypes_1 = (0, tslib_1.__importDefault)(require("../WidgetTypes"));
|
|
4
7
|
const SelectConfig = t.exact(t.partial({
|
|
5
|
-
label: StringOrNull,
|
|
8
|
+
label: validators_1.StringOrNull,
|
|
6
9
|
placeholder: t.string,
|
|
7
10
|
default_value: t.string,
|
|
8
|
-
options: t.array(t.union([t.string, StringFromNumber, StringFromBoolean])),
|
|
11
|
+
options: t.array(t.union([t.string, validators_1.StringFromNumber, validators_1.StringFromBoolean])),
|
|
9
12
|
}));
|
|
10
13
|
const Select = t.exact(t.intersection([
|
|
11
14
|
t.type({
|
|
12
|
-
type: t.literal(
|
|
15
|
+
type: t.literal(WidgetTypes_1.default.Select),
|
|
13
16
|
}),
|
|
14
17
|
t.partial({
|
|
15
|
-
fieldset: StringOrNull,
|
|
18
|
+
fieldset: validators_1.StringOrNull,
|
|
16
19
|
config: SelectConfig,
|
|
17
20
|
}),
|
|
18
21
|
]));
|
|
19
|
-
|
|
22
|
+
exports.default = Select;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
5
|
+
const validators_1 = require("../../../validators");
|
|
6
|
+
const WidgetTypes_1 = (0, tslib_1.__importDefault)(require("../WidgetTypes"));
|
|
4
7
|
const SeparatorConfig = t.exact(t.partial({
|
|
5
|
-
label: StringOrNull,
|
|
8
|
+
label: validators_1.StringOrNull,
|
|
6
9
|
}));
|
|
7
10
|
const Separator = t.exact(t.intersection([
|
|
8
11
|
t.type({
|
|
9
|
-
type: t.literal(
|
|
12
|
+
type: t.literal(WidgetTypes_1.default.Separator),
|
|
10
13
|
}),
|
|
11
14
|
t.partial({
|
|
12
15
|
config: SeparatorConfig,
|
|
13
16
|
}),
|
|
14
17
|
]));
|
|
15
|
-
|
|
18
|
+
exports.default = Separator;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
5
|
+
const validators_1 = require("../../../validators");
|
|
6
|
+
const WidgetTypes_1 = (0, tslib_1.__importDefault)(require("../WidgetTypes"));
|
|
4
7
|
const TextConfig = t.exact(t.partial({
|
|
5
|
-
label: StringOrNull,
|
|
8
|
+
label: validators_1.StringOrNull,
|
|
6
9
|
useAsTitle: t.boolean,
|
|
7
10
|
placeholder: t.string,
|
|
8
11
|
}));
|
|
9
12
|
const Text = t.exact(t.intersection([
|
|
10
13
|
t.type({
|
|
11
|
-
type: t.literal(
|
|
14
|
+
type: t.literal(WidgetTypes_1.default.Text),
|
|
12
15
|
}),
|
|
13
16
|
t.partial({
|
|
14
|
-
fieldset: StringOrNull,
|
|
17
|
+
fieldset: validators_1.StringOrNull,
|
|
15
18
|
config: TextConfig,
|
|
16
19
|
}),
|
|
17
20
|
]));
|
|
18
|
-
|
|
21
|
+
exports.default = Text;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
5
|
+
const validators_1 = require("../../../validators");
|
|
6
|
+
const WidgetTypes_1 = (0, tslib_1.__importDefault)(require("../WidgetTypes"));
|
|
4
7
|
const TimestampConfig = t.exact(t.partial({
|
|
5
|
-
label: StringOrNull,
|
|
8
|
+
label: validators_1.StringOrNull,
|
|
6
9
|
placeholder: t.string,
|
|
7
10
|
default: t.string,
|
|
8
11
|
}));
|
|
9
12
|
const Timestamp = t.exact(t.intersection([
|
|
10
13
|
t.type({
|
|
11
|
-
type: t.literal(
|
|
14
|
+
type: t.literal(WidgetTypes_1.default.Timestamp),
|
|
12
15
|
}),
|
|
13
16
|
t.partial({
|
|
14
|
-
fieldset: StringOrNull,
|
|
17
|
+
fieldset: validators_1.StringOrNull,
|
|
15
18
|
config: TimestampConfig,
|
|
16
19
|
}),
|
|
17
20
|
]));
|
|
18
|
-
|
|
21
|
+
exports.default = Timestamp;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as BooleanField } from "./BooleanField";
|
|
2
2
|
export { default as Color } from "./Color";
|
|
3
3
|
export { default as Date } from "./Date";
|
|
4
|
+
export { default as Embed } from "./Embed";
|
|
4
5
|
export { default as GeoPoint } from "./GeoPoint";
|
|
5
6
|
export { default as Image } from "./Image";
|
|
6
7
|
export { default as IntegrationField } from "./IntegrationField";
|
|
@@ -8,7 +9,7 @@ export { default as Link } from "./Link";
|
|
|
8
9
|
export { default as NestableWidget } from "./NestableWidget";
|
|
9
10
|
export { default as Number } from "./Number";
|
|
10
11
|
export { default as Range } from "./Range";
|
|
11
|
-
export
|
|
12
|
+
export * from "./RichText";
|
|
12
13
|
export { default as Select } from "./Select";
|
|
13
14
|
export { default as Separator } from "./Separator";
|
|
14
15
|
export { default as Text } from "./Text";
|