@payloadcms/richtext-lexical 4.0.0-internal.5f0cd13 → 4.0.0-internal.811e0a4

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 (384) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/cell/rscEntry.d.ts.map +1 -1
  3. package/dist/cell/rscEntry.js +5 -5
  4. package/dist/cell/rscEntry.js.map +1 -1
  5. package/dist/exports/client/Field-XH5C4HFU.js +2 -0
  6. package/dist/exports/client/Field-XH5C4HFU.js.map +7 -0
  7. package/dist/exports/client/bundled.css +1 -1
  8. package/dist/exports/client/chunk-5VIL27GI.js +2 -0
  9. package/dist/exports/client/chunk-5VIL27GI.js.map +7 -0
  10. package/dist/exports/client/chunk-ESITTE3C.js +2 -0
  11. package/dist/exports/client/chunk-ESITTE3C.js.map +7 -0
  12. package/dist/exports/client/chunk-UD4DQ4AK.js +2 -0
  13. package/dist/exports/client/chunk-UD4DQ4AK.js.map +7 -0
  14. package/dist/exports/client/chunk-X3D4LZS7.js +2 -0
  15. package/dist/exports/client/chunk-X3D4LZS7.js.map +7 -0
  16. package/dist/exports/client/{component-HKTAZ77E.js → component-PHZQBOJE.js} +2 -2
  17. package/dist/exports/client/componentInline-H24N7GUG.js +2 -0
  18. package/dist/exports/client/index.d.ts +0 -1
  19. package/dist/exports/client/index.d.ts.map +1 -1
  20. package/dist/exports/client/index.js +20 -21
  21. package/dist/exports/client/index.js.map +4 -4
  22. package/dist/features/blockquote/client/index.js +2 -2
  23. package/dist/features/blockquote/client/index.js.map +1 -1
  24. package/dist/features/blockquote/server/index.js +2 -2
  25. package/dist/features/blockquote/server/index.js.map +1 -1
  26. package/dist/features/blocks/client/component/index.css +2 -2
  27. package/dist/features/blocks/client/component/index.d.ts +1 -0
  28. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  29. package/dist/features/blocks/client/component/index.js +16 -8
  30. package/dist/features/blocks/client/component/index.js.map +1 -1
  31. package/dist/features/blocks/client/componentInline/index.css +8 -8
  32. package/dist/features/blocks/client/componentInline/index.d.ts +1 -0
  33. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  34. package/dist/features/blocks/client/componentInline/index.js +15 -7
  35. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  36. package/dist/features/blocks/client/index.d.ts.map +1 -1
  37. package/dist/features/blocks/client/index.js +4 -2
  38. package/dist/features/blocks/client/index.js.map +1 -1
  39. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +1 -1
  40. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -1
  41. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +1 -1
  42. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -1
  43. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +1 -1
  44. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -1
  45. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +5 -2
  46. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -1
  47. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +1 -2
  48. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  49. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  50. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  51. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  52. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  53. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.css +1 -1
  54. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.css +2 -4
  55. package/dist/features/blocks/premade/CodeBlock/Component/index.css +5 -5
  56. package/dist/features/blocks/server/index.d.ts.map +1 -1
  57. package/dist/features/blocks/server/index.js +6 -8
  58. package/dist/features/blocks/server/index.js.map +1 -1
  59. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +1 -1
  60. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  61. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  62. package/dist/features/blocks/server/schema.d.ts +5 -5
  63. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  64. package/dist/features/blocks/server/schema.js +28 -24
  65. package/dist/features/blocks/server/schema.js.map +1 -1
  66. package/dist/features/converters/lexicalToHtml/async/types.d.ts +13 -15
  67. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  68. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  69. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +13 -15
  70. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  71. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  72. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +2 -2
  73. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  74. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  75. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  76. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +12 -14
  77. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  78. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  79. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  80. package/dist/features/converters/lexicalToMarkdown/index.js +1 -1
  81. package/dist/features/converters/lexicalToMarkdown/index.js.map +1 -1
  82. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +12 -14
  83. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  84. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  85. package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
  86. package/dist/features/converters/markdownToLexical/index.js +5 -2
  87. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  88. package/dist/features/debug/jsxConverter/client/plugin/style.css +2 -2
  89. package/dist/features/experimental_table/client/index.js +2 -2
  90. package/dist/features/experimental_table/client/index.js.map +1 -1
  91. package/dist/features/experimental_table/markdownTransformer.d.ts +2 -2
  92. package/dist/features/experimental_table/markdownTransformer.d.ts.map +1 -1
  93. package/dist/features/experimental_table/markdownTransformer.js +6 -3
  94. package/dist/features/experimental_table/markdownTransformer.js.map +1 -1
  95. package/dist/features/experimental_table/server/index.js +2 -2
  96. package/dist/features/experimental_table/server/index.js.map +1 -1
  97. package/dist/features/experimental_table/server/schema.d.ts.map +1 -1
  98. package/dist/features/experimental_table/server/schema.js +6 -3
  99. package/dist/features/experimental_table/server/schema.js.map +1 -1
  100. package/dist/features/format/bold/feature.client.js +1 -1
  101. package/dist/features/format/bold/feature.client.js.map +1 -1
  102. package/dist/features/format/bold/feature.server.d.ts.map +1 -1
  103. package/dist/features/format/bold/feature.server.js +1 -1
  104. package/dist/features/format/bold/feature.server.js.map +1 -1
  105. package/dist/features/format/inlineCode/feature.client.js +1 -1
  106. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  107. package/dist/features/format/inlineCode/feature.server.d.ts.map +1 -1
  108. package/dist/features/format/inlineCode/feature.server.js +1 -1
  109. package/dist/features/format/inlineCode/feature.server.js.map +1 -1
  110. package/dist/features/format/italic/feature.client.js +1 -1
  111. package/dist/features/format/italic/feature.client.js.map +1 -1
  112. package/dist/features/format/italic/feature.server.d.ts.map +1 -1
  113. package/dist/features/format/italic/feature.server.js +1 -1
  114. package/dist/features/format/italic/feature.server.js.map +1 -1
  115. package/dist/features/format/strikethrough/feature.client.js +1 -1
  116. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  117. package/dist/features/format/strikethrough/feature.server.d.ts.map +1 -1
  118. package/dist/features/format/strikethrough/feature.server.js +1 -1
  119. package/dist/features/format/strikethrough/feature.server.js.map +1 -1
  120. package/dist/features/heading/client/index.js +2 -2
  121. package/dist/features/heading/client/index.js.map +1 -1
  122. package/dist/features/heading/markdownTransformer.d.ts +2 -2
  123. package/dist/features/heading/markdownTransformer.d.ts.map +1 -1
  124. package/dist/features/heading/markdownTransformer.js +6 -19
  125. package/dist/features/heading/markdownTransformer.js.map +1 -1
  126. package/dist/features/heading/server/index.js +2 -2
  127. package/dist/features/heading/server/index.js.map +1 -1
  128. package/dist/features/horizontalRule/client/index.js +2 -2
  129. package/dist/features/horizontalRule/client/index.js.map +1 -1
  130. package/dist/features/horizontalRule/client/markdownTransformer.d.ts +2 -2
  131. package/dist/features/horizontalRule/client/markdownTransformer.d.ts.map +1 -1
  132. package/dist/features/horizontalRule/client/markdownTransformer.js +1 -1
  133. package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
  134. package/dist/features/horizontalRule/client/plugin/index.css +2 -2
  135. package/dist/features/horizontalRule/server/index.js +2 -2
  136. package/dist/features/horizontalRule/server/index.js.map +1 -1
  137. package/dist/features/horizontalRule/server/markdownTransformer.d.ts +2 -2
  138. package/dist/features/horizontalRule/server/markdownTransformer.d.ts.map +1 -1
  139. package/dist/features/horizontalRule/server/markdownTransformer.js +1 -1
  140. package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
  141. package/dist/features/link/client/index.js +2 -2
  142. package/dist/features/link/client/index.js.map +1 -1
  143. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +3 -3
  144. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  145. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +7 -11
  146. package/dist/features/link/markdownTransformer.d.ts +4 -4
  147. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  148. package/dist/features/link/markdownTransformer.js +2 -2
  149. package/dist/features/link/markdownTransformer.js.map +1 -1
  150. package/dist/features/link/markdownTransformer.spec.js +10 -10
  151. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  152. package/dist/features/link/server/baseFields.js.map +1 -1
  153. package/dist/features/link/server/index.js +2 -2
  154. package/dist/features/link/server/index.js.map +1 -1
  155. package/dist/features/link/server/schema.d.ts.map +1 -1
  156. package/dist/features/link/server/schema.js +14 -9
  157. package/dist/features/link/server/schema.js.map +1 -1
  158. package/dist/features/lists/checklist/client/index.js +1 -1
  159. package/dist/features/lists/checklist/client/index.js.map +1 -1
  160. package/dist/features/lists/checklist/server/index.js +1 -1
  161. package/dist/features/lists/checklist/server/index.js.map +1 -1
  162. package/dist/features/lists/orderedList/client/index.js +1 -1
  163. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  164. package/dist/features/lists/orderedList/server/index.js +1 -1
  165. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  166. package/dist/features/lists/unorderedList/client/index.js +1 -1
  167. package/dist/features/lists/unorderedList/client/index.js.map +1 -1
  168. package/dist/features/lists/unorderedList/server/index.js +1 -1
  169. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  170. package/dist/features/relationship/server/schema.d.ts +3 -3
  171. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  172. package/dist/features/relationship/server/schema.js +27 -13
  173. package/dist/features/relationship/server/schema.js.map +1 -1
  174. package/dist/features/textState/feature.client.js +1 -1
  175. package/dist/features/textState/feature.client.js.map +1 -1
  176. package/dist/features/toolbars/fixed/client/Toolbar/index.css +2 -2
  177. package/dist/features/toolbars/inline/client/Toolbar/index.css +2 -13
  178. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +8 -12
  179. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  180. package/dist/features/toolbars/shared/useToolbarStates.d.ts.map +1 -1
  181. package/dist/features/toolbars/shared/useToolbarStates.js +3 -1
  182. package/dist/features/toolbars/shared/useToolbarStates.js.map +1 -1
  183. package/dist/features/typesClient.d.ts +1 -1
  184. package/dist/features/typesClient.d.ts.map +1 -1
  185. package/dist/features/typesClient.js.map +1 -1
  186. package/dist/features/typesServer.d.ts +2 -2
  187. package/dist/features/typesServer.d.ts.map +1 -1
  188. package/dist/features/typesServer.js.map +1 -1
  189. package/dist/features/upload/client/component/index.css +11 -11
  190. package/dist/features/upload/client/plugin/index.js +5 -5
  191. package/dist/features/upload/client/plugin/index.js.map +1 -1
  192. package/dist/features/upload/server/index.js +2 -2
  193. package/dist/features/upload/server/index.js.map +1 -1
  194. package/dist/features/upload/server/markdownTransformer.d.ts +2 -2
  195. package/dist/features/upload/server/markdownTransformer.d.ts.map +1 -1
  196. package/dist/features/upload/server/markdownTransformer.js +1 -1
  197. package/dist/features/upload/server/markdownTransformer.js.map +1 -1
  198. package/dist/features/upload/server/schema.d.ts +8 -8
  199. package/dist/features/upload/server/schema.d.ts.map +1 -1
  200. package/dist/features/upload/server/schema.js +59 -23
  201. package/dist/features/upload/server/schema.js.map +1 -1
  202. package/dist/field/Diff/converters/unknown/index.css +1 -1
  203. package/dist/field/Field.js +1 -1
  204. package/dist/field/Field.js.map +1 -1
  205. package/dist/field/ViewSelector.css +1 -1
  206. package/dist/field/bundled.css +1 -1
  207. package/dist/field/index.css +5 -5
  208. package/dist/field/index.js +1 -1
  209. package/dist/field/index.js.map +1 -1
  210. package/dist/field/rscEntry.d.ts.map +1 -1
  211. package/dist/field/rscEntry.js +2 -0
  212. package/dist/field/rscEntry.js.map +1 -1
  213. package/dist/index.d.ts +2 -2
  214. package/dist/index.d.ts.map +1 -1
  215. package/dist/index.js +3 -3
  216. package/dist/index.js.map +1 -1
  217. package/dist/lexical/LexicalEditor.css +2 -2
  218. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  219. package/dist/lexical/config/client/loader.js +5 -1
  220. package/dist/lexical/config/client/loader.js.map +1 -1
  221. package/dist/lexical/plugins/DecoratorPlugin/index.css +1 -1
  222. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  223. package/dist/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
  224. package/dist/lexical/plugins/MarkdownShortcut/index.js +1 -1
  225. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  226. package/dist/lexical/plugins/SlashMenu/index.css +1 -5
  227. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -1
  228. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +3 -3
  229. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +1 -1
  230. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  231. package/dist/lexical/theme/EditorTheme.css +18 -19
  232. package/dist/lexical/ui/ContentEditable.css +5 -5
  233. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts +17 -0
  234. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts.map +1 -0
  235. package/dist/lexical/utils/markdown/convertFromMarkdownString.js +27 -0
  236. package/dist/lexical/utils/markdown/convertFromMarkdownString.js.map +1 -0
  237. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +88 -0
  238. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +1 -0
  239. package/dist/lexical/utils/markdown/createBlockNode.d.ts +1 -1
  240. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  241. package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
  242. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts +25 -0
  243. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts.map +1 -0
  244. package/dist/lexical/utils/markdown/normalizeMarkdown.js +91 -0
  245. package/dist/lexical/utils/markdown/normalizeMarkdown.js.map +1 -0
  246. package/dist/lexical-proxy/@lexical-markdown.d.ts +1 -1
  247. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -1
  248. package/dist/lexical-proxy/@lexical-markdown.js +1 -1
  249. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -1
  250. package/dist/types/builtInNodes.d.ts.map +1 -1
  251. package/dist/types/builtInNodes.js +17 -17
  252. package/dist/types/builtInNodes.js.map +1 -1
  253. package/dist/types/index.d.ts +16 -16
  254. package/dist/types/index.d.ts.map +1 -1
  255. package/dist/types/index.js.map +1 -1
  256. package/dist/types/jsonSchemaHelpers.d.ts +2 -0
  257. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  258. package/dist/types/jsonSchemaHelpers.js +7 -3
  259. package/dist/types/jsonSchemaHelpers.js.map +1 -1
  260. package/dist/types/nodeTypes.d.ts +51 -9
  261. package/dist/types/nodeTypes.d.ts.map +1 -1
  262. package/dist/types/nodeTypes.js +3 -3
  263. package/dist/types/nodeTypes.js.map +1 -1
  264. package/dist/types/schema.d.ts.map +1 -1
  265. package/dist/types/schema.js +24 -7
  266. package/dist/types/schema.js.map +1 -1
  267. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  268. package/dist/utilities/applyBaseFilterToFields.js +1 -2
  269. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  270. package/dist/utilities/buildEditorState.d.ts +17 -3
  271. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  272. package/dist/utilities/buildEditorState.js +8 -0
  273. package/dist/utilities/buildEditorState.js.map +1 -1
  274. package/dist/utilities/buildInitialState.d.ts +2 -1
  275. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  276. package/dist/utilities/buildInitialState.js.map +1 -1
  277. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  278. package/dist/utilities/fieldsDrawer/Drawer.js +19 -10
  279. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  280. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts +4 -1
  281. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  282. package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -7
  283. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  284. package/dist/utilities/fieldsDrawer/index.css +12 -0
  285. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +29 -0
  286. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -0
  287. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js +97 -0
  288. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -0
  289. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +1 -1
  290. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  291. package/package.json +22 -26
  292. package/dist/exports/client/Field-G5Z2HM5Y.js +0 -2
  293. package/dist/exports/client/Field-G5Z2HM5Y.js.map +0 -7
  294. package/dist/exports/client/chunk-6QWQ7JV4.js +0 -2
  295. package/dist/exports/client/chunk-6QWQ7JV4.js.map +0 -7
  296. package/dist/exports/client/chunk-INBEEENE.js +0 -2
  297. package/dist/exports/client/chunk-INBEEENE.js.map +0 -7
  298. package/dist/exports/client/chunk-LH634DPU.js +0 -12
  299. package/dist/exports/client/chunk-LH634DPU.js.map +0 -7
  300. package/dist/exports/client/chunk-UAKNDD6R.js +0 -2
  301. package/dist/exports/client/chunk-UAKNDD6R.js.map +0 -7
  302. package/dist/exports/client/componentInline-D3A6OW76.js +0 -2
  303. package/dist/features/blockquote/markdownTransformer.d.ts +0 -3
  304. package/dist/features/blockquote/markdownTransformer.d.ts.map +0 -1
  305. package/dist/features/blockquote/markdownTransformer.js +0 -33
  306. package/dist/features/blockquote/markdownTransformer.js.map +0 -1
  307. package/dist/features/format/bold/markdownTransformers.d.ts +0 -6
  308. package/dist/features/format/bold/markdownTransformers.d.ts.map +0 -1
  309. package/dist/features/format/bold/markdownTransformers.js +0 -23
  310. package/dist/features/format/bold/markdownTransformers.js.map +0 -1
  311. package/dist/features/format/inlineCode/markdownTransformers.d.ts +0 -3
  312. package/dist/features/format/inlineCode/markdownTransformers.d.ts.map +0 -1
  313. package/dist/features/format/inlineCode/markdownTransformers.js +0 -6
  314. package/dist/features/format/inlineCode/markdownTransformers.js.map +0 -1
  315. package/dist/features/format/italic/markdownTransformers.d.ts +0 -4
  316. package/dist/features/format/italic/markdownTransformers.d.ts.map +0 -1
  317. package/dist/features/format/italic/markdownTransformers.js +0 -12
  318. package/dist/features/format/italic/markdownTransformers.js.map +0 -1
  319. package/dist/features/format/strikethrough/markdownTransformers.d.ts +0 -3
  320. package/dist/features/format/strikethrough/markdownTransformers.d.ts.map +0 -1
  321. package/dist/features/format/strikethrough/markdownTransformers.js +0 -6
  322. package/dist/features/format/strikethrough/markdownTransformers.js.map +0 -1
  323. package/dist/features/lists/checklist/markdownTransformers.d.ts +0 -3
  324. package/dist/features/lists/checklist/markdownTransformers.d.ts.map +0 -1
  325. package/dist/features/lists/checklist/markdownTransformers.js +0 -12
  326. package/dist/features/lists/checklist/markdownTransformers.js.map +0 -1
  327. package/dist/features/lists/orderedList/markdownTransformer.d.ts +0 -3
  328. package/dist/features/lists/orderedList/markdownTransformer.d.ts.map +0 -1
  329. package/dist/features/lists/orderedList/markdownTransformer.js +0 -12
  330. package/dist/features/lists/orderedList/markdownTransformer.js.map +0 -1
  331. package/dist/features/lists/shared/markdown.d.ts +0 -6
  332. package/dist/features/lists/shared/markdown.d.ts.map +0 -1
  333. package/dist/features/lists/shared/markdown.js +0 -57
  334. package/dist/features/lists/shared/markdown.js.map +0 -1
  335. package/dist/features/lists/unorderedList/markdownTransformer.d.ts +0 -3
  336. package/dist/features/lists/unorderedList/markdownTransformer.d.ts.map +0 -1
  337. package/dist/features/lists/unorderedList/markdownTransformer.js +0 -12
  338. package/dist/features/lists/unorderedList/markdownTransformer.js.map +0 -1
  339. package/dist/lexical/utils/guard.d.ts +0 -5
  340. package/dist/lexical/utils/guard.d.ts.map +0 -1
  341. package/dist/lexical/utils/guard.js +0 -9
  342. package/dist/lexical/utils/guard.js.map +0 -1
  343. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +0 -2
  344. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +0 -1
  345. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +0 -2
  346. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +0 -1
  347. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts +0 -14
  348. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts.map +0 -1
  349. package/dist/packages/@lexical/markdown/MarkdownExport.js +0 -213
  350. package/dist/packages/@lexical/markdown/MarkdownExport.js.map +0 -1
  351. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts +0 -19
  352. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +0 -1
  353. package/dist/packages/@lexical/markdown/MarkdownImport.js +0 -198
  354. package/dist/packages/@lexical/markdown/MarkdownImport.js.map +0 -1
  355. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts +0 -11
  356. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts.map +0 -1
  357. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +0 -304
  358. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +0 -1
  359. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts +0 -147
  360. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts.map +0 -1
  361. package/dist/packages/@lexical/markdown/MarkdownTransformers.js +0 -268
  362. package/dist/packages/@lexical/markdown/MarkdownTransformers.js.map +0 -1
  363. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts +0 -22
  364. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts.map +0 -1
  365. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +0 -91
  366. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +0 -1
  367. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts +0 -21
  368. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts.map +0 -1
  369. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +0 -54
  370. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +0 -1
  371. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts +0 -18
  372. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts.map +0 -1
  373. package/dist/packages/@lexical/markdown/importTextTransformers.js +0 -54
  374. package/dist/packages/@lexical/markdown/importTextTransformers.js.map +0 -1
  375. package/dist/packages/@lexical/markdown/index.d.ts +0 -29
  376. package/dist/packages/@lexical/markdown/index.d.ts.map +0 -1
  377. package/dist/packages/@lexical/markdown/index.js +0 -39
  378. package/dist/packages/@lexical/markdown/index.js.map +0 -1
  379. package/dist/packages/@lexical/markdown/utils.d.ts +0 -34
  380. package/dist/packages/@lexical/markdown/utils.d.ts.map +0 -1
  381. package/dist/packages/@lexical/markdown/utils.js +0 -267
  382. package/dist/packages/@lexical/markdown/utils.js.map +0 -1
  383. /package/dist/exports/client/{component-HKTAZ77E.js.map → component-PHZQBOJE.js.map} +0 -0
  384. /package/dist/exports/client/{componentInline-D3A6OW76.js.map → componentInline-H24N7GUG.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["sanitizeFields","createServerFeature","createNode","createLinkMarkdownTransformer","AutoLinkNode","LinkNode","linkPopulationPromiseHOC","i18n","createAutoLinkNodeJSONSchema","createLinkNodeJSONSchema","transformExtraFields","linkValidation","LinkFeature","feature","config","_config","isRoot","parentIsLocalized","props","validRelationships","collections","map","c","slug","_transformedFields","fields","enabledCollections","disabledCollections","maxDepth","sanitizedFields","requireFieldLevelRichTextEditor","sanitizedFieldsWithoutText","filter","field","name","linkTypeField","linkURLField","defaultLinkType","defaultValue","undefined","defaultLinkURL","ClientFeature","clientFeatureProps","disableAutoLinks","generateSchemaMap","Array","isArray","length","schemaMap","Map","set","markdownTransformers","internalDocToHref","nodes","jsonSchema","node","validations","getSubFields","getSubFieldsData","graphQLPopulationPromises","Boolean","sanitizedServerFeatureProps","key"],"sources":["../../../../src/features/link/server/index.ts"],"sourcesContent":["import type {\n CollectionSlug,\n Config,\n Field,\n FieldAffectingData,\n FieldSchemaMap,\n SanitizedConfig,\n} from 'payload'\n\nimport { sanitizeFields } from 'payload'\n\nimport type { NodeWithHooks } from '../../typesServer.js'\nimport type { ClientProps } from '../client/index.js'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { createLinkMarkdownTransformer } from '../markdownTransformer.js'\nimport { AutoLinkNode } from '../nodes/AutoLinkNode.js'\nimport { LinkNode } from '../nodes/LinkNode.js'\nimport { linkPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport {\n createAutoLinkNodeJSONSchema,\n createLinkNodeJSONSchema,\n type SerializedLinkNode,\n} from './schema.js'\nimport { transformExtraFields } from './transformExtraFields.js'\nimport { linkValidation } from './validate.js'\n\nexport type { LinkFields, SerializedAutoLinkNode, SerializedLinkNode } from './schema.js'\n\nexport type ExclusiveLinkCollectionsProps =\n | {\n /**\n * The collections that should be disabled for internal linking. Overrides the `enableRichTextLink` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: CollectionSlug[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled for internal linking. Overrides the `enableRichTextLink` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: CollectionSlug[]\n }\n\nexport type LinkFeatureServerProps = {\n /**\n * Disables the automatic creation of links from URLs pasted into the editor, as well\n * as auto link nodes.\n *\n * If set to 'creationOnly', only the creation of new auto link nodes will be disabled.\n * Existing auto link nodes will still be editable.\n *\n * @default false\n */\n disableAutoLinks?: 'creationOnly' | true\n /**\n * A function or array defining additional fields for the link feature. These will be\n * displayed in the link editor drawer.\n */\n fields?:\n | ((args: {\n config: SanitizedConfig\n defaultFields: FieldAffectingData[]\n }) => (Field | FieldAffectingData)[])\n | Field[]\n /**\n * Resolves an internal link node to a URL string for use in the markdown converter.\n * Internal links store a doc reference rather than a URL, so without this the markdown\n * output will have an empty href: `[link text]()`.\n */\n internalDocToHref?: (args: { linkNode: SerializedLinkNode }) => string\n /**\n * Sets a maximum population depth for the internal doc default field of link, regardless of the remaining depth when the 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} & ExclusiveLinkCollectionsProps\n\nexport const LinkFeature = createServerFeature<\n LinkFeatureServerProps,\n LinkFeatureServerProps,\n ClientProps\n>({\n feature: async ({ config: _config, isRoot, parentIsLocalized, props }) => {\n if (!props) {\n props = {}\n }\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n const _transformedFields = transformExtraFields(\n props.fields ? props.fields : null,\n _config,\n props.enabledCollections,\n props.disabledCollections,\n props.maxDepth,\n )\n\n const sanitizedFields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: _transformedFields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n props.fields = sanitizedFields\n\n // the text field is not included in the node data.\n // Thus, for tasks like validation, we do not want to pass it a text field in the schema which will never have data.\n // Otherwise, it will cause a validation error (field is required).\n const sanitizedFieldsWithoutText = sanitizedFields.filter(\n (field) => !('name' in field) || field.name !== 'text',\n )\n\n let linkTypeField: Field | null = null\n let linkURLField: Field | null = null\n\n for (const field of sanitizedFields) {\n if ('name' in field && field.name === 'linkType') {\n linkTypeField = field\n }\n\n if ('name' in field && field.name === 'url') {\n linkURLField = field\n }\n }\n\n const defaultLinkType = linkTypeField\n ? 'defaultValue' in linkTypeField && typeof linkTypeField.defaultValue === 'string'\n ? linkTypeField.defaultValue\n : 'custom'\n : undefined\n\n const defaultLinkURL = linkURLField\n ? 'defaultValue' in linkURLField && typeof linkURLField.defaultValue === 'string'\n ? linkURLField.defaultValue\n : 'https://'\n : undefined\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#LinkFeatureClient',\n clientFeatureProps: {\n defaultLinkType,\n defaultLinkURL,\n disableAutoLinks: props.disableAutoLinks,\n disabledCollections: props.disabledCollections,\n enabledCollections: props.enabledCollections,\n } as ClientProps,\n generateSchemaMap: () => {\n if (!sanitizedFields || !Array.isArray(sanitizedFields) || sanitizedFields.length === 0) {\n return null\n }\n\n const schemaMap: FieldSchemaMap = new Map()\n schemaMap.set('fields', {\n fields: sanitizedFields,\n })\n\n return schemaMap\n },\n i18n,\n markdownTransformers: [\n createLinkMarkdownTransformer({ internalDocToHref: props.internalDocToHref }),\n ],\n nodes: [\n props?.disableAutoLinks === true\n ? null\n : createNode({\n jsonSchema: createAutoLinkNodeJSONSchema(sanitizedFieldsWithoutText),\n node: AutoLinkNode,\n // Since AutoLinkNodes are just internal links, they need no hooks or graphQL population promises\n validations: [linkValidation(props, sanitizedFieldsWithoutText)],\n }),\n createNode({\n getSubFields: () => {\n return sanitizedFieldsWithoutText\n },\n getSubFieldsData: ({ node }) => {\n return node?.fields\n },\n graphQLPopulationPromises: [linkPopulationPromiseHOC(props)],\n jsonSchema: createLinkNodeJSONSchema(sanitizedFieldsWithoutText),\n node: LinkNode,\n validations: [linkValidation(props, sanitizedFieldsWithoutText)],\n }),\n ].filter(Boolean) as Array<NodeWithHooks>,\n sanitizedServerFeatureProps: props,\n }\n },\n key: 'link',\n})\n"],"mappings":"AASA,SAASA,cAAc,QAAQ;AAK/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,6BAA6B,QAAQ;AAC9C,SAASC,YAAY,QAAQ;AAC7B,SAASC,QAAQ,QAAQ;AACzB,SAASC,wBAAwB,QAAQ;AACzC,SAASC,IAAI,QAAQ;AACrB,SACEC,4BAA4B,EAC5BC,wBAAwB,QAEnB;AACP,SAASC,oBAAoB,QAAQ;AACrC,SAASC,cAAc,QAAQ;AA8D/B,OAAO,MAAMC,WAAA,GAAcX,mBAAA,CAIzB;EACAY,OAAA,EAAS,MAAAA,CAAO;IAAEC,MAAA,EAAQC,OAAO;IAAEC,MAAM;IAAEC,iBAAiB;IAAEC;EAAK,CAAE;IACnE,IAAI,CAACA,KAAA,EAAO;MACVA,KAAA,GAAQ,CAAC;IACX;IACA,MAAMC,kBAAA,GAAq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4C,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["sanitizeFields","createServerFeature","createNode","createPayloadLinkTransformer","AutoLinkNode","LinkNode","linkPopulationPromiseHOC","i18n","createAutoLinkNodeJSONSchema","createLinkNodeJSONSchema","transformExtraFields","linkValidation","LinkFeature","feature","config","_config","isRoot","parentIsLocalized","props","validRelationships","collections","map","c","slug","_transformedFields","fields","enabledCollections","disabledCollections","maxDepth","sanitizedFields","requireFieldLevelRichTextEditor","sanitizedFieldsWithoutText","filter","field","name","linkTypeField","linkURLField","defaultLinkType","defaultValue","undefined","defaultLinkURL","ClientFeature","clientFeatureProps","disableAutoLinks","generateSchemaMap","Array","isArray","length","schemaMap","Map","set","markdownTransformers","internalDocToHref","nodes","jsonSchema","node","validations","getSubFields","getSubFieldsData","graphQLPopulationPromises","Boolean","sanitizedServerFeatureProps","key"],"sources":["../../../../src/features/link/server/index.ts"],"sourcesContent":["import type {\n CollectionSlug,\n Config,\n Field,\n FieldAffectingData,\n FieldSchemaMap,\n SanitizedConfig,\n} from 'payload'\n\nimport { sanitizeFields } from 'payload'\n\nimport type { NodeWithHooks } from '../../typesServer.js'\nimport type { ClientProps } from '../client/index.js'\n\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { createPayloadLinkTransformer } from '../markdownTransformer.js'\nimport { AutoLinkNode } from '../nodes/AutoLinkNode.js'\nimport { LinkNode } from '../nodes/LinkNode.js'\nimport { linkPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport {\n createAutoLinkNodeJSONSchema,\n createLinkNodeJSONSchema,\n type SerializedLinkNode,\n} from './schema.js'\nimport { transformExtraFields } from './transformExtraFields.js'\nimport { linkValidation } from './validate.js'\n\nexport type { LinkFields, SerializedAutoLinkNode, SerializedLinkNode } from './schema.js'\n\nexport type ExclusiveLinkCollectionsProps =\n | {\n /**\n * The collections that should be disabled for internal linking. Overrides the `enableRichTextLink` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: CollectionSlug[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled for internal linking. Overrides the `enableRichTextLink` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: CollectionSlug[]\n }\n\nexport type LinkFeatureServerProps = {\n /**\n * Disables the automatic creation of links from URLs pasted into the editor, as well\n * as auto link nodes.\n *\n * If set to 'creationOnly', only the creation of new auto link nodes will be disabled.\n * Existing auto link nodes will still be editable.\n *\n * @default false\n */\n disableAutoLinks?: 'creationOnly' | true\n /**\n * A function or array defining additional fields for the link feature. These will be\n * displayed in the link editor drawer.\n */\n fields?:\n | ((args: {\n config: SanitizedConfig\n defaultFields: FieldAffectingData[]\n }) => (Field | FieldAffectingData)[])\n | Field[]\n /**\n * Resolves an internal link node to a URL string for use in the markdown converter.\n * Internal links store a doc reference rather than a URL, so without this the markdown\n * output will have an empty href: `[link text]()`.\n */\n internalDocToHref?: (args: { linkNode: SerializedLinkNode }) => string\n /**\n * Sets a maximum population depth for the internal doc default field of link, regardless of the remaining depth when the 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} & ExclusiveLinkCollectionsProps\n\nexport const LinkFeature = createServerFeature<\n LinkFeatureServerProps,\n LinkFeatureServerProps,\n ClientProps\n>({\n feature: async ({ config: _config, isRoot, parentIsLocalized, props }) => {\n if (!props) {\n props = {}\n }\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n const _transformedFields = transformExtraFields(\n props.fields ? props.fields : null,\n _config,\n props.enabledCollections,\n props.disabledCollections,\n props.maxDepth,\n )\n\n const sanitizedFields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: _transformedFields,\n parentIsLocalized,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n props.fields = sanitizedFields\n\n // the text field is not included in the node data.\n // Thus, for tasks like validation, we do not want to pass it a text field in the schema which will never have data.\n // Otherwise, it will cause a validation error (field is required).\n const sanitizedFieldsWithoutText = sanitizedFields.filter(\n (field) => !('name' in field) || field.name !== 'text',\n )\n\n let linkTypeField: Field | null = null\n let linkURLField: Field | null = null\n\n for (const field of sanitizedFields) {\n if ('name' in field && field.name === 'linkType') {\n linkTypeField = field\n }\n\n if ('name' in field && field.name === 'url') {\n linkURLField = field\n }\n }\n\n const defaultLinkType = linkTypeField\n ? 'defaultValue' in linkTypeField && typeof linkTypeField.defaultValue === 'string'\n ? linkTypeField.defaultValue\n : 'custom'\n : undefined\n\n const defaultLinkURL = linkURLField\n ? 'defaultValue' in linkURLField && typeof linkURLField.defaultValue === 'string'\n ? linkURLField.defaultValue\n : 'https://'\n : undefined\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#LinkFeatureClient',\n clientFeatureProps: {\n defaultLinkType,\n defaultLinkURL,\n disableAutoLinks: props.disableAutoLinks,\n disabledCollections: props.disabledCollections,\n enabledCollections: props.enabledCollections,\n } as ClientProps,\n generateSchemaMap: () => {\n if (!sanitizedFields || !Array.isArray(sanitizedFields) || sanitizedFields.length === 0) {\n return null\n }\n\n const schemaMap: FieldSchemaMap = new Map()\n schemaMap.set('fields', {\n fields: sanitizedFields,\n })\n\n return schemaMap\n },\n i18n,\n markdownTransformers: [\n createPayloadLinkTransformer({ internalDocToHref: props.internalDocToHref }),\n ],\n nodes: [\n props?.disableAutoLinks === true\n ? null\n : createNode({\n jsonSchema: createAutoLinkNodeJSONSchema(sanitizedFieldsWithoutText),\n node: AutoLinkNode,\n // Since AutoLinkNodes are just internal links, they need no hooks or graphQL population promises\n validations: [linkValidation(props, sanitizedFieldsWithoutText)],\n }),\n createNode({\n getSubFields: () => {\n return sanitizedFieldsWithoutText\n },\n getSubFieldsData: ({ node }) => {\n return node?.fields\n },\n graphQLPopulationPromises: [linkPopulationPromiseHOC(props)],\n jsonSchema: createLinkNodeJSONSchema(sanitizedFieldsWithoutText),\n node: LinkNode,\n validations: [linkValidation(props, sanitizedFieldsWithoutText)],\n }),\n ].filter(Boolean) as Array<NodeWithHooks>,\n sanitizedServerFeatureProps: props,\n }\n },\n key: 'link',\n})\n"],"mappings":"AASA,SAASA,cAAc,QAAQ;AAK/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,4BAA4B,QAAQ;AAC7C,SAASC,YAAY,QAAQ;AAC7B,SAASC,QAAQ,QAAQ;AACzB,SAASC,wBAAwB,QAAQ;AACzC,SAASC,IAAI,QAAQ;AACrB,SACEC,4BAA4B,EAC5BC,wBAAwB,QAEnB;AACP,SAASC,oBAAoB,QAAQ;AACrC,SAASC,cAAc,QAAQ;AA8D/B,OAAO,MAAMC,WAAA,GAAcX,mBAAA,CAIzB;EACAY,OAAA,EAAS,MAAAA,CAAO;IAAEC,MAAA,EAAQC,OAAO;IAAEC,MAAM;IAAEC,iBAAiB;IAAEC;EAAK,CAAE;IACnE,IAAI,CAACA,KAAA,EAAO;MACVA,KAAA,GAAQ,CAAC;IACX;IACA,MAAMC,kBAAA,GAAqBJ,OAAA,CAAQK,WAAW,CAACC,GAAG,CAAEC,CAAA,IAAMA,CAAA,CAAEC,IAAI,KAAK,EAAE;IAEvE,MAAMC,kBAAA,GAAqBd,oBAAA,CACzBQ,KAAA,CAAMO,MAAM,GAAGP,KAAA,CAAMO,MAAM,GAAG,MAC9BV,OAAA,EACAG,KAAA,CAAMQ,kBAAkB,EACxBR,KAAA,CAAMS,mBAAmB,EACzBT,KAAA,CAAMU,QAAQ;IAGhB,MAAMC,eAAA,GAAkB,MAAM7B,cAAA,CAAe;MAC3Cc,MAAA,EAAQC,OAAA;MACRU,MAAA,EAAQD,kBAAA;MACRP,iBAAA;MACAa,+BAAA,EAAiCd,MAAA;MACjCG;IACF;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EA,OAAOmB,SAAA;MACT;MACAzC,IAAA;MACA4C,oBAAA,EAAsB,CACpBhD,4BAAA,CAA6B;QAAEiD,iBAAA,EAAmBlC,KAAA,CAAMkC;MAAkB,GAC3E;MACDC,KAAA,EAAO,CACLnC,KAAA,EAAOyB,gBAAA,KAAqB,OACxB,OACAzC,UAAA,CAAW;QACToD,UAAA,EAAY9C,4BAAA,CAA6BuB,0BAAA;QACzCwB,IAAA,EAAMnD,YAAA;QACN;QACAoD,WAAA,EAAa,CAAC7C,cAAA,CAAeO,KAAA,EAAOa,0BAAA;MACtC,IACJ7B,UAAA,CAAW;QACTuD,YAAA,EAAcA,CAAA;UACZ,OAAO1B,0BAAA;QACT;QACA2B,gBAAA,EAAkBA,CAAC;UAAEH;QAAI,CAAE;UACzB,OAAOA,IAAA,EAAM9B,MAAA;QACf;QACAkC,yBAAA,EAA2B,CAACrD,wBAAA,CAAyBY,KAAA,EAAO;QAC5DoC,UAAA,EAAY7C,wBAAA,CAAyBsB,0BAAA;QACrCwB,IAAA,EAAMlD,QAAA;QACNmD,WAAA,EAAa,CAAC7C,cAAA,CAAeO,KAAA,EAAOa,0BAAA;MACtC,GACD,CAACC,MAAM,CAAC4B,OAAA;MACTC,2BAAA,EAA6B3C;IAC/B;EACF;EACA4C,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/link/server/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAI3D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExE,MAAM,MAAM,UAAU,GAAG;IACvB,6DAA6D;IAC7D,CAAC,CAAC,EAAE,MAAM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,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExE,MAAM,MAAM,UAAU,GAAG;IACvB,6DAA6D;IAC7D,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACpB,GAAG,CAAC,EAAE;QACJ,UAAU,EAAE,MAAM,CAAA;QAClB,yEAAyE;QACzE,KAAK,EAAE;YAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;YAAC,EAAE,EAAE,qBAAqB,CAAA;SAAE,GAAG,qBAAqB,CAAA;KACnF,GAAG,IAAI,CAAA;IACR,QAAQ,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC/B,MAAM,EAAE,OAAO,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,WAAW,kBAAkB,CACjC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,EAC/D,OAAO,GAAG,UAAU,CACpB,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAA;IACf,mEAAmE;IACnE,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,sBAAsB,CACrC,SAAS,SAAS,qBAAqB,GAAG,qBAAqB,EAC/D,OAAO,GAAG,UAAU,CACpB,SAAQ,4BAA4B,CAAC,SAAS,CAAC;IAC/C,MAAM,EAAE,OAAO,CAAA;IACf,IAAI,EAAE,UAAU,CAAA;CACjB;AAuHD,eAAO,MAAM,wBAAwB,GAClC,4BAA4B,KAAK,EAAE,KAAG,YActC,CAAA;AAEH,eAAO,MAAM,4BAA4B,GACtC,4BAA4B,KAAK,EAAE,KAAG,YAatC,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { createHash } from 'crypto';
1
2
  import { fieldsToJSONSchema, flattenAllFields } from 'payload';
2
3
  /**
3
4
  * MUST stay byte-for-byte in sync with the runtime `LinkFields`, `SerializedLinkNode`,
@@ -27,7 +28,8 @@ const buildLinkFieldsJSONSchema = (sanitizedFieldsWithoutText, {
27
28
  config,
28
29
  i18n,
29
30
  interfaceNameDefinitions,
30
- typeStringDefinitions
31
+ typeStringDefinitions,
32
+ variant
31
33
  }) => {
32
34
  const flattenedExtraFields = flattenAllFields({
33
35
  fields: sanitizedFieldsWithoutText
@@ -38,7 +40,8 @@ const buildLinkFieldsJSONSchema = (sanitizedFieldsWithoutText, {
38
40
  fields: flattenedExtraFields,
39
41
  i18n,
40
42
  interfaceNameDefinitions,
41
- typeStringDefinitions
43
+ typeStringDefinitions,
44
+ variant
42
45
  }) : {
43
46
  properties: {},
44
47
  required: []
@@ -91,15 +94,18 @@ const buildLinkFieldsJSONSchema = (sanitizedFieldsWithoutText, {
91
94
  type: 'string'
92
95
  }
93
96
  },
94
- required: ['linkType', 'newTab', ...userFieldsSchema.required]
97
+ // `linkType`/`newTab` are already in `userFieldsSchema.required`; use Set to dedupe,
98
+ // so `required` stays unique (draft 2020-12 enforces `uniqueItems`).
99
+ required: [...new Set(['linkType', 'newTab', ...userFieldsSchema.required])]
95
100
  };
96
101
  };
97
102
  /** Fields auto-attached by `LinkFeature` (see `transformExtraFields`). */
98
103
  const STANDARD_LINK_FIELD_NAMES = new Set(['doc', 'linkType', 'newTab', 'url']);
104
+ const hashLinkFields = schema => createHash('sha256').update(JSON.stringify(schema)).digest('hex').slice(0, 8).toUpperCase();
99
105
  /**
100
- * With custom link fields, emit a per-editor `LexicalLinkFields_<hash>`
101
- * interface so the link node picks up their real shape. Without any,
102
- * reuse the default `LexicalLinkFields` for cross-alias assignability.
106
+ * With custom link fields, emit a `LexicalLinkFields_<hash>` interface (hashed by its own content)
107
+ * so the link node picks up their real shape. Without any, reuse the default `LexicalLinkFields` for
108
+ * cross-alias assignability.
103
109
  */
104
110
  const resolveLinkFieldsRef = (sanitizedFieldsWithoutText, args) => {
105
111
  const fieldsSchema = buildLinkFieldsJSONSchema(sanitizedFieldsWithoutText, args);
@@ -110,12 +116,11 @@ const resolveLinkFieldsRef = (sanitizedFieldsWithoutText, args) => {
110
116
  fieldsTypeName: 'LexicalLinkFields'
111
117
  };
112
118
  }
113
- const editorHash = args.nodeUnionName.replace(/^LexicalNodes_/, '');
114
- const fieldsTypeName = `LexicalLinkFields_${editorHash}`;
119
+ const fieldsTypeName = `LexicalLinkFields_${hashLinkFields(fieldsSchema)}`;
115
120
  args.interfaceNameDefinitions.set(fieldsTypeName, fieldsSchema);
116
121
  return {
117
122
  fieldsRef: {
118
- $ref: `#/definitions/${fieldsTypeName}`
123
+ $ref: `#/$defs/${fieldsTypeName}`
119
124
  },
120
125
  fieldsTypeName
121
126
  };
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","names":["fieldsToJSONSchema","flattenAllFields","LINK_NODES_TS","buildLinkFieldsJSONSchema","sanitizedFieldsWithoutText","collectionIDFieldTypes","config","i18n","interfaceNameDefinitions","typeStringDefinitions","flattenedExtraFields","fields","userFieldsSchema","length","properties","required","type","additionalProperties","doc","oneOf","relationTo","value","id","linkType","enum","newTab","url","STANDARD_LINK_FIELD_NAMES","Set","resolveLinkFieldsRef","args","fieldsSchema","hasUserExtras","some","field","has","name","fieldsRef","fieldsTypeName","editorHash","nodeUnionName","replace","set","$ref","createLinkNodeJSONSchema","elementNodeSchema","add","nodeType","tsType","createAutoLinkNodeJSONSchema"],"sources":["../../../../src/features/link/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type { SerializedLexicalNode } from 'lexical'\nimport type { DefaultDocumentIDType, Field } from 'payload'\n\nimport { fieldsToJSONSchema, flattenAllFields } from 'payload'\n\nimport type { SerializedLexicalElementBase } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaArgs, JSONSchemaFn } from '../../typesServer.js'\n\nexport type LinkFields = {\n /** Custom fields added via `LinkFeature`'s `fields` prop. */\n [k: string]: unknown\n doc?: {\n relationTo: string\n /** Document ID, or the full doc when populated by the afterRead hook. */\n value: { [k: string]: unknown; id: DefaultDocumentIDType } | DefaultDocumentIDType\n } | null\n linkType: 'custom' | 'internal'\n newTab: boolean\n url?: string\n}\n\nexport interface SerializedLinkNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n TFields = LinkFields,\n> extends SerializedLexicalElementBase<TChildren> {\n fields: TFields\n /** @todo make required in 4.0 and type AutoLinkNode differently */\n id?: string\n type: 'link'\n}\n\nexport interface SerializedAutoLinkNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n TFields = LinkFields,\n> extends SerializedLexicalElementBase<TChildren> {\n fields: TFields\n type: 'autolink'\n}\n\n/**\n * MUST stay byte-for-byte in sync with the runtime `LinkFields`, `SerializedLinkNode`,\n * and `SerializedAutoLinkNode` declared above.\n */\nconst LINK_NODES_TS = `export interface LexicalLinkFields {\n [k: string]: unknown;\n doc?: {\n relationTo: string;\n value: Config['db']['defaultIDType'] | { [k: string]: unknown; id: Config['db']['defaultIDType'] };\n } | null;\n linkType: 'custom' | 'internal';\n newTab: boolean;\n url?: string;\n}\nexport interface SerializedLinkNode<TChildren, TFields = LexicalLinkFields> extends SerializedLexicalElementBase<TChildren> {\n type: 'link';\n fields: TFields;\n id?: string;\n}\nexport interface SerializedAutoLinkNode<TChildren, TFields = LexicalLinkFields> extends SerializedLexicalElementBase<TChildren> {\n type: 'autolink';\n fields: TFields;\n}`\n\nconst buildLinkFieldsJSONSchema = (\n sanitizedFieldsWithoutText: Field[],\n {\n collectionIDFieldTypes,\n config,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n }: JSONSchemaArgs,\n): JSONSchema4 => {\n const flattenedExtraFields = flattenAllFields({ fields: sanitizedFieldsWithoutText })\n const userFieldsSchema =\n flattenedExtraFields.length > 0 && config\n ? fieldsToJSONSchema({\n collectionIDFieldTypes,\n config,\n fields: flattenedExtraFields,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n })\n : { properties: {}, required: [] }\n\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n ...userFieldsSchema.properties,\n doc: {\n oneOf: [\n {\n type: 'object',\n additionalProperties: false,\n properties: {\n relationTo: { type: 'string' },\n value: {\n oneOf: [\n { type: 'string' },\n { type: 'number' },\n // Populated form (afterRead inflates `value` into the doc).\n {\n type: 'object',\n additionalProperties: true,\n properties: { id: { type: ['string', 'number'] } },\n required: ['id'],\n },\n ],\n },\n },\n required: ['relationTo', 'value'],\n },\n { type: 'null' },\n ],\n },\n linkType: { type: 'string', enum: ['custom', 'internal'] },\n newTab: { type: 'boolean' },\n url: { type: 'string' },\n },\n required: ['linkType', 'newTab', ...userFieldsSchema.required],\n }\n}\n\n/** Fields auto-attached by `LinkFeature` (see `transformExtraFields`). */\nconst STANDARD_LINK_FIELD_NAMES = new Set(['doc', 'linkType', 'newTab', 'url'])\n\n/**\n * With custom link fields, emit a per-editor `LexicalLinkFields_<hash>`\n * interface so the link node picks up their real shape. Without any,\n * reuse the default `LexicalLinkFields` for cross-alias assignability.\n */\nconst resolveLinkFieldsRef = (\n sanitizedFieldsWithoutText: Field[],\n args: JSONSchemaArgs,\n): { fieldsRef: JSONSchema4; fieldsTypeName: string } => {\n const fieldsSchema = buildLinkFieldsJSONSchema(sanitizedFieldsWithoutText, args)\n const hasUserExtras = sanitizedFieldsWithoutText.some(\n (field) => 'name' in field && !STANDARD_LINK_FIELD_NAMES.has(field.name),\n )\n if (!hasUserExtras) {\n return { fieldsRef: fieldsSchema, fieldsTypeName: 'LexicalLinkFields' }\n }\n const editorHash = args.nodeUnionName.replace(/^LexicalNodes_/, '')\n const fieldsTypeName = `LexicalLinkFields_${editorHash}`\n args.interfaceNameDefinitions.set(fieldsTypeName, fieldsSchema)\n return { fieldsRef: { $ref: `#/definitions/${fieldsTypeName}` }, fieldsTypeName }\n}\n\nexport const createLinkNodeJSONSchema =\n (sanitizedFieldsWithoutText: Field[]): JSONSchemaFn =>\n (args) => {\n const { elementNodeSchema, nodeUnionName, typeStringDefinitions } = args\n typeStringDefinitions.add(LINK_NODES_TS)\n const { fieldsRef, fieldsTypeName } = resolveLinkFieldsRef(sanitizedFieldsWithoutText, args)\n return elementNodeSchema({\n nodeType: 'link',\n properties: {\n id: { type: 'string' },\n fields: fieldsRef,\n },\n required: ['fields'],\n tsType: `SerializedLinkNode<${nodeUnionName}, ${fieldsTypeName}>`,\n })\n }\n\nexport const createAutoLinkNodeJSONSchema =\n (sanitizedFieldsWithoutText: Field[]): JSONSchemaFn =>\n (args) => {\n const { elementNodeSchema, nodeUnionName, typeStringDefinitions } = args\n typeStringDefinitions.add(LINK_NODES_TS)\n const { fieldsRef, fieldsTypeName } = resolveLinkFieldsRef(sanitizedFieldsWithoutText, args)\n return elementNodeSchema({\n nodeType: 'autolink',\n properties: {\n fields: fieldsRef,\n },\n required: ['fields'],\n tsType: `SerializedAutoLinkNode<${nodeUnionName}, ${fieldsTypeName}>`,\n })\n }\n"],"mappings":"AAIA,SAASA,kBAAkB,EAAEC,gBAAgB,QAAQ;AAoCrD;;;;AAIA,MAAMC,aAAA,GAAgB;;;;;;;;;;;;;;;;;;EAkBpB;AAEF,MAAMC,yBAAA,GAA4BA,CAChCC,0BAAA,EACA;EACEC,sBAAsB;EACtBC,MAAM;EACNC,IAAI;EACJC,wBAAwB;EACxBC;AAAqB,CACN;EAEjB,MAAMC,oBAAA,GAAuBT,gBAAA,CAAiB;IAAEU,MAAA,EAAQP;EAA2B;EACnF,MAAMQ,gBAAA,GACJF,oBAAA,CAAqBG,MAAM,GAAG,KAAKP,MAAA,GAC/BN,kBAAA,CAAmB;IACjBK,sBAAA;IACAC,MAAA;IACAK,MAAA,EAAQD,oBAAA;IACRH,IAAA;IACAC,wBAAA;IACAC;EACF,KACA;IAAEK,UAAA,EAAY,CAAC;IAAGC,QAAA,EAAU;EAAG;EAErC,OAAO;IACLC,IAAA,EAAM;IACNC,oBAAA,EAAsB;IACtBH,UAAA,EAAY;MACV,GAAGF,gBAAA,CAAiBE,UAAU;MAC9BI,GAAA,EAAK;QACHC,KAAA,EAAO,CACL;UACEH,IAAA,EAAM;UACNC,oB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_TS","buildLinkFieldsJSONSchema","sanitizedFieldsWithoutText","collectionIDFieldTypes","config","i18n","interfaceNameDefinitions","typeStringDefinitions","variant","flattenedExtraFields","fields","userFieldsSchema","length","properties","required","type","additionalProperties","doc","oneOf","relationTo","value","id","linkType","enum","newTab","url","Set","STANDARD_LINK_FIELD_NAMES","hashLinkFields","schema","update","JSON","stringify","digest","slice","toUpperCase","resolveLinkFieldsRef","args","fieldsSchema","hasUserExtras","some","field","has","name","fieldsRef","fieldsTypeName","set","$ref","createLinkNodeJSONSchema","elementNodeSchema","nodeUnionName","add","nodeType","tsType","createAutoLinkNodeJSONSchema"],"sources":["../../../../src/features/link/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type { SerializedLexicalNode } from 'lexical'\nimport type { DefaultDocumentIDType, Field } from 'payload'\n\nimport { createHash } from 'crypto'\nimport { fieldsToJSONSchema, flattenAllFields } from 'payload'\n\nimport type { SerializedLexicalElementBase } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaArgs, JSONSchemaFn } from '../../typesServer.js'\n\nexport type LinkFields = {\n /** Custom fields added via `LinkFeature`'s `fields` prop. */\n [k: string]: unknown\n doc?: {\n relationTo: string\n /** Document ID, or the full doc when populated by the afterRead hook. */\n value: { [k: string]: unknown; id: DefaultDocumentIDType } | DefaultDocumentIDType\n } | null\n linkType: 'custom' | 'internal'\n newTab: boolean\n url?: string\n}\n\nexport interface SerializedLinkNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n TFields = LinkFields,\n> extends SerializedLexicalElementBase<TChildren> {\n fields: TFields\n /** @todo make required in 4.0 and type AutoLinkNode differently */\n id?: string\n type: 'link'\n}\n\nexport interface SerializedAutoLinkNode<\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n TFields = LinkFields,\n> extends SerializedLexicalElementBase<TChildren> {\n fields: TFields\n type: 'autolink'\n}\n\n/**\n * MUST stay byte-for-byte in sync with the runtime `LinkFields`, `SerializedLinkNode`,\n * and `SerializedAutoLinkNode` declared above.\n */\nconst LINK_NODES_TS = `export interface LexicalLinkFields {\n [k: string]: unknown;\n doc?: {\n relationTo: string;\n value: Config['db']['defaultIDType'] | { [k: string]: unknown; id: Config['db']['defaultIDType'] };\n } | null;\n linkType: 'custom' | 'internal';\n newTab: boolean;\n url?: string;\n}\nexport interface SerializedLinkNode<TChildren, TFields = LexicalLinkFields> extends SerializedLexicalElementBase<TChildren> {\n type: 'link';\n fields: TFields;\n id?: string;\n}\nexport interface SerializedAutoLinkNode<TChildren, TFields = LexicalLinkFields> extends SerializedLexicalElementBase<TChildren> {\n type: 'autolink';\n fields: TFields;\n}`\n\nconst buildLinkFieldsJSONSchema = (\n sanitizedFieldsWithoutText: Field[],\n {\n collectionIDFieldTypes,\n config,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n variant,\n }: JSONSchemaArgs,\n): JSONSchema4 => {\n const flattenedExtraFields = flattenAllFields({ fields: sanitizedFieldsWithoutText })\n const userFieldsSchema =\n flattenedExtraFields.length > 0 && config\n ? fieldsToJSONSchema({\n collectionIDFieldTypes,\n config,\n fields: flattenedExtraFields,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n variant,\n })\n : { properties: {}, required: [] }\n\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n ...userFieldsSchema.properties,\n doc: {\n oneOf: [\n {\n type: 'object',\n additionalProperties: false,\n properties: {\n relationTo: { type: 'string' },\n value: {\n oneOf: [\n { type: 'string' },\n { type: 'number' },\n // Populated form (afterRead inflates `value` into the doc).\n {\n type: 'object',\n additionalProperties: true,\n properties: { id: { type: ['string', 'number'] } },\n required: ['id'],\n },\n ],\n },\n },\n required: ['relationTo', 'value'],\n },\n { type: 'null' },\n ],\n },\n linkType: { type: 'string', enum: ['custom', 'internal'] },\n newTab: { type: 'boolean' },\n url: { type: 'string' },\n },\n // `linkType`/`newTab` are already in `userFieldsSchema.required`; use Set to dedupe,\n // so `required` stays unique (draft 2020-12 enforces `uniqueItems`).\n required: [...new Set(['linkType', 'newTab', ...userFieldsSchema.required])],\n }\n}\n\n/** Fields auto-attached by `LinkFeature` (see `transformExtraFields`). */\nconst STANDARD_LINK_FIELD_NAMES = new Set(['doc', 'linkType', 'newTab', 'url'])\n\nconst hashLinkFields = (schema: JSONSchema4): string =>\n createHash('sha256').update(JSON.stringify(schema)).digest('hex').slice(0, 8).toUpperCase()\n\n/**\n * With custom link fields, emit a `LexicalLinkFields_<hash>` interface (hashed by its own content)\n * so the link node picks up their real shape. Without any, reuse the default `LexicalLinkFields` for\n * cross-alias assignability.\n */\nconst resolveLinkFieldsRef = (\n sanitizedFieldsWithoutText: Field[],\n args: JSONSchemaArgs,\n): { fieldsRef: JSONSchema4; fieldsTypeName: string } => {\n const fieldsSchema = buildLinkFieldsJSONSchema(sanitizedFieldsWithoutText, args)\n const hasUserExtras = sanitizedFieldsWithoutText.some(\n (field) => 'name' in field && !STANDARD_LINK_FIELD_NAMES.has(field.name),\n )\n if (!hasUserExtras) {\n return { fieldsRef: fieldsSchema, fieldsTypeName: 'LexicalLinkFields' }\n }\n const fieldsTypeName = `LexicalLinkFields_${hashLinkFields(fieldsSchema)}`\n args.interfaceNameDefinitions.set(fieldsTypeName, fieldsSchema)\n return { fieldsRef: { $ref: `#/$defs/${fieldsTypeName}` }, fieldsTypeName }\n}\n\nexport const createLinkNodeJSONSchema =\n (sanitizedFieldsWithoutText: Field[]): JSONSchemaFn =>\n (args) => {\n const { elementNodeSchema, nodeUnionName, typeStringDefinitions } = args\n typeStringDefinitions.add(LINK_NODES_TS)\n const { fieldsRef, fieldsTypeName } = resolveLinkFieldsRef(sanitizedFieldsWithoutText, args)\n return elementNodeSchema({\n nodeType: 'link',\n properties: {\n id: { type: 'string' },\n fields: fieldsRef,\n },\n required: ['fields'],\n tsType: `SerializedLinkNode<${nodeUnionName}, ${fieldsTypeName}>`,\n })\n }\n\nexport const createAutoLinkNodeJSONSchema =\n (sanitizedFieldsWithoutText: Field[]): JSONSchemaFn =>\n (args) => {\n const { elementNodeSchema, nodeUnionName, typeStringDefinitions } = args\n typeStringDefinitions.add(LINK_NODES_TS)\n const { fieldsRef, fieldsTypeName } = resolveLinkFieldsRef(sanitizedFieldsWithoutText, args)\n return elementNodeSchema({\n nodeType: 'autolink',\n properties: {\n fields: fieldsRef,\n },\n required: ['fields'],\n tsType: `SerializedAutoLinkNode<${nodeUnionName}, ${fieldsTypeName}>`,\n })\n }\n"],"mappings":"AAIA,SAASA,UAAU,QAAQ;AAC3B,SAASC,kBAAkB,EAAEC,gBAAgB,QAAQ;AAoCrD;;;;AAIA,MAAMC,aAAA,GAAgB;;;;;;;;;;;;;;;;;;EAkBpB;AAEF,MAAMC,yBAAA,GAA4BA,CAChCC,0BAAA,EACA;EACEC,sBAAsB;EACtBC,MAAM;EACNC,IAAI;EACJC,wBAAwB;EACxBC,qBAAqB;EACrBC;AAAO,CACQ;EAEjB,MAAMC,oBAAA,GAAuBV,gBAAA,CAAiB;IAAEW,MAAA,EAAQR;EAA2B;EACnF,MAAMS,gBAAA,GACJF,oBAAA,CAAqBG,MAAM,GAAG,KAAKR,MAAA,GAC/BN,kBAAA,CAAmB;IACjBK,sBAAA;IACAC,MAAA;IACAM,MAAA,EAAQD,oBAAA;IACRJ,IAAA;IACAC,wBAAA;IACAC,qBAAA;IACAC;EACF,KACA;IAAEK,UAAA,EAAY,CAAC;IAAGC,QAAA,EAAU;EAAG;EAErC,OAAO;IACLC,IAAA,EAAM;IACNC,oBAAA,EAAsB;IACtBH,UAAA,EAAY;MACV,GAAGF,gBAAA,CAAiBE,UAAU;MAC9BI,GAAA,EAAK;QACHC,KAAA,EAAO,CACL;UACEH,IAAA,EAAM;UACNC,oBAAA,EAAsB;UACtBH,UAAA,EAAY;YACVM,UAAA,EAAY;cAAEJ,IAAA,EAAM;YAAS;YAC7BK,KAAA,EAAO;cACLF,KAAA,EAAO,CACL;gBAAEH,IAAA,EAAM;cAAS,GACjB;gBAAEA,IAAA,EAAM;cA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exical/list';
4
+ import { CHECK_LIST } from '@lexical/markdown';
4
5
  import { $isRangeSelection } from 'lexical';
5
6
  import { ChecklistIcon } from '../../../../lexical/ui/icons/Checklist/index.js';
6
7
  import { createClientFeature } from '../../../../utilities/createClientFeature.js';
@@ -8,7 +9,6 @@ import { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textD
8
9
  import { LexicalListPlugin } from '../../plugin/index.js';
9
10
  import { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js';
10
11
  import { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js';
11
- import { CHECK_LIST } from '../markdownTransformers.js';
12
12
  import { LexicalCheckListPlugin } from './plugin/index.js';
13
13
  const toolbarGroups = [toolbarTextDropdownGroupWithItems([{
14
14
  ChildComponent: ChecklistIcon,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["$isListNode","INSERT_CHECK_LIST_COMMAND","ListItemNode","ListNode","$isRangeSelection","ChecklistIcon","createClientFeature","toolbarTextDropdownGroupWithItems","LexicalListPlugin","shouldRegisterListBaseNodes","slashMenuListGroupWithItems","CHECK_LIST","LexicalCheckListPlugin","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getListType","parent","getParent","parentParent","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","ChecklistFeatureClient","featureProviderMap","plugins","Component","position","shouldRegister","push","markdownTransformers","nodes","slashMenu","groups","Icon","keywords","toolbarFixed","toolbarInline"],"sources":["../../../../../src/features/lists/checklist/client/index.tsx"],"sourcesContent":["'use client'\nimport { $isListNode, INSERT_CHECK_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list'\nimport { $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../../toolbars/types.js'\nimport type { ClientFeature } from '../../../typesClient.js'\n\nimport { ChecklistIcon } from '../../../../lexical/ui/icons/Checklist/index.js'\nimport { createClientFeature } from '../../../../utilities/createClientFeature.js'\nimport { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js'\nimport { LexicalListPlugin } from '../../plugin/index.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js'\nimport { CHECK_LIST } from '../markdownTransformers.js'\nimport { LexicalCheckListPlugin } from './plugin/index.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: ChecklistIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isListNode(node) && node.getListType() === 'check') {\n continue\n }\n\n const parent = node.getParent()\n\n if ($isListNode(parent) && parent.getListType() === 'check') {\n continue\n }\n\n const parentParent = parent?.getParent()\n // Example scenario: Node = textNode, parent = listItemNode, parentParent = listNode\n if ($isListNode(parentParent) && parentParent.getListType() === 'check') {\n continue\n }\n\n return false\n }\n return true\n },\n key: 'checklist',\n label: ({ i18n }) => {\n return i18n.t('lexical:checklist:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, undefined)\n },\n order: 12,\n },\n ]),\n]\n\nexport const ChecklistFeatureClient = createClientFeature(({ featureProviderMap }) => {\n const plugins: ClientFeature<undefined>['plugins'] = [\n {\n Component: LexicalCheckListPlugin,\n position: 'normal',\n },\n ]\n\n const shouldRegister = shouldRegisterListBaseNodes('checklist', featureProviderMap)\n if (shouldRegister) {\n plugins.push({\n Component: LexicalListPlugin,\n position: 'normal',\n })\n }\n\n return {\n markdownTransformers: [CHECK_LIST],\n nodes: shouldRegister ? [ListNode, ListItemNode] : [],\n plugins,\n slashMenu: {\n groups: [\n slashMenuListGroupWithItems([\n {\n Icon: ChecklistIcon,\n key: 'checklist',\n keywords: ['check list', 'check', 'checklist', 'cl'],\n label: ({ i18n }) => {\n return i18n.t('lexical:checklist:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT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CAAE;IACnBA,MAAA,CAAOC,eAAe,CAAC5B,yBAAA,EAA2B6B,SAAA;EACpD;EACAC,KAAA,EAAO;AACT,EACD,EACF;AAED,OAAO,MAAMC,sBAAA,GAAyB1B,mBAAA,CAAoB,CAAC;EAAE2B;AAAkB,CAAE;EAC/E,MAAMC,OAAA,GAA+C,CACnD;IACEC,SAAA,EAAWvB,sBAAA;IACXwB,QAAA,EAAU;EACZ,EACD;EAED,MAAMC,cAAA,GAAiB5B,2BAAA,CAA4B,aAAawB,kBAAA;EAChE,IAAII,cAAA,EAAgB;IAClBH,OAAA,CAAQI,IAAI,CAAC;MACXH,SAAA,EAAW3B,iBAAA;MACX4B,QAAA,EAAU;IACZ;EACF;EAEA,OAAO;IACLG,oBAAA,EAAsB,CAAC5B,UAAA,CAAW;IAClC6B,KAAA,EAAOH,cAAA,GAAiB,CAAClC,QAAA,EAAUD,YAAA,CAAa,GAAG,EAAE;IACrDgC,OAAA;IACAO,SAAA,EAAW;MACTC,MAAA,EAAQ,CACNhC,2BAAA,CAA4B,CAC1B;QACEiC,IAAA,EAAMtC,aAAA;QACNkB,GAAA,EAAK;QACLqB,QAAA,EAAU,CAAC,cAAc,SAAS,aAAa,KAAK;QACpDpB,KAAA,EAAOA,CAAC;UAAEC;QAAI,CAAE;UACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;QAChB;QACAC,QAAA,EAAUA,CAAC;UAAEC;QAAM,CAAE;UACnBA,MAAA,CAAOC,eAAe,CAAC5B,yBAAA,EAA2B6B,SAAA;QACpD;MACF,EACD;IAEL;IACAe,YAAA,EAAc;MACZH,MAAA,EAAQ7B;IACV;IACAiC,aAAA,EAAe;MACbJ,MAAA,EAAQ7B;IACV;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["$isListNode","INSERT_CHECK_LIST_COMMAND","ListItemNode","ListNode","CHECK_LIST","$isRangeSelection","ChecklistIcon","createClientFeature","toolbarTextDropdownGroupWithItems","LexicalListPlugin","shouldRegisterListBaseNodes","slashMenuListGroupWithItems","LexicalCheckListPlugin","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getListType","parent","getParent","parentParent","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","ChecklistFeatureClient","featureProviderMap","plugins","Component","position","shouldRegister","push","markdownTransformers","nodes","slashMenu","groups","Icon","keywords","toolbarFixed","toolbarInline"],"sources":["../../../../../src/features/lists/checklist/client/index.tsx"],"sourcesContent":["'use client'\nimport { $isListNode, INSERT_CHECK_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list'\nimport { CHECK_LIST } from '@lexical/markdown'\nimport { $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../../toolbars/types.js'\nimport type { ClientFeature } from '../../../typesClient.js'\n\nimport { ChecklistIcon } from '../../../../lexical/ui/icons/Checklist/index.js'\nimport { createClientFeature } from '../../../../utilities/createClientFeature.js'\nimport { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js'\nimport { LexicalListPlugin } from '../../plugin/index.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js'\nimport { LexicalCheckListPlugin } from './plugin/index.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: ChecklistIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isListNode(node) && node.getListType() === 'check') {\n continue\n }\n\n const parent = node.getParent()\n\n if ($isListNode(parent) && parent.getListType() === 'check') {\n continue\n }\n\n const parentParent = parent?.getParent()\n // Example scenario: Node = textNode, parent = listItemNode, parentParent = listNode\n if ($isListNode(parentParent) && parentParent.getListType() === 'check') {\n continue\n }\n\n return false\n }\n return true\n },\n key: 'checklist',\n label: ({ i18n }) => {\n return i18n.t('lexical:checklist:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, undefined)\n },\n order: 12,\n },\n ]),\n]\n\nexport const ChecklistFeatureClient = createClientFeature(({ featureProviderMap }) => {\n const plugins: ClientFeature<undefined>['plugins'] = [\n {\n Component: LexicalCheckListPlugin,\n position: 'normal',\n },\n ]\n\n const shouldRegister = shouldRegisterListBaseNodes('checklist', featureProviderMap)\n if (shouldRegister) {\n plugins.push({\n Component: LexicalListPlugin,\n position: 'normal',\n })\n }\n\n return {\n markdownTransformers: [CHECK_LIST],\n nodes: shouldRegister ? [ListNode, ListItemNode] : [],\n plugins,\n slashMenu: {\n groups: [\n slashMenuListGroupWithItems([\n {\n Icon: ChecklistIcon,\n key: 'checklist',\n keywords: ['check list', 'check', 'checklist', 'cl'],\n label: ({ i18n }) => {\n return i18n.t('lexical:checklist:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }\n})\n"],"mappings":"AAAA;;AACA,SAASA,WAAW,EAAEC,yBAAyB,EAAEC,YAAY,EAAEC,QAAQ,QAAQ;AAC/E,SAASC,UAAU,QAAQ;AAC3B,SAASC,iBAAiB,QAAQ;AAKlC,SAASC,aAAa,QAAQ;AAC9B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,iCAAiC,QAAQ;AAClD,SAASC,iBAAiB,QAAQ;AAClC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,sBAAsB,QAAQ;AAEvC,MAAMC,aAAA,GAAgC,CACpCL,iCAAA,CAAkC,CAChC;EACEM,cAAA,EAAgBR,aAAA;EAChBS,QAAA,EAAUA,CAAC;IAAEC;EAAS,CAAE;IACtB,IAAI,CAACX,iBAAA,CAAkBW,SAAA,GAAY;MACjC,OAAO;IACT;IACA,KAAK,MAAMC,IAAA,IAA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C,aAAA;QACNiB,GAAA,EAAK;QACLqB,QAAA,EAAU,CAAC,cAAc,SAAS,aAAa,KAAK;QACpDpB,KAAA,EAAOA,CAAC;UAAEC;QAAI,CAAE;UACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;QAChB;QACAC,QAAA,EAAUA,CAAC;UAAEC;QAAM,CAAE;UACnBA,MAAA,CAAOC,eAAe,CAAC5B,yBAAA,EAA2B6B,SAAA;QACpD;MACF,EACD;IAEL;IACAe,YAAA,EAAc;MACZH,MAAA,EAAQ7B;IACV;IACAiC,aAAA,EAAe;MACbJ,MAAA,EAAQ7B;IACV;EACF;AACF","ignoreList":[]}
@@ -1,9 +1,9 @@
1
1
  import { ListItemNode, ListNode } from '@lexical/list';
2
+ import { CHECK_LIST } from '@lexical/markdown';
2
3
  import { createServerFeature } from '../../../../utilities/createServerFeature.js';
3
4
  import { createNode } from '../../../typeUtilities.js';
4
5
  import { listItemNodeJSONSchema, listNodeJSONSchema } from '../../shared/schema.js';
5
6
  import { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js';
6
- import { CHECK_LIST } from '../markdownTransformers.js';
7
7
  import { i18n } from './i18n.js';
8
8
  export const ChecklistFeature = createServerFeature({
9
9
  feature: ({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ListItemNode","ListNode","createServerFeature","createNode","listItemNodeJSONSchema","listNodeJSONSchema","shouldRegisterListBaseNodes","CHECK_LIST","i18n","ChecklistFeature","feature","featureProviderMap","ClientFeature","markdownTransformers","nodes","jsonSchema","node","key"],"sources":["../../../../../src/features/lists/checklist/server/index.ts"],"sourcesContent":["import { ListItemNode, ListNode } from '@lexical/list'\n\nimport { createServerFeature } from '../../../../utilities/createServerFeature.js'\nimport { createNode } from '../../../typeUtilities.js'\nimport { listItemNodeJSONSchema, listNodeJSONSchema } from '../../shared/schema.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { CHECK_LIST } from '../markdownTransformers.js'\nimport { i18n } from './i18n.js'\n\nexport const ChecklistFeature = createServerFeature({\n feature: ({ featureProviderMap }) => {\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#ChecklistFeatureClient',\n i18n,\n markdownTransformers: [CHECK_LIST],\n nodes: shouldRegisterListBaseNodes('checklist', featureProviderMap)\n ? [\n createNode({\n jsonSchema: listNodeJSONSchema,\n node: ListNode,\n }),\n createNode({\n jsonSchema: listItemNodeJSONSchema,\n node: ListItemNode,\n }),\n ]\n : [],\n }\n },\n key: 'checklist',\n})\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,QAAQ,QAAQ;AAEvC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,EAAEC,kBAAkB,QAAQ;AAC3D,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,UAAU,QAAQ;AAC3B,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,gBAAA,GAAmBP,mBAAA,CAAoB;EAClDQ,OAAA,EAASA,CAAC;IAAEC;EAAkB,CAAE;IAC9B,OAAO;MACLC,aAAA,EAAe;MACfJ,IAAA;MACAK,oBAAA,EAAsB,CAACN,UAAA,CAAW;MAClCO,KAAA,EAAOR,2BAAA,CAA4B,aAAaK,kBAAA,IAC5C,CACER,UAAA,CAAW;QACTY,UAAA,EAAYV,kBAAA;QACZW,IAAA,EAAMf;MACR,IACAE,UAAA,CAAW;QACTY,UAAA,EAAYX,sBAAA;QACZY,IAAA,EAAMhB;MACR,GACD,GACD;IACN;EACF;EACAiB,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["ListItemNode","ListNode","CHECK_LIST","createServerFeature","createNode","listItemNodeJSONSchema","listNodeJSONSchema","shouldRegisterListBaseNodes","i18n","ChecklistFeature","feature","featureProviderMap","ClientFeature","markdownTransformers","nodes","jsonSchema","node","key"],"sources":["../../../../../src/features/lists/checklist/server/index.ts"],"sourcesContent":["import { ListItemNode, ListNode } from '@lexical/list'\nimport { CHECK_LIST } from '@lexical/markdown'\n\nimport { createServerFeature } from '../../../../utilities/createServerFeature.js'\nimport { createNode } from '../../../typeUtilities.js'\nimport { listItemNodeJSONSchema, listNodeJSONSchema } from '../../shared/schema.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { i18n } from './i18n.js'\n\nexport const ChecklistFeature = createServerFeature({\n feature: ({ featureProviderMap }) => {\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#ChecklistFeatureClient',\n i18n,\n markdownTransformers: [CHECK_LIST],\n nodes: shouldRegisterListBaseNodes('checklist', featureProviderMap)\n ? [\n createNode({\n jsonSchema: listNodeJSONSchema,\n node: ListNode,\n }),\n createNode({\n jsonSchema: listItemNodeJSONSchema,\n node: ListItemNode,\n }),\n ]\n : [],\n }\n },\n key: 'checklist',\n})\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,QAAQ,QAAQ;AACvC,SAASC,UAAU,QAAQ;AAE3B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,EAAEC,kBAAkB,QAAQ;AAC3D,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,gBAAA,GAAmBN,mBAAA,CAAoB;EAClDO,OAAA,EAASA,CAAC;IAAEC;EAAkB,CAAE;IAC9B,OAAO;MACLC,aAAA,EAAe;MACfJ,IAAA;MACAK,oBAAA,EAAsB,CAACX,UAAA,CAAW;MAClCY,KAAA,EAAOP,2BAAA,CAA4B,aAAaI,kBAAA,IAC5C,CACEP,UAAA,CAAW;QACTW,UAAA,EAAYT,kBAAA;QACZU,IAAA,EAAMf;MACR,IACAG,UAAA,CAAW;QACTW,UAAA,EAAYV,sBAAA;QACZW,IAAA,EAAMhB;MACR,GACD,GACD;IACN;EACF;EACAiB,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { $isListNode, INSERT_ORDERED_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list';
4
+ import { ORDERED_LIST } from '@lexical/markdown';
4
5
  import { $isRangeSelection } from 'lexical';
5
6
  import { OrderedListIcon } from '../../../../lexical/ui/icons/OrderedList/index.js';
6
7
  import { createClientFeature } from '../../../../utilities/createClientFeature.js';
@@ -8,7 +9,6 @@ import { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textD
8
9
  import { LexicalListPlugin } from '../../plugin/index.js';
9
10
  import { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js';
10
11
  import { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js';
11
- import { ORDERED_LIST } from '../markdownTransformer.js';
12
12
  const toolbarGroups = [toolbarTextDropdownGroupWithItems([{
13
13
  ChildComponent: OrderedListIcon,
14
14
  isActive: ({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["$isListNode","INSERT_ORDERED_LIST_COMMAND","ListItemNode","ListNode","$isRangeSelection","OrderedListIcon","createClientFeature","toolbarTextDropdownGroupWithItems","LexicalListPlugin","shouldRegisterListBaseNodes","slashMenuListGroupWithItems","ORDERED_LIST","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getListType","parent","getParent","parentParent","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","OrderedListFeatureClient","featureProviderMap","shouldRegister","markdownTransformers","nodes","plugins","Component","position","slashMenu","groups","Icon","keywords","toolbarFixed","toolbarInline"],"sources":["../../../../../src/features/lists/orderedList/client/index.tsx"],"sourcesContent":["'use client'\nimport { $isListNode, INSERT_ORDERED_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list'\nimport { $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../../toolbars/types.js'\n\nimport { OrderedListIcon } from '../../../../lexical/ui/icons/OrderedList/index.js'\nimport { createClientFeature } from '../../../../utilities/createClientFeature.js'\nimport { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js'\nimport { LexicalListPlugin } from '../../plugin/index.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js'\nimport { ORDERED_LIST } from '../markdownTransformer.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: OrderedListIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isListNode(node) && node.getListType() === 'number') {\n continue\n }\n\n const parent = node.getParent()\n\n if ($isListNode(parent) && parent.getListType() === 'number') {\n continue\n }\n\n const parentParent = parent?.getParent()\n // Example scenario: Node = textNode, parent = listItemNode, parentParent = listNode\n if ($isListNode(parentParent) && parentParent.getListType() === 'number') {\n continue\n }\n\n return false\n }\n return true\n },\n key: 'orderedList',\n label: ({ i18n }) => {\n return i18n.t('lexical:orderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined)\n },\n order: 10,\n },\n ]),\n]\n\nexport const OrderedListFeatureClient = createClientFeature(({ featureProviderMap }) => {\n const shouldRegister = shouldRegisterListBaseNodes('ordered', featureProviderMap)\n return {\n markdownTransformers: [ORDERED_LIST],\n nodes: shouldRegister ? [ListNode, ListItemNode] : [],\n plugins: shouldRegister\n ? [\n {\n Component: LexicalListPlugin,\n position: 'normal',\n },\n ]\n : [],\n slashMenu: {\n groups: [\n slashMenuListGroupWithItems([\n {\n Icon: OrderedListIcon,\n key: 'orderedList',\n keywords: ['ordered list', 'ol'],\n label: ({ i18n }) => {\n return i18n.t('lexical:orderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbar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zB,mBAAA,CAAoB,CAAC;EAAE0B;AAAkB,CAAE;EACjF,MAAMC,cAAA,GAAiBxB,2BAAA,CAA4B,WAAWuB,kBAAA;EAC9D,OAAO;IACLE,oBAAA,EAAsB,CAACvB,YAAA,CAAa;IACpCwB,KAAA,EAAOF,cAAA,GAAiB,CAAC9B,QAAA,EAAUD,YAAA,CAAa,GAAG,EAAE;IACrDkC,OAAA,EAASH,cAAA,GACL,CACE;MACEI,SAAA,EAAW7B,iBAAA;MACX8B,QAAA,EAAU;IACZ,EACD,GACD,EAAE;IACNC,SAAA,EAAW;MACTC,MAAA,EAAQ,CACN9B,2BAAA,CAA4B,CAC1B;QACE+B,IAAA,EAAMpC,eAAA;QACNiB,GAAA,EAAK;QACLoB,QAAA,EAAU,CAAC,gBAAgB,KAAK;QAChCnB,KAAA,EAAOA,CAAC;UAAEC;QAAI,CAAE;UACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;QAChB;QACAC,QAAA,EAAUA,CAAC;UAAEC;QAAM,CAAE;UACnBA,MAAA,CAAOC,eAAe,CAAC3B,2BAAA,EAA6B4B,SAAA;QACtD;MACF,EACD;IAEL;IACAc,YAAA,EAAc;MACZH,MAAA,EAAQ5B;IACV;IACAgC,aAAA,EAAe;MACbJ,MAAA,EAAQ5B;IACV;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["$isListNode","INSERT_ORDERED_LIST_COMMAND","ListItemNode","ListNode","ORDERED_LIST","$isRangeSelection","OrderedListIcon","createClientFeature","toolbarTextDropdownGroupWithItems","LexicalListPlugin","shouldRegisterListBaseNodes","slashMenuListGroupWithItems","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getListType","parent","getParent","parentParent","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","OrderedListFeatureClient","featureProviderMap","shouldRegister","markdownTransformers","nodes","plugins","Component","position","slashMenu","groups","Icon","keywords","toolbarFixed","toolbarInline"],"sources":["../../../../../src/features/lists/orderedList/client/index.tsx"],"sourcesContent":["'use client'\nimport { $isListNode, INSERT_ORDERED_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list'\nimport { ORDERED_LIST } from '@lexical/markdown'\nimport { $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../../toolbars/types.js'\n\nimport { OrderedListIcon } from '../../../../lexical/ui/icons/OrderedList/index.js'\nimport { createClientFeature } from '../../../../utilities/createClientFeature.js'\nimport { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js'\nimport { LexicalListPlugin } from '../../plugin/index.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: OrderedListIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isListNode(node) && node.getListType() === 'number') {\n continue\n }\n\n const parent = node.getParent()\n\n if ($isListNode(parent) && parent.getListType() === 'number') {\n continue\n }\n\n const parentParent = parent?.getParent()\n // Example scenario: Node = textNode, parent = listItemNode, parentParent = listNode\n if ($isListNode(parentParent) && parentParent.getListType() === 'number') {\n continue\n }\n\n return false\n }\n return true\n },\n key: 'orderedList',\n label: ({ i18n }) => {\n return i18n.t('lexical:orderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined)\n },\n order: 10,\n },\n ]),\n]\n\nexport const OrderedListFeatureClient = createClientFeature(({ featureProviderMap }) => {\n const shouldRegister = shouldRegisterListBaseNodes('ordered', featureProviderMap)\n return {\n markdownTransformers: [ORDERED_LIST],\n nodes: shouldRegister ? [ListNode, ListItemNode] : [],\n plugins: shouldRegister\n ? [\n {\n Component: LexicalListPlugin,\n position: 'normal',\n },\n ]\n : [],\n slashMenu: {\n groups: [\n slashMenuListGroupWithItems([\n {\n Icon: OrderedListIcon,\n key: 'orderedList',\n keywords: ['ordered list', 'ol'],\n label: ({ i18n }) => {\n return i18n.t('lexical:orderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }\n})\n"],"mappings":"AAAA;;AACA,SAASA,WAAW,EAAEC,2BAA2B,EAAEC,YAAY,EAAEC,QAAQ,QAAQ;AACjF,SAASC,YAAY,QAAQ;AAC7B,SAASC,iBAAiB,QAAQ;AAIlC,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,iCAAiC,QAAQ;AAClD,SAASC,iBAAiB,QAAQ;AAClC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,2BAA2B,QAAQ;AAE5C,MAAMC,aAAA,GAAgC,CACpCJ,iCAAA,CAAkC,CAChC;EACEK,cAAA,EAAgBP,eAAA;EAChBQ,QAAA,EAAUA,CAAC;IAAEC;EAAS,CAAE;IACtB,IAAI,CAACV,iBAAA,CAAkBU,SAAA,GAAY;MACjC,OAAO;IACT;IACA,KAAK,MAAMC,IAAA,IAAQD,SAAA,CAAUE,QAAQ,IAAI;MACvC,IAAIjB,WAAA,CAAYgB,IAAA,KAASA,IAAA,CAAKE,WAAW,OAAO,UAAU;QACxD;MACF;MAEA,MAAMC,MAAA,GAASH,IAAA,CAAKI,SAAS;MAE7B,IAAIpB,WAAA,CAAYmB,MAAA,KAAWA,MAAA,CAAOD,WAAW,OAAO,UAAU;QAC5D;MACF;MAEA,MAAMG,YAAA,GAAeF,MAAA,EAAQC,SAAA;MAC7B;MACA,IAAIpB,WAAA,CAAYqB,YAAA,KAAiBA,YAAA,CAAaH,WAAW,OAAO,UAAU;QACxE;MACF;MAEA,OAAO;IACT;IACA,OAAO;EACT;EACAI,GAAA,EAAK;EACLC,KAAA,EAAOA,CAAC;IAAEC;EAAI,CAAE;IACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;EAChB;EACAC,QAAA,EAAUA,CAAC;IAAEC;EAAM,CAAE;IACnBA,MAAA,CAAOC,eAAe,CAAC3B,2BAAA,EAA6B4B,SAAA;EACtD;EACAC,KAAA,EAAO;AACT,EACD,EACF;AAED,OAAO,MAAMC,wBAAA,GAA2BxB,mBAAA,CAAoB,CAAC;EAAEyB;AAAkB,CAAE;EACjF,MAAMC,cAAA,GAAiBvB,2BAAA,CAA4B,WAAWsB,kBAAA;EAC9D,OAAO;IACLE,oBAAA,EAAsB,CAAC9B,YAAA,CAAa;IACpC+B,KAAA,EAAOF,cAAA,GAAiB,CAAC9B,QAAA,EAAUD,YAAA,CAAa,GAAG,EAAE;IACrDkC,OAAA,EAASH,cAAA,GACL,CACE;MACEI,SAAA,EAAW5B,iBAAA;MACX6B,QAAA,EAAU;IACZ,EACD,GACD,EAAE;IACNC,SAAA,EAAW;MACTC,MAAA,EAAQ,CACN7B,2BAAA,CAA4B,CAC1B;QACE8B,IAAA,EAAMnC,eAAA;QACNgB,GAAA,EAAK;QACLoB,QAAA,EAAU,CAAC,gBAAgB,KAAK;QAChCnB,KAAA,EAAOA,CAAC;UAAEC;QAAI,CAAE;UACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;QAChB;QACAC,QAAA,EAAUA,CAAC;UAAEC;QAAM,CAAE;UACnBA,MAAA,CAAOC,eAAe,CAAC3B,2BAAA,EAA6B4B,SAAA;QACtD;MACF,EACD;IAEL;IACAc,YAAA,EAAc;MACZH,MAAA,EAAQ5B;IACV;IACAgC,aAAA,EAAe;MACbJ,MAAA,EAAQ5B;IACV;EACF;AACF","ignoreList":[]}
@@ -1,9 +1,9 @@
1
1
  import { ListItemNode, ListNode } from '@lexical/list';
2
+ import { ORDERED_LIST } from '@lexical/markdown';
2
3
  import { createServerFeature } from '../../../../utilities/createServerFeature.js';
3
4
  import { createNode } from '../../../typeUtilities.js';
4
5
  import { listItemNodeJSONSchema, listNodeJSONSchema } from '../../shared/schema.js';
5
6
  import { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js';
6
- import { ORDERED_LIST } from '../markdownTransformer.js';
7
7
  import { i18n } from './i18n.js';
8
8
  export const OrderedListFeature = createServerFeature({
9
9
  feature: ({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ListItemNode","ListNode","createServerFeature","createNode","listItemNodeJSONSchema","listNodeJSONSchema","shouldRegisterListBaseNodes","ORDERED_LIST","i18n","OrderedListFeature","feature","featureProviderMap","ClientFeature","markdownTransformers","nodes","jsonSchema","node","key"],"sources":["../../../../../src/features/lists/orderedList/server/index.ts"],"sourcesContent":["import { ListItemNode, ListNode } from '@lexical/list'\n\nimport { createServerFeature } from '../../../../utilities/createServerFeature.js'\nimport { createNode } from '../../../typeUtilities.js'\nimport { listItemNodeJSONSchema, listNodeJSONSchema } from '../../shared/schema.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { ORDERED_LIST } from '../markdownTransformer.js'\nimport { i18n } from './i18n.js'\n\nexport const OrderedListFeature = createServerFeature({\n feature: ({ featureProviderMap }) => {\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#OrderedListFeatureClient',\n i18n,\n markdownTransformers: [ORDERED_LIST],\n nodes: shouldRegisterListBaseNodes('ordered', featureProviderMap)\n ? [\n createNode({\n jsonSchema: listNodeJSONSchema,\n node: ListNode,\n }),\n createNode({\n jsonSchema: listItemNodeJSONSchema,\n node: ListItemNode,\n }),\n ]\n : [],\n }\n },\n key: 'orderedList',\n})\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,QAAQ,QAAQ;AAEvC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,EAAEC,kBAAkB,QAAQ;AAC3D,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,YAAY,QAAQ;AAC7B,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,kBAAA,GAAqBP,mBAAA,CAAoB;EACpDQ,OAAA,EAASA,CAAC;IAAEC;EAAkB,CAAE;IAC9B,OAAO;MACLC,aAAA,EAAe;MACfJ,IAAA;MACAK,oBAAA,EAAsB,CAACN,YAAA,CAAa;MACpCO,KAAA,EAAOR,2BAAA,CAA4B,WAAWK,kBAAA,IAC1C,CACER,UAAA,CAAW;QACTY,UAAA,EAAYV,kBAAA;QACZW,IAAA,EAAMf;MACR,IACAE,UAAA,CAAW;QACTY,UAAA,EAAYX,sBAAA;QACZY,IAAA,EAAMhB;MACR,GACD,GACD;IACN;EACF;EACAiB,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["ListItemNode","ListNode","ORDERED_LIST","createServerFeature","createNode","listItemNodeJSONSchema","listNodeJSONSchema","shouldRegisterListBaseNodes","i18n","OrderedListFeature","feature","featureProviderMap","ClientFeature","markdownTransformers","nodes","jsonSchema","node","key"],"sources":["../../../../../src/features/lists/orderedList/server/index.ts"],"sourcesContent":["import { ListItemNode, ListNode } from '@lexical/list'\nimport { ORDERED_LIST } from '@lexical/markdown'\n\nimport { createServerFeature } from '../../../../utilities/createServerFeature.js'\nimport { createNode } from '../../../typeUtilities.js'\nimport { listItemNodeJSONSchema, listNodeJSONSchema } from '../../shared/schema.js'\nimport { shouldRegisterListBaseNodes } from '../../shared/shouldRegisterListBaseNodes.js'\nimport { i18n } from './i18n.js'\n\nexport const OrderedListFeature = createServerFeature({\n feature: ({ featureProviderMap }) => {\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#OrderedListFeatureClient',\n i18n,\n markdownTransformers: [ORDERED_LIST],\n nodes: shouldRegisterListBaseNodes('ordered', featureProviderMap)\n ? [\n createNode({\n jsonSchema: listNodeJSONSchema,\n node: ListNode,\n }),\n createNode({\n jsonSchema: listItemNodeJSONSchema,\n node: ListItemNode,\n }),\n ]\n : [],\n }\n },\n key: 'orderedList',\n})\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,QAAQ,QAAQ;AACvC,SAASC,YAAY,QAAQ;AAE7B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,EAAEC,kBAAkB,QAAQ;AAC3D,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,kBAAA,GAAqBN,mBAAA,CAAoB;EACpDO,OAAA,EAASA,CAAC;IAAEC;EAAkB,CAAE;IAC9B,OAAO;MACLC,aAAA,EAAe;MACfJ,IAAA;MACAK,oBAAA,EAAsB,CAACX,YAAA,CAAa;MACpCY,KAAA,EAAOP,2BAAA,CAA4B,WAAWI,kBAAA,IAC1C,CACEP,UAAA,CAAW;QACTW,UAAA,EAAYT,kBAAA;QACZU,IAAA,EAAMf;MACR,IACAG,UAAA,CAAW;QACTW,UAAA,EAAYV,sBAAA;QACZW,IAAA,EAAMhB;MACR,GACD,GACD;IACN;EACF;EACAiB,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1,13 +1,13 @@
1
1
  'use client';
2
2
 
3
3
  import { $isListNode, INSERT_UNORDERED_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list';
4
+ import { UNORDERED_LIST } from '@lexical/markdown';
4
5
  import { $isRangeSelection } from 'lexical';
5
6
  import { UnorderedListIcon } from '../../../../lexical/ui/icons/UnorderedList/index.js';
6
7
  import { createClientFeature } from '../../../../utilities/createClientFeature.js';
7
8
  import { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js';
8
9
  import { LexicalListPlugin } from '../../plugin/index.js';
9
10
  import { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js';
10
- import { UNORDERED_LIST } from '../markdownTransformer.js';
11
11
  const toolbarGroups = [toolbarTextDropdownGroupWithItems([{
12
12
  ChildComponent: UnorderedListIcon,
13
13
  isActive: ({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["$isListNode","INSERT_UNORDERED_LIST_COMMAND","ListItemNode","ListNode","$isRangeSelection","UnorderedListIcon","createClientFeature","toolbarTextDropdownGroupWithItems","LexicalListPlugin","slashMenuListGroupWithItems","UNORDERED_LIST","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getListType","parent","getParent","parentParent","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","UnorderedListFeatureClient","markdownTransformers","nodes","plugins","Component","position","slashMenu","groups","Icon","keywords","toolbarFixed","toolbarInline"],"sources":["../../../../../src/features/lists/unorderedList/client/index.tsx"],"sourcesContent":["'use client'\n\nimport { $isListNode, INSERT_UNORDERED_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list'\nimport { $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../../toolbars/types.js'\n\nimport { UnorderedListIcon } from '../../../../lexical/ui/icons/UnorderedList/index.js'\nimport { createClientFeature } from '../../../../utilities/createClientFeature.js'\nimport { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js'\nimport { LexicalListPlugin } from '../../plugin/index.js'\nimport { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js'\nimport { UNORDERED_LIST } from '../markdownTransformer.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: UnorderedListIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isListNode(node) && node.getListType() === 'bullet') {\n continue\n }\n\n const parent = node.getParent()\n\n if ($isListNode(parent) && parent.getListType() === 'bullet') {\n continue\n }\n\n const parentParent = parent?.getParent()\n // Example scenario: Node = textNode, parent = listItemNode, parentParent = listNode\n if ($isListNode(parentParent) && parentParent.getListType() === 'bullet') {\n continue\n }\n\n return false\n }\n return true\n },\n key: 'unorderedList',\n label: ({ i18n }) => {\n return i18n.t('lexical:unorderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, undefined)\n },\n order: 11,\n },\n ]),\n]\n\nexport const UnorderedListFeatureClient = createClientFeature({\n markdownTransformers: [UNORDERED_LIST],\n nodes: [ListNode, ListItemNode],\n plugins: [\n {\n Component: LexicalListPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n slashMenuListGroupWithItems([\n {\n Icon: UnorderedListIcon,\n key: 'unorderedList',\n keywords: ['unordered list', 'ul'],\n label: ({ i18n }) => {\n return i18n.t('lexical:unorderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n})\n"],"mappings":"AAAA;;AAEA,SAASA,WAAW,EAAEC,6BAA6B,EAAEC,YAAY,EAAEC,QAAQ,QAAQ;AACnF,SAASC,iBAAiB,QAAQ;AAIlC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,iCAAiC,QAAQ;AAClD,SAASC,iBAAiB,QAAQ;AAClC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,cAAc,QAAQ;AAE/B,MAAMC,aAAA,GAAgC,CACpCJ,iCAAA,CAAkC,CAChC;EACEK,cAAA,EAAgBP,iBAAA;EAChBQ,QAAA,EAAUA,CAAC;IAAEC;EAAS,CAAE;IACtB,IAAI,CAACV,iBAAA,CAAkBU,SAAA,GAAY;MACjC,OAAO;IACT;IACA,KAAK,MAAMC,IAAA,IAAQD,SAAA,CAAUE,QAAQ,IAAI;MACvC,IAAIhB,WAAA,CAAYe,IAAA,KAASA,IAAA,CAAKE,WAAW,OAAO,UAAU;QACxD;MACF;MAEA,MAAMC,MAAA,GAASH,IAAA,CAAKI,SAAS;MAE7B,IAAInB,WAAA,CAAYkB,MAAA,KAAWA,MAAA,CAAOD,WAAW,OAAO,UAAU;QAC5D;MACF;MAEA,MAAMG,YAAA,GAAeF,MAAA,EAAQC,SAAA;MAC7B;MACA,IAAInB,WAAA,CAAYoB,YAAA,KAAiBA,YAAA,CAAaH,WAAW,OAAO,UAAU;QACxE;MACF;MAEA,OAAO;IACT;IACA,OAAO;EACT;EACAI,GAAA,EAAK;EACLC,KAAA,EAAOA,CAAC;IAAEC;EAAI,CAAE;IACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;EAChB;EACAC,QAAA,EAAUA,CAAC;IAAEC;EAAM,CAAE;IACnBA,MAAA,CAAOC,eAAe,CAAC1B,6BAAA,EAA+B2B,SAAA;EACxD;EACAC,KAAA,EAAO;AACT,EACD,EACF;AAED,OAAO,MAAMC,0BAAA,GAA6BxB,mBAAA,CAAoB;EAC5DyB,oBAAA,EAAsB,CAACrB,cAAA,CAAe;EACtCsB,KAAA,EAAO,CAAC7B,QAAA,EAAUD,YAAA,CAAa;EAC/B+B,OAAA,EAAS,CACP;IACEC,SAAA,EAAW1B,iBAAA;IACX2B,QAAA,EAAU;EACZ,EACD;EACDC,SAAA,EAAW;IACTC,MAAA,EAAQ,CACN5B,2BAAA,CAA4B,CAC1B;MACE6B,IAAA,EAAMjC,iBAAA;MACNgB,GAAA,EAAK;MACLkB,QAAA,EAAU,CAAC,kBAAkB,KAAK;MAClCjB,KAAA,EAAOA,CAAC;QAAEC;MAAI,CAAE;QACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;MAChB;MACAC,QAAA,EAAUA,CAAC;QAAEC;MAAM,CAAE;QACnBA,MAAA,CAAOC,eAAe,CAAC1B,6BAAA,EAA+B2B,SAAA;MACxD;IACF,EACD;EAEL;EACAY,YAAA,EAAc;IACZH,MAAA,EAAQ1B;EACV;EACA8B,aAAA,EAAe;IACbJ,MAAA,EAAQ1B;EACV;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["$isListNode","INSERT_UNORDERED_LIST_COMMAND","ListItemNode","ListNode","UNORDERED_LIST","$isRangeSelection","UnorderedListIcon","createClientFeature","toolbarTextDropdownGroupWithItems","LexicalListPlugin","slashMenuListGroupWithItems","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getListType","parent","getParent","parentParent","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","UnorderedListFeatureClient","markdownTransformers","nodes","plugins","Component","position","slashMenu","groups","Icon","keywords","toolbarFixed","toolbarInline"],"sources":["../../../../../src/features/lists/unorderedList/client/index.tsx"],"sourcesContent":["'use client'\n\nimport { $isListNode, INSERT_UNORDERED_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list'\nimport { UNORDERED_LIST } from '@lexical/markdown'\nimport { $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../../../toolbars/types.js'\n\nimport { UnorderedListIcon } from '../../../../lexical/ui/icons/UnorderedList/index.js'\nimport { createClientFeature } from '../../../../utilities/createClientFeature.js'\nimport { toolbarTextDropdownGroupWithItems } from '../../../shared/toolbar/textDropdownGroup.js'\nimport { LexicalListPlugin } from '../../plugin/index.js'\nimport { slashMenuListGroupWithItems } from '../../shared/slashMenuListGroup.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: UnorderedListIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isListNode(node) && node.getListType() === 'bullet') {\n continue\n }\n\n const parent = node.getParent()\n\n if ($isListNode(parent) && parent.getListType() === 'bullet') {\n continue\n }\n\n const parentParent = parent?.getParent()\n // Example scenario: Node = textNode, parent = listItemNode, parentParent = listNode\n if ($isListNode(parentParent) && parentParent.getListType() === 'bullet') {\n continue\n }\n\n return false\n }\n return true\n },\n key: 'unorderedList',\n label: ({ i18n }) => {\n return i18n.t('lexical:unorderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, undefined)\n },\n order: 11,\n },\n ]),\n]\n\nexport const UnorderedListFeatureClient = createClientFeature({\n markdownTransformers: [UNORDERED_LIST],\n nodes: [ListNode, ListItemNode],\n plugins: [\n {\n Component: LexicalListPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n slashMenuListGroupWithItems([\n {\n Icon: UnorderedListIcon,\n key: 'unorderedList',\n keywords: ['unordered list', 'ul'],\n label: ({ i18n }) => {\n return i18n.t('lexical:unorderedList:label')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, undefined)\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n})\n"],"mappings":"AAAA;;AAEA,SAASA,WAAW,EAAEC,6BAA6B,EAAEC,YAAY,EAAEC,QAAQ,QAAQ;AACnF,SAASC,cAAc,QAAQ;AAC/B,SAASC,iBAAiB,QAAQ;AAIlC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,iCAAiC,QAAQ;AAClD,SAASC,iBAAiB,QAAQ;AAClC,SAASC,2BAA2B,QAAQ;AAE5C,MAAMC,aAAA,GAAgC,CACpCH,iCAAA,CAAkC,CAChC;EACEI,cAAA,EAAgBN,iBAAA;EAChBO,QAAA,EAAUA,CAAC;IAAEC;EAAS,CAAE;IACtB,IAAI,CAACT,iBAAA,CAAkBS,SAAA,GAAY;MACjC,OAAO;IACT;IACA,KAAK,MAAMC,IAAA,IAAQD,SAAA,CAAUE,QAAQ,IAAI;MACvC,IAAIhB,WAAA,CAAYe,IAAA,KAASA,IAAA,CAAKE,WAAW,OAAO,UAAU;QACxD;MACF;MAEA,MAAMC,MAAA,GAASH,IAAA,CAAKI,SAAS;MAE7B,IAAInB,WAAA,CAAYkB,MAAA,KAAWA,MAAA,CAAOD,WAAW,OAAO,UAAU;QAC5D;MACF;MAEA,MAAMG,YAAA,GAAeF,MAAA,EAAQC,SAAA;MAC7B;MACA,IAAInB,WAAA,CAAYoB,YAAA,KAAiBA,YAAA,CAAaH,WAAW,OAAO,UAAU;QACxE;MACF;MAEA,OAAO;IACT;IACA,OAAO;EACT;EACAI,GAAA,EAAK;EACLC,KAAA,EAAOA,CAAC;IAAEC;EAAI,CAAE;IACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;EAChB;EACAC,QAAA,EAAUA,CAAC;IAAEC;EAAM,CAAE;IACnBA,MAAA,CAAOC,eAAe,CAAC1B,6BAAA,EAA+B2B,SAAA;EACxD;EACAC,KAAA,EAAO;AACT,EACD,EACF;AAED,OAAO,MAAMC,0BAAA,GAA6BvB,mBAAA,CAAoB;EAC5DwB,oBAAA,EAAsB,CAAC3B,cAAA,CAAe;EACtC4B,KAAA,EAAO,CAAC7B,QAAA,EAAUD,YAAA,CAAa;EAC/B+B,OAAA,EAAS,CACP;IACEC,SAAA,EAAWzB,iBAAA;IACX0B,QAAA,EAAU;EACZ,EACD;EACDC,SAAA,EAAW;IACTC,MAAA,EAAQ,CACN3B,2BAAA,CAA4B,CAC1B;MACE4B,IAAA,EAAMhC,iBAAA;MACNe,GAAA,EAAK;MACLkB,QAAA,EAAU,CAAC,kBAAkB,KAAK;MAClCjB,KAAA,EAAOA,CAAC;QAAEC;MAAI,CAAE;QACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;MAChB;MACAC,QAAA,EAAUA,CAAC;QAAEC;MAAM,CAAE;QACnBA,MAAA,CAAOC,eAAe,CAAC1B,6BAAA,EAA+B2B,SAAA;MACxD;IACF,EACD;EAEL;EACAY,YAAA,EAAc;IACZH,MAAA,EAAQ1B;EACV;EACA8B,aAAA,EAAe;IACbJ,MAAA,EAAQ1B;EACV;AACF","ignoreList":[]}
@@ -1,8 +1,8 @@
1
1
  import { ListItemNode, ListNode } from '@lexical/list';
2
+ import { UNORDERED_LIST } from '@lexical/markdown';
2
3
  import { createServerFeature } from '../../../../utilities/createServerFeature.js';
3
4
  import { createNode } from '../../../typeUtilities.js';
4
5
  import { listItemNodeJSONSchema, listNodeJSONSchema } from '../../shared/schema.js';
5
- import { UNORDERED_LIST } from '../markdownTransformer.js';
6
6
  import { i18n } from './i18n.js';
7
7
  export const UnorderedListFeature = createServerFeature({
8
8
  feature: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ListItemNode","ListNode","createServerFeature","createNode","listItemNodeJSONSchema","listNodeJSONSchema","UNORDERED_LIST","i18n","UnorderedListFeature","feature","ClientFeature","markdownTransformers","nodes","jsonSchema","node","key"],"sources":["../../../../../src/features/lists/unorderedList/server/index.ts"],"sourcesContent":["import { ListItemNode, ListNode } from '@lexical/list'\n\nimport { createServerFeature } from '../../../../utilities/createServerFeature.js'\nimport { createNode } from '../../../typeUtilities.js'\nimport { listItemNodeJSONSchema, listNodeJSONSchema } from '../../shared/schema.js'\nimport { UNORDERED_LIST } from '../markdownTransformer.js'\nimport { i18n } from './i18n.js'\n\nexport const UnorderedListFeature = createServerFeature({\n feature: {\n ClientFeature: '@payloadcms/richtext-lexical/client#UnorderedListFeatureClient',\n i18n,\n markdownTransformers: [UNORDERED_LIST],\n nodes: [\n createNode({\n jsonSchema: listNodeJSONSchema,\n node: ListNode,\n }),\n createNode({\n jsonSchema: listItemNodeJSONSchema,\n node: ListItemNode,\n }),\n ],\n },\n key: 'unorderedList',\n})\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,QAAQ,QAAQ;AAEvC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,EAAEC,kBAAkB,QAAQ;AAC3D,SAASC,cAAc,QAAQ;AAC/B,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,oBAAA,GAAuBN,mBAAA,CAAoB;EACtDO,OAAA,EAAS;IACPC,aAAA,EAAe;IACfH,IAAA;IACAI,oBAAA,EAAsB,CAACL,cAAA,CAAe;IACtCM,KAAA,EAAO,CACLT,UAAA,CAAW;MACTU,UAAA,EAAYR,kBAAA;MACZS,IAAA,EAAMb;IACR,IACAE,UAAA,CAAW;MACTU,UAAA,EAAYT,sBAAA;MACZU,IAAA,EAAMd;IACR;EAEJ;EACAe,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["ListItemNode","ListNode","UNORDERED_LIST","createServerFeature","createNode","listItemNodeJSONSchema","listNodeJSONSchema","i18n","UnorderedListFeature","feature","ClientFeature","markdownTransformers","nodes","jsonSchema","node","key"],"sources":["../../../../../src/features/lists/unorderedList/server/index.ts"],"sourcesContent":["import { ListItemNode, ListNode } from '@lexical/list'\nimport { UNORDERED_LIST } from '@lexical/markdown'\n\nimport { createServerFeature } from '../../../../utilities/createServerFeature.js'\nimport { createNode } from '../../../typeUtilities.js'\nimport { listItemNodeJSONSchema, listNodeJSONSchema } from '../../shared/schema.js'\nimport { i18n } from './i18n.js'\n\nexport const UnorderedListFeature = createServerFeature({\n feature: {\n ClientFeature: '@payloadcms/richtext-lexical/client#UnorderedListFeatureClient',\n i18n,\n markdownTransformers: [UNORDERED_LIST],\n nodes: [\n createNode({\n jsonSchema: listNodeJSONSchema,\n node: ListNode,\n }),\n createNode({\n jsonSchema: listItemNodeJSONSchema,\n node: ListItemNode,\n }),\n ],\n },\n key: 'unorderedList',\n})\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,QAAQ,QAAQ;AACvC,SAASC,cAAc,QAAQ;AAE/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,EAAEC,kBAAkB,QAAQ;AAC3D,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,oBAAA,GAAuBL,mBAAA,CAAoB;EACtDM,OAAA,EAAS;IACPC,aAAA,EAAe;IACfH,IAAA;IACAI,oBAAA,EAAsB,CAACT,cAAA,CAAe;IACtCU,KAAA,EAAO,CACLR,UAAA,CAAW;MACTS,UAAA,EAAYP,kBAAA;MACZQ,IAAA,EAAMb;IACR,IACAG,UAAA,CAAW;MACTS,UAAA,EAAYR,sBAAA;MACZS,IAAA,EAAMd;IACR;EAEJ;EACAe,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1,11 +1,11 @@
1
- import type { CollectionSlug, DataFromCollectionSlug, UploadCollectionSlug } from 'payload';
1
+ import type { CollectionSlug, DataFromCollectionSlug, IDTypeForCollectionSlug, UploadCollectionSlug } from 'payload';
2
2
  import type { LexicalElementFormat } from '../../../types/nodeTypes.js';
3
3
  import type { JSONSchemaFn } from '../../typesServer.js';
4
4
  import type { RelationshipFeatureProps } from './index.js';
5
5
  export type RelationshipData = {
6
6
  [TCollectionSlug in CollectionSlug]: {
7
7
  relationTo: TCollectionSlug;
8
- value: DataFromCollectionSlug<TCollectionSlug> | number | string;
8
+ value: DataFromCollectionSlug<TCollectionSlug> | IDTypeForCollectionSlug<TCollectionSlug>;
9
9
  };
10
10
  }[CollectionSlug];
11
11
  /**
@@ -17,7 +17,7 @@ export type NonUploadCollectionSlug = [Exclude<CollectionSlug, UploadCollectionS
17
17
  export type SerializedRelationshipNode<TSlugs extends CollectionSlug = NonUploadCollectionSlug> = {
18
18
  [TSlug in TSlugs]: {
19
19
  relationTo: TSlug;
20
- value: DataFromCollectionSlug<TSlug> | number | string;
20
+ value: DataFromCollectionSlug<TSlug> | IDTypeForCollectionSlug<TSlug>;
21
21
  };
22
22
  }[TSlugs] & {
23
23
  format: LexicalElementFormat;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/server/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAE3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAK1D,MAAM,MAAM,gBAAgB,GAAG;KAC5B,eAAe,IAAI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sB,CAAC,eAAe,CAAC,GAAG,uBAAuB,CAAC,eAAe,CAAC,CAAA;KAC1F;CACF,CAAC,cAAc,CAAC,CAAA;AAEjB;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAC,SAAS;IAC5F,KAAK;CACN,GACG,cAAc,GACd,OAAO,CAAC,cAAc,EAAE,oBAAoB,CAAC,CAAA;AAEjD,MAAM,MAAM,0BAA0B,CAAC,MAAM,SAAS,cAAc,GAAG,uBAAuB,IAAI;KAC/F,KAAK,IAAI,MAAM,GAAG;QACjB,UAAU,EAAE,KAAK,CAAA;QACjB,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAA;KACtE;CACF,CAAC,MAAM,CAAC,GAAG;IACV,MAAM,EAAE,oBAAoB,CAAA;IAC5B,IAAI,EAAE,cAAc,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AA0BD,eAAO,MAAM,gCAAgC,GAC1C,OAAO,wBAAwB,GAAG,SAAS,KAAG,YAwD9C,CAAA"}
@@ -1,4 +1,4 @@
1
- import { formatSchema } from '../../../types/jsonSchemaHelpers.js';
1
+ import { formatSchema, versionSchema } from '../../../types/jsonSchemaHelpers.js';
2
2
  import { filterEnabledRelationshipCollections } from '../shared/filterEnabledRelationshipCollections.js';
3
3
  /** MUST stay byte-for-byte in sync with the runtime `SerializedRelationshipNode` declared above. */
4
4
  const SERIALIZED_RELATIONSHIP_NODE_TS = `export type SerializedRelationshipNode<TSlugs extends keyof Config['collections']> = {
@@ -8,15 +8,28 @@ const SERIALIZED_RELATIONSHIP_NODE_TS = `export type SerializedRelationshipNode<
8
8
  } & {
9
9
  [TSlug in TSlugs]: {
10
10
  relationTo: TSlug;
11
- value: number | string | Config['collections'][TSlug];
11
+ value: Config['collections'][TSlug]['id'] | Config['collections'][TSlug];
12
+ };
13
+ }[TSlugs];`;
14
+ /** Input variant of `SerializedRelationshipNode`: `value` is ID-only (you only ever write an ID). */
15
+ const SERIALIZED_RELATIONSHIP_NODE_INPUT_TS = `export type SerializedRelationshipNodeInput<TSlugs extends keyof Config['collections']> = {
16
+ type: 'relationship';
17
+ format: LexicalElementFormat;
18
+ version: number;
19
+ } & {
20
+ [TSlug in TSlugs]: {
21
+ relationTo: TSlug;
22
+ value: Config['collections'][TSlug]['id'];
12
23
  };
13
24
  }[TSlugs];`;
14
25
  export const createRelationshipNodeJSONSchema = props => ({
15
26
  collectionIDFieldTypes,
16
27
  config,
17
- typeStringDefinitions
28
+ typeStringDefinitions,
29
+ variant
18
30
  }) => {
19
- typeStringDefinitions.add(SERIALIZED_RELATIONSHIP_NODE_TS);
31
+ const isInput = variant === 'input';
32
+ typeStringDefinitions.add(isInput ? SERIALIZED_RELATIONSHIP_NODE_INPUT_TS : SERIALIZED_RELATIONSHIP_NODE_TS);
20
33
  const enabledCollections = config?.collections ? filterEnabledRelationshipCollections(config.collections, {
21
34
  disabledCollections: props?.disabledCollections,
22
35
  enabledCollections: props?.enabledCollections,
@@ -38,16 +51,18 @@ export const createRelationshipNodeJSONSchema = props => ({
38
51
  type: 'string',
39
52
  const: slug
40
53
  },
41
- value: {
54
+ value: isInput ? {
55
+ type: idType,
56
+ description: 'The related document ID.'
57
+ } : {
58
+ description: 'The related document by ID (string or number). Populated to the full document when read at depth > 0.',
42
59
  oneOf: [{
43
60
  type: idType
44
61
  }, {
45
- $ref: `#/definitions/${slug}`
62
+ $ref: `#/$defs/${slug}`
46
63
  }]
47
64
  },
48
- version: {
49
- type: 'integer'
50
- }
65
+ version: versionSchema
51
66
  },
52
67
  required: ['format', 'relationTo', 'type', 'value', 'version']
53
68
  };
@@ -62,9 +77,7 @@ export const createRelationshipNodeJSONSchema = props => ({
62
77
  type: 'string',
63
78
  const: 'relationship'
64
79
  },
65
- version: {
66
- type: 'integer'
67
- }
80
+ version: versionSchema
68
81
  },
69
82
  required: ['type', 'version']
70
83
  };
@@ -73,9 +86,10 @@ export const createRelationshipNodeJSONSchema = props => ({
73
86
  const baseSchema = variants.length === 1 ? variants[0] : {
74
87
  oneOf: variants
75
88
  };
89
+ const tsName = isInput ? 'SerializedRelationshipNodeInput' : 'SerializedRelationshipNode';
76
90
  schema = {
77
91
  ...baseSchema,
78
- tsType: `SerializedRelationshipNode<${slugUnion}>`
92
+ tsType: `${tsName}<${slugUnion}>`
79
93
  };
80
94
  }
81
95
  return schema;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","names":["formatSchema","filterEnabledRelationshipCollections","SERIALIZED_RELATIONSHIP_NODE_TS","createRelationshipNodeJSONSchema","props","collectionIDFieldTypes","config","typeStringDefinitions","add","enabledCollections","collections","disabledCollections","uploads","variants","map","collection","slug","idType","type","additionalProperties","properties","const","format","relationTo","value","oneOf","$ref","version","required","schema","length","slugUnion","c","join","baseSchema","tsType"],"sources":["../../../../src/features/relationship/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type { CollectionSlug, DataFromCollectionSlug, UploadCollectionSlug } from 'payload'\n\nimport type { LexicalElementFormat } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaFn } from '../../typesServer.js'\nimport type { RelationshipFeatureProps } from './index.js'\n\nimport { formatSchema } from '../../../types/jsonSchemaHelpers.js'\nimport { filterEnabledRelationshipCollections } from '../shared/filterEnabledRelationshipCollections.js'\n\nexport type RelationshipData = {\n [TCollectionSlug in CollectionSlug]: {\n relationTo: TCollectionSlug\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[CollectionSlug]\n\n/**\n * Exclude upload collection slugs. This matches runtime behavior, as well as the json schema.\n */\nexport type NonUploadCollectionSlug = [Exclude<CollectionSlug, UploadCollectionSlug>] extends [\n never,\n]\n ? CollectionSlug\n : Exclude<CollectionSlug, UploadCollectionSlug>\n\nexport type SerializedRelationshipNode<TSlugs extends CollectionSlug = NonUploadCollectionSlug> = {\n [TSlug in TSlugs]: {\n relationTo: TSlug\n value: DataFromCollectionSlug<TSlug> | number | string\n }\n}[TSlugs] & {\n format: LexicalElementFormat\n type: 'relationship'\n version: number\n}\n\n/** MUST stay byte-for-byte in sync with the runtime `SerializedRelationshipNode` declared above. */\nconst SERIALIZED_RELATIONSHIP_NODE_TS = `export type SerializedRelationshipNode<TSlugs extends keyof Config['collections']> = {\n type: 'relationship';\n format: LexicalElementFormat;\n version: number;\n} & {\n [TSlug in TSlugs]: {\n relationTo: TSlug;\n value: number | string | Config['collections'][TSlug];\n };\n}[TSlugs];`\n\nexport const createRelationshipNodeJSONSchema =\n (props: RelationshipFeatureProps | undefined): JSONSchemaFn =>\n ({ collectionIDFieldTypes, config, typeStringDefinitions }) => {\n typeStringDefinitions.add(SERIALIZED_RELATIONSHIP_NODE_TS)\n const enabledCollections = config?.collections\n ? filterEnabledRelationshipCollections(config.collections, {\n disabledCollections: props?.disabledCollections,\n enabledCollections: props?.enabledCollections,\n uploads: false,\n })\n : []\n\n const variants: JSONSchema4[] = enabledCollections.map((collection) => {\n const slug = collection.slug\n const idType: 'number' | 'string' = collectionIDFieldTypes[slug] ?? 'string'\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'relationship' },\n format: formatSchema,\n relationTo: { type: 'string', const: slug },\n value: {\n oneOf: [{ type: idType }, { $ref: `#/definitions/${slug}` }],\n },\n version: { type: 'integer' },\n },\n required: ['format', 'relationTo', 'type', 'value', 'version'],\n }\n })\n\n let schema: JSONSchema4\n if (variants.length === 0) {\n schema = {\n type: 'object',\n additionalProperties: true,\n properties: {\n type: { type: 'string', const: 'relationship' },\n version: { type: 'integer' },\n },\n required: ['type', 'version'],\n }\n } else {\n const slugUnion = enabledCollections.map((c) => `'${c.slug}'`).join(' | ')\n const baseSchema: JSONSchema4 = variants.length === 1 ? variants[0]! : { oneOf: variants }\n schema = { ...baseSchema, tsType: `SerializedRelationshipNode<${slugUnion}>` }\n }\n\n return schema\n }\n"],"mappings":"AAOA,SA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AY;QACVF,IAAA,EAAM;UAAEA,IAAA,EAAM;UAAUG,KAAA,EAAO;QAAe;QAC9CM,OAAA,EAAS;UAAET,IAAA,EAAM;QAAU;MAC7B;MACAU,QAAA,EAAU,CAAC,QAAQ;IACrB;EACF,OAAO;IACL,MAAMG,SAAA,GAAYtB,kBAAA,CAAmBK,GAAG,CAAEkB,CAAA,IAAM,IAAIA,CAAA,CAAEhB,IAAI,GAAG,EAAEiB,IAAI,CAAC;IACpE,MAAMC,UAAA,GAA0BrB,QAAA,CAASiB,MAAM,KAAK,IAAIjB,QAAQ,CAAC,EAAE,GAAI;MAAEY,KAAA,EAAOZ;IAAS;IACzFgB,MAAA,GAAS;MAAE,GAAGK,UAAU;MAAEC,MAAA,EAAQ,8BAA8BJ,SAAA;IAAa;EAC/E;EAEA,OAAOF,MAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"schema.js","names":["formatSchema","versionSchema","filterEnabledRelationshipCollections","SERIALIZED_RELATIONSHIP_NODE_TS","SERIALIZED_RELATIONSHIP_NODE_INPUT_TS","createRelationshipNodeJSONSchema","props","collectionIDFieldTypes","config","typeStringDefinitions","variant","isInput","add","enabledCollections","collections","disabledCollections","uploads","variants","map","collection","slug","idType","type","additionalProperties","properties","const","format","relationTo","value","description","oneOf","$ref","version","required","schema","length","slugUnion","c","join","baseSchema","tsName","tsType"],"sources":["../../../../src/features/relationship/server/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\nimport type {\n CollectionSlug,\n DataFromCollectionSlug,\n IDTypeForCollectionSlug,\n UploadCollectionSlug,\n} from 'payload'\n\nimport type { LexicalElementFormat } from '../../../types/nodeTypes.js'\nimport type { JSONSchemaFn } from '../../typesServer.js'\nimport type { RelationshipFeatureProps } from './index.js'\n\nimport { formatSchema, versionSchema } from '../../../types/jsonSchemaHelpers.js'\nimport { filterEnabledRelationshipCollections } from '../shared/filterEnabledRelationshipCollections.js'\n\nexport type RelationshipData = {\n [TCollectionSlug in CollectionSlug]: {\n relationTo: TCollectionSlug\n value: DataFromCollectionSlug<TCollectionSlug> | IDTypeForCollectionSlug<TCollectionSlug>\n }\n}[CollectionSlug]\n\n/**\n * Exclude upload collection slugs. This matches runtime behavior, as well as the json schema.\n */\nexport type NonUploadCollectionSlug = [Exclude<CollectionSlug, UploadCollectionSlug>] extends [\n never,\n]\n ? CollectionSlug\n : Exclude<CollectionSlug, UploadCollectionSlug>\n\nexport type SerializedRelationshipNode<TSlugs extends CollectionSlug = NonUploadCollectionSlug> = {\n [TSlug in TSlugs]: {\n relationTo: TSlug\n value: DataFromCollectionSlug<TSlug> | IDTypeForCollectionSlug<TSlug>\n }\n}[TSlugs] & {\n format: LexicalElementFormat\n type: 'relationship'\n version: number\n}\n\n/** MUST stay byte-for-byte in sync with the runtime `SerializedRelationshipNode` declared above. */\nconst SERIALIZED_RELATIONSHIP_NODE_TS = `export type SerializedRelationshipNode<TSlugs extends keyof Config['collections']> = {\n type: 'relationship';\n format: LexicalElementFormat;\n version: number;\n} & {\n [TSlug in TSlugs]: {\n relationTo: TSlug;\n value: Config['collections'][TSlug]['id'] | Config['collections'][TSlug];\n };\n}[TSlugs];`\n\n/** Input variant of `SerializedRelationshipNode`: `value` is ID-only (you only ever write an ID). */\nconst SERIALIZED_RELATIONSHIP_NODE_INPUT_TS = `export type SerializedRelationshipNodeInput<TSlugs extends keyof Config['collections']> = {\n type: 'relationship';\n format: LexicalElementFormat;\n version: number;\n} & {\n [TSlug in TSlugs]: {\n relationTo: TSlug;\n value: Config['collections'][TSlug]['id'];\n };\n}[TSlugs];`\n\nexport const createRelationshipNodeJSONSchema =\n (props: RelationshipFeatureProps | undefined): JSONSchemaFn =>\n ({ collectionIDFieldTypes, config, typeStringDefinitions, variant }) => {\n const isInput = variant === 'input'\n typeStringDefinitions.add(\n isInput ? SERIALIZED_RELATIONSHIP_NODE_INPUT_TS : SERIALIZED_RELATIONSHIP_NODE_TS,\n )\n const enabledCollections = config?.collections\n ? filterEnabledRelationshipCollections(config.collections, {\n disabledCollections: props?.disabledCollections,\n enabledCollections: props?.enabledCollections,\n uploads: false,\n })\n : []\n\n const variants: JSONSchema4[] = enabledCollections.map((collection) => {\n const slug = collection.slug\n const idType: 'number' | 'string' = collectionIDFieldTypes[slug] ?? 'string'\n return {\n type: 'object',\n additionalProperties: false,\n properties: {\n type: { type: 'string', const: 'relationship' },\n format: formatSchema,\n relationTo: { type: 'string', const: slug },\n value: isInput\n ? { type: idType, description: 'The related document ID.' }\n : {\n description:\n 'The related document by ID (string or number). Populated to the full document when read at depth > 0.',\n oneOf: [{ type: idType }, { $ref: `#/$defs/${slug}` }],\n },\n version: versionSchema,\n },\n required: ['format', 'relationTo', 'type', 'value', 'version'],\n }\n })\n\n let schema: JSONSchema4\n if (variants.length === 0) {\n schema = {\n type: 'object',\n additionalProperties: true,\n properties: {\n type: { type: 'string', const: 'relationship' },\n version: versionSchema,\n },\n required: ['type', 'version'],\n }\n } else {\n const slugUnion = enabledCollections.map((c) => `'${c.slug}'`).join(' | ')\n const baseSchema: JSONSchema4 = variants.length === 1 ? variants[0]! : { oneOf: variants }\n const tsName = isInput ? 'SerializedRelationshipNodeInput' : 'SerializedRelationshipNode'\n schema = { ...baseSchema, tsType: `${tsName}<${slugUnion}>` }\n }\n\n return schema\n }\n"],"mappings":"AAYA,SAASA,YAAY,EAAEC,aAAa,QAAQ;AAC5C,SAASC,oCAAoC,QAAQ;AA6BrD;AACA,MAAMC,+BAAA,GAAkC;;;;;;;;;WAS7B;AAEX;AACA,MAAMC,qCAAA,GAAwC;;;;;;;;;WASnC;AAEX,OAAO,MAAMC,gCAAA,GACVC,KAAA,IACD,CAAC;EAAEC,sBAAsB;EAAEC,MAAM;EAAEC,qBAAqB;EAAEC;AAAO,CAAE;EACjE,MAAMC,OAAA,GAAUD,OAAA,KAAY;EAC5BD,qBAAA,CAAsBG,GAAG,CACvBD,OAAA,GAAUP,qCAAA,GAAwCD,+BAAA;EAEpD,MAAMU,kBAAA,GAAqBL,MAA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,IAAM,IAAIA,CAAA,CAAEjB,IAAI,GAAG,EAAEkB,IAAI,CAAC;IACpE,MAAMC,UAAA,GAA0BtB,QAAA,CAASkB,MAAM,KAAK,IAAIlB,QAAQ,CAAC,EAAE,GAAI;MAAEa,KAAA,EAAOb;IAAS;IACzF,MAAMuB,MAAA,GAAS7B,OAAA,GAAU,oCAAoC;IAC7DuB,MAAA,GAAS;MAAE,GAAGK,UAAU;MAAEE,MAAA,EAAQ,GAAGD,MAAA,IAAUJ,SAAA;IAAa;EAC9D;EAEA,OAAOF,MAAA;AACT","ignoreList":[]}
@@ -43,7 +43,7 @@ const toolbarGroups = (props, stateMap) => {
43
43
  type: 'dropdown',
44
44
  ChildComponent: () => /*#__PURE__*/_jsx(TextStateIcon, {
45
45
  css: {
46
- color: 'var(--theme-elevation-600)'
46
+ color: 'var(--color-icon-secondary)'
47
47
  }
48
48
  }),
49
49
  items: [...clearStyle, ...items],