@prismicio/types-internal 0.2.6 → 0.2.9

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.
@@ -3,21 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Widgets = exports.DynamicWidget = exports.StaticWidget = exports.widgetReader = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const t = (0, tslib_1.__importStar)(require("io-ts"));
6
- const Format_1 = require("../Format");
7
6
  const Group_1 = (0, tslib_1.__importDefault)(require("./Group"));
8
7
  const NestableWidget_1 = (0, tslib_1.__importDefault)(require("./nestable/NestableWidget"));
9
8
  const Slices_1 = require("./slices/Slices");
10
9
  const UID_1 = (0, tslib_1.__importDefault)(require("./UID"));
11
10
  const WidgetTypes_1 = (0, tslib_1.__importDefault)(require("./WidgetTypes"));
12
- function widgetReader(format) {
13
- return t.union([UID_1.default, NestableWidget_1.default, Group_1.default, (0, Slices_1.slicesReader)(format)]);
11
+ function widgetReader(codec) {
12
+ return t.union([UID_1.default, NestableWidget_1.default, Group_1.default, codec]);
14
13
  }
15
14
  exports.widgetReader = widgetReader;
16
- exports.StaticWidget = widgetReader(Format_1.Format.Static);
17
- exports.DynamicWidget = widgetReader(Format_1.Format.Dynamic);
15
+ exports.StaticWidget = widgetReader(Slices_1.StaticSlices);
16
+ exports.DynamicWidget = widgetReader(Slices_1.DynamicSlices);
18
17
  exports.Widgets = {
19
18
  toStatic(widget, sharedSlices) {
20
19
  switch (widget.type) {
20
+ case WidgetTypes_1.default.LegacySlices:
21
21
  case WidgetTypes_1.default.Slices:
22
22
  return Slices_1.Slices.toStatic(widget, sharedSlices);
23
23
  default:
@@ -20,6 +20,20 @@ export declare enum RichTextNodeType {
20
20
  rtl = "rtl"
21
21
  }
22
22
  export declare function parseRichTextNodeType(str: string): RichTextNodeType | undefined;
23
+ export declare const RichTextConfig: t.ExactC<t.PartialC<{
24
+ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
25
+ placeholder: t.StringC;
26
+ useAsTitle: t.BooleanC;
27
+ single: t.Type<string, string, unknown>;
28
+ multi: t.Type<string, string, unknown>;
29
+ imageConstraint: t.PartialC<{
30
+ width: t.Type<number | null, unknown, unknown>;
31
+ height: t.Type<number | null, unknown, unknown>;
32
+ }>;
33
+ labels: t.Type<string[], object, unknown>;
34
+ allowTargetBlank: t.BooleanC;
35
+ }>>;
36
+ export declare type RichTextConfig = t.TypeOf<typeof RichTextConfig>;
23
37
  export declare const RichText: t.ExactC<t.IntersectionC<[t.TypeC<{
24
38
  type: t.LiteralC<WidgetTypes.RichText>;
25
39
  }>, t.PartialC<{
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RichText = exports.parseRichTextNodeType = exports.RichTextNodeType = exports.DEFAULT_OPTION = void 0;
3
+ exports.RichText = exports.RichTextConfig = exports.parseRichTextNodeType = exports.RichTextNodeType = exports.DEFAULT_OPTION = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const Either_1 = require("fp-ts/lib/Either");
6
6
  const t = (0, tslib_1.__importStar)(require("io-ts"));
@@ -130,7 +130,7 @@ const RichTextLabels = new t.Type("RichTextLabels", (u) => {
130
130
  t.failure(u, context));
131
131
  });
132
132
  }, (res) => res);
133
- const RichTextConfig = t.exact(t.partial({
133
+ exports.RichTextConfig = t.exact(t.partial({
134
134
  label: validators_1.StringOrNull,
135
135
  placeholder: t.string,
136
136
  useAsTitle: t.boolean,
@@ -146,6 +146,6 @@ exports.RichText = t.exact(t.intersection([
146
146
  }),
147
147
  t.partial({
148
148
  fieldset: validators_1.StringOrNull,
149
- config: RichTextConfig,
149
+ config: exports.RichTextConfig,
150
150
  }),
151
151
  ]));