@wordpress/block-editor 10.4.0 → 11.0.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 (638) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +0 -1
  3. package/build/autocompleters/block.js +2 -6
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/autocompleters/link.js +2 -0
  6. package/build/autocompleters/link.js.map +1 -1
  7. package/build/components/block-card/index.js +51 -3
  8. package/build/components/block-card/index.js.map +1 -1
  9. package/build/components/block-draggable/index.native.js +46 -39
  10. package/build/components/block-draggable/index.native.js.map +1 -1
  11. package/build/components/block-edit/edit.js +4 -3
  12. package/build/components/block-edit/edit.js.map +1 -1
  13. package/build/components/block-edit/edit.native.js +4 -7
  14. package/build/components/block-edit/edit.native.js.map +1 -1
  15. package/build/components/block-inspector/index.js +35 -33
  16. package/build/components/block-inspector/index.js.map +1 -1
  17. package/build/components/block-list/block-list-context.native.js +5 -8
  18. package/build/components/block-list/block-list-context.native.js.map +1 -1
  19. package/build/components/block-list/block.js +55 -24
  20. package/build/components/block-list/block.js.map +1 -1
  21. package/build/components/block-list/block.native.js +61 -28
  22. package/build/components/block-list/block.native.js.map +1 -1
  23. package/build/components/block-lock/menu-item.js +1 -1
  24. package/build/components/block-lock/menu-item.js.map +1 -1
  25. package/build/components/block-lock/modal.js +16 -9
  26. package/build/components/block-lock/modal.js.map +1 -1
  27. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +12 -4
  28. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  29. package/build/components/block-pattern-setup/index.js +3 -2
  30. package/build/components/block-pattern-setup/index.js.map +1 -1
  31. package/build/components/block-patterns-list/index.js +33 -11
  32. package/build/components/block-patterns-list/index.js.map +1 -1
  33. package/build/components/block-preview/auto.js +9 -3
  34. package/build/components/block-preview/auto.js.map +1 -1
  35. package/build/components/block-preview/index.js +5 -9
  36. package/build/components/block-preview/index.js.map +1 -1
  37. package/build/components/block-settings-menu/block-settings-dropdown.js +5 -2
  38. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  39. package/build/components/block-styles/utils.js +3 -3
  40. package/build/components/block-styles/utils.js.map +1 -1
  41. package/build/components/block-switcher/index.js +19 -4
  42. package/build/components/block-switcher/index.js.map +1 -1
  43. package/build/components/block-toolbar/index.js +5 -1
  44. package/build/components/block-toolbar/index.js.map +1 -1
  45. package/build/components/block-tools/insertion-point.js +8 -49
  46. package/build/components/block-tools/insertion-point.js.map +1 -1
  47. package/build/components/block-tools/selected-block-popover.js +27 -4
  48. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  49. package/build/components/block-variation-picker/index.js +1 -2
  50. package/build/components/block-variation-picker/index.js.map +1 -1
  51. package/build/components/colors/with-colors.js +4 -3
  52. package/build/components/colors/with-colors.js.map +1 -1
  53. package/build/components/font-sizes/fluid-utils.js +24 -40
  54. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  55. package/build/components/font-sizes/with-font-sizes.js +7 -5
  56. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  57. package/build/components/height-control/index.js +115 -0
  58. package/build/components/height-control/index.js.map +1 -0
  59. package/build/components/iframe/index.js +11 -8
  60. package/build/components/iframe/index.js.map +1 -1
  61. package/build/components/image-editor/use-save-image.js +2 -0
  62. package/build/components/image-editor/use-save-image.js.map +1 -1
  63. package/build/components/image-editor/zoom-dropdown.js +1 -0
  64. package/build/components/image-editor/zoom-dropdown.js.map +1 -1
  65. package/build/components/index.js +18 -0
  66. package/build/components/index.js.map +1 -1
  67. package/build/components/inner-blocks/index.js +25 -9
  68. package/build/components/inner-blocks/index.js.map +1 -1
  69. package/build/components/inner-blocks/use-inner-block-template-sync.js +25 -10
  70. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  71. package/build/components/inserter/block-patterns-explorer/sidebar.js +1 -0
  72. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  73. package/build/components/inserter/block-patterns-tab.js +25 -46
  74. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  75. package/build/components/inserter/block-types-tab.js +3 -1
  76. package/build/components/inserter/block-types-tab.js.map +1 -1
  77. package/build/components/inserter/hooks/use-debounced-input.js +27 -0
  78. package/build/components/inserter/hooks/use-debounced-input.js.map +1 -0
  79. package/build/components/inserter/index.js +8 -3
  80. package/build/components/inserter/index.js.map +1 -1
  81. package/build/components/inserter/index.native.js +3 -4
  82. package/build/components/inserter/index.native.js.map +1 -1
  83. package/build/components/inserter/media-tab/hooks.js +103 -0
  84. package/build/components/inserter/media-tab/hooks.js.map +1 -0
  85. package/build/components/inserter/media-tab/index.js +32 -0
  86. package/build/components/inserter/media-tab/index.js.map +1 -0
  87. package/build/components/inserter/media-tab/media-list.js +100 -0
  88. package/build/components/inserter/media-tab/media-list.js.map +1 -0
  89. package/build/components/inserter/media-tab/media-panel.js +96 -0
  90. package/build/components/inserter/media-tab/media-panel.js.map +1 -0
  91. package/build/components/inserter/media-tab/media-tab.js +120 -0
  92. package/build/components/inserter/media-tab/media-tab.js.map +1 -0
  93. package/build/components/inserter/media-tab/utils.js +54 -0
  94. package/build/components/inserter/media-tab/utils.js.map +1 -0
  95. package/build/components/inserter/menu.js +35 -12
  96. package/build/components/inserter/menu.js.map +1 -1
  97. package/build/components/inserter/mobile-tab-navigation.js +70 -0
  98. package/build/components/inserter/mobile-tab-navigation.js.map +1 -0
  99. package/build/components/inserter/quick-inserter.js +1 -0
  100. package/build/components/inserter/quick-inserter.js.map +1 -1
  101. package/build/components/inserter/reusable-blocks-tab.js +4 -1
  102. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  103. package/build/components/inserter/search-results.js +3 -1
  104. package/build/components/inserter/search-results.js.map +1 -1
  105. package/build/components/inserter/tabs.js +16 -2
  106. package/build/components/inserter/tabs.js.map +1 -1
  107. package/build/components/inserter-list-item/index.js +4 -1
  108. package/build/components/inserter-list-item/index.js.map +1 -1
  109. package/build/components/inspector-controls/groups.js +2 -0
  110. package/build/components/inspector-controls/groups.js.map +1 -1
  111. package/build/components/inspector-controls-tabs/advanced-controls-panel.js +46 -0
  112. package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
  113. package/build/components/inspector-controls-tabs/index.js +71 -0
  114. package/build/components/inspector-controls-tabs/index.js.map +1 -0
  115. package/build/components/inspector-controls-tabs/settings-tab.js +28 -0
  116. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -0
  117. package/build/components/inspector-controls-tabs/styles-tab.js +61 -0
  118. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -0
  119. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +97 -0
  120. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
  121. package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +18 -0
  122. package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
  123. package/build/components/inspector-controls-tabs/utils.js +37 -0
  124. package/build/components/inspector-controls-tabs/utils.js.map +1 -0
  125. package/build/components/link-control/index.js +19 -34
  126. package/build/components/link-control/index.js.map +1 -1
  127. package/build/components/link-control/search-input.js +1 -2
  128. package/build/components/link-control/search-input.js.map +1 -1
  129. package/build/components/link-control/use-internal-input-value.js +26 -0
  130. package/build/components/link-control/use-internal-input-value.js.map +1 -0
  131. package/build/components/list-view/block.js +10 -5
  132. package/build/components/list-view/block.js.map +1 -1
  133. package/build/components/list-view/branch.js +22 -15
  134. package/build/components/list-view/branch.js.map +1 -1
  135. package/build/components/media-upload/index.native.js +2 -3
  136. package/build/components/media-upload/index.native.js.map +1 -1
  137. package/build/components/off-canvas-editor/appender.js +104 -0
  138. package/build/components/off-canvas-editor/appender.js.map +1 -0
  139. package/build/components/off-canvas-editor/block-contents.js +100 -0
  140. package/build/components/off-canvas-editor/block-contents.js.map +1 -0
  141. package/build/components/off-canvas-editor/block-edit-button.js +50 -0
  142. package/build/components/off-canvas-editor/block-edit-button.js.map +1 -0
  143. package/build/components/off-canvas-editor/block-select-button.js +119 -0
  144. package/build/components/off-canvas-editor/block-select-button.js.map +1 -0
  145. package/build/components/off-canvas-editor/block.js +324 -0
  146. package/build/components/off-canvas-editor/block.js.map +1 -0
  147. package/build/components/off-canvas-editor/branch.js +179 -0
  148. package/build/components/off-canvas-editor/branch.js.map +1 -0
  149. package/build/components/off-canvas-editor/context.js +19 -0
  150. package/build/components/off-canvas-editor/context.js.map +1 -0
  151. package/build/components/off-canvas-editor/drop-indicator.js +118 -0
  152. package/build/components/off-canvas-editor/drop-indicator.js.map +1 -0
  153. package/build/components/off-canvas-editor/expander.js +41 -0
  154. package/build/components/off-canvas-editor/expander.js.map +1 -0
  155. package/build/components/off-canvas-editor/index.js +213 -0
  156. package/build/components/off-canvas-editor/index.js.map +1 -0
  157. package/build/components/off-canvas-editor/leaf.js +60 -0
  158. package/build/components/off-canvas-editor/leaf.js.map +1 -0
  159. package/build/components/off-canvas-editor/link-ui.js +185 -0
  160. package/build/components/off-canvas-editor/link-ui.js.map +1 -0
  161. package/build/components/off-canvas-editor/update-attributes.js +108 -0
  162. package/build/components/off-canvas-editor/update-attributes.js.map +1 -0
  163. package/build/components/off-canvas-editor/use-block-selection.js +139 -0
  164. package/build/components/off-canvas-editor/use-block-selection.js.map +1 -0
  165. package/build/components/off-canvas-editor/use-list-view-client-ids.js +33 -0
  166. package/build/components/off-canvas-editor/use-list-view-client-ids.js.map +1 -0
  167. package/build/components/off-canvas-editor/use-list-view-drop-zone.js +235 -0
  168. package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -0
  169. package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js +60 -0
  170. package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +1 -0
  171. package/build/components/off-canvas-editor/utils.js +60 -0
  172. package/build/components/off-canvas-editor/utils.js.map +1 -0
  173. package/build/components/rich-text/format-toolbar/index.js +8 -4
  174. package/build/components/rich-text/format-toolbar/index.js.map +1 -1
  175. package/build/components/rich-text/index.js +3 -3
  176. package/build/components/rich-text/index.js.map +1 -1
  177. package/build/components/rich-text/index.native.js +0 -2
  178. package/build/components/rich-text/index.native.js.map +1 -1
  179. package/build/components/rich-text/use-insert-replacement-text.js +43 -0
  180. package/build/components/rich-text/use-insert-replacement-text.js.map +1 -0
  181. package/build/components/rich-text/use-undo-automatic-change.js +9 -1
  182. package/build/components/rich-text/use-undo-automatic-change.js.map +1 -1
  183. package/build/components/rich-text/utils.js +1 -19
  184. package/build/components/rich-text/utils.js.map +1 -1
  185. package/build/components/spacing-sizes-control/spacing-input-control.js +12 -3
  186. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  187. package/build/components/ungroup-button/index.native.js +4 -2
  188. package/build/components/ungroup-button/index.native.js.map +1 -1
  189. package/build/components/url-input/index.js +46 -43
  190. package/build/components/url-input/index.js.map +1 -1
  191. package/build/components/url-popover/index.js +31 -2
  192. package/build/components/url-popover/index.js.map +1 -1
  193. package/build/components/use-block-display-information/index.js +8 -4
  194. package/build/components/use-block-display-information/index.js.map +1 -1
  195. package/build/components/use-setting/index.js +10 -2
  196. package/build/components/use-setting/index.js.map +1 -1
  197. package/build/hooks/child-layout.js +209 -0
  198. package/build/hooks/child-layout.js.map +1 -0
  199. package/build/hooks/color-panel.js +17 -1
  200. package/build/hooks/color-panel.js.map +1 -1
  201. package/build/hooks/color.js +1 -1
  202. package/build/hooks/color.js.map +1 -1
  203. package/build/hooks/content-lock-ui.js +14 -7
  204. package/build/hooks/content-lock-ui.js.map +1 -1
  205. package/build/hooks/dimensions.js +65 -16
  206. package/build/hooks/dimensions.js.map +1 -1
  207. package/build/hooks/layout.js +59 -3
  208. package/build/hooks/layout.js.map +1 -1
  209. package/build/hooks/margin.js +4 -2
  210. package/build/hooks/margin.js.map +1 -1
  211. package/build/hooks/min-height.js +139 -0
  212. package/build/hooks/min-height.js.map +1 -0
  213. package/build/hooks/padding.js +4 -2
  214. package/build/hooks/padding.js.map +1 -1
  215. package/build/hooks/style.js +3 -2
  216. package/build/hooks/style.js.map +1 -1
  217. package/build/layouts/flex.js +22 -21
  218. package/build/layouts/flex.js.map +1 -1
  219. package/build/store/actions.js +26 -0
  220. package/build/store/actions.js.map +1 -1
  221. package/build/store/reducer.js +420 -265
  222. package/build/store/reducer.js.map +1 -1
  223. package/build/store/selectors.js +73 -49
  224. package/build/store/selectors.js.map +1 -1
  225. package/build/utils/sorting.js +63 -0
  226. package/build/utils/sorting.js.map +1 -0
  227. package/build-module/autocompleters/block.js +2 -6
  228. package/build-module/autocompleters/block.js.map +1 -1
  229. package/build-module/autocompleters/link.js +2 -0
  230. package/build-module/autocompleters/link.js.map +1 -1
  231. package/build-module/components/block-card/index.js +45 -3
  232. package/build-module/components/block-card/index.js.map +1 -1
  233. package/build-module/components/block-draggable/index.native.js +40 -31
  234. package/build-module/components/block-draggable/index.native.js.map +1 -1
  235. package/build-module/components/block-edit/edit.js +4 -2
  236. package/build-module/components/block-edit/edit.js.map +1 -1
  237. package/build-module/components/block-edit/edit.native.js +4 -6
  238. package/build-module/components/block-edit/edit.native.js.map +1 -1
  239. package/build-module/components/block-inspector/index.js +32 -30
  240. package/build-module/components/block-inspector/index.js.map +1 -1
  241. package/build-module/components/block-list/block-list-context.native.js +5 -8
  242. package/build-module/components/block-list/block-list-context.native.js.map +1 -1
  243. package/build-module/components/block-list/block.js +55 -25
  244. package/build-module/components/block-list/block.js.map +1 -1
  245. package/build-module/components/block-list/block.native.js +61 -28
  246. package/build-module/components/block-list/block.native.js.map +1 -1
  247. package/build-module/components/block-lock/menu-item.js +2 -2
  248. package/build-module/components/block-lock/menu-item.js.map +1 -1
  249. package/build-module/components/block-lock/modal.js +17 -10
  250. package/build-module/components/block-lock/modal.js.map +1 -1
  251. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +13 -6
  252. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  253. package/build-module/components/block-pattern-setup/index.js +3 -2
  254. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  255. package/build-module/components/block-patterns-list/index.js +35 -13
  256. package/build-module/components/block-patterns-list/index.js.map +1 -1
  257. package/build-module/components/block-preview/auto.js +9 -3
  258. package/build-module/components/block-preview/auto.js.map +1 -1
  259. package/build-module/components/block-preview/index.js +5 -8
  260. package/build-module/components/block-preview/index.js.map +1 -1
  261. package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -2
  262. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  263. package/build-module/components/block-styles/utils.js +3 -3
  264. package/build-module/components/block-styles/utils.js.map +1 -1
  265. package/build-module/components/block-switcher/index.js +19 -4
  266. package/build-module/components/block-switcher/index.js.map +1 -1
  267. package/build-module/components/block-toolbar/index.js +6 -2
  268. package/build-module/components/block-toolbar/index.js.map +1 -1
  269. package/build-module/components/block-tools/insertion-point.js +8 -49
  270. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  271. package/build-module/components/block-tools/selected-block-popover.js +27 -5
  272. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  273. package/build-module/components/block-variation-picker/index.js +1 -2
  274. package/build-module/components/block-variation-picker/index.js.map +1 -1
  275. package/build-module/components/colors/with-colors.js +5 -4
  276. package/build-module/components/colors/with-colors.js.map +1 -1
  277. package/build-module/components/font-sizes/fluid-utils.js +24 -40
  278. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  279. package/build-module/components/font-sizes/with-font-sizes.js +8 -6
  280. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  281. package/build-module/components/height-control/index.js +103 -0
  282. package/build-module/components/height-control/index.js.map +1 -0
  283. package/build-module/components/iframe/index.js +11 -8
  284. package/build-module/components/iframe/index.js.map +1 -1
  285. package/build-module/components/image-editor/use-save-image.js +2 -0
  286. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  287. package/build-module/components/image-editor/zoom-dropdown.js +1 -0
  288. package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
  289. package/build-module/components/index.js +2 -0
  290. package/build-module/components/index.js.map +1 -1
  291. package/build-module/components/inner-blocks/index.js +27 -11
  292. package/build-module/components/inner-blocks/index.js.map +1 -1
  293. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +23 -10
  294. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  295. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +1 -0
  296. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  297. package/build-module/components/inserter/block-patterns-tab.js +27 -49
  298. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  299. package/build-module/components/inserter/block-types-tab.js +3 -2
  300. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  301. package/build-module/components/inserter/hooks/use-debounced-input.js +18 -0
  302. package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -0
  303. package/build-module/components/inserter/index.js +8 -3
  304. package/build-module/components/inserter/index.js.map +1 -1
  305. package/build-module/components/inserter/index.native.js +3 -5
  306. package/build-module/components/inserter/index.native.js.map +1 -1
  307. package/build-module/components/inserter/media-tab/hooks.js +89 -0
  308. package/build-module/components/inserter/media-tab/hooks.js.map +1 -0
  309. package/build-module/components/inserter/media-tab/index.js +4 -0
  310. package/build-module/components/inserter/media-tab/index.js.map +1 -0
  311. package/build-module/components/inserter/media-tab/media-list.js +86 -0
  312. package/build-module/components/inserter/media-tab/media-list.js.map +1 -0
  313. package/build-module/components/inserter/media-tab/media-panel.js +77 -0
  314. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -0
  315. package/build-module/components/inserter/media-tab/media-tab.js +100 -0
  316. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -0
  317. package/build-module/components/inserter/media-tab/utils.js +45 -0
  318. package/build-module/components/inserter/media-tab/utils.js.map +1 -0
  319. package/build-module/components/inserter/menu.js +33 -12
  320. package/build-module/components/inserter/menu.js.map +1 -1
  321. package/build-module/components/inserter/mobile-tab-navigation.js +61 -0
  322. package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -0
  323. package/build-module/components/inserter/quick-inserter.js +1 -0
  324. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  325. package/build-module/components/inserter/reusable-blocks-tab.js +3 -1
  326. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  327. package/build-module/components/inserter/search-results.js +3 -2
  328. package/build-module/components/inserter/search-results.js.map +1 -1
  329. package/build-module/components/inserter/tabs.js +15 -2
  330. package/build-module/components/inserter/tabs.js.map +1 -1
  331. package/build-module/components/inserter-list-item/index.js +5 -2
  332. package/build-module/components/inserter-list-item/index.js.map +1 -1
  333. package/build-module/components/inspector-controls/groups.js +2 -0
  334. package/build-module/components/inspector-controls/groups.js.map +1 -1
  335. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js +32 -0
  336. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
  337. package/build-module/components/inspector-controls-tabs/index.js +56 -0
  338. package/build-module/components/inspector-controls-tabs/index.js.map +1 -0
  339. package/build-module/components/inspector-controls-tabs/settings-tab.js +17 -0
  340. package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -0
  341. package/build-module/components/inspector-controls-tabs/styles-tab.js +46 -0
  342. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -0
  343. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +81 -0
  344. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
  345. package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +8 -0
  346. package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
  347. package/build-module/components/inspector-controls-tabs/utils.js +26 -0
  348. package/build-module/components/inspector-controls-tabs/utils.js.map +1 -0
  349. package/build-module/components/link-control/index.js +18 -34
  350. package/build-module/components/link-control/index.js.map +1 -1
  351. package/build-module/components/link-control/search-input.js +1 -2
  352. package/build-module/components/link-control/search-input.js.map +1 -1
  353. package/build-module/components/link-control/use-internal-input-value.js +18 -0
  354. package/build-module/components/link-control/use-internal-input-value.js.map +1 -0
  355. package/build-module/components/list-view/block.js +10 -5
  356. package/build-module/components/list-view/block.js.map +1 -1
  357. package/build-module/components/list-view/branch.js +21 -14
  358. package/build-module/components/list-view/branch.js.map +1 -1
  359. package/build-module/components/media-upload/index.native.js +2 -4
  360. package/build-module/components/media-upload/index.native.js.map +1 -1
  361. package/build-module/components/off-canvas-editor/appender.js +89 -0
  362. package/build-module/components/off-canvas-editor/appender.js.map +1 -0
  363. package/build-module/components/off-canvas-editor/block-contents.js +85 -0
  364. package/build-module/components/off-canvas-editor/block-contents.js.map +1 -0
  365. package/build-module/components/off-canvas-editor/block-edit-button.js +35 -0
  366. package/build-module/components/off-canvas-editor/block-edit-button.js.map +1 -0
  367. package/build-module/components/off-canvas-editor/block-select-button.js +101 -0
  368. package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -0
  369. package/build-module/components/off-canvas-editor/block.js +298 -0
  370. package/build-module/components/off-canvas-editor/block.js.map +1 -0
  371. package/build-module/components/off-canvas-editor/branch.js +164 -0
  372. package/build-module/components/off-canvas-editor/branch.js.map +1 -0
  373. package/build-module/components/off-canvas-editor/context.js +7 -0
  374. package/build-module/components/off-canvas-editor/context.js.map +1 -0
  375. package/build-module/components/off-canvas-editor/drop-indicator.js +111 -0
  376. package/build-module/components/off-canvas-editor/drop-indicator.js.map +1 -0
  377. package/build-module/components/off-canvas-editor/expander.js +32 -0
  378. package/build-module/components/off-canvas-editor/expander.js.map +1 -0
  379. package/build-module/components/off-canvas-editor/index.js +189 -0
  380. package/build-module/components/off-canvas-editor/index.js.map +1 -0
  381. package/build-module/components/off-canvas-editor/leaf.js +45 -0
  382. package/build-module/components/off-canvas-editor/leaf.js.map +1 -0
  383. package/build-module/components/off-canvas-editor/link-ui.js +165 -0
  384. package/build-module/components/off-canvas-editor/link-ui.js.map +1 -0
  385. package/build-module/components/off-canvas-editor/update-attributes.js +97 -0
  386. package/build-module/components/off-canvas-editor/update-attributes.js.map +1 -0
  387. package/build-module/components/off-canvas-editor/use-block-selection.js +124 -0
  388. package/build-module/components/off-canvas-editor/use-block-selection.js.map +1 -0
  389. package/build-module/components/off-canvas-editor/use-list-view-client-ids.js +24 -0
  390. package/build-module/components/off-canvas-editor/use-list-view-client-ids.js.map +1 -0
  391. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +220 -0
  392. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -0
  393. package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js +50 -0
  394. package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +1 -0
  395. package/build-module/components/off-canvas-editor/utils.js +44 -0
  396. package/build-module/components/off-canvas-editor/utils.js.map +1 -0
  397. package/build-module/components/rich-text/format-toolbar/index.js +6 -2
  398. package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
  399. package/build-module/components/rich-text/index.js +2 -3
  400. package/build-module/components/rich-text/index.js.map +1 -1
  401. package/build-module/components/rich-text/index.native.js +0 -2
  402. package/build-module/components/rich-text/index.native.js.map +1 -1
  403. package/build-module/components/rich-text/use-insert-replacement-text.js +33 -0
  404. package/build-module/components/rich-text/use-insert-replacement-text.js.map +1 -0
  405. package/build-module/components/rich-text/use-undo-automatic-change.js +9 -1
  406. package/build-module/components/rich-text/use-undo-automatic-change.js.map +1 -1
  407. package/build-module/components/rich-text/utils.js +1 -16
  408. package/build-module/components/rich-text/utils.js.map +1 -1
  409. package/build-module/components/spacing-sizes-control/spacing-input-control.js +12 -3
  410. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  411. package/build-module/components/ungroup-button/index.native.js +3 -2
  412. package/build-module/components/ungroup-button/index.native.js.map +1 -1
  413. package/build-module/components/url-input/index.js +46 -43
  414. package/build-module/components/url-input/index.js.map +1 -1
  415. package/build-module/components/url-popover/index.js +30 -3
  416. package/build-module/components/url-popover/index.js.map +1 -1
  417. package/build-module/components/use-block-display-information/index.js +9 -5
  418. package/build-module/components/use-block-display-information/index.js.map +1 -1
  419. package/build-module/components/use-setting/index.js +9 -2
  420. package/build-module/components/use-setting/index.js.map +1 -1
  421. package/build-module/hooks/child-layout.js +189 -0
  422. package/build-module/hooks/child-layout.js.map +1 -0
  423. package/build-module/hooks/color-panel.js +17 -1
  424. package/build-module/hooks/color-panel.js.map +1 -1
  425. package/build-module/hooks/color.js +1 -1
  426. package/build-module/hooks/color.js.map +1 -1
  427. package/build-module/hooks/content-lock-ui.js +16 -9
  428. package/build-module/hooks/content-lock-ui.js.map +1 -1
  429. package/build-module/hooks/dimensions.js +60 -16
  430. package/build-module/hooks/dimensions.js.map +1 -1
  431. package/build-module/hooks/layout.js +57 -2
  432. package/build-module/hooks/layout.js.map +1 -1
  433. package/build-module/hooks/margin.js +4 -2
  434. package/build-module/hooks/margin.js.map +1 -1
  435. package/build-module/hooks/min-height.js +116 -0
  436. package/build-module/hooks/min-height.js.map +1 -0
  437. package/build-module/hooks/padding.js +4 -2
  438. package/build-module/hooks/padding.js.map +1 -1
  439. package/build-module/hooks/style.js +4 -3
  440. package/build-module/hooks/style.js.map +1 -1
  441. package/build-module/layouts/flex.js +23 -22
  442. package/build-module/layouts/flex.js.map +1 -1
  443. package/build-module/store/actions.js +22 -0
  444. package/build-module/store/actions.js.map +1 -1
  445. package/build-module/store/reducer.js +415 -265
  446. package/build-module/store/reducer.js.map +1 -1
  447. package/build-module/store/selectors.js +66 -48
  448. package/build-module/store/selectors.js.map +1 -1
  449. package/build-module/utils/sorting.js +56 -0
  450. package/build-module/utils/sorting.js.map +1 -0
  451. package/build-style/content-rtl.css +701 -0
  452. package/build-style/content.css +701 -0
  453. package/build-style/default-editor-styles-rtl.css +14 -0
  454. package/build-style/default-editor-styles.css +14 -0
  455. package/build-style/style-rtl.css +305 -668
  456. package/build-style/style.css +305 -668
  457. package/package.json +32 -30
  458. package/src/autocompleters/block.js +2 -6
  459. package/src/autocompleters/link.js +2 -0
  460. package/src/components/alignment-control/README.md +1 -1
  461. package/src/components/alignment-control/test/index.js +4 -1
  462. package/src/components/block-alignment-control/test/index.js +4 -1
  463. package/src/components/block-alignment-control/test/index.native.js +4 -4
  464. package/src/components/block-card/index.js +46 -2
  465. package/src/components/block-card/style.scss +4 -0
  466. package/src/components/block-content-overlay/{style.scss → content.scss} +7 -1
  467. package/src/components/block-draggable/content.scss +20 -0
  468. package/src/components/block-draggable/index.native.js +54 -40
  469. package/src/components/block-draggable/style.scss +0 -21
  470. package/src/components/block-draggable/test/helpers.native.js +7 -9
  471. package/src/components/block-draggable/test/index.native.js +35 -45
  472. package/src/components/block-edit/edit.js +5 -2
  473. package/src/components/block-edit/edit.native.js +5 -6
  474. package/src/components/block-inspector/index.js +96 -81
  475. package/src/components/block-inspector/style.scss +9 -1
  476. package/src/components/block-list/block-list-context.native.js +5 -8
  477. package/src/components/block-list/block.js +74 -23
  478. package/src/components/block-list/block.native.js +78 -23
  479. package/src/components/block-list/{style.scss → content.scss} +11 -20
  480. package/src/components/block-list-appender/{style.scss → content.scss} +0 -0
  481. package/src/components/block-lock/menu-item.js +5 -2
  482. package/src/components/block-lock/modal.js +19 -36
  483. package/src/components/block-lock/style.scss +8 -17
  484. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +24 -6
  485. package/src/components/block-mover/style.scss +0 -1
  486. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +0 -2
  487. package/src/components/block-pattern-setup/index.js +2 -1
  488. package/src/components/block-patterns-list/index.js +47 -24
  489. package/src/components/block-popover/style.scss +1 -1
  490. package/src/components/block-preview/README.md +15 -10
  491. package/src/components/block-preview/auto.js +7 -1
  492. package/src/components/block-preview/content.scss +4 -0
  493. package/src/components/block-preview/index.js +7 -12
  494. package/src/components/block-preview/style.scss +0 -7
  495. package/src/components/block-preview/test/index.js +18 -35
  496. package/src/components/block-selection-clearer/test/index.js +12 -12
  497. package/src/components/block-settings-menu/block-settings-dropdown.js +32 -20
  498. package/src/components/block-styles/utils.js +3 -3
  499. package/src/components/block-switcher/index.js +19 -4
  500. package/src/components/block-switcher/test/index.js +4 -0
  501. package/src/components/block-toolbar/index.js +12 -5
  502. package/src/components/block-toolbar/style.scss +10 -0
  503. package/src/components/block-tools/insertion-point.js +3 -47
  504. package/src/components/block-tools/selected-block-popover.js +80 -34
  505. package/src/components/block-tools/style.scss +27 -5
  506. package/src/components/block-variation-picker/index.js +1 -4
  507. package/src/components/block-vertical-alignment-control/test/index.js +4 -1
  508. package/src/components/colors/with-colors.js +13 -23
  509. package/src/components/default-block-appender/{style.scss → content.scss} +1 -0
  510. package/src/components/font-sizes/fluid-utils.js +37 -64
  511. package/src/components/font-sizes/test/fluid-utils.js +5 -5
  512. package/src/components/font-sizes/with-font-sizes.js +14 -11
  513. package/src/components/height-control/index.js +123 -0
  514. package/src/components/height-control/stories/index.js +21 -0
  515. package/src/components/height-control/style.scss +5 -0
  516. package/src/components/iframe/index.js +25 -18
  517. package/src/components/image-editor/use-save-image.js +2 -0
  518. package/src/components/image-editor/zoom-dropdown.js +1 -0
  519. package/src/components/index.js +2 -0
  520. package/src/components/inner-blocks/{style.scss → content.scss} +0 -0
  521. package/src/components/inner-blocks/index.js +30 -10
  522. package/src/components/inner-blocks/use-inner-block-template-sync.js +28 -10
  523. package/src/components/inserter/block-patterns-explorer/sidebar.js +1 -0
  524. package/src/components/inserter/block-patterns-tab.js +28 -71
  525. package/src/components/inserter/block-types-tab.js +3 -2
  526. package/src/components/inserter/hooks/use-debounced-input.js +17 -0
  527. package/src/components/inserter/index.js +10 -2
  528. package/src/components/inserter/index.native.js +1 -1
  529. package/src/components/inserter/media-tab/hooks.js +88 -0
  530. package/src/components/inserter/media-tab/index.js +3 -0
  531. package/src/components/inserter/media-tab/media-list.js +93 -0
  532. package/src/components/inserter/media-tab/media-panel.js +83 -0
  533. package/src/components/inserter/media-tab/media-tab.js +135 -0
  534. package/src/components/inserter/media-tab/utils.js +37 -0
  535. package/src/components/inserter/menu.js +55 -13
  536. package/src/components/inserter/mobile-tab-navigation.js +85 -0
  537. package/src/components/inserter/quick-inserter.js +1 -0
  538. package/src/components/inserter/reusable-blocks-tab.js +4 -2
  539. package/src/components/inserter/search-results.js +3 -2
  540. package/src/components/inserter/stories/index.js +1 -1
  541. package/src/components/inserter/stories/{fixtures.js → utils/fixtures.js} +0 -0
  542. package/src/components/inserter/style.scss +184 -18
  543. package/src/components/inserter/tabs.js +12 -1
  544. package/src/components/inserter/test/reusable-blocks-tab.js +14 -57
  545. package/src/components/inserter-list-item/index.js +11 -1
  546. package/src/components/inserter-list-item/style.scss +26 -0
  547. package/src/components/inspector-controls/groups.js +2 -0
  548. package/src/components/inspector-controls-tabs/advanced-controls-panel.js +37 -0
  549. package/src/components/inspector-controls-tabs/index.js +62 -0
  550. package/src/components/inspector-controls-tabs/settings-tab.js +18 -0
  551. package/src/components/inspector-controls-tabs/styles-tab.js +51 -0
  552. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +89 -0
  553. package/src/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +9 -0
  554. package/src/components/inspector-controls-tabs/utils.js +28 -0
  555. package/src/components/line-height-control/test/index.js +5 -5
  556. package/src/components/link-control/README.md +1 -1
  557. package/src/components/link-control/index.js +24 -39
  558. package/src/components/link-control/search-input.js +1 -2
  559. package/src/components/link-control/test/index.js +400 -582
  560. package/src/components/link-control/use-internal-input-value.js +22 -0
  561. package/src/components/list-view/block.js +7 -3
  562. package/src/components/list-view/branch.js +21 -14
  563. package/src/components/list-view/style.scss +20 -9
  564. package/src/components/media-placeholder/{style.scss → content.scss} +0 -0
  565. package/src/components/media-replace-flow/test/index.js +37 -9
  566. package/src/components/media-upload/test/index.native.js +2 -0
  567. package/src/components/off-canvas-editor/README.md +5 -0
  568. package/src/components/off-canvas-editor/appender.js +93 -0
  569. package/src/components/off-canvas-editor/block-contents.js +89 -0
  570. package/src/components/off-canvas-editor/block-edit-button.js +27 -0
  571. package/src/components/off-canvas-editor/block-select-button.js +113 -0
  572. package/src/components/off-canvas-editor/block.js +401 -0
  573. package/src/components/off-canvas-editor/branch.js +208 -0
  574. package/src/components/off-canvas-editor/context.js +8 -0
  575. package/src/components/off-canvas-editor/drop-indicator.js +126 -0
  576. package/src/components/off-canvas-editor/expander.js +26 -0
  577. package/src/components/off-canvas-editor/index.js +242 -0
  578. package/src/components/off-canvas-editor/leaf.js +52 -0
  579. package/src/components/off-canvas-editor/link-ui.js +166 -0
  580. package/src/components/off-canvas-editor/style.scss +26 -0
  581. package/src/components/off-canvas-editor/test/utils.js +50 -0
  582. package/src/components/off-canvas-editor/update-attributes.js +99 -0
  583. package/src/components/off-canvas-editor/use-block-selection.js +169 -0
  584. package/src/components/off-canvas-editor/use-list-view-client-ids.js +29 -0
  585. package/src/components/off-canvas-editor/use-list-view-drop-zone.js +260 -0
  586. package/src/components/off-canvas-editor/use-list-view-expand-selected-item.js +58 -0
  587. package/src/components/off-canvas-editor/utils.js +58 -0
  588. package/src/components/plain-text/{style.scss → content.scss} +0 -0
  589. package/src/components/recursion-provider/test/index.js +27 -29
  590. package/src/components/responsive-block-control/test/index.js +69 -92
  591. package/src/components/rich-text/content.scss +42 -0
  592. package/src/components/rich-text/format-toolbar/index.js +6 -4
  593. package/src/components/rich-text/index.js +2 -2
  594. package/src/components/rich-text/index.native.js +0 -2
  595. package/src/components/rich-text/style.scss +0 -43
  596. package/src/components/rich-text/use-insert-replacement-text.js +31 -0
  597. package/src/components/rich-text/use-undo-automatic-change.js +7 -1
  598. package/src/components/rich-text/utils.js +2 -21
  599. package/src/components/spacing-sizes-control/spacing-input-control.js +9 -0
  600. package/src/components/ungroup-button/index.native.js +6 -2
  601. package/src/components/url-input/index.js +57 -73
  602. package/src/components/url-popover/README.md +12 -3
  603. package/src/components/url-popover/index.js +33 -3
  604. package/src/components/url-popover/test/__snapshots__/index.js.snap +8 -6
  605. package/src/components/url-popover/test/index.js +21 -9
  606. package/src/components/use-block-display-information/index.js +14 -5
  607. package/src/components/use-setting/index.js +20 -2
  608. package/src/components/use-setting/test/index.js +99 -0
  609. package/src/content.scss +10 -0
  610. package/src/hooks/child-layout.js +190 -0
  611. package/src/hooks/color-panel.js +13 -1
  612. package/src/hooks/color.js +2 -0
  613. package/src/hooks/content-lock-ui.js +47 -35
  614. package/src/hooks/dimensions.js +119 -21
  615. package/src/hooks/layout.js +62 -3
  616. package/src/hooks/margin.js +4 -3
  617. package/src/hooks/min-height.js +104 -0
  618. package/src/hooks/padding.js +4 -3
  619. package/src/hooks/style.js +10 -2
  620. package/src/hooks/test/style.js +4 -0
  621. package/src/hooks/test/use-typography-props.js +1 -1
  622. package/src/layouts/flex.js +43 -38
  623. package/src/store/actions.js +22 -0
  624. package/src/store/reducer.js +480 -434
  625. package/src/store/selectors.js +70 -64
  626. package/src/store/test/actions.js +18 -0
  627. package/src/store/test/performance.js +71 -0
  628. package/src/store/test/reducer.js +662 -490
  629. package/src/store/test/selectors.js +1839 -1306
  630. package/src/style.scss +4 -7
  631. package/src/utils/sorting.js +54 -0
  632. package/src/utils/test/sorting.js +49 -0
  633. package/tsconfig.tsbuildinfo +1 -1
  634. package/build/components/block-preview/live.js +0 -30
  635. package/build/components/block-preview/live.js.map +0 -1
  636. package/build-module/components/block-preview/live.js +0 -20
  637. package/build-module/components/block-preview/live.js.map +0 -1
  638. package/src/components/block-preview/live.js +0 -19
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/dimensions.js"],"names":["SPACING_SUPPORT_KEY","ALL_SIDES","AXIAL_SIDES","useVisualizerMouseOver","isMouseOver","setIsMouseOver","onMouseOver","onMouseOut","DimensionsPanel","props","isGapDisabled","isPaddingDisabled","isMarginDisabled","isDisabled","useIsDimensionsDisabled","isSupported","hasDimensionsSupport","name","spacingSizes","paddingMouseOver","marginMouseOver","defaultSpacingControls","createResetAllFilter","attribute","newAttributes","style","spacing","undefined","spacingClassnames","length","padding","clientId","margin","blockGap","blockName","Platform","OS","gapDisabled","paddingDisabled","marginDisabled","useCustomSides","feature","support","Array","isArray","sides","useI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D,IAApB,CAAxB,CADA,IAEAH,KAAK,CAACE,IAAN,CAAcC,IAAF,IAAY9C,WAAW,CAAC+C,QAAZ,CAAsBD,IAAtB,CAAxB,CAHD,EAIE;AACD;AACAE,IAAAA,OAAO,CAACC,IAAR,CACE,OAAOV,OAAS,qBAAqBP,SAAW,0EADlD;AAGA,WAAO,KAAP;AACA;;AAED,SAAO,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';\nimport { Platform, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tGapEdit,\n\thasGapSupport,\n\thasGapValue,\n\tresetGap,\n\tuseIsGapDisabled,\n} from './gap';\nimport {\n\tMarginEdit,\n\tMarginVisualizer,\n\thasMarginSupport,\n\thasMarginValue,\n\tresetMargin,\n\tuseIsMarginDisabled,\n} from './margin';\nimport {\n\tPaddingEdit,\n\tPaddingVisualizer,\n\thasPaddingSupport,\n\thasPaddingValue,\n\tresetPadding,\n\tuseIsPaddingDisabled,\n} from './padding';\nimport useSetting from '../components/use-setting';\n\nexport const SPACING_SUPPORT_KEY = 'spacing';\nexport const ALL_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nexport const AXIAL_SIDES = [ 'vertical', 'horizontal' ];\n\nfunction useVisualizerMouseOver() {\n\tconst [ isMouseOver, setIsMouseOver ] = useState( false );\n\tconst onMouseOver = () => setIsMouseOver( true );\n\tconst onMouseOut = () => setIsMouseOver( false );\n\treturn { isMouseOver, onMouseOver, onMouseOut };\n}\n\n/**\n * Inspector controls for dimensions support.\n *\n * @param {Object} props Block props.\n *\n * @return {WPElement} Inspector controls for spacing support features.\n */\nexport function DimensionsPanel( props ) {\n\tconst isGapDisabled = useIsGapDisabled( props );\n\tconst isPaddingDisabled = useIsPaddingDisabled( props );\n\tconst isMarginDisabled = useIsMarginDisabled( props );\n\tconst isDisabled = useIsDimensionsDisabled( props );\n\tconst isSupported = hasDimensionsSupport( props.name );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\tconst paddingMouseOver = useVisualizerMouseOver();\n\tconst marginMouseOver = useVisualizerMouseOver();\n\n\tif ( isDisabled || ! isSupported ) {\n\t\treturn null;\n\t}\n\n\tconst defaultSpacingControls = getBlockSupport( props.name, [\n\t\tSPACING_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst createResetAllFilter = ( attribute ) => ( newAttributes ) => ( {\n\t\t...newAttributes,\n\t\tstyle: {\n\t\t\t...newAttributes.style,\n\t\t\tspacing: {\n\t\t\t\t...newAttributes.style?.spacing,\n\t\t\t\t[ attribute ]: undefined,\n\t\t\t},\n\t\t},\n\t} );\n\n\tconst spacingClassnames = classnames( {\n\t\t'tools-panel-item-spacing': spacingSizes && spacingSizes.length > 0,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls __experimentalGroup=\"dimensions\">\n\t\t\t\t{ ! isPaddingDisabled && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tclassName={ spacingClassnames }\n\t\t\t\t\t\thasValue={ () => hasPaddingValue( props ) }\n\t\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\t\tonDeselect={ () => resetPadding( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'padding' ) }\n\t\t\t\t\t\tisShownByDefault={ defaultSpacingControls?.padding }\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PaddingEdit\n\t\t\t\t\t\t\tonMouseOver={ paddingMouseOver.onMouseOver }\n\t\t\t\t\t\t\tonMouseOut={ paddingMouseOver.onMouseOut }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ ! isMarginDisabled && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tclassName={ spacingClassnames }\n\t\t\t\t\t\thasValue={ () => hasMarginValue( props ) }\n\t\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\t\tonDeselect={ () => resetMargin( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'margin' ) }\n\t\t\t\t\t\tisShownByDefault={ defaultSpacingControls?.margin }\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MarginEdit\n\t\t\t\t\t\t\tonMouseOver={ marginMouseOver.onMouseOver }\n\t\t\t\t\t\t\tonMouseOut={ marginMouseOver.onMouseOut }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ ! isGapDisabled && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tclassName={ spacingClassnames }\n\t\t\t\t\t\thasValue={ () => hasGapValue( props ) }\n\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\tonDeselect={ () => resetGap( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter( 'blockGap' ) }\n\t\t\t\t\t\tisShownByDefault={ defaultSpacingControls?.blockGap }\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<GapEdit { ...props } />\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ ! isPaddingDisabled && (\n\t\t\t\t<PaddingVisualizer\n\t\t\t\t\tforceShow={ paddingMouseOver.isMouseOver }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! isMarginDisabled && (\n\t\t\t\t<MarginVisualizer\n\t\t\t\t\tforceShow={ marginMouseOver.isMouseOver }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * Determine whether there is dimensions related block support.\n *\n * @param {string} blockName Block name.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasDimensionsSupport( blockName ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\thasGapSupport( blockName ) ||\n\t\thasPaddingSupport( blockName ) ||\n\t\thasMarginSupport( blockName )\n\t);\n}\n\n/**\n * Determines whether dimensions support has been disabled.\n *\n * @param {Object} props Block properties.\n *\n * @return {boolean} If spacing support is completely disabled.\n */\nconst useIsDimensionsDisabled = ( props = {} ) => {\n\tconst gapDisabled = useIsGapDisabled( props );\n\tconst paddingDisabled = useIsPaddingDisabled( props );\n\tconst marginDisabled = useIsMarginDisabled( props );\n\n\treturn gapDisabled && paddingDisabled && marginDisabled;\n};\n\n/**\n * Custom hook to retrieve which padding/margin/blockGap is supported\n * e.g. top, right, bottom or left.\n *\n * Sides are opted into by default. It is only if a specific side is set to\n * false that it is omitted.\n *\n * @param {string} blockName Block name.\n * @param {string} feature The feature custom sides relate to e.g. padding or margins.\n *\n * @return {?string[]} Strings representing the custom sides available.\n */\nexport function useCustomSides( blockName, feature ) {\n\tconst support = getBlockSupport( blockName, SPACING_SUPPORT_KEY );\n\n\t// Skip when setting is boolean as theme isn't setting arbitrary sides.\n\tif ( ! support || typeof support[ feature ] === 'boolean' ) {\n\t\treturn;\n\t}\n\n\t// Return if the setting is an array of sides (e.g. `[ 'top', 'bottom' ]`).\n\tif ( Array.isArray( support[ feature ] ) ) {\n\t\treturn support[ feature ];\n\t}\n\n\t// Finally, attempt to return `.sides` if the setting is an object.\n\tif ( support[ feature ]?.sides ) {\n\t\treturn support[ feature ].sides;\n\t}\n}\n\n/**\n * Custom hook to determine whether the sides configured in the\n * block support are valid. A dimension property cannot declare\n * support for a mix of axial and individual sides.\n *\n * @param {string} blockName Block name.\n * @param {string} feature The feature custom sides relate to e.g. padding or margins.\n *\n * @return {boolean} If the feature has a valid configuration of sides.\n */\nexport function useIsDimensionsSupportValid( blockName, feature ) {\n\tconst sides = useCustomSides( blockName, feature );\n\n\tif (\n\t\tsides &&\n\t\tsides.some( ( side ) => ALL_SIDES.includes( side ) ) &&\n\t\tsides.some( ( side ) => AXIAL_SIDES.includes( side ) )\n\t) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t`The ${ feature } support for the \"${ blockName }\" block can not be configured to support both axial and arbitrary sides.`\n\t\t);\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/dimensions.js"],"names":["DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","ALL_SIDES","AXIAL_SIDES","useVisualizerMouseOver","isMouseOver","setIsMouseOver","__experimentalHideBlockInterface","hideBlockInterface","__experimentalShowBlockInterface","showBlockInterface","blockEditorStore","onMouseOver","e","stopPropagation","onMouseOut","DimensionsPanel","props","isGapDisabled","isPaddingDisabled","isMarginDisabled","isMinHeightDisabled","isChildLayoutDisabled","isDisabled","useIsDimensionsDisabled","isSupported","hasDimensionsSupport","spacingSizes","paddingMouseOver","marginMouseOver","defaultDimensionsControls","name","defaultSpacingControls","createResetAllFilter","attribute","featureSet","newAttributes","style","undefined","spacingClassnames","length","__unstableParentLayout","parentLayout","padding","clientId","margin","blockGap","minHeight","ToolsPanelItem","Platform","OS","blockName","gapDisabled","minHeightDisabled","paddingDisabled","marginDisabled","childLayoutDisabled","useCustomSides","feature","support","Array","isArray","sides","useIsDimensionsSupportValid","some","side","includes","console","warn"],"mappings":";;;;;;;;;;;;;;AAYA;;;;AATA;;AAKA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AAOA;;AAQA;;AAOA;;AAQA;;AAQA;;AACA;;AA5DA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AA2CO,MAAMA,sBAAsB,GAAG,YA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KC,OAAO,CAAED,OAAF,CAAZ,6CAAK,iBAAoBI,KAAzB,EAAiC;AAChC,WAAOH,OAAO,CAAED,OAAF,CAAP,CAAmBI,KAA1B;AACA;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,2BAAT,CAAsCZ,SAAtC,EAAiDO,OAAjD,EAA2D;AACjE,QAAMI,KAAK,GAAGL,cAAc,CAAEN,SAAF,EAAaO,OAAb,CAA5B;;AAEA,MACCI,KAAK,IACLA,KAAK,CAACE,IAAN,CAAcC,IAAF,IAAY/D,SAAS,CAACgE,QAAV,CAAoBD,IAApB,CAAxB,CADA,IAEAH,KAAK,CAACE,IAAN,CAAcC,IAAF,IAAY9D,WAAW,CAAC+D,QAAZ,CAAsBD,IAAtB,CAAxB,CAHD,EAIE;AACD;AACAE,IAAAA,OAAO,CAACC,IAAR,CACE,OAAOV,OAAS,qBAAqBP,SAAW,0EADlD;AAGA,WAAO,KAAP;AACA;;AAED,SAAO,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { Platform, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tGapEdit,\n\thasGapSupport,\n\thasGapValue,\n\tresetGap,\n\tuseIsGapDisabled,\n} from './gap';\nimport {\n\tMarginEdit,\n\tMarginVisualizer,\n\thasMarginSupport,\n\thasMarginValue,\n\tresetMargin,\n\tuseIsMarginDisabled,\n} from './margin';\nimport {\n\tMinHeightEdit,\n\thasMinHeightSupport,\n\thasMinHeightValue,\n\tresetMinHeight,\n\tuseIsMinHeightDisabled,\n} from './min-height';\nimport {\n\tPaddingEdit,\n\tPaddingVisualizer,\n\thasPaddingSupport,\n\thasPaddingValue,\n\tresetPadding,\n\tuseIsPaddingDisabled,\n} from './padding';\nimport {\n\tChildLayoutEdit,\n\thasChildLayoutSupport,\n\thasChildLayoutValue,\n\tresetChildLayout,\n\tuseIsChildLayoutDisabled,\n\tchildLayoutOrientation,\n} from './child-layout';\nimport useSetting from '../components/use-setting';\nimport { store as blockEditorStore } from '../store';\n\nexport const DIMENSIONS_SUPPORT_KEY = 'dimensions';\nexport const SPACING_SUPPORT_KEY = 'spacing';\nexport const ALL_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nexport const AXIAL_SIDES = [ 'vertical', 'horizontal' ];\n\nfunction useVisualizerMouseOver() {\n\tconst [ isMouseOver, setIsMouseOver ] = useState( false );\n\tconst {\n\t\t__experimentalHideBlockInterface: hideBlockInterface,\n\t\t__experimentalShowBlockInterface: showBlockInterface,\n\t} = useDispatch( blockEditorStore );\n\tconst onMouseOver = ( e ) => {\n\t\te.stopPropagation();\n\t\thideBlockInterface();\n\t\tsetIsMouseOver( true );\n\t};\n\tconst onMouseOut = ( e ) => {\n\t\te.stopPropagation();\n\t\tshowBlockInterface();\n\t\tsetIsMouseOver( false );\n\t};\n\treturn { isMouseOver, onMouseOver, onMouseOut };\n}\n\n/**\n * Inspector controls for dimensions support.\n *\n * @param {Object} props Block props.\n *\n * @return {WPElement} Inspector controls for dimensions and spacing support features.\n */\nexport function DimensionsPanel( props ) {\n\tconst isGapDisabled = useIsGapDisabled( props );\n\tconst isPaddingDisabled = useIsPaddingDisabled( props );\n\tconst isMarginDisabled = useIsMarginDisabled( props );\n\tconst isMinHeightDisabled = useIsMinHeightDisabled( props );\n\tconst isChildLayoutDisabled = useIsChildLayoutDisabled( props );\n\tconst isDisabled = useIsDimensionsDisabled( props );\n\tconst isSupported = hasDimensionsSupport( props );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\tconst paddingMouseOver = useVisualizerMouseOver();\n\tconst marginMouseOver = useVisualizerMouseOver();\n\n\tif ( isDisabled || ! isSupported ) {\n\t\treturn null;\n\t}\n\n\tconst defaultDimensionsControls = getBlockSupport( props.name, [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst defaultSpacingControls = getBlockSupport( props.name, [\n\t\tSPACING_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\tconst createResetAllFilter =\n\t\t( attribute, featureSet ) => ( newAttributes ) => ( {\n\t\t\t...newAttributes,\n\t\t\tstyle: {\n\t\t\t\t...newAttributes.style,\n\t\t\t\t[ featureSet ]: {\n\t\t\t\t\t...newAttributes.style?.[ featureSet ],\n\t\t\t\t\t[ attribute ]: undefined,\n\t\t\t\t},\n\t\t\t},\n\t\t} );\n\n\tconst spacingClassnames = classnames( {\n\t\t'tools-panel-item-spacing': spacingSizes && spacingSizes.length > 0,\n\t} );\n\n\tconst { __unstableParentLayout: parentLayout } = props;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls __experimentalGroup=\"dimensions\">\n\t\t\t\t{ ! isPaddingDisabled && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tclassName={ spacingClassnames }\n\t\t\t\t\t\thasValue={ () => hasPaddingValue( props ) }\n\t\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\t\tonDeselect={ () => resetPadding( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter(\n\t\t\t\t\t\t\t'padding',\n\t\t\t\t\t\t\t'spacing'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tisShownByDefault={ defaultSpacingControls?.padding }\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PaddingEdit\n\t\t\t\t\t\t\tonMouseOver={ paddingMouseOver.onMouseOver }\n\t\t\t\t\t\t\tonMouseOut={ paddingMouseOver.onMouseOut }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ ! isMarginDisabled && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tclassName={ spacingClassnames }\n\t\t\t\t\t\thasValue={ () => hasMarginValue( props ) }\n\t\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\t\tonDeselect={ () => resetMargin( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter(\n\t\t\t\t\t\t\t'margin',\n\t\t\t\t\t\t\t'spacing'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tisShownByDefault={ defaultSpacingControls?.margin }\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MarginEdit\n\t\t\t\t\t\t\tonMouseOver={ marginMouseOver.onMouseOver }\n\t\t\t\t\t\t\tonMouseOut={ marginMouseOver.onMouseOut }\n\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ ! isGapDisabled && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tclassName={ spacingClassnames }\n\t\t\t\t\t\thasValue={ () => hasGapValue( props ) }\n\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\tonDeselect={ () => resetGap( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter(\n\t\t\t\t\t\t\t'blockGap',\n\t\t\t\t\t\t\t'spacing'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tisShownByDefault={ defaultSpacingControls?.blockGap }\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<GapEdit { ...props } />\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ ! isMinHeightDisabled && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => hasMinHeightValue( props ) }\n\t\t\t\t\t\tlabel={ __( 'Min. height' ) }\n\t\t\t\t\t\tonDeselect={ () => resetMinHeight( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter(\n\t\t\t\t\t\t\t'minHeight',\n\t\t\t\t\t\t\t'dimensions'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\t\tdefaultDimensionsControls?.minHeight\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MinHeightEdit { ...props } />\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t\t{ ! isChildLayoutDisabled && (\n\t\t\t\t\t<VStack\n\t\t\t\t\t\tas={ ToolsPanelItem }\n\t\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\thasValue={ () => hasChildLayoutValue( props ) }\n\t\t\t\t\t\tlabel={ childLayoutOrientation( parentLayout ) }\n\t\t\t\t\t\tonDeselect={ () => resetChildLayout( props ) }\n\t\t\t\t\t\tresetAllFilter={ createResetAllFilter(\n\t\t\t\t\t\t\t'selfStretch',\n\t\t\t\t\t\t\t'layout'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tisShownByDefault={ false }\n\t\t\t\t\t\tpanelId={ props.clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ChildLayoutEdit { ...props } />\n\t\t\t\t\t</VStack>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ ! isPaddingDisabled && (\n\t\t\t\t<PaddingVisualizer\n\t\t\t\t\tforceShow={ paddingMouseOver.isMouseOver }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! isMarginDisabled && (\n\t\t\t\t<MarginVisualizer\n\t\t\t\t\tforceShow={ marginMouseOver.isMouseOver }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * Determine whether there is dimensions related block support.\n *\n * @param {Object} props Block props.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasDimensionsSupport( props ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst { name: blockName } = props;\n\n\treturn (\n\t\thasGapSupport( blockName ) ||\n\t\thasMinHeightSupport( blockName ) ||\n\t\thasPaddingSupport( blockName ) ||\n\t\thasMarginSupport( blockName ) ||\n\t\thasChildLayoutSupport( props )\n\t);\n}\n\n/**\n * Determines whether dimensions support has been disabled.\n *\n * @param {Object} props Block properties.\n *\n * @return {boolean} If spacing support is completely disabled.\n */\nconst useIsDimensionsDisabled = ( props = {} ) => {\n\tconst gapDisabled = useIsGapDisabled( props );\n\tconst minHeightDisabled = useIsMinHeightDisabled( props );\n\tconst paddingDisabled = useIsPaddingDisabled( props );\n\tconst marginDisabled = useIsMarginDisabled( props );\n\tconst childLayoutDisabled = useIsChildLayoutDisabled( props );\n\n\treturn (\n\t\tgapDisabled &&\n\t\tminHeightDisabled &&\n\t\tpaddingDisabled &&\n\t\tmarginDisabled &&\n\t\tchildLayoutDisabled\n\t);\n};\n\n/**\n * Custom hook to retrieve which padding/margin/blockGap is supported\n * e.g. top, right, bottom or left.\n *\n * Sides are opted into by default. It is only if a specific side is set to\n * false that it is omitted.\n *\n * @param {string} blockName Block name.\n * @param {string} feature The feature custom sides relate to e.g. padding or margins.\n *\n * @return {?string[]} Strings representing the custom sides available.\n */\nexport function useCustomSides( blockName, feature ) {\n\tconst support = getBlockSupport( blockName, SPACING_SUPPORT_KEY );\n\n\t// Skip when setting is boolean as theme isn't setting arbitrary sides.\n\tif ( ! support || typeof support[ feature ] === 'boolean' ) {\n\t\treturn;\n\t}\n\n\t// Return if the setting is an array of sides (e.g. `[ 'top', 'bottom' ]`).\n\tif ( Array.isArray( support[ feature ] ) ) {\n\t\treturn support[ feature ];\n\t}\n\n\t// Finally, attempt to return `.sides` if the setting is an object.\n\tif ( support[ feature ]?.sides ) {\n\t\treturn support[ feature ].sides;\n\t}\n}\n\n/**\n * Custom hook to determine whether the sides configured in the\n * block support are valid. A dimension property cannot declare\n * support for a mix of axial and individual sides.\n *\n * @param {string} blockName Block name.\n * @param {string} feature The feature custom sides relate to e.g. padding or margins.\n *\n * @return {boolean} If the feature has a valid configuration of sides.\n */\nexport function useIsDimensionsSupportValid( blockName, feature ) {\n\tconst sides = useCustomSides( blockName, feature );\n\n\tif (\n\t\tsides &&\n\t\tsides.some( ( side ) => ALL_SIDES.includes( side ) ) &&\n\t\tsides.some( ( side ) => AXIAL_SIDES.includes( side ) )\n\t) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t`The ${ feature } support for the \"${ blockName }\" block can not be configured to support both axial and arbitrary sides.`\n\t\t);\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n"]}
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.addAttribute = addAttribute;
9
9
  exports.useLayoutClasses = useLayoutClasses;
10
10
  exports.useLayoutStyles = useLayoutStyles;
11
- exports.withLayoutStyles = exports.withInspectorControls = void 0;
11
+ exports.withLayoutStyles = exports.withInspectorControls = exports.withChildLayoutStyles = void 0;
12
12
 
13
13
  var _element = require("@wordpress/element");
14
14
 
@@ -371,7 +371,7 @@ const withLayoutStyles = (0, _compose.createHigherOrderComponent)(BlockListBlock
371
371
  } // Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.
372
372
 
373
373
 
374
- const className = (0, _classnames.default)(props === null || props === void 0 ? void 0 : props.className, {
374
+ const layoutClassNames = (0, _classnames.default)({
375
375
  [`wp-container-${id}`]: shouldRenderLayoutStyles && !!css // Only attach a container class if there is generated CSS to be attached.
376
376
 
377
377
  }, layoutClasses);
@@ -382,11 +382,67 @@ const withLayoutStyles = (0, _compose.createHigherOrderComponent)(BlockListBlock
382
382
  layout: usedLayout,
383
383
  style: attributes === null || attributes === void 0 ? void 0 : attributes.style
384
384
  }), element), (0, _element.createElement)(BlockListBlock, (0, _extends2.default)({}, props, {
385
- __unstableLayoutClassNames: className
385
+ __unstableLayoutClassNames: layoutClassNames
386
386
  })));
387
387
  });
388
+ /**
389
+ * Override the default block element to add the child layout styles.
390
+ *
391
+ * @param {Function} BlockListBlock Original component.
392
+ *
393
+ * @return {Function} Wrapped component.
394
+ */
395
+
388
396
  exports.withLayoutStyles = withLayoutStyles;
397
+ const withChildLayoutStyles = (0, _compose.createHigherOrderComponent)(BlockListBlock => props => {
398
+ const {
399
+ attributes
400
+ } = props;
401
+ const {
402
+ style: {
403
+ layout = {}
404
+ } = {}
405
+ } = attributes;
406
+ const {
407
+ selfStretch,
408
+ flexSize
409
+ } = layout;
410
+ const hasChildLayout = selfStretch || flexSize;
411
+ const disableLayoutStyles = (0, _data.useSelect)(select => {
412
+ const {
413
+ getSettings
414
+ } = select(_store.store);
415
+ return !!getSettings().disableLayoutStyles;
416
+ });
417
+ const shouldRenderChildLayoutStyles = hasChildLayout && !disableLayoutStyles;
418
+ const element = (0, _element.useContext)(_blockList.default.__unstableElementContext);
419
+ const id = (0, _compose.useInstanceId)(BlockListBlock);
420
+ const selector = `.wp-container-content-${id}`;
421
+ let css = '';
422
+
423
+ if (selfStretch === 'fixed' && flexSize) {
424
+ css += `${selector} {
425
+ flex-basis: ${flexSize};
426
+ box-sizing: border-box;
427
+ }`;
428
+ } else if (selfStretch === 'fill') {
429
+ css += `${selector} {
430
+ flex-grow: 1;
431
+ }`;
432
+ } // Attach a `wp-container-content` id-based classname.
433
+
434
+
435
+ const className = (0, _classnames.default)(props === null || props === void 0 ? void 0 : props.className, {
436
+ [`wp-container-content-${id}`]: shouldRenderChildLayoutStyles && !!css // Only attach a container class if there is generated CSS to be attached.
437
+
438
+ });
439
+ return (0, _element.createElement)(_element.Fragment, null, shouldRenderChildLayoutStyles && element && !!css && (0, _element.createPortal)((0, _element.createElement)("style", null, css), element), (0, _element.createElement)(BlockListBlock, (0, _extends2.default)({}, props, {
440
+ className: className
441
+ })));
442
+ });
443
+ exports.withChildLayoutStyles = withChildLayoutStyles;
389
444
  (0, _hooks.addFilter)('blocks.registerBlockType', 'core/layout/addAttribute', addAttribute);
390
445
  (0, _hooks.addFilter)('editor.BlockListBlock', 'core/editor/layout/with-layout-styles', withLayoutStyles);
446
+ (0, _hooks.addFilter)('editor.BlockListBlock', 'core/editor/layout/with-child-layout-styles', withChildLayoutStyles);
391
447
  (0, _hooks.addFilter)('editor.BlockEdit', 'core/editor/layout/with-inspector-controls', withInspectorControls);
392
448
  //# sourceMappingURL=layout.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/layout.js"],"names":["layoutBlockSupportKey","useLayoutClasses","block","rootPaddingAlignment","select","getSettings","blockEditorStore","__experimentalFeatures","useRootPaddingAwareAlignments","globalLayoutSettings","attributes","name","layout","default","defaultBlockLayout","usedLayout","inherit","contentSize","wideSize","type","layoutClassnames","definitions","className","push","orientation","justifyContent","flexWrap","useLayoutStyles","selector","style","fullLayoutType","blockGapSupport","hasBlockGapSupport","css","getLayoutStyle","blockName","layoutDefinitions","LayoutPanel","setAttributes","defaultThemeLayout","themeSupportsLayout","supportsLayout","layoutBlockSupport","allowSwitching","allowEditing","allowInheriting","showInheritToggle","layoutType","constrainedType","displayControlsForLegacyLayouts","hasContentSizeOrLegacySettings","onChangeType","newType","onChangeLayout","newLayout","LayoutTypeSwitcher","onChange","map","label","addAttribute","settings","withInspectorControls","BlockEdit","props","supportLayout","withLayoutStyles","BlockListBlock","hasLayoutBlockSupport","disableLayoutStyles","shouldRenderLayoutStyles","id","element","BlockList","__unstableElementContext","layoutClasses"],"mappings":";;;;;;;;;;;;AAoBA;;;;AAjBA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA9BA;AACA;AACA;;AAIA;AACA;AACA;;AAcA;AACA;AACA;AAQA,MAAMA,qBAAqB,GAAG,sBAA9B;AAEA;AACA;AAC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AAKvCQ,MAAAA,KAAK,EAAEnB,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAEmB,KALoB;AAMvCG,MAAAA;AANuC,KAApB,CAApB;AAQA,GA7CiC,CA+ClC;;;AACA,QAAMV,SAAS,GAAG,yBACjByC,KADiB,aACjBA,KADiB,uBACjBA,KAAK,CAAEzC,SADU,EAEjB;AACC,KAAG,gBAAgBgD,EAAI,EAAvB,GAA4BD,wBAAwB,IAAI,CAAC,CAAEpC,GAD5D,CACiE;;AADjE,GAFiB,EAKjByC,aALiB,CAAlB;AAQA,SACC,qDACGL,wBAAwB,IACzBE,OADC,IAED,CAAC,CAAEtC,GAFF,IAGD,2BACC,4BAAC,mBAAD;AACC,IAAA,SAAS,EAAGtB,IADb;AAEC,IAAA,QAAQ,EAAGiB,QAFZ;AAGC,IAAA,GAAG,EAAGK,GAHP;AAIC,IAAA,MAAM,EAAGlB,UAJV;AAKC,IAAA,KAAK,EAAGL,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAEmB;AALrB,IADD,EAQC0C,OARD,CAJF,EAcC,4BAAC,cAAD,6BACMR,KADN;AAEC,IAAA,0BAA0B,EAAGzC;AAF9B,KAdD,CADD;AAqBA,CA9E8B,CAAzB;;AAiFP,sBACC,0BADD,EAEC,0BAFD,EAGCqC,YAHD;AAKA,sBACC,uBADD,EAEC,uCAFD,EAGCM,gBAHD;AAKA,sBACC,kBADD,EAEC,4CAFD,EAGCJ,qBAHD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport useSetting from '../components/use-setting';\nimport { LayoutStyle } from '../components/block-list/layout';\nimport BlockList from '../components/block-list';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\n\nconst layoutBlockSupportKey = '__experimentalLayout';\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } block Block object.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( block = {} ) {\n\tconst rootPaddingAlignment = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalFeatures\n\t\t\t?.useRootPaddingAwareAlignments;\n\t}, [] );\n\tconst globalLayoutSettings = useSetting( 'layout' ) || {};\n\n\tconst { attributes = {}, name } = block;\n\tconst { layout } = attributes;\n\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 layoutClassnames = [];\n\n\tif (\n\t\tglobalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]\n\t\t\t?.className\n\t) {\n\t\tlayoutClassnames.push(\n\t\t\tglobalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]\n\t\t\t\t?.className\n\t\t);\n\t}\n\n\tif (\n\t\t( usedLayout?.inherit ||\n\t\t\tusedLayout?.contentSize ||\n\t\t\tusedLayout?.type === 'constrained' ) &&\n\t\trootPaddingAlignment\n\t) {\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 } block Block object.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( block = {}, selector ) {\n\tconst { attributes = {}, name } = block;\n\tconst { layout = {}, style = {} } = attributes;\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 globalLayoutSettings = useSetting( 'layout' ) || {};\n\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout,\n\t\tlayoutDefinitions: globalLayoutSettings?.definitions,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n\treturn css;\n}\n\nfunction LayoutPanel( { setAttributes, attributes, name: blockName } ) {\n\tconst { layout } = attributes;\n\tconst defaultThemeLayout = useSetting( 'layout' );\n\tconst themeSupportsLayout = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().supportsLayout;\n\t}, [] );\n\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = layoutBlockSupport;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\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!! defaultThemeLayout &&\n\t\t( ! layout?.type ||\n\t\t\tlayout?.type === 'default' ||\n\t\t\tlayout?.type === 'constrained' ||\n\t\t\tlayout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst {\n\t\tinherit = false,\n\t\ttype = 'default',\n\t\tcontentSize = null,\n\t} = 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( type === 'default' || type === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tclassName=\"block-editor-hooks__toggle-control\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t'constrained' ||\n\t\t\t\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\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\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container. Toggle to constrain.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\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/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\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 ( hasBlockSupport( settings, layoutBlockSupportKey ) ) {\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\n/**\n * Override the default edit UI to include layout controls\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst supportLayout = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\n\t\treturn [\n\t\t\tsupportLayout && <LayoutPanel key=\"layout\" { ...props } />,\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\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 ) => ( props ) => {\n\t\tconst { name, attributes, block } = props;\n\t\tconst hasLayoutBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\t\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn !! getSettings().disableLayoutStyles;\n\t\t} );\n\t\tconst shouldRenderLayoutStyles =\n\t\t\thasLayoutBlockSupport && ! disableLayoutStyles;\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst defaultThemeLayout = useSetting( 'layout' ) || {};\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst { layout } = attributes;\n\t\tconst { default: defaultBlockLayout } =\n\t\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\t\tconst usedLayout =\n\t\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t\t: layout || defaultBlockLayout || {};\n\t\tconst layoutClasses = hasLayoutBlockSupport\n\t\t\t? useLayoutClasses( block )\n\t\t\t: null;\n\t\t// Higher specificity to override defaults from theme.json.\n\t\tconst selector = `.wp-container-${ id }.wp-container-${ id }`;\n\t\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\t\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t\t// Get CSS string for the current layout type.\n\t\t// The CSS and `style` element is only output if it is not empty.\n\t\tlet css;\n\t\tif ( shouldRenderLayoutStyles ) {\n\t\t\tconst fullLayoutType = getLayoutType(\n\t\t\t\tusedLayout?.type || 'default'\n\t\t\t);\n\t\t\tcss = fullLayoutType?.getLayoutStyle?.( {\n\t\t\t\tblockName: name,\n\t\t\t\tselector,\n\t\t\t\tlayout: usedLayout,\n\t\t\t\tlayoutDefinitions: defaultThemeLayout?.definitions,\n\t\t\t\tstyle: attributes?.style,\n\t\t\t\thasBlockGapSupport,\n\t\t\t} );\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\t\tconst className = classnames(\n\t\t\tprops?.className,\n\t\t\t{\n\t\t\t\t[ `wp-container-${ id }` ]: shouldRenderLayoutStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t},\n\t\t\tlayoutClasses\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\tblockName={ name }\n\t\t\t\t\t\t\tselector={ selector }\n\t\t\t\t\t\t\tcss={ css }\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tstyle={ attributes?.style }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\t__unstableLayoutClassNames={ className }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\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);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/layout/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/layout.js"],"names":["layoutBlockSupportKey","useLayoutClasses","block","rootPaddingAlignment","select","getSettings","blockEditorStore","__experimentalFeatures","useRootPaddingAwareAlignments","globalLayoutSettings","attributes","name","layout","default","defaultBlockLayout","usedLayout","inherit","contentSize","wideSize","type","layoutClassnames","definitions","className","push","orientation","justifyContent","flexWrap","useLayoutStyles","selector","style","fullLayoutType","blockGapSupport","hasBlockGapSupport","css","getLayoutStyle","blockName","layoutDefinitions","LayoutPanel","setAttributes","defaultThemeLayout","themeSupportsLayout","supportsLayout","layoutBlockSupport","allowSwitching","allowEditing","allowInheriting","showInheritToggle","layoutType","constrainedType","displayControlsForLegacyLayouts","hasContentSizeOrLegacySettings","onChangeType","newType","onChangeLayout","newLayout","LayoutTypeSwitcher","onChange","map","label","addAttribute","settings","withInspectorControls","BlockEdit","props","supportLayout","withLayoutStyles","BlockListBlock","hasLayoutBlockSupport","disableLayoutStyles","shouldRenderLayoutStyles","id","element","BlockList","__unstableElementContext","layoutClasses","layoutClassNames","withChildLayoutStyles","selfStretch","flexSize","hasChildLayout","shouldRenderChildLayoutStyles"],"mappings":";;;;;;;;;;;;AAoBA;;;;AAjBA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA9BA;AACA;AACA;;AAIA;AACA;AACA;;AAcA;AACA;AACA;AAQA,MAAMA,qBAAqB,GAAG,sBAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,gBAAT,GAAwC;AAAA;;AAAA,MAAbC,KAAa,uEAAL,EAAK;AAC9C,QAAMC,oBAAoB,GAAG,qBAAaC,MAAF,IAAc;AAAA;;AACrD,UAAM;AAAEC,MAAAA;AAAF,QAAkBD,MAAM,CAAEE,YAAF,CAA9B;AACA,oCAAOD,WAAW,GAAGE,sBAArB,0DAAO,sBACJC,6BADH;AAEA,GAJ4B,EAI1B,EAJ0B,CAA7B;AAKA,QAAMC,oBAAoB,GAA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C7C,IAAAA,GAAG,IAAK,GAAGL,QAAU;AACxB,kBAAmBkD,QAAU;AAC7B;AACA,KAHG;AAIA,GALD,MAKO,IAAKD,WAAW,KAAK,MAArB,EAA8B;AACpC5C,IAAAA,GAAG,IAAK,GAAGL,QAAU;AACxB;AACA,KAFG;AAGA,GA3BiC,CA6BlC;;;AACA,QAAMN,SAAS,GAAG,yBAAYyC,KAAZ,aAAYA,KAAZ,uBAAYA,KAAK,CAAEzC,SAAnB,EAA8B;AAC/C,KAAG,wBAAwBgD,EAAI,EAA/B,GACCU,6BAA6B,IAAI,CAAC,CAAE/C,GAFU,CAEL;;AAFK,GAA9B,CAAlB;AAKA,SACC,qDACG+C,6BAA6B,IAC9BT,OADC,IAED,CAAC,CAAEtC,GAFF,IAGD,2BAAc,2CAASA,GAAT,CAAd,EAAsCsC,OAAtC,CAJF,EAKC,4BAAC,cAAD,6BAAqBR,KAArB;AAA6B,IAAA,SAAS,EAAGzC;AAAzC,KALD,CADD;AASA,CA7CmC,CAA9B;;AAgDP,sBACC,0BADD,EAEC,0BAFD,EAGCqC,YAHD;AAKA,sBACC,uBADD,EAEC,uCAFD,EAGCM,gBAHD;AAKA,sBACC,uBADD,EAEC,6CAFD,EAGCW,qBAHD;AAKA,sBACC,kBADD,EAEC,4CAFD,EAGCf,qBAHD","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport useSetting from '../components/use-setting';\nimport { LayoutStyle } from '../components/block-list/layout';\nimport BlockList from '../components/block-list';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\n\nconst layoutBlockSupportKey = '__experimentalLayout';\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } block Block object.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( block = {} ) {\n\tconst rootPaddingAlignment = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalFeatures\n\t\t\t?.useRootPaddingAwareAlignments;\n\t}, [] );\n\tconst globalLayoutSettings = useSetting( 'layout' ) || {};\n\n\tconst { attributes = {}, name } = block;\n\tconst { layout } = attributes;\n\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 layoutClassnames = [];\n\n\tif (\n\t\tglobalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]\n\t\t\t?.className\n\t) {\n\t\tlayoutClassnames.push(\n\t\t\tglobalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]\n\t\t\t\t?.className\n\t\t);\n\t}\n\n\tif (\n\t\t( usedLayout?.inherit ||\n\t\t\tusedLayout?.contentSize ||\n\t\t\tusedLayout?.type === 'constrained' ) &&\n\t\trootPaddingAlignment\n\t) {\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 } block Block object.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( block = {}, selector ) {\n\tconst { attributes = {}, name } = block;\n\tconst { layout = {}, style = {} } = attributes;\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 globalLayoutSettings = useSetting( 'layout' ) || {};\n\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout,\n\t\tlayoutDefinitions: globalLayoutSettings?.definitions,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n\treturn css;\n}\n\nfunction LayoutPanel( { setAttributes, attributes, name: blockName } ) {\n\tconst { layout } = attributes;\n\tconst defaultThemeLayout = useSetting( 'layout' );\n\tconst themeSupportsLayout = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().supportsLayout;\n\t}, [] );\n\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = layoutBlockSupport;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\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!! defaultThemeLayout &&\n\t\t( ! layout?.type ||\n\t\t\tlayout?.type === 'default' ||\n\t\t\tlayout?.type === 'constrained' ||\n\t\t\tlayout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst {\n\t\tinherit = false,\n\t\ttype = 'default',\n\t\tcontentSize = null,\n\t} = 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( type === 'default' || type === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tclassName=\"block-editor-hooks__toggle-control\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t'constrained' ||\n\t\t\t\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\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\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container. Toggle to constrain.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\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/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\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 ( hasBlockSupport( settings, layoutBlockSupportKey ) ) {\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\n/**\n * Override the default edit UI to include layout controls\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst supportLayout = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\n\t\treturn [\n\t\t\tsupportLayout && <LayoutPanel key=\"layout\" { ...props } />,\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\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 ) => ( props ) => {\n\t\tconst { name, attributes, block } = props;\n\t\tconst hasLayoutBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\t\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn !! getSettings().disableLayoutStyles;\n\t\t} );\n\t\tconst shouldRenderLayoutStyles =\n\t\t\thasLayoutBlockSupport && ! disableLayoutStyles;\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst defaultThemeLayout = useSetting( 'layout' ) || {};\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst { layout } = attributes;\n\t\tconst { default: defaultBlockLayout } =\n\t\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\t\tconst usedLayout =\n\t\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t\t: layout || defaultBlockLayout || {};\n\t\tconst layoutClasses = hasLayoutBlockSupport\n\t\t\t? useLayoutClasses( block )\n\t\t\t: null;\n\t\t// Higher specificity to override defaults from theme.json.\n\t\tconst selector = `.wp-container-${ id }.wp-container-${ id }`;\n\t\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\t\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t\t// Get CSS string for the current layout type.\n\t\t// The CSS and `style` element is only output if it is not empty.\n\t\tlet css;\n\t\tif ( shouldRenderLayoutStyles ) {\n\t\t\tconst fullLayoutType = getLayoutType(\n\t\t\t\tusedLayout?.type || 'default'\n\t\t\t);\n\t\t\tcss = fullLayoutType?.getLayoutStyle?.( {\n\t\t\t\tblockName: name,\n\t\t\t\tselector,\n\t\t\t\tlayout: usedLayout,\n\t\t\t\tlayoutDefinitions: defaultThemeLayout?.definitions,\n\t\t\t\tstyle: attributes?.style,\n\t\t\t\thasBlockGapSupport,\n\t\t\t} );\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\t\tconst layoutClassNames = classnames(\n\t\t\t{\n\t\t\t\t[ `wp-container-${ id }` ]: shouldRenderLayoutStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t},\n\t\t\tlayoutClasses\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\tblockName={ name }\n\t\t\t\t\t\t\tselector={ selector }\n\t\t\t\t\t\t\tcss={ css }\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tstyle={ attributes?.style }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n);\n\n/**\n * Override the default block element to add the child layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withChildLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { attributes } = props;\n\t\tconst { style: { layout = {} } = {} } = attributes;\n\t\tconst { selfStretch, flexSize } = layout;\n\t\tconst hasChildLayout = selfStretch || flexSize;\n\t\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn !! getSettings().disableLayoutStyles;\n\t\t} );\n\t\tconst shouldRenderChildLayoutStyles =\n\t\t\thasChildLayout && ! disableLayoutStyles;\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst selector = `.wp-container-content-${ id }`;\n\n\t\tlet css = '';\n\n\t\tif ( selfStretch === 'fixed' && flexSize ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tflex-basis: ${ flexSize };\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}`;\n\t\t} else if ( selfStretch === 'fill' ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tflex-grow: 1;\n\t\t\t}`;\n\t\t}\n\n\t\t// Attach a `wp-container-content` id-based classname.\n\t\tconst className = classnames( props?.className, {\n\t\t\t[ `wp-container-content-${ id }` ]:\n\t\t\t\tshouldRenderChildLayoutStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderChildLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal( <style>{ css }</style>, element ) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t}\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);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-child-layout-styles',\n\twithChildLayoutStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/layout/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
@@ -217,13 +217,15 @@ function MarginVisualizer(_ref2) {
217
217
  if (!(0, _isShallowEqual.default)(margin, valueRef.current) && !forceShow) {
218
218
  setIsActive(true);
219
219
  valueRef.current = margin;
220
- clearTimer();
221
220
  timeoutRef.current = setTimeout(() => {
222
221
  setIsActive(false);
223
222
  }, 400);
224
223
  }
225
224
 
226
- return () => clearTimer();
225
+ return () => {
226
+ setIsActive(false);
227
+ clearTimer();
228
+ };
227
229
  }, [margin, forceShow]);
228
230
 
229
231
  if (!isActive && !forceShow) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/margin.js"],"names":["hasMarginSupport","blockType","support","SPACING_SUPPORT_KEY","margin","hasMarginValue","props","attributes","style","spacing","undefined","resetMargin","setAttributes","useIsMarginDisabled","name","blockName","isDisabled","isInvalid","MarginEdit","onMouseOver","onMouseOut","spacingSizes","units","availableUnits","sides","splitOnAxis","some","side","AXIAL_SIDES","includes","onChange","next","newStyle","Platform","select","web","length","native","MarginVisualizer","clientId","forceShow","marginTop","top","marginRight","right","marginBottom","bottom","marginLeft","left","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","isActive","setIsActive","valueRef","timeoutRef","clearTimer","current","window","clearTimeout","setTimeout"],"mappings":";;;;;;;;;;;;;;AAIA;;AADA;;AAQA;;AACA;;AAIA;;AAKA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AA/BA;AACA;AACA;;AAgBA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CAA2BC,SAA3B,EAAuC;AAC7C,QAAMC,OAAO,GAAG,6BAAiBD,SAAjB,EAA4BE,+BAA5B,CAAhB;AACA,SAAO,CAAC,EAAI,SAASD,OAAT,IAAoBA,OAApB,aAAoBA,OAApB,eAAoBA,OAAO,CAAEE,MAAjC,CAAR;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,cAAT,CAAyBC,KAAzB,EAAiC;AAAA;;AACvC,SAAO,0BAAAA,KAAK,CAACC,UAAN,CAAiBC,KAAjB,0GAAwBC,OAAxB,kFAAiCL,MAAjC,MAA4CM,SAAnD;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAAS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CP,QAAAA,WAAW,CAAE,KAAF,CAAX;AACA,OAF8B,EAE5B,GAF4B,CAA/B;AAGA;;AAED,WAAO,MAAMG,UAAU,EAAvB;AACA,GAbD,EAaG,CAAErD,MAAF,EAAUoC,SAAV,CAbH;;AAeA,MAAK,CAAEa,QAAF,IAAc,CAAEb,SAArB,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,qBAAD;AACC,IAAA,QAAQ,EAAGD,QADZ;AAEC,IAAA,qBAAqB,MAFtB;AAGC,IAAA,qBAAqB,EAAGnC,MAHzB;AAIC,IAAA,KAAK,EAAG;AAJT,KAMC;AAAK,IAAA,SAAS,EAAC,kCAAf;AAAkD,IAAA,KAAK,EAAGI;AAA1D,IAND,CADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPlatform,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n\tuseEffect,\n} from '@wordpress/element';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalBoxControl as BoxControl,\n} from '@wordpress/components';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport {\n\tAXIAL_SIDES,\n\tSPACING_SUPPORT_KEY,\n\tuseCustomSides,\n\tuseIsDimensionsSupportValid,\n} from './dimensions';\nimport { cleanEmptyObject } from './utils';\nimport BlockPopover from '../components/block-popover';\nimport SpacingSizesControl from '../components/spacing-sizes-control';\nimport { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';\n\n/**\n * Determines if there is margin support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasMarginSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, SPACING_SUPPORT_KEY );\n\treturn !! ( true === support || support?.margin );\n}\n\n/**\n * Checks if there is a current value in the margin block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a margin value set.\n */\nexport function hasMarginValue( props ) {\n\treturn props.attributes.style?.spacing?.margin !== undefined;\n}\n\n/**\n * Resets the margin block support attributes. This can be used when disabling\n * the margin support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetMargin( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tmargin: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if margin settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether margin setting is disabled.\n */\nexport function useIsMarginDisabled( { name: blockName } = {} ) {\n\tconst isDisabled = ! useSetting( 'spacing.margin' );\n\tconst isInvalid = ! useIsDimensionsSupportValid( blockName, 'margin' );\n\n\treturn ! hasMarginSupport( blockName ) || isDisabled || isInvalid;\n}\n\n/**\n * Inspector control panel containing the margin related configuration\n *\n * @param {Object} props Block props.\n *\n * @return {WPElement} Margin edit element.\n */\nexport function MarginEdit( props ) {\n\tconst {\n\t\tname: blockName,\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t\tonMouseOver,\n\t\tonMouseOut,\n\t} = props;\n\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\tconst sides = useCustomSides( blockName, 'margin' );\n\tconst splitOnAxis =\n\t\tsides && sides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\n\tif ( useIsMarginDisabled( props ) ) {\n\t\treturn null;\n\t}\n\n\tconst onChange = ( next ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tmargin: next,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\treturn Platform.select( {\n\t\tweb: (\n\t\t\t<>\n\t\t\t\t{ ( ! spacingSizes || spacingSizes?.length === 0 ) && (\n\t\t\t\t\t<BoxControl\n\t\t\t\t\t\tvalues={ style?.spacing?.margin }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\t\tsides={ sides }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ splitOnAxis }\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ spacingSizes?.length > 0 && (\n\t\t\t\t\t<SpacingSizesControl\n\t\t\t\t\t\tvalues={ style?.spacing?.margin }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\t\tsides={ sides }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ false }\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t),\n\t\tnative: null,\n\t} );\n}\n\nexport function MarginVisualizer( { clientId, attributes, forceShow } ) {\n\tconst margin = attributes?.style?.spacing?.margin;\n\n\tconst style = useMemo( () => {\n\t\tconst marginTop = margin?.top\n\t\t\t? getSpacingPresetCssVar( margin?.top )\n\t\t\t: 0;\n\t\tconst marginRight = margin?.right\n\t\t\t? getSpacingPresetCssVar( margin?.right )\n\t\t\t: 0;\n\t\tconst marginBottom = margin?.bottom\n\t\t\t? getSpacingPresetCssVar( margin?.bottom )\n\t\t\t: 0;\n\t\tconst marginLeft = margin?.left\n\t\t\t? getSpacingPresetCssVar( margin?.left )\n\t\t\t: 0;\n\n\t\treturn {\n\t\t\tborderTopWidth: marginTop,\n\t\t\tborderRightWidth: marginRight,\n\t\t\tborderBottomWidth: marginBottom,\n\t\t\tborderLeftWidth: marginLeft,\n\t\t\ttop: marginTop ? `calc(${ marginTop } * -1)` : 0,\n\t\t\tright: marginRight ? `calc(${ marginRight } * -1)` : 0,\n\t\t\tbottom: marginBottom ? `calc(${ marginBottom } * -1)` : 0,\n\t\t\tleft: marginLeft ? `calc(${ marginLeft } * -1)` : 0,\n\t\t};\n\t}, [ margin ] );\n\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst valueRef = useRef( margin );\n\tconst timeoutRef = useRef();\n\n\tconst clearTimer = () => {\n\t\tif ( timeoutRef.current ) {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! isShallowEqual( margin, valueRef.current ) && ! forceShow ) {\n\t\t\tsetIsActive( true );\n\t\t\tvalueRef.current = margin;\n\n\t\t\tclearTimer();\n\n\t\t\ttimeoutRef.current = setTimeout( () => {\n\t\t\t\tsetIsActive( false );\n\t\t\t}, 400 );\n\t\t}\n\n\t\treturn () => clearTimer();\n\t}, [ margin, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ clientId }\n\t\t\t__unstableCoverTarget\n\t\t\t__unstableRefreshSize={ margin }\n\t\t\tshift={ false }\n\t\t>\n\t\t\t<div className=\"block-editor__padding-visualizer\" style={ style } />\n\t\t</BlockPopover>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/margin.js"],"names":["hasMarginSupport","blockType","support","SPACING_SUPPORT_KEY","margin","hasMarginValue","props","attributes","style","spacing","undefined","resetMargin","setAttributes","useIsMarginDisabled","name","blockName","isDisabled","isInvalid","MarginEdit","onMouseOver","onMouseOut","spacingSizes","units","availableUnits","sides","splitOnAxis","some","side","AXIAL_SIDES","includes","onChange","next","newStyle","Platform","select","web","length","native","MarginVisualizer","clientId","forceShow","marginTop","top","marginRight","right","marginBottom","bottom","marginLeft","left","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","isActive","setIsActive","valueRef","timeoutRef","clearTimer","current","window","clearTimeout","setTimeout"],"mappings":";;;;;;;;;;;;;;AAIA;;AADA;;AAQA;;AACA;;AAIA;;AAKA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AA/BA;AACA;AACA;;AAgBA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CAA2BC,SAA3B,EAAuC;AAC7C,QAAMC,OAAO,GAAG,6BAAiBD,SAAjB,EAA4BE,+BAA5B,CAAhB;AACA,SAAO,CAAC,EAAI,SAASD,OAAT,IAAoBA,OAApB,aAAoBA,OAApB,eAAoBA,OAAO,CAAEE,MAAjC,CAAR;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,cAAT,CAAyBC,KAAzB,EAAiC;AAAA;;AACvC,SAAO,0BAAAA,KAAK,CAACC,UAAN,CAAiBC,KAAjB,0GAAwBC,OAAxB,kFAAiCL,MAAjC,MAA4CM,SAAnD;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,WAAT,OAA2D;AAAA,MAArC;AAAEJ,IAAAA,UAAU,GAAG,EAAf;AAAmBK,IAAAA;AAAnB,GAAqC;AACjE,QAAM;AAAEJ,IAAAA;AAAF,MAAYD,UAAlB;AAEAK,EAAAA,aAAa,CAAE;AACdJ,IAAAA,KAAK,EAAE,6BAAkB,EACxB,GAAGA,KADqB;AAExBC,MAAAA,OAAO,EAAE,EACR,IAAGD,KAAH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AACA;;AAED,SACC,4BAAC,qBAAD;AACC,IAAA,QAAQ,EAAGD,QADZ;AAEC,IAAA,qBAAqB,MAFtB;AAGC,IAAA,qBAAqB,EAAGnC,MAHzB;AAIC,IAAA,KAAK,EAAG;AAJT,KAMC;AAAK,IAAA,SAAS,EAAC,kCAAf;AAAkD,IAAA,KAAK,EAAGI;AAA1D,IAND,CADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPlatform,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n\tuseEffect,\n} from '@wordpress/element';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalBoxControl as BoxControl,\n} from '@wordpress/components';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport {\n\tAXIAL_SIDES,\n\tSPACING_SUPPORT_KEY,\n\tuseCustomSides,\n\tuseIsDimensionsSupportValid,\n} from './dimensions';\nimport { cleanEmptyObject } from './utils';\nimport BlockPopover from '../components/block-popover';\nimport SpacingSizesControl from '../components/spacing-sizes-control';\nimport { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';\n\n/**\n * Determines if there is margin support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasMarginSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, SPACING_SUPPORT_KEY );\n\treturn !! ( true === support || support?.margin );\n}\n\n/**\n * Checks if there is a current value in the margin block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a margin value set.\n */\nexport function hasMarginValue( props ) {\n\treturn props.attributes.style?.spacing?.margin !== undefined;\n}\n\n/**\n * Resets the margin block support attributes. This can be used when disabling\n * the margin support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetMargin( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tmargin: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if margin settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether margin setting is disabled.\n */\nexport function useIsMarginDisabled( { name: blockName } = {} ) {\n\tconst isDisabled = ! useSetting( 'spacing.margin' );\n\tconst isInvalid = ! useIsDimensionsSupportValid( blockName, 'margin' );\n\n\treturn ! hasMarginSupport( blockName ) || isDisabled || isInvalid;\n}\n\n/**\n * Inspector control panel containing the margin related configuration\n *\n * @param {Object} props Block props.\n *\n * @return {WPElement} Margin edit element.\n */\nexport function MarginEdit( props ) {\n\tconst {\n\t\tname: blockName,\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t\tonMouseOver,\n\t\tonMouseOut,\n\t} = props;\n\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\tconst sides = useCustomSides( blockName, 'margin' );\n\tconst splitOnAxis =\n\t\tsides && sides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\n\tif ( useIsMarginDisabled( props ) ) {\n\t\treturn null;\n\t}\n\n\tconst onChange = ( next ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tmargin: next,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\treturn Platform.select( {\n\t\tweb: (\n\t\t\t<>\n\t\t\t\t{ ( ! spacingSizes || spacingSizes?.length === 0 ) && (\n\t\t\t\t\t<BoxControl\n\t\t\t\t\t\tvalues={ style?.spacing?.margin }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\t\tsides={ sides }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ splitOnAxis }\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ spacingSizes?.length > 0 && (\n\t\t\t\t\t<SpacingSizesControl\n\t\t\t\t\t\tvalues={ style?.spacing?.margin }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\t\tsides={ sides }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ false }\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t),\n\t\tnative: null,\n\t} );\n}\n\nexport function MarginVisualizer( { clientId, attributes, forceShow } ) {\n\tconst margin = attributes?.style?.spacing?.margin;\n\n\tconst style = useMemo( () => {\n\t\tconst marginTop = margin?.top\n\t\t\t? getSpacingPresetCssVar( margin?.top )\n\t\t\t: 0;\n\t\tconst marginRight = margin?.right\n\t\t\t? getSpacingPresetCssVar( margin?.right )\n\t\t\t: 0;\n\t\tconst marginBottom = margin?.bottom\n\t\t\t? getSpacingPresetCssVar( margin?.bottom )\n\t\t\t: 0;\n\t\tconst marginLeft = margin?.left\n\t\t\t? getSpacingPresetCssVar( margin?.left )\n\t\t\t: 0;\n\n\t\treturn {\n\t\t\tborderTopWidth: marginTop,\n\t\t\tborderRightWidth: marginRight,\n\t\t\tborderBottomWidth: marginBottom,\n\t\t\tborderLeftWidth: marginLeft,\n\t\t\ttop: marginTop ? `calc(${ marginTop } * -1)` : 0,\n\t\t\tright: marginRight ? `calc(${ marginRight } * -1)` : 0,\n\t\t\tbottom: marginBottom ? `calc(${ marginBottom } * -1)` : 0,\n\t\t\tleft: marginLeft ? `calc(${ marginLeft } * -1)` : 0,\n\t\t};\n\t}, [ margin ] );\n\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst valueRef = useRef( margin );\n\tconst timeoutRef = useRef();\n\n\tconst clearTimer = () => {\n\t\tif ( timeoutRef.current ) {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! isShallowEqual( margin, valueRef.current ) && ! forceShow ) {\n\t\t\tsetIsActive( true );\n\t\t\tvalueRef.current = margin;\n\n\t\t\ttimeoutRef.current = setTimeout( () => {\n\t\t\t\tsetIsActive( false );\n\t\t\t}, 400 );\n\t\t}\n\n\t\treturn () => {\n\t\t\tsetIsActive( false );\n\t\t\tclearTimer();\n\t\t};\n\t}, [ margin, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ clientId }\n\t\t\t__unstableCoverTarget\n\t\t\t__unstableRefreshSize={ margin }\n\t\t\tshift={ false }\n\t\t>\n\t\t\t<div className=\"block-editor__padding-visualizer\" style={ style } />\n\t\t</BlockPopover>\n\t);\n}\n"]}
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.MinHeightEdit = MinHeightEdit;
9
+ exports.hasMinHeightSupport = hasMinHeightSupport;
10
+ exports.hasMinHeightValue = hasMinHeightValue;
11
+ exports.resetMinHeight = resetMinHeight;
12
+ exports.useIsMinHeightDisabled = useIsMinHeightDisabled;
13
+
14
+ var _element = require("@wordpress/element");
15
+
16
+ var _blocks = require("@wordpress/blocks");
17
+
18
+ var _i18n = require("@wordpress/i18n");
19
+
20
+ var _useSetting = _interopRequireDefault(require("../components/use-setting"));
21
+
22
+ var _heightControl = _interopRequireDefault(require("../components/height-control"));
23
+
24
+ var _dimensions = require("./dimensions");
25
+
26
+ var _utils = require("./utils");
27
+
28
+ /**
29
+ * WordPress dependencies
30
+ */
31
+
32
+ /**
33
+ * Internal dependencies
34
+ */
35
+
36
+ /**
37
+ * Determines if there is minHeight support.
38
+ *
39
+ * @param {string|Object} blockType Block name or Block Type object.
40
+ * @return {boolean} Whether there is support.
41
+ */
42
+ function hasMinHeightSupport(blockType) {
43
+ const support = (0, _blocks.getBlockSupport)(blockType, _dimensions.DIMENSIONS_SUPPORT_KEY);
44
+ return !!(true === support || support !== null && support !== void 0 && support.minHeight);
45
+ }
46
+ /**
47
+ * Checks if there is a current value in the minHeight block support attributes.
48
+ *
49
+ * @param {Object} props Block props.
50
+ * @return {boolean} Whether or not the block has a minHeight value set.
51
+ */
52
+
53
+
54
+ function hasMinHeightValue(props) {
55
+ var _props$attributes$sty, _props$attributes$sty2;
56
+
57
+ return ((_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : (_props$attributes$sty2 = _props$attributes$sty.dimensions) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.minHeight) !== undefined;
58
+ }
59
+ /**
60
+ * Resets the minHeight block support attributes. This can be used when disabling
61
+ * the padding support controls for a block via a `ToolsPanel`.
62
+ *
63
+ * @param {Object} props Block props.
64
+ * @param {Object} props.attributes Block's attributes.
65
+ * @param {Object} props.setAttributes Function to set block's attributes.
66
+ */
67
+
68
+
69
+ function resetMinHeight(_ref) {
70
+ let {
71
+ attributes = {},
72
+ setAttributes
73
+ } = _ref;
74
+ const {
75
+ style
76
+ } = attributes;
77
+ setAttributes({
78
+ style: (0, _utils.cleanEmptyObject)({ ...style,
79
+ dimensions: { ...(style === null || style === void 0 ? void 0 : style.dimensions),
80
+ minHeight: undefined
81
+ }
82
+ })
83
+ });
84
+ }
85
+ /**
86
+ * Custom hook that checks if minHeight controls have been disabled.
87
+ *
88
+ * @param {string} name The name of the block.
89
+ * @return {boolean} Whether minHeight control is disabled.
90
+ */
91
+
92
+
93
+ function useIsMinHeightDisabled() {
94
+ let {
95
+ name: blockName
96
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
97
+ const isDisabled = !(0, _useSetting.default)('dimensions.minHeight');
98
+ return !hasMinHeightSupport(blockName) || isDisabled;
99
+ }
100
+ /**
101
+ * Inspector control panel containing the minHeight related configuration.
102
+ *
103
+ * @param {Object} props Block props.
104
+ * @return {WPElement} Edit component for height.
105
+ */
106
+
107
+
108
+ function MinHeightEdit(props) {
109
+ var _style$dimensions;
110
+
111
+ const {
112
+ attributes: {
113
+ style
114
+ },
115
+ setAttributes
116
+ } = props;
117
+
118
+ if (useIsMinHeightDisabled(props)) {
119
+ return null;
120
+ }
121
+
122
+ const onChange = next => {
123
+ const newStyle = { ...style,
124
+ dimensions: { ...(style === null || style === void 0 ? void 0 : style.dimensions),
125
+ minHeight: next
126
+ }
127
+ };
128
+ setAttributes({
129
+ style: (0, _utils.cleanEmptyObject)(newStyle)
130
+ });
131
+ };
132
+
133
+ return (0, _element.createElement)(_heightControl.default, {
134
+ label: (0, _i18n.__)('Min. height'),
135
+ value: style === null || style === void 0 ? void 0 : (_style$dimensions = style.dimensions) === null || _style$dimensions === void 0 ? void 0 : _style$dimensions.minHeight,
136
+ onChange: onChange
137
+ });
138
+ }
139
+ //# sourceMappingURL=min-height.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/min-height.js"],"names":["hasMinHeightSupport","blockType","support","DIMENSIONS_SUPPORT_KEY","minHeight","hasMinHeightValue","props","attributes","style","dimensions","undefined","resetMinHeight","setAttributes","useIsMinHeightDisabled","name","blockName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AED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,aAAT,CAAwBX,KAAxB,EAAgC;AAAA;;AACtC,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA;AAAF,KADP;AAELI,IAAAA;AAFK,MAGFN,KAHJ;;AAKA,MAAKO,sBAAsB,CAAEP,KAAF,CAA3B,EAAuC;AACtC,WAAO,IAAP;AACA;;AAED,QAAMY,QAAQ,GAAKC,IAAF,IAAY;AAC5B,UAAMC,QAAQ,GAAG,EAChB,GAAGZ,KADa;AAEhBC,MAAAA,UAAU,EAAE,EACX,IAAGD,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEC,UAAV,CADW;AAEXL,QAAAA,SAAS,EAAEe;AAFA;AAFI,KAAjB;AAQAP,IAAAA,aAAa,CAAE;AAAEJ,MAAAA,KAAK,EAAE,6BAAkBY,QAAlB;AAAT,KAAF,CAAb;AACA,GAVD;;AAYA,SACC,4BAAC,sBAAD;AACC,IAAA,KAAK,EAAG,cAAI,aAAJ,CADT;AAEC,IAAA,KAAK,EAAGZ,KAAH,aAAGA,KAAH,4CAAGA,KAAK,CAAEC,UAAV,sDAAG,kBAAmBL,SAF5B;AAGC,IAAA,QAAQ,EAAGc;AAHZ,IADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport HeightControl from '../components/height-control';\nimport { DIMENSIONS_SUPPORT_KEY } from './dimensions';\nimport { cleanEmptyObject } from './utils';\n\n/**\n * Determines if there is minHeight support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n * @return {boolean} Whether there is support.\n */\nexport function hasMinHeightSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, DIMENSIONS_SUPPORT_KEY );\n\treturn !! ( true === support || support?.minHeight );\n}\n\n/**\n * Checks if there is a current value in the minHeight block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a minHeight value set.\n */\nexport function hasMinHeightValue( props ) {\n\treturn props.attributes.style?.dimensions?.minHeight !== undefined;\n}\n\n/**\n * Resets the minHeight block support attributes. This can be used when disabling\n * the padding support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetMinHeight( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tdimensions: {\n\t\t\t\t...style?.dimensions,\n\t\t\t\tminHeight: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if minHeight controls have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether minHeight control is disabled.\n */\nexport function useIsMinHeightDisabled( { name: blockName } = {} ) {\n\tconst isDisabled = ! useSetting( 'dimensions.minHeight' );\n\treturn ! hasMinHeightSupport( blockName ) || isDisabled;\n}\n\n/**\n * Inspector control panel containing the minHeight related configuration.\n *\n * @param {Object} props Block props.\n * @return {WPElement} Edit component for height.\n */\nexport function MinHeightEdit( props ) {\n\tconst {\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tif ( useIsMinHeightDisabled( props ) ) {\n\t\treturn null;\n\t}\n\n\tconst onChange = ( next ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tdimensions: {\n\t\t\t\t...style?.dimensions,\n\t\t\t\tminHeight: next,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( { style: cleanEmptyObject( newStyle ) } );\n\t};\n\n\treturn (\n\t\t<HeightControl\n\t\t\tlabel={ __( 'Min. height' ) }\n\t\t\tvalue={ style?.dimensions?.minHeight }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n"]}
@@ -209,13 +209,15 @@ function PaddingVisualizer(_ref2) {
209
209
  if (!(0, _isShallowEqual.default)(padding, valueRef.current) && !forceShow) {
210
210
  setIsActive(true);
211
211
  valueRef.current = padding;
212
- clearTimer();
213
212
  timeoutRef.current = setTimeout(() => {
214
213
  setIsActive(false);
215
214
  }, 400);
216
215
  }
217
216
 
218
- return () => clearTimer();
217
+ return () => {
218
+ setIsActive(false);
219
+ clearTimer();
220
+ };
219
221
  }, [padding, forceShow]);
220
222
 
221
223
  if (!isActive && !forceShow) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/padding.js"],"names":["hasPaddingSupport","blockType","support","SPACING_SUPPORT_KEY","padding","hasPaddingValue","props","attributes","style","spacing","undefined","resetPadding","setAttributes","useIsPaddingDisabled","name","blockName","isDisabled","isInvalid","PaddingEdit","onMouseOver","onMouseOut","spacingSizes","units","availableUnits","sides","splitOnAxis","some","side","AXIAL_SIDES","includes","onChange","next","newStyle","Platform","select","web","length","native","PaddingVisualizer","clientId","forceShow","borderTopWidth","top","borderRightWidth","right","borderBottomWidth","bottom","borderLeftWidth","left","isActive","setIsActive","valueRef","timeoutRef","clearTimer","current","window","clearTimeout","setTimeout"],"mappings":";;;;;;;;;;;;;;AAIA;;AADA;;AAQA;;AACA;;AAIA;;AAKA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AA/BA;AACA;AACA;;AAgBA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,iBAAT,CAA4BC,SAA5B,EAAwC;AAC9C,QAAMC,OAAO,GAAG,6BAAiBD,SAAjB,EAA4BE,+BAA5B,CAAhB;AACA,SAAO,CAAC,EAAI,SAASD,OAAT,IAAoBA,OAApB,aAAoBA,OAApB,eAAoBA,OAAO,CAAEE,OAAjC,CAAR;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,eAAT,CAA0BC,KAA1B,EAAkC;AAAA;;AACxC,SAAO,0BAAAA,KAAK,CAACC,UAAN,CAAiBC,KAAjB,0GAAwBC,OAAxB,kFAAi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IC,IAAA,KAAK,EAAG;AAJT,KAMC;AAAK,IAAA,SAAS,EAAC,kCAAf;AAAkD,IAAA,KAAK,EAAGI;AAA1D,IAND,CADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPlatform,\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseMemo,\n} from '@wordpress/element';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalBoxControl as BoxControl,\n} from '@wordpress/components';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport {\n\tAXIAL_SIDES,\n\tSPACING_SUPPORT_KEY,\n\tuseCustomSides,\n\tuseIsDimensionsSupportValid,\n} from './dimensions';\nimport { cleanEmptyObject } from './utils';\nimport BlockPopover from '../components/block-popover';\nimport SpacingSizesControl from '../components/spacing-sizes-control';\nimport { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';\n/**\n * Determines if there is padding support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPaddingSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, SPACING_SUPPORT_KEY );\n\treturn !! ( true === support || support?.padding );\n}\n\n/**\n * Checks if there is a current value in the padding block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a padding value set.\n */\nexport function hasPaddingValue( props ) {\n\treturn props.attributes.style?.spacing?.padding !== undefined;\n}\n\n/**\n * Resets the padding block support attributes. This can be used when disabling\n * the padding support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPadding( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tpadding: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if padding settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPaddingDisabled( { name: blockName } = {} ) {\n\tconst isDisabled = ! useSetting( 'spacing.padding' );\n\tconst isInvalid = ! useIsDimensionsSupportValid( blockName, 'padding' );\n\n\treturn ! hasPaddingSupport( blockName ) || isDisabled || isInvalid;\n}\n\n/**\n * Inspector control panel containing the padding related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Padding edit element.\n */\nexport function PaddingEdit( props ) {\n\tconst {\n\t\tname: blockName,\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t\tonMouseOver,\n\t\tonMouseOut,\n\t} = props;\n\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\tconst sides = useCustomSides( blockName, 'padding' );\n\tconst splitOnAxis =\n\t\tsides && sides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\n\tif ( useIsPaddingDisabled( props ) ) {\n\t\treturn null;\n\t}\n\n\tconst onChange = ( next ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tpadding: next,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\treturn Platform.select( {\n\t\tweb: (\n\t\t\t<>\n\t\t\t\t{ ( ! spacingSizes || spacingSizes?.length === 0 ) && (\n\t\t\t\t\t<BoxControl\n\t\t\t\t\t\tvalues={ style?.spacing?.padding }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\t\tsides={ sides }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ splitOnAxis }\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ spacingSizes?.length > 0 && (\n\t\t\t\t\t<SpacingSizesControl\n\t\t\t\t\t\tvalues={ style?.spacing?.padding }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\t\tsides={ sides }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ splitOnAxis }\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t),\n\t\tnative: null,\n\t} );\n}\n\nexport function PaddingVisualizer( { clientId, attributes, forceShow } ) {\n\tconst padding = attributes?.style?.spacing?.padding;\n\tconst style = useMemo( () => {\n\t\treturn {\n\t\t\tborderTopWidth: padding?.top\n\t\t\t\t? getSpacingPresetCssVar( padding?.top )\n\t\t\t\t: 0,\n\t\t\tborderRightWidth: padding?.right\n\t\t\t\t? getSpacingPresetCssVar( padding?.right )\n\t\t\t\t: 0,\n\t\t\tborderBottomWidth: padding?.bottom\n\t\t\t\t? getSpacingPresetCssVar( padding?.bottom )\n\t\t\t\t: 0,\n\t\t\tborderLeftWidth: padding?.left\n\t\t\t\t? getSpacingPresetCssVar( padding?.left )\n\t\t\t\t: 0,\n\t\t};\n\t}, [ padding ] );\n\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst valueRef = useRef( padding );\n\tconst timeoutRef = useRef();\n\n\tconst clearTimer = () => {\n\t\tif ( timeoutRef.current ) {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! isShallowEqual( padding, valueRef.current ) && ! forceShow ) {\n\t\t\tsetIsActive( true );\n\t\t\tvalueRef.current = padding;\n\n\t\t\tclearTimer();\n\n\t\t\ttimeoutRef.current = setTimeout( () => {\n\t\t\t\tsetIsActive( false );\n\t\t\t}, 400 );\n\t\t}\n\n\t\treturn () => clearTimer();\n\t}, [ padding, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ clientId }\n\t\t\t__unstableCoverTarget\n\t\t\t__unstableRefreshSize={ padding }\n\t\t\tshift={ false }\n\t\t>\n\t\t\t<div className=\"block-editor__padding-visualizer\" style={ style } />\n\t\t</BlockPopover>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/padding.js"],"names":["hasPaddingSupport","blockType","support","SPACING_SUPPORT_KEY","padding","hasPaddingValue","props","attributes","style","spacing","undefined","resetPadding","setAttributes","useIsPaddingDisabled","name","blockName","isDisabled","isInvalid","PaddingEdit","onMouseOver","onMouseOut","spacingSizes","units","availableUnits","sides","splitOnAxis","some","side","AXIAL_SIDES","includes","onChange","next","newStyle","Platform","select","web","length","native","PaddingVisualizer","clientId","forceShow","borderTopWidth","top","borderRightWidth","right","borderBottomWidth","bottom","borderLeftWidth","left","isActive","setIsActive","valueRef","timeoutRef","clearTimer","current","window","clearTimeout","setTimeout"],"mappings":";;;;;;;;;;;;;;AAIA;;AADA;;AAQA;;AACA;;AAIA;;AAKA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AA/BA;AACA;AACA;;AAgBA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,iBAAT,CAA4BC,SAA5B,EAAwC;AAC9C,QAAMC,OAAO,GAAG,6BAAiBD,SAAjB,EAA4BE,+BAA5B,CAAhB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E,KAAF,CAAX;AACAG,MAAAA,UAAU;AACV,KAHD;AAIA,GAdD,EAcG,CAAEjD,OAAF,EAAWoC,SAAX,CAdH;;AAgBA,MAAK,CAAES,QAAF,IAAc,CAAET,SAArB,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,qBAAD;AACC,IAAA,QAAQ,EAAGD,QADZ;AAEC,IAAA,qBAAqB,MAFtB;AAGC,IAAA,qBAAqB,EAAGnC,OAHzB;AAIC,IAAA,KAAK,EAAG;AAJT,KAMC;AAAK,IAAA,SAAS,EAAC,kCAAf;AAAkD,IAAA,KAAK,EAAGI;AAA1D,IAND,CADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPlatform,\n\tuseState,\n\tuseRef,\n\tuseEffect,\n\tuseMemo,\n} from '@wordpress/element';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalBoxControl as BoxControl,\n} from '@wordpress/components';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport {\n\tAXIAL_SIDES,\n\tSPACING_SUPPORT_KEY,\n\tuseCustomSides,\n\tuseIsDimensionsSupportValid,\n} from './dimensions';\nimport { cleanEmptyObject } from './utils';\nimport BlockPopover from '../components/block-popover';\nimport SpacingSizesControl from '../components/spacing-sizes-control';\nimport { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';\n/**\n * Determines if there is padding support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPaddingSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, SPACING_SUPPORT_KEY );\n\treturn !! ( true === support || support?.padding );\n}\n\n/**\n * Checks if there is a current value in the padding block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a padding value set.\n */\nexport function hasPaddingValue( props ) {\n\treturn props.attributes.style?.spacing?.padding !== undefined;\n}\n\n/**\n * Resets the padding block support attributes. This can be used when disabling\n * the padding support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPadding( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tpadding: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if padding settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPaddingDisabled( { name: blockName } = {} ) {\n\tconst isDisabled = ! useSetting( 'spacing.padding' );\n\tconst isInvalid = ! useIsDimensionsSupportValid( blockName, 'padding' );\n\n\treturn ! hasPaddingSupport( blockName ) || isDisabled || isInvalid;\n}\n\n/**\n * Inspector control panel containing the padding related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Padding edit element.\n */\nexport function PaddingEdit( props ) {\n\tconst {\n\t\tname: blockName,\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t\tonMouseOver,\n\t\tonMouseOut,\n\t} = props;\n\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\tconst sides = useCustomSides( blockName, 'padding' );\n\tconst splitOnAxis =\n\t\tsides && sides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\n\tif ( useIsPaddingDisabled( props ) ) {\n\t\treturn null;\n\t}\n\n\tconst onChange = ( next ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tpadding: next,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\treturn Platform.select( {\n\t\tweb: (\n\t\t\t<>\n\t\t\t\t{ ( ! spacingSizes || spacingSizes?.length === 0 ) && (\n\t\t\t\t\t<BoxControl\n\t\t\t\t\t\tvalues={ style?.spacing?.padding }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\t\tsides={ sides }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ splitOnAxis }\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ spacingSizes?.length > 0 && (\n\t\t\t\t\t<SpacingSizesControl\n\t\t\t\t\t\tvalues={ style?.spacing?.padding }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\t\tsides={ sides }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ splitOnAxis }\n\t\t\t\t\t\tonMouseOver={ onMouseOver }\n\t\t\t\t\t\tonMouseOut={ onMouseOut }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t),\n\t\tnative: null,\n\t} );\n}\n\nexport function PaddingVisualizer( { clientId, attributes, forceShow } ) {\n\tconst padding = attributes?.style?.spacing?.padding;\n\tconst style = useMemo( () => {\n\t\treturn {\n\t\t\tborderTopWidth: padding?.top\n\t\t\t\t? getSpacingPresetCssVar( padding?.top )\n\t\t\t\t: 0,\n\t\t\tborderRightWidth: padding?.right\n\t\t\t\t? getSpacingPresetCssVar( padding?.right )\n\t\t\t\t: 0,\n\t\t\tborderBottomWidth: padding?.bottom\n\t\t\t\t? getSpacingPresetCssVar( padding?.bottom )\n\t\t\t\t: 0,\n\t\t\tborderLeftWidth: padding?.left\n\t\t\t\t? getSpacingPresetCssVar( padding?.left )\n\t\t\t\t: 0,\n\t\t};\n\t}, [ padding ] );\n\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst valueRef = useRef( padding );\n\tconst timeoutRef = useRef();\n\n\tconst clearTimer = () => {\n\t\tif ( timeoutRef.current ) {\n\t\t\twindow.clearTimeout( timeoutRef.current );\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tif ( ! isShallowEqual( padding, valueRef.current ) && ! forceShow ) {\n\t\t\tsetIsActive( true );\n\t\t\tvalueRef.current = padding;\n\n\t\t\ttimeoutRef.current = setTimeout( () => {\n\t\t\t\tsetIsActive( false );\n\t\t\t}, 400 );\n\t\t}\n\n\t\treturn () => {\n\t\t\tsetIsActive( false );\n\t\t\tclearTimer();\n\t\t};\n\t}, [ padding, forceShow ] );\n\n\tif ( ! isActive && ! forceShow ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPopover\n\t\t\tclientId={ clientId }\n\t\t\t__unstableCoverTarget\n\t\t\t__unstableRefreshSize={ padding }\n\t\t\tshift={ false }\n\t\t>\n\t\t\t<div className=\"block-editor__padding-visualizer\" style={ style } />\n\t\t</BlockPopover>\n\t);\n}\n"]}