@wordpress/block-editor 11.2.0 → 11.3.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 (660) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +28 -4
  3. package/build/components/alignment-control/ui.js +1 -1
  4. package/build/components/alignment-control/ui.js.map +1 -1
  5. package/build/components/autocomplete/index.js +2 -7
  6. package/build/components/autocomplete/index.js.map +1 -1
  7. package/build/components/block-alignment-matrix-control/index.js +2 -2
  8. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  9. package/build/components/block-card/index.js +2 -4
  10. package/build/components/block-card/index.js.map +1 -1
  11. package/build/components/block-edit/index.js +8 -0
  12. package/build/components/block-edit/index.js.map +1 -1
  13. package/build/components/block-inspector/index.js +15 -14
  14. package/build/components/block-inspector/index.js.map +1 -1
  15. package/build/components/block-list/use-in-between-inserter.js +5 -0
  16. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  17. package/build/components/block-lock/modal.js +0 -1
  18. package/build/components/block-lock/modal.js.map +1 -1
  19. package/build/components/block-mover/mover-description.js +2 -2
  20. package/build/components/block-mover/mover-description.js.map +1 -1
  21. package/build/components/block-navigation/dropdown.js +3 -1
  22. package/build/components/block-navigation/dropdown.js.map +1 -1
  23. package/build/components/block-pattern-setup/index.js +1 -1
  24. package/build/components/block-pattern-setup/index.js.map +1 -1
  25. package/build/components/block-pattern-setup/use-patterns-setup.js +2 -2
  26. package/build/components/block-pattern-setup/use-patterns-setup.js.map +1 -1
  27. package/build/components/block-patterns-list/index.js +31 -3
  28. package/build/components/block-patterns-list/index.js.map +1 -1
  29. package/build/components/block-preview/auto.js +9 -11
  30. package/build/components/block-preview/auto.js.map +1 -1
  31. package/build/components/block-preview/index.js +32 -8
  32. package/build/components/block-preview/index.js.map +1 -1
  33. package/build/components/block-selection-clearer/index.js +1 -1
  34. package/build/components/block-selection-clearer/index.js.map +1 -1
  35. package/build/components/block-settings/container.native.js +7 -33
  36. package/build/components/block-settings/container.native.js.map +1 -1
  37. package/build/components/block-settings-menu/block-settings-dropdown.js +12 -6
  38. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  39. package/build/components/block-settings-menu-controls/index.js +2 -8
  40. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  41. package/build/components/block-switcher/utils.js +1 -1
  42. package/build/components/block-switcher/utils.js.map +1 -1
  43. package/build/components/block-tools/selected-block-popover.js +55 -47
  44. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  45. package/build/components/block-vertical-alignment-control/icons.js +15 -1
  46. package/build/components/block-vertical-alignment-control/icons.js.map +1 -1
  47. package/build/components/block-vertical-alignment-control/ui.js +9 -4
  48. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  49. package/build/components/color-style-selector/index.js +3 -1
  50. package/build/components/color-style-selector/index.js.map +1 -1
  51. package/build/components/date-format-picker/index.js +3 -4
  52. package/build/components/date-format-picker/index.js.map +1 -1
  53. package/build/components/font-family/index.js +1 -7
  54. package/build/components/font-family/index.js.map +1 -1
  55. package/build/components/font-sizes/fluid-utils.js +1 -1
  56. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  57. package/build/components/font-sizes/utils.js +1 -1
  58. package/build/components/font-sizes/utils.js.map +1 -1
  59. package/build/components/global-styles/context.js +22 -0
  60. package/build/components/global-styles/context.js.map +1 -0
  61. package/build/components/global-styles/hooks.js +142 -0
  62. package/build/components/global-styles/hooks.js.map +1 -0
  63. package/build/components/global-styles/index.js +42 -0
  64. package/build/components/global-styles/index.js.map +1 -0
  65. package/build/components/global-styles/typography-utils.js +92 -0
  66. package/build/components/global-styles/typography-utils.js.map +1 -0
  67. package/build/components/global-styles/use-global-styles-output.js +974 -0
  68. package/build/components/global-styles/use-global-styles-output.js.map +1 -0
  69. package/build/components/global-styles/utils.js +340 -0
  70. package/build/components/global-styles/utils.js.map +1 -0
  71. package/build/components/height-control/index.js +13 -1
  72. package/build/components/height-control/index.js.map +1 -1
  73. package/build/components/image-editor/constants.js +1 -1
  74. package/build/components/image-editor/constants.js.map +1 -1
  75. package/build/components/image-editor/context.js +1 -2
  76. package/build/components/image-editor/context.js.map +1 -1
  77. package/build/components/image-editor/cropper.js +3 -1
  78. package/build/components/image-editor/cropper.js.map +1 -1
  79. package/build/components/image-editor/index.js +13 -9
  80. package/build/components/image-editor/index.js.map +1 -1
  81. package/build/components/image-editor/use-transform-image.js +11 -35
  82. package/build/components/image-editor/use-transform-image.js.map +1 -1
  83. package/build/components/image-size-control/index.js +1 -7
  84. package/build/components/image-size-control/index.js.map +1 -1
  85. package/build/components/index.js +8 -24
  86. package/build/components/index.js.map +1 -1
  87. package/build/components/inner-blocks/index.js +22 -32
  88. package/build/components/inner-blocks/index.js.map +1 -1
  89. package/build/components/inner-blocks/index.native.js +8 -23
  90. package/build/components/inner-blocks/index.native.js.map +1 -1
  91. package/build/components/inner-blocks/use-block-context.js +53 -0
  92. package/build/components/inner-blocks/use-block-context.js.map +1 -0
  93. package/build/components/inserter/block-patterns-explorer/explorer.js +0 -1
  94. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  95. package/build/components/inserter/block-patterns-tab.js +7 -1
  96. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  97. package/build/components/inserter/block-types-tab.js +2 -2
  98. package/build/components/inserter/block-types-tab.js.map +1 -1
  99. package/build/components/inserter/hooks/use-patterns-state.js +1 -7
  100. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  101. package/build/components/inserter/index.js +5 -4
  102. package/build/components/inserter/index.js.map +1 -1
  103. package/build/components/inserter/media-tab/hooks.js +142 -56
  104. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  105. package/build/components/inserter/media-tab/media-list.js +74 -21
  106. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  107. package/build/components/inserter/media-tab/media-panel.js +11 -13
  108. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  109. package/build/components/inserter/media-tab/media-tab.js +6 -3
  110. package/build/components/inserter/media-tab/media-tab.js.map +1 -1
  111. package/build/components/inserter/media-tab/utils.js +26 -15
  112. package/build/components/inserter/media-tab/utils.js.map +1 -1
  113. package/build/components/inserter/menu.js +1 -0
  114. package/build/components/inserter/menu.js.map +1 -1
  115. package/build/components/inserter/preview-panel.js +5 -3
  116. package/build/components/inserter/preview-panel.js.map +1 -1
  117. package/build/components/inserter/search-results.js +2 -7
  118. package/build/components/inserter/search-results.js.map +1 -1
  119. package/build/components/inserter-list-item/index.js +1 -9
  120. package/build/components/inserter-list-item/index.js.map +1 -1
  121. package/build/components/inspector-controls/fill.js +15 -2
  122. package/build/components/inspector-controls/fill.js.map +1 -1
  123. package/build/components/inspector-controls/fill.native.js +14 -1
  124. package/build/components/inspector-controls/fill.native.js.map +1 -1
  125. package/build/components/inspector-controls/groups.js +4 -0
  126. package/build/components/inspector-controls/groups.js.map +1 -1
  127. package/build/components/inspector-controls/index.js +2 -2
  128. package/build/components/inspector-controls/index.js.map +1 -1
  129. package/build/components/inspector-controls/slot.js +14 -1
  130. package/build/components/inspector-controls/slot.js.map +1 -1
  131. package/build/components/inspector-controls/slot.native.js +14 -1
  132. package/build/components/inspector-controls/slot.native.js.map +1 -1
  133. package/build/components/inspector-controls-tabs/advanced-controls-panel.js +1 -1
  134. package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -1
  135. package/build/components/inspector-controls-tabs/index.js +2 -2
  136. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  137. package/build/components/inspector-controls-tabs/position-controls-panel.js +1 -1
  138. package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  139. package/build/components/inspector-controls-tabs/styles-tab.js +6 -4
  140. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  141. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +17 -12
  142. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  143. package/build/components/justify-content-control/ui.js +8 -1
  144. package/build/components/justify-content-control/ui.js.map +1 -1
  145. package/build/components/link-control/index.js +45 -17
  146. package/build/components/link-control/index.js.map +1 -1
  147. package/build/components/list-view/block.js +1 -1
  148. package/build/components/list-view/block.js.map +1 -1
  149. package/build/components/list-view/use-list-view-drop-zone.js +1 -1
  150. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  151. package/build/components/media-upload/index.native.js +4 -1
  152. package/build/components/media-upload/index.native.js.map +1 -1
  153. package/build/components/off-canvas-editor/appender.js +50 -3
  154. package/build/components/off-canvas-editor/appender.js.map +1 -1
  155. package/build/components/off-canvas-editor/block-select-button.js +10 -4
  156. package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
  157. package/build/components/off-canvas-editor/block.js +6 -27
  158. package/build/components/off-canvas-editor/block.js.map +1 -1
  159. package/build/components/off-canvas-editor/branch.js +25 -10
  160. package/build/components/off-canvas-editor/branch.js.map +1 -1
  161. package/build/components/off-canvas-editor/index.js +11 -16
  162. package/build/components/off-canvas-editor/index.js.map +1 -1
  163. package/build/components/off-canvas-editor/link-ui.js +2 -2
  164. package/build/components/off-canvas-editor/link-ui.js.map +1 -1
  165. package/build/components/off-canvas-editor/use-list-view-drop-zone.js +1 -1
  166. package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -1
  167. package/build/components/provider/index.js +21 -9
  168. package/build/components/provider/index.js.map +1 -1
  169. package/build/components/provider/index.native.js +5 -6
  170. package/build/components/provider/index.native.js.map +1 -1
  171. package/build/components/rich-text/use-before-input-rules.js +11 -3
  172. package/build/components/rich-text/use-before-input-rules.js.map +1 -1
  173. package/build/components/rich-text/utils.js +1 -1
  174. package/build/components/rich-text/utils.js.map +1 -1
  175. package/build/components/spacing-sizes-control/utils.js +2 -8
  176. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  177. package/build/components/tool-selector/index.js +3 -1
  178. package/build/components/tool-selector/index.js.map +1 -1
  179. package/build/components/url-popover/image-url-input-ui.js +7 -8
  180. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  181. package/build/components/use-block-display-information/index.js +1 -1
  182. package/build/components/use-block-display-information/index.js.map +1 -1
  183. package/build/experiments.js +45 -0
  184. package/build/experiments.js.map +1 -0
  185. package/build/experiments.native.js +40 -0
  186. package/build/experiments.native.js.map +1 -0
  187. package/build/hooks/anchor.js +2 -1
  188. package/build/hooks/anchor.js.map +1 -1
  189. package/build/hooks/border.js +1 -1
  190. package/build/hooks/border.js.map +1 -1
  191. package/build/hooks/child-layout.js +5 -1
  192. package/build/hooks/child-layout.js.map +1 -1
  193. package/build/hooks/color-panel.js +1 -1
  194. package/build/hooks/color-panel.js.map +1 -1
  195. package/build/hooks/color.js +3 -3
  196. package/build/hooks/color.js.map +1 -1
  197. package/build/hooks/custom-class-name.js +2 -1
  198. package/build/hooks/custom-class-name.js.map +1 -1
  199. package/build/hooks/dimensions.js +7 -5
  200. package/build/hooks/dimensions.js.map +1 -1
  201. package/build/hooks/margin.js +1 -0
  202. package/build/hooks/margin.js.map +1 -1
  203. package/build/hooks/padding.js +1 -0
  204. package/build/hooks/padding.js.map +1 -1
  205. package/build/hooks/position.js +34 -15
  206. package/build/hooks/position.js.map +1 -1
  207. package/build/hooks/typography.js +1 -1
  208. package/build/hooks/typography.js.map +1 -1
  209. package/build/hooks/use-color-props.js +3 -3
  210. package/build/hooks/use-color-props.js.map +1 -1
  211. package/build/hooks/utils.js +69 -3
  212. package/build/hooks/utils.js.map +1 -1
  213. package/build/index.js +10 -1
  214. package/build/index.js.map +1 -1
  215. package/build/layouts/constrained.js +3 -0
  216. package/build/layouts/constrained.js.map +1 -1
  217. package/build/layouts/flex.js +59 -9
  218. package/build/layouts/flex.js.map +1 -1
  219. package/build/layouts/flow.js +0 -18
  220. package/build/layouts/flow.js.map +1 -1
  221. package/build/store/actions.js +3 -30
  222. package/build/store/actions.js.map +1 -1
  223. package/build/store/defaults.js +5 -2
  224. package/build/store/defaults.js.map +1 -1
  225. package/build/store/index.js +11 -2
  226. package/build/store/index.js.map +1 -1
  227. package/build/store/private-actions.js +78 -0
  228. package/build/store/private-actions.js.map +1 -0
  229. package/build/store/private-selectors.js +18 -0
  230. package/build/store/private-selectors.js.map +1 -0
  231. package/build/store/reducer.js +1 -1
  232. package/build/store/reducer.js.map +1 -1
  233. package/build/store/selectors.js +60 -34
  234. package/build/store/selectors.js.map +1 -1
  235. package/build/utils/block-variation-transforms.js +1 -1
  236. package/build/utils/block-variation-transforms.js.map +1 -1
  237. package/build/utils/parse-css-unit-to-px.js +1 -1
  238. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  239. package/build/utils/transform-styles/index.js +1 -7
  240. package/build/utils/transform-styles/index.js.map +1 -1
  241. package/build-module/components/alignment-control/ui.js +1 -1
  242. package/build-module/components/alignment-control/ui.js.map +1 -1
  243. package/build-module/components/autocomplete/index.js +2 -6
  244. package/build-module/components/autocomplete/index.js.map +1 -1
  245. package/build-module/components/block-alignment-matrix-control/index.js +2 -2
  246. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  247. package/build-module/components/block-card/index.js +2 -4
  248. package/build-module/components/block-card/index.js.map +1 -1
  249. package/build-module/components/block-edit/index.js +7 -0
  250. package/build-module/components/block-edit/index.js.map +1 -1
  251. package/build-module/components/block-inspector/index.js +15 -14
  252. package/build-module/components/block-inspector/index.js.map +1 -1
  253. package/build-module/components/block-list/use-in-between-inserter.js +5 -0
  254. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  255. package/build-module/components/block-lock/modal.js +0 -1
  256. package/build-module/components/block-lock/modal.js.map +1 -1
  257. package/build-module/components/block-mover/mover-description.js +2 -2
  258. package/build-module/components/block-mover/mover-description.js.map +1 -1
  259. package/build-module/components/block-navigation/dropdown.js +3 -1
  260. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  261. package/build-module/components/block-pattern-setup/index.js +1 -1
  262. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  263. package/build-module/components/block-pattern-setup/use-patterns-setup.js +2 -2
  264. package/build-module/components/block-pattern-setup/use-patterns-setup.js.map +1 -1
  265. package/build-module/components/block-patterns-list/index.js +32 -3
  266. package/build-module/components/block-patterns-list/index.js.map +1 -1
  267. package/build-module/components/block-preview/auto.js +9 -11
  268. package/build-module/components/block-preview/auto.js.map +1 -1
  269. package/build-module/components/block-preview/index.js +31 -8
  270. package/build-module/components/block-preview/index.js.map +1 -1
  271. package/build-module/components/block-selection-clearer/index.js +1 -1
  272. package/build-module/components/block-selection-clearer/index.js.map +1 -1
  273. package/build-module/components/block-settings/container.native.js +6 -30
  274. package/build-module/components/block-settings/container.native.js.map +1 -1
  275. package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -6
  276. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  277. package/build-module/components/block-settings-menu-controls/index.js +2 -7
  278. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  279. package/build-module/components/block-switcher/utils.js +1 -1
  280. package/build-module/components/block-switcher/utils.js.map +1 -1
  281. package/build-module/components/block-tools/selected-block-popover.js +55 -48
  282. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  283. package/build-module/components/block-vertical-alignment-control/icons.js +12 -0
  284. package/build-module/components/block-vertical-alignment-control/icons.js.map +1 -1
  285. package/build-module/components/block-vertical-alignment-control/ui.js +10 -5
  286. package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
  287. package/build-module/components/color-style-selector/index.js +3 -1
  288. package/build-module/components/color-style-selector/index.js.map +1 -1
  289. package/build-module/components/date-format-picker/index.js +4 -5
  290. package/build-module/components/date-format-picker/index.js.map +1 -1
  291. package/build-module/components/font-family/index.js +1 -6
  292. package/build-module/components/font-family/index.js.map +1 -1
  293. package/build-module/components/font-sizes/fluid-utils.js +1 -1
  294. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  295. package/build-module/components/font-sizes/utils.js +1 -1
  296. package/build-module/components/font-sizes/utils.js.map +1 -1
  297. package/build-module/components/global-styles/context.js +12 -0
  298. package/build-module/components/global-styles/context.js.map +1 -0
  299. package/build-module/components/global-styles/hooks.js +121 -0
  300. package/build-module/components/global-styles/hooks.js.map +1 -0
  301. package/build-module/components/global-styles/index.js +4 -0
  302. package/build-module/components/global-styles/index.js.map +1 -0
  303. package/build-module/components/global-styles/typography-utils.js +84 -0
  304. package/build-module/components/global-styles/typography-utils.js.map +1 -0
  305. package/build-module/components/global-styles/use-global-styles-output.js +930 -0
  306. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -0
  307. package/build-module/components/global-styles/utils.js +321 -0
  308. package/build-module/components/global-styles/utils.js.map +1 -0
  309. package/build-module/components/height-control/index.js +14 -1
  310. package/build-module/components/height-control/index.js.map +1 -1
  311. package/build-module/components/image-editor/constants.js +1 -1
  312. package/build-module/components/image-editor/constants.js.map +1 -1
  313. package/build-module/components/image-editor/context.js +1 -2
  314. package/build-module/components/image-editor/context.js.map +1 -1
  315. package/build-module/components/image-editor/cropper.js +3 -1
  316. package/build-module/components/image-editor/cropper.js.map +1 -1
  317. package/build-module/components/image-editor/index.js +13 -3
  318. package/build-module/components/image-editor/index.js.map +1 -1
  319. package/build-module/components/image-editor/use-transform-image.js +12 -37
  320. package/build-module/components/image-editor/use-transform-image.js.map +1 -1
  321. package/build-module/components/image-size-control/index.js +1 -6
  322. package/build-module/components/image-size-control/index.js.map +1 -1
  323. package/build-module/components/index.js +2 -3
  324. package/build-module/components/index.js.map +1 -1
  325. package/build-module/components/inner-blocks/index.js +21 -32
  326. package/build-module/components/inner-blocks/index.js.map +1 -1
  327. package/build-module/components/inner-blocks/index.native.js +9 -22
  328. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  329. package/build-module/components/inner-blocks/use-block-context.js +43 -0
  330. package/build-module/components/inner-blocks/use-block-context.js.map +1 -0
  331. package/build-module/components/inserter/block-patterns-explorer/explorer.js +0 -1
  332. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  333. package/build-module/components/inserter/block-patterns-tab.js +7 -1
  334. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  335. package/build-module/components/inserter/block-types-tab.js +3 -3
  336. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  337. package/build-module/components/inserter/hooks/use-patterns-state.js +1 -6
  338. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  339. package/build-module/components/inserter/index.js +5 -4
  340. package/build-module/components/inserter/index.js.map +1 -1
  341. package/build-module/components/inserter/media-tab/hooks.js +145 -56
  342. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  343. package/build-module/components/inserter/media-tab/media-list.js +74 -24
  344. package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
  345. package/build-module/components/inserter/media-tab/media-panel.js +14 -14
  346. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
  347. package/build-module/components/inserter/media-tab/media-tab.js +7 -4
  348. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
  349. package/build-module/components/inserter/media-tab/utils.js +27 -15
  350. package/build-module/components/inserter/media-tab/utils.js.map +1 -1
  351. package/build-module/components/inserter/menu.js +1 -0
  352. package/build-module/components/inserter/menu.js.map +1 -1
  353. package/build-module/components/inserter/preview-panel.js +5 -3
  354. package/build-module/components/inserter/preview-panel.js.map +1 -1
  355. package/build-module/components/inserter/search-results.js +2 -6
  356. package/build-module/components/inserter/search-results.js.map +1 -1
  357. package/build-module/components/inserter-list-item/index.js +1 -9
  358. package/build-module/components/inserter-list-item/index.js.map +1 -1
  359. package/build-module/components/inspector-controls/fill.js +14 -2
  360. package/build-module/components/inspector-controls/fill.js.map +1 -1
  361. package/build-module/components/inspector-controls/fill.native.js +13 -1
  362. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  363. package/build-module/components/inspector-controls/groups.js +4 -0
  364. package/build-module/components/inspector-controls/groups.js.map +1 -1
  365. package/build-module/components/inspector-controls/index.js +2 -2
  366. package/build-module/components/inspector-controls/index.js.map +1 -1
  367. package/build-module/components/inspector-controls/slot.js +13 -1
  368. package/build-module/components/inspector-controls/slot.js.map +1 -1
  369. package/build-module/components/inspector-controls/slot.native.js +13 -1
  370. package/build-module/components/inspector-controls/slot.native.js.map +1 -1
  371. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js +1 -1
  372. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -1
  373. package/build-module/components/inspector-controls-tabs/index.js +2 -2
  374. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  375. package/build-module/components/inspector-controls-tabs/position-controls-panel.js +1 -1
  376. package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  377. package/build-module/components/inspector-controls-tabs/styles-tab.js +6 -4
  378. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  379. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +17 -12
  380. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  381. package/build-module/components/justify-content-control/ui.js +9 -2
  382. package/build-module/components/justify-content-control/ui.js.map +1 -1
  383. package/build-module/components/link-control/index.js +45 -16
  384. package/build-module/components/link-control/index.js.map +1 -1
  385. package/build-module/components/list-view/block.js +1 -1
  386. package/build-module/components/list-view/block.js.map +1 -1
  387. package/build-module/components/list-view/use-list-view-drop-zone.js +1 -1
  388. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  389. package/build-module/components/media-upload/index.native.js +4 -1
  390. package/build-module/components/media-upload/index.native.js.map +1 -1
  391. package/build-module/components/off-canvas-editor/appender.js +47 -4
  392. package/build-module/components/off-canvas-editor/appender.js.map +1 -1
  393. package/build-module/components/off-canvas-editor/block-select-button.js +9 -4
  394. package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
  395. package/build-module/components/off-canvas-editor/block.js +6 -25
  396. package/build-module/components/off-canvas-editor/block.js.map +1 -1
  397. package/build-module/components/off-canvas-editor/branch.js +23 -11
  398. package/build-module/components/off-canvas-editor/branch.js.map +1 -1
  399. package/build-module/components/off-canvas-editor/index.js +11 -15
  400. package/build-module/components/off-canvas-editor/index.js.map +1 -1
  401. package/build-module/components/off-canvas-editor/link-ui.js +2 -2
  402. package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
  403. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +1 -1
  404. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -1
  405. package/build-module/components/provider/index.js +16 -9
  406. package/build-module/components/provider/index.js.map +1 -1
  407. package/build-module/components/provider/index.native.js +4 -4
  408. package/build-module/components/provider/index.native.js.map +1 -1
  409. package/build-module/components/rich-text/use-before-input-rules.js +10 -2
  410. package/build-module/components/rich-text/use-before-input-rules.js.map +1 -1
  411. package/build-module/components/rich-text/utils.js +1 -1
  412. package/build-module/components/rich-text/utils.js.map +1 -1
  413. package/build-module/components/spacing-sizes-control/utils.js +2 -7
  414. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  415. package/build-module/components/tool-selector/index.js +3 -1
  416. package/build-module/components/tool-selector/index.js.map +1 -1
  417. package/build-module/components/url-popover/image-url-input-ui.js +8 -8
  418. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  419. package/build-module/components/use-block-display-information/index.js +1 -1
  420. package/build-module/components/use-block-display-information/index.js.map +1 -1
  421. package/build-module/experiments.js +25 -0
  422. package/build-module/experiments.js.map +1 -0
  423. package/build-module/experiments.native.js +23 -0
  424. package/build-module/experiments.native.js.map +1 -0
  425. package/build-module/hooks/anchor.js +2 -1
  426. package/build-module/hooks/anchor.js.map +1 -1
  427. package/build-module/hooks/border.js +1 -1
  428. package/build-module/hooks/border.js.map +1 -1
  429. package/build-module/hooks/child-layout.js +5 -1
  430. package/build-module/hooks/child-layout.js.map +1 -1
  431. package/build-module/hooks/color-panel.js +1 -1
  432. package/build-module/hooks/color-panel.js.map +1 -1
  433. package/build-module/hooks/color.js +3 -3
  434. package/build-module/hooks/color.js.map +1 -1
  435. package/build-module/hooks/custom-class-name.js +2 -1
  436. package/build-module/hooks/custom-class-name.js.map +1 -1
  437. package/build-module/hooks/dimensions.js +6 -5
  438. package/build-module/hooks/dimensions.js.map +1 -1
  439. package/build-module/hooks/margin.js +1 -0
  440. package/build-module/hooks/margin.js.map +1 -1
  441. package/build-module/hooks/padding.js +1 -0
  442. package/build-module/hooks/padding.js.map +1 -1
  443. package/build-module/hooks/position.js +31 -14
  444. package/build-module/hooks/position.js.map +1 -1
  445. package/build-module/hooks/typography.js +1 -1
  446. package/build-module/hooks/typography.js.map +1 -1
  447. package/build-module/hooks/use-color-props.js +3 -3
  448. package/build-module/hooks/use-color-props.js.map +1 -1
  449. package/build-module/hooks/utils.js +70 -4
  450. package/build-module/hooks/utils.js.map +1 -1
  451. package/build-module/index.js +1 -0
  452. package/build-module/index.js.map +1 -1
  453. package/build-module/layouts/constrained.js +3 -0
  454. package/build-module/layouts/constrained.js.map +1 -1
  455. package/build-module/layouts/flex.js +60 -10
  456. package/build-module/layouts/flex.js.map +1 -1
  457. package/build-module/layouts/flow.js +0 -18
  458. package/build-module/layouts/flow.js.map +1 -1
  459. package/build-module/store/actions.js +2 -26
  460. package/build-module/store/actions.js.map +1 -1
  461. package/build-module/store/defaults.js +5 -2
  462. package/build-module/store/defaults.js.map +1 -1
  463. package/build-module/store/index.js +8 -2
  464. package/build-module/store/index.js.map +1 -1
  465. package/build-module/store/private-actions.js +66 -0
  466. package/build-module/store/private-actions.js.map +1 -0
  467. package/build-module/store/private-selectors.js +11 -0
  468. package/build-module/store/private-selectors.js.map +1 -0
  469. package/build-module/store/reducer.js +1 -1
  470. package/build-module/store/reducer.js.map +1 -1
  471. package/build-module/store/selectors.js +48 -25
  472. package/build-module/store/selectors.js.map +1 -1
  473. package/build-module/utils/block-variation-transforms.js +1 -1
  474. package/build-module/utils/block-variation-transforms.js.map +1 -1
  475. package/build-module/utils/parse-css-unit-to-px.js +1 -1
  476. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  477. package/build-module/utils/transform-styles/index.js +1 -6
  478. package/build-module/utils/transform-styles/index.js.map +1 -1
  479. package/build-style/content-rtl.css +283 -3
  480. package/build-style/content.css +283 -3
  481. package/build-style/style-rtl.css +105 -221
  482. package/build-style/style.css +105 -221
  483. package/package.json +30 -29
  484. package/src/components/alignment-control/test/__snapshots__/index.js.snap +3 -3
  485. package/src/components/alignment-control/test/index.js +5 -15
  486. package/src/components/alignment-control/ui.js +1 -1
  487. package/src/components/autocomplete/index.js +3 -6
  488. package/src/components/block-alignment-control/test/index.js +3 -11
  489. package/src/components/block-alignment-matrix-control/index.js +1 -2
  490. package/src/components/block-card/index.js +1 -4
  491. package/src/components/block-content-overlay/content.scss +4 -4
  492. package/src/components/block-edit/index.js +15 -1
  493. package/src/components/block-icon/content.scss +31 -0
  494. package/src/components/block-inspector/index.js +13 -17
  495. package/src/components/block-list/use-in-between-inserter.js +5 -0
  496. package/src/components/block-lock/modal.js +0 -1
  497. package/src/components/block-mover/mover-description.js +2 -2
  498. package/src/components/block-mover/stories/index.js +3 -3
  499. package/src/components/block-navigation/dropdown.js +1 -1
  500. package/src/components/block-pattern-setup/index.js +1 -4
  501. package/src/components/block-pattern-setup/use-patterns-setup.js +2 -5
  502. package/src/components/block-patterns-list/index.js +29 -3
  503. package/src/components/block-preview/README.md +9 -9
  504. package/src/components/block-preview/auto.js +9 -11
  505. package/src/components/block-preview/content.scss +23 -0
  506. package/src/components/block-preview/index.js +40 -10
  507. package/src/components/block-preview/style.scss +0 -23
  508. package/src/components/block-selection-clearer/index.js +1 -1
  509. package/src/components/block-selection-clearer/test/index.js +6 -6
  510. package/src/components/block-settings/container.native.js +7 -26
  511. package/src/components/block-settings-menu/block-settings-dropdown.js +13 -5
  512. package/src/components/block-settings-menu-controls/index.js +2 -10
  513. package/src/components/block-switcher/test/index.js +43 -44
  514. package/src/components/block-switcher/utils.js +1 -1
  515. package/src/components/block-tools/selected-block-popover.js +77 -80
  516. package/src/components/block-tools/style.scss +0 -1
  517. package/src/components/block-variation-picker/{style.scss → content.scss} +0 -0
  518. package/src/components/block-vertical-alignment-control/icons.js +12 -0
  519. package/src/components/block-vertical-alignment-control/test/index.js +3 -11
  520. package/src/components/block-vertical-alignment-control/ui.js +16 -6
  521. package/src/components/color-style-selector/index.js +1 -1
  522. package/src/components/colors/test/with-colors.js +2 -8
  523. package/src/components/date-format-picker/index.js +23 -24
  524. package/src/components/date-format-picker/style.scss +0 -6
  525. package/src/components/default-block-appender/content.scss +18 -0
  526. package/src/components/default-block-appender/test/index.js +2 -8
  527. package/src/components/font-family/index.js +1 -6
  528. package/src/components/font-sizes/fluid-utils.js +1 -1
  529. package/src/components/font-sizes/utils.js +1 -1
  530. package/src/components/global-styles/README.md +77 -0
  531. package/src/components/global-styles/context.js +15 -0
  532. package/src/components/global-styles/hooks.js +145 -0
  533. package/src/components/global-styles/index.js +7 -0
  534. package/src/components/global-styles/test/typography-utils.js +393 -0
  535. package/src/components/global-styles/test/use-global-styles-output.js +814 -0
  536. package/src/components/global-styles/test/utils.js +206 -0
  537. package/src/components/global-styles/typography-utils.js +87 -0
  538. package/src/components/global-styles/use-global-styles-output.js +1088 -0
  539. package/src/components/global-styles/utils.js +373 -0
  540. package/src/components/height-control/README.md +55 -0
  541. package/src/components/height-control/index.js +13 -1
  542. package/src/components/image-editor/constants.js +1 -1
  543. package/src/components/image-editor/context.js +5 -9
  544. package/src/components/image-editor/cropper.js +3 -1
  545. package/src/components/image-editor/index.js +13 -4
  546. package/src/components/image-editor/use-transform-image.js +14 -55
  547. package/src/components/image-size-control/index.js +1 -6
  548. package/src/components/index.js +2 -6
  549. package/src/components/inner-blocks/index.js +29 -33
  550. package/src/components/inner-blocks/index.native.js +27 -47
  551. package/src/components/inner-blocks/use-block-context.js +47 -0
  552. package/src/components/inserter/block-patterns-explorer/explorer.js +0 -1
  553. package/src/components/inserter/block-patterns-tab.js +7 -0
  554. package/src/components/inserter/block-types-tab.js +3 -4
  555. package/src/components/inserter/hooks/use-patterns-state.js +1 -6
  556. package/src/components/inserter/index.js +3 -4
  557. package/src/components/inserter/media-tab/hooks.js +167 -65
  558. package/src/components/inserter/media-tab/media-list.js +94 -26
  559. package/src/components/inserter/media-tab/media-panel.js +9 -20
  560. package/src/components/inserter/media-tab/media-tab.js +12 -4
  561. package/src/components/inserter/media-tab/utils.js +20 -10
  562. package/src/components/inserter/menu.js +1 -0
  563. package/src/components/inserter/preview-panel.js +4 -2
  564. package/src/components/inserter/search-results.js +2 -6
  565. package/src/components/inserter/stories/index.js +9 -9
  566. package/src/components/inserter/style.scss +58 -11
  567. package/src/components/inserter-list-item/index.js +0 -7
  568. package/src/components/inspector-controls/README.md +3 -7
  569. package/src/components/inspector-controls/fill.js +15 -1
  570. package/src/components/inspector-controls/fill.native.js +14 -1
  571. package/src/components/inspector-controls/groups.js +3 -0
  572. package/src/components/inspector-controls/index.js +2 -6
  573. package/src/components/inspector-controls/slot.js +14 -1
  574. package/src/components/inspector-controls/slot.native.js +14 -1
  575. package/src/components/inspector-controls-tabs/advanced-controls-panel.js +1 -1
  576. package/src/components/inspector-controls-tabs/index.js +2 -4
  577. package/src/components/inspector-controls-tabs/position-controls-panel.js +1 -1
  578. package/src/components/inspector-controls-tabs/styles-tab.js +5 -7
  579. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +21 -10
  580. package/src/components/justify-content-control/ui.js +9 -0
  581. package/src/components/link-control/index.js +59 -23
  582. package/src/components/link-control/style.scss +7 -24
  583. package/src/components/link-control/test/index.js +134 -5
  584. package/src/components/list-view/block.js +1 -1
  585. package/src/components/list-view/use-list-view-drop-zone.js +1 -1
  586. package/src/components/media-replace-flow/test/index.js +4 -12
  587. package/src/components/media-upload/index.native.js +2 -2
  588. package/src/components/off-canvas-editor/README.md +2 -2
  589. package/src/components/off-canvas-editor/appender.js +93 -37
  590. package/src/components/off-canvas-editor/block-select-button.js +12 -1
  591. package/src/components/off-canvas-editor/block.js +3 -42
  592. package/src/components/off-canvas-editor/branch.js +32 -5
  593. package/src/components/off-canvas-editor/index.js +10 -25
  594. package/src/components/off-canvas-editor/link-ui.js +2 -2
  595. package/src/components/off-canvas-editor/style.scss +5 -1
  596. package/src/components/off-canvas-editor/use-list-view-drop-zone.js +1 -1
  597. package/src/components/provider/index.js +33 -14
  598. package/src/components/provider/index.native.js +4 -3
  599. package/src/components/provider/test/experimental-provider.js +94 -0
  600. package/src/components/provider/test/use-block-sync.js +10 -0
  601. package/src/components/responsive-block-control/test/index.js +1 -5
  602. package/src/components/rich-text/use-before-input-rules.js +10 -2
  603. package/src/components/rich-text/utils.js +1 -1
  604. package/src/components/spacing-sizes-control/utils.js +2 -7
  605. package/src/components/tool-selector/index.js +1 -1
  606. package/src/components/url-input/test/button.js +24 -24
  607. package/src/components/url-popover/image-url-input-ui.js +7 -8
  608. package/src/components/url-popover/style.scss +0 -10
  609. package/src/components/use-block-display-information/index.js +1 -1
  610. package/src/components/warning/{style.scss → content.scss} +0 -0
  611. package/src/components/warning/test/index.js +1 -5
  612. package/src/content.scss +7 -0
  613. package/src/experiments.js +27 -0
  614. package/src/experiments.native.js +25 -0
  615. package/src/hooks/anchor.js +2 -1
  616. package/src/hooks/border.js +1 -1
  617. package/src/hooks/child-layout.js +6 -1
  618. package/src/hooks/color-panel.js +1 -1
  619. package/src/hooks/color.js +3 -3
  620. package/src/hooks/custom-class-name.js +2 -1
  621. package/src/hooks/dimensions.js +6 -6
  622. package/src/hooks/layout.scss +4 -0
  623. package/src/hooks/margin.js +1 -0
  624. package/src/hooks/padding.js +1 -0
  625. package/src/hooks/position.js +52 -36
  626. package/src/hooks/test/align.native.js +1 -1
  627. package/src/hooks/test/utils.js +104 -0
  628. package/src/hooks/typography.js +1 -1
  629. package/src/hooks/use-color-props.js +3 -3
  630. package/src/hooks/utils.js +68 -2
  631. package/src/index.js +1 -0
  632. package/src/layouts/constrained.js +3 -0
  633. package/src/layouts/flex.js +66 -14
  634. package/src/layouts/flow.js +0 -9
  635. package/src/store/actions.js +2 -26
  636. package/src/store/defaults.js +7 -2
  637. package/src/store/index.js +8 -2
  638. package/src/store/private-actions.js +65 -0
  639. package/src/store/private-selectors.js +10 -0
  640. package/src/store/reducer.js +1 -1
  641. package/src/store/selectors.js +103 -52
  642. package/src/store/test/actions.js +0 -18
  643. package/src/store/test/private-actions.js +22 -0
  644. package/src/store/test/private-selectors.js +24 -0
  645. package/src/store/test/selectors.js +52 -30
  646. package/src/style.scss +3 -5
  647. package/src/utils/block-variation-transforms.js +1 -1
  648. package/src/utils/parse-css-unit-to-px.js +3 -1
  649. package/src/utils/test/parse-css-unit-to-px.js +16 -24
  650. package/src/utils/transform-styles/index.js +1 -6
  651. package/build/components/inner-blocks/get-block-context.js +0 -45
  652. package/build/components/inner-blocks/get-block-context.js.map +0 -1
  653. package/build/components/off-canvas-editor/block-edit-button.js +0 -50
  654. package/build/components/off-canvas-editor/block-edit-button.js.map +0 -1
  655. package/build-module/components/inner-blocks/get-block-context.js +0 -37
  656. package/build-module/components/inner-blocks/get-block-context.js.map +0 -1
  657. package/build-module/components/off-canvas-editor/block-edit-button.js +0 -35
  658. package/build-module/components/off-canvas-editor/block-edit-button.js.map +0 -1
  659. package/src/components/inner-blocks/get-block-context.js +0 -39
  660. package/src/components/off-canvas-editor/block-edit-button.js +0 -27
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inner-blocks/index.js"],"names":["UncontrolledInnerBlocks","props","clientId","allowedBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","template","templateLock","wrapperRef","templateInsertUpdatesSelection","__experimentalCaptureToolbars","captureToolbars","__experimentalAppenderTagName","renderAppender","orientation","placeholder","__experimentalLayout","context","name","select","block","blockEditorStore","getBlock","blockType","Object","keys","providesContext","length","attributes","allowSizingOnChildren","layout","ControlledInnerBlocks","ForwardedInnerBlocks","ref","innerBlocksProps","useInnerBlocksProps","options","__unstableDisableLayoutClassNames","__unstableDisableDropZone","__unstableLayoutClassNames","layoutClassNames","isSmallScreen","hasOverlay","getBlockName","isBlockSelected","hasSelectedInnerBlock","__unstableGetEditorMode","blockName","enableClickThrough","blocksStore","hasBlockSupport","blockDropZoneRef","rootClientId","InnerBlocks","value","onChange","className","children","save","getInnerBlocksProps","DefaultBlockAppender","ButtonBlockAppender","Content"],"mappings":";;;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AACA;;AAUA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,uBAAT,CAAkCC,KAAlC,EAA0C;AACzC,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,aAFK;AAGLC,IAAAA,0BAHK;AAILC,IAAAA,0BAJK;AAKLC,IAAAA,QALK;AAMLC,IAAAA,YANK;AAOLC,IAAAA,UAPK;AAQLC,IAAAA,8BARK;AASLC,IAAAA,6BAA6B,EAAEC,eAT1B;AAULC,IAAAA,6BAVK;AAWLC,IAAAA,cAXK;AAYLC,IAAAA,WAZK;AAaLC,IAAAA,WAbK;AAcLC,IAAAA;AAdK,MAeFf,KAfJ;AAiBA,wCACCC,QADD,EAECC,aAFD,EAGCC,0BAHD,EAICC,0BAJD,EAKCE,YALD,EAMCI,eAND,EAOCG,WAPD,EAQCE,oBARD;AAWA,0CACCd,QADD,EAECI,QAFD,EAGCC,YAHD,EAICE,8BAJD;AAOA,QAAM;AAAEQ,IAAAA,OAAF;AAAWC,IAAAA;AAAX,MAAoB,qBACvBC,MAAF,IAAc;AAAA;;AACb,UAAMC,KAAK,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAA2BC,QAA3B,CAAqCpB,QAArC,CAAd,CADa,CAGb;AACA;;AACA,QAAK,CAAEkB,KAAP,EAAe;AACd,aAAO,EAAP;AACA;;AAED,UAAMG,SAAS,GAAG,0BAAcH,KAAK,CAACF,IAApB,CAAlB;;AAEA,QACCM,MAAM,CAACC,IAAP,0BAAaF,SAAb,aAAaA,SAAb,uBAAaA,SAAS,CAAEG,eAAxB,yEAA2C,EA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AAtD;AAiCA,QAAMU,gBAAgB,GAAG,+BAAkB;AAC1CC,IAAAA,YAAY,EAAElD;AAD4B,GAAlB,CAAzB;AAIA,QAAM+B,GAAG,GAAG,2BAAc,CACzBhC,KAAK,CAACgC,GADmB,EAEzBK,yBAAyB,GAAG,IAAH,GAAUa,gBAFV,CAAd,CAAZ;AAKA,QAAMjB,gBAAgB,GAAG;AACxBxB,IAAAA,6BADwB;AAExB,OAAG0B;AAFqB,GAAzB;AAIA,QAAMiB,WAAW,GAChBnB,gBAAgB,CAACoB,KAAjB,IAA0BpB,gBAAgB,CAACqB,QAA3C,GACGxB,qBADH,GAEG/B,uBAHJ;AAKA,SAAO,EACN,GAAGC,KADG;AAENgC,IAAAA,GAFM;AAGNuB,IAAAA,SAAS,EAAE,yBACVvD,KAAK,CAACuD,SADI,EAEV,iCAFU,EAGVnB,iCAAiC,GAAG,EAAH,GAAQG,gBAH/B,EAIV;AACC,qBAAeE;AADhB,KAJU,CAHL;AAWNe,IAAAA,QAAQ,EAAEvD,QAAQ,GACjB,4BAAC,WAAD,6BAAkBgC,gBAAlB;AAAqC,MAAA,QAAQ,EAAGhC;AAAhD,OADiB,GAGjB,4BAAC,yBAAD,EAAqBkC,OAArB;AAdK,GAAP;AAiBA;;AAEDD,mBAAmB,CAACuB,IAApB,GAA2BC,qCAA3B,C,CAEA;;AACA3B,oBAAoB,CAAC4B,oBAArB,GAA4CA,6BAA5C;AACA5B,oBAAoB,CAAC6B,mBAArB,GAA2CA,4BAA3C;;AAEA7B,oBAAoB,CAAC8B,OAArB,GAA+B,MAAM3B,mBAAmB,CAACuB,IAApB,GAA2BD,QAAhE;AAEA;AACA;AACA;;;eACezB,oB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch, useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\tstore as blocksStore,\n\t__unstableGetInnerBlocksProps as getInnerBlocksProps,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ButtonBlockAppender from './button-block-appender';\nimport DefaultBlockAppender from './default-block-appender';\nimport useNestedSettingsUpdate from './use-nested-settings-update';\nimport useInnerBlockTemplateSync from './use-inner-block-template-sync';\nimport getBlockContext from './get-block-context';\nimport { BlockListItems } from '../block-list';\nimport { BlockContextProvider } from '../block-context';\nimport { useBlockEditContext } from '../block-edit/context';\nimport useBlockSync from '../provider/use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDropZone from '../use-block-drop-zone';\n\n/**\n * InnerBlocks is a component which allows a single block to have multiple blocks\n * as children. The UncontrolledInnerBlocks component is used whenever the inner\n * blocks are not controlled by another entity. In other words, it is normally\n * used for inner blocks in the post editor\n *\n * @param {Object} props The component props.\n */\nfunction UncontrolledInnerBlocks( props ) {\n\tconst {\n\t\tclientId,\n\t\tallowedBlocks,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\twrapperRef,\n\t\ttemplateInsertUpdatesSelection,\n\t\t__experimentalCaptureToolbars: captureToolbars,\n\t\t__experimentalAppenderTagName,\n\t\trenderAppender,\n\t\torientation,\n\t\tplaceholder,\n\t\t__experimentalLayout,\n\t} = props;\n\n\tuseNestedSettingsUpdate(\n\t\tclientId,\n\t\tallowedBlocks,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplateLock,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\t__experimentalLayout\n\t);\n\n\tuseInnerBlockTemplateSync(\n\t\tclientId,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection\n\t);\n\n\tconst { context, name } = useSelect(\n\t\t( select ) => {\n\t\t\tconst block = select( blockEditorStore ).getBlock( clientId );\n\n\t\t\t// This check is here to avoid the Redux zombie bug where a child subscription\n\t\t\t// is called before a parent, causing potential JS errors when the child has been removed.\n\t\t\tif ( ! block ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst blockType = getBlockType( block.name );\n\n\t\t\tif (\n\t\t\t\tObject.keys( blockType?.providesContext ?? {} ).length === 0\n\t\t\t) {\n\t\t\t\treturn { name: block.name };\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcontext: getBlockContext( block.attributes, blockType ),\n\t\t\t\tname: block.name,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { allowSizingOnChildren = false } =\n\t\tgetBlockSupport( name, '__experimentalLayout' ) || {};\n\n\tconst layout = useMemo(\n\t\t() => ( {\n\t\t\t...__experimentalLayout,\n\t\t\t...( allowSizingOnChildren && {\n\t\t\t\tallowSizingOnChildren: true,\n\t\t\t} ),\n\t\t} ),\n\t\t[ __experimentalLayout, allowSizingOnChildren ]\n\t);\n\n\t// This component needs to always be synchronous as it's the one changing\n\t// the async mode depending on the block selection.\n\treturn (\n\t\t<BlockContextProvider value={ context }>\n\t\t\t<BlockListItems\n\t\t\t\trootClientId={ clientId }\n\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t__experimentalAppenderTagName={ __experimentalAppenderTagName }\n\t\t\t\t__experimentalLayout={ layout }\n\t\t\t\twrapperRef={ wrapperRef }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t/>\n\t\t</BlockContextProvider>\n\t);\n}\n\n/**\n * The controlled inner blocks component wraps the uncontrolled inner blocks\n * component with the blockSync hook. This keeps the innerBlocks of the block in\n * the block-editor store in sync with the blocks of the controlling entity. An\n * example of an inner block controller is a template part block, which provides\n * its own blocks from the template part entity data source.\n *\n * @param {Object} props The component props.\n */\nfunction ControlledInnerBlocks( props ) {\n\tuseBlockSync( props );\n\treturn <UncontrolledInnerBlocks { ...props } />;\n}\n\nconst ForwardedInnerBlocks = forwardRef( ( props, ref ) => {\n\tconst innerBlocksProps = useInnerBlocksProps( { ref }, props );\n\treturn (\n\t\t<div className=\"block-editor-inner-blocks\">\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</div>\n\t);\n} );\n\n/**\n * This hook is used to lightly mark an element as an inner blocks wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * an inner blocks 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} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Optional. Inner blocks options.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport function useInnerBlocksProps( props = {}, options = {} ) {\n\tconst { __unstableDisableLayoutClassNames, __unstableDisableDropZone } =\n\t\toptions;\n\tconst { clientId, __unstableLayoutClassNames: layoutClassNames = '' } =\n\t\tuseBlockEditContext();\n\tconst isSmallScreen = useViewportMatch( 'medium', '<' );\n\tconst { __experimentalCaptureToolbars, hasOverlay } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tisBlockSelected,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst enableClickThrough =\n\t\t\t\t__unstableGetEditorMode() === 'navigation' || isSmallScreen;\n\t\t\treturn {\n\t\t\t\t__experimentalCaptureToolbars: select(\n\t\t\t\t\tblocksStore\n\t\t\t\t).hasBlockSupport(\n\t\t\t\t\tblockName,\n\t\t\t\t\t'__experimentalExposeControlsToChildren',\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasOverlay:\n\t\t\t\t\tblockName !== 'core/template' &&\n\t\t\t\t\t! isBlockSelected( clientId ) &&\n\t\t\t\t\t! hasSelectedInnerBlock( clientId, true ) &&\n\t\t\t\t\tenableClickThrough,\n\t\t\t};\n\t\t},\n\t\t[ clientId, isSmallScreen ]\n\t);\n\n\tconst blockDropZoneRef = useBlockDropZone( {\n\t\trootClientId: clientId,\n\t} );\n\n\tconst ref = useMergeRefs( [\n\t\tprops.ref,\n\t\t__unstableDisableDropZone ? null : blockDropZoneRef,\n\t] );\n\n\tconst innerBlocksProps = {\n\t\t__experimentalCaptureToolbars,\n\t\t...options,\n\t};\n\tconst InnerBlocks =\n\t\tinnerBlocksProps.value && innerBlocksProps.onChange\n\t\t\t? ControlledInnerBlocks\n\t\t\t: UncontrolledInnerBlocks;\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: classnames(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-list__layout',\n\t\t\t__unstableDisableLayoutClassNames ? '' : layoutClassNames,\n\t\t\t{\n\t\t\t\t'has-overlay': hasOverlay,\n\t\t\t}\n\t\t),\n\t\tchildren: clientId ? (\n\t\t\t<InnerBlocks { ...innerBlocksProps } clientId={ clientId } />\n\t\t) : (\n\t\t\t<BlockListItems { ...options } />\n\t\t),\n\t};\n}\n\nuseInnerBlocksProps.save = getInnerBlocksProps;\n\n// Expose default appender placeholders as components.\nForwardedInnerBlocks.DefaultBlockAppender = DefaultBlockAppender;\nForwardedInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;\n\nForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport default ForwardedInnerBlocks;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inner-blocks/index.js"],"names":["EMPTY_OBJECT","UncontrolledInnerBlocks","props","clientId","allowedBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","template","templateLock","wrapperRef","templateInsertUpdatesSelection","__experimentalCaptureToolbars","captureToolbars","__experimentalAppenderTagName","renderAppender","orientation","placeholder","layout","context","name","select","blockEditorStore","getBlock","defaultLayoutBlockSupport","allowSizingOnChildren","defaultLayout","usedLayout","memoedLayout","ControlledInnerBlocks","ForwardedInnerBlocks","ref","innerBlocksProps","useInnerBlocksProps","options","__unstableDisableLayoutClassNames","__unstableDisableDropZone","__unstableLayoutClassNames","layoutClassNames","isSmallScreen","hasOverlay","getBlockName","isBlockSelected","hasSelectedInnerBlock","__unstableGetEditorMode","blockName","enableClickThrough","blocksStore","hasBlockSupport","blockDropZoneRef","rootClientId","InnerBlocks","value","onChange","className","children","save","getInnerBlocksProps","DefaultBlockAppender","ButtonBlockAppender","Content"],"mappings":";;;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AACA;;AASA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AAcA,MAAMA,YAAY,GAAG,EAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,uBAAT,CAAkCC,KAAlC,EAA0C;AACzC,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,aAFK;AAGLC,IAAAA,0BAHK;AAILC,IAAAA,0BAJK;AAKLC,IAAAA,QALK;AAMLC,IAAAA,YANK;AAOLC,IAAAA,UAPK;AAQLC,IAAAA,8BARK;AASLC,IAAAA,6BAA6B,EAAEC,eAT1B;AAULC,IAAAA,6BAVK;AAWLC,IAAAA,cAXK;AAYLC,IAAAA,WAZK;AAaLC,IAAAA,WAbK;AAcLC,IAAAA;AAdK,MAeFf,KAfJ;AAiBA,wCACCC,QADD,EAECC,aAFD,EAGCC,0BAHD,EAICC,0BAJD,EAKCE,YALD,EAMCI,eAND,EAOCG,WAPD,EAQCE,MARD;AAWA,0CACCd,QADD,EAECI,QAFD,EAGCC,YAHD,EAICE,8BAJD;AAOA,QAAMQ,OAAO,GAAG,8BAAiBf,QAAjB,CAAhB;AACA,QA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n/**\n * WordPress dependencies\n */\nimport { useViewportMatch, useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tgetBlockSupport,\n\tstore as blocksStore,\n\t__unstableGetInnerBlocksProps as getInnerBlocksProps,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ButtonBlockAppender from './button-block-appender';\nimport DefaultBlockAppender from './default-block-appender';\nimport useNestedSettingsUpdate from './use-nested-settings-update';\nimport useInnerBlockTemplateSync from './use-inner-block-template-sync';\nimport useBlockContext from './use-block-context';\nimport { BlockListItems } from '../block-list';\nimport { BlockContextProvider } from '../block-context';\nimport { useBlockEditContext } from '../block-edit/context';\nimport useBlockSync from '../provider/use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDropZone from '../use-block-drop-zone';\nimport useSetting from '../use-setting';\n\nconst EMPTY_OBJECT = {};\n\n/**\n * InnerBlocks is a component which allows a single block to have multiple blocks\n * as children. The UncontrolledInnerBlocks component is used whenever the inner\n * blocks are not controlled by another entity. In other words, it is normally\n * used for inner blocks in the post editor\n *\n * @param {Object} props The component props.\n */\nfunction UncontrolledInnerBlocks( props ) {\n\tconst {\n\t\tclientId,\n\t\tallowedBlocks,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\twrapperRef,\n\t\ttemplateInsertUpdatesSelection,\n\t\t__experimentalCaptureToolbars: captureToolbars,\n\t\t__experimentalAppenderTagName,\n\t\trenderAppender,\n\t\torientation,\n\t\tplaceholder,\n\t\tlayout,\n\t} = props;\n\n\tuseNestedSettingsUpdate(\n\t\tclientId,\n\t\tallowedBlocks,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplateLock,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tlayout\n\t);\n\n\tuseInnerBlockTemplateSync(\n\t\tclientId,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection\n\t);\n\n\tconst context = useBlockContext( clientId );\n\tconst name = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( blockEditorStore ).getBlock( clientId )?.name;\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst defaultLayoutBlockSupport =\n\t\tgetBlockSupport( name, '__experimentalLayout' ) || EMPTY_OBJECT;\n\n\tconst { allowSizingOnChildren = false } = defaultLayoutBlockSupport;\n\n\tconst defaultLayout = useSetting( 'layout' ) || EMPTY_OBJECT;\n\n\tconst usedLayout = layout || defaultLayoutBlockSupport;\n\n\tconst memoedLayout = useMemo(\n\t\t() => ( {\n\t\t\t// Default layout will know about any content/wide size defined by the theme.\n\t\t\t...defaultLayout,\n\t\t\t...usedLayout,\n\t\t\t...( allowSizingOnChildren && {\n\t\t\t\tallowSizingOnChildren: true,\n\t\t\t} ),\n\t\t} ),\n\t\t[ defaultLayout, usedLayout, allowSizingOnChildren ]\n\t);\n\n\t// This component needs to always be synchronous as it's the one changing\n\t// the async mode depending on the block selection.\n\treturn (\n\t\t<BlockContextProvider value={ context }>\n\t\t\t<BlockListItems\n\t\t\t\trootClientId={ clientId }\n\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t__experimentalAppenderTagName={ __experimentalAppenderTagName }\n\t\t\t\t__experimentalLayout={ memoedLayout }\n\t\t\t\twrapperRef={ wrapperRef }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t/>\n\t\t</BlockContextProvider>\n\t);\n}\n\n/**\n * The controlled inner blocks component wraps the uncontrolled inner blocks\n * component with the blockSync hook. This keeps the innerBlocks of the block in\n * the block-editor store in sync with the blocks of the controlling entity. An\n * example of an inner block controller is a template part block, which provides\n * its own blocks from the template part entity data source.\n *\n * @param {Object} props The component props.\n */\nfunction ControlledInnerBlocks( props ) {\n\tuseBlockSync( props );\n\treturn <UncontrolledInnerBlocks { ...props } />;\n}\n\nconst ForwardedInnerBlocks = forwardRef( ( props, ref ) => {\n\tconst innerBlocksProps = useInnerBlocksProps( { ref }, props );\n\treturn (\n\t\t<div className=\"block-editor-inner-blocks\">\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</div>\n\t);\n} );\n\n/**\n * This hook is used to lightly mark an element as an inner blocks wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * an inner blocks 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} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Optional. Inner blocks options.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport function useInnerBlocksProps( props = {}, options = {} ) {\n\tconst { __unstableDisableLayoutClassNames, __unstableDisableDropZone } =\n\t\toptions;\n\tconst {\n\t\tclientId,\n\t\tlayout = null,\n\t\t__unstableLayoutClassNames: layoutClassNames = '',\n\t} = useBlockEditContext();\n\tconst isSmallScreen = useViewportMatch( 'medium', '<' );\n\tconst { __experimentalCaptureToolbars, hasOverlay } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tisBlockSelected,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst enableClickThrough =\n\t\t\t\t__unstableGetEditorMode() === 'navigation' || isSmallScreen;\n\t\t\treturn {\n\t\t\t\t__experimentalCaptureToolbars: select(\n\t\t\t\t\tblocksStore\n\t\t\t\t).hasBlockSupport(\n\t\t\t\t\tblockName,\n\t\t\t\t\t'__experimentalExposeControlsToChildren',\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasOverlay:\n\t\t\t\t\tblockName !== 'core/template' &&\n\t\t\t\t\t! isBlockSelected( clientId ) &&\n\t\t\t\t\t! hasSelectedInnerBlock( clientId, true ) &&\n\t\t\t\t\tenableClickThrough,\n\t\t\t};\n\t\t},\n\t\t[ clientId, isSmallScreen ]\n\t);\n\n\tconst blockDropZoneRef = useBlockDropZone( {\n\t\trootClientId: clientId,\n\t} );\n\n\tconst ref = useMergeRefs( [\n\t\tprops.ref,\n\t\t__unstableDisableDropZone ? null : blockDropZoneRef,\n\t] );\n\n\tconst innerBlocksProps = {\n\t\t__experimentalCaptureToolbars,\n\t\tlayout,\n\t\t...options,\n\t};\n\tconst InnerBlocks =\n\t\tinnerBlocksProps.value && innerBlocksProps.onChange\n\t\t\t? ControlledInnerBlocks\n\t\t\t: UncontrolledInnerBlocks;\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: classnames(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-list__layout',\n\t\t\t__unstableDisableLayoutClassNames ? '' : layoutClassNames,\n\t\t\t{\n\t\t\t\t'has-overlay': hasOverlay,\n\t\t\t}\n\t\t),\n\t\tchildren: clientId ? (\n\t\t\t<InnerBlocks { ...innerBlocksProps } clientId={ clientId } />\n\t\t) : (\n\t\t\t<BlockListItems { ...options } />\n\t\t),\n\t};\n}\n\nuseInnerBlocksProps.save = getInnerBlocksProps;\n\n// Expose default appender placeholders as components.\nForwardedInnerBlocks.DefaultBlockAppender = DefaultBlockAppender;\nForwardedInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;\n\nForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport default ForwardedInnerBlocks;\n"]}
@@ -12,8 +12,6 @@ var _element = require("@wordpress/element");
12
12
 
13
13
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
14
14
 
15
- var _data = require("@wordpress/data");
16
-
17
15
  var _blocks = require("@wordpress/blocks");
18
16
 
19
17
  var _buttonBlockAppender = _interopRequireDefault(require("./button-block-appender"));
@@ -24,7 +22,7 @@ var _useNestedSettingsUpdate = _interopRequireDefault(require("./use-nested-sett
24
22
 
25
23
  var _useInnerBlockTemplateSync = _interopRequireDefault(require("./use-inner-block-template-sync"));
26
24
 
27
- var _getBlockContext = _interopRequireDefault(require("./get-block-context"));
25
+ var _useBlockContext = _interopRequireDefault(require("./use-block-context"));
28
26
 
29
27
  var _blockList = _interopRequireDefault(require("../block-list"));
30
28
 
@@ -38,8 +36,6 @@ var _blockContext = require("../block-context");
38
36
 
39
37
  var _layout = require("../block-list/layout");
40
38
 
41
- var _store = require("../../store");
42
-
43
39
  /**
44
40
  * WordPress dependencies
45
41
  */
@@ -119,13 +115,15 @@ function UncontrolledInnerBlocks(props) {
119
115
  gridProperties,
120
116
  useCompactList
121
117
  } = props;
122
- const block = (0, _data.useSelect)(select => select(_store.store).getBlock(clientId), [clientId]) || {
123
- innerBlocks: []
124
- };
118
+ const context = (0, _useBlockContext.default)(clientId);
125
119
  (0, _useNestedSettingsUpdate.default)(clientId, allowedBlocks, templateLock);
126
120
  (0, _useInnerBlockTemplateSync.default)(clientId, template, templateLock, templateInsertUpdatesSelection);
127
121
  const BlockListComponent = useCompactList ? _blockListCompact.default : _blockList.default;
128
- let blockList = (0, _element.createElement)(BlockListComponent, {
122
+ return (0, _element.createElement)(_layout.LayoutProvider, {
123
+ value: layout
124
+ }, (0, _element.createElement)(_blockContext.BlockContextProvider, {
125
+ value: context
126
+ }, (0, _element.createElement)(BlockListComponent, {
129
127
  marginVertical: marginVertical,
130
128
  marginHorizontal: marginHorizontal,
131
129
  rootClientId: clientId,
@@ -143,20 +141,7 @@ function UncontrolledInnerBlocks(props) {
143
141
  filterInnerBlocks: filterInnerBlocks,
144
142
  gridProperties: gridProperties,
145
143
  blockWidth: blockWidth
146
- }); // Wrap context provider if (and only if) block has context to provide.
147
-
148
- const blockType = (0, _blocks.getBlockType)(block.name);
149
-
150
- if (blockType && blockType.providesContext) {
151
- const context = (0, _getBlockContext.default)(block.attributes, blockType);
152
- blockList = (0, _element.createElement)(_layout.LayoutProvider, {
153
- value: layout
154
- }, (0, _element.createElement)(_blockContext.BlockContextProvider, {
155
- value: context
156
- }, blockList));
157
- }
158
-
159
- return blockList;
144
+ })));
160
145
  }
161
146
  /**
162
147
  * The controlled inner blocks component wraps the uncontrolled inner blocks
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inner-blocks/index.native.js"],"names":["useInnerBlocksProps","props","options","fallbackRef","clientId","ref","InnerBlocks","value","onChange","ControlledInnerBlocks","UncontrolledInnerBlocks","children","allowedBlocks","template","templateLock","templateInsertUpdatesSelection","orientation","renderAppender","renderFooterAppender","parentWidth","horizontal","contentResizeMode","contentStyle","onAddBlock","onDeleteBlock","marginVertical","marginHorizontal","horizontalAlignment","filterInnerBlocks","blockWidth","__experimentalLayout","layout","defaultLayout","gridProperties","useCompactList","block","select","blockEditorStore","getBlock","innerBlocks","BlockListComponent","BlockListCompact","BlockList","blockList","blockType","name","providesContext","context","attributes","allProps","DefaultBlockAppender","ButtonBlockAppender","save","getInnerBlocksProps","Content"],"mappings":";;;;;;;;;;AAQA;;;;AALA;;AACA;;AASA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAQA;AACA;AACA;;AAOA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAT,GAAyD;AAAA,MAA3BC,KAA2B,uEAAnB,EAAmB;AAAA,MAAfC,OAAe,uEAAL,EAAK;AAC/D,QAAMC,WAAW,GAAG,sBAApB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAe,mCAArB;AAEA,QAAMC,GAAG,GAAGJ,KAAK,CAACI,GAAN,IAAaF,WAAzB;AACA,QAAMG,W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AAChC,QAAM;AAAEG,IAAAA;AAAF,MAAe,mCAArB;AAEA,QAAM6C,QAAQ,GAAG;AAChB7C,IAAAA,QADgB;AAEhB,OAAGH;AAFa,GAAjB,CAHgC,CAQhC;;AACA,SAAOA,KAAK,CAACM,KAAN,IAAeN,KAAK,CAACO,QAArB,GACN,4BAAC,qBAAD,EAA4ByC,QAA5B,CADM,GAGN,4BAAC,uBAAD,EAA8BA,QAA9B,CAHD;AAKA,CAdD,C,CAgBA;;;AACA3C,WAAW,CAAC4C,oBAAZ,GAAmCA,6BAAnC;AACA5C,WAAW,CAAC6C,mBAAZ,GAAkCA,4BAAlC;AAEAnD,mBAAmB,CAACoD,IAApB,GAA2BC,qCAA3B;;AAEA/C,WAAW,CAACgD,OAAZ,GAAsB,MAAMtD,mBAAmB,CAACoD,IAApB,GAA2BzC,QAAvD;AAEA;AACA;AACA;;;eACeL,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tgetBlockType,\n\t__unstableGetInnerBlocksProps as getInnerBlocksProps,\n} from '@wordpress/blocks';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ButtonBlockAppender from './button-block-appender';\nimport DefaultBlockAppender from './default-block-appender';\nimport useNestedSettingsUpdate from './use-nested-settings-update';\nimport useInnerBlockTemplateSync from './use-inner-block-template-sync';\nimport getBlockContext from './get-block-context';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../block-list';\nimport BlockListCompact from '../block-list/block-list-compact';\nimport { useBlockEditContext } from '../block-edit/context';\nimport useBlockSync from '../provider/use-block-sync';\nimport { BlockContextProvider } from '../block-context';\nimport { defaultLayout, LayoutProvider } from '../block-list/layout';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * This hook is used to lightly mark an element as an inner blocks wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * an inner blocks 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} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Optional. Inner blocks options.\n *\n * @see https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport function useInnerBlocksProps( props = {}, options = {} ) {\n\tconst fallbackRef = useRef();\n\tconst { clientId } = useBlockEditContext();\n\n\tconst ref = props.ref || fallbackRef;\n\tconst InnerBlocks =\n\t\toptions.value && options.onChange\n\t\t\t? ControlledInnerBlocks\n\t\t\t: UncontrolledInnerBlocks;\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tchildren: (\n\t\t\t<InnerBlocks\n\t\t\t\t{ ...options }\n\t\t\t\tclientId={ clientId }\n\t\t\t\twrapperRef={ ref }\n\t\t\t/>\n\t\t),\n\t};\n}\n\n/**\n * InnerBlocks is a component which allows a single block to have multiple blocks\n * as children. The UncontrolledInnerBlocks component is used whenever the inner\n * blocks are not controlled by another entity. In other words, it is normally\n * used for inner blocks in the post editor\n *\n * @param {Object} props The component props.\n */\nfunction UncontrolledInnerBlocks( props ) {\n\tconst {\n\t\tclientId,\n\t\tallowedBlocks,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection,\n\t\torientation,\n\t\trenderAppender,\n\t\trenderFooterAppender,\n\t\tparentWidth,\n\t\thorizontal,\n\t\tcontentResizeMode,\n\t\tcontentStyle,\n\t\tonAddBlock,\n\t\tonDeleteBlock,\n\t\tmarginVertical,\n\t\tmarginHorizontal,\n\t\thorizontalAlignment,\n\t\tfilterInnerBlocks,\n\t\tblockWidth,\n\t\t__experimentalLayout: layout = defaultLayout,\n\t\tgridProperties,\n\t\tuseCompactList,\n\t} = props;\n\n\tconst block = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t[ clientId ]\n\t) || { innerBlocks: [] };\n\n\tuseNestedSettingsUpdate( clientId, allowedBlocks, templateLock );\n\n\tuseInnerBlockTemplateSync(\n\t\tclientId,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection\n\t);\n\n\tconst BlockListComponent = useCompactList ? BlockListCompact : BlockList;\n\n\tlet blockList = (\n\t\t<BlockListComponent\n\t\t\tmarginVertical={ marginVertical }\n\t\t\tmarginHorizontal={ marginHorizontal }\n\t\t\trootClientId={ clientId }\n\t\t\trenderAppender={ renderAppender }\n\t\t\trenderFooterAppender={ renderFooterAppender }\n\t\t\twithFooter={ false }\n\t\t\torientation={ orientation }\n\t\t\tparentWidth={ parentWidth }\n\t\t\thorizontalAlignment={ horizontalAlignment }\n\t\t\thorizontal={ horizontal }\n\t\t\tcontentResizeMode={ contentResizeMode }\n\t\t\tcontentStyle={ contentStyle }\n\t\t\tonAddBlock={ onAddBlock }\n\t\t\tonDeleteBlock={ onDeleteBlock }\n\t\t\tfilterInnerBlocks={ filterInnerBlocks }\n\t\t\tgridProperties={ gridProperties }\n\t\t\tblockWidth={ blockWidth }\n\t\t/>\n\t);\n\n\t// Wrap context provider if (and only if) block has context to provide.\n\tconst blockType = getBlockType( block.name );\n\tif ( blockType && blockType.providesContext ) {\n\t\tconst context = getBlockContext( block.attributes, blockType );\n\n\t\tblockList = (\n\t\t\t<LayoutProvider value={ layout }>\n\t\t\t\t<BlockContextProvider value={ context }>\n\t\t\t\t\t{ blockList }\n\t\t\t\t</BlockContextProvider>\n\t\t\t</LayoutProvider>\n\t\t);\n\t}\n\n\treturn blockList;\n}\n\n/**\n * The controlled inner blocks component wraps the uncontrolled inner blocks\n * component with the blockSync hook. This keeps the innerBlocks of the block in\n * the block-editor store in sync with the blocks of the controlling entity. An\n * example of an inner block controller is a template part block, which provides\n * its own blocks from the template part entity data source.\n *\n * @param {Object} props The component props.\n */\nfunction ControlledInnerBlocks( props ) {\n\tuseBlockSync( props );\n\treturn <UncontrolledInnerBlocks { ...props } />;\n}\n\n/**\n * Wrapped InnerBlocks component which detects whether to use the controlled or\n * uncontrolled variations of the InnerBlocks component. This is the component\n * which should be used throughout the application.\n *\n * @param {Object} props The component props.\n */\nconst InnerBlocks = ( props ) => {\n\tconst { clientId } = useBlockEditContext();\n\n\tconst allProps = {\n\t\tclientId,\n\t\t...props,\n\t};\n\n\t// Detects if the InnerBlocks should be controlled by an incoming value.\n\treturn props.value && props.onChange ? (\n\t\t<ControlledInnerBlocks { ...allProps } />\n\t) : (\n\t\t<UncontrolledInnerBlocks { ...allProps } />\n\t);\n};\n\n// Expose default appender placeholders as components.\nInnerBlocks.DefaultBlockAppender = DefaultBlockAppender;\nInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;\n\nuseInnerBlocksProps.save = getInnerBlocksProps;\n\nInnerBlocks.Content = () => useInnerBlocksProps.save().children;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport default InnerBlocks;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inner-blocks/index.native.js"],"names":["useInnerBlocksProps","props","options","fallbackRef","clientId","ref","InnerBlocks","value","onChange","ControlledInnerBlocks","UncontrolledInnerBlocks","children","allowedBlocks","template","templateLock","templateInsertUpdatesSelection","orientation","renderAppender","renderFooterAppender","parentWidth","horizontal","contentResizeMode","contentStyle","onAddBlock","onDeleteBlock","marginVertical","marginHorizontal","horizontalAlignment","filterInnerBlocks","blockWidth","__experimentalLayout","layout","defaultLayout","gridProperties","useCompactList","context","BlockListComponent","BlockListCompact","BlockList","allProps","DefaultBlockAppender","ButtonBlockAppender","save","getInnerBlocksProps","Content"],"mappings":";;;;;;;;;;AAIA;;;;AADA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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ACM,KAAN,IAAeN,KAAK,CAACO,QAArB,GACN,4BAAC,qBAAD,EAA4B+B,QAA5B,CADM,GAGN,4BAAC,uBAAD,EAA8BA,QAA9B,CAHD;AAKA,CAdD,C,CAgBA;;;AACAjC,WAAW,CAACkC,oBAAZ,GAAmCA,6BAAnC;AACAlC,WAAW,CAACmC,mBAAZ,GAAkCA,4BAAlC;AAEAzC,mBAAmB,CAAC0C,IAApB,GAA2BC,qCAA3B;;AAEArC,WAAW,CAACsC,OAAZ,GAAsB,MAAM5C,mBAAmB,CAAC0C,IAApB,GAA2B/B,QAAvD;AAEA;AACA;AACA;;;eACeL,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __unstableGetInnerBlocksProps as getInnerBlocksProps } from '@wordpress/blocks';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ButtonBlockAppender from './button-block-appender';\nimport DefaultBlockAppender from './default-block-appender';\nimport useNestedSettingsUpdate from './use-nested-settings-update';\nimport useInnerBlockTemplateSync from './use-inner-block-template-sync';\nimport useBlockContext from './use-block-context';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../block-list';\nimport BlockListCompact from '../block-list/block-list-compact';\nimport { useBlockEditContext } from '../block-edit/context';\nimport useBlockSync from '../provider/use-block-sync';\nimport { BlockContextProvider } from '../block-context';\nimport { defaultLayout, LayoutProvider } from '../block-list/layout';\n\n/**\n * This hook is used to lightly mark an element as an inner blocks wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * an inner blocks 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} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Optional. Inner blocks options.\n *\n * @see https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport function useInnerBlocksProps( props = {}, options = {} ) {\n\tconst fallbackRef = useRef();\n\tconst { clientId } = useBlockEditContext();\n\n\tconst ref = props.ref || fallbackRef;\n\tconst InnerBlocks =\n\t\toptions.value && options.onChange\n\t\t\t? ControlledInnerBlocks\n\t\t\t: UncontrolledInnerBlocks;\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tchildren: (\n\t\t\t<InnerBlocks\n\t\t\t\t{ ...options }\n\t\t\t\tclientId={ clientId }\n\t\t\t\twrapperRef={ ref }\n\t\t\t/>\n\t\t),\n\t};\n}\n\n/**\n * InnerBlocks is a component which allows a single block to have multiple blocks\n * as children. The UncontrolledInnerBlocks component is used whenever the inner\n * blocks are not controlled by another entity. In other words, it is normally\n * used for inner blocks in the post editor\n *\n * @param {Object} props The component props.\n */\nfunction UncontrolledInnerBlocks( props ) {\n\tconst {\n\t\tclientId,\n\t\tallowedBlocks,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection,\n\t\torientation,\n\t\trenderAppender,\n\t\trenderFooterAppender,\n\t\tparentWidth,\n\t\thorizontal,\n\t\tcontentResizeMode,\n\t\tcontentStyle,\n\t\tonAddBlock,\n\t\tonDeleteBlock,\n\t\tmarginVertical,\n\t\tmarginHorizontal,\n\t\thorizontalAlignment,\n\t\tfilterInnerBlocks,\n\t\tblockWidth,\n\t\t__experimentalLayout: layout = defaultLayout,\n\t\tgridProperties,\n\t\tuseCompactList,\n\t} = props;\n\n\tconst context = useBlockContext( clientId );\n\n\tuseNestedSettingsUpdate( clientId, allowedBlocks, templateLock );\n\n\tuseInnerBlockTemplateSync(\n\t\tclientId,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection\n\t);\n\n\tconst BlockListComponent = useCompactList ? BlockListCompact : BlockList;\n\n\treturn (\n\t\t<LayoutProvider value={ layout }>\n\t\t\t<BlockContextProvider value={ context }>\n\t\t\t\t<BlockListComponent\n\t\t\t\t\tmarginVertical={ marginVertical }\n\t\t\t\t\tmarginHorizontal={ marginHorizontal }\n\t\t\t\t\trootClientId={ clientId }\n\t\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t\trenderFooterAppender={ renderFooterAppender }\n\t\t\t\t\twithFooter={ false }\n\t\t\t\t\torientation={ orientation }\n\t\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\t\thorizontalAlignment={ horizontalAlignment }\n\t\t\t\t\thorizontal={ horizontal }\n\t\t\t\t\tcontentResizeMode={ contentResizeMode }\n\t\t\t\t\tcontentStyle={ contentStyle }\n\t\t\t\t\tonAddBlock={ onAddBlock }\n\t\t\t\t\tonDeleteBlock={ onDeleteBlock }\n\t\t\t\t\tfilterInnerBlocks={ filterInnerBlocks }\n\t\t\t\t\tgridProperties={ gridProperties }\n\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t/>\n\t\t\t</BlockContextProvider>\n\t\t</LayoutProvider>\n\t);\n}\n\n/**\n * The controlled inner blocks component wraps the uncontrolled inner blocks\n * component with the blockSync hook. This keeps the innerBlocks of the block in\n * the block-editor store in sync with the blocks of the controlling entity. An\n * example of an inner block controller is a template part block, which provides\n * its own blocks from the template part entity data source.\n *\n * @param {Object} props The component props.\n */\nfunction ControlledInnerBlocks( props ) {\n\tuseBlockSync( props );\n\treturn <UncontrolledInnerBlocks { ...props } />;\n}\n\n/**\n * Wrapped InnerBlocks component which detects whether to use the controlled or\n * uncontrolled variations of the InnerBlocks component. This is the component\n * which should be used throughout the application.\n *\n * @param {Object} props The component props.\n */\nconst InnerBlocks = ( props ) => {\n\tconst { clientId } = useBlockEditContext();\n\n\tconst allProps = {\n\t\tclientId,\n\t\t...props,\n\t};\n\n\t// Detects if the InnerBlocks should be controlled by an incoming value.\n\treturn props.value && props.onChange ? (\n\t\t<ControlledInnerBlocks { ...allProps } />\n\t) : (\n\t\t<UncontrolledInnerBlocks { ...allProps } />\n\t);\n};\n\n// Expose default appender placeholders as components.\nInnerBlocks.DefaultBlockAppender = DefaultBlockAppender;\nInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;\n\nuseInnerBlocksProps.save = getInnerBlocksProps;\n\nInnerBlocks.Content = () => useInnerBlocksProps.save().children;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport default InnerBlocks;\n"]}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = useBlockContext;
7
+
8
+ var _blocks = require("@wordpress/blocks");
9
+
10
+ var _data = require("@wordpress/data");
11
+
12
+ var _store = require("../../store");
13
+
14
+ /**
15
+ * WordPress dependencies
16
+ */
17
+
18
+ /**
19
+ * Internal dependencies
20
+ */
21
+
22
+ /**
23
+ * Returns a context object for a given block.
24
+ *
25
+ * @param {string} clientId The block client ID.
26
+ *
27
+ * @return {Record<string,*>} Context value.
28
+ */
29
+ function useBlockContext(clientId) {
30
+ return (0, _data.useSelect)(select => {
31
+ const block = select(_store.store).getBlock(clientId);
32
+
33
+ if (!block) {
34
+ return undefined;
35
+ }
36
+
37
+ const blockType = select(_blocks.store).getBlockType(block.name);
38
+
39
+ if (!blockType) {
40
+ return undefined;
41
+ }
42
+
43
+ if (Object.keys(blockType.providesContext).length === 0) {
44
+ return undefined;
45
+ }
46
+
47
+ return Object.fromEntries(Object.entries(blockType.providesContext).map(_ref => {
48
+ let [contextName, attributeName] = _ref;
49
+ return [contextName, block.attributes[attributeName]];
50
+ }));
51
+ }, [clientId]);
52
+ }
53
+ //# sourceMappingURL=use-block-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inner-blocks/use-block-context.js"],"names":["useBlockContext","clientId","select","block","blockEditorStore","getBlock","undefined","blockType","blocksStore","getBlockType","name","Object","keys","providesContext","length","fromEntries","entries","map","contextName","attributeName","attributes"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,eAAT,CAA0BC,QAA1B,EAAqC;AACnD,SAAO,qBACJC,MAAF,IAAc;AACb,UAAMC,KAAK,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAA2BC,QAA3B,CAAqCJ,QAArC,CAAd;;AACA,QAAK,CAAEE,KAAP,EAAe;AACd,aAAOG,SAAP;AACA;;AAED,UAAMC,SAAS,GAAGL,MAAM,CAAEM,aAAF,CAAN,CAAsBC,YAAtB,CAAoCN,KAAK,CAACO,IAA1C,CAAlB;;AACA,QAAK,CAAEH,SAAP,EAAmB;AAClB,aAAOD,SAAP;AACA;;AAED,QAAKK,MAAM,CAACC,IAAP,CAAaL,SAAS,CAACM,eAAvB,EAAyCC,MAAzC,KAAoD,CAAzD,EAA6D;AAC5D,aAAOR,SAAP;AACA;;AAED,WAAOK,MAAM,CAACI,WAAP,CACNJ,MAAM,CAACK,OAAP,CAAgBT,SAAS,CAACM,eAA1B,EAA4CI,GAA5C,CACC;AAAA,UAAE,CAAEC,WAAF,EAAeC,aAAf,CAAF;AAAA,aAAsC,CACrCD,WADqC,EAErCf,KAAK,CAACiB,UAAN,CAAkBD,aAAlB,CAFqC,CAAtC;AAAA,KADD,CADM,CAAP;AAQA,GAxBK,EAyBN,CAAElB,QAAF,CAzBM,CAAP;AA2BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Returns a context object for a given block.\n *\n * @param {string} clientId The block client ID.\n *\n * @return {Record<string,*>} Context value.\n */\nexport default function useBlockContext( clientId ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst block = select( blockEditorStore ).getBlock( clientId );\n\t\t\tif ( ! block ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst blockType = select( blocksStore ).getBlockType( block.name );\n\t\t\tif ( ! blockType ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tif ( Object.keys( blockType.providesContext ).length === 0 ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries( blockType.providesContext ).map(\n\t\t\t\t\t( [ contextName, attributeName ] ) => [\n\t\t\t\t\t\tcontextName,\n\t\t\t\t\t\tblock.attributes[ attributeName ],\n\t\t\t\t\t]\n\t\t\t\t)\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n}\n"]}
@@ -53,7 +53,6 @@ function PatternsExplorerModal(_ref2) {
53
53
  } = _ref2;
54
54
  return (0, _element.createElement)(_components.Modal, {
55
55
  title: (0, _i18n.__)('Patterns'),
56
- closeLabel: (0, _i18n.__)('Close'),
57
56
  onRequestClose: onModalClose,
58
57
  isFullScreen: true
59
58
  }, (0, _element.createElement)(PatternsExplorer, restProps));
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/block-patterns-explorer/explorer.js"],"names":["PatternsExplorer","initialCategory","patternCategories","filterValue","setFilterValue","selectedCategory","setSelectedCategory","name","PatternsExplorerModal","onModalClose","restProps"],"mappings":";;;;;;;;;AAIA;;AADA;;AAEA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;AAIA,SAASA,gBAAT,OAAoE;AAAA,MAAzC;AAAEC,IAAAA,eAAF;AAAmBC,IAAAA;AAAnB,GAAyC;AACnE,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkC,uBAAU,EAAV,CAAxC;AACA,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,uBACjDL,eADiD,aACjDA,eADiD,uBACjDA,eAAe,CAAEM,IADgC,CAAlD;AAGA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,gBAAD;AACC,IAAA,gBAAgB,EAAGF,gBADpB;AAEC,IAAA,iBAAiB,EAAGH,iBAFrB;AAGC,IAAA,eAAe,EAAGI,mBAHnB;AAIC,IAAA,WAAW,EAAGH,WAJf;AAKC,IAAA,cAAc,EAAGC;AALlB,IADD,EAQC,4BAAC,qBAAD;AACC,IAAA,WAAW,EAAGD,WADf;AAEC,IAAA,gBAAgB,EAAGE,gBAFpB;AAGC,IAAA,iBAAiB,EAAGH;AAHrB,IARD,CADD;AAgBA;;AAED,SAASM,qBAAT,QAAiE;AAAA,MAAjC;AAAEC,IAAAA,YAAF;AAAgB,OAAGC;AAAnB,GAAiC;AAChE,SACC,4BAAC,iBAAD;AACC,IAAA,KAAK,EAAG,cAAI,UAAJ,CADT;AAEC,IAAA,UAAU,EAAG,cAAI,OAAJ,CAFd;AAGC,IAAA,cAAc,EAAGD,YAHlB;AAIC,IAAA,YAAY;AAJb,KAMC,4BAAC,gBAAD,EAAuBC,SAAvB,CAND,CADD;AAUA;;eAEcF,qB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PatternExplorerSidebar from './sidebar';\nimport PatternList from './patterns-list';\n\nfunction PatternsExplorer( { initialCategory, patternCategories } ) {\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ selectedCategory, setSelectedCategory ] = useState(\n\t\tinitialCategory?.name\n\t);\n\treturn (\n\t\t<div className=\"block-editor-block-patterns-explorer\">\n\t\t\t<PatternExplorerSidebar\n\t\t\t\tselectedCategory={ selectedCategory }\n\t\t\t\tpatternCategories={ patternCategories }\n\t\t\t\tonClickCategory={ setSelectedCategory }\n\t\t\t\tfilterValue={ filterValue }\n\t\t\t\tsetFilterValue={ setFilterValue }\n\t\t\t/>\n\t\t\t<PatternList\n\t\t\t\tfilterValue={ filterValue }\n\t\t\t\tselectedCategory={ selectedCategory }\n\t\t\t\tpatternCategories={ patternCategories }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction PatternsExplorerModal( { onModalClose, ...restProps } ) {\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Patterns' ) }\n\t\t\tcloseLabel={ __( 'Close' ) }\n\t\t\tonRequestClose={ onModalClose }\n\t\t\tisFullScreen\n\t\t>\n\t\t\t<PatternsExplorer { ...restProps } />\n\t\t</Modal>\n\t);\n}\n\nexport default PatternsExplorerModal;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/block-patterns-explorer/explorer.js"],"names":["PatternsExplorer","initialCategory","patternCategories","filterValue","setFilterValue","selectedCategory","setSelectedCategory","name","PatternsExplorerModal","onModalClose","restProps"],"mappings":";;;;;;;;;AAIA;;AADA;;AAEA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;AAIA,SAASA,gBAAT,OAAoE;AAAA,MAAzC;AAAEC,IAAAA,eAAF;AAAmBC,IAAAA;AAAnB,GAAyC;AACnE,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkC,uBAAU,EAAV,CAAxC;AACA,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,uBACjDL,eADiD,aACjDA,eADiD,uBACjDA,eAAe,CAAEM,IADgC,CAAlD;AAGA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,gBAAD;AACC,IAAA,gBAAgB,EAAGF,gBADpB;AAEC,IAAA,iBAAiB,EAAGH,iBAFrB;AAGC,IAAA,eAAe,EAAGI,mBAHnB;AAIC,IAAA,WAAW,EAAGH,WAJf;AAKC,IAAA,cAAc,EAAGC;AALlB,IADD,EAQC,4BAAC,qBAAD;AACC,IAAA,WAAW,EAAGD,WADf;AAEC,IAAA,gBAAgB,EAAGE,gBAFpB;AAGC,IAAA,iBAAiB,EAAGH;AAHrB,IARD,CADD;AAgBA;;AAED,SAASM,qBAAT,QAAiE;AAAA,MAAjC;AAAEC,IAAAA,YAAF;AAAgB,OAAGC;AAAnB,GAAiC;AAChE,SACC,4BAAC,iBAAD;AACC,IAAA,KAAK,EAAG,cAAI,UAAJ,CADT;AAEC,IAAA,cAAc,EAAGD,YAFlB;AAGC,IAAA,YAAY;AAHb,KAKC,4BAAC,gBAAD,EAAuBC,SAAvB,CALD,CADD;AASA;;eAEcF,qB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PatternExplorerSidebar from './sidebar';\nimport PatternList from './patterns-list';\n\nfunction PatternsExplorer( { initialCategory, patternCategories } ) {\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ selectedCategory, setSelectedCategory ] = useState(\n\t\tinitialCategory?.name\n\t);\n\treturn (\n\t\t<div className=\"block-editor-block-patterns-explorer\">\n\t\t\t<PatternExplorerSidebar\n\t\t\t\tselectedCategory={ selectedCategory }\n\t\t\t\tpatternCategories={ patternCategories }\n\t\t\t\tonClickCategory={ setSelectedCategory }\n\t\t\t\tfilterValue={ filterValue }\n\t\t\t\tsetFilterValue={ setFilterValue }\n\t\t\t/>\n\t\t\t<PatternList\n\t\t\t\tfilterValue={ filterValue }\n\t\t\t\tselectedCategory={ selectedCategory }\n\t\t\t\tpatternCategories={ patternCategories }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction PatternsExplorerModal( { onModalClose, ...restProps } ) {\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Patterns' ) }\n\t\t\tonRequestClose={ onModalClose }\n\t\t\tisFullScreen\n\t\t>\n\t\t\t<PatternsExplorer { ...restProps } />\n\t\t</Modal>\n\t);\n}\n\nexport default PatternsExplorerModal;\n"]}
@@ -83,6 +83,7 @@ function BlockPatternsCategoryDialog(_ref3) {
83
83
  let {
84
84
  rootClientId,
85
85
  onInsert,
86
+ onHover,
86
87
  category,
87
88
  showTitlesAsTooltip
88
89
  } = _ref3;
@@ -101,6 +102,7 @@ function BlockPatternsCategoryDialog(_ref3) {
101
102
  }, (0, _element.createElement)(BlockPatternsCategoryPanel, {
102
103
  rootClientId: rootClientId,
103
104
  onInsert: onInsert,
105
+ onHover: onHover,
104
106
  category: category,
105
107
  showTitlesAsTooltip: showTitlesAsTooltip
106
108
  }));
@@ -110,6 +112,7 @@ function BlockPatternsCategoryPanel(_ref4) {
110
112
  let {
111
113
  rootClientId,
112
114
  onInsert,
115
+ onHover,
113
116
  category,
114
117
  showTitlesAsTooltip
115
118
  } = _ref4;
@@ -129,7 +132,9 @@ function BlockPatternsCategoryPanel(_ref4) {
129
132
  const availablePatternCategories = (_pattern$categories$f = (_pattern$categories3 = pattern.categories) === null || _pattern$categories3 === void 0 ? void 0 : _pattern$categories3.filter(cat => availableCategories.find(availableCategory => availableCategory.name === cat))) !== null && _pattern$categories$f !== void 0 ? _pattern$categories$f : [];
130
133
  return availablePatternCategories.length === 0;
131
134
  }), [allPatterns, category]);
132
- const currentShownPatterns = (0, _compose.useAsyncList)(currentCategoryPatterns);
135
+ const currentShownPatterns = (0, _compose.useAsyncList)(currentCategoryPatterns); // Hide block pattern preview on unmount.
136
+
137
+ (0, _element.useEffect)(() => () => onHover(null), []);
133
138
 
134
139
  if (!currentCategoryPatterns.length) {
135
140
  return null;
@@ -143,6 +148,7 @@ function BlockPatternsCategoryPanel(_ref4) {
143
148
  shownPatterns: currentShownPatterns,
144
149
  blockPatterns: currentCategoryPatterns,
145
150
  onClickPattern: onClick,
151
+ onHover: onHover,
146
152
  label: category.label,
147
153
  orientation: "vertical",
148
154
  category: category.label,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/block-patterns-tab.js"],"names":["usePatternsCategories","rootClientId","allPatterns","allCategories","undefined","hasRegisteredCategory","pattern","categories","length","some","cat","category","name","populatedCategories","filter","includes","sort","currentName","nextName","categoryName","find","push","label","BlockPatternsCategoryDialog","onInsert","showTitlesAsTooltip","container","timeout","setTimeout","firstTabbable","focus","tabbable","current","clearTimeout","BlockPatternsCategoryPanel","onClick","availableCategories","currentCategoryPatterns","availablePatternCategories","availableCategory","currentShownPatterns","description","BlockPatternsTabs","onSelectCategory","selectedCategory","showPatternsExplorer","setShowPatternsExplorer","isMobile","map","chevronRight"],"mappings":";;;;;;;;;;;AAGA;;AAOA;;AACA;;AACA;;AAOA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAoBA;AACA;AACA;AAMA,SAASA,qBAAT,CAAgCC,YAAhC,EAA+C;AAC9C,QAAM,CAAEC,WAAF,EAAeC,aAAf,IAAiC,+BACtCC,SADsC,EAEtCH,YAFsC,CAAvC;AAKA,QAAMI,qBAAqB,GAAG,0BAC3BC,OAAF,IAAe;AACd,QAAK,CAAEA,OAAO,CAACC,UAAV,IAAwB,CAAED,OAAO,CAACC,UAAR,CAAmBC,MAAlD,EAA2D;AAC1D,aAAO,KAAP;AACA;;AAED,WAAOF,OAAO,CAACC,UAAR,CAAmBE,IAAnB,CAA2BC,GAAF,IAC/BP,aAAa,CAACM,IAAd,CAAsBE,QAAF,IAAgBA,QAAQ,CAACC,IAAT,KAAkBF,GAAtD,CADM,CAAP;AAGA,GAT4B,EAU7B,CAAEP,aAAF,CAV6B,CAA9B,CAN8C,CAmB9C;;AACA,QAAMU,mBAAmB,GAAG,sBAAS,MAAM;AAC1C,UAAMN,UAAU,GAAGJ,aAAa,CAC9BW,MADiB,CACPH,QAAF,IACRT,WAAW,CAACO,IAAZ,CAAoBH,OAAF;AAAA;;AAAA,oCACjBA,OAAO,CAACC,UADS,wDACjB,oBAAoBQ,QAApB,CAA8BJ,QAAQ,CAACC,IAAvC,CADiB;AAAA,KAAlB,CAFiB,EAMjBI,IANiB,CAMX,iBAAiD;AAAA,UAA/C;AAAEJ,QAAAA,IAAI,EAAEK;AAAR,OAA+C;AAAA,UAAxB;AAAEL,QAAAA,IAAI,EAAEM;AAAR,OAAwB;;AACvD,UACC,CAAE,CAAED,WAAF,EAAeC,QAAf,EAA0BT,IAA1B,CAAkCU,YAAF,IACjC,CAAE,UAAF,EAA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iC,gBAAb,GACG,MADH,GAEGxC;AAfL,KAkBC,4BAAC,gCAAD,QACC,4BAAC,qBAAD,QACGO,QAAQ,CAACW,KADZ,CADD,EAIC,4BAAC,WAAD;AAAM,IAAA,IAAI,EAAG2B;AAAb,IAJD,CAlBD,CADC,CAJH,EA+BC;AAAK,IAAA,IAAI,EAAC;AAAV,KACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,gDADX;AAEC,IAAA,OAAO,EAAG,MACTH,uBAAuB,CAAE,IAAF,CAHzB;AAKC,IAAA,OAAO,EAAC;AALT,KAOG,cAAI,sBAAJ,CAPH,CADD,CA/BD,CADD,CADD,CAFF,EAkDGC,QAAQ,IACT,4BAAC,4BAAD;AAAqB,IAAA,UAAU,EAAGxC;AAAlC,KACKI,QAAF,IACD,4BAAC,0BAAD;AACC,IAAA,QAAQ,EAAGa,QADZ;AAEC,IAAA,YAAY,EAAGvB,YAFhB;AAGC,IAAA,QAAQ,EAAGU,QAHZ;AAIC,IAAA,mBAAmB,EAAG;AAJvB,IAFF,CAnDF,EA8DGkC,oBAAoB,IACrB,4BAAC,iBAAD;AACC,IAAA,eAAe,EAAGD,gBADnB;AAEC,IAAA,iBAAiB,EAAGrC,UAFrB;AAGC,IAAA,YAAY,EAAG,MAAMuC,uBAAuB,CAAE,KAAF;AAH7C,IA/DF,CADD;AAwEA;;eAEcJ,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseMemo,\n\tuseState,\n\tuseCallback,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { _x, __ } from '@wordpress/i18n';\nimport { useAsyncList, useViewportMatch } from '@wordpress/compose';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\tFlexBlock,\n\tButton,\n} from '@wordpress/components';\nimport { Icon, chevronRight } from '@wordpress/icons';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport usePatternsState from './hooks/use-patterns-state';\nimport BlockPatternList from '../block-patterns-list';\nimport PatternsExplorerModal from './block-patterns-explorer/explorer';\nimport MobileTabNavigation from './mobile-tab-navigation';\n\nfunction usePatternsCategories( rootClientId ) {\n\tconst [ allPatterns, allCategories ] = usePatternsState(\n\t\tundefined,\n\t\trootClientId\n\t);\n\n\tconst hasRegisteredCategory = useCallback(\n\t\t( pattern ) => {\n\t\t\tif ( ! pattern.categories || ! pattern.categories.length ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn pattern.categories.some( ( cat ) =>\n\t\t\t\tallCategories.some( ( category ) => category.name === cat )\n\t\t\t);\n\t\t},\n\t\t[ allCategories ]\n\t);\n\n\t// Remove any empty categories.\n\tconst populatedCategories = useMemo( () => {\n\t\tconst categories = allCategories\n\t\t\t.filter( ( category ) =>\n\t\t\t\tallPatterns.some( ( pattern ) =>\n\t\t\t\t\tpattern.categories?.includes( category.name )\n\t\t\t\t)\n\t\t\t)\n\t\t\t.sort( ( { name: currentName }, { name: nextName } ) => {\n\t\t\t\tif (\n\t\t\t\t\t! [ currentName, nextName ].some( ( categoryName ) =>\n\t\t\t\t\t\t[ 'featured', 'text' ].includes( categoryName )\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\t// Move `featured` category to the top and `text` to the bottom.\n\t\t\t\treturn currentName === 'featured' || nextName === 'text'\n\t\t\t\t\t? -1\n\t\t\t\t\t: 1;\n\t\t\t} );\n\n\t\tif (\n\t\t\tallPatterns.some(\n\t\t\t\t( pattern ) => ! hasRegisteredCategory( pattern )\n\t\t\t) &&\n\t\t\t! categories.find(\n\t\t\t\t( category ) => category.name === 'uncategorized'\n\t\t\t)\n\t\t) {\n\t\t\tcategories.push( {\n\t\t\t\tname: 'uncategorized',\n\t\t\t\tlabel: _x( 'Uncategorized' ),\n\t\t\t} );\n\t\t}\n\n\t\treturn categories;\n\t}, [ allPatterns, allCategories ] );\n\n\treturn populatedCategories;\n}\n\nexport function BlockPatternsCategoryDialog( {\n\trootClientId,\n\tonInsert,\n\tcategory,\n\tshowTitlesAsTooltip,\n} ) {\n\tconst container = useRef();\n\n\tuseEffect( () => {\n\t\tconst timeout = setTimeout( () => {\n\t\t\tconst [ firstTabbable ] = focus.tabbable.find( container.current );\n\t\t\tfirstTabbable?.focus();\n\t\t} );\n\t\treturn () => clearTimeout( timeout );\n\t}, [ category ] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ container }\n\t\t\tclassName=\"block-editor-inserter__patterns-category-dialog\"\n\t\t>\n\t\t\t<BlockPatternsCategoryPanel\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\tonInsert={ onInsert }\n\t\t\t\tcategory={ category }\n\t\t\t\tshowTitlesAsTooltip={ showTitlesAsTooltip }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport function BlockPatternsCategoryPanel( {\n\trootClientId,\n\tonInsert,\n\tcategory,\n\tshowTitlesAsTooltip,\n} ) {\n\tconst [ allPatterns, , onClick ] = usePatternsState(\n\t\tonInsert,\n\t\trootClientId\n\t);\n\n\tconst availableCategories = usePatternsCategories( rootClientId );\n\tconst currentCategoryPatterns = useMemo(\n\t\t() =>\n\t\t\tallPatterns.filter( ( pattern ) => {\n\t\t\t\tif ( category.name !== 'uncategorized' ) {\n\t\t\t\t\treturn pattern.categories?.includes( category.name );\n\t\t\t\t}\n\n\t\t\t\t// The uncategorized category should show all the patterns without any category\n\t\t\t\t// or with no available category.\n\t\t\t\tconst availablePatternCategories =\n\t\t\t\t\tpattern.categories?.filter( ( cat ) =>\n\t\t\t\t\t\tavailableCategories.find(\n\t\t\t\t\t\t\t( availableCategory ) =>\n\t\t\t\t\t\t\t\tavailableCategory.name === cat\n\t\t\t\t\t\t)\n\t\t\t\t\t) ?? [];\n\n\t\t\t\treturn availablePatternCategories.length === 0;\n\t\t\t} ),\n\t\t[ allPatterns, category ]\n\t);\n\n\tconst currentShownPatterns = useAsyncList( currentCategoryPatterns );\n\n\tif ( ! currentCategoryPatterns.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"block-editor-inserter__patterns-category-panel\">\n\t\t\t<div className=\"block-editor-inserter__patterns-category-panel-title\">\n\t\t\t\t{ category.label }\n\t\t\t</div>\n\t\t\t<p>{ category.description }</p>\n\t\t\t<BlockPatternList\n\t\t\t\tshownPatterns={ currentShownPatterns }\n\t\t\t\tblockPatterns={ currentCategoryPatterns }\n\t\t\t\tonClickPattern={ onClick }\n\t\t\t\tlabel={ category.label }\n\t\t\t\torientation=\"vertical\"\n\t\t\t\tcategory={ category.label }\n\t\t\t\tisDraggable\n\t\t\t\tshowTitlesAsTooltip={ showTitlesAsTooltip }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction BlockPatternsTabs( {\n\tonSelectCategory,\n\tselectedCategory,\n\tonInsert,\n\trootClientId,\n} ) {\n\tconst [ showPatternsExplorer, setShowPatternsExplorer ] = useState( false );\n\tconst categories = usePatternsCategories( rootClientId );\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn (\n\t\t<>\n\t\t\t{ ! isMobile && (\n\t\t\t\t<div className=\"block-editor-inserter__block-patterns-tabs-container\">\n\t\t\t\t\t<nav aria-label={ __( 'Block pattern categories' ) }>\n\t\t\t\t\t\t<ItemGroup\n\t\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\t\tclassName=\"block-editor-inserter__block-patterns-tabs\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\t\trole=\"listitem\"\n\t\t\t\t\t\t\t\t\tkey={ category.name }\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tonSelectCategory( category )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\tcategory === selectedCategory\n\t\t\t\t\t\t\t\t\t\t\t? 'block-editor-inserter__patterns-category block-editor-inserter__patterns-selected-category'\n\t\t\t\t\t\t\t\t\t\t\t: 'block-editor-inserter__patterns-category'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-label={ category.label }\n\t\t\t\t\t\t\t\t\taria-current={\n\t\t\t\t\t\t\t\t\t\tcategory === selectedCategory\n\t\t\t\t\t\t\t\t\t\t\t? 'true'\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>\n\t\t\t\t\t\t\t\t\t<HStack>\n\t\t\t\t\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t\t\t\t\t{ category.label }\n\t\t\t\t\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ chevronRight } />\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t<div role=\"listitem\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-inserter__patterns-explore-button\"\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tsetShowPatternsExplorer( true )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Explore all patterns' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t</nav>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ isMobile && (\n\t\t\t\t<MobileTabNavigation categories={ categories }>\n\t\t\t\t\t{ ( category ) => (\n\t\t\t\t\t\t<BlockPatternsCategoryPanel\n\t\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tcategory={ category }\n\t\t\t\t\t\t\tshowTitlesAsTooltip={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</MobileTabNavigation>\n\t\t\t) }\n\t\t\t{ showPatternsExplorer && (\n\t\t\t\t<PatternsExplorerModal\n\t\t\t\t\tinitialCategory={ selectedCategory }\n\t\t\t\t\tpatternCategories={ categories }\n\t\t\t\t\tonModalClose={ () => setShowPatternsExplorer( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default BlockPatternsTabs;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/block-patterns-tab.js"],"names":["usePatternsCategories","rootClientId","allPatterns","allCategories","undefined","hasRegisteredCategory","pattern","categories","length","some","cat","category","name","populatedCategories","filter","includes","sort","currentName","nextName","categoryName","find","push","label","BlockPatternsCategoryDialog","onInsert","onHover","showTitlesAsTooltip","container","timeout","setTimeout","firstTabbable","focus","tabbable","current","clearTimeout","BlockPatternsCategoryPanel","onClick","availableCategories","currentCategoryPatterns","availablePatternCategories","availableCategory","currentShownPatterns","description","BlockPatternsTabs","onSelectCategory","selectedCategory","showPatternsExplorer","setShowPatternsExplorer","isMobile","map","chevronRight"],"mappings":";;;;;;;;;;;AAGA;;AAOA;;AACA;;AACA;;AAOA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAoBA;AACA;AACA;AAMA,SAASA,qBAAT,CAAgCC,YAAhC,EAA+C;AAC9C,QAAM,CAAEC,WAAF,EAAeC,aAAf,IAAiC,+BACtCC,SADsC,EAEtCH,YAFsC,CAAvC;AAKA,QAAMI,qBAAqB,GAAG,0BAC3BC,OAAF,IAAe;AACd,QAAK,CAAEA,OAAO,CAACC,UAAV,IAAwB,CAAED,OAAO,CAACC,UAAR,CAAmBC,MAAlD,EAA2D;AAC1D,aAAO,KAAP;AACA;;AAED,WAAOF,OAAO,CAACC,UAAR,CAAmBE,IAAnB,CAA2BC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,CA/BD,CADD,CADD,CAFF,EAkDGC,QAAQ,IACT,4BAAC,4BAAD;AAAqB,IAAA,UAAU,EAAGzC;AAAlC,KACKI,QAAF,IACD,4BAAC,0BAAD;AACC,IAAA,QAAQ,EAAGa,QADZ;AAEC,IAAA,YAAY,EAAGvB,YAFhB;AAGC,IAAA,QAAQ,EAAGU,QAHZ;AAIC,IAAA,mBAAmB,EAAG;AAJvB,IAFF,CAnDF,EA8DGmC,oBAAoB,IACrB,4BAAC,iBAAD;AACC,IAAA,eAAe,EAAGD,gBADnB;AAEC,IAAA,iBAAiB,EAAGtC,UAFrB;AAGC,IAAA,YAAY,EAAG,MAAMwC,uBAAuB,CAAE,KAAF;AAH7C,IA/DF,CADD;AAwEA;;eAEcJ,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseMemo,\n\tuseState,\n\tuseCallback,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { _x, __ } from '@wordpress/i18n';\nimport { useAsyncList, useViewportMatch } from '@wordpress/compose';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\tFlexBlock,\n\tButton,\n} from '@wordpress/components';\nimport { Icon, chevronRight } from '@wordpress/icons';\nimport { focus } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport usePatternsState from './hooks/use-patterns-state';\nimport BlockPatternList from '../block-patterns-list';\nimport PatternsExplorerModal from './block-patterns-explorer/explorer';\nimport MobileTabNavigation from './mobile-tab-navigation';\n\nfunction usePatternsCategories( rootClientId ) {\n\tconst [ allPatterns, allCategories ] = usePatternsState(\n\t\tundefined,\n\t\trootClientId\n\t);\n\n\tconst hasRegisteredCategory = useCallback(\n\t\t( pattern ) => {\n\t\t\tif ( ! pattern.categories || ! pattern.categories.length ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn pattern.categories.some( ( cat ) =>\n\t\t\t\tallCategories.some( ( category ) => category.name === cat )\n\t\t\t);\n\t\t},\n\t\t[ allCategories ]\n\t);\n\n\t// Remove any empty categories.\n\tconst populatedCategories = useMemo( () => {\n\t\tconst categories = allCategories\n\t\t\t.filter( ( category ) =>\n\t\t\t\tallPatterns.some( ( pattern ) =>\n\t\t\t\t\tpattern.categories?.includes( category.name )\n\t\t\t\t)\n\t\t\t)\n\t\t\t.sort( ( { name: currentName }, { name: nextName } ) => {\n\t\t\t\tif (\n\t\t\t\t\t! [ currentName, nextName ].some( ( categoryName ) =>\n\t\t\t\t\t\t[ 'featured', 'text' ].includes( categoryName )\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\t// Move `featured` category to the top and `text` to the bottom.\n\t\t\t\treturn currentName === 'featured' || nextName === 'text'\n\t\t\t\t\t? -1\n\t\t\t\t\t: 1;\n\t\t\t} );\n\n\t\tif (\n\t\t\tallPatterns.some(\n\t\t\t\t( pattern ) => ! hasRegisteredCategory( pattern )\n\t\t\t) &&\n\t\t\t! categories.find(\n\t\t\t\t( category ) => category.name === 'uncategorized'\n\t\t\t)\n\t\t) {\n\t\t\tcategories.push( {\n\t\t\t\tname: 'uncategorized',\n\t\t\t\tlabel: _x( 'Uncategorized' ),\n\t\t\t} );\n\t\t}\n\n\t\treturn categories;\n\t}, [ allPatterns, allCategories ] );\n\n\treturn populatedCategories;\n}\n\nexport function BlockPatternsCategoryDialog( {\n\trootClientId,\n\tonInsert,\n\tonHover,\n\tcategory,\n\tshowTitlesAsTooltip,\n} ) {\n\tconst container = useRef();\n\n\tuseEffect( () => {\n\t\tconst timeout = setTimeout( () => {\n\t\t\tconst [ firstTabbable ] = focus.tabbable.find( container.current );\n\t\t\tfirstTabbable?.focus();\n\t\t} );\n\t\treturn () => clearTimeout( timeout );\n\t}, [ category ] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ container }\n\t\t\tclassName=\"block-editor-inserter__patterns-category-dialog\"\n\t\t>\n\t\t\t<BlockPatternsCategoryPanel\n\t\t\t\trootClientId={ rootClientId }\n\t\t\t\tonInsert={ onInsert }\n\t\t\t\tonHover={ onHover }\n\t\t\t\tcategory={ category }\n\t\t\t\tshowTitlesAsTooltip={ showTitlesAsTooltip }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport function BlockPatternsCategoryPanel( {\n\trootClientId,\n\tonInsert,\n\tonHover,\n\tcategory,\n\tshowTitlesAsTooltip,\n} ) {\n\tconst [ allPatterns, , onClick ] = usePatternsState(\n\t\tonInsert,\n\t\trootClientId\n\t);\n\n\tconst availableCategories = usePatternsCategories( rootClientId );\n\tconst currentCategoryPatterns = useMemo(\n\t\t() =>\n\t\t\tallPatterns.filter( ( pattern ) => {\n\t\t\t\tif ( category.name !== 'uncategorized' ) {\n\t\t\t\t\treturn pattern.categories?.includes( category.name );\n\t\t\t\t}\n\n\t\t\t\t// The uncategorized category should show all the patterns without any category\n\t\t\t\t// or with no available category.\n\t\t\t\tconst availablePatternCategories =\n\t\t\t\t\tpattern.categories?.filter( ( cat ) =>\n\t\t\t\t\t\tavailableCategories.find(\n\t\t\t\t\t\t\t( availableCategory ) =>\n\t\t\t\t\t\t\t\tavailableCategory.name === cat\n\t\t\t\t\t\t)\n\t\t\t\t\t) ?? [];\n\n\t\t\t\treturn availablePatternCategories.length === 0;\n\t\t\t} ),\n\t\t[ allPatterns, category ]\n\t);\n\n\tconst currentShownPatterns = useAsyncList( currentCategoryPatterns );\n\n\t// Hide block pattern preview on unmount.\n\tuseEffect( () => () => onHover( null ), [] );\n\n\tif ( ! currentCategoryPatterns.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"block-editor-inserter__patterns-category-panel\">\n\t\t\t<div className=\"block-editor-inserter__patterns-category-panel-title\">\n\t\t\t\t{ category.label }\n\t\t\t</div>\n\t\t\t<p>{ category.description }</p>\n\t\t\t<BlockPatternList\n\t\t\t\tshownPatterns={ currentShownPatterns }\n\t\t\t\tblockPatterns={ currentCategoryPatterns }\n\t\t\t\tonClickPattern={ onClick }\n\t\t\t\tonHover={ onHover }\n\t\t\t\tlabel={ category.label }\n\t\t\t\torientation=\"vertical\"\n\t\t\t\tcategory={ category.label }\n\t\t\t\tisDraggable\n\t\t\t\tshowTitlesAsTooltip={ showTitlesAsTooltip }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction BlockPatternsTabs( {\n\tonSelectCategory,\n\tselectedCategory,\n\tonInsert,\n\trootClientId,\n} ) {\n\tconst [ showPatternsExplorer, setShowPatternsExplorer ] = useState( false );\n\tconst categories = usePatternsCategories( rootClientId );\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn (\n\t\t<>\n\t\t\t{ ! isMobile && (\n\t\t\t\t<div className=\"block-editor-inserter__block-patterns-tabs-container\">\n\t\t\t\t\t<nav aria-label={ __( 'Block pattern categories' ) }>\n\t\t\t\t\t\t<ItemGroup\n\t\t\t\t\t\t\trole=\"list\"\n\t\t\t\t\t\t\tclassName=\"block-editor-inserter__block-patterns-tabs\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\t\trole=\"listitem\"\n\t\t\t\t\t\t\t\t\tkey={ category.name }\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tonSelectCategory( category )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\t\tcategory === selectedCategory\n\t\t\t\t\t\t\t\t\t\t\t? 'block-editor-inserter__patterns-category block-editor-inserter__patterns-selected-category'\n\t\t\t\t\t\t\t\t\t\t\t: 'block-editor-inserter__patterns-category'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-label={ category.label }\n\t\t\t\t\t\t\t\t\taria-current={\n\t\t\t\t\t\t\t\t\t\tcategory === selectedCategory\n\t\t\t\t\t\t\t\t\t\t\t? 'true'\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>\n\t\t\t\t\t\t\t\t\t<HStack>\n\t\t\t\t\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t\t\t\t\t{ category.label }\n\t\t\t\t\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ chevronRight } />\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t<div role=\"listitem\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-inserter__patterns-explore-button\"\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tsetShowPatternsExplorer( true )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Explore all patterns' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t</nav>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ isMobile && (\n\t\t\t\t<MobileTabNavigation categories={ categories }>\n\t\t\t\t\t{ ( category ) => (\n\t\t\t\t\t\t<BlockPatternsCategoryPanel\n\t\t\t\t\t\t\tonInsert={ onInsert }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\tcategory={ category }\n\t\t\t\t\t\t\tshowTitlesAsTooltip={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</MobileTabNavigation>\n\t\t\t) }\n\t\t\t{ showPatternsExplorer && (\n\t\t\t\t<PatternsExplorerModal\n\t\t\t\t\tinitialCategory={ selectedCategory }\n\t\t\t\t\tpatternCategories={ categories }\n\t\t\t\t\tonModalClose={ () => setShowPatternsExplorer( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default BlockPatternsTabs;\n"]}
@@ -102,7 +102,7 @@ function BlockTypesTab(_ref) {
102
102
  onSelect: onSelectItem,
103
103
  onHover: onHover,
104
104
  label: (0, _i18n._x)('Most used', 'blocks')
105
- })), (0, _lodash.map)(currentlyRenderedCategories, category => {
105
+ })), currentlyRenderedCategories.map(category => {
106
106
  const categoryItems = itemsPerCategory[category.slug];
107
107
 
108
108
  if (!categoryItems || !categoryItems.length) {
@@ -127,7 +127,7 @@ function BlockTypesTab(_ref) {
127
127
  onSelect: onSelectItem,
128
128
  onHover: onHover,
129
129
  label: (0, _i18n.__)('Uncategorized')
130
- })), (0, _lodash.map)(currentlyRenderedCollections, _ref2 => {
130
+ })), currentlyRenderedCollections.map(_ref2 => {
131
131
  let [namespace, collection] = _ref2;
132
132
  const collectionItems = itemsPerCollection[namespace];
133
133
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/block-types-tab.js"],"names":["getBlockNamespace","item","name","split","MAX_SUGGESTED_ITEMS","EMPTY_ARRAY","BlockTypesTab","rootClientId","onInsert","onHover","showMostUsedBlocks","items","categories","collections","onSelectItem","suggestedItems","slice","uncategorizedItems","filter","category","itemsPerCategory","itemList","itemsPerCollection","result","Object","keys","forEach","namespace","length","currentlyRenderedCategories","didRenderAllCategories","collectionEntries","entries","currentlyRenderedCollections","categoryItems","slug","title","icon","collection","collectionItems"],"mappings":";;;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAOA,MAAMA,iBAAiB,GAAKC,IAAF,IAAYA,IAAI,CAACC,IAAL,CAAUC,KAAV,CAAiB,GAAjB,EAAwB,CAAxB,CAAtC;;AAEA,MAAMC,mBAAmB,GAAG,CAA5B;AAEA;AACA;AACA;AACA;AAC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pB,MALD,CADD;AAcA,GAtBA,CA/CH,CADD,CADD;AA4EA;;eAEc9B,a","sourcesContent":["/**\n * External dependencies\n */\nimport { map, groupBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { pipe, useAsyncList } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesList from '../block-types-list';\nimport InserterPanel from './panel';\nimport useBlockTypesState from './hooks/use-block-types-state';\nimport InserterListbox from '../inserter-listbox';\nimport { orderBy } from '../../utils/sorting';\n\nconst getBlockNamespace = ( item ) => item.name.split( '/' )[ 0 ];\n\nconst MAX_SUGGESTED_ITEMS = 6;\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation and rerendering the component.\n *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\nexport function BlockTypesTab( {\n\trootClientId,\n\tonInsert,\n\tonHover,\n\tshowMostUsedBlocks,\n} ) {\n\tconst [ items, categories, collections, onSelectItem ] = useBlockTypesState(\n\t\trootClientId,\n\t\tonInsert\n\t);\n\n\tconst suggestedItems = useMemo( () => {\n\t\treturn orderBy( items, 'frecency', 'desc' ).slice(\n\t\t\t0,\n\t\t\tMAX_SUGGESTED_ITEMS\n\t\t);\n\t}, [ items ] );\n\n\tconst uncategorizedItems = useMemo( () => {\n\t\treturn items.filter( ( item ) => ! item.category );\n\t}, [ items ] );\n\n\tconst itemsPerCategory = useMemo( () => {\n\t\treturn pipe(\n\t\t\t( itemList ) =>\n\t\t\t\titemList.filter(\n\t\t\t\t\t( item ) => item.category && item.category !== 'reusable'\n\t\t\t\t),\n\t\t\t( itemList ) => groupBy( itemList, 'category' )\n\t\t)( items );\n\t}, [ items ] );\n\n\tconst itemsPerCollection = useMemo( () => {\n\t\t// Create a new Object to avoid mutating collection.\n\t\tconst result = { ...collections };\n\t\tObject.keys( collections ).forEach( ( namespace ) => {\n\t\t\tresult[ namespace ] = items.filter(\n\t\t\t\t( item ) => getBlockNamespace( item ) === namespace\n\t\t\t);\n\t\t\tif ( result[ namespace ].length === 0 ) {\n\t\t\t\tdelete result[ namespace ];\n\t\t\t}\n\t\t} );\n\n\t\treturn result;\n\t}, [ items, collections ] );\n\n\t// Hide block preview on unmount.\n\tuseEffect( () => () => onHover( null ), [] );\n\n\t/**\n\t * The inserter contains a big number of blocks and opening it is a costful operation.\n\t * The rendering is the most costful part of it, in order to improve the responsiveness\n\t * of the \"opening\" action, these lazy lists allow us to render the inserter category per category,\n\t * once all the categories are rendered, we start rendering the collections and the uncategorized block types.\n\t */\n\tconst currentlyRenderedCategories = useAsyncList( categories );\n\tconst didRenderAllCategories =\n\t\tcategories.length === currentlyRenderedCategories.length;\n\n\t// Async List requires an array.\n\tconst collectionEntries = useMemo( () => {\n\t\treturn Object.entries( collections );\n\t}, [ collections ] );\n\tconst currentlyRenderedCollections = useAsyncList(\n\t\tdidRenderAllCategories ? collectionEntries : EMPTY_ARRAY\n\t);\n\n\treturn (\n\t\t<InserterListbox>\n\t\t\t<div>\n\t\t\t\t{ showMostUsedBlocks && !! suggestedItems.length && (\n\t\t\t\t\t<InserterPanel title={ _x( 'Most used', 'blocks' ) }>\n\t\t\t\t\t\t<BlockTypesList\n\t\t\t\t\t\t\titems={ suggestedItems }\n\t\t\t\t\t\t\tonSelect={ onSelectItem }\n\t\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\t\tlabel={ _x( 'Most used', 'blocks' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InserterPanel>\n\t\t\t\t) }\n\n\t\t\t\t{ map( currentlyRenderedCategories, ( category ) => {\n\t\t\t\t\tconst categoryItems = itemsPerCategory[ category.slug ];\n\t\t\t\t\tif ( ! categoryItems || ! categoryItems.length ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<InserterPanel\n\t\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\t\ticon={ category.icon }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockTypesList\n\t\t\t\t\t\t\t\titems={ categoryItems }\n\t\t\t\t\t\t\t\tonSelect={ onSelectItem }\n\t\t\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\t\t\tlabel={ category.title }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</InserterPanel>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\n\t\t\t\t{ didRenderAllCategories && uncategorizedItems.length > 0 && (\n\t\t\t\t\t<InserterPanel\n\t\t\t\t\t\tclassName=\"block-editor-inserter__uncategorized-blocks-panel\"\n\t\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockTypesList\n\t\t\t\t\t\t\titems={ uncategorizedItems }\n\t\t\t\t\t\t\tonSelect={ onSelectItem }\n\t\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\t\tlabel={ __( 'Uncategorized' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InserterPanel>\n\t\t\t\t) }\n\n\t\t\t\t{ map(\n\t\t\t\t\tcurrentlyRenderedCollections,\n\t\t\t\t\t( [ namespace, collection ] ) => {\n\t\t\t\t\t\tconst collectionItems = itemsPerCollection[ namespace ];\n\t\t\t\t\t\tif ( ! collectionItems || ! collectionItems.length ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<InserterPanel\n\t\t\t\t\t\t\t\tkey={ namespace }\n\t\t\t\t\t\t\t\ttitle={ collection.title }\n\t\t\t\t\t\t\t\ticon={ collection.icon }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BlockTypesList\n\t\t\t\t\t\t\t\t\titems={ collectionItems }\n\t\t\t\t\t\t\t\t\tonSelect={ onSelectItem }\n\t\t\t\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\t\t\t\tlabel={ collection.title }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</InserterPanel>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</InserterListbox>\n\t);\n}\n\nexport default BlockTypesTab;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/block-types-tab.js"],"names":["getBlockNamespace","item","name","split","MAX_SUGGESTED_ITEMS","EMPTY_ARRAY","BlockTypesTab","rootClientId","onInsert","onHover","showMostUsedBlocks","items","categories","collections","onSelectItem","suggestedItems","slice","uncategorizedItems","filter","category","itemsPerCategory","itemList","itemsPerCollection","result","Object","keys","forEach","namespace","length","currentlyRenderedCategories","didRenderAllCategories","collectionEntries","entries","currentlyRenderedCollections","map","categoryItems","slug","title","icon","collection","collectionItems"],"mappings":";;;;;;;;;;AASA;;AANA;;AAKA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;AAOA,MAAMA,iBAAiB,GAAKC,IAAF,IAAYA,IAAI,CAACC,IAAL,CAAUC,KAAV,CAAiB,GAAjB,EAAwB,CAAxB,CAAtC;;AAEA,MAAMC,mBAAmB,GAAG,CAA5B;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,WAAW,GAAG,EAApB;;AAEO,SAASC,aAAT,OAKH;AAAA,MAL2B;AAC9BC,IAAAA,YAD8B;AAE9BC,IAAAA,QAF8B;AAG9BC,IAAAA,OAH8B;AAI9BC,IAAAA;AAJ8B,GAK3B;AACH,QAAM,CAAEC,KAAF,EAASC,UAAT,EAAqBC,WAArB,EAAkCC,YAAlC,IAAmD,iCACxDP,YADwD,EAExDC,QAFwD,CAAzD;AAKA,QAAMO,cAAc,GAAG,sBAAS,MAAM;AACrC,WAAO,sBAASJ,KAAT,EAAgB,UAAhB,EAA4B,MAA5B,EAAqCK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AZH,EAiCGP,sBAAsB,IAAIb,kBAAkB,CAACW,MAAnB,GAA4B,CAAtD,IACD,4BAAC,cAAD;AACC,IAAA,SAAS,EAAC,mDADX;AAEC,IAAA,KAAK,EAAG,cAAI,eAAJ;AAFT,KAIC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAGX,kBADT;AAEC,IAAA,QAAQ,EAAGH,YAFZ;AAGC,IAAA,OAAO,EAAGL,OAHX;AAIC,IAAA,KAAK,EAAG,cAAI,eAAJ;AAJT,IAJD,CAlCF,EA+CGwB,4BAA4B,CAACC,GAA7B,CACD,SAAiC;AAAA,QAA/B,CAAEP,SAAF,EAAaY,UAAb,CAA+B;AAChC,UAAMC,eAAe,GAAGlB,kBAAkB,CAAEK,SAAF,CAA1C;;AACA,QAAK,CAAEa,eAAF,IAAqB,CAAEA,eAAe,CAACZ,MAA5C,EAAqD;AACpD,aAAO,IAAP;AACA;;AAED,WACC,4BAAC,cAAD;AACC,MAAA,GAAG,EAAGD,SADP;AAEC,MAAA,KAAK,EAAGY,UAAU,CAACF,KAFpB;AAGC,MAAA,IAAI,EAAGE,UAAU,CAACD;AAHnB,OAKC,4BAAC,uBAAD;AACC,MAAA,KAAK,EAAGE,eADT;AAEC,MAAA,QAAQ,EAAG1B,YAFZ;AAGC,MAAA,OAAO,EAAGL,OAHX;AAIC,MAAA,KAAK,EAAG8B,UAAU,CAACF;AAJpB,MALD,CADD;AAcA,GArBA,CA/CH,CADD,CADD;AA2EA;;eAEc/B,a","sourcesContent":["/**\n * External dependencies\n */\nimport { groupBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { pipe, useAsyncList } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesList from '../block-types-list';\nimport InserterPanel from './panel';\nimport useBlockTypesState from './hooks/use-block-types-state';\nimport InserterListbox from '../inserter-listbox';\nimport { orderBy } from '../../utils/sorting';\n\nconst getBlockNamespace = ( item ) => item.name.split( '/' )[ 0 ];\n\nconst MAX_SUGGESTED_ITEMS = 6;\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation and rerendering the component.\n *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\nexport function BlockTypesTab( {\n\trootClientId,\n\tonInsert,\n\tonHover,\n\tshowMostUsedBlocks,\n} ) {\n\tconst [ items, categories, collections, onSelectItem ] = useBlockTypesState(\n\t\trootClientId,\n\t\tonInsert\n\t);\n\n\tconst suggestedItems = useMemo( () => {\n\t\treturn orderBy( items, 'frecency', 'desc' ).slice(\n\t\t\t0,\n\t\t\tMAX_SUGGESTED_ITEMS\n\t\t);\n\t}, [ items ] );\n\n\tconst uncategorizedItems = useMemo( () => {\n\t\treturn items.filter( ( item ) => ! item.category );\n\t}, [ items ] );\n\n\tconst itemsPerCategory = useMemo( () => {\n\t\treturn pipe(\n\t\t\t( itemList ) =>\n\t\t\t\titemList.filter(\n\t\t\t\t\t( item ) => item.category && item.category !== 'reusable'\n\t\t\t\t),\n\t\t\t( itemList ) => groupBy( itemList, 'category' )\n\t\t)( items );\n\t}, [ items ] );\n\n\tconst itemsPerCollection = useMemo( () => {\n\t\t// Create a new Object to avoid mutating collection.\n\t\tconst result = { ...collections };\n\t\tObject.keys( collections ).forEach( ( namespace ) => {\n\t\t\tresult[ namespace ] = items.filter(\n\t\t\t\t( item ) => getBlockNamespace( item ) === namespace\n\t\t\t);\n\t\t\tif ( result[ namespace ].length === 0 ) {\n\t\t\t\tdelete result[ namespace ];\n\t\t\t}\n\t\t} );\n\n\t\treturn result;\n\t}, [ items, collections ] );\n\n\t// Hide block preview on unmount.\n\tuseEffect( () => () => onHover( null ), [] );\n\n\t/**\n\t * The inserter contains a big number of blocks and opening it is a costful operation.\n\t * The rendering is the most costful part of it, in order to improve the responsiveness\n\t * of the \"opening\" action, these lazy lists allow us to render the inserter category per category,\n\t * once all the categories are rendered, we start rendering the collections and the uncategorized block types.\n\t */\n\tconst currentlyRenderedCategories = useAsyncList( categories );\n\tconst didRenderAllCategories =\n\t\tcategories.length === currentlyRenderedCategories.length;\n\n\t// Async List requires an array.\n\tconst collectionEntries = useMemo( () => {\n\t\treturn Object.entries( collections );\n\t}, [ collections ] );\n\tconst currentlyRenderedCollections = useAsyncList(\n\t\tdidRenderAllCategories ? collectionEntries : EMPTY_ARRAY\n\t);\n\n\treturn (\n\t\t<InserterListbox>\n\t\t\t<div>\n\t\t\t\t{ showMostUsedBlocks && !! suggestedItems.length && (\n\t\t\t\t\t<InserterPanel title={ _x( 'Most used', 'blocks' ) }>\n\t\t\t\t\t\t<BlockTypesList\n\t\t\t\t\t\t\titems={ suggestedItems }\n\t\t\t\t\t\t\tonSelect={ onSelectItem }\n\t\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\t\tlabel={ _x( 'Most used', 'blocks' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InserterPanel>\n\t\t\t\t) }\n\n\t\t\t\t{ currentlyRenderedCategories.map( ( category ) => {\n\t\t\t\t\tconst categoryItems = itemsPerCategory[ category.slug ];\n\t\t\t\t\tif ( ! categoryItems || ! categoryItems.length ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<InserterPanel\n\t\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\t\ticon={ category.icon }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockTypesList\n\t\t\t\t\t\t\t\titems={ categoryItems }\n\t\t\t\t\t\t\t\tonSelect={ onSelectItem }\n\t\t\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\t\t\tlabel={ category.title }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</InserterPanel>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\n\t\t\t\t{ didRenderAllCategories && uncategorizedItems.length > 0 && (\n\t\t\t\t\t<InserterPanel\n\t\t\t\t\t\tclassName=\"block-editor-inserter__uncategorized-blocks-panel\"\n\t\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockTypesList\n\t\t\t\t\t\t\titems={ uncategorizedItems }\n\t\t\t\t\t\t\tonSelect={ onSelectItem }\n\t\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\t\tlabel={ __( 'Uncategorized' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InserterPanel>\n\t\t\t\t) }\n\n\t\t\t\t{ currentlyRenderedCollections.map(\n\t\t\t\t\t( [ namespace, collection ] ) => {\n\t\t\t\t\t\tconst collectionItems = itemsPerCollection[ namespace ];\n\t\t\t\t\t\tif ( ! collectionItems || ! collectionItems.length ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<InserterPanel\n\t\t\t\t\t\t\t\tkey={ namespace }\n\t\t\t\t\t\t\t\ttitle={ collection.title }\n\t\t\t\t\t\t\t\ticon={ collection.icon }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BlockTypesList\n\t\t\t\t\t\t\t\t\titems={ collectionItems }\n\t\t\t\t\t\t\t\t\tonSelect={ onSelectItem }\n\t\t\t\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\t\t\t\tlabel={ collection.title }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</InserterPanel>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</InserterListbox>\n\t);\n}\n\nexport default BlockTypesTab;\n"]}
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _lodash = require("lodash");
9
-
10
8
  var _element = require("@wordpress/element");
11
9
 
12
10
  var _blocks = require("@wordpress/blocks");
@@ -19,10 +17,6 @@ var _notices = require("@wordpress/notices");
19
17
 
20
18
  var _store = require("../../../store");
21
19
 
22
- /**
23
- * External dependencies
24
- */
25
-
26
20
  /**
27
21
  * WordPress dependencies
28
22
  */
@@ -57,7 +51,7 @@ const usePatternsState = (onInsert, rootClientId) => {
57
51
  createSuccessNotice
58
52
  } = (0, _data.useDispatch)(_notices.store);
59
53
  const onClickPattern = (0, _element.useCallback)((pattern, blocks) => {
60
- onInsert((0, _lodash.map)(blocks, block => (0, _blocks.cloneBlock)(block)), pattern.name);
54
+ onInsert((blocks !== null && blocks !== void 0 ? blocks : []).map(block => (0, _blocks.cloneBlock)(block)), pattern.name);
61
55
  createSuccessNotice((0, _i18n.sprintf)(
62
56
  /* translators: %s: block pattern title. */
63
57
  (0, _i18n.__)('Block pattern "%s" inserted.'), pattern.title), {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/hooks/use-patterns-state.js"],"names":["usePatternsState","onInsert","rootClientId","patternCategories","patterns","select","__experimentalGetAllowedPatterns","getSettings","blockEditorStore","__experimentalBlockPatternCategories","createSuccessNotice","noticesStore","onClickPattern","pattern","blocks","block","name","title","type"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,gBAAgB,GAAG,CAAEC,QAAF,EAAYC,YAAZ,KAA8B;AACtD,QAAM;AAAEC,IAAAA,iBAAF;AAAqBC,IAAAA;AAArB,MAAkC,qBACrCC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,gCAAF;AAAoCC,MAAAA;AAApC,QACLF,MAAM,CAAEG,YAAF,CADP;AAEA,WAAO;AACNJ,MAAAA,QAAQ,EAAEE,gCAAgC,CAAEJ,YAAF,CADpC;AAENC,MAAAA,iBAAiB,EAChBI,WAAW,GAAGE;AAHT,KAAP;AAKA,GATsC,EAUvC,CAAEP,YAAF,CAVuC,CAAxC;AAYA,QAAM;AAAEQ,IAAAA;AAAF,MAA0B,uBAAaC,cAAb,CAAhC;AACA,QAAMC,cAAc,GAAG,0BAAa,CAAEC,OAAF,EAAWC,MAAX,KAAuB;AAC1Db,IAAAA,QAAQ,CACP,iBAAKa,MAAL,EAAeC,KAAF,IAAa,wBAAYA,KAAZ,CAA1B,CADO,EAEPF,OAAO,CAACG,IAFD,CAAR;AAIAN,IAAAA,mBAAmB,CAClB;AACC;AACA,kBAAI,8BAAJ,CAFD,EAGCG,OAAO,CAACI,KAHT,CADkB,EAMlB;AACCC,MAAAA,IAAI,EAAE;AADP,KANkB,CAAnB;AAUA,GAfsB,EAepB,EAfoB,CAAvB;AAiBA,SAAO,CAAEd,QAAF,EAAYD,iBAAZ,EAA+BS,cAA/B,CAAP;AACA,CAhCD;;eAkCeZ,gB","sourcesContent":["/**\n * External dependencies\n */\nimport { map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport { cloneBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Retrieves the block patterns inserter state.\n *\n * @param {Function} onInsert function called when inserter a list of blocks.\n * @param {string=} rootClientId Insertion's root client ID.\n *\n * @return {Array} Returns the patterns state. (patterns, categories, onSelect handler)\n */\nconst usePatternsState = ( onInsert, rootClientId ) => {\n\tconst { patternCategories, patterns } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __experimentalGetAllowedPatterns, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tpatterns: __experimentalGetAllowedPatterns( rootClientId ),\n\t\t\t\tpatternCategories:\n\t\t\t\t\tgetSettings().__experimentalBlockPatternCategories,\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst onClickPattern = useCallback( ( pattern, blocks ) => {\n\t\tonInsert(\n\t\t\tmap( blocks, ( block ) => cloneBlock( block ) ),\n\t\t\tpattern.name\n\t\t);\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: block pattern title. */\n\t\t\t\t__( 'Block pattern \"%s\" inserted.' ),\n\t\t\t\tpattern.title\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t}, [] );\n\n\treturn [ patterns, patternCategories, onClickPattern ];\n};\n\nexport default usePatternsState;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/hooks/use-patterns-state.js"],"names":["usePatternsState","onInsert","rootClientId","patternCategories","patterns","select","__experimentalGetAllowedPatterns","getSettings","blockEditorStore","__experimentalBlockPatternCategories","createSuccessNotice","noticesStore","onClickPattern","pattern","blocks","map","block","name","title","type"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,gBAAgB,GAAG,CAAEC,QAAF,EAAYC,YAAZ,KAA8B;AACtD,QAAM;AAAEC,IAAAA,iBAAF;AAAqBC,IAAAA;AAArB,MAAkC,qBACrCC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,gCAAF;AAAoCC,MAAAA;AAApC,QACLF,MAAM,CAAEG,YAAF,CADP;AAEA,WAAO;AACNJ,MAAAA,QAAQ,EAAEE,gCAAgC,CAAEJ,YAAF,CADpC;AAENC,MAAAA,iBAAiB,EAChBI,WAAW,GAAGE;AAHT,KAAP;AAKA,GATsC,EAUvC,CAAEP,YAAF,CAVuC,CAAxC;AAYA,QAAM;AAAEQ,IAAAA;AAAF,MAA0B,uBAAaC,cAAb,CAAhC;AACA,QAAMC,cAAc,GAAG,0BAAa,CAAEC,OAAF,EAAWC,MAAX,KAAuB;AAC1Db,IAAAA,QAAQ,CACP,CAAEa,MAAF,aAAEA,MAAF,cAAEA,MAAF,GAAY,EAAZ,EAAiBC,GAAjB,CAAwBC,KAAF,IAAa,wBAAYA,KAAZ,CAAnC,CADO,EAEPH,OAAO,CAACI,IAFD,CAAR;AAIAP,IAAAA,mBAAmB,CAClB;AACC;AACA,kBAAI,8BAAJ,CAFD,EAGCG,OAAO,CAACK,KAHT,CADkB,EAMlB;AACCC,MAAAA,IAAI,EAAE;AADP,KANkB,CAAnB;AAUA,GAfsB,EAepB,EAfoB,CAAvB;AAiBA,SAAO,CAAEf,QAAF,EAAYD,iBAAZ,EAA+BS,cAA/B,CAAP;AACA,CAhCD;;eAkCeZ,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport { cloneBlock } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Retrieves the block patterns inserter state.\n *\n * @param {Function} onInsert function called when inserter a list of blocks.\n * @param {string=} rootClientId Insertion's root client ID.\n *\n * @return {Array} Returns the patterns state. (patterns, categories, onSelect handler)\n */\nconst usePatternsState = ( onInsert, rootClientId ) => {\n\tconst { patternCategories, patterns } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __experimentalGetAllowedPatterns, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tpatterns: __experimentalGetAllowedPatterns( rootClientId ),\n\t\t\t\tpatternCategories:\n\t\t\t\t\tgetSettings().__experimentalBlockPatternCategories,\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst onClickPattern = useCallback( ( pattern, blocks ) => {\n\t\tonInsert(\n\t\t\t( blocks ?? [] ).map( ( block ) => cloneBlock( block ) ),\n\t\t\tpattern.name\n\t\t);\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: block pattern title. */\n\t\t\t\t__( 'Block pattern \"%s\" inserted.' ),\n\t\t\t\tpattern.title\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t}, [] );\n\n\treturn [ patterns, patternCategories, onClickPattern ];\n};\n\nexport default usePatternsState;\n"]}
@@ -227,7 +227,9 @@ class Inserter extends _element.Component {
227
227
  contentClassName: (0, _classnames.default)('block-editor-inserter__popover', {
228
228
  'is-quick': isQuick
229
229
  }),
230
- position: position,
230
+ popoverProps: {
231
+ position
232
+ },
231
233
  onToggle: this.onToggle,
232
234
  expandOnMobile: true,
233
235
  headerTitle: (0, _i18n.__)('Add a block'),
@@ -250,7 +252,7 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)((select, _ref4) => {
250
252
  const {
251
253
  getBlockRootClientId,
252
254
  hasInserterItems,
253
- __experimentalGetAllowedBlocks,
255
+ getAllowedBlocks,
254
256
  __experimentalGetDirectInsertBlock,
255
257
  getSettings
256
258
  } = select(_store.store);
@@ -258,8 +260,7 @@ var _default = (0, _compose.compose)([(0, _data.withSelect)((select, _ref4) => {
258
260
  getBlockVariations
259
261
  } = select(_blocks.store);
260
262
  rootClientId = rootClientId || getBlockRootClientId(clientId) || undefined;
261
-
262
- const allowedBlocks = __experimentalGetAllowedBlocks(rootClientId);
263
+ const allowedBlocks = getAllowedBlocks(rootClientId);
263
264
 
264
265
  const directInsertBlock = shouldDirectInsert && __experimentalGetDirectInsertBlock(rootClientId);
265
266