@prismicio/types-internal 3.2.0 → 3.2.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_internal/utils.d.ts +6 -4
- package/lib/content/fields/RepeatableContent.d.ts +45 -47
- package/lib/content/fields/nestable/RepeatableContent.d.ts +2 -1
- package/lib/content/fields/nestable/RichTextContent/TextBlock.d.ts +727 -0
- package/lib/content/fields/nestable/RichTextContent/TextBlock.js +80 -0
- package/lib/customtypes/widgets/slices/SliceWidget.d.ts +327 -0
- package/lib/customtypes/widgets/slices/SliceWidget.js +8 -0
- package/package.json +3 -3
- package/src/_internal/utils.ts +9 -3
- package/src/content/fields/nestable/RepeatableContent.ts +1 -1
package/lib/_internal/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RepeatableContent, SharedSliceItemContent, SliceItemContent, WidgetContent } from "../content";
|
|
1
|
+
import type { LinkContent, RepeatableContent, SharedSliceItemContent, SliceItemContent, WidgetContent } from "../content";
|
|
2
2
|
import type { CompositeSlice, Group, NestableWidget, StaticSlices, UID, VariationFields } from "../customtypes";
|
|
3
3
|
export declare type TraverseSliceContentFn = <S extends SliceItemContent | SharedSliceItemContent, D extends VariationFields | CompositeSlice | Group | NestableWidget>({ path, key, apiId, model, content, }: {
|
|
4
4
|
path: ContentPath;
|
|
@@ -7,13 +7,14 @@ export declare type TraverseSliceContentFn = <S extends SliceItemContent | Share
|
|
|
7
7
|
model?: D | undefined;
|
|
8
8
|
content: S;
|
|
9
9
|
}) => S | SharedSliceItemContent | undefined;
|
|
10
|
-
|
|
10
|
+
declare type TransformableContent<C> = C extends LinkContent | RepeatableContent ? LinkContent | RepeatableContent : C;
|
|
11
|
+
export declare type TraverseWidgetContentFn = <C extends WidgetContent, D extends NestableWidget | StaticSlices | Group | UID>({ path, key, apiId, model, content, }: {
|
|
11
12
|
path: ContentPath;
|
|
12
13
|
key: string;
|
|
13
14
|
apiId: string;
|
|
14
15
|
model?: D | undefined;
|
|
15
|
-
content: C
|
|
16
|
-
}) => C | undefined;
|
|
16
|
+
content: TransformableContent<C>;
|
|
17
|
+
}) => TransformableContent<C> | undefined;
|
|
17
18
|
export declare type ContentPathEntry = {
|
|
18
19
|
type: "CustomType" | "Widget" | "SharedSlice" | "Slice" | "LegacySlice" | "GroupItem" | "primary" | "items" | "RepeatableItem";
|
|
19
20
|
key: string;
|
|
@@ -29,3 +30,4 @@ export declare const ContentPath: {
|
|
|
29
30
|
}>): ContentPath;
|
|
30
31
|
};
|
|
31
32
|
export declare type SliceModel = VariationFields | NestableWidget | CompositeSlice | Group;
|
|
33
|
+
export {};
|
|
@@ -5,14 +5,12 @@ import type { LegacyContentCtx, WithTypes } from "../LegacyContentCtx";
|
|
|
5
5
|
export declare const RepeatableContent: t.ExactC<t.TypeC<{
|
|
6
6
|
__TYPE__: t.LiteralC<"RepeatableContent">;
|
|
7
7
|
type: t.LiteralC<"Link">;
|
|
8
|
-
value: t.ArrayC<t.
|
|
9
|
-
key: t.Type<string, string, unknown>;
|
|
10
|
-
}>>, t.ExactC<t.TypeC<{
|
|
8
|
+
value: t.ArrayC<t.ExactC<t.TypeC<{
|
|
11
9
|
__TYPE__: t.LiteralC<"LinkContent">;
|
|
12
10
|
value: t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
13
11
|
__TYPE__: t.LiteralC<"ImageLink">;
|
|
14
|
-
}>>, t.
|
|
15
|
-
kind: t.
|
|
12
|
+
}>>, t.UnionC<[t.IntersectionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
13
|
+
kind: t.StringC;
|
|
16
14
|
id: t.StringC;
|
|
17
15
|
url: t.StringC;
|
|
18
16
|
height: t.StringC;
|
|
@@ -21,35 +19,38 @@ export declare const RepeatableContent: t.ExactC<t.TypeC<{
|
|
|
21
19
|
name: t.StringC;
|
|
22
20
|
}>>, t.ExactC<t.PartialC<{
|
|
23
21
|
date: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
22
|
+
}>>]>, t.ExactC<t.PartialC<{
|
|
23
|
+
text: t.StringC;
|
|
24
24
|
}>>]>, t.ExactC<t.TypeC<{
|
|
25
25
|
kind: t.LiteralC<"image">;
|
|
26
|
-
}>>]>, t.ExactC<t.PartialC<{
|
|
27
26
|
text: t.StringC;
|
|
28
27
|
}>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
29
28
|
__TYPE__: t.LiteralC<"FileLink">;
|
|
30
|
-
}>>, t.
|
|
31
|
-
kind: t.
|
|
29
|
+
}>>, t.UnionC<[t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
30
|
+
kind: t.StringC;
|
|
32
31
|
id: t.StringC;
|
|
33
32
|
url: t.StringC;
|
|
34
33
|
name: t.StringC;
|
|
35
34
|
size: t.StringC;
|
|
36
35
|
}>, t.PartialC<{
|
|
37
36
|
date: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
|
|
38
|
-
}>]>>, t.ExactC<t.
|
|
37
|
+
}>]>>, t.ExactC<t.PartialC<{
|
|
38
|
+
text: t.StringC;
|
|
39
|
+
}>>]>, t.ExactC<t.TypeC<{
|
|
39
40
|
kind: t.LiteralC<"file">;
|
|
40
|
-
}>>]>, t.ExactC<t.PartialC<{
|
|
41
41
|
text: t.StringC;
|
|
42
42
|
}>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
43
43
|
__TYPE__: t.LiteralC<"DocumentLink">;
|
|
44
|
-
}>>, t.
|
|
44
|
+
}>>, t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
45
45
|
id: t.Type<string, string, unknown>;
|
|
46
|
-
}>>, t.ExactC<t.
|
|
46
|
+
}>>, t.ExactC<t.PartialC<{
|
|
47
|
+
text: t.StringC;
|
|
48
|
+
}>>]>, t.ExactC<t.TypeC<{
|
|
47
49
|
kind: t.LiteralC<"document">;
|
|
48
|
-
}>>]>, t.ExactC<t.PartialC<{
|
|
49
50
|
text: t.StringC;
|
|
50
51
|
}>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
51
52
|
__TYPE__: t.LiteralC<"ExternalLink">;
|
|
52
|
-
}>>, t.
|
|
53
|
+
}>>, t.UnionC<[t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
53
54
|
url: t.StringC;
|
|
54
55
|
}>, t.PartialC<{
|
|
55
56
|
kind: t.LiteralC<"web">;
|
|
@@ -59,37 +60,33 @@ export declare const RepeatableContent: t.ExactC<t.TypeC<{
|
|
|
59
60
|
}, {
|
|
60
61
|
title?: string;
|
|
61
62
|
}, unknown>, t.NullC, t.UndefinedC]>;
|
|
62
|
-
}>]>>, t.ExactC<t.
|
|
63
|
+
}>]>>, t.ExactC<t.PartialC<{
|
|
64
|
+
text: t.StringC;
|
|
65
|
+
}>>]>, t.ExactC<t.TypeC<{
|
|
63
66
|
kind: t.LiteralC<"web">;
|
|
64
|
-
}>>]>, t.ExactC<t.PartialC<{
|
|
65
67
|
text: t.StringC;
|
|
66
68
|
}>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
67
69
|
__TYPE__: t.LiteralC<"MediaLink">;
|
|
68
|
-
}>>, t.
|
|
70
|
+
}>>, t.ExactC<t.TypeC<{
|
|
69
71
|
kind: t.LiteralC<"media">;
|
|
70
|
-
}>>, t.ExactC<t.PartialC<{
|
|
71
72
|
text: t.StringC;
|
|
72
|
-
}>>]
|
|
73
|
+
}>>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
|
|
73
74
|
__TYPE__: t.LiteralC<"AnyLink">;
|
|
74
|
-
}>>, t.ExactC<t.
|
|
75
|
-
kind: t.LiteralC<"any">;
|
|
76
|
-
}>, t.PartialC<{
|
|
75
|
+
}>>, t.ExactC<t.TypeC<{
|
|
77
76
|
text: t.StringC;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
77
|
+
}>>]>]>;
|
|
78
|
+
}>>>;
|
|
80
79
|
}>>;
|
|
81
80
|
export declare type RepeatableContent = t.TypeOf<typeof RepeatableContent>;
|
|
82
81
|
export declare const isRepeatableContent: t.Is<{
|
|
83
82
|
__TYPE__: "RepeatableContent";
|
|
84
83
|
type: "Link";
|
|
85
|
-
value:
|
|
86
|
-
key: string;
|
|
87
|
-
} & {
|
|
84
|
+
value: {
|
|
88
85
|
__TYPE__: "LinkContent";
|
|
89
86
|
value: ({
|
|
90
87
|
__TYPE__: "ImageLink";
|
|
91
|
-
} & ((
|
|
92
|
-
kind:
|
|
88
|
+
} & (({
|
|
89
|
+
kind: string;
|
|
93
90
|
id: string;
|
|
94
91
|
url: string;
|
|
95
92
|
height: string;
|
|
@@ -98,41 +95,43 @@ export declare const isRepeatableContent: t.Is<{
|
|
|
98
95
|
name: string;
|
|
99
96
|
} & {
|
|
100
97
|
date?: string | null | undefined;
|
|
98
|
+
} & {
|
|
99
|
+
text?: string;
|
|
101
100
|
}) | {
|
|
102
101
|
kind: "image";
|
|
103
|
-
|
|
104
|
-
text?: string;
|
|
102
|
+
text: string;
|
|
105
103
|
})) | ({
|
|
106
104
|
__TYPE__: "FileLink";
|
|
107
|
-
} & ((
|
|
108
|
-
kind:
|
|
105
|
+
} & (({
|
|
106
|
+
kind: string;
|
|
109
107
|
id: string;
|
|
110
108
|
url: string;
|
|
111
109
|
name: string;
|
|
112
110
|
size: string;
|
|
113
111
|
} & {
|
|
114
112
|
date?: string | null | undefined;
|
|
113
|
+
} & {
|
|
114
|
+
text?: string;
|
|
115
115
|
}) | {
|
|
116
116
|
kind: "file";
|
|
117
|
-
|
|
118
|
-
text?: string;
|
|
117
|
+
text: string;
|
|
119
118
|
})) | ({
|
|
120
119
|
__TYPE__: "MediaLink";
|
|
121
120
|
} & {
|
|
122
121
|
kind: "media";
|
|
123
|
-
|
|
124
|
-
text?: string;
|
|
122
|
+
text: string;
|
|
125
123
|
}) | ({
|
|
126
124
|
__TYPE__: "DocumentLink";
|
|
127
125
|
} & (({
|
|
128
126
|
id: string;
|
|
129
|
-
}
|
|
130
|
-
kind: "document";
|
|
131
|
-
}) & {
|
|
127
|
+
} & {
|
|
132
128
|
text?: string;
|
|
129
|
+
}) | {
|
|
130
|
+
kind: "document";
|
|
131
|
+
text: string;
|
|
133
132
|
})) | ({
|
|
134
133
|
__TYPE__: "ExternalLink";
|
|
135
|
-
} & ((
|
|
134
|
+
} & (({
|
|
136
135
|
url: string;
|
|
137
136
|
} & {
|
|
138
137
|
kind?: "web";
|
|
@@ -140,18 +139,17 @@ export declare const isRepeatableContent: t.Is<{
|
|
|
140
139
|
preview?: {
|
|
141
140
|
title?: string;
|
|
142
141
|
} | null | undefined;
|
|
142
|
+
} & {
|
|
143
|
+
text?: string;
|
|
143
144
|
}) | {
|
|
144
145
|
kind: "web";
|
|
145
|
-
|
|
146
|
-
text?: string;
|
|
146
|
+
text: string;
|
|
147
147
|
})) | ({
|
|
148
148
|
__TYPE__: "AnyLink";
|
|
149
149
|
} & {
|
|
150
|
-
|
|
151
|
-
} & {
|
|
152
|
-
text?: string;
|
|
150
|
+
text: string;
|
|
153
151
|
});
|
|
154
|
-
}
|
|
152
|
+
}[];
|
|
155
153
|
}>;
|
|
156
154
|
export declare const RepeatableLegacy: (ctx: LegacyContentCtx, fieldType: "Link") => t.Type<RepeatableContent, WithTypes<Array<unknown>>, unknown>;
|
|
157
155
|
export declare type RepeatableCustomType = Link;
|
|
@@ -2,6 +2,7 @@ import * as t from "io-ts";
|
|
|
2
2
|
import type { ContentPath, TraverseWidgetContentFn } from "../../../_internal/utils";
|
|
3
3
|
import type { Link, NestableWidget } from "../../../customtypes";
|
|
4
4
|
import type { LegacyContentCtx, WithTypes } from "../../LegacyContentCtx";
|
|
5
|
+
import { LinkContent } from "./LinkContent";
|
|
5
6
|
export declare const RepeatableContent: t.ExactC<t.TypeC<{
|
|
6
7
|
__TYPE__: t.LiteralC<"RepeatableContent">;
|
|
7
8
|
type: t.LiteralC<"Link">;
|
|
@@ -161,4 +162,4 @@ export declare function traverseRepeatableContent({ path, key, apiId, model, con
|
|
|
161
162
|
apiId: string;
|
|
162
163
|
content: RepeatableContent;
|
|
163
164
|
model?: NestableWidget | undefined;
|
|
164
|
-
}): (transform: TraverseWidgetContentFn) => RepeatableContent | undefined;
|
|
165
|
+
}): (transform: TraverseWidgetContentFn) => RepeatableContent | LinkContent | undefined;
|