@prismicio/types-internal
Advanced tools
Comparing version 0.2.4 to 0.2.6
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.filterMissingSharedSlices = exports.collectWidgets = exports.validateSlices = exports.toStatic = exports.CustomType = exports.StaticCustomType = void 0; | ||
exports.filterMissingSharedSlices = exports.collectWidgets = exports.validateSlices = exports.toStatic = exports.flattenWidgets = exports.CustomType = exports.StaticCustomType = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -54,8 +54,11 @@ const Either_1 = require("fp-ts/lib/Either"); | ||
exports.CustomType = customTypeReader(Format_1.Format.Dynamic); | ||
function _retrieveSharedSlicesRef(customType) { | ||
const flattenWidgets = Object.entries(customType.json).reduce((acc, [, section]) => { | ||
function flattenWidgets(customType) { | ||
return Object.entries(customType.json).reduce((acc, [, section]) => { | ||
const sectionWidgets = Object.entries(section); | ||
return acc.concat(sectionWidgets); | ||
}, []); | ||
const slicezones = flattenWidgets.filter(([, widget]) => widget.type === WidgetTypes_1.default.Slices); | ||
} | ||
exports.flattenWidgets = flattenWidgets; | ||
function _retrieveSharedSlicesRef(customType) { | ||
const slicezones = flattenWidgets(customType).filter(([, widget]) => widget.type === WidgetTypes_1.default.Slices); | ||
const allSharedRefs = slicezones.reduce((acc, [, slicezone]) => { | ||
@@ -62,0 +65,0 @@ const sharedRefs = Object.entries(slicezone.config && slicezone.config.choices |
export { default as BooleanField } from "./BooleanField"; | ||
export { default as Color } from "./Color"; | ||
export { default as Date } from "./Date"; | ||
export { default as Embed } from "./Embed"; | ||
export { default as GeoPoint } from "./GeoPoint"; | ||
@@ -11,3 +12,3 @@ export { default as Image } from "./Image"; | ||
export { default as Range } from "./Range"; | ||
export { default as RichText } from "./RichText"; | ||
export * from "./RichText"; | ||
export { default as Select } from "./Select"; | ||
@@ -14,0 +15,0 @@ export { default as Separator } from "./Separator"; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Timestamp = exports.Text = exports.Separator = exports.Select = exports.RichText = exports.Range = exports.Number = exports.NestableWidget = exports.Link = exports.IntegrationField = exports.Image = exports.GeoPoint = exports.Date = exports.Color = exports.BooleanField = void 0; | ||
exports.Timestamp = exports.Text = exports.Separator = exports.Select = exports.Range = exports.Number = exports.NestableWidget = exports.Link = exports.IntegrationField = exports.Image = exports.GeoPoint = exports.Embed = exports.Date = exports.Color = exports.BooleanField = void 0; | ||
const tslib_1 = require("tslib"); | ||
var BooleanField_1 = require("./BooleanField"); | ||
Object.defineProperty(exports, "BooleanField", { enumerable: true, get: function () { return __importDefault(BooleanField_1).default; } }); | ||
Object.defineProperty(exports, "BooleanField", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(BooleanField_1).default; } }); | ||
var Color_1 = require("./Color"); | ||
Object.defineProperty(exports, "Color", { enumerable: true, get: function () { return __importDefault(Color_1).default; } }); | ||
Object.defineProperty(exports, "Color", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Color_1).default; } }); | ||
var Date_1 = require("./Date"); | ||
Object.defineProperty(exports, "Date", { enumerable: true, get: function () { return __importDefault(Date_1).default; } }); | ||
Object.defineProperty(exports, "Date", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Date_1).default; } }); | ||
var Embed_1 = require("./Embed"); | ||
Object.defineProperty(exports, "Embed", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Embed_1).default; } }); | ||
var GeoPoint_1 = require("./GeoPoint"); | ||
Object.defineProperty(exports, "GeoPoint", { enumerable: true, get: function () { return __importDefault(GeoPoint_1).default; } }); | ||
Object.defineProperty(exports, "GeoPoint", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(GeoPoint_1).default; } }); | ||
var Image_1 = require("./Image"); | ||
Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return __importDefault(Image_1).default; } }); | ||
Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Image_1).default; } }); | ||
var IntegrationField_1 = require("./IntegrationField"); | ||
Object.defineProperty(exports, "IntegrationField", { enumerable: true, get: function () { return __importDefault(IntegrationField_1).default; } }); | ||
Object.defineProperty(exports, "IntegrationField", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(IntegrationField_1).default; } }); | ||
var Link_1 = require("./Link"); | ||
Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return __importDefault(Link_1).default; } }); | ||
Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Link_1).default; } }); | ||
var NestableWidget_1 = require("./NestableWidget"); | ||
Object.defineProperty(exports, "NestableWidget", { enumerable: true, get: function () { return __importDefault(NestableWidget_1).default; } }); | ||
Object.defineProperty(exports, "NestableWidget", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(NestableWidget_1).default; } }); | ||
var Number_1 = require("./Number"); | ||
Object.defineProperty(exports, "Number", { enumerable: true, get: function () { return __importDefault(Number_1).default; } }); | ||
Object.defineProperty(exports, "Number", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Number_1).default; } }); | ||
var Range_1 = require("./Range"); | ||
Object.defineProperty(exports, "Range", { enumerable: true, get: function () { return __importDefault(Range_1).default; } }); | ||
var RichText_1 = require("./RichText"); | ||
Object.defineProperty(exports, "RichText", { enumerable: true, get: function () { return __importDefault(RichText_1).default; } }); | ||
Object.defineProperty(exports, "Range", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Range_1).default; } }); | ||
(0, tslib_1.__exportStar)(require("./RichText"), exports); | ||
var Select_1 = require("./Select"); | ||
Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return __importDefault(Select_1).default; } }); | ||
Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Select_1).default; } }); | ||
var Separator_1 = require("./Separator"); | ||
Object.defineProperty(exports, "Separator", { enumerable: true, get: function () { return __importDefault(Separator_1).default; } }); | ||
Object.defineProperty(exports, "Separator", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Separator_1).default; } }); | ||
var Text_1 = require("./Text"); | ||
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return __importDefault(Text_1).default; } }); | ||
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Text_1).default; } }); | ||
var Timestamp_1 = require("./Timestamp"); | ||
Object.defineProperty(exports, "Timestamp", { enumerable: true, get: function () { return __importDefault(Timestamp_1).default; } }); | ||
Object.defineProperty(exports, "Timestamp", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(Timestamp_1).default; } }); |
@@ -15,3 +15,3 @@ "use strict"; | ||
const Range_1 = (0, tslib_1.__importDefault)(require("./Range")); | ||
const RichText_1 = (0, tslib_1.__importDefault)(require("./RichText")); | ||
const RichText_1 = require("./RichText"); | ||
const Select_1 = (0, tslib_1.__importDefault)(require("./Select")); | ||
@@ -29,3 +29,3 @@ const Separator_1 = (0, tslib_1.__importDefault)(require("./Separator")); | ||
Range_1.default, | ||
RichText_1.default, | ||
RichText_1.RichText, | ||
Select_1.default, | ||
@@ -32,0 +32,0 @@ Separator_1.default, |
import * as t from "io-ts"; | ||
import WidgetTypes from "../WidgetTypes"; | ||
declare const RichText: t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
export declare const DEFAULT_OPTION = "paragraph"; | ||
export declare enum RichTextNodeType { | ||
heading1 = "heading1", | ||
heading2 = "heading2", | ||
heading3 = "heading3", | ||
heading4 = "heading4", | ||
heading5 = "heading5", | ||
heading6 = "heading6", | ||
paragraph = "paragraph", | ||
strong = "strong", | ||
em = "em", | ||
preformatted = "preformatted", | ||
hyperlink = "hyperlink", | ||
image = "image", | ||
embed = "embed", | ||
list = "list-item", | ||
orderedList = "o-list-item", | ||
rtl = "rtl" | ||
} | ||
export declare function parseRichTextNodeType(str: string): RichTextNodeType | undefined; | ||
export declare const RichText: t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<WidgetTypes.RichText>; | ||
@@ -21,3 +41,2 @@ }>, t.PartialC<{ | ||
}>]>>; | ||
declare type RichText = t.TypeOf<typeof RichText>; | ||
export default RichText; | ||
export declare type RichText = t.TypeOf<typeof RichText>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.RichText = exports.parseRichTextNodeType = exports.RichTextNodeType = exports.DEFAULT_OPTION = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -9,29 +10,69 @@ const Either_1 = require("fp-ts/lib/Either"); | ||
const WidgetTypes_1 = (0, tslib_1.__importDefault)(require("../WidgetTypes")); | ||
const DEFAULT_OPTION = "paragraph"; | ||
const options = [ | ||
"heading1", | ||
"heading2", | ||
"heading3", | ||
"heading4", | ||
"heading5", | ||
"heading6", | ||
"paragraph", | ||
"strong", | ||
"em", | ||
"preformatted", | ||
"hyperlink", | ||
"image", | ||
"embed", | ||
"list-item", | ||
"o-list-item", | ||
"rtl", | ||
]; | ||
exports.DEFAULT_OPTION = "paragraph"; | ||
var RichTextNodeType; | ||
(function (RichTextNodeType) { | ||
RichTextNodeType["heading1"] = "heading1"; | ||
RichTextNodeType["heading2"] = "heading2"; | ||
RichTextNodeType["heading3"] = "heading3"; | ||
RichTextNodeType["heading4"] = "heading4"; | ||
RichTextNodeType["heading5"] = "heading5"; | ||
RichTextNodeType["heading6"] = "heading6"; | ||
RichTextNodeType["paragraph"] = "paragraph"; | ||
RichTextNodeType["strong"] = "strong"; | ||
RichTextNodeType["em"] = "em"; | ||
RichTextNodeType["preformatted"] = "preformatted"; | ||
RichTextNodeType["hyperlink"] = "hyperlink"; | ||
RichTextNodeType["image"] = "image"; | ||
RichTextNodeType["embed"] = "embed"; | ||
RichTextNodeType["list"] = "list-item"; | ||
RichTextNodeType["orderedList"] = "o-list-item"; | ||
RichTextNodeType["rtl"] = "rtl"; | ||
})(RichTextNodeType = exports.RichTextNodeType || (exports.RichTextNodeType = {})); | ||
function parseRichTextNodeType(str) { | ||
switch (str) { | ||
case RichTextNodeType.heading1: | ||
return RichTextNodeType.heading1; | ||
case RichTextNodeType.heading2: | ||
return RichTextNodeType.heading2; | ||
case RichTextNodeType.heading3: | ||
return RichTextNodeType.heading3; | ||
case RichTextNodeType.heading4: | ||
return RichTextNodeType.heading4; | ||
case RichTextNodeType.heading5: | ||
return RichTextNodeType.heading5; | ||
case RichTextNodeType.heading6: | ||
return RichTextNodeType.heading6; | ||
case RichTextNodeType.paragraph: | ||
return RichTextNodeType.paragraph; | ||
case RichTextNodeType.strong: | ||
return RichTextNodeType.strong; | ||
case RichTextNodeType.em: | ||
return RichTextNodeType.em; | ||
case RichTextNodeType.preformatted: | ||
return RichTextNodeType.preformatted; | ||
case RichTextNodeType.hyperlink: | ||
return RichTextNodeType.hyperlink; | ||
case RichTextNodeType.image: | ||
return RichTextNodeType.image; | ||
case RichTextNodeType.embed: | ||
return RichTextNodeType.embed; | ||
case RichTextNodeType.list: | ||
return RichTextNodeType.list; | ||
case RichTextNodeType.orderedList: | ||
return RichTextNodeType.orderedList; | ||
case RichTextNodeType.rtl: | ||
return RichTextNodeType.rtl; | ||
default: | ||
return; | ||
} | ||
} | ||
exports.parseRichTextNodeType = parseRichTextNodeType; | ||
const RichTextOptions = new t.Type("RichTextOptions", (u) => typeof u === "string", (u, context) => { | ||
return Either_1.either.chain(t.union([t.string, t.null]).validate(u, context), (s) => { | ||
if (!s) | ||
return t.success(DEFAULT_OPTION); | ||
return t.success(exports.DEFAULT_OPTION); | ||
const entries = s.split(",").map((e) => e.trim()); | ||
const filtered = entries.filter((entry) => options.includes(entry)); | ||
const filtered = entries.filter((entry) => parseRichTextNodeType(entry)); | ||
if (!filtered.length) | ||
return t.success(DEFAULT_OPTION); | ||
return t.success(exports.DEFAULT_OPTION); | ||
return t.success(filtered.join(",")); | ||
@@ -103,3 +144,3 @@ }); | ||
})); | ||
const RichText = t.exact(t.intersection([ | ||
exports.RichText = t.exact(t.intersection([ | ||
t.type({ | ||
@@ -113,2 +154,1 @@ type: t.literal(WidgetTypes_1.default.RichText), | ||
])); | ||
exports.default = RichText; |
export { default as CompositeSlice } from "./CompositeSlice"; | ||
export { default as LegacySlice } from "./LegacySlice"; | ||
export { default as SharedSlice } from "./SharedSlice"; | ||
export * from "./SharedSlice"; | ||
export { default as SharedSliceRef } from "./SharedSliceRef"; | ||
@@ -5,0 +5,0 @@ export * as Slice from "./Slice"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SlicesTypes = exports.SliceZone = exports.Slice = exports.SharedSliceRef = exports.SharedSlice = exports.LegacySlice = exports.CompositeSlice = void 0; | ||
exports.SlicesTypes = exports.SliceZone = exports.Slice = exports.SharedSliceRef = exports.LegacySlice = exports.CompositeSlice = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -9,4 +9,3 @@ var CompositeSlice_1 = require("./CompositeSlice"); | ||
Object.defineProperty(exports, "LegacySlice", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(LegacySlice_1).default; } }); | ||
var SharedSlice_1 = require("./SharedSlice"); | ||
Object.defineProperty(exports, "SharedSlice", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(SharedSlice_1).default; } }); | ||
(0, tslib_1.__exportStar)(require("./SharedSlice"), exports); | ||
var SharedSliceRef_1 = require("./SharedSliceRef"); | ||
@@ -13,0 +12,0 @@ Object.defineProperty(exports, "SharedSliceRef", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(SharedSliceRef_1).default; } }); |
import * as t from "io-ts"; | ||
import SlicesTypes from "./SlicesTypes"; | ||
declare const SharedSlice: t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
export declare const Variation: t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
id: t.StringC; | ||
name: t.StringC; | ||
description: t.StringC; | ||
imageUrl: t.StringC; | ||
docURL: t.StringC; | ||
version: t.StringC; | ||
}>, t.PartialC<{ | ||
display: t.StringC; | ||
primary: t.RecordC<t.StringC, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Color>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.BooleanField>; | ||
}>, t.PartialC<{ | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
default_value: t.BooleanC; | ||
placeholder_true: t.StringC; | ||
placeholder_false: t.StringC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Embed>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
useAsTitle: t.BooleanC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.GeoPoint>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Date>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
default: t.StringC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Number>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>; | ||
max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>; | ||
step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Range>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>; | ||
max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>; | ||
step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.RichText>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
useAsTitle: t.BooleanC; | ||
single: t.Type<string, string, unknown>; | ||
multi: t.Type<string, string, unknown>; | ||
imageConstraint: t.PartialC<{ | ||
width: t.Type<number | null, unknown, unknown>; | ||
height: t.Type<number | null, unknown, unknown>; | ||
}>; | ||
labels: t.Type<string[], object, unknown>; | ||
allowTargetBlank: t.BooleanC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Select>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
default_value: t.StringC; | ||
options: t.ArrayC<t.UnionC<[t.StringC, t.Type<string, string, unknown>, t.Type<string, string, unknown>]>>; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Separator>; | ||
}>, t.PartialC<{ | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Text>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
useAsTitle: t.BooleanC; | ||
placeholder: t.StringC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Timestamp>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
default: t.StringC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Link>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
useAsTitle: t.BooleanC; | ||
placeholder: t.StringC; | ||
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>; | ||
customtypes: t.ArrayC<t.StringC>; | ||
masks: t.Type<string[], object, unknown>; | ||
tags: t.Type<string[], object, unknown>; | ||
allowTargetBlank: t.BooleanC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Image>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
constraint: t.PartialC<{ | ||
width: t.Type<number | null, unknown, unknown>; | ||
height: t.Type<number | null, unknown, unknown>; | ||
}>; | ||
thumbnails: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
name: t.StringC; | ||
}>, t.PartialC<{ | ||
width: t.Type<number | null, unknown, unknown>; | ||
height: t.Type<number | null, unknown, unknown>; | ||
}>]>>>; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.IntegrationField>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
catalog: t.StringC; | ||
}>>; | ||
}>]>>]>>; | ||
items: t.RecordC<t.StringC, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Color>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.BooleanField>; | ||
}>, t.PartialC<{ | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
default_value: t.BooleanC; | ||
placeholder_true: t.StringC; | ||
placeholder_false: t.StringC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Embed>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
useAsTitle: t.BooleanC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.GeoPoint>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Date>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
default: t.StringC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Number>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>; | ||
max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>; | ||
step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Range>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
min: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>; | ||
max: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>; | ||
step: t.UnionC<[t.NumberC, import("io-ts-types").NumberFromStringC]>; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.RichText>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
useAsTitle: t.BooleanC; | ||
single: t.Type<string, string, unknown>; | ||
multi: t.Type<string, string, unknown>; | ||
imageConstraint: t.PartialC<{ | ||
width: t.Type<number | null, unknown, unknown>; | ||
height: t.Type<number | null, unknown, unknown>; | ||
}>; | ||
labels: t.Type<string[], object, unknown>; | ||
allowTargetBlank: t.BooleanC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Select>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
default_value: t.StringC; | ||
options: t.ArrayC<t.UnionC<[t.StringC, t.Type<string, string, unknown>, t.Type<string, string, unknown>]>>; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Separator>; | ||
}>, t.PartialC<{ | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Text>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
useAsTitle: t.BooleanC; | ||
placeholder: t.StringC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Timestamp>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
default: t.StringC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Link>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
useAsTitle: t.BooleanC; | ||
placeholder: t.StringC; | ||
select: t.UnionC<[t.LiteralC<"media">, t.LiteralC<"document">, t.LiteralC<"web">, t.NullC]>; | ||
customtypes: t.ArrayC<t.StringC>; | ||
masks: t.Type<string[], object, unknown>; | ||
tags: t.Type<string[], object, unknown>; | ||
allowTargetBlank: t.BooleanC; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Image>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
constraint: t.PartialC<{ | ||
width: t.Type<number | null, unknown, unknown>; | ||
height: t.Type<number | null, unknown, unknown>; | ||
}>; | ||
thumbnails: t.ArrayC<t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
name: t.StringC; | ||
}>, t.PartialC<{ | ||
width: t.Type<number | null, unknown, unknown>; | ||
height: t.Type<number | null, unknown, unknown>; | ||
}>]>>>; | ||
}>>; | ||
}>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.IntegrationField>; | ||
}>, t.PartialC<{ | ||
fieldset: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
config: t.ExactC<t.PartialC<{ | ||
label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
placeholder: t.StringC; | ||
catalog: t.StringC; | ||
}>>; | ||
}>]>>]>>; | ||
}>]>>; | ||
export declare type Variation = t.TypeOf<typeof Variation>; | ||
export declare const SharedSlice: t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
id: t.StringC; | ||
type: t.LiteralC<SlicesTypes.SharedSlice>; | ||
@@ -334,3 +659,2 @@ name: t.StringC; | ||
}>]>>; | ||
declare type SharedSlice = t.TypeOf<typeof SharedSlice>; | ||
export default SharedSlice; | ||
export declare type SharedSlice = t.TypeOf<typeof SharedSlice>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SharedSlice = exports.Variation = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -9,3 +10,3 @@ const t = (0, tslib_1.__importStar)(require("io-ts")); | ||
const IMAGE_PLACEHOLDER_URL = "https://images.prismic.io/slice-machine/621a5ec4-0387-4bc5-9860-2dd46cbc07cd_default_ss.png?auto=compress,format"; | ||
const Variation = t.exact(t.intersection([ | ||
exports.Variation = t.exact(t.intersection([ | ||
t.type({ | ||
@@ -25,3 +26,3 @@ id: t.string, | ||
])); | ||
const SharedSlice = t.exact(t.intersection([ | ||
exports.SharedSlice = t.exact(t.intersection([ | ||
t.type({ | ||
@@ -31,3 +32,3 @@ id: t.string, | ||
name: t.string, | ||
variations: t.array(Variation), | ||
variations: t.array(exports.Variation), | ||
}), | ||
@@ -38,2 +39,1 @@ t.partial({ | ||
])); | ||
exports.default = SharedSlice; |
import type CompositeSlice from "./CompositeSlice"; | ||
import type LegacySlice from "./LegacySlice"; | ||
import type SharedSlice from "./SharedSlice"; | ||
import type { SharedSlice } from "./SharedSlice"; | ||
import type SharedSliceRef from "./SharedSliceRef"; | ||
export declare type DynamicSlice = CompositeSlice | LegacySlice | SharedSliceRef; | ||
export declare type StaticSlice = CompositeSlice | LegacySlice | SharedSlice; |
@@ -11,3 +11,3 @@ "use strict"; | ||
const LegacySlice_1 = (0, tslib_1.__importDefault)(require("./LegacySlice")); | ||
const SharedSlice_1 = (0, tslib_1.__importDefault)(require("./SharedSlice")); | ||
const SharedSlice_1 = require("./SharedSlice"); | ||
const SharedSliceRef_1 = (0, tslib_1.__importDefault)(require("./SharedSliceRef")); | ||
@@ -36,3 +36,3 @@ const SlicesTypes_1 = (0, tslib_1.__importDefault)(require("./SlicesTypes")); | ||
case Format_1.Format.Static: | ||
return SharedSlice_1.default; | ||
return SharedSlice_1.SharedSlice; | ||
case Format_1.Format.Dynamic: | ||
@@ -39,0 +39,0 @@ return SharedSliceRef_1.default; |
@@ -11,7 +11,7 @@ import { SlicesContent } from "./slices/SlicesContent"; | ||
export declare const WidgetTypes: { | ||
Empty: string; | ||
UID: string; | ||
Group: string; | ||
slices: string; | ||
Links: { | ||
readonly Empty: "EmptyContent"; | ||
readonly UID: "UIDContent"; | ||
readonly Group: "GroupContentType"; | ||
readonly slices: "SliceContentType"; | ||
readonly Links: { | ||
readonly DocumentLink: "DocumentLink"; | ||
@@ -23,10 +23,10 @@ readonly FileLink: "FileLink"; | ||
}; | ||
StructuredText: "StructuredTextContent"; | ||
Boolean: "BooleanContent"; | ||
Embed: "EmbedContent"; | ||
Field: "FieldContent"; | ||
GeoPoint: "GeoPointContent"; | ||
Image: "ImageContent"; | ||
IntegrationFields: "IntegrationFieldsContent"; | ||
Separator: "SeparatorContent"; | ||
readonly StructuredText: "StructuredTextContent"; | ||
readonly Boolean: "BooleanContent"; | ||
readonly Embed: "EmbedContent"; | ||
readonly Field: "FieldContent"; | ||
readonly GeoPoint: "GeoPointContent"; | ||
readonly Image: "ImageContent"; | ||
readonly IntegrationFields: "IntegrationFieldsContent"; | ||
readonly Separator: "SeparatorContent"; | ||
}; | ||
@@ -33,0 +33,0 @@ export declare type WidgetKey = string; |
import * as t from "io-ts"; | ||
export declare const EmbedContentType = "EmbedContent"; | ||
declare type EmbedContent = t.OutputOf<typeof EmbedContentC> & { | ||
export declare type EmbedContent = t.TypeOf<typeof EmbedContentC> & { | ||
all: unknown; | ||
}; | ||
declare const EmbedContent: t.Type<EmbedContent, unknown, unknown>; | ||
export declare type EmbedContentO = t.OutputOf<typeof EmbedContentC> & { | ||
all: unknown; | ||
}; | ||
export declare const EmbedContent: t.Type<EmbedContentO, unknown, unknown>; | ||
declare const EmbedContentC: t.Type<{ | ||
@@ -40,2 +43,2 @@ embed_url: string; | ||
}, unknown>; | ||
export default EmbedContent; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EmbedContentType = void 0; | ||
exports.EmbedContent = exports.EmbedContentType = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -11,3 +11,3 @@ const fp_ts_1 = require("fp-ts"); | ||
exports.EmbedContentType = "EmbedContent"; | ||
const EmbedContent = new t.Type("EmbedContent", (u) => u.__TYPE__ === exports.EmbedContentType, (u) => { | ||
exports.EmbedContent = new t.Type("EmbedContent", (u) => u.__TYPE__ === exports.EmbedContentType, (u) => { | ||
return (0, function_1.pipe)(EmbedContentC.decode(u), fp_ts_1.either.map((s) => ({ | ||
@@ -37,2 +37,1 @@ ...EmbedContentC.encode(s), | ||
])), exports.EmbedContentType); | ||
exports.default = EmbedContent; |
import * as O from "fp-ts/Option"; | ||
export declare type FieldType = "Text" | "Date" | "Timestamp" | "Color" | "Number" | "Range" | "Select"; | ||
export declare const FieldContentType = "FieldContent"; | ||
declare type FieldContent = { | ||
value: string; | ||
type: string; | ||
type: FieldType; | ||
__TYPE__: typeof FieldContentType; | ||
@@ -10,4 +11,4 @@ }; | ||
types: string[]; | ||
forType: (type: string, value: unknown) => O.Option<FieldContent>; | ||
forType: (type: FieldType, value: unknown) => O.Option<FieldContent>; | ||
}; | ||
export default FieldContent; |
export { default as BooleanContent } from "./BooleanContent"; | ||
export { default as EmbedContent } from "./EmbedContent"; | ||
export * from "./EmbedContent"; | ||
export { default as FieldContent } from "./FieldContent"; | ||
@@ -4,0 +4,0 @@ export { type GeoPointContentO, GeoPointContent } from "./GeoPointContent"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NestableTypes = exports.Links = exports.IntegrationFieldsContent = exports.ImageContentView = exports.ImageContent = exports.GeoPointContent = exports.FieldContent = exports.EmbedContent = exports.BooleanContent = void 0; | ||
exports.NestableTypes = exports.Links = exports.IntegrationFieldsContent = exports.ImageContentView = exports.ImageContent = exports.GeoPointContent = exports.FieldContent = exports.BooleanContent = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -16,4 +16,3 @@ const BooleanContent_1 = require("./BooleanContent"); | ||
Object.defineProperty(exports, "BooleanContent", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(BooleanContent_2).default; } }); | ||
var EmbedContent_2 = require("./EmbedContent"); | ||
Object.defineProperty(exports, "EmbedContent", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(EmbedContent_2).default; } }); | ||
(0, tslib_1.__exportStar)(require("./EmbedContent"), exports); | ||
var FieldContent_2 = require("./FieldContent"); | ||
@@ -20,0 +19,0 @@ Object.defineProperty(exports, "FieldContent", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(FieldContent_2).default; } }); |
import * as t from "io-ts"; | ||
import EmbedContent from "../EmbedContent"; | ||
export declare const Meta: t.ExactC<t.IntersectionC<[t.PartialC<{ | ||
@@ -122,3 +121,3 @@ data: t.UnknownC; | ||
type: t.LiteralC<"embed">; | ||
data: t.Type<EmbedContent, unknown, unknown>; | ||
data: t.Type<import("../EmbedContent").EmbedContentO, unknown, unknown>; | ||
}>, t.PartialC<{ | ||
@@ -248,3 +247,3 @@ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; | ||
type: t.LiteralC<"embed">; | ||
data: t.Type<EmbedContent, unknown, unknown>; | ||
data: t.Type<import("../EmbedContent").EmbedContentO, unknown, unknown>; | ||
}>, t.PartialC<{ | ||
@@ -251,0 +250,0 @@ label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>; |
@@ -9,3 +9,3 @@ "use strict"; | ||
const function_1 = require("../../../../validators/function"); | ||
const EmbedContent_1 = (0, tslib_1.__importDefault)(require("../EmbedContent")); | ||
const EmbedContent_1 = require("../EmbedContent"); | ||
const ImageContent_1 = require("../ImageContent"); | ||
@@ -70,3 +70,3 @@ const Link_1 = require("../Link"); | ||
type: t.literal(exports.EmbedBlockType), | ||
data: EmbedContent_1.default, | ||
data: EmbedContent_1.EmbedContent, | ||
}), | ||
@@ -73,0 +73,0 @@ t.partial({ |
import * as O from "fp-ts/Option"; | ||
import type { EmptyContent } from "./EmptyContent"; | ||
import BooleanContent from "./nestable/BooleanContent"; | ||
import EmbedContent from "./nestable/EmbedContent"; | ||
import { EmbedContentO } from "./nestable/EmbedContent"; | ||
import FieldContent from "./nestable/FieldContent"; | ||
@@ -14,3 +14,3 @@ import { GeoPointContentO } from "./nestable/GeoPointContent"; | ||
export declare const SimpleWidgetContentType: string[]; | ||
export declare type NonEmptySimpleWidgetContent = IntegrationFieldsContent | StructuredTextContent | ImageContentO | GeoPointContentO | EmbedContent | LinkContent | UIDContent | SeparatorContent | FieldContent | BooleanContent; | ||
export declare type NonEmptySimpleWidgetContent = IntegrationFieldsContent | StructuredTextContent | ImageContentO | GeoPointContentO | EmbedContentO | LinkContent | UIDContent | SeparatorContent | FieldContent | BooleanContent; | ||
export declare type SimpleWidgetContent = NonEmptySimpleWidgetContent | EmptyContent; | ||
@@ -17,0 +17,0 @@ export declare function is(value: unknown): value is SimpleWidgetContent; |
@@ -9,3 +9,3 @@ "use strict"; | ||
const BooleanContent_1 = (0, tslib_1.__importDefault)(require("./nestable/BooleanContent")); | ||
const EmbedContent_1 = (0, tslib_1.__importDefault)(require("./nestable/EmbedContent")); | ||
const EmbedContent_1 = require("./nestable/EmbedContent"); | ||
const FieldContent_1 = (0, tslib_1.__importDefault)(require("./nestable/FieldContent")); | ||
@@ -56,3 +56,3 @@ const GeoPointContent_1 = require("./nestable/GeoPointContent"); | ||
case "Embed": | ||
return O.fromEither(EmbedContent_1.default.decode(content)); | ||
return O.fromEither(EmbedContent_1.EmbedContent.decode(content)); | ||
case "Link": | ||
@@ -59,0 +59,0 @@ return O.fromEither(Link_1.LinkContent.decode(content)); |
{ | ||
"name": "@prismicio/types-internal", | ||
"version": "0.2.4", | ||
"version": "0.2.6", | ||
"description": "Prismic types for Custom Types and Prismic Data", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -13,3 +13,3 @@ import { Either, left, right } from "fp-ts/lib/Either" | ||
} from "./Section" | ||
import type SharedSlice from "./widgets/slices/SharedSlice" | ||
import type { SharedSlice } from "./widgets/slices/SharedSlice" | ||
import type { DynamicSlice } from "./widgets/slices/Slice" | ||
@@ -62,6 +62,6 @@ import type { DynamicSlices } from "./widgets/slices/Slices" | ||
function _retrieveSharedSlicesRef(customType: CustomType): Array<string> { | ||
const flattenWidgets: Array<[string, DynamicWidget]> = Object.entries( | ||
customType.json, | ||
).reduce( | ||
export function flattenWidgets( | ||
customType: CustomType, | ||
): Array<[string, DynamicWidget]> { | ||
return Object.entries(customType.json).reduce( | ||
( | ||
@@ -77,4 +77,5 @@ acc: Array<[string, DynamicWidget]>, | ||
) | ||
const slicezones = flattenWidgets.filter( | ||
} | ||
function _retrieveSharedSlicesRef(customType: CustomType): Array<string> { | ||
const slicezones = flattenWidgets(customType).filter( | ||
([, widget]: [string, DynamicWidget]) => widget.type === WidgetTypes.Slices, | ||
@@ -81,0 +82,0 @@ ) as Array<[string, DynamicSlices]> |
import * as t from "io-ts" | ||
import { Format } from "./Format" | ||
import type SharedSlice from "./widgets/slices/SharedSlice" | ||
import type { SharedSlice } from "./widgets/slices/SharedSlice" | ||
import { | ||
@@ -6,0 +6,0 @@ DynamicWidget, |
export { default as BooleanField } from "./BooleanField" | ||
export { default as Color } from "./Color" | ||
export { default as Date } from "./Date" | ||
export { default as Embed } from "./Embed" | ||
export { default as GeoPoint } from "./GeoPoint" | ||
@@ -11,3 +12,3 @@ export { default as Image } from "./Image" | ||
export { default as Range } from "./Range" | ||
export { default as RichText } from "./RichText" | ||
export * from "./RichText" | ||
export { default as Select } from "./Select" | ||
@@ -14,0 +15,0 @@ export { default as Separator } from "./Separator" |
@@ -13,3 +13,3 @@ import * as t from "io-ts" | ||
import Range from "./Range" | ||
import RichText from "./RichText" | ||
import { RichText } from "./RichText" | ||
import Select from "./Select" | ||
@@ -16,0 +16,0 @@ import Separator from "./Separator" |
@@ -8,22 +8,64 @@ import { either } from "fp-ts/lib/Either" | ||
const DEFAULT_OPTION = "paragraph" | ||
const options = [ | ||
"heading1", | ||
"heading2", | ||
"heading3", | ||
"heading4", | ||
"heading5", | ||
"heading6", | ||
"paragraph", | ||
"strong", | ||
"em", | ||
"preformatted", | ||
"hyperlink", | ||
"image", | ||
"embed", | ||
"list-item", | ||
"o-list-item", | ||
"rtl", | ||
] | ||
export const DEFAULT_OPTION = "paragraph" | ||
export enum RichTextNodeType { | ||
heading1 = "heading1", | ||
heading2 = "heading2", | ||
heading3 = "heading3", | ||
heading4 = "heading4", | ||
heading5 = "heading5", | ||
heading6 = "heading6", | ||
paragraph = "paragraph", | ||
strong = "strong", | ||
em = "em", | ||
preformatted = "preformatted", | ||
hyperlink = "hyperlink", | ||
image = "image", | ||
embed = "embed", | ||
list = "list-item", | ||
orderedList = "o-list-item", | ||
rtl = "rtl", | ||
} | ||
export function parseRichTextNodeType( | ||
str: string, | ||
): RichTextNodeType | undefined { | ||
switch (str) { | ||
case RichTextNodeType.heading1: | ||
return RichTextNodeType.heading1 | ||
case RichTextNodeType.heading2: | ||
return RichTextNodeType.heading2 | ||
case RichTextNodeType.heading3: | ||
return RichTextNodeType.heading3 | ||
case RichTextNodeType.heading4: | ||
return RichTextNodeType.heading4 | ||
case RichTextNodeType.heading5: | ||
return RichTextNodeType.heading5 | ||
case RichTextNodeType.heading6: | ||
return RichTextNodeType.heading6 | ||
case RichTextNodeType.paragraph: | ||
return RichTextNodeType.paragraph | ||
case RichTextNodeType.strong: | ||
return RichTextNodeType.strong | ||
case RichTextNodeType.em: | ||
return RichTextNodeType.em | ||
case RichTextNodeType.preformatted: | ||
return RichTextNodeType.preformatted | ||
case RichTextNodeType.hyperlink: | ||
return RichTextNodeType.hyperlink | ||
case RichTextNodeType.image: | ||
return RichTextNodeType.image | ||
case RichTextNodeType.embed: | ||
return RichTextNodeType.embed | ||
case RichTextNodeType.list: | ||
return RichTextNodeType.list | ||
case RichTextNodeType.orderedList: | ||
return RichTextNodeType.orderedList | ||
case RichTextNodeType.rtl: | ||
return RichTextNodeType.rtl | ||
default: | ||
return | ||
} | ||
} | ||
const RichTextOptions = new t.Type<string, string, unknown>( | ||
@@ -38,3 +80,3 @@ "RichTextOptions", | ||
const entries = s.split(",").map((e: string) => e.trim()) | ||
const filtered = entries.filter((entry) => options.includes(entry)) | ||
const filtered = entries.filter((entry) => parseRichTextNodeType(entry)) | ||
if (!filtered.length) return t.success(DEFAULT_OPTION) | ||
@@ -179,3 +221,3 @@ | ||
const RichText = t.exact( | ||
export const RichText = t.exact( | ||
t.intersection([ | ||
@@ -191,4 +233,2 @@ t.type({ | ||
) | ||
type RichText = t.TypeOf<typeof RichText> | ||
export default RichText | ||
export type RichText = t.TypeOf<typeof RichText> |
export { default as CompositeSlice } from "./CompositeSlice" | ||
export { default as LegacySlice } from "./LegacySlice" | ||
export { default as SharedSlice } from "./SharedSlice" | ||
export * from "./SharedSlice" | ||
export { default as SharedSliceRef } from "./SharedSliceRef" | ||
@@ -5,0 +5,0 @@ export * as Slice from "./Slice" |
@@ -10,3 +10,3 @@ import * as t from "io-ts" | ||
const Variation = t.exact( | ||
export const Variation = t.exact( | ||
t.intersection([ | ||
@@ -29,5 +29,5 @@ t.type({ | ||
type Variation = t.TypeOf<typeof Variation> | ||
export type Variation = t.TypeOf<typeof Variation> | ||
const SharedSlice = t.exact( | ||
export const SharedSlice = t.exact( | ||
t.intersection([ | ||
@@ -46,4 +46,2 @@ t.type({ | ||
type SharedSlice = t.TypeOf<typeof SharedSlice> | ||
export default SharedSlice | ||
export type SharedSlice = t.TypeOf<typeof SharedSlice> |
import type CompositeSlice from "./CompositeSlice" | ||
import type LegacySlice from "./LegacySlice" | ||
import type SharedSlice from "./SharedSlice" | ||
import type { SharedSlice } from "./SharedSlice" | ||
import type SharedSliceRef from "./SharedSliceRef" | ||
@@ -5,0 +5,0 @@ |
@@ -8,3 +8,3 @@ import * as t from "io-ts" | ||
import LegacySlice from "./LegacySlice" | ||
import SharedSlice from "./SharedSlice" | ||
import { SharedSlice } from "./SharedSlice" | ||
import SharedSliceRef from "./SharedSliceRef" | ||
@@ -11,0 +11,0 @@ import SlicesTypes from "./SlicesTypes" |
@@ -6,3 +6,3 @@ import * as t from "io-ts" | ||
import NestableWidget from "./nestable/NestableWidget" | ||
import type SharedSlice from "./slices/SharedSlice" | ||
import type { SharedSlice } from "./slices/SharedSlice" | ||
import { Slices, slicesReader } from "./slices/Slices" | ||
@@ -9,0 +9,0 @@ import UID from "./UID" |
@@ -25,3 +25,3 @@ import { EmptyContentType } from "./EmptyContent" | ||
slices: SlicesContentType, | ||
} | ||
} as const | ||
@@ -28,0 +28,0 @@ export type WidgetKey = string |
@@ -10,9 +10,13 @@ import { either } from "fp-ts" | ||
type EmbedContent = t.OutputOf<typeof EmbedContentC> & { | ||
export type EmbedContent = t.TypeOf<typeof EmbedContentC> & { | ||
all: unknown | ||
} | ||
const EmbedContent = new t.Type<EmbedContent, unknown, unknown>( | ||
export type EmbedContentO = t.OutputOf<typeof EmbedContentC> & { | ||
all: unknown | ||
} | ||
export const EmbedContent = new t.Type<EmbedContentO, unknown, unknown>( | ||
"EmbedContent", | ||
(u): u is EmbedContent => (u as EmbedContent).__TYPE__ === EmbedContentType, | ||
(u): u is EmbedContentO => (u as EmbedContentO).__TYPE__ === EmbedContentType, | ||
(u) => { | ||
@@ -27,3 +31,3 @@ return pipe( | ||
}, | ||
(ec: EmbedContent) => EmbedContentC.encode(ec), | ||
(ec: EmbedContentO) => EmbedContentC.encode(ec), | ||
) | ||
@@ -55,3 +59,1 @@ | ||
) | ||
export default EmbedContent |
@@ -5,6 +5,14 @@ import { pipe } from "fp-ts/function" | ||
export type FieldType = | ||
| "Text" | ||
| "Date" | ||
| "Timestamp" | ||
| "Color" | ||
| "Number" | ||
| "Range" | ||
| "Select" | ||
export const FieldContentType = "FieldContent" | ||
type FieldContent = { | ||
value: string | ||
type: string | ||
type: FieldType | ||
__TYPE__: typeof FieldContentType | ||
@@ -32,3 +40,3 @@ } | ||
types: ["Text", "Date", "Timestamp", "Color", "Number", "Range", "Select"], | ||
forType: (type: string, value: unknown): O.Option<FieldContent> => { | ||
forType: (type: FieldType, value: unknown): O.Option<FieldContent> => { | ||
return pipe( | ||
@@ -35,0 +43,0 @@ O.fromEither(t.string.decode(value)), |
@@ -12,3 +12,3 @@ import { BooleanContentType } from "./BooleanContent" | ||
export { default as BooleanContent } from "./BooleanContent" | ||
export { default as EmbedContent } from "./EmbedContent" | ||
export * from "./EmbedContent" | ||
export { default as FieldContent } from "./FieldContent" | ||
@@ -15,0 +15,0 @@ export { type GeoPointContentO, GeoPointContent } from "./GeoPointContent" |
@@ -6,3 +6,3 @@ import * as E from "fp-ts/lib/Either" | ||
import { nullable, refineType } from "../../../../validators/function" | ||
import EmbedContent from "../EmbedContent" | ||
import { EmbedContent } from "../EmbedContent" | ||
import { ImageContentView } from "../ImageContent" | ||
@@ -9,0 +9,0 @@ import { Link } from "../Link" |
@@ -7,4 +7,4 @@ import { pipe } from "fp-ts/function" | ||
import BooleanContent from "./nestable/BooleanContent" | ||
import EmbedContent from "./nestable/EmbedContent" | ||
import FieldContent from "./nestable/FieldContent" | ||
import { EmbedContent, EmbedContentO } from "./nestable/EmbedContent" | ||
import FieldContent, { FieldType } from "./nestable/FieldContent" | ||
import { GeoPointContent, GeoPointContentO } from "./nestable/GeoPointContent" | ||
@@ -38,3 +38,3 @@ import { ImageContent, ImageContentO } from "./nestable/ImageContent" | ||
| GeoPointContentO | ||
| EmbedContent | ||
| EmbedContentO | ||
| LinkContent | ||
@@ -89,3 +89,3 @@ | UIDContent | ||
if (FieldContent.types.includes(type)) { | ||
return FieldContent.forType(type, content) | ||
return FieldContent.forType(type as FieldType, content) | ||
} else { | ||
@@ -92,0 +92,0 @@ return O.none |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1243613
24437