@prismicio/types-internal 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/customtypes/CustomType.d.ts +2 -1
- package/lib/customtypes/CustomType.js +7 -4
- package/lib/customtypes/Section.d.ts +1 -1
- package/lib/customtypes/widgets/Widget.d.ts +1 -1
- package/lib/customtypes/widgets/nestable/NestableWidget.js +2 -2
- package/lib/customtypes/widgets/nestable/RichText.d.ts +22 -3
- package/lib/customtypes/widgets/nestable/RichText.js +64 -24
- package/lib/customtypes/widgets/nestable/index.d.ts +2 -1
- package/lib/customtypes/widgets/nestable/index.js +19 -20
- package/lib/customtypes/widgets/slices/SharedSlice.d.ts +327 -3
- package/lib/customtypes/widgets/slices/SharedSlice.js +4 -4
- package/lib/customtypes/widgets/slices/Slice.d.ts +1 -1
- package/lib/customtypes/widgets/slices/Slices.d.ts +1 -1
- package/lib/customtypes/widgets/slices/Slices.js +2 -2
- package/lib/customtypes/widgets/slices/index.d.ts +1 -1
- package/lib/customtypes/widgets/slices/index.js +2 -3
- package/lib/documents/widgets/SimpleWidgetContent.d.ts +2 -2
- package/lib/documents/widgets/SimpleWidgetContent.js +2 -2
- package/lib/documents/widgets/index.d.ts +13 -13
- package/lib/documents/widgets/nestable/EmbedContent.d.ts +6 -3
- package/lib/documents/widgets/nestable/EmbedContent.js +2 -3
- package/lib/documents/widgets/nestable/FieldContent.d.ts +3 -2
- package/lib/documents/widgets/nestable/StructuredTextContent/Block.d.ts +2 -3
- package/lib/documents/widgets/nestable/StructuredTextContent/Block.js +2 -2
- package/lib/documents/widgets/nestable/index.d.ts +1 -1
- package/lib/documents/widgets/nestable/index.js +2 -3
- package/package.json +1 -1
- package/src/customtypes/CustomType.ts +8 -7
- package/src/customtypes/Section.ts +1 -1
- package/src/customtypes/widgets/Widget.ts +1 -1
- package/src/customtypes/widgets/nestable/NestableWidget.ts +1 -1
- package/src/customtypes/widgets/nestable/RichText.ts +64 -24
- package/src/customtypes/widgets/nestable/index.ts +2 -1
- package/src/customtypes/widgets/slices/SharedSlice.ts +4 -6
- package/src/customtypes/widgets/slices/Slice.ts +1 -1
- package/src/customtypes/widgets/slices/Slices.ts +1 -1
- package/src/customtypes/widgets/slices/index.ts +1 -1
- package/src/documents/widgets/SimpleWidgetContent.ts +4 -4
- package/src/documents/widgets/index.ts +1 -1
- package/src/documents/widgets/nestable/EmbedContent.ts +8 -6
- package/src/documents/widgets/nestable/FieldContent.ts +10 -2
- package/src/documents/widgets/nestable/StructuredTextContent/Block.ts +1 -1
- package/src/documents/widgets/nestable/index.ts +1 -1
|
@@ -7,13 +7,17 @@ import { addType } from "../../../validators/function"
|
|
|
7
7
|
|
|
8
8
|
export const EmbedContentType = "EmbedContent"
|
|
9
9
|
|
|
10
|
-
type EmbedContent = t.
|
|
10
|
+
export type EmbedContent = t.TypeOf<typeof EmbedContentC> & {
|
|
11
11
|
all: unknown
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
export type EmbedContentO = t.OutputOf<typeof EmbedContentC> & {
|
|
15
|
+
all: unknown
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const EmbedContent = new t.Type<EmbedContentO, unknown, unknown>(
|
|
15
19
|
"EmbedContent",
|
|
16
|
-
(u): u is
|
|
20
|
+
(u): u is EmbedContentO => (u as EmbedContentO).__TYPE__ === EmbedContentType,
|
|
17
21
|
(u) => {
|
|
18
22
|
return pipe(
|
|
19
23
|
EmbedContentC.decode(u),
|
|
@@ -23,7 +27,7 @@ const EmbedContent = new t.Type<EmbedContent, unknown, unknown>(
|
|
|
23
27
|
})),
|
|
24
28
|
)
|
|
25
29
|
},
|
|
26
|
-
(ec:
|
|
30
|
+
(ec: EmbedContentO) => EmbedContentC.encode(ec),
|
|
27
31
|
)
|
|
28
32
|
|
|
29
33
|
const EmbedContentC = addType(
|
|
@@ -50,5 +54,3 @@ const EmbedContentC = addType(
|
|
|
50
54
|
),
|
|
51
55
|
EmbedContentType,
|
|
52
56
|
)
|
|
53
|
-
|
|
54
|
-
export default EmbedContent
|
|
@@ -2,10 +2,18 @@ import { pipe } from "fp-ts/function"
|
|
|
2
2
|
import * as O from "fp-ts/Option"
|
|
3
3
|
import * as t from "io-ts"
|
|
4
4
|
|
|
5
|
+
export type FieldType =
|
|
6
|
+
| "Text"
|
|
7
|
+
| "Date"
|
|
8
|
+
| "Timestamp"
|
|
9
|
+
| "Color"
|
|
10
|
+
| "Number"
|
|
11
|
+
| "Range"
|
|
12
|
+
| "Select"
|
|
5
13
|
export const FieldContentType = "FieldContent"
|
|
6
14
|
type FieldContent = {
|
|
7
15
|
value: string
|
|
8
|
-
type:
|
|
16
|
+
type: FieldType
|
|
9
17
|
__TYPE__: typeof FieldContentType
|
|
10
18
|
}
|
|
11
19
|
|
|
@@ -28,7 +36,7 @@ function trimScalaStyle(s: string): string {
|
|
|
28
36
|
|
|
29
37
|
const FieldContent = {
|
|
30
38
|
types: ["Text", "Date", "Timestamp", "Color", "Number", "Range", "Select"],
|
|
31
|
-
forType: (type:
|
|
39
|
+
forType: (type: FieldType, value: unknown): O.Option<FieldContent> => {
|
|
32
40
|
return pipe(
|
|
33
41
|
O.fromEither(t.string.decode(value)),
|
|
34
42
|
O.map((r) => {
|
|
@@ -3,7 +3,7 @@ import * as t from "io-ts"
|
|
|
3
3
|
|
|
4
4
|
import { StringOrNull } from "../../../../validators"
|
|
5
5
|
import { nullable, refineType } from "../../../../validators/function"
|
|
6
|
-
import EmbedContent from "../EmbedContent"
|
|
6
|
+
import { EmbedContent } from "../EmbedContent"
|
|
7
7
|
import { ImageContentView } from "../ImageContent"
|
|
8
8
|
import { Link } from "../Link"
|
|
9
9
|
|
|
@@ -9,7 +9,7 @@ import { SeparatorContentType } from "./SeparatorContent"
|
|
|
9
9
|
import { StructuredTextContentType } from "./StructuredTextContent"
|
|
10
10
|
|
|
11
11
|
export { default as BooleanContent } from "./BooleanContent"
|
|
12
|
-
export
|
|
12
|
+
export * from "./EmbedContent"
|
|
13
13
|
export { default as FieldContent } from "./FieldContent"
|
|
14
14
|
export { type GeoPointContentO, GeoPointContent } from "./GeoPointContent"
|
|
15
15
|
export {
|