@wordpress/block-editor 9.7.0 → 9.8.1-next.957ca95e4c.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 (396) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-alignment-control/use-available-alignments.js +1 -1
  3. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  4. package/build/components/block-edit-visually-button/index.js +46 -0
  5. package/build/components/block-edit-visually-button/index.js.map +1 -0
  6. package/build/components/block-list/block-list-compact.native.js +73 -0
  7. package/build/components/block-list/block-list-compact.native.js.map +1 -0
  8. package/build/components/block-list/use-block-props/use-focus-first-element.js +1 -1
  9. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  10. package/build/components/block-popover/inbetween.js +4 -2
  11. package/build/components/block-popover/inbetween.js.map +1 -1
  12. package/build/components/block-popover/index.js +11 -7
  13. package/build/components/block-popover/index.js.map +1 -1
  14. package/build/components/block-settings-menu/index.js +2 -6
  15. package/build/components/block-settings-menu/index.js.map +1 -1
  16. package/build/components/block-switcher/index.js +10 -16
  17. package/build/components/block-switcher/index.js.map +1 -1
  18. package/build/components/block-toolbar/index.js +5 -1
  19. package/build/components/block-toolbar/index.js.map +1 -1
  20. package/build/components/block-tools/selected-block-popover.js +10 -2
  21. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  22. package/build/components/block-tools/use-block-toolbar-popover-props.js +126 -0
  23. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -0
  24. package/build/components/border-radius-control/all-input-control.js +31 -3
  25. package/build/components/border-radius-control/all-input-control.js.map +1 -1
  26. package/build/components/border-radius-control/index.js +20 -6
  27. package/build/components/border-radius-control/index.js.map +1 -1
  28. package/build/components/border-radius-control/input-controls.js +21 -6
  29. package/build/components/border-radius-control/input-controls.js.map +1 -1
  30. package/build/components/border-radius-control/utils.js +13 -16
  31. package/build/components/border-radius-control/utils.js.map +1 -1
  32. package/build/components/colors/with-colors.js +17 -4
  33. package/build/components/colors/with-colors.js.map +1 -1
  34. package/build/components/colors-gradients/control.js +1 -0
  35. package/build/components/colors-gradients/control.js.map +1 -1
  36. package/build/components/copy-handler/index.js +6 -0
  37. package/build/components/copy-handler/index.js.map +1 -1
  38. package/build/components/date-format-picker/index.js +2 -7
  39. package/build/components/date-format-picker/index.js.map +1 -1
  40. package/build/components/duotone/components.js +5 -5
  41. package/build/components/duotone/components.js.map +1 -1
  42. package/build/components/font-family/index.js +1 -1
  43. package/build/components/font-family/index.js.map +1 -1
  44. package/build/components/font-sizes/with-font-sizes.js +17 -4
  45. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  46. package/build/components/index.js +9 -0
  47. package/build/components/index.js.map +1 -1
  48. package/build/components/inner-blocks/index.native.js +6 -2
  49. package/build/components/inner-blocks/index.native.js.map +1 -1
  50. package/build/components/inserter/search-items.js +22 -4
  51. package/build/components/inserter/search-items.js.map +1 -1
  52. package/build/components/link-control/link-preview.js +0 -1
  53. package/build/components/link-control/link-preview.js.map +1 -1
  54. package/build/components/list-view/block-select-button.js +5 -2
  55. package/build/components/list-view/block-select-button.js.map +1 -1
  56. package/build/components/list-view/use-block-selection.js +1 -7
  57. package/build/components/list-view/use-block-selection.js.map +1 -1
  58. package/build/components/rich-text/index.js +10 -0
  59. package/build/components/rich-text/index.js.map +1 -1
  60. package/build/components/rich-text/use-enter.js +0 -4
  61. package/build/components/rich-text/use-enter.js.map +1 -1
  62. package/build/components/rich-text/use-format-types.js +8 -11
  63. package/build/components/rich-text/use-format-types.js.map +1 -1
  64. package/build/components/spacing-sizes-control/all-input-control.js +53 -0
  65. package/build/components/spacing-sizes-control/all-input-control.js.map +1 -0
  66. package/build/components/spacing-sizes-control/axial-input-controls.js +69 -0
  67. package/build/components/spacing-sizes-control/axial-input-controls.js.map +1 -0
  68. package/build/components/spacing-sizes-control/index.js +100 -0
  69. package/build/components/spacing-sizes-control/index.js.map +1 -0
  70. package/build/components/spacing-sizes-control/input-controls.js +52 -0
  71. package/build/components/spacing-sizes-control/input-controls.js.map +1 -0
  72. package/build/components/spacing-sizes-control/linked-button.js +38 -0
  73. package/build/components/spacing-sizes-control/linked-button.js.map +1 -0
  74. package/build/components/spacing-sizes-control/spacing-input-control.js +213 -0
  75. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -0
  76. package/build/components/spacing-sizes-control/utils.js +233 -0
  77. package/build/components/spacing-sizes-control/utils.js.map +1 -0
  78. package/build/components/text-decoration-control/index.js +28 -17
  79. package/build/components/text-decoration-control/index.js.map +1 -1
  80. package/build/components/text-transform-control/index.js +21 -14
  81. package/build/components/text-transform-control/index.js.map +1 -1
  82. package/build/components/url-input/index.js +1 -1
  83. package/build/components/url-input/index.js.map +1 -1
  84. package/build/components/writing-flow/index.js +2 -0
  85. package/build/components/writing-flow/index.js.map +1 -1
  86. package/build/components/writing-flow/use-multi-selection.js +4 -2
  87. package/build/components/writing-flow/use-multi-selection.js.map +1 -1
  88. package/build/components/writing-flow/use-select-all.js +7 -10
  89. package/build/components/writing-flow/use-select-all.js.map +1 -1
  90. package/build/components/writing-flow/use-selection-observer.js +10 -2
  91. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  92. package/build/hooks/align.js +3 -1
  93. package/build/hooks/align.js.map +1 -1
  94. package/build/hooks/anchor.js +3 -7
  95. package/build/hooks/anchor.js.map +1 -1
  96. package/build/hooks/border-radius.js +2 -7
  97. package/build/hooks/border-radius.js.map +1 -1
  98. package/build/hooks/border.js +2 -2
  99. package/build/hooks/border.js.map +1 -1
  100. package/build/hooks/color.js +4 -1
  101. package/build/hooks/color.js.map +1 -1
  102. package/build/hooks/dimensions.js +15 -0
  103. package/build/hooks/dimensions.js.map +1 -1
  104. package/build/hooks/duotone.js +4 -4
  105. package/build/hooks/duotone.js.map +1 -1
  106. package/build/hooks/font-appearance.js +2 -1
  107. package/build/hooks/font-appearance.js.map +1 -1
  108. package/build/hooks/font-family.js +3 -1
  109. package/build/hooks/font-family.js.map +1 -1
  110. package/build/hooks/font-size.js +3 -1
  111. package/build/hooks/font-size.js.map +1 -1
  112. package/build/hooks/gap.js +25 -6
  113. package/build/hooks/gap.js.map +1 -1
  114. package/build/hooks/generated-class-name.js +1 -7
  115. package/build/hooks/generated-class-name.js.map +1 -1
  116. package/build/hooks/layout.js +23 -13
  117. package/build/hooks/layout.js.map +1 -1
  118. package/build/hooks/letter-spacing.js +2 -1
  119. package/build/hooks/letter-spacing.js.map +1 -1
  120. package/build/hooks/line-height.js +2 -1
  121. package/build/hooks/line-height.js.map +1 -1
  122. package/build/hooks/lock.js +3 -7
  123. package/build/hooks/lock.js.map +1 -1
  124. package/build/hooks/margin.js +28 -12
  125. package/build/hooks/margin.js.map +1 -1
  126. package/build/hooks/padding.js +19 -8
  127. package/build/hooks/padding.js.map +1 -1
  128. package/build/hooks/style.js +4 -50
  129. package/build/hooks/style.js.map +1 -1
  130. package/build/hooks/text-decoration.js +2 -1
  131. package/build/hooks/text-decoration.js.map +1 -1
  132. package/build/hooks/text-transform.js +2 -1
  133. package/build/hooks/text-transform.js.map +1 -1
  134. package/build/layouts/constrained.js +225 -0
  135. package/build/layouts/constrained.js.map +1 -0
  136. package/build/layouts/flex.js +1 -1
  137. package/build/layouts/flex.js.map +1 -1
  138. package/build/layouts/flow.js +18 -152
  139. package/build/layouts/flow.js.map +1 -1
  140. package/build/layouts/index.js +3 -1
  141. package/build/layouts/index.js.map +1 -1
  142. package/build/layouts/utils.js +43 -0
  143. package/build/layouts/utils.js.map +1 -1
  144. package/build/store/actions.js +25 -3
  145. package/build/store/actions.js.map +1 -1
  146. package/build/store/selectors.js +4 -6
  147. package/build/store/selectors.js.map +1 -1
  148. package/build-module/components/block-alignment-control/use-available-alignments.js +1 -1
  149. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  150. package/build-module/components/block-edit-visually-button/index.js +35 -0
  151. package/build-module/components/block-edit-visually-button/index.js.map +1 -0
  152. package/build-module/components/block-list/block-list-compact.native.js +58 -0
  153. package/build-module/components/block-list/block-list-compact.native.js.map +1 -0
  154. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +1 -1
  155. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  156. package/build-module/components/block-popover/inbetween.js +4 -2
  157. package/build-module/components/block-popover/inbetween.js.map +1 -1
  158. package/build-module/components/block-popover/index.js +9 -7
  159. package/build-module/components/block-popover/index.js.map +1 -1
  160. package/build-module/components/block-settings-menu/index.js +3 -6
  161. package/build-module/components/block-settings-menu/index.js.map +1 -1
  162. package/build-module/components/block-switcher/index.js +10 -16
  163. package/build-module/components/block-switcher/index.js.map +1 -1
  164. package/build-module/components/block-toolbar/index.js +4 -1
  165. package/build-module/components/block-toolbar/index.js.map +1 -1
  166. package/build-module/components/block-tools/selected-block-popover.js +8 -2
  167. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  168. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +114 -0
  169. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -0
  170. package/build-module/components/border-radius-control/all-input-control.js +32 -4
  171. package/build-module/components/border-radius-control/all-input-control.js.map +1 -1
  172. package/build-module/components/border-radius-control/index.js +20 -6
  173. package/build-module/components/border-radius-control/index.js.map +1 -1
  174. package/build-module/components/border-radius-control/input-controls.js +22 -7
  175. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  176. package/build-module/components/border-radius-control/utils.js +13 -16
  177. package/build-module/components/border-radius-control/utils.js.map +1 -1
  178. package/build-module/components/colors/with-colors.js +16 -3
  179. package/build-module/components/colors/with-colors.js.map +1 -1
  180. package/build-module/components/colors-gradients/control.js +1 -0
  181. package/build-module/components/colors-gradients/control.js.map +1 -1
  182. package/build-module/components/copy-handler/index.js +7 -1
  183. package/build-module/components/copy-handler/index.js.map +1 -1
  184. package/build-module/components/date-format-picker/index.js +2 -6
  185. package/build-module/components/date-format-picker/index.js.map +1 -1
  186. package/build-module/components/duotone/components.js +5 -5
  187. package/build-module/components/duotone/components.js.map +1 -1
  188. package/build-module/components/font-family/index.js +1 -1
  189. package/build-module/components/font-family/index.js.map +1 -1
  190. package/build-module/components/font-sizes/with-font-sizes.js +16 -3
  191. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  192. package/build-module/components/index.js +1 -0
  193. package/build-module/components/index.js.map +1 -1
  194. package/build-module/components/inner-blocks/index.native.js +5 -2
  195. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  196. package/build-module/components/inserter/search-items.js +19 -5
  197. package/build-module/components/inserter/search-items.js.map +1 -1
  198. package/build-module/components/link-control/link-preview.js +0 -1
  199. package/build-module/components/link-control/link-preview.js.map +1 -1
  200. package/build-module/components/list-view/block-select-button.js +5 -2
  201. package/build-module/components/list-view/block-select-button.js.map +1 -1
  202. package/build-module/components/list-view/use-block-selection.js +1 -6
  203. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  204. package/build-module/components/rich-text/index.js +10 -0
  205. package/build-module/components/rich-text/index.js.map +1 -1
  206. package/build-module/components/rich-text/use-enter.js +0 -4
  207. package/build-module/components/rich-text/use-enter.js.map +1 -1
  208. package/build-module/components/rich-text/use-format-types.js +8 -10
  209. package/build-module/components/rich-text/use-format-types.js.map +1 -1
  210. package/build-module/components/spacing-sizes-control/all-input-control.js +41 -0
  211. package/build-module/components/spacing-sizes-control/all-input-control.js.map +1 -0
  212. package/build-module/components/spacing-sizes-control/axial-input-controls.js +57 -0
  213. package/build-module/components/spacing-sizes-control/axial-input-controls.js.map +1 -0
  214. package/build-module/components/spacing-sizes-control/index.js +83 -0
  215. package/build-module/components/spacing-sizes-control/index.js.map +1 -0
  216. package/build-module/components/spacing-sizes-control/input-controls.js +41 -0
  217. package/build-module/components/spacing-sizes-control/input-controls.js.map +1 -0
  218. package/build-module/components/spacing-sizes-control/linked-button.js +28 -0
  219. package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -0
  220. package/build-module/components/spacing-sizes-control/spacing-input-control.js +197 -0
  221. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -0
  222. package/build-module/components/spacing-sizes-control/utils.js +203 -0
  223. package/build-module/components/spacing-sizes-control/utils.js.map +1 -0
  224. package/build-module/components/text-decoration-control/index.js +25 -18
  225. package/build-module/components/text-decoration-control/index.js.map +1 -1
  226. package/build-module/components/text-transform-control/index.js +19 -15
  227. package/build-module/components/text-transform-control/index.js.map +1 -1
  228. package/build-module/components/url-input/index.js +1 -1
  229. package/build-module/components/url-input/index.js.map +1 -1
  230. package/build-module/components/writing-flow/index.js +2 -0
  231. package/build-module/components/writing-flow/index.js.map +1 -1
  232. package/build-module/components/writing-flow/use-multi-selection.js +4 -2
  233. package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
  234. package/build-module/components/writing-flow/use-select-all.js +7 -10
  235. package/build-module/components/writing-flow/use-select-all.js.map +1 -1
  236. package/build-module/components/writing-flow/use-selection-observer.js +10 -2
  237. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  238. package/build-module/hooks/align.js +4 -2
  239. package/build-module/hooks/align.js.map +1 -1
  240. package/build-module/hooks/anchor.js +3 -6
  241. package/build-module/hooks/anchor.js.map +1 -1
  242. package/build-module/hooks/border-radius.js +2 -7
  243. package/build-module/hooks/border-radius.js.map +1 -1
  244. package/build-module/hooks/border.js +2 -2
  245. package/build-module/hooks/border.js.map +1 -1
  246. package/build-module/hooks/color.js +4 -1
  247. package/build-module/hooks/color.js.map +1 -1
  248. package/build-module/hooks/dimensions.js +13 -0
  249. package/build-module/hooks/dimensions.js.map +1 -1
  250. package/build-module/hooks/duotone.js +4 -4
  251. package/build-module/hooks/duotone.js.map +1 -1
  252. package/build-module/hooks/font-appearance.js +2 -1
  253. package/build-module/hooks/font-appearance.js.map +1 -1
  254. package/build-module/hooks/font-family.js +3 -1
  255. package/build-module/hooks/font-family.js.map +1 -1
  256. package/build-module/hooks/font-size.js +3 -1
  257. package/build-module/hooks/font-size.js.map +1 -1
  258. package/build-module/hooks/gap.js +21 -4
  259. package/build-module/hooks/gap.js.map +1 -1
  260. package/build-module/hooks/generated-class-name.js +1 -6
  261. package/build-module/hooks/generated-class-name.js.map +1 -1
  262. package/build-module/hooks/layout.js +24 -14
  263. package/build-module/hooks/layout.js.map +1 -1
  264. package/build-module/hooks/letter-spacing.js +2 -1
  265. package/build-module/hooks/letter-spacing.js.map +1 -1
  266. package/build-module/hooks/line-height.js +2 -1
  267. package/build-module/hooks/line-height.js.map +1 -1
  268. package/build-module/hooks/lock.js +3 -6
  269. package/build-module/hooks/lock.js.map +1 -1
  270. package/build-module/hooks/margin.js +26 -12
  271. package/build-module/hooks/margin.js.map +1 -1
  272. package/build-module/hooks/padding.js +17 -8
  273. package/build-module/hooks/padding.js.map +1 -1
  274. package/build-module/hooks/style.js +7 -53
  275. package/build-module/hooks/style.js.map +1 -1
  276. package/build-module/hooks/text-decoration.js +2 -1
  277. package/build-module/hooks/text-decoration.js.map +1 -1
  278. package/build-module/hooks/text-transform.js +2 -1
  279. package/build-module/hooks/text-transform.js.map +1 -1
  280. package/build-module/layouts/constrained.js +207 -0
  281. package/build-module/layouts/constrained.js.map +1 -0
  282. package/build-module/layouts/flex.js +1 -1
  283. package/build-module/layouts/flex.js.map +1 -1
  284. package/build-module/layouts/flow.js +20 -147
  285. package/build-module/layouts/flow.js.map +1 -1
  286. package/build-module/layouts/index.js +2 -1
  287. package/build-module/layouts/index.js.map +1 -1
  288. package/build-module/layouts/utils.js +40 -0
  289. package/build-module/layouts/utils.js.map +1 -1
  290. package/build-module/store/actions.js +25 -3
  291. package/build-module/store/actions.js.map +1 -1
  292. package/build-module/store/selectors.js +5 -7
  293. package/build-module/store/selectors.js.map +1 -1
  294. package/build-style/style-rtl.css +157 -61
  295. package/build-style/style.css +157 -61
  296. package/package.json +30 -28
  297. package/src/components/block-alignment-control/use-available-alignments.js +1 -1
  298. package/src/components/block-edit-visually-button/index.js +39 -0
  299. package/src/components/block-list/block-list-compact.native.js +62 -0
  300. package/src/components/block-list/style.scss +29 -6
  301. package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -1
  302. package/src/components/block-popover/inbetween.js +4 -1
  303. package/src/components/block-popover/index.js +22 -15
  304. package/src/components/block-settings-menu/index.js +11 -15
  305. package/src/components/block-switcher/index.js +9 -13
  306. package/src/components/block-switcher/test/index.js +2 -2
  307. package/src/components/block-toolbar/index.js +2 -0
  308. package/src/components/block-tools/selected-block-popover.js +7 -0
  309. package/src/components/block-tools/use-block-toolbar-popover-props.js +123 -0
  310. package/src/components/border-radius-control/all-input-control.js +41 -4
  311. package/src/components/border-radius-control/index.js +25 -5
  312. package/src/components/border-radius-control/input-controls.js +40 -13
  313. package/src/components/border-radius-control/test/utils.js +22 -60
  314. package/src/components/border-radius-control/utils.js +12 -16
  315. package/src/components/button-block-appender/style.scss +23 -0
  316. package/src/components/colors/with-colors.js +11 -1
  317. package/src/components/colors-gradients/control.js +1 -0
  318. package/src/components/copy-handler/index.js +18 -0
  319. package/src/components/date-format-picker/index.js +12 -14
  320. package/src/components/date-format-picker/style.scss +0 -4
  321. package/src/components/duotone/components.js +5 -5
  322. package/src/components/duotone-control/style.scss +0 -4
  323. package/src/components/font-appearance-control/style.scss +0 -2
  324. package/src/components/font-family/index.js +1 -1
  325. package/src/components/font-sizes/with-font-sizes.js +11 -1
  326. package/src/components/index.js +1 -0
  327. package/src/components/inner-blocks/index.native.js +5 -1
  328. package/src/components/inserter/search-items.js +17 -5
  329. package/src/components/link-control/link-preview.js +0 -1
  330. package/src/components/link-control/test/index.js +540 -893
  331. package/src/components/list-view/block-select-button.js +7 -2
  332. package/src/components/list-view/style.scss +11 -4
  333. package/src/components/list-view/use-block-selection.js +2 -8
  334. package/src/components/media-replace-flow/style.scss +1 -0
  335. package/src/components/rich-text/index.js +9 -0
  336. package/src/components/rich-text/use-enter.js +0 -3
  337. package/src/components/rich-text/use-format-types.js +6 -6
  338. package/src/components/spacing-sizes-control/all-input-control.js +40 -0
  339. package/src/components/spacing-sizes-control/axial-input-controls.js +62 -0
  340. package/src/components/spacing-sizes-control/index.js +91 -0
  341. package/src/components/spacing-sizes-control/input-controls.js +46 -0
  342. package/src/components/spacing-sizes-control/linked-button.js +25 -0
  343. package/src/components/spacing-sizes-control/spacing-input-control.js +285 -0
  344. package/src/components/spacing-sizes-control/style.scss +122 -0
  345. package/src/components/spacing-sizes-control/test/utils.js +182 -0
  346. package/src/components/spacing-sizes-control/utils.js +222 -0
  347. package/src/components/text-decoration-control/index.js +41 -30
  348. package/src/components/text-decoration-control/stories/index.js +37 -0
  349. package/src/components/text-transform-control/index.js +27 -27
  350. package/src/components/text-transform-control/stories/index.js +37 -0
  351. package/src/components/url-input/index.js +1 -1
  352. package/src/components/url-input/style.scss +2 -2
  353. package/src/components/url-popover/style.scss +0 -3
  354. package/src/components/writing-flow/index.js +2 -0
  355. package/src/components/writing-flow/use-multi-selection.js +4 -1
  356. package/src/components/writing-flow/use-select-all.js +10 -13
  357. package/src/components/writing-flow/use-selection-observer.js +10 -2
  358. package/src/hooks/align.js +2 -2
  359. package/src/hooks/anchor.js +1 -6
  360. package/src/hooks/border-radius.js +2 -6
  361. package/src/hooks/border.js +2 -2
  362. package/src/hooks/color.js +13 -3
  363. package/src/hooks/dimensions.js +14 -0
  364. package/src/hooks/duotone.js +4 -4
  365. package/src/hooks/font-appearance.js +1 -0
  366. package/src/hooks/font-family.js +2 -0
  367. package/src/hooks/font-size.js +2 -0
  368. package/src/hooks/gap.js +42 -19
  369. package/src/hooks/generated-class-name.js +6 -9
  370. package/src/hooks/layout.js +47 -16
  371. package/src/hooks/letter-spacing.js +1 -0
  372. package/src/hooks/line-height.js +1 -0
  373. package/src/hooks/lock.js +1 -6
  374. package/src/hooks/margin.js +49 -17
  375. package/src/hooks/padding.js +41 -14
  376. package/src/hooks/style.js +5 -56
  377. package/src/hooks/test/gap.js +16 -0
  378. package/src/hooks/text-decoration.js +1 -0
  379. package/src/hooks/text-transform.js +1 -0
  380. package/src/hooks/typography.scss +0 -7
  381. package/src/layouts/constrained.js +220 -0
  382. package/src/layouts/flex.js +1 -1
  383. package/src/layouts/flow.js +17 -173
  384. package/src/layouts/index.js +2 -1
  385. package/src/layouts/test/constrained.js +21 -0
  386. package/src/layouts/utils.js +34 -0
  387. package/src/store/actions.js +32 -4
  388. package/src/store/selectors.js +5 -4
  389. package/src/style.scss +1 -2
  390. package/build/components/block-settings-menu/block-edit-visually-button.js +0 -70
  391. package/build/components/block-settings-menu/block-edit-visually-button.js.map +0 -1
  392. package/build-module/components/block-settings-menu/block-edit-visually-button.js +0 -56
  393. package/build-module/components/block-settings-menu/block-edit-visually-button.js.map +0 -1
  394. package/src/components/block-settings-menu/block-edit-visually-button.js +0 -52
  395. package/src/components/text-decoration-control/style.scss +0 -18
  396. package/src/components/text-transform-control/style.scss +0 -18
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/text-decoration.js"],"names":["hasBlockSupport","TextDecorationControl","useSetting","cleanEmptyObject","TEXT_DECORATION_SUPPORT_KEY","TextDecorationEdit","props","attributes","style","setAttributes","onChange","newDecoration","typography","textDecoration","useIsTextDecorationDisabled","name","blockName","notSupported","hasTextDecoration","hasTextDecorationValue","resetTextDecoration","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,mBAAhC;AAEA;AACA;AACA;;AACA,OAAOC,qBAAP,MAAkC,uCAAlC;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,gBAAT,QAAiC,SAAjC;AAEA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,2BAA2B,GACvC,yCADM;AAGP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CAA6BC,KAA7B,EAAqC;AAAA;;AAC3C,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA;AAAF,KADP;AAELC,IAAAA;AAFK,MAGFH,KAHJ;;AAKA,WAASI,QAAT,CAAmBC,aAAnB,EAAmC;AAClCF,IAAAA,aAAa,CAAE;AACdD,MA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,uBAAGA,KAAK,CAAEI,UAAV,CADW;AAEXC,QAAAA,cAAc,EAAEQ;AAFL;AAFY,KAAF;AADT,GAAF,CAAb;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport TextDecorationControl from '../components/text-decoration-control';\nimport useSetting from '../components/use-setting';\nimport { cleanEmptyObject } from './utils';\n\n/**\n * Key within block settings' supports array indicating support for text\n * decorations e.g. settings found in `block.json`.\n */\nexport const TEXT_DECORATION_SUPPORT_KEY =\n\t'typography.__experimentalTextDecoration';\n\n/**\n * Inspector control panel containing the text decoration options.\n *\n * @param {Object} props Block properties.\n *\n * @return {WPElement} Text decoration edit element.\n */\nexport function TextDecorationEdit( props ) {\n\tconst {\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tfunction onChange( newDecoration ) {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\ttypography: {\n\t\t\t\t\t...style?.typography,\n\t\t\t\t\ttextDecoration: newDecoration,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t}\n\n\treturn (\n\t\t<TextDecorationControl\n\t\t\tvalue={ style?.typography?.textDecoration }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\n/**\n * Checks if text-decoration settings have been disabled.\n *\n * @param {string} name Name of the block.\n *\n * @return {boolean} Whether or not the setting is disabled.\n */\nexport function useIsTextDecorationDisabled( { name: blockName } = {} ) {\n\tconst notSupported = ! hasBlockSupport(\n\t\tblockName,\n\t\tTEXT_DECORATION_SUPPORT_KEY\n\t);\n\tconst hasTextDecoration = useSetting( 'typography.textDecoration' );\n\n\treturn notSupported || ! hasTextDecoration;\n}\n\n/**\n * Checks if there is a current value set for the text decoration block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a text decoration set.\n */\nexport function hasTextDecorationValue( props ) {\n\treturn !! props.attributes.style?.typography?.textDecoration;\n}\n\n/**\n * Resets the text decoration block support attribute. This can be used when\n * disabling the text decoration 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 resetTextDecoration( { 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\ttextDecoration: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/text-decoration.js"],"names":["hasBlockSupport","TextDecorationControl","useSetting","cleanEmptyObject","TEXT_DECORATION_SUPPORT_KEY","TextDecorationEdit","props","attributes","style","setAttributes","onChange","newDecoration","typography","textDecoration","useIsTextDecorationDisabled","name","blockName","notSupported","hasTextDecoration","hasTextDecorationValue","resetTextDecoration","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,mBAAhC;AAEA;AACA;AACA;;AACA,OAAOC,qBAAP,MAAkC,uCAAlC;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,gBAAT,QAAiC,SAAjC;AAEA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,2BAA2B,GACvC,yCADM;AAGP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CAA6BC,KAA7B,EAAqC;AAAA;;AAC3C,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA;AAAF,KADP;AAELC,IAAAA;AAFK,MAGFH,KAHJ;;AAKA,WAASI,QAAT,CAAmBC,aAAnB,EAAmC;AAClCF,IAAAA,aAAa,CAAE;AACdD,MAAAA,KAAK,EAAEL,gBAAgB,CAAE,EACxB,GAAGK,KADqB;AAExBI,QAAAA,UAAU,EAAE,EACX,IAAGJ,KAAH,aAAGA,KAA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F;AADT,GAAF,CAAb;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport TextDecorationControl from '../components/text-decoration-control';\nimport useSetting from '../components/use-setting';\nimport { cleanEmptyObject } from './utils';\n\n/**\n * Key within block settings' supports array indicating support for text\n * decorations e.g. settings found in `block.json`.\n */\nexport const TEXT_DECORATION_SUPPORT_KEY =\n\t'typography.__experimentalTextDecoration';\n\n/**\n * Inspector control panel containing the text decoration options.\n *\n * @param {Object} props Block properties.\n *\n * @return {WPElement} Text decoration edit element.\n */\nexport function TextDecorationEdit( props ) {\n\tconst {\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tfunction onChange( newDecoration ) {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\ttypography: {\n\t\t\t\t\t...style?.typography,\n\t\t\t\t\ttextDecoration: newDecoration,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t}\n\n\treturn (\n\t\t<TextDecorationControl\n\t\t\tvalue={ style?.typography?.textDecoration }\n\t\t\tonChange={ onChange }\n\t\t\tsize=\"__unstable-large\"\n\t\t/>\n\t);\n}\n\n/**\n * Checks if text-decoration settings have been disabled.\n *\n * @param {string} name Name of the block.\n *\n * @return {boolean} Whether or not the setting is disabled.\n */\nexport function useIsTextDecorationDisabled( { name: blockName } = {} ) {\n\tconst notSupported = ! hasBlockSupport(\n\t\tblockName,\n\t\tTEXT_DECORATION_SUPPORT_KEY\n\t);\n\tconst hasTextDecoration = useSetting( 'typography.textDecoration' );\n\n\treturn notSupported || ! hasTextDecoration;\n}\n\n/**\n * Checks if there is a current value set for the text decoration block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a text decoration set.\n */\nexport function hasTextDecorationValue( props ) {\n\treturn !! props.attributes.style?.typography?.textDecoration;\n}\n\n/**\n * Resets the text decoration block support attribute. This can be used when\n * disabling the text decoration 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 resetTextDecoration( { 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\ttextDecoration: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n"]}
@@ -47,7 +47,8 @@ export function TextTransformEdit(props) {
47
47
 
48
48
  return createElement(TextTransformControl, {
49
49
  value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.textTransform,
50
- onChange: onChange
50
+ onChange: onChange,
51
+ size: "__unstable-large"
51
52
  });
52
53
  }
53
54
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/text-transform.js"],"names":["hasBlockSupport","TextTransformControl","useSetting","cleanEmptyObject","TEXT_TRANSFORM_SUPPORT_KEY","TextTransformEdit","props","attributes","style","setAttributes","onChange","newTransform","typography","textTransform","useIsTextTransformDisabled","name","blockName","notSupported","hasTextTransforms","hasTextTransformValue","resetTextTransform","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,mBAAhC;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,sCAAjC;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,gBAAT,QAAiC,SAAjC;AAEA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,0BAA0B,GACtC,wCADM;AAGP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,iBAAT,CAA4BC,KAA5B,EAAoC;AAAA;;AAC1C,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA;AAAF,KADP;AAELC,IAAAA;AAFK,MAGFH,KAHJ;;AAKA,W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AGK,KADqB;AAExBI,MAAAA,UAAU,EAAE,EACX,IAAGJ,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEI,UAAV,CADW;AAEXC,QAAAA,aAAa,EAAEQ;AAFJ;AAFY,KAAF;AADT,GAAF,CAAb;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport TextTransformControl from '../components/text-transform-control';\nimport useSetting from '../components/use-setting';\nimport { cleanEmptyObject } from './utils';\n\n/**\n * Key within block settings' supports array indicating support for text\n * transforms e.g. settings found in `block.json`.\n */\nexport const TEXT_TRANSFORM_SUPPORT_KEY =\n\t'typography.__experimentalTextTransform';\n\n/**\n * Inspector control panel containing the text transform options.\n *\n * @param {Object} props Block properties.\n *\n * @return {WPElement} Text transform edit element.\n */\nexport function TextTransformEdit( props ) {\n\tconst {\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tfunction onChange( newTransform ) {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\ttypography: {\n\t\t\t\t\t...style?.typography,\n\t\t\t\t\ttextTransform: newTransform,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t}\n\n\treturn (\n\t\t<TextTransformControl\n\t\t\tvalue={ style?.typography?.textTransform }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\n/**\n * Checks if text-transform settings have been disabled.\n *\n * @param {string} name Name of the block.\n *\n * @return {boolean} Whether or not the setting is disabled.\n */\nexport function useIsTextTransformDisabled( { name: blockName } = {} ) {\n\tconst notSupported = ! hasBlockSupport(\n\t\tblockName,\n\t\tTEXT_TRANSFORM_SUPPORT_KEY\n\t);\n\tconst hasTextTransforms = useSetting( 'typography.textTransform' );\n\treturn notSupported || ! hasTextTransforms;\n}\n\n/**\n * Checks if there is a current value set for the text transform block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a text transform set.\n */\nexport function hasTextTransformValue( props ) {\n\treturn !! props.attributes.style?.typography?.textTransform;\n}\n\n/**\n * Resets the text transform block support attribute. This can be used when\n * disabling the text transform 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 resetTextTransform( { 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\ttextTransform: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/text-transform.js"],"names":["hasBlockSupport","TextTransformControl","useSetting","cleanEmptyObject","TEXT_TRANSFORM_SUPPORT_KEY","TextTransformEdit","props","attributes","style","setAttributes","onChange","newTransform","typography","textTransform","useIsTextTransformDisabled","name","blockName","notSupported","hasTextTransforms","hasTextTransformValue","resetTextTransform","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,mBAAhC;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,sCAAjC;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,gBAAT,QAAiC,SAAjC;AAEA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,0BAA0B,GACtC,wCADM;AAGP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,iBAAT,CAA4BC,KAA5B,EAAoC;AAAA;;AAC1C,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA;AAAF,KADP;AAELC,IAAAA;AAFK,MAGFH,KAHJ;;AAKA,WAASI,QAAT,CAAmBC,YAAnB,EAAkC;AACjCF,IAAAA,aAAa,CAAE;AACdD,MAAAA,KAAK,EAAEL,gBAAgB,CAAE,EACxB,GAAGK,KADqB;AAExBI,QAAAA,UAA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,QAAAA,aAAa,EAAEQ;AAFJ;AAFY,KAAF;AADT,GAAF,CAAb;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport TextTransformControl from '../components/text-transform-control';\nimport useSetting from '../components/use-setting';\nimport { cleanEmptyObject } from './utils';\n\n/**\n * Key within block settings' supports array indicating support for text\n * transforms e.g. settings found in `block.json`.\n */\nexport const TEXT_TRANSFORM_SUPPORT_KEY =\n\t'typography.__experimentalTextTransform';\n\n/**\n * Inspector control panel containing the text transform options.\n *\n * @param {Object} props Block properties.\n *\n * @return {WPElement} Text transform edit element.\n */\nexport function TextTransformEdit( props ) {\n\tconst {\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tfunction onChange( newTransform ) {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\ttypography: {\n\t\t\t\t\t...style?.typography,\n\t\t\t\t\ttextTransform: newTransform,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t}\n\n\treturn (\n\t\t<TextTransformControl\n\t\t\tvalue={ style?.typography?.textTransform }\n\t\t\tonChange={ onChange }\n\t\t\tsize=\"__unstable-large\"\n\t\t/>\n\t);\n}\n\n/**\n * Checks if text-transform settings have been disabled.\n *\n * @param {string} name Name of the block.\n *\n * @return {boolean} Whether or not the setting is disabled.\n */\nexport function useIsTextTransformDisabled( { name: blockName } = {} ) {\n\tconst notSupported = ! hasBlockSupport(\n\t\tblockName,\n\t\tTEXT_TRANSFORM_SUPPORT_KEY\n\t);\n\tconst hasTextTransforms = useSetting( 'typography.textTransform' );\n\treturn notSupported || ! hasTextTransforms;\n}\n\n/**\n * Checks if there is a current value set for the text transform block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a text transform set.\n */\nexport function hasTextTransformValue( props ) {\n\treturn !! props.attributes.style?.typography?.textTransform;\n}\n\n/**\n * Resets the text transform block support attribute. This can be used when\n * disabling the text transform 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 resetTextTransform( { 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\ttextTransform: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n"]}
@@ -0,0 +1,207 @@
1
+ import { createElement, Fragment } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { Button, __experimentalUseCustomUnits as useCustomUnits, __experimentalUnitControl as UnitControl } from '@wordpress/components';
7
+ import { __ } from '@wordpress/i18n';
8
+ import { Icon, positionCenter, stretchWide } from '@wordpress/icons';
9
+ import { getCSSRules } from '@wordpress/style-engine';
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+
14
+ import useSetting from '../components/use-setting';
15
+ import { appendSelectors, getBlockGapCSS, getAlignmentsInfo } from './utils';
16
+ import { getGapCSSValue } from '../hooks/gap';
17
+ import { shouldSkipSerialization } from '../hooks/utils';
18
+ export default {
19
+ name: 'constrained',
20
+ label: __('Constrained'),
21
+ inspectorControls: function DefaultLayoutInspectorControls(_ref) {
22
+ let {
23
+ layout,
24
+ onChange
25
+ } = _ref;
26
+ const {
27
+ wideSize,
28
+ contentSize
29
+ } = layout;
30
+ const units = useCustomUnits({
31
+ availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw']
32
+ });
33
+ return createElement(Fragment, null, createElement("div", {
34
+ className: "block-editor-hooks__layout-controls"
35
+ }, createElement("div", {
36
+ className: "block-editor-hooks__layout-controls-unit"
37
+ }, createElement(UnitControl, {
38
+ label: __('Content'),
39
+ labelPosition: "top",
40
+ __unstableInputWidth: "80px",
41
+ value: contentSize || wideSize || '',
42
+ onChange: nextWidth => {
43
+ nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth;
44
+ onChange({ ...layout,
45
+ contentSize: nextWidth
46
+ });
47
+ },
48
+ units: units
49
+ }), createElement(Icon, {
50
+ icon: positionCenter
51
+ })), createElement("div", {
52
+ className: "block-editor-hooks__layout-controls-unit"
53
+ }, createElement(UnitControl, {
54
+ label: __('Wide'),
55
+ labelPosition: "top",
56
+ __unstableInputWidth: "80px",
57
+ value: wideSize || contentSize || '',
58
+ onChange: nextWidth => {
59
+ nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth;
60
+ onChange({ ...layout,
61
+ wideSize: nextWidth
62
+ });
63
+ },
64
+ units: units
65
+ }), createElement(Icon, {
66
+ icon: stretchWide
67
+ }))), createElement("div", {
68
+ className: "block-editor-hooks__layout-controls-reset"
69
+ }, createElement(Button, {
70
+ variant: "secondary",
71
+ isSmall: true,
72
+ disabled: !contentSize && !wideSize,
73
+ onClick: () => onChange({
74
+ contentSize: undefined,
75
+ wideSize: undefined,
76
+ inherit: false
77
+ })
78
+ }, __('Reset'))), createElement("p", {
79
+ className: "block-editor-hooks__layout-controls-helptext"
80
+ }, __('Customize the width for all elements that are assigned to the center or wide columns.')));
81
+ },
82
+ toolBarControls: function DefaultLayoutToolbarControls() {
83
+ return null;
84
+ },
85
+ getLayoutStyle: function getLayoutStyle(_ref2) {
86
+ var _style$spacing, _style$spacing2;
87
+
88
+ let {
89
+ selector,
90
+ layout = {},
91
+ style,
92
+ blockName,
93
+ hasBlockGapSupport,
94
+ layoutDefinitions
95
+ } = _ref2;
96
+ const {
97
+ contentSize,
98
+ wideSize
99
+ } = layout;
100
+ const blockGapStyleValue = getGapCSSValue(style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.blockGap); // If a block's block.json skips serialization for spacing or
101
+ // spacing.blockGap, don't apply the user-defined value to the styles.
102
+
103
+ let blockGapValue = '';
104
+
105
+ if (!shouldSkipSerialization(blockName, 'spacing', 'blockGap')) {
106
+ // If an object is provided only use the 'top' value for this kind of gap.
107
+ if (blockGapStyleValue !== null && blockGapStyleValue !== void 0 && blockGapStyleValue.top) {
108
+ blockGapValue = getGapCSSValue(blockGapStyleValue === null || blockGapStyleValue === void 0 ? void 0 : blockGapStyleValue.top);
109
+ } else if (typeof blockGapStyleValue === 'string') {
110
+ blockGapValue = getGapCSSValue(blockGapStyleValue);
111
+ }
112
+ }
113
+
114
+ let output = !!contentSize || !!wideSize ? `
115
+ ${appendSelectors(selector, '> :where(:not(.alignleft):not(.alignright):not(.alignfull))')} {
116
+ max-width: ${contentSize !== null && contentSize !== void 0 ? contentSize : wideSize};
117
+ margin-left: auto !important;
118
+ margin-right: auto !important;
119
+ }
120
+ ${appendSelectors(selector, '> .alignwide')} {
121
+ max-width: ${wideSize !== null && wideSize !== void 0 ? wideSize : contentSize};
122
+ }
123
+ ${appendSelectors(selector, '> .alignfull')} {
124
+ max-width: none;
125
+ }
126
+ ` : ''; // If there is custom padding, add negative margins for alignfull blocks.
127
+
128
+ if (style !== null && style !== void 0 && (_style$spacing2 = style.spacing) !== null && _style$spacing2 !== void 0 && _style$spacing2.padding) {
129
+ // The style object might be storing a preset so we need to make sure we get a usable value.
130
+ const paddingValues = getCSSRules(style);
131
+ paddingValues.forEach(rule => {
132
+ if (rule.key === 'paddingRight') {
133
+ output += `
134
+ ${appendSelectors(selector, '> .alignfull')} {
135
+ margin-right: calc(${rule.value} * -1);
136
+ }
137
+ `;
138
+ } else if (rule.key === 'paddingLeft') {
139
+ output += `
140
+ ${appendSelectors(selector, '> .alignfull')} {
141
+ margin-left: calc(${rule.value} * -1);
142
+ }
143
+ `;
144
+ }
145
+ });
146
+ } // Output blockGap styles based on rules contained in layout definitions in theme.json.
147
+
148
+
149
+ if (hasBlockGapSupport && blockGapValue) {
150
+ output += getBlockGapCSS(selector, layoutDefinitions, 'constrained', blockGapValue);
151
+ }
152
+
153
+ return output;
154
+ },
155
+
156
+ getOrientation() {
157
+ return 'vertical';
158
+ },
159
+
160
+ getAlignments(layout) {
161
+ const alignmentInfo = getAlignmentsInfo(layout);
162
+
163
+ if (layout.alignments !== undefined) {
164
+ if (!layout.alignments.includes('none')) {
165
+ layout.alignments.unshift('none');
166
+ }
167
+
168
+ return layout.alignments.map(alignment => ({
169
+ name: alignment,
170
+ info: alignmentInfo[alignment]
171
+ }));
172
+ }
173
+
174
+ const {
175
+ contentSize,
176
+ wideSize
177
+ } = layout;
178
+ const alignments = [{
179
+ name: 'left'
180
+ }, {
181
+ name: 'center'
182
+ }, {
183
+ name: 'right'
184
+ }];
185
+
186
+ if (contentSize) {
187
+ alignments.unshift({
188
+ name: 'full'
189
+ });
190
+ }
191
+
192
+ if (wideSize) {
193
+ alignments.unshift({
194
+ name: 'wide',
195
+ info: alignmentInfo.wide
196
+ });
197
+ }
198
+
199
+ alignments.unshift({
200
+ name: 'none',
201
+ info: alignmentInfo.none
202
+ });
203
+ return alignments;
204
+ }
205
+
206
+ };
207
+ //# sourceMappingURL=constrained.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/layouts/constrained.js"],"names":["Button","__experimentalUseCustomUnits","useCustomUnits","__experimentalUnitControl","UnitControl","__","Icon","positionCenter","stretchWide","getCSSRules","useSetting","appendSelectors","getBlockGapCSS","getAlignmentsInfo","getGapCSSValue","shouldSkipSerialization","name","label","inspectorControls","DefaultLayoutInspectorControls","layout","onChange","wideSize","contentSize","units","availableUnits","nextWidth","parseFloat","undefined","inherit","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","blockGapStyleValue","spacing","blockGap","blockGapValue","top","output","padding","paddingValues","forEach","rule","key","value","getOrientation","getAlignments","alignmentInfo","alignments","includes","unshift","map","alignment","info","wide","none"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,MADD,EAECC,4BAA4B,IAAIC,cAFjC,EAGCC,yBAAyB,IAAI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3B;AACA;;AACD,aAAOnC,MAAM,CAACiC,UAAP,CAAkBG,GAAlB,CAAyBC,SAAF,KAAmB;AAChDzC,QAAAA,IAAI,EAAEyC,SAD0C;AAEhDC,QAAAA,IAAI,EAAEN,aAAa,CAAEK,SAAF;AAF6B,OAAnB,CAAvB,CAAP;AAIA;;AACD,UAAM;AAAElC,MAAAA,WAAF;AAAeD,MAAAA;AAAf,QAA4BF,MAAlC;AAEA,UAAMiC,UAAU,GAAG,CAClB;AAAErC,MAAAA,IAAI,EAAE;AAAR,KADkB,EAElB;AAAEA,MAAAA,IAAI,EAAE;AAAR,KAFkB,EAGlB;AAAEA,MAAAA,IAAI,EAAE;AAAR,KAHkB,CAAnB;;AAMA,QAAKO,WAAL,EAAmB;AAClB8B,MAAAA,UAAU,CAACE,OAAX,CAAoB;AAAEvC,QAAAA,IAAI,EAAE;AAAR,OAApB;AACA;;AAED,QAAKM,QAAL,EAAgB;AACf+B,MAAAA,UAAU,CAACE,OAAX,CAAoB;AAAEvC,QAAAA,IAAI,EAAE,MAAR;AAAgB0C,QAAAA,IAAI,EAAEN,aAAa,CAACO;AAApC,OAApB;AACA;;AAEDN,IAAAA,UAAU,CAACE,OAAX,CAAoB;AAAEvC,MAAAA,IAAI,EAAE,MAAR;AAAgB0C,MAAAA,IAAI,EAAEN,aAAa,CAACQ;AAApC,KAApB;AAEA,WAAOP,UAAP;AACA;;AAtMa,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, positionCenter, stretchWide } from '@wordpress/icons';\nimport { getCSSRules } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport { appendSelectors, getBlockGapCSS, getAlignmentsInfo } from './utils';\nimport { getGapCSSValue } from '../hooks/gap';\nimport { shouldSkipSerialization } from '../hooks/utils';\n\nexport default {\n\tname: 'constrained',\n\tlabel: __( 'Constrained' ),\n\tinspectorControls: function DefaultLayoutInspectorControls( {\n\t\tlayout,\n\t\tonChange,\n\t} ) {\n\t\tconst { wideSize, contentSize } = layout;\n\t\tconst units = useCustomUnits( {\n\t\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t\t'%',\n\t\t\t\t'px',\n\t\t\t\t'em',\n\t\t\t\t'rem',\n\t\t\t\t'vw',\n\t\t\t],\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className=\"block-editor-hooks__layout-controls\">\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Content' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ contentSize || wideSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\tcontentSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ positionCenter } />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Wide' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ wideSize || contentSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\twideSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ stretchWide } />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-hooks__layout-controls-reset\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tisSmall\n\t\t\t\t\t\tdisabled={ ! contentSize && ! wideSize }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcontentSize: undefined,\n\t\t\t\t\t\t\t\twideSize: undefined,\n\t\t\t\t\t\t\t\tinherit: false,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\n\t\t\t\t<p className=\"block-editor-hooks__layout-controls-helptext\">\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Customize the width for all elements that are assigned to the center or wide columns.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tlayout = {},\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions,\n\t} ) {\n\t\tconst { contentSize, wideSize } = layout;\n\t\tconst blockGapStyleValue = getGapCSSValue( style?.spacing?.blockGap );\n\n\t\t// If a block's block.json skips serialization for spacing or\n\t\t// spacing.blockGap, don't apply the user-defined value to the styles.\n\t\tlet blockGapValue = '';\n\t\tif ( ! shouldSkipSerialization( blockName, 'spacing', 'blockGap' ) ) {\n\t\t\t// If an object is provided only use the 'top' value for this kind of gap.\n\t\t\tif ( blockGapStyleValue?.top ) {\n\t\t\t\tblockGapValue = getGapCSSValue( blockGapStyleValue?.top );\n\t\t\t} else if ( typeof blockGapStyleValue === 'string' ) {\n\t\t\t\tblockGapValue = getGapCSSValue( blockGapStyleValue );\n\t\t\t}\n\t\t}\n\n\t\tlet output =\n\t\t\t!! contentSize || !! wideSize\n\t\t\t\t? `\n\t\t\t\t\t${ appendSelectors(\n\t\t\t\t\t\tselector,\n\t\t\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t\t\t) } {\n\t\t\t\t\t\tmax-width: ${ contentSize ?? wideSize };\n\t\t\t\t\t\tmargin-left: auto !important;\n\t\t\t\t\t\tmargin-right: auto !important;\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignwide' ) } {\n\t\t\t\t\t\tmax-width: ${ wideSize ?? contentSize };\n\t\t\t\t\t}\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmax-width: none;\n\t\t\t\t\t}\n\t\t\t\t`\n\t\t\t\t: '';\n\n\t\t// If there is custom padding, add negative margins for alignfull blocks.\n\t\tif ( style?.spacing?.padding ) {\n\t\t\t// The style object might be storing a preset so we need to make sure we get a usable value.\n\t\t\tconst paddingValues = getCSSRules( style );\n\t\t\tpaddingValues.forEach( ( rule ) => {\n\t\t\t\tif ( rule.key === 'paddingRight' ) {\n\t\t\t\t\toutput += `\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmargin-right: calc(${ rule.value } * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`;\n\t\t\t\t} else if ( rule.key === 'paddingLeft' ) {\n\t\t\t\t\toutput += `\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmargin-left: calc(${ rule.value } * -1);\n\t\t\t\t\t}\n\t\t\t\t\t`;\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'constrained',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'vertical';\n\t},\n\tgetAlignments( layout ) {\n\t\tconst alignmentInfo = getAlignmentsInfo( layout );\n\t\tif ( layout.alignments !== undefined ) {\n\t\t\tif ( ! layout.alignments.includes( 'none' ) ) {\n\t\t\t\tlayout.alignments.unshift( 'none' );\n\t\t\t}\n\t\t\treturn layout.alignments.map( ( alignment ) => ( {\n\t\t\t\tname: alignment,\n\t\t\t\tinfo: alignmentInfo[ alignment ],\n\t\t\t} ) );\n\t\t}\n\t\tconst { contentSize, wideSize } = layout;\n\n\t\tconst alignments = [\n\t\t\t{ name: 'left' },\n\t\t\t{ name: 'center' },\n\t\t\t{ name: 'right' },\n\t\t];\n\n\t\tif ( contentSize ) {\n\t\t\talignments.unshift( { name: 'full' } );\n\t\t}\n\n\t\tif ( wideSize ) {\n\t\t\talignments.unshift( { name: 'wide', info: alignmentInfo.wide } );\n\t\t}\n\n\t\talignments.unshift( { name: 'none', info: alignmentInfo.none } );\n\n\t\treturn alignments;\n\t},\n};\n"]}
@@ -99,7 +99,7 @@ export default {
99
99
  } = layout; // If a block's block.json skips serialization for spacing or spacing.blockGap,
100
100
  // don't apply the user-defined value to the styles.
101
101
 
102
- const blockGapValue = style !== null && style !== void 0 && (_style$spacing = style.spacing) !== null && _style$spacing !== void 0 && _style$spacing.blockGap && !shouldSkipSerialization(blockName, 'spacing', 'blockGap') ? getGapCSSValue(style === null || style === void 0 ? void 0 : (_style$spacing2 = style.spacing) === null || _style$spacing2 === void 0 ? void 0 : _style$spacing2.blockGap) : undefined;
102
+ const blockGapValue = style !== null && style !== void 0 && (_style$spacing = style.spacing) !== null && _style$spacing !== void 0 && _style$spacing.blockGap && !shouldSkipSerialization(blockName, 'spacing', 'blockGap') ? getGapCSSValue(style === null || style === void 0 ? void 0 : (_style$spacing2 = style.spacing) === null || _style$spacing2 === void 0 ? void 0 : _style$spacing2.blockGap, '0.5em') : undefined;
103
103
  const justifyContent = justifyContentMap[layout.justifyContent];
104
104
  const flexWrap = flexWrapOptions.includes(layout.flexWrap) ? layout.flexWrap : 'wrap';
105
105
  const verticalAlignment = verticalAlignmentMap[layout.verticalAlignment];
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/layouts/flex.js"],"names":["__","justifyLeft","justifyCenter","justifyRight","justifySpaceBetween","arrowRight","arrowDown","Button","ToggleControl","Flex","FlexItem","appendSelectors","getBlockGapCSS","getGapCSSValue","BlockControls","JustifyContentControl","BlockVerticalAlignmentControl","shouldSkipSerialization","justifyContentMap","left","right","center","alignItemsMap","verticalAlignmentMap","top","bottom","flexWrapOptions","name","label","inspectorControls","FlexLayoutInspectorControls","layout","onChange","layoutBlockSupport","allowOrientation","toolBarControls","FlexLayoutToolbarControls","allowSwitching","allowVerticalAlignment","orientation","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","blockGapValue","spacing","blockGap","undefined","justifyContent","flexWrap","includes","verticalAlignment","alignItems","output","rules","push","length","join","getOrientation","getAlignments","FlexLayoutVerticalAlignmentControl","isToolbar","onVerticalAlignmentChange","value","verticalAlignmentOptions","map","icon","FlexLayoutJustifyContentControl","onJustificationChange","allowedControls","position","isAlternate","justificationOptions","FlexWrapControl","OrientationControl"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT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AAG,MACTP,QAAQ,CAAE,EACT,GAAGD,MADM;AAETQ,MAAAA,WAAW,EAAE;AAFJ,KAAF;AALV,IAbD,CADD;AA2BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tjustifyLeft,\n\tjustifyCenter,\n\tjustifyRight,\n\tjustifySpaceBetween,\n\tarrowRight,\n\tarrowDown,\n} from '@wordpress/icons';\nimport { Button, ToggleControl, Flex, FlexItem } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { appendSelectors, getBlockGapCSS } from './utils';\nimport { getGapCSSValue } from '../hooks/gap';\nimport {\n\tBlockControls,\n\tJustifyContentControl,\n\tBlockVerticalAlignmentControl,\n} from '../components';\nimport { shouldSkipSerialization } from '../hooks/utils';\n\n// Used with the default, horizontal flex orientation.\nconst justifyContentMap = {\n\tleft: 'flex-start',\n\tright: 'flex-end',\n\tcenter: 'center',\n\t'space-between': 'space-between',\n};\n\n// Used with the vertical (column) flex orientation.\nconst alignItemsMap = {\n\tleft: 'flex-start',\n\tright: 'flex-end',\n\tcenter: 'center',\n};\n\nconst verticalAlignmentMap = {\n\ttop: 'flex-start',\n\tcenter: 'center',\n\tbottom: 'flex-end',\n};\n\nconst flexWrapOptions = [ 'wrap', 'nowrap' ];\n\nexport default {\n\tname: 'flex',\n\tlabel: __( 'Flex' ),\n\tinspectorControls: function FlexLayoutInspectorControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t\tlayoutBlockSupport = {},\n\t} ) {\n\t\tconst { allowOrientation = true } = layoutBlockSupport;\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Flex>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<FlexLayoutJustifyContentControl\n\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t{ allowOrientation && (\n\t\t\t\t\t\t\t<OrientationControl\n\t\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t\t<FlexWrapControl layout={ layout } onChange={ onChange } />\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function FlexLayoutToolbarControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t\tlayoutBlockSupport,\n\t} ) {\n\t\tif ( layoutBlockSupport?.allowSwitching ) {\n\t\t\treturn null;\n\t\t}\n\t\tconst { allowVerticalAlignment = true } = layoutBlockSupport;\n\t\treturn (\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<FlexLayoutJustifyContentControl\n\t\t\t\t\tlayout={ layout }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tisToolbar\n\t\t\t\t/>\n\t\t\t\t{ allowVerticalAlignment &&\n\t\t\t\t\tlayout?.orientation !== 'vertical' && (\n\t\t\t\t\t\t<FlexLayoutVerticalAlignmentControl\n\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tisToolbar\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t);\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions,\n\t} ) {\n\t\tconst { orientation = 'horizontal' } = layout;\n\n\t\t// If a block's block.json skips serialization for spacing or spacing.blockGap,\n\t\t// don't apply the user-defined value to the styles.\n\t\tconst blockGapValue =\n\t\t\tstyle?.spacing?.blockGap &&\n\t\t\t! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )\n\t\t\t\t? getGapCSSValue( style?.spacing?.blockGap )\n\t\t\t\t: undefined;\n\t\tconst justifyContent = justifyContentMap[ layout.justifyContent ];\n\t\tconst flexWrap = flexWrapOptions.includes( layout.flexWrap )\n\t\t\t? layout.flexWrap\n\t\t\t: 'wrap';\n\t\tconst verticalAlignment =\n\t\t\tverticalAlignmentMap[ layout.verticalAlignment ];\n\t\tconst alignItems =\n\t\t\talignItemsMap[ layout.justifyContent ] || alignItemsMap.left;\n\n\t\tlet output = '';\n\t\tconst rules = [];\n\n\t\tif ( flexWrap && flexWrap !== 'wrap' ) {\n\t\t\trules.push( `flex-wrap: ${ flexWrap }` );\n\t\t}\n\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\tif ( verticalAlignment ) {\n\t\t\t\trules.push( `align-items: ${ verticalAlignment }` );\n\t\t\t}\n\t\t\tif ( justifyContent ) {\n\t\t\t\trules.push( `justify-content: ${ justifyContent }` );\n\t\t\t}\n\t\t} else {\n\t\t\trules.push( 'flex-direction: column' );\n\t\t\trules.push( `align-items: ${ alignItems }` );\n\t\t}\n\n\t\tif ( rules.length ) {\n\t\t\toutput = `${ appendSelectors( selector ) } {\n\t\t\t\t${ rules.join( '; ' ) };\n\t\t\t}`;\n\t\t}\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'flex',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation( layout ) {\n\t\tconst { orientation = 'horizontal' } = layout;\n\t\treturn orientation;\n\t},\n\tgetAlignments() {\n\t\treturn [];\n\t},\n};\n\nfunction FlexLayoutVerticalAlignmentControl( {\n\tlayout,\n\tonChange,\n\tisToolbar = false,\n} ) {\n\tconst { verticalAlignment = verticalAlignmentMap.center } = layout;\n\n\tconst onVerticalAlignmentChange = ( value ) => {\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tverticalAlignment: value,\n\t\t} );\n\t};\n\tif ( isToolbar ) {\n\t\treturn (\n\t\t\t<BlockVerticalAlignmentControl\n\t\t\t\tonChange={ onVerticalAlignmentChange }\n\t\t\t\tvalue={ verticalAlignment }\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst verticalAlignmentOptions = [\n\t\t{\n\t\t\tvalue: 'flex-start',\n\t\t\tlabel: __( 'Align items top' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'center',\n\t\t\tlabel: __( 'Align items center' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'flex-end',\n\t\t\tlabel: __( 'Align items bottom' ),\n\t\t},\n\t];\n\n\treturn (\n\t\t<fieldset className=\"block-editor-hooks__flex-layout-vertical-alignment-control\">\n\t\t\t<legend>{ __( 'Vertical alignment' ) }</legend>\n\t\t\t<div>\n\t\t\t\t{ verticalAlignmentOptions.map( ( value, icon, label ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tisPressed={ verticalAlignment === value }\n\t\t\t\t\t\t\tonClick={ () => onVerticalAlignmentChange( value ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n\nfunction FlexLayoutJustifyContentControl( {\n\tlayout,\n\tonChange,\n\tisToolbar = false,\n} ) {\n\tconst { justifyContent = 'left', orientation = 'horizontal' } = layout;\n\tconst onJustificationChange = ( value ) => {\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tjustifyContent: value,\n\t\t} );\n\t};\n\tconst allowedControls = [ 'left', 'center', 'right' ];\n\tif ( orientation === 'horizontal' ) {\n\t\tallowedControls.push( 'space-between' );\n\t}\n\tif ( isToolbar ) {\n\t\treturn (\n\t\t\t<JustifyContentControl\n\t\t\t\tallowedControls={ allowedControls }\n\t\t\t\tvalue={ justifyContent }\n\t\t\t\tonChange={ onJustificationChange }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tposition: 'bottom right',\n\t\t\t\t\tisAlternate: true,\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst justificationOptions = [\n\t\t{\n\t\t\tvalue: 'left',\n\t\t\ticon: justifyLeft,\n\t\t\tlabel: __( 'Justify items left' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'center',\n\t\t\ticon: justifyCenter,\n\t\t\tlabel: __( 'Justify items center' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'right',\n\t\t\ticon: justifyRight,\n\t\t\tlabel: __( 'Justify items right' ),\n\t\t},\n\t];\n\tif ( orientation === 'horizontal' ) {\n\t\tjustificationOptions.push( {\n\t\t\tvalue: 'space-between',\n\t\t\ticon: justifySpaceBetween,\n\t\t\tlabel: __( 'Space between items' ),\n\t\t} );\n\t}\n\n\treturn (\n\t\t<fieldset className=\"block-editor-hooks__flex-layout-justification-controls\">\n\t\t\t<legend>{ __( 'Justification' ) }</legend>\n\t\t\t<div>\n\t\t\t\t{ justificationOptions.map( ( { value, icon, label } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tisPressed={ justifyContent === value }\n\t\t\t\t\t\t\tonClick={ () => onJustificationChange( value ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n\nfunction FlexWrapControl( { layout, onChange } ) {\n\tconst { flexWrap = 'wrap' } = layout;\n\treturn (\n\t\t<ToggleControl\n\t\t\tlabel={ __( 'Allow to wrap to multiple lines' ) }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tonChange( {\n\t\t\t\t\t...layout,\n\t\t\t\t\tflexWrap: value ? 'wrap' : 'nowrap',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tchecked={ flexWrap === 'wrap' }\n\t\t/>\n\t);\n}\n\nfunction OrientationControl( { layout, onChange } ) {\n\tconst { orientation = 'horizontal' } = layout;\n\treturn (\n\t\t<fieldset className=\"block-editor-hooks__flex-layout-orientation-controls\">\n\t\t\t<legend>{ __( 'Orientation' ) }</legend>\n\t\t\t<Button\n\t\t\t\tlabel={ __( 'Horizontal' ) }\n\t\t\t\ticon={ arrowRight }\n\t\t\t\tisPressed={ orientation === 'horizontal' }\n\t\t\t\tonClick={ () =>\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\t...layout,\n\t\t\t\t\t\torientation: 'horizontal',\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\tlabel={ __( 'Vertical' ) }\n\t\t\t\ticon={ arrowDown }\n\t\t\t\tisPressed={ orientation === 'vertical' }\n\t\t\t\tonClick={ () =>\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\t...layout,\n\t\t\t\t\t\torientation: 'vertical',\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t/>\n\t\t</fieldset>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/layouts/flex.js"],"names":["__","justifyLeft","justifyCenter","justifyRight","justifySpaceBetween","arrowRight","arrowDown","Button","ToggleControl","Flex","FlexItem","appendSelectors","getBlockGapCSS","getGapCSSValue","BlockControls","JustifyContentControl","BlockVerticalAlignmentControl","shouldSkipSerialization","justifyContentMap","left","right","center","alignItemsMap","verticalAlignmentMap","top","bottom","flexWrapOptions","name","label","inspectorControls","FlexLayoutInspectorControls","layout","onChange","layoutBlockSupport","allowOrientation","toolBarControls","FlexLayoutToolbarControls","allowSwitching","allowVerticalAlignment","orientation","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","blockGapValue","spacing","blockGap","undefined","justifyContent","flexWrap","includes","verticalAlignment","alignItems","output","rules","push","length","join","getOrientation","getAlignments","FlexLayoutVerticalAlignmentControl","isToolbar","onVerticalAlignmentChange","value","verticalAlignmentOptions","map","icon","FlexLayoutJustifyContentControl","onJustificationChange","allowedControls","position","isAlternate","justificationOptions","FlexWrapControl","OrientationControl"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,WADD,EAECC,aAFD,EAGCC,YAHD,EAICC,mBAJD,EAKCC,UALD,EAMCC,SAND,QAOO,kBAPP;AAQA,SAASC,MAAT,EAAiBC,aAAjB,EAAgCC,IAAhC,EAAsCC,QAAtC,QAAsD,uBAAtD;AAEA;AACA;AACA;;AACA,SAASC,eAAT,EAA0BC,cAA1B,QAAgD,SAAhD;AACA,SAASC,cAAT,QAA+B,cAA/B;AACA,SACCC,aADD,EAECC,qBAFD,EAGCC,6BAHD,QAIO,eAJP;AAKA,SAASC,uBAAT,QAAwC,gBAAxC,C,CAEA;;AACA,MAAMC,iBAAiB,GAAG;AACzBC,EAAAA,IAAI,EAAE,YADmB;AAEzBC,EAAAA,KAAK,EAAE,UAFkB;AAGzBC,EAAAA,MAAM,EAAE,QAHiB;AAIzB,mBAAiB;AAJQ,CAA1B,C,CAOA;;AACA,MAAMC,aAAa,GAAG;AACrBH,EAAAA,IAAI,EAAE,YADe;AAErBC,EAAAA,KAAK,EAAE,UAFc;AAGrBC,EAAAA,MAAM,EAAE;AAHa,CAAtB;AAMA,MAAME,oBAAoB,GAAG;AAC5BC,EAAAA,GAAG,EAAE,YADuB;AAE5BH,EAAAA,MAAM,EAAE,QAFoB;AAG5BI,EAAAA,MAAM,EAAE;AAHoB,CAA7B;AAMA,MAAMC,eAAe,GAAG,CAAE,MAAF,EAAU,QAAV,CAAxB;AAEA,eAAe;AACdC,EAAAA,IAAI,EAAE,MADQ;AAEdC,EAAAA,KAAK,EAAE5B,EAAE,CAAE,MAAF,CAFK;AAGd6B,EAAAA,iBAAiB,EAAE,SAASC,2BAAT,OAIf;AAAA,QAJqD;AACxDC,MAAAA,M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AAW,EAAE;AAFJ,KAAF;AALV,IAFD,EAaC,cAAC,MAAD;AACC,IAAA,KAAK,EAAGvC,EAAE,CAAE,UAAF,CADX;AAEC,IAAA,IAAI,EAAGM,SAFR;AAGC,IAAA,SAAS,EAAGiC,WAAW,KAAK,UAH7B;AAIC,IAAA,OAAO,EAAG,MACTP,QAAQ,CAAE,EACT,GAAGD,MADM;AAETQ,MAAAA,WAAW,EAAE;AAFJ,KAAF;AALV,IAbD,CADD;AA2BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tjustifyLeft,\n\tjustifyCenter,\n\tjustifyRight,\n\tjustifySpaceBetween,\n\tarrowRight,\n\tarrowDown,\n} from '@wordpress/icons';\nimport { Button, ToggleControl, Flex, FlexItem } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { appendSelectors, getBlockGapCSS } from './utils';\nimport { getGapCSSValue } from '../hooks/gap';\nimport {\n\tBlockControls,\n\tJustifyContentControl,\n\tBlockVerticalAlignmentControl,\n} from '../components';\nimport { shouldSkipSerialization } from '../hooks/utils';\n\n// Used with the default, horizontal flex orientation.\nconst justifyContentMap = {\n\tleft: 'flex-start',\n\tright: 'flex-end',\n\tcenter: 'center',\n\t'space-between': 'space-between',\n};\n\n// Used with the vertical (column) flex orientation.\nconst alignItemsMap = {\n\tleft: 'flex-start',\n\tright: 'flex-end',\n\tcenter: 'center',\n};\n\nconst verticalAlignmentMap = {\n\ttop: 'flex-start',\n\tcenter: 'center',\n\tbottom: 'flex-end',\n};\n\nconst flexWrapOptions = [ 'wrap', 'nowrap' ];\n\nexport default {\n\tname: 'flex',\n\tlabel: __( 'Flex' ),\n\tinspectorControls: function FlexLayoutInspectorControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t\tlayoutBlockSupport = {},\n\t} ) {\n\t\tconst { allowOrientation = true } = layoutBlockSupport;\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Flex>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<FlexLayoutJustifyContentControl\n\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t{ allowOrientation && (\n\t\t\t\t\t\t\t<OrientationControl\n\t\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t\t<FlexWrapControl layout={ layout } onChange={ onChange } />\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function FlexLayoutToolbarControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t\tlayoutBlockSupport,\n\t} ) {\n\t\tif ( layoutBlockSupport?.allowSwitching ) {\n\t\t\treturn null;\n\t\t}\n\t\tconst { allowVerticalAlignment = true } = layoutBlockSupport;\n\t\treturn (\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<FlexLayoutJustifyContentControl\n\t\t\t\t\tlayout={ layout }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tisToolbar\n\t\t\t\t/>\n\t\t\t\t{ allowVerticalAlignment &&\n\t\t\t\t\tlayout?.orientation !== 'vertical' && (\n\t\t\t\t\t\t<FlexLayoutVerticalAlignmentControl\n\t\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tisToolbar\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t</BlockControls>\n\t\t);\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions,\n\t} ) {\n\t\tconst { orientation = 'horizontal' } = layout;\n\n\t\t// If a block's block.json skips serialization for spacing or spacing.blockGap,\n\t\t// don't apply the user-defined value to the styles.\n\t\tconst blockGapValue =\n\t\t\tstyle?.spacing?.blockGap &&\n\t\t\t! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )\n\t\t\t\t? getGapCSSValue( style?.spacing?.blockGap, '0.5em' )\n\t\t\t\t: undefined;\n\t\tconst justifyContent = justifyContentMap[ layout.justifyContent ];\n\t\tconst flexWrap = flexWrapOptions.includes( layout.flexWrap )\n\t\t\t? layout.flexWrap\n\t\t\t: 'wrap';\n\t\tconst verticalAlignment =\n\t\t\tverticalAlignmentMap[ layout.verticalAlignment ];\n\t\tconst alignItems =\n\t\t\talignItemsMap[ layout.justifyContent ] || alignItemsMap.left;\n\n\t\tlet output = '';\n\t\tconst rules = [];\n\n\t\tif ( flexWrap && flexWrap !== 'wrap' ) {\n\t\t\trules.push( `flex-wrap: ${ flexWrap }` );\n\t\t}\n\n\t\tif ( orientation === 'horizontal' ) {\n\t\t\tif ( verticalAlignment ) {\n\t\t\t\trules.push( `align-items: ${ verticalAlignment }` );\n\t\t\t}\n\t\t\tif ( justifyContent ) {\n\t\t\t\trules.push( `justify-content: ${ justifyContent }` );\n\t\t\t}\n\t\t} else {\n\t\t\trules.push( 'flex-direction: column' );\n\t\t\trules.push( `align-items: ${ alignItems }` );\n\t\t}\n\n\t\tif ( rules.length ) {\n\t\t\toutput = `${ appendSelectors( selector ) } {\n\t\t\t\t${ rules.join( '; ' ) };\n\t\t\t}`;\n\t\t}\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'flex',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation( layout ) {\n\t\tconst { orientation = 'horizontal' } = layout;\n\t\treturn orientation;\n\t},\n\tgetAlignments() {\n\t\treturn [];\n\t},\n};\n\nfunction FlexLayoutVerticalAlignmentControl( {\n\tlayout,\n\tonChange,\n\tisToolbar = false,\n} ) {\n\tconst { verticalAlignment = verticalAlignmentMap.center } = layout;\n\n\tconst onVerticalAlignmentChange = ( value ) => {\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tverticalAlignment: value,\n\t\t} );\n\t};\n\tif ( isToolbar ) {\n\t\treturn (\n\t\t\t<BlockVerticalAlignmentControl\n\t\t\t\tonChange={ onVerticalAlignmentChange }\n\t\t\t\tvalue={ verticalAlignment }\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst verticalAlignmentOptions = [\n\t\t{\n\t\t\tvalue: 'flex-start',\n\t\t\tlabel: __( 'Align items top' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'center',\n\t\t\tlabel: __( 'Align items center' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'flex-end',\n\t\t\tlabel: __( 'Align items bottom' ),\n\t\t},\n\t];\n\n\treturn (\n\t\t<fieldset className=\"block-editor-hooks__flex-layout-vertical-alignment-control\">\n\t\t\t<legend>{ __( 'Vertical alignment' ) }</legend>\n\t\t\t<div>\n\t\t\t\t{ verticalAlignmentOptions.map( ( value, icon, label ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tisPressed={ verticalAlignment === value }\n\t\t\t\t\t\t\tonClick={ () => onVerticalAlignmentChange( value ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n\nfunction FlexLayoutJustifyContentControl( {\n\tlayout,\n\tonChange,\n\tisToolbar = false,\n} ) {\n\tconst { justifyContent = 'left', orientation = 'horizontal' } = layout;\n\tconst onJustificationChange = ( value ) => {\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tjustifyContent: value,\n\t\t} );\n\t};\n\tconst allowedControls = [ 'left', 'center', 'right' ];\n\tif ( orientation === 'horizontal' ) {\n\t\tallowedControls.push( 'space-between' );\n\t}\n\tif ( isToolbar ) {\n\t\treturn (\n\t\t\t<JustifyContentControl\n\t\t\t\tallowedControls={ allowedControls }\n\t\t\t\tvalue={ justifyContent }\n\t\t\t\tonChange={ onJustificationChange }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tposition: 'bottom right',\n\t\t\t\t\tisAlternate: true,\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst justificationOptions = [\n\t\t{\n\t\t\tvalue: 'left',\n\t\t\ticon: justifyLeft,\n\t\t\tlabel: __( 'Justify items left' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'center',\n\t\t\ticon: justifyCenter,\n\t\t\tlabel: __( 'Justify items center' ),\n\t\t},\n\t\t{\n\t\t\tvalue: 'right',\n\t\t\ticon: justifyRight,\n\t\t\tlabel: __( 'Justify items right' ),\n\t\t},\n\t];\n\tif ( orientation === 'horizontal' ) {\n\t\tjustificationOptions.push( {\n\t\t\tvalue: 'space-between',\n\t\t\ticon: justifySpaceBetween,\n\t\t\tlabel: __( 'Space between items' ),\n\t\t} );\n\t}\n\n\treturn (\n\t\t<fieldset className=\"block-editor-hooks__flex-layout-justification-controls\">\n\t\t\t<legend>{ __( 'Justification' ) }</legend>\n\t\t\t<div>\n\t\t\t\t{ justificationOptions.map( ( { value, icon, label } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tisPressed={ justifyContent === value }\n\t\t\t\t\t\t\tonClick={ () => onJustificationChange( value ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</fieldset>\n\t);\n}\n\nfunction FlexWrapControl( { layout, onChange } ) {\n\tconst { flexWrap = 'wrap' } = layout;\n\treturn (\n\t\t<ToggleControl\n\t\t\tlabel={ __( 'Allow to wrap to multiple lines' ) }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tonChange( {\n\t\t\t\t\t...layout,\n\t\t\t\t\tflexWrap: value ? 'wrap' : 'nowrap',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tchecked={ flexWrap === 'wrap' }\n\t\t/>\n\t);\n}\n\nfunction OrientationControl( { layout, onChange } ) {\n\tconst { orientation = 'horizontal' } = layout;\n\treturn (\n\t\t<fieldset className=\"block-editor-hooks__flex-layout-orientation-controls\">\n\t\t\t<legend>{ __( 'Orientation' ) }</legend>\n\t\t\t<Button\n\t\t\t\tlabel={ __( 'Horizontal' ) }\n\t\t\t\ticon={ arrowRight }\n\t\t\t\tisPressed={ orientation === 'horizontal' }\n\t\t\t\tonClick={ () =>\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\t...layout,\n\t\t\t\t\t\torientation: 'horizontal',\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\tlabel={ __( 'Vertical' ) }\n\t\t\t\ticon={ arrowDown }\n\t\t\t\tisPressed={ orientation === 'vertical' }\n\t\t\t\tonClick={ () =>\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\t...layout,\n\t\t\t\t\t\torientation: 'vertical',\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t/>\n\t\t</fieldset>\n\t);\n}\n"]}
@@ -1,140 +1,48 @@
1
- import { createElement, Fragment } from "@wordpress/element";
2
-
3
1
  /**
4
2
  * WordPress dependencies
5
3
  */
6
- import { Button, __experimentalUseCustomUnits as useCustomUnits, __experimentalUnitControl as UnitControl } from '@wordpress/components';
7
- import { __, sprintf } from '@wordpress/i18n';
8
- import { Icon, positionCenter, stretchWide } from '@wordpress/icons';
9
- import { getCSSRules } from '@wordpress/style-engine';
4
+ import { __ } from '@wordpress/i18n';
10
5
  /**
11
6
  * Internal dependencies
12
7
  */
13
8
 
14
- import useSetting from '../components/use-setting';
15
- import { appendSelectors, getBlockGapCSS } from './utils';
16
- import { getGapBoxControlValueFromStyle } from '../hooks/gap';
9
+ import { getBlockGapCSS, getAlignmentsInfo } from './utils';
10
+ import { getGapCSSValue } from '../hooks/gap';
17
11
  import { shouldSkipSerialization } from '../hooks/utils';
18
12
  export default {
19
13
  name: 'default',
20
14
  label: __('Flow'),
21
- inspectorControls: function DefaultLayoutInspectorControls(_ref) {
22
- let {
23
- layout,
24
- onChange
25
- } = _ref;
26
- const {
27
- wideSize,
28
- contentSize
29
- } = layout;
30
- const units = useCustomUnits({
31
- availableUnits: useSetting('spacing.units') || ['%', 'px', 'em', 'rem', 'vw']
32
- });
33
- return createElement(Fragment, null, createElement("div", {
34
- className: "block-editor-hooks__layout-controls"
35
- }, createElement("div", {
36
- className: "block-editor-hooks__layout-controls-unit"
37
- }, createElement(UnitControl, {
38
- label: __('Content'),
39
- labelPosition: "top",
40
- __unstableInputWidth: "80px",
41
- value: contentSize || wideSize || '',
42
- onChange: nextWidth => {
43
- nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth;
44
- onChange({ ...layout,
45
- contentSize: nextWidth
46
- });
47
- },
48
- units: units
49
- }), createElement(Icon, {
50
- icon: positionCenter
51
- })), createElement("div", {
52
- className: "block-editor-hooks__layout-controls-unit"
53
- }, createElement(UnitControl, {
54
- label: __('Wide'),
55
- labelPosition: "top",
56
- __unstableInputWidth: "80px",
57
- value: wideSize || contentSize || '',
58
- onChange: nextWidth => {
59
- nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth;
60
- onChange({ ...layout,
61
- wideSize: nextWidth
62
- });
63
- },
64
- units: units
65
- }), createElement(Icon, {
66
- icon: stretchWide
67
- }))), createElement("div", {
68
- className: "block-editor-hooks__layout-controls-reset"
69
- }, createElement(Button, {
70
- variant: "secondary",
71
- isSmall: true,
72
- disabled: !contentSize && !wideSize,
73
- onClick: () => onChange({
74
- contentSize: undefined,
75
- wideSize: undefined,
76
- inherit: false
77
- })
78
- }, __('Reset'))), createElement("p", {
79
- className: "block-editor-hooks__layout-controls-helptext"
80
- }, __('Customize the width for all elements that are assigned to the center or wide columns.')));
15
+ inspectorControls: function DefaultLayoutInspectorControls() {
16
+ return null;
81
17
  },
82
18
  toolBarControls: function DefaultLayoutToolbarControls() {
83
19
  return null;
84
20
  },
85
- getLayoutStyle: function getLayoutStyle(_ref2) {
86
- var _style$spacing, _style$spacing2;
21
+ getLayoutStyle: function getLayoutStyle(_ref) {
22
+ var _style$spacing;
87
23
 
88
24
  let {
89
25
  selector,
90
- layout = {},
91
26
  style,
92
27
  blockName,
93
28
  hasBlockGapSupport,
94
29
  layoutDefinitions
95
- } = _ref2;
96
- const {
97
- contentSize,
98
- wideSize
99
- } = layout;
100
- const blockGapStyleValue = getGapBoxControlValueFromStyle(style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.blockGap); // If a block's block.json skips serialization for spacing or
30
+ } = _ref;
31
+ const blockGapStyleValue = getGapCSSValue(style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.blockGap); // If a block's block.json skips serialization for spacing or
101
32
  // spacing.blockGap, don't apply the user-defined value to the styles.
102
33
 
103
- const blockGapValue = blockGapStyleValue !== null && blockGapStyleValue !== void 0 && blockGapStyleValue.top && !shouldSkipSerialization(blockName, 'spacing', 'blockGap') ? blockGapStyleValue === null || blockGapStyleValue === void 0 ? void 0 : blockGapStyleValue.top : '';
104
- let output = !!contentSize || !!wideSize ? `
105
- ${appendSelectors(selector, '> :where(:not(.alignleft):not(.alignright):not(.alignfull))')} {
106
- max-width: ${contentSize !== null && contentSize !== void 0 ? contentSize : wideSize};
107
- margin-left: auto !important;
108
- margin-right: auto !important;
109
- }
110
- ${appendSelectors(selector, '> .alignwide')} {
111
- max-width: ${wideSize !== null && wideSize !== void 0 ? wideSize : contentSize};
112
- }
113
- ${appendSelectors(selector, '> .alignfull')} {
114
- max-width: none;
115
- }
116
- ` : ''; // If there is custom padding, add negative margins for alignfull blocks.
117
-
118
- if (style !== null && style !== void 0 && (_style$spacing2 = style.spacing) !== null && _style$spacing2 !== void 0 && _style$spacing2.padding) {
119
- // The style object might be storing a preset so we need to make sure we get a usable value.
120
- const paddingValues = getCSSRules(style);
121
- paddingValues.forEach(rule => {
122
- if (rule.key === 'paddingRight') {
123
- output += `
124
- ${appendSelectors(selector, '> .alignfull')} {
125
- margin-right: calc(${rule.value} * -1);
126
- }
127
- `;
128
- } else if (rule.key === 'paddingLeft') {
129
- output += `
130
- ${appendSelectors(selector, '> .alignfull')} {
131
- margin-left: calc(${rule.value} * -1);
132
- }
133
- `;
134
- }
135
- });
136
- } // Output blockGap styles based on rules contained in layout definitions in theme.json.
34
+ let blockGapValue = '';
35
+
36
+ if (!shouldSkipSerialization(blockName, 'spacing', 'blockGap')) {
37
+ // If an object is provided only use the 'top' value for this kind of gap.
38
+ if (blockGapStyleValue !== null && blockGapStyleValue !== void 0 && blockGapStyleValue.top) {
39
+ blockGapValue = getGapCSSValue(blockGapStyleValue === null || blockGapStyleValue === void 0 ? void 0 : blockGapStyleValue.top);
40
+ } else if (typeof blockGapStyleValue === 'string') {
41
+ blockGapValue = getGapCSSValue(blockGapStyleValue);
42
+ }
43
+ }
137
44
 
45
+ let output = ''; // Output blockGap styles based on rules contained in layout definitions in theme.json.
138
46
 
139
47
  if (hasBlockGapSupport && blockGapValue) {
140
48
  output += getBlockGapCSS(selector, layoutDefinitions, 'default', blockGapValue);
@@ -194,39 +102,4 @@ export default {
194
102
  }
195
103
 
196
104
  };
197
- /**
198
- * Helper method to assign contextual info to clarify
199
- * alignment settings.
200
- *
201
- * Besides checking if `contentSize` and `wideSize` have a
202
- * value, we now show this information only if their values
203
- * are not a `css var`. This needs to change when parsing
204
- * css variables land.
205
- *
206
- * @see https://github.com/WordPress/gutenberg/pull/34710#issuecomment-918000752
207
- *
208
- * @param {Object} layout The layout object.
209
- * @return {Object} An object with contextual info per alignment.
210
- */
211
-
212
- function getAlignmentsInfo(layout) {
213
- const {
214
- contentSize,
215
- wideSize
216
- } = layout;
217
- const alignmentInfo = {};
218
- const sizeRegex = /^(?!0)\d+(px|em|rem|vw|vh|%)?$/i;
219
-
220
- if (sizeRegex.test(contentSize)) {
221
- // translators: %s: container size (i.e. 600px etc)
222
- alignmentInfo.none = sprintf(__('Max %s wide'), contentSize);
223
- }
224
-
225
- if (sizeRegex.test(wideSize)) {
226
- // translators: %s: container size (i.e. 600px etc)
227
- alignmentInfo.wide = sprintf(__('Max %s wide'), wideSize);
228
- }
229
-
230
- return alignmentInfo;
231
- }
232
105
  //# sourceMappingURL=flow.js.map