@wordpress/block-editor 11.5.0 → 11.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (345) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +4 -0
  3. package/build/components/block-list/block-html.js +1 -3
  4. package/build/components/block-list/block-html.js.map +1 -1
  5. package/build/components/block-list/block-invalid-warning.js +63 -80
  6. package/build/components/block-list/block-invalid-warning.js.map +1 -1
  7. package/build/components/block-preview/auto.js +6 -23
  8. package/build/components/block-preview/auto.js.map +1 -1
  9. package/build/components/block-settings-menu-controls/index.js +1 -1
  10. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  11. package/build/components/block-switcher/block-transformations-menu.native.js +1 -0
  12. package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  13. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
  14. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  15. package/build/components/editor-styles/index.js +20 -2
  16. package/build/components/editor-styles/index.js.map +1 -1
  17. package/build/components/global-styles/border-panel.js +306 -0
  18. package/build/components/global-styles/border-panel.js.map +1 -0
  19. package/build/components/global-styles/color-panel.js +583 -0
  20. package/build/components/global-styles/color-panel.js.map +1 -0
  21. package/build/components/global-styles/dimensions-panel.js +8 -30
  22. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  23. package/build/components/global-styles/get-block-css-selector.js +129 -0
  24. package/build/components/global-styles/get-block-css-selector.js.map +1 -0
  25. package/build/components/global-styles/hooks.js +109 -3
  26. package/build/components/global-styles/hooks.js.map +1 -1
  27. package/build/components/global-styles/index.js +36 -0
  28. package/build/components/global-styles/index.js.map +1 -1
  29. package/build/components/global-styles/typography-panel.js +66 -45
  30. package/build/components/global-styles/typography-panel.js.map +1 -1
  31. package/build/components/global-styles/use-global-styles-output.js +180 -99
  32. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  33. package/build/components/global-styles/utils.js +2 -1
  34. package/build/components/global-styles/utils.js.map +1 -1
  35. package/build/components/image-size-control/index.js +8 -5
  36. package/build/components/image-size-control/index.js.map +1 -1
  37. package/build/components/inserter/index.js +29 -17
  38. package/build/components/inserter/index.js.map +1 -1
  39. package/build/components/inserter/menu.js +1 -1
  40. package/build/components/inserter/menu.js.map +1 -1
  41. package/build/components/inserter/quick-inserter.js +4 -2
  42. package/build/components/inserter/quick-inserter.js.map +1 -1
  43. package/build/components/inserter/search-results.js +10 -3
  44. package/build/components/inserter/search-results.js.map +1 -1
  45. package/build/components/inserter/tabs.js +1 -1
  46. package/build/components/inserter/tabs.js.map +1 -1
  47. package/build/components/inspector-controls-tabs/position-controls-panel.js +43 -7
  48. package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  49. package/build/components/line-height-control/index.js +15 -1
  50. package/build/components/line-height-control/index.js.map +1 -1
  51. package/build/components/link-control/index.js +1 -1
  52. package/build/components/link-control/index.js.map +1 -1
  53. package/build/components/link-control/search-item.js +5 -2
  54. package/build/components/link-control/search-item.js.map +1 -1
  55. package/build/components/list-view/appender.js +105 -0
  56. package/build/components/list-view/appender.js.map +1 -0
  57. package/build/components/list-view/block.js +5 -5
  58. package/build/components/list-view/block.js.map +1 -1
  59. package/build/components/list-view/branch.js +25 -5
  60. package/build/components/list-view/branch.js.map +1 -1
  61. package/build/components/list-view/index.js +37 -13
  62. package/build/components/list-view/index.js.map +1 -1
  63. package/build/components/list-view/use-block-selection.js +1 -2
  64. package/build/components/list-view/use-block-selection.js.map +1 -1
  65. package/build/components/media-replace-flow/index.js +13 -4
  66. package/build/components/media-replace-flow/index.js.map +1 -1
  67. package/build/components/off-canvas-editor/appender.js +28 -3
  68. package/build/components/off-canvas-editor/appender.js.map +1 -1
  69. package/build/components/off-canvas-editor/branch.js +5 -3
  70. package/build/components/off-canvas-editor/branch.js.map +1 -1
  71. package/build/components/off-canvas-editor/index.js +9 -7
  72. package/build/components/off-canvas-editor/index.js.map +1 -1
  73. package/build/components/off-canvas-editor/link-ui.js +0 -1
  74. package/build/components/off-canvas-editor/link-ui.js.map +1 -1
  75. package/build/components/provider/use-block-sync.js +17 -3
  76. package/build/components/provider/use-block-sync.js.map +1 -1
  77. package/build/components/rich-text/format-edit.js +2 -30
  78. package/build/components/rich-text/format-edit.js.map +1 -1
  79. package/build/components/rich-text/format-toolbar-container.js +0 -3
  80. package/build/components/rich-text/format-toolbar-container.js.map +1 -1
  81. package/build/components/writing-flow/use-input.js +4 -8
  82. package/build/components/writing-flow/use-input.js.map +1 -1
  83. package/build/hooks/border.js +90 -240
  84. package/build/hooks/border.js.map +1 -1
  85. package/build/hooks/color.js +92 -229
  86. package/build/hooks/color.js.map +1 -1
  87. package/build/hooks/content-lock-ui.js +4 -2
  88. package/build/hooks/content-lock-ui.js.map +1 -1
  89. package/build/hooks/{color-panel.js → contrast-checker.js} +11 -49
  90. package/build/hooks/contrast-checker.js.map +1 -0
  91. package/build/hooks/custom-class-name.js +4 -4
  92. package/build/hooks/custom-class-name.js.map +1 -1
  93. package/build/hooks/custom-class-name.native.js +3 -4
  94. package/build/hooks/custom-class-name.native.js.map +1 -1
  95. package/build/hooks/dimensions.js +0 -1
  96. package/build/hooks/dimensions.js.map +1 -1
  97. package/build/hooks/duotone.js +3 -1
  98. package/build/hooks/duotone.js.map +1 -1
  99. package/build/hooks/layout.js +19 -22
  100. package/build/hooks/layout.js.map +1 -1
  101. package/build/hooks/position.js +2 -2
  102. package/build/hooks/position.js.map +1 -1
  103. package/build/hooks/style.js +23 -26
  104. package/build/hooks/style.js.map +1 -1
  105. package/build/hooks/supports.js +7 -1
  106. package/build/hooks/supports.js.map +1 -1
  107. package/build/hooks/typography.js +2 -2
  108. package/build/hooks/typography.js.map +1 -1
  109. package/build/hooks/utils.js +50 -75
  110. package/build/hooks/utils.js.map +1 -1
  111. package/build/layouts/constrained.js +6 -2
  112. package/build/layouts/constrained.js.map +1 -1
  113. package/build/layouts/grid.js +165 -0
  114. package/build/layouts/grid.js.map +1 -0
  115. package/build/layouts/index.js +3 -1
  116. package/build/layouts/index.js.map +1 -1
  117. package/build/private-apis.js +7 -1
  118. package/build/private-apis.js.map +1 -1
  119. package/build/store/actions.js +10 -8
  120. package/build/store/actions.js.map +1 -1
  121. package/build/store/selectors.js +19 -3
  122. package/build/store/selectors.js.map +1 -1
  123. package/build/utils/object.js +76 -0
  124. package/build/utils/object.js.map +1 -0
  125. package/build/utils/parse-css-unit-to-px.js +15 -9
  126. package/build/utils/parse-css-unit-to-px.js.map +1 -1
  127. package/build-module/components/block-list/block-html.js +1 -3
  128. package/build-module/components/block-list/block-html.js.map +1 -1
  129. package/build-module/components/block-list/block-invalid-warning.js +66 -78
  130. package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
  131. package/build-module/components/block-preview/auto.js +6 -22
  132. package/build-module/components/block-preview/auto.js.map +1 -1
  133. package/build-module/components/block-settings-menu-controls/index.js +1 -1
  134. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  135. package/build-module/components/block-switcher/block-transformations-menu.native.js +1 -0
  136. package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
  137. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +6 -3
  138. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  139. package/build-module/components/editor-styles/index.js +19 -2
  140. package/build-module/components/editor-styles/index.js.map +1 -1
  141. package/build-module/components/global-styles/border-panel.js +291 -0
  142. package/build-module/components/global-styles/border-panel.js.map +1 -0
  143. package/build-module/components/global-styles/color-panel.js +554 -0
  144. package/build-module/components/global-styles/color-panel.js.map +1 -0
  145. package/build-module/components/global-styles/dimensions-panel.js +7 -30
  146. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  147. package/build-module/components/global-styles/get-block-css-selector.js +120 -0
  148. package/build-module/components/global-styles/get-block-css-selector.js.map +1 -0
  149. package/build-module/components/global-styles/hooks.js +104 -3
  150. package/build-module/components/global-styles/hooks.js.map +1 -1
  151. package/build-module/components/global-styles/index.js +3 -0
  152. package/build-module/components/global-styles/index.js.map +1 -1
  153. package/build-module/components/global-styles/typography-panel.js +65 -46
  154. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  155. package/build-module/components/global-styles/use-global-styles-output.js +181 -100
  156. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  157. package/build-module/components/global-styles/utils.js +2 -1
  158. package/build-module/components/global-styles/utils.js.map +1 -1
  159. package/build-module/components/image-size-control/index.js +8 -5
  160. package/build-module/components/image-size-control/index.js.map +1 -1
  161. package/build-module/components/inserter/index.js +28 -16
  162. package/build-module/components/inserter/index.js.map +1 -1
  163. package/build-module/components/inserter/menu.js +1 -1
  164. package/build-module/components/inserter/menu.js.map +1 -1
  165. package/build-module/components/inserter/quick-inserter.js +4 -2
  166. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  167. package/build-module/components/inserter/search-results.js +10 -3
  168. package/build-module/components/inserter/search-results.js.map +1 -1
  169. package/build-module/components/inserter/tabs.js +1 -1
  170. package/build-module/components/inserter/tabs.js.map +1 -1
  171. package/build-module/components/inspector-controls-tabs/position-controls-panel.js +42 -7
  172. package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  173. package/build-module/components/line-height-control/index.js +15 -1
  174. package/build-module/components/line-height-control/index.js.map +1 -1
  175. package/build-module/components/link-control/index.js +1 -1
  176. package/build-module/components/link-control/index.js.map +1 -1
  177. package/build-module/components/link-control/search-item.js +4 -2
  178. package/build-module/components/link-control/search-item.js.map +1 -1
  179. package/build-module/components/list-view/appender.js +88 -0
  180. package/build-module/components/list-view/appender.js.map +1 -0
  181. package/build-module/components/list-view/block.js +5 -4
  182. package/build-module/components/list-view/block.js.map +1 -1
  183. package/build-module/components/list-view/branch.js +22 -5
  184. package/build-module/components/list-view/branch.js.map +1 -1
  185. package/build-module/components/list-view/index.js +32 -12
  186. package/build-module/components/list-view/index.js.map +1 -1
  187. package/build-module/components/list-view/use-block-selection.js +1 -2
  188. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  189. package/build-module/components/media-replace-flow/index.js +12 -4
  190. package/build-module/components/media-replace-flow/index.js.map +1 -1
  191. package/build-module/components/off-canvas-editor/appender.js +28 -4
  192. package/build-module/components/off-canvas-editor/appender.js.map +1 -1
  193. package/build-module/components/off-canvas-editor/branch.js +5 -3
  194. package/build-module/components/off-canvas-editor/branch.js.map +1 -1
  195. package/build-module/components/off-canvas-editor/index.js +9 -7
  196. package/build-module/components/off-canvas-editor/index.js.map +1 -1
  197. package/build-module/components/off-canvas-editor/link-ui.js +0 -1
  198. package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
  199. package/build-module/components/provider/use-block-sync.js +17 -3
  200. package/build-module/components/provider/use-block-sync.js.map +1 -1
  201. package/build-module/components/rich-text/format-edit.js +3 -31
  202. package/build-module/components/rich-text/format-edit.js.map +1 -1
  203. package/build-module/components/rich-text/format-toolbar-container.js +0 -3
  204. package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
  205. package/build-module/components/writing-flow/use-input.js +4 -8
  206. package/build-module/components/writing-flow/use-input.js.map +1 -1
  207. package/build-module/hooks/border.js +92 -240
  208. package/build-module/hooks/border.js.map +1 -1
  209. package/build-module/hooks/color.js +90 -232
  210. package/build-module/hooks/color.js.map +1 -1
  211. package/build-module/hooks/content-lock-ui.js +4 -2
  212. package/build-module/hooks/content-lock-ui.js.map +1 -1
  213. package/build-module/hooks/{color-panel.js → contrast-checker.js} +10 -44
  214. package/build-module/hooks/contrast-checker.js.map +1 -0
  215. package/build-module/hooks/custom-class-name.js +4 -4
  216. package/build-module/hooks/custom-class-name.js.map +1 -1
  217. package/build-module/hooks/custom-class-name.native.js +3 -4
  218. package/build-module/hooks/custom-class-name.native.js.map +1 -1
  219. package/build-module/hooks/dimensions.js +0 -1
  220. package/build-module/hooks/dimensions.js.map +1 -1
  221. package/build-module/hooks/duotone.js +4 -2
  222. package/build-module/hooks/duotone.js.map +1 -1
  223. package/build-module/hooks/layout.js +19 -22
  224. package/build-module/hooks/layout.js.map +1 -1
  225. package/build-module/hooks/position.js +3 -3
  226. package/build-module/hooks/position.js.map +1 -1
  227. package/build-module/hooks/style.js +23 -26
  228. package/build-module/hooks/style.js.map +1 -1
  229. package/build-module/hooks/supports.js +7 -1
  230. package/build-module/hooks/supports.js.map +1 -1
  231. package/build-module/hooks/typography.js +2 -2
  232. package/build-module/hooks/typography.js.map +1 -1
  233. package/build-module/hooks/utils.js +48 -72
  234. package/build-module/hooks/utils.js.map +1 -1
  235. package/build-module/layouts/constrained.js +6 -2
  236. package/build-module/layouts/constrained.js.map +1 -1
  237. package/build-module/layouts/grid.js +151 -0
  238. package/build-module/layouts/grid.js.map +1 -0
  239. package/build-module/layouts/index.js +2 -1
  240. package/build-module/layouts/index.js.map +1 -1
  241. package/build-module/private-apis.js +5 -1
  242. package/build-module/private-apis.js.map +1 -1
  243. package/build-module/store/actions.js +10 -8
  244. package/build-module/store/actions.js.map +1 -1
  245. package/build-module/store/selectors.js +17 -3
  246. package/build-module/store/selectors.js.map +1 -1
  247. package/build-module/utils/object.js +69 -0
  248. package/build-module/utils/object.js.map +1 -0
  249. package/build-module/utils/parse-css-unit-to-px.js +15 -9
  250. package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
  251. package/build-style/style-rtl.css +32 -12
  252. package/build-style/style.css +32 -12
  253. package/package.json +31 -31
  254. package/src/components/block-draggable/content.scss +1 -1
  255. package/src/components/block-inspector/style.scss +3 -0
  256. package/src/components/block-list/block-html.js +1 -1
  257. package/src/components/block-list/block-invalid-warning.js +72 -64
  258. package/src/components/block-mover/test/__snapshots__/index.native.js.snap +20 -2
  259. package/src/components/block-preview/auto.js +2 -17
  260. package/src/components/block-preview/test/index.js +0 -2
  261. package/src/components/block-settings-menu-controls/index.js +2 -1
  262. package/src/components/block-styles/style.scss +2 -2
  263. package/src/components/block-switcher/block-transformations-menu.native.js +1 -0
  264. package/src/components/color-palette/test/__snapshots__/control.js.snap +16 -14
  265. package/src/components/colors-gradients/style.scss +8 -8
  266. package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +48 -38
  267. package/src/components/editor-styles/index.js +29 -1
  268. package/src/components/global-styles/border-panel.js +285 -0
  269. package/src/components/global-styles/color-panel.js +706 -0
  270. package/src/components/global-styles/dimensions-panel.js +13 -42
  271. package/src/components/global-styles/get-block-css-selector.js +129 -0
  272. package/src/components/global-styles/hooks.js +154 -1
  273. package/src/components/global-styles/index.js +3 -0
  274. package/src/components/global-styles/test/use-global-styles-output.js +31 -2
  275. package/src/components/global-styles/typography-panel.js +67 -45
  276. package/src/components/global-styles/use-global-styles-output.js +176 -93
  277. package/src/components/global-styles/utils.js +3 -0
  278. package/src/components/image-size-control/index.js +4 -3
  279. package/src/components/image-size-control/test/index.js +2 -2
  280. package/src/components/inner-blocks/README.md +1 -1
  281. package/src/components/inserter/index.js +30 -11
  282. package/src/components/inserter/menu.js +0 -1
  283. package/src/components/inserter/quick-inserter.js +2 -0
  284. package/src/components/inserter/search-results.js +7 -1
  285. package/src/components/inserter/style.scss +3 -0
  286. package/src/components/inserter/tabs.js +1 -9
  287. package/src/components/inspector-controls-tabs/position-controls-panel.js +40 -9
  288. package/src/components/line-height-control/index.js +10 -1
  289. package/src/components/link-control/index.js +1 -1
  290. package/src/components/link-control/search-item.js +3 -1
  291. package/src/components/link-control/style.scss +0 -4
  292. package/src/components/link-control/test/index.js +0 -2
  293. package/src/components/list-view/appender.js +101 -0
  294. package/src/components/list-view/block.js +5 -4
  295. package/src/components/list-view/branch.js +30 -1
  296. package/src/components/list-view/index.js +43 -10
  297. package/src/components/list-view/style.scss +19 -0
  298. package/src/components/list-view/use-block-selection.js +0 -2
  299. package/src/components/media-replace-flow/index.js +36 -24
  300. package/src/components/media-replace-flow/style.scss +5 -2
  301. package/src/components/off-canvas-editor/appender.js +31 -5
  302. package/src/components/off-canvas-editor/branch.js +3 -1
  303. package/src/components/off-canvas-editor/index.js +7 -7
  304. package/src/components/off-canvas-editor/link-ui.js +0 -1
  305. package/src/components/provider/use-block-sync.js +21 -4
  306. package/src/components/rich-text/format-edit.js +2 -32
  307. package/src/components/rich-text/format-toolbar-container.js +1 -7
  308. package/src/components/url-popover/test/index.js +0 -2
  309. package/src/components/writing-flow/use-input.js +4 -5
  310. package/src/hooks/border.js +93 -225
  311. package/src/hooks/color.js +120 -296
  312. package/src/hooks/content-lock-ui.js +6 -2
  313. package/src/hooks/{color-panel.js → contrast-checker.js} +10 -46
  314. package/src/hooks/custom-class-name.js +4 -4
  315. package/src/hooks/custom-class-name.native.js +3 -4
  316. package/src/hooks/dimensions.js +0 -1
  317. package/src/hooks/duotone.js +8 -5
  318. package/src/hooks/layout.js +19 -16
  319. package/src/hooks/position.js +3 -3
  320. package/src/hooks/style.js +29 -28
  321. package/src/hooks/supports.js +6 -0
  322. package/src/hooks/test/style.js +2 -1
  323. package/src/hooks/test/use-typography-props.js +2 -0
  324. package/src/hooks/test/utils.js +0 -104
  325. package/src/hooks/typography.js +2 -1
  326. package/src/hooks/utils.js +63 -70
  327. package/src/layouts/constrained.js +23 -17
  328. package/src/layouts/grid.js +172 -0
  329. package/src/layouts/index.js +2 -1
  330. package/src/layouts/test/grid.js +21 -0
  331. package/src/private-apis.js +4 -0
  332. package/src/store/actions.js +10 -8
  333. package/src/store/selectors.js +20 -3
  334. package/src/utils/object.js +69 -0
  335. package/src/utils/parse-css-unit-to-px.js +14 -9
  336. package/src/utils/test/object.js +107 -0
  337. package/src/utils/test/parse-css-unit-to-px.js +1 -2
  338. package/tsconfig.tsbuildinfo +1 -1
  339. package/build/hooks/border-radius.js +0 -100
  340. package/build/hooks/border-radius.js.map +0 -1
  341. package/build/hooks/color-panel.js.map +0 -1
  342. package/build-module/hooks/border-radius.js +0 -84
  343. package/build-module/hooks/border-radius.js.map +0 -1
  344. package/build-module/hooks/color-panel.js.map +0 -1
  345. package/src/hooks/border-radius.js +0 -70
@@ -23,6 +23,8 @@ var _styleEngine = require("@wordpress/style-engine");
23
23
 
24
24
  var _utils = require("./utils");
25
25
 
26
+ var _getBlockCssSelector = require("./get-block-css-selector");
27
+
26
28
  var _typographyUtils = require("./typography-utils");
27
29
 
28
30
  var _context = require("./context");
@@ -107,13 +109,14 @@ function getPresetsDeclarations() {
107
109
  /**
108
110
  * Transform given preset tree into a set of preset class declarations.
109
111
  *
110
- * @param {string} blockSelector
111
- * @param {Object} blockPresets
112
+ * @param {?string} blockSelector
113
+ * @param {Object} blockPresets
112
114
  * @return {string} CSS declarations for the preset classes.
113
115
  */
114
116
 
115
117
 
116
- function getPresetsClasses(blockSelector) {
118
+ function getPresetsClasses() {
119
+ let blockSelector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '*';
117
120
  let blockPresets = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
118
121
  return _utils.PRESET_METADATA.reduce((declarations, _ref2) => {
119
122
  let {
@@ -156,10 +159,10 @@ function getPresetsSvgFilters() {
156
159
  return _utils.PRESET_METADATA.filter( // Duotone are the only type of filters for now.
157
160
  metadata => metadata.path.at(-1) === 'duotone').flatMap(metadata => {
158
161
  const presetByOrigin = (0, _lodash.get)(blockPresets, metadata.path, {});
159
- return ['default', 'theme'].filter(origin => presetByOrigin[origin]).flatMap(origin => presetByOrigin[origin].map(preset => (0, _element.createElement)(_components.PresetDuotoneFilter, {
162
+ return ['default', 'theme'].filter(origin => presetByOrigin[origin]).flatMap(origin => presetByOrigin[origin].map(preset => (0, _element.renderToString)((0, _element.createElement)(_components.PresetDuotoneFilter, {
160
163
  preset: preset,
161
164
  key: preset.slug
162
- })));
165
+ })))).join('');
163
166
  });
164
167
  }
165
168
 
@@ -200,6 +203,76 @@ function concatFeatureVariationSelectorString(featureSelector, styleVariationSel
200
203
  });
201
204
  return combinedSelectors.join(', ');
202
205
  }
206
+ /**
207
+ * Generate style declarations for a block's custom feature and subfeature
208
+ * selectors.
209
+ *
210
+ * NOTE: The passed `styles` object will be mutated by this function.
211
+ *
212
+ * @param {Object} selectors Custom selectors object for a block.
213
+ * @param {Object} styles A block's styles object.
214
+ *
215
+ * @return {Object} Style declarations.
216
+ */
217
+
218
+
219
+ const getFeatureDeclarations = (selectors, styles) => {
220
+ const declarations = {};
221
+ Object.entries(selectors).forEach(_ref5 => {
222
+ let [feature, selector] = _ref5;
223
+
224
+ // We're only processing features/subfeatures that have styles.
225
+ if (feature === 'root' || !(styles !== null && styles !== void 0 && styles[feature])) {
226
+ return;
227
+ }
228
+
229
+ const isShorthand = typeof selector === 'string'; // If we have a selector object instead of shorthand process it.
230
+
231
+ if (!isShorthand) {
232
+ Object.entries(selector).forEach(_ref6 => {
233
+ let [subfeature, subfeatureSelector] = _ref6;
234
+
235
+ // Don't process root feature selector yet or any
236
+ // subfeature that doesn't have a style.
237
+ if (subfeature === 'root' || !(styles !== null && styles !== void 0 && styles[feature][subfeature])) {
238
+ return;
239
+ } // Create a temporary styles object and build
240
+ // declarations for subfeature.
241
+
242
+
243
+ const subfeatureStyles = {
244
+ [feature]: {
245
+ [subfeature]: styles[feature][subfeature]
246
+ }
247
+ };
248
+ const newDeclarations = getStylesDeclarations(subfeatureStyles); // Merge new declarations in with any others that
249
+ // share the same selector.
250
+
251
+ declarations[subfeatureSelector] = [...(declarations[subfeatureSelector] || []), ...newDeclarations]; // Remove the subfeature's style now it will be
252
+ // included under its own selector not the block's.
253
+
254
+ delete styles[feature][subfeature];
255
+ });
256
+ } // Now subfeatures have been processed and removed, we can
257
+ // process root, or shorthand, feature selectors.
258
+
259
+
260
+ if (isShorthand || selector.root) {
261
+ const featureSelector = isShorthand ? selector : selector.root; // Create temporary style object and build declarations for feature.
262
+
263
+ const featureStyles = {
264
+ [feature]: styles[feature]
265
+ };
266
+ const newDeclarations = getStylesDeclarations(featureStyles); // Merge new declarations with any others that share the selector.
267
+
268
+ declarations[featureSelector] = [...(declarations[featureSelector] || []), ...newDeclarations]; // Remove the feature from the block's styles now as it will be
269
+ // included under its own selector not the block's.
270
+
271
+ delete styles[feature];
272
+ }
273
+ });
274
+ return declarations;
275
+ };
203
276
  /**
204
277
  * Transform given style tree into a set of style declarations.
205
278
  *
@@ -221,13 +294,13 @@ function getStylesDeclarations() {
221
294
  let useRootPaddingAlign = arguments.length > 2 ? arguments[2] : undefined;
222
295
  let tree = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
223
296
  const isRoot = _utils.ROOT_BLOCK_SELECTOR === selector;
224
- const output = Object.entries(_blocks.__EXPERIMENTAL_STYLE_PROPERTY).reduce((declarations, _ref5) => {
297
+ const output = Object.entries(_blocks.__EXPERIMENTAL_STYLE_PROPERTY).reduce((declarations, _ref7) => {
225
298
  let [key, {
226
299
  value,
227
300
  properties,
228
301
  useEngine,
229
302
  rootOnly
230
- }] = _ref5;
303
+ }] = _ref7;
231
304
 
232
305
  if (rootOnly && !isRoot) {
233
306
  return declarations;
@@ -327,7 +400,7 @@ function getStylesDeclarations() {
327
400
  */
328
401
 
329
402
 
330
- function getLayoutStyles(_ref6) {
403
+ function getLayoutStyles(_ref8) {
331
404
  var _style$spacing, _tree$settings2, _tree$settings2$layou, _tree$settings3, _tree$settings3$layou;
332
405
 
333
406
  let {
@@ -337,7 +410,7 @@ function getLayoutStyles(_ref6) {
337
410
  hasBlockGapSupport,
338
411
  hasFallbackGapSupport,
339
412
  fallbackGapValue
340
- } = _ref6;
413
+ } = _ref8;
341
414
  let ruleset = '';
342
415
  let gapValue = hasBlockGapSupport ? (0, _gap.getGapCSSValue)(style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.blockGap) : ''; // Ensure a fallback gap value for the root layout definitions,
343
416
  // and use a fallback value if one is provided for the current block.
@@ -351,12 +424,12 @@ function getLayoutStyles(_ref6) {
351
424
  }
352
425
 
353
426
  if (gapValue && tree !== null && tree !== void 0 && (_tree$settings2 = tree.settings) !== null && _tree$settings2 !== void 0 && (_tree$settings2$layou = _tree$settings2.layout) !== null && _tree$settings2$layou !== void 0 && _tree$settings2$layou.definitions) {
354
- Object.values(tree.settings.layout.definitions).forEach(_ref7 => {
427
+ Object.values(tree.settings.layout.definitions).forEach(_ref9 => {
355
428
  let {
356
429
  className,
357
430
  name,
358
431
  spacingStyles
359
- } = _ref7;
432
+ } = _ref9;
360
433
 
361
434
  // Allow outputting fallback gap styles for flex layout type when block gap support isn't available.
362
435
  if (!hasBlockGapSupport && 'flex' !== name) {
@@ -368,8 +441,8 @@ function getLayoutStyles(_ref6) {
368
441
  const declarations = [];
369
442
 
370
443
  if (spacingStyle.rules) {
371
- Object.entries(spacingStyle.rules).forEach(_ref8 => {
372
- let [cssProperty, cssValue] = _ref8;
444
+ Object.entries(spacingStyle.rules).forEach(_ref10 => {
445
+ let [cssProperty, cssValue] = _ref10;
373
446
  declarations.push(`${cssProperty}: ${cssValue ? cssValue : gapValue}`);
374
447
  });
375
448
  }
@@ -381,7 +454,7 @@ function getLayoutStyles(_ref6) {
381
454
  // For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles.
382
455
  combinedSelector = selector === _utils.ROOT_BLOCK_SELECTOR ? `:where(.${className}${(spacingStyle === null || spacingStyle === void 0 ? void 0 : spacingStyle.selector) || ''})` : `:where(${selector}.${className}${(spacingStyle === null || spacingStyle === void 0 ? void 0 : spacingStyle.selector) || ''})`;
383
456
  } else {
384
- combinedSelector = selector === _utils.ROOT_BLOCK_SELECTOR ? `${selector} .${className}${(spacingStyle === null || spacingStyle === void 0 ? void 0 : spacingStyle.selector) || ''}` : `${selector}.${className}${(spacingStyle === null || spacingStyle === void 0 ? void 0 : spacingStyle.selector) || ''}`;
457
+ combinedSelector = selector === _utils.ROOT_BLOCK_SELECTOR ? `${selector} .${className}${(spacingStyle === null || spacingStyle === void 0 ? void 0 : spacingStyle.selector) || ''}` : `${selector}-${className}${selector}-${className}${(spacingStyle === null || spacingStyle === void 0 ? void 0 : spacingStyle.selector) || ''}`;
385
458
  }
386
459
 
387
460
  ruleset += `${combinedSelector} { ${declarations.join('; ')}; }`;
@@ -398,12 +471,12 @@ function getLayoutStyles(_ref6) {
398
471
 
399
472
  if (selector === _utils.ROOT_BLOCK_SELECTOR && tree !== null && tree !== void 0 && (_tree$settings3 = tree.settings) !== null && _tree$settings3 !== void 0 && (_tree$settings3$layou = _tree$settings3.layout) !== null && _tree$settings3$layou !== void 0 && _tree$settings3$layou.definitions) {
400
473
  const validDisplayModes = ['block', 'flex', 'grid'];
401
- Object.values(tree.settings.layout.definitions).forEach(_ref9 => {
474
+ Object.values(tree.settings.layout.definitions).forEach(_ref11 => {
402
475
  let {
403
476
  className,
404
477
  displayMode,
405
478
  baseStyles
406
- } = _ref9;
479
+ } = _ref11;
407
480
 
408
481
  if (displayMode && validDisplayModes.includes(displayMode)) {
409
482
  ruleset += `${selector} .${className} { display:${displayMode}; }`;
@@ -414,8 +487,8 @@ function getLayoutStyles(_ref6) {
414
487
  const declarations = [];
415
488
 
416
489
  if (baseStyle.rules) {
417
- Object.entries(baseStyle.rules).forEach(_ref10 => {
418
- let [cssProperty, cssValue] = _ref10;
490
+ Object.entries(baseStyle.rules).forEach(_ref12 => {
491
+ let [cssProperty, cssValue] = _ref12;
419
492
  declarations.push(`${cssProperty}: ${cssValue}`);
420
493
  });
421
494
  }
@@ -441,8 +514,8 @@ const getNodesWithStyles = (tree, blockSelectors) => {
441
514
  return nodes;
442
515
  }
443
516
 
444
- const pickStyleKeys = treeToPickFrom => Object.fromEntries(Object.entries(treeToPickFrom !== null && treeToPickFrom !== void 0 ? treeToPickFrom : {}).filter(_ref11 => {
445
- let [key] = _ref11;
517
+ const pickStyleKeys = treeToPickFrom => Object.fromEntries(Object.entries(treeToPickFrom !== null && treeToPickFrom !== void 0 ? treeToPickFrom : {}).filter(_ref13 => {
518
+ let [key] = _ref13;
446
519
  return ['border', 'color', 'dimensions', 'spacing', 'typography', 'filter', 'outline', 'shadow'].includes(key);
447
520
  })); // Top-level.
448
521
 
@@ -456,25 +529,25 @@ const getNodesWithStyles = (tree, blockSelectors) => {
456
529
  });
457
530
  }
458
531
 
459
- Object.entries(_blocks.__EXPERIMENTAL_ELEMENTS).forEach(_ref12 => {
460
- var _tree$styles;
532
+ Object.entries(_blocks.__EXPERIMENTAL_ELEMENTS).forEach(_ref14 => {
533
+ var _tree$styles, _tree$styles$elements;
461
534
 
462
- let [name, selector] = _ref12;
535
+ let [name, selector] = _ref14;
463
536
 
464
- if (!!((_tree$styles = tree.styles) !== null && _tree$styles !== void 0 && _tree$styles.elements[name])) {
465
- var _tree$styles2;
537
+ if (!!((_tree$styles = tree.styles) !== null && _tree$styles !== void 0 && (_tree$styles$elements = _tree$styles.elements) !== null && _tree$styles$elements !== void 0 && _tree$styles$elements[name])) {
538
+ var _tree$styles2, _tree$styles2$element;
466
539
 
467
540
  nodes.push({
468
- styles: (_tree$styles2 = tree.styles) === null || _tree$styles2 === void 0 ? void 0 : _tree$styles2.elements[name],
541
+ styles: (_tree$styles2 = tree.styles) === null || _tree$styles2 === void 0 ? void 0 : (_tree$styles2$element = _tree$styles2.elements) === null || _tree$styles2$element === void 0 ? void 0 : _tree$styles2$element[name],
469
542
  selector
470
543
  });
471
544
  }
472
545
  }); // Iterate over blocks: they can have styles & elements.
473
546
 
474
- Object.entries((_tree$styles$blocks = (_tree$styles3 = tree.styles) === null || _tree$styles3 === void 0 ? void 0 : _tree$styles3.blocks) !== null && _tree$styles$blocks !== void 0 ? _tree$styles$blocks : {}).forEach(_ref13 => {
547
+ Object.entries((_tree$styles$blocks = (_tree$styles3 = tree.styles) === null || _tree$styles3 === void 0 ? void 0 : _tree$styles3.blocks) !== null && _tree$styles$blocks !== void 0 ? _tree$styles$blocks : {}).forEach(_ref15 => {
475
548
  var _blockSelectors$block, _node$elements;
476
549
 
477
- let [blockName, node] = _ref13;
550
+ let [blockName, node] = _ref15;
478
551
  const blockStyles = pickStyleKeys(node);
479
552
 
480
553
  if (node !== null && node !== void 0 && node.variations) {
@@ -486,24 +559,28 @@ const getNodesWithStyles = (tree, blockSelectors) => {
486
559
  }
487
560
 
488
561
  if (!!blockStyles && !!(blockSelectors !== null && blockSelectors !== void 0 && (_blockSelectors$block = blockSelectors[blockName]) !== null && _blockSelectors$block !== void 0 && _blockSelectors$block.selector)) {
562
+ var _blockSelectors$block2;
563
+
489
564
  nodes.push({
490
565
  duotoneSelector: blockSelectors[blockName].duotoneSelector,
491
566
  fallbackGapValue: blockSelectors[blockName].fallbackGapValue,
492
567
  hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport,
493
- selector: blockSelectors[blockName].selector,
568
+ selector: (_blockSelectors$block2 = blockSelectors[blockName]) === null || _blockSelectors$block2 === void 0 ? void 0 : _blockSelectors$block2.selector,
494
569
  styles: blockStyles,
495
570
  featureSelectors: blockSelectors[blockName].featureSelectors,
496
571
  styleVariationSelectors: blockSelectors[blockName].styleVariationSelectors
497
572
  });
498
573
  }
499
574
 
500
- Object.entries((_node$elements = node === null || node === void 0 ? void 0 : node.elements) !== null && _node$elements !== void 0 ? _node$elements : {}).forEach(_ref14 => {
501
- let [elementName, value] = _ref14;
575
+ Object.entries((_node$elements = node === null || node === void 0 ? void 0 : node.elements) !== null && _node$elements !== void 0 ? _node$elements : {}).forEach(_ref16 => {
576
+ let [elementName, value] = _ref16;
502
577
 
503
578
  if (!!value && !!(blockSelectors !== null && blockSelectors !== void 0 && blockSelectors[blockName]) && !!(_blocks.__EXPERIMENTAL_ELEMENTS !== null && _blocks.__EXPERIMENTAL_ELEMENTS !== void 0 && _blocks.__EXPERIMENTAL_ELEMENTS[elementName])) {
579
+ var _blockSelectors$block3;
580
+
504
581
  nodes.push({
505
582
  styles: value,
506
- selector: blockSelectors[blockName].selector.split(',').map(sel => {
583
+ selector: (_blockSelectors$block3 = blockSelectors[blockName]) === null || _blockSelectors$block3 === void 0 ? void 0 : _blockSelectors$block3.selector.split(',').map(sel => {
507
584
  const elementSelectors = _blocks.__EXPERIMENTAL_ELEMENTS[elementName].split(',');
508
585
 
509
586
  return elementSelectors.map(elementSelector => sel + ' ' + elementSelector);
@@ -529,10 +606,10 @@ const getNodesWithSettings = (tree, blockSelectors) => {
529
606
  const pickPresets = treeToPickFrom => {
530
607
  const presets = {};
531
608
 
532
- _utils.PRESET_METADATA.forEach(_ref15 => {
609
+ _utils.PRESET_METADATA.forEach(_ref17 => {
533
610
  let {
534
611
  path
535
- } = _ref15;
612
+ } = _ref17;
536
613
  const value = (0, _lodash.get)(treeToPickFrom, path, false);
537
614
 
538
615
  if (value !== false) {
@@ -556,16 +633,18 @@ const getNodesWithSettings = (tree, blockSelectors) => {
556
633
  } // Blocks.
557
634
 
558
635
 
559
- Object.entries((_tree$settings$blocks = (_tree$settings5 = tree.settings) === null || _tree$settings5 === void 0 ? void 0 : _tree$settings5.blocks) !== null && _tree$settings$blocks !== void 0 ? _tree$settings$blocks : {}).forEach(_ref16 => {
560
- let [blockName, node] = _ref16;
636
+ Object.entries((_tree$settings$blocks = (_tree$settings5 = tree.settings) === null || _tree$settings5 === void 0 ? void 0 : _tree$settings5.blocks) !== null && _tree$settings$blocks !== void 0 ? _tree$settings$blocks : {}).forEach(_ref18 => {
637
+ let [blockName, node] = _ref18;
561
638
  const blockPresets = pickPresets(node);
562
639
  const blockCustom = node.custom;
563
640
 
564
641
  if (!(0, _lodash.isEmpty)(blockPresets) || !!blockCustom) {
642
+ var _blockSelectors$block4;
643
+
565
644
  nodes.push({
566
645
  presets: blockPresets,
567
646
  custom: blockCustom,
568
- selector: blockSelectors[blockName].selector
647
+ selector: (_blockSelectors$block4 = blockSelectors[blockName]) === null || _blockSelectors$block4 === void 0 ? void 0 : _blockSelectors$block4.selector
569
648
  });
570
649
  }
571
650
  });
@@ -577,12 +656,12 @@ exports.getNodesWithSettings = getNodesWithSettings;
577
656
  const toCustomProperties = (tree, blockSelectors) => {
578
657
  const settings = getNodesWithSettings(tree, blockSelectors);
579
658
  let ruleset = '';
580
- settings.forEach(_ref17 => {
659
+ settings.forEach(_ref19 => {
581
660
  let {
582
661
  presets,
583
662
  custom,
584
663
  selector
585
- } = _ref17;
664
+ } = _ref19;
586
665
  const declarations = getPresetsDeclarations(presets, tree === null || tree === void 0 ? void 0 : tree.settings);
587
666
  const customProps = flattenTree(custom, '--wp--custom--', '--');
588
667
 
@@ -644,7 +723,7 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
644
723
  }
645
724
 
646
725
  ruleset += '}';
647
- nodesWithStyles.forEach(_ref18 => {
726
+ nodesWithStyles.forEach(_ref20 => {
648
727
  let {
649
728
  selector,
650
729
  duotoneSelector,
@@ -653,54 +732,43 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
653
732
  hasLayoutSupport,
654
733
  featureSelectors,
655
734
  styleVariationSelectors
656
- } = _ref18;
735
+ } = _ref20;
657
736
 
658
737
  // Process styles for block support features with custom feature level
659
738
  // CSS selectors set.
660
739
  if (featureSelectors) {
661
- Object.entries(featureSelectors).forEach(_ref19 => {
662
- let [featureName, featureSelector] = _ref19;
663
-
664
- if (styles !== null && styles !== void 0 && styles[featureName]) {
665
- const featureStyles = {
666
- [featureName]: styles[featureName]
667
- };
668
- const featureDeclarations = getStylesDeclarations(featureStyles);
669
- delete styles[featureName];
670
-
671
- if (!!featureDeclarations.length) {
672
- ruleset = ruleset + `${featureSelector}{${featureDeclarations.join(';')} }`;
673
- }
740
+ const featureDeclarations = getFeatureDeclarations(featureSelectors, styles);
741
+ Object.entries(featureDeclarations).forEach(_ref21 => {
742
+ let [cssSelector, declarations] = _ref21;
743
+
744
+ if (!!declarations.length) {
745
+ const rules = declarations.join(';');
746
+ ruleset = ruleset + `${cssSelector}{${rules}}`;
674
747
  }
675
748
  });
676
749
  }
677
750
 
678
751
  if (styleVariationSelectors) {
679
- Object.entries(styleVariationSelectors).forEach(_ref20 => {
752
+ Object.entries(styleVariationSelectors).forEach(_ref22 => {
680
753
  var _styles$variations;
681
754
 
682
- let [styleVariationName, styleVariationSelector] = _ref20;
755
+ let [styleVariationName, styleVariationSelector] = _ref22;
683
756
 
684
757
  if (styles !== null && styles !== void 0 && (_styles$variations = styles.variations) !== null && _styles$variations !== void 0 && _styles$variations[styleVariationName]) {
685
758
  var _styles$variations3;
686
759
 
687
760
  // If the block uses any custom selectors for block support, add those first.
688
761
  if (featureSelectors) {
689
- Object.entries(featureSelectors).forEach(_ref21 => {
690
- var _styles$variations2, _styles$variations2$s;
691
-
692
- let [featureName, featureSelector] = _ref21;
762
+ var _styles$variations2;
693
763
 
694
- if (styles !== null && styles !== void 0 && (_styles$variations2 = styles.variations) !== null && _styles$variations2 !== void 0 && (_styles$variations2$s = _styles$variations2[styleVariationName]) !== null && _styles$variations2$s !== void 0 && _styles$variations2$s[featureName]) {
695
- const featureStyles = {
696
- [featureName]: styles.variations[styleVariationName][featureName]
697
- };
698
- const featureDeclarations = getStylesDeclarations(featureStyles);
699
- delete styles.variations[styleVariationName][featureName];
764
+ const featureDeclarations = getFeatureDeclarations(featureSelectors, styles === null || styles === void 0 ? void 0 : (_styles$variations2 = styles.variations) === null || _styles$variations2 === void 0 ? void 0 : _styles$variations2[styleVariationName]);
765
+ Object.entries(featureDeclarations).forEach(_ref23 => {
766
+ let [baseSelector, declarations] = _ref23;
700
767
 
701
- if (!!featureDeclarations.length) {
702
- ruleset = ruleset + `${concatFeatureVariationSelectorString(featureSelector, styleVariationSelector)}{${featureDeclarations.join(';')} }`;
703
- }
768
+ if (!!declarations.length) {
769
+ const cssSelector = concatFeatureVariationSelectorString(baseSelector, styleVariationSelector);
770
+ const rules = declarations.join(';');
771
+ ruleset = ruleset + `${cssSelector}{${rules}}`;
704
772
  }
705
773
  });
706
774
  } // Otherwise add regular selectors.
@@ -751,14 +819,14 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
751
819
  } // Check for pseudo selector in `styles` and handle separately.
752
820
 
753
821
 
754
- const pseudoSelectorStyles = Object.entries(styles).filter(_ref22 => {
755
- let [key] = _ref22;
822
+ const pseudoSelectorStyles = Object.entries(styles).filter(_ref24 => {
823
+ let [key] = _ref24;
756
824
  return key.startsWith(':');
757
825
  });
758
826
 
759
827
  if (pseudoSelectorStyles !== null && pseudoSelectorStyles !== void 0 && pseudoSelectorStyles.length) {
760
- pseudoSelectorStyles.forEach(_ref23 => {
761
- let [pseudoKey, pseudoStyle] = _ref23;
828
+ pseudoSelectorStyles.forEach(_ref25 => {
829
+ let [pseudoKey, pseudoStyle] = _ref25;
762
830
  const pseudoDeclarations = getStylesDeclarations(pseudoStyle);
763
831
 
764
832
  if (!(pseudoDeclarations !== null && pseudoDeclarations !== void 0 && pseudoDeclarations.length)) {
@@ -794,11 +862,11 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
794
862
  ruleset = ruleset + `.wp-site-blocks > * + * { margin-block-start: ${gapValue}; }`;
795
863
  }
796
864
 
797
- nodesWithSettings.forEach(_ref24 => {
865
+ nodesWithSettings.forEach(_ref26 => {
798
866
  let {
799
867
  selector,
800
868
  presets
801
- } = _ref24;
869
+ } = _ref26;
802
870
 
803
871
  if (_utils.ROOT_BLOCK_SELECTOR === selector) {
804
872
  // Do not add extra specificity for top-level classes.
@@ -818,24 +886,43 @@ exports.toStyles = toStyles;
818
886
 
819
887
  function toSvgFilters(tree, blockSelectors) {
820
888
  const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
821
- return nodesWithSettings.flatMap(_ref25 => {
889
+ return nodesWithSettings.flatMap(_ref27 => {
822
890
  let {
823
891
  presets
824
- } = _ref25;
892
+ } = _ref27;
825
893
  return getPresetsSvgFilters(presets);
826
894
  });
827
895
  }
828
896
 
897
+ const getSelectorsConfig = (blockType, rootSelector) => {
898
+ if (!(0, _lodash.isEmpty)(blockType === null || blockType === void 0 ? void 0 : blockType.selectors)) {
899
+ return blockType.selectors;
900
+ }
901
+
902
+ const config = {
903
+ root: rootSelector
904
+ };
905
+ Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(_ref28 => {
906
+ let [featureKey, featureName] = _ref28;
907
+ const featureSelector = (0, _getBlockCssSelector.getBlockCSSSelector)(blockType, featureKey);
908
+
909
+ if (featureSelector) {
910
+ config[featureName] = featureSelector;
911
+ }
912
+ });
913
+ return config;
914
+ };
915
+
829
916
  const getBlockSelectors = (blockTypes, getBlockStyles) => {
830
917
  const result = {};
831
918
  blockTypes.forEach(blockType => {
832
- var _blockType$supports$_, _blockType$supports, _blockType$supports$c, _blockType$supports2, _blockType$supports2$, _blockType$supports3, _blockType$supports4, _blockType$supports4$, _blockType$supports4$2;
919
+ var _blockType$supports, _blockType$supports2, _blockType$supports2$, _blockType$supports2$2;
833
920
 
834
921
  const name = blockType.name;
835
- const selector = (_blockType$supports$_ = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports = blockType.supports) === null || _blockType$supports === void 0 ? void 0 : _blockType$supports.__experimentalSelector) !== null && _blockType$supports$_ !== void 0 ? _blockType$supports$_ : '.wp-block-' + name.replace('core/', '').replace('/', '-');
836
- const duotoneSelector = (_blockType$supports$c = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports2 = blockType.supports) === null || _blockType$supports2 === void 0 ? void 0 : (_blockType$supports2$ = _blockType$supports2.color) === null || _blockType$supports2$ === void 0 ? void 0 : _blockType$supports2$.__experimentalDuotone) !== null && _blockType$supports$c !== void 0 ? _blockType$supports$c : null;
837
- const hasLayoutSupport = !!(blockType !== null && blockType !== void 0 && (_blockType$supports3 = blockType.supports) !== null && _blockType$supports3 !== void 0 && _blockType$supports3.__experimentalLayout);
838
- const fallbackGapValue = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports4 = blockType.supports) === null || _blockType$supports4 === void 0 ? void 0 : (_blockType$supports4$ = _blockType$supports4.spacing) === null || _blockType$supports4$ === void 0 ? void 0 : (_blockType$supports4$2 = _blockType$supports4$.blockGap) === null || _blockType$supports4$2 === void 0 ? void 0 : _blockType$supports4$2.__experimentalDefault;
922
+ const selector = (0, _getBlockCssSelector.getBlockCSSSelector)(blockType, 'root');
923
+ const duotoneSelector = (0, _getBlockCssSelector.getBlockCSSSelector)(blockType, 'filter.duotone');
924
+ const hasLayoutSupport = !!(blockType !== null && blockType !== void 0 && (_blockType$supports = blockType.supports) !== null && _blockType$supports !== void 0 && _blockType$supports.__experimentalLayout);
925
+ const fallbackGapValue = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports2 = blockType.supports) === null || _blockType$supports2 === void 0 ? void 0 : (_blockType$supports2$ = _blockType$supports2.spacing) === null || _blockType$supports2$ === void 0 ? void 0 : (_blockType$supports2$2 = _blockType$supports2$.blockGap) === null || _blockType$supports2$2 === void 0 ? void 0 : _blockType$supports2$2.__experimentalDefault;
839
926
  const blockStyleVariations = getBlockStyles(name);
840
927
  const styleVariationSelectors = {};
841
928
 
@@ -847,17 +934,7 @@ const getBlockSelectors = (blockTypes, getBlockStyles) => {
847
934
  } // For each block support feature add any custom selectors.
848
935
 
849
936
 
850
- const featureSelectors = {};
851
- Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(_ref26 => {
852
- var _blockType$supports5, _blockType$supports5$;
853
-
854
- let [featureKey, featureName] = _ref26;
855
- const featureSelector = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports5 = blockType.supports) === null || _blockType$supports5 === void 0 ? void 0 : (_blockType$supports5$ = _blockType$supports5[featureKey]) === null || _blockType$supports5$ === void 0 ? void 0 : _blockType$supports5$.__experimentalSelector;
856
-
857
- if (featureSelector) {
858
- featureSelectors[featureName] = (0, _utils.scopeSelector)(selector, featureSelector);
859
- }
860
- });
937
+ const featureSelectors = getSelectorsConfig(blockType, selector);
861
938
  result[name] = {
862
939
  duotoneSelector,
863
940
  fallbackGapValue,
@@ -882,9 +959,9 @@ const getBlockSelectors = (blockTypes, getBlockStyles) => {
882
959
  exports.getBlockSelectors = getBlockSelectors;
883
960
 
884
961
  function updateConfigWithSeparator(config) {
885
- var _config$styles, _config$styles2, _config$styles2$block, _config$styles3, _config$styles3$block, _config$styles4, _config$styles4$block;
962
+ var _config$styles, _config$styles$blocks, _config$styles2, _config$styles2$block, _config$styles2$block2, _config$styles3, _config$styles3$block, _config$styles3$block2, _config$styles4, _config$styles4$block, _config$styles4$block2;
886
963
 
887
- const needsSeparatorStyleUpdate = ((_config$styles = config.styles) === null || _config$styles === void 0 ? void 0 : _config$styles.blocks['core/separator']) && ((_config$styles2 = config.styles) === null || _config$styles2 === void 0 ? void 0 : (_config$styles2$block = _config$styles2.blocks['core/separator'].color) === null || _config$styles2$block === void 0 ? void 0 : _config$styles2$block.background) && !((_config$styles3 = config.styles) !== null && _config$styles3 !== void 0 && (_config$styles3$block = _config$styles3.blocks['core/separator'].color) !== null && _config$styles3$block !== void 0 && _config$styles3$block.text) && !((_config$styles4 = config.styles) !== null && _config$styles4 !== void 0 && (_config$styles4$block = _config$styles4.blocks['core/separator'].border) !== null && _config$styles4$block !== void 0 && _config$styles4$block.color);
964
+ const needsSeparatorStyleUpdate = ((_config$styles = config.styles) === null || _config$styles === void 0 ? void 0 : (_config$styles$blocks = _config$styles.blocks) === null || _config$styles$blocks === void 0 ? void 0 : _config$styles$blocks['core/separator']) && ((_config$styles2 = config.styles) === null || _config$styles2 === void 0 ? void 0 : (_config$styles2$block = _config$styles2.blocks) === null || _config$styles2$block === void 0 ? void 0 : (_config$styles2$block2 = _config$styles2$block['core/separator'].color) === null || _config$styles2$block2 === void 0 ? void 0 : _config$styles2$block2.background) && !((_config$styles3 = config.styles) !== null && _config$styles3 !== void 0 && (_config$styles3$block = _config$styles3.blocks) !== null && _config$styles3$block !== void 0 && (_config$styles3$block2 = _config$styles3$block['core/separator'].color) !== null && _config$styles3$block2 !== void 0 && _config$styles3$block2.text) && !((_config$styles4 = config.styles) !== null && _config$styles4 !== void 0 && (_config$styles4$block = _config$styles4.blocks) !== null && _config$styles4$block !== void 0 && (_config$styles4$block2 = _config$styles4$block['core/separator'].border) !== null && _config$styles4$block2 !== void 0 && _config$styles4$block2.color);
888
965
 
889
966
  if (needsSeparatorStyleUpdate) {
890
967
  var _config$styles5;
@@ -944,8 +1021,8 @@ function useGlobalStylesOutput() {
944
1021
  const blockSelectors = getBlockSelectors((0, _blocks.getBlockTypes)(), getBlockStyles);
945
1022
  const customProperties = toCustomProperties(mergedConfig, blockSelectors);
946
1023
  const globalStyles = toStyles(mergedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles);
947
- const filters = toSvgFilters(mergedConfig, blockSelectors);
948
- const stylesheets = [{
1024
+ const svgs = toSvgFilters(mergedConfig, blockSelectors);
1025
+ const styles = [{
949
1026
  css: customProperties,
950
1027
  isGlobalStyles: true
951
1028
  }, {
@@ -955,6 +1032,10 @@ function useGlobalStylesOutput() {
955
1032
  {
956
1033
  css: (_mergedConfig$styles$ = mergedConfig.styles.css) !== null && _mergedConfig$styles$ !== void 0 ? _mergedConfig$styles$ : '',
957
1034
  isGlobalStyles: true
1035
+ }, {
1036
+ assets: svgs,
1037
+ __unstableType: 'svg',
1038
+ isGlobalStyles: true
958
1039
  }]; // Loop through the blocks to check if there are custom CSS values.
959
1040
  // If there are, get the block selector and push the selector together with
960
1041
  // the CSS value to the 'stylesheets' array.
@@ -966,13 +1047,13 @@ function useGlobalStylesOutput() {
966
1047
  var _mergedConfig$styles$3;
967
1048
 
968
1049
  const selector = blockSelectors[blockType.name].selector;
969
- stylesheets.push({
1050
+ styles.push({
970
1051
  css: processCSSNesting((_mergedConfig$styles$3 = mergedConfig.styles.blocks[blockType.name]) === null || _mergedConfig$styles$3 === void 0 ? void 0 : _mergedConfig$styles$3.css, selector),
971
1052
  isGlobalStyles: true
972
1053
  });
973
1054
  }
974
1055
  });
975
- return [stylesheets, mergedConfig.settings, filters];
1056
+ return [styles, mergedConfig.settings];
976
1057
  }, [hasBlockGapSupport, hasFallbackGapSupport, mergedConfig, disableLayoutStyles]);
977
1058
  }
978
1059
  //# sourceMappingURL=use-global-styles-output.js.map