@wordpress/block-editor 15.21.1 → 15.22.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 (490) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +2 -2
  3. package/build/components/block-card/index.cjs +4 -5
  4. package/build/components/block-card/index.cjs.map +2 -2
  5. package/build/components/block-editing-mode/index.cjs +13 -7
  6. package/build/components/block-editing-mode/index.cjs.map +2 -2
  7. package/build/components/block-inspector/index.cjs +35 -20
  8. package/build/components/block-inspector/index.cjs.map +2 -2
  9. package/build/components/block-mover/mover-description.cjs +6 -6
  10. package/build/components/block-mover/mover-description.cjs.map +1 -1
  11. package/build/components/block-patterns-list/index.cjs.map +2 -2
  12. package/build/components/block-patterns-paging/index.cjs +4 -4
  13. package/build/components/block-patterns-paging/index.cjs.map +2 -2
  14. package/build/components/block-popover/use-popover-scroll.cjs.map +1 -1
  15. package/build/components/block-quick-navigation/index.cjs +7 -5
  16. package/build/components/block-quick-navigation/index.cjs.map +2 -2
  17. package/build/components/block-rename/modal.cjs +0 -1
  18. package/build/components/block-rename/modal.cjs.map +2 -2
  19. package/build/components/block-toolbar/block-toolbar-icon.cjs +14 -6
  20. package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
  21. package/build/components/block-toolbar/edit-section-button.cjs.map +1 -1
  22. package/build/components/block-tools/use-block-toolbar-popover-props.cjs +10 -4
  23. package/build/components/block-tools/use-block-toolbar-popover-props.cjs.map +2 -2
  24. package/build/components/child-layout-control/index.cjs +51 -19
  25. package/build/components/child-layout-control/index.cjs.map +2 -2
  26. package/build/components/colors-gradients/control.cjs +25 -14
  27. package/build/components/colors-gradients/control.cjs.map +2 -2
  28. package/build/components/colors-gradients/dropdown.cjs +4 -1
  29. package/build/components/colors-gradients/dropdown.cjs.map +3 -3
  30. package/build/components/contrast-checker/index.cjs +22 -4
  31. package/build/components/contrast-checker/index.cjs.map +2 -2
  32. package/build/components/date-format-picker/index.cjs +0 -1
  33. package/build/components/date-format-picker/index.cjs.map +2 -2
  34. package/build/components/dimensions-tool/index.cjs +4 -5
  35. package/build/components/dimensions-tool/index.cjs.map +2 -2
  36. package/build/components/dimensions-tool/scale-tool.cjs +1 -1
  37. package/build/components/dimensions-tool/scale-tool.cjs.map +2 -2
  38. package/build/components/global-styles/background-panel.cjs +153 -25
  39. package/build/components/global-styles/background-panel.cjs.map +3 -3
  40. package/build/components/global-styles/color-gradient-dropdown-item.cjs +227 -0
  41. package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +7 -0
  42. package/build/components/global-styles/color-panel.cjs +98 -375
  43. package/build/components/global-styles/color-panel.cjs.map +3 -3
  44. package/build/components/global-styles/dimensions-panel.cjs +1 -4
  45. package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
  46. package/build/components/global-styles/hooks.cjs +34 -0
  47. package/build/components/global-styles/hooks.cjs.map +2 -2
  48. package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
  49. package/build/components/global-styles/typography-panel.cjs +82 -10
  50. package/build/components/global-styles/typography-panel.cjs.map +3 -3
  51. package/build/components/grid/grid-item-resizer.cjs.map +1 -1
  52. package/build/components/grid/grid-visualizer.cjs.map +1 -1
  53. package/build/components/iframe/index.cjs +6 -3
  54. package/build/components/iframe/index.cjs.map +3 -3
  55. package/build/components/image-editor/use-transform-image.cjs.map +1 -1
  56. package/build/components/inserter/get-appender-label.cjs.map +1 -1
  57. package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
  58. package/build/components/inserter/search-items.cjs.map +1 -1
  59. package/build/components/inspector-controls/fill.cjs +1 -3
  60. package/build/components/inspector-controls/fill.cjs.map +2 -2
  61. package/build/components/inspector-controls/groups.cjs +2 -0
  62. package/build/components/inspector-controls/groups.cjs.map +2 -2
  63. package/build/components/inspector-controls-tabs/index.cjs.map +2 -2
  64. package/build/components/inspector-controls-tabs/styles-tab.cjs +76 -32
  65. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  66. package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
  67. package/build/components/line-height-control/index.cjs.map +1 -1
  68. package/build/components/link-control/index.cjs +2 -3
  69. package/build/components/link-control/index.cjs.map +2 -2
  70. package/build/components/link-control/normalize-url.cjs.map +1 -1
  71. package/build/components/list-view/block-select-button.cjs +1 -10
  72. package/build/components/list-view/block-select-button.cjs.map +3 -3
  73. package/build/components/list-view/utils.cjs.map +1 -1
  74. package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
  75. package/build/components/provider/index.cjs.map +1 -1
  76. package/build/components/provider/use-block-sync.cjs +3 -1
  77. package/build/components/provider/use-block-sync.cjs.map +2 -2
  78. package/build/components/rich-text/event-listeners/before-input-rules.cjs +1 -1
  79. package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +2 -2
  80. package/build/components/rich-text/event-listeners/paste-handler.cjs.map +1 -1
  81. package/build/components/rich-text/prevent-event-discovery.cjs +1 -1
  82. package/build/components/rich-text/prevent-event-discovery.cjs.map +1 -1
  83. package/build/components/url-popover/image-url-input-ui.cjs +0 -2
  84. package/build/components/url-popover/image-url-input-ui.cjs.map +2 -2
  85. package/build/components/use-block-display-information/index.cjs +10 -3
  86. package/build/components/use-block-display-information/index.cjs.map +2 -2
  87. package/build/components/writing-flow/use-tab-nav.cjs.map +1 -1
  88. package/build/hooks/anchor.cjs +1 -2
  89. package/build/hooks/anchor.cjs.map +2 -2
  90. package/build/hooks/background.cjs +124 -75
  91. package/build/hooks/background.cjs.map +3 -3
  92. package/build/hooks/block-fields/index.cjs +13 -2
  93. package/build/hooks/block-fields/index.cjs.map +2 -2
  94. package/build/hooks/color.cjs +0 -162
  95. package/build/hooks/color.cjs.map +3 -3
  96. package/build/hooks/contrast-checker.cjs +31 -28
  97. package/build/hooks/contrast-checker.cjs.map +3 -3
  98. package/build/hooks/custom-class-name.cjs +0 -1
  99. package/build/hooks/custom-class-name.cjs.map +2 -2
  100. package/build/hooks/dimensions.cjs +13 -2
  101. package/build/hooks/dimensions.cjs.map +2 -2
  102. package/build/hooks/elements.cjs +142 -0
  103. package/build/hooks/elements.cjs.map +7 -0
  104. package/build/hooks/grid-visualizer.cjs +21 -11
  105. package/build/hooks/grid-visualizer.cjs.map +2 -2
  106. package/build/hooks/layout-child.cjs +65 -10
  107. package/build/hooks/layout-child.cjs.map +2 -2
  108. package/build/hooks/layout.cjs +6 -3
  109. package/build/hooks/layout.cjs.map +2 -2
  110. package/build/hooks/list-view.cjs +10 -7
  111. package/build/hooks/list-view.cjs.map +2 -2
  112. package/build/hooks/spacing-visualizer.cjs.map +1 -1
  113. package/build/hooks/state-utils.cjs.map +1 -1
  114. package/build/hooks/states.cjs +2 -2
  115. package/build/hooks/states.cjs.map +2 -2
  116. package/build/hooks/style.cjs +50 -6
  117. package/build/hooks/style.cjs.map +2 -2
  118. package/build/hooks/typography.cjs +62 -10
  119. package/build/hooks/typography.cjs.map +3 -3
  120. package/build/layouts/flex.cjs +99 -6
  121. package/build/layouts/flex.cjs.map +2 -2
  122. package/build/private-apis.cjs +4 -0
  123. package/build/private-apis.cjs.map +2 -2
  124. package/build/store/actions.cjs.map +1 -1
  125. package/build/store/private-selectors.cjs +19 -2
  126. package/build/store/private-selectors.cjs.map +2 -2
  127. package/build/store/reducer.cjs.map +1 -1
  128. package/build/store/selectors.cjs.map +1 -1
  129. package/build/utils/block-bindings.cjs +9 -9
  130. package/build/utils/block-bindings.cjs.map +3 -3
  131. package/build/utils/color-values.cjs +10 -1
  132. package/build/utils/color-values.cjs.map +3 -3
  133. package/build/utils/dom.cjs +2 -5
  134. package/build/utils/dom.cjs.map +3 -3
  135. package/build/utils/fit-text-frontend.cjs +6 -2
  136. package/build/utils/fit-text-frontend.cjs.map +3 -3
  137. package/build/utils/fit-text-utils.cjs +1 -1
  138. package/build/utils/fit-text-utils.cjs.map +3 -3
  139. package/build/utils/format-font-style.cjs +1 -1
  140. package/build/utils/format-font-style.cjs.map +3 -3
  141. package/build/utils/format-font-weight.cjs +1 -1
  142. package/build/utils/format-font-weight.cjs.map +3 -3
  143. package/build/utils/get-editor-region.cjs +4 -2
  144. package/build/utils/get-editor-region.cjs.map +3 -3
  145. package/build/utils/get-font-styles-and-weights.cjs +8 -12
  146. package/build/utils/get-font-styles-and-weights.cjs.map +3 -3
  147. package/build/utils/get-px-from-css-unit.cjs +1 -1
  148. package/build/utils/get-px-from-css-unit.cjs.map +1 -1
  149. package/build/utils/index.cjs +1 -1
  150. package/build/utils/index.cjs.map +1 -1
  151. package/build/utils/math.cjs +1 -1
  152. package/build/utils/math.cjs.map +3 -3
  153. package/build/utils/object.cjs +8 -8
  154. package/build/utils/object.cjs.map +3 -3
  155. package/build/utils/order-inserter-block-items.cjs +1 -1
  156. package/build/utils/order-inserter-block-items.cjs.map +3 -3
  157. package/build/utils/pasting.cjs +4 -2
  158. package/build/utils/pasting.cjs.map +3 -3
  159. package/build/utils/selection.cjs +3 -2
  160. package/build/utils/selection.cjs.map +3 -3
  161. package/build/utils/sorting.cjs +9 -3
  162. package/build/utils/sorting.cjs.map +3 -3
  163. package/build/utils/transform-styles/index.cjs +3 -2
  164. package/build/utils/transform-styles/index.cjs.map +3 -3
  165. package/build/utils/transform-styles/postcss-urlrebase.d.cjs +2 -0
  166. package/build/utils/transform-styles/postcss-urlrebase.d.cjs.map +7 -0
  167. package/build/utils/transform-styles/types.cjs +19 -0
  168. package/build/utils/transform-styles/types.cjs.map +7 -0
  169. package/build/utils/types.cjs +19 -0
  170. package/build/utils/types.cjs.map +7 -0
  171. package/build-module/components/block-card/index.mjs +5 -6
  172. package/build-module/components/block-card/index.mjs.map +2 -2
  173. package/build-module/components/block-editing-mode/index.mjs +14 -8
  174. package/build-module/components/block-editing-mode/index.mjs.map +2 -2
  175. package/build-module/components/block-inspector/index.mjs +35 -21
  176. package/build-module/components/block-inspector/index.mjs.map +2 -2
  177. package/build-module/components/block-mover/mover-description.mjs +6 -6
  178. package/build-module/components/block-mover/mover-description.mjs.map +1 -1
  179. package/build-module/components/block-patterns-list/index.mjs.map +2 -2
  180. package/build-module/components/block-patterns-paging/index.mjs +4 -4
  181. package/build-module/components/block-patterns-paging/index.mjs.map +2 -2
  182. package/build-module/components/block-popover/use-popover-scroll.mjs.map +1 -1
  183. package/build-module/components/block-quick-navigation/index.mjs +8 -6
  184. package/build-module/components/block-quick-navigation/index.mjs.map +2 -2
  185. package/build-module/components/block-rename/modal.mjs +0 -1
  186. package/build-module/components/block-rename/modal.mjs.map +2 -2
  187. package/build-module/components/block-toolbar/block-toolbar-icon.mjs +14 -6
  188. package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
  189. package/build-module/components/block-toolbar/edit-section-button.mjs.map +1 -1
  190. package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs +10 -4
  191. package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs.map +2 -2
  192. package/build-module/components/child-layout-control/index.mjs +51 -19
  193. package/build-module/components/child-layout-control/index.mjs.map +2 -2
  194. package/build-module/components/colors-gradients/control.mjs +27 -15
  195. package/build-module/components/colors-gradients/control.mjs.map +2 -2
  196. package/build-module/components/colors-gradients/dropdown.mjs +4 -1
  197. package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
  198. package/build-module/components/contrast-checker/index.mjs +18 -4
  199. package/build-module/components/contrast-checker/index.mjs.map +2 -2
  200. package/build-module/components/date-format-picker/index.mjs +0 -1
  201. package/build-module/components/date-format-picker/index.mjs.map +2 -2
  202. package/build-module/components/dimensions-tool/index.mjs +4 -5
  203. package/build-module/components/dimensions-tool/index.mjs.map +2 -2
  204. package/build-module/components/dimensions-tool/scale-tool.mjs +1 -1
  205. package/build-module/components/dimensions-tool/scale-tool.mjs.map +2 -2
  206. package/build-module/components/global-styles/background-panel.mjs +155 -27
  207. package/build-module/components/global-styles/background-panel.mjs.map +2 -2
  208. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +207 -0
  209. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +7 -0
  210. package/build-module/components/global-styles/color-panel.mjs +106 -387
  211. package/build-module/components/global-styles/color-panel.mjs.map +3 -3
  212. package/build-module/components/global-styles/dimensions-panel.mjs +1 -5
  213. package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
  214. package/build-module/components/global-styles/hooks.mjs +33 -0
  215. package/build-module/components/global-styles/hooks.mjs.map +2 -2
  216. package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
  217. package/build-module/components/global-styles/typography-panel.mjs +84 -10
  218. package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
  219. package/build-module/components/grid/grid-item-resizer.mjs.map +1 -1
  220. package/build-module/components/grid/grid-visualizer.mjs.map +1 -1
  221. package/build-module/components/iframe/index.mjs +6 -3
  222. package/build-module/components/iframe/index.mjs.map +2 -2
  223. package/build-module/components/image-editor/use-transform-image.mjs.map +1 -1
  224. package/build-module/components/inserter/get-appender-label.mjs.map +1 -1
  225. package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
  226. package/build-module/components/inserter/search-items.mjs.map +1 -1
  227. package/build-module/components/inspector-controls/fill.mjs +1 -3
  228. package/build-module/components/inspector-controls/fill.mjs.map +2 -2
  229. package/build-module/components/inspector-controls/groups.mjs +2 -0
  230. package/build-module/components/inspector-controls/groups.mjs.map +2 -2
  231. package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
  232. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +76 -32
  233. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  234. package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -1
  235. package/build-module/components/line-height-control/index.mjs.map +1 -1
  236. package/build-module/components/link-control/index.mjs +2 -3
  237. package/build-module/components/link-control/index.mjs.map +2 -2
  238. package/build-module/components/link-control/normalize-url.mjs.map +1 -1
  239. package/build-module/components/list-view/block-select-button.mjs +2 -17
  240. package/build-module/components/list-view/block-select-button.mjs.map +2 -2
  241. package/build-module/components/list-view/utils.mjs.map +1 -1
  242. package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
  243. package/build-module/components/provider/index.mjs.map +1 -1
  244. package/build-module/components/provider/use-block-sync.mjs +3 -1
  245. package/build-module/components/provider/use-block-sync.mjs.map +2 -2
  246. package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +1 -1
  247. package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
  248. package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +1 -1
  249. package/build-module/components/rich-text/prevent-event-discovery.mjs +1 -1
  250. package/build-module/components/rich-text/prevent-event-discovery.mjs.map +1 -1
  251. package/build-module/components/url-popover/image-url-input-ui.mjs +0 -2
  252. package/build-module/components/url-popover/image-url-input-ui.mjs.map +2 -2
  253. package/build-module/components/use-block-display-information/index.mjs +10 -3
  254. package/build-module/components/use-block-display-information/index.mjs.map +2 -2
  255. package/build-module/components/writing-flow/use-tab-nav.mjs.map +1 -1
  256. package/build-module/hooks/anchor.mjs +1 -2
  257. package/build-module/hooks/anchor.mjs.map +2 -2
  258. package/build-module/hooks/background.mjs +123 -75
  259. package/build-module/hooks/background.mjs.map +2 -2
  260. package/build-module/hooks/block-fields/index.mjs +13 -2
  261. package/build-module/hooks/block-fields/index.mjs.map +2 -2
  262. package/build-module/hooks/color.mjs +2 -175
  263. package/build-module/hooks/color.mjs.map +2 -2
  264. package/build-module/hooks/contrast-checker.mjs +32 -19
  265. package/build-module/hooks/contrast-checker.mjs.map +2 -2
  266. package/build-module/hooks/custom-class-name.mjs +0 -1
  267. package/build-module/hooks/custom-class-name.mjs.map +2 -2
  268. package/build-module/hooks/dimensions.mjs +12 -2
  269. package/build-module/hooks/dimensions.mjs.map +2 -2
  270. package/build-module/hooks/elements.mjs +115 -0
  271. package/build-module/hooks/elements.mjs.map +7 -0
  272. package/build-module/hooks/grid-visualizer.mjs +21 -11
  273. package/build-module/hooks/grid-visualizer.mjs.map +2 -2
  274. package/build-module/hooks/layout-child.mjs +68 -10
  275. package/build-module/hooks/layout-child.mjs.map +2 -2
  276. package/build-module/hooks/layout.mjs +6 -3
  277. package/build-module/hooks/layout.mjs.map +2 -2
  278. package/build-module/hooks/list-view.mjs +10 -7
  279. package/build-module/hooks/list-view.mjs.map +2 -2
  280. package/build-module/hooks/spacing-visualizer.mjs.map +1 -1
  281. package/build-module/hooks/state-utils.mjs.map +1 -1
  282. package/build-module/hooks/states.mjs +2 -2
  283. package/build-module/hooks/states.mjs.map +2 -2
  284. package/build-module/hooks/style.mjs +53 -8
  285. package/build-module/hooks/style.mjs.map +2 -2
  286. package/build-module/hooks/typography.mjs +62 -10
  287. package/build-module/hooks/typography.mjs.map +2 -2
  288. package/build-module/layouts/flex.mjs +105 -7
  289. package/build-module/layouts/flex.mjs.map +2 -2
  290. package/build-module/private-apis.mjs +8 -0
  291. package/build-module/private-apis.mjs.map +2 -2
  292. package/build-module/store/actions.mjs.map +1 -1
  293. package/build-module/store/private-selectors.mjs +18 -1
  294. package/build-module/store/private-selectors.mjs.map +2 -2
  295. package/build-module/store/reducer.mjs.map +1 -1
  296. package/build-module/store/selectors.mjs.map +1 -1
  297. package/build-module/utils/block-bindings.mjs +9 -9
  298. package/build-module/utils/block-bindings.mjs.map +3 -3
  299. package/build-module/utils/color-values.mjs +9 -1
  300. package/build-module/utils/color-values.mjs.map +3 -3
  301. package/build-module/utils/dom.mjs +2 -5
  302. package/build-module/utils/dom.mjs.map +3 -3
  303. package/build-module/utils/fit-text-frontend.mjs +6 -2
  304. package/build-module/utils/fit-text-frontend.mjs.map +3 -3
  305. package/build-module/utils/fit-text-utils.mjs +1 -1
  306. package/build-module/utils/fit-text-utils.mjs.map +3 -3
  307. package/build-module/utils/format-font-style.mjs +1 -1
  308. package/build-module/utils/format-font-style.mjs.map +3 -3
  309. package/build-module/utils/format-font-weight.mjs +1 -1
  310. package/build-module/utils/format-font-weight.mjs.map +3 -3
  311. package/build-module/utils/get-editor-region.mjs +4 -2
  312. package/build-module/utils/get-editor-region.mjs.map +3 -3
  313. package/build-module/utils/get-font-styles-and-weights.mjs +8 -12
  314. package/build-module/utils/get-font-styles-and-weights.mjs.map +3 -3
  315. package/build-module/utils/get-px-from-css-unit.mjs +1 -1
  316. package/build-module/utils/get-px-from-css-unit.mjs.map +1 -1
  317. package/build-module/utils/index.mjs +1 -1
  318. package/build-module/utils/index.mjs.map +1 -1
  319. package/build-module/utils/math.mjs +1 -1
  320. package/build-module/utils/math.mjs.map +3 -3
  321. package/build-module/utils/object.mjs +8 -8
  322. package/build-module/utils/object.mjs.map +3 -3
  323. package/build-module/utils/order-inserter-block-items.mjs +1 -1
  324. package/build-module/utils/order-inserter-block-items.mjs.map +3 -3
  325. package/build-module/utils/pasting.mjs +4 -2
  326. package/build-module/utils/pasting.mjs.map +3 -3
  327. package/build-module/utils/selection.mjs +3 -2
  328. package/build-module/utils/selection.mjs.map +3 -3
  329. package/build-module/utils/sorting.mjs +9 -3
  330. package/build-module/utils/sorting.mjs.map +3 -3
  331. package/build-module/utils/transform-styles/index.mjs +3 -2
  332. package/build-module/utils/transform-styles/index.mjs.map +3 -3
  333. package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs +1 -0
  334. package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs.map +7 -0
  335. package/build-module/utils/transform-styles/types.mjs +1 -0
  336. package/build-module/utils/transform-styles/types.mjs.map +7 -0
  337. package/build-module/utils/types.mjs +1 -0
  338. package/build-module/utils/types.mjs.map +7 -0
  339. package/build-style/content-rtl.css +2 -0
  340. package/build-style/content.css +2 -0
  341. package/build-style/style-rtl.css +34 -41
  342. package/build-style/style.css +34 -41
  343. package/build-types/utils/block-bindings.d.ts +27 -0
  344. package/build-types/utils/block-bindings.d.ts.map +1 -0
  345. package/build-types/utils/color-values.d.ts +40 -0
  346. package/build-types/utils/color-values.d.ts.map +1 -0
  347. package/build-types/utils/dom.d.ts +19 -19
  348. package/build-types/utils/dom.d.ts.map +1 -1
  349. package/build-types/utils/fit-text-frontend.d.ts +7 -0
  350. package/build-types/utils/fit-text-frontend.d.ts.map +1 -0
  351. package/build-types/utils/fit-text-utils.d.ts +15 -0
  352. package/build-types/utils/fit-text-utils.d.ts.map +1 -0
  353. package/build-types/utils/format-font-style.d.ts +12 -0
  354. package/build-types/utils/format-font-style.d.ts.map +1 -0
  355. package/build-types/utils/format-font-weight.d.ts +12 -0
  356. package/build-types/utils/format-font-weight.d.ts.map +1 -0
  357. package/build-types/utils/get-editor-region.d.ts +9 -0
  358. package/build-types/utils/get-editor-region.d.ts.map +1 -0
  359. package/build-types/utils/get-font-styles-and-weights.d.ts +16 -0
  360. package/build-types/utils/get-font-styles-and-weights.d.ts.map +1 -0
  361. package/build-types/utils/get-px-from-css-unit.d.ts +10 -0
  362. package/build-types/utils/get-px-from-css-unit.d.ts.map +1 -0
  363. package/build-types/utils/index.d.ts +3 -0
  364. package/build-types/utils/index.d.ts.map +1 -0
  365. package/build-types/utils/math.d.ts +61 -0
  366. package/build-types/utils/math.d.ts.map +1 -0
  367. package/build-types/utils/object.d.ts +39 -0
  368. package/build-types/utils/object.d.ts.map +1 -0
  369. package/build-types/utils/order-inserter-block-items.d.ts +13 -0
  370. package/build-types/utils/order-inserter-block-items.d.ts.map +1 -0
  371. package/build-types/utils/pasting.d.ts +28 -0
  372. package/build-types/utils/pasting.d.ts.map +1 -0
  373. package/build-types/utils/selection.d.ts +21 -0
  374. package/build-types/utils/selection.d.ts.map +1 -0
  375. package/build-types/utils/sorting.d.ts +17 -0
  376. package/build-types/utils/sorting.d.ts.map +1 -0
  377. package/build-types/utils/transform-styles/index.d.ts +15 -0
  378. package/build-types/utils/transform-styles/index.d.ts.map +1 -0
  379. package/build-types/utils/transform-styles/types.d.ts +13 -0
  380. package/build-types/utils/transform-styles/types.d.ts.map +1 -0
  381. package/build-types/utils/types.d.ts +28 -0
  382. package/build-types/utils/types.d.ts.map +1 -0
  383. package/package.json +46 -40
  384. package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -0
  385. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -0
  386. package/src/components/block-card/index.js +7 -13
  387. package/src/components/block-editing-mode/index.js +17 -9
  388. package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -0
  389. package/src/components/block-inspector/index.js +22 -20
  390. package/src/components/block-patterns-list/index.js +0 -1
  391. package/src/components/block-quick-navigation/index.js +7 -7
  392. package/src/components/block-rename/modal.js +0 -1
  393. package/src/components/block-toolbar/block-toolbar-icon.js +22 -6
  394. package/src/components/block-toolbar/test/block-toolbar-icon.js +99 -0
  395. package/src/components/block-tools/use-block-toolbar-popover-props.js +10 -4
  396. package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +4 -0
  397. package/src/components/child-layout-control/index.js +65 -20
  398. package/src/components/child-layout-control/test/index.js +64 -0
  399. package/src/components/colors-gradients/control.js +29 -12
  400. package/src/components/colors-gradients/dropdown.js +4 -1
  401. package/src/components/colors-gradients/style.scss +39 -2
  402. package/src/components/contrast-checker/README.md +9 -0
  403. package/src/components/contrast-checker/index.js +42 -3
  404. package/src/components/date-format-picker/index.js +0 -1
  405. package/src/components/default-block-appender/content.scss +3 -0
  406. package/src/components/dimensions-tool/index.js +4 -9
  407. package/src/components/dimensions-tool/scale-tool.js +1 -2
  408. package/src/components/dimensions-tool/test/index.js +89 -11
  409. package/src/components/global-styles/background-panel.js +201 -34
  410. package/src/components/global-styles/color-gradient-dropdown-item.js +258 -0
  411. package/src/components/global-styles/color-panel.js +125 -487
  412. package/src/components/global-styles/dimensions-panel.js +1 -5
  413. package/src/components/global-styles/hooks.js +45 -0
  414. package/src/components/global-styles/shadow-panel-components.js +0 -1
  415. package/src/components/global-styles/test/background-panel.js +56 -0
  416. package/src/components/global-styles/test/color-panel.js +172 -118
  417. package/src/components/global-styles/test/typography-panel.js +167 -0
  418. package/src/components/global-styles/typography-panel.js +100 -11
  419. package/src/components/iframe/index.js +8 -3
  420. package/src/components/inserter/media-tab/media-preview.js +0 -1
  421. package/src/components/inspector-controls/README.md +0 -2
  422. package/src/components/inspector-controls/fill.js +6 -8
  423. package/src/components/inspector-controls/groups.js +2 -0
  424. package/src/components/inspector-controls-tabs/index.js +0 -1
  425. package/src/components/inspector-controls-tabs/styles-tab.js +78 -28
  426. package/src/components/link-control/index.js +0 -1
  427. package/src/components/link-control/test/index.js +2 -3
  428. package/src/components/list-view/block-select-button.js +2 -18
  429. package/src/components/preset-input-control/custom-value-controls.js +0 -1
  430. package/src/components/provider/use-block-sync.js +3 -1
  431. package/src/components/rich-text/content.scss +2 -0
  432. package/src/components/url-popover/image-url-input-ui.js +0 -2
  433. package/src/components/use-block-display-information/index.js +15 -2
  434. package/src/components/use-block-display-information/test/index.js +140 -0
  435. package/src/hooks/anchor.js +0 -1
  436. package/src/hooks/background.js +210 -133
  437. package/src/hooks/background.scss +0 -35
  438. package/src/hooks/block-fields/index.js +27 -2
  439. package/src/hooks/color.js +2 -205
  440. package/src/hooks/color.scss +3 -9
  441. package/src/hooks/contrast-checker.js +60 -17
  442. package/src/hooks/custom-class-name.js +0 -1
  443. package/src/hooks/dimensions.js +14 -3
  444. package/src/hooks/elements.js +140 -0
  445. package/src/hooks/elements.scss +8 -0
  446. package/src/hooks/grid-visualizer.js +59 -45
  447. package/src/hooks/layout-child.js +92 -14
  448. package/src/hooks/layout.js +6 -3
  449. package/src/hooks/list-view.js +10 -11
  450. package/src/hooks/states.js +2 -2
  451. package/src/hooks/style.js +91 -9
  452. package/src/hooks/test/background.js +59 -0
  453. package/src/hooks/test/block-style-state.js +14 -14
  454. package/src/hooks/test/dimensions.js +71 -0
  455. package/src/hooks/test/layout-child.js +165 -0
  456. package/src/hooks/test/layout.js +6 -6
  457. package/src/hooks/test/style.js +133 -11
  458. package/src/hooks/typography.js +70 -6
  459. package/src/layouts/flex.js +118 -15
  460. package/src/private-apis.js +8 -0
  461. package/src/store/private-selectors.js +47 -0
  462. package/src/store/test/private-selectors.js +166 -7
  463. package/src/store/test/reducer.js +61 -10
  464. package/src/style.scss +1 -0
  465. package/src/utils/block-bindings.ts +51 -0
  466. package/src/utils/color-values.ts +63 -0
  467. package/src/utils/{dom.js → dom.ts} +27 -27
  468. package/src/utils/{fit-text-frontend.js → fit-text-frontend.ts} +12 -4
  469. package/src/utils/{fit-text-utils.js → fit-text-utils.ts} +15 -7
  470. package/src/utils/{format-font-style.js → format-font-style.ts} +10 -3
  471. package/src/utils/{format-font-weight.js → format-font-weight.ts} +10 -3
  472. package/src/utils/{get-editor-region.js → get-editor-region.ts} +10 -6
  473. package/src/utils/{get-font-styles-and-weights.js → get-font-styles-and-weights.ts} +21 -17
  474. package/src/utils/{math.js → math.ts} +37 -30
  475. package/src/utils/object.ts +89 -0
  476. package/src/utils/{order-inserter-block-items.js → order-inserter-block-items.ts} +8 -5
  477. package/src/utils/{pasting.js → pasting.ts} +18 -11
  478. package/src/utils/{selection.js → selection.ts} +11 -4
  479. package/src/utils/sorting.ts +81 -0
  480. package/src/utils/test/color-values.js +44 -1
  481. package/src/utils/transform-styles/{index.js → index.ts} +25 -25
  482. package/src/utils/transform-styles/postcss-urlrebase.d.ts +15 -0
  483. package/src/utils/transform-styles/types.ts +13 -0
  484. package/src/utils/types.ts +29 -0
  485. package/src/utils/block-bindings.js +0 -46
  486. package/src/utils/color-values.js +0 -28
  487. package/src/utils/object.js +0 -67
  488. package/src/utils/sorting.js +0 -54
  489. /package/src/utils/{get-px-from-css-unit.js → get-px-from-css-unit.ts} +0 -0
  490. /package/src/utils/{index.js → index.ts} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/layout.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useCallback } from '@wordpress/element';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\tToggleControl,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport { useSettings } from '../components/use-settings';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { LAYOUT_DEFINITIONS } from '../layouts/definitions';\nimport { cleanEmptyObject, useBlockSettings, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\nimport { globalStylesDataKey } from '../store/private-keys';\nimport { getVariationNameFromClass } from './block-style-variation';\nimport {\n\tDEFAULT_BLOCK_STYLE_STATE,\n\tgetStyleForState,\n\thasPseudoBlockStyleState,\n\thasViewportBlockStyleState,\n\tisDefaultBlockStyleState,\n\tsetStyleForState,\n} from './block-style-state';\n\nconst VARIATION_PREFIX = 'is-style-';\n\nconst layoutBlockSupportKey = 'layout';\n// Keep in sync with WP_Theme_JSON_Gutenberg::RESPONSIVE_BREAKPOINTS and\n// packages/global-styles-engine/src/core/render.tsx.\nconst RESPONSIVE_BREAKPOINTS = {\n\tmobile: '@media (width <= 480px)',\n\ttablet: '@media (480px < width <= 782px)',\n};\nconst CHILD_LAYOUT_KEYS = [\n\t'selfStretch',\n\t'flexSize',\n\t'columnStart',\n\t'columnSpan',\n\t'rowStart',\n\t'rowSpan',\n];\nconst { kebabCase } = unlock( componentsPrivateApis );\n\nfunction getDefaultLayout( layoutBlockSupport = {}, blockVariation ) {\n\tconst defaultBlockLayout = layoutBlockSupport?.default;\n\n\treturn blockVariation?.attributes?.layout ?? defaultBlockLayout;\n}\n\n/**\n * Returns the layout values to use when resetting layout controls.\n *\n * @param { Object } layoutBlockSupport Block layout support settings.\n * @param { Object|undefined } blockVariation Block variation settings.\n *\n * @return { Object|undefined } Reset layout values.\n */\nexport function getResetLayout( layoutBlockSupport = {}, blockVariation ) {\n\treturn cleanEmptyObject( {\n\t\t...getDefaultLayout( layoutBlockSupport, blockVariation ),\n\t} );\n}\n\nfunction getLayoutStateOverrides(\n\tlayout = {},\n\tbaseLayout = {},\n\texistingLayout = {}\n) {\n\tconst overrides = {};\n\tconst childLayoutValues = Object.fromEntries(\n\t\tCHILD_LAYOUT_KEYS.filter( ( key ) =>\n\t\t\tObject.hasOwn( existingLayout || {}, key )\n\t\t).map( ( key ) => [ key, existingLayout[ key ] ] )\n\t);\n\n\tObject.entries( layout || {} ).forEach( ( [ key, value ] ) => {\n\t\tif (\n\t\t\t! CHILD_LAYOUT_KEYS.includes( key ) &&\n\t\t\tvalue !== baseLayout?.[ key ]\n\t\t) {\n\t\t\toverrides[ key ] = value;\n\t\t}\n\t} );\n\n\treturn cleanEmptyObject( {\n\t\t...childLayoutValues,\n\t\t...overrides,\n\t} );\n}\n\nfunction getLayoutContainerValues( layout = {} ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( layout || {} ).filter(\n\t\t\t( [ key ] ) => ! CHILD_LAYOUT_KEYS.includes( key )\n\t\t)\n\t);\n}\n\nfunction hasLayoutBlockSupport( blockName ) {\n\treturn (\n\t\thasBlockSupport( blockName, 'layout' ) ||\n\t\thasBlockSupport( blockName, '__experimentalLayout' )\n\t);\n}\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst { layout } = blockAttributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif ( LAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className ) {\n\t\tconst baseClassName =\n\t\t\tLAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className;\n\t\tconst splitBlockName = blockName.split( '/' );\n\t\tconst fullBlockName =\n\t\t\tsplitBlockName[ 0 ] === 'core'\n\t\t\t\t? splitBlockName.pop()\n\t\t\t\t: splitBlockName.join( '-' );\n\t\tconst compoundClassName = `wp-block-${ fullBlockName }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tconst hasGlobalPadding = useSelect(\n\t\t( select ) => {\n\t\t\t// Early return to avoid subscription when layout doesn't use global padding\n\t\t\tif (\n\t\t\t\t! usedLayout?.inherit &&\n\t\t\t\t! usedLayout?.contentSize &&\n\t\t\t\tusedLayout?.type !== 'constrained'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn select( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalFeatures?.useRootPaddingAwareAlignments;\n\t\t},\n\t\t[ usedLayout?.contentSize, usedLayout?.inherit, usedLayout?.type ]\n\t);\n\n\tif ( hasGlobalPadding ) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\treturn fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n}\n\n/**\n * Generates responsive layout CSS for viewport state styles.\n *\n * Viewport state blockGap values need to go through the layout definitions\n * because flow/constrained layouts use child margins while flex/grid use gap.\n *\n * @param { Object } options Options.\n * @param { Object } options.attributes Block attributes.\n * @param { string } options.blockName Block name.\n * @param { string } options.selector CSS selector.\n * @param { Object } options.layout Active block layout.\n * @param { boolean } options.hasBlockGapSupport Whether block gap is supported.\n * @param { * } options.globalBlockGapValue Global block gap fallback.\n *\n * @return { string } CSS rule.\n */\nexport function getResponsiveLayoutStyles( {\n\tattributes = {},\n\tblockName,\n\tselector,\n\tlayout = {},\n\thasBlockGapSupport,\n\tglobalBlockGapValue,\n} ) {\n\treturn Object.entries( RESPONSIVE_BREAKPOINTS )\n\t\t.map( ( [ viewport, mediaQuery ] ) => {\n\t\t\tconst viewportStyle = attributes?.style?.[ viewport ];\n\t\t\tconst viewportLayout = getLayoutContainerValues(\n\t\t\t\tviewportStyle?.layout\n\t\t\t);\n\t\t\tconst hasViewportLayout = Object.keys( viewportLayout ).length > 0;\n\t\t\tconst hasViewportBlockGap =\n\t\t\t\tviewportStyle?.spacing &&\n\t\t\t\tObject.hasOwn( viewportStyle.spacing, 'blockGap' );\n\t\t\tconst hasViewportPadding =\n\t\t\t\tviewportStyle?.spacing &&\n\t\t\t\tObject.hasOwn( viewportStyle.spacing, 'padding' );\n\t\t\tif (\n\t\t\t\t! hasViewportLayout &&\n\t\t\t\t! hasViewportBlockGap &&\n\t\t\t\t! hasViewportPadding\n\t\t\t) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst layoutType = getLayoutType( layout?.type || 'default' );\n\t\t\tconst viewportCSS = layoutType?.getLayoutStyle?.( {\n\t\t\t\tblockName,\n\t\t\t\tselector,\n\t\t\t\tlayout,\n\t\t\t\tviewportOverrides: viewportLayout,\n\t\t\t\tstyle: viewportStyle,\n\t\t\t\thasBlockGapSupport,\n\t\t\t\tglobalBlockGapValue,\n\t\t\t} );\n\n\t\t\treturn viewportCSS ? `${ mediaQuery }{${ viewportCSS }}` : '';\n\t\t} )\n\t\t.filter( Boolean )\n\t\t.join( '' );\n}\n\nfunction LayoutPanelPure( {\n\tlayout,\n\tstyle,\n\tsetAttributes,\n\tname: blockName,\n\tclientId,\n} ) {\n\tconst settings = useBlockSettings( blockName );\n\t// Block settings come from theme.json under settings.[blockName].\n\tconst { layout: layoutSettings } = settings;\n\tconst { themeSupportsLayout, activeBlockVariation, selectedState } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst blockEditorSelect = select( blockEditorStore );\n\t\t\t\tconst { getBlockAttributes, getSettings } = blockEditorSelect;\n\t\t\t\tconst { getSelectedBlockStyleState } =\n\t\t\t\t\tunlock( blockEditorSelect );\n\t\t\t\treturn {\n\t\t\t\t\tactiveBlockVariation: select(\n\t\t\t\t\t\tblocksStore\n\t\t\t\t\t).getActiveBlockVariation(\n\t\t\t\t\t\tblockName,\n\t\t\t\t\t\tgetBlockAttributes( clientId ) || {},\n\t\t\t\t\t\t'block'\n\t\t\t\t\t),\n\t\t\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t\t\t\tselectedState:\n\t\t\t\t\t\tgetSelectedBlockStyleState?.( clientId ) ??\n\t\t\t\t\t\tDEFAULT_BLOCK_STYLE_STATE,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ blockName, clientId ]\n\t\t);\n\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isViewportLayoutState =\n\t\thasViewportBlockStyleState( selectedState ) &&\n\t\t! hasPseudoBlockStyleState( selectedState );\n\tconst resetLayoutFilter = useCallback(\n\t\t( ...resetArgs ) => {\n\t\t\tconst attributes = resetArgs[ 0 ] || {};\n\t\t\tconst context = resetArgs[ 1 ] || {};\n\n\t\t\tif ( isViewportLayoutState ) {\n\t\t\t\tconst existingStateStyle =\n\t\t\t\t\tgetStyleForState(\n\t\t\t\t\t\tattributes.style ?? style,\n\t\t\t\t\t\tselectedState\n\t\t\t\t\t) || {};\n\t\t\t\tconst nextStateStyle = cleanEmptyObject( {\n\t\t\t\t\t...existingStateStyle,\n\t\t\t\t\tlayout: undefined,\n\t\t\t\t} );\n\n\t\t\t\treturn {\n\t\t\t\t\tstyle: setStyleForState(\n\t\t\t\t\t\tattributes.style ?? style,\n\t\t\t\t\t\tselectedState,\n\t\t\t\t\t\tnextStateStyle\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst resetBlockName = context.name || blockName;\n\t\t\tconst resetLayoutBlockSupport = getBlockSupport(\n\t\t\t\tresetBlockName,\n\t\t\t\tlayoutBlockSupportKey,\n\t\t\t\t{}\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlayout: getResetLayout(\n\t\t\t\t\tresetLayoutBlockSupport,\n\t\t\t\t\tactiveBlockVariation\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tblockName,\n\t\t\tactiveBlockVariation,\n\t\t\tisViewportLayoutState,\n\t\t\tselectedState,\n\t\t\tstyle,\n\t\t]\n\t);\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\t// Layout block support comes from the block's block.json.\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst blockSupportAndThemeSettings = {\n\t\t...layoutSettings,\n\t\t...layoutBlockSupport,\n\t};\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = blockSupportAndThemeSettings;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t/*\n\t * Try to find the layout type from either the\n\t * block's layout settings or any saved layout config.\n\t */\n\tconst baseLayout = layout || defaultBlockLayout || {};\n\tconst stateStyle = isViewportLayoutState\n\t\t? getStyleForState( style, selectedState )\n\t\t: undefined;\n\tconst stateLayout = stateStyle?.layout;\n\tconst usedLayout = isViewportLayoutState\n\t\t? cleanEmptyObject( {\n\t\t\t\t...baseLayout,\n\t\t\t\t...stateLayout,\n\t\t } ) || {}\n\t\t: baseLayout;\n\tconst resetLayoutDefaults = isViewportLayoutState\n\t\t? baseLayout\n\t\t: getResetLayout( layoutBlockSupport, activeBlockVariation );\n\tconst blockSupportAndLayout = {\n\t\t...layoutBlockSupport,\n\t\t...usedLayout,\n\t};\n\tconst { type, default: { type: defaultType = 'default' } = {} } =\n\t\tblockSupportAndLayout;\n\tconst blockLayoutType = type || defaultType;\n\n\t// Only show the inherit toggle if it's supported,\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t( ! blockLayoutType ||\n\t\t\tblockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ||\n\t\t\tblockSupportAndLayout.inherit )\n\t);\n\n\tconst { inherit = false, contentSize = null } = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( blockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( blockLayoutType );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\tconst showLayoutTypeSwitcher =\n\t\tisDefaultBlockStyleState( selectedState ) &&\n\t\t! inherit &&\n\t\tallowSwitching;\n\n\tconst onChangeLayout = ( newLayout ) => {\n\t\tif ( isViewportLayoutState ) {\n\t\t\tconst nextStateStyle = cleanEmptyObject( {\n\t\t\t\t...stateStyle,\n\t\t\t\tlayout: getLayoutStateOverrides(\n\t\t\t\t\tcleanEmptyObject( newLayout ),\n\t\t\t\t\tbaseLayout,\n\t\t\t\t\tstateStyle?.layout\n\t\t\t\t),\n\t\t\t} );\n\t\t\tsetAttributes( {\n\t\t\t\tstyle: setStyleForState( style, selectedState, nextStateStyle ),\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes( { layout: cleanEmptyObject( newLayout ) } );\n\t};\n\tconst onChangeType = ( newType ) => onChangeLayout( { type: newType } );\n\tconst resetLayout = () => onChangeLayout( resetLayoutDefaults );\n\tconst resetInheritToggle = () => onChangeLayout( { type: 'default' } );\n\tconst isUsingContentWidth = () =>\n\t\tlayoutType?.name === 'constrained' || hasContentSizeOrLegacySettings;\n\tconst hasInheritToggleValue = () =>\n\t\tisViewportLayoutState\n\t\t\t? ( usedLayout?.type ?? 'default' ) !==\n\t\t\t ( resetLayoutDefaults?.type ?? 'default' )\n\t\t\t: layout?.type === 'constrained';\n\tconst hasLayoutTypeValue = () =>\n\t\t( usedLayout?.type ?? 'default' ) !==\n\t\t( resetLayoutDefaults?.type ?? 'default' );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls\n\t\t\t\tgroup=\"layout\"\n\t\t\t\tresetAllFilter={ resetLayoutFilter }\n\t\t\t>\n\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Use content width' ) }\n\t\t\t\t\t\thasValue={ hasInheritToggleValue }\n\t\t\t\t\t\tonDeselect={ resetInheritToggle }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\tchecked={ isUsingContentWidth() }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tonChangeLayout( {\n\t\t\t\t\t\t\t\t\ttype: isUsingContentWidth()\n\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tisUsingContentWidth()\n\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\n\t\t\t\t{ showLayoutTypeSwitcher && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Layout type' ) }\n\t\t\t\t\t\thasValue={ hasLayoutTypeValue }\n\t\t\t\t\t\tonDeselect={ resetLayout }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ blockLayoutType }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\n\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\tvalue={ layout }\n\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\tresetLayout={ resetLayoutDefaults }\n\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\tvalue={ layout }\n\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\tresetLayout={ resetLayoutDefaults }\n\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\tname={ blockName }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: LayoutPanelPure,\n\tattributeKeys: [ 'layout', 'style' ],\n\thasSupport( name ) {\n\t\treturn hasLayoutBlockSupport( name );\n\t},\n};\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__next40pxDefaultSize\n\t\t\tisBlock\n\t\t\tlabel={ __( 'Layout type' ) }\n\t\t\thideLabelFromVision\n\t\t\tisAdaptiveWidth\n\t\t\tvalue={ type }\n\t\t\tonChange={ onChange }\n\t\t>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tvalue={ name }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ToggleGroupControl>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasLayoutBlockSupport( settings ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockWithLayoutStyles( {\n\tblock: BlockListBlock,\n\tprops,\n\tblockGapSupport,\n\tglobalBlockGapValue,\n\tlayoutClasses,\n} ) {\n\tconst { name, attributes } = props;\n\tconst id = useInstanceId( BlockListBlock );\n\tconst { layout } = attributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;\n\t// Higher specificity to override defaults from theme.json.\n\tconst selector = `.${ selectorPrefix }${ id }`;\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t// Get CSS string for the current layout type.\n\t// The CSS and `style` element is only output if it is not empty.\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst baseLayoutCSS = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\tstyle: attributes?.style,\n\t\thasBlockGapSupport,\n\t\tglobalBlockGapValue,\n\t} );\n\tconst responsiveLayoutCSS = getResponsiveLayoutStyles( {\n\t\tattributes,\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\thasBlockGapSupport,\n\t\tglobalBlockGapValue,\n\t} );\n\tconst css = [ baseLayoutCSS, responsiveLayoutCSS ]\n\t\t.filter( Boolean )\n\t\t.join( '' );\n\n\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\tconst layoutClassNames = clsx(\n\t\t{\n\t\t\t[ `${ selectorPrefix }${ id }` ]: !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t},\n\t\tlayoutClasses\n\t);\n\n\tuseStyleOverride( { css } );\n\n\treturn (\n\t\t<BlockListBlock\n\t\t\t{ ...props }\n\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t/>\n\t);\n}\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) =>\n\t\tfunction WithLayoutStyles( props ) {\n\t\t\tconst { clientId, name, attributes } = props;\n\t\t\tconst blockSupportsLayout = hasLayoutBlockSupport( name );\n\t\t\tconst layoutClasses = useLayoutClasses( attributes, name );\n\t\t\tconst extraProps = useSelect(\n\t\t\t\t( select ) => {\n\t\t\t\t\t// The callback returns early to avoid block editor subscription.\n\t\t\t\t\tif ( ! blockSupportsLayout ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst { getSettings, getBlockSettings } = unlock(\n\t\t\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t);\n\t\t\t\t\tconst settings = getSettings();\n\t\t\t\t\tconst { disableLayoutStyles } = settings;\n\n\t\t\t\t\tif ( disableLayoutStyles ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst [ blockGapSupport ] = getBlockSettings(\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t'spacing.blockGap'\n\t\t\t\t\t);\n\n\t\t\t\t\t// Get default blockGap value from global styles for use in layouts like grid.\n\t\t\t\t\t// Check style variation first, then block-specific styles, then fall back to root styles.\n\t\t\t\t\tconst globalStyles = settings[ globalStylesDataKey ];\n\n\t\t\t\t\t// Check if the block has an active style variation with a blockGap value.\n\t\t\t\t\t// Only check the registry if the className contains a variation class to avoid unnecessary lookups.\n\t\t\t\t\tlet variationBlockGapValue;\n\t\t\t\t\tconst className = attributes?.className;\n\t\t\t\t\tif ( className?.includes( VARIATION_PREFIX ) ) {\n\t\t\t\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\t\t\t\tconst registeredStyles = getBlockStyles( name );\n\t\t\t\t\t\tconst variationName = getVariationNameFromClass(\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\tregisteredStyles\n\t\t\t\t\t\t);\n\t\t\t\t\t\tvariationBlockGapValue = variationName\n\t\t\t\t\t\t\t? globalStyles?.blocks?.[ name ]?.variations?.[\n\t\t\t\t\t\t\t\t\tvariationName\n\t\t\t\t\t\t\t ]?.spacing?.blockGap\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst globalBlockGapValue =\n\t\t\t\t\t\tvariationBlockGapValue ??\n\t\t\t\t\t\tglobalStyles?.blocks?.[ name ]?.spacing?.blockGap ??\n\t\t\t\t\t\tglobalStyles?.spacing?.blockGap;\n\n\t\t\t\t\treturn { blockGapSupport, globalBlockGapValue };\n\t\t\t\t},\n\t\t\t\t[ blockSupportsLayout, clientId, attributes?.className, name ]\n\t\t\t);\n\n\t\t\tif ( ! extraProps ) {\n\t\t\t\treturn (\n\t\t\t\t\t<BlockListBlock\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t__unstableLayoutClassNames={\n\t\t\t\t\t\t\tblockSupportsLayout ? layoutClasses : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<BlockWithLayoutStyles\n\t\t\t\t\tblock={ BlockListBlock }\n\t\t\t\t\tprops={ props }\n\t\t\t\t\tlayoutClasses={ layoutClasses }\n\t\t\t\t\t{ ...extraProps }\n\t\t\t\t/>\n\t\t\t);\n\t\t},\n\t'withLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\n"],
5
- "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,4BAA4B,qBAAqB;AAC1D,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,iBAAiB;AAC1B;AAAA,EACC,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,EAC1C;AAAA,EACA,gCAAgC;AAAA,EAChC,eAAe;AAAA,OACT;AACP,SAAS,UAAU;AAKnB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,eAAe,sBAAsB;AAC9C,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,kBAAkB,kBAAkB,wBAAwB;AACrE,SAAS,cAAc;AACvB,SAAS,2BAA2B;AACpC,SAAS,iCAAiC;AAC1C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AA+bL,mBAaI,KAZH,YADD;AA7bF,IAAM,mBAAmB;AAEzB,IAAM,wBAAwB;AAG9B,IAAM,yBAAyB;AAAA,EAC9B,QAAQ;AAAA,EACR,QAAQ;AACT;AACA,IAAM,oBAAoB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;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rB;AAAA,YACA;AAAA,UACD;AACA,mCAAyB,gBACtB,cAAc,SAAU,IAAK,GAAG,aAChC,aACA,GAAG,SAAS,WACZ;AAAA,QACJ;AAEA,cAAM,sBACL,0BACA,cAAc,SAAU,IAAK,GAAG,SAAS,YACzC,cAAc,SAAS;AAExB,eAAO,EAAE,iBAAiB,oBAAoB;AAAA,MAC/C;AAAA,MACA,CAAE,qBAAqB,UAAU,YAAY,WAAW,IAAK;AAAA,IAC9D;AAEA,QAAK,CAAE,YAAa;AACnB,aACC;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACL,4BACC,sBAAsB,gBAAgB;AAAA;AAAA,MAExC;AAAA,IAEF;AAEA,WACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ;AAAA,QACR;AAAA,QACA;AAAA,QACE,GAAG;AAAA;AAAA,IACN;AAAA,EAEF;AAAA,EACD;AACD;AAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;AACA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useCallback } from '@wordpress/element';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\tToggleControl,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport { useSettings } from '../components/use-settings';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { LAYOUT_DEFINITIONS } from '../layouts/definitions';\nimport { cleanEmptyObject, useBlockSettings, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\nimport { globalStylesDataKey } from '../store/private-keys';\nimport { getVariationNameFromClass } from './block-style-variation';\nimport {\n\tDEFAULT_BLOCK_STYLE_STATE,\n\tgetStyleForState,\n\thasPseudoBlockStyleState,\n\thasViewportBlockStyleState,\n\tisDefaultBlockStyleState,\n\tsetStyleForState,\n} from './block-style-state';\n\nconst VARIATION_PREFIX = 'is-style-';\n\nconst layoutBlockSupportKey = 'layout';\n// Keep in sync with WP_Theme_JSON_Gutenberg::RESPONSIVE_BREAKPOINTS and\n// packages/global-styles-engine/src/core/render.tsx.\nconst RESPONSIVE_BREAKPOINTS = {\n\t'@mobile': '@media (width <= 480px)',\n\t'@tablet': '@media (480px < width <= 782px)',\n};\nconst CHILD_LAYOUT_KEYS = [\n\t'selfStretch',\n\t'flexSize',\n\t'columnStart',\n\t'columnSpan',\n\t'rowStart',\n\t'rowSpan',\n];\nconst { kebabCase } = unlock( componentsPrivateApis );\n\nfunction getDefaultLayout( layoutBlockSupport = {}, blockVariation ) {\n\tconst defaultBlockLayout = layoutBlockSupport?.default;\n\n\treturn blockVariation?.attributes?.layout ?? defaultBlockLayout;\n}\n\n/**\n * Returns the layout values to use when resetting layout controls.\n *\n * @param { Object } layoutBlockSupport Block layout support settings.\n * @param { Object|undefined } blockVariation Block variation settings.\n *\n * @return { Object|undefined } Reset layout values.\n */\nexport function getResetLayout( layoutBlockSupport = {}, blockVariation ) {\n\treturn cleanEmptyObject( {\n\t\t...getDefaultLayout( layoutBlockSupport, blockVariation ),\n\t} );\n}\n\nfunction getLayoutStateOverrides(\n\tlayout = {},\n\tbaseLayout = {},\n\texistingLayout = {}\n) {\n\tconst overrides = {};\n\tconst childLayoutValues = Object.fromEntries(\n\t\tCHILD_LAYOUT_KEYS.filter( ( key ) =>\n\t\t\tObject.hasOwn( existingLayout || {}, key )\n\t\t).map( ( key ) => [ key, existingLayout[ key ] ] )\n\t);\n\n\tObject.entries( layout || {} ).forEach( ( [ key, value ] ) => {\n\t\tif (\n\t\t\t! CHILD_LAYOUT_KEYS.includes( key ) &&\n\t\t\tvalue !== baseLayout?.[ key ]\n\t\t) {\n\t\t\toverrides[ key ] = value;\n\t\t}\n\t} );\n\n\treturn cleanEmptyObject( {\n\t\t...childLayoutValues,\n\t\t...overrides,\n\t} );\n}\n\nfunction getLayoutContainerValues( layout = {} ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( layout || {} ).filter(\n\t\t\t( [ key ] ) => ! CHILD_LAYOUT_KEYS.includes( key )\n\t\t)\n\t);\n}\n\nfunction hasLayoutBlockSupport( blockName ) {\n\treturn (\n\t\thasBlockSupport( blockName, 'layout' ) ||\n\t\thasBlockSupport( blockName, '__experimentalLayout' )\n\t);\n}\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst { layout } = blockAttributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif ( LAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className ) {\n\t\tconst baseClassName =\n\t\t\tLAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className;\n\t\tconst splitBlockName = blockName.split( '/' );\n\t\tconst fullBlockName =\n\t\t\tsplitBlockName[ 0 ] === 'core'\n\t\t\t\t? splitBlockName.pop()\n\t\t\t\t: splitBlockName.join( '-' );\n\t\tconst compoundClassName = `wp-block-${ fullBlockName }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tconst hasGlobalPadding = useSelect(\n\t\t( select ) => {\n\t\t\t// Early return to avoid subscription when layout doesn't use global padding\n\t\t\tif (\n\t\t\t\t! usedLayout?.inherit &&\n\t\t\t\t! usedLayout?.contentSize &&\n\t\t\t\tusedLayout?.type !== 'constrained'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn select( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalFeatures?.useRootPaddingAwareAlignments;\n\t\t},\n\t\t[ usedLayout?.contentSize, usedLayout?.inherit, usedLayout?.type ]\n\t);\n\n\tif ( hasGlobalPadding ) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\treturn fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n}\n\n/**\n * Generates responsive layout CSS for viewport state styles.\n *\n * Viewport state blockGap values need to go through the layout definitions\n * because flow/constrained layouts use child margins while flex/grid use gap.\n *\n * @param { Object } options Options.\n * @param { Object } options.attributes Block attributes.\n * @param { string } options.blockName Block name.\n * @param { string } options.selector CSS selector.\n * @param { Object } options.layout Active block layout.\n * @param { boolean } options.hasBlockGapSupport Whether block gap is supported.\n * @param { * } options.globalBlockGapValue Global block gap fallback.\n *\n * @return { string } CSS rule.\n */\nexport function getResponsiveLayoutStyles( {\n\tattributes = {},\n\tblockName,\n\tselector,\n\tlayout = {},\n\thasBlockGapSupport,\n\tglobalBlockGapValue,\n} ) {\n\treturn Object.entries( RESPONSIVE_BREAKPOINTS )\n\t\t.map( ( [ viewport, mediaQuery ] ) => {\n\t\t\tconst viewportStyle = getStyleForState( attributes?.style, {\n\t\t\t\tviewport,\n\t\t\t\tpseudo: DEFAULT_BLOCK_STYLE_STATE.pseudo,\n\t\t\t} );\n\t\t\tconst viewportLayout = getLayoutContainerValues(\n\t\t\t\tviewportStyle?.layout\n\t\t\t);\n\t\t\tconst hasViewportLayout = Object.keys( viewportLayout ).length > 0;\n\t\t\tconst hasViewportBlockGap =\n\t\t\t\tviewportStyle?.spacing &&\n\t\t\t\tObject.hasOwn( viewportStyle.spacing, 'blockGap' );\n\t\t\tconst hasViewportPadding =\n\t\t\t\tviewportStyle?.spacing &&\n\t\t\t\tObject.hasOwn( viewportStyle.spacing, 'padding' );\n\t\t\tif (\n\t\t\t\t! hasViewportLayout &&\n\t\t\t\t! hasViewportBlockGap &&\n\t\t\t\t! hasViewportPadding\n\t\t\t) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst layoutType = getLayoutType( layout?.type || 'default' );\n\t\t\tconst viewportCSS = layoutType?.getLayoutStyle?.( {\n\t\t\t\tblockName,\n\t\t\t\tselector,\n\t\t\t\tlayout,\n\t\t\t\tviewportOverrides: viewportLayout,\n\t\t\t\tstyle: viewportStyle,\n\t\t\t\thasBlockGapSupport,\n\t\t\t\tglobalBlockGapValue,\n\t\t\t} );\n\n\t\t\treturn viewportCSS ? `${ mediaQuery }{${ viewportCSS }}` : '';\n\t\t} )\n\t\t.filter( Boolean )\n\t\t.join( '' );\n}\n\nfunction LayoutPanelPure( {\n\tlayout,\n\tstyle,\n\tsetAttributes,\n\tname: blockName,\n\tclientId,\n} ) {\n\tconst settings = useBlockSettings( blockName );\n\t// Block settings come from theme.json under settings.[blockName].\n\tconst { layout: layoutSettings } = settings;\n\tconst { themeSupportsLayout, activeBlockVariation, selectedState } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst blockEditorSelect = select( blockEditorStore );\n\t\t\t\tconst { getBlockAttributes, getSettings } = blockEditorSelect;\n\t\t\t\tconst { getSelectedBlockStyleState } =\n\t\t\t\t\tunlock( blockEditorSelect );\n\t\t\t\treturn {\n\t\t\t\t\tactiveBlockVariation: select(\n\t\t\t\t\t\tblocksStore\n\t\t\t\t\t).getActiveBlockVariation(\n\t\t\t\t\t\tblockName,\n\t\t\t\t\t\tgetBlockAttributes( clientId ) || {},\n\t\t\t\t\t\t'block'\n\t\t\t\t\t),\n\t\t\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t\t\t\tselectedState:\n\t\t\t\t\t\tgetSelectedBlockStyleState?.( clientId ) ??\n\t\t\t\t\t\tDEFAULT_BLOCK_STYLE_STATE,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ blockName, clientId ]\n\t\t);\n\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isViewportLayoutState =\n\t\thasViewportBlockStyleState( selectedState ) &&\n\t\t! hasPseudoBlockStyleState( selectedState );\n\tconst resetLayoutFilter = useCallback(\n\t\t( ...resetArgs ) => {\n\t\t\tconst attributes = resetArgs[ 0 ] || {};\n\t\t\tconst context = resetArgs[ 1 ] || {};\n\n\t\t\tif ( isViewportLayoutState ) {\n\t\t\t\tconst existingStateStyle =\n\t\t\t\t\tgetStyleForState(\n\t\t\t\t\t\tattributes.style ?? style,\n\t\t\t\t\t\tselectedState\n\t\t\t\t\t) || {};\n\t\t\t\tconst nextStateStyle = cleanEmptyObject( {\n\t\t\t\t\t...existingStateStyle,\n\t\t\t\t\tlayout: undefined,\n\t\t\t\t} );\n\n\t\t\t\treturn {\n\t\t\t\t\tstyle: setStyleForState(\n\t\t\t\t\t\tattributes.style ?? style,\n\t\t\t\t\t\tselectedState,\n\t\t\t\t\t\tnextStateStyle\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst resetBlockName = context.name || blockName;\n\t\t\tconst resetLayoutBlockSupport = getBlockSupport(\n\t\t\t\tresetBlockName,\n\t\t\t\tlayoutBlockSupportKey,\n\t\t\t\t{}\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tlayout: getResetLayout(\n\t\t\t\t\tresetLayoutBlockSupport,\n\t\t\t\t\tactiveBlockVariation\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tblockName,\n\t\t\tactiveBlockVariation,\n\t\t\tisViewportLayoutState,\n\t\t\tselectedState,\n\t\t\tstyle,\n\t\t]\n\t);\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\t// Layout block support comes from the block's block.json.\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst blockSupportAndThemeSettings = {\n\t\t...layoutSettings,\n\t\t...layoutBlockSupport,\n\t};\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = blockSupportAndThemeSettings;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t/*\n\t * Try to find the layout type from either the\n\t * block's layout settings or any saved layout config.\n\t */\n\tconst baseLayout = layout || defaultBlockLayout || {};\n\tconst stateStyle = isViewportLayoutState\n\t\t? getStyleForState( style, selectedState )\n\t\t: undefined;\n\tconst stateLayout = stateStyle?.layout;\n\tconst usedLayout = isViewportLayoutState\n\t\t? cleanEmptyObject( {\n\t\t\t\t...baseLayout,\n\t\t\t\t...stateLayout,\n\t\t } ) || {}\n\t\t: baseLayout;\n\tconst resetLayoutDefaults = isViewportLayoutState\n\t\t? baseLayout\n\t\t: getResetLayout( layoutBlockSupport, activeBlockVariation );\n\tconst blockSupportAndLayout = {\n\t\t...layoutBlockSupport,\n\t\t...usedLayout,\n\t};\n\tconst { type, default: { type: defaultType = 'default' } = {} } =\n\t\tblockSupportAndLayout;\n\tconst blockLayoutType = type || defaultType;\n\n\t// Only show the inherit toggle if it's supported,\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t( ! blockLayoutType ||\n\t\t\tblockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ||\n\t\t\tblockSupportAndLayout.inherit )\n\t);\n\n\tconst { inherit = false, contentSize = null } = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( blockLayoutType === 'default' ||\n\t\t\tblockLayoutType === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( blockLayoutType );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\tconst showLayoutTypeSwitcher =\n\t\tisDefaultBlockStyleState( selectedState ) &&\n\t\t! inherit &&\n\t\tallowSwitching;\n\n\tconst onChangeLayout = ( newLayout ) => {\n\t\tif ( isViewportLayoutState ) {\n\t\t\tconst nextStateStyle = cleanEmptyObject( {\n\t\t\t\t...stateStyle,\n\t\t\t\tlayout: getLayoutStateOverrides(\n\t\t\t\t\tcleanEmptyObject( newLayout ),\n\t\t\t\t\tbaseLayout,\n\t\t\t\t\tstateStyle?.layout\n\t\t\t\t),\n\t\t\t} );\n\t\t\tsetAttributes( {\n\t\t\t\tstyle: setStyleForState( style, selectedState, nextStateStyle ),\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes( { layout: cleanEmptyObject( newLayout ) } );\n\t};\n\tconst onChangeType = ( newType ) => onChangeLayout( { type: newType } );\n\tconst resetLayout = () => onChangeLayout( resetLayoutDefaults );\n\tconst resetInheritToggle = () => onChangeLayout( { type: 'default' } );\n\tconst isUsingContentWidth = () =>\n\t\tlayoutType?.name === 'constrained' || hasContentSizeOrLegacySettings;\n\tconst hasInheritToggleValue = () =>\n\t\tisViewportLayoutState\n\t\t\t? ( usedLayout?.type ?? 'default' ) !==\n\t\t\t ( resetLayoutDefaults?.type ?? 'default' )\n\t\t\t: layout?.type === 'constrained';\n\tconst hasLayoutTypeValue = () =>\n\t\t( usedLayout?.type ?? 'default' ) !==\n\t\t( resetLayoutDefaults?.type ?? 'default' );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls\n\t\t\t\tgroup=\"layout\"\n\t\t\t\tresetAllFilter={ resetLayoutFilter }\n\t\t\t>\n\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Use content width' ) }\n\t\t\t\t\t\thasValue={ hasInheritToggleValue }\n\t\t\t\t\t\tonDeselect={ resetInheritToggle }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\tchecked={ isUsingContentWidth() }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tonChangeLayout( {\n\t\t\t\t\t\t\t\t\ttype: isUsingContentWidth()\n\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\tisUsingContentWidth()\n\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\n\t\t\t\t{ showLayoutTypeSwitcher && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Layout type' ) }\n\t\t\t\t\t\thasValue={ hasLayoutTypeValue }\n\t\t\t\t\t\tonDeselect={ resetLayout }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ blockLayoutType }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\n\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\tvalue={ layout }\n\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\tresetLayout={ resetLayoutDefaults }\n\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\tvalue={ layout }\n\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\tresetLayout={ resetLayoutDefaults }\n\t\t\t\t\t\tname={ blockName }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\tname={ blockName }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: LayoutPanelPure,\n\tattributeKeys: [ 'layout', 'style' ],\n\thasSupport( name ) {\n\t\treturn hasLayoutBlockSupport( name );\n\t},\n};\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__next40pxDefaultSize\n\t\t\tisBlock\n\t\t\tlabel={ __( 'Layout type' ) }\n\t\t\thideLabelFromVision\n\t\t\tisAdaptiveWidth\n\t\t\tvalue={ type }\n\t\t\tonChange={ onChange }\n\t\t>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tvalue={ name }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ToggleGroupControl>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasLayoutBlockSupport( settings ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockWithLayoutStyles( {\n\tblock: BlockListBlock,\n\tprops,\n\tblockGapSupport,\n\tglobalBlockGapValue,\n\tlayoutClasses,\n} ) {\n\tconst { name, attributes } = props;\n\tconst id = useInstanceId( BlockListBlock );\n\tconst { layout } = attributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;\n\t// Higher specificity to override defaults from theme.json.\n\tconst selector = `.${ selectorPrefix }${ id }`;\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t// Get CSS string for the current layout type.\n\t// The CSS and `style` element is only output if it is not empty.\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst baseLayoutCSS = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\tstyle: attributes?.style,\n\t\thasBlockGapSupport,\n\t\tglobalBlockGapValue,\n\t} );\n\tconst responsiveLayoutCSS = getResponsiveLayoutStyles( {\n\t\tattributes,\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\thasBlockGapSupport,\n\t\tglobalBlockGapValue,\n\t} );\n\tconst css = [ baseLayoutCSS, responsiveLayoutCSS ]\n\t\t.filter( Boolean )\n\t\t.join( '' );\n\n\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\tconst layoutClassNames = clsx(\n\t\t{\n\t\t\t[ `${ selectorPrefix }${ id }` ]: !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t},\n\t\tlayoutClasses\n\t);\n\n\tuseStyleOverride( { css } );\n\n\treturn (\n\t\t<BlockListBlock\n\t\t\t{ ...props }\n\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t/>\n\t);\n}\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) =>\n\t\tfunction WithLayoutStyles( props ) {\n\t\t\tconst { clientId, name, attributes } = props;\n\t\t\tconst blockSupportsLayout = hasLayoutBlockSupport( name );\n\t\t\tconst layoutClasses = useLayoutClasses( attributes, name );\n\t\t\tconst extraProps = useSelect(\n\t\t\t\t( select ) => {\n\t\t\t\t\t// The callback returns early to avoid block editor subscription.\n\t\t\t\t\tif ( ! blockSupportsLayout ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst { getSettings, getBlockSettings } = unlock(\n\t\t\t\t\t\tselect( blockEditorStore )\n\t\t\t\t\t);\n\t\t\t\t\tconst settings = getSettings();\n\t\t\t\t\tconst { disableLayoutStyles } = settings;\n\n\t\t\t\t\tif ( disableLayoutStyles ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst [ blockGapSupport ] = getBlockSettings(\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t'spacing.blockGap'\n\t\t\t\t\t);\n\n\t\t\t\t\t// Get default blockGap value from global styles for use in layouts like grid.\n\t\t\t\t\t// Check style variation first, then block-specific styles, then fall back to root styles.\n\t\t\t\t\tconst globalStyles = settings[ globalStylesDataKey ];\n\n\t\t\t\t\t// Check if the block has an active style variation with a blockGap value.\n\t\t\t\t\t// Only check the registry if the className contains a variation class to avoid unnecessary lookups.\n\t\t\t\t\tlet variationBlockGapValue;\n\t\t\t\t\tconst className = attributes?.className;\n\t\t\t\t\tif ( className?.includes( VARIATION_PREFIX ) ) {\n\t\t\t\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\t\t\t\tconst registeredStyles = getBlockStyles( name );\n\t\t\t\t\t\tconst variationName = getVariationNameFromClass(\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\tregisteredStyles\n\t\t\t\t\t\t);\n\t\t\t\t\t\tvariationBlockGapValue = variationName\n\t\t\t\t\t\t\t? globalStyles?.blocks?.[ name ]?.variations?.[\n\t\t\t\t\t\t\t\t\tvariationName\n\t\t\t\t\t\t\t ]?.spacing?.blockGap\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst globalBlockGapValue =\n\t\t\t\t\t\tvariationBlockGapValue ??\n\t\t\t\t\t\tglobalStyles?.blocks?.[ name ]?.spacing?.blockGap ??\n\t\t\t\t\t\tglobalStyles?.spacing?.blockGap;\n\n\t\t\t\t\treturn { blockGapSupport, globalBlockGapValue };\n\t\t\t\t},\n\t\t\t\t[ blockSupportsLayout, clientId, attributes?.className, name ]\n\t\t\t);\n\n\t\t\tif ( ! extraProps ) {\n\t\t\t\treturn (\n\t\t\t\t\t<BlockListBlock\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t__unstableLayoutClassNames={\n\t\t\t\t\t\t\tblockSupportsLayout ? layoutClasses : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<BlockWithLayoutStyles\n\t\t\t\t\tblock={ BlockListBlock }\n\t\t\t\t\tprops={ props }\n\t\t\t\t\tlayoutClasses={ layoutClasses }\n\t\t\t\t\t{ ...extraProps }\n\t\t\t\t/>\n\t\t\t);\n\t\t},\n\t'withLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\n"],
5
+ "mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,4BAA4B,qBAAqB;AAC1D,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B;AAAA,EACC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,iBAAiB;AAC1B;AAAA,EACC,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,EAC1C;AAAA,EACA,gCAAgC;AAAA,EAChC,eAAe;AAAA,OACT;AACP,SAAS,UAAU;AAKnB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,eAAe,sBAAsB;AAC9C,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,kBAAkB,kBAAkB,wBAAwB;AACrE,SAAS,cAAc;AACvB,SAAS,2BAA2B;AACpC,SAAS,iCAAiC;AAC1C;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAkcL,mBAaI,KAZH,YADD;AAhcF,IAAM,mBAAmB;AAEzB,IAAM,wBAAwB;AAG9B,IAAM,yBAAyB;AAAA,EAC9B,WAAW;AAAA,EACX,WAAW;AACZ;AACA,IAAM,oBAAoB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AACA,IAAM,EAAE,UAAU,IAAI,OAAQ,qBAAsB;AAEpD,SAAS,iBAAkB,qBAAqB,CAAC,GAAG,gBAAiB;AACpE,QAAM,qBAAqB,oBAAoB;AAE/C,SAAO,gBAAgB,YAAY,UAAU;AAC9C;AAUO,SAAS,eAAgB,qBAAqB,CAAC,GAAG,gBAAi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AAS;AAExB,eAAO,EAAE,iBAAiB,oBAAoB;AAAA,MAC/C;AAAA,MACA,CAAE,qBAAqB,UAAU,YAAY,WAAW,IAAK;AAAA,IAC9D;AAEA,QAAK,CAAE,YAAa;AACnB,aACC;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACL,4BACC,sBAAsB,gBAAgB;AAAA;AAAA,MAExC;AAAA,IAEF;AAEA,WACC;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ;AAAA,QACR;AAAA,QACA;AAAA,QACE,GAAG;AAAA;AAAA,IACN;AAAA,EAEF;AAAA,EACD;AACD;AAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;AACA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
6
6
  "names": []
7
7
  }
@@ -21,16 +21,19 @@ function ListViewPanel({ clientId, name }) {
21
21
  const { openListViewContentPanel } = unlock(
22
22
  useDispatch(blockEditorStore)
23
23
  );
24
- const isEnabled = hasListViewSupport(name);
25
- const { hasChildren, isNestedListView } = useSelect(
24
+ const { isEnabled, hasChildren, isNestedListView } = useSelect(
26
25
  (select) => {
27
- const { getBlockCount, getBlockParents, getBlockName } = select(blockEditorStore);
26
+ const {
27
+ getBlockCount,
28
+ getBlockParents,
29
+ shouldRenderBlockListView
30
+ } = unlock(select(blockEditorStore));
28
31
  const parents = getBlockParents(clientId, false);
29
- const _isNestedListView = parents.find((parentId) => {
30
- const parentName = getBlockName(parentId);
31
- return parentName === "core/navigation" || hasBlockSupport(parentName, "listView");
32
- });
32
+ const _isNestedListView = parents.find(
33
+ (parentId) => shouldRenderBlockListView(parentId)
34
+ );
33
35
  return {
36
+ isEnabled: shouldRenderBlockListView(clientId),
34
37
  hasChildren: !!getBlockCount(clientId),
35
38
  isNestedListView: _isNestedListView
36
39
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/list-view.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { hasBlockSupport, getBlockType } from '@wordpress/blocks';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { PrivateListView } from '../components/list-view';\nimport InspectorControls from '../components/inspector-controls/fill';\nimport { PrivateBlockContext } from '../components/block-list/private-block-context';\nimport useListViewPanelState from '../components/use-list-view-panel-state';\n\nimport { unlock } from '../lock-unlock';\n\nexport const LIST_VIEW_SUPPORT_KEY = 'listView';\n\n/**\n * Check if the block has list view support.\n *\n * @param {string|Object} nameOrType Block name or block type object.\n * @return {boolean} Whether the block has list view support.\n */\nexport function hasListViewSupport( nameOrType ) {\n\treturn hasBlockSupport( nameOrType, LIST_VIEW_SUPPORT_KEY );\n}\n\n/**\n * Inspector controls panel for list view.\n *\n * @param {Object} props Component props.\n * @param {string} props.clientId Block client ID.\n * @param {string} props.name Block name.\n * @return {Element|null} List view inspector controls or null.\n */\nexport function ListViewPanel( { clientId, name } ) {\n\tconst { isSelectionWithinCurrentSection } =\n\t\tuseContext( PrivateBlockContext );\n\n\tconst { isOpened, expandRevision, handleToggle } =\n\t\tuseListViewPanelState( clientId );\n\n\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\tconst { openListViewContentPanel } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst isEnabled = hasListViewSupport( name );\n\tconst { hasChildren, isNestedListView } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockCount, getBlockParents, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\t// Avoid showing List Views for both parent and child blocks that have support.\n\t\t\t// In this situation the parent will show the child in its list already.\n\t\t\t// Search parents to see if there's one that also has support, and if so skip rendering.\n\t\t\t// This matches closely the logic in the `BlockCard` component.\n\t\t\tconst parents = getBlockParents( clientId, false );\n\t\t\tconst _isNestedListView = parents.find( ( parentId ) => {\n\t\t\t\tconst parentName = getBlockName( parentId );\n\t\t\t\treturn (\n\t\t\t\t\tparentName === 'core/navigation' ||\n\t\t\t\t\thasBlockSupport( parentName, 'listView' )\n\t\t\t\t);\n\t\t\t} );\n\n\t\t\treturn {\n\t\t\t\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tisNestedListView: _isNestedListView,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockType = getBlockType( name );\n\tconst title = blockType?.title || name;\n\n\tif ( ! isEnabled || isNestedListView ) {\n\t\treturn null;\n\t}\n\n\tconst showBlockTitle = isSelectionWithinCurrentSection;\n\n\treturn (\n\t\t<InspectorControls group=\"list\">\n\t\t\t<PanelBody\n\t\t\t\ttitle={ showBlockTitle ? title : undefined }\n\t\t\t\topened={ isOpened }\n\t\t\t\tonToggle={ handleToggle }\n\t\t\t>\n\t\t\t\t{ ! hasChildren && (\n\t\t\t\t\t<p className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t{ __( 'No items yet.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t<PrivateListView\n\t\t\t\t\tkey={ `${ clientId }-${ expandRevision }` }\n\t\t\t\t\trootClientId={ clientId }\n\t\t\t\t\tisExpanded\n\t\t\t\t\tdescription={ title }\n\t\t\t\t\tshowAppender\n\t\t\t\t\tonSelect={ openListViewContentPanel }\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n}\n\n/**\n * Export block support definition.\n */\nexport default {\n\tedit: ListViewPanel,\n\thasSupport: hasListViewSupport,\n\tattributeKeys: [],\n\tsupportsPatternEditing: true,\n};\n"],
5
- "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,aAAa,iBAAiB;AACvC,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,kBAAkB;AAK3B,SAAS,SAAS,wBAAwB;AAC1C,SAAS,uBAAuB;AAChC,OAAO,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;AAAA,YAEA,cAAe;AAAA,YACf,YAAU;AAAA,YACV,aAAc;AAAA,YACd,cAAY;AAAA,YACZ,UAAW;AAAA;AAAA,UALL,GAAI,QAAS,IAAK,cAAe;AAAA,QAMxC;AAAA;AAAA;AAAA,EACD,GACD;AAEF;AAKA,IAAO,oBAAQ;AAAA,EACd,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,eAAe,CAAC;AAAA,EAChB,wBAAwB;AACzB;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { hasBlockSupport, getBlockType } from '@wordpress/blocks';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { PrivateListView } from '../components/list-view';\nimport InspectorControls from '../components/inspector-controls/fill';\nimport { PrivateBlockContext } from '../components/block-list/private-block-context';\nimport useListViewPanelState from '../components/use-list-view-panel-state';\n\nimport { unlock } from '../lock-unlock';\n\nexport const LIST_VIEW_SUPPORT_KEY = 'listView';\n\n/**\n * Check if the block has list view support.\n *\n * @param {string|Object} nameOrType Block name or block type object.\n * @return {boolean} Whether the block has list view support.\n */\nexport function hasListViewSupport( nameOrType ) {\n\treturn hasBlockSupport( nameOrType, LIST_VIEW_SUPPORT_KEY );\n}\n\n/**\n * Inspector controls panel for list view.\n *\n * @param {Object} props Component props.\n * @param {string} props.clientId Block client ID.\n * @param {string} props.name Block name.\n * @return {Element|null} List view inspector controls or null.\n */\nexport function ListViewPanel( { clientId, name } ) {\n\tconst { isSelectionWithinCurrentSection } =\n\t\tuseContext( PrivateBlockContext );\n\n\tconst { isOpened, expandRevision, handleToggle } =\n\t\tuseListViewPanelState( clientId );\n\n\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\tconst { openListViewContentPanel } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst { isEnabled, hasChildren, isNestedListView } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockParents,\n\t\t\t\tshouldRenderBlockListView,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\t// Avoid showing List Views for both parent and child blocks that have support.\n\t\t\t// In this situation the parent will show the child in its list already.\n\t\t\t// Search parents to see if there's one that also has support, and if so skip rendering.\n\t\t\t// This matches closely the logic in the `BlockCard` component.\n\t\t\tconst parents = getBlockParents( clientId, false );\n\t\t\tconst _isNestedListView = parents.find( ( parentId ) =>\n\t\t\t\tshouldRenderBlockListView( parentId )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tisEnabled: shouldRenderBlockListView( clientId ),\n\t\t\t\thasChildren: !! getBlockCount( clientId ),\n\t\t\t\tisNestedListView: _isNestedListView,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockType = getBlockType( name );\n\tconst title = blockType?.title || name;\n\n\tif ( ! isEnabled || isNestedListView ) {\n\t\treturn null;\n\t}\n\n\tconst showBlockTitle = isSelectionWithinCurrentSection;\n\n\treturn (\n\t\t<InspectorControls group=\"list\">\n\t\t\t<PanelBody\n\t\t\t\ttitle={ showBlockTitle ? title : undefined }\n\t\t\t\topened={ isOpened }\n\t\t\t\tonToggle={ handleToggle }\n\t\t\t>\n\t\t\t\t{ ! hasChildren && (\n\t\t\t\t\t<p className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t{ __( 'No items yet.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t<PrivateListView\n\t\t\t\t\tkey={ `${ clientId }-${ expandRevision }` }\n\t\t\t\t\trootClientId={ clientId }\n\t\t\t\t\tisExpanded\n\t\t\t\t\tdescription={ title }\n\t\t\t\t\tshowAppender\n\t\t\t\t\tonSelect={ openListViewContentPanel }\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n}\n\n/**\n * Export block support definition.\n */\nexport default {\n\tedit: ListViewPanel,\n\thasSupport: hasListViewSupport,\n\tattributeKeys: [],\n\tsupportsPatternEditing: true,\n};\n"],
5
+ "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,aAAa,iBAAiB;AACvC,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,kBAAkB;AAK3B,SAAS,SAAS,wBAAwB;AAC1C,SAAS,uBAAuB;AAChC,OAAO,uBAAuB;AAC9B,SAAS,2BAA2B;AACpC,OAAO,2BAA2B;AAElC,SAAS,cAAc;AAuEpB,SAME,KANF;AArEI,IAAM,wBAAwB;AAQ9B,SAAS,mBAAoB,YAAa;AAChD,SAAO,gBAAiB,YAAY,qBAAsB;AAC3D;AAUO,SAAS,cAAe,EAAE,UAAU,KAAK,GAAI;AACnD,QAAM,EAAE,gCAAgC,IACvC,WAAY,mBAAoB;AAEjC,QAAM,EAAE,UAAU,gBAAgB,aAAa,IAC9C,sBAAuB,QAAS;AAGjC,QAAM,EAAE,yBAAyB,IAAI;AAAA,IACpC,YAAa,gBAAiB;AAAA,EAC/B;AAEA,QAAM,EAAE,WAAW,aAAa,iBAAiB,IAAI;AAAA,IACpD,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,OAAQ,gBAAiB,CAAE;AAMvC,YAAM,UAAU,gBAAiB,UAAU,KAAM;AACjD,YAAM,oBAAoB,QAAQ;AAAA,QAAM,CAAE,aACzC,0BAA2B,QAAS;AAAA,MACrC;AAEA,aAAO;AAAA,QACN,WAAW,0BAA2B,QAAS;AAAA,QAC/C,aAAa,CAAC,CAAE,cAAe,QAAS;AAAA,QACxC,kBAAkB;AAAA,MACnB;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AAEA,QAAM,YAAY,aAAc,IAAK;AACrC,QAAM,QAAQ,WAAW,SAAS;AAElC,MAAK,CAAE,aAAa,kBAAmB;AACtC,WAAO;AAAA,EACR;AAEA,QAAM,iBAAiB;AAEvB,SACC,oBAAC,qBAAkB,OAAM,QACxB;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,iBAAiB,QAAQ;AAAA,MACjC,QAAS;AAAA,MACT,UAAW;AAAA,MAET;AAAA,SAAE,eACH,oBAAC,OAAE,WAAU,2CACV,aAAI,eAAgB,GACvB;AAAA,QAED;AAAA,UAAC;AAAA;AAAA,YAEA,cAAe;AAAA,YACf,YAAU;AAAA,YACV,aAAc;AAAA,YACd,cAAY;AAAA,YACZ,UAAW;AAAA;AAAA,UALL,GAAI,QAAS,IAAK,cAAe;AAAA,QAMxC;AAAA;AAAA;AAAA,EACD,GACD;AAEF;AAKA,IAAO,oBAAQ;AAAA,EACd,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,eAAe,CAAC;AAAA,EAChB,wBAAwB;AACzB;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/spacing-visualizer.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect, useReducer } from '@wordpress/element';\nimport { isShallowEqual } from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockPopoverCover from '../components/block-popover/cover';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction SpacingVisualizer( { clientId, value, computeStyle, forceShow } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst [ style, updateStyle ] = useReducer( () =>\n\t\tcomputeStyle( blockElement )\n\t);\n\n\t// Force style computation when forceShow becomes true (e.g., when hovering control)\n\t// to ensure visualizer displays correct dimensions on first render.\n\tuseEffect( () => {\n\t\tif ( blockElement && forceShow ) {\n\t\t\tupdateStyle();\n\t\t}\n\t}, [ blockElement, forceShow ] );\n\n\t// It's not sufficient to read the block's computed style when `value` changes because\n\t// the effect would run before the block\u2019s style has updated. Thus observing mutations\n\t// to the block\u2019s attributes is used to trigger updates to the visualizer\u2019s styles.\n\tuseEffect( () => {\n\t\tif ( ! blockElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( updateStyle );\n\t\tobserver.observe( blockElement, {\n\t\t\tattributes: true,\n\t\t\tattributeFilter: [ 'style', 'class' ],\n\t\t} );\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ blockElement ] );\n\n\tconst previousValueRef = useRef( value );\n\tconst [ isActive, setIsActive ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( isShallowEqual( value, previousValueRef.current ) || forceShow ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsActive( true );\n\t\tpreviousValueRef.current = value;\n\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetIsActive( false );\n\t\t}, 400 );\n\n\t\treturn () => {\n\t\t\tsetIsActive( false );\n\t\t\tclearTimeout( timeout );\n\t\t};\n\t}, [ value, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t>\n\t\t\t<div className=\"block-editor__spacing-visualizer\" style={ style } />\n\t\t</BlockPopoverCover>\n\t);\n}\n\nfunction getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n\nexport function MarginVisualizer( { clientId, value, forceShow } ) {\n\treturn (\n\t\t<SpacingVisualizer\n\t\t\tclientId={ clientId }\n\t\t\tvalue={ value?.spacing?.margin }\n\t\t\tcomputeStyle={ ( blockElement ) => {\n\t\t\t\tconst top = getComputedCSS( blockElement, 'margin-top' );\n\t\t\t\tconst right = getComputedCSS( blockElement, 'margin-right' );\n\t\t\t\tconst bottom = getComputedCSS( blockElement, 'margin-bottom' );\n\t\t\t\tconst left = getComputedCSS( blockElement, 'margin-left' );\n\t\t\t\treturn {\n\t\t\t\t\tborderTopWidth: top,\n\t\t\t\t\tborderRightWidth: right,\n\t\t\t\t\tborderBottomWidth: bottom,\n\t\t\t\t\tborderLeftWidth: left,\n\t\t\t\t\ttop: top ? `-${ top }` : 0,\n\t\t\t\t\tright: right ? `-${ right }` : 0,\n\t\t\t\t\tbottom: bottom ? `-${ bottom }` : 0,\n\t\t\t\t\tleft: left ? `-${ left }` : 0,\n\t\t\t\t};\n\t\t\t} }\n\t\t\tforceShow={ forceShow }\n\t\t/>\n\t);\n}\n\nexport function PaddingVisualizer( { clientId, value, forceShow } ) {\n\treturn (\n\t\t<SpacingVisualizer\n\t\t\tclientId={ clientId }\n\t\t\tvalue={ value?.spacing?.padding }\n\t\t\tcomputeStyle={ ( blockElement ) => ( {\n\t\t\t\tborderTopWidth: getComputedCSS( blockElement, 'padding-top' ),\n\t\t\t\tborderRightWidth: getComputedCSS(\n\t\t\t\t\tblockElement,\n\t\t\t\t\t'padding-right'\n\t\t\t\t),\n\t\t\t\tborderBottomWidth: getComputedCSS(\n\t\t\t\t\tblockElement,\n\t\t\t\t\t'padding-bottom'\n\t\t\t\t),\n\t\t\t\tborderLeftWidth: getComputedCSS( blockElement, 'padding-left' ),\n\t\t\t} ) }\n\t\t\tforceShow={ forceShow }\n\t\t/>\n\t);\n}\n"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect, useReducer } from '@wordpress/element';\nimport { isShallowEqual } from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockPopoverCover from '../components/block-popover/cover';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nfunction SpacingVisualizer( { clientId, value, computeStyle, forceShow } ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst [ style, updateStyle ] = useReducer( () =>\n\t\tcomputeStyle( blockElement )\n\t);\n\n\t// Force style computation when forceShow becomes true (e.g., when hovering control)\n\t// to ensure visualizer displays correct dimensions on first render.\n\tuseEffect( () => {\n\t\tif ( blockElement && forceShow ) {\n\t\t\tupdateStyle();\n\t\t}\n\t}, [ blockElement, forceShow ] );\n\n\t// It's not sufficient to read the block's computed style when `value` changes because\n\t// the effect would run before the block’s style has updated. Thus observing mutations\n\t// to the block’s attributes is used to trigger updates to the visualizer’s styles.\n\tuseEffect( () => {\n\t\tif ( ! blockElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( updateStyle );\n\t\tobserver.observe( blockElement, {\n\t\t\tattributes: true,\n\t\t\tattributeFilter: [ 'style', 'class' ],\n\t\t} );\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ blockElement ] );\n\n\tconst previousValueRef = useRef( value );\n\tconst [ isActive, setIsActive ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( isShallowEqual( value, previousValueRef.current ) || forceShow ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsActive( true );\n\t\tpreviousValueRef.current = value;\n\n\t\tconst timeout = setTimeout( () => {\n\t\t\tsetIsActive( false );\n\t\t}, 400 );\n\n\t\treturn () => {\n\t\t\tsetIsActive( false );\n\t\t\tclearTimeout( timeout );\n\t\t};\n\t}, [ value, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot=\"block-toolbar\"\n\t\t>\n\t\t\t<div className=\"block-editor__spacing-visualizer\" style={ style } />\n\t\t</BlockPopoverCover>\n\t);\n}\n\nfunction getComputedCSS( element, property ) {\n\treturn element.ownerDocument.defaultView\n\t\t.getComputedStyle( element )\n\t\t.getPropertyValue( property );\n}\n\nexport function MarginVisualizer( { clientId, value, forceShow } ) {\n\treturn (\n\t\t<SpacingVisualizer\n\t\t\tclientId={ clientId }\n\t\t\tvalue={ value?.spacing?.margin }\n\t\t\tcomputeStyle={ ( blockElement ) => {\n\t\t\t\tconst top = getComputedCSS( blockElement, 'margin-top' );\n\t\t\t\tconst right = getComputedCSS( blockElement, 'margin-right' );\n\t\t\t\tconst bottom = getComputedCSS( blockElement, 'margin-bottom' );\n\t\t\t\tconst left = getComputedCSS( blockElement, 'margin-left' );\n\t\t\t\treturn {\n\t\t\t\t\tborderTopWidth: top,\n\t\t\t\t\tborderRightWidth: right,\n\t\t\t\t\tborderBottomWidth: bottom,\n\t\t\t\t\tborderLeftWidth: left,\n\t\t\t\t\ttop: top ? `-${ top }` : 0,\n\t\t\t\t\tright: right ? `-${ right }` : 0,\n\t\t\t\t\tbottom: bottom ? `-${ bottom }` : 0,\n\t\t\t\t\tleft: left ? `-${ left }` : 0,\n\t\t\t\t};\n\t\t\t} }\n\t\t\tforceShow={ forceShow }\n\t\t/>\n\t);\n}\n\nexport function PaddingVisualizer( { clientId, value, forceShow } ) {\n\treturn (\n\t\t<SpacingVisualizer\n\t\t\tclientId={ clientId }\n\t\t\tvalue={ value?.spacing?.padding }\n\t\t\tcomputeStyle={ ( blockElement ) => ( {\n\t\t\t\tborderTopWidth: getComputedCSS( blockElement, 'padding-top' ),\n\t\t\t\tborderRightWidth: getComputedCSS(\n\t\t\t\t\tblockElement,\n\t\t\t\t\t'padding-right'\n\t\t\t\t),\n\t\t\t\tborderBottomWidth: getComputedCSS(\n\t\t\t\t\tblockElement,\n\t\t\t\t\t'padding-bottom'\n\t\t\t\t),\n\t\t\t\tborderLeftWidth: getComputedCSS( blockElement, 'padding-left' ),\n\t\t\t} ) }\n\t\t\tforceShow={ forceShow }\n\t\t/>\n\t);\n}\n"],
5
5
  "mappings": ";AAGA,SAAS,UAAU,QAAQ,WAAW,kBAAkB;AACxD,SAAS,sBAAsB;AAK/B,OAAO,uBAAuB;AAC9B,SAAS,uBAAuB;AA+D7B;AA7DH,SAAS,kBAAmB,EAAE,UAAU,OAAO,cAAc,UAAU,GAAI;AAC1E,QAAM,eAAe,gBAAiB,QAAS;AAC/C,QAAM,CAAE,OAAO,WAAY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A;AAAA,MACA,OAAQ,OAAO,SAAS;AAAA,MACxB,cAAe,CAAE,iBAAkB;AAClC,cAAM,MAAM,eAAgB,cAAc,YAAa;AACvD,cAAM,QAAQ,eAAgB,cAAc,cAAe;AAC3D,cAAM,SAAS,eAAgB,cAAc,eAAgB;AAC7D,cAAM,OAAO,eAAgB,cAAc,aAAc;AACzD,eAAO;AAAA,UACN,gBAAgB;AAAA,UAChB,kBAAkB;AAAA,UAClB,mBAAmB;AAAA,UACnB,iBAAiB;AAAA,UACjB,KAAK,MAAM,IAAK,GAAI,KAAK;AAAA,UACzB,OAAO,QAAQ,IAAK,KAAM,KAAK;AAAA,UAC/B,QAAQ,SAAS,IAAK,MAAO,KAAK;AAAA,UAClC,MAAM,OAAO,IAAK,IAAK,KAAK;AAAA,QAC7B;AAAA,MACD;AAAA,MACA;AAAA;AAAA,EACD;AAEF;AAEO,SAAS,kBAAmB,EAAE,UAAU,OAAO,UAAU,GAAI;AACnE,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,OAAQ,OAAO,SAAS;AAAA,MACxB,cAAe,CAAE,kBAAoB;AAAA,QACpC,gBAAgB,eAAgB,cAAc,aAAc;AAAA,QAC5D,kBAAkB;AAAA,UACjB;AAAA,UACA;AAAA,QACD;AAAA,QACA,mBAAmB;AAAA,UAClB;AAAA,UACA;AAAA,QACD;AAAA,QACA,iBAAiB,eAAgB,cAAc,cAAe;AAAA,MAC/D;AAAA,MACA;AAAA;AAAA,EACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/state-utils.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { splitSelectorList } from '@wordpress/global-styles-engine';\n\n/**\n * Given a block's `selectors.root` value, returns the part of the selector\n * that is relative to the block wrapper \u2014 i.e., everything after the first\n * compound selector segment.\n *\n * Examples:\n * \".wp-block-button .wp-block-button__link\" \u2192 \".wp-block-button__link\"\n * \".wp-block-foo > .inner\" \u2192 \"> .inner\"\n * \".wp-block-foo\" \u2192 null (no descendant)\n *\n * @param {string} rootSelector The block's `selectors.root` value.\n * @return {string|null} Relative selector, or null if rootSelector targets the wrapper itself.\n */\nexport function getRelativeRootSelector( rootSelector ) {\n\t// Match everything after the first compound selector (up to the first\n\t// whitespace or combinator character).\n\t// Require at least one combinator character (space, >, +, ~) between the\n\t// first compound selector and the rest. Without this anchor, a greedy\n\t// quantifier would backtrack into the first token and produce false matches.\n\tconst match = rootSelector.trim().match( /^[^ >+~]+[ >+~](.*)$/ );\n\tif ( ! match ) {\n\t\treturn null;\n\t}\n\tconst rest = match[ 1 ].trim();\n\treturn rest || null;\n}\n\n/**\n * Builds a scoped selector from a block selector and optional suffix.\n *\n * If the block selector targets a descendant, the descendant portion is scoped\n * under the provided base selector. Otherwise the base selector itself is used.\n *\n * @param {string} baseSelector The block-instance scoping selector.\n * @param {string} blockSelector The block or feature selector from block metadata.\n * @param {string} suffix Optional selector suffix, e.g. \":hover\".\n * @return {string} The scoped CSS selector.\n */\nexport function buildScopedBlockSelector(\n\tbaseSelector,\n\tblockSelector,\n\tsuffix = ''\n) {\n\tif ( typeof blockSelector !== 'string' || ! blockSelector ) {\n\t\treturn splitSelectorList( baseSelector )\n\t\t\t.map( ( selector ) => `${ selector.trim() }${ suffix }` )\n\t\t\t.join( ', ' );\n\t}\n\n\tconst baseSelectors = splitSelectorList( baseSelector ).filter(\n\t\t( selector ) => selector.trim()\n\t);\n\tconst selectors = splitSelectorList( blockSelector ).filter( ( selector ) =>\n\t\tselector.trim()\n\t);\n\n\tif ( ! selectors.length ) {\n\t\treturn baseSelectors\n\t\t\t.map( ( selector ) => `${ selector.trim() }${ suffix }` )\n\t\t\t.join( ', ' );\n\t}\n\n\treturn selectors\n\t\t.map( ( selector ) => {\n\t\t\tselector = selector.trim();\n\n\t\t\t/*\n\t\t\t * Replace only the leading block selector part (e.g. class name,\n\t\t\t * attribute selector, ID, or tag name) with the block instance selector.\n\t\t\t * Preserve anything after that prefix, including modifier classes on the\n\t\t\t * same element and combinators without spaces.\n\t\t\t */\n\t\t\tconst match = selector.match( /^([.#]?[-_a-zA-Z0-9]+|\\[[^\\]]+\\])/ );\n\t\t\tif ( match ) {\n\t\t\t\treturn baseSelectors\n\t\t\t\t\t.map(\n\t\t\t\t\t\t( base ) =>\n\t\t\t\t\t\t\t`${ base.trim() }${ selector.slice(\n\t\t\t\t\t\t\t\tmatch[ 0 ].length\n\t\t\t\t\t\t\t) }${ suffix }`\n\t\t\t\t\t)\n\t\t\t\t\t.join( ', ' );\n\t\t\t}\n\n\t\t\treturn baseSelectors\n\t\t\t\t.map( ( base ) => `${ base.trim() }${ suffix }` )\n\t\t\t\t.join( ', ' );\n\t\t} )\n\t\t.join( ', ' );\n}\n\n/**\n * Builds the scoped selector for root block style state styles.\n *\n * Uses the block's `selectors.root` to determine which element should receive\n * root-level state styles. If `selectors.root` describes a descendant element\n * (e.g. `.wp-block-button .wp-block-button__link`), the relative portion is\n * scoped under `baseSelector`. If no descendant is present, falls back to the\n * base selector.\n *\n * @param {string} baseSelector The block-instance scoping class selector.\n * @param {string} name The block name, used to look up selectors.\n * @return {string} The fully-scoped CSS selector for root state styles.\n */\nexport function buildRootStyleStateSelector( baseSelector, name ) {\n\tconst rootSelector = getBlockType( name )?.selectors?.root;\n\treturn buildScopedBlockSelector( baseSelector, rootSelector );\n}\n\n/**\n * Builds the scoped CSS selector for a block state (e.g. :hover, :focus).\n *\n * Uses the block's `selectors.root` to determine which element the state\n * pseudo-class should apply to. If `selectors.root` describes a descendant\n * element (e.g. \".wp-block-button .wp-block-button__link\"), the relative\n * portion (\".wp-block-button__link\") is scoped under `baseSelector`. If no\n * descendant is present, falls back to appending the state to `baseSelector`.\n *\n * @param {string} baseSelector The block-instance scoping class selector.\n * @param {string} name The block name, used to look up selectors.\n * @param {string} state The pseudo-class string, e.g. \":hover\".\n * @return {string} The fully-scoped CSS selector for this state.\n */\nexport function buildPseudoStyleStateSelector( baseSelector, name, state ) {\n\treturn `${ buildRootStyleStateSelector( baseSelector, name ) }${ state }`;\n}\n\nexport function buildStateSelector( baseSelector, name, state ) {\n\tconst rootSelector = getBlockType( name )?.selectors?.root;\n\treturn buildScopedBlockSelector( baseSelector, rootSelector, state );\n}\n\n/**\n * Builds the CSS selector used to preview a state on the editor canvas,\n * scoped to a specific block instance via its `data-block` attribute.\n *\n * For blocks whose `selectors.root` targets a descendant element\n * (e.g. \".wp-block-button .wp-block-button__link\"), the selector targets\n * that descendant inside the block wrapper. Otherwise it targets the wrapper\n * itself.\n *\n * @param {string} clientId The block's clientId.\n * @param {string} name The block name, used to look up selectors.\n * @return {string} CSS selector scoped to this block instance.\n */\nexport function buildCanvasStateSelector( clientId, name ) {\n\tconst rootSelector = getBlockType( name )?.selectors?.root;\n\treturn buildScopedBlockSelector(\n\t\t`[data-block=\"${ clientId }\"]`,\n\t\trootSelector\n\t);\n}\n"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { splitSelectorList } from '@wordpress/global-styles-engine';\n\n/**\n * Given a block's `selectors.root` value, returns the part of the selector\n * that is relative to the block wrapper i.e., everything after the first\n * compound selector segment.\n *\n * Examples:\n * \".wp-block-button .wp-block-button__link\" \".wp-block-button__link\"\n * \".wp-block-foo > .inner\" \"> .inner\"\n * \".wp-block-foo\" null (no descendant)\n *\n * @param {string} rootSelector The block's `selectors.root` value.\n * @return {string|null} Relative selector, or null if rootSelector targets the wrapper itself.\n */\nexport function getRelativeRootSelector( rootSelector ) {\n\t// Match everything after the first compound selector (up to the first\n\t// whitespace or combinator character).\n\t// Require at least one combinator character (space, >, +, ~) between the\n\t// first compound selector and the rest. Without this anchor, a greedy\n\t// quantifier would backtrack into the first token and produce false matches.\n\tconst match = rootSelector.trim().match( /^[^ >+~]+[ >+~](.*)$/ );\n\tif ( ! match ) {\n\t\treturn null;\n\t}\n\tconst rest = match[ 1 ].trim();\n\treturn rest || null;\n}\n\n/**\n * Builds a scoped selector from a block selector and optional suffix.\n *\n * If the block selector targets a descendant, the descendant portion is scoped\n * under the provided base selector. Otherwise the base selector itself is used.\n *\n * @param {string} baseSelector The block-instance scoping selector.\n * @param {string} blockSelector The block or feature selector from block metadata.\n * @param {string} suffix Optional selector suffix, e.g. \":hover\".\n * @return {string} The scoped CSS selector.\n */\nexport function buildScopedBlockSelector(\n\tbaseSelector,\n\tblockSelector,\n\tsuffix = ''\n) {\n\tif ( typeof blockSelector !== 'string' || ! blockSelector ) {\n\t\treturn splitSelectorList( baseSelector )\n\t\t\t.map( ( selector ) => `${ selector.trim() }${ suffix }` )\n\t\t\t.join( ', ' );\n\t}\n\n\tconst baseSelectors = splitSelectorList( baseSelector ).filter(\n\t\t( selector ) => selector.trim()\n\t);\n\tconst selectors = splitSelectorList( blockSelector ).filter( ( selector ) =>\n\t\tselector.trim()\n\t);\n\n\tif ( ! selectors.length ) {\n\t\treturn baseSelectors\n\t\t\t.map( ( selector ) => `${ selector.trim() }${ suffix }` )\n\t\t\t.join( ', ' );\n\t}\n\n\treturn selectors\n\t\t.map( ( selector ) => {\n\t\t\tselector = selector.trim();\n\n\t\t\t/*\n\t\t\t * Replace only the leading block selector part (e.g. class name,\n\t\t\t * attribute selector, ID, or tag name) with the block instance selector.\n\t\t\t * Preserve anything after that prefix, including modifier classes on the\n\t\t\t * same element and combinators without spaces.\n\t\t\t */\n\t\t\tconst match = selector.match( /^([.#]?[-_a-zA-Z0-9]+|\\[[^\\]]+\\])/ );\n\t\t\tif ( match ) {\n\t\t\t\treturn baseSelectors\n\t\t\t\t\t.map(\n\t\t\t\t\t\t( base ) =>\n\t\t\t\t\t\t\t`${ base.trim() }${ selector.slice(\n\t\t\t\t\t\t\t\tmatch[ 0 ].length\n\t\t\t\t\t\t\t) }${ suffix }`\n\t\t\t\t\t)\n\t\t\t\t\t.join( ', ' );\n\t\t\t}\n\n\t\t\treturn baseSelectors\n\t\t\t\t.map( ( base ) => `${ base.trim() }${ suffix }` )\n\t\t\t\t.join( ', ' );\n\t\t} )\n\t\t.join( ', ' );\n}\n\n/**\n * Builds the scoped selector for root block style state styles.\n *\n * Uses the block's `selectors.root` to determine which element should receive\n * root-level state styles. If `selectors.root` describes a descendant element\n * (e.g. `.wp-block-button .wp-block-button__link`), the relative portion is\n * scoped under `baseSelector`. If no descendant is present, falls back to the\n * base selector.\n *\n * @param {string} baseSelector The block-instance scoping class selector.\n * @param {string} name The block name, used to look up selectors.\n * @return {string} The fully-scoped CSS selector for root state styles.\n */\nexport function buildRootStyleStateSelector( baseSelector, name ) {\n\tconst rootSelector = getBlockType( name )?.selectors?.root;\n\treturn buildScopedBlockSelector( baseSelector, rootSelector );\n}\n\n/**\n * Builds the scoped CSS selector for a block state (e.g. :hover, :focus).\n *\n * Uses the block's `selectors.root` to determine which element the state\n * pseudo-class should apply to. If `selectors.root` describes a descendant\n * element (e.g. \".wp-block-button .wp-block-button__link\"), the relative\n * portion (\".wp-block-button__link\") is scoped under `baseSelector`. If no\n * descendant is present, falls back to appending the state to `baseSelector`.\n *\n * @param {string} baseSelector The block-instance scoping class selector.\n * @param {string} name The block name, used to look up selectors.\n * @param {string} state The pseudo-class string, e.g. \":hover\".\n * @return {string} The fully-scoped CSS selector for this state.\n */\nexport function buildPseudoStyleStateSelector( baseSelector, name, state ) {\n\treturn `${ buildRootStyleStateSelector( baseSelector, name ) }${ state }`;\n}\n\nexport function buildStateSelector( baseSelector, name, state ) {\n\tconst rootSelector = getBlockType( name )?.selectors?.root;\n\treturn buildScopedBlockSelector( baseSelector, rootSelector, state );\n}\n\n/**\n * Builds the CSS selector used to preview a state on the editor canvas,\n * scoped to a specific block instance via its `data-block` attribute.\n *\n * For blocks whose `selectors.root` targets a descendant element\n * (e.g. \".wp-block-button .wp-block-button__link\"), the selector targets\n * that descendant inside the block wrapper. Otherwise it targets the wrapper\n * itself.\n *\n * @param {string} clientId The block's clientId.\n * @param {string} name The block name, used to look up selectors.\n * @return {string} CSS selector scoped to this block instance.\n */\nexport function buildCanvasStateSelector( clientId, name ) {\n\tconst rootSelector = getBlockType( name )?.selectors?.root;\n\treturn buildScopedBlockSelector(\n\t\t`[data-block=\"${ clientId }\"]`,\n\t\trootSelector\n\t);\n}\n"],
5
5
  "mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,yBAAyB;AAe3B,SAAS,wBAAyB,cAAe;AAMvD,QAAM,QAAQ,aAAa,KAAK,EAAE,MAAO,sBAAuB;AAChE,MAAK,CAAE,OAAQ;AACd,WAAO;AAAA,EACR;AACA,QAAM,OAAO,MAAO,CAAE,EAAE,KAAK;AAC7B,SAAO,QAAQ;AAChB;AAaO,SAAS,yBACf,cACA,eACA,SAAS,IACR;AACD,MAAK,OAAO,kBAAkB,YAAY,CAAE,eAAgB;AAC3D,WAAO,kBAAmB,YAAa,EACrC,IAAK,CAAE,aAAc,GAAI,SAAS,KAAK,CAAE,GAAI,MAAO,EAAG,EACvD,KAAM,IAAK;AAAA,EACd;AAEA,QAAM,gBAAgB,kBAAmB,YAAa,EAAE;AAAA,IACvD,CAAE,aAAc,SAAS,KAAK;AAAA,EAC/B;AACA,QAAM,YAAY,kBAAmB,aAAc,EAAE;AAAA,IAAQ,CAAE,aAC9D,SAAS,KAAK;AAAA,EACf;AAEA,MAAK,CAAE,UAAU,QAAS;AACzB,WAAO,cACL,IAAK,CAAE,aAAc,GAAI,SAAS,KAAK,CAAE,GAAI,MAAO,EAAG,EACvD,KAAM,IAAK;AAAA,EACd;AAEA,SAAO,UACL,IAAK,CAAE,aAAc;AACrB,eAAW,SAAS,KAAK;AAQzB,UAAM,QAAQ,SAAS,MAAO,mCAAoC;AAClE,QAAK,OAAQ;AACZ,aAAO,cACL;AAAA,QACA,CAAE,SACD,GAAI,KAAK,KAAK,CAAE,GAAI,SAAS;AAAA,UAC5B,MAAO,CAAE,EAAE;AAAA,QACZ,CAAE,GAAI,MAAO;AAAA,MACf,EACC,KAAM,IAAK;AAAA,IACd;AAEA,WAAO,cACL,IAAK,CAAE,SAAU,GAAI,KAAK,KAAK,CAAE,GAAI,MAAO,EAAG,EAC/C,KAAM,IAAK;AAAA,EACd,CAAE,EACD,KAAM,IAAK;AACd;AAeO,SAAS,4BAA6B,cAAc,MAAO;AACjE,QAAM,eAAe,aAAc,IAAK,GAAG,WAAW;AACtD,SAAO,yBAA0B,cAAc,YAAa;AAC7D;AAgBO,SAAS,8BAA+B,cAAc,MAAM,OAAQ;AAC1E,SAAO,GAAI,4BAA6B,cAAc,IAAK,CAAE,GAAI,KAAM;AACxE;AAEO,SAAS,mBAAoB,cAAc,MAAM,OAAQ;AAC/D,QAAM,eAAe,aAAc,IAAK,GAAG,WAAW;AACtD,SAAO,yBAA0B,cAAc,cAAc,KAAM;AACpE;AAeO,SAAS,yBAA0B,UAAU,MAAO;AAC1D,QAAM,eAAe,aAAc,IAAK,GAAG,WAAW;AACtD,SAAO;AAAA,IACN,gBAAiB,QAAS;AAAA,IAC1B;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -12,8 +12,8 @@ var PSEUDO_STATE_LABELS = {
12
12
  ":active": __("Active")
13
13
  };
14
14
  var RESPONSIVE_STATE_LABELS = {
15
- tablet: __("Tablet"),
16
- mobile: __("Mobile")
15
+ "@tablet": __("Tablet"),
16
+ "@mobile": __("Mobile")
17
17
  };
18
18
  var VALID_BLOCK_PSEUDO_STATES = {
19
19
  "core/button": [":hover", ":focus", ":focus-visible", ":active"],
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/hooks/states.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport StateControl from '../components/global-styles/state-control';\nimport StateControlBadges from '../components/global-styles/state-control-badges';\nimport { useToolsPanelDropdownMenuProps } from '../components/global-styles/utils';\n\nexport const PSEUDO_STATE_LABELS = {\n\t':hover': __( 'Hover' ),\n\t':focus': __( 'Focus' ),\n\t':focus-visible': __( 'Focus-visible' ),\n\t':active': __( 'Active' ),\n};\n\nexport const RESPONSIVE_STATE_LABELS = {\n\ttablet: __( 'Tablet' ),\n\tmobile: __( 'Mobile' ),\n};\n\n// Keep in sync with WP_Theme_JSON_Gutenberg::VALID_BLOCK_PSEUDO_SELECTORS\n// and packages/global-styles-engine/src/core/render.tsx.\nexport const VALID_BLOCK_PSEUDO_STATES = {\n\t'core/button': [ ':hover', ':focus', ':focus-visible', ':active' ],\n\t'core/navigation-link': [ ':hover', ':focus', ':focus-visible', ':active' ],\n};\n\nfunction getPseudoStateOptions( name ) {\n\tconst validStates = VALID_BLOCK_PSEUDO_STATES[ name ] ?? [];\n\n\treturn validStates\n\t\t.filter( ( state ) => PSEUDO_STATE_LABELS[ state ] )\n\t\t.map( ( state ) => ( {\n\t\t\tvalue: state,\n\t\t\tlabel: PSEUDO_STATE_LABELS[ state ],\n\t\t} ) );\n}\n\nconst DEFAULT_STATE_VALUE = 'default';\n\nfunction getViewportStateOptions( name ) {\n\tif ( ! getBlockType( name )?.attributes?.style ) {\n\t\treturn [];\n\t}\n\n\treturn Object.entries( RESPONSIVE_STATE_LABELS ).map(\n\t\t( [ value, label ] ) => ( {\n\t\t\tvalue,\n\t\t\tlabel,\n\t\t} )\n\t);\n}\n\n/**\n * Renders a style-state selector in the block card header.\n * Viewport states are shown for blocks with a style attribute, while\n * pseudo-states are shown for blocks with configured pseudo-state support.\n *\n * @param {Object} props Component props.\n * @param {string} props.name Block name.\n * @param {Object} props.value Currently selected style-state value.\n * @param {Function} props.onChange Callback when style-state selection changes.\n * @return {Element|null} State control component, or null if not applicable.\n */\nexport function BlockStatesControl( { name, value, onChange } ) {\n\tconst viewportStateOptions = getViewportStateOptions( name );\n\tconst pseudoStateOptions = getPseudoStateOptions( name );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tif ( ! viewportStateOptions.length && ! pseudoStateOptions.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StateControl\n\t\t\tviewportStates={ viewportStateOptions }\n\t\t\tpseudoStates={ pseudoStateOptions }\n\t\t\tviewportValue={ value?.viewport ?? DEFAULT_STATE_VALUE }\n\t\t\tpseudoStateValue={ value?.pseudo ?? DEFAULT_STATE_VALUE }\n\t\t\tonChangeViewport={ ( viewport ) => onChange( { viewport } ) }\n\t\t\tonChangePseudoState={ ( pseudo ) => onChange( { pseudo } ) }\n\t\t\tpopoverProps={ dropdownMenuProps.popoverProps }\n\t\t\tshowText={ false }\n\t\t/>\n\t);\n}\n\nexport function BlockStateBadges( { name, value } ) {\n\tconst viewportStateOptions = getViewportStateOptions( name );\n\tconst pseudoStateOptions = getPseudoStateOptions( name );\n\n\tif ( ! viewportStateOptions.length && ! pseudoStateOptions.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StateControlBadges\n\t\t\tviewportStates={ viewportStateOptions }\n\t\t\tpseudoStates={ pseudoStateOptions }\n\t\t\tviewportValue={ value?.viewport ?? DEFAULT_STATE_VALUE }\n\t\t\tpseudoStateValue={ value?.pseudo ?? DEFAULT_STATE_VALUE }\n\t\t/>\n\t);\n}\n"],
5
- "mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AAKnB,OAAO,kBAAkB;AACzB,OAAO,wBAAwB;AAC/B,SAAS,sCAAsC;AAoE7C;AAlEK,IAAM,sBAAsB;AAAA,EAClC,UAAU,GAAI,OAAQ;AAAA,EACtB,UAAU,GAAI,OAAQ;AAAA,EACtB,kBAAkB,GAAI,eAAgB;AAAA,EACtC,WAAW,GAAI,QAAS;AACzB;AAEO,IAAM,0BAA0B;AAAA,EACtC,QAAQ,GAAI,QAAS;AAAA,EACrB,QAAQ,GAAI,QAAS;AACtB;AAIO,IAAM,4BAA4B;AAAA,EACxC,eAAe,CAAE,UAAU,UAAU,kBAAkB,SAAU;AAAA,EACjE,w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QAAS;AACnE,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,gBAAiB;AAAA,MACjB,cAAe;AAAA,MACf,eAAgB,OAAO,YAAY;AAAA,MACnC,kBAAmB,OAAO,UAAU;AAAA;AAAA,EACrC;AAEF;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport StateControl from '../components/global-styles/state-control';\nimport StateControlBadges from '../components/global-styles/state-control-badges';\nimport { useToolsPanelDropdownMenuProps } from '../components/global-styles/utils';\n\nexport const PSEUDO_STATE_LABELS = {\n\t':hover': __( 'Hover' ),\n\t':focus': __( 'Focus' ),\n\t':focus-visible': __( 'Focus-visible' ),\n\t':active': __( 'Active' ),\n};\n\nexport const RESPONSIVE_STATE_LABELS = {\n\t'@tablet': __( 'Tablet' ),\n\t'@mobile': __( 'Mobile' ),\n};\n\n// Keep in sync with WP_Theme_JSON_Gutenberg::VALID_BLOCK_PSEUDO_SELECTORS\n// and packages/global-styles-engine/src/core/render.tsx.\nexport const VALID_BLOCK_PSEUDO_STATES = {\n\t'core/button': [ ':hover', ':focus', ':focus-visible', ':active' ],\n\t'core/navigation-link': [ ':hover', ':focus', ':focus-visible', ':active' ],\n};\n\nfunction getPseudoStateOptions( name ) {\n\tconst validStates = VALID_BLOCK_PSEUDO_STATES[ name ] ?? [];\n\n\treturn validStates\n\t\t.filter( ( state ) => PSEUDO_STATE_LABELS[ state ] )\n\t\t.map( ( state ) => ( {\n\t\t\tvalue: state,\n\t\t\tlabel: PSEUDO_STATE_LABELS[ state ],\n\t\t} ) );\n}\n\nconst DEFAULT_STATE_VALUE = 'default';\n\nfunction getViewportStateOptions( name ) {\n\tif ( ! getBlockType( name )?.attributes?.style ) {\n\t\treturn [];\n\t}\n\n\treturn Object.entries( RESPONSIVE_STATE_LABELS ).map(\n\t\t( [ value, label ] ) => ( {\n\t\t\tvalue,\n\t\t\tlabel,\n\t\t} )\n\t);\n}\n\n/**\n * Renders a style-state selector in the block card header.\n * Viewport states are shown for blocks with a style attribute, while\n * pseudo-states are shown for blocks with configured pseudo-state support.\n *\n * @param {Object} props Component props.\n * @param {string} props.name Block name.\n * @param {Object} props.value Currently selected style-state value.\n * @param {Function} props.onChange Callback when style-state selection changes.\n * @return {Element|null} State control component, or null if not applicable.\n */\nexport function BlockStatesControl( { name, value, onChange } ) {\n\tconst viewportStateOptions = getViewportStateOptions( name );\n\tconst pseudoStateOptions = getPseudoStateOptions( name );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tif ( ! viewportStateOptions.length && ! pseudoStateOptions.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StateControl\n\t\t\tviewportStates={ viewportStateOptions }\n\t\t\tpseudoStates={ pseudoStateOptions }\n\t\t\tviewportValue={ value?.viewport ?? DEFAULT_STATE_VALUE }\n\t\t\tpseudoStateValue={ value?.pseudo ?? DEFAULT_STATE_VALUE }\n\t\t\tonChangeViewport={ ( viewport ) => onChange( { viewport } ) }\n\t\t\tonChangePseudoState={ ( pseudo ) => onChange( { pseudo } ) }\n\t\t\tpopoverProps={ dropdownMenuProps.popoverProps }\n\t\t\tshowText={ false }\n\t\t/>\n\t);\n}\n\nexport function BlockStateBadges( { name, value } ) {\n\tconst viewportStateOptions = getViewportStateOptions( name );\n\tconst pseudoStateOptions = getPseudoStateOptions( name );\n\n\tif ( ! viewportStateOptions.length && ! pseudoStateOptions.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StateControlBadges\n\t\t\tviewportStates={ viewportStateOptions }\n\t\t\tpseudoStates={ pseudoStateOptions }\n\t\t\tviewportValue={ value?.viewport ?? DEFAULT_STATE_VALUE }\n\t\t\tpseudoStateValue={ value?.pseudo ?? DEFAULT_STATE_VALUE }\n\t\t/>\n\t);\n}\n"],
5
+ "mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAA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A,MACf,eAAgB,OAAO,YAAY;AAAA,MACnC,kBAAmB,OAAO,UAAU;AAAA,MACpC,kBAAmB,CAAE,aAAc,SAAU,EAAE,SAAS,CAAE;AAAA,MAC1D,qBAAsB,CAAE,WAAY,SAAU,EAAE,OAAO,CAAE;AAAA,MACzD,cAAe,kBAAkB;AAAA,MACjC,UAAW;AAAA;AAAA,EACZ;AAEF;AAEO,SAAS,iBAAkB,EAAE,MAAM,MAAM,GAAI;AACnD,QAAM,uBAAuB,wBAAyB,IAAK;AAC3D,QAAM,qBAAqB,sBAAuB,IAAK;AAEvD,MAAK,CAAE,qBAAqB,UAAU,CAAE,mBAAmB,QAAS;AACnE,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,gBAAiB;AAAA,MACjB,cAAe;AAAA,MACf,eAAgB,OAAO,YAAY;AAAA,MACnC,kBAAmB,OAAO,UAAU;AAAA;AAAA,EACrC;AAEF;",
6
6
  "names": []
7
7
  }
@@ -13,7 +13,8 @@ import { useInstanceId } from "@wordpress/compose";
13
13
  import { getCSSRules, compileCSS } from "@wordpress/style-engine";
14
14
  import { BACKGROUND_SUPPORT_KEY, BackgroundImagePanel } from "./background.mjs";
15
15
  import { BORDER_SUPPORT_KEY, BorderPanel, SHADOW_SUPPORT_KEY } from "./border.mjs";
16
- import { COLOR_SUPPORT_KEY, ColorEdit } from "./color.mjs";
16
+ import { COLOR_SUPPORT_KEY } from "./color.mjs";
17
+ import { ElementsEdit } from "./elements.mjs";
17
18
  import {
18
19
  TypographyPanel,
19
20
  TYPOGRAPHY_SUPPORT_KEY,
@@ -22,7 +23,8 @@ import {
22
23
  import {
23
24
  DIMENSIONS_SUPPORT_KEY,
24
25
  SPACING_SUPPORT_KEY,
25
- DimensionsPanel
26
+ DimensionsPanel,
27
+ isExplicitAspectRatio
26
28
  } from "./dimensions.mjs";
27
29
  import {
28
30
  cleanEmptyObject,
@@ -47,8 +49,8 @@ import { unlock } from "../lock-unlock.mjs";
47
49
  import { jsx, jsxs } from "react/jsx-runtime";
48
50
  var BORDER_SIDES = ["Top", "Right", "Bottom", "Left"];
49
51
  var RESPONSIVE_BREAKPOINTS = {
50
- mobile: "@media (width <= 480px)",
51
- tablet: "@media (480px < width <= 782px)"
52
+ "@mobile": "@media (width <= 480px)",
53
+ "@tablet": "@media (480px < width <= 782px)"
52
54
  };
53
55
  var styleSupportKeys = [
54
56
  ...TYPOGRAPHY_SUPPORT_KEYS,
@@ -91,12 +93,52 @@ function getStateFallbackBorderStyles(stateStyles) {
91
93
  });
92
94
  return cleanEmptyObject({ border: cleanEmptyObject(fallbackBorder) });
93
95
  }
96
+ function getStateBackgroundResetCSS(stateStyles, selector) {
97
+ const hasSolidBackground = !!stateStyles?.color?.background;
98
+ if (!hasSolidBackground) {
99
+ return void 0;
100
+ }
101
+ const hasColorGradient = !!stateStyles?.color?.gradient;
102
+ const hasBackgroundGradient = !!stateStyles?.background?.gradient || !!stateStyles?.background?.backgroundImage;
103
+ if (hasColorGradient || hasBackgroundGradient) {
104
+ return void 0;
105
+ }
106
+ const declaration = "background-image: unset !important";
107
+ return selector ? `${selector} { ${declaration}; }` : `${declaration};`;
108
+ }
109
+ function getStateFallbackDimensionStyles(stateStyles) {
110
+ const dimensions = stateStyles?.dimensions;
111
+ if (!dimensions) {
112
+ return void 0;
113
+ }
114
+ if (isExplicitAspectRatio(dimensions.aspectRatio)) {
115
+ return {
116
+ dimensions: {
117
+ minHeight: "unset",
118
+ height: "unset"
119
+ }
120
+ };
121
+ }
122
+ if (dimensions.minHeight || dimensions.height) {
123
+ return {
124
+ dimensions: {
125
+ aspectRatio: "unset"
126
+ }
127
+ };
128
+ }
129
+ }
94
130
  function getStateStylesCSS(stateStyles, selector) {
95
- const css = compileCSS(stateStyles, { selector });
131
+ const fallbackDimensionStyles = getStateFallbackDimensionStyles(stateStyles);
132
+ const stylesWithDimensionFallbacks = fallbackDimensionStyles ? mergeStyleObjects(stateStyles, fallbackDimensionStyles) : stateStyles;
133
+ const css = compileCSS(stylesWithDimensionFallbacks, { selector });
96
134
  const importantCSS = css ? css.replace(/;/g, " !important;") : void 0;
97
135
  const fallbackBorderStyles = getStateFallbackBorderStyles(stateStyles);
98
136
  const fallbackCSS = fallbackBorderStyles ? compileCSS(fallbackBorderStyles, { selector }) : void 0;
99
- return [importantCSS, fallbackCSS].filter(Boolean).join("\n");
137
+ const backgroundResetCSS = getStateBackgroundResetCSS(
138
+ stateStyles,
139
+ selector
140
+ );
141
+ return [importantCSS, fallbackCSS, backgroundResetCSS].filter(Boolean).join("\n");
100
142
  }
101
143
  function isPlainObject(value) {
102
144
  return !!value && typeof value === "object" && !Array.isArray(value);
@@ -208,7 +250,10 @@ function getResponsiveStateCSSRules(style, name, baseSelector) {
208
250
  const nestedStateKeys = ["elements", ...validPseudoStates];
209
251
  Object.entries(RESPONSIVE_BREAKPOINTS).forEach(
210
252
  ([viewport, mediaQuery]) => {
211
- const viewportStyles = style?.[viewport];
253
+ const viewportStyles = getStyleForState(style, {
254
+ viewport,
255
+ pseudo: DEFAULT_BLOCK_STYLE_STATE.pseudo
256
+ });
212
257
  if (!viewportStyles) {
213
258
  return;
214
259
  }
@@ -437,7 +482,7 @@ function BlockStyleControls({
437
482
  settings: panelSettings
438
483
  };
439
484
  return /* @__PURE__ */ jsxs(BlockStyleStateProvider, { value: selectedState, children: [
440
- /* @__PURE__ */ jsx(ColorEdit, { ...passedProps }),
485
+ /* @__PURE__ */ jsx(ElementsEdit, { ...passedProps }),
441
486
  /* @__PURE__ */ jsx(BackgroundImagePanel, { ...passedProps }),
442
487
  /* @__PURE__ */ jsx(TypographyPanel, { ...passedProps }),
443
488
  /* @__PURE__ */ jsx(BorderPanel, { ...passedProps }),