@wordpress/edit-site 5.2.0 → 5.3.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 (374) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/add-new-template/add-custom-generic-template-modal.js +8 -10
  3. package/build/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  4. package/build/components/add-new-template/add-custom-template-modal.js +0 -1
  5. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  6. package/build/components/add-new-template/new-template-part.js +5 -29
  7. package/build/components/add-new-template/new-template-part.js.map +1 -1
  8. package/build/components/add-new-template/utils.js +1 -9
  9. package/build/components/add-new-template/utils.js.map +1 -1
  10. package/build/components/app/index.js +2 -7
  11. package/build/components/app/index.js.map +1 -1
  12. package/build/components/block-editor/index.js +13 -11
  13. package/build/components/block-editor/index.js.map +1 -1
  14. package/build/components/block-editor/inserter-media-categories.js +237 -0
  15. package/build/components/block-editor/inserter-media-categories.js.map +1 -0
  16. package/build/components/canvas-spinner/index.js +20 -0
  17. package/build/components/canvas-spinner/index.js.map +1 -0
  18. package/build/components/create-template-part-modal/index.js +4 -2
  19. package/build/components/create-template-part-modal/index.js.map +1 -1
  20. package/build/components/editor/index.js +4 -2
  21. package/build/components/editor/index.js.map +1 -1
  22. package/build/components/error-boundary/index.js +2 -12
  23. package/build/components/error-boundary/index.js.map +1 -1
  24. package/build/components/error-boundary/warning.js +5 -28
  25. package/build/components/error-boundary/warning.js.map +1 -1
  26. package/build/components/global-styles/block-preview-panel.js +2 -2
  27. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  28. package/build/components/global-styles/border-panel.js +17 -9
  29. package/build/components/global-styles/border-panel.js.map +1 -1
  30. package/build/components/global-styles/color-palette-panel.js +13 -7
  31. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  32. package/build/components/global-styles/context-menu.js +39 -4
  33. package/build/components/global-styles/context-menu.js.map +1 -1
  34. package/build/components/global-styles/custom-css.js +65 -14
  35. package/build/components/global-styles/custom-css.js.map +1 -1
  36. package/build/components/global-styles/dimensions-panel.js +49 -31
  37. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  38. package/build/components/global-styles/global-styles-provider.js +13 -3
  39. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  40. package/build/components/global-styles/gradients-palette-panel.js +17 -11
  41. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  42. package/build/components/global-styles/hooks.js +21 -142
  43. package/build/components/global-styles/hooks.js.map +1 -1
  44. package/build/components/global-styles/index.js +0 -28
  45. package/build/components/global-styles/index.js.map +1 -1
  46. package/build/components/global-styles/palette.js +11 -4
  47. package/build/components/global-styles/palette.js.map +1 -1
  48. package/build/components/global-styles/preview.js +18 -15
  49. package/build/components/global-styles/preview.js.map +1 -1
  50. package/build/components/global-styles/screen-background-color.js +27 -13
  51. package/build/components/global-styles/screen-background-color.js.map +1 -1
  52. package/build/components/global-styles/screen-border.js +10 -4
  53. package/build/components/global-styles/screen-border.js.map +1 -1
  54. package/build/components/global-styles/screen-button-color.js +16 -9
  55. package/build/components/global-styles/screen-button-color.js.map +1 -1
  56. package/build/components/global-styles/screen-colors.js +43 -34
  57. package/build/components/global-styles/screen-colors.js.map +1 -1
  58. package/build/components/global-styles/screen-css.js +20 -8
  59. package/build/components/global-styles/screen-css.js.map +1 -1
  60. package/build/components/global-styles/screen-heading-color.js +23 -16
  61. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  62. package/build/components/global-styles/screen-layout.js +3 -3
  63. package/build/components/global-styles/screen-layout.js.map +1 -1
  64. package/build/components/global-styles/screen-link-color.js +18 -11
  65. package/build/components/global-styles/screen-link-color.js.map +1 -1
  66. package/build/components/global-styles/screen-root.js +25 -9
  67. package/build/components/global-styles/screen-root.js.map +1 -1
  68. package/build/components/global-styles/screen-style-variations.js +8 -4
  69. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  70. package/build/components/global-styles/screen-text-color.js +14 -7
  71. package/build/components/global-styles/screen-text-color.js.map +1 -1
  72. package/build/components/global-styles/screen-typography.js +18 -12
  73. package/build/components/global-styles/screen-typography.js.map +1 -1
  74. package/build/components/global-styles/shadow-panel.js +196 -0
  75. package/build/components/global-styles/shadow-panel.js.map +1 -0
  76. package/build/components/global-styles/typography-panel.js +43 -29
  77. package/build/components/global-styles/typography-panel.js.map +1 -1
  78. package/build/components/global-styles/typography-preview.js +19 -9
  79. package/build/components/global-styles/typography-preview.js.map +1 -1
  80. package/build/components/global-styles/ui.js +85 -34
  81. package/build/components/global-styles/ui.js.map +1 -1
  82. package/build/components/global-styles/utils.js +5 -334
  83. package/build/components/global-styles/utils.js.map +1 -1
  84. package/build/components/global-styles-renderer/index.js +7 -5
  85. package/build/components/global-styles-renderer/index.js.map +1 -1
  86. package/build/components/header-edit-mode/document-actions/index.js +2 -2
  87. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  88. package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
  89. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  90. package/build/components/layout/index.js +6 -8
  91. package/build/components/layout/index.js.map +1 -1
  92. package/build/components/list/actions/rename-menu-item.js +8 -11
  93. package/build/components/list/actions/rename-menu-item.js.map +1 -1
  94. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +1 -2
  95. package/build/components/navigation-inspector/index.js.map +1 -0
  96. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -15
  97. package/build/components/navigation-inspector/navigation-menu.js.map +1 -0
  98. package/build/components/sidebar/index.js +3 -1
  99. package/build/components/sidebar/index.js.map +1 -1
  100. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +3 -18
  101. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  102. package/build/components/sidebar-edit-mode/index.js +1 -14
  103. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  104. package/build/components/sidebar-navigation-screen/index.js +3 -2
  105. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  106. package/build/components/sidebar-navigation-screen-main/index.js +23 -1
  107. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  108. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +35 -0
  109. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  110. package/build/components/sidebar-navigation-screen-templates/index.js +3 -8
  111. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  112. package/build/components/site-hub/index.js +2 -2
  113. package/build/components/site-hub/index.js.map +1 -1
  114. package/build/components/site-icon/index.js +1 -1
  115. package/build/components/site-icon/index.js.map +1 -1
  116. package/build/components/style-book/index.js +7 -4
  117. package/build/components/style-book/index.js.map +1 -1
  118. package/build/components/template-part-converter/convert-to-template-part.js +5 -9
  119. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  120. package/build/experiments.js +19 -0
  121. package/build/experiments.js.map +1 -0
  122. package/build/hooks/push-changes-to-global-styles/index.js +65 -6
  123. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  124. package/build/index.js +53 -60
  125. package/build/index.js.map +1 -1
  126. package/build/store/selectors.js +7 -27
  127. package/build/store/selectors.js.map +1 -1
  128. package/build/store/utils.js +77 -0
  129. package/build/store/utils.js.map +1 -0
  130. package/build/utils/template-part-create.js +71 -0
  131. package/build/utils/template-part-create.js.map +1 -0
  132. package/build-module/components/add-new-template/add-custom-generic-template-modal.js +9 -11
  133. package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  134. package/build-module/components/add-new-template/add-custom-template-modal.js +0 -1
  135. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  136. package/build-module/components/add-new-template/new-template-part.js +4 -27
  137. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  138. package/build-module/components/add-new-template/utils.js +0 -5
  139. package/build-module/components/add-new-template/utils.js.map +1 -1
  140. package/build-module/components/app/index.js +2 -7
  141. package/build-module/components/app/index.js.map +1 -1
  142. package/build-module/components/block-editor/index.js +14 -12
  143. package/build-module/components/block-editor/index.js.map +1 -1
  144. package/build-module/components/block-editor/inserter-media-categories.js +225 -0
  145. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -0
  146. package/build-module/components/canvas-spinner/index.js +12 -0
  147. package/build-module/components/canvas-spinner/index.js.map +1 -0
  148. package/build-module/components/create-template-part-modal/index.js +5 -3
  149. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  150. package/build-module/components/editor/index.js +3 -2
  151. package/build-module/components/editor/index.js.map +1 -1
  152. package/build-module/components/error-boundary/index.js +2 -12
  153. package/build-module/components/error-boundary/index.js.map +1 -1
  154. package/build-module/components/error-boundary/warning.js +5 -28
  155. package/build-module/components/error-boundary/warning.js.map +1 -1
  156. package/build-module/components/global-styles/block-preview-panel.js +2 -2
  157. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  158. package/build-module/components/global-styles/border-panel.js +17 -11
  159. package/build-module/components/global-styles/border-panel.js.map +1 -1
  160. package/build-module/components/global-styles/color-palette-panel.js +11 -7
  161. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  162. package/build-module/components/global-styles/context-menu.js +40 -8
  163. package/build-module/components/global-styles/context-menu.js.map +1 -1
  164. package/build-module/components/global-styles/custom-css.js +61 -15
  165. package/build-module/components/global-styles/custom-css.js.map +1 -1
  166. package/build-module/components/global-styles/dimensions-panel.js +49 -32
  167. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  168. package/build-module/components/global-styles/global-styles-provider.js +7 -2
  169. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  170. package/build-module/components/global-styles/gradients-palette-panel.js +15 -11
  171. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  172. package/build-module/components/global-styles/hooks.js +23 -134
  173. package/build-module/components/global-styles/hooks.js.map +1 -1
  174. package/build-module/components/global-styles/index.js +0 -2
  175. package/build-module/components/global-styles/index.js.map +1 -1
  176. package/build-module/components/global-styles/palette.js +10 -5
  177. package/build-module/components/global-styles/palette.js.map +1 -1
  178. package/build-module/components/global-styles/preview.js +18 -14
  179. package/build-module/components/global-styles/preview.js.map +1 -1
  180. package/build-module/components/global-styles/screen-background-color.js +26 -15
  181. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  182. package/build-module/components/global-styles/screen-border.js +10 -5
  183. package/build-module/components/global-styles/screen-border.js.map +1 -1
  184. package/build-module/components/global-styles/screen-button-color.js +16 -11
  185. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  186. package/build-module/components/global-styles/screen-colors.js +43 -37
  187. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  188. package/build-module/components/global-styles/screen-css.js +21 -9
  189. package/build-module/components/global-styles/screen-css.js.map +1 -1
  190. package/build-module/components/global-styles/screen-heading-color.js +23 -18
  191. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  192. package/build-module/components/global-styles/screen-layout.js +4 -4
  193. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  194. package/build-module/components/global-styles/screen-link-color.js +18 -13
  195. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  196. package/build-module/components/global-styles/screen-root.js +23 -9
  197. package/build-module/components/global-styles/screen-root.js.map +1 -1
  198. package/build-module/components/global-styles/screen-style-variations.js +5 -2
  199. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  200. package/build-module/components/global-styles/screen-text-color.js +14 -9
  201. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  202. package/build-module/components/global-styles/screen-typography.js +16 -12
  203. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  204. package/build-module/components/global-styles/shadow-panel.js +177 -0
  205. package/build-module/components/global-styles/shadow-panel.js.map +1 -0
  206. package/build-module/components/global-styles/typography-panel.js +43 -31
  207. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  208. package/build-module/components/global-styles/typography-preview.js +17 -9
  209. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  210. package/build-module/components/global-styles/ui.js +80 -35
  211. package/build-module/components/global-styles/ui.js.map +1 -1
  212. package/build-module/components/global-styles/utils.js +4 -319
  213. package/build-module/components/global-styles/utils.js.map +1 -1
  214. package/build-module/components/global-styles-renderer/index.js +5 -5
  215. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  216. package/build-module/components/header-edit-mode/document-actions/index.js +2 -2
  217. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  218. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
  219. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  220. package/build-module/components/layout/index.js +6 -8
  221. package/build-module/components/layout/index.js.map +1 -1
  222. package/build-module/components/list/actions/rename-menu-item.js +9 -12
  223. package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
  224. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +1 -2
  225. package/build-module/components/navigation-inspector/index.js.map +1 -0
  226. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -16
  227. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -0
  228. package/build-module/components/sidebar/index.js +2 -1
  229. package/build-module/components/sidebar/index.js.map +1 -1
  230. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +6 -21
  231. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  232. package/build-module/components/sidebar-edit-mode/index.js +1 -13
  233. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  234. package/build-module/components/sidebar-navigation-screen/index.js +3 -2
  235. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  236. package/build-module/components/sidebar-navigation-screen-main/index.js +22 -2
  237. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  238. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +23 -0
  239. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  240. package/build-module/components/sidebar-navigation-screen-templates/index.js +4 -9
  241. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  242. package/build-module/components/site-hub/index.js +2 -2
  243. package/build-module/components/site-hub/index.js.map +1 -1
  244. package/build-module/components/site-icon/index.js +1 -1
  245. package/build-module/components/site-icon/index.js.map +1 -1
  246. package/build-module/components/style-book/index.js +8 -5
  247. package/build-module/components/style-book/index.js.map +1 -1
  248. package/build-module/components/template-part-converter/convert-to-template-part.js +5 -9
  249. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  250. package/build-module/experiments.js +9 -0
  251. package/build-module/experiments.js.map +1 -0
  252. package/build-module/hooks/push-changes-to-global-styles/index.js +62 -3
  253. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  254. package/build-module/index.js +52 -60
  255. package/build-module/index.js.map +1 -1
  256. package/build-module/store/selectors.js +6 -26
  257. package/build-module/store/selectors.js.map +1 -1
  258. package/build-module/store/utils.js +66 -0
  259. package/build-module/store/utils.js.map +1 -0
  260. package/build-module/utils/template-part-create.js +53 -0
  261. package/build-module/utils/template-part-create.js.map +1 -0
  262. package/build-style/style-rtl.css +314 -216
  263. package/build-style/style.css +314 -216
  264. package/package.json +32 -30
  265. package/src/components/add-new-template/add-custom-generic-template-modal.js +20 -28
  266. package/src/components/add-new-template/add-custom-template-modal.js +0 -1
  267. package/src/components/add-new-template/new-template-part.js +11 -32
  268. package/src/components/add-new-template/style.scss +0 -4
  269. package/src/components/add-new-template/utils.js +0 -14
  270. package/src/components/app/index.js +2 -2
  271. package/src/components/block-editor/index.js +12 -25
  272. package/src/components/block-editor/inserter-media-categories.js +247 -0
  273. package/src/components/block-editor/style.scss +19 -7
  274. package/src/components/canvas-spinner/index.js +12 -0
  275. package/src/components/canvas-spinner/style.scss +7 -0
  276. package/src/components/create-template-part-modal/index.js +75 -67
  277. package/src/components/create-template-part-modal/style.scss +0 -10
  278. package/src/components/editor/index.js +4 -2
  279. package/src/components/error-boundary/index.js +2 -10
  280. package/src/components/error-boundary/warning.js +6 -35
  281. package/src/components/global-styles/README.md +1 -75
  282. package/src/components/global-styles/block-preview-panel.js +2 -2
  283. package/src/components/global-styles/border-panel.js +19 -17
  284. package/src/components/global-styles/color-palette-panel.js +10 -7
  285. package/src/components/global-styles/context-menu.js +114 -44
  286. package/src/components/global-styles/custom-css.js +76 -19
  287. package/src/components/global-styles/dimensions-panel.js +46 -36
  288. package/src/components/global-styles/global-styles-provider.js +6 -2
  289. package/src/components/global-styles/gradients-palette-panel.js +17 -11
  290. package/src/components/global-styles/hooks.js +31 -155
  291. package/src/components/global-styles/index.js +0 -2
  292. package/src/components/global-styles/palette.js +9 -5
  293. package/src/components/global-styles/preview.js +19 -13
  294. package/src/components/global-styles/screen-background-color.js +37 -21
  295. package/src/components/global-styles/screen-border.js +10 -5
  296. package/src/components/global-styles/screen-button-color.js +21 -19
  297. package/src/components/global-styles/screen-colors.js +48 -65
  298. package/src/components/global-styles/screen-css.js +30 -14
  299. package/src/components/global-styles/screen-heading-color.js +32 -27
  300. package/src/components/global-styles/screen-layout.js +4 -7
  301. package/src/components/global-styles/screen-link-color.js +26 -26
  302. package/src/components/global-styles/screen-root.js +24 -9
  303. package/src/components/global-styles/screen-style-variations.js +7 -2
  304. package/src/components/global-styles/screen-text-color.js +15 -19
  305. package/src/components/global-styles/screen-typography.js +27 -12
  306. package/src/components/global-styles/shadow-panel.js +174 -0
  307. package/src/components/global-styles/style.scss +85 -1
  308. package/src/components/global-styles/typography-panel.js +60 -48
  309. package/src/components/global-styles/typography-preview.js +28 -9
  310. package/src/components/global-styles/ui.js +78 -53
  311. package/src/components/global-styles/utils.js +4 -371
  312. package/src/components/global-styles-renderer/index.js +3 -4
  313. package/src/components/header-edit-mode/document-actions/index.js +1 -1
  314. package/src/components/keyboard-shortcut-help-modal/index.js +0 -1
  315. package/src/components/layout/index.js +9 -2
  316. package/src/components/layout/style.scss +4 -5
  317. package/src/components/list/actions/rename-menu-item.js +14 -23
  318. package/src/components/list/style.scss +0 -4
  319. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +1 -4
  320. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +10 -12
  321. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/style.scss +0 -17
  322. package/src/components/sidebar/index.js +2 -0
  323. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +8 -32
  324. package/src/components/sidebar-edit-mode/index.js +0 -11
  325. package/src/components/sidebar-edit-mode/settings-header/style.scss +8 -0
  326. package/src/components/sidebar-navigation-item/style.scss +28 -3
  327. package/src/components/sidebar-navigation-screen/index.js +4 -3
  328. package/src/components/sidebar-navigation-screen/style.scss +2 -0
  329. package/src/components/sidebar-navigation-screen-main/index.js +23 -1
  330. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +25 -0
  331. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +12 -0
  332. package/src/components/sidebar-navigation-screen-templates/index.js +12 -19
  333. package/src/components/site-hub/index.js +1 -1
  334. package/src/components/site-hub/style.scss +7 -1
  335. package/src/components/site-icon/index.js +1 -1
  336. package/src/components/site-icon/style.scss +2 -2
  337. package/src/components/style-book/index.js +10 -5
  338. package/src/components/template-part-converter/convert-to-template-part.js +12 -10
  339. package/src/experiments.js +10 -0
  340. package/src/hooks/push-changes-to-global-styles/index.js +63 -5
  341. package/src/index.js +51 -59
  342. package/src/store/selectors.js +6 -26
  343. package/src/store/test/utils.js +181 -0
  344. package/src/store/utils.js +69 -0
  345. package/src/style.scss +4 -2
  346. package/src/utils/template-part-create.js +62 -0
  347. package/src/utils/test/template-part-create.js +63 -0
  348. package/build/components/global-styles/context.js +0 -22
  349. package/build/components/global-styles/context.js.map +0 -1
  350. package/build/components/global-styles/typography-utils.js +0 -92
  351. package/build/components/global-styles/typography-utils.js.map +0 -1
  352. package/build/components/global-styles/use-global-styles-output.js +0 -943
  353. package/build/components/global-styles/use-global-styles-output.js.map +0 -1
  354. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -42
  355. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  356. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  357. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  358. package/build-module/components/global-styles/context.js +0 -12
  359. package/build-module/components/global-styles/context.js.map +0 -1
  360. package/build-module/components/global-styles/typography-utils.js +0 -84
  361. package/build-module/components/global-styles/typography-utils.js.map +0 -1
  362. package/build-module/components/global-styles/use-global-styles-output.js +0 -901
  363. package/build-module/components/global-styles/use-global-styles-output.js.map +0 -1
  364. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -28
  365. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  366. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  367. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  368. package/src/components/global-styles/context.js +0 -15
  369. package/src/components/global-styles/test/typography-utils.js +0 -393
  370. package/src/components/global-styles/test/use-global-styles-output.js +0 -814
  371. package/src/components/global-styles/test/utils.js +0 -206
  372. package/src/components/global-styles/typography-utils.js +0 -87
  373. package/src/components/global-styles/use-global-styles-output.js +0 -1059
  374. package/src/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -37
@@ -1,7 +1,14 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
5
+
1
6
  /**
2
7
  * Internal dependencies
3
8
  */
4
- import { useStyle } from './hooks';
9
+ import { unlock } from '../../experiments';
10
+
11
+ const { useGlobalStyle } = unlock( blockEditorExperiments );
5
12
 
6
13
  export default function TypographyPreview( { name, element, headingLevel } ) {
7
14
  let prefix = '';
@@ -11,14 +18,26 @@ export default function TypographyPreview( { name, element, headingLevel } ) {
11
18
  prefix = `elements.${ element }.`;
12
19
  }
13
20
 
14
- const [ fontFamily ] = useStyle( prefix + 'typography.fontFamily', name );
15
- const [ gradientValue ] = useStyle( prefix + 'color.gradient', name );
16
- const [ backgroundColor ] = useStyle( prefix + 'color.background', name );
17
- const [ color ] = useStyle( prefix + 'color.text', name );
18
- const [ fontSize ] = useStyle( prefix + 'typography.fontSize', name );
19
- const [ fontStyle ] = useStyle( prefix + 'typography.fontStyle', name );
20
- const [ fontWeight ] = useStyle( prefix + 'typography.fontWeight', name );
21
- const [ letterSpacing ] = useStyle(
21
+ const [ fontFamily ] = useGlobalStyle(
22
+ prefix + 'typography.fontFamily',
23
+ name
24
+ );
25
+ const [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient', name );
26
+ const [ backgroundColor ] = useGlobalStyle(
27
+ prefix + 'color.background',
28
+ name
29
+ );
30
+ const [ color ] = useGlobalStyle( prefix + 'color.text', name );
31
+ const [ fontSize ] = useGlobalStyle( prefix + 'typography.fontSize', name );
32
+ const [ fontStyle ] = useGlobalStyle(
33
+ prefix + 'typography.fontStyle',
34
+ name
35
+ );
36
+ const [ fontWeight ] = useGlobalStyle(
37
+ prefix + 'typography.fontWeight',
38
+ name
39
+ );
40
+ const [ letterSpacing ] = useGlobalStyle(
22
41
  prefix + 'typography.letterSpacing',
23
42
  name
24
43
  );
@@ -5,10 +5,15 @@ import {
5
5
  __experimentalNavigatorProvider as NavigatorProvider,
6
6
  __experimentalNavigatorScreen as NavigatorScreen,
7
7
  __experimentalUseNavigator as useNavigator,
8
+ createSlotFill,
9
+ DropdownMenu,
8
10
  } from '@wordpress/components';
9
11
  import { getBlockTypes, store as blocksStore } from '@wordpress/blocks';
10
-
11
- import { useSelect } from '@wordpress/data';
12
+ import { useSelect, useDispatch } from '@wordpress/data';
13
+ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
14
+ import { __ } from '@wordpress/i18n';
15
+ import { store as preferencesStore } from '@wordpress/preferences';
16
+ import { moreVertical } from '@wordpress/icons';
12
17
 
13
18
  /**
14
19
  * Internal dependencies
@@ -31,6 +36,43 @@ import { ScreenVariation } from './screen-variations';
31
36
  import ScreenBorder from './screen-border';
32
37
  import StyleBook from '../style-book';
33
38
  import ScreenCSS from './screen-css';
39
+ import { unlock } from '../../experiments';
40
+
41
+ const SLOT_FILL_NAME = 'GlobalStylesMenu';
42
+ const { Slot: GlobalStylesMenuSlot, Fill: GlobalStylesMenuFill } =
43
+ createSlotFill( SLOT_FILL_NAME );
44
+
45
+ function GlobalStylesActionMenu() {
46
+ const { toggle } = useDispatch( preferencesStore );
47
+ const { useGlobalStylesReset } = unlock( blockEditorExperiments );
48
+ const [ canReset, onReset ] = useGlobalStylesReset();
49
+ const { goTo } = useNavigator();
50
+ const loadCustomCSS = () => goTo( '/css' );
51
+ return (
52
+ <GlobalStylesMenuFill>
53
+ <DropdownMenu
54
+ icon={ moreVertical }
55
+ label={ __( 'More Styles actions' ) }
56
+ controls={ [
57
+ {
58
+ title: __( 'Reset to defaults' ),
59
+ onClick: onReset,
60
+ isDisabled: ! canReset,
61
+ },
62
+ {
63
+ title: __( 'Welcome Guide' ),
64
+ onClick: () =>
65
+ toggle( 'core/edit-site', 'welcomeGuideStyles' ),
66
+ },
67
+ {
68
+ title: __( 'Additional CSS' ),
69
+ onClick: loadCustomCSS,
70
+ },
71
+ ] }
72
+ />
73
+ </GlobalStylesMenuFill>
74
+ );
75
+ }
34
76
 
35
77
  function GlobalStylesNavigationScreen( { className, ...props } ) {
36
78
  return (
@@ -68,19 +110,27 @@ function BlockStyleVariationsScreens( { name } ) {
68
110
  '/variations/' +
69
111
  encodeURIComponent( variation.name )
70
112
  }
113
+ variation={ variation.name }
71
114
  />
72
115
  ) );
73
116
  }
74
117
 
75
- function ContextScreens( { name, parentMenu = '' } ) {
76
- const hasVariationPath = parentMenu.search( 'variations' );
77
- const variationPath =
78
- hasVariationPath !== -1
79
- ? parentMenu
80
- .substring( hasVariationPath )
81
- .replace( '/', '.' )
82
- .concat( '', '.' )
83
- : '';
118
+ function BlockStylesNavigationScreens( {
119
+ parentMenu,
120
+ blockStyles,
121
+ blockName,
122
+ } ) {
123
+ return blockStyles.map( ( style, index ) => (
124
+ <GlobalStylesNavigationScreen
125
+ key={ index }
126
+ path={ parentMenu + '/variations/' + style.name }
127
+ >
128
+ <ScreenVariation blockName={ blockName } style={ style } />
129
+ </GlobalStylesNavigationScreen>
130
+ ) );
131
+ }
132
+
133
+ function ContextScreens( { name, parentMenu = '', variation = '' } ) {
84
134
  const blockStyleVariations = useSelect(
85
135
  ( select ) => {
86
136
  const { getBlockStyles } = select( blocksStore );
@@ -89,24 +139,10 @@ function ContextScreens( { name, parentMenu = '' } ) {
89
139
  [ name ]
90
140
  );
91
141
 
92
- const BlockStylesNavigationScreens = ( { blockStyles, blockName } ) => {
93
- return blockStyles.map( ( style, index ) => (
94
- <GlobalStylesNavigationScreen
95
- key={ index }
96
- path={ parentMenu + '/variations/' + style.name }
97
- >
98
- <ScreenVariation blockName={ blockName } style={ style } />
99
- </GlobalStylesNavigationScreen>
100
- ) );
101
- };
102
-
103
142
  return (
104
143
  <>
105
144
  <GlobalStylesNavigationScreen path={ parentMenu + '/typography' }>
106
- <ScreenTypography
107
- name={ name }
108
- variationPath={ variationPath }
109
- />
145
+ <ScreenTypography name={ name } variation={ variation } />
110
146
  </GlobalStylesNavigationScreen>
111
147
 
112
148
  <GlobalStylesNavigationScreen
@@ -134,7 +170,7 @@ function ContextScreens( { name, parentMenu = '' } ) {
134
170
  </GlobalStylesNavigationScreen>
135
171
 
136
172
  <GlobalStylesNavigationScreen path={ parentMenu + '/colors' }>
137
- <ScreenColors name={ name } variationPath={ variationPath } />
173
+ <ScreenColors name={ name } variation={ variation } />
138
174
  </GlobalStylesNavigationScreen>
139
175
 
140
176
  <GlobalStylesNavigationScreen
@@ -146,54 +182,44 @@ function ContextScreens( { name, parentMenu = '' } ) {
146
182
  <GlobalStylesNavigationScreen
147
183
  path={ parentMenu + '/colors/background' }
148
184
  >
149
- <ScreenBackgroundColor
150
- name={ name }
151
- variationPath={ variationPath }
152
- />
185
+ <ScreenBackgroundColor name={ name } variation={ variation } />
153
186
  </GlobalStylesNavigationScreen>
154
187
 
155
188
  <GlobalStylesNavigationScreen path={ parentMenu + '/colors/text' }>
156
- <ScreenTextColor
157
- name={ name }
158
- variationPath={ variationPath }
159
- />
189
+ <ScreenTextColor name={ name } variation={ variation } />
160
190
  </GlobalStylesNavigationScreen>
161
191
 
162
192
  <GlobalStylesNavigationScreen path={ parentMenu + '/colors/link' }>
163
- <ScreenLinkColor
164
- name={ name }
165
- variationPath={ variationPath }
166
- />
193
+ <ScreenLinkColor name={ name } variation={ variation } />
167
194
  </GlobalStylesNavigationScreen>
168
195
 
169
196
  <GlobalStylesNavigationScreen
170
197
  path={ parentMenu + '/colors/heading' }
171
198
  >
172
- <ScreenHeadingColor
173
- name={ name }
174
- variationPath={ variationPath }
175
- />
199
+ <ScreenHeadingColor name={ name } variation={ variation } />
176
200
  </GlobalStylesNavigationScreen>
177
201
 
178
202
  <GlobalStylesNavigationScreen
179
203
  path={ parentMenu + '/colors/button' }
180
204
  >
181
- <ScreenButtonColor
182
- name={ name }
183
- variationPath={ variationPath }
184
- />
205
+ <ScreenButtonColor name={ name } variation={ variation } />
185
206
  </GlobalStylesNavigationScreen>
186
207
 
187
208
  <GlobalStylesNavigationScreen path={ parentMenu + '/border' }>
188
- <ScreenBorder name={ name } variationPath={ variationPath } />
209
+ <ScreenBorder name={ name } variation={ variation } />
189
210
  </GlobalStylesNavigationScreen>
190
211
 
191
212
  <GlobalStylesNavigationScreen path={ parentMenu + '/layout' }>
192
- <ScreenLayout name={ name } variationPath={ variationPath } />
213
+ <ScreenLayout name={ name } variation={ variation } />
214
+ </GlobalStylesNavigationScreen>
215
+
216
+ <GlobalStylesNavigationScreen path={ parentMenu + '/css' }>
217
+ <ScreenCSS name={ name } />
193
218
  </GlobalStylesNavigationScreen>
194
219
 
195
220
  { !! blockStyleVariations?.length && (
196
221
  <BlockStylesNavigationScreens
222
+ parentMenu={ parentMenu }
197
223
  blockStyles={ blockStyleVariations }
198
224
  blockName={ name }
199
225
  />
@@ -280,11 +306,10 @@ function GlobalStylesUI( { isStyleBookOpened, onCloseStyleBook } ) {
280
306
  { isStyleBookOpened && (
281
307
  <GlobalStylesStyleBook onClose={ onCloseStyleBook } />
282
308
  ) }
283
- <GlobalStylesNavigationScreen path="/css">
284
- <ScreenCSS />
285
- </GlobalStylesNavigationScreen>
309
+
310
+ <GlobalStylesActionMenu />
286
311
  </NavigatorProvider>
287
312
  );
288
313
  }
289
-
314
+ export { GlobalStylesMenuSlot };
290
315
  export default GlobalStylesUI;
@@ -1,379 +1,12 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
- import { getTypographyFontSizeValue } from './typography-utils';
10
-
11
- /* Supporting data. */
12
- export const ROOT_BLOCK_NAME = 'root';
13
- export const ROOT_BLOCK_SELECTOR = 'body';
14
- export const ROOT_BLOCK_SUPPORTS = [
15
- 'background',
16
- 'backgroundColor',
17
- 'color',
18
- 'linkColor',
19
- 'buttonColor',
20
- 'fontFamily',
21
- 'fontSize',
22
- 'fontStyle',
23
- 'fontWeight',
24
- 'lineHeight',
25
- 'textDecoration',
26
- 'textTransform',
27
- 'padding',
28
- ];
29
-
30
- export const PRESET_METADATA = [
31
- {
32
- path: [ 'color', 'palette' ],
33
- valueKey: 'color',
34
- cssVarInfix: 'color',
35
- classes: [
36
- { classSuffix: 'color', propertyName: 'color' },
37
- {
38
- classSuffix: 'background-color',
39
- propertyName: 'background-color',
40
- },
41
- {
42
- classSuffix: 'border-color',
43
- propertyName: 'border-color',
44
- },
45
- ],
46
- },
47
- {
48
- path: [ 'color', 'gradients' ],
49
- valueKey: 'gradient',
50
- cssVarInfix: 'gradient',
51
- classes: [
52
- {
53
- classSuffix: 'gradient-background',
54
- propertyName: 'background',
55
- },
56
- ],
57
- },
58
- {
59
- path: [ 'color', 'duotone' ],
60
- cssVarInfix: 'duotone',
61
- valueFunc: ( { slug } ) => `url( '#wp-duotone-${ slug }' )`,
62
- classes: [],
63
- },
64
- {
65
- path: [ 'typography', 'fontSizes' ],
66
- valueFunc: ( preset, { typography: typographySettings } ) =>
67
- getTypographyFontSizeValue( preset, typographySettings ),
68
- valueKey: 'size',
69
- cssVarInfix: 'font-size',
70
- classes: [ { classSuffix: 'font-size', propertyName: 'font-size' } ],
71
- },
72
- {
73
- path: [ 'typography', 'fontFamilies' ],
74
- valueKey: 'fontFamily',
75
- cssVarInfix: 'font-family',
76
- classes: [
77
- { classSuffix: 'font-family', propertyName: 'font-family' },
78
- ],
79
- },
80
- {
81
- path: [ 'spacing', 'spacingSizes' ],
82
- valueKey: 'size',
83
- cssVarInfix: 'spacing',
84
- valueFunc: ( { size } ) => size,
85
- classes: [],
86
- },
87
- ];
88
-
89
- export const STYLE_PATH_TO_CSS_VAR_INFIX = {
90
- 'color.background': 'color',
91
- 'color.text': 'color',
92
- 'elements.link.color.text': 'color',
93
- 'elements.link.:hover.color.text': 'color',
94
- 'elements.link.typography.fontFamily': 'font-family',
95
- 'elements.link.typography.fontSize': 'font-size',
96
- 'elements.button.color.text': 'color',
97
- 'elements.button.color.background': 'color',
98
- 'elements.button.typography.fontFamily': 'font-family',
99
- 'elements.button.typography.fontSize': 'font-size',
100
- 'elements.heading.color': 'color',
101
- 'elements.heading.color.background': 'color',
102
- 'elements.heading.typography.fontFamily': 'font-family',
103
- 'elements.heading.gradient': 'gradient',
104
- 'elements.heading.color.gradient': 'gradient',
105
- 'elements.h1.color': 'color',
106
- 'elements.h1.color.background': 'color',
107
- 'elements.h1.typography.fontFamily': 'font-family',
108
- 'elements.h1.color.gradient': 'gradient',
109
- 'elements.h2.color': 'color',
110
- 'elements.h2.color.background': 'color',
111
- 'elements.h2.typography.fontFamily': 'font-family',
112
- 'elements.h2.color.gradient': 'gradient',
113
- 'elements.h3.color': 'color',
114
- 'elements.h3.color.background': 'color',
115
- 'elements.h3.typography.fontFamily': 'font-family',
116
- 'elements.h3.color.gradient': 'gradient',
117
- 'elements.h4.color': 'color',
118
- 'elements.h4.color.background': 'color',
119
- 'elements.h4.typography.fontFamily': 'font-family',
120
- 'elements.h4.color.gradient': 'gradient',
121
- 'elements.h5.color': 'color',
122
- 'elements.h5.color.background': 'color',
123
- 'elements.h5.typography.fontFamily': 'font-family',
124
- 'elements.h5.color.gradient': 'gradient',
125
- 'elements.h6.color': 'color',
126
- 'elements.h6.color.background': 'color',
127
- 'elements.h6.typography.fontFamily': 'font-family',
128
- 'elements.h6.color.gradient': 'gradient',
129
- 'color.gradient': 'gradient',
130
- 'typography.fontSize': 'font-size',
131
- 'typography.fontFamily': 'font-family',
132
- };
133
-
134
- // A static list of block attributes that store global style preset slugs.
135
- export const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
136
- 'color.background': 'backgroundColor',
137
- 'color.text': 'textColor',
138
- 'color.gradient': 'gradient',
139
- 'typography.fontSize': 'fontSize',
140
- 'typography.fontFamily': 'fontFamily',
141
- };
142
-
143
- function findInPresetsBy(
144
- features,
145
- blockName,
146
- presetPath,
147
- presetProperty,
148
- presetValueValue
149
- ) {
150
- // Block presets take priority above root level presets.
151
- const orderedPresetsByOrigin = [
152
- get( features, [ 'blocks', blockName, ...presetPath ] ),
153
- get( features, presetPath ),
154
- ];
155
-
156
- for ( const presetByOrigin of orderedPresetsByOrigin ) {
157
- if ( presetByOrigin ) {
158
- // Preset origins ordered by priority.
159
- const origins = [ 'custom', 'theme', 'default' ];
160
- for ( const origin of origins ) {
161
- const presets = presetByOrigin[ origin ];
162
- if ( presets ) {
163
- const presetObject = presets.find(
164
- ( preset ) =>
165
- preset[ presetProperty ] === presetValueValue
166
- );
167
- if ( presetObject ) {
168
- if ( presetProperty === 'slug' ) {
169
- return presetObject;
170
- }
171
- // If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.
172
- const highestPresetObjectWithSameSlug = findInPresetsBy(
173
- features,
174
- blockName,
175
- presetPath,
176
- 'slug',
177
- presetObject.slug
178
- );
179
- if (
180
- highestPresetObjectWithSameSlug[
181
- presetProperty
182
- ] === presetObject[ presetProperty ]
183
- ) {
184
- return presetObject;
185
- }
186
- return undefined;
187
- }
188
- }
189
- }
190
- }
191
- }
192
- }
193
-
194
- export function getPresetVariableFromValue(
195
- features,
196
- blockName,
197
- variableStylePath,
198
- presetPropertyValue
199
- ) {
200
- if ( ! presetPropertyValue ) {
201
- return presetPropertyValue;
202
- }
203
-
204
- const cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[ variableStylePath ];
205
-
206
- const metadata = PRESET_METADATA.find(
207
- ( data ) => data.cssVarInfix === cssVarInfix
208
- );
209
-
210
- if ( ! metadata ) {
211
- // The property doesn't have preset data
212
- // so the value should be returned as it is.
213
- return presetPropertyValue;
214
- }
215
- const { valueKey, path } = metadata;
216
-
217
- const presetObject = findInPresetsBy(
218
- features,
219
- blockName,
220
- path,
221
- valueKey,
222
- presetPropertyValue
223
- );
224
-
225
- if ( ! presetObject ) {
226
- // Value wasn't found in the presets,
227
- // so it must be a custom value.
228
- return presetPropertyValue;
229
- }
230
-
231
- return `var:preset|${ cssVarInfix }|${ presetObject.slug }`;
232
- }
233
-
234
- function getValueFromPresetVariable(
235
- features,
236
- blockName,
237
- variable,
238
- [ presetType, slug ]
239
- ) {
240
- const metadata = PRESET_METADATA.find(
241
- ( data ) => data.cssVarInfix === presetType
242
- );
243
- if ( ! metadata ) {
244
- return variable;
245
- }
246
-
247
- const presetObject = findInPresetsBy(
248
- features.settings,
249
- blockName,
250
- metadata.path,
251
- 'slug',
252
- slug
253
- );
254
-
255
- if ( presetObject ) {
256
- const { valueKey } = metadata;
257
- const result = presetObject[ valueKey ];
258
- return getValueFromVariable( features, blockName, result );
259
- }
260
-
261
- return variable;
262
- }
263
-
264
- function getValueFromCustomVariable( features, blockName, variable, path ) {
265
- const result =
266
- get( features.settings, [ 'blocks', blockName, 'custom', ...path ] ) ??
267
- get( features.settings, [ 'custom', ...path ] );
268
- if ( ! result ) {
269
- return variable;
270
- }
271
- // A variable may reference another variable so we need recursion until we find the value.
272
- return getValueFromVariable( features, blockName, result );
273
- }
274
-
275
- /**
276
- * Attempts to fetch the value of a theme.json CSS variable.
277
- *
278
- * @param {Object} features GlobalStylesContext config, e.g., user, base or merged. Represents the theme.json tree.
279
- * @param {string} blockName The name of a block as represented in the styles property. E.g., 'root' for root-level, and 'core/${blockName}' for blocks.
280
- * @param {string|*} variable An incoming style value. A CSS var value is expected, but it could be any value.
281
- * @return {string|*|{ref}} The value of the CSS var, if found. If not found, the passed variable argument.
282
- */
283
- export function getValueFromVariable( features, blockName, variable ) {
284
- if ( ! variable || typeof variable !== 'string' ) {
285
- if ( variable?.ref && typeof variable?.ref === 'string' ) {
286
- const refPath = variable.ref.split( '.' );
287
- variable = get( features, refPath );
288
- // Presence of another ref indicates a reference to another dynamic value.
289
- // Pointing to another dynamic value is not supported.
290
- if ( ! variable || !! variable?.ref ) {
291
- return variable;
292
- }
293
- } else {
294
- return variable;
295
- }
296
- }
297
- const USER_VALUE_PREFIX = 'var:';
298
- const THEME_VALUE_PREFIX = 'var(--wp--';
299
- const THEME_VALUE_SUFFIX = ')';
300
-
301
- let parsedVar;
302
-
303
- if ( variable.startsWith( USER_VALUE_PREFIX ) ) {
304
- parsedVar = variable.slice( USER_VALUE_PREFIX.length ).split( '|' );
305
- } else if (
306
- variable.startsWith( THEME_VALUE_PREFIX ) &&
307
- variable.endsWith( THEME_VALUE_SUFFIX )
308
- ) {
309
- parsedVar = variable
310
- .slice( THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length )
311
- .split( '--' );
312
- } else {
313
- // We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`
314
- return variable;
315
- }
316
-
317
- const [ type, ...path ] = parsedVar;
318
- if ( type === 'preset' ) {
319
- return getValueFromPresetVariable(
320
- features,
321
- blockName,
322
- variable,
323
- path
324
- );
325
- }
326
- if ( type === 'custom' ) {
327
- return getValueFromCustomVariable(
328
- features,
329
- blockName,
330
- variable,
331
- path
332
- );
333
- }
334
- return variable;
335
- }
336
-
337
- /**
338
- * Function that scopes a selector with another one. This works a bit like
339
- * SCSS nesting except the `&` operator isn't supported.
340
- *
341
- * @example
342
- * ```js
343
- * const scope = '.a, .b .c';
344
- * const selector = '> .x, .y';
345
- * const merged = scopeSelector( scope, selector );
346
- * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'
347
- * ```
348
- *
349
- * @param {string} scope Selector to scope to.
350
- * @param {string} selector Original selector.
351
- *
352
- * @return {string} Scoped selector.
353
- */
354
- export function scopeSelector( scope, selector ) {
355
- const scopes = scope.split( ',' );
356
- const selectors = selector.split( ',' );
357
-
358
- const selectorsScoped = [];
359
- scopes.forEach( ( outer ) => {
360
- selectors.forEach( ( inner ) => {
361
- selectorsScoped.push( `${ outer.trim() } ${ inner.trim() }` );
362
- } );
363
- } );
364
-
365
- return selectorsScoped.join( ', ' );
366
- }
367
-
368
1
  /**
369
2
  *
370
- * @param {string} path The variation path in the Global Styles tree.
3
+ * @param {string} variation The variation name.
371
4
  *
372
5
  * @return {string} The variation class name.
373
6
  */
374
- export function getVariationClassNameFromPath( path ) {
375
- if ( ! path ) {
7
+ export function getVariationClassName( variation ) {
8
+ if ( ! variation ) {
376
9
  return '';
377
10
  }
378
- return `is-style-${ path.split( '.' )[ 1 ] }`;
11
+ return `is-style-${ variation }`;
379
12
  }
@@ -3,16 +3,15 @@
3
3
  */
4
4
  import { useEffect } from '@wordpress/element';
5
5
  import { useSelect, useDispatch } from '@wordpress/data';
6
+ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
6
7
 
7
8
  /**
8
9
  * Internal dependencies
9
10
  */
10
11
  import { store as editSiteStore } from '../../store';
12
+ import { unlock } from '../../experiments';
11
13
 
12
- /**
13
- * Internal dependencies
14
- */
15
- import { useGlobalStylesOutput } from '../global-styles/use-global-styles-output';
14
+ const { useGlobalStylesOutput } = unlock( blockEditorExperiments );
16
15
 
17
16
  function useGlobalStylesRenderer() {
18
17
  const [ styles, settings, svgFilters ] = useGlobalStylesOutput();
@@ -88,6 +88,7 @@ export default function DocumentActions() {
88
88
  // Use the title wrapper as the popover anchor so that the dropdown is
89
89
  // centered over the whole title area rather than just one part of it.
90
90
  anchor: popoverAnchor,
91
+ placement: 'bottom',
91
92
  } ),
92
93
  [ popoverAnchor ]
93
94
  );
@@ -146,7 +147,6 @@ export default function DocumentActions() {
146
147
 
147
148
  <Dropdown
148
149
  popoverProps={ popoverProps }
149
- position="bottom center"
150
150
  renderToggle={ ( { isOpen, onToggle } ) => (
151
151
  <Button
152
152
  className="edit-site-document-actions__get-info"
@@ -94,7 +94,6 @@ export default function KeyboardShortcutHelpModal( {
94
94
  <Modal
95
95
  className="edit-site-keyboard-shortcut-help-modal"
96
96
  title={ __( 'Keyboard shortcuts' ) }
97
- closeLabel={ __( 'Close' ) }
98
97
  onRequestClose={ toggleModal }
99
98
  >
100
99
  <ShortcutSection