@wordpress/block-editor 14.5.0 → 14.7.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 (541) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +0 -8
  3. package/build/autocompleters/block.js +13 -5
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/block-canvas/index.js +10 -0
  6. package/build/components/block-canvas/index.js.map +1 -1
  7. package/build/components/block-card/index.js +2 -2
  8. package/build/components/block-card/index.js.map +1 -1
  9. package/build/components/block-full-height-alignment-control/index.js +1 -1
  10. package/build/components/block-full-height-alignment-control/index.js.map +1 -1
  11. package/build/components/block-list/block.js +15 -29
  12. package/build/components/block-list/block.js.map +1 -1
  13. package/build/components/block-list/block.native.js +1 -7
  14. package/build/components/block-list/block.native.js.map +1 -1
  15. package/build/components/block-list/index.js +5 -5
  16. package/build/components/block-list/index.js.map +1 -1
  17. package/build/components/block-list/use-block-props/index.js +1 -2
  18. package/build/components/block-list/use-block-props/index.js.map +1 -1
  19. package/build/components/block-list/use-block-props/use-focus-first-element.js +4 -3
  20. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  21. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -6
  22. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  23. package/build/components/block-list/use-in-between-inserter.js +1 -1
  24. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  25. package/build/components/block-patterns-list/index.js +23 -26
  26. package/build/components/block-patterns-list/index.js.map +1 -1
  27. package/build/components/block-patterns-paging/index.js +1 -1
  28. package/build/components/block-patterns-paging/index.js.map +1 -1
  29. package/build/components/block-popover/index.js +3 -46
  30. package/build/components/block-popover/index.js.map +1 -1
  31. package/build/components/block-preview/async.js +51 -0
  32. package/build/components/block-preview/async.js.map +1 -0
  33. package/build/components/block-preview/index.js +6 -3
  34. package/build/components/block-preview/index.js.map +1 -1
  35. package/build/components/block-settings-menu/block-settings-dropdown.js +5 -0
  36. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  37. package/build/components/block-settings-menu/index.js +4 -3
  38. package/build/components/block-settings-menu/index.js.map +1 -1
  39. package/build/components/block-toolbar/change-design.js +119 -0
  40. package/build/components/block-toolbar/change-design.js.map +1 -0
  41. package/build/components/block-toolbar/index.js +19 -7
  42. package/build/components/block-toolbar/index.js.map +1 -1
  43. package/build/components/block-tools/index.js +16 -19
  44. package/build/components/block-tools/index.js.map +1 -1
  45. package/build/components/block-tools/insertion-point.js +4 -3
  46. package/build/components/block-tools/insertion-point.js.map +1 -1
  47. package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
  48. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  49. package/build/components/block-tools/use-show-block-tools.js +7 -10
  50. package/build/components/block-tools/use-show-block-tools.js.map +1 -1
  51. package/build/components/block-tools/zoom-out-mode-inserters.js +20 -29
  52. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  53. package/build/components/block-variation-transforms/index.js +2 -2
  54. package/build/components/block-variation-transforms/index.js.map +1 -1
  55. package/build/components/block-vertical-alignment-control/ui.js +6 -10
  56. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  57. package/build/components/border-radius-control/linked-button.js +7 -10
  58. package/build/components/border-radius-control/linked-button.js.map +1 -1
  59. package/build/components/collab/block-comment-icon-slot.js +18 -0
  60. package/build/components/collab/block-comment-icon-slot.js.map +1 -0
  61. package/build/components/collab/block-comment-icon-toolbar-slot.js +18 -0
  62. package/build/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
  63. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
  64. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  65. package/build/components/convert-to-group-buttons/toolbar.js +4 -4
  66. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  67. package/build/components/global-styles/color-panel.js +1 -4
  68. package/build/components/global-styles/color-panel.js.map +1 -1
  69. package/build/components/global-styles/dimensions-panel.js +26 -14
  70. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  71. package/build/components/global-styles/use-global-styles-context.native.js +6 -0
  72. package/build/components/global-styles/use-global-styles-context.native.js.map +1 -1
  73. package/build/components/iframe/get-compatibility-styles.js +4 -4
  74. package/build/components/iframe/get-compatibility-styles.js.map +1 -1
  75. package/build/components/iframe/index.js +33 -22
  76. package/build/components/iframe/index.js.map +1 -1
  77. package/build/components/image-size-control/index.js +61 -20
  78. package/build/components/image-size-control/index.js.map +1 -1
  79. package/build/components/inner-blocks/index.js +9 -5
  80. package/build/components/inner-blocks/index.js.map +1 -1
  81. package/build/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  82. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  83. package/build/components/inserter/block-patterns-tab/index.js +1 -2
  84. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  85. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +5 -3
  86. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  87. package/build/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  88. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  89. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +3 -0
  90. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  91. package/build/components/inserter/block-patterns-tab/utils.js +5 -1
  92. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  93. package/build/components/inserter/category-tabs/index.js +15 -2
  94. package/build/components/inserter/category-tabs/index.js.map +1 -1
  95. package/build/components/inserter/hooks/use-block-types-state.js +1 -1
  96. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  97. package/build/components/inserter/hooks/use-patterns-paging.js +0 -5
  98. package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -1
  99. package/build/components/inserter/menu.js +4 -2
  100. package/build/components/inserter/menu.js.map +1 -1
  101. package/build/components/inserter/search-results.js +0 -2
  102. package/build/components/inserter/search-results.js.map +1 -1
  103. package/build/components/inserter-button/index.native.js +1 -1
  104. package/build/components/inserter-button/index.native.js.map +1 -1
  105. package/build/components/inspector-controls-tabs/index.js +0 -2
  106. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  107. package/build/components/inspector-controls-tabs/utils.js +3 -6
  108. package/build/components/inspector-controls-tabs/utils.js.map +1 -1
  109. package/build/components/link-control/link-preview.js +12 -9
  110. package/build/components/link-control/link-preview.js.map +1 -1
  111. package/build/components/list-view/appender.js +4 -3
  112. package/build/components/list-view/appender.js.map +1 -1
  113. package/build/components/list-view/branch.js +6 -5
  114. package/build/components/list-view/branch.js.map +1 -1
  115. package/build/components/list-view/index.js +1 -2
  116. package/build/components/list-view/index.js.map +1 -1
  117. package/build/components/media-placeholder/index.js +4 -4
  118. package/build/components/media-placeholder/index.js.map +1 -1
  119. package/build/components/provider/index.js +1 -1
  120. package/build/components/provider/index.js.map +1 -1
  121. package/build/components/rich-text/event-listeners/index.js +3 -1
  122. package/build/components/rich-text/event-listeners/index.js.map +1 -1
  123. package/build/components/rich-text/index.js +1 -1
  124. package/build/components/rich-text/index.js.map +1 -1
  125. package/build/components/rich-text/index.native.js +2 -6
  126. package/build/components/rich-text/index.native.js.map +1 -1
  127. package/build/components/spacing-sizes-control/index.js +2 -2
  128. package/build/components/spacing-sizes-control/index.js.map +1 -1
  129. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -3
  130. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  131. package/build/components/spacing-sizes-control/linked-button.js +1 -5
  132. package/build/components/spacing-sizes-control/linked-button.js.map +1 -1
  133. package/build/components/tabbed-sidebar/index.js +1 -1
  134. package/build/components/tabbed-sidebar/index.js.map +1 -1
  135. package/build/components/tool-selector/index.js +1 -4
  136. package/build/components/tool-selector/index.js.map +1 -1
  137. package/build/components/url-input/index.js +4 -2
  138. package/build/components/url-input/index.js.map +1 -1
  139. package/build/components/use-block-commands/index.js +6 -7
  140. package/build/components/use-block-commands/index.js.map +1 -1
  141. package/build/components/use-block-drop-zone/index.js +5 -5
  142. package/build/components/use-block-drop-zone/index.js.map +1 -1
  143. package/build/components/use-block-drop-zone/index.native.js +0 -1
  144. package/build/components/use-block-drop-zone/index.native.js.map +1 -1
  145. package/build/components/use-moving-animation/index.js +1 -3
  146. package/build/components/use-moving-animation/index.js.map +1 -1
  147. package/build/components/use-settings/index.js +1 -3
  148. package/build/components/use-settings/index.js.map +1 -1
  149. package/build/components/writing-flow/index.js +5 -3
  150. package/build/components/writing-flow/index.js.map +1 -1
  151. package/build/components/writing-flow/use-tab-nav.js +2 -3
  152. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  153. package/build/hooks/block-bindings.js +19 -8
  154. package/build/hooks/block-bindings.js.map +1 -1
  155. package/build/hooks/contrast-checker.js +0 -1
  156. package/build/hooks/contrast-checker.js.map +1 -1
  157. package/build/hooks/duotone.js +2 -2
  158. package/build/hooks/duotone.js.map +1 -1
  159. package/build/hooks/font-family.js +1 -1
  160. package/build/hooks/font-family.js.map +1 -1
  161. package/build/hooks/style.js +4 -1
  162. package/build/hooks/style.js.map +1 -1
  163. package/build/hooks/supports.js +6 -6
  164. package/build/hooks/supports.js.map +1 -1
  165. package/build/hooks/typography.js +5 -5
  166. package/build/hooks/typography.js.map +1 -1
  167. package/build/hooks/use-zoom-out.js +13 -22
  168. package/build/hooks/use-zoom-out.js.map +1 -1
  169. package/build/hooks/utils.js +2 -2
  170. package/build/hooks/utils.js.map +1 -1
  171. package/build/index.js +0 -7
  172. package/build/index.js.map +1 -1
  173. package/build/lock-unlock.js.map +1 -1
  174. package/build/private-apis.js +6 -3
  175. package/build/private-apis.js.map +1 -1
  176. package/build/store/actions.js +2 -33
  177. package/build/store/actions.js.map +1 -1
  178. package/build/store/defaults.js +1 -1
  179. package/build/store/defaults.js.map +1 -1
  180. package/build/store/private-actions.js +57 -8
  181. package/build/store/private-actions.js.map +1 -1
  182. package/build/store/private-selectors.js +10 -22
  183. package/build/store/private-selectors.js.map +1 -1
  184. package/build/store/reducer.js +16 -6
  185. package/build/store/reducer.js.map +1 -1
  186. package/build/store/selectors.js +53 -15
  187. package/build/store/selectors.js.map +1 -1
  188. package/build/store/utils.js +5 -4
  189. package/build/store/utils.js.map +1 -1
  190. package/build/utils/dom.js +37 -17
  191. package/build/utils/dom.js.map +1 -1
  192. package/build/utils/get-font-styles-and-weights.js +1 -1
  193. package/build/utils/get-font-styles-and-weights.js.map +1 -1
  194. package/build/utils/transform-styles/index.js +4 -3
  195. package/build/utils/transform-styles/index.js.map +1 -1
  196. package/build-module/autocompleters/block.js +14 -6
  197. package/build-module/autocompleters/block.js.map +1 -1
  198. package/build-module/components/block-canvas/index.js +11 -1
  199. package/build-module/components/block-canvas/index.js.map +1 -1
  200. package/build-module/components/block-card/index.js +3 -3
  201. package/build-module/components/block-card/index.js.map +1 -1
  202. package/build-module/components/block-full-height-alignment-control/index.js +1 -1
  203. package/build-module/components/block-full-height-alignment-control/index.js.map +1 -1
  204. package/build-module/components/block-list/block.js +16 -28
  205. package/build-module/components/block-list/block.js.map +1 -1
  206. package/build-module/components/block-list/block.native.js +1 -7
  207. package/build-module/components/block-list/block.native.js.map +1 -1
  208. package/build-module/components/block-list/index.js +5 -5
  209. package/build-module/components/block-list/index.js.map +1 -1
  210. package/build-module/components/block-list/use-block-props/index.js +1 -2
  211. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  212. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +4 -3
  213. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  214. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +3 -6
  215. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +1 -1
  216. package/build-module/components/block-list/use-in-between-inserter.js +1 -1
  217. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  218. package/build-module/components/block-patterns-list/index.js +23 -26
  219. package/build-module/components/block-patterns-list/index.js.map +1 -1
  220. package/build-module/components/block-patterns-paging/index.js +1 -1
  221. package/build-module/components/block-patterns-paging/index.js.map +1 -1
  222. package/build-module/components/block-popover/index.js +4 -47
  223. package/build-module/components/block-popover/index.js.map +1 -1
  224. package/build-module/components/block-preview/async.js +44 -0
  225. package/build-module/components/block-preview/async.js.map +1 -0
  226. package/build-module/components/block-preview/index.js +6 -3
  227. package/build-module/components/block-preview/index.js.map +1 -1
  228. package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -0
  229. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  230. package/build-module/components/block-settings-menu/index.js +5 -4
  231. package/build-module/components/block-settings-menu/index.js.map +1 -1
  232. package/build-module/components/block-toolbar/change-design.js +111 -0
  233. package/build-module/components/block-toolbar/change-design.js.map +1 -0
  234. package/build-module/components/block-toolbar/index.js +19 -7
  235. package/build-module/components/block-toolbar/index.js.map +1 -1
  236. package/build-module/components/block-tools/index.js +17 -20
  237. package/build-module/components/block-tools/index.js.map +1 -1
  238. package/build-module/components/block-tools/insertion-point.js +4 -3
  239. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  240. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -2
  241. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  242. package/build-module/components/block-tools/use-show-block-tools.js +7 -10
  243. package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
  244. package/build-module/components/block-tools/zoom-out-mode-inserters.js +20 -29
  245. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  246. package/build-module/components/block-variation-transforms/index.js +2 -2
  247. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  248. package/build-module/components/block-vertical-alignment-control/ui.js +6 -10
  249. package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
  250. package/build-module/components/border-radius-control/linked-button.js +8 -11
  251. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  252. package/build-module/components/collab/block-comment-icon-slot.js +11 -0
  253. package/build-module/components/collab/block-comment-icon-slot.js.map +1 -0
  254. package/build-module/components/collab/block-comment-icon-toolbar-slot.js +11 -0
  255. package/build-module/components/collab/block-comment-icon-toolbar-slot.js.map +1 -0
  256. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
  257. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  258. package/build-module/components/convert-to-group-buttons/toolbar.js +4 -4
  259. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
  260. package/build-module/components/global-styles/color-panel.js +2 -5
  261. package/build-module/components/global-styles/color-panel.js.map +1 -1
  262. package/build-module/components/global-styles/dimensions-panel.js +26 -14
  263. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  264. package/build-module/components/global-styles/use-global-styles-context.native.js +6 -0
  265. package/build-module/components/global-styles/use-global-styles-context.native.js.map +1 -1
  266. package/build-module/components/iframe/get-compatibility-styles.js +4 -4
  267. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
  268. package/build-module/components/iframe/index.js +33 -22
  269. package/build-module/components/iframe/index.js.map +1 -1
  270. package/build-module/components/image-size-control/index.js +62 -21
  271. package/build-module/components/image-size-control/index.js.map +1 -1
  272. package/build-module/components/inner-blocks/index.js +9 -5
  273. package/build-module/components/inner-blocks/index.js.map +1 -1
  274. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  275. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  276. package/build-module/components/inserter/block-patterns-tab/index.js +1 -2
  277. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  278. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +6 -4
  279. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  280. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  281. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  282. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +4 -1
  283. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  284. package/build-module/components/inserter/block-patterns-tab/utils.js +4 -0
  285. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  286. package/build-module/components/inserter/category-tabs/index.js +15 -2
  287. package/build-module/components/inserter/category-tabs/index.js.map +1 -1
  288. package/build-module/components/inserter/hooks/use-block-types-state.js +1 -1
  289. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  290. package/build-module/components/inserter/hooks/use-patterns-paging.js +1 -6
  291. package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -1
  292. package/build-module/components/inserter/menu.js +5 -3
  293. package/build-module/components/inserter/menu.js.map +1 -1
  294. package/build-module/components/inserter/search-results.js +0 -2
  295. package/build-module/components/inserter/search-results.js.map +1 -1
  296. package/build-module/components/inserter-button/index.native.js +1 -1
  297. package/build-module/components/inserter-button/index.native.js.map +1 -1
  298. package/build-module/components/inspector-controls-tabs/index.js +0 -2
  299. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  300. package/build-module/components/inspector-controls-tabs/utils.js +3 -6
  301. package/build-module/components/inspector-controls-tabs/utils.js.map +1 -1
  302. package/build-module/components/link-control/link-preview.js +13 -10
  303. package/build-module/components/link-control/link-preview.js.map +1 -1
  304. package/build-module/components/list-view/appender.js +4 -3
  305. package/build-module/components/list-view/appender.js.map +1 -1
  306. package/build-module/components/list-view/branch.js +7 -6
  307. package/build-module/components/list-view/branch.js.map +1 -1
  308. package/build-module/components/list-view/index.js +1 -2
  309. package/build-module/components/list-view/index.js.map +1 -1
  310. package/build-module/components/media-placeholder/index.js +4 -4
  311. package/build-module/components/media-placeholder/index.js.map +1 -1
  312. package/build-module/components/provider/index.js +1 -1
  313. package/build-module/components/provider/index.js.map +1 -1
  314. package/build-module/components/rich-text/event-listeners/index.js +4 -2
  315. package/build-module/components/rich-text/event-listeners/index.js.map +1 -1
  316. package/build-module/components/rich-text/index.js +1 -1
  317. package/build-module/components/rich-text/index.js.map +1 -1
  318. package/build-module/components/rich-text/index.native.js +2 -6
  319. package/build-module/components/rich-text/index.native.js.map +1 -1
  320. package/build-module/components/spacing-sizes-control/index.js +3 -3
  321. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  322. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
  323. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  324. package/build-module/components/spacing-sizes-control/linked-button.js +2 -6
  325. package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -1
  326. package/build-module/components/tabbed-sidebar/index.js +1 -1
  327. package/build-module/components/tabbed-sidebar/index.js.map +1 -1
  328. package/build-module/components/tool-selector/index.js +1 -4
  329. package/build-module/components/tool-selector/index.js.map +1 -1
  330. package/build-module/components/url-input/index.js +4 -2
  331. package/build-module/components/url-input/index.js.map +1 -1
  332. package/build-module/components/use-block-commands/index.js +5 -5
  333. package/build-module/components/use-block-commands/index.js.map +1 -1
  334. package/build-module/components/use-block-drop-zone/index.js +5 -5
  335. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  336. package/build-module/components/use-block-drop-zone/index.native.js +0 -1
  337. package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
  338. package/build-module/components/use-moving-animation/index.js +1 -3
  339. package/build-module/components/use-moving-animation/index.js.map +1 -1
  340. package/build-module/components/use-settings/index.js +1 -3
  341. package/build-module/components/use-settings/index.js.map +1 -1
  342. package/build-module/components/writing-flow/index.js +5 -3
  343. package/build-module/components/writing-flow/index.js.map +1 -1
  344. package/build-module/components/writing-flow/use-tab-nav.js +2 -3
  345. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  346. package/build-module/hooks/block-bindings.js +20 -9
  347. package/build-module/hooks/block-bindings.js.map +1 -1
  348. package/build-module/hooks/contrast-checker.js +0 -1
  349. package/build-module/hooks/contrast-checker.js.map +1 -1
  350. package/build-module/hooks/duotone.js +2 -2
  351. package/build-module/hooks/duotone.js.map +1 -1
  352. package/build-module/hooks/font-family.js +1 -1
  353. package/build-module/hooks/font-family.js.map +1 -1
  354. package/build-module/hooks/style.js +4 -1
  355. package/build-module/hooks/style.js.map +1 -1
  356. package/build-module/hooks/supports.js +6 -6
  357. package/build-module/hooks/supports.js.map +1 -1
  358. package/build-module/hooks/typography.js +5 -5
  359. package/build-module/hooks/typography.js.map +1 -1
  360. package/build-module/hooks/use-zoom-out.js +15 -23
  361. package/build-module/hooks/use-zoom-out.js.map +1 -1
  362. package/build-module/hooks/utils.js +2 -2
  363. package/build-module/hooks/utils.js.map +1 -1
  364. package/build-module/index.js +1 -1
  365. package/build-module/index.js.map +1 -1
  366. package/build-module/lock-unlock.js.map +1 -1
  367. package/build-module/private-apis.js +7 -5
  368. package/build-module/private-apis.js.map +1 -1
  369. package/build-module/store/actions.js +2 -33
  370. package/build-module/store/actions.js.map +1 -1
  371. package/build-module/store/defaults.js +1 -1
  372. package/build-module/store/defaults.js.map +1 -1
  373. package/build-module/store/private-actions.js +54 -7
  374. package/build-module/store/private-actions.js.map +1 -1
  375. package/build-module/store/private-selectors.js +10 -21
  376. package/build-module/store/private-selectors.js.map +1 -1
  377. package/build-module/store/reducer.js +16 -6
  378. package/build-module/store/reducer.js.map +1 -1
  379. package/build-module/store/selectors.js +54 -16
  380. package/build-module/store/selectors.js.map +1 -1
  381. package/build-module/store/utils.js +3 -3
  382. package/build-module/store/utils.js.map +1 -1
  383. package/build-module/utils/dom.js +35 -16
  384. package/build-module/utils/dom.js.map +1 -1
  385. package/build-module/utils/get-font-styles-and-weights.js +2 -2
  386. package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
  387. package/build-module/utils/transform-styles/index.js +3 -2
  388. package/build-module/utils/transform-styles/index.js.map +1 -1
  389. package/build-style/content-rtl.css +16 -10
  390. package/build-style/content.css +16 -10
  391. package/build-style/style-rtl.css +47 -25
  392. package/build-style/style.css +47 -25
  393. package/build-types/utils/dom.d.ts +7 -9
  394. package/build-types/utils/dom.d.ts.map +1 -1
  395. package/package.json +34 -32
  396. package/src/autocompleters/block.js +16 -7
  397. package/src/components/block-canvas/index.js +17 -1
  398. package/src/components/block-canvas/style.scss +3 -1
  399. package/src/components/block-card/index.js +3 -3
  400. package/src/components/block-full-height-alignment-control/index.js +1 -1
  401. package/src/components/block-inspector/style.scss +2 -7
  402. package/src/components/block-list/block.js +29 -50
  403. package/src/components/block-list/block.native.js +0 -4
  404. package/src/components/block-list/content.scss +1 -1
  405. package/src/components/block-list/index.js +4 -4
  406. package/src/components/block-list/use-block-props/index.js +0 -2
  407. package/src/components/block-list/use-block-props/use-focus-first-element.js +5 -3
  408. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +7 -20
  409. package/src/components/block-list/use-in-between-inserter.js +1 -1
  410. package/src/components/block-patterns-list/README.md +8 -8
  411. package/src/components/block-patterns-list/index.js +35 -51
  412. package/src/components/block-patterns-list/stories/fixtures.js +834 -0
  413. package/src/components/block-patterns-list/stories/index.story.js +64 -0
  414. package/src/components/block-patterns-list/style.scss +2 -0
  415. package/src/components/block-patterns-paging/index.js +1 -1
  416. package/src/components/block-popover/index.js +4 -66
  417. package/src/components/block-preview/async.js +43 -0
  418. package/src/components/block-preview/index.js +8 -3
  419. package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
  420. package/src/components/block-settings-menu/index.js +3 -0
  421. package/src/components/block-toolbar/change-design.js +127 -0
  422. package/src/components/block-toolbar/index.js +25 -8
  423. package/src/components/block-toolbar/style.scss +16 -0
  424. package/src/components/block-tools/index.js +30 -27
  425. package/src/components/block-tools/insertion-point.js +4 -3
  426. package/src/components/block-tools/style.scss +12 -20
  427. package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -2
  428. package/src/components/block-tools/use-show-block-tools.js +3 -14
  429. package/src/components/block-tools/zoom-out-mode-inserters.js +25 -40
  430. package/src/components/block-variation-transforms/index.js +2 -2
  431. package/src/components/block-vertical-alignment-control/ui.js +11 -15
  432. package/src/components/border-radius-control/linked-button.js +9 -11
  433. package/src/components/collab/block-comment-icon-slot.js +12 -0
  434. package/src/components/collab/block-comment-icon-toolbar-slot.js +12 -0
  435. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +7 -1
  436. package/src/components/convert-to-group-buttons/toolbar.js +4 -4
  437. package/src/components/default-block-appender/content.scss +13 -19
  438. package/src/components/global-styles/color-panel.js +2 -10
  439. package/src/components/global-styles/dimensions-panel.js +22 -16
  440. package/src/components/global-styles/test/use-global-styles-context.native.js +1 -0
  441. package/src/components/global-styles/use-global-styles-context.native.js +6 -0
  442. package/src/components/iframe/content.scss +4 -9
  443. package/src/components/iframe/get-compatibility-styles.js +4 -9
  444. package/src/components/iframe/index.js +48 -34
  445. package/src/components/iframe/style.scss +2 -3
  446. package/src/components/image-size-control/index.js +74 -43
  447. package/src/components/image-size-control/test/index.js +5 -63
  448. package/src/components/inner-blocks/index.js +12 -6
  449. package/src/components/inserter/block-patterns-explorer/pattern-list.js +3 -6
  450. package/src/components/inserter/block-patterns-tab/index.js +0 -1
  451. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -4
  452. package/src/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
  453. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +8 -0
  454. package/src/components/inserter/block-patterns-tab/utils.js +5 -0
  455. package/src/components/inserter/category-tabs/index.js +16 -2
  456. package/src/components/inserter/hooks/use-block-types-state.js +6 -1
  457. package/src/components/inserter/hooks/use-patterns-paging.js +1 -6
  458. package/src/components/inserter/menu.js +6 -4
  459. package/src/components/inserter/search-results.js +0 -6
  460. package/src/components/inserter/style.scss +13 -0
  461. package/src/components/inserter-button/index.native.js +1 -1
  462. package/src/components/inspector-controls-tabs/index.js +1 -6
  463. package/src/components/inspector-controls-tabs/utils.js +0 -3
  464. package/src/components/link-control/link-preview.js +15 -8
  465. package/src/components/link-control/test/index.js +63 -24
  466. package/src/components/list-view/appender.js +5 -6
  467. package/src/components/list-view/branch.js +8 -6
  468. package/src/components/list-view/index.js +1 -2
  469. package/src/components/media-placeholder/index.js +4 -4
  470. package/src/components/provider/index.js +1 -3
  471. package/src/components/provider/test/experimental-provider.js +43 -1
  472. package/src/components/rich-text/event-listeners/index.js +4 -2
  473. package/src/components/rich-text/index.js +8 -1
  474. package/src/components/rich-text/index.native.js +0 -2
  475. package/src/components/spacing-sizes-control/index.js +3 -3
  476. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +4 -4
  477. package/src/components/spacing-sizes-control/linked-button.js +2 -12
  478. package/src/components/tabbed-sidebar/index.js +1 -1
  479. package/src/components/tabbed-sidebar/style.scss +1 -1
  480. package/src/components/tool-selector/index.js +1 -5
  481. package/src/components/url-input/index.js +4 -5
  482. package/src/components/use-block-commands/index.js +245 -234
  483. package/src/components/use-block-drop-zone/index.js +5 -5
  484. package/src/components/use-block-drop-zone/index.native.js +0 -1
  485. package/src/components/use-moving-animation/index.js +0 -1
  486. package/src/components/use-settings/index.js +0 -1
  487. package/src/components/writing-flow/index.js +5 -3
  488. package/src/components/writing-flow/use-tab-nav.js +1 -2
  489. package/src/hooks/block-bindings.js +48 -31
  490. package/src/hooks/contrast-checker.js +0 -1
  491. package/src/hooks/duotone.js +2 -2
  492. package/src/hooks/font-family.js +1 -1
  493. package/src/hooks/style.js +7 -3
  494. package/src/hooks/supports.js +6 -6
  495. package/src/hooks/typography.js +5 -5
  496. package/src/hooks/use-zoom-out.js +14 -34
  497. package/src/hooks/utils.js +7 -2
  498. package/src/index.js +0 -1
  499. package/src/private-apis.js +6 -3
  500. package/src/store/actions.js +3 -52
  501. package/src/store/defaults.js +2 -1
  502. package/src/store/private-actions.js +71 -8
  503. package/src/store/private-selectors.js +14 -25
  504. package/src/store/reducer.js +25 -11
  505. package/src/store/selectors.js +116 -53
  506. package/src/store/test/actions.js +41 -0
  507. package/src/store/test/private-selectors.js +5 -0
  508. package/src/store/test/reducer.js +23 -0
  509. package/src/store/utils.js +12 -11
  510. package/src/utils/dom.js +42 -17
  511. package/src/utils/get-font-styles-and-weights.js +2 -2
  512. package/src/utils/test/dom.js +224 -0
  513. package/src/utils/transform-styles/index.js +3 -2
  514. package/tsconfig.json +1 -0
  515. package/tsconfig.tsbuildinfo +1 -1
  516. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -57
  517. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
  518. package/build/components/block-toolbar/shuffle.js +0 -110
  519. package/build/components/block-toolbar/shuffle.js.map +0 -1
  520. package/build/components/block-tools/zoom-out-popover.js +0 -58
  521. package/build/components/block-tools/zoom-out-popover.js.map +0 -1
  522. package/build/components/block-tools/zoom-out-toolbar.js +0 -132
  523. package/build/components/block-tools/zoom-out-toolbar.js.map +0 -1
  524. package/build/components/block-vertical-alignment-control/icons.js +0 -48
  525. package/build/components/block-vertical-alignment-control/icons.js.map +0 -1
  526. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -51
  527. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +0 -1
  528. package/build-module/components/block-toolbar/shuffle.js +0 -103
  529. package/build-module/components/block-toolbar/shuffle.js.map +0 -1
  530. package/build-module/components/block-tools/zoom-out-popover.js +0 -49
  531. package/build-module/components/block-tools/zoom-out-popover.js.map +0 -1
  532. package/build-module/components/block-tools/zoom-out-toolbar.js +0 -124
  533. package/build-module/components/block-tools/zoom-out-toolbar.js.map +0 -1
  534. package/build-module/components/block-vertical-alignment-control/icons.js +0 -41
  535. package/build-module/components/block-vertical-alignment-control/icons.js.map +0 -1
  536. package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +0 -65
  537. package/src/components/block-toolbar/shuffle.js +0 -111
  538. package/src/components/block-tools/zoom-out-popover.js +0 -47
  539. package/src/components/block-tools/zoom-out-toolbar.js +0 -135
  540. package/src/components/block-vertical-alignment-control/icons.js +0 -34
  541. /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
@@ -42,8 +42,7 @@ function BlockPattern({
42
42
  pattern,
43
43
  onClick,
44
44
  onHover,
45
- showTitle = true,
46
- showTooltip,
45
+ showTitlesAsTooltip,
47
46
  category
48
47
  }) {
49
48
  const [isDragging, setIsDragging] = useState(false);
@@ -53,6 +52,7 @@ function BlockPattern({
53
52
  } = pattern;
54
53
  const instanceId = useInstanceId(BlockPattern);
55
54
  const descriptionId = `block-editor-block-patterns-list__item-description-${instanceId}`;
55
+ const isUserPattern = pattern.type === INSERTER_PATTERN_TYPES.user;
56
56
 
57
57
  // When we have a selected category and the pattern is draggable, we need to update the
58
58
  // pattern's categories in metadata to only contain the selected category, and pass this to
@@ -95,7 +95,7 @@ function BlockPattern({
95
95
  }
96
96
  },
97
97
  children: /*#__PURE__*/_jsx(WithToolTip, {
98
- showTooltip: showTooltip && !pattern.type !== INSERTER_PATTERN_TYPES.user,
98
+ showTooltip: showTitlesAsTooltip && !isUserPattern,
99
99
  title: pattern.title,
100
100
  children: /*#__PURE__*/_jsxs(Composite.Item, {
101
101
  render: /*#__PURE__*/_jsx("div", {
@@ -118,19 +118,22 @@ function BlockPattern({
118
118
  onHover?.(pattern);
119
119
  },
120
120
  onMouseLeave: () => onHover?.(null),
121
- children: [/*#__PURE__*/_jsx(BlockPreview, {
122
- blocks: blocks,
123
- viewportWidth: viewportWidth
124
- }), showTitle && /*#__PURE__*/_jsxs(HStack, {
121
+ children: [/*#__PURE__*/_jsx(BlockPreview.Async, {
122
+ placeholder: /*#__PURE__*/_jsx(BlockPatternPlaceholder, {}),
123
+ children: /*#__PURE__*/_jsx(BlockPreview, {
124
+ blocks: blocks,
125
+ viewportWidth: viewportWidth
126
+ })
127
+ }), (!showTitlesAsTooltip || isUserPattern) && /*#__PURE__*/_jsxs(HStack, {
125
128
  className: "block-editor-patterns__pattern-details",
126
129
  spacing: 2,
127
- children: [pattern.type === INSERTER_PATTERN_TYPES.user && !pattern.syncStatus && /*#__PURE__*/_jsx("div", {
130
+ children: [isUserPattern && !pattern.syncStatus && /*#__PURE__*/_jsx("div", {
128
131
  className: "block-editor-patterns__pattern-icon-wrapper",
129
132
  children: /*#__PURE__*/_jsx(Icon, {
130
133
  className: "block-editor-patterns__pattern-icon",
131
134
  icon: symbol
132
135
  })
133
- }), (!showTooltip || pattern.type === INSERTER_PATTERN_TYPES.user) && /*#__PURE__*/_jsx("div", {
136
+ }), /*#__PURE__*/_jsx("div", {
134
137
  className: "block-editor-block-patterns-list__item-title",
135
138
  children: pattern.title
136
139
  })]
@@ -151,13 +154,11 @@ function BlockPatternPlaceholder() {
151
154
  function BlockPatternsList({
152
155
  isDraggable,
153
156
  blockPatterns,
154
- shownPatterns,
155
157
  onHover,
156
158
  onClickPattern,
157
159
  orientation,
158
160
  label = __('Block patterns'),
159
161
  category,
160
- showTitle = true,
161
162
  showTitlesAsTooltip,
162
163
  pagingProps
163
164
  }, ref) {
@@ -166,9 +167,9 @@ function BlockPatternsList({
166
167
  // Reset the active composite item whenever the available patterns change,
167
168
  // to make sure that Composite widget can receive focus correctly when its
168
169
  // composite items change. The first composite item will receive focus.
169
- const firstCompositeItemId = blockPatterns.find(pattern => shownPatterns.includes(pattern))?.name;
170
+ const firstCompositeItemId = blockPatterns[0]?.name;
170
171
  setActiveCompositeId(firstCompositeItemId);
171
- }, [shownPatterns, blockPatterns]);
172
+ }, [blockPatterns]);
172
173
  return /*#__PURE__*/_jsxs(Composite, {
173
174
  orientation: orientation,
174
175
  activeId: activeCompositeId,
@@ -177,19 +178,15 @@ function BlockPatternsList({
177
178
  className: "block-editor-block-patterns-list",
178
179
  "aria-label": label,
179
180
  ref: ref,
180
- children: [blockPatterns.map(pattern => {
181
- const isShown = shownPatterns.includes(pattern);
182
- return isShown ? /*#__PURE__*/_jsx(BlockPattern, {
183
- id: pattern.name,
184
- pattern: pattern,
185
- onClick: onClickPattern,
186
- onHover: onHover,
187
- isDraggable: isDraggable,
188
- showTitle: showTitle,
189
- showTooltip: showTitlesAsTooltip,
190
- category: category
191
- }, pattern.name) : /*#__PURE__*/_jsx(BlockPatternPlaceholder, {}, pattern.name);
192
- }), pagingProps && /*#__PURE__*/_jsx(BlockPatternsPaging, {
181
+ children: [blockPatterns.map(pattern => /*#__PURE__*/_jsx(BlockPattern, {
182
+ id: pattern.name,
183
+ pattern: pattern,
184
+ onClick: onClickPattern,
185
+ onHover: onHover,
186
+ isDraggable: isDraggable,
187
+ showTitlesAsTooltip: showTitlesAsTooltip,
188
+ category: category
189
+ }, pattern.name)), pagingProps && /*#__PURE__*/_jsx(BlockPatternsPaging, {
193
190
  ...pagingProps
194
191
  })]
195
192
  });
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","cloneBlock","useEffect","useState","forwardRef","useMemo","Composite","VisuallyHidden","Tooltip","__experimentalHStack","HStack","useInstanceId","__","Icon","symbol","BlockPreview","InserterDraggableBlocks","BlockPatternsPaging","INSERTER_PATTERN_TYPES","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","WithToolTip","showTooltip","title","children","text","BlockPattern","id","isDraggable","pattern","onClick","onHover","showTitle","category","isDragging","setIsDragging","blocks","viewportWidth","instanceId","descriptionId","patternBlocks","map","block","clonedBlock","attributes","metadata","categories","includes","isEnabled","draggable","onDragStart","onDragEnd","className","event","type","user","Item","render","role","description","undefined","syncStatus","onMouseEnter","onMouseLeave","spacing","icon","BlockPatternPlaceholder","BlockPatternsList","blockPatterns","shownPatterns","onClickPattern","orientation","label","showTitlesAsTooltip","pagingProps","ref","activeCompositeId","setActiveCompositeId","firstCompositeItemId","find","name","activeId","setActiveId","isShown"],"sources":["@wordpress/block-editor/src/components/block-patterns-list/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { cloneBlock } from '@wordpress/blocks';\nimport { useEffect, useState, forwardRef, useMemo } from '@wordpress/element';\nimport {\n\tComposite,\n\tVisuallyHidden,\n\tTooltip,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, symbol } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockPreview from '../block-preview';\nimport InserterDraggableBlocks from '../inserter-draggable-blocks';\nimport BlockPatternsPaging from '../block-patterns-paging';\nimport { INSERTER_PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';\n\nconst WithToolTip = ( { showTooltip, title, children } ) => {\n\tif ( showTooltip ) {\n\t\treturn <Tooltip text={ title }>{ children }</Tooltip>;\n\t}\n\treturn <>{ children }</>;\n};\n\nfunction BlockPattern( {\n\tid,\n\tisDraggable,\n\tpattern,\n\tonClick,\n\tonHover,\n\tshowTitle = true,\n\tshowTooltip,\n\tcategory,\n} ) {\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\tconst { blocks, viewportWidth } = pattern;\n\tconst instanceId = useInstanceId( BlockPattern );\n\tconst descriptionId = `block-editor-block-patterns-list__item-description-${ instanceId }`;\n\n\t// When we have a selected category and the pattern is draggable, we need to update the\n\t// pattern's categories in metadata to only contain the selected category, and pass this to\n\t// InserterDraggableBlocks component. We do that because we use this information for pattern\n\t// shuffling and it makes more sense to show only the ones from the initially selected category during insertion.\n\tconst patternBlocks = useMemo( () => {\n\t\tif ( ! category || ! isDraggable ) {\n\t\t\treturn blocks;\n\t\t}\n\t\treturn ( blocks ?? [] ).map( ( block ) => {\n\t\t\tconst clonedBlock = cloneBlock( block );\n\t\t\tif (\n\t\t\t\tclonedBlock.attributes.metadata?.categories?.includes(\n\t\t\t\t\tcategory\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tclonedBlock.attributes.metadata.categories = [ category ];\n\t\t\t}\n\t\t\treturn clonedBlock;\n\t\t} );\n\t}, [ blocks, isDraggable, category ] );\n\n\treturn (\n\t\t<InserterDraggableBlocks\n\t\t\tisEnabled={ isDraggable }\n\t\t\tblocks={ patternBlocks }\n\t\t\tpattern={ pattern }\n\t\t>\n\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"block-editor-block-patterns-list__list-item\"\n\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\tonDragStart={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( true );\n\t\t\t\t\t\tif ( onDragStart ) {\n\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\tonDragStart( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonDragEnd={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( false );\n\t\t\t\t\t\tif ( onDragEnd ) {\n\t\t\t\t\t\t\tonDragEnd( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<WithToolTip\n\t\t\t\t\t\tshowTooltip={\n\t\t\t\t\t\t\tshowTooltip &&\n\t\t\t\t\t\t\t! pattern.type !== INSERTER_PATTERN_TYPES.user\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttitle={ pattern.title }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Composite.Item\n\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\taria-label={ pattern.title }\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\tpattern.description\n\t\t\t\t\t\t\t\t\t\t\t? descriptionId\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__item',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__list-item-synced':\n\t\t\t\t\t\t\t\t\t\t\t\tpattern.type ===\n\t\t\t\t\t\t\t\t\t\t\t\t\tINSERTER_PATTERN_TYPES.user &&\n\t\t\t\t\t\t\t\t\t\t\t\t! pattern.syncStatus,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonClick( pattern, blocks );\n\t\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseEnter={ () => {\n\t\t\t\t\t\t\t\tif ( isDragging ) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonHover?.( pattern );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseLeave={ () => onHover?.( null ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockPreview\n\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t{ showTitle && (\n\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-patterns__pattern-details\"\n\t\t\t\t\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ pattern.type ===\n\t\t\t\t\t\t\t\t\t\tINSERTER_PATTERN_TYPES.user &&\n\t\t\t\t\t\t\t\t\t\t! pattern.syncStatus && (\n\t\t\t\t\t\t\t\t\t\t\t<div className=\"block-editor-patterns__pattern-icon-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-patterns__pattern-icon\"\n\t\t\t\t\t\t\t\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ ( ! showTooltip ||\n\t\t\t\t\t\t\t\t\t\tpattern.type ===\n\t\t\t\t\t\t\t\t\t\t\tINSERTER_PATTERN_TYPES.user ) && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"block-editor-block-patterns-list__item-title\">\n\t\t\t\t\t\t\t\t\t\t\t{ pattern.title }\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t{ !! pattern.description && (\n\t\t\t\t\t\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t\t\t\t\t\t{ pattern.description }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Composite.Item>\n\t\t\t\t\t</WithToolTip>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</InserterDraggableBlocks>\n\t);\n}\n\nfunction BlockPatternPlaceholder() {\n\treturn (\n\t\t<div className=\"block-editor-block-patterns-list__item is-placeholder\" />\n\t);\n}\n\nfunction BlockPatternsList(\n\t{\n\t\tisDraggable,\n\t\tblockPatterns,\n\t\tshownPatterns,\n\t\tonHover,\n\t\tonClickPattern,\n\t\torientation,\n\t\tlabel = __( 'Block patterns' ),\n\t\tcategory,\n\t\tshowTitle = true,\n\t\tshowTitlesAsTooltip,\n\t\tpagingProps,\n\t},\n\tref\n) {\n\tconst [ activeCompositeId, setActiveCompositeId ] = useState( undefined );\n\n\tuseEffect( () => {\n\t\t// Reset the active composite item whenever the available patterns change,\n\t\t// to make sure that Composite widget can receive focus correctly when its\n\t\t// composite items change. The first composite item will receive focus.\n\t\tconst firstCompositeItemId = blockPatterns.find( ( pattern ) =>\n\t\t\tshownPatterns.includes( pattern )\n\t\t)?.name;\n\t\tsetActiveCompositeId( firstCompositeItemId );\n\t}, [ shownPatterns, blockPatterns ] );\n\n\treturn (\n\t\t<Composite\n\t\t\torientation={ orientation }\n\t\t\tactiveId={ activeCompositeId }\n\t\t\tsetActiveId={ setActiveCompositeId }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-editor-block-patterns-list\"\n\t\t\taria-label={ label }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ blockPatterns.map( ( pattern ) => {\n\t\t\t\tconst isShown = shownPatterns.includes( pattern );\n\t\t\t\treturn isShown ? (\n\t\t\t\t\t<BlockPattern\n\t\t\t\t\t\tkey={ pattern.name }\n\t\t\t\t\t\tid={ pattern.name }\n\t\t\t\t\t\tpattern={ pattern }\n\t\t\t\t\t\tonClick={ onClickPattern }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tisDraggable={ isDraggable }\n\t\t\t\t\t\tshowTitle={ showTitle }\n\t\t\t\t\t\tshowTooltip={ showTitlesAsTooltip }\n\t\t\t\t\t\tcategory={ category }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<BlockPatternPlaceholder key={ pattern.name } />\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ pagingProps && <BlockPatternsPaging { ...pagingProps } /> }\n\t\t</Composite>\n\t);\n}\n\nexport default forwardRef( BlockPatternsList );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,UAAU,QAAQ,mBAAmB;AAC9C,SAASC,SAAS,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;AAC7E,SACCC,SAAS,EACTC,cAAc,EACdC,OAAO,EACPC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,MAAM,QAAQ,kBAAkB;;AAE/C;AACA;AACA;AACA,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,mBAAmB,MAAM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AAa;QAC3BI,SAAS,EAAGA,SAAW;QACvBV,WAAW,EAAGmD,mBAAqB;QACnCxC,QAAQ,EAAGA;MAAU,GARfJ,OAAO,CAACmD,IASd,CAAC,gBAEFhE,IAAA,CAACkD,uBAAuB,MAAOrC,OAAO,CAACmD,IAAQ,CAC/C;IACF,CAAE,CAAC,EACDN,WAAW,iBAAI1D,IAAA,CAACH,mBAAmB;MAAA,GAAM6D;IAAW,CAAI,CAAC;EAAA,CACjD,CAAC;AAEd;AAEA,eAAe1E,UAAU,CAAEmE,iBAAkB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["clsx","cloneBlock","useEffect","useState","forwardRef","useMemo","Composite","VisuallyHidden","Tooltip","__experimentalHStack","HStack","useInstanceId","__","Icon","symbol","BlockPreview","InserterDraggableBlocks","BlockPatternsPaging","INSERTER_PATTERN_TYPES","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","WithToolTip","showTooltip","title","children","text","BlockPattern","id","isDraggable","pattern","onClick","onHover","showTitlesAsTooltip","category","isDragging","setIsDragging","blocks","viewportWidth","instanceId","descriptionId","isUserPattern","type","user","patternBlocks","map","block","clonedBlock","attributes","metadata","categories","includes","isEnabled","draggable","onDragStart","onDragEnd","className","event","Item","render","role","description","undefined","syncStatus","onMouseEnter","onMouseLeave","Async","placeholder","BlockPatternPlaceholder","spacing","icon","BlockPatternsList","blockPatterns","onClickPattern","orientation","label","pagingProps","ref","activeCompositeId","setActiveCompositeId","firstCompositeItemId","name","activeId","setActiveId"],"sources":["@wordpress/block-editor/src/components/block-patterns-list/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { cloneBlock } from '@wordpress/blocks';\nimport { useEffect, useState, forwardRef, useMemo } from '@wordpress/element';\nimport {\n\tComposite,\n\tVisuallyHidden,\n\tTooltip,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, symbol } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockPreview from '../block-preview';\nimport InserterDraggableBlocks from '../inserter-draggable-blocks';\nimport BlockPatternsPaging from '../block-patterns-paging';\nimport { INSERTER_PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';\n\nconst WithToolTip = ( { showTooltip, title, children } ) => {\n\tif ( showTooltip ) {\n\t\treturn <Tooltip text={ title }>{ children }</Tooltip>;\n\t}\n\treturn <>{ children }</>;\n};\n\nfunction BlockPattern( {\n\tid,\n\tisDraggable,\n\tpattern,\n\tonClick,\n\tonHover,\n\tshowTitlesAsTooltip,\n\tcategory,\n} ) {\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\tconst { blocks, viewportWidth } = pattern;\n\tconst instanceId = useInstanceId( BlockPattern );\n\tconst descriptionId = `block-editor-block-patterns-list__item-description-${ instanceId }`;\n\tconst isUserPattern = pattern.type === INSERTER_PATTERN_TYPES.user;\n\n\t// When we have a selected category and the pattern is draggable, we need to update the\n\t// pattern's categories in metadata to only contain the selected category, and pass this to\n\t// InserterDraggableBlocks component. We do that because we use this information for pattern\n\t// shuffling and it makes more sense to show only the ones from the initially selected category during insertion.\n\tconst patternBlocks = useMemo( () => {\n\t\tif ( ! category || ! isDraggable ) {\n\t\t\treturn blocks;\n\t\t}\n\t\treturn ( blocks ?? [] ).map( ( block ) => {\n\t\t\tconst clonedBlock = cloneBlock( block );\n\t\t\tif (\n\t\t\t\tclonedBlock.attributes.metadata?.categories?.includes(\n\t\t\t\t\tcategory\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tclonedBlock.attributes.metadata.categories = [ category ];\n\t\t\t}\n\t\t\treturn clonedBlock;\n\t\t} );\n\t}, [ blocks, isDraggable, category ] );\n\n\treturn (\n\t\t<InserterDraggableBlocks\n\t\t\tisEnabled={ isDraggable }\n\t\t\tblocks={ patternBlocks }\n\t\t\tpattern={ pattern }\n\t\t>\n\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"block-editor-block-patterns-list__list-item\"\n\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\tonDragStart={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( true );\n\t\t\t\t\t\tif ( onDragStart ) {\n\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\tonDragStart( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonDragEnd={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( false );\n\t\t\t\t\t\tif ( onDragEnd ) {\n\t\t\t\t\t\t\tonDragEnd( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<WithToolTip\n\t\t\t\t\t\tshowTooltip={ showTitlesAsTooltip && ! isUserPattern }\n\t\t\t\t\t\ttitle={ pattern.title }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Composite.Item\n\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\taria-label={ pattern.title }\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\tpattern.description\n\t\t\t\t\t\t\t\t\t\t\t? descriptionId\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__item',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__list-item-synced':\n\t\t\t\t\t\t\t\t\t\t\t\tpattern.type ===\n\t\t\t\t\t\t\t\t\t\t\t\t\tINSERTER_PATTERN_TYPES.user &&\n\t\t\t\t\t\t\t\t\t\t\t\t! pattern.syncStatus,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonClick( pattern, blocks );\n\t\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseEnter={ () => {\n\t\t\t\t\t\t\t\tif ( isDragging ) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonHover?.( pattern );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseLeave={ () => onHover?.( null ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockPreview.Async\n\t\t\t\t\t\t\t\tplaceholder={ <BlockPatternPlaceholder /> }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BlockPreview\n\t\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</BlockPreview.Async>\n\t\t\t\t\t\t\t{ ( ! showTitlesAsTooltip || isUserPattern ) && (\n\t\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-patterns__pattern-details\"\n\t\t\t\t\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ isUserPattern && ! pattern.syncStatus && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"block-editor-patterns__pattern-icon-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-patterns__pattern-icon\"\n\t\t\t\t\t\t\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<div className=\"block-editor-block-patterns-list__item-title\">\n\t\t\t\t\t\t\t\t\t\t{ pattern.title }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t\t{ !! pattern.description && (\n\t\t\t\t\t\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t\t\t\t\t\t{ pattern.description }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Composite.Item>\n\t\t\t\t\t</WithToolTip>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</InserterDraggableBlocks>\n\t);\n}\n\nfunction BlockPatternPlaceholder() {\n\treturn (\n\t\t<div className=\"block-editor-block-patterns-list__item is-placeholder\" />\n\t);\n}\n\nfunction BlockPatternsList(\n\t{\n\t\tisDraggable,\n\t\tblockPatterns,\n\t\tonHover,\n\t\tonClickPattern,\n\t\torientation,\n\t\tlabel = __( 'Block patterns' ),\n\t\tcategory,\n\t\tshowTitlesAsTooltip,\n\t\tpagingProps,\n\t},\n\tref\n) {\n\tconst [ activeCompositeId, setActiveCompositeId ] = useState( undefined );\n\n\tuseEffect( () => {\n\t\t// Reset the active composite item whenever the available patterns change,\n\t\t// to make sure that Composite widget can receive focus correctly when its\n\t\t// composite items change. The first composite item will receive focus.\n\t\tconst firstCompositeItemId = blockPatterns[ 0 ]?.name;\n\t\tsetActiveCompositeId( firstCompositeItemId );\n\t}, [ blockPatterns ] );\n\n\treturn (\n\t\t<Composite\n\t\t\torientation={ orientation }\n\t\t\tactiveId={ activeCompositeId }\n\t\t\tsetActiveId={ setActiveCompositeId }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-editor-block-patterns-list\"\n\t\t\taria-label={ label }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ blockPatterns.map( ( pattern ) => (\n\t\t\t\t<BlockPattern\n\t\t\t\t\tkey={ pattern.name }\n\t\t\t\t\tid={ pattern.name }\n\t\t\t\t\tpattern={ pattern }\n\t\t\t\t\tonClick={ onClickPattern }\n\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\tisDraggable={ isDraggable }\n\t\t\t\t\tshowTitlesAsTooltip={ showTitlesAsTooltip }\n\t\t\t\t\tcategory={ category }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ pagingProps && <BlockPatternsPaging { ...pagingProps } /> }\n\t\t</Composite>\n\t);\n}\n\nexport default forwardRef( BlockPatternsList );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,UAAU,QAAQ,mBAAmB;AAC9C,SAASC,SAAS,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;AAC7E,SACCC,SAAS,EACTC,cAAc,EACdC,OAAO,EACPC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,MAAM,QAAQ,kBAAkB;;AAE/C;AACA;AACA;AACA,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,SAASC,sBAAsB,QAAQ,sCAAsC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAE9E,MAAMC,WAAW,GAAGA,CAAE;EAAEC,WAAW;EAAEC,KAAK;EAAEC;AAAS,CAAC,KAAM;EAC3D,IAAKF,WAAW,EAAG;IAClB,oBAAON,IAAA,CAACZ,OAAO;MAACqB,IAAI,EAAGF,KAAO;MAAAC,QAAA,EAAGA;IAAQ,CAAW,CAAC;EACtD;EACA,oBAAOR,IAAA,CAAAE,SAAA;IAAAM,QAAA,EAAIA;EAAQ,CAAI,C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D,SAAU,CAAC;EAEzE/D,SAAS,CAAE,MAAM;IAChB;IACA;IACA;IACA,MAAMiF,oBAAoB,GAAGR,aAAa,CAAE,CAAC,CAAE,EAAES,IAAI;IACrDF,oBAAoB,CAAEC,oBAAqB,CAAC;EAC7C,CAAC,EAAE,CAAER,aAAa,CAAG,CAAC;EAEtB,oBACCnD,KAAA,CAAClB,SAAS;IACTuE,WAAW,EAAGA,WAAa;IAC3BQ,QAAQ,EAAGJ,iBAAmB;IAC9BK,WAAW,EAAGJ,oBAAsB;IACpCnB,IAAI,EAAC,SAAS;IACdJ,SAAS,EAAC,kCAAkC;IAC5C,cAAamB,KAAO;IACpBE,GAAG,EAAGA,GAAK;IAAApD,QAAA,GAET+C,aAAa,CAAC3B,GAAG,CAAIf,OAAO,iBAC7Bb,IAAA,CAACU,YAAY;MAEZC,EAAE,EAAGE,OAAO,CAACmD,IAAM;MACnBnD,OAAO,EAAGA,OAAS;MACnBC,OAAO,EAAG0C,cAAgB;MAC1BzC,OAAO,EAAGA,OAAS;MACnBH,WAAW,EAAGA,WAAa;MAC3BI,mBAAmB,EAAGA,mBAAqB;MAC3CC,QAAQ,EAAGA;IAAU,GAPfJ,OAAO,CAACmD,IAQd,CACA,CAAC,EACDL,WAAW,iBAAI3D,IAAA,CAACH,mBAAmB;MAAA,GAAM8D;IAAW,CAAI,CAAC;EAAA,CACjD,CAAC;AAEd;AAEA,eAAe3E,UAAU,CAAEsE,iBAAkB,CAAC","ignoreList":[]}
@@ -52,7 +52,7 @@ export default function Pagination({
52
52
  }), /*#__PURE__*/_jsx(Text, {
53
53
  variant: "muted",
54
54
  children: sprintf(
55
- // translators: %1$s: Current page number, %2$s: Total number of pages.
55
+ // translators: 1: Current page number. 2: Total number of pages.
56
56
  _x('%1$s of %2$s', 'paging'), currentPage, numPages)
57
57
  }), /*#__PURE__*/_jsxs(HStack, {
58
58
  expanded: false,
@@ -1 +1 @@
1
- {"version":3,"names":["__experimentalVStack","VStack","__experimentalHStack","HStack","__experimentalText","Text","Button","__","_x","_n","sprintf","jsx","_jsx","jsxs","_jsxs","Pagination","currentPage","numPages","changePage","totalItems","className","children","variant","expanded","spacing","justify","onClick","disabled","size","accessibleWhenDisabled"],"sources":["@wordpress/block-editor/src/components/block-patterns-paging/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\tButton,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\n\nexport default function Pagination( {\n\tcurrentPage,\n\tnumPages,\n\tchangePage,\n\ttotalItems,\n} ) {\n\treturn (\n\t\t<VStack className=\"block-editor-patterns__grid-pagination-wrapper\">\n\t\t\t<Text variant=\"muted\">\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\t_n( '%s item', '%s items', totalItems ),\n\t\t\t\t\ttotalItems\n\t\t\t\t) }\n\t\t\t</Text>\n\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<HStack\n\t\t\t\t\texpanded={ false }\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-previous\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'First page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>«</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage - 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'Previous page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>‹</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %1$s: Current page number, %2$s: Total number of pages.\n\t\t\t\t\t\t\t_x( '%1$s of %2$s', 'paging' ),\n\t\t\t\t\t\t\tcurrentPage,\n\t\t\t\t\t\t\tnumPages\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-next\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage + 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Next page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>›</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( numPages ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Last page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>»</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,EAC1BC,MAAM,QACA,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtD,eAAe,SAASC,UAAUA,CAAE;EACnCC,WAAW;EACXC,QAAQ;EACRC,UAAU;EACVC;AACD,CAAC,EAAG;EACH,oBACCL,KAAA,CAACb,MAAM;IAACmB,SAAS,EAAC,gDAAgD;IAAAC,QAAA,gBACjET,IAAA,CAACP,IAAI;MAACiB,OAAO,EAAC,OAAO;MAAAD,QAAA,EAClBX,OAAO;MACR;MACAD,EAAE,CAAE,SAAS,EAAE,UAAU,EAAEU,UAAW,CAAC,EACvCA,UACD;IAAC,CACI,CAAC,EAELF,QAAQ,GAAG,CAAC,iBACbH,KAAA,CAACX,MAAM;MACNoB,QAAQ,EAAG,KAAO;MAClBC,OAAO,EAAG,CAAG;MACbC,OAAO,EAAC,YAAY;MACpBL,SAAS,EAAC,wCAAwC;MAAAC,QAAA,gBAElDP,KAAA,CAACX,MAAM;QACNoB,QAAQ,EAAG,KAAO;QAClBC,OAAO,EAAG,CAAG;QACbJ,SAAS,EAAC,iDAAiD;QAAAC,Q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T,SAAS,EAAC,+CAA+C;UAAAC,QAAA,eAEzDT,IAAA;YAAAS,QAAA,EAAM;UAAC,CAAM;QAAC,CACP,CAAC,eACTT,IAAA,CAACN,MAAM;UACNgB,OAAO,EAAC,UAAU;UAClBI,OAAO,EAAGA,CAAA,KAAMR,UAAU,CAAED,QAAS,CAAG;UACxCU,QAAQ,EAAGX,WAAW,KAAKC,QAAU;UACrC,cAAaV,EAAE,CAAE,WAAY,CAAG;UAChCqB,IAAI,EAAC,SAAS;UACdC,sBAAsB;UACtBT,SAAS,EAAC,+CAA+C;UAAAC,QAAA,eAEzDT,IAAA;YAAAS,QAAA,EAAM;UAAC,CAAM;QAAC,CACP,CAAC;MAAA,CACF,CAAC;IAAA,CACF,CACR;EAAA,CACM,CAAC;AAEX","ignoreList":[]}
1
+ {"version":3,"names":["__experimentalVStack","VStack","__experimentalHStack","HStack","__experimentalText","Text","Button","__","_x","_n","sprintf","jsx","_jsx","jsxs","_jsxs","Pagination","currentPage","numPages","changePage","totalItems","className","children","variant","expanded","spacing","justify","onClick","disabled","size","accessibleWhenDisabled"],"sources":["@wordpress/block-editor/src/components/block-patterns-paging/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\tButton,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\n\nexport default function Pagination( {\n\tcurrentPage,\n\tnumPages,\n\tchangePage,\n\ttotalItems,\n} ) {\n\treturn (\n\t\t<VStack className=\"block-editor-patterns__grid-pagination-wrapper\">\n\t\t\t<Text variant=\"muted\">\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\t_n( '%s item', '%s items', totalItems ),\n\t\t\t\t\ttotalItems\n\t\t\t\t) }\n\t\t\t</Text>\n\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<HStack\n\t\t\t\t\texpanded={ false }\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-previous\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'First page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>«</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage - 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'Previous page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>‹</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: 1: Current page number. 2: Total number of pages.\n\t\t\t\t\t\t\t_x( '%1$s of %2$s', 'paging' ),\n\t\t\t\t\t\t\tcurrentPage,\n\t\t\t\t\t\t\tnumPages\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-next\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage + 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Next page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>›</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( numPages ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Last page' ) }\n\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-button\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>»</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,EAC1BC,MAAM,QACA,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtD,eAAe,SAASC,UAAUA,CAAE;EACnCC,WAAW;EACXC,QAAQ;EACRC,UAAU;EACV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CAAC,eACTT,IAAA,CAACP,IAAI;QAACiB,OAAO,EAAC,OAAO;QAAAD,QAAA,EAClBX,OAAO;QACR;QACAF,EAAE,CAAE,cAAc,EAAE,QAAS,CAAC,EAC9BQ,WAAW,EACXC,QACD;MAAC,CACI,CAAC,eACPH,KAAA,CAACX,MAAM;QACNoB,QAAQ,EAAG,KAAO;QAClBC,OAAO,EAAG,CAAG;QACbJ,SAAS,EAAC,6CAA6C;QAAAC,QAAA,gBAEvDT,IAAA,CAACN,MAAM;UACNgB,OAAO,EAAC,UAAU;UAClBI,OAAO,EAAGA,CAAA,KAAMR,UAAU,CAAEF,WAAW,GAAG,CAAE,CAAG;UAC/CW,QAAQ,EAAGX,WAAW,KAAKC,QAAU;UACrC,cAAaV,EAAE,CAAE,WAAY,CAAG;UAChCqB,IAAI,EAAC,SAAS;UACdC,sBAAsB;UACtBT,SAAS,EAAC,+CAA+C;UAAAC,QAAA,eAEzDT,IAAA;YAAAS,QAAA,EAAM;UAAC,CAAM;QAAC,CACP,CAAC,eACTT,IAAA,CAACN,MAAM;UACNgB,OAAO,EAAC,UAAU;UAClBI,OAAO,EAAGA,CAAA,KAAMR,UAAU,CAAED,QAAS,CAAG;UACxCU,QAAQ,EAAGX,WAAW,KAAKC,QAAU;UACrC,cAAaV,EAAE,CAAE,WAAY,CAAG;UAChCqB,IAAI,EAAC,SAAS;UACdC,sBAAsB;UACtBT,SAAS,EAAC,+CAA+C;UAAAC,QAAA,eAEzDT,IAAA;YAAAS,QAAA,EAAM;UAAC,CAAM;QAAC,CACP,CAAC;MAAA,CACF,CAAC;IAAA,CACF,CACR;EAAA,CACM,CAAC;AAEX","ignoreList":[]}
@@ -8,7 +8,6 @@ import clsx from 'clsx';
8
8
  */
9
9
  import { useMergeRefs } from '@wordpress/compose';
10
10
  import { Popover } from '@wordpress/components';
11
- import { useSelect } from '@wordpress/data';
12
11
  import { forwardRef, useMemo, useReducer, useLayoutEffect } from '@wordpress/element';
13
12
 
14
13
  /**
@@ -16,9 +15,7 @@ import { forwardRef, useMemo, useReducer, useLayoutEffect } from '@wordpress/ele
16
15
  */
17
16
  import { useBlockElement } from '../block-list/use-block-props/use-block-refs';
18
17
  import usePopoverScroll from './use-popover-scroll';
19
- import { rectUnion, getVisibleElementBounds } from '../../utils/dom';
20
- import { store as blockEditorStore } from '../../store';
21
- import { unlock } from '../../lock-unlock';
18
+ import { rectUnion, getElementBounds } from '../../utils/dom';
22
19
  import { jsx as _jsx } from "react/jsx-runtime";
23
20
  const MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;
24
21
  function BlockPopover({
@@ -56,61 +53,21 @@ function BlockPopover({
56
53
  observer.disconnect();
57
54
  };
58
55
  }, [selectedElement]);
59
- const {
60
- isZoomOut,
61
- parentSectionBlock,
62
- isSectionSelected
63
- } = useSelect(select => {
64
- var _getParentSectionBloc;
65
- const {
66
- isZoomOut: isZoomOutSelector,
67
- getSectionRootClientId,
68
- getParentSectionBlock,
69
- getBlockOrder
70
- } = unlock(select(blockEditorStore));
71
- return {
72
- isZoomOut: isZoomOutSelector(),
73
- parentSectionBlock: (_getParentSectionBloc = getParentSectionBlock(clientId)) !== null && _getParentSectionBloc !== void 0 ? _getParentSectionBloc : clientId,
74
- isSectionSelected: getBlockOrder(getSectionRootClientId()).includes(clientId)
75
- };
76
- }, [clientId]);
77
-
78
- // This element is used to position the zoom out view vertical toolbar
79
- // correctly, relative to the selected section.
80
- const parentSectionElement = useBlockElement(parentSectionBlock);
81
56
  const popoverAnchor = useMemo(() => {
82
57
  if (
83
58
  // popoverDimensionsRecomputeCounter is by definition always equal or greater
84
59
  // than 0. This check is only there to satisfy the correctness of the
85
60
  // exhaustive-deps rule for the `useMemo` hook.
86
- popoverDimensionsRecomputeCounter < 0 || isZoomOut && !parentSectionElement || !selectedElement || bottomClientId && !lastSelectedElement) {
61
+ popoverDimensionsRecomputeCounter < 0 || !selectedElement || bottomClientId && !lastSelectedElement) {
87
62
  return undefined;
88
63
  }
89
64
  return {
90
65
  getBoundingClientRect() {
91
- // The zoom out view has a vertical block toolbar that should always
92
- // be on the edge of the canvas, aligned to the top of the currently
93
- // selected section. This condition changes the anchor of the toolbar
94
- // to the section instead of the block to handle blocks that are
95
- // not full width and nested blocks to keep section height.
96
- if (isZoomOut && isSectionSelected) {
97
- // Compute the height based on the parent section of the
98
- // selected block, because the selected block may be
99
- // shorter than the section.
100
- const canvasElementRect = getVisibleElementBounds(__unstableContentRef.current);
101
- const parentSectionElementRect = getVisibleElementBounds(parentSectionElement);
102
- const anchorHeight = parentSectionElementRect.bottom - parentSectionElementRect.top;
103
-
104
- // Always use the width of the section root element to make sure
105
- // the toolbar is always on the edge of the canvas.
106
- const anchorWidth = canvasElementRect.width;
107
- return new window.DOMRectReadOnly(canvasElementRect.left, parentSectionElementRect.top, anchorWidth, anchorHeight);
108
- }
109
- return lastSelectedElement ? rectUnion(getVisibleElementBounds(selectedElement), getVisibleElementBounds(lastSelectedElement)) : getVisibleElementBounds(selectedElement);
66
+ return lastSelectedElement ? rectUnion(getElementBounds(selectedElement), getElementBounds(lastSelectedElement)) : getElementBounds(selectedElement);
110
67
  },
111
68
  contextElement: selectedElement
112
69
  };
113
- }, [popoverDimensionsRecomputeCounter, isZoomOut, parentSectionElement, selectedElement, bottomClientId, lastSelectedElement, isSectionSelected, __unstableContentRef]);
70
+ }, [popoverDimensionsRecomputeCounter, selectedElement, bottomClientId, lastSelectedElement]);
114
71
  if (!selectedElement || bottomClientId && !lastSelectedElement) {
115
72
  return null;
116
73
  }
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useMergeRefs","Popover","useSelect","forwardRef","useMemo","useReducer","useLayoutEffect","useBlockElement","usePopoverScroll","rectUnion","getVisibleElementBounds","store","blockEditorStore","unlock","jsx","_jsx","MAX_POPOVER_RECOMPUTE_COUNTER","Number","MAX_SAFE_INTEGER","BlockPopover","clientId","bottomClientId","children","__unstablePopoverSlot","__unstableContentRef","shift","props","ref","selectedElement","lastSelectedElement","mergedRefs","popoverDimensionsRecomputeCounter","forceRecomputePopoverDimensions","s","observer","window","MutationObserver","observe","attributes","disconnect","isZoomOut","parentSectionBlock","isSectionSelected","select","_getParentSectionBloc","isZoomOutSelector","getSectionRootClientId","getParentSectionBlock","getBlockOrder","includes","parentSectionElement","popoverAnchor","undefined","getBoundingClientRect","canvasElementRect","current","parentSectionElementRect","anchorHeight","bottom","top","anchorWidth","width","DOMRectReadOnly","left","contextElement","animate","focusOnMount","anchor","__unstableSlotName","inline","placement","resize","flip","className","variant","PrivateBlockPopover","PublicBlockPopover"],"sources":["@wordpress/block-editor/src/components/block-popover/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { Popover } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tforwardRef,\n\tuseMemo,\n\tuseReducer,\n\tuseLayoutEffect,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\nimport { rectUnion, getVisibleElementBounds } from '../../utils/dom';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;\n\nfunction BlockPopover(\n\t{\n\t\tclientId,\n\t\tbottomClientId,\n\t\tchildren,\n\t\t__unstablePopoverSlot,\n\t\t__unstableContentRef,\n\t\tshift = true,\n\t\t...props\n\t},\n\tref\n) {\n\tconst selectedElement = useBlockElement( clientId );\n\tconst lastSelectedElement = useBlockElement( bottomClientId ?? clientId );\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tusePopoverScroll( __unstableContentRef ),\n\t] );\n\n\tconst [\n\t\tpopoverDimensionsRecomputeCounter,\n\t\tforceRecomputePopoverDimensions,\n\t] = useReducer(\n\t\t// Module is there to make sure that the counter doesn't overflow.\n\t\t( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,\n\t\t0\n\t);\n\n\t// When blocks are moved up/down, they are animated to their new position by\n\t// updating the `transform` property manually (i.e. without using CSS\n\t// transitions or animations). The animation, which can also scroll the block\n\t// editor, can sometimes cause the position of the Popover to get out of sync.\n\t// A MutationObserver is therefore used to make sure that changes to the\n\t// selectedElement's attribute (i.e. `transform`) can be tracked and used to\n\t// trigger the Popover to rerender.\n\tuseLayoutEffect( () => {\n\t\tif ( ! selectedElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst observer = new window.MutationObserver(\n\t\t\tforceRecomputePopoverDimensions\n\t\t);\n\t\tobserver.observe( selectedElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ selectedElement ] );\n\n\tconst { isZoomOut, parentSectionBlock, isSectionSelected } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisZoomOut: isZoomOutSelector,\n\t\t\t\tgetSectionRootClientId,\n\t\t\t\tgetParentSectionBlock,\n\t\t\t\tgetBlockOrder,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\treturn {\n\t\t\t\tisZoomOut: isZoomOutSelector(),\n\t\t\t\tparentSectionBlock:\n\t\t\t\t\tgetParentSectionBlock( clientId ) ?? clientId,\n\t\t\t\tisSectionSelected: getBlockOrder(\n\t\t\t\t\tgetSectionRootClientId()\n\t\t\t\t).includes( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// This element is used to position the zoom out view vertical toolbar\n\t// correctly, relative to the selected section.\n\tconst parentSectionElement = useBlockElement( parentSectionBlock );\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tif (\n\t\t\t// popoverDimensionsRecomputeCounter is by definition always equal or greater\n\t\t\t// than 0. This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverDimensionsRecomputeCounter < 0 ||\n\t\t\t( isZoomOut && ! parentSectionElement ) ||\n\t\t\t! selectedElement ||\n\t\t\t( bottomClientId && ! lastSelectedElement )\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tgetBoundingClientRect() {\n\t\t\t\t// The zoom out view has a vertical block toolbar that should always\n\t\t\t\t// be on the edge of the canvas, aligned to the top of the currently\n\t\t\t\t// selected section. This condition changes the anchor of the toolbar\n\t\t\t\t// to the section instead of the block to handle blocks that are\n\t\t\t\t// not full width and nested blocks to keep section height.\n\t\t\t\tif ( isZoomOut && isSectionSelected ) {\n\t\t\t\t\t// Compute the height based on the parent section of the\n\t\t\t\t\t// selected block, because the selected block may be\n\t\t\t\t\t// shorter than the section.\n\t\t\t\t\tconst canvasElementRect = getVisibleElementBounds(\n\t\t\t\t\t\t__unstableContentRef.current\n\t\t\t\t\t);\n\t\t\t\t\tconst parentSectionElementRect =\n\t\t\t\t\t\tgetVisibleElementBounds( parentSectionElement );\n\t\t\t\t\tconst anchorHeight =\n\t\t\t\t\t\tparentSectionElementRect.bottom -\n\t\t\t\t\t\tparentSectionElementRect.top;\n\n\t\t\t\t\t// Always use the width of the section root element to make sure\n\t\t\t\t\t// the toolbar is always on the edge of the canvas.\n\t\t\t\t\tconst anchorWidth = canvasElementRect.width;\n\t\t\t\t\treturn new window.DOMRectReadOnly(\n\t\t\t\t\t\tcanvasElementRect.left,\n\t\t\t\t\t\tparentSectionElementRect.top,\n\t\t\t\t\t\tanchorWidth,\n\t\t\t\t\t\tanchorHeight\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn lastSelectedElement\n\t\t\t\t\t? rectUnion(\n\t\t\t\t\t\t\tgetVisibleElementBounds( selectedElement ),\n\t\t\t\t\t\t\tgetVisibleElementBounds( lastSelectedElement )\n\t\t\t\t\t )\n\t\t\t\t\t: getVisibleElementBounds( selectedElement );\n\t\t\t},\n\t\t\tcontextElement: selectedElement,\n\t\t};\n\t}, [\n\t\tpopoverDimensionsRecomputeCounter,\n\t\tisZoomOut,\n\t\tparentSectionElement,\n\t\tselectedElement,\n\t\tbottomClientId,\n\t\tlastSelectedElement,\n\t\tisSectionSelected,\n\t\t__unstableContentRef,\n\t] );\n\n\tif ( ! selectedElement || ( bottomClientId && ! lastSelectedElement ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tref={ mergedRefs }\n\t\t\tanimate={ false }\n\t\t\tfocusOnMount={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot }\n\t\t\tinline={ ! __unstablePopoverSlot }\n\t\t\tplacement=\"top-start\"\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tshift={ shift }\n\t\t\t{ ...props }\n\t\t\tclassName={ clsx( 'block-editor-block-popover', props.className ) }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t{ children }\n\t\t</Popover>\n\t);\n}\n\nexport const PrivateBlockPopover = forwardRef( BlockPopover );\n\nconst PublicBlockPopover = (\n\t{ clientId, bottomClientId, children, ...props },\n\tref\n) => (\n\t<PrivateBlockPopover\n\t\t{ ...props }\n\t\tbottomClientId={ bottomClientId }\n\t\tclientId={ clientId }\n\t\t__unstableContentRef={ undefined }\n\t\t__unstablePopoverSlot={ undefined }\n\t\tref={ ref }\n\t>\n\t\t{ children }\n\t</PrivateBlockPopover>\n);\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-popover/README.md\n */\nexport default forwardRef( PublicBlockPopover );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,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AGA,CAC1B;EAAExD,QAAQ;EAAEC,cAAc;EAAEC,QAAQ;EAAE,GAAGI;AAAM,CAAC,EAChDC,GAAG,kBAEHZ,IAAA,CAAC4D,mBAAmB;EAAA,GACdjD,KAAK;EACVL,cAAc,EAAGA,cAAgB;EACjCD,QAAQ,EAAGA,QAAU;EACrBI,oBAAoB,EAAG4B,SAAW;EAClC7B,qBAAqB,EAAG6B,SAAW;EACnCzB,GAAG,EAAGA,GAAK;EAAAL,QAAA,EAETA;AAAQ,CACU,CACrB;;AAED;AACA;AACA;AACA,eAAenB,UAAU,CAAEyE,kBAAmB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useMergeRefs","Popover","forwardRef","useMemo","useReducer","useLayoutEffect","useBlockElement","usePopoverScroll","rectUnion","getElementBounds","jsx","_jsx","MAX_POPOVER_RECOMPUTE_COUNTER","Number","MAX_SAFE_INTEGER","BlockPopover","clientId","bottomClientId","children","__unstablePopoverSlot","__unstableContentRef","shift","props","ref","selectedElement","lastSelectedElement","mergedRefs","popoverDimensionsRecomputeCounter","forceRecomputePopoverDimensions","s","observer","window","MutationObserver","observe","attributes","disconnect","popoverAnchor","undefined","getBoundingClientRect","contextElement","animate","focusOnMount","anchor","__unstableSlotName","inline","placement","resize","flip","className","variant","PrivateBlockPopover","PublicBlockPopover"],"sources":["@wordpress/block-editor/src/components/block-popover/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { Popover } from '@wordpress/components';\nimport {\n\tforwardRef,\n\tuseMemo,\n\tuseReducer,\n\tuseLayoutEffect,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\nimport { rectUnion, getElementBounds } from '../../utils/dom';\n\nconst MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;\n\nfunction BlockPopover(\n\t{\n\t\tclientId,\n\t\tbottomClientId,\n\t\tchildren,\n\t\t__unstablePopoverSlot,\n\t\t__unstableContentRef,\n\t\tshift = true,\n\t\t...props\n\t},\n\tref\n) {\n\tconst selectedElement = useBlockElement( clientId );\n\tconst lastSelectedElement = useBlockElement( bottomClientId ?? clientId );\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tusePopoverScroll( __unstableContentRef ),\n\t] );\n\n\tconst [\n\t\tpopoverDimensionsRecomputeCounter,\n\t\tforceRecomputePopoverDimensions,\n\t] = useReducer(\n\t\t// Module is there to make sure that the counter doesn't overflow.\n\t\t( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,\n\t\t0\n\t);\n\n\t// When blocks are moved up/down, they are animated to their new position by\n\t// updating the `transform` property manually (i.e. without using CSS\n\t// transitions or animations). The animation, which can also scroll the block\n\t// editor, can sometimes cause the position of the Popover to get out of sync.\n\t// A MutationObserver is therefore used to make sure that changes to the\n\t// selectedElement's attribute (i.e. `transform`) can be tracked and used to\n\t// trigger the Popover to rerender.\n\tuseLayoutEffect( () => {\n\t\tif ( ! selectedElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst observer = new window.MutationObserver(\n\t\t\tforceRecomputePopoverDimensions\n\t\t);\n\t\tobserver.observe( selectedElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ selectedElement ] );\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tif (\n\t\t\t// popoverDimensionsRecomputeCounter is by definition always equal or greater\n\t\t\t// than 0. This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverDimensionsRecomputeCounter < 0 ||\n\t\t\t! selectedElement ||\n\t\t\t( bottomClientId && ! lastSelectedElement )\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tgetBoundingClientRect() {\n\t\t\t\treturn lastSelectedElement\n\t\t\t\t\t? rectUnion(\n\t\t\t\t\t\t\tgetElementBounds( selectedElement ),\n\t\t\t\t\t\t\tgetElementBounds( lastSelectedElement )\n\t\t\t\t\t )\n\t\t\t\t\t: getElementBounds( selectedElement );\n\t\t\t},\n\t\t\tcontextElement: selectedElement,\n\t\t};\n\t}, [\n\t\tpopoverDimensionsRecomputeCounter,\n\t\tselectedElement,\n\t\tbottomClientId,\n\t\tlastSelectedElement,\n\t] );\n\n\tif ( ! selectedElement || ( bottomClientId && ! lastSelectedElement ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tref={ mergedRefs }\n\t\t\tanimate={ false }\n\t\t\tfocusOnMount={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot }\n\t\t\tinline={ ! __unstablePopoverSlot }\n\t\t\tplacement=\"top-start\"\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tshift={ shift }\n\t\t\t{ ...props }\n\t\t\tclassName={ clsx( 'block-editor-block-popover', props.className ) }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t{ children }\n\t\t</Popover>\n\t);\n}\n\nexport const PrivateBlockPopover = forwardRef( BlockPopover );\n\nconst PublicBlockPopover = (\n\t{ clientId, bottomClientId, children, ...props },\n\tref\n) => (\n\t<PrivateBlockPopover\n\t\t{ ...props }\n\t\tbottomClientId={ bottomClientId }\n\t\tclientId={ clientId }\n\t\t__unstableContentRef={ undefined }\n\t\t__unstablePopoverSlot={ undefined }\n\t\tref={ ref }\n\t>\n\t\t{ children }\n\t</PrivateBlockPopover>\n);\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-popover/README.md\n */\nexport default forwardRef( PublicBlockPopover );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM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AAkB,GAAGA,CAC1B;EAAEnC,QAAQ;EAAEC,cAAc;EAAEC,QAAQ;EAAE,GAAGI;AAAM,CAAC,EAChDC,GAAG,kBAEHZ,IAAA,CAACuC,mBAAmB;EAAA,GACd5B,KAAK;EACVL,cAAc,EAAGA,cAAgB;EACjCD,QAAQ,EAAGA,QAAU;EACrBI,oBAAoB,EAAGiB,SAAW;EAClClB,qBAAqB,EAAGkB,SAAW;EACnCd,GAAG,EAAGA,GAAK;EAAAL,QAAA,EAETA;AAAQ,CACU,CACrB;;AAED;AACA;AACA;AACA,eAAehB,UAAU,CAAEiD,kBAAmB,CAAC","ignoreList":[]}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useEffect, useState, flushSync } from '@wordpress/element';
5
+ import { createQueue } from '@wordpress/priority-queue';
6
+ const blockPreviewQueue = createQueue();
7
+
8
+ /**
9
+ * Renders a component at the next idle time.
10
+ * @param {*} props
11
+ */
12
+ export function Async({
13
+ children,
14
+ placeholder
15
+ }) {
16
+ const [shouldRender, setShouldRender] = useState(false);
17
+
18
+ // In the future, we could try to use startTransition here, but currently
19
+ // react will batch all transitions, which means all previews will be
20
+ // rendered at the same time.
21
+ // https://react.dev/reference/react/startTransition#caveats
22
+ // > If there are multiple ongoing Transitions, React currently batches them
23
+ // > together. This is a limitation that will likely be removed in a future
24
+ // > release.
25
+
26
+ useEffect(() => {
27
+ const context = {};
28
+ blockPreviewQueue.add(context, () => {
29
+ // Synchronously run all renders so it consumes timeRemaining.
30
+ // See https://github.com/WordPress/gutenberg/pull/48238
31
+ flushSync(() => {
32
+ setShouldRender(true);
33
+ });
34
+ });
35
+ return () => {
36
+ blockPreviewQueue.cancel(context);
37
+ };
38
+ }, []);
39
+ if (!shouldRender) {
40
+ return placeholder;
41
+ }
42
+ return children;
43
+ }
44
+ //# sourceMappingURL=async.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useEffect","useState","flushSync","createQueue","blockPreviewQueue","Async","children","placeholder","shouldRender","setShouldRender","context","add","cancel"],"sources":["@wordpress/block-editor/src/components/block-preview/async.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, flushSync } from '@wordpress/element';\nimport { createQueue } from '@wordpress/priority-queue';\n\nconst blockPreviewQueue = createQueue();\n\n/**\n * Renders a component at the next idle time.\n * @param {*} props\n */\nexport function Async( { children, placeholder } ) {\n\tconst [ shouldRender, setShouldRender ] = useState( false );\n\n\t// In the future, we could try to use startTransition here, but currently\n\t// react will batch all transitions, which means all previews will be\n\t// rendered at the same time.\n\t// https://react.dev/reference/react/startTransition#caveats\n\t// > If there are multiple ongoing Transitions, React currently batches them\n\t// > together. This is a limitation that will likely be removed in a future\n\t// > release.\n\n\tuseEffect( () => {\n\t\tconst context = {};\n\t\tblockPreviewQueue.add( context, () => {\n\t\t\t// Synchronously run all renders so it consumes timeRemaining.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/48238\n\t\t\tflushSync( () => {\n\t\t\t\tsetShouldRender( true );\n\t\t\t} );\n\t\t} );\n\t\treturn () => {\n\t\t\tblockPreviewQueue.cancel( context );\n\t\t};\n\t}, [] );\n\n\tif ( ! shouldRender ) {\n\t\treturn placeholder;\n\t}\n\n\treturn children;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AACnE,SAASC,WAAW,QAAQ,2BAA2B;AAEvD,MAAMC,iBAAiB,GAAGD,WAAW,CAAC,CAAC;;AAEvC;AACA;AACA;AACA;AACA,OAAO,SAASE,KAAKA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EAClD,MAAM,CAAEC,YAAY,EAAEC,eAAe,CAAE,GAAGR,QAAQ,CAAE,KAAM,CAAC;;EAE3D;EACA;EACA;EACA;EACA;EACA;EACA;;EAEAD,SAAS,CAAE,MAAM;IAChB,MAAMU,OAAO,GAAG,CAAC,CAAC;IAClBN,iBAAiB,CAACO,GAAG,CAAED,OAAO,EAAE,MAAM;MACrC;MACA;MACAR,SAAS,CAAE,MAAM;QAChBO,eAAe,CAAE,IAAK,CAAC;MACxB,CAAE,CAAC;IACJ,CAAE,CAAC;IACH,OAAO,MAAM;MACZL,iBAAiB,CAACQ,MAAM,CAAEF,OAAQ,CAAC;IACpC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEF,YAAY,EAAG;IACrB,OAAOD,WAAW;EACnB;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
@@ -19,6 +19,7 @@ import AutoHeightBlockPreview from './auto';
19
19
  import EditorStyles from '../editor-styles';
20
20
  import { store as blockEditorStore } from '../../store';
21
21
  import { BlockListItems } from '../block-list';
22
+ import { Async } from './async';
22
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
24
  const EMPTY_ADDITIONAL_STYLES = [];
24
25
  export function BlockPreview({
@@ -53,7 +54,7 @@ export function BlockPreview({
53
54
  ...originalSettings,
54
55
  focusMode: false,
55
56
  // Disable "Spotlight mode".
56
- __unstableIsPreviewMode: true
57
+ isPreviewMode: true
57
58
  }), [originalSettings]);
58
59
  const renderedBlocks = useMemo(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]);
59
60
  if (!blocks || blocks.length === 0) {
@@ -69,6 +70,8 @@ export function BlockPreview({
69
70
  })
70
71
  });
71
72
  }
73
+ const MemoizedBlockPreview = memo(BlockPreview);
74
+ MemoizedBlockPreview.Async = Async;
72
75
 
73
76
  /**
74
77
  * BlockPreview renders a preview of a block or array of blocks.
@@ -81,7 +84,7 @@ export function BlockPreview({
81
84
  *
82
85
  * @return {Component} The component to be rendered.
83
86
  */
84
- export default memo(BlockPreview);
87
+ export default MemoizedBlockPreview;
85
88
 
86
89
  /**
87
90
  * This hook is used to lightly mark an element as a block preview wrapper
@@ -110,7 +113,7 @@ export function useBlockPreview({
110
113
  // Clear styles included by the parent settings, as they are already output by the parent's EditorStyles.
111
114
  focusMode: false,
112
115
  // Disable "Spotlight mode".
113
- __unstableIsPreviewMode: true
116
+ isPreviewMode: true
114
117
  }), [originalSettings]);
115
118
  const disabledRef = useDisabled();
116
119
  const ref = useMergeRefs([props.ref, disabledRef]);
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useDisabled","useMergeRefs","useSelect","memo","useMemo","deprecated","ExperimentalBlockEditorProvider","AutoHeightBlockPreview","EditorStyles","store","blockEditorStore","BlockListItems","jsx","_jsx","jsxs","_jsxs","EMPTY_ADDITIONAL_STYLES","BlockPreview","blocks","viewportWidth","minHeight","additionalStyles","__experimentalMinHeight","__experimentalPadding","since","version","alternative","css","originalSettings","select","getSettings","settings","focusMode","__unstableIsPreviewMode","renderedBlocks","Array","isArray","length","value","children","useBlockPreview","props","layout","styles","undefined","disabledRef","ref","renderAppender","className"],"sources":["@wordpress/block-editor/src/components/block-preview/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDisabled, useMergeRefs } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { memo, useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { ExperimentalBlockEditorProvider } from '../provider';\nimport AutoHeightBlockPreview from './auto';\nimport EditorStyles from '../editor-styles';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockListItems } from '../block-list';\n\nconst EMPTY_ADDITIONAL_STYLES = [];\n\nexport function BlockPreview( {\n\tblocks,\n\tviewportWidth = 1200,\n\tminHeight,\n\tadditionalStyles = EMPTY_ADDITIONAL_STYLES,\n\t// Deprecated props:\n\t__experimentalMinHeight,\n\t__experimentalPadding,\n} ) {\n\tif ( __experimentalMinHeight ) {\n\t\tminHeight = __experimentalMinHeight;\n\t\tdeprecated( 'The __experimentalMinHeight prop', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t\talternative: 'minHeight',\n\t\t} );\n\t}\n\tif ( __experimentalPadding ) {\n\t\tadditionalStyles = [\n\t\t\t...additionalStyles,\n\t\t\t{ css: `body { padding: ${ __experimentalPadding }px; }` },\n\t\t];\n\t\tdeprecated( 'The __experimentalPadding prop of BlockPreview', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t\talternative: 'additionalStyles',\n\t\t} );\n\t}\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tfocusMode: false, // Disable \"Spotlight mode\".\n\t\t\t__unstableIsPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tif ( ! blocks || blocks.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tvalue={ renderedBlocks }\n\t\t\tsettings={ settings }\n\t\t>\n\t\t\t<AutoHeightBlockPreview\n\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tadditionalStyles={ additionalStyles }\n\t\t\t/>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n\n/**\n * BlockPreview renders a preview of a block or array of blocks.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-preview/README.md\n *\n * @param {Object} preview options for how the preview should be shown\n * @param {Array|Object} preview.blocks A block instance (object) or an array of blocks to be previewed.\n * @param {number} preview.viewportWidth Width of the preview container in pixels. Controls at what size the blocks will be rendered inside the preview. Default: 700.\n *\n * @return {Component} The component to be rendered.\n */\nexport default memo( BlockPreview );\n\n/**\n * This hook is used to lightly mark an element as a block preview wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * a block preview wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} options Preview options.\n * @param {WPBlock[]} options.blocks Block objects.\n * @param {Object} options.props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options.layout Layout settings to be used in the preview.\n */\nexport function useBlockPreview( { blocks, props = {}, layout } ) {\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tstyles: undefined, // Clear styles included by the parent settings, as they are already output by the parent's EditorStyles.\n\t\t\tfocusMode: false, // Disable \"Spotlight mode\".\n\t\t\t__unstableIsPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\tconst disabledRef = useDisabled();\n\tconst ref = useMergeRefs( [ props.ref, disabledRef ] );\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst children = (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tvalue={ renderedBlocks }\n\t\t\tsettings={ settings }\n\t\t>\n\t\t\t<EditorStyles />\n\t\t\t<BlockListItems renderAppender={ false } layout={ layout } />\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: clsx(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-preview__live-content',\n\t\t\t'components-disabled'\n\t\t),\n\t\tchildren: blocks?.length ? children : null,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,WAAW,EAAEC,YAAY,QAAQ,oBAAoB;AAC9D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,IAAI,EAAEC,OAAO,QAAQ,oBAAo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ED,WAAW,CAAG,CAAC;EACtD,MAAMX,cAAc,GAAG9B,OAAO,CAC7B,MAAQ+B,KAAK,CAACC,OAAO,CAAElB,MAAO,CAAC,GAAGA,MAAM,GAAG,CAAEA,MAAM,CAAI,EACvD,CAAEA,MAAM,CACT,CAAC;EAED,MAAMqB,QAAQ,gBACbxB,KAAA,CAACT,+BAA+B;IAC/BgC,KAAK,EAAGJ,cAAgB;IACxBH,QAAQ,EAAGA,QAAU;IAAAQ,QAAA,gBAErB1B,IAAA,CAACL,YAAY,IAAE,CAAC,eAChBK,IAAA,CAACF,cAAc;MAACoC,cAAc,EAAG,KAAO;MAACL,MAAM,EAAGA;IAAQ,CAAE,CAAC;EAAA,CAC7B,CACjC;EAED,OAAO;IACN,GAAGD,KAAK;IACRK,GAAG;IACHE,SAAS,EAAEjD,IAAI,CACd0C,KAAK,CAACO,SAAS,EACf,0CAA0C,EAC1C,qBACD,CAAC;IACDT,QAAQ,EAAErB,MAAM,EAAEmB,MAAM,GAAGE,QAAQ,GAAG;EACvC,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useDisabled","useMergeRefs","useSelect","memo","useMemo","deprecated","ExperimentalBlockEditorProvider","AutoHeightBlockPreview","EditorStyles","store","blockEditorStore","BlockListItems","Async","jsx","_jsx","jsxs","_jsxs","EMPTY_ADDITIONAL_STYLES","BlockPreview","blocks","viewportWidth","minHeight","additionalStyles","__experimentalMinHeight","__experimentalPadding","since","version","alternative","css","originalSettings","select","getSettings","settings","focusMode","isPreviewMode","renderedBlocks","Array","isArray","length","value","children","MemoizedBlockPreview","useBlockPreview","props","layout","styles","undefined","disabledRef","ref","renderAppender","className"],"sources":["@wordpress/block-editor/src/components/block-preview/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useDisabled, useMergeRefs } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { memo, useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { ExperimentalBlockEditorProvider } from '../provider';\nimport AutoHeightBlockPreview from './auto';\nimport EditorStyles from '../editor-styles';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockListItems } from '../block-list';\nimport { Async } from './async';\n\nconst EMPTY_ADDITIONAL_STYLES = [];\n\nexport function BlockPreview( {\n\tblocks,\n\tviewportWidth = 1200,\n\tminHeight,\n\tadditionalStyles = EMPTY_ADDITIONAL_STYLES,\n\t// Deprecated props:\n\t__experimentalMinHeight,\n\t__experimentalPadding,\n} ) {\n\tif ( __experimentalMinHeight ) {\n\t\tminHeight = __experimentalMinHeight;\n\t\tdeprecated( 'The __experimentalMinHeight prop', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t\talternative: 'minHeight',\n\t\t} );\n\t}\n\tif ( __experimentalPadding ) {\n\t\tadditionalStyles = [\n\t\t\t...additionalStyles,\n\t\t\t{ css: `body { padding: ${ __experimentalPadding }px; }` },\n\t\t];\n\t\tdeprecated( 'The __experimentalPadding prop of BlockPreview', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t\talternative: 'additionalStyles',\n\t\t} );\n\t}\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tfocusMode: false, // Disable \"Spotlight mode\".\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tif ( ! blocks || blocks.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tvalue={ renderedBlocks }\n\t\t\tsettings={ settings }\n\t\t>\n\t\t\t<AutoHeightBlockPreview\n\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tadditionalStyles={ additionalStyles }\n\t\t\t/>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n\nconst MemoizedBlockPreview = memo( BlockPreview );\n\nMemoizedBlockPreview.Async = Async;\n\n/**\n * BlockPreview renders a preview of a block or array of blocks.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-preview/README.md\n *\n * @param {Object} preview options for how the preview should be shown\n * @param {Array|Object} preview.blocks A block instance (object) or an array of blocks to be previewed.\n * @param {number} preview.viewportWidth Width of the preview container in pixels. Controls at what size the blocks will be rendered inside the preview. Default: 700.\n *\n * @return {Component} The component to be rendered.\n */\nexport default MemoizedBlockPreview;\n\n/**\n * This hook is used to lightly mark an element as a block preview wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * a block preview wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} options Preview options.\n * @param {WPBlock[]} options.blocks Block objects.\n * @param {Object} options.props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options.layout Layout settings to be used in the preview.\n */\nexport function useBlockPreview( { blocks, props = {}, layout } ) {\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tstyles: undefined, // Clear styles included by the parent settings, as they are already output by the parent's EditorStyles.\n\t\t\tfocusMode: false, // Disable \"Spotlight mode\".\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\tconst disabledRef = useDisabled();\n\tconst ref = useMergeRefs( [ props.ref, disabledRef ] );\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst children = (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tvalue={ renderedBlocks }\n\t\t\tsettings={ settings }\n\t\t>\n\t\t\t<EditorStyles />\n\t\t\t<BlockListItems renderAppender={ false } layout={ layout } />\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: clsx(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-preview__live-content',\n\t\t\t'components-disabled'\n\t\t),\n\t\tchildren: blocks?.length ? children : null,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,WAAW,EAAEC,YAAY,QAAQ,oBAAoB;AAC9D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,IAAI,EAAEC,OAAO,QAAQ,oBAAoB;AAClD,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,+BAA+B,QAAQ,aAAa;AAC7D,OAAOC,sBAAsB,MAAM,QAAQ;AAC3C,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,KAAK,QAAQ,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEhC,MAAMC,uBAAuB,GAAG,EAAE;AAElC,OAAO,SAASC,YAAYA,CAAE;EAC7BC,MAAM;EACNC,aAAa,GAAG,IAAI;EACpBC,SAAS;EACTC,gBAAgB,GAAGL,uBAAuB;EAC1C;EACAM,uBAAuB;EACvBC;AACD,CAAC,EAAG;EACH,IAAKD,uBAAuB,EAAG;IAC9BF,SAAS,GAAGE,uBAAuB;IACnClB,UAAU,CAAE,kCAAkC,EAAE;MAC/CoB,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,K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C,EAC1C,qBACD,CAAC;IACDV,QAAQ,EAAErB,MAAM,EAAEmB,MAAM,GAAGE,QAAQ,GAAG;EACvC,CAAC;AACF","ignoreList":[]}
@@ -15,6 +15,7 @@ import { pipe, useCopyToClipboard } from '@wordpress/compose';
15
15
  * Internal dependencies
16
16
  */
17
17
  import BlockActions from '../block-actions';
18
+ import __unstableCommentIconFill from '../../components/collab/block-comment-icon-slot';
18
19
  import BlockHTMLConvertButton from './block-html-convert-button';
19
20
  import __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';
20
21
  import BlockSettingsMenuControls from '../block-settings-menu-controls';
@@ -212,6 +213,10 @@ export function BlockSettingsDropdown({
212
213
  shortcut: shortcuts.insertAfter,
213
214
  children: __('Add after')
214
215
  })]
216
+ }), /*#__PURE__*/_jsx(__unstableCommentIconFill.Slot, {
217
+ fillProps: {
218
+ onClose
219
+ }
215
220
  })]
216
221
  }), canCopyStyles && !isContentOnly && /*#__PURE__*/_jsxs(MenuGroup, {
217
222
  children: [/*#__PURE__*/_jsx(CopyMenuItem, {