@payloadcms/richtext-lexical 4.0.0-internal.2fddfc0 → 4.0.0-internal.31ba7ee

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 (725) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/exports/client/Field-TCOK744G.js +2 -0
  3. package/dist/exports/client/Field-TCOK744G.js.map +7 -0
  4. package/dist/exports/client/bundled.css +1 -1
  5. package/dist/exports/client/chunk-3LRZDIIG.js +2 -0
  6. package/dist/exports/client/chunk-3LRZDIIG.js.map +7 -0
  7. package/dist/exports/client/chunk-43E5QYAA.js +2 -0
  8. package/dist/exports/client/chunk-43E5QYAA.js.map +7 -0
  9. package/dist/exports/client/{chunk-ESITTE3C.js → chunk-ZFGDYZDE.js} +2 -2
  10. package/dist/exports/client/{chunk-ESITTE3C.js.map → chunk-ZFGDYZDE.js.map} +2 -2
  11. package/dist/exports/client/component-D5QLYS7W.js +2 -0
  12. package/dist/exports/client/component-D5QLYS7W.js.map +7 -0
  13. package/dist/exports/client/componentInline-55HZXGUS.js +2 -0
  14. package/dist/exports/client/index.d.ts +1 -3
  15. package/dist/exports/client/index.d.ts.map +1 -1
  16. package/dist/exports/client/index.js +27 -28
  17. package/dist/exports/client/index.js.map +4 -4
  18. package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
  19. package/dist/features/blockquote/client/index.js +2 -2
  20. package/dist/features/blockquote/client/index.js.map +1 -1
  21. package/dist/features/blockquote/server/index.js +2 -2
  22. package/dist/features/blockquote/server/index.js.map +1 -1
  23. package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
  24. package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
  25. package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
  26. package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
  27. package/dist/features/blocks/client/component/index.css +2 -2
  28. package/dist/features/blocks/client/component/index.d.ts +0 -6
  29. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  30. package/dist/features/blocks/client/component/index.js +133 -76
  31. package/dist/features/blocks/client/component/index.js.map +1 -1
  32. package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
  33. package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
  34. package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
  35. package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
  36. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -1
  37. package/dist/features/blocks/client/componentInline/index.css +8 -8
  38. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  39. package/dist/features/blocks/client/componentInline/index.js +2 -2
  40. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  41. package/dist/features/blocks/client/getBlockImageComponent.d.ts +1 -1
  42. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +1 -1
  43. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -1
  44. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +1 -1
  45. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -1
  46. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +1 -1
  47. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -1
  48. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +5 -2
  49. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -1
  50. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +1 -2
  51. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  52. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  53. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  54. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  55. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.css +1 -1
  56. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.css +2 -4
  57. package/dist/features/blocks/premade/CodeBlock/Component/index.css +5 -5
  58. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  59. package/dist/features/blocks/server/index.js +2 -2
  60. package/dist/features/blocks/server/index.js.map +1 -1
  61. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +1 -1
  62. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  63. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  64. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  65. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  66. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  67. package/dist/features/blocks/server/schema.js +3 -2
  68. package/dist/features/blocks/server/schema.js.map +1 -1
  69. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  70. package/dist/features/converters/htmlToLexical/index.d.ts.map +1 -1
  71. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  72. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  73. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  74. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  75. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  76. package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts.map +1 -1
  77. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.d.ts.map +1 -1
  78. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js +3 -2
  79. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  80. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  81. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  82. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  83. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  84. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  85. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  86. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  87. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  88. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  89. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  90. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  91. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  92. package/dist/features/converters/lexicalToMarkdown/index.js +1 -1
  93. package/dist/features/converters/lexicalToMarkdown/index.js.map +1 -1
  94. package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
  95. package/dist/features/converters/markdownToLexical/index.js +5 -2
  96. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  97. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  98. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  99. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  100. package/dist/features/debug/jsxConverter/client/plugin/style.css +2 -2
  101. package/dist/features/debug/testRecorder/client/plugin/index.css +0 -1
  102. package/dist/features/format/bold/feature.client.js +1 -1
  103. package/dist/features/format/bold/feature.client.js.map +1 -1
  104. package/dist/features/format/bold/feature.server.d.ts.map +1 -1
  105. package/dist/features/format/bold/feature.server.js +1 -1
  106. package/dist/features/format/bold/feature.server.js.map +1 -1
  107. package/dist/features/format/inlineCode/feature.client.js +1 -1
  108. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  109. package/dist/features/format/inlineCode/feature.server.d.ts.map +1 -1
  110. package/dist/features/format/inlineCode/feature.server.js +1 -1
  111. package/dist/features/format/inlineCode/feature.server.js.map +1 -1
  112. package/dist/features/format/italic/feature.client.js +1 -1
  113. package/dist/features/format/italic/feature.client.js.map +1 -1
  114. package/dist/features/format/italic/feature.server.d.ts.map +1 -1
  115. package/dist/features/format/italic/feature.server.js +1 -1
  116. package/dist/features/format/italic/feature.server.js.map +1 -1
  117. package/dist/features/format/shared/toolbarFormatGroup.d.ts.map +1 -1
  118. package/dist/features/format/strikethrough/feature.client.js +1 -1
  119. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  120. package/dist/features/format/strikethrough/feature.server.d.ts.map +1 -1
  121. package/dist/features/format/strikethrough/feature.server.js +1 -1
  122. package/dist/features/format/strikethrough/feature.server.js.map +1 -1
  123. package/dist/features/heading/client/index.js +2 -2
  124. package/dist/features/heading/client/index.js.map +1 -1
  125. package/dist/features/heading/constants.d.ts +2 -0
  126. package/dist/features/heading/constants.d.ts.map +1 -0
  127. package/dist/features/heading/constants.js +2 -0
  128. package/dist/features/heading/constants.js.map +1 -0
  129. package/dist/features/heading/markdownTransformer.d.ts +2 -2
  130. package/dist/features/heading/markdownTransformer.d.ts.map +1 -1
  131. package/dist/features/heading/markdownTransformer.js +6 -19
  132. package/dist/features/heading/markdownTransformer.js.map +1 -1
  133. package/dist/features/heading/server/index.d.ts.map +1 -1
  134. package/dist/features/heading/server/index.js +7 -3
  135. package/dist/features/heading/server/index.js.map +1 -1
  136. package/dist/features/heading/server/schema.d.ts.map +1 -1
  137. package/dist/features/heading/server/validate.d.ts +6 -0
  138. package/dist/features/heading/server/validate.d.ts.map +1 -0
  139. package/dist/features/heading/server/validate.js +15 -0
  140. package/dist/features/heading/server/validate.js.map +1 -0
  141. package/dist/features/horizontalRule/client/index.js +2 -2
  142. package/dist/features/horizontalRule/client/index.js.map +1 -1
  143. package/dist/features/horizontalRule/client/markdownTransformer.d.ts +2 -2
  144. package/dist/features/horizontalRule/client/markdownTransformer.d.ts.map +1 -1
  145. package/dist/features/horizontalRule/client/markdownTransformer.js +1 -1
  146. package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
  147. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  148. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  149. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +1 -1
  150. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  151. package/dist/features/horizontalRule/client/plugin/index.css +2 -2
  152. package/dist/features/horizontalRule/server/index.js +2 -2
  153. package/dist/features/horizontalRule/server/index.js.map +1 -1
  154. package/dist/features/horizontalRule/server/markdownTransformer.d.ts +2 -2
  155. package/dist/features/horizontalRule/server/markdownTransformer.d.ts.map +1 -1
  156. package/dist/features/horizontalRule/server/markdownTransformer.js +1 -1
  157. package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
  158. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -1
  159. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  160. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +1 -1
  161. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  162. package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
  163. package/dist/features/indent/client/IndentPlugin.js +122 -1
  164. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  165. package/dist/features/indent/client/toolbarIndentGroup.d.ts.map +1 -1
  166. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  167. package/dist/features/indent/server/i18n.js +74 -37
  168. package/dist/features/indent/server/i18n.js.map +1 -1
  169. package/dist/features/link/client/index.js +2 -2
  170. package/dist/features/link/client/index.js.map +1 -1
  171. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  172. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  173. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +11 -8
  174. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  175. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +7 -12
  176. package/dist/features/link/markdownTransformer.d.ts +4 -4
  177. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  178. package/dist/features/link/markdownTransformer.js +2 -2
  179. package/dist/features/link/markdownTransformer.js.map +1 -1
  180. package/dist/features/link/nodes/AutoLinkNode.d.ts +1 -1
  181. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  182. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  183. package/dist/features/link/nodes/LinkNode.d.ts +1 -1
  184. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  185. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  186. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  187. package/dist/features/link/server/baseFields.js.map +1 -1
  188. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  189. package/dist/features/link/server/index.js +4 -4
  190. package/dist/features/link/server/index.js.map +1 -1
  191. package/dist/features/link/server/schema.d.ts.map +1 -1
  192. package/dist/features/link/server/schema.js +4 -2
  193. package/dist/features/link/server/schema.js.map +1 -1
  194. package/dist/features/link/server/validate.d.ts.map +1 -1
  195. package/dist/features/lists/checklist/client/index.js +1 -1
  196. package/dist/features/lists/checklist/client/index.js.map +1 -1
  197. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  198. package/dist/features/lists/checklist/server/index.js +6 -3
  199. package/dist/features/lists/checklist/server/index.js.map +1 -1
  200. package/dist/features/lists/orderedList/client/index.js +1 -1
  201. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  202. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  203. package/dist/features/lists/orderedList/server/index.js +6 -3
  204. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  205. package/dist/features/lists/shared/constants.d.ts +2 -0
  206. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  207. package/dist/features/lists/shared/constants.js +2 -0
  208. package/dist/features/lists/shared/constants.js.map +1 -0
  209. package/dist/features/lists/shared/validate.d.ts +5 -0
  210. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  211. package/dist/features/lists/shared/validate.js +15 -0
  212. package/dist/features/lists/shared/validate.js.map +1 -0
  213. package/dist/features/lists/unorderedList/client/index.js +1 -1
  214. package/dist/features/lists/unorderedList/client/index.js.map +1 -1
  215. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  216. package/dist/features/lists/unorderedList/server/index.js +6 -3
  217. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  218. package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
  219. package/dist/features/relationship/client/index.d.ts +2 -2
  220. package/dist/features/relationship/client/index.d.ts.map +1 -1
  221. package/dist/features/relationship/client/index.js.map +1 -1
  222. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  223. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  224. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  225. package/dist/features/relationship/client/plugins/index.js +27 -31
  226. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  227. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  228. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  229. package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
  230. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  231. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  232. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  233. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  234. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  235. package/dist/features/relationship/server/index.d.ts +8 -1
  236. package/dist/features/relationship/server/index.d.ts.map +1 -1
  237. package/dist/features/relationship/server/index.js +28 -11
  238. package/dist/features/relationship/server/index.js.map +1 -1
  239. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  240. package/dist/features/relationship/server/schema.d.ts +5 -5
  241. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  242. package/dist/features/relationship/server/schema.js +27 -15
  243. package/dist/features/relationship/server/schema.js.map +1 -1
  244. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
  245. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  246. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +1 -5
  247. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
  248. package/dist/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -1
  249. package/dist/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -1
  250. package/dist/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -1
  251. package/dist/features/table/client/index.d.ts.map +1 -0
  252. package/dist/features/{experimental_table → table}/client/index.js +2 -2
  253. package/dist/features/table/client/index.js.map +1 -0
  254. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  255. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  256. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  257. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  258. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -0
  259. package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.js +17 -44
  260. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -0
  261. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -0
  262. package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.js +41 -18
  263. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -0
  264. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
  265. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -0
  266. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +1 -0
  267. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.js.map +1 -0
  268. package/dist/features/table/client/plugins/TablePlugin/index.d.ts.map +1 -0
  269. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -0
  270. package/dist/features/table/client/utils/debounce.d.ts.map +1 -0
  271. package/dist/features/table/client/utils/debounce.js.map +1 -0
  272. package/dist/features/table/client/utils/useDebounce.d.ts.map +1 -0
  273. package/dist/features/table/client/utils/useDebounce.js.map +1 -0
  274. package/dist/features/table/markdownTransformer.d.ts +5 -0
  275. package/dist/features/table/markdownTransformer.d.ts.map +1 -0
  276. package/dist/features/{experimental_table → table}/markdownTransformer.js +6 -3
  277. package/dist/features/table/markdownTransformer.js.map +1 -0
  278. package/dist/features/table/server/index.d.ts +3 -0
  279. package/dist/features/table/server/index.d.ts.map +1 -0
  280. package/dist/features/{experimental_table → table}/server/index.js +6 -6
  281. package/dist/features/table/server/index.js.map +1 -0
  282. package/dist/features/table/server/schema.d.ts.map +1 -0
  283. package/dist/features/table/server/schema.js.map +1 -0
  284. package/dist/features/textState/feature.client.js +1 -1
  285. package/dist/features/textState/feature.client.js.map +1 -1
  286. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts +8 -0
  287. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.d.ts.map +1 -0
  288. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js +80 -0
  289. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -0
  290. package/dist/features/toolbars/fixed/client/Toolbar/index.css +80 -8
  291. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  292. package/dist/features/toolbars/fixed/client/Toolbar/index.js +4 -1
  293. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  294. package/dist/features/toolbars/inline/client/Toolbar/index.css +2 -14
  295. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
  296. package/dist/features/toolbars/inline/client/Toolbar/index.js +2 -2
  297. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  298. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  299. package/dist/features/toolbars/shared/ToolbarButton/index.js +1 -0
  300. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  301. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  302. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +85 -32
  303. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  304. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +23 -24
  305. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  306. package/dist/features/toolbars/shared/useToolbarStates.d.ts.map +1 -1
  307. package/dist/features/toolbars/shared/useToolbarStates.js +3 -1
  308. package/dist/features/toolbars/shared/useToolbarStates.js.map +1 -1
  309. package/dist/features/typesClient.d.ts +1 -1
  310. package/dist/features/typesClient.d.ts.map +1 -1
  311. package/dist/features/typesClient.js.map +1 -1
  312. package/dist/features/typesServer.d.ts +16 -11
  313. package/dist/features/typesServer.d.ts.map +1 -1
  314. package/dist/features/typesServer.js.map +1 -1
  315. package/dist/features/upload/client/component/index.css +9 -9
  316. package/dist/features/upload/client/component/index.js +2 -1
  317. package/dist/features/upload/client/component/index.js.map +1 -1
  318. package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
  319. package/dist/features/upload/client/index.d.ts +3 -2
  320. package/dist/features/upload/client/index.d.ts.map +1 -1
  321. package/dist/features/upload/client/index.js.map +1 -1
  322. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  323. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  324. package/dist/features/upload/client/plugin/index.js +53 -56
  325. package/dist/features/upload/client/plugin/index.js.map +1 -1
  326. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  327. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  328. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  329. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  330. package/dist/features/upload/server/index.d.ts +6 -2
  331. package/dist/features/upload/server/index.d.ts.map +1 -1
  332. package/dist/features/upload/server/index.js +22 -18
  333. package/dist/features/upload/server/index.js.map +1 -1
  334. package/dist/features/upload/server/markdownTransformer.d.ts +2 -2
  335. package/dist/features/upload/server/markdownTransformer.d.ts.map +1 -1
  336. package/dist/features/upload/server/markdownTransformer.js +1 -1
  337. package/dist/features/upload/server/markdownTransformer.js.map +1 -1
  338. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  339. package/dist/features/upload/server/schema.d.ts +6 -6
  340. package/dist/features/upload/server/schema.d.ts.map +1 -1
  341. package/dist/features/upload/server/schema.js +30 -14
  342. package/dist/features/upload/server/schema.js.map +1 -1
  343. package/dist/features/upload/server/validate.d.ts +2 -2
  344. package/dist/features/upload/server/validate.d.ts.map +1 -1
  345. package/dist/features/upload/server/validate.js +3 -0
  346. package/dist/features/upload/server/validate.js.map +1 -1
  347. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  348. package/dist/field/Diff/converters/listitem/index.js +2 -1
  349. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  350. package/dist/field/Diff/converters/unknown/index.css +1 -1
  351. package/dist/field/Diff/index.d.ts +3 -2
  352. package/dist/field/Diff/index.d.ts.map +1 -1
  353. package/dist/field/Diff/index.js +1 -0
  354. package/dist/field/Diff/index.js.map +1 -1
  355. package/dist/field/Field.d.ts.map +1 -1
  356. package/dist/field/Field.js +18 -15
  357. package/dist/field/Field.js.map +1 -1
  358. package/dist/field/RenderLexical/index.d.ts +3 -1
  359. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  360. package/dist/field/RenderLexical/index.js +23 -23
  361. package/dist/field/RenderLexical/index.js.map +1 -1
  362. package/dist/field/ViewSelector.css +1 -1
  363. package/dist/field/ViewSelector.d.ts.map +1 -1
  364. package/dist/field/ViewSelector.js +1 -0
  365. package/dist/field/ViewSelector.js.map +1 -1
  366. package/dist/field/bundled.css +1 -1
  367. package/dist/field/index.css +4 -4
  368. package/dist/i18n.d.ts.map +1 -1
  369. package/dist/i18n.js +68 -0
  370. package/dist/i18n.js.map +1 -1
  371. package/dist/index.d.ts +3 -3
  372. package/dist/index.d.ts.map +1 -1
  373. package/dist/index.js +11 -54
  374. package/dist/index.js.map +1 -1
  375. package/dist/lexical/LexicalEditor.css +29 -18
  376. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  377. package/dist/lexical/LexicalEditor.js +62 -99
  378. package/dist/lexical/LexicalEditor.js.map +1 -1
  379. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  380. package/dist/lexical/LexicalProvider.js +7 -22
  381. package/dist/lexical/LexicalProvider.js.map +1 -1
  382. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  383. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  384. package/dist/lexical/config/server/loader.d.ts +1 -1
  385. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  386. package/dist/lexical/config/server/loader.js +2 -2
  387. package/dist/lexical/config/server/loader.js.map +1 -1
  388. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  389. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  390. package/dist/lexical/config/server/sanitize.js +2 -2
  391. package/dist/lexical/config/server/sanitize.js.map +1 -1
  392. package/dist/lexical/plugins/DecoratorPlugin/index.css +1 -1
  393. package/dist/lexical/plugins/DecoratorPlugin/index.d.ts.map +1 -1
  394. package/dist/lexical/plugins/DecoratorPlugin/index.js +24 -21
  395. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  396. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +18 -25
  397. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
  398. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +27 -14
  399. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  400. package/dist/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
  401. package/dist/lexical/plugins/MarkdownShortcut/index.js +1 -1
  402. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  403. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -1
  404. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +21 -0
  405. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
  406. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +0 -1
  407. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  408. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +2 -21
  409. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  410. package/dist/lexical/plugins/SlashMenu/index.css +1 -6
  411. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +2 -1
  412. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
  413. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  414. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  415. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +5 -3
  416. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  417. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +17 -3
  418. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  419. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  420. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  421. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +65 -0
  422. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  423. package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -1
  424. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  425. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
  426. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  427. package/dist/lexical/theme/EditorTheme.css +18 -19
  428. package/dist/lexical/ui/ContentEditable.css +22 -17
  429. package/dist/lexical/ui/ContentEditable.d.ts +2 -1
  430. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  431. package/dist/lexical/ui/ContentEditable.js +9 -6
  432. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  433. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  434. package/dist/lexical/ui/icons/H3/index.js +13 -6
  435. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  436. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  437. package/dist/lexical/ui/icons/H4/index.js +13 -6
  438. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  439. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  440. package/dist/lexical/ui/icons/H5/index.js +13 -6
  441. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  442. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  443. package/dist/lexical/ui/icons/H6/index.js +13 -6
  444. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  445. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts +17 -0
  446. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts.map +1 -0
  447. package/dist/lexical/utils/markdown/convertFromMarkdownString.js +27 -0
  448. package/dist/lexical/utils/markdown/convertFromMarkdownString.js.map +1 -0
  449. package/dist/lexical/utils/markdown/createBlockNode.d.ts +2 -2
  450. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  451. package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
  452. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts +25 -0
  453. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts.map +1 -0
  454. package/dist/lexical/utils/markdown/normalizeMarkdown.js +91 -0
  455. package/dist/lexical/utils/markdown/normalizeMarkdown.js.map +1 -0
  456. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  457. package/dist/lexical/utils/point.d.ts.map +1 -1
  458. package/dist/lexical/utils/rect.d.ts.map +1 -1
  459. package/dist/lexical-proxy/@lexical-markdown.d.ts +1 -1
  460. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -1
  461. package/dist/lexical-proxy/@lexical-markdown.js +1 -1
  462. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -1
  463. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts +2 -0
  464. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts.map +1 -0
  465. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js +2 -0
  466. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js.map +1 -0
  467. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts +2 -0
  468. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts.map +1 -0
  469. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js +2 -0
  470. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js.map +1 -0
  471. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts +2 -0
  472. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts.map +1 -0
  473. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js +2 -0
  474. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js.map +1 -0
  475. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts +2 -0
  476. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts.map +1 -0
  477. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js +2 -0
  478. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js.map +1 -0
  479. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts +2 -0
  480. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts.map +1 -0
  481. package/dist/lexical-proxy/@lexical-react/ReactExtension.js +2 -0
  482. package/dist/lexical-proxy/@lexical-react/ReactExtension.js.map +1 -0
  483. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts +2 -0
  484. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts.map +1 -0
  485. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js +2 -0
  486. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js.map +1 -0
  487. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts +2 -0
  488. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts.map +1 -0
  489. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js +2 -0
  490. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js.map +1 -0
  491. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts +2 -0
  492. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts.map +1 -0
  493. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js +2 -0
  494. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js.map +1 -0
  495. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts +2 -0
  496. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts.map +1 -0
  497. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js +2 -0
  498. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js.map +1 -0
  499. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts +2 -0
  500. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts.map +1 -0
  501. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js +2 -0
  502. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js.map +1 -0
  503. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts +2 -0
  504. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts.map +1 -0
  505. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js +2 -0
  506. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js.map +1 -0
  507. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts +2 -0
  508. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts.map +1 -0
  509. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js +2 -0
  510. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js.map +1 -0
  511. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts +2 -0
  512. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts.map +1 -0
  513. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js +2 -0
  514. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js.map +1 -0
  515. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts +2 -0
  516. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts.map +1 -0
  517. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js +2 -0
  518. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js.map +1 -0
  519. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts +2 -0
  520. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts.map +1 -0
  521. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js +2 -0
  522. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js.map +1 -0
  523. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
  524. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -1
  525. package/dist/types/index.d.ts +1 -1
  526. package/dist/types/index.d.ts.map +1 -1
  527. package/dist/types/index.js.map +1 -1
  528. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  529. package/dist/types/nodeTypes.d.ts +1 -1
  530. package/dist/types/nodeTypes.d.ts.map +1 -1
  531. package/dist/types/nodeTypes.js.map +1 -1
  532. package/dist/types/schema.d.ts.map +1 -1
  533. package/dist/types/schema.js +12 -5
  534. package/dist/types/schema.js.map +1 -1
  535. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  536. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  537. package/dist/utilities/createServerFeature.d.ts +1 -1
  538. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  539. package/dist/utilities/createServerFeature.js +2 -2
  540. package/dist/utilities/createServerFeature.js.map +1 -1
  541. package/dist/utilities/editorConfigFactory.d.ts +6 -6
  542. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  543. package/dist/utilities/editorConfigFactory.js +9 -9
  544. package/dist/utilities/editorConfigFactory.js.map +1 -1
  545. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +1 -1
  546. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -1
  547. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -1
  548. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -1
  549. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -1
  550. package/dist/utilities/generateImportMap.d.ts +1 -1
  551. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  552. package/dist/utilities/generateImportMap.js +3 -7
  553. package/dist/utilities/generateImportMap.js.map +1 -1
  554. package/dist/utilities/generateSchemaMap.d.ts +1 -1
  555. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  556. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts +2 -2
  557. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  558. package/dist/utilities/getDefaultSanitizedEditorConfig.js +6 -17
  559. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -1
  560. package/dist/utilities/recurseNodeTree.d.ts.map +1 -1
  561. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  562. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  563. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  564. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  565. package/dist/validate/hasText.d.ts +2 -2
  566. package/dist/validate/hasText.d.ts.map +1 -1
  567. package/dist/validate/hasText.js.map +1 -1
  568. package/dist/validate/index.d.ts +1 -1
  569. package/dist/validate/index.d.ts.map +1 -1
  570. package/package.json +96 -28
  571. package/dist/@types/assets.d.js +0 -2
  572. package/dist/@types/assets.d.js.map +0 -1
  573. package/dist/dependencyChecker.spec.js +0 -16
  574. package/dist/dependencyChecker.spec.js.map +0 -1
  575. package/dist/exports/client/Field-VW7ZGT6K.js +0 -2
  576. package/dist/exports/client/Field-VW7ZGT6K.js.map +0 -7
  577. package/dist/exports/client/chunk-4EIYXZ6H.js +0 -12
  578. package/dist/exports/client/chunk-4EIYXZ6H.js.map +0 -7
  579. package/dist/exports/client/chunk-UD4DQ4AK.js +0 -2
  580. package/dist/exports/client/chunk-UD4DQ4AK.js.map +0 -7
  581. package/dist/exports/client/component-PHZQBOJE.js +0 -2
  582. package/dist/exports/client/component-PHZQBOJE.js.map +0 -7
  583. package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
  584. package/dist/exports/server/rsc.browser.d.ts +0 -11
  585. package/dist/exports/server/rsc.browser.d.ts.map +0 -1
  586. package/dist/exports/server/rsc.browser.js +0 -10
  587. package/dist/exports/server/rsc.browser.js.map +0 -1
  588. package/dist/features/blockquote/markdownTransformer.d.ts +0 -3
  589. package/dist/features/blockquote/markdownTransformer.d.ts.map +0 -1
  590. package/dist/features/blockquote/markdownTransformer.js +0 -33
  591. package/dist/features/blockquote/markdownTransformer.js.map +0 -1
  592. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  593. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  594. package/dist/features/experimental_table/client/index.d.ts.map +0 -1
  595. package/dist/features/experimental_table/client/index.js.map +0 -1
  596. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +0 -1
  597. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +0 -1
  598. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +0 -1
  599. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +0 -1
  600. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +0 -1
  601. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +0 -1
  602. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +0 -1
  603. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js.map +0 -1
  604. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +0 -1
  605. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +0 -1
  606. package/dist/features/experimental_table/client/utils/debounce.d.ts.map +0 -1
  607. package/dist/features/experimental_table/client/utils/debounce.js.map +0 -1
  608. package/dist/features/experimental_table/client/utils/useDebounce.d.ts.map +0 -1
  609. package/dist/features/experimental_table/client/utils/useDebounce.js.map +0 -1
  610. package/dist/features/experimental_table/markdownTransformer.d.ts +0 -5
  611. package/dist/features/experimental_table/markdownTransformer.d.ts.map +0 -1
  612. package/dist/features/experimental_table/markdownTransformer.js.map +0 -1
  613. package/dist/features/experimental_table/server/index.d.ts +0 -3
  614. package/dist/features/experimental_table/server/index.d.ts.map +0 -1
  615. package/dist/features/experimental_table/server/index.js.map +0 -1
  616. package/dist/features/experimental_table/server/schema.d.ts.map +0 -1
  617. package/dist/features/experimental_table/server/schema.js.map +0 -1
  618. package/dist/features/format/bold/markdownTransformers.d.ts +0 -6
  619. package/dist/features/format/bold/markdownTransformers.d.ts.map +0 -1
  620. package/dist/features/format/bold/markdownTransformers.js +0 -23
  621. package/dist/features/format/bold/markdownTransformers.js.map +0 -1
  622. package/dist/features/format/inlineCode/markdownTransformers.d.ts +0 -3
  623. package/dist/features/format/inlineCode/markdownTransformers.d.ts.map +0 -1
  624. package/dist/features/format/inlineCode/markdownTransformers.js +0 -6
  625. package/dist/features/format/inlineCode/markdownTransformers.js.map +0 -1
  626. package/dist/features/format/italic/markdownTransformers.d.ts +0 -4
  627. package/dist/features/format/italic/markdownTransformers.d.ts.map +0 -1
  628. package/dist/features/format/italic/markdownTransformers.js +0 -12
  629. package/dist/features/format/italic/markdownTransformers.js.map +0 -1
  630. package/dist/features/format/strikethrough/markdownTransformers.d.ts +0 -3
  631. package/dist/features/format/strikethrough/markdownTransformers.d.ts.map +0 -1
  632. package/dist/features/format/strikethrough/markdownTransformers.js +0 -6
  633. package/dist/features/format/strikethrough/markdownTransformers.js.map +0 -1
  634. package/dist/features/link/markdownTransformer.spec.js +0 -195
  635. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  636. package/dist/features/lists/checklist/markdownTransformers.d.ts +0 -3
  637. package/dist/features/lists/checklist/markdownTransformers.d.ts.map +0 -1
  638. package/dist/features/lists/checklist/markdownTransformers.js +0 -12
  639. package/dist/features/lists/checklist/markdownTransformers.js.map +0 -1
  640. package/dist/features/lists/orderedList/markdownTransformer.d.ts +0 -3
  641. package/dist/features/lists/orderedList/markdownTransformer.d.ts.map +0 -1
  642. package/dist/features/lists/orderedList/markdownTransformer.js +0 -12
  643. package/dist/features/lists/orderedList/markdownTransformer.js.map +0 -1
  644. package/dist/features/lists/shared/markdown.d.ts +0 -6
  645. package/dist/features/lists/shared/markdown.d.ts.map +0 -1
  646. package/dist/features/lists/shared/markdown.js +0 -57
  647. package/dist/features/lists/shared/markdown.js.map +0 -1
  648. package/dist/features/lists/unorderedList/markdownTransformer.d.ts +0 -3
  649. package/dist/features/lists/unorderedList/markdownTransformer.d.ts.map +0 -1
  650. package/dist/features/lists/unorderedList/markdownTransformer.js +0 -12
  651. package/dist/features/lists/unorderedList/markdownTransformer.js.map +0 -1
  652. package/dist/field/clientEntry.d.ts +0 -29
  653. package/dist/field/clientEntry.d.ts.map +0 -1
  654. package/dist/field/clientEntry.js +0 -86
  655. package/dist/field/clientEntry.js.map +0 -1
  656. package/dist/lexical/utils/guard.d.ts +0 -5
  657. package/dist/lexical/utils/guard.d.ts.map +0 -1
  658. package/dist/lexical/utils/guard.js +0 -9
  659. package/dist/lexical/utils/guard.js.map +0 -1
  660. package/dist/lexical/utils/url.spec.js +0 -114
  661. package/dist/lexical/utils/url.spec.js.map +0 -1
  662. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +0 -2
  663. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +0 -1
  664. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +0 -2
  665. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +0 -1
  666. package/dist/packages/@lexical/markdown/LexicalMarkdownHardLineBreak.spec.js +0 -160
  667. package/dist/packages/@lexical/markdown/LexicalMarkdownHardLineBreak.spec.js.map +0 -1
  668. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts +0 -14
  669. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts.map +0 -1
  670. package/dist/packages/@lexical/markdown/MarkdownExport.js +0 -220
  671. package/dist/packages/@lexical/markdown/MarkdownExport.js.map +0 -1
  672. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts +0 -19
  673. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +0 -1
  674. package/dist/packages/@lexical/markdown/MarkdownImport.js +0 -199
  675. package/dist/packages/@lexical/markdown/MarkdownImport.js.map +0 -1
  676. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts +0 -11
  677. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts.map +0 -1
  678. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +0 -304
  679. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +0 -1
  680. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts +0 -173
  681. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts.map +0 -1
  682. package/dist/packages/@lexical/markdown/MarkdownTransformers.js +0 -352
  683. package/dist/packages/@lexical/markdown/MarkdownTransformers.js.map +0 -1
  684. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts +0 -22
  685. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts.map +0 -1
  686. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +0 -91
  687. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +0 -1
  688. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts +0 -21
  689. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts.map +0 -1
  690. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +0 -54
  691. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +0 -1
  692. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts +0 -18
  693. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts.map +0 -1
  694. package/dist/packages/@lexical/markdown/importTextTransformers.js +0 -54
  695. package/dist/packages/@lexical/markdown/importTextTransformers.js.map +0 -1
  696. package/dist/packages/@lexical/markdown/index.d.ts +0 -29
  697. package/dist/packages/@lexical/markdown/index.d.ts.map +0 -1
  698. package/dist/packages/@lexical/markdown/index.js +0 -39
  699. package/dist/packages/@lexical/markdown/index.js.map +0 -1
  700. package/dist/packages/@lexical/markdown/utils.d.ts +0 -34
  701. package/dist/packages/@lexical/markdown/utils.d.ts.map +0 -1
  702. package/dist/packages/@lexical/markdown/utils.js +0 -267
  703. package/dist/packages/@lexical/markdown/utils.js.map +0 -1
  704. package/dist/utilities/jsx/jsx.spec.js +0 -178
  705. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
  706. /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-55HZXGUS.js.map} +0 -0
  707. /package/dist/features/{experimental_table → table}/client/index.d.ts +0 -0
  708. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.css +0 -0
  709. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.d.ts +0 -0
  710. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.css +0 -0
  711. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.d.ts +0 -0
  712. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.d.ts +0 -0
  713. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.js +0 -0
  714. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.css +0 -0
  715. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.d.ts +0 -0
  716. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.js +0 -0
  717. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.css +0 -0
  718. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.d.ts +0 -0
  719. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.js +0 -0
  720. /package/dist/features/{experimental_table → table}/client/utils/debounce.d.ts +0 -0
  721. /package/dist/features/{experimental_table → table}/client/utils/debounce.js +0 -0
  722. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.d.ts +0 -0
  723. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.js +0 -0
  724. /package/dist/features/{experimental_table → table}/server/schema.d.ts +0 -0
  725. /package/dist/features/{experimental_table → table}/server/schema.js +0 -0
@@ -1,34 +1,35 @@
1
1
  import { sanitizeFields } from 'payload';
2
2
  import { populate } from '../../../populateGraphQL/populate.js';
3
3
  import { createServerFeature } from '../../../utilities/createServerFeature.js';
4
+ import { filterEnabledRelationshipCollections } from '../../relationship/shared/filterEnabledRelationshipCollections.js';
4
5
  import { createNode } from '../../typeUtilities.js';
5
6
  import { uploadPopulationPromiseHOC } from './graphQLPopulationPromise.js';
6
7
  import { i18n } from './i18n.js';
7
- import { UploadMarkdownTransformer } from './markdownTransformer.js';
8
+ import { PAYLOAD_UPLOAD } from './markdownTransformer.js';
8
9
  import { UploadServerNode } from './nodes/UploadNode.js';
9
10
  import { createUploadNodeJSONSchema } from './schema.js';
10
11
  import { uploadValidation } from './validate.js';
11
12
  export const UploadFeature = createServerFeature({
12
- feature: async ({
13
+ feature: ({
13
14
  config: _config,
14
15
  isRoot,
15
16
  parentIsLocalized,
16
- props
17
+ props: unsanitizedProps
17
18
  }) => {
18
- if (!props) {
19
- props = {
20
- collections: {}
21
- };
22
- }
19
+ const props = {
20
+ ...unsanitizedProps,
21
+ collections: unsanitizedProps?.collections ?? {},
22
+ enabledCollectionSlugs: filterEnabledRelationshipCollections(_config.collections, {
23
+ ...unsanitizedProps,
24
+ uploads: true
25
+ }).map(({
26
+ slug
27
+ }) => slug)
28
+ };
23
29
  const clientProps = {
24
- collections: {}
30
+ collections: {},
31
+ enabledCollectionSlugs: props.enabledCollectionSlugs
25
32
  };
26
- if (props.disabledCollections) {
27
- clientProps.disabledCollections = props.disabledCollections;
28
- }
29
- if (props.enabledCollections) {
30
- clientProps.enabledCollections = props.enabledCollections;
31
- }
32
33
  if (props.collections) {
33
34
  for (const collection in props.collections) {
34
35
  clientProps.collections[collection] = {
@@ -40,7 +41,7 @@ export const UploadFeature = createServerFeature({
40
41
  for (const collectionKey in props.collections) {
41
42
  const collection = props.collections[collectionKey];
42
43
  if (collection.fields?.length) {
43
- collection.fields = await sanitizeFields({
44
+ collection.fields = sanitizeFields({
44
45
  config: _config,
45
46
  fields: collection.fields,
46
47
  parentIsLocalized,
@@ -70,7 +71,7 @@ export const UploadFeature = createServerFeature({
70
71
  return schemaMap;
71
72
  },
72
73
  i18n,
73
- markdownTransformers: [UploadMarkdownTransformer],
74
+ markdownTransformers: [PAYLOAD_UPLOAD],
74
75
  nodes: [createNode({
75
76
  getSubFields: ({
76
77
  node,
@@ -84,6 +85,9 @@ export const UploadFeature = createServerFeature({
84
85
  }
85
86
  return allSubFields;
86
87
  }
88
+ if (!props.enabledCollectionSlugs.includes(node.relationTo)) {
89
+ return null;
90
+ }
87
91
  const collection = req ? req.payload.collections[node?.relationTo] : null;
88
92
  if (collection) {
89
93
  const collectionFieldSchema = props?.collections?.[node?.relationTo]?.fields;
@@ -114,7 +118,7 @@ export const UploadFeature = createServerFeature({
114
118
  req,
115
119
  showHiddenFields
116
120
  }) => {
117
- if (!node?.value) {
121
+ if (!node?.value || !props.enabledCollectionSlugs.includes(node.relationTo)) {
118
122
  return node;
119
123
  }
120
124
  const collection = req.payload.collections[node?.relationTo];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["sanitizeFields","populate","createServerFeature","createNode","uploadPopulationPromiseHOC","i18n","UploadMarkdownTransformer","UploadServerNode","createUploadNodeJSONSchema","uploadValidation","UploadFeature","feature","config","_config","isRoot","parentIsLocalized","props","collections","clientProps","disabledCollections","enabledCollections","collection","hasExtraFields","fields","length","validRelationships","map","c","slug","collectionKey","requireFieldLevelRichTextEditor","ClientFeature","clientFeatureProps","generateSchemaMap","schemaMap","Map","set","markdownTransformers","nodes","getSubFields","node","req","allSubFields","collectionFields","concat","payload","relationTo","collectionFieldSchema","Array","isArray","getSubFieldsData","graphQLPopulationPromises","hooks","afterRead","currentDepth","depth","draft","overrideAccess","populateArg","populationPromises","showHiddenFields","value","id","populateDepth","maxDepth","undefined","push","collectionSlug","data","key","select","defaultPopulate","jsonSchema","validations","sanitizedServerFeatureProps"],"sources":["../../../../src/features/upload/server/index.ts"],"sourcesContent":["import type { Config, Field, FieldSchemaMap, UploadCollectionSlug } from 'payload'\n\nimport { sanitizeFields } from 'payload'\n\nimport type { UploadFeaturePropsClient } from '../client/index.js'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { uploadPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport { UploadMarkdownTransformer } from './markdownTransformer.js'\nimport { UploadServerNode } from './nodes/UploadNode.js'\nimport { createUploadNodeJSONSchema } from './schema.js'\nimport { uploadValidation } from './validate.js'\n\nexport type {\n Internal_UploadData,\n SerializedUploadNode,\n UploadData,\n UploadDataImproved,\n} from './schema.js'\n\nexport type ExclusiveUploadFeatureProps =\n | {\n /**\n * The collections that should be disabled. Overrides the `enableRichTextRelationship` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: UploadCollectionSlug[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled. Overrides the `enableRichTextRelationship` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: UploadCollectionSlug[]\n }\n\nexport type UploadFeatureProps = {\n collections?: {\n [collection: UploadCollectionSlug]: {\n fields: Field[]\n }\n }\n /**\n * Sets a maximum population depth for this upload (not the fields for this upload), regardless of the remaining depth when the respective field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n} & ExclusiveUploadFeatureProps\n\nexport const UploadFeature = createServerFeature<\n UploadFeatureProps,\n UploadFeatureProps,\n UploadFeaturePropsClient\n>({\n feature: async ({ config: _config, isRoot, parentIsLocalized, props }) => {\n if (!props) {\n props = { collections: {} }\n }\n\n const clientProps: UploadFeaturePropsClient = {\n collections: {},\n }\n if (props.disabledCollections) {\n clientProps.disabledCollections = props.disabledCollections\n }\n if (props.enabledCollections) {\n clientProps.enabledCollections = props.enabledCollections\n }\n\n if (props.collections) {\n for (const collection in props.collections) {\n clientProps.collections[collection] = {\n hasExtraFields: props.collections[collection]!.fields.length >= 1,\n }\n }\n }\n\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n for (const collectionKey in props.collections) {\n const collection = props.collections[collectionKey]!\n if (collection.fields?.length) {\n collection.fields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: collection.fields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n }\n }\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#UploadFeatureClient',\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ props }) => {\n if (!props?.collections) {\n return null\n }\n\n const schemaMap: FieldSchemaMap = new Map()\n\n for (const collectionKey in props.collections) {\n const collection = props.collections[collectionKey]!\n if (collection.fields?.length) {\n schemaMap.set(collectionKey, {\n fields: collection.fields,\n })\n }\n }\n\n return schemaMap\n },\n i18n,\n markdownTransformers: [UploadMarkdownTransformer],\n nodes: [\n createNode({\n getSubFields: ({ node, req }) => {\n if (!node) {\n let allSubFields: Field[] = []\n for (const collection in props?.collections) {\n const collectionFields = props.collections[collection]!.fields\n allSubFields = allSubFields.concat(collectionFields)\n }\n return allSubFields\n }\n const collection = req ? req.payload.collections[node?.relationTo] : null\n\n if (collection) {\n const collectionFieldSchema = props?.collections?.[node?.relationTo]?.fields\n\n if (Array.isArray(collectionFieldSchema)) {\n if (!collectionFieldSchema?.length) {\n return null\n }\n return collectionFieldSchema\n }\n }\n return null\n },\n getSubFieldsData: ({ node }) => {\n return node?.fields\n },\n graphQLPopulationPromises: [uploadPopulationPromiseHOC(props)],\n hooks: {\n afterRead: [\n ({\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n populateArg,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (!node?.value) {\n return node\n }\n const collection = req.payload.collections[node?.relationTo]\n\n if (!collection) {\n return node\n }\n const id =\n typeof node?.value === 'object' && node.value !== null && 'id' in node.value\n ? node.value.id\n : node?.value // for backwards-compatibility\n\n const populateDepth =\n props?.maxDepth !== undefined && props?.maxDepth < depth ? props?.maxDepth : depth\n\n populationPromises.push(\n populate({\n id,\n collectionSlug: collection.config.slug,\n currentDepth,\n data: node,\n depth: populateDepth,\n draft,\n key: 'value',\n overrideAccess,\n req,\n select:\n populateArg?.[collection.config.slug] ?? collection.config.defaultPopulate,\n showHiddenFields,\n }),\n )\n\n return node\n },\n ],\n },\n jsonSchema: createUploadNodeJSONSchema(props),\n node: UploadServerNode,\n validations: [uploadValidation(props)],\n }),\n ],\n sanitizedServerFeatureProps: props,\n }\n },\n key: 'upload',\n})\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAI/B,SAASC,QAAQ,QAAQ;AACzB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,IAAI,QAAQ;AACrB,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,gBAAgB,QAAQ;AACjC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,gBAAgB,QAAQ;AA8CjC,OAAO,MAAMC,aAAA,GAAgBR,mBAAA,CAI3B;EACAS,OAAA,EAAS,MAAAA,CAAO;IAAEC,MAAA,EAAQC,OAAO;IAAEC,MAAM;IAAEC,iBAAiB;IAAEC;EAAK,CAAE;IACnE,IAAI,CAACA,KAAA,EAAO;MACVA,KAAA,GAAQ;QAAEC,WAAA,EAAa,CAAC;MAAE;IAC5B;IAEA,MAAMC,WAAA,GAAwC;MAC5CD,WAAA,EAAa,CAAC;IAChB;IACA,IAAID,KAAA,CAAMG,mBAAmB,EAAE;MAC7BD,WAAA,CAAYC,mBAAmB,GAAGH,KAA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K;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["sanitizeFields","populate","createServerFeature","filterEnabledRelationshipCollections","createNode","uploadPopulationPromiseHOC","i18n","PAYLOAD_UPLOAD","UploadServerNode","createUploadNodeJSONSchema","uploadValidation","UploadFeature","feature","config","_config","isRoot","parentIsLocalized","props","unsanitizedProps","collections","enabledCollectionSlugs","uploads","map","slug","clientProps","collection","hasExtraFields","fields","length","validRelationships","c","collectionKey","requireFieldLevelRichTextEditor","ClientFeature","clientFeatureProps","generateSchemaMap","schemaMap","Map","set","markdownTransformers","nodes","getSubFields","node","req","allSubFields","collectionFields","concat","includes","relationTo","payload","collectionFieldSchema","Array","isArray","getSubFieldsData","graphQLPopulationPromises","hooks","afterRead","currentDepth","depth","draft","overrideAccess","populateArg","populationPromises","showHiddenFields","value","id","populateDepth","maxDepth","undefined","push","collectionSlug","data","key","select","defaultPopulate","jsonSchema","validations","sanitizedServerFeatureProps"],"sources":["../../../../src/features/upload/server/index.ts"],"sourcesContent":["import type { CollectionSlug, Config, Field, FieldSchemaMap, UploadCollectionSlug } from 'payload'\n\nimport { sanitizeFields } from 'payload'\n\nimport type { UploadFeaturePropsClient } from '../client/index.js'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { filterEnabledRelationshipCollections } from '../../relationship/shared/filterEnabledRelationshipCollections.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { uploadPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport { PAYLOAD_UPLOAD } from './markdownTransformer.js'\nimport { UploadServerNode } from './nodes/UploadNode.js'\nimport { createUploadNodeJSONSchema } from './schema.js'\nimport { uploadValidation } from './validate.js'\n\nexport type {\n Internal_UploadData,\n SerializedUploadNode,\n UploadData,\n UploadDataImproved,\n} from './schema.js'\n\nexport type ExclusiveUploadFeatureProps =\n | {\n /**\n * The collections that should be disabled. Overrides the `enableRichTextRelationship` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: UploadCollectionSlug[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled. Overrides the `enableRichTextRelationship` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: UploadCollectionSlug[]\n }\n\nexport type UploadFeatureProps = {\n collections?: {\n [collection: UploadCollectionSlug]: {\n fields: Field[]\n }\n }\n /**\n * Sets a maximum population depth for this upload (not the fields for this upload), regardless of the remaining depth when the respective field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n} & ExclusiveUploadFeatureProps\n\nexport type UploadFeatureServerProps = {\n /** Collection policy resolved during feature initialization. */\n enabledCollectionSlugs: CollectionSlug[]\n} & UploadFeatureProps\n\nexport const UploadFeature = createServerFeature<\n UploadFeatureProps,\n UploadFeatureServerProps,\n UploadFeaturePropsClient\n>({\n feature: ({ config: _config, isRoot, parentIsLocalized, props: unsanitizedProps }) => {\n const props: UploadFeatureServerProps = {\n ...unsanitizedProps,\n collections: unsanitizedProps?.collections ?? {},\n enabledCollectionSlugs: filterEnabledRelationshipCollections(_config.collections, {\n ...unsanitizedProps,\n uploads: true,\n }).map(({ slug }) => slug),\n }\n\n const clientProps: UploadFeaturePropsClient = {\n collections: {},\n enabledCollectionSlugs: props.enabledCollectionSlugs,\n }\n\n if (props.collections) {\n for (const collection in props.collections) {\n clientProps.collections[collection] = {\n hasExtraFields: props.collections[collection]!.fields.length >= 1,\n }\n }\n }\n\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n for (const collectionKey in props.collections) {\n const collection = props.collections[collectionKey]!\n if (collection.fields?.length) {\n collection.fields = sanitizeFields({\n config: _config as unknown as Config,\n fields: collection.fields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n }\n }\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#UploadFeatureClient',\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ props }) => {\n if (!props?.collections) {\n return null\n }\n\n const schemaMap: FieldSchemaMap = new Map()\n\n for (const collectionKey in props.collections) {\n const collection = props.collections[collectionKey]!\n if (collection.fields?.length) {\n schemaMap.set(collectionKey, {\n fields: collection.fields,\n })\n }\n }\n\n return schemaMap\n },\n i18n,\n markdownTransformers: [PAYLOAD_UPLOAD],\n nodes: [\n createNode({\n getSubFields: ({ node, req }) => {\n if (!node) {\n let allSubFields: Field[] = []\n for (const collection in props?.collections) {\n const collectionFields = props.collections[collection]!.fields\n allSubFields = allSubFields.concat(collectionFields)\n }\n return allSubFields\n }\n if (!props.enabledCollectionSlugs.includes(node.relationTo)) {\n return null\n }\n const collection = req ? req.payload.collections[node?.relationTo] : null\n\n if (collection) {\n const collectionFieldSchema = props?.collections?.[node?.relationTo]?.fields\n\n if (Array.isArray(collectionFieldSchema)) {\n if (!collectionFieldSchema?.length) {\n return null\n }\n return collectionFieldSchema\n }\n }\n return null\n },\n getSubFieldsData: ({ node }) => {\n return node?.fields\n },\n graphQLPopulationPromises: [uploadPopulationPromiseHOC(props)],\n hooks: {\n afterRead: [\n ({\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n populateArg,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (!node?.value || !props.enabledCollectionSlugs.includes(node.relationTo)) {\n return node\n }\n const collection = req.payload.collections[node?.relationTo]\n\n if (!collection) {\n return node\n }\n const id =\n typeof node?.value === 'object' && node.value !== null && 'id' in node.value\n ? node.value.id\n : node?.value // for backwards-compatibility\n\n const populateDepth =\n props?.maxDepth !== undefined && props?.maxDepth < depth ? props?.maxDepth : depth\n\n populationPromises.push(\n populate({\n id,\n collectionSlug: collection.config.slug,\n currentDepth,\n data: node,\n depth: populateDepth,\n draft,\n key: 'value',\n overrideAccess,\n req,\n select:\n populateArg?.[collection.config.slug] ?? collection.config.defaultPopulate,\n showHiddenFields,\n }),\n )\n\n return node\n },\n ],\n },\n jsonSchema: createUploadNodeJSONSchema(props),\n node: UploadServerNode,\n validations: [uploadValidation(props)],\n }),\n ],\n sanitizedServerFeatureProps: props,\n }\n },\n key: 'upload',\n})\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAI/B,SAASC,QAAQ,QAAQ;AACzB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,oCAAoC,QAAQ;AACrD,SAASC,UAAU,QAAQ;AAC3B,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,IAAI,QAAQ;AACrB,SAASC,cAAc,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,gBAAgB,QAAQ;AAmDjC,OAAO,MAAMC,aAAA,GAAgBT,mBAAA,CAI3B;EACAU,OAAA,EAASA,CAAC;IAAEC,MAAA,EAAQC,OAAO;IAAEC,MAAM;IAAEC,iBAAiB;IAAEC,KAAA,EAAOC;EAAgB,CAAE;IAC/E,MAAMD,KAAA,GAAkC;MACtC,GAAGC,gBAAgB;MACnBC,WAAA,EAAaD,gBAAA,EAAkBC,WAAA,IAAe,CAAC;MAC/CC,sBAAA,EAAwBjB,oCAAA,CAAqCW,OAAA,CAAQK,WAAW,EAAE;QAChF,GAAGD,gBAAgB;QACnBG,OAAA,EAAS;MACX,GAAGC,GAAG,CAAC,CAAC;QAAEC;MAAI,CAAE,KAAKA,IAAA;IACvB;IAEA,MAAMC,WAAA,GAAwC;MAC5CL,WAAA,EAAa,CAAC;MACdC,sBAAA,EAAwBH,KAAA,CAAMG;IAChC;IAEA,IAAIH,KAAA,CAAME,WAAW,EAAE;MACrB,KAAK,MAAMM,UAAA,IAAcR,KAAA,CAAME,WAAW,EAAE;QAC1CK,WAAA,CAAYL,WAAW,CAACM,UAAA,CAAW,GAAG;UACpCC,cAAA,EAAgBT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;YACT;YACA,MAAMjB,UAAA,GAAakB,GAAA,CAAIM,OAAO,CAAC9B,WAAW,CAACuB,IAAA,EAAMM,UAAA,CAAW;YAE5D,IAAI,CAACvB,UAAA,EAAY;cACf,OAAOiB,IAAA;YACT;YACA,MAAMuB,EAAA,GACJ,OAAOvB,IAAA,EAAMsB,KAAA,KAAU,YAAYtB,IAAA,CAAKsB,KAAK,KAAK,QAAQ,QAAQtB,IAAA,CAAKsB,KAAK,GACxEtB,IAAA,CAAKsB,KAAK,CAACC,EAAE,GACbvB,IAAA,EAAMsB,KAAA,CAAM;AAAA;YAElB,MAAME,aAAA,GACJjD,KAAA,EAAOkD,QAAA,KAAaC,SAAA,IAAanD,KAAA,EAAOkD,QAAA,GAAWT,KAAA,GAAQzC,KAAA,EAAOkD,QAAA,GAAWT,KAAA;YAE/EI,kBAAA,CAAmBO,IAAI,CACrBpE,QAAA,CAAS;cACPgE,EAAA;cACAK,cAAA,EAAgB7C,UAAA,CAAWZ,MAAM,CAACU,IAAI;cACtCkC,YAAA;cACAc,IAAA,EAAM7B,IAAA;cACNgB,KAAA,EAAOQ,aAAA;cACPP,KAAA;cACAa,GAAA,EAAK;cACLZ,cAAA;cACAjB,GAAA;cACA8B,MAAA,EACEZ,WAAA,GAAcpC,UAAA,CAAWZ,MAAM,CAACU,IAAI,CAAC,IAAIE,UAAA,CAAWZ,MAAM,CAAC6D,eAAe;cAC5EX;YACF;YAGF,OAAOrB,IAAA;UACT;QAEJ;QACAiC,UAAA,EAAYlE,0BAAA,CAA2BQ,KAAA;QACvCyB,IAAA,EAAMlC,gBAAA;QACNoE,WAAA,EAAa,CAAClE,gBAAA,CAAiBO,KAAA;MACjC,GACD;MACD4D,2BAAA,EAA6B5D;IAC/B;EACF;EACAuD,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import type { ElementTransformer } from '../../../packages/@lexical/markdown/MarkdownTransformers.js';
2
- export declare const UploadMarkdownTransformer: ElementTransformer;
1
+ import type { ElementTransformer } from '@lexical/markdown';
2
+ export declare const PAYLOAD_UPLOAD: ElementTransformer;
3
3
  //# sourceMappingURL=markdownTransformer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdownTransformer.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/markdownTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6DAA6D,CAAA;AAWrG,eAAO,MAAM,yBAAyB,EAAE,kBAwDvC,CAAA"}
1
+ {"version":3,"file":"markdownTransformer.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/markdownTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAW3D,eAAO,MAAM,cAAc,EAAE,kBAwD5B,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { $createUploadServerNode, $isUploadServerNode, UploadServerNode } from './nodes/UploadNode.js';
2
2
  /** Matches upload placeholder written by export: ![relationTo:id]() */
3
3
  const UPLOAD_PLACEHOLDER_REGEX = /!\[([^\]:]+):([^\]]+)\]\(\)/;
4
- export const UploadMarkdownTransformer = {
4
+ export const PAYLOAD_UPLOAD = {
5
5
  type: 'element',
6
6
  dependencies: [UploadServerNode],
7
7
  export: node => {
@@ -1 +1 @@
1
- {"version":3,"file":"markdownTransformer.js","names":["$createUploadServerNode","$isUploadServerNode","UploadServerNode","UPLOAD_PLACEHOLDER_REGEX","UploadMarkdownTransformer","type","dependencies","export","node","data","getData","value","url","alt","fields","filename","mimeType","startsWith","id","relationTo","regExp","replace","parentNode","_children","match","isImport","test","Number"],"sources":["../../../../src/features/upload/server/markdownTransformer.ts"],"sourcesContent":["import type { ElementTransformer } from '../../../packages/@lexical/markdown/MarkdownTransformers.js'\n\nimport {\n $createUploadServerNode,\n $isUploadServerNode,\n UploadServerNode,\n} from './nodes/UploadNode.js'\n\n/** Matches upload placeholder written by export: ![relationTo:id]() */\nconst UPLOAD_PLACEHOLDER_REGEX = /!\\[([^\\]:]+):([^\\]]+)\\]\\(\\)/\n\nexport const UploadMarkdownTransformer: ElementTransformer = {\n type: 'element',\n dependencies: [UploadServerNode],\n export: (node) => {\n if (!$isUploadServerNode(node)) {\n return null\n }\n\n const data = node.getData()\n const value = data?.value\n\n // When the value is a populated document object (not just an ID),\n // we can extract the URL and alt text\n if (value && typeof value === 'object' && 'url' in value) {\n const url = (value as Record<string, unknown>).url as string\n const alt =\n (data.fields as Record<string, unknown>)?.alt ||\n (value as Record<string, unknown>).alt ||\n (value as Record<string, unknown>).filename ||\n ''\n\n if ((value as Record<string, unknown>).mimeType) {\n const mimeType = (value as Record<string, unknown>).mimeType as string\n // For non-image uploads, output a link instead of an image\n if (!mimeType.startsWith('image')) {\n const filename = ((value as Record<string, unknown>).filename as string) || url\n return `[${filename}](${url})`\n }\n }\n\n return `![${alt}](${url})`\n }\n\n // When value is just an ID (not populated), output a reference placeholder\n // so the upload is not silently dropped from the markdown output\n const id = typeof value === 'object' ? (value as Record<string, string>)?.id : value\n return `![${data.relationTo}:${id}]()`\n },\n regExp: UPLOAD_PLACEHOLDER_REGEX,\n replace: (parentNode, _children, match, isImport) => {\n if (!isImport || !match[1] || !match[2]) {\n return false\n }\n const relationTo = match[1]\n const value = match[2]\n const id = /^\\d+$/.test(value) ? Number(value) : value\n const node = $createUploadServerNode({\n data: {\n fields: {},\n relationTo,\n value: id,\n },\n })\n parentNode.replace(node)\n return true\n },\n}\n"],"mappings":"AAEA,SACEA,uBAAuB,EACvBC,mBAAmB,EACnBC,gBAAgB,QACX;AAEP;AACA,MAAMC,wBAAA,GAA2B;AAEjC,OAAO,MAAMC,yBAAA,GAAgD;EAC3DC,IAAA,EAAM;EACNC,YAAA,EAAc,CAACJ,gBAAA,CAAiB;EAChCK,MAAA,EAASC,IAAA;IACP,IAAI,CAACP,mBAAA,CAAoBO,IAAA,GAAO;MAC9B,OAAO;IACT;IAEA,MAAMC,IAAA,GAAOD,IAAA,CAAK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AAA,EAAQ,CAAC;QACTK,UAAA;QACAR,KAAA,EAAOO;MACT;IACF;IACAI,UAAA,CAAWD,OAAO,CAACb,IAAA;IACnB,OAAO;EACT;AACF","ignoreList":[]}
1
+ {"version":3,"file":"markdownTransformer.js","names":["$createUploadServerNode","$isUploadServerNode","UploadServerNode","UPLOAD_PLACEHOLDER_REGEX","PAYLOAD_UPLOAD","type","dependencies","export","node","data","getData","value","url","alt","fields","filename","mimeType","startsWith","id","relationTo","regExp","replace","parentNode","_children","match","isImport","test","Number"],"sources":["../../../../src/features/upload/server/markdownTransformer.ts"],"sourcesContent":["import type { ElementTransformer } from '@lexical/markdown'\n\nimport {\n $createUploadServerNode,\n $isUploadServerNode,\n UploadServerNode,\n} from './nodes/UploadNode.js'\n\n/** Matches upload placeholder written by export: ![relationTo:id]() */\nconst UPLOAD_PLACEHOLDER_REGEX = /!\\[([^\\]:]+):([^\\]]+)\\]\\(\\)/\n\nexport const PAYLOAD_UPLOAD: ElementTransformer = {\n type: 'element',\n dependencies: [UploadServerNode],\n export: (node) => {\n if (!$isUploadServerNode(node)) {\n return null\n }\n\n const data = node.getData()\n const value = data?.value\n\n // When the value is a populated document object (not just an ID),\n // we can extract the URL and alt text\n if (value && typeof value === 'object' && 'url' in value) {\n const url = (value as Record<string, unknown>).url as string\n const alt =\n (data.fields as Record<string, unknown>)?.alt ||\n (value as Record<string, unknown>).alt ||\n (value as Record<string, unknown>).filename ||\n ''\n\n if ((value as Record<string, unknown>).mimeType) {\n const mimeType = (value as Record<string, unknown>).mimeType as string\n // For non-image uploads, output a link instead of an image\n if (!mimeType.startsWith('image')) {\n const filename = ((value as Record<string, unknown>).filename as string) || url\n return `[${filename}](${url})`\n }\n }\n\n return `![${alt}](${url})`\n }\n\n // When value is just an ID (not populated), output a reference placeholder\n // so the upload is not silently dropped from the markdown output\n const id = typeof value === 'object' ? (value as Record<string, string>)?.id : value\n return `![${data.relationTo}:${id}]()`\n },\n regExp: UPLOAD_PLACEHOLDER_REGEX,\n replace: (parentNode, _children, match, isImport) => {\n if (!isImport || !match[1] || !match[2]) {\n return false\n }\n const relationTo = match[1]\n const value = match[2]\n const id = /^\\d+$/.test(value) ? Number(value) : value\n const node = $createUploadServerNode({\n data: {\n fields: {},\n relationTo,\n value: id,\n },\n })\n parentNode.replace(node)\n return true\n },\n}\n"],"mappings":"AAEA,SACEA,uBAAuB,EACvBC,mBAAmB,EACnBC,gBAAgB,QACX;AAEP;AACA,MAAMC,wBAAA,GAA2B;AAEjC,OAAO,MAAMC,cAAA,GAAqC;EAChDC,IAAA,EAAM;EACNC,YAAA,EAAc,CAACJ,gBAAA,CAAiB;EAChCK,MAAA,EAASC,IAAA;IACP,IAAI,CAACP,mBAAA,CAAoBO,IAAA,GAAO;MAC9B,OAAO;IACT;IAEA,MAAMC,IAAA,GAAOD,IAAA,CAAKE,OAAO;IACzB,MAAMC,KAAA,GAAQF,IAAA,EAAME,KAAA;IAEpB;IACA;IACA,IAAIA,KAAA,IAAS,OAAOA,KAAA,KAAU,YAAY,SAASA,KAAA,EAAO;MACxD,MAAMC,GAAA,GAAMD,KAAC,CAAkCC,GAAG;MAClD,MAAMC,GAAA,GACJJ,IAAC,CAAKK,MAAM,EAA8BD,GAAA,IAC1CF,KAAC,CAAkCE,GAAG,IACtCF,KAAC,CAAkCI,QAAQ,IAC3C;MAEF,IAAIJ,KAAC,CAAkCK,QAAQ,EAAE;QAC/C,MAAMA,QAAA,GAAWL,KAAC,CAAkCK,QAAQ;QAC5D;QACA,IAAI,CAACA,QAAA,CAASC,UAAU,CAAC,UAAU;UACjC,MAAMF,QAAA,GAAWJ,KAAE,CAAkCI,QAAQ,IAAeH,GAAA;UAC5E,OAAO,IAAIG,QAAA,KAAaH,GAAA,GAAM;QAChC;MACF;MAEA,OAAO,KAAKC,GAAA,KAAQD,GAAA,GAAM;IAC5B;IAEA;IACA;IACA,MAAMM,EAAA,GAAK,OAAOP,KAAA,KAAU,WAAYA,KAAA,EAAkCO,EAAA,GAAKP,KAAA;IAC/E,OAAO,KAAKF,IAAA,CAAKU,UAAU,IAAID,EAAA,KAAO;EACxC;EACAE,MAAA,EAAQjB,wBAAA;EACRkB,OAAA,EAASA,CAACC,UAAA,EAAYC,SAAA,EAAWC,KAAA,EAAOC,QAAA;IACtC,IAAI,CAACA,QAAA,IAAY,CAACD,KAAK,CAAC,EAAE,IAAI,CAACA,KAAK,CAAC,EAAE,EAAE;MACvC,OAAO;IACT;IACA,MAAML,UAAA,GAAaK,KAAK,CAAC,EAAE;IAC3B,MAAMb,KAAA,GAAQa,KAAK,CAAC,EAAE;IACtB,MAAMN,EAAA,GAAK,QAAQQ,IAAI,CAACf,KAAA,IAASgB,MAAA,CAAOhB,KAAA,IAASA,KAAA;IACjD,MAAMH,IAAA,GAAOR,uBAAA,CAAwB;MACnCS,IAAA,EAAM;QACJK,MAAA,EAAQ,CAAC;QACTK,UAAA;QACAR,KAAA,EAAOO;MACT;IACF;IACAI,UAAA,CAAWD,OAAO,CAACb,IAAA;IACnB,OAAO;EACT;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"UploadNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/server/nodes/UploadNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,OAAO,EACR,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAKhF,OAAO,KAAK,EAAuB,oBAAoB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAIzF,qBAAa,gBAAiB,SAAQ,kBAAkB;IACtD,MAAM,EAAE,UAAU,CAAA;gBAEN,EACV,IAAI,EACJ,MAAM,EACN,GAAG,GACJ,EAAE;QACD,IAAI,EAAE,UAAU,CAAA;QAChB,MAAM,CAAC,EAAE,iBA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,gBAAiB,SAAQ,kBAAkB;IACtD,MAAM,EAAE,UAAU,CAAA;IAElB,YAAY,EACV,IAAI,EACJ,MAAM,EACN,GAAG,GACJ,EAAE;QACD,IAAI,EAAE,UAAU,CAAA;QAChB,MAAM,CAAC,EAAE,iBAAiB,CAAA;QAC1B,GAAG,CAAC,EAAE,OAAO,CAAA;KACd,EAGA;IAED,OAAgB,KAAK,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAM9D;IAED,OAAgB,OAAO,IAAI,MAAM,CAEhC;IAED,OAAgB,SAAS,IAAI,gBAAgB,CAAC,gBAAgB,CAAC,CAO9D;IAED,OAAgB,UAAU,CAAC,cAAc,EAAE,oBAAoB,GAAG,gBAAgB,CAqBjF;IAED,MAAM,CAAC,QAAQ,IAAI,KAAK,CAEvB;IAEQ,SAAS,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAIrD;IAEQ,QAAQ,IAAI,GAAG,CAAC,OAAO,CAE/B;IAEQ,SAAS,IAAI,eAAe,CAYpC;IAEQ,UAAU,IAAI,oBAAoB,CAO1C;IAED,OAAO,IAAI,UAAU,CAEpB;IAED,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAG9B;IAEQ,SAAS,IAAI,KAAK,CAE1B;CACF;AAED,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,GACL,EAAE;IACD,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAA;CAC/D,GAAG,gBAAgB,CAKnB;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,gBAAgB,CAE1B"}
@@ -1,7 +1,7 @@
1
- import type { DataFromCollectionSlug, JsonObject, TypedUploadCollection, UploadCollectionSlug } from 'payload';
1
+ import type { DataFromCollectionSlug, IDTypeForCollectionSlug, JsonObject, TypedUploadCollection, UploadCollectionSlug } from 'payload';
2
2
  import type { LexicalElementFormat } from '../../../types/nodeTypes.js';
3
3
  import type { JSONSchemaFn } from '../../typesServer.js';
4
- import type { UploadFeatureProps } from './index.js';
4
+ import type { UploadFeatureServerProps } from './index.js';
5
5
  export type UploadData<TFields extends JsonObject = JsonObject> = {
6
6
  [TCollectionSlug in UploadCollectionSlug]: {
7
7
  fields: TFields;
@@ -9,7 +9,7 @@ export type UploadData<TFields extends JsonObject = JsonObject> = {
9
9
  id: string;
10
10
  relationTo: TCollectionSlug;
11
11
  /** Either the document ID or the full populated document. */
12
- value: DataFromCollectionSlug<TCollectionSlug> | number | string;
12
+ value: DataFromCollectionSlug<TCollectionSlug> | IDTypeForCollectionSlug<TCollectionSlug>;
13
13
  };
14
14
  }[UploadCollectionSlug];
15
15
  /** @internal Adds a pending state to `UploadData`. */
@@ -31,7 +31,7 @@ export type UploadDataImproved<TFields extends JsonObject = JsonObject> = {
31
31
  fields: TFields;
32
32
  id: string;
33
33
  relationTo: TCollectionSlug;
34
- value: number | string | TypedUploadCollection[TCollectionSlug];
34
+ value: IDTypeForCollectionSlug<TCollectionSlug> | TypedUploadCollection[TCollectionSlug];
35
35
  };
36
36
  }[UploadCollectionSlug];
37
37
  export type SerializedUploadNode<TSlugs extends UploadCollectionSlug = UploadCollectionSlug, TFields = {
@@ -39,7 +39,7 @@ export type SerializedUploadNode<TSlugs extends UploadCollectionSlug = UploadCol
39
39
  }> = {
40
40
  [TSlug in TSlugs]: {
41
41
  relationTo: TSlug;
42
- value: DataFromCollectionSlug<TSlug> | number | string;
42
+ value: DataFromCollectionSlug<TSlug> | IDTypeForCollectionSlug<TSlug>;
43
43
  };
44
44
  }[TSlugs] & {
45
45
  fields: TFields;
@@ -48,5 +48,5 @@ export type SerializedUploadNode<TSlugs extends UploadCollectionSlug = UploadCol
48
48
  type: 'upload';
49
49
  version: number;
50
50
  };
51
- export declare const createUploadNodeJSONSchema: (props: undefined | UploadFeatureProps) => JSONSchemaFn;
51
+ export declare const createUploadNodeJSONSchema: (props: UploadFeatureServerProps) => JSONSchemaFn;
52
52
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,EACtB,UAAU,EACV,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAKhB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAKpD,MAAM,MAAM,UAAU,CAAC,OAAO,SAAS,UAAU,GAAG,UAAU,IAAI;KAC/D,eAAe,IAAI,oBAAoB,GAAG;QACzC,MAAM,EAAE,OAAO,CAAA;QACf,6DAA6D;QAC7D,EAAE,EAAE,MAAM,CAAA;QACV,UAAU,EAAE,eAAe,CAAA;QAC3B,6DAA6D;QAC7D,KAAK,EAAE,sBAAsB,CAAC,eAAe,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;KACjE;CACF,CAAC,oBAAoB,CAAC,CAAA;AAEvB,sDAAsD;AACtD,MAAM,MAAM,mBAAmB,CAAC,OAAO,SAAS,UAAU,GAAG,UAAU,IAAI;IACzE,OAAO,CAAC,EAAE;QACR,2BAA2B;QAC3B,MAAM,EAAE,MAAM,CAAA;QACd,sCAAsC;QACtC,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;CACF,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;AAEvB;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,CAAC,OAAO,SAAS,UAAU,GAAG,UAAU,IAAI;KACvE,eAAe,IAAI,oBAAoB,GAAG;QACzC,MAAM,EAAE,OAAO,CAAA;QACf,EAAE,EAAE,MAAM,CAAA;QACV,UAAU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AiCD,eAAO,MAAM,0BAA0B,UAC7B,wBAAwB,KAAG,YAmGlC,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import { createHash } from 'crypto';
2
2
  import { fieldsToJSONSchema, flattenAllFields } from 'payload';
3
3
  import { formatSchema, versionSchema } from '../../../types/jsonSchemaHelpers.js';
4
- import { filterEnabledRelationshipCollections } from '../../relationship/shared/filterEnabledRelationshipCollections.js';
5
4
  /** MUST stay byte-for-byte in sync with the runtime `SerializedUploadNode` declared above. */
6
5
  const SERIALIZED_UPLOAD_NODE_TS = `export type SerializedUploadNode<TSlugs extends keyof Config['collections'], TFields = { [k: string]: unknown }> = {
7
6
  type: 'upload';
@@ -12,7 +11,20 @@ const SERIALIZED_UPLOAD_NODE_TS = `export type SerializedUploadNode<TSlugs exten
12
11
  } & {
13
12
  [TSlug in TSlugs]: {
14
13
  relationTo: TSlug;
15
- value: number | string | Config['collections'][TSlug];
14
+ value: Config['collections'][TSlug]['id'] | Config['collections'][TSlug];
15
+ };
16
+ }[TSlugs];`;
17
+ /** Input variant of `SerializedUploadNode`: `value` is ID-only (you only ever write an ID). */
18
+ const SERIALIZED_UPLOAD_NODE_INPUT_TS = `export type SerializedUploadNodeInput<TSlugs extends keyof Config['collections'], TFields = { [k: string]: unknown }> = {
19
+ type: 'upload';
20
+ format: LexicalElementFormat;
21
+ id: string;
22
+ version: number;
23
+ fields: TFields;
24
+ } & {
25
+ [TSlug in TSlugs]: {
26
+ relationTo: TSlug;
27
+ value: Config['collections'][TSlug]['id'];
16
28
  };
17
29
  }[TSlugs];`;
18
30
  const hashUploadFields = schema => createHash('sha256').update(JSON.stringify(schema)).digest('hex').slice(0, 8).toUpperCase();
@@ -21,14 +33,14 @@ export const createUploadNodeJSONSchema = props => ({
21
33
  config,
22
34
  i18n,
23
35
  interfaceNameDefinitions,
24
- typeStringDefinitions
36
+ typeStringDefinitions,
37
+ variant
25
38
  }) => {
26
- typeStringDefinitions.add(SERIALIZED_UPLOAD_NODE_TS);
27
- const enabledCollections = config?.collections ? filterEnabledRelationshipCollections(config.collections, {
28
- disabledCollections: props?.disabledCollections,
29
- enabledCollections: props?.enabledCollections,
30
- uploads: true
31
- }) : [];
39
+ const isInput = variant === 'input';
40
+ typeStringDefinitions.add(isInput ? SERIALIZED_UPLOAD_NODE_INPUT_TS : SERIALIZED_UPLOAD_NODE_TS);
41
+ const {
42
+ enabledCollectionSlugs
43
+ } = props;
32
44
  // Configured extra fields are registered as their own interface and referenced here, so the
33
45
  // generated TypeScript keeps them - the node-level `tsType` would otherwise erase `fields` to
34
46
  // `{ [k: string]: unknown }`. Mirrors how LinkFeature handles custom link fields.
@@ -37,8 +49,7 @@ export const createUploadNodeJSONSchema = props => ({
37
49
  // generated union correctly pairs each `relationTo` with its own fields type. A single
38
50
  // `SerializedUploadNode<'a' | 'b', AFields | BFields>` would lose that pairing.
39
51
  const perCollectionTsTypes = [];
40
- const collectionVariants = enabledCollections.map(collection => {
41
- const slug = collection.slug;
52
+ const collectionVariants = enabledCollectionSlugs.map(slug => {
42
53
  const idType = collectionIDFieldTypes[slug] ?? 'string';
43
54
  const extraFields = props?.collections?.[slug]?.fields ?? [];
44
55
  const flattenedExtra = flattenAllFields({
@@ -50,7 +61,8 @@ export const createUploadNodeJSONSchema = props => ({
50
61
  fields: flattenedExtra,
51
62
  i18n,
52
63
  interfaceNameDefinitions,
53
- typeStringDefinitions
64
+ typeStringDefinitions,
65
+ variant
54
66
  }) : {
55
67
  properties: {},
56
68
  required: []
@@ -69,7 +81,8 @@ export const createUploadNodeJSONSchema = props => ({
69
81
  $ref: `#/$defs/${fieldsTypeName}`
70
82
  };
71
83
  }
72
- perCollectionTsTypes.push(fieldsTypeName ? `SerializedUploadNode<'${slug}', ${fieldsTypeName}>` : `SerializedUploadNode<'${slug}'>`);
84
+ const uploadTsName = isInput ? 'SerializedUploadNodeInput' : 'SerializedUploadNode';
85
+ perCollectionTsTypes.push(fieldsTypeName ? `${uploadTsName}<'${slug}', ${fieldsTypeName}>` : `${uploadTsName}<'${slug}'>`);
73
86
  return {
74
87
  type: 'object',
75
88
  additionalProperties: false,
@@ -87,7 +100,10 @@ export const createUploadNodeJSONSchema = props => ({
87
100
  type: 'string',
88
101
  const: slug
89
102
  },
90
- value: {
103
+ value: isInput ? {
104
+ type: idType,
105
+ description: 'The uploaded file ID.'
106
+ } : {
91
107
  description: 'The uploaded file by ID (string or number). Populated to the full upload document when read at depth > 0.',
92
108
  oneOf: [{
93
109
  type: idType
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","names":["createHash","fieldsToJSONSchema","flattenAllFields","formatSchema","versionSchema","filterEnabledRelationshipCollections","SERIALIZED_UPLOAD_NODE_TS","hashUploadFields","schema","update","JSON","stringify","digest","slice","toUpperCase","createUploadNodeJSONSchema","props","collectionIDFieldTypes","config","i18n","interfaceNameDefinitions","typeStringDefinitions","add","enabledCollections","collections","disabledCollections","uploads","perCollectionTsTypes","collectionVariants","map","collection","slug","idType","extraFields","fields","flattenedExtra","extraFieldsSchema","length","properties","required","fieldsSchema","type","additionalProperties","fieldsTypeName","set","$ref","push","id","const","format","relationTo","value","description","oneOf","version","baseSchema","tsType","join"],"sources":["../../../../src/features/upload/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type {\n DataFromCollectionSlug,\n JsonObject,\n TypedUploadCollection,\n UploadCollectionSlug,\n} from 'payload'\n\nimport { createHash } from 'crypto'\nimport { fieldsToJSONSchema, flattenAllFields } from 'payload'\n\nimport type { LexicalElementFormat } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaFn } from '../../typesServer.js'\nimport type { UploadFeatureProps } from './index.js'\n\nimport { formatSchema, versionSchema } from '../../../types/jsonSchemaHelpers.js'\nimport { filterEnabledRelationshipCollections } from '../../relationship/shared/filterEnabledRelationshipCollections.js'\n\nexport type UploadData<TFields extends JsonObject = JsonObject> = {\n [TCollectionSlug in UploadCollectionSlug]: {\n fields: TFields\n /** ID of this upload node — NOT the linked document's ID. */\n id: string\n relationTo: TCollectionSlug\n /** Either the document ID or the full populated document. */\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[UploadCollectionSlug]\n\n/** @internal Adds a pending state to `UploadData`. */\nexport type Internal_UploadData<TFields extends JsonObject = JsonObject> = {\n pending?: {\n /** Bulk upload form ID. */\n formID: string\n /** `src` of the image DOM element. */\n src: string\n }\n} & UploadData<TFields>\n\n/**\n * More precise variant of {@link UploadData}. Replaces `UploadData` in v4.\n * @internal\n * @todo Replace UploadData with UploadDataImproved in 4.0\n */\nexport type UploadDataImproved<TFields extends JsonObject = JsonObject> = {\n [TCollectionSlug in UploadCollectionSlug]: {\n fields: TFields\n id: string\n relationTo: TCollectionSlug\n value: number | string | TypedUploadCollection[TCollectionSlug]\n }\n}[UploadCollectionSlug]\n\nexport type SerializedUploadNode<\n TSlugs extends UploadCollectionSlug = UploadCollectionSlug,\n TFields = { [k: string]: unknown },\n> = {\n [TSlug in TSlugs]: {\n relationTo: TSlug\n value: DataFromCollectionSlug<TSlug> | number | string\n }\n}[TSlugs] & {\n fields: TFields\n format: LexicalElementFormat\n id: string\n type: 'upload'\n version: number\n}\n\n/** MUST stay byte-for-byte in sync with the runtime `SerializedUploadNode` declared above. */\nconst SERIALIZED_UPLOAD_NODE_TS = `export type SerializedUploadNode<TSlugs extends keyof Config['collections'], TFields = { [k: string]: unknown }> = {\n type: 'upload';\n format: LexicalElementFormat;\n id: string;\n version: number;\n fields: TFields;\n} & {\n [TSlug in TSlugs]: {\n relationTo: TSlug;\n value: number | string | Config['collections'][TSlug];\n };\n}[TSlugs];`\n\nconst hashUploadFields = (schema: JSONSchema4): string =>\n createHash('sha256').update(JSON.stringify(schema)).digest('hex').slice(0, 8).toUpperCase()\n\nexport const createUploadNodeJSONSchema =\n (props: undefined | UploadFeatureProps): JSONSchemaFn =>\n ({ collectionIDFieldTypes, config, i18n, interfaceNameDefinitions, typeStringDefinitions }) => {\n typeStringDefinitions.add(SERIALIZED_UPLOAD_NODE_TS)\n const enabledCollections = config?.collections\n ? filterEnabledRelationshipCollections(config.collections, {\n disabledCollections: props?.disabledCollections,\n enabledCollections: props?.enabledCollections,\n uploads: true,\n })\n : []\n\n // Configured extra fields are registered as their own interface and referenced here, so the\n // generated TypeScript keeps them - the node-level `tsType` would otherwise erase `fields` to\n // `{ [k: string]: unknown }`. Mirrors how LinkFeature handles custom link fields.\n //\n // Each collection gets its own `SerializedUploadNode<'slug', Fields>` instantiation so the\n // generated union correctly pairs each `relationTo` with its own fields type. A single\n // `SerializedUploadNode<'a' | 'b', AFields | BFields>` would lose that pairing.\n const perCollectionTsTypes: string[] = []\n const collectionVariants: JSONSchema4[] = enabledCollections.map((collection) => {\n const slug = collection.slug\n const idType: 'number' | 'string' = collectionIDFieldTypes[slug] ?? 'string'\n const extraFields = props?.collections?.[slug]?.fields ?? []\n const flattenedExtra = flattenAllFields({ fields: extraFields })\n const extraFieldsSchema =\n flattenedExtra.length > 0 && config\n ? fieldsToJSONSchema({\n collectionIDFieldTypes,\n config,\n fields: flattenedExtra,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n })\n : { properties: {}, required: [] }\n\n let fieldsSchema: JSONSchema4 = {\n type: 'object',\n additionalProperties: false,\n properties: extraFieldsSchema.properties,\n required: extraFieldsSchema.required,\n }\n let fieldsTypeName: string | undefined\n if (flattenedExtra.length > 0) {\n fieldsTypeName = `LexicalUploadFields_${hashUploadFields(fieldsSchema)}`\n interfaceNameDefinitions.set(fieldsTypeName, fieldsSchema)\n fieldsSchema = { $ref: `#/$defs/${fieldsTypeName}` }\n }\n\n perCollectionTsTypes.push(\n fieldsTypeName\n ? `SerializedUploadNode<'${slug}', ${fieldsTypeName}>`\n : `SerializedUploadNode<'${slug}'>`,\n )\n\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n id: { type: 'string' },\n type: { type: 'string', const: 'upload' },\n fields: fieldsSchema,\n format: formatSchema,\n relationTo: { type: 'string', const: slug },\n value: {\n description:\n 'The uploaded file by ID (string or number). Populated to the full upload document when read at depth > 0.',\n oneOf: [{ type: idType }, { $ref: `#/$defs/${slug}` }],\n },\n version: versionSchema,\n },\n required: ['fields', 'format', 'id', 'relationTo', 'type', 'value', 'version'],\n }\n })\n\n let schema: JSONSchema4\n if (collectionVariants.length === 0) {\n // Fallback when no enabled upload collections.\n schema = {\n type: 'object',\n additionalProperties: true,\n properties: {\n type: { type: 'string', const: 'upload' },\n version: versionSchema,\n },\n required: ['type', 'version'],\n }\n } else {\n const baseSchema: JSONSchema4 =\n collectionVariants.length === 1 ? collectionVariants[0]! : { oneOf: collectionVariants }\n schema = { ...baseSchema, tsType: perCollectionTsTypes.join(' | ') }\n }\n\n return schema\n }\n"],"mappings":"AAQA,SAASA,UAAU,QAAQ;AAC3B,SAASC,kBAAkB,EAAEC,gBAAgB,QAAQ;AAMrD,SAASC,YAAY,EAAEC,aAAa,QAAQ;AAC5C,SAASC,oCAAoC,QAAQ;AAqDrD;AACA,MAAMC,yBAAA,GAA4B;;;;;;;;;;;WAWvB;AAEX,MAAMC,gBAAA,GAAoBC,MAAA,IACxBR,UAAA,CAAW,UAAUS,MAAM,CAACC,IAAA,CAAKC,SAAS,CAACH,MAAA,GAASI,MAAM,CAAC,OAAOC,KAAK,CAAC,GAAG,GAAGC,WAAW;AAE3F,OAAO,MAAMC,0BAAA,GACVC,KAAA,IACD,CAAC;EAAEC,sBAAsB;EAAEC,MAAM;EAAEC,IAAI;EAAEC,wBAAwB;EAAEC;AAAqB,CAAE;EACxFA,qBAAA,CAAsBC,GAAG,CAAChB,yBAAA;EAC1B,MAAMiB,kBAAA,GAAqBL,MAAA,EAAQM,WAAA,GAC/BnB,oCAAA,CAAqCa,MAAA,CAAOM,WAAW,EAAE;IACvDC,mBAAA,EAAqBT,KAAA,EAAOS,mBAAA;IAC5BF,kBAAA,EAAoBP,KAAA,EAAOO,kBAAA;IAC3BG,OAAA,EAAS;EACX,KACA,EAAE;EAEN;EACA;EACA;EACA;EACA;EACA;EACA;EAC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AAS;QACrBA,IAAA,EAAM;UAAEA,IAAA,EAAM;UAAUO,KAAA,EAAO;QAAS;QACxCd,MAAA,EAAQM,YAAA;QACRS,MAAA,EAAQ9C,YAAA;QACR+C,UAAA,EAAY;UAAET,IAAA,EAAM;UAAUO,KAAA,EAAOjB;QAAK;QAC1CoB,KAAA,EAAO;UACLC,WAAA,EACE;UACFC,KAAA,EAAO,CAAC;YAAEZ,IAAA,EAAMT;UAAO,GAAG;YAAEa,IAAA,EAAM,WAAWd,IAAA;UAAO;QACtD;QACAuB,OAAA,EAASlD;MACX;MACAmC,QAAA,EAAU,CAAC,UAAU,UAAU,MAAM,cAAc,QAAQ,SAAS;IACtE;EACF;EAEA,IAAI/B,MAAA;EACJ,IAAIoB,kBAAA,CAAmBS,MAAM,KAAK,GAAG;IACnC;IACA7B,MAAA,GAAS;MACPiC,IAAA,EAAM;MACNC,oBAAA,EAAsB;MACtBJ,UAAA,EAAY;QACVG,IAAA,EAAM;UAAEA,IAAA,EAAM;UAAUO,KAAA,EAAO;QAAS;QACxCM,OAAA,EAASlD;MACX;MACAmC,QAAA,EAAU,CAAC,QAAQ;IACrB;EACF,OAAO;IACL,MAAMgB,UAAA,GACJ3B,kBAAA,CAAmBS,MAAM,KAAK,IAAIT,kBAAkB,CAAC,EAAE,GAAI;MAAEyB,KAAA,EAAOzB;IAAmB;IACzFpB,MAAA,GAAS;MAAE,GAAG+C,UAAU;MAAEC,MAAA,EAAQ7B,oBAAA,CAAqB8B,IAAI,CAAC;IAAO;EACrE;EAEA,OAAOjD,MAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"schema.js","names":["createHash","fieldsToJSONSchema","flattenAllFields","formatSchema","versionSchema","SERIALIZED_UPLOAD_NODE_TS","SERIALIZED_UPLOAD_NODE_INPUT_TS","hashUploadFields","schema","update","JSON","stringify","digest","slice","toUpperCase","createUploadNodeJSONSchema","props","collectionIDFieldTypes","config","i18n","interfaceNameDefinitions","typeStringDefinitions","variant","isInput","add","enabledCollectionSlugs","perCollectionTsTypes","collectionVariants","map","slug","idType","extraFields","collections","fields","flattenedExtra","extraFieldsSchema","length","properties","required","fieldsSchema","type","additionalProperties","fieldsTypeName","set","$ref","uploadTsName","push","id","const","format","relationTo","value","description","oneOf","version","baseSchema","tsType","join"],"sources":["../../../../src/features/upload/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type {\n DataFromCollectionSlug,\n IDTypeForCollectionSlug,\n JsonObject,\n TypedUploadCollection,\n UploadCollectionSlug,\n} from 'payload'\n\nimport { createHash } from 'crypto'\nimport { fieldsToJSONSchema, flattenAllFields } from 'payload'\n\nimport type { LexicalElementFormat } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaFn } from '../../typesServer.js'\nimport type { UploadFeatureServerProps } from './index.js'\n\nimport { formatSchema, versionSchema } from '../../../types/jsonSchemaHelpers.js'\n\nexport type UploadData<TFields extends JsonObject = JsonObject> = {\n [TCollectionSlug in UploadCollectionSlug]: {\n fields: TFields\n /** ID of this upload node — NOT the linked document's ID. */\n id: string\n relationTo: TCollectionSlug\n /** Either the document ID or the full populated document. */\n value: DataFromCollectionSlug<TCollectionSlug> | IDTypeForCollectionSlug<TCollectionSlug>\n }\n}[UploadCollectionSlug]\n\n/** @internal Adds a pending state to `UploadData`. */\nexport type Internal_UploadData<TFields extends JsonObject = JsonObject> = {\n pending?: {\n /** Bulk upload form ID. */\n formID: string\n /** `src` of the image DOM element. */\n src: string\n }\n} & UploadData<TFields>\n\n/**\n * More precise variant of {@link UploadData}. Replaces `UploadData` in v4.\n * @internal\n * @todo Replace UploadData with UploadDataImproved in 4.0\n */\nexport type UploadDataImproved<TFields extends JsonObject = JsonObject> = {\n [TCollectionSlug in UploadCollectionSlug]: {\n fields: TFields\n id: string\n relationTo: TCollectionSlug\n value: IDTypeForCollectionSlug<TCollectionSlug> | TypedUploadCollection[TCollectionSlug]\n }\n}[UploadCollectionSlug]\n\nexport type SerializedUploadNode<\n TSlugs extends UploadCollectionSlug = UploadCollectionSlug,\n TFields = { [k: string]: unknown },\n> = {\n [TSlug in TSlugs]: {\n relationTo: TSlug\n value: DataFromCollectionSlug<TSlug> | IDTypeForCollectionSlug<TSlug>\n }\n}[TSlugs] & {\n fields: TFields\n format: LexicalElementFormat\n id: string\n type: 'upload'\n version: number\n}\n\n/** MUST stay byte-for-byte in sync with the runtime `SerializedUploadNode` declared above. */\nconst SERIALIZED_UPLOAD_NODE_TS = `export type SerializedUploadNode<TSlugs extends keyof Config['collections'], TFields = { [k: string]: unknown }> = {\n type: 'upload';\n format: LexicalElementFormat;\n id: string;\n version: number;\n fields: TFields;\n} & {\n [TSlug in TSlugs]: {\n relationTo: TSlug;\n value: Config['collections'][TSlug]['id'] | Config['collections'][TSlug];\n };\n}[TSlugs];`\n\n/** Input variant of `SerializedUploadNode`: `value` is ID-only (you only ever write an ID). */\nconst SERIALIZED_UPLOAD_NODE_INPUT_TS = `export type SerializedUploadNodeInput<TSlugs extends keyof Config['collections'], TFields = { [k: string]: unknown }> = {\n type: 'upload';\n format: LexicalElementFormat;\n id: string;\n version: number;\n fields: TFields;\n} & {\n [TSlug in TSlugs]: {\n relationTo: TSlug;\n value: Config['collections'][TSlug]['id'];\n };\n}[TSlugs];`\n\nconst hashUploadFields = (schema: JSONSchema4): string =>\n createHash('sha256').update(JSON.stringify(schema)).digest('hex').slice(0, 8).toUpperCase()\n\nexport const createUploadNodeJSONSchema =\n (props: UploadFeatureServerProps): JSONSchemaFn =>\n ({\n collectionIDFieldTypes,\n config,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n variant,\n }) => {\n const isInput = variant === 'input'\n typeStringDefinitions.add(isInput ? SERIALIZED_UPLOAD_NODE_INPUT_TS : SERIALIZED_UPLOAD_NODE_TS)\n const { enabledCollectionSlugs } = props\n\n // Configured extra fields are registered as their own interface and referenced here, so the\n // generated TypeScript keeps them - the node-level `tsType` would otherwise erase `fields` to\n // `{ [k: string]: unknown }`. Mirrors how LinkFeature handles custom link fields.\n //\n // Each collection gets its own `SerializedUploadNode<'slug', Fields>` instantiation so the\n // generated union correctly pairs each `relationTo` with its own fields type. A single\n // `SerializedUploadNode<'a' | 'b', AFields | BFields>` would lose that pairing.\n const perCollectionTsTypes: string[] = []\n const collectionVariants: JSONSchema4[] = enabledCollectionSlugs.map((slug) => {\n const idType: 'number' | 'string' = collectionIDFieldTypes[slug] ?? 'string'\n const extraFields = props?.collections?.[slug]?.fields ?? []\n const flattenedExtra = flattenAllFields({ fields: extraFields })\n const extraFieldsSchema =\n flattenedExtra.length > 0 && config\n ? fieldsToJSONSchema({\n collectionIDFieldTypes,\n config,\n fields: flattenedExtra,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n variant,\n })\n : { properties: {}, required: [] }\n\n let fieldsSchema: JSONSchema4 = {\n type: 'object',\n additionalProperties: false,\n properties: extraFieldsSchema.properties,\n required: extraFieldsSchema.required,\n }\n let fieldsTypeName: string | undefined\n if (flattenedExtra.length > 0) {\n fieldsTypeName = `LexicalUploadFields_${hashUploadFields(fieldsSchema)}`\n interfaceNameDefinitions.set(fieldsTypeName, fieldsSchema)\n fieldsSchema = { $ref: `#/$defs/${fieldsTypeName}` }\n }\n\n const uploadTsName = isInput ? 'SerializedUploadNodeInput' : 'SerializedUploadNode'\n perCollectionTsTypes.push(\n fieldsTypeName\n ? `${uploadTsName}<'${slug}', ${fieldsTypeName}>`\n : `${uploadTsName}<'${slug}'>`,\n )\n\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n id: { type: 'string' },\n type: { type: 'string', const: 'upload' },\n fields: fieldsSchema,\n format: formatSchema,\n relationTo: { type: 'string', const: slug },\n value: isInput\n ? { type: idType, description: 'The uploaded file ID.' }\n : {\n description:\n 'The uploaded file by ID (string or number). Populated to the full upload document when read at depth > 0.',\n oneOf: [{ type: idType }, { $ref: `#/$defs/${slug}` }],\n },\n version: versionSchema,\n },\n required: ['fields', 'format', 'id', 'relationTo', 'type', 'value', 'version'],\n }\n })\n\n let schema: JSONSchema4\n if (collectionVariants.length === 0) {\n // Fallback when no enabled upload collections.\n schema = {\n type: 'object',\n additionalProperties: true,\n properties: {\n type: { type: 'string', const: 'upload' },\n version: versionSchema,\n },\n required: ['type', 'version'],\n }\n } else {\n const baseSchema: JSONSchema4 =\n collectionVariants.length === 1 ? collectionVariants[0]! : { oneOf: collectionVariants }\n schema = { ...baseSchema, tsType: perCollectionTsTypes.join(' | ') }\n }\n\n return schema\n }\n"],"mappings":"AASA,SAASA,UAAU,QAAQ;AAC3B,SAASC,kBAAkB,EAAEC,gBAAgB,QAAQ;AAMrD,SAASC,YAAY,EAAEC,aAAa,QAAQ;AAqD5C;AACA,MAAMC,yBAAA,GAA4B;;;;;;;;;;;WAWvB;AAEX;AACA,MAAMC,+BAAA,GAAkC;;;;;;;;;;;WAW7B;AAEX,MAAMC,gBAAA,GAAoBC,MAAA,IACxBR,UAAA,CAAW,UAAUS,MAAM,CAACC,IAAA,CAAKC,SAAS,CAACH,MAAA,GAASI,MAAM,CAAC,OAAOC,KAAK,CAAC,GAAG,GAAGC,WAAW;AAE3F,OAAO,MAAMC,0BAAA,GACVC,KAAA,IACD,CAAC;EACCC,sBAAsB;EACtBC,MAAM;EACNC,IAAI;EACJC,wBAAwB;EACxBC,qBAAqB;EACrBC;AAAO,CACR;EACC,MAAMC,OAAA,GAAUD,OAAA,KAAY;EAC5BD,qBAAA,CAAsBG,GAAG,CAACD,OAAA,GAAUjB,+BAAA,GAAkCD,yBAAA;EACtE,MAAM;IAAEoB;EAAsB,CAAE,GAAGT,KAAA;EAEnC;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMU,oBAAA,GAAiC,EAAE;EACzC,MAAMC,kBAAA,GAAoCF,sBAAA,CAAuBG,GAAG,CAAEC,IAAA;IACpE,MAAMC,MAAA,GAA8Bb,sBAAsB,CAACY,IAAA,CAAK,IAAI;IACpE,MAAME,WAAA,GAAcf,KAAA,EAAOgB,WAAA,GAAcH,IAAA,CAAK,E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AAK;QAC1CsB,KAAA,EAAO5B,OAAA,GACH;UAAEiB,IAAA,EAAMV,MAAA;UAAQsB,WAAA,EAAa;QAAwB,IACrD;UACEA,WAAA,EACE;UACFC,KAAA,EAAO,CAAC;YAAEb,IAAA,EAAMV;UAAO,GAAG;YAAEc,IAAA,EAAM,WAAWf,IAAA;UAAO;QACtD;QACJyB,OAAA,EAASlD;MACX;MACAkC,QAAA,EAAU,CAAC,UAAU,UAAU,MAAM,cAAc,QAAQ,SAAS;IACtE;EACF;EAEA,IAAI9B,MAAA;EACJ,IAAImB,kBAAA,CAAmBS,MAAM,KAAK,GAAG;IACnC;IACA5B,MAAA,GAAS;MACPgC,IAAA,EAAM;MACNC,oBAAA,EAAsB;MACtBJ,UAAA,EAAY;QACVG,IAAA,EAAM;UAAEA,IAAA,EAAM;UAAUQ,KAAA,EAAO;QAAS;QACxCM,OAAA,EAASlD;MACX;MACAkC,QAAA,EAAU,CAAC,QAAQ;IACrB;EACF,OAAO;IACL,MAAMiB,UAAA,GACJ5B,kBAAA,CAAmBS,MAAM,KAAK,IAAIT,kBAAkB,CAAC,EAAE,GAAI;MAAE0B,KAAA,EAAO1B;IAAmB;IACzFnB,MAAA,GAAS;MAAE,GAAG+C,UAAU;MAAEC,MAAA,EAAQ9B,oBAAA,CAAqB+B,IAAI,CAAC;IAAO;EACrE;EAEA,OAAOjD,MAAA;AACT","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { NodeValidation } from '../../typesServer.js';
2
- import type { UploadFeatureProps } from './index.js';
2
+ import type { UploadFeatureServerProps } from './index.js';
3
3
  import type { SerializedUploadNode } from './schema.js';
4
- export declare const uploadValidation: (props: UploadFeatureProps) => NodeValidation<SerializedUploadNode>;
4
+ export declare const uploadValidation: (props: UploadFeatureServerProps) => NodeValidation<SerializedUploadNode>;
5
5
  //# sourceMappingURL=validate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEvD,eAAO,MAAM,gBAAgB,GAC3B,OAAO,kBAAkB,KACxB,cAAc,CAAC,oBAAoB,CAqErC,CAAA"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/features/upload/server/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEvD,eAAO,MAAM,gBAAgB,UACpB,wBAAwB,KAC9B,cAAc,CAAC,oBAAoB,CAyErC,CAAA"}
@@ -17,6 +17,9 @@ export const uploadValidation = props => {
17
17
  }
18
18
  }
19
19
  }) => {
20
+ if (!props.enabledCollectionSlugs.includes(node.relationTo)) {
21
+ return t('validation:invalidSelection');
22
+ }
20
23
  const idType = payload.collections[node.relationTo]?.customIDType || payload.db.defaultIDType;
21
24
  // @ts-expect-error - Fix in Payload v4
22
25
  const nodeID = node?.value?.id || node?.value // for backwards-compatibility
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","names":["fieldSchemasToFormState","isValidID","uploadValidation","props","node","validation","options","id","data","operation","preferences","req","payload","t","idType","collections","relationTo","customIDType","db","defaultIDType","nodeID","value","Object","keys","length","collection","fields","result","collectionSlug","documentData","fieldSchemaMap","undefined","initialBlockData","permissions","renderAllFields","schemaPath","errorPathsSet","Set","fieldKey","fieldState","errorPaths","errorPath","add","Array","from","join"],"sources":["../../../../src/features/upload/server/validate.ts"],"sourcesContent":["import { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\nimport { isValidID } from 'payload'\n\nimport type { NodeValidation } from '../../typesServer.js'\nimport type { UploadFeatureProps } from './index.js'\nimport type { SerializedUploadNode } from './schema.js'\n\nexport const uploadValidation = (\n props: UploadFeatureProps,\n): NodeValidation<SerializedUploadNode> => {\n return async ({\n node,\n validation: {\n options: {\n id,\n data,\n operation,\n preferences,\n req,\n req: { payload, t },\n },\n },\n }) => {\n const idType = payload.collections[node.relationTo]?.customIDType || payload.db.defaultIDType\n // @ts-expect-error - Fix in Payload v4\n const nodeID = node?.value?.id || node?.value // for backwards-compatibility\n\n if (!isValidID(nodeID, idType)) {\n return t('validation:validUploadID')\n }\n\n if (!props?.collections) {\n return true\n }\n\n if (Object.keys(props?.collections).length === 0) {\n return true\n }\n\n const collection = props?.collections[node.relationTo]\n\n if (!collection?.fields?.length) {\n return true\n }\n\n const result = await fieldSchemasToFormState({\n id,\n collectionSlug: node.relationTo,\n data: node?.fields ?? {},\n documentData: data,\n fields: collection.fields,\n fieldSchemaMap: undefined,\n initialBlockData: node?.fields ?? {},\n operation: operation === 'create' || operation === 'update' ? operation : 'update',\n permissions: {},\n preferences,\n renderAllFields: false,\n req,\n schemaPath: '',\n })\n\n const errorPathsSet = new Set<string>()\n for (const fieldKey in result) {\n const fieldState = result[fieldKey]\n if (fieldState?.errorPaths?.length) {\n for (const errorPath of fieldState.errorPaths) {\n errorPathsSet.add(errorPath)\n }\n }\n }\n const errorPaths = Array.from(errorPathsSet)\n\n if (errorPaths.length) {\n return 'The following fields are invalid: ' + errorPaths.join(', ')\n }\n\n return true\n }\n}\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ;AACxC,SAASC,SAAS,QAAQ;AAM1B,OAAO,MAAMC,gBAAA,GACXC,KAAA;EAEA,OAAO,OAAO;IACZC,IAAI;IACJC,UAAA,EAAY;MACVC,OAAA,EAAS;QACPC,EAAE;QACFC,IAAI;QACJC,SAAS;QACTC,WAAW;QACXC,GAAG;QACHA,GAAA,EAAK;UAAEC,OAA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X,MAAA,EAAQ;MAC7B,MAAMY,UAAA,GAAaZ,MAAM,CAACW,QAAA,CAAS;MACnC,IAAIC,UAAA,EAAYC,UAAA,EAAYhB,MAAA,EAAQ;QAClC,KAAK,MAAMiB,SAAA,IAAaF,UAAA,CAAWC,UAAU,EAAE;UAC7CJ,aAAA,CAAcM,GAAG,CAACD,SAAA;QACpB;MACF;IACF;IACA,MAAMD,UAAA,GAAaG,KAAA,CAAMC,IAAI,CAACR,aAAA;IAE9B,IAAII,UAAA,CAAWhB,MAAM,EAAE;MACrB,OAAO,uCAAuCgB,UAAA,CAAWK,IAAI,CAAC;IAChE;IAEA,OAAO;EACT;AACF","ignoreList":[]}
1
+ {"version":3,"file":"validate.js","names":["fieldSchemasToFormState","isValidID","uploadValidation","props","node","validation","options","id","data","operation","preferences","req","payload","t","enabledCollectionSlugs","includes","relationTo","idType","collections","customIDType","db","defaultIDType","nodeID","value","Object","keys","length","collection","fields","result","collectionSlug","documentData","fieldSchemaMap","undefined","initialBlockData","permissions","renderAllFields","schemaPath","errorPathsSet","Set","fieldKey","fieldState","errorPaths","errorPath","add","Array","from","join"],"sources":["../../../../src/features/upload/server/validate.ts"],"sourcesContent":["import { fieldSchemasToFormState } from '@payloadcms/ui/forms/fieldSchemasToFormState'\nimport { isValidID } from 'payload'\n\nimport type { NodeValidation } from '../../typesServer.js'\nimport type { UploadFeatureServerProps } from './index.js'\nimport type { SerializedUploadNode } from './schema.js'\n\nexport const uploadValidation = (\n props: UploadFeatureServerProps,\n): NodeValidation<SerializedUploadNode> => {\n return async ({\n node,\n validation: {\n options: {\n id,\n data,\n operation,\n preferences,\n req,\n req: { payload, t },\n },\n },\n }) => {\n if (!props.enabledCollectionSlugs.includes(node.relationTo)) {\n return t('validation:invalidSelection')\n }\n\n const idType = payload.collections[node.relationTo]?.customIDType || payload.db.defaultIDType\n // @ts-expect-error - Fix in Payload v4\n const nodeID = node?.value?.id || node?.value // for backwards-compatibility\n\n if (!isValidID(nodeID, idType)) {\n return t('validation:validUploadID')\n }\n\n if (!props?.collections) {\n return true\n }\n\n if (Object.keys(props?.collections).length === 0) {\n return true\n }\n\n const collection = props?.collections[node.relationTo]\n\n if (!collection?.fields?.length) {\n return true\n }\n\n const result = await fieldSchemasToFormState({\n id,\n collectionSlug: node.relationTo,\n data: node?.fields ?? {},\n documentData: data,\n fields: collection.fields,\n fieldSchemaMap: undefined,\n initialBlockData: node?.fields ?? {},\n operation: operation === 'create' || operation === 'update' ? operation : 'update',\n permissions: {},\n preferences,\n renderAllFields: false,\n req,\n schemaPath: '',\n })\n\n const errorPathsSet = new Set<string>()\n for (const fieldKey in result) {\n const fieldState = result[fieldKey]\n if (fieldState?.errorPaths?.length) {\n for (const errorPath of fieldState.errorPaths) {\n errorPathsSet.add(errorPath)\n }\n }\n }\n const errorPaths = Array.from(errorPathsSet)\n\n if (errorPaths.length) {\n return 'The following fields are invalid: ' + errorPaths.join(', ')\n }\n\n return true\n }\n}\n"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ;AACxC,SAASC,SAAS,QAAQ;AAM1B,OAAO,MAAMC,gBAAA,GACXC,KAAA;EAEA,OAAO,OAAO;IACZC,IAAI;IACJC,UAAA,EAAY;MACVC,OAAA,EAAS;QACPC,EAAE;QACFC,IAAI;QACJC,SAAS;QACTC,WAAW;QACXC,GAAG;QACHA,GAAA,EAAK;UAAEC,OAAO;UAAEC;QAAC;MAAE;IACpB;EACF,CACF;IACC,IAAI,CAACV,KAAA,CAAMW,sBAAsB,CAACC,QAAQ,CAACX,IAAA,CAAKY,UAAU,GAAG;MAC3D,OAAOH,CAAA,CAAE;IACX;IAEA,MAAMI,MAAA,GAASL,OAAA,CAAQM,WAAW,CAACd,IAAA,CAAKY,UAAU,CAAC,EAAEG,YAAA,IAAgBP,OAAA,CAAQQ,EAAE,CAACC,aAAa;IAC7F;IACA,MAAMC,MAAA,GAASlB,IAAA,EAAMmB,KAAA,EAAOhB,EAAA,IAAMH,IAAA,EAAMmB,KAAA,CAAM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aG,KAAA,CAAMC,IAAI,CAACR,aAAA;IAE9B,IAAII,UAAA,CAAWhB,MAAM,EAAE;MACrB,OAAO,uCAAuCgB,UAAA,CAAWK,IAAI,CAAC;IAChE;IAEA,OAAO;EACT;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/Diff/converters/listitem/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8DAA8D,CAAA;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAE5E,OAAO,aAAa,CAAA;AAEpB,eAAO,MAAM,8BAA8B,EAAE,mBAAmB,CAAC,sBAAsB,CA+DtF,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/Diff/converters/listitem/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8DAA8D,CAAA;AACvG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAE5E,OAAO,aAAa,CAAA;AAEpB,eAAO,MAAM,8BAA8B,EAAE,mBAAmB,CAAC,sBAAsB,CA+DtF,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { CheckIcon } from '@payloadcms/ui/rsc';
3
+ import escapeHTML from 'escape-html';
3
4
  import './index.css';
4
5
  export const ListItemDiffHTMLConverterAsync = {
5
6
  listitem: async ({
@@ -57,7 +58,7 @@ export const ListItemDiffHTMLConverterAsync = {
57
58
  return `<li
58
59
  class="${hasSubLists ? 'nestedListItem' : ''}"
59
60
  style="${hasSubLists ? `list-style-type: none;${providedCSSString}` : providedCSSString}"
60
- value="${node.value}"
61
+ value="${escapeHTML(String(node.value))}"
61
62
  data-enable-match="true"
62
63
  >${children}</li>`;
63
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["CheckIcon","ListItemDiffHTMLConverterAsync","listitem","node","nodesToHTML","parent","providedCSSString","hasSubLists","children","some","child","type","nodes","join","listType","ReactDOMServer","default","JSX","_jsx","checked","className","role","tabIndex","value","dangerouslySetInnerHTML","__html","_jsxs","html","renderToStaticMarkup","styleIndex","indexOf","classIndex","classEndIndex","substring","classNameWithStyle","htmlWithStyle","replace"],"sources":["../../../../../src/field/Diff/converters/listitem/index.tsx"],"sourcesContent":["import { CheckIcon } from '@payloadcms/ui/rsc'\n\nimport type { HTMLConvertersAsync } from '../../../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedListItemNode } from '../../../../types/nodeTypes.js'\n\nimport './index.css'\n\nexport const ListItemDiffHTMLConverterAsync: HTMLConvertersAsync<SerializedListItemNode> = {\n listitem: async ({ node, nodesToHTML, parent, providedCSSString }) => {\n const hasSubLists = node.children.some((child) => child.type === 'list')\n\n const children = (\n await nodesToHTML({\n nodes: node.children,\n })\n ).join('')\n\n if ('listType' in parent && parent?.listType === 'check') {\n const ReactDOMServer = (await import('react-dom/server')).default\n\n const JSX = (\n <li\n aria-checked={node.checked ? true : false}\n className={`checkboxItem ${node.checked ? 'checkboxItem--checked' : 'checkboxItem--unchecked'}${\n hasSubLists ? ' checkboxItem--nested' : ''\n }`}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n role=\"checkbox\"\n tabIndex={-1}\n value={node.value}\n >\n {hasSubLists ? (\n // When sublists exist, just render them safely as HTML\n <div dangerouslySetInnerHTML={{ __html: children }} />\n ) : (\n // Otherwise, show our custom styled checkbox\n <div className=\"checkboxItem__wrapper\">\n <div\n className=\"checkboxItem__icon\"\n data-checked={node.checked}\n data-enable-match=\"true\"\n >\n {node.checked && <CheckIcon />}\n </div>\n <span className=\"checkboxItem__label\">{children}</span>\n </div>\n )}\n </li>\n )\n\n const html = ReactDOMServer.renderToStaticMarkup(JSX)\n\n // Add style=\"list-style-type: none;${providedCSSString}\" to html\n const styleIndex = html.indexOf('class=\"list-item-checkbox')\n const classIndex = html.indexOf('class=\"list-item-checkbox', styleIndex)\n const classEndIndex = html.indexOf('\"', classIndex + 6)\n const className = html.substring(classIndex, classEndIndex)\n const classNameWithStyle = `${className} style=\"list-style-type: none;${providedCSSString}\"`\n const htmlWithStyle = html.replace(className, classNameWithStyle)\n\n return htmlWithStyle\n } else {\n return `<li\n class=\"${hasSubLists ? 'nestedListItem' : ''}\"\n style=\"${hasSubLists ? `list-style-type: none;${providedCSSString}` : providedCSSString}\"\n value=\"${node.value}\"\n data-enable-match=\"true\"\n >${children}</li>`\n }\n },\n}\n"],"mappings":";AAAA,SAASA,SAAS,QAAQ;AAK1B,OAAO;AAEP,OAAO,MAAMC,8BAAA,GAA8E;EACzFC,QAAA,EAAU,MAAAA,CAAO;IAAEC,IAAI;IAAEC,WAAW;IAAEC,MAAM;IAAEC;EAAiB,CAAE;IAC/D,MAAMC,WAAA,GAAcJ,IAAA,CAAKK,QAAQ,CAACC,IAAI,CAAEC,KAAA,IAAUA,KAAA,CAAMC,IAAI,KAAK;IAEjE,MAAMH,QAAA,GAAW,CACf,MAAMJ,WAAA,CAAY;MAChBQ,KAAA,EAAOT,IAAA,CAAKK;IACd,EAAC,EACDK,IAAI,CAAC;IAEP,IAAI,cAAcR,MAAA,IAAUA,MAAA,EAAQS,QAAA,KAAa,SAAS;MACxD,MAAMC,cAAA,GAAiB,CAAC,MAAM,MAAM,CAAC,mBAAkB,EAAGC,OAAO;MAEjE,MAAMC,GAAA,gBACJC,IAAA,CAAC;QACC,gBAAcf,IAAA,CAAKgB,OAAO,GAAG,OAAO;QACpCC,SAAA,EAAW,gBAAgBjB,IAAA,CAAKgB,OAAO,GAAG,0BAA0B,4BAClEZ,WAAA,GAAc,0BAA0B,IACxC;QACF;QACAc,IAAA,EAAK;QACLC,QAAA,EAAU,CAAC;QACXC,KAAA,EAAOpB,IAAA,CAAKoB,KAAK;kBAEhBhB,WAAA;QACC;;QACAW,IAAA,CAAC;UAAIM,uBAAA,EAAyB;YAAEC,MAAA,EAAQjB;UAAS;;QAEjD;;QACAkB,KAAA,CAAC;UAAIN,SAAA,EAAU;kCACbF,IAAA,CAAC;YACCE,SAAA,EAAU;YACV,gBAAcjB,IAAA,CAAKgB,OAAO;YAC1B,qBAAkB;sBAEjBhB,IAAA,CAAKgB,OAAO,iBAAID,IAAA,CAAClB,SAAA;2BAEpBkB,IAAA,CAAC;YAAKE,SAAA,EAAU;sBAAuBZ;;;;MAM/C,MAAMmB,IAAA,GAAOZ,cAAA,CAAea,oBAAoB,CAACX,GAAA;MAEjD;MACA,MAAMY,UAAA,GAAaF,IAAA,CAAKG,OAAO,CAAC;MAChC,MAAMC,UAAA,GAAaJ,IAAA,CAAKG,OAAO,CAAC,6BAA6BD,UAAA;MAC7D,MAAMG,aAAA,GAAgBL,IAAA,CAAKG,OAAO,CAAC,KAAKC,UAAA,GAAa;MACrD,MAAMX,SAAA,GAAYO,IAAA,CAAKM,SAAS,CAACF,UAAA,EAAYC,aAAA;MAC7C,MAAME,kBAAA,GAAqB,GAAGd,SAAA,iCAA0Cd,iBAAA,GAAoB;MAC5F,MAAM6B,aAAA,GAAgBR,IAAA,CAAKS,OAAO,CAAChB,SAAA,EAAWc,kBAAA;MAE9C,OAAOC,aAAA;IACT,OAAO;MACL,OAAO;mBACM5B,WAAA,GAAc,mBAAmB;mBACjCA,WAAA,GAAc,yBAAyBD,iBAAA,EAAmB,GAAGA,iBAAA;mBAC7DH,IAAA,CAAKoB,KAAK;;WAElBf,QAAA,OAAe;IACtB;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["CheckIcon","escapeHTML","ListItemDiffHTMLConverterAsync","listitem","node","nodesToHTML","parent","providedCSSString","hasSubLists","children","some","child","type","nodes","join","listType","ReactDOMServer","default","JSX","_jsx","checked","className","role","tabIndex","value","dangerouslySetInnerHTML","__html","_jsxs","html","renderToStaticMarkup","styleIndex","indexOf","classIndex","classEndIndex","substring","classNameWithStyle","htmlWithStyle","replace","String"],"sources":["../../../../../src/field/Diff/converters/listitem/index.tsx"],"sourcesContent":["import { CheckIcon } from '@payloadcms/ui/rsc'\nimport escapeHTML from 'escape-html'\n\nimport type { HTMLConvertersAsync } from '../../../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedListItemNode } from '../../../../types/nodeTypes.js'\n\nimport './index.css'\n\nexport const ListItemDiffHTMLConverterAsync: HTMLConvertersAsync<SerializedListItemNode> = {\n listitem: async ({ node, nodesToHTML, parent, providedCSSString }) => {\n const hasSubLists = node.children.some((child) => child.type === 'list')\n\n const children = (\n await nodesToHTML({\n nodes: node.children,\n })\n ).join('')\n\n if ('listType' in parent && parent?.listType === 'check') {\n const ReactDOMServer = (await import('react-dom/server')).default\n\n const JSX = (\n <li\n aria-checked={node.checked ? true : false}\n className={`checkboxItem ${node.checked ? 'checkboxItem--checked' : 'checkboxItem--unchecked'}${\n hasSubLists ? ' checkboxItem--nested' : ''\n }`}\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n role=\"checkbox\"\n tabIndex={-1}\n value={node.value}\n >\n {hasSubLists ? (\n // When sublists exist, just render them safely as HTML\n <div dangerouslySetInnerHTML={{ __html: children }} />\n ) : (\n // Otherwise, show our custom styled checkbox\n <div className=\"checkboxItem__wrapper\">\n <div\n className=\"checkboxItem__icon\"\n data-checked={node.checked}\n data-enable-match=\"true\"\n >\n {node.checked && <CheckIcon />}\n </div>\n <span className=\"checkboxItem__label\">{children}</span>\n </div>\n )}\n </li>\n )\n\n const html = ReactDOMServer.renderToStaticMarkup(JSX)\n\n // Add style=\"list-style-type: none;${providedCSSString}\" to html\n const styleIndex = html.indexOf('class=\"list-item-checkbox')\n const classIndex = html.indexOf('class=\"list-item-checkbox', styleIndex)\n const classEndIndex = html.indexOf('\"', classIndex + 6)\n const className = html.substring(classIndex, classEndIndex)\n const classNameWithStyle = `${className} style=\"list-style-type: none;${providedCSSString}\"`\n const htmlWithStyle = html.replace(className, classNameWithStyle)\n\n return htmlWithStyle\n } else {\n return `<li\n class=\"${hasSubLists ? 'nestedListItem' : ''}\"\n style=\"${hasSubLists ? `list-style-type: none;${providedCSSString}` : providedCSSString}\"\n value=\"${escapeHTML(String(node.value))}\"\n data-enable-match=\"true\"\n >${children}</li>`\n }\n },\n}\n"],"mappings":";AAAA,SAASA,SAAS,QAAQ;AAC1B,OAAOC,UAAA,MAAgB;AAKvB,OAAO;AAEP,OAAO,MAAMC,8BAAA,GAA8E;EACzFC,QAAA,EAAU,MAAAA,CAAO;IAAEC,IAAI;IAAEC,WAAW;IAAEC,MAAM;IAAEC;EAAiB,CAAE;IAC/D,MAAMC,WAAA,GAAcJ,IAAA,CAAKK,QAAQ,CAACC,IAAI,CAAEC,KAAA,IAAUA,KAAA,CAAMC,IAAI,KAAK;IAEjE,MAAMH,QAAA,GAAW,CACf,MAAMJ,WAAA,CAAY;MAChBQ,KAAA,EAAOT,IAAA,CAAKK;IACd,EAAC,EACDK,IAAI,CAAC;IAEP,IAAI,cAAcR,MAAA,IAAUA,MAAA,EAAQS,QAAA,KAAa,SAAS;MACxD,MAAMC,cAAA,GAAiB,CAAC,MAAM,MAAM,CAAC,mBAAkB,EAAGC,OAAO;MAEjE,MAAMC,GAAA,gBACJC,IAAA,CAAC;QACC,gBAAcf,IAAA,CAAKgB,OAAO,GAAG,OAAO;QACpCC,SAAA,EAAW,gBAAgBjB,IAAA,CAAKgB,OAAO,GAAG,0BAA0B,4BAClEZ,WAAA,GAAc,0BAA0B,IACxC;QACF;QACAc,IAAA,EAAK;QACLC,QAAA,EAAU,CAAC;QACXC,KAAA,EAAOpB,IAAA,CAAKoB,KAAK;kBAEhBhB,WAAA;QACC;;QACAW,IAAA,CAAC;UAAIM,uBAAA,EAAyB;YAAEC,MAAA,EAAQjB;UAAS;;QAEjD;;QACAkB,KAAA,CAAC;UAAIN,SAAA,EAAU;kCACbF,IAAA,CAAC;YACCE,SAAA,EAAU;YACV,gBAAcjB,IAAA,CAAKgB,OAAO;YAC1B,qBAAkB;sBAEjBhB,IAAA,CAAKgB,OAAO,iBAAID,IAAA,CAACnB,SAAA;2BAEpBmB,IAAA,CAAC;YAAKE,SAAA,EAAU;sBAAuBZ;;;;MAM/C,MAAMmB,IAAA,GAAOZ,cAAA,CAAea,oBAAoB,CAACX,GAAA;MAEjD;MACA,MAAMY,UAAA,GAAaF,IAAA,CAAKG,OAAO,CAAC;MAChC,MAAMC,UAAA,GAAaJ,IAAA,CAAKG,OAAO,CAAC,6BAA6BD,UAAA;MAC7D,MAAMG,aAAA,GAAgBL,IAAA,CAAKG,OAAO,CAAC,KAAKC,UAAA,GAAa;MACrD,MAAMX,SAAA,GAAYO,IAAA,CAAKM,SAAS,CAACF,UAAA,EAAYC,aAAA;MAC7C,MAAME,kBAAA,GAAqB,GAAGd,SAAA,iCAA0Cd,iBAAA,GAAoB;MAC5F,MAAM6B,aAAA,GAAgBR,IAAA,CAAKS,OAAO,CAAChB,SAAA,EAAWc,kBAAA;MAE9C,OAAOC,aAAA;IACT,OAAO;MACL,OAAO;mBACM5B,WAAA,GAAc,mBAAmB;mBACjCA,WAAA,GAAc,yBAAyBD,iBAAA,EAAmB,GAAGA,iBAAA;mBAC7DN,UAAA,CAAWqC,MAAA,CAAOlC,IAAA,CAAKoB,KAAK;;WAEpCf,QAAA,OAAe;IACtB;EACF;AACF","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  @layer payload-default {
2
2
  .lexical-diff .lexical-unknown-diff {
3
- box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
3
+ box-shadow: var(--elevation-100-canvas);
4
4
  max-width: fit-content;
5
5
  display: flex;
6
6
  align-items: center;
@@ -1,5 +1,6 @@
1
- import type { RichTextFieldDiffServerComponent } from 'payload';
1
+ import type { RichTextFieldDiffServerProps } from 'payload';
2
2
  import './index.css';
3
3
  import '../bundled.css';
4
- export declare const LexicalDiffComponent: RichTextFieldDiffServerComponent;
4
+ import React from 'react';
5
+ export declare const LexicalDiffComponent: React.FC<RichTextFieldDiffServerProps>;
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/field/Diff/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,SAAS,CAAA;AAI/D,OAAO,aAAa,CAAA;AACpB,OAAO,gBAAgB,CAAA;AAqBvB,eAAO,MAAM,oBAAoB,EAAE,gCAiGlC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/field/Diff/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAA;AAI3D,OAAO,aAAa,CAAA;AACpB,OAAO,gBAAgB,CAAA;AAGvB,OAAO,KAAK,MAAM,OAAO,CAAA;AAkBzB,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CAkGvE,CAAA"}
@@ -78,6 +78,7 @@ export const LexicalDiffComponent = async args => {
78
78
  const payloadPopulateFn = await getPayloadPopulateFn({
79
79
  currentDepth: 0,
80
80
  depth: 1,
81
+ overrideAccess: false,
81
82
  req
82
83
  });
83
84
  const fromHTML = await convertLexicalToHTMLAsync({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["FieldDiffContainer","getHTMLDiffComponents","formatAdminURL","React","convertLexicalToHTMLAsync","getPayloadPopulateFn","LinkDiffHTMLConverterAsync","ListItemDiffHTMLConverterAsync","RelationshipDiffHTMLConverterAsync","UnknownDiffHTMLConverterAsync","UploadDiffHTMLConverterAsync","baseClass","LexicalDiffComponent","args","comparisonValue","valueFrom","field","i18n","locale","nestingLevel","req","versionValue","valueTo","internalDocToHref","linkNode","populate","fields","doc","relationTo","value","docId","id","collectionSlug","adminRoute","payload","config","routes","admin","path","serverURL","converters","defaultConverters","payloadPopulateFn","currentDepth","depth","fromHTML","data","disableContainer","toHTML","From","To","length","_jsx","className","label"],"sources":["../../../src/field/Diff/index.tsx"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { RichTextFieldDiffServerComponent } from 'payload'\n\nimport { FieldDiffContainer, getHTMLDiffComponents } from '@payloadcms/ui/rsc'\n\nimport './index.css'\nimport '../bundled.css'\n\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport type {\n HTMLConvertersFunctionAsync,\n HTMLPopulateFn,\n} from '../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedLinkNode } from '../../types/nodeTypes.js'\n\nimport { convertLexicalToHTMLAsync } from '../../features/converters/lexicalToHtml/async/index.js'\nimport { getPayloadPopulateFn } from '../../features/converters/utilities/payloadPopulateFn.js'\nimport { LinkDiffHTMLConverterAsync } from './converters/link.js'\nimport { ListItemDiffHTMLConverterAsync } from './converters/listitem/index.js'\nimport { RelationshipDiffHTMLConverterAsync } from './converters/relationship/index.js'\nimport { UnknownDiffHTMLConverterAsync } from './converters/unknown/index.js'\nimport { UploadDiffHTMLConverterAsync } from './converters/upload/index.js'\n\nconst baseClass = 'lexical-diff'\n\nexport const LexicalDiffComponent: RichTextFieldDiffServerComponent = async (args) => {\n const {\n comparisonValue: valueFrom,\n field,\n i18n,\n locale,\n nestingLevel,\n req,\n versionValue: valueTo,\n } = args\n\n const internalDocToHref = async ({\n linkNode,\n populate,\n }: {\n linkNode: SerializedLinkNode\n populate?: HTMLPopulateFn\n }) => {\n if (!linkNode.fields.doc) {\n return '#'\n }\n\n const { relationTo, value } = linkNode.fields.doc\n\n let docId: number | string\n\n if (typeof value === 'object' && value !== null) {\n docId = value.id\n } else if (populate && typeof value !== 'object') {\n const doc = await populate({\n id: value,\n collectionSlug: relationTo,\n })\n\n if (!doc || !doc.id) {\n return '#'\n }\n\n docId = doc.id\n } else {\n docId = value\n }\n\n return formatAdminURL({\n adminRoute: req.payload.config.routes.admin,\n path: `/collections/${relationTo}/${docId}`,\n serverURL: req.payload.config.serverURL,\n })\n }\n\n const converters: HTMLConvertersFunctionAsync = ({ defaultConverters }) => ({\n ...defaultConverters,\n ...LinkDiffHTMLConverterAsync({ internalDocToHref }),\n ...ListItemDiffHTMLConverterAsync,\n ...UploadDiffHTMLConverterAsync({ i18n, req }),\n ...RelationshipDiffHTMLConverterAsync({ i18n, req }),\n ...UnknownDiffHTMLConverterAsync({ i18n, req }),\n })\n\n const payloadPopulateFn = await getPayloadPopulateFn({\n currentDepth: 0,\n depth: 1,\n req,\n })\n const fromHTML = await convertLexicalToHTMLAsync({\n converters,\n data: valueFrom as SerializedEditorState,\n disableContainer: true,\n populate: payloadPopulateFn,\n })\n\n const toHTML = await convertLexicalToHTMLAsync({\n converters,\n data: valueTo as SerializedEditorState,\n disableContainer: true,\n populate: payloadPopulateFn,\n })\n\n const { From, To } = getHTMLDiffComponents({\n // Ensure empty paragraph is displayed for empty rich text fields - otherwise, toHTML may be displayed in the wrong column\n fromHTML: fromHTML?.length ? fromHTML : '<p></p>',\n toHTML: toHTML?.length ? toHTML : '<p></p>',\n })\n\n return (\n <FieldDiffContainer\n className={baseClass}\n From={From}\n i18n={i18n}\n label={{\n label: field.label,\n locale,\n }}\n nestingLevel={nestingLevel}\n To={To}\n />\n )\n}\n"],"mappings":";AAGA,SAASA,kBAAkB,EAAEC,qBAAqB,QAAQ;AAE1D,OAAO;AACP,OAAO;AAEP,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAQlB,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,kCAAkC,QAAQ;AACnD,SAASC,6BAA6B,QAAQ;AAC9C,SAASC,4BAA4B,QAAQ;AAE7C,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,oBAAA,GAAyD,MAAOC,IAAA;EAC3E,MAAM;IACJC,eAAA,EAAiBC,SAAS;IAC1BC,KAAK;IACLC,IAAI;IACJC,MAAM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AAE;IACpD,GAAGX,6BAAA,CAA8B;MAAEQ,IAAA;MAAMG;IAAI;EAC/C;EAEA,MAAMsB,iBAAA,GAAoB,MAAMrC,oBAAA,CAAqB;IACnDsC,YAAA,EAAc;IACdC,KAAA,EAAO;IACPxB;EACF;EACA,MAAMyB,QAAA,GAAW,MAAMzC,yBAAA,CAA0B;IAC/CoC,UAAA;IACAM,IAAA,EAAM/B,SAAA;IACNgC,gBAAA,EAAkB;IAClBtB,QAAA,EAAUiB;EACZ;EAEA,MAAMM,MAAA,GAAS,MAAM5C,yBAAA,CAA0B;IAC7CoC,UAAA;IACAM,IAAA,EAAMxB,OAAA;IACNyB,gBAAA,EAAkB;IAClBtB,QAAA,EAAUiB;EACZ;EAEA,MAAM;IAAEO,IAAI;IAAEC;EAAE,CAAE,GAAGjD,qBAAA,CAAsB;IACzC;IACA4C,QAAA,EAAUA,QAAA,EAAUM,MAAA,GAASN,QAAA,GAAW;IACxCG,MAAA,EAAQA,MAAA,EAAQG,MAAA,GAASH,MAAA,GAAS;EACpC;EAEA,oBACEI,IAAA,CAACpD,kBAAA;IACCqD,SAAA,EAAW1C,SAAA;IACXsC,IAAA,EAAMA,IAAA;IACNhC,IAAA,EAAMA,IAAA;IACNqC,KAAA,EAAO;MACLA,KAAA,EAAOtC,KAAA,CAAMsC,KAAK;MAClBpC;IACF;IACAC,YAAA,EAAcA,YAAA;IACd+B,EAAA,EAAIA;;AAGV","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["FieldDiffContainer","getHTMLDiffComponents","formatAdminURL","React","convertLexicalToHTMLAsync","getPayloadPopulateFn","LinkDiffHTMLConverterAsync","ListItemDiffHTMLConverterAsync","RelationshipDiffHTMLConverterAsync","UnknownDiffHTMLConverterAsync","UploadDiffHTMLConverterAsync","baseClass","LexicalDiffComponent","args","comparisonValue","valueFrom","field","i18n","locale","nestingLevel","req","versionValue","valueTo","internalDocToHref","linkNode","populate","fields","doc","relationTo","value","docId","id","collectionSlug","adminRoute","payload","config","routes","admin","path","serverURL","converters","defaultConverters","payloadPopulateFn","currentDepth","depth","overrideAccess","fromHTML","data","disableContainer","toHTML","From","To","length","_jsx","className","label"],"sources":["../../../src/field/Diff/index.tsx"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { RichTextFieldDiffServerProps } from 'payload'\n\nimport { FieldDiffContainer, getHTMLDiffComponents } from '@payloadcms/ui/rsc'\n\nimport './index.css'\nimport '../bundled.css'\n\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport type {\n HTMLConvertersFunctionAsync,\n HTMLPopulateFn,\n} from '../../features/converters/lexicalToHtml/async/types.js'\nimport type { SerializedLinkNode } from '../../types/nodeTypes.js'\n\nimport { convertLexicalToHTMLAsync } from '../../features/converters/lexicalToHtml/async/index.js'\nimport { getPayloadPopulateFn } from '../../features/converters/utilities/payloadPopulateFn.js'\nimport { LinkDiffHTMLConverterAsync } from './converters/link.js'\nimport { ListItemDiffHTMLConverterAsync } from './converters/listitem/index.js'\nimport { RelationshipDiffHTMLConverterAsync } from './converters/relationship/index.js'\nimport { UnknownDiffHTMLConverterAsync } from './converters/unknown/index.js'\nimport { UploadDiffHTMLConverterAsync } from './converters/upload/index.js'\n\nconst baseClass = 'lexical-diff'\n\nexport const LexicalDiffComponent: React.FC<RichTextFieldDiffServerProps> = async (args) => {\n const {\n comparisonValue: valueFrom,\n field,\n i18n,\n locale,\n nestingLevel,\n req,\n versionValue: valueTo,\n } = args\n\n const internalDocToHref = async ({\n linkNode,\n populate,\n }: {\n linkNode: SerializedLinkNode\n populate?: HTMLPopulateFn\n }) => {\n if (!linkNode.fields.doc) {\n return '#'\n }\n\n const { relationTo, value } = linkNode.fields.doc\n\n let docId: number | string\n\n if (typeof value === 'object' && value !== null) {\n docId = value.id\n } else if (populate && typeof value !== 'object') {\n const doc = await populate({\n id: value,\n collectionSlug: relationTo,\n })\n\n if (!doc || !doc.id) {\n return '#'\n }\n\n docId = doc.id\n } else {\n docId = value\n }\n\n return formatAdminURL({\n adminRoute: req.payload.config.routes.admin,\n path: `/collections/${relationTo}/${docId}`,\n serverURL: req.payload.config.serverURL,\n })\n }\n\n const converters: HTMLConvertersFunctionAsync = ({ defaultConverters }) => ({\n ...defaultConverters,\n ...LinkDiffHTMLConverterAsync({ internalDocToHref }),\n ...ListItemDiffHTMLConverterAsync,\n ...UploadDiffHTMLConverterAsync({ i18n, req }),\n ...RelationshipDiffHTMLConverterAsync({ i18n, req }),\n ...UnknownDiffHTMLConverterAsync({ i18n, req }),\n })\n\n const payloadPopulateFn = await getPayloadPopulateFn({\n currentDepth: 0,\n depth: 1,\n overrideAccess: false,\n req,\n })\n const fromHTML = await convertLexicalToHTMLAsync({\n converters,\n data: valueFrom as SerializedEditorState,\n disableContainer: true,\n populate: payloadPopulateFn,\n })\n\n const toHTML = await convertLexicalToHTMLAsync({\n converters,\n data: valueTo as SerializedEditorState,\n disableContainer: true,\n populate: payloadPopulateFn,\n })\n\n const { From, To } = getHTMLDiffComponents({\n // Ensure empty paragraph is displayed for empty rich text fields - otherwise, toHTML may be displayed in the wrong column\n fromHTML: fromHTML?.length ? fromHTML : '<p></p>',\n toHTML: toHTML?.length ? toHTML : '<p></p>',\n })\n\n return (\n <FieldDiffContainer\n className={baseClass}\n From={From}\n i18n={i18n}\n label={{\n label: field.label,\n locale,\n }}\n nestingLevel={nestingLevel}\n To={To}\n />\n )\n}\n"],"mappings":";AAGA,SAASA,kBAAkB,EAAEC,qBAAqB,QAAQ;AAE1D,OAAO;AACP,OAAO;AAEP,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAQlB,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,kCAAkC,QAAQ;AACnD,SAASC,6BAA6B,QAAQ;AAC9C,SAASC,4BAA4B,QAAQ;AAE7C,MAAMC,SAAA,GAAY;AAElB,OAA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