@wordpress/block-editor 12.13.0 → 12.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (344) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-heading-level-dropdown/index.js +1 -1
  3. package/build/components/block-heading-level-dropdown/index.js.map +1 -1
  4. package/build/components/block-list/index.js +2 -9
  5. package/build/components/block-list/index.js.map +1 -1
  6. package/build/components/block-list-appender/index.js +16 -3
  7. package/build/components/block-list-appender/index.js.map +1 -1
  8. package/build/components/block-quick-navigation/index.js +6 -4
  9. package/build/components/block-quick-navigation/index.js.map +1 -1
  10. package/build/components/block-styles/index.js +0 -8
  11. package/build/components/block-styles/index.js.map +1 -1
  12. package/build/components/block-switcher/pattern-transformations-menu.js +18 -14
  13. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  14. package/build/components/block-tools/back-compat.js +2 -2
  15. package/build/components/block-tools/back-compat.js.map +1 -1
  16. package/build/components/block-tools/block-contextual-toolbar.js +11 -81
  17. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  18. package/build/components/block-tools/empty-block-inserter.js +56 -0
  19. package/build/components/block-tools/empty-block-inserter.js.map +1 -0
  20. package/build/components/block-tools/index.js +48 -9
  21. package/build/components/block-tools/index.js.map +1 -1
  22. package/build/components/block-tools/selected-block-tools.js +113 -0
  23. package/build/components/block-tools/selected-block-tools.js.map +1 -0
  24. package/build/components/block-tools/use-selected-block-tool-props.js +56 -0
  25. package/build/components/block-tools/use-selected-block-tool-props.js.map +1 -0
  26. package/build/components/editable-text/index.js +1 -2
  27. package/build/components/editable-text/index.js.map +1 -1
  28. package/build/components/iframe/index.js +4 -3
  29. package/build/components/iframe/index.js.map +1 -1
  30. package/build/components/inserter/block-patterns-explorer/{explorer.js → index.js} +7 -7
  31. package/build/components/inserter/block-patterns-explorer/index.js.map +1 -0
  32. package/build/components/inserter/block-patterns-explorer/{sidebar.js → pattern-explorer-sidebar.js} +1 -1
  33. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -0
  34. package/build/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js} +4 -4
  35. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -0
  36. package/build/components/inserter/block-patterns-tab/index.js +75 -0
  37. package/build/components/inserter/block-patterns-tab/index.js.map +1 -0
  38. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +48 -0
  39. package/build/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -0
  40. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +108 -0
  41. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -0
  42. package/build/components/inserter/{block-patterns-filter.js → block-patterns-tab/patterns-filter.js} +18 -34
  43. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -0
  44. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +55 -0
  45. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -0
  46. package/build/components/inserter/block-patterns-tab/utils.js +70 -0
  47. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -0
  48. package/build/components/inserter/media-tab/media-list.js +9 -5
  49. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  50. package/build/components/inserter/media-tab/media-preview.js +15 -12
  51. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  52. package/build/components/inserter/menu.js +3 -4
  53. package/build/components/inserter/menu.js.map +1 -1
  54. package/build/components/link-control/index.js +6 -5
  55. package/build/components/link-control/index.js.map +1 -1
  56. package/build/components/list-view/block-select-button.js +39 -0
  57. package/build/components/list-view/block-select-button.js.map +1 -1
  58. package/build/components/list-view/block.js +16 -3
  59. package/build/components/list-view/block.js.map +1 -1
  60. package/build/components/list-view/index.js +3 -2
  61. package/build/components/list-view/index.js.map +1 -1
  62. package/build/components/navigable-toolbar/index.js +69 -18
  63. package/build/components/navigable-toolbar/index.js.map +1 -1
  64. package/build/components/provider/use-block-sync.js +1 -14
  65. package/build/components/provider/use-block-sync.js.map +1 -1
  66. package/build/components/rich-text/index.js +0 -1
  67. package/build/components/rich-text/index.js.map +1 -1
  68. package/build/components/rich-text/index.native.js +3 -1
  69. package/build/components/rich-text/index.native.js.map +1 -1
  70. package/build/components/rich-text/native/format-edit.js +45 -0
  71. package/build/components/rich-text/native/format-edit.js.map +1 -0
  72. package/build/components/rich-text/native/get-format-colors.native.js +41 -0
  73. package/build/components/rich-text/native/get-format-colors.native.js.map +1 -0
  74. package/build/components/rich-text/native/index.js +9 -0
  75. package/build/components/rich-text/native/index.js.map +1 -0
  76. package/build/components/rich-text/native/index.native.js +1158 -0
  77. package/build/components/rich-text/native/index.native.js.map +1 -0
  78. package/build/components/rich-text/native/toolbar-button-with-options.native.js +58 -0
  79. package/build/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -0
  80. package/build/components/rich-text/native/use-format-types.js +111 -0
  81. package/build/components/rich-text/native/use-format-types.js.map +1 -0
  82. package/build/components/rich-text/use-paste-handler.js +2 -5
  83. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  84. package/build/components/url-popover/image-url-input-ui.js +2 -1
  85. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  86. package/build/components/writing-flow/use-tab-nav.js +7 -3
  87. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  88. package/build/hooks/align.js +10 -10
  89. package/build/hooks/align.js.map +1 -1
  90. package/build/hooks/align.native.js +2 -2
  91. package/build/hooks/align.native.js.map +1 -1
  92. package/build/hooks/anchor.js +7 -6
  93. package/build/hooks/anchor.js.map +1 -1
  94. package/build/hooks/background.js +16 -4
  95. package/build/hooks/background.js.map +1 -1
  96. package/build/hooks/block-hooks.js +7 -8
  97. package/build/hooks/block-hooks.js.map +1 -1
  98. package/build/hooks/block-rename-ui.js +7 -5
  99. package/build/hooks/block-rename-ui.js.map +1 -1
  100. package/build/hooks/content-lock-ui.js +5 -5
  101. package/build/hooks/content-lock-ui.js.map +1 -1
  102. package/build/hooks/custom-class-name.js +8 -7
  103. package/build/hooks/custom-class-name.js.map +1 -1
  104. package/build/hooks/custom-fields.js +4 -4
  105. package/build/hooks/custom-fields.js.map +1 -1
  106. package/build/hooks/duotone.js +9 -20
  107. package/build/hooks/duotone.js.map +1 -1
  108. package/build/hooks/layout.js +90 -86
  109. package/build/hooks/layout.js.map +1 -1
  110. package/build/hooks/position.js +10 -9
  111. package/build/hooks/position.js.map +1 -1
  112. package/build/hooks/style.js +10 -13
  113. package/build/hooks/style.js.map +1 -1
  114. package/build/hooks/utils.js +30 -0
  115. package/build/hooks/utils.js.map +1 -1
  116. package/build/private-apis.js +3 -0
  117. package/build/private-apis.js.map +1 -1
  118. package/build/store/actions.js +30 -37
  119. package/build/store/actions.js.map +1 -1
  120. package/build/store/reducer.js +18 -0
  121. package/build/store/reducer.js.map +1 -1
  122. package/build/store/selectors.js +16 -13
  123. package/build/store/selectors.js.map +1 -1
  124. package/build-module/components/block-heading-level-dropdown/index.js +1 -1
  125. package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
  126. package/build-module/components/block-list/index.js +3 -10
  127. package/build-module/components/block-list/index.js.map +1 -1
  128. package/build-module/components/block-list-appender/index.js +16 -3
  129. package/build-module/components/block-list-appender/index.js.map +1 -1
  130. package/build-module/components/block-quick-navigation/index.js +7 -5
  131. package/build-module/components/block-quick-navigation/index.js.map +1 -1
  132. package/build-module/components/block-styles/index.js +0 -8
  133. package/build-module/components/block-styles/index.js.map +1 -1
  134. package/build-module/components/block-switcher/pattern-transformations-menu.js +17 -13
  135. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  136. package/build-module/components/block-tools/back-compat.js +1 -1
  137. package/build-module/components/block-tools/back-compat.js.map +1 -1
  138. package/build-module/components/block-tools/block-contextual-toolbar.js +11 -80
  139. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  140. package/build-module/components/block-tools/empty-block-inserter.js +48 -0
  141. package/build-module/components/block-tools/empty-block-inserter.js.map +1 -0
  142. package/build-module/components/block-tools/index.js +48 -9
  143. package/build-module/components/block-tools/index.js.map +1 -1
  144. package/build-module/components/block-tools/selected-block-tools.js +105 -0
  145. package/build-module/components/block-tools/selected-block-tools.js.map +1 -0
  146. package/build-module/components/block-tools/use-selected-block-tool-props.js +50 -0
  147. package/build-module/components/block-tools/use-selected-block-tool-props.js.map +1 -0
  148. package/build-module/components/editable-text/index.js +1 -2
  149. package/build-module/components/editable-text/index.js.map +1 -1
  150. package/build-module/components/iframe/index.js +4 -3
  151. package/build-module/components/iframe/index.js.map +1 -1
  152. package/build-module/components/inserter/block-patterns-explorer/{explorer.js → index.js} +5 -5
  153. package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -0
  154. package/build-module/components/inserter/block-patterns-explorer/{sidebar.js → pattern-explorer-sidebar.js} +1 -1
  155. package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -0
  156. package/build-module/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js} +2 -2
  157. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -0
  158. package/build-module/components/inserter/block-patterns-tab/index.js +66 -0
  159. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -0
  160. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +42 -0
  161. package/build-module/components/inserter/block-patterns-tab/pattern-category-preview-panel.js.map +1 -0
  162. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +100 -0
  163. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -0
  164. package/build-module/components/inserter/{block-patterns-filter.js → block-patterns-tab/patterns-filter.js} +7 -20
  165. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -0
  166. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +47 -0
  167. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -0
  168. package/build-module/components/inserter/block-patterns-tab/utils.js +58 -0
  169. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -0
  170. package/build-module/components/inserter/media-tab/media-list.js +9 -5
  171. package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
  172. package/build-module/components/inserter/media-tab/media-preview.js +15 -12
  173. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  174. package/build-module/components/inserter/menu.js +4 -3
  175. package/build-module/components/inserter/menu.js.map +1 -1
  176. package/build-module/components/link-control/index.js +7 -6
  177. package/build-module/components/link-control/index.js.map +1 -1
  178. package/build-module/components/list-view/block-select-button.js +39 -0
  179. package/build-module/components/list-view/block-select-button.js.map +1 -1
  180. package/build-module/components/list-view/block.js +16 -3
  181. package/build-module/components/list-view/block.js.map +1 -1
  182. package/build-module/components/list-view/index.js +3 -2
  183. package/build-module/components/list-view/index.js.map +1 -1
  184. package/build-module/components/navigable-toolbar/index.js +69 -17
  185. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  186. package/build-module/components/provider/use-block-sync.js +1 -14
  187. package/build-module/components/provider/use-block-sync.js.map +1 -1
  188. package/build-module/components/rich-text/index.js +0 -1
  189. package/build-module/components/rich-text/index.js.map +1 -1
  190. package/build-module/components/rich-text/index.native.js +3 -1
  191. package/build-module/components/rich-text/index.native.js.map +1 -1
  192. package/build-module/components/rich-text/native/format-edit.js +38 -0
  193. package/build-module/components/rich-text/native/format-edit.js.map +1 -0
  194. package/build-module/components/rich-text/native/get-format-colors.native.js +34 -0
  195. package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -0
  196. package/build-module/components/rich-text/native/index.js +2 -0
  197. package/build-module/components/rich-text/native/index.js.map +1 -0
  198. package/build-module/components/rich-text/native/index.native.js +1148 -0
  199. package/build-module/components/rich-text/native/index.native.js.map +1 -0
  200. package/build-module/components/rich-text/native/toolbar-button-with-options.native.js +51 -0
  201. package/build-module/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -0
  202. package/build-module/components/rich-text/native/use-format-types.js +104 -0
  203. package/build-module/components/rich-text/native/use-format-types.js.map +1 -0
  204. package/build-module/components/rich-text/use-paste-handler.js +2 -5
  205. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  206. package/build-module/components/url-popover/image-url-input-ui.js +2 -1
  207. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  208. package/build-module/components/writing-flow/use-tab-nav.js +7 -3
  209. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  210. package/build-module/hooks/align.js +8 -8
  211. package/build-module/hooks/align.js.map +1 -1
  212. package/build-module/hooks/align.native.js +2 -2
  213. package/build-module/hooks/align.native.js.map +1 -1
  214. package/build-module/hooks/anchor.js +5 -4
  215. package/build-module/hooks/anchor.js.map +1 -1
  216. package/build-module/hooks/background.js +17 -5
  217. package/build-module/hooks/background.js.map +1 -1
  218. package/build-module/hooks/block-hooks.js +5 -6
  219. package/build-module/hooks/block-hooks.js.map +1 -1
  220. package/build-module/hooks/block-rename-ui.js +5 -3
  221. package/build-module/hooks/block-rename-ui.js.map +1 -1
  222. package/build-module/hooks/content-lock-ui.js +3 -3
  223. package/build-module/hooks/content-lock-ui.js.map +1 -1
  224. package/build-module/hooks/custom-class-name.js +6 -5
  225. package/build-module/hooks/custom-class-name.js.map +1 -1
  226. package/build-module/hooks/custom-fields.js +4 -4
  227. package/build-module/hooks/custom-fields.js.map +1 -1
  228. package/build-module/hooks/duotone.js +10 -21
  229. package/build-module/hooks/duotone.js.map +1 -1
  230. package/build-module/hooks/layout.js +90 -86
  231. package/build-module/hooks/layout.js.map +1 -1
  232. package/build-module/hooks/position.js +11 -10
  233. package/build-module/hooks/position.js.map +1 -1
  234. package/build-module/hooks/style.js +10 -13
  235. package/build-module/hooks/style.js.map +1 -1
  236. package/build-module/hooks/utils.js +30 -1
  237. package/build-module/hooks/utils.js.map +1 -1
  238. package/build-module/private-apis.js +4 -1
  239. package/build-module/private-apis.js.map +1 -1
  240. package/build-module/store/actions.js +29 -37
  241. package/build-module/store/actions.js.map +1 -1
  242. package/build-module/store/reducer.js +17 -0
  243. package/build-module/store/reducer.js.map +1 -1
  244. package/build-module/store/selectors.js +15 -13
  245. package/build-module/store/selectors.js.map +1 -1
  246. package/build-style/style-rtl.css +16 -15
  247. package/build-style/style.css +16 -15
  248. package/package.json +31 -31
  249. package/src/components/block-heading-level-dropdown/index.js +1 -1
  250. package/src/components/block-list/index.js +4 -18
  251. package/src/components/block-list-appender/index.js +20 -4
  252. package/src/components/block-quick-navigation/index.js +11 -5
  253. package/src/components/block-styles/index.js +0 -10
  254. package/src/components/block-switcher/pattern-transformations-menu.js +20 -14
  255. package/src/components/block-toolbar/style.scss +8 -0
  256. package/src/components/block-tools/back-compat.js +1 -1
  257. package/src/components/block-tools/block-contextual-toolbar.js +11 -134
  258. package/src/components/block-tools/empty-block-inserter.js +56 -0
  259. package/src/components/block-tools/index.js +72 -16
  260. package/src/components/block-tools/selected-block-tools.js +127 -0
  261. package/src/components/block-tools/style.scss +0 -10
  262. package/src/components/block-tools/use-selected-block-tool-props.js +66 -0
  263. package/src/components/editable-text/index.js +1 -8
  264. package/src/components/iframe/index.js +4 -3
  265. package/src/components/inserter/block-patterns-explorer/{explorer.js → index.js} +4 -4
  266. package/src/components/inserter/block-patterns-explorer/{patterns-list.js → pattern-list.js} +4 -1
  267. package/src/components/inserter/block-patterns-tab/index.js +118 -0
  268. package/src/components/inserter/block-patterns-tab/pattern-category-preview-panel.js +48 -0
  269. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +175 -0
  270. package/src/components/inserter/{block-patterns-filter.js → block-patterns-tab/patterns-filter.js} +15 -21
  271. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +96 -0
  272. package/src/components/inserter/block-patterns-tab/utils.js +76 -0
  273. package/src/components/inserter/media-tab/media-list.js +7 -7
  274. package/src/components/inserter/media-tab/media-preview.js +27 -22
  275. package/src/components/inserter/menu.js +4 -5
  276. package/src/components/link-control/README.md +2 -2
  277. package/src/components/link-control/index.js +15 -6
  278. package/src/components/link-control/style.scss +8 -5
  279. package/src/components/list-view/block-select-button.js +44 -1
  280. package/src/components/list-view/block.js +11 -11
  281. package/src/components/list-view/index.js +2 -0
  282. package/src/components/media-replace-flow/style.scss +2 -2
  283. package/src/components/navigable-toolbar/index.js +71 -25
  284. package/src/components/plain-text/README.md +3 -3
  285. package/src/components/provider/use-block-sync.js +2 -21
  286. package/src/components/rich-text/README.md +9 -8
  287. package/src/components/rich-text/index.js +0 -1
  288. package/src/components/rich-text/index.native.js +3 -1
  289. package/src/components/rich-text/native/format-edit.js +44 -0
  290. package/src/components/rich-text/native/get-format-colors.native.js +54 -0
  291. package/src/components/rich-text/native/index.js +1 -0
  292. package/src/components/rich-text/native/index.native.js +1363 -0
  293. package/src/components/rich-text/native/style.native.scss +28 -0
  294. package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +79 -0
  295. package/src/components/rich-text/native/test/index.native.js +278 -0
  296. package/src/components/rich-text/native/test/performance/rich-text.native.js +44 -0
  297. package/src/components/rich-text/native/toolbar-button-with-options.native.js +61 -0
  298. package/src/components/rich-text/native/use-format-types.js +146 -0
  299. package/src/components/rich-text/use-paste-handler.js +1 -6
  300. package/src/components/url-popover/image-url-input-ui.js +1 -0
  301. package/src/components/writing-flow/use-tab-nav.js +8 -3
  302. package/src/hooks/align.js +8 -8
  303. package/src/hooks/align.native.js +2 -2
  304. package/src/hooks/anchor.js +21 -23
  305. package/src/hooks/background.js +28 -6
  306. package/src/hooks/block-hooks.js +20 -16
  307. package/src/hooks/block-rename-ui.js +6 -4
  308. package/src/hooks/content-lock-ui.js +3 -3
  309. package/src/hooks/custom-class-name.js +7 -6
  310. package/src/hooks/custom-fields.js +5 -5
  311. package/src/hooks/duotone.js +23 -33
  312. package/src/hooks/layout.js +114 -105
  313. package/src/hooks/position.js +8 -21
  314. package/src/hooks/style.js +17 -31
  315. package/src/hooks/test/align.js +4 -4
  316. package/src/hooks/utils.js +33 -1
  317. package/src/private-apis.js +4 -1
  318. package/src/store/actions.js +26 -72
  319. package/src/store/reducer.js +19 -0
  320. package/src/store/selectors.js +13 -19
  321. package/build/components/block-tools/selected-block-popover.js +0 -221
  322. package/build/components/block-tools/selected-block-popover.js.map +0 -1
  323. package/build/components/inserter/block-patterns-explorer/explorer.js.map +0 -1
  324. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +0 -1
  325. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +0 -1
  326. package/build/components/inserter/block-patterns-filter.js.map +0 -1
  327. package/build/components/inserter/block-patterns-tab.js +0 -270
  328. package/build/components/inserter/block-patterns-tab.js.map +0 -1
  329. package/build/store/utils.js +0 -22
  330. package/build/store/utils.js.map +0 -1
  331. package/build-module/components/block-tools/selected-block-popover.js +0 -213
  332. package/build-module/components/block-tools/selected-block-popover.js.map +0 -1
  333. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +0 -1
  334. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +0 -1
  335. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +0 -1
  336. package/build-module/components/inserter/block-patterns-filter.js.map +0 -1
  337. package/build-module/components/inserter/block-patterns-tab.js +0 -254
  338. package/build-module/components/inserter/block-patterns-tab.js.map +0 -1
  339. package/build-module/store/utils.js +0 -16
  340. package/build-module/store/utils.js.map +0 -1
  341. package/src/components/block-tools/selected-block-popover.js +0 -265
  342. package/src/components/inserter/block-patterns-tab.js +0 -448
  343. package/src/store/utils.js +0 -12
  344. /package/src/components/inserter/block-patterns-explorer/{sidebar.js → pattern-explorer-sidebar.js} +0 -0
@@ -53,7 +53,7 @@ export default function HeadingLevelDropdown({
53
53
  level: targetLevel,
54
54
  isPressed: isActive
55
55
  }),
56
- label: targetLevel === 0 ? __('Paragraph') : sprintf(
56
+ title: targetLevel === 0 ? __('Paragraph') : sprintf(
57
57
  // translators: %s: heading level e.g: "1", "2", "3"
58
58
  __('Heading %d'), targetLevel),
59
59
  isActive,
@@ -1 +1 @@
1
- {"version":3,"names":["ToolbarDropdownMenu","__","sprintf","HeadingLevelIcon","HEADING_LEVELS","POPOVER_PROPS","className","HeadingLevelDropdown","options","value","onChange","createElement","popoverProps","icon","level","label","controls","map","targetLevel","isActive","isPressed","onClick","role"],"sources":["@wordpress/block-editor/src/components/block-heading-level-dropdown/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarDropdownMenu } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport HeadingLevelIcon from './heading-level-icon';\n\nconst HEADING_LEVELS = [ 1, 2, 3, 4, 5, 6 ];\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-library-heading-level-dropdown',\n};\n\n/** @typedef {import('react').ComponentType} ComponentType */\n\n/**\n * HeadingLevelDropdown props.\n *\n * @typedef WPHeadingLevelDropdownProps\n *\n * @property {number} value The chosen heading level.\n * @property {number[]} options An array of supported heading levels.\n * @property {(newValue:number)=>any} onChange Callback to run when\n * toolbar value is changed.\n */\n\n/**\n * Dropdown for selecting a heading level (1 through 6) or paragraph (0).\n *\n * @param {WPHeadingLevelDropdownProps} props Component props.\n *\n * @return {ComponentType} The toolbar.\n */\nexport default function HeadingLevelDropdown( {\n\toptions = HEADING_LEVELS,\n\tvalue,\n\tonChange,\n} ) {\n\treturn (\n\t\t<ToolbarDropdownMenu\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\ticon={ <HeadingLevelIcon level={ value } /> }\n\t\t\tlabel={ __( 'Change level' ) }\n\t\t\tcontrols={ options.map( ( targetLevel ) => {\n\t\t\t\t{\n\t\t\t\t\tconst isActive = targetLevel === value;\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\ticon: (\n\t\t\t\t\t\t\t<HeadingLevelIcon\n\t\t\t\t\t\t\t\tlevel={ targetLevel }\n\t\t\t\t\t\t\t\tisPressed={ isActive }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t),\n\t\t\t\t\t\tlabel:\n\t\t\t\t\t\t\ttargetLevel === 0\n\t\t\t\t\t\t\t\t? __( 'Paragraph' )\n\t\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: heading level e.g: \"1\", \"2\", \"3\"\n\t\t\t\t\t\t\t\t\t\t__( 'Heading %d' ),\n\t\t\t\t\t\t\t\t\t\ttargetLevel\n\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\tisActive,\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\tonChange( targetLevel );\n\t\t\t\t\t\t},\n\t\t\t\t\t\trole: 'menuitemradio',\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} ) }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,sBAAsB;AAEnD,MAAMC,cAAc,GAAG,CAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAE;AAE3C,MAAMC,aAAa,GAAG;EACrBC,SAAS,EAAE;AACZ,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAAE;EAC7CC,OAAO,GAAGJ,cAAc;EACxBK,KAAK;EACLC;AACD,CAAC,EAAG;EACH,OACCC,aAAA,CAACX,mBAAmB;IACnBY,YAAY,EAAGP,aAAe;IAC9BQ,IAAI,EAAGF,aAAA,CAACR,gBAAgB;MAACW,KAAK,EAAGL;IAAO,CAAE,CAAG;IAC7CM,KAAK,EAAGd,EAAE,CAAE,cAAe,CAAG;IAC9Be,QAAQ,EAAGR,OAAO,CAACS,GAAG,CAAIC,WAAW,IAAM;MAC1C;QACC,MAAMC,QAAQ,GAAGD,WAAW,KAAKT,KAAK;QAEtC,OAAO;UACNI,IAAI,EACHF,aAAA,CAACR,gBAAgB;YAChBW,KAAK,EAAGI,WAAa;YACrBE,SAAS,EAAGD;UAAU,CACtB,CACD;UACDJ,KAAK,EACJG,WAAW,KAAK,CAAC,GACdjB,EAAE,CAAE,WAAY,CAAC,GACjBC,OAAO;UACP;UACAD,EAAE,CAAE,YAAa,CAAC,EAClBiB,WACA,CAAC;UACLC,QAAQ;UACRE,OAAOA,CAAA,EAAG;YACTX,QAAQ,CAAEQ,WAAY,CAAC;UACxB,CAAC;UACDI,IAAI,EAAE;QACP,CAAC;MACF;IACD,CAAE;EAAG,CACL,CAAC;AAEJ"}
1
+ {"version":3,"names":["ToolbarDropdownMenu","__","sprintf","HeadingLevelIcon","HEADING_LEVELS","POPOVER_PROPS","className","HeadingLevelDropdown","options","value","onChange","createElement","popoverProps","icon","level","label","controls","map","targetLevel","isActive","isPressed","title","onClick","role"],"sources":["@wordpress/block-editor/src/components/block-heading-level-dropdown/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarDropdownMenu } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport HeadingLevelIcon from './heading-level-icon';\n\nconst HEADING_LEVELS = [ 1, 2, 3, 4, 5, 6 ];\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-library-heading-level-dropdown',\n};\n\n/** @typedef {import('react').ComponentType} ComponentType */\n\n/**\n * HeadingLevelDropdown props.\n *\n * @typedef WPHeadingLevelDropdownProps\n *\n * @property {number} value The chosen heading level.\n * @property {number[]} options An array of supported heading levels.\n * @property {(newValue:number)=>any} onChange Callback to run when\n * toolbar value is changed.\n */\n\n/**\n * Dropdown for selecting a heading level (1 through 6) or paragraph (0).\n *\n * @param {WPHeadingLevelDropdownProps} props Component props.\n *\n * @return {ComponentType} The toolbar.\n */\nexport default function HeadingLevelDropdown( {\n\toptions = HEADING_LEVELS,\n\tvalue,\n\tonChange,\n} ) {\n\treturn (\n\t\t<ToolbarDropdownMenu\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\ticon={ <HeadingLevelIcon level={ value } /> }\n\t\t\tlabel={ __( 'Change level' ) }\n\t\t\tcontrols={ options.map( ( targetLevel ) => {\n\t\t\t\t{\n\t\t\t\t\tconst isActive = targetLevel === value;\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\ticon: (\n\t\t\t\t\t\t\t<HeadingLevelIcon\n\t\t\t\t\t\t\t\tlevel={ targetLevel }\n\t\t\t\t\t\t\t\tisPressed={ isActive }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t),\n\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\ttargetLevel === 0\n\t\t\t\t\t\t\t\t? __( 'Paragraph' )\n\t\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: heading level e.g: \"1\", \"2\", \"3\"\n\t\t\t\t\t\t\t\t\t\t__( 'Heading %d' ),\n\t\t\t\t\t\t\t\t\t\ttargetLevel\n\t\t\t\t\t\t\t\t ),\n\t\t\t\t\t\tisActive,\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\tonChange( targetLevel );\n\t\t\t\t\t\t},\n\t\t\t\t\t\trole: 'menuitemradio',\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} ) }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;;AAE7C;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,sBAAsB;AAEnD,MAAMC,cAAc,GAAG,CAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAE;AAE3C,MAAMC,aAAa,GAAG;EACrBC,SAAS,EAAE;AACZ,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAAE;EAC7CC,OAAO,GAAGJ,cAAc;EACxBK,KAAK;EACLC;AACD,CAAC,EAAG;EACH,OACCC,aAAA,CAACX,mBAAmB;IACnBY,YAAY,EAAGP,aAAe;IAC9BQ,IAAI,EAAGF,aAAA,CAACR,gBAAgB;MAACW,KAAK,EAAGL;IAAO,CAAE,CAAG;IAC7CM,KAAK,EAAGd,EAAE,CAAE,cAAe,CAAG;IAC9Be,QAAQ,EAAGR,OAAO,CAACS,GAAG,CAAIC,WAAW,IAAM;MAC1C;QACC,MAAMC,QAAQ,GAAGD,WAAW,KAAKT,KAAK;QAEtC,OAAO;UACNI,IAAI,EACHF,aAAA,CAACR,gBAAgB;YAChBW,KAAK,EAAGI,WAAa;YACrBE,SAAS,EAAGD;UAAU,CACtB,CACD;UACDE,KAAK,EACJH,WAAW,KAAK,CAAC,GACdjB,EAAE,CAAE,WAAY,CAAC,GACjBC,OAAO;UACP;UACAD,EAAE,CAAE,YAAa,CAAC,EAClBiB,WACA,CAAC;UACLC,QAAQ;UACRG,OAAOA,CAAA,EAAG;YACTZ,QAAQ,CAAEQ,WAAY,CAAC;UACxB,CAAC;UACDK,IAAI,EAAE;QACP,CAAC;MACF;IACD,CAAE;EAAG,CACL,CAAC;AAEJ"}
@@ -9,7 +9,7 @@ import classnames from 'classnames';
9
9
  */
10
10
  import { AsyncModeProvider, useSelect, useDispatch, useRegistry } from '@wordpress/data';
11
11
  import { useViewportMatch, useMergeRefs, useDebounce } from '@wordpress/compose';
12
- import { createContext, useState, useMemo, useCallback } from '@wordpress/element';
12
+ import { createContext, useMemo, useCallback } from '@wordpress/element';
13
13
 
14
14
  /**
15
15
  * Internal dependencies
@@ -23,14 +23,12 @@ import { useBlockSelectionClearer } from '../block-selection-clearer';
23
23
  import { useInnerBlocksProps } from '../inner-blocks';
24
24
  import { BlockEditContextProvider, DEFAULT_BLOCK_EDIT_CONTEXT } from '../block-edit/context';
25
25
  import { useTypingObserver } from '../observe-typing';
26
- const elementContext = createContext();
27
26
  export const IntersectionObserver = createContext();
28
27
  const pendingBlockVisibilityUpdatesPerRegistry = new WeakMap();
29
28
  function Root({
30
29
  className,
31
30
  ...settings
32
31
  }) {
33
- const [element, setElement] = useState();
34
32
  const isLargeViewport = useViewportMatch('medium');
35
33
  const {
36
34
  isOutlineMode,
@@ -90,15 +88,11 @@ function Root({
90
88
  'is-navigate-mode': editorMode === 'navigation'
91
89
  })
92
90
  }, settings);
93
- return createElement(elementContext.Provider, {
94
- value: element
95
- }, createElement(IntersectionObserver.Provider, {
91
+ return createElement(IntersectionObserver.Provider, {
96
92
  value: intersectionObserver
97
93
  }, createElement("div", {
98
94
  ...innerBlocksProps
99
- }), createElement("div", {
100
- ref: setElement
101
- })));
95
+ }));
102
96
  }
103
97
  export default function BlockList(settings) {
104
98
  return createElement(BlockEditContextProvider, {
@@ -107,7 +101,6 @@ export default function BlockList(settings) {
107
101
  ...settings
108
102
  }));
109
103
  }
110
- BlockList.__unstableElementContext = elementContext;
111
104
  function Items({
112
105
  placeholder,
113
106
  rootClientId,
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","AsyncModeProvider","useSelect","useDispatch","useRegistry","useViewportMatch","useMergeRefs","useDebounce","createContext","useState","useMemo","useCallback","BlockListBlock","BlockListAppender","useInBetweenInserter","store","blockEditorStore","LayoutProvider","defaultLayout","useBlockSelectionClearer","useInnerBlocksProps","BlockEditContextProvider","DEFAULT_BLOCK_EDIT_CONTEXT","useTypingObserver","elementContext","IntersectionObserver","pendingBlockVisibilityUpdatesPerRegistry","WeakMap","Root","className","settings","element","setElement","isLargeViewport","isOutlineMode","isFocusMode","editorMode","select","getSettings","__unstableGetEditorMode","outlineMode","focusMode","registry","setBlockVisibility","delayedBlockVisibilityUpdates","updates","get","forEach","id","isIntersecting","trailing","intersectionObserver","Observer","window","entries","set","entry","clientId","target","getAttribute","push","innerBlocksProps","ref","createElement","Provider","value","BlockList","__unstableElementContext","Items","placeholder","rootClientId","renderAppender","__experimentalAppenderTagName","layout","order","selectedBlocks","visibleBlocks","getBlockOrder","getSelectedBlockClientIds","__unstableGetVisibleBlocks","map","key","has","includes","length","tagName","BlockListItems","props"],"sources":["@wordpress/block-editor/src/components/block-list/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAsyncModeProvider,\n\tuseSelect,\n\tuseDispatch,\n\tuseRegistry,\n} from '@wordpress/data';\nimport {\n\tuseViewportMatch,\n\tuseMergeRefs,\n\tuseDebounce,\n} from '@wordpress/compose';\nimport {\n\tcreateContext,\n\tuseState,\n\tuseMemo,\n\tuseCallback,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockListBlock from './block';\nimport BlockListAppender from '../block-list-appender';\nimport { useInBetweenInserter } from './use-in-between-inserter';\nimport { store as blockEditorStore } from '../../store';\nimport { LayoutProvider, defaultLayout } from './layout';\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useInnerBlocksProps } from '../inner-blocks';\nimport {\n\tBlockEditContextProvider,\n\tDEFAULT_BLOCK_EDIT_CONTEXT,\n} from '../block-edit/context';\nimport { useTypingObserver } from '../observe-typing';\n\nconst elementContext = createContext();\n\nexport const IntersectionObserver = createContext();\nconst pendingBlockVisibilityUpdatesPerRegistry = new WeakMap();\n\nfunction Root( { className, ...settings } ) {\n\tconst [ element, setElement ] = useState();\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { isOutlineMode, isFocusMode, editorMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, __unstableGetEditorMode } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { outlineMode, focusMode } = getSettings();\n\t\t\treturn {\n\t\t\t\tisOutlineMode: outlineMode,\n\t\t\t\tisFocusMode: focusMode,\n\t\t\t\teditorMode: __unstableGetEditorMode(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst registry = useRegistry();\n\tconst { setBlockVisibility } = useDispatch( blockEditorStore );\n\n\tconst delayedBlockVisibilityUpdates = useDebounce(\n\t\tuseCallback( () => {\n\t\t\tconst updates = {};\n\t\t\tpendingBlockVisibilityUpdatesPerRegistry\n\t\t\t\t.get( registry )\n\t\t\t\t.forEach( ( [ id, isIntersecting ] ) => {\n\t\t\t\t\tupdates[ id ] = isIntersecting;\n\t\t\t\t} );\n\t\t\tsetBlockVisibility( updates );\n\t\t}, [ registry ] ),\n\t\t300,\n\t\t{\n\t\t\ttrailing: true,\n\t\t}\n\t);\n\tconst intersectionObserver = useMemo( () => {\n\t\tconst { IntersectionObserver: Observer } = window;\n\n\t\tif ( ! Observer ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn new Observer( ( entries ) => {\n\t\t\tif ( ! pendingBlockVisibilityUpdatesPerRegistry.get( registry ) ) {\n\t\t\t\tpendingBlockVisibilityUpdatesPerRegistry.set( registry, [] );\n\t\t\t}\n\t\t\tfor ( const entry of entries ) {\n\t\t\t\tconst clientId = entry.target.getAttribute( 'data-block' );\n\t\t\t\tpendingBlockVisibilityUpdatesPerRegistry\n\t\t\t\t\t.get( registry )\n\t\t\t\t\t.push( [ clientId, entry.isIntersecting ] );\n\t\t\t}\n\t\t\tdelayedBlockVisibilityUpdates();\n\t\t} );\n\t}, [] );\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tref: useMergeRefs( [\n\t\t\t\tuseBlockSelectionClearer(),\n\t\t\t\tuseInBetweenInserter(),\n\t\t\t\tuseTypingObserver(),\n\t\t\t] ),\n\t\t\tclassName: classnames( 'is-root-container', className, {\n\t\t\t\t'is-outline-mode': isOutlineMode,\n\t\t\t\t'is-focus-mode': isFocusMode && isLargeViewport,\n\t\t\t\t'is-navigate-mode': editorMode === 'navigation',\n\t\t\t} ),\n\t\t},\n\t\tsettings\n\t);\n\treturn (\n\t\t<elementContext.Provider value={ element }>\n\t\t\t<IntersectionObserver.Provider value={ intersectionObserver }>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t\t{ /* Ensure element and layout styles are always at the end of the document */ }\n\t\t\t\t<div ref={ setElement } />\n\t\t\t</IntersectionObserver.Provider>\n\t\t</elementContext.Provider>\n\t);\n}\n\nexport default function BlockList( settings ) {\n\treturn (\n\t\t<BlockEditContextProvider value={ DEFAULT_BLOCK_EDIT_CONTEXT }>\n\t\t\t<Root { ...settings } />\n\t\t</BlockEditContextProvider>\n\t);\n}\n\nBlockList.__unstableElementContext = elementContext;\n\nfunction Items( {\n\tplaceholder,\n\trootClientId,\n\trenderAppender,\n\t__experimentalAppenderTagName,\n\tlayout = defaultLayout,\n} ) {\n\tconst { order, selectedBlocks, visibleBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\t__unstableGetVisibleBlocks,\n\t\t\t} = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\torder: getBlockOrder( rootClientId ),\n\t\t\t\tselectedBlocks: getSelectedBlockClientIds(),\n\t\t\t\tvisibleBlocks: __unstableGetVisibleBlocks(),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\treturn (\n\t\t<LayoutProvider value={ layout }>\n\t\t\t{ order.map( ( clientId ) => (\n\t\t\t\t<AsyncModeProvider\n\t\t\t\t\tkey={ clientId }\n\t\t\t\t\tvalue={\n\t\t\t\t\t\t// Only provide data asynchronously if the block is\n\t\t\t\t\t\t// not visible and not selected.\n\t\t\t\t\t\t! visibleBlocks.has( clientId ) &&\n\t\t\t\t\t\t! selectedBlocks.includes( clientId )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<BlockListBlock\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t</AsyncModeProvider>\n\t\t\t) ) }\n\t\t\t{ order.length < 1 && placeholder }\n\t\t\t<BlockListAppender\n\t\t\t\ttagName={ __experimentalAppenderTagName }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\trenderAppender={ renderAppender }\n\t\t\t/>\n\t\t</LayoutProvider>\n\t);\n}\n\nexport function BlockListItems( props ) {\n\t// This component needs to always be synchronous as it's the one changing\n\t// the async mode depending on the block selection.\n\treturn (\n\t\t<AsyncModeProvider value={ false }>\n\t\t\t<Items { ...props } />\n\t\t</AsyncModeProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,iBAAiB,EACjBC,SAAS,EACTC,WAAW,EACXC,WAAW,QACL,iBAAiB;AACxB,SACCC,gBAAgB,EAChBC,YAAY,EACZC,WAAW,QACL,oBAAoB;AAC3B,SACCC,aAAa,EACbC,QAAQ,EACRC,OAAO,EACPC,WAAW,QACL,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAOC,cAAc,MAAM,SAAS;AACpC,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,cAAc,EAAEC,aAAa,QAAQ,UAAU;AACxD,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,mBAAmB,QAAQ,iBAAiB;AACrD,SACCC,wBAAwB,EACxBC,0BAA0B,QACpB,uBAAuB;AAC9B,SAASC,iBAAiB,QAAQ,mBAAmB;AAErD,MAAMC,cAAc,GAAGhB,aAAa,CAAC,CAAC;AAEtC,OAAO,MAAMiB,oBAAoB,GAAGjB,aAAa,CAAC,CAAC;AACnD,MAAMkB,wCAAwC,GAAG,IAAIC,OAAO,CAAC,CAAC;AAE9D,SAASC,IAAIA,CAAE;EAAEC,SAAS;EAAE,GAAGC;AAAS,CAAC,EAAG;EAC3C,MAAM,CAAEC,OAAO,EAAEC,UAAU,CAAE,GAAGvB,QAAQ,CAAC,CAA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AG;EAAO,GACjCF,aAAA,CAACK,KAAK;IAAA,GAAMmB;EAAK,CAAI,CACH,CAAC;AAEtB"}
1
+ {"version":3,"names":["classnames","AsyncModeProvider","useSelect","useDispatch","useRegistry","useViewportMatch","useMergeRefs","useDebounce","createContext","useMemo","useCallback","BlockListBlock","BlockListAppender","useInBetweenInserter","store","blockEditorStore","LayoutProvider","defaultLayout","useBlockSelectionClearer","useInnerBlocksProps","BlockEditContextProvider","DEFAULT_BLOCK_EDIT_CONTEXT","useTypingObserver","IntersectionObserver","pendingBlockVisibilityUpdatesPerRegistry","WeakMap","Root","className","settings","isLargeViewport","isOutlineMode","isFocusMode","editorMode","select","getSettings","__unstableGetEditorMode","outlineMode","focusMode","registry","setBlockVisibility","delayedBlockVisibilityUpdates","updates","get","forEach","id","isIntersecting","trailing","intersectionObserver","Observer","window","entries","set","entry","clientId","target","getAttribute","push","innerBlocksProps","ref","createElement","Provider","value","BlockList","Items","placeholder","rootClientId","renderAppender","__experimentalAppenderTagName","layout","order","selectedBlocks","visibleBlocks","getBlockOrder","getSelectedBlockClientIds","__unstableGetVisibleBlocks","map","key","has","includes","length","tagName","BlockListItems","props"],"sources":["@wordpress/block-editor/src/components/block-list/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAsyncModeProvider,\n\tuseSelect,\n\tuseDispatch,\n\tuseRegistry,\n} from '@wordpress/data';\nimport {\n\tuseViewportMatch,\n\tuseMergeRefs,\n\tuseDebounce,\n} from '@wordpress/compose';\nimport { createContext, useMemo, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockListBlock from './block';\nimport BlockListAppender from '../block-list-appender';\nimport { useInBetweenInserter } from './use-in-between-inserter';\nimport { store as blockEditorStore } from '../../store';\nimport { LayoutProvider, defaultLayout } from './layout';\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useInnerBlocksProps } from '../inner-blocks';\nimport {\n\tBlockEditContextProvider,\n\tDEFAULT_BLOCK_EDIT_CONTEXT,\n} from '../block-edit/context';\nimport { useTypingObserver } from '../observe-typing';\n\nexport const IntersectionObserver = createContext();\nconst pendingBlockVisibilityUpdatesPerRegistry = new WeakMap();\n\nfunction Root( { className, ...settings } ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { isOutlineMode, isFocusMode, editorMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, __unstableGetEditorMode } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { outlineMode, focusMode } = getSettings();\n\t\t\treturn {\n\t\t\t\tisOutlineMode: outlineMode,\n\t\t\t\tisFocusMode: focusMode,\n\t\t\t\teditorMode: __unstableGetEditorMode(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst registry = useRegistry();\n\tconst { setBlockVisibility } = useDispatch( blockEditorStore );\n\n\tconst delayedBlockVisibilityUpdates = useDebounce(\n\t\tuseCallback( () => {\n\t\t\tconst updates = {};\n\t\t\tpendingBlockVisibilityUpdatesPerRegistry\n\t\t\t\t.get( registry )\n\t\t\t\t.forEach( ( [ id, isIntersecting ] ) => {\n\t\t\t\t\tupdates[ id ] = isIntersecting;\n\t\t\t\t} );\n\t\t\tsetBlockVisibility( updates );\n\t\t}, [ registry ] ),\n\t\t300,\n\t\t{\n\t\t\ttrailing: true,\n\t\t}\n\t);\n\tconst intersectionObserver = useMemo( () => {\n\t\tconst { IntersectionObserver: Observer } = window;\n\n\t\tif ( ! Observer ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn new Observer( ( entries ) => {\n\t\t\tif ( ! pendingBlockVisibilityUpdatesPerRegistry.get( registry ) ) {\n\t\t\t\tpendingBlockVisibilityUpdatesPerRegistry.set( registry, [] );\n\t\t\t}\n\t\t\tfor ( const entry of entries ) {\n\t\t\t\tconst clientId = entry.target.getAttribute( 'data-block' );\n\t\t\t\tpendingBlockVisibilityUpdatesPerRegistry\n\t\t\t\t\t.get( registry )\n\t\t\t\t\t.push( [ clientId, entry.isIntersecting ] );\n\t\t\t}\n\t\t\tdelayedBlockVisibilityUpdates();\n\t\t} );\n\t}, [] );\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tref: useMergeRefs( [\n\t\t\t\tuseBlockSelectionClearer(),\n\t\t\t\tuseInBetweenInserter(),\n\t\t\t\tuseTypingObserver(),\n\t\t\t] ),\n\t\t\tclassName: classnames( 'is-root-container', className, {\n\t\t\t\t'is-outline-mode': isOutlineMode,\n\t\t\t\t'is-focus-mode': isFocusMode && isLargeViewport,\n\t\t\t\t'is-navigate-mode': editorMode === 'navigation',\n\t\t\t} ),\n\t\t},\n\t\tsettings\n\t);\n\treturn (\n\t\t<IntersectionObserver.Provider value={ intersectionObserver }>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</IntersectionObserver.Provider>\n\t);\n}\n\nexport default function BlockList( settings ) {\n\treturn (\n\t\t<BlockEditContextProvider value={ DEFAULT_BLOCK_EDIT_CONTEXT }>\n\t\t\t<Root { ...settings } />\n\t\t</BlockEditContextProvider>\n\t);\n}\n\nfunction Items( {\n\tplaceholder,\n\trootClientId,\n\trenderAppender,\n\t__experimentalAppenderTagName,\n\tlayout = defaultLayout,\n} ) {\n\tconst { order, selectedBlocks, visibleBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\t__unstableGetVisibleBlocks,\n\t\t\t} = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\torder: getBlockOrder( rootClientId ),\n\t\t\t\tselectedBlocks: getSelectedBlockClientIds(),\n\t\t\t\tvisibleBlocks: __unstableGetVisibleBlocks(),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\treturn (\n\t\t<LayoutProvider value={ layout }>\n\t\t\t{ order.map( ( clientId ) => (\n\t\t\t\t<AsyncModeProvider\n\t\t\t\t\tkey={ clientId }\n\t\t\t\t\tvalue={\n\t\t\t\t\t\t// Only provide data asynchronously if the block is\n\t\t\t\t\t\t// not visible and not selected.\n\t\t\t\t\t\t! visibleBlocks.has( clientId ) &&\n\t\t\t\t\t\t! selectedBlocks.includes( clientId )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<BlockListBlock\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t</AsyncModeProvider>\n\t\t\t) ) }\n\t\t\t{ order.length < 1 && placeholder }\n\t\t\t<BlockListAppender\n\t\t\t\ttagName={ __experimentalAppenderTagName }\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\trenderAppender={ renderAppender }\n\t\t\t/>\n\t\t</LayoutProvider>\n\t);\n}\n\nexport function BlockListItems( props ) {\n\t// This component needs to always be synchronous as it's the one changing\n\t// the async mode depending on the block selection.\n\treturn (\n\t\t<AsyncModeProvider value={ false }>\n\t\t\t<Items { ...props } />\n\t\t</AsyncModeProvider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SACCC,iBAAiB,EACjBC,SAAS,EACTC,WAAW,EACXC,WAAW,QACL,iBAAiB;AACxB,SACCC,gBAAgB,EAChBC,YAAY,EACZC,WAAW,QACL,oBAAoB;AAC3B,SAASC,aAAa,EAAEC,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;;AAExE;AACA;AACA;AACA,OAAOC,cAAc,MAAM,SAAS;AACpC,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,cAAc,EAAEC,aAAa,QAAQ,UAAU;AACxD,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,mBAAmB,QAAQ,iBAAiB;AACrD,SACCC,wBAAwB,EACxBC,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EACA;EACA,OACCvB,aAAA,CAAC1D,iBAAiB;IAAC4D,KAAK,EAAG;EAAO,GACjCF,aAAA,CAACI,KAAK;IAAA,GAAMmB;EAAK,CAAI,CACH,CAAC;AAEtB"}
@@ -42,9 +42,6 @@ function useAppender(rootClientId, CustomAppender) {
42
42
  __unstableGetEditorMode,
43
43
  getBlockEditingMode
44
44
  } = select(blockEditorStore);
45
- if (CustomAppender === false) {
46
- return false;
47
- }
48
45
  if (!CustomAppender) {
49
46
  const selectedBlockClientId = getSelectedBlockClientId();
50
47
  const isParentSelected = rootClientId === selectedBlockClientId || !rootClientId && !selectedBlockClientId;
@@ -69,6 +66,22 @@ function BlockListAppender({
69
66
  renderAppender,
70
67
  className,
71
68
  tagName: TagName = 'div'
69
+ }) {
70
+ if (renderAppender === false) {
71
+ return null;
72
+ }
73
+ return createElement(BlockListAppenderInner, {
74
+ rootClientId: rootClientId,
75
+ renderAppender: renderAppender,
76
+ className: className,
77
+ tagName: TagName
78
+ });
79
+ }
80
+ function BlockListAppenderInner({
81
+ rootClientId,
82
+ renderAppender,
83
+ className,
84
+ tagName: TagName
72
85
  }) {
73
86
  const appender = useAppender(rootClientId, renderAppender);
74
87
  const isDragOver = useSelect(select => {
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useSelect","getDefaultBlockName","DefaultBlockAppender","ButtonBlockAppender","store","blockEditorStore","DefaultAppender","rootClientId","canInsertDefaultBlock","select","canInsertBlockType","createElement","className","useAppender","CustomAppender","isVisible","getTemplateLock","getSelectedBlockClientId","__unstableGetEditorMode","getBlockEditingMode","selectedBlockClientId","isParentSelected","BlockListAppender","renderAppender","tagName","TagName","appender","isDragOver","getBlockInsertionPoint","isBlockInsertionPointVisible","getBlockCount","insertionPoint","tabIndex","contentEditable"],"sources":["@wordpress/block-editor/src/components/block-list-appender/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { getDefaultBlockName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport DefaultBlockAppender from '../default-block-appender';\nimport ButtonBlockAppender from '../button-block-appender';\nimport { store as blockEditorStore } from '../../store';\n\nfunction DefaultAppender( { rootClientId } ) {\n\tconst canInsertDefaultBlock = useSelect( ( select ) =>\n\t\tselect( blockEditorStore ).canInsertBlockType(\n\t\t\tgetDefaultBlockName(),\n\t\t\trootClientId\n\t\t)\n\t);\n\n\tif ( canInsertDefaultBlock ) {\n\t\t// Render the default block appender if the context supports use\n\t\t// of the default appender.\n\t\treturn <DefaultBlockAppender rootClientId={ rootClientId } />;\n\t}\n\n\t// Fallback in case the default block can't be inserted.\n\treturn (\n\t\t<ButtonBlockAppender\n\t\t\trootClientId={ rootClientId }\n\t\t\tclassName=\"block-list-appender__toggle\"\n\t\t/>\n\t);\n}\n\nfunction useAppender( rootClientId, CustomAppender ) {\n\tconst isVisible = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tif ( CustomAppender === false ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif ( ! CustomAppender ) {\n\t\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\t\t\tconst isParentSelected =\n\t\t\t\t\trootClientId === selectedBlockClientId ||\n\t\t\t\t\t( ! rootClientId && ! selectedBlockClientId );\n\t\t\t\tif ( ! isParentSelected ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tgetTemplateLock( rootClientId ) ||\n\t\t\t\tgetBlockEditingMode( rootClientId ) === 'disabled' ||\n\t\t\t\t__unstableGetEditorMode() === 'zoom-out'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\t\t[ rootClientId, CustomAppender ]\n\t);\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn CustomAppender ? (\n\t\t<CustomAppender />\n\t) : (\n\t\t<DefaultAppender rootClientId={ rootClientId } />\n\t);\n}\n\nfunction BlockListAppender( {\n\trootClientId,\n\trenderAppender,\n\tclassName,\n\ttagName: TagName = 'div',\n} ) {\n\tconst appender = useAppender( rootClientId, renderAppender );\n\tconst isDragOver = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockCount,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\t// Ideally we should also check for `isDragging` but currently it\n\t\t\t// requires a lot more setup. We can revisit this once we refactor\n\t\t\t// the DnD utility hooks.\n\t\t\treturn (\n\t\t\t\tisBlockInsertionPointVisible() &&\n\t\t\t\trootClientId === insertionPoint?.rootClientId &&\n\t\t\t\tgetBlockCount( rootClientId ) === 0\n\t\t\t);\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\tif ( ! appender ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<TagName\n\t\t\t// A `tabIndex` is used on the wrapping `div` element in order to\n\t\t\t// force a focus event to occur when an appender `button` element\n\t\t\t// is clicked. In some browsers (Firefox, Safari), button clicks do\n\t\t\t// not emit a focus event, which could cause this event to propagate\n\t\t\t// unexpectedly. The `tabIndex` ensures that the interaction is\n\t\t\t// captured as a focus, without also adding an extra tab stop.\n\t\t\t//\n\t\t\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\t\t\ttabIndex={ -1 }\n\t\t\tclassName={ classnames( 'block-list-appender wp-block', className, {\n\t\t\t\t'is-drag-over': isDragOver,\n\t\t\t} ) }\n\t\t\t// Needed in case the whole editor is content editable (for multi\n\t\t\t// selection). It fixes an edge case where ArrowDown and ArrowRight\n\t\t\t// should collapse the selection to the end of that selection and\n\t\t\t// not into the appender.\n\t\t\tcontentEditable={ false }\n\t\t\t// The appender exists to let you add the first Paragraph before\n\t\t\t// any is inserted. To that end, this appender should visually be\n\t\t\t// presented as a block. That means theme CSS should style it as if\n\t\t\t// it were an empty paragraph block. That means a `wp-block` class to\n\t\t\t// ensure the width is correct, and a [data-block] attribute to ensure\n\t\t\t// the correct margin is applied, especially for classic themes which\n\t\t\t// have commonly targeted that attribute for margins.\n\t\t\tdata-block\n\t\t>\n\t\t\t{ appender }\n\t\t</TagName>\n\t);\n}\n\nexport default BlockListAppender;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,mBAAmB,QAAQ,mBAAmB;;AAEvD;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,SAASC,eAAeA,CAAE;EAAEC;AAAa,CAAC,EAAG;EAC5C,MAAMC,qBAAqB,GAAGR,SAAS,CAAIS,MAAM,IAChDA,MAAM,CAAEJ,gBAAiB,CAAC,CAACK,kBAAkB,CAC5CT,mBAAmB,CAAC,CAAC,EACrBM,YACD,CACD,CAAC;EAED,IAAKC,qBAAqB,EAAG;IAC5B;IACA;IACA,OAAOG,aAAA,CAACT,oBAAoB;MAACK,YAAY,EAAGA;IAAc,CAAE,CAAC;EAC9D;;EAEA;EACA,OACCI,aAAA,CAACR,mBAAmB;IACnBI,YAAY,EAAGA,YAAc;IAC7BK,SAAS,EAAC;EAA6B,CACvC,CAAC;AAEJ;AAEA,SAASC,WAAWA,CAAEN,YAAY,EAAEO,cAAc,EAAG;EACpD,MAAMC,SAAS,GAAGf,SAAS,CACxBS,MAAM,IAAM;IACb,MAAM;MACLO,eAAe;MACfC,wBAAwB;MACxBC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AAExB,YAAY,IAC7CuB,aAAa,CAAEvB,YAAa,CAAC,KAAK,CAAC;EAErC,CAAC,EACD,CAAEA,YAAY,CACf,CAAC;EAED,IAAK,CAAEmB,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,OACCf,aAAA,CAACc;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAAA;IACAO,QAAQ,EAAG,CAAC,CAAG;IACfpB,SAAS,EAAGb,UAAU,CAAE,8BAA8B,EAAEa,SAAS,EAAE;MAClE,cAAc,EAAEe;IACjB,CAAE;IACF;IACA;IACA;IACA;IAAA;IACAM,eAAe,EAAG;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IAAA;IACA;EAAU,GAERP,QACM,CAAC;AAEZ;AAEA,eAAeJ,iBAAiB"}
1
+ {"version":3,"names":["classnames","useSelect","getDefaultBlockName","DefaultBlockAppender","ButtonBlockAppender","store","blockEditorStore","DefaultAppender","rootClientId","canInsertDefaultBlock","select","canInsertBlockType","createElement","className","useAppender","CustomAppender","isVisible","getTemplateLock","getSelectedBlockClientId","__unstableGetEditorMode","getBlockEditingMode","selectedBlockClientId","isParentSelected","BlockListAppender","renderAppender","tagName","TagName","BlockListAppenderInner","appender","isDragOver","getBlockInsertionPoint","isBlockInsertionPointVisible","getBlockCount","insertionPoint","tabIndex","contentEditable"],"sources":["@wordpress/block-editor/src/components/block-list-appender/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { getDefaultBlockName } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport DefaultBlockAppender from '../default-block-appender';\nimport ButtonBlockAppender from '../button-block-appender';\nimport { store as blockEditorStore } from '../../store';\n\nfunction DefaultAppender( { rootClientId } ) {\n\tconst canInsertDefaultBlock = useSelect( ( select ) =>\n\t\tselect( blockEditorStore ).canInsertBlockType(\n\t\t\tgetDefaultBlockName(),\n\t\t\trootClientId\n\t\t)\n\t);\n\n\tif ( canInsertDefaultBlock ) {\n\t\t// Render the default block appender if the context supports use\n\t\t// of the default appender.\n\t\treturn <DefaultBlockAppender rootClientId={ rootClientId } />;\n\t}\n\n\t// Fallback in case the default block can't be inserted.\n\treturn (\n\t\t<ButtonBlockAppender\n\t\t\trootClientId={ rootClientId }\n\t\t\tclassName=\"block-list-appender__toggle\"\n\t\t/>\n\t);\n}\n\nfunction useAppender( rootClientId, CustomAppender ) {\n\tconst isVisible = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tif ( ! CustomAppender ) {\n\t\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\t\t\tconst isParentSelected =\n\t\t\t\t\trootClientId === selectedBlockClientId ||\n\t\t\t\t\t( ! rootClientId && ! selectedBlockClientId );\n\t\t\t\tif ( ! isParentSelected ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tgetTemplateLock( rootClientId ) ||\n\t\t\t\tgetBlockEditingMode( rootClientId ) === 'disabled' ||\n\t\t\t\t__unstableGetEditorMode() === 'zoom-out'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\t\t[ rootClientId, CustomAppender ]\n\t);\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn CustomAppender ? (\n\t\t<CustomAppender />\n\t) : (\n\t\t<DefaultAppender rootClientId={ rootClientId } />\n\t);\n}\n\nfunction BlockListAppender( {\n\trootClientId,\n\trenderAppender,\n\tclassName,\n\ttagName: TagName = 'div',\n} ) {\n\tif ( renderAppender === false ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockListAppenderInner\n\t\t\trootClientId={ rootClientId }\n\t\t\trenderAppender={ renderAppender }\n\t\t\tclassName={ className }\n\t\t\ttagName={ TagName }\n\t\t/>\n\t);\n}\n\nfunction BlockListAppenderInner( {\n\trootClientId,\n\trenderAppender,\n\tclassName,\n\ttagName: TagName,\n} ) {\n\tconst appender = useAppender( rootClientId, renderAppender );\n\tconst isDragOver = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockCount,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\t\t// Ideally we should also check for `isDragging` but currently it\n\t\t\t// requires a lot more setup. We can revisit this once we refactor\n\t\t\t// the DnD utility hooks.\n\t\t\treturn (\n\t\t\t\tisBlockInsertionPointVisible() &&\n\t\t\t\trootClientId === insertionPoint?.rootClientId &&\n\t\t\t\tgetBlockCount( rootClientId ) === 0\n\t\t\t);\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\tif ( ! appender ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<TagName\n\t\t\t// A `tabIndex` is used on the wrapping `div` element in order to\n\t\t\t// force a focus event to occur when an appender `button` element\n\t\t\t// is clicked. In some browsers (Firefox, Safari), button clicks do\n\t\t\t// not emit a focus event, which could cause this event to propagate\n\t\t\t// unexpectedly. The `tabIndex` ensures that the interaction is\n\t\t\t// captured as a focus, without also adding an extra tab stop.\n\t\t\t//\n\t\t\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\t\t\ttabIndex={ -1 }\n\t\t\tclassName={ classnames( 'block-list-appender wp-block', className, {\n\t\t\t\t'is-drag-over': isDragOver,\n\t\t\t} ) }\n\t\t\t// Needed in case the whole editor is content editable (for multi\n\t\t\t// selection). It fixes an edge case where ArrowDown and ArrowRight\n\t\t\t// should collapse the selection to the end of that selection and\n\t\t\t// not into the appender.\n\t\t\tcontentEditable={ false }\n\t\t\t// The appender exists to let you add the first Paragraph before\n\t\t\t// any is inserted. To that end, this appender should visually be\n\t\t\t// presented as a block. That means theme CSS should style it as if\n\t\t\t// it were an empty paragraph block. That means a `wp-block` class to\n\t\t\t// ensure the width is correct, and a [data-block] attribute to ensure\n\t\t\t// the correct margin is applied, especially for classic themes which\n\t\t\t// have commonly targeted that attribute for margins.\n\t\t\tdata-block\n\t\t>\n\t\t\t{ appender }\n\t\t</TagName>\n\t);\n}\n\nexport default BlockListAppender;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,mBAAmB,QAAQ,mBAAmB;;AAEvD;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,SAASC,eAAeA,CAAE;EAAEC;AAAa,CAAC,EAAG;EAC5C,MAAMC,qBAAqB,GAAGR,SAAS,CAAIS,MAAM,IAChDA,MAAM,CAAEJ,gBAAiB,CAAC,CAACK,kBAAkB,CAC5CT,mBAAmB,CAAC,CAAC,EACrBM,YACD,CACD,CAAC;EAED,IAAKC,qBAAqB,EAAG;IAC5B;IACA;IACA,OAAOG,aAAA,CAACT,oBAAoB;MAACK,YAAY,EAAGA;IAAc,CAAE,CAAC;EAC9D;;EAEA;EACA,OACCI,aAAA,CAACR,mBAAmB;IACnBI,YAAY,EAAGA,YAAc;IAC7BK,SAAS,EAAC;EAA6B,CACvC,CAAC;AAEJ;AAEA,SAASC,WAAWA,CAAEN,YAAY,EAAEO,cAAc,EAAG;EACpD,MAAMC,SAAS,GAAGf,SAAS,CACxBS,MAAM,IAAM;IACb,MAAM;MACLO,eAAe;MACfC,wBAAwB;MACxBC,uBAAuB;MACvBC;IACD,CAAC,GAAGV,MAAM,CAAEJ,gBAAiB,CAAC;IAE9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C,4BAA4B;MAC5BC;IACD,CAAC,GAAGtB,MAAM,CAAEJ,gBAAiB,CAAC;IAC9B,MAAM2B,cAAc,GAAGH,sBAAsB,CAAC,CAAC;IAC/C;IACA;IACA;IACA,OACCC,4BAA4B,CAAC,CAAC,IAC9BvB,YAAY,KAAKyB,cAAc,EAAEzB,YAAY,IAC7CwB,aAAa,CAAExB,YAAa,CAAC,KAAK,CAAC;EAErC,CAAC,EACD,CAAEA,YAAY,CACf,CAAC;EAED,IAAK,CAAEoB,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,OACChB,aAAA,CAACc;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAAA;IACAQ,QAAQ,EAAG,CAAC,CAAG;IACfrB,SAAS,EAAGb,UAAU,CAAE,8BAA8B,EAAEa,SAAS,EAAE;MAClE,cAAc,EAAEgB;IACjB,CAAE;IACF;IACA;IACA;IACA;IAAA;IACAM,eAAe,EAAG;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IAAA;IACA;EAAU,GAERP,QACM,CAAC;AAEZ;AAEA,eAAeL,iBAAiB"}
@@ -3,7 +3,7 @@ import { createElement } from "react";
3
3
  * WordPress dependencies
4
4
  */
5
5
  import { useSelect, useDispatch } from '@wordpress/data';
6
- import { Button, __experimentalVStack as VStack, __experimentalHStack as HStack, FlexItem } from '@wordpress/components';
6
+ import { Button, __experimentalVStack as VStack, __experimentalTruncate as Truncate, Flex, FlexBlock, FlexItem } from '@wordpress/components';
7
7
  import { __experimentalGetBlockLabel, store as blocksStore } from '@wordpress/blocks';
8
8
 
9
9
  /**
@@ -55,10 +55,12 @@ function BlockQuickNavigationItem({
55
55
  return createElement(Button, {
56
56
  isPressed: isSelected,
57
57
  onClick: () => selectBlock(clientId)
58
- }, createElement(HStack, {
59
- justify: "flex-start"
60
- }, createElement(BlockIcon, {
58
+ }, createElement(Flex, null, createElement(FlexItem, null, createElement(BlockIcon, {
61
59
  icon: icon
62
- }), createElement(FlexItem, null, name)));
60
+ })), createElement(FlexBlock, {
61
+ style: {
62
+ textAlign: 'left'
63
+ }
64
+ }, createElement(Truncate, null, name))));
63
65
  }
64
66
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","Button","__experimentalVStack","VStack","__experimentalHStack","HStack","FlexItem","__experimentalGetBlockLabel","store","blocksStore","blockEditorStore","BlockIcon","BlockQuickNavigation","clientIds","length","createElement","spacing","map","clientId","BlockQuickNavigationItem","key","name","icon","isSelected","select","getBlockName","getBlockAttributes","isBlockSelected","hasSelectedInnerBlock","getBlockType","blockType","attributes","selectBlock","isPressed","onClick","justify"],"sources":["@wordpress/block-editor/src/components/block-quick-navigation/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tFlexItem,\n} from '@wordpress/components';\nimport {\n\t__experimentalGetBlockLabel,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport BlockIcon from '../block-icon';\n\nexport default function BlockQuickNavigation( { clientIds } ) {\n\tif ( ! clientIds.length ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<VStack spacing={ 1 }>\n\t\t\t{ clientIds.map( ( clientId ) => (\n\t\t\t\t<BlockQuickNavigationItem\n\t\t\t\t\tkey={ clientId }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</VStack>\n\t);\n}\n\nfunction BlockQuickNavigationItem( { clientId } ) {\n\tconst { name, icon, isSelected } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tisBlockSelected,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockType } = select( blocksStore );\n\n\t\t\tconst blockType = getBlockType( getBlockName( clientId ) );\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\n\t\t\treturn {\n\t\t\t\tname:\n\t\t\t\t\tblockType &&\n\t\t\t\t\t__experimentalGetBlockLabel(\n\t\t\t\t\t\tblockType,\n\t\t\t\t\t\tattributes,\n\t\t\t\t\t\t'list-view'\n\t\t\t\t\t),\n\t\t\t\ticon: blockType?.icon,\n\t\t\t\tisSelected:\n\t\t\t\t\tisBlockSelected( clientId ) ||\n\t\t\t\t\thasSelectedInnerBlock( clientId, /* deep: */ true ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<Button\n\t\t\tisPressed={ isSelected }\n\t\t\tonClick={ () => selectBlock( clientId ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<BlockIcon icon={ icon } />\n\t\t\t\t<FlexItem>{ name }</FlexItem>\n\t\t\t</HStack>\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,QAAQ,QACF,uBAAuB;AAC9B,SACCC,2BAA2B,EAC3BC,KAAK,IAAIC,WAAW,QACd,mBAAmB;;AAE1B;AACA;AACA;AACA,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,SAAS,MAAM,eAAe;AAErC,eAAe,SAASC,oBAAoBA,CAAE;EAAEC;AAAU,CAAC,EAAG;EAC7D,IAAK,CAAEA,SAAS,CAACC,MAAM,EAAG;IACzB,OAAO,IAAI;EACZ;EACA,OACCC,aAAA,CAACZ,MAAM;IAACa,OAAO,EAAG;EAAG,GAClBH,SAAS,CAACI,GAAG,CAAIC,QAAQ,IAC1BH,aAAA,CAACI,wBAAwB;IACxBC,GAAG,EAAGF,QAAU;IAChBA,QAAQ,EAAGA;EAAU,CACrB,CACA,CACK,CAAC;AAEX;AAEA,SAASC,wBAAwBA,CAAE;EAAED;AAAS,CAAC,EAAG;EACjD,MAAM;IAAEG,IAAI;IAAEC,IAAI;IAAEC;EAAW,CAAC,GAAGxB,SAAS,CACzCyB,MAAM,IAAM;IACb,MAAM;MACLC,YAAY;MACZC,kBAAkB;MAClBC,eAAe;MACfC;IACD,CAAC,GAAGJ,MAAM,CAAEd,gBAAiB,CAAC;IAC9B,MAAM;MAAEmB;IAAa,CAAC,GAAGL,MAAM,CAAEf,WAAY,CAAC;IAE9C,MAAMqB,SAAS,GAAGD,YAAY,CAAEJ,YAAY,CAAEP,QAAS,CAAE,CAAC;IAC1D,MAAMa,UAAU,GAAGL,kBAAkB,CAAER,QAAS,CAAC;IAEjD,OAAO;MACNG,IAAI,EACHS,SAAS,IACTvB,2BAA2B,CAC1BuB,SAAS,EACTC,UAAU,EACV,WACD,CAAC;MACFT,IAAI,EAAEQ,SAAS,EAAER,IAAI;MACrBC,UAAU,EACTI,eAAe,CAAET,QAAS,CAAC,IAC3BU,qBAAqB,CAAEV,QAAQ,EAAE,WAAY,IAAK;IACpD,CAAC;EACF,CAAC,EACD,CAAEA,QAAQ,CACX,CAAC;EACD,MAAM;IAAEc;EAAY,CAAC,GAAGhC,WAAW,CAAEU,gBAAiB,CAAC;EAEvD,OACCK,aAAA,CAACd,MAAM;IACNgC,SAAS,EAAGV,UAAY;IACxBW,OAAO,EAAGA,CAAA,KAAMF,WAAW,CAAEd,QAAS;EAAG,GAEzCH,aAAA,CAACV,MAAM;IAAC8B,OAAO,EAAC;EAAY,GAC3BpB,aAAA,CAACJ,SAAS;IAACW,IAAI,EAAGA;EAAM,CAAE,CAAC,EAC3BP,aAAA,CAACT,QAAQ,QAAGe,IAAgB,CACrB,CACD,CAAC;AAEX"}
1
+ {"version":3,"names":["useSelect","useDispatch","Button","__experimentalVStack","VStack","__experimentalTruncate","Truncate","Flex","FlexBlock","FlexItem","__experimentalGetBlockLabel","store","blocksStore","blockEditorStore","BlockIcon","BlockQuickNavigation","clientIds","length","createElement","spacing","map","clientId","BlockQuickNavigationItem","key","name","icon","isSelected","select","getBlockName","getBlockAttributes","isBlockSelected","hasSelectedInnerBlock","getBlockType","blockType","attributes","selectBlock","isPressed","onClick","style","textAlign"],"sources":["@wordpress/block-editor/src/components/block-quick-navigation/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalVStack as VStack,\n\t__experimentalTruncate as Truncate,\n\tFlex,\n\tFlexBlock,\n\tFlexItem,\n} from '@wordpress/components';\nimport {\n\t__experimentalGetBlockLabel,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport BlockIcon from '../block-icon';\n\nexport default function BlockQuickNavigation( { clientIds } ) {\n\tif ( ! clientIds.length ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<VStack spacing={ 1 }>\n\t\t\t{ clientIds.map( ( clientId ) => (\n\t\t\t\t<BlockQuickNavigationItem\n\t\t\t\t\tkey={ clientId }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</VStack>\n\t);\n}\n\nfunction BlockQuickNavigationItem( { clientId } ) {\n\tconst { name, icon, isSelected } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tisBlockSelected,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockType } = select( blocksStore );\n\n\t\t\tconst blockType = getBlockType( getBlockName( clientId ) );\n\t\t\tconst attributes = getBlockAttributes( clientId );\n\n\t\t\treturn {\n\t\t\t\tname:\n\t\t\t\t\tblockType &&\n\t\t\t\t\t__experimentalGetBlockLabel(\n\t\t\t\t\t\tblockType,\n\t\t\t\t\t\tattributes,\n\t\t\t\t\t\t'list-view'\n\t\t\t\t\t),\n\t\t\t\ticon: blockType?.icon,\n\t\t\t\tisSelected:\n\t\t\t\t\tisBlockSelected( clientId ) ||\n\t\t\t\t\thasSelectedInnerBlock( clientId, /* deep: */ true ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<Button\n\t\t\tisPressed={ isSelected }\n\t\t\tonClick={ () => selectBlock( clientId ) }\n\t\t>\n\t\t\t<Flex>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<BlockIcon icon={ icon } />\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexBlock style={ { textAlign: 'left' } }>\n\t\t\t\t\t<Truncate>{ name }</Truncate>\n\t\t\t\t</FlexBlock>\n\t\t\t</Flex>\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,EAC9BC,sBAAsB,IAAIC,QAAQ,EAClCC,IAAI,EACJC,SAAS,EACTC,QAAQ,QACF,uBAAuB;AAC9B,SACCC,2BAA2B,EAC3BC,KAAK,IAAIC,WAAW,QACd,mBAAmB;;AAE1B;AACA;AACA;AACA,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,SAAS,MAAM,eAAe;AAErC,eAAe,SAASC,oBAAoBA,CAAE;EAAEC;AAAU,CAAC,EAAG;EAC7D,IAAK,CAAEA,SAAS,CAACC,MAAM,EAAG;IACzB,OAAO,IAAI;EACZ;EACA,OACCC,aAAA,CAACd,MAAM;IAACe,OAAO,EAAG;EAAG,GAClBH,SAAS,CAACI,GAAG,CAAIC,QAAQ,IAC1BH,aAAA,CAACI,wBAAwB;IACxBC,GAAG,EAAGF,QAAU;IAChBA,QAAQ,EAA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@ import classnames from 'classnames';
10
10
  import { useState } from '@wordpress/element';
11
11
  import { debounce, useViewportMatch } from '@wordpress/compose';
12
12
  import { Button, __experimentalTruncate as Truncate, Popover } from '@wordpress/components';
13
- import deprecated from '@wordpress/deprecated';
14
13
 
15
14
  /**
16
15
  * Internal dependencies
@@ -95,11 +94,4 @@ function BlockStyles({
95
94
  }))));
96
95
  }
97
96
  export default BlockStyles;
98
- BlockStyles.Slot = () => {
99
- deprecated('BlockStyles.Slot', {
100
- version: '6.4',
101
- since: '6.2'
102
- });
103
- return null;
104
- };
105
97
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useState","debounce","useViewportMatch","Button","__experimentalTruncate","Truncate","Popover","deprecated","BlockStylesPreviewPanel","useStylesForBlocks","noop","BlockStyles","clientId","onSwitch","onHoverClassName","onSelect","stylesToRender","activeStyle","genericPreviewBlock","className","previewClassName","hoveredStyle","setHoveredStyle","isMobileViewport","length","debouncedSetHoveredStyle","onSelectStylePreview","style","cancel","styleItemHandler","item","_item$name","name","createElement","map","buttonText","label","__next40pxDefaultSize","key","variant","onMouseEnter","onFocus","onMouseLeave","onBlur","onClick","numberOfLines","placement","offset","focusOnMount","Slot","version","since"],"sources":["@wordpress/block-editor/src/components/block-styles/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { debounce, useViewportMatch } from '@wordpress/compose';\nimport {\n\tButton,\n\t__experimentalTruncate as Truncate,\n\tPopover,\n} from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport BlockStylesPreviewPanel from './preview-panel';\nimport useStylesForBlocks from './use-styles-for-block';\n\nconst noop = () => {};\n\n// Block Styles component for the Settings Sidebar.\nfunction BlockStyles( { clientId, onSwitch = noop, onHoverClassName = noop } ) {\n\tconst {\n\t\tonSelect,\n\t\tstylesToRender,\n\t\tactiveStyle,\n\t\tgenericPreviewBlock,\n\t\tclassName: previewClassName,\n\t} = useStylesForBlocks( {\n\t\tclientId,\n\t\tonSwitch,\n\t} );\n\tconst [ hoveredStyle, setHoveredStyle ] = useState( null );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\tif ( ! stylesToRender || stylesToRender.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst debouncedSetHoveredStyle = debounce( setHoveredStyle, 250 );\n\n\tconst onSelectStylePreview = ( style ) => {\n\t\tonSelect( style );\n\t\tonHoverClassName( null );\n\t\tsetHoveredStyle( null );\n\t\tdebouncedSetHoveredStyle.cancel();\n\t};\n\n\tconst styleItemHandler = ( item ) => {\n\t\tif ( hoveredStyle === item ) {\n\t\t\tdebouncedSetHoveredStyle.cancel();\n\t\t\treturn;\n\t\t}\n\t\tdebouncedSetHoveredStyle( item );\n\t\tonHoverClassName( item?.name ?? null );\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-block-styles\">\n\t\t\t<div className=\"block-editor-block-styles__variants\">\n\t\t\t\t{ stylesToRender.map( ( style ) => {\n\t\t\t\t\tconst buttonText = style.label || style.name;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-block-styles__item',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-active':\n\t\t\t\t\t\t\t\t\t\tactiveStyle.name === style.name,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tkey={ style.name }\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tlabel={ buttonText }\n\t\t\t\t\t\t\tonMouseEnter={ () => styleItemHandler( style ) }\n\t\t\t\t\t\t\tonFocus={ () => styleItemHandler( style ) }\n\t\t\t\t\t\t\tonMouseLeave={ () => styleItemHandler( null ) }\n\t\t\t\t\t\t\tonBlur={ () => styleItemHandler( null ) }\n\t\t\t\t\t\t\tonClick={ () => onSelectStylePreview( style ) }\n\t\t\t\t\t\t\taria-current={ activeStyle.name === style.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-styles__item-text\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ buttonText }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t\t{ hoveredStyle && ! isMobileViewport && (\n\t\t\t\t<Popover\n\t\t\t\t\tplacement=\"left-start\"\n\t\t\t\t\toffset={ 20 }\n\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"block-editor-block-styles__preview-panel\"\n\t\t\t\t\t\tonMouseLeave={ () => styleItemHandler( null ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockStylesPreviewPanel\n\t\t\t\t\t\t\tactiveStyle={ activeStyle }\n\t\t\t\t\t\t\tclassName={ previewClassName }\n\t\t\t\t\t\t\tgenericPreviewBlock={ genericPreviewBlock }\n\t\t\t\t\t\t\tstyle={ hoveredStyle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default BlockStyles;\n\nBlockStyles.Slot = () => {\n\tdeprecated( 'BlockStyles.Slot', {\n\t\tversion: '6.4',\n\t\tsince: '6.2',\n\t} );\n\n\treturn null;\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,QAAQ,EAAEC,gBAAgB,QAAQ,oBAAoB;AAC/D,SACCC,MAAM,EACNC,s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AA,KAAMb,gBAAgB,CAAE,IAAK;EAAG,GAE/CI,aAAA,CAACzB,uBAAuB;IACvBS,WAAW,EAAGA,WAAa;IAC3BE,SAAS,EAAGC,gBAAkB;IAC9BF,mBAAmB,EAAGA,mBAAqB;IAC3CS,KAAK,EAAGN;EAAc,CACtB,CACG,CACG,CAEN,CAAC;AAER;AAEA,eAAeV,WAAW;AAE1BA,WAAW,CAACsC,IAAI,GAAG,MAAM;EACxB1C,UAAU,CAAE,kBAAkB,EAAE;IAC/B2C,OAAO,EAAE,KAAK;IACdC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO,IAAI;AACZ,CAAC"}
1
+ {"version":3,"names":["classnames","useState","debounce","useViewportMatch","Button","__experimentalTruncate","Truncate","Popover","BlockStylesPreviewPanel","useStylesForBlocks","noop","BlockStyles","clientId","onSwitch","onHoverClassName","onSelect","stylesToRender","activeStyle","genericPreviewBlock","className","previewClassName","hoveredStyle","setHoveredStyle","isMobileViewport","length","debouncedSetHoveredStyle","onSelectStylePreview","style","cancel","styleItemHandler","item","_item$name","name","createElement","map","buttonText","label","__next40pxDefaultSize","key","variant","onMouseEnter","onFocus","onMouseLeave","onBlur","onClick","numberOfLines","placement","offset","focusOnMount"],"sources":["@wordpress/block-editor/src/components/block-styles/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { debounce, useViewportMatch } from '@wordpress/compose';\nimport {\n\tButton,\n\t__experimentalTruncate as Truncate,\n\tPopover,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockStylesPreviewPanel from './preview-panel';\nimport useStylesForBlocks from './use-styles-for-block';\n\nconst noop = () => {};\n\n// Block Styles component for the Settings Sidebar.\nfunction BlockStyles( { clientId, onSwitch = noop, onHoverClassName = noop } ) {\n\tconst {\n\t\tonSelect,\n\t\tstylesToRender,\n\t\tactiveStyle,\n\t\tgenericPreviewBlock,\n\t\tclassName: previewClassName,\n\t} = useStylesForBlocks( {\n\t\tclientId,\n\t\tonSwitch,\n\t} );\n\tconst [ hoveredStyle, setHoveredStyle ] = useState( null );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\tif ( ! stylesToRender || stylesToRender.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst debouncedSetHoveredStyle = debounce( setHoveredStyle, 250 );\n\n\tconst onSelectStylePreview = ( style ) => {\n\t\tonSelect( style );\n\t\tonHoverClassName( null );\n\t\tsetHoveredStyle( null );\n\t\tdebouncedSetHoveredStyle.cancel();\n\t};\n\n\tconst styleItemHandler = ( item ) => {\n\t\tif ( hoveredStyle === item ) {\n\t\t\tdebouncedSetHoveredStyle.cancel();\n\t\t\treturn;\n\t\t}\n\t\tdebouncedSetHoveredStyle( item );\n\t\tonHoverClassName( item?.name ?? null );\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-block-styles\">\n\t\t\t<div className=\"block-editor-block-styles__variants\">\n\t\t\t\t{ stylesToRender.map( ( style ) => {\n\t\t\t\t\tconst buttonText = style.label || style.name;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-block-styles__item',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-active':\n\t\t\t\t\t\t\t\t\t\tactiveStyle.name === style.name,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tkey={ style.name }\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tlabel={ buttonText }\n\t\t\t\t\t\t\tonMouseEnter={ () => styleItemHandler( style ) }\n\t\t\t\t\t\t\tonFocus={ () => styleItemHandler( style ) }\n\t\t\t\t\t\t\tonMouseLeave={ () => styleItemHandler( null ) }\n\t\t\t\t\t\t\tonBlur={ () => styleItemHandler( null ) }\n\t\t\t\t\t\t\tonClick={ () => onSelectStylePreview( style ) }\n\t\t\t\t\t\t\taria-current={ activeStyle.name === style.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-styles__item-text\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ buttonText }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t\t{ hoveredStyle && ! isMobileViewport && (\n\t\t\t\t<Popover\n\t\t\t\t\tplacement=\"left-start\"\n\t\t\t\t\toffset={ 20 }\n\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"block-editor-block-styles__preview-panel\"\n\t\t\t\t\t\tonMouseLeave={ () => styleItemHandler( null ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockStylesPreviewPanel\n\t\t\t\t\t\t\tactiveStyle={ activeStyle }\n\t\t\t\t\t\t\tclassName={ previewClassName }\n\t\t\t\t\t\t\tgenericPreviewBlock={ genericPreviewBlock }\n\t\t\t\t\t\t\tstyle={ hoveredStyle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default BlockStyles;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,QAAQ,EAAEC,gBAAgB,QAAQ,oBAAoB;AAC/D,SACCC,MAAM,EACNC,sBAAsB,IAAIC,QAAQ,EAClCC,OAAO,QACD,uBAAuB;;AAE9B;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,iBAAiB;AACrD,OAAOC,kBAAkB,MAAM,wB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AK,EAAGN;EAAc,CACtB,CACG,CACG,CAEN,CAAC;AAER;AAEA,eAAeV,WAAW"}
@@ -6,13 +6,19 @@ import { __ } from '@wordpress/i18n';
6
6
  import { useState } from '@wordpress/element';
7
7
  import { useInstanceId } from '@wordpress/compose';
8
8
  import { chevronRight } from '@wordpress/icons';
9
- import { MenuGroup, MenuItem, Popover, VisuallyHidden, __unstableComposite as Composite, __unstableUseCompositeState as useCompositeState, __unstableCompositeItem as CompositeItem } from '@wordpress/components';
9
+ import { MenuGroup, MenuItem, Popover, VisuallyHidden, privateApis as componentsPrivateApis } from '@wordpress/components';
10
10
 
11
11
  /**
12
12
  * Internal dependencies
13
13
  */
14
14
  import BlockPreview from '../block-preview';
15
15
  import useTransformedPatterns from './use-transformed-patterns';
16
+ import { unlock } from '../../lock-unlock';
17
+ const {
18
+ CompositeV2: Composite,
19
+ CompositeItemV2: CompositeItem,
20
+ useCompositeStoreV2: useCompositeStore
21
+ } = unlock(componentsPrivateApis);
16
22
  function PatternTransformationsMenu({
17
23
  blocks,
18
24
  patterns: statePatterns,
@@ -56,23 +62,21 @@ function BlockPatternsList({
56
62
  patterns,
57
63
  onSelect
58
64
  }) {
59
- const composite = useCompositeState();
65
+ const composite = useCompositeStore();
60
66
  return createElement(Composite, {
61
- ...composite,
67
+ store: composite,
62
68
  role: "listbox",
63
69
  className: "block-editor-block-switcher__preview-patterns-container",
64
70
  "aria-label": __('Patterns list')
65
71
  }, patterns.map(pattern => createElement(BlockPattern, {
66
72
  key: pattern.name,
67
73
  pattern: pattern,
68
- onSelect: onSelect,
69
- composite: composite
74
+ onSelect: onSelect
70
75
  })));
71
76
  }
72
77
  function BlockPattern({
73
78
  pattern,
74
- onSelect,
75
- composite
79
+ onSelect
76
80
  }) {
77
81
  // TODO check pattern/preview width...
78
82
  const baseClassName = 'block-editor-block-switcher__preview-patterns-container';
@@ -80,12 +84,12 @@ function BlockPattern({
80
84
  return createElement("div", {
81
85
  className: `${baseClassName}-list__list-item`
82
86
  }, createElement(CompositeItem, {
83
- role: "option",
84
- as: "div",
85
- ...composite,
86
- "aria-label": pattern.title,
87
- "aria-describedby": pattern.description ? descriptionId : undefined,
88
- className: `${baseClassName}-list__item`,
87
+ render: createElement("div", {
88
+ role: "option",
89
+ "aria-label": pattern.title,
90
+ "aria-describedby": pattern.description ? descriptionId : undefined,
91
+ className: `${baseClassName}-list__item`
92
+ }),
89
93
  onClick: () => onSelect(pattern.transformedBlocks)
90
94
  }, createElement(BlockPreview, {
91
95
  blocks: pattern.transformedBlocks,
@@ -1 +1 @@
1
- {"version":3,"names":["__","useState","useInstanceId","chevronRight","MenuGroup","MenuItem","Popover","VisuallyHidden","__unstableComposite","Composite","__unstableUseCompositeState","useCompositeState","__unstableCompositeItem","CompositeItem","BlockPreview","useTransformedPatterns","PatternTransformationsMenu","blocks","patterns","statePatterns","onSelect","showTransforms","setShowTransforms","length","createElement","className","PreviewPatternsPopover","onClick","event","preventDefault","icon","position","BlockPatternsList","composite","role","map","pattern","BlockPattern","key","name","baseClassName","descriptionId","as","title","description","undefined","transformedBlocks","viewportWidth","id"],"sources":["@wordpress/block-editor/src/components/block-switcher/pattern-transformations-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { chevronRight } from '@wordpress/icons';\n\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tPopover,\n\tVisuallyHidden,\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n\t__unstableCompositeItem as CompositeItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockPreview from '../block-preview';\nimport useTransformedPatterns from './use-transformed-patterns';\n\nfunction PatternTransformationsMenu( {\n\tblocks,\n\tpatterns: statePatterns,\n\tonSelect,\n} ) {\n\tconst [ showTransforms, setShowTransforms ] = useState( false );\n\tconst patterns = useTransformedPatterns( statePatterns, blocks );\n\tif ( ! patterns.length ) return null;\n\n\treturn (\n\t\t<MenuGroup className=\"block-editor-block-switcher__pattern__transforms__menugroup\">\n\t\t\t{ showTransforms && (\n\t\t\t\t<PreviewPatternsPopover\n\t\t\t\t\tpatterns={ patterns }\n\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<MenuItem\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tsetShowTransforms( ! showTransforms );\n\t\t\t\t} }\n\t\t\t\ticon={ chevronRight }\n\t\t\t>\n\t\t\t\t{ __( 'Patterns' ) }\n\t\t\t</MenuItem>\n\t\t</MenuGroup>\n\t);\n}\n\nfunction PreviewPatternsPopover( { patterns, onSelect } ) {\n\treturn (\n\t\t<div className=\"block-editor-block-switcher__popover__preview__parent\">\n\t\t\t<div className=\"block-editor-block-switcher__popover__preview__container\">\n\t\t\t\t<Popover\n\t\t\t\t\tclassName=\"block-editor-block-switcher__preview__popover\"\n\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t>\n\t\t\t\t\t<div className=\"block-editor-block-switcher__preview is-pattern-list-preview\">\n\t\t\t\t\t\t<BlockPatternsList\n\t\t\t\t\t\t\tpatterns={ patterns }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</Popover>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction BlockPatternsList( { patterns, onSelect } ) {\n\tconst composite = useCompositeState();\n\treturn (\n\t\t<Composite\n\t\t\t{ ...composite }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-editor-block-switcher__preview-patterns-container\"\n\t\t\taria-label={ __( 'Patterns list' ) }\n\t\t>\n\t\t\t{ patterns.map( ( pattern ) => (\n\t\t\t\t<BlockPattern\n\t\t\t\t\tkey={ pattern.name }\n\t\t\t\t\tpattern={ pattern }\n\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\tcomposite={ composite }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</Composite>\n\t);\n}\n\nfunction BlockPattern( { pattern, onSelect, composite } ) {\n\t// TODO check pattern/preview width...\n\tconst baseClassName =\n\t\t'block-editor-block-switcher__preview-patterns-container';\n\tconst descriptionId = useInstanceId(\n\t\tBlockPattern,\n\t\t`${ baseClassName }-list__item-description`\n\t);\n\treturn (\n\t\t<div className={ `${ baseClassName }-list__list-item` }>\n\t\t\t<CompositeItem\n\t\t\t\trole=\"option\"\n\t\t\t\tas=\"div\"\n\t\t\t\t{ ...composite }\n\t\t\t\taria-label={ pattern.title }\n\t\t\t\taria-describedby={\n\t\t\t\t\tpattern.description ? descriptionId : undefined\n\t\t\t\t}\n\t\t\t\tclassName={ `${ baseClassName }-list__item` }\n\t\t\t\tonClick={ () => onSelect( pattern.transformedBlocks ) }\n\t\t\t>\n\t\t\t\t<BlockPreview\n\t\t\t\t\tblocks={ pattern.transformedBlocks }\n\t\t\t\t\tviewportWidth={ pattern.viewportWidth || 500 }\n\t\t\t\t/>\n\t\t\t\t<div className={ `${ baseClassName }-list__item-title` }>\n\t\t\t\t\t{ pattern.title }\n\t\t\t\t</div>\n\t\t\t</CompositeItem>\n\t\t\t{ !! pattern.description && (\n\t\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t\t{ pattern.description }\n\t\t\t\t</VisuallyHidden>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default PatternTransformationsMenu;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,YAAY,QAAQ,kBAAkB;AAE/C,SACCC,SAAS,EACTC,QAAQ,EACRC,OAAO,EACPC,cAAc,EACdC,mBAAmB,IAAIC,SAAS,EAChCC,2BAA2B,IAAIC,iBAAiB,EAChDC,uBAAuB,IAAIC,aAAa,QAClC,uBAAuB;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,aAAA,CAACjB,cAAc;IAACyC,EAAE,EAAGP;EAAe,GACjCL,OAAO,CAACQ,WACK,CAEb,CAAC;AAER;AAEA,eAAe5B,0BAA0B"}
1
+ {"version":3,"names":["__","useState","useInstanceId","chevronRight","MenuGroup","MenuItem","Popover","VisuallyHidden","privateApis","componentsPrivateApis","BlockPreview","useTransformedPatterns","unlock","CompositeV2","Composite","CompositeItemV2","CompositeItem","useCompositeStoreV2","useCompositeStore","PatternTransformationsMenu","blocks","patterns","statePatterns","onSelect","showTransforms","setShowTransforms","length","createElement","className","PreviewPatternsPopover","onClick","event","preventDefault","icon","position","BlockPatternsList","composite","store","role","map","pattern","BlockPattern","key","name","baseClassName","descriptionId","render","title","description","undefined","transformedBlocks","viewportWidth","id"],"sources":["@wordpress/block-editor/src/components/block-switcher/pattern-transformations-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { chevronRight } from '@wordpress/icons';\n\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tPopover,\n\tVisuallyHidden,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockPreview from '../block-preview';\nimport useTransformedPatterns from './use-transformed-patterns';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tCompositeV2: Composite,\n\tCompositeItemV2: CompositeItem,\n\tuseCompositeStoreV2: useCompositeStore,\n} = unlock( componentsPrivateApis );\n\nfunction PatternTransformationsMenu( {\n\tblocks,\n\tpatterns: statePatterns,\n\tonSelect,\n} ) {\n\tconst [ showTransforms, setShowTransforms ] = useState( false );\n\tconst patterns = useTransformedPatterns( statePatterns, blocks );\n\tif ( ! patterns.length ) return null;\n\n\treturn (\n\t\t<MenuGroup className=\"block-editor-block-switcher__pattern__transforms__menugroup\">\n\t\t\t{ showTransforms && (\n\t\t\t\t<PreviewPatternsPopover\n\t\t\t\t\tpatterns={ patterns }\n\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<MenuItem\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tsetShowTransforms( ! showTransforms );\n\t\t\t\t} }\n\t\t\t\ticon={ chevronRight }\n\t\t\t>\n\t\t\t\t{ __( 'Patterns' ) }\n\t\t\t</MenuItem>\n\t\t</MenuGroup>\n\t);\n}\n\nfunction PreviewPatternsPopover( { patterns, onSelect } ) {\n\treturn (\n\t\t<div className=\"block-editor-block-switcher__popover__preview__parent\">\n\t\t\t<div className=\"block-editor-block-switcher__popover__preview__container\">\n\t\t\t\t<Popover\n\t\t\t\t\tclassName=\"block-editor-block-switcher__preview__popover\"\n\t\t\t\t\tposition=\"bottom right\"\n\t\t\t\t>\n\t\t\t\t\t<div className=\"block-editor-block-switcher__preview is-pattern-list-preview\">\n\t\t\t\t\t\t<BlockPatternsList\n\t\t\t\t\t\t\tpatterns={ patterns }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</Popover>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nfunction BlockPatternsList( { patterns, onSelect } ) {\n\tconst composite = useCompositeStore();\n\treturn (\n\t\t<Composite\n\t\t\tstore={ composite }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-editor-block-switcher__preview-patterns-container\"\n\t\t\taria-label={ __( 'Patterns list' ) }\n\t\t>\n\t\t\t{ patterns.map( ( pattern ) => (\n\t\t\t\t<BlockPattern\n\t\t\t\t\tkey={ pattern.name }\n\t\t\t\t\tpattern={ pattern }\n\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</Composite>\n\t);\n}\n\nfunction BlockPattern( { pattern, onSelect } ) {\n\t// TODO check pattern/preview width...\n\tconst baseClassName =\n\t\t'block-editor-block-switcher__preview-patterns-container';\n\tconst descriptionId = useInstanceId(\n\t\tBlockPattern,\n\t\t`${ baseClassName }-list__item-description`\n\t);\n\treturn (\n\t\t<div className={ `${ baseClassName }-list__list-item` }>\n\t\t\t<CompositeItem\n\t\t\t\trender={\n\t\t\t\t\t<div\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\taria-label={ pattern.title }\n\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\tpattern.description ? descriptionId : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName={ `${ baseClassName }-list__item` }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tonClick={ () => onSelect( pattern.transformedBlocks ) }\n\t\t\t>\n\t\t\t\t<BlockPreview\n\t\t\t\t\tblocks={ pattern.transformedBlocks }\n\t\t\t\t\tviewportWidth={ pattern.viewportWidth || 500 }\n\t\t\t\t/>\n\t\t\t\t<div className={ `${ baseClassName }-list__item-title` }>\n\t\t\t\t\t{ pattern.title }\n\t\t\t\t</div>\n\t\t\t</CompositeItem>\n\t\t\t{ !! pattern.description && (\n\t\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t\t{ pattern.description }\n\t\t\t\t</VisuallyHidden>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default PatternTransformationsMenu;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,YAAY,QAAQ,kBAAkB;AAE/C,SACCC,SAAS,EACTC,QAAQ,EACRC,OAAO,EACPC,cAAc,EACdC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;;AAE9B;AACA;AACA;AACA,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,sBAAsB,MAAM,4BAA4B;AAC/D,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EACLC,WAAW,EAAEC,SAAS;EACtBC,eAAe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EAAGP;EAAe,GACjCL,OAAO,CAACQ,WACK,CAEb,CAAC;AAER;AAEA,eAAe7B,0BAA0B"}
@@ -10,7 +10,7 @@ import deprecated from '@wordpress/deprecated';
10
10
  * Internal dependencies
11
11
  */
12
12
  import InsertionPoint, { InsertionPointOpenRef } from './insertion-point';
13
- import BlockPopover from './selected-block-popover';
13
+ import BlockPopover from './selected-block-tools';
14
14
  export default function BlockToolsBackCompat({
15
15
  children
16
16
  }) {
@@ -1 +1 @@
1
- {"version":3,"names":["useContext","Disabled","deprecated","InsertionPoint","InsertionPointOpenRef","BlockPopover","BlockToolsBackCompat","children","openRef","isDisabled","Context","alternative","since","version","createElement","__unstablePopoverSlot"],"sources":["@wordpress/block-editor/src/components/block-tools/back-compat.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { Disabled } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport InsertionPoint, { InsertionPointOpenRef } from './insertion-point';\nimport BlockPopover from './selected-block-popover';\n\nexport default function BlockToolsBackCompat( { children } ) {\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst isDisabled = useContext( Disabled.Context );\n\n\t// If context is set, `BlockTools` is a parent component.\n\tif ( openRef || isDisabled ) {\n\t\treturn children;\n\t}\n\n\tdeprecated( 'wp.components.Popover.Slot name=\"block-toolbar\"', {\n\t\talternative: 'wp.blockEditor.BlockTools',\n\t\tsince: '5.8',\n\t\tversion: '6.3',\n\t} );\n\n\treturn (\n\t\t<InsertionPoint __unstablePopoverSlot=\"block-toolbar\">\n\t\t\t<BlockPopover __unstablePopoverSlot=\"block-toolbar\" />\n\t\t\t{ children }\n\t\t</InsertionPoint>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,OAAOC,cAAc,IAAIC,qBAAqB,QAAQ,mBAAmB;AACzE,OAAOC,YAAY,MAAM,0BAA0B;AAEnD,eAAe,SAASC,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC5D,MAAMC,OAAO,GAAGR,UAAU,CAAEI,qBAAsB,CAAC;EACnD,MAAMK,UAAU,GAAGT,UAAU,CAAEC,QAAQ,CAACS,OAAQ,CAAC;;EAEjD;EACA,IAAKF,OAAO,IAAIC,UAAU,EAAG;IAC5B,OAAOF,QAAQ;EAChB;EAEAL,UAAU,CAAE,iDAAiD,EAAE;IAC9DS,WAAW,EAAE,2BAA2B;IACxCC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;EAEH,OACCC,aAAA,CAACX,cAAc;IAACY,qBAAqB,EAAC;EAAe,GACpDD,aAAA,CAACT,YAAY;IAACU,qBAAqB,EAAC;EAAe,CAAE,CAAC,EACpDR,QACa,CAAC;AAEnB"}
1
+ {"version":3,"names":["useContext","Disabled","deprecated","InsertionPoint","InsertionPointOpenRef","BlockPopover","BlockToolsBackCompat","children","openRef","isDisabled","Context","alternative","since","version","createElement","__unstablePopoverSlot"],"sources":["@wordpress/block-editor/src/components/block-tools/back-compat.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { Disabled } from '@wordpress/components';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport InsertionPoint, { InsertionPointOpenRef } from './insertion-point';\nimport BlockPopover from './selected-block-tools';\n\nexport default function BlockToolsBackCompat( { children } ) {\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst isDisabled = useContext( Disabled.Context );\n\n\t// If context is set, `BlockTools` is a parent component.\n\tif ( openRef || isDisabled ) {\n\t\treturn children;\n\t}\n\n\tdeprecated( 'wp.components.Popover.Slot name=\"block-toolbar\"', {\n\t\talternative: 'wp.blockEditor.BlockTools',\n\t\tsince: '5.8',\n\t\tversion: '6.3',\n\t} );\n\n\treturn (\n\t\t<InsertionPoint __unstablePopoverSlot=\"block-toolbar\">\n\t\t\t<BlockPopover __unstablePopoverSlot=\"block-toolbar\" />\n\t\t\t{ children }\n\t\t</InsertionPoint>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,OAAOC,cAAc,IAAIC,qBAAqB,QAAQ,mBAAmB;AACzE,OAAOC,YAAY,MAAM,wBAAwB;AAEjD,eAAe,SAASC,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC5D,MAAMC,OAAO,GAAGR,UAAU,CAAEI,qBAAsB,CAAC;EACnD,MAAMK,UAAU,GAAGT,UAAU,CAAEC,QAAQ,CAACS,OAAQ,CAAC;;EAEjD;EACA,IAAKF,OAAO,IAAIC,UAAU,EAAG;IAC5B,OAAOF,QAAQ;EAChB;EAEAL,UAAU,CAAE,iDAAiD,EAAE;IAC9DS,WAAW,EAAE,2BAA2B;IACxCC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;EAEH,OACCC,aAAA,CAACX,cAAc;IAACY,qBAAqB,EAAC;EAAe,GACpDD,aAAA,CAACT,YAAY;IAACU,qBAAqB,EAAC;EAAe,CAAE,CAAC,EACpDR,QACa,CAAC;AAEnB"}
@@ -8,12 +8,8 @@ import classnames from 'classnames';
8
8
  * WordPress dependencies
9
9
  */
10
10
  import { __ } from '@wordpress/i18n';
11
- import { useLayoutEffect, useEffect, useRef, useState } from '@wordpress/element';
12
11
  import { hasBlockSupport, store as blocksStore } from '@wordpress/blocks';
13
12
  import { useSelect } from '@wordpress/data';
14
- import { ToolbarItem, ToolbarButton, ToolbarGroup } from '@wordpress/components';
15
- import { next, previous } from '@wordpress/icons';
16
- import { useViewportMatch } from '@wordpress/compose';
17
13
 
18
14
  /**
19
15
  * Internal dependencies
@@ -22,15 +18,11 @@ import NavigableToolbar from '../navigable-toolbar';
22
18
  import BlockToolbar from '../block-toolbar';
23
19
  import { store as blockEditorStore } from '../../store';
24
20
  import { useHasAnyBlockControls } from '../block-controls/use-has-block-controls';
25
- function BlockContextualToolbar({
21
+ export default function BlockContextualToolbar({
26
22
  focusOnMount,
27
23
  isFixed,
28
24
  ...props
29
25
  }) {
30
- // When the toolbar is fixed it can be collapsed
31
- const [isCollapsed, setIsCollapsed] = useState(false);
32
- const toolbarButtonRef = useRef();
33
- const isLargeViewport = useViewportMatch('medium');
34
26
  const {
35
27
  blockType,
36
28
  blockEditingMode,
@@ -61,60 +53,7 @@ function BlockContextualToolbar({
61
53
  showParentSelector: parentBlockType && getBlockEditingMode(firstParentClientId) === 'default' && hasBlockSupport(parentBlockType, '__experimentalParentSelector', true) && selectedBlockClientIds.length <= 1 && getBlockEditingMode(_selectedBlockClientId) === 'default'
62
54
  };
63
55
  }, []);
64
- useEffect(() => {
65
- setIsCollapsed(false);
66
- }, [selectedBlockClientId]);
67
- const isLargerThanTabletViewport = useViewportMatch('large', '>=');
68
- const isFullscreen = document.body.classList.contains('is-fullscreen-mode');
69
-
70
- /**
71
- * The following code is a workaround to fix the width of the toolbar
72
- * it should be removed when the toolbar will be rendered inline
73
- * FIXME: remove this layout effect when the toolbar is no longer
74
- * absolutely positioned
75
- */
76
- useLayoutEffect(() => {
77
- // don't do anything if not fixed toolbar
78
- if (!isFixed) {
79
- return;
80
- }
81
- const blockToolbar = document.querySelector('.block-editor-block-contextual-toolbar');
82
- if (!blockToolbar) {
83
- return;
84
- }
85
- if (!blockType) {
86
- blockToolbar.style.width = 'initial';
87
- return;
88
- }
89
- if (!isLargerThanTabletViewport) {
90
- // set the width of the toolbar to auto
91
- blockToolbar.style = {};
92
- return;
93
- }
94
- if (isCollapsed) {
95
- // set the width of the toolbar to auto
96
- blockToolbar.style.width = 'auto';
97
- return;
98
- }
99
-
100
- // get the width of the pinned items in the post editor or widget editor
101
- const pinnedItems = document.querySelector('.edit-post-header__settings, .edit-widgets-header__actions');
102
- // get the width of the left header in the site editor
103
- const leftHeader = document.querySelector('.edit-site-header-edit-mode__end');
104
- const computedToolbarStyle = window.getComputedStyle(blockToolbar);
105
- const computedPinnedItemsStyle = pinnedItems ? window.getComputedStyle(pinnedItems) : false;
106
- const computedLeftHeaderStyle = leftHeader ? window.getComputedStyle(leftHeader) : false;
107
- const marginLeft = parseFloat(computedToolbarStyle.marginLeft);
108
- const pinnedItemsWidth = computedPinnedItemsStyle ? parseFloat(computedPinnedItemsStyle.width) : 0;
109
- const leftHeaderWidth = computedLeftHeaderStyle ? parseFloat(computedLeftHeaderStyle.width) : 0;
110
-
111
- // set the new witdth of the toolbar
112
- blockToolbar.style.width = `calc(100% - ${leftHeaderWidth + pinnedItemsWidth + marginLeft + (pinnedItems || leftHeader ? 2 : 0) + (
113
- // Prevents button focus border from being cut off
114
- isFullscreen ? 0 : 160) // the width of the admin sidebar expanded
115
- }px)`;
116
- }, [isFixed, isLargerThanTabletViewport, isCollapsed, isFullscreen, blockType]);
117
- const isToolbarEnabled = !blockType || hasBlockSupport(blockType, '__experimentalToolbar', true);
56
+ const isToolbarEnabled = blockType && hasBlockSupport(blockType, '__experimentalToolbar', true);
118
57
  const hasAnyBlockControls = useHasAnyBlockControls();
119
58
  if (!isToolbarEnabled || blockEditingMode !== 'default' && !hasAnyBlockControls) {
120
59
  return null;
@@ -123,30 +62,22 @@ function BlockContextualToolbar({
123
62
  // Shifts the toolbar to make room for the parent block selector.
124
63
  const classes = classnames('block-editor-block-contextual-toolbar', {
125
64
  'has-parent': hasParents && showParentSelector,
126
- 'is-fixed': isFixed,
127
- 'is-collapsed': isCollapsed
65
+ 'is-fixed': isFixed
128
66
  });
129
67
  return createElement(NavigableToolbar, {
130
68
  focusOnMount: focusOnMount,
69
+ focusEditorOnEscape: true,
131
70
  className: classes
132
71
  /* translators: accessibility text for the block toolbar */,
133
72
  "aria-label": __('Block tools'),
134
- variant: isFixed ? 'unstyled' : undefined,
73
+ variant: isFixed ? 'unstyled' : undefined
74
+ // Resets the index whenever the active block changes so
75
+ // this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169
76
+ ,
77
+ key: selectedBlockClientId,
135
78
  ...props
136
- }, !isCollapsed && createElement(BlockToolbar, {
79
+ }, createElement(BlockToolbar, {
137
80
  hideDragHandle: isFixed
138
- }), isFixed && isLargeViewport && blockType && createElement(ToolbarGroup, {
139
- className: isCollapsed ? 'block-editor-block-toolbar__group-expand-fixed-toolbar' : 'block-editor-block-toolbar__group-collapse-fixed-toolbar'
140
- }, createElement(ToolbarItem, {
141
- as: ToolbarButton,
142
- ref: toolbarButtonRef,
143
- icon: isCollapsed ? next : previous,
144
- onClick: () => {
145
- setIsCollapsed(collapsed => !collapsed);
146
- toolbarButtonRef.current.focus();
147
- },
148
- label: isCollapsed ? __('Show block tools') : __('Hide block tools')
149
- })));
81
+ }));
150
82
  }
151
- export default BlockContextualToolbar;
152
83
  //# sourceMappingURL=block-contextual-toolbar.js.map