@payloadcms/richtext-lexical 3.0.0-alpha.67 → 3.0.0-alpha.69

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 (342) 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 +127 -53
  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/toolbarAlignGroup.js +12 -0
  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 +50 -34
  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 +56 -27
  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/debug/{testrecorder → testRecorder}/feature.client.d.ts.map +1 -1
  25. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.js.map +1 -1
  26. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.d.ts.map +1 -1
  27. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.js +1 -1
  28. package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.js.map +1 -1
  29. package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.d.ts.map +1 -1
  30. package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.js.map +1 -1
  31. package/dist/field/features/debug/{treeview → treeView}/feature.client.d.ts.map +1 -1
  32. package/dist/field/features/debug/{treeview → treeView}/feature.client.js.map +1 -1
  33. package/dist/field/features/debug/{treeview → treeView}/feature.server.d.ts.map +1 -1
  34. package/dist/field/features/debug/{treeview → treeView}/feature.server.js +1 -1
  35. package/dist/field/features/debug/{treeview → treeView}/feature.server.js.map +1 -1
  36. package/dist/field/features/debug/{treeview → treeView}/plugin/index.d.ts.map +1 -1
  37. package/dist/field/features/debug/{treeview → treeView}/plugin/index.js.map +1 -1
  38. package/dist/field/features/format/bold/feature.client.d.ts.map +1 -1
  39. package/dist/field/features/format/bold/feature.client.js +25 -21
  40. package/dist/field/features/format/bold/feature.client.js.map +1 -1
  41. package/dist/field/features/format/inlineCode/feature.client.d.ts.map +1 -0
  42. package/dist/field/features/format/inlineCode/feature.client.js +46 -0
  43. package/dist/field/features/format/inlineCode/feature.client.js.map +1 -0
  44. package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.d.ts.map +1 -1
  45. package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.js +1 -1
  46. package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.js.map +1 -1
  47. package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.d.ts.map +1 -1
  48. package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.js.map +1 -1
  49. package/dist/field/features/format/italic/feature.client.d.ts.map +1 -1
  50. package/dist/field/features/format/italic/feature.client.js +26 -22
  51. package/dist/field/features/format/italic/feature.client.js.map +1 -1
  52. package/dist/field/features/format/shared/toolbarFormatGroup.d.ts +3 -0
  53. package/dist/field/features/format/shared/toolbarFormatGroup.d.ts.map +1 -0
  54. package/dist/field/features/format/shared/toolbarFormatGroup.js +10 -0
  55. package/dist/field/features/format/shared/toolbarFormatGroup.js.map +1 -0
  56. package/dist/field/features/format/strikethrough/feature.client.d.ts.map +1 -1
  57. package/dist/field/features/format/strikethrough/feature.client.js +26 -22
  58. package/dist/field/features/format/strikethrough/feature.client.js.map +1 -1
  59. package/dist/field/features/format/subscript/feature.client.d.ts.map +1 -1
  60. package/dist/field/features/format/subscript/feature.client.js +24 -20
  61. package/dist/field/features/format/subscript/feature.client.js.map +1 -1
  62. package/dist/field/features/format/superscript/feature.client.d.ts.map +1 -1
  63. package/dist/field/features/format/superscript/feature.client.js +24 -20
  64. package/dist/field/features/format/superscript/feature.client.js.map +1 -1
  65. package/dist/field/features/format/underline/feature.client.d.ts.map +1 -1
  66. package/dist/field/features/format/underline/feature.client.js +24 -20
  67. package/dist/field/features/format/underline/feature.client.js.map +1 -1
  68. package/dist/field/features/heading/feature.client.d.ts.map +1 -1
  69. package/dist/field/features/heading/feature.client.js +69 -49
  70. package/dist/field/features/heading/feature.client.js.map +1 -1
  71. package/dist/field/features/{horizontalrule → horizontalRule}/component/index.d.ts.map +1 -1
  72. package/dist/field/features/{horizontalrule → horizontalRule}/component/index.js.map +1 -1
  73. package/dist/field/features/horizontalRule/feature.client.d.ts.map +1 -0
  74. package/dist/field/features/horizontalRule/feature.client.js +76 -0
  75. package/dist/field/features/horizontalRule/feature.client.js.map +1 -0
  76. package/dist/field/features/{horizontalrule → horizontalRule}/feature.server.d.ts.map +1 -1
  77. package/dist/field/features/{horizontalrule → horizontalRule}/feature.server.js +1 -1
  78. package/dist/field/features/{horizontalrule → horizontalRule}/feature.server.js.map +1 -1
  79. package/dist/field/features/{horizontalrule → horizontalRule}/markdownTransformer.d.ts.map +1 -1
  80. package/dist/field/features/{horizontalrule → horizontalRule}/markdownTransformer.js.map +1 -1
  81. package/dist/field/features/{horizontalrule → horizontalRule}/nodes/HorizontalRuleNode.d.ts.map +1 -1
  82. package/dist/field/features/{horizontalrule → horizontalRule}/nodes/HorizontalRuleNode.js.map +1 -1
  83. package/dist/field/features/{horizontalrule → horizontalRule}/plugin/index.d.ts.map +1 -1
  84. package/dist/field/features/{horizontalrule → horizontalRule}/plugin/index.js.map +1 -1
  85. package/dist/field/features/indent/feature.client.d.ts.map +1 -1
  86. package/dist/field/features/indent/feature.client.js +42 -40
  87. package/dist/field/features/indent/feature.client.js.map +1 -1
  88. package/dist/field/features/indent/toolbarIndentGroup.d.ts +3 -0
  89. package/dist/field/features/indent/toolbarIndentGroup.d.ts.map +1 -0
  90. package/dist/field/features/indent/toolbarIndentGroup.js +10 -0
  91. package/dist/field/features/indent/toolbarIndentGroup.js.map +1 -0
  92. package/dist/field/features/link/feature.client.d.ts.map +1 -1
  93. package/dist/field/features/link/feature.client.js +47 -43
  94. package/dist/field/features/link/feature.client.js.map +1 -1
  95. package/dist/field/features/link/populationPromise.d.ts.map +1 -1
  96. package/dist/field/features/link/populationPromise.js +2 -1
  97. package/dist/field/features/link/populationPromise.js.map +1 -1
  98. package/dist/field/features/lists/checklist/feature.client.d.ts +1 -1
  99. package/dist/field/features/lists/checklist/feature.client.d.ts.map +1 -1
  100. package/dist/field/features/lists/checklist/feature.client.js +56 -31
  101. package/dist/field/features/lists/checklist/feature.client.js.map +1 -1
  102. package/dist/field/features/lists/checklist/feature.server.d.ts +1 -1
  103. package/dist/field/features/lists/checklist/feature.server.js +4 -4
  104. package/dist/field/features/lists/checklist/feature.server.js.map +1 -1
  105. package/dist/field/features/lists/checklist/markdownTransformers.js +1 -1
  106. package/dist/field/features/lists/checklist/markdownTransformers.js.map +1 -1
  107. package/dist/field/features/lists/orderedList/feature.client.d.ts.map +1 -0
  108. package/dist/field/features/lists/orderedList/feature.client.js +96 -0
  109. package/dist/field/features/lists/orderedList/feature.client.js.map +1 -0
  110. package/dist/field/features/lists/{orderedlist → orderedList}/feature.server.d.ts.map +1 -1
  111. package/dist/field/features/lists/{orderedlist → orderedList}/feature.server.js +1 -1
  112. package/dist/field/features/lists/{orderedlist → orderedList}/feature.server.js.map +1 -1
  113. package/dist/field/features/lists/{orderedlist → orderedList}/markdownTransformer.d.ts.map +1 -1
  114. package/dist/field/features/lists/{orderedlist → orderedList}/markdownTransformer.js +1 -1
  115. package/dist/field/features/lists/{orderedlist → orderedList}/markdownTransformer.js.map +1 -1
  116. package/dist/field/features/lists/{common → shared}/markdown.d.ts.map +1 -1
  117. package/dist/field/features/lists/{common → shared}/markdown.js.map +1 -1
  118. package/dist/field/features/lists/unorderedList/feature.client.d.ts.map +1 -0
  119. package/dist/field/features/lists/unorderedList/feature.client.js +96 -0
  120. package/dist/field/features/lists/unorderedList/feature.client.js.map +1 -0
  121. package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.server.d.ts.map +1 -1
  122. package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.server.js +1 -1
  123. package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.server.js.map +1 -1
  124. package/dist/field/features/lists/{unorderedlist → unorderedList}/markdownTransformer.d.ts.map +1 -1
  125. package/dist/field/features/lists/{unorderedlist → unorderedList}/markdownTransformer.js +1 -1
  126. package/dist/field/features/lists/{unorderedlist → unorderedList}/markdownTransformer.js.map +1 -1
  127. package/dist/field/features/paragraph/feature.client.d.ts.map +1 -1
  128. package/dist/field/features/paragraph/feature.client.js +44 -30
  129. package/dist/field/features/paragraph/feature.client.js.map +1 -1
  130. package/dist/field/features/relationship/feature.client.d.ts.map +1 -1
  131. package/dist/field/features/relationship/feature.client.js +36 -10
  132. package/dist/field/features/relationship/feature.client.js.map +1 -1
  133. package/dist/field/features/relationship/populationPromise.d.ts.map +1 -1
  134. package/dist/field/features/relationship/populationPromise.js +2 -1
  135. package/dist/field/features/relationship/populationPromise.js.map +1 -1
  136. package/dist/field/features/shared/toolbar/addDropdownGroup.d.ts +3 -0
  137. package/dist/field/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -0
  138. package/dist/field/features/shared/toolbar/addDropdownGroup.js +12 -0
  139. package/dist/field/features/shared/toolbar/addDropdownGroup.js.map +1 -0
  140. package/dist/field/features/shared/toolbar/featureButtonsGroup.d.ts +3 -0
  141. package/dist/field/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -0
  142. package/dist/field/features/shared/toolbar/featureButtonsGroup.js +10 -0
  143. package/dist/field/features/shared/toolbar/featureButtonsGroup.js.map +1 -0
  144. package/dist/field/features/shared/toolbar/textDropdownGroup.d.ts +3 -0
  145. package/dist/field/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -0
  146. package/dist/field/features/shared/toolbar/textDropdownGroup.js +12 -0
  147. package/dist/field/features/shared/toolbar/textDropdownGroup.js.map +1 -0
  148. package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts +6 -0
  149. package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts.map +1 -0
  150. package/dist/field/features/toolbars/fixed/Toolbar/index.js +152 -0
  151. package/dist/field/features/toolbars/fixed/Toolbar/index.js.map +1 -0
  152. package/dist/field/features/toolbars/fixed/Toolbar/index.scss +81 -0
  153. package/dist/field/features/toolbars/fixed/feature.client.d.ts +3 -0
  154. package/dist/field/features/toolbars/fixed/feature.client.d.ts.map +1 -0
  155. package/dist/field/features/toolbars/fixed/feature.client.js +20 -0
  156. package/dist/field/features/toolbars/fixed/feature.client.js.map +1 -0
  157. package/dist/field/features/toolbars/fixed/feature.server.d.ts +3 -0
  158. package/dist/field/features/toolbars/fixed/feature.server.d.ts.map +1 -0
  159. package/dist/field/features/toolbars/fixed/feature.server.js +16 -0
  160. package/dist/field/features/toolbars/fixed/feature.server.js.map +1 -0
  161. package/dist/field/features/toolbars/inline/Toolbar/index.d.ts +6 -0
  162. package/dist/field/features/toolbars/inline/Toolbar/index.d.ts.map +1 -0
  163. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/inline/Toolbar}/index.js +64 -38
  164. package/dist/field/features/toolbars/inline/Toolbar/index.js.map +1 -0
  165. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/inline/Toolbar}/index.scss +7 -11
  166. package/dist/field/features/toolbars/inline/feature.client.d.ts +3 -0
  167. package/dist/field/features/toolbars/inline/feature.client.d.ts.map +1 -0
  168. package/dist/field/features/toolbars/inline/feature.client.js +20 -0
  169. package/dist/field/features/toolbars/inline/feature.client.js.map +1 -0
  170. package/dist/field/features/toolbars/inline/feature.server.d.ts +3 -0
  171. package/dist/field/features/toolbars/inline/feature.server.d.ts.map +1 -0
  172. package/dist/field/features/toolbars/inline/feature.server.js +16 -0
  173. package/dist/field/features/toolbars/inline/feature.server.js.map +1 -0
  174. package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts +10 -0
  175. package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -0
  176. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarButton/index.js +16 -12
  177. package/dist/field/features/toolbars/shared/ToolbarButton/index.js.map +1 -0
  178. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarButton/index.scss +3 -1
  179. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts +23 -0
  180. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -0
  181. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarDropdown/DropDown.js +17 -67
  182. package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -0
  183. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts +23 -0
  184. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -0
  185. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js +139 -0
  186. package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -0
  187. package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarDropdown/index.scss +25 -13
  188. package/dist/field/features/toolbars/types.d.ts +48 -0
  189. package/dist/field/features/toolbars/types.d.ts.map +1 -0
  190. package/dist/field/features/toolbars/types.js.map +1 -0
  191. package/dist/field/features/types.d.ts +51 -12
  192. package/dist/field/features/types.d.ts.map +1 -1
  193. package/dist/field/features/types.js.map +1 -1
  194. package/dist/field/features/upload/feature.client.d.ts.map +1 -1
  195. package/dist/field/features/upload/feature.client.js +35 -10
  196. package/dist/field/features/upload/feature.client.js.map +1 -1
  197. package/dist/field/features/upload/populationPromise.d.ts.map +1 -1
  198. package/dist/field/features/upload/populationPromise.js +3 -1
  199. package/dist/field/features/upload/populationPromise.js.map +1 -1
  200. package/dist/field/lexical/EditorFocusProvider.d.ts +20 -0
  201. package/dist/field/lexical/EditorFocusProvider.d.ts.map +1 -0
  202. package/dist/field/lexical/EditorFocusProvider.js +78 -0
  203. package/dist/field/lexical/EditorFocusProvider.js.map +1 -0
  204. package/dist/field/lexical/LexicalEditor.d.ts.map +1 -1
  205. package/dist/field/lexical/LexicalEditor.js +20 -4
  206. package/dist/field/lexical/LexicalEditor.js.map +1 -1
  207. package/dist/field/lexical/LexicalEditor.scss +3 -19
  208. package/dist/field/lexical/LexicalProvider.d.ts.map +1 -1
  209. package/dist/field/lexical/LexicalProvider.js +3 -2
  210. package/dist/field/lexical/LexicalProvider.js.map +1 -1
  211. package/dist/field/lexical/config/client/EditorConfigProvider.d.ts +2 -3
  212. package/dist/field/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  213. package/dist/field/lexical/config/client/EditorConfigProvider.js.map +1 -1
  214. package/dist/field/lexical/config/client/sanitize.d.ts.map +1 -1
  215. package/dist/field/lexical/config/client/sanitize.js +80 -32
  216. package/dist/field/lexical/config/client/sanitize.js.map +1 -1
  217. package/dist/field/lexical/config/server/default.d.ts.map +1 -1
  218. package/dist/field/lexical/config/server/default.js +9 -7
  219. package/dist/field/lexical/config/server/default.js.map +1 -1
  220. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +9 -9
  221. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  222. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +71 -71
  223. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  224. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +4 -4
  225. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
  226. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +3 -3
  227. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  228. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +17 -25
  229. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  230. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js +1 -37
  231. package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  232. package/dist/field/lexical/plugins/SlashMenu/index.d.ts +2 -2
  233. package/dist/field/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  234. package/dist/field/lexical/plugins/SlashMenu/index.js +71 -65
  235. package/dist/field/lexical/plugins/SlashMenu/index.js.map +1 -1
  236. package/dist/field/lexical/theme/EditorTheme.scss +2 -6
  237. package/dist/field/lexical/ui/icons/Add/index.d.ts +3 -0
  238. package/dist/field/lexical/ui/icons/Add/index.d.ts.map +1 -0
  239. package/dist/field/lexical/ui/icons/Add/index.js +16 -0
  240. package/dist/field/lexical/ui/icons/Add/index.js.map +1 -0
  241. package/dist/index.d.ts +15 -11
  242. package/dist/index.d.ts.map +1 -1
  243. package/dist/index.js +16 -12
  244. package/dist/index.js.map +1 -1
  245. package/dist/populate/populate.d.ts +2 -1
  246. package/dist/populate/populate.d.ts.map +1 -1
  247. package/dist/populate/populate.js +13 -11
  248. package/dist/populate/populate.js.map +1 -1
  249. package/dist/populate/populateLexicalPopulationPromises.d.ts +1 -1
  250. package/dist/populate/populateLexicalPopulationPromises.d.ts.map +1 -1
  251. package/dist/populate/populateLexicalPopulationPromises.js +2 -1
  252. package/dist/populate/populateLexicalPopulationPromises.js.map +1 -1
  253. package/dist/populate/recurseNestedFields.d.ts +2 -1
  254. package/dist/populate/recurseNestedFields.d.ts.map +1 -1
  255. package/dist/populate/recurseNestedFields.js +2 -1
  256. package/dist/populate/recurseNestedFields.js.map +1 -1
  257. package/package.json +10 -10
  258. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.d.ts +0 -3
  259. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.d.ts.map +0 -1
  260. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.js +0 -12
  261. package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.js.map +0 -1
  262. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.d.ts +0 -3
  263. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.d.ts.map +0 -1
  264. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.js +0 -10
  265. package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.js.map +0 -1
  266. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.d.ts +0 -3
  267. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.d.ts.map +0 -1
  268. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.js +0 -12
  269. package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.js.map +0 -1
  270. package/dist/field/features/format/common/floatingSelectToolbarSection.d.ts +0 -3
  271. package/dist/field/features/format/common/floatingSelectToolbarSection.d.ts.map +0 -1
  272. package/dist/field/features/format/common/floatingSelectToolbarSection.js +0 -10
  273. package/dist/field/features/format/common/floatingSelectToolbarSection.js.map +0 -1
  274. package/dist/field/features/format/inlinecode/feature.client.d.ts.map +0 -1
  275. package/dist/field/features/format/inlinecode/feature.client.js +0 -42
  276. package/dist/field/features/format/inlinecode/feature.client.js.map +0 -1
  277. package/dist/field/features/horizontalrule/feature.client.d.ts.map +0 -1
  278. package/dist/field/features/horizontalrule/feature.client.js +0 -53
  279. package/dist/field/features/horizontalrule/feature.client.js.map +0 -1
  280. package/dist/field/features/indent/floatingSelectToolbarIndentSection.d.ts +0 -3
  281. package/dist/field/features/indent/floatingSelectToolbarIndentSection.d.ts.map +0 -1
  282. package/dist/field/features/indent/floatingSelectToolbarIndentSection.js +0 -10
  283. package/dist/field/features/indent/floatingSelectToolbarIndentSection.js.map +0 -1
  284. package/dist/field/features/indent/index.scss +0 -4
  285. package/dist/field/features/lists/orderedlist/feature.client.d.ts.map +0 -1
  286. package/dist/field/features/lists/orderedlist/feature.client.js +0 -71
  287. package/dist/field/features/lists/orderedlist/feature.client.js.map +0 -1
  288. package/dist/field/features/lists/unorderedlist/feature.client.d.ts.map +0 -1
  289. package/dist/field/features/lists/unorderedlist/feature.client.js +0 -71
  290. package/dist/field/features/lists/unorderedlist/feature.client.js.map +0 -1
  291. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.d.ts +0 -8
  292. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.d.ts.map +0 -1
  293. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.js.map +0 -1
  294. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.d.ts +0 -17
  295. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.d.ts.map +0 -1
  296. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.js.map +0 -1
  297. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.d.ts +0 -18
  298. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.d.ts.map +0 -1
  299. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.js +0 -42
  300. package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.js.map +0 -1
  301. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.d.ts +0 -6
  302. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.d.ts.map +0 -1
  303. package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js.map +0 -1
  304. package/dist/field/lexical/plugins/FloatingSelectToolbar/types.d.ts +0 -40
  305. package/dist/field/lexical/plugins/FloatingSelectToolbar/types.d.ts.map +0 -1
  306. package/dist/field/lexical/plugins/FloatingSelectToolbar/types.js.map +0 -1
  307. /package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.d.ts +0 -0
  308. /package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.js +0 -0
  309. /package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.d.ts +0 -0
  310. /package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.d.ts +0 -0
  311. /package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.js +0 -0
  312. /package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.scss +0 -0
  313. /package/dist/field/features/debug/{treeview → treeView}/feature.client.d.ts +0 -0
  314. /package/dist/field/features/debug/{treeview → treeView}/feature.client.js +0 -0
  315. /package/dist/field/features/debug/{treeview → treeView}/feature.server.d.ts +0 -0
  316. /package/dist/field/features/debug/{treeview → treeView}/plugin/index.d.ts +0 -0
  317. /package/dist/field/features/debug/{treeview → treeView}/plugin/index.js +0 -0
  318. /package/dist/field/features/debug/{treeview → treeView}/plugin/index.scss +0 -0
  319. /package/dist/field/features/format/{inlinecode → inlineCode}/feature.client.d.ts +0 -0
  320. /package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.d.ts +0 -0
  321. /package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.d.ts +0 -0
  322. /package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.js +0 -0
  323. /package/dist/field/features/{horizontalrule → horizontalRule}/component/index.d.ts +0 -0
  324. /package/dist/field/features/{horizontalrule → horizontalRule}/component/index.js +0 -0
  325. /package/dist/field/features/{horizontalrule → horizontalRule}/feature.client.d.ts +0 -0
  326. /package/dist/field/features/{horizontalrule → horizontalRule}/feature.server.d.ts +0 -0
  327. /package/dist/field/features/{horizontalrule → horizontalRule}/markdownTransformer.d.ts +0 -0
  328. /package/dist/field/features/{horizontalrule → horizontalRule}/markdownTransformer.js +0 -0
  329. /package/dist/field/features/{horizontalrule → horizontalRule}/nodes/HorizontalRuleNode.d.ts +0 -0
  330. /package/dist/field/features/{horizontalrule → horizontalRule}/nodes/HorizontalRuleNode.js +0 -0
  331. /package/dist/field/features/{horizontalrule → horizontalRule}/plugin/index.d.ts +0 -0
  332. /package/dist/field/features/{horizontalrule → horizontalRule}/plugin/index.js +0 -0
  333. /package/dist/field/features/{horizontalrule → horizontalRule}/plugin/index.scss +0 -0
  334. /package/dist/field/features/lists/{orderedlist → orderedList}/feature.client.d.ts +0 -0
  335. /package/dist/field/features/lists/{orderedlist → orderedList}/feature.server.d.ts +0 -0
  336. /package/dist/field/features/lists/{orderedlist → orderedList}/markdownTransformer.d.ts +0 -0
  337. /package/dist/field/features/lists/{common → shared}/markdown.d.ts +0 -0
  338. /package/dist/field/features/lists/{common → shared}/markdown.js +0 -0
  339. /package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.client.d.ts +0 -0
  340. /package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.server.d.ts +0 -0
  341. /package/dist/field/features/lists/{unorderedlist → unorderedList}/markdownTransformer.d.ts +0 -0
  342. /package/dist/field/{lexical/plugins/FloatingSelectToolbar → 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/FloatingSelectToolbar/ToolbarButton/index.js';
5
- export { ToolbarDropdown } from '../field/lexical/plugins/FloatingSelectToolbar/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,uEAAuE,CAAA;AACrG,OAAO,EAAE,eAAe,EAAE,MAAM,yEAAyE,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/FloatingSelectToolbar/ToolbarButton/index.js';
5
- export { ToolbarDropdown } from '../field/lexical/plugins/FloatingSelectToolbar/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/FloatingSelectToolbar/ToolbarButton/index.js'\nexport { ToolbarDropdown } from '../field/lexical/plugins/FloatingSelectToolbar/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,wEAAuE;AACrG,SAASC,eAAe,QAAQ,0EAAyE"}
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":";AA0EA,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,67 +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 { AlignDropdownSectionWithEntries } from './floatingSelectToolbarAlignDropdownSection.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,
14
- floatingSelectToolbar: {
15
- sections: [
16
- AlignDropdownSectionWithEntries([
17
- {
18
- ChildComponent: AlignLeftIcon,
19
- isActive: ()=>false,
20
- key: 'align-left',
21
- label: `Align Left`,
22
- onClick: ({ editor })=>{
23
- editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left');
24
- },
25
- order: 1
26
- }
27
- ]),
28
- AlignDropdownSectionWithEntries([
29
- {
30
- ChildComponent: AlignCenterIcon,
31
- isActive: ()=>false,
32
- key: 'align-center',
33
- label: `Align Center`,
34
- onClick: ({ editor })=>{
35
- editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center');
36
- },
37
- order: 2
38
- }
39
- ]),
40
- AlignDropdownSectionWithEntries([
41
- {
42
- ChildComponent: AlignRightIcon,
43
- isActive: ()=>false,
44
- key: 'align-right',
45
- label: `Align Right`,
46
- onClick: ({ editor })=>{
47
- editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right');
48
- },
49
- order: 3
50
- }
51
- ]),
52
- AlignDropdownSectionWithEntries([
53
- {
54
- ChildComponent: AlignJustifyIcon,
55
- isActive: ()=>false,
56
- key: 'align-justify',
57
- label: `Align Justify`,
58
- onClick: ({ editor })=>{
59
- editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify');
60
- },
61
- order: 4
62
- }
63
- ])
64
- ]
134
+ toolbarFixed: {
135
+ groups: toolbarGroups
136
+ },
137
+ toolbarInline: {
138
+ groups: toolbarGroups
65
139
  }
66
140
  })
67
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 { AlignDropdownSectionWithEntries } from './floatingSelectToolbarAlignDropdownSection.js'\n\nconst AlignFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n floatingSelectToolbar: {\n sections: [\n AlignDropdownSectionWithEntries([\n {\n ChildComponent: AlignLeftIcon,\n isActive: () => false,\n key: 'align-left',\n label: `Align Left`,\n onClick: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left')\n },\n order: 1,\n },\n ]),\n AlignDropdownSectionWithEntries([\n {\n ChildComponent: AlignCenterIcon,\n isActive: () => false,\n key: 'align-center',\n label: `Align Center`,\n onClick: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center')\n },\n order: 2,\n },\n ]),\n AlignDropdownSectionWithEntries([\n {\n ChildComponent: AlignRightIcon,\n isActive: () => false,\n key: 'align-right',\n label: `Align Right`,\n onClick: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right')\n },\n order: 3,\n },\n ]),\n AlignDropdownSectionWithEntries([\n {\n ChildComponent: AlignJustifyIcon,\n isActive: () => false,\n key: 'align-justify',\n label: `Align Justify`,\n onClick: ({ 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","AlignDropdownSectionWithEntries","AlignFeatureClient","props","clientFeatureProps","feature","floatingSelectToolbar","sections","ChildComponent","isActive","key","label","onClick","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,+BAA+B,QAAQ,iDAAgD;AAEhG,MAAMC,qBAA+D,CAACC;IACpE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,uBAAuB;oBACrBC,UAAU;wBACRN,gCAAgC;4BAC9B;gCACEO,gBAAgBV;gCAChBW,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,UAAU,CAAC;gCACnBC,SAAS,CAAC,EAAEC,MAAM,EAAE;oCAClBA,OAAOC,eAAe,CAACnB,wBAAwB;gCACjD;gCACAoB,OAAO;4BACT;yBACD;wBACDd,gCAAgC;4BAC9B;gCACEO,gBAAgBZ;gCAChBa,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,YAAY,CAAC;gCACrBC,SAAS,CAAC,EAAEC,MAAM,EAAE;oCAClBA,OAAOC,eAAe,CAACnB,wBAAwB;gCACjD;gCACAoB,OAAO;4BACT;yBACD;wBACDd,gCAAgC;4BAC9B;gCACEO,gBAAgBT;gCAChBU,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,WAAW,CAAC;gCACpBC,SAAS,CAAC,EAAEC,MAAM,EAAE;oCAClBA,OAAOC,eAAe,CAACnB,wBAAwB;gCACjD;gCACAoB,OAAO;4BACT;yBACD;wBACDd,gCAAgC;4BAC9B;gCACEO,gBAAgBX;gCAChBY,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,aAAa,CAAC;gCACtBC,SAAS,CAAC,EAAEC,MAAM,EAAE;oCAClBA,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;oB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BACT;gBACA,OAAO;YACT;YACAG,KAAK;YACLC,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"}
@@ -0,0 +1,12 @@
1
+ import { AlignLeftIcon } from '../../lexical/ui/icons/AlignLeft/index.js';
2
+ export const toolbarAlignGroupWithItems = (items)=>{
3
+ return {
4
+ type: 'dropdown',
5
+ ChildComponent: AlignLeftIcon,
6
+ items,
7
+ key: 'align',
8
+ order: 30
9
+ };
10
+ };
11
+
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":";AAgEA,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,36 +1,43 @@
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';
5
- import { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js';
4
+ import { $getSelection, $isRangeSelection } from 'lexical';
6
5
  import { BlockquoteIcon } from '../../lexical/ui/icons/Blockquote/index.js';
7
- import { TextDropdownSectionWithEntries } from '../common/floatingSelectToolbarTextDropdownSection/index.js';
8
6
  import { createClientComponent } from '../createClientComponent.js';
7
+ import { toolbarTextDropdownGroupWithItems } from '../shared/toolbar/textDropdownGroup.js';
9
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
+ ];
10
36
  const BlockQuoteFeatureClient = (props)=>{
11
37
  return {
12
38
  clientFeatureProps: props,
13
39
  feature: ()=>({
14
40
  clientFeatureProps: props,
15
- floatingSelectToolbar: {
16
- sections: [
17
- TextDropdownSectionWithEntries([
18
- {
19
- ChildComponent: BlockquoteIcon,
20
- isActive: ()=>false,
21
- key: 'blockquote',
22
- label: `Blockquote`,
23
- onClick: ({ editor })=>{
24
- editor.update(()=>{
25
- const selection = $getSelection();
26
- $setBlocksType(selection, ()=>$createQuoteNode());
27
- });
28
- },
29
- order: 20
30
- }
31
- ])
32
- ]
33
- },
34
41
  markdownTransformers: [
35
42
  MarkdownTransformer
36
43
  ],
@@ -38,26 +45,35 @@ const BlockQuoteFeatureClient = (props)=>{
38
45
  QuoteNode
39
46
  ],
40
47
  slashMenu: {
41
- options: [
48
+ groups: [
42
49
  {
43
- displayName: 'Basic',
44
- key: 'basic',
45
- options: [
46
- new SlashMenuOption(`blockquote`, {
50
+ items: [
51
+ {
47
52
  Icon: BlockquoteIcon,
48
- displayName: `Blockquote`,
53
+ key: 'blockquote',
49
54
  keywords: [
50
55
  'quote',
51
56
  'blockquote'
52
57
  ],
53
- onSelect: ()=>{
54
- const selection = $getSelection();
55
- $setBlocksType(selection, ()=>$createQuoteNode());
58
+ label: 'Blockquote',
59
+ onSelect: ({ editor })=>{
60
+ editor.update(()=>{
61
+ const selection = $getSelection();
62
+ $setBlocksType(selection, ()=>$createQuoteNode());
63
+ });
56
64
  }
57
- })
58
- ]
65
+ }
66
+ ],
67
+ key: 'basic',
68
+ label: 'Basic'
59
69
  }
60
70
  ]
71
+ },
72
+ toolbarFixed: {
73
+ groups: toolbarGroups
74
+ },
75
+ toolbarInline: {
76
+ groups: toolbarGroups
61
77
  }
62
78
  })
63
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 { SlashMenuOption } from '../../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport { BlockquoteIcon } from '../../lexical/ui/icons/Blockquote/index.js'\nimport { TextDropdownSectionWithEntries } from '../common/floatingSelectToolbarTextDropdownSection/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nconst BlockQuoteFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n floatingSelectToolbar: {\n sections: [\n TextDropdownSectionWithEntries([\n {\n ChildComponent: BlockquoteIcon,\n isActive: () => false,\n key: 'blockquote',\n label: `Blockquote`,\n onClick: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n })\n },\n order: 20,\n },\n ]),\n ],\n },\n markdownTransformers: [MarkdownTransformer],\n\n nodes: [QuoteNode],\n slashMenu: {\n options: [\n {\n displayName: 'Basic',\n key: 'basic',\n options: [\n new SlashMenuOption(`blockquote`, {\n Icon: BlockquoteIcon,\n displayName: `Blockquote`,\n keywords: ['quote', 'blockquote'],\n onSelect: () => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n },\n }),\n ],\n },\n ],\n },\n }),\n }\n}\n\nexport const BlockQuoteFeatureClientComponent = createClientComponent(BlockQuoteFeatureClient)\n"],"names":["$createQuoteNode","QuoteNode","$setBlocksType","$getSelection","SlashMenuOption","BlockquoteIcon","TextDropdownSectionWithEntries","createClientComponent","MarkdownTransformer","BlockQuoteFeatureClient","props","clientFeatureProps","feature","floatingSelectToolbar","sections","ChildComponent","isActive","key","label","onClick","editor","update","selection","order","markdownTransformers","nodes","slashMenu","options","displayName","Icon","keywords","onSelect","BlockQuoteFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,gBAAgB,EAAEC,SAAS,QAAQ,qBAAoB;AAChE,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,aAAa,QAAQ,UAAS;AAIvC,SAASC,eAAe,QAAQ,sEAAqE;AACrG,SAASC,cAAc,QAAQ,6CAA4C;AAC3E,SAASC,8BAA8B,QAAQ,8DAA6D;AAC5G,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,MAAMC,0BAAoE,CAACC;IACzE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,uBAAuB;oBACrBC,UAAU;wBACRR,+BAA+B;4BAC7B;gCACES,gBAAgBV;gCAChBW,UAAU,IAAM;gCAChBC,KAAK;gCACLC,OAAO,CAAC,UAAU,CAAC;gCACnBC,SAAS,CAAC,EAAEC,MAAM,EAAE;oCAClBA,OAAOC,MAAM,CAAC;wCACZ,MAAMC,YAAYnB;wCAClBD,eAAeoB,WAAW,IAAMtB;oCAClC;gCACF;gCACAuB,OAAO;4BACT;yBACD;qBACF;gBACH;gBACAC,sBAAsB;oBAAChB;iBAAoB;gBAE3CiB,OAAO;oBAACxB;iBAAU;gBAClByB,WAAW;oBACTC,SAAS;wBACP;4BACEC,aAAa;4BACbX,KAAK;4BACLU,SAAS;gCACP,IAAIvB,gBAAgB,CAAC,UAAU,CAAC,EAAE;oCAChCyB,MAAMxB;oCACNuB,aAAa,CAAC,UAAU,CAAC;oCACzBE,UAAU;wCAAC;wCAAS;qCAAa;oCACjCC,UAAU;wCACR,MAAMT,YAAYnB;wCAClBD,eAAeoB,WAAW,IAAMtB;oCAClC;gCACF;6BACD;wBACH;qBACD;gBACH;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMgC,mCAAmCzB,sBAAsBE,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"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AC,EAAEC,MAAM,EAAE;wCACnBA,OAAOC,MAAM,CAAC;4CACZ,MAAMR,YAAYT;4CAClBD,eAAeU,WAAW,IAAMb;wCAClC;oCACF;gCACF;6BACD;4BACDiB,KAAK;4BACLC,OAAO;wBACT;qBACD;gBACH;gBACAgB,cAAc;oBACZJ,QAAQpB;gBACV;gBACAyB,eAAe;oBACbL,QAAQpB;gBACV;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAM0B,mCAAmC7B,sBAAsBgB,yBAAwB"}
@@ -1 +1 @@
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,SAAS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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;;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;AAC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,SAASC,IAAI,CAAC;IAE9F,oBAAoB;IACpB,MAAMC,cAAczE,QAAQ;QAC1B,OAAOsC,gBAAgBN,iBAAiB,sBACtC,oBAACpC;YACC8E,cAAc;gBAACT;aAAS;YACxB,kCAAkC;YAClCN,QAAQb;YACRd,cAAcA;YACdiC,UAAU;gBAACA;aAAS;YACpBxC,WAAWA;YACXV,MAAMA;yBAEN,oBAACE;YACCf,WAAWA;YACX4B,OAAOC;YACPT,UAAUA;YACVqD,YAAYC,MAAMC,OAAO,CAAC/B,YAAYA,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;AAa9E,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,YAAY,EAAE,CAAA;CAC9B,CAAA;AAgDD,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"}