@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
@@ -24,8 +24,8 @@ import { getComputedFluidTypographyValue } from '../font-sizes/fluid-utils';
24
24
 
25
25
  /**
26
26
  * @typedef {Object} TypographySettings
27
- * @property {?string} minViewPortWidth Minimum viewport size from which type will have fluidity. Optional if size is specified.
28
- * @property {?string} maxViewPortWidth Maximum size up to which type will have fluidity. Optional if size is specified.
27
+ * @property {?string} minViewportWidth Minimum viewport size from which type will have fluidity. Optional if size is specified.
28
+ * @property {?string} maxViewportWidth Maximum size up to which type will have fluidity. Optional if size is specified.
29
29
  * @property {?number} scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional.
30
30
  * @property {?number} minFontSizeFactor How much to scale defaultFontSize by to derive minimumFontSize. Optional.
31
31
  * @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) {
@@ -96,7 +96,7 @@ export function getFluidTypographyOptionsFromSettings(settings) {
96
96
  const layoutSettings = settings?.layout;
97
97
  return isFluidTypographyEnabled(typographySettings) && layoutSettings?.wideSize ? {
98
98
  fluid: {
99
- maxViewPortWidth: layoutSettings.wideSize,
99
+ maxViewportWidth: layoutSettings.wideSize,
100
100
  ...typographySettings.fluid
101
101
  }
102
102
  } : {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/typography-utils.js"],"names":["getComputedFluidTypographyValue","getTypographyFontSizeValue","preset","typographyOptions","size","defaultSize","isFluidTypographyEnabled","fluid","fluidTypographySettings","fluidFontSizeValue","minimumFontSize","min","maximumFontSize","max","fontSize","minimumFontSizeLimit","minFontSize","maximumViewPortWidth","maxViewPortWidth","typographySettings","fluidSettings","Object","keys","length","getFluidTypographyOptionsFromSettings","settings","typography","layoutSettings","layout","wideSize"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,+BAAT,QAAgD,2BAAhD;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,0BAAT,CAAqCC,MAArC,EAA6CC,iBAA7C,EAAiE;AACvE,QAAM;AAAEC,IAAAA,IAAI,EAAEC;AAAR,MAAwBH,MAA9B;;AAEA,MAAK,CAAEI,wBAAwB,CAAEH,iBAAF,CAA/B,EAAuD;AACtD,WAAOE,WAAP;AACA;AACD;AACD;AACA;AACA;AACA;;;AACC,MAAK,CAAEA,WAAF,IAAiB,QAAQA,WAAzB,IAAwC,UAAUH,MAAM,EAAEK,KAA/D,EAAuE;AACtE,WAAOF,WAAP;AACA;;AAED,QAAMG,uBAAuB,GAC5B,OAAOL,iBAAiB,EAAEI,KAA1B,KAAoC,QAApC,GACGJ,iBAAiB,EAAEI,KADtB,GAEG,EAHJ;AAKA,QAAME,kBAAkB,GAAGT,+BAA+B,CAAE;AAC3DU,IAAAA,eAAe,EAAER,MAAM,EAAEK,KAAR,EAAeI,GAD2B;AAE3DC,IAAAA,eAAe,EAAEV,MAAM,EAAEK,KAAR,EAAeM,GAF2B;AAG3DC,IAAAA,QAAQ,EAAET,WAHiD;AAI3DU,IAAAA,oBAAoB,EAAEP,uBAAuB,EAAEQ,WAJY;AAK3DC,IAAAA,oBAAoB,EAAET,uBAAuB,EAAEU;AALY,GAAF,CAA1D;;AAQA,MAAK,CAAC,CAAET,kBAAR,EAA6B;AAC5B,WAAOA,kBAAP;AACA;;AAED,SAAOJ,WAAP;AACA;;AAED,SAASC,wBAAT,CAAmCa,kBAAnC,EAAwD;AACvD,QAAMC,aAAa,GAAGD,kBAAkB,EAAEZ,KAA1C;AACA,SACC,SAASa,aAAT,IACEA,aAAa,IACd,OAAOA,aAAP,KAAyB,QADxB,IAEDC,MAAM,CAACC,IAAP,CAAaF,aAAb,EAA6BG,MAA7B,GAAsC,CAJxC;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASC,qCAAT,CAAgDC,QAAhD,EAA2D;AACjE,QAAMN,kBAAkB,GAAGM,QAAQ,EAAEC,UAArC;AACA,QAAMC,cAAc,GAAGF,QAAQ,EAAEG,MAAjC;AACA,SAAOtB,wBAAwB,CAAEa,kBAAF,CAAxB,IACNQ,cAAc,EAAEE,QADV,GAEJ;AACAtB,IAAAA,KAAK,EAAE;AACNW,MAAAA,gBAAgB,EAAES,cAAc,CAACE,QAD3B;AAEN,SAAGV,kBAAkB,CAACZ;AAFhB;AADP,GAFI,GAQJ;AACAA,IAAAA,KAAK,EAAEY,kBAAkB,EAAEZ;AAD3B,GARH;AAWA","sourcesContent":["/**\n * The fluid utilities must match the backend equivalent.\n * See: gutenberg_get_typography_font_size_value() in lib/block-supports/typography.php\n * ---------------------------------------------------------------\n */\n\n/**\n * Internal dependencies\n */\nimport { getComputedFluidTypographyValue } from '../font-sizes/fluid-utils';\n\n/**\n * @typedef {Object} FluidPreset\n * @property {string|undefined} max A maximum font size value.\n * @property {?string|undefined} min A minimum font size value.\n */\n\n/**\n * @typedef {Object} Preset\n * @property {?string|?number} size A default font size.\n * @property {string} name A font size name, displayed in the UI.\n * @property {string} slug A font size slug\n * @property {boolean|FluidPreset|undefined} fluid Specifies the minimum and maximum font size value of a fluid font size.\n */\n\n/**\n * @typedef {Object} TypographySettings\n * @property {?string} minViewPortWidth Minimum viewport size from which type will have fluidity. Optional if size is specified.\n * @property {?string} maxViewPortWidth Maximum size up to which type will have fluidity. Optional if size is specified.\n * @property {?number} scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional.\n * @property {?number} minFontSizeFactor How much to scale defaultFontSize by to derive minimumFontSize. Optional.\n * @property {?string} minFontSize The smallest a calculated font size may be. Optional.\n */\n\n/**\n * Returns a font-size value based on a given font-size preset.\n * Takes into account fluid typography parameters and attempts to return a css formula depending on available, valid values.\n *\n * @param {Preset} preset\n * @param {Object} typographyOptions\n * @param {boolean|TypographySettings} typographyOptions.fluid Whether fluid typography is enabled, and, optionally, fluid font size options.\n *\n * @return {string|*} A font-size value or the value of preset.size.\n */\nexport function getTypographyFontSizeValue( preset, typographyOptions ) {\n\tconst { size: defaultSize } = preset;\n\n\tif ( ! isFluidTypographyEnabled( typographyOptions ) ) {\n\t\treturn defaultSize;\n\t}\n\t/*\n\t * Checks whether a font size has explicitly bypassed fluid calculations.\n\t * Also catches falsy values and 0/'0'.\n\t * Fluid calculations cannot be performed on `0`.\n\t */\n\tif ( ! defaultSize || '0' === defaultSize || false === preset?.fluid ) {\n\t\treturn defaultSize;\n\t}\n\n\tconst fluidTypographySettings =\n\t\ttypeof typographyOptions?.fluid === 'object'\n\t\t\t? typographyOptions?.fluid\n\t\t\t: {};\n\n\tconst fluidFontSizeValue = getComputedFluidTypographyValue( {\n\t\tminimumFontSize: preset?.fluid?.min,\n\t\tmaximumFontSize: preset?.fluid?.max,\n\t\tfontSize: defaultSize,\n\t\tminimumFontSizeLimit: fluidTypographySettings?.minFontSize,\n\t\tmaximumViewPortWidth: fluidTypographySettings?.maxViewPortWidth,\n\t} );\n\n\tif ( !! fluidFontSizeValue ) {\n\t\treturn fluidFontSizeValue;\n\t}\n\n\treturn defaultSize;\n}\n\nfunction isFluidTypographyEnabled( typographySettings ) {\n\tconst fluidSettings = typographySettings?.fluid;\n\treturn (\n\t\ttrue === fluidSettings ||\n\t\t( fluidSettings &&\n\t\t\ttypeof fluidSettings === 'object' &&\n\t\t\tObject.keys( fluidSettings ).length > 0 )\n\t);\n}\n\n/**\n * Returns fluid typography settings from theme.json setting object.\n *\n * @param {Object} settings Theme.json settings\n * @param {Object} settings.typography Theme.json typography settings\n * @param {Object} settings.layout Theme.json layout settings\n * @return {TypographySettings} Fluid typography settings\n */\nexport function getFluidTypographyOptionsFromSettings( settings ) {\n\tconst typographySettings = settings?.typography;\n\tconst layoutSettings = settings?.layout;\n\treturn isFluidTypographyEnabled( typographySettings ) &&\n\t\tlayoutSettings?.wideSize\n\t\t? {\n\t\t\t\tfluid: {\n\t\t\t\t\tmaxViewPortWidth: layoutSettings.wideSize,\n\t\t\t\t\t...typographySettings.fluid,\n\t\t\t\t},\n\t\t }\n\t\t: {\n\t\t\t\tfluid: typographySettings?.fluid,\n\t\t };\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/typography-utils.js"],"names":["getComputedFluidTypographyValue","getTypographyFontSizeValue","preset","typographyOptions","size","defaultSize","isFluidTypographyEnabled","fluid","fluidTypographySettings","fluidFontSizeValue","minimumFontSize","min","maximumFontSize","max","fontSize","minimumFontSizeLimit","minFontSize","maximumViewportWidth","maxViewportWidth","typographySettings","fluidSettings","Object","keys","length","getFluidTypographyOptionsFromSettings","settings","typography","layoutSettings","layout","wideSize"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,+BAAT,QAAgD,2BAAhD;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,0BAAT,CAAqCC,MAArC,EAA6CC,iBA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AjC;AACA,SAAOtB,wBAAwB,CAAEa,kBAAF,CAAxB,IACNQ,cAAc,EAAEE,QADV,GAEJ;AACAtB,IAAAA,KAAK,EAAE;AACNW,MAAAA,gBAAgB,EAAES,cAAc,CAACE,QAD3B;AAEN,SAAGV,kBAAkB,CAACZ;AAFhB;AADP,GAFI,GAQJ;AACAA,IAAAA,KAAK,EAAEY,kBAAkB,EAAEZ;AAD3B,GARH;AAWA","sourcesContent":["/**\n * The fluid utilities must match the backend equivalent.\n * See: gutenberg_get_typography_font_size_value() in lib/block-supports/typography.php\n * ---------------------------------------------------------------\n */\n\n/**\n * Internal dependencies\n */\nimport { getComputedFluidTypographyValue } from '../font-sizes/fluid-utils';\n\n/**\n * @typedef {Object} FluidPreset\n * @property {string|undefined} max A maximum font size value.\n * @property {?string|undefined} min A minimum font size value.\n */\n\n/**\n * @typedef {Object} Preset\n * @property {?string|?number} size A default font size.\n * @property {string} name A font size name, displayed in the UI.\n * @property {string} slug A font size slug\n * @property {boolean|FluidPreset|undefined} fluid Specifies the minimum and maximum font size value of a fluid font size.\n */\n\n/**\n * @typedef {Object} TypographySettings\n * @property {?string} minViewportWidth Minimum viewport size from which type will have fluidity. Optional if size is specified.\n * @property {?string} maxViewportWidth Maximum size up to which type will have fluidity. Optional if size is specified.\n * @property {?number} scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional.\n * @property {?number} minFontSizeFactor How much to scale defaultFontSize by to derive minimumFontSize. Optional.\n * @property {?string} minFontSize The smallest a calculated font size may be. Optional.\n */\n\n/**\n * Returns a font-size value based on a given font-size preset.\n * Takes into account fluid typography parameters and attempts to return a css formula depending on available, valid values.\n *\n * @param {Preset} preset\n * @param {Object} typographyOptions\n * @param {boolean|TypographySettings} typographyOptions.fluid Whether fluid typography is enabled, and, optionally, fluid font size options.\n *\n * @return {string|*} A font-size value or the value of preset.size.\n */\nexport function getTypographyFontSizeValue( preset, typographyOptions ) {\n\tconst { size: defaultSize } = preset;\n\n\tif ( ! isFluidTypographyEnabled( typographyOptions ) ) {\n\t\treturn defaultSize;\n\t}\n\t/*\n\t * Checks whether a font size has explicitly bypassed fluid calculations.\n\t * Also catches falsy values and 0/'0'.\n\t * Fluid calculations cannot be performed on `0`.\n\t */\n\tif ( ! defaultSize || '0' === defaultSize || false === preset?.fluid ) {\n\t\treturn defaultSize;\n\t}\n\n\tconst fluidTypographySettings =\n\t\ttypeof typographyOptions?.fluid === 'object'\n\t\t\t? typographyOptions?.fluid\n\t\t\t: {};\n\n\tconst fluidFontSizeValue = getComputedFluidTypographyValue( {\n\t\tminimumFontSize: preset?.fluid?.min,\n\t\tmaximumFontSize: preset?.fluid?.max,\n\t\tfontSize: defaultSize,\n\t\tminimumFontSizeLimit: fluidTypographySettings?.minFontSize,\n\t\tmaximumViewportWidth: fluidTypographySettings?.maxViewportWidth,\n\t} );\n\n\tif ( !! fluidFontSizeValue ) {\n\t\treturn fluidFontSizeValue;\n\t}\n\n\treturn defaultSize;\n}\n\nfunction isFluidTypographyEnabled( typographySettings ) {\n\tconst fluidSettings = typographySettings?.fluid;\n\treturn (\n\t\ttrue === fluidSettings ||\n\t\t( fluidSettings &&\n\t\t\ttypeof fluidSettings === 'object' &&\n\t\t\tObject.keys( fluidSettings ).length > 0 )\n\t);\n}\n\n/**\n * Returns fluid typography settings from theme.json setting object.\n *\n * @param {Object} settings Theme.json settings\n * @param {Object} settings.typography Theme.json typography settings\n * @param {Object} settings.layout Theme.json layout settings\n * @return {TypographySettings} Fluid typography settings\n */\nexport function getFluidTypographyOptionsFromSettings( settings ) {\n\tconst typographySettings = settings?.typography;\n\tconst layoutSettings = settings?.layout;\n\treturn isFluidTypographyEnabled( typographySettings ) &&\n\t\tlayoutSettings?.wideSize\n\t\t? {\n\t\t\t\tfluid: {\n\t\t\t\t\tmaxViewportWidth: layoutSettings.wideSize,\n\t\t\t\t\t...typographySettings.fluid,\n\t\t\t\t},\n\t\t }\n\t\t: {\n\t\t\t\tfluid: typographySettings?.fluid,\n\t\t };\n}\n"]}
@@ -1,13 +1,8 @@
1
1
  import { createElement } from "@wordpress/element";
2
2
 
3
- /**
4
- * External dependencies
5
- */
6
- import { get, set } from 'lodash';
7
3
  /**
8
4
  * WordPress dependencies
9
5
  */
10
-
11
6
  import { __EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY, __EXPERIMENTAL_ELEMENTS as ELEMENTS, getBlockSupport, getBlockTypes, store as blocksStore } from '@wordpress/blocks';
12
7
  import { useSelect } from '@wordpress/data';
13
8
  import { renderToString, useContext, useMemo } from '@wordpress/element';
@@ -25,7 +20,7 @@ import { PresetDuotoneFilter } from '../duotone/components';
25
20
  import { getGapCSSValue } from '../../hooks/gap';
26
21
  import { store as blockEditorStore } from '../../store';
27
22
  import { LAYOUT_DEFINITIONS } from '../../layouts/definitions';
28
- import { kebabCase } from '../../utils/object'; // List of block support features that can have their related styles
23
+ import { getValueFromObjectPath, kebabCase, setImmutably } from '../../utils/object'; // List of block support features that can have their related styles
29
24
  // generated under their own feature level selector rather than the block's.
30
25
 
31
26
  const BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {
@@ -64,7 +59,7 @@ function getPresetsDeclarations(blockPresets = {}, mergedSettings) {
64
59
  valueFunc,
65
60
  cssVarInfix
66
61
  }) => {
67
- const presetByOrigin = get(blockPresets, path, []);
62
+ const presetByOrigin = getValueFromObjectPath(blockPresets, path, []);
68
63
  ['default', 'theme', 'custom'].forEach(origin => {
69
64
  if (presetByOrigin[origin]) {
70
65
  presetByOrigin[origin].forEach(value => {
@@ -98,7 +93,7 @@ function getPresetsClasses(blockSelector = '*', blockPresets = {}) {
98
93
  return declarations;
99
94
  }
100
95
 
101
- const presetByOrigin = get(blockPresets, path, []);
96
+ const presetByOrigin = getValueFromObjectPath(blockPresets, path, []);
102
97
  ['default', 'theme', 'custom'].forEach(origin => {
103
98
  if (presetByOrigin[origin]) {
104
99
  presetByOrigin[origin].forEach(({
@@ -124,7 +119,7 @@ function getPresetsClasses(blockSelector = '*', blockPresets = {}) {
124
119
  function getPresetsSvgFilters(blockPresets = {}) {
125
120
  return PRESET_METADATA.filter( // Duotone are the only type of filters for now.
126
121
  metadata => metadata.path.at(-1) === 'duotone').flatMap(metadata => {
127
- const presetByOrigin = get(blockPresets, metadata.path, {});
122
+ const presetByOrigin = getValueFromObjectPath(blockPresets, metadata.path, {});
128
123
  return ['default', 'theme'].filter(origin => presetByOrigin[origin]).flatMap(origin => presetByOrigin[origin].map(preset => renderToString(createElement(PresetDuotoneFilter, {
129
124
  preset: preset,
130
125
  key: preset.slug
@@ -265,7 +260,7 @@ export function getStylesDeclarations(blockStyles = {}, selector = '', useRootPa
265
260
  return declarations;
266
261
  }
267
262
 
268
- const styleValue = get(blockStyles, pathToValue); // Root-level padding styles don't currently support strings with CSS shorthand values.
263
+ const styleValue = getValueFromObjectPath(blockStyles, pathToValue); // Root-level padding styles don't currently support strings with CSS shorthand values.
269
264
  // This may change: https://github.com/WordPress/gutenberg/issues/40132.
270
265
 
271
266
  if (key === '--wp--style--root--padding' && (typeof styleValue === 'string' || !useRootPaddingAlign)) {
@@ -276,18 +271,18 @@ export function getStylesDeclarations(blockStyles = {}, selector = '', useRootPa
276
271
  Object.entries(properties).forEach(entry => {
277
272
  const [name, prop] = entry;
278
273
 
279
- if (!get(styleValue, [prop], false)) {
274
+ if (!getValueFromObjectPath(styleValue, [prop], false)) {
280
275
  // Do not create a declaration
281
276
  // for sub-properties that don't have any value.
282
277
  return;
283
278
  }
284
279
 
285
280
  const cssProperty = name.startsWith('--') ? name : kebabCase(name);
286
- declarations.push(`${cssProperty}: ${compileStyleValue(get(styleValue, [prop]))}`);
281
+ declarations.push(`${cssProperty}: ${compileStyleValue(getValueFromObjectPath(styleValue, [prop]))}`);
287
282
  });
288
- } else if (get(blockStyles, pathToValue, false)) {
283
+ } else if (getValueFromObjectPath(blockStyles, pathToValue, false)) {
289
284
  const cssProperty = key.startsWith('--') ? key : kebabCase(key);
290
- declarations.push(`${cssProperty}: ${compileStyleValue(get(blockStyles, pathToValue))}`);
285
+ declarations.push(`${cssProperty}: ${compileStyleValue(getValueFromObjectPath(blockStyles, pathToValue))}`);
291
286
  }
292
287
 
293
288
  return declarations;
@@ -306,7 +301,7 @@ export function getStylesDeclarations(blockStyles = {}, selector = '', useRootPa
306
301
 
307
302
  if (typeof ruleValue !== 'string' && ruleValue?.ref) {
308
303
  const refPath = ruleValue.ref.split('.');
309
- ruleValue = get(tree, refPath); // Presence of another ref indicates a reference to another dynamic value.
304
+ ruleValue = getValueFromObjectPath(tree, refPath); // Presence of another ref indicates a reference to another dynamic value.
310
305
  // Pointing to another dynamic value is not supported.
311
306
 
312
307
  if (!ruleValue || ruleValue?.ref) {
@@ -532,14 +527,14 @@ export const getNodesWithSettings = (tree, blockSelectors) => {
532
527
  }
533
528
 
534
529
  const pickPresets = treeToPickFrom => {
535
- const presets = {};
530
+ let presets = {};
536
531
  PRESET_METADATA.forEach(({
537
532
  path
538
533
  }) => {
539
- const value = get(treeToPickFrom, path, false);
534
+ const value = getValueFromObjectPath(treeToPickFrom, path, false);
540
535
 
541
536
  if (value !== false) {
542
- set(presets, path, value);
537
+ presets = setImmutably(presets, path, value);
543
538
  }
544
539
  });
545
540
  return presets;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/use-global-styles-output.js"],"names":["get","set","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","__EXPERIMENTAL_ELEMENTS","ELEMENTS","getBlockSupport","getBlockTypes","store","blocksStore","useSelect","renderToString","useContext","useMemo","getCSSRules","PRESET_METADATA","ROOT_BLOCK_SELECTOR","scopeSelector","getBlockCSSSelector","getTypographyFontSizeValue","getFluidTypographyOptionsFromSettings","GlobalStylesContext","useGlobalSetting","PresetDuotoneFilter","getGapCSSValue","blockEditorStore","LAYOUT_DEFINITIONS","kebabCase","BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS","__experimentalBorder","color","spacing","typography","compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","startsWith","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","mergedSettings","reduce","declarations","path","valueKey","valueFunc","cssVarInfix","presetByOrigin","forEach","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","getPresetsSvgFilters","filter","metadata","at","flatMap","preset","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","concatFeatureVariationSelectorString","featureSelector","styleVariationSelector","featureSelectors","combinedSelectors","trim","getFeatureDeclarations","selectors","styles","entries","feature","isShorthand","subfeature","subfeatureSelector","subfeatureStyles","newDeclarations","getStylesDeclarations","root","featureStyles","blockStyles","useRootPaddingAlign","tree","isRoot","output","properties","useEngine","rootOnly","pathToValue","styleValue","entry","name","prop","cssProperty","extraRules","rule","ruleValue","ref","refPath","size","settings","getLayoutStyles","layoutDefinitions","style","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","ruleset","gapValue","blockGap","values","className","spacingStyles","spacingStyle","rules","cssValue","combinedSelector","validDisplayModes","displayMode","baseStyles","includes","baseStyle","STYLE_KEYS","pickStyleKeys","treeToPickFrom","pickedEntries","clonedEntries","JSON","parse","stringify","fromEntries","getNodesWithStyles","blockSelectors","nodes","elements","blocks","blockName","node","variations","variation","duotoneSelector","hasLayoutSupport","styleVariationSelectors","elementName","sel","elementSelectors","elementSelector","getNodesWithSettings","pickPresets","presets","custom","blockCustom","toCustomProperties","customProps","toStyles","disableLayoutStyles","nodesWithStyles","nodesWithSettings","useRootPaddingAwareAlignments","contentSize","wideSize","layout","featureDeclarations","cssSelector","styleVariationName","styleVariations","baseSelector","styleVariationDeclarations","duotoneStyles","duotoneDeclarations","pseudoSelectorStyles","pseudoKey","pseudoStyle","pseudoDeclarations","_selector","pseudoRule","toSvgFilters","getSelectorsConfig","blockType","rootSelector","config","featureKey","featureName","getBlockSelectors","blockTypes","getBlockStyles","duotoneSupport","supports","__experimentalLayout","__experimentalDefault","blockStyleVariations","undefined","updateConfigWithSeparator","needsSeparatorStyleUpdate","background","text","border","processCSSNesting","css","processedCSS","parts","part","useGlobalStylesOutputWithConfig","mergedConfig","select","getSettings","customProperties","globalStyles","svgs","isGlobalStyles","assets","__unstableType","useGlobalStylesOutput","merged"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,GAAd,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SACCC,6BAA6B,IAAIC,cADlC,EAECC,uBAAuB,IAAIC,QAF5B,EAGCC,eAHD,EAICC,aAJD,EAKCC,KAAK,IAAIC,WALV,QAMO,mBANP;AAOA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,cAAT,EAAyBC,UAAzB,EAAqCC,OAArC,QAAoD,oBAApD;AACA,SAASC,WAAT,QAA4B,yBAA5B;AAEA;AACA;AACA;;AACA,SAASC,eAAT,EAA0BC,mBAA1B,EAA+CC,aAA/C,QAAoE,SAApE;AACA,SAASC,mBAAT,QAAoC,0BAApC;AACA,SACCC,0BADD,EAECC,qCAFD,QAGO,oBAHP;AAIA,SAASC,mBAAT,QAAoC,WAApC;AACA,SAASC,gBAAT,QAAiC,SAAjC;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,cAAT,QAA+B,iBAA/B;AACA,SAAShB,KAAK,IAAIiB,gBAAlB,QAA0C,aAA1C;AACA,SAASC,kBAAT,QAAmC,2BAAnC;AACA,SAASC,SAAT,QAA0B,oBAA1B,C,CAEA;AACA;;AACA,MAAMC,qCAAqC,GAAG;AAC7CC,EAAAA,oBAAoB,EAAE,QADuB;AAE7CC,EAAAA,KAAK,EAAE,OAFsC;AAG7CC,EAAAA,OAAO,EAAE,SAHoC;AAI7CC,EAAAA,UAAU,EAAE;AAJiC,CAA9C;;AAOA,SAASC,iBAAT,CAA4BC,eAA5B,EAA8C;AAC7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,UAAKyB,YAAY,CAACtI,MAAb,CAAoBkE,MAApB,CAA4B2C,SAAS,CAACvF,IAAtC,GAA8C2G,GAAnD,EAAyD;AACxD,cAAM5J,QAAQ,GAAG0F,cAAc,CAAE8C,SAAS,CAACvF,IAAZ,CAAd,CAAiCjD,QAAlD;AACA2B,QAAAA,MAAM,CAACrC,IAAP,CAAa;AACZsK,UAAAA,GAAG,EAAED,iBAAiB,CACrBM,YAAY,CAACtI,MAAb,CAAoBkE,MAApB,CAA4B2C,SAAS,CAACvF,IAAtC,GAA8C2G,GADzB,EAErB5J,QAFqB,CADV;AAKZuK,UAAAA,cAAc,EAAE;AALJ,SAAb;AAOA;AACD,KAXD;AAaA,WAAO,CAAE5I,MAAF,EAAUsI,YAAY,CAACvG,QAAvB,CAAP;AACA,GA9Da,EA8DX,CACFI,kBADE,EAEFC,qBAFE,EAGFkG,YAHE,EAIFhD,mBAJE,CA9DW,CAAd;AAoEA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASyD,qBAAT,GAAiC;AACvC,QAAM;AAAEC,IAAAA,MAAM,EAAEV;AAAV,MAA2BxN,UAAU,CAAES,mBAAF,CAA3C;AACA,SAAO8M,+BAA+B,CAAEC,YAAF,CAAtC;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockSupport,\n\tgetBlockTypes,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { renderToString, useContext, useMemo } from '@wordpress/element';\nimport { getCSSRules } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport { PRESET_METADATA, ROOT_BLOCK_SELECTOR, scopeSelector } from './utils';\nimport { getBlockCSSSelector } from './get-block-css-selector';\nimport {\n\tgetTypographyFontSizeValue,\n\tgetFluidTypographyOptionsFromSettings,\n} from './typography-utils';\nimport { GlobalStylesContext } from './context';\nimport { useGlobalSetting } from './hooks';\nimport { PresetDuotoneFilter } from '../duotone/components';\nimport { getGapCSSValue } from '../../hooks/gap';\nimport { store as blockEditorStore } from '../../store';\nimport { LAYOUT_DEFINITIONS } from '../../layouts/definitions';\nimport { kebabCase } from '../../utils/object';\n\n// List of block support features that can have their related styles\n// generated under their own feature level selector rather than the block's.\nconst BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {\n\t__experimentalBorder: 'border',\n\tcolor: 'color',\n\tspacing: 'spacing',\n\ttypography: 'typography',\n};\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\n\tif ( uncompiledValue?.startsWith?.( VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n * @param {Object} mergedSettings Merged theme.json settings.\n *\n * @return {Array<Object>} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {}, mergedSettings ) {\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( value ) => {\n\t\t\t\t\t\tif ( valueKey && ! valueFunc ) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ value[ valueKey ] }`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tvalueFunc &&\n\t\t\t\t\t\t\ttypeof valueFunc === 'function'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ valueFunc( value, mergedSettings ) }`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param {?string} blockSelector\n * @param {Object} blockPresets\n * @return {string} CSS declarations for the preset classes.\n */\nfunction getPresetsClasses( blockSelector = '*', blockPresets = {} ) {\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, cssVarInfix, classes } ) => {\n\t\t\tif ( ! classes ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( { slug } ) => {\n\t\t\t\t\t\tclasses.forEach( ( { classSuffix, propertyName } ) => {\n\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction getPresetsSvgFilters( blockPresets = {} ) {\n\treturn PRESET_METADATA.filter(\n\t\t// Duotone are the only type of filters for now.\n\t\t( metadata ) => metadata.path.at( -1 ) === 'duotone'\n\t).flatMap( ( metadata ) => {\n\t\tconst presetByOrigin = get( blockPresets, metadata.path, {} );\n\t\treturn [ 'default', 'theme' ]\n\t\t\t.filter( ( origin ) => presetByOrigin[ origin ] )\n\t\t\t.flatMap( ( origin ) =>\n\t\t\t\tpresetByOrigin[ origin ].map( ( preset ) =>\n\t\t\t\t\trenderToString(\n\t\t\t\t\t\t<PresetDuotoneFilter\n\t\t\t\t\t\t\tpreset={ preset }\n\t\t\t\t\t\t\tkey={ preset.slug }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.join( '' );\n\t} );\n}\n\nfunction flattenTree( input = {}, prefix, token ) {\n\tlet result = [];\n\tObject.keys( input ).forEach( ( key ) => {\n\t\tconst newKey = prefix + kebabCase( key.replace( '/', '-' ) );\n\t\tconst newLeaf = input[ key ];\n\n\t\tif ( newLeaf instanceof Object ) {\n\t\t\tconst newPrefix = newKey + token;\n\t\t\tresult = [ ...result, ...flattenTree( newLeaf, newPrefix, token ) ];\n\t\t} else {\n\t\t\tresult.push( `${ newKey }: ${ newLeaf }` );\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Gets variation selector string from feature selector.\n *\n * @param {string} featureSelector The feature selector.\n *\n * @param {string} styleVariationSelector The style variation selector.\n * @return {string} Combined selector string.\n *\n */\nfunction concatFeatureVariationSelectorString(\n\tfeatureSelector,\n\tstyleVariationSelector\n) {\n\tconst featureSelectors = featureSelector.split( ',' );\n\tconst combinedSelectors = [];\n\tfeatureSelectors.forEach( ( selector ) => {\n\t\tcombinedSelectors.push(\n\t\t\t`${ styleVariationSelector.trim() }${ selector.trim() }`\n\t\t);\n\t} );\n\treturn combinedSelectors.join( ', ' );\n}\n\n/**\n * Generate style declarations for a block's custom feature and subfeature\n * selectors.\n *\n * NOTE: The passed `styles` object will be mutated by this function.\n *\n * @param {Object} selectors Custom selectors object for a block.\n * @param {Object} styles A block's styles object.\n *\n * @return {Object} Style declarations.\n */\nconst getFeatureDeclarations = ( selectors, styles ) => {\n\tconst declarations = {};\n\n\tObject.entries( selectors ).forEach( ( [ feature, selector ] ) => {\n\t\t// We're only processing features/subfeatures that have styles.\n\t\tif ( feature === 'root' || ! styles?.[ feature ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isShorthand = typeof selector === 'string';\n\n\t\t// If we have a selector object instead of shorthand process it.\n\t\tif ( ! isShorthand ) {\n\t\t\tObject.entries( selector ).forEach(\n\t\t\t\t( [ subfeature, subfeatureSelector ] ) => {\n\t\t\t\t\t// Don't process root feature selector yet or any\n\t\t\t\t\t// subfeature that doesn't have a style.\n\t\t\t\t\tif (\n\t\t\t\t\t\tsubfeature === 'root' ||\n\t\t\t\t\t\t! styles?.[ feature ][ subfeature ]\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create a temporary styles object and build\n\t\t\t\t\t// declarations for subfeature.\n\t\t\t\t\tconst subfeatureStyles = {\n\t\t\t\t\t\t[ feature ]: {\n\t\t\t\t\t\t\t[ subfeature ]: styles[ feature ][ subfeature ],\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tconst newDeclarations =\n\t\t\t\t\t\tgetStylesDeclarations( subfeatureStyles );\n\n\t\t\t\t\t// Merge new declarations in with any others that\n\t\t\t\t\t// share the same selector.\n\t\t\t\t\tdeclarations[ subfeatureSelector ] = [\n\t\t\t\t\t\t...( declarations[ subfeatureSelector ] || [] ),\n\t\t\t\t\t\t...newDeclarations,\n\t\t\t\t\t];\n\n\t\t\t\t\t// Remove the subfeature's style now it will be\n\t\t\t\t\t// included under its own selector not the block's.\n\t\t\t\t\tdelete styles[ feature ][ subfeature ];\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Now subfeatures have been processed and removed, we can\n\t\t// process root, or shorthand, feature selectors.\n\t\tif ( isShorthand || selector.root ) {\n\t\t\tconst featureSelector = isShorthand ? selector : selector.root;\n\n\t\t\t// Create temporary style object and build declarations for feature.\n\t\t\tconst featureStyles = { [ feature ]: styles[ feature ] };\n\t\t\tconst newDeclarations = getStylesDeclarations( featureStyles );\n\n\t\t\t// Merge new declarations with any others that share the selector.\n\t\t\tdeclarations[ featureSelector ] = [\n\t\t\t\t...( declarations[ featureSelector ] || [] ),\n\t\t\t\t...newDeclarations,\n\t\t\t];\n\n\t\t\t// Remove the feature from the block's styles now as it will be\n\t\t\t// included under its own selector not the block's.\n\t\t\tdelete styles[ feature ];\n\t\t}\n\t} );\n\n\treturn declarations;\n};\n\n/**\n * Transform given style tree into a set of style declarations.\n *\n * @param {Object} blockStyles Block styles.\n *\n * @param {string} selector The selector these declarations should attach to.\n *\n * @param {boolean} useRootPaddingAlign Whether to use CSS custom properties in root selector.\n *\n * @param {Object} tree A theme.json tree containing layout definitions.\n *\n * @return {Array} An array of style declarations.\n */\nexport function getStylesDeclarations(\n\tblockStyles = {},\n\tselector = '',\n\tuseRootPaddingAlign,\n\ttree = {}\n) {\n\tconst isRoot = ROOT_BLOCK_SELECTOR === selector;\n\tconst output = Object.entries( STYLE_PROPERTY ).reduce(\n\t\t(\n\t\t\tdeclarations,\n\t\t\t[ key, { value, properties, useEngine, rootOnly } ]\n\t\t) => {\n\t\t\tif ( rootOnly && ! isRoot ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\t\t\tconst pathToValue = value;\n\t\t\tif ( pathToValue[ 0 ] === 'elements' || useEngine ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst styleValue = get( blockStyles, pathToValue );\n\n\t\t\t// Root-level padding styles don't currently support strings with CSS shorthand values.\n\t\t\t// This may change: https://github.com/WordPress/gutenberg/issues/40132.\n\t\t\tif (\n\t\t\t\tkey === '--wp--style--root--padding' &&\n\t\t\t\t( typeof styleValue === 'string' || ! useRootPaddingAlign )\n\t\t\t) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tif ( properties && typeof styleValue !== 'string' ) {\n\t\t\t\tObject.entries( properties ).forEach( ( entry ) => {\n\t\t\t\t\tconst [ name, prop ] = entry;\n\n\t\t\t\t\tif ( ! get( styleValue, [ prop ], false ) ) {\n\t\t\t\t\t\t// Do not create a declaration\n\t\t\t\t\t\t// for sub-properties that don't have any value.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cssProperty = name.startsWith( '--' )\n\t\t\t\t\t\t? name\n\t\t\t\t\t\t: kebabCase( name );\n\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\t\tget( styleValue, [ prop ] )\n\t\t\t\t\t\t) }`\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else if ( get( blockStyles, pathToValue, false ) ) {\n\t\t\t\tconst cssProperty = key.startsWith( '--' )\n\t\t\t\t\t? key\n\t\t\t\t\t: kebabCase( key );\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\tget( blockStyles, pathToValue )\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tconst extraRules = getCSSRules( blockStyles );\n\textraRules.forEach( ( rule ) => {\n\t\t// Don't output padding properties if padding variables are set.\n\t\tif (\n\t\t\tisRoot &&\n\t\t\tuseRootPaddingAlign &&\n\t\t\trule.key.startsWith( 'padding' )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst cssProperty = rule.key.startsWith( '--' )\n\t\t\t? rule.key\n\t\t\t: kebabCase( rule.key );\n\n\t\tlet ruleValue = rule.value;\n\t\tif ( typeof ruleValue !== 'string' && ruleValue?.ref ) {\n\t\t\tconst refPath = ruleValue.ref.split( '.' );\n\t\t\truleValue = get( tree, refPath );\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! ruleValue || ruleValue?.ref ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Calculate fluid typography rules where available.\n\t\tif ( cssProperty === 'font-size' ) {\n\t\t\t/*\n\t\t\t * getTypographyFontSizeValue() will check\n\t\t\t * if fluid typography has been activated and also\n\t\t\t * whether the incoming value can be converted to a fluid value.\n\t\t\t * Values that already have a \"clamp()\" function will not pass the test,\n\t\t\t * and therefore the original $value will be returned.\n\t\t\t */\n\t\t\truleValue = getTypographyFontSizeValue(\n\t\t\t\t{ size: ruleValue },\n\t\t\t\tgetFluidTypographyOptionsFromSettings( tree?.settings )\n\t\t\t);\n\t\t}\n\n\t\toutput.push( `${ cssProperty }: ${ ruleValue }` );\n\t} );\n\n\treturn output;\n}\n\n/**\n * Get generated CSS for layout styles by looking up layout definitions provided\n * in theme.json, and outputting common layout styles, and specific blockGap values.\n *\n * @param {Object} props\n * @param {Object} props.layoutDefinitions Layout definitions, keyed by layout type.\n * @param {Object} props.style A style object containing spacing values.\n * @param {string} props.selector Selector used to group together layout styling rules.\n * @param {boolean} props.hasBlockGapSupport Whether or not the theme opts-in to blockGap support.\n * @param {boolean} props.hasFallbackGapSupport Whether or not the theme allows fallback gap styles.\n * @param {?string} props.fallbackGapValue An optional fallback gap value if no real gap value is available.\n * @return {string} Generated CSS rules for the layout styles.\n */\nexport function getLayoutStyles( {\n\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\tstyle,\n\tselector,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tfallbackGapValue,\n} ) {\n\tlet ruleset = '';\n\tlet gapValue = hasBlockGapSupport\n\t\t? getGapCSSValue( style?.spacing?.blockGap )\n\t\t: '';\n\n\t// Ensure a fallback gap value for the root layout definitions,\n\t// and use a fallback value if one is provided for the current block.\n\tif ( hasFallbackGapSupport ) {\n\t\tif ( selector === ROOT_BLOCK_SELECTOR ) {\n\t\t\tgapValue = ! gapValue ? '0.5em' : gapValue;\n\t\t} else if ( ! hasBlockGapSupport && fallbackGapValue ) {\n\t\t\tgapValue = fallbackGapValue;\n\t\t}\n\t}\n\n\tif ( gapValue && layoutDefinitions ) {\n\t\tObject.values( layoutDefinitions ).forEach(\n\t\t\t( { className, name, spacingStyles } ) => {\n\t\t\t\t// Allow outputting fallback gap styles for flex layout type when block gap support isn't available.\n\t\t\t\tif (\n\t\t\t\t\t! hasBlockGapSupport &&\n\t\t\t\t\t'flex' !== name &&\n\t\t\t\t\t'grid' !== name\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( spacingStyles?.length ) {\n\t\t\t\t\tspacingStyles.forEach( ( spacingStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( spacingStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( spacingStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${\n\t\t\t\t\t\t\t\t\t\t\tcssValue ? cssValue : gapValue\n\t\t\t\t\t\t\t\t\t\t}`\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tlet combinedSelector = '';\n\n\t\t\t\t\t\t\tif ( ! hasBlockGapSupport ) {\n\t\t\t\t\t\t\t\t// For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles.\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `:where(.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`\n\t\t\t\t\t\t\t\t\t\t: `:where(${ selector }.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `:where(${ selector } .${ className })${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`\n\t\t\t\t\t\t\t\t\t\t: `${ selector }-${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\n\t\t\t\t\t\t\t\t'; '\n\t\t\t\t\t\t\t) }; }`;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\t// For backwards compatibility, ensure the legacy block gap CSS variable is still available.\n\t\tif ( selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport ) {\n\t\t\truleset += `${ selector } { --wp--style--block-gap: ${ gapValue }; }`;\n\t\t}\n\t}\n\n\t// Output base styles\n\tif ( selector === ROOT_BLOCK_SELECTOR && layoutDefinitions ) {\n\t\tconst validDisplayModes = [ 'block', 'flex', 'grid' ];\n\t\tObject.values( layoutDefinitions ).forEach(\n\t\t\t( { className, displayMode, baseStyles } ) => {\n\t\t\t\tif (\n\t\t\t\t\tdisplayMode &&\n\t\t\t\t\tvalidDisplayModes.includes( displayMode )\n\t\t\t\t) {\n\t\t\t\t\truleset += `${ selector } .${ className } { display:${ displayMode }; }`;\n\t\t\t\t}\n\n\t\t\t\tif ( baseStyles?.length ) {\n\t\t\t\t\tbaseStyles.forEach( ( baseStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( baseStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( baseStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${ cssValue }`\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst combinedSelector = `${ selector } .${ className }${\n\t\t\t\t\t\t\t\tbaseStyle?.selector || ''\n\t\t\t\t\t\t\t}`;\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\n\t\t\t\t\t\t\t\t'; '\n\t\t\t\t\t\t\t) }; }`;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\treturn ruleset;\n}\n\nconst STYLE_KEYS = [\n\t'border',\n\t'color',\n\t'dimensions',\n\t'spacing',\n\t'typography',\n\t'filter',\n\t'outline',\n\t'shadow',\n];\n\nfunction pickStyleKeys( treeToPickFrom ) {\n\tif ( ! treeToPickFrom ) {\n\t\treturn {};\n\t}\n\tconst entries = Object.entries( treeToPickFrom );\n\tconst pickedEntries = entries.filter( ( [ key ] ) =>\n\t\tSTYLE_KEYS.includes( key )\n\t);\n\t// clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it\n\tconst clonedEntries = pickedEntries.map( ( [ key, style ] ) => [\n\t\tkey,\n\t\tJSON.parse( JSON.stringify( style ) ),\n\t] );\n\treturn Object.fromEntries( clonedEntries );\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\t// Top-level.\n\tconst styles = pickStyleKeys( tree.styles );\n\tif ( styles ) {\n\t\tnodes.push( {\n\t\t\tstyles,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\tObject.entries( ELEMENTS ).forEach( ( [ name, selector ] ) => {\n\t\tif ( tree.styles?.elements?.[ name ] ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: tree.styles?.elements?.[ name ],\n\t\t\t\tselector,\n\t\t\t} );\n\t\t}\n\t} );\n\n\t// Iterate over blocks: they can have styles & elements.\n\tObject.entries( tree.styles?.blocks ?? {} ).forEach(\n\t\t( [ blockName, node ] ) => {\n\t\t\tconst blockStyles = pickStyleKeys( node );\n\n\t\t\tif ( node?.variations ) {\n\t\t\t\tconst variations = {};\n\t\t\t\tObject.keys( node.variations ).forEach( ( variation ) => {\n\t\t\t\t\tvariations[ variation ] = pickStyleKeys(\n\t\t\t\t\t\tnode.variations[ variation ]\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t\tblockStyles.variations = variations;\n\t\t\t}\n\t\t\tif ( blockStyles && blockSelectors?.[ blockName ]?.selector ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tduotoneSelector:\n\t\t\t\t\t\tblockSelectors[ blockName ].duotoneSelector,\n\t\t\t\t\tfallbackGapValue:\n\t\t\t\t\t\tblockSelectors[ blockName ].fallbackGapValue,\n\t\t\t\t\thasLayoutSupport:\n\t\t\t\t\t\tblockSelectors[ blockName ].hasLayoutSupport,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t\t\tstyles: blockStyles,\n\t\t\t\t\tfeatureSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].featureSelectors,\n\t\t\t\t\tstyleVariationSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].styleVariationSelectors,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tObject.entries( node?.elements ?? {} ).forEach(\n\t\t\t\t( [ elementName, value ] ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tvalue &&\n\t\t\t\t\t\tblockSelectors?.[ blockName ] &&\n\t\t\t\t\t\tELEMENTS[ elementName ]\n\t\t\t\t\t) {\n\t\t\t\t\t\tnodes.push( {\n\t\t\t\t\t\t\tstyles: value,\n\t\t\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector\n\t\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t\t.map( ( sel ) => {\n\t\t\t\t\t\t\t\t\tconst elementSelectors =\n\t\t\t\t\t\t\t\t\t\tELEMENTS[ elementName ].split( ',' );\n\t\t\t\t\t\t\t\t\treturn elementSelectors.map(\n\t\t\t\t\t\t\t\t\t\t( elementSelector ) =>\n\t\t\t\t\t\t\t\t\t\t\tsel + ' ' + elementSelector\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t.join( ',' ),\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom ) => {\n\t\tconst presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = get( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tset( presets, path, value );\n\t\t\t}\n\t\t} );\n\t\treturn presets;\n\t};\n\n\t// Top-level.\n\tconst presets = pickPresets( tree.settings );\n\tconst custom = tree.settings?.custom;\n\tif ( Object.keys( presets ).length > 0 || custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\t// Blocks.\n\tObject.entries( tree.settings?.blocks ?? {} ).forEach(\n\t\t( [ blockName, node ] ) => {\n\t\t\tconst blockPresets = pickPresets( node );\n\t\t\tconst blockCustom = node.custom;\n\t\t\tif ( Object.keys( blockPresets ).length > 0 || blockCustom ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tpresets: blockPresets,\n\t\t\t\t\tcustom: blockCustom,\n\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\nexport const toCustomProperties = ( tree, blockSelectors ) => {\n\tconst settings = getNodesWithSettings( tree, blockSelectors );\n\tlet ruleset = '';\n\tsettings.forEach( ( { presets, custom, selector } ) => {\n\t\tconst declarations = getPresetsDeclarations( presets, tree?.settings );\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tdeclarations.push( ...customProps );\n\t\t}\n\n\t\tif ( declarations.length > 0 ) {\n\t\t\truleset += `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport const toStyles = (\n\ttree,\n\tblockSelectors,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tdisableLayoutStyles = false\n) => {\n\tconst nodesWithStyles = getNodesWithStyles( tree, blockSelectors );\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\tconst useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments;\n\tconst { contentSize, wideSize } = tree?.settings?.layout || {};\n\n\t/*\n\t * Reset default browser margin on the root body element.\n\t * This is set on the root selector **before** generating the ruleset\n\t * from the `theme.json`. This is to ensure that if the `theme.json` declares\n\t * `margin` in its `spacing` declaration for the `body` element then these\n\t * user-generated values take precedence in the CSS cascade.\n\t * @link https://github.com/WordPress/gutenberg/issues/36147.\n\t */\n\tlet ruleset = 'body {margin: 0;';\n\n\tif ( contentSize ) {\n\t\truleset += ` --wp--style--global--content-size: ${ contentSize };`;\n\t}\n\n\tif ( wideSize ) {\n\t\truleset += ` --wp--style--global--wide-size: ${ wideSize };`;\n\t}\n\n\tif ( useRootPaddingAlign ) {\n\t\t/*\n\t\t * These rules reproduce the ones from https://github.com/WordPress/gutenberg/blob/79103f124925d1f457f627e154f52a56228ed5ad/lib/class-wp-theme-json-gutenberg.php#L2508\n\t\t * almost exactly, but for the selectors that target block wrappers in the front end. This code only runs in the editor, so it doesn't need those selectors.\n\t\t */\n\t\truleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }\n\t\t\t.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }\n\t\t\t.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }\n\t\t\t.has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }\n\t\t\t.has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;\n\t}\n\n\truleset += '}';\n\n\tnodesWithStyles.forEach(\n\t\t( {\n\t\t\tselector,\n\t\t\tduotoneSelector,\n\t\t\tstyles,\n\t\t\tfallbackGapValue,\n\t\t\thasLayoutSupport,\n\t\t\tfeatureSelectors,\n\t\t\tstyleVariationSelectors,\n\t\t} ) => {\n\t\t\t// Process styles for block support features with custom feature level\n\t\t\t// CSS selectors set.\n\t\t\tif ( featureSelectors ) {\n\t\t\t\tconst featureDeclarations = getFeatureDeclarations(\n\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\tstyles\n\t\t\t\t);\n\n\t\t\t\tObject.entries( featureDeclarations ).forEach(\n\t\t\t\t\t( [ cssSelector, declarations ] ) => {\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst rules = declarations.join( ';' );\n\t\t\t\t\t\t\truleset += `${ cssSelector }{${ rules };}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif ( styleVariationSelectors ) {\n\t\t\t\tObject.entries( styleVariationSelectors ).forEach(\n\t\t\t\t\t( [ styleVariationName, styleVariationSelector ] ) => {\n\t\t\t\t\t\tconst styleVariations =\n\t\t\t\t\t\t\tstyles?.variations?.[ styleVariationName ];\n\t\t\t\t\t\tif ( styleVariations ) {\n\t\t\t\t\t\t\t// If the block uses any custom selectors for block support, add those first.\n\t\t\t\t\t\t\tif ( featureSelectors ) {\n\t\t\t\t\t\t\t\tconst featureDeclarations =\n\t\t\t\t\t\t\t\t\tgetFeatureDeclarations(\n\t\t\t\t\t\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\t\t\t\t\t\tstyleVariations\n\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tObject.entries( featureDeclarations ).forEach(\n\t\t\t\t\t\t\t\t\t( [ baseSelector, declarations ] ) => {\n\t\t\t\t\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\t\t\t\t\tconst cssSelector =\n\t\t\t\t\t\t\t\t\t\t\t\tconcatFeatureVariationSelectorString(\n\t\t\t\t\t\t\t\t\t\t\t\t\tbaseSelector,\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyleVariationSelector\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tconst rules =\n\t\t\t\t\t\t\t\t\t\t\t\tdeclarations.join( ';' );\n\t\t\t\t\t\t\t\t\t\t\truleset += `${ cssSelector }{${ rules };}`;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Otherwise add regular selectors.\n\t\t\t\t\t\t\tconst styleVariationDeclarations =\n\t\t\t\t\t\t\t\tgetStylesDeclarations(\n\t\t\t\t\t\t\t\t\tstyleVariations,\n\t\t\t\t\t\t\t\t\tstyleVariationSelector,\n\t\t\t\t\t\t\t\t\tuseRootPaddingAlign,\n\t\t\t\t\t\t\t\t\ttree\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif ( styleVariationDeclarations.length ) {\n\t\t\t\t\t\t\t\truleset += `${ styleVariationSelector }{${ styleVariationDeclarations.join(\n\t\t\t\t\t\t\t\t\t';'\n\t\t\t\t\t\t\t\t) };}`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Process duotone styles.\n\t\t\tif ( duotoneSelector ) {\n\t\t\t\tconst duotoneStyles = {};\n\t\t\t\tif ( styles?.filter ) {\n\t\t\t\t\tduotoneStyles.filter = styles.filter;\n\t\t\t\t\tdelete styles.filter;\n\t\t\t\t}\n\t\t\t\tconst duotoneDeclarations =\n\t\t\t\t\tgetStylesDeclarations( duotoneStyles );\n\t\t\t\tif ( duotoneDeclarations.length ) {\n\t\t\t\t\truleset += `${ duotoneSelector }{${ duotoneDeclarations.join(\n\t\t\t\t\t\t';'\n\t\t\t\t\t) };}`;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Process blockGap and layout styles.\n\t\t\tif (\n\t\t\t\t! disableLayoutStyles &&\n\t\t\t\t( ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport )\n\t\t\t) {\n\t\t\t\truleset += getLayoutStyles( {\n\t\t\t\t\tstyle: styles,\n\t\t\t\t\tselector,\n\t\t\t\t\thasBlockGapSupport,\n\t\t\t\t\thasFallbackGapSupport,\n\t\t\t\t\tfallbackGapValue,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t// Process the remaining block styles (they use either normal block class or __experimentalSelector).\n\t\t\tconst declarations = getStylesDeclarations(\n\t\t\t\tstyles,\n\t\t\t\tselector,\n\t\t\t\tuseRootPaddingAlign,\n\t\t\t\ttree\n\t\t\t);\n\t\t\tif ( declarations?.length ) {\n\t\t\t\truleset += `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t\t}\n\n\t\t\t// Check for pseudo selector in `styles` and handle separately.\n\t\t\tconst pseudoSelectorStyles = Object.entries( styles ).filter(\n\t\t\t\t( [ key ] ) => key.startsWith( ':' )\n\t\t\t);\n\n\t\t\tif ( pseudoSelectorStyles?.length ) {\n\t\t\t\tpseudoSelectorStyles.forEach(\n\t\t\t\t\t( [ pseudoKey, pseudoStyle ] ) => {\n\t\t\t\t\t\tconst pseudoDeclarations =\n\t\t\t\t\t\t\tgetStylesDeclarations( pseudoStyle );\n\n\t\t\t\t\t\tif ( ! pseudoDeclarations?.length ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// `selector` maybe provided in a form\n\t\t\t\t\t\t// where block level selectors have sub element\n\t\t\t\t\t\t// selectors appended to them as a comma separated\n\t\t\t\t\t\t// string.\n\t\t\t\t\t\t// e.g. `h1 a,h2 a,h3 a,h4 a,h5 a,h6 a`;\n\t\t\t\t\t\t// Split and append pseudo selector to create\n\t\t\t\t\t\t// the proper rules to target the elements.\n\t\t\t\t\t\tconst _selector = selector\n\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t.map( ( sel ) => sel + pseudoKey )\n\t\t\t\t\t\t\t.join( ',' );\n\n\t\t\t\t\t\tconst pseudoRule = `${ _selector }{${ pseudoDeclarations.join(\n\t\t\t\t\t\t\t';'\n\t\t\t\t\t\t) };}`;\n\n\t\t\t\t\t\truleset += pseudoRule;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t);\n\n\t/* Add alignment / layout styles */\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';\n\n\tif ( hasBlockGapSupport ) {\n\t\t// Use fallback of `0.5em` just in case, however if there is blockGap support, there should nearly always be a real value.\n\t\tconst gapValue =\n\t\t\tgetGapCSSValue( tree?.styles?.spacing?.blockGap ) || '0.5em';\n\t\truleset =\n\t\t\truleset +\n\t\t\t`:where(.wp-site-blocks) > * { margin-block-start: ${ gapValue }; margin-block-end: 0; }`;\n\t\truleset =\n\t\t\truleset +\n\t\t\t':where(.wp-site-blocks) > :first-child:first-child { margin-block-start: 0; }';\n\t\truleset =\n\t\t\truleset +\n\t\t\t':where(.wp-site-blocks) > :last-child:last-child { margin-block-end: 0; }';\n\t}\n\n\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\tif ( ROOT_BLOCK_SELECTOR === selector ) {\n\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\tselector = '';\n\t\t}\n\n\t\tconst classes = getPresetsClasses( selector, presets );\n\t\tif ( classes.length > 0 ) {\n\t\t\truleset += classes;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport function toSvgFilters( tree, blockSelectors ) {\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\treturn nodesWithSettings.flatMap( ( { presets } ) => {\n\t\treturn getPresetsSvgFilters( presets );\n\t} );\n}\n\nconst getSelectorsConfig = ( blockType, rootSelector ) => {\n\tif (\n\t\tblockType?.selectors &&\n\t\tObject.keys( blockType.selectors ).length > 0\n\t) {\n\t\treturn blockType.selectors;\n\t}\n\n\tconst config = { root: rootSelector };\n\tObject.entries( BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS ).forEach(\n\t\t( [ featureKey, featureName ] ) => {\n\t\t\tconst featureSelector = getBlockCSSSelector(\n\t\t\t\tblockType,\n\t\t\t\tfeatureKey\n\t\t\t);\n\n\t\t\tif ( featureSelector ) {\n\t\t\t\tconfig[ featureName ] = featureSelector;\n\t\t\t}\n\t\t}\n\t);\n\n\treturn config;\n};\n\nexport const getBlockSelectors = ( blockTypes, getBlockStyles ) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector = getBlockCSSSelector( blockType );\n\t\tlet duotoneSelector = getBlockCSSSelector(\n\t\t\tblockType,\n\t\t\t'filter.duotone'\n\t\t);\n\n\t\t// Keep backwards compatibility for support.color.__experimentalDuotone.\n\t\tif ( ! duotoneSelector ) {\n\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tduotoneSelector =\n\t\t\t\tduotoneSupport && scopeSelector( rootSelector, duotoneSupport );\n\t\t}\n\n\t\tconst hasLayoutSupport =\n\t\t\t!! blockType?.supports?.layout ||\n\t\t\t!! blockType?.supports?.__experimentalLayout;\n\t\tconst fallbackGapValue =\n\t\t\tblockType?.supports?.spacing?.blockGap?.__experimentalDefault;\n\n\t\tconst blockStyleVariations = getBlockStyles( name );\n\t\tconst styleVariationSelectors = {};\n\t\tif ( blockStyleVariations?.length ) {\n\t\t\tblockStyleVariations.forEach( ( variation ) => {\n\t\t\t\tconst styleVariationSelector = `.is-style-${ variation.name }${ selector }`;\n\t\t\t\tstyleVariationSelectors[ variation.name ] =\n\t\t\t\t\tstyleVariationSelector;\n\t\t\t} );\n\t\t}\n\t\t// For each block support feature add any custom selectors.\n\t\tconst featureSelectors = getSelectorsConfig( blockType, selector );\n\n\t\tresult[ name ] = {\n\t\t\tduotoneSelector,\n\t\t\tfallbackGapValue,\n\t\t\tfeatureSelectors: Object.keys( featureSelectors ).length\n\t\t\t\t? featureSelectors\n\t\t\t\t: undefined,\n\t\t\thasLayoutSupport,\n\t\t\tname,\n\t\t\tselector,\n\t\t\tstyleVariationSelectors: Object.keys( styleVariationSelectors )\n\t\t\t\t.length\n\t\t\t\t? styleVariationSelectors\n\t\t\t\t: undefined,\n\t\t};\n\t} );\n\n\treturn result;\n};\n\n/**\n * If there is a separator block whose color is defined in theme.json via background,\n * update the separator color to the same value by using border color.\n *\n * @param {Object} config Theme.json configuration file object.\n * @return {Object} configTheme.json configuration file object updated.\n */\nfunction updateConfigWithSeparator( config ) {\n\tconst needsSeparatorStyleUpdate =\n\t\tconfig.styles?.blocks?.[ 'core/separator' ] &&\n\t\tconfig.styles?.blocks?.[ 'core/separator' ].color?.background &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].color?.text &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].border?.color;\n\tif ( needsSeparatorStyleUpdate ) {\n\t\treturn {\n\t\t\t...config,\n\t\t\tstyles: {\n\t\t\t\t...config.styles,\n\t\t\t\tblocks: {\n\t\t\t\t\t...config.styles.blocks,\n\t\t\t\t\t'core/separator': {\n\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ],\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ].color,\n\t\t\t\t\t\t\ttext: config.styles?.blocks[ 'core/separator' ]\n\t\t\t\t\t\t\t\t.color.background,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\treturn config;\n}\n\nconst processCSSNesting = ( css, blockSelector ) => {\n\tlet processedCSS = '';\n\n\t// Split CSS nested rules.\n\tconst parts = css.split( '&' );\n\tparts.forEach( ( part ) => {\n\t\tprocessedCSS += ! part.includes( '{' )\n\t\t\t? blockSelector + '{' + part + '}' // If the part doesn't contain braces, it applies to the root level.\n\t\t\t: blockSelector + part; // Prepend the selector, which effectively replaces the \"&\" character.\n\t} );\n\treturn processedCSS;\n};\n\n/**\n * Returns the global styles output using a global styles configuration.\n * If wishing to generate global styles and settings based on the\n * global styles config loaded in the editor context, use `useGlobalStylesOutput()`.\n * The use case for a custom config is to generate bespoke styles\n * and settings for previews, or other out-of-editor experiences.\n *\n * @param {Object} mergedConfig Global styles configuration.\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {\n\tconst [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGap !== null;\n\tconst hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.\n\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn !! getSettings().disableLayoutStyles;\n\t} );\n\n\tconst getBlockStyles = useSelect( ( select ) => {\n\t\treturn select( blocksStore ).getBlockStyles;\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn [];\n\t\t}\n\t\tmergedConfig = updateConfigWithSeparator( mergedConfig );\n\n\t\tconst blockSelectors = getBlockSelectors(\n\t\t\tgetBlockTypes(),\n\t\t\tgetBlockStyles\n\t\t);\n\n\t\tconst customProperties = toCustomProperties(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors\n\t\t);\n\t\tconst globalStyles = toStyles(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors,\n\t\t\thasBlockGapSupport,\n\t\t\thasFallbackGapSupport,\n\t\t\tdisableLayoutStyles\n\t\t);\n\t\tconst svgs = toSvgFilters( mergedConfig, blockSelectors );\n\n\t\tconst styles = [\n\t\t\t{\n\t\t\t\tcss: customProperties,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcss: globalStyles,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t// Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.\n\t\t\t{\n\t\t\t\tcss: mergedConfig.styles.css ?? '',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tassets: svgs,\n\t\t\t\t__unstableType: 'svg',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t];\n\n\t\t// Loop through the blocks to check if there are custom CSS values.\n\t\t// If there are, get the block selector and push the selector together with\n\t\t// the CSS value to the 'stylesheets' array.\n\t\tgetBlockTypes().forEach( ( blockType ) => {\n\t\t\tif ( mergedConfig.styles.blocks[ blockType.name ]?.css ) {\n\t\t\t\tconst selector = blockSelectors[ blockType.name ].selector;\n\t\t\t\tstyles.push( {\n\t\t\t\t\tcss: processCSSNesting(\n\t\t\t\t\t\tmergedConfig.styles.blocks[ blockType.name ]?.css,\n\t\t\t\t\t\tselector\n\t\t\t\t\t),\n\t\t\t\t\tisGlobalStyles: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\treturn [ styles, mergedConfig.settings ];\n\t}, [\n\t\thasBlockGapSupport,\n\t\thasFallbackGapSupport,\n\t\tmergedConfig,\n\t\tdisableLayoutStyles,\n\t] );\n}\n\n/**\n * Returns the global styles output based on the current state of global styles config loaded in the editor context.\n *\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutput() {\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\treturn useGlobalStylesOutputWithConfig( mergedConfig );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/use-global-styles-output.js"],"names":["__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","__EXPERIMENTAL_ELEMENTS","ELEMENTS","getBlockSupport","getBlockTypes","store","blocksStore","useSelect","renderToString","useContext","useMemo","getCSSRules","PRESET_METADATA","ROOT_BLOCK_SELECTOR","scopeSelector","getBlockCSSSelector","getTypographyFontSizeValue","getFluidTypographyOptionsFromSettings","GlobalStylesContext","useGlobalSetting","PresetDuotoneFilter","getGapCSSValue","blockEditorStore","LAYOUT_DEFINITIONS","getValueFromObjectPath","kebabCase","setImmutably","BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS","__experimentalBorder","color","spacing","typography","compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","startsWith","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","mergedSettings","reduce","declarations","path","valueKey","valueFunc","cssVarInfix","presetByOrigin","forEach","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","getPresetsSvgFilters","filter","metadata","at","flatMap","preset","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","concatFeatureVariationSelectorString","featureSelector","styleVariationSelector","featureSelectors","combinedSelectors","trim","getFeatureDeclarations","selectors","styles","entries","feature","isShorthand","subfeature","subfeatureSelector","subfeatureStyles","newDeclarations","getStylesDeclarations","root","featureStyles","blockStyles","useRootPaddingAlign","tree","isRoot","output","properties","useEngine","rootOnly","pathToValue","styleValue","entry","name","prop","cssProperty","extraRules","rule","ruleValue","ref","refPath","size","settings","getLayoutStyles","layoutDefinitions","style","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","ruleset","gapValue","blockGap","values","className","spacingStyles","spacingStyle","rules","cssValue","combinedSelector","validDisplayModes","displayMode","baseStyles","includes","baseStyle","STYLE_KEYS","pickStyleKeys","treeToPickFrom","pickedEntries","clonedEntries","JSON","parse","stringify","fromEntries","getNodesWithStyles","blockSelectors","nodes","elements","blocks","blockName","node","variations","variation","duotoneSelector","hasLayoutSupport","styleVariationSelectors","elementName","sel","elementSelectors","elementSelector","getNodesWithSettings","pickPresets","presets","custom","blockCustom","toCustomProperties","customProps","toStyles","disableLayoutStyles","nodesWithStyles","nodesWithSettings","useRootPaddingAwareAlignments","contentSize","wideSize","layout","featureDeclarations","cssSelector","styleVariationName","styleVariations","baseSelector","styleVariationDeclarations","duotoneStyles","duotoneDeclarations","pseudoSelectorStyles","pseudoKey","pseudoStyle","pseudoDeclarations","_selector","pseudoRule","toSvgFilters","getSelectorsConfig","blockType","rootSelector","config","featureKey","featureName","getBlockSelectors","blockTypes","getBlockStyles","duotoneSupport","supports","__experimentalLayout","__experimentalDefault","blockStyleVariations","undefined","updateConfigWithSeparator","needsSeparatorStyleUpdate","background","text","border","processCSSNesting","css","processedCSS","parts","part","useGlobalStylesOutputWithConfig","mergedConfig","select","getSettings","customProperties","globalStyles","svgs","isGlobalStyles","assets","__unstableType","useGlobalStylesOutput","merged"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,6BAA6B,IAAIC,cADlC,EAECC,uBAAuB,IAAIC,QAF5B,EAGCC,eAHD,EAICC,aAJD,EAKCC,KAAK,IAAIC,WALV,QAMO,mBANP;AAOA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,cAAT,EAAyBC,UAAzB,EAAqCC,OAArC,QAAoD,oBAApD;AACA,SAASC,WAAT,QAA4B,yBAA5B;AAEA;AACA;AACA;;AACA,SAASC,eAAT,EAA0BC,mBAA1B,EAA+CC,aAA/C,QAAoE,SAApE;AACA,SAASC,mBA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D,qBAAT,GAAiC;AACvC,QAAM;AAAEC,IAAAA,MAAM,EAAEV;AAAV,MAA2B1N,UAAU,CAAES,mBAAF,CAA3C;AACA,SAAOgN,+BAA+B,CAAEC,YAAF,CAAtC;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockSupport,\n\tgetBlockTypes,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { renderToString, useContext, useMemo } from '@wordpress/element';\nimport { getCSSRules } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport { PRESET_METADATA, ROOT_BLOCK_SELECTOR, scopeSelector } from './utils';\nimport { getBlockCSSSelector } from './get-block-css-selector';\nimport {\n\tgetTypographyFontSizeValue,\n\tgetFluidTypographyOptionsFromSettings,\n} from './typography-utils';\nimport { GlobalStylesContext } from './context';\nimport { useGlobalSetting } from './hooks';\nimport { PresetDuotoneFilter } from '../duotone/components';\nimport { getGapCSSValue } from '../../hooks/gap';\nimport { store as blockEditorStore } from '../../store';\nimport { LAYOUT_DEFINITIONS } from '../../layouts/definitions';\nimport {\n\tgetValueFromObjectPath,\n\tkebabCase,\n\tsetImmutably,\n} from '../../utils/object';\n\n// List of block support features that can have their related styles\n// generated under their own feature level selector rather than the block's.\nconst BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {\n\t__experimentalBorder: 'border',\n\tcolor: 'color',\n\tspacing: 'spacing',\n\ttypography: 'typography',\n};\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\n\tif ( uncompiledValue?.startsWith?.( VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n * @param {Object} mergedSettings Merged theme.json settings.\n *\n * @return {Array<Object>} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {}, mergedSettings ) {\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\t\tblockPresets,\n\t\t\t\tpath,\n\t\t\t\t[]\n\t\t\t);\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( value ) => {\n\t\t\t\t\t\tif ( valueKey && ! valueFunc ) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ value[ valueKey ] }`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tvalueFunc &&\n\t\t\t\t\t\t\ttypeof valueFunc === 'function'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ valueFunc( value, mergedSettings ) }`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param {?string} blockSelector\n * @param {Object} blockPresets\n * @return {string} CSS declarations for the preset classes.\n */\nfunction getPresetsClasses( blockSelector = '*', blockPresets = {} ) {\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, cssVarInfix, classes } ) => {\n\t\t\tif ( ! classes ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\t\tblockPresets,\n\t\t\t\tpath,\n\t\t\t\t[]\n\t\t\t);\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( { slug } ) => {\n\t\t\t\t\t\tclasses.forEach( ( { classSuffix, propertyName } ) => {\n\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction getPresetsSvgFilters( blockPresets = {} ) {\n\treturn PRESET_METADATA.filter(\n\t\t// Duotone are the only type of filters for now.\n\t\t( metadata ) => metadata.path.at( -1 ) === 'duotone'\n\t).flatMap( ( metadata ) => {\n\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\tblockPresets,\n\t\t\tmetadata.path,\n\t\t\t{}\n\t\t);\n\t\treturn [ 'default', 'theme' ]\n\t\t\t.filter( ( origin ) => presetByOrigin[ origin ] )\n\t\t\t.flatMap( ( origin ) =>\n\t\t\t\tpresetByOrigin[ origin ].map( ( preset ) =>\n\t\t\t\t\trenderToString(\n\t\t\t\t\t\t<PresetDuotoneFilter\n\t\t\t\t\t\t\tpreset={ preset }\n\t\t\t\t\t\t\tkey={ preset.slug }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.join( '' );\n\t} );\n}\n\nfunction flattenTree( input = {}, prefix, token ) {\n\tlet result = [];\n\tObject.keys( input ).forEach( ( key ) => {\n\t\tconst newKey = prefix + kebabCase( key.replace( '/', '-' ) );\n\t\tconst newLeaf = input[ key ];\n\n\t\tif ( newLeaf instanceof Object ) {\n\t\t\tconst newPrefix = newKey + token;\n\t\t\tresult = [ ...result, ...flattenTree( newLeaf, newPrefix, token ) ];\n\t\t} else {\n\t\t\tresult.push( `${ newKey }: ${ newLeaf }` );\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Gets variation selector string from feature selector.\n *\n * @param {string} featureSelector The feature selector.\n *\n * @param {string} styleVariationSelector The style variation selector.\n * @return {string} Combined selector string.\n *\n */\nfunction concatFeatureVariationSelectorString(\n\tfeatureSelector,\n\tstyleVariationSelector\n) {\n\tconst featureSelectors = featureSelector.split( ',' );\n\tconst combinedSelectors = [];\n\tfeatureSelectors.forEach( ( selector ) => {\n\t\tcombinedSelectors.push(\n\t\t\t`${ styleVariationSelector.trim() }${ selector.trim() }`\n\t\t);\n\t} );\n\treturn combinedSelectors.join( ', ' );\n}\n\n/**\n * Generate style declarations for a block's custom feature and subfeature\n * selectors.\n *\n * NOTE: The passed `styles` object will be mutated by this function.\n *\n * @param {Object} selectors Custom selectors object for a block.\n * @param {Object} styles A block's styles object.\n *\n * @return {Object} Style declarations.\n */\nconst getFeatureDeclarations = ( selectors, styles ) => {\n\tconst declarations = {};\n\n\tObject.entries( selectors ).forEach( ( [ feature, selector ] ) => {\n\t\t// We're only processing features/subfeatures that have styles.\n\t\tif ( feature === 'root' || ! styles?.[ feature ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isShorthand = typeof selector === 'string';\n\n\t\t// If we have a selector object instead of shorthand process it.\n\t\tif ( ! isShorthand ) {\n\t\t\tObject.entries( selector ).forEach(\n\t\t\t\t( [ subfeature, subfeatureSelector ] ) => {\n\t\t\t\t\t// Don't process root feature selector yet or any\n\t\t\t\t\t// subfeature that doesn't have a style.\n\t\t\t\t\tif (\n\t\t\t\t\t\tsubfeature === 'root' ||\n\t\t\t\t\t\t! styles?.[ feature ][ subfeature ]\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create a temporary styles object and build\n\t\t\t\t\t// declarations for subfeature.\n\t\t\t\t\tconst subfeatureStyles = {\n\t\t\t\t\t\t[ feature ]: {\n\t\t\t\t\t\t\t[ subfeature ]: styles[ feature ][ subfeature ],\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tconst newDeclarations =\n\t\t\t\t\t\tgetStylesDeclarations( subfeatureStyles );\n\n\t\t\t\t\t// Merge new declarations in with any others that\n\t\t\t\t\t// share the same selector.\n\t\t\t\t\tdeclarations[ subfeatureSelector ] = [\n\t\t\t\t\t\t...( declarations[ subfeatureSelector ] || [] ),\n\t\t\t\t\t\t...newDeclarations,\n\t\t\t\t\t];\n\n\t\t\t\t\t// Remove the subfeature's style now it will be\n\t\t\t\t\t// included under its own selector not the block's.\n\t\t\t\t\tdelete styles[ feature ][ subfeature ];\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Now subfeatures have been processed and removed, we can\n\t\t// process root, or shorthand, feature selectors.\n\t\tif ( isShorthand || selector.root ) {\n\t\t\tconst featureSelector = isShorthand ? selector : selector.root;\n\n\t\t\t// Create temporary style object and build declarations for feature.\n\t\t\tconst featureStyles = { [ feature ]: styles[ feature ] };\n\t\t\tconst newDeclarations = getStylesDeclarations( featureStyles );\n\n\t\t\t// Merge new declarations with any others that share the selector.\n\t\t\tdeclarations[ featureSelector ] = [\n\t\t\t\t...( declarations[ featureSelector ] || [] ),\n\t\t\t\t...newDeclarations,\n\t\t\t];\n\n\t\t\t// Remove the feature from the block's styles now as it will be\n\t\t\t// included under its own selector not the block's.\n\t\t\tdelete styles[ feature ];\n\t\t}\n\t} );\n\n\treturn declarations;\n};\n\n/**\n * Transform given style tree into a set of style declarations.\n *\n * @param {Object} blockStyles Block styles.\n *\n * @param {string} selector The selector these declarations should attach to.\n *\n * @param {boolean} useRootPaddingAlign Whether to use CSS custom properties in root selector.\n *\n * @param {Object} tree A theme.json tree containing layout definitions.\n *\n * @return {Array} An array of style declarations.\n */\nexport function getStylesDeclarations(\n\tblockStyles = {},\n\tselector = '',\n\tuseRootPaddingAlign,\n\ttree = {}\n) {\n\tconst isRoot = ROOT_BLOCK_SELECTOR === selector;\n\tconst output = Object.entries( STYLE_PROPERTY ).reduce(\n\t\t(\n\t\t\tdeclarations,\n\t\t\t[ key, { value, properties, useEngine, rootOnly } ]\n\t\t) => {\n\t\t\tif ( rootOnly && ! isRoot ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\t\t\tconst pathToValue = value;\n\t\t\tif ( pathToValue[ 0 ] === 'elements' || useEngine ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst styleValue = getValueFromObjectPath(\n\t\t\t\tblockStyles,\n\t\t\t\tpathToValue\n\t\t\t);\n\n\t\t\t// Root-level padding styles don't currently support strings with CSS shorthand values.\n\t\t\t// This may change: https://github.com/WordPress/gutenberg/issues/40132.\n\t\t\tif (\n\t\t\t\tkey === '--wp--style--root--padding' &&\n\t\t\t\t( typeof styleValue === 'string' || ! useRootPaddingAlign )\n\t\t\t) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tif ( properties && typeof styleValue !== 'string' ) {\n\t\t\t\tObject.entries( properties ).forEach( ( entry ) => {\n\t\t\t\t\tconst [ name, prop ] = entry;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! getValueFromObjectPath( styleValue, [ prop ], false )\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Do not create a declaration\n\t\t\t\t\t\t// for sub-properties that don't have any value.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cssProperty = name.startsWith( '--' )\n\t\t\t\t\t\t? name\n\t\t\t\t\t\t: kebabCase( name );\n\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\t\tgetValueFromObjectPath( styleValue, [ prop ] )\n\t\t\t\t\t\t) }`\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else if (\n\t\t\t\tgetValueFromObjectPath( blockStyles, pathToValue, false )\n\t\t\t) {\n\t\t\t\tconst cssProperty = key.startsWith( '--' )\n\t\t\t\t\t? key\n\t\t\t\t\t: kebabCase( key );\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\tgetValueFromObjectPath( blockStyles, pathToValue )\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tconst extraRules = getCSSRules( blockStyles );\n\textraRules.forEach( ( rule ) => {\n\t\t// Don't output padding properties if padding variables are set.\n\t\tif (\n\t\t\tisRoot &&\n\t\t\tuseRootPaddingAlign &&\n\t\t\trule.key.startsWith( 'padding' )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst cssProperty = rule.key.startsWith( '--' )\n\t\t\t? rule.key\n\t\t\t: kebabCase( rule.key );\n\n\t\tlet ruleValue = rule.value;\n\t\tif ( typeof ruleValue !== 'string' && ruleValue?.ref ) {\n\t\t\tconst refPath = ruleValue.ref.split( '.' );\n\t\t\truleValue = getValueFromObjectPath( tree, refPath );\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! ruleValue || ruleValue?.ref ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Calculate fluid typography rules where available.\n\t\tif ( cssProperty === 'font-size' ) {\n\t\t\t/*\n\t\t\t * getTypographyFontSizeValue() will check\n\t\t\t * if fluid typography has been activated and also\n\t\t\t * whether the incoming value can be converted to a fluid value.\n\t\t\t * Values that already have a \"clamp()\" function will not pass the test,\n\t\t\t * and therefore the original $value will be returned.\n\t\t\t */\n\t\t\truleValue = getTypographyFontSizeValue(\n\t\t\t\t{ size: ruleValue },\n\t\t\t\tgetFluidTypographyOptionsFromSettings( tree?.settings )\n\t\t\t);\n\t\t}\n\n\t\toutput.push( `${ cssProperty }: ${ ruleValue }` );\n\t} );\n\n\treturn output;\n}\n\n/**\n * Get generated CSS for layout styles by looking up layout definitions provided\n * in theme.json, and outputting common layout styles, and specific blockGap values.\n *\n * @param {Object} props\n * @param {Object} props.layoutDefinitions Layout definitions, keyed by layout type.\n * @param {Object} props.style A style object containing spacing values.\n * @param {string} props.selector Selector used to group together layout styling rules.\n * @param {boolean} props.hasBlockGapSupport Whether or not the theme opts-in to blockGap support.\n * @param {boolean} props.hasFallbackGapSupport Whether or not the theme allows fallback gap styles.\n * @param {?string} props.fallbackGapValue An optional fallback gap value if no real gap value is available.\n * @return {string} Generated CSS rules for the layout styles.\n */\nexport function getLayoutStyles( {\n\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\tstyle,\n\tselector,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tfallbackGapValue,\n} ) {\n\tlet ruleset = '';\n\tlet gapValue = hasBlockGapSupport\n\t\t? getGapCSSValue( style?.spacing?.blockGap )\n\t\t: '';\n\n\t// Ensure a fallback gap value for the root layout definitions,\n\t// and use a fallback value if one is provided for the current block.\n\tif ( hasFallbackGapSupport ) {\n\t\tif ( selector === ROOT_BLOCK_SELECTOR ) {\n\t\t\tgapValue = ! gapValue ? '0.5em' : gapValue;\n\t\t} else if ( ! hasBlockGapSupport && fallbackGapValue ) {\n\t\t\tgapValue = fallbackGapValue;\n\t\t}\n\t}\n\n\tif ( gapValue && layoutDefinitions ) {\n\t\tObject.values( layoutDefinitions ).forEach(\n\t\t\t( { className, name, spacingStyles } ) => {\n\t\t\t\t// Allow outputting fallback gap styles for flex layout type when block gap support isn't available.\n\t\t\t\tif (\n\t\t\t\t\t! hasBlockGapSupport &&\n\t\t\t\t\t'flex' !== name &&\n\t\t\t\t\t'grid' !== name\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( spacingStyles?.length ) {\n\t\t\t\t\tspacingStyles.forEach( ( spacingStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( spacingStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( spacingStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${\n\t\t\t\t\t\t\t\t\t\t\tcssValue ? cssValue : gapValue\n\t\t\t\t\t\t\t\t\t\t}`\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tlet combinedSelector = '';\n\n\t\t\t\t\t\t\tif ( ! hasBlockGapSupport ) {\n\t\t\t\t\t\t\t\t// For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles.\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `:where(.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`\n\t\t\t\t\t\t\t\t\t\t: `:where(${ selector }.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `:where(${ selector } .${ className })${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`\n\t\t\t\t\t\t\t\t\t\t: `${ selector }-${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\n\t\t\t\t\t\t\t\t'; '\n\t\t\t\t\t\t\t) }; }`;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\t// For backwards compatibility, ensure the legacy block gap CSS variable is still available.\n\t\tif ( selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport ) {\n\t\t\truleset += `${ selector } { --wp--style--block-gap: ${ gapValue }; }`;\n\t\t}\n\t}\n\n\t// Output base styles\n\tif ( selector === ROOT_BLOCK_SELECTOR && layoutDefinitions ) {\n\t\tconst validDisplayModes = [ 'block', 'flex', 'grid' ];\n\t\tObject.values( layoutDefinitions ).forEach(\n\t\t\t( { className, displayMode, baseStyles } ) => {\n\t\t\t\tif (\n\t\t\t\t\tdisplayMode &&\n\t\t\t\t\tvalidDisplayModes.includes( displayMode )\n\t\t\t\t) {\n\t\t\t\t\truleset += `${ selector } .${ className } { display:${ displayMode }; }`;\n\t\t\t\t}\n\n\t\t\t\tif ( baseStyles?.length ) {\n\t\t\t\t\tbaseStyles.forEach( ( baseStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( baseStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( baseStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${ cssValue }`\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst combinedSelector = `${ selector } .${ className }${\n\t\t\t\t\t\t\t\tbaseStyle?.selector || ''\n\t\t\t\t\t\t\t}`;\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\n\t\t\t\t\t\t\t\t'; '\n\t\t\t\t\t\t\t) }; }`;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\treturn ruleset;\n}\n\nconst STYLE_KEYS = [\n\t'border',\n\t'color',\n\t'dimensions',\n\t'spacing',\n\t'typography',\n\t'filter',\n\t'outline',\n\t'shadow',\n];\n\nfunction pickStyleKeys( treeToPickFrom ) {\n\tif ( ! treeToPickFrom ) {\n\t\treturn {};\n\t}\n\tconst entries = Object.entries( treeToPickFrom );\n\tconst pickedEntries = entries.filter( ( [ key ] ) =>\n\t\tSTYLE_KEYS.includes( key )\n\t);\n\t// clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it\n\tconst clonedEntries = pickedEntries.map( ( [ key, style ] ) => [\n\t\tkey,\n\t\tJSON.parse( JSON.stringify( style ) ),\n\t] );\n\treturn Object.fromEntries( clonedEntries );\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\t// Top-level.\n\tconst styles = pickStyleKeys( tree.styles );\n\tif ( styles ) {\n\t\tnodes.push( {\n\t\t\tstyles,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\tObject.entries( ELEMENTS ).forEach( ( [ name, selector ] ) => {\n\t\tif ( tree.styles?.elements?.[ name ] ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: tree.styles?.elements?.[ name ],\n\t\t\t\tselector,\n\t\t\t} );\n\t\t}\n\t} );\n\n\t// Iterate over blocks: they can have styles & elements.\n\tObject.entries( tree.styles?.blocks ?? {} ).forEach(\n\t\t( [ blockName, node ] ) => {\n\t\t\tconst blockStyles = pickStyleKeys( node );\n\n\t\t\tif ( node?.variations ) {\n\t\t\t\tconst variations = {};\n\t\t\t\tObject.keys( node.variations ).forEach( ( variation ) => {\n\t\t\t\t\tvariations[ variation ] = pickStyleKeys(\n\t\t\t\t\t\tnode.variations[ variation ]\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t\tblockStyles.variations = variations;\n\t\t\t}\n\t\t\tif ( blockStyles && blockSelectors?.[ blockName ]?.selector ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tduotoneSelector:\n\t\t\t\t\t\tblockSelectors[ blockName ].duotoneSelector,\n\t\t\t\t\tfallbackGapValue:\n\t\t\t\t\t\tblockSelectors[ blockName ].fallbackGapValue,\n\t\t\t\t\thasLayoutSupport:\n\t\t\t\t\t\tblockSelectors[ blockName ].hasLayoutSupport,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t\t\tstyles: blockStyles,\n\t\t\t\t\tfeatureSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].featureSelectors,\n\t\t\t\t\tstyleVariationSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].styleVariationSelectors,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tObject.entries( node?.elements ?? {} ).forEach(\n\t\t\t\t( [ elementName, value ] ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tvalue &&\n\t\t\t\t\t\tblockSelectors?.[ blockName ] &&\n\t\t\t\t\t\tELEMENTS[ elementName ]\n\t\t\t\t\t) {\n\t\t\t\t\t\tnodes.push( {\n\t\t\t\t\t\t\tstyles: value,\n\t\t\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector\n\t\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t\t.map( ( sel ) => {\n\t\t\t\t\t\t\t\t\tconst elementSelectors =\n\t\t\t\t\t\t\t\t\t\tELEMENTS[ elementName ].split( ',' );\n\t\t\t\t\t\t\t\t\treturn elementSelectors.map(\n\t\t\t\t\t\t\t\t\t\t( elementSelector ) =>\n\t\t\t\t\t\t\t\t\t\t\tsel + ' ' + elementSelector\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t.join( ',' ),\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom ) => {\n\t\tlet presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = getValueFromObjectPath( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tpresets = setImmutably( presets, path, value );\n\t\t\t}\n\t\t} );\n\t\treturn presets;\n\t};\n\n\t// Top-level.\n\tconst presets = pickPresets( tree.settings );\n\tconst custom = tree.settings?.custom;\n\tif ( Object.keys( presets ).length > 0 || custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\t// Blocks.\n\tObject.entries( tree.settings?.blocks ?? {} ).forEach(\n\t\t( [ blockName, node ] ) => {\n\t\t\tconst blockPresets = pickPresets( node );\n\t\t\tconst blockCustom = node.custom;\n\t\t\tif ( Object.keys( blockPresets ).length > 0 || blockCustom ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tpresets: blockPresets,\n\t\t\t\t\tcustom: blockCustom,\n\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\nexport const toCustomProperties = ( tree, blockSelectors ) => {\n\tconst settings = getNodesWithSettings( tree, blockSelectors );\n\tlet ruleset = '';\n\tsettings.forEach( ( { presets, custom, selector } ) => {\n\t\tconst declarations = getPresetsDeclarations( presets, tree?.settings );\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tdeclarations.push( ...customProps );\n\t\t}\n\n\t\tif ( declarations.length > 0 ) {\n\t\t\truleset += `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport const toStyles = (\n\ttree,\n\tblockSelectors,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tdisableLayoutStyles = false\n) => {\n\tconst nodesWithStyles = getNodesWithStyles( tree, blockSelectors );\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\tconst useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments;\n\tconst { contentSize, wideSize } = tree?.settings?.layout || {};\n\n\t/*\n\t * Reset default browser margin on the root body element.\n\t * This is set on the root selector **before** generating the ruleset\n\t * from the `theme.json`. This is to ensure that if the `theme.json` declares\n\t * `margin` in its `spacing` declaration for the `body` element then these\n\t * user-generated values take precedence in the CSS cascade.\n\t * @link https://github.com/WordPress/gutenberg/issues/36147.\n\t */\n\tlet ruleset = 'body {margin: 0;';\n\n\tif ( contentSize ) {\n\t\truleset += ` --wp--style--global--content-size: ${ contentSize };`;\n\t}\n\n\tif ( wideSize ) {\n\t\truleset += ` --wp--style--global--wide-size: ${ wideSize };`;\n\t}\n\n\tif ( useRootPaddingAlign ) {\n\t\t/*\n\t\t * These rules reproduce the ones from https://github.com/WordPress/gutenberg/blob/79103f124925d1f457f627e154f52a56228ed5ad/lib/class-wp-theme-json-gutenberg.php#L2508\n\t\t * almost exactly, but for the selectors that target block wrappers in the front end. This code only runs in the editor, so it doesn't need those selectors.\n\t\t */\n\t\truleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }\n\t\t\t.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }\n\t\t\t.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }\n\t\t\t.has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }\n\t\t\t.has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;\n\t}\n\n\truleset += '}';\n\n\tnodesWithStyles.forEach(\n\t\t( {\n\t\t\tselector,\n\t\t\tduotoneSelector,\n\t\t\tstyles,\n\t\t\tfallbackGapValue,\n\t\t\thasLayoutSupport,\n\t\t\tfeatureSelectors,\n\t\t\tstyleVariationSelectors,\n\t\t} ) => {\n\t\t\t// Process styles for block support features with custom feature level\n\t\t\t// CSS selectors set.\n\t\t\tif ( featureSelectors ) {\n\t\t\t\tconst featureDeclarations = getFeatureDeclarations(\n\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\tstyles\n\t\t\t\t);\n\n\t\t\t\tObject.entries( featureDeclarations ).forEach(\n\t\t\t\t\t( [ cssSelector, declarations ] ) => {\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst rules = declarations.join( ';' );\n\t\t\t\t\t\t\truleset += `${ cssSelector }{${ rules };}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif ( styleVariationSelectors ) {\n\t\t\t\tObject.entries( styleVariationSelectors ).forEach(\n\t\t\t\t\t( [ styleVariationName, styleVariationSelector ] ) => {\n\t\t\t\t\t\tconst styleVariations =\n\t\t\t\t\t\t\tstyles?.variations?.[ styleVariationName ];\n\t\t\t\t\t\tif ( styleVariations ) {\n\t\t\t\t\t\t\t// If the block uses any custom selectors for block support, add those first.\n\t\t\t\t\t\t\tif ( featureSelectors ) {\n\t\t\t\t\t\t\t\tconst featureDeclarations =\n\t\t\t\t\t\t\t\t\tgetFeatureDeclarations(\n\t\t\t\t\t\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\t\t\t\t\t\tstyleVariations\n\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tObject.entries( featureDeclarations ).forEach(\n\t\t\t\t\t\t\t\t\t( [ baseSelector, declarations ] ) => {\n\t\t\t\t\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\t\t\t\t\tconst cssSelector =\n\t\t\t\t\t\t\t\t\t\t\t\tconcatFeatureVariationSelectorString(\n\t\t\t\t\t\t\t\t\t\t\t\t\tbaseSelector,\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyleVariationSelector\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tconst rules =\n\t\t\t\t\t\t\t\t\t\t\t\tdeclarations.join( ';' );\n\t\t\t\t\t\t\t\t\t\t\truleset += `${ cssSelector }{${ rules };}`;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Otherwise add regular selectors.\n\t\t\t\t\t\t\tconst styleVariationDeclarations =\n\t\t\t\t\t\t\t\tgetStylesDeclarations(\n\t\t\t\t\t\t\t\t\tstyleVariations,\n\t\t\t\t\t\t\t\t\tstyleVariationSelector,\n\t\t\t\t\t\t\t\t\tuseRootPaddingAlign,\n\t\t\t\t\t\t\t\t\ttree\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif ( styleVariationDeclarations.length ) {\n\t\t\t\t\t\t\t\truleset += `${ styleVariationSelector }{${ styleVariationDeclarations.join(\n\t\t\t\t\t\t\t\t\t';'\n\t\t\t\t\t\t\t\t) };}`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Process duotone styles.\n\t\t\tif ( duotoneSelector ) {\n\t\t\t\tconst duotoneStyles = {};\n\t\t\t\tif ( styles?.filter ) {\n\t\t\t\t\tduotoneStyles.filter = styles.filter;\n\t\t\t\t\tdelete styles.filter;\n\t\t\t\t}\n\t\t\t\tconst duotoneDeclarations =\n\t\t\t\t\tgetStylesDeclarations( duotoneStyles );\n\t\t\t\tif ( duotoneDeclarations.length ) {\n\t\t\t\t\truleset += `${ duotoneSelector }{${ duotoneDeclarations.join(\n\t\t\t\t\t\t';'\n\t\t\t\t\t) };}`;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Process blockGap and layout styles.\n\t\t\tif (\n\t\t\t\t! disableLayoutStyles &&\n\t\t\t\t( ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport )\n\t\t\t) {\n\t\t\t\truleset += getLayoutStyles( {\n\t\t\t\t\tstyle: styles,\n\t\t\t\t\tselector,\n\t\t\t\t\thasBlockGapSupport,\n\t\t\t\t\thasFallbackGapSupport,\n\t\t\t\t\tfallbackGapValue,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t// Process the remaining block styles (they use either normal block class or __experimentalSelector).\n\t\t\tconst declarations = getStylesDeclarations(\n\t\t\t\tstyles,\n\t\t\t\tselector,\n\t\t\t\tuseRootPaddingAlign,\n\t\t\t\ttree\n\t\t\t);\n\t\t\tif ( declarations?.length ) {\n\t\t\t\truleset += `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t\t}\n\n\t\t\t// Check for pseudo selector in `styles` and handle separately.\n\t\t\tconst pseudoSelectorStyles = Object.entries( styles ).filter(\n\t\t\t\t( [ key ] ) => key.startsWith( ':' )\n\t\t\t);\n\n\t\t\tif ( pseudoSelectorStyles?.length ) {\n\t\t\t\tpseudoSelectorStyles.forEach(\n\t\t\t\t\t( [ pseudoKey, pseudoStyle ] ) => {\n\t\t\t\t\t\tconst pseudoDeclarations =\n\t\t\t\t\t\t\tgetStylesDeclarations( pseudoStyle );\n\n\t\t\t\t\t\tif ( ! pseudoDeclarations?.length ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// `selector` maybe provided in a form\n\t\t\t\t\t\t// where block level selectors have sub element\n\t\t\t\t\t\t// selectors appended to them as a comma separated\n\t\t\t\t\t\t// string.\n\t\t\t\t\t\t// e.g. `h1 a,h2 a,h3 a,h4 a,h5 a,h6 a`;\n\t\t\t\t\t\t// Split and append pseudo selector to create\n\t\t\t\t\t\t// the proper rules to target the elements.\n\t\t\t\t\t\tconst _selector = selector\n\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t.map( ( sel ) => sel + pseudoKey )\n\t\t\t\t\t\t\t.join( ',' );\n\n\t\t\t\t\t\tconst pseudoRule = `${ _selector }{${ pseudoDeclarations.join(\n\t\t\t\t\t\t\t';'\n\t\t\t\t\t\t) };}`;\n\n\t\t\t\t\t\truleset += pseudoRule;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t);\n\n\t/* Add alignment / layout styles */\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';\n\n\tif ( hasBlockGapSupport ) {\n\t\t// Use fallback of `0.5em` just in case, however if there is blockGap support, there should nearly always be a real value.\n\t\tconst gapValue =\n\t\t\tgetGapCSSValue( tree?.styles?.spacing?.blockGap ) || '0.5em';\n\t\truleset =\n\t\t\truleset +\n\t\t\t`:where(.wp-site-blocks) > * { margin-block-start: ${ gapValue }; margin-block-end: 0; }`;\n\t\truleset =\n\t\t\truleset +\n\t\t\t':where(.wp-site-blocks) > :first-child:first-child { margin-block-start: 0; }';\n\t\truleset =\n\t\t\truleset +\n\t\t\t':where(.wp-site-blocks) > :last-child:last-child { margin-block-end: 0; }';\n\t}\n\n\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\tif ( ROOT_BLOCK_SELECTOR === selector ) {\n\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\tselector = '';\n\t\t}\n\n\t\tconst classes = getPresetsClasses( selector, presets );\n\t\tif ( classes.length > 0 ) {\n\t\t\truleset += classes;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport function toSvgFilters( tree, blockSelectors ) {\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\treturn nodesWithSettings.flatMap( ( { presets } ) => {\n\t\treturn getPresetsSvgFilters( presets );\n\t} );\n}\n\nconst getSelectorsConfig = ( blockType, rootSelector ) => {\n\tif (\n\t\tblockType?.selectors &&\n\t\tObject.keys( blockType.selectors ).length > 0\n\t) {\n\t\treturn blockType.selectors;\n\t}\n\n\tconst config = { root: rootSelector };\n\tObject.entries( BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS ).forEach(\n\t\t( [ featureKey, featureName ] ) => {\n\t\t\tconst featureSelector = getBlockCSSSelector(\n\t\t\t\tblockType,\n\t\t\t\tfeatureKey\n\t\t\t);\n\n\t\t\tif ( featureSelector ) {\n\t\t\t\tconfig[ featureName ] = featureSelector;\n\t\t\t}\n\t\t}\n\t);\n\n\treturn config;\n};\n\nexport const getBlockSelectors = ( blockTypes, getBlockStyles ) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector = getBlockCSSSelector( blockType );\n\t\tlet duotoneSelector = getBlockCSSSelector(\n\t\t\tblockType,\n\t\t\t'filter.duotone'\n\t\t);\n\n\t\t// Keep backwards compatibility for support.color.__experimentalDuotone.\n\t\tif ( ! duotoneSelector ) {\n\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tduotoneSelector =\n\t\t\t\tduotoneSupport && scopeSelector( rootSelector, duotoneSupport );\n\t\t}\n\n\t\tconst hasLayoutSupport =\n\t\t\t!! blockType?.supports?.layout ||\n\t\t\t!! blockType?.supports?.__experimentalLayout;\n\t\tconst fallbackGapValue =\n\t\t\tblockType?.supports?.spacing?.blockGap?.__experimentalDefault;\n\n\t\tconst blockStyleVariations = getBlockStyles( name );\n\t\tconst styleVariationSelectors = {};\n\t\tif ( blockStyleVariations?.length ) {\n\t\t\tblockStyleVariations.forEach( ( variation ) => {\n\t\t\t\tconst styleVariationSelector = `.is-style-${ variation.name }${ selector }`;\n\t\t\t\tstyleVariationSelectors[ variation.name ] =\n\t\t\t\t\tstyleVariationSelector;\n\t\t\t} );\n\t\t}\n\t\t// For each block support feature add any custom selectors.\n\t\tconst featureSelectors = getSelectorsConfig( blockType, selector );\n\n\t\tresult[ name ] = {\n\t\t\tduotoneSelector,\n\t\t\tfallbackGapValue,\n\t\t\tfeatureSelectors: Object.keys( featureSelectors ).length\n\t\t\t\t? featureSelectors\n\t\t\t\t: undefined,\n\t\t\thasLayoutSupport,\n\t\t\tname,\n\t\t\tselector,\n\t\t\tstyleVariationSelectors: Object.keys( styleVariationSelectors )\n\t\t\t\t.length\n\t\t\t\t? styleVariationSelectors\n\t\t\t\t: undefined,\n\t\t};\n\t} );\n\n\treturn result;\n};\n\n/**\n * If there is a separator block whose color is defined in theme.json via background,\n * update the separator color to the same value by using border color.\n *\n * @param {Object} config Theme.json configuration file object.\n * @return {Object} configTheme.json configuration file object updated.\n */\nfunction updateConfigWithSeparator( config ) {\n\tconst needsSeparatorStyleUpdate =\n\t\tconfig.styles?.blocks?.[ 'core/separator' ] &&\n\t\tconfig.styles?.blocks?.[ 'core/separator' ].color?.background &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].color?.text &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].border?.color;\n\tif ( needsSeparatorStyleUpdate ) {\n\t\treturn {\n\t\t\t...config,\n\t\t\tstyles: {\n\t\t\t\t...config.styles,\n\t\t\t\tblocks: {\n\t\t\t\t\t...config.styles.blocks,\n\t\t\t\t\t'core/separator': {\n\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ],\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ].color,\n\t\t\t\t\t\t\ttext: config.styles?.blocks[ 'core/separator' ]\n\t\t\t\t\t\t\t\t.color.background,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\treturn config;\n}\n\nconst processCSSNesting = ( css, blockSelector ) => {\n\tlet processedCSS = '';\n\n\t// Split CSS nested rules.\n\tconst parts = css.split( '&' );\n\tparts.forEach( ( part ) => {\n\t\tprocessedCSS += ! part.includes( '{' )\n\t\t\t? blockSelector + '{' + part + '}' // If the part doesn't contain braces, it applies to the root level.\n\t\t\t: blockSelector + part; // Prepend the selector, which effectively replaces the \"&\" character.\n\t} );\n\treturn processedCSS;\n};\n\n/**\n * Returns the global styles output using a global styles configuration.\n * If wishing to generate global styles and settings based on the\n * global styles config loaded in the editor context, use `useGlobalStylesOutput()`.\n * The use case for a custom config is to generate bespoke styles\n * and settings for previews, or other out-of-editor experiences.\n *\n * @param {Object} mergedConfig Global styles configuration.\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {\n\tconst [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGap !== null;\n\tconst hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.\n\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn !! getSettings().disableLayoutStyles;\n\t} );\n\n\tconst getBlockStyles = useSelect( ( select ) => {\n\t\treturn select( blocksStore ).getBlockStyles;\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn [];\n\t\t}\n\t\tmergedConfig = updateConfigWithSeparator( mergedConfig );\n\n\t\tconst blockSelectors = getBlockSelectors(\n\t\t\tgetBlockTypes(),\n\t\t\tgetBlockStyles\n\t\t);\n\n\t\tconst customProperties = toCustomProperties(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors\n\t\t);\n\t\tconst globalStyles = toStyles(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors,\n\t\t\thasBlockGapSupport,\n\t\t\thasFallbackGapSupport,\n\t\t\tdisableLayoutStyles\n\t\t);\n\t\tconst svgs = toSvgFilters( mergedConfig, blockSelectors );\n\n\t\tconst styles = [\n\t\t\t{\n\t\t\t\tcss: customProperties,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcss: globalStyles,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t// Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.\n\t\t\t{\n\t\t\t\tcss: mergedConfig.styles.css ?? '',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tassets: svgs,\n\t\t\t\t__unstableType: 'svg',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t];\n\n\t\t// Loop through the blocks to check if there are custom CSS values.\n\t\t// If there are, get the block selector and push the selector together with\n\t\t// the CSS value to the 'stylesheets' array.\n\t\tgetBlockTypes().forEach( ( blockType ) => {\n\t\t\tif ( mergedConfig.styles.blocks[ blockType.name ]?.css ) {\n\t\t\t\tconst selector = blockSelectors[ blockType.name ].selector;\n\t\t\t\tstyles.push( {\n\t\t\t\t\tcss: processCSSNesting(\n\t\t\t\t\t\tmergedConfig.styles.blocks[ blockType.name ]?.css,\n\t\t\t\t\t\tselector\n\t\t\t\t\t),\n\t\t\t\t\tisGlobalStyles: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\treturn [ styles, mergedConfig.settings ];\n\t}, [\n\t\thasBlockGapSupport,\n\t\thasFallbackGapSupport,\n\t\tmergedConfig,\n\t\tdisableLayoutStyles,\n\t] );\n}\n\n/**\n * Returns the global styles output based on the current state of global styles config loaded in the editor context.\n *\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutput() {\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\treturn useGlobalStylesOutputWithConfig( mergedConfig );\n}\n"]}
@@ -1,13 +1,13 @@
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
  * Internal dependencies
8
7
  */
9
8
 
10
9
  import { getTypographyFontSizeValue, getFluidTypographyOptionsFromSettings } from './typography-utils';
10
+ import { getValueFromObjectPath } from '../../utils/object';
11
11
  /* Supporting data. */
12
12
 
13
13
  export const ROOT_BLOCK_NAME = 'root';
@@ -132,7 +132,7 @@ export const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
132
132
 
133
133
  function findInPresetsBy(features, blockName, presetPath, presetProperty, presetValueValue) {
134
134
  // Block presets take priority above root level presets.
135
- const orderedPresetsByOrigin = [get(features, ['blocks', blockName, ...presetPath]), get(features, presetPath)];
135
+ const orderedPresetsByOrigin = [getValueFromObjectPath(features, ['blocks', blockName, ...presetPath]), getValueFromObjectPath(features, presetPath)];
136
136
 
137
137
  for (const presetByOrigin of orderedPresetsByOrigin) {
138
138
  if (presetByOrigin) {
@@ -215,9 +215,9 @@ function getValueFromPresetVariable(features, blockName, variable, [presetType,
215
215
  }
216
216
 
217
217
  function getValueFromCustomVariable(features, blockName, variable, path) {
218
- var _get;
218
+ var _getValueFromObjectPa;
219
219
 
220
- const result = (_get = get(features.settings, ['blocks', blockName, 'custom', ...path])) !== null && _get !== void 0 ? _get : get(features.settings, ['custom', ...path]);
220
+ const result = (_getValueFromObjectPa = getValueFromObjectPath(features.settings, ['blocks', blockName, 'custom', ...path])) !== null && _getValueFromObjectPa !== void 0 ? _getValueFromObjectPa : getValueFromObjectPath(features.settings, ['custom', ...path]);
221
221
 
222
222
  if (!result) {
223
223
  return variable;
@@ -240,7 +240,7 @@ export function getValueFromVariable(features, blockName, variable) {
240
240
  if (!variable || typeof variable !== 'string') {
241
241
  if (variable?.ref && typeof variable?.ref === 'string') {
242
242
  const refPath = variable.ref.split('.');
243
- variable = get(features, refPath); // Presence of another ref indicates a reference to another dynamic value.
243
+ variable = getValueFromObjectPath(features, refPath); // Presence of another ref indicates a reference to another dynamic value.
244
244
  // Pointing to another dynamic value is not supported.
245
245
 
246
246
  if (!variable || !!variable?.ref) {
@@ -328,6 +328,6 @@ export function areGlobalStyleConfigsEqual(original, variation) {
328
328
  return original === variation;
329
329
  }
330
330
 
331
- return fastDeepEqual(original?.styles, variation?.styles) && fastDeepEqual(original?.settings, variation?.settings);
331
+ return fastDeepEqual(original?.styles, variation?.styles) && fastDeepEqual(original?.settings, variation?.settings) && fastDeepEqual(original?.behaviors, variation?.behaviors);
332
332
  }
333
333
  //# sourceMappingURL=utils.js.map