@prismicio/types-internal 4.1.0-canary.9e28a5d → 4.1.0-canary.9fc1e05
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/dist/content/field.js +1 -1
- 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/legacy/richText.d.ts +23 -12
- package/dist/content/legacy/richText.d.ts.map +1 -1
- package/dist/content/legacy/richText.js +2 -2
- package/dist/content/legacy/richText.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 +3 -9
- package/dist/content/nestable.js.map +1 -1
- package/dist/content/richText.d.ts +1 -1
- package/dist/content/richText.d.ts.map +1 -1
- package/dist/content/richText.js +1 -1
- 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/index.d.ts +4 -4
- package/dist/io-ts.d.ts +5157 -1952
- package/dist/io-ts.d.ts.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/slice.d.ts +10 -10
- package/dist/model/slice.d.ts.map +1 -1
- package/dist/model/slice.js +5 -5
- package/dist/model/slice.js.map +1 -1
- package/dist/model/widget.d.ts.map +1 -1
- package/dist/model/widget.js +2 -2
- package/dist/model/widget.js.map +1 -1
- package/dist/zod4.d.ts +1809 -256
- package/dist/zod4.d.ts.map +1 -1
- package/package.json +9 -6
- package/src/content/field.ts +1 -1
- package/src/content/group.ts +1 -1
- package/src/content/legacy/richText.ts +14 -21
- package/src/content/nestable.ts +3 -18
- package/src/content/richText.ts +9 -6
- package/src/content/slice.ts +1 -1
- package/src/content/widget.ts +1 -1
- package/src/model/group.ts +1 -1
- package/src/model/nestable.ts +1 -1
- package/src/model/slice.ts +16 -17
- package/src/model/widget.ts +8 -12
package/dist/content/field.js
CHANGED
|
@@ -37,7 +37,7 @@ const SelectContentSchema = z.object({
|
|
|
37
37
|
value: z.string().check(z.trim()),
|
|
38
38
|
__TYPE__: z.literal(FieldContentType)
|
|
39
39
|
});
|
|
40
|
-
const FieldContentSchema = z.
|
|
40
|
+
const FieldContentSchema = z.discriminatedUnion("type", [
|
|
41
41
|
TextContentSchema,
|
|
42
42
|
ColorContentSchema,
|
|
43
43
|
DateContentSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","names":[],"sources":["../../src/content/field.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const FieldContentType = \"FieldContent\" as const\nexport const SelectFieldType = \"Select\" as const\n\n// Text\nexport const TextContentSchema = z.object({\n\ttype: z.literal(\"Text\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Color\nexport const ColorContentSchema = z.object({\n\ttype: z.literal(\"Color\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Date\nexport const DateContentSchema = z.object({\n\ttype: z.literal(\"Date\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Timestamp\nexport const TimestampContentSchema = z.object({\n\ttype: z.literal(\"Timestamp\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Number\nexport const NumberContentSchema = z.object({\n\ttype: z.literal(\"Number\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Range\nexport const RangeContentSchema = z.object({\n\ttype: z.literal(\"Range\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Select\nexport const SelectContentSchema = z.object({\n\ttype: z.literal(SelectFieldType),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Fields\nexport const FieldContentSchema
|
|
1
|
+
{"version":3,"file":"field.js","names":[],"sources":["../../src/content/field.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nexport const FieldContentType = \"FieldContent\" as const\nexport const SelectFieldType = \"Select\" as const\n\n// Text\nexport const TextContentSchema = z.object({\n\ttype: z.literal(\"Text\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Color\nexport const ColorContentSchema = z.object({\n\ttype: z.literal(\"Color\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Date\nexport const DateContentSchema = z.object({\n\ttype: z.literal(\"Date\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Timestamp\nexport const TimestampContentSchema = z.object({\n\ttype: z.literal(\"Timestamp\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Number\nexport const NumberContentSchema = z.object({\n\ttype: z.literal(\"Number\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Range\nexport const RangeContentSchema = z.object({\n\ttype: z.literal(\"Range\"),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Select\nexport const SelectContentSchema = z.object({\n\ttype: z.literal(SelectFieldType),\n\tvalue: z.string().check(z.trim()),\n\t__TYPE__: z.literal(FieldContentType),\n})\n\n// Fields\nexport const FieldContentSchema = z.discriminatedUnion(\"type\", [\n\tTextContentSchema,\n\tColorContentSchema,\n\tDateContentSchema,\n\tTimestampContentSchema,\n\tNumberContentSchema,\n\tRangeContentSchema,\n\tSelectContentSchema,\n])\n\nexport type TextContent = z.infer<typeof TextContentSchema>\nexport type ColorContent = z.infer<typeof ColorContentSchema>\nexport type DateContent = z.infer<typeof DateContentSchema>\nexport type TimestampContent = z.infer<typeof TimestampContentSchema>\nexport type NumberContent = z.infer<typeof NumberContentSchema>\nexport type RangeContent = z.infer<typeof RangeContentSchema>\nexport type SelectContent = z.infer<typeof SelectContentSchema>\nexport type FieldContent =\n\t| TextContent\n\t| ColorContent\n\t| DateContent\n\t| TimestampContent\n\t| NumberContent\n\t| RangeContent\n\t| SelectContent\n"],"mappings":";;AAEA,MAAa,mBAAmB;AAChC,MAAa,kBAAkB;AAG/B,MAAa,oBAAoB,EAAE,OAAO;CACzC,MAAM,EAAE,QAAQ,OAAO;CACvB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,UAAU,EAAE,QAAQ,iBAAiB;CACrC,CAAC;AAGF,MAAa,qBAAqB,EAAE,OAAO;CAC1C,MAAM,EAAE,QAAQ,QAAQ;CACxB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,UAAU,EAAE,QAAQ,iBAAiB;CACrC,CAAC;AAGF,MAAa,oBAAoB,EAAE,OAAO;CACzC,MAAM,EAAE,QAAQ,OAAO;CACvB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,UAAU,EAAE,QAAQ,iBAAiB;CACrC,CAAC;AAGF,MAAa,yBAAyB,EAAE,OAAO;CAC9C,MAAM,EAAE,QAAQ,YAAY;CAC5B,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,UAAU,EAAE,QAAQ,iBAAiB;CACrC,CAAC;AAGF,MAAa,sBAAsB,EAAE,OAAO;CAC3C,MAAM,EAAE,QAAQ,SAAS;CACzB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,UAAU,EAAE,QAAQ,iBAAiB;CACrC,CAAC;AAGF,MAAa,qBAAqB,EAAE,OAAO;CAC1C,MAAM,EAAE,QAAQ,QAAQ;CACxB,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,UAAU,EAAE,QAAQ,iBAAiB;CACrC,CAAC;AAGF,MAAa,sBAAsB,EAAE,OAAO;CAC3C,MAAM,EAAE,QAAQ,gBAAgB;CAChC,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACjC,UAAU,EAAE,QAAQ,iBAAiB;CACrC,CAAC;AAGF,MAAa,qBAAqB,EAAE,mBAAmB,QAAQ;CAC9D;CACA;CACA;CACA;CACA;CACA;CACA;CACA,CAAC"}
|
package/dist/content/group.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ declare const GroupContentSchema: z.ZodMiniObject<{
|
|
|
13
13
|
value: z.ZodMiniArray<z.ZodMiniType<GroupItemContent, unknown, z.core.$ZodTypeInternals<GroupItemContent, unknown>>>;
|
|
14
14
|
}, z.core.$strip>;
|
|
15
15
|
type GroupContent = z.infer<typeof GroupContentSchema>;
|
|
16
|
-
type NestableAndGroupContent = NestableContent | GroupContent;
|
|
17
16
|
//#endregion
|
|
18
|
-
export { GroupContent, GroupItemContent
|
|
17
|
+
export { GroupContent, GroupItemContent };
|
|
19
18
|
//# sourceMappingURL=group.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","names":[],"sources":["../../src/content/group.ts"],"mappings":";;;;cAMa,oBAAA;AAAA,KAkBD,gBAAA;EACX,QAAA,SAAiB,oBAAA;EACjB,GAAA;EACA,KAAA,WAAgB,eAAA,GAAkB,YAAA;AAAA;AAAA,cAMtB,kBAAA,EAAkB,CAAA,CAAA,aAAA;;;;KAKnB,YAAA,GAAe,CAAA,CAAE,KAAA,QAAa,kBAAA
|
|
1
|
+
{"version":3,"file":"group.d.ts","names":[],"sources":["../../src/content/group.ts"],"mappings":";;;;cAMa,oBAAA;AAAA,KAkBD,gBAAA;EACX,QAAA,SAAiB,oBAAA;EACjB,GAAA;EACA,KAAA,WAAgB,eAAA,GAAkB,YAAA;AAAA;AAAA,cAMtB,kBAAA,EAAkB,CAAA,CAAA,aAAA;;;;KAKnB,YAAA,GAAe,CAAA,CAAE,KAAA,QAAa,kBAAA"}
|
package/dist/content/group.js
CHANGED
|
@@ -12,7 +12,7 @@ const GroupContentSchema = z.object({
|
|
|
12
12
|
__TYPE__: z.literal(GroupContentType),
|
|
13
13
|
value: z.array(GroupItemContentSchema)
|
|
14
14
|
});
|
|
15
|
-
const NestableAndGroupContentSchema = z.
|
|
15
|
+
const NestableAndGroupContentSchema = z.discriminatedUnion("__TYPE__", [NestableContentSchema, GroupContentSchema]);
|
|
16
16
|
//#endregion
|
|
17
17
|
export { GroupContentSchema, GroupContentType, GroupItemContentSchema, GroupItemContentType, NestableAndGroupContentSchema };
|
|
18
18
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","names":[],"sources":["../../src/content/group.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { NestableContentSchema } from \"./nestable\"\nimport type { NestableContent } from \"./nestable\"\n\n// Item\nexport const GroupItemContentType = \"GroupItemContent\" as const\n\nexport const GroupItemContentSchema: z.ZodMiniType<GroupItemContent> = z.object({\n\t__TYPE__: z.literal(GroupItemContentType),\n\tkey: z.string(),\n\tvalue: z.array(\n\t\tz.tuple([\n\t\t\tz.string(),\n\t\t\tz.union([\n\t\t\t\tNestableContentSchema,\n\t\t\t\t// `lazy` is used to handle circular dependency on GroupContentSchema\n\t\t\t\tz.lazy(() => GroupContentSchema),\n\t\t\t]),\n\t\t]),\n\t),\n})\n\n// Manual type definition to handle circular dependency on GroupItemContentSchema\nexport type GroupItemContent = {\n\t__TYPE__: typeof GroupItemContentType\n\tkey: string\n\tvalue: [string, NestableContent | GroupContent][]\n}\n\n// Group\nexport const GroupContentType = \"GroupContentType\" as const\n\nexport const GroupContentSchema = z.object({\n\t__TYPE__: z.literal(GroupContentType),\n\tvalue: z.array(GroupItemContentSchema),\n})\n\nexport type GroupContent = z.infer<typeof GroupContentSchema>\n\nexport const NestableAndGroupContentSchema
|
|
1
|
+
{"version":3,"file":"group.js","names":[],"sources":["../../src/content/group.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { NestableContentSchema } from \"./nestable\"\nimport type { NestableContent } from \"./nestable\"\n\n// Item\nexport const GroupItemContentType = \"GroupItemContent\" as const\n\nexport const GroupItemContentSchema: z.ZodMiniType<GroupItemContent> = z.object({\n\t__TYPE__: z.literal(GroupItemContentType),\n\tkey: z.string(),\n\tvalue: z.array(\n\t\tz.tuple([\n\t\t\tz.string(),\n\t\t\tz.union([\n\t\t\t\tNestableContentSchema,\n\t\t\t\t// `lazy` is used to handle circular dependency on GroupContentSchema\n\t\t\t\tz.lazy(() => GroupContentSchema),\n\t\t\t]),\n\t\t]),\n\t),\n})\n\n// Manual type definition to handle circular dependency on GroupItemContentSchema\nexport type GroupItemContent = {\n\t__TYPE__: typeof GroupItemContentType\n\tkey: string\n\tvalue: [string, NestableContent | GroupContent][]\n}\n\n// Group\nexport const GroupContentType = \"GroupContentType\" as const\n\nexport const GroupContentSchema = z.object({\n\t__TYPE__: z.literal(GroupContentType),\n\tvalue: z.array(GroupItemContentSchema),\n})\n\nexport type GroupContent = z.infer<typeof GroupContentSchema>\n\nexport const NestableAndGroupContentSchema = z.discriminatedUnion(\"__TYPE__\", [\n\tNestableContentSchema,\n\tGroupContentSchema,\n])\n\nexport type NestableAndGroupContent = NestableContent | GroupContent\n"],"mappings":";;;AAMA,MAAa,uBAAuB;AAEpC,MAAa,yBAA0D,EAAE,OAAO;CAC/E,UAAU,EAAE,QAAQ,qBAAqB;CACzC,KAAK,EAAE,QAAQ;CACf,OAAO,EAAE,MACR,EAAE,MAAM,CACP,EAAE,QAAQ,EACV,EAAE,MAAM,CACP,uBAEA,EAAE,WAAW,mBAAmB,CAChC,CAAC,CACF,CAAC,CACF;CACD,CAAC;AAUF,MAAa,mBAAmB;AAEhC,MAAa,qBAAqB,EAAE,OAAO;CAC1C,UAAU,EAAE,QAAQ,iBAAiB;CACrC,OAAO,EAAE,MAAM,uBAAuB;CACtC,CAAC;AAIF,MAAa,gCAAgC,EAAE,mBAAmB,YAAY,CAC7E,uBACA,mBACA,CAAC"}
|
|
@@ -27,23 +27,34 @@ type HyperlinkSpan<TData extends FilledLinkLegacyValue | FilledLinkContentValue>
|
|
|
27
27
|
end: number;
|
|
28
28
|
data: TData;
|
|
29
29
|
};
|
|
30
|
-
|
|
31
|
-
type: "label"
|
|
32
|
-
start: number
|
|
33
|
-
end: number
|
|
34
|
-
data: string
|
|
35
|
-
}
|
|
36
|
-
type
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
declare const LabelSpanSchema: z.ZodMiniObject<{
|
|
31
|
+
type: z.ZodMiniLiteral<"label">;
|
|
32
|
+
start: z.ZodMiniNumber<number>;
|
|
33
|
+
end: z.ZodMiniNumber<number>;
|
|
34
|
+
data: z.ZodMiniPipe<z.ZodMiniUnknown, z.ZodMiniTransform<string, unknown>>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
type LabelSpan = z.infer<typeof LabelSpanSchema>;
|
|
37
|
+
declare const BasicSpanSchema: z.ZodMiniObject<{
|
|
38
|
+
type: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"strong">, z.ZodMiniLiteral<"em">, z.ZodMiniLiteral<"list-item">]>;
|
|
39
|
+
start: z.ZodMiniNumber<number>;
|
|
40
|
+
end: z.ZodMiniNumber<number>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
type BasicSpan = z.infer<typeof BasicSpanSchema>;
|
|
41
43
|
type Span<TLink extends FilledLinkLegacyValue | FilledLinkContentValue> = HyperlinkSpan<TLink> | LabelSpan | BasicSpan;
|
|
42
44
|
declare const TextBlockLegacySchema: z.ZodMiniObject<{
|
|
43
45
|
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">]>;
|
|
44
46
|
content: z.ZodMiniObject<{
|
|
45
47
|
text: z.ZodMiniString<string>;
|
|
46
|
-
spans: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniArray<z.ZodMiniUnknown>, z.ZodMiniTransform<(
|
|
48
|
+
spans: z.ZodMiniOptional<z.ZodMiniPipe<z.ZodMiniArray<z.ZodMiniUnknown>, z.ZodMiniTransform<({
|
|
49
|
+
type: "label";
|
|
50
|
+
start: number;
|
|
51
|
+
end: number;
|
|
52
|
+
data: string;
|
|
53
|
+
} | {
|
|
54
|
+
type: "list-item" | "strong" | "em";
|
|
55
|
+
start: number;
|
|
56
|
+
end: number;
|
|
57
|
+
} | {
|
|
47
58
|
type: "hyperlink";
|
|
48
59
|
start: number;
|
|
49
60
|
end: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richText.d.ts","names":[],"sources":["../../../src/content/legacy/richText.ts"],"mappings":";;;;;cAYa,gBAAA;EAAA;;;;;;;;;;;;;;;;KAkBD,iBAAA,WAA4B,gBAAA,eAA+B,gBAAA;AAAA,KAGlE,aAAA,eAA4B,qBAAA,GAAwB,sBAAA;EACxD,IAAA,SAAa,gBAAA,CAAiB,SAAA;EAC9B,KAAA;EACA,GAAA;EACA,IAAA,EAAM,KAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"richText.d.ts","names":[],"sources":["../../../src/content/legacy/richText.ts"],"mappings":";;;;;cAYa,gBAAA;EAAA;;;;;;;;;;;;;;;;KAkBD,iBAAA,WAA4B,gBAAA,eAA+B,gBAAA;AAAA,KAGlE,aAAA,eAA4B,qBAAA,GAAwB,sBAAA;EACxD,IAAA,SAAa,gBAAA,CAAiB,SAAA;EAC9B,KAAA;EACA,GAAA;EACA,IAAA,EAAM,KAAA;AAAA;AAAA,cAeD,eAAA,EAAe,CAAA,CAAA,aAAA;;;;;;KAShB,SAAA,GAAY,CAAA,CAAE,KAAA,QAAa,eAAA;AAAA,cAE1B,eAAA,EAAe,CAAA,CAAA,aAAA;;;;;KAShB,SAAA,GAAY,CAAA,CAAE,KAAA,QAAa,eAAA;AAAA,KAEpB,IAAA,eAAmB,qBAAA,GAAwB,sBAAA,IACpD,aAAA,CAAc,KAAA,IACd,SAAA,GACA,SAAA;AAAA,cA2DG,qBAAA,EAAqB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;KAEtB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;AAAA,cAmBhC,sBAAA,EAAsB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAKvB,gBAAA,GAAmB,CAAA,CAAE,KAAA,QAAa,sBAAA;AAAA,cAgBjC,sBAAA,EAAsB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;KAEvB,gBAAA,GAAmB,CAAA,CAAE,KAAA,QAAa,sBAAA;AAAA,KAQ3B,mBAAA,GAAsB,eAAA,GAAkB,gBAAA,GAAmB,gBAAA"}
|
|
@@ -41,7 +41,7 @@ const BasicSpanSchema = z.object({
|
|
|
41
41
|
start: z.number(),
|
|
42
42
|
end: z.number()
|
|
43
43
|
});
|
|
44
|
-
const getSpanSchema = (linkSchema) => z.
|
|
44
|
+
const getSpanSchema = (linkSchema) => z.discriminatedUnion("type", [
|
|
45
45
|
getHyperlinkSpanSchema(linkSchema),
|
|
46
46
|
LabelSpanSchema,
|
|
47
47
|
BasicSpanSchema
|
|
@@ -88,7 +88,7 @@ const getEmbedBlockSchema = (data) => z.object({
|
|
|
88
88
|
direction: z.nullish(z.string())
|
|
89
89
|
});
|
|
90
90
|
const EmbedBlockLegacySchema = getEmbedBlockSchema(EmbedLegacyLooseSchema);
|
|
91
|
-
const RichTextLegacyBlockSchema = z.
|
|
91
|
+
const RichTextLegacyBlockSchema = z.discriminatedUnion("type", [
|
|
92
92
|
TextBlockLegacySchema,
|
|
93
93
|
ImageBlockLegacySchema,
|
|
94
94
|
EmbedBlockLegacySchema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richText.js","names":[],"sources":["../../../src/content/legacy/richText.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n// It's important to only import the types here to\n// avoid runtime circular dependencies!\nimport type { EmbedContentSchema } from \"../embed\"\nimport type { ImageContentViewSchema } from \"../image\"\nimport type { FilledLinkContentValue, FilledLinkContentValueSchema } from \"../link\"\nimport { EmbedLegacyLooseSchema } from \"./embed\"\nimport { ImageLegacyViewSchema } from \"./image\"\nimport { FilledLinkLegacyValueSchema } from \"./link\"\nimport type { FilledLinkLegacyValue } from \"./link\"\n\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\n\tpreformatted: \"preformatted\",\n\toListItem: \"o-list-item\",\n\tlistItem: \"list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tstrong: \"strong\",\n\tem: \"em\",\n} as const\n\nexport type RichTextNodeTypes = (typeof RichTextNodeType)[keyof typeof RichTextNodeType]\n\n// Spans\ntype HyperlinkSpan<TData extends FilledLinkLegacyValue | FilledLinkContentValue> = {\n\ttype: typeof RichTextNodeType.hyperlink\n\tstart: number\n\tend: number\n\tdata: TData\n}\n\nconst getHyperlinkSpanSchema = <\n\tTData extends typeof FilledLinkLegacyValueSchema | typeof FilledLinkContentValueSchema,\n>(\n\tdata: TData,\n) =>\n\tz.object({\n\t\ttype: z.literal(RichTextNodeType.hyperlink),\n\t\tstart: z.number(),\n\t\tend: z.number(),\n\t\tdata,\n\t})\n\
|
|
1
|
+
{"version":3,"file":"richText.js","names":[],"sources":["../../../src/content/legacy/richText.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n// It's important to only import the types here to\n// avoid runtime circular dependencies!\nimport type { EmbedContentSchema } from \"../embed\"\nimport type { ImageContentViewSchema } from \"../image\"\nimport type { FilledLinkContentValue, FilledLinkContentValueSchema } from \"../link\"\nimport { EmbedLegacyLooseSchema } from \"./embed\"\nimport { ImageLegacyViewSchema } from \"./image\"\nimport { FilledLinkLegacyValueSchema } from \"./link\"\nimport type { FilledLinkLegacyValue } from \"./link\"\n\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\n\tpreformatted: \"preformatted\",\n\toListItem: \"o-list-item\",\n\tlistItem: \"list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tstrong: \"strong\",\n\tem: \"em\",\n} as const\n\nexport type RichTextNodeTypes = (typeof RichTextNodeType)[keyof typeof RichTextNodeType]\n\n// Spans\ntype HyperlinkSpan<TData extends FilledLinkLegacyValue | FilledLinkContentValue> = {\n\ttype: typeof RichTextNodeType.hyperlink\n\tstart: number\n\tend: number\n\tdata: TData\n}\n\nconst getHyperlinkSpanSchema = <\n\tTData extends typeof FilledLinkLegacyValueSchema | typeof FilledLinkContentValueSchema,\n>(\n\tdata: TData,\n) =>\n\tz.object({\n\t\ttype: z.literal(RichTextNodeType.hyperlink),\n\t\tstart: z.number(),\n\t\tend: z.number(),\n\t\tdata,\n\t})\n\nconst LabelSpanSchema = z.object({\n\ttype: z.literal(\"label\"),\n\tstart: z.number(),\n\tend: z.number(),\n\tdata: z.pipe(\n\t\tz.unknown(),\n\t\tz.transform((value) => (typeof value === \"string\" && value.length > 0 ? value : \"\")),\n\t),\n})\ntype LabelSpan = z.infer<typeof LabelSpanSchema>\n\nconst BasicSpanSchema = z.object({\n\ttype: z.union([\n\t\tz.literal(RichTextNodeType.strong),\n\t\tz.literal(RichTextNodeType.em),\n\t\tz.literal(\"list-item\"), // legacy case\n\t]),\n\tstart: z.number(),\n\tend: z.number(),\n})\ntype BasicSpan = z.infer<typeof BasicSpanSchema>\n\nexport type Span<TLink extends FilledLinkLegacyValue | FilledLinkContentValue> =\n\t| HyperlinkSpan<TLink>\n\t| LabelSpan\n\t| BasicSpan\n\n// oxlint-disable-next-line explicit-module-boundary-types\nexport const getSpanSchema = <\n\tTLinkSchema extends typeof FilledLinkLegacyValueSchema | typeof FilledLinkContentValueSchema,\n>(\n\tlinkSchema: TLinkSchema,\n) =>\n\tz.discriminatedUnion(\"type\", [\n\t\tgetHyperlinkSpanSchema(linkSchema),\n\t\tLabelSpanSchema,\n\t\tBasicSpanSchema,\n\t])\n\n// Text blocks\nconst TextBlockTypeSchema = z.union([\n\tz.literal(RichTextNodeType.paragraph),\n\tz.literal(RichTextNodeType.heading1),\n\tz.literal(RichTextNodeType.heading2),\n\tz.literal(RichTextNodeType.heading3),\n\tz.literal(RichTextNodeType.heading4),\n\tz.literal(RichTextNodeType.heading5),\n\tz.literal(RichTextNodeType.heading6),\n\tz.literal(RichTextNodeType.preformatted),\n\tz.literal(RichTextNodeType.oListItem),\n\tz.literal(RichTextNodeType.listItem),\n])\n\n// oxlint-disable-next-line explicit-module-boundary-types\nexport const getTextBlockSchema = <\n\tTLinkSchema extends typeof FilledLinkLegacyValueSchema | typeof FilledLinkContentValueSchema,\n>(\n\tlinkSchema: TLinkSchema,\n) =>\n\tz.object({\n\t\ttype: TextBlockTypeSchema,\n\t\tcontent: z.object({\n\t\t\ttext: z.string(),\n\t\t\tspans: z.optional(\n\t\t\t\tz.pipe(\n\t\t\t\t\tz.array(z.unknown()),\n\t\t\t\t\tz.transform((spans) => {\n\t\t\t\t\t\tconst spanSchema = getSpanSchema(linkSchema)\n\n\t\t\t\t\t\t// Filter out invalid spans and order them by start position\n\t\t\t\t\t\treturn spans\n\t\t\t\t\t\t\t.flatMap((maybeSpan) => {\n\t\t\t\t\t\t\t\tconst parsed = spanSchema.safeParse(maybeSpan)\n\t\t\t\t\t\t\t\treturn parsed.success ? [parsed.data] : []\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.sort((a, b) => a.start - b.start)\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t),\n\t\t}),\n\t\tlabel: z.optional(z.string()),\n\t\tdirection: z.optional(z.string()),\n\t})\n\nconst TextBlockLegacySchema = getTextBlockSchema(FilledLinkLegacyValueSchema)\n\ntype TextBlockLegacy = z.infer<typeof TextBlockLegacySchema>\n\n// Image block\n\n// oxlint-disable-next-line explicit-module-boundary-types\nexport const getImageBlockSchema = <\n\tTData extends typeof ImageLegacyViewSchema | typeof ImageContentViewSchema,\n\tTLinkTo extends typeof FilledLinkLegacyValueSchema | typeof FilledLinkContentValueSchema,\n>(\n\tdata: TData,\n\tlinkTo: TLinkTo,\n) =>\n\tz.object({\n\t\ttype: z.literal(RichTextNodeType.image),\n\t\tdata: z.extend(data, { linkTo: z.nullish(linkTo) }),\n\t\tlabel: z.nullish(z.string()),\n\t\tdirection: z.nullish(z.string()),\n\t})\n\nconst ImageBlockLegacySchema = getImageBlockSchema(\n\tImageLegacyViewSchema,\n\tFilledLinkLegacyValueSchema,\n)\n\ntype ImageBlockLegacy = z.infer<typeof ImageBlockLegacySchema>\n\n// Embed block\n// oxlint-disable-next-line explicit-module-boundary-types\nexport const getEmbedBlockSchema = <\n\tTData extends typeof EmbedLegacyLooseSchema | typeof EmbedContentSchema,\n>(\n\tdata: TData,\n) =>\n\tz.object({\n\t\ttype: z.literal(RichTextNodeType.embed),\n\t\tdata,\n\t\tlabel: z.nullish(z.string()),\n\t\tdirection: z.nullish(z.string()),\n\t})\n\nconst EmbedBlockLegacySchema = getEmbedBlockSchema(EmbedLegacyLooseSchema)\n\ntype EmbedBlockLegacy = z.infer<typeof EmbedBlockLegacySchema>\n\n// Blocks\nexport const RichTextLegacyBlockSchema: z.ZodMiniType<RichTextLegacyBlock> = z.discriminatedUnion(\n\t\"type\",\n\t[TextBlockLegacySchema, ImageBlockLegacySchema, EmbedBlockLegacySchema],\n)\n\nexport type RichTextLegacyBlock = TextBlockLegacy | ImageBlockLegacy | EmbedBlockLegacy\n\nexport const RichTextLegacySchema = z.array(RichTextLegacyBlockSchema)\n\nexport type RichTextLegacy = z.infer<typeof RichTextLegacySchema>\n"],"mappings":"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"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { BooleanContent } from "./boolean.js";
|
|
2
|
+
import { LinkContent } from "./link.js";
|
|
2
3
|
import { EmbedContent } from "./embed.js";
|
|
4
|
+
import { ImageContent } from "./image.js";
|
|
5
|
+
import { RichTextContent } from "./richText.js";
|
|
3
6
|
import { EmptyContent } from "./empty.js";
|
|
4
7
|
import { ColorContent, DateContent, NumberContent, RangeContent, SelectContent, TextContent, TimestampContent } from "./field.js";
|
|
5
8
|
import { GeoPointContent } from "./geopoint.js";
|
|
6
|
-
import { ImageContent } from "./image.js";
|
|
7
9
|
import { IntegrationFieldContent } from "./integrationField.js";
|
|
8
|
-
import { LinkContent } from "./link.js";
|
|
9
10
|
import { RepeatableContent } from "./repeatable.js";
|
|
10
|
-
import { RichTextContent } from "./richText.js";
|
|
11
11
|
import { SeparatorContent } from "./separator.js";
|
|
12
12
|
import { TableContent } from "./table.js";
|
|
13
13
|
import { z } from "zod/mini";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestable.d.ts","names":[],"sources":["../../src/content/nestable.ts"],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"nestable.d.ts","names":[],"sources":["../../src/content/nestable.ts"],"mappings":";;;;;;;;;;;;;;;KAkDY,eAAA,GACT,YAAA,GACA,cAAA,GACA,YAAA,GACA,WAAA,GACA,YAAA,GACA,eAAA,GACA,YAAA,GACA,uBAAA,GACA,WAAA,GACA,aAAA,GACA,YAAA,GACA,iBAAA,GACA,eAAA,GACA,aAAA,GACA,gBAAA,GACA,YAAA,GACA,WAAA,GACA,gBAAA"}
|
package/dist/content/nestable.js
CHANGED
|
@@ -4,7 +4,7 @@ import { LinkContentSchema, LinkContentType } from "./link.js";
|
|
|
4
4
|
import { RichTextContentSchema, RichTextContentType } from "./richText.js";
|
|
5
5
|
import { BooleanContentSchema, BooleanContentType } from "./boolean.js";
|
|
6
6
|
import { EmptyContentSchema, EmptyContentType } from "./empty.js";
|
|
7
|
-
import {
|
|
7
|
+
import { FieldContentSchema, FieldContentType } from "./field.js";
|
|
8
8
|
import { GeoPointContentSchema, GeoPointContentType } from "./geopoint.js";
|
|
9
9
|
import { IntegrationFieldContentSchema, IntegrationFieldContentType } from "./integrationField.js";
|
|
10
10
|
import { RepeatableContentSchema, RepeatableContentType } from "./repeatable.js";
|
|
@@ -12,25 +12,19 @@ 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 { 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 {
|
|
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 +1 @@
|
|
|
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,
|
|
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
|
@@ -8,7 +8,7 @@ const RichTextContentSpanSchema = getSpanSchema(FilledLinkContentValueSchema);
|
|
|
8
8
|
const RichTextContentTextBlockSchema = getTextBlockSchema(FilledLinkContentValueSchema);
|
|
9
9
|
const RichTextContentImageBlockSchema = getImageBlockSchema(ImageContentViewSchema, FilledLinkContentValueSchema);
|
|
10
10
|
const RichTextContentEmbedBlockSchema = getEmbedBlockSchema(EmbedContentSchema);
|
|
11
|
-
const RichTextContentBlockSchema = z.
|
|
11
|
+
const RichTextContentBlockSchema = z.discriminatedUnion("type", [
|
|
12
12
|
RichTextContentTextBlockSchema,
|
|
13
13
|
RichTextContentImageBlockSchema,
|
|
14
14
|
RichTextContentEmbedBlockSchema
|
|
@@ -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 { 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.
|
|
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"}
|