@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
@@ -10,6 +10,7 @@ import {
10
10
  FlexItem,
11
11
  ColorIndicator,
12
12
  } from '@wordpress/components';
13
+ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
13
14
 
14
15
  /**
15
16
  * Internal dependencies
@@ -17,33 +18,27 @@ import {
17
18
  import ScreenHeader from './header';
18
19
  import Palette from './palette';
19
20
  import { NavigationButtonAsItem } from './navigation-button';
20
- import { getSupportedGlobalStylesPanels, useStyle } from './hooks';
21
+ import { getSupportedGlobalStylesPanels } from './hooks';
21
22
  import Subtitle from './subtitle';
22
23
  import ColorIndicatorWrapper from './color-indicator-wrapper';
23
24
  import BlockPreviewPanel from './block-preview-panel';
24
- import { getVariationClassNameFromPath } from './utils';
25
+ import { getVariationClassName } from './utils';
26
+ import { unlock } from '../../experiments';
25
27
 
26
- function variationPathToURL( variationPath ) {
27
- if ( ! variationPath ) {
28
- return '';
29
- }
30
- // Replace the dots with slashes, add slash at the beginning and remove the last slash.
31
- return '/' + variationPath.replace( /\./g, '/' ).slice( 0, -1 );
32
- }
28
+ const { useGlobalStyle } = unlock( blockEditorExperiments );
33
29
 
34
- function BackgroundColorItem( { name, parentMenu, variationPath = '' } ) {
30
+ function BackgroundColorItem( { name, parentMenu, variation = '' } ) {
31
+ const prefix = variation ? `variations.${ variation }.` : '';
32
+ const urlPrefix = variation ? `/variations/${ variation }` : '';
35
33
  const supports = getSupportedGlobalStylesPanels( name );
36
34
  const hasSupport =
37
35
  supports.includes( 'backgroundColor' ) ||
38
36
  supports.includes( 'background' );
39
- const [ backgroundColor ] = useStyle(
40
- variationPath + 'color.background',
41
- name
42
- );
43
- const [ gradientValue ] = useStyle(
44
- variationPath + 'color.gradient',
37
+ const [ backgroundColor ] = useGlobalStyle(
38
+ prefix + 'color.background',
45
39
  name
46
40
  );
41
+ const [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient', name );
47
42
 
48
43
  if ( ! hasSupport ) {
49
44
  return null;
@@ -51,11 +46,7 @@ function BackgroundColorItem( { name, parentMenu, variationPath = '' } ) {
51
46
 
52
47
  return (
53
48
  <NavigationButtonAsItem
54
- path={
55
- parentMenu +
56
- variationPathToURL( variationPath ) +
57
- '/colors/background'
58
- }
49
+ path={ parentMenu + urlPrefix + '/colors/background' }
59
50
  aria-label={ __( 'Colors background styles' ) }
60
51
  >
61
52
  <HStack justify="flex-start">
@@ -73,10 +64,12 @@ function BackgroundColorItem( { name, parentMenu, variationPath = '' } ) {
73
64
  );
74
65
  }
75
66
 
76
- function TextColorItem( { name, parentMenu, variationPath = '' } ) {
67
+ function TextColorItem( { name, parentMenu, variation = '' } ) {
68
+ const prefix = variation ? `variations.${ variation }.` : '';
69
+ const urlPrefix = variation ? `/variations/${ variation }` : '';
77
70
  const supports = getSupportedGlobalStylesPanels( name );
78
71
  const hasSupport = supports.includes( 'color' );
79
- const [ color ] = useStyle( variationPath + 'color.text', name );
72
+ const [ color ] = useGlobalStyle( prefix + 'color.text', name );
80
73
 
81
74
  if ( ! hasSupport ) {
82
75
  return null;
@@ -84,11 +77,7 @@ function TextColorItem( { name, parentMenu, variationPath = '' } ) {
84
77
 
85
78
  return (
86
79
  <NavigationButtonAsItem
87
- path={
88
- parentMenu +
89
- variationPathToURL( variationPath ) +
90
- '/colors/text'
91
- }
80
+ path={ parentMenu + urlPrefix + '/colors/text' }
92
81
  aria-label={ __( 'Colors text styles' ) }
93
82
  >
94
83
  <HStack justify="flex-start">
@@ -106,15 +95,17 @@ function TextColorItem( { name, parentMenu, variationPath = '' } ) {
106
95
  );
107
96
  }
108
97
 
109
- function LinkColorItem( { name, parentMenu, variationPath = '' } ) {
98
+ function LinkColorItem( { name, parentMenu, variation = '' } ) {
99
+ const prefix = variation ? `variations.${ variation }.` : '';
100
+ const urlPrefix = variation ? `/variations/${ variation }` : '';
110
101
  const supports = getSupportedGlobalStylesPanels( name );
111
102
  const hasSupport = supports.includes( 'linkColor' );
112
- const [ color ] = useStyle(
113
- variationPath + 'elements.link.color.text',
103
+ const [ color ] = useGlobalStyle(
104
+ prefix + 'elements.link.color.text',
114
105
  name
115
106
  );
116
- const [ colorHover ] = useStyle(
117
- variationPath + 'elements.link.:hover.color.text',
107
+ const [ colorHover ] = useGlobalStyle(
108
+ prefix + 'elements.link.:hover.color.text',
118
109
  name
119
110
  );
120
111
 
@@ -124,11 +115,7 @@ function LinkColorItem( { name, parentMenu, variationPath = '' } ) {
124
115
 
125
116
  return (
126
117
  <NavigationButtonAsItem
127
- path={
128
- parentMenu +
129
- variationPathToURL( variationPath ) +
130
- '/colors/link'
131
- }
118
+ path={ parentMenu + urlPrefix + '/colors/link' }
132
119
  aria-label={ __( 'Colors link styles' ) }
133
120
  >
134
121
  <HStack justify="flex-start">
@@ -148,15 +135,17 @@ function LinkColorItem( { name, parentMenu, variationPath = '' } ) {
148
135
  );
149
136
  }
150
137
 
151
- function HeadingColorItem( { name, parentMenu, variationPath = '' } ) {
138
+ function HeadingColorItem( { name, parentMenu, variation = '' } ) {
139
+ const prefix = variation ? `variations.${ variation }.` : '';
140
+ const urlPrefix = variation ? `/variations/${ variation }` : '';
152
141
  const supports = getSupportedGlobalStylesPanels( name );
153
142
  const hasSupport = supports.includes( 'color' );
154
- const [ color ] = useStyle(
155
- variationPath + 'elements.heading.color.text',
143
+ const [ color ] = useGlobalStyle(
144
+ prefix + 'elements.heading.color.text',
156
145
  name
157
146
  );
158
- const [ bgColor ] = useStyle(
159
- variationPath + 'elements.heading.color.background',
147
+ const [ bgColor ] = useGlobalStyle(
148
+ prefix + 'elements.heading.color.background',
160
149
  name
161
150
  );
162
151
 
@@ -166,11 +155,7 @@ function HeadingColorItem( { name, parentMenu, variationPath = '' } ) {
166
155
 
167
156
  return (
168
157
  <NavigationButtonAsItem
169
- path={
170
- parentMenu +
171
- variationPathToURL( variationPath ) +
172
- '/colors/heading'
173
- }
158
+ path={ parentMenu + urlPrefix + '/colors/heading' }
174
159
  aria-label={ __( 'Colors heading styles' ) }
175
160
  >
176
161
  <HStack justify="flex-start">
@@ -188,15 +173,17 @@ function HeadingColorItem( { name, parentMenu, variationPath = '' } ) {
188
173
  );
189
174
  }
190
175
 
191
- function ButtonColorItem( { name, parentMenu, variationPath = '' } ) {
176
+ function ButtonColorItem( { name, parentMenu, variation = '' } ) {
177
+ const prefix = variation ? `variations.${ variation }.` : '';
178
+ const urlPrefix = variation ? `/variations/${ variation }` : '';
192
179
  const supports = getSupportedGlobalStylesPanels( name );
193
180
  const hasSupport = supports.includes( 'buttonColor' );
194
- const [ color ] = useStyle(
195
- variationPath + 'elements.button.color.text',
181
+ const [ color ] = useGlobalStyle(
182
+ prefix + 'elements.button.color.text',
196
183
  name
197
184
  );
198
- const [ bgColor ] = useStyle(
199
- variationPath + 'elements.button.color.background',
185
+ const [ bgColor ] = useGlobalStyle(
186
+ prefix + 'elements.button.color.background',
200
187
  name
201
188
  );
202
189
 
@@ -206,11 +193,7 @@ function ButtonColorItem( { name, parentMenu, variationPath = '' } ) {
206
193
 
207
194
  return (
208
195
  <NavigationButtonAsItem
209
- path={
210
- parentMenu +
211
- variationPathToURL( variationPath ) +
212
- '/colors/button'
213
- }
196
+ path={ parentMenu + urlPrefix + '/colors/button' }
214
197
  >
215
198
  <HStack justify="flex-start">
216
199
  <ZStack isLayered={ false } offset={ -8 }>
@@ -229,10 +212,10 @@ function ButtonColorItem( { name, parentMenu, variationPath = '' } ) {
229
212
  );
230
213
  }
231
214
 
232
- function ScreenColors( { name, variationPath = '' } ) {
215
+ function ScreenColors( { name, variation = '' } ) {
233
216
  const parentMenu =
234
217
  name === undefined ? '' : '/blocks/' + encodeURIComponent( name );
235
- const variationClassName = getVariationClassNameFromPath( variationPath );
218
+ const variationClassName = getVariationClassName( variation );
236
219
 
237
220
  return (
238
221
  <>
@@ -255,27 +238,27 @@ function ScreenColors( { name, variationPath = '' } ) {
255
238
  <BackgroundColorItem
256
239
  name={ name }
257
240
  parentMenu={ parentMenu }
258
- variationPath={ variationPath }
241
+ variation={ variation }
259
242
  />
260
243
  <TextColorItem
261
244
  name={ name }
262
245
  parentMenu={ parentMenu }
263
- variationPath={ variationPath }
246
+ variation={ variation }
264
247
  />
265
248
  <LinkColorItem
266
249
  name={ name }
267
250
  parentMenu={ parentMenu }
268
- variationPath={ variationPath }
251
+ variation={ variation }
269
252
  />
270
253
  <HeadingColorItem
271
254
  name={ name }
272
255
  parentMenu={ parentMenu }
273
- variationPath={ variationPath }
256
+ variation={ variation }
274
257
  />
275
258
  <ButtonColorItem
276
259
  name={ name }
277
260
  parentMenu={ parentMenu }
278
- variationPath={ variationPath }
261
+ variation={ variation }
279
262
  />
280
263
  </ItemGroup>
281
264
  </VStack>
@@ -1,30 +1,46 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __ } from '@wordpress/i18n';
5
- import { __experimentalVStack as VStack } from '@wordpress/components';
4
+ import { sprintf, __ } from '@wordpress/i18n';
5
+ import { ExternalLink } from '@wordpress/components';
6
+ import { getBlockType } from '@wordpress/blocks';
6
7
 
7
8
  /**
8
9
  * Internal dependencies
9
10
  */
10
11
  import ScreenHeader from './header';
11
- import Subtitle from './subtitle';
12
12
  import CustomCSSControl from './custom-css';
13
13
 
14
- function ScreenCSS() {
14
+ function ScreenCSS( { name } ) {
15
+ // If name is defined, we are customizing CSS at the block level.
16
+ // Display the block title in the description.
17
+ const blockType = getBlockType( name );
18
+ const title = blockType?.title;
19
+
20
+ const description =
21
+ title !== undefined
22
+ ? sprintf(
23
+ // translators: %s: is the name of a block e.g., 'Image' or 'Table'.
24
+ __(
25
+ 'Add your own CSS to customize the appearance of the %s block.'
26
+ ),
27
+ title
28
+ )
29
+ : __(
30
+ 'Add your own CSS to customize the appearance and layout of your site.'
31
+ );
32
+
15
33
  return (
16
34
  <>
17
- <ScreenHeader
18
- title={ __( 'CSS' ) }
19
- description={ __(
20
- 'Add your own CSS to customize the appearance and layout of your site.'
21
- ) }
22
- />
35
+ <ScreenHeader title={ __( 'CSS' ) } description={ description } />
36
+ <ExternalLink
37
+ href="https://wordpress.org/support/article/css/"
38
+ className="edit-site-global-styles-screen-css-help-link"
39
+ >
40
+ { __( 'Learn more about CSS' ) }
41
+ </ExternalLink>
23
42
  <div className="edit-site-global-styles-screen-css">
24
- <VStack spacing={ 3 }>
25
- <Subtitle>{ __( 'ADDITIONAL CSS' ) }</Subtitle>
26
- <CustomCSSControl />
27
- </VStack>
43
+ <CustomCSSControl blockName={ name } />
28
44
  </div>
29
45
  </>
30
46
  );
@@ -6,7 +6,10 @@ import {
6
6
  __experimentalToggleGroupControl as ToggleGroupControl,
7
7
  __experimentalToggleGroupControlOption as ToggleGroupControlOption,
8
8
  } from '@wordpress/components';
9
- import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
9
+ import {
10
+ __experimentalColorGradientControl as ColorGradientControl,
11
+ experiments as blockEditorExperiments,
12
+ } from '@wordpress/block-editor';
10
13
  import { useState } from '@wordpress/element';
11
14
 
12
15
  /**
@@ -15,67 +18,68 @@ import { useState } from '@wordpress/element';
15
18
  import ScreenHeader from './header';
16
19
  import {
17
20
  getSupportedGlobalStylesPanels,
18
- useSetting,
19
- useStyle,
20
21
  useColorsPerOrigin,
21
22
  useGradientsPerOrigin,
22
23
  } from './hooks';
24
+ import { unlock } from '../../experiments';
23
25
 
24
- function ScreenHeadingColor( { name, variationPath = '' } ) {
25
- const [ selectedLevel, setCurrentTab ] = useState( 'heading' );
26
+ const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
26
27
 
28
+ function ScreenHeadingColor( { name, variation = '' } ) {
29
+ const prefix = variation ? `variations.${ variation }.` : '';
30
+ const [ selectedLevel, setCurrentTab ] = useState( 'heading' );
27
31
  const supports = getSupportedGlobalStylesPanels( name );
28
- const [ solids ] = useSetting( 'color.palette', name );
29
- const [ gradients ] = useSetting( 'color.gradients', name );
30
- const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
31
- const [ areCustomGradientsEnabled ] = useSetting(
32
+ const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
33
+ const [ areCustomGradientsEnabled ] = useGlobalSetting(
32
34
  'color.customGradient',
33
35
  name
34
36
  );
35
- const [ isTextEnabled ] = useSetting( 'color.text', name );
36
- const [ isBackgroundEnabled ] = useSetting( 'color.background', name );
37
-
37
+ const [ isTextEnabled ] = useGlobalSetting( 'color.text', name );
38
+ const [ isBackgroundEnabled ] = useGlobalSetting(
39
+ 'color.background',
40
+ name
41
+ );
38
42
  const colorsPerOrigin = useColorsPerOrigin( name );
39
43
  const gradientsPerOrigin = useGradientsPerOrigin( name );
40
44
 
41
45
  const hasTextColor =
42
46
  supports.includes( 'color' ) &&
43
47
  isTextEnabled &&
44
- ( solids.length > 0 || areCustomSolidsEnabled );
48
+ ( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
45
49
 
46
50
  const hasBackgroundColor =
47
51
  supports.includes( 'backgroundColor' ) &&
48
52
  isBackgroundEnabled &&
49
- ( solids.length > 0 || areCustomSolidsEnabled );
53
+ ( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
50
54
  const hasGradientColor =
51
55
  supports.includes( 'background' ) &&
52
- ( gradients.length > 0 || areCustomGradientsEnabled );
56
+ ( gradientsPerOrigin.length > 0 || areCustomGradientsEnabled );
53
57
 
54
- const [ color, setColor ] = useStyle(
55
- variationPath + 'elements.' + selectedLevel + '.color.text',
58
+ const [ color, setColor ] = useGlobalStyle(
59
+ prefix + 'elements.' + selectedLevel + '.color.text',
56
60
  name
57
61
  );
58
- const [ userColor ] = useStyle(
59
- variationPath + 'elements.' + selectedLevel + '.color.text',
62
+ const [ userColor ] = useGlobalStyle(
63
+ prefix + 'elements.' + selectedLevel + '.color.text',
60
64
  name,
61
65
  'user'
62
66
  );
63
67
 
64
- const [ backgroundColor, setBackgroundColor ] = useStyle(
65
- variationPath + 'elements.' + selectedLevel + '.color.background',
68
+ const [ backgroundColor, setBackgroundColor ] = useGlobalStyle(
69
+ prefix + 'elements.' + selectedLevel + '.color.background',
66
70
  name
67
71
  );
68
- const [ userBackgroundColor ] = useStyle(
69
- variationPath + 'elements.' + selectedLevel + '.color.background',
72
+ const [ userBackgroundColor ] = useGlobalStyle(
73
+ prefix + 'elements.' + selectedLevel + '.color.background',
70
74
  name,
71
75
  'user'
72
76
  );
73
- const [ gradient, setGradient ] = useStyle(
74
- variationPath + 'elements.' + selectedLevel + '.color.gradient',
77
+ const [ gradient, setGradient ] = useGlobalStyle(
78
+ prefix + 'elements.' + selectedLevel + '.color.gradient',
75
79
  name
76
80
  );
77
- const [ userGradient ] = useStyle(
78
- variationPath + 'elements.' + selectedLevel + '.color.gradient',
81
+ const [ userGradient ] = useGlobalStyle(
82
+ prefix + 'elements.' + selectedLevel + '.color.gradient',
79
83
  name,
80
84
  'user'
81
85
  );
@@ -124,6 +128,7 @@ function ScreenHeadingColor( { name, variationPath = '' } ) {
124
128
  <h4>{ __( 'Select heading level' ) }</h4>
125
129
 
126
130
  <ToggleGroupControl
131
+ __nextHasNoMarginBottom
127
132
  label={ __( 'Select heading level' ) }
128
133
  hideLabelFromVision={ true }
129
134
  value={ selectedLevel }
@@ -9,20 +9,17 @@ import { __ } from '@wordpress/i18n';
9
9
  import DimensionsPanel, { useHasDimensionsPanel } from './dimensions-panel';
10
10
  import ScreenHeader from './header';
11
11
  import BlockPreviewPanel from './block-preview-panel';
12
- import { getVariationClassNameFromPath } from './utils';
12
+ import { getVariationClassName } from './utils';
13
13
 
14
- function ScreenLayout( { name, variationPath = '' } ) {
14
+ function ScreenLayout( { name, variation = '' } ) {
15
15
  const hasDimensionsPanel = useHasDimensionsPanel( name );
16
- const variationClassName = getVariationClassNameFromPath( variationPath );
16
+ const variationClassName = getVariationClassName( variation );
17
17
  return (
18
18
  <>
19
19
  <ScreenHeader title={ __( 'Layout' ) } />
20
20
  <BlockPreviewPanel name={ name } variation={ variationClassName } />
21
21
  { hasDimensionsPanel && (
22
- <DimensionsPanel
23
- name={ name }
24
- variationPath={ variationPath }
25
- />
22
+ <DimensionsPanel name={ name } variation={ variation } />
26
23
  ) }
27
24
  </>
28
25
  );
@@ -2,62 +2,62 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
5
+ import {
6
+ __experimentalColorGradientControl as ColorGradientControl,
7
+ experiments as blockEditorExperiments,
8
+ } from '@wordpress/block-editor';
6
9
  import { TabPanel } from '@wordpress/components';
10
+
7
11
  /**
8
12
  * Internal dependencies
9
13
  */
10
14
  import ScreenHeader from './header';
11
- import {
12
- getSupportedGlobalStylesPanels,
13
- useSetting,
14
- useStyle,
15
- useColorsPerOrigin,
16
- } from './hooks';
15
+ import { getSupportedGlobalStylesPanels, useColorsPerOrigin } from './hooks';
16
+ import { unlock } from '../../experiments';
17
17
 
18
- function ScreenLinkColor( { name, variationPath = '' } ) {
19
- const supports = getSupportedGlobalStylesPanels( name );
20
- const [ solids ] = useSetting( 'color.palette', name );
21
- const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
18
+ const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
22
19
 
20
+ function ScreenLinkColor( { name, variation = '' } ) {
21
+ const prefix = variation ? `variations.${ variation }.` : '';
22
+ const supports = getSupportedGlobalStylesPanels( name );
23
+ const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
23
24
  const colorsPerOrigin = useColorsPerOrigin( name );
24
-
25
- const [ isLinkEnabled ] = useSetting( 'color.link', name );
25
+ const [ isLinkEnabled ] = useGlobalSetting( 'color.link', name );
26
26
 
27
27
  const hasLinkColor =
28
28
  supports.includes( 'linkColor' ) &&
29
29
  isLinkEnabled &&
30
- ( solids.length > 0 || areCustomSolidsEnabled );
30
+ ( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
31
31
 
32
32
  const pseudoStates = {
33
33
  default: {
34
34
  label: __( 'Default' ),
35
- value: useStyle(
36
- variationPath + 'elements.link.color.text',
35
+ value: useGlobalStyle(
36
+ prefix + 'elements.link.color.text',
37
37
  name
38
38
  )[ 0 ],
39
- handler: useStyle(
40
- variationPath + 'elements.link.color.text',
39
+ handler: useGlobalStyle(
40
+ prefix + 'elements.link.color.text',
41
41
  name
42
42
  )[ 1 ],
43
- userValue: useStyle(
44
- variationPath + 'elements.link.color.text',
43
+ userValue: useGlobalStyle(
44
+ prefix + 'elements.link.color.text',
45
45
  name,
46
46
  'user'
47
47
  )[ 0 ],
48
48
  },
49
49
  hover: {
50
50
  label: __( 'Hover' ),
51
- value: useStyle(
52
- variationPath + 'elements.link.:hover.color.text',
51
+ value: useGlobalStyle(
52
+ prefix + 'elements.link.:hover.color.text',
53
53
  name
54
54
  )[ 0 ],
55
- handler: useStyle(
56
- variationPath + 'elements.link.:hover.color.text',
55
+ handler: useGlobalStyle(
56
+ prefix + 'elements.link.:hover.color.text',
57
57
  name
58
58
  )[ 1 ],
59
- userValue: useStyle(
60
- variationPath + 'elements.link.:hover.color.text',
59
+ userValue: useGlobalStyle(
60
+ prefix + 'elements.link.:hover.color.text',
61
61
  name,
62
62
  'user'
63
63
  )[ 0 ],
@@ -16,6 +16,7 @@ import { isRTL, __ } from '@wordpress/i18n';
16
16
  import { chevronLeft, chevronRight } from '@wordpress/icons';
17
17
  import { useSelect } from '@wordpress/data';
18
18
  import { store as coreStore } from '@wordpress/core-data';
19
+ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
19
20
 
20
21
  /**
21
22
  * Internal dependencies
@@ -24,19 +25,31 @@ import { IconWithCurrentColor } from './icon-with-current-color';
24
25
  import { NavigationButtonAsItem } from './navigation-button';
25
26
  import ContextMenu from './context-menu';
26
27
  import StylesPreview from './preview';
28
+ import { unlock } from '../../experiments';
27
29
 
28
30
  function ScreenRoot() {
29
- const { variations } = useSelect( ( select ) => {
31
+ const { useGlobalStyle } = unlock( blockEditorExperiments );
32
+ const [ customCSS ] = useGlobalStyle( 'css' );
33
+
34
+ const { variations, canEditCSS } = useSelect( ( select ) => {
35
+ const {
36
+ getEntityRecord,
37
+ __experimentalGetCurrentGlobalStylesId,
38
+ __experimentalGetCurrentThemeGlobalStylesVariations,
39
+ } = select( coreStore );
40
+
41
+ const globalStylesId = __experimentalGetCurrentGlobalStylesId();
42
+ const globalStyles = globalStylesId
43
+ ? getEntityRecord( 'root', 'globalStyles', globalStylesId )
44
+ : undefined;
45
+
30
46
  return {
31
- variations:
32
- select(
33
- coreStore
34
- ).__experimentalGetCurrentThemeGlobalStylesVariations(),
47
+ variations: __experimentalGetCurrentThemeGlobalStylesVariations(),
48
+ canEditCSS:
49
+ !! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,
35
50
  };
36
51
  }, [] );
37
52
 
38
- const __experimentalGlobalStylesCustomCSS =
39
- window?.__experimentalEnableGlobalStylesCustomCSS;
40
53
  return (
41
54
  <Card size="small">
42
55
  <CardBody>
@@ -102,7 +115,7 @@ function ScreenRoot() {
102
115
  </ItemGroup>
103
116
  </CardBody>
104
117
 
105
- { __experimentalGlobalStylesCustomCSS && (
118
+ { canEditCSS && !! customCSS && (
106
119
  <>
107
120
  <CardDivider />
108
121
  <CardBody>
@@ -122,7 +135,9 @@ function ScreenRoot() {
122
135
  aria-label={ __( 'Additional CSS' ) }
123
136
  >
124
137
  <HStack justify="space-between">
125
- <FlexItem>{ __( 'Custom' ) }</FlexItem>
138
+ <FlexItem>
139
+ { __( 'Additional CSS' ) }
140
+ </FlexItem>
126
141
  <IconWithCurrentColor
127
142
  icon={
128
143
  isRTL() ? chevronLeft : chevronRight
@@ -23,15 +23,20 @@ import {
23
23
  CardBody,
24
24
  } from '@wordpress/components';
25
25
  import { __ } from '@wordpress/i18n';
26
- import { store as blockEditorStore } from '@wordpress/block-editor';
26
+ import {
27
+ store as blockEditorStore,
28
+ experiments as blockEditorExperiments,
29
+ } from '@wordpress/block-editor';
27
30
 
28
31
  /**
29
32
  * Internal dependencies
30
33
  */
31
34
  import { mergeBaseAndUserConfigs } from './global-styles-provider';
32
- import { GlobalStylesContext } from './context';
33
35
  import StylesPreview from './preview';
34
36
  import ScreenHeader from './header';
37
+ import { unlock } from '../../experiments';
38
+
39
+ const { GlobalStylesContext } = unlock( blockEditorExperiments );
35
40
 
36
41
  function compareVariations( a, b ) {
37
42
  return (