@wordpress/edit-site 5.1.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 (415) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/add-new-template/add-custom-generic-template-modal.js +8 -10
  4. package/build/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  5. package/build/components/add-new-template/add-custom-template-modal.js +0 -1
  6. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  7. package/build/components/add-new-template/new-template-part.js +5 -9
  8. package/build/components/add-new-template/new-template-part.js.map +1 -1
  9. package/build/components/app/index.js +2 -7
  10. package/build/components/app/index.js.map +1 -1
  11. package/build/components/block-editor/editor-canvas.js +0 -1
  12. package/build/components/block-editor/editor-canvas.js.map +1 -1
  13. package/build/components/block-editor/index.js +25 -59
  14. package/build/components/block-editor/index.js.map +1 -1
  15. package/build/components/block-editor/inserter-media-categories.js +237 -0
  16. package/build/components/block-editor/inserter-media-categories.js.map +1 -0
  17. package/build/components/block-editor/resize-handle.js +2 -1
  18. package/build/components/block-editor/resize-handle.js.map +1 -1
  19. package/build/components/canvas-spinner/index.js +20 -0
  20. package/build/components/canvas-spinner/index.js.map +1 -0
  21. package/build/components/create-template-part-modal/index.js +4 -2
  22. package/build/components/create-template-part-modal/index.js.map +1 -1
  23. package/build/components/editor/index.js +4 -2
  24. package/build/components/editor/index.js.map +1 -1
  25. package/build/components/error-boundary/index.js +2 -12
  26. package/build/components/error-boundary/index.js.map +1 -1
  27. package/build/components/error-boundary/warning.js +5 -28
  28. package/build/components/error-boundary/warning.js.map +1 -1
  29. package/build/components/global-styles/block-preview-panel.js +10 -4
  30. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  31. package/build/components/global-styles/border-panel.js +18 -9
  32. package/build/components/global-styles/border-panel.js.map +1 -1
  33. package/build/components/global-styles/color-palette-panel.js +13 -7
  34. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  35. package/build/components/global-styles/context-menu.js +47 -4
  36. package/build/components/global-styles/context-menu.js.map +1 -1
  37. package/build/components/global-styles/custom-css.js +65 -14
  38. package/build/components/global-styles/custom-css.js.map +1 -1
  39. package/build/components/global-styles/dimensions-panel.js +50 -27
  40. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  41. package/build/components/global-styles/global-styles-provider.js +13 -3
  42. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  43. package/build/components/global-styles/gradients-palette-panel.js +17 -11
  44. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  45. package/build/components/global-styles/hooks.js +21 -142
  46. package/build/components/global-styles/hooks.js.map +1 -1
  47. package/build/components/global-styles/index.js +0 -28
  48. package/build/components/global-styles/index.js.map +1 -1
  49. package/build/components/global-styles/palette.js +11 -4
  50. package/build/components/global-styles/palette.js.map +1 -1
  51. package/build/components/global-styles/preview.js +18 -15
  52. package/build/components/global-styles/preview.js.map +1 -1
  53. package/build/components/global-styles/screen-background-color.js +28 -13
  54. package/build/components/global-styles/screen-background-color.js.map +1 -1
  55. package/build/components/global-styles/screen-block-list.js +4 -1
  56. package/build/components/global-styles/screen-block-list.js.map +1 -1
  57. package/build/components/global-styles/screen-border.js +16 -4
  58. package/build/components/global-styles/screen-border.js.map +1 -1
  59. package/build/components/global-styles/screen-button-color.js +17 -9
  60. package/build/components/global-styles/screen-button-color.js.map +1 -1
  61. package/build/components/global-styles/screen-colors.js +59 -26
  62. package/build/components/global-styles/screen-colors.js.map +1 -1
  63. package/build/components/global-styles/screen-css.js +20 -8
  64. package/build/components/global-styles/screen-css.js.map +1 -1
  65. package/build/components/global-styles/screen-heading-color.js +24 -16
  66. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  67. package/build/components/global-styles/screen-layout.js +9 -3
  68. package/build/components/global-styles/screen-layout.js.map +1 -1
  69. package/build/components/global-styles/screen-link-color.js +19 -11
  70. package/build/components/global-styles/screen-link-color.js.map +1 -1
  71. package/build/components/global-styles/screen-root.js +25 -9
  72. package/build/components/global-styles/screen-root.js.map +1 -1
  73. package/build/components/global-styles/screen-style-variations.js +8 -4
  74. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  75. package/build/components/global-styles/screen-text-color.js +15 -7
  76. package/build/components/global-styles/screen-text-color.js.map +1 -1
  77. package/build/components/global-styles/screen-typography.js +23 -11
  78. package/build/components/global-styles/screen-typography.js.map +1 -1
  79. package/build/components/global-styles/screen-variations.js +71 -0
  80. package/build/components/global-styles/screen-variations.js.map +1 -0
  81. package/build/components/global-styles/shadow-panel.js +196 -0
  82. package/build/components/global-styles/shadow-panel.js.map +1 -0
  83. package/build/components/global-styles/typography-panel.js +37 -22
  84. package/build/components/global-styles/typography-panel.js.map +1 -1
  85. package/build/components/global-styles/typography-preview.js +19 -9
  86. package/build/components/global-styles/typography-preview.js.map +1 -1
  87. package/build/components/global-styles/ui.js +139 -21
  88. package/build/components/global-styles/ui.js.map +1 -1
  89. package/build/components/global-styles/utils.js +8 -290
  90. package/build/components/global-styles/utils.js.map +1 -1
  91. package/build/components/global-styles/variations-panel.js +85 -0
  92. package/build/components/global-styles/variations-panel.js.map +1 -0
  93. package/build/components/global-styles-renderer/index.js +7 -5
  94. package/build/components/global-styles-renderer/index.js.map +1 -1
  95. package/build/components/header-edit-mode/document-actions/index.js +2 -2
  96. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  97. package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
  98. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  99. package/build/components/layout/index.js +86 -15
  100. package/build/components/layout/index.js.map +1 -1
  101. package/build/components/list/actions/rename-menu-item.js +8 -11
  102. package/build/components/list/actions/rename-menu-item.js.map +1 -1
  103. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +3 -2
  104. package/build/components/navigation-inspector/index.js.map +1 -0
  105. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -15
  106. package/build/components/navigation-inspector/navigation-menu.js.map +1 -0
  107. package/build/components/sidebar/index.js +3 -1
  108. package/build/components/sidebar/index.js.map +1 -1
  109. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +3 -18
  110. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  111. package/build/components/sidebar-edit-mode/index.js +1 -14
  112. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  113. package/build/components/sidebar-navigation-screen/index.js +3 -2
  114. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  115. package/build/components/sidebar-navigation-screen-main/index.js +23 -1
  116. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  117. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +35 -0
  118. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  119. package/build/components/sidebar-navigation-screen-templates/index.js +3 -8
  120. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  121. package/build/components/site-hub/index.js +11 -11
  122. package/build/components/site-hub/index.js.map +1 -1
  123. package/build/components/site-icon/index.js +1 -1
  124. package/build/components/site-icon/index.js.map +1 -1
  125. package/build/components/style-book/index.js +7 -4
  126. package/build/components/style-book/index.js.map +1 -1
  127. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +54 -0
  128. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
  129. package/build/components/template-details/edit-template-title.js +1 -0
  130. package/build/components/template-details/edit-template-title.js.map +1 -1
  131. package/build/components/template-details/template-part-area-selector.js +1 -0
  132. package/build/components/template-details/template-part-area-selector.js.map +1 -1
  133. package/build/components/template-part-converter/convert-to-template-part.js +5 -9
  134. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  135. package/build/experiments.js +19 -0
  136. package/build/experiments.js.map +1 -0
  137. package/build/hooks/push-changes-to-global-styles/index.js +68 -9
  138. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  139. package/build/index.js +53 -60
  140. package/build/index.js.map +1 -1
  141. package/build/store/reducer.js +1 -1
  142. package/build/store/reducer.js.map +1 -1
  143. package/build/store/selectors.js +7 -27
  144. package/build/store/selectors.js.map +1 -1
  145. package/build/store/utils.js +77 -0
  146. package/build/store/utils.js.map +1 -0
  147. package/build/utils/template-part-create.js +71 -0
  148. package/build/utils/template-part-create.js.map +1 -0
  149. package/build-module/components/add-new-template/add-custom-generic-template-modal.js +9 -11
  150. package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  151. package/build-module/components/add-new-template/add-custom-template-modal.js +0 -1
  152. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  153. package/build-module/components/add-new-template/new-template-part.js +5 -9
  154. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  155. package/build-module/components/app/index.js +2 -7
  156. package/build-module/components/app/index.js.map +1 -1
  157. package/build-module/components/block-editor/editor-canvas.js +0 -1
  158. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  159. package/build-module/components/block-editor/index.js +27 -57
  160. package/build-module/components/block-editor/index.js.map +1 -1
  161. package/build-module/components/block-editor/inserter-media-categories.js +225 -0
  162. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -0
  163. package/build-module/components/block-editor/resize-handle.js +2 -1
  164. package/build-module/components/block-editor/resize-handle.js.map +1 -1
  165. package/build-module/components/canvas-spinner/index.js +12 -0
  166. package/build-module/components/canvas-spinner/index.js.map +1 -0
  167. package/build-module/components/create-template-part-modal/index.js +5 -3
  168. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  169. package/build-module/components/editor/index.js +3 -2
  170. package/build-module/components/editor/index.js.map +1 -1
  171. package/build-module/components/error-boundary/index.js +2 -12
  172. package/build-module/components/error-boundary/index.js.map +1 -1
  173. package/build-module/components/error-boundary/warning.js +5 -28
  174. package/build-module/components/error-boundary/warning.js.map +1 -1
  175. package/build-module/components/global-styles/block-preview-panel.js +10 -4
  176. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  177. package/build-module/components/global-styles/border-panel.js +18 -11
  178. package/build-module/components/global-styles/border-panel.js.map +1 -1
  179. package/build-module/components/global-styles/color-palette-panel.js +11 -7
  180. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  181. package/build-module/components/global-styles/context-menu.js +46 -8
  182. package/build-module/components/global-styles/context-menu.js.map +1 -1
  183. package/build-module/components/global-styles/custom-css.js +61 -15
  184. package/build-module/components/global-styles/custom-css.js.map +1 -1
  185. package/build-module/components/global-styles/dimensions-panel.js +50 -28
  186. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  187. package/build-module/components/global-styles/global-styles-provider.js +7 -2
  188. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  189. package/build-module/components/global-styles/gradients-palette-panel.js +15 -11
  190. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  191. package/build-module/components/global-styles/hooks.js +23 -134
  192. package/build-module/components/global-styles/hooks.js.map +1 -1
  193. package/build-module/components/global-styles/index.js +0 -2
  194. package/build-module/components/global-styles/index.js.map +1 -1
  195. package/build-module/components/global-styles/palette.js +10 -5
  196. package/build-module/components/global-styles/palette.js.map +1 -1
  197. package/build-module/components/global-styles/preview.js +18 -14
  198. package/build-module/components/global-styles/preview.js.map +1 -1
  199. package/build-module/components/global-styles/screen-background-color.js +27 -15
  200. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  201. package/build-module/components/global-styles/screen-block-list.js +3 -1
  202. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  203. package/build-module/components/global-styles/screen-border.js +14 -4
  204. package/build-module/components/global-styles/screen-border.js.map +1 -1
  205. package/build-module/components/global-styles/screen-button-color.js +17 -11
  206. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  207. package/build-module/components/global-styles/screen-colors.js +56 -27
  208. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  209. package/build-module/components/global-styles/screen-css.js +21 -9
  210. package/build-module/components/global-styles/screen-css.js.map +1 -1
  211. package/build-module/components/global-styles/screen-heading-color.js +24 -18
  212. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  213. package/build-module/components/global-styles/screen-layout.js +8 -3
  214. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  215. package/build-module/components/global-styles/screen-link-color.js +19 -13
  216. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  217. package/build-module/components/global-styles/screen-root.js +23 -9
  218. package/build-module/components/global-styles/screen-root.js.map +1 -1
  219. package/build-module/components/global-styles/screen-style-variations.js +5 -2
  220. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  221. package/build-module/components/global-styles/screen-text-color.js +15 -9
  222. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  223. package/build-module/components/global-styles/screen-typography.js +19 -10
  224. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  225. package/build-module/components/global-styles/screen-variations.js +54 -0
  226. package/build-module/components/global-styles/screen-variations.js.map +1 -0
  227. package/build-module/components/global-styles/shadow-panel.js +177 -0
  228. package/build-module/components/global-styles/shadow-panel.js.map +1 -0
  229. package/build-module/components/global-styles/typography-panel.js +37 -24
  230. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  231. package/build-module/components/global-styles/typography-preview.js +17 -9
  232. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  233. package/build-module/components/global-styles/ui.js +132 -22
  234. package/build-module/components/global-styles/ui.js.map +1 -1
  235. package/build-module/components/global-styles/utils.js +7 -277
  236. package/build-module/components/global-styles/utils.js.map +1 -1
  237. package/build-module/components/global-styles/variations-panel.js +68 -0
  238. package/build-module/components/global-styles/variations-panel.js.map +1 -0
  239. package/build-module/components/global-styles-renderer/index.js +5 -5
  240. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  241. package/build-module/components/header-edit-mode/document-actions/index.js +2 -2
  242. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  243. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
  244. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  245. package/build-module/components/layout/index.js +86 -17
  246. package/build-module/components/layout/index.js.map +1 -1
  247. package/build-module/components/list/actions/rename-menu-item.js +9 -12
  248. package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
  249. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +3 -2
  250. package/build-module/components/navigation-inspector/index.js.map +1 -0
  251. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -16
  252. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -0
  253. package/build-module/components/sidebar/index.js +2 -1
  254. package/build-module/components/sidebar/index.js.map +1 -1
  255. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +6 -21
  256. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  257. package/build-module/components/sidebar-edit-mode/index.js +1 -13
  258. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  259. package/build-module/components/sidebar-navigation-screen/index.js +3 -2
  260. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  261. package/build-module/components/sidebar-navigation-screen-main/index.js +22 -2
  262. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  263. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +23 -0
  264. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  265. package/build-module/components/sidebar-navigation-screen-templates/index.js +4 -9
  266. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  267. package/build-module/components/site-hub/index.js +12 -11
  268. package/build-module/components/site-hub/index.js.map +1 -1
  269. package/build-module/components/site-icon/index.js +1 -1
  270. package/build-module/components/site-icon/index.js.map +1 -1
  271. package/build-module/components/style-book/index.js +8 -5
  272. package/build-module/components/style-book/index.js.map +1 -1
  273. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +43 -0
  274. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
  275. package/build-module/components/template-details/edit-template-title.js +1 -0
  276. package/build-module/components/template-details/edit-template-title.js.map +1 -1
  277. package/build-module/components/template-details/template-part-area-selector.js +1 -0
  278. package/build-module/components/template-details/template-part-area-selector.js.map +1 -1
  279. package/build-module/components/template-part-converter/convert-to-template-part.js +5 -9
  280. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  281. package/build-module/experiments.js +9 -0
  282. package/build-module/experiments.js.map +1 -0
  283. package/build-module/hooks/push-changes-to-global-styles/index.js +65 -6
  284. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  285. package/build-module/index.js +52 -60
  286. package/build-module/index.js.map +1 -1
  287. package/build-module/store/reducer.js +1 -1
  288. package/build-module/store/reducer.js.map +1 -1
  289. package/build-module/store/selectors.js +6 -26
  290. package/build-module/store/selectors.js.map +1 -1
  291. package/build-module/store/utils.js +66 -0
  292. package/build-module/store/utils.js.map +1 -0
  293. package/build-module/utils/template-part-create.js +53 -0
  294. package/build-module/utils/template-part-create.js.map +1 -0
  295. package/build-style/style-rtl.css +448 -278
  296. package/build-style/style.css +448 -278
  297. package/package.json +32 -30
  298. package/src/components/add-new-template/add-custom-generic-template-modal.js +20 -28
  299. package/src/components/add-new-template/add-custom-template-modal.js +0 -1
  300. package/src/components/add-new-template/new-template-part.js +12 -11
  301. package/src/components/add-new-template/style.scss +0 -4
  302. package/src/components/app/index.js +2 -2
  303. package/src/components/block-editor/editor-canvas.js +0 -1
  304. package/src/components/block-editor/index.js +21 -77
  305. package/src/components/block-editor/inserter-media-categories.js +247 -0
  306. package/src/components/block-editor/resize-handle.js +6 -2
  307. package/src/components/block-editor/style.scss +55 -7
  308. package/src/components/canvas-spinner/index.js +12 -0
  309. package/src/components/canvas-spinner/style.scss +7 -0
  310. package/src/components/create-template-part-modal/index.js +75 -67
  311. package/src/components/create-template-part-modal/style.scss +0 -10
  312. package/src/components/editor/index.js +5 -3
  313. package/src/components/error-boundary/index.js +2 -10
  314. package/src/components/error-boundary/warning.js +6 -35
  315. package/src/components/global-styles/README.md +1 -75
  316. package/src/components/global-styles/block-preview-panel.js +16 -4
  317. package/src/components/global-styles/border-panel.js +22 -16
  318. package/src/components/global-styles/color-palette-panel.js +10 -7
  319. package/src/components/global-styles/context-menu.js +117 -41
  320. package/src/components/global-styles/custom-css.js +76 -19
  321. package/src/components/global-styles/dimensions-panel.js +58 -31
  322. package/src/components/global-styles/global-styles-provider.js +6 -2
  323. package/src/components/global-styles/gradients-palette-panel.js +17 -11
  324. package/src/components/global-styles/hooks.js +31 -155
  325. package/src/components/global-styles/index.js +0 -2
  326. package/src/components/global-styles/palette.js +9 -5
  327. package/src/components/global-styles/preview.js +19 -13
  328. package/src/components/global-styles/screen-background-color.js +42 -19
  329. package/src/components/global-styles/screen-block-list.js +6 -1
  330. package/src/components/global-styles/screen-border.js +13 -5
  331. package/src/components/global-styles/screen-button-color.js +21 -19
  332. package/src/components/global-styles/screen-colors.js +66 -22
  333. package/src/components/global-styles/screen-css.js +30 -14
  334. package/src/components/global-styles/screen-heading-color.js +32 -27
  335. package/src/components/global-styles/screen-layout.js +7 -4
  336. package/src/components/global-styles/screen-link-color.js +34 -22
  337. package/src/components/global-styles/screen-root.js +24 -9
  338. package/src/components/global-styles/screen-style-variations.js +7 -2
  339. package/src/components/global-styles/screen-text-color.js +15 -15
  340. package/src/components/global-styles/screen-typography.js +34 -12
  341. package/src/components/global-styles/screen-variations.js +47 -0
  342. package/src/components/global-styles/shadow-panel.js +174 -0
  343. package/src/components/global-styles/style.scss +94 -1
  344. package/src/components/global-styles/typography-panel.js +58 -23
  345. package/src/components/global-styles/typography-preview.js +28 -9
  346. package/src/components/global-styles/ui.js +130 -17
  347. package/src/components/global-styles/utils.js +7 -330
  348. package/src/components/global-styles/variations-panel.js +78 -0
  349. package/src/components/global-styles-renderer/index.js +3 -4
  350. package/src/components/header-edit-mode/document-actions/index.js +1 -1
  351. package/src/components/keyboard-shortcut-help-modal/index.js +0 -1
  352. package/src/components/layout/index.js +116 -21
  353. package/src/components/layout/style.scss +29 -5
  354. package/src/components/list/actions/rename-menu-item.js +14 -23
  355. package/src/components/list/style.scss +0 -4
  356. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +3 -4
  357. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +10 -12
  358. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/style.scss +4 -17
  359. package/src/components/sidebar/index.js +2 -0
  360. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +8 -32
  361. package/src/components/sidebar-edit-mode/index.js +0 -11
  362. package/src/components/sidebar-edit-mode/settings-header/style.scss +8 -0
  363. package/src/components/sidebar-navigation-item/style.scss +28 -3
  364. package/src/components/sidebar-navigation-screen/index.js +4 -3
  365. package/src/components/sidebar-navigation-screen/style.scss +2 -0
  366. package/src/components/sidebar-navigation-screen-main/index.js +23 -1
  367. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +25 -0
  368. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +12 -0
  369. package/src/components/sidebar-navigation-screen-templates/index.js +12 -19
  370. package/src/components/site-hub/index.js +120 -109
  371. package/src/components/site-hub/style.scss +7 -1
  372. package/src/components/site-icon/index.js +1 -1
  373. package/src/components/site-icon/style.scss +2 -2
  374. package/src/components/style-book/index.js +10 -5
  375. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +40 -0
  376. package/src/components/template-details/edit-template-title.js +1 -0
  377. package/src/components/template-details/template-part-area-selector.js +1 -0
  378. package/src/components/template-part-converter/convert-to-template-part.js +12 -10
  379. package/src/experiments.js +10 -0
  380. package/src/hooks/push-changes-to-global-styles/index.js +66 -8
  381. package/src/index.js +51 -59
  382. package/src/store/reducer.js +1 -1
  383. package/src/store/selectors.js +6 -26
  384. package/src/store/test/utils.js +181 -0
  385. package/src/store/utils.js +69 -0
  386. package/src/style.scss +4 -2
  387. package/src/utils/template-part-create.js +62 -0
  388. package/src/utils/test/template-part-create.js +63 -0
  389. package/build/components/global-styles/context.js +0 -22
  390. package/build/components/global-styles/context.js.map +0 -1
  391. package/build/components/global-styles/typography-utils.js +0 -92
  392. package/build/components/global-styles/typography-utils.js.map +0 -1
  393. package/build/components/global-styles/use-global-styles-output.js +0 -857
  394. package/build/components/global-styles/use-global-styles-output.js.map +0 -1
  395. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -42
  396. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  397. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  398. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  399. package/build-module/components/global-styles/context.js +0 -12
  400. package/build-module/components/global-styles/context.js.map +0 -1
  401. package/build-module/components/global-styles/typography-utils.js +0 -84
  402. package/build-module/components/global-styles/typography-utils.js.map +0 -1
  403. package/build-module/components/global-styles/use-global-styles-output.js +0 -815
  404. package/build-module/components/global-styles/use-global-styles-output.js.map +0 -1
  405. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -28
  406. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  407. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  408. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  409. package/src/components/global-styles/context.js +0 -15
  410. package/src/components/global-styles/test/typography-utils.js +0 -393
  411. package/src/components/global-styles/test/use-global-styles-output.js +0 -814
  412. package/src/components/global-styles/test/utils.js +0 -206
  413. package/src/components/global-styles/typography-utils.js +0 -87
  414. package/src/components/global-styles/use-global-styles-output.js +0 -936
  415. package/src/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -37
@@ -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,8 +203,12 @@ function useWideSizeProps( name ) {
197
203
  }
198
204
 
199
205
  // Props for managing `spacing.padding`.
200
- function usePaddingProps( name ) {
201
- const [ rawPadding, setRawPadding ] = useStyle( 'spacing.padding', name );
206
+ function usePaddingProps( name, variation = '' ) {
207
+ const prefix = variation ? `variations.${ variation }.` : '';
208
+ const [ rawPadding, setRawPadding ] = useGlobalStyle(
209
+ prefix + 'spacing.padding',
210
+ name
211
+ );
202
212
  const paddingValues = splitStyleValue( rawPadding );
203
213
  const paddingSides = useCustomSides( name, 'padding' );
204
214
  const isAxialPadding =
@@ -210,7 +220,11 @@ function usePaddingProps( name ) {
210
220
  setRawPadding( padding );
211
221
  };
212
222
  const resetPaddingValue = () => setPaddingValues( {} );
213
- const [ userSetPaddingValue ] = useStyle( 'spacing.padding', name, 'user' );
223
+ const [ userSetPaddingValue ] = useGlobalStyle(
224
+ prefix + 'spacing.padding',
225
+ name,
226
+ 'user'
227
+ );
214
228
  // The `hasPaddingValue` check does not need a parsed value, as `userSetPaddingValue` will be `undefined` if not set.
215
229
  const hasPaddingValue = () => !! userSetPaddingValue;
216
230
 
@@ -225,8 +239,12 @@ function usePaddingProps( name ) {
225
239
  }
226
240
 
227
241
  // Props for managing `spacing.margin`.
228
- function useMarginProps( name ) {
229
- const [ rawMargin, setRawMargin ] = useStyle( 'spacing.margin', name );
242
+ function useMarginProps( name, variation = '' ) {
243
+ const prefix = variation ? `variations.${ variation }.` : '';
244
+ const [ rawMargin, setRawMargin ] = useGlobalStyle(
245
+ prefix + 'spacing.margin',
246
+ name
247
+ );
230
248
  const marginValues = splitStyleValue( rawMargin );
231
249
  const marginSides = useCustomSides( name, 'margin' );
232
250
  const isAxialMargin =
@@ -252,14 +270,22 @@ function useMarginProps( name ) {
252
270
  }
253
271
 
254
272
  // Props for managing `spacing.blockGap`.
255
- function useBlockGapProps( name ) {
256
- const [ gapValue, setGapValue ] = useStyle( 'spacing.blockGap', name );
273
+ function useBlockGapProps( name, variation = '' ) {
274
+ const prefix = variation ? `variations.${ variation }.` : '';
275
+ const [ gapValue, setGapValue ] = useGlobalStyle(
276
+ prefix + 'spacing.blockGap',
277
+ name
278
+ );
257
279
  const gapValues = splitGapValue( gapValue );
258
280
  const gapSides = useCustomSides( name, 'blockGap' );
259
281
  const isAxialGap =
260
282
  gapSides && gapSides.some( ( side ) => AXIAL_SIDES.includes( side ) );
261
283
  const resetGapValue = () => setGapValue( undefined );
262
- const [ userSetGapValue ] = useStyle( 'spacing.blockGap', name, 'user' );
284
+ const [ userSetGapValue ] = useGlobalStyle(
285
+ prefix + 'spacing.blockGap',
286
+ name,
287
+ 'user'
288
+ );
263
289
  const hasGapValue = () => !! userSetGapValue;
264
290
  const setGapValues = ( nextBoxGapValue ) => {
265
291
  if ( ! nextBoxGapValue ) {
@@ -288,9 +314,10 @@ function useBlockGapProps( name ) {
288
314
  }
289
315
 
290
316
  // Props for managing `dimensions.minHeight`.
291
- function useMinHeightProps( name ) {
292
- const [ minHeightValue, setMinHeightValue ] = useStyle(
293
- 'dimensions.minHeight',
317
+ function useMinHeightProps( name, variation = '' ) {
318
+ const prefix = variation ? `variations.${ variation }.` : '';
319
+ const [ minHeightValue, setMinHeightValue ] = useGlobalStyle(
320
+ prefix + 'dimensions.minHeight',
294
321
  name
295
322
  );
296
323
  const resetMinHeightValue = () => setMinHeightValue( undefined );
@@ -303,7 +330,7 @@ function useMinHeightProps( name ) {
303
330
  };
304
331
  }
305
332
 
306
- export default function DimensionsPanel( { name } ) {
333
+ export default function DimensionsPanel( { name, variation = '' } ) {
307
334
  const showContentSizeControl = useHasContentSize( name );
308
335
  const showWideSizeControl = useHasWideSize( name );
309
336
  const showPaddingControl = useHasPadding( name );
@@ -312,7 +339,7 @@ export default function DimensionsPanel( { name } ) {
312
339
  const showMinHeightControl = useHasMinHeight( name );
313
340
  const showSpacingPresetsControl = useHasSpacingPresets();
314
341
  const units = useCustomUnits( {
315
- availableUnits: useSetting( 'spacing.units', name )[ 0 ] || [
342
+ availableUnits: useGlobalSetting( 'spacing.units', name )[ 0 ] || [
316
343
  '%',
317
344
  'px',
318
345
  'em',
@@ -345,7 +372,7 @@ export default function DimensionsPanel( { name } ) {
345
372
  setPaddingValues,
346
373
  resetPaddingValue,
347
374
  hasPaddingValue,
348
- } = usePaddingProps( name );
375
+ } = usePaddingProps( name, variation );
349
376
 
350
377
  // Props for managing `spacing.margin`.
351
378
  const {
@@ -355,7 +382,7 @@ export default function DimensionsPanel( { name } ) {
355
382
  setMarginValues,
356
383
  resetMarginValue,
357
384
  hasMarginValue,
358
- } = useMarginProps( name );
385
+ } = useMarginProps( name, variation );
359
386
 
360
387
  // Props for managing `spacing.blockGap`.
361
388
  const {
@@ -367,7 +394,7 @@ export default function DimensionsPanel( { name } ) {
367
394
  setGapValues,
368
395
  resetGapValue,
369
396
  hasGapValue,
370
- } = useBlockGapProps( name );
397
+ } = useBlockGapProps( name, variation );
371
398
 
372
399
  // Props for managing `dimensions.minHeight`.
373
400
  const {
@@ -375,7 +402,7 @@ export default function DimensionsPanel( { name } ) {
375
402
  setMinHeightValue,
376
403
  resetMinHeightValue,
377
404
  hasMinHeightValue,
378
- } = useMinHeightProps( name );
405
+ } = useMinHeightProps( name, variation );
379
406
 
380
407
  const resetAll = () => {
381
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 || [] ),
@@ -1,8 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import fastDeepEqual from 'fast-deep-equal/es6';
5
- import { get, set } from 'lodash';
4
+ import { get } from 'lodash';
6
5
  import { colord, extend } from 'colord';
7
6
  import a11yPlugin from 'colord/plugins/a11y';
8
7
 
@@ -10,162 +9,23 @@ import a11yPlugin from 'colord/plugins/a11y';
10
9
  * WordPress dependencies
11
10
  */
12
11
  import { _x } from '@wordpress/i18n';
13
- import { useContext, useCallback, useMemo } from '@wordpress/element';
12
+ import { useMemo } from '@wordpress/element';
14
13
  import {
15
14
  getBlockType,
16
- __EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE,
17
15
  __EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,
18
16
  } from '@wordpress/blocks';
17
+ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
19
18
 
20
19
  /**
21
20
  * Internal dependencies
22
21
  */
23
- import { getValueFromVariable, getPresetVariableFromValue } from './utils';
24
- import { GlobalStylesContext } from './context';
22
+ import { unlock } from '../../experiments';
23
+
24
+ const { useGlobalSetting } = unlock( blockEditorExperiments );
25
25
 
26
26
  // Enable colord's a11y plugin.
27
27
  extend( [ a11yPlugin ] );
28
28
 
29
- const EMPTY_CONFIG = { settings: {}, styles: {} };
30
-
31
- export const useGlobalStylesReset = () => {
32
- const { user: config, setUserConfig } = useContext( GlobalStylesContext );
33
- const canReset = !! config && ! fastDeepEqual( config, EMPTY_CONFIG );
34
- return [
35
- canReset,
36
- useCallback(
37
- () => setUserConfig( () => EMPTY_CONFIG ),
38
- [ setUserConfig ]
39
- ),
40
- ];
41
- };
42
-
43
- export function useSetting( path, blockName, source = 'all' ) {
44
- const {
45
- merged: mergedConfig,
46
- base: baseConfig,
47
- user: userConfig,
48
- setUserConfig,
49
- } = useContext( GlobalStylesContext );
50
-
51
- const fullPath = ! blockName
52
- ? `settings.${ path }`
53
- : `settings.blocks.${ blockName }.${ path }`;
54
-
55
- const setSetting = ( newValue ) => {
56
- setUserConfig( ( currentConfig ) => {
57
- // Deep clone `currentConfig` to avoid mutating it later.
58
- const newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );
59
- const pathToSet = PATHS_WITH_MERGE[ path ]
60
- ? fullPath + '.custom'
61
- : fullPath;
62
- set( newUserConfig, pathToSet, newValue );
63
-
64
- return newUserConfig;
65
- } );
66
- };
67
-
68
- const getSettingValueForContext = ( name ) => {
69
- const currentPath = ! name
70
- ? `settings.${ path }`
71
- : `settings.blocks.${ name }.${ path }`;
72
-
73
- const getSettingValue = ( configToUse ) => {
74
- const result = get( configToUse, currentPath );
75
- if ( PATHS_WITH_MERGE[ path ] ) {
76
- return result?.custom ?? result?.theme ?? result?.default;
77
- }
78
- return result;
79
- };
80
-
81
- let result;
82
- switch ( source ) {
83
- case 'all':
84
- result = getSettingValue( mergedConfig );
85
- break;
86
- case 'user':
87
- result = getSettingValue( userConfig );
88
- break;
89
- case 'base':
90
- result = getSettingValue( baseConfig );
91
- break;
92
- default:
93
- throw 'Unsupported source';
94
- }
95
-
96
- return result;
97
- };
98
-
99
- // Unlike styles settings get inherited from top level settings.
100
- const resultWithFallback =
101
- getSettingValueForContext( blockName ) ?? getSettingValueForContext();
102
-
103
- return [ resultWithFallback, setSetting ];
104
- }
105
-
106
- export function useStyle( path, blockName, source = 'all' ) {
107
- const {
108
- merged: mergedConfig,
109
- base: baseConfig,
110
- user: userConfig,
111
- setUserConfig,
112
- } = useContext( GlobalStylesContext );
113
- const finalPath = ! blockName
114
- ? `styles.${ path }`
115
- : `styles.blocks.${ blockName }.${ path }`;
116
-
117
- const setStyle = ( newValue ) => {
118
- setUserConfig( ( currentConfig ) => {
119
- // Deep clone `currentConfig` to avoid mutating it later.
120
- const newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );
121
- set(
122
- newUserConfig,
123
- finalPath,
124
- getPresetVariableFromValue(
125
- mergedConfig.settings,
126
- blockName,
127
- path,
128
- newValue
129
- )
130
- );
131
- return newUserConfig;
132
- } );
133
- };
134
-
135
- let result;
136
- switch ( source ) {
137
- case 'all':
138
- result = getValueFromVariable(
139
- mergedConfig,
140
- blockName,
141
- // The stlyes.css path is allowed to be empty, so don't revert to base if undefined.
142
- finalPath === 'styles.css'
143
- ? get( userConfig, finalPath )
144
- : get( userConfig, finalPath ) ??
145
- get( baseConfig, finalPath )
146
- );
147
- break;
148
- case 'user':
149
- result = getValueFromVariable(
150
- mergedConfig,
151
- blockName,
152
- get( userConfig, finalPath )
153
- );
154
- break;
155
- case 'base':
156
- result = getValueFromVariable(
157
- baseConfig,
158
- blockName,
159
- get( baseConfig, finalPath )
160
- );
161
- break;
162
- default:
163
- throw 'Unsupported source';
164
- }
165
-
166
- return [ result, setStyle ];
167
- }
168
-
169
29
  const ROOT_BLOCK_SUPPORTS = [
170
30
  'background',
171
31
  'backgroundColor',
@@ -211,6 +71,11 @@ export function getSupportedGlobalStylesPanels( name ) {
211
71
  supportKeys.push( 'blockGap' );
212
72
  }
213
73
 
74
+ // check for shadow support
75
+ if ( blockType?.supports?.shadow ) {
76
+ supportKeys.push( 'shadow' );
77
+ }
78
+
214
79
  Object.keys( STYLE_PROPERTY ).forEach( ( styleName ) => {
215
80
  if ( ! STYLE_PROPERTY[ styleName ].support ) {
216
81
  return;
@@ -247,10 +112,12 @@ export function getSupportedGlobalStylesPanels( name ) {
247
112
  }
248
113
 
249
114
  export function useColorsPerOrigin( name ) {
250
- const [ customColors ] = useSetting( 'color.palette.custom', name );
251
- const [ themeColors ] = useSetting( 'color.palette.theme', name );
252
- const [ defaultColors ] = useSetting( 'color.palette.default', name );
253
- const [ shouldDisplayDefaultColors ] = useSetting( 'color.defaultPalette' );
115
+ const [ customColors ] = useGlobalSetting( 'color.palette.custom', name );
116
+ const [ themeColors ] = useGlobalSetting( 'color.palette.theme', name );
117
+ const [ defaultColors ] = useGlobalSetting( 'color.palette.default', name );
118
+ const [ shouldDisplayDefaultColors ] = useGlobalSetting(
119
+ 'color.defaultPalette'
120
+ );
254
121
 
255
122
  return useMemo( () => {
256
123
  const result = [];
@@ -290,10 +157,19 @@ export function useColorsPerOrigin( name ) {
290
157
  }
291
158
 
292
159
  export function useGradientsPerOrigin( name ) {
293
- const [ customGradients ] = useSetting( 'color.gradients.custom', name );
294
- const [ themeGradients ] = useSetting( 'color.gradients.theme', name );
295
- const [ defaultGradients ] = useSetting( 'color.gradients.default', name );
296
- const [ shouldDisplayDefaultGradients ] = useSetting(
160
+ const [ customGradients ] = useGlobalSetting(
161
+ 'color.gradients.custom',
162
+ name
163
+ );
164
+ const [ themeGradients ] = useGlobalSetting(
165
+ 'color.gradients.theme',
166
+ name
167
+ );
168
+ const [ defaultGradients ] = useGlobalSetting(
169
+ 'color.gradients.default',
170
+ name
171
+ );
172
+ const [ shouldDisplayDefaultGradients ] = useGlobalSetting(
297
173
  'color.defaultGradients'
298
174
  );
299
175
 
@@ -335,7 +211,7 @@ export function useGradientsPerOrigin( name ) {
335
211
  }
336
212
 
337
213
  export function useColorRandomizer( name ) {
338
- const [ themeColors, setThemeColors ] = useSetting(
214
+ const [ themeColors, setThemeColors ] = useGlobalSetting(
339
215
  'color.palette.theme',
340
216
  name
341
217
  );
@@ -1,3 +1 @@
1
1
  export { default as GlobalStylesUI } from './ui';
2
- export { useGlobalStylesReset, useStyle, useSetting } from './hooks';
3
- export { useGlobalStylesOutput } from './use-global-styles-output';
@@ -13,23 +13,27 @@ import {
13
13
  import { __, _n, sprintf } from '@wordpress/i18n';
14
14
  import { shuffle } from '@wordpress/icons';
15
15
  import { useMemo } from '@wordpress/element';
16
+ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
16
17
 
17
18
  /**
18
19
  * Internal dependencies
19
20
  */
20
21
  import Subtitle from './subtitle';
21
22
  import { NavigationButtonAsItem } from './navigation-button';
22
- import { useColorRandomizer, useSetting } from './hooks';
23
+ import { useColorRandomizer } from './hooks';
23
24
  import ColorIndicatorWrapper from './color-indicator-wrapper';
25
+ import { unlock } from '../../experiments';
26
+
27
+ const { useGlobalSetting } = unlock( blockEditorExperiments );
24
28
 
25
29
  const EMPTY_COLORS = [];
26
30
 
27
31
  function Palette( { name } ) {
28
- const [ customColors ] = useSetting( 'color.palette.custom' );
29
- const [ themeColors ] = useSetting( 'color.palette.theme' );
30
- const [ defaultColors ] = useSetting( 'color.palette.default' );
32
+ const [ customColors ] = useGlobalSetting( 'color.palette.custom' );
33
+ const [ themeColors ] = useGlobalSetting( 'color.palette.theme' );
34
+ const [ defaultColors ] = useGlobalSetting( 'color.palette.default' );
31
35
 
32
- const [ defaultPaletteEnabled ] = useSetting(
36
+ const [ defaultPaletteEnabled ] = useGlobalSetting(
33
37
  'color.defaultPalette',
34
38
  name
35
39
  );
@@ -4,6 +4,7 @@
4
4
  import {
5
5
  __unstableIframe as Iframe,
6
6
  __unstableEditorStyles as EditorStyles,
7
+ experiments as blockEditorExperiments,
7
8
  } from '@wordpress/block-editor';
8
9
  import {
9
10
  __unstableMotion as motion,
@@ -16,8 +17,11 @@ import { useState, useMemo } from '@wordpress/element';
16
17
  /**
17
18
  * Internal dependencies
18
19
  */
19
- import { useSetting, useStyle } from './hooks';
20
- import { useGlobalStylesOutput } from './use-global-styles-output';
20
+ import { unlock } from '../../experiments';
21
+
22
+ const { useGlobalSetting, useGlobalStyle, useGlobalStylesOutput } = unlock(
23
+ blockEditorExperiments
24
+ );
21
25
 
22
26
  const firstFrame = {
23
27
  start: {
@@ -56,23 +60,25 @@ const normalizedHeight = 152;
56
60
  const normalizedColorSwatchSize = 32;
57
61
 
58
62
  const StylesPreview = ( { label, isFocused, withHoverView } ) => {
59
- const [ fontWeight ] = useStyle( 'typography.fontWeight' );
60
- const [ fontFamily = 'serif' ] = useStyle( 'typography.fontFamily' );
61
- const [ headingFontFamily = fontFamily ] = useStyle(
63
+ const [ fontWeight ] = useGlobalStyle( 'typography.fontWeight' );
64
+ const [ fontFamily = 'serif' ] = useGlobalStyle( 'typography.fontFamily' );
65
+ const [ headingFontFamily = fontFamily ] = useGlobalStyle(
62
66
  'elements.h1.typography.fontFamily'
63
67
  );
64
- const [ headingFontWeight = fontWeight ] = useStyle(
68
+ const [ headingFontWeight = fontWeight ] = useGlobalStyle(
65
69
  'elements.h1.typography.fontWeight'
66
70
  );
67
- const [ textColor = 'black' ] = useStyle( 'color.text' );
68
- const [ headingColor = textColor ] = useStyle( 'elements.h1.color.text' );
69
- const [ backgroundColor = 'white' ] = useStyle( 'color.background' );
70
- const [ gradientValue ] = useStyle( 'color.gradient' );
71
+ const [ textColor = 'black' ] = useGlobalStyle( 'color.text' );
72
+ const [ headingColor = textColor ] = useGlobalStyle(
73
+ 'elements.h1.color.text'
74
+ );
75
+ const [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );
76
+ const [ gradientValue ] = useGlobalStyle( 'color.gradient' );
71
77
  const [ styles ] = useGlobalStylesOutput();
72
78
  const disableMotion = useReducedMotion();
73
- const [ coreColors ] = useSetting( 'color.palette.core' );
74
- const [ themeColors ] = useSetting( 'color.palette.theme' );
75
- const [ customColors ] = useSetting( 'color.palette.custom' );
79
+ const [ coreColors ] = useGlobalSetting( 'color.palette.core' );
80
+ const [ themeColors ] = useGlobalSetting( 'color.palette.theme' );
81
+ const [ customColors ] = useGlobalSetting( 'color.palette.custom' );
76
82
  const [ isHovered, setIsHovered ] = useState( false );
77
83
  const [ containerResizeListener, { width } ] = useResizeObserver();
78
84
  const ratio = width ? width / normalizedWidth : 1;