@wordpress/block-editor 11.5.0 → 11.7.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 (345) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +4 -0
  3. package/build/components/block-list/block-html.js +1 -3
  4. package/build/components/block-list/block-html.js.map +1 -1
  5. package/build/components/block-list/block-invalid-warning.js +63 -80
  6. package/build/components/block-list/block-invalid-warning.js.map +1 -1
  7. package/build/components/block-preview/auto.js +6 -23
  8. package/build/components/block-preview/auto.js.map +1 -1
  9. package/build/components/block-settings-menu-controls/index.js +1 -1
  10. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  11. package/build/components/block-switcher/block-transformations-menu.native.js +1 -0
  12. package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  13. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
  14. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  15. package/build/components/editor-styles/index.js +20 -2
  16. package/build/components/editor-styles/index.js.map +1 -1
  17. package/build/components/global-styles/border-panel.js +306 -0
  18. package/build/components/global-styles/border-panel.js.map +1 -0
  19. package/build/components/global-styles/color-panel.js +583 -0
  20. package/build/components/global-styles/color-panel.js.map +1 -0
  21. package/build/components/global-styles/dimensions-panel.js +8 -30
  22. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  23. package/build/components/global-styles/get-block-css-selector.js +129 -0
  24. package/build/components/global-styles/get-block-css-selector.js.map +1 -0
  25. package/build/components/global-styles/hooks.js +109 -3
  26. package/build/components/global-styles/hooks.js.map +1 -1
  27. package/build/components/global-styles/index.js +36 -0
  28. package/build/components/global-styles/index.js.map +1 -1
  29. package/build/components/global-styles/typography-panel.js +66 -45
  30. package/build/components/global-styles/typography-panel.js.map +1 -1
  31. package/build/components/global-styles/use-global-styles-output.js +180 -99
  32. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  33. package/build/components/global-styles/utils.js +2 -1
  34. package/build/components/global-styles/utils.js.map +1 -1
  35. package/build/components/image-size-control/index.js +8 -5
  36. package/build/components/image-size-control/index.js.map +1 -1
  37. package/build/components/inserter/index.js +29 -17
  38. package/build/components/inserter/index.js.map +1 -1
  39. package/build/components/inserter/menu.js +1 -1
  40. package/build/components/inserter/menu.js.map +1 -1
  41. package/build/components/inserter/quick-inserter.js +4 -2
  42. package/build/components/inserter/quick-inserter.js.map +1 -1
  43. package/build/components/inserter/search-results.js +10 -3
  44. package/build/components/inserter/search-results.js.map +1 -1
  45. package/build/components/inserter/tabs.js +1 -1
  46. package/build/components/inserter/tabs.js.map +1 -1
  47. package/build/components/inspector-controls-tabs/position-controls-panel.js +43 -7
  48. package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  49. package/build/components/line-height-control/index.js +15 -1
  50. package/build/components/line-height-control/index.js.map +1 -1
  51. package/build/components/link-control/index.js +1 -1
  52. package/build/components/link-control/index.js.map +1 -1
  53. package/build/components/link-control/search-item.js +5 -2
  54. package/build/components/link-control/search-item.js.map +1 -1
  55. package/build/components/list-view/appender.js +105 -0
  56. package/build/components/list-view/appender.js.map +1 -0
  57. package/build/components/list-view/block.js +5 -5
  58. package/build/components/list-view/block.js.map +1 -1
  59. package/build/components/list-view/branch.js +25 -5
  60. package/build/components/list-view/branch.js.map +1 -1
  61. package/build/components/list-view/index.js +37 -13
  62. package/build/components/list-view/index.js.map +1 -1
  63. package/build/components/list-view/use-block-selection.js +1 -2
  64. package/build/components/list-view/use-block-selection.js.map +1 -1
  65. package/build/components/media-replace-flow/index.js +13 -4
  66. package/build/components/media-replace-flow/index.js.map +1 -1
  67. package/build/components/off-canvas-editor/appender.js +28 -3
  68. package/build/components/off-canvas-editor/appender.js.map +1 -1
  69. package/build/components/off-canvas-editor/branch.js +5 -3
  70. package/build/components/off-canvas-editor/branch.js.map +1 -1
  71. package/build/components/off-canvas-editor/index.js +9 -7
  72. package/build/components/off-canvas-editor/index.js.map +1 -1
  73. package/build/components/off-canvas-editor/link-ui.js +0 -1
  74. package/build/components/off-canvas-editor/link-ui.js.map +1 -1
  75. package/build/components/provider/use-block-sync.js +17 -3
  76. package/build/components/provider/use-block-sync.js.map +1 -1
  77. package/build/components/rich-text/format-edit.js +2 -30
  78. package/build/components/rich-text/format-edit.js.map +1 -1
  79. package/build/components/rich-text/format-toolbar-container.js +0 -3
  80. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  81. package/build/components/writing-flow/use-input.js +4 -8
  82. package/build/components/writing-flow/use-input.js.map +1 -1
  83. package/build/hooks/border.js +90 -240
  84. package/build/hooks/border.js.map +1 -1
  85. package/build/hooks/color.js +92 -229
  86. package/build/hooks/color.js.map +1 -1
  87. package/build/hooks/content-lock-ui.js +4 -2
  88. package/build/hooks/content-lock-ui.js.map +1 -1
  89. package/build/hooks/{color-panel.js → contrast-checker.js} +11 -49
  90. package/build/hooks/contrast-checker.js.map +1 -0
  91. package/build/hooks/custom-class-name.js +4 -4
  92. package/build/hooks/custom-class-name.js.map +1 -1
  93. package/build/hooks/custom-class-name.native.js +3 -4
  94. package/build/hooks/custom-class-name.native.js.map +1 -1
  95. package/build/hooks/dimensions.js +0 -1
  96. package/build/hooks/dimensions.js.map +1 -1
  97. package/build/hooks/duotone.js +3 -1
  98. package/build/hooks/duotone.js.map +1 -1
  99. package/build/hooks/layout.js +19 -22
  100. package/build/hooks/layout.js.map +1 -1
  101. package/build/hooks/position.js +2 -2
  102. package/build/hooks/position.js.map +1 -1
  103. package/build/hooks/style.js +23 -26
  104. package/build/hooks/style.js.map +1 -1
  105. package/build/hooks/supports.js +7 -1
  106. package/build/hooks/supports.js.map +1 -1
  107. package/build/hooks/typography.js +2 -2
  108. package/build/hooks/typography.js.map +1 -1
  109. package/build/hooks/utils.js +50 -75
  110. package/build/hooks/utils.js.map +1 -1
  111. package/build/layouts/constrained.js +6 -2
  112. package/build/layouts/constrained.js.map +1 -1
  113. package/build/layouts/grid.js +165 -0
  114. package/build/layouts/grid.js.map +1 -0
  115. package/build/layouts/index.js +3 -1
  116. package/build/layouts/index.js.map +1 -1
  117. package/build/private-apis.js +7 -1
  118. package/build/private-apis.js.map +1 -1
  119. package/build/store/actions.js +10 -8
  120. package/build/store/actions.js.map +1 -1
  121. package/build/store/selectors.js +19 -3
  122. package/build/store/selectors.js.map +1 -1
  123. package/build/utils/object.js +76 -0
  124. package/build/utils/object.js.map +1 -0
  125. package/build/utils/parse-css-unit-to-px.js +15 -9
  126. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  127. package/build-module/components/block-list/block-html.js +1 -3
  128. package/build-module/components/block-list/block-html.js.map +1 -1
  129. package/build-module/components/block-list/block-invalid-warning.js +66 -78
  130. package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
  131. package/build-module/components/block-preview/auto.js +6 -22
  132. package/build-module/components/block-preview/auto.js.map +1 -1
  133. package/build-module/components/block-settings-menu-controls/index.js +1 -1
  134. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  135. package/build-module/components/block-switcher/block-transformations-menu.native.js +1 -0
  136. package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  137. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
  138. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  139. package/build-module/components/editor-styles/index.js +19 -2
  140. package/build-module/components/editor-styles/index.js.map +1 -1
  141. package/build-module/components/global-styles/border-panel.js +291 -0
  142. package/build-module/components/global-styles/border-panel.js.map +1 -0
  143. package/build-module/components/global-styles/color-panel.js +554 -0
  144. package/build-module/components/global-styles/color-panel.js.map +1 -0
  145. package/build-module/components/global-styles/dimensions-panel.js +7 -30
  146. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  147. package/build-module/components/global-styles/get-block-css-selector.js +120 -0
  148. package/build-module/components/global-styles/get-block-css-selector.js.map +1 -0
  149. package/build-module/components/global-styles/hooks.js +104 -3
  150. package/build-module/components/global-styles/hooks.js.map +1 -1
  151. package/build-module/components/global-styles/index.js +3 -0
  152. package/build-module/components/global-styles/index.js.map +1 -1
  153. package/build-module/components/global-styles/typography-panel.js +65 -46
  154. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  155. package/build-module/components/global-styles/use-global-styles-output.js +181 -100
  156. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  157. package/build-module/components/global-styles/utils.js +2 -1
  158. package/build-module/components/global-styles/utils.js.map +1 -1
  159. package/build-module/components/image-size-control/index.js +8 -5
  160. package/build-module/components/image-size-control/index.js.map +1 -1
  161. package/build-module/components/inserter/index.js +28 -16
  162. package/build-module/components/inserter/index.js.map +1 -1
  163. package/build-module/components/inserter/menu.js +1 -1
  164. package/build-module/components/inserter/menu.js.map +1 -1
  165. package/build-module/components/inserter/quick-inserter.js +4 -2
  166. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  167. package/build-module/components/inserter/search-results.js +10 -3
  168. package/build-module/components/inserter/search-results.js.map +1 -1
  169. package/build-module/components/inserter/tabs.js +1 -1
  170. package/build-module/components/inserter/tabs.js.map +1 -1
  171. package/build-module/components/inspector-controls-tabs/position-controls-panel.js +42 -7
  172. package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  173. package/build-module/components/line-height-control/index.js +15 -1
  174. package/build-module/components/line-height-control/index.js.map +1 -1
  175. package/build-module/components/link-control/index.js +1 -1
  176. package/build-module/components/link-control/index.js.map +1 -1
  177. package/build-module/components/link-control/search-item.js +4 -2
  178. package/build-module/components/link-control/search-item.js.map +1 -1
  179. package/build-module/components/list-view/appender.js +88 -0
  180. package/build-module/components/list-view/appender.js.map +1 -0
  181. package/build-module/components/list-view/block.js +5 -4
  182. package/build-module/components/list-view/block.js.map +1 -1
  183. package/build-module/components/list-view/branch.js +22 -5
  184. package/build-module/components/list-view/branch.js.map +1 -1
  185. package/build-module/components/list-view/index.js +32 -12
  186. package/build-module/components/list-view/index.js.map +1 -1
  187. package/build-module/components/list-view/use-block-selection.js +1 -2
  188. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  189. package/build-module/components/media-replace-flow/index.js +12 -4
  190. package/build-module/components/media-replace-flow/index.js.map +1 -1
  191. package/build-module/components/off-canvas-editor/appender.js +28 -4
  192. package/build-module/components/off-canvas-editor/appender.js.map +1 -1
  193. package/build-module/components/off-canvas-editor/branch.js +5 -3
  194. package/build-module/components/off-canvas-editor/branch.js.map +1 -1
  195. package/build-module/components/off-canvas-editor/index.js +9 -7
  196. package/build-module/components/off-canvas-editor/index.js.map +1 -1
  197. package/build-module/components/off-canvas-editor/link-ui.js +0 -1
  198. package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
  199. package/build-module/components/provider/use-block-sync.js +17 -3
  200. package/build-module/components/provider/use-block-sync.js.map +1 -1
  201. package/build-module/components/rich-text/format-edit.js +3 -31
  202. package/build-module/components/rich-text/format-edit.js.map +1 -1
  203. package/build-module/components/rich-text/format-toolbar-container.js +0 -3
  204. package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
  205. package/build-module/components/writing-flow/use-input.js +4 -8
  206. package/build-module/components/writing-flow/use-input.js.map +1 -1
  207. package/build-module/hooks/border.js +92 -240
  208. package/build-module/hooks/border.js.map +1 -1
  209. package/build-module/hooks/color.js +90 -232
  210. package/build-module/hooks/color.js.map +1 -1
  211. package/build-module/hooks/content-lock-ui.js +4 -2
  212. package/build-module/hooks/content-lock-ui.js.map +1 -1
  213. package/build-module/hooks/{color-panel.js → contrast-checker.js} +10 -44
  214. package/build-module/hooks/contrast-checker.js.map +1 -0
  215. package/build-module/hooks/custom-class-name.js +4 -4
  216. package/build-module/hooks/custom-class-name.js.map +1 -1
  217. package/build-module/hooks/custom-class-name.native.js +3 -4
  218. package/build-module/hooks/custom-class-name.native.js.map +1 -1
  219. package/build-module/hooks/dimensions.js +0 -1
  220. package/build-module/hooks/dimensions.js.map +1 -1
  221. package/build-module/hooks/duotone.js +4 -2
  222. package/build-module/hooks/duotone.js.map +1 -1
  223. package/build-module/hooks/layout.js +19 -22
  224. package/build-module/hooks/layout.js.map +1 -1
  225. package/build-module/hooks/position.js +3 -3
  226. package/build-module/hooks/position.js.map +1 -1
  227. package/build-module/hooks/style.js +23 -26
  228. package/build-module/hooks/style.js.map +1 -1
  229. package/build-module/hooks/supports.js +7 -1
  230. package/build-module/hooks/supports.js.map +1 -1
  231. package/build-module/hooks/typography.js +2 -2
  232. package/build-module/hooks/typography.js.map +1 -1
  233. package/build-module/hooks/utils.js +48 -72
  234. package/build-module/hooks/utils.js.map +1 -1
  235. package/build-module/layouts/constrained.js +6 -2
  236. package/build-module/layouts/constrained.js.map +1 -1
  237. package/build-module/layouts/grid.js +151 -0
  238. package/build-module/layouts/grid.js.map +1 -0
  239. package/build-module/layouts/index.js +2 -1
  240. package/build-module/layouts/index.js.map +1 -1
  241. package/build-module/private-apis.js +5 -1
  242. package/build-module/private-apis.js.map +1 -1
  243. package/build-module/store/actions.js +10 -8
  244. package/build-module/store/actions.js.map +1 -1
  245. package/build-module/store/selectors.js +17 -3
  246. package/build-module/store/selectors.js.map +1 -1
  247. package/build-module/utils/object.js +69 -0
  248. package/build-module/utils/object.js.map +1 -0
  249. package/build-module/utils/parse-css-unit-to-px.js +15 -9
  250. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  251. package/build-style/style-rtl.css +32 -12
  252. package/build-style/style.css +32 -12
  253. package/package.json +31 -31
  254. package/src/components/block-draggable/content.scss +1 -1
  255. package/src/components/block-inspector/style.scss +3 -0
  256. package/src/components/block-list/block-html.js +1 -1
  257. package/src/components/block-list/block-invalid-warning.js +72 -64
  258. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +20 -2
  259. package/src/components/block-preview/auto.js +2 -17
  260. package/src/components/block-preview/test/index.js +0 -2
  261. package/src/components/block-settings-menu-controls/index.js +2 -1
  262. package/src/components/block-styles/style.scss +2 -2
  263. package/src/components/block-switcher/block-transformations-menu.native.js +1 -0
  264. package/src/components/color-palette/test/__snapshots__/control.js.snap +16 -14
  265. package/src/components/colors-gradients/style.scss +8 -8
  266. package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +48 -38
  267. package/src/components/editor-styles/index.js +29 -1
  268. package/src/components/global-styles/border-panel.js +285 -0
  269. package/src/components/global-styles/color-panel.js +706 -0
  270. package/src/components/global-styles/dimensions-panel.js +13 -42
  271. package/src/components/global-styles/get-block-css-selector.js +129 -0
  272. package/src/components/global-styles/hooks.js +154 -1
  273. package/src/components/global-styles/index.js +3 -0
  274. package/src/components/global-styles/test/use-global-styles-output.js +31 -2
  275. package/src/components/global-styles/typography-panel.js +67 -45
  276. package/src/components/global-styles/use-global-styles-output.js +176 -93
  277. package/src/components/global-styles/utils.js +3 -0
  278. package/src/components/image-size-control/index.js +4 -3
  279. package/src/components/image-size-control/test/index.js +2 -2
  280. package/src/components/inner-blocks/README.md +1 -1
  281. package/src/components/inserter/index.js +30 -11
  282. package/src/components/inserter/menu.js +0 -1
  283. package/src/components/inserter/quick-inserter.js +2 -0
  284. package/src/components/inserter/search-results.js +7 -1
  285. package/src/components/inserter/style.scss +3 -0
  286. package/src/components/inserter/tabs.js +1 -9
  287. package/src/components/inspector-controls-tabs/position-controls-panel.js +40 -9
  288. package/src/components/line-height-control/index.js +10 -1
  289. package/src/components/link-control/index.js +1 -1
  290. package/src/components/link-control/search-item.js +3 -1
  291. package/src/components/link-control/style.scss +0 -4
  292. package/src/components/link-control/test/index.js +0 -2
  293. package/src/components/list-view/appender.js +101 -0
  294. package/src/components/list-view/block.js +5 -4
  295. package/src/components/list-view/branch.js +30 -1
  296. package/src/components/list-view/index.js +43 -10
  297. package/src/components/list-view/style.scss +19 -0
  298. package/src/components/list-view/use-block-selection.js +0 -2
  299. package/src/components/media-replace-flow/index.js +36 -24
  300. package/src/components/media-replace-flow/style.scss +5 -2
  301. package/src/components/off-canvas-editor/appender.js +31 -5
  302. package/src/components/off-canvas-editor/branch.js +3 -1
  303. package/src/components/off-canvas-editor/index.js +7 -7
  304. package/src/components/off-canvas-editor/link-ui.js +0 -1
  305. package/src/components/provider/use-block-sync.js +21 -4
  306. package/src/components/rich-text/format-edit.js +2 -32
  307. package/src/components/rich-text/format-toolbar-container.js +1 -7
  308. package/src/components/url-popover/test/index.js +0 -2
  309. package/src/components/writing-flow/use-input.js +4 -5
  310. package/src/hooks/border.js +93 -225
  311. package/src/hooks/color.js +120 -296
  312. package/src/hooks/content-lock-ui.js +6 -2
  313. package/src/hooks/{color-panel.js → contrast-checker.js} +10 -46
  314. package/src/hooks/custom-class-name.js +4 -4
  315. package/src/hooks/custom-class-name.native.js +3 -4
  316. package/src/hooks/dimensions.js +0 -1
  317. package/src/hooks/duotone.js +8 -5
  318. package/src/hooks/layout.js +19 -16
  319. package/src/hooks/position.js +3 -3
  320. package/src/hooks/style.js +29 -28
  321. package/src/hooks/supports.js +6 -0
  322. package/src/hooks/test/style.js +2 -1
  323. package/src/hooks/test/use-typography-props.js +2 -0
  324. package/src/hooks/test/utils.js +0 -104
  325. package/src/hooks/typography.js +2 -1
  326. package/src/hooks/utils.js +63 -70
  327. package/src/layouts/constrained.js +23 -17
  328. package/src/layouts/grid.js +172 -0
  329. package/src/layouts/index.js +2 -1
  330. package/src/layouts/test/grid.js +21 -0
  331. package/src/private-apis.js +4 -0
  332. package/src/store/actions.js +10 -8
  333. package/src/store/selectors.js +20 -3
  334. package/src/utils/object.js +69 -0
  335. package/src/utils/parse-css-unit-to-px.js +14 -9
  336. package/src/utils/test/object.js +107 -0
  337. package/src/utils/test/parse-css-unit-to-px.js +1 -2
  338. package/tsconfig.tsbuildinfo +1 -1
  339. package/build/hooks/border-radius.js +0 -100
  340. package/build/hooks/border-radius.js.map +0 -1
  341. package/build/hooks/color-panel.js.map +0 -1
  342. package/build-module/hooks/border-radius.js +0 -84
  343. package/build-module/hooks/border-radius.js.map +0 -1
  344. package/build-module/hooks/color-panel.js.map +0 -1
  345. package/src/hooks/border-radius.js +0 -70
@@ -26,10 +26,11 @@ function omit(object, keys) {
26
26
  const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
27
27
  const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
28
28
  const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
29
+ const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
29
30
  const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
30
31
  const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
31
32
  export const TYPOGRAPHY_SUPPORT_KEY = 'typography';
32
- export const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
33
+ export const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_COLUMNS_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
33
34
 
34
35
  function styleToAttributes(style) {
35
36
  var _style$typography, _style$typography2;
@@ -109,7 +110,6 @@ export function TypographyPanel(_ref3) {
109
110
  return createElement(StylesTypographyPanel, {
110
111
  as: TypographyInspectorControl,
111
112
  panelId: clientId,
112
- name: name,
113
113
  settings: settings,
114
114
  value: value,
115
115
  onChange: onChange,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/typography.js"],"names":["getBlockSupport","hasBlockSupport","useMemo","useCallback","InspectorControls","default","StylesTypographyPanel","useHasTypographyPanel","LINE_HEIGHT_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","cleanEmptyObject","useBlockSettings","omit","object","keys","Object","fromEntries","entries","filter","key","includes","LETTER_SPACING_SUPPORT_KEY","TEXT_TRANSFORM_SUPPORT_KEY","TEXT_DECORATION_SUPPORT_KEY","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","styleToAttributes","style","updatedStyle","fontSizeValue","typography","fontSize","fontFamilyValue","fontFamily","fontSizeSlug","startsWith","substring","length","undefined","fontFamilySlug","attributesToStyle","attributes","TypographyInspectorControl","children","resetAllFilter","attributesResetAllFilter","existingStyle","TypographyPanel","clientId","name","setAttributes","__unstableParentLayout","settings","isEnabled","value","onChange","newStyle","defaultControls","hasTypographySupport","blockName","some"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,OAAT,EAAkBC,WAAlB,QAAqC,oBAArC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,SACCC,OAAO,IAAIC,qBADZ,EAECC,qBAFD,QAGO,8CAHP;AAKA,SAASC,uBAAT,QAAwC,eAAxC;AACA,SAASC,uBAAT,QAAwC,eAAxC;AACA,SAASC,qBAAT,QAAsC,aAAtC;AACA,SAASC,gBAAT,EAA2BC,gBAA3B,QAAmD,SAAnD;;AAEA,SAASC,IAAT,CAAeC,MAAf,EAAuBC,IAAvB,EAA8B;AAC7B,SAAOC,MAAM,CAACC,WAAP,CACND,MAAM,CAACE,OAAP,CAAgBJ,MAAhB,EAAyBK,MAAzB,CAAiC;AAAA,QAAE,CAAEC,GAAF,CAAF;AAAA,WAAe,CAAEL,IAAI,CAACM,QAAL,CAAeD,GAAf,CAAjB;AAAA,GAAjC,CADM,CAAP;AAGA;;AAED,MAAME,0BAA0B,GAAG,wCAAnC;AACA,MAAMC,0BAA0B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BAAgB,CAAEwC,IAAF,EAAQE,sBAAR,CAAjC;AACA,QAAME,SAAS,GAAGjD,qBAAqB,CAAEgD,QAAF,CAAvC;AACA,QAAME,KAAK,GAAGvD,OAAO,CAAE,MAAM;AAC5B,WAAOyC,iBAAiB,CAAE;AACzBb,MAAAA,KAAK,EAAEc,UAAU,CAACd,KADO;AAEzBM,MAAAA,UAAU,EAAEQ,UAAU,CAACR,UAFE;AAGzBF,MAAAA,QAAQ,EAAEU,UAAU,CAACV;AAHI,KAAF,CAAxB;AAKA,GANoB,EAMlB,CAAEU,UAAU,CAACd,KAAb,EAAoBc,UAAU,CAACV,QAA/B,EAAyCU,UAAU,CAACR,UAApD,CANkB,CAArB;;AAQA,QAAMsB,QAAQ,GAAKC,QAAF,IAAgB;AAChCN,IAAAA,aAAa,CAAExB,iBAAiB,CAAE8B,QAAF,CAAnB,CAAb;AACA,GAFD;;AAIA,MAAK,CAAEH,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMI,eAAe,GAAG5D,eAAe,CAAEoD,IAAF,EAAQ,CAC9CzB,sBAD8C,EAE9C,+BAF8C,CAAR,CAAvC;AAKA,SACC,cAAC,qBAAD;AACC,IAAA,EAAE,EAAGkB,0BADN;AAEC,IAAA,OAAO,EAAGM,QAFX;AAGC,IAAA,IAAI,EAAGC,IAHR;AAIC,IAAA,QAAQ,EAAGG,QAJZ;AAKC,IAAA,KAAK,EAAGE,KALT;AAMC,IAAA,QAAQ,EAAGC,QANZ;AAOC,IAAA,eAAe,EAAGE;AAPnB,IADD;AAWA;AAED,OAAO,MAAMC,oBAAoB,GAAKC,SAAF,IAAiB;AACpD,SAAOlC,uBAAuB,CAACmC,IAAxB,CAAgC3C,GAAF,IACpCnB,eAAe,CAAE6D,SAAF,EAAa1C,GAAb,CADT,CAAP;AAGA,CAJM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useMemo, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tdefault as StylesTypographyPanel,\n\tuseHasTypographyPanel,\n} from '../components/global-styles/typography-panel';\n\nimport { LINE_HEIGHT_SUPPORT_KEY } from './line-height';\nimport { FONT_FAMILY_SUPPORT_KEY } from './font-family';\nimport { FONT_SIZE_SUPPORT_KEY } from './font-size';\nimport { cleanEmptyObject, useBlockSettings } from './utils';\n\nfunction omit( object, keys ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( object ).filter( ( [ key ] ) => ! keys.includes( key ) )\n\t);\n}\n\nconst LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';\nconst TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';\nconst TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';\nconst FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';\nconst FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';\nexport const TYPOGRAPHY_SUPPORT_KEY = 'typography';\nexport const TYPOGRAPHY_SUPPORT_KEYS = [\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tFONT_SIZE_SUPPORT_KEY,\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFONT_FAMILY_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\n\nfunction styleToAttributes( style ) {\n\tconst updatedStyle = { ...omit( style, [ 'fontFamily' ] ) };\n\tconst fontSizeValue = style?.typography?.fontSize;\n\tconst fontFamilyValue = style?.typography?.fontFamily;\n\tconst fontSizeSlug = fontSizeValue?.startsWith( 'var:preset|font-size|' )\n\t\t? fontSizeValue.substring( 'var:preset|font-size|'.length )\n\t\t: undefined;\n\tconst fontFamilySlug = fontFamilyValue?.startsWith(\n\t\t'var:preset|font-family|'\n\t)\n\t\t? fontFamilyValue.substring( 'var:preset|font-family|'.length )\n\t\t: undefined;\n\tupdatedStyle.typography = {\n\t\t...omit( updatedStyle.typography, [ 'fontFamily' ] ),\n\t\tfontSize: fontSizeSlug ? undefined : fontSizeValue,\n\t};\n\treturn {\n\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\tfontFamily: fontFamilySlug,\n\t\tfontSize: fontSizeSlug,\n\t};\n}\n\nfunction attributesToStyle( attributes ) {\n\treturn {\n\t\t...attributes.style,\n\t\ttypography: {\n\t\t\t...attributes.style?.typography,\n\t\t\tfontFamily: attributes.fontFamily\n\t\t\t\t? 'var:preset|font-family|' + attributes.fontFamily\n\t\t\t\t: undefined,\n\t\t\tfontSize: attributes.fontSize\n\t\t\t\t? 'var:preset|font-size|' + attributes.fontSize\n\t\t\t\t: attributes.style?.typography?.fontSize,\n\t\t},\n\t};\n}\n\nfunction TypographyInspectorControl( { children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributesToStyle( attributes );\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\t...styleToAttributes( updatedStyle ),\n\t\t\t};\n\t\t},\n\t\t[ resetAllFilter ]\n\t);\n\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"typography\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function TypographyPanel( {\n\tclientId,\n\tname,\n\tattributes,\n\tsetAttributes,\n\t__unstableParentLayout,\n} ) {\n\tconst settings = useBlockSettings( name, __unstableParentLayout );\n\tconst isEnabled = useHasTypographyPanel( settings );\n\tconst value = useMemo( () => {\n\t\treturn attributesToStyle( {\n\t\t\tstyle: attributes.style,\n\t\t\tfontFamily: attributes.fontFamily,\n\t\t\tfontSize: attributes.fontSize,\n\t\t} );\n\t}, [ attributes.style, attributes.fontSize, attributes.fontFamily ] );\n\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( styleToAttributes( newStyle ) );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultControls = getBlockSupport( name, [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<StylesTypographyPanel\n\t\t\tas={ TypographyInspectorControl }\n\t\t\tpanelId={ clientId }\n\t\t\tname={ name }\n\t\t\tsettings={ settings }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tdefaultControls={ defaultControls }\n\t\t/>\n\t);\n}\n\nexport const hasTypographySupport = ( blockName ) => {\n\treturn TYPOGRAPHY_SUPPORT_KEYS.some( ( key ) =>\n\t\thasBlockSupport( blockName, key )\n\t);\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/typography.js"],"names":["getBlockSupport","hasBlockSupport","useMemo","useCallback","InspectorControls","default","StylesTypographyPanel","useHasTypographyPanel","LINE_HEIGHT_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","cleanEmptyObject","useBlockSettings","omit","object","keys","Object","fromEntries","entries","filter","key","includes","LETTER_SPACING_SUPPORT_KEY","TEXT_TRANSFORM_SUPPORT_KEY","TEXT_DECORATION_SUPPORT_KEY","TEXT_COLUMNS_SUPPORT_KEY","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","styleToAttributes","style","updatedStyle","fontSizeValue","typography","fontSize","fontFamilyValue","fontFamily","fontSizeSlug","startsWith","substring","length","undefined","fontFamilySlug","attributesToStyle","attributes","TypographyInspectorControl","children","resetAllFilter","attributesResetAllFilter","existingStyle","TypographyPanel","clientId","name","setAttributes","__unstableParentLayout","settings","isEnabled","value","onCh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AAMsB,QAAQ,GAAKC,QAAF,IAAgB;AAChCN,IAAAA,aAAa,CAAExB,iBAAiB,CAAE8B,QAAF,CAAnB,CAAb;AACA,GAFD;;AAIA,MAAK,CAAEH,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMI,eAAe,GAAG7D,eAAe,CAAEqD,IAAF,EAAQ,CAC9CzB,sBAD8C,EAE9C,+BAF8C,CAAR,CAAvC;AAKA,SACC,cAAC,qBAAD;AACC,IAAA,EAAE,EAAGkB,0BADN;AAEC,IAAA,OAAO,EAAGM,QAFX;AAGC,IAAA,QAAQ,EAAGI,QAHZ;AAIC,IAAA,KAAK,EAAGE,KAJT;AAKC,IAAA,QAAQ,EAAGC,QALZ;AAMC,IAAA,eAAe,EAAGE;AANnB,IADD;AAUA;AAED,OAAO,MAAMC,oBAAoB,GAAKC,SAAF,IAAiB;AACpD,SAAOlC,uBAAuB,CAACmC,IAAxB,CAAgC5C,GAAF,IACpCnB,eAAe,CAAE8D,SAAF,EAAa3C,GAAb,CADT,CAAP;AAGA,CAJM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useMemo, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tdefault as StylesTypographyPanel,\n\tuseHasTypographyPanel,\n} from '../components/global-styles/typography-panel';\n\nimport { LINE_HEIGHT_SUPPORT_KEY } from './line-height';\nimport { FONT_FAMILY_SUPPORT_KEY } from './font-family';\nimport { FONT_SIZE_SUPPORT_KEY } from './font-size';\nimport { cleanEmptyObject, useBlockSettings } from './utils';\n\nfunction omit( object, keys ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( object ).filter( ( [ key ] ) => ! keys.includes( key ) )\n\t);\n}\n\nconst LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';\nconst TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';\nconst TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';\nconst TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';\nconst FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';\nconst FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';\nexport const TYPOGRAPHY_SUPPORT_KEY = 'typography';\nexport const TYPOGRAPHY_SUPPORT_KEYS = [\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tFONT_SIZE_SUPPORT_KEY,\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFONT_FAMILY_SUPPORT_KEY,\n\tTEXT_COLUMNS_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\n\nfunction styleToAttributes( style ) {\n\tconst updatedStyle = { ...omit( style, [ 'fontFamily' ] ) };\n\tconst fontSizeValue = style?.typography?.fontSize;\n\tconst fontFamilyValue = style?.typography?.fontFamily;\n\tconst fontSizeSlug = fontSizeValue?.startsWith( 'var:preset|font-size|' )\n\t\t? fontSizeValue.substring( 'var:preset|font-size|'.length )\n\t\t: undefined;\n\tconst fontFamilySlug = fontFamilyValue?.startsWith(\n\t\t'var:preset|font-family|'\n\t)\n\t\t? fontFamilyValue.substring( 'var:preset|font-family|'.length )\n\t\t: undefined;\n\tupdatedStyle.typography = {\n\t\t...omit( updatedStyle.typography, [ 'fontFamily' ] ),\n\t\tfontSize: fontSizeSlug ? undefined : fontSizeValue,\n\t};\n\treturn {\n\t\tstyle: cleanEmptyObject( updatedStyle ),\n\t\tfontFamily: fontFamilySlug,\n\t\tfontSize: fontSizeSlug,\n\t};\n}\n\nfunction attributesToStyle( attributes ) {\n\treturn {\n\t\t...attributes.style,\n\t\ttypography: {\n\t\t\t...attributes.style?.typography,\n\t\t\tfontFamily: attributes.fontFamily\n\t\t\t\t? 'var:preset|font-family|' + attributes.fontFamily\n\t\t\t\t: undefined,\n\t\t\tfontSize: attributes.fontSize\n\t\t\t\t? 'var:preset|font-size|' + attributes.fontSize\n\t\t\t\t: attributes.style?.typography?.fontSize,\n\t\t},\n\t};\n}\n\nfunction TypographyInspectorControl( { children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributesToStyle( attributes );\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\t...styleToAttributes( updatedStyle ),\n\t\t\t};\n\t\t},\n\t\t[ resetAllFilter ]\n\t);\n\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"typography\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function TypographyPanel( {\n\tclientId,\n\tname,\n\tattributes,\n\tsetAttributes,\n\t__unstableParentLayout,\n} ) {\n\tconst settings = useBlockSettings( name, __unstableParentLayout );\n\tconst isEnabled = useHasTypographyPanel( settings );\n\tconst value = useMemo( () => {\n\t\treturn attributesToStyle( {\n\t\t\tstyle: attributes.style,\n\t\t\tfontFamily: attributes.fontFamily,\n\t\t\tfontSize: attributes.fontSize,\n\t\t} );\n\t}, [ attributes.style, attributes.fontSize, attributes.fontFamily ] );\n\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( styleToAttributes( newStyle ) );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultControls = getBlockSupport( name, [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<StylesTypographyPanel\n\t\t\tas={ TypographyInspectorControl }\n\t\t\tpanelId={ clientId }\n\t\t\tsettings={ settings }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tdefaultControls={ defaultControls }\n\t\t/>\n\t);\n}\n\nexport const hasTypographySupport = ( blockName ) => {\n\treturn TYPOGRAPHY_SUPPORT_KEYS.some( ( key ) =>\n\t\thasBlockSupport( blockName, key )\n\t);\n};\n"]}
@@ -14,6 +14,7 @@ import { useMemo } from '@wordpress/element';
14
14
 
15
15
  import { useSetting } from '../components';
16
16
  import { useSettingsForBlockElement } from '../components/global-styles/hooks';
17
+ import { immutableSet } from '../utils/object';
17
18
  /**
18
19
  * Removed falsy values from nested object.
19
20
  *
@@ -32,75 +33,6 @@ export const cleanEmptyObject = object => {
32
33
  }));
33
34
  return isEmpty(cleanedNestedObjects) ? undefined : cleanedNestedObjects;
34
35
  };
35
- /**
36
- * Converts a path to an array of its fragments.
37
- * Supports strings, numbers and arrays:
38
- *
39
- * 'foo' => [ 'foo' ]
40
- * 2 => [ '2' ]
41
- * [ 'foo', 'bar' ] => [ 'foo', 'bar' ]
42
- *
43
- * @param {string|number|Array} path Path
44
- * @return {Array} Normalized path.
45
- */
46
-
47
- function normalizePath(path) {
48
- if (Array.isArray(path)) {
49
- return path;
50
- } else if (typeof path === 'number') {
51
- return [path.toString()];
52
- }
53
-
54
- return [path];
55
- }
56
- /**
57
- * Clones an object.
58
- * Non-object values are returned unchanged.
59
- *
60
- * @param {*} object Object to clone.
61
- * @return {*} Cloned object, or original literal non-object value.
62
- */
63
-
64
-
65
- function cloneObject(object) {
66
- if (typeof object === 'object') {
67
- return { ...Object.fromEntries(Object.entries(object).map(_ref2 => {
68
- let [key, value] = _ref2;
69
- return [key, cloneObject(value)];
70
- }))
71
- };
72
- }
73
-
74
- return object;
75
- }
76
- /**
77
- * Perform an immutable set.
78
- * Handles nullish initial values.
79
- * Clones all nested objects in the specified object.
80
- *
81
- * @param {Object} object Object to set a value in.
82
- * @param {number|string|Array} path Path in the object to modify.
83
- * @param {*} value New value to set.
84
- * @return {Object} Cloned object with the new value set.
85
- */
86
-
87
-
88
- export function immutableSet(object, path, value) {
89
- const normalizedPath = normalizePath(path);
90
- const newObject = object ? cloneObject(object) : {};
91
- normalizedPath.reduce((acc, key, i) => {
92
- if (acc[key] === undefined) {
93
- acc[key] = {};
94
- }
95
-
96
- if (i === normalizedPath.length - 1) {
97
- acc[key] = value;
98
- }
99
-
100
- return acc[key];
101
- }, newObject);
102
- return newObject;
103
- }
104
36
  export function transformStyles(activeSupports, migrationPaths, result, source, index, results) {
105
37
  var _source$;
106
38
 
@@ -134,8 +66,8 @@ export function transformStyles(activeSupports, migrationPaths, result, source,
134
66
  }
135
67
 
136
68
  let returnBlock = result;
137
- Object.entries(activeSupports).forEach(_ref3 => {
138
- let [support, isActive] = _ref3;
69
+ Object.entries(activeSupports).forEach(_ref2 => {
70
+ let [support, isActive] = _ref2;
139
71
 
140
72
  if (isActive) {
141
73
  migrationPaths[support].forEach(path => {
@@ -190,6 +122,7 @@ export function useBlockSettings(name, parentLayout) {
190
122
  const fontStyle = useSetting('typography.fontStyle');
191
123
  const fontWeight = useSetting('typography.fontWeight');
192
124
  const lineHeight = useSetting('typography.lineHeight');
125
+ const textColumns = useSetting('typography.textColumns');
193
126
  const textDecoration = useSetting('typography.textDecoration');
194
127
  const textTransform = useSetting('typography.textTransform');
195
128
  const letterSpacing = useSetting('typography.letterSpacing');
@@ -200,8 +133,44 @@ export function useBlockSettings(name, parentLayout) {
200
133
  const units = useSetting('spacing.units');
201
134
  const minHeight = useSetting('dimensions.minHeight');
202
135
  const layout = useSetting('layout');
136
+ const borderColor = useSetting('border.color');
137
+ const borderRadius = useSetting('border.radius');
138
+ const borderStyle = useSetting('border.style');
139
+ const borderWidth = useSetting('border.width');
140
+ const customColorsEnabled = useSetting('color.custom');
141
+ const customColors = useSetting('color.palette.custom');
142
+ const themeColors = useSetting('color.palette.theme');
143
+ const defaultColors = useSetting('color.palette.default');
144
+ const defaultPalette = useSetting('color.defaultPalette');
145
+ const userGradientPalette = useSetting('color.gradients.custom');
146
+ const themeGradientPalette = useSetting('color.gradients.theme');
147
+ const defaultGradientPalette = useSetting('color.gradients.default');
148
+ const defaultGradients = useSetting('color.defaultGradients');
149
+ const areCustomGradientsEnabled = useSetting('color.customGradient');
150
+ const isBackgroundEnabled = useSetting('color.background');
151
+ const isLinkEnabled = useSetting('color.link');
152
+ const isTextEnabled = useSetting('color.text');
203
153
  const rawSettings = useMemo(() => {
204
154
  return {
155
+ color: {
156
+ palette: {
157
+ custom: customColors,
158
+ theme: themeColors,
159
+ default: defaultColors
160
+ },
161
+ gradients: {
162
+ custom: userGradientPalette,
163
+ theme: themeGradientPalette,
164
+ default: defaultGradientPalette
165
+ },
166
+ defaultGradients,
167
+ defaultPalette,
168
+ custom: customColorsEnabled,
169
+ customGradient: areCustomGradientsEnabled,
170
+ background: isBackgroundEnabled,
171
+ link: isLinkEnabled,
172
+ text: isTextEnabled
173
+ },
205
174
  typography: {
206
175
  fontFamilies: {
207
176
  custom: fontFamilies
@@ -213,6 +182,7 @@ export function useBlockSettings(name, parentLayout) {
213
182
  fontStyle,
214
183
  fontWeight,
215
184
  lineHeight,
185
+ textColumns,
216
186
  textDecoration,
217
187
  textTransform,
218
188
  letterSpacing
@@ -226,13 +196,19 @@ export function useBlockSettings(name, parentLayout) {
226
196
  blockGap,
227
197
  units
228
198
  },
199
+ border: {
200
+ color: borderColor,
201
+ radius: borderRadius,
202
+ style: borderStyle,
203
+ width: borderWidth
204
+ },
229
205
  dimensions: {
230
206
  minHeight
231
207
  },
232
208
  layout,
233
209
  parentLayout
234
210
  };
235
- }, [fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textDecoration, textTransform, letterSpacing, padding, margin, blockGap, spacingSizes, units, minHeight, layout, parentLayout]);
211
+ }, [fontFamilies, fontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textColumns, textDecoration, textTransform, letterSpacing, padding, margin, blockGap, spacingSizes, units, minHeight, layout, parentLayout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, themeColors, defaultColors, defaultPalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled]);
236
212
  return useSettingsForBlockElement(rawSettings, name);
237
213
  }
238
214
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/utils.js"],"names":["isEmpty","mapValues","get","getBlockSupport","useMemo","useSetting","useSettingsForBlockElement","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","fromEntries","entries","filter","value","Boolean","undefined","normalizePath","path","toString","cloneObject","map","key","immutableSet","normalizedPath","newObject","reduce","acc","i","length","transformStyles","activeSupports","migrationPaths","result","source","index","results","values","every","isActive","innerBlocks","referenceBlockAttributes","attributes","returnBlock","forEach","support","styleValue","shouldSkipSerialization","blockType","featureSet","feature","skipSerialization","__experimentalSkipSerialization","includes","useBlockSettings","name","parentLayout","fontFamilies","fontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textDecoration","textTransform","letterSpacing","padding","margin","blockGap","spacingSizes","units","minHeight","layout","rawSettings","typography","custom","spacing","dimensions"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,SAAlB,EAA6BC,GAA7B,QAAwC,QAAxC;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,eAA3B;AACA,SAASC,0BAAT,QAA2C,mCAA3C;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,gBAAgB,GAAKC,MAAF,IAAc;AAC7C,MACCA,MAAM,KAAK,IAAX,IACA,OAAOA,MAAP,KAAkB,QADlB,IAEAC,KAAK,CAACC,OAAN,CAAeF,MAAf,CAHD,EAIE;AACD,WAAOA,MAAP;AACA;;AACD,QAAMG,oBAAoB,GAAGC,MAAM,CAACC,WAAP,CAC5BD,MAAM,CAACE,OAAP,CAAgBb,SAAS,CAAEO,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AA,MALQ;AAMRC,QAAAA,QANQ;AAORE,QAAAA;AAPQ,OAhBH;AAyBNO,MAAAA,UAAU,EAAE;AACXN,QAAAA;AADW,OAzBN;AA4BNC,MAAAA,MA5BM;AA6BNhB,MAAAA;AA7BM,KAAP;AA+BA,GAhC0B,EAgCxB,CACFC,YADE,EAEFC,SAFE,EAGFC,cAHE,EAIFC,SAJE,EAKFC,UALE,EAMFC,UANE,EAOFC,cAPE,EAQFC,aARE,EASFC,aATE,EAUFC,OAVE,EAWFC,MAXE,EAYFC,QAZE,EAaFC,YAbE,EAcFC,KAdE,EAeFC,SAfE,EAgBFC,MAhBE,EAiBFhB,YAjBE,CAhCwB,CAA3B;AAoDA,SAAOpD,0BAA0B,CAAEqE,WAAF,EAAelB,IAAf,CAAjC;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, mapValues, get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\tconst cleanedNestedObjects = Object.fromEntries(\n\t\tObject.entries( mapValues( object, cleanEmptyObject ) ).filter(\n\t\t\t( [ , value ] ) => Boolean( value )\n\t\t)\n\t);\n\treturn isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;\n};\n\n/**\n * Converts a path to an array of its fragments.\n * Supports strings, numbers and arrays:\n *\n * 'foo' => [ 'foo' ]\n * 2 => [ '2' ]\n * [ 'foo', 'bar' ] => [ 'foo', 'bar' ]\n *\n * @param {string|number|Array} path Path\n * @return {Array} Normalized path.\n */\nfunction normalizePath( path ) {\n\tif ( Array.isArray( path ) ) {\n\t\treturn path;\n\t} else if ( typeof path === 'number' ) {\n\t\treturn [ path.toString() ];\n\t}\n\n\treturn [ path ];\n}\n\n/**\n * Clones an object.\n * Non-object values are returned unchanged.\n *\n * @param {*} object Object to clone.\n * @return {*} Cloned object, or original literal non-object value.\n */\nfunction cloneObject( object ) {\n\tif ( typeof object === 'object' ) {\n\t\treturn {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( object ).map( ( [ key, value ] ) => [\n\t\t\t\t\tkey,\n\t\t\t\t\tcloneObject( value ),\n\t\t\t\t] )\n\t\t\t),\n\t\t};\n\t}\n\n\treturn object;\n}\n\n/**\n * Perform an immutable set.\n * Handles nullish initial values.\n * Clones all nested objects in the specified object.\n *\n * @param {Object} object Object to set a value in.\n * @param {number|string|Array} path Path in the object to modify.\n * @param {*} value New value to set.\n * @return {Object} Cloned object with the new value set.\n */\nexport function immutableSet( object, path, value ) {\n\tconst normalizedPath = normalizePath( path );\n\tconst newObject = object ? cloneObject( object ) : {};\n\n\tnormalizedPath.reduce( ( acc, key, i ) => {\n\t\tif ( acc[ key ] === undefined ) {\n\t\t\tacc[ key ] = {};\n\t\t}\n\t\tif ( i === normalizedPath.length - 1 ) {\n\t\t\tacc[ key ] = value;\n\t\t}\n\t\treturn acc[ key ];\n\t}, newObject );\n\n\treturn newObject;\n}\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tObject.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = get( referenceBlockAttributes, path );\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: immutableSet(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization( blockType, featureSet, feature ) {\n\tconst support = getBlockSupport( blockType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst customFontSize = useSetting( 'typography.customFontSize' );\n\tconst fontStyle = useSetting( 'typography.fontStyle' );\n\tconst fontWeight = useSetting( 'typography.fontWeight' );\n\tconst lineHeight = useSetting( 'typography.lineHeight' );\n\tconst textDecoration = useSetting( 'typography.textDecoration' );\n\tconst textTransform = useSetting( 'typography.textTransform' );\n\tconst letterSpacing = useSetting( 'typography.letterSpacing' );\n\tconst padding = useSetting( 'spacing.padding' );\n\tconst margin = useSetting( 'spacing.margin' );\n\tconst blockGap = useSetting( 'spacing.blockGap' );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\tconst units = useSetting( 'spacing.units' );\n\tconst minHeight = useSetting( 'dimensions.minHeight' );\n\tconst layout = useSetting( 'layout' );\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: fontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: fontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: spacingSizes,\n\t\t\t\t},\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\tminHeight,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t};\n\t}, [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\tminHeight,\n\t\tlayout,\n\t\tparentLayout,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/utils.js"],"names":["isEmpty","mapValues","get","getBlockSupport","useMemo","useSetting","useSettingsForBlockElement","immutableSet","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","fromEntries","entries","filter","value","Boolean","undefined","transformStyles","activeSupports","migrationPaths","result","source","index","results","values","every","isActive","length","innerBlocks","referenceBlockAttributes","attributes","returnBlock","forEach","support","path","styleValue","shouldSkipSerialization","blockType","featureSet","feature","skipSerialization","__experimentalSkipSerialization","includes","useBlockSettings","name","parentLayout","fontFamilies","fontSizes","customFontSize","fontStyle","fontWeight","lineHeight","textColumns","textDecoration","textTransform","letterSpacing","padding","margin","blockGap","spacingSizes","units","minHeight","layout","borderColor","borderRadius","borderStyle","borderWidth","customColorsEnabled","customColors","themeColors","defaultColors","defaultPalette","userGradientPalette","themeGradientPalette","defaultGradientPalette","defaultGradients","areCustomGradientsEnabled","isBackgroundEnabled","isLinkEnabled","isTextEnabled","rawSettings","color","palette","custom","theme","default","gradients","customGradient","background","link","text","typography","spacing","border","radius","style","width","dimensions"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,SAAlB,EAA6BC,GAA7B,QAAwC,QAAxC;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,eAA3B;AACA,SAASC,0BAAT,QAA2C,mCAA3C;AACA,SAASC,YAAT,QAA6B,iBAA7B;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,gBAAgB,GAAKC,MAAF,IAAc;AAC7C,MACCA,MAAM,KAAK,IAAX,IAC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A0B,CAAE6E,WAAF,EAAepC,IAAf,CAAjC;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty, mapValues, get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../components';\nimport { useSettingsForBlockElement } from '../components/global-styles/hooks';\nimport { immutableSet } from '../utils/object';\n\n/**\n * Removed falsy values from nested object.\n *\n * @param {*} object\n * @return {*} Object cleaned from falsy values\n */\nexport const cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\tconst cleanedNestedObjects = Object.fromEntries(\n\t\tObject.entries( mapValues( object, cleanEmptyObject ) ).filter(\n\t\t\t( [ , value ] ) => Boolean( value )\n\t\t)\n\t);\n\treturn isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;\n};\n\nexport function transformStyles(\n\tactiveSupports,\n\tmigrationPaths,\n\tresult,\n\tsource,\n\tindex,\n\tresults\n) {\n\t// If there are no active supports return early.\n\tif (\n\t\tObject.values( activeSupports ?? {} ).every(\n\t\t\t( isActive ) => ! isActive\n\t\t)\n\t) {\n\t\treturn result;\n\t}\n\t// If the condition verifies we are probably in the presence of a wrapping transform\n\t// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.\n\tif ( results.length === 1 && result.innerBlocks.length === source.length ) {\n\t\treturn result;\n\t}\n\t// For cases where we have a transform from one block to multiple blocks\n\t// or multiple blocks to one block we apply the styles of the first source block\n\t// to the result(s).\n\tlet referenceBlockAttributes = source[ 0 ]?.attributes;\n\t// If we are in presence of transform between more than one block in the source\n\t// that has more than one block in the result\n\t// we apply the styles on source N to the result N,\n\t// if source N does not exists we do nothing.\n\tif ( results.length > 1 && source.length > 1 ) {\n\t\tif ( source[ index ] ) {\n\t\t\treferenceBlockAttributes = source[ index ]?.attributes;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n\tlet returnBlock = result;\n\tObject.entries( activeSupports ).forEach( ( [ support, isActive ] ) => {\n\t\tif ( isActive ) {\n\t\t\tmigrationPaths[ support ].forEach( ( path ) => {\n\t\t\t\tconst styleValue = get( referenceBlockAttributes, path );\n\t\t\t\tif ( styleValue ) {\n\t\t\t\t\treturnBlock = {\n\t\t\t\t\t\t...returnBlock,\n\t\t\t\t\t\tattributes: immutableSet(\n\t\t\t\t\t\t\treturnBlock.attributes,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tstyleValue\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\treturn returnBlock;\n}\n\n/**\n * Check whether serialization of specific block support feature or set should\n * be skipped.\n *\n * @param {string|Object} blockType Block name or block type object.\n * @param {string} featureSet Name of block support feature set.\n * @param {string} feature Name of the individual feature to check.\n *\n * @return {boolean} Whether serialization should occur.\n */\nexport function shouldSkipSerialization( blockType, featureSet, feature ) {\n\tconst support = getBlockSupport( blockType, featureSet );\n\tconst skipSerialization = support?.__experimentalSkipSerialization;\n\n\tif ( Array.isArray( skipSerialization ) ) {\n\t\treturn skipSerialization.includes( feature );\n\t}\n\n\treturn skipSerialization;\n}\n\n/**\n * Based on the block and its context, returns an object of all the block settings.\n * This object can be passed as a prop to all the Styles UI components\n * (TypographyPanel, DimensionsPanel...).\n *\n * @param {string} name Block name.\n * @param {*} parentLayout Parent layout.\n *\n * @return {Object} Settings object.\n */\nexport function useBlockSettings( name, parentLayout ) {\n\tconst fontFamilies = useSetting( 'typography.fontFamilies' );\n\tconst fontSizes = useSetting( 'typography.fontSizes' );\n\tconst customFontSize = useSetting( 'typography.customFontSize' );\n\tconst fontStyle = useSetting( 'typography.fontStyle' );\n\tconst fontWeight = useSetting( 'typography.fontWeight' );\n\tconst lineHeight = useSetting( 'typography.lineHeight' );\n\tconst textColumns = useSetting( 'typography.textColumns' );\n\tconst textDecoration = useSetting( 'typography.textDecoration' );\n\tconst textTransform = useSetting( 'typography.textTransform' );\n\tconst letterSpacing = useSetting( 'typography.letterSpacing' );\n\tconst padding = useSetting( 'spacing.padding' );\n\tconst margin = useSetting( 'spacing.margin' );\n\tconst blockGap = useSetting( 'spacing.blockGap' );\n\tconst spacingSizes = useSetting( 'spacing.spacingSizes' );\n\tconst units = useSetting( 'spacing.units' );\n\tconst minHeight = useSetting( 'dimensions.minHeight' );\n\tconst layout = useSetting( 'layout' );\n\tconst borderColor = useSetting( 'border.color' );\n\tconst borderRadius = useSetting( 'border.radius' );\n\tconst borderStyle = useSetting( 'border.style' );\n\tconst borderWidth = useSetting( 'border.width' );\n\tconst customColorsEnabled = useSetting( 'color.custom' );\n\tconst customColors = useSetting( 'color.palette.custom' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst defaultColors = useSetting( 'color.palette.default' );\n\tconst defaultPalette = useSetting( 'color.defaultPalette' );\n\tconst userGradientPalette = useSetting( 'color.gradients.custom' );\n\tconst themeGradientPalette = useSetting( 'color.gradients.theme' );\n\tconst defaultGradientPalette = useSetting( 'color.gradients.default' );\n\tconst defaultGradients = useSetting( 'color.defaultGradients' );\n\tconst areCustomGradientsEnabled = useSetting( 'color.customGradient' );\n\tconst isBackgroundEnabled = useSetting( 'color.background' );\n\tconst isLinkEnabled = useSetting( 'color.link' );\n\tconst isTextEnabled = useSetting( 'color.text' );\n\n\tconst rawSettings = useMemo( () => {\n\t\treturn {\n\t\t\tcolor: {\n\t\t\t\tpalette: {\n\t\t\t\t\tcustom: customColors,\n\t\t\t\t\ttheme: themeColors,\n\t\t\t\t\tdefault: defaultColors,\n\t\t\t\t},\n\t\t\t\tgradients: {\n\t\t\t\t\tcustom: userGradientPalette,\n\t\t\t\t\ttheme: themeGradientPalette,\n\t\t\t\t\tdefault: defaultGradientPalette,\n\t\t\t\t},\n\t\t\t\tdefaultGradients,\n\t\t\t\tdefaultPalette,\n\t\t\t\tcustom: customColorsEnabled,\n\t\t\t\tcustomGradient: areCustomGradientsEnabled,\n\t\t\t\tbackground: isBackgroundEnabled,\n\t\t\t\tlink: isLinkEnabled,\n\t\t\t\ttext: isTextEnabled,\n\t\t\t},\n\t\t\ttypography: {\n\t\t\t\tfontFamilies: {\n\t\t\t\t\tcustom: fontFamilies,\n\t\t\t\t},\n\t\t\t\tfontSizes: {\n\t\t\t\t\tcustom: fontSizes,\n\t\t\t\t},\n\t\t\t\tcustomFontSize,\n\t\t\t\tfontStyle,\n\t\t\t\tfontWeight,\n\t\t\t\tlineHeight,\n\t\t\t\ttextColumns,\n\t\t\t\ttextDecoration,\n\t\t\t\ttextTransform,\n\t\t\t\tletterSpacing,\n\t\t\t},\n\t\t\tspacing: {\n\t\t\t\tspacingSizes: {\n\t\t\t\t\tcustom: spacingSizes,\n\t\t\t\t},\n\t\t\t\tpadding,\n\t\t\t\tmargin,\n\t\t\t\tblockGap,\n\t\t\t\tunits,\n\t\t\t},\n\t\t\tborder: {\n\t\t\t\tcolor: borderColor,\n\t\t\t\tradius: borderRadius,\n\t\t\t\tstyle: borderStyle,\n\t\t\t\twidth: borderWidth,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\tminHeight,\n\t\t\t},\n\t\t\tlayout,\n\t\t\tparentLayout,\n\t\t};\n\t}, [\n\t\tfontFamilies,\n\t\tfontSizes,\n\t\tcustomFontSize,\n\t\tfontStyle,\n\t\tfontWeight,\n\t\tlineHeight,\n\t\ttextColumns,\n\t\ttextDecoration,\n\t\ttextTransform,\n\t\tletterSpacing,\n\t\tpadding,\n\t\tmargin,\n\t\tblockGap,\n\t\tspacingSizes,\n\t\tunits,\n\t\tminHeight,\n\t\tlayout,\n\t\tparentLayout,\n\t\tborderColor,\n\t\tborderRadius,\n\t\tborderStyle,\n\t\tborderWidth,\n\t\tcustomColorsEnabled,\n\t\tcustomColors,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tdefaultPalette,\n\t\tuserGradientPalette,\n\t\tthemeGradientPalette,\n\t\tdefaultGradientPalette,\n\t\tdefaultGradients,\n\t\tareCustomGradientsEnabled,\n\t\tisBackgroundEnabled,\n\t\tisLinkEnabled,\n\t\tisTextEnabled,\n\t] );\n\n\treturn useSettingsForBlockElement( rawSettings, name );\n}\n"]}
@@ -21,13 +21,17 @@ export default {
21
21
  inspectorControls: function DefaultLayoutInspectorControls(_ref) {
22
22
  let {
23
23
  layout,
24
- onChange
24
+ onChange,
25
+ layoutBlockSupport = {}
25
26
  } = _ref;
26
27
  const {
27
28
  wideSize,
28
29
  contentSize,
29
30
  justifyContent = 'center'
30
31
  } = layout;
32
+ const {
33
+ allowJustification = true
34
+ } = layoutBlockSupport;
31
35
 
32
36
  const onJustificationChange = value => {
33
37
  onChange({ ...layout,
@@ -89,7 +93,7 @@ export default {
89
93
  icon: stretchWide
90
94
  }))), createElement("p", {
91
95
  className: "block-editor-hooks__layout-controls-helptext"
92
- }, __('Customize the width for all elements that are assigned to the center or wide columns.')), createElement(ToggleGroupControl, {
96
+ }, __('Customize the width for all elements that are assigned to the center or wide columns.')), allowJustification && createElement(ToggleGroupControl, {
93
97
  __nextHasNoMarginBottom: true,
94
98
  label: __('Justification'),
95
99
  value: justifyContent,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/layouts/constrained.js"],"names":["__experimentalUseCustomUnits","useCustomUnits","__experimentalUnitControl","UnitControl","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOptionIcon","ToggleGroupControlOptionIcon","__","Icon","positionCenter","stretchWide","justifyLeft","justifyCenter","justifyRight","getCSSRules","useSetting","appendSelectors","getBlockGapCSS","getAlignmentsInfo","getGapCSSValue","shouldSkipSerialization","name","label","inspectorControls","DefaultLayoutInspectorControls","layout","onChange","wideSize","contentSize","justifyContent","onJustificationChange","value","justificationOptions","icon","units","availableUnits","nextWidth","parseFloat","map","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","blockGapStyleValue","spacing","blockGap","blockGapValue","top","marginLeft","marginRight","output","padding","paddingValues","forEach","rule","key","getOrientation","getAlignments","alignmentInfo","alignments","undefined","includes","unshift","alignment","info","wide","none"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,4BAA4B,IAAIC,cADjC,EAECC,yBAAyB,IAAIC,WAF9B,EAGCC,gCAAgC,IAAIC,kBAHrC,EAICC,0CAA0C,IAAIC,4BAJ/C,QAKO,uBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,IADD,EAECC,cAFD,EAGCC,WAHD,EAICC,WAJD,EAKCC,aALD,EAMCC,YAND,QAOO,kBAPP;AAQA,SAASC,WAAT,QAA4B,yBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,eAAT,EAA0BC,cAA1B,EAA0CC,iBAA1C,QAAmE,SAAnE;AACA,SAASC,cAAT,QAA+B,cAA/B;AACA,SAASC,uBAAT,QAAwC,gBAAxC;AAEA,eAAe;AACdC,EAAAA,IAAI,EAAE,aADQ;AAEdC,EAAAA,KAAK,EAAEf,EAAE,CAAE,aAAF,CAFK;AAGdgB,EAAAA,iBAAiB,EAAE,SAASC,8BAAT,OAGf;AAAA,QAHwD;AAC3DC,MAAAA,MAD2D;AAE3DC,MAAAA;AAF2D,KAGxD;AACH,UAAM;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,WAAZ;AAAyBC,MAAAA,cAAc,GAAG;AAA1C,QAAuDJ,MAA7D;;AACA,UAAMK,qBAAqB,GAAKC,KAAF,IAAa;AAC1CL,MAAAA,QAAQ,CAAE,EACT,GAAGD,MADM;AAETI,QAAAA,cAAc,EAAEE;AAFP,OAAF,CAAR;AAIA,KALD;;AAMA,UAAMC,oBAAoB,GAAG,CAC5B;AACCD,MAAAA,KAAK,EAAE,MADR;AAECE,MAAAA,IAAI,EAAEtB,WAFP;AAGCW,MAAAA,KAAK,EAA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aAAa,CAACQ;AAApC,KAApB;AAEA,WAAOP,UAAP;AACA;;AAjPa,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tIcon,\n\tpositionCenter,\n\tstretchWide,\n\tjustifyLeft,\n\tjustifyCenter,\n\tjustifyRight,\n} 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, justifyContent = 'center' } = layout;\n\t\tconst onJustificationChange = ( value ) => {\n\t\t\tonChange( {\n\t\t\t\t...layout,\n\t\t\t\tjustifyContent: value,\n\t\t\t} );\n\t\t};\n\t\tconst justificationOptions = [\n\t\t\t{\n\t\t\t\tvalue: 'left',\n\t\t\t\ticon: justifyLeft,\n\t\t\t\tlabel: __( 'Justify items left' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: 'center',\n\t\t\t\ticon: justifyCenter,\n\t\t\t\tlabel: __( 'Justify items center' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: 'right',\n\t\t\t\ticon: justifyRight,\n\t\t\t\tlabel: __( 'Justify items right' ),\n\t\t\t},\n\t\t];\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\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\tclassName=\"block-editor-hooks__layout-controls-unit-input\"\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\tclassName=\"block-editor-hooks__layout-controls-unit-input\"\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<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\t<ToggleGroupControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Justification' ) }\n\t\t\t\t\tvalue={ justifyContent }\n\t\t\t\t\tonChange={ onJustificationChange }\n\t\t\t\t>\n\t\t\t\t\t{ justificationOptions.map( ( { value, icon, label } ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\tlabel={ label }\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</ToggleGroupControl>\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, justifyContent } = 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\tconst marginLeft =\n\t\t\tjustifyContent === 'left' ? '0 !important' : 'auto !important';\n\t\tconst marginRight =\n\t\t\tjustifyContent === 'right' ? '0 !important' : 'auto !important';\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: ${ marginLeft };\n\t\t\t\t\t\tmargin-right: ${ marginRight };\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\tif ( justifyContent === 'left' ) {\n\t\t\toutput += `${ appendSelectors(\n\t\t\t\tselector,\n\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t) }\n\t\t\t{ margin-left: ${ marginLeft }; }`;\n\t\t} else if ( justifyContent === 'right' ) {\n\t\t\toutput += `${ appendSelectors(\n\t\t\t\tselector,\n\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t) }\n\t\t\t{ margin-right: ${ marginRight }; }`;\n\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"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/layouts/constrained.js"],"names":["__experimentalUseCustomUnits","useCustomUnits","__experimentalUnitControl","UnitControl","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOptionIcon","ToggleGroupControlOptionIcon","__","Icon","positionCenter","stretchWide","justifyLeft","justifyCenter","justifyRight","getCSSRules","useSetting","appendSelectors","getBlockGapCSS","getAlignmentsInfo","getGapCSSValue","shouldSkipSerialization","name","label","inspectorControls","DefaultLayoutInspectorControls","layout","onChange","layoutBlockSupport","wideSize","contentSize","justifyContent","allowJustification","onJustificationChange","value","justificationOptions","icon","units","availableUnits","nextWidth","parseFloat","map","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","blockGapStyleValue","spacing","blockGap","blockGapValue","top","marginLeft","marginRight","output","padding","paddingValues","forEach","rule","key","getOrientation","getAlignments","alignmentInfo","alignments","undefined","includes","unshift","alignment","info","wide","none"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,4BAA4B,IAAIC,cADjC,EAECC,yBAAyB,IAAIC,WAF9B,EAGCC,gCAAgC,IAAIC,kBAHrC,EAICC,0CAA0C,IAAIC,4BAJ/C,QAKO,uBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,IADD,EAECC,cAFD,EAGCC,WAHD,EAICC,WAJD,EAKCC,aALD,EAMCC,YAND,QAOO,kBAPP;AAQA,SAASC,WAAT,QAA4B,yBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,eAAT,EAA0BC,cAA1B,EAA0C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AACwC,UAAP,CAAkBzB,GAAlB,CAAyB6B,SAAF,KAAmB;AAChDhD,QAAAA,IAAI,EAAEgD,SAD0C;AAEhDC,QAAAA,IAAI,EAAEN,aAAa,CAAEK,SAAF;AAF6B,OAAnB,CAAvB,CAAP;AAIA;;AACD,UAAM;AAAExC,MAAAA,WAAF;AAAeD,MAAAA;AAAf,QAA4BH,MAAlC;AAEA,UAAMwC,UAAU,GAAG,CAClB;AAAE5C,MAAAA,IAAI,EAAE;AAAR,KADkB,EAElB;AAAEA,MAAAA,IAAI,EAAE;AAAR,KAFkB,EAGlB;AAAEA,MAAAA,IAAI,EAAE;AAAR,KAHkB,CAAnB;;AAMA,QAAKQ,WAAL,EAAmB;AAClBoC,MAAAA,UAAU,CAACG,OAAX,CAAoB;AAAE/C,QAAAA,IAAI,EAAE;AAAR,OAApB;AACA;;AAED,QAAKO,QAAL,EAAgB;AACfqC,MAAAA,UAAU,CAACG,OAAX,CAAoB;AAAE/C,QAAAA,IAAI,EAAE,MAAR;AAAgBiD,QAAAA,IAAI,EAAEN,aAAa,CAACO;AAApC,OAApB;AACA;;AAEDN,IAAAA,UAAU,CAACG,OAAX,CAAoB;AAAE/C,MAAAA,IAAI,EAAE,MAAR;AAAgBiD,MAAAA,IAAI,EAAEN,aAAa,CAACQ;AAApC,KAApB;AAEA,WAAOP,UAAP;AACA;;AAvPa,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tIcon,\n\tpositionCenter,\n\tstretchWide,\n\tjustifyLeft,\n\tjustifyCenter,\n\tjustifyRight,\n} 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\tlayoutBlockSupport = {},\n\t} ) {\n\t\tconst { wideSize, contentSize, justifyContent = 'center' } = layout;\n\t\tconst { allowJustification = true } = layoutBlockSupport;\n\t\tconst onJustificationChange = ( value ) => {\n\t\t\tonChange( {\n\t\t\t\t...layout,\n\t\t\t\tjustifyContent: value,\n\t\t\t} );\n\t\t};\n\t\tconst justificationOptions = [\n\t\t\t{\n\t\t\t\tvalue: 'left',\n\t\t\t\ticon: justifyLeft,\n\t\t\t\tlabel: __( 'Justify items left' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: 'center',\n\t\t\t\ticon: justifyCenter,\n\t\t\t\tlabel: __( 'Justify items center' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: 'right',\n\t\t\t\ticon: justifyRight,\n\t\t\t\tlabel: __( 'Justify items right' ),\n\t\t\t},\n\t\t];\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\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\tclassName=\"block-editor-hooks__layout-controls-unit-input\"\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\tclassName=\"block-editor-hooks__layout-controls-unit-input\"\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<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\t{ allowJustification && (\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Justification' ) }\n\t\t\t\t\t\tvalue={ justifyContent }\n\t\t\t\t\t\tonChange={ onJustificationChange }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ justificationOptions.map(\n\t\t\t\t\t\t\t( { value, icon, label } ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\t\t\t\t\tkey={ value }\n\t\t\t\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\tlabel={ label }\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}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t) }\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, justifyContent } = 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\tconst marginLeft =\n\t\t\tjustifyContent === 'left' ? '0 !important' : 'auto !important';\n\t\tconst marginRight =\n\t\t\tjustifyContent === 'right' ? '0 !important' : 'auto !important';\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: ${ marginLeft };\n\t\t\t\t\t\tmargin-right: ${ marginRight };\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\tif ( justifyContent === 'left' ) {\n\t\t\toutput += `${ appendSelectors(\n\t\t\t\tselector,\n\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t) }\n\t\t\t{ margin-left: ${ marginLeft }; }`;\n\t\t} else if ( justifyContent === 'right' ) {\n\t\t\toutput += `${ appendSelectors(\n\t\t\t\tselector,\n\t\t\t\t'> :where(:not(.alignleft):not(.alignright):not(.alignfull))'\n\t\t\t) }\n\t\t\t{ margin-right: ${ marginRight }; }`;\n\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"]}
@@ -0,0 +1,151 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { __ } from '@wordpress/i18n';
7
+ import { BaseControl, Flex, FlexItem, RangeControl, __experimentalUnitControl as UnitControl, __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue } from '@wordpress/components';
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+
12
+ import { appendSelectors, getBlockGapCSS } from './utils';
13
+ import { getGapCSSValue } from '../hooks/gap';
14
+ import { shouldSkipSerialization } from '../hooks/utils';
15
+ const RANGE_CONTROL_MAX_VALUES = {
16
+ px: 600,
17
+ '%': 100,
18
+ vw: 100,
19
+ vh: 100,
20
+ em: 38,
21
+ rem: 38
22
+ };
23
+ export default {
24
+ name: 'grid',
25
+ label: __('Grid'),
26
+ inspectorControls: function GridLayoutInspectorControls(_ref) {
27
+ let {
28
+ layout = {},
29
+ onChange
30
+ } = _ref;
31
+ return createElement(GridLayoutMinimumWidthControl, {
32
+ layout: layout,
33
+ onChange: onChange
34
+ });
35
+ },
36
+ toolBarControls: function DefaultLayoutToolbarControls() {
37
+ return null;
38
+ },
39
+ getLayoutStyle: function getLayoutStyle(_ref2) {
40
+ var _style$spacing, _style$spacing2;
41
+
42
+ let {
43
+ selector,
44
+ layout,
45
+ style,
46
+ blockName,
47
+ hasBlockGapSupport,
48
+ layoutDefinitions
49
+ } = _ref2;
50
+ const {
51
+ minimumColumnWidth = '12rem'
52
+ } = layout; // If a block's block.json skips serialization for spacing or spacing.blockGap,
53
+ // don't apply the user-defined value to the styles.
54
+
55
+ 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;
56
+ let output = '';
57
+ const rules = [];
58
+
59
+ if (minimumColumnWidth) {
60
+ rules.push(`grid-template-columns: repeat(auto-fill, minmax(min(${minimumColumnWidth}, 100%), 1fr))`);
61
+ }
62
+
63
+ if (rules.length) {
64
+ // Reason to disable: the extra line breaks added by prettier mess with the unit tests.
65
+ // eslint-disable-next-line prettier/prettier
66
+ output = `${appendSelectors(selector)} { ${rules.join('; ')}; }`;
67
+ } // Output blockGap styles based on rules contained in layout definitions in theme.json.
68
+
69
+
70
+ if (hasBlockGapSupport && blockGapValue) {
71
+ output += getBlockGapCSS(selector, layoutDefinitions, 'grid', blockGapValue);
72
+ }
73
+
74
+ return output;
75
+ },
76
+
77
+ getOrientation() {
78
+ return 'horizontal';
79
+ },
80
+
81
+ getAlignments() {
82
+ return [];
83
+ }
84
+
85
+ }; // Enables setting minimum width of grid items.
86
+
87
+ function GridLayoutMinimumWidthControl(_ref3) {
88
+ let {
89
+ layout,
90
+ onChange
91
+ } = _ref3;
92
+ const {
93
+ minimumColumnWidth: value = '12rem'
94
+ } = layout;
95
+ const [quantity, unit] = parseQuantityAndUnitFromRawValue(value);
96
+
97
+ const handleSliderChange = next => {
98
+ onChange({ ...layout,
99
+ minimumColumnWidth: [next, unit].join('')
100
+ });
101
+ }; // Mostly copied from HeightControl.
102
+
103
+
104
+ const handleUnitChange = newUnit => {
105
+ // Attempt to smooth over differences between currentUnit and newUnit.
106
+ // This should slightly improve the experience of switching between unit types.
107
+ let newValue;
108
+
109
+ if (['em', 'rem'].includes(newUnit) && unit === 'px') {
110
+ // Convert pixel value to an approximate of the new unit, assuming a root size of 16px.
111
+ newValue = (quantity / 16).toFixed(2) + newUnit;
112
+ } else if (['em', 'rem'].includes(unit) && newUnit === 'px') {
113
+ // Convert to pixel value assuming a root size of 16px.
114
+ newValue = Math.round(quantity * 16) + newUnit;
115
+ } else if (['vh', 'vw', '%'].includes(newUnit) && quantity > 100) {
116
+ // When converting to `vh`, `vw`, or `%` units, cap the new value at 100.
117
+ newValue = 100 + newUnit;
118
+ }
119
+
120
+ onChange({ ...layout,
121
+ minimumColumnWidth: newValue
122
+ });
123
+ };
124
+
125
+ return createElement("fieldset", null, createElement(BaseControl.VisualLabel, {
126
+ as: "legend"
127
+ }, __('Minimum column width')), createElement(Flex, {
128
+ gap: 4
129
+ }, createElement(FlexItem, {
130
+ isBlock: true
131
+ }, createElement(UnitControl, {
132
+ size: '__unstable-large',
133
+ onChange: newValue => {
134
+ onChange({ ...layout,
135
+ minimumColumnWidth: newValue
136
+ });
137
+ },
138
+ onUnitChange: handleUnitChange,
139
+ value: value,
140
+ min: 0
141
+ })), createElement(FlexItem, {
142
+ isBlock: true
143
+ }, createElement(RangeControl, {
144
+ onChange: handleSliderChange,
145
+ value: quantity,
146
+ min: 0,
147
+ max: RANGE_CONTROL_MAX_VALUES[unit] || 600,
148
+ withInputField: false
149
+ }))));
150
+ }
151
+ //# sourceMappingURL=grid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/layouts/grid.js"],"names":["__","BaseControl","Flex","FlexItem","RangeControl","__experimentalUnitControl","UnitControl","__experimentalParseQuantityAndUnitFromRawValue","parseQuantityAndUnitFromRawValue","appendSelectors","getBlockGapCSS","getGapCSSValue","shouldSkipSerialization","RANGE_CONTROL_MAX_VALUES","px","vw","vh","em","rem","name","label","inspectorControls","GridLayoutInspectorControls","layout","onChange","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","minimumColumnWidth","blockGapValue","spacing","blockGap","undefined","output","rules","push","length","join","getOrientation","getAlignments","GridLayoutMinimumWidthControl","value","quantity","unit","handleSliderChange","next","handleUnitChange","newUnit","newValue","includes","toFixed","Math","round"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA,SACCC,WADD,EAECC,IAFD,EAGCC,QAHD,EAICC,YAJD,EAKCC,yBAAyB,IAAIC,WAL9B,EAMCC,8CAA8C,IAAIC,gCANnD,QAOO,uBAPP;AASA;AACA;AACA;;AACA,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AVP,IADD,CADD,EAeC,cAAC,QAAD;AAAU,IAAA,OAAO;AAAjB,KACC,cAAC,YAAD;AACC,IAAA,QAAQ,EAAGG,kBADZ;AAEC,IAAA,KAAK,EAAGF,QAFT;AAGC,IAAA,GAAG,EAAG,CAHP;AAIC,IAAA,GAAG,EAAGlC,wBAAwB,CAAEmC,IAAF,CAAxB,IAAoC,GAJ3C;AAKC,IAAA,cAAc,EAAG;AALlB,IADD,CAfD,CAJD,CADD;AAgCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nimport {\n\tBaseControl,\n\tFlex,\n\tFlexItem,\n\tRangeControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { appendSelectors, getBlockGapCSS } from './utils';\nimport { getGapCSSValue } from '../hooks/gap';\nimport { shouldSkipSerialization } from '../hooks/utils';\n\nconst RANGE_CONTROL_MAX_VALUES = {\n\tpx: 600,\n\t'%': 100,\n\tvw: 100,\n\tvh: 100,\n\tem: 38,\n\trem: 38,\n};\n\nexport default {\n\tname: 'grid',\n\tlabel: __( 'Grid' ),\n\tinspectorControls: function GridLayoutInspectorControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t} ) {\n\t\treturn (\n\t\t\t<GridLayoutMinimumWidthControl\n\t\t\t\tlayout={ layout }\n\t\t\t\tonChange={ onChange }\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 { minimumColumnWidth = '12rem' } = 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\n\t\tlet output = '';\n\t\tconst rules = [];\n\n\t\tif ( minimumColumnWidth ) {\n\t\t\trules.push(\n\t\t\t\t`grid-template-columns: repeat(auto-fill, minmax(min(${ minimumColumnWidth }, 100%), 1fr))`\n\t\t\t);\n\t\t}\n\n\t\tif ( rules.length ) {\n\t\t\t// Reason to disable: the extra line breaks added by prettier mess with the unit tests.\n\t\t\t// eslint-disable-next-line prettier/prettier\n\t\t\toutput = `${ appendSelectors( selector ) } { ${ rules.join(\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'grid',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'horizontal';\n\t},\n\tgetAlignments() {\n\t\treturn [];\n\t},\n};\n\n// Enables setting minimum width of grid items.\nfunction GridLayoutMinimumWidthControl( { layout, onChange } ) {\n\tconst { minimumColumnWidth: value = '12rem' } = layout;\n\tconst [ quantity, unit ] = parseQuantityAndUnitFromRawValue( value );\n\n\tconst handleSliderChange = ( next ) => {\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tminimumColumnWidth: [ next, unit ].join( '' ),\n\t\t} );\n\t};\n\n\t// Mostly copied from HeightControl.\n\tconst handleUnitChange = ( newUnit ) => {\n\t\t// Attempt to smooth over differences between currentUnit and newUnit.\n\t\t// This should slightly improve the experience of switching between unit types.\n\t\tlet newValue;\n\n\t\tif ( [ 'em', 'rem' ].includes( newUnit ) && unit === 'px' ) {\n\t\t\t// Convert pixel value to an approximate of the new unit, assuming a root size of 16px.\n\t\t\tnewValue = ( quantity / 16 ).toFixed( 2 ) + newUnit;\n\t\t} else if ( [ 'em', 'rem' ].includes( unit ) && newUnit === 'px' ) {\n\t\t\t// Convert to pixel value assuming a root size of 16px.\n\t\t\tnewValue = Math.round( quantity * 16 ) + newUnit;\n\t\t} else if (\n\t\t\t[ 'vh', 'vw', '%' ].includes( newUnit ) &&\n\t\t\tquantity > 100\n\t\t) {\n\t\t\t// When converting to `vh`, `vw`, or `%` units, cap the new value at 100.\n\t\t\tnewValue = 100 + newUnit;\n\t\t}\n\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tminimumColumnWidth: newValue,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<fieldset>\n\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t{ __( 'Minimum column width' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Flex gap={ 4 }>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\tminimumColumnWidth: newValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonUnitChange={ handleUnitChange }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\t\t\tvalue={ quantity }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tmax={ RANGE_CONTROL_MAX_VALUES[ unit ] || 600 }\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</fieldset>\n\t);\n}\n"]}
@@ -4,7 +4,8 @@
4
4
  import flex from './flex';
5
5
  import flow from './flow';
6
6
  import constrained from './constrained';
7
- const layoutTypes = [flow, flex, constrained];
7
+ import grid from './grid';
8
+ const layoutTypes = [flow, flex, constrained, grid];
8
9
  /**
9
10
  * Retrieves a layout type by name.
10
11
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/layouts/index.js"],"names":["flex","flow","constrained","layoutTypes","getLayoutType","name","find","layoutType","getLayoutTypes"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAP,MAAiB,QAAjB;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AAEA,MAAMC,WAAW,GAAG,CAAEF,IAAF,EAAQD,IAAR,EAAcE,WAAd,CAApB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,aAAT,GAA2C;AAAA,MAAnBC,IAAmB,uEAAZ,SAAY;AACjD,SAAOF,WAAW,CAACG,IAAZ,CAAoBC,UAAF,IAAkBA,UAAU,CAACF,IAAX,KAAoBA,IAAxD,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,cAAT,GAA0B;AAChC,SAAOL,WAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport flex from './flex';\nimport flow from './flow';\nimport constrained from './constrained';\n\nconst layoutTypes = [ flow, flex, constrained ];\n\n/**\n * Retrieves a layout type by name.\n *\n * @param {string} name - The name of the layout type.\n * @return {Object} Layout type.\n */\nexport function getLayoutType( name = 'default' ) {\n\treturn layoutTypes.find( ( layoutType ) => layoutType.name === name );\n}\n\n/**\n * Retrieves the available layout types.\n *\n * @return {Array} Layout types.\n */\nexport function getLayoutTypes() {\n\treturn layoutTypes;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/layouts/index.js"],"names":["flex","flow","constrained","grid","layoutTypes","getLayoutType","name","find","layoutType","getLayoutTypes"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAP,MAAiB,QAAjB;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,OAAOC,IAAP,MAAiB,QAAjB;AAEA,MAAMC,WAAW,GAAG,CAAEH,IAAF,EAAQD,IAAR,EAAcE,WAAd,EAA2BC,IAA3B,CAApB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,aAAT,GAA2C;AAAA,MAAnBC,IAAmB,uEAAZ,SAAY;AACjD,SAAOF,WAAW,CAACG,IAAZ,CAAoBC,UAAF,IAAkBA,UAAU,CAACF,IAAX,KAAoBA,IAAxD,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,cAAT,GAA0B;AAChC,SAAOL,WAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport flex from './flex';\nimport flow from './flow';\nimport constrained from './constrained';\nimport grid from './grid';\n\nconst layoutTypes = [ flow, flex, constrained, grid ];\n\n/**\n * Retrieves a layout type by name.\n *\n * @param {string} name - The name of the layout type.\n * @return {Object} Layout type.\n */\nexport function getLayoutType( name = 'default' ) {\n\treturn layoutTypes.find( ( layoutType ) => layoutType.name === name );\n}\n\n/**\n * Retrieves the available layout types.\n *\n * @return {Array} Layout types.\n */\nexport function getLayoutTypes() {\n\treturn layoutTypes;\n}\n"]}