@wordpress/edit-site 5.2.0 → 5.3.1

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 (409) 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 +9 -32
  7. package/build/components/add-new-template/new-template-part.js.map +1 -1
  8. package/build/components/add-new-template/new-template.js +5 -4
  9. package/build/components/add-new-template/new-template.js.map +1 -1
  10. package/build/components/add-new-template/utils.js +1 -9
  11. package/build/components/add-new-template/utils.js.map +1 -1
  12. package/build/components/app/index.js +2 -7
  13. package/build/components/app/index.js.map +1 -1
  14. package/build/components/block-editor/editor-canvas.js +13 -2
  15. package/build/components/block-editor/editor-canvas.js.map +1 -1
  16. package/build/components/block-editor/index.js +16 -14
  17. package/build/components/block-editor/index.js.map +1 -1
  18. package/build/components/block-editor/inserter-media-categories.js +237 -0
  19. package/build/components/block-editor/inserter-media-categories.js.map +1 -0
  20. package/build/components/canvas-spinner/index.js +20 -0
  21. package/build/components/canvas-spinner/index.js.map +1 -0
  22. package/build/components/create-template-part-modal/index.js +4 -2
  23. package/build/components/create-template-part-modal/index.js.map +1 -1
  24. package/build/components/editor/index.js +9 -5
  25. package/build/components/editor/index.js.map +1 -1
  26. package/build/components/error-boundary/index.js +2 -12
  27. package/build/components/error-boundary/index.js.map +1 -1
  28. package/build/components/error-boundary/warning.js +5 -28
  29. package/build/components/error-boundary/warning.js.map +1 -1
  30. package/build/components/global-styles/block-preview-panel.js +2 -2
  31. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  32. package/build/components/global-styles/border-panel.js +17 -9
  33. package/build/components/global-styles/border-panel.js.map +1 -1
  34. package/build/components/global-styles/color-palette-panel.js +13 -7
  35. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  36. package/build/components/global-styles/context-menu.js +39 -4
  37. package/build/components/global-styles/context-menu.js.map +1 -1
  38. package/build/components/global-styles/custom-css.js +65 -14
  39. package/build/components/global-styles/custom-css.js.map +1 -1
  40. package/build/components/global-styles/dimensions-panel.js +49 -31
  41. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  42. package/build/components/global-styles/global-styles-provider.js +13 -3
  43. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  44. package/build/components/global-styles/gradients-palette-panel.js +17 -11
  45. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  46. package/build/components/global-styles/hooks.js +21 -142
  47. package/build/components/global-styles/hooks.js.map +1 -1
  48. package/build/components/global-styles/index.js +0 -28
  49. package/build/components/global-styles/index.js.map +1 -1
  50. package/build/components/global-styles/palette.js +11 -4
  51. package/build/components/global-styles/palette.js.map +1 -1
  52. package/build/components/global-styles/preview.js +18 -15
  53. package/build/components/global-styles/preview.js.map +1 -1
  54. package/build/components/global-styles/screen-background-color.js +27 -13
  55. package/build/components/global-styles/screen-background-color.js.map +1 -1
  56. package/build/components/global-styles/screen-border.js +10 -4
  57. package/build/components/global-styles/screen-border.js.map +1 -1
  58. package/build/components/global-styles/screen-button-color.js +16 -9
  59. package/build/components/global-styles/screen-button-color.js.map +1 -1
  60. package/build/components/global-styles/screen-colors.js +43 -34
  61. package/build/components/global-styles/screen-colors.js.map +1 -1
  62. package/build/components/global-styles/screen-css.js +20 -8
  63. package/build/components/global-styles/screen-css.js.map +1 -1
  64. package/build/components/global-styles/screen-heading-color.js +23 -16
  65. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  66. package/build/components/global-styles/screen-layout.js +3 -3
  67. package/build/components/global-styles/screen-layout.js.map +1 -1
  68. package/build/components/global-styles/screen-link-color.js +18 -11
  69. package/build/components/global-styles/screen-link-color.js.map +1 -1
  70. package/build/components/global-styles/screen-root.js +25 -9
  71. package/build/components/global-styles/screen-root.js.map +1 -1
  72. package/build/components/global-styles/screen-style-variations.js +8 -4
  73. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  74. package/build/components/global-styles/screen-text-color.js +14 -7
  75. package/build/components/global-styles/screen-text-color.js.map +1 -1
  76. package/build/components/global-styles/screen-typography.js +18 -12
  77. package/build/components/global-styles/screen-typography.js.map +1 -1
  78. package/build/components/global-styles/shadow-panel.js +196 -0
  79. package/build/components/global-styles/shadow-panel.js.map +1 -0
  80. package/build/components/global-styles/typography-panel.js +43 -29
  81. package/build/components/global-styles/typography-panel.js.map +1 -1
  82. package/build/components/global-styles/typography-preview.js +19 -9
  83. package/build/components/global-styles/typography-preview.js.map +1 -1
  84. package/build/components/global-styles/ui.js +104 -34
  85. package/build/components/global-styles/ui.js.map +1 -1
  86. package/build/components/global-styles/utils.js +5 -334
  87. package/build/components/global-styles/utils.js.map +1 -1
  88. package/build/components/global-styles-renderer/index.js +7 -5
  89. package/build/components/global-styles-renderer/index.js.map +1 -1
  90. package/build/components/header-edit-mode/document-actions/index.js +2 -2
  91. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  92. package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
  93. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  94. package/build/components/layout/index.js +11 -11
  95. package/build/components/layout/index.js.map +1 -1
  96. package/build/components/list/actions/rename-menu-item.js +8 -11
  97. package/build/components/list/actions/rename-menu-item.js.map +1 -1
  98. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +9 -6
  99. package/build/components/navigation-inspector/index.js.map +1 -0
  100. package/build/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +14 -14
  101. package/build/components/navigation-inspector/navigation-menu.js.map +1 -0
  102. package/build/components/sidebar/index.js +3 -1
  103. package/build/components/sidebar/index.js.map +1 -1
  104. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +3 -18
  105. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  106. package/build/components/sidebar-edit-mode/index.js +1 -14
  107. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  108. package/build/components/sidebar-navigation-screen/index.js +3 -2
  109. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  110. package/build/components/sidebar-navigation-screen-main/index.js +23 -1
  111. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  112. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +52 -0
  113. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  114. package/build/components/sidebar-navigation-screen-templates/index.js +3 -8
  115. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  116. package/build/components/site-hub/index.js +11 -10
  117. package/build/components/site-hub/index.js.map +1 -1
  118. package/build/components/site-icon/index.js +1 -1
  119. package/build/components/site-icon/index.js.map +1 -1
  120. package/build/components/style-book/index.js +7 -4
  121. package/build/components/style-book/index.js.map +1 -1
  122. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +6 -4
  123. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  124. package/build/components/template-part-converter/convert-to-template-part.js +5 -9
  125. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  126. package/build/experiments.js +19 -0
  127. package/build/experiments.js.map +1 -0
  128. package/build/hooks/push-changes-to-global-styles/index.js +65 -6
  129. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  130. package/build/index.js +53 -60
  131. package/build/index.js.map +1 -1
  132. package/build/store/actions.js +1 -27
  133. package/build/store/actions.js.map +1 -1
  134. package/build/store/index.js +8 -0
  135. package/build/store/index.js.map +1 -1
  136. package/build/store/private-actions.js +40 -0
  137. package/build/store/private-actions.js.map +1 -0
  138. package/build/store/private-selectors.js +18 -0
  139. package/build/store/private-selectors.js.map +1 -0
  140. package/build/store/selectors.js +7 -40
  141. package/build/store/selectors.js.map +1 -1
  142. package/build/store/utils.js +77 -0
  143. package/build/store/utils.js.map +1 -0
  144. package/build/utils/template-part-create.js +71 -0
  145. package/build/utils/template-part-create.js.map +1 -0
  146. package/build-module/components/add-new-template/add-custom-generic-template-modal.js +9 -11
  147. package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  148. package/build-module/components/add-new-template/add-custom-template-modal.js +0 -1
  149. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  150. package/build-module/components/add-new-template/new-template-part.js +8 -31
  151. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  152. package/build-module/components/add-new-template/new-template.js +4 -4
  153. package/build-module/components/add-new-template/new-template.js.map +1 -1
  154. package/build-module/components/add-new-template/utils.js +0 -5
  155. package/build-module/components/add-new-template/utils.js.map +1 -1
  156. package/build-module/components/app/index.js +2 -7
  157. package/build-module/components/app/index.js.map +1 -1
  158. package/build-module/components/block-editor/editor-canvas.js +13 -3
  159. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  160. package/build-module/components/block-editor/index.js +17 -15
  161. package/build-module/components/block-editor/index.js.map +1 -1
  162. package/build-module/components/block-editor/inserter-media-categories.js +225 -0
  163. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -0
  164. package/build-module/components/canvas-spinner/index.js +12 -0
  165. package/build-module/components/canvas-spinner/index.js.map +1 -0
  166. package/build-module/components/create-template-part-modal/index.js +5 -3
  167. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  168. package/build-module/components/editor/index.js +7 -5
  169. package/build-module/components/editor/index.js.map +1 -1
  170. package/build-module/components/error-boundary/index.js +2 -12
  171. package/build-module/components/error-boundary/index.js.map +1 -1
  172. package/build-module/components/error-boundary/warning.js +5 -28
  173. package/build-module/components/error-boundary/warning.js.map +1 -1
  174. package/build-module/components/global-styles/block-preview-panel.js +2 -2
  175. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  176. package/build-module/components/global-styles/border-panel.js +17 -11
  177. package/build-module/components/global-styles/border-panel.js.map +1 -1
  178. package/build-module/components/global-styles/color-palette-panel.js +11 -7
  179. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  180. package/build-module/components/global-styles/context-menu.js +40 -8
  181. package/build-module/components/global-styles/context-menu.js.map +1 -1
  182. package/build-module/components/global-styles/custom-css.js +61 -15
  183. package/build-module/components/global-styles/custom-css.js.map +1 -1
  184. package/build-module/components/global-styles/dimensions-panel.js +49 -32
  185. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  186. package/build-module/components/global-styles/global-styles-provider.js +7 -2
  187. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  188. package/build-module/components/global-styles/gradients-palette-panel.js +15 -11
  189. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  190. package/build-module/components/global-styles/hooks.js +23 -134
  191. package/build-module/components/global-styles/hooks.js.map +1 -1
  192. package/build-module/components/global-styles/index.js +0 -2
  193. package/build-module/components/global-styles/index.js.map +1 -1
  194. package/build-module/components/global-styles/palette.js +10 -5
  195. package/build-module/components/global-styles/palette.js.map +1 -1
  196. package/build-module/components/global-styles/preview.js +18 -14
  197. package/build-module/components/global-styles/preview.js.map +1 -1
  198. package/build-module/components/global-styles/screen-background-color.js +26 -15
  199. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  200. package/build-module/components/global-styles/screen-border.js +10 -5
  201. package/build-module/components/global-styles/screen-border.js.map +1 -1
  202. package/build-module/components/global-styles/screen-button-color.js +16 -11
  203. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  204. package/build-module/components/global-styles/screen-colors.js +43 -37
  205. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  206. package/build-module/components/global-styles/screen-css.js +21 -9
  207. package/build-module/components/global-styles/screen-css.js.map +1 -1
  208. package/build-module/components/global-styles/screen-heading-color.js +23 -18
  209. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  210. package/build-module/components/global-styles/screen-layout.js +4 -4
  211. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  212. package/build-module/components/global-styles/screen-link-color.js +18 -13
  213. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  214. package/build-module/components/global-styles/screen-root.js +23 -9
  215. package/build-module/components/global-styles/screen-root.js.map +1 -1
  216. package/build-module/components/global-styles/screen-style-variations.js +5 -2
  217. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  218. package/build-module/components/global-styles/screen-text-color.js +14 -9
  219. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  220. package/build-module/components/global-styles/screen-typography.js +16 -12
  221. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  222. package/build-module/components/global-styles/shadow-panel.js +177 -0
  223. package/build-module/components/global-styles/shadow-panel.js.map +1 -0
  224. package/build-module/components/global-styles/typography-panel.js +43 -31
  225. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  226. package/build-module/components/global-styles/typography-preview.js +17 -9
  227. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  228. package/build-module/components/global-styles/ui.js +98 -35
  229. package/build-module/components/global-styles/ui.js.map +1 -1
  230. package/build-module/components/global-styles/utils.js +4 -319
  231. package/build-module/components/global-styles/utils.js.map +1 -1
  232. package/build-module/components/global-styles-renderer/index.js +5 -5
  233. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  234. package/build-module/components/header-edit-mode/document-actions/index.js +2 -2
  235. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  236. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
  237. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  238. package/build-module/components/layout/index.js +10 -11
  239. package/build-module/components/layout/index.js.map +1 -1
  240. package/build-module/components/list/actions/rename-menu-item.js +9 -12
  241. package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
  242. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +9 -6
  243. package/build-module/components/navigation-inspector/index.js.map +1 -0
  244. package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +14 -15
  245. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -0
  246. package/build-module/components/sidebar/index.js +2 -1
  247. package/build-module/components/sidebar/index.js.map +1 -1
  248. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +6 -21
  249. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  250. package/build-module/components/sidebar-edit-mode/index.js +1 -13
  251. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  252. package/build-module/components/sidebar-navigation-screen/index.js +3 -2
  253. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  254. package/build-module/components/sidebar-navigation-screen-main/index.js +22 -2
  255. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  256. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +40 -0
  257. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
  258. package/build-module/components/sidebar-navigation-screen-templates/index.js +4 -9
  259. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  260. package/build-module/components/site-hub/index.js +10 -10
  261. package/build-module/components/site-hub/index.js.map +1 -1
  262. package/build-module/components/site-icon/index.js +1 -1
  263. package/build-module/components/site-icon/index.js.map +1 -1
  264. package/build-module/components/style-book/index.js +8 -5
  265. package/build-module/components/style-book/index.js.map +1 -1
  266. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -4
  267. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  268. package/build-module/components/template-part-converter/convert-to-template-part.js +5 -9
  269. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  270. package/build-module/experiments.js +9 -0
  271. package/build-module/experiments.js.map +1 -0
  272. package/build-module/hooks/push-changes-to-global-styles/index.js +62 -3
  273. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  274. package/build-module/index.js +52 -60
  275. package/build-module/index.js.map +1 -1
  276. package/build-module/store/actions.js +0 -23
  277. package/build-module/store/actions.js.map +1 -1
  278. package/build-module/store/index.js +5 -0
  279. package/build-module/store/index.js.map +1 -1
  280. package/build-module/store/private-actions.js +29 -0
  281. package/build-module/store/private-actions.js.map +1 -0
  282. package/build-module/store/private-selectors.js +11 -0
  283. package/build-module/store/private-selectors.js.map +1 -0
  284. package/build-module/store/selectors.js +6 -37
  285. package/build-module/store/selectors.js.map +1 -1
  286. package/build-module/store/utils.js +66 -0
  287. package/build-module/store/utils.js.map +1 -0
  288. package/build-module/utils/template-part-create.js +53 -0
  289. package/build-module/utils/template-part-create.js.map +1 -0
  290. package/build-style/style-rtl.css +314 -216
  291. package/build-style/style.css +314 -216
  292. package/package.json +32 -30
  293. package/src/components/add-new-template/add-custom-generic-template-modal.js +20 -28
  294. package/src/components/add-new-template/add-custom-template-modal.js +0 -1
  295. package/src/components/add-new-template/new-template-part.js +14 -34
  296. package/src/components/add-new-template/new-template.js +5 -3
  297. package/src/components/add-new-template/style.scss +0 -4
  298. package/src/components/add-new-template/utils.js +0 -14
  299. package/src/components/app/index.js +2 -2
  300. package/src/components/block-editor/editor-canvas.js +12 -2
  301. package/src/components/block-editor/index.js +16 -28
  302. package/src/components/block-editor/inserter-media-categories.js +247 -0
  303. package/src/components/block-editor/style.scss +20 -7
  304. package/src/components/canvas-spinner/index.js +12 -0
  305. package/src/components/canvas-spinner/style.scss +7 -0
  306. package/src/components/create-template-part-modal/index.js +75 -67
  307. package/src/components/create-template-part-modal/style.scss +0 -10
  308. package/src/components/editor/index.js +8 -5
  309. package/src/components/error-boundary/index.js +2 -10
  310. package/src/components/error-boundary/warning.js +6 -35
  311. package/src/components/global-styles/README.md +1 -75
  312. package/src/components/global-styles/block-preview-panel.js +2 -2
  313. package/src/components/global-styles/border-panel.js +19 -17
  314. package/src/components/global-styles/color-palette-panel.js +10 -7
  315. package/src/components/global-styles/context-menu.js +114 -44
  316. package/src/components/global-styles/custom-css.js +76 -19
  317. package/src/components/global-styles/dimensions-panel.js +46 -36
  318. package/src/components/global-styles/global-styles-provider.js +6 -2
  319. package/src/components/global-styles/gradients-palette-panel.js +17 -11
  320. package/src/components/global-styles/hooks.js +31 -155
  321. package/src/components/global-styles/index.js +0 -2
  322. package/src/components/global-styles/palette.js +9 -5
  323. package/src/components/global-styles/preview.js +19 -13
  324. package/src/components/global-styles/screen-background-color.js +37 -21
  325. package/src/components/global-styles/screen-border.js +10 -5
  326. package/src/components/global-styles/screen-button-color.js +21 -19
  327. package/src/components/global-styles/screen-colors.js +48 -65
  328. package/src/components/global-styles/screen-css.js +30 -14
  329. package/src/components/global-styles/screen-heading-color.js +32 -27
  330. package/src/components/global-styles/screen-layout.js +4 -7
  331. package/src/components/global-styles/screen-link-color.js +26 -26
  332. package/src/components/global-styles/screen-root.js +24 -9
  333. package/src/components/global-styles/screen-style-variations.js +7 -2
  334. package/src/components/global-styles/screen-text-color.js +15 -19
  335. package/src/components/global-styles/screen-typography.js +27 -12
  336. package/src/components/global-styles/shadow-panel.js +174 -0
  337. package/src/components/global-styles/style.scss +85 -1
  338. package/src/components/global-styles/typography-panel.js +60 -48
  339. package/src/components/global-styles/typography-preview.js +28 -9
  340. package/src/components/global-styles/ui.js +97 -53
  341. package/src/components/global-styles/utils.js +4 -371
  342. package/src/components/global-styles-renderer/index.js +3 -4
  343. package/src/components/header-edit-mode/document-actions/index.js +1 -1
  344. package/src/components/keyboard-shortcut-help-modal/index.js +0 -1
  345. package/src/components/layout/index.js +12 -4
  346. package/src/components/layout/style.scss +4 -5
  347. package/src/components/list/actions/rename-menu-item.js +14 -23
  348. package/src/components/list/style.scss +0 -4
  349. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +2 -2
  350. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +10 -12
  351. package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/style.scss +0 -17
  352. package/src/components/sidebar/index.js +2 -0
  353. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +8 -32
  354. package/src/components/sidebar-edit-mode/index.js +0 -11
  355. package/src/components/sidebar-edit-mode/settings-header/style.scss +8 -0
  356. package/src/components/sidebar-navigation-item/style.scss +28 -3
  357. package/src/components/sidebar-navigation-screen/index.js +4 -3
  358. package/src/components/sidebar-navigation-screen/style.scss +2 -0
  359. package/src/components/sidebar-navigation-screen-main/index.js +23 -1
  360. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +45 -0
  361. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +12 -0
  362. package/src/components/sidebar-navigation-screen-templates/index.js +12 -19
  363. package/src/components/site-hub/index.js +8 -10
  364. package/src/components/site-hub/style.scss +7 -1
  365. package/src/components/site-icon/index.js +1 -1
  366. package/src/components/site-icon/style.scss +2 -2
  367. package/src/components/style-book/index.js +10 -5
  368. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +4 -3
  369. package/src/components/template-part-converter/convert-to-template-part.js +12 -10
  370. package/src/experiments.js +10 -0
  371. package/src/hooks/push-changes-to-global-styles/index.js +63 -5
  372. package/src/index.js +51 -59
  373. package/src/store/actions.js +0 -24
  374. package/src/store/index.js +5 -0
  375. package/src/store/private-actions.js +29 -0
  376. package/src/store/private-selectors.js +10 -0
  377. package/src/store/selectors.js +6 -37
  378. package/src/store/test/utils.js +181 -0
  379. package/src/store/utils.js +69 -0
  380. package/src/style.scss +4 -2
  381. package/src/utils/template-part-create.js +62 -0
  382. package/src/utils/test/template-part-create.js +63 -0
  383. package/build/components/global-styles/context.js +0 -22
  384. package/build/components/global-styles/context.js.map +0 -1
  385. package/build/components/global-styles/typography-utils.js +0 -92
  386. package/build/components/global-styles/typography-utils.js.map +0 -1
  387. package/build/components/global-styles/use-global-styles-output.js +0 -943
  388. package/build/components/global-styles/use-global-styles-output.js.map +0 -1
  389. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -42
  390. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  391. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  392. package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  393. package/build-module/components/global-styles/context.js +0 -12
  394. package/build-module/components/global-styles/context.js.map +0 -1
  395. package/build-module/components/global-styles/typography-utils.js +0 -84
  396. package/build-module/components/global-styles/typography-utils.js.map +0 -1
  397. package/build-module/components/global-styles/use-global-styles-output.js +0 -901
  398. package/build-module/components/global-styles/use-global-styles-output.js.map +0 -1
  399. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -28
  400. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
  401. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
  402. package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
  403. package/src/components/global-styles/context.js +0 -15
  404. package/src/components/global-styles/test/typography-utils.js +0 -393
  405. package/src/components/global-styles/test/use-global-styles-output.js +0 -814
  406. package/src/components/global-styles/test/utils.js +0 -206
  407. package/src/components/global-styles/typography-utils.js +0 -87
  408. package/src/components/global-styles/use-global-styles-output.js +0 -1059
  409. package/src/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -37
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-text-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","ScreenTextColor","name","variationPath","supports","solids","areCustomSolidsEnabled","isTextEnabled","colorsPerOrigin","hasTextColor","includes","length","color","setColor","userColor"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,yBAA3E;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,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KAPd;AAQC,IAAA,aAAa,EAAGC,QARjB;AASC,IAAA,SAAS,EAAGD,KAAK,KAAKE;AATvB,IAPD,CADD;AAqBA;;AAED,eAAeb,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseSetting,\n\tuseStyle,\n\tuseColorsPerOrigin,\n} from './hooks';\n\nfunction ScreenTextColor( { name, variationPath = '' } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\tconst [ isTextEnabled ] = useSetting( 'color.text', name );\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\n\tconst hasTextColor =\n\t\tsupports.includes( 'color' ) &&\n\t\tisTextEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ color, setColor ] = useStyle( variationPath + 'color.text', name );\n\tconst [ userColor ] = useStyle(\n\t\tvariationPath + 'color.text',\n\t\tname,\n\t\t'user'\n\t);\n\n\tif ( ! hasTextColor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Text' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for text across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-text-color__control\"\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\tcolorValue={ color }\n\t\t\t\tonColorChange={ setColor }\n\t\t\t\tclearable={ color === userColor }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenTextColor;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-text-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","experiments","blockEditorExperiments","ScreenHeader","getSupportedGlobalStylesPanels","useColorsPerOrigin","unlock","useGlobalSetting","useGlobalStyle","ScreenTextColor","name","variation","prefix","supports","areCustomSolidsEnabled","isTextEnabled","colorsPerOrigin","hasTextColor","includes","length","color","setColor","userColor"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,WAAW,IAAIC,sBAFhB,QAGO,yBAHP;AAKA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SAASC,8BAAT,EAAyCC,kBAAzC,QAAmE,SAAnE;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,IAAuCF,MAAM,CAAEJ,sBAAF,CAAnD;;AAEA,SAASO,eAAT,OAAqD;AAAA,MAA3B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG;AAApB,GAA2B;AACpD,QAAMC,MAAM,GAAGD,SAAS,GAAI,cAAcA,SAAW,GAA7B,GAAkC,EAA1D;AACA,QAAME,QAAQ,GAAGT,8BAA8B,CAAEM,IAAF,CAA/C;AACA,QAAM,CAAEI,sBAAF,IAA6BP,gBAAgB,CAAE,cAAF,EAAkBG,IAAlB,CAAnD;AACA,QAAM,CAAEK,aAAF,IAAoBR,gBAAgB,CAAE,YAAF,EAAgBG,IAAhB,CAA1C;AACA,QAAMM,eAAe,GAAGX,kBAAkB,CAAEK,IAAF,CAA1C;AAEA,QAAMO,YAAY,GACjBJ,QAAQ,CAACK,QAAT,CAAmB,OAAnB,KACAH,aADA,KAEEC,eAAe,CAACG,MAAhB,GAAyB,CAAzB,IAA8BL,sBAFhC,CADD;AAKA,QAAM,CAAEM,KAAF,EAASC,QAAT,IAAsBb,cAAc,CAAEI,MAAM,GAAG,YAAX,EAAyBF,IAAzB,CAA1C;AACA,QAAM,CAAEY,SAAF,IAAgBd,cAAc,CAAEI,MAAM,GAAG,YAAX,EAAyBF,IAAzB,EAA+B,MAA/B,CAApC;;AAEA,MAAK,CAAEO,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,8BACC,cAAC,YAAD;AACC,IAAA,KAAK,EAAGnB,EAAE,CAAE,MAAF,CADX;AAEC,IAAA,WAAW,EAAGA,EAAE,CACf,sDADe;AAFjB,IADD,EAOC,cAAC,oBAAD;AACC,IAAA,SAAS,EAAC,sCADX;AAEC,IAAA,MAAM,EAAGkB,eAFV;AAGC,IAAA,mBAAmB,EAAG,CAAEF,sBAHzB;AAIC,IAAA,SAAS,EAAG,KAJb;AAKC,IAAA,WAAW,MALZ;AAMC,IAAA,iCAAiC,MANlC;AAOC,IAAA,UAAU,EAAGM,KAPd;AAQC,IAAA,aAAa,EAAGC,QARjB;AASC,IAAA,SAAS,EAAGD,KAAK,KAAKE;AATvB,IAPD,CADD;AAqBA;;AAED,eAAeb,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalColorGradientControl as ColorGradientControl,\n\texperiments as blockEditorExperiments,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport { getSupportedGlobalStylesPanels, useColorsPerOrigin } from './hooks';\nimport { unlock } from '../../experiments';\n\nconst { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );\n\nfunction ScreenTextColor( { name, variation = '' } ) {\n\tconst prefix = variation ? `variations.${ variation }.` : '';\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );\n\tconst [ isTextEnabled ] = useGlobalSetting( 'color.text', name );\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\n\tconst hasTextColor =\n\t\tsupports.includes( 'color' ) &&\n\t\tisTextEnabled &&\n\t\t( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ color, setColor ] = useGlobalStyle( prefix + 'color.text', name );\n\tconst [ userColor ] = useGlobalStyle( prefix + 'color.text', name, 'user' );\n\n\tif ( ! hasTextColor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Text' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for text across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-text-color__control\"\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\tcolorValue={ color }\n\t\t\t\tonColorChange={ setColor }\n\t\t\t\tclearable={ color === userColor }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenTextColor;\n"]}
@@ -5,17 +5,21 @@ import { createElement, Fragment } from "@wordpress/element";
5
5
  */
6
6
  import { __, sprintf } from '@wordpress/i18n';
7
7
  import { __experimentalItemGroup as ItemGroup, __experimentalVStack as VStack, __experimentalHStack as HStack, FlexItem } from '@wordpress/components';
8
+ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
8
9
  /**
9
10
  * Internal dependencies
10
11
  */
11
12
 
12
13
  import ScreenHeader from './header';
13
14
  import { NavigationButtonAsItem } from './navigation-button';
14
- import { useStyle } from './hooks';
15
15
  import Subtitle from './subtitle';
16
16
  import TypographyPanel from './typography-panel';
17
17
  import BlockPreviewPanel from './block-preview-panel';
18
- import { getVariationClassNameFromPath } from './utils';
18
+ import { getVariationClassName } from './utils';
19
+ import { unlock } from '../../experiments';
20
+ const {
21
+ useGlobalStyle
22
+ } = unlock(blockEditorExperiments);
19
23
 
20
24
  function Item(_ref) {
21
25
  let {
@@ -29,13 +33,13 @@ function Item(_ref) {
29
33
  const extraStyles = element === 'link' ? {
30
34
  textDecoration: 'underline'
31
35
  } : {};
32
- const [fontFamily] = useStyle(prefix + 'typography.fontFamily', name);
33
- const [fontStyle] = useStyle(prefix + 'typography.fontStyle', name);
34
- const [fontWeight] = useStyle(prefix + 'typography.fontWeight', name);
35
- const [letterSpacing] = useStyle(prefix + 'typography.letterSpacing', name);
36
- const [backgroundColor] = useStyle(prefix + 'color.background', name);
37
- const [gradientValue] = useStyle(prefix + 'color.gradient', name);
38
- const [color] = useStyle(prefix + 'color.text', name);
36
+ const [fontFamily] = useGlobalStyle(prefix + 'typography.fontFamily', name);
37
+ const [fontStyle] = useGlobalStyle(prefix + 'typography.fontStyle', name);
38
+ const [fontWeight] = useGlobalStyle(prefix + 'typography.fontWeight', name);
39
+ const [letterSpacing] = useGlobalStyle(prefix + 'typography.letterSpacing', name);
40
+ const [backgroundColor] = useGlobalStyle(prefix + 'color.background', name);
41
+ const [gradientValue] = useGlobalStyle(prefix + 'color.gradient', name);
42
+ const [color] = useGlobalStyle(prefix + 'color.text', name);
39
43
 
40
44
  if (!hasSupport) {
41
45
  return null;
@@ -65,10 +69,10 @@ function Item(_ref) {
65
69
  function ScreenTypography(_ref2) {
66
70
  let {
67
71
  name,
68
- variationPath = ''
72
+ variation = ''
69
73
  } = _ref2;
70
74
  const parentMenu = name === undefined ? '' : '/blocks/' + name;
71
- const variationClassName = getVariationClassNameFromPath(variationPath);
75
+ const variationClassName = getVariationClassName(variation);
72
76
  return createElement(Fragment, null, createElement(ScreenHeader, {
73
77
  title: __('Typography'),
74
78
  description: __('Manage the typography settings for different elements.')
@@ -104,7 +108,7 @@ function ScreenTypography(_ref2) {
104
108
  label: __('Buttons')
105
109
  })))), !!name && createElement(TypographyPanel, {
106
110
  name: name,
107
- variationPath: variationPath,
111
+ variation: variation,
108
112
  element: "text"
109
113
  }));
110
114
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography.js"],"names":["__","sprintf","__experimentalItemGroup","ItemGroup","__experimentalVStack","VStack","__experimentalHStack","HStack","FlexItem","ScreenHeader","NavigationButtonAsItem","useStyle","Subtitle","TypographyPanel","BlockPreviewPanel","getVariationClassNameFromPath","Item","name","parentMenu","element","label","hasSupport","prefix","extraStyles","textDecoration","fontFamily","fontStyle","fontWeight","letterSpacing","backgroundColor","gradientValue","color","navigationButtonLabel","background","ScreenTypography","variationPath","undefined","variationClassName"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,uBAAuB,IAAIC,SAD5B,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,oBAAoB,IAAIC,MAHzB,EAICC,QAJD,QAKO,uBALP;AAOA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SAASC,sBAAT,QAAuC,qBAAvC;AACA,SAASC,QAAT,QAAyB,SAAzB;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,SAASC,6BAAT,QAA8C,SAA9C;;AAEA,SAASC,IAAT,OAAsD;AAAA,MAAvC;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,UAAR;AAAoBC,IAAAA,OAApB;AAA6BC,IAAAA;AAA7B,GAAuC;AACrD,QAAMC,UAAU,GAAG,CAAEJ,IAArB;AACA,QAAMK,MAAM,GACXH,OAAO,KAAK,MAAZ,IAAsB,CAAEA,OAAxB,GAAkC,EAAlC,GAAwC,YAAYA,OAAS,GAD9D;AAEA,QAAMI,WAAW,GAChBJ,OAAO,KAAK,MAAZ,GACG;AACAK,IAAAA,cAAc,EAAE;AADhB,GADH,GAIG,EALJ;AAMA,QAAM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OAAO,EAAC,SAHT;AAIC,IAAA,KAAK,EAAGlB,EAAE,CAAE,UAAF;AAJX,IAbD,EAmBC,cAAC,IAAD;AACC,IAAA,IAAI,EAAGiB,IADR;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,OAAO,EAAC,QAHT;AAIC,IAAA,KAAK,EAAGlB,EAAE,CAAE,SAAF;AAJX,IAnBD,CAFD,CADD,CAXF,EA4CG,CAAC,CAAEiB,IAAH,IACD,cAAC,eAAD;AACC,IAAA,IAAI,EAAGA,IADR;AAEC,IAAA,aAAa,EAAGkB,aAFjB;AAGC,IAAA,OAAO,EAAC;AAHT,IA7CF,CADD;AAsDA;;AAED,eAAeD,gBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tFlexItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { useStyle } from './hooks';\nimport Subtitle from './subtitle';\nimport TypographyPanel from './typography-panel';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { getVariationClassNameFromPath } from './utils';\n\nfunction Item( { name, parentMenu, element, label } ) {\n\tconst hasSupport = ! name;\n\tconst prefix =\n\t\telement === 'text' || ! element ? '' : `elements.${ element }.`;\n\tconst extraStyles =\n\t\telement === 'link'\n\t\t\t? {\n\t\t\t\t\ttextDecoration: 'underline',\n\t\t\t }\n\t\t\t: {};\n\tconst [ fontFamily ] = useStyle( prefix + 'typography.fontFamily', name );\n\tconst [ fontStyle ] = useStyle( prefix + 'typography.fontStyle', name );\n\tconst [ fontWeight ] = useStyle( prefix + 'typography.fontWeight', name );\n\tconst [ letterSpacing ] = useStyle(\n\t\tprefix + 'typography.letterSpacing',\n\t\tname\n\t);\n\tconst [ backgroundColor ] = useStyle( prefix + 'color.background', name );\n\tconst [ gradientValue ] = useStyle( prefix + 'color.gradient', name );\n\tconst [ color ] = useStyle( prefix + 'color.text', name );\n\n\tif ( ! hasSupport ) {\n\t\treturn null;\n\t}\n\n\tconst navigationButtonLabel = sprintf(\n\t\t// translators: %s: is a subset of Typography, e.g., 'text' or 'links'.\n\t\t__( 'Typography %s styles' ),\n\t\tlabel\n\t);\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ parentMenu + '/typography/' + element }\n\t\t\taria-label={ navigationButtonLabel }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<FlexItem\n\t\t\t\t\tclassName=\"edit-site-global-styles-screen-typography__indicator\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tfontFamily: fontFamily ?? 'serif',\n\t\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\t\tcolor,\n\t\t\t\t\t\tfontStyle,\n\t\t\t\t\t\tfontWeight,\n\t\t\t\t\t\tletterSpacing,\n\t\t\t\t\t\t...extraStyles,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Aa' ) }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>{ label }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction ScreenTypography( { name, variationPath = '' } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst variationClassName = getVariationClassNameFromPath( variationPath );\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Typography' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Manage the typography settings for different elements.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<BlockPreviewPanel name={ name } variation={ variationClassName } />\n\n\t\t\t{ ! name && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-typography\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Elements' ) }</Subtitle>\n\t\t\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"text\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"link\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Links' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"heading\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Headings' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"button\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Buttons' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ /* No typography elements support yet for blocks. */ }\n\t\t\t{ !! name && (\n\t\t\t\t<TypographyPanel\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t\telement=\"text\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenTypography;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography.js"],"names":["__","sprintf","__experimentalItemGroup","ItemGroup","__experimentalVStack","VStack","__experimentalHStack","HStack","FlexItem","experiments","blockEditorExperiments","ScreenHeader","NavigationButtonAsItem","Subtitle","TypographyPanel","BlockPreviewPanel","getVariationClassName","unlock","useGlobalStyle","Item","name","parentMenu","element","label","hasSupport","prefix","extraStyles","textDecoration","fontFamily","fontStyle","fontWeight","letterSpacing","backgroundColor","gradientValue","color","navigationButtonLabel","background","ScreenTypography","variation","undefined","variationClassName"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,uBAAuB,IAAIC,SAD5B,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,oBAAoB,IAAIC,MAHzB,EAICC,QAJD,QAKO,uBALP;AAMA,SAASC,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SAASC,sBAAT,QAAuC,qBAAvC;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,SAASC,qBAAT,QAAsC,SAAtC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAqBD,MAAM,CAAEP,sBAAF,CAAjC;;AAEA,SAASS,IAAT,OAAsD;AAAA,MAAvC;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,UAAR;AAAoBC,IAAAA,OAApB;AAA6BC,IAAAA;AAA7B,GAAuC;AACrD,QAAMC,UAAU,GAAG,CAAEJ,IAArB;AACA,QAAMK,MAAM,GACXH,OAAO,KAAK,MAAZ,IAAsB,CAAEA,OAAxB,GAAkC,EAAlC,GAAwC,YAAYA,OAAS,GAD9D;AAEA,QAAMI,WAAW,GAChBJ,OAAO,KAAK,MAAZ,GACG;AACAK,IAAAA,cAAc,EAAE;AADhB,GADH,GAIG,EALJ;AAMA,QAAM,CAAEC,UAAF,IAAiBV,cAAc,CACpCO,MAAM,GAAG,uBAD2B,EAEpCL,IAFoC,CAArC;AAIA,QAAM,CAAES,SAAF,I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AI,EAAGoB,IADR;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,OAAO,EAAC,QAHT;AAIC,IAAA,KAAK,EAAGrB,EAAE,CAAE,SAAF;AAJX,IAnBD,CAFD,CADD,CAXF,EA4CG,CAAC,CAAEoB,IAAH,IACD,cAAC,eAAD;AACC,IAAA,IAAI,EAAGA,IADR;AAEC,IAAA,SAAS,EAAGkB,SAFb;AAGC,IAAA,OAAO,EAAC;AAHT,IA7CF,CADD;AAsDA;;AAED,eAAeD,gBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tFlexItem,\n} from '@wordpress/components';\nimport { experiments as blockEditorExperiments } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport Subtitle from './subtitle';\nimport TypographyPanel from './typography-panel';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { getVariationClassName } from './utils';\nimport { unlock } from '../../experiments';\n\nconst { useGlobalStyle } = unlock( blockEditorExperiments );\n\nfunction Item( { name, parentMenu, element, label } ) {\n\tconst hasSupport = ! name;\n\tconst prefix =\n\t\telement === 'text' || ! element ? '' : `elements.${ element }.`;\n\tconst extraStyles =\n\t\telement === 'link'\n\t\t\t? {\n\t\t\t\t\ttextDecoration: 'underline',\n\t\t\t }\n\t\t\t: {};\n\tconst [ fontFamily ] = useGlobalStyle(\n\t\tprefix + 'typography.fontFamily',\n\t\tname\n\t);\n\tconst [ fontStyle ] = useGlobalStyle(\n\t\tprefix + 'typography.fontStyle',\n\t\tname\n\t);\n\tconst [ fontWeight ] = useGlobalStyle(\n\t\tprefix + 'typography.fontWeight',\n\t\tname\n\t);\n\tconst [ letterSpacing ] = useGlobalStyle(\n\t\tprefix + 'typography.letterSpacing',\n\t\tname\n\t);\n\tconst [ backgroundColor ] = useGlobalStyle(\n\t\tprefix + 'color.background',\n\t\tname\n\t);\n\tconst [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient', name );\n\tconst [ color ] = useGlobalStyle( prefix + 'color.text', name );\n\n\tif ( ! hasSupport ) {\n\t\treturn null;\n\t}\n\n\tconst navigationButtonLabel = sprintf(\n\t\t// translators: %s: is a subset of Typography, e.g., 'text' or 'links'.\n\t\t__( 'Typography %s styles' ),\n\t\tlabel\n\t);\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ parentMenu + '/typography/' + element }\n\t\t\taria-label={ navigationButtonLabel }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<FlexItem\n\t\t\t\t\tclassName=\"edit-site-global-styles-screen-typography__indicator\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tfontFamily: fontFamily ?? 'serif',\n\t\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\t\tcolor,\n\t\t\t\t\t\tfontStyle,\n\t\t\t\t\t\tfontWeight,\n\t\t\t\t\t\tletterSpacing,\n\t\t\t\t\t\t...extraStyles,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Aa' ) }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>{ label }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction ScreenTypography( { name, variation = '' } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst variationClassName = getVariationClassName( variation );\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Typography' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Manage the typography settings for different elements.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<BlockPreviewPanel name={ name } variation={ variationClassName } />\n\n\t\t\t{ ! name && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-typography\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Elements' ) }</Subtitle>\n\t\t\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"text\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"link\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Links' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"heading\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Headings' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"button\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Buttons' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ /* No typography elements support yet for blocks. */ }\n\t\t\t{ !! name && (\n\t\t\t\t<TypographyPanel\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariation={ variation }\n\t\t\t\t\telement=\"text\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenTypography;\n"]}
@@ -0,0 +1,177 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import classnames from 'classnames';
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+
11
+ import { __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, __experimentalItemGroup as ItemGroup, __experimentalHStack as HStack, __experimentalVStack as VStack, __experimentalGrid as Grid, __experimentalHeading as Heading, FlexItem, Dropdown, __experimentalDropdownContentWrapper as DropdownContentWrapper, Button } from '@wordpress/components';
12
+ import { __ } from '@wordpress/i18n';
13
+ import { shadow as shadowIcon, Icon, check } from '@wordpress/icons';
14
+ import { useCallback } from '@wordpress/element';
15
+ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+
20
+ import { getSupportedGlobalStylesPanels } from './hooks';
21
+ import { IconWithCurrentColor } from './icon-with-current-color';
22
+ import { unlock } from '../../experiments';
23
+ const {
24
+ useGlobalSetting,
25
+ useGlobalStyle
26
+ } = unlock(blockEditorExperiments);
27
+ export function useHasShadowControl(name) {
28
+ const supports = getSupportedGlobalStylesPanels(name);
29
+ return supports.includes('shadow');
30
+ }
31
+ export default function ShadowPanel(_ref) {
32
+ let {
33
+ name,
34
+ variation = ''
35
+ } = _ref;
36
+ const prefix = variation ? `variations.${variation}.` : '';
37
+ const [shadow, setShadow] = useGlobalStyle(`${prefix}shadow`, name);
38
+ const [userShadow] = useGlobalStyle(`${prefix}shadow`, name, 'user');
39
+
40
+ const hasShadow = () => !!userShadow;
41
+
42
+ const resetShadow = () => setShadow(undefined);
43
+
44
+ const resetAll = useCallback(() => resetShadow(undefined), [resetShadow]);
45
+ return createElement(ToolsPanel, {
46
+ label: __('Shadow'),
47
+ resetAll: resetAll
48
+ }, createElement(ToolsPanelItem, {
49
+ label: __('Shadow'),
50
+ hasValue: hasShadow,
51
+ onDeselect: resetShadow,
52
+ isShownByDefault: true
53
+ }, createElement(ItemGroup, {
54
+ isBordered: true,
55
+ isSeparated: true
56
+ }, createElement(ShadowPopover, {
57
+ shadow: shadow,
58
+ onShadowChange: setShadow
59
+ }))));
60
+ }
61
+
62
+ const ShadowPopover = _ref2 => {
63
+ let {
64
+ shadow,
65
+ onShadowChange
66
+ } = _ref2;
67
+ const popoverProps = {
68
+ placement: 'left-start',
69
+ offset: 36,
70
+ shift: true
71
+ };
72
+ return createElement(Dropdown, {
73
+ popoverProps: popoverProps,
74
+ className: "edit-site-global-styles__shadow-dropdown",
75
+ renderToggle: renderShadowToggle(),
76
+ renderContent: () => createElement(DropdownContentWrapper, {
77
+ paddingSize: "medium"
78
+ }, createElement(ShadowPopoverContainer, {
79
+ shadow: shadow,
80
+ onShadowChange: onShadowChange
81
+ }))
82
+ });
83
+ };
84
+
85
+ function renderShadowToggle() {
86
+ return _ref3 => {
87
+ let {
88
+ onToggle,
89
+ isOpen
90
+ } = _ref3;
91
+ const toggleProps = {
92
+ onClick: onToggle,
93
+ className: classnames({
94
+ 'is-open': isOpen
95
+ }),
96
+ 'aria-expanded': isOpen
97
+ };
98
+ return createElement(Button, toggleProps, createElement(HStack, {
99
+ justify: "flex-start"
100
+ }, createElement(IconWithCurrentColor, {
101
+ icon: shadowIcon,
102
+ size: 24
103
+ }), createElement(FlexItem, {
104
+ className: "edit-site-global-styles__shadow-label"
105
+ }, __('Shadow'))));
106
+ };
107
+ }
108
+
109
+ function ShadowPopoverContainer(_ref4) {
110
+ let {
111
+ shadow,
112
+ onShadowChange
113
+ } = _ref4;
114
+ const [defaultShadows] = useGlobalSetting('shadow.presets.default');
115
+ const [themeShadows] = useGlobalSetting('shadow.presets.theme');
116
+ const [defaultPresetsEnabled] = useGlobalSetting('shadow.defaultPresets');
117
+ const shadows = [...(defaultPresetsEnabled ? defaultShadows : []), ...(themeShadows || [])];
118
+ return createElement("div", {
119
+ className: "edit-site-global-styles__shadow-panel"
120
+ }, createElement(VStack, {
121
+ spacing: 4
122
+ }, createElement(Heading, {
123
+ level: 5
124
+ }, __('Shadows')), createElement(ShadowPresets, {
125
+ presets: shadows,
126
+ activeShadow: shadow,
127
+ onSelect: onShadowChange
128
+ })));
129
+ }
130
+
131
+ function ShadowPresets(_ref5) {
132
+ let {
133
+ presets,
134
+ activeShadow,
135
+ onSelect
136
+ } = _ref5;
137
+ return !presets ? null : createElement(Grid, {
138
+ columns: 6,
139
+ gap: 0,
140
+ align: "center",
141
+ justify: "center"
142
+ }, presets.map((_ref6, i) => {
143
+ let {
144
+ name,
145
+ shadow
146
+ } = _ref6;
147
+ return createElement(ShadowIndicator, {
148
+ key: i,
149
+ label: name,
150
+ isActive: shadow === activeShadow,
151
+ onSelect: () => onSelect(shadow === activeShadow ? undefined : shadow),
152
+ shadow: shadow
153
+ });
154
+ }));
155
+ }
156
+
157
+ function ShadowIndicator(_ref7) {
158
+ let {
159
+ label,
160
+ isActive,
161
+ onSelect,
162
+ shadow
163
+ } = _ref7;
164
+ return createElement("div", {
165
+ className: "edit-site-global-styles__shadow-indicator-wrapper"
166
+ }, createElement(Button, {
167
+ className: "edit-site-global-styles__shadow-indicator",
168
+ onClick: onSelect,
169
+ "aria-label": label,
170
+ style: {
171
+ boxShadow: shadow
172
+ }
173
+ }, isActive && createElement(Icon, {
174
+ icon: check
175
+ })));
176
+ }
177
+ //# sourceMappingURL=shadow-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/shadow-panel.js"],"names":["classnames","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalItemGroup","ItemGroup","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalGrid","Grid","__experimentalHeading","Heading","FlexItem","Dropdown","__experimentalDropdownContentWrapper","DropdownContentWrapper","Button","__","shadow","shadowIcon","Icon","check","useCallback","experiments","blockEditorExperiments","getSupportedGlobalStylesPanels","IconWithCurrentColor","unlock","useGlobalSetting","useGlobalStyle","useHasShadowControl","name","supports","includes","ShadowPanel","variation","prefix","setShadow","userShadow","hasShadow","resetShadow","undefined","resetAll","ShadowPopover","onShadowChange","popoverProps","placement","offset","shift","renderShadowToggle","onToggle","isOpen","toggleProps","onClick","className","ShadowPopoverContainer","defaultShadows","themeShadows","defaultPresetsEnabled","shadows","ShadowPresets","presets","activeShadow","onSelect","map","i","ShadowIndicator","label","isActive","boxShadow"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,wBAAwB,IAAIC,UAD7B,EAECC,4BAA4B,IAAIC,cAFjC,EAGCC,uBAAuB,IAAIC,SAH5B,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,oBAAoB,IAAIC,MALzB,EAMCC,kBAAkB,IAAIC,IANvB,EAOCC,qBAAqB,IAAIC,OAP1B,EAQCC,QARD,EASCC,QATD,EAUCC,oCAAoC,IAAIC,sBAVzC,EAWCC,MAXD,QAYO,uBAZP;AAaA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAM,IAAIC,UAAnB,EAA+BC,IAA/B,EAAqCC,KAArC,QAAkD,kBAAlD;AACA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AAEA;AACA;AACA;;AACA,SAASC,8BAAT,QAA+C,SAA/C;AACA,SAASC,oBAAT,QAAqC,2BAArC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,IAAuCF,MAAM,CAAEH,sBAAF,CAAnD;AAEA,OAAO,SAASM,mBAAT,CAA8BC,IAA9B,EAAqC;AAC3C,QAAMC,QAAQ,GAAGP,8BAA8B,CAAEM,IAAF,CAA/C;AACA,SAAOC,QAAQ,CAACC,QAAT,CAAmB,QAAnB,CAAP;AACA;AAED,eAAe,SAASC,WAAT,OAAiD;AAAA,MAA3B;AAAEH,IAAAA,IAAF;AAAQI,IAAAA,SAAS,GAAG;AAApB,GAA2B;AAC/D,QAAMC,MAAM,GAAGD,SAAS,GAAI,cAAcA,SAAW,GAA7B,GAAkC,EAA1D;AACA,QAA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AS,EAAEnD;AAAb;AAJT,KAMGkD,QAAQ,IAAI,cAAC,IAAD;AAAM,IAAA,IAAI,EAAG/C;AAAb,IANf,CADD,CADD;AAYA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalGrid as Grid,\n\t__experimentalHeading as Heading,\n\tFlexItem,\n\tDropdown,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\tButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { shadow as shadowIcon, Icon, check } from '@wordpress/icons';\nimport { useCallback } from '@wordpress/element';\nimport { experiments as blockEditorExperiments } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels } from './hooks';\nimport { IconWithCurrentColor } from './icon-with-current-color';\nimport { unlock } from '../../experiments';\n\nconst { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );\n\nexport function useHasShadowControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn supports.includes( 'shadow' );\n}\n\nexport default function ShadowPanel( { name, variation = '' } ) {\n\tconst prefix = variation ? `variations.${ variation }.` : '';\n\tconst [ shadow, setShadow ] = useGlobalStyle( `${ prefix }shadow`, name );\n\tconst [ userShadow ] = useGlobalStyle( `${ prefix }shadow`, name, 'user' );\n\tconst hasShadow = () => !! userShadow;\n\n\tconst resetShadow = () => setShadow( undefined );\n\tconst resetAll = useCallback(\n\t\t() => resetShadow( undefined ),\n\t\t[ resetShadow ]\n\t);\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Shadow' ) } resetAll={ resetAll }>\n\t\t\t<ToolsPanelItem\n\t\t\t\tlabel={ __( 'Shadow' ) }\n\t\t\t\thasValue={ hasShadow }\n\t\t\t\tonDeselect={ resetShadow }\n\t\t\t\tisShownByDefault\n\t\t\t>\n\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t<ShadowPopover\n\t\t\t\t\t\tshadow={ shadow }\n\t\t\t\t\t\tonShadowChange={ setShadow }\n\t\t\t\t\t/>\n\t\t\t\t</ItemGroup>\n\t\t\t</ToolsPanelItem>\n\t\t</ToolsPanel>\n\t);\n}\n\nconst ShadowPopover = ( { shadow, onShadowChange } ) => {\n\tconst popoverProps = {\n\t\tplacement: 'left-start',\n\t\toffset: 36,\n\t\tshift: true,\n\t};\n\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ popoverProps }\n\t\t\tclassName=\"edit-site-global-styles__shadow-dropdown\"\n\t\t\trenderToggle={ renderShadowToggle() }\n\t\t\trenderContent={ () => (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"medium\">\n\t\t\t\t\t<ShadowPopoverContainer\n\t\t\t\t\t\tshadow={ shadow }\n\t\t\t\t\t\tonShadowChange={ onShadowChange }\n\t\t\t\t\t/>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t/>\n\t);\n};\n\nfunction renderShadowToggle() {\n\treturn ( { onToggle, isOpen } ) => {\n\t\tconst toggleProps = {\n\t\t\tonClick: onToggle,\n\t\t\tclassName: classnames( { 'is-open': isOpen } ),\n\t\t\t'aria-expanded': isOpen,\n\t\t};\n\n\t\treturn (\n\t\t\t<Button { ...toggleProps }>\n\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t<IconWithCurrentColor icon={ shadowIcon } size={ 24 } />\n\t\t\t\t\t<FlexItem className=\"edit-site-global-styles__shadow-label\">\n\t\t\t\t\t\t{ __( 'Shadow' ) }\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t);\n\t};\n}\n\nfunction ShadowPopoverContainer( { shadow, onShadowChange } ) {\n\tconst [ defaultShadows ] = useGlobalSetting( 'shadow.presets.default' );\n\tconst [ themeShadows ] = useGlobalSetting( 'shadow.presets.theme' );\n\tconst [ defaultPresetsEnabled ] = useGlobalSetting(\n\t\t'shadow.defaultPresets'\n\t);\n\n\tconst shadows = [\n\t\t...( defaultPresetsEnabled ? defaultShadows : [] ),\n\t\t...( themeShadows || [] ),\n\t];\n\n\treturn (\n\t\t<div className=\"edit-site-global-styles__shadow-panel\">\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<Heading level={ 5 }>{ __( 'Shadows' ) }</Heading>\n\t\t\t\t<ShadowPresets\n\t\t\t\t\tpresets={ shadows }\n\t\t\t\t\tactiveShadow={ shadow }\n\t\t\t\t\tonSelect={ onShadowChange }\n\t\t\t\t/>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nfunction ShadowPresets( { presets, activeShadow, onSelect } ) {\n\treturn ! presets ? null : (\n\t\t<Grid columns={ 6 } gap={ 0 } align=\"center\" justify=\"center\">\n\t\t\t{ presets.map( ( { name, shadow }, i ) => (\n\t\t\t\t<ShadowIndicator\n\t\t\t\t\tkey={ i }\n\t\t\t\t\tlabel={ name }\n\t\t\t\t\tisActive={ shadow === activeShadow }\n\t\t\t\t\tonSelect={ () =>\n\t\t\t\t\t\tonSelect( shadow === activeShadow ? undefined : shadow )\n\t\t\t\t\t}\n\t\t\t\t\tshadow={ shadow }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</Grid>\n\t);\n}\n\nfunction ShadowIndicator( { label, isActive, onSelect, shadow } ) {\n\treturn (\n\t\t<div className=\"edit-site-global-styles__shadow-indicator-wrapper\">\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-global-styles__shadow-indicator\"\n\t\t\t\tonClick={ onSelect }\n\t\t\t\taria-label={ label }\n\t\t\t\tstyle={ { boxShadow: shadow } }\n\t\t\t>\n\t\t\t\t{ isActive && <Icon icon={ check } /> }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
@@ -3,14 +3,19 @@ import { createElement } from "@wordpress/element";
3
3
  /**
4
4
  * WordPress dependencies
5
5
  */
6
- import { LineHeightControl, __experimentalFontFamilyControl as FontFamilyControl, __experimentalFontAppearanceControl as FontAppearanceControl, __experimentalLetterSpacingControl as LetterSpacingControl, __experimentalTextTransformControl as TextTransformControl, __experimentalTextDecorationControl as TextDecorationControl } from '@wordpress/block-editor';
6
+ import { LineHeightControl, __experimentalFontFamilyControl as FontFamilyControl, __experimentalFontAppearanceControl as FontAppearanceControl, __experimentalLetterSpacingControl as LetterSpacingControl, __experimentalTextTransformControl as TextTransformControl, __experimentalTextDecorationControl as TextDecorationControl, experiments as blockEditorExperiments } from '@wordpress/block-editor';
7
7
  import { FontSizePicker, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
8
8
  import { __ } from '@wordpress/i18n';
9
9
  /**
10
10
  * Internal dependencies
11
11
  */
12
12
 
13
- import { getSupportedGlobalStylesPanels, useSetting, useStyle } from './hooks';
13
+ import { getSupportedGlobalStylesPanels } from './hooks';
14
+ import { unlock } from '../../experiments';
15
+ const {
16
+ useGlobalSetting,
17
+ useGlobalStyle
18
+ } = unlock(blockEditorExperiments);
14
19
  export function useHasTypographyPanel(name) {
15
20
  const hasFontFamily = useHasFontFamilyControl(name);
16
21
  const hasLineHeight = useHasLineHeightControl(name);
@@ -22,26 +27,27 @@ export function useHasTypographyPanel(name) {
22
27
 
23
28
  function useHasFontFamilyControl(name) {
24
29
  const supports = getSupportedGlobalStylesPanels(name);
25
- const [fontFamilies] = useSetting('typography.fontFamilies', name);
30
+ const [fontFamiliesPerOrigin] = useGlobalSetting('typography.fontFamilies', name);
31
+ const fontFamilies = (fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.custom) || (fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.theme) || (fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.default);
26
32
  return supports.includes('fontFamily') && !!(fontFamilies !== null && fontFamilies !== void 0 && fontFamilies.length);
27
33
  }
28
34
 
29
35
  function useHasLineHeightControl(name) {
30
36
  const supports = getSupportedGlobalStylesPanels(name);
31
- return useSetting('typography.lineHeight', name)[0] && supports.includes('lineHeight');
37
+ return useGlobalSetting('typography.lineHeight', name)[0] && supports.includes('lineHeight');
32
38
  }
33
39
 
34
40
  function useHasAppearanceControl(name) {
35
41
  const supports = getSupportedGlobalStylesPanels(name);
36
- const hasFontStyles = useSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle');
37
- const hasFontWeights = useSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight');
42
+ const hasFontStyles = useGlobalSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle');
43
+ const hasFontWeights = useGlobalSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight');
38
44
  return hasFontStyles || hasFontWeights;
39
45
  }
40
46
 
41
47
  function useAppearanceControlLabel(name) {
42
48
  const supports = getSupportedGlobalStylesPanels(name);
43
- const hasFontStyles = useSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle');
44
- const hasFontWeights = useSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight');
49
+ const hasFontStyles = useGlobalSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle');
50
+ const hasFontWeights = useGlobalSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight');
45
51
 
46
52
  if (!hasFontStyles) {
47
53
  return __('Font weight');
@@ -55,7 +61,7 @@ function useAppearanceControlLabel(name) {
55
61
  }
56
62
 
57
63
  function useHasLetterSpacingControl(name, element) {
58
- const setting = useSetting('typography.letterSpacing', name)[0];
64
+ const setting = useGlobalSetting('typography.letterSpacing', name)[0];
59
65
 
60
66
  if (!setting) {
61
67
  return false;
@@ -70,7 +76,7 @@ function useHasLetterSpacingControl(name, element) {
70
76
  }
71
77
 
72
78
  function useHasTextTransformControl(name, element) {
73
- const setting = useSetting('typography.textTransform', name)[0];
79
+ const setting = useGlobalSetting('typography.textTransform', name)[0];
74
80
 
75
81
  if (!setting) {
76
82
  return false;
@@ -92,8 +98,8 @@ function useHasTextDecorationControl(name, element) {
92
98
  }
93
99
 
94
100
  function useStyleWithReset(path, blockName) {
95
- const [style, setStyle] = useStyle(path, blockName);
96
- const [userStyle] = useStyle(path, blockName, 'user');
101
+ const [style, setStyle] = useGlobalStyle(path, blockName);
102
+ const [userStyle] = useGlobalStyle(path, blockName, 'user');
97
103
 
98
104
  const hasStyle = () => !!userStyle;
99
105
 
@@ -103,8 +109,8 @@ function useStyleWithReset(path, blockName) {
103
109
  }
104
110
 
105
111
  function useFontSizeWithReset(path, blockName) {
106
- const [fontSize, setStyleCallback] = useStyle(path, blockName);
107
- const [userStyle] = useStyle(path, blockName, 'user');
112
+ const [fontSize, setStyleCallback] = useGlobalStyle(path, blockName);
113
+ const [userStyle] = useGlobalStyle(path, blockName, 'user');
108
114
 
109
115
  const hasFontSize = () => !!userStyle;
110
116
 
@@ -127,10 +133,10 @@ function useFontSizeWithReset(path, blockName) {
127
133
  }
128
134
 
129
135
  function useFontAppearance(prefix, name) {
130
- const [fontStyle, setFontStyle] = useStyle(prefix + 'typography.fontStyle', name);
131
- const [userFontStyle] = useStyle(prefix + 'typography.fontStyle', name, 'user');
132
- const [fontWeight, setFontWeight] = useStyle(prefix + 'typography.fontWeight', name);
133
- const [userFontWeight] = useStyle(prefix + 'typography.fontWeight', name, 'user');
136
+ const [fontStyle, setFontStyle] = useGlobalStyle(prefix + 'typography.fontStyle', name);
137
+ const [userFontStyle] = useGlobalStyle(prefix + 'typography.fontStyle', name, 'user');
138
+ const [fontWeight, setFontWeight] = useGlobalStyle(prefix + 'typography.fontWeight', name);
139
+ const [userFontWeight] = useGlobalStyle(prefix + 'typography.fontWeight', name, 'user');
134
140
 
135
141
  const hasFontAppearance = () => !!userFontStyle || !!userFontWeight;
136
142
 
@@ -154,7 +160,7 @@ export default function TypographyPanel(_ref) {
154
160
  name,
155
161
  element,
156
162
  headingLevel,
157
- variationPath = ''
163
+ variation = ''
158
164
  } = _ref;
159
165
  const supports = getSupportedGlobalStylesPanels(name);
160
166
  let prefix = '';
@@ -165,11 +171,17 @@ export default function TypographyPanel(_ref) {
165
171
  prefix = `elements.${element}.`;
166
172
  }
167
173
 
168
- const [fontSizes] = useSetting('typography.fontSizes', name);
169
- const disableCustomFontSizes = !useSetting('typography.customFontSize', name)[0];
170
- const [fontFamilies] = useSetting('typography.fontFamilies', name);
171
- const hasFontStyles = useSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle');
172
- const hasFontWeights = useSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight');
174
+ if (variation) {
175
+ prefix = prefix ? `variations.${variation}.${prefix}` : `variations.${variation}`;
176
+ }
177
+
178
+ const [fontSizesPerOrigin] = useGlobalSetting('typography.fontSizes', name);
179
+ const fontSizes = (fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.custom) || (fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.theme) || (fontSizesPerOrigin === null || fontSizesPerOrigin === void 0 ? void 0 : fontSizesPerOrigin.default);
180
+ const disableCustomFontSizes = !useGlobalSetting('typography.customFontSize', name)[0];
181
+ const [fontFamiliesPerOrigin] = useGlobalSetting('typography.fontFamilies', name);
182
+ const fontFamilies = (fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.custom) || (fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.theme) || (fontFamiliesPerOrigin === null || fontFamiliesPerOrigin === void 0 ? void 0 : fontFamiliesPerOrigin.default);
183
+ const hasFontStyles = useGlobalSetting('typography.fontStyle', name)[0] && supports.includes('fontStyle');
184
+ const hasFontWeights = useGlobalSetting('typography.fontWeight', name)[0] && supports.includes('fontWeight');
173
185
  const hasFontFamilyEnabled = useHasFontFamilyControl(name);
174
186
  const hasLineHeightEnabled = useHasLineHeightControl(name);
175
187
  const hasAppearanceControl = useHasAppearanceControl(name);
@@ -185,13 +197,13 @@ export default function TypographyPanel(_ref) {
185
197
  hasFontSizeEnabled = false;
186
198
  }
187
199
 
188
- const [fontFamily, setFontFamily, hasFontFamily, resetFontFamily] = useStyleWithReset(variationPath + prefix + 'typography.fontFamily', name);
200
+ const [fontFamily, setFontFamily, hasFontFamily, resetFontFamily] = useStyleWithReset(prefix + 'typography.fontFamily', name);
189
201
  const {
190
202
  fontSize,
191
203
  setFontSize,
192
204
  hasFontSize,
193
205
  resetFontSize
194
- } = useFontSizeWithReset(variationPath + prefix + 'typography.fontSize', name);
206
+ } = useFontSizeWithReset(prefix + 'typography.fontSize', name);
195
207
  const {
196
208
  fontStyle,
197
209
  setFontStyle,
@@ -199,11 +211,11 @@ export default function TypographyPanel(_ref) {
199
211
  setFontWeight,
200
212
  hasFontAppearance,
201
213
  resetFontAppearance
202
- } = useFontAppearance(variationPath + prefix, name);
203
- const [lineHeight, setLineHeight, hasLineHeight, resetLineHeight] = useStyleWithReset(variationPath + prefix + 'typography.lineHeight', name);
204
- const [letterSpacing, setLetterSpacing, hasLetterSpacing, resetLetterSpacing] = useStyleWithReset(variationPath + prefix + 'typography.letterSpacing', name);
205
- const [textTransform, setTextTransform, hasTextTransform, resetTextTransform] = useStyleWithReset(variationPath + prefix + 'typography.textTransform', name);
206
- const [textDecoration, setTextDecoration, hasTextDecoration, resetTextDecoration] = useStyleWithReset(variationPath + prefix + 'typography.textDecoration', name);
214
+ } = useFontAppearance(prefix, name);
215
+ const [lineHeight, setLineHeight, hasLineHeight, resetLineHeight] = useStyleWithReset(prefix + 'typography.lineHeight', name);
216
+ const [letterSpacing, setLetterSpacing, hasLetterSpacing, resetLetterSpacing] = useStyleWithReset(prefix + 'typography.letterSpacing', name);
217
+ const [textTransform, setTextTransform, hasTextTransform, resetTextTransform] = useStyleWithReset(prefix + 'typography.textTransform', name);
218
+ const [textDecoration, setTextDecoration, hasTextDecoration, resetTextDecoration] = useStyleWithReset(prefix + 'typography.textDecoration', name);
207
219
 
208
220
  const resetAll = () => {
209
221
  resetFontFamily();