@wordpress/edit-site 5.5.0 → 5.7.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 (310) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/new-template-part.js +3 -11
  3. package/build/components/add-new-template/new-template-part.js.map +1 -1
  4. package/build/components/add-new-template/new-template.js +23 -17
  5. package/build/components/add-new-template/new-template.js.map +1 -1
  6. package/build/components/add-new-template/utils.js +1 -1
  7. package/build/components/add-new-template/utils.js.map +1 -1
  8. package/build/components/app/index.js +4 -2
  9. package/build/components/app/index.js.map +1 -1
  10. package/build/components/block-editor/editor-canvas.js +7 -9
  11. package/build/components/block-editor/editor-canvas.js.map +1 -1
  12. package/build/components/editor/index.js +2 -4
  13. package/build/components/editor/index.js.map +1 -1
  14. package/build/components/global-styles/border-panel.js +20 -159
  15. package/build/components/global-styles/border-panel.js.map +1 -1
  16. package/build/components/global-styles/context-menu.js +4 -6
  17. package/build/components/global-styles/context-menu.js.map +1 -1
  18. package/build/components/global-styles/hooks.js +0 -72
  19. package/build/components/global-styles/hooks.js.map +1 -1
  20. package/build/components/global-styles/preview.js +3 -4
  21. package/build/components/global-styles/preview.js.map +1 -1
  22. package/build/components/global-styles/screen-block-list.js +5 -7
  23. package/build/components/global-styles/screen-block-list.js.map +1 -1
  24. package/build/components/global-styles/screen-border.js +13 -5
  25. package/build/components/global-styles/screen-border.js.map +1 -1
  26. package/build/components/global-styles/screen-colors.js +22 -211
  27. package/build/components/global-styles/screen-colors.js.map +1 -1
  28. package/build/components/global-styles/screen-root.js +2 -1
  29. package/build/components/global-styles/screen-root.js.map +1 -1
  30. package/build/components/global-styles/screen-style-variations.js +2 -1
  31. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  32. package/build/components/global-styles/screen-typography-element.js +4 -0
  33. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  34. package/build/components/global-styles/screen-typography.js +5 -0
  35. package/build/components/global-styles/screen-typography.js.map +1 -1
  36. package/build/components/global-styles/ui.js +5 -35
  37. package/build/components/global-styles/ui.js.map +1 -1
  38. package/build/components/global-styles-renderer/index.js +1 -2
  39. package/build/components/global-styles-renderer/index.js.map +1 -1
  40. package/build/components/layout/index.js +7 -0
  41. package/build/components/layout/index.js.map +1 -1
  42. package/build/components/list/added-by.js +128 -136
  43. package/build/components/list/added-by.js.map +1 -1
  44. package/build/components/list/index.js +2 -1
  45. package/build/components/list/index.js.map +1 -1
  46. package/build/components/list/table.js +6 -5
  47. package/build/components/list/table.js.map +1 -1
  48. package/build/components/routes/link.js +4 -1
  49. package/build/components/routes/link.js.map +1 -1
  50. package/build/components/save-button/index.js +2 -5
  51. package/build/components/save-button/index.js.map +1 -1
  52. package/build/components/save-hub/index.js +82 -0
  53. package/build/components/save-hub/index.js.map +1 -0
  54. package/build/components/secondary-sidebar/list-view-sidebar.js +6 -1
  55. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  56. package/build/components/sidebar/index.js +2 -4
  57. package/build/components/sidebar/index.js.map +1 -1
  58. package/build/components/sidebar-navigation-screen/index.js +5 -2
  59. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  60. package/build/components/sidebar-navigation-screen-main/index.js +13 -13
  61. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  62. package/build/components/sidebar-navigation-screen-navigation-item/index.js +9 -14
  63. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  64. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +87 -10
  65. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  66. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
  67. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  68. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
  69. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  70. package/build/components/sidebar-navigation-screen-template/index.js +59 -10
  71. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  72. package/build/components/sidebar-navigation-screen-templates/index.js +5 -2
  73. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  74. package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
  75. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  76. package/build/components/site-hub/index.js +3 -1
  77. package/build/components/site-hub/index.js.map +1 -1
  78. package/build/components/start-template-options/index.js +44 -9
  79. package/build/components/start-template-options/index.js.map +1 -1
  80. package/build/components/style-book/index.js +133 -19
  81. package/build/components/style-book/index.js.map +1 -1
  82. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  83. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  84. package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
  85. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  86. package/build/components/template-details/index.js +0 -3
  87. package/build/components/template-details/index.js.map +1 -1
  88. package/build/components/template-part-converter/convert-to-regular.js +8 -12
  89. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  90. package/build/components/template-part-converter/convert-to-template-part.js +2 -2
  91. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  92. package/build/components/template-part-converter/index.js +19 -14
  93. package/build/components/template-part-converter/index.js.map +1 -1
  94. package/build/components/use-edited-entity-record/index.js +6 -6
  95. package/build/components/use-edited-entity-record/index.js.map +1 -1
  96. package/build/hooks/push-changes-to-global-styles/index.js +1 -0
  97. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  98. package/build/index.js +3 -0
  99. package/build/index.js.map +1 -1
  100. package/build/utils/history.js +8 -2
  101. package/build/utils/history.js.map +1 -1
  102. package/build-module/components/add-new-template/new-template-part.js +3 -9
  103. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  104. package/build-module/components/add-new-template/new-template.js +25 -18
  105. package/build-module/components/add-new-template/new-template.js.map +1 -1
  106. package/build-module/components/add-new-template/utils.js +1 -1
  107. package/build-module/components/add-new-template/utils.js.map +1 -1
  108. package/build-module/components/app/index.js +3 -2
  109. package/build-module/components/app/index.js.map +1 -1
  110. package/build-module/components/block-editor/editor-canvas.js +8 -10
  111. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  112. package/build-module/components/editor/index.js +2 -3
  113. package/build-module/components/editor/index.js.map +1 -1
  114. package/build-module/components/global-styles/border-panel.js +21 -157
  115. package/build-module/components/global-styles/border-panel.js.map +1 -1
  116. package/build-module/components/global-styles/context-menu.js +4 -4
  117. package/build-module/components/global-styles/context-menu.js.map +1 -1
  118. package/build-module/components/global-styles/hooks.js +0 -66
  119. package/build-module/components/global-styles/hooks.js.map +1 -1
  120. package/build-module/components/global-styles/preview.js +3 -4
  121. package/build-module/components/global-styles/preview.js.map +1 -1
  122. package/build-module/components/global-styles/screen-block-list.js +5 -5
  123. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  124. package/build-module/components/global-styles/screen-border.js +11 -2
  125. package/build-module/components/global-styles/screen-border.js.map +1 -1
  126. package/build-module/components/global-styles/screen-colors.js +23 -208
  127. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  128. package/build-module/components/global-styles/screen-root.js +2 -1
  129. package/build-module/components/global-styles/screen-root.js.map +1 -1
  130. package/build-module/components/global-styles/screen-style-variations.js +2 -1
  131. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  132. package/build-module/components/global-styles/screen-typography-element.js +4 -0
  133. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  134. package/build-module/components/global-styles/screen-typography.js +5 -0
  135. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  136. package/build-module/components/global-styles/ui.js +5 -30
  137. package/build-module/components/global-styles/ui.js.map +1 -1
  138. package/build-module/components/global-styles-renderer/index.js +1 -2
  139. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  140. package/build-module/components/layout/index.js +7 -0
  141. package/build-module/components/layout/index.js.map +1 -1
  142. package/build-module/components/list/added-by.js +126 -137
  143. package/build-module/components/list/added-by.js.map +1 -1
  144. package/build-module/components/list/index.js +2 -1
  145. package/build-module/components/list/index.js.map +1 -1
  146. package/build-module/components/list/table.js +6 -5
  147. package/build-module/components/list/table.js.map +1 -1
  148. package/build-module/components/routes/link.js +5 -2
  149. package/build-module/components/routes/link.js.map +1 -1
  150. package/build-module/components/save-button/index.js +2 -5
  151. package/build-module/components/save-button/index.js.map +1 -1
  152. package/build-module/components/save-hub/index.js +68 -0
  153. package/build-module/components/save-hub/index.js.map +1 -0
  154. package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -2
  155. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  156. package/build-module/components/sidebar/index.js +2 -4
  157. package/build-module/components/sidebar/index.js.map +1 -1
  158. package/build-module/components/sidebar-navigation-screen/index.js +5 -2
  159. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  160. package/build-module/components/sidebar-navigation-screen-main/index.js +13 -13
  161. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  162. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +13 -18
  163. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  164. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +81 -10
  165. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  166. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
  167. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  168. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
  169. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  170. package/build-module/components/sidebar-navigation-screen-template/index.js +60 -13
  171. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  172. package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -2
  173. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  174. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
  175. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  176. package/build-module/components/site-hub/index.js +3 -1
  177. package/build-module/components/site-hub/index.js.map +1 -1
  178. package/build-module/components/start-template-options/index.js +45 -10
  179. package/build-module/components/start-template-options/index.js.map +1 -1
  180. package/build-module/components/style-book/index.js +133 -21
  181. package/build-module/components/style-book/index.js.map +1 -1
  182. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  183. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  184. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
  185. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  186. package/build-module/components/template-details/index.js +0 -3
  187. package/build-module/components/template-details/index.js.map +1 -1
  188. package/build-module/components/template-part-converter/convert-to-regular.js +9 -13
  189. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  190. package/build-module/components/template-part-converter/convert-to-template-part.js +3 -3
  191. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  192. package/build-module/components/template-part-converter/index.js +20 -15
  193. package/build-module/components/template-part-converter/index.js.map +1 -1
  194. package/build-module/components/use-edited-entity-record/index.js +6 -6
  195. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  196. package/build-module/hooks/push-changes-to-global-styles/index.js +1 -0
  197. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  198. package/build-module/index.js +4 -1
  199. package/build-module/index.js.map +1 -1
  200. package/build-module/utils/history.js +9 -3
  201. package/build-module/utils/history.js.map +1 -1
  202. package/build-style/style-rtl.css +172 -128
  203. package/build-style/style.css +172 -128
  204. package/package.json +31 -31
  205. package/src/components/add-new-template/new-template-part.js +1 -6
  206. package/src/components/add-new-template/new-template.js +60 -38
  207. package/src/components/add-new-template/style.scss +12 -1
  208. package/src/components/add-new-template/utils.js +1 -1
  209. package/src/components/app/index.js +9 -6
  210. package/src/components/block-editor/editor-canvas.js +13 -22
  211. package/src/components/editor/index.js +61 -65
  212. package/src/components/global-styles/border-panel.js +24 -199
  213. package/src/components/global-styles/context-menu.js +4 -4
  214. package/src/components/global-styles/hooks.js +0 -101
  215. package/src/components/global-styles/preview.js +1 -1
  216. package/src/components/global-styles/screen-block-list.js +4 -4
  217. package/src/components/global-styles/screen-border.js +9 -2
  218. package/src/components/global-styles/screen-colors.js +25 -229
  219. package/src/components/global-styles/screen-root.js +1 -1
  220. package/src/components/global-styles/screen-style-variations.js +5 -1
  221. package/src/components/global-styles/screen-typography-element.js +4 -0
  222. package/src/components/global-styles/screen-typography.js +6 -0
  223. package/src/components/global-styles/stories/index.js +425 -0
  224. package/src/components/global-styles/style.scss +14 -18
  225. package/src/components/global-styles/ui.js +6 -31
  226. package/src/components/global-styles-renderer/index.js +1 -2
  227. package/src/components/layout/index.js +15 -0
  228. package/src/components/layout/style.scss +1 -3
  229. package/src/components/list/added-by.js +144 -140
  230. package/src/components/list/index.js +3 -1
  231. package/src/components/list/table.js +7 -4
  232. package/src/components/routes/link.js +9 -2
  233. package/src/components/save-button/index.js +2 -2
  234. package/src/components/save-hub/index.js +78 -0
  235. package/src/components/save-hub/style.scss +15 -0
  236. package/src/components/secondary-sidebar/list-view-sidebar.js +4 -3
  237. package/src/components/sidebar/index.js +2 -3
  238. package/src/components/sidebar/style.scss +4 -3
  239. package/src/components/sidebar-button/style.scss +2 -1
  240. package/src/components/sidebar-navigation-item/style.scss +1 -23
  241. package/src/components/sidebar-navigation-screen/index.js +6 -0
  242. package/src/components/sidebar-navigation-screen/style.scss +15 -0
  243. package/src/components/sidebar-navigation-screen-main/index.js +21 -8
  244. package/src/components/sidebar-navigation-screen-navigation-item/index.js +30 -21
  245. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +92 -9
  246. package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
  247. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
  248. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +108 -1
  249. package/src/components/sidebar-navigation-screen-template/index.js +82 -11
  250. package/src/components/sidebar-navigation-screen-template/style.scss +25 -0
  251. package/src/components/sidebar-navigation-screen-templates/index.js +7 -0
  252. package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -1
  253. package/src/components/site-hub/index.js +5 -1
  254. package/src/components/site-hub/style.scss +5 -1
  255. package/src/components/start-template-options/index.js +40 -8
  256. package/src/components/style-book/index.js +203 -54
  257. package/src/components/style-book/style.scss +2 -46
  258. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
  259. package/src/components/sync-state-with-url/use-sync-path-with-url.js +12 -7
  260. package/src/components/template-details/index.js +0 -3
  261. package/src/components/template-part-converter/convert-to-regular.js +10 -17
  262. package/src/components/template-part-converter/convert-to-template-part.js +9 -16
  263. package/src/components/template-part-converter/index.js +28 -12
  264. package/src/components/use-edited-entity-record/index.js +26 -18
  265. package/src/hooks/push-changes-to-global-styles/index.js +1 -0
  266. package/src/index.js +5 -1
  267. package/src/store/test/actions.js +0 -2
  268. package/src/style.scss +2 -1
  269. package/src/utils/history.js +13 -9
  270. package/build/components/global-styles/color-utils.js +0 -17
  271. package/build/components/global-styles/color-utils.js.map +0 -1
  272. package/build/components/global-styles/screen-background-color.js +0 -114
  273. package/build/components/global-styles/screen-background-color.js.map +0 -1
  274. package/build/components/global-styles/screen-button-color.js +0 -88
  275. package/build/components/global-styles/screen-button-color.js.map +0 -1
  276. package/build/components/global-styles/screen-heading-color.js +0 -165
  277. package/build/components/global-styles/screen-heading-color.js.map +0 -1
  278. package/build/components/global-styles/screen-link-color.js +0 -105
  279. package/build/components/global-styles/screen-link-color.js.map +0 -1
  280. package/build/components/global-styles/screen-text-color.js +0 -71
  281. package/build/components/global-styles/screen-text-color.js.map +0 -1
  282. package/build/components/navigation-inspector/index.js +0 -161
  283. package/build/components/navigation-inspector/index.js.map +0 -1
  284. package/build/components/navigation-inspector/navigation-menu.js +0 -79
  285. package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
  286. package/build-module/components/global-styles/color-utils.js +0 -9
  287. package/build-module/components/global-styles/color-utils.js.map +0 -1
  288. package/build-module/components/global-styles/screen-background-color.js +0 -97
  289. package/build-module/components/global-styles/screen-background-color.js.map +0 -1
  290. package/build-module/components/global-styles/screen-button-color.js +0 -73
  291. package/build-module/components/global-styles/screen-button-color.js.map +0 -1
  292. package/build-module/components/global-styles/screen-heading-color.js +0 -149
  293. package/build-module/components/global-styles/screen-heading-color.js.map +0 -1
  294. package/build-module/components/global-styles/screen-link-color.js +0 -89
  295. package/build-module/components/global-styles/screen-link-color.js.map +0 -1
  296. package/build-module/components/global-styles/screen-text-color.js +0 -56
  297. package/build-module/components/global-styles/screen-text-color.js.map +0 -1
  298. package/build-module/components/navigation-inspector/index.js +0 -146
  299. package/build-module/components/navigation-inspector/index.js.map +0 -1
  300. package/build-module/components/navigation-inspector/navigation-menu.js +0 -69
  301. package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
  302. package/src/components/global-styles/color-utils.js +0 -14
  303. package/src/components/global-styles/screen-background-color.js +0 -132
  304. package/src/components/global-styles/screen-button-color.js +0 -104
  305. package/src/components/global-styles/screen-heading-color.js +0 -206
  306. package/src/components/global-styles/screen-link-color.js +0 -124
  307. package/src/components/global-styles/screen-text-color.js +0 -62
  308. package/src/components/navigation-inspector/index.js +0 -191
  309. package/src/components/navigation-inspector/navigation-menu.js +0 -84
  310. package/src/components/navigation-inspector/style.scss +0 -46
@@ -27,8 +27,6 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
27
27
  /**
28
28
  * Internal dependencies
29
29
  */
30
- import { useHasBorderPanel } from './border-panel';
31
- import { useHasColorPanel } from './color-utils';
32
30
  import { useHasFilterPanel } from './filter-utils';
33
31
  import { useHasVariationsPanel } from './variations-panel';
34
32
  import { NavigationButtonAsItem } from './navigation-button';
@@ -40,6 +38,8 @@ import { unlock } from '../../private-apis';
40
38
  const {
41
39
  useHasDimensionsPanel,
42
40
  useHasTypographyPanel,
41
+ useHasBorderPanel,
42
+ useHasColorPanel,
43
43
  useGlobalSetting,
44
44
  useSettingsForBlockElement,
45
45
  } = unlock( blockEditorPrivateApis );
@@ -48,8 +48,8 @@ function ContextMenu( { name, parentMenu = '' } ) {
48
48
  const [ rawSettings ] = useGlobalSetting( '', name );
49
49
  const settings = useSettingsForBlockElement( rawSettings, name );
50
50
  const hasTypographyPanel = useHasTypographyPanel( settings );
51
- const hasColorPanel = useHasColorPanel( name );
52
- const hasBorderPanel = useHasBorderPanel( name );
51
+ const hasColorPanel = useHasColorPanel( settings );
52
+ const hasBorderPanel = useHasBorderPanel( settings );
53
53
  const hasEffectsPanel = useHasShadowControl( name );
54
54
  const hasFilterPanel = useHasFilterPanel( name );
55
55
  const hasDimensionsPanel = useHasDimensionsPanel( settings );
@@ -7,8 +7,6 @@ import a11yPlugin from 'colord/plugins/a11y';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
- import { _x } from '@wordpress/i18n';
11
- import { useMemo } from '@wordpress/element';
12
10
  import { store as blocksStore } from '@wordpress/blocks';
13
11
  import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
14
12
 
@@ -23,105 +21,6 @@ const { useGlobalSetting } = unlock( blockEditorPrivateApis );
23
21
  // Enable colord's a11y plugin.
24
22
  extend( [ a11yPlugin ] );
25
23
 
26
- export function useColorsPerOrigin( name ) {
27
- const [ customColors ] = useGlobalSetting( 'color.palette.custom', name );
28
- const [ themeColors ] = useGlobalSetting( 'color.palette.theme', name );
29
- const [ defaultColors ] = useGlobalSetting( 'color.palette.default', name );
30
- const [ shouldDisplayDefaultColors ] = useGlobalSetting(
31
- 'color.defaultPalette'
32
- );
33
-
34
- return useMemo( () => {
35
- const result = [];
36
- if ( themeColors && themeColors.length ) {
37
- result.push( {
38
- name: _x(
39
- 'Theme',
40
- 'Indicates this palette comes from the theme.'
41
- ),
42
- colors: themeColors,
43
- } );
44
- }
45
- if (
46
- shouldDisplayDefaultColors &&
47
- defaultColors &&
48
- defaultColors.length
49
- ) {
50
- result.push( {
51
- name: _x(
52
- 'Default',
53
- 'Indicates this palette comes from WordPress.'
54
- ),
55
- colors: defaultColors,
56
- } );
57
- }
58
- if ( customColors && customColors.length ) {
59
- result.push( {
60
- name: _x(
61
- 'Custom',
62
- 'Indicates this palette is created by the user.'
63
- ),
64
- colors: customColors,
65
- } );
66
- }
67
- return result;
68
- }, [ customColors, themeColors, defaultColors ] );
69
- }
70
-
71
- export function useGradientsPerOrigin( name ) {
72
- const [ customGradients ] = useGlobalSetting(
73
- 'color.gradients.custom',
74
- name
75
- );
76
- const [ themeGradients ] = useGlobalSetting(
77
- 'color.gradients.theme',
78
- name
79
- );
80
- const [ defaultGradients ] = useGlobalSetting(
81
- 'color.gradients.default',
82
- name
83
- );
84
- const [ shouldDisplayDefaultGradients ] = useGlobalSetting(
85
- 'color.defaultGradients'
86
- );
87
-
88
- return useMemo( () => {
89
- const result = [];
90
- if ( themeGradients && themeGradients.length ) {
91
- result.push( {
92
- name: _x(
93
- 'Theme',
94
- 'Indicates this palette comes from the theme.'
95
- ),
96
- gradients: themeGradients,
97
- } );
98
- }
99
- if (
100
- shouldDisplayDefaultGradients &&
101
- defaultGradients &&
102
- defaultGradients.length
103
- ) {
104
- result.push( {
105
- name: _x(
106
- 'Default',
107
- 'Indicates this palette comes from WordPress.'
108
- ),
109
- gradients: defaultGradients,
110
- } );
111
- }
112
- if ( customGradients && customGradients.length ) {
113
- result.push( {
114
- name: _x(
115
- 'Custom',
116
- 'Indicates this palette is created by the user.'
117
- ),
118
- gradients: customGradients,
119
- } );
120
- }
121
- return result;
122
- }, [ customGradients, themeGradients, defaultGradients ] );
123
- }
124
-
125
24
  export function useColorRandomizer( name ) {
126
25
  const [ themeColors, setThemeColors ] = useGlobalSetting(
127
26
  'color.palette.theme',
@@ -117,7 +117,6 @@ const StylesPreview = ( { label, isFocused, withHoverView } ) => {
117
117
  { isReady && (
118
118
  <Iframe
119
119
  className="edit-site-global-styles-preview__iframe"
120
- head={ <EditorStyles styles={ editorStyles } /> }
121
120
  style={ {
122
121
  height: normalizedHeight * ratio,
123
122
  } }
@@ -125,6 +124,7 @@ const StylesPreview = ( { label, isFocused, withHoverView } ) => {
125
124
  onMouseLeave={ () => setIsHovered( false ) }
126
125
  tabIndex={ -1 }
127
126
  >
127
+ <EditorStyles styles={ editorStyles } />
128
128
  <motion.div
129
129
  style={ {
130
130
  height: normalizedHeight * ratio,
@@ -20,8 +20,6 @@ import { speak } from '@wordpress/a11y';
20
20
  /**
21
21
  * Internal dependencies
22
22
  */
23
- import { useHasBorderPanel } from './border-panel';
24
- import { useHasColorPanel } from './color-utils';
25
23
  import { useHasVariationsPanel } from './variations-panel';
26
24
  import ScreenHeader from './header';
27
25
  import { NavigationButtonAsItem } from './navigation-button';
@@ -30,8 +28,10 @@ import { unlock } from '../../private-apis';
30
28
  const {
31
29
  useHasDimensionsPanel,
32
30
  useHasTypographyPanel,
31
+ useHasBorderPanel,
33
32
  useGlobalSetting,
34
33
  useSettingsForBlockElement,
34
+ useHasColorPanel,
35
35
  } = unlock( blockEditorPrivateApis );
36
36
 
37
37
  function useSortedBlockTypes() {
@@ -61,8 +61,8 @@ function BlockMenuItem( { block } ) {
61
61
  const [ rawSettings ] = useGlobalSetting( '', block.name );
62
62
  const settings = useSettingsForBlockElement( rawSettings, block.name );
63
63
  const hasTypographyPanel = useHasTypographyPanel( settings );
64
- const hasColorPanel = useHasColorPanel( block.name );
65
- const hasBorderPanel = useHasBorderPanel( block.name );
64
+ const hasColorPanel = useHasColorPanel( settings );
65
+ const hasBorderPanel = useHasBorderPanel( settings );
66
66
  const hasDimensionsPanel = useHasDimensionsPanel( settings );
67
67
  const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
68
68
  const hasVariationsPanel = useHasVariationsPanel( block.name );
@@ -2,17 +2,24 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
8
9
  */
9
10
  import ScreenHeader from './header';
10
- import BorderPanel, { useHasBorderPanel } from './border-panel';
11
+ import BorderPanel from './border-panel';
11
12
  import BlockPreviewPanel from './block-preview-panel';
12
13
  import { getVariationClassName } from './utils';
14
+ import { unlock } from '../../private-apis';
15
+
16
+ const { useHasBorderPanel, useGlobalSetting, useSettingsForBlockElement } =
17
+ unlock( blockEditorPrivateApis );
13
18
 
14
19
  function ScreenBorder( { name, variation = '' } ) {
15
- const hasBorderPanel = useHasBorderPanel( name );
20
+ const [ rawSettings ] = useGlobalSetting( '', name );
21
+ const settings = useSettingsForBlockElement( rawSettings, name );
22
+ const hasBorderPanel = useHasBorderPanel( settings );
16
23
  const variationClassName = getVariationClassName( variation );
17
24
  return (
18
25
  <>
@@ -2,14 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import {
6
- __experimentalItemGroup as ItemGroup,
7
- __experimentalHStack as HStack,
8
- __experimentalVStack as VStack,
9
- __experimentalZStack as ZStack,
10
- FlexItem,
11
- ColorIndicator,
12
- } from '@wordpress/components';
5
+ import { __experimentalVStack as VStack } from '@wordpress/components';
13
6
  import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
14
7
 
15
8
  /**
@@ -17,205 +10,32 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
17
10
  */
18
11
  import ScreenHeader from './header';
19
12
  import Palette from './palette';
20
- import { NavigationButtonAsItem } from './navigation-button';
21
- import { useSupportedStyles } from './hooks';
22
- import Subtitle from './subtitle';
23
- import ColorIndicatorWrapper from './color-indicator-wrapper';
24
13
  import BlockPreviewPanel from './block-preview-panel';
25
14
  import { getVariationClassName } from './utils';
26
15
  import { unlock } from '../../private-apis';
27
16
 
28
- const { useGlobalStyle } = unlock( blockEditorPrivateApis );
17
+ const {
18
+ useGlobalStyle,
19
+ useGlobalSetting,
20
+ useSettingsForBlockElement,
21
+ ColorPanel: StylesColorPanel,
22
+ } = unlock( blockEditorPrivateApis );
29
23
 
30
- function BackgroundColorItem( { name, parentMenu, variation = '' } ) {
31
- const prefix = variation ? `variations.${ variation }.` : '';
32
- const urlPrefix = variation ? `/variations/${ variation }` : '';
33
- const supports = useSupportedStyles( name );
34
- const hasSupport =
35
- supports.includes( 'backgroundColor' ) ||
36
- supports.includes( 'background' );
37
- const [ backgroundColor ] = useGlobalStyle(
38
- prefix + 'color.background',
39
- name
40
- );
41
- const [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient', name );
42
-
43
- if ( ! hasSupport ) {
44
- return null;
45
- }
46
-
47
- return (
48
- <NavigationButtonAsItem
49
- path={ parentMenu + urlPrefix + '/colors/background' }
50
- aria-label={ __( 'Colors background styles' ) }
51
- >
52
- <HStack justify="flex-start">
53
- <ColorIndicatorWrapper expanded={ false }>
54
- <ColorIndicator
55
- colorValue={ gradientValue ?? backgroundColor }
56
- data-testid="background-color-indicator"
57
- />
58
- </ColorIndicatorWrapper>
59
- <FlexItem className="edit-site-global-styles__color-label">
60
- { __( 'Background' ) }
61
- </FlexItem>
62
- </HStack>
63
- </NavigationButtonAsItem>
64
- );
65
- }
66
-
67
- function TextColorItem( { name, parentMenu, variation = '' } ) {
68
- const prefix = variation ? `variations.${ variation }.` : '';
69
- const urlPrefix = variation ? `/variations/${ variation }` : '';
70
- const supports = useSupportedStyles( name );
71
- const hasSupport = supports.includes( 'color' );
72
- const [ color ] = useGlobalStyle( prefix + 'color.text', name );
73
-
74
- if ( ! hasSupport ) {
75
- return null;
76
- }
77
-
78
- return (
79
- <NavigationButtonAsItem
80
- path={ parentMenu + urlPrefix + '/colors/text' }
81
- aria-label={ __( 'Colors text styles' ) }
82
- >
83
- <HStack justify="flex-start">
84
- <ColorIndicatorWrapper expanded={ false }>
85
- <ColorIndicator
86
- colorValue={ color }
87
- data-testid="text-color-indicator"
88
- />
89
- </ColorIndicatorWrapper>
90
- <FlexItem className="edit-site-global-styles__color-label">
91
- { __( 'Text' ) }
92
- </FlexItem>
93
- </HStack>
94
- </NavigationButtonAsItem>
95
- );
96
- }
97
-
98
- function LinkColorItem( { name, parentMenu, variation = '' } ) {
99
- const prefix = variation ? `variations.${ variation }.` : '';
100
- const urlPrefix = variation ? `/variations/${ variation }` : '';
101
- const supports = useSupportedStyles( name );
102
- const hasSupport = supports.includes( 'linkColor' );
103
- const [ color ] = useGlobalStyle(
104
- prefix + 'elements.link.color.text',
105
- name
106
- );
107
- const [ colorHover ] = useGlobalStyle(
108
- prefix + 'elements.link.:hover.color.text',
109
- name
110
- );
111
-
112
- if ( ! hasSupport ) {
113
- return null;
114
- }
115
-
116
- return (
117
- <NavigationButtonAsItem
118
- path={ parentMenu + urlPrefix + '/colors/link' }
119
- aria-label={ __( 'Colors link styles' ) }
120
- >
121
- <HStack justify="flex-start">
122
- <ZStack isLayered={ false } offset={ -8 }>
123
- <ColorIndicatorWrapper expanded={ false }>
124
- <ColorIndicator colorValue={ color } />
125
- </ColorIndicatorWrapper>
126
- <ColorIndicatorWrapper expanded={ false }>
127
- <ColorIndicator colorValue={ colorHover } />
128
- </ColorIndicatorWrapper>
129
- </ZStack>
130
- <FlexItem className="edit-site-global-styles__color-label">
131
- { __( 'Links' ) }
132
- </FlexItem>
133
- </HStack>
134
- </NavigationButtonAsItem>
135
- );
136
- }
137
-
138
- function HeadingColorItem( { name, parentMenu, variation = '' } ) {
139
- const prefix = variation ? `variations.${ variation }.` : '';
140
- const urlPrefix = variation ? `/variations/${ variation }` : '';
141
- const supports = useSupportedStyles( name );
142
- const hasSupport = supports.includes( 'color' );
143
- const [ color ] = useGlobalStyle(
144
- prefix + 'elements.heading.color.text',
145
- name
146
- );
147
- const [ bgColor ] = useGlobalStyle(
148
- prefix + 'elements.heading.color.background',
149
- name
150
- );
151
-
152
- if ( ! hasSupport ) {
153
- return null;
154
- }
155
-
156
- return (
157
- <NavigationButtonAsItem
158
- path={ parentMenu + urlPrefix + '/colors/heading' }
159
- aria-label={ __( 'Colors heading styles' ) }
160
- >
161
- <HStack justify="flex-start">
162
- <ZStack isLayered={ false } offset={ -8 }>
163
- <ColorIndicatorWrapper expanded={ false }>
164
- <ColorIndicator colorValue={ bgColor } />
165
- </ColorIndicatorWrapper>
166
- <ColorIndicatorWrapper expanded={ false }>
167
- <ColorIndicator colorValue={ color } />
168
- </ColorIndicatorWrapper>
169
- </ZStack>
170
- <FlexItem>{ __( 'Headings' ) }</FlexItem>
171
- </HStack>
172
- </NavigationButtonAsItem>
173
- );
174
- }
175
-
176
- function ButtonColorItem( { name, parentMenu, variation = '' } ) {
177
- const prefix = variation ? `variations.${ variation }.` : '';
178
- const urlPrefix = variation ? `/variations/${ variation }` : '';
179
- const supports = useSupportedStyles( name );
180
- const hasSupport = supports.includes( 'buttonColor' );
181
- const [ color ] = useGlobalStyle(
182
- prefix + 'elements.button.color.text',
183
- name
184
- );
185
- const [ bgColor ] = useGlobalStyle(
186
- prefix + 'elements.button.color.background',
187
- name
188
- );
24
+ function ScreenColors( { name, variation = '' } ) {
25
+ const variationClassName = getVariationClassName( variation );
189
26
 
190
- if ( ! hasSupport ) {
191
- return null;
27
+ let prefixParts = [];
28
+ if ( variation ) {
29
+ prefixParts = [ 'variations', variation ].concat( prefixParts );
192
30
  }
31
+ const prefix = prefixParts.join( '.' );
193
32
 
194
- return (
195
- <NavigationButtonAsItem
196
- path={ parentMenu + urlPrefix + '/colors/button' }
197
- >
198
- <HStack justify="flex-start">
199
- <ZStack isLayered={ false } offset={ -8 }>
200
- <ColorIndicatorWrapper expanded={ false }>
201
- <ColorIndicator colorValue={ bgColor } />
202
- </ColorIndicatorWrapper>
203
- <ColorIndicatorWrapper expanded={ false }>
204
- <ColorIndicator colorValue={ color } />
205
- </ColorIndicatorWrapper>
206
- </ZStack>
207
- <FlexItem className="edit-site-global-styles__color-label">
208
- { __( 'Buttons' ) }
209
- </FlexItem>
210
- </HStack>
211
- </NavigationButtonAsItem>
212
- );
213
- }
214
-
215
- function ScreenColors( { name, variation = '' } ) {
216
- const parentMenu =
217
- name === undefined ? '' : '/blocks/' + encodeURIComponent( name );
218
- const variationClassName = getVariationClassName( variation );
33
+ const [ style ] = useGlobalStyle( prefix, name, 'user', false );
34
+ const [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {
35
+ shouldDecodeEncode: false,
36
+ } );
37
+ const [ rawSettings ] = useGlobalSetting( '', name );
38
+ const settings = useSettingsForBlockElement( rawSettings, name );
219
39
 
220
40
  return (
221
41
  <>
@@ -232,36 +52,12 @@ function ScreenColors( { name, variation = '' } ) {
232
52
  <VStack spacing={ 10 }>
233
53
  <Palette name={ name } />
234
54
 
235
- <VStack spacing={ 3 }>
236
- <Subtitle level={ 3 }>{ __( 'Elements' ) }</Subtitle>
237
- <ItemGroup isBordered isSeparated>
238
- <BackgroundColorItem
239
- name={ name }
240
- parentMenu={ parentMenu }
241
- variation={ variation }
242
- />
243
- <TextColorItem
244
- name={ name }
245
- parentMenu={ parentMenu }
246
- variation={ variation }
247
- />
248
- <LinkColorItem
249
- name={ name }
250
- parentMenu={ parentMenu }
251
- variation={ variation }
252
- />
253
- <HeadingColorItem
254
- name={ name }
255
- parentMenu={ parentMenu }
256
- variation={ variation }
257
- />
258
- <ButtonColorItem
259
- name={ name }
260
- parentMenu={ parentMenu }
261
- variation={ variation }
262
- />
263
- </ItemGroup>
264
- </VStack>
55
+ <StylesColorPanel
56
+ inheritedValue={ inheritedStyle }
57
+ value={ style }
58
+ onChange={ setStyle }
59
+ settings={ settings }
60
+ />
265
61
  </VStack>
266
62
  </div>
267
63
  </>
@@ -51,7 +51,7 @@ function ScreenRoot() {
51
51
  }, [] );
52
52
 
53
53
  return (
54
- <Card size="small">
54
+ <Card size="small" className="edit-site-global-styles-screen-root">
55
55
  <CardBody>
56
56
  <VStack spacing={ 4 }>
57
57
  <Card>
@@ -172,7 +172,11 @@ function ScreenStyleVariations() {
172
172
  ) }
173
173
  />
174
174
 
175
- <Card size="small" isBorderless>
175
+ <Card
176
+ size="small"
177
+ isBorderless
178
+ className="edit-site-global-styles-screen-style-variations"
179
+ >
176
180
  <CardBody>
177
181
  <Grid columns={ 2 }>
178
182
  { withEmptyVariation?.map( ( variation, index ) => (
@@ -29,6 +29,10 @@ const elements = {
29
29
  description: __( 'Manage the fonts and typography used on headings.' ),
30
30
  title: __( 'Headings' ),
31
31
  },
32
+ caption: {
33
+ description: __( 'Manage the fonts and typography used on captions.' ),
34
+ title: __( 'Captions' ),
35
+ },
32
36
  button: {
33
37
  description: __( 'Manage the fonts and typography used on buttons.' ),
34
38
  title: __( 'Buttons' ),
@@ -129,6 +129,12 @@ function ScreenTypography( { name, variation = '' } ) {
129
129
  element="heading"
130
130
  label={ __( 'Headings' ) }
131
131
  />
132
+ <Item
133
+ name={ name }
134
+ parentMenu={ parentMenu }
135
+ element="caption"
136
+ label={ __( 'Captions' ) }
137
+ />
132
138
  <Item
133
139
  name={ name }
134
140
  parentMenu={ parentMenu }