@wordpress/edit-site 5.2.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (374) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/components/add-new-template/add-custom-generic-template-modal.js +8 -10
  3. package/build/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  4. package/build/components/add-new-template/add-custom-template-modal.js +0 -1
  5. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  6. package/build/components/add-new-template/new-template-part.js +5 -29
  7. package/build/components/add-new-template/new-template-part.js.map +1 -1
  8. package/build/components/add-new-template/utils.js +1 -9
  9. package/build/components/add-new-template/utils.js.map +1 -1
  10. package/build/components/app/index.js +2 -7
  11. package/build/components/app/index.js.map +1 -1
  12. package/build/components/block-editor/index.js +13 -11
  13. package/build/components/block-editor/index.js.map +1 -1
  14. package/build/components/block-editor/inserter-media-categories.js +237 -0
  15. package/build/components/block-editor/inserter-media-categories.js.map +1 -0
  16. package/build/components/canvas-spinner/index.js +20 -0
  17. package/build/components/canvas-spinner/index.js.map +1 -0
  18. package/build/components/create-template-part-modal/index.js +4 -2
  19. package/build/components/create-template-part-modal/index.js.map +1 -1
  20. package/build/components/editor/index.js +4 -2
  21. package/build/components/editor/index.js.map +1 -1
  22. package/build/components/error-boundary/index.js +2 -12
  23. package/build/components/error-boundary/index.js.map +1 -1
  24. package/build/components/error-boundary/warning.js +5 -28
  25. package/build/components/error-boundary/warning.js.map +1 -1
  26. package/build/components/global-styles/block-preview-panel.js +2 -2
  27. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  28. package/build/components/global-styles/border-panel.js +17 -9
  29. package/build/components/global-styles/border-panel.js.map +1 -1
  30. package/build/components/global-styles/color-palette-panel.js +13 -7
  31. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  32. package/build/components/global-styles/context-menu.js +39 -4
  33. package/build/components/global-styles/context-menu.js.map +1 -1
  34. package/build/components/global-styles/custom-css.js +65 -14
  35. package/build/components/global-styles/custom-css.js.map +1 -1
  36. package/build/components/global-styles/dimensions-panel.js +49 -31
  37. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  38. package/build/components/global-styles/global-styles-provider.js +13 -3
  39. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  40. package/build/components/global-styles/gradients-palette-panel.js +17 -11
  41. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  42. package/build/components/global-styles/hooks.js +21 -142
  43. package/build/components/global-styles/hooks.js.map +1 -1
  44. package/build/components/global-styles/index.js +0 -28
  45. package/build/components/global-styles/index.js.map +1 -1
  46. package/build/components/global-styles/palette.js +11 -4
  47. package/build/components/global-styles/palette.js.map +1 -1
  48. package/build/components/global-styles/preview.js +18 -15
  49. package/build/components/global-styles/preview.js.map +1 -1
  50. package/build/components/global-styles/screen-background-color.js +27 -13
  51. package/build/components/global-styles/screen-background-color.js.map +1 -1
  52. package/build/components/global-styles/screen-border.js +10 -4
  53. package/build/components/global-styles/screen-border.js.map +1 -1
  54. package/build/components/global-styles/screen-button-color.js +16 -9
  55. package/build/components/global-styles/screen-button-color.js.map +1 -1
  56. package/build/components/global-styles/screen-colors.js +43 -34
  57. package/build/components/global-styles/screen-colors.js.map +1 -1
  58. package/build/components/global-styles/screen-css.js +20 -8
  59. package/build/components/global-styles/screen-css.js.map +1 -1
  60. package/build/components/global-styles/screen-heading-color.js +23 -16
  61. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  62. package/build/components/global-styles/screen-layout.js +3 -3
  63. package/build/components/global-styles/screen-layout.js.map +1 -1
  64. package/build/components/global-styles/screen-link-color.js +18 -11
  65. package/build/components/global-styles/screen-link-color.js.map +1 -1
  66. package/build/components/global-styles/screen-root.js +25 -9
  67. package/build/components/global-styles/screen-root.js.map +1 -1
  68. package/build/components/global-styles/screen-style-variations.js +8 -4
  69. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  70. package/build/components/global-styles/screen-text-color.js +14 -7
  71. package/build/components/global-styles/screen-text-color.js.map +1 -1
  72. package/build/components/global-styles/screen-typography.js +18 -12
  73. package/build/components/global-styles/screen-typography.js.map +1 -1
  74. package/build/components/global-styles/shadow-panel.js +196 -0
  75. package/build/components/global-styles/shadow-panel.js.map +1 -0
  76. package/build/components/global-styles/typography-panel.js +43 -29
  77. package/build/components/global-styles/typography-panel.js.map +1 -1
  78. package/build/components/global-styles/typography-preview.js +19 -9
  79. package/build/components/global-styles/typography-preview.js.map +1 -1
  80. package/build/components/global-styles/ui.js +85 -34
  81. package/build/components/global-styles/ui.js.map +1 -1
  82. package/build/components/global-styles/utils.js +5 -334
  83. package/build/components/global-styles/utils.js.map +1 -1
  84. package/build/components/global-styles-renderer/index.js +7 -5
  85. package/build/components/global-styles-renderer/index.js.map +1 -1
  86. package/build/components/header-edit-mode/document-actions/index.js +2 -2
  87. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  88. package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
  89. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  90. package/build/components/layout/index.js +6 -8
  91. package/build/components/layout/index.js.map +1 -1
  92. package/build/components/list/actions/rename-menu-item.js +8 -11
  93. package/build/components/list/actions/rename-menu-item.js.map +1 -1
  94. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +1 -2
  95. package/build/components/navigation-inspector/index.js.map +1 -0
  96. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -15
  97. package/build/components/navigation-inspector/navigation-menu.js.map +1 -0
  98. package/build/components/sidebar/index.js +3 -1
  99. package/build/components/sidebar/index.js.map +1 -1
  100. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +3 -18
  101. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  102. package/build/components/sidebar-edit-mode/index.js +1 -14
  103. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  104. package/build/components/sidebar-navigation-screen/index.js +3 -2
  105. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  106. package/build/components/sidebar-navigation-screen-main/index.js +23 -1
  107. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  108. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +35 -0
  109. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  110. package/build/components/sidebar-navigation-screen-templates/index.js +3 -8
  111. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  112. package/build/components/site-hub/index.js +2 -2
  113. package/build/components/site-hub/index.js.map +1 -1
  114. package/build/components/site-icon/index.js +1 -1
  115. package/build/components/site-icon/index.js.map +1 -1
  116. package/build/components/style-book/index.js +7 -4
  117. package/build/components/style-book/index.js.map +1 -1
  118. package/build/components/template-part-converter/convert-to-template-part.js +5 -9
  119. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  120. package/build/experiments.js +19 -0
  121. package/build/experiments.js.map +1 -0
  122. package/build/hooks/push-changes-to-global-styles/index.js +65 -6
  123. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  124. package/build/index.js +53 -60
  125. package/build/index.js.map +1 -1
  126. package/build/store/selectors.js +7 -27
  127. package/build/store/selectors.js.map +1 -1
  128. package/build/store/utils.js +77 -0
  129. package/build/store/utils.js.map +1 -0
  130. package/build/utils/template-part-create.js +71 -0
  131. package/build/utils/template-part-create.js.map +1 -0
  132. package/build-module/components/add-new-template/add-custom-generic-template-modal.js +9 -11
  133. package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  134. package/build-module/components/add-new-template/add-custom-template-modal.js +0 -1
  135. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  136. package/build-module/components/add-new-template/new-template-part.js +4 -27
  137. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  138. package/build-module/components/add-new-template/utils.js +0 -5
  139. package/build-module/components/add-new-template/utils.js.map +1 -1
  140. package/build-module/components/app/index.js +2 -7
  141. package/build-module/components/app/index.js.map +1 -1
  142. package/build-module/components/block-editor/index.js +14 -12
  143. package/build-module/components/block-editor/index.js.map +1 -1
  144. package/build-module/components/block-editor/inserter-media-categories.js +225 -0
  145. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -0
  146. package/build-module/components/canvas-spinner/index.js +12 -0
  147. package/build-module/components/canvas-spinner/index.js.map +1 -0
  148. package/build-module/components/create-template-part-modal/index.js +5 -3
  149. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  150. package/build-module/components/editor/index.js +3 -2
  151. package/build-module/components/editor/index.js.map +1 -1
  152. package/build-module/components/error-boundary/index.js +2 -12
  153. package/build-module/components/error-boundary/index.js.map +1 -1
  154. package/build-module/components/error-boundary/warning.js +5 -28
  155. package/build-module/components/error-boundary/warning.js.map +1 -1
  156. package/build-module/components/global-styles/block-preview-panel.js +2 -2
  157. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  158. package/build-module/components/global-styles/border-panel.js +17 -11
  159. package/build-module/components/global-styles/border-panel.js.map +1 -1
  160. package/build-module/components/global-styles/color-palette-panel.js +11 -7
  161. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  162. package/build-module/components/global-styles/context-menu.js +40 -8
  163. package/build-module/components/global-styles/context-menu.js.map +1 -1
  164. package/build-module/components/global-styles/custom-css.js +61 -15
  165. package/build-module/components/global-styles/custom-css.js.map +1 -1
  166. package/build-module/components/global-styles/dimensions-panel.js +49 -32
  167. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  168. package/build-module/components/global-styles/global-styles-provider.js +7 -2
  169. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  170. package/build-module/components/global-styles/gradients-palette-panel.js +15 -11
  171. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  172. package/build-module/components/global-styles/hooks.js +23 -134
  173. package/build-module/components/global-styles/hooks.js.map +1 -1
  174. package/build-module/components/global-styles/index.js +0 -2
  175. package/build-module/components/global-styles/index.js.map +1 -1
  176. package/build-module/components/global-styles/palette.js +10 -5
  177. package/build-module/components/global-styles/palette.js.map +1 -1
  178. package/build-module/components/global-styles/preview.js +18 -14
  179. package/build-module/components/global-styles/preview.js.map +1 -1
  180. package/build-module/components/global-styles/screen-background-color.js +26 -15
  181. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  182. package/build-module/components/global-styles/screen-border.js +10 -5
  183. package/build-module/components/global-styles/screen-border.js.map +1 -1
  184. package/build-module/components/global-styles/screen-button-color.js +16 -11
  185. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  186. package/build-module/components/global-styles/screen-colors.js +43 -37
  187. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  188. package/build-module/components/global-styles/screen-css.js +21 -9
  189. package/build-module/components/global-styles/screen-css.js.map +1 -1
  190. package/build-module/components/global-styles/screen-heading-color.js +23 -18
  191. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  192. package/build-module/components/global-styles/screen-layout.js +4 -4
  193. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  194. package/build-module/components/global-styles/screen-link-color.js +18 -13
  195. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  196. package/build-module/components/global-styles/screen-root.js +23 -9
  197. package/build-module/components/global-styles/screen-root.js.map +1 -1
  198. package/build-module/components/global-styles/screen-style-variations.js +5 -2
  199. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  200. package/build-module/components/global-styles/screen-text-color.js +14 -9
  201. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  202. package/build-module/components/global-styles/screen-typography.js +16 -12
  203. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  204. package/build-module/components/global-styles/shadow-panel.js +177 -0
  205. package/build-module/components/global-styles/shadow-panel.js.map +1 -0
  206. package/build-module/components/global-styles/typography-panel.js +43 -31
  207. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  208. package/build-module/components/global-styles/typography-preview.js +17 -9
  209. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  210. package/build-module/components/global-styles/ui.js +80 -35
  211. package/build-module/components/global-styles/ui.js.map +1 -1
  212. package/build-module/components/global-styles/utils.js +4 -319
  213. package/build-module/components/global-styles/utils.js.map +1 -1
  214. package/build-module/components/global-styles-renderer/index.js +5 -5
  215. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  216. package/build-module/components/header-edit-mode/document-actions/index.js +2 -2
  217. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  218. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
  219. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  220. package/build-module/components/layout/index.js +6 -8
  221. package/build-module/components/layout/index.js.map +1 -1
  222. package/build-module/components/list/actions/rename-menu-item.js +9 -12
  223. package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
  224. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +1 -2
  225. package/build-module/components/navigation-inspector/index.js.map +1 -0
  226. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -16
  227. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -0
  228. package/build-module/components/sidebar/index.js +2 -1
  229. package/build-module/components/sidebar/index.js.map +1 -1
  230. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +6 -21
  231. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  232. package/build-module/components/sidebar-edit-mode/index.js +1 -13
  233. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  234. package/build-module/components/sidebar-navigation-screen/index.js +3 -2
  235. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  236. package/build-module/components/sidebar-navigation-screen-main/index.js +22 -2
  237. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  238. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +23 -0
  239. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  240. package/build-module/components/sidebar-navigation-screen-templates/index.js +4 -9
  241. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  242. package/build-module/components/site-hub/index.js +2 -2
  243. package/build-module/components/site-hub/index.js.map +1 -1
  244. package/build-module/components/site-icon/index.js +1 -1
  245. package/build-module/components/site-icon/index.js.map +1 -1
  246. package/build-module/components/style-book/index.js +8 -5
  247. package/build-module/components/style-book/index.js.map +1 -1
  248. package/build-module/components/template-part-converter/convert-to-template-part.js +5 -9
  249. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  250. package/build-module/experiments.js +9 -0
  251. package/build-module/experiments.js.map +1 -0
  252. package/build-module/hooks/push-changes-to-global-styles/index.js +62 -3
  253. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  254. package/build-module/index.js +52 -60
  255. package/build-module/index.js.map +1 -1
  256. package/build-module/store/selectors.js +6 -26
  257. package/build-module/store/selectors.js.map +1 -1
  258. package/build-module/store/utils.js +66 -0
  259. package/build-module/store/utils.js.map +1 -0
  260. package/build-module/utils/template-part-create.js +53 -0
  261. package/build-module/utils/template-part-create.js.map +1 -0
  262. package/build-style/style-rtl.css +314 -216
  263. package/build-style/style.css +314 -216
  264. package/package.json +32 -30
  265. package/src/components/add-new-template/add-custom-generic-template-modal.js +20 -28
  266. package/src/components/add-new-template/add-custom-template-modal.js +0 -1
  267. package/src/components/add-new-template/new-template-part.js +11 -32
  268. package/src/components/add-new-template/style.scss +0 -4
  269. package/src/components/add-new-template/utils.js +0 -14
  270. package/src/components/app/index.js +2 -2
  271. package/src/components/block-editor/index.js +12 -25
  272. package/src/components/block-editor/inserter-media-categories.js +247 -0
  273. package/src/components/block-editor/style.scss +19 -7
  274. package/src/components/canvas-spinner/index.js +12 -0
  275. package/src/components/canvas-spinner/style.scss +7 -0
  276. package/src/components/create-template-part-modal/index.js +75 -67
  277. package/src/components/create-template-part-modal/style.scss +0 -10
  278. package/src/components/editor/index.js +4 -2
  279. package/src/components/error-boundary/index.js +2 -10
  280. package/src/components/error-boundary/warning.js +6 -35
  281. package/src/components/global-styles/README.md +1 -75
  282. package/src/components/global-styles/block-preview-panel.js +2 -2
  283. package/src/components/global-styles/border-panel.js +19 -17
  284. package/src/components/global-styles/color-palette-panel.js +10 -7
  285. package/src/components/global-styles/context-menu.js +114 -44
  286. package/src/components/global-styles/custom-css.js +76 -19
  287. package/src/components/global-styles/dimensions-panel.js +46 -36
  288. package/src/components/global-styles/global-styles-provider.js +6 -2
  289. package/src/components/global-styles/gradients-palette-panel.js +17 -11
  290. package/src/components/global-styles/hooks.js +31 -155
  291. package/src/components/global-styles/index.js +0 -2
  292. package/src/components/global-styles/palette.js +9 -5
  293. package/src/components/global-styles/preview.js +19 -13
  294. package/src/components/global-styles/screen-background-color.js +37 -21
  295. package/src/components/global-styles/screen-border.js +10 -5
  296. package/src/components/global-styles/screen-button-color.js +21 -19
  297. package/src/components/global-styles/screen-colors.js +48 -65
  298. package/src/components/global-styles/screen-css.js +30 -14
  299. package/src/components/global-styles/screen-heading-color.js +32 -27
  300. package/src/components/global-styles/screen-layout.js +4 -7
  301. package/src/components/global-styles/screen-link-color.js +26 -26
  302. package/src/components/global-styles/screen-root.js +24 -9
  303. package/src/components/global-styles/screen-style-variations.js +7 -2
  304. package/src/components/global-styles/screen-text-color.js +15 -19
  305. package/src/components/global-styles/screen-typography.js +27 -12
  306. package/src/components/global-styles/shadow-panel.js +174 -0
  307. package/src/components/global-styles/style.scss +85 -1
  308. package/src/components/global-styles/typography-panel.js +60 -48
  309. package/src/components/global-styles/typography-preview.js +28 -9
  310. package/src/components/global-styles/ui.js +78 -53
  311. package/src/components/global-styles/utils.js +4 -371
  312. package/src/components/global-styles-renderer/index.js +3 -4
  313. package/src/components/header-edit-mode/document-actions/index.js +1 -1
  314. package/src/components/keyboard-shortcut-help-modal/index.js +0 -1
  315. package/src/components/layout/index.js +9 -2
  316. package/src/components/layout/style.scss +4 -5
  317. package/src/components/list/actions/rename-menu-item.js +14 -23
  318. package/src/components/list/style.scss +0 -4
  319. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +1 -4
  320. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +10 -12
  321. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/style.scss +0 -17
  322. package/src/components/sidebar/index.js +2 -0
  323. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +8 -32
  324. package/src/components/sidebar-edit-mode/index.js +0 -11
  325. package/src/components/sidebar-edit-mode/settings-header/style.scss +8 -0
  326. package/src/components/sidebar-navigation-item/style.scss +28 -3
  327. package/src/components/sidebar-navigation-screen/index.js +4 -3
  328. package/src/components/sidebar-navigation-screen/style.scss +2 -0
  329. package/src/components/sidebar-navigation-screen-main/index.js +23 -1
  330. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +25 -0
  331. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +12 -0
  332. package/src/components/sidebar-navigation-screen-templates/index.js +12 -19
  333. package/src/components/site-hub/index.js +1 -1
  334. package/src/components/site-hub/style.scss +7 -1
  335. package/src/components/site-icon/index.js +1 -1
  336. package/src/components/site-icon/style.scss +2 -2
  337. package/src/components/style-book/index.js +10 -5
  338. package/src/components/template-part-converter/convert-to-template-part.js +12 -10
  339. package/src/experiments.js +10 -0
  340. package/src/hooks/push-changes-to-global-styles/index.js +63 -5
  341. package/src/index.js +51 -59
  342. package/src/store/selectors.js +6 -26
  343. package/src/store/test/utils.js +181 -0
  344. package/src/store/utils.js +69 -0
  345. package/src/style.scss +4 -2
  346. package/src/utils/template-part-create.js +62 -0
  347. package/src/utils/test/template-part-create.js +63 -0
  348. package/build/components/global-styles/context.js +0 -22
  349. package/build/components/global-styles/context.js.map +0 -1
  350. package/build/components/global-styles/typography-utils.js +0 -92
  351. package/build/components/global-styles/typography-utils.js.map +0 -1
  352. package/build/components/global-styles/use-global-styles-output.js +0 -943
  353. package/build/components/global-styles/use-global-styles-output.js.map +0 -1
  354. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -42
  355. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  356. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  357. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  358. package/build-module/components/global-styles/context.js +0 -12
  359. package/build-module/components/global-styles/context.js.map +0 -1
  360. package/build-module/components/global-styles/typography-utils.js +0 -84
  361. package/build-module/components/global-styles/typography-utils.js.map +0 -1
  362. package/build-module/components/global-styles/use-global-styles-output.js +0 -901
  363. package/build-module/components/global-styles/use-global-styles-output.js.map +0 -1
  364. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -28
  365. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  366. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  367. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  368. package/src/components/global-styles/context.js +0 -15
  369. package/src/components/global-styles/test/typography-utils.js +0 -393
  370. package/src/components/global-styles/test/use-global-styles-output.js +0 -814
  371. package/src/components/global-styles/test/utils.js +0 -206
  372. package/src/components/global-styles/typography-utils.js +0 -87
  373. package/src/components/global-styles/use-global-styles-output.js +0 -1059
  374. package/src/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -37
@@ -2,38 +2,34 @@
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 ScreenTextColor( { name, variationPath = '' } ) {
19
- const supports = getSupportedGlobalStylesPanels( name );
20
- const [ solids ] = useSetting( 'color.palette', name );
21
- const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
22
- const [ isTextEnabled ] = useSetting( 'color.text', name );
17
+ const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
23
18
 
19
+ function ScreenTextColor( { name, variation = '' } ) {
20
+ const prefix = variation ? `variations.${ variation }.` : '';
21
+ const supports = getSupportedGlobalStylesPanels( name );
22
+ const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
23
+ const [ isTextEnabled ] = useGlobalSetting( 'color.text', name );
24
24
  const colorsPerOrigin = useColorsPerOrigin( name );
25
25
 
26
26
  const hasTextColor =
27
27
  supports.includes( 'color' ) &&
28
28
  isTextEnabled &&
29
- ( solids.length > 0 || areCustomSolidsEnabled );
29
+ ( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
30
30
 
31
- const [ color, setColor ] = useStyle( variationPath + 'color.text', name );
32
- const [ userColor ] = useStyle(
33
- variationPath + 'color.text',
34
- name,
35
- 'user'
36
- );
31
+ const [ color, setColor ] = useGlobalStyle( prefix + 'color.text', name );
32
+ const [ userColor ] = useGlobalStyle( prefix + 'color.text', name, 'user' );
37
33
 
38
34
  if ( ! hasTextColor ) {
39
35
  return null;
@@ -8,17 +8,20 @@ import {
8
8
  __experimentalHStack as HStack,
9
9
  FlexItem,
10
10
  } from '@wordpress/components';
11
+ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
11
12
 
12
13
  /**
13
14
  * Internal dependencies
14
15
  */
15
16
  import ScreenHeader from './header';
16
17
  import { NavigationButtonAsItem } from './navigation-button';
17
- import { useStyle } from './hooks';
18
18
  import Subtitle from './subtitle';
19
19
  import TypographyPanel from './typography-panel';
20
20
  import BlockPreviewPanel from './block-preview-panel';
21
- import { getVariationClassNameFromPath } from './utils';
21
+ import { getVariationClassName } from './utils';
22
+ import { unlock } from '../../experiments';
23
+
24
+ const { useGlobalStyle } = unlock( blockEditorExperiments );
22
25
 
23
26
  function Item( { name, parentMenu, element, label } ) {
24
27
  const hasSupport = ! name;
@@ -30,16 +33,28 @@ function Item( { name, parentMenu, element, label } ) {
30
33
  textDecoration: 'underline',
31
34
  }
32
35
  : {};
33
- const [ fontFamily ] = useStyle( prefix + 'typography.fontFamily', name );
34
- const [ fontStyle ] = useStyle( prefix + 'typography.fontStyle', name );
35
- const [ fontWeight ] = useStyle( prefix + 'typography.fontWeight', name );
36
- const [ letterSpacing ] = useStyle(
36
+ const [ fontFamily ] = useGlobalStyle(
37
+ prefix + 'typography.fontFamily',
38
+ name
39
+ );
40
+ const [ fontStyle ] = useGlobalStyle(
41
+ prefix + 'typography.fontStyle',
42
+ name
43
+ );
44
+ const [ fontWeight ] = useGlobalStyle(
45
+ prefix + 'typography.fontWeight',
46
+ name
47
+ );
48
+ const [ letterSpacing ] = useGlobalStyle(
37
49
  prefix + 'typography.letterSpacing',
38
50
  name
39
51
  );
40
- const [ backgroundColor ] = useStyle( prefix + 'color.background', name );
41
- const [ gradientValue ] = useStyle( prefix + 'color.gradient', name );
42
- const [ color ] = useStyle( prefix + 'color.text', name );
52
+ const [ backgroundColor ] = useGlobalStyle(
53
+ prefix + 'color.background',
54
+ name
55
+ );
56
+ const [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient', name );
57
+ const [ color ] = useGlobalStyle( prefix + 'color.text', name );
43
58
 
44
59
  if ( ! hasSupport ) {
45
60
  return null;
@@ -77,9 +92,9 @@ function Item( { name, parentMenu, element, label } ) {
77
92
  );
78
93
  }
79
94
 
80
- function ScreenTypography( { name, variationPath = '' } ) {
95
+ function ScreenTypography( { name, variation = '' } ) {
81
96
  const parentMenu = name === undefined ? '' : '/blocks/' + name;
82
- const variationClassName = getVariationClassNameFromPath( variationPath );
97
+ const variationClassName = getVariationClassName( variation );
83
98
  return (
84
99
  <>
85
100
  <ScreenHeader
@@ -128,7 +143,7 @@ function ScreenTypography( { name, variationPath = '' } ) {
128
143
  { !! name && (
129
144
  <TypographyPanel
130
145
  name={ name }
131
- variationPath={ variationPath }
146
+ variation={ variation }
132
147
  element="text"
133
148
  />
134
149
  ) }
@@ -0,0 +1,174 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import classnames from 'classnames';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import {
10
+ __experimentalToolsPanel as ToolsPanel,
11
+ __experimentalToolsPanelItem as ToolsPanelItem,
12
+ __experimentalItemGroup as ItemGroup,
13
+ __experimentalHStack as HStack,
14
+ __experimentalVStack as VStack,
15
+ __experimentalGrid as Grid,
16
+ __experimentalHeading as Heading,
17
+ FlexItem,
18
+ Dropdown,
19
+ __experimentalDropdownContentWrapper as DropdownContentWrapper,
20
+ Button,
21
+ } from '@wordpress/components';
22
+ import { __ } from '@wordpress/i18n';
23
+ import { shadow as shadowIcon, Icon, check } from '@wordpress/icons';
24
+ import { useCallback } from '@wordpress/element';
25
+ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
26
+
27
+ /**
28
+ * Internal dependencies
29
+ */
30
+ import { getSupportedGlobalStylesPanels } from './hooks';
31
+ import { IconWithCurrentColor } from './icon-with-current-color';
32
+ import { unlock } from '../../experiments';
33
+
34
+ const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
35
+
36
+ export function useHasShadowControl( name ) {
37
+ const supports = getSupportedGlobalStylesPanels( name );
38
+ return supports.includes( 'shadow' );
39
+ }
40
+
41
+ export default function ShadowPanel( { name, variation = '' } ) {
42
+ const prefix = variation ? `variations.${ variation }.` : '';
43
+ const [ shadow, setShadow ] = useGlobalStyle( `${ prefix }shadow`, name );
44
+ const [ userShadow ] = useGlobalStyle( `${ prefix }shadow`, name, 'user' );
45
+ const hasShadow = () => !! userShadow;
46
+
47
+ const resetShadow = () => setShadow( undefined );
48
+ const resetAll = useCallback(
49
+ () => resetShadow( undefined ),
50
+ [ resetShadow ]
51
+ );
52
+
53
+ return (
54
+ <ToolsPanel label={ __( 'Shadow' ) } resetAll={ resetAll }>
55
+ <ToolsPanelItem
56
+ label={ __( 'Shadow' ) }
57
+ hasValue={ hasShadow }
58
+ onDeselect={ resetShadow }
59
+ isShownByDefault
60
+ >
61
+ <ItemGroup isBordered isSeparated>
62
+ <ShadowPopover
63
+ shadow={ shadow }
64
+ onShadowChange={ setShadow }
65
+ />
66
+ </ItemGroup>
67
+ </ToolsPanelItem>
68
+ </ToolsPanel>
69
+ );
70
+ }
71
+
72
+ const ShadowPopover = ( { shadow, onShadowChange } ) => {
73
+ const popoverProps = {
74
+ placement: 'left-start',
75
+ offset: 36,
76
+ shift: true,
77
+ };
78
+
79
+ return (
80
+ <Dropdown
81
+ popoverProps={ popoverProps }
82
+ className="edit-site-global-styles__shadow-dropdown"
83
+ renderToggle={ renderShadowToggle() }
84
+ renderContent={ () => (
85
+ <DropdownContentWrapper paddingSize="medium">
86
+ <ShadowPopoverContainer
87
+ shadow={ shadow }
88
+ onShadowChange={ onShadowChange }
89
+ />
90
+ </DropdownContentWrapper>
91
+ ) }
92
+ />
93
+ );
94
+ };
95
+
96
+ function renderShadowToggle() {
97
+ return ( { onToggle, isOpen } ) => {
98
+ const toggleProps = {
99
+ onClick: onToggle,
100
+ className: classnames( { 'is-open': isOpen } ),
101
+ 'aria-expanded': isOpen,
102
+ };
103
+
104
+ return (
105
+ <Button { ...toggleProps }>
106
+ <HStack justify="flex-start">
107
+ <IconWithCurrentColor icon={ shadowIcon } size={ 24 } />
108
+ <FlexItem className="edit-site-global-styles__shadow-label">
109
+ { __( 'Shadow' ) }
110
+ </FlexItem>
111
+ </HStack>
112
+ </Button>
113
+ );
114
+ };
115
+ }
116
+
117
+ function ShadowPopoverContainer( { shadow, onShadowChange } ) {
118
+ const [ defaultShadows ] = useGlobalSetting( 'shadow.presets.default' );
119
+ const [ themeShadows ] = useGlobalSetting( 'shadow.presets.theme' );
120
+ const [ defaultPresetsEnabled ] = useGlobalSetting(
121
+ 'shadow.defaultPresets'
122
+ );
123
+
124
+ const shadows = [
125
+ ...( defaultPresetsEnabled ? defaultShadows : [] ),
126
+ ...( themeShadows || [] ),
127
+ ];
128
+
129
+ return (
130
+ <div className="edit-site-global-styles__shadow-panel">
131
+ <VStack spacing={ 4 }>
132
+ <Heading level={ 5 }>{ __( 'Shadows' ) }</Heading>
133
+ <ShadowPresets
134
+ presets={ shadows }
135
+ activeShadow={ shadow }
136
+ onSelect={ onShadowChange }
137
+ />
138
+ </VStack>
139
+ </div>
140
+ );
141
+ }
142
+
143
+ function ShadowPresets( { presets, activeShadow, onSelect } ) {
144
+ return ! presets ? null : (
145
+ <Grid columns={ 6 } gap={ 0 } align="center" justify="center">
146
+ { presets.map( ( { name, shadow }, i ) => (
147
+ <ShadowIndicator
148
+ key={ i }
149
+ label={ name }
150
+ isActive={ shadow === activeShadow }
151
+ onSelect={ () =>
152
+ onSelect( shadow === activeShadow ? undefined : shadow )
153
+ }
154
+ shadow={ shadow }
155
+ />
156
+ ) ) }
157
+ </Grid>
158
+ );
159
+ }
160
+
161
+ function ShadowIndicator( { label, isActive, onSelect, shadow } ) {
162
+ return (
163
+ <div className="edit-site-global-styles__shadow-indicator-wrapper">
164
+ <Button
165
+ className="edit-site-global-styles__shadow-indicator"
166
+ onClick={ onSelect }
167
+ aria-label={ label }
168
+ style={ { boxShadow: shadow } }
169
+ >
170
+ { isActive && <Icon icon={ check } /> }
171
+ </Button>
172
+ </div>
173
+ );
174
+ }
@@ -84,7 +84,8 @@ $block-preview-height: 150px;
84
84
 
85
85
  .edit-site-screen-text-color__control,
86
86
  .edit-site-screen-link-color__control,
87
- .edit-site-screen-button-color__control {
87
+ .edit-site-screen-button-color__control,
88
+ .edit-site-screen-background-color__control.has-no-tabs {
88
89
  padding: $grid-unit-20;
89
90
  }
90
91
 
@@ -135,10 +136,46 @@ $block-preview-height: 150px;
135
136
  border-radius: $radius-block-ui;
136
137
  }
137
138
 
139
+ .edit-site-global-styles-screen-css {
140
+ flex: 1 1 auto;
141
+ display: flex;
142
+ flex-direction: column;
143
+
144
+ .components-v-stack {
145
+ flex: 1 1 auto;
146
+
147
+ .edit-site-global-styles__custom-css-input {
148
+ flex: 1 1 auto;
149
+ display: flex;
150
+ flex-direction: column;
151
+
152
+ .components-base-control__field {
153
+ flex: 1 1 auto;
154
+ display: flex;
155
+ flex-direction: column;
156
+
157
+ .components-textarea-control__input {
158
+ flex: 1 1 auto;
159
+ }
160
+ }
161
+ }
162
+ }
163
+ }
164
+
138
165
  .edit-site-global-styles__custom-css-input textarea {
139
166
  font-family: $editor_html_font;
140
167
  }
141
168
 
169
+ .edit-site-global-styles__custom-css-validation-wrapper {
170
+ position: absolute;
171
+ bottom: $grid-unit-20;
172
+ right: $grid-unit * 3;
173
+ }
174
+
175
+ .edit-site-global-styles__custom-css-validation-icon {
176
+ fill: $alert-red;
177
+ }
178
+
142
179
  .edit-site-global-styles__custom-css-theme-css {
143
180
  width: 100%;
144
181
  line-break: anywhere;
@@ -147,6 +184,9 @@ $block-preview-height: 150px;
147
184
  overflow-y: scroll;
148
185
  }
149
186
 
187
+ .edit-site-global-styles-screen-css-help-link {
188
+ padding-left: $grid-unit-20;
189
+ }
150
190
  .edit-site-global-styles-screen-variations {
151
191
  margin-top: $grid-unit-20;
152
192
  border-top: 1px solid $gray-300;
@@ -155,3 +195,47 @@ $block-preview-height: 150px;
155
195
  margin: $grid-unit-30 $grid-unit-20;
156
196
  }
157
197
  }
198
+
199
+ .edit-site-global-styles-sidebar__navigator-screen {
200
+ display: flex;
201
+ flex-direction: column;
202
+ }
203
+
204
+ .edit-site-global-styles__shadow-panel {
205
+ width: 230px;
206
+ }
207
+
208
+ .edit-site-global-styles__shadow-dropdown {
209
+ display: block;
210
+ padding: 0;
211
+
212
+ > button {
213
+ width: 100%;
214
+ padding: $grid-unit-10;
215
+
216
+ &.is-open {
217
+ background-color: $gray-100;
218
+ }
219
+ }
220
+ }
221
+
222
+ // wrapper to clip the shadow beyond 6px
223
+ .edit-site-global-styles__shadow-indicator-wrapper {
224
+ padding: 6px;
225
+ overflow: hidden;
226
+ display: flex;
227
+ align-items: center;
228
+ justify-content: center;
229
+ }
230
+
231
+ // These styles are similar to the color palette.
232
+ .edit-site-global-styles__shadow-indicator {
233
+ color: $gray-800;
234
+ border: $gray-200 $border-width solid;
235
+ border-radius: $radius-block-ui;
236
+ cursor: pointer;
237
+ padding: 0;
238
+
239
+ height: 24px;
240
+ width: 24px;
241
+ }
@@ -8,6 +8,7 @@ import {
8
8
  __experimentalLetterSpacingControl as LetterSpacingControl,
9
9
  __experimentalTextTransformControl as TextTransformControl,
10
10
  __experimentalTextDecorationControl as TextDecorationControl,
11
+ experiments as blockEditorExperiments,
11
12
  } from '@wordpress/block-editor';
12
13
  import {
13
14
  FontSizePicker,
@@ -19,7 +20,10 @@ import { __ } from '@wordpress/i18n';
19
20
  /**
20
21
  * Internal dependencies
21
22
  */
22
- import { getSupportedGlobalStylesPanels, useSetting, useStyle } from './hooks';
23
+ import { getSupportedGlobalStylesPanels } from './hooks';
24
+ import { unlock } from '../../experiments';
25
+
26
+ const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
23
27
 
24
28
  export function useHasTypographyPanel( name ) {
25
29
  const hasFontFamily = useHasFontFamilyControl( name );
@@ -38,14 +42,21 @@ export function useHasTypographyPanel( name ) {
38
42
 
39
43
  function useHasFontFamilyControl( name ) {
40
44
  const supports = getSupportedGlobalStylesPanels( name );
41
- const [ fontFamilies ] = useSetting( 'typography.fontFamilies', name );
45
+ const [ fontFamiliesPerOrigin ] = useGlobalSetting(
46
+ 'typography.fontFamilies',
47
+ name
48
+ );
49
+ const fontFamilies =
50
+ fontFamiliesPerOrigin?.custom ||
51
+ fontFamiliesPerOrigin?.theme ||
52
+ fontFamiliesPerOrigin?.default;
42
53
  return supports.includes( 'fontFamily' ) && !! fontFamilies?.length;
43
54
  }
44
55
 
45
56
  function useHasLineHeightControl( name ) {
46
57
  const supports = getSupportedGlobalStylesPanels( name );
47
58
  return (
48
- useSetting( 'typography.lineHeight', name )[ 0 ] &&
59
+ useGlobalSetting( 'typography.lineHeight', name )[ 0 ] &&
49
60
  supports.includes( 'lineHeight' )
50
61
  );
51
62
  }
@@ -53,10 +64,10 @@ function useHasLineHeightControl( name ) {
53
64
  function useHasAppearanceControl( name ) {
54
65
  const supports = getSupportedGlobalStylesPanels( name );
55
66
  const hasFontStyles =
56
- useSetting( 'typography.fontStyle', name )[ 0 ] &&
67
+ useGlobalSetting( 'typography.fontStyle', name )[ 0 ] &&
57
68
  supports.includes( 'fontStyle' );
58
69
  const hasFontWeights =
59
- useSetting( 'typography.fontWeight', name )[ 0 ] &&
70
+ useGlobalSetting( 'typography.fontWeight', name )[ 0 ] &&
60
71
  supports.includes( 'fontWeight' );
61
72
  return hasFontStyles || hasFontWeights;
62
73
  }
@@ -64,10 +75,10 @@ function useHasAppearanceControl( name ) {
64
75
  function useAppearanceControlLabel( name ) {
65
76
  const supports = getSupportedGlobalStylesPanels( name );
66
77
  const hasFontStyles =
67
- useSetting( 'typography.fontStyle', name )[ 0 ] &&
78
+ useGlobalSetting( 'typography.fontStyle', name )[ 0 ] &&
68
79
  supports.includes( 'fontStyle' );
69
80
  const hasFontWeights =
70
- useSetting( 'typography.fontWeight', name )[ 0 ] &&
81
+ useGlobalSetting( 'typography.fontWeight', name )[ 0 ] &&
71
82
  supports.includes( 'fontWeight' );
72
83
  if ( ! hasFontStyles ) {
73
84
  return __( 'Font weight' );
@@ -79,7 +90,7 @@ function useAppearanceControlLabel( name ) {
79
90
  }
80
91
 
81
92
  function useHasLetterSpacingControl( name, element ) {
82
- const setting = useSetting( 'typography.letterSpacing', name )[ 0 ];
93
+ const setting = useGlobalSetting( 'typography.letterSpacing', name )[ 0 ];
83
94
  if ( ! setting ) {
84
95
  return false;
85
96
  }
@@ -91,7 +102,7 @@ function useHasLetterSpacingControl( name, element ) {
91
102
  }
92
103
 
93
104
  function useHasTextTransformControl( name, element ) {
94
- const setting = useSetting( 'typography.textTransform', name )[ 0 ];
105
+ const setting = useGlobalSetting( 'typography.textTransform', name )[ 0 ];
95
106
  if ( ! setting ) {
96
107
  return false;
97
108
  }
@@ -110,16 +121,16 @@ function useHasTextDecorationControl( name, element ) {
110
121
  }
111
122
 
112
123
  function useStyleWithReset( path, blockName ) {
113
- const [ style, setStyle ] = useStyle( path, blockName );
114
- const [ userStyle ] = useStyle( path, blockName, 'user' );
124
+ const [ style, setStyle ] = useGlobalStyle( path, blockName );
125
+ const [ userStyle ] = useGlobalStyle( path, blockName, 'user' );
115
126
  const hasStyle = () => !! userStyle;
116
127
  const resetStyle = () => setStyle( undefined );
117
128
  return [ style, setStyle, hasStyle, resetStyle ];
118
129
  }
119
130
 
120
131
  function useFontSizeWithReset( path, blockName ) {
121
- const [ fontSize, setStyleCallback ] = useStyle( path, blockName );
122
- const [ userStyle ] = useStyle( path, blockName, 'user' );
132
+ const [ fontSize, setStyleCallback ] = useGlobalStyle( path, blockName );
133
+ const [ userStyle ] = useGlobalStyle( path, blockName, 'user' );
123
134
  const hasFontSize = () => !! userStyle;
124
135
  const resetFontSize = () => setStyleCallback( undefined );
125
136
  const setFontSize = ( newValue, metadata ) => {
@@ -138,20 +149,20 @@ function useFontSizeWithReset( path, blockName ) {
138
149
  }
139
150
 
140
151
  function useFontAppearance( prefix, name ) {
141
- const [ fontStyle, setFontStyle ] = useStyle(
152
+ const [ fontStyle, setFontStyle ] = useGlobalStyle(
142
153
  prefix + 'typography.fontStyle',
143
154
  name
144
155
  );
145
- const [ userFontStyle ] = useStyle(
156
+ const [ userFontStyle ] = useGlobalStyle(
146
157
  prefix + 'typography.fontStyle',
147
158
  name,
148
159
  'user'
149
160
  );
150
- const [ fontWeight, setFontWeight ] = useStyle(
161
+ const [ fontWeight, setFontWeight ] = useGlobalStyle(
151
162
  prefix + 'typography.fontWeight',
152
163
  name
153
164
  );
154
- const [ userFontWeight ] = useStyle(
165
+ const [ userFontWeight ] = useGlobalStyle(
155
166
  prefix + 'typography.fontWeight',
156
167
  name,
157
168
  'user'
@@ -175,7 +186,7 @@ export default function TypographyPanel( {
175
186
  name,
176
187
  element,
177
188
  headingLevel,
178
- variationPath = '',
189
+ variation = '',
179
190
  } ) {
180
191
  const supports = getSupportedGlobalStylesPanels( name );
181
192
  let prefix = '';
@@ -184,18 +195,37 @@ export default function TypographyPanel( {
184
195
  } else if ( element && element !== 'text' ) {
185
196
  prefix = `elements.${ element }.`;
186
197
  }
187
- const [ fontSizes ] = useSetting( 'typography.fontSizes', name );
198
+ if ( variation ) {
199
+ prefix = prefix
200
+ ? `variations.${ variation }.${ prefix }`
201
+ : `variations.${ variation }`;
202
+ }
203
+ const [ fontSizesPerOrigin ] = useGlobalSetting(
204
+ 'typography.fontSizes',
205
+ name
206
+ );
207
+ const fontSizes =
208
+ fontSizesPerOrigin?.custom ||
209
+ fontSizesPerOrigin?.theme ||
210
+ fontSizesPerOrigin?.default;
188
211
 
189
- const disableCustomFontSizes = ! useSetting(
212
+ const disableCustomFontSizes = ! useGlobalSetting(
190
213
  'typography.customFontSize',
191
214
  name
192
215
  )[ 0 ];
193
- const [ fontFamilies ] = useSetting( 'typography.fontFamilies', name );
216
+ const [ fontFamiliesPerOrigin ] = useGlobalSetting(
217
+ 'typography.fontFamilies',
218
+ name
219
+ );
220
+ const fontFamilies =
221
+ fontFamiliesPerOrigin?.custom ||
222
+ fontFamiliesPerOrigin?.theme ||
223
+ fontFamiliesPerOrigin?.default;
194
224
  const hasFontStyles =
195
- useSetting( 'typography.fontStyle', name )[ 0 ] &&
225
+ useGlobalSetting( 'typography.fontStyle', name )[ 0 ] &&
196
226
  supports.includes( 'fontStyle' );
197
227
  const hasFontWeights =
198
- useSetting( 'typography.fontWeight', name )[ 0 ] &&
228
+ useGlobalSetting( 'typography.fontWeight', name )[ 0 ] &&
199
229
  supports.includes( 'fontWeight' );
200
230
  const hasFontFamilyEnabled = useHasFontFamilyControl( name );
201
231
  const hasLineHeightEnabled = useHasLineHeightControl( name );
@@ -215,15 +245,9 @@ export default function TypographyPanel( {
215
245
  }
216
246
 
217
247
  const [ fontFamily, setFontFamily, hasFontFamily, resetFontFamily ] =
218
- useStyleWithReset(
219
- variationPath + prefix + 'typography.fontFamily',
220
- name
221
- );
248
+ useStyleWithReset( prefix + 'typography.fontFamily', name );
222
249
  const { fontSize, setFontSize, hasFontSize, resetFontSize } =
223
- useFontSizeWithReset(
224
- variationPath + prefix + 'typography.fontSize',
225
- name
226
- );
250
+ useFontSizeWithReset( prefix + 'typography.fontSize', name );
227
251
  const {
228
252
  fontStyle,
229
253
  setFontStyle,
@@ -231,39 +255,27 @@ export default function TypographyPanel( {
231
255
  setFontWeight,
232
256
  hasFontAppearance,
233
257
  resetFontAppearance,
234
- } = useFontAppearance( variationPath + prefix, name );
258
+ } = useFontAppearance( prefix, name );
235
259
  const [ lineHeight, setLineHeight, hasLineHeight, resetLineHeight ] =
236
- useStyleWithReset(
237
- variationPath + prefix + 'typography.lineHeight',
238
- name
239
- );
260
+ useStyleWithReset( prefix + 'typography.lineHeight', name );
240
261
  const [
241
262
  letterSpacing,
242
263
  setLetterSpacing,
243
264
  hasLetterSpacing,
244
265
  resetLetterSpacing,
245
- ] = useStyleWithReset(
246
- variationPath + prefix + 'typography.letterSpacing',
247
- name
248
- );
266
+ ] = useStyleWithReset( prefix + 'typography.letterSpacing', name );
249
267
  const [
250
268
  textTransform,
251
269
  setTextTransform,
252
270
  hasTextTransform,
253
271
  resetTextTransform,
254
- ] = useStyleWithReset(
255
- variationPath + prefix + 'typography.textTransform',
256
- name
257
- );
272
+ ] = useStyleWithReset( prefix + 'typography.textTransform', name );
258
273
  const [
259
274
  textDecoration,
260
275
  setTextDecoration,
261
276
  hasTextDecoration,
262
277
  resetTextDecoration,
263
- ] = useStyleWithReset(
264
- variationPath + prefix + 'typography.textDecoration',
265
- name
266
- );
278
+ ] = useStyleWithReset( prefix + 'typography.textDecoration', name );
267
279
 
268
280
  const resetAll = () => {
269
281
  resetFontFamily();