@wordpress/block-editor 12.4.0 → 12.6.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 (524) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +1 -0
  3. package/build/components/block-draggable/index.js +6 -3
  4. package/build/components/block-draggable/index.js.map +1 -1
  5. package/build/components/block-draggable/index.native.js +2 -2
  6. package/build/components/block-draggable/index.native.js.map +1 -1
  7. package/build/components/block-edit/edit.js +25 -13
  8. package/build/components/block-edit/edit.js.map +1 -1
  9. package/build/components/block-heading-level-dropdown/heading-level-icon.js +10 -2
  10. package/build/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
  11. package/build/components/block-heading-level-dropdown/index.native.js +4 -3
  12. package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
  13. package/build/components/block-list/block-outline.native.js +14 -18
  14. package/build/components/block-list/block-outline.native.js.map +1 -1
  15. package/build/components/block-list/block.native.js +21 -42
  16. package/build/components/block-list/block.native.js.map +1 -1
  17. package/build/components/block-lock/toolbar.js +25 -6
  18. package/build/components/block-lock/toolbar.js.map +1 -1
  19. package/build/components/block-mover/index.native.js +1 -1
  20. package/build/components/block-mover/index.native.js.map +1 -1
  21. package/build/components/block-parent-selector/index.js +8 -5
  22. package/build/components/block-parent-selector/index.js.map +1 -1
  23. package/build/components/block-removal-warning-modal/index.js +15 -25
  24. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  25. package/build/components/block-settings/button.native.js +2 -2
  26. package/build/components/block-settings/button.native.js.map +1 -1
  27. package/build/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +10 -11
  28. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
  29. package/build/components/block-toolbar/index.js +12 -8
  30. package/build/components/block-toolbar/index.js.map +1 -1
  31. package/build/components/block-toolbar/index.native.js +62 -3
  32. package/build/components/block-toolbar/index.native.js.map +1 -1
  33. package/build/components/block-tools/block-contextual-toolbar.js +7 -11
  34. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  35. package/build/components/colors-gradients/control.js +4 -2
  36. package/build/components/colors-gradients/control.js.map +1 -1
  37. package/build/components/dimensions-tool/aspect-ratio-tool.js +99 -0
  38. package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
  39. package/build/components/dimensions-tool/index.js +207 -0
  40. package/build/components/dimensions-tool/index.js.map +1 -0
  41. package/build/components/dimensions-tool/scale-tool.js +111 -0
  42. package/build/components/dimensions-tool/scale-tool.js.map +1 -0
  43. package/build/components/dimensions-tool/width-height-tool.js +125 -0
  44. package/build/components/dimensions-tool/width-height-tool.js.map +1 -0
  45. package/build/components/global-styles/color-panel.js +22 -16
  46. package/build/components/global-styles/color-panel.js.map +1 -1
  47. package/build/components/global-styles/dimensions-panel.js +13 -2
  48. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  49. package/build/components/global-styles/filters-panel.js +1 -1
  50. package/build/components/global-styles/filters-panel.js.map +1 -1
  51. package/build/components/global-styles/get-block-css-selector.js +4 -8
  52. package/build/components/global-styles/get-block-css-selector.js.map +1 -1
  53. package/build/components/global-styles/hooks.js +15 -25
  54. package/build/components/global-styles/hooks.js.map +1 -1
  55. package/build/components/global-styles/typography-panel.js +52 -5
  56. package/build/components/global-styles/typography-panel.js.map +1 -1
  57. package/build/components/global-styles/use-global-styles-output.js +12 -18
  58. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  59. package/build/components/global-styles/utils.js +6 -6
  60. package/build/components/global-styles/utils.js.map +1 -1
  61. package/build/components/iframe/index.js +36 -48
  62. package/build/components/iframe/index.js.map +1 -1
  63. package/build/components/iframe/use-compatibility-styles.js +5 -0
  64. package/build/components/iframe/use-compatibility-styles.js.map +1 -1
  65. package/build/components/image-editor/aspect-ratio-dropdown.js +1 -1
  66. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  67. package/build/components/image-editor/use-save-image.js +1 -2
  68. package/build/components/image-editor/use-save-image.js.map +1 -1
  69. package/build/components/image-size-control/index.js +6 -0
  70. package/build/components/image-size-control/index.js.map +1 -1
  71. package/build/components/index.js +9 -0
  72. package/build/components/index.js.map +1 -1
  73. package/build/components/inner-blocks/index.js +3 -1
  74. package/build/components/inner-blocks/index.js.map +1 -1
  75. package/build/components/inner-blocks/index.native.js +3 -1
  76. package/build/components/inner-blocks/index.native.js.map +1 -1
  77. package/build/components/inner-blocks/use-nested-settings-update.js +33 -7
  78. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  79. package/build/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
  80. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  81. package/build/components/inserter/block-patterns-tab.js +7 -35
  82. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  83. package/build/components/inserter/hooks/use-block-types-state.js +3 -4
  84. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  85. package/build/components/inserter/hooks/use-patterns-state.js +9 -3
  86. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  87. package/build/components/inserter/index.js +2 -4
  88. package/build/components/inserter/index.js.map +1 -1
  89. package/build/components/inserter/index.native.js +21 -32
  90. package/build/components/inserter/index.native.js.map +1 -1
  91. package/build/components/inserter/media-tab/hooks.js +2 -21
  92. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  93. package/build/components/inserter/reusable-block-rename-hint.js +82 -0
  94. package/build/components/inserter/reusable-block-rename-hint.js.map +1 -0
  95. package/build/components/inserter/reusable-blocks-tab.js +6 -2
  96. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  97. package/build/components/inserter/reusable-blocks-tab.native.js +2 -2
  98. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  99. package/build/components/inserter/tabs.native.js +1 -1
  100. package/build/components/inserter/tabs.native.js.map +1 -1
  101. package/build/components/inserter-draggable-blocks/index.js +9 -1
  102. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  103. package/build/components/link-control/constants.js +1 -1
  104. package/build/components/link-control/constants.js.map +1 -1
  105. package/build/components/link-control/index.js +21 -16
  106. package/build/components/link-control/index.js.map +1 -1
  107. package/build/components/link-control/search-create-button.js +5 -21
  108. package/build/components/link-control/search-create-button.js.map +1 -1
  109. package/build/components/link-control/search-input.js +4 -4
  110. package/build/components/link-control/search-input.js.map +1 -1
  111. package/build/components/link-control/search-item.js +13 -30
  112. package/build/components/link-control/search-item.js.map +1 -1
  113. package/build/components/link-control/search-results.js +2 -2
  114. package/build/components/link-control/search-results.js.map +1 -1
  115. package/build/components/link-control/settings-drawer.js +2 -3
  116. package/build/components/link-control/settings-drawer.js.map +1 -1
  117. package/build/components/list-view/appender.js +2 -6
  118. package/build/components/list-view/appender.js.map +1 -1
  119. package/build/components/list-view/use-list-view-client-ids.js +2 -2
  120. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  121. package/build/components/media-placeholder/index.native.js +65 -31
  122. package/build/components/media-placeholder/index.native.js.map +1 -1
  123. package/build/components/preview-options/index.js +2 -2
  124. package/build/components/preview-options/index.js.map +1 -1
  125. package/build/components/provider/index.js +5 -2
  126. package/build/components/provider/index.js.map +1 -1
  127. package/build/components/provider/use-block-sync.js +21 -0
  128. package/build/components/provider/use-block-sync.js.map +1 -1
  129. package/build/components/resolution-tool/index.js +55 -0
  130. package/build/components/resolution-tool/index.js.map +1 -0
  131. package/build/components/rich-text/content.js +0 -36
  132. package/build/components/rich-text/content.js.map +1 -1
  133. package/build/components/rich-text/get-rich-text-values.js +118 -0
  134. package/build/components/rich-text/get-rich-text-values.js.map +1 -0
  135. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  136. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  137. package/build/components/spacing-sizes-control/input-controls/axial.js +6 -2
  138. package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
  139. package/build/components/spacing-sizes-control/input-controls/separated.js +5 -1
  140. package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
  141. package/build/components/spacing-sizes-control/input-controls/single.js +5 -1
  142. package/build/components/spacing-sizes-control/input-controls/single.js.map +1 -1
  143. package/build/components/spacing-sizes-control/utils.js +1 -1
  144. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  145. package/build/components/url-input/index.js +4 -2
  146. package/build/components/url-input/index.js.map +1 -1
  147. package/build/components/use-block-display-information/index.js +7 -3
  148. package/build/components/use-block-display-information/index.js.map +1 -1
  149. package/build/components/use-block-drop-zone/index.native.js +49 -8
  150. package/build/components/use-block-drop-zone/index.native.js.map +1 -1
  151. package/build/components/use-setting/index.js +5 -9
  152. package/build/components/use-setting/index.js.map +1 -1
  153. package/build/components/writing-flow/use-tab-nav.js +10 -27
  154. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  155. package/build/components/writing-mode-control/index.js +70 -0
  156. package/build/components/writing-mode-control/index.js.map +1 -0
  157. package/build/hooks/behaviors.js +25 -20
  158. package/build/hooks/behaviors.js.map +1 -1
  159. package/build/hooks/margin.js +1 -1
  160. package/build/hooks/margin.js.map +1 -1
  161. package/build/hooks/padding.js +1 -1
  162. package/build/hooks/padding.js.map +1 -1
  163. package/build/hooks/supports.js +7 -1
  164. package/build/hooks/supports.js.map +1 -1
  165. package/build/hooks/typography.js +2 -1
  166. package/build/hooks/typography.js.map +1 -1
  167. package/build/hooks/utils.js +5 -9
  168. package/build/hooks/utils.js.map +1 -1
  169. package/build/private-apis.js +16 -3
  170. package/build/private-apis.js.map +1 -1
  171. package/build/private-apis.native.js +3 -0
  172. package/build/private-apis.native.js.map +1 -1
  173. package/build/store/actions.js +196 -2
  174. package/build/store/actions.js.map +1 -1
  175. package/build/store/defaults.js +1 -0
  176. package/build/store/defaults.js.map +1 -1
  177. package/build/store/index.js +10 -1
  178. package/build/store/index.js.map +1 -1
  179. package/build/store/private-actions.js +46 -40
  180. package/build/store/private-actions.js.map +1 -1
  181. package/build/store/private-selectors.js +8 -9
  182. package/build/store/private-selectors.js.map +1 -1
  183. package/build/store/reducer.js +22 -9
  184. package/build/store/reducer.js.map +1 -1
  185. package/build/store/selectors.js +52 -23
  186. package/build/store/selectors.js.map +1 -1
  187. package/build/utils/object.js +38 -2
  188. package/build/utils/object.js.map +1 -1
  189. package/build-module/components/block-draggable/index.js +6 -3
  190. package/build-module/components/block-draggable/index.js.map +1 -1
  191. package/build-module/components/block-draggable/index.native.js +2 -2
  192. package/build-module/components/block-draggable/index.native.js.map +1 -1
  193. package/build-module/components/block-edit/edit.js +27 -10
  194. package/build-module/components/block-edit/edit.js.map +1 -1
  195. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js +9 -2
  196. package/build-module/components/block-heading-level-dropdown/heading-level-icon.js.map +1 -1
  197. package/build-module/components/block-heading-level-dropdown/index.native.js +4 -3
  198. package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
  199. package/build-module/components/block-list/block-outline.native.js +14 -18
  200. package/build-module/components/block-list/block-outline.native.js.map +1 -1
  201. package/build-module/components/block-list/block.native.js +24 -43
  202. package/build-module/components/block-list/block.native.js.map +1 -1
  203. package/build-module/components/block-lock/toolbar.js +25 -7
  204. package/build-module/components/block-lock/toolbar.js.map +1 -1
  205. package/build-module/components/block-mover/index.native.js +3 -3
  206. package/build-module/components/block-mover/index.native.js.map +1 -1
  207. package/build-module/components/block-parent-selector/index.js +7 -5
  208. package/build-module/components/block-parent-selector/index.js.map +1 -1
  209. package/build-module/components/block-removal-warning-modal/index.js +17 -24
  210. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  211. package/build-module/components/block-settings/button.native.js +3 -3
  212. package/build-module/components/block-settings/button.native.js.map +1 -1
  213. package/build-module/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +13 -13
  214. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
  215. package/build-module/components/block-toolbar/index.js +12 -8
  216. package/build-module/components/block-toolbar/index.js.map +1 -1
  217. package/build-module/components/block-toolbar/index.native.js +60 -4
  218. package/build-module/components/block-toolbar/index.native.js.map +1 -1
  219. package/build-module/components/block-tools/block-contextual-toolbar.js +8 -11
  220. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  221. package/build-module/components/colors-gradients/control.js +3 -2
  222. package/build-module/components/colors-gradients/control.js.map +1 -1
  223. package/build-module/components/dimensions-tool/aspect-ratio-tool.js +87 -0
  224. package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -0
  225. package/build-module/components/dimensions-tool/index.js +195 -0
  226. package/build-module/components/dimensions-tool/index.js.map +1 -0
  227. package/build-module/components/dimensions-tool/scale-tool.js +103 -0
  228. package/build-module/components/dimensions-tool/scale-tool.js.map +1 -0
  229. package/build-module/components/dimensions-tool/width-height-tool.js +122 -0
  230. package/build-module/components/dimensions-tool/width-height-tool.js.map +1 -0
  231. package/build-module/components/global-styles/color-panel.js +22 -16
  232. package/build-module/components/global-styles/color-panel.js.map +1 -1
  233. package/build-module/components/global-styles/dimensions-panel.js +13 -2
  234. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  235. package/build-module/components/global-styles/filters-panel.js +2 -2
  236. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  237. package/build-module/components/global-styles/get-block-css-selector.js +4 -8
  238. package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
  239. package/build-module/components/global-styles/hooks.js +14 -24
  240. package/build-module/components/global-styles/hooks.js.map +1 -1
  241. package/build-module/components/global-styles/typography-panel.js +51 -5
  242. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  243. package/build-module/components/global-styles/use-global-styles-output.js +13 -18
  244. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  245. package/build-module/components/global-styles/utils.js +5 -5
  246. package/build-module/components/global-styles/utils.js.map +1 -1
  247. package/build-module/components/iframe/index.js +37 -49
  248. package/build-module/components/iframe/index.js.map +1 -1
  249. package/build-module/components/iframe/use-compatibility-styles.js +5 -0
  250. package/build-module/components/iframe/use-compatibility-styles.js.map +1 -1
  251. package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -1
  252. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  253. package/build-module/components/image-editor/use-save-image.js +1 -2
  254. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  255. package/build-module/components/image-size-control/index.js +5 -0
  256. package/build-module/components/image-size-control/index.js.map +1 -1
  257. package/build-module/components/index.js +1 -0
  258. package/build-module/components/index.js.map +1 -1
  259. package/build-module/components/inner-blocks/index.js +3 -1
  260. package/build-module/components/inner-blocks/index.js.map +1 -1
  261. package/build-module/components/inner-blocks/index.native.js +3 -1
  262. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  263. package/build-module/components/inner-blocks/use-nested-settings-update.js +30 -7
  264. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  265. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +2 -2
  266. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  267. package/build-module/components/inserter/block-patterns-tab.js +7 -33
  268. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  269. package/build-module/components/inserter/hooks/use-block-types-state.js +3 -4
  270. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  271. package/build-module/components/inserter/hooks/use-patterns-state.js +9 -3
  272. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  273. package/build-module/components/inserter/index.js +2 -4
  274. package/build-module/components/inserter/index.js.map +1 -1
  275. package/build-module/components/inserter/index.native.js +22 -33
  276. package/build-module/components/inserter/index.native.js.map +1 -1
  277. package/build-module/components/inserter/media-tab/hooks.js +2 -21
  278. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  279. package/build-module/components/inserter/reusable-block-rename-hint.js +67 -0
  280. package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -0
  281. package/build-module/components/inserter/reusable-blocks-tab.js +5 -2
  282. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  283. package/build-module/components/inserter/reusable-blocks-tab.native.js +2 -2
  284. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  285. package/build-module/components/inserter/tabs.native.js +1 -1
  286. package/build-module/components/inserter/tabs.native.js.map +1 -1
  287. package/build-module/components/inserter-draggable-blocks/index.js +9 -2
  288. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  289. package/build-module/components/link-control/constants.js +1 -1
  290. package/build-module/components/link-control/constants.js.map +1 -1
  291. package/build-module/components/link-control/index.js +21 -16
  292. package/build-module/components/link-control/index.js.map +1 -1
  293. package/build-module/components/link-control/search-create-button.js +7 -20
  294. package/build-module/components/link-control/search-create-button.js.map +1 -1
  295. package/build-module/components/link-control/search-input.js +4 -4
  296. package/build-module/components/link-control/search-input.js.map +1 -1
  297. package/build-module/components/link-control/search-item.js +14 -28
  298. package/build-module/components/link-control/search-item.js.map +1 -1
  299. package/build-module/components/link-control/search-results.js +3 -3
  300. package/build-module/components/link-control/search-results.js.map +1 -1
  301. package/build-module/components/link-control/settings-drawer.js +4 -5
  302. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  303. package/build-module/components/list-view/appender.js +2 -6
  304. package/build-module/components/list-view/appender.js.map +1 -1
  305. package/build-module/components/list-view/use-list-view-client-ids.js +2 -2
  306. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  307. package/build-module/components/media-placeholder/index.native.js +66 -33
  308. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  309. package/build-module/components/preview-options/index.js +2 -2
  310. package/build-module/components/preview-options/index.js.map +1 -1
  311. package/build-module/components/provider/index.js +5 -2
  312. package/build-module/components/provider/index.js.map +1 -1
  313. package/build-module/components/provider/use-block-sync.js +21 -0
  314. package/build-module/components/provider/use-block-sync.js.map +1 -1
  315. package/build-module/components/resolution-tool/index.js +45 -0
  316. package/build-module/components/resolution-tool/index.js.map +1 -0
  317. package/build-module/components/rich-text/content.js +1 -36
  318. package/build-module/components/rich-text/content.js.map +1 -1
  319. package/build-module/components/rich-text/get-rich-text-values.js +105 -0
  320. package/build-module/components/rich-text/get-rich-text-values.js.map +1 -0
  321. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  322. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  323. package/build-module/components/spacing-sizes-control/input-controls/axial.js +7 -3
  324. package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
  325. package/build-module/components/spacing-sizes-control/input-controls/separated.js +6 -2
  326. package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
  327. package/build-module/components/spacing-sizes-control/input-controls/single.js +6 -2
  328. package/build-module/components/spacing-sizes-control/input-controls/single.js.map +1 -1
  329. package/build-module/components/spacing-sizes-control/utils.js +1 -1
  330. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  331. package/build-module/components/url-input/index.js +4 -2
  332. package/build-module/components/url-input/index.js.map +1 -1
  333. package/build-module/components/use-block-display-information/index.js +7 -3
  334. package/build-module/components/use-block-display-information/index.js.map +1 -1
  335. package/build-module/components/use-block-drop-zone/index.native.js +50 -8
  336. package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
  337. package/build-module/components/use-setting/index.js +5 -9
  338. package/build-module/components/use-setting/index.js.map +1 -1
  339. package/build-module/components/writing-flow/use-tab-nav.js +8 -26
  340. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  341. package/build-module/components/writing-mode-control/index.js +57 -0
  342. package/build-module/components/writing-mode-control/index.js.map +1 -0
  343. package/build-module/hooks/behaviors.js +26 -20
  344. package/build-module/hooks/behaviors.js.map +1 -1
  345. package/build-module/hooks/margin.js +1 -1
  346. package/build-module/hooks/margin.js.map +1 -1
  347. package/build-module/hooks/padding.js +1 -1
  348. package/build-module/hooks/padding.js.map +1 -1
  349. package/build-module/hooks/supports.js +7 -1
  350. package/build-module/hooks/supports.js.map +1 -1
  351. package/build-module/hooks/typography.js +2 -1
  352. package/build-module/hooks/typography.js.map +1 -1
  353. package/build-module/hooks/utils.js +6 -9
  354. package/build-module/hooks/utils.js.map +1 -1
  355. package/build-module/private-apis.js +11 -2
  356. package/build-module/private-apis.js.map +1 -1
  357. package/build-module/private-apis.native.js +2 -0
  358. package/build-module/private-apis.native.js.map +1 -1
  359. package/build-module/store/actions.js +193 -3
  360. package/build-module/store/actions.js.map +1 -1
  361. package/build-module/store/defaults.js +1 -0
  362. package/build-module/store/defaults.js.map +1 -1
  363. package/build-module/store/index.js +10 -1
  364. package/build-module/store/index.js.map +1 -1
  365. package/build-module/store/private-actions.js +45 -36
  366. package/build-module/store/private-actions.js.map +1 -1
  367. package/build-module/store/private-selectors.js +5 -5
  368. package/build-module/store/private-selectors.js.map +1 -1
  369. package/build-module/store/reducer.js +22 -9
  370. package/build-module/store/reducer.js.map +1 -1
  371. package/build-module/store/selectors.js +49 -21
  372. package/build-module/store/selectors.js.map +1 -1
  373. package/build-module/utils/object.js +34 -2
  374. package/build-module/utils/object.js.map +1 -1
  375. package/build-style/content-rtl.css +4 -0
  376. package/build-style/content.css +4 -0
  377. package/build-style/style-rtl.css +137 -129
  378. package/build-style/style.css +137 -129
  379. package/package.json +33 -32
  380. package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -6
  381. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -5
  382. package/src/components/block-controls/README.md +89 -0
  383. package/src/components/block-draggable/index.js +13 -4
  384. package/src/components/block-draggable/index.native.js +7 -3
  385. package/src/components/block-draggable/style.scss +1 -0
  386. package/src/components/block-draggable/test/index.native.js +0 -54
  387. package/src/components/block-edit/edit.js +26 -9
  388. package/src/components/block-edit/test/edit.js +1 -1
  389. package/src/components/block-heading-level-dropdown/heading-level-icon.js +6 -1
  390. package/src/components/block-heading-level-dropdown/index.native.js +8 -4
  391. package/src/components/block-inspector/style.scss +2 -1
  392. package/src/components/block-list/block-outline.native.js +26 -25
  393. package/src/components/block-list/block.native.js +24 -38
  394. package/src/components/block-list/block.native.scss +18 -40
  395. package/src/components/block-list/style.native.scss +3 -3
  396. package/src/components/block-lock/toolbar.js +34 -6
  397. package/src/components/block-mover/index.native.js +3 -3
  398. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +16 -6
  399. package/src/components/block-parent-selector/index.js +13 -8
  400. package/src/components/block-removal-warning-modal/index.js +17 -33
  401. package/src/components/block-settings/button.native.js +12 -6
  402. package/src/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +19 -18
  403. package/src/components/block-toolbar/index.js +11 -9
  404. package/src/components/block-toolbar/index.native.js +86 -6
  405. package/src/components/{block-mobile-toolbar/test/block-actions-menu.native.js → block-toolbar/test/block-toolbar-menu.native.js} +20 -54
  406. package/src/components/block-toolbar/test/index.native.js +42 -0
  407. package/src/components/block-tools/block-contextual-toolbar.js +5 -11
  408. package/src/components/block-tools/style.scss +73 -26
  409. package/src/components/button-block-appender/styles.native.scss +2 -2
  410. package/src/components/caption/README.md +49 -0
  411. package/src/components/colors-gradients/control.js +3 -2
  412. package/src/components/default-block-appender/content.scss +11 -0
  413. package/src/components/dimensions-tool/aspect-ratio-tool.js +124 -0
  414. package/src/components/dimensions-tool/index.js +212 -0
  415. package/src/components/dimensions-tool/scale-tool.js +124 -0
  416. package/src/components/dimensions-tool/stories/aspect-ratio-tool.js +52 -0
  417. package/src/components/dimensions-tool/stories/index.js +54 -0
  418. package/src/components/dimensions-tool/stories/scale-tool.js +48 -0
  419. package/src/components/dimensions-tool/stories/width-height-tool.js +54 -0
  420. package/src/components/dimensions-tool/test/index.js +641 -0
  421. package/src/components/dimensions-tool/width-height-tool.js +113 -0
  422. package/src/components/font-family/README.md +71 -0
  423. package/src/components/global-styles/color-panel.js +24 -17
  424. package/src/components/global-styles/dimensions-panel.js +8 -2
  425. package/src/components/global-styles/filters-panel.js +2 -2
  426. package/src/components/global-styles/get-block-css-selector.js +5 -9
  427. package/src/components/global-styles/hooks.js +22 -26
  428. package/src/components/global-styles/typography-panel.js +57 -5
  429. package/src/components/global-styles/use-global-styles-output.js +36 -18
  430. package/src/components/global-styles/utils.js +15 -6
  431. package/src/components/iframe/index.js +30 -56
  432. package/src/components/iframe/use-compatibility-styles.js +5 -0
  433. package/src/components/image-editor/aspect-ratio-dropdown.js +1 -1
  434. package/src/components/image-editor/use-save-image.js +0 -1
  435. package/src/components/image-size-control/index.js +6 -0
  436. package/src/components/index.js +1 -0
  437. package/src/components/inner-blocks/README.md +10 -0
  438. package/src/components/inner-blocks/index.js +4 -0
  439. package/src/components/inner-blocks/index.native.js +4 -0
  440. package/src/components/inner-blocks/use-nested-settings-update.js +32 -5
  441. package/src/components/inserter/block-patterns-explorer/patterns-list.js +8 -2
  442. package/src/components/inserter/block-patterns-tab.js +8 -56
  443. package/src/components/inserter/hooks/use-block-types-state.js +3 -4
  444. package/src/components/inserter/hooks/use-patterns-state.js +35 -19
  445. package/src/components/inserter/index.js +2 -3
  446. package/src/components/inserter/index.native.js +17 -36
  447. package/src/components/inserter/media-tab/hooks.js +2 -22
  448. package/src/components/inserter/reusable-block-rename-hint.js +69 -0
  449. package/src/components/inserter/reusable-blocks-tab.js +5 -1
  450. package/src/components/inserter/reusable-blocks-tab.native.js +2 -2
  451. package/src/components/inserter/style.native.scss +10 -15
  452. package/src/components/inserter/style.scss +28 -0
  453. package/src/components/inserter/tabs.native.js +5 -1
  454. package/src/components/inserter-draggable-blocks/index.js +13 -2
  455. package/src/components/link-control/constants.js +1 -1
  456. package/src/components/link-control/index.js +36 -29
  457. package/src/components/link-control/search-create-button.js +8 -26
  458. package/src/components/link-control/search-input.js +4 -3
  459. package/src/components/link-control/search-item.js +21 -43
  460. package/src/components/link-control/search-results.js +48 -46
  461. package/src/components/link-control/settings-drawer.js +6 -5
  462. package/src/components/link-control/style.scss +58 -123
  463. package/src/components/link-control/test/index.js +161 -123
  464. package/src/components/list-view/appender.js +5 -6
  465. package/src/components/list-view/style.scss +1 -2
  466. package/src/components/list-view/use-list-view-client-ids.js +2 -2
  467. package/src/components/media-placeholder/index.native.js +108 -59
  468. package/src/components/media-placeholder/styles.native.scss +59 -24
  469. package/src/components/media-replace-flow/test/index.js +1 -1
  470. package/src/components/panel-color-settings/README.md +98 -0
  471. package/src/components/preview-options/README.md +18 -17
  472. package/src/components/preview-options/index.js +2 -2
  473. package/src/components/provider/index.js +9 -2
  474. package/src/components/provider/test/use-block-sync.js +21 -6
  475. package/src/components/provider/use-block-sync.js +19 -0
  476. package/src/components/recursion-provider/README.md +101 -0
  477. package/src/components/resolution-tool/index.js +56 -0
  478. package/src/components/resolution-tool/stories/index.js +48 -0
  479. package/src/components/rich-text/content.js +1 -46
  480. package/src/components/rich-text/get-rich-text-values.js +105 -0
  481. package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  482. package/src/components/spacing-sizes-control/input-controls/axial.js +17 -2
  483. package/src/components/spacing-sizes-control/input-controls/separated.js +17 -2
  484. package/src/components/spacing-sizes-control/input-controls/single.js +12 -2
  485. package/src/components/spacing-sizes-control/utils.js +1 -1
  486. package/src/components/text-transform-control/README.md +44 -0
  487. package/src/components/url-input/index.js +2 -0
  488. package/src/components/use-block-display-information/index.js +12 -5
  489. package/src/components/use-block-drop-zone/index.native.js +65 -28
  490. package/src/components/use-setting/index.js +8 -8
  491. package/src/components/writing-flow/use-tab-nav.js +10 -33
  492. package/src/components/writing-mode-control/index.js +68 -0
  493. package/src/components/writing-mode-control/style.scss +18 -0
  494. package/src/hooks/behaviors.js +25 -16
  495. package/src/hooks/margin.js +4 -1
  496. package/src/hooks/padding.js +4 -1
  497. package/src/hooks/supports.js +7 -0
  498. package/src/hooks/typography.js +2 -0
  499. package/src/hooks/utils.js +8 -7
  500. package/src/private-apis.js +13 -1
  501. package/src/private-apis.native.js +2 -0
  502. package/src/store/actions.js +195 -3
  503. package/src/store/defaults.js +1 -0
  504. package/src/store/index.js +10 -0
  505. package/src/store/private-actions.js +39 -39
  506. package/src/store/private-selectors.js +5 -8
  507. package/src/store/reducer.js +22 -9
  508. package/src/store/selectors.js +87 -25
  509. package/src/store/test/actions.js +114 -0
  510. package/src/store/test/private-actions.js +56 -0
  511. package/src/store/test/private-selectors.js +5 -5
  512. package/src/store/test/reducer.js +14 -7
  513. package/src/store/test/selectors.js +1 -1
  514. package/src/utils/object.js +32 -2
  515. package/src/utils/test/object.js +36 -0
  516. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
  517. package/build/components/block-mobile-toolbar/index.native.js +0 -135
  518. package/build/components/block-mobile-toolbar/index.native.js.map +0 -1
  519. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
  520. package/build-module/components/block-mobile-toolbar/index.native.js +0 -116
  521. package/build-module/components/block-mobile-toolbar/index.native.js.map +0 -1
  522. package/src/components/block-mobile-toolbar/index.native.js +0 -127
  523. package/src/components/block-mobile-toolbar/style.native.scss +0 -16
  524. /package/src/components/{block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap → block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap} +0 -0
@@ -89,6 +89,8 @@ function UncontrolledInnerBlocks(props) {
89
89
  clientId,
90
90
  allowedBlocks,
91
91
  prioritizedInserterBlocks,
92
+ defaultBlock,
93
+ directInsert,
92
94
  __experimentalDefaultBlock,
93
95
  __experimentalDirectInsert,
94
96
  template,
@@ -113,7 +115,7 @@ function UncontrolledInnerBlocks(props) {
113
115
  gridProperties
114
116
  } = props;
115
117
  const context = (0, _useBlockContext.default)(clientId);
116
- (0, _useNestedSettingsUpdate.default)(clientId, allowedBlocks, prioritizedInserterBlocks, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout);
118
+ (0, _useNestedSettingsUpdate.default)(clientId, allowedBlocks, prioritizedInserterBlocks, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout);
117
119
  (0, _useInnerBlockTemplateSync.default)(clientId, template, templateLock, templateInsertUpdatesSelection);
118
120
  return (0, _element.createElement)(_layout.LayoutProvider, {
119
121
  value: layout
@@ -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","prioritizedInserterBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","template","templateLock","templateInsertUpdatesSelection","__experimentalCaptureToolbars","captureToolbars","orientation","renderAppender","renderFooterAppender","parentWidth","horizontal","contentResizeMode","contentStyle","onAddBlock","onDeleteBlock","marginVertical","marginHorizontal","horizontalAlignment","filterInnerBlocks","blockWidth","layout","defaultLayout","gridProperties","context","allProps","DefaultBlockAppender","ButtonBlockAppender","save","getInnerBlocksProps","Content"],"mappings":";;;;;;;;;;AAIA;;AADA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAT,CAA8BC,KAAK,GAAG,EAAtC,EAA0CC,OAAO,GAAG,EAApD,EAAyD;AAC/D,QAAMC,WAAW,GAAG,sBAApB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAe,mCAArB;AAEA,QAAMC,GAAG,GAAGJ,KAAK,CAACI,GAAN,IAAaF,WAAzB;AACA,QAAMG,WAAW,GAChBJ,OAAO,CAACK,KAAR,IAAiBL,OAAO,CAACM,QAAzB,GACGC,qBADH,GAEGC,uBAHJ;AAKA,SAAO,EACN,GAAGT,KADG;AAENI,IAAAA,GAFM;AAGNM,IAAAA,QAAQ,EACP,4BAAC,WAAD,OACMT,OADN;AAEC,MAAA,QAAQ,EAAGE,QAFZ;AAGC,MAAA,UAAU,EAAGC;AAHd;AAJK,GAAP;AAWA;AAED;AACA;AACA;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AAA,WAAW,EAAGF,WAPf;AAQC,IAAA,WAAW,EAAGG,WARf;AASC,IAAA,mBAAmB,EAAGQ,mBATvB;AAUC,IAAA,UAAU,EAAGP,UAVd;AAWC,IAAA,iBAAiB,EAAGC,iBAXrB;AAYC,IAAA,YAAY,EAAGC,YAZhB;AAaC,IAAA,UAAU,EAAGC,UAbd;AAcC,IAAA,aAAa,EAAGC,aAdjB;AAeC,IAAA,iBAAiB,EAAGI,iBAfrB;AAgBC,IAAA,cAAc,EAAGI,cAhBlB;AAiBC,IAAA,UAAU,EAAGH;AAjBd,IADD,CADD,CADD;AAyBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASzB,qBAAT,CAAgCR,KAAhC,EAAwC;AACvC,6BAAcA,KAAd;AACA,SAAO,4BAAC,uBAAD,OAA8BA;AAA9B,IAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMK,WAAW,GAAKL,KAAF,IAAa;AAChC,QAAM;AAAEG,IAAAA;AAAF,MAAe,mCAArB;AAEA,QAAMmC,QAAQ,GAAG;AAChBnC,IAAAA,QADgB;AAEhB,OAAGH;AAFa,GAAjB,CAHgC,CAQhC;;AACA,SAAOA,KAAK,CAACM,KAAN,IAAeN,KAAK,CAACO,QAArB,GACN,4BAAC,qBAAD,OAA4B+B;AAA5B,IADM,GAGN,4BAAC,uBAAD,OAA8BA;AAA9B,IAHD;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 { 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\tprioritizedInserterBlocks,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection,\n\t\t__experimentalCaptureToolbars: captureToolbars,\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\tlayout = defaultLayout,\n\t\tgridProperties,\n\t} = props;\n\n\tconst context = useBlockContext( clientId );\n\n\tuseNestedSettingsUpdate(\n\t\tclientId,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\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\treturn (\n\t\t<LayoutProvider value={ layout }>\n\t\t\t<BlockContextProvider value={ context }>\n\t\t\t\t<BlockList\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"]}
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","prioritizedInserterBlocks","defaultBlock","directInsert","__experimentalDefaultBlock","__experimentalDirectInsert","template","templateLock","templateInsertUpdatesSelection","__experimentalCaptureToolbars","captureToolbars","orientation","renderAppender","renderFooterAppender","parentWidth","horizontal","contentResizeMode","contentStyle","onAddBlock","onDeleteBlock","marginVertical","marginHorizontal","horizontalAlignment","filterInnerBlocks","blockWidth","layout","defaultLayout","gridProperties","context","allProps","DefaultBlockAppender","ButtonBlockAppender","save","getInnerBlocksProps","Content"],"mappings":";;;;;;;;;;AAIA;;AADA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAT,CAA8BC,KAAK,GAAG,EAAtC,EAA0CC,OAAO,GAAG,EAApD,EAAyD;AAC/D,QAAMC,WAAW,GAAG,sBAApB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAe,mCAArB;AAEA,QAAMC,GAAG,GAAGJ,KAAK,CAACI,GAAN,IAAaF,WAAzB;AACA,QAAMG,WAAW,GAChBJ,OAAO,CAACK,KAAR,IAAiBL,OAAO,CAACM,QAAzB,GACGC,qBADH,GAEGC,uBAHJ;AAKA,SAAO,EACN,GAAGT,KADG;AAENI,IAAAA,GAFM;AAGNM,IAAAA,QAAQ,EACP,4BAAC,WAAD,OACMT,OADN;AAEC,MAAA,QAAQ,EAAGE,QAFZ;AAGC,MAAA,UAAU,EAAGC;AAHd;AAJK,GAAP;AAWA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASK,uBAAT,CAAkCT,KAAlC,EAA0C;AACzC,QAAM;AACLG,IAAAA,QADK;AAELQ,IAAAA,aAFK;AAGLC,IAAAA,yBAHK;AAILC,IAAAA,YAJK;AAKLC,IAAAA,YALK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,EAAGP,UAVd;AAWC,IAAA,iBAAiB,EAAGC,iBAXrB;AAYC,IAAA,YAAY,EAAGC,YAZhB;AAaC,IAAA,UAAU,EAAGC,UAbd;AAcC,IAAA,aAAa,EAAGC,aAdjB;AAeC,IAAA,iBAAiB,EAAGI,iBAfrB;AAgBC,IAAA,cAAc,EAAGI,cAhBlB;AAiBC,IAAA,UAAU,EAAGH;AAjBd,IADD,CADD,CADD;AAyBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAAS3B,qBAAT,CAAgCR,KAAhC,EAAwC;AACvC,6BAAcA,KAAd;AACA,SAAO,4BAAC,uBAAD,OAA8BA;AAA9B,IAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMK,WAAW,GAAKL,KAAF,IAAa;AAChC,QAAM;AAAEG,IAAAA;AAAF,MAAe,mCAArB;AAEA,QAAMqC,QAAQ,GAAG;AAChBrC,IAAAA,QADgB;AAEhB,OAAGH;AAFa,GAAjB,CAHgC,CAQhC;;AACA,SAAOA,KAAK,CAACM,KAAN,IAAeN,KAAK,CAACO,QAArB,GACN,4BAAC,qBAAD,OAA4BiC;AAA5B,IADM,GAGN,4BAAC,uBAAD,OAA8BA;AAA9B,IAHD;AAKA,CAdD,C,CAgBA;;;AACAnC,WAAW,CAACoC,oBAAZ,GAAmCA,6BAAnC;AACApC,WAAW,CAACqC,mBAAZ,GAAkCA,4BAAlC;AAEA3C,mBAAmB,CAAC4C,IAApB,GAA2BC,qCAA3B;;AAEAvC,WAAW,CAACwC,OAAZ,GAAsB,MAAM9C,mBAAmB,CAAC4C,IAApB,GAA2BjC,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 { 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\tprioritizedInserterBlocks,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection,\n\t\t__experimentalCaptureToolbars: captureToolbars,\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\tlayout = defaultLayout,\n\t\tgridProperties,\n\t} = props;\n\n\tconst context = useBlockContext( clientId );\n\n\tuseNestedSettingsUpdate(\n\t\tclientId,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\tdefaultBlock,\n\t\tdirectInsert,\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\treturn (\n\t\t<LayoutProvider value={ layout }>\n\t\t\t<BlockContextProvider value={ context }>\n\t\t\t\t<BlockList\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"]}
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -9,6 +11,8 @@ var _element = require("@wordpress/element");
9
11
 
10
12
  var _data = require("@wordpress/data");
11
13
 
14
+ var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
15
+
12
16
  var _store = require("../../store");
13
17
 
14
18
  var _layouts = require("../../layouts");
@@ -34,9 +38,13 @@ const pendingSettingsUpdates = new WeakMap();
34
38
  * @param {string[]} allowedBlocks An array of block names which are permitted
35
39
  * in inner blocks.
36
40
  * @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.
37
- * @param {?WPDirectInsertBlock} __experimentalDefaultBlock The default block to insert: [ blockName, { blockAttributes } ].
38
- * @param {?Function|boolean} __experimentalDirectInsert If a default block should be inserted directly by the
39
- * appender.
41
+ * @param {?WPDirectInsertBlock} defaultBlock The default block to insert: [ blockName, { blockAttributes } ].
42
+ * @param {?Function|boolean} directInsert If a default block should be inserted directly by the appender.
43
+ *
44
+ * @param {?WPDirectInsertBlock} __experimentalDefaultBlock A deprecated prop for the default block to insert: [ blockName, { blockAttributes } ]. Use `defaultBlock` instead.
45
+ *
46
+ * @param {?Function|boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead.
47
+ *
40
48
  * @param {string} [templateLock] The template lock specified for the inner
41
49
  * blocks component. (e.g. "all")
42
50
  * @param {boolean} captureToolbars Whether or children toolbars should be shown
@@ -47,7 +55,7 @@ const pendingSettingsUpdates = new WeakMap();
47
55
  * @param {Object} layout The layout object for the block container.
48
56
  */
49
57
 
50
- function useNestedSettingsUpdate(clientId, allowedBlocks, prioritizedInserterBlocks, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout) {
58
+ function useNestedSettingsUpdate(clientId, allowedBlocks, prioritizedInserterBlocks, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout) {
51
59
  const {
52
60
  updateBlockListSettings
53
61
  } = (0, _data.useDispatch)(_store.store);
@@ -94,11 +102,29 @@ function useNestedSettingsUpdate(clientId, allowedBlocks, prioritizedInserterBlo
94
102
  }
95
103
 
96
104
  if (__experimentalDefaultBlock !== undefined) {
97
- newSettings.__experimentalDefaultBlock = __experimentalDefaultBlock;
105
+ (0, _deprecated.default)('__experimentalDefaultBlock', {
106
+ alternative: 'defaultBlock',
107
+ since: '6.3',
108
+ version: '6.4'
109
+ });
110
+ newSettings.defaultBlock = __experimentalDefaultBlock;
111
+ }
112
+
113
+ if (defaultBlock !== undefined) {
114
+ newSettings.defaultBlock = defaultBlock;
98
115
  }
99
116
 
100
117
  if (__experimentalDirectInsert !== undefined) {
101
- newSettings.__experimentalDirectInsert = __experimentalDirectInsert;
118
+ (0, _deprecated.default)('__experimentalDirectInsert', {
119
+ alternative: 'directInsert',
120
+ since: '6.3',
121
+ version: '6.4'
122
+ });
123
+ newSettings.directInsert = __experimentalDirectInsert;
124
+ }
125
+
126
+ if (directInsert !== undefined) {
127
+ newSettings.directInsert = directInsert;
102
128
  } // Batch updates to block list settings to avoid triggering cascading renders
103
129
  // for each container block included in a tree and optimize initial render.
104
130
  // To avoid triggering updateBlockListSettings for each container block
@@ -122,6 +148,6 @@ function useNestedSettingsUpdate(clientId, allowedBlocks, prioritizedInserterBlo
122
148
  });
123
149
  }
124
150
  });
125
- }, [clientId, _allowedBlocks, _prioritizedInserterBlocks, _templateLock, __experimentalDefaultBlock, __experimentalDirectInsert, captureToolbars, orientation, updateBlockListSettings, layout, registry]);
151
+ }, [clientId, _allowedBlocks, _prioritizedInserterBlocks, _templateLock, defaultBlock, directInsert, __experimentalDefaultBlock, __experimentalDirectInsert, captureToolbars, orientation, updateBlockListSettings, layout, registry]);
126
152
  }
127
153
  //# sourceMappingURL=use-nested-settings-update.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inner-blocks/use-nested-settings-update.js"],"names":["pendingSettingsUpdates","WeakMap","useNestedSettingsUpdate","clientId","allowedBlocks","prioritizedInserterBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","templateLock","captureToolbars","orientation","layout","updateBlockListSettings","blockEditorStore","registry","parentLock","select","rootClientId","getBlockRootClientId","getTemplateLock","_allowedBlocks","_prioritizedInserterBlocks","_templateLock","undefined","newSettings","__experimentalCaptureToolbars","layoutType","type","getOrientation","get","set","push","window","queueMicrotask","length","batch","forEach","args"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AAEA,MAAMA,sBAAsB,GAAG,IAAIC,OAAJ,EAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASC,uBAAT,CACdC,QADc,EAEdC,aAFc,EAGdC,yBAHc,EAIdC,0BAJc,EAKdC,0BALc,EAMdC,YANc,EAOdC,eAPc,EAQdC,WARc,EASdC,MATc,EAUb;AACD,QAAM;AAAEC,IAAAA;AAAF,MAA8B,uBAAaC,YAAb,CAApC;AACA,QAAMC,QAAQ,GAAG,wBAAjB;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAiB,qBACpBC,MAAF,IAAc;AACb,UAAMC,YAAY,GACjBD,MAAM,CAAEH,YAAF,CAAN,CAA2BK,oBAA3B,CAAiDf,QAAjD,CADD;AAEA,WAAO;AACNY,MAAAA,UAAU,EACTC,MAAM,CAAEH,YAAF,CAAN,CAA2BM,eAA3B,CAA4CF,YAA5C;AAFK,KAAP;AAIA,GARqB,EAStB,CAAEd,QAAF,CATsB,CAAvB,CAJC,CAgBD;AACA;AACA;AACA;;AAEA,QAAMiB,cAAc,GAAG,sBACtB,MAAMhB,aADgB,EAEtB;AACAA,EAAAA,aAHsB,CAAvB;;AAMA,QAAMiB,0BAA0B,GAAG,sBAClC,MAAMhB,yBAD4B,EAElC;AACAA,EAAAA,yBAHkC,CAAnC;;AAMA,QAAMiB,aAAa,GAClBd,YAAY,KAAKe,SAA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,EAAsD;AACrDpB,QAAAA,QAAQ,CAACqB,KAAT,CAAgB,MAAM;AACrBnC,UAAAA,sBAAsB,CACpB6B,GADF,CACOf,QADP,EAEEsB,OAFF,CAEaC,IAAF,IAAY;AACrBzB,YAAAA,uBAAuB,CAAE,GAAGyB,IAAL,CAAvB;AACA,WAJF;AAKArC,UAAAA,sBAAsB,CAAC8B,GAAvB,CAA4BhB,QAA5B,EAAsC,EAAtC;AACA,SAPD;AAQA;AACD,KAXD;AAYA,GAtDD,EAsDG,CACFX,QADE,EAEFiB,cAFE,EAGFC,0BAHE,EAIFC,aAJE,EAKFhB,0BALE,EAMFC,0BANE,EAOFE,eAPE,EAQFC,WARE,EASFE,uBATE,EAUFD,MAVE,EAWFG,QAXE,CAtDH;AAmEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getLayoutType } from '../../layouts';\n\n/** @typedef {import('../../selectors').WPDirectInsertBlock } WPDirectInsertBlock */\n\nconst pendingSettingsUpdates = new WeakMap();\n\n/**\n * This hook is a side effect which updates the block-editor store when changes\n * happen to inner block settings. The given props are transformed into a\n * settings object, and if that is different from the current settings object in\n * the block-editor store, then the store is updated with the new settings which\n * came from props.\n *\n * @param {string} clientId The client ID of the block to update.\n * @param {string[]} allowedBlocks An array of block names which are permitted\n * in inner blocks.\n * @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.\n * @param {?WPDirectInsertBlock} __experimentalDefaultBlock The default block to insert: [ blockName, { blockAttributes } ].\n * @param {?Function|boolean} __experimentalDirectInsert If a default block should be inserted directly by the\n * appender.\n * @param {string} [templateLock] The template lock specified for the inner\n * blocks component. (e.g. \"all\")\n * @param {boolean} captureToolbars Whether or children toolbars should be shown\n * in the inner blocks component rather than on\n * the child block.\n * @param {string} orientation The direction in which the block\n * should face.\n * @param {Object} layout The layout object for the block container.\n */\nexport default function useNestedSettingsUpdate(\n\tclientId,\n\tallowedBlocks,\n\tprioritizedInserterBlocks,\n\t__experimentalDefaultBlock,\n\t__experimentalDirectInsert,\n\ttemplateLock,\n\tcaptureToolbars,\n\torientation,\n\tlayout\n) {\n\tconst { updateBlockListSettings } = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\tconst { parentLock } = useSelect(\n\t\t( select ) => {\n\t\t\tconst rootClientId =\n\t\t\t\tselect( blockEditorStore ).getBlockRootClientId( clientId );\n\t\t\treturn {\n\t\t\t\tparentLock:\n\t\t\t\t\tselect( blockEditorStore ).getTemplateLock( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Memoize allowedBlocks and prioritisedInnerBlocks based on the contents\n\t// of the arrays. Implementors often pass a new array on every render,\n\t// and the contents of the arrays are just strings, so the entire array\n\t// can be passed as dependencies.\n\n\tconst _allowedBlocks = useMemo(\n\t\t() => allowedBlocks,\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tallowedBlocks\n\t);\n\n\tconst _prioritizedInserterBlocks = useMemo(\n\t\t() => prioritizedInserterBlocks,\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tprioritizedInserterBlocks\n\t);\n\n\tconst _templateLock =\n\t\ttemplateLock === undefined || parentLock === 'contentOnly'\n\t\t\t? parentLock\n\t\t\t: templateLock;\n\n\tuseLayoutEffect( () => {\n\t\tconst newSettings = {\n\t\t\tallowedBlocks: _allowedBlocks,\n\t\t\tprioritizedInserterBlocks: _prioritizedInserterBlocks,\n\t\t\ttemplateLock: _templateLock,\n\t\t};\n\n\t\t// These values are not defined for RN, so only include them if they\n\t\t// are defined.\n\t\tif ( captureToolbars !== undefined ) {\n\t\t\tnewSettings.__experimentalCaptureToolbars = captureToolbars;\n\t\t}\n\n\t\t// Orientation depends on layout,\n\t\t// ideally the separate orientation prop should be deprecated.\n\t\tif ( orientation !== undefined ) {\n\t\t\tnewSettings.orientation = orientation;\n\t\t} else {\n\t\t\tconst layoutType = getLayoutType( layout?.type );\n\t\t\tnewSettings.orientation = layoutType.getOrientation( layout );\n\t\t}\n\n\t\tif ( __experimentalDefaultBlock !== undefined ) {\n\t\t\tnewSettings.__experimentalDefaultBlock = __experimentalDefaultBlock;\n\t\t}\n\n\t\tif ( __experimentalDirectInsert !== undefined ) {\n\t\t\tnewSettings.__experimentalDirectInsert = __experimentalDirectInsert;\n\t\t}\n\n\t\t// Batch updates to block list settings to avoid triggering cascading renders\n\t\t// for each container block included in a tree and optimize initial render.\n\t\t// To avoid triggering updateBlockListSettings for each container block\n\t\t// causing X re-renderings for X container blocks,\n\t\t// we batch all the updatedBlockListSettings in a single \"data\" batch\n\t\t// which results in a single re-render.\n\t\tif ( ! pendingSettingsUpdates.get( registry ) ) {\n\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t}\n\t\tpendingSettingsUpdates\n\t\t\t.get( registry )\n\t\t\t.push( [ clientId, newSettings ] );\n\t\twindow.queueMicrotask( () => {\n\t\t\tif ( pendingSettingsUpdates.get( registry )?.length ) {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tpendingSettingsUpdates\n\t\t\t\t\t\t.get( registry )\n\t\t\t\t\t\t.forEach( ( args ) => {\n\t\t\t\t\t\t\tupdateBlockListSettings( ...args );\n\t\t\t\t\t\t} );\n\t\t\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}, [\n\t\tclientId,\n\t\t_allowedBlocks,\n\t\t_prioritizedInserterBlocks,\n\t\t_templateLock,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tupdateBlockListSettings,\n\t\tlayout,\n\t\tregistry,\n\t] );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inner-blocks/use-nested-settings-update.js"],"names":["pendingSettingsUpdates","WeakMap","useNestedSettingsUpdate","clientId","allowedBlocks","prioritizedInserterBlocks","defaultBlock","directInsert","__experimentalDefaultBlock","__experimentalDirectInsert","templateLock","captureToolbars","orientation","layout","updateBlockListSettings","blockEditorStore","registry","parentLock","select","rootClientId","getBlockRootClientId","getTemplateLock","_allowedBlocks","_prioritizedInserterBlocks","_templateLock","undefined","newSettings","__experimentalCaptureToolbars","layoutType","type","getOrientation","alternative","since","version","get","set","push","window","queueMicrotask","length","batch","forEach","args"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;;AAIA;AAEA,MAAMA,sBAAsB,GAAG,IAAIC,OAAJ,EAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASC,uBAAT,CACdC,QADc,EAEdC,aAFc,EAGdC,yBAHc,EAIdC,YAJc,EAKdC,YALc,EAMdC,0BANc,EAOdC,0BAPc,EAQdC,YARc,EASdC,eATc,EAUdC,WAVc,EAWdC,MAXc,EAYb;AACD,QAAM;AAAEC,IAAAA;AAAF,MAA8B,uBAAaC,YAAb,CAApC;AACA,QAAMC,QAAQ,GAAG,wBAAjB;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAiB,qBACpBC,MAAF,IAAc;AACb,UAAMC,YAAY,GACjBD,MAAM,CAAEH,YAAF,CAAN,CAA2BK,oBAA3B,CAAiDjB,QAAjD,CADD;AAEA,WAAO;AACNc,MAAAA,UAAU,EACTC,MAAM,CAAEH,YAAF,CAAN,CAA2BM,eAA3B,CAA4CF,YAA5C;AAFK,KAAP;AAIA,GARqB,EAStB,CAAEhB,QAAF,CATsB,CAAvB,CAJC,CAgBD;AACA;AACA;AACA;;AAEA,QAAMmB,cAAc,GAAG,sBACtB,MAAMlB,aADg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EzCC,QAAAA,KAAK,EAAE,KAFkC;AAGzCC,QAAAA,OAAO,EAAE;AAHgC,OAA1C;AAKAP,MAAAA,WAAW,CAACnB,YAAZ,GAA2BE,0BAA3B;AACA;;AAED,QAAKF,YAAY,KAAKkB,SAAtB,EAAkC;AACjCC,MAAAA,WAAW,CAACnB,YAAZ,GAA2BA,YAA3B;AACA,KA9CqB,CAgDtB;AACA;AACA;AACA;AACA;AACA;;;AACA,QAAK,CAAEP,sBAAsB,CAACkC,GAAvB,CAA4BlB,QAA5B,CAAP,EAAgD;AAC/ChB,MAAAA,sBAAsB,CAACmC,GAAvB,CAA4BnB,QAA5B,EAAsC,EAAtC;AACA;;AACDhB,IAAAA,sBAAsB,CACpBkC,GADF,CACOlB,QADP,EAEEoB,IAFF,CAEQ,CAAEjC,QAAF,EAAYuB,WAAZ,CAFR;AAGAW,IAAAA,MAAM,CAACC,cAAP,CAAuB,MAAM;AAC5B,UAAKtC,sBAAsB,CAACkC,GAAvB,CAA4BlB,QAA5B,GAAwCuB,MAA7C,EAAsD;AACrDvB,QAAAA,QAAQ,CAACwB,KAAT,CAAgB,MAAM;AACrBxC,UAAAA,sBAAsB,CACpBkC,GADF,CACOlB,QADP,EAEEyB,OAFF,CAEaC,IAAF,IAAY;AACrB5B,YAAAA,uBAAuB,CAAE,GAAG4B,IAAL,CAAvB;AACA,WAJF;AAKA1C,UAAAA,sBAAsB,CAACmC,GAAvB,CAA4BnB,QAA5B,EAAsC,EAAtC;AACA,SAPD;AAQA;AACD,KAXD;AAYA,GAxED,EAwEG,CACFb,QADE,EAEFmB,cAFE,EAGFC,0BAHE,EAIFC,aAJE,EAKFlB,YALE,EAMFC,YANE,EAOFC,0BAPE,EAQFC,0BARE,EASFE,eATE,EAUFC,WAVE,EAWFE,uBAXE,EAYFD,MAZE,EAaFG,QAbE,CAxEH;AAuFA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { getLayoutType } from '../../layouts';\n\n/** @typedef {import('../../selectors').WPDirectInsertBlock } WPDirectInsertBlock */\n\nconst pendingSettingsUpdates = new WeakMap();\n\n/**\n * This hook is a side effect which updates the block-editor store when changes\n * happen to inner block settings. The given props are transformed into a\n * settings object, and if that is different from the current settings object in\n * the block-editor store, then the store is updated with the new settings which\n * came from props.\n *\n * @param {string} clientId The client ID of the block to update.\n * @param {string[]} allowedBlocks An array of block names which are permitted\n * in inner blocks.\n * @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.\n * @param {?WPDirectInsertBlock} defaultBlock The default block to insert: [ blockName, { blockAttributes } ].\n * @param {?Function|boolean} directInsert If a default block should be inserted directly by the appender.\n *\n * @param {?WPDirectInsertBlock} __experimentalDefaultBlock A deprecated prop for the default block to insert: [ blockName, { blockAttributes } ]. Use `defaultBlock` instead.\n *\n * @param {?Function|boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead.\n *\n * @param {string} [templateLock] The template lock specified for the inner\n * blocks component. (e.g. \"all\")\n * @param {boolean} captureToolbars Whether or children toolbars should be shown\n * in the inner blocks component rather than on\n * the child block.\n * @param {string} orientation The direction in which the block\n * should face.\n * @param {Object} layout The layout object for the block container.\n */\nexport default function useNestedSettingsUpdate(\n\tclientId,\n\tallowedBlocks,\n\tprioritizedInserterBlocks,\n\tdefaultBlock,\n\tdirectInsert,\n\t__experimentalDefaultBlock,\n\t__experimentalDirectInsert,\n\ttemplateLock,\n\tcaptureToolbars,\n\torientation,\n\tlayout\n) {\n\tconst { updateBlockListSettings } = useDispatch( blockEditorStore );\n\tconst registry = useRegistry();\n\n\tconst { parentLock } = useSelect(\n\t\t( select ) => {\n\t\t\tconst rootClientId =\n\t\t\t\tselect( blockEditorStore ).getBlockRootClientId( clientId );\n\t\t\treturn {\n\t\t\t\tparentLock:\n\t\t\t\t\tselect( blockEditorStore ).getTemplateLock( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Memoize allowedBlocks and prioritisedInnerBlocks based on the contents\n\t// of the arrays. Implementors often pass a new array on every render,\n\t// and the contents of the arrays are just strings, so the entire array\n\t// can be passed as dependencies.\n\n\tconst _allowedBlocks = useMemo(\n\t\t() => allowedBlocks,\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tallowedBlocks\n\t);\n\n\tconst _prioritizedInserterBlocks = useMemo(\n\t\t() => prioritizedInserterBlocks,\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\tprioritizedInserterBlocks\n\t);\n\n\tconst _templateLock =\n\t\ttemplateLock === undefined || parentLock === 'contentOnly'\n\t\t\t? parentLock\n\t\t\t: templateLock;\n\n\tuseLayoutEffect( () => {\n\t\tconst newSettings = {\n\t\t\tallowedBlocks: _allowedBlocks,\n\t\t\tprioritizedInserterBlocks: _prioritizedInserterBlocks,\n\t\t\ttemplateLock: _templateLock,\n\t\t};\n\n\t\t// These values are not defined for RN, so only include them if they\n\t\t// are defined.\n\t\tif ( captureToolbars !== undefined ) {\n\t\t\tnewSettings.__experimentalCaptureToolbars = captureToolbars;\n\t\t}\n\n\t\t// Orientation depends on layout,\n\t\t// ideally the separate orientation prop should be deprecated.\n\t\tif ( orientation !== undefined ) {\n\t\t\tnewSettings.orientation = orientation;\n\t\t} else {\n\t\t\tconst layoutType = getLayoutType( layout?.type );\n\t\t\tnewSettings.orientation = layoutType.getOrientation( layout );\n\t\t}\n\n\t\tif ( __experimentalDefaultBlock !== undefined ) {\n\t\t\tdeprecated( '__experimentalDefaultBlock', {\n\t\t\t\talternative: 'defaultBlock',\n\t\t\t\tsince: '6.3',\n\t\t\t\tversion: '6.4',\n\t\t\t} );\n\t\t\tnewSettings.defaultBlock = __experimentalDefaultBlock;\n\t\t}\n\n\t\tif ( defaultBlock !== undefined ) {\n\t\t\tnewSettings.defaultBlock = defaultBlock;\n\t\t}\n\n\t\tif ( __experimentalDirectInsert !== undefined ) {\n\t\t\tdeprecated( '__experimentalDirectInsert', {\n\t\t\t\talternative: 'directInsert',\n\t\t\t\tsince: '6.3',\n\t\t\t\tversion: '6.4',\n\t\t\t} );\n\t\t\tnewSettings.directInsert = __experimentalDirectInsert;\n\t\t}\n\n\t\tif ( directInsert !== undefined ) {\n\t\t\tnewSettings.directInsert = directInsert;\n\t\t}\n\n\t\t// Batch updates to block list settings to avoid triggering cascading renders\n\t\t// for each container block included in a tree and optimize initial render.\n\t\t// To avoid triggering updateBlockListSettings for each container block\n\t\t// causing X re-renderings for X container blocks,\n\t\t// we batch all the updatedBlockListSettings in a single \"data\" batch\n\t\t// which results in a single re-render.\n\t\tif ( ! pendingSettingsUpdates.get( registry ) ) {\n\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t}\n\t\tpendingSettingsUpdates\n\t\t\t.get( registry )\n\t\t\t.push( [ clientId, newSettings ] );\n\t\twindow.queueMicrotask( () => {\n\t\t\tif ( pendingSettingsUpdates.get( registry )?.length ) {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tpendingSettingsUpdates\n\t\t\t\t\t\t.get( registry )\n\t\t\t\t\t\t.forEach( ( args ) => {\n\t\t\t\t\t\t\tupdateBlockListSettings( ...args );\n\t\t\t\t\t\t} );\n\t\t\t\t\tpendingSettingsUpdates.set( registry, [] );\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}, [\n\t\tclientId,\n\t\t_allowedBlocks,\n\t\t_prioritizedInserterBlocks,\n\t\t_templateLock,\n\t\tdefaultBlock,\n\t\tdirectInsert,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tupdateBlockListSettings,\n\t\tlayout,\n\t\tregistry,\n\t] );\n}\n"]}
@@ -72,7 +72,7 @@ function PatternList({
72
72
  }
73
73
 
74
74
  return (0, _searchItems.searchItems)(allPatterns, filterValue);
75
- }, [filterValue, selectedCategory, allPatterns]); // Announce search results on change.
75
+ }, [filterValue, allPatterns, selectedCategory, registeredPatternCategories]); // Announce search results on change.
76
76
 
77
77
  (0, _element.useEffect)(() => {
78
78
  if (!filterValue) {
@@ -84,7 +84,7 @@ function PatternList({
84
84
  /* translators: %d: number of results. */
85
85
  (0, _i18n._n)('%d result found.', '%d results found.', count), count);
86
86
  debouncedSpeak(resultsFoundMessage);
87
- }, [filterValue, debouncedSpeak]);
87
+ }, [filterValue, debouncedSpeak, filteredBlockPatterns.length]);
88
88
  const currentShownPatterns = (0, _compose.useAsyncList)(filteredBlockPatterns, {
89
89
  step: INITIAL_INSERTER_RESULTS
90
90
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/block-patterns-explorer/patterns-list.js"],"names":["INITIAL_INSERTER_RESULTS","PatternsListHeader","filterValue","filteredBlockPatternsLength","PatternList","selectedCategory","patternCategories","debouncedSpeak","speak","destinationRootClientId","onInsertBlocks","shouldFocusBlock","allPatterns","onSelectBlockPattern","registeredPatternCategories","map","patternCategory","name","filteredBlockPatterns","filter","pattern","categories","length","every","category","includes","count","resultsFoundMessage","currentShownPatterns","step","hasItems"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAOA;AACA;AACA;AAQA,MAAMA,wBAAwB,GAAG,CAAjC;;AAEA,SAASC,kBAAT,CAA6B;AAAEC,EAAAA,WAAF;AAAeC,EAAAA;AAAf,CAA7B,EAA4E;AAC3E,MAAK,CAAED,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AACD,SACC,4BAAC,iCAAD;AACC,IAAA,KAAK,EAAG,CADT;AAEC,IAAA,UAAU,EAAG,MAFd;AAGC,IAAA,SAAS,EAAC;AAHX,KAKG;AACD;AACA,gB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MK,mBAAmB,GAAG;AAC3B;AACA,kBAAI,kBAAJ,EAAwB,mBAAxB,EAA6CD,KAA7C,CAF2B,EAG3BA,KAH2B,CAA5B;AAKAnB,IAAAA,cAAc,CAAEoB,mBAAF,CAAd;AACA,GAXD,EAWG,CAAEzB,WAAF,EAAeK,cAAf,CAXH;AAaA,QAAMqB,oBAAoB,GAAG,2BAAcV,qBAAd,EAAqC;AACjEW,IAAAA,IAAI,EAAE7B;AAD2D,GAArC,CAA7B;AAIA,QAAM8B,QAAQ,GAAG,CAAC,CAAEZ,qBAAqB,EAAEI,MAA3C;AACA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGQ,QAAQ,IACT,4BAAC,kBAAD;AACC,IAAA,WAAW,EAAG5B,WADf;AAEC,IAAA,2BAA2B,EAAGgB,qBAAqB,CAACI;AAFrD,IAFF,EAOC,4BAAC,wBAAD,QACG,CAAEQ,QAAF,IAAc,4BAAC,kBAAD,OADjB,EAEGA,QAAQ,IACT,4BAAC,0BAAD;AACC,IAAA,aAAa,EAAGF,oBADjB;AAEC,IAAA,aAAa,EAAGV,qBAFjB;AAGC,IAAA,cAAc,EAAGL,oBAHlB;AAIC,IAAA,WAAW,EAAG;AAJf,IAHF,CAPD,CADD;AAqBA;;eAEcT,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { useDebounce, useAsyncList } from '@wordpress/compose';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockPatternsList from '../../block-patterns-list';\nimport InserterNoResults from '../no-results';\nimport useInsertionPoint from '../hooks/use-insertion-point';\nimport usePatternsState from '../hooks/use-patterns-state';\nimport InserterListbox from '../../inserter-listbox';\nimport { searchItems } from '../search-items';\n\nconst INITIAL_INSERTER_RESULTS = 2;\n\nfunction PatternsListHeader( { filterValue, filteredBlockPatternsLength } ) {\n\tif ( ! filterValue ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Heading\n\t\t\tlevel={ 2 }\n\t\t\tlineHeight={ '48px' }\n\t\t\tclassName=\"block-editor-block-patterns-explorer__search-results-count\"\n\t\t>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: %d: number of patterns. %s: block pattern search query */\n\t\t\t\t_n(\n\t\t\t\t\t'%1$d pattern found for \"%2$s\"',\n\t\t\t\t\t'%1$d patterns found for \"%2$s\"',\n\t\t\t\t\tfilteredBlockPatternsLength\n\t\t\t\t),\n\t\t\t\tfilteredBlockPatternsLength,\n\t\t\t\tfilterValue\n\t\t\t) }\n\t\t</Heading>\n\t);\n}\n\nfunction PatternList( { filterValue, selectedCategory, patternCategories } ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {\n\t\tshouldFocusBlock: true,\n\t} );\n\tconst [ allPatterns, , onSelectBlockPattern ] = usePatternsState(\n\t\tonInsertBlocks,\n\t\tdestinationRootClientId\n\t);\n\tconst registeredPatternCategories = useMemo(\n\t\t() =>\n\t\t\tpatternCategories.map(\n\t\t\t\t( patternCategory ) => patternCategory.name\n\t\t\t),\n\t\t[ patternCategories ]\n\t);\n\n\tconst filteredBlockPatterns = useMemo( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn allPatterns.filter( ( pattern ) =>\n\t\t\t\tselectedCategory === 'uncategorized'\n\t\t\t\t\t? ! pattern.categories?.length ||\n\t\t\t\t\t pattern.categories.every(\n\t\t\t\t\t\t\t( category ) =>\n\t\t\t\t\t\t\t\t! registeredPatternCategories.includes(\n\t\t\t\t\t\t\t\t\tcategory\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t )\n\t\t\t\t\t: pattern.categories?.includes( selectedCategory )\n\t\t\t);\n\t\t}\n\t\treturn searchItems( allPatterns, filterValue );\n\t}, [ filterValue, selectedCategory, allPatterns ] );\n\n\t// Announce search results on change.\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = filteredBlockPatterns.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ filterValue, debouncedSpeak ] );\n\n\tconst currentShownPatterns = useAsyncList( filteredBlockPatterns, {\n\t\tstep: INITIAL_INSERTER_RESULTS,\n\t} );\n\n\tconst hasItems = !! filteredBlockPatterns?.length;\n\treturn (\n\t\t<div className=\"block-editor-block-patterns-explorer__list\">\n\t\t\t{ hasItems && (\n\t\t\t\t<PatternsListHeader\n\t\t\t\t\tfilterValue={ filterValue }\n\t\t\t\t\tfilteredBlockPatternsLength={ filteredBlockPatterns.length }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<InserterListbox>\n\t\t\t\t{ ! hasItems && <InserterNoResults /> }\n\t\t\t\t{ hasItems && (\n\t\t\t\t\t<BlockPatternsList\n\t\t\t\t\t\tshownPatterns={ currentShownPatterns }\n\t\t\t\t\t\tblockPatterns={ filteredBlockPatterns }\n\t\t\t\t\t\tonClickPattern={ onSelectBlockPattern }\n\t\t\t\t\t\tisDraggable={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InserterListbox>\n\t\t</div>\n\t);\n}\n\nexport default PatternList;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/block-patterns-explorer/patterns-list.js"],"names":["INITIAL_INSERTER_RESULTS","PatternsListHeader","filterValue","filteredBlockPatternsLength","PatternList","selectedCategory","patternCategories","debouncedSpeak","speak","destinationRootClientId","onInsertBlocks","shouldFocusBlock","allPatterns","onSelectBlockPattern","registeredPatternCategories","map","patternCategory","name","filteredBlockPatterns","filter","pattern","categories","length","every","category","includes","count","resultsFoundMessage","currentShownPatterns","step","hasItems"],"mappings":";;;;;;;;;AAGA;;AAC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ent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useEffect } from '@wordpress/element';\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { useDebounce, useAsyncList } from '@wordpress/compose';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockPatternsList from '../../block-patterns-list';\nimport InserterNoResults from '../no-results';\nimport useInsertionPoint from '../hooks/use-insertion-point';\nimport usePatternsState from '../hooks/use-patterns-state';\nimport InserterListbox from '../../inserter-listbox';\nimport { searchItems } from '../search-items';\n\nconst INITIAL_INSERTER_RESULTS = 2;\n\nfunction PatternsListHeader( { filterValue, filteredBlockPatternsLength } ) {\n\tif ( ! filterValue ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Heading\n\t\t\tlevel={ 2 }\n\t\t\tlineHeight={ '48px' }\n\t\t\tclassName=\"block-editor-block-patterns-explorer__search-results-count\"\n\t\t>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: %d: number of patterns. %s: block pattern search query */\n\t\t\t\t_n(\n\t\t\t\t\t'%1$d pattern found for \"%2$s\"',\n\t\t\t\t\t'%1$d patterns found for \"%2$s\"',\n\t\t\t\t\tfilteredBlockPatternsLength\n\t\t\t\t),\n\t\t\t\tfilteredBlockPatternsLength,\n\t\t\t\tfilterValue\n\t\t\t) }\n\t\t</Heading>\n\t);\n}\n\nfunction PatternList( { filterValue, selectedCategory, patternCategories } ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( {\n\t\tshouldFocusBlock: true,\n\t} );\n\tconst [ allPatterns, , onSelectBlockPattern ] = usePatternsState(\n\t\tonInsertBlocks,\n\t\tdestinationRootClientId\n\t);\n\n\tconst registeredPatternCategories = useMemo(\n\t\t() =>\n\t\t\tpatternCategories.map(\n\t\t\t\t( patternCategory ) => patternCategory.name\n\t\t\t),\n\t\t[ patternCategories ]\n\t);\n\n\tconst filteredBlockPatterns = useMemo( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn allPatterns.filter( ( pattern ) =>\n\t\t\t\tselectedCategory === 'uncategorized'\n\t\t\t\t\t? ! pattern.categories?.length ||\n\t\t\t\t\t pattern.categories.every(\n\t\t\t\t\t\t\t( category ) =>\n\t\t\t\t\t\t\t\t! registeredPatternCategories.includes(\n\t\t\t\t\t\t\t\t\tcategory\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t )\n\t\t\t\t\t: pattern.categories?.includes( selectedCategory )\n\t\t\t);\n\t\t}\n\t\treturn searchItems( allPatterns, filterValue );\n\t}, [\n\t\tfilterValue,\n\t\tallPatterns,\n\t\tselectedCategory,\n\t\tregisteredPatternCategories,\n\t] );\n\n\t// Announce search results on change.\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = filteredBlockPatterns.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ filterValue, debouncedSpeak, filteredBlockPatterns.length ] );\n\n\tconst currentShownPatterns = useAsyncList( filteredBlockPatterns, {\n\t\tstep: INITIAL_INSERTER_RESULTS,\n\t} );\n\n\tconst hasItems = !! filteredBlockPatterns?.length;\n\treturn (\n\t\t<div className=\"block-editor-block-patterns-explorer__list\">\n\t\t\t{ hasItems && (\n\t\t\t\t<PatternsListHeader\n\t\t\t\t\tfilterValue={ filterValue }\n\t\t\t\t\tfilteredBlockPatternsLength={ filteredBlockPatterns.length }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<InserterListbox>\n\t\t\t\t{ ! hasItems && <InserterNoResults /> }\n\t\t\t\t{ hasItems && (\n\t\t\t\t\t<BlockPatternsList\n\t\t\t\t\t\tshownPatterns={ currentShownPatterns }\n\t\t\t\t\t\tblockPatterns={ filteredBlockPatterns }\n\t\t\t\t\t\tonClickPattern={ onSelectBlockPattern }\n\t\t\t\t\t\tisDraggable={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InserterListbox>\n\t\t</div>\n\t);\n}\n\nexport default PatternList;\n"]}
@@ -19,8 +19,6 @@ var _components = require("@wordpress/components");
19
19
 
20
20
  var _icons = require("@wordpress/icons");
21
21
 
22
- var _blocks = require("@wordpress/blocks");
23
-
24
22
  var _dom = require("@wordpress/dom");
25
23
 
26
24
  var _usePatternsState = _interopRequireDefault(require("./hooks/use-patterns-state"));
@@ -31,8 +29,6 @@ var _explorer = _interopRequireDefault(require("./block-patterns-explorer/explor
31
29
 
32
30
  var _mobileTabNavigation = _interopRequireDefault(require("./mobile-tab-navigation"));
33
31
 
34
- var _useBlockTypesState = _interopRequireDefault(require("./hooks/use-block-types-state"));
35
-
36
32
  /**
37
33
  * WordPress dependencies
38
34
  */
@@ -44,16 +40,10 @@ const noop = () => {}; // Preferred order of pattern categories. Any other categ
44
40
  // be at the bottom without any re-ordering.
45
41
 
46
42
 
47
- const patternCategoriesOrder = ['featured', 'posts', 'text', 'gallery', 'call-to-action', 'banner', 'header', 'footer'];
43
+ const patternCategoriesOrder = ['custom', 'featured', 'posts', 'text', 'gallery', 'call-to-action', 'banner', 'header', 'footer'];
48
44
 
49
45
  function usePatternsCategories(rootClientId) {
50
46
  const [allPatterns, allCategories] = (0, _usePatternsState.default)(undefined, rootClientId);
51
- const [unsyncedPatterns] = (0, _useBlockTypesState.default)(rootClientId, undefined, 'unsynced');
52
- const filteredUnsyncedPatterns = (0, _element.useMemo)(() => {
53
- return unsyncedPatterns.filter(({
54
- category: unsyncedPatternCategory
55
- }) => unsyncedPatternCategory === 'reusable');
56
- }, [unsyncedPatterns]);
57
47
  const hasRegisteredCategory = (0, _element.useCallback)(pattern => {
58
48
  if (!pattern.categories || !pattern.categories.length) {
59
49
  return false;
@@ -84,15 +74,8 @@ function usePatternsCategories(rootClientId) {
84
74
  });
85
75
  }
86
76
 
87
- if (filteredUnsyncedPatterns.length > 0) {
88
- categories.push({
89
- name: 'reusable',
90
- label: (0, _i18n._x)('Custom patterns')
91
- });
92
- }
93
-
94
77
  return categories;
95
- }, [allCategories, allPatterns, filteredUnsyncedPatterns.length, hasRegisteredCategory]);
78
+ }, [allCategories, allPatterns, hasRegisteredCategory]);
96
79
  return populatedCategories;
97
80
  }
98
81
 
@@ -132,16 +115,6 @@ function BlockPatternsCategoryPanel({
132
115
  showTitlesAsTooltip
133
116
  }) {
134
117
  const [allPatterns,, onClick] = (0, _usePatternsState.default)(onInsert, rootClientId);
135
- const [unsyncedPatterns] = (0, _useBlockTypesState.default)(rootClientId, onInsert, 'unsynced');
136
- const filteredUnsyncedPatterns = (0, _element.useMemo)(() => {
137
- return unsyncedPatterns.filter(({
138
- category: unsyncedPatternCategory
139
- }) => unsyncedPatternCategory === 'reusable').map(syncedPattern => ({ ...syncedPattern,
140
- blocks: (0, _blocks.parse)(syncedPattern.content, {
141
- __unstableSkipMigrationLogs: true
142
- })
143
- }));
144
- }, [unsyncedPatterns]);
145
118
  const availableCategories = usePatternsCategories(rootClientId);
146
119
  const currentCategoryPatterns = (0, _element.useMemo)(() => allPatterns.filter(pattern => {
147
120
  var _pattern$categories$f;
@@ -154,13 +127,12 @@ function BlockPatternsCategoryPanel({
154
127
 
155
128
  const availablePatternCategories = (_pattern$categories$f = pattern.categories?.filter(cat => availableCategories.find(availableCategory => availableCategory.name === cat))) !== null && _pattern$categories$f !== void 0 ? _pattern$categories$f : [];
156
129
  return availablePatternCategories.length === 0;
157
- }), [allPatterns, category]);
158
- const patterns = category.name === 'reusable' ? filteredUnsyncedPatterns : currentCategoryPatterns;
159
- const currentShownPatterns = (0, _compose.useAsyncList)(patterns); // Hide block pattern preview on unmount.
130
+ }), [allPatterns, availableCategories, category.name]);
131
+ const categoryPatternsList = (0, _compose.useAsyncList)(currentCategoryPatterns); // Hide block pattern preview on unmount.
160
132
 
161
133
  (0, _element.useEffect)(() => () => onHover(null), []);
162
134
 
163
- if (!currentCategoryPatterns.length && !filteredUnsyncedPatterns.length) {
135
+ if (!currentCategoryPatterns.length) {
164
136
  return null;
165
137
  }
166
138
 
@@ -169,8 +141,8 @@ function BlockPatternsCategoryPanel({
169
141
  }, (0, _element.createElement)("div", {
170
142
  className: "block-editor-inserter__patterns-category-panel-title"
171
143
  }, category.label), (0, _element.createElement)("p", null, category.description), (0, _element.createElement)(_blockPatternsList.default, {
172
- shownPatterns: currentShownPatterns,
173
- blockPatterns: patterns,
144
+ shownPatterns: categoryPatternsList,
145
+ blockPatterns: currentCategoryPatterns,
174
146
  onClickPattern: onClick,
175
147
  onHover: onHover,
176
148
  label: category.label,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/block-patterns-tab.js"],"names":["noop","patternCategoriesOrder","usePatternsCategories","rootClientId","allPatterns","allCategories","undefined","unsyncedPatterns","filteredUnsyncedPatterns","filter","category","unsyncedPatternCategory","hasRegisteredCategory","pattern","categories","length","some","cat","name","populatedCategories","includes","sort","aName","bName","aIndex","indexOf","bIndex","find","push","label","BlockPatternsCategoryDialog","onInsert","onHover","showTitlesAsTooltip","container","timeout","setTimeout","firstTabbable","focus","tabbable","current","clearTimeout","BlockPatternsCategoryPanel","onClick","map","syncedPattern","blocks","content","__unstableSkipMigrationLogs","availableCategories","currentCategoryPatterns","availablePatternCategories","availableCategory","patterns","currentShownPatterns","description","BlockPatternsTabs","onSelectCategory","selectedCategory","showPatternsExplorer","setShowPatternsExplorer","initialCategory","isMobile","chevronLeft","chevronRight"],"mappings":";;;;;;;;;;;AAGA;;AAOA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AA9BA;AACA;AACA;;AAqBA;AACA;AACA;AAOA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB,C,CAEA;AACA;;;AACA,MAAMC,sBAAsB,GAAG,CAC9B,UAD8B,EAE9B,OAF8B,E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gD,gBAAb,GACG,MADH,GAEGpD;AAfL,KAkBC,4BAAC,gCAAD,QACC,4BAAC,qBAAD,QACGI,QAAQ,CAACmB,KADZ,CADD,EAIC,4BAAC,WAAD;AACC,IAAA,IAAI,EACH,qBACGkC,kBADH,GAEGC;AAJL,IAJD,CAlBD,CADC,CAJH,EAqCC;AAAK,IAAA,IAAI,EAAC;AAAV,KACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,gDADX;AAEC,IAAA,OAAO,EAAG,MACTJ,uBAAuB,CAAE,IAAF,CAHzB;AAKC,IAAA,OAAO,EAAC;AALT,KAOG,cAAI,sBAAJ,CAPH,CADD,CArCD,CADD,CADD,CAFF,EAwDGE,QAAQ,IACT,4BAAC,4BAAD;AAAqB,IAAA,UAAU,EAAGhD;AAAlC,KACKJ,QAAF,IACD,4BAAC,0BAAD;AACC,IAAA,QAAQ,EAAGqB,QADZ;AAEC,IAAA,YAAY,EAAG5B,YAFhB;AAGC,IAAA,QAAQ,EAAGO,QAHZ;AAIC,IAAA,mBAAmB,EAAG;AAJvB,IAFF,CAzDF,EAoEGiD,oBAAoB,IACrB,4BAAC,iBAAD;AACC,IAAA,eAAe,EAAGE,eADnB;AAEC,IAAA,iBAAiB,EAAG/C,UAFrB;AAGC,IAAA,YAAY,EAAG,MAAM8C,uBAAuB,CAAE,KAAF;AAH7C,IArEF,CADD;AA8EA;;eAEcJ,iB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseMemo,\n\tuseState,\n\tuseCallback,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { _x, __, isRTL } 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, chevronLeft } from '@wordpress/icons';\nimport { parse } from '@wordpress/blocks';\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';\nimport useBlockTypesState from './hooks/use-block-types-state';\n\nconst noop = () => {};\n\n// Preferred order of pattern categories. Any other categories should\n// be at the bottom without any re-ordering.\nconst patternCategoriesOrder = [\n\t'featured',\n\t'posts',\n\t'text',\n\t'gallery',\n\t'call-to-action',\n\t'banner',\n\t'header',\n\t'footer',\n];\n\nfunction usePatternsCategories( rootClientId ) {\n\tconst [ allPatterns, allCategories ] = usePatternsState(\n\t\tundefined,\n\t\trootClientId\n\t);\n\n\tconst [ unsyncedPatterns ] = useBlockTypesState(\n\t\trootClientId,\n\t\tundefined,\n\t\t'unsynced'\n\t);\n\n\tconst filteredUnsyncedPatterns = useMemo( () => {\n\t\treturn unsyncedPatterns.filter(\n\t\t\t( { category: unsyncedPatternCategory } ) =>\n\t\t\t\tunsyncedPatternCategory === 'reusable'\n\t\t);\n\t}, [ unsyncedPatterns ] );\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: aName }, { name: bName } ) => {\n\t\t\t\t// Sort categories according to `patternCategoriesOrder`.\n\t\t\t\tlet aIndex = patternCategoriesOrder.indexOf( aName );\n\t\t\t\tlet bIndex = patternCategoriesOrder.indexOf( bName );\n\t\t\t\t// All other categories should come after that.\n\t\t\t\tif ( aIndex < 0 ) aIndex = patternCategoriesOrder.length;\n\t\t\t\tif ( bIndex < 0 ) bIndex = patternCategoriesOrder.length;\n\t\t\t\treturn aIndex - bIndex;\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\t\tif ( filteredUnsyncedPatterns.length > 0 ) {\n\t\t\tcategories.push( {\n\t\t\t\tname: 'reusable',\n\t\t\t\tlabel: _x( 'Custom patterns' ),\n\t\t\t} );\n\t\t}\n\n\t\treturn categories;\n\t}, [\n\t\tallCategories,\n\t\tallPatterns,\n\t\tfilteredUnsyncedPatterns.length,\n\t\thasRegisteredCategory,\n\t] );\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 = noop,\n\tcategory,\n\tshowTitlesAsTooltip,\n} ) {\n\tconst [ allPatterns, , onClick ] = usePatternsState(\n\t\tonInsert,\n\t\trootClientId\n\t);\n\tconst [ unsyncedPatterns ] = useBlockTypesState(\n\t\trootClientId,\n\t\tonInsert,\n\t\t'unsynced'\n\t);\n\tconst filteredUnsyncedPatterns = useMemo( () => {\n\t\treturn unsyncedPatterns\n\t\t\t.filter(\n\t\t\t\t( { category: unsyncedPatternCategory } ) =>\n\t\t\t\t\tunsyncedPatternCategory === 'reusable'\n\t\t\t)\n\t\t\t.map( ( syncedPattern ) => ( {\n\t\t\t\t...syncedPattern,\n\t\t\t\tblocks: parse( syncedPattern.content, {\n\t\t\t\t\t__unstableSkipMigrationLogs: true,\n\t\t\t\t} ),\n\t\t\t} ) );\n\t}, [ unsyncedPatterns ] );\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\tconst patterns =\n\t\tcategory.name === 'reusable'\n\t\t\t? filteredUnsyncedPatterns\n\t\t\t: currentCategoryPatterns;\n\tconst currentShownPatterns = useAsyncList( patterns );\n\n\t// Hide block pattern preview on unmount.\n\tuseEffect( () => () => onHover( null ), [] );\n\n\tif (\n\t\t! currentCategoryPatterns.length &&\n\t\t! filteredUnsyncedPatterns.length\n\t) {\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={ patterns }\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 initialCategory = selectedCategory || categories[ 0 ];\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\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\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</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={ initialCategory }\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":["noop","patternCategoriesOrder","usePatternsCategories","rootClientId","allPatterns","allCategories","undefined","hasRegisteredCategory","pattern","categories","length","some","cat","category","name","populatedCategories","filter","includes","sort","aName","bName","aIndex","indexOf","bIndex","find","push","label","BlockPatternsCategoryDialog","onInsert","onHover","showTitlesAsTooltip","container","timeout","setTimeout","firstTabbable","focus","tabbable","current","clearTimeout","BlockPatternsCategoryPanel","onClick","availableCategories","currentCategoryPatterns","availablePatternCategories","availableCategory","categoryPatternsList","description","BlockPatternsTabs","onSelectCategory","selectedCategory","showPatternsExplorer","setShowPatternsExplorer","initialCategory","isMobile","map","chevronLeft","chevronRight"],"mappings":";;;;;;;;;;;AAGA;;AAOA;;AACA;;AACA;;AAOA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;;A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seEffect,\n} from '@wordpress/element';\nimport { _x, __, isRTL } 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, chevronLeft } 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\nconst noop = () => {};\n\n// Preferred order of pattern categories. Any other categories should\n// be at the bottom without any re-ordering.\nconst patternCategoriesOrder = [\n\t'custom',\n\t'featured',\n\t'posts',\n\t'text',\n\t'gallery',\n\t'call-to-action',\n\t'banner',\n\t'header',\n\t'footer',\n];\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: aName }, { name: bName } ) => {\n\t\t\t\t// Sort categories according to `patternCategoriesOrder`.\n\t\t\t\tlet aIndex = patternCategoriesOrder.indexOf( aName );\n\t\t\t\tlet bIndex = patternCategoriesOrder.indexOf( bName );\n\t\t\t\t// All other categories should come after that.\n\t\t\t\tif ( aIndex < 0 ) aIndex = patternCategoriesOrder.length;\n\t\t\t\tif ( bIndex < 0 ) bIndex = patternCategoriesOrder.length;\n\t\t\t\treturn aIndex - bIndex;\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}, [ allCategories, allPatterns, hasRegisteredCategory ] );\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 = noop,\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, availableCategories, category.name ]\n\t);\n\n\tconst categoryPatternsList = 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={ categoryPatternsList }\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 initialCategory = selectedCategory || categories[ 0 ];\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\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\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</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={ initialCategory }\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"]}
@@ -26,10 +26,9 @@ var _store = require("../../../store");
26
26
  *
27
27
  * @param {string=} rootClientId Insertion's root client ID.
28
28
  * @param {Function} onInsert function called when inserter a list of blocks.
29
- * @param {?string} syncStatus Optional sync status to filter pattern blocks by.
30
29
  * @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler)
31
30
  */
32
- const useBlockTypesState = (rootClientId, onInsert, syncStatus) => {
31
+ const useBlockTypesState = (rootClientId, onInsert) => {
33
32
  const {
34
33
  categories,
35
34
  collections,
@@ -45,9 +44,9 @@ const useBlockTypesState = (rootClientId, onInsert, syncStatus) => {
45
44
  return {
46
45
  categories: getCategories(),
47
46
  collections: getCollections(),
48
- items: getInserterItems(rootClientId, syncStatus)
47
+ items: getInserterItems(rootClientId)
49
48
  };
50
- }, [rootClientId, syncStatus]);
49
+ }, [rootClientId]);
51
50
  const onSelectItem = (0, _element.useCallback)(({
52
51
  name,
53
52
  initialAttributes,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/hooks/use-block-types-state.js"],"names":["useBlockTypesState","rootClientId","onInsert","syncStatus","categories","collections","items","select","getInserterItems","blockEditorStore","getCategories","getCollections","blocksStore","onSelectItem","name","initialAttributes","innerBlocks","shouldFocusBlock","insertedBlock","undefined"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AASA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,kBAAkB,GAAG,CAAEC,YAAF,EAAgBC,QAAhB,EAA0BC,UAA1B,KAA0C;AACpE,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,WAAd;AAA2BC,IAAAA;AAA3B,MAAqC,qBACxCC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAuBD,MAAM,CAAEE,YAAF,CAAnC;AACA,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,QAAoCJ,MAAM,CAAEK,aAAF,CAAhD;AAEA,WAAO;AACNR,MAAAA,UAAU,EAAEM,aAAa,EADnB;AAENL,MAAAA,WAAW,EAAEM,cAAc,EAFrB;AAGNL,MAAAA,KAAK,EAAEE,gBAAgB,CAAEP,YAAF,EAAgBE,UAAhB;AAHjB,KAAP;AAKA,GAVyC,EAW1C,CAAEF,YAAF,EAAgBE,UAAhB,CAX0C,CAA3C;AAcA,QAAMU,YAAY,GAAG,0BACpB,CAAE;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,iBAAR;AAA2BC,IAAAA;AAA3B,GAAF,EAA4CC,gBAA5C,KAAkE;AACjE,UAAMC,aAAa,GAAG,yBACrBJ,IADqB,EAErBC,iBAFqB,EAGrB,iDAAqCC,WAArC,CAHqB,CAAtB;AAMAd,IAAAA,QAAQ,CAAEgB,aAAF,EAAiBC,SAAjB,EAA4BF,gBAA5B,CAAR;AACA,GATmB,EAUpB,CAAEf,QAAF,CAVoB,CAArB;AAaA,SAAO,CAAEI,KAAF,EAASF,UAAT,EAAqBC,WAArB,EAAkCQ,YAAlC,CAAP;AACA,CA7BD;;eA+Beb,kB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Retrieves the block types inserter state.\n *\n * @param {string=} rootClientId Insertion's root client ID.\n * @param {Function} onInsert function called when inserter a list of blocks.\n * @param {?string} syncStatus Optional sync status to filter pattern blocks by.\n * @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler)\n */\nconst useBlockTypesState = ( rootClientId, onInsert, syncStatus ) => {\n\tconst { categories, collections, items } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getInserterItems } = select( blockEditorStore );\n\t\t\tconst { getCategories, getCollections } = select( blocksStore );\n\n\t\t\treturn {\n\t\t\t\tcategories: getCategories(),\n\t\t\t\tcollections: getCollections(),\n\t\t\t\titems: getInserterItems( rootClientId, syncStatus ),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId, syncStatus ]\n\t);\n\n\tconst onSelectItem = useCallback(\n\t\t( { name, initialAttributes, innerBlocks }, shouldFocusBlock ) => {\n\t\t\tconst insertedBlock = createBlock(\n\t\t\t\tname,\n\t\t\t\tinitialAttributes,\n\t\t\t\tcreateBlocksFromInnerBlocksTemplate( innerBlocks )\n\t\t\t);\n\n\t\t\tonInsert( insertedBlock, undefined, shouldFocusBlock );\n\t\t},\n\t\t[ onInsert ]\n\t);\n\n\treturn [ items, categories, collections, onSelectItem ];\n};\n\nexport default useBlockTypesState;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/hooks/use-block-types-state.js"],"names":["useBlockTypesState","rootClientId","onInsert","categories","collections","items","select","getInserterItems","blockEditorStore","getCategories","getCollections","blocksStore","onSelectItem","name","initialAttributes","innerBlocks","shouldFocusBlock","insertedBlock","undefined"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AASA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,kBAAkB,GAAG,CAAEC,YAAF,EAAgBC,QAAhB,KAA8B;AACxD,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,WAAd;AAA2BC,IAAAA;AAA3B,MAAqC,qBACxCC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAuBD,MAAM,CAAEE,YAAF,CAAnC;AACA,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,QAAoCJ,MAAM,CAAEK,aAAF,CAAhD;AAEA,WAAO;AACNR,MAAAA,UAAU,EAAEM,aAAa,EADnB;AAENL,MAAAA,WAAW,EAAEM,cAAc,EAFrB;AAGNL,MAAAA,KAAK,EAAEE,gBAAgB,CAAEN,YAAF;AAHjB,KAAP;AAKA,GAVyC,EAW1C,CAAEA,YAAF,CAX0C,CAA3C;AAcA,QAAMW,YAAY,GAAG,0BACpB,CAAE;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,iBAAR;AAA2BC,IAAAA;AAA3B,GAAF,EAA4CC,gBAA5C,KAAkE;AACjE,UAAMC,aAAa,GAAG,yBACrBJ,IADqB,EAErBC,iBAFqB,EAGrB,iDAAqCC,WAArC,CAHqB,CAAtB;AAMAb,IAAAA,QAAQ,CAAEe,aAAF,EAAiBC,SAAjB,EAA4BF,gBAA5B,CAAR;AACA,GATmB,EAUpB,CAAEd,QAAF,CAVoB,CAArB;AAaA,SAAO,CAAEG,KAAF,EAASF,UAAT,EAAqBC,WAArB,EAAkCQ,YAAlC,CAAP;AACA,CA7BD;;eA+BeZ,kB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../../store';\n\n/**\n * Retrieves the block types inserter state.\n *\n * @param {string=} rootClientId Insertion's root client ID.\n * @param {Function} onInsert function called when inserter a list of blocks.\n * @return {Array} Returns the block types state. (block types, categories, collections, onSelect handler)\n */\nconst useBlockTypesState = ( rootClientId, onInsert ) => {\n\tconst { categories, collections, items } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getInserterItems } = select( blockEditorStore );\n\t\t\tconst { getCategories, getCollections } = select( blocksStore );\n\n\t\t\treturn {\n\t\t\t\tcategories: getCategories(),\n\t\t\t\tcollections: getCollections(),\n\t\t\t\titems: getInserterItems( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\tconst onSelectItem = useCallback(\n\t\t( { name, initialAttributes, innerBlocks }, shouldFocusBlock ) => {\n\t\t\tconst insertedBlock = createBlock(\n\t\t\t\tname,\n\t\t\t\tinitialAttributes,\n\t\t\t\tcreateBlocksFromInnerBlocksTemplate( innerBlocks )\n\t\t\t);\n\n\t\t\tonInsert( insertedBlock, undefined, shouldFocusBlock );\n\t\t},\n\t\t[ onInsert ]\n\t);\n\n\treturn [ items, categories, collections, onSelectItem ];\n};\n\nexport default useBlockTypesState;\n"]}
@@ -24,7 +24,11 @@ var _store = require("../../../store");
24
24
  /**
25
25
  * Internal dependencies
26
26
  */
27
-
27
+ const CUSTOM_CATEGORY = {
28
+ name: 'custom',
29
+ label: (0, _i18n.__)('My patterns'),
30
+ description: (0, _i18n.__)('Custom patterns add by site users')
31
+ };
28
32
  /**
29
33
  * Retrieves the block patterns inserter state.
30
34
  *
@@ -33,6 +37,7 @@ var _store = require("../../../store");
33
37
  *
34
38
  * @return {Array} Returns the patterns state. (patterns, categories, onSelect handler)
35
39
  */
40
+
36
41
  const usePatternsState = (onInsert, rootClientId) => {
37
42
  const {
38
43
  patternCategories,
@@ -47,6 +52,7 @@ const usePatternsState = (onInsert, rootClientId) => {
47
52
  patternCategories: getSettings().__experimentalBlockPatternCategories
48
53
  };
49
54
  }, [rootClientId]);
55
+ const allCategories = (0, _element.useMemo)(() => [...patternCategories, CUSTOM_CATEGORY], [patternCategories]);
50
56
  const {
51
57
  createSuccessNotice
52
58
  } = (0, _data.useDispatch)(_notices.store);
@@ -57,8 +63,8 @@ const usePatternsState = (onInsert, rootClientId) => {
57
63
  (0, _i18n.__)('Block pattern "%s" inserted.'), pattern.title), {
58
64
  type: 'snackbar'
59
65
  });
60
- }, []);
61
- return [patterns, patternCategories, onClickPattern];
66
+ }, [createSuccessNotice, onInsert]);
67
+ return [patterns, allCategories, onClickPattern];
62
68
  };
63
69
 
64
70
  var _default = usePatternsState;
@@ -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","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"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/inserter/hooks/use-patterns-state.js"],"names":["CUSTOM_CATEGORY","name","label","description","usePatternsState","onInsert","rootClientId","patternCategories","patterns","select","__experimentalGetAllowedPatterns","getSettings","blockEditorStore","__experimentalBlockPatternCategories","allCategories","createSuccessNotice","noticesStore","onClickPattern","pattern","blocks","map","block","title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AE;AADP,KANkB,CAAnB;AAUA,GAhBqB,EAiBtB,CAAER,mBAAF,EAAuBV,QAAvB,CAjBsB,CAAvB;AAoBA,SAAO,CAAEG,QAAF,EAAYM,aAAZ,EAA2BG,cAA3B,CAAP;AACA,CA1CD;;eA4Ceb,gB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo } 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\nconst CUSTOM_CATEGORY = {\n\tname: 'custom',\n\tlabel: __( 'My patterns' ),\n\tdescription: __( 'Custom patterns add by site users' ),\n};\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\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\n\tconst allCategories = useMemo(\n\t\t() => [ ...patternCategories, CUSTOM_CATEGORY ],\n\t\t[ patternCategories ]\n\t);\n\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst onClickPattern = useCallback(\n\t\t( pattern, blocks ) => {\n\t\t\tonInsert(\n\t\t\t\t( blocks ?? [] ).map( ( block ) => cloneBlock( block ) ),\n\t\t\t\tpattern.name\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: block pattern title. */\n\t\t\t\t\t__( 'Block pattern \"%s\" inserted.' ),\n\t\t\t\t\tpattern.title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t\t[ createSuccessNotice, onInsert ]\n\t);\n\n\treturn [ patterns, allCategories, onClickPattern ];\n};\n\nexport default usePatternsState;\n"]}
@@ -249,7 +249,7 @@ const ComposedPrivateInserter = (0, _compose.compose)([(0, _data.withSelect)((se
249
249
  getBlockRootClientId,
250
250
  hasInserterItems,
251
251
  getAllowedBlocks,
252
- __experimentalGetDirectInsertBlock,
252
+ getDirectInsertBlock,
253
253
  getSettings
254
254
  } = select(_store.store);
255
255
  const {
@@ -257,9 +257,7 @@ const ComposedPrivateInserter = (0, _compose.compose)([(0, _data.withSelect)((se
257
257
  } = select(_blocks.store);
258
258
  rootClientId = rootClientId || getBlockRootClientId(clientId) || undefined;
259
259
  const allowedBlocks = getAllowedBlocks(rootClientId);
260
-
261
- const directInsertBlock = shouldDirectInsert && __experimentalGetDirectInsertBlock(rootClientId);
262
-
260
+ const directInsertBlock = shouldDirectInsert && getDirectInsertBlock(rootClientId);
263
261
  const settings = getSettings();
264
262
  const hasSingleBlockType = allowedBlocks?.length === 1 && getBlockVariations(allowedBlocks[0].name, 'inserter')?.length === 0;
265
263
  let allowedBlockType = false;