@payloadcms/richtext-lexical 3.0.0-beta.24 → 3.0.0-beta.25

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 (230) hide show
  1. package/dist/exports/components.d.ts +3 -2
  2. package/dist/exports/components.d.ts.map +1 -1
  3. package/dist/exports/components.js +3 -2
  4. package/dist/exports/components.js.map +1 -1
  5. package/dist/field/features/align/feature.client.d.ts.map +1 -1
  6. package/dist/field/features/align/feature.client.js +126 -46
  7. package/dist/field/features/align/feature.client.js.map +1 -1
  8. package/dist/field/features/align/toolbarAlignGroup.d.ts +3 -0
  9. package/dist/field/features/align/toolbarAlignGroup.d.ts.map +1 -0
  10. package/dist/field/features/align/{inlineToolbarAlignGroup.js → toolbarAlignGroup.js} +3 -3
  11. package/dist/field/features/align/toolbarAlignGroup.js.map +1 -0
  12. package/dist/field/features/blockquote/feature.client.d.ts.map +1 -1
  13. package/dist/field/features/blockquote/feature.client.js +37 -23
  14. package/dist/field/features/blockquote/feature.client.js.map +1 -1
  15. package/dist/field/features/blocks/component/index.d.ts.map +1 -1
  16. package/dist/field/features/blocks/component/index.js +1 -1
  17. package/dist/field/features/blocks/component/index.js.map +1 -1
  18. package/dist/field/features/blocks/feature.client.d.ts.map +1 -1
  19. package/dist/field/features/blocks/feature.client.js +39 -8
  20. package/dist/field/features/blocks/feature.client.js.map +1 -1
  21. package/dist/field/features/blocks/populationPromise.d.ts.map +1 -1
  22. package/dist/field/features/blocks/populationPromise.js +2 -1
  23. package/dist/field/features/blocks/populationPromise.js.map +1 -1
  24. package/dist/field/features/format/bold/feature.client.d.ts.map +1 -1
  25. package/dist/field/features/format/bold/feature.client.js +23 -19
  26. package/dist/field/features/format/bold/feature.client.js.map +1 -1
  27. package/dist/field/features/format/inlineCode/feature.client.d.ts.map +1 -1
  28. package/dist/field/features/format/inlineCode/feature.client.js +23 -19
  29. package/dist/field/features/format/inlineCode/feature.client.js.map +1 -1
  30. package/dist/field/features/format/italic/feature.client.d.ts.map +1 -1
  31. package/dist/field/features/format/italic/feature.client.js +23 -19
  32. package/dist/field/features/format/italic/feature.client.js.map +1 -1
  33. package/dist/field/features/format/shared/toolbarFormatGroup.d.ts +3 -0
  34. package/dist/field/features/format/shared/toolbarFormatGroup.d.ts.map +1 -0
  35. package/dist/field/features/format/shared/toolbarFormatGroup.js +10 -0
  36. package/dist/field/features/format/shared/toolbarFormatGroup.js.map +1 -0
  37. package/dist/field/features/format/strikethrough/feature.client.d.ts.map +1 -1
  38. package/dist/field/features/format/strikethrough/feature.client.js +23 -19
  39. package/dist/field/features/format/strikethrough/feature.client.js.map +1 -1
  40. package/dist/field/features/format/subscript/feature.client.d.ts.map +1 -1
  41. package/dist/field/features/format/subscript/feature.client.js +23 -19
  42. package/dist/field/features/format/subscript/feature.client.js.map +1 -1
  43. package/dist/field/features/format/superscript/feature.client.d.ts.map +1 -1
  44. package/dist/field/features/format/superscript/feature.client.js +23 -19
  45. package/dist/field/features/format/superscript/feature.client.js.map +1 -1
  46. package/dist/field/features/format/underline/feature.client.d.ts.map +1 -1
  47. package/dist/field/features/format/underline/feature.client.js +23 -19
  48. package/dist/field/features/format/underline/feature.client.js.map +1 -1
  49. package/dist/field/features/heading/feature.client.d.ts.map +1 -1
  50. package/dist/field/features/heading/feature.client.js +49 -29
  51. package/dist/field/features/heading/feature.client.js.map +1 -1
  52. package/dist/field/features/horizontalRule/feature.client.d.ts.map +1 -1
  53. package/dist/field/features/horizontalRule/feature.client.js +27 -4
  54. package/dist/field/features/horizontalRule/feature.client.js.map +1 -1
  55. package/dist/field/features/indent/feature.client.d.ts.map +1 -1
  56. package/dist/field/features/indent/feature.client.js +41 -37
  57. package/dist/field/features/indent/feature.client.js.map +1 -1
  58. package/dist/field/features/indent/toolbarIndentGroup.d.ts +3 -0
  59. package/dist/field/features/indent/toolbarIndentGroup.d.ts.map +1 -0
  60. package/dist/field/features/indent/toolbarIndentGroup.js +10 -0
  61. package/dist/field/features/indent/toolbarIndentGroup.js.map +1 -0
  62. package/dist/field/features/link/feature.client.d.ts.map +1 -1
  63. package/dist/field/features/link/feature.client.js +44 -40
  64. package/dist/field/features/link/feature.client.js.map +1 -1
  65. package/dist/field/features/link/populationPromise.d.ts.map +1 -1
  66. package/dist/field/features/link/populationPromise.js +2 -1
  67. package/dist/field/features/link/populationPromise.js.map +1 -1
  68. package/dist/field/features/lists/checklist/feature.client.d.ts.map +1 -1
  69. package/dist/field/features/lists/checklist/feature.client.js +44 -19
  70. package/dist/field/features/lists/checklist/feature.client.js.map +1 -1
  71. package/dist/field/features/lists/orderedList/feature.client.d.ts.map +1 -1
  72. package/dist/field/features/lists/orderedList/feature.client.js +44 -19
  73. package/dist/field/features/lists/orderedList/feature.client.js.map +1 -1
  74. package/dist/field/features/lists/unorderedList/feature.client.d.ts.map +1 -1
  75. package/dist/field/features/lists/unorderedList/feature.client.js +44 -19
  76. package/dist/field/features/lists/unorderedList/feature.client.js.map +1 -1
  77. package/dist/field/features/paragraph/feature.client.d.ts.map +1 -1
  78. package/dist/field/features/paragraph/feature.client.js +36 -22
  79. package/dist/field/features/paragraph/feature.client.js.map +1 -1
  80. package/dist/field/features/relationship/feature.client.d.ts.map +1 -1
  81. package/dist/field/features/relationship/feature.client.js +30 -4
  82. package/dist/field/features/relationship/feature.client.js.map +1 -1
  83. package/dist/field/features/relationship/populationPromise.d.ts.map +1 -1
  84. package/dist/field/features/relationship/populationPromise.js +2 -1
  85. package/dist/field/features/relationship/populationPromise.js.map +1 -1
  86. package/dist/field/features/shared/toolbar/addDropdownGroup.d.ts +3 -0
  87. package/dist/field/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -0
  88. package/dist/field/features/shared/toolbar/addDropdownGroup.js +12 -0
  89. package/dist/field/features/shared/toolbar/addDropdownGroup.js.map +1 -0
  90. package/dist/field/features/shared/toolbar/featureButtonsGroup.d.ts +3 -0
  91. package/dist/field/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -0
  92. package/dist/field/features/shared/toolbar/featureButtonsGroup.js +10 -0
  93. package/dist/field/features/shared/toolbar/featureButtonsGroup.js.map +1 -0
  94. package/dist/field/features/shared/toolbar/textDropdownGroup.d.ts +3 -0
  95. package/dist/field/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -0
  96. package/dist/field/features/shared/{inlineToolbar → toolbar}/textDropdownGroup.js +2 -2
  97. package/dist/field/features/shared/toolbar/textDropdownGroup.js.map +1 -0
  98. package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts +6 -0
  99. package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts.map +1 -0
  100. package/dist/field/features/toolbars/fixed/Toolbar/index.js +152 -0
  101. package/dist/field/features/toolbars/fixed/Toolbar/index.js.map +1 -0
  102. package/dist/field/features/toolbars/fixed/Toolbar/index.scss +81 -0
  103. package/dist/field/features/toolbars/fixed/feature.client.d.ts +3 -0
  104. package/dist/field/features/toolbars/fixed/feature.client.d.ts.map +1 -0
  105. package/dist/field/features/toolbars/fixed/feature.client.js +20 -0
  106. package/dist/field/features/toolbars/fixed/feature.client.js.map +1 -0
  107. package/dist/field/features/toolbars/fixed/feature.server.d.ts +3 -0
  108. package/dist/field/features/toolbars/fixed/feature.server.d.ts.map +1 -0
  109. package/dist/field/features/toolbars/fixed/feature.server.js +16 -0
  110. package/dist/field/features/toolbars/fixed/feature.server.js.map +1 -0
  111. package/dist/field/features/toolbars/inline/Toolbar/index.d.ts +6 -0
  112. package/dist/field/features/toolbars/inline/Toolbar/index.d.ts.map +1 -0
  113. package/dist/field/{lexical/plugins → features}/toolbars/inline/Toolbar/index.js +43 -17
  114. package/dist/field/features/toolbars/inline/Toolbar/index.js.map +1 -0
  115. package/dist/field/{lexical/plugins → features}/toolbars/inline/Toolbar/index.scss +3 -8
  116. package/dist/field/features/toolbars/inline/feature.client.d.ts +3 -0
  117. package/dist/field/features/toolbars/inline/feature.client.d.ts.map +1 -0
  118. package/dist/field/features/toolbars/inline/feature.client.js +20 -0
  119. package/dist/field/features/toolbars/inline/feature.client.js.map +1 -0
  120. package/dist/field/features/toolbars/inline/feature.server.d.ts +3 -0
  121. package/dist/field/features/toolbars/inline/feature.server.d.ts.map +1 -0
  122. package/dist/field/features/toolbars/inline/feature.server.js +16 -0
  123. package/dist/field/features/toolbars/inline/feature.server.js.map +1 -0
  124. package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts +10 -0
  125. package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -0
  126. package/dist/field/{lexical/plugins/toolbars/inline → features/toolbars/shared}/ToolbarButton/index.js +9 -5
  127. package/dist/field/features/toolbars/shared/ToolbarButton/index.js.map +1 -0
  128. package/dist/field/{lexical/plugins/toolbars/inline → features/toolbars/shared}/ToolbarButton/index.scss +3 -1
  129. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts +23 -0
  130. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -0
  131. package/dist/field/{lexical/plugins/toolbars/inline → features/toolbars/shared}/ToolbarDropdown/DropDown.js +14 -64
  132. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -0
  133. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts +23 -0
  134. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -0
  135. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js +139 -0
  136. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -0
  137. package/dist/field/{lexical/plugins/toolbars/inline → features/toolbars/shared}/ToolbarDropdown/index.scss +25 -13
  138. package/dist/field/{lexical/plugins/toolbars/inline → features/toolbars}/types.d.ts +16 -8
  139. package/dist/field/features/toolbars/types.d.ts.map +1 -0
  140. package/dist/field/features/toolbars/types.js.map +1 -0
  141. package/dist/field/features/types.d.ts +7 -7
  142. package/dist/field/features/types.d.ts.map +1 -1
  143. package/dist/field/features/types.js.map +1 -1
  144. package/dist/field/features/upload/feature.client.d.ts.map +1 -1
  145. package/dist/field/features/upload/feature.client.js +29 -4
  146. package/dist/field/features/upload/feature.client.js.map +1 -1
  147. package/dist/field/features/upload/populationPromise.d.ts.map +1 -1
  148. package/dist/field/features/upload/populationPromise.js +3 -1
  149. package/dist/field/features/upload/populationPromise.js.map +1 -1
  150. package/dist/field/lexical/EditorFocusProvider.d.ts +20 -0
  151. package/dist/field/lexical/EditorFocusProvider.d.ts.map +1 -0
  152. package/dist/field/lexical/EditorFocusProvider.js +78 -0
  153. package/dist/field/lexical/EditorFocusProvider.js.map +1 -0
  154. package/dist/field/lexical/LexicalEditor.d.ts.map +1 -1
  155. package/dist/field/lexical/LexicalEditor.js +20 -4
  156. package/dist/field/lexical/LexicalEditor.js.map +1 -1
  157. package/dist/field/lexical/LexicalProvider.d.ts.map +1 -1
  158. package/dist/field/lexical/LexicalProvider.js +3 -2
  159. package/dist/field/lexical/LexicalProvider.js.map +1 -1
  160. package/dist/field/lexical/config/client/EditorConfigProvider.d.ts +2 -3
  161. package/dist/field/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  162. package/dist/field/lexical/config/client/EditorConfigProvider.js.map +1 -1
  163. package/dist/field/lexical/config/server/default.d.ts.map +1 -1
  164. package/dist/field/lexical/config/server/default.js +3 -1
  165. package/dist/field/lexical/config/server/default.js.map +1 -1
  166. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +6 -6
  167. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  168. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  169. package/dist/field/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  170. package/dist/field/lexical/plugins/SlashMenu/index.js +10 -10
  171. package/dist/field/lexical/plugins/SlashMenu/index.js.map +1 -1
  172. package/dist/field/lexical/ui/icons/Add/index.d.ts +3 -0
  173. package/dist/field/lexical/ui/icons/Add/index.d.ts.map +1 -0
  174. package/dist/field/lexical/ui/icons/Add/index.js +16 -0
  175. package/dist/field/lexical/ui/icons/Add/index.js.map +1 -0
  176. package/dist/index.d.ts +8 -5
  177. package/dist/index.d.ts.map +1 -1
  178. package/dist/index.js +8 -4
  179. package/dist/index.js.map +1 -1
  180. package/dist/populate/populate.d.ts +2 -1
  181. package/dist/populate/populate.d.ts.map +1 -1
  182. package/dist/populate/populate.js +13 -11
  183. package/dist/populate/populate.js.map +1 -1
  184. package/dist/populate/populateLexicalPopulationPromises.d.ts +1 -1
  185. package/dist/populate/populateLexicalPopulationPromises.d.ts.map +1 -1
  186. package/dist/populate/populateLexicalPopulationPromises.js +2 -1
  187. package/dist/populate/populateLexicalPopulationPromises.js.map +1 -1
  188. package/dist/populate/recurseNestedFields.d.ts +2 -1
  189. package/dist/populate/recurseNestedFields.d.ts.map +1 -1
  190. package/dist/populate/recurseNestedFields.js +2 -1
  191. package/dist/populate/recurseNestedFields.js.map +1 -1
  192. package/package.json +10 -10
  193. package/dist/field/features/align/inlineToolbarAlignGroup.d.ts +0 -3
  194. package/dist/field/features/align/inlineToolbarAlignGroup.d.ts.map +0 -1
  195. package/dist/field/features/align/inlineToolbarAlignGroup.js.map +0 -1
  196. package/dist/field/features/format/shared/inlineToolbarFormatGroup.d.ts +0 -3
  197. package/dist/field/features/format/shared/inlineToolbarFormatGroup.d.ts.map +0 -1
  198. package/dist/field/features/format/shared/inlineToolbarFormatGroup.js +0 -10
  199. package/dist/field/features/format/shared/inlineToolbarFormatGroup.js.map +0 -1
  200. package/dist/field/features/indent/inlineToolbarIndentGroup.d.ts +0 -3
  201. package/dist/field/features/indent/inlineToolbarIndentGroup.d.ts.map +0 -1
  202. package/dist/field/features/indent/inlineToolbarIndentGroup.js +0 -10
  203. package/dist/field/features/indent/inlineToolbarIndentGroup.js.map +0 -1
  204. package/dist/field/features/shared/inlineToolbar/featureButtonsGroup.d.ts +0 -3
  205. package/dist/field/features/shared/inlineToolbar/featureButtonsGroup.d.ts.map +0 -1
  206. package/dist/field/features/shared/inlineToolbar/featureButtonsGroup.js +0 -10
  207. package/dist/field/features/shared/inlineToolbar/featureButtonsGroup.js.map +0 -1
  208. package/dist/field/features/shared/inlineToolbar/textDropdownGroup.d.ts +0 -3
  209. package/dist/field/features/shared/inlineToolbar/textDropdownGroup.d.ts.map +0 -1
  210. package/dist/field/features/shared/inlineToolbar/textDropdownGroup.js.map +0 -1
  211. package/dist/field/lexical/plugins/toolbars/fixed/types.d.ts +0 -40
  212. package/dist/field/lexical/plugins/toolbars/fixed/types.d.ts.map +0 -1
  213. package/dist/field/lexical/plugins/toolbars/fixed/types.js.map +0 -1
  214. package/dist/field/lexical/plugins/toolbars/inline/Toolbar/index.d.ts +0 -6
  215. package/dist/field/lexical/plugins/toolbars/inline/Toolbar/index.d.ts.map +0 -1
  216. package/dist/field/lexical/plugins/toolbars/inline/Toolbar/index.js.map +0 -1
  217. package/dist/field/lexical/plugins/toolbars/inline/ToolbarButton/index.d.ts +0 -8
  218. package/dist/field/lexical/plugins/toolbars/inline/ToolbarButton/index.d.ts.map +0 -1
  219. package/dist/field/lexical/plugins/toolbars/inline/ToolbarButton/index.js.map +0 -1
  220. package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/DropDown.d.ts +0 -17
  221. package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/DropDown.d.ts.map +0 -1
  222. package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/DropDown.js.map +0 -1
  223. package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.d.ts +0 -18
  224. package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.d.ts.map +0 -1
  225. package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.js +0 -42
  226. package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.js.map +0 -1
  227. package/dist/field/lexical/plugins/toolbars/inline/types.d.ts.map +0 -1
  228. package/dist/field/lexical/plugins/toolbars/inline/types.js +0 -3
  229. package/dist/field/lexical/plugins/toolbars/inline/types.js.map +0 -1
  230. /package/dist/field/{lexical/plugins/toolbars/fixed → features/toolbars}/types.js +0 -0
@@ -1,6 +1,7 @@
1
1
  export { RichTextCell } from '../cell/index.js';
2
+ export { ToolbarButton } from '../field/features/toolbars/shared/ToolbarButton/index.js';
3
+ export { ToolbarDropdown } from '../field/features/toolbars/shared/ToolbarDropdown/index.js';
2
4
  export { RichTextField } from '../field/index.js';
5
+ export { type EditorFocusContextType, EditorFocusProvider, useEditorFocus, } from '../field/lexical/EditorFocusProvider.js';
3
6
  export { defaultEditorLexicalConfig } from '../field/lexical/config/client/default.js';
4
- export { ToolbarButton } from '../field/lexical/plugins/toolbars/inline/ToolbarButton/index.js';
5
- export { ToolbarDropdown } from '../field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.js';
6
7
  //# sourceMappingURL=components.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/exports/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAA;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,iEAAiE,CAAA;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,mEAAmE,CAAA"}
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/exports/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,0DAA0D,CAAA;AAExF,OAAO,EAAE,eAAe,EAAE,MAAM,4DAA4D,CAAA;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EACL,KAAK,sBAAsB,EAC3B,mBAAmB,EACnB,cAAc,GACf,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAA"}
@@ -1,7 +1,8 @@
1
1
  export { RichTextCell } from '../cell/index.js';
2
+ export { ToolbarButton } from '../field/features/toolbars/shared/ToolbarButton/index.js';
3
+ export { ToolbarDropdown } from '../field/features/toolbars/shared/ToolbarDropdown/index.js';
2
4
  export { RichTextField } from '../field/index.js';
5
+ export { EditorFocusProvider, useEditorFocus } from '../field/lexical/EditorFocusProvider.js';
3
6
  export { defaultEditorLexicalConfig } from '../field/lexical/config/client/default.js';
4
- export { ToolbarButton } from '../field/lexical/plugins/toolbars/inline/ToolbarButton/index.js';
5
- export { ToolbarDropdown } from '../field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.js';
6
7
 
7
8
  //# sourceMappingURL=components.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/exports/components.ts"],"sourcesContent":["export { RichTextCell } from '../cell/index.js'\nexport { RichTextField } from '../field/index.js'\n\nexport { defaultEditorLexicalConfig } from '../field/lexical/config/client/default.js'\nexport { ToolbarButton } from '../field/lexical/plugins/toolbars/inline/ToolbarButton/index.js'\nexport { ToolbarDropdown } from '../field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.js'\n"],"names":["RichTextCell","RichTextField","defaultEditorLexicalConfig","ToolbarButton","ToolbarDropdown"],"rangeMappings":";;;;","mappings":"AAAA,SAASA,YAAY,QAAQ,mBAAkB;AAC/C,SAASC,aAAa,QAAQ,oBAAmB;AAEjD,SAASC,0BAA0B,QAAQ,4CAA2C;AACtF,SAASC,aAAa,QAAQ,kEAAiE;AAC/F,SAASC,eAAe,QAAQ,oEAAmE"}
1
+ {"version":3,"sources":["../../src/exports/components.ts"],"sourcesContent":["export { RichTextCell } from '../cell/index.js'\nexport { ToolbarButton } from '../field/features/toolbars/shared/ToolbarButton/index.js'\n\nexport { ToolbarDropdown } from '../field/features/toolbars/shared/ToolbarDropdown/index.js'\nexport { RichTextField } from '../field/index.js'\nexport {\n type EditorFocusContextType,\n EditorFocusProvider,\n useEditorFocus,\n} from '../field/lexical/EditorFocusProvider.js'\nexport { defaultEditorLexicalConfig } from '../field/lexical/config/client/default.js'\n"],"names":["RichTextCell","ToolbarButton","ToolbarDropdown","RichTextField","EditorFocusProvider","useEditorFocus","defaultEditorLexicalConfig"],"rangeMappings":";;;;;","mappings":"AAAA,SAASA,YAAY,QAAQ,mBAAkB;AAC/C,SAASC,aAAa,QAAQ,2DAA0D;AAExF,SAASC,eAAe,QAAQ,6DAA4D;AAC5F,SAASC,aAAa,QAAQ,oBAAmB;AACjD,SAEEC,mBAAmB,EACnBC,cAAc,QACT,0CAAyC;AAChD,SAASC,0BAA0B,QAAQ,4CAA2C"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/align/feature.client.tsx"],"names":[],"mappings":";AAoEA,eAAO,MAAM,2BAA2B,+BAA4C,CAAA"}
1
+ {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/align/feature.client.tsx"],"names":[],"mappings":";AA8JA,eAAO,MAAM,2BAA2B,+BAA4C,CAAA"}
@@ -1,61 +1,141 @@
1
1
  'use client';
2
- import { FORMAT_ELEMENT_COMMAND } from 'lexical';
2
+ import { $isElementNode, $isRangeSelection, FORMAT_ELEMENT_COMMAND } from 'lexical';
3
3
  import { AlignCenterIcon } from '../../lexical/ui/icons/AlignCenter/index.js';
4
4
  import { AlignJustifyIcon } from '../../lexical/ui/icons/AlignJustify/index.js';
5
5
  import { AlignLeftIcon } from '../../lexical/ui/icons/AlignLeft/index.js';
6
6
  import { AlignRightIcon } from '../../lexical/ui/icons/AlignRight/index.js';
7
7
  import { createClientComponent } from '../createClientComponent.js';
8
- import { alignGroupWithItems } from './inlineToolbarAlignGroup.js';
8
+ import { toolbarAlignGroupWithItems } from './toolbarAlignGroup.js';
9
+ const toolbarGroups = [
10
+ toolbarAlignGroupWithItems([
11
+ {
12
+ ChildComponent: AlignLeftIcon,
13
+ isActive: ({ selection })=>{
14
+ if (!$isRangeSelection(selection)) {
15
+ return false;
16
+ }
17
+ for (const node of selection.getNodes()){
18
+ if ($isElementNode(node)) {
19
+ if (node.getFormatType() === 'left') {
20
+ continue;
21
+ }
22
+ }
23
+ const parent = node.getParent();
24
+ if ($isElementNode(parent)) {
25
+ if (parent.getFormatType() === 'left') {
26
+ continue;
27
+ }
28
+ }
29
+ return false;
30
+ }
31
+ return true;
32
+ },
33
+ key: 'alignLeft',
34
+ label: `Align Left`,
35
+ onSelect: ({ editor })=>{
36
+ editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left');
37
+ },
38
+ order: 1
39
+ },
40
+ {
41
+ ChildComponent: AlignCenterIcon,
42
+ isActive: ({ selection })=>{
43
+ if (!$isRangeSelection(selection)) {
44
+ return false;
45
+ }
46
+ for (const node of selection.getNodes()){
47
+ if ($isElementNode(node)) {
48
+ if (node.getFormatType() === 'center') {
49
+ continue;
50
+ }
51
+ }
52
+ const parent = node.getParent();
53
+ if ($isElementNode(parent)) {
54
+ if (parent.getFormatType() === 'center') {
55
+ continue;
56
+ }
57
+ }
58
+ return false;
59
+ }
60
+ return true;
61
+ },
62
+ key: 'alignCenter',
63
+ label: `Align Center`,
64
+ onSelect: ({ editor })=>{
65
+ editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center');
66
+ },
67
+ order: 2
68
+ },
69
+ {
70
+ ChildComponent: AlignRightIcon,
71
+ isActive: ({ selection })=>{
72
+ if (!$isRangeSelection(selection)) {
73
+ return false;
74
+ }
75
+ for (const node of selection.getNodes()){
76
+ if ($isElementNode(node)) {
77
+ if (node.getFormatType() === 'right') {
78
+ continue;
79
+ }
80
+ }
81
+ const parent = node.getParent();
82
+ if ($isElementNode(parent)) {
83
+ if (parent.getFormatType() === 'right') {
84
+ continue;
85
+ }
86
+ }
87
+ return false;
88
+ }
89
+ return true;
90
+ },
91
+ key: 'alignRight',
92
+ label: `Align Right`,
93
+ onSelect: ({ editor })=>{
94
+ editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right');
95
+ },
96
+ order: 3
97
+ },
98
+ {
99
+ ChildComponent: AlignJustifyIcon,
100
+ isActive: ({ selection })=>{
101
+ if (!$isRangeSelection(selection)) {
102
+ return false;
103
+ }
104
+ for (const node of selection.getNodes()){
105
+ if ($isElementNode(node)) {
106
+ if (node.getFormatType() === 'justify') {
107
+ continue;
108
+ }
109
+ }
110
+ const parent = node.getParent();
111
+ if ($isElementNode(parent)) {
112
+ if (parent.getFormatType() === 'justify') {
113
+ continue;
114
+ }
115
+ }
116
+ return false;
117
+ }
118
+ return true;
119
+ },
120
+ key: 'alignJustify',
121
+ label: `Align Justify`,
122
+ onSelect: ({ editor })=>{
123
+ editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify');
124
+ },
125
+ order: 4
126
+ }
127
+ ])
128
+ ];
9
129
  const AlignFeatureClient = (props)=>{
10
130
  return {
11
131
  clientFeatureProps: props,
12
132
  feature: ()=>({
13
133
  clientFeatureProps: props,
134
+ toolbarFixed: {
135
+ groups: toolbarGroups
136
+ },
14
137
  toolbarInline: {
15
- groups: [
16
- alignGroupWithItems([
17
- {
18
- ChildComponent: AlignLeftIcon,
19
- isActive: ()=>false,
20
- key: 'alignLeft',
21
- label: `Align Left`,
22
- onSelect: ({ editor })=>{
23
- editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left');
24
- },
25
- order: 1
26
- },
27
- {
28
- ChildComponent: AlignCenterIcon,
29
- isActive: ()=>false,
30
- key: 'alignCenter',
31
- label: `Align Center`,
32
- onSelect: ({ editor })=>{
33
- editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center');
34
- },
35
- order: 2
36
- },
37
- {
38
- ChildComponent: AlignRightIcon,
39
- isActive: ()=>false,
40
- key: 'alignRight',
41
- label: `Align Right`,
42
- onSelect: ({ editor })=>{
43
- editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right');
44
- },
45
- order: 3
46
- },
47
- {
48
- ChildComponent: AlignJustifyIcon,
49
- isActive: ()=>false,
50
- key: 'alignJustify',
51
- label: `Align Justify`,
52
- onSelect: ({ editor })=>{
53
- editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify');
54
- },
55
- order: 4
56
- }
57
- ])
58
- ]
138
+ groups: toolbarGroups
59
139
  }
60
140
  })
61
141
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/align/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { FORMAT_ELEMENT_COMMAND } from 'lexical'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { AlignCenterIcon } from '../../lexical/ui/icons/AlignCenter/index.js'\nimport { AlignJustifyIcon } from '../../lexical/ui/icons/AlignJustify/index.js'\nimport { AlignLeftIcon } from '../../lexical/ui/icons/AlignLeft/index.js'\nimport { AlignRightIcon } from '../../lexical/ui/icons/AlignRight/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { alignGroupWithItems } from './inlineToolbarAlignGroup.js'\n\nconst AlignFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n toolbarInline: {\n groups: [\n alignGroupWithItems([\n {\n ChildComponent: AlignLeftIcon,\n isActive: () => false,\n key: 'alignLeft',\n label: `Align Left`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left')\n },\n order: 1,\n },\n {\n ChildComponent: AlignCenterIcon,\n isActive: () => false,\n key: 'alignCenter',\n label: `Align Center`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center')\n },\n order: 2,\n },\n {\n ChildComponent: AlignRightIcon,\n isActive: () => false,\n key: 'alignRight',\n label: `Align Right`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right')\n },\n order: 3,\n },\n {\n ChildComponent: AlignJustifyIcon,\n isActive: () => false,\n key: 'alignJustify',\n label: `Align Justify`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify')\n },\n order: 4,\n },\n ]),\n ],\n },\n }),\n }\n}\n\nexport const AlignFeatureClientComponent = createClientComponent(AlignFeatureClient)\n"],"names":["FORMAT_ELEMENT_COMMAND","AlignCenterIcon","AlignJustifyIcon","AlignLeftIcon","AlignRightIcon","createClientComponent","alignGroupWithItems","AlignFeatureClient","props","clientFeatureProps","feature","toolbarInline","groups","ChildComponent","isActive","key","label","onSelect","editor","dispatchCommand","order","AlignFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,sBAAsB,QAAQ,UAAS;AAIhD,SAASC,eAAe,QAAQ,8CAA6C;AAC7E,SAASC,gBAAgB,QAAQ,+CAA8C;AAC/E,SAASC,aAAa,QAAQ,4CAA2C;AACzE,SAASC,cAAc,QAAQ,6CAA4C;AAC3E,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,mBAAmB,QAAQ,+BAA8B;AAElE,MAAMC,qBAA+D,CAACC;IACpE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,eAAe;oBACbC,QAAQ;wBACNN,oBAAoB;4BAClB;gCACEO,gBAAgBV;gCAChBW,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,UAAU,CAAC;gCACnBC,UAAU,CAAC,EAAEC,MAAM,EAAE;oCACnBA,OAAOC,eAAe,CAACnB,wBAAwB;gCACjD;gCACAoB,OAAO;4BACT;4BACA;gCACEP,gBAAgBZ;gCAChBa,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,YAAY,CAAC;gCACrBC,UAAU,CAAC,EAAEC,MAAM,EAAE;oCACnBA,OAAOC,eAAe,CAACnB,wBAAwB;gCACjD;gCACAoB,OAAO;4BACT;4BACA;gCACEP,gBAAgBT;gCAChBU,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,WAAW,CAAC;gCACpBC,UAAU,CAAC,EAAEC,MAAM,EAAE;oCACnBA,OAAOC,eAAe,CAACnB,wBAAwB;gCACjD;gCACAoB,OAAO;4BACT;4BACA;gCACEP,gBAAgBX;gCAChBY,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,aAAa,CAAC;gCACtBC,UAAU,CAAC,EAAEC,MAAM,EAAE;oCACnBA,OAAOC,eAAe,CAACnB,wBAAwB;gCACjD;gCACAoB,OAAO;4BACT;yBACD;qBACF;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMC,8BAA8BhB,sBAAsBE,oBAAmB"}
1
+ {"version":3,"sources":["../../../../src/field/features/align/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $isElementNode, $isRangeSelection, FORMAT_ELEMENT_COMMAND } from 'lexical'\n\nimport type { ToolbarGroup } from '../toolbars/types.js'\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { AlignCenterIcon } from '../../lexical/ui/icons/AlignCenter/index.js'\nimport { AlignJustifyIcon } from '../../lexical/ui/icons/AlignJustify/index.js'\nimport { AlignLeftIcon } from '../../lexical/ui/icons/AlignLeft/index.js'\nimport { AlignRightIcon } from '../../lexical/ui/icons/AlignRight/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { toolbarAlignGroupWithItems } from './toolbarAlignGroup.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarAlignGroupWithItems([\n {\n ChildComponent: AlignLeftIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node)) {\n if (node.getFormatType() === 'left') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent)) {\n if (parent.getFormatType() === 'left') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignLeft',\n label: `Align Left`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left')\n },\n order: 1,\n },\n {\n ChildComponent: AlignCenterIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node)) {\n if (node.getFormatType() === 'center') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent)) {\n if (parent.getFormatType() === 'center') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignCenter',\n label: `Align Center`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center')\n },\n order: 2,\n },\n {\n ChildComponent: AlignRightIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node)) {\n if (node.getFormatType() === 'right') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent)) {\n if (parent.getFormatType() === 'right') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignRight',\n label: `Align Right`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right')\n },\n order: 3,\n },\n {\n ChildComponent: AlignJustifyIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node)) {\n if (node.getFormatType() === 'justify') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent)) {\n if (parent.getFormatType() === 'justify') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignJustify',\n label: `Align Justify`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify')\n },\n order: 4,\n },\n ]),\n]\n\nconst AlignFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }),\n }\n}\n\nexport const AlignFeatureClientComponent = createClientComponent(AlignFeatureClient)\n"],"names":["$isElementNode","$isRangeSelection","FORMAT_ELEMENT_COMMAND","AlignCenterIcon","AlignJustifyIcon","AlignLeftIcon","AlignRightIcon","createClientComponent","toolbarAlignGroupWithItems","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getFormatType","parent","getParent","key","label","onSelect","editor","dispatchCommand","order","AlignFeatureClient","props","clientFeatureProps","feature","toolbarFixed","groups","toolbarInline","AlignFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,cAAc,EAAEC,iBAAiB,EAAEC,sBAAsB,QAAQ,UAAS;AAKnF,SAASC,eAAe,QAAQ,8CAA6C;AAC7E,SAASC,gBAAgB,QAAQ,+CAA8C;AAC/E,SAASC,aAAa,QAAQ,4CAA2C;AACzE,SAASC,cAAc,QAAQ,6CAA4C;AAC3E,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,0BAA0B,QAAQ,yBAAwB;AAEnE,MAAMC,gBAAgC;IACpCD,2BAA2B;QACzB;YACEE,gBAAgBL;YAChBM,UAAU,CAAC,EAAEC,SAAS,EAAE;gBACtB,IAAI,CAACX,kBAAkBW,YAAY;oBACjC,OAAO;gBACT;gBACA,KAAK,MAAMC,QAAQD,UAAUE,QAAQ,GAAI;oBACvC,IAAId,eAAea,OAAO;wBACxB,IAAIA,KAAKE,aAAa,OAAO,QAAQ;4BACnC;wBACF;oBACF;oBAEA,MAAMC,SAASH,KAAKI,SAAS;oBAC7B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,OAAO,CAAC,WAAW,CAAC;YACpBC,UAAU,CAAC,EAAEC,MAAM,EAAE;gBACnBA,OAAOC,eAAe,CAACpB,wBAAwB;YACjD;YACAqB,OAAO;QACT;QACA;YACEb,gBAAgBN;YAChBO,UAAU,CAAC,EAAEC,SAAS,EAAE;gBACtB,IAAI,CAACX,kBAAkBW,YAAY;oBACjC,OAAO;gBACT;gBACA,KAAK,MAAMC,QAAQD,UAAUE,QAAQ,GAAI;oBACvC,IAAId,eAAea,OAAO;wBACxB,IAAIA,KAAKE,aAAa,OAAO,WAAW;4BACtC;wBACF;oBACF;oBAEA,MAAMC,SAASH,KAAKI,SAAS;oBAC7B,IAAIjB,eAAegB,SAAS;wBAC1B,IAAIA,OAAOD,aAAa,OAAO,WAAW;4BACxC;wBACF;oBACF;oBAEA,OAAO;gBACT;gBACA,OAAO;YACT;YACAG,KAAK;YACLC,OAAO,CAAC,aAAa,CAAC;YACtBC,UAAU,CAAC,EAAEC,MAAM,EAAE;gBACnBA,OAAOC,eAAe,CAACpB,wBAAwB;YACjD;YACAqB,OAAO;QACT;KACD;CACF;AAED,MAAMC,qBAA+D,CAACC;IACpE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,cAAc;oBACZC,QAAQpB;gBACV;gBACAqB,eAAe;oBACbD,QAAQpB;gBACV;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMsB,8BAA8BxB,sBAAsBiB,oBAAmB"}
@@ -0,0 +1,3 @@
1
+ import type { ToolbarGroup, ToolbarGroupItem } from '../toolbars/types.js';
2
+ export declare const toolbarAlignGroupWithItems: (items: ToolbarGroupItem[]) => ToolbarGroup;
3
+ //# sourceMappingURL=toolbarAlignGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolbarAlignGroup.d.ts","sourceRoot":"","sources":["../../../../src/field/features/align/toolbarAlignGroup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAI1E,eAAO,MAAM,0BAA0B,UAAW,gBAAgB,EAAE,KAAG,YAQtE,CAAA"}
@@ -1,12 +1,12 @@
1
1
  import { AlignLeftIcon } from '../../lexical/ui/icons/AlignLeft/index.js';
2
- export const alignGroupWithItems = (items)=>{
2
+ export const toolbarAlignGroupWithItems = (items)=>{
3
3
  return {
4
4
  type: 'dropdown',
5
5
  ChildComponent: AlignLeftIcon,
6
6
  items,
7
7
  key: 'align',
8
- order: 2
8
+ order: 30
9
9
  };
10
10
  };
11
11
 
12
- //# sourceMappingURL=inlineToolbarAlignGroup.js.map
12
+ //# sourceMappingURL=toolbarAlignGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/field/features/align/toolbarAlignGroup.ts"],"sourcesContent":["import type { ToolbarGroup, ToolbarGroupItem } from '../toolbars/types.js'\n\nimport { AlignLeftIcon } from '../../lexical/ui/icons/AlignLeft/index.js'\n\nexport const toolbarAlignGroupWithItems = (items: ToolbarGroupItem[]): ToolbarGroup => {\n return {\n type: 'dropdown',\n ChildComponent: AlignLeftIcon,\n items,\n key: 'align',\n order: 30,\n }\n}\n"],"names":["AlignLeftIcon","toolbarAlignGroupWithItems","items","type","ChildComponent","key","order"],"rangeMappings":";;;;;;;;;","mappings":"AAEA,SAASA,aAAa,QAAQ,4CAA2C;AAEzE,OAAO,MAAMC,6BAA6B,CAACC;IACzC,OAAO;QACLC,MAAM;QACNC,gBAAgBJ;QAChBE;QACAG,KAAK;QACLC,OAAO;IACT;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blockquote/feature.client.tsx"],"names":[],"mappings":";AAkEA,eAAO,MAAM,gCAAgC,+BAAiD,CAAA"}
1
+ {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blockquote/feature.client.tsx"],"names":[],"mappings":";AAkFA,eAAO,MAAM,gCAAgC,+BAAiD,CAAA"}
@@ -1,11 +1,38 @@
1
1
  'use client';
2
- import { $createQuoteNode, QuoteNode } from '@lexical/rich-text';
2
+ import { $createQuoteNode, $isQuoteNode, QuoteNode } from '@lexical/rich-text';
3
3
  import { $setBlocksType } from '@lexical/selection';
4
- import { $getSelection } from 'lexical';
4
+ import { $getSelection, $isRangeSelection } from 'lexical';
5
5
  import { BlockquoteIcon } from '../../lexical/ui/icons/Blockquote/index.js';
6
6
  import { createClientComponent } from '../createClientComponent.js';
7
- import { inlineToolbarTextDropdownGroupWithItems } from '../shared/inlineToolbar/textDropdownGroup.js';
7
+ import { toolbarTextDropdownGroupWithItems } from '../shared/toolbar/textDropdownGroup.js';
8
8
  import { MarkdownTransformer } from './markdownTransformer.js';
9
+ const toolbarGroups = [
10
+ toolbarTextDropdownGroupWithItems([
11
+ {
12
+ ChildComponent: BlockquoteIcon,
13
+ isActive: ({ selection })=>{
14
+ if (!$isRangeSelection(selection)) {
15
+ return false;
16
+ }
17
+ for (const node of selection.getNodes()){
18
+ if (!$isQuoteNode(node) && !$isQuoteNode(node.getParent())) {
19
+ return false;
20
+ }
21
+ }
22
+ return true;
23
+ },
24
+ key: 'blockquote',
25
+ label: `Blockquote`,
26
+ onSelect: ({ editor })=>{
27
+ editor.update(()=>{
28
+ const selection = $getSelection();
29
+ $setBlocksType(selection, ()=>$createQuoteNode());
30
+ });
31
+ },
32
+ order: 20
33
+ }
34
+ ])
35
+ ];
9
36
  const BlockQuoteFeatureClient = (props)=>{
10
37
  return {
11
38
  clientFeatureProps: props,
@@ -20,16 +47,15 @@ const BlockQuoteFeatureClient = (props)=>{
20
47
  slashMenu: {
21
48
  groups: [
22
49
  {
23
- displayName: 'Basic',
24
50
  items: [
25
51
  {
26
52
  Icon: BlockquoteIcon,
27
- displayName: 'Blockquote',
28
53
  key: 'blockquote',
29
54
  keywords: [
30
55
  'quote',
31
56
  'blockquote'
32
57
  ],
58
+ label: 'Blockquote',
33
59
  onSelect: ({ editor })=>{
34
60
  editor.update(()=>{
35
61
  const selection = $getSelection();
@@ -38,28 +64,16 @@ const BlockQuoteFeatureClient = (props)=>{
38
64
  }
39
65
  }
40
66
  ],
41
- key: 'basic'
67
+ key: 'basic',
68
+ label: 'Basic'
42
69
  }
43
70
  ]
44
71
  },
72
+ toolbarFixed: {
73
+ groups: toolbarGroups
74
+ },
45
75
  toolbarInline: {
46
- groups: [
47
- inlineToolbarTextDropdownGroupWithItems([
48
- {
49
- ChildComponent: BlockquoteIcon,
50
- isActive: ()=>false,
51
- key: 'blockquote',
52
- label: `Blockquote`,
53
- onSelect: ({ editor })=>{
54
- editor.update(()=>{
55
- const selection = $getSelection();
56
- $setBlocksType(selection, ()=>$createQuoteNode());
57
- });
58
- },
59
- order: 20
60
- }
61
- ])
62
- ]
76
+ groups: toolbarGroups
63
77
  }
64
78
  })
65
79
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/blockquote/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $createQuoteNode, QuoteNode } from '@lexical/rich-text'\nimport { $setBlocksType } from '@lexical/selection'\nimport { $getSelection } from 'lexical'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { BlockquoteIcon } from '../../lexical/ui/icons/Blockquote/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { inlineToolbarTextDropdownGroupWithItems } from '../shared/inlineToolbar/textDropdownGroup.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nconst BlockQuoteFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n markdownTransformers: [MarkdownTransformer],\n nodes: [QuoteNode],\n\n slashMenu: {\n groups: [\n {\n displayName: 'Basic',\n items: [\n {\n Icon: BlockquoteIcon,\n displayName: 'Blockquote',\n key: 'blockquote',\n keywords: ['quote', 'blockquote'],\n onSelect: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n })\n },\n },\n ],\n key: 'basic',\n },\n ],\n },\n toolbarInline: {\n groups: [\n inlineToolbarTextDropdownGroupWithItems([\n {\n ChildComponent: BlockquoteIcon,\n isActive: () => false,\n key: 'blockquote',\n label: `Blockquote`,\n onSelect: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n })\n },\n order: 20,\n },\n ]),\n ],\n },\n }),\n }\n}\n\nexport const BlockQuoteFeatureClientComponent = createClientComponent(BlockQuoteFeatureClient)\n"],"names":["$createQuoteNode","QuoteNode","$setBlocksType","$getSelection","BlockquoteIcon","createClientComponent","inlineToolbarTextDropdownGroupWithItems","MarkdownTransformer","BlockQuoteFeatureClient","props","clientFeatureProps","feature","markdownTransformers","nodes","slashMenu","groups","displayName","items","Icon","key","keywords","onSelect","editor","update","selection","toolbarInline","ChildComponent","isActive","label","order","BlockQuoteFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,gBAAgB,EAAEC,SAAS,QAAQ,qBAAoB;AAChE,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,aAAa,QAAQ,UAAS;AAIvC,SAASC,cAAc,QAAQ,6CAA4C;AAC3E,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,uCAAuC,QAAQ,+CAA8C;AACtG,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,MAAMC,0BAAoE,CAACC;IACzE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,sBAAsB;oBAACL;iBAAoB;gBAC3CM,OAAO;oBAACZ;iBAAU;gBAElBa,WAAW;oBACTC,QAAQ;wBACN;4BACEC,aAAa;4BACbC,OAAO;gCACL;oCACEC,MAAMd;oCACNY,aAAa;oCACbG,KAAK;oCACLC,UAAU;wCAAC;wCAAS;qCAAa;oCACjCC,UAAU,CAAC,EAAEC,MAAM,EAAE;wCACnBA,OAAOC,MAAM,CAAC;4CACZ,MAAMC,YAAYrB;4CAClBD,eAAesB,WAAW,IAAMxB;wCAClC;oCACF;gCACF;6BACD;4BACDmB,KAAK;wBACP;qBACD;gBACH;gBACAM,eAAe;oBACbV,QAAQ;wBACNT,wCAAwC;4BACtC;gCACEoB,gBAAgBtB;gCAChBuB,UAAU,IAAM;gCAChBR,KAAK;gCACLS,OAAO,CAAC,UAAU,CAAC;gCACnBP,UAAU,CAAC,EAAEC,MAAM,EAAE;oCACnBA,OAAOC,MAAM,CAAC;wCACZ,MAAMC,YAAYrB;wCAClBD,eAAesB,WAAW,IAAMxB;oCAClC;gCACF;gCACA6B,OAAO;4BACT;yBACD;qBACF;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMC,mCAAmCzB,sBAAsBG,yBAAwB"}
1
+ {"version":3,"sources":["../../../../src/field/features/blockquote/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $createQuoteNode, $isQuoteNode, QuoteNode } from '@lexical/rich-text'\nimport { $setBlocksType } from '@lexical/selection'\nimport { $getSelection, $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../toolbars/types.js'\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { BlockquoteIcon } from '../../lexical/ui/icons/Blockquote/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { toolbarTextDropdownGroupWithItems } from '../shared/toolbar/textDropdownGroup.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: BlockquoteIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if (!$isQuoteNode(node) && !$isQuoteNode(node.getParent())) {\n return false\n }\n }\n return true\n },\n key: 'blockquote',\n label: `Blockquote`,\n onSelect: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n })\n },\n order: 20,\n },\n ]),\n]\n\nconst BlockQuoteFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n markdownTransformers: [MarkdownTransformer],\n nodes: [QuoteNode],\n\n slashMenu: {\n groups: [\n {\n items: [\n {\n Icon: BlockquoteIcon,\n key: 'blockquote',\n keywords: ['quote', 'blockquote'],\n label: 'Blockquote',\n onSelect: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n })\n },\n },\n ],\n key: 'basic',\n label: 'Basic',\n },\n ],\n },\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }),\n }\n}\n\nexport const BlockQuoteFeatureClientComponent = createClientComponent(BlockQuoteFeatureClient)\n"],"names":["$createQuoteNode","$isQuoteNode","QuoteNode","$setBlocksType","$getSelection","$isRangeSelection","BlockquoteIcon","createClientComponent","toolbarTextDropdownGroupWithItems","MarkdownTransformer","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getParent","key","label","onSelect","editor","update","order","BlockQuoteFeatureClient","props","clientFeatureProps","feature","markdownTransformers","nodes","slashMenu","groups","items","Icon","keywords","toolbarFixed","toolbarInline","BlockQuoteFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,gBAAgB,EAAEC,YAAY,EAAEC,SAAS,QAAQ,qBAAoB;AAC9E,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,UAAS;AAK1D,SAASC,cAAc,QAAQ,6CAA4C;AAC3E,SAASC,qBAAqB,QAAQ,8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@@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/blocks/component/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAuBzD,OAAO,cAAc,CAAA;AAGrB,KAAK,KAAK,GAAG;IACX,qBAAqB,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B,QAAQ,EAAE,WAAW,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,mBAAmB,EAAE,WAAW,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAkJ1C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/blocks/component/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAuBzD,OAAO,cAAc,CAAA;AAGrB,KAAK,KAAK,GAAG;IACX,qBAAqB,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B,QAAQ,EAAE,WAAW,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,mBAAmB,EAAE,WAAW,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAiJ1C,CAAA"}
@@ -154,7 +154,7 @@ export const BlockComponent = (props)=>{
154
154
  ]) // Adding formData to the dependencies here might break it
155
155
  ;
156
156
  return /*#__PURE__*/ React.createElement("div", {
157
- className: baseClass
157
+ className: baseClass + ' ' + baseClass + '-' + formData.blockType
158
158
  }, formContent);
159
159
  };
160
160
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/blocks/component/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui/forms/Form'\n\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { type BlockFields } from '../nodes/BlocksNode.js'\nconst baseClass = 'lexical-block'\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { FormState } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Collapsible } from '@payloadcms/ui/elements/Collapsible'\nimport { Pill } from '@payloadcms/ui/elements/Pill'\nimport { ShimmerEffect } from '@payloadcms/ui/elements/ShimmerEffect'\nimport { SectionTitle } from '@payloadcms/ui/fields/Blocks/SectionTitle'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useFormSubmitted } from '@payloadcms/ui/forms/Form'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { BlockContent } from './BlockContent.js'\nimport './index.scss'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n blockFieldWrapperName: string\n children?: React.ReactNode\n\n formData: BlockFields\n nodeKey?: string\n /**\n * This transformedFormData already comes wrapped in blockFieldWrapperName\n */\n transformedFormData: BlockFields\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { blockFieldWrapperName, formData, nodeKey } = props\n const config = useConfig()\n const submitted = useFormSubmitted()\n const { id } = useDocumentInfo()\n const { path, schemaPath } = useFieldProps()\n const { editorConfig, field: parentLexicalRichTextField } = useEditorConfigContext()\n\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.blocks.fields.${formData?.blockType}`\n const schemaFieldsPath = `${schemaPath}.feature.blocks.${formData?.blockType}`\n\n const reducedBlock: ReducedBlock = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.clientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks?.find((block) => block.slug === formData?.blockType)\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath)\n // Field Schema\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: JSON.parse(JSON.stringify(formData)),\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n if (state) {\n setInitialState({\n ...removeEmptyArrayValues({ fields: state }),\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n })\n }\n }\n\n if (formData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const formState = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n\n return {\n ...formState,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n }\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id, formData.blockName],\n )\n const { i18n } = useTranslation()\n\n const classNames = [`${baseClass}__row`, `${baseClass}__row--no-errors`].filter(Boolean).join(' ')\n\n // Memoized Form JSX\n const formContent = useMemo(() => {\n return reducedBlock && initialState !== false ? (\n <Form\n beforeSubmit={[onChange]}\n // @ts-expect-error TODO: Fix this\n fields={fieldMap}\n initialState={initialState}\n onChange={[onChange]}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n field={parentLexicalRichTextField}\n formData={formData}\n formSchema={Array.isArray(fieldMap) ? fieldMap : []}\n nodeKey={nodeKey}\n path={`${path}.feature.blocks.${formData.blockType}`}\n reducedBlock={reducedBlock}\n schemaPath={schemaFieldsPath}\n />\n </Form>\n ) : (\n <Collapsible\n className={classNames}\n collapsibleStyle=\"default\"\n header={\n <div className={`${baseClass}__block-header`}>\n <div>\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${formData?.blockType}`}\n pillStyle=\"white\"\n >\n {typeof reducedBlock.labels.singular === 'string'\n ? getTranslation(reducedBlock.labels.singular, i18n)\n : '[Singular Label]'}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={parentLexicalRichTextField?.readOnly} />\n </div>\n </div>\n }\n key={0}\n >\n <ShimmerEffect height=\"35vh\" />\n </Collapsible>\n )\n }, [\n fieldMap,\n parentLexicalRichTextField,\n nodeKey,\n i18n,\n submitted,\n initialState,\n reducedBlock,\n blockFieldWrapperName,\n onChange,\n schemaFieldsPath,\n path,\n ]) // Adding formData to the dependencies here might break it\n\n return <div className={baseClass}>{formContent}</div>\n}\n"],"names":["Form","React","useCallback","useEffect","useMemo","useState","baseClass","getTranslation","Collapsible","Pill","ShimmerEffect","SectionTitle","useFieldProps","useFormSubmitted","useConfig","useDocumentInfo","useTranslation","getFormState","v4","uuid","useEditorConfigContext","BlockContent","removeEmptyArrayValues","BlockComponent","props","blockFieldWrapperName","formData","nodeKey","config","submitted","id","path","schemaPath","editorConfig","field","parentLexicalRichTextField","initialState","setInitialState","richTextComponentMap","componentMapRenderedFieldsPath","blockType","schemaFieldsPath","reducedBlock","resolvedFeatureMap","get","clientFeatureProps","reducedBlocks","find","block","slug","fieldMap","awaitInitialState","state","apiRoute","routes","api","body","data","JSON","parse","stringify","operation","serverURL","fields","blockName","initialValue","passesCondition","valid","value","onChange","formState","prevFormState","i18n","classNames","filter","Boolean","join","formContent","beforeSubmit","formSchema","Array","isArray","className","collapsibleStyle","header","div","pillStyle","labels","singular","readOnly","key","height"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,IAAI,QAAQ,4BAA2B;AAChD,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAGxE,MAAMC,YAAY;AAIlB,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SAASC,WAAW,QAAQ,sCAAqC;AACjE,SAASC,IAAI,QAAQ,+BAA8B;AACnD,SAASC,aAAa,QAAQ,wCAAuC;AACrE,SAASC,YAAY,QAAQ,4CAA2C;AACxE,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,YAAY,QAAQ,wCAAuC;AACpE,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAKjC,SAASC,sBAAsB,QAAQ,yDAAwD;AAC/F,SAASC,YAAY,QAAQ,oBAAmB;AAChD,OAAO,eAAc;AACrB,SAASC,sBAAsB,QAAQ,8BAA6B;AAcpE,OAAO,MAAMC,iBAAkC,CAACC;IAC9C,MAAM,EAAEC,qBAAqB,EAAEC,QAAQ,EAAEC,OAAO,EAAE,GAAGH;IACrD,MAAMI,SAASd;IACf,MAAMe,YAAYhB;IAClB,MAAM,EAAEiB,EAAE,EAAE,GAAGf;IACf,MAAM,EAAEgB,IAAI,EAAEC,UAAU,EAAE,GAAGpB;IAC7B,MAAM,E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,aAAa6C,MAAM,CAACC,QAAQ,KAAK,WACrCjF,eAAemC,aAAa6C,MAAM,CAACC,QAAQ,EAAEhB,QAC7C,mCAEN,oBAAC7D;gBAAaoB,MAAK;gBAAY0D,UAAUtD,4BAA4BsD;;YAI3EC,KAAK;yBAEL,oBAAChF;YAAciF,QAAO;;IAG5B,GAAG;QACDzC;QACAf;QACAR;QACA6C;QACA3C;QACAO;QACAM;QACAjB;QACA4C;QACA5B;QACAV;KACD,EAAE,0DAA0D;;IAE7D,qBAAO,oBAACsD;QAAIH,WAAW5E;OAAYuE;AACrC,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/features/blocks/component/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui/forms/Form'\n\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { type BlockFields } from '../nodes/BlocksNode.js'\nconst baseClass = 'lexical-block'\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { FormState } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Collapsible } from '@payloadcms/ui/elements/Collapsible'\nimport { Pill } from '@payloadcms/ui/elements/Pill'\nimport { ShimmerEffect } from '@payloadcms/ui/elements/ShimmerEffect'\nimport { SectionTitle } from '@payloadcms/ui/fields/Blocks/SectionTitle'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useFormSubmitted } from '@payloadcms/ui/forms/Form'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { BlockContent } from './BlockContent.js'\nimport './index.scss'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n blockFieldWrapperName: string\n children?: React.ReactNode\n\n formData: BlockFields\n nodeKey?: string\n /**\n * This transformedFormData already comes wrapped in blockFieldWrapperName\n */\n transformedFormData: BlockFields\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { blockFieldWrapperName, formData, nodeKey } = props\n const config = useConfig()\n const submitted = useFormSubmitted()\n const { id } = useDocumentInfo()\n const { path, schemaPath } = useFieldProps()\n const { editorConfig, field: parentLexicalRichTextField } = useEditorConfigContext()\n\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.blocks.fields.${formData?.blockType}`\n const schemaFieldsPath = `${schemaPath}.feature.blocks.${formData?.blockType}`\n\n const reducedBlock: ReducedBlock = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.clientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks?.find((block) => block.slug === formData?.blockType)\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath)\n // Field Schema\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: JSON.parse(JSON.stringify(formData)),\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n if (state) {\n setInitialState({\n ...removeEmptyArrayValues({ fields: state }),\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n })\n }\n }\n\n if (formData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const formState = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n\n return {\n ...formState,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n }\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id, formData.blockName],\n )\n const { i18n } = useTranslation()\n\n const classNames = [`${baseClass}__row`, `${baseClass}__row--no-errors`].filter(Boolean).join(' ')\n\n // Memoized Form JSX\n const formContent = useMemo(() => {\n return reducedBlock && initialState !== false ? (\n <Form\n beforeSubmit={[onChange]}\n // @ts-expect-error TODO: Fix this\n fields={fieldMap}\n initialState={initialState}\n onChange={[onChange]}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n field={parentLexicalRichTextField}\n formData={formData}\n formSchema={Array.isArray(fieldMap) ? fieldMap : []}\n nodeKey={nodeKey}\n path={`${path}.feature.blocks.${formData.blockType}`}\n reducedBlock={reducedBlock}\n schemaPath={schemaFieldsPath}\n />\n </Form>\n ) : (\n <Collapsible\n className={classNames}\n collapsibleStyle=\"default\"\n header={\n <div className={`${baseClass}__block-header`}>\n <div>\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${formData?.blockType}`}\n pillStyle=\"white\"\n >\n {typeof reducedBlock.labels.singular === 'string'\n ? getTranslation(reducedBlock.labels.singular, i18n)\n : '[Singular Label]'}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={parentLexicalRichTextField?.readOnly} />\n </div>\n </div>\n }\n key={0}\n >\n <ShimmerEffect height=\"35vh\" />\n </Collapsible>\n )\n }, [\n fieldMap,\n parentLexicalRichTextField,\n nodeKey,\n i18n,\n submitted,\n initialState,\n reducedBlock,\n blockFieldWrapperName,\n onChange,\n schemaFieldsPath,\n path,\n ]) // Adding formData to the dependencies here might break it\n return <div className={baseClass + ' ' + baseClass + '-' + formData.blockType}>{formContent}</div>\n}\n"],"names":["Form","React","useCallback","useEffect","useMemo","useState","baseClass","getTranslation","Collapsible","Pill","ShimmerEffect","SectionTitle","useFieldProps","useFormSubmitted","useConfig","useDocumentInfo","useTranslation","getFormState","v4","uuid","useEditorConfigContext","BlockContent","removeEmptyArrayValues","BlockComponent","props","blockFieldWrapperName","formData","nodeKey","config","submitted","id","path","schemaPath","editorConfig","field","parentLexicalRichTextField","initialState","setInitialState","richTextComponentMap","componentMapRenderedFieldsPath","blockType","schemaFieldsPath","reducedBlock","resolvedFeatureMap","get","clientFeatureProps","reducedBlocks","find","block","slug","fieldMap","awaitInitialState","state","apiRoute","routes","api","body","data","JSON","parse","stringify","operation","serverURL","fields","blockName","initialValue","passesCondition","valid","value","onChange","formState","prevFormState","i18n","classNames","filter","Boolean","join","formContent","beforeSubmit","formSchema","Array","isArray","className","collapsibleStyle","header","div","pillStyle","labels","singular","readOnly","key","height"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,IAAI,QAAQ,4BAA2B;AAChD,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAGxE,MAAMC,YAAY;AAIlB,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SAASC,WAAW,QAAQ,sCAAqC;AACjE,SAASC,IAAI,QAAQ,+BAA8B;AACnD,SAASC,aAAa,QAAQ,wCAAuC;AACrE,SAASC,YAAY,QAAQ,4CAA2C;AACxE,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,YAAY,QAAQ,wCAAuC;AACpE,SAASC,MAAMC,IAAI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AYA,WAAW,EAAE;YACnDvB,SAASA;YACTI,MAAM,CAAC,EAAEA,KAAK,gBAAgB,EAAEL,SAASc,SAAS,CAAC,CAAC;YACpDE,cAAcA;YACdV,YAAYS;4BAIhB,oBAACjC;YACC0E,WAAWT;YACXU,kBAAiB;YACjBC,sBACE,oBAACC;gBAAIH,WAAW,CAAC,EAAE5E,UAAU,cAAc,CAAC;6BAC1C,oBAAC+E,2BACC,oBAAC5E;gBACCyE,WAAW,CAAC,EAAE5E,UAAU,aAAa,EAAEA,UAAU,aAAa,EAAEoB,UAAUc,UAAU,CAAC;gBACrF8C,WAAU;eAET,OAAO5C,aAAa6C,MAAM,CAACC,QAAQ,KAAK,WACrCjF,eAAemC,aAAa6C,MAAM,CAACC,QAAQ,EAAEhB,QAC7C,mCAEN,oBAAC7D;gBAAaoB,MAAK;gBAAY0D,UAAUtD,4BAA4BsD;;YAI3EC,KAAK;yBAEL,oBAAChF;YAAciF,QAAO;;IAG5B,GAAG;QACDzC;QACAf;QACAR;QACA6C;QACA3C;QACAO;QACAM;QACAjB;QACA4C;QACA5B;QACAV;KACD,EAAE,0DAA0D;;IAC7D,qBAAO,oBAACsD;QAAIH,WAAW5E,YAAY,MAAMA,YAAY,MAAMoB,SAASc,SAAS;OAAGqC;AAClF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/feature.client.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAY9E,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,YAAY,EAAE,CAAA;CAC9B,CAAA;AA+CD,eAAO,MAAM,4BAA4B,0FAA6C,CAAA"}
1
+ {"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/feature.client.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAY9E,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,YAAY,EAAE,CAAA;CAC9B,CAAA;AA+ED,eAAO,MAAM,4BAA4B,0FAA6C,CAAA"}
@@ -22,22 +22,21 @@ const BlocksFeatureClient = (props)=>{
22
22
  slashMenu: {
23
23
  groups: [
24
24
  {
25
- displayName: 'Blocks',
26
25
  items: props.reducedBlocks.map((block)=>{
27
26
  return {
28
27
  Icon: BlockIcon,
29
- displayName: ({ i18n })=>{
30
- if (!block.labels.singular) {
31
- return block.slug;
32
- }
33
- return getTranslation(block.labels.singular, i18n);
34
- },
35
28
  key: 'block-' + block.slug,
36
29
  keywords: [
37
30
  'block',
38
31
  'blocks',
39
32
  block.slug
40
33
  ],
34
+ label: ({ i18n })=>{
35
+ if (!block.labels.singular) {
36
+ return block.slug;
37
+ }
38
+ return getTranslation(block.labels.singular, i18n);
39
+ },
41
40
  onSelect: ({ editor })=>{
42
41
  editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
43
42
  id: null,
@@ -47,7 +46,39 @@ const BlocksFeatureClient = (props)=>{
47
46
  }
48
47
  };
49
48
  }),
50
- key: 'blocks'
49
+ key: 'blocks',
50
+ label: 'Blocks'
51
+ }
52
+ ]
53
+ },
54
+ toolbarFixed: {
55
+ groups: [
56
+ {
57
+ type: 'dropdown',
58
+ ChildComponent: BlockIcon,
59
+ items: props.reducedBlocks.map((block, index)=>{
60
+ return {
61
+ ChildComponent: BlockIcon,
62
+ isActive: undefined,
63
+ key: 'block-' + block.slug,
64
+ label: ({ i18n })=>{
65
+ if (!block.labels.singular) {
66
+ return block.slug;
67
+ }
68
+ return getTranslation(block.labels.singular, i18n);
69
+ },
70
+ onSelect: ({ editor })=>{
71
+ editor.dispatchCommand(INSERT_BLOCK_COMMAND, {
72
+ id: null,
73
+ blockName: '',
74
+ blockType: block.slug
75
+ });
76
+ },
77
+ order: index
78
+ };
79
+ }),
80
+ key: 'blocks',
81
+ order: 20
51
82
  }
52
83
  ]
53
84
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/blocks/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { BlockIcon } from '../../lexical/ui/icons/Block/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from './plugin/commands.js'\nimport { BlocksPlugin } from './plugin/index.js'\n\nexport type BlocksFeatureClientProps = {\n reducedBlocks: ReducedBlock[]\n}\n\nconst BlocksFeatureClient: FeatureProviderProviderClient<BlocksFeatureClientProps> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n nodes: [BlockNode],\n plugins: [\n {\n Component: BlocksPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n {\n displayName: 'Blocks',\n items: props.reducedBlocks.map((block) => {\n return {\n Icon: BlockIcon,\n displayName: ({ i18n }) => {\n if (!block.labels.singular) {\n return block.slug\n }\n\n return getTranslation(block.labels.singular, i18n)\n },\n key: 'block-' + block.slug,\n keywords: ['block', 'blocks', block.slug],\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType: block.slug,\n })\n },\n }\n }),\n key: 'blocks',\n },\n ],\n },\n }),\n }\n}\n\nexport const BlocksFeatureClientComponent = createClientComponent(BlocksFeatureClient)\n"],"names":["getTranslation","BlockIcon","createClientComponent","BlockNode","INSERT_BLOCK_COMMAND","BlocksPlugin","BlocksFeatureClient","props","clientFeatureProps","feature","nodes","plugins","Component","position","slashMenu","groups","displayName","items","reducedBlocks","map","block","Icon","i18n","labels","singular","slug","key","keywords","onSelect","editor","dispatchCommand","id","blockName","blockType","BlocksFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AAIzD,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,oBAAoB,QAAQ,uBAAsB;AAC3D,SAASC,YAAY,QAAQ,oBAAmB;AAMhD,MAAMC,sBAA+E,CAACC;IACpF,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,OAAO;oBAACP;iBAAU;gBAClBQ,SAAS;oBACP;wBACEC,WAAWP;wBACXQ,UAAU;oBACZ;iBACD;gBACDC,WAAW;oBACTC,QAAQ;wBACN;4BACEC,aAAa;4BACbC,OAAOV,MAAMW,aAAa,CAACC,GAAG,CAAC,CAACC;gCAC9B,OAAO;oCACLC,MAAMpB;oCACNe,aAAa,CAAC,EAAEM,IAAI,EAAE;wCACpB,IAAI,CAACF,MAAMG,MAAM,CAACC,QAAQ,EAAE;4CAC1B,OAAOJ,MAAMK,IAAI;wCACnB;wCAEA,OAAOzB,eAAeoB,MAAMG,MAAM,CAACC,QAAQ,EAAEF;oCAC/C;oCACAI,KAAK,WAAWN,MAAMK,IAAI;oCAC1BE,UAAU;wCAAC;wCAAS;wCAAUP,MAAMK,IAAI;qCAAC;oCACzCG,UAAU,CAAC,EAAEC,MAAM,EAAE;wCACnBA,OAAOC,eAAe,CAAC1B,sBAAsB;4CAC3C2B,IAAI;4CACJC,WAAW;4CACXC,WAAWb,MAAMK,IAAI;wCACvB;oCACF;gCACF;4BACF;4BACAC,KAAK;wBACP;qBACD;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMQ,+BAA+BhC,sBAAsBI,qBAAoB"}
1
+ {"version":3,"sources":["../../../../src/field/features/blocks/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { BlockIcon } from '../../lexical/ui/icons/Block/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { INSERT_BLOCK_COMMAND } from './plugin/commands.js'\nimport { BlocksPlugin } from './plugin/index.js'\n\nexport type BlocksFeatureClientProps = {\n reducedBlocks: ReducedBlock[]\n}\n\nconst BlocksFeatureClient: FeatureProviderProviderClient<BlocksFeatureClientProps> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n nodes: [BlockNode],\n plugins: [\n {\n Component: BlocksPlugin,\n position: 'normal',\n },\n ],\n slashMenu: {\n groups: [\n {\n items: props.reducedBlocks.map((block) => {\n return {\n Icon: BlockIcon,\n key: 'block-' + block.slug,\n keywords: ['block', 'blocks', block.slug],\n label: ({ i18n }) => {\n if (!block.labels.singular) {\n return block.slug\n }\n\n return getTranslation(block.labels.singular, i18n)\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType: block.slug,\n })\n },\n }\n }),\n key: 'blocks',\n label: 'Blocks',\n },\n ],\n },\n toolbarFixed: {\n groups: [\n {\n type: 'dropdown',\n ChildComponent: BlockIcon,\n items: props.reducedBlocks.map((block, index) => {\n return {\n ChildComponent: BlockIcon,\n isActive: undefined, // At this point, we would be inside a sub-richtext-editor. And at this point this will be run against the focused sub-editor, not the parent editor which has the actual block. Thus, no point in running this\n key: 'block-' + block.slug,\n label: ({ i18n }) => {\n if (!block.labels.singular) {\n return block.slug\n }\n\n return getTranslation(block.labels.singular, i18n)\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INSERT_BLOCK_COMMAND, {\n id: null,\n blockName: '',\n blockType: block.slug,\n })\n },\n order: index,\n }\n }),\n key: 'blocks',\n order: 20,\n },\n ],\n },\n }),\n }\n}\n\nexport const BlocksFeatureClientComponent = createClientComponent(BlocksFeatureClient)\n"],"names":["getTranslation","BlockIcon","createClientComponent","BlockNode","INSERT_BLOCK_COMMAND","BlocksPlugin","BlocksFeatureClient","props","clientFeatureProps","feature","nodes","plugins","Component","position","slashMenu","groups","items","reducedBlocks","map","block","Icon","key","slug","keywords","label","i18n","labels","singular","onSelect","editor","dispatchCommand","id","blockName","blockType","toolbarFixed","type","ChildComponent","index","isActive","undefined","order","BlocksFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AAIzD,SAASC,SAAS,QAAQ,wCAAuC;AACjE,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,oBAAoB,QAAQ,uBAAsB;AAC3D,SAASC,YAAY,QAAQ,oBAAmB;AAMhD,MAAMC,sBAA+E,CAACC;IACpF,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,OAAO;oBAACP;iBAAU;gBAClBQ,SAAS;oBACP;wBACEC,WAAWP;wBACXQ,UAAU;oBACZ;iBACD;gBACDC,WAAW;oBACTC,QAAQ;wBACN;4BACEC,OAAOT,MAAMU,aAAa,CAACC,GAAG,CAAC,CAACC;gCAC9B,OAAO;oCACLC,MAAMnB;oCACNoB,KAAK,WAAWF,MAAMG,IAAI;oCAC1BC,UAAU;wCAAC;wCAAS;wCAAUJ,MAAMG,IAAI;qCAAC;oCACzCE,OAAO,CAAC,EAAEC,IAAI,EAAE;wCACd,IAAI,CAACN,MAAMO,MAAM,CAACC,QAAQ,EAAE;4CAC1B,OAAOR,MAAMG,IAAI;wCACnB;wCAEA,OAAOtB,eAAemB,MAAMO,MAAM,CAACC,QAAQ,EAAEF;oCAC/C;oCACAG,UAAU,CAAC,EAAEC,MAAM,EAAE;wCACnBA,OAAOC,eAAe,CAAC1B,sBAAsB;4CAC3C2B,IAAI;4CACJC,WAAW;4CACXC,WAAWd,MAAMG,IAAI;wCACvB;oCACF;gCACF;4BACF;4BACAD,KAAK;4BACLG,OAAO;wBACT;qBACD;gBACH;gBACAU,cAAc;oBACZnB,QAAQ;wBACN;4BACEoB,MAAM;4BACNC,gBAAgBnC;4BAChBe,OAAOT,MAAMU,aAAa,CAACC,GAAG,CAAC,CAACC,OAAOkB;gCACrC,OAAO;oCACLD,gBAAgBnC;oCAChBqC,UAAUC;oCACVlB,KAAK,WAAWF,MAAMG,IAAI;oCAC1BE,OAAO,CAAC,EAAEC,IAAI,EAAE;wCACd,IAAI,CAACN,MAAMO,MAAM,CAACC,QAAQ,EAAE;4CAC1B,OAAOR,MAAMG,IAAI;wCACnB;wCAEA,OAAOtB,eAAemB,MAAMO,MAAM,CAACC,QAAQ,EAAEF;oCAC/C;oCACAG,UAAU,CAAC,EAAEC,MAAM,EAAE;wCACnBA,OAAOC,eAAe,CAAC1B,sBAAsB;4CAC3C2B,IAAI;4CACJC,WAAW;4CACXC,WAAWd,MAAMG,IAAI;wCACvB;oCACF;oCACAkB,OAAOH;gCACT;4BACF;4BACAhB,KAAK;4BACLmB,OAAO;wBACT;qBACD;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMC,+BAA+BvC,sBAAsBI,qBAAoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"populationPromise.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/populationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAIhE,eAAO,MAAM,yBAAyB,UAC7B,kBAAkB,KACxB,kBAAkB,mBAAmB,CA4CvC,CAAA"}
1
+ {"version":3,"file":"populationPromise.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/populationPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAIhE,eAAO,MAAM,yBAAyB,UAC7B,kBAAkB,KACxB,kBAAkB,mBAAmB,CA8CvC,CAAA"}