@payloadcms/richtext-lexical 3.89.0-internal.95c9cba → 3.90.0

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 (195) hide show
  1. package/dist/exports/client/{Field-J6MIUIWP.js → Field-YZR46UCY.js} +1 -1
  2. package/dist/exports/client/{Field-J6MIUIWP.js.map → Field-YZR46UCY.js.map} +1 -1
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-OSMEE5HW.js +2 -0
  5. package/dist/exports/client/chunk-OSMEE5HW.js.map +7 -0
  6. package/dist/exports/client/component-UBRNPIQ6.js +2 -0
  7. package/dist/exports/client/component-UBRNPIQ6.js.map +7 -0
  8. package/dist/exports/client/index.js +21 -21
  9. package/dist/exports/client/index.js.map +4 -4
  10. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  11. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  12. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  13. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  14. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  15. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  16. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  17. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  18. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  19. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  20. package/dist/features/converters/lexicalToJSX/Component/nodeTags.spec.js +114 -0
  21. package/dist/features/converters/lexicalToJSX/Component/nodeTags.spec.js.map +1 -0
  22. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  23. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  24. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  25. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  26. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  27. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  28. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  29. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  30. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  31. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  32. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
  33. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +16 -43
  34. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  35. package/dist/features/heading/constants.d.ts +2 -0
  36. package/dist/features/heading/constants.d.ts.map +1 -0
  37. package/dist/features/heading/constants.js +2 -0
  38. package/dist/features/heading/constants.js.map +1 -0
  39. package/dist/features/heading/server/index.d.ts.map +1 -1
  40. package/dist/features/heading/server/index.js +8 -2
  41. package/dist/features/heading/server/index.js.map +1 -1
  42. package/dist/features/heading/server/validate.d.ts +6 -0
  43. package/dist/features/heading/server/validate.d.ts.map +1 -0
  44. package/dist/features/heading/server/validate.js +15 -0
  45. package/dist/features/heading/server/validate.js.map +1 -0
  46. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  47. package/dist/features/lists/checklist/server/index.js +5 -2
  48. package/dist/features/lists/checklist/server/index.js.map +1 -1
  49. package/dist/features/lists/htmlConverter.d.ts.map +1 -1
  50. package/dist/features/lists/htmlConverter.js +6 -3
  51. package/dist/features/lists/htmlConverter.js.map +1 -1
  52. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  53. package/dist/features/lists/orderedList/server/index.js +5 -2
  54. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  55. package/dist/features/lists/shared/constants.d.ts +2 -0
  56. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  57. package/dist/features/lists/shared/constants.js +2 -0
  58. package/dist/features/lists/shared/constants.js.map +1 -0
  59. package/dist/features/lists/shared/validate.d.ts +5 -0
  60. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  61. package/dist/features/lists/shared/validate.js +15 -0
  62. package/dist/features/lists/shared/validate.js.map +1 -0
  63. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  64. package/dist/features/lists/unorderedList/server/index.js +5 -2
  65. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  66. package/dist/features/relationship/client/index.d.ts +2 -2
  67. package/dist/features/relationship/client/index.d.ts.map +1 -1
  68. package/dist/features/relationship/client/index.js.map +1 -1
  69. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  70. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  71. package/dist/features/relationship/client/plugins/index.js +27 -31
  72. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  73. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  74. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  75. package/dist/features/relationship/client/utils/useEnabledRelationships.js +52 -50
  76. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  77. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  78. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  79. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  80. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  81. package/dist/features/relationship/server/index.d.ts +8 -1
  82. package/dist/features/relationship/server/index.d.ts.map +1 -1
  83. package/dist/features/relationship/server/index.js +28 -11
  84. package/dist/features/relationship/server/index.js.map +1 -1
  85. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +7 -0
  86. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -0
  87. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +23 -0
  88. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -0
  89. package/dist/features/toolbars/shared/useToolbarStates.d.ts.map +1 -1
  90. package/dist/features/toolbars/shared/useToolbarStates.js +3 -1
  91. package/dist/features/toolbars/shared/useToolbarStates.js.map +1 -1
  92. package/dist/features/upload/client/component/index.js +2 -1
  93. package/dist/features/upload/client/component/index.js.map +1 -1
  94. package/dist/features/upload/client/index.d.ts +3 -2
  95. package/dist/features/upload/client/index.d.ts.map +1 -1
  96. package/dist/features/upload/client/index.js.map +1 -1
  97. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  98. package/dist/features/upload/client/plugin/index.js +47 -52
  99. package/dist/features/upload/client/plugin/index.js.map +1 -1
  100. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  101. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  102. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  103. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  104. package/dist/features/upload/server/index.d.ts +6 -2
  105. package/dist/features/upload/server/index.d.ts.map +1 -1
  106. package/dist/features/upload/server/index.js +21 -14
  107. package/dist/features/upload/server/index.js.map +1 -1
  108. package/dist/features/upload/server/validate.d.ts +2 -2
  109. package/dist/features/upload/server/validate.d.ts.map +1 -1
  110. package/dist/features/upload/server/validate.js +3 -0
  111. package/dist/features/upload/server/validate.js.map +1 -1
  112. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  113. package/dist/field/Diff/converters/listitem/index.js +2 -1
  114. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  115. package/dist/field/Diff/index.d.ts.map +1 -1
  116. package/dist/field/Diff/index.js +1 -0
  117. package/dist/field/Diff/index.js.map +1 -1
  118. package/dist/field/RenderLexical/index.d.ts +3 -1
  119. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  120. package/dist/field/RenderLexical/index.js +23 -23
  121. package/dist/field/RenderLexical/index.js.map +1 -1
  122. package/dist/field/bundled.css +1 -1
  123. package/dist/index.d.ts +1 -1
  124. package/dist/index.js +1 -1
  125. package/dist/index.js.map +1 -1
  126. package/dist/lexical/LexicalEditor.js.map +1 -1
  127. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts +2 -0
  128. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts.map +1 -0
  129. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js +2 -0
  130. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js.map +1 -0
  131. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts +2 -0
  132. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts.map +1 -0
  133. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js +2 -0
  134. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js.map +1 -0
  135. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts +2 -0
  136. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts.map +1 -0
  137. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js +2 -0
  138. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js.map +1 -0
  139. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts +2 -0
  140. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts.map +1 -0
  141. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js +2 -0
  142. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js.map +1 -0
  143. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts +2 -0
  144. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts.map +1 -0
  145. package/dist/lexical-proxy/@lexical-react/ReactExtension.js +2 -0
  146. package/dist/lexical-proxy/@lexical-react/ReactExtension.js.map +1 -0
  147. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts +2 -0
  148. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts.map +1 -0
  149. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js +2 -0
  150. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js.map +1 -0
  151. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts +2 -0
  152. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts.map +1 -0
  153. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js +2 -0
  154. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js.map +1 -0
  155. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts +2 -0
  156. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts.map +1 -0
  157. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js +2 -0
  158. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js.map +1 -0
  159. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts +2 -0
  160. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts.map +1 -0
  161. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js +2 -0
  162. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js.map +1 -0
  163. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts +2 -0
  164. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts.map +1 -0
  165. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js +2 -0
  166. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js.map +1 -0
  167. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts +2 -0
  168. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts.map +1 -0
  169. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js +2 -0
  170. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js.map +1 -0
  171. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts +2 -0
  172. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts.map +1 -0
  173. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js +2 -0
  174. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js.map +1 -0
  175. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts +2 -0
  176. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts.map +1 -0
  177. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js +2 -0
  178. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js.map +1 -0
  179. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts +2 -0
  180. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts.map +1 -0
  181. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js +2 -0
  182. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js.map +1 -0
  183. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts +2 -0
  184. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts.map +1 -0
  185. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js +2 -0
  186. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js.map +1 -0
  187. package/package.json +94 -24
  188. package/dist/exports/client/chunk-FWFDJAJ5.js +0 -2
  189. package/dist/exports/client/chunk-FWFDJAJ5.js.map +0 -7
  190. package/dist/exports/client/component-BAAVC34S.js +0 -2
  191. package/dist/exports/client/component-BAAVC34S.js.map +0 -7
  192. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +0 -2
  193. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +0 -1
  194. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +0 -2
  195. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ListItemNode","ListNode","createServerFeature","createNode","ListHTMLConverter","ListItemHTMLConverter","UNORDERED_LIST","i18n","UnorderedListFeature","feature","ClientFeature","markdownTransformers","nodes","converters","html","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 { ListHTMLConverter, ListItemHTMLConverter } from '../../htmlConverter.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 converters: {\n html: ListHTMLConverter as any, // ListHTMLConverter uses a different generic type than ListNode[exportJSON], thus we need to cast as any\n },\n node: ListNode,\n }),\n createNode({\n converters: {\n html: ListItemHTMLConverter as any,\n },\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,iBAAiB,EAAEC,qBAAqB,QAAQ;AACzD,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,EAAY;QACVC,IAAA,EAAMV;MACR;MACAW,IAAA,EAAMd;IACR,IACAE,UAAA,CAAW;MACTU,UAAA,EAAY;QACVC,IAAA,EAAMT;MACR;MACAU,IAAA,EAAMf;IACR;EAEJ;EACAgB,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["ListItemNode","ListNode","createServerFeature","createNode","ListHTMLConverter","ListItemHTMLConverter","listItemValidation","listValidation","UNORDERED_LIST","i18n","UnorderedListFeature","feature","ClientFeature","markdownTransformers","nodes","converters","html","node","validations","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 { ListHTMLConverter, ListItemHTMLConverter } from '../../htmlConverter.js'\nimport { listItemValidation, listValidation } from '../../shared/validate.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 converters: {\n html: ListHTMLConverter as any, // ListHTMLConverter uses a different generic type than ListNode[exportJSON], thus we need to cast as any\n },\n node: ListNode,\n validations: [listValidation],\n }),\n createNode({\n converters: {\n html: ListItemHTMLConverter as any,\n },\n node: ListItemNode,\n validations: [listItemValidation],\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,iBAAiB,EAAEC,qBAAqB,QAAQ;AACzD,SAASC,kBAAkB,EAAEC,cAAc,QAAQ;AACnD,SAASC,cAAc,QAAQ;AAC/B,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,oBAAA,GAAuBR,mBAAA,CAAoB;EACtDS,OAAA,EAAS;IACPC,aAAA,EAAe;IACfH,IAAA;IACAI,oBAAA,EAAsB,CAACL,cAAA,CAAe;IACtCM,KAAA,EAAO,CACLX,UAAA,CAAW;MACTY,UAAA,EAAY;QACVC,IAAA,EAAMZ;MACR;MACAa,IAAA,EAAMhB,QAAA;MACNiB,WAAA,EAAa,CAACX,cAAA;IAChB,IACAJ,UAAA,CAAW;MACTY,UAAA,EAAY;QACVC,IAAA,EAAMX;MACR;MACAY,IAAA,EAAMjB,YAAA;MACNkB,WAAA,EAAa,CAACZ,kBAAA;IAChB;EAEJ;EACAa,GAAA,EAAK;AACP","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import type { RelationshipFeatureProps } from '../server/index.js';
2
- export declare const RelationshipFeatureClient: import("../../typesClient.js").FeatureProviderProviderClient<RelationshipFeatureProps, RelationshipFeatureProps>;
1
+ import type { RelationshipFeatureClientProps } from '../server/index.js';
2
+ export declare const RelationshipFeatureClient: import("../../typesClient.js").FeatureProviderProviderClient<RelationshipFeatureClientProps, RelationshipFeatureClientProps>;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/client/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAUlE,eAAO,MAAM,yBAAyB,kHAuDpC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/client/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAA;AAUxE,eAAO,MAAM,yBAAyB,8HAuDpC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["$isNodeSelection","RelationshipIcon","createClientFeature","slashMenuBasicGroupWithItems","toolbarAddDropdownGroupWithItems","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND","$isRelationshipNode","RelationshipNode","RelationshipPlugin","RelationshipFeatureClient","nodes","plugins","Component","position","slashMenu","groups","Icon","key","keywords","label","i18n","t","onSelect","editor","dispatchCommand","replace","toolbarFixed","ChildComponent","isActive","selection","getNodes","length","firstNode"],"sources":["../../../../src/features/relationship/client/index.tsx"],"sourcesContent":["'use client'\n\nimport { $isNodeSelection } from 'lexical'\n\nimport type { RelationshipFeatureProps } from '../server/index.js'\n\nimport { RelationshipIcon } from '../../../lexical/ui/icons/Relationship/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { slashMenuBasicGroupWithItems } from '../../shared/slashMenu/basicGroup.js'\nimport { toolbarAddDropdownGroupWithItems } from '../../shared/toolbar/addDropdownGroup.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from './drawer/commands.js'\nimport { $isRelationshipNode, RelationshipNode } from './nodes/RelationshipNode.js'\nimport { RelationshipPlugin } from './plugins/index.js'\n\nexport const RelationshipFeatureClient = createClientFeature<RelationshipFeatureProps>({\n nodes: [RelationshipNode],\n plugins: [\n {\n Component: RelationshipPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n slashMenuBasicGroupWithItems([\n {\n Icon: RelationshipIcon,\n key: 'relationship',\n keywords: ['relationship', 'relation', 'rel'],\n label: ({ i18n }) => {\n return i18n.t('lexical:relationship:label')\n },\n onSelect: ({ editor }) => {\n // dispatch INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: false,\n })\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: [\n toolbarAddDropdownGroupWithItems([\n {\n ChildComponent: RelationshipIcon,\n isActive: ({ selection }) => {\n if (!$isNodeSelection(selection) || !selection.getNodes().length) {\n return false\n }\n\n const firstNode = selection.getNodes()[0]\n return $isRelationshipNode(firstNode)\n },\n key: 'relationship',\n label: ({ i18n }) => {\n return i18n.t('lexical:relationship:label')\n },\n onSelect: ({ editor }) => {\n // dispatch INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: false,\n })\n },\n },\n ]),\n ],\n },\n})\n"],"mappings":"AAAA;;AAEA,SAASA,gBAAgB,QAAQ;AAIjC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,4BAA4B,QAAQ;AAC7C,SAASC,gCAAgC,QAAQ;AACjD,SAASC,uCAAuC,QAAQ;AACxD,SAASC,mBAAmB,EAAEC,gBAAgB,QAAQ;AACtD,SAASC,kBAAkB,QAAQ;AAEnC,OAAO,MAAMC,yBAAA,GAA4BP,mBAAA,CAA8C;EACrFQ,KAAA,EAAO,CAACH,gBAAA,CAAiB;EACzBI,OAAA,EAAS,CACP;IACEC,SAAA,EAAWJ,kBAAA;IACXK,QAAA,EAAU;EACZ,EACD;EACDC,SAAA,EAAW;IACTC,MAAA,EAAQ,CACNZ,4BAAA,CAA6B,CAC3B;MACEa,IAAA,EAAMf,gBAAA;MACNgB,GAAA,EAAK;MACLC,QAAA,EAAU,CAAC,gBAAgB,YAAY,MAAM;MAC7CC,KAAA,EAAOA,CAAC;QAAEC;MAAI,CAAE;QACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;MAChB;MACAC,QAAA,EAAUA,CAAC;QAAEC;MAAM,CAAE;QACnB;QACAA,MAAA,CAAOC,eAAe,CAACnB,uCAAA,EAAyC;UAC9DoB,OAAA,EAAS;QACX;MACF;IACF,EACD;EAEL;EACAC,YAAA,EAAc;IACZX,MAAA,EAAQ,CACNX,gCAAA,CAAiC,CAC/B;MACEuB,cAAA,EAAgB1B,gBAAA;MAChB2B,QAAA,EAAUA,CAAC;QAAEC;MAAS,CAAE;QACtB,IAAI,CAAC7B,gBAAA,CAAiB6B,SAAA,KAAc,CAACA,SAAA,CAAUC,QAAQ,GAAGC,MAAM,EAAE;UAChE,OAAO;QACT;QAEA,MAAMC,SAAA,GAAYH,SAAA,CAAUC,QAAQ,EAAE,CAAC,EAAE;QACzC,OAAOxB,mBAAA,CAAoB0B,SAAA;MAC7B;MACAf,GAAA,EAAK;MACLE,KAAA,EAAOA,CAAC;QAAEC;MAAI,CAAE;QACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;MAChB;MACAC,QAAA,EAAUA,CAAC;QAAEC;MAAM,CAAE;QACnB;QACAA,MAAA,CAAOC,eAAe,CAACnB,uCAAA,EAAyC;UAC9DoB,OAAA,EAAS;QACX;MACF;IACF,EACD;EAEL;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["$isNodeSelection","RelationshipIcon","createClientFeature","slashMenuBasicGroupWithItems","toolbarAddDropdownGroupWithItems","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND","$isRelationshipNode","RelationshipNode","RelationshipPlugin","RelationshipFeatureClient","nodes","plugins","Component","position","slashMenu","groups","Icon","key","keywords","label","i18n","t","onSelect","editor","dispatchCommand","replace","toolbarFixed","ChildComponent","isActive","selection","getNodes","length","firstNode"],"sources":["../../../../src/features/relationship/client/index.tsx"],"sourcesContent":["'use client'\n\nimport { $isNodeSelection } from 'lexical'\n\nimport type { RelationshipFeatureClientProps } from '../server/index.js'\n\nimport { RelationshipIcon } from '../../../lexical/ui/icons/Relationship/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { slashMenuBasicGroupWithItems } from '../../shared/slashMenu/basicGroup.js'\nimport { toolbarAddDropdownGroupWithItems } from '../../shared/toolbar/addDropdownGroup.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from './drawer/commands.js'\nimport { $isRelationshipNode, RelationshipNode } from './nodes/RelationshipNode.js'\nimport { RelationshipPlugin } from './plugins/index.js'\n\nexport const RelationshipFeatureClient = createClientFeature<RelationshipFeatureClientProps>({\n nodes: [RelationshipNode],\n plugins: [\n {\n Component: RelationshipPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n slashMenuBasicGroupWithItems([\n {\n Icon: RelationshipIcon,\n key: 'relationship',\n keywords: ['relationship', 'relation', 'rel'],\n label: ({ i18n }) => {\n return i18n.t('lexical:relationship:label')\n },\n onSelect: ({ editor }) => {\n // dispatch INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: false,\n })\n },\n },\n ]),\n ],\n },\n toolbarFixed: {\n groups: [\n toolbarAddDropdownGroupWithItems([\n {\n ChildComponent: RelationshipIcon,\n isActive: ({ selection }) => {\n if (!$isNodeSelection(selection) || !selection.getNodes().length) {\n return false\n }\n\n const firstNode = selection.getNodes()[0]\n return $isRelationshipNode(firstNode)\n },\n key: 'relationship',\n label: ({ i18n }) => {\n return i18n.t('lexical:relationship:label')\n },\n onSelect: ({ editor }) => {\n // dispatch INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: false,\n })\n },\n },\n ]),\n ],\n },\n})\n"],"mappings":"AAAA;;AAEA,SAASA,gBAAgB,QAAQ;AAIjC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,4BAA4B,QAAQ;AAC7C,SAASC,gCAAgC,QAAQ;AACjD,SAASC,uCAAuC,QAAQ;AACxD,SAASC,mBAAmB,EAAEC,gBAAgB,QAAQ;AACtD,SAASC,kBAAkB,QAAQ;AAEnC,OAAO,MAAMC,yBAAA,GAA4BP,mBAAA,CAAoD;EAC3FQ,KAAA,EAAO,CAACH,gBAAA,CAAiB;EACzBI,OAAA,EAAS,CACP;IACEC,SAAA,EAAWJ,kBAAA;IACXK,QAAA,EAAU;EACZ,EACD;EACDC,SAAA,EAAW;IACTC,MAAA,EAAQ,CACNZ,4BAAA,CAA6B,CAC3B;MACEa,IAAA,EAAMf,gBAAA;MACNgB,GAAA,EAAK;MACLC,QAAA,EAAU,CAAC,gBAAgB,YAAY,MAAM;MAC7CC,KAAA,EAAOA,CAAC;QAAEC;MAAI,CAAE;QACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;MAChB;MACAC,QAAA,EAAUA,CAAC;QAAEC;MAAM,CAAE;QACnB;QACAA,MAAA,CAAOC,eAAe,CAACnB,uCAAA,EAAyC;UAC9DoB,OAAA,EAAS;QACX;MACF;IACF,EACD;EAEL;EACAC,YAAA,EAAc;IACZX,MAAA,EAAQ,CACNX,gCAAA,CAAiC,CAC/B;MACEuB,cAAA,EAAgB1B,gBAAA;MAChB2B,QAAA,EAAUA,CAAC;QAAEC;MAAS,CAAE;QACtB,IAAI,CAAC7B,gBAAA,CAAiB6B,SAAA,KAAc,CAACA,SAAA,CAAUC,QAAQ,GAAGC,MAAM,EAAE;UAChE,OAAO;QACT;QAEA,MAAMC,SAAA,GAAYH,SAAA,CAAUC,QAAQ,EAAE,CAAC,EAAE;QACzC,OAAOxB,mBAAA,CAAoB0B,SAAA;MAC7B;MACAf,GAAA,EAAK;MACLE,KAAA,EAAOA,CAAC;QAAEC;MAAI,CAAE;QACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;MAChB;MACAC,QAAA,EAAUA,CAAC;QAAEC;MAAM,CAAE;QACnB;QACAA,MAAA,CAAOC,eAAe,CAACnB,uCAAA,EAAyC;UAC9DoB,OAAA,EAAS;QACX;MACF;IACF,EACD;EAEL;AACF","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import type { LexicalCommand } from 'lexical';
2
2
  import type { PluginComponent } from '../../../typesClient.js';
3
- import type { RelationshipFeatureProps } from '../../server/index.js';
3
+ import type { RelationshipFeatureClientProps } from '../../server/index.js';
4
4
  import type { RelationshipData } from '../../server/nodes/RelationshipNode.js';
5
5
  export declare const INSERT_RELATIONSHIP_COMMAND: LexicalCommand<RelationshipData>;
6
- export declare const RelationshipPlugin: PluginComponent<RelationshipFeatureProps>;
6
+ export declare const RelationshipPlugin: PluginComponent<RelationshipFeatureClientProps>;
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/client/plugins/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAc7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AAM9E,eAAO,MAAM,2BAA2B,EAAE,cAAc,CAAC,gBAAgB,CAExE,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAAC,wBAAwB,CAuCxE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/client/plugins/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAc7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAA;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AAM9E,eAAO,MAAM,2BAA2B,EAAE,cAAc,CAAC,gBAAgB,CAExE,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAAC,8BAA8B,CAwC9E,CAAA"}
@@ -11,57 +11,53 @@ import { $createRelationshipNode, RelationshipNode } from '../nodes/Relationship
11
11
  import { useEnabledRelationships } from '../utils/useEnabledRelationships.js';
12
12
  export const INSERT_RELATIONSHIP_COMMAND = createCommand('INSERT_RELATIONSHIP_COMMAND');
13
13
  export const RelationshipPlugin = t0 => {
14
- const $ = _c(8);
14
+ const $ = _c(7);
15
15
  const {
16
16
  clientProps
17
17
  } = t0;
18
18
  const [editor] = useLexicalComposerContext();
19
- const t1 = clientProps?.disabledCollections;
20
- const t2 = clientProps?.enabledCollections;
21
- let t3;
22
- if ($[0] !== t1 || $[1] !== t2) {
23
- t3 = {
24
- collectionSlugsBlacklist: t1,
25
- collectionSlugsWhitelist: t2
19
+ let t1;
20
+ if ($[0] !== clientProps.enabledCollectionSlugs) {
21
+ t1 = {
22
+ enabledCollectionSlugs: clientProps.enabledCollectionSlugs
26
23
  };
27
- $[0] = t1;
28
- $[1] = t2;
29
- $[2] = t3;
24
+ $[0] = clientProps.enabledCollectionSlugs;
25
+ $[1] = t1;
30
26
  } else {
31
- t3 = $[2];
27
+ t1 = $[1];
32
28
  }
33
29
  const {
34
30
  enabledCollectionSlugs
35
- } = useEnabledRelationships(t3);
36
- let t4;
37
- let t5;
38
- if ($[3] !== editor) {
39
- t4 = () => {
31
+ } = useEnabledRelationships(t1);
32
+ let t2;
33
+ let t3;
34
+ if ($[2] !== editor) {
35
+ t2 = () => {
40
36
  if (!editor.hasNodes([RelationshipNode])) {
41
37
  throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");
42
38
  }
43
39
  return editor.registerCommand(INSERT_RELATIONSHIP_COMMAND, _temp, COMMAND_PRIORITY_EDITOR);
44
40
  };
45
- t5 = [editor];
46
- $[3] = editor;
47
- $[4] = t4;
48
- $[5] = t5;
41
+ t3 = [editor];
42
+ $[2] = editor;
43
+ $[3] = t2;
44
+ $[4] = t3;
49
45
  } else {
50
- t4 = $[4];
51
- t5 = $[5];
46
+ t2 = $[3];
47
+ t3 = $[4];
52
48
  }
53
- useEffect(t4, t5);
54
- let t6;
55
- if ($[6] !== enabledCollectionSlugs) {
56
- t6 = _jsx(RelationshipDrawer, {
49
+ useEffect(t2, t3);
50
+ let t4;
51
+ if ($[5] !== enabledCollectionSlugs) {
52
+ t4 = _jsx(RelationshipDrawer, {
57
53
  enabledCollectionSlugs
58
54
  });
59
- $[6] = enabledCollectionSlugs;
60
- $[7] = t6;
55
+ $[5] = enabledCollectionSlugs;
56
+ $[6] = t4;
61
57
  } else {
62
- t6 = $[7];
58
+ t4 = $[6];
63
59
  }
64
- return t6;
60
+ return t4;
65
61
  };
66
62
  function _temp(payload) {
67
63
  const selection = $getSelection() || $getPreviousSelection();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$insertNodeToNearestRoot","$getPreviousSelection","$getSelection","$isParagraphNode","$isRangeSelection","COMMAND_PRIORITY_EDITOR","createCommand","useEffect","RelationshipDrawer","$createRelationshipNode","RelationshipNode","useEnabledRelationships","INSERT_RELATIONSHIP_COMMAND","RelationshipPlugin","t0","$","clientProps","editor","t1","disabledCollections","t2","enabledCollections","t3","collectionSlugsBlacklist","collectionSlugsWhitelist","enabledCollectionSlugs","t4","t5","hasNodes","Error","registerCommand","_temp","t6","_jsx","payload","selection","relationshipNode","focus","focusNode","getNode","__first","remove"],"sources":["../../../../../src/features/relationship/client/plugins/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $insertNodeToNearestRoot } from '@lexical/utils'\nimport {\n $getPreviousSelection,\n $getSelection,\n $isParagraphNode,\n $isRangeSelection,\n COMMAND_PRIORITY_EDITOR,\n createCommand,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../typesClient.js'\nimport type { RelationshipFeatureProps } from '../../server/index.js'\nimport type { RelationshipData } from '../../server/nodes/RelationshipNode.js'\n\nimport { RelationshipDrawer } from '../drawer/index.js'\nimport { $createRelationshipNode, RelationshipNode } from '../nodes/RelationshipNode.js'\nimport { useEnabledRelationships } from '../utils/useEnabledRelationships.js'\n\nexport const INSERT_RELATIONSHIP_COMMAND: LexicalCommand<RelationshipData> = createCommand(\n 'INSERT_RELATIONSHIP_COMMAND',\n)\n\nexport const RelationshipPlugin: PluginComponent<RelationshipFeatureProps> = ({ clientProps }) => {\n const [editor] = useLexicalComposerContext()\n\n const { enabledCollectionSlugs } = useEnabledRelationships({\n collectionSlugsBlacklist: clientProps?.disabledCollections,\n collectionSlugsWhitelist: clientProps?.enabledCollections,\n })\n\n useEffect(() => {\n if (!editor.hasNodes([RelationshipNode])) {\n throw new Error('RelationshipPlugin: RelationshipNode not registered on editor')\n }\n\n return editor.registerCommand<RelationshipData>(\n INSERT_RELATIONSHIP_COMMAND,\n (payload) => {\n const selection = $getSelection() || $getPreviousSelection()\n\n if ($isRangeSelection(selection)) {\n const relationshipNode = $createRelationshipNode(payload)\n // we need to get the focus node before inserting the block node, as $insertNodeToNearestRoot can change the focus node\n const { focus } = selection\n const focusNode = focus.getNode()\n // Insert relationship node BEFORE potentially removing focusNode, as $insertNodeToNearestRoot errors if the focusNode doesn't exist\n $insertNodeToNearestRoot(relationshipNode)\n\n // Delete the node it it's an empty paragraph\n if ($isParagraphNode(focusNode) && !focusNode.__first) {\n focusNode.remove()\n }\n }\n\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor])\n\n return <RelationshipDrawer enabledCollectionSlugs={enabledCollectionSlugs} />\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,wBAAwB,QAAQ;AACzC,SACEC,qBAAqB,EACrBC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,uBAAuB,EACvBC,aAAa,QACR;AACP,SAASC,SAAS,QAAQ;AAM1B,SAASC,kBAAkB,QAAQ;AACnC,SAASC,uBAAuB,EAAEC,gBAAgB,QAAQ;AAC1D,SAASC,uBAAuB,QAAQ;AAExC,OAAO,MAAMC,2BAAA,GAAgEN,aAAA,CAC3E;AAGF,OAAO,MAAMO,kBAAA,GAAgEC,EAAA;EAAA,MAAAC,CAAA,GAAAjB,EAAA;EAAC;IAAAkB;EAAA,IAAAF,EAAe;EAC3F,OAAAG,MAAA,IAAiBlB,yBAAA;E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,SAAA;IAClB,MAAAG,SAAA,GAAkBD,KAAA,CAAAE,OAAA,CAAa;IAE/BvC,wBAAA,CAAyBoC,gBAAA;IAAA,IAGrBjC,gBAAA,CAAiBmC,SAAA,MAAeA,SAAA,CAAAE,OAAiB;MACnDF,SAAA,CAAAG,MAAA,CAAgB;IAAA;EAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$insertNodeToNearestRoot","$getPreviousSelection","$getSelection","$isParagraphNode","$isRangeSelection","COMMAND_PRIORITY_EDITOR","createCommand","useEffect","RelationshipDrawer","$createRelationshipNode","RelationshipNode","useEnabledRelationships","INSERT_RELATIONSHIP_COMMAND","RelationshipPlugin","t0","$","clientProps","editor","t1","enabledCollectionSlugs","t2","t3","hasNodes","Error","registerCommand","_temp","t4","_jsx","payload","selection","relationshipNode","focus","focusNode","getNode","__first","remove"],"sources":["../../../../../src/features/relationship/client/plugins/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $insertNodeToNearestRoot } from '@lexical/utils'\nimport {\n $getPreviousSelection,\n $getSelection,\n $isParagraphNode,\n $isRangeSelection,\n COMMAND_PRIORITY_EDITOR,\n createCommand,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../typesClient.js'\nimport type { RelationshipFeatureClientProps } from '../../server/index.js'\nimport type { RelationshipData } from '../../server/nodes/RelationshipNode.js'\n\nimport { RelationshipDrawer } from '../drawer/index.js'\nimport { $createRelationshipNode, RelationshipNode } from '../nodes/RelationshipNode.js'\nimport { useEnabledRelationships } from '../utils/useEnabledRelationships.js'\n\nexport const INSERT_RELATIONSHIP_COMMAND: LexicalCommand<RelationshipData> = createCommand(\n 'INSERT_RELATIONSHIP_COMMAND',\n)\n\nexport const RelationshipPlugin: PluginComponent<RelationshipFeatureClientProps> = ({\n clientProps,\n}) => {\n const [editor] = useLexicalComposerContext()\n\n const { enabledCollectionSlugs } = useEnabledRelationships({\n enabledCollectionSlugs: clientProps.enabledCollectionSlugs,\n })\n\n useEffect(() => {\n if (!editor.hasNodes([RelationshipNode])) {\n throw new Error('RelationshipPlugin: RelationshipNode not registered on editor')\n }\n\n return editor.registerCommand<RelationshipData>(\n INSERT_RELATIONSHIP_COMMAND,\n (payload) => {\n const selection = $getSelection() || $getPreviousSelection()\n\n if ($isRangeSelection(selection)) {\n const relationshipNode = $createRelationshipNode(payload)\n // we need to get the focus node before inserting the block node, as $insertNodeToNearestRoot can change the focus node\n const { focus } = selection\n const focusNode = focus.getNode()\n // Insert relationship node BEFORE potentially removing focusNode, as $insertNodeToNearestRoot errors if the focusNode doesn't exist\n $insertNodeToNearestRoot(relationshipNode)\n\n // Delete the node it it's an empty paragraph\n if ($isParagraphNode(focusNode) && !focusNode.__first) {\n focusNode.remove()\n }\n }\n\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor])\n\n return <RelationshipDrawer enabledCollectionSlugs={enabledCollectionSlugs} />\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,wBAAwB,QAAQ;AACzC,SACEC,qBAAqB,EACrBC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,uBAAuB,EACvBC,aAAa,QACR;AACP,SAASC,SAAS,QAAQ;AAM1B,SAASC,kBAAkB,QAAQ;AACnC,SAASC,uBAAuB,EAAEC,gBAAgB,QAAQ;AAC1D,SAASC,uBAAuB,QAAQ;AAExC,OAAO,MAAMC,2BAAA,GAAgEN,aAAA,CAC3E;AAGF,OAAO,MAAMO,kBAAA,GAAsEC,EAAA;EAAA,MAAAC,CAAA,GAAAjB,EAAA;EAAC;IAAAkB;EAAA,IAAAF,EAEnF;EACC,OAAAG,MAAA,IAAiBlB,yBAAA;EAAA,IAAAmB,EAAA;EAAA,IAAAH,C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CAAAG,MAAA,CAAgB;IAAA;EAAA;EAAA;AAAA","ignoreList":[]}
@@ -1,13 +1,11 @@
1
1
  import type { ClientCollectionConfig, CollectionSlug } from 'payload';
2
2
  type UseEnabledRelationshipsOptions = {
3
- collectionSlugsBlacklist?: string[];
4
- collectionSlugsWhitelist?: string[];
5
- uploads?: boolean;
3
+ enabledCollectionSlugs: CollectionSlug[];
6
4
  };
7
5
  type UseEnabledRelationshipsResult = {
8
6
  enabledCollections: ClientCollectionConfig[];
9
7
  enabledCollectionSlugs: CollectionSlug[];
10
8
  };
11
- export declare const useEnabledRelationships: (options?: UseEnabledRelationshipsOptions) => UseEnabledRelationshipsResult;
9
+ export declare const useEnabledRelationships: ({ enabledCollectionSlugs, }: UseEnabledRelationshipsOptions) => UseEnabledRelationshipsResult;
12
10
  export {};
13
11
  //# sourceMappingURL=useEnabledRelationships.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEnabledRelationships.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/client/utils/useEnabledRelationships.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAKrE,KAAK,8BAA8B,GAAG;IACpC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,6BAA6B,GAAG;IACnC,kBAAkB,EAAE,sBAAsB,EAAE,CAAA;IAC5C,sBAAsB,EAAE,cAAc,EAAE,CAAA;CACzC,CAAA;AAED,eAAO,MAAM,uBAAuB,aACxB,8BAA8B,KACvC,6BAsDF,CAAA"}
1
+ {"version":3,"file":"useEnabledRelationships.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/client/utils/useEnabledRelationships.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAKrE,KAAK,8BAA8B,GAAG;IACpC,sBAAsB,EAAE,cAAc,EAAE,CAAA;CACzC,CAAA;AAED,KAAK,6BAA6B,GAAG;IACnC,kBAAkB,EAAE,sBAAsB,EAAE,CAAA;IAC5C,sBAAsB,EAAE,cAAc,EAAE,CAAA;CACzC,CAAA;AAED,eAAO,MAAM,uBAAuB,gCAEjC,8BAA8B,KAAG,6BAgBnC,CAAA"}
@@ -1,64 +1,66 @@
1
1
  'use client';
2
2
 
3
+ import { c as _c } from "react/compiler-runtime";
3
4
  import { useConfig, useEntityVisibility } from '@payloadcms/ui';
4
5
  import * as React from 'react';
5
- export const useEnabledRelationships = options => {
6
+ export const useEnabledRelationships = t0 => {
7
+ const $ = _c(11);
6
8
  const {
7
- collectionSlugsBlacklist,
8
- collectionSlugsWhitelist,
9
- uploads = false
10
- } = options || {};
9
+ enabledCollectionSlugs
10
+ } = t0;
11
11
  const {
12
- config: {
13
- collections
14
- }
12
+ config: t1
15
13
  } = useConfig();
14
+ const {
15
+ collections
16
+ } = t1;
16
17
  const {
17
18
  visibleEntities
18
19
  } = useEntityVisibility();
19
- const result = React.useMemo(() => {
20
- const enabledCollectionSlugs = [];
21
- const enabledCollections = [];
22
- const whitelistSet = collectionSlugsWhitelist ? new Set(collectionSlugsWhitelist) : null;
23
- const blacklistSet = collectionSlugsBlacklist ? new Set(collectionSlugsBlacklist) : null;
24
- for (const collection of collections) {
25
- const {
26
- slug,
27
- admin: {
28
- enableRichTextRelationship
29
- },
30
- upload
31
- } = collection;
32
- // Check visibility
33
- if (!visibleEntities?.collections.includes(slug)) {
34
- continue;
35
- }
36
- // Check rich text relationship and upload settings
37
- if (uploads) {
38
- if (!enableRichTextRelationship || !upload) {
39
- continue;
40
- }
41
- } else {
42
- if (upload || !enableRichTextRelationship) {
43
- continue;
44
- }
45
- }
46
- // Check whitelist (if provided, only include slugs in the whitelist)
47
- if (whitelistSet && !whitelistSet.has(slug)) {
48
- continue;
49
- }
50
- // Check blacklist (if provided, exclude slugs in the blacklist)
51
- if (blacklistSet && blacklistSet.has(slug)) {
52
- continue;
53
- }
54
- enabledCollectionSlugs.push(slug);
55
- enabledCollections.push(collection);
20
+ let t2;
21
+ let t3;
22
+ if ($[0] !== collections || $[1] !== enabledCollectionSlugs || $[2] !== visibleEntities?.collections) {
23
+ let t4;
24
+ if ($[5] !== enabledCollectionSlugs || $[6] !== visibleEntities?.collections) {
25
+ t4 = t5 => {
26
+ const {
27
+ slug
28
+ } = t5;
29
+ return enabledCollectionSlugs.includes(slug) && visibleEntities?.collections.includes(slug);
30
+ };
31
+ $[5] = enabledCollectionSlugs;
32
+ $[6] = visibleEntities?.collections;
33
+ $[7] = t4;
34
+ } else {
35
+ t4 = $[7];
56
36
  }
57
- return {
58
- enabledCollections,
59
- enabledCollectionSlugs
37
+ const enabledCollections = collections.filter(t4);
38
+ t2 = enabledCollections;
39
+ t3 = enabledCollections.map(_temp);
40
+ $[0] = collections;
41
+ $[1] = enabledCollectionSlugs;
42
+ $[2] = visibleEntities?.collections;
43
+ $[3] = t2;
44
+ $[4] = t3;
45
+ } else {
46
+ t2 = $[3];
47
+ t3 = $[4];
48
+ }
49
+ let t4;
50
+ if ($[8] !== t2 || $[9] !== t3) {
51
+ t4 = {
52
+ enabledCollections: t2,
53
+ enabledCollectionSlugs: t3
60
54
  };
61
- }, [collections, visibleEntities, uploads, collectionSlugsWhitelist, collectionSlugsBlacklist]);
62
- return result;
55
+ $[8] = t2;
56
+ $[9] = t3;
57
+ $[10] = t4;
58
+ } else {
59
+ t4 = $[10];
60
+ }
61
+ return t4;
63
62
  };
63
+ function _temp(c) {
64
+ return c.slug;
65
+ }
64
66
  //# sourceMappingURL=useEnabledRelationships.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEnabledRelationships.js","names":["useConfig","useEntityVisibility","React","useEnabledRelationships","options","collectionSlugsBlacklist","collectionSlugsWhitelist","uploads","config","collections","visibleEntities","result","useMemo","enabledCollectionSlugs","enabledCollections","whitelistSet","Set","blacklistSet","collection","slug","admin","enableRichTextRelationship","upload","includes","has","push"],"sources":["../../../../../src/features/relationship/client/utils/useEnabledRelationships.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig, CollectionSlug } from 'payload'\n\nimport { useConfig, useEntityVisibility } from '@payloadcms/ui'\nimport * as React from 'react'\n\ntype UseEnabledRelationshipsOptions = {\n collectionSlugsBlacklist?: string[]\n collectionSlugsWhitelist?: string[]\n uploads?: boolean\n}\n\ntype UseEnabledRelationshipsResult = {\n enabledCollections: ClientCollectionConfig[]\n enabledCollectionSlugs: CollectionSlug[]\n}\n\nexport const useEnabledRelationships = (\n options?: UseEnabledRelationshipsOptions,\n): UseEnabledRelationshipsResult => {\n const { collectionSlugsBlacklist, collectionSlugsWhitelist, uploads = false } = options || {}\n const {\n config: { collections },\n } = useConfig()\n const { visibleEntities } = useEntityVisibility()\n\n const result = React.useMemo(() => {\n const enabledCollectionSlugs: string[] = []\n const enabledCollections: ClientCollectionConfig[] = []\n const whitelistSet = collectionSlugsWhitelist ? new Set(collectionSlugsWhitelist) : null\n const blacklistSet = collectionSlugsBlacklist ? new Set(collectionSlugsBlacklist) : null\n\n for (const collection of collections) {\n const {\n slug,\n admin: { enableRichTextRelationship },\n upload,\n } = collection\n\n // Check visibility\n if (!visibleEntities?.collections.includes(slug)) {\n continue\n }\n\n // Check rich text relationship and upload settings\n if (uploads) {\n if (!enableRichTextRelationship || !upload) {\n continue\n }\n } else {\n if (upload || !enableRichTextRelationship) {\n continue\n }\n }\n\n // Check whitelist (if provided, only include slugs in the whitelist)\n if (whitelistSet && !whitelistSet.has(slug)) {\n continue\n }\n\n // Check blacklist (if provided, exclude slugs in the blacklist)\n if (blacklistSet && blacklistSet.has(slug)) {\n continue\n }\n\n enabledCollectionSlugs.push(slug)\n enabledCollections.push(collection)\n }\n\n return { enabledCollections, enabledCollectionSlugs }\n }, [collections, visibleEntities, uploads, collectionSlugsWhitelist, collectionSlugsBlacklist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AC5BL,kBAAA,CAAmBW,IAAI,CAACP,UAAA;IAC1B;IAEA,OAAO;MAAEJ,kBAAA;MAAoBD;IAAuB;EACtD,GAAG,CAACJ,WAAA,EAAaC,eAAA,EAAiBH,OAAA,EAASD,wBAAA,EAA0BD,wBAAA,CAAyB;EAE9F,OAAOM,MAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"useEnabledRelationships.js","names":["c","_c","useConfig","useEntityVisibility","React","useEnabledRelationships","t0","$","enabledCollectionSlugs","config","t1","collections","visibleEntities","t2","t3","t4","t5","slug","includes","enabledCollections","filter","map","_temp"],"sources":["../../../../../src/features/relationship/client/utils/useEnabledRelationships.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig, CollectionSlug } from 'payload'\n\nimport { useConfig, useEntityVisibility } from '@payloadcms/ui'\nimport * as React from 'react'\n\ntype UseEnabledRelationshipsOptions = {\n enabledCollectionSlugs: CollectionSlug[]\n}\n\ntype UseEnabledRelationshipsResult = {\n enabledCollections: ClientCollectionConfig[]\n enabledCollectionSlugs: CollectionSlug[]\n}\n\nexport const useEnabledRelationships = ({\n enabledCollectionSlugs,\n}: UseEnabledRelationshipsOptions): UseEnabledRelationshipsResult => {\n const {\n config: { collections },\n } = useConfig()\n const { visibleEntities } = useEntityVisibility()\n\n return React.useMemo(() => {\n const enabledCollections = collections.filter(\n ({ slug }) =>\n enabledCollectionSlugs.includes(slug) && visibleEntities?.collections.includes(slug),\n )\n return {\n enabledCollections,\n enabledCollectionSlugs: enabledCollections.map((c) => c.slug),\n }\n }, [collections, enabledCollectionSlugs, visibleEntities])\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAGA,SAASC,SAAS,EAAEC,mBAAmB,QAAQ;AAC/C,YAAYC,KAAA,MAAW;AAWvB,OAAO,MAAMC,uBAAA,GAA0BC,EAAA;EAAA,MAAAC,CAAA,GAAAN,EAAA;EAAC;IAAAO;EAAA,IAAAF,EAEP;EAC/B;IAAAG,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,EAAA;EAAA;IAAAA,EAAA,GAAAR,CAAA;EAAA;EAAA,OAHOQ,EAGP;AAAA,CAEJ;AAlBuC,SAAAO,MAAAtB,CAAA;EAAA,OAeqBA,CAAA,CAAAiB,IAAA;AAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import type { PopulationPromise } from '../../typesServer.js';
2
- import type { RelationshipFeatureProps } from './index.js';
2
+ import type { RelationshipFeatureServerProps } from './index.js';
3
3
  import type { SerializedRelationshipNode } from './nodes/RelationshipNode.js';
4
- export declare const relationshipPopulationPromiseHOC: (props: RelationshipFeatureProps) => PopulationPromise<SerializedRelationshipNode>;
4
+ export declare const relationshipPopulationPromiseHOC: (props: RelationshipFeatureServerProps) => PopulationPromise<SerializedRelationshipNode>;
5
5
  //# sourceMappingURL=graphQLPopulationPromise.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphQLPopulationPromise.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/server/graphQLPopulationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAA;AAI7E,eAAO,MAAM,gCAAgC,UACpC,wBAAwB,KAC9B,iBAAiB,CAAC,0BAA0B,CAwC9C,CAAA"}
1
+ {"version":3,"file":"graphQLPopulationPromise.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/server/graphQLPopulationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAA;AAChE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAA;AAI7E,eAAO,MAAM,gCAAgC,UACpC,8BAA8B,KACpC,iBAAiB,CAAC,0BAA0B,CAwC9C,CAAA"}
@@ -10,13 +10,13 @@ export const relationshipPopulationPromiseHOC = props => {
10
10
  req,
11
11
  showHiddenFields
12
12
  }) => {
13
- if (node?.value) {
13
+ if (node?.value && props.enabledCollectionSlugs.includes(node.relationTo)) {
14
14
  // @ts-expect-error
15
15
  const id = node?.value?.id || node?.value // for backwards-compatibility
16
16
  ;
17
17
  const collection = req.payload.collections[node?.relationTo];
18
18
  if (collection) {
19
- const populateDepth = props?.maxDepth !== undefined && props?.maxDepth < depth ? props?.maxDepth : depth;
19
+ const populateDepth = props.maxDepth !== undefined && props.maxDepth < depth ? props.maxDepth : depth;
20
20
  populationPromises.push(populate({
21
21
  id,
22
22
  collectionSlug: collection.config.slug,
@@ -1 +1 @@
1
- {"version":3,"file":"graphQLPopulationPromise.js","names":["populate","relationshipPopulationPromiseHOC","props","relationshipPopulationPromise","currentDepth","depth","draft","node","overrideAccess","populationPromises","req","showHiddenFields","value","id","collection","payload","collections","relationTo","populateDepth","maxDepth","undefined","push","collectionSlug","config","slug","data","key"],"sources":["../../../../src/features/relationship/server/graphQLPopulationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../../typesServer.js'\nimport type { RelationshipFeatureProps } from './index.js'\nimport type { SerializedRelationshipNode } from './nodes/RelationshipNode.js'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\n\nexport const relationshipPopulationPromiseHOC = (\n props: RelationshipFeatureProps,\n): PopulationPromise<SerializedRelationshipNode> => {\n const relationshipPopulationPromise: PopulationPromise<SerializedRelationshipNode> = ({\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (node?.value) {\n // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n const collection = req.payload.collections[node?.relationTo]\n\n if (collection) {\n const populateDepth =\n props?.maxDepth !== undefined && props?.maxDepth < depth ? props?.maxDepth : depth\n\n populationPromises.push(\n populate({\n id,\n collectionSlug: collection.config.slug,\n currentDepth,\n data: node,\n depth: populateDepth,\n draft,\n key: 'value',\n overrideAccess,\n req,\n showHiddenFields,\n }),\n )\n }\n }\n }\n\n return relationshipPopulationPromise\n}\n"],"mappings":"AAIA,SAASA,QAAQ,QAAQ;AAEzB,OAAO,MAAMC,gCAAA,GACXC,KAAA;EAEA,MAAMC,6BAAA,GAA+EA,CAAC;IACpFC,YAAY;IACZC,KAAK;IACLC,KAAK;IACLC,IAAI;IACJC,cAAc;IACdC,kBAAkB;IAClBC,GAAG;IACHC;EAAgB,CACjB;IACC,IAAIJ,IAAA,EAAMK,KAAA,EAAO;MACf;MACA,MAAMC,EAAA,GAAKN,IAAA,EAAMK,KAAA,EAAOC,EAAA,IAAMN,IAAA,EAAMK,KAAA,CAAM;AAAA;MAE1C,MAAME,UAAA,GAAaJ,GAAA,CAAIK,OAAO,CAACC,WAAW,CAACT,IAAA,EAAMU,UAAA,CAAW;MAE5D,IAAIH,UAAA,EAAY;QACd,MAAMI,aAAA,GACJhB,KAAA,EAAOiB,QAAA,KAAaC,SAAA,IAAalB,KAAA,EAAOiB,QAAA,GAAWd,KAAA,GAAQH,KAAA,EAAOiB,QAAA,GAAWd,KAAA;QAE/EI,kBAAA,CAAmBY,IAAI,CACrBrB,QAAA,CAAS;UACPa,EAAA;UACAS,cAAA,EAAgBR,UAAA,CAAWS,MAAM,CAACC,IAAI;UACtCpB,YAAA;UACAqB,IAAA,EAAMlB,IAAA;UACNF,KAAA,EAAOa,aAAA;UACPZ,KAAA;UACAoB,GAAA,EAAK;UACLlB,cAAA;UACAE,GAAA;UACAC;QACF;MAEJ;IACF;EACF;EAEA,OAAOR,6BAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"graphQLPopulationPromise.js","names":["populate","relationshipPopulationPromiseHOC","props","relationshipPopulationPromise","currentDepth","depth","draft","node","overrideAccess","populationPromises","req","showHiddenFields","value","enabledCollectionSlugs","includes","relationTo","id","collection","payload","collections","populateDepth","maxDepth","undefined","push","collectionSlug","config","slug","data","key"],"sources":["../../../../src/features/relationship/server/graphQLPopulationPromise.ts"],"sourcesContent":["import type { PopulationPromise } from '../../typesServer.js'\nimport type { RelationshipFeatureServerProps } from './index.js'\nimport type { SerializedRelationshipNode } from './nodes/RelationshipNode.js'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\n\nexport const relationshipPopulationPromiseHOC = (\n props: RelationshipFeatureServerProps,\n): PopulationPromise<SerializedRelationshipNode> => {\n const relationshipPopulationPromise: PopulationPromise<SerializedRelationshipNode> = ({\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (node?.value && props.enabledCollectionSlugs.includes(node.relationTo)) {\n // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n const collection = req.payload.collections[node?.relationTo]\n\n if (collection) {\n const populateDepth =\n props.maxDepth !== undefined && props.maxDepth < depth ? props.maxDepth : depth\n\n populationPromises.push(\n populate({\n id,\n collectionSlug: collection.config.slug,\n currentDepth,\n data: node,\n depth: populateDepth,\n draft,\n key: 'value',\n overrideAccess,\n req,\n showHiddenFields,\n }),\n )\n }\n }\n }\n\n return relationshipPopulationPromise\n}\n"],"mappings":"AAIA,SAASA,QAAQ,QAAQ;AAEzB,OAAO,MAAMC,gCAAA,GACXC,KAAA;EAEA,MAAMC,6BAAA,GAA+EA,CAAC;IACpFC,YAAY;IACZC,KAAK;IACLC,KAAK;IACLC,IAAI;IACJC,cAAc;IACdC,kBAAkB;IAClBC,GAAG;IACHC;EAAgB,CACjB;IACC,IAAIJ,IAAA,EAAMK,KAAA,IAASV,KAAA,CAAMW,sBAAsB,CAACC,QAAQ,CAACP,IAAA,CAAKQ,UAAU,GAAG;MACzE;MACA,MAAMC,EAAA,GAAKT,IAAA,EAAMK,KAAA,EAAOI,EAAA,IAAMT,IAAA,EAAMK,KAAA,CAAM;AAAA;MAE1C,MAAMK,UAAA,GAAaP,GAAA,CAAIQ,OAAO,CAACC,WAAW,CAACZ,IAAA,EAAMQ,UAAA,CAAW;MAE5D,IAAIE,UAAA,EAAY;QACd,MAAMG,aAAA,GACJlB,KAAA,CAAMmB,QAAQ,KAAKC,SAAA,IAAapB,KAAA,CAAMmB,QAAQ,GAAGhB,KAAA,GAAQH,KAAA,CAAMmB,QAAQ,GAAGhB,KAAA;QAE5EI,kBAAA,CAAmBc,IAAI,CACrBvB,QAAA,CAAS;UACPgB,EAAA;UACAQ,cAAA,EAAgBP,UAAA,CAAWQ,MAAM,CAACC,IAAI;UACtCtB,YAAA;UACAuB,IAAA,EAAMpB,IAAA;UACNF,KAAA,EAAOe,aAAA;UACPd,KAAA;UACAsB,GAAA,EAAK;UACLpB,cAAA;UACAE,GAAA;UACAC;QACF;MAEJ;IACF;EACF;EAEA,OAAOR,6BAAA;AACT","ignoreList":[]}
@@ -23,5 +23,12 @@ export type RelationshipFeatureProps = {
23
23
  */
24
24
  maxDepth?: number;
25
25
  } & ExclusiveRelationshipFeatureProps;
26
- export declare const RelationshipFeature: import("../../typesServer.js").FeatureProviderProviderServer<RelationshipFeatureProps, RelationshipFeatureProps, ExclusiveRelationshipFeatureProps>;
26
+ export type RelationshipFeatureServerProps = {
27
+ /** Collection policy resolved during feature initialization. */
28
+ enabledCollectionSlugs: CollectionSlug[];
29
+ } & RelationshipFeatureProps;
30
+ export type RelationshipFeatureClientProps = {
31
+ enabledCollectionSlugs: CollectionSlug[];
32
+ };
33
+ export declare const RelationshipFeature: import("../../typesServer.js").FeatureProviderProviderServer<RelationshipFeatureProps, RelationshipFeatureServerProps, RelationshipFeatureClientProps>;
27
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAS7C,MAAM,MAAM,iCAAiC,GACzC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAA;IAGtC,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,cAAc,EAAE,CAAA;CACtC,CAAA;AAEL,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,iCAAiC,CAAA;AAErC,eAAO,MAAM,mBAAmB,qJAoE9B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAU7C,MAAM,MAAM,iCAAiC,GACzC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAA;IAGtC,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,cAAc,EAAE,CAAA;CACtC,CAAA;AAEL,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,iCAAiC,CAAA;AAErC,MAAM,MAAM,8BAA8B,GAAG;IAC3C,gEAAgE;IAChE,sBAAsB,EAAE,cAAc,EAAE,CAAA;CACzC,GAAG,wBAAwB,CAAA;AAE5B,MAAM,MAAM,8BAA8B,GAAG;IAC3C,sBAAsB,EAAE,cAAc,EAAE,CAAA;CACzC,CAAA;AAED,eAAO,MAAM,mBAAmB,wJAyF9B,CAAA"}
@@ -1,21 +1,29 @@
1
1
  import { populate } from '../../../populateGraphQL/populate.js';
2
2
  import { createServerFeature } from '../../../utilities/createServerFeature.js';
3
3
  import { createNode } from '../../typeUtilities.js';
4
+ import { filterEnabledRelationshipCollections } from '../shared/filterEnabledRelationshipCollections.js';
4
5
  import { relationshipPopulationPromiseHOC } from './graphQLPopulationPromise.js';
5
6
  import { i18n } from './i18n.js';
6
7
  import { RelationshipServerNode } from './nodes/RelationshipNode.js';
7
8
  export const RelationshipFeature = createServerFeature({
8
9
  feature: ({
9
- props
10
+ config,
11
+ props: unsanitizedProps
10
12
  }) => {
11
- // we don't need to pass maxDepth to the client, it's only used on the server
12
- const {
13
- maxDepth,
14
- ...clientFeatureProps
15
- } = props ?? {};
13
+ const props = {
14
+ ...unsanitizedProps,
15
+ enabledCollectionSlugs: filterEnabledRelationshipCollections(config.collections, {
16
+ ...unsanitizedProps,
17
+ uploads: false
18
+ }).map(({
19
+ slug
20
+ }) => slug)
21
+ };
16
22
  return {
17
23
  ClientFeature: '@payloadcms/richtext-lexical/client#RelationshipFeatureClient',
18
- clientFeatureProps,
24
+ clientFeatureProps: {
25
+ enabledCollectionSlugs: props.enabledCollectionSlugs
26
+ },
19
27
  i18n,
20
28
  nodes: [createNode({
21
29
  graphQLPopulationPromises: [relationshipPopulationPromiseHOC(props)],
@@ -31,7 +39,7 @@ export const RelationshipFeature = createServerFeature({
31
39
  req,
32
40
  showHiddenFields
33
41
  }) => {
34
- if (!node?.value) {
42
+ if (!node?.value || !props.enabledCollectionSlugs.includes(node.relationTo)) {
35
43
  return node;
36
44
  }
37
45
  const collection = req.payload.collections[node?.relationTo];
@@ -41,7 +49,7 @@ export const RelationshipFeature = createServerFeature({
41
49
  // @ts-expect-error
42
50
  const id = node?.value?.id || node?.value // for backwards-compatibility
43
51
  ;
44
- const populateDepth = maxDepth !== undefined && maxDepth < depth ? maxDepth : depth;
52
+ const populateDepth = props.maxDepth !== undefined && props.maxDepth < depth ? props.maxDepth : depth;
45
53
  populationPromises.push(populate({
46
54
  id,
47
55
  collectionSlug: collection.config.slug,
@@ -58,8 +66,17 @@ export const RelationshipFeature = createServerFeature({
58
66
  return node;
59
67
  }]
60
68
  },
61
- node: RelationshipServerNode
62
- })]
69
+ node: RelationshipServerNode,
70
+ validations: [({
71
+ node,
72
+ validation: {
73
+ options: {
74
+ req
75
+ }
76
+ }
77
+ }) => props.enabledCollectionSlugs.includes(node.relationTo) ? true : req.t('validation:invalidSelection')]
78
+ })],
79
+ sanitizedServerFeatureProps: props
63
80
  };
64
81
  },
65
82
  key: 'relationship'
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["populate","createServerFeature","createNode","relationshipPopulationPromiseHOC","i18n","RelationshipServerNode","RelationshipFeature","feature","props","maxDepth","clientFeatureProps","ClientFeature","nodes","graphQLPopulationPromises","hooks","afterRead","currentDepth","depth","draft","node","overrideAccess","populateArg","populationPromises","req","showHiddenFields","value","collection","payload","collections","relationTo","id","populateDepth","undefined","push","collectionSlug","config","slug","data","key","select","defaultPopulate"],"sources":["../../../../src/features/relationship/server/index.ts"],"sourcesContent":["import type { CollectionSlug } from 'payload'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { relationshipPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport { RelationshipServerNode } from './nodes/RelationshipNode.js'\n\nexport type ExclusiveRelationshipFeatureProps =\n | {\n /**\n * The collections that should be disabled. Overrides the `enableRichTextRelationship` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: CollectionSlug[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled. Overrides the `enableRichTextRelationship` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: CollectionSlug[]\n }\n\nexport type RelationshipFeatureProps = {\n /**\n * Sets a maximum population depth for this relationship, regardless of the remaining depth when the respective field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n} & ExclusiveRelationshipFeatureProps\n\nexport const RelationshipFeature = createServerFeature<\n RelationshipFeatureProps,\n RelationshipFeatureProps,\n ExclusiveRelationshipFeatureProps\n>({\n feature: ({ props }) => {\n // we don't need to pass maxDepth to the client, it's only used on the server\n const { maxDepth, ...clientFeatureProps } = props ?? {}\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#RelationshipFeatureClient',\n clientFeatureProps,\n i18n,\n nodes: [\n createNode({\n graphQLPopulationPromises: [relationshipPopulationPromiseHOC(props)],\n hooks: {\n afterRead: [\n ({\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n populateArg,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (!node?.value) {\n return node\n }\n const collection = req.payload.collections[node?.relationTo]\n\n if (!collection) {\n return node\n }\n // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n const populateDepth = maxDepth !== undefined && maxDepth < depth ? maxDepth : depth\n\n populationPromises.push(\n populate({\n id,\n collectionSlug: collection.config.slug,\n currentDepth,\n data: node,\n depth: populateDepth,\n draft,\n key: 'value',\n overrideAccess,\n req,\n select:\n populateArg?.[collection.config.slug] ?? collection.config.defaultPopulate,\n showHiddenFields,\n }),\n )\n\n return node\n },\n ],\n },\n node: RelationshipServerNode,\n }),\n ],\n }\n },\n key: 'relationship',\n})\n"],"mappings":"AAEA,SAASA,QAAQ,QAAQ;AACzB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,gCAAgC,QAAQ;AACjD,SAASC,IAAI,QAAQ;AACrB,SAASC,sBAAsB,QAAQ;AAkCvC,OAAO,MAAMC,mBAAA,GAAsBL,mBAAA,CAIjC;EACAM,OAAA,EAASA,CAAC;IAAEC;EAAK,CAAE;IACjB;IACA,MAAM;MAAEC,QAAQ;MAAE,GAAGC;IAAA,CAAoB,GAAGF,KAAA,IAAS,CAAC;IACtD,OAAO;MACLG,aAAA,EAAe;MACfD,kBAAA;MACAN,IAAA;MACAQ,KAAA,EAAO,CACLV,UAAA,CAAW;QACTW,yBAAA,EAA2B,CAACV,gCAAA,CAAiCK,KAAA,EAAO;QACpEM,KAAA,EAAO;UACLC,SAAA,EAAW,CACT,CAAC;YACCC,YAAY;YACZC,KAAK;YACLC,KAAK;YACLC,IAAI;YACJC,cAAc;YACdC,WAAW;YACXC,kBAAkB;YAClBC,GAAG;YACHC;UAAgB,CACjB;YACC,IAAI,CAACL,IAAA,EAAMM,KAAA,EAAO;cAChB,OAAON,IAAA;YACT;YACA,MAAMO,UAAA,GAAaH,GAAA,CAAII,OAAO,CAACC,WAAW,CAACT,IAAA,EAAMU,UAAA,CAAW;YAE5D,IAAI,CAACH,UAAA,EAAY;cACf,OAAOP,IAAA;YACT;YACA;YACA,MAAMW,EAAA,GAAKX,IAAA,EAAMM,KAAA,EAAOK,EAAA,IAAMX,IAAA,EAAMM,KAAA,CAAM;AAAA;YAE1C,MAAMM,aAAA,GAAgBtB,QAAA,KAAauB,SAAA,IAAavB,QAAA,GAAWQ,KAAA,GAAQR,QAAA,GAAWQ,KAAA;YAE9EK,kBAAA,CAAmBW,IAAI,CACrBjC,QAAA,CAAS;cACP8B,EAAA;cACAI,cAAA,EAAgBR,UAAA,CAAWS,MAAM,CAACC,IAAI;cACtCpB,YAAA;cACAqB,IAAA,EAAMlB,IAAA;cACNF,KAAA,EAAOc,aAAA;cACPb,KAAA;cACAoB,GAAA,EAAK;cACLlB,cAAA;cACAG,GAAA;cACAgB,MAAA,EACElB,WAAA,GAAcK,UAAA,CAAWS,MAAM,CAACC,IAAI,CAAC,IAAIV,UAAA,CAAWS,MAAM,CAACK,eAAe;cAC5EhB;YACF;YAGF,OAAOL,IAAA;UACT;QAEJ;QACAA,IAAA,EAAMd;MACR;IAEJ;EACF;EACAiC,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["populate","createServerFeature","createNode","filterEnabledRelationshipCollections","relationshipPopulationPromiseHOC","i18n","RelationshipServerNode","RelationshipFeature","feature","config","props","unsanitizedProps","enabledCollectionSlugs","collections","uploads","map","slug","ClientFeature","clientFeatureProps","nodes","graphQLPopulationPromises","hooks","afterRead","currentDepth","depth","draft","node","overrideAccess","populateArg","populationPromises","req","showHiddenFields","value","includes","relationTo","collection","payload","id","populateDepth","maxDepth","undefined","push","collectionSlug","data","key","select","defaultPopulate","validations","validation","options","t","sanitizedServerFeatureProps"],"sources":["../../../../src/features/relationship/server/index.ts"],"sourcesContent":["import type { CollectionSlug } from 'payload'\n\nimport { populate } from '../../../populateGraphQL/populate.js'\nimport { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { filterEnabledRelationshipCollections } from '../shared/filterEnabledRelationshipCollections.js'\nimport { relationshipPopulationPromiseHOC } from './graphQLPopulationPromise.js'\nimport { i18n } from './i18n.js'\nimport { RelationshipServerNode } from './nodes/RelationshipNode.js'\n\nexport type ExclusiveRelationshipFeatureProps =\n | {\n /**\n * The collections that should be disabled. Overrides the `enableRichTextRelationship` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: CollectionSlug[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled. Overrides the `enableRichTextRelationship` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: CollectionSlug[]\n }\n\nexport type RelationshipFeatureProps = {\n /**\n * Sets a maximum population depth for this relationship, regardless of the remaining depth when the respective field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n} & ExclusiveRelationshipFeatureProps\n\nexport type RelationshipFeatureServerProps = {\n /** Collection policy resolved during feature initialization. */\n enabledCollectionSlugs: CollectionSlug[]\n} & RelationshipFeatureProps\n\nexport type RelationshipFeatureClientProps = {\n enabledCollectionSlugs: CollectionSlug[]\n}\n\nexport const RelationshipFeature = createServerFeature<\n RelationshipFeatureProps,\n RelationshipFeatureServerProps,\n RelationshipFeatureClientProps\n>({\n feature: ({ config, props: unsanitizedProps }) => {\n const props: RelationshipFeatureServerProps = {\n ...unsanitizedProps,\n enabledCollectionSlugs: filterEnabledRelationshipCollections(config.collections, {\n ...unsanitizedProps,\n uploads: false,\n }).map(({ slug }) => slug),\n }\n\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#RelationshipFeatureClient',\n clientFeatureProps: {\n enabledCollectionSlugs: props.enabledCollectionSlugs,\n },\n i18n,\n nodes: [\n createNode({\n graphQLPopulationPromises: [relationshipPopulationPromiseHOC(props)],\n hooks: {\n afterRead: [\n ({\n currentDepth,\n depth,\n draft,\n node,\n overrideAccess,\n populateArg,\n populationPromises,\n req,\n showHiddenFields,\n }) => {\n if (!node?.value || !props.enabledCollectionSlugs.includes(node.relationTo)) {\n return node\n }\n const collection = req.payload.collections[node?.relationTo]\n\n if (!collection) {\n return node\n }\n // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n const populateDepth =\n props.maxDepth !== undefined && props.maxDepth < depth ? props.maxDepth : depth\n\n populationPromises.push(\n populate({\n id,\n collectionSlug: collection.config.slug,\n currentDepth,\n data: node,\n depth: populateDepth,\n draft,\n key: 'value',\n overrideAccess,\n req,\n select:\n populateArg?.[collection.config.slug] ?? collection.config.defaultPopulate,\n showHiddenFields,\n }),\n )\n\n return node\n },\n ],\n },\n node: RelationshipServerNode,\n validations: [\n ({\n node,\n validation: {\n options: { req },\n },\n }) =>\n props.enabledCollectionSlugs.includes(node.relationTo)\n ? true\n : req.t('validation:invalidSelection'),\n ],\n }),\n ],\n sanitizedServerFeatureProps: props,\n }\n },\n key: 'relationship',\n})\n"],"mappings":"AAEA,SAASA,QAAQ,QAAQ;AACzB,SAASC,mBAAmB,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AM;AAAA;YAE1C,MAAMM,aAAA,GACJ5B,KAAA,CAAM6B,QAAQ,KAAKC,SAAA,IAAa9B,KAAA,CAAM6B,QAAQ,GAAGf,KAAA,GAAQd,KAAA,CAAM6B,QAAQ,GAAGf,KAAA;YAE5EK,kBAAA,CAAmBY,IAAI,CACrBzC,QAAA,CAAS;cACPqC,EAAA;cACAK,cAAA,EAAgBP,UAAA,CAAW1B,MAAM,CAACO,IAAI;cACtCO,YAAA;cACAoB,IAAA,EAAMjB,IAAA;cACNF,KAAA,EAAOc,aAAA;cACPb,KAAA;cACAmB,GAAA,EAAK;cACLjB,cAAA;cACAG,GAAA;cACAe,MAAA,EACEjB,WAAA,GAAcO,UAAA,CAAW1B,MAAM,CAACO,IAAI,CAAC,IAAImB,UAAA,CAAW1B,MAAM,CAACqC,eAAe;cAC5Ef;YACF;YAGF,OAAOL,IAAA;UACT;QAEJ;QACAA,IAAA,EAAMpB,sBAAA;QACNyC,WAAA,EAAa,CACX,CAAC;UACCrB,IAAI;UACJsB,UAAA,EAAY;YACVC,OAAA,EAAS;cAAEnB;YAAG;UAAE;QACjB,CACF,KACCpB,KAAA,CAAME,sBAAsB,CAACqB,QAAQ,CAACP,IAAA,CAAKQ,UAAU,IACjD,OACAJ,GAAA,CAAIoB,CAAC,CAAC;MAEhB,GACD;MACDC,2BAAA,EAA6BzC;IAC/B;EACF;EACAkC,GAAA,EAAK;AACP","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import type { CollectionConfig, CollectionSlug } from 'payload';
2
+ export declare const filterEnabledRelationshipCollections: (collections: CollectionConfig[], { disabledCollections, enabledCollections, uploads, }: {
3
+ disabledCollections?: CollectionSlug[];
4
+ enabledCollections?: CollectionSlug[];
5
+ uploads: boolean;
6
+ }) => CollectionConfig[];
7
+ //# sourceMappingURL=filterEnabledRelationshipCollections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterEnabledRelationshipCollections.d.ts","sourceRoot":"","sources":["../../../../src/features/relationship/shared/filterEnabledRelationshipCollections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE/D,eAAO,MAAM,oCAAoC,gBAClC,gBAAgB,EAAE,yDAK5B;IACD,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAA;IACtC,kBAAkB,CAAC,EAAE,cAAc,EAAE,CAAA;IACrC,OAAO,EAAE,OAAO,CAAA;CACjB,KACA,gBAAgB,EAgBlB,CAAA"}
@@ -0,0 +1,23 @@
1
+ export const filterEnabledRelationshipCollections = (collections, {
2
+ disabledCollections,
3
+ enabledCollections,
4
+ uploads
5
+ }) => {
6
+ return collections.filter(({
7
+ slug,
8
+ admin,
9
+ upload
10
+ }) => {
11
+ if (!admin?.enableRichTextRelationship || Boolean(upload) !== uploads) {
12
+ return false;
13
+ }
14
+ if (enabledCollections && !enabledCollections.includes(slug)) {
15
+ return false;
16
+ }
17
+ if (disabledCollections?.includes(slug)) {
18
+ return false;
19
+ }
20
+ return true;
21
+ });
22
+ };
23
+ //# sourceMappingURL=filterEnabledRelationshipCollections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterEnabledRelationshipCollections.js","names":["filterEnabledRelationshipCollections","collections","disabledCollections","enabledCollections","uploads","filter","slug","admin","upload","enableRichTextRelationship","Boolean","includes"],"sources":["../../../../src/features/relationship/shared/filterEnabledRelationshipCollections.ts"],"sourcesContent":["import type { CollectionConfig, CollectionSlug } from 'payload'\n\nexport const filterEnabledRelationshipCollections = (\n collections: CollectionConfig[],\n {\n disabledCollections,\n enabledCollections,\n uploads,\n }: {\n disabledCollections?: CollectionSlug[]\n enabledCollections?: CollectionSlug[]\n uploads: boolean\n },\n): CollectionConfig[] => {\n return collections.filter(({ slug, admin, upload }) => {\n if (!admin?.enableRichTextRelationship || Boolean(upload) !== uploads) {\n return false\n }\n\n if (enabledCollections && !enabledCollections.includes(slug)) {\n return false\n }\n\n if (disabledCollections?.includes(slug)) {\n return false\n }\n\n return true\n })\n}\n"],"mappings":"AAEA,OAAO,MAAMA,oCAAA,GAAuCA,CAClDC,WAAA,EACA;EACEC,mBAAmB;EACnBC,kBAAkB;EAClBC;AAAO,CAKR;EAED,OAAOH,WAAA,CAAYI,MAAM,CAAC,CAAC;IAAEC,IAAI;IAAEC,KAAK;IAAEC;EAAM,CAAE;IAChD,IAAI,CAACD,KAAA,EAAOE,0BAAA,IAA8BC,OAAA,CAAQF,MAAA,MAAYJ,OAAA,EAAS;MACrE,OAAO;IACT;IAEA,IAAID,kBAAA,IAAsB,CAACA,kBAAA,CAAmBQ,QAAQ,CAACL,IAAA,GAAO;MAC5D,OAAO;IACT;IAEA,IAAIJ,mBAAA,EAAqBS,QAAA,CAASL,IAAA,GAAO;MACvC,OAAO;IACT;IAEA,OAAO;EACT;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useToolbarStates.d.ts","sourceRoot":"","sources":["../../../../src/features/toolbars/shared/useToolbarStates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAM5C,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAKjE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,WAAW,EAAE,gBAAgB,EAAE,CAAA;IAC/B,YAAY,EAAE,OAAO,CAAA;IACrB,eAAe,EAAE,MAAM,EAAE,CAAA;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAC3C,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;CAC1C;AAgCD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9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