@prismicio/types-internal 0.2.0 → 0.2.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/customtypes/CustomType.d.ts +2 -2
- package/lib/customtypes/CustomType.js +38 -56
- package/lib/customtypes/Format.js +2 -5
- package/lib/customtypes/Section.d.ts +1 -1
- package/lib/customtypes/Section.js +9 -32
- package/lib/customtypes/index.js +4 -30
- package/lib/customtypes/widgets/Group.js +9 -33
- package/lib/customtypes/widgets/UID.js +7 -31
- package/lib/customtypes/widgets/Widget.d.ts +1 -1
- package/lib/customtypes/widgets/Widget.js +14 -40
- package/lib/customtypes/widgets/WidgetTypes.js +1 -3
- package/lib/customtypes/widgets/index.js +7 -35
- package/lib/customtypes/widgets/nestable/BooleanField.js +6 -30
- package/lib/customtypes/widgets/nestable/Color.js +7 -31
- package/lib/customtypes/widgets/nestable/Date.js +7 -31
- package/lib/customtypes/widgets/nestable/Embed.js +7 -31
- package/lib/customtypes/widgets/nestable/GeoPoint.js +7 -31
- package/lib/customtypes/widgets/nestable/Image.js +10 -34
- package/lib/customtypes/widgets/nestable/IntegrationField.js +7 -31
- package/lib/customtypes/widgets/nestable/Link.js +13 -35
- package/lib/customtypes/widgets/nestable/NestableWidget.js +32 -56
- package/lib/customtypes/widgets/nestable/Number.js +11 -35
- package/lib/customtypes/widgets/nestable/Range.js +11 -35
- package/lib/customtypes/widgets/nestable/RichText.js +16 -36
- package/lib/customtypes/widgets/nestable/Select.js +8 -32
- package/lib/customtypes/widgets/nestable/Separator.js +6 -30
- package/lib/customtypes/widgets/nestable/Text.js +7 -31
- package/lib/customtypes/widgets/nestable/Timestamp.js +7 -31
- package/lib/customtypes/widgets/nestable/index.js +15 -36
- package/lib/customtypes/widgets/shared/ImageConstraint.js +9 -30
- package/lib/customtypes/widgets/shared/index.js +1 -8
- package/lib/customtypes/widgets/slices/CompositeSlice.js +10 -34
- package/lib/customtypes/widgets/slices/LegacySlice.js +6 -30
- package/lib/customtypes/widgets/slices/SharedSlice.js +9 -33
- package/lib/customtypes/widgets/slices/SharedSliceRef.js +4 -28
- package/lib/customtypes/widgets/slices/Slice.d.ts +4 -4
- package/lib/customtypes/widgets/slices/Slice.js +1 -2
- package/lib/customtypes/widgets/slices/Slices.js +27 -54
- package/lib/customtypes/widgets/slices/SlicesTypes.js +1 -3
- package/lib/customtypes/widgets/slices/index.js +7 -37
- package/lib/documents/DocumentData.js +4 -25
- package/lib/documents/index.js +2 -28
- package/lib/documents/widgets/EmptyContent.js +3 -6
- package/lib/documents/widgets/GroupContent.js +10 -32
- package/lib/documents/widgets/SimpleWidgetContent.d.ts +2 -2
- package/lib/documents/widgets/SimpleWidgetContent.js +27 -53
- package/lib/documents/widgets/StaticWidgetContent.js +8 -29
- package/lib/documents/widgets/UIDContent.js +4 -26
- package/lib/documents/widgets/index.js +22 -51
- package/lib/documents/widgets/nestable/BooleanContent.js +6 -28
- package/lib/documents/widgets/nestable/EmbedContent.d.ts +4 -4
- package/lib/documents/widgets/nestable/EmbedContent.js +20 -42
- package/lib/documents/widgets/nestable/FieldContent.js +8 -28
- package/lib/documents/widgets/nestable/GeoPointContent.js +5 -27
- package/lib/documents/widgets/nestable/ImageContent.d.ts +14 -14
- package/lib/documents/widgets/nestable/ImageContent.js +12 -34
- package/lib/documents/widgets/nestable/IntegrationFieldsContent.js +6 -28
- package/lib/documents/widgets/nestable/Link/DocumentLink.js +7 -30
- package/lib/documents/widgets/nestable/Link/ExternalLink.d.ts +4 -4
- package/lib/documents/widgets/nestable/Link/ExternalLink.js +10 -33
- package/lib/documents/widgets/nestable/Link/FileLink.js +10 -33
- package/lib/documents/widgets/nestable/Link/ImageLink.js +9 -32
- package/lib/documents/widgets/nestable/Link/LinkContent.d.ts +2 -2
- package/lib/documents/widgets/nestable/Link/LinkContent.js +9 -31
- package/lib/documents/widgets/nestable/Link/index.d.ts +8 -8
- package/lib/documents/widgets/nestable/Link/index.js +24 -51
- package/lib/documents/widgets/nestable/SeparatorContent.js +2 -5
- package/lib/documents/widgets/nestable/StructuredTextContent/Block.d.ts +8 -8
- package/lib/documents/widgets/nestable/StructuredTextContent/Block.js +33 -60
- package/lib/documents/widgets/nestable/StructuredTextContent/index.js +7 -29
- package/lib/documents/widgets/nestable/index.d.ts +2 -2
- package/lib/documents/widgets/nestable/index.js +28 -63
- package/lib/documents/widgets/slices/CompositeSliceContent.d.ts +1 -1
- package/lib/documents/widgets/slices/CompositeSliceContent.js +9 -31
- package/lib/documents/widgets/slices/SharedSliceContent.d.ts +1 -1
- package/lib/documents/widgets/slices/SharedSliceContent.js +12 -34
- package/lib/documents/widgets/slices/SimpleSliceContent.js +2 -8
- package/lib/documents/widgets/slices/SliceWidgetContent.d.ts +1 -1
- package/lib/documents/widgets/slices/SliceWidgetContent.js +8 -33
- package/lib/documents/widgets/slices/SlicesContent.js +13 -35
- package/lib/documents/widgets/slices/index.js +5 -17
- package/lib/index.js +3 -25
- package/lib/validators/DateFromString.js +4 -25
- package/lib/validators/DateFromStringOrNumber.js +4 -25
- package/lib/validators/DateFromTsMs.js +4 -25
- package/lib/validators/IntFromNumber.js +4 -25
- package/lib/validators/IntFromPixels.js +7 -29
- package/lib/validators/NonEmptyString.js +3 -24
- package/lib/validators/NonEmptyStringOrNull.js +7 -12
- package/lib/validators/NumberOrNull.js +3 -24
- package/lib/validators/StringFromBoolean.js +4 -25
- package/lib/validators/StringFromNumber.js +4 -25
- package/lib/validators/StringOrNull.js +3 -24
- package/lib/validators/function.js +17 -47
- package/lib/validators/index.js +12 -48
- package/package.json +1 -1
- package/lib/documents/widgets/Widget.d.ts +0 -0
- package/lib/documents/widgets/Widget.js +0 -1
|
@@ -1,32 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const Either_1 = require("fp-ts/lib/Either");
|
|
26
|
-
const t = __importStar(require("io-ts"));
|
|
27
|
-
const validators_1 = require("../../../validators");
|
|
28
|
-
const ImageConstraint_1 = __importDefault(require("../shared/ImageConstraint"));
|
|
29
|
-
const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
|
|
1
|
+
import { either } from "fp-ts/lib/Either";
|
|
2
|
+
import * as t from "io-ts";
|
|
3
|
+
import { StringOrNull } from "../../../validators";
|
|
4
|
+
import ImageConstraint from "../shared/ImageConstraint";
|
|
5
|
+
import WidgetTypes from "../WidgetTypes";
|
|
30
6
|
const DEFAULT_OPTION = "paragraph";
|
|
31
7
|
const options = [
|
|
32
8
|
"heading1",
|
|
@@ -47,7 +23,7 @@ const options = [
|
|
|
47
23
|
"rtl",
|
|
48
24
|
];
|
|
49
25
|
const RichTextOptions = new t.Type("RichTextOptions", (u) => typeof u === "string", (u, context) => {
|
|
50
|
-
return
|
|
26
|
+
return either.chain(t.union([t.string, t.null]).validate(u, context), (s) => {
|
|
51
27
|
if (!s)
|
|
52
28
|
return t.success(DEFAULT_OPTION);
|
|
53
29
|
const entries = s.split(",").map((e) => e.trim());
|
|
@@ -60,6 +36,7 @@ const RichTextOptions = new t.Type("RichTextOptions", (u) => typeof u === "strin
|
|
|
60
36
|
const NoLabels = (labels) => {
|
|
61
37
|
if (!labels)
|
|
62
38
|
return t.success([]);
|
|
39
|
+
return;
|
|
63
40
|
};
|
|
64
41
|
const LabelsAsObject = (labels) => {
|
|
65
42
|
if (labels instanceof Object) {
|
|
@@ -78,6 +55,7 @@ const LabelsAsObject = (labels) => {
|
|
|
78
55
|
.filter(Boolean);
|
|
79
56
|
return t.success(convertedObjectToArray);
|
|
80
57
|
}
|
|
58
|
+
return;
|
|
81
59
|
};
|
|
82
60
|
const LabelsAsArray = (labels) => {
|
|
83
61
|
if (labels instanceof Array) {
|
|
@@ -85,18 +63,20 @@ const LabelsAsArray = (labels) => {
|
|
|
85
63
|
if (isValidLabels)
|
|
86
64
|
return t.success(labels);
|
|
87
65
|
}
|
|
66
|
+
return;
|
|
88
67
|
};
|
|
89
68
|
const LabelsAsString = (labels) => {
|
|
90
69
|
if (typeof labels === "string") {
|
|
91
70
|
return t.success([labels]);
|
|
92
71
|
}
|
|
72
|
+
return;
|
|
93
73
|
};
|
|
94
74
|
const RichTextLabels = new t.Type("RichTextLabels", (u) => {
|
|
95
75
|
return u instanceof Array;
|
|
96
76
|
}, (u, context) => {
|
|
97
77
|
const legacyValidator = t.record(t.string, t.array(t.record(t.literal("name"), t.string)));
|
|
98
78
|
const validator = t.array(t.string);
|
|
99
|
-
return
|
|
79
|
+
return either.chain(t
|
|
100
80
|
.union([legacyValidator, validator, t.string, t.null])
|
|
101
81
|
.validate(u, context), (labels) => {
|
|
102
82
|
return (NoLabels(labels) ||
|
|
@@ -107,22 +87,22 @@ const RichTextLabels = new t.Type("RichTextLabels", (u) => {
|
|
|
107
87
|
});
|
|
108
88
|
}, (res) => res);
|
|
109
89
|
const RichTextConfig = t.exact(t.partial({
|
|
110
|
-
label:
|
|
90
|
+
label: StringOrNull,
|
|
111
91
|
placeholder: t.string,
|
|
112
92
|
useAsTitle: t.boolean,
|
|
113
93
|
single: RichTextOptions,
|
|
114
94
|
multi: RichTextOptions,
|
|
115
|
-
imageConstraint:
|
|
95
|
+
imageConstraint: ImageConstraint,
|
|
116
96
|
labels: RichTextLabels,
|
|
117
97
|
allowTargetBlank: t.boolean,
|
|
118
98
|
}));
|
|
119
99
|
const RichText = t.exact(t.intersection([
|
|
120
100
|
t.type({
|
|
121
|
-
type: t.literal(
|
|
101
|
+
type: t.literal(WidgetTypes.RichText),
|
|
122
102
|
}),
|
|
123
103
|
t.partial({
|
|
124
|
-
fieldset:
|
|
104
|
+
fieldset: StringOrNull,
|
|
125
105
|
config: RichTextConfig,
|
|
126
106
|
}),
|
|
127
107
|
]));
|
|
128
|
-
|
|
108
|
+
export default RichText;
|
|
@@ -1,43 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const t = __importStar(require("io-ts"));
|
|
26
|
-
const validators_1 = require("../../../validators");
|
|
27
|
-
const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import { StringFromBoolean, StringFromNumber, StringOrNull, } from "../../../validators";
|
|
3
|
+
import WidgetTypes from "../WidgetTypes";
|
|
28
4
|
const SelectConfig = t.exact(t.partial({
|
|
29
|
-
label:
|
|
5
|
+
label: StringOrNull,
|
|
30
6
|
placeholder: t.string,
|
|
31
7
|
default_value: t.string,
|
|
32
|
-
options: t.array(t.union([t.string,
|
|
8
|
+
options: t.array(t.union([t.string, StringFromNumber, StringFromBoolean])),
|
|
33
9
|
}));
|
|
34
10
|
const Select = t.exact(t.intersection([
|
|
35
11
|
t.type({
|
|
36
|
-
type: t.literal(
|
|
12
|
+
type: t.literal(WidgetTypes.Select),
|
|
37
13
|
}),
|
|
38
14
|
t.partial({
|
|
39
|
-
fieldset:
|
|
15
|
+
fieldset: StringOrNull,
|
|
40
16
|
config: SelectConfig,
|
|
41
17
|
}),
|
|
42
18
|
]));
|
|
43
|
-
|
|
19
|
+
export default Select;
|
|
@@ -1,39 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const t = __importStar(require("io-ts"));
|
|
26
|
-
const validators_1 = require("../../../validators");
|
|
27
|
-
const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import { StringOrNull } from "../../../validators";
|
|
3
|
+
import WidgetTypes from "../WidgetTypes";
|
|
28
4
|
const SeparatorConfig = t.exact(t.partial({
|
|
29
|
-
label:
|
|
5
|
+
label: StringOrNull,
|
|
30
6
|
}));
|
|
31
7
|
const Separator = t.exact(t.intersection([
|
|
32
8
|
t.type({
|
|
33
|
-
type: t.literal(
|
|
9
|
+
type: t.literal(WidgetTypes.Separator),
|
|
34
10
|
}),
|
|
35
11
|
t.partial({
|
|
36
12
|
config: SeparatorConfig,
|
|
37
13
|
}),
|
|
38
14
|
]));
|
|
39
|
-
|
|
15
|
+
export default Separator;
|
|
@@ -1,42 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const t = __importStar(require("io-ts"));
|
|
26
|
-
const validators_1 = require("../../../validators");
|
|
27
|
-
const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import { StringOrNull } from "../../../validators";
|
|
3
|
+
import WidgetTypes from "../WidgetTypes";
|
|
28
4
|
const TextConfig = t.exact(t.partial({
|
|
29
|
-
label:
|
|
5
|
+
label: StringOrNull,
|
|
30
6
|
useAsTitle: t.boolean,
|
|
31
7
|
placeholder: t.string,
|
|
32
8
|
}));
|
|
33
9
|
const Text = t.exact(t.intersection([
|
|
34
10
|
t.type({
|
|
35
|
-
type: t.literal(
|
|
11
|
+
type: t.literal(WidgetTypes.Text),
|
|
36
12
|
}),
|
|
37
13
|
t.partial({
|
|
38
|
-
fieldset:
|
|
14
|
+
fieldset: StringOrNull,
|
|
39
15
|
config: TextConfig,
|
|
40
16
|
}),
|
|
41
17
|
]));
|
|
42
|
-
|
|
18
|
+
export default Text;
|
|
@@ -1,42 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const t = __importStar(require("io-ts"));
|
|
26
|
-
const validators_1 = require("../../../validators");
|
|
27
|
-
const WidgetTypes_1 = __importDefault(require("../WidgetTypes"));
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import { StringOrNull } from "../../../validators";
|
|
3
|
+
import WidgetTypes from "../WidgetTypes";
|
|
28
4
|
const TimestampConfig = t.exact(t.partial({
|
|
29
|
-
label:
|
|
5
|
+
label: StringOrNull,
|
|
30
6
|
placeholder: t.string,
|
|
31
7
|
default: t.string,
|
|
32
8
|
}));
|
|
33
9
|
const Timestamp = t.exact(t.intersection([
|
|
34
10
|
t.type({
|
|
35
|
-
type: t.literal(
|
|
11
|
+
type: t.literal(WidgetTypes.Timestamp),
|
|
36
12
|
}),
|
|
37
13
|
t.partial({
|
|
38
|
-
fieldset:
|
|
14
|
+
fieldset: StringOrNull,
|
|
39
15
|
config: TimestampConfig,
|
|
40
16
|
}),
|
|
41
17
|
]));
|
|
42
|
-
|
|
18
|
+
export default Timestamp;
|
|
@@ -1,36 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return __importDefault(Image_1).default; } });
|
|
17
|
-
var IntegrationField_1 = require("./IntegrationField");
|
|
18
|
-
Object.defineProperty(exports, "IntegrationField", { enumerable: true, get: function () { return __importDefault(IntegrationField_1).default; } });
|
|
19
|
-
var Link_1 = require("./Link");
|
|
20
|
-
Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return __importDefault(Link_1).default; } });
|
|
21
|
-
var NestableWidget_1 = require("./NestableWidget");
|
|
22
|
-
Object.defineProperty(exports, "NestableWidget", { enumerable: true, get: function () { return __importDefault(NestableWidget_1).default; } });
|
|
23
|
-
var Number_1 = require("./Number");
|
|
24
|
-
Object.defineProperty(exports, "Number", { enumerable: true, get: function () { return __importDefault(Number_1).default; } });
|
|
25
|
-
var Range_1 = require("./Range");
|
|
26
|
-
Object.defineProperty(exports, "Range", { enumerable: true, get: function () { return __importDefault(Range_1).default; } });
|
|
27
|
-
var RichText_1 = require("./RichText");
|
|
28
|
-
Object.defineProperty(exports, "RichText", { enumerable: true, get: function () { return __importDefault(RichText_1).default; } });
|
|
29
|
-
var Select_1 = require("./Select");
|
|
30
|
-
Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return __importDefault(Select_1).default; } });
|
|
31
|
-
var Separator_1 = require("./Separator");
|
|
32
|
-
Object.defineProperty(exports, "Separator", { enumerable: true, get: function () { return __importDefault(Separator_1).default; } });
|
|
33
|
-
var Text_1 = require("./Text");
|
|
34
|
-
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return __importDefault(Text_1).default; } });
|
|
35
|
-
var Timestamp_1 = require("./Timestamp");
|
|
36
|
-
Object.defineProperty(exports, "Timestamp", { enumerable: true, get: function () { return __importDefault(Timestamp_1).default; } });
|
|
1
|
+
export { default as BooleanField } from "./BooleanField";
|
|
2
|
+
export { default as Color } from "./Color";
|
|
3
|
+
export { default as Date } from "./Date";
|
|
4
|
+
export { default as GeoPoint } from "./GeoPoint";
|
|
5
|
+
export { default as Image } from "./Image";
|
|
6
|
+
export { default as IntegrationField } from "./IntegrationField";
|
|
7
|
+
export { default as Link } from "./Link";
|
|
8
|
+
export { default as NestableWidget } from "./NestableWidget";
|
|
9
|
+
export { default as Number } from "./Number";
|
|
10
|
+
export { default as Range } from "./Range";
|
|
11
|
+
export { default as RichText } from "./RichText";
|
|
12
|
+
export { default as Select } from "./Select";
|
|
13
|
+
export { default as Separator } from "./Separator";
|
|
14
|
+
export { default as Text } from "./Text";
|
|
15
|
+
export { default as Timestamp } from "./Timestamp";
|
|
@@ -1,39 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
const Either_1 = require("fp-ts/lib/Either");
|
|
23
|
-
const t = __importStar(require("io-ts"));
|
|
24
|
-
const IntFromString_1 = require("io-ts-types/lib/IntFromString");
|
|
25
|
-
const validators_1 = require("../../../validators");
|
|
1
|
+
import { either } from "fp-ts/lib/Either";
|
|
2
|
+
import * as t from "io-ts";
|
|
3
|
+
import { IntFromString } from "io-ts-types/lib/IntFromString";
|
|
4
|
+
import { IntFromNumber, IntFromPixels } from "../../../validators";
|
|
26
5
|
const SideConstraint = new t.Type("SideConstraints", (u) => {
|
|
27
6
|
return !u || typeof u === "number";
|
|
28
7
|
}, (u, context) => {
|
|
29
|
-
return
|
|
8
|
+
return either.chain(t
|
|
30
9
|
.union([
|
|
31
10
|
t.literal("auto"),
|
|
32
11
|
t.literal(""),
|
|
33
12
|
t.Int,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
13
|
+
IntFromString,
|
|
14
|
+
IntFromNumber,
|
|
15
|
+
IntFromPixels,
|
|
37
16
|
t.null,
|
|
38
17
|
])
|
|
39
18
|
.validate(u, context), (constraint) => {
|
|
@@ -46,4 +25,4 @@ const ImageConstraint = t.partial({
|
|
|
46
25
|
width: SideConstraint,
|
|
47
26
|
height: SideConstraint,
|
|
48
27
|
});
|
|
49
|
-
|
|
28
|
+
export default ImageConstraint;
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ImageConstraint = void 0;
|
|
7
|
-
var ImageConstraint_1 = require("./ImageConstraint");
|
|
8
|
-
Object.defineProperty(exports, "ImageConstraint", { enumerable: true, get: function () { return __importDefault(ImageConstraint_1).default; } });
|
|
1
|
+
export { default as ImageConstraint } from "./ImageConstraint";
|
|
@@ -1,46 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const t = __importStar(require("io-ts"));
|
|
26
|
-
const validators_1 = require("../../../validators");
|
|
27
|
-
const NestableWidget_1 = __importDefault(require("../nestable/NestableWidget"));
|
|
28
|
-
const SlicesTypes_1 = __importDefault(require("./SlicesTypes"));
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import { StringOrNull } from "../../../validators";
|
|
3
|
+
import NestableWidget from "../nestable/NestableWidget";
|
|
4
|
+
import SlicesTypes from "./SlicesTypes";
|
|
29
5
|
const CompositeSliceConfig = t.exact(t.partial({
|
|
30
|
-
label:
|
|
6
|
+
label: StringOrNull,
|
|
31
7
|
}));
|
|
32
8
|
const CompositeSlice = t.exact(t.intersection([
|
|
33
9
|
t.type({
|
|
34
|
-
type: t.literal(
|
|
10
|
+
type: t.literal(SlicesTypes.Slice),
|
|
35
11
|
}),
|
|
36
12
|
t.partial({
|
|
37
|
-
fieldset:
|
|
13
|
+
fieldset: StringOrNull,
|
|
38
14
|
description: t.string,
|
|
39
15
|
icon: t.string,
|
|
40
16
|
display: t.string,
|
|
41
|
-
"non-repeat": t.record(t.string,
|
|
42
|
-
repeat: t.record(t.string,
|
|
17
|
+
"non-repeat": t.record(t.string, NestableWidget),
|
|
18
|
+
repeat: t.record(t.string, NestableWidget),
|
|
43
19
|
config: CompositeSliceConfig,
|
|
44
20
|
}),
|
|
45
21
|
]));
|
|
46
|
-
|
|
22
|
+
export default CompositeSlice;
|
|
@@ -1,30 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const t = __importStar(require("io-ts"));
|
|
26
|
-
const Group_1 = __importDefault(require("../Group"));
|
|
27
|
-
const NestableWidget_1 = __importDefault(require("../nestable/NestableWidget"));
|
|
28
|
-
const UID_1 = __importDefault(require("../UID"));
|
|
29
|
-
const LegacySlice = t.union([UID_1.default, NestableWidget_1.default, Group_1.default]);
|
|
30
|
-
exports.default = LegacySlice;
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import Group from "../Group";
|
|
3
|
+
import NestableWidget from "../nestable/NestableWidget";
|
|
4
|
+
import UID from "../UID";
|
|
5
|
+
const LegacySlice = t.union([UID, NestableWidget, Group]);
|
|
6
|
+
export default LegacySlice;
|
|
@@ -1,51 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const t = __importStar(require("io-ts"));
|
|
26
|
-
const withFallback_1 = require("io-ts-types/lib/withFallback");
|
|
27
|
-
const NestableWidget_1 = __importDefault(require("../nestable/NestableWidget"));
|
|
28
|
-
const SlicesTypes_1 = __importDefault(require("./SlicesTypes"));
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import { withFallback } from "io-ts-types/lib/withFallback";
|
|
3
|
+
import NestableWidget from "../nestable/NestableWidget";
|
|
4
|
+
import SlicesTypes from "./SlicesTypes";
|
|
29
5
|
const IMAGE_PLACEHOLDER_URL = "https://images.prismic.io/slice-machine/621a5ec4-0387-4bc5-9860-2dd46cbc07cd_default_ss.png?auto=compress,format";
|
|
30
6
|
const Variation = t.exact(t.intersection([
|
|
31
7
|
t.type({
|
|
32
8
|
id: t.string,
|
|
33
9
|
name: t.string,
|
|
34
10
|
description: t.string,
|
|
35
|
-
imageUrl:
|
|
11
|
+
imageUrl: withFallback(t.string, IMAGE_PLACEHOLDER_URL),
|
|
36
12
|
docURL: t.string,
|
|
37
13
|
version: t.string,
|
|
38
14
|
}),
|
|
39
15
|
t.partial({
|
|
40
16
|
display: t.string,
|
|
41
|
-
primary: t.record(t.string,
|
|
42
|
-
items: t.record(t.string,
|
|
17
|
+
primary: t.record(t.string, NestableWidget),
|
|
18
|
+
items: t.record(t.string, NestableWidget),
|
|
43
19
|
}),
|
|
44
20
|
]));
|
|
45
21
|
const SharedSlice = t.exact(t.intersection([
|
|
46
22
|
t.type({
|
|
47
23
|
id: t.string,
|
|
48
|
-
type: t.literal(
|
|
24
|
+
type: t.literal(SlicesTypes.SharedSlice),
|
|
49
25
|
name: t.string,
|
|
50
26
|
variations: t.array(Variation),
|
|
51
27
|
}),
|
|
@@ -53,4 +29,4 @@ const SharedSlice = t.exact(t.intersection([
|
|
|
53
29
|
description: t.string,
|
|
54
30
|
}),
|
|
55
31
|
]));
|
|
56
|
-
|
|
32
|
+
export default SharedSlice;
|
|
@@ -1,30 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const t = __importStar(require("io-ts"));
|
|
26
|
-
const SlicesTypes_1 = __importDefault(require("./SlicesTypes"));
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import SlicesTypes from "./SlicesTypes";
|
|
27
3
|
const SharedSliceRef = t.exact(t.type({
|
|
28
|
-
type: t.literal(
|
|
4
|
+
type: t.literal(SlicesTypes.SharedSlice),
|
|
29
5
|
}));
|
|
30
|
-
|
|
6
|
+
export default SharedSliceRef;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import CompositeSlice from "./CompositeSlice";
|
|
2
|
-
import LegacySlice from "./LegacySlice";
|
|
3
|
-
import SharedSlice from "./SharedSlice";
|
|
4
|
-
import SharedSliceRef from "./SharedSliceRef";
|
|
1
|
+
import type CompositeSlice from "./CompositeSlice";
|
|
2
|
+
import type LegacySlice from "./LegacySlice";
|
|
3
|
+
import type SharedSlice from "./SharedSlice";
|
|
4
|
+
import type SharedSliceRef from "./SharedSliceRef";
|
|
5
5
|
export declare type DynamicSlice = CompositeSlice | LegacySlice | SharedSliceRef;
|
|
6
6
|
export declare type StaticSlice = CompositeSlice | LegacySlice | SharedSlice;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|