@wordpress/block-editor 15.11.0 → 15.12.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 (393) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-breadcrumb/index.cjs +10 -2
  3. package/build/components/block-breadcrumb/index.cjs.map +2 -2
  4. package/build/components/block-controls/index.cjs +1 -1
  5. package/build/components/block-controls/index.cjs.map +2 -2
  6. package/build/components/block-inspector/index.cjs +8 -21
  7. package/build/components/block-inspector/index.cjs.map +3 -3
  8. package/build/components/block-list/block.cjs +6 -3
  9. package/build/components/block-list/block.cjs.map +3 -3
  10. package/build/components/block-list/index.cjs +26 -18
  11. package/build/components/block-list/index.cjs.map +2 -2
  12. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs +39 -19
  13. package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs.map +2 -2
  14. package/build/components/block-list/use-in-between-inserter.cjs +4 -4
  15. package/build/components/block-list/use-in-between-inserter.cjs.map +2 -2
  16. package/build/components/block-settings-menu/block-settings-dropdown.cjs +10 -7
  17. package/build/components/block-settings-menu/block-settings-dropdown.cjs.map +2 -2
  18. package/build/components/block-settings-menu-controls/edit-section-menu-item.cjs +1 -1
  19. package/build/components/block-settings-menu-controls/edit-section-menu-item.cjs.map +2 -2
  20. package/build/components/block-settings-menu-controls/index.cjs +11 -16
  21. package/build/components/block-settings-menu-controls/index.cjs.map +2 -2
  22. package/build/components/block-toolbar/block-toolbar-icon.cjs +6 -4
  23. package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
  24. package/build/components/block-toolbar/index.cjs +2 -2
  25. package/build/components/block-toolbar/index.cjs.map +2 -2
  26. package/build/components/block-tools/index.cjs +2 -26
  27. package/build/components/block-tools/index.cjs.map +2 -2
  28. package/build/components/block-variation-transforms/index.cjs +1 -2
  29. package/build/components/block-variation-transforms/index.cjs.map +2 -2
  30. package/build/components/block-visibility/index.cjs +7 -9
  31. package/build/components/block-visibility/index.cjs.map +3 -3
  32. package/build/components/block-visibility/modal.cjs +18 -103
  33. package/build/components/block-visibility/modal.cjs.map +2 -2
  34. package/build/components/block-visibility/use-block-visibility.cjs +1 -1
  35. package/build/components/block-visibility/use-block-visibility.cjs.map +2 -2
  36. package/build/components/block-visibility/utils.cjs +5 -1
  37. package/build/components/block-visibility/utils.cjs.map +2 -2
  38. package/build/components/block-visibility/viewport-menu-item.cjs +11 -4
  39. package/build/components/block-visibility/viewport-menu-item.cjs.map +2 -2
  40. package/build/components/block-visibility/viewport-toolbar.cjs +4 -6
  41. package/build/components/block-visibility/viewport-toolbar.cjs.map +2 -2
  42. package/build/components/block-visibility/viewport-visibility-info.cjs +121 -0
  43. package/build/components/block-visibility/viewport-visibility-info.cjs.map +7 -0
  44. package/build/components/color-palette/with-color-context.cjs +1 -1
  45. package/build/components/color-palette/with-color-context.cjs.map +2 -2
  46. package/build/components/color-style-selector/index.cjs +1 -1
  47. package/build/components/color-style-selector/index.cjs.map +2 -2
  48. package/build/components/colors/with-colors.cjs +5 -3
  49. package/build/components/colors/with-colors.cjs.map +2 -2
  50. package/build/components/colors-gradients/dropdown.cjs +1 -1
  51. package/build/components/colors-gradients/dropdown.cjs.map +2 -2
  52. package/build/components/editable-text/index.cjs +5 -1
  53. package/build/components/editable-text/index.cjs.map +2 -2
  54. package/build/components/font-sizes/with-font-sizes.cjs +5 -3
  55. package/build/components/font-sizes/with-font-sizes.cjs.map +2 -2
  56. package/build/components/global-styles/advanced-panel.cjs +26 -13
  57. package/build/components/global-styles/advanced-panel.cjs.map +2 -2
  58. package/build/components/global-styles/filters-panel.cjs +1 -1
  59. package/build/components/global-styles/filters-panel.cjs.map +2 -2
  60. package/build/components/global-styles/shadow-panel-components.cjs +1 -1
  61. package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
  62. package/build/components/gradients/with-gradient.cjs +1 -1
  63. package/build/components/gradients/with-gradient.cjs.map +2 -2
  64. package/build/components/inserter/index.cjs +1 -0
  65. package/build/components/inserter/index.cjs.map +2 -2
  66. package/build/components/inspector-controls/fill.cjs +12 -2
  67. package/build/components/inspector-controls/fill.cjs.map +2 -2
  68. package/build/components/inspector-controls/index.cjs +1 -1
  69. package/build/components/inspector-controls/index.cjs.map +2 -2
  70. package/build/components/inspector-controls-tabs/index.cjs +3 -3
  71. package/build/components/inspector-controls-tabs/index.cjs.map +3 -3
  72. package/build/components/inspector-controls-tabs/styles-tab.cjs +1 -1
  73. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  74. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +2 -2
  75. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
  76. package/build/components/list-view/block-select-button.cjs +8 -16
  77. package/build/components/list-view/block-select-button.cjs.map +2 -2
  78. package/build/components/list-view/block.cjs +29 -34
  79. package/build/components/list-view/block.cjs.map +3 -3
  80. package/build/components/list-view/utils.cjs +3 -1
  81. package/build/components/list-view/utils.cjs.map +2 -2
  82. package/build/components/media-replace-flow/index.cjs +2 -2
  83. package/build/components/media-replace-flow/index.cjs.map +2 -2
  84. package/build/components/provider/index.cjs +7 -8
  85. package/build/components/provider/index.cjs.map +2 -2
  86. package/build/components/provider/with-registry-provider.cjs +1 -1
  87. package/build/components/provider/with-registry-provider.cjs.map +2 -2
  88. package/build/components/rich-text/index.cjs +1 -1
  89. package/build/components/rich-text/index.cjs.map +2 -2
  90. package/build/components/use-block-commands/index.cjs +2 -34
  91. package/build/components/use-block-commands/index.cjs.map +2 -2
  92. package/build/components/use-block-display-information/index.cjs +1 -1
  93. package/build/components/use-block-display-information/index.cjs.map +2 -2
  94. package/build/components/writing-flow/index.cjs +2 -0
  95. package/build/components/writing-flow/index.cjs.map +2 -2
  96. package/build/components/writing-flow/use-arrow-nav.cjs +3 -0
  97. package/build/components/writing-flow/use-arrow-nav.cjs.map +2 -2
  98. package/build/components/writing-flow/use-drag-selection.cjs +2 -1
  99. package/build/components/writing-flow/use-drag-selection.cjs.map +2 -2
  100. package/build/components/writing-flow/use-preview-mode-nav.cjs +92 -0
  101. package/build/components/writing-flow/use-preview-mode-nav.cjs.map +7 -0
  102. package/build/hooks/block-renaming.cjs +1 -1
  103. package/build/hooks/block-renaming.cjs.map +2 -2
  104. package/build/hooks/cross-origin-isolation.cjs +1 -1
  105. package/build/hooks/cross-origin-isolation.cjs.map +2 -2
  106. package/build/hooks/custom-css.cjs +141 -0
  107. package/build/hooks/custom-css.cjs.map +7 -0
  108. package/build/hooks/fit-text.cjs +14 -7
  109. package/build/hooks/fit-text.cjs.map +2 -2
  110. package/build/hooks/grid-visualizer.cjs +1 -1
  111. package/build/hooks/grid-visualizer.cjs.map +2 -2
  112. package/build/hooks/index.cjs +4 -2
  113. package/build/hooks/index.cjs.map +3 -3
  114. package/build/hooks/layout.cjs +10 -4
  115. package/build/hooks/layout.cjs.map +2 -2
  116. package/build/hooks/list-view.cjs +9 -5
  117. package/build/hooks/list-view.cjs.map +3 -3
  118. package/build/hooks/utils.cjs +2 -2
  119. package/build/hooks/utils.cjs.map +2 -2
  120. package/build/layouts/grid.cjs +12 -1
  121. package/build/layouts/grid.cjs.map +2 -2
  122. package/build/store/actions.cjs +5 -0
  123. package/build/store/actions.cjs.map +2 -2
  124. package/build/store/defaults.cjs +3 -0
  125. package/build/store/defaults.cjs.map +2 -2
  126. package/build/store/private-selectors.cjs +46 -38
  127. package/build/store/private-selectors.cjs.map +2 -2
  128. package/build/store/reducer.cjs +5 -7
  129. package/build/store/reducer.cjs.map +2 -2
  130. package/build/store/selectors.cjs +15 -0
  131. package/build/store/selectors.cjs.map +2 -2
  132. package/build/utils/fit-text-utils.cjs +18 -4
  133. package/build/utils/fit-text-utils.cjs.map +2 -2
  134. package/build-module/components/block-breadcrumb/index.mjs +10 -2
  135. package/build-module/components/block-breadcrumb/index.mjs.map +2 -2
  136. package/build-module/components/block-controls/index.mjs +1 -1
  137. package/build-module/components/block-controls/index.mjs.map +2 -2
  138. package/build-module/components/block-inspector/index.mjs +8 -21
  139. package/build-module/components/block-inspector/index.mjs.map +2 -2
  140. package/build-module/components/block-list/block.mjs +6 -3
  141. package/build-module/components/block-list/block.mjs.map +3 -3
  142. package/build-module/components/block-list/index.mjs +26 -18
  143. package/build-module/components/block-list/index.mjs.map +2 -2
  144. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs +39 -19
  145. package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs.map +2 -2
  146. package/build-module/components/block-list/use-in-between-inserter.mjs +4 -4
  147. package/build-module/components/block-list/use-in-between-inserter.mjs.map +2 -2
  148. package/build-module/components/block-settings-menu/block-settings-dropdown.mjs +10 -7
  149. package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
  150. package/build-module/components/block-settings-menu-controls/edit-section-menu-item.mjs +1 -1
  151. package/build-module/components/block-settings-menu-controls/edit-section-menu-item.mjs.map +2 -2
  152. package/build-module/components/block-settings-menu-controls/index.mjs +12 -17
  153. package/build-module/components/block-settings-menu-controls/index.mjs.map +2 -2
  154. package/build-module/components/block-toolbar/block-toolbar-icon.mjs +6 -4
  155. package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
  156. package/build-module/components/block-toolbar/index.mjs +3 -3
  157. package/build-module/components/block-toolbar/index.mjs.map +2 -2
  158. package/build-module/components/block-tools/index.mjs +2 -26
  159. package/build-module/components/block-tools/index.mjs.map +2 -2
  160. package/build-module/components/block-variation-transforms/index.mjs +1 -2
  161. package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
  162. package/build-module/components/block-visibility/index.mjs +6 -9
  163. package/build-module/components/block-visibility/index.mjs.map +2 -2
  164. package/build-module/components/block-visibility/modal.mjs +18 -103
  165. package/build-module/components/block-visibility/modal.mjs.map +2 -2
  166. package/build-module/components/block-visibility/use-block-visibility.mjs +1 -1
  167. package/build-module/components/block-visibility/use-block-visibility.mjs.map +2 -2
  168. package/build-module/components/block-visibility/utils.mjs +5 -1
  169. package/build-module/components/block-visibility/utils.mjs.map +2 -2
  170. package/build-module/components/block-visibility/viewport-menu-item.mjs +11 -4
  171. package/build-module/components/block-visibility/viewport-menu-item.mjs.map +2 -2
  172. package/build-module/components/block-visibility/viewport-toolbar.mjs +4 -6
  173. package/build-module/components/block-visibility/viewport-toolbar.mjs.map +2 -2
  174. package/build-module/components/block-visibility/viewport-visibility-info.mjs +95 -0
  175. package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +7 -0
  176. package/build-module/components/color-palette/with-color-context.mjs +1 -1
  177. package/build-module/components/color-palette/with-color-context.mjs.map +2 -2
  178. package/build-module/components/color-style-selector/index.mjs +1 -1
  179. package/build-module/components/color-style-selector/index.mjs.map +2 -2
  180. package/build-module/components/colors/with-colors.mjs +5 -3
  181. package/build-module/components/colors/with-colors.mjs.map +2 -2
  182. package/build-module/components/colors-gradients/dropdown.mjs +1 -1
  183. package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
  184. package/build-module/components/editable-text/index.mjs +5 -1
  185. package/build-module/components/editable-text/index.mjs.map +2 -2
  186. package/build-module/components/font-sizes/with-font-sizes.mjs +5 -3
  187. package/build-module/components/font-sizes/with-font-sizes.mjs.map +2 -2
  188. package/build-module/components/global-styles/advanced-panel.mjs +22 -13
  189. package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
  190. package/build-module/components/global-styles/filters-panel.mjs +1 -1
  191. package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
  192. package/build-module/components/global-styles/shadow-panel-components.mjs +1 -1
  193. package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
  194. package/build-module/components/gradients/with-gradient.mjs +1 -1
  195. package/build-module/components/gradients/with-gradient.mjs.map +2 -2
  196. package/build-module/components/inserter/index.mjs +1 -0
  197. package/build-module/components/inserter/index.mjs.map +2 -2
  198. package/build-module/components/inspector-controls/fill.mjs +12 -2
  199. package/build-module/components/inspector-controls/fill.mjs.map +2 -2
  200. package/build-module/components/inspector-controls/index.mjs +1 -1
  201. package/build-module/components/inspector-controls/index.mjs.map +2 -2
  202. package/build-module/components/inspector-controls-tabs/index.mjs +3 -3
  203. package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
  204. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +1 -1
  205. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  206. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +2 -2
  207. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
  208. package/build-module/components/list-view/block-select-button.mjs +8 -16
  209. package/build-module/components/list-view/block-select-button.mjs.map +2 -2
  210. package/build-module/components/list-view/block.mjs +31 -36
  211. package/build-module/components/list-view/block.mjs.map +2 -2
  212. package/build-module/components/list-view/utils.mjs +3 -1
  213. package/build-module/components/list-view/utils.mjs.map +2 -2
  214. package/build-module/components/media-replace-flow/index.mjs +2 -2
  215. package/build-module/components/media-replace-flow/index.mjs.map +2 -2
  216. package/build-module/components/provider/index.mjs +7 -8
  217. package/build-module/components/provider/index.mjs.map +2 -2
  218. package/build-module/components/provider/with-registry-provider.mjs +1 -1
  219. package/build-module/components/provider/with-registry-provider.mjs.map +2 -2
  220. package/build-module/components/rich-text/index.mjs +1 -1
  221. package/build-module/components/rich-text/index.mjs.map +2 -2
  222. package/build-module/components/use-block-commands/index.mjs +3 -37
  223. package/build-module/components/use-block-commands/index.mjs.map +2 -2
  224. package/build-module/components/use-block-display-information/index.mjs +1 -1
  225. package/build-module/components/use-block-display-information/index.mjs.map +2 -2
  226. package/build-module/components/writing-flow/index.mjs +2 -0
  227. package/build-module/components/writing-flow/index.mjs.map +2 -2
  228. package/build-module/components/writing-flow/use-arrow-nav.mjs +3 -0
  229. package/build-module/components/writing-flow/use-arrow-nav.mjs.map +2 -2
  230. package/build-module/components/writing-flow/use-drag-selection.mjs +2 -1
  231. package/build-module/components/writing-flow/use-drag-selection.mjs.map +2 -2
  232. package/build-module/components/writing-flow/use-preview-mode-nav.mjs +67 -0
  233. package/build-module/components/writing-flow/use-preview-mode-nav.mjs.map +7 -0
  234. package/build-module/hooks/block-renaming.mjs +1 -1
  235. package/build-module/hooks/block-renaming.mjs.map +2 -2
  236. package/build-module/hooks/cross-origin-isolation.mjs +1 -1
  237. package/build-module/hooks/cross-origin-isolation.mjs.map +2 -2
  238. package/build-module/hooks/custom-css.mjs +112 -0
  239. package/build-module/hooks/custom-css.mjs.map +7 -0
  240. package/build-module/hooks/fit-text.mjs +14 -7
  241. package/build-module/hooks/fit-text.mjs.map +2 -2
  242. package/build-module/hooks/grid-visualizer.mjs +1 -1
  243. package/build-module/hooks/grid-visualizer.mjs.map +2 -2
  244. package/build-module/hooks/index.mjs +4 -2
  245. package/build-module/hooks/index.mjs.map +2 -2
  246. package/build-module/hooks/layout.mjs +10 -4
  247. package/build-module/hooks/layout.mjs.map +2 -2
  248. package/build-module/hooks/list-view.mjs +10 -6
  249. package/build-module/hooks/list-view.mjs.map +2 -2
  250. package/build-module/hooks/utils.mjs +2 -2
  251. package/build-module/hooks/utils.mjs.map +2 -2
  252. package/build-module/layouts/grid.mjs +12 -1
  253. package/build-module/layouts/grid.mjs.map +2 -2
  254. package/build-module/store/actions.mjs +5 -0
  255. package/build-module/store/actions.mjs.map +2 -2
  256. package/build-module/store/defaults.mjs +3 -0
  257. package/build-module/store/defaults.mjs.map +2 -2
  258. package/build-module/store/private-selectors.mjs +43 -41
  259. package/build-module/store/private-selectors.mjs.map +2 -2
  260. package/build-module/store/reducer.mjs +5 -7
  261. package/build-module/store/reducer.mjs.map +2 -2
  262. package/build-module/store/selectors.mjs +15 -0
  263. package/build-module/store/selectors.mjs.map +2 -2
  264. package/build-module/utils/fit-text-utils.mjs +18 -4
  265. package/build-module/utils/fit-text-utils.mjs.map +2 -2
  266. package/build-style/content-rtl.css +10 -0
  267. package/build-style/content.css +10 -0
  268. package/build-style/style-rtl.css +3 -0
  269. package/build-style/style.css +3 -0
  270. package/package.json +39 -39
  271. package/src/components/block-breadcrumb/index.js +6 -1
  272. package/src/components/block-controls/index.js +1 -1
  273. package/src/components/block-controls/test/index.js +1 -0
  274. package/src/components/block-edit/test/edit.js +10 -0
  275. package/src/components/block-inspector/index.js +15 -36
  276. package/src/components/block-list/block.js +5 -2
  277. package/src/components/block-list/content.scss +11 -0
  278. package/src/components/block-list/index.js +25 -17
  279. package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +51 -36
  280. package/src/components/block-list/use-in-between-inserter.js +8 -6
  281. package/src/components/block-preview/test/index.js +11 -7
  282. package/src/components/block-settings-menu/block-settings-dropdown.js +11 -6
  283. package/src/components/block-settings-menu-controls/edit-section-menu-item.js +1 -7
  284. package/src/components/block-settings-menu-controls/index.js +16 -18
  285. package/src/components/block-switcher/test/index.js +2 -0
  286. package/src/components/block-switcher/test/use-transformed.patterns.js +2 -0
  287. package/src/components/block-switcher/test/utils.js +2 -0
  288. package/src/components/block-toolbar/block-toolbar-icon.js +6 -10
  289. package/src/components/block-toolbar/index.js +3 -9
  290. package/src/components/block-tools/index.js +2 -29
  291. package/src/components/block-variation-transforms/index.js +1 -4
  292. package/src/components/block-visibility/index.js +3 -19
  293. package/src/components/block-visibility/modal.js +16 -14
  294. package/src/components/block-visibility/test/use-block-visibility.js +27 -25
  295. package/src/components/block-visibility/test/utils.js +24 -8
  296. package/src/components/block-visibility/use-block-visibility.js +1 -4
  297. package/src/components/block-visibility/utils.js +9 -1
  298. package/src/components/block-visibility/viewport-menu-item.js +11 -5
  299. package/src/components/block-visibility/viewport-toolbar.js +5 -6
  300. package/src/components/block-visibility/viewport-visibility-info.js +131 -0
  301. package/src/components/color-palette/with-color-context.js +1 -1
  302. package/src/components/color-style-selector/index.js +2 -3
  303. package/src/components/colors/with-colors.js +23 -20
  304. package/src/components/colors-gradients/dropdown.js +2 -3
  305. package/src/components/editable-text/index.js +5 -1
  306. package/src/components/font-sizes/with-font-sizes.js +13 -10
  307. package/src/components/global-styles/advanced-panel.js +35 -16
  308. package/src/components/global-styles/filters-panel.js +2 -3
  309. package/src/components/global-styles/shadow-panel-components.js +1 -1
  310. package/src/components/global-styles/style.scss +9 -5
  311. package/src/components/gradients/with-gradient.js +7 -4
  312. package/src/components/inner-blocks/test/index.js +2 -0
  313. package/src/components/inserter/index.js +1 -0
  314. package/src/components/inserter/stories/index.story.jsx +31 -24
  315. package/src/components/inspector-controls/fill.js +25 -5
  316. package/src/components/inspector-controls/index.js +1 -1
  317. package/src/components/inspector-controls-tabs/index.js +6 -2
  318. package/src/components/inspector-controls-tabs/styles-tab.js +7 -8
  319. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -4
  320. package/src/components/link-control/test/index.js +6 -1
  321. package/src/components/list-view/block-select-button.js +16 -25
  322. package/src/components/list-view/block.js +38 -43
  323. package/src/components/list-view/utils.js +4 -2
  324. package/src/components/media-replace-flow/index.js +3 -3
  325. package/src/components/media-replace-flow/test/index.js +13 -11
  326. package/src/components/provider/index.js +11 -10
  327. package/src/components/provider/test/use-block-sync.js +1 -0
  328. package/src/components/provider/with-registry-provider.js +1 -1
  329. package/src/components/rich-text/index.js +1 -1
  330. package/src/components/use-block-commands/index.js +0 -41
  331. package/src/components/use-block-display-information/index.js +1 -5
  332. package/src/components/writing-flow/index.js +2 -0
  333. package/src/components/writing-flow/use-arrow-nav.js +5 -0
  334. package/src/components/writing-flow/use-drag-selection.js +7 -1
  335. package/src/components/writing-flow/use-preview-mode-nav.js +102 -0
  336. package/src/hooks/block-renaming.js +5 -2
  337. package/src/hooks/cross-origin-isolation.js +19 -18
  338. package/src/hooks/custom-css.js +176 -0
  339. package/src/hooks/fit-text.js +20 -5
  340. package/src/hooks/grid-visualizer.js +15 -14
  341. package/src/hooks/index.js +4 -2
  342. package/src/hooks/layout.js +55 -43
  343. package/src/hooks/list-view.js +10 -6
  344. package/src/hooks/test/align.js +1 -0
  345. package/src/hooks/test/allowed-blocks.js +8 -0
  346. package/src/hooks/test/auto-inspector-controls.js +4 -0
  347. package/src/hooks/test/font-size.js +1 -0
  348. package/src/hooks/test/metadata.js +4 -0
  349. package/src/hooks/test/text-align.js +1 -0
  350. package/src/hooks/utils.js +123 -119
  351. package/src/layouts/grid.js +19 -3
  352. package/src/layouts/test/grid.js +1 -1
  353. package/src/store/actions.js +7 -0
  354. package/src/store/defaults.js +4 -0
  355. package/src/store/private-selectors.js +94 -64
  356. package/src/store/reducer.js +11 -18
  357. package/src/store/selectors.js +25 -0
  358. package/src/store/test/actions.js +7 -0
  359. package/src/store/test/private-selectors.js +116 -119
  360. package/src/store/test/reducer.js +262 -266
  361. package/src/store/test/registry-selectors.js +2 -0
  362. package/src/store/test/selectors.js +19 -0
  363. package/src/utils/fit-text-utils.js +31 -5
  364. package/build/components/block-visibility/block-visibility-info.cjs +0 -63
  365. package/build/components/block-visibility/block-visibility-info.cjs.map +0 -7
  366. package/build/components/block-visibility/menu-item.cjs +0 -109
  367. package/build/components/block-visibility/menu-item.cjs.map +0 -7
  368. package/build/components/block-visibility/toolbar.cjs +0 -92
  369. package/build/components/block-visibility/toolbar.cjs.map +0 -7
  370. package/build/components/content-lock/index.cjs +0 -31
  371. package/build/components/content-lock/index.cjs.map +0 -7
  372. package/build/components/content-lock/modify-content-lock-menu-item.cjs +0 -70
  373. package/build/components/content-lock/modify-content-lock-menu-item.cjs.map +0 -7
  374. package/build/hooks/content-lock-ui.cjs +0 -68
  375. package/build/hooks/content-lock-ui.cjs.map +0 -7
  376. package/build-module/components/block-visibility/block-visibility-info.mjs +0 -47
  377. package/build-module/components/block-visibility/block-visibility-info.mjs.map +0 -7
  378. package/build-module/components/block-visibility/menu-item.mjs +0 -88
  379. package/build-module/components/block-visibility/menu-item.mjs.map +0 -7
  380. package/build-module/components/block-visibility/toolbar.mjs +0 -71
  381. package/build-module/components/block-visibility/toolbar.mjs.map +0 -7
  382. package/build-module/components/content-lock/index.mjs +0 -6
  383. package/build-module/components/content-lock/index.mjs.map +0 -7
  384. package/build-module/components/content-lock/modify-content-lock-menu-item.mjs +0 -45
  385. package/build-module/components/content-lock/modify-content-lock-menu-item.mjs.map +0 -7
  386. package/build-module/hooks/content-lock-ui.mjs +0 -47
  387. package/build-module/hooks/content-lock-ui.mjs.map +0 -7
  388. package/src/components/block-visibility/block-visibility-info.js +0 -62
  389. package/src/components/block-visibility/menu-item.js +0 -96
  390. package/src/components/block-visibility/toolbar.js +0 -88
  391. package/src/components/content-lock/index.js +0 -1
  392. package/src/components/content-lock/modify-content-lock-menu-item.js +0 -67
  393. package/src/hooks/content-lock-ui.js +0 -76
@@ -30,6 +30,7 @@ import { useBlockEditingMode } from '../components/block-editing-mode';
30
30
  import { LAYOUT_DEFINITIONS } from '../layouts/definitions';
31
31
  import { useBlockSettings, useStyleOverride } from './utils';
32
32
  import { unlock } from '../lock-unlock';
33
+ import { globalStylesDataKey } from '../store/private-keys';
33
34
 
34
35
  const layoutBlockSupportKey = 'layout';
35
36
  const { kebabCase } = unlock( componentsPrivateApis );
@@ -367,6 +368,7 @@ function BlockWithLayoutStyles( {
367
368
  block: BlockListBlock,
368
369
  props,
369
370
  blockGapSupport,
371
+ globalBlockGapValue,
370
372
  layoutClasses,
371
373
  } ) {
372
374
  const { name, attributes } = props;
@@ -393,6 +395,7 @@ function BlockWithLayoutStyles( {
393
395
  layout: usedLayout,
394
396
  style: attributes?.style,
395
397
  hasBlockGapSupport,
398
+ globalBlockGapValue,
396
399
  } );
397
400
 
398
401
  // Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.
@@ -421,56 +424,65 @@ function BlockWithLayoutStyles( {
421
424
  * @return {Function} Wrapped component.
422
425
  */
423
426
  export const withLayoutStyles = createHigherOrderComponent(
424
- ( BlockListBlock ) => ( props ) => {
425
- const { clientId, name, attributes } = props;
426
- const blockSupportsLayout = hasLayoutBlockSupport( name );
427
- const layoutClasses = useLayoutClasses( attributes, name );
428
- const extraProps = useSelect(
429
- ( select ) => {
430
- // The callback returns early to avoid block editor subscription.
431
- if ( ! blockSupportsLayout ) {
432
- return;
433
- }
434
-
435
- const { getSettings, getBlockSettings } = unlock(
436
- select( blockEditorStore )
437
- );
438
- const { disableLayoutStyles } = getSettings();
427
+ ( BlockListBlock ) =>
428
+ function WithLayoutStyles( props ) {
429
+ const { clientId, name, attributes } = props;
430
+ const blockSupportsLayout = hasLayoutBlockSupport( name );
431
+ const layoutClasses = useLayoutClasses( attributes, name );
432
+ const extraProps = useSelect(
433
+ ( select ) => {
434
+ // The callback returns early to avoid block editor subscription.
435
+ if ( ! blockSupportsLayout ) {
436
+ return;
437
+ }
439
438
 
440
- if ( disableLayoutStyles ) {
441
- return;
442
- }
439
+ const { getSettings, getBlockSettings } = unlock(
440
+ select( blockEditorStore )
441
+ );
442
+ const settings = getSettings();
443
+ const { disableLayoutStyles } = settings;
443
444
 
444
- const [ blockGapSupport ] = getBlockSettings(
445
- clientId,
446
- 'spacing.blockGap'
447
- );
445
+ if ( disableLayoutStyles ) {
446
+ return;
447
+ }
448
448
 
449
- return { blockGapSupport };
450
- },
451
- [ blockSupportsLayout, clientId ]
452
- );
449
+ const [ blockGapSupport ] = getBlockSettings(
450
+ clientId,
451
+ 'spacing.blockGap'
452
+ );
453
+
454
+ // Get default blockGap value from global styles for use in layouts like grid.
455
+ // Check block-specific styles first, then fall back to root styles.
456
+ const globalStyles = settings[ globalStylesDataKey ];
457
+ const globalBlockGapValue =
458
+ globalStyles?.blocks?.[ name ]?.spacing?.blockGap ??
459
+ globalStyles?.spacing?.blockGap;
460
+
461
+ return { blockGapSupport, globalBlockGapValue };
462
+ },
463
+ [ blockSupportsLayout, clientId ]
464
+ );
465
+
466
+ if ( ! extraProps ) {
467
+ return (
468
+ <BlockListBlock
469
+ { ...props }
470
+ __unstableLayoutClassNames={
471
+ blockSupportsLayout ? layoutClasses : undefined
472
+ }
473
+ />
474
+ );
475
+ }
453
476
 
454
- if ( ! extraProps ) {
455
477
  return (
456
- <BlockListBlock
457
- { ...props }
458
- __unstableLayoutClassNames={
459
- blockSupportsLayout ? layoutClasses : undefined
460
- }
478
+ <BlockWithLayoutStyles
479
+ block={ BlockListBlock }
480
+ props={ props }
481
+ layoutClasses={ layoutClasses }
482
+ { ...extraProps }
461
483
  />
462
484
  );
463
- }
464
-
465
- return (
466
- <BlockWithLayoutStyles
467
- block={ BlockListBlock }
468
- props={ props }
469
- layoutClasses={ layoutClasses }
470
- { ...extraProps }
471
- />
472
- );
473
- },
485
+ },
474
486
  'withLayoutStyles'
475
487
  );
476
488
 
@@ -4,7 +4,7 @@
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import { PanelBody } from '@wordpress/components';
6
6
  import { useSelect } from '@wordpress/data';
7
- import { store as blocksStore, hasBlockSupport } from '@wordpress/blocks';
7
+ import { hasBlockSupport } from '@wordpress/blocks';
8
8
  import { useContext } from '@wordpress/element';
9
9
 
10
10
  /**
@@ -14,6 +14,7 @@ import { store as blockEditorStore } from '../store';
14
14
  import { PrivateListView } from '../components/list-view';
15
15
  import InspectorControls from '../components/inspector-controls/fill';
16
16
  import { PrivateBlockContext } from '../components/block-list/private-block-context';
17
+ import useBlockDisplayTitle from '../components/block-title/use-block-display-title';
17
18
 
18
19
  export const LIST_VIEW_SUPPORT_KEY = 'listView';
19
20
 
@@ -39,7 +40,7 @@ export function ListViewPanel( { clientId, name } ) {
39
40
  const { isSelectionWithinCurrentSection } =
40
41
  useContext( PrivateBlockContext );
41
42
  const isEnabled = hasListViewSupport( name );
42
- const { hasChildren, blockTitle, isNestedListView } = useSelect(
43
+ const { hasChildren, isNestedListView } = useSelect(
43
44
  ( select ) => {
44
45
  const { getBlockCount, getBlockParents, getBlockName } =
45
46
  select( blockEditorStore );
@@ -64,12 +65,15 @@ export function ListViewPanel( { clientId, name } ) {
64
65
 
65
66
  return {
66
67
  hasChildren: !! getBlockCount( clientId ),
67
- blockTitle: select( blocksStore ).getBlockType( name )?.title,
68
68
  isNestedListView: _isNestedListView,
69
69
  };
70
70
  },
71
- [ clientId, name, isSelectionWithinCurrentSection ]
71
+ [ clientId, isSelectionWithinCurrentSection ]
72
72
  );
73
+ const title = useBlockDisplayTitle( {
74
+ clientId,
75
+ context: 'list-view',
76
+ } );
73
77
 
74
78
  if ( ! isEnabled || isNestedListView ) {
75
79
  return null;
@@ -79,7 +83,7 @@ export function ListViewPanel( { clientId, name } ) {
79
83
 
80
84
  return (
81
85
  <InspectorControls group="list">
82
- <PanelBody title={ showBlockTitle ? blockTitle : undefined }>
86
+ <PanelBody title={ showBlockTitle ? title : undefined }>
83
87
  { ! hasChildren && (
84
88
  <p className="block-editor-block-inspector__no-blocks">
85
89
  { __( 'No items yet.' ) }
@@ -88,7 +92,7 @@ export function ListViewPanel( { clientId, name } ) {
88
92
  <PrivateListView
89
93
  rootClientId={ clientId }
90
94
  isExpanded
91
- description={ blockTitle }
95
+ description={ title }
92
96
  showAppender
93
97
  />
94
98
  </PanelBody>
@@ -17,6 +17,7 @@ const noop = () => {};
17
17
 
18
18
  describe( 'align', () => {
19
19
  const blockSettings = {
20
+ apiVersion: 3,
20
21
  save: noop,
21
22
  category: 'text',
22
23
  title: 'block title',
@@ -22,6 +22,7 @@ describe( 'allowedBlocks', () => {
22
22
  describe( 'addTransforms()', () => {
23
23
  it( 'should not preserve allowedBlocks in wrapping transforms', () => {
24
24
  registerBlockType( 'core/bar', {
25
+ apiVersion: 3,
25
26
  title: 'Bar',
26
27
  supports: { allowedBlocks: true },
27
28
  } );
@@ -53,6 +54,7 @@ describe( 'allowedBlocks', () => {
53
54
 
54
55
  it( 'should not preserve allowedBlocks in one-to-many transforms', () => {
55
56
  registerBlockType( 'core/bar', {
57
+ apiVersion: 3,
56
58
  title: 'Bar',
57
59
  supports: { allowedBlocks: true },
58
60
  } );
@@ -83,6 +85,7 @@ describe( 'allowedBlocks', () => {
83
85
 
84
86
  it( 'should not preserve allowedBlocks in many-to-one transforms', () => {
85
87
  registerBlockType( 'core/bar', {
88
+ apiVersion: 3,
86
89
  title: 'Bar',
87
90
  supports: { allowedBlocks: true },
88
91
  } );
@@ -114,6 +117,7 @@ describe( 'allowedBlocks', () => {
114
117
 
115
118
  it( 'should not preserve allowedBlocks in many-to-many transforms with different counts', () => {
116
119
  registerBlockType( 'core/bar', {
120
+ apiVersion: 3,
117
121
  title: 'Bar',
118
122
  supports: { allowedBlocks: true },
119
123
  } );
@@ -155,6 +159,7 @@ describe( 'allowedBlocks', () => {
155
159
 
156
160
  it( 'should preserve allowedBlocks in many-to-many transforms with same counts', () => {
157
161
  registerBlockType( 'core/bar', {
162
+ apiVersion: 3,
158
163
  title: 'Bar',
159
164
  supports: { allowedBlocks: true },
160
165
  } );
@@ -194,6 +199,7 @@ describe( 'allowedBlocks', () => {
194
199
 
195
200
  it( "should filter allowedBlocks based on destination block's allowedBlocks", () => {
196
201
  registerBlockType( 'core/bar', {
202
+ apiVersion: 3,
197
203
  title: 'Bar',
198
204
  supports: { allowedBlocks: true },
199
205
  allowedBlocks: [ 'core/paragraph' ],
@@ -227,6 +233,7 @@ describe( 'allowedBlocks', () => {
227
233
 
228
234
  it( 'should not override existing allowedBlocks in target block', () => {
229
235
  registerBlockType( 'core/bar', {
236
+ apiVersion: 3,
230
237
  title: 'Bar',
231
238
  supports: { allowedBlocks: true },
232
239
  } );
@@ -253,6 +260,7 @@ describe( 'allowedBlocks', () => {
253
260
 
254
261
  it( 'should not preserve allowedBlocks when target block does not support allowedBlocks', () => {
255
262
  registerBlockType( 'core/bar', {
263
+ apiVersion: 3,
256
264
  title: 'Bar',
257
265
  } );
258
266
 
@@ -24,6 +24,7 @@ describe( 'auto-inspector-controls', () => {
24
24
  describe( 'hasSupport()', () => {
25
25
  it( 'should return false for blocks without __experimentalAutoInspectorControl markers', () => {
26
26
  registerBlockType( blockName, {
27
+ apiVersion: 3,
27
28
  title: 'Test Block',
28
29
  category: 'text',
29
30
  attributes: {
@@ -42,6 +43,7 @@ describe( 'auto-inspector-controls', () => {
42
43
 
43
44
  it( 'should return true for blocks with __experimentalAutoInspectorControl markers', () => {
44
45
  registerBlockType( blockName, {
46
+ apiVersion: 3,
45
47
  title: 'Test Block',
46
48
  category: 'text',
47
49
  attributes: {
@@ -71,6 +73,7 @@ describe( 'auto-inspector-controls', () => {
71
73
 
72
74
  it( 'should return false for blocks with no attributes', () => {
73
75
  registerBlockType( blockName, {
76
+ apiVersion: 3,
74
77
  title: 'Test Block',
75
78
  category: 'text',
76
79
  edit: () => null,
@@ -84,6 +87,7 @@ describe( 'auto-inspector-controls', () => {
84
87
 
85
88
  it( 'should return true when at least one attribute has __experimentalAutoInspectorControl', () => {
86
89
  registerBlockType( blockName, {
90
+ apiVersion: 3,
87
91
  title: 'Test Block',
88
92
  category: 'text',
89
93
  attributes: {
@@ -39,6 +39,7 @@ function addUseSettingFilter( callback ) {
39
39
 
40
40
  describe( 'useBlockProps', () => {
41
41
  const blockSettings = {
42
+ apiVersion: 3,
42
43
  save: () => noop,
43
44
  category: 'text',
44
45
  title: 'font size title',
@@ -174,6 +174,7 @@ describe( 'metadata', () => {
174
174
 
175
175
  it( 'should preserve custom name metadata', () => {
176
176
  registerBlockType( 'core/bar', {
177
+ apiVersion: 3,
177
178
  title: 'Bar',
178
179
  } );
179
180
  const source = [
@@ -199,6 +200,7 @@ describe( 'metadata', () => {
199
200
 
200
201
  it( 'should not preserve custom name metadata when target block does not support renaming', () => {
201
202
  registerBlockType( 'core/bar', {
203
+ apiVersion: 3,
202
204
  title: 'Bar',
203
205
  supports: {
204
206
  renaming: false,
@@ -226,6 +228,7 @@ describe( 'metadata', () => {
226
228
 
227
229
  it( 'should preserve block visibility metadata', () => {
228
230
  registerBlockType( 'core/bar', {
231
+ apiVersion: 3,
229
232
  title: 'Bar',
230
233
  } );
231
234
 
@@ -252,6 +255,7 @@ describe( 'metadata', () => {
252
255
 
253
256
  it( 'should not preserve block visibility metadata when target block does not support it', () => {
254
257
  registerBlockType( 'core/bar', {
258
+ apiVersion: 3,
255
259
  title: 'Bar',
256
260
  supports: {
257
261
  visibility: false,
@@ -16,6 +16,7 @@ const noop = () => {};
16
16
 
17
17
  describe( 'textAlign', () => {
18
18
  const blockSettings = {
19
+ apiVersion: 3,
19
20
  save: noop,
20
21
  category: 'text',
21
22
  title: 'block title',
@@ -522,63 +522,66 @@ export function createBlockEditFilter( features ) {
522
522
  return { ...settings, Edit: memo( settings.edit ) };
523
523
  } );
524
524
  const withBlockEditHooks = createHigherOrderComponent(
525
- ( OriginalBlockEdit ) => ( props ) => {
526
- const context = useBlockEditContext();
527
- // CAUTION: code added before this line will be executed for all
528
- // blocks, not just those that support the feature! Code added
529
- // above this line should be carefully evaluated for its impact on
530
- // performance.
531
- return [
532
- ...features.map( ( feature, i ) => {
533
- const {
534
- Edit,
535
- hasSupport,
536
- attributeKeys = [],
537
- shareWithChildBlocks,
538
- supportsPatternEditing,
539
- } = feature;
540
- const shouldDisplayControls =
541
- ( supportsPatternEditing &&
542
- context[ mayDisplayPatternEditingControlsKey ] ) ||
543
- context[ mayDisplayControlsKey ] ||
544
- ( context[ mayDisplayParentControlsKey ] &&
545
- shareWithChildBlocks );
525
+ ( OriginalBlockEdit ) =>
526
+ function WithBlockEditHooks( props ) {
527
+ const context = useBlockEditContext();
528
+ // CAUTION: code added before this line will be executed for all
529
+ // blocks, not just those that support the feature! Code added
530
+ // above this line should be carefully evaluated for its impact on
531
+ // performance.
532
+ return [
533
+ ...features.map( ( feature, i ) => {
534
+ const {
535
+ Edit,
536
+ hasSupport,
537
+ attributeKeys = [],
538
+ shareWithChildBlocks,
539
+ supportsPatternEditing,
540
+ } = feature;
541
+ const shouldDisplayControls =
542
+ ( supportsPatternEditing &&
543
+ context[
544
+ mayDisplayPatternEditingControlsKey
545
+ ] ) ||
546
+ context[ mayDisplayControlsKey ] ||
547
+ ( context[ mayDisplayParentControlsKey ] &&
548
+ shareWithChildBlocks );
546
549
 
547
- if (
548
- ! shouldDisplayControls ||
549
- ! hasSupport( props.name )
550
- ) {
551
- return null;
552
- }
553
-
554
- const neededProps = {};
555
- for ( const key of attributeKeys ) {
556
- if ( props.attributes[ key ] ) {
557
- neededProps[ key ] = props.attributes[ key ];
550
+ if (
551
+ ! shouldDisplayControls ||
552
+ ! hasSupport( props.name )
553
+ ) {
554
+ return null;
558
555
  }
559
- }
560
556
 
561
- return (
562
- <Edit
563
- // We can use the index because the array length
564
- // is fixed per page load right now.
565
- key={ i }
566
- name={ props.name }
567
- isSelected={ props.isSelected }
568
- clientId={ props.clientId }
569
- setAttributes={ props.setAttributes }
570
- __unstableParentLayout={
571
- props.__unstableParentLayout
557
+ const neededProps = {};
558
+ for ( const key of attributeKeys ) {
559
+ if ( props.attributes[ key ] ) {
560
+ neededProps[ key ] = props.attributes[ key ];
572
561
  }
573
- // This component is pure, so only pass needed
574
- // props!!!
575
- { ...neededProps }
576
- />
577
- );
578
- } ),
579
- <OriginalBlockEdit key="edit" { ...props } />,
580
- ];
581
- },
562
+ }
563
+
564
+ return (
565
+ <Edit
566
+ // We can use the index because the array length
567
+ // is fixed per page load right now.
568
+ key={ i }
569
+ name={ props.name }
570
+ isSelected={ props.isSelected }
571
+ clientId={ props.clientId }
572
+ setAttributes={ props.setAttributes }
573
+ __unstableParentLayout={
574
+ props.__unstableParentLayout
575
+ }
576
+ // This component is pure, so only pass needed
577
+ // props!!!
578
+ { ...neededProps }
579
+ />
580
+ );
581
+ } ),
582
+ <OriginalBlockEdit key="edit" { ...props } />,
583
+ ];
584
+ },
582
585
  'withBlockEditHooks'
583
586
  );
584
587
  addFilter( 'editor.BlockEdit', 'core/editor/hooks', withBlockEditHooks );
@@ -614,76 +617,77 @@ const BlockPropsPure = memo( BlockProps );
614
617
 
615
618
  export function createBlockListBlockFilter( features ) {
616
619
  const withBlockListBlockHooks = createHigherOrderComponent(
617
- ( BlockListBlock ) => ( props ) => {
618
- const [ allWrapperProps, setAllWrapperProps ] = useState(
619
- Array( features.length ).fill( undefined )
620
- );
621
- return [
622
- ...features.map( ( feature, i ) => {
623
- const {
624
- hasSupport,
625
- attributeKeys = [],
626
- useBlockProps,
627
- isMatch,
628
- } = feature;
620
+ ( BlockListBlock ) =>
621
+ function WithBlockListBlockHooks( props ) {
622
+ const [ allWrapperProps, setAllWrapperProps ] = useState(
623
+ Array( features.length ).fill( undefined )
624
+ );
625
+ return [
626
+ ...features.map( ( feature, i ) => {
627
+ const {
628
+ hasSupport,
629
+ attributeKeys = [],
630
+ useBlockProps,
631
+ isMatch,
632
+ } = feature;
629
633
 
630
- const neededProps = {};
631
- for ( const key of attributeKeys ) {
632
- if ( props.attributes[ key ] ) {
633
- neededProps[ key ] = props.attributes[ key ];
634
+ const neededProps = {};
635
+ for ( const key of attributeKeys ) {
636
+ if ( props.attributes[ key ] ) {
637
+ neededProps[ key ] = props.attributes[ key ];
638
+ }
634
639
  }
635
- }
636
640
 
637
- if (
638
- // Skip rendering if none of the needed attributes are
639
- // set.
640
- ! Object.keys( neededProps ).length ||
641
- ! hasSupport( props.name ) ||
642
- ( isMatch && ! isMatch( neededProps ) )
643
- ) {
644
- return null;
645
- }
641
+ if (
642
+ // Skip rendering if none of the needed attributes are
643
+ // set.
644
+ ! Object.keys( neededProps ).length ||
645
+ ! hasSupport( props.name ) ||
646
+ ( isMatch && ! isMatch( neededProps ) )
647
+ ) {
648
+ return null;
649
+ }
646
650
 
647
- return (
648
- <BlockPropsPure
649
- // We can use the index because the array length
650
- // is fixed per page load right now.
651
- key={ i }
652
- index={ i }
653
- useBlockProps={ useBlockProps }
654
- // This component is pure, so we must pass a stable
655
- // function reference.
656
- setAllWrapperProps={ setAllWrapperProps }
657
- name={ props.name }
658
- clientId={ props.clientId }
659
- // This component is pure, so only pass needed
660
- // props!!!
661
- { ...neededProps }
662
- />
663
- );
664
- } ),
665
- <BlockListBlock
666
- key="edit"
667
- { ...props }
668
- wrapperProps={ allWrapperProps
669
- .filter( Boolean )
670
- .reduce( ( acc, wrapperProps ) => {
671
- return {
672
- ...acc,
673
- ...wrapperProps,
674
- className: clsx(
675
- acc.className,
676
- wrapperProps.className
677
- ),
678
- style: {
679
- ...acc.style,
680
- ...wrapperProps.style,
681
- },
682
- };
683
- }, props.wrapperProps || {} ) }
684
- />,
685
- ];
686
- },
651
+ return (
652
+ <BlockPropsPure
653
+ // We can use the index because the array length
654
+ // is fixed per page load right now.
655
+ key={ i }
656
+ index={ i }
657
+ useBlockProps={ useBlockProps }
658
+ // This component is pure, so we must pass a stable
659
+ // function reference.
660
+ setAllWrapperProps={ setAllWrapperProps }
661
+ name={ props.name }
662
+ clientId={ props.clientId }
663
+ // This component is pure, so only pass needed
664
+ // props!!!
665
+ { ...neededProps }
666
+ />
667
+ );
668
+ } ),
669
+ <BlockListBlock
670
+ key="edit"
671
+ { ...props }
672
+ wrapperProps={ allWrapperProps
673
+ .filter( Boolean )
674
+ .reduce( ( acc, wrapperProps ) => {
675
+ return {
676
+ ...acc,
677
+ ...wrapperProps,
678
+ className: clsx(
679
+ acc.className,
680
+ wrapperProps.className
681
+ ),
682
+ style: {
683
+ ...acc.style,
684
+ ...wrapperProps.style,
685
+ },
686
+ };
687
+ }, props.wrapperProps || {} ) }
688
+ />,
689
+ ];
690
+ },
687
691
  'withBlockListBlockHooks'
688
692
  );
689
693
  addFilter(
@@ -113,6 +113,7 @@ export default {
113
113
  style,
114
114
  blockName,
115
115
  hasBlockGapSupport,
116
+ globalBlockGapValue,
116
117
  layoutDefinitions = LAYOUT_DEFINITIONS,
117
118
  } ) {
118
119
  const {
@@ -146,13 +147,28 @@ export default {
146
147
  ? getGapCSSValue( style?.spacing?.blockGap, '0.5em' )
147
148
  : undefined;
148
149
 
150
+ // Use the global blockGap value for grid column calculations when available
151
+ // If the gap value has both top and left (separated by space), use the left value for horizontal calculations
152
+ let fallbackGapValue = '1.2rem';
153
+ if ( globalBlockGapValue ) {
154
+ const processedGap = getGapCSSValue( globalBlockGapValue, '0.5em' );
155
+ const gapParts = processedGap.split( ' ' );
156
+ fallbackGapValue =
157
+ gapParts.length > 1 ? gapParts[ 1 ] : gapParts[ 0 ];
158
+ }
159
+
149
160
  let output = '';
150
161
  const rules = [];
151
162
 
152
163
  if ( minimumColumnWidth && columnCount > 0 ) {
153
- const maxValue = `max(${ minimumColumnWidth }, ( 100% - (${
154
- blockGapValue || '1.2rem'
155
- }*${ columnCount - 1 }) ) / ${ columnCount })`;
164
+ let blockGapToUse = blockGapValue || fallbackGapValue;
165
+ // Ensure 0 values have a unit so they work in calc().
166
+ if ( blockGapToUse === '0' || blockGapToUse === 0 ) {
167
+ blockGapToUse = '0px';
168
+ }
169
+ const maxValue = `max(min( ${ minimumColumnWidth }, 100%), ( 100% - (${ blockGapToUse }*${
170
+ columnCount - 1
171
+ }) ) / ${ columnCount })`;
156
172
  rules.push(
157
173
  `grid-template-columns: repeat(auto-fill, minmax(${ maxValue }, 1fr))`,
158
174
  `container-type: inline-size`
@@ -33,7 +33,7 @@ describe( 'getLayoutStyle', () => {
33
33
  expect( result ).toBe( expected );
34
34
  } );
35
35
  it( 'should return `grid-template-columns` with max() function if both minimumColumnWidth and columnCount are provided', () => {
36
- const expected = `.my-container { grid-template-columns: repeat(auto-fill, minmax(max(12rem, ( 100% - (1.2rem*2) ) / 3), 1fr)); container-type: inline-size; }`;
36
+ const expected = `.my-container { grid-template-columns: repeat(auto-fill, minmax(max(min( 12rem, 100%), ( 100% - (1.2rem*2) ) / 3), 1fr)); container-type: inline-size; }`;
37
37
 
38
38
  const result = grid.getLayoutStyle( {
39
39
  selector: '.my-container',