@payloadcms/richtext-lexical 4.0.0-internal.38b7f1d → 4.0.0-internal.5d5a2b2

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 (581) hide show
  1. package/dist/@types/assets.d.js +2 -0
  2. package/dist/@types/assets.d.js.map +1 -0
  3. package/dist/cell/rscEntry.d.ts +1 -1
  4. package/dist/cell/rscEntry.d.ts.map +1 -1
  5. package/dist/cell/rscEntry.js +5 -5
  6. package/dist/cell/rscEntry.js.map +1 -1
  7. package/dist/exports/client/Field-VYBSMSRY.js +2 -0
  8. package/dist/exports/client/Field-VYBSMSRY.js.map +7 -0
  9. package/dist/exports/client/{RelationshipComponent-5RONAYJM.js → RelationshipComponent-YCPAKOL7.js} +2 -2
  10. package/dist/exports/client/RelationshipComponent-YCPAKOL7.js.map +7 -0
  11. package/dist/exports/client/bundled.css +1 -1
  12. package/dist/exports/client/chunk-5VIL27GI.js +2 -0
  13. package/dist/exports/client/chunk-5VIL27GI.js.map +7 -0
  14. package/dist/exports/client/{chunk-FTT5KJ6W.js → chunk-LH634DPU.js} +1 -1
  15. package/dist/exports/client/chunk-LH634DPU.js.map +7 -0
  16. package/dist/exports/client/{chunk-BZZVLW4U.js → chunk-RJ5MAOKZ.js} +1 -1
  17. package/dist/exports/client/chunk-RJ5MAOKZ.js.map +7 -0
  18. package/dist/exports/client/chunk-UD4DQ4AK.js +2 -0
  19. package/dist/exports/client/chunk-UD4DQ4AK.js.map +7 -0
  20. package/dist/exports/client/chunk-ZYXHC5CY.js +2 -0
  21. package/dist/exports/client/chunk-ZYXHC5CY.js.map +7 -0
  22. package/dist/exports/client/component-PHZQBOJE.js +2 -0
  23. package/dist/exports/client/component-PHZQBOJE.js.map +7 -0
  24. package/dist/exports/client/componentInline-R3EPNYWF.js +2 -0
  25. package/dist/exports/client/index.d.ts +1 -0
  26. package/dist/exports/client/index.d.ts.map +1 -1
  27. package/dist/exports/client/index.js +25 -25
  28. package/dist/exports/client/index.js.map +4 -4
  29. package/dist/exports/react/index.d.ts +1 -1
  30. package/dist/exports/react/index.d.ts.map +1 -1
  31. package/dist/exports/react/index.js.map +1 -1
  32. package/dist/exports/server/rsc.browser.d.ts +11 -0
  33. package/dist/exports/server/rsc.browser.d.ts.map +1 -0
  34. package/dist/exports/server/rsc.browser.js +10 -0
  35. package/dist/exports/server/rsc.browser.js.map +1 -0
  36. package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
  37. package/dist/features/blockquote/server/index.d.ts +1 -4
  38. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  39. package/dist/features/blockquote/server/index.js +2 -0
  40. package/dist/features/blockquote/server/index.js.map +1 -1
  41. package/dist/features/blockquote/server/schema.d.ts +8 -0
  42. package/dist/features/blockquote/server/schema.d.ts.map +1 -0
  43. package/dist/features/blockquote/server/schema.js +15 -0
  44. package/dist/features/blockquote/server/schema.js.map +1 -0
  45. package/dist/features/blocks/client/component/index.d.ts +3 -2
  46. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  47. package/dist/features/blocks/client/component/index.js +17 -10
  48. package/dist/features/blocks/client/component/index.js.map +1 -1
  49. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -1
  50. package/dist/features/blocks/client/componentInline/index.d.ts +3 -2
  51. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  52. package/dist/features/blocks/client/componentInline/index.js +16 -9
  53. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  54. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  55. package/dist/features/blocks/client/markdown/markdownTransformer.js +4 -4
  56. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  57. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
  58. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  59. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  60. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +2 -2
  61. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  62. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  63. package/dist/features/blocks/client/plugin/index.d.ts +1 -1
  64. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  65. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  66. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  67. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  68. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  69. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +1 -2
  70. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  71. package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
  72. package/dist/features/blocks/server/index.d.ts +1 -0
  73. package/dist/features/blocks/server/index.d.ts.map +1 -1
  74. package/dist/features/blocks/server/index.js +20 -66
  75. package/dist/features/blocks/server/index.js.map +1 -1
  76. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  77. package/dist/features/blocks/server/markdown/markdownTransformer.js +4 -4
  78. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  79. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -18
  80. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  81. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  82. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -10
  83. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  84. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  85. package/dist/features/blocks/server/schema.d.ts +45 -0
  86. package/dist/features/blocks/server/schema.d.ts.map +1 -0
  87. package/dist/features/blocks/server/schema.js +139 -0
  88. package/dist/features/blocks/server/schema.js.map +1 -0
  89. package/dist/features/blocks/server/validate.d.ts +1 -2
  90. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  91. package/dist/features/blocks/server/validate.js.map +1 -1
  92. package/dist/features/converters/htmlToLexical/index.d.ts +1 -1
  93. package/dist/features/converters/htmlToLexical/index.d.ts.map +1 -1
  94. package/dist/features/converters/htmlToLexical/index.js.map +1 -1
  95. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.d.ts +1 -1
  96. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.d.ts.map +1 -1
  97. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.js.map +1 -1
  98. package/dist/features/converters/lexicalToHtml/async/converters/heading.d.ts +1 -1
  99. package/dist/features/converters/lexicalToHtml/async/converters/heading.d.ts.map +1 -1
  100. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  101. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.d.ts +1 -1
  102. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.d.ts.map +1 -1
  103. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.js.map +1 -1
  104. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.d.ts +1 -1
  105. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.d.ts.map +1 -1
  106. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.js.map +1 -1
  107. package/dist/features/converters/lexicalToHtml/async/converters/link.d.ts +1 -1
  108. package/dist/features/converters/lexicalToHtml/async/converters/link.d.ts.map +1 -1
  109. package/dist/features/converters/lexicalToHtml/async/converters/link.js.map +1 -1
  110. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts +1 -1
  111. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  112. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  113. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.d.ts +1 -1
  114. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.d.ts.map +1 -1
  115. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.js.map +1 -1
  116. package/dist/features/converters/lexicalToHtml/async/converters/tab.d.ts +1 -1
  117. package/dist/features/converters/lexicalToHtml/async/converters/tab.d.ts.map +1 -1
  118. package/dist/features/converters/lexicalToHtml/async/converters/tab.js.map +1 -1
  119. package/dist/features/converters/lexicalToHtml/async/converters/table.d.ts +1 -1
  120. package/dist/features/converters/lexicalToHtml/async/converters/table.d.ts.map +1 -1
  121. package/dist/features/converters/lexicalToHtml/async/converters/table.js +1 -1
  122. package/dist/features/converters/lexicalToHtml/async/converters/table.js.map +1 -1
  123. package/dist/features/converters/lexicalToHtml/async/converters/text.d.ts +1 -1
  124. package/dist/features/converters/lexicalToHtml/async/converters/text.d.ts.map +1 -1
  125. package/dist/features/converters/lexicalToHtml/async/converters/text.js.map +1 -1
  126. package/dist/features/converters/lexicalToHtml/async/converters/upload.d.ts +1 -1
  127. package/dist/features/converters/lexicalToHtml/async/converters/upload.d.ts.map +1 -1
  128. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  129. package/dist/features/converters/lexicalToHtml/async/defaultConverters.d.ts +1 -1
  130. package/dist/features/converters/lexicalToHtml/async/defaultConverters.d.ts.map +1 -1
  131. package/dist/features/converters/lexicalToHtml/async/defaultConverters.js.map +1 -1
  132. package/dist/features/converters/lexicalToHtml/async/types.d.ts +15 -16
  133. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  134. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  135. package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts.map +1 -1
  136. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  137. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.d.ts +1 -1
  138. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.d.ts.map +1 -1
  139. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.js.map +1 -1
  140. package/dist/features/converters/lexicalToHtml/sync/converters/heading.d.ts +1 -1
  141. package/dist/features/converters/lexicalToHtml/sync/converters/heading.d.ts.map +1 -1
  142. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  143. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.d.ts +1 -1
  144. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.d.ts.map +1 -1
  145. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.js.map +1 -1
  146. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.d.ts +1 -1
  147. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.d.ts.map +1 -1
  148. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.js.map +1 -1
  149. package/dist/features/converters/lexicalToHtml/sync/converters/link.d.ts +1 -1
  150. package/dist/features/converters/lexicalToHtml/sync/converters/link.d.ts.map +1 -1
  151. package/dist/features/converters/lexicalToHtml/sync/converters/link.js.map +1 -1
  152. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts +1 -1
  153. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  154. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  155. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.d.ts +1 -1
  156. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.d.ts.map +1 -1
  157. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.js.map +1 -1
  158. package/dist/features/converters/lexicalToHtml/sync/converters/tab.d.ts +1 -1
  159. package/dist/features/converters/lexicalToHtml/sync/converters/tab.d.ts.map +1 -1
  160. package/dist/features/converters/lexicalToHtml/sync/converters/tab.js.map +1 -1
  161. package/dist/features/converters/lexicalToHtml/sync/converters/table.d.ts +1 -1
  162. package/dist/features/converters/lexicalToHtml/sync/converters/table.d.ts.map +1 -1
  163. package/dist/features/converters/lexicalToHtml/sync/converters/table.js +1 -1
  164. package/dist/features/converters/lexicalToHtml/sync/converters/table.js.map +1 -1
  165. package/dist/features/converters/lexicalToHtml/sync/converters/text.d.ts +1 -1
  166. package/dist/features/converters/lexicalToHtml/sync/converters/text.d.ts.map +1 -1
  167. package/dist/features/converters/lexicalToHtml/sync/converters/text.js.map +1 -1
  168. package/dist/features/converters/lexicalToHtml/sync/converters/upload.d.ts +1 -1
  169. package/dist/features/converters/lexicalToHtml/sync/converters/upload.d.ts.map +1 -1
  170. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  171. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.d.ts +1 -1
  172. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.d.ts.map +1 -1
  173. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.js.map +1 -1
  174. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +15 -16
  175. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  176. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  177. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +6 -4
  178. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  179. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  180. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  181. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.d.ts +1 -1
  182. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.d.ts.map +1 -1
  183. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
  184. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts +1 -1
  185. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  186. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  187. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.d.ts +1 -1
  188. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.d.ts.map +1 -1
  189. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
  190. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.d.ts +1 -1
  191. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.d.ts.map +1 -1
  192. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
  193. package/dist/features/converters/lexicalToJSX/converter/converters/link.d.ts +1 -1
  194. package/dist/features/converters/lexicalToJSX/converter/converters/link.d.ts.map +1 -1
  195. package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
  196. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts +1 -1
  197. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  198. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  199. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.d.ts +1 -1
  200. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.d.ts.map +1 -1
  201. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
  202. package/dist/features/converters/lexicalToJSX/converter/converters/tab.d.ts +1 -1
  203. package/dist/features/converters/lexicalToJSX/converter/converters/tab.d.ts.map +1 -1
  204. package/dist/features/converters/lexicalToJSX/converter/converters/tab.js.map +1 -1
  205. package/dist/features/converters/lexicalToJSX/converter/converters/table.d.ts +1 -1
  206. package/dist/features/converters/lexicalToJSX/converter/converters/table.d.ts.map +1 -1
  207. package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
  208. package/dist/features/converters/lexicalToJSX/converter/converters/text.d.ts +1 -1
  209. package/dist/features/converters/lexicalToJSX/converter/converters/text.d.ts.map +1 -1
  210. package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
  211. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts +1 -1
  212. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts.map +1 -1
  213. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  214. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.d.ts +1 -1
  215. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.d.ts.map +1 -1
  216. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.js.map +1 -1
  217. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +1 -1
  218. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  219. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  220. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +13 -15
  221. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  222. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  223. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  224. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +1 -1
  225. package/dist/features/converters/lexicalToPlaintext/shared/findConverterForNode.js.map +1 -1
  226. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +13 -15
  227. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  228. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  229. package/dist/features/converters/markdownToLexical/index.d.ts +1 -1
  230. package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
  231. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  232. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.css +4 -4
  233. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.css +1 -1
  234. package/dist/features/experimental_table/server/index.d.ts +1 -6
  235. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  236. package/dist/features/experimental_table/server/index.js +4 -0
  237. package/dist/features/experimental_table/server/index.js.map +1 -1
  238. package/dist/features/experimental_table/server/schema.d.ts +27 -0
  239. package/dist/features/experimental_table/server/schema.d.ts.map +1 -0
  240. package/dist/features/experimental_table/server/schema.js +107 -0
  241. package/dist/features/experimental_table/server/schema.js.map +1 -0
  242. package/dist/features/format/shared/toolbarFormatGroup.d.ts.map +1 -1
  243. package/dist/features/heading/server/index.d.ts +2 -4
  244. package/dist/features/heading/server/index.d.ts.map +1 -1
  245. package/dist/features/heading/server/index.js +2 -0
  246. package/dist/features/heading/server/index.js.map +1 -1
  247. package/dist/features/heading/server/schema.d.ts +10 -0
  248. package/dist/features/heading/server/schema.d.ts.map +1 -0
  249. package/dist/features/heading/server/schema.js +37 -0
  250. package/dist/features/heading/server/schema.js.map +1 -0
  251. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  252. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  253. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  254. package/dist/features/horizontalRule/server/index.d.ts +1 -0
  255. package/dist/features/horizontalRule/server/index.d.ts.map +1 -1
  256. package/dist/features/horizontalRule/server/index.js +2 -0
  257. package/dist/features/horizontalRule/server/index.js.map +1 -1
  258. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -5
  259. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  260. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  261. package/dist/features/horizontalRule/server/schema.d.ts +7 -0
  262. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -0
  263. package/dist/features/horizontalRule/server/schema.js +25 -0
  264. package/dist/features/horizontalRule/server/schema.js.map +1 -0
  265. package/dist/features/indent/client/toolbarIndentGroup.d.ts.map +1 -1
  266. package/dist/features/link/client/index.d.ts.map +1 -1
  267. package/dist/features/link/client/index.js.map +1 -1
  268. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  269. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  270. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  271. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  272. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +2 -2
  273. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts +1 -1
  274. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts.map +1 -1
  275. package/dist/features/link/client/plugins/floatingLinkEditor/types.js.map +1 -1
  276. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  277. package/dist/features/link/markdownTransformer.d.ts +1 -1
  278. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  279. package/dist/features/link/markdownTransformer.js.map +1 -1
  280. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  281. package/dist/features/link/nodes/AutoLinkNode.d.ts +3 -3
  282. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  283. package/dist/features/link/nodes/AutoLinkNode.js +2 -1
  284. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  285. package/dist/features/link/nodes/LinkNode.d.ts +3 -3
  286. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  287. package/dist/features/link/nodes/LinkNode.js +2 -1
  288. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  289. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  290. package/dist/features/link/server/baseFields.js.map +1 -1
  291. package/dist/features/link/server/graphQLPopulationPromise.d.ts +1 -1
  292. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  293. package/dist/features/link/server/graphQLPopulationPromise.js.map +1 -1
  294. package/dist/features/link/server/index.d.ts +2 -1
  295. package/dist/features/link/server/index.d.ts.map +1 -1
  296. package/dist/features/link/server/index.js +3 -0
  297. package/dist/features/link/server/index.js.map +1 -1
  298. package/dist/features/link/server/schema.d.ts +32 -0
  299. package/dist/features/link/server/schema.d.ts.map +1 -0
  300. package/dist/features/link/server/schema.js +169 -0
  301. package/dist/features/link/server/schema.js.map +1 -0
  302. package/dist/features/link/server/validate.d.ts +1 -1
  303. package/dist/features/link/server/validate.d.ts.map +1 -1
  304. package/dist/features/link/server/validate.js.map +1 -1
  305. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  306. package/dist/features/lists/checklist/server/index.js +3 -0
  307. package/dist/features/lists/checklist/server/index.js.map +1 -1
  308. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  309. package/dist/features/lists/orderedList/server/index.js +3 -0
  310. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  311. package/dist/features/lists/plugin/index.d.ts +0 -9
  312. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  313. package/dist/features/lists/plugin/index.js.map +1 -1
  314. package/dist/features/lists/shared/markdown.d.ts.map +1 -1
  315. package/dist/features/lists/shared/schema.d.ts +18 -0
  316. package/dist/features/lists/shared/schema.d.ts.map +1 -0
  317. package/dist/features/lists/shared/schema.js +62 -0
  318. package/dist/features/lists/shared/schema.js.map +1 -0
  319. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  320. package/dist/features/lists/unorderedList/server/index.js +3 -0
  321. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  322. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  323. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  324. package/dist/features/relationship/client/components/RelationshipComponent.js +2 -2
  325. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  326. package/dist/features/relationship/client/components/index.css +2 -2
  327. package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
  328. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  329. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  330. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  331. package/dist/features/relationship/client/plugins/index.d.ts +1 -1
  332. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  333. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  334. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  335. package/dist/features/relationship/client/utils/useEnabledRelationships.js +9 -40
  336. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  337. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +1 -1
  338. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  339. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  340. package/dist/features/relationship/server/index.d.ts +1 -0
  341. package/dist/features/relationship/server/index.d.ts.map +1 -1
  342. package/dist/features/relationship/server/index.js +2 -0
  343. package/dist/features/relationship/server/index.js.map +1 -1
  344. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -10
  345. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  346. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  347. package/dist/features/relationship/server/schema.d.ts +28 -0
  348. package/dist/features/relationship/server/schema.d.ts.map +1 -0
  349. package/dist/features/relationship/server/schema.js +80 -0
  350. package/dist/features/relationship/server/schema.js.map +1 -0
  351. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +23 -0
  352. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -0
  353. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +34 -0
  354. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -0
  355. package/dist/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -1
  356. package/dist/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -1
  357. package/dist/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -1
  358. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  359. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  360. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +1 -2
  361. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  362. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +4 -4
  363. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  364. package/dist/features/toolbars/types.d.ts +1 -1
  365. package/dist/features/toolbars/types.d.ts.map +1 -1
  366. package/dist/features/toolbars/types.js.map +1 -1
  367. package/dist/features/typesClient.d.ts +1 -1
  368. package/dist/features/typesClient.d.ts.map +1 -1
  369. package/dist/features/typesClient.js.map +1 -1
  370. package/dist/features/typesServer.d.ts +18 -41
  371. package/dist/features/typesServer.d.ts.map +1 -1
  372. package/dist/features/typesServer.js.map +1 -1
  373. package/dist/features/upload/client/component/index.css +13 -17
  374. package/dist/features/upload/client/component/index.d.ts +1 -1
  375. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  376. package/dist/features/upload/client/component/index.js +4 -4
  377. package/dist/features/upload/client/component/index.js.map +1 -1
  378. package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
  379. package/dist/features/upload/client/nodes/UploadNode.d.ts +1 -1
  380. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  381. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  382. package/dist/features/upload/client/plugin/index.d.ts +1 -1
  383. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  384. package/dist/features/upload/client/plugin/index.js.map +1 -1
  385. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +1 -1
  386. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  387. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  388. package/dist/features/upload/server/index.d.ts +1 -0
  389. package/dist/features/upload/server/index.d.ts.map +1 -1
  390. package/dist/features/upload/server/index.js +3 -2
  391. package/dist/features/upload/server/index.js.map +1 -1
  392. package/dist/features/upload/server/nodes/UploadNode.d.ts +1 -55
  393. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  394. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  395. package/dist/features/upload/server/nodes/conversions.d.ts.map +1 -1
  396. package/dist/features/upload/server/nodes/conversions.js.map +1 -1
  397. package/dist/features/upload/server/schema.d.ts +52 -0
  398. package/dist/features/upload/server/schema.d.ts.map +1 -0
  399. package/dist/features/upload/server/schema.js +129 -0
  400. package/dist/features/upload/server/schema.js.map +1 -0
  401. package/dist/features/upload/server/validate.d.ts +1 -1
  402. package/dist/features/upload/server/validate.d.ts.map +1 -1
  403. package/dist/features/upload/server/validate.js.map +1 -1
  404. package/dist/field/Diff/converters/link.d.ts +1 -1
  405. package/dist/field/Diff/converters/link.d.ts.map +1 -1
  406. package/dist/field/Diff/converters/link.js.map +1 -1
  407. package/dist/field/Diff/converters/listitem/index.css +44 -8
  408. package/dist/field/Diff/converters/listitem/index.d.ts +1 -1
  409. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  410. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  411. package/dist/field/Diff/converters/relationship/index.css +76 -36
  412. package/dist/field/Diff/converters/relationship/index.d.ts +1 -1
  413. package/dist/field/Diff/converters/relationship/index.d.ts.map +1 -1
  414. package/dist/field/Diff/converters/relationship/index.js +10 -28
  415. package/dist/field/Diff/converters/relationship/index.js.map +1 -1
  416. package/dist/field/Diff/converters/unknown/index.js.map +1 -1
  417. package/dist/field/Diff/converters/upload/index.css +106 -43
  418. package/dist/field/Diff/converters/upload/index.d.ts +1 -1
  419. package/dist/field/Diff/converters/upload/index.d.ts.map +1 -1
  420. package/dist/field/Diff/converters/upload/index.js +6 -2
  421. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  422. package/dist/field/Diff/index.css +116 -61
  423. package/dist/field/Diff/index.js.map +1 -1
  424. package/dist/field/Field.d.ts +1 -1
  425. package/dist/field/Field.d.ts.map +1 -1
  426. package/dist/field/Field.js +3 -4
  427. package/dist/field/Field.js.map +1 -1
  428. package/dist/field/RenderLexical/index.d.ts +2 -2
  429. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  430. package/dist/field/RenderLexical/index.js.map +1 -1
  431. package/dist/field/RichTextViewProvider.d.ts +1 -1
  432. package/dist/field/RichTextViewProvider.d.ts.map +1 -1
  433. package/dist/field/RichTextViewProvider.js.map +1 -1
  434. package/dist/field/bundled.css +1 -1
  435. package/dist/field/clientEntry.d.ts +29 -0
  436. package/dist/field/clientEntry.d.ts.map +1 -0
  437. package/dist/field/clientEntry.js +86 -0
  438. package/dist/field/clientEntry.js.map +1 -0
  439. package/dist/field/index.css +9 -12
  440. package/dist/field/index.d.ts +1 -1
  441. package/dist/field/index.d.ts.map +1 -1
  442. package/dist/field/index.js +1 -1
  443. package/dist/field/index.js.map +1 -1
  444. package/dist/field/rscEntry.d.ts +1 -1
  445. package/dist/field/rscEntry.d.ts.map +1 -1
  446. package/dist/field/rscEntry.js +2 -0
  447. package/dist/field/rscEntry.js.map +1 -1
  448. package/dist/hooks.d.ts +6 -0
  449. package/dist/hooks.d.ts.map +1 -0
  450. package/dist/hooks.js +548 -0
  451. package/dist/hooks.js.map +1 -0
  452. package/dist/index.d.ts +11 -8
  453. package/dist/index.d.ts.map +1 -1
  454. package/dist/index.js +56 -622
  455. package/dist/index.js.map +1 -1
  456. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  457. package/dist/lexical/LexicalEditor.js +36 -2
  458. package/dist/lexical/LexicalEditor.js.map +1 -1
  459. package/dist/lexical/LexicalProvider.d.ts +1 -1
  460. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  461. package/dist/lexical/LexicalProvider.js +22 -7
  462. package/dist/lexical/LexicalProvider.js.map +1 -1
  463. package/dist/lexical/config/client/EditorConfigProvider.d.ts +1 -1
  464. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  465. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  466. package/dist/lexical/config/client/loader.d.ts +1 -1
  467. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  468. package/dist/lexical/config/client/loader.js +5 -1
  469. package/dist/lexical/config/client/loader.js.map +1 -1
  470. package/dist/lexical/config/client/sanitize.d.ts +1 -1
  471. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  472. package/dist/lexical/config/client/sanitize.js.map +1 -1
  473. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  474. package/dist/lexical/config/server/sanitize.js +9 -11
  475. package/dist/lexical/config/server/sanitize.js.map +1 -1
  476. package/dist/lexical/config/types.d.ts +1 -1
  477. package/dist/lexical/config/types.d.ts.map +1 -1
  478. package/dist/lexical/config/types.js.map +1 -1
  479. package/dist/lexical/nodes/index.d.ts +1 -1
  480. package/dist/lexical/nodes/index.d.ts.map +1 -1
  481. package/dist/lexical/nodes/index.js.map +1 -1
  482. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +1 -1
  483. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  484. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  485. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  486. package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -1
  487. package/dist/lexical/theme/EditorTheme.css +4 -4
  488. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  489. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts +1 -1
  490. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
  491. package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
  492. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -1
  493. package/dist/types/builtInNodes.d.ts +14 -0
  494. package/dist/types/builtInNodes.d.ts.map +1 -0
  495. package/dist/types/builtInNodes.js +203 -0
  496. package/dist/types/builtInNodes.js.map +1 -0
  497. package/dist/{types.d.ts → types/index.d.ts} +25 -26
  498. package/dist/types/index.d.ts.map +1 -0
  499. package/dist/types/index.js +2 -0
  500. package/dist/types/index.js.map +1 -0
  501. package/dist/types/jsonSchemaHelpers.d.ts +30 -0
  502. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -0
  503. package/dist/types/jsonSchemaHelpers.js +58 -0
  504. package/dist/types/jsonSchemaHelpers.js.map +1 -0
  505. package/dist/types/nodeTypes.d.ts +128 -0
  506. package/dist/types/nodeTypes.d.ts.map +1 -0
  507. package/dist/types/nodeTypes.js +6 -0
  508. package/dist/types/nodeTypes.js.map +1 -0
  509. package/dist/types/schema.d.ts +6 -0
  510. package/dist/types/schema.d.ts.map +1 -0
  511. package/dist/types/schema.js +83 -0
  512. package/dist/types/schema.js.map +1 -0
  513. package/dist/utilities/buildEditorState.d.ts +18 -4
  514. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  515. package/dist/utilities/buildEditorState.js +8 -0
  516. package/dist/utilities/buildEditorState.js.map +1 -1
  517. package/dist/utilities/buildInitialState.d.ts +2 -1
  518. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  519. package/dist/utilities/buildInitialState.js.map +1 -1
  520. package/dist/utilities/createClientFeature.d.ts +1 -1
  521. package/dist/utilities/createClientFeature.d.ts.map +1 -1
  522. package/dist/utilities/createClientFeature.js.map +1 -1
  523. package/dist/utilities/editorConfigFactory.d.ts +1 -1
  524. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  525. package/dist/utilities/editorConfigFactory.js.map +1 -1
  526. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  527. package/dist/utilities/fieldsDrawer/Drawer.js +19 -10
  528. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  529. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts +4 -1
  530. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  531. package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -7
  532. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  533. package/dist/utilities/fieldsDrawer/index.css +12 -0
  534. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +29 -0
  535. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -0
  536. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js +97 -0
  537. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -0
  538. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -1
  539. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -1
  540. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -1
  541. package/dist/utilities/generateImportMap.d.ts +1 -1
  542. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  543. package/dist/utilities/generateImportMap.js +7 -3
  544. package/dist/utilities/generateImportMap.js.map +1 -1
  545. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  546. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  547. package/dist/utilities/initLexicalFeatures.d.ts +1 -1
  548. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  549. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  550. package/dist/utilities/recurseNodeTree.d.ts.map +1 -1
  551. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  552. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  553. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  554. package/dist/validate/index.d.ts.map +1 -1
  555. package/package.json +14 -13
  556. package/dist/exports/client/Field-PJW7KUJG.js +0 -2
  557. package/dist/exports/client/Field-PJW7KUJG.js.map +0 -7
  558. package/dist/exports/client/RelationshipComponent-5RONAYJM.js.map +0 -7
  559. package/dist/exports/client/chunk-44G3K3W7.js +0 -2
  560. package/dist/exports/client/chunk-44G3K3W7.js.map +0 -7
  561. package/dist/exports/client/chunk-BZZVLW4U.js.map +0 -7
  562. package/dist/exports/client/chunk-FTT5KJ6W.js.map +0 -7
  563. package/dist/exports/client/chunk-INBEEENE.js +0 -2
  564. package/dist/exports/client/chunk-INBEEENE.js.map +0 -7
  565. package/dist/exports/client/chunk-QJ5EETIB.js +0 -2
  566. package/dist/exports/client/chunk-QJ5EETIB.js.map +0 -7
  567. package/dist/exports/client/component-53Y3RYR5.js +0 -2
  568. package/dist/exports/client/component-53Y3RYR5.js.map +0 -7
  569. package/dist/exports/client/componentInline-PM4PLNUK.js +0 -2
  570. package/dist/features/link/nodes/types.d.ts +0 -27
  571. package/dist/features/link/nodes/types.d.ts.map +0 -1
  572. package/dist/features/link/nodes/types.js +0 -2
  573. package/dist/features/link/nodes/types.js.map +0 -1
  574. package/dist/nodeTypes.d.ts +0 -74
  575. package/dist/nodeTypes.d.ts.map +0 -1
  576. package/dist/nodeTypes.js +0 -5
  577. package/dist/nodeTypes.js.map +0 -1
  578. package/dist/types.d.ts.map +0 -1
  579. package/dist/types.js +0 -2
  580. package/dist/types.js.map +0 -1
  581. /package/dist/exports/client/{componentInline-PM4PLNUK.js.map → componentInline-R3EPNYWF.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["jsx","_jsx","Fragment","_Fragment","React","hasText","createConverterFromNodeMapValue","viewDef","args","converterArgs","isEditor","isJSXConverter","Component","html","htmlContent","dangerouslySetInnerHTML","__html","createConverterFromBlockValue","Block","blockNode","node","blockProps","childIndex","converters","formData","fields","nodesToJSX","parent","createElement","nodeMapToConverters","nodeMap","nodeType","value","Object","entries","blocks","blockType","_viewDef","inlineBlocks","convertLexicalToJSX","data","disableIndent","disableTextAlign","nodeMapConverters","undefined","mergedConverters","convertLexicalNodesToJSX","nodes","root","children","unknownConverter","unknown","jsxArray","map","i","converterForNode","type","console","error","reactNode","converted","style","Array","isArray","includes","format","textAlign","indent","paddingInlineStart","Number","isValidElement","newStyle","props","cloneElement","key","filter","Boolean"],"sources":["../../../../../src/features/converters/lexicalToJSX/converter/index.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { SerializedEditorState, SerializedLexicalNode } from 'lexical'\n\nimport React from 'react'\n\nimport type { SerializedBlockNode, SerializedInlineBlockNode } from '../../../../nodeTypes.js'\nimport type {\n LexicalEditorNodeMap,\n NodeMapBlockValue,\n NodeMapValue,\n SerializedNodeBase,\n ViewMapBlockJSXConverterProps,\n} from '../../../../types.js'\nimport type { JSXConverter, JSXConverters, SerializedLexicalNodeWithParent } from './types.js'\n\nimport { hasText } from '../../../../validate/hasText.js'\n\n/**\n * Creates a JSX converter from a NodeMapValue\n */\nfunction createConverterFromNodeMapValue(viewDef: NodeMapValue): JSXConverter {\n return (args) => {\n const converterArgs = {\n ...args,\n isEditor: false as const,\n isJSXConverter: true as const,\n }\n\n // If Component is provided, use it\n if (viewDef.Component) {\n return viewDef.Component(converterArgs)\n }\n\n // If html is provided (as a function or string), use it\n // Note: Using span instead of div to avoid forcing block-level semantics\n if (viewDef.html) {\n const htmlContent =\n typeof viewDef.html === 'function' ? viewDef.html(converterArgs) : viewDef.html\n\n return <span dangerouslySetInnerHTML={{ __html: htmlContent }} />\n }\n\n return null\n }\n}\n\n/**\n * Creates a JSX converter from a NodeMapBlockValue (for blocks/inlineBlocks)\n * This also checks for Block FC as a fallback when Component is not defined.\n */\nfunction createConverterFromBlockValue(viewDef: NodeMapBlockValue<any>): JSXConverter {\n return (args) => {\n // Priority: Component > Block > html\n if (viewDef.Component) {\n const converterArgs = {\n ...args,\n isEditor: false as const,\n isJSXConverter: true as const,\n }\n return viewDef.Component(converterArgs)\n }\n\n // Use Block FC with JSX converter props\n if (viewDef.Block) {\n const blockNode = args.node as SerializedBlockNode\n const blockProps: ViewMapBlockJSXConverterProps<any> = {\n childIndex: args.childIndex,\n converters: args.converters,\n formData: blockNode.fields ?? {},\n isEditor: false,\n isJSXConverter: true,\n node: blockNode,\n nodesToJSX: args.nodesToJSX,\n parent: args.parent,\n }\n return React.createElement(viewDef.Block, blockProps)\n }\n\n if (viewDef.html) {\n const converterArgs = {\n ...args,\n isEditor: false as const,\n isJSXConverter: true as const,\n }\n const htmlContent =\n typeof viewDef.html === 'function' ? viewDef.html(converterArgs) : viewDef.html\n\n return <span dangerouslySetInnerHTML={{ __html: htmlContent }} />\n }\n\n return null\n }\n}\n\n/**\n * Converts a LexicalEditorNodeMap into JSXConverters\n */\nfunction nodeMapToConverters<TNodes extends SerializedNodeBase = SerializedNodeBase>(\n nodeMap: LexicalEditorNodeMap<TNodes>,\n): JSXConverters {\n const converters: JSXConverters = {}\n\n for (const [nodeType, value] of Object.entries(nodeMap)) {\n if (!value || typeof value !== 'object') {\n continue\n }\n\n // Handle special keys: blocks, inlineBlocks\n if (nodeType === 'blocks') {\n converters.blocks = {}\n for (const [blockType, _viewDef] of Object.entries(value)) {\n const viewDef = _viewDef as NodeMapBlockValue<any>\n // Check for Component, Block, or html\n if (viewDef.Component || viewDef.Block || viewDef.html) {\n converters.blocks[blockType] = createConverterFromBlockValue(viewDef)\n }\n }\n continue\n }\n\n if (nodeType === 'inlineBlocks') {\n converters.inlineBlocks = {}\n for (const [blockType, _viewDef] of Object.entries(value)) {\n const viewDef = _viewDef as NodeMapBlockValue<any>\n // Check for Component, Block, or html\n if (viewDef.Component || viewDef.Block || viewDef.html) {\n converters.inlineBlocks[blockType] = createConverterFromBlockValue(viewDef)\n }\n }\n continue\n }\n\n // Handle regular node types\n const viewDef = value as NodeMapValue\n\n if (viewDef.Component || viewDef.html) {\n converters[nodeType] = createConverterFromNodeMapValue(viewDef)\n }\n }\n\n return converters\n}\n\nexport type ConvertLexicalToJSXArgs<TNodes extends SerializedNodeBase = SerializedNodeBase> = {\n converters: JSXConverters\n /**\n * Serialized editor state to render.\n */\n data: SerializedEditorState\n /**\n * If true, disables indentation globally. If an array, disables for specific node `type` values.\n */\n disableIndent?: boolean | string[]\n /**\n * If true, disables text alignment globally. If an array, disables for specific node `type` values.\n */\n disableTextAlign?: boolean | string[]\n /**\n * You can use the lexical editor node map or view map as converters. NodeMap converters will override converters passed\n * in the `converters` prop. If a LexicalEditorViewMap is provided, the `default` view will be used.\n */\n nodeMap?: LexicalEditorNodeMap<TNodes>\n}\n\nexport function convertLexicalToJSX<TNodes extends SerializedNodeBase = SerializedNodeBase>({\n converters,\n data,\n disableIndent,\n disableTextAlign,\n nodeMap,\n}: ConvertLexicalToJSXArgs<TNodes>): React.ReactNode {\n if (hasText(data)) {\n // Merge nodeMap converters with existing converters\n // NodeMap converters override existing converters\n const nodeMapConverters = nodeMap ? nodeMapToConverters(nodeMap) : undefined\n const mergedConverters = nodeMapConverters\n ? {\n ...converters,\n ...nodeMapConverters,\n blocks: { ...converters.blocks, ...nodeMapConverters.blocks },\n inlineBlocks: { ...converters.inlineBlocks, ...nodeMapConverters.inlineBlocks },\n }\n : converters\n\n return convertLexicalNodesToJSX({\n converters: mergedConverters,\n disableIndent,\n disableTextAlign,\n nodes: data.root.children,\n parent: data.root,\n })\n }\n return <></>\n}\n\nexport function convertLexicalNodesToJSX({\n converters,\n disableIndent,\n disableTextAlign,\n nodes,\n parent,\n}: {\n converters: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent: SerializedLexicalNodeWithParent\n}): React.ReactNode[] {\n const unknownConverter: JSXConverter<any> = converters.unknown as JSXConverter<any>\n\n const jsxArray: React.ReactNode[] = nodes.map((node, i) => {\n let converterForNode: JSXConverter<any> | undefined\n if (node.type === 'block') {\n converterForNode = converters?.blocks?.[(node as SerializedBlockNode)?.fields?.blockType]\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => JSX converter: Blocks converter: found ${(node as SerializedBlockNode)?.fields?.blockType} block, but no converter is provided`,\n )\n }\n } else if (node.type === 'inlineBlock') {\n converterForNode =\n converters?.inlineBlocks?.[(node as SerializedInlineBlockNode)?.fields?.blockType]\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => JSX converter: Inline Blocks converter: found ${(node as SerializedInlineBlockNode)?.fields?.blockType} inline block, but no converter is provided`,\n )\n }\n } else {\n converterForNode = converters[node.type] as JSXConverter<any>\n }\n\n try {\n if (!converterForNode && unknownConverter) {\n converterForNode = unknownConverter\n }\n\n let reactNode: React.ReactNode\n if (converterForNode) {\n const converted =\n typeof converterForNode === 'function'\n ? converterForNode({\n childIndex: i,\n converters,\n node,\n nodesToJSX: (args) => {\n return convertLexicalNodesToJSX({\n converters: args.converters ?? converters,\n disableIndent: args.disableIndent ?? disableIndent,\n disableTextAlign: args.disableTextAlign ?? disableTextAlign,\n nodes: args.nodes,\n parent: args.parent ?? {\n ...node,\n parent,\n },\n })\n },\n parent,\n })\n : converterForNode\n reactNode = converted\n } else {\n reactNode = <span key={i}>unknown node</span>\n }\n\n const style: React.CSSProperties = {}\n\n // Check if disableTextAlign is not true and does not include node type\n if (\n !disableTextAlign &&\n (!Array.isArray(disableTextAlign) || !disableTextAlign?.includes(node.type))\n ) {\n if ('format' in node && node.format) {\n switch (node.format) {\n case 'center':\n style.textAlign = 'center'\n break\n case 'end':\n style.textAlign = 'right'\n break\n case 'justify':\n style.textAlign = 'justify'\n break\n case 'left':\n //style.textAlign = 'left'\n // Do nothing, as left is the default\n break\n case 'right':\n style.textAlign = 'right'\n break\n case 'start':\n style.textAlign = 'left'\n break\n }\n }\n }\n\n if (\n !disableIndent &&\n (!Array.isArray(disableIndent) || !disableIndent?.includes(node.type))\n ) {\n if ('indent' in node && node.indent && node.type !== 'listitem') {\n // the unit should be px. Do not change it to rem, em, or something else.\n // The quantity should be 40px. Do not change it either.\n // See rationale in\n // https://github.com/payloadcms/payload/issues/13130#issuecomment-3058348085\n style.paddingInlineStart = `${Number(node.indent) * 40}px`\n }\n }\n\n if (React.isValidElement(reactNode)) {\n // Inject style into reactNode\n if (style.textAlign || style.paddingInlineStart) {\n const newStyle = {\n ...style,\n // @ts-expect-error type better later\n ...(reactNode?.props?.style ?? {}),\n // reactNode style comes after, thus a textAlign specified in the converter has priority over the one we inject here\n }\n\n return React.cloneElement(reactNode, {\n key: i,\n // @ts-expect-error type better later\n style: newStyle,\n })\n }\n return React.cloneElement(reactNode, {\n key: i,\n })\n }\n\n return reactNode\n } catch (error) {\n console.error('Error converting lexical node to JSX:', error, 'node:', node)\n return null\n }\n })\n\n return jsxArray.filter(Boolean)\n}\n"],"mappings":"AAAA,+BAA6B,SAAAA,GAAA,IAAAC,IAAA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,CAAOjD,IAAA,CAAK+C,MAAM,IAAI,MAAM;QAC5D;MACF;MAEA,iBAAI/D,KAAA,CAAMkE,cAAc,CAACX,SAAA,GAAY;QACnC;QACA,IAAIE,KAAA,CAAMK,SAAS,IAAIL,KAAA,CAAMO,kBAAkB,EAAE;UAC/C,MAAMG,QAAA,GAAW;YACf,GAAGV,KAAK;YACR;YACA,IAAIF,SAAA,EAAWa,KAAA,EAAOX,KAAA,IAAS,CAAC,CAAC;UAEnC;UAEA,oBAAOzD,KAAA,CAAMqE,YAAY,CAACd,SAAA,EAAW;YACnCe,GAAA,EAAKpB,CAAA;YACL;YACAO,KAAA,EAAOU;UACT;QACF;QACA,oBAAOnE,KAAA,CAAMqE,YAAY,CAACd,SAAA,EAAW;UACnCe,GAAA,EAAKpB;QACP;MACF;MAEA,OAAOK,SAAA;IACT,EAAE,OAAOD,KAAA,EAAO;MACdD,OAAA,CAAQC,KAAK,CAAC,yCAAyCA,KAAA,EAAO,SAAStC,IAAA;MACvE,OAAO;IACT;EACF;EAEA,OAAOgC,QAAA,CAASuB,MAAM,CAACC,OAAA;AACzB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["jsx","_jsx","Fragment","_Fragment","React","hasText","createConverterFromNodeMapValue","viewDef","args","converterArgs","isEditor","isJSXConverter","Component","html","htmlContent","dangerouslySetInnerHTML","__html","createConverterFromBlockValue","Block","blockNode","node","blockProps","childIndex","converters","formData","fields","nodesToJSX","parent","createElement","nodeMapToConverters","nodeMap","nodeType","value","Object","entries","blocks","blockType","_viewDef","inlineBlocks","convertLexicalToJSX","data","disableIndent","disableTextAlign","nodeMapConverters","undefined","mergedConverters","convertLexicalNodesToJSX","nodes","root","children","unknownConverter","unknown","jsxArray","map","i","converterForNode","type","console","error","reactNode","converted","style","Array","isArray","includes","format","textAlign","indent","paddingInlineStart","Number","isValidElement","newStyle","props","cloneElement","key","filter","Boolean"],"sources":["../../../../../src/features/converters/lexicalToJSX/converter/index.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { SerializedEditorState, SerializedLexicalNode } from 'lexical'\n\nimport React from 'react'\n\nimport type {\n LexicalEditorNodeMap,\n NodeMapBlockValue,\n NodeMapValue,\n SerializedNodeBase,\n ViewMapBlockJSXConverterProps,\n} from '../../../../types/index.js'\nimport type { SerializedBlockNode, SerializedInlineBlockNode } from '../../../../types/nodeTypes.js'\nimport type { JSXConverter, JSXConverters, SerializedLexicalNodeWithParent } from './types.js'\n\nimport { hasText } from '../../../../validate/hasText.js'\n\n/**\n * Creates a JSX converter from a NodeMapValue\n */\nfunction createConverterFromNodeMapValue(viewDef: NodeMapValue): JSXConverter {\n return (args) => {\n const converterArgs = {\n ...args,\n isEditor: false as const,\n isJSXConverter: true as const,\n }\n\n // If Component is provided, use it\n if (viewDef.Component) {\n return viewDef.Component(converterArgs)\n }\n\n // If html is provided (as a function or string), use it\n // Note: Using span instead of div to avoid forcing block-level semantics\n if (viewDef.html) {\n const htmlContent =\n typeof viewDef.html === 'function' ? viewDef.html(converterArgs) : viewDef.html\n\n return <span dangerouslySetInnerHTML={{ __html: htmlContent }} />\n }\n\n return null\n }\n}\n\n/**\n * Creates a JSX converter from a NodeMapBlockValue (for blocks/inlineBlocks)\n * This also checks for Block FC as a fallback when Component is not defined.\n */\nfunction createConverterFromBlockValue(viewDef: NodeMapBlockValue<any>): JSXConverter {\n return (args) => {\n // Priority: Component > Block > html\n if (viewDef.Component) {\n const converterArgs = {\n ...args,\n isEditor: false as const,\n isJSXConverter: true as const,\n }\n return viewDef.Component(converterArgs)\n }\n\n // Use Block FC with JSX converter props\n if (viewDef.Block) {\n const blockNode = args.node as SerializedBlockNode\n const blockProps: ViewMapBlockJSXConverterProps<any> = {\n childIndex: args.childIndex,\n converters: args.converters,\n formData: blockNode.fields ?? {},\n isEditor: false,\n isJSXConverter: true,\n node: blockNode,\n nodesToJSX: args.nodesToJSX,\n parent: args.parent,\n }\n return React.createElement(viewDef.Block, blockProps)\n }\n\n if (viewDef.html) {\n const converterArgs = {\n ...args,\n isEditor: false as const,\n isJSXConverter: true as const,\n }\n const htmlContent =\n typeof viewDef.html === 'function' ? viewDef.html(converterArgs) : viewDef.html\n\n return <span dangerouslySetInnerHTML={{ __html: htmlContent }} />\n }\n\n return null\n }\n}\n\n/**\n * Converts a LexicalEditorNodeMap into JSXConverters\n */\nfunction nodeMapToConverters<TNodes extends SerializedNodeBase = SerializedNodeBase>(\n nodeMap: LexicalEditorNodeMap<TNodes>,\n): JSXConverters {\n const converters: JSXConverters = {}\n\n for (const [nodeType, value] of Object.entries(nodeMap)) {\n if (!value || typeof value !== 'object') {\n continue\n }\n\n // Handle special keys: blocks, inlineBlocks\n if (nodeType === 'blocks') {\n converters.blocks = {}\n for (const [blockType, _viewDef] of Object.entries(value)) {\n const viewDef = _viewDef as NodeMapBlockValue<any>\n // Check for Component, Block, or html\n if (viewDef.Component || viewDef.Block || viewDef.html) {\n converters.blocks[blockType] = createConverterFromBlockValue(viewDef)\n }\n }\n continue\n }\n\n if (nodeType === 'inlineBlocks') {\n converters.inlineBlocks = {}\n for (const [blockType, _viewDef] of Object.entries(value)) {\n const viewDef = _viewDef as NodeMapBlockValue<any>\n // Check for Component, Block, or html\n if (viewDef.Component || viewDef.Block || viewDef.html) {\n converters.inlineBlocks[blockType] = createConverterFromBlockValue(viewDef)\n }\n }\n continue\n }\n\n // Handle regular node types\n const viewDef = value as NodeMapValue\n\n if (viewDef.Component || viewDef.html) {\n converters[nodeType] = createConverterFromNodeMapValue(viewDef)\n }\n }\n\n return converters\n}\n\nexport type ConvertLexicalToJSXArgs<TNodes extends SerializedNodeBase = SerializedNodeBase> = {\n converters: JSXConverters\n /**\n * Serialized editor state to render.\n */\n data: SerializedEditorState\n /**\n * If true, disables indentation globally. If an array, disables for specific node `type` values.\n */\n disableIndent?: boolean | string[]\n /**\n * If true, disables text alignment globally. If an array, disables for specific node `type` values.\n */\n disableTextAlign?: boolean | string[]\n /**\n * You can use the lexical editor node map or view map as converters. NodeMap converters will override converters passed\n * in the `converters` prop. If a LexicalEditorViewMap is provided, the `default` view will be used.\n */\n nodeMap?: LexicalEditorNodeMap<TNodes>\n}\n\nexport function convertLexicalToJSX<TNodes extends SerializedNodeBase = SerializedNodeBase>({\n converters,\n data,\n disableIndent,\n disableTextAlign,\n nodeMap,\n}: ConvertLexicalToJSXArgs<TNodes>): React.ReactNode {\n if (hasText(data)) {\n // Merge nodeMap converters with existing converters\n // NodeMap converters override existing converters\n const nodeMapConverters = nodeMap ? nodeMapToConverters(nodeMap) : undefined\n const mergedConverters = nodeMapConverters\n ? {\n ...converters,\n ...nodeMapConverters,\n blocks: { ...converters.blocks, ...nodeMapConverters.blocks },\n inlineBlocks: { ...converters.inlineBlocks, ...nodeMapConverters.inlineBlocks },\n }\n : converters\n\n return convertLexicalNodesToJSX({\n converters: mergedConverters,\n disableIndent,\n disableTextAlign,\n nodes: data.root.children,\n parent: data.root,\n })\n }\n return <></>\n}\n\nexport function convertLexicalNodesToJSX({\n converters,\n disableIndent,\n disableTextAlign,\n nodes,\n parent,\n}: {\n converters: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent: SerializedLexicalNodeWithParent\n}): React.ReactNode[] {\n const unknownConverter: JSXConverter<any> = converters.unknown as JSXConverter<any>\n\n const jsxArray: React.ReactNode[] = nodes.map((node, i) => {\n let converterForNode: JSXConverter<any> | undefined\n if (node.type === 'block') {\n converterForNode = converters?.blocks?.[(node as SerializedBlockNode)?.fields?.blockType]\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => JSX converter: Blocks converter: found ${(node as SerializedBlockNode)?.fields?.blockType} block, but no converter is provided`,\n )\n }\n } else if (node.type === 'inlineBlock') {\n converterForNode =\n converters?.inlineBlocks?.[(node as SerializedInlineBlockNode)?.fields?.blockType]\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => JSX converter: Inline Blocks converter: found ${(node as SerializedInlineBlockNode)?.fields?.blockType} inline block, but no converter is provided`,\n )\n }\n } else {\n converterForNode = converters[node.type] as JSXConverter<any>\n }\n\n try {\n if (!converterForNode && unknownConverter) {\n converterForNode = unknownConverter\n }\n\n let reactNode: React.ReactNode\n if (converterForNode) {\n const converted =\n typeof converterForNode === 'function'\n ? converterForNode({\n childIndex: i,\n converters,\n node,\n nodesToJSX: (args) => {\n return convertLexicalNodesToJSX({\n converters: args.converters ?? converters,\n disableIndent: args.disableIndent ?? disableIndent,\n disableTextAlign: args.disableTextAlign ?? disableTextAlign,\n nodes: args.nodes,\n parent: args.parent ?? {\n ...node,\n parent,\n },\n })\n },\n parent,\n })\n : converterForNode\n reactNode = converted\n } else {\n reactNode = <span key={i}>unknown node</span>\n }\n\n const style: React.CSSProperties = {}\n\n // Check if disableTextAlign is not true and does not include node type\n if (\n !disableTextAlign &&\n (!Array.isArray(disableTextAlign) || !disableTextAlign?.includes(node.type))\n ) {\n if ('format' in node && node.format) {\n switch (node.format) {\n case 'center':\n style.textAlign = 'center'\n break\n case 'end':\n style.textAlign = 'right'\n break\n case 'justify':\n style.textAlign = 'justify'\n break\n case 'left':\n //style.textAlign = 'left'\n // Do nothing, as left is the default\n break\n case 'right':\n style.textAlign = 'right'\n break\n case 'start':\n style.textAlign = 'left'\n break\n }\n }\n }\n\n if (\n !disableIndent &&\n (!Array.isArray(disableIndent) || !disableIndent?.includes(node.type))\n ) {\n if ('indent' in node && node.indent && node.type !== 'listitem') {\n // the unit should be px. Do not change it to rem, em, or something else.\n // The quantity should be 40px. Do not change it either.\n // See rationale in\n // https://github.com/payloadcms/payload/issues/13130#issuecomment-3058348085\n style.paddingInlineStart = `${Number(node.indent) * 40}px`\n }\n }\n\n if (React.isValidElement(reactNode)) {\n // Inject style into reactNode\n if (style.textAlign || style.paddingInlineStart) {\n const newStyle = {\n ...style,\n // @ts-expect-error type better later\n ...(reactNode?.props?.style ?? {}),\n // reactNode style comes after, thus a textAlign specified in the converter has priority over the one we inject here\n }\n\n return React.cloneElement(reactNode, {\n key: i,\n // @ts-expect-error type better later\n style: newStyle,\n })\n }\n return React.cloneElement(reactNode, {\n key: i,\n })\n }\n\n return reactNode\n } catch (error) {\n console.error('Error converting lexical node to JSX:', error, 'node:', node)\n return null\n }\n })\n\n return jsxArray.filter(Boolean)\n}\n"],"mappings":"AAAA,+BAA6B,SAAAA,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA;AAG7B,OAAOC,KAAA,MAAW;AAYlB,SAASC,OAAO,QAAQ;AAExB;;;AAGA,SAASC,gCAAgCC,OAAqB;EAC5D,OAAQC,IAAA;IACN,MAAMC,aAAA,GAAgB;MACpB,GAAGD,IAAI;MACPE,QAAA,EAAU;MACVC,cAAA,EAAgB;IAClB;IAEA;IACA,IAAIJ,OAAA,CAAQK,SAAS,EAAE;MACrB,OAAOL,OAAA,CAAQK,SAAS,CAACH,aAAA;IAC3B;IAEA;IACA;IACA,IAAIF,OAAA,CAAQM,IAAI,EAAE;MAChB,MAAMC,WAAA,GACJ,OAAOP,OAAA,CAAQM,IAAI,KAAK,aAAaN,OAAA,CAAQM,IAAI,CAACJ,aAAA,IAAiBF,OAAA,CAAQM,IAAI;MAEjF,oBAAOZ,IAAA,CAAC;QAAKc,uBAAA,EAAyB;UAAEC,MAAA,EAAQF;QAAY;;IAC9D;IAEA,OAAO;EACT;AACF;AAEA;;;;AAIA,SAASG,8BAA8BV,OAA+B;EACpE,OAAQC,IAAA;IACN;IACA,IAAID,OAAA,CAAQK,SAAS,EAAE;MACrB,MAAMH,aAAA,GAAgB;QACpB,GAAGD,IAAI;QACPE,QAAA,EAAU;QACVC,cAAA,EAAgB;MAClB;MACA,OAAOJ,OAAA,CAAQK,SAAS,CAACH,aAAA;IAC3B;IAEA;IACA,IAAIF,OAAA,CAAQW,KAAK,EAAE;MACjB,MAAMC,SAAA,GAAYX,IAAA,CAAKY,IAAI;MAC3B,MAAMC,UAAA,GAAiD;QACrDC,UAAA,EAAYd,IAAA,CAAKc,UAAU;QAC3B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AkB,CAACA,aAAA,EAAeuB,QAAA,CAAS5C,IAAA,CAAKoC,IAAI,IACpE;QACA,IAAI,YAAYpC,IAAA,IAAQA,IAAA,CAAK+C,MAAM,IAAI/C,IAAA,CAAKoC,IAAI,KAAK,YAAY;UAC/D;UACA;UACA;UACA;UACAK,KAAA,CAAMO,kBAAkB,GAAG,GAAGC,MAAA,CAAOjD,IAAA,CAAK+C,MAAM,IAAI,MAAM;QAC5D;MACF;MAEA,iBAAI/D,KAAA,CAAMkE,cAAc,CAACX,SAAA,GAAY;QACnC;QACA,IAAIE,KAAA,CAAMK,SAAS,IAAIL,KAAA,CAAMO,kBAAkB,EAAE;UAC/C,MAAMG,QAAA,GAAW;YACf,GAAGV,KAAK;YACR;YACA,IAAIF,SAAA,EAAWa,KAAA,EAAOX,KAAA,IAAS,CAAC,CAAC;UAEnC;UAEA,oBAAOzD,KAAA,CAAMqE,YAAY,CAACd,SAAA,EAAW;YACnCe,GAAA,EAAKpB,CAAA;YACL;YACAO,KAAA,EAAOU;UACT;QACF;QACA,oBAAOnE,KAAA,CAAMqE,YAAY,CAACd,SAAA,EAAW;UACnCe,GAAA,EAAKpB;QACP;MACF;MAEA,OAAOK,SAAA;IACT,EAAE,OAAOD,KAAA,EAAO;MACdD,OAAA,CAAQC,KAAK,CAAC,yCAAyCA,KAAA,EAAO,SAAStC,IAAA;MACvE,OAAO;IACT;EACF;EAEA,OAAOgC,QAAA,CAASuB,MAAM,CAACC,OAAA;AACzB","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { SerializedLexicalNode } from 'lexical';
2
- import type { DefaultNodeTypes, SerializedBlockNode, SerializedInlineBlockNode } from '../../../../nodeTypes.js';
2
+ import type { DefaultNodeTypes, SerializedBlockNode, SerializedInlineBlockNode } from '../../../../types/nodeTypes.js';
3
3
  export type JSXConverterArgs<TNode extends {
4
4
  [key: string]: any;
5
5
  type?: string;
@@ -39,26 +39,24 @@ export type JSXConverters<TNodes extends {
39
39
  }>>;
40
40
  } & {
41
41
  blocks?: {
42
- [K in Extract<Extract<TNodes, {
42
+ [K in Extract<TNodes, {
43
43
  type: 'block';
44
- }> extends SerializedBlockNode<infer B> ? B extends {
45
- blockType: string;
46
- } ? B['blockType'] : never : never, string>]?: JSXConverter<Extract<TNodes, {
44
+ }>['fields']['blockType']]?: JSXConverter<Extract<TNodes, {
45
+ fields: {
46
+ blockType: K;
47
+ };
47
48
  type: 'block';
48
- }> extends SerializedBlockNode<infer B> ? SerializedBlockNode<Extract<B, {
49
- blockType: K;
50
- }>> : SerializedBlockNode>;
49
+ }>>;
51
50
  };
52
51
  inlineBlocks?: {
53
- [K in Extract<Extract<TNodes, {
52
+ [K in Extract<TNodes, {
54
53
  type: 'inlineBlock';
55
- }> extends SerializedInlineBlockNode<infer B> ? B extends {
56
- blockType: string;
57
- } ? B['blockType'] : never : never, string>]?: JSXConverter<Extract<TNodes, {
54
+ }>['fields']['blockType']]?: JSXConverter<Extract<TNodes, {
55
+ fields: {
56
+ blockType: K;
57
+ };
58
58
  type: 'inlineBlock';
59
- }> extends SerializedInlineBlockNode<infer B> ? SerializedInlineBlockNode<Extract<B, {
60
- blockType: K;
61
- }>> : SerializedInlineBlockNode>;
59
+ }>>;
62
60
  };
63
61
  unknown?: JSXConverter<SerializedLexicalNode>;
64
62
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToJSX/converter/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAA;AAEjC,MAAM,MAAM,gBAAgB,CAC1B,KAAK,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,IACzE;IACF,UAAU,EAAE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SAAE,CAAC,CAAC,GACvD,yBAAyB,CAC9B;KACF,CAAA;IACD,OAAO,CAAC,EAAE,YAAY,CAAC,qBAAqB,CAAC,CAAA;CAC9C,CAAA;AACD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,CAAC,EAAE,qBAAqB,CAAA;CAC/B,GAAG,qBAAqB,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToJSX/converter/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,gCAAgC,CAAA;AAEvC,MAAM,MAAM,gBAAgB,CAC1B,KAAK,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,IACzE;IACF,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,aAAa,CAAA;IACzB,IAAI,EAAE,KAAK,CAAA;IACX,UAAU,EAAE,CAAC,IAAI,EAAE;QACjB,UAAU,CAAC,EAAE,aAAa,CAAA;QAC1B,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;QAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;QACrC,KAAK,EAAE,qBAAqB,EAAE,CAAA;QAC9B,MAAM,CAAC,EAAE,+BAA+B,CAAA;KACzC,KAAK,KAAK,CAAC,SAAS,EAAE,CAAA;IACvB,MAAM,EAAE,+BAA+B,CAAA;CACxC,CAAA;AACD,MAAM,MAAM,YAAY,CACtB,KAAK,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,IACzE,CAAC,CAAC,IAAI,EAAE,gBAAg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,EAAE,aAAa,CAAA;SAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,YAAY,CACnF,OAAO,CAAC,MAAM,EAAE;YAAE,MAAM,EAAE;gBAAE,SAAS,EAAE,CAAC,CAAA;aAAE,CAAC;YAAC,IAAI,EAAE,aAAa,CAAA;SAAE,CAAC,CACnE;KACF,CAAA;IACD,OAAO,CAAC,EAAE,YAAY,CAAC,qBAAqB,CAAC,CAAA;CAC9C,CAAA;AACD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,CAAC,EAAE,qBAAqB,CAAA;CAC/B,GAAG,qBAAqB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/features/converters/lexicalToJSX/converter/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../nodeTypes.js'\n\nexport type JSXConverterArgs<\n TNode extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> = {\n childIndex: number\n converters: JSXConverters\n node: TNode\n nodesToJSX: (args: {\n converters?: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => React.ReactNode[]\n parent: SerializedLexicalNodeWithParent\n}\nexport type JSXConverter<\n TNode extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> = ((args: JSXConverterArgs<TNode>) => React.ReactNode) | React.ReactNode\n\nexport type JSXConverters<\n TNodes extends { [key: string]: any; type?: string } =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n [key: string]:\n | {\n [blockSlug: string]: JSXConverter<any>\n }\n | JSXConverter<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<TNodes['type']>, 'block' | 'inlineBlock'>]?: JSXConverter<\n Extract<TNodes, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract<\n Extract<TNodes, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: JSXConverter<\n Extract<TNodes, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? SerializedBlockNode<Extract<B, { blockType: K }>>\n : SerializedBlockNode\n >\n }\n inlineBlocks?: {\n [K in Extract<\n Extract<TNodes, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: JSXConverter<\n Extract<TNodes, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? SerializedInlineBlockNode<Extract<B, { blockType: K }>>\n : SerializedInlineBlockNode\n >\n }\n unknown?: JSXConverter<SerializedLexicalNode>\n}\nexport type SerializedLexicalNodeWithParent = {\n parent?: SerializedLexicalNode\n} & SerializedLexicalNode\n"],"mappings":"AA0EA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/features/converters/lexicalToJSX/converter/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../types/nodeTypes.js'\n\nexport type JSXConverterArgs<\n TNode extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> = {\n childIndex: number\n converters: JSXConverters\n node: TNode\n nodesToJSX: (args: {\n converters?: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => React.ReactNode[]\n parent: SerializedLexicalNodeWithParent\n}\nexport type JSXConverter<\n TNode extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> = ((args: JSXConverterArgs<TNode>) => React.ReactNode) | React.ReactNode\n\nexport type JSXConverters<\n TNodes extends { [key: string]: any; type?: string } =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n [key: string]:\n | {\n [blockSlug: string]: JSXConverter<any>\n }\n | JSXConverter<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<TNodes['type']>, 'block' | 'inlineBlock'>]?: JSXConverter<\n Extract<TNodes, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract<TNodes, { type: 'block' }>['fields']['blockType']]?: JSXConverter<\n Extract<TNodes, { fields: { blockType: K }; type: 'block' }>\n >\n }\n inlineBlocks?: {\n [K in Extract<TNodes, { type: 'inlineBlock' }>['fields']['blockType']]?: JSXConverter<\n Extract<TNodes, { fields: { blockType: K }; type: 'inlineBlock' }>\n >\n }\n unknown?: JSXConverter<SerializedLexicalNode>\n}\nexport type SerializedLexicalNodeWithParent = {\n parent?: SerializedLexicalNode\n} & SerializedLexicalNode\n"],"mappings":"AAwDA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/converters/lexicalToMarkdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIpD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAA;AAKnF,eAAO,MAAM,wBAAwB,4BAGlC;IACD,IAAI,EAAE,qBAAqB,CAAA;IAC3B,YAAY,EAAE,2BAA2B,CAAA;CAC1C,KAAG,MAoBH,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/converters/lexicalToMarkdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIpD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAA;AAKnF,eAAO,MAAM,wBAAwB,GAAI,yBAGtC;IACD,IAAI,EAAE,qBAAqB,CAAA;IAC3B,YAAY,EAAE,2BAA2B,CAAA;CAC1C,KAAG,MAoBH,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"convertLexicalToPlaintext.spec.js","names":["describe","it","expect","convertLexicalToPlaintext","textNode","text","bold","type","detail","format","mode","style","version","linebreakNode","tabNode","paragraphNode","children","direction","indent","textFormat","headingNode","tag","listItemNode","checked","value","listNode","listType","start","tableNode","tableRowNode","tableCellNode","headerState","rootNode","nodes","root","data","plaintext","toBe"],"sources":["../../../../src/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.ts"],"sourcesContent":["import { describe, it, expect } from 'vitest'\nimport type {\n DefaultNodeTypes,\n DefaultTypedEditorState,\n SerializedTabNode,\n SerializedParagraphNode,\n SerializedTextNode,\n SerializedLineBreakNode,\n SerializedHeadingNode,\n SerializedListItemNode,\n SerializedListNode,\n SerializedTableRowNode,\n SerializedTableNode,\n SerializedTableCellNode,\n} from '../../../nodeTypes.js'\nimport { convertLexicalToPlaintext } from './sync/index.js'\n\nfunction textNode(text: string, bold?: boolean): SerializedTextNode {\n return {\n type: 'text',\n detail: 0,\n format: bold ? 1 : 0,\n mode: 'normal',\n style: '',\n text,\n version: 1,\n }\n}\n\nfunction linebreakNode(): SerializedLineBreakNode {\n return {\n type: 'linebreak',\n version: 1,\n }\n}\n\nfunction tabNode(): SerializedTabNode {\n return {\n type: 'tab',\n detail: 0,\n format: 0,\n mode: 'normal',\n style: '',\n text: '',\n version: 1,\n }\n}\n\nfunction paragraphNode(children: DefaultNodeTypes[]): SerializedParagraphNode {\n return {\n type: 'paragraph',\n children,\n direction: 'ltr',\n format: '',\n indent: 0,\n textFormat: 0,\n version: 1,\n }\n}\n\nfunction headingNode(children: DefaultNodeTypes[]): SerializedHeadingNode {\n return {\n type: 'heading',\n children,\n direction: 'ltr',\n format: '',\n indent: 0,\n textFormat: 0,\n tag: 'h1',\n version: 1,\n }\n}\n\nfunction listItemNode(children: DefaultNodeTypes[]): SerializedListItemNode {\n return {\n type: 'listitem',\n children,\n checked: false,\n direction: 'ltr',\n format: '',\n indent: 0,\n value: 0,\n version: 1,\n }\n}\n\nfunction listNode(children: DefaultNodeTypes[]): SerializedListNode {\n return {\n type: 'list',\n children,\n direction: 'ltr',\n format: '',\n indent: 0,\n listType: 'bullet',\n start: 0,\n tag: 'ul',\n version: 1,\n }\n}\n\nfunction tableNode(children: (DefaultNodeTypes | SerializedTableRowNode)[]): SerializedTableNode {\n return {\n type: 'table',\n children,\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n }\n}\n\nfunction tableRowNode(\n children: (DefaultNodeTypes | SerializedTableCellNode)[],\n): SerializedTableRowNode {\n return {\n type: 'tablerow',\n children,\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n }\n}\n\nfunction tableCellNode(children: DefaultNodeTypes[]): SerializedTableCellNode {\n return {\n type: 'tablecell',\n children,\n direction: 'ltr',\n format: '',\n indent: 0,\n headerState: 0,\n version: 1,\n }\n}\n\nfunction rootNode(nodes: (DefaultNodeTypes | SerializedTableNode)[]): DefaultTypedEditorState {\n return {\n root: {\n type: 'root',\n children: nodes,\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n },\n }\n}\n\ndescribe('convertLexicalToPlaintext', () => {\n it('ensure paragraph with text is correctly converted', () => {\n const data: DefaultTypedEditorState = rootNode([paragraphNode([textNode('Basic Text')])])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe('Basic Text')\n })\n\n it('ensure paragraph with multiple text nodes is correctly converted', () => {\n const data: DefaultTypedEditorState = rootNode([\n paragraphNode([textNode('Basic Text'), textNode(' Bold', true), textNode(' Text')]),\n ])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe('Basic Text Bold Text')\n })\n\n it('ensure linebreaks are converted correctly', () => {\n const data: DefaultTypedEditorState = rootNode([\n paragraphNode([textNode('Basic Text'), linebreakNode(), textNode('Next Line')]),\n ])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe('Basic Text\\nNext Line')\n })\n\n it('ensure tabs are converted correctly', () => {\n const data: DefaultTypedEditorState = rootNode([\n paragraphNode([textNode('Basic Text'), tabNode(), textNode('Next Line')]),\n ])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe('Basic Text\\tNext Line')\n })\n\n it('ensure new lines are added between paragraphs', () => {\n const data: DefaultTypedEditorState = rootNode([\n paragraphNode([textNode('Basic text')]),\n paragraphNode([textNode('Next block-node')]),\n ])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe('Basic text\\n\\nNext block-node')\n })\n\n it('ensure new lines are added between heading nodes', () => {\n const data: DefaultTypedEditorState = rootNode([\n headingNode([textNode('Basic text')]),\n headingNode([textNode('Next block-node')]),\n ])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe('Basic text\\n\\nNext block-node')\n })\n\n it('ensure new lines are added between list items and lists', () => {\n const data: DefaultTypedEditorState = rootNode([\n listNode([listItemNode([textNode('First item')]), listItemNode([textNode('Second item')])]),\n listNode([listItemNode([textNode('Next list')])]),\n ])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe('First item\\nSecond item\\n\\nNext list')\n })\n\n it('ensure new lines are added between tables, table rows, and table cells', () => {\n const data: DefaultTypedEditorState = rootNode([\n tableNode([\n tableRowNode([\n tableCellNode([textNode('Cell 1, Row 1')]),\n tableCellNode([textNode('Cell 2, Row 1')]),\n ]),\n tableRowNode([\n tableCellNode([textNode('Cell 1, Row 2')]),\n tableCellNode([textNode('Cell 2, Row 2')]),\n ]),\n ]),\n tableNode([tableRowNode([tableCellNode([textNode('Cell in Table 2')])])]),\n ])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe(\n 'Cell 1, Row 1 | Cell 2, Row 1\\nCell 1, Row 2 | Cell 2, Row 2\\n\\nCell in Table 2',\n )\n })\n})\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ;AAerC,SAASC,yBAAyB,QAAQ;AAE1C,SAASC,SAASC,IAAY,EAAEC,IAAc;EAC5C,OAAO;IACLC,IAAA,EAAM;IACNC,MAAA,EAAQ;IACRC,MAAA,EAAQH,IAAA,GAAO,IAAI;IACnBI,IAAA,EAAM;IACNC,KAAA,EAAO;IACPN,IAAA;IACAO,OAAA,EAAS;EACX;AACF;AAEA,SAASC,cAAA;EACP,OAAO;IACLN,IAAA,EAAM;IACNK,OAAA,EAAS;EACX;AACF;AAEA,SAASE,QAAA;EACP,OAAO;IACLP,IAAA,EAAM;IACNC,MAAA,EAAQ;IACRC,MAAA,EAAQ;IACRC,IAAA,EAAM;IACNC,KAAA,EAAO;IACPN,IAAA,EAAM;IACNO,OAAA,EAAS;EACX;AACF;AAEA,SAASG,cAAcC,QAA4B;EACjD,OAAO;IACLT,IAAA,EAAM;IACNS,QAAA;IACAC,SAAA,EAAW;IACXR,MAAA,EAAQ;IACRS,MAAA,EAAQ;IACRC,UAAA,EAAY;IACZP,OAAA,EAAS;EACX;AACF;AAEA,SAASQ,YAAYJ,QAA4B;EAC/C,OAAO;IACLT,IAAA,EAAM;IACNS,QAAA;IACAC,SAAA,EAAW;IACXR,MAAA,EAAQ;IACRS,MAAA,EAAQ;IACRC,UAAA,EAAY;IACZE,GAAA,EAAK;IACLT,OAAA,EAAS;EACX;AACF;AAEA,SAASU,aAAaN,QAA4B;EAChD,OAAO;IACLT,IAAA,EAAM;IACNS,QAAA;IACAO,OAAA,EAAS;IACTN,SAAA,EAAW;IACXR,MAAA,EAAQ;IACRS,MAAA,EA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AA,GAAYjC,yBAAA,CAA0B;MAC1CgC;IACF;IAEAjC,MAAA,CAAOkC,SAAA,EAAWC,IAAI,CAAC;EACzB;EAEApC,EAAA,CAAG,2DAA2D;IAC5D,MAAMkC,IAAA,GAAgCH,QAAA,CAAS,CAC7CP,QAAA,CAAS,CAACH,YAAA,CAAa,CAAClB,QAAA,CAAS,cAAc,GAAGkB,YAAA,CAAa,CAAClB,QAAA,CAAS,eAAe,EAAE,GAC1FqB,QAAA,CAAS,CAACH,YAAA,CAAa,CAAClB,QAAA,CAAS,aAAa,EAAE,EACjD;IAED,MAAMgC,SAAA,GAAYjC,yBAAA,CAA0B;MAC1CgC;IACF;IAEAjC,MAAA,CAAOkC,SAAA,EAAWC,IAAI,CAAC;EACzB;EAEApC,EAAA,CAAG,0EAA0E;IAC3E,MAAMkC,IAAA,GAAgCH,QAAA,CAAS,CAC7CJ,SAAA,CAAU,CACRC,YAAA,CAAa,CACXC,aAAA,CAAc,CAAC1B,QAAA,CAAS,iBAAiB,GACzC0B,aAAA,CAAc,CAAC1B,QAAA,CAAS,iBAAiB,EAC1C,GACDyB,YAAA,CAAa,CACXC,aAAA,CAAc,CAAC1B,QAAA,CAAS,iBAAiB,GACzC0B,aAAA,CAAc,CAAC1B,QAAA,CAAS,iBAAiB,EAC1C,EACF,GACDwB,SAAA,CAAU,CAACC,YAAA,CAAa,CAACC,aAAA,CAAc,CAAC1B,QAAA,CAAS,mBAAmB,EAAE,EAAE,EACzE;IAED,MAAMgC,SAAA,GAAYjC,yBAAA,CAA0B;MAC1CgC;IACF;IAEAjC,MAAA,CAAOkC,SAAA,EAAWC,IAAI,CACpB;EAEJ;AACF","ignoreList":[]}
1
+ {"version":3,"file":"convertLexicalToPlaintext.spec.js","names":["describe","it","expect","convertLexicalToPlaintext","textNode","text","bold","type","detail","format","mode","style","version","linebreakNode","tabNode","paragraphNode","children","direction","indent","textFormat","headingNode","tag","listItemNode","checked","value","listNode","listType","start","tableNode","tableRowNode","tableCellNode","headerState","rootNode","nodes","root","data","plaintext","toBe"],"sources":["../../../../src/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.ts"],"sourcesContent":["import { describe, it, expect } from 'vitest'\nimport type {\n DefaultNodeTypes,\n DefaultTypedEditorState,\n SerializedTabNode,\n SerializedParagraphNode,\n SerializedTextNode,\n SerializedLineBreakNode,\n SerializedHeadingNode,\n SerializedListItemNode,\n SerializedListNode,\n SerializedTableRowNode,\n SerializedTableNode,\n SerializedTableCellNode,\n} from '../../../types/nodeTypes.js'\nimport { convertLexicalToPlaintext } from './sync/index.js'\n\nfunction textNode(text: string, bold?: boolean): SerializedTextNode {\n return {\n type: 'text',\n detail: 0,\n format: bold ? 1 : 0,\n mode: 'normal',\n style: '',\n text,\n version: 1,\n }\n}\n\nfunction linebreakNode(): SerializedLineBreakNode {\n return {\n type: 'linebreak',\n version: 1,\n }\n}\n\nfunction tabNode(): SerializedTabNode {\n return {\n type: 'tab',\n detail: 0,\n format: 0,\n mode: 'normal',\n style: '',\n text: '',\n version: 1,\n }\n}\n\nfunction paragraphNode(children: DefaultNodeTypes[]): SerializedParagraphNode {\n return {\n type: 'paragraph',\n children,\n direction: 'ltr',\n format: '',\n indent: 0,\n textFormat: 0,\n version: 1,\n }\n}\n\nfunction headingNode(children: DefaultNodeTypes[]): SerializedHeadingNode {\n return {\n type: 'heading',\n children,\n direction: 'ltr',\n format: '',\n indent: 0,\n textFormat: 0,\n tag: 'h1',\n version: 1,\n }\n}\n\nfunction listItemNode(children: DefaultNodeTypes[]): SerializedListItemNode {\n return {\n type: 'listitem',\n children,\n checked: false,\n direction: 'ltr',\n format: '',\n indent: 0,\n value: 0,\n version: 1,\n }\n}\n\nfunction listNode(children: DefaultNodeTypes[]): SerializedListNode {\n return {\n type: 'list',\n children,\n direction: 'ltr',\n format: '',\n indent: 0,\n listType: 'bullet',\n start: 0,\n tag: 'ul',\n version: 1,\n }\n}\n\nfunction tableNode(children: (DefaultNodeTypes | SerializedTableRowNode)[]): SerializedTableNode {\n return {\n type: 'table',\n children,\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n }\n}\n\nfunction tableRowNode(\n children: (DefaultNodeTypes | SerializedTableCellNode)[],\n): SerializedTableRowNode {\n return {\n type: 'tablerow',\n children,\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n }\n}\n\nfunction tableCellNode(children: DefaultNodeTypes[]): SerializedTableCellNode {\n return {\n type: 'tablecell',\n children,\n direction: 'ltr',\n format: '',\n indent: 0,\n headerState: 0,\n version: 1,\n }\n}\n\nfunction rootNode(nodes: (DefaultNodeTypes | SerializedTableNode)[]): DefaultTypedEditorState {\n return {\n root: {\n type: 'root',\n children: nodes,\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n },\n }\n}\n\ndescribe('convertLexicalToPlaintext', () => {\n it('ensure paragraph with text is correctly converted', () => {\n const data: DefaultTypedEditorState = rootNode([paragraphNode([textNode('Basic Text')])])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe('Basic Text')\n })\n\n it('ensure paragraph with multiple text nodes is correctly converted', () => {\n const data: DefaultTypedEditorState = rootNode([\n paragraphNode([textNode('Basic Text'), textNode(' Bold', true), textNode(' Text')]),\n ])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe('Basic Text Bold Text')\n })\n\n it('ensure linebreaks are converted correctly', () => {\n const data: DefaultTypedEditorState = rootNode([\n paragraphNode([textNode('Basic Text'), linebreakNode(), textNode('Next Line')]),\n ])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe('Basic Text\\nNext Line')\n })\n\n it('ensure tabs are converted correctly', () => {\n const data: DefaultTypedEditorState = rootNode([\n paragraphNode([textNode('Basic Text'), tabNode(), textNode('Next Line')]),\n ])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe('Basic Text\\tNext Line')\n })\n\n it('ensure new lines are added between paragraphs', () => {\n const data: DefaultTypedEditorState = rootNode([\n paragraphNode([textNode('Basic text')]),\n paragraphNode([textNode('Next block-node')]),\n ])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe('Basic text\\n\\nNext block-node')\n })\n\n it('ensure new lines are added between heading nodes', () => {\n const data: DefaultTypedEditorState = rootNode([\n headingNode([textNode('Basic text')]),\n headingNode([textNode('Next block-node')]),\n ])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe('Basic text\\n\\nNext block-node')\n })\n\n it('ensure new lines are added between list items and lists', () => {\n const data: DefaultTypedEditorState = rootNode([\n listNode([listItemNode([textNode('First item')]), listItemNode([textNode('Second item')])]),\n listNode([listItemNode([textNode('Next list')])]),\n ])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe('First item\\nSecond item\\n\\nNext list')\n })\n\n it('ensure new lines are added between tables, table rows, and table cells', () => {\n const data: DefaultTypedEditorState = rootNode([\n tableNode([\n tableRowNode([\n tableCellNode([textNode('Cell 1, Row 1')]),\n tableCellNode([textNode('Cell 2, Row 1')]),\n ]),\n tableRowNode([\n tableCellNode([textNode('Cell 1, Row 2')]),\n tableCellNode([textNode('Cell 2, Row 2')]),\n ]),\n ]),\n tableNode([tableRowNode([tableCellNode([textNode('Cell in Table 2')])])]),\n ])\n\n const plaintext = convertLexicalToPlaintext({\n data,\n })\n\n expect(plaintext).toBe(\n 'Cell 1, Row 1 | Cell 2, Row 1\\nCell 1, Row 2 | Cell 2, Row 2\\n\\nCell in Table 2',\n )\n })\n})\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ;AAerC,SAASC,yBAAyB,QAAQ;AAE1C,SAASC,SAASC,IAAY,EAAEC,IAAc;EAC5C,OAAO;IACLC,IAAA,EAAM;IACNC,MAAA,EAAQ;IACRC,MAAA,EAAQH,IAAA,GAAO,IAAI;IACnBI,IAAA,EAAM;IACNC,KA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AA,EAAWC,IAAI,CAAC;EACzB;EAEApC,EAAA,CAAG,0EAA0E;IAC3E,MAAMkC,IAAA,GAAgCH,QAAA,CAAS,CAC7CJ,SAAA,CAAU,CACRC,YAAA,CAAa,CACXC,aAAA,CAAc,CAAC1B,QAAA,CAAS,iBAAiB,GACzC0B,aAAA,CAAc,CAAC1B,QAAA,CAAS,iBAAiB,EAC1C,GACDyB,YAAA,CAAa,CACXC,aAAA,CAAc,CAAC1B,QAAA,CAAS,iBAAiB,GACzC0B,aAAA,CAAc,CAAC1B,QAAA,CAAS,iBAAiB,EAC1C,EACF,GACDwB,SAAA,CAAU,CAACC,YAAA,CAAa,CAACC,aAAA,CAAc,CAAC1B,QAAA,CAAS,mBAAmB,EAAE,EAAE,EACzE;IAED,MAAMgC,SAAA,GAAYjC,yBAAA,CAA0B;MAC1CgC;IACF;IAEAjC,MAAA,CAAOkC,SAAA,EAAWC,IAAI,CACpB;EAEJ;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"findConverterForNode.js","names":["findConverterForNode","converters","node","converterForNode","type","blocks","fields","blockType","inlineBlocks"],"sources":["../../../../../src/features/converters/lexicalToPlaintext/shared/findConverterForNode.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type { SerializedBlockNode, SerializedInlineBlockNode } from '../../../../nodeTypes.js'\nimport type { PlaintextConverter, PlaintextConverters } from '../sync/types.js'\n\nexport function findConverterForNode<\n TConverters extends PlaintextConverters,\n TConverter extends PlaintextConverter<any>,\n>({\n converters,\n\n node,\n}: {\n converters: TConverters\n node: SerializedLexicalNode\n}): TConverter | undefined {\n let converterForNode: TConverter | undefined\n if (node.type === 'block') {\n converterForNode = converters?.blocks?.[\n (node as SerializedBlockNode)?.fields?.blockType\n ] as TConverter\n } else if (node.type === 'inlineBlock') {\n converterForNode = converters?.inlineBlocks?.[\n (node as SerializedInlineBlockNode)?.fields?.blockType\n ] as TConverter\n } else {\n converterForNode = converters[node.type] as TConverter\n }\n\n return converterForNode\n}\n"],"mappings":"AAKA,OAAO,SAASA,qBAGd;EACAC,UAAU;EAEVC;AAAI,CAIL;EACC,IAAIC,gBAAA;EACJ,IAAID,IAAA,CAAKE,IAAI,KAAK,SAAS;IACzBD,gBAAA,GAAmBF,UAAA,EAAYI,MAAA,GAC5BH,IAAA,EAA8BI,MAAA,EAAQC,SAAA,CACxC;EACH,OAAO,IAAIL,IAAA,CAAKE,IAAI,KAAK,eAAe;IACtCD,gBAAA,GAAmBF,UAAA,EAAYO,YAAA,GAC5BN,IAAA,EAAoCI,MAAA,EAAQC,SAAA,CAC9C;EACH,OAAO;IACLJ,gBAAA,GAAmBF,UAAU,CAACC,IAAA,CAAKE,IAAI,CAAC;EAC1C;EAEA,OAAOD,gBAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"findConverterForNode.js","names":["findConverterForNode","converters","node","converterForNode","type","blocks","fields","blockType","inlineBlocks"],"sources":["../../../../../src/features/converters/lexicalToPlaintext/shared/findConverterForNode.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type { SerializedBlockNode, SerializedInlineBlockNode } from '../../../../types/nodeTypes.js'\nimport type { PlaintextConverter, PlaintextConverters } from '../sync/types.js'\n\nexport function findConverterForNode<\n TConverters extends PlaintextConverters,\n TConverter extends PlaintextConverter<any>,\n>({\n converters,\n\n node,\n}: {\n converters: TConverters\n node: SerializedLexicalNode\n}): TConverter | undefined {\n let converterForNode: TConverter | undefined\n if (node.type === 'block') {\n converterForNode = converters?.blocks?.[\n (node as SerializedBlockNode)?.fields?.blockType\n ] as TConverter\n } else if (node.type === 'inlineBlock') {\n converterForNode = converters?.inlineBlocks?.[\n (node as SerializedInlineBlockNode)?.fields?.blockType\n ] as TConverter\n } else {\n converterForNode = converters[node.type] as TConverter\n }\n\n return converterForNode\n}\n"],"mappings":"AAKA,OAAO,SAASA,qBAGd;EACAC,UAAU;EAEVC;AAAI,CAIL;EACC,IAAIC,gBAAA;EACJ,IAAID,IAAA,CAAKE,IAAI,KAAK,SAAS;IACzBD,gBAAA,GAAmBF,UAAA,EAAYI,MAAA,GAC5BH,IAAA,EAA8BI,MAAA,EAAQC,SAAA,CACxC;EACH,OAAO,IAAIL,IAAA,CAAKE,IAAI,KAAK,eAAe;IACtCD,gBAAA,GAAmBF,UAAA,EAAYO,YAAA,GAC5BN,IAAA,EAAoCI,MAAA,EAAQC,SAAA,CAC9C;EACH,OAAO;IACLJ,gBAAA,GAAmBF,UAAU,CAACC,IAAA,CAAKE,IAAI,CAAC;EAC1C;EAEA,OAAOD,gBAAA;AACT","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { SerializedLexicalNode } from 'lexical';
2
- import type { DefaultNodeTypes, SerializedBlockNode, SerializedInlineBlockNode } from '../../../../nodeTypes.js';
2
+ import type { DefaultNodeTypes, SerializedBlockNode, SerializedInlineBlockNode } from '../../../../types/nodeTypes.js';
3
3
  import type { SerializedLexicalNodeWithParent } from '../shared/types.js';
4
4
  export type PlaintextConverter<T extends {
5
5
  [key: string]: any;
@@ -35,26 +35,24 @@ export type PlaintextConverters<T extends {
35
35
  }>>;
36
36
  } & {
37
37
  blocks?: {
38
- [K in Extract<Extract<T, {
38
+ [K in Extract<T, {
39
39
  type: 'block';
40
- }> extends SerializedBlockNode<infer B> ? B extends {
41
- blockType: string;
42
- } ? B['blockType'] : never : never, string>]?: PlaintextConverter<Extract<T, {
40
+ }>['fields']['blockType']]?: PlaintextConverter<Extract<T, {
41
+ fields: {
42
+ blockType: K;
43
+ };
43
44
  type: 'block';
44
- }> extends SerializedBlockNode<infer B> ? SerializedBlockNode<Extract<B, {
45
- blockType: K;
46
- }>> : SerializedBlockNode>;
45
+ }>>;
47
46
  };
48
47
  inlineBlocks?: {
49
- [K in Extract<Extract<T, {
48
+ [K in Extract<T, {
50
49
  type: 'inlineBlock';
51
- }> extends SerializedInlineBlockNode<infer B> ? B extends {
52
- blockType: string;
53
- } ? B['blockType'] : never : never, string>]?: PlaintextConverter<Extract<T, {
50
+ }>['fields']['blockType']]?: PlaintextConverter<Extract<T, {
51
+ fields: {
52
+ blockType: K;
53
+ };
54
54
  type: 'inlineBlock';
55
- }> extends SerializedInlineBlockNode<infer B> ? SerializedInlineBlockNode<Extract<B, {
56
- blockType: K;
57
- }>> : SerializedInlineBlockNode>;
55
+ }>>;
58
56
  };
59
57
  };
60
58
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToPlaintext/sync/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAA;AAEzE,MAAM,MAAM,kBAAkB,CAC5B,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,IAErE,CAAC,CAAC,IAAI,EAAE;IACN,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,mBAAmB,CAAA;IAC/B,IAAI,EAAE,CAAC,CAAA;IACP,gBAAgB,EAAE,CAAC,IAAI,EAAE;QACvB,UAAU,CAAC,EAAE,mBAAmB,CAAA;QAChC,KAAK,EAAE,qBAAqB,EAAE,CAAA;QAC9B,MAAM,CAAC,EAAE,+BAA+B,CAAA;KACzC,KAAK,MAAM,EAAE,CAAA;IACd,MAAM,EAAE,+BAA+B,CAAA;CACxC,KAAK,MAAM,CAAC,GACb,MAAM,CAAA;AAEV,MAAM,MAAM,yBAAyB,GACjC,gBAAgB,GAChB,mBAAmB,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAAC,SAAS,EAAE,MA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AAY,CAAC,EAAE;SACZ,CAAC,IAAI,OAAO,CACX,OAAO,CAAC,CAAC,EAAE;YAAE,IAAI,EAAE,aAAa,CAAA;SAAE,CAAC,SAAS,yBAAyB,CAAC,MAAM,CAAC,CAAC,GAC1E,CAAC,SAAS;YAAE,SAAS,EAAE,MAAM,CAAA;SAAE,GAC7B,CAAC,CAAC,WAAW,CAAC,GACd,KAAK,GACP,KAAK,EACT,MAAM,CACP,CAAC,CAAC,EAAE,kBAAkB,CACrB,OAAO,CAAC,CAAC,EAAE;YAAE,IAAI,EAAE,aAAa,CAAA;SAAE,CAAC,SAAS,yBAAyB,CAAC,MAAM,CAAC,CAAC,GAC1E,yBAAyB,CAAC,OAAO,CAAC,CAAC,EAAE;YAAE,SAAS,EAAE,CAAC,CAAA;SAAE,CAAC,CAAC,GACvD,yBAAyB,CAC9B;KACF,CAAA;CACF,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToPlaintext/sync/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAA;AAEzE,MAAM,MAAM,kBAAkB,CAC5B,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,IAErE,CAAC,CAAC,IAAI,EAAE;IACN,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,mBAAmB,CAAA;IAC/B,IAAI,EAAE,CAAC,CAAA;IACP,gBAAgB,EAAE,CAAC,IAAI,EAAE;QACvB,UAAU,CAAC,EAAE,mBAAmB,CAAA;QAChC,KAAK,EAAE,qBAAqB,EAAE,C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AI,EAAE,OAAO,CAAA;SAAE,CAAC,CACxD;KACF,CAAA;IACD,YAAY,CAAC,EAAE;SACZ,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE;YAAE,IAAI,EAAE,aAAa,CAAA;SAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,kBAAkB,CACpF,OAAO,CAAC,CAAC,EAAE;YAAE,MAAM,EAAE;gBAAE,SAAS,EAAE,CAAC,CAAA;aAAE,CAAC;YAAC,IAAI,EAAE,aAAa,CAAA;SAAE,CAAC,CAC9D;KACF,CAAA;CACF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/features/converters/lexicalToPlaintext/sync/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../nodeTypes.js'\nimport type { SerializedLexicalNodeWithParent } from '../shared/types.js'\n\nexport type PlaintextConverter<\n T extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> =\n | ((args: {\n childIndex: number\n converters: PlaintextConverters\n node: T\n nodesToPlaintext: (args: {\n converters?: PlaintextConverters\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => string[]\n parent: SerializedLexicalNodeWithParent\n }) => string)\n | string\n\nexport type DefaultPlaintextNodeTypes =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>\n\nexport type PlaintextConverters<\n T extends { [key: string]: any; type?: string } = DefaultPlaintextNodeTypes,\n> = {\n [key: string]:\n | {\n [blockSlug: string]: PlaintextConverter<any>\n }\n | PlaintextConverter<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<T['type']>, 'block' | 'inlineBlock'>]?: PlaintextConverter<\n Extract<T, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract<\n Extract<T, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: PlaintextConverter<\n Extract<T, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? SerializedBlockNode<Extract<B, { blockType: K }>>\n : SerializedBlockNode\n >\n }\n inlineBlocks?: {\n [K in Extract<\n Extract<T, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: PlaintextConverter<\n Extract<T, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? SerializedInlineBlockNode<Extract<B, { blockType: K }>>\n : SerializedInlineBlockNode\n >\n }\n}\n"],"mappings":"AA8BA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/features/converters/lexicalToPlaintext/sync/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../types/nodeTypes.js'\nimport type { SerializedLexicalNodeWithParent } from '../shared/types.js'\n\nexport type PlaintextConverter<\n T extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> =\n | ((args: {\n childIndex: number\n converters: PlaintextConverters\n node: T\n nodesToPlaintext: (args: {\n converters?: PlaintextConverters\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => string[]\n parent: SerializedLexicalNodeWithParent\n }) => string)\n | string\n\nexport type DefaultPlaintextNodeTypes =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>\n\nexport type PlaintextConverters<\n T extends { [key: string]: any; type?: string } = DefaultPlaintextNodeTypes,\n> = {\n [key: string]:\n | {\n [blockSlug: string]: PlaintextConverter<any>\n }\n | PlaintextConverter<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<T['type']>, 'block' | 'inlineBlock'>]?: PlaintextConverter<\n Extract<T, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract<T, { type: 'block' }>['fields']['blockType']]?: PlaintextConverter<\n Extract<T, { fields: { blockType: K }; type: 'block' }>\n >\n }\n inlineBlocks?: {\n [K in Extract<T, { type: 'inlineBlock' }>['fields']['blockType']]?: PlaintextConverter<\n Extract<T, { fields: { blockType: K }; type: 'inlineBlock' }>\n >\n }\n}\n"],"mappings":"AA8BA","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import type { SerializedLexicalNode } from 'lexical';
2
2
  import type { SanitizedServerEditorConfig } from '../../../lexical/config/types.js';
3
- import type { DefaultNodeTypes, TypedEditorState } from '../../../nodeTypes.js';
3
+ import type { DefaultNodeTypes, TypedEditorState } from '../../../types/nodeTypes.js';
4
4
  export declare const convertMarkdownToLexical: <TNodeTypes extends SerializedLexicalNode = DefaultNodeTypes>({ editorConfig, markdown, }: {
5
5
  editorConfig: SanitizedServerEditorConfig;
6
6
  markdown: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/converters/markdownToLexical/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIpD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAA;AACnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAK/E,eAAO,MAAM,wBAAwB,GACnC,UAAU,SAAS,qBAAqB,kDAIvC;IACD,YAAY,EAAE,2BAA2B,CAAA;IACzC,QAAQ,EAAE,MAAM,CAAA;CACjB,KAAG,gBAAgB,CAAC,UAAU,CAiB9B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/converters/markdownToLexical/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIpD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAA;AACnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAKrF,eAAO,MAAM,wBAAwB,GACnC,UAAU,SAAS,qBAAqB,GAAG,gBAAgB,EAC3D,6BAGC;IACD,YAAY,EAAE,2BAA2B,CAAA;IACzC,QAAQ,EAAE,MAAM,CAAA;CACjB,KAAG,gBAAgB,CAAC,UAAU,CAiB9B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["createHeadlessEditor","getEnabledNodes","$convertFromMarkdownString","convertMarkdownToLexical","editorConfig","markdown","headlessEditor","nodes","update","features","markdownTransformers","discrete","editorJSON","getEditorState","toJSON"],"sources":["../../../../src/features/converters/markdownToLexical/index.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport { createHeadlessEditor } from '@lexical/headless'\n\nimport type { SanitizedServerEditorConfig } from '../../../lexical/config/types.js'\nimport type { DefaultNodeTypes, TypedEditorState } from '../../../nodeTypes.js'\n\nimport { getEnabledNodes } from '../../../lexical/nodes/index.js'\nimport { $convertFromMarkdownString } from '../../../packages/@lexical/markdown/index.js'\n\nexport const convertMarkdownToLexical = <\n TNodeTypes extends SerializedLexicalNode = DefaultNodeTypes,\n>({\n editorConfig,\n markdown,\n}: {\n editorConfig: SanitizedServerEditorConfig\n markdown: string\n}): TypedEditorState<TNodeTypes> => {\n const headlessEditor = createHeadlessEditor({\n nodes: getEnabledNodes({\n editorConfig,\n }),\n })\n\n headlessEditor.update(\n () => {\n $convertFromMarkdownString(markdown, editorConfig.features.markdownTransformers)\n },\n { discrete: true },\n )\n\n const editorJSON = headlessEditor.getEditorState().toJSON()\n\n return editorJSON as TypedEditorState<TNodeTypes>\n}\n"],"mappings":"AAEA,SAASA,oBAAoB,QAAQ;AAKrC,SAASC,eAAe,QAAQ;AAChC,SAASC,0BAA0B,QAAQ;AAE3C,OAAO,MAAMC,wBAAA,GAA2BA,CAEtC;EACAC,YAAY;EACZC;AAAQ,CAIT;EACC,MAAMC,cAAA,GAAiBN,oBAAA,CAAqB;IAC1CO,KAAA,EAAON,eAAA,CAAgB;MACrBG;IACF;EACF;EAEAE,cAAA,CAAeE,MAAM,CACnB;IACEN,0BAAA,CAA2BG,QAAA,EAAUD,YAAA,CAAaK,QAAQ,CAACC,oBAAoB;EACjF,GACA;IAAEC,QAAA,EAAU;EAAK;EAGnB,MAAMC,UAAA,GAAaN,cAAA,CAAeO,cAAc,GAAGC,MAAM;EAEzD,OAAOF,UAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["createHeadlessEditor","getEnabledNodes","$convertFromMarkdownString","convertMarkdownToLexical","editorConfig","markdown","headlessEditor","nodes","update","features","markdownTransformers","discrete","editorJSON","getEditorState","toJSON"],"sources":["../../../../src/features/converters/markdownToLexical/index.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport { createHeadlessEditor } from '@lexical/headless'\n\nimport type { SanitizedServerEditorConfig } from '../../../lexical/config/types.js'\nimport type { DefaultNodeTypes, TypedEditorState } from '../../../types/nodeTypes.js'\n\nimport { getEnabledNodes } from '../../../lexical/nodes/index.js'\nimport { $convertFromMarkdownString } from '../../../packages/@lexical/markdown/index.js'\n\nexport const convertMarkdownToLexical = <\n TNodeTypes extends SerializedLexicalNode = DefaultNodeTypes,\n>({\n editorConfig,\n markdown,\n}: {\n editorConfig: SanitizedServerEditorConfig\n markdown: string\n}): TypedEditorState<TNodeTypes> => {\n const headlessEditor = createHeadlessEditor({\n nodes: getEnabledNodes({\n editorConfig,\n }),\n })\n\n headlessEditor.update(\n () => {\n $convertFromMarkdownString(markdown, editorConfig.features.markdownTransformers)\n },\n { discrete: true },\n )\n\n const editorJSON = headlessEditor.getEditorState().toJSON()\n\n return editorJSON as TypedEditorState<TNodeTypes>\n}\n"],"mappings":"AAEA,SAASA,oBAAoB,QAAQ;AAKrC,SAASC,eAAe,QAAQ;AAChC,SAASC,0BAA0B,QAAQ;AAE3C,OAAO,MAAMC,wBAAA,GAA2BA,CAEtC;EACAC,YAAY;EACZC;AAAQ,CAIT;EACC,MAAMC,cAAA,GAAiBN,oBAAA,CAAqB;IAC1CO,KAAA,EAAON,eAAA,CAAgB;MACrBG;IACF;EACF;EAEAE,cAAA,CAAeE,MAAM,CACnB;IACEN,0BAAA,CAA2BG,QAAA,EAAUD,YAAA,CAAaK,QAAQ,CAACC,oBAAoB;EACjF,GACA;IAAEC,QAAA,EAAU;EAAK;EAGnB,MAAMC,UAAA,GAAaN,cAAA,CAAeO,cAAc,GAAGC,MAAM;EAEzD,OAAOF,UAAA;AACT","ignoreList":[]}
@@ -57,12 +57,12 @@
57
57
  border: none;
58
58
  height: var(--stroke-width-small);
59
59
  margin: var(--spacer-2) calc(var(--spacer-2) * -1);
60
- background-color: var(--color-white-200);
60
+ background-color: var(--ramp-white-200);
61
61
  }
62
62
 
63
63
  .item {
64
64
  padding: var(--spacer-2);
65
- color: var(--color-white-800);
65
+ color: var(--ramp-white-800);
66
66
  background: transparent;
67
67
  cursor: pointer;
68
68
  font-family: var(--text-body-medium-font-family);
@@ -79,12 +79,12 @@
79
79
 
80
80
  &:hover {
81
81
  background: var(--color-bg-brand);
82
- color: var(--color-white-1000);
82
+ color: var(--ramp-white-1000);
83
83
  }
84
84
 
85
85
  &:active {
86
86
  background: var(--color-bg-brand-pressed);
87
- color: var(--color-white-1000);
87
+ color: var(--ramp-white-1000);
88
88
  }
89
89
  }
90
90
  }
@@ -132,7 +132,7 @@
132
132
  .table-grid-popup__tooltip {
133
133
  position: absolute;
134
134
  background: var(--color-bg-menu);
135
- color: var(--color-white-800);
135
+ color: var(--ramp-white-800);
136
136
  font-family: var(--text-body-medium-font-family);
137
137
  font-size: var(--text-body-medium-font-size);
138
138
  font-weight: var(--text-body-medium-font-weight);
@@ -1,8 +1,3 @@
1
- import type { SerializedTableCellNode as _SerializedTableCellNode, SerializedTableNode as _SerializedTableNode, SerializedTableRowNode as _SerializedTableRowNode } from '@lexical/table';
2
- import type { SerializedLexicalNode } from 'lexical';
3
- import type { StronglyTypedElementNode } from '../../../nodeTypes.js';
4
- export type SerializedTableCellNode<T extends SerializedLexicalNode = SerializedLexicalNode> = StronglyTypedElementNode<_SerializedTableCellNode, 'tablecell', T>;
5
- export type SerializedTableNode<T extends SerializedLexicalNode = SerializedLexicalNode> = StronglyTypedElementNode<_SerializedTableNode, 'table', T>;
6
- export type SerializedTableRowNode<T extends SerializedLexicalNode = SerializedLexicalNode> = StronglyTypedElementNode<_SerializedTableRowNode, 'tablerow', T>;
1
+ export type { SerializedTableCellNode, SerializedTableNode, SerializedTableRowNode, } from './schema.js';
7
2
  export declare const EXPERIMENTAL_TableFeature: import("../../typesServer.js").FeatureProviderProviderServer<undefined, undefined, undefined>;
8
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/experimental_table/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,IAAI,wBAAwB,EACnD,mBAAmB,IAAI,oBAAoB,EAC3C,sBAAsB,IAAI,uBAAuB,EAClD,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAMpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAqBrE,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IACzF,wBAAwB,CAAC,wBAAwB,EAAE,WAAW,EAAE,CAAC,CAAC,CAAA;AAEpE,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IACrF,wBAAwB,CAAC,oBAAoB,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;AAE5D,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IACxF,wBAAwB,CAAC,uBAAuB,EAAE,UAAU,EAAE,CAAC,CAAC,CAAA;AAClE,eAAO,MAAM,yBAAyB,+FAqCpC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/experimental_table/server/index.ts"],"names":[],"mappings":"AAUA,YAAY,EACV,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,aAAa,CAAA;AAiBpB,eAAO,MAAM,yBAAyB,+FAwCpC,CAAA"}
@@ -3,6 +3,7 @@ import { sanitizeFields } from 'payload';
3
3
  import { createServerFeature } from '../../../utilities/createServerFeature.js';
4
4
  import { createNode } from '../../typeUtilities.js';
5
5
  import { TableMarkdownTransformer } from '../markdownTransformer.js';
6
+ import { tableCellNodeJSONSchema, tableNodeJSONSchema, tableRowNodeJSONSchema } from './schema.js';
6
7
  const fields = [{
7
8
  name: 'rows',
8
9
  type: 'number',
@@ -39,10 +40,13 @@ export const EXPERIMENTAL_TableFeature = createServerFeature({
39
40
  },
40
41
  markdownTransformers: [TableMarkdownTransformer],
41
42
  nodes: [createNode({
43
+ jsonSchema: tableNodeJSONSchema,
42
44
  node: TableNode
43
45
  }), createNode({
46
+ jsonSchema: tableCellNodeJSONSchema,
44
47
  node: TableCellNode
45
48
  }), createNode({
49
+ jsonSchema: tableRowNodeJSONSchema,
46
50
  node: TableRowNode
47
51
  })]
48
52
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["TableCellNode","TableNode","TableRowNode","sanitizeFields","createServerFeature","createNode","TableMarkdownTransformer","fields","name","type","defaultValue","required","EXPERIMENTAL_TableFeature","feature","config","isRoot","parentIsLocalized","validRelationships","collections","map","c","slug","sanitizedFields","requireFieldLevelRichTextEditor","ClientFeature","generateSchemaMap","schemaMap","Map","set","markdownTransformers","nodes","node","key"],"sources":["../../../../src/features/experimental_table/server/index.ts"],"sourcesContent":["import type {\n SerializedTableCellNode as _SerializedTableCellNode,\n SerializedTableNode as _SerializedTableNode,\n SerializedTableRowNode as _SerializedTableRowNode,\n} from '@lexical/table'\nimport type { SerializedLexicalNode } from 'lexical'\nimport type { Config, Field, FieldSchemaMap } from 'payload'\n\nimport { TableCellNode, TableNode, TableRowNode } from '@lexical/table'\nimport { sanitizeFields } from 'payload'\n\nimport type { StronglyTypedElementNode } from '../../../nodeTypes.js'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { TableMarkdownTransformer } from '../markdownTransformer.js'\n\nconst fields: Field[] = [\n {\n name: 'rows',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n {\n name: 'columns',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n]\n\nexport type SerializedTableCellNode<T extends SerializedLexicalNode = SerializedLexicalNode> =\n StronglyTypedElementNode<_SerializedTableCellNode, 'tablecell', T>\n\nexport type SerializedTableNode<T extends SerializedLexicalNode = SerializedLexicalNode> =\n StronglyTypedElementNode<_SerializedTableNode, 'table', T>\n\nexport type SerializedTableRowNode<T extends SerializedLexicalNode = SerializedLexicalNode> =\n StronglyTypedElementNode<_SerializedTableRowNode, 'tablerow', T>\nexport const EXPERIMENTAL_TableFeature = createServerFeature({\n feature: async ({ config, isRoot, parentIsLocalized }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const sanitizedFields = await sanitizeFields({\n config: config as unknown as Config,\n fields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#TableFeatureClient',\n generateSchemaMap: () => {\n const schemaMap: FieldSchemaMap = new Map()\n\n schemaMap.set('fields', {\n fields: sanitizedFields,\n })\n\n return schemaMap\n },\n markdownTransformers: [TableMarkdownTransformer],\n nodes: [\n createNode({\n node: TableNode,\n }),\n createNode({\n node: TableCellNode,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P","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["TableCellNode","TableNode","TableRowNode","sanitizeFields","createServerFeature","createNode","TableMarkdownTransformer","tableCellNodeJSONSchema","tableNodeJSONSchema","tableRowNodeJSONSchema","fields","name","type","defaultValue","required","EXPERIMENTAL_TableFeature","feature","config","isRoot","parentIsLocalized","validRelationships","collections","map","c","slug","sanitizedFields","requireFieldLevelRichTextEditor","ClientFeature","generateSchemaMap","schemaMap","Map","set","markdownTransformers","nodes","jsonSchema","node","key"],"sources":["../../../../src/features/experimental_table/server/index.ts"],"sourcesContent":["import type { Config, Field, FieldSchemaMap } from 'payload'\n\nimport { TableCellNode, TableNode, TableRowNode } from '@lexical/table'\nimport { sanitizeFields } from 'payload'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { TableMarkdownTransformer } from '../markdownTransformer.js'\nimport { tableCellNodeJSONSchema, tableNodeJSONSchema, tableRowNodeJSONSchema } from './schema.js'\n\nexport type {\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n} from './schema.js'\n\nconst fields: Field[] = [\n {\n name: 'rows',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n {\n name: 'columns',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n]\n\nexport const EXPERIMENTAL_TableFeature = createServerFeature({\n feature: async ({ config, isRoot, parentIsLocalized }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const sanitizedFields = await sanitizeFields({\n config: config as unknown as Config,\n fields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#TableFeatureClient',\n generateSchemaMap: () => {\n const schemaMap: FieldSchemaMap = new Map()\n\n schemaMap.set('fields', {\n fields: sanitizedFields,\n })\n\n return schemaMap\n },\n markdownTransformers: [TableMarkdownTransformer],\n nodes: [\n createNode({\n jsonSchema: tableNodeJSONSchema,\n node: TableNode,\n }),\n createNode({\n jsonSchema: tableCellNodeJSONSchema,\n node: TableCellNode,\n }),\n createNode({\n jsonSchema: tableRowNodeJSONSchema,\n node: TableRowNode,\n }),\n ],\n }\n },\n key: 'experimental_table',\n})\n"],"mappings":"AAEA,SAASA,aAAa,EAAEC,SAAS,EAAEC,YAAY,QAAQ;AACvD,SAASC,cAAc,QAAQ;AAE/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,wBAAwB,QAAQ;AACzC,SAASC,uBAAuB,EAAEC,mBAAmB,EAAEC,sBAAsB,QAAQ;AAQrF,MAAMC,MAAA,GAAkB,CACtB;EACEC,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,YAAA,EAAc;EACdC,QAAA,EAAU;AACZ,GACA;EACEH,IAAA,EAAM;EACNC,IAAA,EAAM;EACNC,YAAA,EAAc;EACdC,QAAA,EAAU;AACZ,EACD;AAED,OAAO,MAAMC,yBAAA,GAA4BX,mBAAA,CAAoB;EAC3DY,OAAA,EAAS,MAAAA,CAAO;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAiB,CAAE;IACnD,MAAMC,kBAAA,GAAqBH,MAAA,CAAOI,WAAW,CAACC,GAAG,CAAEC,CAAA,IAAMA,CAAA,CAAEC,IAAI,KAAK,EAAE;IAEtE,MAAMC,eAAA,GAAkB,MAAMtB,cAAA,CAAe;MAC3Cc,MAAA,EAAQA,MAAA;MACRP,MAAA;MACAS,iBAAA;MACAO,+BAAA,EAAiCR,MAAA;MACjCE;IACF;IACA,OAAO;MACLO,aAAA,EAAe;MACfC,iBAAA,EAAmBA,CAAA;QACjB,MAAMC,SAAA,GAA4B,IAAIC,GAAA;QAEtCD,SAAA,CAAUE,GAAG,CAAC,UAAU;UACtBrB,MAAA,EAAQe;QACV;QAEA,OAAOI,SAAA;MACT;MACAG,oBAAA,EAAsB,CAAC1B,wBAAA,CAAyB;MAChD2B,KAAA,EAAO,CACL5B,UAAA,CAAW;QACT6B,UAAA,EAAY1B,mBAAA;QACZ2B,IAAA,EAAMlC;MACR,IACAI,UAAA,CAAW;QACT6B,UAAA,EAAY3B,uBAAA;QACZ4B,IAAA,EAAMnC;MACR,IACAK,UAAA,CAAW;QACT6B,UAAA,EAAYzB,sBAAA;QACZ0B,IAAA,EAAMjC;MACR;IAEJ;EACF;EACAkC,GAAA,EAAK;AACP","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ import type { SerializedLexicalNode } from 'lexical';
2
+ import type { SerializedLexicalElementBase } from '../../../types/nodeTypes.js';
3
+ import type { JSONSchemaFn } from '../../typesServer.js';
4
+ export interface SerializedTableCellNode<TChildren extends SerializedLexicalNode = SerializedLexicalNode> extends SerializedLexicalElementBase<TChildren> {
5
+ backgroundColor?: null | string;
6
+ colSpan?: number;
7
+ headerState: number;
8
+ rowSpan?: number;
9
+ type: 'tablecell';
10
+ verticalAlign?: string;
11
+ width?: number;
12
+ }
13
+ export interface SerializedTableNode<TChildren extends SerializedLexicalNode = SerializedLexicalNode> extends SerializedLexicalElementBase<TChildren> {
14
+ colWidths?: number[];
15
+ frozenColumnCount?: number;
16
+ frozenRowCount?: number;
17
+ rowStriping?: boolean;
18
+ type: 'table';
19
+ }
20
+ export interface SerializedTableRowNode<TChildren extends SerializedLexicalNode = SerializedLexicalNode> extends SerializedLexicalElementBase<TChildren> {
21
+ height?: number;
22
+ type: 'tablerow';
23
+ }
24
+ export declare const tableNodeJSONSchema: JSONSchemaFn;
25
+ export declare const tableCellNodeJSONSchema: JSONSchemaFn;
26
+ export declare const tableRowNodeJSONSchema: JSONSchemaFn;
27
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/experimental_table/server/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,MAAM,WAAW,uBAAuB,CACtC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,CAC/D,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,eAAe,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,WAAW,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,mBAAmB,CAClC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,CAC/D,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,EAAE,OAAO,CAAA;CACd;AAED,MAAM,WAAW,sBAAsB,CACrC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,CAC/D,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,UAAU,CAAA;CACjB;AA2BD,eAAO,MAAM,mBAAmB,EAAE,YAgBjC,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,YAuBrC,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,YAWpC,CAAA"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * MUST stay byte-for-byte in sync with the runtime `SerializedTableNode`,
3
+ * `SerializedTableRowNode`, and `SerializedTableCellNode` declared above.
4
+ */const TABLE_NODES_TS = `export interface SerializedTableNode<TChildren> extends SerializedLexicalElementBase<TChildren> {
5
+ type: 'table';
6
+ colWidths?: number[];
7
+ frozenColumnCount?: number;
8
+ frozenRowCount?: number;
9
+ rowStriping?: boolean;
10
+ }
11
+ export interface SerializedTableRowNode<TChildren> extends SerializedLexicalElementBase<TChildren> {
12
+ type: 'tablerow';
13
+ height?: number;
14
+ }
15
+ export interface SerializedTableCellNode<TChildren> extends SerializedLexicalElementBase<TChildren> {
16
+ type: 'tablecell';
17
+ backgroundColor?: string | null;
18
+ colSpan?: number;
19
+ headerState: number;
20
+ rowSpan?: number;
21
+ verticalAlign?: string;
22
+ width?: number;
23
+ }`;
24
+ export const tableNodeJSONSchema = ({
25
+ elementNodeSchema,
26
+ nodeUnionName,
27
+ typeStringDefinitions
28
+ }) => {
29
+ typeStringDefinitions.add(TABLE_NODES_TS);
30
+ return elementNodeSchema({
31
+ nodeType: 'table',
32
+ properties: {
33
+ colWidths: {
34
+ type: 'array',
35
+ items: {
36
+ type: 'number'
37
+ }
38
+ },
39
+ frozenColumnCount: {
40
+ type: 'integer'
41
+ },
42
+ frozenRowCount: {
43
+ type: 'integer'
44
+ },
45
+ rowStriping: {
46
+ type: 'boolean'
47
+ }
48
+ },
49
+ tsType: `SerializedTableNode<${nodeUnionName}>`
50
+ });
51
+ };
52
+ export const tableCellNodeJSONSchema = ({
53
+ elementNodeSchema,
54
+ nodeUnionName,
55
+ typeStringDefinitions
56
+ }) => {
57
+ typeStringDefinitions.add(TABLE_NODES_TS);
58
+ return elementNodeSchema({
59
+ nodeType: 'tablecell',
60
+ properties: {
61
+ backgroundColor: {
62
+ oneOf: [{
63
+ type: 'string'
64
+ }, {
65
+ type: 'null'
66
+ }]
67
+ },
68
+ colSpan: {
69
+ type: 'integer',
70
+ description: 'How many columns this cell spans (default 1).'
71
+ },
72
+ headerState: {
73
+ type: 'integer',
74
+ description: 'Header bitmask: 0 = normal cell, 1 = row header, 2 = column header, 3 = both.'
75
+ },
76
+ rowSpan: {
77
+ type: 'integer',
78
+ description: 'How many rows this cell spans (default 1).'
79
+ },
80
+ verticalAlign: {
81
+ type: 'string'
82
+ },
83
+ width: {
84
+ type: 'integer'
85
+ }
86
+ },
87
+ required: ['headerState'],
88
+ tsType: `SerializedTableCellNode<${nodeUnionName}>`
89
+ });
90
+ };
91
+ export const tableRowNodeJSONSchema = ({
92
+ elementNodeSchema,
93
+ nodeUnionName,
94
+ typeStringDefinitions
95
+ }) => {
96
+ typeStringDefinitions.add(TABLE_NODES_TS);
97
+ return elementNodeSchema({
98
+ nodeType: 'tablerow',
99
+ properties: {
100
+ height: {
101
+ type: 'integer'
102
+ }
103
+ },
104
+ tsType: `SerializedTableRowNode<${nodeUnionName}>`
105
+ });
106
+ };
107
+ //# sourceMappingURL=schema.js.map