@prismicio/types-internal 4.0.0 → 4.1.0-canary.18ae460

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 (117) 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 +1 -1
  8. package/dist/content/field.js.map +1 -1
  9. package/dist/content/group.d.ts.map +1 -1
  10. package/dist/content/group.js.map +1 -1
  11. package/dist/content/image.d.ts +3 -1
  12. package/dist/content/image.d.ts.map +1 -1
  13. package/dist/content/image.js +3 -3
  14. package/dist/content/image.js.map +1 -1
  15. package/dist/content/legacy/boolean.d.ts +1 -0
  16. package/dist/content/legacy/embed.d.ts +1 -0
  17. package/dist/content/legacy/empty.d.ts +1 -0
  18. package/dist/content/legacy/field.d.ts +1 -0
  19. package/dist/content/legacy/geopoint.d.ts +1 -0
  20. package/dist/content/legacy/image.d.ts +28 -0
  21. package/dist/content/legacy/image.d.ts.map +1 -0
  22. package/dist/content/legacy/image.js +3 -3
  23. package/dist/content/legacy/image.js.map +1 -1
  24. package/dist/content/legacy/integrationField.d.ts +1 -0
  25. package/dist/content/legacy/link.d.ts +10 -10
  26. package/dist/content/legacy/link.js +23 -23
  27. package/dist/content/legacy/link.js.map +1 -1
  28. package/dist/content/legacy/nestable.d.ts +1 -0
  29. package/dist/content/legacy/nestable.js +1 -1
  30. package/dist/content/legacy/repeatable.d.ts +1 -0
  31. package/dist/content/legacy/richText.d.ts +9 -8
  32. package/dist/content/legacy/richText.d.ts.map +1 -1
  33. package/dist/content/legacy/richText.js +5 -5
  34. package/dist/content/legacy/richText.js.map +1 -1
  35. package/dist/content/legacy/separator.d.ts +1 -0
  36. package/dist/content/legacy/table.d.ts +1 -0
  37. package/dist/content/link.d.ts +62 -85
  38. package/dist/content/link.d.ts.map +1 -1
  39. package/dist/content/link.js +30 -27
  40. package/dist/content/link.js.map +1 -1
  41. package/dist/content/nestable.d.ts.map +1 -1
  42. package/dist/content/nestable.js +4 -4
  43. package/dist/content/nestable.js.map +1 -1
  44. package/dist/content/repeatable.d.ts +4 -69
  45. package/dist/content/repeatable.d.ts.map +1 -1
  46. package/dist/content/richText.d.ts +13 -13
  47. package/dist/content/richText.d.ts.map +1 -1
  48. package/dist/content/richText.js +9 -9
  49. package/dist/content/richText.js.map +1 -1
  50. package/dist/helpers/customTypeModel.d.ts +2 -1
  51. package/dist/helpers/customTypeModel.d.ts.map +1 -1
  52. package/dist/helpers/customTypeModel.js +30 -0
  53. package/dist/helpers/customTypeModel.js.map +1 -1
  54. package/dist/helpers/imageContent.d.ts +33 -0
  55. package/dist/helpers/imageContent.d.ts.map +1 -0
  56. package/dist/helpers/imageContent.js +55 -0
  57. package/dist/helpers/imageContent.js.map +1 -0
  58. package/dist/helpers/traverseContent.d.ts +4 -4
  59. package/dist/helpers/traverseContent.d.ts.map +1 -1
  60. package/dist/helpers/traverseContent.js +5 -3
  61. package/dist/helpers/traverseContent.js.map +1 -1
  62. package/dist/helpers/traverseContentWithModel.d.ts +4 -4
  63. package/dist/helpers/traverseContentWithModel.js +1 -1
  64. package/dist/helpers/withDefaultContent.d.ts +21 -0
  65. package/dist/helpers/withDefaultContent.d.ts.map +1 -0
  66. package/dist/helpers/withDefaultContent.js +120 -0
  67. package/dist/helpers/withDefaultContent.js.map +1 -0
  68. package/dist/index.d.ts +25 -22
  69. package/dist/index.js +6 -1
  70. package/dist/io-ts.d.ts +1156 -727
  71. package/dist/io-ts.d.ts.map +1 -1
  72. package/dist/io-ts.js +11 -7
  73. package/dist/io-ts.js.map +1 -1
  74. package/dist/model/richText.d.ts +20 -1
  75. package/dist/model/richText.d.ts.map +1 -1
  76. package/dist/model/richText.js +3 -3
  77. package/dist/model/richText.js.map +1 -1
  78. package/dist/model/slice.d.ts +1251 -643
  79. package/dist/model/slice.d.ts.map +1 -1
  80. package/dist/model/slice.js +4 -4
  81. package/dist/model/slice.js.map +1 -1
  82. package/dist/model/table.js +5 -5
  83. package/dist/model/table.js.map +1 -1
  84. package/dist/model/widget.d.ts +1 -3
  85. package/dist/model/widget.d.ts.map +1 -1
  86. package/dist/model/widget.js +5 -2
  87. package/dist/model/widget.js.map +1 -1
  88. package/dist/zod4.d.ts +2392 -1873
  89. package/dist/zod4.d.ts.map +1 -1
  90. package/dist/zod4.js +11 -7
  91. package/dist/zod4.js.map +1 -1
  92. package/package.json +19 -12
  93. package/src/content/boolean.ts +0 -13
  94. package/src/content/codec/link.ts +12 -12
  95. package/src/content/field.ts +0 -14
  96. package/src/content/group.ts +1 -54
  97. package/src/content/image.ts +3 -91
  98. package/src/content/legacy/image.ts +4 -4
  99. package/src/content/legacy/link.ts +46 -46
  100. package/src/content/legacy/richText.ts +18 -16
  101. package/src/content/link.ts +100 -89
  102. package/src/content/nestable.ts +1 -20
  103. package/src/content/richText.ts +23 -17
  104. package/src/helpers/customTypeModel.ts +44 -0
  105. package/src/helpers/imageContent.ts +84 -0
  106. package/src/helpers/traverseContent.ts +4 -1
  107. package/src/helpers/withDefaultContent.ts +180 -0
  108. package/src/index.ts +18 -5
  109. package/src/io-ts.ts +14 -2
  110. package/src/model/diff/sharedSlice.ts +2 -2
  111. package/src/model/diff/variation.ts +7 -7
  112. package/src/model/richText.ts +5 -2
  113. package/src/model/slice.ts +6 -8
  114. package/src/model/table.ts +5 -5
  115. package/src/model/widget.ts +6 -2
  116. package/src/zod4.ts +14 -2
  117. package/src/content/withDefaultValues.ts +0 -114
@@ -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 { ImageViewContentSchema } from \"../image\"\nimport type { FilledLinkValueContent, FilledLinkValueContentSchema } from \"../link\"\nimport { EmbedLegacyLooseSchema } from \"./embed\"\nimport { ImageViewLegacySchema } from \"./image\"\nimport { FilledLinkValueLegacySchema } from \"./link\"\nimport type { FilledLinkValueLegacy } from \"./link\"\n\nexport const RichTextNodeType = {\n\tparagraph: \"paragraph\",\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\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\n// Spans\ntype HyperlinkSpan<TData extends FilledLinkValueLegacy | FilledLinkValueContent> = {\n\ttype: typeof RichTextNodeType.hyperlink\n\tstart: number\n\tend: number\n\tdata: TData\n}\n\nconst getHyperlinkSpanSchema = <\n\tTData extends typeof FilledLinkValueLegacySchema | typeof FilledLinkValueContentSchema,\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\ntype LabelSpan = {\n\ttype: \"label\"\n\tstart: number\n\tend: number\n\tdata: string\n}\n\nconst LabelSpanSchema: z.ZodMiniType<LabelSpan> = 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})\n\ntype BasicSpan = {\n\ttype: typeof RichTextNodeType.strong | typeof RichTextNodeType.em | \"list-item\"\n\tstart: number\n\tend: number\n}\n\nconst BasicSpanSchema: z.ZodMiniType<BasicSpan> = 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})\n\nexport type Span<TLink extends FilledLinkValueLegacy | FilledLinkValueContent> =\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 FilledLinkValueLegacySchema | typeof FilledLinkValueContentSchema,\n>(\n\tlinkSchema: TLinkSchema,\n) => z.union([getHyperlinkSpanSchema(linkSchema), LabelSpanSchema, BasicSpanSchema])\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 FilledLinkValueLegacySchema | typeof FilledLinkValueContentSchema,\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(FilledLinkValueLegacySchema)\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 ImageViewLegacySchema | typeof ImageViewContentSchema,\n\tTLinkTo extends typeof FilledLinkValueLegacySchema | typeof FilledLinkValueContentSchema,\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\tImageViewLegacySchema,\n\tFilledLinkValueLegacySchema,\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.union([\n\tTextBlockLegacySchema,\n\tImageBlockLegacySchema,\n\tEmbedBlockLegacySchema,\n])\n\nexport type RichTextLegacyBlock = TextBlockLegacy | ImageBlockLegacy | EmbedBlockLegacy\n\nexport const RichTextLeg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F;CACA;CACA;CACA,CAAC;AAIF,MAAa,uBAAuB,EAAE,MAAM,0BAA0B"}
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\ntype LabelSpan = {\n\ttype: \"label\"\n\tstart: number\n\tend: number\n\tdata: string\n}\n\nconst LabelSpanSchema: z.ZodMiniType<LabelSpan> = 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})\n\ntype BasicSpan = {\n\ttype: typeof RichTextNodeType.strong | typeof RichTextNodeType.em | \"list-item\"\n\tstart: number\n\tend: number\n}\n\nconst BasicSpanSchema: z.ZodMiniType<BasicSpan> = 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})\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) => z.union([getHyperlinkSpanSchema(linkSchema), LabelSpanSchema, BasicSpanSchema])\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.union([\n\tTextBlockLegacySchema,\n\tImageBlockLegacySchema,\n\tEmbedBlockLegacySchema,\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":";;;;;AAYA,MAAa,mBAAmB;CAC/B,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,WAAW;CACX,cAAc;CACd,WAAW;CACX,UAAU;CACV,OAAO;CACP,OAAO;CACP,WAAW;CACX,QAAQ;CACR,IAAI;CACJ;AAYD,MAAM,0BAGL,SAEA,EAAE,OAAO;CACR,MAAM,EAAE,QAAQ,iBAAiB,UAAU;CAC3C,OAAO,EAAE,QAAQ;CACjB,KAAK,EAAE,QAAQ;CACf;CACA,CAAC;AASH,MAAM,kBAA4C,EAAE,OAAO;CAC1D,MAAM,EAAE,QAAQ,QAAQ;CACxB,OAAO,EAAE,QAAQ;CACjB,KAAK,EAAE,QAAQ;CACf,MAAM,EAAE,KACP,EAAE,SAAS,EACX,EAAE,WAAW,UAAW,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI,QAAQ,GAAI,CACpF;CACD,CAAC;AAQF,MAAM,kBAA4C,EAAE,OAAO;CAC1D,MAAM,EAAE,MAAM;EACb,EAAE,QAAQ,iBAAiB,OAAO;EAClC,EAAE,QAAQ,iBAAiB,GAAG;EAC9B,EAAE,QAAQ,YAAY;EACtB,CAAC;CACF,OAAO,EAAE,QAAQ;CACjB,KAAK,EAAE,QAAQ;CACf,CAAC;AAQF,MAA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QAAQ,EAAE,QAAQ,CAAC;CAChC,CAAC;AAEH,MAAM,yBAAyB,oBAC9B,uBACA,4BACA;AAMD,MAAa,uBAGZ,SAEA,EAAE,OAAO;CACR,MAAM,EAAE,QAAQ,iBAAiB,MAAM;CACvC;CACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC5B,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAChC,CAAC;AAEH,MAAM,yBAAyB,oBAAoB,uBAAuB;AAK1E,MAAa,4BAAgE,EAAE,MAAM;CACpF;CACA;CACA;CACA,CAAC;AAIF,MAAa,uBAAuB,EAAE,MAAM,0BAA0B"}
@@ -0,0 +1 @@
1
+ import { z } from "zod/mini";
@@ -0,0 +1 @@
1
+ import { z } from "zod/mini";
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod/mini";
2
2
 
3
3
  //#region src/content/link.d.ts
4
- declare const FilledImageLinkValueContentSchema: z.ZodMiniObject<{
4
+ declare const FilledImageLinkContentValueSchema: z.ZodMiniObject<{
5
5
  kind: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"image", string>>;
6
6
  id: z.ZodMiniString<string>;
7
7
  url: z.ZodMiniString<string>;
@@ -12,11 +12,11 @@ declare const FilledImageLinkValueContentSchema: z.ZodMiniObject<{
12
12
  date: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
13
13
  __TYPE__: z.ZodMiniLiteral<"ImageLink">;
14
14
  }, z.core.$strict>;
15
- declare const EmptyImageLinkValueContentSchema: z.ZodMiniObject<{
15
+ declare const EmptyImageLinkContentValueSchema: z.ZodMiniObject<{
16
16
  kind: z.ZodMiniLiteral<"image">;
17
17
  __TYPE__: z.ZodMiniLiteral<"ImageLink">;
18
18
  }, z.core.$strict>;
19
- declare const FilledFileLinkValueContentSchema: z.ZodMiniObject<{
19
+ declare const FilledFileLinkContentValueSchema: z.ZodMiniObject<{
20
20
  kind: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<"file", string>>;
21
21
  id: z.ZodMiniString<string>;
22
22
  url: z.ZodMiniString<string>;
@@ -25,24 +25,24 @@ declare const FilledFileLinkValueContentSchema: z.ZodMiniObject<{
25
25
  date: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
26
26
  __TYPE__: z.ZodMiniLiteral<"FileLink">;
27
27
  }, z.core.$strict>;
28
- declare const EmptyFileLinkValueContentSchema: z.ZodMiniObject<{
28
+ declare const EmptyFileLinkContentValueSchema: z.ZodMiniObject<{
29
29
  kind: z.ZodMiniLiteral<"file">;
30
30
  __TYPE__: z.ZodMiniLiteral<"FileLink">;
31
31
  }, z.core.$strict>;
32
- declare const EmptyMediaLinkValueContentSchema: z.ZodMiniObject<{
32
+ declare const EmptyMediaLinkContentValueSchema: z.ZodMiniObject<{
33
33
  kind: z.ZodMiniLiteral<"media">;
34
34
  __TYPE__: z.ZodMiniLiteral<"MediaLink">;
35
35
  }, z.core.$strict>;
36
- declare const FilledDocumentLinkValueContentSchema: z.ZodMiniObject<{
36
+ declare const FilledDocumentLinkContentValueSchema: z.ZodMiniObject<{
37
37
  kind: z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniLiteral<"document">>, z.ZodMiniTransform<"document", "document" | undefined>>;
38
38
  id: z.ZodMiniString<string>;
39
39
  __TYPE__: z.ZodMiniLiteral<"DocumentLink">;
40
40
  }, z.core.$strict>;
41
- declare const EmptyDocumentLinkValueContentSchema: z.ZodMiniObject<{
41
+ declare const EmptyDocumentLinkContentValueSchema: z.ZodMiniObject<{
42
42
  kind: z.ZodMiniLiteral<"document">;
43
43
  __TYPE__: z.ZodMiniLiteral<"DocumentLink">;
44
44
  }, z.core.$strict>;
45
- declare const FilledExternalLinkValueContentSchema: z.ZodMiniObject<{
45
+ declare const FilledExternalLinkContentValueSchema: z.ZodMiniObject<{
46
46
  kind: z.ZodMiniPipe<z.ZodMiniOptional<z.ZodMiniLiteral<"web">>, z.ZodMiniTransform<"web", "web" | undefined>>;
47
47
  url: z.ZodMiniString<string>;
48
48
  target: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
@@ -51,28 +51,28 @@ declare const FilledExternalLinkValueContentSchema: z.ZodMiniObject<{
51
51
  }, z.core.$strict>>>;
52
52
  __TYPE__: z.ZodMiniLiteral<"ExternalLink">;
53
53
  }, z.core.$strict>;
54
- declare const EmptyExternalLinkValueContentSchema: z.ZodMiniObject<{
54
+ declare const EmptyExternalLinkContentValueSchema: z.ZodMiniObject<{
55
55
  kind: z.ZodMiniLiteral<"web">;
56
56
  __TYPE__: z.ZodMiniLiteral<"ExternalLink">;
57
57
  }, z.core.$strict>;
58
- declare const AnyLinkValueContentSchema: z.ZodMiniObject<{
58
+ declare const AnyLinkContentValueSchema: z.ZodMiniObject<{
59
59
  kind: z.ZodMiniTransform<"any", unknown>;
60
60
  __TYPE__: z.ZodMiniLiteral<"AnyLink">;
61
61
  }, z.core.$strict>;
62
- type FilledImageLinkValueContent = z.infer<typeof FilledImageLinkValueContentSchema>;
63
- type FilledFileLinkValueContent = z.infer<typeof FilledFileLinkValueContentSchema>;
64
- type FilledDocumentLinkValueContent = z.infer<typeof FilledDocumentLinkValueContentSchema>;
65
- type FilledExternalLinkValueContent = z.infer<typeof FilledExternalLinkValueContentSchema>;
66
- type FilledLinkValueContent = FilledImageLinkValueContent | FilledFileLinkValueContent | FilledDocumentLinkValueContent | FilledExternalLinkValueContent;
67
- type EmptyImageLinkValueContent = z.infer<typeof EmptyImageLinkValueContentSchema>;
68
- type EmptyFileLinkValueContent = z.infer<typeof EmptyFileLinkValueContentSchema>;
69
- type EmptyMediaLinkValueContent = z.infer<typeof EmptyMediaLinkValueContentSchema>;
70
- type EmptyDocumentLinkValueContent = z.infer<typeof EmptyDocumentLinkValueContentSchema>;
71
- type EmptyExternalLinkValueContent = z.infer<typeof EmptyExternalLinkValueContentSchema>;
72
- type AnyLinkValueContent = z.infer<typeof AnyLinkValueContentSchema>;
73
- type EmptyLinkValueContent = EmptyImageLinkValueContent | EmptyFileLinkValueContent | EmptyMediaLinkValueContent | EmptyDocumentLinkValueContent | EmptyExternalLinkValueContent | AnyLinkValueContent;
74
- type LinkValueContent = FilledLinkValueContent | EmptyLinkValueContent;
75
- declare const LinkContentSchema: z.ZodMiniObject<{
62
+ type FilledImageLinkContentValue = z.infer<typeof FilledImageLinkContentValueSchema>;
63
+ type FilledFileLinkContentValue = z.infer<typeof FilledFileLinkContentValueSchema>;
64
+ type FilledDocumentLinkContentValue = z.infer<typeof FilledDocumentLinkContentValueSchema>;
65
+ type FilledExternalLinkContentValue = z.infer<typeof FilledExternalLinkContentValueSchema>;
66
+ type FilledLinkContentValue = FilledImageLinkContentValue | FilledFileLinkContentValue | FilledDocumentLinkContentValue | FilledExternalLinkContentValue;
67
+ type EmptyImageLinkContentValue = z.infer<typeof EmptyImageLinkContentValueSchema>;
68
+ type EmptyFileLinkContentValue = z.infer<typeof EmptyFileLinkContentValueSchema>;
69
+ type EmptyMediaLinkContentValue = z.infer<typeof EmptyMediaLinkContentValueSchema>;
70
+ type EmptyDocumentLinkContentValue = z.infer<typeof EmptyDocumentLinkContentValueSchema>;
71
+ type EmptyExternalLinkContentValue = z.infer<typeof EmptyExternalLinkContentValueSchema>;
72
+ type AnyLinkContentValue = z.infer<typeof AnyLinkContentValueSchema>;
73
+ type EmptyLinkContentValue = EmptyImageLinkContentValue | EmptyFileLinkContentValue | EmptyMediaLinkContentValue | EmptyDocumentLinkContentValue | EmptyExternalLinkContentValue | AnyLinkContentValue;
74
+ type LinkContentValue = FilledLinkContentValue | EmptyLinkContentValue;
75
+ declare const FilledLinkContentSchema: z.ZodMiniObject<{
76
76
  __TYPE__: z.ZodMiniLiteral<"LinkContent">;
77
77
  key: z.ZodMiniTransform<string, unknown>;
78
78
  value: z.ZodMiniPipe<z.ZodMiniPipe<z.ZodMiniPipe<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>, z.ZodMiniTransform<{
@@ -82,82 +82,59 @@ declare const LinkContentSchema: z.ZodMiniObject<{
82
82
  }, Record<string, unknown>>>, z.ZodMiniObject<{
83
83
  text: z.ZodMiniOptional<z.ZodMiniString<string>>;
84
84
  variant: z.ZodMiniOptional<z.ZodMiniString<string>>;
85
- value: z.ZodMiniType<LinkValueContent, Record<string, unknown>>;
85
+ value: z.ZodMiniType<FilledLinkContentValue, Record<string, unknown>, z.core.$ZodTypeInternals<FilledLinkContentValue, Record<string, unknown>>>;
86
86
  }, z.core.$strip>>, z.ZodMiniTransform<{
87
- kind: "image";
88
- id: string;
89
- url: string;
90
- height: string;
91
- width: string;
92
- size: string;
93
- name: string;
94
- __TYPE__: "ImageLink";
95
- date?: string | null | undefined;
96
87
  variant?: string | undefined;
97
88
  text?: string | undefined;
98
- } | {
99
- kind: "file";
100
- id: string;
101
- url: string;
102
- name: string;
103
- size: string;
104
- __TYPE__: "FileLink";
105
- date?: string | null | undefined;
106
- variant?: string | undefined;
89
+ } & FilledLinkContentValue, {
90
+ value: FilledLinkContentValue;
107
91
  text?: string | undefined;
108
- } | {
109
- kind: "document";
110
- id: string;
111
- __TYPE__: "DocumentLink";
112
92
  variant?: string | undefined;
113
- text?: string | undefined;
114
- } | {
115
- kind: "web";
116
- url: string;
117
- __TYPE__: "ExternalLink";
118
- target?: string | null | undefined;
119
- preview?: {
120
- title?: string | undefined;
121
- } | null | undefined;
122
- variant?: string | undefined;
123
- text?: string | undefined;
124
- } | {
125
- kind: "image";
126
- __TYPE__: "ImageLink";
127
- variant?: string | undefined;
128
- text?: string | undefined;
129
- } | {
130
- kind: "file";
131
- __TYPE__: "FileLink";
132
- variant?: string | undefined;
133
- text?: string | undefined;
134
- } | {
135
- kind: "media";
136
- __TYPE__: "MediaLink";
93
+ }>>;
94
+ }, z.core.$strip>;
95
+ type FilledLinkContent = z.infer<typeof FilledLinkContentSchema>;
96
+ declare const EmptyLinkContentSchema: z.ZodMiniObject<{
97
+ __TYPE__: z.ZodMiniLiteral<"LinkContent">;
98
+ key: z.ZodMiniTransform<string, unknown>;
99
+ value: z.ZodMiniPipe<z.ZodMiniPipe<z.ZodMiniPipe<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>, z.ZodMiniTransform<{
100
+ text?: unknown;
101
+ variant?: unknown;
102
+ value: Record<string, unknown>;
103
+ }, Record<string, unknown>>>, z.ZodMiniObject<{
104
+ text: z.ZodMiniOptional<z.ZodMiniString<string>>;
105
+ variant: z.ZodMiniOptional<z.ZodMiniString<string>>;
106
+ value: z.ZodMiniType<EmptyLinkContentValue, Record<string, unknown>, z.core.$ZodTypeInternals<EmptyLinkContentValue, Record<string, unknown>>>;
107
+ }, z.core.$strip>>, z.ZodMiniTransform<{
137
108
  variant?: string | undefined;
138
109
  text?: string | undefined;
139
- } | {
140
- kind: "document";
141
- __TYPE__: "DocumentLink";
142
- variant?: string | undefined;
110
+ } & EmptyLinkContentValue, {
111
+ value: EmptyLinkContentValue;
143
112
  text?: string | undefined;
144
- } | {
145
- kind: "web";
146
- __TYPE__: "ExternalLink";
147
113
  variant?: string | undefined;
148
- text?: string | undefined;
149
- } | {
150
- kind: "any";
151
- __TYPE__: "AnyLink";
114
+ }>>;
115
+ }, z.core.$strip>;
116
+ type EmptyLinkContent = z.infer<typeof EmptyLinkContentSchema>;
117
+ declare const LinkContentSchema: z.ZodMiniObject<{
118
+ __TYPE__: z.ZodMiniLiteral<"LinkContent">;
119
+ key: z.ZodMiniTransform<string, unknown>;
120
+ value: z.ZodMiniPipe<z.ZodMiniPipe<z.ZodMiniPipe<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>, z.ZodMiniTransform<{
121
+ text?: unknown;
122
+ variant?: unknown;
123
+ value: Record<string, unknown>;
124
+ }, Record<string, unknown>>>, z.ZodMiniObject<{
125
+ text: z.ZodMiniOptional<z.ZodMiniString<string>>;
126
+ variant: z.ZodMiniOptional<z.ZodMiniString<string>>;
127
+ value: z.ZodMiniType<LinkContentValue, Record<string, unknown>, z.core.$ZodTypeInternals<LinkContentValue, Record<string, unknown>>>;
128
+ }, z.core.$strip>>, z.ZodMiniTransform<{
152
129
  variant?: string | undefined;
153
130
  text?: string | undefined;
154
- }, {
155
- value: LinkValueContent;
131
+ } & LinkContentValue, {
132
+ value: LinkContentValue;
156
133
  text?: string | undefined;
157
134
  variant?: string | undefined;
158
135
  }>>;
159
136
  }, z.core.$strip>;
160
137
  type LinkContent = z.infer<typeof LinkContentSchema>;
161
138
  //#endregion
162
- export { FilledLinkValueContent, LinkContent, LinkValueContent };
139
+ export { EmptyLinkContent, EmptyLinkContentValue, FilledLinkContent, FilledLinkContentValue, LinkContent, LinkContentValue };
163
140
  //# sourceMappingURL=link.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"link.d.ts","names":[],"sources":["../../src/content/link.ts"],"mappings":";;;cAiBM,iCAAA,EAAiC,CAAA,CAAA,aAAA;;;;;;;;;;;cAIjC,gCAAA,EAAgC,CAAA,CAAA,aAAA;;;;cAKhC,gCAAA,EAAgC,CAAA,CAAA,aAAA;;;;;;;;;cAIhC,+BAAA,EAA+B,CAAA,CAAA,aAAA;;;;cAK/B,gCAAA,EAAgC,CAAA,CAAA,aAAA;;;;cAKhC,oCAAA,EAAoC,CAAA,CAAA,aAAA;;;;;cAIpC,mCAAA,EAAmC,CAAA,CAAA,aAAA;;;;cAKnC,oCAAA,EAAoC,CAAA,CAAA,aAAA;;;;;;;;;cAIpC,mCAAA,EAAmC,CAAA,CAAA,aAAA;;;;cAKnC,yBAAA,EAAyB,CAAA,CAAA,aAAA;;;;KAe1B,2BAAA,GAA8B,CAAA,CAAE,KAAA,QAAa,iCAAA;AAAA,KAC7C,0BAAA,GAA6B,CAAA,CAAE,KAAA,QAAa,gCAAA;AAAA,KAC5C,8BAAA,GAAiC,CAAA,CAAE,KAAA,QAAa,oCAAA;AAAA,KAChD,8BAAA,GAAiC,CAAA,CAAE,KAAA,QAAa,oCAAA;AAAA,KACzC,sBAAA,GACT,2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;;;;;;;;;;;;KA4BF,WAAA,GAAc,CAAA,CAAE,KAAA,QAAa,iBAAA"}
@@ -1,33 +1,33 @@
1
- import { AnyLinkLegacySchema, EmptyDocumentLinkValueLegacySchema, EmptyExternalLinkValueLegacySchema, EmptyFileLinkValueLegacySchema, EmptyImageLinkValueLegacySchema, EmptyMediaLinkValueLegacySchema, FilledDocumentLinkValueLegacySchema, FilledExternalLinkValueLegacySchema, FilledFileLinkValueLegacySchema, FilledImageLinkValueLegacySchema, LinkType } from "./legacy/link.js";
1
+ import { AnyLinkLegacySchema, EmptyDocumentLinkLegacyValueSchema, EmptyExternalLinkLegacyValueSchema, EmptyFileLinkLegacyValueSchema, EmptyImageLinkLegacyValueSchema, EmptyMediaLinkLegacyValueSchema, FilledDocumentLinkLegacyValueSchema, FilledExternalLinkLegacyValueSchema, FilledFileLinkLegacyValueSchema, FilledImageLinkLegacyValueSchema, LinkType } from "./legacy/link.js";
2
2
  import { z } from "zod/mini";
3
3
  //#region src/content/link.ts
4
- const FilledImageLinkValueContentSchema = z.extend(FilledImageLinkValueLegacySchema, { __TYPE__: z.literal(LinkType.Image) });
5
- const EmptyImageLinkValueContentSchema = z.extend(EmptyImageLinkValueLegacySchema, { __TYPE__: z.literal(LinkType.Image) });
6
- const FilledFileLinkValueContentSchema = z.extend(FilledFileLinkValueLegacySchema, { __TYPE__: z.literal(LinkType.File) });
7
- const EmptyFileLinkValueContentSchema = z.extend(EmptyFileLinkValueLegacySchema, { __TYPE__: z.literal(LinkType.File) });
8
- const EmptyMediaLinkValueContentSchema = z.extend(EmptyMediaLinkValueLegacySchema, { __TYPE__: z.literal(LinkType.Media) });
9
- const FilledDocumentLinkValueContentSchema = z.extend(FilledDocumentLinkValueLegacySchema, { __TYPE__: z.literal(LinkType.Document) });
10
- const EmptyDocumentLinkValueContentSchema = z.extend(EmptyDocumentLinkValueLegacySchema, { __TYPE__: z.literal(LinkType.Document) });
11
- const FilledExternalLinkValueContentSchema = z.extend(FilledExternalLinkValueLegacySchema, { __TYPE__: z.literal(LinkType.External) });
12
- const EmptyExternalLinkValueContentSchema = z.extend(EmptyExternalLinkValueLegacySchema, { __TYPE__: z.literal(LinkType.External) });
13
- const AnyLinkValueContentSchema = z.extend(AnyLinkLegacySchema, { __TYPE__: z.literal(LinkType.Any) });
14
- const FilledLinkValueContentSchema = z.union([
15
- FilledImageLinkValueContentSchema,
16
- FilledFileLinkValueContentSchema,
17
- FilledDocumentLinkValueContentSchema,
18
- FilledExternalLinkValueContentSchema
4
+ const FilledImageLinkContentValueSchema = z.extend(FilledImageLinkLegacyValueSchema, { __TYPE__: z.literal(LinkType.Image) });
5
+ const EmptyImageLinkContentValueSchema = z.extend(EmptyImageLinkLegacyValueSchema, { __TYPE__: z.literal(LinkType.Image) });
6
+ const FilledFileLinkContentValueSchema = z.extend(FilledFileLinkLegacyValueSchema, { __TYPE__: z.literal(LinkType.File) });
7
+ const EmptyFileLinkContentValueSchema = z.extend(EmptyFileLinkLegacyValueSchema, { __TYPE__: z.literal(LinkType.File) });
8
+ const EmptyMediaLinkContentValueSchema = z.extend(EmptyMediaLinkLegacyValueSchema, { __TYPE__: z.literal(LinkType.Media) });
9
+ const FilledDocumentLinkContentValueSchema = z.extend(FilledDocumentLinkLegacyValueSchema, { __TYPE__: z.literal(LinkType.Document) });
10
+ const EmptyDocumentLinkContentValueSchema = z.extend(EmptyDocumentLinkLegacyValueSchema, { __TYPE__: z.literal(LinkType.Document) });
11
+ const FilledExternalLinkContentValueSchema = z.extend(FilledExternalLinkLegacyValueSchema, { __TYPE__: z.literal(LinkType.External) });
12
+ const EmptyExternalLinkContentValueSchema = z.extend(EmptyExternalLinkLegacyValueSchema, { __TYPE__: z.literal(LinkType.External) });
13
+ const AnyLinkContentValueSchema = z.extend(AnyLinkLegacySchema, { __TYPE__: z.literal(LinkType.Any) });
14
+ const FilledLinkContentValueSchema = z.union([
15
+ FilledImageLinkContentValueSchema,
16
+ FilledFileLinkContentValueSchema,
17
+ FilledDocumentLinkContentValueSchema,
18
+ FilledExternalLinkContentValueSchema
19
19
  ]);
20
- const EmptyLinkValueContentSchema = z.union([
21
- EmptyImageLinkValueContentSchema,
22
- EmptyFileLinkValueContentSchema,
23
- EmptyMediaLinkValueContentSchema,
24
- EmptyDocumentLinkValueContentSchema,
25
- EmptyExternalLinkValueContentSchema,
26
- AnyLinkValueContentSchema
20
+ const EmptyLinkContentValueSchema = z.union([
21
+ EmptyImageLinkContentValueSchema,
22
+ EmptyFileLinkContentValueSchema,
23
+ EmptyMediaLinkContentValueSchema,
24
+ EmptyDocumentLinkContentValueSchema,
25
+ EmptyExternalLinkContentValueSchema,
26
+ AnyLinkContentValueSchema
27
27
  ]);
28
- const LinkValueContentSchema = z.union([FilledLinkValueContentSchema, EmptyLinkValueContentSchema]);
28
+ const LinkContentValueSchema = z.union([FilledLinkContentValueSchema, EmptyLinkContentValueSchema]);
29
29
  const LinkContentType = "LinkContent";
30
- const LinkContentSchema = z.object({
30
+ const getLinkContentSchema = (value) => z.object({
31
31
  __TYPE__: z.literal(LinkContentType),
32
32
  key: z.transform((value) => z.uuidv4().safeParse(value).data || crypto.randomUUID()),
33
33
  value: z.pipe(z.pipe(z.pipe(z.record(z.string(), z.unknown()), z.transform(({ text, variant, ...value }) => ({
@@ -37,14 +37,17 @@ const LinkContentSchema = z.object({
37
37
  }))), z.object({
38
38
  text: z.optional(z.string()),
39
39
  variant: z.optional(z.string()),
40
- value: LinkValueContentSchema
40
+ value
41
41
  })), z.transform(({ text, variant, value }) => ({
42
42
  ...text ? { text } : {},
43
43
  ...variant ? { variant } : {},
44
44
  ...value
45
45
  })))
46
46
  });
47
+ const FilledLinkContentSchema = getLinkContentSchema(FilledLinkContentValueSchema);
48
+ const EmptyLinkContentSchema = getLinkContentSchema(EmptyLinkContentValueSchema);
49
+ const LinkContentSchema = getLinkContentSchema(LinkContentValueSchema);
47
50
  //#endregion
48
- export { FilledLinkValueContentSchema, LinkContentSchema, LinkContentType };
51
+ export { EmptyLinkContentSchema, FilledLinkContentSchema, FilledLinkContentValueSchema, LinkContentSchema, LinkContentType };
49
52
 
50
53
  //# sourceMappingURL=link.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"link.js","names":[],"sources":["../../src/content/link.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport {\n\tEmptyDocumentLinkValueLegacySchema,\n\tEmptyImageLinkValueLegacySchema,\n\tFilledDocumentLinkValueLegacySchema,\n\tFilledFileLinkValueLegacySchema,\n\tFilledImageLinkValueLegacySchema,\n\tEmptyMediaLinkValueLegacySchema,\n\tFilledExternalLinkValueLegacySchema,\n\tEmptyExternalLinkValueLegacySchema,\n\tAnyLinkLegacySchema,\n\tLinkType,\n\tEmptyFileLinkValueLegacySchema,\n} from \"./legacy/link\"\n\n// Image\nconst FilledImageLinkValueContentSchema = z.extend(FilledImageLinkValueLegacySchema, {\n\t__TYPE__: z.literal(LinkType.Image),\n})\n\nconst EmptyImageLinkValueContentSchema = z.extend(EmptyImageLinkValueLegacySchema, {\n\t__TYPE__: z.literal(LinkType.Image),\n})\n\n// File\nconst FilledFileLinkValueContentSchema = z.extend(FilledFileLinkValueLegacySchema, {\n\t__TYPE__: z.literal(LinkType.File),\n})\n\nconst EmptyFileLinkValueContentSchema = z.extend(EmptyFileLinkValueLegacySchema, {\n\t__TYPE__: z.literal(LinkType.File),\n})\n\n// Media\nconst EmptyMediaLinkValueContentSchema = z.extend(EmptyMediaLinkValueLegacySchema, {\n\t__TYPE__: z.literal(LinkType.Media),\n})\n\n// Document\nconst FilledDocumentLinkValueContentSchema = z.extend(FilledDocumentLinkValueLegacySchema, {\n\t__TYPE__: z.literal(LinkType.Document),\n})\n\nconst EmptyDocumentLinkValueContentSchema = z.extend(EmptyDocumentLinkValueLegacySchema, {\n\t__TYPE__: z.literal(LinkType.Document),\n})\n\n// External\nconst FilledExternalLinkValueContentSchema = z.extend(FilledExternalLinkValueLegacySchema, {\n\t__TYPE__: z.literal(LinkType.External),\n})\n\nconst EmptyExternalLinkValueContentSchema = z.extend(EmptyExternalLinkValueLegacySchema, {\n\t__TYPE__: z.literal(LinkType.External),\n})\n\n// Any\nconst AnyLinkValueContentSchema = z.extend(AnyLinkLegacySchema, {\n\t__TYPE__: z.literal(LinkType.Any),\n})\n\n// All\n\n// Used by content/richText\nexport const FilledLinkValueContentSchema: z.ZodMiniType<FilledLinkValueContent> = z.union([\n\tFilledImageLinkValueContentSchema,\n\tFilledFileLinkValueContentSchema,\n\tFilledDocumentLinkValueContentSchema,\n\tFilledExternalLinkValueContentSchema,\n])\n\n// Used by content/legacy/link\ntype FilledImageLinkValueContent = z.infer<typeof FilledImageLinkValueContentSchema>\ntype FilledFileLinkValueContent = z.infer<typeof FilledFileLinkValueContentSchema>\ntype FilledDocumentLinkValueContent = z.infer<typeof FilledDocumentLinkValueContentSchema>\ntype FilledExternalLinkValueContent = z.infer<typeof FilledExternalLinkValueContentSchema>\nexport type FilledLinkValueContent =\n\t| FilledImageLinkValueContent\n\t| FilledFileLinkValueContent\n\t| FilledDocumentLinkValueContent\n\t| FilledExternalLinkValueContent\n\nconst EmptyLinkValueContentSchema: z.ZodMiniType<EmptyLinkValueContent> = z.union([\n\tEmptyImageLinkValueContentSchema,\n\tEmptyFileLinkValueContentSchema,\n\tEmptyMediaLinkValueContentSchema,\n\tEmptyDocumentLinkValueContentSchema,\n\tEmptyExternalLinkValueContentSchema,\n\tAnyLinkValueContentSchema,\n])\n\n// Used by content/codec/link\ntype EmptyImageLinkValueContent = z.infer<typeof EmptyImageLinkValueContentSchema>\ntype EmptyFileLinkValueContent = z.infer<typeof EmptyFileLinkValueContentSchema>\ntype EmptyMediaLinkValueContent = z.infer<typeof EmptyMediaLinkValueContentSchema>\ntype EmptyDocumentLinkValueContent = z.infer<typeof EmptyDocumentLinkValueContentSchema>\ntype EmptyExternalLinkValueContent = z.infer<typeof EmptyExternalLinkValueContentSchema>\ntype AnyLinkValueContent = z.infer<typeof AnyLinkValueContentSchema>\nexport type EmptyLinkValueContent =\n\t| EmptyImageLinkValueContent\n\t| EmptyFileLinkValueContent\n\t| EmptyMediaLinkValueContent\n\t| EmptyDocumentLinkValueContent\n\t| EmptyExternalLinkValueContent\n\t| AnyLinkValueContent\n\nconst LinkValueContentSchema: z.ZodMiniType<LinkValueContent> = z.union([\n\tFilledLinkValueContentSchema,\n\tEmptyLinkValueContentSchema,\n])\n\n// Used by content/codec/link\nexport type LinkValueContent = FilledLinkValueContent | EmptyLinkValueContent\n\n// Content\nexport const LinkContentType = \"LinkContent\" as const\n\nexport const LinkContentSchema = z.object({\n\t__TYPE__: z.literal(LinkContentType),\n\tkey: z.transform((value) => z.uuidv4().safeParse(value).data || crypto.randomUUID()),\n\t// We cannot use z.extend here because we're working with unions.\n\t// z.intersection wouldn't work also for the same reason.\n\tvalue: z.pipe(\n\t\tz.pipe(\n\t\t\tz.pipe(\n\t\t\t\tz.record(z.string(), z.unknown()),\n\t\t\t\tz.transform(\n\t\t\t\t\t({\n\t\t\t\t\t\ttext,\n\t\t\t\t\t\tvariant,\n\t\t\t\t\t\t...value\n\t\t\t\t\t}): {\n\t\t\t\t\t\ttext?: unknown\n\t\t\t\t\t\tvariant?: unknown\n\t\t\t\t\t\tvalue: Record<string, unknown>\n\t\t\t\t\t} => ({ text, variant, value }),\n\t\t\t\t),\n\t\t\t),\n\t\t\tz.object({\n\t\t\t\ttext: z.optional(z.string()),\n\t\t\t\tvariant: z.optional(z.string()),\n\t\t\t\tvalue: LinkValueContentSchema as z.ZodMiniType<LinkValueContent, Record<string, unknown>>,\n\t\t\t}),\n\t\t),\n\t\tz.transform(({ text, variant, value }) => ({\n\t\t\t...(text ? { text } : {}),\n\t\t\t...(variant ? { variant } : {}),\n\t\t\t...value,\n\t\t})),\n\t),\n})\n\nexport type LinkContent = z.infer<typeof LinkContentSchema>\n"],"mappings":";;;AAiBA,MAAM,oCAAoC,EAAE,OAAO,kCAAkC,EACpF,UAAU,EAAE,QAAQ,SAAS,MAAM,EACnC,CAAC;AAEF,MAA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E,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,EACjC,EAAE,WACA,EACA,MACA,SACA,GAAG,aAKE;EAAE;EAAM;EAAS;EAAO,EAC9B,CACD,EACD,EAAE,OAAO;EACR,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC;EAC5B,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC;EAC/B,OAAO;EACP,CAAC,CACF,EACD,EAAE,WAAW,EAAE,MAAM,SAAS,aAAa;EAC1C,GAAI,OAAO,EAAE,MAAM,GAAG,EAAE;EACxB,GAAI,UAAU,EAAE,SAAS,GAAG,EAAE;EAC9B,GAAG;EACH,EAAE,CACH;CACD,CAAC"}
1
+ {"version":3,"file":"link.js","names":[],"sources":["../../src/content/link.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport {\n\tEmptyDocumentLinkLegacyValueSchema,\n\tEmptyImageLinkLegacyValueSchema,\n\tFilledDocumentLinkLegacyValueSchema,\n\tFilledFileLinkLegacyValueSchema,\n\tFilledImageLinkLegacyValueSchema,\n\tEmptyMediaLinkLegacyValueSchema,\n\tFilledExternalLinkLegacyValueSchema,\n\tEmptyExternalLinkLegacyValueSchema,\n\tAnyLinkLegacySchema,\n\tLinkType,\n\tEmptyFileLinkLegacyValueSchema,\n} from \"./legacy/link\"\n\n// Image\nconst FilledImageLinkContentValueSchema = z.extend(FilledImageLinkLegacyValueSchema, {\n\t__TYPE__: z.literal(LinkType.Image),\n})\n\nconst EmptyImageLinkContentValueSchema = z.extend(EmptyImageLinkLegacyValueSchema, {\n\t__TYPE__: z.literal(LinkType.Image),\n})\n\n// File\nconst FilledFileLinkContentValueSchema = z.extend(FilledFileLinkLegacyValueSchema, {\n\t__TYPE__: z.literal(LinkType.File),\n})\n\nconst EmptyFileLinkContentValueSchema = z.extend(EmptyFileLinkLegacyValueSchema, {\n\t__TYPE__: z.literal(LinkType.File),\n})\n\n// Media\nconst EmptyMediaLinkContentValueSchema = z.extend(EmptyMediaLinkLegacyValueSchema, {\n\t__TYPE__: z.literal(LinkType.Media),\n})\n\n// Document\nconst FilledDocumentLinkContentValueSchema = z.extend(FilledDocumentLinkLegacyValueSchema, {\n\t__TYPE__: z.literal(LinkType.Document),\n})\n\nconst EmptyDocumentLinkContentValueSchema = z.extend(EmptyDocumentLinkLegacyValueSchema, {\n\t__TYPE__: z.literal(LinkType.Document),\n})\n\n// External\nconst FilledExternalLinkContentValueSchema = z.extend(FilledExternalLinkLegacyValueSchema, {\n\t__TYPE__: z.literal(LinkType.External),\n})\n\nconst EmptyExternalLinkContentValueSchema = z.extend(EmptyExternalLinkLegacyValueSchema, {\n\t__TYPE__: z.literal(LinkType.External),\n})\n\n// Any\nconst AnyLinkContentValueSchema = z.extend(AnyLinkLegacySchema, {\n\t__TYPE__: z.literal(LinkType.Any),\n})\n\n// All\n\n// Used by content/richText\nexport const FilledLinkContentValueSchema: z.ZodMiniType<FilledLinkContentValue> = z.union([\n\tFilledImageLinkContentValueSchema,\n\tFilledFileLinkContentValueSchema,\n\tFilledDocumentLinkContentValueSchema,\n\tFilledExternalLinkContentValueSchema,\n])\n\n// Used by content/legacy/link\ntype FilledImageLinkContentValue = z.infer<typeof FilledImageLinkContentValueSchema>\ntype FilledFileLinkContentValue = z.infer<typeof FilledFileLinkContentValueSchema>\ntype FilledDocumentLinkContentValue = z.infer<typeof FilledDocumentLinkContentValueSchema>\ntype FilledExternalLinkContentValue = z.infer<typeof FilledExternalLinkContentValueSchema>\nexport type FilledLinkContentValue =\n\t| FilledImageLinkContentValue\n\t| FilledFileLinkContentValue\n\t| FilledDocumentLinkContentValue\n\t| FilledExternalLinkContentValue\n\nconst EmptyLinkContentValueSchema: z.ZodMiniType<EmptyLinkContentValue> = z.union([\n\tEmptyImageLinkContentValueSchema,\n\tEmptyFileLinkContentValueSchema,\n\tEmptyMediaLinkContentValueSchema,\n\tEmptyDocumentLinkContentValueSchema,\n\tEmptyExternalLinkContentValueSchema,\n\tAnyLinkContentValueSchema,\n])\n\n// Used by content/codec/link\ntype EmptyImageLinkContentValue = z.infer<typeof EmptyImageLinkContentValueSchema>\ntype EmptyFileLinkContentValue = z.infer<typeof EmptyFileLinkContentValueSchema>\ntype EmptyMediaLinkContentValue = z.infer<typeof EmptyMediaLinkContentValueSchema>\ntype EmptyDocumentLinkContentValue = z.infer<typeof EmptyDocumentLinkContentValueSchema>\ntype EmptyExternalLinkContentValue = z.infer<typeof EmptyExternalLinkContentValueSchema>\ntype AnyLinkContentValue = z.infer<typeof AnyLinkContentValueSchema>\nexport type EmptyLinkContentValue =\n\t| EmptyImageLinkContentValue\n\t| EmptyFileLinkContentValue\n\t| EmptyMediaLinkContentValue\n\t| EmptyDocumentLinkContentValue\n\t| EmptyExternalLinkContentValue\n\t| AnyLinkContentValue\n\nconst LinkContentValueSchema: z.ZodMiniType<LinkContentValue> = z.union([\n\tFilledLinkContentValueSchema,\n\tEmptyLinkContentValueSchema,\n])\n\n// Used by content/codec/link\nexport type LinkContentValue = FilledLinkContentValue | EmptyLinkContentValue\n\n// Content\nexport const LinkContentType = \"LinkContent\" as const\n\nconst getLinkContentSchema = <TValue extends LinkContentValue>(value: z.ZodMiniType<TValue>) =>\n\tz.object({\n\t\t__TYPE__: z.literal(LinkContentType),\n\t\tkey: z.transform((value) => z.uuidv4().safeParse(value).data || crypto.randomUUID()),\n\t\t// We cannot use z.extend here because we're working with unions.\n\t\t// z.intersection wouldn't work also for the same reason.\n\t\tvalue: z.pipe(\n\t\t\tz.pipe(\n\t\t\t\tz.pipe(\n\t\t\t\t\tz.record(z.string(), z.unknown()),\n\t\t\t\t\tz.transform(\n\t\t\t\t\t\t({\n\t\t\t\t\t\t\ttext,\n\t\t\t\t\t\t\tvariant,\n\t\t\t\t\t\t\t...value\n\t\t\t\t\t\t}): {\n\t\t\t\t\t\t\ttext?: unknown\n\t\t\t\t\t\t\tvariant?: unknown\n\t\t\t\t\t\t\tvalue: Record<string, unknown>\n\t\t\t\t\t\t} => ({ text, variant, value }),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tz.object({\n\t\t\t\t\ttext: z.optional(z.string()),\n\t\t\t\t\tvariant: z.optional(z.string()),\n\t\t\t\t\tvalue: value as z.ZodMiniType<TValue, Record<string, unknown>>,\n\t\t\t\t}),\n\t\t\t),\n\t\t\tz.transform(({ text, variant, value }) => ({\n\t\t\t\t...(text ? { text } : {}),\n\t\t\t\t...(variant ? { variant } : {}),\n\t\t\t\t...value,\n\t\t\t})),\n\t\t),\n\t})\n\nexport const FilledLinkContentSchema = getLinkContentSchema(FilledLinkContentValueSchema)\n\nexport type FilledLinkContent = z.infer<typeof FilledLinkContentSchema>\n\nexport const EmptyLinkContentSchema = getLinkContentSchema(EmptyLinkContentValueSchema)\n\nexport type EmptyLinkContent = z.infer<typeof EmptyLinkContentSchema>\n\nexport const LinkContentSchema = getLinkContentSchema(LinkContentValueSchema)\n\nexport type LinkContent = z.infer<typeof LinkContentSchema>\n"],"mappings":";;;AAiBA,MAAM,oCAAoC,EAAE,OAAO,kCAAkC,EACpF,UAAU,EAAE,QAAQ,SAAS,MAAM,EACnC,CAAC;AAEF,MAAM,mCAAmC,EAAE,OAAO,iCAAiC,EAClF,UAAU,EAAE,QAAQ,SAAS,MAAM,EACnC,CAAC;AAGF,MAAM,mCAAmC,EAAE,OAAO,iCAAiC,EAClF,UAAU,EAAE,QAAQ,SAAS,KAAK,EAClC,CAAC;AAEF,MAAM,kCAAkC,EAAE,OAAO,gCAAgC,EAChF,UAAU,EAAE,QAAQ,SAAS,KAAK,EAClC,CAAC;AAGF,MAAM,mCAAmC,EAAE,OAAO,iCAAiC,EAClF,UAAU,EAAE,QAAQ,SAAS,MAAM,EACnC,CAAC;AAGF,MAAM,uCAAuC,EAAE,OAAO,qCAAqC,EAC1F,UAAU,EAAE,QAAQ,SAAS,SAAS,EACtC,CAAC;AAEF,MAAM,sCAAsC,EAAE,OAAO,oCAAoC,EACxF,UAAU,EAAE,QAAQ,SAAS,SAAS,EACtC,CAAC;AAGF,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@@ -1 +1 @@
1
- {"version":3,"file":"nestable.d.ts","names":[],"sources":["../../src/content/nestable.ts"],"mappings":";;;;;;;;;;;;;;;KAmEY,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"}
1
+ {"version":3,"file":"nestable.d.ts","names":[],"sources":["../../src/content/nestable.ts"],"mappings":";;;;;;;;;;;;;;;KAiEY,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"}
@@ -1,13 +1,13 @@
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
7
  import { ColorContentSchema, DateContentSchema, FieldContentType, NumberContentSchema, RangeContentSchema, SelectContentSchema, TextContentSchema, TimestampContentSchema } 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";
@@ -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 {\n\tColorContentSchema,\n\tDateContentSchema,\n\tFieldContentType,\n\tNumberContentSchema,\n\tRangeContentSchema,\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"],"mappings":";;;;;;;;;;;;;;AA4CA,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,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>;
@@ -21,14 +21,14 @@ declare const TextBlockValueSchema: z.ZodMiniObject<{
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,KAS3C,oBAAA,GACT,wBAAA,GACA,y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