@prismicio/types-internal 2.0.0-alpha.3 → 2.0.0-alpha.4

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.
Files changed (39) hide show
  1. package/lib/content/LegacyContentCtx.js +1 -1
  2. package/lib/content/fields/WidgetContent.d.ts +1 -1
  3. package/lib/customtypes/widgets/Group.d.ts +164 -3
  4. package/lib/customtypes/widgets/Group.js +4 -5
  5. package/lib/customtypes/widgets/UID.d.ts +8 -3
  6. package/lib/customtypes/widgets/UID.js +4 -5
  7. package/lib/customtypes/widgets/Widget.d.ts +2 -2
  8. package/lib/customtypes/widgets/Widget.js +5 -5
  9. package/lib/customtypes/widgets/nestable/Link.d.ts +0 -1
  10. package/lib/customtypes/widgets/nestable/Link.js +0 -1
  11. package/lib/customtypes/widgets/nestable/RichText.d.ts +1 -1
  12. package/lib/customtypes/widgets/nestable/Text.d.ts +0 -1
  13. package/lib/customtypes/widgets/nestable/Text.js +0 -1
  14. package/lib/customtypes/widgets/slices/CompositeSlice.d.ts +6 -3
  15. package/lib/customtypes/widgets/slices/CompositeSlice.js +4 -5
  16. package/lib/customtypes/widgets/slices/LegacySlice.d.ts +2 -3
  17. package/lib/customtypes/widgets/slices/LegacySlice.js +3 -3
  18. package/lib/customtypes/widgets/slices/SharedSliceRef.d.ts +2 -3
  19. package/lib/customtypes/widgets/slices/SharedSliceRef.js +2 -2
  20. package/lib/customtypes/widgets/slices/Slice.d.ts +3 -3
  21. package/lib/customtypes/widgets/slices/Slices.d.ts +1 -1
  22. package/lib/customtypes/widgets/slices/Slices.js +5 -5
  23. package/lib/customtypes/widgets/slices/index.d.ts +3 -3
  24. package/lib/customtypes/widgets/slices/index.js +3 -3
  25. package/package.json +1 -1
  26. package/src/content/LegacyContentCtx.ts +2 -2
  27. package/src/content/fields/WidgetContent.ts +1 -1
  28. package/src/customtypes/widgets/Group.ts +4 -6
  29. package/src/customtypes/widgets/UID.ts +4 -6
  30. package/src/customtypes/widgets/Widget.ts +5 -5
  31. package/src/customtypes/widgets/nestable/Link.ts +0 -2
  32. package/src/customtypes/widgets/nestable/RichText.ts +1 -1
  33. package/src/customtypes/widgets/nestable/Text.ts +0 -2
  34. package/src/customtypes/widgets/slices/CompositeSlice.ts +4 -6
  35. package/src/customtypes/widgets/slices/LegacySlice.ts +3 -5
  36. package/src/customtypes/widgets/slices/SharedSliceRef.ts +2 -4
  37. package/src/customtypes/widgets/slices/Slice.ts +3 -3
  38. package/src/customtypes/widgets/slices/Slices.ts +3 -3
  39. package/src/customtypes/widgets/slices/index.ts +3 -3
@@ -4,7 +4,7 @@ exports.defaultCtx = exports.getFieldCtx = exports.LegacyContentCtx = exports.Fi
4
4
  const tslib_1 = require("tslib");
5
5
  const t = tslib_1.__importStar(require("io-ts"));
6
6
  const widgets_1 = require("../customtypes/widgets");
7
- exports.FieldOrSliceType = t.union([widgets_1.FieldTypes, widgets_1.SlicesTypes]);
7
+ exports.FieldOrSliceType = t.union([widgets_1.FieldType, widgets_1.SlicesTypes]);
8
8
  class LegacyContentCtx {
9
9
  constructor(fieldKey, fieldPath, allTypes) {
10
10
  Object.defineProperty(this, "fieldKey", {
@@ -4659,7 +4659,7 @@ export declare const isWidgetContent: (u: unknown) => u is {
4659
4659
  value: string;
4660
4660
  };
4661
4661
  export type WidgetContent = t.TypeOf<typeof WidgetContent>;
4662
- export type WidgetTypes = WidgetContent["__TYPE__"];
4662
+ export type ContentType = WidgetContent["__TYPE__"];
4663
4663
  export declare const WidgetLegacy: (ctx: LegacyContentCtx) => {
4664
4664
  decode(value: unknown): import("fp-ts/lib/Either").Left<t.Errors> | import("fp-ts/lib/Either").Right<{
4665
4665
  __TYPE__: "BooleanContent";
@@ -1,6 +1,168 @@
1
1
  import * as t from "io-ts";
2
2
  export declare const GroupFieldType = "Group";
3
- declare const Group: t.ExactC<t.IntersectionC<[t.TypeC<{
3
+ export declare const GroupConfig: t.ExactC<t.PartialC<{
4
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
5
+ repeat: t.BooleanC;
6
+ fields: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
7
+ type: t.LiteralC<"Color">;
8
+ }>, t.PartialC<{
9
+ fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
10
+ config: t.ExactC<t.PartialC<{
11
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
12
+ placeholder: t.StringC;
13
+ }>>;
14
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
15
+ type: t.LiteralC<"Boolean">;
16
+ }>, t.PartialC<{
17
+ config: t.ExactC<t.PartialC<{
18
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
19
+ default_value: t.BooleanC;
20
+ placeholder_true: t.StringC;
21
+ placeholder_false: t.StringC;
22
+ }>>;
23
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
24
+ type: t.LiteralC<"Embed">;
25
+ }>, t.PartialC<{
26
+ fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
27
+ config: t.ExactC<t.PartialC<{
28
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
29
+ placeholder: t.StringC;
30
+ useAsTitle: t.BooleanC;
31
+ }>>;
32
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
33
+ type: t.LiteralC<"GeoPoint">;
34
+ }>, t.PartialC<{
35
+ fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
36
+ config: t.ExactC<t.PartialC<{
37
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
38
+ }>>;
39
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
40
+ type: t.LiteralC<"Date">;
41
+ }>, t.PartialC<{
42
+ fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
43
+ config: t.ExactC<t.PartialC<{
44
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
45
+ placeholder: t.StringC;
46
+ default: t.StringC;
47
+ }>>;
48
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
49
+ type: t.LiteralC<"Number">;
50
+ }>, t.PartialC<{
51
+ fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
52
+ config: t.ExactC<t.PartialC<{
53
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
54
+ placeholder: t.StringC;
55
+ min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
56
+ max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
57
+ step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
58
+ }>>;
59
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
60
+ type: t.LiteralC<"Range">;
61
+ }>, t.PartialC<{
62
+ fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
63
+ config: t.ExactC<t.PartialC<{
64
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
65
+ placeholder: t.StringC;
66
+ min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
67
+ max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
68
+ step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>;
69
+ }>>;
70
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
71
+ type: t.LiteralC<"StructuredText">;
72
+ }>, t.PartialC<{
73
+ fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
74
+ config: t.ExactC<t.PartialC<{
75
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
76
+ placeholder: t.StringC;
77
+ useAsTitle: t.BooleanC;
78
+ single: t.Type<string, string, unknown>;
79
+ multi: t.Type<string, string, unknown>;
80
+ imageConstraint: t.PartialC<{
81
+ width: t.Type<number | null, unknown, unknown>;
82
+ height: t.Type<number | null, unknown, unknown>;
83
+ }>;
84
+ labels: t.Type<readonly string[], object, unknown>;
85
+ allowTargetBlank: t.BooleanC;
86
+ }>>;
87
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
88
+ type: t.LiteralC<"Select">;
89
+ }>, t.PartialC<{
90
+ fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
91
+ config: t.ExactC<t.PartialC<{
92
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
93
+ placeholder: t.StringC;
94
+ default_value: t.StringC;
95
+ options: t.ReadonlyArrayC<t.UnionC<[t.StringC, t.Type<string, string, unknown>, t.Type<string, string, unknown>]>>;
96
+ }>>;
97
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
98
+ type: t.LiteralC<"Separator">;
99
+ }>, t.PartialC<{
100
+ config: t.ExactC<t.PartialC<{
101
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
102
+ }>>;
103
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
104
+ type: t.LiteralC<"Text">;
105
+ }>, t.PartialC<{
106
+ fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
107
+ config: t.ExactC<t.PartialC<{
108
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
109
+ useAsTitle: t.BooleanC;
110
+ placeholder: t.StringC;
111
+ }>>;
112
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
113
+ type: t.LiteralC<"Timestamp">;
114
+ }>, t.PartialC<{
115
+ fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
116
+ config: t.ExactC<t.PartialC<{
117
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
118
+ placeholder: t.StringC;
119
+ default: t.StringC;
120
+ }>>;
121
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
122
+ type: t.LiteralC<"Link">;
123
+ }>, t.PartialC<{
124
+ fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
125
+ config: t.ExactC<t.PartialC<{
126
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
127
+ useAsTitle: t.BooleanC;
128
+ placeholder: t.StringC;
129
+ select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>;
130
+ customtypes: t.ReadonlyArrayC<t.StringC>;
131
+ masks: t.Type<readonly string[], object, unknown>;
132
+ tags: t.Type<readonly string[], object, unknown>;
133
+ allowTargetBlank: t.BooleanC;
134
+ }>>;
135
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
136
+ type: t.LiteralC<"Image">;
137
+ }>, t.PartialC<{
138
+ fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
139
+ config: t.ExactC<t.PartialC<{
140
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
141
+ placeholder: t.StringC;
142
+ constraint: t.PartialC<{
143
+ width: t.Type<number | null, unknown, unknown>;
144
+ height: t.Type<number | null, unknown, unknown>;
145
+ }>;
146
+ thumbnails: t.ReadonlyArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
147
+ name: t.StringC;
148
+ }>, t.PartialC<{
149
+ width: t.Type<number | null, unknown, unknown>;
150
+ height: t.Type<number | null, unknown, unknown>;
151
+ }>]>>>;
152
+ }>>;
153
+ }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
154
+ type: t.LiteralC<"IntegrationFields">;
155
+ }>, t.PartialC<{
156
+ fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
157
+ config: t.ExactC<t.PartialC<{
158
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
159
+ placeholder: t.StringC;
160
+ catalog: t.StringC;
161
+ }>>;
162
+ }>]>>]>>;
163
+ }>>;
164
+ export type GroupConfig = t.TypeOf<typeof GroupConfig>;
165
+ export declare const Group: t.ExactC<t.IntersectionC<[t.TypeC<{
4
166
  type: t.LiteralC<"Group">;
5
167
  }>, t.PartialC<{
6
168
  fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
@@ -168,5 +330,4 @@ declare const Group: t.ExactC<t.IntersectionC<[t.TypeC<{
168
330
  }>]>>]>>;
169
331
  }>>;
170
332
  }>]>>;
171
- type Group = t.TypeOf<typeof Group>;
172
- export default Group;
333
+ export type Group = t.TypeOf<typeof Group>;
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GroupFieldType = void 0;
3
+ exports.Group = exports.GroupConfig = exports.GroupFieldType = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const t = tslib_1.__importStar(require("io-ts"));
6
6
  const common_1 = require("../../common");
7
7
  const validators_1 = require("../../validators");
8
8
  const NestableWidget_1 = require("./nestable/NestableWidget");
9
9
  exports.GroupFieldType = "Group";
10
- const GroupConfig = t.exact(t.partial({
10
+ exports.GroupConfig = t.exact(t.partial({
11
11
  label: validators_1.StringOrNull,
12
12
  repeat: t.boolean,
13
13
  fields: t.record(common_1.WidgetKey, NestableWidget_1.NestableWidget),
14
14
  }));
15
- const Group = t.exact(t.intersection([
15
+ exports.Group = t.exact(t.intersection([
16
16
  t.type({
17
17
  type: t.literal(exports.GroupFieldType),
18
18
  }),
@@ -20,7 +20,6 @@ const Group = t.exact(t.intersection([
20
20
  fieldset: validators_1.StringOrNull,
21
21
  icon: t.string,
22
22
  description: t.string,
23
- config: GroupConfig,
23
+ config: exports.GroupConfig,
24
24
  }),
25
25
  ]));
26
- exports.default = Group;
@@ -1,6 +1,12 @@
1
1
  import * as t from "io-ts";
2
2
  export declare const UIDFieldType = "UID";
3
- declare const UID: t.ExactC<t.IntersectionC<[t.TypeC<{
3
+ export declare const UIDConfig: t.ExactC<t.PartialC<{
4
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
5
+ useAsTitle: t.BooleanC;
6
+ placeholder: t.StringC;
7
+ }>>;
8
+ export type UIDConfig = t.TypeOf<typeof UIDConfig>;
9
+ export declare const UID: t.ExactC<t.IntersectionC<[t.TypeC<{
4
10
  type: t.LiteralC<"UID">;
5
11
  }>, t.PartialC<{
6
12
  fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
@@ -10,5 +16,4 @@ declare const UID: t.ExactC<t.IntersectionC<[t.TypeC<{
10
16
  placeholder: t.StringC;
11
17
  }>>;
12
18
  }>]>>;
13
- type UID = t.TypeOf<typeof UID>;
14
- export default UID;
19
+ export type UID = t.TypeOf<typeof UID>;
@@ -1,22 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UIDFieldType = void 0;
3
+ exports.UID = exports.UIDConfig = exports.UIDFieldType = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const t = tslib_1.__importStar(require("io-ts"));
6
6
  const validators_1 = require("../../validators");
7
7
  exports.UIDFieldType = "UID";
8
- const UIDConfig = t.exact(t.partial({
8
+ exports.UIDConfig = t.exact(t.partial({
9
9
  label: validators_1.StringOrNull,
10
10
  useAsTitle: t.boolean,
11
11
  placeholder: t.string,
12
12
  }));
13
- const UID = t.exact(t.intersection([
13
+ exports.UID = t.exact(t.intersection([
14
14
  t.type({
15
15
  type: t.literal(exports.UIDFieldType),
16
16
  }),
17
17
  t.partial({
18
18
  fieldset: validators_1.StringOrNull,
19
- config: UIDConfig,
19
+ config: exports.UIDConfig,
20
20
  }),
21
21
  ]));
22
- exports.default = UID;
@@ -2678,7 +2678,7 @@ export declare const DynamicWidget: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<
2678
2678
  };
2679
2679
  }, unknown, unknown>]>;
2680
2680
  export type DynamicWidget = t.TypeOf<typeof DynamicWidget>;
2681
- export declare const FieldTypes: t.KeyofC<{
2681
+ export declare const FieldType: t.KeyofC<{
2682
2682
  Color: null;
2683
2683
  Boolean: null;
2684
2684
  Number: null;
@@ -2699,7 +2699,7 @@ export declare const FieldTypes: t.KeyofC<{
2699
2699
  Slices: null;
2700
2700
  Choice: null;
2701
2701
  }>;
2702
- export type FieldTypes = t.TypeOf<typeof FieldTypes>;
2702
+ export type FieldType = t.TypeOf<typeof FieldType>;
2703
2703
  export declare const Widgets: {
2704
2704
  toStatic(widget: DynamicWidget, sharedSlices: Map<string, SharedSlice>): StaticWidget;
2705
2705
  };
@@ -1,20 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Widgets = exports.FieldTypes = exports.DynamicWidget = exports.StaticWidget = exports.widgetReader = void 0;
3
+ exports.Widgets = exports.FieldType = exports.DynamicWidget = exports.StaticWidget = exports.widgetReader = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const t = tslib_1.__importStar(require("io-ts"));
6
- const Group_1 = tslib_1.__importStar(require("./Group"));
6
+ const Group_1 = require("./Group");
7
7
  const nestable_1 = require("./nestable");
8
8
  const NestableWidget_1 = require("./nestable/NestableWidget");
9
9
  const Slices_1 = require("./slices/Slices");
10
- const UID_1 = tslib_1.__importStar(require("./UID"));
10
+ const UID_1 = require("./UID");
11
11
  function widgetReader(codec) {
12
- return t.union([UID_1.default, NestableWidget_1.NestableWidget, Group_1.default, codec]);
12
+ return t.union([UID_1.UID, NestableWidget_1.NestableWidget, Group_1.Group, codec]);
13
13
  }
14
14
  exports.widgetReader = widgetReader;
15
15
  exports.StaticWidget = widgetReader(Slices_1.StaticSlices);
16
16
  exports.DynamicWidget = widgetReader(Slices_1.DynamicSlices);
17
- exports.FieldTypes = t.keyof({
17
+ exports.FieldType = t.keyof({
18
18
  [nestable_1.ColorFieldType]: null,
19
19
  [nestable_1.BooleanFieldType]: null,
20
20
  [nestable_1.NumberFieldType]: null,
@@ -27,4 +27,3 @@ export declare const Link: t.ExactC<t.IntersectionC<[t.TypeC<{
27
27
  }>>;
28
28
  }>]>>;
29
29
  export type Link = t.TypeOf<typeof Link>;
30
- export default Link;
@@ -52,4 +52,3 @@ exports.Link = t.exact(t.intersection([
52
52
  config: exports.LinkConfig,
53
53
  }),
54
54
  ]));
55
- exports.default = exports.Link;
@@ -1,7 +1,7 @@
1
1
  import * as t from "io-ts";
2
2
  export declare const RichTextFieldType = "StructuredText";
3
3
  export declare const DEFAULT_OPTION = "paragraph";
4
- export type RichTextNodeType = typeof RichTextNodeType[keyof typeof RichTextNodeType];
4
+ export type RichTextNodeType = (typeof RichTextNodeType)[keyof typeof RichTextNodeType];
5
5
  export declare const RichTextNodeType: {
6
6
  readonly heading1: "heading1";
7
7
  readonly heading2: "heading2";
@@ -17,4 +17,3 @@ export declare const Text: t.ExactC<t.IntersectionC<[t.TypeC<{
17
17
  }>>;
18
18
  }>]>>;
19
19
  export type Text = t.TypeOf<typeof Text>;
20
- export default Text;
@@ -19,4 +19,3 @@ exports.Text = t.exact(t.intersection([
19
19
  config: exports.TextConfig,
20
20
  }),
21
21
  ]));
22
- exports.default = exports.Text;
@@ -1,6 +1,10 @@
1
1
  import * as t from "io-ts";
2
2
  export declare const CompositeSliceType = "Slice";
3
- declare const CompositeSlice: t.ExactC<t.IntersectionC<[t.TypeC<{
3
+ export declare const CompositeSliceConfig: t.ExactC<t.PartialC<{
4
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
5
+ }>>;
6
+ export type CompositeSliceConfig = t.TypeOf<typeof CompositeSliceConfig>;
7
+ export declare const CompositeSlice: t.ExactC<t.IntersectionC<[t.TypeC<{
4
8
  type: t.LiteralC<"Slice">;
5
9
  }>, t.PartialC<{
6
10
  fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
@@ -325,5 +329,4 @@ declare const CompositeSlice: t.ExactC<t.IntersectionC<[t.TypeC<{
325
329
  label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
326
330
  }>>;
327
331
  }>]>>;
328
- type CompositeSlice = t.TypeOf<typeof CompositeSlice>;
329
- export default CompositeSlice;
332
+ export type CompositeSlice = t.TypeOf<typeof CompositeSlice>;
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CompositeSliceType = void 0;
3
+ exports.CompositeSlice = exports.CompositeSliceConfig = exports.CompositeSliceType = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const t = tslib_1.__importStar(require("io-ts"));
6
6
  const common_1 = require("../../../common");
7
7
  const validators_1 = require("../../../validators");
8
8
  const NestableWidget_1 = require("../nestable/NestableWidget");
9
9
  exports.CompositeSliceType = "Slice";
10
- const CompositeSliceConfig = t.exact(t.partial({
10
+ exports.CompositeSliceConfig = t.exact(t.partial({
11
11
  label: validators_1.StringOrNull,
12
12
  }));
13
- const CompositeSlice = t.exact(t.intersection([
13
+ exports.CompositeSlice = t.exact(t.intersection([
14
14
  t.type({
15
15
  type: t.literal(exports.CompositeSliceType),
16
16
  }),
@@ -21,7 +21,6 @@ const CompositeSlice = t.exact(t.intersection([
21
21
  display: t.string,
22
22
  "non-repeat": t.record(common_1.WidgetKey, NestableWidget_1.NestableWidget),
23
23
  repeat: t.record(common_1.WidgetKey, NestableWidget_1.NestableWidget),
24
- config: CompositeSliceConfig,
24
+ config: exports.CompositeSliceConfig,
25
25
  }),
26
26
  ]));
27
- exports.default = CompositeSlice;
@@ -1,5 +1,5 @@
1
1
  import * as t from "io-ts";
2
- declare const LegacySlice: t.UnionC<[t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
2
+ export declare const LegacySlice: t.UnionC<[t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
3
3
  type: t.LiteralC<"Color">;
4
4
  }>, t.PartialC<{
5
5
  fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
@@ -323,5 +323,4 @@ declare const LegacySlice: t.UnionC<[t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC
323
323
  }>]>>]>>;
324
324
  }>>;
325
325
  }>]>>]>;
326
- type LegacySlice = t.TypeOf<typeof LegacySlice>;
327
- export default LegacySlice;
326
+ export type LegacySlice = t.TypeOf<typeof LegacySlice>;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LegacySlice = void 0;
3
4
  const tslib_1 = require("tslib");
4
5
  const t = tslib_1.__importStar(require("io-ts"));
5
- const Group_1 = tslib_1.__importDefault(require("../Group"));
6
+ const Group_1 = require("../Group");
6
7
  const NestableWidget_1 = require("../nestable/NestableWidget");
7
- const LegacySlice = t.union([NestableWidget_1.NestableWidget, Group_1.default]);
8
- exports.default = LegacySlice;
8
+ exports.LegacySlice = t.union([NestableWidget_1.NestableWidget, Group_1.Group]);
@@ -1,6 +1,5 @@
1
1
  import * as t from "io-ts";
2
- declare const SharedSliceRef: t.ExactC<t.TypeC<{
2
+ export declare const SharedSliceRef: t.ExactC<t.TypeC<{
3
3
  type: t.LiteralC<"SharedSlice">;
4
4
  }>>;
5
- type SharedSliceRef = t.TypeOf<typeof SharedSliceRef>;
6
- export default SharedSliceRef;
5
+ export type SharedSliceRef = t.TypeOf<typeof SharedSliceRef>;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SharedSliceRef = void 0;
3
4
  const tslib_1 = require("tslib");
4
5
  const t = tslib_1.__importStar(require("io-ts"));
5
6
  const SharedSlice_1 = require("./SharedSlice");
6
- const SharedSliceRef = t.exact(t.type({
7
+ exports.SharedSliceRef = t.exact(t.type({
7
8
  type: t.literal(SharedSlice_1.SharedSliceType),
8
9
  }));
9
- exports.default = SharedSliceRef;
@@ -1,6 +1,6 @@
1
- import type CompositeSlice from "./CompositeSlice";
2
- import type LegacySlice from "./LegacySlice";
1
+ import type { CompositeSlice } from "./CompositeSlice";
2
+ import type { LegacySlice } from "./LegacySlice";
3
3
  import type { SharedSlice } from "./SharedSlice";
4
- import type SharedSliceRef from "./SharedSliceRef";
4
+ import type { SharedSliceRef } from "./SharedSliceRef";
5
5
  export type DynamicSlice = CompositeSlice | LegacySlice | SharedSliceRef;
6
6
  export type StaticSlice = CompositeSlice | LegacySlice | SharedSlice;
@@ -1,6 +1,6 @@
1
1
  import * as t from "io-ts";
2
2
  import { SharedSlice } from "./SharedSlice";
3
- import SharedSliceRef from "./SharedSliceRef";
3
+ import { SharedSliceRef } from "./SharedSliceRef";
4
4
  export declare const LegacySlicesFieldType = "Choice";
5
5
  export declare const SlicesFieldType = "Slices";
6
6
  export declare const SlicesLabels: t.UnionC<[t.RecordC<t.StringC, t.ReadonlyArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{
@@ -5,10 +5,10 @@ const tslib_1 = require("tslib");
5
5
  const t = tslib_1.__importStar(require("io-ts"));
6
6
  const common_1 = require("../../../common");
7
7
  const validators_1 = require("../../../validators");
8
- const CompositeSlice_1 = tslib_1.__importDefault(require("./CompositeSlice"));
9
- const LegacySlice_1 = tslib_1.__importDefault(require("./LegacySlice"));
8
+ const CompositeSlice_1 = require("./CompositeSlice");
9
+ const LegacySlice_1 = require("./LegacySlice");
10
10
  const SharedSlice_1 = require("./SharedSlice");
11
- const SharedSliceRef_1 = tslib_1.__importDefault(require("./SharedSliceRef"));
11
+ const SharedSliceRef_1 = require("./SharedSliceRef");
12
12
  exports.LegacySlicesFieldType = "Choice";
13
13
  exports.SlicesFieldType = "Slices";
14
14
  exports.SlicesLabels = t.union([
@@ -26,12 +26,12 @@ function slicesConfigReader(codec) {
26
26
  return t.exact(t.partial({
27
27
  label: validators_1.StringOrNull,
28
28
  labels: exports.SlicesLabels,
29
- choices: t.record(common_1.WidgetKey, t.union([LegacySlice_1.default, CompositeSlice_1.default, codec])),
29
+ choices: t.record(common_1.WidgetKey, t.union([LegacySlice_1.LegacySlice, CompositeSlice_1.CompositeSlice, codec])),
30
30
  }));
31
31
  }
32
32
  exports.slicesConfigReader = slicesConfigReader;
33
33
  exports.StaticSlicesConfig = slicesConfigReader(SharedSlice_1.SharedSlice);
34
- exports.DynamicSlicesConfig = slicesConfigReader(SharedSliceRef_1.default);
34
+ exports.DynamicSlicesConfig = slicesConfigReader(SharedSliceRef_1.SharedSliceRef);
35
35
  const SlicesConfig = {
36
36
  toStatic(config, sharedSlices) {
37
37
  const choices = Object.entries(config.choices || {}).reduce((acc, [ref, slice]) => {
@@ -1,7 +1,7 @@
1
- export { default as CompositeSlice } from "./CompositeSlice";
2
- export { default as LegacySlice } from "./LegacySlice";
1
+ export { CompositeSlice } from "./CompositeSlice";
2
+ export { LegacySlice } from "./LegacySlice";
3
3
  export * from "./SharedSlice";
4
- export { default as SharedSliceRef } from "./SharedSliceRef";
4
+ export { SharedSliceRef } from "./SharedSliceRef";
5
5
  export * as Slice from "./Slice";
6
6
  export * as SliceZone from "./Slices";
7
7
  export { SlicesTypes } from "./SlicesTypes";
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SlicesTypes = exports.SliceZone = exports.Slice = exports.SharedSliceRef = exports.LegacySlice = exports.CompositeSlice = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  var CompositeSlice_1 = require("./CompositeSlice");
6
- Object.defineProperty(exports, "CompositeSlice", { enumerable: true, get: function () { return tslib_1.__importDefault(CompositeSlice_1).default; } });
6
+ Object.defineProperty(exports, "CompositeSlice", { enumerable: true, get: function () { return CompositeSlice_1.CompositeSlice; } });
7
7
  var LegacySlice_1 = require("./LegacySlice");
8
- Object.defineProperty(exports, "LegacySlice", { enumerable: true, get: function () { return tslib_1.__importDefault(LegacySlice_1).default; } });
8
+ Object.defineProperty(exports, "LegacySlice", { enumerable: true, get: function () { return LegacySlice_1.LegacySlice; } });
9
9
  tslib_1.__exportStar(require("./SharedSlice"), exports);
10
10
  var SharedSliceRef_1 = require("./SharedSliceRef");
11
- Object.defineProperty(exports, "SharedSliceRef", { enumerable: true, get: function () { return tslib_1.__importDefault(SharedSliceRef_1).default; } });
11
+ Object.defineProperty(exports, "SharedSliceRef", { enumerable: true, get: function () { return SharedSliceRef_1.SharedSliceRef; } });
12
12
  exports.Slice = tslib_1.__importStar(require("./Slice"));
13
13
  exports.SliceZone = tslib_1.__importStar(require("./Slices"));
14
14
  var SlicesTypes_1 = require("./SlicesTypes");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/types-internal",
3
- "version": "2.0.0-alpha.3",
3
+ "version": "2.0.0-alpha.4",
4
4
  "description": "Prismic types for Custom Types and Prismic Data",
5
5
  "keywords": [
6
6
  "typescript",
@@ -1,8 +1,8 @@
1
1
  import * as t from "io-ts"
2
2
 
3
- import { FieldTypes, SlicesTypes } from "../customtypes/widgets"
3
+ import { FieldType, SlicesTypes } from "../customtypes/widgets"
4
4
 
5
- export const FieldOrSliceType = t.union([FieldTypes, SlicesTypes])
5
+ export const FieldOrSliceType = t.union([FieldType, SlicesTypes])
6
6
  export type FieldOrSliceType = t.TypeOf<typeof FieldOrSliceType>
7
7
  export class LegacyContentCtx {
8
8
  fieldKey: string
@@ -35,7 +35,7 @@ export const isWidgetContent = (u: unknown): u is WidgetContent =>
35
35
  isSlicesContent(u)
36
36
 
37
37
  export type WidgetContent = t.TypeOf<typeof WidgetContent>
38
- export type WidgetTypes = WidgetContent["__TYPE__"]
38
+ export type ContentType = WidgetContent["__TYPE__"]
39
39
 
40
40
  export const WidgetLegacy = (ctx: LegacyContentCtx) => {
41
41
  return {
@@ -5,16 +5,16 @@ import { StringOrNull } from "../../validators"
5
5
  import { NestableWidget } from "./nestable/NestableWidget"
6
6
 
7
7
  export const GroupFieldType = "Group"
8
- const GroupConfig = t.exact(
8
+ export const GroupConfig = t.exact(
9
9
  t.partial({
10
10
  label: StringOrNull,
11
11
  repeat: t.boolean,
12
12
  fields: t.record(WidgetKey, NestableWidget),
13
13
  }),
14
14
  )
15
- type GroupConfig = t.TypeOf<typeof GroupConfig>
15
+ export type GroupConfig = t.TypeOf<typeof GroupConfig>
16
16
 
17
- const Group = t.exact(
17
+ export const Group = t.exact(
18
18
  t.intersection([
19
19
  t.type({
20
20
  type: t.literal(GroupFieldType),
@@ -27,6 +27,4 @@ const Group = t.exact(
27
27
  }),
28
28
  ]),
29
29
  )
30
- type Group = t.TypeOf<typeof Group>
31
-
32
- export default Group
30
+ export type Group = t.TypeOf<typeof Group>
@@ -4,16 +4,16 @@ import { StringOrNull } from "../../validators"
4
4
 
5
5
  export const UIDFieldType = "UID"
6
6
 
7
- const UIDConfig = t.exact(
7
+ export const UIDConfig = t.exact(
8
8
  t.partial({
9
9
  label: StringOrNull,
10
10
  useAsTitle: t.boolean,
11
11
  placeholder: t.string,
12
12
  }),
13
13
  )
14
- type UIDConfig = t.TypeOf<typeof UIDConfig>
14
+ export type UIDConfig = t.TypeOf<typeof UIDConfig>
15
15
 
16
- const UID = t.exact(
16
+ export const UID = t.exact(
17
17
  t.intersection([
18
18
  t.type({
19
19
  type: t.literal(UIDFieldType),
@@ -24,6 +24,4 @@ const UID = t.exact(
24
24
  }),
25
25
  ]),
26
26
  )
27
- type UID = t.TypeOf<typeof UID>
28
-
29
- export default UID
27
+ export type UID = t.TypeOf<typeof UID>
@@ -1,6 +1,6 @@
1
1
  import * as t from "io-ts"
2
2
 
3
- import Group, { GroupFieldType } from "./Group"
3
+ import { Group, GroupFieldType } from "./Group"
4
4
  import {
5
5
  BooleanFieldType,
6
6
  ColorFieldType,
@@ -27,7 +27,7 @@ import {
27
27
  SlicesFieldType,
28
28
  StaticSlices,
29
29
  } from "./slices/Slices"
30
- import UID, { UIDFieldType } from "./UID"
30
+ import { UID, UIDFieldType } from "./UID"
31
31
 
32
32
  export function widgetReader<T extends StaticSlices | DynamicSlices>(
33
33
  codec: t.Type<T, unknown>,
@@ -41,7 +41,7 @@ export type StaticWidget = t.TypeOf<typeof StaticWidget>
41
41
  export const DynamicWidget = widgetReader(DynamicSlices)
42
42
  export type DynamicWidget = t.TypeOf<typeof DynamicWidget>
43
43
 
44
- export const FieldTypes = t.keyof({
44
+ export const FieldType = t.keyof({
45
45
  [ColorFieldType]: null,
46
46
  [BooleanFieldType]: null,
47
47
  [NumberFieldType]: null,
@@ -63,7 +63,7 @@ export const FieldTypes = t.keyof({
63
63
  [LegacySlicesFieldType]: null,
64
64
  })
65
65
 
66
- export type FieldTypes = t.TypeOf<typeof FieldTypes>
66
+ export type FieldType = t.TypeOf<typeof FieldType>
67
67
 
68
68
  export const Widgets = {
69
69
  toStatic(
@@ -75,7 +75,7 @@ export const Widgets = {
75
75
  case "Slices":
76
76
  return Slices.toStatic(widget, sharedSlices)
77
77
  default:
78
- return widget as StaticWidget
78
+ return widget
79
79
  }
80
80
  },
81
81
  }
@@ -94,5 +94,3 @@ export const Link = t.exact(
94
94
  ]),
95
95
  )
96
96
  export type Link = t.TypeOf<typeof Link>
97
-
98
- export default Link
@@ -9,7 +9,7 @@ export const RichTextFieldType = "StructuredText"
9
9
  export const DEFAULT_OPTION = "paragraph"
10
10
 
11
11
  export type RichTextNodeType =
12
- typeof RichTextNodeType[keyof typeof RichTextNodeType]
12
+ (typeof RichTextNodeType)[keyof typeof RichTextNodeType]
13
13
  export const RichTextNodeType = {
14
14
  heading1: "heading1",
15
15
  heading2: "heading2",
@@ -25,5 +25,3 @@ export const Text = t.exact(
25
25
  ]),
26
26
  )
27
27
  export type Text = t.TypeOf<typeof Text>
28
-
29
- export default Text
@@ -6,14 +6,14 @@ import { NestableWidget } from "../nestable/NestableWidget"
6
6
 
7
7
  export const CompositeSliceType = "Slice"
8
8
 
9
- const CompositeSliceConfig = t.exact(
9
+ export const CompositeSliceConfig = t.exact(
10
10
  t.partial({
11
11
  label: StringOrNull,
12
12
  }),
13
13
  )
14
- type CompositeSliceConfig = t.TypeOf<typeof CompositeSliceConfig>
14
+ export type CompositeSliceConfig = t.TypeOf<typeof CompositeSliceConfig>
15
15
 
16
- const CompositeSlice = t.exact(
16
+ export const CompositeSlice = t.exact(
17
17
  t.intersection([
18
18
  t.type({
19
19
  type: t.literal(CompositeSliceType),
@@ -29,6 +29,4 @@ const CompositeSlice = t.exact(
29
29
  }),
30
30
  ]),
31
31
  )
32
- type CompositeSlice = t.TypeOf<typeof CompositeSlice>
33
-
34
- export default CompositeSlice
32
+ export type CompositeSlice = t.TypeOf<typeof CompositeSlice>
@@ -1,10 +1,8 @@
1
1
  import * as t from "io-ts"
2
2
 
3
- import Group from "../Group"
3
+ import { Group } from "../Group"
4
4
  import { NestableWidget } from "../nestable/NestableWidget"
5
5
 
6
- const LegacySlice = t.union([NestableWidget, Group])
6
+ export const LegacySlice = t.union([NestableWidget, Group])
7
7
 
8
- type LegacySlice = t.TypeOf<typeof LegacySlice>
9
-
10
- export default LegacySlice
8
+ export type LegacySlice = t.TypeOf<typeof LegacySlice>
@@ -2,11 +2,9 @@ import * as t from "io-ts"
2
2
 
3
3
  import { SharedSliceType } from "./SharedSlice"
4
4
 
5
- const SharedSliceRef = t.exact(
5
+ export const SharedSliceRef = t.exact(
6
6
  t.type({
7
7
  type: t.literal(SharedSliceType),
8
8
  }),
9
9
  )
10
- type SharedSliceRef = t.TypeOf<typeof SharedSliceRef>
11
-
12
- export default SharedSliceRef
10
+ export type SharedSliceRef = t.TypeOf<typeof SharedSliceRef>
@@ -1,7 +1,7 @@
1
- import type CompositeSlice from "./CompositeSlice"
2
- import type LegacySlice from "./LegacySlice"
1
+ import type { CompositeSlice } from "./CompositeSlice"
2
+ import type { LegacySlice } from "./LegacySlice"
3
3
  import type { SharedSlice } from "./SharedSlice"
4
- import type SharedSliceRef from "./SharedSliceRef"
4
+ import type { SharedSliceRef } from "./SharedSliceRef"
5
5
 
6
6
  export type DynamicSlice = CompositeSlice | LegacySlice | SharedSliceRef
7
7
  export type StaticSlice = CompositeSlice | LegacySlice | SharedSlice
@@ -2,10 +2,10 @@ import * as t from "io-ts"
2
2
 
3
3
  import { WidgetKey } from "../../../common"
4
4
  import { StringOrNull } from "../../../validators"
5
- import CompositeSlice from "./CompositeSlice"
6
- import LegacySlice from "./LegacySlice"
5
+ import { CompositeSlice } from "./CompositeSlice"
6
+ import { LegacySlice } from "./LegacySlice"
7
7
  import { SharedSlice } from "./SharedSlice"
8
- import SharedSliceRef from "./SharedSliceRef"
8
+ import { SharedSliceRef } from "./SharedSliceRef"
9
9
 
10
10
  export const LegacySlicesFieldType = "Choice"
11
11
  export const SlicesFieldType = "Slices"
@@ -1,7 +1,7 @@
1
- export { default as CompositeSlice } from "./CompositeSlice"
2
- export { default as LegacySlice } from "./LegacySlice"
1
+ export { CompositeSlice } from "./CompositeSlice"
2
+ export { LegacySlice } from "./LegacySlice"
3
3
  export * from "./SharedSlice"
4
- export { default as SharedSliceRef } from "./SharedSliceRef"
4
+ export { SharedSliceRef } from "./SharedSliceRef"
5
5
  export * as Slice from "./Slice"
6
6
  export * as SliceZone from "./Slices"
7
7
  export { SlicesTypes } from "./SlicesTypes"