@prismicio/types-internal 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/lib/customtypes/CustomType.d.ts +14 -14
- package/lib/customtypes/Section.d.ts +17 -17
- package/lib/customtypes/Section.js +2 -1
- package/lib/customtypes/widgets/Group.d.ts +1 -1
- package/lib/customtypes/widgets/Group.js +2 -1
- package/lib/customtypes/widgets/Widget.d.ts +13 -13
- package/lib/customtypes/widgets/slices/CompositeSlice.d.ts +2 -2
- package/lib/customtypes/widgets/slices/CompositeSlice.js +3 -2
- package/lib/customtypes/widgets/slices/LegacySlice.d.ts +1 -1
- package/lib/customtypes/widgets/slices/SharedSlice.d.ts +4 -4
- package/lib/customtypes/widgets/slices/SharedSlice.js +3 -2
- package/lib/customtypes/widgets/slices/Slices.d.ts +24 -24
- package/lib/customtypes/widgets/slices/Slices.js +2 -1
- package/lib/documents/widgets/index.d.ts +3 -1
- package/lib/documents/widgets/index.js +5 -1
- package/package.json +1 -1
- package/src/customtypes/Section.ts +2 -1
- package/src/customtypes/widgets/Group.ts +2 -1
- package/src/customtypes/widgets/slices/CompositeSlice.ts +3 -2
- package/src/customtypes/widgets/slices/SharedSlice.ts +3 -2
- package/src/customtypes/widgets/slices/Slices.ts +2 -1
- package/src/documents/widgets/index.ts +10 -1
- package/lib/customtypes/Format.d.ts +0 -4
- package/lib/customtypes/Format.js +0 -8
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
### [0.3.1](https://github.com/prismicio/prismic-types-internal/compare/v0.3.1-beta.0...v0.3.1) (2022-07-06)
|
|
6
|
+
|
|
7
|
+
### [0.3.1-beta.0](https://github.com/prismicio/prismic-types-internal/compare/v0.3.0...v0.3.1-beta.0) (2022-06-23)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* test StructuredTextContent ([62405b5](https://github.com/prismicio/prismic-types-internal/commit/62405b538e7db959f79fa6933129bb7f9ca008e1))
|
|
13
|
+
* validate widget id format ([fe0fbec](https://github.com/prismicio/prismic-types-internal/commit/fe0fbec5287178b9d7ae5f97c4b4c3edbf364c21))
|
|
@@ -90,7 +90,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
90
90
|
label?: string | null | undefined;
|
|
91
91
|
useAsTitle?: boolean;
|
|
92
92
|
placeholder?: string;
|
|
93
|
-
select?: "
|
|
93
|
+
select?: "web" | "media" | "document" | null;
|
|
94
94
|
customtypes?: readonly string[];
|
|
95
95
|
masks?: readonly string[];
|
|
96
96
|
tags?: readonly string[];
|
|
@@ -256,7 +256,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
256
256
|
label?: string | null | undefined;
|
|
257
257
|
useAsTitle?: boolean;
|
|
258
258
|
placeholder?: string;
|
|
259
|
-
select?: "
|
|
259
|
+
select?: "web" | "media" | "document" | null;
|
|
260
260
|
customtypes?: readonly string[];
|
|
261
261
|
masks?: readonly string[];
|
|
262
262
|
tags?: readonly string[];
|
|
@@ -429,7 +429,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
429
429
|
label?: string | null | undefined;
|
|
430
430
|
useAsTitle?: boolean;
|
|
431
431
|
placeholder?: string;
|
|
432
|
-
select?: "
|
|
432
|
+
select?: "web" | "media" | "document" | null;
|
|
433
433
|
customtypes?: readonly string[];
|
|
434
434
|
masks?: readonly string[];
|
|
435
435
|
tags?: readonly string[];
|
|
@@ -593,7 +593,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
593
593
|
label?: string | null | undefined;
|
|
594
594
|
useAsTitle?: boolean;
|
|
595
595
|
placeholder?: string;
|
|
596
|
-
select?: "
|
|
596
|
+
select?: "web" | "media" | "document" | null;
|
|
597
597
|
customtypes?: readonly string[];
|
|
598
598
|
masks?: readonly string[];
|
|
599
599
|
tags?: readonly string[];
|
|
@@ -752,7 +752,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
752
752
|
label?: string | null | undefined;
|
|
753
753
|
useAsTitle?: boolean;
|
|
754
754
|
placeholder?: string;
|
|
755
|
-
select?: "
|
|
755
|
+
select?: "web" | "media" | "document" | null;
|
|
756
756
|
customtypes?: readonly string[];
|
|
757
757
|
masks?: readonly string[];
|
|
758
758
|
tags?: readonly string[];
|
|
@@ -923,7 +923,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
923
923
|
label?: string | null | undefined;
|
|
924
924
|
useAsTitle?: boolean;
|
|
925
925
|
placeholder?: string;
|
|
926
|
-
select?: "
|
|
926
|
+
select?: "web" | "media" | "document" | null;
|
|
927
927
|
customtypes?: readonly string[];
|
|
928
928
|
masks?: readonly string[];
|
|
929
929
|
tags?: readonly string[];
|
|
@@ -1096,7 +1096,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
1096
1096
|
label?: string | null | undefined;
|
|
1097
1097
|
useAsTitle?: boolean;
|
|
1098
1098
|
placeholder?: string;
|
|
1099
|
-
select?: "
|
|
1099
|
+
select?: "web" | "media" | "document" | null;
|
|
1100
1100
|
customtypes?: readonly string[];
|
|
1101
1101
|
masks?: readonly string[];
|
|
1102
1102
|
tags?: readonly string[];
|
|
@@ -1255,7 +1255,7 @@ export declare const StaticCustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
1255
1255
|
label?: string | null | undefined;
|
|
1256
1256
|
useAsTitle?: boolean;
|
|
1257
1257
|
placeholder?: string;
|
|
1258
|
-
select?: "
|
|
1258
|
+
select?: "web" | "media" | "document" | null;
|
|
1259
1259
|
customtypes?: readonly string[];
|
|
1260
1260
|
masks?: readonly string[];
|
|
1261
1261
|
tags?: readonly string[];
|
|
@@ -1440,7 +1440,7 @@ export declare const CustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
1440
1440
|
label?: string | null | undefined;
|
|
1441
1441
|
useAsTitle?: boolean;
|
|
1442
1442
|
placeholder?: string;
|
|
1443
|
-
select?: "
|
|
1443
|
+
select?: "web" | "media" | "document" | null;
|
|
1444
1444
|
customtypes?: readonly string[];
|
|
1445
1445
|
masks?: readonly string[];
|
|
1446
1446
|
tags?: readonly string[];
|
|
@@ -1606,7 +1606,7 @@ export declare const CustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
1606
1606
|
label?: string | null | undefined;
|
|
1607
1607
|
useAsTitle?: boolean;
|
|
1608
1608
|
placeholder?: string;
|
|
1609
|
-
select?: "
|
|
1609
|
+
select?: "web" | "media" | "document" | null;
|
|
1610
1610
|
customtypes?: readonly string[];
|
|
1611
1611
|
masks?: readonly string[];
|
|
1612
1612
|
tags?: readonly string[];
|
|
@@ -1779,7 +1779,7 @@ export declare const CustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
1779
1779
|
label?: string | null | undefined;
|
|
1780
1780
|
useAsTitle?: boolean;
|
|
1781
1781
|
placeholder?: string;
|
|
1782
|
-
select?: "
|
|
1782
|
+
select?: "web" | "media" | "document" | null;
|
|
1783
1783
|
customtypes?: readonly string[];
|
|
1784
1784
|
masks?: readonly string[];
|
|
1785
1785
|
tags?: readonly string[];
|
|
@@ -1943,7 +1943,7 @@ export declare const CustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
1943
1943
|
label?: string | null | undefined;
|
|
1944
1944
|
useAsTitle?: boolean;
|
|
1945
1945
|
placeholder?: string;
|
|
1946
|
-
select?: "
|
|
1946
|
+
select?: "web" | "media" | "document" | null;
|
|
1947
1947
|
customtypes?: readonly string[];
|
|
1948
1948
|
masks?: readonly string[];
|
|
1949
1949
|
tags?: readonly string[];
|
|
@@ -2102,7 +2102,7 @@ export declare const CustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
2102
2102
|
label?: string | null | undefined;
|
|
2103
2103
|
useAsTitle?: boolean;
|
|
2104
2104
|
placeholder?: string;
|
|
2105
|
-
select?: "
|
|
2105
|
+
select?: "web" | "media" | "document" | null;
|
|
2106
2106
|
customtypes?: readonly string[];
|
|
2107
2107
|
masks?: readonly string[];
|
|
2108
2108
|
tags?: readonly string[];
|
|
@@ -2273,7 +2273,7 @@ export declare const CustomType: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
2273
2273
|
label?: string | null | undefined;
|
|
2274
2274
|
useAsTitle?: boolean;
|
|
2275
2275
|
placeholder?: string;
|
|
2276
|
-
select?: "
|
|
2276
|
+
select?: "web" | "media" | "document" | null;
|
|
2277
2277
|
customtypes?: readonly string[];
|
|
2278
2278
|
masks?: readonly string[];
|
|
2279
2279
|
tags?: readonly string[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import type { SharedSlice } from "./widgets/slices";
|
|
3
3
|
import { DynamicWidget, StaticWidget } from "./widgets/Widget";
|
|
4
|
-
export declare function sectionReader<T extends StaticWidget | DynamicWidget>(codec: t.Type<T, unknown>): t.RecordC<t.
|
|
5
|
-
export declare const StaticSection: t.RecordC<t.
|
|
4
|
+
export declare function sectionReader<T extends StaticWidget | DynamicWidget>(codec: t.Type<T, unknown>): t.RecordC<t.Type<string, string, unknown>, t.Type<T, unknown, unknown>>;
|
|
5
|
+
export declare const StaticSection: t.RecordC<t.Type<string, string, unknown>, t.Type<({
|
|
6
6
|
type: "Boolean";
|
|
7
7
|
} & {
|
|
8
8
|
config?: {
|
|
@@ -79,7 +79,7 @@ export declare const StaticSection: t.RecordC<t.StringC, t.Type<({
|
|
|
79
79
|
label?: string | null | undefined;
|
|
80
80
|
useAsTitle?: boolean;
|
|
81
81
|
placeholder?: string;
|
|
82
|
-
select?: "
|
|
82
|
+
select?: "web" | "media" | "document" | null;
|
|
83
83
|
customtypes?: readonly string[];
|
|
84
84
|
masks?: readonly string[];
|
|
85
85
|
tags?: readonly string[];
|
|
@@ -245,7 +245,7 @@ export declare const StaticSection: t.RecordC<t.StringC, t.Type<({
|
|
|
245
245
|
label?: string | null | undefined;
|
|
246
246
|
useAsTitle?: boolean;
|
|
247
247
|
placeholder?: string;
|
|
248
|
-
select?: "
|
|
248
|
+
select?: "web" | "media" | "document" | null;
|
|
249
249
|
customtypes?: readonly string[];
|
|
250
250
|
masks?: readonly string[];
|
|
251
251
|
tags?: readonly string[];
|
|
@@ -418,7 +418,7 @@ export declare const StaticSection: t.RecordC<t.StringC, t.Type<({
|
|
|
418
418
|
label?: string | null | undefined;
|
|
419
419
|
useAsTitle?: boolean;
|
|
420
420
|
placeholder?: string;
|
|
421
|
-
select?: "
|
|
421
|
+
select?: "web" | "media" | "document" | null;
|
|
422
422
|
customtypes?: readonly string[];
|
|
423
423
|
masks?: readonly string[];
|
|
424
424
|
tags?: readonly string[];
|
|
@@ -582,7 +582,7 @@ export declare const StaticSection: t.RecordC<t.StringC, t.Type<({
|
|
|
582
582
|
label?: string | null | undefined;
|
|
583
583
|
useAsTitle?: boolean;
|
|
584
584
|
placeholder?: string;
|
|
585
|
-
select?: "
|
|
585
|
+
select?: "web" | "media" | "document" | null;
|
|
586
586
|
customtypes?: readonly string[];
|
|
587
587
|
masks?: readonly string[];
|
|
588
588
|
tags?: readonly string[];
|
|
@@ -741,7 +741,7 @@ export declare const StaticSection: t.RecordC<t.StringC, t.Type<({
|
|
|
741
741
|
label?: string | null | undefined;
|
|
742
742
|
useAsTitle?: boolean;
|
|
743
743
|
placeholder?: string;
|
|
744
|
-
select?: "
|
|
744
|
+
select?: "web" | "media" | "document" | null;
|
|
745
745
|
customtypes?: readonly string[];
|
|
746
746
|
masks?: readonly string[];
|
|
747
747
|
tags?: readonly string[];
|
|
@@ -912,7 +912,7 @@ export declare const StaticSection: t.RecordC<t.StringC, t.Type<({
|
|
|
912
912
|
label?: string | null | undefined;
|
|
913
913
|
useAsTitle?: boolean;
|
|
914
914
|
placeholder?: string;
|
|
915
|
-
select?: "
|
|
915
|
+
select?: "web" | "media" | "document" | null;
|
|
916
916
|
customtypes?: readonly string[];
|
|
917
917
|
masks?: readonly string[];
|
|
918
918
|
tags?: readonly string[];
|
|
@@ -1085,7 +1085,7 @@ export declare const StaticSection: t.RecordC<t.StringC, t.Type<({
|
|
|
1085
1085
|
label?: string | null | undefined;
|
|
1086
1086
|
useAsTitle?: boolean;
|
|
1087
1087
|
placeholder?: string;
|
|
1088
|
-
select?: "
|
|
1088
|
+
select?: "web" | "media" | "document" | null;
|
|
1089
1089
|
customtypes?: readonly string[];
|
|
1090
1090
|
masks?: readonly string[];
|
|
1091
1091
|
tags?: readonly string[];
|
|
@@ -1244,7 +1244,7 @@ export declare const StaticSection: t.RecordC<t.StringC, t.Type<({
|
|
|
1244
1244
|
label?: string | null | undefined;
|
|
1245
1245
|
useAsTitle?: boolean;
|
|
1246
1246
|
placeholder?: string;
|
|
1247
|
-
select?: "
|
|
1247
|
+
select?: "web" | "media" | "document" | null;
|
|
1248
1248
|
customtypes?: readonly string[];
|
|
1249
1249
|
masks?: readonly string[];
|
|
1250
1250
|
tags?: readonly string[];
|
|
@@ -1342,7 +1342,7 @@ export declare const StaticSection: t.RecordC<t.StringC, t.Type<({
|
|
|
1342
1342
|
};
|
|
1343
1343
|
}), unknown, unknown>>;
|
|
1344
1344
|
export declare type StaticSection = t.TypeOf<typeof StaticSection>;
|
|
1345
|
-
export declare const DynamicSection: t.RecordC<t.
|
|
1345
|
+
export declare const DynamicSection: t.RecordC<t.Type<string, string, unknown>, t.Type<({
|
|
1346
1346
|
type: "Boolean";
|
|
1347
1347
|
} & {
|
|
1348
1348
|
config?: {
|
|
@@ -1419,7 +1419,7 @@ export declare const DynamicSection: t.RecordC<t.StringC, t.Type<({
|
|
|
1419
1419
|
label?: string | null | undefined;
|
|
1420
1420
|
useAsTitle?: boolean;
|
|
1421
1421
|
placeholder?: string;
|
|
1422
|
-
select?: "
|
|
1422
|
+
select?: "web" | "media" | "document" | null;
|
|
1423
1423
|
customtypes?: readonly string[];
|
|
1424
1424
|
masks?: readonly string[];
|
|
1425
1425
|
tags?: readonly string[];
|
|
@@ -1585,7 +1585,7 @@ export declare const DynamicSection: t.RecordC<t.StringC, t.Type<({
|
|
|
1585
1585
|
label?: string | null | undefined;
|
|
1586
1586
|
useAsTitle?: boolean;
|
|
1587
1587
|
placeholder?: string;
|
|
1588
|
-
select?: "
|
|
1588
|
+
select?: "web" | "media" | "document" | null;
|
|
1589
1589
|
customtypes?: readonly string[];
|
|
1590
1590
|
masks?: readonly string[];
|
|
1591
1591
|
tags?: readonly string[];
|
|
@@ -1758,7 +1758,7 @@ export declare const DynamicSection: t.RecordC<t.StringC, t.Type<({
|
|
|
1758
1758
|
label?: string | null | undefined;
|
|
1759
1759
|
useAsTitle?: boolean;
|
|
1760
1760
|
placeholder?: string;
|
|
1761
|
-
select?: "
|
|
1761
|
+
select?: "web" | "media" | "document" | null;
|
|
1762
1762
|
customtypes?: readonly string[];
|
|
1763
1763
|
masks?: readonly string[];
|
|
1764
1764
|
tags?: readonly string[];
|
|
@@ -1922,7 +1922,7 @@ export declare const DynamicSection: t.RecordC<t.StringC, t.Type<({
|
|
|
1922
1922
|
label?: string | null | undefined;
|
|
1923
1923
|
useAsTitle?: boolean;
|
|
1924
1924
|
placeholder?: string;
|
|
1925
|
-
select?: "
|
|
1925
|
+
select?: "web" | "media" | "document" | null;
|
|
1926
1926
|
customtypes?: readonly string[];
|
|
1927
1927
|
masks?: readonly string[];
|
|
1928
1928
|
tags?: readonly string[];
|
|
@@ -2081,7 +2081,7 @@ export declare const DynamicSection: t.RecordC<t.StringC, t.Type<({
|
|
|
2081
2081
|
label?: string | null | undefined;
|
|
2082
2082
|
useAsTitle?: boolean;
|
|
2083
2083
|
placeholder?: string;
|
|
2084
|
-
select?: "
|
|
2084
|
+
select?: "web" | "media" | "document" | null;
|
|
2085
2085
|
customtypes?: readonly string[];
|
|
2086
2086
|
masks?: readonly string[];
|
|
2087
2087
|
tags?: readonly string[];
|
|
@@ -2252,7 +2252,7 @@ export declare const DynamicSection: t.RecordC<t.StringC, t.Type<({
|
|
|
2252
2252
|
label?: string | null | undefined;
|
|
2253
2253
|
useAsTitle?: boolean;
|
|
2254
2254
|
placeholder?: string;
|
|
2255
|
-
select?: "
|
|
2255
|
+
select?: "web" | "media" | "document" | null;
|
|
2256
2256
|
customtypes?: readonly string[];
|
|
2257
2257
|
masks?: readonly string[];
|
|
2258
2258
|
tags?: readonly string[];
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Sections = exports.DynamicSection = exports.StaticSection = exports.sectionReader = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
+
const widgets_1 = require("../documents/widgets");
|
|
6
7
|
const Widget_1 = require("./widgets/Widget");
|
|
7
8
|
function sectionReader(codec) {
|
|
8
|
-
return t.record(
|
|
9
|
+
return t.record(widgets_1.WidgetKey, codec); // WidgetId -> Widget Data
|
|
9
10
|
}
|
|
10
11
|
exports.sectionReader = sectionReader;
|
|
11
12
|
exports.StaticSection = sectionReader(Widget_1.StaticWidget);
|
|
@@ -8,7 +8,7 @@ declare const Group: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
8
8
|
config: t.ExactC<t.PartialC<{
|
|
9
9
|
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
10
10
|
repeat: t.BooleanC;
|
|
11
|
-
fields: t.RecordC<t.
|
|
11
|
+
fields: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
12
12
|
type: t.LiteralC<"Color">;
|
|
13
13
|
}>, t.PartialC<{
|
|
14
14
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
5
|
+
const widgets_1 = require("../../documents/widgets");
|
|
5
6
|
const validators_1 = require("../../validators");
|
|
6
7
|
const NestableWidget_1 = (0, tslib_1.__importDefault)(require("./nestable/NestableWidget"));
|
|
7
8
|
const WidgetTypes_1 = require("./WidgetTypes");
|
|
8
9
|
const GroupConfig = t.exact(t.partial({
|
|
9
10
|
label: validators_1.StringOrNull,
|
|
10
11
|
repeat: t.boolean,
|
|
11
|
-
fields: t.record(
|
|
12
|
+
fields: t.record(widgets_1.WidgetKey, NestableWidget_1.default),
|
|
12
13
|
}));
|
|
13
14
|
const Group = t.exact(t.intersection([
|
|
14
15
|
t.type({
|
|
@@ -175,7 +175,7 @@ export declare function widgetReader<T extends StaticSlices | DynamicSlices>(cod
|
|
|
175
175
|
config: t.ExactC<t.PartialC<{
|
|
176
176
|
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
177
177
|
repeat: t.BooleanC;
|
|
178
|
-
fields: t.RecordC<t.
|
|
178
|
+
fields: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
179
179
|
type: t.LiteralC<"Color">;
|
|
180
180
|
}>, t.PartialC<{
|
|
181
181
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -508,7 +508,7 @@ export declare const StaticWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
508
508
|
config: t.ExactC<t.PartialC<{
|
|
509
509
|
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
510
510
|
repeat: t.BooleanC;
|
|
511
|
-
fields: t.RecordC<t.
|
|
511
|
+
fields: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
512
512
|
type: t.LiteralC<"Color">;
|
|
513
513
|
}>, t.PartialC<{
|
|
514
514
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -757,7 +757,7 @@ export declare const StaticWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
757
757
|
label?: string | null | undefined;
|
|
758
758
|
useAsTitle?: boolean;
|
|
759
759
|
placeholder?: string;
|
|
760
|
-
select?: "
|
|
760
|
+
select?: "web" | "media" | "document" | null;
|
|
761
761
|
customtypes?: readonly string[];
|
|
762
762
|
masks?: readonly string[];
|
|
763
763
|
tags?: readonly string[];
|
|
@@ -921,7 +921,7 @@ export declare const StaticWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
921
921
|
label?: string | null | undefined;
|
|
922
922
|
useAsTitle?: boolean;
|
|
923
923
|
placeholder?: string;
|
|
924
|
-
select?: "
|
|
924
|
+
select?: "web" | "media" | "document" | null;
|
|
925
925
|
customtypes?: readonly string[];
|
|
926
926
|
masks?: readonly string[];
|
|
927
927
|
tags?: readonly string[];
|
|
@@ -1080,7 +1080,7 @@ export declare const StaticWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
1080
1080
|
label?: string | null | undefined;
|
|
1081
1081
|
useAsTitle?: boolean;
|
|
1082
1082
|
placeholder?: string;
|
|
1083
|
-
select?: "
|
|
1083
|
+
select?: "web" | "media" | "document" | null;
|
|
1084
1084
|
customtypes?: readonly string[];
|
|
1085
1085
|
masks?: readonly string[];
|
|
1086
1086
|
tags?: readonly string[];
|
|
@@ -1251,7 +1251,7 @@ export declare const StaticWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
1251
1251
|
label?: string | null | undefined;
|
|
1252
1252
|
useAsTitle?: boolean;
|
|
1253
1253
|
placeholder?: string;
|
|
1254
|
-
select?: "
|
|
1254
|
+
select?: "web" | "media" | "document" | null;
|
|
1255
1255
|
customtypes?: readonly string[];
|
|
1256
1256
|
masks?: readonly string[];
|
|
1257
1257
|
tags?: readonly string[];
|
|
@@ -1424,7 +1424,7 @@ export declare const StaticWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
1424
1424
|
label?: string | null | undefined;
|
|
1425
1425
|
useAsTitle?: boolean;
|
|
1426
1426
|
placeholder?: string;
|
|
1427
|
-
select?: "
|
|
1427
|
+
select?: "web" | "media" | "document" | null;
|
|
1428
1428
|
customtypes?: readonly string[];
|
|
1429
1429
|
masks?: readonly string[];
|
|
1430
1430
|
tags?: readonly string[];
|
|
@@ -1583,7 +1583,7 @@ export declare const StaticWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
1583
1583
|
label?: string | null | undefined;
|
|
1584
1584
|
useAsTitle?: boolean;
|
|
1585
1585
|
placeholder?: string;
|
|
1586
|
-
select?: "
|
|
1586
|
+
select?: "web" | "media" | "document" | null;
|
|
1587
1587
|
customtypes?: readonly string[];
|
|
1588
1588
|
masks?: readonly string[];
|
|
1589
1589
|
tags?: readonly string[];
|
|
@@ -1846,7 +1846,7 @@ export declare const DynamicWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<
|
|
|
1846
1846
|
config: t.ExactC<t.PartialC<{
|
|
1847
1847
|
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
1848
1848
|
repeat: t.BooleanC;
|
|
1849
|
-
fields: t.RecordC<t.
|
|
1849
|
+
fields: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
1850
1850
|
type: t.LiteralC<"Color">;
|
|
1851
1851
|
}>, t.PartialC<{
|
|
1852
1852
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -2095,7 +2095,7 @@ export declare const DynamicWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<
|
|
|
2095
2095
|
label?: string | null | undefined;
|
|
2096
2096
|
useAsTitle?: boolean;
|
|
2097
2097
|
placeholder?: string;
|
|
2098
|
-
select?: "
|
|
2098
|
+
select?: "web" | "media" | "document" | null;
|
|
2099
2099
|
customtypes?: readonly string[];
|
|
2100
2100
|
masks?: readonly string[];
|
|
2101
2101
|
tags?: readonly string[];
|
|
@@ -2259,7 +2259,7 @@ export declare const DynamicWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<
|
|
|
2259
2259
|
label?: string | null | undefined;
|
|
2260
2260
|
useAsTitle?: boolean;
|
|
2261
2261
|
placeholder?: string;
|
|
2262
|
-
select?: "
|
|
2262
|
+
select?: "web" | "media" | "document" | null;
|
|
2263
2263
|
customtypes?: readonly string[];
|
|
2264
2264
|
masks?: readonly string[];
|
|
2265
2265
|
tags?: readonly string[];
|
|
@@ -2418,7 +2418,7 @@ export declare const DynamicWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<
|
|
|
2418
2418
|
label?: string | null | undefined;
|
|
2419
2419
|
useAsTitle?: boolean;
|
|
2420
2420
|
placeholder?: string;
|
|
2421
|
-
select?: "
|
|
2421
|
+
select?: "web" | "media" | "document" | null;
|
|
2422
2422
|
customtypes?: readonly string[];
|
|
2423
2423
|
masks?: readonly string[];
|
|
2424
2424
|
tags?: readonly string[];
|
|
@@ -2589,7 +2589,7 @@ export declare const DynamicWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<
|
|
|
2589
2589
|
label?: string | null | undefined;
|
|
2590
2590
|
useAsTitle?: boolean;
|
|
2591
2591
|
placeholder?: string;
|
|
2592
|
-
select?: "
|
|
2592
|
+
select?: "web" | "media" | "document" | null;
|
|
2593
2593
|
customtypes?: readonly string[];
|
|
2594
2594
|
masks?: readonly string[];
|
|
2595
2595
|
tags?: readonly string[];
|
|
@@ -6,7 +6,7 @@ declare const CompositeSlice: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
6
6
|
description: t.StringC;
|
|
7
7
|
icon: t.StringC;
|
|
8
8
|
display: t.StringC;
|
|
9
|
-
"non-repeat": t.RecordC<t.
|
|
9
|
+
"non-repeat": t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
10
10
|
type: t.LiteralC<"Color">;
|
|
11
11
|
}>, t.PartialC<{
|
|
12
12
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -163,7 +163,7 @@ declare const CompositeSlice: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
163
163
|
catalog: t.StringC;
|
|
164
164
|
}>>;
|
|
165
165
|
}>]>>]>>;
|
|
166
|
-
repeat: t.RecordC<t.
|
|
166
|
+
repeat: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
167
167
|
type: t.LiteralC<"Color">;
|
|
168
168
|
}>, t.PartialC<{
|
|
169
169
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
5
|
+
const widgets_1 = require("../../../documents/widgets");
|
|
5
6
|
const validators_1 = require("../../../validators");
|
|
6
7
|
const NestableWidget_1 = (0, tslib_1.__importDefault)(require("../nestable/NestableWidget"));
|
|
7
8
|
const SlicesTypes_1 = require("./SlicesTypes");
|
|
@@ -17,8 +18,8 @@ const CompositeSlice = t.exact(t.intersection([
|
|
|
17
18
|
description: t.string,
|
|
18
19
|
icon: t.string,
|
|
19
20
|
display: t.string,
|
|
20
|
-
"non-repeat": t.record(
|
|
21
|
-
repeat: t.record(
|
|
21
|
+
"non-repeat": t.record(widgets_1.WidgetKey, NestableWidget_1.default),
|
|
22
|
+
repeat: t.record(widgets_1.WidgetKey, NestableWidget_1.default),
|
|
22
23
|
config: CompositeSliceConfig,
|
|
23
24
|
}),
|
|
24
25
|
]));
|
|
@@ -164,7 +164,7 @@ declare const LegacySlice: t.UnionC<[t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC
|
|
|
164
164
|
config: t.ExactC<t.PartialC<{
|
|
165
165
|
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
166
166
|
repeat: t.BooleanC;
|
|
167
|
-
fields: t.RecordC<t.
|
|
167
|
+
fields: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
168
168
|
type: t.LiteralC<"Color">;
|
|
169
169
|
}>, t.PartialC<{
|
|
170
170
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -8,7 +8,7 @@ export declare const Variation: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
8
8
|
version: t.StringC;
|
|
9
9
|
}>, t.PartialC<{
|
|
10
10
|
display: t.StringC;
|
|
11
|
-
primary: t.RecordC<t.
|
|
11
|
+
primary: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
12
12
|
type: t.LiteralC<"Color">;
|
|
13
13
|
}>, t.PartialC<{
|
|
14
14
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -165,7 +165,7 @@ export declare const Variation: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
165
165
|
catalog: t.StringC;
|
|
166
166
|
}>>;
|
|
167
167
|
}>]>>]>>;
|
|
168
|
-
items: t.RecordC<t.
|
|
168
|
+
items: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
169
169
|
type: t.LiteralC<"Color">;
|
|
170
170
|
}>, t.PartialC<{
|
|
171
171
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -337,7 +337,7 @@ export declare const SharedSlice: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
337
337
|
version: t.StringC;
|
|
338
338
|
}>, t.PartialC<{
|
|
339
339
|
display: t.StringC;
|
|
340
|
-
primary: t.RecordC<t.
|
|
340
|
+
primary: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
341
341
|
type: t.LiteralC<"Color">;
|
|
342
342
|
}>, t.PartialC<{
|
|
343
343
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -494,7 +494,7 @@ export declare const SharedSlice: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
494
494
|
catalog: t.StringC;
|
|
495
495
|
}>>;
|
|
496
496
|
}>]>>]>>;
|
|
497
|
-
items: t.RecordC<t.
|
|
497
|
+
items: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
498
498
|
type: t.LiteralC<"Color">;
|
|
499
499
|
}>, t.PartialC<{
|
|
500
500
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -4,6 +4,7 @@ exports.SharedSlice = exports.Variation = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
6
|
const withFallback_1 = require("io-ts-types/lib/withFallback");
|
|
7
|
+
const widgets_1 = require("../../../documents/widgets");
|
|
7
8
|
const NestableWidget_1 = (0, tslib_1.__importDefault)(require("../nestable/NestableWidget"));
|
|
8
9
|
const SlicesTypes_1 = require("./SlicesTypes");
|
|
9
10
|
const IMAGE_PLACEHOLDER_URL = "https://images.prismic.io/slice-machine/621a5ec4-0387-4bc5-9860-2dd46cbc07cd_default_ss.png?auto=compress,format";
|
|
@@ -18,8 +19,8 @@ exports.Variation = t.exact(t.intersection([
|
|
|
18
19
|
}),
|
|
19
20
|
t.partial({
|
|
20
21
|
display: t.string,
|
|
21
|
-
primary: t.record(
|
|
22
|
-
items: t.record(
|
|
22
|
+
primary: t.record(widgets_1.WidgetKey, NestableWidget_1.default),
|
|
23
|
+
items: t.record(widgets_1.WidgetKey, NestableWidget_1.default),
|
|
23
24
|
}),
|
|
24
25
|
]));
|
|
25
26
|
exports.SharedSlice = t.exact(t.intersection([
|
|
@@ -14,7 +14,7 @@ export declare function slicesConfigReader<T extends SharedSlice | SharedSliceRe
|
|
|
14
14
|
}>, t.PartialC<{
|
|
15
15
|
display: t.StringC;
|
|
16
16
|
}>]>>>>, t.NullC]>;
|
|
17
|
-
choices: t.RecordC<t.
|
|
17
|
+
choices: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.UnionC<[t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
18
18
|
type: t.LiteralC<"Color">;
|
|
19
19
|
}>, t.PartialC<{
|
|
20
20
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -179,7 +179,7 @@ export declare function slicesConfigReader<T extends SharedSlice | SharedSliceRe
|
|
|
179
179
|
config: t.ExactC<t.PartialC<{
|
|
180
180
|
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
181
181
|
repeat: t.BooleanC;
|
|
182
|
-
fields: t.RecordC<t.
|
|
182
|
+
fields: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
183
183
|
type: t.LiteralC<"Color">;
|
|
184
184
|
}>, t.PartialC<{
|
|
185
185
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -344,7 +344,7 @@ export declare function slicesConfigReader<T extends SharedSlice | SharedSliceRe
|
|
|
344
344
|
description: t.StringC;
|
|
345
345
|
icon: t.StringC;
|
|
346
346
|
display: t.StringC;
|
|
347
|
-
"non-repeat": t.RecordC<t.
|
|
347
|
+
"non-repeat": t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
348
348
|
type: t.LiteralC<"Color">;
|
|
349
349
|
}>, t.PartialC<{
|
|
350
350
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -501,7 +501,7 @@ export declare function slicesConfigReader<T extends SharedSlice | SharedSliceRe
|
|
|
501
501
|
catalog: t.StringC;
|
|
502
502
|
}>>;
|
|
503
503
|
}>]>>]>>;
|
|
504
|
-
repeat: t.RecordC<t.
|
|
504
|
+
repeat: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
505
505
|
type: t.LiteralC<"Color">;
|
|
506
506
|
}>, t.PartialC<{
|
|
507
507
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -670,7 +670,7 @@ export declare const StaticSlicesConfig: t.ExactC<t.PartialC<{
|
|
|
670
670
|
}>, t.PartialC<{
|
|
671
671
|
display: t.StringC;
|
|
672
672
|
}>]>>>>, t.NullC]>;
|
|
673
|
-
choices: t.RecordC<t.
|
|
673
|
+
choices: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.UnionC<[t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
674
674
|
type: t.LiteralC<"Color">;
|
|
675
675
|
}>, t.PartialC<{
|
|
676
676
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -835,7 +835,7 @@ export declare const StaticSlicesConfig: t.ExactC<t.PartialC<{
|
|
|
835
835
|
config: t.ExactC<t.PartialC<{
|
|
836
836
|
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
837
837
|
repeat: t.BooleanC;
|
|
838
|
-
fields: t.RecordC<t.
|
|
838
|
+
fields: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
839
839
|
type: t.LiteralC<"Color">;
|
|
840
840
|
}>, t.PartialC<{
|
|
841
841
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -1000,7 +1000,7 @@ export declare const StaticSlicesConfig: t.ExactC<t.PartialC<{
|
|
|
1000
1000
|
description: t.StringC;
|
|
1001
1001
|
icon: t.StringC;
|
|
1002
1002
|
display: t.StringC;
|
|
1003
|
-
"non-repeat": t.RecordC<t.
|
|
1003
|
+
"non-repeat": t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
1004
1004
|
type: t.LiteralC<"Color">;
|
|
1005
1005
|
}>, t.PartialC<{
|
|
1006
1006
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -1157,7 +1157,7 @@ export declare const StaticSlicesConfig: t.ExactC<t.PartialC<{
|
|
|
1157
1157
|
catalog: t.StringC;
|
|
1158
1158
|
}>>;
|
|
1159
1159
|
}>]>>]>>;
|
|
1160
|
-
repeat: t.RecordC<t.
|
|
1160
|
+
repeat: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
1161
1161
|
type: t.LiteralC<"Color">;
|
|
1162
1162
|
}>, t.PartialC<{
|
|
1163
1163
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -1408,7 +1408,7 @@ export declare const StaticSlicesConfig: t.ExactC<t.PartialC<{
|
|
|
1408
1408
|
label?: string | null | undefined;
|
|
1409
1409
|
useAsTitle?: boolean;
|
|
1410
1410
|
placeholder?: string;
|
|
1411
|
-
select?: "
|
|
1411
|
+
select?: "web" | "media" | "document" | null;
|
|
1412
1412
|
customtypes?: readonly string[];
|
|
1413
1413
|
masks?: readonly string[];
|
|
1414
1414
|
tags?: readonly string[];
|
|
@@ -1567,7 +1567,7 @@ export declare const StaticSlicesConfig: t.ExactC<t.PartialC<{
|
|
|
1567
1567
|
label?: string | null | undefined;
|
|
1568
1568
|
useAsTitle?: boolean;
|
|
1569
1569
|
placeholder?: string;
|
|
1570
|
-
select?: "
|
|
1570
|
+
select?: "web" | "media" | "document" | null;
|
|
1571
1571
|
customtypes?: readonly string[];
|
|
1572
1572
|
masks?: readonly string[];
|
|
1573
1573
|
tags?: readonly string[];
|
|
@@ -1661,7 +1661,7 @@ export declare const DynamicSlicesConfig: t.ExactC<t.PartialC<{
|
|
|
1661
1661
|
}>, t.PartialC<{
|
|
1662
1662
|
display: t.StringC;
|
|
1663
1663
|
}>]>>>>, t.NullC]>;
|
|
1664
|
-
choices: t.RecordC<t.
|
|
1664
|
+
choices: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.UnionC<[t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
1665
1665
|
type: t.LiteralC<"Color">;
|
|
1666
1666
|
}>, t.PartialC<{
|
|
1667
1667
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -1826,7 +1826,7 @@ export declare const DynamicSlicesConfig: t.ExactC<t.PartialC<{
|
|
|
1826
1826
|
config: t.ExactC<t.PartialC<{
|
|
1827
1827
|
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
1828
1828
|
repeat: t.BooleanC;
|
|
1829
|
-
fields: t.RecordC<t.
|
|
1829
|
+
fields: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
1830
1830
|
type: t.LiteralC<"Color">;
|
|
1831
1831
|
}>, t.PartialC<{
|
|
1832
1832
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -1991,7 +1991,7 @@ export declare const DynamicSlicesConfig: t.ExactC<t.PartialC<{
|
|
|
1991
1991
|
description: t.StringC;
|
|
1992
1992
|
icon: t.StringC;
|
|
1993
1993
|
display: t.StringC;
|
|
1994
|
-
"non-repeat": t.RecordC<t.
|
|
1994
|
+
"non-repeat": t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
1995
1995
|
type: t.LiteralC<"Color">;
|
|
1996
1996
|
}>, t.PartialC<{
|
|
1997
1997
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -2148,7 +2148,7 @@ export declare const DynamicSlicesConfig: t.ExactC<t.PartialC<{
|
|
|
2148
2148
|
catalog: t.StringC;
|
|
2149
2149
|
}>>;
|
|
2150
2150
|
}>]>>]>>;
|
|
2151
|
-
repeat: t.RecordC<t.
|
|
2151
|
+
repeat: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
2152
2152
|
type: t.LiteralC<"Color">;
|
|
2153
2153
|
}>, t.PartialC<{
|
|
2154
2154
|
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
@@ -2410,7 +2410,7 @@ export declare const StaticSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
2410
2410
|
label?: string | null | undefined;
|
|
2411
2411
|
useAsTitle?: boolean;
|
|
2412
2412
|
placeholder?: string;
|
|
2413
|
-
select?: "
|
|
2413
|
+
select?: "web" | "media" | "document" | null;
|
|
2414
2414
|
customtypes?: readonly string[];
|
|
2415
2415
|
masks?: readonly string[];
|
|
2416
2416
|
tags?: readonly string[];
|
|
@@ -2574,7 +2574,7 @@ export declare const StaticSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
2574
2574
|
label?: string | null | undefined;
|
|
2575
2575
|
useAsTitle?: boolean;
|
|
2576
2576
|
placeholder?: string;
|
|
2577
|
-
select?: "
|
|
2577
|
+
select?: "web" | "media" | "document" | null;
|
|
2578
2578
|
customtypes?: readonly string[];
|
|
2579
2579
|
masks?: readonly string[];
|
|
2580
2580
|
tags?: readonly string[];
|
|
@@ -2733,7 +2733,7 @@ export declare const StaticSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
2733
2733
|
label?: string | null | undefined;
|
|
2734
2734
|
useAsTitle?: boolean;
|
|
2735
2735
|
placeholder?: string;
|
|
2736
|
-
select?: "
|
|
2736
|
+
select?: "web" | "media" | "document" | null;
|
|
2737
2737
|
customtypes?: readonly string[];
|
|
2738
2738
|
masks?: readonly string[];
|
|
2739
2739
|
tags?: readonly string[];
|
|
@@ -2904,7 +2904,7 @@ export declare const StaticSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
2904
2904
|
label?: string | null | undefined;
|
|
2905
2905
|
useAsTitle?: boolean;
|
|
2906
2906
|
placeholder?: string;
|
|
2907
|
-
select?: "
|
|
2907
|
+
select?: "web" | "media" | "document" | null;
|
|
2908
2908
|
customtypes?: readonly string[];
|
|
2909
2909
|
masks?: readonly string[];
|
|
2910
2910
|
tags?: readonly string[];
|
|
@@ -3077,7 +3077,7 @@ export declare const StaticSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
3077
3077
|
label?: string | null | undefined;
|
|
3078
3078
|
useAsTitle?: boolean;
|
|
3079
3079
|
placeholder?: string;
|
|
3080
|
-
select?: "
|
|
3080
|
+
select?: "web" | "media" | "document" | null;
|
|
3081
3081
|
customtypes?: readonly string[];
|
|
3082
3082
|
masks?: readonly string[];
|
|
3083
3083
|
tags?: readonly string[];
|
|
@@ -3236,7 +3236,7 @@ export declare const StaticSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
3236
3236
|
label?: string | null | undefined;
|
|
3237
3237
|
useAsTitle?: boolean;
|
|
3238
3238
|
placeholder?: string;
|
|
3239
|
-
select?: "
|
|
3239
|
+
select?: "web" | "media" | "document" | null;
|
|
3240
3240
|
customtypes?: readonly string[];
|
|
3241
3241
|
masks?: readonly string[];
|
|
3242
3242
|
tags?: readonly string[];
|
|
@@ -3416,7 +3416,7 @@ export declare const DynamicSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
3416
3416
|
label?: string | null | undefined;
|
|
3417
3417
|
useAsTitle?: boolean;
|
|
3418
3418
|
placeholder?: string;
|
|
3419
|
-
select?: "
|
|
3419
|
+
select?: "web" | "media" | "document" | null;
|
|
3420
3420
|
customtypes?: readonly string[];
|
|
3421
3421
|
masks?: readonly string[];
|
|
3422
3422
|
tags?: readonly string[];
|
|
@@ -3580,7 +3580,7 @@ export declare const DynamicSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
3580
3580
|
label?: string | null | undefined;
|
|
3581
3581
|
useAsTitle?: boolean;
|
|
3582
3582
|
placeholder?: string;
|
|
3583
|
-
select?: "
|
|
3583
|
+
select?: "web" | "media" | "document" | null;
|
|
3584
3584
|
customtypes?: readonly string[];
|
|
3585
3585
|
masks?: readonly string[];
|
|
3586
3586
|
tags?: readonly string[];
|
|
@@ -3739,7 +3739,7 @@ export declare const DynamicSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
3739
3739
|
label?: string | null | undefined;
|
|
3740
3740
|
useAsTitle?: boolean;
|
|
3741
3741
|
placeholder?: string;
|
|
3742
|
-
select?: "
|
|
3742
|
+
select?: "web" | "media" | "document" | null;
|
|
3743
3743
|
customtypes?: readonly string[];
|
|
3744
3744
|
masks?: readonly string[];
|
|
3745
3745
|
tags?: readonly string[];
|
|
@@ -3910,7 +3910,7 @@ export declare const DynamicSlices: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
|
3910
3910
|
label?: string | null | undefined;
|
|
3911
3911
|
useAsTitle?: boolean;
|
|
3912
3912
|
placeholder?: string;
|
|
3913
|
-
select?: "
|
|
3913
|
+
select?: "web" | "media" | "document" | null;
|
|
3914
3914
|
customtypes?: readonly string[];
|
|
3915
3915
|
masks?: readonly string[];
|
|
3916
3916
|
tags?: readonly string[];
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Slices = exports.DynamicSlices = exports.StaticSlices = exports.slicesReader = exports.DynamicSlicesConfig = exports.StaticSlicesConfig = exports.slicesConfigReader = exports.SlicesLabels = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
+
const widgets_1 = require("../../../documents/widgets");
|
|
6
7
|
const validators_1 = require("../../../validators");
|
|
7
8
|
const WidgetTypes_1 = require("../WidgetTypes");
|
|
8
9
|
const CompositeSlice_1 = (0, tslib_1.__importDefault)(require("./CompositeSlice"));
|
|
@@ -25,7 +26,7 @@ function slicesConfigReader(codec) {
|
|
|
25
26
|
return t.exact(t.partial({
|
|
26
27
|
label: validators_1.StringOrNull,
|
|
27
28
|
labels: exports.SlicesLabels,
|
|
28
|
-
choices: t.record(
|
|
29
|
+
choices: t.record(widgets_1.WidgetKey, t.union([LegacySlice_1.default, CompositeSlice_1.default, codec])),
|
|
29
30
|
}));
|
|
30
31
|
}
|
|
31
32
|
exports.slicesConfigReader = slicesConfigReader;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as t from "io-ts";
|
|
1
2
|
import { SlicesContent } from "./slices";
|
|
2
3
|
import StaticWidgetContent from "./StaticWidgetContent";
|
|
3
4
|
export * from "./EmptyContent";
|
|
@@ -29,7 +30,8 @@ export declare const WidgetTypes: {
|
|
|
29
30
|
readonly Separator: "SeparatorContent";
|
|
30
31
|
};
|
|
31
32
|
export declare type WidgetTypes = typeof WidgetTypes[keyof typeof WidgetTypes];
|
|
32
|
-
export declare
|
|
33
|
+
export declare const WidgetKey: t.Type<string, string, unknown>;
|
|
34
|
+
export declare type WidgetKey = t.TypeOf<typeof WidgetKey>;
|
|
33
35
|
export declare type WidgetContent = SlicesContent | StaticWidgetContent;
|
|
34
36
|
export declare const Widget: {
|
|
35
37
|
fromJson(widgetKey: WidgetKey, widgetValue: unknown, widgetTypes: Map<WidgetKey, string>, widgetPositions: Map<WidgetKey, number>): import("fp-ts/lib/Option").None | import("fp-ts/lib/Option").Some<StaticWidgetContent> | import("fp-ts/lib/Option").Some<SlicesContent>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Widget = exports.WidgetTypes = exports.StaticWidgetContent = exports.Slices = exports.Nestable = void 0;
|
|
3
|
+
exports.Widget = exports.WidgetKey = exports.WidgetTypes = exports.StaticWidgetContent = exports.Slices = exports.Nestable = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
+
const function_1 = require("../../validators/function");
|
|
5
7
|
const EmptyContent_1 = require("./EmptyContent");
|
|
6
8
|
const GroupContent_1 = require("./GroupContent");
|
|
7
9
|
const nestable_1 = require("./nestable");
|
|
@@ -23,6 +25,8 @@ exports.WidgetTypes = {
|
|
|
23
25
|
Group: GroupContent_1.GroupContentType,
|
|
24
26
|
slices: slices_1.SlicesContentType,
|
|
25
27
|
};
|
|
28
|
+
const widgetKeyRegex = new RegExp("^[^<>]+$");
|
|
29
|
+
exports.WidgetKey = (0, function_1.refineType)(t.string, "WidgetKey", (s) => widgetKeyRegex.test(s));
|
|
26
30
|
exports.Widget = {
|
|
27
31
|
fromJson(widgetKey, widgetValue, widgetTypes, widgetPositions) {
|
|
28
32
|
const fieldType = widgetTypes.get(widgetKey);
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as t from "io-ts"
|
|
2
2
|
|
|
3
|
+
import { WidgetKey } from "../documents/widgets"
|
|
3
4
|
import type { SharedSlice } from "./widgets/slices"
|
|
4
5
|
import { DynamicWidget, StaticWidget, Widgets } from "./widgets/Widget"
|
|
5
6
|
|
|
6
7
|
export function sectionReader<T extends StaticWidget | DynamicWidget>(
|
|
7
8
|
codec: t.Type<T, unknown>,
|
|
8
9
|
) {
|
|
9
|
-
return t.record(
|
|
10
|
+
return t.record(WidgetKey, codec) // WidgetId -> Widget Data
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export const StaticSection = sectionReader(StaticWidget)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as t from "io-ts"
|
|
2
2
|
|
|
3
|
+
import { WidgetKey } from "../../documents/widgets"
|
|
3
4
|
import { StringOrNull } from "../../validators"
|
|
4
5
|
import NestableWidget from "./nestable/NestableWidget"
|
|
5
6
|
import { WidgetTypes } from "./WidgetTypes"
|
|
@@ -8,7 +9,7 @@ const GroupConfig = t.exact(
|
|
|
8
9
|
t.partial({
|
|
9
10
|
label: StringOrNull,
|
|
10
11
|
repeat: t.boolean,
|
|
11
|
-
fields: t.record(
|
|
12
|
+
fields: t.record(WidgetKey, NestableWidget),
|
|
12
13
|
}),
|
|
13
14
|
)
|
|
14
15
|
type GroupConfig = t.TypeOf<typeof GroupConfig>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as t from "io-ts"
|
|
2
2
|
|
|
3
|
+
import { WidgetKey } from "../../../documents/widgets"
|
|
3
4
|
import { StringOrNull } from "../../../validators"
|
|
4
5
|
import NestableWidget from "../nestable/NestableWidget"
|
|
5
6
|
import { SlicesTypes } from "./SlicesTypes"
|
|
@@ -21,8 +22,8 @@ const CompositeSlice = t.exact(
|
|
|
21
22
|
description: t.string,
|
|
22
23
|
icon: t.string,
|
|
23
24
|
display: t.string,
|
|
24
|
-
"non-repeat": t.record(
|
|
25
|
-
repeat: t.record(
|
|
25
|
+
"non-repeat": t.record(WidgetKey, NestableWidget),
|
|
26
|
+
repeat: t.record(WidgetKey, NestableWidget),
|
|
26
27
|
config: CompositeSliceConfig,
|
|
27
28
|
}),
|
|
28
29
|
]),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as t from "io-ts"
|
|
2
2
|
import { withFallback } from "io-ts-types/lib/withFallback"
|
|
3
3
|
|
|
4
|
+
import { WidgetKey } from "../../../documents/widgets"
|
|
4
5
|
import NestableWidget from "../nestable/NestableWidget"
|
|
5
6
|
import { SlicesTypes } from "./SlicesTypes"
|
|
6
7
|
|
|
@@ -19,8 +20,8 @@ export const Variation = t.exact(
|
|
|
19
20
|
}),
|
|
20
21
|
t.partial({
|
|
21
22
|
display: t.string,
|
|
22
|
-
primary: t.record(
|
|
23
|
-
items: t.record(
|
|
23
|
+
primary: t.record(WidgetKey, NestableWidget),
|
|
24
|
+
items: t.record(WidgetKey, NestableWidget),
|
|
24
25
|
}),
|
|
25
26
|
]),
|
|
26
27
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as t from "io-ts"
|
|
2
2
|
|
|
3
|
+
import { WidgetKey } from "../../../documents/widgets"
|
|
3
4
|
import { StringOrNull } from "../../../validators"
|
|
4
5
|
import { WidgetTypes } from "../WidgetTypes"
|
|
5
6
|
import CompositeSlice from "./CompositeSlice"
|
|
@@ -36,7 +37,7 @@ export function slicesConfigReader<T extends SharedSlice | SharedSliceRef>(
|
|
|
36
37
|
label: StringOrNull,
|
|
37
38
|
labels: SlicesLabels,
|
|
38
39
|
choices: t.record(
|
|
39
|
-
|
|
40
|
+
WidgetKey,
|
|
40
41
|
t.union([LegacySlice, CompositeSlice, codec]),
|
|
41
42
|
),
|
|
42
43
|
}),
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import * as t from "io-ts"
|
|
2
|
+
|
|
3
|
+
import { refineType } from "../../validators/function"
|
|
1
4
|
import { EmptyContentType } from "./EmptyContent"
|
|
2
5
|
import { GroupContentType } from "./GroupContent"
|
|
3
6
|
import { NestableTypes } from "./nestable"
|
|
@@ -26,7 +29,13 @@ export const WidgetTypes = {
|
|
|
26
29
|
|
|
27
30
|
export type WidgetTypes = typeof WidgetTypes[keyof typeof WidgetTypes]
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
const widgetKeyRegex = new RegExp("^[^<>]+$")
|
|
33
|
+
|
|
34
|
+
export const WidgetKey = refineType(t.string, "WidgetKey", (s: string) =>
|
|
35
|
+
widgetKeyRegex.test(s),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
export type WidgetKey = t.TypeOf<typeof WidgetKey>
|
|
30
39
|
|
|
31
40
|
export type WidgetContent = SlicesContent | StaticWidgetContent
|
|
32
41
|
|