@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.
Files changed (149) hide show
  1. package/README.md +5 -5
  2. package/dist/content/boolean.d.ts.map +1 -1
  3. package/dist/content/boolean.js.map +1 -1
  4. package/dist/content/codec/link.js.map +1 -1
  5. package/dist/content/codec/nestable.js +4 -4
  6. package/dist/content/field.d.ts.map +1 -1
  7. package/dist/content/field.js +2 -2
  8. package/dist/content/field.js.map +1 -1
  9. package/dist/content/group.d.ts +1 -2
  10. package/dist/content/group.d.ts.map +1 -1
  11. package/dist/content/group.js +1 -1
  12. package/dist/content/group.js.map +1 -1
  13. package/dist/content/image.d.ts +3 -1
  14. package/dist/content/image.d.ts.map +1 -1
  15. package/dist/content/image.js +3 -3
  16. package/dist/content/image.js.map +1 -1
  17. package/dist/content/legacy/boolean.d.ts +1 -0
  18. package/dist/content/legacy/embed.d.ts +1 -0
  19. package/dist/content/legacy/empty.d.ts +1 -0
  20. package/dist/content/legacy/field.d.ts +1 -0
  21. package/dist/content/legacy/geopoint.d.ts +1 -0
  22. package/dist/content/legacy/image.d.ts +28 -0
  23. package/dist/content/legacy/image.d.ts.map +1 -0
  24. package/dist/content/legacy/image.js +3 -3
  25. package/dist/content/legacy/image.js.map +1 -1
  26. package/dist/content/legacy/integrationField.d.ts +1 -0
  27. package/dist/content/legacy/link.d.ts +14 -14
  28. package/dist/content/legacy/link.js +23 -23
  29. package/dist/content/legacy/link.js.map +1 -1
  30. package/dist/content/legacy/nestable.d.ts +1 -0
  31. package/dist/content/legacy/nestable.js +1 -1
  32. package/dist/content/legacy/repeatable.d.ts +1 -0
  33. package/dist/content/legacy/richText.d.ts +32 -20
  34. package/dist/content/legacy/richText.d.ts.map +1 -1
  35. package/dist/content/legacy/richText.js +7 -7
  36. package/dist/content/legacy/richText.js.map +1 -1
  37. package/dist/content/legacy/separator.d.ts +1 -0
  38. package/dist/content/legacy/table.d.ts +1 -0
  39. package/dist/content/link.d.ts +66 -89
  40. package/dist/content/link.d.ts.map +1 -1
  41. package/dist/content/link.js +30 -27
  42. package/dist/content/link.js.map +1 -1
  43. package/dist/content/nestable.d.ts +3 -3
  44. package/dist/content/nestable.d.ts.map +1 -1
  45. package/dist/content/nestable.js +7 -13
  46. package/dist/content/nestable.js.map +1 -1
  47. package/dist/content/repeatable.d.ts +4 -69
  48. package/dist/content/repeatable.d.ts.map +1 -1
  49. package/dist/content/richText.d.ts +14 -14
  50. package/dist/content/richText.d.ts.map +1 -1
  51. package/dist/content/richText.js +10 -10
  52. package/dist/content/richText.js.map +1 -1
  53. package/dist/content/slice.d.ts +507 -5
  54. package/dist/content/slice.d.ts.map +1 -1
  55. package/dist/content/slice.js +1 -1
  56. package/dist/content/slice.js.map +1 -1
  57. package/dist/content/slices.d.ts +507 -5
  58. package/dist/content/slices.d.ts.map +1 -1
  59. package/dist/content/table.d.ts +5 -2
  60. package/dist/content/table.d.ts.map +1 -1
  61. package/dist/content/widget.js +1 -1
  62. package/dist/content/widget.js.map +1 -1
  63. package/dist/helpers/customTypeModel.d.ts +5 -5
  64. package/dist/helpers/customTypeModel.d.ts.map +1 -1
  65. package/dist/helpers/customTypeModel.js +30 -0
  66. package/dist/helpers/customTypeModel.js.map +1 -1
  67. package/dist/helpers/imageContent.d.ts +33 -0
  68. package/dist/helpers/imageContent.d.ts.map +1 -0
  69. package/dist/helpers/imageContent.js +55 -0
  70. package/dist/helpers/imageContent.js.map +1 -0
  71. package/dist/helpers/traverseContent.d.ts +4 -4
  72. package/dist/helpers/traverseContent.d.ts.map +1 -1
  73. package/dist/helpers/traverseContent.js +5 -3
  74. package/dist/helpers/traverseContent.js.map +1 -1
  75. package/dist/helpers/traverseContentWithModel.d.ts +4 -4
  76. package/dist/helpers/traverseContentWithModel.js +1 -1
  77. package/dist/helpers/withDefaultContent.d.ts +21 -0
  78. package/dist/helpers/withDefaultContent.d.ts.map +1 -0
  79. package/dist/helpers/withDefaultContent.js +120 -0
  80. package/dist/helpers/withDefaultContent.js.map +1 -0
  81. package/dist/index.d.ts +26 -24
  82. package/dist/index.js +6 -1
  83. package/dist/io-ts.d.ts +6777 -3127
  84. package/dist/io-ts.d.ts.map +1 -1
  85. package/dist/io-ts.js +17 -12
  86. package/dist/io-ts.js.map +1 -1
  87. package/dist/model/customType.d.ts +9 -3
  88. package/dist/model/customType.d.ts.map +1 -1
  89. package/dist/model/customType.js +7 -4
  90. package/dist/model/customType.js.map +1 -1
  91. package/dist/model/group.d.ts +2 -2
  92. package/dist/model/group.js +1 -1
  93. package/dist/model/group.js.map +1 -1
  94. package/dist/model/nestable.js +1 -1
  95. package/dist/model/nestable.js.map +1 -1
  96. package/dist/model/richText.d.ts +20 -1
  97. package/dist/model/richText.d.ts.map +1 -1
  98. package/dist/model/richText.js +3 -3
  99. package/dist/model/richText.js.map +1 -1
  100. package/dist/model/slice.d.ts +1259 -651
  101. package/dist/model/slice.d.ts.map +1 -1
  102. package/dist/model/slice.js +9 -9
  103. package/dist/model/slice.js.map +1 -1
  104. package/dist/model/table.js +5 -5
  105. package/dist/model/table.js.map +1 -1
  106. package/dist/model/widget.d.ts +1 -3
  107. package/dist/model/widget.d.ts.map +1 -1
  108. package/dist/model/widget.js +7 -4
  109. package/dist/model/widget.js.map +1 -1
  110. package/dist/zod4.d.ts +3946 -1862
  111. package/dist/zod4.d.ts.map +1 -1
  112. package/dist/zod4.js +17 -12
  113. package/dist/zod4.js.map +1 -1
  114. package/package.json +22 -12
  115. package/src/content/boolean.ts +0 -13
  116. package/src/content/codec/link.ts +12 -12
  117. package/src/content/field.ts +1 -15
  118. package/src/content/group.ts +2 -55
  119. package/src/content/image.ts +3 -91
  120. package/src/content/legacy/image.ts +4 -4
  121. package/src/content/legacy/link.ts +46 -46
  122. package/src/content/legacy/richText.ts +32 -37
  123. package/src/content/link.ts +100 -89
  124. package/src/content/nestable.ts +4 -38
  125. package/src/content/richText.ts +31 -22
  126. package/src/content/slice.ts +1 -1
  127. package/src/content/widget.ts +1 -1
  128. package/src/helpers/customTypeModel.ts +51 -4
  129. package/src/helpers/imageContent.ts +84 -0
  130. package/src/helpers/traverseContent.ts +4 -1
  131. package/src/helpers/withDefaultContent.ts +180 -0
  132. package/src/index.ts +25 -7
  133. package/src/io-ts.ts +22 -10
  134. package/src/model/customType.ts +18 -7
  135. package/src/model/diff/sharedSlice.ts +2 -2
  136. package/src/model/diff/variation.ts +7 -7
  137. package/src/model/group.ts +1 -1
  138. package/src/model/nestable.ts +1 -1
  139. package/src/model/richText.ts +5 -2
  140. package/src/model/slice.ts +20 -23
  141. package/src/model/table.ts +5 -5
  142. package/src/model/widget.ts +14 -14
  143. package/src/zod4.ts +22 -10
  144. package/dist/model/section.d.ts +0 -11
  145. package/dist/model/section.d.ts.map +0 -1
  146. package/dist/model/section.js +0 -10
  147. package/dist/model/section.js.map +0 -1
  148. package/src/content/withDefaultValues.ts +0 -114
  149. package/src/model/section.ts +0 -12
@@ -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 { ColorContentSchema, DateContentSchema, FieldContentType, NumberContentSchema, RangeContentSchema, SelectContentSchema, TextContentSchema, TimestampContentSchema } from "./field.js";
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.union([
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
- TextContentSchema,
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 { NestableModel } from \"../model/nestable\"\nimport type { BooleanContent } from \"./boolean\"\nimport { BooleanContentDefaultValue, 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 {\n\tColorContentSchema,\n\tDateContentSchema,\n\tFieldContentType,\n\tNumberContentSchema,\n\tRangeContentSchema,\n\tSelectContentDefaultValue,\n\tSelectContentSchema,\n\tTextContentSchema,\n\tTimestampContentSchema,\n} 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.ZodMiniType<NestableContent> = z.union([\n\tEmptyContentSchema,\n\tBooleanContentSchema,\n\tColorContentSchema,\n\tDateContentSchema,\n\tEmbedContentSchema,\n\tGeoPointContentSchema,\n\tImageContentSchema,\n\tIntegrationFieldContentSchema,\n\tLinkContentSchema,\n\tNumberContentSchema,\n\tRangeContentSchema,\n\tRepeatableContentSchema,\n\tRichTextContentSchema,\n\tSelectContentSchema,\n\tSeparatorContentSchema,\n\tTableContentSchema,\n\tTextContentSchema,\n\tTimestampContentSchema,\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\n/**\n * Returns the default value for a nestable widget based on its configuration.\n * Currently only Boolean and Select fields have default values.\n */\nexport const NestableContentDefaultValue = (\n\twidgetDef: NestableModel,\n): NestableContent | undefined => {\n\tswitch (widgetDef.type) {\n\t\tcase \"Boolean\":\n\t\t\treturn BooleanContentDefaultValue(widgetDef)\n\t\tcase \"Select\":\n\t\t\treturn SelectContentDefaultValue(widgetDef)\n\t\tdefault:\n\t\t\treturn undefined\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AA8CA,MAAa,wBAAwD,EAAE,MAAM;CAC5E;CACA;CACA;CACA;CACA;CACA;CACA;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
+ {"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 { LinkValueContent } from "./link.js";
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<LinkValueContent, Record<string, unknown>>;
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
- kind: "file";
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAMxB,iBAAA,GAAoB,CAAA,CAAE,KAAA,QAAa,uBAAA"}
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 { FilledLinkValueContent } from "./link.js";
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<FilledLinkValueContent>;
7
- declare const TextBlockValueSchema: z.ZodMiniObject<{
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: "strong" | "em" | "list-item";
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: FilledLinkValueContent;
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 TextBlockValue = z.infer<typeof TextBlockValueSchema>;
31
- declare const ImageBlockValueSchema: z.ZodMiniObject<{
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<FilledLinkValueContent, unknown, z.core.$ZodTypeInternals<FilledLinkValueContent, unknown>>>>;
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 ImageBlockValue = z.infer<typeof ImageBlockValueSchema>;
60
- declare const EmbedBlockValueSchema: z.ZodMiniObject<{
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 EmbedBlockValue = z.infer<typeof EmbedBlockValueSchema>;
83
- type RichTextContentBlock = TextBlockValue | ImageBlockValue | EmbedBlockValue;
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":";;;;;KAeY,mBAAA,GAAsB,IAAA,CAAK,sBAAA;AAAA,cAOjC,oBAAA,EAAoB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;KACrB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA;AAAA,cAE/B,qBAAA,EAAqB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAItB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;AAAA,cAEhC,qBAAA,EAAqB,CAAA,CAAA,aAAA;;;;;;;;;;;;;;;;;;;;;;KACtB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;AAAA,KAS1B,oBAAA,GAAuB,cAAA,GAAiB,eAAA,GAAkB,eAAA;AAAA,cAEzD,mBAAA;AAAA,KAED,eAAA;EACX,QAAA,SAAiB,mBAAA;EACjB,KAAA,EAAO,oBAAA;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"}
@@ -1,17 +1,17 @@
1
1
  import { EmbedContentSchema } from "./embed.js";
2
- import { ImageViewContentSchema } from "./image.js";
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(FilledLinkValueContentSchema);
8
- const TextBlockValueSchema = getTextBlockSchema(FilledLinkValueContentSchema);
9
- const ImageBlockValueSchema = getImageBlockSchema(ImageViewContentSchema, FilledLinkValueContentSchema);
10
- const EmbedBlockValueSchema = getEmbedBlockSchema(EmbedContentSchema);
11
- const RichTextContentBlockSchema = z.union([
12
- TextBlockValueSchema,
13
- ImageBlockValueSchema,
14
- EmbedBlockValueSchema
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 { ImageViewContentSchema } from \"./image\"\nimport {\n\tgetEmbedBlockSchema,\n\tgetImageBlockSchema,\n\tgetSpanSchema,\n\tgetTextBlockSchema,\n} from \"./legacy/richText\"\nimport type { Span } from \"./legacy/richText\"\nimport type { FilledLinkValueContent } from \"./link\"\nimport { FilledLinkValueContentSchema } from \"./link\"\n\n// Spans\nexport type RichTextContentSpan = Span<FilledLinkValueContent>\n\nexport const RichTextContentSpanSchema: z.ZodMiniType<RichTextContentSpan> = getSpanSchema(\n\tFilledLinkValueContentSchema,\n)\n\n// Blocks\nconst TextBlockValueSchema = getTextBlockSchema(FilledLinkValueContentSchema)\ntype TextBlockValue = z.infer<typeof TextBlockValueSchema>\n\nconst ImageBlockValueSchema = getImageBlockSchema(\n\tImageViewContentSchema,\n\tFilledLinkValueContentSchema,\n)\ntype ImageBlockValue = z.infer<typeof ImageBlockValueSchema>\n\nconst EmbedBlockValueSchema = getEmbedBlockSchema(EmbedContentSchema)\ntype EmbedBlockValue = z.infer<typeof EmbedBlockValueSchema>\n\nexport const RichTextContentBlockSchema: z.ZodMiniType<RichTextContentBlock> = z.union([\n\tTextBlockValueSchema,\n\tImageBlockValueSchema,\n\tEmbedBlockValueSchema,\n])\n\n// Used by content/codec/richText\nexport type RichTextContentBlock = TextBlockValue | ImageBlockValue | EmbedBlockValue\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.ZodMiniType<RichTextContent> = z.object({\n\t__TYPE__: z.literal(RichTextContentType),\n\tvalue: z.array(RichTextContentBlockSchema),\n})\n"],"mappings":";;;;;;AAiBA,MAAa,4BAAgE,cAC5E,6BACA;AAGD,MAAM,uBAAuB,mBAAmB,6BAA6B;AAG7E,MAAM,wBAAwB,oBAC7B,wBACA,6BACA;AAGD,MAAM,wBAAwB,oBAAoB,mBAAmB;AAGrE,MAAa,6BAAkE,EAAE,MAAM;CACtF;CACA;CACA;CACA,CAAC;AAKF,MAAa,sBAAsB;AAOnC,MAAa,wBAAwD,EAAE,OAAO;CAC7E,UAAU,EAAE,QAAQ,oBAAoB;CACxC,OAAO,EAAE,MAAM,2BAA2B;CAC1C,CAAC"}
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"}