@wordpress/block-editor 11.2.0 → 11.3.1

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 (675) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +28 -4
  3. package/build/components/alignment-control/ui.js +1 -1
  4. package/build/components/alignment-control/ui.js.map +1 -1
  5. package/build/components/autocomplete/index.js +2 -7
  6. package/build/components/autocomplete/index.js.map +1 -1
  7. package/build/components/block-actions/index.js +7 -2
  8. package/build/components/block-actions/index.js.map +1 -1
  9. package/build/components/block-alignment-matrix-control/index.js +2 -2
  10. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  11. package/build/components/block-card/index.js +2 -4
  12. package/build/components/block-card/index.js.map +1 -1
  13. package/build/components/block-edit/index.js +8 -0
  14. package/build/components/block-edit/index.js.map +1 -1
  15. package/build/components/block-inspector/index.js +15 -14
  16. package/build/components/block-inspector/index.js.map +1 -1
  17. package/build/components/block-list/use-in-between-inserter.js +5 -0
  18. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  19. package/build/components/block-lock/modal.js +0 -1
  20. package/build/components/block-lock/modal.js.map +1 -1
  21. package/build/components/block-mover/mover-description.js +2 -2
  22. package/build/components/block-mover/mover-description.js.map +1 -1
  23. package/build/components/block-navigation/dropdown.js +3 -1
  24. package/build/components/block-navigation/dropdown.js.map +1 -1
  25. package/build/components/block-pattern-setup/index.js +1 -1
  26. package/build/components/block-pattern-setup/index.js.map +1 -1
  27. package/build/components/block-pattern-setup/use-patterns-setup.js +2 -2
  28. package/build/components/block-pattern-setup/use-patterns-setup.js.map +1 -1
  29. package/build/components/block-patterns-list/index.js +31 -3
  30. package/build/components/block-patterns-list/index.js.map +1 -1
  31. package/build/components/block-preview/auto.js +9 -11
  32. package/build/components/block-preview/auto.js.map +1 -1
  33. package/build/components/block-preview/index.js +32 -8
  34. package/build/components/block-preview/index.js.map +1 -1
  35. package/build/components/block-selection-clearer/index.js +1 -1
  36. package/build/components/block-selection-clearer/index.js.map +1 -1
  37. package/build/components/block-settings/container.native.js +7 -33
  38. package/build/components/block-settings/container.native.js.map +1 -1
  39. package/build/components/block-settings-menu/block-settings-dropdown.js +12 -6
  40. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  41. package/build/components/block-settings-menu-controls/index.js +2 -8
  42. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  43. package/build/components/block-switcher/utils.js +1 -1
  44. package/build/components/block-switcher/utils.js.map +1 -1
  45. package/build/components/block-tools/selected-block-popover.js +55 -47
  46. package/build/components/block-tools/selected-block-popover.js.map +1 -1
  47. package/build/components/block-vertical-alignment-control/icons.js +15 -1
  48. package/build/components/block-vertical-alignment-control/icons.js.map +1 -1
  49. package/build/components/block-vertical-alignment-control/ui.js +9 -4
  50. package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
  51. package/build/components/color-style-selector/index.js +3 -1
  52. package/build/components/color-style-selector/index.js.map +1 -1
  53. package/build/components/date-format-picker/index.js +3 -4
  54. package/build/components/date-format-picker/index.js.map +1 -1
  55. package/build/components/font-family/index.js +1 -7
  56. package/build/components/font-family/index.js.map +1 -1
  57. package/build/components/font-sizes/fluid-utils.js +1 -1
  58. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  59. package/build/components/font-sizes/utils.js +1 -1
  60. package/build/components/font-sizes/utils.js.map +1 -1
  61. package/build/components/global-styles/context.js +22 -0
  62. package/build/components/global-styles/context.js.map +1 -0
  63. package/build/components/global-styles/hooks.js +142 -0
  64. package/build/components/global-styles/hooks.js.map +1 -0
  65. package/build/components/global-styles/index.js +42 -0
  66. package/build/components/global-styles/index.js.map +1 -0
  67. package/build/components/global-styles/typography-utils.js +92 -0
  68. package/build/components/global-styles/typography-utils.js.map +1 -0
  69. package/build/components/global-styles/use-global-styles-output.js +974 -0
  70. package/build/components/global-styles/use-global-styles-output.js.map +1 -0
  71. package/build/components/global-styles/utils.js +340 -0
  72. package/build/components/global-styles/utils.js.map +1 -0
  73. package/build/components/height-control/index.js +13 -1
  74. package/build/components/height-control/index.js.map +1 -1
  75. package/build/components/iframe/index.js +5 -3
  76. package/build/components/iframe/index.js.map +1 -1
  77. package/build/components/image-editor/constants.js +1 -1
  78. package/build/components/image-editor/constants.js.map +1 -1
  79. package/build/components/image-editor/context.js +1 -2
  80. package/build/components/image-editor/context.js.map +1 -1
  81. package/build/components/image-editor/cropper.js +3 -1
  82. package/build/components/image-editor/cropper.js.map +1 -1
  83. package/build/components/image-editor/index.js +13 -9
  84. package/build/components/image-editor/index.js.map +1 -1
  85. package/build/components/image-editor/use-transform-image.js +11 -35
  86. package/build/components/image-editor/use-transform-image.js.map +1 -1
  87. package/build/components/image-size-control/index.js +1 -7
  88. package/build/components/image-size-control/index.js.map +1 -1
  89. package/build/components/index.js +8 -24
  90. package/build/components/index.js.map +1 -1
  91. package/build/components/inner-blocks/index.js +22 -32
  92. package/build/components/inner-blocks/index.js.map +1 -1
  93. package/build/components/inner-blocks/index.native.js +8 -23
  94. package/build/components/inner-blocks/index.native.js.map +1 -1
  95. package/build/components/inner-blocks/use-block-context.js +53 -0
  96. package/build/components/inner-blocks/use-block-context.js.map +1 -0
  97. package/build/components/inserter/block-patterns-explorer/explorer.js +0 -1
  98. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  99. package/build/components/inserter/block-patterns-tab.js +9 -2
  100. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  101. package/build/components/inserter/block-types-tab.js +2 -2
  102. package/build/components/inserter/block-types-tab.js.map +1 -1
  103. package/build/components/inserter/hooks/use-patterns-state.js +1 -7
  104. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  105. package/build/components/inserter/index.js +5 -4
  106. package/build/components/inserter/index.js.map +1 -1
  107. package/build/components/inserter/media-tab/hooks.js +142 -56
  108. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  109. package/build/components/inserter/media-tab/media-list.js +74 -21
  110. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  111. package/build/components/inserter/media-tab/media-panel.js +11 -13
  112. package/build/components/inserter/media-tab/media-panel.js.map +1 -1
  113. package/build/components/inserter/media-tab/media-tab.js +6 -3
  114. package/build/components/inserter/media-tab/media-tab.js.map +1 -1
  115. package/build/components/inserter/media-tab/utils.js +26 -15
  116. package/build/components/inserter/media-tab/utils.js.map +1 -1
  117. package/build/components/inserter/menu.js +4 -0
  118. package/build/components/inserter/menu.js.map +1 -1
  119. package/build/components/inserter/preview-panel.js +5 -3
  120. package/build/components/inserter/preview-panel.js.map +1 -1
  121. package/build/components/inserter/search-results.js +2 -7
  122. package/build/components/inserter/search-results.js.map +1 -1
  123. package/build/components/inserter-list-item/index.js +1 -9
  124. package/build/components/inserter-list-item/index.js.map +1 -1
  125. package/build/components/inspector-controls/fill.js +15 -2
  126. package/build/components/inspector-controls/fill.js.map +1 -1
  127. package/build/components/inspector-controls/fill.native.js +14 -1
  128. package/build/components/inspector-controls/fill.native.js.map +1 -1
  129. package/build/components/inspector-controls/groups.js +4 -0
  130. package/build/components/inspector-controls/groups.js.map +1 -1
  131. package/build/components/inspector-controls/index.js +2 -2
  132. package/build/components/inspector-controls/index.js.map +1 -1
  133. package/build/components/inspector-controls/slot.js +14 -1
  134. package/build/components/inspector-controls/slot.js.map +1 -1
  135. package/build/components/inspector-controls/slot.native.js +14 -1
  136. package/build/components/inspector-controls/slot.native.js.map +1 -1
  137. package/build/components/inspector-controls-tabs/advanced-controls-panel.js +1 -1
  138. package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -1
  139. package/build/components/inspector-controls-tabs/index.js +2 -2
  140. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  141. package/build/components/inspector-controls-tabs/position-controls-panel.js +1 -1
  142. package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  143. package/build/components/inspector-controls-tabs/styles-tab.js +6 -4
  144. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  145. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +17 -12
  146. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  147. package/build/components/justify-content-control/ui.js +8 -1
  148. package/build/components/justify-content-control/ui.js.map +1 -1
  149. package/build/components/link-control/index.js +45 -17
  150. package/build/components/link-control/index.js.map +1 -1
  151. package/build/components/list-view/block.js +1 -1
  152. package/build/components/list-view/block.js.map +1 -1
  153. package/build/components/list-view/use-list-view-drop-zone.js +1 -1
  154. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  155. package/build/components/media-upload/index.native.js +4 -1
  156. package/build/components/media-upload/index.native.js.map +1 -1
  157. package/build/components/off-canvas-editor/appender.js +50 -3
  158. package/build/components/off-canvas-editor/appender.js.map +1 -1
  159. package/build/components/off-canvas-editor/block-contents.js +3 -1
  160. package/build/components/off-canvas-editor/block-contents.js.map +1 -1
  161. package/build/components/off-canvas-editor/block-select-button.js +10 -4
  162. package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
  163. package/build/components/off-canvas-editor/block.js +6 -27
  164. package/build/components/off-canvas-editor/block.js.map +1 -1
  165. package/build/components/off-canvas-editor/branch.js +25 -10
  166. package/build/components/off-canvas-editor/branch.js.map +1 -1
  167. package/build/components/off-canvas-editor/index.js +27 -20
  168. package/build/components/off-canvas-editor/index.js.map +1 -1
  169. package/build/components/off-canvas-editor/link-ui.js +2 -2
  170. package/build/components/off-canvas-editor/link-ui.js.map +1 -1
  171. package/build/components/off-canvas-editor/use-list-view-drop-zone.js +1 -1
  172. package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -1
  173. package/build/components/provider/index.js +21 -9
  174. package/build/components/provider/index.js.map +1 -1
  175. package/build/components/provider/index.native.js +5 -6
  176. package/build/components/provider/index.native.js.map +1 -1
  177. package/build/components/rich-text/use-before-input-rules.js +11 -3
  178. package/build/components/rich-text/use-before-input-rules.js.map +1 -1
  179. package/build/components/rich-text/utils.js +1 -1
  180. package/build/components/rich-text/utils.js.map +1 -1
  181. package/build/components/spacing-sizes-control/utils.js +2 -8
  182. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  183. package/build/components/tool-selector/index.js +3 -1
  184. package/build/components/tool-selector/index.js.map +1 -1
  185. package/build/components/url-popover/image-url-input-ui.js +7 -8
  186. package/build/components/url-popover/image-url-input-ui.js.map +1 -1
  187. package/build/components/use-block-display-information/index.js +1 -1
  188. package/build/components/use-block-display-information/index.js.map +1 -1
  189. package/build/experiments.js +45 -0
  190. package/build/experiments.js.map +1 -0
  191. package/build/experiments.native.js +40 -0
  192. package/build/experiments.native.js.map +1 -0
  193. package/build/hooks/anchor.js +2 -1
  194. package/build/hooks/anchor.js.map +1 -1
  195. package/build/hooks/border.js +1 -1
  196. package/build/hooks/border.js.map +1 -1
  197. package/build/hooks/child-layout.js +5 -1
  198. package/build/hooks/child-layout.js.map +1 -1
  199. package/build/hooks/color-panel.js +1 -1
  200. package/build/hooks/color-panel.js.map +1 -1
  201. package/build/hooks/color.js +3 -3
  202. package/build/hooks/color.js.map +1 -1
  203. package/build/hooks/custom-class-name.js +2 -1
  204. package/build/hooks/custom-class-name.js.map +1 -1
  205. package/build/hooks/dimensions.js +7 -5
  206. package/build/hooks/dimensions.js.map +1 -1
  207. package/build/hooks/margin.js +1 -0
  208. package/build/hooks/margin.js.map +1 -1
  209. package/build/hooks/padding.js +1 -0
  210. package/build/hooks/padding.js.map +1 -1
  211. package/build/hooks/position.js +39 -17
  212. package/build/hooks/position.js.map +1 -1
  213. package/build/hooks/typography.js +1 -1
  214. package/build/hooks/typography.js.map +1 -1
  215. package/build/hooks/use-color-props.js +3 -3
  216. package/build/hooks/use-color-props.js.map +1 -1
  217. package/build/hooks/utils.js +69 -3
  218. package/build/hooks/utils.js.map +1 -1
  219. package/build/index.js +10 -1
  220. package/build/index.js.map +1 -1
  221. package/build/layouts/constrained.js +3 -0
  222. package/build/layouts/constrained.js.map +1 -1
  223. package/build/layouts/flex.js +59 -9
  224. package/build/layouts/flex.js.map +1 -1
  225. package/build/layouts/flow.js +0 -18
  226. package/build/layouts/flow.js.map +1 -1
  227. package/build/store/actions.js +3 -30
  228. package/build/store/actions.js.map +1 -1
  229. package/build/store/defaults.js +5 -2
  230. package/build/store/defaults.js.map +1 -1
  231. package/build/store/index.js +11 -2
  232. package/build/store/index.js.map +1 -1
  233. package/build/store/private-actions.js +78 -0
  234. package/build/store/private-actions.js.map +1 -0
  235. package/build/store/private-selectors.js +32 -0
  236. package/build/store/private-selectors.js.map +1 -0
  237. package/build/store/reducer.js +1 -1
  238. package/build/store/reducer.js.map +1 -1
  239. package/build/store/selectors.js +60 -48
  240. package/build/store/selectors.js.map +1 -1
  241. package/build/utils/block-variation-transforms.js +1 -1
  242. package/build/utils/block-variation-transforms.js.map +1 -1
  243. package/build/utils/parse-css-unit-to-px.js +1 -1
  244. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  245. package/build/utils/transform-styles/index.js +1 -7
  246. package/build/utils/transform-styles/index.js.map +1 -1
  247. package/build-module/components/alignment-control/ui.js +1 -1
  248. package/build-module/components/alignment-control/ui.js.map +1 -1
  249. package/build-module/components/autocomplete/index.js +2 -6
  250. package/build-module/components/autocomplete/index.js.map +1 -1
  251. package/build-module/components/block-actions/index.js +7 -2
  252. package/build-module/components/block-actions/index.js.map +1 -1
  253. package/build-module/components/block-alignment-matrix-control/index.js +2 -2
  254. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  255. package/build-module/components/block-card/index.js +2 -4
  256. package/build-module/components/block-card/index.js.map +1 -1
  257. package/build-module/components/block-edit/index.js +7 -0
  258. package/build-module/components/block-edit/index.js.map +1 -1
  259. package/build-module/components/block-inspector/index.js +15 -14
  260. package/build-module/components/block-inspector/index.js.map +1 -1
  261. package/build-module/components/block-list/use-in-between-inserter.js +5 -0
  262. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  263. package/build-module/components/block-lock/modal.js +0 -1
  264. package/build-module/components/block-lock/modal.js.map +1 -1
  265. package/build-module/components/block-mover/mover-description.js +2 -2
  266. package/build-module/components/block-mover/mover-description.js.map +1 -1
  267. package/build-module/components/block-navigation/dropdown.js +3 -1
  268. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  269. package/build-module/components/block-pattern-setup/index.js +1 -1
  270. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  271. package/build-module/components/block-pattern-setup/use-patterns-setup.js +2 -2
  272. package/build-module/components/block-pattern-setup/use-patterns-setup.js.map +1 -1
  273. package/build-module/components/block-patterns-list/index.js +32 -3
  274. package/build-module/components/block-patterns-list/index.js.map +1 -1
  275. package/build-module/components/block-preview/auto.js +9 -11
  276. package/build-module/components/block-preview/auto.js.map +1 -1
  277. package/build-module/components/block-preview/index.js +31 -8
  278. package/build-module/components/block-preview/index.js.map +1 -1
  279. package/build-module/components/block-selection-clearer/index.js +1 -1
  280. package/build-module/components/block-selection-clearer/index.js.map +1 -1
  281. package/build-module/components/block-settings/container.native.js +6 -30
  282. package/build-module/components/block-settings/container.native.js.map +1 -1
  283. package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -6
  284. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  285. package/build-module/components/block-settings-menu-controls/index.js +2 -7
  286. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  287. package/build-module/components/block-switcher/utils.js +1 -1
  288. package/build-module/components/block-switcher/utils.js.map +1 -1
  289. package/build-module/components/block-tools/selected-block-popover.js +55 -48
  290. package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
  291. package/build-module/components/block-vertical-alignment-control/icons.js +12 -0
  292. package/build-module/components/block-vertical-alignment-control/icons.js.map +1 -1
  293. package/build-module/components/block-vertical-alignment-control/ui.js +10 -5
  294. package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
  295. package/build-module/components/color-style-selector/index.js +3 -1
  296. package/build-module/components/color-style-selector/index.js.map +1 -1
  297. package/build-module/components/date-format-picker/index.js +4 -5
  298. package/build-module/components/date-format-picker/index.js.map +1 -1
  299. package/build-module/components/font-family/index.js +1 -6
  300. package/build-module/components/font-family/index.js.map +1 -1
  301. package/build-module/components/font-sizes/fluid-utils.js +1 -1
  302. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  303. package/build-module/components/font-sizes/utils.js +1 -1
  304. package/build-module/components/font-sizes/utils.js.map +1 -1
  305. package/build-module/components/global-styles/context.js +12 -0
  306. package/build-module/components/global-styles/context.js.map +1 -0
  307. package/build-module/components/global-styles/hooks.js +121 -0
  308. package/build-module/components/global-styles/hooks.js.map +1 -0
  309. package/build-module/components/global-styles/index.js +4 -0
  310. package/build-module/components/global-styles/index.js.map +1 -0
  311. package/build-module/components/global-styles/typography-utils.js +84 -0
  312. package/build-module/components/global-styles/typography-utils.js.map +1 -0
  313. package/build-module/components/global-styles/use-global-styles-output.js +930 -0
  314. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -0
  315. package/build-module/components/global-styles/utils.js +321 -0
  316. package/build-module/components/global-styles/utils.js.map +1 -0
  317. package/build-module/components/height-control/index.js +14 -1
  318. package/build-module/components/height-control/index.js.map +1 -1
  319. package/build-module/components/iframe/index.js +6 -4
  320. package/build-module/components/iframe/index.js.map +1 -1
  321. package/build-module/components/image-editor/constants.js +1 -1
  322. package/build-module/components/image-editor/constants.js.map +1 -1
  323. package/build-module/components/image-editor/context.js +1 -2
  324. package/build-module/components/image-editor/context.js.map +1 -1
  325. package/build-module/components/image-editor/cropper.js +3 -1
  326. package/build-module/components/image-editor/cropper.js.map +1 -1
  327. package/build-module/components/image-editor/index.js +13 -3
  328. package/build-module/components/image-editor/index.js.map +1 -1
  329. package/build-module/components/image-editor/use-transform-image.js +12 -37
  330. package/build-module/components/image-editor/use-transform-image.js.map +1 -1
  331. package/build-module/components/image-size-control/index.js +1 -6
  332. package/build-module/components/image-size-control/index.js.map +1 -1
  333. package/build-module/components/index.js +2 -3
  334. package/build-module/components/index.js.map +1 -1
  335. package/build-module/components/inner-blocks/index.js +21 -32
  336. package/build-module/components/inner-blocks/index.js.map +1 -1
  337. package/build-module/components/inner-blocks/index.native.js +9 -22
  338. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  339. package/build-module/components/inner-blocks/use-block-context.js +43 -0
  340. package/build-module/components/inner-blocks/use-block-context.js.map +1 -0
  341. package/build-module/components/inserter/block-patterns-explorer/explorer.js +0 -1
  342. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  343. package/build-module/components/inserter/block-patterns-tab.js +9 -2
  344. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  345. package/build-module/components/inserter/block-types-tab.js +3 -3
  346. package/build-module/components/inserter/block-types-tab.js.map +1 -1
  347. package/build-module/components/inserter/hooks/use-patterns-state.js +1 -6
  348. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  349. package/build-module/components/inserter/index.js +5 -4
  350. package/build-module/components/inserter/index.js.map +1 -1
  351. package/build-module/components/inserter/media-tab/hooks.js +145 -56
  352. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  353. package/build-module/components/inserter/media-tab/media-list.js +74 -24
  354. package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
  355. package/build-module/components/inserter/media-tab/media-panel.js +14 -14
  356. package/build-module/components/inserter/media-tab/media-panel.js.map +1 -1
  357. package/build-module/components/inserter/media-tab/media-tab.js +7 -4
  358. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
  359. package/build-module/components/inserter/media-tab/utils.js +27 -15
  360. package/build-module/components/inserter/media-tab/utils.js.map +1 -1
  361. package/build-module/components/inserter/menu.js +4 -0
  362. package/build-module/components/inserter/menu.js.map +1 -1
  363. package/build-module/components/inserter/preview-panel.js +5 -3
  364. package/build-module/components/inserter/preview-panel.js.map +1 -1
  365. package/build-module/components/inserter/search-results.js +2 -6
  366. package/build-module/components/inserter/search-results.js.map +1 -1
  367. package/build-module/components/inserter-list-item/index.js +1 -9
  368. package/build-module/components/inserter-list-item/index.js.map +1 -1
  369. package/build-module/components/inspector-controls/fill.js +14 -2
  370. package/build-module/components/inspector-controls/fill.js.map +1 -1
  371. package/build-module/components/inspector-controls/fill.native.js +13 -1
  372. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  373. package/build-module/components/inspector-controls/groups.js +4 -0
  374. package/build-module/components/inspector-controls/groups.js.map +1 -1
  375. package/build-module/components/inspector-controls/index.js +2 -2
  376. package/build-module/components/inspector-controls/index.js.map +1 -1
  377. package/build-module/components/inspector-controls/slot.js +13 -1
  378. package/build-module/components/inspector-controls/slot.js.map +1 -1
  379. package/build-module/components/inspector-controls/slot.native.js +13 -1
  380. package/build-module/components/inspector-controls/slot.native.js.map +1 -1
  381. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js +1 -1
  382. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -1
  383. package/build-module/components/inspector-controls-tabs/index.js +2 -2
  384. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  385. package/build-module/components/inspector-controls-tabs/position-controls-panel.js +1 -1
  386. package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  387. package/build-module/components/inspector-controls-tabs/styles-tab.js +6 -4
  388. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  389. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +17 -12
  390. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  391. package/build-module/components/justify-content-control/ui.js +9 -2
  392. package/build-module/components/justify-content-control/ui.js.map +1 -1
  393. package/build-module/components/link-control/index.js +45 -16
  394. package/build-module/components/link-control/index.js.map +1 -1
  395. package/build-module/components/list-view/block.js +1 -1
  396. package/build-module/components/list-view/block.js.map +1 -1
  397. package/build-module/components/list-view/use-list-view-drop-zone.js +1 -1
  398. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  399. package/build-module/components/media-upload/index.native.js +4 -1
  400. package/build-module/components/media-upload/index.native.js.map +1 -1
  401. package/build-module/components/off-canvas-editor/appender.js +47 -4
  402. package/build-module/components/off-canvas-editor/appender.js.map +1 -1
  403. package/build-module/components/off-canvas-editor/block-contents.js +2 -1
  404. package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
  405. package/build-module/components/off-canvas-editor/block-select-button.js +9 -4
  406. package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
  407. package/build-module/components/off-canvas-editor/block.js +6 -25
  408. package/build-module/components/off-canvas-editor/block.js.map +1 -1
  409. package/build-module/components/off-canvas-editor/branch.js +23 -11
  410. package/build-module/components/off-canvas-editor/branch.js.map +1 -1
  411. package/build-module/components/off-canvas-editor/index.js +27 -19
  412. package/build-module/components/off-canvas-editor/index.js.map +1 -1
  413. package/build-module/components/off-canvas-editor/link-ui.js +2 -2
  414. package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
  415. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +1 -1
  416. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -1
  417. package/build-module/components/provider/index.js +16 -9
  418. package/build-module/components/provider/index.js.map +1 -1
  419. package/build-module/components/provider/index.native.js +4 -4
  420. package/build-module/components/provider/index.native.js.map +1 -1
  421. package/build-module/components/rich-text/use-before-input-rules.js +10 -2
  422. package/build-module/components/rich-text/use-before-input-rules.js.map +1 -1
  423. package/build-module/components/rich-text/utils.js +1 -1
  424. package/build-module/components/rich-text/utils.js.map +1 -1
  425. package/build-module/components/spacing-sizes-control/utils.js +2 -7
  426. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  427. package/build-module/components/tool-selector/index.js +3 -1
  428. package/build-module/components/tool-selector/index.js.map +1 -1
  429. package/build-module/components/url-popover/image-url-input-ui.js +8 -8
  430. package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
  431. package/build-module/components/use-block-display-information/index.js +1 -1
  432. package/build-module/components/use-block-display-information/index.js.map +1 -1
  433. package/build-module/experiments.js +25 -0
  434. package/build-module/experiments.js.map +1 -0
  435. package/build-module/experiments.native.js +23 -0
  436. package/build-module/experiments.native.js.map +1 -0
  437. package/build-module/hooks/anchor.js +2 -1
  438. package/build-module/hooks/anchor.js.map +1 -1
  439. package/build-module/hooks/border.js +1 -1
  440. package/build-module/hooks/border.js.map +1 -1
  441. package/build-module/hooks/child-layout.js +5 -1
  442. package/build-module/hooks/child-layout.js.map +1 -1
  443. package/build-module/hooks/color-panel.js +1 -1
  444. package/build-module/hooks/color-panel.js.map +1 -1
  445. package/build-module/hooks/color.js +3 -3
  446. package/build-module/hooks/color.js.map +1 -1
  447. package/build-module/hooks/custom-class-name.js +2 -1
  448. package/build-module/hooks/custom-class-name.js.map +1 -1
  449. package/build-module/hooks/dimensions.js +6 -5
  450. package/build-module/hooks/dimensions.js.map +1 -1
  451. package/build-module/hooks/margin.js +1 -0
  452. package/build-module/hooks/margin.js.map +1 -1
  453. package/build-module/hooks/padding.js +1 -0
  454. package/build-module/hooks/padding.js.map +1 -1
  455. package/build-module/hooks/position.js +36 -16
  456. package/build-module/hooks/position.js.map +1 -1
  457. package/build-module/hooks/typography.js +1 -1
  458. package/build-module/hooks/typography.js.map +1 -1
  459. package/build-module/hooks/use-color-props.js +3 -3
  460. package/build-module/hooks/use-color-props.js.map +1 -1
  461. package/build-module/hooks/utils.js +70 -4
  462. package/build-module/hooks/utils.js.map +1 -1
  463. package/build-module/index.js +1 -0
  464. package/build-module/index.js.map +1 -1
  465. package/build-module/layouts/constrained.js +3 -0
  466. package/build-module/layouts/constrained.js.map +1 -1
  467. package/build-module/layouts/flex.js +60 -10
  468. package/build-module/layouts/flex.js.map +1 -1
  469. package/build-module/layouts/flow.js +0 -18
  470. package/build-module/layouts/flow.js.map +1 -1
  471. package/build-module/store/actions.js +2 -26
  472. package/build-module/store/actions.js.map +1 -1
  473. package/build-module/store/defaults.js +5 -2
  474. package/build-module/store/defaults.js.map +1 -1
  475. package/build-module/store/index.js +8 -2
  476. package/build-module/store/index.js.map +1 -1
  477. package/build-module/store/private-actions.js +66 -0
  478. package/build-module/store/private-actions.js.map +1 -0
  479. package/build-module/store/private-selectors.js +23 -0
  480. package/build-module/store/private-selectors.js.map +1 -0
  481. package/build-module/store/reducer.js +1 -1
  482. package/build-module/store/reducer.js.map +1 -1
  483. package/build-module/store/selectors.js +48 -37
  484. package/build-module/store/selectors.js.map +1 -1
  485. package/build-module/utils/block-variation-transforms.js +1 -1
  486. package/build-module/utils/block-variation-transforms.js.map +1 -1
  487. package/build-module/utils/parse-css-unit-to-px.js +1 -1
  488. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  489. package/build-module/utils/transform-styles/index.js +1 -6
  490. package/build-module/utils/transform-styles/index.js.map +1 -1
  491. package/build-style/content-rtl.css +283 -3
  492. package/build-style/content.css +283 -3
  493. package/build-style/style-rtl.css +105 -221
  494. package/build-style/style.css +105 -221
  495. package/package.json +30 -29
  496. package/src/components/alignment-control/test/__snapshots__/index.js.snap +3 -3
  497. package/src/components/alignment-control/test/index.js +5 -15
  498. package/src/components/alignment-control/ui.js +1 -1
  499. package/src/components/autocomplete/index.js +3 -6
  500. package/src/components/block-actions/index.js +9 -0
  501. package/src/components/block-alignment-control/test/index.js +3 -11
  502. package/src/components/block-alignment-matrix-control/index.js +1 -2
  503. package/src/components/block-card/index.js +1 -4
  504. package/src/components/block-content-overlay/content.scss +4 -4
  505. package/src/components/block-edit/index.js +15 -1
  506. package/src/components/block-icon/content.scss +31 -0
  507. package/src/components/block-inspector/index.js +13 -17
  508. package/src/components/block-list/use-in-between-inserter.js +5 -0
  509. package/src/components/block-lock/modal.js +0 -1
  510. package/src/components/block-mover/mover-description.js +2 -2
  511. package/src/components/block-mover/stories/index.js +3 -3
  512. package/src/components/block-navigation/dropdown.js +1 -1
  513. package/src/components/block-pattern-setup/index.js +1 -4
  514. package/src/components/block-pattern-setup/use-patterns-setup.js +2 -5
  515. package/src/components/block-patterns-list/index.js +29 -3
  516. package/src/components/block-preview/README.md +9 -9
  517. package/src/components/block-preview/auto.js +9 -11
  518. package/src/components/block-preview/content.scss +23 -0
  519. package/src/components/block-preview/index.js +40 -10
  520. package/src/components/block-preview/style.scss +0 -23
  521. package/src/components/block-selection-clearer/index.js +1 -1
  522. package/src/components/block-selection-clearer/test/index.js +6 -6
  523. package/src/components/block-settings/container.native.js +7 -26
  524. package/src/components/block-settings-menu/block-settings-dropdown.js +13 -5
  525. package/src/components/block-settings-menu-controls/index.js +2 -10
  526. package/src/components/block-switcher/test/index.js +43 -44
  527. package/src/components/block-switcher/utils.js +1 -1
  528. package/src/components/block-tools/selected-block-popover.js +77 -80
  529. package/src/components/block-tools/style.scss +0 -1
  530. package/src/components/block-variation-picker/{style.scss → content.scss} +0 -0
  531. package/src/components/block-vertical-alignment-control/icons.js +12 -0
  532. package/src/components/block-vertical-alignment-control/test/index.js +3 -11
  533. package/src/components/block-vertical-alignment-control/ui.js +16 -6
  534. package/src/components/color-style-selector/index.js +1 -1
  535. package/src/components/colors/test/with-colors.js +2 -8
  536. package/src/components/date-format-picker/index.js +23 -24
  537. package/src/components/date-format-picker/style.scss +0 -6
  538. package/src/components/default-block-appender/content.scss +18 -0
  539. package/src/components/default-block-appender/test/index.js +2 -8
  540. package/src/components/font-family/index.js +1 -6
  541. package/src/components/font-sizes/fluid-utils.js +1 -1
  542. package/src/components/font-sizes/utils.js +1 -1
  543. package/src/components/global-styles/README.md +77 -0
  544. package/src/components/global-styles/context.js +15 -0
  545. package/src/components/global-styles/hooks.js +145 -0
  546. package/src/components/global-styles/index.js +7 -0
  547. package/src/components/global-styles/test/typography-utils.js +393 -0
  548. package/src/components/global-styles/test/use-global-styles-output.js +814 -0
  549. package/src/components/global-styles/test/utils.js +206 -0
  550. package/src/components/global-styles/typography-utils.js +87 -0
  551. package/src/components/global-styles/use-global-styles-output.js +1088 -0
  552. package/src/components/global-styles/utils.js +373 -0
  553. package/src/components/height-control/README.md +55 -0
  554. package/src/components/height-control/index.js +13 -1
  555. package/src/components/iframe/index.js +8 -2
  556. package/src/components/image-editor/constants.js +1 -1
  557. package/src/components/image-editor/context.js +5 -9
  558. package/src/components/image-editor/cropper.js +3 -1
  559. package/src/components/image-editor/index.js +13 -4
  560. package/src/components/image-editor/use-transform-image.js +14 -55
  561. package/src/components/image-size-control/index.js +1 -6
  562. package/src/components/index.js +2 -6
  563. package/src/components/inner-blocks/index.js +29 -33
  564. package/src/components/inner-blocks/index.native.js +27 -47
  565. package/src/components/inner-blocks/use-block-context.js +47 -0
  566. package/src/components/inserter/block-patterns-explorer/explorer.js +0 -1
  567. package/src/components/inserter/block-patterns-tab.js +9 -1
  568. package/src/components/inserter/block-types-tab.js +3 -4
  569. package/src/components/inserter/hooks/use-patterns-state.js +1 -6
  570. package/src/components/inserter/index.js +3 -4
  571. package/src/components/inserter/media-tab/hooks.js +167 -65
  572. package/src/components/inserter/media-tab/media-list.js +94 -26
  573. package/src/components/inserter/media-tab/media-panel.js +9 -20
  574. package/src/components/inserter/media-tab/media-tab.js +12 -4
  575. package/src/components/inserter/media-tab/utils.js +20 -10
  576. package/src/components/inserter/menu.js +8 -0
  577. package/src/components/inserter/preview-panel.js +4 -2
  578. package/src/components/inserter/search-results.js +2 -6
  579. package/src/components/inserter/stories/index.js +9 -9
  580. package/src/components/inserter/style.scss +58 -11
  581. package/src/components/inserter-list-item/index.js +0 -7
  582. package/src/components/inspector-controls/README.md +3 -7
  583. package/src/components/inspector-controls/fill.js +15 -1
  584. package/src/components/inspector-controls/fill.native.js +14 -1
  585. package/src/components/inspector-controls/groups.js +3 -0
  586. package/src/components/inspector-controls/index.js +2 -6
  587. package/src/components/inspector-controls/slot.js +14 -1
  588. package/src/components/inspector-controls/slot.native.js +14 -1
  589. package/src/components/inspector-controls-tabs/advanced-controls-panel.js +1 -1
  590. package/src/components/inspector-controls-tabs/index.js +2 -4
  591. package/src/components/inspector-controls-tabs/position-controls-panel.js +1 -1
  592. package/src/components/inspector-controls-tabs/styles-tab.js +5 -7
  593. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +21 -10
  594. package/src/components/justify-content-control/ui.js +9 -0
  595. package/src/components/link-control/index.js +59 -23
  596. package/src/components/link-control/style.scss +7 -24
  597. package/src/components/link-control/test/index.js +134 -5
  598. package/src/components/list-view/block.js +1 -1
  599. package/src/components/list-view/use-list-view-drop-zone.js +1 -1
  600. package/src/components/media-replace-flow/test/index.js +4 -12
  601. package/src/components/media-upload/index.native.js +2 -2
  602. package/src/components/off-canvas-editor/README.md +2 -2
  603. package/src/components/off-canvas-editor/appender.js +93 -37
  604. package/src/components/off-canvas-editor/block-contents.js +2 -1
  605. package/src/components/off-canvas-editor/block-select-button.js +12 -1
  606. package/src/components/off-canvas-editor/block.js +3 -42
  607. package/src/components/off-canvas-editor/branch.js +32 -5
  608. package/src/components/off-canvas-editor/index.js +20 -20
  609. package/src/components/off-canvas-editor/link-ui.js +2 -2
  610. package/src/components/off-canvas-editor/style.scss +5 -1
  611. package/src/components/off-canvas-editor/use-list-view-drop-zone.js +1 -1
  612. package/src/components/provider/index.js +33 -14
  613. package/src/components/provider/index.native.js +4 -3
  614. package/src/components/provider/test/experimental-provider.js +94 -0
  615. package/src/components/provider/test/use-block-sync.js +10 -0
  616. package/src/components/responsive-block-control/test/index.js +1 -5
  617. package/src/components/rich-text/use-before-input-rules.js +10 -2
  618. package/src/components/rich-text/utils.js +1 -1
  619. package/src/components/spacing-sizes-control/utils.js +2 -7
  620. package/src/components/tool-selector/index.js +1 -1
  621. package/src/components/url-input/test/button.js +24 -24
  622. package/src/components/url-popover/image-url-input-ui.js +7 -8
  623. package/src/components/url-popover/style.scss +0 -10
  624. package/src/components/use-block-display-information/index.js +1 -1
  625. package/src/components/warning/{style.scss → content.scss} +0 -0
  626. package/src/components/warning/test/index.js +1 -5
  627. package/src/content.scss +7 -0
  628. package/src/experiments.js +27 -0
  629. package/src/experiments.native.js +25 -0
  630. package/src/hooks/anchor.js +2 -1
  631. package/src/hooks/border.js +1 -1
  632. package/src/hooks/child-layout.js +6 -1
  633. package/src/hooks/color-panel.js +1 -1
  634. package/src/hooks/color.js +3 -3
  635. package/src/hooks/custom-class-name.js +2 -1
  636. package/src/hooks/dimensions.js +6 -6
  637. package/src/hooks/layout.scss +4 -0
  638. package/src/hooks/margin.js +1 -0
  639. package/src/hooks/padding.js +1 -0
  640. package/src/hooks/position.js +56 -36
  641. package/src/hooks/test/align.native.js +1 -1
  642. package/src/hooks/test/utils.js +104 -0
  643. package/src/hooks/typography.js +1 -1
  644. package/src/hooks/use-color-props.js +3 -3
  645. package/src/hooks/utils.js +68 -2
  646. package/src/index.js +1 -0
  647. package/src/layouts/constrained.js +3 -0
  648. package/src/layouts/flex.js +66 -14
  649. package/src/layouts/flow.js +0 -9
  650. package/src/store/actions.js +2 -26
  651. package/src/store/defaults.js +7 -2
  652. package/src/store/index.js +8 -2
  653. package/src/store/private-actions.js +65 -0
  654. package/src/store/private-selectors.js +20 -0
  655. package/src/store/reducer.js +1 -1
  656. package/src/store/selectors.js +103 -62
  657. package/src/store/test/actions.js +0 -18
  658. package/src/store/test/private-actions.js +22 -0
  659. package/src/store/test/private-selectors.js +52 -0
  660. package/src/store/test/selectors.js +52 -54
  661. package/src/style.scss +3 -5
  662. package/src/utils/block-variation-transforms.js +1 -1
  663. package/src/utils/parse-css-unit-to-px.js +3 -1
  664. package/src/utils/test/parse-css-unit-to-px.js +16 -24
  665. package/src/utils/transform-styles/index.js +1 -6
  666. package/build/components/inner-blocks/get-block-context.js +0 -45
  667. package/build/components/inner-blocks/get-block-context.js.map +0 -1
  668. package/build/components/off-canvas-editor/block-edit-button.js +0 -50
  669. package/build/components/off-canvas-editor/block-edit-button.js.map +0 -1
  670. package/build-module/components/inner-blocks/get-block-context.js +0 -37
  671. package/build-module/components/inner-blocks/get-block-context.js.map +0 -1
  672. package/build-module/components/off-canvas-editor/block-edit-button.js +0 -35
  673. package/build-module/components/off-canvas-editor/block-edit-button.js.map +0 -1
  674. package/src/components/inner-blocks/get-block-context.js +0 -39
  675. package/src/components/off-canvas-editor/block-edit-button.js +0 -27
@@ -7,9 +7,113 @@ import { applyFilters } from '@wordpress/hooks';
7
7
  * Internal dependencies
8
8
  */
9
9
  import '../anchor';
10
+ import { immutableSet } from '../utils';
10
11
 
11
12
  const noop = () => {};
12
13
 
14
+ describe( 'immutableSet', () => {
15
+ describe( 'handling falsy values properly', () => {
16
+ it( 'should create a new object if `undefined` is passed', () => {
17
+ const result = immutableSet( undefined, 'test', 1 );
18
+
19
+ expect( result ).toEqual( { test: 1 } );
20
+ } );
21
+
22
+ it( 'should create a new object if `null` is passed', () => {
23
+ const result = immutableSet( null, 'test', 1 );
24
+
25
+ expect( result ).toEqual( { test: 1 } );
26
+ } );
27
+
28
+ it( 'should create a new object if `false` is passed', () => {
29
+ const result = immutableSet( false, 'test', 1 );
30
+
31
+ expect( result ).toEqual( { test: 1 } );
32
+ } );
33
+
34
+ it( 'should create a new object if `0` is passed', () => {
35
+ const result = immutableSet( 0, 'test', 1 );
36
+
37
+ expect( result ).toEqual( { test: 1 } );
38
+ } );
39
+
40
+ it( 'should create a new object if an empty string is passed', () => {
41
+ const result = immutableSet( '', 'test', 1 );
42
+
43
+ expect( result ).toEqual( { test: 1 } );
44
+ } );
45
+
46
+ it( 'should create a new object if a NaN is passed', () => {
47
+ const result = immutableSet( NaN, 'test', 1 );
48
+
49
+ expect( result ).toEqual( { test: 1 } );
50
+ } );
51
+ } );
52
+
53
+ describe( 'manages data assignment properly', () => {
54
+ it( 'assigns value properly when it does not exist', () => {
55
+ const result = immutableSet( {}, 'test', 1 );
56
+
57
+ expect( result ).toEqual( { test: 1 } );
58
+ } );
59
+
60
+ it( 'overrides existing values', () => {
61
+ const result = immutableSet( { test: 1 }, 'test', 2 );
62
+
63
+ expect( result ).toEqual( { test: 2 } );
64
+ } );
65
+
66
+ describe( 'with array notation access', () => {
67
+ it( 'assigns values at deeper levels', () => {
68
+ const result = immutableSet( {}, [ 'foo', 'bar', 'baz' ], 5 );
69
+
70
+ expect( result ).toEqual( { foo: { bar: { baz: 5 } } } );
71
+ } );
72
+
73
+ it( 'overrides existing values at deeper levels', () => {
74
+ const result = immutableSet(
75
+ { foo: { bar: { baz: 1 } } },
76
+ [ 'foo', 'bar', 'baz' ],
77
+ 5
78
+ );
79
+
80
+ expect( result ).toEqual( { foo: { bar: { baz: 5 } } } );
81
+ } );
82
+
83
+ it( 'keeps other properties intact', () => {
84
+ const result = immutableSet(
85
+ { foo: { bar: { baz: 1 } } },
86
+ [ 'foo', 'bar', 'test' ],
87
+ 5
88
+ );
89
+
90
+ expect( result ).toEqual( {
91
+ foo: { bar: { baz: 1, test: 5 } },
92
+ } );
93
+ } );
94
+ } );
95
+ } );
96
+
97
+ describe( 'does not mutate the original object', () => {
98
+ it( 'clones the object at the first level', () => {
99
+ const input = {};
100
+ const result = immutableSet( input, 'test', 1 );
101
+
102
+ expect( result ).not.toBe( input );
103
+ } );
104
+
105
+ it( 'clones the object at deeper levels', () => {
106
+ const input = { foo: { bar: { baz: 1 } } };
107
+ const result = immutableSet( input, [ 'foo', 'bar', 'baz' ], 2 );
108
+
109
+ expect( result ).not.toBe( input );
110
+ expect( result.foo ).not.toBe( input.foo );
111
+ expect( result.foo.bar ).not.toBe( input.foo.bar );
112
+ expect( result.foo.bar.baz ).not.toBe( input.foo.bar.baz );
113
+ } );
114
+ } );
115
+ } );
116
+
13
117
  describe( 'anchor', () => {
14
118
  const blockSettings = {
15
119
  save: noop,
@@ -111,7 +111,7 @@ export function TypographyPanel( props ) {
111
111
  } );
112
112
 
113
113
  return (
114
- <InspectorControls __experimentalGroup="typography">
114
+ <InspectorControls group="typography">
115
115
  { ! isFontFamilyDisabled && (
116
116
  <ToolsPanelItem
117
117
  hasValue={ () => hasFontFamilyValue( props ) }
@@ -92,9 +92,9 @@ export function useColorProps( attributes ) {
92
92
  // Some color settings have a special handling for deprecated flags in `useSetting`,
93
93
  // so we can't unwrap them by doing const { ... } = useSetting('color')
94
94
  // until https://github.com/WordPress/gutenberg/issues/37094 is fixed.
95
- const userPalette = useSetting( 'color.palette.custom' ) || [];
96
- const themePalette = useSetting( 'color.palette.theme' ) || [];
97
- const defaultPalette = useSetting( 'color.palette.default' ) || [];
95
+ const userPalette = useSetting( 'color.palette.custom' );
96
+ const themePalette = useSetting( 'color.palette.theme' );
97
+ const defaultPalette = useSetting( 'color.palette.default' );
98
98
  const gradientsPerOrigin = useSetting( 'color.gradients' ) || EMPTY_OBJECT;
99
99
  const colors = useMemo(
100
100
  () => [
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { isEmpty, mapValues, get, setWith, clone } from 'lodash';
4
+ import { isEmpty, mapValues, get } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -30,8 +30,74 @@ export const cleanEmptyObject = ( object ) => {
30
30
  return isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;
31
31
  };
32
32
 
33
+ /**
34
+ * Converts a path to an array of its fragments.
35
+ * Supports strings, numbers and arrays:
36
+ *
37
+ * 'foo' => [ 'foo' ]
38
+ * 2 => [ '2' ]
39
+ * [ 'foo', 'bar' ] => [ 'foo', 'bar' ]
40
+ *
41
+ * @param {string|number|Array} path Path
42
+ * @return {Array} Normalized path.
43
+ */
44
+ function normalizePath( path ) {
45
+ if ( Array.isArray( path ) ) {
46
+ return path;
47
+ } else if ( typeof path === 'number' ) {
48
+ return [ path.toString() ];
49
+ }
50
+
51
+ return [ path ];
52
+ }
53
+
54
+ /**
55
+ * Clones an object.
56
+ * Non-object values are returned unchanged.
57
+ *
58
+ * @param {*} object Object to clone.
59
+ * @return {*} Cloned object, or original literal non-object value.
60
+ */
61
+ function cloneObject( object ) {
62
+ if ( typeof object === 'object' ) {
63
+ return {
64
+ ...Object.fromEntries(
65
+ Object.entries( object ).map( ( [ key, value ] ) => [
66
+ key,
67
+ cloneObject( value ),
68
+ ] )
69
+ ),
70
+ };
71
+ }
72
+
73
+ return object;
74
+ }
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
+ */
33
86
  export function immutableSet( object, path, value ) {
34
- return setWith( object ? clone( object ) : {}, path, value, clone );
87
+ const normalizedPath = normalizePath( path );
88
+ const newObject = object ? cloneObject( object ) : {};
89
+
90
+ normalizedPath.reduce( ( acc, key, i ) => {
91
+ if ( acc[ key ] === undefined ) {
92
+ acc[ key ] = {};
93
+ }
94
+ if ( i === normalizedPath.length - 1 ) {
95
+ acc[ key ] = value;
96
+ }
97
+ return acc[ key ];
98
+ }, newObject );
99
+
100
+ return newObject;
35
101
  }
36
102
 
37
103
  export function transformStyles(
package/src/index.js CHANGED
@@ -20,3 +20,4 @@ export * from './elements';
20
20
  export * from './utils';
21
21
  export { storeConfig, store } from './store';
22
22
  export { SETTINGS_DEFAULTS } from './store/defaults';
23
+ export { experiments } from './experiments';
@@ -71,6 +71,7 @@ export default {
71
71
  <div className="block-editor-hooks__layout-controls">
72
72
  <div className="block-editor-hooks__layout-controls-unit">
73
73
  <UnitControl
74
+ className="block-editor-hooks__layout-controls-unit-input"
74
75
  label={ __( 'Content' ) }
75
76
  labelPosition="top"
76
77
  __unstableInputWidth="80px"
@@ -91,6 +92,7 @@ export default {
91
92
  </div>
92
93
  <div className="block-editor-hooks__layout-controls-unit">
93
94
  <UnitControl
95
+ className="block-editor-hooks__layout-controls-unit-input"
94
96
  label={ __( 'Wide' ) }
95
97
  labelPosition="top"
96
98
  __unstableInputWidth="80px"
@@ -116,6 +118,7 @@ export default {
116
118
  ) }
117
119
  </p>
118
120
  <ToggleGroupControl
121
+ __nextHasNoMarginBottom
119
122
  label={ __( 'Justification' ) }
120
123
  value={ justifyContent }
121
124
  onChange={ onJustificationChange }
@@ -7,6 +7,7 @@ import {
7
7
  justifyCenter,
8
8
  justifyRight,
9
9
  justifySpaceBetween,
10
+ justifyStretch,
10
11
  arrowRight,
11
12
  arrowDown,
12
13
  } from '@wordpress/icons';
@@ -44,12 +45,15 @@ const alignItemsMap = {
44
45
  left: 'flex-start',
45
46
  right: 'flex-end',
46
47
  center: 'center',
48
+ stretch: 'stretch',
47
49
  };
48
50
 
49
51
  const verticalAlignmentMap = {
50
52
  top: 'flex-start',
51
53
  center: 'center',
52
54
  bottom: 'flex-end',
55
+ stretch: 'stretch',
56
+ 'space-between': 'space-between',
53
57
  };
54
58
 
55
59
  const flexWrapOptions = [ 'wrap', 'nowrap' ];
@@ -101,14 +105,13 @@ export default {
101
105
  onChange={ onChange }
102
106
  isToolbar
103
107
  />
104
- { allowVerticalAlignment &&
105
- layout?.orientation !== 'vertical' && (
106
- <FlexLayoutVerticalAlignmentControl
107
- layout={ layout }
108
- onChange={ onChange }
109
- isToolbar
110
- />
111
- ) }
108
+ { allowVerticalAlignment && (
109
+ <FlexLayoutVerticalAlignmentControl
110
+ layout={ layout }
111
+ onChange={ onChange }
112
+ isToolbar
113
+ />
114
+ ) }
112
115
  </BlockControls>
113
116
  );
114
117
  },
@@ -153,6 +156,9 @@ export default {
153
156
  rules.push( `justify-content: ${ justifyContent }` );
154
157
  }
155
158
  } else {
159
+ if ( verticalAlignment ) {
160
+ rules.push( `justify-content: ${ verticalAlignment }` );
161
+ }
156
162
  rules.push( 'flex-direction: column' );
157
163
  rules.push( `align-items: ${ alignItems }` );
158
164
  }
@@ -188,7 +194,14 @@ function FlexLayoutVerticalAlignmentControl( {
188
194
  onChange,
189
195
  isToolbar = false,
190
196
  } ) {
191
- const { verticalAlignment = verticalAlignmentMap.center } = layout;
197
+ const { orientation = 'horizontal' } = layout;
198
+
199
+ const defaultVerticalAlignment =
200
+ orientation === 'horizontal'
201
+ ? verticalAlignmentMap.center
202
+ : verticalAlignmentMap.top;
203
+
204
+ const { verticalAlignment = defaultVerticalAlignment } = layout;
192
205
 
193
206
  const onVerticalAlignmentChange = ( value ) => {
194
207
  onChange( {
@@ -201,6 +214,11 @@ function FlexLayoutVerticalAlignmentControl( {
201
214
  <BlockVerticalAlignmentControl
202
215
  onChange={ onVerticalAlignmentChange }
203
216
  value={ verticalAlignment }
217
+ controls={
218
+ orientation === 'horizontal'
219
+ ? [ 'top', 'center', 'bottom', 'stretch' ]
220
+ : [ 'top', 'center', 'bottom', 'space-between' ]
221
+ }
204
222
  />
205
223
  );
206
224
  }
@@ -255,6 +273,8 @@ function FlexLayoutJustifyContentControl( {
255
273
  const allowedControls = [ 'left', 'center', 'right' ];
256
274
  if ( orientation === 'horizontal' ) {
257
275
  allowedControls.push( 'space-between' );
276
+ } else {
277
+ allowedControls.push( 'stretch' );
258
278
  }
259
279
  if ( isToolbar ) {
260
280
  return (
@@ -293,10 +313,17 @@ function FlexLayoutJustifyContentControl( {
293
313
  icon: justifySpaceBetween,
294
314
  label: __( 'Space between items' ),
295
315
  } );
316
+ } else {
317
+ justificationOptions.push( {
318
+ value: 'stretch',
319
+ icon: justifyStretch,
320
+ label: __( 'Stretch items' ),
321
+ } );
296
322
  }
297
323
 
298
324
  return (
299
325
  <ToggleGroupControl
326
+ __nextHasNoMarginBottom
300
327
  label={ __( 'Justification' ) }
301
328
  value={ justifyContent }
302
329
  onChange={ onJustificationChange }
@@ -333,18 +360,43 @@ function FlexWrapControl( { layout, onChange } ) {
333
360
  }
334
361
 
335
362
  function OrientationControl( { layout, onChange } ) {
336
- const { orientation = 'horizontal' } = layout;
363
+ const {
364
+ orientation = 'horizontal',
365
+ verticalAlignment,
366
+ justifyContent,
367
+ } = layout;
337
368
  return (
338
369
  <ToggleGroupControl
370
+ __nextHasNoMarginBottom
339
371
  className="block-editor-hooks__flex-layout-orientation-controls"
340
372
  label={ __( 'Orientation' ) }
341
373
  value={ orientation }
342
- onChange={ ( value ) =>
343
- onChange( {
374
+ onChange={ ( value ) => {
375
+ // Make sure the vertical alignment and justification are compatible with the new orientation.
376
+ let newVerticalAlignment = verticalAlignment;
377
+ let newJustification = justifyContent;
378
+ if ( value === 'horizontal' ) {
379
+ if ( verticalAlignment === 'space-between' ) {
380
+ newVerticalAlignment = 'center';
381
+ }
382
+ if ( justifyContent === 'stretch' ) {
383
+ newJustification = 'left';
384
+ }
385
+ } else {
386
+ if ( verticalAlignment === 'stretch' ) {
387
+ newVerticalAlignment = 'top';
388
+ }
389
+ if ( justifyContent === 'space-between' ) {
390
+ newJustification = 'left';
391
+ }
392
+ }
393
+ return onChange( {
344
394
  ...layout,
345
395
  orientation: value,
346
- } )
347
- }
396
+ verticalAlignment: newVerticalAlignment,
397
+ justifyContent: newJustification,
398
+ } );
399
+ } }
348
400
  >
349
401
  <ToggleGroupControlOptionIcon
350
402
  icon={ arrowRight }
@@ -67,7 +67,6 @@ export default {
67
67
  info: alignmentInfo[ alignment ],
68
68
  } ) );
69
69
  }
70
- const { contentSize, wideSize } = layout;
71
70
 
72
71
  const alignments = [
73
72
  { name: 'left' },
@@ -75,14 +74,6 @@ export default {
75
74
  { name: 'right' },
76
75
  ];
77
76
 
78
- if ( contentSize ) {
79
- alignments.unshift( { name: 'full' } );
80
- }
81
-
82
- if ( wideSize ) {
83
- alignments.unshift( { name: 'wide', info: alignmentInfo.wide } );
84
- }
85
-
86
77
  alignments.unshift( { name: 'none', info: alignmentInfo.none } );
87
78
 
88
79
  return alignments;
@@ -25,6 +25,7 @@ import {
25
25
  retrieveSelectedAttribute,
26
26
  START_OF_SELECTED_AREA,
27
27
  } from '../utils/selection';
28
+ import { __experimentalUpdateSettings } from './private-actions';
28
29
 
29
30
  /** @typedef {import('../components/use-on-block-drop/types').WPDropOperation} WPDropOperation */
30
31
 
@@ -1263,28 +1264,6 @@ export function toggleBlockMode( clientId ) {
1263
1264
  };
1264
1265
  }
1265
1266
 
1266
- /**
1267
- * Returns an action object used in signalling that the block interface, eg. toolbar, outline, etc. should be hidden.
1268
- *
1269
- * @return {Object} Action object.
1270
- */
1271
- export function __experimentalHideBlockInterface() {
1272
- return {
1273
- type: 'HIDE_BLOCK_INTERFACE',
1274
- };
1275
- }
1276
-
1277
- /**
1278
- * Returns an action object used in signalling that the block interface, eg. toolbar, outline, etc. should be shown.
1279
- *
1280
- * @return {Object} Action object.
1281
- */
1282
- export function __experimentalShowBlockInterface() {
1283
- return {
1284
- type: 'SHOW_BLOCK_INTERFACE',
1285
- };
1286
- }
1287
-
1288
1267
  /**
1289
1268
  * Returns an action object used in signalling that the user has begun to type.
1290
1269
  *
@@ -1442,10 +1421,7 @@ export function updateBlockListSettings( clientId, settings ) {
1442
1421
  * @return {Object} Action object
1443
1422
  */
1444
1423
  export function updateSettings( settings ) {
1445
- return {
1446
- type: 'UPDATE_SETTINGS',
1447
- settings,
1448
- };
1424
+ return __experimentalUpdateSettings( settings, true );
1449
1425
  }
1450
1426
 
1451
1427
  /**
@@ -26,8 +26,9 @@ export const PREFERENCES_DEFAULTS = {
26
26
  * @property {boolean} canLockBlocks Whether the user can manage Block Lock state
27
27
  * @property {boolean} codeEditingEnabled Whether or not the user can switch to the code editor
28
28
  * @property {boolean} generateAnchors Enable/Disable auto anchor generation for Heading blocks
29
+ * @property {boolean} enableOpenverseMediaCategory Enable/Disable the Openverse media category in the inserter.
30
+ * @property {boolean} clearBlockSelection Whether the block editor should clear selection on mousedown when a block is not clicked.
29
31
  * @property {boolean} __experimentalCanUserUseUnfilteredHTML Whether the user should be able to use unfiltered HTML or the HTML should be filtered e.g., to remove elements considered insecure like iframes.
30
- * @property {boolean} __experimentalClearBlockSelection Whether the block editor should clear selection on mousedown when a block is not clicked.
31
32
  * @property {boolean} __experimentalBlockDirectory Whether the user has enabled the Block Directory
32
33
  * @property {Array} __experimentalBlockPatterns Array of objects representing the block patterns
33
34
  * @property {Array} __experimentalBlockPatternCategories Array of objects representing the block pattern categories
@@ -156,8 +157,12 @@ export const SETTINGS_DEFAULTS = {
156
157
  // Allows to disable block locking interface.
157
158
  canLockBlocks: true,
158
159
 
160
+ // Allows to disable Openverse media category in the inserter.
161
+ enableOpenverseMediaCategory: true,
162
+
163
+ clearBlockSelection: true,
164
+
159
165
  __experimentalCanUserUseUnfilteredHTML: false,
160
- __experimentalClearBlockSelection: true,
161
166
  __experimentalBlockDirectory: false,
162
167
  __mobileEnablePageTemplates: false,
163
168
  __experimentalBlockPatterns: [],
@@ -8,8 +8,11 @@ import { createReduxStore, registerStore } from '@wordpress/data';
8
8
  */
9
9
  import reducer from './reducer';
10
10
  import * as selectors from './selectors';
11
+ import * as privateActions from './private-actions';
12
+ import * as privateSelectors from './private-selectors';
11
13
  import * as actions from './actions';
12
14
  import { STORE_NAME } from './constants';
15
+ import { unlock } from '../experiments';
13
16
 
14
17
  /**
15
18
  * Block editor data store configuration.
@@ -32,8 +35,11 @@ export const store = createReduxStore( STORE_NAME, {
32
35
  persist: [ 'preferences' ],
33
36
  } );
34
37
 
35
- // Ideally we'd use register instead of register stores.
36
- registerStore( STORE_NAME, {
38
+ // We will be able to use the `register` function once we switch
39
+ // the "preferences" persistence to use the new preferences package.
40
+ const registeredStore = registerStore( STORE_NAME, {
37
41
  ...storeConfig,
38
42
  persist: [ 'preferences' ],
39
43
  } );
44
+ unlock( registeredStore ).registerPrivateActions( privateActions );
45
+ unlock( registeredStore ).registerPrivateSelectors( privateSelectors );
@@ -0,0 +1,65 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { Platform } from '@wordpress/element';
5
+
6
+ /**
7
+ * A list of private/experimental block editor settings that
8
+ * should not become a part of the WordPress public API.
9
+ * BlockEditorProvider will remove these settings from the
10
+ * settings object it receives.
11
+ *
12
+ * @see https://github.com/WordPress/gutenberg/pull/46131
13
+ */
14
+ const privateSettings = [ 'inserterMediaCategories' ];
15
+
16
+ /**
17
+ * Action that updates the block editor settings and
18
+ * conditionally preserves the experimental ones.
19
+ *
20
+ * @param {Object} settings Updated settings
21
+ * @param {boolean} stripExperimentalSettings Whether to strip experimental settings.
22
+ * @return {Object} Action object
23
+ */
24
+ export function __experimentalUpdateSettings(
25
+ settings,
26
+ stripExperimentalSettings = false
27
+ ) {
28
+ let cleanSettings = settings;
29
+ // There are no plugins in the mobile apps, so there is no
30
+ // need to strip the experimental settings:
31
+ if ( stripExperimentalSettings && Platform.OS === 'web' ) {
32
+ cleanSettings = {};
33
+ for ( const key in settings ) {
34
+ if ( ! privateSettings.includes( key ) ) {
35
+ cleanSettings[ key ] = settings[ key ];
36
+ }
37
+ }
38
+ }
39
+ return {
40
+ type: 'UPDATE_SETTINGS',
41
+ settings: cleanSettings,
42
+ };
43
+ }
44
+
45
+ /**
46
+ * Hides the block interface (eg. toolbar, outline, etc.)
47
+ *
48
+ * @return {Object} Action object.
49
+ */
50
+ export function hideBlockInterface() {
51
+ return {
52
+ type: 'HIDE_BLOCK_INTERFACE',
53
+ };
54
+ }
55
+
56
+ /**
57
+ * Shows the block interface (eg. toolbar, outline, etc.)
58
+ *
59
+ * @return {Object} Action object.
60
+ */
61
+ export function showBlockInterface() {
62
+ return {
63
+ type: 'SHOW_BLOCK_INTERFACE',
64
+ };
65
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Returns true if the block interface is hidden, or false otherwise.
3
+ *
4
+ * @param {Object} state Global application state.
5
+ *
6
+ * @return {boolean} Whether the block toolbar is hidden.
7
+ */
8
+ export function isBlockInterfaceHidden( state ) {
9
+ return state.isBlockInterfaceHidden;
10
+ }
11
+
12
+ /**
13
+ * Gets the client ids of the last inserted blocks.
14
+ *
15
+ * @param {Object} state Global application state.
16
+ * @return {Array|undefined} Client Ids of the last inserted block(s).
17
+ */
18
+ export function getLastInsertedBlocksClientIds( state ) {
19
+ return state?.lastBlockInserted?.clientIds;
20
+ }
@@ -1756,7 +1756,7 @@ export function lastBlockAttributesChange( state = null, action ) {
1756
1756
  * @param {?string} state Current state.
1757
1757
  * @param {Object} action Dispatched action.
1758
1758
  *
1759
- * @return {string} Updated state.
1759
+ * @return {string | undefined} Updated state.
1760
1760
  */
1761
1761
  export function automaticChangeStatus( state, action ) {
1762
1762
  switch ( action.type ) {