@payloadcms/richtext-lexical 3.0.0-beta.3 → 3.0.0-beta.31

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 (666) hide show
  1. package/dist/cell/index.d.ts +1 -1
  2. package/dist/cell/index.d.ts.map +1 -1
  3. package/dist/cell/index.js +2 -4
  4. package/dist/cell/index.js.map +1 -1
  5. package/dist/exports/components.d.ts +8 -2
  6. package/dist/exports/components.d.ts.map +1 -1
  7. package/dist/exports/components.js +8 -2
  8. package/dist/exports/components.js.map +1 -1
  9. package/dist/field/Field.d.ts +0 -2
  10. package/dist/field/Field.d.ts.map +1 -1
  11. package/dist/field/Field.js.map +1 -1
  12. package/dist/field/features/align/feature.client.d.ts +4 -1
  13. package/dist/field/features/align/feature.client.d.ts.map +1 -1
  14. package/dist/field/features/align/feature.client.js +127 -54
  15. package/dist/field/features/align/feature.client.js.map +1 -1
  16. package/dist/field/features/align/toolbarAlignGroup.d.ts +3 -0
  17. package/dist/field/features/align/toolbarAlignGroup.d.ts.map +1 -0
  18. package/dist/field/features/align/toolbarAlignGroup.js +12 -0
  19. package/dist/field/features/align/toolbarAlignGroup.js.map +1 -0
  20. package/dist/field/features/blockquote/feature.client.d.ts +4 -1
  21. package/dist/field/features/blockquote/feature.client.d.ts.map +1 -1
  22. package/dist/field/features/blockquote/feature.client.js +53 -40
  23. package/dist/field/features/blockquote/feature.client.js.map +1 -1
  24. package/dist/field/features/blockquote/feature.server.d.ts +1 -1
  25. package/dist/field/features/blockquote/feature.server.d.ts.map +1 -1
  26. package/dist/field/features/blockquote/feature.server.js +7 -7
  27. package/dist/field/features/blockquote/feature.server.js.map +1 -1
  28. package/dist/field/features/blockquote/markdownTransformer.d.ts.map +1 -1
  29. package/dist/field/features/blockquote/markdownTransformer.js +2 -4
  30. package/dist/field/features/blockquote/markdownTransformer.js.map +1 -1
  31. package/dist/field/features/blocks/component/BlockContent.d.ts.map +1 -1
  32. package/dist/field/features/blocks/component/BlockContent.js +3 -5
  33. package/dist/field/features/blocks/component/BlockContent.js.map +1 -1
  34. package/dist/field/features/blocks/component/index.d.ts.map +1 -1
  35. package/dist/field/features/blocks/component/index.js +37 -4
  36. package/dist/field/features/blocks/component/index.js.map +1 -1
  37. package/dist/field/features/blocks/drawer/index.d.ts.map +1 -1
  38. package/dist/field/features/blocks/drawer/index.js +2 -4
  39. package/dist/field/features/blocks/drawer/index.js.map +1 -1
  40. package/dist/field/features/blocks/feature.client.d.ts +4 -1
  41. package/dist/field/features/blocks/feature.client.d.ts.map +1 -1
  42. package/dist/field/features/blocks/feature.client.js +56 -27
  43. package/dist/field/features/blocks/feature.client.js.map +1 -1
  44. package/dist/field/features/blocks/feature.server.d.ts +2 -5
  45. package/dist/field/features/blocks/feature.server.d.ts.map +1 -1
  46. package/dist/field/features/blocks/feature.server.js +109 -77
  47. package/dist/field/features/blocks/feature.server.js.map +1 -1
  48. package/dist/field/features/blocks/nodes/BlocksNode.d.ts +1 -3
  49. package/dist/field/features/blocks/nodes/BlocksNode.d.ts.map +1 -1
  50. package/dist/field/features/blocks/nodes/BlocksNode.js +1 -2
  51. package/dist/field/features/blocks/nodes/BlocksNode.js.map +1 -1
  52. package/dist/field/features/blocks/plugin/commands.d.ts.map +1 -1
  53. package/dist/field/features/blocks/plugin/commands.js +1 -2
  54. package/dist/field/features/blocks/plugin/commands.js.map +1 -1
  55. package/dist/field/features/blocks/plugin/index.d.ts +3 -2
  56. package/dist/field/features/blocks/plugin/index.d.ts.map +1 -1
  57. package/dist/field/features/blocks/plugin/index.js +5 -8
  58. package/dist/field/features/blocks/plugin/index.js.map +1 -1
  59. package/dist/field/features/blocks/populationPromise.d.ts.map +1 -1
  60. package/dist/field/features/blocks/populationPromise.js +4 -18
  61. package/dist/field/features/blocks/populationPromise.js.map +1 -1
  62. package/dist/field/features/blocks/validate.d.ts.map +1 -1
  63. package/dist/field/features/blocks/validate.js +22 -36
  64. package/dist/field/features/blocks/validate.js.map +1 -1
  65. package/dist/field/features/converters/html/field/index.d.ts +8 -2
  66. package/dist/field/features/converters/html/field/index.d.ts.map +1 -1
  67. package/dist/field/features/converters/html/field/index.js +6 -3
  68. package/dist/field/features/converters/html/field/index.js.map +1 -1
  69. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.d.ts +4 -1
  70. package/dist/field/features/debug/testRecorder/feature.client.d.ts.map +1 -0
  71. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.js.map +1 -1
  72. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.d.ts.map +1 -1
  73. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.js +1 -1
  74. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.js.map +1 -1
  75. package/dist/field/features/debug/testRecorder/plugin/index.d.ts +5 -0
  76. package/dist/field/features/debug/testRecorder/plugin/index.d.ts.map +1 -0
  77. package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.js +2 -4
  78. package/dist/field/features/debug/testRecorder/plugin/index.js.map +1 -0
  79. package/dist/field/features/debug/{treeview → treeView}/feature.client.d.ts +4 -1
  80. package/dist/field/features/debug/treeView/feature.client.d.ts.map +1 -0
  81. package/dist/field/features/debug/{treeview → treeView}/feature.client.js.map +1 -1
  82. package/dist/field/features/debug/{treeview → treeView}/feature.server.d.ts.map +1 -1
  83. package/dist/field/features/debug/{treeview → treeView}/feature.server.js +1 -1
  84. package/dist/field/features/debug/{treeview → treeView}/feature.server.js.map +1 -1
  85. package/dist/field/features/debug/treeView/plugin/index.d.ts +4 -0
  86. package/dist/field/features/debug/treeView/plugin/index.d.ts.map +1 -0
  87. package/dist/field/features/debug/{treeview → treeView}/plugin/index.js +4 -6
  88. package/dist/field/features/debug/treeView/plugin/index.js.map +1 -0
  89. package/dist/field/features/format/bold/feature.client.d.ts +4 -1
  90. package/dist/field/features/format/bold/feature.client.d.ts.map +1 -1
  91. package/dist/field/features/format/bold/feature.client.js +26 -23
  92. package/dist/field/features/format/bold/feature.client.js.map +1 -1
  93. package/dist/field/features/format/{inlinecode → inlineCode}/feature.client.d.ts +4 -1
  94. package/dist/field/features/format/inlineCode/feature.client.d.ts.map +1 -0
  95. package/dist/field/features/format/inlineCode/feature.client.js +46 -0
  96. package/dist/field/features/format/inlineCode/feature.client.js.map +1 -0
  97. package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.d.ts.map +1 -1
  98. package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.js +1 -1
  99. package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.js.map +1 -1
  100. package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.d.ts.map +1 -1
  101. package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.js.map +1 -1
  102. package/dist/field/features/format/italic/feature.client.d.ts +4 -1
  103. package/dist/field/features/format/italic/feature.client.d.ts.map +1 -1
  104. package/dist/field/features/format/italic/feature.client.js +27 -24
  105. package/dist/field/features/format/italic/feature.client.js.map +1 -1
  106. package/dist/field/features/format/shared/toolbarFormatGroup.d.ts +3 -0
  107. package/dist/field/features/format/shared/toolbarFormatGroup.d.ts.map +1 -0
  108. package/dist/field/features/format/shared/toolbarFormatGroup.js +10 -0
  109. package/dist/field/features/format/shared/toolbarFormatGroup.js.map +1 -0
  110. package/dist/field/features/format/strikethrough/feature.client.d.ts +4 -1
  111. package/dist/field/features/format/strikethrough/feature.client.d.ts.map +1 -1
  112. package/dist/field/features/format/strikethrough/feature.client.js +27 -24
  113. package/dist/field/features/format/strikethrough/feature.client.js.map +1 -1
  114. package/dist/field/features/format/subscript/feature.client.d.ts +4 -1
  115. package/dist/field/features/format/subscript/feature.client.d.ts.map +1 -1
  116. package/dist/field/features/format/subscript/feature.client.js +25 -22
  117. package/dist/field/features/format/subscript/feature.client.js.map +1 -1
  118. package/dist/field/features/format/superscript/feature.client.d.ts +4 -1
  119. package/dist/field/features/format/superscript/feature.client.d.ts.map +1 -1
  120. package/dist/field/features/format/superscript/feature.client.js +25 -22
  121. package/dist/field/features/format/superscript/feature.client.js.map +1 -1
  122. package/dist/field/features/format/underline/feature.client.d.ts +4 -1
  123. package/dist/field/features/format/underline/feature.client.d.ts.map +1 -1
  124. package/dist/field/features/format/underline/feature.client.js +25 -22
  125. package/dist/field/features/format/underline/feature.client.js.map +1 -1
  126. package/dist/field/features/heading/feature.client.d.ts +4 -1
  127. package/dist/field/features/heading/feature.client.d.ts.map +1 -1
  128. package/dist/field/features/heading/feature.client.js +71 -54
  129. package/dist/field/features/heading/feature.client.js.map +1 -1
  130. package/dist/field/features/heading/feature.server.d.ts.map +1 -1
  131. package/dist/field/features/heading/feature.server.js +5 -5
  132. package/dist/field/features/heading/feature.server.js.map +1 -1
  133. package/dist/field/features/heading/markdownTransformer.d.ts.map +1 -1
  134. package/dist/field/features/heading/markdownTransformer.js +1 -2
  135. package/dist/field/features/heading/markdownTransformer.js.map +1 -1
  136. package/dist/field/features/horizontalRule/component/index.d.ts +10 -0
  137. package/dist/field/features/horizontalRule/component/index.d.ts.map +1 -0
  138. package/dist/field/features/horizontalRule/component/index.js +62 -0
  139. package/dist/field/features/horizontalRule/component/index.js.map +1 -0
  140. package/dist/field/features/horizontalRule/feature.client.d.ts +6 -0
  141. package/dist/field/features/horizontalRule/feature.client.d.ts.map +1 -0
  142. package/dist/field/features/horizontalRule/feature.client.js +76 -0
  143. package/dist/field/features/horizontalRule/feature.client.js.map +1 -0
  144. package/dist/field/features/horizontalRule/feature.server.d.ts +3 -0
  145. package/dist/field/features/horizontalRule/feature.server.d.ts.map +1 -0
  146. package/dist/field/features/horizontalRule/feature.server.js +36 -0
  147. package/dist/field/features/horizontalRule/feature.server.js.map +1 -0
  148. package/dist/field/features/horizontalRule/markdownTransformer.d.ts +3 -0
  149. package/dist/field/features/horizontalRule/markdownTransformer.d.ts.map +1 -0
  150. package/dist/field/features/horizontalRule/markdownTransformer.js +23 -0
  151. package/dist/field/features/horizontalRule/markdownTransformer.js.map +1 -0
  152. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.d.ts +53 -0
  153. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.d.ts.map +1 -0
  154. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.js +88 -0
  155. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.js.map +1 -0
  156. package/dist/field/features/horizontalRule/plugin/index.d.ts +7 -0
  157. package/dist/field/features/horizontalRule/plugin/index.d.ts.map +1 -0
  158. package/dist/field/features/horizontalRule/plugin/index.js +31 -0
  159. package/dist/field/features/horizontalRule/plugin/index.js.map +1 -0
  160. package/dist/field/features/horizontalRule/plugin/index.scss +20 -0
  161. package/dist/field/features/indent/feature.client.d.ts +4 -1
  162. package/dist/field/features/indent/feature.client.d.ts.map +1 -1
  163. package/dist/field/features/indent/feature.client.js +43 -42
  164. package/dist/field/features/indent/feature.client.js.map +1 -1
  165. package/dist/field/features/indent/toolbarIndentGroup.d.ts +3 -0
  166. package/dist/field/features/indent/toolbarIndentGroup.d.ts.map +1 -0
  167. package/dist/field/features/indent/toolbarIndentGroup.js +10 -0
  168. package/dist/field/features/indent/toolbarIndentGroup.js.map +1 -0
  169. package/dist/field/features/link/drawer/baseFields.d.ts +2 -2
  170. package/dist/field/features/link/drawer/baseFields.d.ts.map +1 -1
  171. package/dist/field/features/link/drawer/baseFields.js +30 -43
  172. package/dist/field/features/link/drawer/baseFields.js.map +1 -1
  173. package/dist/field/features/link/drawer/index.js +3 -2
  174. package/dist/field/features/link/drawer/index.js.map +1 -1
  175. package/dist/field/features/link/drawer/types.d.ts +4 -2
  176. package/dist/field/features/link/drawer/types.d.ts.map +1 -1
  177. package/dist/field/features/link/drawer/types.js.map +1 -1
  178. package/dist/field/features/link/feature.client.d.ts +13 -1
  179. package/dist/field/features/link/feature.client.d.ts.map +1 -1
  180. package/dist/field/features/link/feature.client.js +59 -47
  181. package/dist/field/features/link/feature.client.js.map +1 -1
  182. package/dist/field/features/link/feature.server.d.ts +10 -5
  183. package/dist/field/features/link/feature.server.d.ts.map +1 -1
  184. package/dist/field/features/link/feature.server.js +48 -9
  185. package/dist/field/features/link/feature.server.js.map +1 -1
  186. package/dist/field/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  187. package/dist/field/features/link/nodes/AutoLinkNode.js +1 -2
  188. package/dist/field/features/link/nodes/AutoLinkNode.js.map +1 -1
  189. package/dist/field/features/link/nodes/LinkNode.d.ts +1 -3
  190. package/dist/field/features/link/nodes/LinkNode.d.ts.map +1 -1
  191. package/dist/field/features/link/nodes/LinkNode.js +2 -4
  192. package/dist/field/features/link/nodes/LinkNode.js.map +1 -1
  193. package/dist/field/features/link/plugins/autoLink/index.d.ts +3 -2
  194. package/dist/field/features/link/plugins/autoLink/index.d.ts.map +1 -1
  195. package/dist/field/features/link/plugins/autoLink/index.js +5 -8
  196. package/dist/field/features/link/plugins/autoLink/index.js.map +1 -1
  197. package/dist/field/features/link/plugins/clickableLink/index.d.ts +3 -2
  198. package/dist/field/features/link/plugins/clickableLink/index.d.ts.map +1 -1
  199. package/dist/field/features/link/plugins/clickableLink/index.js +2 -2
  200. package/dist/field/features/link/plugins/clickableLink/index.js.map +1 -1
  201. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/commands.d.ts.map +1 -1
  202. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/commands.js +1 -2
  203. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/commands.js.map +1 -1
  204. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  205. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js +93 -69
  206. package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  207. package/dist/field/features/link/plugins/floatingLinkEditor/index.d.ts +3 -4
  208. package/dist/field/features/link/plugins/floatingLinkEditor/index.d.ts.map +1 -1
  209. package/dist/field/features/link/plugins/floatingLinkEditor/index.js.map +1 -1
  210. package/dist/field/features/link/plugins/floatingLinkEditor/index.scss +11 -3
  211. package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts +1 -3
  212. package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts.map +1 -1
  213. package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js +12 -30
  214. package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js.map +1 -1
  215. package/dist/field/features/link/plugins/link/index.d.ts +3 -1
  216. package/dist/field/features/link/plugins/link/index.d.ts.map +1 -1
  217. package/dist/field/features/link/plugins/link/index.js +5 -14
  218. package/dist/field/features/link/plugins/link/index.js.map +1 -1
  219. package/dist/field/features/link/populationPromise.d.ts.map +1 -1
  220. package/dist/field/features/link/populationPromise.js +10 -25
  221. package/dist/field/features/link/populationPromise.js.map +1 -1
  222. package/dist/field/features/link/validate.d.ts +5 -0
  223. package/dist/field/features/link/validate.d.ts.map +1 -0
  224. package/dist/field/features/link/validate.js +32 -0
  225. package/dist/field/features/link/validate.js.map +1 -0
  226. package/dist/field/features/lists/checklist/feature.client.d.ts +4 -1
  227. package/dist/field/features/lists/checklist/feature.client.d.ts.map +1 -1
  228. package/dist/field/features/lists/checklist/feature.client.js +56 -32
  229. package/dist/field/features/lists/checklist/feature.client.js.map +1 -1
  230. package/dist/field/features/lists/checklist/feature.server.d.ts +1 -1
  231. package/dist/field/features/lists/checklist/feature.server.d.ts.map +1 -1
  232. package/dist/field/features/lists/checklist/feature.server.js +10 -10
  233. package/dist/field/features/lists/checklist/feature.server.js.map +1 -1
  234. package/dist/field/features/lists/checklist/markdownTransformers.d.ts.map +1 -1
  235. package/dist/field/features/lists/checklist/markdownTransformers.js +2 -3
  236. package/dist/field/features/lists/checklist/markdownTransformers.js.map +1 -1
  237. package/dist/field/features/lists/checklist/plugin/index.d.ts +2 -2
  238. package/dist/field/features/lists/checklist/plugin/index.d.ts.map +1 -1
  239. package/dist/field/features/lists/checklist/plugin/index.js +3 -4
  240. package/dist/field/features/lists/checklist/plugin/index.js.map +1 -1
  241. package/dist/field/features/lists/htmlConverter.d.ts.map +1 -1
  242. package/dist/field/features/lists/htmlConverter.js +13 -6
  243. package/dist/field/features/lists/htmlConverter.js.map +1 -1
  244. package/dist/field/features/lists/{orderedlist → orderedList}/feature.client.d.ts +4 -1
  245. package/dist/field/features/lists/orderedList/feature.client.d.ts.map +1 -0
  246. package/dist/field/features/lists/orderedList/feature.client.js +96 -0
  247. package/dist/field/features/lists/orderedList/feature.client.js.map +1 -0
  248. package/dist/field/features/lists/orderedList/feature.server.d.ts.map +1 -0
  249. package/dist/field/features/lists/{orderedlist → orderedList}/feature.server.js +7 -7
  250. package/dist/field/features/lists/orderedList/feature.server.js.map +1 -0
  251. package/dist/field/features/lists/orderedList/markdownTransformer.d.ts.map +1 -0
  252. package/dist/field/features/lists/{orderedlist → orderedList}/markdownTransformer.js +2 -3
  253. package/dist/field/features/lists/orderedList/markdownTransformer.js.map +1 -0
  254. package/dist/field/features/lists/plugin/index.d.ts +2 -2
  255. package/dist/field/features/lists/plugin/index.d.ts.map +1 -1
  256. package/dist/field/features/lists/plugin/index.js +3 -4
  257. package/dist/field/features/lists/plugin/index.js.map +1 -1
  258. package/dist/field/features/lists/{common → shared}/markdown.d.ts.map +1 -1
  259. package/dist/field/features/lists/{common → shared}/markdown.js +1 -2
  260. package/dist/field/features/lists/shared/markdown.js.map +1 -0
  261. package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.client.d.ts +4 -1
  262. package/dist/field/features/lists/unorderedList/feature.client.d.ts.map +1 -0
  263. package/dist/field/features/lists/unorderedList/feature.client.js +96 -0
  264. package/dist/field/features/lists/unorderedList/feature.client.js.map +1 -0
  265. package/dist/field/features/lists/unorderedList/feature.server.d.ts.map +1 -0
  266. package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.server.js +7 -7
  267. package/dist/field/features/lists/unorderedList/feature.server.js.map +1 -0
  268. package/dist/field/features/lists/unorderedList/markdownTransformer.d.ts.map +1 -0
  269. package/dist/field/features/lists/{unorderedlist → unorderedList}/markdownTransformer.js +2 -3
  270. package/dist/field/features/lists/unorderedList/markdownTransformer.js.map +1 -0
  271. package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.d.ts.map +1 -1
  272. package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js +2 -4
  273. package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js.map +1 -1
  274. package/dist/field/features/migrations/lexicalPluginToLexical/feature.client.d.ts +4 -1
  275. package/dist/field/features/migrations/lexicalPluginToLexical/feature.client.d.ts.map +1 -1
  276. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +1 -3
  277. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  278. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +2 -4
  279. package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  280. package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/client.d.ts +1 -1
  281. package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/client.js +1 -1
  282. package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/client.js.map +1 -1
  283. package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/index.js +2 -2
  284. package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/index.js.map +1 -1
  285. package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.d.ts.map +1 -1
  286. package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.js +2 -4
  287. package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.js.map +1 -1
  288. package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.d.ts.map +1 -1
  289. package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.js +2 -4
  290. package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.js.map +1 -1
  291. package/dist/field/features/migrations/slateToLexical/converter/index.d.ts.map +1 -1
  292. package/dist/field/features/migrations/slateToLexical/converter/index.js +2 -1
  293. package/dist/field/features/migrations/slateToLexical/converter/index.js.map +1 -1
  294. package/dist/field/features/migrations/slateToLexical/feature.client.d.ts +4 -1
  295. package/dist/field/features/migrations/slateToLexical/feature.client.d.ts.map +1 -1
  296. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +1 -3
  297. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
  298. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +2 -4
  299. package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  300. package/dist/field/features/paragraph/feature.client.d.ts +4 -1
  301. package/dist/field/features/paragraph/feature.client.d.ts.map +1 -1
  302. package/dist/field/features/paragraph/feature.client.js +45 -33
  303. package/dist/field/features/paragraph/feature.client.js.map +1 -1
  304. package/dist/field/features/relationship/drawer/commands.d.ts.map +1 -1
  305. package/dist/field/features/relationship/drawer/commands.js +1 -2
  306. package/dist/field/features/relationship/drawer/commands.js.map +1 -1
  307. package/dist/field/features/relationship/drawer/index.d.ts.map +1 -1
  308. package/dist/field/features/relationship/drawer/index.js +7 -13
  309. package/dist/field/features/relationship/drawer/index.js.map +1 -1
  310. package/dist/field/features/relationship/feature.client.d.ts +17 -2
  311. package/dist/field/features/relationship/feature.client.d.ts.map +1 -1
  312. package/dist/field/features/relationship/feature.client.js +37 -15
  313. package/dist/field/features/relationship/feature.client.js.map +1 -1
  314. package/dist/field/features/relationship/feature.server.d.ts +10 -1
  315. package/dist/field/features/relationship/feature.server.d.ts.map +1 -1
  316. package/dist/field/features/relationship/feature.server.js +5 -4
  317. package/dist/field/features/relationship/feature.server.js.map +1 -1
  318. package/dist/field/features/relationship/nodes/RelationshipNode.d.ts +3 -8
  319. package/dist/field/features/relationship/nodes/RelationshipNode.d.ts.map +1 -1
  320. package/dist/field/features/relationship/nodes/RelationshipNode.js +8 -8
  321. package/dist/field/features/relationship/nodes/RelationshipNode.js.map +1 -1
  322. package/dist/field/features/relationship/nodes/components/RelationshipComponent.d.ts.map +1 -1
  323. package/dist/field/features/relationship/nodes/components/RelationshipComponent.js +56 -7
  324. package/dist/field/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
  325. package/dist/field/features/relationship/plugins/index.d.ts +2 -2
  326. package/dist/field/features/relationship/plugins/index.d.ts.map +1 -1
  327. package/dist/field/features/relationship/plugins/index.js +9 -12
  328. package/dist/field/features/relationship/plugins/index.js.map +1 -1
  329. package/dist/field/features/relationship/populationPromise.d.ts +2 -1
  330. package/dist/field/features/relationship/populationPromise.d.ts.map +1 -1
  331. package/dist/field/features/relationship/populationPromise.js +25 -19
  332. package/dist/field/features/relationship/populationPromise.js.map +1 -1
  333. package/dist/field/features/shared/toolbar/addDropdownGroup.d.ts +3 -0
  334. package/dist/field/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -0
  335. package/dist/field/features/shared/toolbar/addDropdownGroup.js +12 -0
  336. package/dist/field/features/shared/toolbar/addDropdownGroup.js.map +1 -0
  337. package/dist/field/features/shared/toolbar/featureButtonsGroup.d.ts +3 -0
  338. package/dist/field/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -0
  339. package/dist/field/features/shared/toolbar/featureButtonsGroup.js +10 -0
  340. package/dist/field/features/shared/toolbar/featureButtonsGroup.js.map +1 -0
  341. package/dist/field/features/shared/toolbar/textDropdownGroup.d.ts +3 -0
  342. package/dist/field/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -0
  343. package/dist/field/features/shared/toolbar/textDropdownGroup.js +12 -0
  344. package/dist/field/features/shared/toolbar/textDropdownGroup.js.map +1 -0
  345. package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts +4 -0
  346. package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts.map +1 -0
  347. package/dist/field/features/toolbars/fixed/Toolbar/index.js +152 -0
  348. package/dist/field/features/toolbars/fixed/Toolbar/index.js.map +1 -0
  349. package/dist/field/features/toolbars/fixed/Toolbar/index.scss +91 -0
  350. package/dist/field/features/toolbars/fixed/feature.client.d.ts +6 -0
  351. package/dist/field/features/toolbars/fixed/feature.client.d.ts.map +1 -0
  352. package/dist/field/features/toolbars/fixed/feature.client.js +20 -0
  353. package/dist/field/features/toolbars/fixed/feature.client.js.map +1 -0
  354. package/dist/field/features/toolbars/fixed/feature.server.d.ts +3 -0
  355. package/dist/field/features/toolbars/fixed/feature.server.d.ts.map +1 -0
  356. package/dist/field/features/toolbars/fixed/feature.server.js +15 -0
  357. package/dist/field/features/toolbars/fixed/feature.server.js.map +1 -0
  358. package/dist/field/features/toolbars/inline/Toolbar/index.d.ts +4 -0
  359. package/dist/field/features/toolbars/inline/Toolbar/index.d.ts.map +1 -0
  360. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/inline/Toolbar}/index.js +112 -70
  361. package/dist/field/features/toolbars/inline/Toolbar/index.js.map +1 -0
  362. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/inline/Toolbar}/index.scss +7 -11
  363. package/dist/field/features/toolbars/inline/feature.client.d.ts +6 -0
  364. package/dist/field/features/toolbars/inline/feature.client.d.ts.map +1 -0
  365. package/dist/field/features/toolbars/inline/feature.client.js +20 -0
  366. package/dist/field/features/toolbars/inline/feature.client.js.map +1 -0
  367. package/dist/field/features/toolbars/inline/feature.server.d.ts +3 -0
  368. package/dist/field/features/toolbars/inline/feature.server.d.ts.map +1 -0
  369. package/dist/field/features/toolbars/inline/feature.server.js +15 -0
  370. package/dist/field/features/toolbars/inline/feature.server.js.map +1 -0
  371. package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts +10 -0
  372. package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -0
  373. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarButton/index.js +29 -19
  374. package/dist/field/features/toolbars/shared/ToolbarButton/index.js.map +1 -0
  375. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarButton/index.scss +3 -1
  376. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts +23 -0
  377. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -0
  378. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarDropdown/DropDown.js +27 -72
  379. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -0
  380. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts +23 -0
  381. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -0
  382. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js +139 -0
  383. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -0
  384. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarDropdown/index.scss +25 -13
  385. package/dist/field/features/toolbars/types.d.ts +48 -0
  386. package/dist/field/features/toolbars/types.d.ts.map +1 -0
  387. package/dist/field/features/toolbars/types.js.map +1 -0
  388. package/dist/field/features/typeUtilities.d.ts +8 -0
  389. package/dist/field/features/typeUtilities.d.ts.map +1 -0
  390. package/dist/field/features/typeUtilities.js +8 -0
  391. package/dist/field/features/typeUtilities.js.map +1 -0
  392. package/dist/field/features/types.d.ts +136 -62
  393. package/dist/field/features/types.d.ts.map +1 -1
  394. package/dist/field/features/types.js.map +1 -1
  395. package/dist/field/features/upload/component/ExtraFieldsDrawer/index.d.ts.map +1 -1
  396. package/dist/field/features/upload/component/ExtraFieldsDrawer/index.js +5 -6
  397. package/dist/field/features/upload/component/ExtraFieldsDrawer/index.js.map +1 -1
  398. package/dist/field/features/upload/component/index.d.ts.map +1 -1
  399. package/dist/field/features/upload/component/index.js +59 -9
  400. package/dist/field/features/upload/component/index.js.map +1 -1
  401. package/dist/field/features/upload/drawer/commands.d.ts.map +1 -1
  402. package/dist/field/features/upload/drawer/commands.js +1 -2
  403. package/dist/field/features/upload/drawer/commands.js.map +1 -1
  404. package/dist/field/features/upload/drawer/index.d.ts.map +1 -1
  405. package/dist/field/features/upload/drawer/index.js +8 -12
  406. package/dist/field/features/upload/drawer/index.js.map +1 -1
  407. package/dist/field/features/upload/feature.client.d.ts +4 -1
  408. package/dist/field/features/upload/feature.client.d.ts.map +1 -1
  409. package/dist/field/features/upload/feature.client.js +35 -10
  410. package/dist/field/features/upload/feature.client.js.map +1 -1
  411. package/dist/field/features/upload/feature.server.d.ts +10 -3
  412. package/dist/field/features/upload/feature.server.d.ts.map +1 -1
  413. package/dist/field/features/upload/feature.server.js +39 -11
  414. package/dist/field/features/upload/feature.server.js.map +1 -1
  415. package/dist/field/features/upload/nodes/UploadNode.d.ts +2 -14
  416. package/dist/field/features/upload/nodes/UploadNode.d.ts.map +1 -1
  417. package/dist/field/features/upload/nodes/UploadNode.js +24 -11
  418. package/dist/field/features/upload/nodes/UploadNode.js.map +1 -1
  419. package/dist/field/features/upload/plugin/index.d.ts +5 -4
  420. package/dist/field/features/upload/plugin/index.d.ts.map +1 -1
  421. package/dist/field/features/upload/plugin/index.js +6 -11
  422. package/dist/field/features/upload/plugin/index.js.map +1 -1
  423. package/dist/field/features/upload/populationPromise.d.ts.map +1 -1
  424. package/dist/field/features/upload/populationPromise.js +15 -9
  425. package/dist/field/features/upload/populationPromise.js.map +1 -1
  426. package/dist/field/features/upload/validate.d.ts +2 -1
  427. package/dist/field/features/upload/validate.d.ts.map +1 -1
  428. package/dist/field/features/upload/validate.js +37 -12
  429. package/dist/field/features/upload/validate.js.map +1 -1
  430. package/dist/field/index.d.ts +1 -1
  431. package/dist/field/index.d.ts.map +1 -1
  432. package/dist/field/index.js.map +1 -1
  433. package/dist/field/index.scss +4 -0
  434. package/dist/field/lexical/EditorFocusProvider.d.ts +20 -0
  435. package/dist/field/lexical/EditorFocusProvider.d.ts.map +1 -0
  436. package/dist/field/lexical/EditorFocusProvider.js +78 -0
  437. package/dist/field/lexical/EditorFocusProvider.js.map +1 -0
  438. package/dist/field/lexical/EditorPlugin.d.ts +1 -0
  439. package/dist/field/lexical/EditorPlugin.d.ts.map +1 -1
  440. package/dist/field/lexical/EditorPlugin.js +6 -3
  441. package/dist/field/lexical/EditorPlugin.js.map +1 -1
  442. package/dist/field/lexical/LexicalEditor.d.ts.map +1 -1
  443. package/dist/field/lexical/LexicalEditor.js +31 -15
  444. package/dist/field/lexical/LexicalEditor.js.map +1 -1
  445. package/dist/field/lexical/LexicalEditor.scss +3 -19
  446. package/dist/field/lexical/LexicalProvider.d.ts +1 -1
  447. package/dist/field/lexical/LexicalProvider.d.ts.map +1 -1
  448. package/dist/field/lexical/LexicalProvider.js +4 -4
  449. package/dist/field/lexical/LexicalProvider.js.map +1 -1
  450. package/dist/field/lexical/config/client/EditorConfigProvider.d.ts +2 -3
  451. package/dist/field/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  452. package/dist/field/lexical/config/client/EditorConfigProvider.js.map +1 -1
  453. package/dist/field/lexical/config/client/default.d.ts +1 -1
  454. package/dist/field/lexical/config/client/default.d.ts.map +1 -1
  455. package/dist/field/lexical/config/client/default.js.map +1 -1
  456. package/dist/field/lexical/config/client/sanitize.d.ts +1 -1
  457. package/dist/field/lexical/config/client/sanitize.d.ts.map +1 -1
  458. package/dist/field/lexical/config/client/sanitize.js +81 -32
  459. package/dist/field/lexical/config/client/sanitize.js.map +1 -1
  460. package/dist/field/lexical/config/server/default.d.ts +2 -3
  461. package/dist/field/lexical/config/server/default.d.ts.map +1 -1
  462. package/dist/field/lexical/config/server/default.js +12 -10
  463. package/dist/field/lexical/config/server/default.js.map +1 -1
  464. package/dist/field/lexical/config/server/loader.d.ts +5 -2
  465. package/dist/field/lexical/config/server/loader.d.ts.map +1 -1
  466. package/dist/field/lexical/config/server/loader.js +4 -2
  467. package/dist/field/lexical/config/server/loader.js.map +1 -1
  468. package/dist/field/lexical/config/server/sanitize.d.ts +2 -1
  469. package/dist/field/lexical/config/server/sanitize.d.ts.map +1 -1
  470. package/dist/field/lexical/config/server/sanitize.js +23 -8
  471. package/dist/field/lexical/config/server/sanitize.js.map +1 -1
  472. package/dist/field/lexical/config/types.d.ts +1 -1
  473. package/dist/field/lexical/config/types.d.ts.map +1 -1
  474. package/dist/field/lexical/config/types.js.map +1 -1
  475. package/dist/field/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
  476. package/dist/field/lexical/plugins/MarkdownShortcut/index.js +1 -2
  477. package/dist/field/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  478. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +9 -9
  479. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  480. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +74 -77
  481. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  482. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +4 -4
  483. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
  484. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +6 -9
  485. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  486. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +19 -27
  487. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  488. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js +1 -37
  489. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  490. package/dist/field/lexical/plugins/SlashMenu/index.d.ts +2 -2
  491. package/dist/field/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  492. package/dist/field/lexical/plugins/SlashMenu/index.js +72 -67
  493. package/dist/field/lexical/plugins/SlashMenu/index.js.map +1 -1
  494. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts.map +1 -1
  495. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js +13 -10
  496. package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  497. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.d.ts +1 -1
  498. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.d.ts.map +1 -1
  499. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.js +3 -4
  500. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.js.map +1 -1
  501. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  502. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js +16 -10
  503. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  504. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.scss +8 -0
  505. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.d.ts.map +1 -1
  506. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js +25 -6
  507. package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js.map +1 -1
  508. package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.d.ts +9 -0
  509. package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.d.ts.map +1 -0
  510. package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.js +35 -0
  511. package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.js.map +1 -0
  512. package/dist/field/lexical/plugins/handles/utils/getTopLevelNodeKeys.d.ts.map +1 -1
  513. package/dist/field/lexical/plugins/handles/utils/getTopLevelNodeKeys.js +1 -2
  514. package/dist/field/lexical/plugins/handles/utils/getTopLevelNodeKeys.js.map +1 -1
  515. package/dist/field/lexical/plugins/handles/utils/setHandlePosition.d.ts +1 -1
  516. package/dist/field/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  517. package/dist/field/lexical/plugins/handles/utils/setHandlePosition.js +17 -7
  518. package/dist/field/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  519. package/dist/field/lexical/theme/EditorTheme.scss +13 -14
  520. package/dist/field/lexical/ui/ContentEditable.d.ts.map +1 -1
  521. package/dist/field/lexical/ui/ContentEditable.js +1 -2
  522. package/dist/field/lexical/ui/ContentEditable.js.map +1 -1
  523. package/dist/field/lexical/ui/icons/Add/index.d.ts +3 -0
  524. package/dist/field/lexical/ui/icons/Add/index.d.ts.map +1 -0
  525. package/dist/field/lexical/ui/icons/Add/index.js +16 -0
  526. package/dist/field/lexical/ui/icons/Add/index.js.map +1 -0
  527. package/dist/field/lexical/ui/icons/HorizontalRule/index.d.ts +3 -0
  528. package/dist/field/lexical/ui/icons/HorizontalRule/index.d.ts.map +1 -0
  529. package/dist/field/lexical/ui/icons/HorizontalRule/index.js +19 -0
  530. package/dist/field/lexical/ui/icons/HorizontalRule/index.js.map +1 -0
  531. package/dist/field/lexical/utils/getSelectedNode.d.ts.map +1 -1
  532. package/dist/field/lexical/utils/getSelectedNode.js +1 -2
  533. package/dist/field/lexical/utils/getSelectedNode.js.map +1 -1
  534. package/dist/field/lexical/utils/nodeFormat.d.ts +2 -1
  535. package/dist/field/lexical/utils/nodeFormat.d.ts.map +1 -1
  536. package/dist/field/lexical/utils/nodeFormat.js.map +1 -1
  537. package/dist/field/lexical/utils/setFloatingElemPosition.d.ts +11 -1
  538. package/dist/field/lexical/utils/setFloatingElemPosition.d.ts.map +1 -1
  539. package/dist/field/lexical/utils/setFloatingElemPosition.js +16 -13
  540. package/dist/field/lexical/utils/setFloatingElemPosition.js.map +1 -1
  541. package/dist/field/lexical/utils/url.d.ts.map +1 -1
  542. package/dist/field/lexical/utils/url.js +3 -0
  543. package/dist/field/lexical/utils/url.js.map +1 -1
  544. package/dist/forEachNodeRecursively.d.ts +10 -0
  545. package/dist/forEachNodeRecursively.d.ts.map +1 -0
  546. package/dist/forEachNodeRecursively.js +24 -0
  547. package/dist/forEachNodeRecursively.js.map +1 -0
  548. package/dist/generateComponentMap.d.ts.map +1 -1
  549. package/dist/generateComponentMap.js +16 -22
  550. package/dist/generateComponentMap.js.map +1 -1
  551. package/dist/generateSchemaMap.d.ts.map +1 -1
  552. package/dist/generateSchemaMap.js +4 -12
  553. package/dist/generateSchemaMap.js.map +1 -1
  554. package/dist/index.d.ts +24 -20
  555. package/dist/index.d.ts.map +1 -1
  556. package/dist/index.js +275 -184
  557. package/dist/index.js.map +1 -1
  558. package/dist/populate/defaultValue.d.ts.map +1 -1
  559. package/dist/populate/defaultValue.js +1 -0
  560. package/dist/populate/defaultValue.js.map +1 -1
  561. package/dist/populate/populate.d.ts +5 -4
  562. package/dist/populate/populate.d.ts.map +1 -1
  563. package/dist/populate/populate.js +13 -11
  564. package/dist/populate/populate.js.map +1 -1
  565. package/dist/populate/populateLexicalPopulationPromises.d.ts +12 -0
  566. package/dist/populate/populateLexicalPopulationPromises.d.ts.map +1 -0
  567. package/dist/populate/populateLexicalPopulationPromises.js +36 -0
  568. package/dist/populate/populateLexicalPopulationPromises.js.map +1 -0
  569. package/dist/populate/recurseNestedFields.d.ts +8 -4
  570. package/dist/populate/recurseNestedFields.d.ts.map +1 -1
  571. package/dist/populate/recurseNestedFields.js +4 -5
  572. package/dist/populate/recurseNestedFields.js.map +1 -1
  573. package/dist/scss/app.scss +2 -3
  574. package/dist/scss/vars.scss +0 -7
  575. package/dist/types.d.ts +12 -5
  576. package/dist/types.d.ts.map +1 -1
  577. package/dist/types.js.map +1 -1
  578. package/dist/validate/index.d.ts +1 -1
  579. package/dist/validate/index.d.ts.map +1 -1
  580. package/package.json +48 -47
  581. package/components.d.ts +0 -6
  582. package/components.js +0 -7
  583. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.d.ts +0 -3
  584. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.d.ts.map +0 -1
  585. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.js +0 -12
  586. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.js.map +0 -1
  587. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.d.ts +0 -3
  588. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.d.ts.map +0 -1
  589. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.js +0 -10
  590. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.js.map +0 -1
  591. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.d.ts +0 -3
  592. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.d.ts.map +0 -1
  593. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.js +0 -12
  594. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.js.map +0 -1
  595. package/dist/field/features/debug/testrecorder/feature.client.d.ts.map +0 -1
  596. package/dist/field/features/debug/testrecorder/plugin/index.d.ts +0 -5
  597. package/dist/field/features/debug/testrecorder/plugin/index.d.ts.map +0 -1
  598. package/dist/field/features/debug/testrecorder/plugin/index.js.map +0 -1
  599. package/dist/field/features/debug/treeview/feature.client.d.ts.map +0 -1
  600. package/dist/field/features/debug/treeview/plugin/index.d.ts +0 -4
  601. package/dist/field/features/debug/treeview/plugin/index.d.ts.map +0 -1
  602. package/dist/field/features/debug/treeview/plugin/index.js.map +0 -1
  603. package/dist/field/features/format/common/floatingSelectToolbarSection.d.ts +0 -3
  604. package/dist/field/features/format/common/floatingSelectToolbarSection.d.ts.map +0 -1
  605. package/dist/field/features/format/common/floatingSelectToolbarSection.js +0 -10
  606. package/dist/field/features/format/common/floatingSelectToolbarSection.js.map +0 -1
  607. package/dist/field/features/format/inlinecode/feature.client.d.ts.map +0 -1
  608. package/dist/field/features/format/inlinecode/feature.client.js +0 -43
  609. package/dist/field/features/format/inlinecode/feature.client.js.map +0 -1
  610. package/dist/field/features/indent/floatingSelectToolbarIndentSection.d.ts +0 -3
  611. package/dist/field/features/indent/floatingSelectToolbarIndentSection.d.ts.map +0 -1
  612. package/dist/field/features/indent/floatingSelectToolbarIndentSection.js +0 -10
  613. package/dist/field/features/indent/floatingSelectToolbarIndentSection.js.map +0 -1
  614. package/dist/field/features/indent/index.scss +0 -4
  615. package/dist/field/features/lists/common/markdown.js.map +0 -1
  616. package/dist/field/features/lists/orderedlist/feature.client.d.ts.map +0 -1
  617. package/dist/field/features/lists/orderedlist/feature.client.js +0 -72
  618. package/dist/field/features/lists/orderedlist/feature.client.js.map +0 -1
  619. package/dist/field/features/lists/orderedlist/feature.server.d.ts.map +0 -1
  620. package/dist/field/features/lists/orderedlist/feature.server.js.map +0 -1
  621. package/dist/field/features/lists/orderedlist/markdownTransformer.d.ts.map +0 -1
  622. package/dist/field/features/lists/orderedlist/markdownTransformer.js.map +0 -1
  623. package/dist/field/features/lists/unorderedlist/feature.client.d.ts.map +0 -1
  624. package/dist/field/features/lists/unorderedlist/feature.client.js +0 -72
  625. package/dist/field/features/lists/unorderedlist/feature.client.js.map +0 -1
  626. package/dist/field/features/lists/unorderedlist/feature.server.d.ts.map +0 -1
  627. package/dist/field/features/lists/unorderedlist/feature.server.js.map +0 -1
  628. package/dist/field/features/lists/unorderedlist/markdownTransformer.d.ts.map +0 -1
  629. package/dist/field/features/lists/unorderedlist/markdownTransformer.js.map +0 -1
  630. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.d.ts +0 -8
  631. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.d.ts.map +0 -1
  632. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.js.map +0 -1
  633. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.d.ts +0 -17
  634. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.d.ts.map +0 -1
  635. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.js.map +0 -1
  636. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.d.ts +0 -18
  637. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.d.ts.map +0 -1
  638. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.js +0 -42
  639. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.js.map +0 -1
  640. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.d.ts +0 -6
  641. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.d.ts.map +0 -1
  642. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js.map +0 -1
  643. package/dist/field/lexical/plugins/FloatingSelectToolbar/types.d.ts +0 -40
  644. package/dist/field/lexical/plugins/FloatingSelectToolbar/types.d.ts.map +0 -1
  645. package/dist/field/lexical/plugins/FloatingSelectToolbar/types.js.map +0 -1
  646. package/dist/populate/richTextRelationshipPromise.d.ts +0 -23
  647. package/dist/populate/richTextRelationshipPromise.d.ts.map +0 -1
  648. package/dist/populate/richTextRelationshipPromise.js +0 -68
  649. package/dist/populate/richTextRelationshipPromise.js.map +0 -1
  650. package/dist/scss/fonts.scss +0 -75
  651. package/src/index.ts +0 -423
  652. /package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.js +0 -0
  653. /package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.d.ts +0 -0
  654. /package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.scss +0 -0
  655. /package/dist/field/features/debug/{treeview → treeView}/feature.client.js +0 -0
  656. /package/dist/field/features/debug/{treeview → treeView}/feature.server.d.ts +0 -0
  657. /package/dist/field/features/debug/{treeview → treeView}/plugin/index.scss +0 -0
  658. /package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.d.ts +0 -0
  659. /package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.d.ts +0 -0
  660. /package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.js +0 -0
  661. /package/dist/field/features/lists/{orderedlist → orderedList}/feature.server.d.ts +0 -0
  662. /package/dist/field/features/lists/{orderedlist → orderedList}/markdownTransformer.d.ts +0 -0
  663. /package/dist/field/features/lists/{common → shared}/markdown.d.ts +0 -0
  664. /package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.server.d.ts +0 -0
  665. /package/dist/field/features/lists/{unorderedlist → unorderedList}/markdownTransformer.d.ts +0 -0
  666. /package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars}/types.js +0 -0
@@ -1,21 +1,17 @@
1
1
  'use client';
2
- import lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js';
3
- const { useLexicalComposerContext } = lexicalComposerContextImport;
4
- import lexicalImport from 'lexical';
5
- const { $getNodeByKey, COMMAND_PRIORITY_EDITOR } = lexicalImport;
2
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
6
3
  import { useListDrawer } from '@payloadcms/ui/elements/ListDrawer';
4
+ import { $getNodeByKey, COMMAND_PRIORITY_EDITOR } from 'lexical';
7
5
  import React, { useCallback, useEffect, useState } from 'react';
8
6
  import { $createRelationshipNode } from '../nodes/RelationshipNode.js';
9
7
  import { INSERT_RELATIONSHIP_COMMAND } from '../plugins/index.js';
10
8
  import { EnabledRelationshipsCondition } from '../utils/EnabledRelationshipsCondition.js';
11
9
  import { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from './commands.js';
12
- const insertRelationship = ({ id, editor, relationTo, replaceNodeKey })=>{
10
+ const insertRelationship = ({ editor, relationTo, replaceNodeKey, value })=>{
13
11
  if (!replaceNodeKey) {
14
12
  editor.dispatchCommand(INSERT_RELATIONSHIP_COMMAND, {
15
13
  relationTo,
16
- value: {
17
- id
18
- }
14
+ value
19
15
  });
20
16
  } else {
21
17
  editor.update(()=>{
@@ -23,9 +19,7 @@ const insertRelationship = ({ id, editor, relationTo, replaceNodeKey })=>{
23
19
  if (node) {
24
20
  node.replace($createRelationshipNode({
25
21
  relationTo,
26
- value: {
27
- id
28
- }
22
+ value
29
23
  }));
30
24
  }
31
25
  });
@@ -51,10 +45,10 @@ const RelationshipDrawerComponent = ({ enabledCollectionSlugs })=>{
51
45
  ]);
52
46
  const onSelect = useCallback(({ collectionSlug, docID })=>{
53
47
  insertRelationship({
54
- id: docID,
55
48
  editor,
56
49
  relationTo: collectionSlug,
57
- replaceNodeKey
50
+ replaceNodeKey,
51
+ value: docID
58
52
  });
59
53
  closeDrawer();
60
54
  }, [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/relationship/drawer/index.tsx"],"sourcesContent":["'use client'\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport lexicalImport from 'lexical'\nconst { $getNodeByKey, COMMAND_PRIORITY_EDITOR } = lexicalImport\n\nimport type { LexicalEditor } from 'lexical'\n\nimport { useListDrawer } from '@payloadcms/ui/elements/ListDrawer'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport { $createRelationshipNode } from '../nodes/RelationshipNode.js'\nimport { INSERT_RELATIONSHIP_COMMAND } from '../plugins/index.js'\nimport { EnabledRelationshipsCondition } from '../utils/EnabledRelationshipsCondition.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from './commands.js'\n\nconst insertRelationship = ({\n id,\n editor,\n relationTo,\n replaceNodeKey,\n}: {\n editor: LexicalEditor\n id: string\n relationTo: string\n replaceNodeKey: null | string\n}) => {\n if (!replaceNodeKey) {\n editor.dispatchCommand(INSERT_RELATIONSHIP_COMMAND, {\n relationTo,\n value: {\n id,\n },\n })\n } else {\n editor.update(() => {\n const node = $getNodeByKey(replaceNodeKey)\n if (node) {\n node.replace($createRelationshipNode({ relationTo, value: { id } }))\n }\n })\n }\n}\n\ntype Props = {\n enabledCollectionSlugs: null | string[]\n}\n\nconst RelationshipDrawerComponent: React.FC<Props> = ({ enabledCollectionSlugs }) => {\n const [editor] = useLexicalComposerContext()\n const [selectedCollectionSlug, setSelectedCollectionSlug] = useState(\n () => enabledCollectionSlugs[0],\n )\n const [replaceNodeKey, setReplaceNodeKey] = useState<null | string>(null)\n\n const [ListDrawer, ListDrawerToggler, { closeDrawer, isDrawerOpen, openDrawer }] = useListDrawer({\n collectionSlugs: enabledCollectionSlugs,\n selectedCollection: selectedCollectionSlug,\n })\n\n useEffect(() => {\n return editor.registerCommand<{\n replace: { nodeKey: string } | false\n }>(\n INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND,\n (payload) => {\n setReplaceNodeKey(payload?.replace ? payload?.replace.nodeKey : null)\n openDrawer()\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor, openDrawer])\n\n const onSelect = useCallback(\n ({ collectionSlug, docID }) => {\n insertRelationship({\n id: docID,\n editor,\n relationTo: collectionSlug,\n replaceNodeKey,\n })\n closeDrawer()\n },\n [editor, closeDrawer, replaceNodeKey],\n )\n\n useEffect(() => {\n // always reset back to first option\n // TODO: this is not working, see the ListDrawer component\n setSelectedCollectionSlug(enabledCollectionSlugs[0])\n }, [isDrawerOpen, enabledCollectionSlugs])\n\n return <ListDrawer onSelect={onSelect} />\n}\n\nexport const RelationshipDrawer = (props: Props): React.ReactNode => {\n return props?.enabledCollectionSlugs?.length > 0 ? ( // If enabledCollectionSlugs it overrides what EnabledRelationshipsCondition is doing\n <RelationshipDrawerComponent {...props} />\n ) : (\n <EnabledRelationshipsCondition {...props}>\n <RelationshipDrawerComponent {...props} />\n </EnabledRelationshipsCondition>\n )\n}\n"],"names":["lexicalComposerContextImport","useLexicalComposerContext","lexicalImport","$getNodeByKey","COMMAND_PRIORITY_EDITOR","useListDrawer","React","useCallback","useEffect","useState","$createRelationshipNode","INSERT_RELATIONSHIP_COMMAND","EnabledRelationshipsCondition","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND","insertRelationship","id","editor","relationTo","replaceNodeKey","dispatchCommand","value","update","node","replace","RelationshipDrawerComponent","enabledCollectionSlugs","selectedCollectionSlug","setSelectedCollectionSlug","setReplaceNodeKey","ListDrawer","ListDrawerToggler","closeDrawer","isDrawerOpen","openDrawer","collectionSlugs","selectedCollection","registerCommand","payload","nodeKey","onSelect","collectionSlug","docID","RelationshipDrawer","props","length"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,OAAOA,kCAAkC,2CAA0C;AACnF,MAAM,EAAEC,yBAAyB,EAAE,GAAGD;AACtC,OAAOE,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAEC,uBAAuB,EAAE,GAAGF;AAInD,SAASG,aAAa,QAAQ,qCAAoC;AAClE,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAE/D,SAASC,uBAAuB,QAAQ,+BAA8B;AACtE,SAASC,2BAA2B,QAAQ,sBAAqB;AACjE,SAASC,6BAA6B,QAAQ,4CAA2C;AACzF,SAASC,uCAAuC,QAAQ,gBAAe;AAEvE,MAAMC,qBAAqB,CAAC,EAC1BC,EAAE,EACFC,MAAM,EACNC,UAAU,EACVC,cAAc,EAMf;IACC,IAAI,CAACA,gBAAgB;QACnBF,OAAOG,eAAe,CAACR,6BAA6B;YAClDM;YACAG,OAAO;gBACLL;YACF;QACF;IACF,OAAO;QACLC,OAAOK,MAAM,CAAC;YACZ,MAAMC,OAAOnB,cAAce;YAC3B,IAAII,MAAM;gBACRA,KAAKC,OAAO,CAACb,wBAAwB;oBAAEO;oBAAYG,OAAO;wBAAEL;oBAAG;gBAAE;YACnE;QACF;IACF;AACF;AAMA,MAAMS,8BAA+C,CAAC,EAAEC,sBAAsB,EAAE;IAC9E,MAAM,CAACT,OAAO,GAAGf;IACjB,MAAM,CAACyB,wBAAwBC,0BAA0B,GAAGlB,SAC1D,IAAMgB,sBAAsB,CAAC,EAAE;IAEjC,MAAM,CAACP,gBAAgBU,kBAAkB,GAAGnB,SAAwB;IAEpE,MAAM,CAACoB,YAAYC,mBAAmB,EAAEC,WAAW,EAAEC,YAAY,EAAEC,UAAU,EAAE,CAAC,GAAG5B,cAAc;QAC/F6B,iBAAiBT;QACjBU,oBAAoBT;IACtB;IAEAlB,UAAU;QACR,OAAOQ,OAAOoB,eAAe,CAG3BvB,yCACA,CAACwB;YACCT,kBAAkBS,SAASd,UAAUc,SAASd,QAAQe,UAAU;YAChEL;YACA,OAAO;QACT,GACA7B;IAEJ,GAAG;QAACY;QAAQiB;KAAW;IAEvB,MAAMM,WAAWhC,YACf,CAAC,EAAEiC,cAAc,EAAEC,KAAK,EAAE;QACxB3B,mBAAmB;YACjBC,IAAI0B;YACJzB;YACAC,YAAYuB;YACZtB;QACF;QACAa;IACF,GACA;QAACf;QAAQe;QAAab;KAAe;IAGvCV,UAAU;QACR,oCAAoC;QACpC,0DAA0D;QAC1DmB,0BAA0BF,sBAAsB,CAAC,EAAE;IACrD,GAAG;QAACO;QAAcP;KAAuB;IAEzC,qBAAO,oBAACI;QAAWU,UAAUA;;AAC/B;AAEA,OAAO,MAAMG,qBAAqB,CAACC;IACjC,OAAOA,OAAOlB,wBAAwBmB,SAAS,kBAC7C,oBAACpB,6BAAgCmB,uBAEjC,oBAAC/B,+BAAkC+B,qBACjC,oBAACnB,6BAAgCmB;AAGvC,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/features/relationship/drawer/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useListDrawer } from '@payloadcms/ui/elements/ListDrawer'\nimport { $getNodeByKey, COMMAND_PRIORITY_EDITOR } from 'lexical'\nimport React, { useCallback, useEffect, useState } from 'react'\n\nimport { $createRelationshipNode } from '../nodes/RelationshipNode.js'\nimport { INSERT_RELATIONSHIP_COMMAND } from '../plugins/index.js'\nimport { EnabledRelationshipsCondition } from '../utils/EnabledRelationshipsCondition.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from './commands.js'\n\nconst insertRelationship = ({\n editor,\n relationTo,\n replaceNodeKey,\n value,\n}: {\n editor: LexicalEditor\n relationTo: string\n replaceNodeKey: null | string\n value: number | string\n}) => {\n if (!replaceNodeKey) {\n editor.dispatchCommand(INSERT_RELATIONSHIP_COMMAND, {\n relationTo,\n value,\n })\n } else {\n editor.update(() => {\n const node = $getNodeByKey(replaceNodeKey)\n if (node) {\n node.replace($createRelationshipNode({ relationTo, value }))\n }\n })\n }\n}\n\ntype Props = {\n enabledCollectionSlugs: null | string[]\n}\n\nconst RelationshipDrawerComponent: React.FC<Props> = ({ enabledCollectionSlugs }) => {\n const [editor] = useLexicalComposerContext()\n const [selectedCollectionSlug, setSelectedCollectionSlug] = useState(\n () => enabledCollectionSlugs[0],\n )\n const [replaceNodeKey, setReplaceNodeKey] = useState<null | string>(null)\n\n const [ListDrawer, ListDrawerToggler, { closeDrawer, isDrawerOpen, openDrawer }] = useListDrawer({\n collectionSlugs: enabledCollectionSlugs,\n selectedCollection: selectedCollectionSlug,\n })\n\n useEffect(() => {\n return editor.registerCommand<{\n replace: { nodeKey: string } | false\n }>(\n INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND,\n (payload) => {\n setReplaceNodeKey(payload?.replace ? payload?.replace.nodeKey : null)\n openDrawer()\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor, openDrawer])\n\n const onSelect = useCallback(\n ({ collectionSlug, docID }) => {\n insertRelationship({\n editor,\n relationTo: collectionSlug,\n replaceNodeKey,\n value: docID,\n })\n closeDrawer()\n },\n [editor, closeDrawer, replaceNodeKey],\n )\n\n useEffect(() => {\n // always reset back to first option\n // TODO: this is not working, see the ListDrawer component\n setSelectedCollectionSlug(enabledCollectionSlugs[0])\n }, [isDrawerOpen, enabledCollectionSlugs])\n\n return <ListDrawer onSelect={onSelect} />\n}\n\nexport const RelationshipDrawer = (props: Props): React.ReactNode => {\n return props?.enabledCollectionSlugs?.length > 0 ? ( // If enabledCollectionSlugs it overrides what EnabledRelationshipsCondition is doing\n <RelationshipDrawerComponent {...props} />\n ) : (\n <EnabledRelationshipsCondition {...props}>\n <RelationshipDrawerComponent {...props} />\n </EnabledRelationshipsCondition>\n )\n}\n"],"names":["useLexicalComposerContext","useListDrawer","$getNodeByKey","COMMAND_PRIORITY_EDITOR","React","useCallback","useEffect","useState","$createRelationshipNode","INSERT_RELATIONSHIP_COMMAND","EnabledRelationshipsCondition","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND","insertRelationship","editor","relationTo","replaceNodeKey","value","dispatchCommand","update","node","replace","RelationshipDrawerComponent","enabledCollectionSlugs","selectedCollectionSlug","setSelectedCollectionSlug","setReplaceNodeKey","ListDrawer","ListDrawerToggler","closeDrawer","isDrawerOpen","openDrawer","collectionSlugs","selectedCollection","registerCommand","payload","nodeKey","onSelect","collectionSlug","docID","RelationshipDrawer","props","length"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,aAAa,EAAEC,uBAAuB,QAAQ,UAAS;AAChE,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAE/D,SAASC,uBAAuB,QAAQ,+BAA8B;AACtE,SAASC,2BAA2B,QAAQ,sBAAqB;AACjE,SAASC,6BAA6B,QAAQ,4CAA2C;AACzF,SAASC,uCAAuC,QAAQ,gBAAe;AAEvE,MAAMC,qBAAqB,CAAC,EAC1BC,MAAM,EACNC,UAAU,EACVC,cAAc,EACdC,KAAK,E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,+BAAkC8B,qBACjC,oBAACnB,6BAAgCmB;AAGvC,EAAC"}
@@ -1,4 +1,19 @@
1
1
  /// <reference types="react" resolution-mode="require"/>
2
- import type { RelationshipFeatureProps } from './feature.server.js';
3
- export declare const RelationshipFeatureClientComponent: import("react").FC<import("../types.js").ClientComponentProps<RelationshipFeatureProps>>;
2
+ export declare const RelationshipFeatureClientComponent: import("react").FC<({
3
+ featureKey: string;
4
+ order: number;
5
+ } & {
6
+ disabledCollections?: string[];
7
+ enabledCollections?: never;
8
+ } & {
9
+ maxDepth?: number;
10
+ }) | ({
11
+ featureKey: string;
12
+ order: number;
13
+ } & {
14
+ disabledCollections?: never;
15
+ enabledCollections?: string[];
16
+ } & {
17
+ maxDepth?: number;
18
+ })>;
4
19
  //# sourceMappingURL=feature.client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/relationship/feature.client.tsx"],"names":[],"mappings":";AAKA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAmDnE,eAAO,MAAM,kCAAkC,0FAAmD,CAAA"}
1
+ {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/relationship/feature.client.tsx"],"names":[],"mappings":";AA+EA,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;GAAmD,CAAA"}
@@ -1,10 +1,10 @@
1
1
  'use client';
2
- import { withMergedProps } from '@payloadcms/ui/elements/withMergedProps';
3
- import { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js';
2
+ import { $isNodeSelection } from 'lexical';
4
3
  import { RelationshipIcon } from '../../lexical/ui/icons/Relationship/index.js';
5
4
  import { createClientComponent } from '../createClientComponent.js';
5
+ import { toolbarAddDropdownGroupWithItems } from '../shared/toolbar/addDropdownGroup.js';
6
6
  import { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from './drawer/commands.js';
7
- import { RelationshipNode } from './nodes/RelationshipNode.js';
7
+ import { $isRelationshipNode, RelationshipNode } from './nodes/RelationshipNode.js';
8
8
  import { RelationshipPlugin } from './plugins/index.js';
9
9
  const RelationshipFeatureClient = (props)=>{
10
10
  return {
@@ -16,37 +16,59 @@ const RelationshipFeatureClient = (props)=>{
16
16
  ],
17
17
  plugins: [
18
18
  {
19
- Component: withMergedProps({
20
- Component: RelationshipPlugin,
21
- toMergeIntoProps: props
22
- }),
19
+ Component: RelationshipPlugin,
23
20
  position: 'normal'
24
21
  }
25
22
  ],
26
23
  slashMenu: {
27
- options: [
24
+ groups: [
28
25
  {
29
- displayName: 'Basic',
30
- key: 'basic',
31
- options: [
32
- new SlashMenuOption('relationship', {
26
+ items: [
27
+ {
33
28
  Icon: RelationshipIcon,
34
- displayName: 'Relationship',
29
+ key: 'relationship',
35
30
  keywords: [
36
31
  'relationship',
37
32
  'relation',
38
33
  'rel'
39
34
  ],
35
+ label: 'Relationship',
40
36
  onSelect: ({ editor })=>{
41
37
  // dispatch INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND
42
38
  editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {
43
39
  replace: false
44
40
  });
45
41
  }
46
- })
47
- ]
42
+ }
43
+ ],
44
+ key: 'basic',
45
+ label: 'Basic'
48
46
  }
49
47
  ]
48
+ },
49
+ toolbarFixed: {
50
+ groups: [
51
+ toolbarAddDropdownGroupWithItems([
52
+ {
53
+ ChildComponent: RelationshipIcon,
54
+ isActive: ({ selection })=>{
55
+ if (!$isNodeSelection(selection) || !selection.getNodes().length) {
56
+ return false;
57
+ }
58
+ const firstNode = selection.getNodes()[0];
59
+ return $isRelationshipNode(firstNode);
60
+ },
61
+ key: 'relationship',
62
+ label: 'Relationship',
63
+ onSelect: ({ editor })=>{
64
+ // dispatch INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND
65
+ editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {
66
+ replace: false
67
+ });
68
+ }
69
+ }
70
+ ])
71
+ ]
50
72
  }
51
73
  })
52
74
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/relationship/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { withMergedProps } from '@payloadcms/ui/elements/withMergedProps'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\nimport type { RelationshipFeatureProps } from './feature.server.js'\n\nimport { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport { RelationshipIcon } from '../../lexical/ui/icons/Relationship/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from './drawer/commands.js'\nimport { RelationshipNode } from './nodes/RelationshipNode.js'\nimport { RelationshipPlugin } from './plugins/index.js'\n\nconst RelationshipFeatureClient: FeatureProviderProviderClient<RelationshipFeatureProps> = (\n props,\n) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n nodes: [RelationshipNode],\n plugins: [\n {\n Component: withMergedProps({\n Component: RelationshipPlugin,\n toMergeIntoProps: props,\n }),\n position: 'normal',\n },\n ],\n slashMenu: {\n options: [\n {\n displayName: 'Basic',\n key: 'basic',\n options: [\n new SlashMenuOption('relationship', {\n Icon: RelationshipIcon,\n displayName: 'Relationship',\n keywords: ['relationship', 'relation', 'rel'],\n onSelect: ({ editor }) => {\n // dispatch INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: false,\n })\n },\n }),\n ],\n },\n ],\n },\n }),\n }\n}\n\nexport const RelationshipFeatureClientComponent = createClientComponent(RelationshipFeatureClient)\n"],"names":["withMergedProps","SlashMenuOption","RelationshipIcon","createClientComponent","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND","RelationshipNode","RelationshipPlugin","RelationshipFeatureClient","props","clientFeatureProps","feature","nodes","plugins","Component","toMergeIntoProps","position","slashMenu","options","displayName","key","Icon","keywords","onSelect","editor","dispatchCommand","replace","RelationshipFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,eAAe,QAAQ,0CAAyC;AAKzE,SAASC,eAAe,QAAQ,sEAAqE;AACrG,SAASC,gBAAgB,QAAQ,+CAA8C;AAC/E,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,uCAAuC,QAAQ,uBAAsB;AAC9E,SAASC,gBAAgB,QAAQ,8BAA6B;AAC9D,SAASC,kBAAkB,QAAQ,qBAAoB;AAEvD,MAAMC,4BAAqF,CACzFC;IAEA,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,OAAO;oBAACN;iBAAiB;gBACzBO,SAAS;oBACP;wBACEC,WAAWb,gBAAgB;4BACzBa,WAAWP;4BACXQ,kBAAkBN;wBACpB;wBACAO,UAAU;oBACZ;iBACD;gBACDC,WAAW;oBACTC,SAAS;wBACP;4BACEC,aAAa;4BACbC,KAAK;4BACLF,SAAS;gCACP,IAAIhB,gBAAgB,gBAAgB;oCAClCmB,MAAMlB;oCACNgB,aAAa;oCACbG,UAAU;wCAAC;wCAAgB;wCAAY;qCAAM;oCAC7CC,UAAU,CAAC,EAAEC,MAAM,EAAE;wCACnB,mDAAmD;wCACnDA,OAAOC,eAAe,CAACpB,yCAAyC;4CAC9DqB,SAAS;wCACX;oCACF;gCACF;6BACD;wBACH;qBACD;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMC,qCAAqCvB,sBAAsBI,2BAA0B"}
1
+ {"version":3,"sources":["../../../../src/field/features/relationship/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $isNodeSelection } from 'lexical'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\nimport type { RelationshipFeatureProps } from './feature.server.js'\n\nimport { RelationshipIcon } from '../../lexical/ui/icons/Relationship/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { toolbarAddDropdownGroupWithItems } from '../shared/toolbar/addDropdownGroup.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from './drawer/commands.js'\nimport { $isRelationshipNode, RelationshipNode } from './nodes/RelationshipNode.js'\nimport { RelationshipPlugin } from './plugins/index.js'\n\nconst RelationshipFeatureClient: FeatureProviderProviderClient<RelationshipFeatureProps> = (\n props,\n) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n nodes: [RelationshipNode],\n plugins: [\n {\n Component: RelationshipPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n {\n items: [\n {\n Icon: RelationshipIcon,\n key: 'relationship',\n keywords: ['relationship', 'relation', 'rel'],\n label: 'Relationship',\n onSelect: ({ editor }) => {\n // dispatch INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: false,\n })\n },\n },\n ],\n key: 'basic',\n label: 'Basic',\n },\n ],\n },\n toolbarFixed: {\n groups: [\n toolbarAddDropdownGroupWithItems([\n {\n ChildComponent: RelationshipIcon,\n isActive: ({ selection }) => {\n if (!$isNodeSelection(selection) || !selection.getNodes().length) {\n return false\n }\n\n const firstNode = selection.getNodes()[0]\n return $isRelationshipNode(firstNode)\n },\n key: 'relationship',\n label: 'Relationship',\n onSelect: ({ editor }) => {\n // dispatch INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: false,\n })\n },\n },\n ]),\n ],\n },\n }),\n }\n}\n\nexport const RelationshipFeatureClientComponent = createClientComponent(RelationshipFeatureClient)\n"],"names":["$isNodeSelection","RelationshipIcon","createClientComponent","toolbarAddDropdownGroupWithItems","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND","$isRelationshipNode","RelationshipNode","RelationshipPlugin","RelationshipFeatureClient","props","clientFeatureProps","feature","nodes","plugins","Component","position","slashMenu","groups","items","Icon","key","keywords","label","onSelect","editor","dispatchCommand","replace","toolbarFixed","ChildComponent","isActive","selection","getNodes","length","firstNode","RelationshipFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,gBAAgB,QAAQ,UAAS;AAK1C,SAASC,gBAAgB,QAAQ,+CAA8C;AAC/E,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,gCAAgC,QAAQ,wCAAuC;AACxF,SAASC,uCAAuC,QAAQ,uBAAsB;AAC9E,SAASC,mBAAmB,EAAEC,gBAAgB,QAAQ,8BAA6B;AACnF,SAASC,kBAAkB,QAAQ,qBAAoB;AAEvD,MAAMC,4BAAqF,CACzFC;IAEA,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,OAAO;oBAACN;iBAAiB;gBACzBO,SAAS;oBACP;wBACEC,WAAWP;wBACXQ,UAAU;oBACZ;iBACD;gBACDC,WAAW;oBACTC,QAAQ;wBACN;4BACEC,OAAO;gCACL;oCACEC,MAAMlB;oCACNmB,KAAK;oCACLC,UAAU;wCAAC;wCAAgB;wCAAY;qCAAM;oCAC7CC,OAAO;oCACPC,UAAU,CAAC,EAAEC,MAAM,EAAE;wCACnB,mDAAmD;wCACnDA,OAAOC,eAAe,CAACrB,yCAAyC;4CAC9DsB,SAAS;wCACX;oCACF;gCACF;6BACD;4BACDN,KAAK;4BACLE,OAAO;wBACT;qBACD;gBACH;gBACAK,cAAc;oBACZV,QAAQ;wBACNd,iCAAiC;4BAC/B;gCACEyB,gBAAgB3B;gCAChB4B,UAAU,CAAC,EAAEC,SAAS,EAAE;oCACtB,IAAI,CAAC9B,iBAAiB8B,cAAc,CAACA,UAAUC,QAAQ,GAAGC,MAAM,EAAE;wCAChE,OAAO;oCACT;oCAEA,MAAMC,YAAYH,UAAUC,QAAQ,EAAE,CAAC,EAAE;oCACzC,OAAO1B,oBAAoB4B;gCAC7B;gCACAb,KAAK;gCACLE,OAAO;gCACPC,UAAU,CAAC,EAAEC,MAAM,EAAE;oCACnB,mDAAmD;oCACnDA,OAAOC,eAAe,CAACrB,yCAAyC;wCAC9DsB,SAAS;oCACX;gCACF;4BACF;yBACD;qBACF;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMQ,qCAAqChC,sBAAsBM,2BAA0B"}
@@ -1,5 +1,5 @@
1
1
  import type { FeatureProviderProviderServer } from '../types.js';
2
- export type RelationshipFeatureProps = {
2
+ export type ExclusiveRelationshipFeatureProps = {
3
3
  /**
4
4
  * The collections that should be disabled. Overrides the `enableRichTextRelationship` property in the collection config.
5
5
  * When this property is set, `enabledCollections` will not be available.
@@ -14,5 +14,14 @@ export type RelationshipFeatureProps = {
14
14
  **/
15
15
  enabledCollections?: string[];
16
16
  };
17
+ export type RelationshipFeatureProps = ExclusiveRelationshipFeatureProps & {
18
+ /**
19
+ * Sets a maximum population depth for this relationship, regardless of the remaining depth when the respective field is reached.
20
+ * This behaves exactly like the maxDepth properties of relationship and upload fields.
21
+ *
22
+ * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}
23
+ */
24
+ maxDepth?: number;
25
+ };
17
26
  export declare const RelationshipFeature: FeatureProviderProviderServer<RelationshipFeatureProps, RelationshipFeatureProps>;
18
27
  //# sourceMappingURL=feature.server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/relationship/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAMhE,MAAM,MAAM,wBAAwB,GAChC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAG9B,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B,CAAA;AAEL,eAAO,MAAM,mBAAmB,EAAE,6BAA6B,CAC7D,wBAAwB,EACxB,wBAAwB,CAoBzB,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/relationship/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAOhE,MAAM,MAAM,iCAAiC,GACzC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAG9B,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B,CAAA;AAEL,MAAM,MAAM,wBAAwB,GAAG,iCAAiC,GAAG;IACzE;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,6BAA6B,CAC7D,wBAAwB,EACxB,wBAAwB,CAmBzB,CAAA"}
@@ -1,6 +1,7 @@
1
+ import { createNode } from '../typeUtilities.js';
1
2
  import { RelationshipFeatureClientComponent } from './feature.client.js';
2
3
  import { RelationshipNode } from './nodes/RelationshipNode.js';
3
- import { relationshipPopulationPromise } from './populationPromise.js';
4
+ import { relationshipPopulationPromiseHOC } from './populationPromise.js';
4
5
  export const RelationshipFeature = (props)=>{
5
6
  return {
6
7
  feature: ()=>{
@@ -8,12 +9,12 @@ export const RelationshipFeature = (props)=>{
8
9
  ClientComponent: RelationshipFeatureClientComponent,
9
10
  clientFeatureProps: props,
10
11
  nodes: [
11
- {
12
+ createNode({
12
13
  node: RelationshipNode,
13
14
  populationPromises: [
14
- relationshipPopulationPromise
15
+ relationshipPopulationPromiseHOC(props)
15
16
  ]
16
- }
17
+ })
17
18
  ],
18
19
  serverFeatureProps: props
19
20
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/relationship/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../types.js'\n\nimport { RelationshipFeatureClientComponent } from './feature.client.js'\nimport { RelationshipNode } from './nodes/RelationshipNode.js'\nimport { relationshipPopulationPromise } from './populationPromise.js'\n\nexport type RelationshipFeatureProps =\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?: string[]\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?: string[]\n }\n\nexport const RelationshipFeature: FeatureProviderProviderServer<\n RelationshipFeatureProps,\n RelationshipFeatureProps\n> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: RelationshipFeatureClientComponent,\n clientFeatureProps: props,\n nodes: [\n {\n node: RelationshipNode,\n populationPromises: [relationshipPopulationPromise],\n // TODO: Add validation similar to upload\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'relationship',\n serverFeatureProps: props,\n }\n}\n"],"names":["RelationshipFeatureClientComponent","RelationshipNode","relationshipPopulationPromise","RelationshipFeature","props","feature","ClientComponent","clientFeatureProps","nodes","node","populationPromises","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,kCAAkC,QAAQ,sBAAqB;AACxE,SAASC,gBAAgB,QAAQ,8BAA6B;AAC9D,SAASC,6BAA6B,QAAQ,yBAAwB;AAwBtE,OAAO,MAAMC,sBAGT,CAACC;IACH,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBN;gBACjBO,oBAAoBH;gBACpBI,OAAO;oBACL;wBACEC,MAAMR;wBACNS,oBAAoB;4BAACR;yBAA8B;oBAErD;iBACD;gBACDS,oBAAoBP;YACtB;QACF;QACAQ,KAAK;QACLD,oBAAoBP;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/features/relationship/feature.server.ts"],"sourcesContent":["import type { FeatureProviderProviderServer } from '../types.js'\n\nimport { createNode } from '../typeUtilities.js'\nimport { RelationshipFeatureClientComponent } from './feature.client.js'\nimport { RelationshipNode } from './nodes/RelationshipNode.js'\nimport { relationshipPopulationPromiseHOC } from './populationPromise.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?: string[]\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?: string[]\n }\n\nexport type RelationshipFeatureProps = ExclusiveRelationshipFeatureProps & {\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}\n\nexport const RelationshipFeature: FeatureProviderProviderServer<\n RelationshipFeatureProps,\n RelationshipFeatureProps\n> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: RelationshipFeatureClientComponent,\n clientFeatureProps: props,\n nodes: [\n createNode({\n node: RelationshipNode,\n populationPromises: [relationshipPopulationPromiseHOC(props)],\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'relationship',\n serverFeatureProps: props,\n }\n}\n"],"names":["createNode","RelationshipFeatureClientComponent","RelationshipNode","relationshipPopulationPromiseHOC","RelationshipFeature","props","feature","ClientComponent","clientFeatureProps","nodes","node","populationPromises","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,UAAU,QAAQ,sBAAqB;AAChD,SAASC,kCAAkC,QAAQ,sBAAqB;AACxE,SAASC,gBAAgB,QAAQ,8BAA6B;AAC9D,SAASC,gCAAgC,QAAQ,yBAAwB;AAkCzE,OAAO,MAAMC,sBAGT,CAACC;IACH,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBN;gBACjBO,oBAAoBH;gBACpBI,OAAO;oBACLT,WAAW;wBACTU,MAAMR;wBACNS,oBAAoB;4BAACR,iCAAiCE;yBAAO;oBAC/D;iBACD;gBACDO,oBAAoBP;YACtB;QACF;QACAQ,KAAK;QACLD,oBAAoBP;IACtB;AACF,EAAC"}
@@ -1,14 +1,10 @@
1
1
  /// <reference types="react" resolution-mode="require"/>
2
- import type { DOMConversionMap, DOMExportOutput, EditorConfig, ElementFormatType, LexicalEditor, LexicalNode, NodeKey, Spread } from 'lexical';
3
- import lexicalDecoratorBlockNodeImport from '@lexical/react/LexicalDecoratorBlockNode.js';
4
- declare const DecoratorBlockNode: typeof lexicalDecoratorBlockNodeImport.DecoratorBlockNode;
5
2
  import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
3
+ import type { DOMConversionMap, DOMExportOutput, EditorConfig, ElementFormatType, LexicalEditor, LexicalNode, NodeKey, Spread } from 'lexical';
4
+ import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
6
5
  export type RelationshipData = {
7
6
  relationTo: string;
8
- value: {
9
- [key: string]: unknown;
10
- id: string;
11
- };
7
+ value: number | string;
12
8
  };
13
9
  export type SerializedRelationshipNode = Spread<RelationshipData, SerializedDecoratorBlockNode>;
14
10
  export declare class RelationshipNode extends DecoratorBlockNode {
@@ -32,5 +28,4 @@ export declare class RelationshipNode extends DecoratorBlockNode {
32
28
  }
33
29
  export declare function $createRelationshipNode(data: RelationshipData): RelationshipNode;
34
30
  export declare function $isRelationshipNode(node: LexicalNode | RelationshipNode | null | undefined): node is RelationshipNode;
35
- export {};
36
31
  //# sourceMappingURL=RelationshipNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipNode.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/relationship/nodes/RelationshipNode.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,OAAO,EACP,MAAM,EACP,MAAM,SAAS,CAAA;AAEhB,OAAO,+BAA+B,MAAM,6CAA6C,CAAA;AACzF,QAAA,MAAQ,kBAAkB,2DAAoC,CAAA;AAE9D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAU/F,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE;QAEL,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;QACtB,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;CACF,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,gBAAgB,EAAE,4BAA4B,CAAC,CAAA;AAkB/F,qBAAa,gBAAiB,SAAQ,kBAAkB;IACtD,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;IAKD,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB;IAQtD,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB,MAAM,CAAC,SAAS,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;IAiB3D,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,0BAA0B,GAAG,gBAAgB;IAU/E,MAAM,CAAC,QAAQ,IAAI,KAAK;IAGxB,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;IAWlE,SAAS,IAAI,eAAe;IAU5B,UAAU,IAAI,0BAA0B;IASxC,OAAO,IAAI,gBAAgB;IAI3B,cAAc,IAAI,MAAM;IAIxB,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;CAItC;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAIhF;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,GAAG,gBAAgB,GAAG,IAAI,GAAG,SAAS,GACtD,IAAI,IAAI,gBAAgB,CAE1B"}
1
+ {"version":3,"file":"RelationshipNode.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/relationship/nodes/RelationshipNode.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAC/F,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,OAAO,EACP,MAAM,EACP,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAShF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,gBAAgB,EAAE,4BAA4B,CAAC,CAAA;AAgB/F,qBAAa,gBAAiB,SAAQ,kBAAkB;IACtD,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;IAKD,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB;IAQtD,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB,MAAM,CAAC,SAAS,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;IAiB3D,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,0BAA0B,GAAG,gBAAgB;IAc/E,MAAM,CAAC,QAAQ,IAAI,KAAK;IAIxB,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;IAUlE,SAAS,IAAI,eAAe;IAU5B,UAAU,IAAI,0BAA0B;IASxC,OAAO,IAAI,gBAAgB;IAI3B,cAAc,IAAI,MAAM;IAIxB,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;CAItC;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAIhF;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,GAAG,gBAAgB,GAAG,IAAI,GAAG,SAAS,GACtD,IAAI,IAAI,gBAAgB,CAE1B"}
@@ -1,5 +1,4 @@
1
- import lexicalDecoratorBlockNodeImport from '@lexical/react/LexicalDecoratorBlockNode.js';
2
- const { DecoratorBlockNode } = lexicalDecoratorBlockNodeImport;
1
+ import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
3
2
  import * as React from 'react';
4
3
  const RelationshipComponent = /*#__PURE__*/ React.lazy(()=>import('./components/RelationshipComponent.js').then((module)=>({
5
4
  default: module.RelationshipComponent
@@ -10,9 +9,7 @@ function relationshipElementToNode(domNode) {
10
9
  if (id != null && relationTo != null) {
11
10
  const node = $createRelationshipNode({
12
11
  relationTo,
13
- value: {
14
- id
15
- }
12
+ value: id
16
13
  });
17
14
  return {
18
15
  node
@@ -50,6 +47,9 @@ export class RelationshipNode extends DecoratorBlockNode {
50
47
  };
51
48
  }
52
49
  static importJSON(serializedNode) {
50
+ if (serializedNode.version === 1 && serializedNode?.value?.id) {
51
+ serializedNode.value = serializedNode.value.id;
52
+ }
53
53
  const importedData = {
54
54
  relationTo: serializedNode.relationTo,
55
55
  value: serializedNode.value
@@ -71,7 +71,7 @@ export class RelationshipNode extends DecoratorBlockNode {
71
71
  }
72
72
  exportDOM() {
73
73
  const element = document.createElement('div');
74
- element.setAttribute('data-lexical-relationship-id', this.__data?.value?.id);
74
+ element.setAttribute('data-lexical-relationship-id', String(this.__data?.value));
75
75
  element.setAttribute('data-lexical-relationship-relationTo', this.__data?.relationTo);
76
76
  const text = document.createTextNode(this.getTextContent());
77
77
  element.append(text);
@@ -84,14 +84,14 @@ export class RelationshipNode extends DecoratorBlockNode {
84
84
  ...super.exportJSON(),
85
85
  ...this.getData(),
86
86
  type: this.getType(),
87
- version: 1
87
+ version: 2
88
88
  };
89
89
  }
90
90
  getData() {
91
91
  return this.getLatest().__data;
92
92
  }
93
93
  getTextContent() {
94
- return `${this.__data?.relationTo} relation to ${this.__data?.value?.id}`;
94
+ return `${this.__data?.relationTo} relation to ${this.__data?.value}`;
95
95
  }
96
96
  setData(data) {
97
97
  const writable = this.getWritable();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/relationship/nodes/RelationshipNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\n\nimport lexicalDecoratorBlockNodeImport from '@lexical/react/LexicalDecoratorBlockNode.js'\nconst { DecoratorBlockNode } = lexicalDecoratorBlockNodeImport\n\nimport type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\n\nimport * as React from 'react'\n\nconst RelationshipComponent = React.lazy(() =>\n import('./components/RelationshipComponent.js').then((module) => ({\n default: module.RelationshipComponent,\n })),\n)\n\nexport type RelationshipData = {\n relationTo: string\n value: {\n // Actual relationship, populated in afterRead hook\n [key: string]: unknown\n id: string\n }\n}\n\nexport type SerializedRelationshipNode = Spread<RelationshipData, SerializedDecoratorBlockNode>\n\nfunction relationshipElementToNode(domNode: HTMLDivElement): DOMConversionOutput | null {\n const id = domNode.getAttribute('data-lexical-relationship-id')\n const relationTo = domNode.getAttribute('data-lexical-relationship-relationTo')\n\n if (id != null && relationTo != null) {\n const node = $createRelationshipNode({\n relationTo,\n value: {\n id,\n },\n })\n return { node }\n }\n return null\n}\n\nexport class RelationshipNode extends DecoratorBlockNode {\n __data: RelationshipData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: RelationshipData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static clone(node: RelationshipNode): RelationshipNode {\n return new RelationshipNode({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'relationship'\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {\n div: (domNode: HTMLDivElement) => {\n if (\n !domNode.hasAttribute('data-lexical-relationship-relationTo') ||\n !domNode.hasAttribute('data-lexical-relationship-id')\n ) {\n return null\n }\n return {\n conversion: relationshipElementToNode,\n priority: 2,\n }\n },\n }\n }\n\n static importJSON(serializedNode: SerializedRelationshipNode): RelationshipNode {\n const importedData: RelationshipData = {\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n const node = $createRelationshipNode(importedData)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <RelationshipComponent\n className={config.theme.relationship ?? 'LexicalEditorTheme__relationship'}\n data={this.__data}\n format={this.__format}\n nodeKey={this.getKey()}\n />\n )\n }\n\n exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n element.setAttribute('data-lexical-relationship-id', this.__data?.value?.id)\n element.setAttribute('data-lexical-relationship-relationTo', this.__data?.relationTo)\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n exportJSON(): SerializedRelationshipNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: this.getType(),\n version: 1,\n }\n }\n\n getData(): RelationshipData {\n return this.getLatest().__data\n }\n\n getTextContent(): string {\n return `${this.__data?.relationTo} relation to ${this.__data?.value?.id}`\n }\n\n setData(data: RelationshipData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n}\n\nexport function $createRelationshipNode(data: RelationshipData): RelationshipNode {\n return new RelationshipNode({\n data,\n })\n}\n\nexport function $isRelationshipNode(\n node: LexicalNode | RelationshipNode | null | undefined,\n): node is RelationshipNode {\n return node instanceof RelationshipNode\n}\n"],"names":["lexicalDecoratorBlockNodeImport","DecoratorBlockNode","React","RelationshipComponent","lazy","then","module","default","relationshipElementToNode","domNode","id","getAttribute","relationTo","node","$createRelationshipNode","value","RelationshipNode","__data","constructor","data","format","key","clone","__format","__key","getType","importDOM","div","hasAttribute","conversion","priority","importJSON","serializedNode","importedData","setFormat","isInline","decorate","editor","config","className","theme","relationship","nodeKey","getKey","exportDOM","element","document","createElement","setAttribute","text","createTextNode","getTextContent","append","exportJSON","getData","type","version","getLatest","setData","writable","getWritable","$isRelationshipNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAYA,OAAOA,qCAAqC,8CAA6C;AACzF,MAAM,EAAEC,kBAAkB,EAAE,GAAGD;AAI/B,YAAYE,WAAW,QAAO;AAE9B,MAAMC,sCAAwBD,MAAME,IAA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Ae;QACjE,qBACE,oBAACnC;YACCoC,WAAWD,OAAOE,KAAK,CAACC,YAAY,IAAI;YACxCtB,MAAM,IAAI,CAACF,MAAM;YACjBG,QAAQ,IAAI,CAACG,QAAQ;YACrBmB,SAAS,IAAI,CAACC,MAAM;;IAG1B;IAEAC,YAA6B;QAC3B,MAAMC,UAAUC,SAASC,aAAa,CAAC;QACvCF,QAAQG,YAAY,CAAC,gCAAgC,IAAI,CAAC/B,MAAM,EAAEF,OAAOL;QACzEmC,QAAQG,YAAY,CAAC,wCAAwC,IAAI,CAAC/B,MAAM,EAAEL;QAE1E,MAAMqC,OAAOH,SAASI,cAAc,CAAC,IAAI,CAACC,cAAc;QACxDN,QAAQO,MAAM,CAACH;QACf,OAAO;YAAEJ;QAAQ;IACnB;IAEAQ,aAAyC;QACvC,OAAO;YACL,GAAG,KAAK,CAACA,YAAY;YACrB,GAAG,IAAI,CAACC,OAAO,EAAE;YACjBC,MAAM,IAAI,CAAC9B,OAAO;YAClB+B,SAAS;QACX;IACF;IAEAF,UAA4B;QAC1B,OAAO,IAAI,CAACG,SAAS,GAAGxC,MAAM;IAChC;IAEAkC,iBAAyB;QACvB,OAAO,CAAC,EAAE,IAAI,CAAClC,MAAM,EAAEL,WAAW,aAAa,EAAE,IAAI,CAACK,MAAM,EAAEF,OAAOL,GAAG,CAAC;IAC3E;IAEAgD,QAAQvC,IAAsB,EAAQ;QACpC,MAAMwC,WAAW,IAAI,CAACC,WAAW;QACjCD,SAAS1C,MAAM,GAAGE;IACpB;AACF;AAEA,OAAO,SAASL,wBAAwBK,IAAsB;IAC5D,OAAO,IAAIH,iBAAiB;QAC1BG;IACF;AACF;AAEA,OAAO,SAAS0C,oBACdhD,IAAuD;IAEvD,OAAOA,gBAAgBG;AACzB"}
1
+ {"version":3,"sources":["../../../../../src/field/features/relationship/nodes/RelationshipNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport * as React from 'react'\n\nconst RelationshipComponent = React.lazy(() =>\n import('./components/RelationshipComponent.js').then((module) => ({\n default: module.RelationshipComponent,\n })),\n)\n\nexport type RelationshipData = {\n relationTo: string\n value: number | string\n}\n\nexport type SerializedRelationshipNode = Spread<RelationshipData, SerializedDecoratorBlockNode>\n\nfunction relationshipElementToNode(domNode: HTMLDivElement): DOMConversionOutput | null {\n const id = domNode.getAttribute('data-lexical-relationship-id')\n const relationTo = domNode.getAttribute('data-lexical-relationship-relationTo')\n\n if (id != null && relationTo != null) {\n const node = $createRelationshipNode({\n relationTo,\n value: id,\n })\n return { node }\n }\n return null\n}\n\nexport class RelationshipNode extends DecoratorBlockNode {\n __data: RelationshipData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: RelationshipData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static clone(node: RelationshipNode): RelationshipNode {\n return new RelationshipNode({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'relationship'\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {\n div: (domNode: HTMLDivElement) => {\n if (\n !domNode.hasAttribute('data-lexical-relationship-relationTo') ||\n !domNode.hasAttribute('data-lexical-relationship-id')\n ) {\n return null\n }\n return {\n conversion: relationshipElementToNode,\n priority: 2,\n }\n },\n }\n }\n\n static importJSON(serializedNode: SerializedRelationshipNode): RelationshipNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n\n const importedData: RelationshipData = {\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n const node = $createRelationshipNode(importedData)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <RelationshipComponent\n className={config.theme.relationship ?? 'LexicalEditorTheme__relationship'}\n data={this.__data}\n format={this.__format}\n nodeKey={this.getKey()}\n />\n )\n }\n exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n element.setAttribute('data-lexical-relationship-id', String(this.__data?.value))\n element.setAttribute('data-lexical-relationship-relationTo', this.__data?.relationTo)\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n exportJSON(): SerializedRelationshipNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: this.getType(),\n version: 2,\n }\n }\n\n getData(): RelationshipData {\n return this.getLatest().__data\n }\n\n getTextContent(): string {\n return `${this.__data?.relationTo} relation to ${this.__data?.value}`\n }\n\n setData(data: RelationshipData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n}\n\nexport function $createRelationshipNode(data: RelationshipData): RelationshipNode {\n return new RelationshipNode({\n data,\n })\n}\n\nexport function $isRelationshipNode(\n node: LexicalNode | RelationshipNode | null | undefined,\n): node is RelationshipNode {\n return node instanceof RelationshipNode\n}\n"],"names":["DecoratorBlockNode","React","RelationshipComponent","lazy","then","module","default","relationshipElementToNode","domNode","id","getAttribute","relationTo","node","$createRelationshipNode","value","RelationshipNode","__data","constructor","data","format","key","clone","__format","__key","getType","importDOM","div","hasAttribute","conversion","priority","importJSON","serializedNode","version","importedData","setFormat","isInline","decorate","editor","config","className","theme","relationship","nodeKey","getKey","exportDOM","element","document","createElement","setAttribute","String","text","createTextNode","getTextContent","append","exportJSON","getData","type","getLatest","setData","writable","getWritable","$isRelationshipNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAaA,SAASA,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OAAO,SAAS2C,oBACdjD,IAAuD;IAEvD,OAAOA,gBAAgBG;AACzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"RelationshipComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/relationship/nodes/components/RelationshipComponent.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAOhD,OAAO,KAA4C,MAAM,OAAO,CAAA;AAEhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAI9D,OAAO,cAAc,CAAA;AAQrB,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,gBAAgB,CAAA;IACtB,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AA8GD,eAAO,MAAM,qBAAqB,UAAW,KAAK,KAAG,MAAM,SAE1D,CAAA"}
1
+ {"version":3,"file":"RelationshipComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/relationship/nodes/components/RelationshipComponent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAoBhD,OAAO,KAA+D,MAAM,OAAO,CAAA;AAEnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAK9D,OAAO,cAAc,CAAA;AAQrB,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,gBAAgB,CAAA;IACtB,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AA8JD,eAAO,MAAM,qBAAqB,UAAW,KAAK,KAAG,MAAM,SAE1D,CAAA"}
@@ -1,25 +1,27 @@
1
1
  'use client';
2
- import lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js';
3
- const { useLexicalComposerContext } = lexicalComposerContextImport;
2
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
4
3
  import { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection.js';
4
+ import { mergeRegister } from '@lexical/utils';
5
5
  import { getTranslation } from '@payloadcms/translations';
6
- import lexicalImport from 'lexical';
7
- const { $getNodeByKey } = lexicalImport;
8
6
  import { Button } from '@payloadcms/ui/elements/Button';
9
7
  import { useDocumentDrawer } from '@payloadcms/ui/elements/DocumentDrawer';
10
8
  import usePayloadAPI from '@payloadcms/ui/hooks/usePayloadAPI';
11
9
  import { useConfig } from '@payloadcms/ui/providers/Config';
12
10
  import { useTranslation } from '@payloadcms/ui/providers/Translation';
13
- import React, { useCallback, useReducer, useState } from 'react';
11
+ import { $getSelection, $isNodeSelection, CLICK_COMMAND, COMMAND_PRIORITY_LOW, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND } from 'lexical';
12
+ import { $getNodeByKey } from 'lexical';
13
+ import React, { useCallback, useEffect, useReducer, useRef, useState } from 'react';
14
14
  import { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js';
15
15
  import { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from '../../drawer/commands.js';
16
+ import { $isRelationshipNode } from '../RelationshipNode.js';
16
17
  import './index.scss';
17
18
  const baseClass = 'lexical-relationship';
18
19
  const initialParams = {
19
20
  depth: 0
20
21
  };
21
22
  const Component = (props)=>{
22
- const { children, data: { relationTo, value: { id } }, nodeKey } = props;
23
+ const { children, data: { relationTo, value: id }, nodeKey } = props;
24
+ const relationshipElemRef = useRef(null);
23
25
  const [editor] = useLexicalComposerContext();
24
26
  const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey);
25
27
  const { field } = useEditorConfigContext();
@@ -54,12 +56,59 @@ const Component = (props)=>{
54
56
  setParams,
55
57
  closeDrawer
56
58
  ]);
59
+ const onDelete = useCallback((payload)=>{
60
+ if (isSelected && $isNodeSelection($getSelection())) {
61
+ const event = payload;
62
+ event.preventDefault();
63
+ const node = $getNodeByKey(nodeKey);
64
+ if ($isRelationshipNode(node)) {
65
+ node.remove();
66
+ return true;
67
+ }
68
+ }
69
+ return false;
70
+ }, [
71
+ isSelected,
72
+ nodeKey
73
+ ]);
74
+ const onClick = useCallback((payload)=>{
75
+ const event = payload;
76
+ // Check if relationshipElemRef.target or anything WITHIN relationshipElemRef.target was clicked
77
+ if (event.target === relationshipElemRef.current || relationshipElemRef.current?.contains(event.target)) {
78
+ if (event.shiftKey) {
79
+ setSelected(!isSelected);
80
+ } else {
81
+ if (!isSelected) {
82
+ clearSelection();
83
+ setSelected(true);
84
+ }
85
+ }
86
+ return true;
87
+ }
88
+ return false;
89
+ }, [
90
+ isSelected,
91
+ setSelected,
92
+ clearSelection
93
+ ]);
94
+ useEffect(()=>{
95
+ return mergeRegister(editor.registerCommand(CLICK_COMMAND, onClick, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_DELETE_COMMAND, onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_BACKSPACE_COMMAND, onDelete, COMMAND_PRIORITY_LOW));
96
+ }, [
97
+ clearSelection,
98
+ editor,
99
+ isSelected,
100
+ nodeKey,
101
+ onDelete,
102
+ setSelected,
103
+ onClick
104
+ ]);
57
105
  return /*#__PURE__*/ React.createElement("div", {
58
106
  className: [
59
107
  baseClass,
60
108
  isSelected && `${baseClass}--selected`
61
109
  ].filter(Boolean).join(' '),
62
- contentEditable: false
110
+ contentEditable: false,
111
+ ref: relationshipElemRef
63
112
  }, /*#__PURE__*/ React.createElement("div", {
64
113
  className: `${baseClass}__wrap`
65
114
  }, /*#__PURE__*/ React.createElement("p", {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/field/features/relationship/nodes/components/RelationshipComponent.tsx"],"sourcesContent":["'use client'\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection.js'\nimport { getTranslation } from '@payloadcms/translations'\nimport lexicalImport from 'lexical'\nconst { $getNodeByKey } = lexicalImport\n\nimport type { ElementFormatType } from 'lexical'\n\nimport { Button } from '@payloadcms/ui/elements/Button'\nimport { useDocumentDrawer } from '@payloadcms/ui/elements/DocumentDrawer'\nimport usePayloadAPI from '@payloadcms/ui/hooks/usePayloadAPI'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport React, { useCallback, useReducer, useState } from 'react'\n\nimport type { RelationshipData } from '../RelationshipNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from '../../drawer/commands.js'\nimport './index.scss'\n\nconst baseClass = 'lexical-relationship'\n\nconst initialParams = {\n depth: 0,\n}\n\ntype Props = {\n children?: React.ReactNode\n className?: string\n data: RelationshipData\n format?: ElementFormatType\n nodeKey?: string\n}\n\nconst Component: React.FC<Props> = (props) => {\n const {\n children,\n data: {\n relationTo,\n value: { id },\n },\n nodeKey,\n } = props\n\n const [editor] = useLexicalComposerContext()\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n const { field } = useEditorConfigContext()\n const {\n collections,\n routes: { api },\n serverURL,\n } = useConfig()\n\n const [relatedCollection, setRelatedCollection] = useState(() =>\n collections.find((coll) => coll.slug === relationTo),\n )\n\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${id}`,\n { initialParams },\n )\n\n const [DocumentDrawer, DocumentDrawerToggler, { closeDrawer }] = useDocumentDrawer({\n id,\n collectionSlug: relatedCollection.slug,\n })\n\n const removeRelationship = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey).remove()\n })\n }, [editor, nodeKey])\n\n const updateRelationship = React.useCallback(\n ({ doc }) => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n closeDrawer()\n dispatchCacheBust()\n },\n [cacheBust, setParams, closeDrawer],\n )\n\n return (\n <div\n className={[baseClass, isSelected && `${baseClass}--selected`].filter(Boolean).join(' ')}\n contentEditable={false}\n >\n <div className={`${baseClass}__wrap`}>\n <p className={`${baseClass}__label`}>\n {t('fields:labelRelationship', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n </p>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <p className={`${baseClass}__title`}>\n {data ? data[relatedCollection?.admin?.useAsTitle || 'id'] : id}\n </p>\n </DocumentDrawerToggler>\n </div>\n {editor.isEditable() && (\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swapButton`}\n disabled={field?.readOnly}\n el=\"div\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n tooltip={t('fields:swapRelationship')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={field?.readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeRelationship()\n }}\n round\n tooltip={t('fields:removeRelationship')}\n />\n </div>\n )}\n\n {id && <DocumentDrawer onSave={updateRelationship} />}\n {children}\n </div>\n )\n}\n\nexport const RelationshipComponent = (props: Props): React.ReactNode => {\n return <Component {...props} />\n}\n"],"names":["lexicalComposerContextImport","useLexicalComposerContext","useLexicalNodeSelection","getTranslation","lexicalImport","$getNodeByKey","Button","useDocumentDrawer","usePayloadAPI","useConfig","useTranslation","React","useCallback","useReducer","useState","useEditorConfigContext","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND","baseClass","initialParams","depth","Component","props","children","data","relationTo","value","id","nodeKey","editor","isSelected","setSelected","clearSelection","field","collections","routes","api","serverURL","relatedCollection","setRelatedCollection","find","coll","slug","i18n","t","cacheBust","dispatchCacheBust","state","setParams","DocumentDrawer","DocumentDrawerToggler","closeDrawer","collectionSlug","removeRelationship","update","remove","updateRelationship","doc","div","className","filter","Boolean","join","contentEditable","p","label","labels","singular","admin","useAsTitle","isEditable","buttonStyle","disabled","readOnly","el","icon","onClick","dispatchCommand","replace","round","tooltip","e","preventDefault","onSave","RelationshipComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AACA,OAAOA,kCAAkC,2CAA0C;AACnF,MAAM,EAAEC,yBAAyB,EAAE,GAAGD;AACtC,SAASE,uBAAuB,QAAQ,4CAA2C;AACnF,SAASC,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAE,GAAGD;AAI1B,SAASE,MAAM,QAAQ,iCAAgC;AACvD,SAASC,iBAAiB,QAAQ,yCAAwC;AAC1E,OAAOC,mBAAmB,qCAAoC;AAC9D,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,OAAOC,SAASC,WAAW,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,QAAO;AAIhE,SAASC,sBAAsB,QAAQ,4DAA2D;AAClG,SAASC,uCAAuC,QAAQ,2BAA0B;AAClF,OAAO,eAAc;AAErB,MAAMC,YAAY;AAElB,MAAMC,gBAAgB;IACpBC,OAAO;AACT;AAUA,MAAMC,YAA6B,CAACC;IAClC,MAAM,EACJC,QAAQ,EACRC,MAAM,EACJC,UA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AC;SAAC,CAAC0C,MAAM,CAACC,SAASC,IAAI,CAAC;QACpFC,iBAAiB;qBAEjB,oBAACL;QAAIC,WAAW,CAAC,EAAEzC,UAAU,MAAM,CAAC;qBAClC,oBAAC8C;QAAEL,WAAW,CAAC,EAAEzC,UAAU,OAAO,CAAC;OAChC0B,EAAE,4BAA4B;QAC7BqB,OAAO7D,eAAekC,kBAAkB4B,MAAM,CAACC,QAAQ,EAAExB;IAC3D,mBAEF,oBAACO;QAAsBS,WAAW,CAAC,EAAEzC,UAAU,oBAAoB,CAAC;qBAClE,oBAAC8C;QAAEL,WAAW,CAAC,EAAEzC,UAAU,OAAO,CAAC;OAChCM,OAAOA,IAAI,CAACc,mBAAmB8B,OAAOC,cAAc,KAAK,GAAG1C,OAIlEE,OAAOyC,UAAU,oBAChB,oBAACZ;QAAIC,WAAW,CAAC,EAAEzC,UAAU,SAAS,CAAC;qBACrC,oBAACX;QACCgE,aAAY;QACZZ,WAAW,CAAC,EAAEzC,UAAU,YAAY,CAAC;QACrCsD,UAAUvC,OAAOwC;QACjBC,IAAG;QACHC,MAAK;QACLC,SAAS;YACP/C,OAAOgD,eAAe,CAAC5D,yCAAyC;gBAC9D6D,SAAS;oBAAElD;gBAAQ;YACrB;QACF;QACAmD,OAAAA;QACAC,SAASpC,EAAE;sBAEb,oBAACrC;QACCgE,aAAY;QACZZ,WAAW,CAAC,EAAEzC,UAAU,cAAc,CAAC;QACvCsD,UAAUvC,OAAOwC;QACjBE,MAAK;QACLC,SAAS,CAACK;YACRA,EAAEC,cAAc;YAChB7B;QACF;QACA0B,OAAAA;QACAC,SAASpC,EAAE;SAKhBjB,oBAAM,oBAACsB;QAAekC,QAAQ3B;QAC9BjC;AAGP;AAEA,OAAO,MAAM6D,wBAAwB,CAAC9D;IACpC,qBAAO,oBAACD,WAAcC;AACxB,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/field/features/relationship/nodes/components/RelationshipComponent.tsx"],"sourcesContent":["'use client'\nimport type { ElementFormatType } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection.js'\nimport { mergeRegister } from '@lexical/utils'\nimport { getTranslation } from '@payloadcms/translations'\nimport { Button } from '@payloadcms/ui/elements/Button'\nimport { useDocumentDrawer } from '@payloadcms/ui/elements/DocumentDrawer'\nimport usePayloadAPI from '@payloadcms/ui/hooks/usePayloadAPI'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport {\n $getSelection,\n $isNodeSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n} from 'lexical'\nimport { $getNodeByKey } from 'lexical'\nimport React, { useCallback, useEffect, useReducer, useRef, useState } from 'react'\n\nimport type { RelationshipData } from '../RelationshipNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from '../../drawer/commands.js'\nimport { $isRelationshipNode } from '../RelationshipNode.js'\nimport './index.scss'\n\nconst baseClass = 'lexical-relationship'\n\nconst initialParams = {\n depth: 0,\n}\n\ntype Props = {\n children?: React.ReactNode\n className?: string\n data: RelationshipData\n format?: ElementFormatType\n nodeKey?: string\n}\n\nconst Component: React.FC<Props> = (props) => {\n const {\n children,\n data: { relationTo, value: id },\n nodeKey,\n } = props\n\n const relationshipElemRef = useRef<HTMLDivElement | null>(null)\n\n const [editor] = useLexicalComposerContext()\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n const { field } = useEditorConfigContext()\n const {\n collections,\n routes: { api },\n serverURL,\n } = useConfig()\n\n const [relatedCollection, setRelatedCollection] = useState(() =>\n collections.find((coll) => coll.slug === relationTo),\n )\n\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${id}`,\n { initialParams },\n )\n\n const [DocumentDrawer, DocumentDrawerToggler, { closeDrawer }] = useDocumentDrawer({\n id,\n collectionSlug: relatedCollection.slug,\n })\n\n const removeRelationship = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey).remove()\n })\n }, [editor, nodeKey])\n\n const updateRelationship = React.useCallback(\n ({ doc }) => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n closeDrawer()\n dispatchCacheBust()\n },\n [cacheBust, setParams, closeDrawer],\n )\n\n const onDelete = useCallback(\n (payload: KeyboardEvent) => {\n if (isSelected && $isNodeSelection($getSelection())) {\n const event: KeyboardEvent = payload\n event.preventDefault()\n const node = $getNodeByKey(nodeKey)\n if ($isRelationshipNode(node)) {\n node.remove()\n return true\n }\n }\n return false\n },\n [isSelected, nodeKey],\n )\n const onClick = useCallback(\n (payload: MouseEvent) => {\n const event = payload\n // Check if relationshipElemRef.target or anything WITHIN relationshipElemRef.target was clicked\n if (\n event.target === relationshipElemRef.current ||\n relationshipElemRef.current?.contains(event.target as Node)\n ) {\n if (event.shiftKey) {\n setSelected(!isSelected)\n } else {\n if (!isSelected) {\n clearSelection()\n setSelected(true)\n }\n }\n return true\n }\n\n return false\n },\n [isSelected, setSelected, clearSelection],\n )\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<MouseEvent>(CLICK_COMMAND, onClick, COMMAND_PRIORITY_LOW),\n\n editor.registerCommand(KEY_DELETE_COMMAND, onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, onDelete, COMMAND_PRIORITY_LOW),\n )\n }, [clearSelection, editor, isSelected, nodeKey, onDelete, setSelected, onClick])\n\n return (\n <div\n className={[baseClass, isSelected && `${baseClass}--selected`].filter(Boolean).join(' ')}\n contentEditable={false}\n ref={relationshipElemRef}\n >\n <div className={`${baseClass}__wrap`}>\n <p className={`${baseClass}__label`}>\n {t('fields:labelRelationship', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n </p>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <p className={`${baseClass}__title`}>\n {data ? data[relatedCollection?.admin?.useAsTitle || 'id'] : id}\n </p>\n </DocumentDrawerToggler>\n </div>\n {editor.isEditable() && (\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swapButton`}\n disabled={field?.readOnly}\n el=\"div\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n tooltip={t('fields:swapRelationship')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={field?.readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeRelationship()\n }}\n round\n tooltip={t('fields:removeRelationship')}\n />\n </div>\n )}\n\n {id && <DocumentDrawer onSave={updateRelationship} />}\n {children}\n </div>\n )\n}\n\nexport const RelationshipComponent = (props: Props): React.ReactNode => {\n return <Component {...props} />\n}\n"],"names":["useLexicalComposerContext","useLexicalNodeSelection","mergeRegister","getTranslation","Button","useDocumentDrawer","usePayloadAPI","useConfig","useTranslation","$getSelection","$isNodeSelection","CLICK_COMMAND","COMMAND_PRIORITY_LOW","KEY_BACKSPACE_COMMAND","KEY_DELETE_COMMAND","$getNodeByKey","React","useCallback","useEffect","useReducer","useRef","useState","useEditorConfigContext","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND","$isRelationshipNode","baseClass","initialParams","depth","Component","props","children","data","relationTo","value","id","nodeKey","relationshipElemRef","editor","isSelected","setSelected","clearSelection","field","collections","routes","api","serverURL","relatedCollection","setRelatedCollection","find","coll","slug","i18n","t","cacheBust","dispatchCacheBust","state","setParams","DocumentDrawer","DocumentDrawerToggler","closeDrawer","collectionSlug","removeRelationship","update","remove","updateRelationship","doc","onDelete","payload","event","preventDefault","node","onClick","target","current","contains","shiftKey","registerCommand","div","className","filter","Boolean","join","contentEditable","ref","p","label","labels","singular","admin","useAsTitle","isEditable","buttonStyle","disabled","readOnly","el","icon","dispatchCommand","replace","round","tooltip","e","onSave","RelationshipComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,uBAAuB,QAAQ,4CAA2C;AACnF,SAASC,aAAa,QAAQ,iBAAgB;AAC9C,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SAASC,MAAM,QAAQ,iCAAgC;AACvD,SAASC,iBAAiB,QAAQ,yCAAwC;AAC1E,OAAOC,mBAAmB,qCAAoC;AAC9D,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SACEC,aAAa,EACbC,gBAAgB,EAChBC,aAAa,EACbC,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,QACb,UAAS;AAChB,SAASC,aAAa,QAAQ,UAAS;AACvC,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,UAAU,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAInF,SAASC,sBAAsB,QAAQ,4DAA2D;AAClG,SAASC,uCAAuC,QAAQ,2BAA0B;AAClF,SAASC,mBAAmB,QAAQ,yBAAwB;AAC5D,OAAO,eAAc;AAErB,MAAMC,YAAY;AAElB,MAAMC,gBAAgB;IACpBC,OAAO;AACT;AAUA,MAAMC,YAA6B,CAACC;IAClC,MAAM,EACJC,QAAQ,EACRC,MAAM,EAAEC,UAA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AW,CAAC,EAAErD,UAAU,oBAAoB,CAAC;qBAClE,oBAAC2D;QAAEN,WAAW,CAAC,EAAErD,UAAU,OAAO,CAAC;OAChCM,OAAOA,IAAI,CAACe,mBAAmB0C,OAAOC,cAAc,KAAK,GAAGvD,OAIlEG,OAAOqD,UAAU,oBAChB,oBAACb;QAAIC,WAAW,CAAC,EAAErD,UAAU,SAAS,CAAC;qBACrC,oBAACrB;QACCuF,aAAY;QACZb,WAAW,CAAC,EAAErD,UAAU,YAAY,CAAC;QACrCmE,UAAUnD,OAAOoD;QACjBC,IAAG;QACHC,MAAK;QACLxB,SAAS;YACPlC,OAAO2D,eAAe,CAACzE,yCAAyC;gBAC9D0E,SAAS;oBAAE9D;gBAAQ;YACrB;QACF;QACA+D,OAAAA;QACAC,SAAS/C,EAAE;sBAEb,oBAAChD;QACCuF,aAAY;QACZb,WAAW,CAAC,EAAErD,UAAU,cAAc,CAAC;QACvCmE,UAAUnD,OAAOoD;QACjBE,MAAK;QACLxB,SAAS,CAAC6B;YACRA,EAAE/B,cAAc;YAChBR;QACF;QACAqC,OAAAA;QACAC,SAAS/C,EAAE;SAKhBlB,oBAAM,oBAACuB;QAAe4C,QAAQrC;QAC9BlC;AAGP;AAEA,OAAO,MAAMwE,wBAAwB,CAACzE;IACpC,qBAAO,oBAACD,WAAcC;AACxB,EAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { LexicalCommand } from 'lexical';
2
- import React from 'react';
2
+ import type { PluginComponent } from '../../types.js';
3
3
  import type { RelationshipFeatureProps } from '../feature.server.js';
4
4
  import type { RelationshipData } from '../nodes/RelationshipNode.js';
5
5
  export declare const INSERT_RELATIONSHIP_COMMAND: LexicalCommand<RelationshipData>;
6
- export declare function RelationshipPlugin(props?: RelationshipFeatureProps): React.ReactNode;
6
+ export declare const RelationshipPlugin: PluginComponent<RelationshipFeatureProps>;
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/relationship/plugins/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAKpE,eAAO,MAAM,2BAA2B,EAAE,cAAc,CAAC,gBAAgB,CAExE,CAAA;AAED,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,wBAAwB,GAAG,KAAK,CAAC,SAAS,CAqDpF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/relationship/plugins/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAgB7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAKpE,eAAO,MAAM,2BAA2B,EAAE,cAAc,CAAC,gBAAgB,CAExE,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAAC,wBAAwB,CAqDxE,CAAA"}