@wordpress/block-editor 11.3.6 → 11.5.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 (357) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/build/components/block-lock/modal.js +1 -0
  3. package/build/components/block-lock/modal.js.map +1 -1
  4. package/build/components/block-popover/inbetween.js +10 -33
  5. package/build/components/block-popover/inbetween.js.map +1 -1
  6. package/build/components/block-settings-menu/block-settings-dropdown.js +2 -2
  7. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  8. package/build/components/block-styles/index.js +2 -1
  9. package/build/components/block-styles/index.js.map +1 -1
  10. package/build/components/block-types-list/index.native.js +2 -0
  11. package/build/components/block-types-list/index.native.js.map +1 -1
  12. package/build/components/child-layout-control/index.js +107 -0
  13. package/build/components/child-layout-control/index.js.map +1 -0
  14. package/build/components/colors-gradients/control.js +6 -3
  15. package/build/components/colors-gradients/control.js.map +1 -1
  16. package/build/components/date-format-picker/index.js +3 -3
  17. package/build/components/date-format-picker/index.js.map +1 -1
  18. package/build/components/font-appearance-control/index.js +0 -3
  19. package/build/components/font-appearance-control/index.js.map +1 -1
  20. package/build/components/global-styles/dimensions-panel.js +594 -0
  21. package/build/components/global-styles/dimensions-panel.js.map +1 -0
  22. package/build/components/global-styles/hooks.js +142 -45
  23. package/build/components/global-styles/hooks.js.map +1 -1
  24. package/build/components/global-styles/index.js +38 -0
  25. package/build/components/global-styles/index.js.map +1 -1
  26. package/build/components/global-styles/typography-panel.js +434 -0
  27. package/build/components/global-styles/typography-panel.js.map +1 -0
  28. package/build/components/global-styles/use-global-styles-output.js +7 -3
  29. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  30. package/build/components/global-styles/utils.js +2 -0
  31. package/build/components/global-styles/utils.js.map +1 -1
  32. package/build/components/iframe/index.js +17 -11
  33. package/build/components/iframe/index.js.map +1 -1
  34. package/build/components/image-editor/aspect-ratio-dropdown.js +2 -1
  35. package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  36. package/build/components/image-size-control/index.js +6 -11
  37. package/build/components/image-size-control/index.js.map +1 -1
  38. package/build/components/index.native.js +23 -0
  39. package/build/components/index.native.js.map +1 -1
  40. package/build/components/inserter/block-patterns-tab.js +9 -15
  41. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  42. package/build/components/inserter/block-types-tab.native.js +4 -1
  43. package/build/components/inserter/block-types-tab.native.js.map +1 -1
  44. package/build/components/inserter/reusable-blocks-tab.native.js +4 -1
  45. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  46. package/build/components/inserter/search-results.native.js +4 -1
  47. package/build/components/inserter/search-results.native.js.map +1 -1
  48. package/build/components/inspector-controls/block-support-tools-panel.js +1 -1
  49. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  50. package/build/components/inspector-controls/fill.js +38 -9
  51. package/build/components/inspector-controls/fill.js.map +1 -1
  52. package/build/components/link-control/index.js +55 -28
  53. package/build/components/link-control/index.js.map +1 -1
  54. package/build/components/link-control/settings-drawer.js +72 -30
  55. package/build/components/link-control/settings-drawer.js.map +1 -1
  56. package/build/components/link-control/settings.js +53 -0
  57. package/build/components/link-control/settings.js.map +1 -0
  58. package/build/components/list-view/block.js +4 -2
  59. package/build/components/list-view/block.js.map +1 -1
  60. package/build/components/list-view/expander.js +2 -1
  61. package/build/components/list-view/expander.js.map +1 -1
  62. package/build/components/list-view/index.js +6 -1
  63. package/build/components/list-view/index.js.map +1 -1
  64. package/build/components/off-canvas-editor/appender.js +5 -10
  65. package/build/components/off-canvas-editor/appender.js.map +1 -1
  66. package/build/components/off-canvas-editor/block-contents.js +3 -2
  67. package/build/components/off-canvas-editor/block-contents.js.map +1 -1
  68. package/build/components/off-canvas-editor/branch.js +1 -0
  69. package/build/components/off-canvas-editor/branch.js.map +1 -1
  70. package/build/components/off-canvas-editor/index.js +7 -3
  71. package/build/components/off-canvas-editor/index.js.map +1 -1
  72. package/build/components/off-canvas-editor/leaf-more-menu.js +24 -4
  73. package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
  74. package/build/components/off-canvas-editor/link-ui.js +2 -0
  75. package/build/components/off-canvas-editor/link-ui.js.map +1 -1
  76. package/build/components/responsive-block-control/index.js +1 -0
  77. package/build/components/responsive-block-control/index.js.map +1 -1
  78. package/build/components/rich-text/index.js +9 -45
  79. package/build/components/rich-text/index.js.map +1 -1
  80. package/build/components/rich-text/use-delete.js +73 -0
  81. package/build/components/rich-text/use-delete.js.map +1 -0
  82. package/build/components/rich-text/use-input-rules.js +14 -6
  83. package/build/components/rich-text/use-input-rules.js.map +1 -1
  84. package/build/components/url-input/index.js +2 -2
  85. package/build/components/url-input/index.js.map +1 -1
  86. package/build/components/writing-flow/use-selection-observer.js +4 -1
  87. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  88. package/build/hooks/align.js +3 -1
  89. package/build/hooks/align.js.map +1 -1
  90. package/build/hooks/dimensions.js +78 -190
  91. package/build/hooks/dimensions.js.map +1 -1
  92. package/build/hooks/duotone.js +94 -25
  93. package/build/hooks/duotone.js.map +1 -1
  94. package/build/hooks/font-family.js +2 -76
  95. package/build/hooks/font-family.js.map +1 -1
  96. package/build/hooks/font-size.js +3 -51
  97. package/build/hooks/font-size.js.map +1 -1
  98. package/build/hooks/gap.js +0 -201
  99. package/build/hooks/gap.js.map +1 -1
  100. package/build/hooks/index.js +2 -0
  101. package/build/hooks/index.js.map +1 -1
  102. package/build/hooks/layout.js +14 -5
  103. package/build/hooks/layout.js.map +1 -1
  104. package/build/hooks/line-height.js +0 -42
  105. package/build/hooks/line-height.js.map +1 -1
  106. package/build/hooks/margin.js +7 -163
  107. package/build/hooks/margin.js.map +1 -1
  108. package/build/hooks/padding.js +7 -163
  109. package/build/hooks/padding.js.map +1 -1
  110. package/build/hooks/typography.js +98 -128
  111. package/build/hooks/typography.js.map +1 -1
  112. package/build/hooks/utils.js +75 -0
  113. package/build/hooks/utils.js.map +1 -1
  114. package/build/layouts/flex.js +1 -0
  115. package/build/layouts/flex.js.map +1 -1
  116. package/build/store/actions.js +24 -12
  117. package/build/store/actions.js.map +1 -1
  118. package/build/store/reducer.js +53 -47
  119. package/build/store/reducer.js.map +1 -1
  120. package/build/store/selectors.js +22 -1
  121. package/build/store/selectors.js.map +1 -1
  122. package/build/utils/parse-css-unit-to-px.js +36 -3
  123. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  124. package/build-module/components/block-lock/modal.js +1 -0
  125. package/build-module/components/block-lock/modal.js.map +1 -1
  126. package/build-module/components/block-popover/inbetween.js +10 -33
  127. package/build-module/components/block-popover/inbetween.js.map +1 -1
  128. package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -2
  129. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  130. package/build-module/components/block-styles/index.js +2 -1
  131. package/build-module/components/block-styles/index.js.map +1 -1
  132. package/build-module/components/block-types-list/index.native.js +2 -0
  133. package/build-module/components/block-types-list/index.native.js.map +1 -1
  134. package/build-module/components/child-layout-control/index.js +98 -0
  135. package/build-module/components/child-layout-control/index.js.map +1 -0
  136. package/build-module/components/colors-gradients/control.js +6 -3
  137. package/build-module/components/colors-gradients/control.js.map +1 -1
  138. package/build-module/components/date-format-picker/index.js +4 -4
  139. package/build-module/components/date-format-picker/index.js.map +1 -1
  140. package/build-module/components/font-appearance-control/index.js +2 -1
  141. package/build-module/components/font-appearance-control/index.js.map +1 -1
  142. package/build-module/components/global-styles/dimensions-panel.js +574 -0
  143. package/build-module/components/global-styles/dimensions-panel.js.map +1 -0
  144. package/build-module/components/global-styles/hooks.js +138 -46
  145. package/build-module/components/global-styles/hooks.js.map +1 -1
  146. package/build-module/components/global-styles/index.js +3 -1
  147. package/build-module/components/global-styles/index.js.map +1 -1
  148. package/build-module/components/global-styles/typography-panel.js +415 -0
  149. package/build-module/components/global-styles/typography-panel.js.map +1 -0
  150. package/build-module/components/global-styles/use-global-styles-output.js +7 -3
  151. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  152. package/build-module/components/global-styles/utils.js +2 -0
  153. package/build-module/components/global-styles/utils.js.map +1 -1
  154. package/build-module/components/iframe/index.js +17 -11
  155. package/build-module/components/iframe/index.js.map +1 -1
  156. package/build-module/components/image-editor/aspect-ratio-dropdown.js +2 -1
  157. package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
  158. package/build-module/components/image-size-control/index.js +7 -12
  159. package/build-module/components/image-size-control/index.js.map +1 -1
  160. package/build-module/components/index.native.js +2 -1
  161. package/build-module/components/index.native.js.map +1 -1
  162. package/build-module/components/inserter/block-patterns-tab.js +9 -15
  163. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  164. package/build-module/components/inserter/block-types-tab.native.js +3 -1
  165. package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
  166. package/build-module/components/inserter/reusable-blocks-tab.native.js +3 -1
  167. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  168. package/build-module/components/inserter/search-results.native.js +3 -1
  169. package/build-module/components/inserter/search-results.native.js.map +1 -1
  170. package/build-module/components/inspector-controls/block-support-tools-panel.js +1 -1
  171. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  172. package/build-module/components/inspector-controls/fill.js +39 -9
  173. package/build-module/components/inspector-controls/fill.js.map +1 -1
  174. package/build-module/components/link-control/index.js +56 -28
  175. package/build-module/components/link-control/index.js.map +1 -1
  176. package/build-module/components/link-control/settings-drawer.js +68 -30
  177. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  178. package/build-module/components/link-control/settings.js +44 -0
  179. package/build-module/components/link-control/settings.js.map +1 -0
  180. package/build-module/components/list-view/block.js +4 -2
  181. package/build-module/components/list-view/block.js.map +1 -1
  182. package/build-module/components/list-view/expander.js +2 -1
  183. package/build-module/components/list-view/expander.js.map +1 -1
  184. package/build-module/components/list-view/index.js +6 -1
  185. package/build-module/components/list-view/index.js.map +1 -1
  186. package/build-module/components/off-canvas-editor/appender.js +5 -10
  187. package/build-module/components/off-canvas-editor/appender.js.map +1 -1
  188. package/build-module/components/off-canvas-editor/block-contents.js +3 -2
  189. package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
  190. package/build-module/components/off-canvas-editor/branch.js +1 -0
  191. package/build-module/components/off-canvas-editor/branch.js.map +1 -1
  192. package/build-module/components/off-canvas-editor/index.js +7 -3
  193. package/build-module/components/off-canvas-editor/index.js.map +1 -1
  194. package/build-module/components/off-canvas-editor/leaf-more-menu.js +27 -7
  195. package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
  196. package/build-module/components/off-canvas-editor/link-ui.js +2 -0
  197. package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
  198. package/build-module/components/responsive-block-control/index.js +1 -0
  199. package/build-module/components/responsive-block-control/index.js.map +1 -1
  200. package/build-module/components/rich-text/index.js +9 -45
  201. package/build-module/components/rich-text/index.js.map +1 -1
  202. package/build-module/components/rich-text/use-delete.js +62 -0
  203. package/build-module/components/rich-text/use-delete.js.map +1 -0
  204. package/build-module/components/rich-text/use-input-rules.js +14 -6
  205. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  206. package/build-module/components/url-input/index.js +2 -2
  207. package/build-module/components/url-input/index.js.map +1 -1
  208. package/build-module/components/writing-flow/use-selection-observer.js +4 -1
  209. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  210. package/build-module/hooks/align.js +3 -1
  211. package/build-module/hooks/align.js.map +1 -1
  212. package/build-module/hooks/dimensions.js +81 -187
  213. package/build-module/hooks/dimensions.js.map +1 -1
  214. package/build-module/hooks/duotone.js +86 -24
  215. package/build-module/hooks/duotone.js.map +1 -1
  216. package/build-module/hooks/font-family.js +3 -69
  217. package/build-module/hooks/font-family.js.map +1 -1
  218. package/build-module/hooks/font-size.js +6 -47
  219. package/build-module/hooks/font-size.js.map +1 -1
  220. package/build-module/hooks/gap.js +0 -182
  221. package/build-module/hooks/gap.js.map +1 -1
  222. package/build-module/hooks/index.js +1 -0
  223. package/build-module/hooks/index.js.map +1 -1
  224. package/build-module/hooks/layout.js +14 -5
  225. package/build-module/hooks/layout.js.map +1 -1
  226. package/build-module/hooks/line-height.js +0 -38
  227. package/build-module/hooks/line-height.js.map +1 -1
  228. package/build-module/hooks/margin.js +4 -143
  229. package/build-module/hooks/margin.js.map +1 -1
  230. package/build-module/hooks/padding.js +4 -143
  231. package/build-module/hooks/padding.js.map +1 -1
  232. package/build-module/hooks/typography.js +97 -123
  233. package/build-module/hooks/typography.js.map +1 -1
  234. package/build-module/hooks/utils.js +70 -0
  235. package/build-module/hooks/utils.js.map +1 -1
  236. package/build-module/layouts/flex.js +1 -0
  237. package/build-module/layouts/flex.js.map +1 -1
  238. package/build-module/store/actions.js +24 -12
  239. package/build-module/store/actions.js.map +1 -1
  240. package/build-module/store/reducer.js +53 -45
  241. package/build-module/store/reducer.js.map +1 -1
  242. package/build-module/store/selectors.js +22 -1
  243. package/build-module/store/selectors.js.map +1 -1
  244. package/build-module/utils/parse-css-unit-to-px.js +36 -3
  245. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  246. package/build-style/style-rtl.css +54 -64
  247. package/build-style/style.css +54 -64
  248. package/package.json +31 -31
  249. package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +24 -24
  250. package/src/components/block-lock/modal.js +1 -0
  251. package/src/components/block-lock/style.scss +0 -9
  252. package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +20 -20
  253. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +15 -15
  254. package/src/components/block-popover/inbetween.js +21 -53
  255. package/src/components/block-settings-menu/block-settings-dropdown.js +4 -1
  256. package/src/components/block-styles/index.js +5 -1
  257. package/src/components/block-types-list/index.native.js +2 -0
  258. package/src/components/child-layout-control/index.js +106 -0
  259. package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
  260. package/src/components/colors-gradients/control.js +3 -0
  261. package/src/components/date-format-picker/index.js +6 -8
  262. package/src/components/date-format-picker/style.scss +0 -5
  263. package/src/components/font-appearance-control/index.js +1 -1
  264. package/src/components/global-styles/dimensions-panel.js +627 -0
  265. package/src/components/global-styles/hooks.js +229 -66
  266. package/src/components/global-styles/index.js +9 -0
  267. package/src/components/global-styles/typography-panel.js +428 -0
  268. package/src/components/global-styles/use-global-styles-output.js +10 -5
  269. package/src/components/global-styles/utils.js +2 -0
  270. package/src/components/iframe/index.js +20 -18
  271. package/src/components/image-editor/aspect-ratio-dropdown.js +1 -0
  272. package/src/components/image-size-control/index.js +10 -12
  273. package/src/components/image-size-control/style.scss +3 -21
  274. package/src/components/index.native.js +5 -0
  275. package/src/components/inner-blocks/test/__snapshots__/index.js.snap +1 -1
  276. package/src/components/inserter/block-patterns-tab.js +9 -23
  277. package/src/components/inserter/block-types-tab.native.js +2 -0
  278. package/src/components/inserter/reusable-blocks-tab.native.js +2 -0
  279. package/src/components/inserter/search-results.native.js +2 -0
  280. package/src/components/inserter/test/__snapshots__/index.native.js.snap +15 -15
  281. package/src/components/inspector-controls/block-support-tools-panel.js +0 -1
  282. package/src/components/inspector-controls/fill.js +32 -8
  283. package/src/components/link-control/index.js +69 -34
  284. package/src/components/link-control/settings-drawer.js +85 -29
  285. package/src/components/link-control/settings.js +42 -0
  286. package/src/components/link-control/style.scss +63 -37
  287. package/src/components/link-control/test/index.js +347 -9
  288. package/src/components/list-view/block.js +7 -1
  289. package/src/components/list-view/expander.js +1 -0
  290. package/src/components/list-view/index.js +5 -0
  291. package/src/components/media-replace-flow/style.scss +7 -9
  292. package/src/components/media-replace-flow/test/index.js +1 -1
  293. package/src/components/off-canvas-editor/appender.js +13 -16
  294. package/src/components/off-canvas-editor/block-contents.js +2 -1
  295. package/src/components/off-canvas-editor/branch.js +1 -0
  296. package/src/components/off-canvas-editor/index.js +8 -2
  297. package/src/components/off-canvas-editor/leaf-more-menu.js +52 -15
  298. package/src/components/off-canvas-editor/link-ui.js +2 -0
  299. package/src/components/responsive-block-control/index.js +1 -0
  300. package/src/components/rich-text/index.js +8 -46
  301. package/src/components/rich-text/use-delete.js +59 -0
  302. package/src/components/rich-text/use-input-rules.js +13 -5
  303. package/src/components/url-input/index.js +3 -2
  304. package/src/components/url-popover/stories/index.js +1 -0
  305. package/src/components/writing-flow/use-selection-observer.js +5 -1
  306. package/src/hooks/align.js +1 -1
  307. package/src/hooks/dimensions.js +97 -269
  308. package/src/hooks/duotone.js +100 -30
  309. package/src/hooks/font-family.js +0 -58
  310. package/src/hooks/font-size.js +1 -36
  311. package/src/hooks/gap.js +0 -201
  312. package/src/hooks/index.js +1 -0
  313. package/src/hooks/layout.js +19 -6
  314. package/src/hooks/line-height.js +0 -33
  315. package/src/hooks/margin.js +1 -164
  316. package/src/hooks/padding.js +1 -163
  317. package/src/hooks/test/__snapshots__/align.native.js.snap +24 -24
  318. package/src/hooks/test/duotone.js +102 -0
  319. package/src/hooks/typography.js +112 -213
  320. package/src/hooks/utils.js +90 -0
  321. package/src/layouts/flex.js +1 -0
  322. package/src/store/actions.js +12 -4
  323. package/src/store/reducer.js +68 -43
  324. package/src/store/selectors.js +20 -1
  325. package/src/store/test/actions.js +4 -2
  326. package/src/utils/parse-css-unit-to-px.js +35 -5
  327. package/src/utils/test/parse-css-unit-to-px.js +12 -0
  328. package/build/hooks/child-layout.js +0 -213
  329. package/build/hooks/child-layout.js.map +0 -1
  330. package/build/hooks/font-appearance.js +0 -188
  331. package/build/hooks/font-appearance.js.map +0 -1
  332. package/build/hooks/letter-spacing.js +0 -129
  333. package/build/hooks/letter-spacing.js.map +0 -1
  334. package/build/hooks/min-height.js +0 -139
  335. package/build/hooks/min-height.js.map +0 -1
  336. package/build/hooks/text-decoration.js +0 -130
  337. package/build/hooks/text-decoration.js.map +0 -1
  338. package/build/hooks/text-transform.js +0 -130
  339. package/build/hooks/text-transform.js.map +0 -1
  340. package/build-module/hooks/child-layout.js +0 -193
  341. package/build-module/hooks/child-layout.js.map +0 -1
  342. package/build-module/hooks/font-appearance.js +0 -161
  343. package/build-module/hooks/font-appearance.js.map +0 -1
  344. package/build-module/hooks/letter-spacing.js +0 -107
  345. package/build-module/hooks/letter-spacing.js.map +0 -1
  346. package/build-module/hooks/min-height.js +0 -116
  347. package/build-module/hooks/min-height.js.map +0 -1
  348. package/build-module/hooks/text-decoration.js +0 -108
  349. package/build-module/hooks/text-decoration.js.map +0 -1
  350. package/build-module/hooks/text-transform.js +0 -108
  351. package/build-module/hooks/text-transform.js.map +0 -1
  352. package/src/hooks/child-layout.js +0 -195
  353. package/src/hooks/font-appearance.js +0 -146
  354. package/src/hooks/letter-spacing.js +0 -101
  355. package/src/hooks/min-height.js +0 -104
  356. package/src/hooks/text-decoration.js +0 -102
  357. package/src/hooks/text-transform.js +0 -101
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/gap.js"],"names":["hasGapSupport","blockType","support","SPACING_SUPPORT_KEY","blockGap","hasGapValue","props","attributes","style","spacing","undefined","getGapBoxControlValueFromStyle","blockGapValue","isValueString","top","left","getGapCSSValue","defaultValue","blockGapBoxControlValue","row","column","resetGap","setAttributes","useIsGapDisabled","name","blockName","isDisabled","GapEdit","clientId","spacingSizes","units","availableUnits","sides","ref","splitOnAxis","some","side","AXIAL_SIDES","includes","onChange","next","hasOwnProperty","newStyle","isSafari","window","navigator","userAgent","current","parentNode","replaceChild","gapValue","boxControlGapValue","right","bottom","Platform","select","web","length","native"],"mappings":";;;;;;;;;;;;;;;AAIA;;AADA;;AAEA;;AACA;;AASA;;AACA;;AACA;;AACA;;AACA;;AACA;;AApBA;AACA;AACA;;AAUA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAwBC,SAAxB,EAAoC;AAC1C,QAAMC,OAAO,GAAG,6BAAiBD,SAAjB,EAA4BE,+BAA5B,CAAhB;AACA,SAAO,CAAC,EAAI,SAASD,OAAT,IAAoBA,OAApB,aAAoBA,OAApB,eAAoBA,OAAO,CAAEE,QAAjC,CAAR;AACA;AAED;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EAwBG,CAAAtB,YAAY,SAAZ,IAAAA,YAAY,WAAZ,YAAAA,YAAY,CAAE4B,MAAd,IAAuB,CAAvB,IACD,4BAAC,4BAAD;AACC,MAAA,MAAM,EAAGN,kBADV;AAEC,MAAA,QAAQ,EAAGZ,QAFZ;AAGC,MAAA,KAAK,EAAG,cAAI,eAAJ,CAHT;AAIC,MAAA,KAAK,EAAGL,WAAW,GAAGF,KAAH,GAAW,CAAE,KAAF,CAJ/B,CAI2C;AAJ3C;AAKC,MAAA,KAAK,EAAGF,KALT;AAMC,MAAA,UAAU,EAAG,KANd;AAOC,MAAA,WAAW,EAAGI;AAPf,MAzBF,CAFsB;AAuCvBwB,IAAAA,MAAM,EAAE;AAvCe,GAAjB,CAAP;AAyCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Platform } from '@wordpress/element';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalBoxControl as BoxControl,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { __unstableUseBlockRef as useBlockRef } from '../components/block-list/use-block-props/use-block-refs';\nimport { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';\nimport SpacingSizesControl from '../components/spacing-sizes-control';\nimport useSetting from '../components/use-setting';\nimport { AXIAL_SIDES, SPACING_SUPPORT_KEY, useCustomSides } from './dimensions';\nimport { cleanEmptyObject } from './utils';\n\n/**\n * Determines if there is gap support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n * @return {boolean} Whether there is support.\n */\nexport function hasGapSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, SPACING_SUPPORT_KEY );\n\treturn !! ( true === support || support?.blockGap );\n}\n\n/**\n * Checks if there is a current value in the gap block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a gap value set.\n */\nexport function hasGapValue( props ) {\n\treturn props.attributes.style?.spacing?.blockGap !== undefined;\n}\n\n/**\n * Returns a BoxControl object value from a given blockGap style value.\n * The string check is for backwards compatibility before Gutenberg supported\n * split gap values (row and column) and the value was a string n + unit.\n *\n * @param {string? | Object?} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}.\n * @return {Object|null} A value to pass to the BoxControl component.\n */\nexport function getGapBoxControlValueFromStyle( blockGapValue ) {\n\tif ( ! blockGapValue ) {\n\t\treturn null;\n\t}\n\n\tconst isValueString = typeof blockGapValue === 'string';\n\treturn {\n\t\ttop: isValueString ? blockGapValue : blockGapValue?.top,\n\t\tleft: isValueString ? blockGapValue : blockGapValue?.left,\n\t};\n}\n\n/**\n * Returns a CSS value for the `gap` property from a given blockGap style.\n *\n * @param {string? | Object?} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}.\n * @param {string?} defaultValue A default gap value.\n * @return {string|null} The concatenated gap value (row and column).\n */\nexport function getGapCSSValue( blockGapValue, defaultValue = '0' ) {\n\tconst blockGapBoxControlValue =\n\t\tgetGapBoxControlValueFromStyle( blockGapValue );\n\tif ( ! blockGapBoxControlValue ) {\n\t\treturn null;\n\t}\n\n\tconst row =\n\t\tgetSpacingPresetCssVar( blockGapBoxControlValue?.top ) || defaultValue;\n\tconst column =\n\t\tgetSpacingPresetCssVar( blockGapBoxControlValue?.left ) || defaultValue;\n\n\treturn row === column ? row : `${ row } ${ column }`;\n}\n\n/**\n * Resets the gap block support attribute. This can be used when disabling\n * the gap support controls for a block via a progressive discovery panel.\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 resetGap( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tblockGap: undefined,\n\t\t\t},\n\t\t},\n\t} );\n}\n\n/**\n * Custom hook that checks if gap settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether the gap setting is disabled.\n */\nexport function useIsGapDisabled( { name: blockName } = {} ) {\n\tconst isDisabled = ! useSetting( 'spacing.blockGap' );\n\treturn ! hasGapSupport( blockName ) || isDisabled;\n}\n\n/**\n * Inspector control panel containing the gap related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Gap edit element.\n */\nexport function GapEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tattributes: { style },\n\t\tname: blockName,\n\t\tsetAttributes,\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, 'blockGap' );\n\tconst ref = useBlockRef( clientId );\n\n\tif ( useIsGapDisabled( props ) ) {\n\t\treturn null;\n\t}\n\n\tconst splitOnAxis =\n\t\tsides && sides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\n\tconst onChange = ( next ) => {\n\t\tlet blockGap = next;\n\n\t\t// If splitOnAxis activated we need to return a BoxControl object to the BoxControl component.\n\t\tif ( !! next && splitOnAxis ) {\n\t\t\tblockGap = { ...getGapBoxControlValueFromStyle( next ) };\n\t\t} else if ( next?.hasOwnProperty( 'top' ) ) {\n\t\t\t// If splitOnAxis is not enabled, treat the 'top' value as the shorthand gap value.\n\t\t\tblockGap = next.top;\n\t\t}\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tspacing: {\n\t\t\t\t...style?.spacing,\n\t\t\t\tblockGap,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\n\t\t// In Safari, changing the `gap` CSS value on its own will not trigger the layout\n\t\t// to be recalculated / re-rendered. To force the updated gap to re-render, here\n\t\t// we replace the block's node with itself.\n\t\tconst isSafari =\n\t\t\twindow?.navigator.userAgent &&\n\t\t\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t\t\t! window.navigator.userAgent.includes( 'Chrome ' ) &&\n\t\t\t! window.navigator.userAgent.includes( 'Chromium ' );\n\n\t\tif ( ref.current && isSafari ) {\n\t\t\tref.current.parentNode?.replaceChild( ref.current, ref.current );\n\t\t}\n\t};\n\n\tconst gapValue = getGapBoxControlValueFromStyle( style?.spacing?.blockGap );\n\n\t// The BoxControl component expects a full complement of side values.\n\t// Gap row and column values translate to top/bottom and left/right respectively.\n\tconst boxControlGapValue = splitOnAxis\n\t\t? {\n\t\t\t\t...gapValue,\n\t\t\t\tright: gapValue?.left,\n\t\t\t\tbottom: gapValue?.top,\n\t\t }\n\t\t: {\n\t\t\t\ttop: gapValue?.top,\n\t\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( splitOnAxis ? (\n\t\t\t\t\t\t<BoxControl\n\t\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\tsides={ sides }\n\t\t\t\t\t\t\tvalues={ boxControlGapValue }\n\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\tsplitOnAxis={ splitOnAxis }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t// Default to `row` for combined values.\n\t\t\t\t\t\t\tvalue={ boxControlGapValue }\n\t\t\t\t\t\t/>\n\t\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={ boxControlGapValue }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\tsides={ splitOnAxis ? sides : [ 'top' ] } // Use 'top' as the shorthand property in non-axial configurations.\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/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t),\n\t\tnative: null,\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/gap.js"],"names":["getGapBoxControlValueFromStyle","blockGapValue","isValueString","top","left","getGapCSSValue","defaultValue","blockGapBoxControlValue","row","column"],"mappings":";;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,8BAAT,CAAyCC,aAAzC,EAAyD;AAC/D,MAAK,CAAEA,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,QAAMC,aAAa,GAAG,OAAOD,aAAP,KAAyB,QAA/C;AACA,SAAO;AACNE,IAAAA,GAAG,EAAED,aAAa,GAAGD,aAAH,GAAmBA,aAAnB,aAAmBA,aAAnB,uBAAmBA,aAAa,CAAEE,GAD9C;AAENC,IAAAA,IAAI,EAAEF,aAAa,GAAGD,aAAH,GAAmBA,aAAnB,aAAmBA,aAAnB,uBAAmBA,aAAa,CAAEG;AAF/C,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,cAAT,CAAyBJ,aAAzB,EAA6D;AAAA,MAArBK,YAAqB,uEAAN,GAAM;AACnE,QAAMC,uBAAuB,GAC5BP,8BAA8B,CAAEC,aAAF,CAD/B;;AAEA,MAAK,CAAEM,uBAAP,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,QAAMC,GAAG,GACR,mCAAwBD,uBAAxB,aAAwBA,uBAAxB,uBAAwBA,uBAAuB,CAAEJ,GAAjD,KAA0DG,YAD3D;AAEA,QAAMG,MAAM,GACX,mCAAwBF,uBAAxB,aAAwBA,uBAAxB,uBAAwBA,uBAAuB,CAAEH,IAAjD,KAA2DE,YAD5D;AAGA,SAAOE,GAAG,KAAKC,MAAR,GAAiBD,GAAjB,GAAwB,GAAGA,GAAK,IAAIC,MAAQ,EAAnD;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';\n\n/**\n * Returns a BoxControl object value from a given blockGap style value.\n * The string check is for backwards compatibility before Gutenberg supported\n * split gap values (row and column) and the value was a string n + unit.\n *\n * @param {string? | Object?} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}.\n * @return {Object|null} A value to pass to the BoxControl component.\n */\nexport function getGapBoxControlValueFromStyle( blockGapValue ) {\n\tif ( ! blockGapValue ) {\n\t\treturn null;\n\t}\n\n\tconst isValueString = typeof blockGapValue === 'string';\n\treturn {\n\t\ttop: isValueString ? blockGapValue : blockGapValue?.top,\n\t\tleft: isValueString ? blockGapValue : blockGapValue?.left,\n\t};\n}\n\n/**\n * Returns a CSS value for the `gap` property from a given blockGap style.\n *\n * @param {string? | Object?} blockGapValue A block gap string or axial object value, e.g., '10px' or { top: '10px', left: '10px'}.\n * @param {string?} defaultValue A default gap value.\n * @return {string|null} The concatenated gap value (row and column).\n */\nexport function getGapCSSValue( blockGapValue, defaultValue = '0' ) {\n\tconst blockGapBoxControlValue =\n\t\tgetGapBoxControlValueFromStyle( blockGapValue );\n\tif ( ! blockGapBoxControlValue ) {\n\t\treturn null;\n\t}\n\n\tconst row =\n\t\tgetSpacingPresetCssVar( blockGapBoxControlValue?.top ) || defaultValue;\n\tconst column =\n\t\tgetSpacingPresetCssVar( blockGapBoxControlValue?.left ) || defaultValue;\n\n\treturn row === column ? row : `${ row } ${ column }`;\n}\n"]}
@@ -92,6 +92,8 @@ require("./color");
92
92
 
93
93
  require("./duotone");
94
94
 
95
+ require("./font-family");
96
+
95
97
  require("./font-size");
96
98
 
97
99
  require("./border");
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './lock';\nimport './anchor';\nimport './aria-label';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './settings';\nimport './color';\nimport './duotone';\nimport './font-size';\nimport './border';\nimport './position';\nimport './layout';\nimport './content-lock-ui';\nimport './metadata';\nimport './metadata-name';\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './lock';\nimport './anchor';\nimport './aria-label';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './settings';\nimport './color';\nimport './duotone';\nimport './font-family';\nimport './font-size';\nimport './border';\nimport './position';\nimport './layout';\nimport './content-lock-ui';\nimport './metadata';\nimport './metadata-name';\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\n"]}
@@ -158,6 +158,7 @@ function useLayoutStyles() {
158
158
 
159
159
  function LayoutPanel(_ref) {
160
160
  let {
161
+ clientId,
161
162
  setAttributes,
162
163
  attributes,
163
164
  name: blockName
@@ -166,12 +167,19 @@ function LayoutPanel(_ref) {
166
167
  layout
167
168
  } = attributes;
168
169
  const defaultThemeLayout = (0, _useSetting.default)('layout');
169
- const themeSupportsLayout = (0, _data.useSelect)(select => {
170
+ const {
171
+ themeSupportsLayout,
172
+ isContentLocked
173
+ } = (0, _data.useSelect)(select => {
170
174
  const {
171
- getSettings
175
+ getSettings,
176
+ __unstableGetContentLockingParent
172
177
  } = select(_store.store);
173
- return getSettings().supportsLayout;
174
- }, []);
178
+ return {
179
+ themeSupportsLayout: getSettings().supportsLayout,
180
+ isContentLocked: __unstableGetContentLockingParent(clientId)
181
+ };
182
+ }, [clientId]);
175
183
  const layoutBlockSupport = (0, _blocks.getBlockSupport)(blockName, layoutBlockSupportKey, {});
176
184
  const {
177
185
  allowSwitching,
@@ -222,6 +230,7 @@ function LayoutPanel(_ref) {
222
230
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components2.InspectorControls, null, (0, _element.createElement)(_components.PanelBody, {
223
231
  title: (0, _i18n.__)('Layout')
224
232
  }, showInheritToggle && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.ToggleControl, {
233
+ __nextHasNoMarginBottom: true,
225
234
  className: "block-editor-hooks__toggle-control",
226
235
  label: (0, _i18n.__)('Inner blocks use content width'),
227
236
  checked: (layoutType === null || layoutType === void 0 ? void 0 : layoutType.name) === 'constrained' || hasContentSizeOrLegacySettings,
@@ -242,7 +251,7 @@ function LayoutPanel(_ref) {
242
251
  layout: usedLayout,
243
252
  onChange: onChangeLayout,
244
253
  layoutBlockSupport: layoutBlockSupport
245
- }))), !inherit && layoutType && (0, _element.createElement)(layoutType.toolBarControls, {
254
+ }))), !inherit && !isContentLocked && layoutType && (0, _element.createElement)(layoutType.toolBarControls, {
246
255
  layout: usedLayout,
247
256
  onChange: onChangeLayout,
248
257
  layoutBlockSupport: layoutBlockSupport
@@ -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","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,GAAG,yBAAY,QAAZ,KAA0B,EAAvD;AAEA,QAAM;AAAEC,IAAAA,UAAU,GAAG,EAAf;AAAmBC,IAAAA;AAAnB,MAA4BT,KAAlC;AACA,QAAM;AAAEU,IAAAA;AAAF,MAAaF,UAAnB;AAEA,QAAM;AAAEG,IAAAA,OAAO,EAAEC;AAAX,MACL,6BAAiBH,IAAjB,EAAuBX,qBAAvB,KAAkD,EADnD;AAEA,QAAMe,UAAU,GACfH,MAAM,SAAN,IAAAA,MAAM,WAAN,IAAAA,MAAM,CAAEI,OAAR,IAAmBJ,MAAnB,aAAmBA,MAAnB,eAAmBA,MAAM,CAAEK,WAA3B,IAA0CL,MAA1C,aAA0CA,MAA1C,eAA0CA,MAAM,CAAEM,QAAlD,GACG,EAAE,GAAGN,MAAL;AAAaO,IAAAA,IAAI,EAAE;AAAnB,GADH,GAEGP,MAAM,IAAIE,kBAAV,IAAgC,EAHpC;AAKA,QAAMM,gBAAgB,GAA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;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"]}
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","clientId","setAttributes","defaultThemeLayout","themeSupportsLayout","isContentLocked","__unstableGetContentLockingParent","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"],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AC,CAAEzC,GAFF,IAGD,2BAAc,2CAASA,GAAT,CAAd,EAAsCyC,OAAtC,CAJF,EAKC,4BAAC,cAAD,6BAAqBR,KAArB;AAA6B,IAAA,SAAS,EAAG5C;AAAzC,KALD,CADD;AASA,CA7CmC,CAA9B;;AAgDP,sBACC,0BADD,EAEC,0BAFD,EAGCwC,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( {\n\tclientId,\n\tsetAttributes,\n\tattributes,\n\tname: blockName,\n} ) {\n\tconst { layout } = attributes;\n\tconst defaultThemeLayout = useSetting( 'layout' );\n\tconst { themeSupportsLayout, isContentLocked } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, __unstableGetContentLockingParent } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t\t\tisContentLocked: __unstableGetContentLockingParent( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\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\t__nextHasNoMarginBottom\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 && ! isContentLocked && 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"]}
@@ -7,8 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.LINE_HEIGHT_SUPPORT_KEY = void 0;
9
9
  exports.LineHeightEdit = LineHeightEdit;
10
- exports.hasLineHeightValue = hasLineHeightValue;
11
- exports.resetLineHeight = resetLineHeight;
12
10
  exports.useIsLineHeightDisabled = useIsLineHeightDisabled;
13
11
 
14
12
  var _element = require("@wordpress/element");
@@ -83,44 +81,4 @@ function useIsLineHeightDisabled() {
83
81
  const isDisabled = !(0, _useSetting.default)('typography.lineHeight');
84
82
  return !(0, _blocks.hasBlockSupport)(blockName, LINE_HEIGHT_SUPPORT_KEY) || isDisabled;
85
83
  }
86
- /**
87
- * Checks if there is a current value set for the line height block support.
88
- *
89
- * @param {Object} props Block props.
90
- * @return {boolean} Whether or not the block has a line height value set.
91
- */
92
-
93
-
94
- function hasLineHeightValue(props) {
95
- var _props$attributes$sty, _props$attributes$sty2;
96
-
97
- return !!((_props$attributes$sty = props.attributes.style) !== null && _props$attributes$sty !== void 0 && (_props$attributes$sty2 = _props$attributes$sty.typography) !== null && _props$attributes$sty2 !== void 0 && _props$attributes$sty2.lineHeight);
98
- }
99
- /**
100
- * Resets the line height block support attribute. This can be used when
101
- * disabling the line height support controls for a block via a progressive
102
- * discovery panel.
103
- *
104
- * @param {Object} props Block props.
105
- * @param {Object} props.attributes Block's attributes.
106
- * @param {Object} props.setAttributes Function to set block's attributes.
107
- */
108
-
109
-
110
- function resetLineHeight(_ref) {
111
- let {
112
- attributes = {},
113
- setAttributes
114
- } = _ref;
115
- const {
116
- style
117
- } = attributes;
118
- setAttributes({
119
- style: (0, _utils.cleanEmptyObject)({ ...style,
120
- typography: { ...(style === null || style === void 0 ? void 0 : style.typography),
121
- lineHeight: undefined
122
- }
123
- })
124
- });
125
- }
126
84
  //# sourceMappingURL=line-height.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/line-height.js"],"names":["LINE_HEIGHT_SUPPORT_KEY","LineHeightEdit","props","attributes","style","setAttributes","onChange","newLineHeightValue","newStyle","typography","lineHeight","useIsLineHeightDisabled","name","blockName","isDisabled","hasLineHeightValue","resetLineHeight","undefined"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAKO,MAAMA,uBAAuB,GAAG,uBAAhC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASC,cAAT,CAAyBC,KAAzB,EAAiC;AAAA;;AACvC,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA;AAAF,K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E,QAAM;AAAED,IAAAA;AAAF,MAAYD,UAAlB;AAEAE,EAAAA,aAAa,CAAE;AACdD,IAAAA,KAAK,EAAE,6BAAkB,EACxB,GAAGA,KADqB;AAExBK,MAAAA,UAAU,EAAE,EACX,IAAGL,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEK,UAAV,CADW;AAEXC,QAAAA,UAAU,EAAEO;AAFD;AAFY,KAAlB;AADO,GAAF,CAAb;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport LineHeightControl from '../components/line-height-control';\nimport { cleanEmptyObject } from './utils';\nimport useSetting from '../components/use-setting';\n\nexport const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';\n\n/**\n * Inspector control panel containing the line height related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Line height edit element.\n */\nexport function LineHeightEdit( props ) {\n\tconst {\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tconst onChange = ( newLineHeightValue ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tlineHeight: newLineHeightValue,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( { style: cleanEmptyObject( newStyle ) } );\n\t};\n\treturn (\n\t\t<LineHeightControl\n\t\t\t__unstableInputWidth=\"100%\"\n\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\tvalue={ style?.typography?.lineHeight }\n\t\t\tonChange={ onChange }\n\t\t\tsize=\"__unstable-large\"\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if line-height settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsLineHeightDisabled( { name: blockName } = {} ) {\n\tconst isDisabled = ! useSetting( 'typography.lineHeight' );\n\n\treturn (\n\t\t! hasBlockSupport( blockName, LINE_HEIGHT_SUPPORT_KEY ) || isDisabled\n\t);\n}\n\n/**\n * Checks if there is a current value set for the line height block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a line height value set.\n */\nexport function hasLineHeightValue( props ) {\n\treturn !! props.attributes.style?.typography?.lineHeight;\n}\n\n/**\n * Resets the line height block support attribute. This can be used when\n * disabling the line height support controls for a block via a progressive\n * discovery panel.\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 resetLineHeight( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tlineHeight: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/line-height.js"],"names":["LINE_HEIGHT_SUPPORT_KEY","LineHeightEdit","props","attributes","style","setAttributes","onChange","newLineHeightValue","newStyle","typography","lineHeight","useIsLineHeightDisabled","name","blockName","isDisabled"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAKO,MAAMA,uBAAuB,GAAG,uBAAhC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASC,cAAT,CAAyBC,KAAzB,EAAiC;AAAA;;AACvC,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA;AAAF,KADP;AAELC,IAAAA;AAFK,MAGFH,KAHJ;;AAKA,QAAMI,QAAQ,GAAKC,kBAAF,IAA0B;AAC1C,UAAMC,QAAQ,GAAG,EAChB,GAAGJ,KADa;AAEhBK,MAAAA,UAAU,EAAE,EACX,IAAGL,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEK,UAAV,CADW;AAEXC,QAAAA,UAAU,EAAEH;AAFD;AAFI,KAAjB;AAQAF,IAAAA,aAAa,CAAE;AAAED,MAAAA,KAAK,EAAE,6BAAkBI,QAAlB;AAAT,KAAF,CAAb;AACA,GAVD;;AAWA,SACC,4BAAC,0BAAD;AACC,IAAA,oBAAoB,EAAC,MADtB;AAEC,IAAA,uBAAuB,EAAG,IAF3B;AAGC,IAAA,KAAK,EAAGJ,KAAH,aAAGA,KAAH,4CAAGA,KAAK,CAAEK,UAAV,sDAAG,kBAAmBC,UAH5B;AAIC,IAAA,QAAQ,EAAGJ,QAJZ;AAKC,IAAA,IAAI,EAAC;AALN,IADD;AASA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASK,uBAAT,GAA6D;AAAA,MAA3B;AAAEC,IAAAA,IAAI,EAAEC;AAAR,GAA2B,uEAAL,EAAK;AACnE,QAAMC,UAAU,GAAG,CAAE,yBAAY,uBAAZ,CAArB;AAEA,SACC,CAAE,6BAAiBD,SAAjB,EAA4Bb,uBAA5B,CAAF,IAA2Dc,UAD5D;AAGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport LineHeightControl from '../components/line-height-control';\nimport { cleanEmptyObject } from './utils';\nimport useSetting from '../components/use-setting';\n\nexport const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';\n\n/**\n * Inspector control panel containing the line height related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Line height edit element.\n */\nexport function LineHeightEdit( props ) {\n\tconst {\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tconst onChange = ( newLineHeightValue ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tlineHeight: newLineHeightValue,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( { style: cleanEmptyObject( newStyle ) } );\n\t};\n\treturn (\n\t\t<LineHeightControl\n\t\t\t__unstableInputWidth=\"100%\"\n\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\tvalue={ style?.typography?.lineHeight }\n\t\t\tonChange={ onChange }\n\t\t\tsize=\"__unstable-large\"\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if line-height settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsLineHeightDisabled( { name: blockName } = {} ) {\n\tconst isDisabled = ! useSetting( 'typography.lineHeight' );\n\n\treturn (\n\t\t! hasBlockSupport( blockName, LINE_HEIGHT_SUPPORT_KEY ) || isDisabled\n\t);\n}\n"]}
@@ -5,34 +5,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.MarginEdit = MarginEdit;
9
8
  exports.MarginVisualizer = MarginVisualizer;
10
- exports.hasMarginSupport = hasMarginSupport;
11
- exports.hasMarginValue = hasMarginValue;
12
- exports.resetMargin = resetMargin;
13
- exports.useIsMarginDisabled = useIsMarginDisabled;
14
9
 
15
10
  var _element = require("@wordpress/element");
16
11
 
17
- var _i18n = require("@wordpress/i18n");
18
-
19
- var _blocks = require("@wordpress/blocks");
20
-
21
- var _components = require("@wordpress/components");
22
-
23
12
  var _isShallowEqual = _interopRequireDefault(require("@wordpress/is-shallow-equal"));
24
13
 
25
- var _useSetting = _interopRequireDefault(require("../components/use-setting"));
26
-
27
- var _dimensions = require("./dimensions");
28
-
29
- var _utils = require("./utils");
30
-
31
14
  var _blockPopover = _interopRequireDefault(require("../components/block-popover"));
32
15
 
33
- var _spacingSizesControl = _interopRequireDefault(require("../components/spacing-sizes-control"));
34
-
35
- var _utils2 = require("../components/spacing-sizes-control/utils");
16
+ var _utils = require("../components/spacing-sizes-control/utils");
36
17
 
37
18
  /**
38
19
  * WordPress dependencies
@@ -41,157 +22,20 @@ var _utils2 = require("../components/spacing-sizes-control/utils");
41
22
  /**
42
23
  * Internal dependencies
43
24
  */
44
-
45
- /**
46
- * Determines if there is margin support.
47
- *
48
- * @param {string|Object} blockType Block name or Block Type object.
49
- *
50
- * @return {boolean} Whether there is support.
51
- */
52
- function hasMarginSupport(blockType) {
53
- const support = (0, _blocks.getBlockSupport)(blockType, _dimensions.SPACING_SUPPORT_KEY);
54
- return !!(true === support || support !== null && support !== void 0 && support.margin);
55
- }
56
- /**
57
- * Checks if there is a current value in the margin block support attributes.
58
- *
59
- * @param {Object} props Block props.
60
- * @return {boolean} Whether or not the block has a margin value set.
61
- */
62
-
63
-
64
- function hasMarginValue(props) {
65
- var _props$attributes$sty, _props$attributes$sty2;
66
-
67
- return ((_props$attributes$sty = props.attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : (_props$attributes$sty2 = _props$attributes$sty.spacing) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.margin) !== undefined;
68
- }
69
- /**
70
- * Resets the margin block support attributes. This can be used when disabling
71
- * the margin support controls for a block via a `ToolsPanel`.
72
- *
73
- * @param {Object} props Block props.
74
- * @param {Object} props.attributes Block's attributes.
75
- * @param {Object} props.setAttributes Function to set block's attributes.
76
- */
77
-
78
-
79
- function resetMargin(_ref) {
80
- let {
81
- attributes = {},
82
- setAttributes
83
- } = _ref;
84
- const {
85
- style
86
- } = attributes;
87
- setAttributes({
88
- style: (0, _utils.cleanEmptyObject)({ ...style,
89
- spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing),
90
- margin: undefined
91
- }
92
- })
93
- });
94
- }
95
- /**
96
- * Custom hook that checks if margin settings have been disabled.
97
- *
98
- * @param {string} name The name of the block.
99
- *
100
- * @return {boolean} Whether margin setting is disabled.
101
- */
102
-
103
-
104
- function useIsMarginDisabled() {
105
- let {
106
- name: blockName
107
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
108
- const isDisabled = !(0, _useSetting.default)('spacing.margin');
109
- const isInvalid = !(0, _dimensions.useIsDimensionsSupportValid)(blockName, 'margin');
110
- return !hasMarginSupport(blockName) || isDisabled || isInvalid;
111
- }
112
- /**
113
- * Inspector control panel containing the margin related configuration
114
- *
115
- * @param {Object} props Block props.
116
- *
117
- * @return {WPElement} Margin edit element.
118
- */
119
-
120
-
121
- function MarginEdit(props) {
122
- var _style$spacing, _style$spacing2;
123
-
124
- const {
125
- name: blockName,
126
- attributes: {
127
- style
128
- },
129
- setAttributes,
130
- onMouseOver,
131
- onMouseOut
132
- } = props;
133
- const spacingSizes = (0, _useSetting.default)('spacing.spacingSizes');
134
- const units = (0, _components.__experimentalUseCustomUnits)({
135
- availableUnits: (0, _useSetting.default)('spacing.units') || ['%', 'px', 'em', 'rem', 'vw']
136
- });
137
- const sides = (0, _dimensions.useCustomSides)(blockName, 'margin');
138
- const splitOnAxis = sides && sides.some(side => _dimensions.AXIAL_SIDES.includes(side));
139
-
140
- if (useIsMarginDisabled(props)) {
141
- return null;
142
- }
143
-
144
- const onChange = next => {
145
- const newStyle = { ...style,
146
- spacing: { ...(style === null || style === void 0 ? void 0 : style.spacing),
147
- margin: next
148
- }
149
- };
150
- setAttributes({
151
- style: (0, _utils.cleanEmptyObject)(newStyle)
152
- });
153
- };
154
-
155
- return _element.Platform.select({
156
- web: (0, _element.createElement)(_element.Fragment, null, (!spacingSizes || (spacingSizes === null || spacingSizes === void 0 ? void 0 : spacingSizes.length) === 0) && (0, _element.createElement)(_components.__experimentalBoxControl, {
157
- values: style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.margin,
158
- onChange: onChange,
159
- label: (0, _i18n.__)('Margin'),
160
- sides: sides,
161
- units: units,
162
- allowReset: false,
163
- splitOnAxis: splitOnAxis,
164
- onMouseOver: onMouseOver,
165
- onMouseOut: onMouseOut
166
- }), (spacingSizes === null || spacingSizes === void 0 ? void 0 : spacingSizes.length) > 0 && (0, _element.createElement)(_spacingSizesControl.default, {
167
- values: style === null || style === void 0 ? void 0 : (_style$spacing2 = style.spacing) === null || _style$spacing2 === void 0 ? void 0 : _style$spacing2.margin,
168
- onChange: onChange,
169
- label: (0, _i18n.__)('Margin'),
170
- sides: sides,
171
- units: units,
172
- allowReset: false,
173
- splitOnAxis: false,
174
- onMouseOver: onMouseOver,
175
- onMouseOut: onMouseOut
176
- })),
177
- native: null
178
- });
179
- }
180
-
181
- function MarginVisualizer(_ref2) {
25
+ function MarginVisualizer(_ref) {
182
26
  var _attributes$style, _attributes$style$spa;
183
27
 
184
28
  let {
185
29
  clientId,
186
30
  attributes,
187
31
  forceShow
188
- } = _ref2;
32
+ } = _ref;
189
33
  const margin = attributes === null || attributes === void 0 ? void 0 : (_attributes$style = attributes.style) === null || _attributes$style === void 0 ? void 0 : (_attributes$style$spa = _attributes$style.spacing) === null || _attributes$style$spa === void 0 ? void 0 : _attributes$style$spa.margin;
190
34
  const style = (0, _element.useMemo)(() => {
191
- const marginTop = margin !== null && margin !== void 0 && margin.top ? (0, _utils2.getSpacingPresetCssVar)(margin === null || margin === void 0 ? void 0 : margin.top) : 0;
192
- const marginRight = margin !== null && margin !== void 0 && margin.right ? (0, _utils2.getSpacingPresetCssVar)(margin === null || margin === void 0 ? void 0 : margin.right) : 0;
193
- const marginBottom = margin !== null && margin !== void 0 && margin.bottom ? (0, _utils2.getSpacingPresetCssVar)(margin === null || margin === void 0 ? void 0 : margin.bottom) : 0;
194
- const marginLeft = margin !== null && margin !== void 0 && margin.left ? (0, _utils2.getSpacingPresetCssVar)(margin === null || margin === void 0 ? void 0 : margin.left) : 0;
35
+ const marginTop = margin !== null && margin !== void 0 && margin.top ? (0, _utils.getSpacingPresetCssVar)(margin === null || margin === void 0 ? void 0 : margin.top) : 0;
36
+ const marginRight = margin !== null && margin !== void 0 && margin.right ? (0, _utils.getSpacingPresetCssVar)(margin === null || margin === void 0 ? void 0 : margin.right) : 0;
37
+ const marginBottom = margin !== null && margin !== void 0 && margin.bottom ? (0, _utils.getSpacingPresetCssVar)(margin === null || margin === void 0 ? void 0 : margin.bottom) : 0;
38
+ const marginLeft = margin !== null && margin !== void 0 && margin.left ? (0, _utils.getSpacingPresetCssVar)(margin === null || margin === void 0 ? void 0 : margin.left) : 0;
195
39
  return {
196
40
  borderTopWidth: marginTop,
197
41
  borderRightWidth: marginRight,
@@ -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,SAASC,WAAT,OAA2D;AAAA,MAArC;AAAEJ,IAAAA,UAAU,GAAG,EAAf;AAAmBK,IAAA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ZA,MAAAA,WAAW,CAAE,KAAF,CAAX;AACAG,MAAAA,UAAU;AACV,KAHD;AAIA,GAdD,EAcG,CAAErD,MAAF,EAAUoC,SAAV,CAdH;;AAgBA,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,qBAAqB,EAAC,eAJvB;AAKC,IAAA,KAAK,EAAG;AALT,KAOC;AAAK,IAAA,SAAS,EAAC,kCAAf;AAAkD,IAAA,KAAK,EAAGI;AAA1D,IAPD,CADD;AAWA","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\t__unstablePopoverSlot=\"block-toolbar\"\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":["MarginVisualizer","clientId","attributes","forceShow","margin","style","spacing","marginTop","top","marginRight","right","marginBottom","bottom","marginLeft","left","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","isActive","setIsActive","valueRef","timeoutRef","clearTimer","current","window","clearTimeout","setTimeout"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIO,SAASA,gBAAT,OAAiE;AAAA;;AAAA,MAAtC;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,UAAZ;AAAwBC,IAAAA;AAAxB,GAAsC;AACvE,QAAMC,MAAM,GAAGF,UAAH,aAAGA,UAAH,4CAAGA,UAAU,CAAEG,KAAf,+EAAG,kBAAmBC,OAAtB,0DAAG,sBAA4BF,MAA3C;AAEA,QAAMC,KAAK,GAAG,sBAAS,MAAM;AAC5B,UAAME,SAAS,GAAGH,MAAM,SAAN,IAAAA,MAAM,WAAN,IAAAA,MAAM,CAAEI,GAAR,GACf,mCAAwBJ,MAAxB,aAAwBA,MAAxB,uBAAwBA,MAAM,CAAEI,GAAhC,CADe,GAEf,CAFH;AAGA,UAAMC,WAAW,GAAGL,MAAM,SAAN,IAAAA,MAAM,WAAN,IAAAA,MAAM,CAAEM,KAAR,GACjB,mCAAwBN,MAAxB,aAAwBA,MAAxB,uBAAwBA,MAAM,CAAEM,KAAhC,CADiB,GAEjB,CAFH;AAGA,UAAMC,YAAY,GAAGP,MAAM,SAAN,IAAAA,MAAM,WAAN,IAAAA,MAAM,CAAEQ,MAAR,GAClB,mCAAwBR,MAAxB,aAAwBA,MAAxB,uBAAwBA,MAAM,CAAEQ,MAAhC,CADkB,GAElB,CAFH;AAGA,UAAMC,UAAU,GAAGT,MAAM,SAAN,IAAAA,MAAM,WAAN,IAAAA,MAAM,CAAEU,IAAR,GAChB,mCAAwBV,MAAxB,aAAwBA,MAAxB,uBAAwBA,MAAM,CAAEU,IAAhC,CADgB,GAEhB,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AIA,GAdD,EAcG,CAAEnB,MAAF,EAAUD,SAAV,CAdH;;AAgBA,MAAK,CAAEgB,QAAF,IAAc,CAAEhB,SAArB,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,qBAAD;AACC,IAAA,QAAQ,EAAGF,QADZ;AAEC,IAAA,qBAAqB,MAFtB;AAGC,IAAA,qBAAqB,EAAGG,MAHzB;AAIC,IAAA,qBAAqB,EAAC,eAJvB;AAKC,IAAA,KAAK,EAAG;AALT,KAOC;AAAK,IAAA,SAAS,EAAC,kCAAf;AAAkD,IAAA,KAAK,EAAGC;AAA1D,IAPD,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useRef, useState, useEffect } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\n\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../components/block-popover';\nimport { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';\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\t__unstablePopoverSlot=\"block-toolbar\"\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"]}