@wordpress/block-editor 12.5.0 → 12.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 (442) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +2 -6
  3. package/build/autocompleters/block.js +6 -2
  4. package/build/autocompleters/block.js.map +1 -1
  5. package/build/components/block-draggable/index.js +6 -3
  6. package/build/components/block-draggable/index.js.map +1 -1
  7. package/build/components/block-draggable/index.native.js +2 -2
  8. package/build/components/block-draggable/index.native.js.map +1 -1
  9. package/build/components/block-edit/edit.js +25 -13
  10. package/build/components/block-edit/edit.js.map +1 -1
  11. package/build/components/block-editing-mode/index.js +1 -1
  12. package/build/components/block-editing-mode/index.js.map +1 -1
  13. package/build/components/block-list/block-outline.native.js +14 -18
  14. package/build/components/block-list/block-outline.native.js.map +1 -1
  15. package/build/components/block-list/block.js +4 -2
  16. package/build/components/block-list/block.js.map +1 -1
  17. package/build/components/block-list/block.native.js +21 -42
  18. package/build/components/block-list/block.native.js.map +1 -1
  19. package/build/components/block-list/index.js +2 -4
  20. package/build/components/block-list/index.js.map +1 -1
  21. package/build/components/block-mover/index.native.js +1 -1
  22. package/build/components/block-mover/index.native.js.map +1 -1
  23. package/build/components/block-parent-selector/index.js +6 -21
  24. package/build/components/block-parent-selector/index.js.map +1 -1
  25. package/build/components/block-preview/auto.js +6 -1
  26. package/build/components/block-preview/auto.js.map +1 -1
  27. package/build/components/block-removal-warning-modal/index.js +1 -4
  28. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  29. package/build/components/block-settings/button.native.js +2 -2
  30. package/build/components/block-settings/button.native.js.map +1 -1
  31. package/build/components/block-settings-menu/block-settings-dropdown.js +3 -17
  32. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  33. package/build/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +7 -5
  34. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
  35. package/build/components/block-toolbar/index.js +4 -33
  36. package/build/components/block-toolbar/index.js.map +1 -1
  37. package/build/components/block-toolbar/index.native.js +62 -3
  38. package/build/components/block-toolbar/index.native.js.map +1 -1
  39. package/build/components/block-toolbar/utils.js +56 -51
  40. package/build/components/block-toolbar/utils.js.map +1 -1
  41. package/build/components/block-tools/block-contextual-toolbar.js +4 -2
  42. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  43. package/build/components/block-variation-picker/index.native.js +10 -20
  44. package/build/components/block-variation-picker/index.native.js.map +1 -1
  45. package/build/components/colors-gradients/control.js +4 -2
  46. package/build/components/colors-gradients/control.js.map +1 -1
  47. package/build/components/editor-styles/index.js +2 -2
  48. package/build/components/editor-styles/index.js.map +1 -1
  49. package/build/components/font-sizes/fluid-utils.js +11 -11
  50. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  51. package/build/components/global-styles/behaviors-panel.js +66 -0
  52. package/build/components/global-styles/behaviors-panel.js.map +1 -0
  53. package/build/components/global-styles/color-panel.js +21 -15
  54. package/build/components/global-styles/color-panel.js.map +1 -1
  55. package/build/components/global-styles/dimensions-panel.js +13 -2
  56. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  57. package/build/components/global-styles/get-block-css-selector.js +4 -8
  58. package/build/components/global-styles/get-block-css-selector.js.map +1 -1
  59. package/build/components/global-styles/hooks.js +131 -27
  60. package/build/components/global-styles/hooks.js.map +1 -1
  61. package/build/components/global-styles/index.js +20 -0
  62. package/build/components/global-styles/index.js.map +1 -1
  63. package/build/components/global-styles/typography-panel.js +18 -3
  64. package/build/components/global-styles/typography-panel.js.map +1 -1
  65. package/build/components/global-styles/typography-utils.js +4 -4
  66. package/build/components/global-styles/typography-utils.js.map +1 -1
  67. package/build/components/global-styles/use-global-styles-output.js +12 -18
  68. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  69. package/build/components/global-styles/utils.js +7 -7
  70. package/build/components/global-styles/utils.js.map +1 -1
  71. package/build/components/iframe/index.js +36 -48
  72. package/build/components/iframe/index.js.map +1 -1
  73. package/build/components/iframe/use-compatibility-styles.js +5 -0
  74. package/build/components/iframe/use-compatibility-styles.js.map +1 -1
  75. package/build/components/index.js +1 -10
  76. package/build/components/index.js.map +1 -1
  77. package/build/components/inner-blocks/index.js +3 -1
  78. package/build/components/inner-blocks/index.js.map +1 -1
  79. package/build/components/inner-blocks/index.native.js +3 -1
  80. package/build/components/inner-blocks/index.native.js.map +1 -1
  81. package/build/components/inner-blocks/use-nested-settings-update.js +33 -7
  82. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  83. package/build/components/inserter/hooks/use-block-types-state.js +6 -2
  84. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  85. package/build/components/inserter/hooks/use-debounced-input.js +5 -7
  86. package/build/components/inserter/hooks/use-debounced-input.js.map +1 -1
  87. package/build/components/inserter/hooks/use-patterns-state.js +3 -2
  88. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  89. package/build/components/inserter/index.js +2 -4
  90. package/build/components/inserter/index.js.map +1 -1
  91. package/build/components/inserter/index.native.js +21 -32
  92. package/build/components/inserter/index.native.js.map +1 -1
  93. package/build/components/inserter/reusable-block-rename-hint.js +23 -3
  94. package/build/components/inserter/reusable-block-rename-hint.js.map +1 -1
  95. package/build/components/inserter/reusable-blocks-tab.js +3 -2
  96. package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
  97. package/build/components/inserter-list-item/index.js +1 -1
  98. package/build/components/inserter-list-item/index.js.map +1 -1
  99. package/build/components/link-control/index.js +51 -7
  100. package/build/components/link-control/index.js.map +1 -1
  101. package/build/components/link-control/link-preview.js +3 -3
  102. package/build/components/link-control/link-preview.js.map +1 -1
  103. package/build/components/link-control/search-item.js +1 -1
  104. package/build/components/link-control/search-item.js.map +1 -1
  105. package/build/components/list-view/use-list-view-client-ids.js +2 -2
  106. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  107. package/build/components/list-view/use-list-view-drop-zone.js +6 -1
  108. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  109. package/build/components/media-placeholder/index.native.js +65 -31
  110. package/build/components/media-placeholder/index.native.js.map +1 -1
  111. package/build/components/media-replace-flow/index.native.js +15 -3
  112. package/build/components/media-replace-flow/index.native.js.map +1 -1
  113. package/build/components/preview-options/index.js +2 -2
  114. package/build/components/preview-options/index.js.map +1 -1
  115. package/build/components/rich-text/content.js +0 -36
  116. package/build/components/rich-text/content.js.map +1 -1
  117. package/build/components/rich-text/format-edit.js +57 -28
  118. package/build/components/rich-text/format-edit.js.map +1 -1
  119. package/build/components/rich-text/get-rich-text-values.js +111 -0
  120. package/build/components/rich-text/get-rich-text-values.js.map +1 -0
  121. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  122. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  123. package/build/components/spacing-sizes-control/input-controls/axial.js +6 -2
  124. package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
  125. package/build/components/spacing-sizes-control/input-controls/separated.js +5 -1
  126. package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
  127. package/build/components/spacing-sizes-control/input-controls/single.js +5 -1
  128. package/build/components/spacing-sizes-control/input-controls/single.js.map +1 -1
  129. package/build/components/spacing-sizes-control/utils.js +2 -2
  130. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  131. package/build/components/use-block-display-information/index.js +7 -3
  132. package/build/components/use-block-display-information/index.js.map +1 -1
  133. package/build/components/use-block-drop-zone/index.native.js +49 -8
  134. package/build/components/use-block-drop-zone/index.native.js.map +1 -1
  135. package/build/components/use-setting/index.js +5 -9
  136. package/build/components/use-setting/index.js.map +1 -1
  137. package/build/hooks/behaviors.js +5 -12
  138. package/build/hooks/behaviors.js.map +1 -1
  139. package/build/hooks/border.js +2 -1
  140. package/build/hooks/border.js.map +1 -1
  141. package/build/hooks/margin.js +1 -1
  142. package/build/hooks/margin.js.map +1 -1
  143. package/build/hooks/padding.js +1 -1
  144. package/build/hooks/padding.js.map +1 -1
  145. package/build/hooks/style.js +11 -2
  146. package/build/hooks/style.js.map +1 -1
  147. package/build/hooks/utils.js +1 -7
  148. package/build/hooks/utils.js.map +1 -1
  149. package/build/private-apis.js +10 -3
  150. package/build/private-apis.js.map +1 -1
  151. package/build/store/actions.js +3 -4
  152. package/build/store/actions.js.map +1 -1
  153. package/build/store/private-selectors.js +5 -6
  154. package/build/store/private-selectors.js.map +1 -1
  155. package/build/store/reducer.js +0 -1
  156. package/build/store/reducer.js.map +1 -1
  157. package/build/store/selectors.js +23 -79
  158. package/build/store/selectors.js.map +1 -1
  159. package/build/utils/object.js +38 -2
  160. package/build/utils/object.js.map +1 -1
  161. package/build-module/autocompleters/block.js +7 -3
  162. package/build-module/autocompleters/block.js.map +1 -1
  163. package/build-module/components/block-draggable/index.js +6 -3
  164. package/build-module/components/block-draggable/index.js.map +1 -1
  165. package/build-module/components/block-draggable/index.native.js +2 -2
  166. package/build-module/components/block-draggable/index.native.js.map +1 -1
  167. package/build-module/components/block-edit/edit.js +27 -10
  168. package/build-module/components/block-edit/edit.js.map +1 -1
  169. package/build-module/components/block-editing-mode/index.js +1 -1
  170. package/build-module/components/block-editing-mode/index.js.map +1 -1
  171. package/build-module/components/block-list/block-outline.native.js +14 -18
  172. package/build-module/components/block-list/block-outline.native.js.map +1 -1
  173. package/build-module/components/block-list/block.js +4 -2
  174. package/build-module/components/block-list/block.js.map +1 -1
  175. package/build-module/components/block-list/block.native.js +24 -43
  176. package/build-module/components/block-list/block.native.js.map +1 -1
  177. package/build-module/components/block-list/index.js +2 -3
  178. package/build-module/components/block-list/index.js.map +1 -1
  179. package/build-module/components/block-mover/index.native.js +3 -3
  180. package/build-module/components/block-mover/index.native.js.map +1 -1
  181. package/build-module/components/block-parent-selector/index.js +7 -22
  182. package/build-module/components/block-parent-selector/index.js.map +1 -1
  183. package/build-module/components/block-preview/auto.js +6 -1
  184. package/build-module/components/block-preview/auto.js.map +1 -1
  185. package/build-module/components/block-removal-warning-modal/index.js +1 -4
  186. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  187. package/build-module/components/block-settings/button.native.js +3 -3
  188. package/build-module/components/block-settings/button.native.js.map +1 -1
  189. package/build-module/components/block-settings-menu/block-settings-dropdown.js +4 -18
  190. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  191. package/build-module/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +9 -7
  192. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
  193. package/build-module/components/block-toolbar/index.js +6 -35
  194. package/build-module/components/block-toolbar/index.js.map +1 -1
  195. package/build-module/components/block-toolbar/index.native.js +60 -4
  196. package/build-module/components/block-toolbar/index.native.js.map +1 -1
  197. package/build-module/components/block-toolbar/utils.js +54 -49
  198. package/build-module/components/block-toolbar/utils.js.map +1 -1
  199. package/build-module/components/block-tools/block-contextual-toolbar.js +4 -2
  200. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  201. package/build-module/components/block-variation-picker/index.native.js +13 -23
  202. package/build-module/components/block-variation-picker/index.native.js.map +1 -1
  203. package/build-module/components/colors-gradients/control.js +3 -2
  204. package/build-module/components/colors-gradients/control.js.map +1 -1
  205. package/build-module/components/editor-styles/index.js +2 -2
  206. package/build-module/components/editor-styles/index.js.map +1 -1
  207. package/build-module/components/font-sizes/fluid-utils.js +11 -11
  208. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  209. package/build-module/components/global-styles/behaviors-panel.js +57 -0
  210. package/build-module/components/global-styles/behaviors-panel.js.map +1 -0
  211. package/build-module/components/global-styles/color-panel.js +21 -15
  212. package/build-module/components/global-styles/color-panel.js.map +1 -1
  213. package/build-module/components/global-styles/dimensions-panel.js +13 -2
  214. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  215. package/build-module/components/global-styles/get-block-css-selector.js +4 -8
  216. package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
  217. package/build-module/components/global-styles/hooks.js +127 -27
  218. package/build-module/components/global-styles/hooks.js.map +1 -1
  219. package/build-module/components/global-styles/index.js +2 -1
  220. package/build-module/components/global-styles/index.js.map +1 -1
  221. package/build-module/components/global-styles/typography-panel.js +18 -3
  222. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  223. package/build-module/components/global-styles/typography-utils.js +4 -4
  224. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  225. package/build-module/components/global-styles/use-global-styles-output.js +13 -18
  226. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  227. package/build-module/components/global-styles/utils.js +6 -6
  228. package/build-module/components/global-styles/utils.js.map +1 -1
  229. package/build-module/components/iframe/index.js +37 -49
  230. package/build-module/components/iframe/index.js.map +1 -1
  231. package/build-module/components/iframe/use-compatibility-styles.js +5 -0
  232. package/build-module/components/iframe/use-compatibility-styles.js.map +1 -1
  233. package/build-module/components/index.js +0 -5
  234. package/build-module/components/index.js.map +1 -1
  235. package/build-module/components/inner-blocks/index.js +3 -1
  236. package/build-module/components/inner-blocks/index.js.map +1 -1
  237. package/build-module/components/inner-blocks/index.native.js +3 -1
  238. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  239. package/build-module/components/inner-blocks/use-nested-settings-update.js +30 -7
  240. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  241. package/build-module/components/inserter/hooks/use-block-types-state.js +7 -3
  242. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  243. package/build-module/components/inserter/hooks/use-debounced-input.js +5 -7
  244. package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -1
  245. package/build-module/components/inserter/hooks/use-patterns-state.js +3 -2
  246. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  247. package/build-module/components/inserter/index.js +2 -4
  248. package/build-module/components/inserter/index.js.map +1 -1
  249. package/build-module/components/inserter/index.native.js +22 -33
  250. package/build-module/components/inserter/index.native.js.map +1 -1
  251. package/build-module/components/inserter/reusable-block-rename-hint.js +22 -3
  252. package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -1
  253. package/build-module/components/inserter/reusable-blocks-tab.js +3 -2
  254. package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
  255. package/build-module/components/inserter-list-item/index.js +1 -1
  256. package/build-module/components/inserter-list-item/index.js.map +1 -1
  257. package/build-module/components/link-control/index.js +49 -7
  258. package/build-module/components/link-control/index.js.map +1 -1
  259. package/build-module/components/link-control/link-preview.js +3 -3
  260. package/build-module/components/link-control/link-preview.js.map +1 -1
  261. package/build-module/components/link-control/search-item.js +1 -1
  262. package/build-module/components/link-control/search-item.js.map +1 -1
  263. package/build-module/components/list-view/use-list-view-client-ids.js +2 -2
  264. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  265. package/build-module/components/list-view/use-list-view-drop-zone.js +6 -1
  266. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  267. package/build-module/components/media-placeholder/index.native.js +66 -33
  268. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  269. package/build-module/components/media-replace-flow/index.native.js +15 -3
  270. package/build-module/components/media-replace-flow/index.native.js.map +1 -1
  271. package/build-module/components/preview-options/index.js +2 -2
  272. package/build-module/components/preview-options/index.js.map +1 -1
  273. package/build-module/components/rich-text/content.js +1 -36
  274. package/build-module/components/rich-text/content.js.map +1 -1
  275. package/build-module/components/rich-text/format-edit.js +51 -26
  276. package/build-module/components/rich-text/format-edit.js.map +1 -1
  277. package/build-module/components/rich-text/get-rich-text-values.js +100 -0
  278. package/build-module/components/rich-text/get-rich-text-values.js.map +1 -0
  279. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  280. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  281. package/build-module/components/spacing-sizes-control/input-controls/axial.js +7 -3
  282. package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
  283. package/build-module/components/spacing-sizes-control/input-controls/separated.js +6 -2
  284. package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
  285. package/build-module/components/spacing-sizes-control/input-controls/single.js +6 -2
  286. package/build-module/components/spacing-sizes-control/input-controls/single.js.map +1 -1
  287. package/build-module/components/spacing-sizes-control/utils.js +2 -2
  288. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  289. package/build-module/components/use-block-display-information/index.js +7 -3
  290. package/build-module/components/use-block-display-information/index.js.map +1 -1
  291. package/build-module/components/use-block-drop-zone/index.native.js +50 -8
  292. package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
  293. package/build-module/components/use-setting/index.js +5 -9
  294. package/build-module/components/use-setting/index.js.map +1 -1
  295. package/build-module/hooks/behaviors.js +5 -12
  296. package/build-module/hooks/behaviors.js.map +1 -1
  297. package/build-module/hooks/border.js +2 -1
  298. package/build-module/hooks/border.js.map +1 -1
  299. package/build-module/hooks/margin.js +1 -1
  300. package/build-module/hooks/margin.js.map +1 -1
  301. package/build-module/hooks/padding.js +1 -1
  302. package/build-module/hooks/padding.js.map +1 -1
  303. package/build-module/hooks/style.js +11 -2
  304. package/build-module/hooks/style.js.map +1 -1
  305. package/build-module/hooks/utils.js +2 -7
  306. package/build-module/hooks/utils.js.map +1 -1
  307. package/build-module/private-apis.js +7 -2
  308. package/build-module/private-apis.js.map +1 -1
  309. package/build-module/store/actions.js +4 -5
  310. package/build-module/store/actions.js.map +1 -1
  311. package/build-module/store/private-selectors.js +3 -3
  312. package/build-module/store/private-selectors.js.map +1 -1
  313. package/build-module/store/reducer.js +0 -1
  314. package/build-module/store/reducer.js.map +1 -1
  315. package/build-module/store/selectors.js +20 -75
  316. package/build-module/store/selectors.js.map +1 -1
  317. package/build-module/utils/object.js +34 -2
  318. package/build-module/utils/object.js.map +1 -1
  319. package/build-style/content-rtl.css +2 -1
  320. package/build-style/content.css +2 -1
  321. package/build-style/style-rtl.css +25 -6
  322. package/build-style/style.css +25 -6
  323. package/package.json +32 -32
  324. package/src/autocompleters/block.js +21 -6
  325. package/src/components/block-controls/README.md +89 -0
  326. package/src/components/block-draggable/index.js +13 -4
  327. package/src/components/block-draggable/index.native.js +7 -3
  328. package/src/components/block-draggable/test/index.native.js +2 -57
  329. package/src/components/block-edit/edit.js +26 -9
  330. package/src/components/block-edit/test/edit.js +1 -1
  331. package/src/components/block-editing-mode/index.js +1 -1
  332. package/src/components/block-list/block-outline.native.js +26 -25
  333. package/src/components/block-list/block.js +6 -1
  334. package/src/components/block-list/block.native.js +24 -38
  335. package/src/components/block-list/block.native.scss +18 -40
  336. package/src/components/block-list/index.js +3 -6
  337. package/src/components/block-list/style.native.scss +3 -3
  338. package/src/components/block-list/test/block-invalid-warning.native.js +8 -1
  339. package/src/components/block-mover/index.native.js +3 -3
  340. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +40 -6
  341. package/src/components/block-parent-selector/index.js +30 -42
  342. package/src/components/block-preview/auto.js +8 -1
  343. package/src/components/block-preview/style.scss +2 -1
  344. package/src/components/block-removal-warning-modal/index.js +0 -3
  345. package/src/components/block-settings/button.native.js +12 -6
  346. package/src/components/block-settings-menu/block-settings-dropdown.js +4 -13
  347. package/src/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +15 -10
  348. package/src/components/block-toolbar/index.js +36 -64
  349. package/src/components/block-toolbar/index.native.js +86 -6
  350. package/src/components/{block-mobile-toolbar/test/block-actions-menu.native.js → block-toolbar/test/block-toolbar-menu.native.js} +20 -54
  351. package/src/components/block-toolbar/test/index.native.js +42 -0
  352. package/src/components/block-toolbar/utils.js +57 -45
  353. package/src/components/block-tools/block-contextual-toolbar.js +43 -35
  354. package/src/components/block-tools/style.scss +17 -5
  355. package/src/components/block-variation-picker/index.native.js +52 -72
  356. package/src/components/button-block-appender/styles.native.scss +2 -2
  357. package/src/components/caption/README.md +49 -0
  358. package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
  359. package/src/components/colors-gradients/control.js +3 -2
  360. package/src/components/editor-styles/index.js +2 -2
  361. package/src/components/font-sizes/fluid-utils.js +17 -17
  362. package/src/components/font-sizes/test/fluid-utils.js +6 -6
  363. package/src/components/global-styles/behaviors-panel.js +71 -0
  364. package/src/components/global-styles/color-panel.js +23 -16
  365. package/src/components/global-styles/dimensions-panel.js +8 -2
  366. package/src/components/global-styles/get-block-css-selector.js +5 -9
  367. package/src/components/global-styles/hooks.js +134 -31
  368. package/src/components/global-styles/index.js +3 -0
  369. package/src/components/global-styles/test/typography-utils.js +6 -6
  370. package/src/components/global-styles/typography-panel.js +17 -5
  371. package/src/components/global-styles/typography-utils.js +4 -4
  372. package/src/components/global-styles/use-global-styles-output.js +36 -18
  373. package/src/components/global-styles/utils.js +17 -7
  374. package/src/components/iframe/index.js +30 -56
  375. package/src/components/iframe/use-compatibility-styles.js +5 -0
  376. package/src/components/index.js +0 -5
  377. package/src/components/inner-blocks/README.md +10 -0
  378. package/src/components/inner-blocks/index.js +4 -0
  379. package/src/components/inner-blocks/index.native.js +4 -0
  380. package/src/components/inner-blocks/use-nested-settings-update.js +32 -5
  381. package/src/components/inserter/hooks/use-block-types-state.js +15 -6
  382. package/src/components/inserter/hooks/use-debounced-input.js +8 -7
  383. package/src/components/inserter/hooks/use-patterns-state.js +2 -1
  384. package/src/components/inserter/index.js +2 -3
  385. package/src/components/inserter/index.native.js +17 -36
  386. package/src/components/inserter/reusable-block-rename-hint.js +18 -1
  387. package/src/components/inserter/reusable-blocks-tab.js +4 -1
  388. package/src/components/inserter/style.native.scss +10 -15
  389. package/src/components/inserter-list-item/index.js +3 -1
  390. package/src/components/link-control/README.md +12 -3
  391. package/src/components/link-control/index.js +47 -7
  392. package/src/components/link-control/link-preview.js +6 -4
  393. package/src/components/link-control/search-item.js +1 -1
  394. package/src/components/link-control/style.scss +11 -3
  395. package/src/components/link-control/test/index.js +28 -1
  396. package/src/components/list-view/use-list-view-client-ids.js +2 -2
  397. package/src/components/list-view/use-list-view-drop-zone.js +5 -1
  398. package/src/components/media-placeholder/index.native.js +108 -59
  399. package/src/components/media-placeholder/styles.native.scss +59 -24
  400. package/src/components/media-replace-flow/index.native.js +12 -3
  401. package/src/components/media-upload/test/index.native.js +1 -0
  402. package/src/components/preview-options/README.md +18 -17
  403. package/src/components/preview-options/index.js +2 -2
  404. package/src/components/rich-text/content.js +1 -46
  405. package/src/components/rich-text/format-edit.js +62 -38
  406. package/src/components/rich-text/get-rich-text-values.js +99 -0
  407. package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  408. package/src/components/spacing-sizes-control/input-controls/axial.js +17 -2
  409. package/src/components/spacing-sizes-control/input-controls/separated.js +17 -2
  410. package/src/components/spacing-sizes-control/input-controls/single.js +12 -2
  411. package/src/components/spacing-sizes-control/test/utils.js +9 -1
  412. package/src/components/spacing-sizes-control/utils.js +2 -2
  413. package/src/components/text-transform-control/README.md +44 -0
  414. package/src/components/use-block-display-information/index.js +12 -5
  415. package/src/components/use-block-drop-zone/index.native.js +65 -28
  416. package/src/components/use-setting/index.js +8 -8
  417. package/src/hooks/behaviors.js +10 -16
  418. package/src/hooks/border.js +2 -1
  419. package/src/hooks/margin.js +4 -1
  420. package/src/hooks/padding.js +4 -1
  421. package/src/hooks/style.js +7 -3
  422. package/src/hooks/utils.js +5 -7
  423. package/src/private-apis.js +9 -1
  424. package/src/store/actions.js +23 -30
  425. package/src/store/private-selectors.js +3 -6
  426. package/src/store/reducer.js +0 -1
  427. package/src/store/selectors.js +36 -85
  428. package/src/store/test/actions.js +3 -0
  429. package/src/store/test/private-selectors.js +5 -5
  430. package/src/store/test/reducer.js +14 -7
  431. package/src/store/test/selectors.js +8 -7
  432. package/src/utils/object.js +32 -2
  433. package/src/utils/test/object.js +36 -0
  434. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
  435. package/build/components/block-mobile-toolbar/index.native.js +0 -135
  436. package/build/components/block-mobile-toolbar/index.native.js.map +0 -1
  437. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
  438. package/build-module/components/block-mobile-toolbar/index.native.js +0 -116
  439. package/build-module/components/block-mobile-toolbar/index.native.js.map +0 -1
  440. package/src/components/block-mobile-toolbar/index.native.js +0 -127
  441. package/src/components/block-mobile-toolbar/style.native.scss +0 -16
  442. /package/src/components/{block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap → block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap} +0 -0
@@ -2,27 +2,28 @@
2
2
  * External dependencies
3
3
  */
4
4
  import fastDeepEqual from 'fast-deep-equal/es6';
5
- import { get, set } from 'lodash';
6
5
 
7
6
  /**
8
7
  * WordPress dependencies
9
8
  */
10
9
  import { useContext, useCallback, useMemo } from '@wordpress/element';
11
10
  import { useSelect } from '@wordpress/data';
12
- import { store as blocksStore } from '@wordpress/blocks';
11
+ import { store as blocksStore, hasBlockSupport } from '@wordpress/blocks';
13
12
  import { _x } from '@wordpress/i18n';
14
13
 
15
14
  /**
16
15
  * Internal dependencies
17
16
  */
18
17
  import { getValueFromVariable, getPresetVariableFromValue } from './utils';
18
+ import { getValueFromObjectPath, setImmutably } from '../../utils/object';
19
19
  import { GlobalStylesContext } from './context';
20
20
  import { unlock } from '../../lock-unlock';
21
21
 
22
- const EMPTY_CONFIG = { settings: {}, styles: {} };
22
+ const EMPTY_CONFIG = { settings: {}, styles: {}, behaviors: {} };
23
23
 
24
24
  const VALID_SETTINGS = [
25
25
  'appearanceTools',
26
+ 'behaviors',
26
27
  'useRootPaddingAwareAlignments',
27
28
  'border.color',
28
29
  'border.radius',
@@ -88,7 +89,6 @@ export const useGlobalStylesReset = () => {
88
89
 
89
90
  export function useGlobalSetting( propertyPath, blockName, source = 'all' ) {
90
91
  const { setUserConfig, ...configs } = useContext( GlobalStylesContext );
91
-
92
92
  const appendedBlockPath = blockName ? '.blocks.' + blockName : '';
93
93
  const appendedPropertyPath = propertyPath ? '.' + propertyPath : '';
94
94
  const contextualPath = `settings${ appendedBlockPath }${ appendedPropertyPath }`;
@@ -103,20 +103,21 @@ export function useGlobalSetting( propertyPath, blockName, source = 'all' ) {
103
103
 
104
104
  if ( propertyPath ) {
105
105
  return (
106
- get( configToUse, contextualPath ) ??
107
- get( configToUse, globalPath )
106
+ getValueFromObjectPath( configToUse, contextualPath ) ??
107
+ getValueFromObjectPath( configToUse, globalPath )
108
108
  );
109
109
  }
110
110
 
111
- const result = {};
111
+ let result = {};
112
112
  VALID_SETTINGS.forEach( ( setting ) => {
113
113
  const value =
114
- get(
114
+ getValueFromObjectPath(
115
115
  configToUse,
116
116
  `settings${ appendedBlockPath }.${ setting }`
117
- ) ?? get( configToUse, `settings.${ setting }` );
117
+ ) ??
118
+ getValueFromObjectPath( configToUse, `settings.${ setting }` );
118
119
  if ( value ) {
119
- set( result, setting, value );
120
+ result = setImmutably( result, setting.split( '.' ), value );
120
121
  }
121
122
  } );
122
123
  return result;
@@ -130,15 +131,10 @@ export function useGlobalSetting( propertyPath, blockName, source = 'all' ) {
130
131
  ] );
131
132
 
132
133
  const setSetting = ( newValue ) => {
133
- setUserConfig( ( currentConfig ) => {
134
- // Deep clone `currentConfig` to avoid mutating it later.
135
- const newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );
136
- set( newUserConfig, contextualPath, newValue );
137
-
138
- return newUserConfig;
139
- } );
134
+ setUserConfig( ( currentConfig ) =>
135
+ setImmutably( currentConfig, contextualPath.split( '.' ), newValue )
136
+ );
140
137
  };
141
-
142
138
  return [ settingValue, setSetting ];
143
139
  }
144
140
 
@@ -160,12 +156,10 @@ export function useGlobalStyle(
160
156
  : `styles.blocks.${ blockName }${ appendedPath }`;
161
157
 
162
158
  const setStyle = ( newValue ) => {
163
- setUserConfig( ( currentConfig ) => {
164
- // Deep clone `currentConfig` to avoid mutating it later.
165
- const newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );
166
- set(
167
- newUserConfig,
168
- finalPath,
159
+ setUserConfig( ( currentConfig ) =>
160
+ setImmutably(
161
+ currentConfig,
162
+ finalPath.split( '.' ),
169
163
  shouldDecodeEncode
170
164
  ? getPresetVariableFromValue(
171
165
  mergedConfig.settings,
@@ -174,27 +168,26 @@ export function useGlobalStyle(
174
168
  newValue
175
169
  )
176
170
  : newValue
177
- );
178
- return newUserConfig;
179
- } );
171
+ )
172
+ );
180
173
  };
181
174
 
182
175
  let rawResult, result;
183
176
  switch ( source ) {
184
177
  case 'all':
185
- rawResult = get( mergedConfig, finalPath );
178
+ rawResult = getValueFromObjectPath( mergedConfig, finalPath );
186
179
  result = shouldDecodeEncode
187
180
  ? getValueFromVariable( mergedConfig, blockName, rawResult )
188
181
  : rawResult;
189
182
  break;
190
183
  case 'user':
191
- rawResult = get( userConfig, finalPath );
184
+ rawResult = getValueFromObjectPath( userConfig, finalPath );
192
185
  result = shouldDecodeEncode
193
186
  ? getValueFromVariable( mergedConfig, blockName, rawResult )
194
187
  : rawResult;
195
188
  break;
196
189
  case 'base':
197
- rawResult = get( baseConfig, finalPath );
190
+ rawResult = getValueFromObjectPath( baseConfig, finalPath );
198
191
  result = shouldDecodeEncode
199
192
  ? getValueFromVariable( baseConfig, blockName, rawResult )
200
193
  : rawResult;
@@ -333,7 +326,8 @@ export function useSettingsForBlockElement(
333
326
  const sides = Array.isArray( supports?.spacing?.[ key ] )
334
327
  ? supports?.spacing?.[ key ]
335
328
  : supports?.spacing?.[ key ]?.sides;
336
- if ( sides?.length ) {
329
+ // Check if spacing type is supported before adding sides.
330
+ if ( sides?.length && updatedSettings.spacing?.[ key ] ) {
337
331
  updatedSettings.spacing = {
338
332
  ...updatedSettings.spacing,
339
333
  [ key ]: {
@@ -467,3 +461,112 @@ export function useGradientsPerOrigin( settings ) {
467
461
  shouldDisplayDefaultGradients,
468
462
  ] );
469
463
  }
464
+
465
+ export function __experimentalUseGlobalBehaviors( blockName, source = 'all' ) {
466
+ const {
467
+ merged: mergedConfig,
468
+ base: baseConfig,
469
+ user: userConfig,
470
+ setUserConfig,
471
+ } = useContext( GlobalStylesContext );
472
+ const finalPath = ! blockName
473
+ ? `behaviors`
474
+ : `behaviors.blocks.${ blockName }`;
475
+
476
+ let rawResult, result;
477
+ switch ( source ) {
478
+ case 'all':
479
+ rawResult = getValueFromObjectPath( mergedConfig, finalPath );
480
+ result = getValueFromVariable( mergedConfig, blockName, rawResult );
481
+ break;
482
+ case 'user':
483
+ rawResult = getValueFromObjectPath( userConfig, finalPath );
484
+ result = getValueFromVariable( mergedConfig, blockName, rawResult );
485
+ break;
486
+ case 'base':
487
+ rawResult = getValueFromObjectPath( baseConfig, finalPath );
488
+ result = getValueFromVariable( baseConfig, blockName, rawResult );
489
+ break;
490
+ default:
491
+ throw 'Unsupported source';
492
+ }
493
+
494
+ const animation = result?.lightbox?.animation || 'zoom';
495
+
496
+ const setBehavior = ( newValue ) => {
497
+ let newBehavior;
498
+ // The user saves with Apply Globally option.
499
+ if ( typeof newValue === 'object' ) {
500
+ newBehavior = newValue;
501
+ } else {
502
+ switch ( newValue ) {
503
+ case 'lightbox':
504
+ newBehavior = {
505
+ lightbox: {
506
+ enabled: true,
507
+ animation,
508
+ },
509
+ };
510
+ break;
511
+ case 'fade':
512
+ newBehavior = {
513
+ lightbox: {
514
+ enabled: true,
515
+ animation: 'fade',
516
+ },
517
+ };
518
+ break;
519
+ case 'zoom':
520
+ newBehavior = {
521
+ lightbox: {
522
+ enabled: true,
523
+ animation: 'zoom',
524
+ },
525
+ };
526
+ break;
527
+ case '':
528
+ newBehavior = {
529
+ lightbox: {
530
+ enabled: false,
531
+ animation,
532
+ },
533
+ };
534
+ break;
535
+ default:
536
+ break;
537
+ }
538
+ }
539
+ setUserConfig( ( currentConfig ) =>
540
+ setImmutably( currentConfig, finalPath.split( '.' ), newBehavior )
541
+ );
542
+ };
543
+ let behavior = '';
544
+ if ( result === undefined ) behavior = 'default';
545
+ if ( result?.lightbox.enabled ) behavior = 'lightbox';
546
+
547
+ return { behavior, inheritedBehaviors: result, setBehavior };
548
+ }
549
+
550
+ export function __experimentalUseHasBehaviorsPanel(
551
+ settings,
552
+ name,
553
+ { blockSupportOnly = false } = {}
554
+ ) {
555
+ if ( ! settings?.behaviors ) {
556
+ return false;
557
+ }
558
+
559
+ // If every behavior is disabled on block supports, do not show the behaviors inspector control.
560
+ const hasSomeBlockSupport = Object.keys( settings?.behaviors ).some(
561
+ ( key ) => hasBlockSupport( name, `behaviors.${ key }` )
562
+ );
563
+
564
+ if ( blockSupportOnly ) {
565
+ return hasSomeBlockSupport;
566
+ }
567
+
568
+ // If every behavior is disabled, do not show the behaviors inspector control.
569
+ return Object.values( settings?.behaviors ).some(
570
+ ( value ) => value === true && hasSomeBlockSupport
571
+ );
572
+ }
@@ -1,4 +1,6 @@
1
1
  export {
2
+ __experimentalUseGlobalBehaviors,
3
+ __experimentalUseHasBehaviorsPanel,
2
4
  useGlobalStylesReset,
3
5
  useGlobalSetting,
4
6
  useGlobalStyle,
@@ -23,5 +25,6 @@ export { default as BorderPanel, useHasBorderPanel } from './border-panel';
23
25
  export { default as ColorPanel, useHasColorPanel } from './color-panel';
24
26
  export { default as EffectsPanel, useHasEffectsPanel } from './effects-panel';
25
27
  export { default as FiltersPanel, useHasFiltersPanel } from './filters-panel';
28
+ export { default as __experimentalBehaviorsPanel } from './behaviors-panel';
26
29
  export { default as AdvancedPanel } from './advanced-panel';
27
30
  export { areGlobalStyleConfigsEqual } from './utils';
@@ -192,7 +192,7 @@ describe( 'typography utils', () => {
192
192
 
193
193
  {
194
194
  message:
195
- 'should apply maxViewPortWidth as maximum viewport width',
195
+ 'should apply maxViewportWidth as maximum viewport width',
196
196
  preset: {
197
197
  size: '80px',
198
198
  fluid: {
@@ -202,7 +202,7 @@ describe( 'typography utils', () => {
202
202
  },
203
203
  typographySettings: {
204
204
  fluid: {
205
- maxViewPortWidth: '1100px',
205
+ maxViewportWidth: '1100px',
206
206
  },
207
207
  },
208
208
  expected:
@@ -548,18 +548,18 @@ describe( 'typography utils', () => {
548
548
  layout: { wideSize: '1000rem' },
549
549
  },
550
550
  expected: {
551
- fluid: { maxViewPortWidth: '1000rem', minFontSize: '16px' },
551
+ fluid: { maxViewportWidth: '1000rem', minFontSize: '16px' },
552
552
  },
553
553
  },
554
554
 
555
555
  {
556
556
  message:
557
- 'should prioritize fluid `maxViewPortWidth` over `layout.wideSize`',
557
+ 'should prioritize fluid `maxViewportWidth` over `layout.wideSize`',
558
558
  settings: {
559
- typography: { fluid: { maxViewPortWidth: '10px' } },
559
+ typography: { fluid: { maxViewportWidth: '10px' } },
560
560
  layout: { wideSize: '1000rem' },
561
561
  },
562
- expected: { fluid: { maxViewPortWidth: '10px' } },
562
+ expected: { fluid: { maxViewportWidth: '10px' } },
563
563
  },
564
564
  ].forEach( ( { message, settings, expected } ) => {
565
565
  it( `${ message }`, () => {
@@ -114,6 +114,21 @@ function useHasTextColumnsControl( settings ) {
114
114
  return settings?.typography?.textColumns;
115
115
  }
116
116
 
117
+ function getUniqueFontSizesBySlug( settings ) {
118
+ const fontSizesPerOrigin = settings?.typography?.fontSizes ?? {};
119
+ const fontSizes = []
120
+ .concat( fontSizesPerOrigin?.custom ?? [] )
121
+ .concat( fontSizesPerOrigin?.theme ?? [] )
122
+ .concat( fontSizesPerOrigin.default ?? [] );
123
+
124
+ return fontSizes.reduce( ( acc, currentSize ) => {
125
+ if ( ! acc.some( ( { slug } ) => slug === currentSize.slug ) ) {
126
+ acc.push( currentSize );
127
+ }
128
+ return acc;
129
+ }, [] );
130
+ }
131
+
117
132
  function TypographyToolsPanel( {
118
133
  resetAllFilter,
119
134
  onChange,
@@ -189,11 +204,8 @@ export default function TypographyPanel( {
189
204
  // Font Size
190
205
  const hasFontSizeEnabled = useHasFontSizeControl( settings );
191
206
  const disableCustomFontSizes = ! settings?.typography?.customFontSize;
192
- const fontSizesPerOrigin = settings?.typography?.fontSizes ?? {};
193
- const fontSizes = []
194
- .concat( fontSizesPerOrigin?.custom ?? [] )
195
- .concat( fontSizesPerOrigin?.theme ?? [] )
196
- .concat( fontSizesPerOrigin.default ?? [] );
207
+ const fontSizes = getUniqueFontSizesBySlug( settings );
208
+
197
209
  const fontSize = decodeValue( inheritedValue?.typography?.fontSize );
198
210
  const setFontSize = ( newValue, metadata ) => {
199
211
  const actualValue = !! metadata?.slug
@@ -25,8 +25,8 @@ import { getComputedFluidTypographyValue } from '../font-sizes/fluid-utils';
25
25
 
26
26
  /**
27
27
  * @typedef {Object} TypographySettings
28
- * @property {?string} minViewPortWidth Minimum viewport size from which type will have fluidity. Optional if size is specified.
29
- * @property {?string} maxViewPortWidth Maximum size up to which type will have fluidity. Optional if size is specified.
28
+ * @property {?string} minViewportWidth Minimum viewport size from which type will have fluidity. Optional if size is specified.
29
+ * @property {?string} maxViewportWidth Maximum size up to which type will have fluidity. Optional if size is specified.
30
30
  * @property {?number} scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional.
31
31
  * @property {?number} minFontSizeFactor How much to scale defaultFontSize by to derive minimumFontSize. Optional.
32
32
  * @property {?string} minFontSize The smallest a calculated font size may be. Optional.
@@ -67,7 +67,7 @@ export function getTypographyFontSizeValue( preset, typographyOptions ) {
67
67
  maximumFontSize: preset?.fluid?.max,
68
68
  fontSize: defaultSize,
69
69
  minimumFontSizeLimit: fluidTypographySettings?.minFontSize,
70
- maximumViewPortWidth: fluidTypographySettings?.maxViewPortWidth,
70
+ maximumViewportWidth: fluidTypographySettings?.maxViewportWidth,
71
71
  } );
72
72
 
73
73
  if ( !! fluidFontSizeValue ) {
@@ -102,7 +102,7 @@ export function getFluidTypographyOptionsFromSettings( settings ) {
102
102
  layoutSettings?.wideSize
103
103
  ? {
104
104
  fluid: {
105
- maxViewPortWidth: layoutSettings.wideSize,
105
+ maxViewportWidth: layoutSettings.wideSize,
106
106
  ...typographySettings.fluid,
107
107
  },
108
108
  }
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get, set } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -32,7 +27,11 @@ import { PresetDuotoneFilter } from '../duotone/components';
32
27
  import { getGapCSSValue } from '../../hooks/gap';
33
28
  import { store as blockEditorStore } from '../../store';
34
29
  import { LAYOUT_DEFINITIONS } from '../../layouts/definitions';
35
- import { kebabCase } from '../../utils/object';
30
+ import {
31
+ getValueFromObjectPath,
32
+ kebabCase,
33
+ setImmutably,
34
+ } from '../../utils/object';
36
35
 
37
36
  // List of block support features that can have their related styles
38
37
  // generated under their own feature level selector rather than the block's.
@@ -69,7 +68,11 @@ function compileStyleValue( uncompiledValue ) {
69
68
  function getPresetsDeclarations( blockPresets = {}, mergedSettings ) {
70
69
  return PRESET_METADATA.reduce(
71
70
  ( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {
72
- const presetByOrigin = get( blockPresets, path, [] );
71
+ const presetByOrigin = getValueFromObjectPath(
72
+ blockPresets,
73
+ path,
74
+ []
75
+ );
73
76
  [ 'default', 'theme', 'custom' ].forEach( ( origin ) => {
74
77
  if ( presetByOrigin[ origin ] ) {
75
78
  presetByOrigin[ origin ].forEach( ( value ) => {
@@ -113,7 +116,11 @@ function getPresetsClasses( blockSelector = '*', blockPresets = {} ) {
113
116
  return declarations;
114
117
  }
115
118
 
116
- const presetByOrigin = get( blockPresets, path, [] );
119
+ const presetByOrigin = getValueFromObjectPath(
120
+ blockPresets,
121
+ path,
122
+ []
123
+ );
117
124
  [ 'default', 'theme', 'custom' ].forEach( ( origin ) => {
118
125
  if ( presetByOrigin[ origin ] ) {
119
126
  presetByOrigin[ origin ].forEach( ( { slug } ) => {
@@ -147,7 +154,11 @@ function getPresetsSvgFilters( blockPresets = {} ) {
147
154
  // Duotone are the only type of filters for now.
148
155
  ( metadata ) => metadata.path.at( -1 ) === 'duotone'
149
156
  ).flatMap( ( metadata ) => {
150
- const presetByOrigin = get( blockPresets, metadata.path, {} );
157
+ const presetByOrigin = getValueFromObjectPath(
158
+ blockPresets,
159
+ metadata.path,
160
+ {}
161
+ );
151
162
  return [ 'default', 'theme' ]
152
163
  .filter( ( origin ) => presetByOrigin[ origin ] )
153
164
  .flatMap( ( origin ) =>
@@ -319,7 +330,10 @@ export function getStylesDeclarations(
319
330
  return declarations;
320
331
  }
321
332
 
322
- const styleValue = get( blockStyles, pathToValue );
333
+ const styleValue = getValueFromObjectPath(
334
+ blockStyles,
335
+ pathToValue
336
+ );
323
337
 
324
338
  // Root-level padding styles don't currently support strings with CSS shorthand values.
325
339
  // This may change: https://github.com/WordPress/gutenberg/issues/40132.
@@ -334,7 +348,9 @@ export function getStylesDeclarations(
334
348
  Object.entries( properties ).forEach( ( entry ) => {
335
349
  const [ name, prop ] = entry;
336
350
 
337
- if ( ! get( styleValue, [ prop ], false ) ) {
351
+ if (
352
+ ! getValueFromObjectPath( styleValue, [ prop ], false )
353
+ ) {
338
354
  // Do not create a declaration
339
355
  // for sub-properties that don't have any value.
340
356
  return;
@@ -345,17 +361,19 @@ export function getStylesDeclarations(
345
361
  : kebabCase( name );
346
362
  declarations.push(
347
363
  `${ cssProperty }: ${ compileStyleValue(
348
- get( styleValue, [ prop ] )
364
+ getValueFromObjectPath( styleValue, [ prop ] )
349
365
  ) }`
350
366
  );
351
367
  } );
352
- } else if ( get( blockStyles, pathToValue, false ) ) {
368
+ } else if (
369
+ getValueFromObjectPath( blockStyles, pathToValue, false )
370
+ ) {
353
371
  const cssProperty = key.startsWith( '--' )
354
372
  ? key
355
373
  : kebabCase( key );
356
374
  declarations.push(
357
375
  `${ cssProperty }: ${ compileStyleValue(
358
- get( blockStyles, pathToValue )
376
+ getValueFromObjectPath( blockStyles, pathToValue )
359
377
  ) }`
360
378
  );
361
379
  }
@@ -384,7 +402,7 @@ export function getStylesDeclarations(
384
402
  let ruleValue = rule.value;
385
403
  if ( typeof ruleValue !== 'string' && ruleValue?.ref ) {
386
404
  const refPath = ruleValue.ref.split( '.' );
387
- ruleValue = get( tree, refPath );
405
+ ruleValue = getValueFromObjectPath( tree, refPath );
388
406
  // Presence of another ref indicates a reference to another dynamic value.
389
407
  // Pointing to another dynamic value is not supported.
390
408
  if ( ! ruleValue || ruleValue?.ref ) {
@@ -678,11 +696,11 @@ export const getNodesWithSettings = ( tree, blockSelectors ) => {
678
696
  }
679
697
 
680
698
  const pickPresets = ( treeToPickFrom ) => {
681
- const presets = {};
699
+ let presets = {};
682
700
  PRESET_METADATA.forEach( ( { path } ) => {
683
- const value = get( treeToPickFrom, path, false );
701
+ const value = getValueFromObjectPath( treeToPickFrom, path, false );
684
702
  if ( value !== false ) {
685
- set( presets, path, value );
703
+ presets = setImmutably( presets, path, value );
686
704
  }
687
705
  } );
688
706
  return presets;
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { get } from 'lodash';
5
4
  import fastDeepEqual from 'fast-deep-equal/es6';
6
5
 
7
6
  /**
@@ -11,6 +10,7 @@ import {
11
10
  getTypographyFontSizeValue,
12
11
  getFluidTypographyOptionsFromSettings,
13
12
  } from './typography-utils';
13
+ import { getValueFromObjectPath } from '../../utils/object';
14
14
 
15
15
  /* Supporting data. */
16
16
  export const ROOT_BLOCK_NAME = 'root';
@@ -168,8 +168,12 @@ function findInPresetsBy(
168
168
  ) {
169
169
  // Block presets take priority above root level presets.
170
170
  const orderedPresetsByOrigin = [
171
- get( features, [ 'blocks', blockName, ...presetPath ] ),
172
- get( features, presetPath ),
171
+ getValueFromObjectPath( features, [
172
+ 'blocks',
173
+ blockName,
174
+ ...presetPath,
175
+ ] ),
176
+ getValueFromObjectPath( features, presetPath ),
173
177
  ];
174
178
 
175
179
  for ( const presetByOrigin of orderedPresetsByOrigin ) {
@@ -282,8 +286,13 @@ function getValueFromPresetVariable(
282
286
 
283
287
  function getValueFromCustomVariable( features, blockName, variable, path ) {
284
288
  const result =
285
- get( features.settings, [ 'blocks', blockName, 'custom', ...path ] ) ??
286
- get( features.settings, [ 'custom', ...path ] );
289
+ getValueFromObjectPath( features.settings, [
290
+ 'blocks',
291
+ blockName,
292
+ 'custom',
293
+ ...path,
294
+ ] ) ??
295
+ getValueFromObjectPath( features.settings, [ 'custom', ...path ] );
287
296
  if ( ! result ) {
288
297
  return variable;
289
298
  }
@@ -303,7 +312,7 @@ export function getValueFromVariable( features, blockName, variable ) {
303
312
  if ( ! variable || typeof variable !== 'string' ) {
304
313
  if ( variable?.ref && typeof variable?.ref === 'string' ) {
305
314
  const refPath = variable.ref.split( '.' );
306
- variable = get( features, refPath );
315
+ variable = getValueFromObjectPath( features, refPath );
307
316
  // Presence of another ref indicates a reference to another dynamic value.
308
317
  // Pointing to another dynamic value is not supported.
309
318
  if ( ! variable || !! variable?.ref ) {
@@ -406,6 +415,7 @@ export function areGlobalStyleConfigsEqual( original, variation ) {
406
415
  }
407
416
  return (
408
417
  fastDeepEqual( original?.styles, variation?.styles ) &&
409
- fastDeepEqual( original?.settings, variation?.settings )
418
+ fastDeepEqual( original?.settings, variation?.settings ) &&
419
+ fastDeepEqual( original?.behaviors, variation?.behaviors )
410
420
  );
411
421
  }