@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
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/hooks.js"],"names":["fastDeepEqual","get","set","colord","extend","a11yPlugin","_x","useContext","useCallback","useMemo","getBlockType","__EXPERIMENTAL_PATHS_WITH_MERGE","PATHS_WITH_MERGE","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","getValueFromVariable","getPresetVariableFromValue","GlobalStylesContext","EMPTY_CONFIG","settings","styles","useGlobalStylesReset","user","config","setUserConfig","canReset","useSetting","path","blockName","source","merged","mergedConfig","base","baseConfig","userConfig","fullPath","setSetting","newValue","currentConfig","newUserConfig","JSON","parse","stringify","pathToSet","getSettingValueForContext","name","currentPath","getSettingValue","configToUse","result","custom","theme","default","resultWithFallback","useStyle","finalPath","setStyle","ROOT_BLOCK_SUPPORTS","getSupportedGlobalStylesPanels","blockType","supportKeys","supports","spacing","blockGap","__experimentalSkipSerialization","some","spacingType","push","Object","keys","forEach","styleName","support","requiresOptOut","useColorsPerOrigin","customColors","themeColors","defaultColors","shouldDisplayDefaultColors","length","colors","useGradientsPerOrigin","customGradients","themeGradients","defaultGradients","shouldDisplayDefaultGradients","gradients","useColorRandomizer","setThemeColors","randomizeColors","randomRotationValue","Math","floor","random","newColors","map","colorObject","color","newColor","rotate","toHex","window","__experimentalEnableColorRandomizer"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,qBAA1B;AACA,SAASC,GAAT,EAAcC,GAAd,QAAyB,QAAzB;AACA,SAASC,MAAT,EAAiBC,MAAjB,QAA+B,QAA/B;AACA,OAAOC,UAAP,MAAuB,qBAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,WAArB,EAAkCC,OAAlC,QAAiD,oBAAjD;AACA,SACCC,YADD,EAECC,+BAA+B,IAAIC,gBAFpC,EAGCC,6BAA6B,IAAIC,cAHlC,QAIO,mBAJP;AAMA;AACA;AACA;;AACA,SAASC,oBAAT,EAA+BC,0BAA/B,QAAiE,SAAjE;AACA,SAASC,mBAAT,QAAoC,WAApC,C,CAEA;;AACAb,MAAM,CAAE,CAAEC,UAAF,CAAF,CAAN;AAEA,MAAMa,YAAY,GAAG;AAAEC,EAAAA,QAAQ,EAAE,EAAZ;AAAgBC,EAAAA,MAAM,EAAE;AAAxB,CAArB;AAEA,OAAO,MAAMC,oBAAoB,GAAG,MAAM;AACzC,QAAM;AAAEC,IAAAA,IAAI,EAAEC,MAAR;AA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A,IAAI,EAAEvC,EAAE,CACP,QADO,EAEP,gDAFO,CADI;AAKZgF,QAAAA,SAAS,EAAEJ;AALC,OAAb;AAOA;;AACD,WAAOjC,MAAP;AACA,GAlCa,EAkCX,CAAEiC,eAAF,EAAmBC,cAAnB,EAAmCC,gBAAnC,CAlCW,CAAd;AAmCA;AAED,OAAO,SAASG,kBAAT,CAA6B1C,IAA7B,EAAoC;AAC1C,QAAM,CAAE+B,WAAF,EAAeY,cAAf,IAAkC9D,UAAU,CACjD,qBADiD,EAEjDmB,IAFiD,CAAlD;;AAKA,WAAS4C,eAAT,GAA2B;AAC1B;AACA,UAAMC,mBAAmB,GAAGC,IAAI,CAACC,KAAL,CAAYD,IAAI,CAACE,MAAL,KAAgB,GAA5B,CAA5B;AACA;;AAEA,UAAMC,SAAS,GAAGlB,WAAW,CAACmB,GAAZ,CAAmBC,WAAF,IAAmB;AACrD,YAAM;AAAEC,QAAAA;AAAF,UAAYD,WAAlB;AACA,YAAME,QAAQ,GAAG/F,MAAM,CAAE8F,KAAF,CAAN,CACfE,MADe,CACPT,mBADO,EAEfU,KAFe,EAAjB;AAIA,aAAO,EACN,GAAGJ,WADG;AAENC,QAAAA,KAAK,EAAEC;AAFD,OAAP;AAIA,KAViB,CAAlB;AAYAV,IAAAA,cAAc,CAAEM,SAAF,CAAd;AACA;;AAED,SAAOO,MAAM,CAACC,mCAAP,GACJ,CAAEb,eAAF,CADI,GAEJ,EAFH;AAGA","sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\nimport { get, set } from 'lodash';\nimport { colord, extend } from 'colord';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\nimport { useContext, useCallback, useMemo } from '@wordpress/element';\nimport {\n\tgetBlockType,\n\t__EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE,\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { getValueFromVariable, getPresetVariableFromValue } from './utils';\nimport { GlobalStylesContext } from './context';\n\n// Enable colord's a11y plugin.\nextend( [ a11yPlugin ] );\n\nconst EMPTY_CONFIG = { settings: {}, styles: {} };\n\nexport const useGlobalStylesReset = () => {\n\tconst { user: config, setUserConfig } = useContext( GlobalStylesContext );\n\tconst canReset = !! config && ! fastDeepEqual( config, EMPTY_CONFIG );\n\treturn [\n\t\tcanReset,\n\t\tuseCallback(\n\t\t\t() => setUserConfig( () => EMPTY_CONFIG ),\n\t\t\t[ setUserConfig ]\n\t\t),\n\t];\n};\n\nexport function useSetting( path, blockName, source = 'all' ) {\n\tconst {\n\t\tmerged: mergedConfig,\n\t\tbase: baseConfig,\n\t\tuser: userConfig,\n\t\tsetUserConfig,\n\t} = useContext( GlobalStylesContext );\n\n\tconst fullPath = ! blockName\n\t\t? `settings.${ path }`\n\t\t: `settings.blocks.${ blockName }.${ path }`;\n\n\tconst setSetting = ( newValue ) => {\n\t\tsetUserConfig( ( currentConfig ) => {\n\t\t\t// Deep clone `currentConfig` to avoid mutating it later.\n\t\t\tconst newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );\n\t\t\tconst pathToSet = PATHS_WITH_MERGE[ path ]\n\t\t\t\t? fullPath + '.custom'\n\t\t\t\t: fullPath;\n\t\t\tset( newUserConfig, pathToSet, newValue );\n\n\t\t\treturn newUserConfig;\n\t\t} );\n\t};\n\n\tconst getSettingValueForContext = ( name ) => {\n\t\tconst currentPath = ! name\n\t\t\t? `settings.${ path }`\n\t\t\t: `settings.blocks.${ name }.${ path }`;\n\n\t\tconst getSettingValue = ( configToUse ) => {\n\t\t\tconst result = get( configToUse, currentPath );\n\t\t\tif ( PATHS_WITH_MERGE[ path ] ) {\n\t\t\t\treturn result?.custom ?? result?.theme ?? result?.default;\n\t\t\t}\n\t\t\treturn result;\n\t\t};\n\n\t\tlet result;\n\t\tswitch ( source ) {\n\t\t\tcase 'all':\n\t\t\t\tresult = getSettingValue( mergedConfig );\n\t\t\t\tbreak;\n\t\t\tcase 'user':\n\t\t\t\tresult = getSettingValue( userConfig );\n\t\t\t\tbreak;\n\t\t\tcase 'base':\n\t\t\t\tresult = getSettingValue( baseConfig );\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow 'Unsupported source';\n\t\t}\n\n\t\treturn result;\n\t};\n\n\t// Unlike styles settings get inherited from top level settings.\n\tconst resultWithFallback =\n\t\tgetSettingValueForContext( blockName ) ?? getSettingValueForContext();\n\n\treturn [ resultWithFallback, setSetting ];\n}\n\nexport function useStyle( path, blockName, source = 'all' ) {\n\tconst {\n\t\tmerged: mergedConfig,\n\t\tbase: baseConfig,\n\t\tuser: userConfig,\n\t\tsetUserConfig,\n\t} = useContext( GlobalStylesContext );\n\tconst finalPath = ! blockName\n\t\t? `styles.${ path }`\n\t\t: `styles.blocks.${ blockName }.${ path }`;\n\n\tconst setStyle = ( newValue ) => {\n\t\tsetUserConfig( ( currentConfig ) => {\n\t\t\t// Deep clone `currentConfig` to avoid mutating it later.\n\t\t\tconst newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );\n\t\t\tset(\n\t\t\t\tnewUserConfig,\n\t\t\t\tfinalPath,\n\t\t\t\tgetPresetVariableFromValue(\n\t\t\t\t\tmergedConfig.settings,\n\t\t\t\t\tblockName,\n\t\t\t\t\tpath,\n\t\t\t\t\tnewValue\n\t\t\t\t)\n\t\t\t);\n\t\t\treturn newUserConfig;\n\t\t} );\n\t};\n\n\tlet result;\n\tswitch ( source ) {\n\t\tcase 'all':\n\t\t\tresult = getValueFromVariable(\n\t\t\t\tmergedConfig,\n\t\t\t\tblockName,\n\t\t\t\t// The stlyes.css path is allowed to be empty, so don't revert to base if undefined.\n\t\t\t\tfinalPath === 'styles.css'\n\t\t\t\t\t? get( userConfig, finalPath )\n\t\t\t\t\t: get( userConfig, finalPath ) ??\n\t\t\t\t\t\t\tget( baseConfig, finalPath )\n\t\t\t);\n\t\t\tbreak;\n\t\tcase 'user':\n\t\t\tresult = getValueFromVariable(\n\t\t\t\tmergedConfig,\n\t\t\t\tblockName,\n\t\t\t\tget( userConfig, finalPath )\n\t\t\t);\n\t\t\tbreak;\n\t\tcase 'base':\n\t\t\tresult = getValueFromVariable(\n\t\t\t\tbaseConfig,\n\t\t\t\tblockName,\n\t\t\t\tget( baseConfig, finalPath )\n\t\t\t);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow 'Unsupported source';\n\t}\n\n\treturn [ result, setStyle ];\n}\n\nconst ROOT_BLOCK_SUPPORTS = [\n\t'background',\n\t'backgroundColor',\n\t'color',\n\t'linkColor',\n\t'buttonColor',\n\t'fontFamily',\n\t'fontSize',\n\t'fontStyle',\n\t'fontWeight',\n\t'lineHeight',\n\t'textDecoration',\n\t'padding',\n\t'contentSize',\n\t'wideSize',\n\t'blockGap',\n];\n\nexport function getSupportedGlobalStylesPanels( name ) {\n\tif ( ! name ) {\n\t\treturn ROOT_BLOCK_SUPPORTS;\n\t}\n\n\tconst blockType = getBlockType( name );\n\n\tif ( ! blockType ) {\n\t\treturn [];\n\t}\n\n\tconst supportKeys = [];\n\n\t// Check for blockGap support.\n\t// Block spacing support doesn't map directly to a single style property, so needs to be handled separately.\n\t// Also, only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.\n\tif (\n\t\tblockType?.supports?.spacing?.blockGap &&\n\t\tblockType?.supports?.spacing?.__experimentalSkipSerialization !==\n\t\t\ttrue &&\n\t\t! blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(\n\t\t\t( spacingType ) => spacingType === 'blockGap'\n\t\t)\n\t) {\n\t\tsupportKeys.push( 'blockGap' );\n\t}\n\n\tObject.keys( STYLE_PROPERTY ).forEach( ( styleName ) => {\n\t\tif ( ! STYLE_PROPERTY[ styleName ].support ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Opting out means that, for certain support keys like background color,\n\t\t// blocks have to explicitly set the support value false. If the key is\n\t\t// unset, we still enable it.\n\t\tif ( STYLE_PROPERTY[ styleName ].requiresOptOut ) {\n\t\t\tif (\n\t\t\t\tSTYLE_PROPERTY[ styleName ].support[ 0 ] in\n\t\t\t\t\tblockType.supports &&\n\t\t\t\tget(\n\t\t\t\t\tblockType.supports,\n\t\t\t\t\tSTYLE_PROPERTY[ styleName ].support\n\t\t\t\t) !== false\n\t\t\t) {\n\t\t\t\treturn supportKeys.push( styleName );\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tget(\n\t\t\t\tblockType.supports,\n\t\t\t\tSTYLE_PROPERTY[ styleName ].support,\n\t\t\t\tfalse\n\t\t\t)\n\t\t) {\n\t\t\treturn supportKeys.push( styleName );\n\t\t}\n\t} );\n\n\treturn supportKeys;\n}\n\nexport function useColorsPerOrigin( name ) {\n\tconst [ customColors ] = useSetting( 'color.palette.custom', name );\n\tconst [ themeColors ] = useSetting( 'color.palette.theme', name );\n\tconst [ defaultColors ] = useSetting( 'color.palette.default', name );\n\tconst [ shouldDisplayDefaultColors ] = useSetting( 'color.defaultPalette' );\n\n\treturn useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeColors && themeColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: themeColors,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultColors &&\n\t\t\tdefaultColors &&\n\t\t\tdefaultColors.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tcolors: defaultColors,\n\t\t\t} );\n\t\t}\n\t\tif ( customColors && customColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tcolors: customColors,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [ customColors, themeColors, defaultColors ] );\n}\n\nexport function useGradientsPerOrigin( name ) {\n\tconst [ customGradients ] = useSetting( 'color.gradients.custom', name );\n\tconst [ themeGradients ] = useSetting( 'color.gradients.theme', name );\n\tconst [ defaultGradients ] = useSetting( 'color.gradients.default', name );\n\tconst [ shouldDisplayDefaultGradients ] = useSetting(\n\t\t'color.defaultGradients'\n\t);\n\n\treturn useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeGradients && themeGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tgradients: themeGradients,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultGradients &&\n\t\t\tdefaultGradients &&\n\t\t\tdefaultGradients.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tgradients: defaultGradients,\n\t\t\t} );\n\t\t}\n\t\tif ( customGradients && customGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tgradients: customGradients,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [ customGradients, themeGradients, defaultGradients ] );\n}\n\nexport function useColorRandomizer( name ) {\n\tconst [ themeColors, setThemeColors ] = useSetting(\n\t\t'color.palette.theme',\n\t\tname\n\t);\n\n\tfunction randomizeColors() {\n\t\t/* eslint-disable no-restricted-syntax */\n\t\tconst randomRotationValue = Math.floor( Math.random() * 225 );\n\t\t/* eslint-enable no-restricted-syntax */\n\n\t\tconst newColors = themeColors.map( ( colorObject ) => {\n\t\t\tconst { color } = colorObject;\n\t\t\tconst newColor = colord( color )\n\t\t\t\t.rotate( randomRotationValue )\n\t\t\t\t.toHex();\n\n\t\t\treturn {\n\t\t\t\t...colorObject,\n\t\t\t\tcolor: newColor,\n\t\t\t};\n\t\t} );\n\n\t\tsetThemeColors( newColors );\n\t}\n\n\treturn window.__experimentalEnableColorRandomizer\n\t\t? [ randomizeColors ]\n\t\t: [];\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/hooks.js"],"names":["get","colord","extend","a11yPlugin","_x","useMemo","getBlockType","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","experiments","blockEditorExperiments","unlock","useGlobalSetting","ROOT_BLOCK_SUPPORTS","getSupportedGlobalStylesPanels","name","blockType","supportKeys","supports","spacing","blockGap","__experimentalSkipSerialization","some","spacingType","push","shadow","Object","keys","forEach","styleName","support","requiresOptOut","useColorsPerOrigin","customColors","themeColors","defaultColors","shouldDisplayDefaultColors","result","length","colors","useGradientsPerOrigin","customGradients","themeGradients","defaultGradients","shouldDisplayDefaultGradients","gradients","useColorRandomizer","setThemeColors","randomizeColors","randomRotationValue","Math","floor","random","newColors","map","colorObject","color","newColor","rotate","toHex","window","__experimentalEnableColorRandomizer"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AACA,SAASC,MAAT,EAAiBC,MAAjB,QAA+B,QAA/B;AACA,OAAOC,UAAP,MAAuB,qBAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SACCC,YADD,EAECC,6BAA6B,IAAIC,cAFlC,QAGO,mBAHP;AAIA,SAASC,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAuBD,MAAM,CAAED,sBAAF,CAAnC,C,CAEA;;AACAR,MA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nimport { get } from 'lodash';\nimport { colord, extend } from 'colord';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tgetBlockType,\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n} from '@wordpress/blocks';\nimport { experiments as blockEditorExperiments } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../experiments';\n\nconst { useGlobalSetting } = unlock( blockEditorExperiments );\n\n// Enable colord's a11y plugin.\nextend( [ a11yPlugin ] );\n\nconst ROOT_BLOCK_SUPPORTS = [\n\t'background',\n\t'backgroundColor',\n\t'color',\n\t'linkColor',\n\t'buttonColor',\n\t'fontFamily',\n\t'fontSize',\n\t'fontStyle',\n\t'fontWeight',\n\t'lineHeight',\n\t'textDecoration',\n\t'padding',\n\t'contentSize',\n\t'wideSize',\n\t'blockGap',\n];\n\nexport function getSupportedGlobalStylesPanels( name ) {\n\tif ( ! name ) {\n\t\treturn ROOT_BLOCK_SUPPORTS;\n\t}\n\n\tconst blockType = getBlockType( name );\n\n\tif ( ! blockType ) {\n\t\treturn [];\n\t}\n\n\tconst supportKeys = [];\n\n\t// Check for blockGap support.\n\t// Block spacing support doesn't map directly to a single style property, so needs to be handled separately.\n\t// Also, only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.\n\tif (\n\t\tblockType?.supports?.spacing?.blockGap &&\n\t\tblockType?.supports?.spacing?.__experimentalSkipSerialization !==\n\t\t\ttrue &&\n\t\t! blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(\n\t\t\t( spacingType ) => spacingType === 'blockGap'\n\t\t)\n\t) {\n\t\tsupportKeys.push( 'blockGap' );\n\t}\n\n\t// check for shadow support\n\tif ( blockType?.supports?.shadow ) {\n\t\tsupportKeys.push( 'shadow' );\n\t}\n\n\tObject.keys( STYLE_PROPERTY ).forEach( ( styleName ) => {\n\t\tif ( ! STYLE_PROPERTY[ styleName ].support ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Opting out means that, for certain support keys like background color,\n\t\t// blocks have to explicitly set the support value false. If the key is\n\t\t// unset, we still enable it.\n\t\tif ( STYLE_PROPERTY[ styleName ].requiresOptOut ) {\n\t\t\tif (\n\t\t\t\tSTYLE_PROPERTY[ styleName ].support[ 0 ] in\n\t\t\t\t\tblockType.supports &&\n\t\t\t\tget(\n\t\t\t\t\tblockType.supports,\n\t\t\t\t\tSTYLE_PROPERTY[ styleName ].support\n\t\t\t\t) !== false\n\t\t\t) {\n\t\t\t\treturn supportKeys.push( styleName );\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\tget(\n\t\t\t\tblockType.supports,\n\t\t\t\tSTYLE_PROPERTY[ styleName ].support,\n\t\t\t\tfalse\n\t\t\t)\n\t\t) {\n\t\t\treturn supportKeys.push( styleName );\n\t\t}\n\t} );\n\n\treturn supportKeys;\n}\n\nexport function useColorsPerOrigin( name ) {\n\tconst [ customColors ] = useGlobalSetting( 'color.palette.custom', name );\n\tconst [ themeColors ] = useGlobalSetting( 'color.palette.theme', name );\n\tconst [ defaultColors ] = useGlobalSetting( 'color.palette.default', name );\n\tconst [ shouldDisplayDefaultColors ] = useGlobalSetting(\n\t\t'color.defaultPalette'\n\t);\n\n\treturn useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeColors && themeColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: themeColors,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultColors &&\n\t\t\tdefaultColors &&\n\t\t\tdefaultColors.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tcolors: defaultColors,\n\t\t\t} );\n\t\t}\n\t\tif ( customColors && customColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tcolors: customColors,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [ customColors, themeColors, defaultColors ] );\n}\n\nexport function useGradientsPerOrigin( name ) {\n\tconst [ customGradients ] = useGlobalSetting(\n\t\t'color.gradients.custom',\n\t\tname\n\t);\n\tconst [ themeGradients ] = useGlobalSetting(\n\t\t'color.gradients.theme',\n\t\tname\n\t);\n\tconst [ defaultGradients ] = useGlobalSetting(\n\t\t'color.gradients.default',\n\t\tname\n\t);\n\tconst [ shouldDisplayDefaultGradients ] = useGlobalSetting(\n\t\t'color.defaultGradients'\n\t);\n\n\treturn useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeGradients && themeGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tgradients: themeGradients,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultGradients &&\n\t\t\tdefaultGradients &&\n\t\t\tdefaultGradients.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tgradients: defaultGradients,\n\t\t\t} );\n\t\t}\n\t\tif ( customGradients && customGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tgradients: customGradients,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [ customGradients, themeGradients, defaultGradients ] );\n}\n\nexport function useColorRandomizer( name ) {\n\tconst [ themeColors, setThemeColors ] = useGlobalSetting(\n\t\t'color.palette.theme',\n\t\tname\n\t);\n\n\tfunction randomizeColors() {\n\t\t/* eslint-disable no-restricted-syntax */\n\t\tconst randomRotationValue = Math.floor( Math.random() * 225 );\n\t\t/* eslint-enable no-restricted-syntax */\n\n\t\tconst newColors = themeColors.map( ( colorObject ) => {\n\t\t\tconst { color } = colorObject;\n\t\t\tconst newColor = colord( color )\n\t\t\t\t.rotate( randomRotationValue )\n\t\t\t\t.toHex();\n\n\t\t\treturn {\n\t\t\t\t...colorObject,\n\t\t\t\tcolor: newColor,\n\t\t\t};\n\t\t} );\n\n\t\tsetThemeColors( newColors );\n\t}\n\n\treturn window.__experimentalEnableColorRandomizer\n\t\t? [ randomizeColors ]\n\t\t: [];\n}\n"]}
@@ -1,4 +1,2 @@
1
1
  export { default as GlobalStylesUI } from './ui';
2
- export { useGlobalStylesReset, useStyle, useSetting } from './hooks';
3
- export { useGlobalStylesOutput } from './use-global-styles-output';
4
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/index.js"],"names":["default","GlobalStylesUI","useGlobalStylesReset","useStyle","useSetting","useGlobalStylesOutput"],"mappings":"AAAA,SAASA,OAAO,IAAIC,cAApB,QAA0C,MAA1C;AACA,SAASC,oBAAT,EAA+BC,QAA/B,EAAyCC,UAAzC,QAA2D,SAA3D;AACA,SAASC,qBAAT,QAAsC,4BAAtC","sourcesContent":["export { default as GlobalStylesUI } from './ui';\nexport { useGlobalStylesReset, useStyle, useSetting } from './hooks';\nexport { useGlobalStylesOutput } from './use-global-styles-output';\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/index.js"],"names":["default","GlobalStylesUI"],"mappings":"AAAA,SAASA,OAAO,IAAIC,cAApB,QAA0C,MAA1C","sourcesContent":["export { default as GlobalStylesUI } from './ui';\n"]}
@@ -7,24 +7,29 @@ import { __experimentalItemGroup as ItemGroup, FlexItem, __experimentalHStack as
7
7
  import { __, _n, sprintf } from '@wordpress/i18n';
8
8
  import { shuffle } from '@wordpress/icons';
9
9
  import { useMemo } from '@wordpress/element';
10
+ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
10
11
  /**
11
12
  * Internal dependencies
12
13
  */
13
14
 
14
15
  import Subtitle from './subtitle';
15
16
  import { NavigationButtonAsItem } from './navigation-button';
16
- import { useColorRandomizer, useSetting } from './hooks';
17
+ import { useColorRandomizer } from './hooks';
17
18
  import ColorIndicatorWrapper from './color-indicator-wrapper';
19
+ import { unlock } from '../../experiments';
20
+ const {
21
+ useGlobalSetting
22
+ } = unlock(blockEditorExperiments);
18
23
  const EMPTY_COLORS = [];
19
24
 
20
25
  function Palette(_ref) {
21
26
  let {
22
27
  name
23
28
  } = _ref;
24
- const [customColors] = useSetting('color.palette.custom');
25
- const [themeColors] = useSetting('color.palette.theme');
26
- const [defaultColors] = useSetting('color.palette.default');
27
- const [defaultPaletteEnabled] = useSetting('color.defaultPalette', name);
29
+ const [customColors] = useGlobalSetting('color.palette.custom');
30
+ const [themeColors] = useGlobalSetting('color.palette.theme');
31
+ const [defaultColors] = useGlobalSetting('color.palette.default');
32
+ const [defaultPaletteEnabled] = useGlobalSetting('color.defaultPalette', name);
28
33
  const [randomizeThemeColors] = useColorRandomizer();
29
34
  const colors = useMemo(() => [...(customColors || EMPTY_COLORS), ...(themeColors || EMPTY_COLORS), ...(defaultColors && defaultPaletteEnabled ? defaultColors : EMPTY_COLORS)], [customColors, themeColors, defaultColors, defaultPaletteEnabled]);
30
35
  const screenPath = !name ? '/colors/palette' : '/blocks/' + encodeURIComponent(name) + '/colors/palette';
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/palette.js"],"names":["__experimentalItemGroup","ItemGroup","FlexItem","__experimentalHStack","HStack","__experimentalZStack","ZStack","__experimentalVStack","VStack","ColorIndicator","Button","__","_n","sprintf","shuffle","useMemo","Subtitle","NavigationButtonAsItem","useColorRandomizer","useSetting","ColorIndicatorWrapper","EMPTY_COLORS","Palette","name","customColors","themeColors","defaultColors","defaultPaletteEnabled","randomizeThemeColors","colors","screenPath","encodeURIComponent","paletteButtonText","length","slice","map","index","color"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,QAFD,EAGCC,oBAAoB,IAAIC,MAHzB,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,oBAAoB,IAAIC,MALzB,EAMCC,cAND,EAOCC,MAPD,QAQO,uBARP;AASA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,SAASC,sBAAT,QAAuC,qBAAvC;AACA,SAASC,kBAAT,EAA6BC,UAA7B,QAA+C,SAA/C;AACA,OAAOC,qBAAP,MAAkC,2BAAlC;AAEA,MAAMC,YAAY,GAAG,EAArB;;AAEA,SAASC,OAAT,OAA6B;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AAC5B,QAAM,CAAEC,YAAF,IAAmBL,UAAU,CAAE,sBAAF,CAAnC;AACA,QAAM,CAAEM,WAAF,IAAkBN,UAAU,CAAE,qBAAF,CAAlC;AACA,QAAM,CAAEO,aAAF,IAAoBP,UAAU,CAAE,uBAAF,CAApC;AAEA,QAAM,CAAEQ,qBAAF,IAA4BR,UAAU,CAC3C,sBAD2C,EAE3CI,IAF2C,CAA5C;AAKA,QAAM,CAAEK,oBAAF,IAA2BV,kBAAkB,EAAnD;AAEA,QAAMW,MAAM,GAAGd,OAAO,CACrB,MAAM,CACL,IAAKS,YAAY,IAAIH,YAArB,CADK,EAEL,IAAKI,WAAW,IAAIJ,YAApB,CAFK,EAGL,IAAKK,aAAa,IAAIC,qBAAjB,GACFD,aADE,GAEFL,YAFH,CAHK,CADe,EAQrB,CAAEG,YAAF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AA,OAAO,EAAC,WADT;AAEC,IAAA,IAAI,EAAGd,OAFR;AAGC,IAAA,OAAO,EAAGc;AAHX,KAKGjB,EAAE,CAAE,kBAAF,CALL,CA5BF,CADD;AAuCA;;AAED,eAAeW,OAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tFlexItem,\n\t__experimentalHStack as HStack,\n\t__experimentalZStack as ZStack,\n\t__experimentalVStack as VStack,\n\tColorIndicator,\n\tButton,\n} from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { shuffle } from '@wordpress/icons';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Subtitle from './subtitle';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { useColorRandomizer, useSetting } from './hooks';\nimport ColorIndicatorWrapper from './color-indicator-wrapper';\n\nconst EMPTY_COLORS = [];\n\nfunction Palette( { name } ) {\n\tconst [ customColors ] = useSetting( 'color.palette.custom' );\n\tconst [ themeColors ] = useSetting( 'color.palette.theme' );\n\tconst [ defaultColors ] = useSetting( 'color.palette.default' );\n\n\tconst [ defaultPaletteEnabled ] = useSetting(\n\t\t'color.defaultPalette',\n\t\tname\n\t);\n\n\tconst [ randomizeThemeColors ] = useColorRandomizer();\n\n\tconst colors = useMemo(\n\t\t() => [\n\t\t\t...( customColors || EMPTY_COLORS ),\n\t\t\t...( themeColors || EMPTY_COLORS ),\n\t\t\t...( defaultColors && defaultPaletteEnabled\n\t\t\t\t? defaultColors\n\t\t\t\t: EMPTY_COLORS ),\n\t\t],\n\t\t[ customColors, themeColors, defaultColors, defaultPaletteEnabled ]\n\t);\n\n\tconst screenPath = ! name\n\t\t? '/colors/palette'\n\t\t: '/blocks/' + encodeURIComponent( name ) + '/colors/palette';\n\tconst paletteButtonText =\n\t\tcolors.length > 0\n\t\t\t? sprintf(\n\t\t\t\t\t// Translators: %d: Number of palette colors.\n\t\t\t\t\t_n( '%d color', '%d colors', colors.length ),\n\t\t\t\t\tcolors.length\n\t\t\t )\n\t\t\t: __( 'Add custom colors' );\n\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t<Subtitle>{ __( 'Palette' ) }</Subtitle>\n\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\tpath={ screenPath }\n\t\t\t\t\taria-label={ __( 'Color palettes' ) }\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tdirection={\n\t\t\t\t\t\t\tcolors.length === 0 ? 'row-reverse' : 'row'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t\t\t\t\t{ colors\n\t\t\t\t\t\t\t\t.slice( 0, 5 )\n\t\t\t\t\t\t\t\t.map( ( { color }, index ) => (\n\t\t\t\t\t\t\t\t\t<ColorIndicatorWrapper\n\t\t\t\t\t\t\t\t\t\tkey={ `${ color }-${ index }` }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<ColorIndicator colorValue={ color } />\n\t\t\t\t\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</ZStack>\n\t\t\t\t\t\t<FlexItem>{ paletteButtonText }</FlexItem>\n\t\t\t\t\t</HStack>\n\t\t\t\t</NavigationButtonAsItem>\n\t\t\t</ItemGroup>\n\t\t\t{ randomizeThemeColors && (\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\ticon={ shuffle }\n\t\t\t\t\tonClick={ randomizeThemeColors }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Randomize colors' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport default Palette;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/palette.js"],"names":["__experimentalItemGroup","ItemGroup","FlexItem","__experimentalHStack","HStack","__experimentalZStack","ZStack","__experimentalVStack","VStack","ColorIndicator","Button","__","_n","sprintf","shuffle","useMemo","experiments","blockEditorExperiments","Subtitle","NavigationButtonAsItem","useColorRandomizer","ColorIndicatorWrapper","unlock","useGlobalSetting","EMPTY_COLORS","Palette","name","customColors","themeColors","defaultColors","defaultPaletteEnabled","randomizeThemeColors","colors","screenPath","encodeURIComponent","paletteButtonText","length","slice","map","index","color"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,QAFD,EAGCC,oBAAoB,IAAIC,MAHzB,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,oBAAoB,IAAIC,MALzB,EAMCC,cAND,EAOCC,MAPD,QAQO,uBARP;AASA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,SAASC,sBAAT,QAAuC,qBAAvC;AACA,SAASC,kBAAT,QAAmC,SAAnC;AACA,OAAOC,qBAAP,MAAkC,2BAAlC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAuBD,MAAM,CAAEL,sBAAF,CAAnC;AAEA,MAAMO,YAAY,GAAG,EAArB;;AAEA,SAASC,OAAT,OAA6B;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AAC5B,QAAM,CAAEC,YAAF,IAAmBJ,gBAAgB,CAAE,sBAAF,CAAzC;AACA,QAAM,CAAEK,WAAF,IAAkBL,gBAAgB,CAAE,qBAAF,CAAxC;AACA,QAAM,CAAEM,aAAF,IAAoBN,gBAAgB,CAAE,uBAAF,CAA1C;AAEA,QAAM,CAAEO,qBAAF,IAA4BP,gBAAgB,CACjD,sBADiD,E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AAA;AAAF,KAAF;AAAA,WACL,cAAC,qBAAD;AACC,MAAA,GAAG,EAAI,GAAGA,KAAO,IAAID,KAAO;AAD7B,OAGC,cAAC,cAAD;AAAgB,MAAA,UAAU,EAAGC;AAA7B,MAHD,CADK;AAAA,GAFL,CADH,CALD,EAgBC,cAAC,QAAD,QAAYL,iBAAZ,CAhBD,CAJD,CADD,CAFD,EA2BGJ,oBAAoB,IACrB,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,WADT;AAEC,IAAA,IAAI,EAAGjB,OAFR;AAGC,IAAA,OAAO,EAAGiB;AAHX,KAKGpB,EAAE,CAAE,kBAAF,CALL,CA5BF,CADD;AAuCA;;AAED,eAAec,OAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tFlexItem,\n\t__experimentalHStack as HStack,\n\t__experimentalZStack as ZStack,\n\t__experimentalVStack as VStack,\n\tColorIndicator,\n\tButton,\n} from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { shuffle } from '@wordpress/icons';\nimport { useMemo } from '@wordpress/element';\nimport { experiments as blockEditorExperiments } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport Subtitle from './subtitle';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { useColorRandomizer } from './hooks';\nimport ColorIndicatorWrapper from './color-indicator-wrapper';\nimport { unlock } from '../../experiments';\n\nconst { useGlobalSetting } = unlock( blockEditorExperiments );\n\nconst EMPTY_COLORS = [];\n\nfunction Palette( { name } ) {\n\tconst [ customColors ] = useGlobalSetting( 'color.palette.custom' );\n\tconst [ themeColors ] = useGlobalSetting( 'color.palette.theme' );\n\tconst [ defaultColors ] = useGlobalSetting( 'color.palette.default' );\n\n\tconst [ defaultPaletteEnabled ] = useGlobalSetting(\n\t\t'color.defaultPalette',\n\t\tname\n\t);\n\n\tconst [ randomizeThemeColors ] = useColorRandomizer();\n\n\tconst colors = useMemo(\n\t\t() => [\n\t\t\t...( customColors || EMPTY_COLORS ),\n\t\t\t...( themeColors || EMPTY_COLORS ),\n\t\t\t...( defaultColors && defaultPaletteEnabled\n\t\t\t\t? defaultColors\n\t\t\t\t: EMPTY_COLORS ),\n\t\t],\n\t\t[ customColors, themeColors, defaultColors, defaultPaletteEnabled ]\n\t);\n\n\tconst screenPath = ! name\n\t\t? '/colors/palette'\n\t\t: '/blocks/' + encodeURIComponent( name ) + '/colors/palette';\n\tconst paletteButtonText =\n\t\tcolors.length > 0\n\t\t\t? sprintf(\n\t\t\t\t\t// Translators: %d: Number of palette colors.\n\t\t\t\t\t_n( '%d color', '%d colors', colors.length ),\n\t\t\t\t\tcolors.length\n\t\t\t )\n\t\t\t: __( 'Add custom colors' );\n\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t<Subtitle>{ __( 'Palette' ) }</Subtitle>\n\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\tpath={ screenPath }\n\t\t\t\t\taria-label={ __( 'Color palettes' ) }\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tdirection={\n\t\t\t\t\t\t\tcolors.length === 0 ? 'row-reverse' : 'row'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t\t\t\t\t{ colors\n\t\t\t\t\t\t\t\t.slice( 0, 5 )\n\t\t\t\t\t\t\t\t.map( ( { color }, index ) => (\n\t\t\t\t\t\t\t\t\t<ColorIndicatorWrapper\n\t\t\t\t\t\t\t\t\t\tkey={ `${ color }-${ index }` }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<ColorIndicator colorValue={ color } />\n\t\t\t\t\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</ZStack>\n\t\t\t\t\t\t<FlexItem>{ paletteButtonText }</FlexItem>\n\t\t\t\t\t</HStack>\n\t\t\t\t</NavigationButtonAsItem>\n\t\t\t</ItemGroup>\n\t\t\t{ randomizeThemeColors && (\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\ticon={ shuffle }\n\t\t\t\t\tonClick={ randomizeThemeColors }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Randomize colors' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport default Palette;\n"]}
@@ -3,7 +3,7 @@ import { createElement } from "@wordpress/element";
3
3
  /**
4
4
  * WordPress dependencies
5
5
  */
6
- import { __unstableIframe as Iframe, __unstableEditorStyles as EditorStyles } from '@wordpress/block-editor';
6
+ import { __unstableIframe as Iframe, __unstableEditorStyles as EditorStyles, experiments as blockEditorExperiments } from '@wordpress/block-editor';
7
7
  import { __unstableMotion as motion, __experimentalHStack as HStack, __experimentalVStack as VStack } from '@wordpress/components';
8
8
  import { useReducedMotion, useResizeObserver } from '@wordpress/compose';
9
9
  import { useState, useMemo } from '@wordpress/element';
@@ -11,8 +11,12 @@ import { useState, useMemo } from '@wordpress/element';
11
11
  * Internal dependencies
12
12
  */
13
13
 
14
- import { useSetting, useStyle } from './hooks';
15
- import { useGlobalStylesOutput } from './use-global-styles-output';
14
+ import { unlock } from '../../experiments';
15
+ const {
16
+ useGlobalSetting,
17
+ useGlobalStyle,
18
+ useGlobalStylesOutput
19
+ } = unlock(blockEditorExperiments);
16
20
  const firstFrame = {
17
21
  start: {
18
22
  scale: 1,
@@ -51,19 +55,19 @@ const StylesPreview = _ref => {
51
55
  isFocused,
52
56
  withHoverView
53
57
  } = _ref;
54
- const [fontWeight] = useStyle('typography.fontWeight');
55
- const [fontFamily = 'serif'] = useStyle('typography.fontFamily');
56
- const [headingFontFamily = fontFamily] = useStyle('elements.h1.typography.fontFamily');
57
- const [headingFontWeight = fontWeight] = useStyle('elements.h1.typography.fontWeight');
58
- const [textColor = 'black'] = useStyle('color.text');
59
- const [headingColor = textColor] = useStyle('elements.h1.color.text');
60
- const [backgroundColor = 'white'] = useStyle('color.background');
61
- const [gradientValue] = useStyle('color.gradient');
58
+ const [fontWeight] = useGlobalStyle('typography.fontWeight');
59
+ const [fontFamily = 'serif'] = useGlobalStyle('typography.fontFamily');
60
+ const [headingFontFamily = fontFamily] = useGlobalStyle('elements.h1.typography.fontFamily');
61
+ const [headingFontWeight = fontWeight] = useGlobalStyle('elements.h1.typography.fontWeight');
62
+ const [textColor = 'black'] = useGlobalStyle('color.text');
63
+ const [headingColor = textColor] = useGlobalStyle('elements.h1.color.text');
64
+ const [backgroundColor = 'white'] = useGlobalStyle('color.background');
65
+ const [gradientValue] = useGlobalStyle('color.gradient');
62
66
  const [styles] = useGlobalStylesOutput();
63
67
  const disableMotion = useReducedMotion();
64
- const [coreColors] = useSetting('color.palette.core');
65
- const [themeColors] = useSetting('color.palette.theme');
66
- const [customColors] = useSetting('color.palette.custom');
68
+ const [coreColors] = useGlobalSetting('color.palette.core');
69
+ const [themeColors] = useGlobalSetting('color.palette.theme');
70
+ const [customColors] = useGlobalSetting('color.palette.custom');
67
71
  const [isHovered, setIsHovered] = useState(false);
68
72
  const [containerResizeListener, {
69
73
  width
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/preview.js"],"names":["__unstableIframe","Iframe","__unstableEditorStyles","EditorStyles","__unstableMotion","motion","__experimentalHStack","HStack","__experimentalVStack","VStack","useReducedMotion","useResizeObserver","useState","useMemo","useSetting","useStyle","useGlobalStylesOutput","firstFrame","start","scale","opacity","hover","midFrame","secondFrame","normalizedWidth","normalizedHeight","normalizedColorSwatchSize","StylesPreview","label","isFocused","withHoverView","fontWeight","fontFamily","headingFontFamily","headingFontWeight","textColor","headingColor","backgroundColor","gradientValue","styles","disableMotion","coreColors","themeColors","customColors","isHovered","setIsHovered","containerResizeListener","width","ratio","paletteColors","concat","highlightedColors","filter","color","slice","editorStyles","css","isGlobalStyles","height","visibility","background","cursor","overflow","fontSize","delay","type","map","index","slug","borderRadius","position","top","flexGrow","padding","boxSizing","lineHeight","textAlign"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,gBAAgB,IAAIC,MADrB,EAECC,sBAAsB,IAAIC,YAF3B,QAGO,yBAHP;AAIA,SACCC,gBAAgB,IAAIC,MADrB,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,oBAAoB,IAAIC,MAHzB,QAIO,uBAJP;AAKA,SAASC,gBAAT,EAA2BC,iBAA3B,QAAoD,oBAApD;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AAEA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,QAArB,QAAqC,SAArC;AACA,SAASC,qBAAT,QAAsC,4BAAtC;AAEA,MAAMC,UAAU,GAAG;AAClBC,EAAAA,KAAK,EAAE;AACNC,IAAAA,KAAK,EAAE,CADD;AAENC,IAAAA,OAAO,EAAE;AAFH,GADW;AAKlBC,EAAAA,KAAK,EAAE;AACNF,IAAAA,KAAK,EAAE,CADD;AAENC,IAAAA,OAAO,EAAE;AAFH;AALW,CAAnB;AAWA,MAAME,QAAQ,GAAG;AAChBD,EAAAA,KAAK,EAAE;AACND,IAAAA,OAAO,EAAE;AADH,GADS;AAIhBF,EAAAA,KAAK,EAAE;AACNE,IAAAA,OAAO,EAAE;AADH;AAJS,CAAjB;AASA,MAAMG,WAAW,GAAG;AACnBF,EAAAA,KAAK,EAAE;AACNF,IAAAA,KAAK,EAAE,CADD;AAENC,IAAAA,OAAO,EAAE;AAFH,GADY;AAKnBF,EAAAA,KAAK,EAAE;AACNC,IAAAA,KAAK,EAAE,CADD;AAENC,IAAAA,OAAO,EAAE;AAFH;AALY,CAApB;AAWA,MAAMI,eAAe,GAAG,GAAxB;AACA,MAAMC,gBAAgB,GAAG,GAAzB;AAEA,MAAMC,yBAAyB,GAAG,EAAlC;;AAEA,MAAMC,aAAa,GAAG,QAA2C;AAAA,MAAzC;AAAEC,IAAAA,KAAF;AA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AA,WACL;AACC,MAAA,GAAG,EAAGc,KADP;AAEC,MAAA,KAAK,EAAG;AACPT,QAAAA,MAAM,EAAE,MADD;AAEPE,QAAAA,UAAU,EAAEP,KAFL;AAGPmB,QAAAA,QAAQ,EAAE;AAHH;AAFT,MADK;AAAA,GAFL,CARH,CAZD,CAvED,EAyGC,cAAC,MAAD,CAAQ,GAAR;AACC,IAAA,QAAQ,EAAGjD,WADZ;AAEC,IAAA,KAAK,EAAG;AACPmC,MAAAA,MAAM,EAAE,MADD;AAEPX,MAAAA,KAAK,EAAE,MAFA;AAGPe,MAAAA,QAAQ,EAAE,QAHH;AAIPQ,MAAAA,QAAQ,EAAE,UAJH;AAKPC,MAAAA,GAAG,EAAE;AALE;AAFT,KAUC,cAAC,MAAD;AACC,IAAA,OAAO,EAAG,IAAIvB,KADf;AAEC,IAAA,OAAO,EAAC,QAFT;AAGC,IAAA,KAAK,EAAG;AACPU,MAAAA,MAAM,EAAE,MADD;AAEPI,MAAAA,QAAQ,EAAE,QAFH;AAGPW,MAAAA,OAAO,EAAE,KAAKzB,KAHP;AAIP0B,MAAAA,SAAS,EAAE;AAJJ;AAHT,KAUG9C,KAAK,IACN;AACC,IAAA,KAAK,EAAG;AACPmC,MAAAA,QAAQ,EAAE,KAAKf,KADR;AAEPhB,MAAAA,UAAU,EAAEC,iBAFL;AAGPoB,MAAAA,KAAK,EAAEjB,YAHA;AAIPL,MAAAA,UAAU,EAAEG,iBAJL;AAKPyC,MAAAA,UAAU,EAAE,KALL;AAMPC,MAAAA,SAAS,EAAE;AANJ;AADT,KAUGhD,KAVH,CAXF,CAVD,CAzGD,CAZD,CADD;AA6JA,CA5MD;;AA8MA,eAAeD,aAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__unstableIframe as Iframe,\n\t__unstableEditorStyles as EditorStyles,\n} from '@wordpress/block-editor';\nimport {\n\t__unstableMotion as motion,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useReducedMotion, useResizeObserver } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSetting, useStyle } from './hooks';\nimport { useGlobalStylesOutput } from './use-global-styles-output';\n\nconst firstFrame = {\n\tstart: {\n\t\tscale: 1,\n\t\topacity: 1,\n\t},\n\thover: {\n\t\tscale: 0,\n\t\topacity: 0,\n\t},\n};\n\nconst midFrame = {\n\thover: {\n\t\topacity: 1,\n\t},\n\tstart: {\n\t\topacity: 0.5,\n\t},\n};\n\nconst secondFrame = {\n\thover: {\n\t\tscale: 1,\n\t\topacity: 1,\n\t},\n\tstart: {\n\t\tscale: 0,\n\t\topacity: 0,\n\t},\n};\n\nconst normalizedWidth = 248;\nconst normalizedHeight = 152;\n\nconst normalizedColorSwatchSize = 32;\n\nconst StylesPreview = ( { label, isFocused, withHoverView } ) => {\n\tconst [ fontWeight ] = useStyle( 'typography.fontWeight' );\n\tconst [ fontFamily = 'serif' ] = useStyle( 'typography.fontFamily' );\n\tconst [ headingFontFamily = fontFamily ] = useStyle(\n\t\t'elements.h1.typography.fontFamily'\n\t);\n\tconst [ headingFontWeight = fontWeight ] = useStyle(\n\t\t'elements.h1.typography.fontWeight'\n\t);\n\tconst [ textColor = 'black' ] = useStyle( 'color.text' );\n\tconst [ headingColor = textColor ] = useStyle( 'elements.h1.color.text' );\n\tconst [ backgroundColor = 'white' ] = useStyle( 'color.background' );\n\tconst [ gradientValue ] = useStyle( 'color.gradient' );\n\tconst [ styles ] = useGlobalStylesOutput();\n\tconst disableMotion = useReducedMotion();\n\tconst [ coreColors ] = useSetting( 'color.palette.core' );\n\tconst [ themeColors ] = useSetting( 'color.palette.theme' );\n\tconst [ customColors ] = useSetting( 'color.palette.custom' );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ containerResizeListener, { width } ] = useResizeObserver();\n\tconst ratio = width ? width / normalizedWidth : 1;\n\n\tconst paletteColors = ( themeColors ?? [] )\n\t\t.concat( customColors ?? [] )\n\t\t.concat( coreColors ?? [] );\n\tconst highlightedColors = paletteColors\n\t\t.filter(\n\t\t\t// we exclude these two colors because they are already visible in the preview.\n\t\t\t( { color } ) => color !== backgroundColor && color !== headingColor\n\t\t)\n\t\t.slice( 0, 2 );\n\n\t// Reset leaked styles from WP common.css and remove main content layout padding and border.\n\tconst editorStyles = useMemo( () => {\n\t\tif ( styles ) {\n\t\t\treturn [\n\t\t\t\t...styles,\n\t\t\t\t{\n\t\t\t\t\tcss: 'html{overflow:hidden}body{min-width: 0;padding: 0;border: none;}',\n\t\t\t\t\tisGlobalStyles: true,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\treturn styles;\n\t}, [ styles ] );\n\n\treturn (\n\t\t<Iframe\n\t\t\tclassName=\"edit-site-global-styles-preview__iframe\"\n\t\t\thead={ <EditorStyles styles={ editorStyles } /> }\n\t\t\tstyle={ {\n\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\tvisibility: ! width ? 'hidden' : 'visible',\n\t\t\t} }\n\t\t\tonMouseEnter={ () => setIsHovered( true ) }\n\t\t\tonMouseLeave={ () => setIsHovered( false ) }\n\t\t\ttabIndex={ -1 }\n\t\t>\n\t\t\t{ containerResizeListener }\n\t\t\t<motion.div\n\t\t\t\tstyle={ {\n\t\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t} }\n\t\t\t\tinitial=\"start\"\n\t\t\t\tanimate={\n\t\t\t\t\t( isHovered || isFocused ) && ! disableMotion && label\n\t\t\t\t\t\t? 'hover'\n\t\t\t\t\t\t: 'start'\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ firstFrame }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tspacing={ 10 * ratio }\n\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tfontFamily: headingFontFamily,\n\t\t\t\t\t\t\t\tfontSize: 65 * ratio,\n\t\t\t\t\t\t\t\tcolor: headingColor,\n\t\t\t\t\t\t\t\tfontWeight: headingFontWeight,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tanimate={ { scale: 1, opacity: 1 } }\n\t\t\t\t\t\t\tinitial={ { scale: 0.1, opacity: 0 } }\n\t\t\t\t\t\t\ttransition={ { delay: 0.3, type: 'tween' } }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tAa\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t<VStack spacing={ 4 * ratio }>\n\t\t\t\t\t\t\t{ highlightedColors.map(\n\t\t\t\t\t\t\t\t( { slug, color }, index ) => (\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\theight:\n\t\t\t\t\t\t\t\t\t\t\t\tnormalizedColorSwatchSize *\n\t\t\t\t\t\t\t\t\t\t\t\tratio,\n\t\t\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t\t\tnormalizedColorSwatchSize *\n\t\t\t\t\t\t\t\t\t\t\t\tratio,\n\t\t\t\t\t\t\t\t\t\t\tbackground: color,\n\t\t\t\t\t\t\t\t\t\t\tborderRadius:\n\t\t\t\t\t\t\t\t\t\t\t\t( normalizedColorSwatchSize *\n\t\t\t\t\t\t\t\t\t\t\t\t\tratio ) /\n\t\t\t\t\t\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tanimate={ { scale: 1, opacity: 1 } }\n\t\t\t\t\t\t\t\t\t\tinitial={ { scale: 0.1, opacity: 0 } }\n\t\t\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\t\t\tdelay: index === 1 ? 0.2 : 0.1,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</HStack>\n\t\t\t\t</motion.div>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ withHoverView && midFrame }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\tfilter: 'blur(60px)',\n\t\t\t\t\t\topacity: 0.1,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ paletteColors\n\t\t\t\t\t\t\t.slice( 0, 4 )\n\t\t\t\t\t\t\t.map( ( { color }, index ) => (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\t\tbackground: color,\n\t\t\t\t\t\t\t\t\t\tflexGrow: 1,\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t</HStack>\n\t\t\t\t</motion.div>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ secondFrame }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<VStack\n\t\t\t\t\t\tspacing={ 3 * ratio }\n\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tpadding: 10 * ratio,\n\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tfontSize: 40 * ratio,\n\t\t\t\t\t\t\t\t\tfontFamily: headingFontFamily,\n\t\t\t\t\t\t\t\t\tcolor: headingColor,\n\t\t\t\t\t\t\t\t\tfontWeight: headingFontWeight,\n\t\t\t\t\t\t\t\t\tlineHeight: '1em',\n\t\t\t\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VStack>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t</Iframe>\n\t);\n};\n\nexport default StylesPreview;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/preview.js"],"names":["__unstableIframe","Iframe","__unstableEditorStyles","EditorStyles","experiments","blockEditorExperiments","__unstableMotion","motion","__experimentalHStack","HStack","__experimentalVStack","VStack","useReducedMotion","useResizeObserver","useState","useMemo","unlock","useGlobalSetting","useGlobalStyle","useGlobalStylesOutput","firstFrame","start","scale","opacity","hover","midFrame","secondFrame","normalizedWidth","normalizedHeight","normalizedColorSwatchSize","StylesPreview","label","isFocused","withHoverView","fontWeight","fontFamily","headingFontFamily","headingFontWeight","textColor","headingColor","backgroundColor","gradientValue","styles","disableMotion","coreColors","themeColors","customColors","isHovered","setIsHovered","containerResizeListener","width","ratio","paletteColors","concat","highlightedColors","filter","color","slice","editorStyles","css","isGlobalStyles","height","visibility","background","cursor","overflow","fontSize","delay","type","map","index","slug","borderRadius","position","top","flexGrow","padding","boxSizing","lineHeight","textAlign"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,gBAAgB,IAAIC,MADrB,EAECC,sBAAsB,IAAIC,YAF3B,EAGCC,WAAW,IAAIC,sBAHhB,QAIO,yBAJP;AAKA,SACCC,gBAAgB,IAAIC,MADrB,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,oBAAoB,IAAIC,MAHzB,QAIO,uBAJP;AAKA,SAASC,gBAAT,EAA2BC,iBAA3B,QAAoD,oBAApD;AACA,SAASC,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA,gBAAF;AAAoBC,EAAAA,cAApB;AAAoCC,EAAAA;AAApC,IAA8DH,MAAM,CACzEX,sBADyE,CAA1E;AAIA,MAAMe,UAAU,GAAG;AAClBC,EAAAA,KAAK,EAAE;AACNC,IAAAA,KAAK,EAAE,CADD;AAENC,IAAAA,OAAO,EAAE;AAFH,GADW;AAKlBC,EAAAA,KAAK,EAAE;AACNF,IAAAA,KAAK,EAAE,CADD;AAENC,IAAAA,OAAO,EAAE;AAFH;AALW,CAAnB;AAWA,MAAME,QAAQ,GAAG;AAChBD,EAAAA,KAAK,EAAE;AACND,IAAAA,OAAO,EAAE;AADH,GADS;AAIhBF,EAAAA,KAAK,EAAE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AAAA,UAAU,EAAEC,iBAFL;AAGPoB,MAAAA,KAAK,EAAEjB,YAHA;AAIPL,MAAAA,UAAU,EAAEG,iBAJL;AAKPyC,MAAAA,UAAU,EAAE,KALL;AAMPC,MAAAA,SAAS,EAAE;AANJ;AADT,KAUGhD,KAVH,CAXF,CAVD,CAzGD,CAZD,CADD;AA6JA,CA9MD;;AAgNA,eAAeD,aAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__unstableIframe as Iframe,\n\t__unstableEditorStyles as EditorStyles,\n\texperiments as blockEditorExperiments,\n} from '@wordpress/block-editor';\nimport {\n\t__unstableMotion as motion,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useReducedMotion, useResizeObserver } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../experiments';\n\nconst { useGlobalSetting, useGlobalStyle, useGlobalStylesOutput } = unlock(\n\tblockEditorExperiments\n);\n\nconst firstFrame = {\n\tstart: {\n\t\tscale: 1,\n\t\topacity: 1,\n\t},\n\thover: {\n\t\tscale: 0,\n\t\topacity: 0,\n\t},\n};\n\nconst midFrame = {\n\thover: {\n\t\topacity: 1,\n\t},\n\tstart: {\n\t\topacity: 0.5,\n\t},\n};\n\nconst secondFrame = {\n\thover: {\n\t\tscale: 1,\n\t\topacity: 1,\n\t},\n\tstart: {\n\t\tscale: 0,\n\t\topacity: 0,\n\t},\n};\n\nconst normalizedWidth = 248;\nconst normalizedHeight = 152;\n\nconst normalizedColorSwatchSize = 32;\n\nconst StylesPreview = ( { label, isFocused, withHoverView } ) => {\n\tconst [ fontWeight ] = useGlobalStyle( 'typography.fontWeight' );\n\tconst [ fontFamily = 'serif' ] = useGlobalStyle( 'typography.fontFamily' );\n\tconst [ headingFontFamily = fontFamily ] = useGlobalStyle(\n\t\t'elements.h1.typography.fontFamily'\n\t);\n\tconst [ headingFontWeight = fontWeight ] = useGlobalStyle(\n\t\t'elements.h1.typography.fontWeight'\n\t);\n\tconst [ textColor = 'black' ] = useGlobalStyle( 'color.text' );\n\tconst [ headingColor = textColor ] = useGlobalStyle(\n\t\t'elements.h1.color.text'\n\t);\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst [ gradientValue ] = useGlobalStyle( 'color.gradient' );\n\tconst [ styles ] = useGlobalStylesOutput();\n\tconst disableMotion = useReducedMotion();\n\tconst [ coreColors ] = useGlobalSetting( 'color.palette.core' );\n\tconst [ themeColors ] = useGlobalSetting( 'color.palette.theme' );\n\tconst [ customColors ] = useGlobalSetting( 'color.palette.custom' );\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ containerResizeListener, { width } ] = useResizeObserver();\n\tconst ratio = width ? width / normalizedWidth : 1;\n\n\tconst paletteColors = ( themeColors ?? [] )\n\t\t.concat( customColors ?? [] )\n\t\t.concat( coreColors ?? [] );\n\tconst highlightedColors = paletteColors\n\t\t.filter(\n\t\t\t// we exclude these two colors because they are already visible in the preview.\n\t\t\t( { color } ) => color !== backgroundColor && color !== headingColor\n\t\t)\n\t\t.slice( 0, 2 );\n\n\t// Reset leaked styles from WP common.css and remove main content layout padding and border.\n\tconst editorStyles = useMemo( () => {\n\t\tif ( styles ) {\n\t\t\treturn [\n\t\t\t\t...styles,\n\t\t\t\t{\n\t\t\t\t\tcss: 'html{overflow:hidden}body{min-width: 0;padding: 0;border: none;}',\n\t\t\t\t\tisGlobalStyles: true,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\treturn styles;\n\t}, [ styles ] );\n\n\treturn (\n\t\t<Iframe\n\t\t\tclassName=\"edit-site-global-styles-preview__iframe\"\n\t\t\thead={ <EditorStyles styles={ editorStyles } /> }\n\t\t\tstyle={ {\n\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\tvisibility: ! width ? 'hidden' : 'visible',\n\t\t\t} }\n\t\t\tonMouseEnter={ () => setIsHovered( true ) }\n\t\t\tonMouseLeave={ () => setIsHovered( false ) }\n\t\t\ttabIndex={ -1 }\n\t\t>\n\t\t\t{ containerResizeListener }\n\t\t\t<motion.div\n\t\t\t\tstyle={ {\n\t\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t} }\n\t\t\t\tinitial=\"start\"\n\t\t\t\tanimate={\n\t\t\t\t\t( isHovered || isFocused ) && ! disableMotion && label\n\t\t\t\t\t\t? 'hover'\n\t\t\t\t\t\t: 'start'\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ firstFrame }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tspacing={ 10 * ratio }\n\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tfontFamily: headingFontFamily,\n\t\t\t\t\t\t\t\tfontSize: 65 * ratio,\n\t\t\t\t\t\t\t\tcolor: headingColor,\n\t\t\t\t\t\t\t\tfontWeight: headingFontWeight,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tanimate={ { scale: 1, opacity: 1 } }\n\t\t\t\t\t\t\tinitial={ { scale: 0.1, opacity: 0 } }\n\t\t\t\t\t\t\ttransition={ { delay: 0.3, type: 'tween' } }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tAa\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t<VStack spacing={ 4 * ratio }>\n\t\t\t\t\t\t\t{ highlightedColors.map(\n\t\t\t\t\t\t\t\t( { slug, color }, index ) => (\n\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\theight:\n\t\t\t\t\t\t\t\t\t\t\t\tnormalizedColorSwatchSize *\n\t\t\t\t\t\t\t\t\t\t\t\tratio,\n\t\t\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t\t\tnormalizedColorSwatchSize *\n\t\t\t\t\t\t\t\t\t\t\t\tratio,\n\t\t\t\t\t\t\t\t\t\t\tbackground: color,\n\t\t\t\t\t\t\t\t\t\t\tborderRadius:\n\t\t\t\t\t\t\t\t\t\t\t\t( normalizedColorSwatchSize *\n\t\t\t\t\t\t\t\t\t\t\t\t\tratio ) /\n\t\t\t\t\t\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tanimate={ { scale: 1, opacity: 1 } }\n\t\t\t\t\t\t\t\t\t\tinitial={ { scale: 0.1, opacity: 0 } }\n\t\t\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\t\t\tdelay: index === 1 ? 0.2 : 0.1,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</HStack>\n\t\t\t\t</motion.div>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ withHoverView && midFrame }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\tfilter: 'blur(60px)',\n\t\t\t\t\t\topacity: 0.1,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ paletteColors\n\t\t\t\t\t\t\t.slice( 0, 4 )\n\t\t\t\t\t\t\t.map( ( { color }, index ) => (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\t\tbackground: color,\n\t\t\t\t\t\t\t\t\t\tflexGrow: 1,\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t</HStack>\n\t\t\t\t</motion.div>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ secondFrame }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<VStack\n\t\t\t\t\t\tspacing={ 3 * ratio }\n\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tpadding: 10 * ratio,\n\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tfontSize: 40 * ratio,\n\t\t\t\t\t\t\t\t\tfontFamily: headingFontFamily,\n\t\t\t\t\t\t\t\t\tcolor: headingColor,\n\t\t\t\t\t\t\t\t\tfontWeight: headingFontWeight,\n\t\t\t\t\t\t\t\t\tlineHeight: '1em',\n\t\t\t\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VStack>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t</Iframe>\n\t);\n};\n\nexport default StylesPreview;\n"]}
@@ -1,37 +1,46 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { createElement, Fragment } from "@wordpress/element";
3
3
 
4
+ /**
5
+ * External dependencies
6
+ */
7
+ import classnames from 'classnames';
4
8
  /**
5
9
  * WordPress dependencies
6
10
  */
11
+
7
12
  import { __ } from '@wordpress/i18n';
8
- import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
13
+ import { __experimentalColorGradientControl as ColorGradientControl, experiments as blockEditorExperiments } from '@wordpress/block-editor';
9
14
  /**
10
15
  * Internal dependencies
11
16
  */
12
17
 
13
18
  import ScreenHeader from './header';
14
- import { getSupportedGlobalStylesPanels, useColorsPerOrigin, useGradientsPerOrigin, useSetting, useStyle } from './hooks';
19
+ import { getSupportedGlobalStylesPanels, useColorsPerOrigin, useGradientsPerOrigin } from './hooks';
20
+ import { unlock } from '../../experiments';
21
+ const {
22
+ useGlobalSetting,
23
+ useGlobalStyle
24
+ } = unlock(blockEditorExperiments);
15
25
 
16
26
  function ScreenBackgroundColor(_ref) {
17
27
  let {
18
28
  name,
19
- variationPath = ''
29
+ variation = ''
20
30
  } = _ref;
31
+ const prefix = variation ? `variations.${variation}.` : '';
21
32
  const supports = getSupportedGlobalStylesPanels(name);
22
- const [solids] = useSetting('color.palette', name);
23
- const [gradients] = useSetting('color.gradients', name);
24
- const [areCustomSolidsEnabled] = useSetting('color.custom', name);
25
- const [areCustomGradientsEnabled] = useSetting('color.customGradient', name);
33
+ const [areCustomSolidsEnabled] = useGlobalSetting('color.custom', name);
34
+ const [areCustomGradientsEnabled] = useGlobalSetting('color.customGradient', name);
26
35
  const colorsPerOrigin = useColorsPerOrigin(name);
27
36
  const gradientsPerOrigin = useGradientsPerOrigin(name);
28
- const [isBackgroundEnabled] = useSetting('color.background', name);
29
- const hasBackgroundColor = supports.includes('backgroundColor') && isBackgroundEnabled && (solids.length > 0 || areCustomSolidsEnabled);
30
- const hasGradientColor = supports.includes('background') && (gradients.length > 0 || areCustomGradientsEnabled);
31
- const [backgroundColor, setBackgroundColor] = useStyle(variationPath + 'color.background', name);
32
- const [userBackgroundColor] = useStyle(variationPath + 'color.background', name, 'user');
33
- const [gradient, setGradient] = useStyle(variationPath + 'color.gradient', name);
34
- const [userGradient] = useStyle(variationPath + 'color.gradient', name, 'user');
37
+ const [isBackgroundEnabled] = useGlobalSetting('color.background', name);
38
+ const hasBackgroundColor = supports.includes('backgroundColor') && isBackgroundEnabled && (colorsPerOrigin.length > 0 || areCustomSolidsEnabled);
39
+ const hasGradientColor = supports.includes('background') && (gradientsPerOrigin.length > 0 || areCustomGradientsEnabled);
40
+ const [backgroundColor, setBackgroundColor] = useGlobalStyle(prefix + 'color.background', name);
41
+ const [userBackgroundColor] = useGlobalStyle(prefix + 'color.background', name, 'user');
42
+ const [gradient, setGradient] = useGlobalStyle(prefix + 'color.gradient', name);
43
+ const [userGradient] = useGlobalStyle(prefix + 'color.gradient', name, 'user');
35
44
 
36
45
  if (!hasBackgroundColor && !hasGradientColor) {
37
46
  return null;
@@ -70,7 +79,9 @@ function ScreenBackgroundColor(_ref) {
70
79
  title: __('Background'),
71
80
  description: __('Set a background color or gradient for the whole site.')
72
81
  }), createElement(ColorGradientControl, _extends({
73
- className: "edit-site-screen-background-color__control",
82
+ className: classnames('edit-site-screen-background-color__control', {
83
+ 'has-no-tabs': !hasBackgroundColor || !hasGradientColor
84
+ }),
74
85
  colors: colorsPerOrigin,
75
86
  gradients: gradientsPerOrigin,
76
87
  disableCustomColors: !areCustomSolidsEnabled,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-background-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","ScreenHeader","getSupportedGlobalStylesPanels","useColorsPerOrigin","useGradientsPerOrigin","useSetting","useStyle","ScreenBackgroundColor","name","variationPath","supports","solids","gradients","areCustomSolidsEnabled","areCustomGradientsEnabled","colorsPerOrigin","gradientsPerOrigin","isBackgroundEnabled","hasBackgroundColor","includes","length","hasGradientColor","backgroundColor","setBackgroundColor","userBackgroundColor","gradient","setGradient","userGradient","backgroundSettings","colorValue","onColorChange","clearable","gradientSettings","gradientValue","onGradientChange","controlProps"],"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,EAECC,kBAFD,EAGCC,qBAHD,EAICC,UAJD,EAKCC,QALD,QAMO,SANP;;AAQA,SAASC,qBAAT,OAA+D;AAAA,MAA/B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,aAAa,GAAG;AAAxB,GAA+B;AAC9D,QAAMC,QAAQ,GAAGR,8BAA8B,CAAEM,IAAF,CAA/C;AACA,QAAM,CAAEG,MAAF,IAAaN,UAAU,CAAE,eAAF,EAAmBG,IAAnB,CAA7B;AACA,QAAM,CAAEI,SAAF,IAAgBP,UAAU,CAAE,iBAAF,EAAqBG,IAArB,CAAhC;AACA,QAAM,CAAEK,sBAAF,IAA6BR,UAAU,CAAE,cAAF,EAAkBG,IAAlB,CAA7C;AACA,QAAM,CAAEM,yBAAF,IAAgCT,UAAU,CAC/C,sBAD+C,EAE/CG,IAF+C,CAAhD;AAKA,QAAMO,eAAe,GAAGZ,kB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G,EAAvB;;AACA,MAAKX,gBAAL,EAAwB;AACvBW,IAAAA,gBAAgB,GAAG;AAClBC,MAAAA,aAAa,EAAER,QADG;AAElBS,MAAAA,gBAAgB,EAAER;AAFA,KAAnB;;AAIA,QAAKD,QAAL,EAAgB;AACfO,MAAAA,gBAAgB,CAACD,SAAjB,GAA6BN,QAAQ,KAAKE,YAA1C;AACA;AACD;;AAED,QAAMQ,YAAY,GAAG,EACpB,GAAGP,kBADiB;AAEpB,OAAGI;AAFiB,GAArB;AAKA,SACC,8BACC,cAAC,YAAD;AACC,IAAA,KAAK,EAAGlC,EAAE,CAAE,YAAF,CADX;AAEC,IAAA,WAAW,EAAGA,EAAE,CACf,wDADe;AAFjB,IADD,EAOC,cAAC,oBAAD;AACC,IAAA,SAAS,EAAC,4CADX;AAEC,IAAA,MAAM,EAAGiB,eAFV;AAGC,IAAA,SAAS,EAAGC,kBAHb;AAIC,IAAA,mBAAmB,EAAG,CAAEH,sBAJzB;AAKC,IAAA,sBAAsB,EAAG,CAAEC,yBAL5B;AAMC,IAAA,SAAS,EAAG,KANb;AAOC,IAAA,WAAW,MAPZ;AAQC,IAAA,iCAAiC;AARlC,KASMqB,YATN,EAPD,CADD;AAqBA;;AAED,eAAe5B,qBAAf","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\tuseColorsPerOrigin,\n\tuseGradientsPerOrigin,\n\tuseSetting,\n\tuseStyle,\n} from './hooks';\n\nfunction ScreenBackgroundColor( { name, variationPath = '' } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ gradients ] = useSetting( 'color.gradients', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\tconst [ areCustomGradientsEnabled ] = useSetting(\n\t\t'color.customGradient',\n\t\tname\n\t);\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\tconst gradientsPerOrigin = useGradientsPerOrigin( name );\n\n\tconst [ isBackgroundEnabled ] = useSetting( 'color.background', name );\n\n\tconst hasBackgroundColor =\n\t\tsupports.includes( 'backgroundColor' ) &&\n\t\tisBackgroundEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasGradientColor =\n\t\tsupports.includes( 'background' ) &&\n\t\t( gradients.length > 0 || areCustomGradientsEnabled );\n\tconst [ backgroundColor, setBackgroundColor ] = useStyle(\n\t\tvariationPath + 'color.background',\n\t\tname\n\t);\n\tconst [ userBackgroundColor ] = useStyle(\n\t\tvariationPath + 'color.background',\n\t\tname,\n\t\t'user'\n\t);\n\tconst [ gradient, setGradient ] = useStyle(\n\t\tvariationPath + 'color.gradient',\n\t\tname\n\t);\n\tconst [ userGradient ] = useStyle(\n\t\tvariationPath + 'color.gradient',\n\t\tname,\n\t\t'user'\n\t);\n\n\tif ( ! hasBackgroundColor && ! hasGradientColor ) {\n\t\treturn null;\n\t}\n\n\tlet backgroundSettings = {};\n\tif ( hasBackgroundColor ) {\n\t\tbackgroundSettings = {\n\t\t\tcolorValue: backgroundColor,\n\t\t\tonColorChange: setBackgroundColor,\n\t\t};\n\t\tif ( backgroundColor ) {\n\t\t\tbackgroundSettings.clearable =\n\t\t\t\tbackgroundColor === userBackgroundColor;\n\t\t}\n\t}\n\n\tlet gradientSettings = {};\n\tif ( hasGradientColor ) {\n\t\tgradientSettings = {\n\t\t\tgradientValue: gradient,\n\t\t\tonGradientChange: setGradient,\n\t\t};\n\t\tif ( gradient ) {\n\t\t\tgradientSettings.clearable = gradient === userGradient;\n\t\t}\n\t}\n\n\tconst controlProps = {\n\t\t...backgroundSettings,\n\t\t...gradientSettings,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Background' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set a background color or gradient for the whole site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-background-color__control\"\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tgradients={ gradientsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\tdisableCustomGradients={ ! areCustomGradientsEnabled }\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t{ ...controlProps }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenBackgroundColor;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-background-color.js"],"names":["classnames","__","__experimentalColorGradientControl","ColorGradientControl","experiments","blockEditorExperiments","ScreenHeader","getSupportedGlobalStylesPanels","useColorsPerOrigin","useGradientsPerOrigin","unlock","useGlobalSetting","useGlobalStyle","ScreenBackgroundColor","name","variation","prefix","supports","areCustomSolidsEnabled","areCustomGradientsEnabled","colorsPerOrigin","gradientsPerOrigin","isBackgroundEnabled","hasBackgroundColor","includes","length","hasGradientColor","backgroundColor","setBackgroundColor","userBackgroundColor","gradient","setGradient","userGradient","backgroundSettings","colorValue","onColorChange","clearable","gradientSettings","gradientValue","onGradientChange","controlProps"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,WAAW,IAAIC,sBAFhB,QAGO,yBAHP;AAKA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,kBAFD,EAGCC,qBAHD,QAIO,SAJP;AAKA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,MAAM;AAAEC,EAAAA,gBAAF;AAAoBC,EAAAA;AA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bZ;AAcC,IAAA,iCAAiC;AAdlC,KAeMqB,YAfN,EAPD,CADD;AA2BA;;AAED,eAAe3B,qBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\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 {\n\tgetSupportedGlobalStylesPanels,\n\tuseColorsPerOrigin,\n\tuseGradientsPerOrigin,\n} from './hooks';\nimport { unlock } from '../../experiments';\n\nconst { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );\n\nfunction ScreenBackgroundColor( { name, variation = '' } ) {\n\tconst prefix = variation ? `variations.${ variation }.` : '';\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );\n\tconst [ areCustomGradientsEnabled ] = useGlobalSetting(\n\t\t'color.customGradient',\n\t\tname\n\t);\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\tconst gradientsPerOrigin = useGradientsPerOrigin( name );\n\n\tconst [ isBackgroundEnabled ] = useGlobalSetting(\n\t\t'color.background',\n\t\tname\n\t);\n\n\tconst hasBackgroundColor =\n\t\tsupports.includes( 'backgroundColor' ) &&\n\t\tisBackgroundEnabled &&\n\t\t( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );\n\tconst hasGradientColor =\n\t\tsupports.includes( 'background' ) &&\n\t\t( gradientsPerOrigin.length > 0 || areCustomGradientsEnabled );\n\tconst [ backgroundColor, setBackgroundColor ] = useGlobalStyle(\n\t\tprefix + 'color.background',\n\t\tname\n\t);\n\tconst [ userBackgroundColor ] = useGlobalStyle(\n\t\tprefix + 'color.background',\n\t\tname,\n\t\t'user'\n\t);\n\tconst [ gradient, setGradient ] = useGlobalStyle(\n\t\tprefix + 'color.gradient',\n\t\tname\n\t);\n\tconst [ userGradient ] = useGlobalStyle(\n\t\tprefix + 'color.gradient',\n\t\tname,\n\t\t'user'\n\t);\n\n\tif ( ! hasBackgroundColor && ! hasGradientColor ) {\n\t\treturn null;\n\t}\n\n\tlet backgroundSettings = {};\n\tif ( hasBackgroundColor ) {\n\t\tbackgroundSettings = {\n\t\t\tcolorValue: backgroundColor,\n\t\t\tonColorChange: setBackgroundColor,\n\t\t};\n\t\tif ( backgroundColor ) {\n\t\t\tbackgroundSettings.clearable =\n\t\t\t\tbackgroundColor === userBackgroundColor;\n\t\t}\n\t}\n\n\tlet gradientSettings = {};\n\tif ( hasGradientColor ) {\n\t\tgradientSettings = {\n\t\t\tgradientValue: gradient,\n\t\t\tonGradientChange: setGradient,\n\t\t};\n\t\tif ( gradient ) {\n\t\t\tgradientSettings.clearable = gradient === userGradient;\n\t\t}\n\t}\n\n\tconst controlProps = {\n\t\t...backgroundSettings,\n\t\t...gradientSettings,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Background' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set a background color or gradient for the whole site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'edit-site-screen-background-color__control',\n\t\t\t\t\t{\n\t\t\t\t\t\t'has-no-tabs':\n\t\t\t\t\t\t\t! hasBackgroundColor || ! hasGradientColor,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tgradients={ gradientsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\tdisableCustomGradients={ ! areCustomGradientsEnabled }\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t{ ...controlProps }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenBackgroundColor;\n"]}
@@ -11,23 +11,28 @@ import { __ } from '@wordpress/i18n';
11
11
  import ScreenHeader from './header';
12
12
  import BorderPanel, { useHasBorderPanel } from './border-panel';
13
13
  import BlockPreviewPanel from './block-preview-panel';
14
- import { getVariationClassNameFromPath } from './utils';
14
+ import { getVariationClassName } from './utils';
15
+ import ShadowPanel, { useHasShadowControl } from './shadow-panel';
15
16
 
16
17
  function ScreenBorder(_ref) {
17
18
  let {
18
19
  name,
19
- variationPath = ''
20
+ variation = ''
20
21
  } = _ref;
21
22
  const hasBorderPanel = useHasBorderPanel(name);
22
- const variationClassName = getVariationClassNameFromPath(variationPath);
23
+ const variationClassName = getVariationClassName(variation);
24
+ const hasShadowPanel = useHasShadowControl(name);
23
25
  return createElement(Fragment, null, createElement(ScreenHeader, {
24
- title: __('Border')
26
+ title: __('Border & Shadow')
25
27
  }), createElement(BlockPreviewPanel, {
26
28
  name: name,
27
29
  variation: variationClassName
28
30
  }), hasBorderPanel && createElement(BorderPanel, {
29
31
  name: name,
30
- variationPath: variationPath
32
+ variation: variation
33
+ }), hasShadowPanel && createElement(ShadowPanel, {
34
+ name: name,
35
+ variation: variation
31
36
  }));
32
37
  }
33
38
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-border.js"],"names":["__","ScreenHeader","BorderPanel","useHasBorderPanel","BlockPreviewPanel","getVariationClassNameFromPath","ScreenBorder","name","variationPath","hasBorderPanel","variationClassName"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,OAAOC,WAAP,IAAsBC,iBAAtB,QAA+C,gBAA/C;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,SAASC,6BAAT,QAA8C,SAA9C;;AAEA,SAASC,YAAT,OAAsD;AAAA,MAA/B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,aAAa,GAAG;AAAxB,GAA+B;AACrD,QAAMC,cAAc,GAAGN,iBAAiB,CAAEI,IAAF,CAAxC;AACA,QAAMG,kBAAkB,GAAGL,6BAA6B,CAAEG,aAAF,CAAxD;AACA,SACC,8BACC,cAAC,YAAD;AAAc,IAAA,KAAK,EAAGR,EAAE,CAAE,QAAF;AAAxB,IADD,EAEC,cAAC,iBAAD;AAAmB,IAAA,IAAI,EAAGO,IAA1B;AAAiC,IAAA,SAAS,EAAGG;AAA7C,IAFD,EAGGD,cAAc,IACf,cAAC,WAAD;AAAa,IAAA,IAAI,EAAGF,IAApB;AAA2B,IAAA,aAAa,EAAGC;AAA3C,IAJF,CADD;AASA;;AAED,eAAeF,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport BorderPanel, { useHasBorderPanel } from './border-panel';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { getVariationClassNameFromPath } from './utils';\n\nfunction ScreenBorder( { name, variationPath = '' } ) {\n\tconst hasBorderPanel = useHasBorderPanel( name );\n\tconst variationClassName = getVariationClassNameFromPath( variationPath );\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader title={ __( 'Border' ) } />\n\t\t\t<BlockPreviewPanel name={ name } variation={ variationClassName } />\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<BorderPanel name={ name } variationPath={ variationPath } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBorder;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-border.js"],"names":["__","ScreenHeader","BorderPanel","useHasBorderPanel","BlockPreviewPanel","getVariationClassName","ShadowPanel","useHasShadowControl","ScreenBorder","name","variation","hasBorderPanel","variationClassName","hasShadowPanel"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,OAAOC,WAAP,IAAsBC,iBAAtB,QAA+C,gBAA/C;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,SAASC,qBAAT,QAAsC,SAAtC;AACA,OAAOC,WAAP,IAAsBC,mBAAtB,QAAiD,gBAAjD;;AAEA,SAASC,YAAT,OAAkD;AAAA,MAA3B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG;AAApB,GAA2B;AACjD,QAAMC,cAAc,GAAGR,iBAAiB,CAAEM,IAAF,CAAxC;AACA,QAAMG,kBAAkB,GAAGP,qBAAqB,CAAEK,SAAF,CAAhD;AACA,QAAMG,cAAc,GAAGN,mBAAmB,CAAEE,IAAF,CAA1C;AACA,SACC,8BACC,cAAC,YAAD;AAAc,IAAA,KAAK,EAAGT,EAAE,CAAE,iBAAF;AAAxB,IADD,EAEC,cAAC,iBAAD;AAAmB,IAAA,IAAI,EAAGS,IAA1B;AAAiC,IAAA,SAAS,EAAGG;AAA7C,IAFD,EAGGD,cAAc,IACf,cAAC,WAAD;AAAa,IAAA,IAAI,EAAGF,IAApB;AAA2B,IAAA,SAAS,EAAGC;AAAvC,IAJF,EAMGG,cAAc,IACf,cAAC,WAAD;AAAa,IAAA,IAAI,EAAGJ,IAApB;AAA2B,IAAA,SAAS,EAAGC;AAAvC,IAPF,CADD;AAYA;;AAED,eAAeF,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport BorderPanel, { useHasBorderPanel } from './border-panel';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { getVariationClassName } from './utils';\nimport ShadowPanel, { useHasShadowControl } from './shadow-panel';\n\nfunction ScreenBorder( { name, variation = '' } ) {\n\tconst hasBorderPanel = useHasBorderPanel( name );\n\tconst variationClassName = getVariationClassName( variation );\n\tconst hasShadowPanel = useHasShadowControl( name );\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader title={ __( 'Border & Shadow' ) } />\n\t\t\t<BlockPreviewPanel name={ name } variation={ variationClassName } />\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<BorderPanel name={ name } variation={ variation } />\n\t\t\t) }\n\t\t\t{ hasShadowPanel && (\n\t\t\t\t<ShadowPanel name={ name } variation={ variation } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBorder;\n"]}
@@ -4,29 +4,34 @@ import { createElement, Fragment } from "@wordpress/element";
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { __ } from '@wordpress/i18n';
7
- import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
7
+ import { __experimentalColorGradientControl as ColorGradientControl, experiments as blockEditorExperiments } from '@wordpress/block-editor';
8
8
  /**
9
9
  * Internal dependencies
10
10
  */
11
11
 
12
12
  import ScreenHeader from './header';
13
- import { getSupportedGlobalStylesPanels, useSetting, useStyle, useColorsPerOrigin } from './hooks';
13
+ import { getSupportedGlobalStylesPanels, useColorsPerOrigin } from './hooks';
14
+ import { unlock } from '../../experiments';
15
+ const {
16
+ useGlobalSetting,
17
+ useGlobalStyle
18
+ } = unlock(blockEditorExperiments);
14
19
 
15
20
  function ScreenButtonColor(_ref) {
16
21
  let {
17
22
  name,
18
- variationPath = ''
23
+ variation = ''
19
24
  } = _ref;
25
+ const prefix = variation ? `variations.${variation}.` : '';
20
26
  const supports = getSupportedGlobalStylesPanels(name);
21
- const [solids] = useSetting('color.palette', name);
22
- const [areCustomSolidsEnabled] = useSetting('color.custom', name);
23
27
  const colorsPerOrigin = useColorsPerOrigin(name);
24
- const [isBackgroundEnabled] = useSetting('color.background', name);
25
- const hasButtonColor = supports.includes('buttonColor') && isBackgroundEnabled && (solids.length > 0 || areCustomSolidsEnabled);
26
- const [buttonTextColor, setButtonTextColor] = useStyle(variationPath + 'elements.button.color.text', name);
27
- const [userButtonTextColor] = useStyle('elements.button.color.text', name, 'user');
28
- const [buttonBgColor, setButtonBgColor] = useStyle('elements.button.color.background', name);
29
- const [userButtonBgColor] = useStyle('elements.button.color.background', name, 'user');
28
+ const [areCustomSolidsEnabled] = useGlobalSetting('color.custom', name);
29
+ const [isBackgroundEnabled] = useGlobalSetting('color.background', name);
30
+ const hasButtonColor = supports.includes('buttonColor') && isBackgroundEnabled && (colorsPerOrigin.length > 0 || areCustomSolidsEnabled);
31
+ const [buttonTextColor, setButtonTextColor] = useGlobalStyle(prefix + 'elements.button.color.text', name);
32
+ const [userButtonTextColor] = useGlobalStyle('elements.button.color.text', name, 'user');
33
+ const [buttonBgColor, setButtonBgColor] = useGlobalStyle('elements.button.color.background', name);
34
+ const [userButtonBgColor] = useGlobalStyle('elements.button.color.background', name, 'user');
30
35
 
31
36
  if (!hasButtonColor) {
32
37
  return null;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-button-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","ScreenButtonColor","name","variationPath","supports","solids","areCustomSolidsEnabled","colorsPerOrigin","isBackgroundEnabled","hasButtonColor","includes","length","buttonTextColor","setButtonTextColor","userButtonTextColor","buttonBgColor","setButtonBgColor","userButtonBgColor"],"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,EAECC,UAFD,EAGCC,QAHD,EAICC,kBAJD,QAKO,SALP;;AAOA,SAASC,iBAAT,OAA2D;AAAA,MAA/B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,aAAa,GAAG;AAAxB,GAA+B;AAC1D,QAAMC,QAAQ,GAAGP,8BAA8B,CAAEK,IAAF,CAA/C;AACA,QAAM,CAAEG,MAAF,IAAaP,UAAU,CAAE,eAAF,EAAmBI,IAAnB,CAA7B;AACA,QAAM,CAAEI,sBAAF,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AAA,SAAS,EAAGD,eAAe,KAAKE;AATjC,IAZD,EAwBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGrB,EAAE,CAAE,kBAAF,CADL,CAxBD,EA4BC,cAAC,oBAAD;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,MAAM,EAAGc,eAFV;AAGC,IAAA,mBAAmB,EAAG,CAAED,sBAHzB;AAIC,IAAA,SAAS,EAAG,KAJb;AAKC,IAAA,WAAW,MALZ;AAMC,IAAA,iCAAiC,MANlC;AAOC,IAAA,UAAU,EAAGS,aAPd;AAQC,IAAA,aAAa,EAAGC,gBARjB;AASC,IAAA,SAAS,EAAGD,aAAa,KAAKE;AAT/B,IA5BD,CADD;AA0CA;;AAED,eAAehB,iBAAf","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 ScreenButtonColor( { name, variationPath = '' } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\n\tconst [ isBackgroundEnabled ] = useSetting( 'color.background', name );\n\n\tconst hasButtonColor =\n\t\tsupports.includes( 'buttonColor' ) &&\n\t\tisBackgroundEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ buttonTextColor, setButtonTextColor ] = useStyle(\n\t\tvariationPath + 'elements.button.color.text',\n\t\tname\n\t);\n\tconst [ userButtonTextColor ] = useStyle(\n\t\t'elements.button.color.text',\n\t\tname,\n\t\t'user'\n\t);\n\n\tconst [ buttonBgColor, setButtonBgColor ] = useStyle(\n\t\t'elements.button.color.background',\n\t\tname\n\t);\n\tconst [ userButtonBgColor ] = useStyle(\n\t\t'elements.button.color.background',\n\t\tname,\n\t\t'user'\n\t);\n\n\tif ( ! hasButtonColor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Buttons' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default colors used for buttons across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<h4 className=\"edit-site-global-styles-section-title\">\n\t\t\t\t{ __( 'Text color' ) }\n\t\t\t</h4>\n\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-button-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={ buttonTextColor }\n\t\t\t\tonColorChange={ setButtonTextColor }\n\t\t\t\tclearable={ buttonTextColor === userButtonTextColor }\n\t\t\t/>\n\n\t\t\t<h4 className=\"edit-site-global-styles-section-title\">\n\t\t\t\t{ __( 'Background color' ) }\n\t\t\t</h4>\n\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-button-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={ buttonBgColor }\n\t\t\t\tonColorChange={ setButtonBgColor }\n\t\t\t\tclearable={ buttonBgColor === userButtonBgColor }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenButtonColor;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-button-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","experiments","blockEditorExperiments","ScreenHeader","getSupportedGlobalStylesPanels","useColorsPerOrigin","unlock","useGlobalSetting","useGlobalStyle","ScreenButtonColor","name","variation","prefix","supports","colorsPerOrigin","areCustomSolidsEnabled","isBackgroundEnabled","hasButtonColor","includes","length","buttonTextColor","setButtonTextColor","userButtonTextColor","buttonBgColor","setButtonBgColor","userButtonBgColor"],"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,iBAAT,OAAuD;AAAA,MAA3B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG;AAApB,GAA2B;AACtD,QAAMC,MAAM,GAAGD,SAAS,GAAI,cAAcA,SAAW,GAA7B,GAAkC,EAA1D;AACA,QAAME,QAAQ,GAAGT,8BAA8B,CAAEM,IAAF,CAA/C;AACA,QAAMI,eAAe,GAAGT,kBAAkB,CAAEK,IAAF,CAA1C;AACA,QAAM,CAAEK,sBAAF,IAA6BR,gBAAgB,CAAE,cAAF,EAAkBG,IAAlB,CAAnD;AACA,QAAM,CAAEM,mBAAF,IAA0BT,gBAAgB,CAC/C,kBAD+C,EAE/CG,IAF+C,CAAhD;AAKA,QAAMO,cAAc,GACnBJ,QAAQ,CAACK,QAAT,CAAmB,aAAnB,KACAF,mBADA,KAEEF,eAAe,CAACK,MAAhB,GAAyB,CAAzB,IAA8BJ,sBAFhC,CADD;AAKA,QAAM,CAAEK,eAAF,EAAmBC,kBAAnB,IAA0Cb,cAAc,CAC7D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EAAGC,gBARjB;AASC,IAAA,SAAS,EAAGD,aAAa,KAAKE;AAT/B,IA5BD,CADD;AA0CA;;AAED,eAAehB,iBAAf","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 ScreenButtonColor( { name, variation = '' } ) {\n\tconst prefix = variation ? `variations.${ variation }.` : '';\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\tconst [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );\n\tconst [ isBackgroundEnabled ] = useGlobalSetting(\n\t\t'color.background',\n\t\tname\n\t);\n\n\tconst hasButtonColor =\n\t\tsupports.includes( 'buttonColor' ) &&\n\t\tisBackgroundEnabled &&\n\t\t( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ buttonTextColor, setButtonTextColor ] = useGlobalStyle(\n\t\tprefix + 'elements.button.color.text',\n\t\tname\n\t);\n\tconst [ userButtonTextColor ] = useGlobalStyle(\n\t\t'elements.button.color.text',\n\t\tname,\n\t\t'user'\n\t);\n\n\tconst [ buttonBgColor, setButtonBgColor ] = useGlobalStyle(\n\t\t'elements.button.color.background',\n\t\tname\n\t);\n\tconst [ userButtonBgColor ] = useGlobalStyle(\n\t\t'elements.button.color.background',\n\t\tname,\n\t\t'user'\n\t);\n\n\tif ( ! hasButtonColor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Buttons' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default colors used for buttons across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<h4 className=\"edit-site-global-styles-section-title\">\n\t\t\t\t{ __( 'Text color' ) }\n\t\t\t</h4>\n\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-button-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={ buttonTextColor }\n\t\t\t\tonColorChange={ setButtonTextColor }\n\t\t\t\tclearable={ buttonTextColor === userButtonTextColor }\n\t\t\t/>\n\n\t\t\t<h4 className=\"edit-site-global-styles-section-title\">\n\t\t\t\t{ __( 'Background color' ) }\n\t\t\t</h4>\n\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-button-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={ buttonBgColor }\n\t\t\t\tonColorChange={ setButtonBgColor }\n\t\t\t\tclearable={ buttonBgColor === userButtonBgColor }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenButtonColor;\n"]}