@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
@@ -1,8 +1,16 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import classnames from 'classnames';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
4
9
  import { __ } from '@wordpress/i18n';
5
- import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
10
+ import {
11
+ __experimentalColorGradientControl as ColorGradientControl,
12
+ experiments as blockEditorExperiments,
13
+ } from '@wordpress/block-editor';
6
14
 
7
15
  /**
8
16
  * Internal dependencies
@@ -12,43 +20,52 @@ import {
12
20
  getSupportedGlobalStylesPanels,
13
21
  useColorsPerOrigin,
14
22
  useGradientsPerOrigin,
15
- useSetting,
16
- useStyle,
17
23
  } from './hooks';
24
+ import { unlock } from '../../experiments';
25
+
26
+ const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
18
27
 
19
- function ScreenBackgroundColor( { name } ) {
28
+ function ScreenBackgroundColor( { name, variation = '' } ) {
29
+ const prefix = variation ? `variations.${ variation }.` : '';
20
30
  const supports = getSupportedGlobalStylesPanels( name );
21
- const [ solids ] = useSetting( 'color.palette', name );
22
- const [ gradients ] = useSetting( 'color.gradients', name );
23
- const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
24
- const [ areCustomGradientsEnabled ] = useSetting(
31
+ const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
32
+ const [ areCustomGradientsEnabled ] = useGlobalSetting(
25
33
  'color.customGradient',
26
34
  name
27
35
  );
28
-
29
36
  const colorsPerOrigin = useColorsPerOrigin( name );
30
37
  const gradientsPerOrigin = useGradientsPerOrigin( name );
31
38
 
32
- const [ isBackgroundEnabled ] = useSetting( 'color.background', name );
39
+ const [ isBackgroundEnabled ] = useGlobalSetting(
40
+ 'color.background',
41
+ name
42
+ );
33
43
 
34
44
  const hasBackgroundColor =
35
45
  supports.includes( 'backgroundColor' ) &&
36
46
  isBackgroundEnabled &&
37
- ( solids.length > 0 || areCustomSolidsEnabled );
47
+ ( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
38
48
  const hasGradientColor =
39
49
  supports.includes( 'background' ) &&
40
- ( gradients.length > 0 || areCustomGradientsEnabled );
41
- const [ backgroundColor, setBackgroundColor ] = useStyle(
42
- 'color.background',
50
+ ( gradientsPerOrigin.length > 0 || areCustomGradientsEnabled );
51
+ const [ backgroundColor, setBackgroundColor ] = useGlobalStyle(
52
+ prefix + 'color.background',
43
53
  name
44
54
  );
45
- const [ userBackgroundColor ] = useStyle(
46
- 'color.background',
55
+ const [ userBackgroundColor ] = useGlobalStyle(
56
+ prefix + 'color.background',
57
+ name,
58
+ 'user'
59
+ );
60
+ const [ gradient, setGradient ] = useGlobalStyle(
61
+ prefix + 'color.gradient',
62
+ name
63
+ );
64
+ const [ userGradient ] = useGlobalStyle(
65
+ prefix + 'color.gradient',
47
66
  name,
48
67
  'user'
49
68
  );
50
- const [ gradient, setGradient ] = useStyle( 'color.gradient', name );
51
- const [ userGradient ] = useStyle( 'color.gradient', name, 'user' );
52
69
 
53
70
  if ( ! hasBackgroundColor && ! hasGradientColor ) {
54
71
  return null;
@@ -91,7 +108,13 @@ function ScreenBackgroundColor( { name } ) {
91
108
  ) }
92
109
  />
93
110
  <ColorGradientControl
94
- className="edit-site-screen-background-color__control"
111
+ className={ classnames(
112
+ 'edit-site-screen-background-color__control',
113
+ {
114
+ 'has-no-tabs':
115
+ ! hasBackgroundColor || ! hasGradientColor,
116
+ }
117
+ ) }
95
118
  colors={ colorsPerOrigin }
96
119
  gradients={ gradientsPerOrigin }
97
120
  disableCustomColors={ ! areCustomSolidsEnabled }
@@ -21,6 +21,7 @@ import { useHasBorderPanel } from './border-panel';
21
21
  import { useHasColorPanel } from './color-utils';
22
22
  import { useHasDimensionsPanel } from './dimensions-panel';
23
23
  import { useHasTypographyPanel } from './typography-panel';
24
+ import { useHasVariationsPanel } from './variations-panel';
24
25
  import ScreenHeader from './header';
25
26
  import { NavigationButtonAsItem } from './navigation-button';
26
27
 
@@ -53,8 +54,12 @@ function BlockMenuItem( { block } ) {
53
54
  const hasBorderPanel = useHasBorderPanel( block.name );
54
55
  const hasDimensionsPanel = useHasDimensionsPanel( block.name );
55
56
  const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
57
+ const hasVariationsPanel = useHasVariationsPanel( block.name );
56
58
  const hasBlockMenuItem =
57
- hasTypographyPanel || hasColorPanel || hasLayoutPanel;
59
+ hasTypographyPanel ||
60
+ hasColorPanel ||
61
+ hasLayoutPanel ||
62
+ hasVariationsPanel;
58
63
 
59
64
  if ( ! hasBlockMenuItem ) {
60
65
  return null;
@@ -9,15 +9,23 @@ import { __ } from '@wordpress/i18n';
9
9
  import ScreenHeader from './header';
10
10
  import BorderPanel, { useHasBorderPanel } from './border-panel';
11
11
  import BlockPreviewPanel from './block-preview-panel';
12
+ import { getVariationClassName } from './utils';
13
+ import ShadowPanel, { useHasShadowControl } from './shadow-panel';
12
14
 
13
- function ScreenBorder( { name } ) {
15
+ function ScreenBorder( { name, variation = '' } ) {
14
16
  const hasBorderPanel = useHasBorderPanel( name );
15
-
17
+ const variationClassName = getVariationClassName( variation );
18
+ const hasShadowPanel = useHasShadowControl( name );
16
19
  return (
17
20
  <>
18
- <ScreenHeader title={ __( 'Border' ) } />
19
- <BlockPreviewPanel name={ name } />
20
- { hasBorderPanel && <BorderPanel name={ name } /> }
21
+ <ScreenHeader title={ __( 'Border & Shadow' ) } />
22
+ <BlockPreviewPanel name={ name } variation={ variationClassName } />
23
+ { hasBorderPanel && (
24
+ <BorderPanel name={ name } variation={ variation } />
25
+ ) }
26
+ { hasShadowPanel && (
27
+ <ShadowPanel name={ name } variation={ variation } />
28
+ ) }
21
29
  </>
22
30
  );
23
31
  }
@@ -2,48 +2,50 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
5
+ import {
6
+ __experimentalColorGradientControl as ColorGradientControl,
7
+ experiments as blockEditorExperiments,
8
+ } from '@wordpress/block-editor';
6
9
 
7
10
  /**
8
11
  * Internal dependencies
9
12
  */
10
13
  import ScreenHeader from './header';
11
- import {
12
- getSupportedGlobalStylesPanels,
13
- useSetting,
14
- useStyle,
15
- useColorsPerOrigin,
16
- } from './hooks';
14
+ import { getSupportedGlobalStylesPanels, useColorsPerOrigin } from './hooks';
15
+ import { unlock } from '../../experiments';
17
16
 
18
- function ScreenButtonColor( { name } ) {
19
- const supports = getSupportedGlobalStylesPanels( name );
20
- const [ solids ] = useSetting( 'color.palette', name );
21
- const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
17
+ const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
22
18
 
19
+ function ScreenButtonColor( { name, variation = '' } ) {
20
+ const prefix = variation ? `variations.${ variation }.` : '';
21
+ const supports = getSupportedGlobalStylesPanels( name );
23
22
  const colorsPerOrigin = useColorsPerOrigin( name );
24
-
25
- const [ isBackgroundEnabled ] = useSetting( 'color.background', name );
23
+ const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
24
+ const [ isBackgroundEnabled ] = useGlobalSetting(
25
+ 'color.background',
26
+ name
27
+ );
26
28
 
27
29
  const hasButtonColor =
28
30
  supports.includes( 'buttonColor' ) &&
29
31
  isBackgroundEnabled &&
30
- ( solids.length > 0 || areCustomSolidsEnabled );
32
+ ( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
31
33
 
32
- const [ buttonTextColor, setButtonTextColor ] = useStyle(
33
- 'elements.button.color.text',
34
+ const [ buttonTextColor, setButtonTextColor ] = useGlobalStyle(
35
+ prefix + 'elements.button.color.text',
34
36
  name
35
37
  );
36
- const [ userButtonTextColor ] = useStyle(
38
+ const [ userButtonTextColor ] = useGlobalStyle(
37
39
  'elements.button.color.text',
38
40
  name,
39
41
  'user'
40
42
  );
41
43
 
42
- const [ buttonBgColor, setButtonBgColor ] = useStyle(
44
+ const [ buttonBgColor, setButtonBgColor ] = useGlobalStyle(
43
45
  'elements.button.color.background',
44
46
  name
45
47
  );
46
- const [ userButtonBgColor ] = useStyle(
48
+ const [ userButtonBgColor ] = useGlobalStyle(
47
49
  'elements.button.color.background',
48
50
  name,
49
51
  'user'
@@ -10,6 +10,7 @@ import {
10
10
  FlexItem,
11
11
  ColorIndicator,
12
12
  } from '@wordpress/components';
13
+ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
13
14
 
14
15
  /**
15
16
  * Internal dependencies
@@ -17,18 +18,27 @@ import {
17
18
  import ScreenHeader from './header';
18
19
  import Palette from './palette';
19
20
  import { NavigationButtonAsItem } from './navigation-button';
20
- import { getSupportedGlobalStylesPanels, useStyle } from './hooks';
21
+ import { getSupportedGlobalStylesPanels } from './hooks';
21
22
  import Subtitle from './subtitle';
22
23
  import ColorIndicatorWrapper from './color-indicator-wrapper';
23
24
  import BlockPreviewPanel from './block-preview-panel';
25
+ import { getVariationClassName } from './utils';
26
+ import { unlock } from '../../experiments';
24
27
 
25
- function BackgroundColorItem( { name, parentMenu } ) {
28
+ const { useGlobalStyle } = unlock( blockEditorExperiments );
29
+
30
+ function BackgroundColorItem( { name, parentMenu, variation = '' } ) {
31
+ const prefix = variation ? `variations.${ variation }.` : '';
32
+ const urlPrefix = variation ? `/variations/${ variation }` : '';
26
33
  const supports = getSupportedGlobalStylesPanels( name );
27
34
  const hasSupport =
28
35
  supports.includes( 'backgroundColor' ) ||
29
36
  supports.includes( 'background' );
30
- const [ backgroundColor ] = useStyle( 'color.background', name );
31
- const [ gradientValue ] = useStyle( 'color.gradient', name );
37
+ const [ backgroundColor ] = useGlobalStyle(
38
+ prefix + 'color.background',
39
+ name
40
+ );
41
+ const [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient', name );
32
42
 
33
43
  if ( ! hasSupport ) {
34
44
  return null;
@@ -36,7 +46,7 @@ function BackgroundColorItem( { name, parentMenu } ) {
36
46
 
37
47
  return (
38
48
  <NavigationButtonAsItem
39
- path={ parentMenu + '/colors/background' }
49
+ path={ parentMenu + urlPrefix + '/colors/background' }
40
50
  aria-label={ __( 'Colors background styles' ) }
41
51
  >
42
52
  <HStack justify="flex-start">
@@ -54,10 +64,12 @@ function BackgroundColorItem( { name, parentMenu } ) {
54
64
  );
55
65
  }
56
66
 
57
- function TextColorItem( { name, parentMenu } ) {
67
+ function TextColorItem( { name, parentMenu, variation = '' } ) {
68
+ const prefix = variation ? `variations.${ variation }.` : '';
69
+ const urlPrefix = variation ? `/variations/${ variation }` : '';
58
70
  const supports = getSupportedGlobalStylesPanels( name );
59
71
  const hasSupport = supports.includes( 'color' );
60
- const [ color ] = useStyle( 'color.text', name );
72
+ const [ color ] = useGlobalStyle( prefix + 'color.text', name );
61
73
 
62
74
  if ( ! hasSupport ) {
63
75
  return null;
@@ -65,7 +77,7 @@ function TextColorItem( { name, parentMenu } ) {
65
77
 
66
78
  return (
67
79
  <NavigationButtonAsItem
68
- path={ parentMenu + '/colors/text' }
80
+ path={ parentMenu + urlPrefix + '/colors/text' }
69
81
  aria-label={ __( 'Colors text styles' ) }
70
82
  >
71
83
  <HStack justify="flex-start">
@@ -83,11 +95,19 @@ function TextColorItem( { name, parentMenu } ) {
83
95
  );
84
96
  }
85
97
 
86
- function LinkColorItem( { name, parentMenu } ) {
98
+ function LinkColorItem( { name, parentMenu, variation = '' } ) {
99
+ const prefix = variation ? `variations.${ variation }.` : '';
100
+ const urlPrefix = variation ? `/variations/${ variation }` : '';
87
101
  const supports = getSupportedGlobalStylesPanels( name );
88
102
  const hasSupport = supports.includes( 'linkColor' );
89
- const [ color ] = useStyle( 'elements.link.color.text', name );
90
- const [ colorHover ] = useStyle( 'elements.link.:hover.color.text', name );
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
+ );
91
111
 
92
112
  if ( ! hasSupport ) {
93
113
  return null;
@@ -95,7 +115,7 @@ function LinkColorItem( { name, parentMenu } ) {
95
115
 
96
116
  return (
97
117
  <NavigationButtonAsItem
98
- path={ parentMenu + '/colors/link' }
118
+ path={ parentMenu + urlPrefix + '/colors/link' }
99
119
  aria-label={ __( 'Colors link styles' ) }
100
120
  >
101
121
  <HStack justify="flex-start">
@@ -115,11 +135,19 @@ function LinkColorItem( { name, parentMenu } ) {
115
135
  );
116
136
  }
117
137
 
118
- function HeadingColorItem( { name, parentMenu } ) {
138
+ function HeadingColorItem( { name, parentMenu, variation = '' } ) {
139
+ const prefix = variation ? `variations.${ variation }.` : '';
140
+ const urlPrefix = variation ? `/variations/${ variation }` : '';
119
141
  const supports = getSupportedGlobalStylesPanels( name );
120
142
  const hasSupport = supports.includes( 'color' );
121
- const [ color ] = useStyle( 'elements.heading.color.text', name );
122
- const [ bgColor ] = useStyle( 'elements.heading.color.background', name );
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
+ );
123
151
 
124
152
  if ( ! hasSupport ) {
125
153
  return null;
@@ -127,7 +155,7 @@ function HeadingColorItem( { name, parentMenu } ) {
127
155
 
128
156
  return (
129
157
  <NavigationButtonAsItem
130
- path={ parentMenu + '/colors/heading' }
158
+ path={ parentMenu + urlPrefix + '/colors/heading' }
131
159
  aria-label={ __( 'Colors heading styles' ) }
132
160
  >
133
161
  <HStack justify="flex-start">
@@ -145,18 +173,28 @@ function HeadingColorItem( { name, parentMenu } ) {
145
173
  );
146
174
  }
147
175
 
148
- function ButtonColorItem( { name, parentMenu } ) {
176
+ function ButtonColorItem( { name, parentMenu, variation = '' } ) {
177
+ const prefix = variation ? `variations.${ variation }.` : '';
178
+ const urlPrefix = variation ? `/variations/${ variation }` : '';
149
179
  const supports = getSupportedGlobalStylesPanels( name );
150
180
  const hasSupport = supports.includes( 'buttonColor' );
151
- const [ color ] = useStyle( 'elements.button.color.text', name );
152
- const [ bgColor ] = useStyle( 'elements.button.color.background', name );
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
+ );
153
189
 
154
190
  if ( ! hasSupport ) {
155
191
  return null;
156
192
  }
157
193
 
158
194
  return (
159
- <NavigationButtonAsItem path={ parentMenu + '/colors/button' }>
195
+ <NavigationButtonAsItem
196
+ path={ parentMenu + urlPrefix + '/colors/button' }
197
+ >
160
198
  <HStack justify="flex-start">
161
199
  <ZStack isLayered={ false } offset={ -8 }>
162
200
  <ColorIndicatorWrapper expanded={ false }>
@@ -174,9 +212,10 @@ function ButtonColorItem( { name, parentMenu } ) {
174
212
  );
175
213
  }
176
214
 
177
- function ScreenColors( { name } ) {
215
+ function ScreenColors( { name, variation = '' } ) {
178
216
  const parentMenu =
179
217
  name === undefined ? '' : '/blocks/' + encodeURIComponent( name );
218
+ const variationClassName = getVariationClassName( variation );
180
219
 
181
220
  return (
182
221
  <>
@@ -187,7 +226,7 @@ function ScreenColors( { name } ) {
187
226
  ) }
188
227
  />
189
228
 
190
- <BlockPreviewPanel name={ name } />
229
+ <BlockPreviewPanel name={ name } variation={ variationClassName } />
191
230
 
192
231
  <div className="edit-site-global-styles-screen-colors">
193
232
  <VStack spacing={ 10 }>
@@ -199,22 +238,27 @@ function ScreenColors( { name } ) {
199
238
  <BackgroundColorItem
200
239
  name={ name }
201
240
  parentMenu={ parentMenu }
241
+ variation={ variation }
202
242
  />
203
243
  <TextColorItem
204
244
  name={ name }
205
245
  parentMenu={ parentMenu }
246
+ variation={ variation }
206
247
  />
207
248
  <LinkColorItem
208
249
  name={ name }
209
250
  parentMenu={ parentMenu }
251
+ variation={ variation }
210
252
  />
211
253
  <HeadingColorItem
212
254
  name={ name }
213
255
  parentMenu={ parentMenu }
256
+ variation={ variation }
214
257
  />
215
258
  <ButtonColorItem
216
259
  name={ name }
217
260
  parentMenu={ parentMenu }
261
+ variation={ variation }
218
262
  />
219
263
  </ItemGroup>
220
264
  </VStack>
@@ -1,30 +1,46 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __ } from '@wordpress/i18n';
5
- import { __experimentalVStack as VStack } from '@wordpress/components';
4
+ import { sprintf, __ } from '@wordpress/i18n';
5
+ import { ExternalLink } from '@wordpress/components';
6
+ import { getBlockType } from '@wordpress/blocks';
6
7
 
7
8
  /**
8
9
  * Internal dependencies
9
10
  */
10
11
  import ScreenHeader from './header';
11
- import Subtitle from './subtitle';
12
12
  import CustomCSSControl from './custom-css';
13
13
 
14
- function ScreenCSS() {
14
+ function ScreenCSS( { name } ) {
15
+ // If name is defined, we are customizing CSS at the block level.
16
+ // Display the block title in the description.
17
+ const blockType = getBlockType( name );
18
+ const title = blockType?.title;
19
+
20
+ const description =
21
+ title !== undefined
22
+ ? sprintf(
23
+ // translators: %s: is the name of a block e.g., 'Image' or 'Table'.
24
+ __(
25
+ 'Add your own CSS to customize the appearance of the %s block.'
26
+ ),
27
+ title
28
+ )
29
+ : __(
30
+ 'Add your own CSS to customize the appearance and layout of your site.'
31
+ );
32
+
15
33
  return (
16
34
  <>
17
- <ScreenHeader
18
- title={ __( 'CSS' ) }
19
- description={ __(
20
- 'Add your own CSS to customize the appearance and layout of your site.'
21
- ) }
22
- />
35
+ <ScreenHeader title={ __( 'CSS' ) } description={ description } />
36
+ <ExternalLink
37
+ href="https://wordpress.org/support/article/css/"
38
+ className="edit-site-global-styles-screen-css-help-link"
39
+ >
40
+ { __( 'Learn more about CSS' ) }
41
+ </ExternalLink>
23
42
  <div className="edit-site-global-styles-screen-css">
24
- <VStack spacing={ 3 }>
25
- <Subtitle>{ __( 'ADDITIONAL CSS' ) }</Subtitle>
26
- <CustomCSSControl />
27
- </VStack>
43
+ <CustomCSSControl blockName={ name } />
28
44
  </div>
29
45
  </>
30
46
  );
@@ -6,7 +6,10 @@ import {
6
6
  __experimentalToggleGroupControl as ToggleGroupControl,
7
7
  __experimentalToggleGroupControlOption as ToggleGroupControlOption,
8
8
  } from '@wordpress/components';
9
- import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
9
+ import {
10
+ __experimentalColorGradientControl as ColorGradientControl,
11
+ experiments as blockEditorExperiments,
12
+ } from '@wordpress/block-editor';
10
13
  import { useState } from '@wordpress/element';
11
14
 
12
15
  /**
@@ -15,67 +18,68 @@ import { useState } from '@wordpress/element';
15
18
  import ScreenHeader from './header';
16
19
  import {
17
20
  getSupportedGlobalStylesPanels,
18
- useSetting,
19
- useStyle,
20
21
  useColorsPerOrigin,
21
22
  useGradientsPerOrigin,
22
23
  } from './hooks';
24
+ import { unlock } from '../../experiments';
23
25
 
24
- function ScreenHeadingColor( { name } ) {
25
- const [ selectedLevel, setCurrentTab ] = useState( 'heading' );
26
+ const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
26
27
 
28
+ function ScreenHeadingColor( { name, variation = '' } ) {
29
+ const prefix = variation ? `variations.${ variation }.` : '';
30
+ const [ selectedLevel, setCurrentTab ] = useState( 'heading' );
27
31
  const supports = getSupportedGlobalStylesPanels( name );
28
- const [ solids ] = useSetting( 'color.palette', name );
29
- const [ gradients ] = useSetting( 'color.gradients', name );
30
- const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
31
- const [ areCustomGradientsEnabled ] = useSetting(
32
+ const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
33
+ const [ areCustomGradientsEnabled ] = useGlobalSetting(
32
34
  'color.customGradient',
33
35
  name
34
36
  );
35
- const [ isTextEnabled ] = useSetting( 'color.text', name );
36
- const [ isBackgroundEnabled ] = useSetting( 'color.background', name );
37
-
37
+ const [ isTextEnabled ] = useGlobalSetting( 'color.text', name );
38
+ const [ isBackgroundEnabled ] = useGlobalSetting(
39
+ 'color.background',
40
+ name
41
+ );
38
42
  const colorsPerOrigin = useColorsPerOrigin( name );
39
43
  const gradientsPerOrigin = useGradientsPerOrigin( name );
40
44
 
41
45
  const hasTextColor =
42
46
  supports.includes( 'color' ) &&
43
47
  isTextEnabled &&
44
- ( solids.length > 0 || areCustomSolidsEnabled );
48
+ ( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
45
49
 
46
50
  const hasBackgroundColor =
47
51
  supports.includes( 'backgroundColor' ) &&
48
52
  isBackgroundEnabled &&
49
- ( solids.length > 0 || areCustomSolidsEnabled );
53
+ ( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
50
54
  const hasGradientColor =
51
55
  supports.includes( 'background' ) &&
52
- ( gradients.length > 0 || areCustomGradientsEnabled );
56
+ ( gradientsPerOrigin.length > 0 || areCustomGradientsEnabled );
53
57
 
54
- const [ color, setColor ] = useStyle(
55
- 'elements.' + selectedLevel + '.color.text',
58
+ const [ color, setColor ] = useGlobalStyle(
59
+ prefix + 'elements.' + selectedLevel + '.color.text',
56
60
  name
57
61
  );
58
- const [ userColor ] = useStyle(
59
- 'elements.' + selectedLevel + '.color.text',
62
+ const [ userColor ] = useGlobalStyle(
63
+ prefix + 'elements.' + selectedLevel + '.color.text',
60
64
  name,
61
65
  'user'
62
66
  );
63
67
 
64
- const [ backgroundColor, setBackgroundColor ] = useStyle(
65
- 'elements.' + selectedLevel + '.color.background',
68
+ const [ backgroundColor, setBackgroundColor ] = useGlobalStyle(
69
+ prefix + 'elements.' + selectedLevel + '.color.background',
66
70
  name
67
71
  );
68
- const [ userBackgroundColor ] = useStyle(
69
- 'elements.' + selectedLevel + '.color.background',
72
+ const [ userBackgroundColor ] = useGlobalStyle(
73
+ prefix + 'elements.' + selectedLevel + '.color.background',
70
74
  name,
71
75
  'user'
72
76
  );
73
- const [ gradient, setGradient ] = useStyle(
74
- 'elements.' + selectedLevel + '.color.gradient',
77
+ const [ gradient, setGradient ] = useGlobalStyle(
78
+ prefix + 'elements.' + selectedLevel + '.color.gradient',
75
79
  name
76
80
  );
77
- const [ userGradient ] = useStyle(
78
- 'elements.' + selectedLevel + '.color.gradient',
81
+ const [ userGradient ] = useGlobalStyle(
82
+ prefix + 'elements.' + selectedLevel + '.color.gradient',
79
83
  name,
80
84
  'user'
81
85
  );
@@ -124,6 +128,7 @@ function ScreenHeadingColor( { name } ) {
124
128
  <h4>{ __( 'Select heading level' ) }</h4>
125
129
 
126
130
  <ToggleGroupControl
131
+ __nextHasNoMarginBottom
127
132
  label={ __( 'Select heading level' ) }
128
133
  hideLabelFromVision={ true }
129
134
  value={ selectedLevel }
@@ -9,15 +9,18 @@ import { __ } from '@wordpress/i18n';
9
9
  import DimensionsPanel, { useHasDimensionsPanel } from './dimensions-panel';
10
10
  import ScreenHeader from './header';
11
11
  import BlockPreviewPanel from './block-preview-panel';
12
+ import { getVariationClassName } from './utils';
12
13
 
13
- function ScreenLayout( { name } ) {
14
+ function ScreenLayout( { name, variation = '' } ) {
14
15
  const hasDimensionsPanel = useHasDimensionsPanel( name );
15
-
16
+ const variationClassName = getVariationClassName( variation );
16
17
  return (
17
18
  <>
18
19
  <ScreenHeader title={ __( 'Layout' ) } />
19
- <BlockPreviewPanel name={ name } />
20
- { hasDimensionsPanel && <DimensionsPanel name={ name } /> }
20
+ <BlockPreviewPanel name={ name } variation={ variationClassName } />
21
+ { hasDimensionsPanel && (
22
+ <DimensionsPanel name={ name } variation={ variation } />
23
+ ) }
21
24
  </>
22
25
  );
23
26
  }