@wordpress/block-editor 11.6.0 → 11.8.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 (350) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +46 -55
  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.native.js +4 -3
  6. package/build/components/block-list/block.native.js.map +1 -1
  7. package/build/components/block-list/index.native.js +11 -21
  8. package/build/components/block-list/index.native.js.map +1 -1
  9. package/build/components/block-list/use-in-between-inserter.js +3 -1
  10. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  11. package/build/components/block-popover/inbetween.js +2 -9
  12. package/build/components/block-popover/inbetween.js.map +1 -1
  13. package/build/components/block-preview/auto.js +6 -23
  14. package/build/components/block-preview/auto.js.map +1 -1
  15. package/build/components/block-settings-menu/block-settings-dropdown.js +1 -10
  16. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  17. package/build/components/caption/index.native.js +0 -1
  18. package/build/components/caption/index.native.js.map +1 -1
  19. package/build/components/date-format-picker/index.js +1 -1
  20. package/build/components/date-format-picker/index.js.map +1 -1
  21. package/build/components/editor-styles/index.js +20 -2
  22. package/build/components/editor-styles/index.js.map +1 -1
  23. package/build/components/global-styles/border-panel.js +15 -29
  24. package/build/components/global-styles/border-panel.js.map +1 -1
  25. package/build/components/global-styles/color-panel.js +583 -0
  26. package/build/components/global-styles/color-panel.js.map +1 -0
  27. package/build/components/global-styles/dimensions-panel.js +23 -44
  28. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  29. package/build/components/global-styles/effects-panel.js +244 -0
  30. package/build/components/global-styles/effects-panel.js.map +1 -0
  31. package/build/components/global-styles/filters-panel.js +151 -0
  32. package/build/components/global-styles/filters-panel.js.map +1 -0
  33. package/build/components/global-styles/get-block-css-selector.js +118 -0
  34. package/build/components/global-styles/get-block-css-selector.js.map +1 -0
  35. package/build/components/global-styles/hooks.js +60 -1
  36. package/build/components/global-styles/hooks.js.map +1 -1
  37. package/build/components/global-styles/index.js +46 -2
  38. package/build/components/global-styles/index.js.map +1 -1
  39. package/build/components/global-styles/typography-panel.js +9 -35
  40. package/build/components/global-styles/typography-panel.js.map +1 -1
  41. package/build/components/global-styles/use-global-styles-output.js +173 -91
  42. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  43. package/build/components/global-styles/utils.js +2 -1
  44. package/build/components/global-styles/utils.js.map +1 -1
  45. package/build/components/iframe/index.js +1 -1
  46. package/build/components/iframe/index.js.map +1 -1
  47. package/build/components/image-size-control/index.js +8 -5
  48. package/build/components/image-size-control/index.js.map +1 -1
  49. package/build/components/image-size-control/use-dimension-handler.js +5 -3
  50. package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
  51. package/build/components/index.js +16 -0
  52. package/build/components/index.js.map +1 -1
  53. package/build/components/inserter/block-patterns-tab.js +4 -2
  54. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  55. package/build/components/inspector-controls-tabs/position-controls-panel.js +43 -7
  56. package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  57. package/build/components/inspector-controls-tabs/utils.js +5 -3
  58. package/build/components/inspector-controls-tabs/utils.js.map +1 -1
  59. package/build/components/line-height-control/index.js +15 -1
  60. package/build/components/line-height-control/index.js.map +1 -1
  61. package/build/components/list-view/appender.js +105 -0
  62. package/build/components/list-view/appender.js.map +1 -0
  63. package/build/components/list-view/block.js +6 -5
  64. package/build/components/list-view/block.js.map +1 -1
  65. package/build/components/list-view/branch.js +25 -5
  66. package/build/components/list-view/branch.js.map +1 -1
  67. package/build/components/list-view/index.js +56 -14
  68. package/build/components/list-view/index.js.map +1 -1
  69. package/build/components/list-view/use-list-view-client-ids.js +7 -3
  70. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  71. package/build/components/list-view/use-list-view-drop-zone.js +8 -2
  72. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  73. package/build/components/media-replace-flow/index.js +13 -4
  74. package/build/components/media-replace-flow/index.js.map +1 -1
  75. package/build/components/off-canvas-editor/block-contents.js +6 -1
  76. package/build/components/off-canvas-editor/block-contents.js.map +1 -1
  77. package/build/components/off-canvas-editor/index.js +17 -14
  78. package/build/components/off-canvas-editor/index.js.map +1 -1
  79. package/build/components/resizable-box-popover/index.js +38 -0
  80. package/build/components/resizable-box-popover/index.js.map +1 -0
  81. package/build/components/rich-text/format-edit.js +2 -30
  82. package/build/components/rich-text/format-edit.js.map +1 -1
  83. package/build/components/rich-text/index.js +0 -1
  84. package/build/components/rich-text/index.js.map +1 -1
  85. package/build/components/rich-text/index.native.js +7 -11
  86. package/build/components/rich-text/index.native.js.map +1 -1
  87. package/build/components/spacing-sizes-control/spacing-input-control.js +8 -0
  88. package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  89. package/build/components/writing-flow/use-input.js +4 -8
  90. package/build/components/writing-flow/use-input.js.map +1 -1
  91. package/build/hooks/anchor.js +1 -1
  92. package/build/hooks/anchor.js.map +1 -1
  93. package/build/hooks/border.js +1 -2
  94. package/build/hooks/border.js.map +1 -1
  95. package/build/hooks/color.js +92 -229
  96. package/build/hooks/color.js.map +1 -1
  97. package/build/hooks/content-lock-ui.js +4 -2
  98. package/build/hooks/content-lock-ui.js.map +1 -1
  99. package/build/hooks/{color-panel.js → contrast-checker.js} +11 -49
  100. package/build/hooks/contrast-checker.js.map +1 -0
  101. package/build/hooks/dimensions.js +0 -1
  102. package/build/hooks/dimensions.js.map +1 -1
  103. package/build/hooks/duotone.js +92 -64
  104. package/build/hooks/duotone.js.map +1 -1
  105. package/build/hooks/margin.js +27 -17
  106. package/build/hooks/margin.js.map +1 -1
  107. package/build/hooks/padding.js +19 -9
  108. package/build/hooks/padding.js.map +1 -1
  109. package/build/hooks/position.js +2 -2
  110. package/build/hooks/position.js.map +1 -1
  111. package/build/hooks/style.js +23 -26
  112. package/build/hooks/style.js.map +1 -1
  113. package/build/hooks/typography.js +0 -1
  114. package/build/hooks/typography.js.map +1 -1
  115. package/build/hooks/utils.js +28 -76
  116. package/build/hooks/utils.js.map +1 -1
  117. package/build/layouts/grid.js +165 -0
  118. package/build/layouts/grid.js.map +1 -0
  119. package/build/layouts/index.js +3 -1
  120. package/build/layouts/index.js.map +1 -1
  121. package/build/layouts/utils.js +3 -2
  122. package/build/layouts/utils.js.map +1 -1
  123. package/build/private-apis.js +7 -1
  124. package/build/private-apis.js.map +1 -1
  125. package/build/store/actions.js +1 -1
  126. package/build/store/actions.js.map +1 -1
  127. package/build/utils/object.js +76 -0
  128. package/build/utils/object.js.map +1 -0
  129. package/build-module/components/block-list/block-html.js +1 -3
  130. package/build-module/components/block-list/block-html.js.map +1 -1
  131. package/build-module/components/block-list/block.native.js +4 -3
  132. package/build-module/components/block-list/block.native.js.map +1 -1
  133. package/build-module/components/block-list/index.native.js +11 -19
  134. package/build-module/components/block-list/index.native.js.map +1 -1
  135. package/build-module/components/block-list/use-in-between-inserter.js +2 -1
  136. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  137. package/build-module/components/block-popover/inbetween.js +2 -9
  138. package/build-module/components/block-popover/inbetween.js.map +1 -1
  139. package/build-module/components/block-preview/auto.js +6 -22
  140. package/build-module/components/block-preview/auto.js.map +1 -1
  141. package/build-module/components/block-settings-menu/block-settings-dropdown.js +1 -9
  142. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  143. package/build-module/components/caption/index.native.js +0 -1
  144. package/build-module/components/caption/index.native.js.map +1 -1
  145. package/build-module/components/date-format-picker/index.js +1 -1
  146. package/build-module/components/date-format-picker/index.js.map +1 -1
  147. package/build-module/components/editor-styles/index.js +19 -2
  148. package/build-module/components/editor-styles/index.js.map +1 -1
  149. package/build-module/components/global-styles/border-panel.js +15 -29
  150. package/build-module/components/global-styles/border-panel.js.map +1 -1
  151. package/build-module/components/global-styles/color-panel.js +554 -0
  152. package/build-module/components/global-styles/color-panel.js.map +1 -0
  153. package/build-module/components/global-styles/dimensions-panel.js +22 -44
  154. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  155. package/build-module/components/global-styles/effects-panel.js +228 -0
  156. package/build-module/components/global-styles/effects-panel.js.map +1 -0
  157. package/build-module/components/global-styles/filters-panel.js +139 -0
  158. package/build-module/components/global-styles/filters-panel.js.map +1 -0
  159. package/build-module/components/global-styles/get-block-css-selector.js +109 -0
  160. package/build-module/components/global-styles/get-block-css-selector.js.map +1 -0
  161. package/build-module/components/global-styles/hooks.js +58 -1
  162. package/build-module/components/global-styles/hooks.js.map +1 -1
  163. package/build-module/components/global-styles/index.js +5 -1
  164. package/build-module/components/global-styles/index.js.map +1 -1
  165. package/build-module/components/global-styles/typography-panel.js +8 -35
  166. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  167. package/build-module/components/global-styles/use-global-styles-output.js +175 -93
  168. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  169. package/build-module/components/global-styles/utils.js +2 -1
  170. package/build-module/components/global-styles/utils.js.map +1 -1
  171. package/build-module/components/iframe/index.js +1 -1
  172. package/build-module/components/iframe/index.js.map +1 -1
  173. package/build-module/components/image-size-control/index.js +8 -5
  174. package/build-module/components/image-size-control/index.js.map +1 -1
  175. package/build-module/components/image-size-control/use-dimension-handler.js +5 -3
  176. package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
  177. package/build-module/components/index.js +1 -0
  178. package/build-module/components/index.js.map +1 -1
  179. package/build-module/components/inserter/block-patterns-tab.js +5 -2
  180. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  181. package/build-module/components/inspector-controls-tabs/position-controls-panel.js +42 -7
  182. package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
  183. package/build-module/components/inspector-controls-tabs/utils.js +4 -3
  184. package/build-module/components/inspector-controls-tabs/utils.js.map +1 -1
  185. package/build-module/components/line-height-control/index.js +15 -1
  186. package/build-module/components/line-height-control/index.js.map +1 -1
  187. package/build-module/components/list-view/appender.js +88 -0
  188. package/build-module/components/list-view/appender.js.map +1 -0
  189. package/build-module/components/list-view/block.js +6 -4
  190. package/build-module/components/list-view/block.js.map +1 -1
  191. package/build-module/components/list-view/branch.js +22 -5
  192. package/build-module/components/list-view/branch.js.map +1 -1
  193. package/build-module/components/list-view/index.js +50 -13
  194. package/build-module/components/list-view/index.js.map +1 -1
  195. package/build-module/components/list-view/use-list-view-client-ids.js +7 -3
  196. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  197. package/build-module/components/list-view/use-list-view-drop-zone.js +8 -4
  198. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  199. package/build-module/components/media-replace-flow/index.js +12 -4
  200. package/build-module/components/media-replace-flow/index.js.map +1 -1
  201. package/build-module/components/off-canvas-editor/block-contents.js +5 -1
  202. package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
  203. package/build-module/components/off-canvas-editor/index.js +17 -14
  204. package/build-module/components/off-canvas-editor/index.js.map +1 -1
  205. package/build-module/components/resizable-box-popover/index.js +26 -0
  206. package/build-module/components/resizable-box-popover/index.js.map +1 -0
  207. package/build-module/components/rich-text/format-edit.js +3 -31
  208. package/build-module/components/rich-text/format-edit.js.map +1 -1
  209. package/build-module/components/rich-text/index.js +0 -1
  210. package/build-module/components/rich-text/index.js.map +1 -1
  211. package/build-module/components/rich-text/index.native.js +7 -10
  212. package/build-module/components/rich-text/index.native.js.map +1 -1
  213. package/build-module/components/spacing-sizes-control/spacing-input-control.js +7 -0
  214. package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
  215. package/build-module/components/writing-flow/use-input.js +4 -8
  216. package/build-module/components/writing-flow/use-input.js.map +1 -1
  217. package/build-module/hooks/anchor.js +1 -1
  218. package/build-module/hooks/anchor.js.map +1 -1
  219. package/build-module/hooks/border.js +1 -2
  220. package/build-module/hooks/border.js.map +1 -1
  221. package/build-module/hooks/color.js +90 -232
  222. package/build-module/hooks/color.js.map +1 -1
  223. package/build-module/hooks/content-lock-ui.js +4 -2
  224. package/build-module/hooks/content-lock-ui.js.map +1 -1
  225. package/build-module/hooks/{color-panel.js → contrast-checker.js} +10 -44
  226. package/build-module/hooks/contrast-checker.js.map +1 -0
  227. package/build-module/hooks/dimensions.js +0 -1
  228. package/build-module/hooks/dimensions.js.map +1 -1
  229. package/build-module/hooks/duotone.js +91 -65
  230. package/build-module/hooks/duotone.js.map +1 -1
  231. package/build-module/hooks/margin.js +29 -18
  232. package/build-module/hooks/margin.js.map +1 -1
  233. package/build-module/hooks/padding.js +21 -10
  234. package/build-module/hooks/padding.js.map +1 -1
  235. package/build-module/hooks/position.js +3 -3
  236. package/build-module/hooks/position.js.map +1 -1
  237. package/build-module/hooks/style.js +23 -26
  238. package/build-module/hooks/style.js.map +1 -1
  239. package/build-module/hooks/typography.js +0 -1
  240. package/build-module/hooks/typography.js.map +1 -1
  241. package/build-module/hooks/utils.js +27 -74
  242. package/build-module/hooks/utils.js.map +1 -1
  243. package/build-module/layouts/grid.js +151 -0
  244. package/build-module/layouts/grid.js.map +1 -0
  245. package/build-module/layouts/index.js +2 -1
  246. package/build-module/layouts/index.js.map +1 -1
  247. package/build-module/layouts/utils.js +3 -2
  248. package/build-module/layouts/utils.js.map +1 -1
  249. package/build-module/private-apis.js +5 -1
  250. package/build-module/private-apis.js.map +1 -1
  251. package/build-module/store/actions.js +1 -1
  252. package/build-module/store/actions.js.map +1 -1
  253. package/build-module/utils/object.js +69 -0
  254. package/build-module/utils/object.js.map +1 -0
  255. package/build-style/style-rtl.css +77 -16
  256. package/build-style/style.css +77 -16
  257. package/package.json +31 -31
  258. package/src/components/block-draggable/content.scss +1 -1
  259. package/src/components/block-inspector/style.scss +6 -4
  260. package/src/components/block-list/block-html.js +1 -1
  261. package/src/components/block-list/block.native.js +3 -2
  262. package/src/components/block-list/index.native.js +19 -38
  263. package/src/components/block-list/use-in-between-inserter.js +4 -1
  264. package/src/components/block-popover/inbetween.js +2 -13
  265. package/src/components/block-preview/auto.js +2 -17
  266. package/src/components/block-settings-menu/block-settings-dropdown.js +2 -12
  267. package/src/components/caption/index.native.js +0 -1
  268. package/src/components/colors-gradients/style.scss +8 -8
  269. package/src/components/date-format-picker/index.js +1 -1
  270. package/src/components/editor-styles/index.js +29 -1
  271. package/src/components/global-styles/README.md +129 -16
  272. package/src/components/global-styles/border-panel.js +13 -32
  273. package/src/components/global-styles/color-panel.js +706 -0
  274. package/src/components/global-styles/dimensions-panel.js +43 -55
  275. package/src/components/global-styles/effects-panel.js +228 -0
  276. package/src/components/global-styles/filters-panel.js +157 -0
  277. package/src/components/global-styles/get-block-css-selector.js +118 -0
  278. package/src/components/global-styles/hooks.js +90 -0
  279. package/src/components/global-styles/index.js +4 -1
  280. package/src/components/global-styles/style.scss +42 -0
  281. package/src/components/global-styles/test/use-global-styles-output.js +34 -5
  282. package/src/components/global-styles/typography-panel.js +26 -51
  283. package/src/components/global-styles/use-global-styles-output.js +188 -89
  284. package/src/components/global-styles/utils.js +3 -0
  285. package/src/components/iframe/index.js +1 -1
  286. package/src/components/image-size-control/index.js +4 -3
  287. package/src/components/image-size-control/test/index.js +2 -2
  288. package/src/components/image-size-control/use-dimension-handler.js +4 -3
  289. package/src/components/index.js +4 -1
  290. package/src/components/inner-blocks/README.md +1 -1
  291. package/src/components/inserter/block-patterns-tab.js +3 -1
  292. package/src/components/inspector-controls-tabs/position-controls-panel.js +40 -9
  293. package/src/components/inspector-controls-tabs/utils.js +4 -3
  294. package/src/components/line-height-control/index.js +10 -1
  295. package/src/components/list-view/README.md +2 -0
  296. package/src/components/list-view/appender.js +101 -0
  297. package/src/components/list-view/block.js +6 -4
  298. package/src/components/list-view/branch.js +30 -1
  299. package/src/components/list-view/index.js +60 -11
  300. package/src/components/list-view/style.scss +22 -1
  301. package/src/components/list-view/test/use-list-view-drop-zone.js +188 -0
  302. package/src/components/list-view/use-list-view-client-ids.js +5 -3
  303. package/src/components/list-view/use-list-view-drop-zone.js +9 -3
  304. package/src/components/media-replace-flow/index.js +36 -24
  305. package/src/components/media-replace-flow/style.scss +5 -2
  306. package/src/components/off-canvas-editor/block-contents.js +4 -0
  307. package/src/components/off-canvas-editor/index.js +15 -11
  308. package/src/components/resizable-box-popover/index.js +27 -0
  309. package/src/components/rich-text/format-edit.js +2 -32
  310. package/src/components/rich-text/index.js +0 -1
  311. package/src/components/rich-text/index.native.js +2 -5
  312. package/src/components/spacing-sizes-control/spacing-input-control.js +10 -0
  313. package/src/components/spacing-sizes-control/style.scss +7 -7
  314. package/src/components/writing-flow/use-input.js +4 -5
  315. package/src/hooks/anchor.js +1 -1
  316. package/src/hooks/border.js +1 -2
  317. package/src/hooks/color.js +120 -296
  318. package/src/hooks/content-lock-ui.js +6 -2
  319. package/src/hooks/{color-panel.js → contrast-checker.js} +10 -46
  320. package/src/hooks/dimensions.js +0 -1
  321. package/src/hooks/duotone.js +121 -76
  322. package/src/hooks/margin.js +31 -26
  323. package/src/hooks/padding.js +24 -18
  324. package/src/hooks/position.js +3 -3
  325. package/src/hooks/style.js +29 -28
  326. package/src/hooks/test/utils.js +0 -104
  327. package/src/hooks/typography.js +0 -1
  328. package/src/hooks/utils.js +31 -74
  329. package/src/layouts/grid.js +172 -0
  330. package/src/layouts/index.js +2 -1
  331. package/src/layouts/test/grid.js +21 -0
  332. package/src/layouts/utils.js +2 -2
  333. package/src/private-apis.js +4 -0
  334. package/src/store/actions.js +1 -1
  335. package/src/style.scss +1 -0
  336. package/src/utils/object.js +69 -0
  337. package/src/utils/test/object.js +145 -0
  338. package/tsconfig.tsbuildinfo +1 -1
  339. package/build/components/rich-text/use-native-props.js +0 -11
  340. package/build/components/rich-text/use-native-props.js.map +0 -1
  341. package/build/components/rich-text/use-native-props.native.js +0 -24
  342. package/build/components/rich-text/use-native-props.native.js.map +0 -1
  343. package/build/hooks/color-panel.js.map +0 -1
  344. package/build-module/components/rich-text/use-native-props.js +0 -4
  345. package/build-module/components/rich-text/use-native-props.js.map +0 -1
  346. package/build-module/components/rich-text/use-native-props.native.js +0 -15
  347. package/build-module/components/rich-text/use-native-props.native.js.map +0 -1
  348. package/build-module/hooks/color-panel.js.map +0 -1
  349. package/src/components/rich-text/use-native-props.js +0 -3
  350. package/src/components/rich-text/use-native-props.native.js +0 -17
@@ -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");
@@ -157,10 +159,10 @@ function getPresetsSvgFilters() {
157
159
  return _utils.PRESET_METADATA.filter( // Duotone are the only type of filters for now.
158
160
  metadata => metadata.path.at(-1) === 'duotone').flatMap(metadata => {
159
161
  const presetByOrigin = (0, _lodash.get)(blockPresets, metadata.path, {});
160
- 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, {
161
163
  preset: preset,
162
164
  key: preset.slug
163
- })));
165
+ })))).join('');
164
166
  });
165
167
  }
166
168
 
@@ -201,6 +203,76 @@ function concatFeatureVariationSelectorString(featureSelector, styleVariationSel
201
203
  });
202
204
  return combinedSelectors.join(', ');
203
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
+ };
204
276
  /**
205
277
  * Transform given style tree into a set of style declarations.
206
278
  *
@@ -222,13 +294,13 @@ function getStylesDeclarations() {
222
294
  let useRootPaddingAlign = arguments.length > 2 ? arguments[2] : undefined;
223
295
  let tree = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
224
296
  const isRoot = _utils.ROOT_BLOCK_SELECTOR === selector;
225
- const output = Object.entries(_blocks.__EXPERIMENTAL_STYLE_PROPERTY).reduce((declarations, _ref5) => {
297
+ const output = Object.entries(_blocks.__EXPERIMENTAL_STYLE_PROPERTY).reduce((declarations, _ref7) => {
226
298
  let [key, {
227
299
  value,
228
300
  properties,
229
301
  useEngine,
230
302
  rootOnly
231
- }] = _ref5;
303
+ }] = _ref7;
232
304
 
233
305
  if (rootOnly && !isRoot) {
234
306
  return declarations;
@@ -328,7 +400,7 @@ function getStylesDeclarations() {
328
400
  */
329
401
 
330
402
 
331
- function getLayoutStyles(_ref6) {
403
+ function getLayoutStyles(_ref8) {
332
404
  var _style$spacing, _tree$settings2, _tree$settings2$layou, _tree$settings3, _tree$settings3$layou;
333
405
 
334
406
  let {
@@ -338,7 +410,7 @@ function getLayoutStyles(_ref6) {
338
410
  hasBlockGapSupport,
339
411
  hasFallbackGapSupport,
340
412
  fallbackGapValue
341
- } = _ref6;
413
+ } = _ref8;
342
414
  let ruleset = '';
343
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,
344
416
  // and use a fallback value if one is provided for the current block.
@@ -352,12 +424,12 @@ function getLayoutStyles(_ref6) {
352
424
  }
353
425
 
354
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) {
355
- Object.values(tree.settings.layout.definitions).forEach(_ref7 => {
427
+ Object.values(tree.settings.layout.definitions).forEach(_ref9 => {
356
428
  let {
357
429
  className,
358
430
  name,
359
431
  spacingStyles
360
- } = _ref7;
432
+ } = _ref9;
361
433
 
362
434
  // Allow outputting fallback gap styles for flex layout type when block gap support isn't available.
363
435
  if (!hasBlockGapSupport && 'flex' !== name) {
@@ -369,8 +441,8 @@ function getLayoutStyles(_ref6) {
369
441
  const declarations = [];
370
442
 
371
443
  if (spacingStyle.rules) {
372
- Object.entries(spacingStyle.rules).forEach(_ref8 => {
373
- let [cssProperty, cssValue] = _ref8;
444
+ Object.entries(spacingStyle.rules).forEach(_ref10 => {
445
+ let [cssProperty, cssValue] = _ref10;
374
446
  declarations.push(`${cssProperty}: ${cssValue ? cssValue : gapValue}`);
375
447
  });
376
448
  }
@@ -382,7 +454,7 @@ function getLayoutStyles(_ref6) {
382
454
  // For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles.
383
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) || ''})`;
384
456
  } else {
385
- 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) || ''}`;
457
+ combinedSelector = selector === _utils.ROOT_BLOCK_SELECTOR ? `:where(${selector} .${className})${(spacingStyle === null || spacingStyle === void 0 ? void 0 : spacingStyle.selector) || ''}` : `${selector}-${className}${(spacingStyle === null || spacingStyle === void 0 ? void 0 : spacingStyle.selector) || ''}`;
386
458
  }
387
459
 
388
460
  ruleset += `${combinedSelector} { ${declarations.join('; ')}; }`;
@@ -399,12 +471,12 @@ function getLayoutStyles(_ref6) {
399
471
 
400
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) {
401
473
  const validDisplayModes = ['block', 'flex', 'grid'];
402
- Object.values(tree.settings.layout.definitions).forEach(_ref9 => {
474
+ Object.values(tree.settings.layout.definitions).forEach(_ref11 => {
403
475
  let {
404
476
  className,
405
477
  displayMode,
406
478
  baseStyles
407
- } = _ref9;
479
+ } = _ref11;
408
480
 
409
481
  if (displayMode && validDisplayModes.includes(displayMode)) {
410
482
  ruleset += `${selector} .${className} { display:${displayMode}; }`;
@@ -415,8 +487,8 @@ function getLayoutStyles(_ref6) {
415
487
  const declarations = [];
416
488
 
417
489
  if (baseStyle.rules) {
418
- Object.entries(baseStyle.rules).forEach(_ref10 => {
419
- let [cssProperty, cssValue] = _ref10;
490
+ Object.entries(baseStyle.rules).forEach(_ref12 => {
491
+ let [cssProperty, cssValue] = _ref12;
420
492
  declarations.push(`${cssProperty}: ${cssValue}`);
421
493
  });
422
494
  }
@@ -442,8 +514,8 @@ const getNodesWithStyles = (tree, blockSelectors) => {
442
514
  return nodes;
443
515
  }
444
516
 
445
- const pickStyleKeys = treeToPickFrom => Object.fromEntries(Object.entries(treeToPickFrom !== null && treeToPickFrom !== void 0 ? treeToPickFrom : {}).filter(_ref11 => {
446
- let [key] = _ref11;
517
+ const pickStyleKeys = treeToPickFrom => Object.fromEntries(Object.entries(treeToPickFrom !== null && treeToPickFrom !== void 0 ? treeToPickFrom : {}).filter(_ref13 => {
518
+ let [key] = _ref13;
447
519
  return ['border', 'color', 'dimensions', 'spacing', 'typography', 'filter', 'outline', 'shadow'].includes(key);
448
520
  })); // Top-level.
449
521
 
@@ -457,10 +529,10 @@ const getNodesWithStyles = (tree, blockSelectors) => {
457
529
  });
458
530
  }
459
531
 
460
- Object.entries(_blocks.__EXPERIMENTAL_ELEMENTS).forEach(_ref12 => {
532
+ Object.entries(_blocks.__EXPERIMENTAL_ELEMENTS).forEach(_ref14 => {
461
533
  var _tree$styles, _tree$styles$elements;
462
534
 
463
- let [name, selector] = _ref12;
535
+ let [name, selector] = _ref14;
464
536
 
465
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])) {
466
538
  var _tree$styles2, _tree$styles2$element;
@@ -472,10 +544,10 @@ const getNodesWithStyles = (tree, blockSelectors) => {
472
544
  }
473
545
  }); // Iterate over blocks: they can have styles & elements.
474
546
 
475
- 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 => {
476
548
  var _blockSelectors$block, _node$elements;
477
549
 
478
- let [blockName, node] = _ref13;
550
+ let [blockName, node] = _ref15;
479
551
  const blockStyles = pickStyleKeys(node);
480
552
 
481
553
  if (node !== null && node !== void 0 && node.variations) {
@@ -500,8 +572,8 @@ const getNodesWithStyles = (tree, blockSelectors) => {
500
572
  });
501
573
  }
502
574
 
503
- Object.entries((_node$elements = node === null || node === void 0 ? void 0 : node.elements) !== null && _node$elements !== void 0 ? _node$elements : {}).forEach(_ref14 => {
504
- 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;
505
577
 
506
578
  if (!!value && !!(blockSelectors !== null && blockSelectors !== void 0 && blockSelectors[blockName]) && !!(_blocks.__EXPERIMENTAL_ELEMENTS !== null && _blocks.__EXPERIMENTAL_ELEMENTS !== void 0 && _blocks.__EXPERIMENTAL_ELEMENTS[elementName])) {
507
579
  var _blockSelectors$block3;
@@ -534,10 +606,10 @@ const getNodesWithSettings = (tree, blockSelectors) => {
534
606
  const pickPresets = treeToPickFrom => {
535
607
  const presets = {};
536
608
 
537
- _utils.PRESET_METADATA.forEach(_ref15 => {
609
+ _utils.PRESET_METADATA.forEach(_ref17 => {
538
610
  let {
539
611
  path
540
- } = _ref15;
612
+ } = _ref17;
541
613
  const value = (0, _lodash.get)(treeToPickFrom, path, false);
542
614
 
543
615
  if (value !== false) {
@@ -561,8 +633,8 @@ const getNodesWithSettings = (tree, blockSelectors) => {
561
633
  } // Blocks.
562
634
 
563
635
 
564
- 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 => {
565
- 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;
566
638
  const blockPresets = pickPresets(node);
567
639
  const blockCustom = node.custom;
568
640
 
@@ -584,12 +656,12 @@ exports.getNodesWithSettings = getNodesWithSettings;
584
656
  const toCustomProperties = (tree, blockSelectors) => {
585
657
  const settings = getNodesWithSettings(tree, blockSelectors);
586
658
  let ruleset = '';
587
- settings.forEach(_ref17 => {
659
+ settings.forEach(_ref19 => {
588
660
  let {
589
661
  presets,
590
662
  custom,
591
663
  selector
592
- } = _ref17;
664
+ } = _ref19;
593
665
  const declarations = getPresetsDeclarations(presets, tree === null || tree === void 0 ? void 0 : tree.settings);
594
666
  const customProps = flattenTree(custom, '--wp--custom--', '--');
595
667
 
@@ -651,7 +723,7 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
651
723
  }
652
724
 
653
725
  ruleset += '}';
654
- nodesWithStyles.forEach(_ref18 => {
726
+ nodesWithStyles.forEach(_ref20 => {
655
727
  let {
656
728
  selector,
657
729
  duotoneSelector,
@@ -660,54 +732,43 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
660
732
  hasLayoutSupport,
661
733
  featureSelectors,
662
734
  styleVariationSelectors
663
- } = _ref18;
735
+ } = _ref20;
664
736
 
665
737
  // Process styles for block support features with custom feature level
666
738
  // CSS selectors set.
667
739
  if (featureSelectors) {
668
- Object.entries(featureSelectors).forEach(_ref19 => {
669
- let [featureName, featureSelector] = _ref19;
670
-
671
- if (styles !== null && styles !== void 0 && styles[featureName]) {
672
- const featureStyles = {
673
- [featureName]: styles[featureName]
674
- };
675
- const featureDeclarations = getStylesDeclarations(featureStyles);
676
- delete styles[featureName];
677
-
678
- if (!!featureDeclarations.length) {
679
- ruleset = ruleset + `${featureSelector}{${featureDeclarations.join(';')} }`;
680
- }
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}}`;
681
747
  }
682
748
  });
683
749
  }
684
750
 
685
751
  if (styleVariationSelectors) {
686
- Object.entries(styleVariationSelectors).forEach(_ref20 => {
752
+ Object.entries(styleVariationSelectors).forEach(_ref22 => {
687
753
  var _styles$variations;
688
754
 
689
- let [styleVariationName, styleVariationSelector] = _ref20;
755
+ let [styleVariationName, styleVariationSelector] = _ref22;
690
756
 
691
757
  if (styles !== null && styles !== void 0 && (_styles$variations = styles.variations) !== null && _styles$variations !== void 0 && _styles$variations[styleVariationName]) {
692
758
  var _styles$variations3;
693
759
 
694
760
  // If the block uses any custom selectors for block support, add those first.
695
761
  if (featureSelectors) {
696
- Object.entries(featureSelectors).forEach(_ref21 => {
697
- var _styles$variations2, _styles$variations2$s;
762
+ var _styles$variations2;
698
763
 
699
- let [featureName, featureSelector] = _ref21;
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 (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]) {
702
- const featureStyles = {
703
- [featureName]: styles.variations[styleVariationName][featureName]
704
- };
705
- const featureDeclarations = getStylesDeclarations(featureStyles);
706
- delete styles.variations[styleVariationName][featureName];
707
-
708
- if (!!featureDeclarations.length) {
709
- ruleset = ruleset + `${concatFeatureVariationSelectorString(featureSelector, styleVariationSelector)}{${featureDeclarations.join(';')} }`;
710
- }
768
+ if (!!declarations.length) {
769
+ const cssSelector = concatFeatureVariationSelectorString(baseSelector, styleVariationSelector);
770
+ const rules = declarations.join(';');
771
+ ruleset = ruleset + `${cssSelector}{${rules}}`;
711
772
  }
712
773
  });
713
774
  } // Otherwise add regular selectors.
@@ -727,14 +788,14 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
727
788
  if (styles !== null && styles !== void 0 && styles.filter) {
728
789
  duotoneStyles.filter = styles.filter;
729
790
  delete styles.filter;
730
- } // Process duotone styles (they use color.__experimentalDuotone selector).
791
+ } // Process duotone styles.
731
792
 
732
793
 
733
794
  if (duotoneSelector) {
734
795
  const duotoneDeclarations = getStylesDeclarations(duotoneStyles);
735
796
 
736
797
  if (duotoneDeclarations.length > 0) {
737
- ruleset = ruleset + `${(0, _utils.scopeSelector)(selector, duotoneSelector)}{${duotoneDeclarations.join(';')};}`;
798
+ ruleset = ruleset + `${duotoneSelector}{${duotoneDeclarations.join(';')};}`;
738
799
  }
739
800
  } // Process blockGap and layout styles.
740
801
 
@@ -758,14 +819,14 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
758
819
  } // Check for pseudo selector in `styles` and handle separately.
759
820
 
760
821
 
761
- const pseudoSelectorStyles = Object.entries(styles).filter(_ref22 => {
762
- let [key] = _ref22;
822
+ const pseudoSelectorStyles = Object.entries(styles).filter(_ref24 => {
823
+ let [key] = _ref24;
763
824
  return key.startsWith(':');
764
825
  });
765
826
 
766
827
  if (pseudoSelectorStyles !== null && pseudoSelectorStyles !== void 0 && pseudoSelectorStyles.length) {
767
- pseudoSelectorStyles.forEach(_ref23 => {
768
- let [pseudoKey, pseudoStyle] = _ref23;
828
+ pseudoSelectorStyles.forEach(_ref25 => {
829
+ let [pseudoKey, pseudoStyle] = _ref25;
769
830
  const pseudoDeclarations = getStylesDeclarations(pseudoStyle);
770
831
 
771
832
  if (!(pseudoDeclarations !== null && pseudoDeclarations !== void 0 && pseudoDeclarations.length)) {
@@ -797,15 +858,16 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
797
858
 
798
859
  // Use fallback of `0.5em` just in case, however if there is blockGap support, there should nearly always be a real value.
799
860
  const gapValue = (0, _gap.getGapCSSValue)(tree === null || tree === void 0 ? void 0 : (_tree$styles4 = tree.styles) === null || _tree$styles4 === void 0 ? void 0 : (_tree$styles4$spacing = _tree$styles4.spacing) === null || _tree$styles4$spacing === void 0 ? void 0 : _tree$styles4$spacing.blockGap) || '0.5em';
800
- ruleset = ruleset + '.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }';
801
- ruleset = ruleset + `.wp-site-blocks > * + * { margin-block-start: ${gapValue}; }`;
861
+ ruleset = ruleset + `:where(.wp-site-blocks) > * { margin-block-start: ${gapValue}; margin-block-end: 0; }`;
862
+ ruleset = ruleset + ':where(.wp-site-blocks) > :first-child:first-child { margin-block-start: 0; }';
863
+ ruleset = ruleset + ':where(.wp-site-blocks) > :last-child:last-child { margin-block-end: 0; }';
802
864
  }
803
865
 
804
- nodesWithSettings.forEach(_ref24 => {
866
+ nodesWithSettings.forEach(_ref26 => {
805
867
  let {
806
868
  selector,
807
869
  presets
808
- } = _ref24;
870
+ } = _ref26;
809
871
 
810
872
  if (_utils.ROOT_BLOCK_SELECTOR === selector) {
811
873
  // Do not add extra specificity for top-level classes.
@@ -825,24 +887,50 @@ exports.toStyles = toStyles;
825
887
 
826
888
  function toSvgFilters(tree, blockSelectors) {
827
889
  const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
828
- return nodesWithSettings.flatMap(_ref25 => {
890
+ return nodesWithSettings.flatMap(_ref27 => {
829
891
  let {
830
892
  presets
831
- } = _ref25;
893
+ } = _ref27;
832
894
  return getPresetsSvgFilters(presets);
833
895
  });
834
896
  }
835
897
 
898
+ const getSelectorsConfig = (blockType, rootSelector) => {
899
+ if (!(0, _lodash.isEmpty)(blockType === null || blockType === void 0 ? void 0 : blockType.selectors)) {
900
+ return blockType.selectors;
901
+ }
902
+
903
+ const config = {
904
+ root: rootSelector
905
+ };
906
+ Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(_ref28 => {
907
+ let [featureKey, featureName] = _ref28;
908
+ const featureSelector = (0, _getBlockCssSelector.getBlockCSSSelector)(blockType, featureKey);
909
+
910
+ if (featureSelector) {
911
+ config[featureName] = featureSelector;
912
+ }
913
+ });
914
+ return config;
915
+ };
916
+
836
917
  const getBlockSelectors = (blockTypes, getBlockStyles) => {
837
918
  const result = {};
838
919
  blockTypes.forEach(blockType => {
839
- var _blockType$supports$_, _blockType$supports, _blockType$supports$c, _blockType$supports2, _blockType$supports2$, _blockType$supports3, _blockType$supports4, _blockType$supports4$, _blockType$supports4$2;
920
+ var _blockType$supports, _blockType$supports2, _blockType$supports2$, _blockType$supports2$2;
840
921
 
841
922
  const name = blockType.name;
842
- 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('/', '-');
843
- 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;
844
- const hasLayoutSupport = !!(blockType !== null && blockType !== void 0 && (_blockType$supports3 = blockType.supports) !== null && _blockType$supports3 !== void 0 && _blockType$supports3.__experimentalLayout);
845
- 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;
923
+ const selector = (0, _getBlockCssSelector.getBlockCSSSelector)(blockType);
924
+ let duotoneSelector = (0, _getBlockCssSelector.getBlockCSSSelector)(blockType, 'filter.duotone'); // Keep backwards compatibility for support.color.__experimentalDuotone.
925
+
926
+ if (!duotoneSelector) {
927
+ const rootSelector = (0, _getBlockCssSelector.getBlockCSSSelector)(blockType);
928
+ const duotoneSupport = (0, _blocks.getBlockSupport)(blockType, 'color.__experimentalDuotone', false);
929
+ duotoneSelector = duotoneSupport && (0, _utils.scopeSelector)(rootSelector, duotoneSupport);
930
+ }
931
+
932
+ const hasLayoutSupport = !!(blockType !== null && blockType !== void 0 && (_blockType$supports = blockType.supports) !== null && _blockType$supports !== void 0 && _blockType$supports.__experimentalLayout);
933
+ 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;
846
934
  const blockStyleVariations = getBlockStyles(name);
847
935
  const styleVariationSelectors = {};
848
936
 
@@ -854,17 +942,7 @@ const getBlockSelectors = (blockTypes, getBlockStyles) => {
854
942
  } // For each block support feature add any custom selectors.
855
943
 
856
944
 
857
- const featureSelectors = {};
858
- Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(_ref26 => {
859
- var _blockType$supports5, _blockType$supports5$;
860
-
861
- let [featureKey, featureName] = _ref26;
862
- 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;
863
-
864
- if (featureSelector) {
865
- featureSelectors[featureName] = (0, _utils.scopeSelector)(selector, featureSelector);
866
- }
867
- });
945
+ const featureSelectors = getSelectorsConfig(blockType, selector);
868
946
  result[name] = {
869
947
  duotoneSelector,
870
948
  fallbackGapValue,
@@ -951,8 +1029,8 @@ function useGlobalStylesOutput() {
951
1029
  const blockSelectors = getBlockSelectors((0, _blocks.getBlockTypes)(), getBlockStyles);
952
1030
  const customProperties = toCustomProperties(mergedConfig, blockSelectors);
953
1031
  const globalStyles = toStyles(mergedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles);
954
- const filters = toSvgFilters(mergedConfig, blockSelectors);
955
- const stylesheets = [{
1032
+ const svgs = toSvgFilters(mergedConfig, blockSelectors);
1033
+ const styles = [{
956
1034
  css: customProperties,
957
1035
  isGlobalStyles: true
958
1036
  }, {
@@ -962,6 +1040,10 @@ function useGlobalStylesOutput() {
962
1040
  {
963
1041
  css: (_mergedConfig$styles$ = mergedConfig.styles.css) !== null && _mergedConfig$styles$ !== void 0 ? _mergedConfig$styles$ : '',
964
1042
  isGlobalStyles: true
1043
+ }, {
1044
+ assets: svgs,
1045
+ __unstableType: 'svg',
1046
+ isGlobalStyles: true
965
1047
  }]; // Loop through the blocks to check if there are custom CSS values.
966
1048
  // If there are, get the block selector and push the selector together with
967
1049
  // the CSS value to the 'stylesheets' array.
@@ -973,13 +1055,13 @@ function useGlobalStylesOutput() {
973
1055
  var _mergedConfig$styles$3;
974
1056
 
975
1057
  const selector = blockSelectors[blockType.name].selector;
976
- stylesheets.push({
1058
+ styles.push({
977
1059
  css: processCSSNesting((_mergedConfig$styles$3 = mergedConfig.styles.blocks[blockType.name]) === null || _mergedConfig$styles$3 === void 0 ? void 0 : _mergedConfig$styles$3.css, selector),
978
1060
  isGlobalStyles: true
979
1061
  });
980
1062
  }
981
1063
  });
982
- return [stylesheets, mergedConfig.settings, filters];
1064
+ return [styles, mergedConfig.settings];
983
1065
  }, [hasBlockGapSupport, hasFallbackGapSupport, mergedConfig, disableLayoutStyles]);
984
1066
  }
985
1067
  //# sourceMappingURL=use-global-styles-output.js.map