@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,9 +1,25 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
5
- import { typography, border, color, layout } from '@wordpress/icons';
6
- import { __ } from '@wordpress/i18n';
4
+ import {
5
+ __experimentalItemGroup as ItemGroup,
6
+ __experimentalHStack as HStack,
7
+ __experimentalSpacer as Spacer,
8
+ FlexItem,
9
+ CardBody,
10
+ CardDivider,
11
+ } from '@wordpress/components';
12
+ import {
13
+ typography,
14
+ border,
15
+ color,
16
+ layout,
17
+ chevronLeft,
18
+ chevronRight,
19
+ } from '@wordpress/icons';
20
+ import { isRTL, __ } from '@wordpress/i18n';
21
+ import { useSelect } from '@wordpress/data';
22
+ import { store as coreStore } from '@wordpress/core-data';
7
23
 
8
24
  /**
9
25
  * Internal dependencies
@@ -14,6 +30,7 @@ import { useHasDimensionsPanel } from './dimensions-panel';
14
30
  import { useHasTypographyPanel } from './typography-panel';
15
31
  import { useHasVariationsPanel } from './variations-panel';
16
32
  import { NavigationButtonAsItem } from './navigation-button';
33
+ import { IconWithCurrentColor } from './icon-with-current-color';
17
34
  import { ScreenVariations } from './screen-variations';
18
35
 
19
36
  function ContextMenu( { name, parentMenu = '' } ) {
@@ -24,48 +41,101 @@ function ContextMenu( { name, parentMenu = '' } ) {
24
41
  const hasLayoutPanel = hasDimensionsPanel;
25
42
  const hasVariationsPanel = useHasVariationsPanel( name, parentMenu );
26
43
 
44
+ const { canEditCSS } = useSelect( ( select ) => {
45
+ const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
46
+ select( coreStore );
47
+
48
+ const globalStylesId = __experimentalGetCurrentGlobalStylesId();
49
+ const globalStyles = globalStylesId
50
+ ? getEntityRecord( 'root', 'globalStyles', globalStylesId )
51
+ : undefined;
52
+
53
+ return {
54
+ canEditCSS:
55
+ !! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,
56
+ };
57
+ }, [] );
58
+
59
+ const isBlocksPanel =
60
+ parentMenu.includes( 'blocks' ) &&
61
+ ! parentMenu.includes( 'variations' );
62
+
27
63
  return (
28
- <ItemGroup>
29
- { hasTypographyPanel && (
30
- <NavigationButtonAsItem
31
- icon={ typography }
32
- path={ parentMenu + '/typography' }
33
- aria-label={ __( 'Typography styles' ) }
34
- >
35
- { __( 'Typography' ) }
36
- </NavigationButtonAsItem>
37
- ) }
38
- { hasColorPanel && (
39
- <NavigationButtonAsItem
40
- icon={ color }
41
- path={ parentMenu + '/colors' }
42
- aria-label={ __( 'Colors styles' ) }
43
- >
44
- { __( 'Colors' ) }
45
- </NavigationButtonAsItem>
46
- ) }
47
- { hasBorderPanel && (
48
- <NavigationButtonAsItem
49
- icon={ border }
50
- path={ parentMenu + '/border' }
51
- aria-label={ __( 'Border styles' ) }
52
- >
53
- { __( 'Border' ) }
54
- </NavigationButtonAsItem>
55
- ) }
56
- { hasLayoutPanel && (
57
- <NavigationButtonAsItem
58
- icon={ layout }
59
- path={ parentMenu + '/layout' }
60
- aria-label={ __( 'Layout styles' ) }
61
- >
62
- { __( 'Layout' ) }
63
- </NavigationButtonAsItem>
64
- ) }
65
- { hasVariationsPanel && (
66
- <ScreenVariations name={ name } path={ parentMenu } />
67
- ) }
68
- </ItemGroup>
64
+ <>
65
+ <ItemGroup>
66
+ { hasTypographyPanel && (
67
+ <NavigationButtonAsItem
68
+ icon={ typography }
69
+ path={ parentMenu + '/typography' }
70
+ aria-label={ __( 'Typography styles' ) }
71
+ >
72
+ { __( 'Typography' ) }
73
+ </NavigationButtonAsItem>
74
+ ) }
75
+ { hasColorPanel && (
76
+ <NavigationButtonAsItem
77
+ icon={ color }
78
+ path={ parentMenu + '/colors' }
79
+ aria-label={ __( 'Colors styles' ) }
80
+ >
81
+ { __( 'Colors' ) }
82
+ </NavigationButtonAsItem>
83
+ ) }
84
+ { hasBorderPanel && (
85
+ <NavigationButtonAsItem
86
+ icon={ border }
87
+ path={ parentMenu + '/border' }
88
+ aria-label={ __( 'Border & shadow styles' ) }
89
+ >
90
+ { __( 'Border & Shadow' ) }
91
+ </NavigationButtonAsItem>
92
+ ) }
93
+ { hasLayoutPanel && (
94
+ <NavigationButtonAsItem
95
+ icon={ layout }
96
+ path={ parentMenu + '/layout' }
97
+ aria-label={ __( 'Layout styles' ) }
98
+ >
99
+ { __( 'Layout' ) }
100
+ </NavigationButtonAsItem>
101
+ ) }
102
+ { hasVariationsPanel && (
103
+ <ScreenVariations name={ name } path={ parentMenu } />
104
+ ) }
105
+ { isBlocksPanel && canEditCSS && (
106
+ <>
107
+ <CardDivider />
108
+ <CardBody>
109
+ <Spacer as="p" paddingTop={ 2 } marginBottom={ 4 }>
110
+ { __(
111
+ 'Add your own CSS to customize the block appearance.'
112
+ ) }
113
+ </Spacer>
114
+ <ItemGroup>
115
+ <NavigationButtonAsItem
116
+ path={ parentMenu + '/css' }
117
+ aria-label={ __( 'Additional block CSS' ) }
118
+ >
119
+ <HStack justify="space-between">
120
+ <FlexItem>
121
+ { __( 'Additional block CSS' ) }
122
+ </FlexItem>
123
+ <IconWithCurrentColor
124
+ icon={
125
+ isRTL()
126
+ ? chevronLeft
127
+ : chevronRight
128
+ }
129
+ />
130
+ </HStack>
131
+ </NavigationButtonAsItem>
132
+ </ItemGroup>
133
+ </CardBody>
134
+ <CardDivider />
135
+ </>
136
+ ) }
137
+ </ItemGroup>
138
+ </>
69
139
  );
70
140
  }
71
141
 
@@ -1,17 +1,37 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { TextareaControl, Panel, PanelBody } from '@wordpress/components';
4
+ import { useState } from '@wordpress/element';
5
+ import {
6
+ TextareaControl,
7
+ Panel,
8
+ PanelBody,
9
+ __experimentalVStack as VStack,
10
+ Tooltip,
11
+ Icon,
12
+ } from '@wordpress/components';
5
13
  import { __ } from '@wordpress/i18n';
14
+ import {
15
+ experiments as blockEditorExperiments,
16
+ transformStyles,
17
+ } from '@wordpress/block-editor';
18
+ import { info } from '@wordpress/icons';
6
19
 
7
20
  /**
8
21
  * Internal dependencies
9
22
  */
10
- import { useStyle } from './hooks';
23
+ import { unlock } from '../../experiments';
24
+ import Subtitle from './subtitle';
11
25
 
12
- function CustomCSSControl() {
13
- const [ customCSS, setCustomCSS ] = useStyle( 'css' );
14
- const [ themeCSS ] = useStyle( 'css', null, 'base' );
26
+ const { useGlobalStyle } = unlock( blockEditorExperiments );
27
+ function CustomCSSControl( { blockName } ) {
28
+ // If blockName is defined, we are customizing CSS at the block level:
29
+ // styles.blocks.blockName.css
30
+ const block = !! blockName ? blockName : null;
31
+
32
+ const [ customCSS, setCustomCSS ] = useGlobalStyle( 'css', block );
33
+ const [ themeCSS ] = useGlobalStyle( 'css', block, 'base' );
34
+ const [ cssError, setCSSError ] = useState( null );
15
35
  const ignoreThemeCustomCSS = '/* IgnoreThemeCustomCSS */';
16
36
 
17
37
  // If there is custom css from theme.json show it in the edit box
@@ -32,6 +52,33 @@ function CustomCSSControl() {
32
52
  return;
33
53
  }
34
54
  setCustomCSS( value );
55
+ if ( cssError ) {
56
+ const [ transformed ] = transformStyles(
57
+ [ { css: value } ],
58
+ '.editor-styles-wrapper'
59
+ );
60
+ if ( transformed ) {
61
+ setCSSError( null );
62
+ }
63
+ }
64
+ }
65
+
66
+ function handleOnBlur( event ) {
67
+ if ( ! event?.target?.value ) {
68
+ setCSSError( null );
69
+ return;
70
+ }
71
+
72
+ const [ transformed ] = transformStyles(
73
+ [ { css: event.target.value } ],
74
+ '.editor-styles-wrapper'
75
+ );
76
+
77
+ setCSSError(
78
+ transformed === null
79
+ ? __( 'There is an error with your CSS structure.' )
80
+ : null
81
+ );
35
82
  }
36
83
 
37
84
  const originalThemeCustomCSS =
@@ -41,20 +88,6 @@ function CustomCSSControl() {
41
88
 
42
89
  return (
43
90
  <>
44
- <TextareaControl
45
- __nextHasNoMarginBottom
46
- value={
47
- customCSS?.replace( ignoreThemeCustomCSS, '' ) ||
48
- themeCustomCSS
49
- }
50
- onChange={ ( value ) => handleOnChange( value ) }
51
- rows={ 15 }
52
- className="edit-site-global-styles__custom-css-input"
53
- spellCheck={ false }
54
- help={ __(
55
- "Enter your custom CSS in the textarea and preview in the editor. Changes won't take effect until you've saved the template."
56
- ) }
57
- />
58
91
  { originalThemeCustomCSS && (
59
92
  <Panel>
60
93
  <PanelBody
@@ -67,6 +100,30 @@ function CustomCSSControl() {
67
100
  </PanelBody>
68
101
  </Panel>
69
102
  ) }
103
+ <VStack spacing={ 3 }>
104
+ <Subtitle>{ __( 'ADDITIONAL CSS' ) }</Subtitle>
105
+ <TextareaControl
106
+ __nextHasNoMarginBottom
107
+ value={
108
+ customCSS?.replace( ignoreThemeCustomCSS, '' ) ||
109
+ themeCustomCSS
110
+ }
111
+ onChange={ ( value ) => handleOnChange( value ) }
112
+ onBlur={ handleOnBlur }
113
+ className="edit-site-global-styles__custom-css-input"
114
+ spellCheck={ false }
115
+ />
116
+ { cssError && (
117
+ <Tooltip text={ cssError }>
118
+ <div className="edit-site-global-styles__custom-css-validation-wrapper">
119
+ <Icon
120
+ icon={ info }
121
+ className="edit-site-global-styles__custom-css-validation-icon"
122
+ />
123
+ </div>
124
+ </Tooltip>
125
+ ) }
126
+ </VStack>
70
127
  </>
71
128
  );
72
129
  }
@@ -18,15 +18,19 @@ import {
18
18
  } from '@wordpress/components';
19
19
  import {
20
20
  __experimentalUseCustomSides as useCustomSides,
21
- __experimentalHeightControl as HeightControl,
21
+ HeightControl,
22
22
  __experimentalSpacingSizesControl as SpacingSizesControl,
23
+ experiments as blockEditorExperiments,
23
24
  } from '@wordpress/block-editor';
24
25
  import { Icon, positionCenter, stretchWide } from '@wordpress/icons';
25
26
 
26
27
  /**
27
28
  * Internal dependencies
28
29
  */
29
- import { getSupportedGlobalStylesPanels, useSetting, useStyle } from './hooks';
30
+ import { getSupportedGlobalStylesPanels } from './hooks';
31
+ import { unlock } from '../../experiments';
32
+
33
+ const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
30
34
 
31
35
  const AXIAL_SIDES = [ 'horizontal', 'vertical' ];
32
36
 
@@ -50,50 +54,52 @@ export function useHasDimensionsPanel( name ) {
50
54
 
51
55
  function useHasContentSize( name ) {
52
56
  const supports = getSupportedGlobalStylesPanels( name );
53
- const [ settings ] = useSetting( 'layout.contentSize', name );
57
+ const [ settings ] = useGlobalSetting( 'layout.contentSize', name );
54
58
 
55
59
  return settings && supports.includes( 'contentSize' );
56
60
  }
57
61
 
58
62
  function useHasWideSize( name ) {
59
63
  const supports = getSupportedGlobalStylesPanels( name );
60
- const [ settings ] = useSetting( 'layout.wideSize', name );
64
+ const [ settings ] = useGlobalSetting( 'layout.wideSize', name );
61
65
 
62
66
  return settings && supports.includes( 'wideSize' );
63
67
  }
64
68
 
65
69
  function useHasPadding( name ) {
66
70
  const supports = getSupportedGlobalStylesPanels( name );
67
- const [ settings ] = useSetting( 'spacing.padding', name );
71
+ const [ settings ] = useGlobalSetting( 'spacing.padding', name );
68
72
 
69
73
  return settings && supports.includes( 'padding' );
70
74
  }
71
75
 
72
76
  function useHasMargin( name ) {
73
77
  const supports = getSupportedGlobalStylesPanels( name );
74
- const [ settings ] = useSetting( 'spacing.margin', name );
78
+ const [ settings ] = useGlobalSetting( 'spacing.margin', name );
75
79
 
76
80
  return settings && supports.includes( 'margin' );
77
81
  }
78
82
 
79
83
  function useHasGap( name ) {
80
84
  const supports = getSupportedGlobalStylesPanels( name );
81
- const [ settings ] = useSetting( 'spacing.blockGap', name );
85
+ const [ settings ] = useGlobalSetting( 'spacing.blockGap', name );
82
86
 
83
87
  return settings && supports.includes( 'blockGap' );
84
88
  }
85
89
 
86
90
  function useHasMinHeight( name ) {
87
91
  const supports = getSupportedGlobalStylesPanels( name );
88
- const [ settings ] = useSetting( 'dimensions.minHeight', name );
92
+ const [ settings ] = useGlobalSetting( 'dimensions.minHeight', name );
89
93
 
90
94
  return settings && supports.includes( 'minHeight' );
91
95
  }
92
96
 
93
97
  function useHasSpacingPresets() {
94
- const [ settings ] = useSetting( 'spacing.spacingSizes' );
98
+ const [ settings ] = useGlobalSetting( 'spacing.spacingSizes' );
99
+ const { custom, theme, default: defaultPresets } = settings || {};
100
+ const presets = custom ?? theme ?? defaultPresets ?? [];
95
101
 
96
- return settings && settings.length > 0;
102
+ return settings && presets.length > 0;
97
103
  }
98
104
 
99
105
  function filterValuesBySides( values, sides ) {
@@ -156,11 +162,11 @@ function splitGapValue( value ) {
156
162
 
157
163
  // Props for managing `layout.contentSize`.
158
164
  function useContentSizeProps( name ) {
159
- const [ contentSizeValue, setContentSizeValue ] = useSetting(
165
+ const [ contentSizeValue, setContentSizeValue ] = useGlobalSetting(
160
166
  'layout.contentSize',
161
167
  name
162
168
  );
163
- const [ userSetContentSizeValue ] = useSetting(
169
+ const [ userSetContentSizeValue ] = useGlobalSetting(
164
170
  'layout.contentSize',
165
171
  name,
166
172
  'user'
@@ -177,11 +183,11 @@ function useContentSizeProps( name ) {
177
183
 
178
184
  // Props for managing `layout.wideSize`.
179
185
  function useWideSizeProps( name ) {
180
- const [ wideSizeValue, setWideSizeValue ] = useSetting(
186
+ const [ wideSizeValue, setWideSizeValue ] = useGlobalSetting(
181
187
  'layout.wideSize',
182
188
  name
183
189
  );
184
- const [ userSetWideSizeValue ] = useSetting(
190
+ const [ userSetWideSizeValue ] = useGlobalSetting(
185
191
  'layout.wideSize',
186
192
  name,
187
193
  'user'
@@ -197,9 +203,10 @@ function useWideSizeProps( name ) {
197
203
  }
198
204
 
199
205
  // Props for managing `spacing.padding`.
200
- function usePaddingProps( name, variationPath = '' ) {
201
- const [ rawPadding, setRawPadding ] = useStyle(
202
- variationPath + 'spacing.padding',
206
+ function usePaddingProps( name, variation = '' ) {
207
+ const prefix = variation ? `variations.${ variation }.` : '';
208
+ const [ rawPadding, setRawPadding ] = useGlobalStyle(
209
+ prefix + 'spacing.padding',
203
210
  name
204
211
  );
205
212
  const paddingValues = splitStyleValue( rawPadding );
@@ -213,8 +220,8 @@ function usePaddingProps( name, variationPath = '' ) {
213
220
  setRawPadding( padding );
214
221
  };
215
222
  const resetPaddingValue = () => setPaddingValues( {} );
216
- const [ userSetPaddingValue ] = useStyle(
217
- variationPath + 'spacing.padding',
223
+ const [ userSetPaddingValue ] = useGlobalStyle(
224
+ prefix + 'spacing.padding',
218
225
  name,
219
226
  'user'
220
227
  );
@@ -232,9 +239,10 @@ function usePaddingProps( name, variationPath = '' ) {
232
239
  }
233
240
 
234
241
  // Props for managing `spacing.margin`.
235
- function useMarginProps( name, variationPath = '' ) {
236
- const [ rawMargin, setRawMargin ] = useStyle(
237
- variationPath + 'spacing.margin',
242
+ function useMarginProps( name, variation = '' ) {
243
+ const prefix = variation ? `variations.${ variation }.` : '';
244
+ const [ rawMargin, setRawMargin ] = useGlobalStyle(
245
+ prefix + 'spacing.margin',
238
246
  name
239
247
  );
240
248
  const marginValues = splitStyleValue( rawMargin );
@@ -262,9 +270,10 @@ function useMarginProps( name, variationPath = '' ) {
262
270
  }
263
271
 
264
272
  // Props for managing `spacing.blockGap`.
265
- function useBlockGapProps( name, variationPath = '' ) {
266
- const [ gapValue, setGapValue ] = useStyle(
267
- variationPath + 'spacing.blockGap',
273
+ function useBlockGapProps( name, variation = '' ) {
274
+ const prefix = variation ? `variations.${ variation }.` : '';
275
+ const [ gapValue, setGapValue ] = useGlobalStyle(
276
+ prefix + 'spacing.blockGap',
268
277
  name
269
278
  );
270
279
  const gapValues = splitGapValue( gapValue );
@@ -272,8 +281,8 @@ function useBlockGapProps( name, variationPath = '' ) {
272
281
  const isAxialGap =
273
282
  gapSides && gapSides.some( ( side ) => AXIAL_SIDES.includes( side ) );
274
283
  const resetGapValue = () => setGapValue( undefined );
275
- const [ userSetGapValue ] = useStyle(
276
- variationPath + 'spacing.blockGap',
284
+ const [ userSetGapValue ] = useGlobalStyle(
285
+ prefix + 'spacing.blockGap',
277
286
  name,
278
287
  'user'
279
288
  );
@@ -305,9 +314,10 @@ function useBlockGapProps( name, variationPath = '' ) {
305
314
  }
306
315
 
307
316
  // Props for managing `dimensions.minHeight`.
308
- function useMinHeightProps( name, variationPath = '' ) {
309
- const [ minHeightValue, setMinHeightValue ] = useStyle(
310
- variationPath + 'dimensions.minHeight',
317
+ function useMinHeightProps( name, variation = '' ) {
318
+ const prefix = variation ? `variations.${ variation }.` : '';
319
+ const [ minHeightValue, setMinHeightValue ] = useGlobalStyle(
320
+ prefix + 'dimensions.minHeight',
311
321
  name
312
322
  );
313
323
  const resetMinHeightValue = () => setMinHeightValue( undefined );
@@ -320,7 +330,7 @@ function useMinHeightProps( name, variationPath = '' ) {
320
330
  };
321
331
  }
322
332
 
323
- export default function DimensionsPanel( { name, variationPath = '' } ) {
333
+ export default function DimensionsPanel( { name, variation = '' } ) {
324
334
  const showContentSizeControl = useHasContentSize( name );
325
335
  const showWideSizeControl = useHasWideSize( name );
326
336
  const showPaddingControl = useHasPadding( name );
@@ -329,7 +339,7 @@ export default function DimensionsPanel( { name, variationPath = '' } ) {
329
339
  const showMinHeightControl = useHasMinHeight( name );
330
340
  const showSpacingPresetsControl = useHasSpacingPresets();
331
341
  const units = useCustomUnits( {
332
- availableUnits: useSetting( 'spacing.units', name )[ 0 ] || [
342
+ availableUnits: useGlobalSetting( 'spacing.units', name )[ 0 ] || [
333
343
  '%',
334
344
  'px',
335
345
  'em',
@@ -362,7 +372,7 @@ export default function DimensionsPanel( { name, variationPath = '' } ) {
362
372
  setPaddingValues,
363
373
  resetPaddingValue,
364
374
  hasPaddingValue,
365
- } = usePaddingProps( name, variationPath );
375
+ } = usePaddingProps( name, variation );
366
376
 
367
377
  // Props for managing `spacing.margin`.
368
378
  const {
@@ -372,7 +382,7 @@ export default function DimensionsPanel( { name, variationPath = '' } ) {
372
382
  setMarginValues,
373
383
  resetMarginValue,
374
384
  hasMarginValue,
375
- } = useMarginProps( name, variationPath );
385
+ } = useMarginProps( name, variation );
376
386
 
377
387
  // Props for managing `spacing.blockGap`.
378
388
  const {
@@ -384,7 +394,7 @@ export default function DimensionsPanel( { name, variationPath = '' } ) {
384
394
  setGapValues,
385
395
  resetGapValue,
386
396
  hasGapValue,
387
- } = useBlockGapProps( name, variationPath );
397
+ } = useBlockGapProps( name, variation );
388
398
 
389
399
  // Props for managing `dimensions.minHeight`.
390
400
  const {
@@ -392,7 +402,7 @@ export default function DimensionsPanel( { name, variationPath = '' } ) {
392
402
  setMinHeightValue,
393
403
  resetMinHeightValue,
394
404
  hasMinHeightValue,
395
- } = useMinHeightProps( name, variationPath );
405
+ } = useMinHeightProps( name, variation );
396
406
 
397
407
  const resetAll = () => {
398
408
  resetPaddingValue();
@@ -9,11 +9,15 @@ import { mergeWith, isEmpty, mapValues } from 'lodash';
9
9
  import { useMemo, useCallback } from '@wordpress/element';
10
10
  import { useSelect, useDispatch } from '@wordpress/data';
11
11
  import { store as coreStore } from '@wordpress/core-data';
12
+ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
12
13
 
13
14
  /**
14
15
  * Internal dependencies
15
16
  */
16
- import { GlobalStylesContext } from './context';
17
+ import CanvasSpinner from '../canvas-spinner';
18
+ import { unlock } from '../../experiments';
19
+
20
+ const { GlobalStylesContext } = unlock( blockEditorExperiments );
17
21
 
18
22
  function mergeTreesCustomizer( _, srcValue ) {
19
23
  // We only pass as arrays the presets,
@@ -165,7 +169,7 @@ function useGlobalStylesContext() {
165
169
  export function GlobalStylesProvider( { children } ) {
166
170
  const context = useGlobalStylesContext();
167
171
  if ( ! context.isReady ) {
168
- return null;
172
+ return <CanvasSpinner />;
169
173
  }
170
174
 
171
175
  return (
@@ -8,48 +8,54 @@ import {
8
8
  DuotonePicker,
9
9
  } from '@wordpress/components';
10
10
  import { __ } from '@wordpress/i18n';
11
+ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
11
12
 
12
13
  /**
13
14
  * Internal dependencies
14
15
  */
15
- import { useSetting } from './hooks';
16
16
  import Subtitle from './subtitle';
17
+ import { unlock } from '../../experiments';
18
+
19
+ const { useGlobalSetting } = unlock( blockEditorExperiments );
17
20
 
18
21
  const noop = () => {};
19
22
 
20
23
  export default function GradientPalettePanel( { name } ) {
21
- const [ themeGradients, setThemeGradients ] = useSetting(
24
+ const [ themeGradients, setThemeGradients ] = useGlobalSetting(
22
25
  'color.gradients.theme',
23
26
  name
24
27
  );
25
- const [ baseThemeGradients ] = useSetting(
28
+ const [ baseThemeGradients ] = useGlobalSetting(
26
29
  'color.gradients.theme',
27
30
  name,
28
31
  'base'
29
32
  );
30
- const [ defaultGradients, setDefaultGradients ] = useSetting(
33
+ const [ defaultGradients, setDefaultGradients ] = useGlobalSetting(
31
34
  'color.gradients.default',
32
35
  name
33
36
  );
34
- const [ baseDefaultGradients ] = useSetting(
37
+ const [ baseDefaultGradients ] = useGlobalSetting(
35
38
  'color.gradients.default',
36
39
  name,
37
40
  'base'
38
41
  );
39
- const [ customGradients, setCustomGradients ] = useSetting(
42
+ const [ customGradients, setCustomGradients ] = useGlobalSetting(
40
43
  'color.gradients.custom',
41
44
  name
42
45
  );
43
46
 
44
- const [ defaultPaletteEnabled ] = useSetting(
47
+ const [ defaultPaletteEnabled ] = useGlobalSetting(
45
48
  'color.defaultGradients',
46
49
  name
47
50
  );
48
51
 
49
- const [ customDuotone ] = useSetting( 'color.duotone.custom' ) || [];
50
- const [ defaultDuotone ] = useSetting( 'color.duotone.default' ) || [];
51
- const [ themeDuotone ] = useSetting( 'color.duotone.theme' ) || [];
52
- const [ defaultDuotoneEnabled ] = useSetting( 'color.defaultDuotone' );
52
+ const [ customDuotone ] = useGlobalSetting( 'color.duotone.custom' ) || [];
53
+ const [ defaultDuotone ] =
54
+ useGlobalSetting( 'color.duotone.default' ) || [];
55
+ const [ themeDuotone ] = useGlobalSetting( 'color.duotone.theme' ) || [];
56
+ const [ defaultDuotoneEnabled ] = useGlobalSetting(
57
+ 'color.defaultDuotone'
58
+ );
53
59
 
54
60
  const duotonePalette = [
55
61
  ...( customDuotone || [] ),