@prismicio/types-internal 4.0.0 → 4.1.0-canary.51f7473
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/README.md +5 -5
- package/dist/content/boolean.d.ts.map +1 -1
- package/dist/content/boolean.js.map +1 -1
- package/dist/content/codec/link.js.map +1 -1
- package/dist/content/codec/nestable.js +4 -4
- package/dist/content/field.d.ts.map +1 -1
- package/dist/content/field.js +2 -2
- package/dist/content/field.js.map +1 -1
- package/dist/content/group.d.ts +1 -2
- package/dist/content/group.d.ts.map +1 -1
- package/dist/content/group.js +1 -1
- package/dist/content/group.js.map +1 -1
- package/dist/content/image.d.ts +3 -1
- package/dist/content/image.d.ts.map +1 -1
- package/dist/content/image.js +3 -3
- package/dist/content/image.js.map +1 -1
- package/dist/content/legacy/boolean.d.ts +1 -0
- package/dist/content/legacy/embed.d.ts +1 -0
- package/dist/content/legacy/empty.d.ts +1 -0
- package/dist/content/legacy/field.d.ts +1 -0
- package/dist/content/legacy/geopoint.d.ts +1 -0
- package/dist/content/legacy/image.d.ts +28 -0
- package/dist/content/legacy/image.d.ts.map +1 -0
- package/dist/content/legacy/image.js +3 -3
- package/dist/content/legacy/image.js.map +1 -1
- package/dist/content/legacy/integrationField.d.ts +1 -0
- package/dist/content/legacy/link.d.ts +14 -14
- package/dist/content/legacy/link.js +23 -23
- package/dist/content/legacy/link.js.map +1 -1
- package/dist/content/legacy/nestable.d.ts +1 -0
- package/dist/content/legacy/nestable.js +1 -1
- package/dist/content/legacy/repeatable.d.ts +1 -0
- package/dist/content/legacy/richText.d.ts +32 -20
- package/dist/content/legacy/richText.d.ts.map +1 -1
- package/dist/content/legacy/richText.js +7 -7
- package/dist/content/legacy/richText.js.map +1 -1
- package/dist/content/legacy/separator.d.ts +1 -0
- package/dist/content/legacy/table.d.ts +1 -0
- package/dist/content/link.d.ts +66 -89
- package/dist/content/link.d.ts.map +1 -1
- package/dist/content/link.js +30 -27
- package/dist/content/link.js.map +1 -1
- package/dist/content/nestable.d.ts +3 -3
- package/dist/content/nestable.d.ts.map +1 -1
- package/dist/content/nestable.js +7 -13
- package/dist/content/nestable.js.map +1 -1
- package/dist/content/repeatable.d.ts +4 -69
- package/dist/content/repeatable.d.ts.map +1 -1
- package/dist/content/richText.d.ts +14 -14
- package/dist/content/richText.d.ts.map +1 -1
- package/dist/content/richText.js +10 -10
- package/dist/content/richText.js.map +1 -1
- package/dist/content/slice.d.ts +507 -5
- package/dist/content/slice.d.ts.map +1 -1
- package/dist/content/slice.js +1 -1
- package/dist/content/slice.js.map +1 -1
- package/dist/content/slices.d.ts +507 -5
- package/dist/content/slices.d.ts.map +1 -1
- package/dist/content/table.d.ts +5 -2
- package/dist/content/table.d.ts.map +1 -1
- package/dist/content/widget.js +1 -1
- package/dist/content/widget.js.map +1 -1
- package/dist/helpers/customTypeModel.d.ts +5 -5
- package/dist/helpers/customTypeModel.d.ts.map +1 -1
- package/dist/helpers/customTypeModel.js +30 -0
- package/dist/helpers/customTypeModel.js.map +1 -1
- package/dist/helpers/imageContent.d.ts +33 -0
- package/dist/helpers/imageContent.d.ts.map +1 -0
- package/dist/helpers/imageContent.js +55 -0
- package/dist/helpers/imageContent.js.map +1 -0
- package/dist/helpers/traverseContent.d.ts +4 -4
- package/dist/helpers/traverseContent.d.ts.map +1 -1
- package/dist/helpers/traverseContent.js +5 -3
- package/dist/helpers/traverseContent.js.map +1 -1
- package/dist/helpers/traverseContentWithModel.d.ts +4 -4
- package/dist/helpers/traverseContentWithModel.js +1 -1
- package/dist/helpers/withDefaultContent.d.ts +21 -0
- package/dist/helpers/withDefaultContent.d.ts.map +1 -0
- package/dist/helpers/withDefaultContent.js +120 -0
- package/dist/helpers/withDefaultContent.js.map +1 -0
- package/dist/index.d.ts +26 -24
- package/dist/index.js +6 -1
- package/dist/io-ts.d.ts +6777 -3127
- package/dist/io-ts.d.ts.map +1 -1
- package/dist/io-ts.js +17 -12
- package/dist/io-ts.js.map +1 -1
- package/dist/model/customType.d.ts +9 -3
- package/dist/model/customType.d.ts.map +1 -1
- package/dist/model/customType.js +7 -4
- package/dist/model/customType.js.map +1 -1
- package/dist/model/group.d.ts +2 -2
- package/dist/model/group.js +1 -1
- package/dist/model/group.js.map +1 -1
- package/dist/model/nestable.js +1 -1
- package/dist/model/nestable.js.map +1 -1
- package/dist/model/richText.d.ts +20 -1
- package/dist/model/richText.d.ts.map +1 -1
- package/dist/model/richText.js +3 -3
- package/dist/model/richText.js.map +1 -1
- package/dist/model/slice.d.ts +1259 -651
- package/dist/model/slice.d.ts.map +1 -1
- package/dist/model/slice.js +9 -9
- package/dist/model/slice.js.map +1 -1
- package/dist/model/table.js +5 -5
- package/dist/model/table.js.map +1 -1
- package/dist/model/widget.d.ts +1 -3
- package/dist/model/widget.d.ts.map +1 -1
- package/dist/model/widget.js +7 -4
- package/dist/model/widget.js.map +1 -1
- package/dist/zod4.d.ts +3946 -1862
- package/dist/zod4.d.ts.map +1 -1
- package/dist/zod4.js +17 -12
- package/dist/zod4.js.map +1 -1
- package/package.json +22 -12
- package/src/content/boolean.ts +0 -13
- package/src/content/codec/link.ts +12 -12
- package/src/content/field.ts +1 -15
- package/src/content/group.ts +2 -55
- package/src/content/image.ts +3 -91
- package/src/content/legacy/image.ts +4 -4
- package/src/content/legacy/link.ts +46 -46
- package/src/content/legacy/richText.ts +32 -37
- package/src/content/link.ts +100 -89
- package/src/content/nestable.ts +4 -38
- package/src/content/richText.ts +31 -22
- package/src/content/slice.ts +1 -1
- package/src/content/widget.ts +1 -1
- package/src/helpers/customTypeModel.ts +51 -4
- package/src/helpers/imageContent.ts +84 -0
- package/src/helpers/traverseContent.ts +4 -1
- package/src/helpers/withDefaultContent.ts +180 -0
- package/src/index.ts +25 -7
- package/src/io-ts.ts +22 -10
- package/src/model/customType.ts +18 -7
- package/src/model/diff/sharedSlice.ts +2 -2
- package/src/model/diff/variation.ts +7 -7
- package/src/model/group.ts +1 -1
- package/src/model/nestable.ts +1 -1
- package/src/model/richText.ts +5 -2
- package/src/model/slice.ts +20 -23
- package/src/model/table.ts +5 -5
- package/src/model/widget.ts +14 -14
- package/src/zod4.ts +22 -10
- package/dist/model/section.d.ts +0 -11
- package/dist/model/section.d.ts.map +0 -1
- package/dist/model/section.js +0 -10
- package/dist/model/section.js.map +0 -1
- package/src/content/withDefaultValues.ts +0 -114
- package/src/model/section.ts +0 -12
package/dist/content/nestable.js
CHANGED
|
@@ -1,36 +1,30 @@
|
|
|
1
|
-
import { BooleanContentSchema, BooleanContentType } from "./boolean.js";
|
|
2
1
|
import { EmbedContentSchema, EmbedContentType } from "./embed.js";
|
|
2
|
+
import { ImageContentSchema, ImageContentType } from "./image.js";
|
|
3
|
+
import { LinkContentSchema, LinkContentType } from "./link.js";
|
|
4
|
+
import { RichTextContentSchema, RichTextContentType } from "./richText.js";
|
|
5
|
+
import { BooleanContentSchema, BooleanContentType } from "./boolean.js";
|
|
3
6
|
import { EmptyContentSchema, EmptyContentType } from "./empty.js";
|
|
4
|
-
import {
|
|
7
|
+
import { FieldContentSchema, FieldContentType } from "./field.js";
|
|
5
8
|
import { GeoPointContentSchema, GeoPointContentType } from "./geopoint.js";
|
|
6
|
-
import { ImageContentSchema, ImageContentType } from "./image.js";
|
|
7
9
|
import { IntegrationFieldContentSchema, IntegrationFieldContentType } from "./integrationField.js";
|
|
8
|
-
import { LinkContentSchema, LinkContentType } from "./link.js";
|
|
9
10
|
import { RepeatableContentSchema, RepeatableContentType } from "./repeatable.js";
|
|
10
|
-
import { RichTextContentSchema, RichTextContentType } from "./richText.js";
|
|
11
11
|
import { SeparatorContentSchema, SeparatorContentType } from "./separator.js";
|
|
12
12
|
import { TableContentSchema, TableContentType } from "./table.js";
|
|
13
13
|
import { z } from "zod/mini";
|
|
14
14
|
//#region src/content/nestable.ts
|
|
15
|
-
const NestableContentSchema = z.
|
|
15
|
+
const NestableContentSchema = z.discriminatedUnion("__TYPE__", [
|
|
16
16
|
EmptyContentSchema,
|
|
17
17
|
BooleanContentSchema,
|
|
18
|
-
ColorContentSchema,
|
|
19
|
-
DateContentSchema,
|
|
20
18
|
EmbedContentSchema,
|
|
21
19
|
GeoPointContentSchema,
|
|
22
20
|
ImageContentSchema,
|
|
23
21
|
IntegrationFieldContentSchema,
|
|
24
22
|
LinkContentSchema,
|
|
25
|
-
NumberContentSchema,
|
|
26
|
-
RangeContentSchema,
|
|
27
23
|
RepeatableContentSchema,
|
|
28
24
|
RichTextContentSchema,
|
|
29
|
-
SelectContentSchema,
|
|
30
25
|
SeparatorContentSchema,
|
|
31
26
|
TableContentSchema,
|
|
32
|
-
|
|
33
|
-
TimestampContentSchema
|
|
27
|
+
FieldContentSchema
|
|
34
28
|
]);
|
|
35
29
|
const NestableContentTypes = [
|
|
36
30
|
EmptyContentType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestable.js","names":[],"sources":["../../src/content/nestable.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type {
|
|
1
|
+
{"version":3,"file":"nestable.js","names":[],"sources":["../../src/content/nestable.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport type { BooleanContent } from \"./boolean\"\nimport { BooleanContentSchema, BooleanContentType } from \"./boolean\"\nimport type { EmbedContent } from \"./embed\"\nimport { EmbedContentSchema, EmbedContentType } from \"./embed\"\nimport type { EmptyContent } from \"./empty\"\nimport { EmptyContentSchema, EmptyContentType } from \"./empty\"\nimport type {\n\tColorContent,\n\tDateContent,\n\tNumberContent,\n\tRangeContent,\n\tSelectContent,\n\tTextContent,\n\tTimestampContent,\n} from \"./field\"\nimport { FieldContentType, FieldContentSchema } from \"./field\"\nimport type { GeoPointContent } from \"./geopoint\"\nimport { GeoPointContentSchema, GeoPointContentType } from \"./geopoint\"\nimport type { ImageContent } from \"./image\"\nimport { ImageContentSchema, ImageContentType } from \"./image\"\nimport type { IntegrationFieldContent } from \"./integrationField\"\nimport { IntegrationFieldContentSchema, IntegrationFieldContentType } from \"./integrationField\"\nimport type { LinkContent } from \"./link\"\nimport { LinkContentSchema, LinkContentType } from \"./link\"\nimport type { RepeatableContent } from \"./repeatable\"\nimport { RepeatableContentSchema, RepeatableContentType } from \"./repeatable\"\nimport type { RichTextContent } from \"./richText\"\nimport { RichTextContentSchema, RichTextContentType } from \"./richText\"\nimport type { SeparatorContent } from \"./separator\"\nimport { SeparatorContentSchema, SeparatorContentType } from \"./separator\"\nimport type { TableContent } from \"./table\"\nimport { TableContentSchema, TableContentType } from \"./table\"\n\nexport const NestableContentSchema = z.discriminatedUnion(\"__TYPE__\", [\n\tEmptyContentSchema,\n\tBooleanContentSchema,\n\tEmbedContentSchema,\n\tGeoPointContentSchema,\n\tImageContentSchema,\n\tIntegrationFieldContentSchema,\n\tLinkContentSchema,\n\tRepeatableContentSchema,\n\tRichTextContentSchema,\n\tSeparatorContentSchema,\n\tTableContentSchema,\n\tFieldContentSchema,\n])\n\nexport type NestableContent =\n\t| EmptyContent\n\t| BooleanContent\n\t| ColorContent\n\t| DateContent\n\t| EmbedContent\n\t| GeoPointContent\n\t| ImageContent\n\t| IntegrationFieldContent\n\t| LinkContent\n\t| NumberContent\n\t| RangeContent\n\t| RepeatableContent\n\t| RichTextContent\n\t| SelectContent\n\t| SeparatorContent\n\t| TableContent\n\t| TextContent\n\t| TimestampContent\n\nconst NestableContentTypes = [\n\tEmptyContentType,\n\tBooleanContentType,\n\tEmbedContentType,\n\tFieldContentType,\n\tGeoPointContentType,\n\tImageContentType,\n\tIntegrationFieldContentType,\n\tLinkContentType,\n\tRepeatableContentType,\n\tRichTextContentType,\n\tSeparatorContentType,\n\tTableContentType,\n]\ntype NestableContentType = (typeof NestableContentTypes)[number]\n\n/** @internal */\nexport function isNestableContent(content: {\n\t__TYPE__: string\n}): content is { __TYPE__: NestableContentType } {\n\treturn (NestableContentTypes as string[]).includes(content.__TYPE__)\n}\n"],"mappings":";;;;;;;;;;;;;;AAmCA,MAAa,wBAAwB,EAAE,mBAAmB,YAAY;CACrE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC;AAsBF,MAAM,uBAAuB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AAID,SAAgB,kBAAkB,SAEe;AAChD,QAAQ,qBAAkC,SAAS,QAAQ,SAAS"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LinkContentValue } from "./link.js";
|
|
2
2
|
import { z } from "zod/mini";
|
|
3
3
|
|
|
4
4
|
//#region src/content/repeatable.d.ts
|
|
@@ -15,77 +15,12 @@ declare const RepeatableContentSchema: z.ZodMiniObject<{
|
|
|
15
15
|
}, Record<string, unknown>>>, z.ZodMiniObject<{
|
|
16
16
|
text: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
17
17
|
variant: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
18
|
-
value: z.ZodMiniType<
|
|
18
|
+
value: z.ZodMiniType<LinkContentValue, Record<string, unknown>, z.core.$ZodTypeInternals<LinkContentValue, Record<string, unknown>>>;
|
|
19
19
|
}, z.core.$strip>>, z.ZodMiniTransform<{
|
|
20
|
-
kind: "image";
|
|
21
|
-
id: string;
|
|
22
|
-
url: string;
|
|
23
|
-
height: string;
|
|
24
|
-
width: string;
|
|
25
|
-
size: string;
|
|
26
|
-
name: string;
|
|
27
|
-
__TYPE__: "ImageLink";
|
|
28
|
-
date?: string | null | undefined;
|
|
29
20
|
variant?: string | undefined;
|
|
30
21
|
text?: string | undefined;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
id: string;
|
|
34
|
-
url: string;
|
|
35
|
-
name: string;
|
|
36
|
-
size: string;
|
|
37
|
-
__TYPE__: "FileLink";
|
|
38
|
-
date?: string | null | undefined;
|
|
39
|
-
variant?: string | undefined;
|
|
40
|
-
text?: string | undefined;
|
|
41
|
-
} | {
|
|
42
|
-
kind: "document";
|
|
43
|
-
id: string;
|
|
44
|
-
__TYPE__: "DocumentLink";
|
|
45
|
-
variant?: string | undefined;
|
|
46
|
-
text?: string | undefined;
|
|
47
|
-
} | {
|
|
48
|
-
kind: "web";
|
|
49
|
-
url: string;
|
|
50
|
-
__TYPE__: "ExternalLink";
|
|
51
|
-
target?: string | null | undefined;
|
|
52
|
-
preview?: {
|
|
53
|
-
title?: string | undefined;
|
|
54
|
-
} | null | undefined;
|
|
55
|
-
variant?: string | undefined;
|
|
56
|
-
text?: string | undefined;
|
|
57
|
-
} | {
|
|
58
|
-
kind: "image";
|
|
59
|
-
__TYPE__: "ImageLink";
|
|
60
|
-
variant?: string | undefined;
|
|
61
|
-
text?: string | undefined;
|
|
62
|
-
} | {
|
|
63
|
-
kind: "file";
|
|
64
|
-
__TYPE__: "FileLink";
|
|
65
|
-
variant?: string | undefined;
|
|
66
|
-
text?: string | undefined;
|
|
67
|
-
} | {
|
|
68
|
-
kind: "media";
|
|
69
|
-
__TYPE__: "MediaLink";
|
|
70
|
-
variant?: string | undefined;
|
|
71
|
-
text?: string | undefined;
|
|
72
|
-
} | {
|
|
73
|
-
kind: "document";
|
|
74
|
-
__TYPE__: "DocumentLink";
|
|
75
|
-
variant?: string | undefined;
|
|
76
|
-
text?: string | undefined;
|
|
77
|
-
} | {
|
|
78
|
-
kind: "web";
|
|
79
|
-
__TYPE__: "ExternalLink";
|
|
80
|
-
variant?: string | undefined;
|
|
81
|
-
text?: string | undefined;
|
|
82
|
-
} | {
|
|
83
|
-
kind: "any";
|
|
84
|
-
__TYPE__: "AnyLink";
|
|
85
|
-
variant?: string | undefined;
|
|
86
|
-
text?: string | undefined;
|
|
87
|
-
}, {
|
|
88
|
-
value: LinkValueContent;
|
|
22
|
+
} & LinkContentValue, {
|
|
23
|
+
value: LinkContentValue;
|
|
89
24
|
text?: string | undefined;
|
|
90
25
|
variant?: string | undefined;
|
|
91
26
|
}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repeatable.d.ts","names":[],"sources":["../../src/content/repeatable.ts"],"mappings":";;;;cAMa,uBAAA,EAAuB,CAAA,CAAA,aAAA
|
|
1
|
+
{"version":3,"file":"repeatable.d.ts","names":[],"sources":["../../src/content/repeatable.ts"],"mappings":";;;;cAMa,uBAAA,EAAuB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;KAMxB,iBAAA,GAAoB,CAAA,CAAE,KAAA,QAAa,uBAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Span } from "./legacy/richText.js";
|
|
1
|
+
import { FilledLinkContentValue } from "./link.js";
|
|
2
|
+
import { RichTextNodeType, RichTextNodeTypes, Span } from "./legacy/richText.js";
|
|
3
3
|
import { z } from "zod/mini";
|
|
4
4
|
|
|
5
5
|
//#region src/content/richText.d.ts
|
|
6
|
-
type RichTextContentSpan = Span<
|
|
7
|
-
declare const
|
|
6
|
+
type RichTextContentSpan = Span<FilledLinkContentValue>;
|
|
7
|
+
declare const RichTextContentTextBlockSchema: z.ZodMiniObject<{
|
|
8
8
|
type: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"paragraph">, z.ZodMiniLiteral<"heading1">, z.ZodMiniLiteral<"heading2">, z.ZodMiniLiteral<"heading3">, z.ZodMiniLiteral<"heading4">, z.ZodMiniLiteral<"heading5">, z.ZodMiniLiteral<"heading6">, z.ZodMiniLiteral<"preformatted">, z.ZodMiniLiteral<"o-list-item">, z.ZodMiniLiteral<"list-item">]>;
|
|
9
9
|
content: z.ZodMiniObject<{
|
|
10
10
|
text: z.ZodMiniString<string>;
|
|
@@ -14,21 +14,21 @@ declare const TextBlockValueSchema: z.ZodMiniObject<{
|
|
|
14
14
|
end: number;
|
|
15
15
|
data: string;
|
|
16
16
|
} | {
|
|
17
|
-
type: "
|
|
17
|
+
type: "list-item" | "strong" | "em";
|
|
18
18
|
start: number;
|
|
19
19
|
end: number;
|
|
20
20
|
} | {
|
|
21
21
|
type: "hyperlink";
|
|
22
22
|
start: number;
|
|
23
23
|
end: number;
|
|
24
|
-
data:
|
|
24
|
+
data: FilledLinkContentValue;
|
|
25
25
|
})[], unknown[]>>>;
|
|
26
26
|
}, z.core.$strip>;
|
|
27
27
|
label: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
28
28
|
direction: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
29
29
|
}, z.core.$strip>;
|
|
30
|
-
type
|
|
31
|
-
declare const
|
|
30
|
+
type RichTextContentTextBlock = z.infer<typeof RichTextContentTextBlockSchema>;
|
|
31
|
+
declare const RichTextContentImageBlockSchema: z.ZodMiniObject<{
|
|
32
32
|
type: z.ZodMiniLiteral<"image">;
|
|
33
33
|
data: z.ZodMiniObject<{
|
|
34
34
|
origin: z.ZodMiniObject<{
|
|
@@ -51,13 +51,13 @@ declare const ImageBlockValueSchema: z.ZodMiniObject<{
|
|
|
51
51
|
credits: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
|
|
52
52
|
alt: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>, z.ZodMiniTransform<string | null, string | null | undefined>>>;
|
|
53
53
|
provider: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
54
|
-
linkTo: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniType<
|
|
54
|
+
linkTo: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniType<FilledLinkContentValue, unknown, z.core.$ZodTypeInternals<FilledLinkContentValue, unknown>>>>;
|
|
55
55
|
}, z.core.$strip>;
|
|
56
56
|
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
57
57
|
direction: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
58
58
|
}, z.core.$strip>;
|
|
59
|
-
type
|
|
60
|
-
declare const
|
|
59
|
+
type RichTextContentImageBlock = z.infer<typeof RichTextContentImageBlockSchema>;
|
|
60
|
+
declare const RichTextContentEmbedBlockSchema: z.ZodMiniObject<{
|
|
61
61
|
type: z.ZodMiniLiteral<"embed">;
|
|
62
62
|
data: z.ZodMiniObject<{
|
|
63
63
|
embed_url: z.ZodMiniString<string>;
|
|
@@ -79,13 +79,13 @@ declare const EmbedBlockValueSchema: z.ZodMiniObject<{
|
|
|
79
79
|
label: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
80
80
|
direction: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
|
|
81
81
|
}, z.core.$strip>;
|
|
82
|
-
type
|
|
83
|
-
type RichTextContentBlock =
|
|
82
|
+
type RichTextContentEmbedBlock = z.infer<typeof RichTextContentEmbedBlockSchema>;
|
|
83
|
+
type RichTextContentBlock = RichTextContentTextBlock | RichTextContentImageBlock | RichTextContentEmbedBlock;
|
|
84
84
|
declare const RichTextContentType: "StructuredTextContent";
|
|
85
85
|
type RichTextContent = {
|
|
86
86
|
__TYPE__: typeof RichTextContentType;
|
|
87
87
|
value: RichTextContentBlock[];
|
|
88
88
|
};
|
|
89
89
|
//#endregion
|
|
90
|
-
export { RichTextContent, RichTextContentBlock, RichTextContentSpan };
|
|
90
|
+
export { RichTextContent, RichTextContentBlock, RichTextContentEmbedBlock, RichTextContentImageBlock, RichTextContentSpan, RichTextContentTextBlock };
|
|
91
91
|
//# sourceMappingURL=richText.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richText.d.ts","names":[],"sources":["../../src/content/richText.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"richText.d.ts","names":[],"sources":["../../src/content/richText.ts"],"mappings":";;;;;KAkBY,mBAAA,GAAsB,IAAA,CAAK,sBAAA;AAAA,cAOjC,8BAAA,EAA8B,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;KACxB,wBAAA,GAA2B,CAAA,CAAE,KAAA,QAAa,8BAAA;AAAA,cAEhD,+BAAA,EAA+B,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIzB,yBAAA,GAA4B,CAAA,CAAE,KAAA,QAAa,+BAAA;AAAA,cAEjD,+BAAA,EAA+B,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;KACzB,yBAAA,GAA4B,CAAA,CAAE,KAAA,QAAa,+BAAA;AAAA,KAY3C,oBAAA,GACT,wBAAA,GACA,yBAAA,GACA,yBAAA;AAAA,cAEU,mBAAA;AAAA,KAED,eAAA;EACX,QAAA,SAAiB,mBAAA;EACjB,KAAA,EAAO,oBAAA;AAAA"}
|
package/dist/content/richText.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { EmbedContentSchema } from "./embed.js";
|
|
2
|
-
import {
|
|
3
|
-
import { FilledLinkValueContentSchema } from "./link.js";
|
|
2
|
+
import { ImageContentViewSchema } from "./image.js";
|
|
4
3
|
import { getEmbedBlockSchema, getImageBlockSchema, getSpanSchema, getTextBlockSchema } from "./legacy/richText.js";
|
|
4
|
+
import { FilledLinkContentValueSchema } from "./link.js";
|
|
5
5
|
import { z } from "zod/mini";
|
|
6
6
|
//#region src/content/richText.ts
|
|
7
|
-
const RichTextContentSpanSchema = getSpanSchema(
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const RichTextContentBlockSchema = z.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
const RichTextContentSpanSchema = getSpanSchema(FilledLinkContentValueSchema);
|
|
8
|
+
const RichTextContentTextBlockSchema = getTextBlockSchema(FilledLinkContentValueSchema);
|
|
9
|
+
const RichTextContentImageBlockSchema = getImageBlockSchema(ImageContentViewSchema, FilledLinkContentValueSchema);
|
|
10
|
+
const RichTextContentEmbedBlockSchema = getEmbedBlockSchema(EmbedContentSchema);
|
|
11
|
+
const RichTextContentBlockSchema = z.discriminatedUnion("type", [
|
|
12
|
+
RichTextContentTextBlockSchema,
|
|
13
|
+
RichTextContentImageBlockSchema,
|
|
14
|
+
RichTextContentEmbedBlockSchema
|
|
15
15
|
]);
|
|
16
16
|
const RichTextContentType = "StructuredTextContent";
|
|
17
17
|
const RichTextContentSchema = z.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richText.js","names":[],"sources":["../../src/content/richText.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { EmbedContentSchema } from \"./embed\"\nimport {
|
|
1
|
+
{"version":3,"file":"richText.js","names":[],"sources":["../../src/content/richText.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { EmbedContentSchema } from \"./embed\"\nimport { ImageContentViewSchema } from \"./image\"\nimport {\n\tgetEmbedBlockSchema,\n\tgetImageBlockSchema,\n\tgetSpanSchema,\n\tgetTextBlockSchema,\n} from \"./legacy/richText\"\nimport type { Span } from \"./legacy/richText\"\nimport type { FilledLinkContentValue } from \"./link\"\nimport { FilledLinkContentValueSchema } from \"./link\"\n\nexport { RichTextNodeType } from \"./legacy/richText\"\nexport type { RichTextNodeTypes } from \"./legacy/richText\"\n\n// Spans\nexport type RichTextContentSpan = Span<FilledLinkContentValue>\n\nexport const RichTextContentSpanSchema: z.ZodMiniType<RichTextContentSpan> = getSpanSchema(\n\tFilledLinkContentValueSchema,\n)\n\n// Blocks\nconst RichTextContentTextBlockSchema = getTextBlockSchema(FilledLinkContentValueSchema)\nexport type RichTextContentTextBlock = z.infer<typeof RichTextContentTextBlockSchema>\n\nconst RichTextContentImageBlockSchema = getImageBlockSchema(\n\tImageContentViewSchema,\n\tFilledLinkContentValueSchema,\n)\nexport type RichTextContentImageBlock = z.infer<typeof RichTextContentImageBlockSchema>\n\nconst RichTextContentEmbedBlockSchema = getEmbedBlockSchema(EmbedContentSchema)\nexport type RichTextContentEmbedBlock = z.infer<typeof RichTextContentEmbedBlockSchema>\n\nexport const RichTextContentBlockSchema: z.ZodMiniType<RichTextContentBlock> = z.discriminatedUnion(\n\t\"type\",\n\t[\n\t\tRichTextContentTextBlockSchema,\n\t\tRichTextContentImageBlockSchema,\n\t\tRichTextContentEmbedBlockSchema,\n\t],\n)\n\n// Used by content/codec/richText\nexport type RichTextContentBlock =\n\t| RichTextContentTextBlock\n\t| RichTextContentImageBlock\n\t| RichTextContentEmbedBlock\n\nexport const RichTextContentType = \"StructuredTextContent\" as const\n\nexport type RichTextContent = {\n\t__TYPE__: typeof RichTextContentType\n\tvalue: RichTextContentBlock[]\n}\n\nexport const RichTextContentSchema = z.object({\n\t__TYPE__: z.literal(RichTextContentType),\n\tvalue: z.array(RichTextContentBlockSchema),\n})\n"],"mappings":";;;;;;AAoBA,MAAa,4BAAgE,cAC5E,6BACA;AAGD,MAAM,iCAAiC,mBAAmB,6BAA6B;AAGvF,MAAM,kCAAkC,oBACvC,wBACA,6BACA;AAGD,MAAM,kCAAkC,oBAAoB,mBAAmB;AAG/E,MAAa,6BAAkE,EAAE,mBAChF,QACA;CACC;CACA;CACA;CACA,CACD;AAQD,MAAa,sBAAsB;AAOnC,MAAa,wBAAwB,EAAE,OAAO;CAC7C,UAAU,EAAE,QAAQ,oBAAoB;CACxC,OAAO,EAAE,MAAM,2BAA2B;CAC1C,CAAC"}
|