@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
@@ -11,57 +11,53 @@ import { $createRelationshipNode, RelationshipNode } from '../nodes/Relationship
11
11
  import { useEnabledRelationships } from '../utils/useEnabledRelationships.js';
12
12
  export const INSERT_RELATIONSHIP_COMMAND = createCommand('INSERT_RELATIONSHIP_COMMAND');
13
13
  export const RelationshipPlugin = t0 => {
14
- const $ = _c(8);
14
+ const $ = _c(7);
15
15
  const {
16
16
  clientProps
17
17
  } = t0;
18
18
  const [editor] = useLexicalComposerContext();
19
- const t1 = clientProps?.disabledCollections;
20
- const t2 = clientProps?.enabledCollections;
21
- let t3;
22
- if ($[0] !== t1 || $[1] !== t2) {
23
- t3 = {
24
- collectionSlugsBlacklist: t1,
25
- collectionSlugsWhitelist: t2
19
+ let t1;
20
+ if ($[0] !== clientProps.enabledCollectionSlugs) {
21
+ t1 = {
22
+ enabledCollectionSlugs: clientProps.enabledCollectionSlugs
26
23
  };
27
- $[0] = t1;
28
- $[1] = t2;
29
- $[2] = t3;
24
+ $[0] = clientProps.enabledCollectionSlugs;
25
+ $[1] = t1;
30
26
  } else {
31
- t3 = $[2];
27
+ t1 = $[1];
32
28
  }
33
29
  const {
34
30
  enabledCollectionSlugs
35
- } = useEnabledRelationships(t3);
36
- let t4;
37
- let t5;
38
- if ($[3] !== editor) {
39
- t4 = () => {
31
+ } = useEnabledRelationships(t1);
32
+ let t2;
33
+ let t3;
34
+ if ($[2] !== editor) {
35
+ t2 = () => {
40
36
  if (!editor.hasNodes([RelationshipNode])) {
41
37
  throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");
42
38
  }
43
39
  return editor.registerCommand(INSERT_RELATIONSHIP_COMMAND, _temp, COMMAND_PRIORITY_EDITOR);
44
40
  };
45
- t5 = [editor];
46
- $[3] = editor;
47
- $[4] = t4;
48
- $[5] = t5;
41
+ t3 = [editor];
42
+ $[2] = editor;
43
+ $[3] = t2;
44
+ $[4] = t3;
49
45
  } else {
50
- t4 = $[4];
51
- t5 = $[5];
46
+ t2 = $[3];
47
+ t3 = $[4];
52
48
  }
53
- useEffect(t4, t5);
54
- let t6;
55
- if ($[6] !== enabledCollectionSlugs) {
56
- t6 = _jsx(RelationshipDrawer, {
49
+ useEffect(t2, t3);
50
+ let t4;
51
+ if ($[5] !== enabledCollectionSlugs) {
52
+ t4 = _jsx(RelationshipDrawer, {
57
53
  enabledCollectionSlugs
58
54
  });
59
- $[6] = enabledCollectionSlugs;
60
- $[7] = t6;
55
+ $[5] = enabledCollectionSlugs;
56
+ $[6] = t4;
61
57
  } else {
62
- t6 = $[7];
58
+ t4 = $[6];
63
59
  }
64
- return t6;
60
+ return t4;
65
61
  };
66
62
  function _temp(payload) {
67
63
  const selection = $getSelection() || $getPreviousSelection();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$insertNodeToNearestRoot","$getPreviousSelection","$getSelection","$isParagraphNode","$isRangeSelection","COMMAND_PRIORITY_EDITOR","createCommand","useEffect","RelationshipDrawer","$createRelationshipNode","RelationshipNode","useEnabledRelationships","INSERT_RELATIONSHIP_COMMAND","RelationshipPlugin","t0","$","clientProps","editor","t1","disabledCollections","t2","enabledCollections","t3","collectionSlugsBlacklist","collectionSlugsWhitelist","enabledCollectionSlugs","t4","t5","hasNodes","Error","registerCommand","_temp","t6","_jsx","payload","selection","relationshipNode","focus","focusNode","getNode","__first","remove"],"sources":["../../../../../src/features/relationship/client/plugins/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $insertNodeToNearestRoot } from '@lexical/utils'\nimport {\n $getPreviousSelection,\n $getSelection,\n $isParagraphNode,\n $isRangeSelection,\n COMMAND_PRIORITY_EDITOR,\n createCommand,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../typesClient.js'\nimport type { RelationshipFeatureProps } from '../../server/index.js'\nimport type { RelationshipData } from '../../server/schema.js'\n\nimport { RelationshipDrawer } from '../drawer/index.js'\nimport { $createRelationshipNode, RelationshipNode } from '../nodes/RelationshipNode.js'\nimport { useEnabledRelationships } from '../utils/useEnabledRelationships.js'\n\nexport const INSERT_RELATIONSHIP_COMMAND: LexicalCommand<RelationshipData> = createCommand(\n 'INSERT_RELATIONSHIP_COMMAND',\n)\n\nexport const RelationshipPlugin: PluginComponent<RelationshipFeatureProps> = ({ clientProps }) => {\n const [editor] = useLexicalComposerContext()\n\n const { enabledCollectionSlugs } = useEnabledRelationships({\n collectionSlugsBlacklist: clientProps?.disabledCollections,\n collectionSlugsWhitelist: clientProps?.enabledCollections,\n })\n\n useEffect(() => {\n if (!editor.hasNodes([RelationshipNode])) {\n throw new Error('RelationshipPlugin: RelationshipNode not registered on editor')\n }\n\n return editor.registerCommand<RelationshipData>(\n INSERT_RELATIONSHIP_COMMAND,\n (payload) => {\n const selection = $getSelection() || $getPreviousSelection()\n\n if ($isRangeSelection(selection)) {\n const relationshipNode = $createRelationshipNode(payload)\n // we need to get the focus node before inserting the block node, as $insertNodeToNearestRoot can change the focus node\n const { focus } = selection\n const focusNode = focus.getNode()\n // Insert relationship node BEFORE potentially removing focusNode, as $insertNodeToNearestRoot errors if the focusNode doesn't exist\n $insertNodeToNearestRoot(relationshipNode)\n\n // Delete the node it it's an empty paragraph\n if ($isParagraphNode(focusNode) && !focusNode.__first) {\n focusNode.remove()\n }\n }\n\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor])\n\n return <RelationshipDrawer enabledCollectionSlugs={enabledCollectionSlugs} />\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,wBAAwB,QAAQ;AACzC,SACEC,qBAAqB,EACrBC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,uBAAuB,EACvBC,aAAa,QACR;AACP,SAASC,SAAS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AAjB,CAAA,QAAAU,sBAAA;IAEJO,EAAA,GAAAC,IAAA,CAAAzB,kBAAA;MAAAiB;IAAA,C;;;;;;SAAAO,E;CACT;AAvC6E,SAAAD,MAAAG,OAAA;EAgBrE,MAAAC,SAAA,GAAkBjC,aAAA,MAAmBD,qBAAA;EAAA,IAEjCG,iBAAA,CAAkB+B,SAAA;IACpB,MAAAC,gBAAA,GAAyB3B,uBAAA,CAAwByB,OAAA;IAEjD;MAAAG;IAAA,IAAkBF,SAAA;IAClB,MAAAG,SAAA,GAAkBD,KAAA,CAAAE,OAAA,CAAa;IAE/BvC,wBAAA,CAAyBoC,gBAAA;IAAA,IAGrBjC,gBAAA,CAAiBmC,SAAA,MAAeA,SAAA,CAAAE,OAAiB;MACnDF,SAAA,CAAAG,MAAA,CAAgB;IAAA;EAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$insertNodeToNearestRoot","$getPreviousSelection","$getSelection","$isParagraphNode","$isRangeSelection","COMMAND_PRIORITY_EDITOR","createCommand","useEffect","RelationshipDrawer","$createRelationshipNode","RelationshipNode","useEnabledRelationships","INSERT_RELATIONSHIP_COMMAND","RelationshipPlugin","t0","$","clientProps","editor","t1","enabledCollectionSlugs","t2","t3","hasNodes","Error","registerCommand","_temp","t4","_jsx","payload","selection","relationshipNode","focus","focusNode","getNode","__first","remove"],"sources":["../../../../../src/features/relationship/client/plugins/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $insertNodeToNearestRoot } from '@lexical/utils'\nimport {\n $getPreviousSelection,\n $getSelection,\n $isParagraphNode,\n $isRangeSelection,\n COMMAND_PRIORITY_EDITOR,\n createCommand,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../typesClient.js'\nimport type { RelationshipFeatureClientProps } from '../../server/index.js'\nimport type { RelationshipData } from '../../server/schema.js'\n\nimport { RelationshipDrawer } from '../drawer/index.js'\nimport { $createRelationshipNode, RelationshipNode } from '../nodes/RelationshipNode.js'\nimport { useEnabledRelationships } from '../utils/useEnabledRelationships.js'\n\nexport const INSERT_RELATIONSHIP_COMMAND: LexicalCommand<RelationshipData> = createCommand(\n 'INSERT_RELATIONSHIP_COMMAND',\n)\n\nexport const RelationshipPlugin: PluginComponent<RelationshipFeatureClientProps> = ({\n clientProps,\n}) => {\n const [editor] = useLexicalComposerContext()\n\n const { enabledCollectionSlugs } = useEnabledRelationships({\n enabledCollectionSlugs: clientProps.enabledCollectionSlugs,\n })\n\n useEffect(() => {\n if (!editor.hasNodes([RelationshipNode])) {\n throw new Error('RelationshipPlugin: RelationshipNode not registered on editor')\n }\n\n return editor.registerCommand<RelationshipData>(\n INSERT_RELATIONSHIP_COMMAND,\n (payload) => {\n const selection = $getSelection() || $getPreviousSelection()\n\n if ($isRangeSelection(selection)) {\n const relationshipNode = $createRelationshipNode(payload)\n // we need to get the focus node before inserting the block node, as $insertNodeToNearestRoot can change the focus node\n const { focus } = selection\n const focusNode = focus.getNode()\n // Insert relationship node BEFORE potentially removing focusNode, as $insertNodeToNearestRoot errors if the focusNode doesn't exist\n $insertNodeToNearestRoot(relationshipNode)\n\n // Delete the node it it's an empty paragraph\n if ($isParagraphNode(focusNode) && !focusNode.__first) {\n focusNode.remove()\n }\n }\n\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor])\n\n return <RelationshipDrawer enabledCollectionSlugs={enabledCollectionSlugs} />\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,wBAAwB,QAAQ;AACzC,SACEC,qBAAqB,EACrBC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,uBAAuB,EACvBC,aAAa,QACR;AACP,SAASC,SAAS,QAAQ;AAM1B,SAASC,kBAAkB,QAAQ;AACnC,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AA;EAAA,IAEjCG,iBAAA,CAAkByB,SAAA;IACpB,MAAAC,gBAAA,GAAyBrB,uBAAA,CAAwBmB,OAAA;IAEjD;MAAAG;IAAA,IAAkBF,SAAA;IAClB,MAAAG,SAAA,GAAkBD,KAAA,CAAAE,OAAA,CAAa;IAE/BjC,wBAAA,CAAyB8B,gBAAA;IAAA,IAGrB3B,gBAAA,CAAiB6B,SAAA,MAAeA,SAAA,CAAAE,OAAiB;MACnDF,SAAA,CAAAG,MAAA,CAAgB;IAAA;EAAA;EAAA;AAAA","ignoreList":[]}
@@ -1,13 +1,11 @@
1
1
  import type { ClientCollectionConfig, CollectionSlug } from 'payload';
2
2
  type UseEnabledRelationshipsOptions = {
3
- collectionSlugsBlacklist?: string[];
4
- collectionSlugsWhitelist?: string[];
5
- uploads?: boolean;
3
+ enabledCollectionSlugs: CollectionSlug[];
6
4
  };
7
5
  type UseEnabledRelationshipsResult = {
8
6
  enabledCollections: ClientCollectionConfig[];
9
7
  enabledCollectionSlugs: CollectionSlug[];
10
8
  };
11
- export declare const useEnabledRelationships: (options?: UseEnabledRelationshipsOptions) => UseEnabledRelationshipsResult;
9
+ export declare const useEnabledRelationships: ({ enabledCollectionSlugs, }: UseEnabledRelationshipsOptions) => UseEnabledRelationshipsResult;
12
10
  export {};
13
11
  //# sourceMappingURL=useEnabledRelationships.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEnabledRelationships.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/client/utils/useEnabledRelationships.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAOrE,KAAK,8BAA8B,GAAG;IACpC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,6BAA6B,GAAG;IACnC,kBAAkB,EAAE,sBAAsB,EAAE,CAAA;IAC5C,sBAAsB,EAAE,cAAc,EAAE,CAAA;CACzC,CAAA;AAED,eAAO,MAAM,uBAAuB,GAClC,UAAU,8BAA8B,KACvC,6BAmBF,CAAA"}
1
+ {"version":3,"file":"useEnabledRelationships.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/client/utils/useEnabledRelationships.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAKrE,KAAK,8BAA8B,GAAG;IACpC,sBAAsB,EAAE,cAAc,EAAE,CAAA;CACzC,CAAA;AAED,KAAK,6BAA6B,GAAG;IACnC,kBAAkB,EAAE,sBAAsB,EAAE,CAAA;IAC5C,sBAAsB,EAAE,cAAc,EAAE,CAAA;CACzC,CAAA;AAED,eAAO,MAAM,uBAAuB,gCAEjC,8BAA8B,KAAG,6BAiBnC,CAAA"}
@@ -1,33 +1,66 @@
1
1
  'use client';
2
2
 
3
+ import { c as _c } from "react/compiler-runtime";
3
4
  import { useConfig, useEntityVisibility } from '@payloadcms/ui';
4
5
  import * as React from 'react';
5
- import { filterEnabledRelationshipCollections } from '../../shared/filterEnabledRelationshipCollections.js';
6
- export const useEnabledRelationships = options => {
6
+ export const useEnabledRelationships = t0 => {
7
+ const $ = _c(11);
7
8
  const {
8
- collectionSlugsBlacklist,
9
- collectionSlugsWhitelist,
10
- uploads = false
11
- } = options || {};
9
+ enabledCollectionSlugs
10
+ } = t0;
12
11
  const {
13
- config: {
14
- collections
15
- }
12
+ config: t1
16
13
  } = useConfig();
14
+ const {
15
+ collections
16
+ } = t1;
17
17
  const {
18
18
  visibleEntities
19
19
  } = useEntityVisibility();
20
- return React.useMemo(() => {
21
- const enabledCollections = filterEnabledRelationshipCollections(collections, {
22
- disabledCollections: collectionSlugsBlacklist,
23
- enabledCollections: collectionSlugsWhitelist,
24
- uploads,
25
- visibleSlugs: visibleEntities?.collections
26
- });
27
- return {
28
- enabledCollections,
29
- enabledCollectionSlugs: enabledCollections.map(c => c.slug)
20
+ let t2;
21
+ let t3;
22
+ if ($[0] !== collections || $[1] !== enabledCollectionSlugs || $[2] !== visibleEntities) {
23
+ let t4;
24
+ if ($[5] !== enabledCollectionSlugs || $[6] !== visibleEntities) {
25
+ t4 = t5 => {
26
+ const {
27
+ slug
28
+ } = t5;
29
+ return enabledCollectionSlugs.includes(slug) && (!visibleEntities?.collections || visibleEntities.collections.includes(slug));
30
+ };
31
+ $[5] = enabledCollectionSlugs;
32
+ $[6] = visibleEntities;
33
+ $[7] = t4;
34
+ } else {
35
+ t4 = $[7];
36
+ }
37
+ const enabledCollections = collections.filter(t4);
38
+ t2 = enabledCollections;
39
+ t3 = enabledCollections.map(_temp);
40
+ $[0] = collections;
41
+ $[1] = enabledCollectionSlugs;
42
+ $[2] = visibleEntities;
43
+ $[3] = t2;
44
+ $[4] = t3;
45
+ } else {
46
+ t2 = $[3];
47
+ t3 = $[4];
48
+ }
49
+ let t4;
50
+ if ($[8] !== t2 || $[9] !== t3) {
51
+ t4 = {
52
+ enabledCollections: t2,
53
+ enabledCollectionSlugs: t3
30
54
  };
31
- }, [collections, visibleEntities, uploads, collectionSlugsWhitelist, collectionSlugsBlacklist]);
55
+ $[8] = t2;
56
+ $[9] = t3;
57
+ $[10] = t4;
58
+ } else {
59
+ t4 = $[10];
60
+ }
61
+ return t4;
32
62
  };
63
+ function _temp(c) {
64
+ return c.slug;
65
+ }
33
66
  //# sourceMappingURL=useEnabledRelationships.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEnabledRelationships.js","names":["useConfig","useEntityVisibility","React","filterEnabledRelationshipCollections","useEnabledRelationships","options","collectionSlugsBlacklist","collectionSlugsWhitelist","uploads","config","collections","visibleEntities","useMemo","enabledCollections","disabledCollections","visibleSlugs","enabledCollectionSlugs","map","c","slug"],"sources":["../../../../../src/features/relationship/client/utils/useEnabledRelationships.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig, CollectionSlug } from 'payload'\n\nimport { useConfig, useEntityVisibility } from '@payloadcms/ui'\nimport * as React from 'react'\n\nimport { filterEnabledRelationshipCollections } from '../../shared/filterEnabledRelationshipCollections.js'\n\ntype UseEnabledRelationshipsOptions = {\n collectionSlugsBlacklist?: string[]\n collectionSlugsWhitelist?: string[]\n uploads?: boolean\n}\n\ntype UseEnabledRelationshipsResult = {\n enabledCollections: ClientCollectionConfig[]\n enabledCollectionSlugs: CollectionSlug[]\n}\n\nexport const useEnabledRelationships = (\n options?: UseEnabledRelationshipsOptions,\n): UseEnabledRelationshipsResult => {\n const { collectionSlugsBlacklist, collectionSlugsWhitelist, uploads = false } = options || {}\n const {\n config: { collections },\n } = useConfig()\n const { visibleEntities } = useEntityVisibility()\n\n return React.useMemo(() => {\n const enabledCollections = filterEnabledRelationshipCollections(collections, {\n disabledCollections: collectionSlugsBlacklist,\n enabledCollections: collectionSlugsWhitelist,\n uploads,\n visibleSlugs: visibleEntities?.collections,\n })\n return {\n enabledCollections,\n enabledCollectionSlugs: enabledCollections.map((c) => c.slug),\n }\n }, [collections, visibleEntities, uploads, collectionSlugsWhitelist, collectionSlugsBlacklist])\n}\n"],"mappings":"AAAA;;AAGA,SAASA,SAAS,EAAEC,mBAAmB,QAAQ;AAC/C,YAAYC,KAAA,MAAW;AAEvB,SAASC,oCAAoC,QAAQ;AAarD,OAAO,MAAMC,uBAAA,GACXC,OAAA;EAEA,MAAM;IAAEC,wBAAwB;IAAEC,wBAAwB;IAAEC,OAAA,GAAU;EAAK,CAAE,GAAGH,OAAA,IAAW,CAAC;EAC5F,MAAM;IACJI,MAAA,EAAQ;MAAEC;IAAW;EAAE,CACxB,GAAGV,SAAA;EACJ,MAAM;IAAEW;EAAe,CAAE,GAAGV,mBAAA;EAE5B,OAAOC,KAAA,CAAMU,OAAO,CAAC;IACnB,MAAMC,kBAAA,GAAqBV,oCAAA,CAAqCO,WAAA,EAAa;MAC3EI,mBAAA,EAAqBR,wBAAA;MACrBO,kBAAA,EAAoBN,wBAAA;MACpBC,OAAA;MACAO,YAAA,EAAcJ,eAAA,EAAiBD;IACjC;IACA,OAAO;MACLG,kBAAA;MACAG,sBAAA,EAAwBH,kBAAA,CAAmBI,GAAG,CAAEC,CAAA,IAAMA,CAAA,CAAEC,IAAI;IAC9D;EACF,GAAG,CAACT,WAAA,EAAaC,eAAA,EAAiBH,OAAA,EAASD,wBAAA,EAA0BD,wBAAA,CAAyB;AAChG","ignoreList":[]}
1
+ {"version":3,"file":"useEnabledRelationships.js","names":["c","_c","useConfig","useEntityVisibility","React","useEnabledRelationships","t0","$","enabledCollectionSlugs","config","t1","collections","visibleEntities","t2","t3","t4","t5","slug","includes","enabledCollections","filter","map","_temp"],"sources":["../../../../../src/features/relationship/client/utils/useEnabledRelationships.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig, CollectionSlug } from 'payload'\n\nimport { useConfig, useEntityVisibility } from '@payloadcms/ui'\nimport * as React from 'react'\n\ntype UseEnabledRelationshipsOptions = {\n enabledCollectionSlugs: CollectionSlug[]\n}\n\ntype UseEnabledRelationshipsResult = {\n enabledCollections: ClientCollectionConfig[]\n enabledCollectionSlugs: CollectionSlug[]\n}\n\nexport const useEnabledRelationships = ({\n enabledCollectionSlugs,\n}: UseEnabledRelationshipsOptions): UseEnabledRelationshipsResult => {\n const {\n config: { collections },\n } = useConfig()\n const { visibleEntities } = useEntityVisibility()\n\n return React.useMemo(() => {\n const enabledCollections = collections.filter(\n ({ slug }) =>\n enabledCollectionSlugs.includes(slug) &&\n (!visibleEntities?.collections || visibleEntities.collections.includes(slug)),\n )\n return {\n enabledCollections,\n enabledCollectionSlugs: enabledCollections.map((c) => c.slug),\n }\n }, [collections, enabledCollectionSlugs, visibleEntities])\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAGA,SAASC,SAAS,EAAEC,mBAAmB,QAAQ;AAC/C,YAAYC,KAAA,MAAW;AAWvB,OAAO,MAAMC,uBAAA,GA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oC;IAC9DP,CAAA,MAAAM,EAAA;IAAAN,CAAA,MAAAO,EAAA;IAAAP,CAAA,OAAAQ,EAAA;EAAA;IAAAA,EAAA,GAAAR,CAAA;EAAA;EAAA,OAHOQ,EAGP;AAAA,CAEJ;AAnBuC,SAAAO,MAAAtB,CAAA;EAAA,OAgBqBA,CAAA,CAAAiB,IAAA;AAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { PopulationPromise } from '../../typesServer.js';
2
- import type { RelationshipFeatureProps } from './index.js';
2
+ import type { RelationshipFeatureServerProps } from './index.js';
3
3
  import type { SerializedRelationshipNode } from './schema.js';
4
- export declare const relationshipPopulationPromiseHOC: (props: RelationshipFeatureProps) => PopulationPromise<SerializedRelationshipNode>;
4
+ export declare const relationshipPopulationPromiseHOC: (props: RelationshipFeatureServerProps) => PopulationPromise<SerializedRelationshipNode>;
5
5
  //# sourceMappingURL=graphQLPopulationPromise.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphQLPopulationPromise.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/server/graphQLPopulationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AAI7D,eAAO,MAAM,gCAAgC,GAC3C,OAAO,wBAAwB,KAC9B,iBAAiB,CAAC,0BAA0B,CAwC9C,CAAA"}
1
+ {"version":3,"file":"graphQLPopulationPromise.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/server/graphQLPopulationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAA;AAChE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AAI7D,eAAO,MAAM,gCAAgC,UACpC,8BAA8B,KACpC,iBAAiB,CAAC,0BAA0B,CAwC9C,CAAA"}
@@ -10,13 +10,13 @@ export const relationshipPopulationPromiseHOC = props => {
10
10
  req,
11
11
  showHiddenFields
12
12
  }) => {
13
- if (node?.value) {
13
+ if (node?.value && props.enabledCollectionSlugs.includes(node.relationTo)) {
14
14
  // @ts-expect-error
15
15
  const id = node?.value?.id || node?.value // for backwards-compatibility
16
16
  ;
17
17
  const collection = req.payload.collections[node?.relationTo];
18
18
  if (collection) {
19
- const populateDepth = props?.maxDepth !== undefined && props?.maxDepth < depth ? props?.maxDepth : depth;
19
+ const populateDepth = props.maxDepth !== undefined && props.maxDepth < depth ? props.maxDepth : depth;
20
20
  populationPromises.push(populate({
21
21
  id,
22
22
  collectionSlug: collection.config.slug,
@@ -1 +1 @@
1
- {"version":3,"file":"graphQLPopulationPromise.js","names":["populate","relationshipPopulationPromiseHOC","props","relationshipPopulationPromise","currentDepth","depth","draft","node","overrideAccess","populationPromises","req","showHiddenFields","value","id","collection","payload","collections","relationTo","populateDepth","maxDepth","undefined","push","collectionSlug","config","slug","data","key"],"sources":["../../../../src/features/relationship/server/graphQLPopulationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../../typesServer.js'\nimport type { RelationshipFeatureProps } from './index.js'\nimport type { SerializedRelationshipNode } from './schema.js'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\n\nexport const relationshipPopulationPromiseHOC = (\n props: RelationshipFeatureProps,\n): PopulationPromise<SerializedRelationshipNode> => {\n const relationshipPopulationPromise: PopulationPromise<SerializedRelationshipNode> = ({\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (node?.value) {\n // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n const collection = req.payload.collections[node?.relationTo]\n\n if (collection) {\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 showHiddenFields,\n }),\n )\n }\n }\n }\n\n return relationshipPopulationPromise\n}\n"],"mappings":"AAIA,SAASA,QAAQ,QAAQ;AAEzB,OAAO,MAAMC,gCAAA,GACXC,KAAA;EAEA,MAAMC,6BAAA,GAA+EA,CAAC;IACpFC,YAAY;IACZC,KAAK;IACLC,KAAK;IACLC,IAAI;IACJC,cAAc;IACdC,kBAAkB;IAClBC,GAAG;IACHC;EAAgB,CACjB;IACC,IAAIJ,IAAA,EAAMK,KAAA,EAAO;MACf;MACA,MAAMC,EAAA,GAAKN,IAAA,EAAMK,KAAA,EAAOC,EAAA,IAAMN,IAAA,EAAMK,KAAA,CAAM;AAAA;MAE1C,MAAME,UAAA,GAAaJ,GAAA,CAAIK,OAAO,CAACC,WAAW,CAACT,IAAA,EAAMU,UAAA,CAAW;MAE5D,IAAIH,UAAA,EAAY;QACd,MAAMI,aAAA,GACJhB,KAAA,EAAOiB,QAAA,KAAaC,SAAA,IAAalB,KAAA,EAAOiB,QAAA,GAAWd,KAAA,GAAQH,KAAA,EAAOiB,QAAA,GAAWd,KAAA;QAE/EI,kBAAA,CAAmBY,IAAI,CACrBrB,QAAA,CAAS;UACPa,EAAA;UACAS,cAAA,EAAgBR,UAAA,CAAWS,MAAM,CAACC,IAAI;UACtCpB,YAAA;UACAqB,IAAA,EAAMlB,IAAA;UACNF,KAAA,EAAOa,aAAA;UACPZ,KAAA;UACAoB,GAAA,EAAK;UACLlB,cAAA;UACAE,GAAA;UACAC;QACF;MAEJ;IACF;EACF;EAEA,OAAOR,6BAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"graphQLPopulationPromise.js","names":["populate","relationshipPopulationPromiseHOC","props","relationshipPopulationPromise","currentDepth","depth","draft","node","overrideAccess","populationPromises","req","showHiddenFields","value","enabledCollectionSlugs","includes","relationTo","id","collection","payload","collections","populateDepth","maxDepth","undefined","push","collectionSlug","config","slug","data","key"],"sources":["../../../../src/features/relationship/server/graphQLPopulationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../../typesServer.js'\nimport type { RelationshipFeatureServerProps } from './index.js'\nimport type { SerializedRelationshipNode } from './schema.js'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\n\nexport const relationshipPopulationPromiseHOC = (\n props: RelationshipFeatureServerProps,\n): PopulationPromise<SerializedRelationshipNode> => {\n const relationshipPopulationPromise: PopulationPromise<SerializedRelationshipNode> = ({\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (node?.value && props.enabledCollectionSlugs.includes(node.relationTo)) {\n // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n const collection = req.payload.collections[node?.relationTo]\n\n if (collection) {\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 showHiddenFields,\n }),\n )\n }\n }\n }\n\n return relationshipPopulationPromise\n}\n"],"mappings":"AAIA,SAASA,QAAQ,QAAQ;AAEzB,OAAO,MAAMC,gCAAA,GACXC,KAAA;EAEA,MAAMC,6BAAA,GAA+EA,CAAC;IACpFC,YAAY;IACZC,KAAK;IACLC,KAAK;IACLC,IAAI;IACJC,cAAc;IACdC,kBAAkB;IAClBC,GAAG;IACHC;EAAgB,CACjB;IACC,IAAIJ,IAAA,EAAMK,KAAA,IAASV,KAAA,CAAMW,sBAAsB,CAACC,QAAQ,CAACP,IAAA,CAAKQ,UAAU,GAAG;MACzE;MACA,MAAMC,EAAA,GAAKT,IAAA,EAAMK,KAAA,EAAOI,EAAA,IAAMT,IAAA,EAAMK,KAAA,CAAM;AAAA;MAE1C,MAAMK,UAAA,GAAaP,GAAA,CAAIQ,OAAO,CAACC,WAAW,CAACZ,IAAA,EAAMQ,UAAA,CAAW;MAE5D,IAAIE,UAAA,EAAY;QACd,MAAMG,aAAA,GACJlB,KAAA,CAAMmB,QAAQ,KAAKC,SAAA,IAAapB,KAAA,CAAMmB,QAAQ,GAAGhB,KAAA,GAAQH,KAAA,CAAMmB,QAAQ,GAAGhB,KAAA;QAE5EI,kBAAA,CAAmBc,IAAI,CACrBvB,QAAA,CAAS;UACPgB,EAAA;UACAQ,cAAA,EAAgBP,UAAA,CAAWQ,MAAM,CAACC,IAAI;UACtCtB,YAAA;UACAuB,IAAA,EAAMpB,IAAA;UACNF,KAAA,EAAOe,aAAA;UACPd,KAAA;UACAsB,GAAA,EAAK;UACLpB,cAAA;UACAE,GAAA;UACAC;QACF;MAEJ;IACF;EACF;EAEA,OAAOR,6BAAA;AACT","ignoreList":[]}
@@ -24,5 +24,12 @@ export type RelationshipFeatureProps = {
24
24
  */
25
25
  maxDepth?: number;
26
26
  } & ExclusiveRelationshipFeatureProps;
27
- export declare const RelationshipFeature: import("../../typesServer.js").FeatureProviderProviderServer<RelationshipFeatureProps, RelationshipFeatureProps, ExclusiveRelationshipFeatureProps>;
27
+ export type RelationshipFeatureServerProps = {
28
+ /** Collection policy resolved during feature initialization. */
29
+ enabledCollectionSlugs: CollectionSlug[];
30
+ } & RelationshipFeatureProps;
31
+ export type RelationshipFeatureClientProps = {
32
+ enabledCollectionSlugs: CollectionSlug[];
33
+ };
34
+ export declare const RelationshipFeature: import("../../typesServer.js").FeatureProviderProviderServer<RelationshipFeatureProps, RelationshipFeatureServerProps, RelationshipFeatureClientProps>;
28
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAU7C,YAAY,EAAE,gB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M,mBAAmB,wJA0F9B,CAAA"}
@@ -1,22 +1,30 @@
1
1
  import { populate } from '../../../populateGraphQL/populate.js';
2
2
  import { createServerFeature } from '../../../utilities/createServerFeature.js';
3
3
  import { createNode } from '../../typeUtilities.js';
4
+ import { filterEnabledRelationshipCollections } from '../shared/filterEnabledRelationshipCollections.js';
4
5
  import { relationshipPopulationPromiseHOC } from './graphQLPopulationPromise.js';
5
6
  import { i18n } from './i18n.js';
6
7
  import { RelationshipServerNode } from './nodes/RelationshipNode.js';
7
8
  import { createRelationshipNodeJSONSchema } from './schema.js';
8
9
  export const RelationshipFeature = createServerFeature({
9
10
  feature: ({
10
- props
11
+ config,
12
+ props: unsanitizedProps
11
13
  }) => {
12
- // we don't need to pass maxDepth to the client, it's only used on the server
13
- const {
14
- maxDepth,
15
- ...clientFeatureProps
16
- } = props ?? {};
14
+ const props = {
15
+ ...unsanitizedProps,
16
+ enabledCollectionSlugs: filterEnabledRelationshipCollections(config.collections, {
17
+ ...unsanitizedProps,
18
+ uploads: false
19
+ }).map(({
20
+ slug
21
+ }) => slug)
22
+ };
17
23
  return {
18
24
  ClientFeature: '@payloadcms/richtext-lexical/client#RelationshipFeatureClient',
19
- clientFeatureProps,
25
+ clientFeatureProps: {
26
+ enabledCollectionSlugs: props.enabledCollectionSlugs
27
+ },
20
28
  i18n,
21
29
  nodes: [createNode({
22
30
  graphQLPopulationPromises: [relationshipPopulationPromiseHOC(props)],
@@ -32,7 +40,7 @@ export const RelationshipFeature = createServerFeature({
32
40
  req,
33
41
  showHiddenFields
34
42
  }) => {
35
- if (!node?.value) {
43
+ if (!node?.value || !props.enabledCollectionSlugs.includes(node.relationTo)) {
36
44
  return node;
37
45
  }
38
46
  const collection = req.payload.collections[node?.relationTo];
@@ -42,7 +50,7 @@ export const RelationshipFeature = createServerFeature({
42
50
  // @ts-expect-error
43
51
  const id = node?.value?.id || node?.value // for backwards-compatibility
44
52
  ;
45
- const populateDepth = maxDepth !== undefined && maxDepth < depth ? maxDepth : depth;
53
+ const populateDepth = props.maxDepth !== undefined && props.maxDepth < depth ? props.maxDepth : depth;
46
54
  populationPromises.push(populate({
47
55
  id,
48
56
  collectionSlug: collection.config.slug,
@@ -60,8 +68,17 @@ export const RelationshipFeature = createServerFeature({
60
68
  }]
61
69
  },
62
70
  jsonSchema: createRelationshipNodeJSONSchema(props),
63
- node: RelationshipServerNode
64
- })]
71
+ node: RelationshipServerNode,
72
+ validations: [({
73
+ node,
74
+ validation: {
75
+ options: {
76
+ req
77
+ }
78
+ }
79
+ }) => props.enabledCollectionSlugs.includes(node.relationTo) ? true : req.t('validation:invalidSelection')]
80
+ })],
81
+ sanitizedServerFeatureProps: props
65
82
  };
66
83
  },
67
84
  key: 'relationship'
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["populate","createServerFeature","createNode","relationshipPopulationPromiseHOC","i18n","RelationshipServerNode","createRelationshipNodeJSONSchema","RelationshipFeature","feature","props","maxDepth","clientFeatureProps","ClientFeature","nodes","graphQLPopulationPromises","hooks","afterRead","currentDepth","depth","draft","node","overrideAccess","populateArg","populationPromises","req","showHiddenFields","value","collection","payload","collections","relationTo","id","populateDepth","undefined","push","collectionSlug","config","slug","data","key","select","defaultPopulate","jsonSchema"],"sources":["../../../../src/features/relationship/server/index.ts"],"sourcesContent":["import type { CollectionSlug } from 'payload'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { relationshipPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport { RelationshipServerNode } from './nodes/RelationshipNode.js'\nimport { createRelationshipNodeJSONSchema } from './schema.js'\n\nexport type { RelationshipData, SerializedRelationshipNode } from './schema.js'\n\nexport type ExclusiveRelationshipFeatureProps =\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?: CollectionSlug[]\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?: CollectionSlug[]\n }\n\nexport type RelationshipFeatureProps = {\n /**\n * Sets a maximum population depth for this relationship, 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} & ExclusiveRelationshipFeatureProps\n\nexport const RelationshipFeature = createServerFeature<\n RelationshipFeatureProps,\n RelationshipFeatureProps,\n ExclusiveRelationshipFeatureProps\n>({\n feature: ({ props }) => {\n // we don't need to pass maxDepth to the client, it's only used on the server\n const { maxDepth, ...clientFeatureProps } = props ?? {}\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#RelationshipFeatureClient',\n clientFeatureProps,\n i18n,\n nodes: [\n createNode({\n graphQLPopulationPromises: [relationshipPopulationPromiseHOC(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 // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n const populateDepth = maxDepth !== undefined && maxDepth < depth ? 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: createRelationshipNodeJSONSchema(props),\n node: RelationshipServerNode,\n }),\n ],\n }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IAAI;cACtCpB,YAAA;cACAqB,IAAA,EAAMlB,IAAA;cACNF,KAAA,EAAOc,aAAA;cACPb,KAAA;cACAoB,GAAA,EAAK;cACLlB,cAAA;cACAG,GAAA;cACAgB,MAAA,EACElB,WAAA,GAAcK,UAAA,CAAWS,MAAM,CAACC,IAAI,CAAC,IAAIV,UAAA,CAAWS,MAAM,CAACK,eAAe;cAC5EhB;YACF;YAGF,OAAOL,IAAA;UACT;QAEJ;QACAsB,UAAA,EAAYpC,gCAAA,CAAiCG,KAAA;QAC7CW,IAAA,EAAMf;MACR;IAEJ;EACF;EACAkC,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["populate","createServerFeature","createNode","filterEnabledRelationshipCollections","relationshipPopulationPromiseHOC","i18n","RelationshipServerNode","createRelationshipNodeJSONSchema","RelationshipFeature","feature","config","props","unsanitizedProps","enabledCollectionSlugs","collections","uploads","map","slug","ClientFeature","clientFeatureProps","nodes","graphQLPopulationPromises","hooks","afterRead","currentDepth","depth","draft","node","overrideAccess","populateArg","populationPromises","req","showHiddenFields","value","includes","relationTo","collection","payload","id","populateDepth","maxDepth","undefined","push","collectionSlug","data","key","select","defaultPopulate","jsonSchema","validations","validation","options","t","sanitizedServerFeatureProps"],"sources":["../../../../src/features/relationship/server/index.ts"],"sourcesContent":["import type { CollectionSlug } from 'payload'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { filterEnabledRelationshipCollections } from '../shared/filterEnabledRelationshipCollections.js'\nimport { relationshipPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport { RelationshipServerNode } from './nodes/RelationshipNode.js'\nimport { createRelationshipNodeJSONSchema } from './schema.js'\n\nexport type { RelationshipData, SerializedRelationshipNode } from './schema.js'\n\nexport type ExclusiveRelationshipFeatureProps =\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?: CollectionSlug[]\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?: CollectionSlug[]\n }\n\nexport type RelationshipFeatureProps = {\n /**\n * Sets a maximum population depth for this relationship, 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} & ExclusiveRelationshipFeatureProps\n\nexport type RelationshipFeatureServerProps = {\n /** Collection policy resolved during feature initialization. */\n enabledCollectionSlugs: CollectionSlug[]\n} & RelationshipFeatureProps\n\nexport type RelationshipFeatureClientProps = {\n enabledCollectionSlugs: CollectionSlug[]\n}\n\nexport const RelationshipFeature = createServerFeature<\n RelationshipFeatureProps,\n RelationshipFeatureServerProps,\n RelationshipFeatureClientProps\n>({\n feature: ({ config, props: unsanitizedProps }) => {\n const props: RelationshipFeatureServerProps = {\n ...unsanitizedProps,\n enabledCollectionSlugs: filterEnabledRelationshipCollections(config.collections, {\n ...unsanitizedProps,\n uploads: false,\n }).map(({ slug }) => slug),\n }\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#RelationshipFeatureClient',\n clientFeatureProps: {\n enabledCollectionSlugs: props.enabledCollectionSlugs,\n },\n i18n,\n nodes: [\n createNode({\n graphQLPopulationPromises: [relationshipPopulationPromiseHOC(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 // @ts-expect-error\n const id = node?.value?.id || 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: createRelationshipNodeJSONSchema(props),\n node: RelationshipServerNode,\n validations: [\n ({\n node,\n validation: {\n options: { req },\n },\n }) =>\n props.enabledCollectionSlugs.includes(node.relationTo)\n ? true\n : req.t('validation:invalidSelection'),\n ],\n }),\n ],\n sanitizedServerFeatureProps: props,\n }\n },\n key: 'relationship',\n})\n"],"mappings":"AAEA,SAASA,QAAQ,QAAQ;AACzB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,oCAAoC,QAAQ;AACrD,SAASC,gCAAgC,QAAQ;AACjD,SAASC,IAAI,QAAQ;AACrB,SAASC,sBAAsB,QAAQ;AACvC,SAASC,gCAAgC,QAAQ;AA6CjD,OAAO,MAAMC,mBAAA,GAAsBP,mBAAA,CAIjC;EACAQ,OAAA,EAASA,CAAC;IAAEC,MAAM;IAAEC,KAAA,EAAOC;EAAgB,CAAE;IAC3C,MAAMD,KAAA,GAAwC;MAC5C,GAAGC,gBAAgB;MACnBC,sBAAA,EAAwBV,oCAAA,CAAqCO,MAAA,CAAOI,WAAW,EAAE;QAC/E,GAAGF,gBAAgB;QACnBG,OAAA,EAAS;MACX,GAAGC,GAAG,CAAC,CAAC;QAAEC;MAAI,CAAE,KAAKA,IAAA;IACvB;IAEA,OAAO;MACLC,aAAA,EAAe;MACfC,kBAAA,EAAoB;QAClBN,sBAAA,EAAwBF,KAAA,CAAME;MAChC;MACAR,IAAA;MACAe,KAAA,EAAO,CACLl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AAMrB,sBAAA;QACN2C,WAAA,EAAa,CACX,CAAC;UACCtB,IAAI;UACJuB,UAAA,EAAY;YACVC,OAAA,EAAS;cAAEpB;YAAG;UAAE;QACjB,CACF,KACCpB,KAAA,CAAME,sBAAsB,CAACqB,QAAQ,CAACP,IAAA,CAAKQ,UAAU,IACjD,OACAJ,GAAA,CAAIqB,CAAC,CAAC;MAEhB,GACD;MACDC,2BAAA,EAA6B1C;IAC/B;EACF;EACAkC,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/server/nodes/RelationshipNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAEhF,OAAO,EAEL,KAAK,gBAAgB,EAErB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,OAAO,EACb,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAA;AAgBhF,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D,MAAM,EAAE,gBAAgB,CAAA;gBAEZ,EACV,IAAI,EACJ,MAAM,EACN,GAAG,GACJ,EAAE;QACD,IAAI,EAAE,gBAAgB,CAAA;QACtB,MAAM,CAAC,EAAE,iBAAiB,CAAA;QAC1B,GAAG,CAAC,EAAE,OAAO,CAAA;KACd;WAKe,KAAK,CAAC,IAAI,EAAE,sBAAsB,GAAG,sBAAsB;WAQ3D,OAAO,IAAI,MAAM;WAIjB,SAAS,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;WAiBpD,UAAU,CAAC,cAAc,EAAE,0BAA0B,GAAG,sBAAsB;IAc9F,MAAM,CAAC,QAAQ,IAAI,KAAK;IAIf,SAAS,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW;IAM7C,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;IAIpE,SAAS,IAAI,eAAe;IAa5B,UAAU,IAAI,0BAA0B;IASjD,OAAO,IAAI,gBAAgB;IAIlB,cAAc,IAAI,MAAM;IAIjC,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;CAItC;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,gBAAgB,GAAG,sBAAsB,CAM5F;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,sBAAsB,GAAG,SAAS,GAC5D,IAAI,IAAI,sBAAsB,CAEhC"}
1
+ {"version":3,"file":"RelationshipNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/server/nodes/RelationshipNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAEhF,OAAO,EAEL,KAAK,gBAAgB,EAErB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,OAAO,EACb,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAA;AAgBhF,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D,MAAM,EAAE,gBAAgB,CAAA;IAExB,YAAY,EACV,IAAI,EACJ,MAAM,EACN,GAAG,GACJ,EAAE;QACD,IAAI,EAAE,gBAAgB,CAAA;QACtB,MAAM,CAAC,EAAE,iBAAiB,CAAA;QAC1B,GAAG,CAAC,EAAE,OAAO,CAAA;KACd,EAGA;IAED,OAAgB,KAAK,CAAC,IAAI,EAAE,sBAAsB,GAAG,sBAAsB,CAM1E;IAED,OAAgB,OAAO,IAAI,MAAM,CAEhC;IAED,OAAgB,SAAS,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI,CAenE;IAED,OAAgB,UAAU,CAAC,cAAc,EAAE,0BAA0B,GAAG,sBAAsB,CAY7F;IAED,MAAM,CAAC,QAAQ,IAAI,KAAK,CAEvB;IAEQ,SAAS,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAIrD;IAEQ,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CAE5E;IAEQ,SAAS,IAAI,eAAe,CAWpC;IAEQ,UAAU,IAAI,0BAA0B,CAOhD;IAED,OAAO,IAAI,gBAAgB,CAE1B;IAEQ,cAAc,IAAI,MAAM,CAEhC;IAED,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAGpC;CACF;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,gBAAgB,GAAG,sBAAsB,CAM5F;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,sBAAsB,GAAG,SAAS,GAC5D,IAAI,IAAI,sBAAsB,CAEhC"}
@@ -1,11 +1,11 @@
1
- import type { CollectionSlug, DataFromCollectionSlug, UploadCollectionSlug } from 'payload';
1
+ import type { CollectionSlug, DataFromCollectionSlug, IDTypeForCollectionSlug, UploadCollectionSlug } from 'payload';
2
2
  import type { LexicalElementFormat } from '../../../types/nodeTypes.js';
3
3
  import type { JSONSchemaFn } from '../../typesServer.js';
4
- import type { RelationshipFeatureProps } from './index.js';
4
+ import type { RelationshipFeatureServerProps } from './index.js';
5
5
  export type RelationshipData = {
6
6
  [TCollectionSlug in CollectionSlug]: {
7
7
  relationTo: TCollectionSlug;
8
- value: DataFromCollectionSlug<TCollectionSlug> | number | string;
8
+ value: DataFromCollectionSlug<TCollectionSlug> | IDTypeForCollectionSlug<TCollectionSlug>;
9
9
  };
10
10
  }[CollectionSlug];
11
11
  /**
@@ -17,12 +17,12 @@ export type NonUploadCollectionSlug = [Exclude<CollectionSlug, UploadCollectionS
17
17
  export type SerializedRelationshipNode<TSlugs extends CollectionSlug = NonUploadCollectionSlug> = {
18
18
  [TSlug in TSlugs]: {
19
19
  relationTo: TSlug;
20
- value: DataFromCollectionSlug<TSlug> | number | string;
20
+ value: DataFromCollectionSlug<TSlug> | IDTypeForCollectionSlug<TSlug>;
21
21
  };
22
22
  }[TSlugs] & {
23
23
  format: LexicalElementFormat;
24
24
  type: 'relationship';
25
25
  version: number;
26
26
  };
27
- export declare const createRelationshipNodeJSONSchema: (props: RelationshipFeatureProps | undefined) => JSONSchemaFn;
27
+ export declare const createRelationshipNodeJSONSchema: (props: RelationshipFeatureServerProps) => JSONSchemaFn;
28
28
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/server/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAE3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAK1D,MAAM,MAAM,gBAAgB,GAAG;KAC5B,eAAe,IAAI,cAAc,GAAG;QACnC,UAAU,EAAE,eAAe,CAAA;QAC3B,KAAK,EAAE,sBAAsB,CAAC,eAAe,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;KACjE;CACF,CAAC,cAAc,CAAC,CAAA;AAEjB;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC,SAAS;IAC5F,KAAK;CACN,GACG,cAAc,GACd,OAAO,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAA;AAEjD,MAAM,MAAM,0BAA0B,CAAC,MAAM,SAAS,cAAc,GAAG,uBAAuB,IAAI;KAC/F,KAAK,IAAI,MAAM,GAAG;QACjB,UAAU,EAAE,KAAK,CAAA;QACjB,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;KACvD;CACF,CAAC,MAAM,CAAC,GAAG;IACV,MAAM,EAAE,oBAAoB,CAAA;IAC5B,IAAI,EAAE,cAAc,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAcD,eAAO,MAAM,gCAAgC,GAC1C,OAAO,wBAAwB,GAAG,SAAS,KAAG,YAkD9C,CAAA"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/server/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAA;AAIhE,MAAM,MAAM,gBAAgB,GAAG;KAC5B,eAAe,IAAI,cAAc,GAAG;QACnC,UAAU,EAAE,eAAe,CAAA;QAC3B,KAAK,EAAE,sBAAsB,CAAC,eAAe,CAAC,GAAG,uBAAuB,CAAC,eAAe,CAAC,CAAA;KAC1F;CACF,CAAC,cAAc,CAAC,CAAA;AAEjB;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC,SAAS;IAC5F,KAAK;CACN,GACG,cAAc,GACd,OAAO,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAA;AAEjD,MAAM,MAAM,0BAA0B,CAAC,MAAM,SAAS,cAAc,GAAG,uBAAuB,IAAI;KAC/F,KAAK,IAAI,MAAM,GAAG;QACjB,UAAU,EAAE,KAAK,CAAA;QACjB,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAA;KACtE;CACF,CAAC,MAAM,CAAC,GAAG;IACV,MAAM,EAAE,oBAAoB,CAAA;IAC5B,IAAI,EAAE,cAAc,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AA0BD,eAAO,MAAM,gCAAgC,UACnC,8BAA8B,KAAG,YAiDxC,CAAA"}
@@ -1,5 +1,4 @@
1
1
  import { formatSchema, versionSchema } from '../../../types/jsonSchemaHelpers.js';
2
- import { filterEnabledRelationshipCollections } from '../shared/filterEnabledRelationshipCollections.js';
3
2
  /** MUST stay byte-for-byte in sync with the runtime `SerializedRelationshipNode` declared above. */
4
3
  const SERIALIZED_RELATIONSHIP_NODE_TS = `export type SerializedRelationshipNode<TSlugs extends keyof Config['collections']> = {
5
4
  type: 'relationship';
@@ -8,22 +7,31 @@ const SERIALIZED_RELATIONSHIP_NODE_TS = `export type SerializedRelationshipNode<
8
7
  } & {
9
8
  [TSlug in TSlugs]: {
10
9
  relationTo: TSlug;
11
- value: number | string | Config['collections'][TSlug];
10
+ value: Config['collections'][TSlug]['id'] | Config['collections'][TSlug];
11
+ };
12
+ }[TSlugs];`;
13
+ /** Input variant of `SerializedRelationshipNode`: `value` is ID-only (you only ever write an ID). */
14
+ const SERIALIZED_RELATIONSHIP_NODE_INPUT_TS = `export type SerializedRelationshipNodeInput<TSlugs extends keyof Config['collections']> = {
15
+ type: 'relationship';
16
+ format: LexicalElementFormat;
17
+ version: number;
18
+ } & {
19
+ [TSlug in TSlugs]: {
20
+ relationTo: TSlug;
21
+ value: Config['collections'][TSlug]['id'];
12
22
  };
13
23
  }[TSlugs];`;
14
24
  export const createRelationshipNodeJSONSchema = props => ({
15
25
  collectionIDFieldTypes,
16
- config,
17
- typeStringDefinitions
26
+ typeStringDefinitions,
27
+ variant
18
28
  }) => {
19
- typeStringDefinitions.add(SERIALIZED_RELATIONSHIP_NODE_TS);
20
- const enabledCollections = config?.collections ? filterEnabledRelationshipCollections(config.collections, {
21
- disabledCollections: props?.disabledCollections,
22
- enabledCollections: props?.enabledCollections,
23
- uploads: false
24
- }) : [];
25
- const variants = enabledCollections.map(collection => {
26
- const slug = collection.slug;
29
+ const isInput = variant === 'input';
30
+ typeStringDefinitions.add(isInput ? SERIALIZED_RELATIONSHIP_NODE_INPUT_TS : SERIALIZED_RELATIONSHIP_NODE_TS);
31
+ const {
32
+ enabledCollectionSlugs
33
+ } = props;
34
+ const variants = enabledCollectionSlugs.map(slug => {
27
35
  const idType = collectionIDFieldTypes[slug] ?? 'string';
28
36
  return {
29
37
  type: 'object',
@@ -38,7 +46,10 @@ export const createRelationshipNodeJSONSchema = props => ({
38
46
  type: 'string',
39
47
  const: slug
40
48
  },
41
- value: {
49
+ value: isInput ? {
50
+ type: idType,
51
+ description: 'The related document ID.'
52
+ } : {
42
53
  description: 'The related document by ID (string or number). Populated to the full document when read at depth > 0.',
43
54
  oneOf: [{
44
55
  type: idType
@@ -66,13 +77,14 @@ export const createRelationshipNodeJSONSchema = props => ({
66
77
  required: ['type', 'version']
67
78
  };
68
79
  } else {
69
- const slugUnion = enabledCollections.map(c => `'${c.slug}'`).join(' | ');
80
+ const slugUnion = enabledCollectionSlugs.map(slug => `'${slug}'`).join(' | ');
70
81
  const baseSchema = variants.length === 1 ? variants[0] : {
71
82
  oneOf: variants
72
83
  };
84
+ const tsName = isInput ? 'SerializedRelationshipNodeInput' : 'SerializedRelationshipNode';
73
85
  schema = {
74
86
  ...baseSchema,
75
- tsType: `SerializedRelationshipNode<${slugUnion}>`
87
+ tsType: `${tsName}<${slugUnion}>`
76
88
  };
77
89
  }
78
90
  return schema;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","names":["formatSchema","versionSchema","filterEnabledRelationshipCollections","SERIALIZED_RELATIONSHIP_NODE_TS","createRelationshipNodeJSONSchema","props","collectionIDFieldTypes","config","typeStringDefinitions","add","enabledCollections","collections","disabledCollections","uploads","variants","map","collection","slug","idType","type","additionalProperties","properties","const","format","relationTo","value","description","oneOf","$ref","version","required","schema","length","slugUnion","c","join","baseSchema","tsType"],"sources":["../../../../src/features/relationship/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type { CollectionSlug, DataFromCollectionSlug, UploadCollectionSlug } from 'payload'\n\nimport type { LexicalElementFormat } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaFn } from '../../typesServer.js'\nimport type { RelationshipFeatureProps } from './index.js'\n\nimport { formatSchema, versionSchema } from '../../../types/jsonSchemaHelpers.js'\nimport { filterEnabledRelationshipCollections } from '../shared/filterEnabledRelationshipCollections.js'\n\nexport type RelationshipData = {\n [TCollectionSlug in CollectionSlug]: {\n relationTo: TCollectionSlug\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[CollectionSlug]\n\n/**\n * Exclude upload collection slugs. This matches runtime behavior, as well as the json schema.\n */\nexport type NonUploadCollectionSlug = [Exclude<CollectionSlug, UploadCollectionSlug>] extends [\n never,\n]\n ? CollectionSlug\n : Exclude<CollectionSlug, UploadCollectionSlug>\n\nexport type SerializedRelationshipNode<TSlugs extends CollectionSlug = NonUploadCollectionSlug> = {\n [TSlug in TSlugs]: {\n relationTo: TSlug\n value: DataFromCollectionSlug<TSlug> | number | string\n }\n}[TSlugs] & {\n format: LexicalElementFormat\n type: 'relationship'\n version: number\n}\n\n/** MUST stay byte-for-byte in sync with the runtime `SerializedRelationshipNode` declared above. */\nconst SERIALIZED_RELATIONSHIP_NODE_TS = `export type SerializedRelationshipNode<TSlugs extends keyof Config['collections']> = {\n type: 'relationship';\n format: LexicalElementFormat;\n version: number;\n} & {\n [TSlug in TSlugs]: {\n relationTo: TSlug;\n value: number | string | Config['collections'][TSlug];\n };\n}[TSlugs];`\n\nexport const createRelationshipNodeJSONSchema =\n (props: RelationshipFeatureProps | undefined): JSONSchemaFn =>\n ({ collectionIDFieldTypes, config, typeStringDefinitions }) => {\n typeStringDefinitions.add(SERIALIZED_RELATIONSHIP_NODE_TS)\n const enabledCollections = config?.collections\n ? filterEnabledRelationshipCollections(config.collections, {\n disabledCollections: props?.disabledCollections,\n enabledCollections: props?.enabledCollections,\n uploads: false,\n })\n : []\n\n const variants: JSONSchema4[] = enabledCollections.map((collection) => {\n const slug = collection.slug\n const idType: 'number' | 'string' = collectionIDFieldTypes[slug] ?? 'string'\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'relationship' },\n format: formatSchema,\n relationTo: { type: 'string', const: slug },\n value: {\n description:\n 'The related document by ID (string or number). Populated to the full document when read at depth > 0.',\n oneOf: [{ type: idType }, { $ref: `#/$defs/${slug}` }],\n },\n version: versionSchema,\n },\n required: ['format', 'relationTo', 'type', 'value', 'version'],\n }\n })\n\n let schema: JSONSchema4\n if (variants.length === 0) {\n schema = {\n type: 'object',\n additionalProperties: true,\n properties: {\n type: { type: 'string', const: 'relationship' },\n version: versionSchema,\n },\n required: ['type', 'version'],\n }\n } else {\n const slugUnion = enabledCollections.map((c) => `'${c.slug}'`).join(' | ')\n const baseSchema: JSONSchema4 = variants.length === 1 ? variants[0]! : { oneOf: variants }\n schema = { ...baseSchema, tsType: `SerializedRelationshipNode<${slugUnion}>` }\n }\n\n return schema\n }\n"],"mappings":"AAOA,SAASA,YAAY,EAAEC,aAAa,QAAQ;AAC5C,SAASC,oCAAoC,QAAQ;AA6BrD;AACA,MAAMC,+BAAA,GAAkC;;;;;;;;;WAS7B;AAEX,OAAO,MAAMC,gCAAA,GACVC,KAAA,IACD,CAAC;EAAEC,sBAAsB;EAAEC,MAAM;EAAEC;AAAqB,CAAE;EACxDA,qBAAA,CAAsBC,GAAG,CAACN,+BAAA;EAC1B,MAAMO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CAAC;IACpE,MAAMC,UAAA,GAA0BtB,QAAA,CAASkB,MAAM,KAAK,IAAIlB,QAAQ,CAAC,EAAE,GAAI;MAAEa,KAAA,EAAOb;IAAS;IACzFiB,MAAA,GAAS;MAAE,GAAGK,UAAU;MAAEC,MAAA,EAAQ,8BAA8BJ,SAAA;IAAa;EAC/E;EAEA,OAAOF,MAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"schema.js","names":["formatSchema","versionSchema","SERIALIZED_RELATIONSHIP_NODE_TS","SERIALIZED_RELATIONSHIP_NODE_INPUT_TS","createRelationshipNodeJSONSchema","props","collectionIDFieldTypes","typeStringDefinitions","variant","isInput","add","enabledCollectionSlugs","variants","map","slug","idType","type","additionalProperties","properties","const","format","relationTo","value","description","oneOf","$ref","version","required","schema","length","slugUnion","join","baseSchema","tsName","tsType"],"sources":["../../../../src/features/relationship/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type {\n CollectionSlug,\n DataFromCollectionSlug,\n IDTypeForCollectionSlug,\n UploadCollectionSlug,\n} from 'payload'\n\nimport type { LexicalElementFormat } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaFn } from '../../typesServer.js'\nimport type { RelationshipFeatureServerProps } from './index.js'\n\nimport { formatSchema, versionSchema } from '../../../types/jsonSchemaHelpers.js'\n\nexport type RelationshipData = {\n [TCollectionSlug in CollectionSlug]: {\n relationTo: TCollectionSlug\n value: DataFromCollectionSlug<TCollectionSlug> | IDTypeForCollectionSlug<TCollectionSlug>\n }\n}[CollectionSlug]\n\n/**\n * Exclude upload collection slugs. This matches runtime behavior, as well as the json schema.\n */\nexport type NonUploadCollectionSlug = [Exclude<CollectionSlug, UploadCollectionSlug>] extends [\n never,\n]\n ? CollectionSlug\n : Exclude<CollectionSlug, UploadCollectionSlug>\n\nexport type SerializedRelationshipNode<TSlugs extends CollectionSlug = NonUploadCollectionSlug> = {\n [TSlug in TSlugs]: {\n relationTo: TSlug\n value: DataFromCollectionSlug<TSlug> | IDTypeForCollectionSlug<TSlug>\n }\n}[TSlugs] & {\n format: LexicalElementFormat\n type: 'relationship'\n version: number\n}\n\n/** MUST stay byte-for-byte in sync with the runtime `SerializedRelationshipNode` declared above. */\nconst SERIALIZED_RELATIONSHIP_NODE_TS = `export type SerializedRelationshipNode<TSlugs extends keyof Config['collections']> = {\n type: 'relationship';\n format: LexicalElementFormat;\n version: number;\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 `SerializedRelationshipNode`: `value` is ID-only (you only ever write an ID). */\nconst SERIALIZED_RELATIONSHIP_NODE_INPUT_TS = `export type SerializedRelationshipNodeInput<TSlugs extends keyof Config['collections']> = {\n type: 'relationship';\n format: LexicalElementFormat;\n version: number;\n} & {\n [TSlug in TSlugs]: {\n relationTo: TSlug;\n value: Config['collections'][TSlug]['id'];\n };\n}[TSlugs];`\n\nexport const createRelationshipNodeJSONSchema =\n (props: RelationshipFeatureServerProps): JSONSchemaFn =>\n ({ collectionIDFieldTypes, typeStringDefinitions, variant }) => {\n const isInput = variant === 'input'\n typeStringDefinitions.add(\n isInput ? SERIALIZED_RELATIONSHIP_NODE_INPUT_TS : SERIALIZED_RELATIONSHIP_NODE_TS,\n )\n const { enabledCollectionSlugs } = props\n\n const variants: JSONSchema4[] = enabledCollectionSlugs.map((slug) => {\n const idType: 'number' | 'string' = collectionIDFieldTypes[slug] ?? 'string'\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'relationship' },\n format: formatSchema,\n relationTo: { type: 'string', const: slug },\n value: isInput\n ? { type: idType, description: 'The related document ID.' }\n : {\n description:\n 'The related document by ID (string or number). Populated to the full document when read at depth > 0.',\n oneOf: [{ type: idType }, { $ref: `#/$defs/${slug}` }],\n },\n version: versionSchema,\n },\n required: ['format', 'relationTo', 'type', 'value', 'version'],\n }\n })\n\n let schema: JSONSchema4\n if (variants.length === 0) {\n schema = {\n type: 'object',\n additionalProperties: true,\n properties: {\n type: { type: 'string', const: 'relationship' },\n version: versionSchema,\n },\n required: ['type', 'version'],\n }\n } else {\n const slugUnion = enabledCollectionSlugs.map((slug) => `'${slug}'`).join(' | ')\n const baseSchema: JSONSchema4 = variants.length === 1 ? variants[0]! : { oneOf: variants }\n const tsName = isInput ? 'SerializedRelationshipNodeInput' : 'SerializedRelationshipNode'\n schema = { ...baseSchema, tsType: `${tsName}<${slugUnion}>` }\n }\n\n return schema\n }\n"],"mappings":"AAYA,SAASA,YAAY,EAAEC,aAAa,QAAQ;AA6B5C;AACA,MAAMC,+BAAA,GAAkC;;;;;;;;;WAS7B;AAEX;AACA,MAAMC,qCAAA,GAAwC;;;;;;;;;WASnC;AAEX,OAAO,MAAMC,gCAAA,GACVC,KAAA,IACD,CAAC;EAAEC,sBAAsB;EAAEC,qBAAqB;EAAEC;AAAO,CAAE;EACzD,MAAMC,OAAA,GAAUD,OAAA,KAAY;EAC5BD,qBAAA,CAAsBG,GAAG,CACvBD,OAAA,GAAUN,qCAAA,GAAwCD,+BAAA;EAEpD,MAAM;IAAES;EAAsB,CAAE,GAAGN,KAAA;EAEnC,MAAMO,QAAA,GAA0BD,sBAAA,CAAuBE,GAAG,CAAEC,IAAA;IAC1D,MAAMC,MAAA,GAA8BT,sBAAsB,CAACQ,IAAA,CAAK,IAAI;IACpE,OAAO;MACLE,IAAA,EAAM;MACNC,oBAAA,EAAsB;MACtBC,UAAA,EAAY;QACVF,IAAA,EAAM;UAAEA,IAAA,EAAM;UAAUG,KAAA,EAAO;QAAe;QAC9CC,MAAA,EAAQpB,YAAA;QACRqB,UAAA,EAAY;UAAEL,IAAA,EAAM;UAAUG,KAAA,EAAOL;QAAK;QAC1CQ,KAAA,EAAOb,OAAA,GACH;UAAEO,IAAA,EAAMD,MAAA;UAAQQ,WAAA,EAAa;QAA2B,IACxD;UACEA,WAAA,EACE;UACFC,KAAA,EAAO,CAAC;YAAER,IAAA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