@contember/react-richtext-renderer 2.1.0-beta.2 → 2.2.0-alpha.2

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 (160) hide show
  1. package/dist/development/src/components/RichText.cjs.map +1 -1
  2. package/dist/development/src/components/RichText.js.map +1 -1
  3. package/dist/development/src/components/RichTextBlocksRenderer.cjs.map +1 -1
  4. package/dist/development/src/components/RichTextBlocksRenderer.js.map +1 -1
  5. package/dist/development/src/components/RichTextFieldRenderer.cjs.map +1 -1
  6. package/dist/development/src/components/RichTextFieldRenderer.js.map +1 -1
  7. package/dist/development/src/components/RichTextRenderer.cjs.map +1 -1
  8. package/dist/development/src/components/RichTextRenderer.js.map +1 -1
  9. package/dist/development/src/hooks/useRichTextBlocksSource.cjs.map +1 -1
  10. package/dist/development/src/hooks/useRichTextBlocksSource.js.map +1 -1
  11. package/dist/development/src/hooks/useRichTextFieldSource.cjs.map +1 -1
  12. package/dist/development/src/hooks/useRichTextFieldSource.js.map +1 -1
  13. package/dist/development/src/internal/components/ElementRenderer.cjs.map +1 -1
  14. package/dist/development/src/internal/components/ElementRenderer.js.map +1 -1
  15. package/dist/development/src/internal/components/LeafRenderer.cjs.map +1 -1
  16. package/dist/development/src/internal/components/LeafRenderer.js.map +1 -1
  17. package/dist/development/src/internal/components/RenderElementFallback.cjs.map +1 -1
  18. package/dist/development/src/internal/components/RenderElementFallback.js.map +1 -1
  19. package/dist/development/src/internal/components/RenderLeafFallback.cjs.map +1 -1
  20. package/dist/development/src/internal/components/RenderLeafFallback.js.map +1 -1
  21. package/dist/development/src/internal/defaultDeserialize.cjs.map +1 -1
  22. package/dist/development/src/internal/defaultDeserialize.js.map +1 -1
  23. package/dist/development/src/internal/renderChildren.cjs.map +1 -1
  24. package/dist/development/src/internal/renderChildren.js.map +1 -1
  25. package/dist/development/src/internal/useReferenceMetadata.cjs.map +1 -1
  26. package/dist/development/src/internal/useReferenceMetadata.js.map +1 -1
  27. package/dist/production/src/components/RichText.cjs.map +1 -1
  28. package/dist/production/src/components/RichText.js.map +1 -1
  29. package/dist/production/src/components/RichTextBlocksRenderer.cjs.map +1 -1
  30. package/dist/production/src/components/RichTextBlocksRenderer.js.map +1 -1
  31. package/dist/production/src/components/RichTextFieldRenderer.cjs.map +1 -1
  32. package/dist/production/src/components/RichTextFieldRenderer.js.map +1 -1
  33. package/dist/production/src/components/RichTextRenderer.cjs.map +1 -1
  34. package/dist/production/src/components/RichTextRenderer.js.map +1 -1
  35. package/dist/production/src/hooks/useRichTextBlocksSource.cjs.map +1 -1
  36. package/dist/production/src/hooks/useRichTextBlocksSource.js.map +1 -1
  37. package/dist/production/src/hooks/useRichTextFieldSource.cjs.map +1 -1
  38. package/dist/production/src/hooks/useRichTextFieldSource.js.map +1 -1
  39. package/dist/production/src/internal/components/ElementRenderer.cjs.map +1 -1
  40. package/dist/production/src/internal/components/ElementRenderer.js.map +1 -1
  41. package/dist/production/src/internal/components/LeafRenderer.cjs.map +1 -1
  42. package/dist/production/src/internal/components/LeafRenderer.js.map +1 -1
  43. package/dist/production/src/internal/components/RenderElementFallback.cjs.map +1 -1
  44. package/dist/production/src/internal/components/RenderElementFallback.js.map +1 -1
  45. package/dist/production/src/internal/components/RenderLeafFallback.cjs.map +1 -1
  46. package/dist/production/src/internal/components/RenderLeafFallback.js.map +1 -1
  47. package/dist/production/src/internal/defaultDeserialize.cjs.map +1 -1
  48. package/dist/production/src/internal/defaultDeserialize.js.map +1 -1
  49. package/dist/production/src/internal/renderChildren.cjs.map +1 -1
  50. package/dist/production/src/internal/renderChildren.js.map +1 -1
  51. package/dist/production/src/internal/useReferenceMetadata.cjs.map +1 -1
  52. package/dist/production/src/internal/useReferenceMetadata.js.map +1 -1
  53. package/dist/types/components/RichText.d.ts +2 -2
  54. package/dist/types/components/RichText.d.ts.map +1 -1
  55. package/dist/types/components/RichTextBlocksRenderer.d.ts +1 -1
  56. package/dist/types/components/RichTextBlocksRenderer.d.ts.map +1 -1
  57. package/dist/types/components/RichTextFieldRenderer.d.ts +1 -1
  58. package/dist/types/components/RichTextFieldRenderer.d.ts.map +1 -1
  59. package/dist/types/components/RichTextRenderer.d.ts +4 -4
  60. package/dist/types/components/RichTextRenderer.d.ts.map +1 -1
  61. package/dist/types/components/index.d.ts +4 -4
  62. package/dist/types/components/index.d.ts.map +1 -1
  63. package/dist/types/hooks/index.d.ts +2 -2
  64. package/dist/types/hooks/index.d.ts.map +1 -1
  65. package/dist/types/hooks/useRichTextBlocksSource.d.ts +1 -1
  66. package/dist/types/hooks/useRichTextBlocksSource.d.ts.map +1 -1
  67. package/dist/types/hooks/useRichTextFieldSource.d.ts +1 -1
  68. package/dist/types/hooks/useRichTextFieldSource.d.ts.map +1 -1
  69. package/dist/types/index.d.ts +4 -4
  70. package/dist/types/index.d.ts.map +1 -1
  71. package/dist/types/internal/components/ElementRenderer.d.ts +5 -5
  72. package/dist/types/internal/components/ElementRenderer.d.ts.map +1 -1
  73. package/dist/types/internal/components/LeafRenderer.d.ts +5 -5
  74. package/dist/types/internal/components/LeafRenderer.d.ts.map +1 -1
  75. package/dist/types/internal/components/RenderElementFallback.d.ts +5 -5
  76. package/dist/types/internal/components/RenderElementFallback.d.ts.map +1 -1
  77. package/dist/types/internal/components/RenderLeafFallback.d.ts +1 -1
  78. package/dist/types/internal/components/RenderLeafFallback.d.ts.map +1 -1
  79. package/dist/types/internal/defaultDeserialize.d.ts +3 -3
  80. package/dist/types/internal/defaultDeserialize.d.ts.map +1 -1
  81. package/dist/types/internal/renderChildren.d.ts +5 -5
  82. package/dist/types/internal/renderChildren.d.ts.map +1 -1
  83. package/dist/types/internal/useReferenceMetadata.d.ts +7 -7
  84. package/dist/types/internal/useReferenceMetadata.d.ts.map +1 -1
  85. package/dist/types/tsconfig.tsbuildinfo +1 -1
  86. package/dist/types/types/RenderChildren.d.ts +2 -2
  87. package/dist/types/types/RenderChildren.d.ts.map +1 -1
  88. package/dist/types/types/RichTextBlock.d.ts +2 -2
  89. package/dist/types/types/RichTextBlock.d.ts.map +1 -1
  90. package/dist/types/types/RichTextBlockSource.d.ts +1 -1
  91. package/dist/types/types/RichTextBlockSource.d.ts.map +1 -1
  92. package/dist/types/types/RichTextFieldSource.d.ts +1 -1
  93. package/dist/types/types/RichTextFieldSource.d.ts.map +1 -1
  94. package/dist/types/types/RichTextReferenceMetadata.d.ts +3 -3
  95. package/dist/types/types/RichTextReferenceMetadata.d.ts.map +1 -1
  96. package/dist/types/types/RichTextRenderingOptions.d.ts +4 -4
  97. package/dist/types/types/RichTextRenderingOptions.d.ts.map +1 -1
  98. package/dist/types/types/builtin/BuiltinElements.d.ts +1 -1
  99. package/dist/types/types/builtin/BuiltinElements.d.ts.map +1 -1
  100. package/dist/types/types/builtin/BuiltinLeaves.d.ts +1 -1
  101. package/dist/types/types/builtin/BuiltinLeaves.d.ts.map +1 -1
  102. package/dist/types/types/builtin/index.d.ts +2 -2
  103. package/dist/types/types/builtin/index.d.ts.map +1 -1
  104. package/dist/types/types/custom/ReferenceRenderer.d.ts +6 -6
  105. package/dist/types/types/custom/ReferenceRenderer.d.ts.map +1 -1
  106. package/dist/types/types/custom/RenderElement.d.ts +8 -8
  107. package/dist/types/types/custom/RenderElement.d.ts.map +1 -1
  108. package/dist/types/types/custom/RenderLeaf.d.ts +2 -2
  109. package/dist/types/types/custom/RenderLeaf.d.ts.map +1 -1
  110. package/dist/types/types/custom/index.d.ts +4 -4
  111. package/dist/types/types/custom/index.d.ts.map +1 -1
  112. package/dist/types/types/index.d.ts +10 -10
  113. package/dist/types/types/index.d.ts.map +1 -1
  114. package/dist/types/types/structure/RichTextChild.d.ts +3 -3
  115. package/dist/types/types/structure/RichTextChild.d.ts.map +1 -1
  116. package/dist/types/types/structure/RichTextElement.d.ts +2 -2
  117. package/dist/types/types/structure/RichTextElement.d.ts.map +1 -1
  118. package/dist/types/types/structure/RootEditorNode.d.ts +3 -3
  119. package/dist/types/types/structure/RootEditorNode.d.ts.map +1 -1
  120. package/dist/types/types/structure/index.d.ts +4 -4
  121. package/dist/types/types/structure/index.d.ts.map +1 -1
  122. package/package.json +1 -2
  123. package/src/components/RichText.tsx +3 -3
  124. package/src/components/RichTextBlocksRenderer.tsx +3 -3
  125. package/src/components/RichTextFieldRenderer.tsx +3 -3
  126. package/src/components/RichTextRenderer.tsx +4 -4
  127. package/src/components/index.ts +4 -4
  128. package/src/hooks/index.ts +2 -2
  129. package/src/hooks/useRichTextBlocksSource.ts +3 -3
  130. package/src/hooks/useRichTextFieldSource.ts +2 -2
  131. package/src/index.ts +4 -4
  132. package/src/internal/components/ElementRenderer.tsx +8 -8
  133. package/src/internal/components/LeafRenderer.tsx +6 -6
  134. package/src/internal/components/RenderElementFallback.tsx +8 -8
  135. package/src/internal/components/RenderLeafFallback.tsx +1 -1
  136. package/src/internal/defaultDeserialize.ts +3 -3
  137. package/src/internal/renderChildren.tsx +7 -7
  138. package/src/internal/useReferenceMetadata.ts +9 -9
  139. package/src/types/RenderChildren.ts +2 -2
  140. package/src/types/RichTextBlock.ts +2 -2
  141. package/src/types/RichTextBlockSource.ts +1 -1
  142. package/src/types/RichTextFieldSource.ts +1 -1
  143. package/src/types/RichTextReferenceMetadata.ts +3 -3
  144. package/src/types/RichTextRenderingOptions.ts +4 -4
  145. package/src/types/builtin/BuiltinElements.ts +1 -1
  146. package/src/types/builtin/BuiltinLeaves.ts +1 -1
  147. package/src/types/builtin/index.ts +2 -2
  148. package/src/types/custom/ReferenceRenderer.ts +6 -6
  149. package/src/types/custom/RenderElement.ts +8 -8
  150. package/src/types/custom/RenderLeaf.ts +2 -2
  151. package/src/types/custom/index.ts +4 -4
  152. package/src/types/index.ts +10 -10
  153. package/src/types/structure/RichTextChild.ts +3 -3
  154. package/src/types/structure/RichTextElement.ts +2 -2
  155. package/src/types/structure/RootEditorNode.ts +3 -3
  156. package/src/types/structure/index.ts +4 -4
  157. package/tests/decodeBlockSource.test.tsx +2 -2
  158. package/tests/renderElement.test.tsx +1 -1
  159. package/tests/renderLeaf.test.tsx +1 -1
  160. package/tests/renderReferences.test.tsx +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextFieldRenderer.cjs","sources":["../../../../../packages/react-richtext-renderer/src/components/RichTextFieldRenderer.tsx"],"sourcesContent":["import { RichText } from './RichText'\nimport { RichTextElement, RichTextFieldSource, RichTextLeaf, RichTextRenderingOptions } from '../types'\nimport { useRichTextFieldSource } from '../hooks'\n\nexport type { RichTextFieldSource }\n\nexport type RichTextFieldRendererProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> =\n\t& RichTextFieldSource<CustomElements, CustomLeaves>\n\t& RichTextRenderingOptions<CustomElements, CustomLeaves>\n\n/**\n * Accepts raw RichText field source and renders them using the provided renderers.\n *\n * @group Content rendering\n */\nexport const RichTextFieldRenderer = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({\n\trenderLeaf,\n\trenderBlock,\n\trenderElement,\n\tattributeNamePrefix,\n\tundefinedReferenceHandler,\n\t...source\n}: RichTextFieldRendererProps<CustomElements, CustomLeaves>) => {\n\tconst blocks = useRichTextFieldSource(source)\n\n\treturn (\n\t\t<RichText<CustomElements, CustomLeaves>\n\t\t\tblocks={blocks}\n\t\t\trenderElement={renderElement}\n\t\t\trenderLeaf={renderLeaf}\n\t\t\trenderBlock={renderBlock}\n\t\t\tattributeNamePrefix={attributeNamePrefix}\n\t\t\tundefinedReferenceHandler={undefinedReferenceHandler}\n\t\t/>\n\t)\n}\n"],"names":["useRichTextFieldSource","jsx","RichText"],"mappings":";;;;;AAkBO,MAAM,wBAAwB,CAGnC;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACJ,MAAgE;AAC/D,QAAM,SAASA,uBAAAA,uBAAuB,MAAM;AAE5C,SACCC,2BAAAA;AAAAA,IAACC,SAAAA;AAAAA,IAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAAA;AAGH;;"}
1
+ {"version":3,"file":"RichTextFieldRenderer.cjs","sources":["../../../../../packages/react-richtext-renderer/src/components/RichTextFieldRenderer.tsx"],"sourcesContent":["import { RichText } from './RichText.js'\nimport { RichTextElement, RichTextFieldSource, RichTextLeaf, RichTextRenderingOptions } from '../types/index.js'\nimport { useRichTextFieldSource } from '../hooks/index.js'\n\nexport type { RichTextFieldSource }\n\nexport type RichTextFieldRendererProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> =\n\t& RichTextFieldSource<CustomElements, CustomLeaves>\n\t& RichTextRenderingOptions<CustomElements, CustomLeaves>\n\n/**\n * Accepts raw RichText field source and renders them using the provided renderers.\n *\n * @group Content rendering\n */\nexport const RichTextFieldRenderer = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({\n\trenderLeaf,\n\trenderBlock,\n\trenderElement,\n\tattributeNamePrefix,\n\tundefinedReferenceHandler,\n\t...source\n}: RichTextFieldRendererProps<CustomElements, CustomLeaves>) => {\n\tconst blocks = useRichTextFieldSource(source)\n\n\treturn (\n\t\t<RichText<CustomElements, CustomLeaves>\n\t\t\tblocks={blocks}\n\t\t\trenderElement={renderElement}\n\t\t\trenderLeaf={renderLeaf}\n\t\t\trenderBlock={renderBlock}\n\t\t\tattributeNamePrefix={attributeNamePrefix}\n\t\t\tundefinedReferenceHandler={undefinedReferenceHandler}\n\t\t/>\n\t)\n}\n"],"names":["useRichTextFieldSource","jsx","RichText"],"mappings":";;;;;AAkBO,MAAM,wBAAwB,CAGnC;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACJ,MAAgE;AAC/D,QAAM,SAASA,uBAAAA,uBAAuB,MAAM;AAE5C,SACCC,2BAAAA;AAAAA,IAACC,SAAAA;AAAAA,IAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAAA;AAGH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextFieldRenderer.js","sources":["../../../../../packages/react-richtext-renderer/src/components/RichTextFieldRenderer.tsx"],"sourcesContent":["import { RichText } from './RichText'\nimport { RichTextElement, RichTextFieldSource, RichTextLeaf, RichTextRenderingOptions } from '../types'\nimport { useRichTextFieldSource } from '../hooks'\n\nexport type { RichTextFieldSource }\n\nexport type RichTextFieldRendererProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> =\n\t& RichTextFieldSource<CustomElements, CustomLeaves>\n\t& RichTextRenderingOptions<CustomElements, CustomLeaves>\n\n/**\n * Accepts raw RichText field source and renders them using the provided renderers.\n *\n * @group Content rendering\n */\nexport const RichTextFieldRenderer = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({\n\trenderLeaf,\n\trenderBlock,\n\trenderElement,\n\tattributeNamePrefix,\n\tundefinedReferenceHandler,\n\t...source\n}: RichTextFieldRendererProps<CustomElements, CustomLeaves>) => {\n\tconst blocks = useRichTextFieldSource(source)\n\n\treturn (\n\t\t<RichText<CustomElements, CustomLeaves>\n\t\t\tblocks={blocks}\n\t\t\trenderElement={renderElement}\n\t\t\trenderLeaf={renderLeaf}\n\t\t\trenderBlock={renderBlock}\n\t\t\tattributeNamePrefix={attributeNamePrefix}\n\t\t\tundefinedReferenceHandler={undefinedReferenceHandler}\n\t\t/>\n\t)\n}\n"],"names":[],"mappings":";;;AAkBO,MAAM,wBAAwB,CAGnC;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACJ,MAAgE;AAC/D,QAAM,SAAS,uBAAuB,MAAM;AAE5C,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAAA;AAGH;"}
1
+ {"version":3,"file":"RichTextFieldRenderer.js","sources":["../../../../../packages/react-richtext-renderer/src/components/RichTextFieldRenderer.tsx"],"sourcesContent":["import { RichText } from './RichText.js'\nimport { RichTextElement, RichTextFieldSource, RichTextLeaf, RichTextRenderingOptions } from '../types/index.js'\nimport { useRichTextFieldSource } from '../hooks/index.js'\n\nexport type { RichTextFieldSource }\n\nexport type RichTextFieldRendererProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> =\n\t& RichTextFieldSource<CustomElements, CustomLeaves>\n\t& RichTextRenderingOptions<CustomElements, CustomLeaves>\n\n/**\n * Accepts raw RichText field source and renders them using the provided renderers.\n *\n * @group Content rendering\n */\nexport const RichTextFieldRenderer = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({\n\trenderLeaf,\n\trenderBlock,\n\trenderElement,\n\tattributeNamePrefix,\n\tundefinedReferenceHandler,\n\t...source\n}: RichTextFieldRendererProps<CustomElements, CustomLeaves>) => {\n\tconst blocks = useRichTextFieldSource(source)\n\n\treturn (\n\t\t<RichText<CustomElements, CustomLeaves>\n\t\t\tblocks={blocks}\n\t\t\trenderElement={renderElement}\n\t\t\trenderLeaf={renderLeaf}\n\t\t\trenderBlock={renderBlock}\n\t\t\tattributeNamePrefix={attributeNamePrefix}\n\t\t\tundefinedReferenceHandler={undefinedReferenceHandler}\n\t\t/>\n\t)\n}\n"],"names":[],"mappings":";;;AAkBO,MAAM,wBAAwB,CAGnC;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACJ,MAAgE;AAC/D,QAAM,SAAS,uBAAuB,MAAM;AAE5C,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAAA;AAGH;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextRenderer.cjs","sources":["../../../../../packages/react-richtext-renderer/src/components/RichTextRenderer.tsx"],"sourcesContent":["import { memo, ReactElement } from 'react'\nimport type { RichTextElement } from '../types/structure/RichTextElement'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf'\nimport { RichTextFieldRenderer, RichTextFieldRendererProps } from './RichTextFieldRenderer'\nimport { RichTextBlocksRenderer, RichTextBlocksRendererProps } from './RichTextBlocksRenderer'\n\nexport type RichTextRendererProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> =\n\t| RichTextFieldRendererProps<CustomElements, CustomLeaves>\n\t| RichTextBlocksRendererProps<CustomElements, CustomLeaves>\n\n/**\n * @deprecated Use `RichTextBlocksRenderer` or `RichTextFieldRenderer` instead, or directly use `RichText`.\n * @group Content rendering\n */\nexport const RichTextRenderer = memo(function RichTextRenderer<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(props: RichTextRendererProps<CustomElements, CustomLeaves>) {\n\tif ('source' in props) {\n\t\treturn <RichTextFieldRenderer<CustomElements, CustomLeaves> {...props} />\n\t}\n\n\treturn <RichTextBlocksRenderer<CustomElements, CustomLeaves> {...props} />\n}) as <CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf>(\n\tprops: RichTextRendererProps<CustomElements, CustomLeaves>,\n) => ReactElement\n"],"names":["memo","RichTextRenderer","jsx","RichTextFieldRenderer","RichTextBlocksRenderer"],"mappings":";;;;;;AAiBO,MAAM,mBAAmBA,MAAAA,KAAK,SAASC,kBAG5C,OAA4D;AAC7D,MAAI,YAAY,OAAO;AACtB,WAAOC,+BAACC,sBAAAA,uBAAA,EAAqD,GAAG,MAAA,CAAO;AAAA,EACxE;AAEA,SAAOD,+BAACE,uBAAAA,wBAAA,EAAsD,GAAG,MAAA,CAAO;AACzE,CAAC;;"}
1
+ {"version":3,"file":"RichTextRenderer.cjs","sources":["../../../../../packages/react-richtext-renderer/src/components/RichTextRenderer.tsx"],"sourcesContent":["import { memo, ReactElement } from 'react'\nimport type { RichTextElement } from '../types/structure/RichTextElement.js'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf.js'\nimport { RichTextFieldRenderer, RichTextFieldRendererProps } from './RichTextFieldRenderer.js'\nimport { RichTextBlocksRenderer, RichTextBlocksRendererProps } from './RichTextBlocksRenderer.js'\n\nexport type RichTextRendererProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> =\n\t| RichTextFieldRendererProps<CustomElements, CustomLeaves>\n\t| RichTextBlocksRendererProps<CustomElements, CustomLeaves>\n\n/**\n * @deprecated Use `RichTextBlocksRenderer` or `RichTextFieldRenderer` instead, or directly use `RichText`.\n * @group Content rendering\n */\nexport const RichTextRenderer = memo(function RichTextRenderer<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(props: RichTextRendererProps<CustomElements, CustomLeaves>) {\n\tif ('source' in props) {\n\t\treturn <RichTextFieldRenderer<CustomElements, CustomLeaves> {...props} />\n\t}\n\n\treturn <RichTextBlocksRenderer<CustomElements, CustomLeaves> {...props} />\n}) as <CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf>(\n\tprops: RichTextRendererProps<CustomElements, CustomLeaves>,\n) => ReactElement\n"],"names":["memo","RichTextRenderer","jsx","RichTextFieldRenderer","RichTextBlocksRenderer"],"mappings":";;;;;;AAiBO,MAAM,mBAAmBA,MAAAA,KAAK,SAASC,kBAG5C,OAA4D;AAC7D,MAAI,YAAY,OAAO;AACtB,WAAOC,+BAACC,sBAAAA,uBAAA,EAAqD,GAAG,MAAA,CAAO;AAAA,EACxE;AAEA,SAAOD,+BAACE,uBAAAA,wBAAA,EAAsD,GAAG,MAAA,CAAO;AACzE,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextRenderer.js","sources":["../../../../../packages/react-richtext-renderer/src/components/RichTextRenderer.tsx"],"sourcesContent":["import { memo, ReactElement } from 'react'\nimport type { RichTextElement } from '../types/structure/RichTextElement'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf'\nimport { RichTextFieldRenderer, RichTextFieldRendererProps } from './RichTextFieldRenderer'\nimport { RichTextBlocksRenderer, RichTextBlocksRendererProps } from './RichTextBlocksRenderer'\n\nexport type RichTextRendererProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> =\n\t| RichTextFieldRendererProps<CustomElements, CustomLeaves>\n\t| RichTextBlocksRendererProps<CustomElements, CustomLeaves>\n\n/**\n * @deprecated Use `RichTextBlocksRenderer` or `RichTextFieldRenderer` instead, or directly use `RichText`.\n * @group Content rendering\n */\nexport const RichTextRenderer = memo(function RichTextRenderer<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(props: RichTextRendererProps<CustomElements, CustomLeaves>) {\n\tif ('source' in props) {\n\t\treturn <RichTextFieldRenderer<CustomElements, CustomLeaves> {...props} />\n\t}\n\n\treturn <RichTextBlocksRenderer<CustomElements, CustomLeaves> {...props} />\n}) as <CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf>(\n\tprops: RichTextRendererProps<CustomElements, CustomLeaves>,\n) => ReactElement\n"],"names":["RichTextRenderer"],"mappings":";;;;AAiBO,MAAM,mBAAmB,KAAK,SAASA,kBAG5C,OAA4D;AAC7D,MAAI,YAAY,OAAO;AACtB,WAAO,oBAAC,uBAAA,EAAqD,GAAG,MAAA,CAAO;AAAA,EACxE;AAEA,SAAO,oBAAC,wBAAA,EAAsD,GAAG,MAAA,CAAO;AACzE,CAAC;"}
1
+ {"version":3,"file":"RichTextRenderer.js","sources":["../../../../../packages/react-richtext-renderer/src/components/RichTextRenderer.tsx"],"sourcesContent":["import { memo, ReactElement } from 'react'\nimport type { RichTextElement } from '../types/structure/RichTextElement.js'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf.js'\nimport { RichTextFieldRenderer, RichTextFieldRendererProps } from './RichTextFieldRenderer.js'\nimport { RichTextBlocksRenderer, RichTextBlocksRendererProps } from './RichTextBlocksRenderer.js'\n\nexport type RichTextRendererProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> =\n\t| RichTextFieldRendererProps<CustomElements, CustomLeaves>\n\t| RichTextBlocksRendererProps<CustomElements, CustomLeaves>\n\n/**\n * @deprecated Use `RichTextBlocksRenderer` or `RichTextFieldRenderer` instead, or directly use `RichText`.\n * @group Content rendering\n */\nexport const RichTextRenderer = memo(function RichTextRenderer<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(props: RichTextRendererProps<CustomElements, CustomLeaves>) {\n\tif ('source' in props) {\n\t\treturn <RichTextFieldRenderer<CustomElements, CustomLeaves> {...props} />\n\t}\n\n\treturn <RichTextBlocksRenderer<CustomElements, CustomLeaves> {...props} />\n}) as <CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf>(\n\tprops: RichTextRendererProps<CustomElements, CustomLeaves>,\n) => ReactElement\n"],"names":["RichTextRenderer"],"mappings":";;;;AAiBO,MAAM,mBAAmB,KAAK,SAASA,kBAG5C,OAA4D;AAC7D,MAAI,YAAY,OAAO;AACtB,WAAO,oBAAC,uBAAA,EAAqD,GAAG,MAAA,CAAO;AAAA,EACxE;AAEA,SAAO,oBAAC,wBAAA,EAAsD,GAAG,MAAA,CAAO;AACzE,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useRichTextBlocksSource.cjs","sources":["../../../../../packages/react-richtext-renderer/src/hooks/useRichTextBlocksSource.ts"],"sourcesContent":["import { RichTextBlock, RichTextBlockSource, RichTextElement, RichTextLeaf, RichTextReference, RootEditorNode } from '../types'\nimport { defaultDeserialize } from '../internal/defaultDeserialize'\nimport { useMemo } from 'react'\nimport { RichTextRendererError } from '../RichTextRendererError'\n\nexport const useRichTextBlocksSource = <CustomElements extends RichTextElement, CustomLeaves extends RichTextLeaf>({\n\tdeserialize = defaultDeserialize,\n\tblocks,\n\treferencesField,\n\tsourceField,\n\treferenceDiscriminationField,\n}: RichTextBlockSource<CustomElements, CustomLeaves>) => {\n\treturn useMemo((): RichTextBlock<CustomElements, CustomLeaves>[] => {\n\t\tconst sourceFieldResolved = sourceField ?? 'source'\n\t\tconst referencesFieldResolved = referencesField ?? 'references'\n\t\tconst referenceDiscriminationFieldResolved = referenceDiscriminationField ?? 'type'\n\n\t\treturn blocks.map(block => {\n\t\t\tif (!(sourceFieldResolved in block)) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`Found a block without a '${sourceFieldResolved}' field. `\n\t\t\t\t\t\t+ (sourceField === undefined\n\t\t\t\t\t\t\t? `The 'sourceField' prop has not been supplied, and so '${sourceFieldResolved}' was used as a default.`\n\t\t\t\t\t\t\t: `That is what the 'sourceField' prop has been set to, and so either this is a typo, `\n\t\t\t\t\t\t\t\t+ `or the data supplied is invalid.`),\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst source = block[sourceFieldResolved]\n\t\t\tif (typeof source !== 'string' && (typeof source !== 'object' || source === null)) {\n\t\t\t\tthrow new RichTextRendererError(`Found a block whose source is not a string or an object.`)\n\t\t\t}\n\n\t\t\tif (referencesField !== undefined && !(referencesFieldResolved in block)) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`The 'referencesField' prop is set to '${referencesFieldResolved}' but a block without such field `\n\t\t\t\t\t\t+ `has been encountered. Unless this is just a typo, `\n\t\t\t\t\t\t+ `if you do not wish to use references, avoid supplying the 'referencesField' prop.`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst references = block[referencesFieldResolved]\n\n\t\t\tlet normalizedReferences: Record<string, RichTextReference> | undefined\n\t\t\tif (references) {\n\t\t\t\tif (typeof Object(references)[Symbol.iterator] !== 'function') {\n\t\t\t\t\tthrow new RichTextRendererError(`The set of references must be an iterable!`)\n\t\t\t\t}\n\n\t\t\t\tnormalizedReferences = Object.fromEntries(\n\t\t\t\t\tArray.from(references as Iterable<RichTextReference>).map(reference => {\n\t\t\t\t\t\tif (!('id' in reference)) {\n\t\t\t\t\t\t\tthrow new RichTextRendererError(`Found a reference without an id field.`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!(referenceDiscriminationFieldResolved in reference) || typeof reference[referenceDiscriminationFieldResolved] !== 'string') {\n\t\t\t\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t\t\t\t`Found a reference without a '${referenceDiscriminationFieldResolved}' field. `\n\t\t\t\t\t\t\t\t\t+ (referenceDiscriminationField === undefined\n\t\t\t\t\t\t\t\t\t\t? `The 'referenceDiscriminationField' prop has not been supplied, `\n\t\t\t\t\t\t\t\t\t\t\t+ `and so '${referenceDiscriminationFieldResolved}' was used as a default.`\n\t\t\t\t\t\t\t\t\t\t: `That is what the 'referenceDiscriminationField' prop has been set to, `\n\t\t\t\t\t\t\t\t\t\t\t+ `and so either this is a typo, or the data supplied is invalid.`),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn [reference.id, {\n\t\t\t\t\t\t\t...reference,\n\t\t\t\t\t\t\ttype: reference[referenceDiscriminationFieldResolved] as string,\n\t\t\t\t\t\t}]\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tid: typeof block.id === 'string' ? block.id : undefined,\n\t\t\t\tcontent: typeof source === 'string' ? deserialize(source) : source as RootEditorNode<CustomElements, CustomLeaves>,\n\t\t\t\treferences: normalizedReferences,\n\t\t\t}\n\t\t})\n\t}, [blocks, deserialize, referenceDiscriminationField, referencesField, sourceField])\n}\n"],"names":["defaultDeserialize","useMemo","RichTextRendererError"],"mappings":";;;;;AAKO,MAAM,0BAA0B,CAA4E;AAAA,EAClH,cAAcA,mBAAAA;AAAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAAyD;AACxD,SAAOC,MAAAA,QAAQ,MAAqD;AACnE,UAAM,sBAAsB,eAAe;AAC3C,UAAM,0BAA0B,mBAAmB;AACnD,UAAM,uCAAuC,gCAAgC;AAE7E,WAAO,OAAO,IAAI,CAAA,UAAS;AAC1B,UAAI,EAAE,uBAAuB,QAAQ;AACpC,cAAM,IAAIC,sBAAAA;AAAAA,UACT,4BAA4B,mBAAmB,eAC3C,gBAAgB,SAChB,yDAAyD,mBAAmB,6BAC5E;AAAA,QAAA;AAAA,MAGN;AACA,YAAM,SAAS,MAAM,mBAAmB;AACxC,UAAI,OAAO,WAAW,aAAa,OAAO,WAAW,YAAY,WAAW,OAAO;AAClF,cAAM,IAAIA,sBAAAA,sBAAsB,0DAA0D;AAAA,MAC3F;AAEA,UAAI,oBAAoB,UAAa,EAAE,2BAA2B,QAAQ;AACzE,cAAM,IAAIA,sBAAAA;AAAAA,UACT,yCAAyC,uBAAuB;AAAA,QAAA;AAAA,MAIlE;AACA,YAAM,aAAa,MAAM,uBAAuB;AAEhD,UAAI;AACJ,UAAI,YAAY;AACf,YAAI,OAAO,OAAO,UAAU,EAAE,OAAO,QAAQ,MAAM,YAAY;AAC9D,gBAAM,IAAIA,sBAAAA,sBAAsB,4CAA4C;AAAA,QAC7E;AAEA,+BAAuB,OAAO;AAAA,UAC7B,MAAM,KAAK,UAAyC,EAAE,IAAI,CAAA,cAAa;AACtE,gBAAI,EAAE,QAAQ,YAAY;AACzB,oBAAM,IAAIA,sBAAAA,sBAAsB,wCAAwC;AAAA,YACzE;AACA,gBAAI,EAAE,wCAAwC,cAAc,OAAO,UAAU,oCAAoC,MAAM,UAAU;AAChI,oBAAM,IAAIA,sBAAAA;AAAAA,gBACT,gCAAgC,oCAAoC,eAChE,iCAAiC,SACjC,0EACY,oCAAoC,6BAChD;AAAA,cAAA;AAAA,YAGN;AACA,mBAAO,CAAC,UAAU,IAAI;AAAA,cACrB,GAAG;AAAA,cACH,MAAM,UAAU,oCAAoC;AAAA,YAAA,CACpD;AAAA,UACF,CAAC;AAAA,QAAA;AAAA,MAEH;AACA,aAAO;AAAA,QACN,IAAI,OAAO,MAAM,OAAO,WAAW,MAAM,KAAK;AAAA,QAC9C,SAAS,OAAO,WAAW,WAAW,YAAY,MAAM,IAAI;AAAA,QAC5D,YAAY;AAAA,MAAA;AAAA,IAEd,CAAC;AAAA,EACF,GAAG,CAAC,QAAQ,aAAa,8BAA8B,iBAAiB,WAAW,CAAC;AACrF;;"}
1
+ {"version":3,"file":"useRichTextBlocksSource.cjs","sources":["../../../../../packages/react-richtext-renderer/src/hooks/useRichTextBlocksSource.ts"],"sourcesContent":["import { RichTextBlock, RichTextBlockSource, RichTextElement, RichTextLeaf, RichTextReference, RootEditorNode } from '../types/index.js'\nimport { defaultDeserialize } from '../internal/defaultDeserialize.js'\nimport { useMemo } from 'react'\nimport { RichTextRendererError } from '../RichTextRendererError.js'\n\nexport const useRichTextBlocksSource = <CustomElements extends RichTextElement, CustomLeaves extends RichTextLeaf>({\n\tdeserialize = defaultDeserialize,\n\tblocks,\n\treferencesField,\n\tsourceField,\n\treferenceDiscriminationField,\n}: RichTextBlockSource<CustomElements, CustomLeaves>) => {\n\treturn useMemo((): RichTextBlock<CustomElements, CustomLeaves>[] => {\n\t\tconst sourceFieldResolved = sourceField ?? 'source'\n\t\tconst referencesFieldResolved = referencesField ?? 'references'\n\t\tconst referenceDiscriminationFieldResolved = referenceDiscriminationField ?? 'type'\n\n\t\treturn blocks.map(block => {\n\t\t\tif (!(sourceFieldResolved in block)) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`Found a block without a '${sourceFieldResolved}' field. `\n\t\t\t\t\t\t+ (sourceField === undefined\n\t\t\t\t\t\t\t? `The 'sourceField' prop has not been supplied, and so '${sourceFieldResolved}' was used as a default.`\n\t\t\t\t\t\t\t: `That is what the 'sourceField' prop has been set to, and so either this is a typo, `\n\t\t\t\t\t\t\t\t+ `or the data supplied is invalid.`),\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst source = block[sourceFieldResolved]\n\t\t\tif (typeof source !== 'string' && (typeof source !== 'object' || source === null)) {\n\t\t\t\tthrow new RichTextRendererError(`Found a block whose source is not a string or an object.`)\n\t\t\t}\n\n\t\t\tif (referencesField !== undefined && !(referencesFieldResolved in block)) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`The 'referencesField' prop is set to '${referencesFieldResolved}' but a block without such field `\n\t\t\t\t\t\t+ `has been encountered. Unless this is just a typo, `\n\t\t\t\t\t\t+ `if you do not wish to use references, avoid supplying the 'referencesField' prop.`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst references = block[referencesFieldResolved]\n\n\t\t\tlet normalizedReferences: Record<string, RichTextReference> | undefined\n\t\t\tif (references) {\n\t\t\t\tif (typeof Object(references)[Symbol.iterator] !== 'function') {\n\t\t\t\t\tthrow new RichTextRendererError(`The set of references must be an iterable!`)\n\t\t\t\t}\n\n\t\t\t\tnormalizedReferences = Object.fromEntries(\n\t\t\t\t\tArray.from(references as Iterable<RichTextReference>).map(reference => {\n\t\t\t\t\t\tif (!('id' in reference)) {\n\t\t\t\t\t\t\tthrow new RichTextRendererError(`Found a reference without an id field.`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!(referenceDiscriminationFieldResolved in reference) || typeof reference[referenceDiscriminationFieldResolved] !== 'string') {\n\t\t\t\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t\t\t\t`Found a reference without a '${referenceDiscriminationFieldResolved}' field. `\n\t\t\t\t\t\t\t\t\t+ (referenceDiscriminationField === undefined\n\t\t\t\t\t\t\t\t\t\t? `The 'referenceDiscriminationField' prop has not been supplied, `\n\t\t\t\t\t\t\t\t\t\t\t+ `and so '${referenceDiscriminationFieldResolved}' was used as a default.`\n\t\t\t\t\t\t\t\t\t\t: `That is what the 'referenceDiscriminationField' prop has been set to, `\n\t\t\t\t\t\t\t\t\t\t\t+ `and so either this is a typo, or the data supplied is invalid.`),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn [reference.id, {\n\t\t\t\t\t\t\t...reference,\n\t\t\t\t\t\t\ttype: reference[referenceDiscriminationFieldResolved] as string,\n\t\t\t\t\t\t}]\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tid: typeof block.id === 'string' ? block.id : undefined,\n\t\t\t\tcontent: typeof source === 'string' ? deserialize(source) : source as RootEditorNode<CustomElements, CustomLeaves>,\n\t\t\t\treferences: normalizedReferences,\n\t\t\t}\n\t\t})\n\t}, [blocks, deserialize, referenceDiscriminationField, referencesField, sourceField])\n}\n"],"names":["defaultDeserialize","useMemo","RichTextRendererError"],"mappings":";;;;;AAKO,MAAM,0BAA0B,CAA4E;AAAA,EAClH,cAAcA,mBAAAA;AAAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAAyD;AACxD,SAAOC,MAAAA,QAAQ,MAAqD;AACnE,UAAM,sBAAsB,eAAe;AAC3C,UAAM,0BAA0B,mBAAmB;AACnD,UAAM,uCAAuC,gCAAgC;AAE7E,WAAO,OAAO,IAAI,CAAA,UAAS;AAC1B,UAAI,EAAE,uBAAuB,QAAQ;AACpC,cAAM,IAAIC,sBAAAA;AAAAA,UACT,4BAA4B,mBAAmB,eAC3C,gBAAgB,SAChB,yDAAyD,mBAAmB,6BAC5E;AAAA,QAAA;AAAA,MAGN;AACA,YAAM,SAAS,MAAM,mBAAmB;AACxC,UAAI,OAAO,WAAW,aAAa,OAAO,WAAW,YAAY,WAAW,OAAO;AAClF,cAAM,IAAIA,sBAAAA,sBAAsB,0DAA0D;AAAA,MAC3F;AAEA,UAAI,oBAAoB,UAAa,EAAE,2BAA2B,QAAQ;AACzE,cAAM,IAAIA,sBAAAA;AAAAA,UACT,yCAAyC,uBAAuB;AAAA,QAAA;AAAA,MAIlE;AACA,YAAM,aAAa,MAAM,uBAAuB;AAEhD,UAAI;AACJ,UAAI,YAAY;AACf,YAAI,OAAO,OAAO,UAAU,EAAE,OAAO,QAAQ,MAAM,YAAY;AAC9D,gBAAM,IAAIA,sBAAAA,sBAAsB,4CAA4C;AAAA,QAC7E;AAEA,+BAAuB,OAAO;AAAA,UAC7B,MAAM,KAAK,UAAyC,EAAE,IAAI,CAAA,cAAa;AACtE,gBAAI,EAAE,QAAQ,YAAY;AACzB,oBAAM,IAAIA,sBAAAA,sBAAsB,wCAAwC;AAAA,YACzE;AACA,gBAAI,EAAE,wCAAwC,cAAc,OAAO,UAAU,oCAAoC,MAAM,UAAU;AAChI,oBAAM,IAAIA,sBAAAA;AAAAA,gBACT,gCAAgC,oCAAoC,eAChE,iCAAiC,SACjC,0EACY,oCAAoC,6BAChD;AAAA,cAAA;AAAA,YAGN;AACA,mBAAO,CAAC,UAAU,IAAI;AAAA,cACrB,GAAG;AAAA,cACH,MAAM,UAAU,oCAAoC;AAAA,YAAA,CACpD;AAAA,UACF,CAAC;AAAA,QAAA;AAAA,MAEH;AACA,aAAO;AAAA,QACN,IAAI,OAAO,MAAM,OAAO,WAAW,MAAM,KAAK;AAAA,QAC9C,SAAS,OAAO,WAAW,WAAW,YAAY,MAAM,IAAI;AAAA,QAC5D,YAAY;AAAA,MAAA;AAAA,IAEd,CAAC;AAAA,EACF,GAAG,CAAC,QAAQ,aAAa,8BAA8B,iBAAiB,WAAW,CAAC;AACrF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useRichTextBlocksSource.js","sources":["../../../../../packages/react-richtext-renderer/src/hooks/useRichTextBlocksSource.ts"],"sourcesContent":["import { RichTextBlock, RichTextBlockSource, RichTextElement, RichTextLeaf, RichTextReference, RootEditorNode } from '../types'\nimport { defaultDeserialize } from '../internal/defaultDeserialize'\nimport { useMemo } from 'react'\nimport { RichTextRendererError } from '../RichTextRendererError'\n\nexport const useRichTextBlocksSource = <CustomElements extends RichTextElement, CustomLeaves extends RichTextLeaf>({\n\tdeserialize = defaultDeserialize,\n\tblocks,\n\treferencesField,\n\tsourceField,\n\treferenceDiscriminationField,\n}: RichTextBlockSource<CustomElements, CustomLeaves>) => {\n\treturn useMemo((): RichTextBlock<CustomElements, CustomLeaves>[] => {\n\t\tconst sourceFieldResolved = sourceField ?? 'source'\n\t\tconst referencesFieldResolved = referencesField ?? 'references'\n\t\tconst referenceDiscriminationFieldResolved = referenceDiscriminationField ?? 'type'\n\n\t\treturn blocks.map(block => {\n\t\t\tif (!(sourceFieldResolved in block)) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`Found a block without a '${sourceFieldResolved}' field. `\n\t\t\t\t\t\t+ (sourceField === undefined\n\t\t\t\t\t\t\t? `The 'sourceField' prop has not been supplied, and so '${sourceFieldResolved}' was used as a default.`\n\t\t\t\t\t\t\t: `That is what the 'sourceField' prop has been set to, and so either this is a typo, `\n\t\t\t\t\t\t\t\t+ `or the data supplied is invalid.`),\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst source = block[sourceFieldResolved]\n\t\t\tif (typeof source !== 'string' && (typeof source !== 'object' || source === null)) {\n\t\t\t\tthrow new RichTextRendererError(`Found a block whose source is not a string or an object.`)\n\t\t\t}\n\n\t\t\tif (referencesField !== undefined && !(referencesFieldResolved in block)) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`The 'referencesField' prop is set to '${referencesFieldResolved}' but a block without such field `\n\t\t\t\t\t\t+ `has been encountered. Unless this is just a typo, `\n\t\t\t\t\t\t+ `if you do not wish to use references, avoid supplying the 'referencesField' prop.`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst references = block[referencesFieldResolved]\n\n\t\t\tlet normalizedReferences: Record<string, RichTextReference> | undefined\n\t\t\tif (references) {\n\t\t\t\tif (typeof Object(references)[Symbol.iterator] !== 'function') {\n\t\t\t\t\tthrow new RichTextRendererError(`The set of references must be an iterable!`)\n\t\t\t\t}\n\n\t\t\t\tnormalizedReferences = Object.fromEntries(\n\t\t\t\t\tArray.from(references as Iterable<RichTextReference>).map(reference => {\n\t\t\t\t\t\tif (!('id' in reference)) {\n\t\t\t\t\t\t\tthrow new RichTextRendererError(`Found a reference without an id field.`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!(referenceDiscriminationFieldResolved in reference) || typeof reference[referenceDiscriminationFieldResolved] !== 'string') {\n\t\t\t\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t\t\t\t`Found a reference without a '${referenceDiscriminationFieldResolved}' field. `\n\t\t\t\t\t\t\t\t\t+ (referenceDiscriminationField === undefined\n\t\t\t\t\t\t\t\t\t\t? `The 'referenceDiscriminationField' prop has not been supplied, `\n\t\t\t\t\t\t\t\t\t\t\t+ `and so '${referenceDiscriminationFieldResolved}' was used as a default.`\n\t\t\t\t\t\t\t\t\t\t: `That is what the 'referenceDiscriminationField' prop has been set to, `\n\t\t\t\t\t\t\t\t\t\t\t+ `and so either this is a typo, or the data supplied is invalid.`),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn [reference.id, {\n\t\t\t\t\t\t\t...reference,\n\t\t\t\t\t\t\ttype: reference[referenceDiscriminationFieldResolved] as string,\n\t\t\t\t\t\t}]\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tid: typeof block.id === 'string' ? block.id : undefined,\n\t\t\t\tcontent: typeof source === 'string' ? deserialize(source) : source as RootEditorNode<CustomElements, CustomLeaves>,\n\t\t\t\treferences: normalizedReferences,\n\t\t\t}\n\t\t})\n\t}, [blocks, deserialize, referenceDiscriminationField, referencesField, sourceField])\n}\n"],"names":[],"mappings":";;;AAKO,MAAM,0BAA0B,CAA4E;AAAA,EAClH,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAAyD;AACxD,SAAO,QAAQ,MAAqD;AACnE,UAAM,sBAAsB,eAAe;AAC3C,UAAM,0BAA0B,mBAAmB;AACnD,UAAM,uCAAuC,gCAAgC;AAE7E,WAAO,OAAO,IAAI,CAAA,UAAS;AAC1B,UAAI,EAAE,uBAAuB,QAAQ;AACpC,cAAM,IAAI;AAAA,UACT,4BAA4B,mBAAmB,eAC3C,gBAAgB,SAChB,yDAAyD,mBAAmB,6BAC5E;AAAA,QAAA;AAAA,MAGN;AACA,YAAM,SAAS,MAAM,mBAAmB;AACxC,UAAI,OAAO,WAAW,aAAa,OAAO,WAAW,YAAY,WAAW,OAAO;AAClF,cAAM,IAAI,sBAAsB,0DAA0D;AAAA,MAC3F;AAEA,UAAI,oBAAoB,UAAa,EAAE,2BAA2B,QAAQ;AACzE,cAAM,IAAI;AAAA,UACT,yCAAyC,uBAAuB;AAAA,QAAA;AAAA,MAIlE;AACA,YAAM,aAAa,MAAM,uBAAuB;AAEhD,UAAI;AACJ,UAAI,YAAY;AACf,YAAI,OAAO,OAAO,UAAU,EAAE,OAAO,QAAQ,MAAM,YAAY;AAC9D,gBAAM,IAAI,sBAAsB,4CAA4C;AAAA,QAC7E;AAEA,+BAAuB,OAAO;AAAA,UAC7B,MAAM,KAAK,UAAyC,EAAE,IAAI,CAAA,cAAa;AACtE,gBAAI,EAAE,QAAQ,YAAY;AACzB,oBAAM,IAAI,sBAAsB,wCAAwC;AAAA,YACzE;AACA,gBAAI,EAAE,wCAAwC,cAAc,OAAO,UAAU,oCAAoC,MAAM,UAAU;AAChI,oBAAM,IAAI;AAAA,gBACT,gCAAgC,oCAAoC,eAChE,iCAAiC,SACjC,0EACY,oCAAoC,6BAChD;AAAA,cAAA;AAAA,YAGN;AACA,mBAAO,CAAC,UAAU,IAAI;AAAA,cACrB,GAAG;AAAA,cACH,MAAM,UAAU,oCAAoC;AAAA,YAAA,CACpD;AAAA,UACF,CAAC;AAAA,QAAA;AAAA,MAEH;AACA,aAAO;AAAA,QACN,IAAI,OAAO,MAAM,OAAO,WAAW,MAAM,KAAK;AAAA,QAC9C,SAAS,OAAO,WAAW,WAAW,YAAY,MAAM,IAAI;AAAA,QAC5D,YAAY;AAAA,MAAA;AAAA,IAEd,CAAC;AAAA,EACF,GAAG,CAAC,QAAQ,aAAa,8BAA8B,iBAAiB,WAAW,CAAC;AACrF;"}
1
+ {"version":3,"file":"useRichTextBlocksSource.js","sources":["../../../../../packages/react-richtext-renderer/src/hooks/useRichTextBlocksSource.ts"],"sourcesContent":["import { RichTextBlock, RichTextBlockSource, RichTextElement, RichTextLeaf, RichTextReference, RootEditorNode } from '../types/index.js'\nimport { defaultDeserialize } from '../internal/defaultDeserialize.js'\nimport { useMemo } from 'react'\nimport { RichTextRendererError } from '../RichTextRendererError.js'\n\nexport const useRichTextBlocksSource = <CustomElements extends RichTextElement, CustomLeaves extends RichTextLeaf>({\n\tdeserialize = defaultDeserialize,\n\tblocks,\n\treferencesField,\n\tsourceField,\n\treferenceDiscriminationField,\n}: RichTextBlockSource<CustomElements, CustomLeaves>) => {\n\treturn useMemo((): RichTextBlock<CustomElements, CustomLeaves>[] => {\n\t\tconst sourceFieldResolved = sourceField ?? 'source'\n\t\tconst referencesFieldResolved = referencesField ?? 'references'\n\t\tconst referenceDiscriminationFieldResolved = referenceDiscriminationField ?? 'type'\n\n\t\treturn blocks.map(block => {\n\t\t\tif (!(sourceFieldResolved in block)) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`Found a block without a '${sourceFieldResolved}' field. `\n\t\t\t\t\t\t+ (sourceField === undefined\n\t\t\t\t\t\t\t? `The 'sourceField' prop has not been supplied, and so '${sourceFieldResolved}' was used as a default.`\n\t\t\t\t\t\t\t: `That is what the 'sourceField' prop has been set to, and so either this is a typo, `\n\t\t\t\t\t\t\t\t+ `or the data supplied is invalid.`),\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst source = block[sourceFieldResolved]\n\t\t\tif (typeof source !== 'string' && (typeof source !== 'object' || source === null)) {\n\t\t\t\tthrow new RichTextRendererError(`Found a block whose source is not a string or an object.`)\n\t\t\t}\n\n\t\t\tif (referencesField !== undefined && !(referencesFieldResolved in block)) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`The 'referencesField' prop is set to '${referencesFieldResolved}' but a block without such field `\n\t\t\t\t\t\t+ `has been encountered. Unless this is just a typo, `\n\t\t\t\t\t\t+ `if you do not wish to use references, avoid supplying the 'referencesField' prop.`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst references = block[referencesFieldResolved]\n\n\t\t\tlet normalizedReferences: Record<string, RichTextReference> | undefined\n\t\t\tif (references) {\n\t\t\t\tif (typeof Object(references)[Symbol.iterator] !== 'function') {\n\t\t\t\t\tthrow new RichTextRendererError(`The set of references must be an iterable!`)\n\t\t\t\t}\n\n\t\t\t\tnormalizedReferences = Object.fromEntries(\n\t\t\t\t\tArray.from(references as Iterable<RichTextReference>).map(reference => {\n\t\t\t\t\t\tif (!('id' in reference)) {\n\t\t\t\t\t\t\tthrow new RichTextRendererError(`Found a reference without an id field.`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!(referenceDiscriminationFieldResolved in reference) || typeof reference[referenceDiscriminationFieldResolved] !== 'string') {\n\t\t\t\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t\t\t\t`Found a reference without a '${referenceDiscriminationFieldResolved}' field. `\n\t\t\t\t\t\t\t\t\t+ (referenceDiscriminationField === undefined\n\t\t\t\t\t\t\t\t\t\t? `The 'referenceDiscriminationField' prop has not been supplied, `\n\t\t\t\t\t\t\t\t\t\t\t+ `and so '${referenceDiscriminationFieldResolved}' was used as a default.`\n\t\t\t\t\t\t\t\t\t\t: `That is what the 'referenceDiscriminationField' prop has been set to, `\n\t\t\t\t\t\t\t\t\t\t\t+ `and so either this is a typo, or the data supplied is invalid.`),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn [reference.id, {\n\t\t\t\t\t\t\t...reference,\n\t\t\t\t\t\t\ttype: reference[referenceDiscriminationFieldResolved] as string,\n\t\t\t\t\t\t}]\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tid: typeof block.id === 'string' ? block.id : undefined,\n\t\t\t\tcontent: typeof source === 'string' ? deserialize(source) : source as RootEditorNode<CustomElements, CustomLeaves>,\n\t\t\t\treferences: normalizedReferences,\n\t\t\t}\n\t\t})\n\t}, [blocks, deserialize, referenceDiscriminationField, referencesField, sourceField])\n}\n"],"names":[],"mappings":";;;AAKO,MAAM,0BAA0B,CAA4E;AAAA,EAClH,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAAyD;AACxD,SAAO,QAAQ,MAAqD;AACnE,UAAM,sBAAsB,eAAe;AAC3C,UAAM,0BAA0B,mBAAmB;AACnD,UAAM,uCAAuC,gCAAgC;AAE7E,WAAO,OAAO,IAAI,CAAA,UAAS;AAC1B,UAAI,EAAE,uBAAuB,QAAQ;AACpC,cAAM,IAAI;AAAA,UACT,4BAA4B,mBAAmB,eAC3C,gBAAgB,SAChB,yDAAyD,mBAAmB,6BAC5E;AAAA,QAAA;AAAA,MAGN;AACA,YAAM,SAAS,MAAM,mBAAmB;AACxC,UAAI,OAAO,WAAW,aAAa,OAAO,WAAW,YAAY,WAAW,OAAO;AAClF,cAAM,IAAI,sBAAsB,0DAA0D;AAAA,MAC3F;AAEA,UAAI,oBAAoB,UAAa,EAAE,2BAA2B,QAAQ;AACzE,cAAM,IAAI;AAAA,UACT,yCAAyC,uBAAuB;AAAA,QAAA;AAAA,MAIlE;AACA,YAAM,aAAa,MAAM,uBAAuB;AAEhD,UAAI;AACJ,UAAI,YAAY;AACf,YAAI,OAAO,OAAO,UAAU,EAAE,OAAO,QAAQ,MAAM,YAAY;AAC9D,gBAAM,IAAI,sBAAsB,4CAA4C;AAAA,QAC7E;AAEA,+BAAuB,OAAO;AAAA,UAC7B,MAAM,KAAK,UAAyC,EAAE,IAAI,CAAA,cAAa;AACtE,gBAAI,EAAE,QAAQ,YAAY;AACzB,oBAAM,IAAI,sBAAsB,wCAAwC;AAAA,YACzE;AACA,gBAAI,EAAE,wCAAwC,cAAc,OAAO,UAAU,oCAAoC,MAAM,UAAU;AAChI,oBAAM,IAAI;AAAA,gBACT,gCAAgC,oCAAoC,eAChE,iCAAiC,SACjC,0EACY,oCAAoC,6BAChD;AAAA,cAAA;AAAA,YAGN;AACA,mBAAO,CAAC,UAAU,IAAI;AAAA,cACrB,GAAG;AAAA,cACH,MAAM,UAAU,oCAAoC;AAAA,YAAA,CACpD;AAAA,UACF,CAAC;AAAA,QAAA;AAAA,MAEH;AACA,aAAO;AAAA,QACN,IAAI,OAAO,MAAM,OAAO,WAAW,MAAM,KAAK;AAAA,QAC9C,SAAS,OAAO,WAAW,WAAW,YAAY,MAAM,IAAI;AAAA,QAC5D,YAAY;AAAA,MAAA;AAAA,IAEd,CAAC;AAAA,EACF,GAAG,CAAC,QAAQ,aAAa,8BAA8B,iBAAiB,WAAW,CAAC;AACrF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useRichTextFieldSource.cjs","sources":["../../../../../packages/react-richtext-renderer/src/hooks/useRichTextFieldSource.ts"],"sourcesContent":["import { RichTextBlock, RichTextElement, RichTextFieldSource, RichTextLeaf } from '../types'\nimport { useMemo } from 'react'\nimport { defaultDeserialize } from '../internal/defaultDeserialize'\n\nexport const useRichTextFieldSource = <CustomElements extends RichTextElement, CustomLeaves extends RichTextLeaf>({\n\tsource,\n\tdeserialize = defaultDeserialize,\n}: RichTextFieldSource<CustomElements, CustomLeaves>): RichTextBlock<CustomElements, CustomLeaves>[] => {\n\treturn useMemo(() => {\n\t\treturn [\n\t\t\t{\n\t\t\t\tcontent: source\n\t\t\t\t\t? (typeof source === 'string' ? deserialize(source) : source)\n\t\t\t\t\t: {\n\t\t\t\t\t\tformatVersion: 0,\n\t\t\t\t\t\tchildren: [],\n\t\t\t\t\t},\n\t\t\t\tid: undefined,\n\t\t\t\treferencesField: undefined,\n\t\t\t\treferenceDiscriminationField: undefined,\n\t\t\t\treferenceRenderers: {},\n\t\t\t\treferences: undefined,\n\t\t\t},\n\t\t]\n\t}, [deserialize, source])\n}\n"],"names":["defaultDeserialize","useMemo"],"mappings":";;;;AAIO,MAAM,yBAAyB,CAA4E;AAAA,EACjH;AAAA,EACA,cAAcA,mBAAAA;AACf,MAAwG;AACvG,SAAOC,MAAAA,QAAQ,MAAM;AACpB,WAAO;AAAA,MACN;AAAA,QACC,SAAS,SACL,OAAO,WAAW,WAAW,YAAY,MAAM,IAAI,SACpD;AAAA,UACD,eAAe;AAAA,UACf,UAAU,CAAA;AAAA,QAAC;AAAA,QAEb,IAAI;AAAA,QACJ,iBAAiB;AAAA,QACjB,8BAA8B;AAAA,QAC9B,oBAAoB,CAAA;AAAA,QACpB,YAAY;AAAA,MAAA;AAAA,IACb;AAAA,EAEF,GAAG,CAAC,aAAa,MAAM,CAAC;AACzB;;"}
1
+ {"version":3,"file":"useRichTextFieldSource.cjs","sources":["../../../../../packages/react-richtext-renderer/src/hooks/useRichTextFieldSource.ts"],"sourcesContent":["import { RichTextBlock, RichTextElement, RichTextFieldSource, RichTextLeaf } from '../types/index.js'\nimport { useMemo } from 'react'\nimport { defaultDeserialize } from '../internal/defaultDeserialize.js'\n\nexport const useRichTextFieldSource = <CustomElements extends RichTextElement, CustomLeaves extends RichTextLeaf>({\n\tsource,\n\tdeserialize = defaultDeserialize,\n}: RichTextFieldSource<CustomElements, CustomLeaves>): RichTextBlock<CustomElements, CustomLeaves>[] => {\n\treturn useMemo(() => {\n\t\treturn [\n\t\t\t{\n\t\t\t\tcontent: source\n\t\t\t\t\t? (typeof source === 'string' ? deserialize(source) : source)\n\t\t\t\t\t: {\n\t\t\t\t\t\tformatVersion: 0,\n\t\t\t\t\t\tchildren: [],\n\t\t\t\t\t},\n\t\t\t\tid: undefined,\n\t\t\t\treferencesField: undefined,\n\t\t\t\treferenceDiscriminationField: undefined,\n\t\t\t\treferenceRenderers: {},\n\t\t\t\treferences: undefined,\n\t\t\t},\n\t\t]\n\t}, [deserialize, source])\n}\n"],"names":["defaultDeserialize","useMemo"],"mappings":";;;;AAIO,MAAM,yBAAyB,CAA4E;AAAA,EACjH;AAAA,EACA,cAAcA,mBAAAA;AACf,MAAwG;AACvG,SAAOC,MAAAA,QAAQ,MAAM;AACpB,WAAO;AAAA,MACN;AAAA,QACC,SAAS,SACL,OAAO,WAAW,WAAW,YAAY,MAAM,IAAI,SACpD;AAAA,UACD,eAAe;AAAA,UACf,UAAU,CAAA;AAAA,QAAC;AAAA,QAEb,IAAI;AAAA,QACJ,iBAAiB;AAAA,QACjB,8BAA8B;AAAA,QAC9B,oBAAoB,CAAA;AAAA,QACpB,YAAY;AAAA,MAAA;AAAA,IACb;AAAA,EAEF,GAAG,CAAC,aAAa,MAAM,CAAC;AACzB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useRichTextFieldSource.js","sources":["../../../../../packages/react-richtext-renderer/src/hooks/useRichTextFieldSource.ts"],"sourcesContent":["import { RichTextBlock, RichTextElement, RichTextFieldSource, RichTextLeaf } from '../types'\nimport { useMemo } from 'react'\nimport { defaultDeserialize } from '../internal/defaultDeserialize'\n\nexport const useRichTextFieldSource = <CustomElements extends RichTextElement, CustomLeaves extends RichTextLeaf>({\n\tsource,\n\tdeserialize = defaultDeserialize,\n}: RichTextFieldSource<CustomElements, CustomLeaves>): RichTextBlock<CustomElements, CustomLeaves>[] => {\n\treturn useMemo(() => {\n\t\treturn [\n\t\t\t{\n\t\t\t\tcontent: source\n\t\t\t\t\t? (typeof source === 'string' ? deserialize(source) : source)\n\t\t\t\t\t: {\n\t\t\t\t\t\tformatVersion: 0,\n\t\t\t\t\t\tchildren: [],\n\t\t\t\t\t},\n\t\t\t\tid: undefined,\n\t\t\t\treferencesField: undefined,\n\t\t\t\treferenceDiscriminationField: undefined,\n\t\t\t\treferenceRenderers: {},\n\t\t\t\treferences: undefined,\n\t\t\t},\n\t\t]\n\t}, [deserialize, source])\n}\n"],"names":[],"mappings":";;AAIO,MAAM,yBAAyB,CAA4E;AAAA,EACjH;AAAA,EACA,cAAc;AACf,MAAwG;AACvG,SAAO,QAAQ,MAAM;AACpB,WAAO;AAAA,MACN;AAAA,QACC,SAAS,SACL,OAAO,WAAW,WAAW,YAAY,MAAM,IAAI,SACpD;AAAA,UACD,eAAe;AAAA,UACf,UAAU,CAAA;AAAA,QAAC;AAAA,QAEb,IAAI;AAAA,QACJ,iBAAiB;AAAA,QACjB,8BAA8B;AAAA,QAC9B,oBAAoB,CAAA;AAAA,QACpB,YAAY;AAAA,MAAA;AAAA,IACb;AAAA,EAEF,GAAG,CAAC,aAAa,MAAM,CAAC;AACzB;"}
1
+ {"version":3,"file":"useRichTextFieldSource.js","sources":["../../../../../packages/react-richtext-renderer/src/hooks/useRichTextFieldSource.ts"],"sourcesContent":["import { RichTextBlock, RichTextElement, RichTextFieldSource, RichTextLeaf } from '../types/index.js'\nimport { useMemo } from 'react'\nimport { defaultDeserialize } from '../internal/defaultDeserialize.js'\n\nexport const useRichTextFieldSource = <CustomElements extends RichTextElement, CustomLeaves extends RichTextLeaf>({\n\tsource,\n\tdeserialize = defaultDeserialize,\n}: RichTextFieldSource<CustomElements, CustomLeaves>): RichTextBlock<CustomElements, CustomLeaves>[] => {\n\treturn useMemo(() => {\n\t\treturn [\n\t\t\t{\n\t\t\t\tcontent: source\n\t\t\t\t\t? (typeof source === 'string' ? deserialize(source) : source)\n\t\t\t\t\t: {\n\t\t\t\t\t\tformatVersion: 0,\n\t\t\t\t\t\tchildren: [],\n\t\t\t\t\t},\n\t\t\t\tid: undefined,\n\t\t\t\treferencesField: undefined,\n\t\t\t\treferenceDiscriminationField: undefined,\n\t\t\t\treferenceRenderers: {},\n\t\t\t\treferences: undefined,\n\t\t\t},\n\t\t]\n\t}, [deserialize, source])\n}\n"],"names":[],"mappings":";;AAIO,MAAM,yBAAyB,CAA4E;AAAA,EACjH;AAAA,EACA,cAAc;AACf,MAAwG;AACvG,SAAO,QAAQ,MAAM;AACpB,WAAO;AAAA,MACN;AAAA,QACC,SAAS,SACL,OAAO,WAAW,WAAW,YAAY,MAAM,IAAI,SACpD;AAAA,UACD,eAAe;AAAA,UACf,UAAU,CAAA;AAAA,QAAC;AAAA,QAEb,IAAI;AAAA,QACJ,iBAAiB;AAAA,QACjB,8BAA8B;AAAA,QAC9B,oBAAoB,CAAA;AAAA,QACpB,YAAY;AAAA,MAAA;AAAA,IACb;AAAA,EAEF,GAAG,CAAC,aAAa,MAAM,CAAC;AACzB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ElementRenderer.cjs","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/ElementRenderer.tsx"],"sourcesContent":["import type { ReactElement } from 'react'\nimport { createElement } from 'react'\nimport type { BuiltinElements } from '../../types/builtin/BuiltinElements'\nimport { renderChildren } from '../renderChildren'\nimport { RenderElementFallback } from './RenderElementFallback'\nimport { useReferenceMetadata } from '../useReferenceMetadata'\nimport type { RichTextElement } from '../../types/structure/RichTextElement'\nimport type { RichTextLeaf } from '../../types/structure/RichTextLeaf'\nimport { RichTextBlock } from '../../types/RichTextBlock'\nimport { RichTextRenderingOptions } from '../../types/RichTextRenderingOptions'\n\nexport interface ElementRendererProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> {\n\telement: CustomElements | BuiltinElements<CustomElements, CustomLeaves>\n\tchildren: ReactElement\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n}\n\nexport function ElementRenderer<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({ element, children, options, block }: ElementRendererProps<CustomElements, CustomLeaves>) {\n\tconst referenceMetadata = useReferenceMetadata<CustomElements, CustomLeaves>(element, options, block)\n\n\tconst fallback = (\n\t\t<RenderElementFallback<CustomElements, CustomLeaves>\n\t\t\telement={element as BuiltinElements<CustomElements, CustomLeaves>}\n\t\t\toptions={options}\n\t\t\tblock={block}\n\t\t>\n\t\t\t{children}\n\t\t</RenderElementFallback>\n\t)\n\n\treturn options.renderElement\n\t\t? createElement(options.renderElement, {\n\t\t\t...referenceMetadata,\n\t\t\tformatVersion: block.content.formatVersion,\n\t\t\tblock,\n\t\t\toptions,\n\t\t\telement,\n\t\t\tfallback,\n\t\t\tchildren,\n\t\t\trenderChildren: (children, opts = options) => renderChildren(children, opts, block),\n\t\t\trenderChildrenOptions: options,\n\t\t})\n\t\t: fallback\n}\n"],"names":["useReferenceMetadata","jsx","RenderElementFallback","createElement","children","renderChildren"],"mappings":";;;;;;;AAqBO,SAAS,gBAGd,EAAE,SAAS,UAAU,SAAS,SAA6D;AAC5F,QAAM,oBAAoBA,qBAAAA,qBAAmD,SAAS,SAAS,KAAK;AAEpG,QAAM,WACLC,2BAAAA;AAAAA,IAACC,sBAAAA;AAAAA,IAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEC;AAAA,IAAA;AAAA,EAAA;AAIH,SAAO,QAAQ,gBACZC,oBAAc,QAAQ,eAAe;AAAA,IACtC,GAAG;AAAA,IACH,eAAe,MAAM,QAAQ;AAAA,IAC7B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB,CAACC,WAAU,OAAO,YAAYC,eAAAA,eAAeD,WAAU,MAAM,KAAK;AAAA,IAClF,uBAAuB;AAAA,EAAA,CACvB,IACC;AACJ;;"}
1
+ {"version":3,"file":"ElementRenderer.cjs","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/ElementRenderer.tsx"],"sourcesContent":["import type { ReactElement } from 'react'\nimport { createElement } from 'react'\nimport type { BuiltinElements } from '../../types/builtin/BuiltinElements.js'\nimport { renderChildren } from '../renderChildren.js'\nimport { RenderElementFallback } from './RenderElementFallback.js'\nimport { useReferenceMetadata } from '../useReferenceMetadata.js'\nimport type { RichTextElement } from '../../types/structure/RichTextElement.js'\nimport type { RichTextLeaf } from '../../types/structure/RichTextLeaf.js'\nimport { RichTextBlock } from '../../types/RichTextBlock.js'\nimport { RichTextRenderingOptions } from '../../types/RichTextRenderingOptions.js'\n\nexport interface ElementRendererProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> {\n\telement: CustomElements | BuiltinElements<CustomElements, CustomLeaves>\n\tchildren: ReactElement\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n}\n\nexport function ElementRenderer<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({ element, children, options, block }: ElementRendererProps<CustomElements, CustomLeaves>) {\n\tconst referenceMetadata = useReferenceMetadata<CustomElements, CustomLeaves>(element, options, block)\n\n\tconst fallback = (\n\t\t<RenderElementFallback<CustomElements, CustomLeaves>\n\t\t\telement={element as BuiltinElements<CustomElements, CustomLeaves>}\n\t\t\toptions={options}\n\t\t\tblock={block}\n\t\t>\n\t\t\t{children}\n\t\t</RenderElementFallback>\n\t)\n\n\treturn options.renderElement\n\t\t? createElement(options.renderElement, {\n\t\t\t...referenceMetadata,\n\t\t\tformatVersion: block.content.formatVersion,\n\t\t\tblock,\n\t\t\toptions,\n\t\t\telement,\n\t\t\tfallback,\n\t\t\tchildren,\n\t\t\trenderChildren: (children, opts = options) => renderChildren(children, opts, block),\n\t\t\trenderChildrenOptions: options,\n\t\t})\n\t\t: fallback\n}\n"],"names":["useReferenceMetadata","jsx","RenderElementFallback","createElement","children","renderChildren"],"mappings":";;;;;;;AAqBO,SAAS,gBAGd,EAAE,SAAS,UAAU,SAAS,SAA6D;AAC5F,QAAM,oBAAoBA,qBAAAA,qBAAmD,SAAS,SAAS,KAAK;AAEpG,QAAM,WACLC,2BAAAA;AAAAA,IAACC,sBAAAA;AAAAA,IAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEC;AAAA,IAAA;AAAA,EAAA;AAIH,SAAO,QAAQ,gBACZC,oBAAc,QAAQ,eAAe;AAAA,IACtC,GAAG;AAAA,IACH,eAAe,MAAM,QAAQ;AAAA,IAC7B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB,CAACC,WAAU,OAAO,YAAYC,eAAAA,eAAeD,WAAU,MAAM,KAAK;AAAA,IAClF,uBAAuB;AAAA,EAAA,CACvB,IACC;AACJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ElementRenderer.js","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/ElementRenderer.tsx"],"sourcesContent":["import type { ReactElement } from 'react'\nimport { createElement } from 'react'\nimport type { BuiltinElements } from '../../types/builtin/BuiltinElements'\nimport { renderChildren } from '../renderChildren'\nimport { RenderElementFallback } from './RenderElementFallback'\nimport { useReferenceMetadata } from '../useReferenceMetadata'\nimport type { RichTextElement } from '../../types/structure/RichTextElement'\nimport type { RichTextLeaf } from '../../types/structure/RichTextLeaf'\nimport { RichTextBlock } from '../../types/RichTextBlock'\nimport { RichTextRenderingOptions } from '../../types/RichTextRenderingOptions'\n\nexport interface ElementRendererProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> {\n\telement: CustomElements | BuiltinElements<CustomElements, CustomLeaves>\n\tchildren: ReactElement\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n}\n\nexport function ElementRenderer<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({ element, children, options, block }: ElementRendererProps<CustomElements, CustomLeaves>) {\n\tconst referenceMetadata = useReferenceMetadata<CustomElements, CustomLeaves>(element, options, block)\n\n\tconst fallback = (\n\t\t<RenderElementFallback<CustomElements, CustomLeaves>\n\t\t\telement={element as BuiltinElements<CustomElements, CustomLeaves>}\n\t\t\toptions={options}\n\t\t\tblock={block}\n\t\t>\n\t\t\t{children}\n\t\t</RenderElementFallback>\n\t)\n\n\treturn options.renderElement\n\t\t? createElement(options.renderElement, {\n\t\t\t...referenceMetadata,\n\t\t\tformatVersion: block.content.formatVersion,\n\t\t\tblock,\n\t\t\toptions,\n\t\t\telement,\n\t\t\tfallback,\n\t\t\tchildren,\n\t\t\trenderChildren: (children, opts = options) => renderChildren(children, opts, block),\n\t\t\trenderChildrenOptions: options,\n\t\t})\n\t\t: fallback\n}\n"],"names":["children"],"mappings":";;;;;AAqBO,SAAS,gBAGd,EAAE,SAAS,UAAU,SAAS,SAA6D;AAC5F,QAAM,oBAAoB,qBAAmD,SAAS,SAAS,KAAK;AAEpG,QAAM,WACL;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEC;AAAA,IAAA;AAAA,EAAA;AAIH,SAAO,QAAQ,gBACZ,cAAc,QAAQ,eAAe;AAAA,IACtC,GAAG;AAAA,IACH,eAAe,MAAM,QAAQ;AAAA,IAC7B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB,CAACA,WAAU,OAAO,YAAY,eAAeA,WAAU,MAAM,KAAK;AAAA,IAClF,uBAAuB;AAAA,EAAA,CACvB,IACC;AACJ;"}
1
+ {"version":3,"file":"ElementRenderer.js","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/ElementRenderer.tsx"],"sourcesContent":["import type { ReactElement } from 'react'\nimport { createElement } from 'react'\nimport type { BuiltinElements } from '../../types/builtin/BuiltinElements.js'\nimport { renderChildren } from '../renderChildren.js'\nimport { RenderElementFallback } from './RenderElementFallback.js'\nimport { useReferenceMetadata } from '../useReferenceMetadata.js'\nimport type { RichTextElement } from '../../types/structure/RichTextElement.js'\nimport type { RichTextLeaf } from '../../types/structure/RichTextLeaf.js'\nimport { RichTextBlock } from '../../types/RichTextBlock.js'\nimport { RichTextRenderingOptions } from '../../types/RichTextRenderingOptions.js'\n\nexport interface ElementRendererProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> {\n\telement: CustomElements | BuiltinElements<CustomElements, CustomLeaves>\n\tchildren: ReactElement\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n}\n\nexport function ElementRenderer<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({ element, children, options, block }: ElementRendererProps<CustomElements, CustomLeaves>) {\n\tconst referenceMetadata = useReferenceMetadata<CustomElements, CustomLeaves>(element, options, block)\n\n\tconst fallback = (\n\t\t<RenderElementFallback<CustomElements, CustomLeaves>\n\t\t\telement={element as BuiltinElements<CustomElements, CustomLeaves>}\n\t\t\toptions={options}\n\t\t\tblock={block}\n\t\t>\n\t\t\t{children}\n\t\t</RenderElementFallback>\n\t)\n\n\treturn options.renderElement\n\t\t? createElement(options.renderElement, {\n\t\t\t...referenceMetadata,\n\t\t\tformatVersion: block.content.formatVersion,\n\t\t\tblock,\n\t\t\toptions,\n\t\t\telement,\n\t\t\tfallback,\n\t\t\tchildren,\n\t\t\trenderChildren: (children, opts = options) => renderChildren(children, opts, block),\n\t\t\trenderChildrenOptions: options,\n\t\t})\n\t\t: fallback\n}\n"],"names":["children"],"mappings":";;;;;AAqBO,SAAS,gBAGd,EAAE,SAAS,UAAU,SAAS,SAA6D;AAC5F,QAAM,oBAAoB,qBAAmD,SAAS,SAAS,KAAK;AAEpG,QAAM,WACL;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEC;AAAA,IAAA;AAAA,EAAA;AAIH,SAAO,QAAQ,gBACZ,cAAc,QAAQ,eAAe;AAAA,IACtC,GAAG;AAAA,IACH,eAAe,MAAM,QAAQ;AAAA,IAC7B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB,CAACA,WAAU,OAAO,YAAY,eAAeA,WAAU,MAAM,KAAK;AAAA,IAClF,uBAAuB;AAAA,EAAA,CACvB,IACC;AACJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LeafRenderer.cjs","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/LeafRenderer.tsx"],"sourcesContent":["import { createElement } from 'react'\nimport type { BuiltinLeaves } from '../../types/builtin/BuiltinLeaves'\nimport { RenderLeafFallback } from './RenderLeafFallback'\nimport type { RichTextLeaf } from '../../types/structure/RichTextLeaf'\nimport { RichTextElement } from '../../types/structure/RichTextElement'\nimport { RichTextRenderingOptions } from '../../types/RichTextRenderingOptions'\nimport { RichTextBlock } from '../../types/RichTextBlock'\n\nexport interface LeafRendererProps<CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf> {\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n\tleaf: CustomLeaves & BuiltinLeaves\n}\n\nexport function LeafRenderer<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({\n\tleaf,\n\toptions: { renderLeaf },\n\tblock: { content: { formatVersion } },\n}: LeafRendererProps<CustomElements, CustomLeaves>) {\n\tconst fallback = <RenderLeafFallback leaf={leaf} />\n\n\treturn renderLeaf\n\t\t? createElement(\n\t\t\trenderLeaf,\n\t\t\t{\n\t\t\t\tformatVersion,\n\t\t\t\tleaf,\n\t\t\t\tfallback,\n\t\t\t\tchildren: leaf.text,\n\t\t\t},\n\t\t)\n\t\t: fallback\n}\n"],"names":["jsx","RenderLeafFallback","createElement"],"mappings":";;;;;AAcO,SAAS,aAGd;AAAA,EACD;AAAA,EACA,SAAS,EAAE,WAAA;AAAA,EACX,OAAO,EAAE,SAAS,EAAE,gBAAc;AACnC,GAAoD;AACnD,QAAM,WAAWA,2BAAAA,IAACC,uCAAA,EAAmB,KAAA,CAAY;AAEjD,SAAO,aACJC,MAAAA;AAAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU,KAAK;AAAA,IAAA;AAAA,EAChB,IAEC;AACJ;;"}
1
+ {"version":3,"file":"LeafRenderer.cjs","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/LeafRenderer.tsx"],"sourcesContent":["import { createElement } from 'react'\nimport type { BuiltinLeaves } from '../../types/builtin/BuiltinLeaves.js'\nimport { RenderLeafFallback } from './RenderLeafFallback.js'\nimport type { RichTextLeaf } from '../../types/structure/RichTextLeaf.js'\nimport { RichTextElement } from '../../types/structure/RichTextElement.js'\nimport { RichTextRenderingOptions } from '../../types/RichTextRenderingOptions.js'\nimport { RichTextBlock } from '../../types/RichTextBlock.js'\n\nexport interface LeafRendererProps<CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf> {\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n\tleaf: CustomLeaves & BuiltinLeaves\n}\n\nexport function LeafRenderer<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({\n\tleaf,\n\toptions: { renderLeaf },\n\tblock: { content: { formatVersion } },\n}: LeafRendererProps<CustomElements, CustomLeaves>) {\n\tconst fallback = <RenderLeafFallback leaf={leaf} />\n\n\treturn renderLeaf\n\t\t? createElement(\n\t\t\trenderLeaf,\n\t\t\t{\n\t\t\t\tformatVersion,\n\t\t\t\tleaf,\n\t\t\t\tfallback,\n\t\t\t\tchildren: leaf.text,\n\t\t\t},\n\t\t)\n\t\t: fallback\n}\n"],"names":["jsx","RenderLeafFallback","createElement"],"mappings":";;;;;AAcO,SAAS,aAGd;AAAA,EACD;AAAA,EACA,SAAS,EAAE,WAAA;AAAA,EACX,OAAO,EAAE,SAAS,EAAE,gBAAc;AACnC,GAAoD;AACnD,QAAM,WAAWA,2BAAAA,IAACC,uCAAA,EAAmB,KAAA,CAAY;AAEjD,SAAO,aACJC,MAAAA;AAAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU,KAAK;AAAA,IAAA;AAAA,EAChB,IAEC;AACJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LeafRenderer.js","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/LeafRenderer.tsx"],"sourcesContent":["import { createElement } from 'react'\nimport type { BuiltinLeaves } from '../../types/builtin/BuiltinLeaves'\nimport { RenderLeafFallback } from './RenderLeafFallback'\nimport type { RichTextLeaf } from '../../types/structure/RichTextLeaf'\nimport { RichTextElement } from '../../types/structure/RichTextElement'\nimport { RichTextRenderingOptions } from '../../types/RichTextRenderingOptions'\nimport { RichTextBlock } from '../../types/RichTextBlock'\n\nexport interface LeafRendererProps<CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf> {\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n\tleaf: CustomLeaves & BuiltinLeaves\n}\n\nexport function LeafRenderer<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({\n\tleaf,\n\toptions: { renderLeaf },\n\tblock: { content: { formatVersion } },\n}: LeafRendererProps<CustomElements, CustomLeaves>) {\n\tconst fallback = <RenderLeafFallback leaf={leaf} />\n\n\treturn renderLeaf\n\t\t? createElement(\n\t\t\trenderLeaf,\n\t\t\t{\n\t\t\t\tformatVersion,\n\t\t\t\tleaf,\n\t\t\t\tfallback,\n\t\t\t\tchildren: leaf.text,\n\t\t\t},\n\t\t)\n\t\t: fallback\n}\n"],"names":[],"mappings":";;;AAcO,SAAS,aAGd;AAAA,EACD;AAAA,EACA,SAAS,EAAE,WAAA;AAAA,EACX,OAAO,EAAE,SAAS,EAAE,gBAAc;AACnC,GAAoD;AACnD,QAAM,WAAW,oBAAC,oBAAA,EAAmB,KAAA,CAAY;AAEjD,SAAO,aACJ;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU,KAAK;AAAA,IAAA;AAAA,EAChB,IAEC;AACJ;"}
1
+ {"version":3,"file":"LeafRenderer.js","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/LeafRenderer.tsx"],"sourcesContent":["import { createElement } from 'react'\nimport type { BuiltinLeaves } from '../../types/builtin/BuiltinLeaves.js'\nimport { RenderLeafFallback } from './RenderLeafFallback.js'\nimport type { RichTextLeaf } from '../../types/structure/RichTextLeaf.js'\nimport { RichTextElement } from '../../types/structure/RichTextElement.js'\nimport { RichTextRenderingOptions } from '../../types/RichTextRenderingOptions.js'\nimport { RichTextBlock } from '../../types/RichTextBlock.js'\n\nexport interface LeafRendererProps<CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf> {\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n\tleaf: CustomLeaves & BuiltinLeaves\n}\n\nexport function LeafRenderer<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({\n\tleaf,\n\toptions: { renderLeaf },\n\tblock: { content: { formatVersion } },\n}: LeafRendererProps<CustomElements, CustomLeaves>) {\n\tconst fallback = <RenderLeafFallback leaf={leaf} />\n\n\treturn renderLeaf\n\t\t? createElement(\n\t\t\trenderLeaf,\n\t\t\t{\n\t\t\t\tformatVersion,\n\t\t\t\tleaf,\n\t\t\t\tfallback,\n\t\t\t\tchildren: leaf.text,\n\t\t\t},\n\t\t)\n\t\t: fallback\n}\n"],"names":[],"mappings":";;;AAcO,SAAS,aAGd;AAAA,EACD;AAAA,EACA,SAAS,EAAE,WAAA;AAAA,EACX,OAAO,EAAE,SAAS,EAAE,gBAAc;AACnC,GAAoD;AACnD,QAAM,WAAW,oBAAC,oBAAA,EAAmB,KAAA,CAAY;AAEjD,SAAO,aACJ;AAAA,IACD;AAAA,IACA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU,KAAK;AAAA,IAAA;AAAA,EAChB,IAEC;AACJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RenderElementFallback.cjs","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx"],"sourcesContent":["import { createElement, ReactElement } from 'react'\nimport type { BuiltinElements, RichTextReferenceElement, RichTextTableRowElement } from '../../types/builtin/BuiltinElements'\nimport { renderChildren } from '../renderChildren'\nimport { useReferenceMetadata } from '../useReferenceMetadata'\nimport type { RichTextElement } from '../../types/structure/RichTextElement'\nimport type { RichTextLeaf } from '../../types/structure/RichTextLeaf'\nimport { RichTextRendererError } from '../../RichTextRendererError'\nimport { RichTextBlock } from '../../types/RichTextBlock'\nimport { RichTextRenderingOptions } from '../../types/RichTextRenderingOptions'\n\nexport interface RenderElementFallbackProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> {\n\telement: BuiltinElements<CustomElements, CustomLeaves>\n\tchildren: ReactElement\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n}\n\nconst getElementDataAttributes = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(\n\telement: RichTextElement<CustomElements, CustomLeaves>,\n\tattributeNamePrefix: string = 'contember-',\n): {\n\t[dataAttribute: string]: string | number | boolean\n} => {\n\tconst { children, referenceId, ...extendedSpecifics } = element\n\n\treturn Object.fromEntries(\n\t\tObject.entries(extendedSpecifics)\n\t\t\t.filter(([, value]) => {\n\t\t\t\tconst t = typeof value\n\t\t\t\treturn t === 'string' || t === 'number' || t === 'boolean'\n\t\t\t})\n\t\t\t.map(([attribute, value]) => [`data-${attributeNamePrefix}${attribute.toLowerCase()}`, value]),\n\t)\n}\n\nexport function RenderElementFallback<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({ element, children, options, block }: RenderElementFallbackProps<CustomElements, CustomLeaves>) {\n\tconst attributes = getElementDataAttributes(element, options.attributeNamePrefix)\n\n\tswitch (element.type) {\n\t\tcase 'anchor':\n\t\t\treturn (\n\t\t\t\t<a {...attributes} href={element.href}>\n\t\t\t\t\t{children}\n\t\t\t\t</a>\n\t\t\t)\n\t\tcase 'heading':\n\t\t\treturn createElement(`h${element.level}`, attributes, children) // TODO numbered\n\t\tcase 'horizontalRule':\n\t\t\treturn <hr {...attributes} />\n\t\tcase 'listItem':\n\t\t\treturn <li {...attributes}>{children}</li>\n\t\tcase 'orderedList':\n\t\t\treturn <ol {...attributes}>{children}</ol>\n\t\tcase 'paragraph':\n\t\t\treturn <p {...attributes}>{children}</p>\n\t\tcase 'reference': {\n\t\t\treturn <ReferenceElementFallback element={element} children={children} options={options} block={block} />\n\t\t}\n\t\tcase 'scrollTarget':\n\t\t\treturn (\n\t\t\t\t<span {...attributes} id={element.identifier}>\n\t\t\t\t\t{children}\n\t\t\t\t</span>\n\t\t\t)\n\t\tcase 'table': {\n\t\t\tconst firstRow = element.children[0] as RichTextTableRowElement<CustomElements, CustomLeaves> | undefined\n\t\t\tif (!firstRow || firstRow.headerScope !== 'table') {\n\t\t\t\treturn (\n\t\t\t\t\t<table {...attributes}>\n\t\t\t\t\t\t<tbody>{children}</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<table {...attributes}>\n\t\t\t\t\t<thead>{renderChildren<CustomElements, CustomLeaves>([firstRow], options, block)}</thead>\n\t\t\t\t\t<tbody>{renderChildren<CustomElements, CustomLeaves>(element.children.slice(1) as any, options, block)}</tbody>\n\t\t\t\t</table>\n\t\t\t)\n\t\t}\n\t\tcase 'tableRow':\n\t\t\treturn <tr {...attributes}>{children}</tr>\n\t\tcase 'tableCell': {\n\t\t\tif (element.headerScope) {\n\t\t\t\treturn (\n\t\t\t\t\t<th {...attributes} scope={element.headerScope}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</th>\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn <td {...attributes}>{children}</td>\n\t\t}\n\t\tcase 'unorderedList':\n\t\t\treturn <ul {...attributes}>{children}</ul>\n\t\tdefault: {\n\t\t\tif (import.meta.env.DEV) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`RichTextRenderer: unknown element of type '${(element as { type: string }).type}'.`,\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\treturn children // At least render the text contents\n\t\t\t}\n\t\t}\n\t}\n}\n\ntype ReferenceElementFallbackProps<CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf> = {\n\telement: RichTextReferenceElement<CustomElements, CustomLeaves>\n\tchildren: ReactElement\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n}\n\nfunction ReferenceElementFallback<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({ element, children, options, block }: ReferenceElementFallbackProps<CustomElements, CustomLeaves>) {\n\tconst elementMetadata = useReferenceMetadata<CustomElements, CustomLeaves>(element, options, block, true)\n\n\tif (\n\t\telementMetadata.referenceRenderer === undefined\n\t\t|| elementMetadata.referenceType === undefined\n\t\t|| elementMetadata.reference === undefined\n\t) {\n\t\treturn children // At least render the text contents\n\t}\n\n\tlet Renderer = elementMetadata.referenceRenderer\n\treturn (\n\t\t<>\n\t\t\t<Renderer\n\t\t\t\treferenceType={elementMetadata.referenceType}\n\t\t\t\treferenceRenderer={elementMetadata.referenceRenderer}\n\t\t\t\treference={elementMetadata.reference}\n\t\t\t\tformatVersion={block.content.formatVersion}\n\t\t\t\tblock={block}\n\t\t\t\toptions={options}\n\t\t\t\telement={element}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Renderer>\n\t\t</>\n\t)\n}\n"],"names":["createElement","jsx","jsxs","renderChildren","useReferenceMetadata","Fragment"],"mappings":"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"}
1
+ {"version":3,"file":"RenderElementFallback.cjs","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx"],"sourcesContent":["import { createElement, ReactElement } from 'react'\nimport type { BuiltinElements, RichTextReferenceElement, RichTextTableRowElement } from '../../types/builtin/BuiltinElements.js'\nimport { renderChildren } from '../renderChildren.js'\nimport { useReferenceMetadata } from '../useReferenceMetadata.js'\nimport type { RichTextElement } from '../../types/structure/RichTextElement.js'\nimport type { RichTextLeaf } from '../../types/structure/RichTextLeaf.js'\nimport { RichTextRendererError } from '../../RichTextRendererError.js'\nimport { RichTextBlock } from '../../types/RichTextBlock.js'\nimport { RichTextRenderingOptions } from '../../types/RichTextRenderingOptions.js'\n\nexport interface RenderElementFallbackProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> {\n\telement: BuiltinElements<CustomElements, CustomLeaves>\n\tchildren: ReactElement\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n}\n\nconst getElementDataAttributes = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(\n\telement: RichTextElement<CustomElements, CustomLeaves>,\n\tattributeNamePrefix: string = 'contember-',\n): {\n\t[dataAttribute: string]: string | number | boolean\n} => {\n\tconst { children, referenceId, ...extendedSpecifics } = element\n\n\treturn Object.fromEntries(\n\t\tObject.entries(extendedSpecifics)\n\t\t\t.filter(([, value]) => {\n\t\t\t\tconst t = typeof value\n\t\t\t\treturn t === 'string' || t === 'number' || t === 'boolean'\n\t\t\t})\n\t\t\t.map(([attribute, value]) => [`data-${attributeNamePrefix}${attribute.toLowerCase()}`, value]),\n\t)\n}\n\nexport function RenderElementFallback<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({ element, children, options, block }: RenderElementFallbackProps<CustomElements, CustomLeaves>) {\n\tconst attributes = getElementDataAttributes(element, options.attributeNamePrefix)\n\n\tswitch (element.type) {\n\t\tcase 'anchor':\n\t\t\treturn (\n\t\t\t\t<a {...attributes} href={element.href}>\n\t\t\t\t\t{children}\n\t\t\t\t</a>\n\t\t\t)\n\t\tcase 'heading':\n\t\t\treturn createElement(`h${element.level}`, attributes, children) // TODO numbered\n\t\tcase 'horizontalRule':\n\t\t\treturn <hr {...attributes} />\n\t\tcase 'listItem':\n\t\t\treturn <li {...attributes}>{children}</li>\n\t\tcase 'orderedList':\n\t\t\treturn <ol {...attributes}>{children}</ol>\n\t\tcase 'paragraph':\n\t\t\treturn <p {...attributes}>{children}</p>\n\t\tcase 'reference': {\n\t\t\treturn <ReferenceElementFallback element={element} children={children} options={options} block={block} />\n\t\t}\n\t\tcase 'scrollTarget':\n\t\t\treturn (\n\t\t\t\t<span {...attributes} id={element.identifier}>\n\t\t\t\t\t{children}\n\t\t\t\t</span>\n\t\t\t)\n\t\tcase 'table': {\n\t\t\tconst firstRow = element.children[0] as RichTextTableRowElement<CustomElements, CustomLeaves> | undefined\n\t\t\tif (!firstRow || firstRow.headerScope !== 'table') {\n\t\t\t\treturn (\n\t\t\t\t\t<table {...attributes}>\n\t\t\t\t\t\t<tbody>{children}</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<table {...attributes}>\n\t\t\t\t\t<thead>{renderChildren<CustomElements, CustomLeaves>([firstRow], options, block)}</thead>\n\t\t\t\t\t<tbody>{renderChildren<CustomElements, CustomLeaves>(element.children.slice(1) as any, options, block)}</tbody>\n\t\t\t\t</table>\n\t\t\t)\n\t\t}\n\t\tcase 'tableRow':\n\t\t\treturn <tr {...attributes}>{children}</tr>\n\t\tcase 'tableCell': {\n\t\t\tif (element.headerScope) {\n\t\t\t\treturn (\n\t\t\t\t\t<th {...attributes} scope={element.headerScope}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</th>\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn <td {...attributes}>{children}</td>\n\t\t}\n\t\tcase 'unorderedList':\n\t\t\treturn <ul {...attributes}>{children}</ul>\n\t\tdefault: {\n\t\t\tif (import.meta.env.DEV) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`RichTextRenderer: unknown element of type '${(element as { type: string }).type}'.`,\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\treturn children // At least render the text contents\n\t\t\t}\n\t\t}\n\t}\n}\n\ntype ReferenceElementFallbackProps<CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf> = {\n\telement: RichTextReferenceElement<CustomElements, CustomLeaves>\n\tchildren: ReactElement\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n}\n\nfunction ReferenceElementFallback<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({ element, children, options, block }: ReferenceElementFallbackProps<CustomElements, CustomLeaves>) {\n\tconst elementMetadata = useReferenceMetadata<CustomElements, CustomLeaves>(element, options, block, true)\n\n\tif (\n\t\telementMetadata.referenceRenderer === undefined\n\t\t|| elementMetadata.referenceType === undefined\n\t\t|| elementMetadata.reference === undefined\n\t) {\n\t\treturn children // At least render the text contents\n\t}\n\n\tlet Renderer = elementMetadata.referenceRenderer\n\treturn (\n\t\t<>\n\t\t\t<Renderer\n\t\t\t\treferenceType={elementMetadata.referenceType}\n\t\t\t\treferenceRenderer={elementMetadata.referenceRenderer}\n\t\t\t\treference={elementMetadata.reference}\n\t\t\t\tformatVersion={block.content.formatVersion}\n\t\t\t\tblock={block}\n\t\t\t\toptions={options}\n\t\t\t\telement={element}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Renderer>\n\t\t</>\n\t)\n}\n"],"names":["createElement","jsx","jsxs","renderChildren","useReferenceMetadata","Fragment"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"RenderElementFallback.js","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx"],"sourcesContent":["import { createElement, ReactElement } from 'react'\nimport type { BuiltinElements, RichTextReferenceElement, RichTextTableRowElement } from '../../types/builtin/BuiltinElements'\nimport { renderChildren } from '../renderChildren'\nimport { useReferenceMetadata } from '../useReferenceMetadata'\nimport type { RichTextElement } from '../../types/structure/RichTextElement'\nimport type { RichTextLeaf } from '../../types/structure/RichTextLeaf'\nimport { RichTextRendererError } from '../../RichTextRendererError'\nimport { RichTextBlock } from '../../types/RichTextBlock'\nimport { RichTextRenderingOptions } from '../../types/RichTextRenderingOptions'\n\nexport interface RenderElementFallbackProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> {\n\telement: BuiltinElements<CustomElements, CustomLeaves>\n\tchildren: ReactElement\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n}\n\nconst getElementDataAttributes = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(\n\telement: RichTextElement<CustomElements, CustomLeaves>,\n\tattributeNamePrefix: string = 'contember-',\n): {\n\t[dataAttribute: string]: string | number | boolean\n} => {\n\tconst { children, referenceId, ...extendedSpecifics } = element\n\n\treturn Object.fromEntries(\n\t\tObject.entries(extendedSpecifics)\n\t\t\t.filter(([, value]) => {\n\t\t\t\tconst t = typeof value\n\t\t\t\treturn t === 'string' || t === 'number' || t === 'boolean'\n\t\t\t})\n\t\t\t.map(([attribute, value]) => [`data-${attributeNamePrefix}${attribute.toLowerCase()}`, value]),\n\t)\n}\n\nexport function RenderElementFallback<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({ element, children, options, block }: RenderElementFallbackProps<CustomElements, CustomLeaves>) {\n\tconst attributes = getElementDataAttributes(element, options.attributeNamePrefix)\n\n\tswitch (element.type) {\n\t\tcase 'anchor':\n\t\t\treturn (\n\t\t\t\t<a {...attributes} href={element.href}>\n\t\t\t\t\t{children}\n\t\t\t\t</a>\n\t\t\t)\n\t\tcase 'heading':\n\t\t\treturn createElement(`h${element.level}`, attributes, children) // TODO numbered\n\t\tcase 'horizontalRule':\n\t\t\treturn <hr {...attributes} />\n\t\tcase 'listItem':\n\t\t\treturn <li {...attributes}>{children}</li>\n\t\tcase 'orderedList':\n\t\t\treturn <ol {...attributes}>{children}</ol>\n\t\tcase 'paragraph':\n\t\t\treturn <p {...attributes}>{children}</p>\n\t\tcase 'reference': {\n\t\t\treturn <ReferenceElementFallback element={element} children={children} options={options} block={block} />\n\t\t}\n\t\tcase 'scrollTarget':\n\t\t\treturn (\n\t\t\t\t<span {...attributes} id={element.identifier}>\n\t\t\t\t\t{children}\n\t\t\t\t</span>\n\t\t\t)\n\t\tcase 'table': {\n\t\t\tconst firstRow = element.children[0] as RichTextTableRowElement<CustomElements, CustomLeaves> | undefined\n\t\t\tif (!firstRow || firstRow.headerScope !== 'table') {\n\t\t\t\treturn (\n\t\t\t\t\t<table {...attributes}>\n\t\t\t\t\t\t<tbody>{children}</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<table {...attributes}>\n\t\t\t\t\t<thead>{renderChildren<CustomElements, CustomLeaves>([firstRow], options, block)}</thead>\n\t\t\t\t\t<tbody>{renderChildren<CustomElements, CustomLeaves>(element.children.slice(1) as any, options, block)}</tbody>\n\t\t\t\t</table>\n\t\t\t)\n\t\t}\n\t\tcase 'tableRow':\n\t\t\treturn <tr {...attributes}>{children}</tr>\n\t\tcase 'tableCell': {\n\t\t\tif (element.headerScope) {\n\t\t\t\treturn (\n\t\t\t\t\t<th {...attributes} scope={element.headerScope}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</th>\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn <td {...attributes}>{children}</td>\n\t\t}\n\t\tcase 'unorderedList':\n\t\t\treturn <ul {...attributes}>{children}</ul>\n\t\tdefault: {\n\t\t\tif (import.meta.env.DEV) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`RichTextRenderer: unknown element of type '${(element as { type: string }).type}'.`,\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\treturn children // At least render the text contents\n\t\t\t}\n\t\t}\n\t}\n}\n\ntype ReferenceElementFallbackProps<CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf> = {\n\telement: RichTextReferenceElement<CustomElements, CustomLeaves>\n\tchildren: ReactElement\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n}\n\nfunction ReferenceElementFallback<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({ element, children, options, block }: ReferenceElementFallbackProps<CustomElements, CustomLeaves>) {\n\tconst elementMetadata = useReferenceMetadata<CustomElements, CustomLeaves>(element, options, block, true)\n\n\tif (\n\t\telementMetadata.referenceRenderer === undefined\n\t\t|| elementMetadata.referenceType === undefined\n\t\t|| elementMetadata.reference === undefined\n\t) {\n\t\treturn children // At least render the text contents\n\t}\n\n\tlet Renderer = elementMetadata.referenceRenderer\n\treturn (\n\t\t<>\n\t\t\t<Renderer\n\t\t\t\treferenceType={elementMetadata.referenceType}\n\t\t\t\treferenceRenderer={elementMetadata.referenceRenderer}\n\t\t\t\treference={elementMetadata.reference}\n\t\t\t\tformatVersion={block.content.formatVersion}\n\t\t\t\tblock={block}\n\t\t\t\toptions={options}\n\t\t\t\telement={element}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Renderer>\n\t\t</>\n\t)\n}\n"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"RenderElementFallback.js","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/RenderElementFallback.tsx"],"sourcesContent":["import { createElement, ReactElement } from 'react'\nimport type { BuiltinElements, RichTextReferenceElement, RichTextTableRowElement } from '../../types/builtin/BuiltinElements.js'\nimport { renderChildren } from '../renderChildren.js'\nimport { useReferenceMetadata } from '../useReferenceMetadata.js'\nimport type { RichTextElement } from '../../types/structure/RichTextElement.js'\nimport type { RichTextLeaf } from '../../types/structure/RichTextLeaf.js'\nimport { RichTextRendererError } from '../../RichTextRendererError.js'\nimport { RichTextBlock } from '../../types/RichTextBlock.js'\nimport { RichTextRenderingOptions } from '../../types/RichTextRenderingOptions.js'\n\nexport interface RenderElementFallbackProps<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n> {\n\telement: BuiltinElements<CustomElements, CustomLeaves>\n\tchildren: ReactElement\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n}\n\nconst getElementDataAttributes = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(\n\telement: RichTextElement<CustomElements, CustomLeaves>,\n\tattributeNamePrefix: string = 'contember-',\n): {\n\t[dataAttribute: string]: string | number | boolean\n} => {\n\tconst { children, referenceId, ...extendedSpecifics } = element\n\n\treturn Object.fromEntries(\n\t\tObject.entries(extendedSpecifics)\n\t\t\t.filter(([, value]) => {\n\t\t\t\tconst t = typeof value\n\t\t\t\treturn t === 'string' || t === 'number' || t === 'boolean'\n\t\t\t})\n\t\t\t.map(([attribute, value]) => [`data-${attributeNamePrefix}${attribute.toLowerCase()}`, value]),\n\t)\n}\n\nexport function RenderElementFallback<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({ element, children, options, block }: RenderElementFallbackProps<CustomElements, CustomLeaves>) {\n\tconst attributes = getElementDataAttributes(element, options.attributeNamePrefix)\n\n\tswitch (element.type) {\n\t\tcase 'anchor':\n\t\t\treturn (\n\t\t\t\t<a {...attributes} href={element.href}>\n\t\t\t\t\t{children}\n\t\t\t\t</a>\n\t\t\t)\n\t\tcase 'heading':\n\t\t\treturn createElement(`h${element.level}`, attributes, children) // TODO numbered\n\t\tcase 'horizontalRule':\n\t\t\treturn <hr {...attributes} />\n\t\tcase 'listItem':\n\t\t\treturn <li {...attributes}>{children}</li>\n\t\tcase 'orderedList':\n\t\t\treturn <ol {...attributes}>{children}</ol>\n\t\tcase 'paragraph':\n\t\t\treturn <p {...attributes}>{children}</p>\n\t\tcase 'reference': {\n\t\t\treturn <ReferenceElementFallback element={element} children={children} options={options} block={block} />\n\t\t}\n\t\tcase 'scrollTarget':\n\t\t\treturn (\n\t\t\t\t<span {...attributes} id={element.identifier}>\n\t\t\t\t\t{children}\n\t\t\t\t</span>\n\t\t\t)\n\t\tcase 'table': {\n\t\t\tconst firstRow = element.children[0] as RichTextTableRowElement<CustomElements, CustomLeaves> | undefined\n\t\t\tif (!firstRow || firstRow.headerScope !== 'table') {\n\t\t\t\treturn (\n\t\t\t\t\t<table {...attributes}>\n\t\t\t\t\t\t<tbody>{children}</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<table {...attributes}>\n\t\t\t\t\t<thead>{renderChildren<CustomElements, CustomLeaves>([firstRow], options, block)}</thead>\n\t\t\t\t\t<tbody>{renderChildren<CustomElements, CustomLeaves>(element.children.slice(1) as any, options, block)}</tbody>\n\t\t\t\t</table>\n\t\t\t)\n\t\t}\n\t\tcase 'tableRow':\n\t\t\treturn <tr {...attributes}>{children}</tr>\n\t\tcase 'tableCell': {\n\t\t\tif (element.headerScope) {\n\t\t\t\treturn (\n\t\t\t\t\t<th {...attributes} scope={element.headerScope}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</th>\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn <td {...attributes}>{children}</td>\n\t\t}\n\t\tcase 'unorderedList':\n\t\t\treturn <ul {...attributes}>{children}</ul>\n\t\tdefault: {\n\t\t\tif (import.meta.env.DEV) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`RichTextRenderer: unknown element of type '${(element as { type: string }).type}'.`,\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\treturn children // At least render the text contents\n\t\t\t}\n\t\t}\n\t}\n}\n\ntype ReferenceElementFallbackProps<CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf> = {\n\telement: RichTextReferenceElement<CustomElements, CustomLeaves>\n\tchildren: ReactElement\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>\n\tblock: RichTextBlock<CustomElements, CustomLeaves>\n}\n\nfunction ReferenceElementFallback<\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>({ element, children, options, block }: ReferenceElementFallbackProps<CustomElements, CustomLeaves>) {\n\tconst elementMetadata = useReferenceMetadata<CustomElements, CustomLeaves>(element, options, block, true)\n\n\tif (\n\t\telementMetadata.referenceRenderer === undefined\n\t\t|| elementMetadata.referenceType === undefined\n\t\t|| elementMetadata.reference === undefined\n\t) {\n\t\treturn children // At least render the text contents\n\t}\n\n\tlet Renderer = elementMetadata.referenceRenderer\n\treturn (\n\t\t<>\n\t\t\t<Renderer\n\t\t\t\treferenceType={elementMetadata.referenceType}\n\t\t\t\treferenceRenderer={elementMetadata.referenceRenderer}\n\t\t\t\treference={elementMetadata.reference}\n\t\t\t\tformatVersion={block.content.formatVersion}\n\t\t\t\tblock={block}\n\t\t\t\toptions={options}\n\t\t\t\telement={element}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Renderer>\n\t\t</>\n\t)\n}\n"],"names":[],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"RenderLeafFallback.cjs","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/RenderLeafFallback.tsx"],"sourcesContent":["import { Fragment, ReactNode } from 'react'\nimport type { BuiltinLeaves } from '../../types/builtin/BuiltinLeaves'\n\nexport interface RenderLeafFallbackProps {\n\tleaf: BuiltinLeaves\n}\n\nfunction jsxN2br(text: string): ReactNode {\n\tconst lines = text.split('\\n')\n\tif (lines.length <= 1) {\n\t\treturn text\n\t}\n\treturn lines.map((line, i) => (\n\t\t<Fragment key={i}>\n\t\t\t{!!i && <br />}\n\t\t\t{line}\n\t\t</Fragment>\n\t))\n}\n\nexport function RenderLeafFallback({ leaf }: RenderLeafFallbackProps) {\n\tlet element = jsxN2br(leaf.text)\n\n\tif ('isCode' in leaf && leaf.isCode === true) {\n\t\telement = <code>{element}</code>\n\t}\n\tif ('isStruckThrough' in leaf && leaf.isStruckThrough === true) {\n\t\telement = <s>{element}</s>\n\t}\n\tif ('isHighlighted' in leaf && leaf.isHighlighted === true) {\n\t\telement = <em>{element}</em>\n\t}\n\tif ('isUnderlined' in leaf && leaf.isUnderlined === true) {\n\t\telement = <u>{element}</u>\n\t}\n\tif ('isItalic' in leaf && leaf.isItalic === true) {\n\t\telement = <i>{element}</i>\n\t}\n\tif ('isBold' in leaf && leaf.isBold === true) {\n\t\telement = <b>{element}</b>\n\t}\n\treturn <>{element}</>\n}\n"],"names":["jsxs","Fragment","jsx"],"mappings":";;;;AAOA,SAAS,QAAQ,MAAyB;AACzC,QAAM,QAAQ,KAAK,MAAM,IAAI;AAC7B,MAAI,MAAM,UAAU,GAAG;AACtB,WAAO;AAAA,EACR;AACA,SAAO,MAAM,IAAI,CAAC,MAAM,MACvBA,gCAACC,MAAAA,UAAA,EACC,UAAA;AAAA,IAAA,CAAC,CAAC,KAAKC,+BAAC,MAAA,CAAA,CAAG;AAAA,IACX;AAAA,EAAA,EAAA,GAFa,CAGf,CACA;AACF;AAEO,SAAS,mBAAmB,EAAE,QAAiC;AACrE,MAAI,UAAU,QAAQ,KAAK,IAAI;AAE/B,MAAI,YAAY,QAAQ,KAAK,WAAW,MAAM;AAC7C,cAAUA,2BAAAA,IAAC,UAAM,UAAA,QAAA,CAAQ;AAAA,EAC1B;AACA,MAAI,qBAAqB,QAAQ,KAAK,oBAAoB,MAAM;AAC/D,cAAUA,2BAAAA,IAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,MAAI,mBAAmB,QAAQ,KAAK,kBAAkB,MAAM;AAC3D,cAAUA,2BAAAA,IAAC,QAAI,UAAA,QAAA,CAAQ;AAAA,EACxB;AACA,MAAI,kBAAkB,QAAQ,KAAK,iBAAiB,MAAM;AACzD,cAAUA,2BAAAA,IAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,MAAI,cAAc,QAAQ,KAAK,aAAa,MAAM;AACjD,cAAUA,2BAAAA,IAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,MAAI,YAAY,QAAQ,KAAK,WAAW,MAAM;AAC7C,cAAUA,2BAAAA,IAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,+DAAU,UAAA,QAAA,CAAQ;AACnB;;"}
1
+ {"version":3,"file":"RenderLeafFallback.cjs","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/RenderLeafFallback.tsx"],"sourcesContent":["import { Fragment, ReactNode } from 'react'\nimport type { BuiltinLeaves } from '../../types/builtin/BuiltinLeaves.js'\n\nexport interface RenderLeafFallbackProps {\n\tleaf: BuiltinLeaves\n}\n\nfunction jsxN2br(text: string): ReactNode {\n\tconst lines = text.split('\\n')\n\tif (lines.length <= 1) {\n\t\treturn text\n\t}\n\treturn lines.map((line, i) => (\n\t\t<Fragment key={i}>\n\t\t\t{!!i && <br />}\n\t\t\t{line}\n\t\t</Fragment>\n\t))\n}\n\nexport function RenderLeafFallback({ leaf }: RenderLeafFallbackProps) {\n\tlet element = jsxN2br(leaf.text)\n\n\tif ('isCode' in leaf && leaf.isCode === true) {\n\t\telement = <code>{element}</code>\n\t}\n\tif ('isStruckThrough' in leaf && leaf.isStruckThrough === true) {\n\t\telement = <s>{element}</s>\n\t}\n\tif ('isHighlighted' in leaf && leaf.isHighlighted === true) {\n\t\telement = <em>{element}</em>\n\t}\n\tif ('isUnderlined' in leaf && leaf.isUnderlined === true) {\n\t\telement = <u>{element}</u>\n\t}\n\tif ('isItalic' in leaf && leaf.isItalic === true) {\n\t\telement = <i>{element}</i>\n\t}\n\tif ('isBold' in leaf && leaf.isBold === true) {\n\t\telement = <b>{element}</b>\n\t}\n\treturn <>{element}</>\n}\n"],"names":["jsxs","Fragment","jsx"],"mappings":";;;;AAOA,SAAS,QAAQ,MAAyB;AACzC,QAAM,QAAQ,KAAK,MAAM,IAAI;AAC7B,MAAI,MAAM,UAAU,GAAG;AACtB,WAAO;AAAA,EACR;AACA,SAAO,MAAM,IAAI,CAAC,MAAM,MACvBA,gCAACC,MAAAA,UAAA,EACC,UAAA;AAAA,IAAA,CAAC,CAAC,KAAKC,+BAAC,MAAA,CAAA,CAAG;AAAA,IACX;AAAA,EAAA,EAAA,GAFa,CAGf,CACA;AACF;AAEO,SAAS,mBAAmB,EAAE,QAAiC;AACrE,MAAI,UAAU,QAAQ,KAAK,IAAI;AAE/B,MAAI,YAAY,QAAQ,KAAK,WAAW,MAAM;AAC7C,cAAUA,2BAAAA,IAAC,UAAM,UAAA,QAAA,CAAQ;AAAA,EAC1B;AACA,MAAI,qBAAqB,QAAQ,KAAK,oBAAoB,MAAM;AAC/D,cAAUA,2BAAAA,IAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,MAAI,mBAAmB,QAAQ,KAAK,kBAAkB,MAAM;AAC3D,cAAUA,2BAAAA,IAAC,QAAI,UAAA,QAAA,CAAQ;AAAA,EACxB;AACA,MAAI,kBAAkB,QAAQ,KAAK,iBAAiB,MAAM;AACzD,cAAUA,2BAAAA,IAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,MAAI,cAAc,QAAQ,KAAK,aAAa,MAAM;AACjD,cAAUA,2BAAAA,IAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,MAAI,YAAY,QAAQ,KAAK,WAAW,MAAM;AAC7C,cAAUA,2BAAAA,IAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,+DAAU,UAAA,QAAA,CAAQ;AACnB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RenderLeafFallback.js","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/RenderLeafFallback.tsx"],"sourcesContent":["import { Fragment, ReactNode } from 'react'\nimport type { BuiltinLeaves } from '../../types/builtin/BuiltinLeaves'\n\nexport interface RenderLeafFallbackProps {\n\tleaf: BuiltinLeaves\n}\n\nfunction jsxN2br(text: string): ReactNode {\n\tconst lines = text.split('\\n')\n\tif (lines.length <= 1) {\n\t\treturn text\n\t}\n\treturn lines.map((line, i) => (\n\t\t<Fragment key={i}>\n\t\t\t{!!i && <br />}\n\t\t\t{line}\n\t\t</Fragment>\n\t))\n}\n\nexport function RenderLeafFallback({ leaf }: RenderLeafFallbackProps) {\n\tlet element = jsxN2br(leaf.text)\n\n\tif ('isCode' in leaf && leaf.isCode === true) {\n\t\telement = <code>{element}</code>\n\t}\n\tif ('isStruckThrough' in leaf && leaf.isStruckThrough === true) {\n\t\telement = <s>{element}</s>\n\t}\n\tif ('isHighlighted' in leaf && leaf.isHighlighted === true) {\n\t\telement = <em>{element}</em>\n\t}\n\tif ('isUnderlined' in leaf && leaf.isUnderlined === true) {\n\t\telement = <u>{element}</u>\n\t}\n\tif ('isItalic' in leaf && leaf.isItalic === true) {\n\t\telement = <i>{element}</i>\n\t}\n\tif ('isBold' in leaf && leaf.isBold === true) {\n\t\telement = <b>{element}</b>\n\t}\n\treturn <>{element}</>\n}\n"],"names":["Fragment"],"mappings":";;AAOA,SAAS,QAAQ,MAAyB;AACzC,QAAM,QAAQ,KAAK,MAAM,IAAI;AAC7B,MAAI,MAAM,UAAU,GAAG;AACtB,WAAO;AAAA,EACR;AACA,SAAO,MAAM,IAAI,CAAC,MAAM,MACvB,qBAACA,YAAA,EACC,UAAA;AAAA,IAAA,CAAC,CAAC,KAAK,oBAAC,MAAA,CAAA,CAAG;AAAA,IACX;AAAA,EAAA,EAAA,GAFa,CAGf,CACA;AACF;AAEO,SAAS,mBAAmB,EAAE,QAAiC;AACrE,MAAI,UAAU,QAAQ,KAAK,IAAI;AAE/B,MAAI,YAAY,QAAQ,KAAK,WAAW,MAAM;AAC7C,cAAU,oBAAC,UAAM,UAAA,QAAA,CAAQ;AAAA,EAC1B;AACA,MAAI,qBAAqB,QAAQ,KAAK,oBAAoB,MAAM;AAC/D,cAAU,oBAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,MAAI,mBAAmB,QAAQ,KAAK,kBAAkB,MAAM;AAC3D,cAAU,oBAAC,QAAI,UAAA,QAAA,CAAQ;AAAA,EACxB;AACA,MAAI,kBAAkB,QAAQ,KAAK,iBAAiB,MAAM;AACzD,cAAU,oBAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,MAAI,cAAc,QAAQ,KAAK,aAAa,MAAM;AACjD,cAAU,oBAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,MAAI,YAAY,QAAQ,KAAK,WAAW,MAAM;AAC7C,cAAU,oBAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,yCAAU,UAAA,QAAA,CAAQ;AACnB;"}
1
+ {"version":3,"file":"RenderLeafFallback.js","sources":["../../../../../../packages/react-richtext-renderer/src/internal/components/RenderLeafFallback.tsx"],"sourcesContent":["import { Fragment, ReactNode } from 'react'\nimport type { BuiltinLeaves } from '../../types/builtin/BuiltinLeaves.js'\n\nexport interface RenderLeafFallbackProps {\n\tleaf: BuiltinLeaves\n}\n\nfunction jsxN2br(text: string): ReactNode {\n\tconst lines = text.split('\\n')\n\tif (lines.length <= 1) {\n\t\treturn text\n\t}\n\treturn lines.map((line, i) => (\n\t\t<Fragment key={i}>\n\t\t\t{!!i && <br />}\n\t\t\t{line}\n\t\t</Fragment>\n\t))\n}\n\nexport function RenderLeafFallback({ leaf }: RenderLeafFallbackProps) {\n\tlet element = jsxN2br(leaf.text)\n\n\tif ('isCode' in leaf && leaf.isCode === true) {\n\t\telement = <code>{element}</code>\n\t}\n\tif ('isStruckThrough' in leaf && leaf.isStruckThrough === true) {\n\t\telement = <s>{element}</s>\n\t}\n\tif ('isHighlighted' in leaf && leaf.isHighlighted === true) {\n\t\telement = <em>{element}</em>\n\t}\n\tif ('isUnderlined' in leaf && leaf.isUnderlined === true) {\n\t\telement = <u>{element}</u>\n\t}\n\tif ('isItalic' in leaf && leaf.isItalic === true) {\n\t\telement = <i>{element}</i>\n\t}\n\tif ('isBold' in leaf && leaf.isBold === true) {\n\t\telement = <b>{element}</b>\n\t}\n\treturn <>{element}</>\n}\n"],"names":["Fragment"],"mappings":";;AAOA,SAAS,QAAQ,MAAyB;AACzC,QAAM,QAAQ,KAAK,MAAM,IAAI;AAC7B,MAAI,MAAM,UAAU,GAAG;AACtB,WAAO;AAAA,EACR;AACA,SAAO,MAAM,IAAI,CAAC,MAAM,MACvB,qBAACA,YAAA,EACC,UAAA;AAAA,IAAA,CAAC,CAAC,KAAK,oBAAC,MAAA,CAAA,CAAG;AAAA,IACX;AAAA,EAAA,EAAA,GAFa,CAGf,CACA;AACF;AAEO,SAAS,mBAAmB,EAAE,QAAiC;AACrE,MAAI,UAAU,QAAQ,KAAK,IAAI;AAE/B,MAAI,YAAY,QAAQ,KAAK,WAAW,MAAM;AAC7C,cAAU,oBAAC,UAAM,UAAA,QAAA,CAAQ;AAAA,EAC1B;AACA,MAAI,qBAAqB,QAAQ,KAAK,oBAAoB,MAAM;AAC/D,cAAU,oBAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,MAAI,mBAAmB,QAAQ,KAAK,kBAAkB,MAAM;AAC3D,cAAU,oBAAC,QAAI,UAAA,QAAA,CAAQ;AAAA,EACxB;AACA,MAAI,kBAAkB,QAAQ,KAAK,iBAAiB,MAAM;AACzD,cAAU,oBAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,MAAI,cAAc,QAAQ,KAAK,aAAa,MAAM;AACjD,cAAU,oBAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,MAAI,YAAY,QAAQ,KAAK,WAAW,MAAM;AAC7C,cAAU,oBAAC,OAAG,UAAA,QAAA,CAAQ;AAAA,EACvB;AACA,yCAAU,UAAA,QAAA,CAAQ;AACnB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaultDeserialize.cjs","sources":["../../../../../packages/react-richtext-renderer/src/internal/defaultDeserialize.ts"],"sourcesContent":["import type { RichTextElement } from '../types/structure/RichTextElement'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf'\nimport type { RootEditorNode } from '../types/structure/RootEditorNode'\n\nexport const defaultDeserialize = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(\n\tsource: string,\n): RootEditorNode<CustomElements, CustomLeaves> => {\n\ttry {\n\t\treturn JSON.parse(source)\n\t} catch (e) {\n\t\treturn {\n\t\t\tformatVersion: 0,\n\t\t\tchildren: [],\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAIO,MAAM,qBAAqB,CAIjC,WACkD;AAClD,MAAI;AACH,WAAO,KAAK,MAAM,MAAM;AAAA,EACzB,SAAS,GAAG;AACX,WAAO;AAAA,MACN,eAAe;AAAA,MACf,UAAU,CAAA;AAAA,IAAC;AAAA,EAEb;AACD;;"}
1
+ {"version":3,"file":"defaultDeserialize.cjs","sources":["../../../../../packages/react-richtext-renderer/src/internal/defaultDeserialize.ts"],"sourcesContent":["import type { RichTextElement } from '../types/structure/RichTextElement.js'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf.js'\nimport type { RootEditorNode } from '../types/structure/RootEditorNode.js'\n\nexport const defaultDeserialize = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(\n\tsource: string,\n): RootEditorNode<CustomElements, CustomLeaves> => {\n\ttry {\n\t\treturn JSON.parse(source)\n\t} catch (e) {\n\t\treturn {\n\t\t\tformatVersion: 0,\n\t\t\tchildren: [],\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAIO,MAAM,qBAAqB,CAIjC,WACkD;AAClD,MAAI;AACH,WAAO,KAAK,MAAM,MAAM;AAAA,EACzB,SAAS,GAAG;AACX,WAAO;AAAA,MACN,eAAe;AAAA,MACf,UAAU,CAAA;AAAA,IAAC;AAAA,EAEb;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaultDeserialize.js","sources":["../../../../../packages/react-richtext-renderer/src/internal/defaultDeserialize.ts"],"sourcesContent":["import type { RichTextElement } from '../types/structure/RichTextElement'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf'\nimport type { RootEditorNode } from '../types/structure/RootEditorNode'\n\nexport const defaultDeserialize = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(\n\tsource: string,\n): RootEditorNode<CustomElements, CustomLeaves> => {\n\ttry {\n\t\treturn JSON.parse(source)\n\t} catch (e) {\n\t\treturn {\n\t\t\tformatVersion: 0,\n\t\t\tchildren: [],\n\t\t}\n\t}\n}\n"],"names":[],"mappings":"AAIO,MAAM,qBAAqB,CAIjC,WACkD;AAClD,MAAI;AACH,WAAO,KAAK,MAAM,MAAM;AAAA,EACzB,SAAS,GAAG;AACX,WAAO;AAAA,MACN,eAAe;AAAA,MACf,UAAU,CAAA;AAAA,IAAC;AAAA,EAEb;AACD;"}
1
+ {"version":3,"file":"defaultDeserialize.js","sources":["../../../../../packages/react-richtext-renderer/src/internal/defaultDeserialize.ts"],"sourcesContent":["import type { RichTextElement } from '../types/structure/RichTextElement.js'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf.js'\nimport type { RootEditorNode } from '../types/structure/RootEditorNode.js'\n\nexport const defaultDeserialize = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(\n\tsource: string,\n): RootEditorNode<CustomElements, CustomLeaves> => {\n\ttry {\n\t\treturn JSON.parse(source)\n\t} catch (e) {\n\t\treturn {\n\t\t\tformatVersion: 0,\n\t\t\tchildren: [],\n\t\t}\n\t}\n}\n"],"names":[],"mappings":"AAIO,MAAM,qBAAqB,CAIjC,WACkD;AAClD,MAAI;AACH,WAAO,KAAK,MAAM,MAAM;AAAA,EACzB,SAAS,GAAG;AACX,WAAO;AAAA,MACN,eAAe;AAAA,MACf,UAAU,CAAA;AAAA,IAAC;AAAA,EAEb;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"renderChildren.cjs","sources":["../../../../../packages/react-richtext-renderer/src/internal/renderChildren.tsx"],"sourcesContent":["import type { ReactElement } from 'react'\nimport { ElementRenderer } from './components/ElementRenderer'\nimport { LeafRenderer } from './components/LeafRenderer'\nimport type { RichTextElement } from '../types/structure/RichTextElement'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf'\nimport { RichTextRenderingOptions } from '../types/RichTextRenderingOptions'\nimport { RichTextBlock } from '../types/RichTextBlock'\nimport { RichTextChild } from '../types/structure/RichTextChild'\n\nexport const renderChildren = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(\n\tchildren:\n\t\t| RichTextChild<CustomElements, CustomLeaves>\n\t\t| readonly RichTextChild<CustomElements, CustomLeaves>[],\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>,\n\tblock: RichTextBlock<CustomElements, CustomLeaves>,\n): ReactElement => {\n\treturn (\n\t\t<>\n\t\t\t{(Array.isArray(children) ? children : [children]).map((child, i) => {\n\t\t\t\tif ('text' in child) {\n\t\t\t\t\treturn <LeafRenderer<CustomElements, CustomLeaves> key={i} leaf={child} options={options} block={block} />\n\t\t\t\t}\n\t\t\t\tif ('children' in child) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ElementRenderer<CustomElements, CustomLeaves> key={i} element={child} options={options} block={block}>\n\t\t\t\t\t\t\t{renderChildren<CustomElements, CustomLeaves>(child.children as typeof children, options, block)}\n\t\t\t\t\t\t</ElementRenderer>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn null // Throw?\n\t\t\t})}\n\t\t</>\n\t)\n}\n"],"names":["jsx","Fragment","LeafRenderer","ElementRenderer"],"mappings":";;;;;AASO,MAAM,iBAAiB,CAI7B,UAGA,SACA,UACkB;AAClB,SACCA,2BAAAA,IAAAC,WAAAA,UAAA,EACG,WAAA,MAAM,QAAQ,QAAQ,IAAI,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,MAAM;AACpE,QAAI,UAAU,OAAO;AACpB,4CAAQC,aAAAA,cAAA,EAAmD,MAAM,OAAO,SAAkB,SAAlC,CAAgD;AAAA,IACzG;AACA,QAAI,cAAc,OAAO;AACxB,aACCF,2BAAAA,IAACG,gBAAAA,iBAAA,EAAsD,SAAS,OAAO,SAAkB,OACvF,UAAA,eAA6C,MAAM,UAA6B,SAAS,KAAK,EAAA,GAD5C,CAEpD;AAAA,IAEF;AACA,WAAO;AAAA,EACR,CAAC,EAAA,CACF;AAEF;;"}
1
+ {"version":3,"file":"renderChildren.cjs","sources":["../../../../../packages/react-richtext-renderer/src/internal/renderChildren.tsx"],"sourcesContent":["import type { ReactElement } from 'react'\nimport { ElementRenderer } from './components/ElementRenderer.js'\nimport { LeafRenderer } from './components/LeafRenderer.js'\nimport type { RichTextElement } from '../types/structure/RichTextElement.js'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf.js'\nimport { RichTextRenderingOptions } from '../types/RichTextRenderingOptions.js'\nimport { RichTextBlock } from '../types/RichTextBlock.js'\nimport { RichTextChild } from '../types/structure/RichTextChild.js'\n\nexport const renderChildren = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(\n\tchildren:\n\t\t| RichTextChild<CustomElements, CustomLeaves>\n\t\t| readonly RichTextChild<CustomElements, CustomLeaves>[],\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>,\n\tblock: RichTextBlock<CustomElements, CustomLeaves>,\n): ReactElement => {\n\treturn (\n\t\t<>\n\t\t\t{(Array.isArray(children) ? children : [children]).map((child, i) => {\n\t\t\t\tif ('text' in child) {\n\t\t\t\t\treturn <LeafRenderer<CustomElements, CustomLeaves> key={i} leaf={child} options={options} block={block} />\n\t\t\t\t}\n\t\t\t\tif ('children' in child) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ElementRenderer<CustomElements, CustomLeaves> key={i} element={child} options={options} block={block}>\n\t\t\t\t\t\t\t{renderChildren<CustomElements, CustomLeaves>(child.children as typeof children, options, block)}\n\t\t\t\t\t\t</ElementRenderer>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn null // Throw?\n\t\t\t})}\n\t\t</>\n\t)\n}\n"],"names":["jsx","Fragment","LeafRenderer","ElementRenderer"],"mappings":";;;;;AASO,MAAM,iBAAiB,CAI7B,UAGA,SACA,UACkB;AAClB,SACCA,2BAAAA,IAAAC,WAAAA,UAAA,EACG,WAAA,MAAM,QAAQ,QAAQ,IAAI,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,MAAM;AACpE,QAAI,UAAU,OAAO;AACpB,4CAAQC,aAAAA,cAAA,EAAmD,MAAM,OAAO,SAAkB,SAAlC,CAAgD;AAAA,IACzG;AACA,QAAI,cAAc,OAAO;AACxB,aACCF,2BAAAA,IAACG,gBAAAA,iBAAA,EAAsD,SAAS,OAAO,SAAkB,OACvF,UAAA,eAA6C,MAAM,UAA6B,SAAS,KAAK,EAAA,GAD5C,CAEpD;AAAA,IAEF;AACA,WAAO;AAAA,EACR,CAAC,EAAA,CACF;AAEF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"renderChildren.js","sources":["../../../../../packages/react-richtext-renderer/src/internal/renderChildren.tsx"],"sourcesContent":["import type { ReactElement } from 'react'\nimport { ElementRenderer } from './components/ElementRenderer'\nimport { LeafRenderer } from './components/LeafRenderer'\nimport type { RichTextElement } from '../types/structure/RichTextElement'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf'\nimport { RichTextRenderingOptions } from '../types/RichTextRenderingOptions'\nimport { RichTextBlock } from '../types/RichTextBlock'\nimport { RichTextChild } from '../types/structure/RichTextChild'\n\nexport const renderChildren = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(\n\tchildren:\n\t\t| RichTextChild<CustomElements, CustomLeaves>\n\t\t| readonly RichTextChild<CustomElements, CustomLeaves>[],\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>,\n\tblock: RichTextBlock<CustomElements, CustomLeaves>,\n): ReactElement => {\n\treturn (\n\t\t<>\n\t\t\t{(Array.isArray(children) ? children : [children]).map((child, i) => {\n\t\t\t\tif ('text' in child) {\n\t\t\t\t\treturn <LeafRenderer<CustomElements, CustomLeaves> key={i} leaf={child} options={options} block={block} />\n\t\t\t\t}\n\t\t\t\tif ('children' in child) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ElementRenderer<CustomElements, CustomLeaves> key={i} element={child} options={options} block={block}>\n\t\t\t\t\t\t\t{renderChildren<CustomElements, CustomLeaves>(child.children as typeof children, options, block)}\n\t\t\t\t\t\t</ElementRenderer>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn null // Throw?\n\t\t\t})}\n\t\t</>\n\t)\n}\n"],"names":[],"mappings":";;;AASO,MAAM,iBAAiB,CAI7B,UAGA,SACA,UACkB;AAClB,SACC,oBAAA,UAAA,EACG,WAAA,MAAM,QAAQ,QAAQ,IAAI,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,MAAM;AACpE,QAAI,UAAU,OAAO;AACpB,iCAAQ,cAAA,EAAmD,MAAM,OAAO,SAAkB,SAAlC,CAAgD;AAAA,IACzG;AACA,QAAI,cAAc,OAAO;AACxB,aACC,oBAAC,iBAAA,EAAsD,SAAS,OAAO,SAAkB,OACvF,UAAA,eAA6C,MAAM,UAA6B,SAAS,KAAK,EAAA,GAD5C,CAEpD;AAAA,IAEF;AACA,WAAO;AAAA,EACR,CAAC,EAAA,CACF;AAEF;"}
1
+ {"version":3,"file":"renderChildren.js","sources":["../../../../../packages/react-richtext-renderer/src/internal/renderChildren.tsx"],"sourcesContent":["import type { ReactElement } from 'react'\nimport { ElementRenderer } from './components/ElementRenderer.js'\nimport { LeafRenderer } from './components/LeafRenderer.js'\nimport type { RichTextElement } from '../types/structure/RichTextElement.js'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf.js'\nimport { RichTextRenderingOptions } from '../types/RichTextRenderingOptions.js'\nimport { RichTextBlock } from '../types/RichTextBlock.js'\nimport { RichTextChild } from '../types/structure/RichTextChild.js'\n\nexport const renderChildren = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n>(\n\tchildren:\n\t\t| RichTextChild<CustomElements, CustomLeaves>\n\t\t| readonly RichTextChild<CustomElements, CustomLeaves>[],\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves>,\n\tblock: RichTextBlock<CustomElements, CustomLeaves>,\n): ReactElement => {\n\treturn (\n\t\t<>\n\t\t\t{(Array.isArray(children) ? children : [children]).map((child, i) => {\n\t\t\t\tif ('text' in child) {\n\t\t\t\t\treturn <LeafRenderer<CustomElements, CustomLeaves> key={i} leaf={child} options={options} block={block} />\n\t\t\t\t}\n\t\t\t\tif ('children' in child) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ElementRenderer<CustomElements, CustomLeaves> key={i} element={child} options={options} block={block}>\n\t\t\t\t\t\t\t{renderChildren<CustomElements, CustomLeaves>(child.children as typeof children, options, block)}\n\t\t\t\t\t\t</ElementRenderer>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn null // Throw?\n\t\t\t})}\n\t\t</>\n\t)\n}\n"],"names":[],"mappings":";;;AASO,MAAM,iBAAiB,CAI7B,UAGA,SACA,UACkB;AAClB,SACC,oBAAA,UAAA,EACG,WAAA,MAAM,QAAQ,QAAQ,IAAI,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,MAAM;AACpE,QAAI,UAAU,OAAO;AACpB,iCAAQ,cAAA,EAAmD,MAAM,OAAO,SAAkB,SAAlC,CAAgD;AAAA,IACzG;AACA,QAAI,cAAc,OAAO;AACxB,aACC,oBAAC,iBAAA,EAAsD,SAAS,OAAO,SAAkB,OACvF,UAAA,eAA6C,MAAM,UAA6B,SAAS,KAAK,EAAA,GAD5C,CAEpD;AAAA,IAEF;AACA,WAAO;AAAA,EACR,CAAC,EAAA,CACF;AAEF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useReferenceMetadata.cjs","sources":["../../../../../packages/react-richtext-renderer/src/internal/useReferenceMetadata.ts"],"sourcesContent":["import type { BuiltinElements } from '../types/builtin/BuiltinElements'\nimport type { RichTextElement } from '../types/structure/RichTextElement'\nimport type { RichTextReferenceMetadata } from '../types/RichTextReferenceMetadata'\nimport { RichTextReferenceEmptyMetadata } from '../types/RichTextReferenceMetadata'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf'\nimport type { RichTextReference } from '../types/RichTextReference'\nimport { RichTextRendererError } from '../RichTextRendererError'\nimport { RichTextBlock } from '../types/RichTextBlock'\nimport { RichTextRenderingOptions } from '../types/RichTextRenderingOptions'\nimport { useMemo } from 'react'\n\nconst emptyReference: RichTextReferenceEmptyMetadata = {\n\treference: undefined,\n\treferenceType: undefined,\n\treferenceRenderer: undefined,\n}\nexport const useReferenceMetadata = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n\tReference extends RichTextReference = RichTextReference,\n>(\n\telement: CustomElements | BuiltinElements<CustomElements, CustomLeaves>,\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves, Reference>,\n\tblock: RichTextBlock<CustomElements, CustomLeaves>,\n\texpectReference: boolean = false,\n): RichTextReferenceMetadata<CustomElements, CustomLeaves, Reference> => {\n\tconst undefinedReferenceHandler = options.undefinedReferenceHandler\n\tconst referenceRenderers = options.referenceRenderers\n\n\treturn useMemo(() => {\n\t\tconst id = element['referenceId']\n\n\t\tif (typeof id !== 'string') {\n\t\t\tif (import.meta.env.DEV && expectReference) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`RichTextRenderer: Expected element to have a referenceId.`,\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn emptyReference\n\t\t}\n\n\t\tconst reference: Reference | undefined = block.references?.[id] as Reference | undefined\n\n\t\tif (reference === undefined) {\n\t\t\tif (undefinedReferenceHandler) {\n\t\t\t\treturn undefinedReferenceHandler(id) ?? emptyReference\n\t\t\t} else {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`RichTextRenderer: Cannot find reference id '${id}'`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tconst referenceRenderer = referenceRenderers?.[reference.type]\n\n\t\treturn {\n\t\t\treference,\n\t\t\treferenceType: reference.type,\n\t\t\treferenceRenderer,\n\t\t}\n\t}, [block.references, element, expectReference, referenceRenderers, undefinedReferenceHandler])\n}\n"],"names":["useMemo","RichTextRendererError"],"mappings":";;;;AAWA,MAAM,iBAAiD;AAAA,EACtD,WAAW;AAAA,EACX,eAAe;AAAA,EACf,mBAAmB;AACpB;AACO,MAAM,uBAAuB,CAKnC,SACA,SACA,OACA,kBAA2B,UAC6C;AACxE,QAAM,4BAA4B,QAAQ;AAC1C,QAAM,qBAAqB,QAAQ;AAEnC,SAAOA,MAAAA,QAAQ,MAAM;AACpB,UAAM,KAAK,QAAQ,aAAa;AAEhC,QAAI,OAAO,OAAO,UAAU;AAM3B,aAAO;AAAA,IACR;AAEA,UAAM,YAAmC,MAAM,aAAa,EAAE;AAE9D,QAAI,cAAc,QAAW;AAC5B,UAAI,2BAA2B;AAC9B,eAAO,0BAA0B,EAAE,KAAK;AAAA,MACzC,OAAO;AACN,cAAM,IAAIC,sBAAAA;AAAAA,UACT,+CAA+C,EAAE;AAAA,QAAA;AAAA,MAEnD;AAAA,IACD;AAEA,UAAM,oBAAoB,qBAAqB,UAAU,IAAI;AAE7D,WAAO;AAAA,MACN;AAAA,MACA,eAAe,UAAU;AAAA,MACzB;AAAA,IAAA;AAAA,EAEF,GAAG,CAAC,MAAM,YAAY,SAAS,iBAAiB,oBAAoB,yBAAyB,CAAC;AAC/F;;"}
1
+ {"version":3,"file":"useReferenceMetadata.cjs","sources":["../../../../../packages/react-richtext-renderer/src/internal/useReferenceMetadata.ts"],"sourcesContent":["import type { BuiltinElements } from '../types/builtin/BuiltinElements.js'\nimport type { RichTextElement } from '../types/structure/RichTextElement.js'\nimport type { RichTextReferenceMetadata } from '../types/RichTextReferenceMetadata.js'\nimport { RichTextReferenceEmptyMetadata } from '../types/RichTextReferenceMetadata.js'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf.js'\nimport type { RichTextReference } from '../types/RichTextReference.js'\nimport { RichTextRendererError } from '../RichTextRendererError.js'\nimport { RichTextBlock } from '../types/RichTextBlock.js'\nimport { RichTextRenderingOptions } from '../types/RichTextRenderingOptions.js'\nimport { useMemo } from 'react'\n\nconst emptyReference: RichTextReferenceEmptyMetadata = {\n\treference: undefined,\n\treferenceType: undefined,\n\treferenceRenderer: undefined,\n}\nexport const useReferenceMetadata = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n\tReference extends RichTextReference = RichTextReference,\n>(\n\telement: CustomElements | BuiltinElements<CustomElements, CustomLeaves>,\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves, Reference>,\n\tblock: RichTextBlock<CustomElements, CustomLeaves>,\n\texpectReference: boolean = false,\n): RichTextReferenceMetadata<CustomElements, CustomLeaves, Reference> => {\n\tconst undefinedReferenceHandler = options.undefinedReferenceHandler\n\tconst referenceRenderers = options.referenceRenderers\n\n\treturn useMemo(() => {\n\t\tconst id = element['referenceId']\n\n\t\tif (typeof id !== 'string') {\n\t\t\tif (import.meta.env.DEV && expectReference) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`RichTextRenderer: Expected element to have a referenceId.`,\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn emptyReference\n\t\t}\n\n\t\tconst reference: Reference | undefined = block.references?.[id] as Reference | undefined\n\n\t\tif (reference === undefined) {\n\t\t\tif (undefinedReferenceHandler) {\n\t\t\t\treturn undefinedReferenceHandler(id) ?? emptyReference\n\t\t\t} else {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`RichTextRenderer: Cannot find reference id '${id}'`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tconst referenceRenderer = referenceRenderers?.[reference.type]\n\n\t\treturn {\n\t\t\treference,\n\t\t\treferenceType: reference.type,\n\t\t\treferenceRenderer,\n\t\t}\n\t}, [block.references, element, expectReference, referenceRenderers, undefinedReferenceHandler])\n}\n"],"names":["useMemo","RichTextRendererError"],"mappings":";;;;AAWA,MAAM,iBAAiD;AAAA,EACtD,WAAW;AAAA,EACX,eAAe;AAAA,EACf,mBAAmB;AACpB;AACO,MAAM,uBAAuB,CAKnC,SACA,SACA,OACA,kBAA2B,UAC6C;AACxE,QAAM,4BAA4B,QAAQ;AAC1C,QAAM,qBAAqB,QAAQ;AAEnC,SAAOA,MAAAA,QAAQ,MAAM;AACpB,UAAM,KAAK,QAAQ,aAAa;AAEhC,QAAI,OAAO,OAAO,UAAU;AAM3B,aAAO;AAAA,IACR;AAEA,UAAM,YAAmC,MAAM,aAAa,EAAE;AAE9D,QAAI,cAAc,QAAW;AAC5B,UAAI,2BAA2B;AAC9B,eAAO,0BAA0B,EAAE,KAAK;AAAA,MACzC,OAAO;AACN,cAAM,IAAIC,sBAAAA;AAAAA,UACT,+CAA+C,EAAE;AAAA,QAAA;AAAA,MAEnD;AAAA,IACD;AAEA,UAAM,oBAAoB,qBAAqB,UAAU,IAAI;AAE7D,WAAO;AAAA,MACN;AAAA,MACA,eAAe,UAAU;AAAA,MACzB;AAAA,IAAA;AAAA,EAEF,GAAG,CAAC,MAAM,YAAY,SAAS,iBAAiB,oBAAoB,yBAAyB,CAAC;AAC/F;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useReferenceMetadata.js","sources":["../../../../../packages/react-richtext-renderer/src/internal/useReferenceMetadata.ts"],"sourcesContent":["import type { BuiltinElements } from '../types/builtin/BuiltinElements'\nimport type { RichTextElement } from '../types/structure/RichTextElement'\nimport type { RichTextReferenceMetadata } from '../types/RichTextReferenceMetadata'\nimport { RichTextReferenceEmptyMetadata } from '../types/RichTextReferenceMetadata'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf'\nimport type { RichTextReference } from '../types/RichTextReference'\nimport { RichTextRendererError } from '../RichTextRendererError'\nimport { RichTextBlock } from '../types/RichTextBlock'\nimport { RichTextRenderingOptions } from '../types/RichTextRenderingOptions'\nimport { useMemo } from 'react'\n\nconst emptyReference: RichTextReferenceEmptyMetadata = {\n\treference: undefined,\n\treferenceType: undefined,\n\treferenceRenderer: undefined,\n}\nexport const useReferenceMetadata = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n\tReference extends RichTextReference = RichTextReference,\n>(\n\telement: CustomElements | BuiltinElements<CustomElements, CustomLeaves>,\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves, Reference>,\n\tblock: RichTextBlock<CustomElements, CustomLeaves>,\n\texpectReference: boolean = false,\n): RichTextReferenceMetadata<CustomElements, CustomLeaves, Reference> => {\n\tconst undefinedReferenceHandler = options.undefinedReferenceHandler\n\tconst referenceRenderers = options.referenceRenderers\n\n\treturn useMemo(() => {\n\t\tconst id = element['referenceId']\n\n\t\tif (typeof id !== 'string') {\n\t\t\tif (import.meta.env.DEV && expectReference) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`RichTextRenderer: Expected element to have a referenceId.`,\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn emptyReference\n\t\t}\n\n\t\tconst reference: Reference | undefined = block.references?.[id] as Reference | undefined\n\n\t\tif (reference === undefined) {\n\t\t\tif (undefinedReferenceHandler) {\n\t\t\t\treturn undefinedReferenceHandler(id) ?? emptyReference\n\t\t\t} else {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`RichTextRenderer: Cannot find reference id '${id}'`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tconst referenceRenderer = referenceRenderers?.[reference.type]\n\n\t\treturn {\n\t\t\treference,\n\t\t\treferenceType: reference.type,\n\t\t\treferenceRenderer,\n\t\t}\n\t}, [block.references, element, expectReference, referenceRenderers, undefinedReferenceHandler])\n}\n"],"names":[],"mappings":";;AAWA,MAAM,iBAAiD;AAAA,EACtD,WAAW;AAAA,EACX,eAAe;AAAA,EACf,mBAAmB;AACpB;AACO,MAAM,uBAAuB,CAKnC,SACA,SACA,OACA,kBAA2B,UAC6C;AACxE,QAAM,4BAA4B,QAAQ;AAC1C,QAAM,qBAAqB,QAAQ;AAEnC,SAAO,QAAQ,MAAM;AACpB,UAAM,KAAK,QAAQ,aAAa;AAEhC,QAAI,OAAO,OAAO,UAAU;AAM3B,aAAO;AAAA,IACR;AAEA,UAAM,YAAmC,MAAM,aAAa,EAAE;AAE9D,QAAI,cAAc,QAAW;AAC5B,UAAI,2BAA2B;AAC9B,eAAO,0BAA0B,EAAE,KAAK;AAAA,MACzC,OAAO;AACN,cAAM,IAAI;AAAA,UACT,+CAA+C,EAAE;AAAA,QAAA;AAAA,MAEnD;AAAA,IACD;AAEA,UAAM,oBAAoB,qBAAqB,UAAU,IAAI;AAE7D,WAAO;AAAA,MACN;AAAA,MACA,eAAe,UAAU;AAAA,MACzB;AAAA,IAAA;AAAA,EAEF,GAAG,CAAC,MAAM,YAAY,SAAS,iBAAiB,oBAAoB,yBAAyB,CAAC;AAC/F;"}
1
+ {"version":3,"file":"useReferenceMetadata.js","sources":["../../../../../packages/react-richtext-renderer/src/internal/useReferenceMetadata.ts"],"sourcesContent":["import type { BuiltinElements } from '../types/builtin/BuiltinElements.js'\nimport type { RichTextElement } from '../types/structure/RichTextElement.js'\nimport type { RichTextReferenceMetadata } from '../types/RichTextReferenceMetadata.js'\nimport { RichTextReferenceEmptyMetadata } from '../types/RichTextReferenceMetadata.js'\nimport type { RichTextLeaf } from '../types/structure/RichTextLeaf.js'\nimport type { RichTextReference } from '../types/RichTextReference.js'\nimport { RichTextRendererError } from '../RichTextRendererError.js'\nimport { RichTextBlock } from '../types/RichTextBlock.js'\nimport { RichTextRenderingOptions } from '../types/RichTextRenderingOptions.js'\nimport { useMemo } from 'react'\n\nconst emptyReference: RichTextReferenceEmptyMetadata = {\n\treference: undefined,\n\treferenceType: undefined,\n\treferenceRenderer: undefined,\n}\nexport const useReferenceMetadata = <\n\tCustomElements extends RichTextElement = never,\n\tCustomLeaves extends RichTextLeaf = RichTextLeaf,\n\tReference extends RichTextReference = RichTextReference,\n>(\n\telement: CustomElements | BuiltinElements<CustomElements, CustomLeaves>,\n\toptions: RichTextRenderingOptions<CustomElements, CustomLeaves, Reference>,\n\tblock: RichTextBlock<CustomElements, CustomLeaves>,\n\texpectReference: boolean = false,\n): RichTextReferenceMetadata<CustomElements, CustomLeaves, Reference> => {\n\tconst undefinedReferenceHandler = options.undefinedReferenceHandler\n\tconst referenceRenderers = options.referenceRenderers\n\n\treturn useMemo(() => {\n\t\tconst id = element['referenceId']\n\n\t\tif (typeof id !== 'string') {\n\t\t\tif (import.meta.env.DEV && expectReference) {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`RichTextRenderer: Expected element to have a referenceId.`,\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn emptyReference\n\t\t}\n\n\t\tconst reference: Reference | undefined = block.references?.[id] as Reference | undefined\n\n\t\tif (reference === undefined) {\n\t\t\tif (undefinedReferenceHandler) {\n\t\t\t\treturn undefinedReferenceHandler(id) ?? emptyReference\n\t\t\t} else {\n\t\t\t\tthrow new RichTextRendererError(\n\t\t\t\t\t`RichTextRenderer: Cannot find reference id '${id}'`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tconst referenceRenderer = referenceRenderers?.[reference.type]\n\n\t\treturn {\n\t\t\treference,\n\t\t\treferenceType: reference.type,\n\t\t\treferenceRenderer,\n\t\t}\n\t}, [block.references, element, expectReference, referenceRenderers, undefinedReferenceHandler])\n}\n"],"names":[],"mappings":";;AAWA,MAAM,iBAAiD;AAAA,EACtD,WAAW;AAAA,EACX,eAAe;AAAA,EACf,mBAAmB;AACpB;AACO,MAAM,uBAAuB,CAKnC,SACA,SACA,OACA,kBAA2B,UAC6C;AACxE,QAAM,4BAA4B,QAAQ;AAC1C,QAAM,qBAAqB,QAAQ;AAEnC,SAAO,QAAQ,MAAM;AACpB,UAAM,KAAK,QAAQ,aAAa;AAEhC,QAAI,OAAO,OAAO,UAAU;AAM3B,aAAO;AAAA,IACR;AAEA,UAAM,YAAmC,MAAM,aAAa,EAAE;AAE9D,QAAI,cAAc,QAAW;AAC5B,UAAI,2BAA2B;AAC9B,eAAO,0BAA0B,EAAE,KAAK;AAAA,MACzC,OAAO;AACN,cAAM,IAAI;AAAA,UACT,+CAA+C,EAAE;AAAA,QAAA;AAAA,MAEnD;AAAA,IACD;AAEA,UAAM,oBAAoB,qBAAqB,UAAU,IAAI;AAE7D,WAAO;AAAA,MACN;AAAA,MACA,eAAe,UAAU;AAAA,MACzB;AAAA,IAAA;AAAA,EAEF,GAAG,CAAC,MAAM,YAAY,SAAS,iBAAiB,oBAAoB,yBAAyB,CAAC;AAC/F;"}
@@ -1,5 +1,5 @@
1
- import type { RichTextBlock } from '../types';
2
- import { RichTextElement, RichTextLeaf, RichTextRenderingOptions } from '../types';
1
+ import type { RichTextBlock } from '../types/index.js';
2
+ import { RichTextElement, RichTextLeaf, RichTextRenderingOptions } from '../types/index.js';
3
3
  export type RichTextProps<CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf> = {
4
4
  blocks: RichTextBlock<CustomElements, CustomLeaves>[];
5
5
  } & RichTextRenderingOptions<CustomElements, CustomLeaves>;
@@ -1 +1 @@
1
- {"version":3,"file":"RichText.d.ts","sourceRoot":"","sources":["../../../src/components/RichText.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AAElF,MAAM,MAAM,aAAa,CACxB,cAAc,SAAS,eAAe,GAAG,KAAK,EAC9C,YAAY,SAAS,YAAY,GAAG,YAAY,IAE9C;IACD,MAAM,EAAE,aAAa,CAAC,cAAc,EAAE,YAAY,CAAC,EAAE,CAAA;CACrD,GACC,wBAAwB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GACpB,cAAc,SAAS,eAAe,GAAG,KAAK,EAC9C,YAAY,SAAS,YAAY,GAAG,YAAY,EAC/C,yHAQC,aAAa,CAAC,cAAc,EAAE,YAAY,CAAC,4CAsB7C,CAAA"}
1
+ {"version":3,"file":"RichText.d.ts","sourceRoot":"","sources":["../../../src/components/RichText.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAE3F,MAAM,MAAM,aAAa,CACxB,cAAc,SAAS,eAAe,GAAG,KAAK,EAC9C,YAAY,SAAS,YAAY,GAAG,YAAY,IAE9C;IACD,MAAM,EAAE,aAAa,CAAC,cAAc,EAAE,YAAY,CAAC,EAAE,CAAA;CACrD,GACC,wBAAwB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GACpB,cAAc,SAAS,eAAe,GAAG,KAAK,EAC9C,YAAY,SAAS,YAAY,GAAG,YAAY,EAC/C,yHAQC,aAAa,CAAC,cAAc,EAAE,YAAY,CAAC,4CAsB7C,CAAA"}
@@ -1,4 +1,4 @@
1
- import { RichTextBlockSource, RichTextElement, RichTextLeaf, RichTextRenderingOptions } from '../types';
1
+ import { RichTextBlockSource, RichTextElement, RichTextLeaf, RichTextRenderingOptions } from '../types/index.js';
2
2
  export type { RichTextBlockSource };
3
3
  export type RichTextBlocksRendererProps<CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf> = RichTextBlockSource<CustomElements, CustomLeaves> & RichTextRenderingOptions<CustomElements, CustomLeaves>;
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextBlocksRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextBlocksRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AAIvG,YAAY,EAAE,mBAAmB,EAAE,CAAA;AAEnC,MAAM,MAAM,2BAA2B,CAAC,cAAc,SAAS,eAAe,GAAG,KAAK,EAAE,YAAY,SAAS,YAAY,GAAG,YAAY,IACrI,mBAAmB,CAAC,cAAc,EAAE,YAAY,CAAC,GACjD,wBAAwB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;AAEzD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAClC,cAAc,SAAS,eAAe,GAAG,KAAK,EAC9C,YAAY,SAAS,YAAY,GAAG,YAAY,EAC/C,0HAQC,2BAA2B,CAAC,cAAc,EAAE,YAAY,CAAC,4CAa3D,CAAA"}
1
+ {"version":3,"file":"RichTextBlocksRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextBlocksRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAIhH,YAAY,EAAE,mBAAmB,EAAE,CAAA;AAEnC,MAAM,MAAM,2BAA2B,CAAC,cAAc,SAAS,eAAe,GAAG,KAAK,EAAE,YAAY,SAAS,YAAY,GAAG,YAAY,IACrI,mBAAmB,CAAC,cAAc,EAAE,YAAY,CAAC,GACjD,wBAAwB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;AAEzD;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAClC,cAAc,SAAS,eAAe,GAAG,KAAK,EAC9C,YAAY,SAAS,YAAY,GAAG,YAAY,EAC/C,0HAQC,2BAA2B,CAAC,cAAc,EAAE,YAAY,CAAC,4CAa3D,CAAA"}
@@ -1,4 +1,4 @@
1
- import { RichTextElement, RichTextFieldSource, RichTextLeaf, RichTextRenderingOptions } from '../types';
1
+ import { RichTextElement, RichTextFieldSource, RichTextLeaf, RichTextRenderingOptions } from '../types/index.js';
2
2
  export type { RichTextFieldSource };
3
3
  export type RichTextFieldRendererProps<CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf> = RichTextFieldSource<CustomElements, CustomLeaves> & RichTextRenderingOptions<CustomElements, CustomLeaves>;
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextFieldRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextFieldRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AAGvG,YAAY,EAAE,mBAAmB,EAAE,CAAA;AAEnC,MAAM,MAAM,0BAA0B,CACrC,cAAc,SAAS,eAAe,GAAG,KAAK,EAC9C,YAAY,SAAS,YAAY,GAAG,YAAY,IAE9C,mBAAmB,CAAC,cAAc,EAAE,YAAY,CAAC,GACjD,wBAAwB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;AAEzD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GACjC,cAAc,SAAS,eAAe,GAAG,KAAK,EAC9C,YAAY,SAAS,YAAY,GAAG,YAAY,EAC/C,uGAOC,0BAA0B,CAAC,cAAc,EAAE,YAAY,CAAC,4CAa1D,CAAA"}
1
+ {"version":3,"file":"RichTextFieldRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextFieldRenderer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAGhH,YAAY,EAAE,mBAAmB,EAAE,CAAA;AAEnC,MAAM,MAAM,0BAA0B,CACrC,cAAc,SAAS,eAAe,GAAG,KAAK,EAC9C,YAAY,SAAS,YAAY,GAAG,YAAY,IAE9C,mBAAmB,CAAC,cAAc,EAAE,YAAY,CAAC,GACjD,wBAAwB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;AAEzD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GACjC,cAAc,SAAS,eAAe,GAAG,KAAK,EAC9C,YAAY,SAAS,YAAY,GAAG,YAAY,EAC/C,uGAOC,0BAA0B,CAAC,cAAc,EAAE,YAAY,CAAC,4CAa1D,CAAA"}
@@ -1,8 +1,8 @@
1
1
  import { ReactElement } from 'react';
2
- import type { RichTextElement } from '../types/structure/RichTextElement';
3
- import type { RichTextLeaf } from '../types/structure/RichTextLeaf';
4
- import { RichTextFieldRendererProps } from './RichTextFieldRenderer';
5
- import { RichTextBlocksRendererProps } from './RichTextBlocksRenderer';
2
+ import type { RichTextElement } from '../types/structure/RichTextElement.js';
3
+ import type { RichTextLeaf } from '../types/structure/RichTextLeaf.js';
4
+ import { RichTextFieldRendererProps } from './RichTextFieldRenderer.js';
5
+ import { RichTextBlocksRendererProps } from './RichTextBlocksRenderer.js';
6
6
  export type RichTextRendererProps<CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf> = RichTextFieldRendererProps<CustomElements, CustomLeaves> | RichTextBlocksRendererProps<CustomElements, CustomLeaves>;
7
7
  /**
8
8
  * @deprecated Use `RichTextBlocksRenderer` or `RichTextFieldRenderer` instead, or directly use `RichText`.
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,YAAY,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAAyB,0BAA0B,EAAE,MAAM,yBAAyB,CAAA;AAC3F,OAAO,EAA0B,2BAA2B,EAAE,MAAM,0BAA0B,CAAA;AAE9F,MAAM,MAAM,qBAAqB,CAChC,cAAc,SAAS,eAAe,GAAG,KAAK,EAC9C,YAAY,SAAS,YAAY,GAAG,YAAY,IAE9C,0BAA0B,CAAC,cAAc,EAAE,YAAY,CAAC,GACxD,2BAA2B,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;AAE5D;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EASvB,CAAC,cAAc,SAAS,eAAe,GAAG,KAAK,EAAE,YAAY,SAAS,YAAY,GAAG,YAAY,EACtG,KAAK,EAAE,qBAAqB,CAAC,cAAc,EAAE,YAAY,CAAC,KACtD,YAAY,CAAA"}
1
+ {"version":3,"file":"RichTextRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,YAAY,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAA;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,EAAyB,0BAA0B,EAAE,MAAM,4BAA4B,CAAA;AAC9F,OAAO,EAA0B,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAEjG,MAAM,MAAM,qBAAqB,CAChC,cAAc,SAAS,eAAe,GAAG,KAAK,EAC9C,YAAY,SAAS,YAAY,GAAG,YAAY,IAE9C,0BAA0B,CAAC,cAAc,EAAE,YAAY,CAAC,GACxD,2BAA2B,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;AAE5D;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EASvB,CAAC,cAAc,SAAS,eAAe,GAAG,KAAK,EAAE,YAAY,SAAS,YAAY,GAAG,YAAY,EACtG,KAAK,EAAE,qBAAqB,CAAC,cAAc,EAAE,YAAY,CAAC,KACtD,YAAY,CAAA"}
@@ -1,5 +1,5 @@
1
- export * from './RichText';
2
- export * from './RichTextFieldRenderer';
3
- export * from './RichTextBlocksRenderer';
4
- export * from './RichTextRenderer';
1
+ export * from './RichText.js';
2
+ export * from './RichTextFieldRenderer.js';
3
+ export * from './RichTextBlocksRenderer.js';
4
+ export * from './RichTextRenderer.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,uBAAuB,CAAA"}
@@ -1,3 +1,3 @@
1
- export * from './useRichTextFieldSource';
2
- export * from './useRichTextBlocksSource';
1
+ export * from './useRichTextFieldSource.js';
2
+ export * from './useRichTextBlocksSource.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA"}
@@ -1,3 +1,3 @@
1
- import { RichTextBlock, RichTextBlockSource, RichTextElement, RichTextLeaf } from '../types';
1
+ import { RichTextBlock, RichTextBlockSource, RichTextElement, RichTextLeaf } from '../types/index.js';
2
2
  export declare const useRichTextBlocksSource: <CustomElements extends RichTextElement, CustomLeaves extends RichTextLeaf>({ deserialize, blocks, referencesField, sourceField, referenceDiscriminationField, }: RichTextBlockSource<CustomElements, CustomLeaves>) => RichTextBlock<CustomElements, CustomLeaves>[];
3
3
  //# sourceMappingURL=useRichTextBlocksSource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRichTextBlocksSource.d.ts","sourceRoot":"","sources":["../../../src/hooks/useRichTextBlocksSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,eAAe,EAAE,YAAY,EAAqC,MAAM,UAAU,CAAA;AAK/H,eAAO,MAAM,uBAAuB,GAAI,cAAc,SAAS,eAAe,EAAE,YAAY,SAAS,YAAY,EAAE,sFAMhH,mBAAmB,CAAC,cAAc,EAAE,YAAY,CAAC,kDAiEnD,CAAA"}
1
+ {"version":3,"file":"useRichTextBlocksSource.d.ts","sourceRoot":"","sources":["../../../src/hooks/useRichTextBlocksSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,eAAe,EAAE,YAAY,EAAqC,MAAM,mBAAmB,CAAA;AAKxI,eAAO,MAAM,uBAAuB,GAAI,cAAc,SAAS,eAAe,EAAE,YAAY,SAAS,YAAY,EAAE,sFAMhH,mBAAmB,CAAC,cAAc,EAAE,YAAY,CAAC,kDAiEnD,CAAA"}
@@ -1,3 +1,3 @@
1
- import { RichTextBlock, RichTextElement, RichTextFieldSource, RichTextLeaf } from '../types';
1
+ import { RichTextBlock, RichTextElement, RichTextFieldSource, RichTextLeaf } from '../types/index.js';
2
2
  export declare const useRichTextFieldSource: <CustomElements extends RichTextElement, CustomLeaves extends RichTextLeaf>({ source, deserialize, }: RichTextFieldSource<CustomElements, CustomLeaves>) => RichTextBlock<CustomElements, CustomLeaves>[];
3
3
  //# sourceMappingURL=useRichTextFieldSource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRichTextFieldSource.d.ts","sourceRoot":"","sources":["../../../src/hooks/useRichTextFieldSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAI5F,eAAO,MAAM,sBAAsB,GAAI,cAAc,SAAS,eAAe,EAAE,YAAY,SAAS,YAAY,EAAE,0BAG/G,mBAAmB,CAAC,cAAc,EAAE,YAAY,CAAC,KAAG,aAAa,CAAC,cAAc,EAAE,YAAY,CAAC,EAkBjG,CAAA"}
1
+ {"version":3,"file":"useRichTextFieldSource.d.ts","sourceRoot":"","sources":["../../../src/hooks/useRichTextFieldSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAIrG,eAAO,MAAM,sBAAsB,GAAI,cAAc,SAAS,eAAe,EAAE,YAAY,SAAS,YAAY,EAAE,0BAG/G,mBAAmB,CAAC,cAAc,EAAE,YAAY,CAAC,KAAG,aAAa,CAAC,cAAc,EAAE,YAAY,CAAC,EAkBjG,CAAA"}
@@ -1,5 +1,5 @@
1
- export * from './components';
2
- export * from './hooks';
3
- export * from './types';
4
- export * from './RichTextRendererError';
1
+ export * from './components/index.js';
2
+ export * from './hooks/index.js';
3
+ export * from './types/index.js';
4
+ export * from './RichTextRendererError.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AAEvB,cAAc,yBAAyB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAEhC,cAAc,4BAA4B,CAAA"}
@@ -1,9 +1,9 @@
1
1
  import type { ReactElement } from 'react';
2
- import type { BuiltinElements } from '../../types/builtin/BuiltinElements';
3
- import type { RichTextElement } from '../../types/structure/RichTextElement';
4
- import type { RichTextLeaf } from '../../types/structure/RichTextLeaf';
5
- import { RichTextBlock } from '../../types/RichTextBlock';
6
- import { RichTextRenderingOptions } from '../../types/RichTextRenderingOptions';
2
+ import type { BuiltinElements } from '../../types/builtin/BuiltinElements.js';
3
+ import type { RichTextElement } from '../../types/structure/RichTextElement.js';
4
+ import type { RichTextLeaf } from '../../types/structure/RichTextLeaf.js';
5
+ import { RichTextBlock } from '../../types/RichTextBlock.js';
6
+ import { RichTextRenderingOptions } from '../../types/RichTextRenderingOptions.js';
7
7
  export interface ElementRendererProps<CustomElements extends RichTextElement = never, CustomLeaves extends RichTextLeaf = RichTextLeaf> {
8
8
  element: CustomElements | BuiltinElements<CustomElements, CustomLeaves>;
9
9
  children: ReactElement;