@wordpress/edit-site 5.5.0 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/new-template-part.js +3 -11
  3. package/build/components/add-new-template/new-template-part.js.map +1 -1
  4. package/build/components/add-new-template/new-template.js +23 -17
  5. package/build/components/add-new-template/new-template.js.map +1 -1
  6. package/build/components/add-new-template/utils.js +1 -1
  7. package/build/components/add-new-template/utils.js.map +1 -1
  8. package/build/components/app/index.js +4 -2
  9. package/build/components/app/index.js.map +1 -1
  10. package/build/components/block-editor/editor-canvas.js +7 -9
  11. package/build/components/block-editor/editor-canvas.js.map +1 -1
  12. package/build/components/editor/index.js +2 -4
  13. package/build/components/editor/index.js.map +1 -1
  14. package/build/components/global-styles/border-panel.js +20 -159
  15. package/build/components/global-styles/border-panel.js.map +1 -1
  16. package/build/components/global-styles/context-menu.js +4 -6
  17. package/build/components/global-styles/context-menu.js.map +1 -1
  18. package/build/components/global-styles/hooks.js +0 -72
  19. package/build/components/global-styles/hooks.js.map +1 -1
  20. package/build/components/global-styles/preview.js +3 -4
  21. package/build/components/global-styles/preview.js.map +1 -1
  22. package/build/components/global-styles/screen-block-list.js +5 -7
  23. package/build/components/global-styles/screen-block-list.js.map +1 -1
  24. package/build/components/global-styles/screen-border.js +13 -5
  25. package/build/components/global-styles/screen-border.js.map +1 -1
  26. package/build/components/global-styles/screen-colors.js +22 -211
  27. package/build/components/global-styles/screen-colors.js.map +1 -1
  28. package/build/components/global-styles/screen-root.js +2 -1
  29. package/build/components/global-styles/screen-root.js.map +1 -1
  30. package/build/components/global-styles/screen-style-variations.js +2 -1
  31. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  32. package/build/components/global-styles/screen-typography-element.js +4 -0
  33. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  34. package/build/components/global-styles/screen-typography.js +5 -0
  35. package/build/components/global-styles/screen-typography.js.map +1 -1
  36. package/build/components/global-styles/ui.js +5 -35
  37. package/build/components/global-styles/ui.js.map +1 -1
  38. package/build/components/global-styles-renderer/index.js +1 -2
  39. package/build/components/global-styles-renderer/index.js.map +1 -1
  40. package/build/components/layout/index.js +7 -0
  41. package/build/components/layout/index.js.map +1 -1
  42. package/build/components/list/added-by.js +128 -136
  43. package/build/components/list/added-by.js.map +1 -1
  44. package/build/components/list/index.js +2 -1
  45. package/build/components/list/index.js.map +1 -1
  46. package/build/components/list/table.js +6 -5
  47. package/build/components/list/table.js.map +1 -1
  48. package/build/components/routes/link.js +4 -1
  49. package/build/components/routes/link.js.map +1 -1
  50. package/build/components/save-button/index.js +2 -5
  51. package/build/components/save-button/index.js.map +1 -1
  52. package/build/components/save-hub/index.js +82 -0
  53. package/build/components/save-hub/index.js.map +1 -0
  54. package/build/components/secondary-sidebar/list-view-sidebar.js +6 -1
  55. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  56. package/build/components/sidebar/index.js +2 -4
  57. package/build/components/sidebar/index.js.map +1 -1
  58. package/build/components/sidebar-navigation-screen/index.js +5 -2
  59. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  60. package/build/components/sidebar-navigation-screen-main/index.js +13 -13
  61. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  62. package/build/components/sidebar-navigation-screen-navigation-item/index.js +9 -14
  63. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  64. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +87 -10
  65. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  66. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
  67. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  68. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
  69. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  70. package/build/components/sidebar-navigation-screen-template/index.js +59 -10
  71. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  72. package/build/components/sidebar-navigation-screen-templates/index.js +5 -2
  73. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  74. package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
  75. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  76. package/build/components/site-hub/index.js +3 -1
  77. package/build/components/site-hub/index.js.map +1 -1
  78. package/build/components/start-template-options/index.js +44 -9
  79. package/build/components/start-template-options/index.js.map +1 -1
  80. package/build/components/style-book/index.js +133 -19
  81. package/build/components/style-book/index.js.map +1 -1
  82. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  83. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  84. package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
  85. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  86. package/build/components/template-details/index.js +0 -3
  87. package/build/components/template-details/index.js.map +1 -1
  88. package/build/components/template-part-converter/convert-to-regular.js +8 -12
  89. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  90. package/build/components/template-part-converter/convert-to-template-part.js +2 -2
  91. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  92. package/build/components/template-part-converter/index.js +19 -14
  93. package/build/components/template-part-converter/index.js.map +1 -1
  94. package/build/components/use-edited-entity-record/index.js +6 -6
  95. package/build/components/use-edited-entity-record/index.js.map +1 -1
  96. package/build/hooks/push-changes-to-global-styles/index.js +1 -0
  97. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  98. package/build/index.js +3 -0
  99. package/build/index.js.map +1 -1
  100. package/build/utils/history.js +8 -2
  101. package/build/utils/history.js.map +1 -1
  102. package/build-module/components/add-new-template/new-template-part.js +3 -9
  103. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  104. package/build-module/components/add-new-template/new-template.js +25 -18
  105. package/build-module/components/add-new-template/new-template.js.map +1 -1
  106. package/build-module/components/add-new-template/utils.js +1 -1
  107. package/build-module/components/add-new-template/utils.js.map +1 -1
  108. package/build-module/components/app/index.js +3 -2
  109. package/build-module/components/app/index.js.map +1 -1
  110. package/build-module/components/block-editor/editor-canvas.js +8 -10
  111. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  112. package/build-module/components/editor/index.js +2 -3
  113. package/build-module/components/editor/index.js.map +1 -1
  114. package/build-module/components/global-styles/border-panel.js +21 -157
  115. package/build-module/components/global-styles/border-panel.js.map +1 -1
  116. package/build-module/components/global-styles/context-menu.js +4 -4
  117. package/build-module/components/global-styles/context-menu.js.map +1 -1
  118. package/build-module/components/global-styles/hooks.js +0 -66
  119. package/build-module/components/global-styles/hooks.js.map +1 -1
  120. package/build-module/components/global-styles/preview.js +3 -4
  121. package/build-module/components/global-styles/preview.js.map +1 -1
  122. package/build-module/components/global-styles/screen-block-list.js +5 -5
  123. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  124. package/build-module/components/global-styles/screen-border.js +11 -2
  125. package/build-module/components/global-styles/screen-border.js.map +1 -1
  126. package/build-module/components/global-styles/screen-colors.js +23 -208
  127. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  128. package/build-module/components/global-styles/screen-root.js +2 -1
  129. package/build-module/components/global-styles/screen-root.js.map +1 -1
  130. package/build-module/components/global-styles/screen-style-variations.js +2 -1
  131. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  132. package/build-module/components/global-styles/screen-typography-element.js +4 -0
  133. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  134. package/build-module/components/global-styles/screen-typography.js +5 -0
  135. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  136. package/build-module/components/global-styles/ui.js +5 -30
  137. package/build-module/components/global-styles/ui.js.map +1 -1
  138. package/build-module/components/global-styles-renderer/index.js +1 -2
  139. package/build-module/components/global-styles-renderer/index.js.map +1 -1
  140. package/build-module/components/layout/index.js +7 -0
  141. package/build-module/components/layout/index.js.map +1 -1
  142. package/build-module/components/list/added-by.js +126 -137
  143. package/build-module/components/list/added-by.js.map +1 -1
  144. package/build-module/components/list/index.js +2 -1
  145. package/build-module/components/list/index.js.map +1 -1
  146. package/build-module/components/list/table.js +6 -5
  147. package/build-module/components/list/table.js.map +1 -1
  148. package/build-module/components/routes/link.js +5 -2
  149. package/build-module/components/routes/link.js.map +1 -1
  150. package/build-module/components/save-button/index.js +2 -5
  151. package/build-module/components/save-button/index.js.map +1 -1
  152. package/build-module/components/save-hub/index.js +68 -0
  153. package/build-module/components/save-hub/index.js.map +1 -0
  154. package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -2
  155. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  156. package/build-module/components/sidebar/index.js +2 -4
  157. package/build-module/components/sidebar/index.js.map +1 -1
  158. package/build-module/components/sidebar-navigation-screen/index.js +5 -2
  159. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  160. package/build-module/components/sidebar-navigation-screen-main/index.js +13 -13
  161. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  162. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +13 -18
  163. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  164. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +81 -10
  165. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  166. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
  167. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  168. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
  169. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  170. package/build-module/components/sidebar-navigation-screen-template/index.js +60 -13
  171. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  172. package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -2
  173. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  174. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
  175. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  176. package/build-module/components/site-hub/index.js +3 -1
  177. package/build-module/components/site-hub/index.js.map +1 -1
  178. package/build-module/components/start-template-options/index.js +45 -10
  179. package/build-module/components/start-template-options/index.js.map +1 -1
  180. package/build-module/components/style-book/index.js +133 -21
  181. package/build-module/components/style-book/index.js.map +1 -1
  182. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  183. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  184. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
  185. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  186. package/build-module/components/template-details/index.js +0 -3
  187. package/build-module/components/template-details/index.js.map +1 -1
  188. package/build-module/components/template-part-converter/convert-to-regular.js +9 -13
  189. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  190. package/build-module/components/template-part-converter/convert-to-template-part.js +3 -3
  191. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  192. package/build-module/components/template-part-converter/index.js +20 -15
  193. package/build-module/components/template-part-converter/index.js.map +1 -1
  194. package/build-module/components/use-edited-entity-record/index.js +6 -6
  195. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  196. package/build-module/hooks/push-changes-to-global-styles/index.js +1 -0
  197. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  198. package/build-module/index.js +4 -1
  199. package/build-module/index.js.map +1 -1
  200. package/build-module/utils/history.js +9 -3
  201. package/build-module/utils/history.js.map +1 -1
  202. package/build-style/style-rtl.css +172 -128
  203. package/build-style/style.css +172 -128
  204. package/package.json +31 -31
  205. package/src/components/add-new-template/new-template-part.js +1 -6
  206. package/src/components/add-new-template/new-template.js +60 -38
  207. package/src/components/add-new-template/style.scss +12 -1
  208. package/src/components/add-new-template/utils.js +1 -1
  209. package/src/components/app/index.js +9 -6
  210. package/src/components/block-editor/editor-canvas.js +13 -22
  211. package/src/components/editor/index.js +61 -65
  212. package/src/components/global-styles/border-panel.js +24 -199
  213. package/src/components/global-styles/context-menu.js +4 -4
  214. package/src/components/global-styles/hooks.js +0 -101
  215. package/src/components/global-styles/preview.js +1 -1
  216. package/src/components/global-styles/screen-block-list.js +4 -4
  217. package/src/components/global-styles/screen-border.js +9 -2
  218. package/src/components/global-styles/screen-colors.js +25 -229
  219. package/src/components/global-styles/screen-root.js +1 -1
  220. package/src/components/global-styles/screen-style-variations.js +5 -1
  221. package/src/components/global-styles/screen-typography-element.js +4 -0
  222. package/src/components/global-styles/screen-typography.js +6 -0
  223. package/src/components/global-styles/stories/index.js +425 -0
  224. package/src/components/global-styles/style.scss +14 -18
  225. package/src/components/global-styles/ui.js +6 -31
  226. package/src/components/global-styles-renderer/index.js +1 -2
  227. package/src/components/layout/index.js +15 -0
  228. package/src/components/layout/style.scss +1 -3
  229. package/src/components/list/added-by.js +144 -140
  230. package/src/components/list/index.js +3 -1
  231. package/src/components/list/table.js +7 -4
  232. package/src/components/routes/link.js +9 -2
  233. package/src/components/save-button/index.js +2 -2
  234. package/src/components/save-hub/index.js +78 -0
  235. package/src/components/save-hub/style.scss +15 -0
  236. package/src/components/secondary-sidebar/list-view-sidebar.js +4 -3
  237. package/src/components/sidebar/index.js +2 -3
  238. package/src/components/sidebar/style.scss +4 -3
  239. package/src/components/sidebar-button/style.scss +2 -1
  240. package/src/components/sidebar-navigation-item/style.scss +1 -23
  241. package/src/components/sidebar-navigation-screen/index.js +6 -0
  242. package/src/components/sidebar-navigation-screen/style.scss +15 -0
  243. package/src/components/sidebar-navigation-screen-main/index.js +21 -8
  244. package/src/components/sidebar-navigation-screen-navigation-item/index.js +30 -21
  245. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +92 -9
  246. package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
  247. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
  248. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +108 -1
  249. package/src/components/sidebar-navigation-screen-template/index.js +82 -11
  250. package/src/components/sidebar-navigation-screen-template/style.scss +25 -0
  251. package/src/components/sidebar-navigation-screen-templates/index.js +7 -0
  252. package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -1
  253. package/src/components/site-hub/index.js +5 -1
  254. package/src/components/site-hub/style.scss +5 -1
  255. package/src/components/start-template-options/index.js +40 -8
  256. package/src/components/style-book/index.js +203 -54
  257. package/src/components/style-book/style.scss +2 -46
  258. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
  259. package/src/components/sync-state-with-url/use-sync-path-with-url.js +12 -7
  260. package/src/components/template-details/index.js +0 -3
  261. package/src/components/template-part-converter/convert-to-regular.js +10 -17
  262. package/src/components/template-part-converter/convert-to-template-part.js +9 -16
  263. package/src/components/template-part-converter/index.js +28 -12
  264. package/src/components/use-edited-entity-record/index.js +26 -18
  265. package/src/hooks/push-changes-to-global-styles/index.js +1 -0
  266. package/src/index.js +5 -1
  267. package/src/store/test/actions.js +0 -2
  268. package/src/style.scss +2 -1
  269. package/src/utils/history.js +13 -9
  270. package/build/components/global-styles/color-utils.js +0 -17
  271. package/build/components/global-styles/color-utils.js.map +0 -1
  272. package/build/components/global-styles/screen-background-color.js +0 -114
  273. package/build/components/global-styles/screen-background-color.js.map +0 -1
  274. package/build/components/global-styles/screen-button-color.js +0 -88
  275. package/build/components/global-styles/screen-button-color.js.map +0 -1
  276. package/build/components/global-styles/screen-heading-color.js +0 -165
  277. package/build/components/global-styles/screen-heading-color.js.map +0 -1
  278. package/build/components/global-styles/screen-link-color.js +0 -105
  279. package/build/components/global-styles/screen-link-color.js.map +0 -1
  280. package/build/components/global-styles/screen-text-color.js +0 -71
  281. package/build/components/global-styles/screen-text-color.js.map +0 -1
  282. package/build/components/navigation-inspector/index.js +0 -161
  283. package/build/components/navigation-inspector/index.js.map +0 -1
  284. package/build/components/navigation-inspector/navigation-menu.js +0 -79
  285. package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
  286. package/build-module/components/global-styles/color-utils.js +0 -9
  287. package/build-module/components/global-styles/color-utils.js.map +0 -1
  288. package/build-module/components/global-styles/screen-background-color.js +0 -97
  289. package/build-module/components/global-styles/screen-background-color.js.map +0 -1
  290. package/build-module/components/global-styles/screen-button-color.js +0 -73
  291. package/build-module/components/global-styles/screen-button-color.js.map +0 -1
  292. package/build-module/components/global-styles/screen-heading-color.js +0 -149
  293. package/build-module/components/global-styles/screen-heading-color.js.map +0 -1
  294. package/build-module/components/global-styles/screen-link-color.js +0 -89
  295. package/build-module/components/global-styles/screen-link-color.js.map +0 -1
  296. package/build-module/components/global-styles/screen-text-color.js +0 -56
  297. package/build-module/components/global-styles/screen-text-color.js.map +0 -1
  298. package/build-module/components/navigation-inspector/index.js +0 -146
  299. package/build-module/components/navigation-inspector/index.js.map +0 -1
  300. package/build-module/components/navigation-inspector/navigation-menu.js +0 -69
  301. package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
  302. package/src/components/global-styles/color-utils.js +0 -14
  303. package/src/components/global-styles/screen-background-color.js +0 -132
  304. package/src/components/global-styles/screen-button-color.js +0 -104
  305. package/src/components/global-styles/screen-heading-color.js +0 -206
  306. package/src/components/global-styles/screen-link-color.js +0 -124
  307. package/src/components/global-styles/screen-text-color.js +0 -62
  308. package/src/components/navigation-inspector/index.js +0 -191
  309. package/src/components/navigation-inspector/navigation-menu.js +0 -84
  310. package/src/components/navigation-inspector/style.scss +0 -46
@@ -1,73 +0,0 @@
1
- import { createElement, Fragment } from "@wordpress/element";
2
-
3
- /**
4
- * WordPress dependencies
5
- */
6
- import { __ } from '@wordpress/i18n';
7
- import { __experimentalColorGradientControl as ColorGradientControl, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
8
- /**
9
- * Internal dependencies
10
- */
11
-
12
- import ScreenHeader from './header';
13
- import { useSupportedStyles, useColorsPerOrigin } from './hooks';
14
- import { unlock } from '../../private-apis';
15
- const {
16
- useGlobalSetting,
17
- useGlobalStyle
18
- } = unlock(blockEditorPrivateApis);
19
-
20
- function ScreenButtonColor(_ref) {
21
- let {
22
- name,
23
- variation = ''
24
- } = _ref;
25
- const prefix = variation ? `variations.${variation}.` : '';
26
- const supports = useSupportedStyles(name);
27
- const colorsPerOrigin = useColorsPerOrigin(name);
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');
35
-
36
- if (!hasButtonColor) {
37
- return null;
38
- }
39
-
40
- return createElement(Fragment, null, createElement(ScreenHeader, {
41
- title: __('Buttons'),
42
- description: __('Set the default colors used for buttons across the site.')
43
- }), createElement("h3", {
44
- className: "edit-site-global-styles-section-title"
45
- }, __('Text color')), createElement(ColorGradientControl, {
46
- className: "edit-site-screen-button-color__control",
47
- colors: colorsPerOrigin,
48
- disableCustomColors: !areCustomSolidsEnabled,
49
- showTitle: false,
50
- enableAlpha: true,
51
- __experimentalIsRenderedInSidebar: true,
52
- colorValue: buttonTextColor,
53
- onColorChange: setButtonTextColor,
54
- clearable: buttonTextColor === userButtonTextColor,
55
- headingLevel: 4
56
- }), createElement("h3", {
57
- className: "edit-site-global-styles-section-title"
58
- }, __('Background color')), createElement(ColorGradientControl, {
59
- className: "edit-site-screen-button-color__control",
60
- colors: colorsPerOrigin,
61
- disableCustomColors: !areCustomSolidsEnabled,
62
- showTitle: false,
63
- enableAlpha: true,
64
- __experimentalIsRenderedInSidebar: true,
65
- colorValue: buttonBgColor,
66
- onColorChange: setButtonBgColor,
67
- clearable: buttonBgColor === userButtonBgColor,
68
- headingLevel: 4
69
- }));
70
- }
71
-
72
- export default ScreenButtonColor;
73
- //# sourceMappingURL=screen-button-color.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-button-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","privateApis","blockEditorPrivateApis","ScreenHeader","useSupportedStyles","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,kBAAT,EAA6BC,kBAA7B,QAAuD,SAAvD;AACA,SAASC,MAAT,QAAuB,oBAAvB;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,kBAAkB,CAAEM,IAAF,CAAnC;AACA,QAAMI,eAAe,GAAGT,kBAAkB,CAAEK,IAAF,CAA1C;AACA,QAAM,CAAEK,sBAAF,IAA6BR,gBAAgB,CAAE,cAAF,EAAkBG,IAAlB,CAAn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AAA,SAAS,EAAC;AAAd,KACGxB,EAAE,CAAE,kBAAF,CADL,CAzBD,EA6BC,cAAC,oBAAD;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,MAAM,EAAGgB,eAFV;AAGC,IAAA,mBAAmB,EAAG,CAAEC,sBAHzB;AAIC,IAAA,SAAS,EAAG,KAJb;AAKC,IAAA,WAAW,MALZ;AAMC,IAAA,iCAAiC,MANlC;AAOC,IAAA,UAAU,EAAGQ,aAPd;AAQC,IAAA,aAAa,EAAGC,gBARjB;AASC,IAAA,SAAS,EAAGD,aAAa,KAAKE,iBAT/B;AAUC,IAAA,YAAY,EAAG;AAVhB,IA7BD,CADD;AA4CA;;AAED,eAAehB,iBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalColorGradientControl as ColorGradientControl,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport { useSupportedStyles, useColorsPerOrigin } from './hooks';\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction ScreenButtonColor( { name, variation = '' } ) {\n\tconst prefix = variation ? `variations.${ variation }.` : '';\n\tconst supports = useSupportedStyles( 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<h3 className=\"edit-site-global-styles-section-title\">\n\t\t\t\t{ __( 'Text color' ) }\n\t\t\t</h3>\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\theadingLevel={ 4 }\n\t\t\t/>\n\n\t\t\t<h3 className=\"edit-site-global-styles-section-title\">\n\t\t\t\t{ __( 'Background color' ) }\n\t\t\t</h3>\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\theadingLevel={ 4 }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenButtonColor;\n"]}
@@ -1,149 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { createElement, Fragment } from "@wordpress/element";
3
-
4
- /**
5
- * WordPress dependencies
6
- */
7
- import { sprintf, __ } from '@wordpress/i18n';
8
- import { __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption } from '@wordpress/components';
9
- import { __experimentalColorGradientControl as ColorGradientControl, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
10
- import { useState } from '@wordpress/element';
11
- /**
12
- * Internal dependencies
13
- */
14
-
15
- import ScreenHeader from './header';
16
- import { useSupportedStyles, useColorsPerOrigin, useGradientsPerOrigin } from './hooks';
17
- import { unlock } from '../../private-apis';
18
- const {
19
- useGlobalSetting,
20
- useGlobalStyle
21
- } = unlock(blockEditorPrivateApis);
22
-
23
- function ScreenHeadingColor(_ref) {
24
- let {
25
- name,
26
- variation = ''
27
- } = _ref;
28
- const prefix = variation ? `variations.${variation}.` : '';
29
- const [selectedLevel, setCurrentTab] = useState('heading');
30
- const supports = useSupportedStyles(name);
31
- const [areCustomSolidsEnabled] = useGlobalSetting('color.custom', name);
32
- const [areCustomGradientsEnabled] = useGlobalSetting('color.customGradient', name);
33
- const [isTextEnabled] = useGlobalSetting('color.text', name);
34
- const [isBackgroundEnabled] = useGlobalSetting('color.background', name);
35
- const colorsPerOrigin = useColorsPerOrigin(name);
36
- const gradientsPerOrigin = useGradientsPerOrigin(name);
37
- const hasTextColor = supports.includes('color') && isTextEnabled && (colorsPerOrigin.length > 0 || areCustomSolidsEnabled);
38
- const hasBackgroundColor = supports.includes('backgroundColor') && isBackgroundEnabled && (colorsPerOrigin.length > 0 || areCustomSolidsEnabled);
39
- const hasGradientColor = supports.includes('background') && (gradientsPerOrigin.length > 0 || areCustomGradientsEnabled);
40
- const [color, setColor] = useGlobalStyle(prefix + 'elements.' + selectedLevel + '.color.text', name);
41
- const [userColor] = useGlobalStyle(prefix + 'elements.' + selectedLevel + '.color.text', name, 'user');
42
- const [backgroundColor, setBackgroundColor] = useGlobalStyle(prefix + 'elements.' + selectedLevel + '.color.background', name);
43
- const [userBackgroundColor] = useGlobalStyle(prefix + 'elements.' + selectedLevel + '.color.background', name, 'user');
44
- const [gradient, setGradient] = useGlobalStyle(prefix + 'elements.' + selectedLevel + '.color.gradient', name);
45
- const [userGradient] = useGlobalStyle(prefix + 'elements.' + selectedLevel + '.color.gradient', name, 'user');
46
-
47
- if (!hasTextColor && !hasBackgroundColor && !hasGradientColor) {
48
- return null;
49
- }
50
-
51
- let backgroundSettings = {};
52
-
53
- if (hasBackgroundColor) {
54
- backgroundSettings = {
55
- colorValue: backgroundColor,
56
- onColorChange: setBackgroundColor
57
- };
58
-
59
- if (backgroundColor) {
60
- backgroundSettings.clearable = backgroundColor === userBackgroundColor;
61
- }
62
- }
63
-
64
- let gradientSettings = {};
65
-
66
- if (hasGradientColor) {
67
- gradientSettings = {
68
- gradientValue: gradient,
69
- onGradientChange: setGradient
70
- };
71
-
72
- if (gradient) {
73
- gradientSettings.clearable = gradient === userGradient;
74
- }
75
- }
76
-
77
- const controlProps = { ...backgroundSettings,
78
- ...gradientSettings
79
- };
80
- return createElement(Fragment, null, createElement(ScreenHeader, {
81
- title: __('Headings'),
82
- description: __('Set the default color used for headings across the site.')
83
- }), createElement("div", {
84
- className: "edit-site-global-styles-screen-heading-color"
85
- }, createElement("h3", null, __('Select heading level')), createElement(ToggleGroupControl, {
86
- __nextHasNoMarginBottom: true,
87
- label: __('Select heading level'),
88
- hideLabelFromVision: true,
89
- value: selectedLevel,
90
- onChange: setCurrentTab,
91
- isBlock: true
92
- }, createElement(ToggleGroupControlOption, {
93
- value: "heading"
94
- /* translators: 'All' refers to selecting all heading levels
95
- and applying the same style to h1-h6. */
96
- ,
97
- label: __('All')
98
- }), createElement(ToggleGroupControlOption, {
99
- value: "h1",
100
- label: __('H1')
101
- }), createElement(ToggleGroupControlOption, {
102
- value: "h2",
103
- label: __('H2')
104
- }), createElement(ToggleGroupControlOption, {
105
- value: "h3",
106
- label: __('H3')
107
- }), createElement(ToggleGroupControlOption, {
108
- value: "h4",
109
- label: __('H4')
110
- }), createElement(ToggleGroupControlOption, {
111
- value: "h5",
112
- label: __('H5')
113
- }), createElement(ToggleGroupControlOption, {
114
- value: "h6",
115
- label: __('H6')
116
- }))), hasTextColor && createElement("div", {
117
- className: "edit-site-global-styles-screen-heading-color"
118
- }, createElement("h3", null, selectedLevel === 'heading' ? __('Text color for all heading levels') : sprintf(
119
- /* translators: %s: heading level (h1-h6) */
120
- __('Text color for %s'), selectedLevel.toUpperCase())), createElement(ColorGradientControl, {
121
- className: "edit-site-screen-heading-text-color__control",
122
- colors: colorsPerOrigin,
123
- disableCustomColors: !areCustomSolidsEnabled,
124
- showTitle: false,
125
- enableAlpha: true,
126
- __experimentalIsRenderedInSidebar: true,
127
- colorValue: color,
128
- onColorChange: setColor,
129
- clearable: color === userColor,
130
- headingLevel: 4
131
- })), hasBackgroundColor && createElement("div", {
132
- className: "edit-site-global-styles-screen-heading-color"
133
- }, createElement("h3", null, selectedLevel === 'heading' ? __('Background color for all heading levels') : sprintf(
134
- /* translators: %s: heading level (h1-h6) */
135
- __('Background color for %s'), selectedLevel.toUpperCase())), createElement(ColorGradientControl, _extends({
136
- className: "edit-site-screen-heading-background-color__control",
137
- colors: colorsPerOrigin,
138
- gradients: gradientsPerOrigin,
139
- disableCustomColors: !areCustomSolidsEnabled,
140
- disableCustomGradients: !areCustomGradientsEnabled,
141
- showTitle: false,
142
- enableAlpha: true,
143
- __experimentalIsRenderedInSidebar: true,
144
- headingLevel: 4
145
- }, controlProps))));
146
- }
147
-
148
- export default ScreenHeadingColor;
149
- //# sourceMappingURL=screen-heading-color.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-heading-color.js"],"names":["sprintf","__","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","__experimentalColorGradientControl","ColorGradientControl","privateApis","blockEditorPrivateApis","useState","ScreenHeader","useSupportedStyles","useColorsPerOrigin","useGradientsPerOrigin","unlock","useGlobalSetting","useGlobalStyle","ScreenHeadingColor","name","variation","prefix","selectedLevel","setCurrentTab","supports","areCustomSolidsEnabled","areCustomGradientsEnabled","isTextEnabled","isBackgroundEnabled","colorsPerOrigin","gradientsPerOrigin","hasTextColor","includes","length","hasBackgroundColor","hasGradientColor","color","setColor","userColor","backgroundColor","setBackgroundColor","userBackgroundColor","gradient","setGradient","userGradient","backgroundSettings","colorValue","onColorChange","clearable","gradientSettings","gradientValue","onGradientChange","controlProps","toUpperCase"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SACCC,gCAAgC,IAAIC,kBADrC,EAECC,sCAAsC,IAAIC,wBAF3C,QAGO,uBAHP;AAIA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,WAAW,IAAIC,sBAFhB,QAGO,yBAHP;AAIA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,kBADD,EAECC,kBAFD,EAGCC,qBAHD,QAIO,SAJP;AAKA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAM;AAAEC,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,IAAuCF,MAAM,CAAEN,sBAAF,CAAnD;;AAEA,SAASS,kBAAT,OAAwD;AAAA,MAA3B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG;AAApB,GAA2B;AACvD,QAAMC,MAAM,GAAGD,SAAS,GAAI,cAAcA,SAAW,GAA7B,GAAkC,EAA1D;AACA,QAAM,CAAEE,aAAF,EAAiBC,aAAjB,IAAmCb,QAAQ,CAAE,SAAF,CAAjD;AACA,QAAMc,QAAQ,GAAGZ,kBAAkB,CAAEO,IAAF,CAA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P;AACAC,EAAAA,EAAE,CAAE,mBAAF,CAFK,EAGPqB,aAAa,CAAC+B,WAAd,EAHO,CAHX,CADD,EAUC,cAAC,oBAAD;AACC,IAAA,SAAS,EAAC,8CADX;AAEC,IAAA,MAAM,EAAGxB,eAFV;AAGC,IAAA,mBAAmB,EAAG,CAAEJ,sBAHzB;AAIC,IAAA,SAAS,EAAG,KAJb;AAKC,IAAA,WAAW,MALZ;AAMC,IAAA,iCAAiC,MANlC;AAOC,IAAA,UAAU,EAAGW,KAPd;AAQC,IAAA,aAAa,EAAGC,QARjB;AASC,IAAA,SAAS,EAAGD,KAAK,KAAKE,SATvB;AAUC,IAAA,YAAY,EAAG;AAVhB,IAVD,CAjCF,EAyDGJ,kBAAkB,IACnB;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,0BACGZ,aAAa,KAAK,SAAlB,GACCrB,EAAE,CAAE,yCAAF,CADH,GAECD,OAAO;AACP;AACAC,EAAAA,EAAE,CAAE,yBAAF,CAFK,EAGPqB,aAAa,CAAC+B,WAAd,EAHO,CAHX,CADD,EAUC,cAAC,oBAAD;AACC,IAAA,SAAS,EAAC,oDADX;AAEC,IAAA,MAAM,EAAGxB,eAFV;AAGC,IAAA,SAAS,EAAGC,kBAHb;AAIC,IAAA,mBAAmB,EAAG,CAAEL,sBAJzB;AAKC,IAAA,sBAAsB,EAAG,CAAEC,yBAL5B;AAMC,IAAA,SAAS,EAAG,KANb;AAOC,IAAA,WAAW,MAPZ;AAQC,IAAA,iCAAiC,MARlC;AASC,IAAA,YAAY,EAAG;AAThB,KAUM0B,YAVN,EAVD,CA1DF,CADD;AAqFA;;AAED,eAAelC,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport {\n\t__experimentalColorGradientControl as ColorGradientControl,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tuseSupportedStyles,\n\tuseColorsPerOrigin,\n\tuseGradientsPerOrigin,\n} from './hooks';\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction ScreenHeadingColor( { name, variation = '' } ) {\n\tconst prefix = variation ? `variations.${ variation }.` : '';\n\tconst [ selectedLevel, setCurrentTab ] = useState( 'heading' );\n\tconst supports = useSupportedStyles( name );\n\tconst [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );\n\tconst [ areCustomGradientsEnabled ] = useGlobalSetting(\n\t\t'color.customGradient',\n\t\tname\n\t);\n\tconst [ isTextEnabled ] = useGlobalSetting( 'color.text', name );\n\tconst [ isBackgroundEnabled ] = useGlobalSetting(\n\t\t'color.background',\n\t\tname\n\t);\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\tconst gradientsPerOrigin = useGradientsPerOrigin( name );\n\n\tconst hasTextColor =\n\t\tsupports.includes( 'color' ) &&\n\t\tisTextEnabled &&\n\t\t( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );\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\n\tconst [ color, setColor ] = useGlobalStyle(\n\t\tprefix + 'elements.' + selectedLevel + '.color.text',\n\t\tname\n\t);\n\tconst [ userColor ] = useGlobalStyle(\n\t\tprefix + 'elements.' + selectedLevel + '.color.text',\n\t\tname,\n\t\t'user'\n\t);\n\n\tconst [ backgroundColor, setBackgroundColor ] = useGlobalStyle(\n\t\tprefix + 'elements.' + selectedLevel + '.color.background',\n\t\tname\n\t);\n\tconst [ userBackgroundColor ] = useGlobalStyle(\n\t\tprefix + 'elements.' + selectedLevel + '.color.background',\n\t\tname,\n\t\t'user'\n\t);\n\tconst [ gradient, setGradient ] = useGlobalStyle(\n\t\tprefix + 'elements.' + selectedLevel + '.color.gradient',\n\t\tname\n\t);\n\tconst [ userGradient ] = useGlobalStyle(\n\t\tprefix + 'elements.' + selectedLevel + '.color.gradient',\n\t\tname,\n\t\t'user'\n\t);\n\n\tif ( ! hasTextColor && ! 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={ __( 'Headings' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for headings across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<div className=\"edit-site-global-styles-screen-heading-color\">\n\t\t\t\t<h3>{ __( 'Select heading level' ) }</h3>\n\n\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Select heading level' ) }\n\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\tvalue={ selectedLevel }\n\t\t\t\t\tonChange={ setCurrentTab }\n\t\t\t\t\tisBlock\n\t\t\t\t>\n\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\tvalue=\"heading\"\n\t\t\t\t\t\t/* translators: 'All' refers to selecting all heading levels\n\t\t\t\t\t\tand applying the same style to h1-h6. */\n\t\t\t\t\t\tlabel={ __( 'All' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleGroupControlOption value=\"h1\" label={ __( 'H1' ) } />\n\t\t\t\t\t<ToggleGroupControlOption value=\"h2\" label={ __( 'H2' ) } />\n\t\t\t\t\t<ToggleGroupControlOption value=\"h3\" label={ __( 'H3' ) } />\n\t\t\t\t\t<ToggleGroupControlOption value=\"h4\" label={ __( 'H4' ) } />\n\t\t\t\t\t<ToggleGroupControlOption value=\"h5\" label={ __( 'H5' ) } />\n\t\t\t\t\t<ToggleGroupControlOption value=\"h6\" label={ __( 'H6' ) } />\n\t\t\t\t</ToggleGroupControl>\n\t\t\t</div>\n\t\t\t{ hasTextColor && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-heading-color\">\n\t\t\t\t\t<h3>\n\t\t\t\t\t\t{ selectedLevel === 'heading'\n\t\t\t\t\t\t\t? __( 'Text color for all heading levels' )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: heading level (h1-h6) */\n\t\t\t\t\t\t\t\t\t__( 'Text color for %s' ),\n\t\t\t\t\t\t\t\t\tselectedLevel.toUpperCase()\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</h3>\n\t\t\t\t\t<ColorGradientControl\n\t\t\t\t\t\tclassName=\"edit-site-screen-heading-text-color__control\"\n\t\t\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t\t\tshowTitle={ false }\n\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tcolorValue={ color }\n\t\t\t\t\t\tonColorChange={ setColor }\n\t\t\t\t\t\tclearable={ color === userColor }\n\t\t\t\t\t\theadingLevel={ 4 }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasBackgroundColor && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-heading-color\">\n\t\t\t\t\t<h3>\n\t\t\t\t\t\t{ selectedLevel === 'heading'\n\t\t\t\t\t\t\t? __( 'Background color for all heading levels' )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: heading level (h1-h6) */\n\t\t\t\t\t\t\t\t\t__( 'Background color for %s' ),\n\t\t\t\t\t\t\t\t\tselectedLevel.toUpperCase()\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</h3>\n\t\t\t\t\t<ColorGradientControl\n\t\t\t\t\t\tclassName=\"edit-site-screen-heading-background-color__control\"\n\t\t\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\t\t\tgradients={ gradientsPerOrigin }\n\t\t\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t\t\tdisableCustomGradients={ ! areCustomGradientsEnabled }\n\t\t\t\t\t\tshowTitle={ false }\n\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\theadingLevel={ 4 }\n\t\t\t\t\t\t{ ...controlProps }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenHeadingColor;\n"]}
@@ -1,89 +0,0 @@
1
- import { createElement, Fragment } from "@wordpress/element";
2
-
3
- /**
4
- * WordPress dependencies
5
- */
6
- import { __ } from '@wordpress/i18n';
7
- import { __experimentalColorGradientControl as ColorGradientControl, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
8
- import { TabPanel } from '@wordpress/components';
9
- /**
10
- * Internal dependencies
11
- */
12
-
13
- import ScreenHeader from './header';
14
- import { useSupportedStyles, useColorsPerOrigin } from './hooks';
15
- import { unlock } from '../../private-apis';
16
- const {
17
- useGlobalSetting,
18
- useGlobalStyle
19
- } = unlock(blockEditorPrivateApis);
20
-
21
- function ScreenLinkColor(_ref) {
22
- let {
23
- name,
24
- variation = ''
25
- } = _ref;
26
- const prefix = variation ? `variations.${variation}.` : '';
27
- const supports = useSupportedStyles(name);
28
- const [areCustomSolidsEnabled] = useGlobalSetting('color.custom', name);
29
- const colorsPerOrigin = useColorsPerOrigin(name);
30
- const [isLinkEnabled] = useGlobalSetting('color.link', name);
31
- const hasLinkColor = supports.includes('linkColor') && isLinkEnabled && (colorsPerOrigin.length > 0 || areCustomSolidsEnabled);
32
- const pseudoStates = {
33
- default: {
34
- label: __('Default'),
35
- value: useGlobalStyle(prefix + 'elements.link.color.text', name)[0],
36
- handler: useGlobalStyle(prefix + 'elements.link.color.text', name)[1],
37
- userValue: useGlobalStyle(prefix + 'elements.link.color.text', name, 'user')[0]
38
- },
39
- hover: {
40
- label: __('Hover'),
41
- value: useGlobalStyle(prefix + 'elements.link.:hover.color.text', name)[0],
42
- handler: useGlobalStyle(prefix + 'elements.link.:hover.color.text', name)[1],
43
- userValue: useGlobalStyle(prefix + 'elements.link.:hover.color.text', name, 'user')[0]
44
- }
45
- };
46
-
47
- if (!hasLinkColor) {
48
- return null;
49
- }
50
-
51
- const tabs = Object.entries(pseudoStates).map(_ref2 => {
52
- let [selector, config] = _ref2;
53
- return {
54
- name: selector,
55
- title: config.label,
56
- className: `color-text-${selector}`
57
- };
58
- });
59
- return createElement(Fragment, null, createElement(ScreenHeader, {
60
- title: __('Links'),
61
- description: __('Set the colors used for links across the site.')
62
- }), createElement(TabPanel, {
63
- tabs: tabs
64
- }, tab => {
65
- var _pseudoStates$tab$nam;
66
-
67
- const pseudoSelectorConfig = (_pseudoStates$tab$nam = pseudoStates[tab.name]) !== null && _pseudoStates$tab$nam !== void 0 ? _pseudoStates$tab$nam : null;
68
-
69
- if (!pseudoSelectorConfig) {
70
- return null;
71
- }
72
-
73
- return createElement(Fragment, null, createElement(ColorGradientControl, {
74
- className: "edit-site-screen-link-color__control",
75
- colors: colorsPerOrigin,
76
- disableCustomColors: !areCustomSolidsEnabled,
77
- showTitle: false,
78
- enableAlpha: true,
79
- __experimentalIsRenderedInSidebar: true,
80
- colorValue: pseudoSelectorConfig.value,
81
- onColorChange: pseudoSelectorConfig.handler,
82
- clearable: pseudoSelectorConfig.value === pseudoSelectorConfig.userValue,
83
- headingLevel: 3
84
- }));
85
- }));
86
- }
87
-
88
- export default ScreenLinkColor;
89
- //# sourceMappingURL=screen-link-color.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-link-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","privateApis","blockEditorPrivateApis","TabPanel","ScreenHeader","useSupportedStyles","useColorsPerOrigin","unlock","useGlobalSetting","useGlobalStyle","ScreenLinkColor","name","variation","prefix","supports","areCustomSolidsEnabled","colorsPerOrigin","isLinkEnabled","hasLinkColor","includes","length","pseudoStates","default","label","value","handler","userValue","hover","tabs","Object","entries","map","selector","config","title","className","tab","pseudoSelectorConfig"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,WAAW,IAAIC,sBAFhB,QAGO,yBAHP;AAIA,SAASC,QAAT,QAAyB,uBAAzB;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SAASC,kBAAT,EAA6BC,kBAA7B,QAAuD,SAAvD;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAM;AAAEC,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,IAAuCF,MAAM,CAAEL,sBAAF,CAAnD;;AAEA,SAASQ,eAAT,OAAqD;AAAA,MAA3B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG;AAApB,GAA2B;AACpD,QAAMC,MAAM,GAAGD,SAAS,GAAI,cAAcA,S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} from '@wordpress/i18n';\nimport {\n\t__experimentalColorGradientControl as ColorGradientControl,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { TabPanel } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport { useSupportedStyles, useColorsPerOrigin } from './hooks';\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction ScreenLinkColor( { name, variation = '' } ) {\n\tconst prefix = variation ? `variations.${ variation }.` : '';\n\tconst supports = useSupportedStyles( name );\n\tconst [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\tconst [ isLinkEnabled ] = useGlobalSetting( 'color.link', name );\n\n\tconst hasLinkColor =\n\t\tsupports.includes( 'linkColor' ) &&\n\t\tisLinkEnabled &&\n\t\t( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );\n\n\tconst pseudoStates = {\n\t\tdefault: {\n\t\t\tlabel: __( 'Default' ),\n\t\t\tvalue: useGlobalStyle(\n\t\t\t\tprefix + 'elements.link.color.text',\n\t\t\t\tname\n\t\t\t)[ 0 ],\n\t\t\thandler: useGlobalStyle(\n\t\t\t\tprefix + 'elements.link.color.text',\n\t\t\t\tname\n\t\t\t)[ 1 ],\n\t\t\tuserValue: useGlobalStyle(\n\t\t\t\tprefix + 'elements.link.color.text',\n\t\t\t\tname,\n\t\t\t\t'user'\n\t\t\t)[ 0 ],\n\t\t},\n\t\thover: {\n\t\t\tlabel: __( 'Hover' ),\n\t\t\tvalue: useGlobalStyle(\n\t\t\t\tprefix + 'elements.link.:hover.color.text',\n\t\t\t\tname\n\t\t\t)[ 0 ],\n\t\t\thandler: useGlobalStyle(\n\t\t\t\tprefix + 'elements.link.:hover.color.text',\n\t\t\t\tname\n\t\t\t)[ 1 ],\n\t\t\tuserValue: useGlobalStyle(\n\t\t\t\tprefix + 'elements.link.:hover.color.text',\n\t\t\t\tname,\n\t\t\t\t'user'\n\t\t\t)[ 0 ],\n\t\t},\n\t};\n\n\tif ( ! hasLinkColor ) {\n\t\treturn null;\n\t}\n\n\tconst tabs = Object.entries( pseudoStates ).map(\n\t\t( [ selector, config ] ) => {\n\t\t\treturn {\n\t\t\t\tname: selector,\n\t\t\t\ttitle: config.label,\n\t\t\t\tclassName: `color-text-${ selector }`,\n\t\t\t};\n\t\t}\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Links' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the colors used for links across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<TabPanel tabs={ tabs }>\n\t\t\t\t{ ( tab ) => {\n\t\t\t\t\tconst pseudoSelectorConfig =\n\t\t\t\t\t\tpseudoStates[ tab.name ] ?? null;\n\n\t\t\t\t\tif ( ! pseudoSelectorConfig ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ColorGradientControl\n\t\t\t\t\t\t\t\tclassName=\"edit-site-screen-link-color__control\"\n\t\t\t\t\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\t\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t\t\t\t\tshowTitle={ false }\n\t\t\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t\tcolorValue={ pseudoSelectorConfig.value }\n\t\t\t\t\t\t\t\tonColorChange={ pseudoSelectorConfig.handler }\n\t\t\t\t\t\t\t\tclearable={\n\t\t\t\t\t\t\t\t\tpseudoSelectorConfig.value ===\n\t\t\t\t\t\t\t\t\tpseudoSelectorConfig.userValue\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\theadingLevel={ 3 }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</TabPanel>\n\t\t</>\n\t);\n}\n\nexport default ScreenLinkColor;\n"]}
@@ -1,56 +0,0 @@
1
- import { createElement, Fragment } from "@wordpress/element";
2
-
3
- /**
4
- * WordPress dependencies
5
- */
6
- import { __ } from '@wordpress/i18n';
7
- import { __experimentalColorGradientControl as ColorGradientControl, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
8
- /**
9
- * Internal dependencies
10
- */
11
-
12
- import ScreenHeader from './header';
13
- import { useSupportedStyles, useColorsPerOrigin } from './hooks';
14
- import { unlock } from '../../private-apis';
15
- const {
16
- useGlobalSetting,
17
- useGlobalStyle
18
- } = unlock(blockEditorPrivateApis);
19
-
20
- function ScreenTextColor(_ref) {
21
- let {
22
- name,
23
- variation = ''
24
- } = _ref;
25
- const prefix = variation ? `variations.${variation}.` : '';
26
- const supports = useSupportedStyles(name);
27
- const [areCustomSolidsEnabled] = useGlobalSetting('color.custom', name);
28
- const [isTextEnabled] = useGlobalSetting('color.text', name);
29
- const colorsPerOrigin = useColorsPerOrigin(name);
30
- const hasTextColor = supports.includes('color') && isTextEnabled && (colorsPerOrigin.length > 0 || areCustomSolidsEnabled);
31
- const [color, setColor] = useGlobalStyle(prefix + 'color.text', name);
32
- const [userColor] = useGlobalStyle(prefix + 'color.text', name, 'user');
33
-
34
- if (!hasTextColor) {
35
- return null;
36
- }
37
-
38
- return createElement(Fragment, null, createElement(ScreenHeader, {
39
- title: __('Text'),
40
- description: __('Set the default color used for text across the site.')
41
- }), createElement(ColorGradientControl, {
42
- className: "edit-site-screen-text-color__control",
43
- colors: colorsPerOrigin,
44
- disableCustomColors: !areCustomSolidsEnabled,
45
- showTitle: false,
46
- enableAlpha: true,
47
- __experimentalIsRenderedInSidebar: true,
48
- colorValue: color,
49
- onColorChange: setColor,
50
- clearable: color === userColor,
51
- headingLevel: 3
52
- }));
53
- }
54
-
55
- export default ScreenTextColor;
56
- //# sourceMappingURL=screen-text-color.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-text-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","privateApis","blockEditorPrivateApis","ScreenHeader","useSupportedStyles","useColorsPerOrigin","unlock","useGlobalSetting","useGlobalStyle","ScreenTextColor","name","variation","prefix","supports","areCustomSolidsEnabled","isTextEnabled","colorsPerOrigin","hasTextColor","includes","length","color","setColor","userColor"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,WAAW,IAAIC,sBAFhB,QAGO,yBAHP;AAKA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SAASC,kBAAT,EAA6BC,kBAA7B,QAAuD,SAAvD;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAM;AAAEC,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,IAAuCF,MAAM,CAAEJ,sBAAF,CAAnD;;AAEA,SAASO,eAAT,OAAqD;AAAA,MAA3B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG;AAApB,GAA2B;AACpD,QAAMC,MAAM,GAAGD,SAAS,GAAI,cAAcA,SAAW,GAA7B,GAAkC,EAA1D;AACA,QAAME,QAAQ,GAAGT,kBAAkB,CAAEM,IAAF,CAAnC;AACA,QAAM,CAAEI,sBAAF,IAA6BP,gBAAgB,CAAE,cAAF,EAAkBG,IAAlB,CAAnD;AACA,QAAM,CAAEK,aAAF,IAAoBR,gBAAgB,CAAE,YAAF,EAAgBG,IAAhB,CAA1C;AACA,QAAMM,eAAe,GAAGX,kBAAkB,CAAEK,IAAF,CAA1C;AAEA,QAAMO,YAAY,GACjBJ,QAAQ,CAACK,QAAT,CAAmB,OAAnB,KACAH,aADA,KAEEC,eAAe,CAACG,MAAhB,GAAyB,CAAzB,IAA8BL,sBAFhC,CADD;AAKA,QAAM,CAAEM,KAAF,EAASC,QAAT,IAAsBb,cAAc,CAAEI,MAAM,GAAG,YAAX,EAAyBF,IAAzB,CAA1C;AACA,QAAM,CAAEY,SAAF,IAAgBd,cAAc,CAAEI,MAAM,GAAG,YAAX,EAAyBF,IAAzB,EAA+B,MAA/B,CAApC;;AAEA,MAAK,CAAEO,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,8BACC,cAAC,YAAD;AACC,IAAA,KAAK,EAAGnB,EAAE,CAAE,MAAF,CADX;AAEC,IAAA,WAAW,EAAGA,EAAE,CACf,sDADe;AAFjB,IADD,EAOC,cAAC,oBAAD;AACC,IAAA,SAAS,EAAC,sCADX;AAEC,IAAA,MAAM,EAAGkB,eAFV;AAGC,IAAA,mBAAmB,EAAG,CAAEF,sBAHzB;AAIC,IAAA,SAAS,EAAG,KAJb;AAKC,IAAA,WAAW,MALZ;AAMC,IAAA,iCAAiC,MANlC;AAOC,IAAA,UAAU,EAAGM,KAPd;AAQC,IAAA,aAAa,EAAGC,QARjB;AASC,IAAA,SAAS,EAAGD,KAAK,KAAKE,SATvB;AAUC,IAAA,YAAY,EAAG;AAVhB,IAPD,CADD;AAsBA;;AAED,eAAeb,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalColorGradientControl as ColorGradientControl,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport { useSupportedStyles, useColorsPerOrigin } from './hooks';\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction ScreenTextColor( { name, variation = '' } ) {\n\tconst prefix = variation ? `variations.${ variation }.` : '';\n\tconst supports = useSupportedStyles( name );\n\tconst [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );\n\tconst [ isTextEnabled ] = useGlobalSetting( 'color.text', name );\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\n\tconst hasTextColor =\n\t\tsupports.includes( 'color' ) &&\n\t\tisTextEnabled &&\n\t\t( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ color, setColor ] = useGlobalStyle( prefix + 'color.text', name );\n\tconst [ userColor ] = useGlobalStyle( prefix + 'color.text', name, 'user' );\n\n\tif ( ! hasTextColor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Text' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for text across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-text-color__control\"\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\tcolorValue={ color }\n\t\t\t\tonColorChange={ setColor }\n\t\t\t\tclearable={ color === userColor }\n\t\t\t\theadingLevel={ 3 }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenTextColor;\n"]}
@@ -1,146 +0,0 @@
1
- import { createElement, Fragment } from "@wordpress/element";
2
-
3
- /**
4
- * WordPress dependencies
5
- */
6
- import { useSelect } from '@wordpress/data';
7
- import { useState, useEffect } from '@wordpress/element';
8
- import { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';
9
- import { store as blockEditorStore, BlockEditorProvider } from '@wordpress/block-editor';
10
- import { speak } from '@wordpress/a11y';
11
- import { __ } from '@wordpress/i18n';
12
- /**
13
- * Internal dependencies
14
- */
15
-
16
- import NavigationMenu from './navigation-menu';
17
- const NAVIGATION_MENUS_QUERY = [{
18
- per_page: -1,
19
- status: 'publish'
20
- }];
21
- export default function NavigationInspector(_ref) {
22
- var _navigationMenus$;
23
-
24
- let {
25
- onSelect
26
- } = _ref;
27
- const {
28
- selectedNavigationBlockId,
29
- clientIdToRef,
30
- navigationMenus,
31
- isResolvingNavigationMenus,
32
- hasResolvedNavigationMenus,
33
- firstNavigationBlockId
34
- } = useSelect(select => {
35
- const {
36
- __experimentalGetActiveBlockIdByBlockNames,
37
- __experimentalGetGlobalBlocksByName,
38
- getBlock
39
- } = select(blockEditorStore);
40
- const {
41
- getEntityRecords,
42
- hasFinishedResolution,
43
- isResolving
44
- } = select(coreStore);
45
- const navigationMenusQuery = ['postType', 'wp_navigation', NAVIGATION_MENUS_QUERY[0]]; // Get the active Navigation block (if present).
46
-
47
- const selectedNavId = __experimentalGetActiveBlockIdByBlockNames('core/navigation'); // Get all Navigation blocks currently within the editor canvas.
48
-
49
-
50
- const navBlockIds = __experimentalGetGlobalBlocksByName('core/navigation');
51
-
52
- const idToRef = {};
53
- navBlockIds.forEach(id => {
54
- var _getBlock, _getBlock$attributes;
55
-
56
- idToRef[id] = (_getBlock = getBlock(id)) === null || _getBlock === void 0 ? void 0 : (_getBlock$attributes = _getBlock.attributes) === null || _getBlock$attributes === void 0 ? void 0 : _getBlock$attributes.ref;
57
- });
58
- return {
59
- selectedNavigationBlockId: selectedNavId,
60
- firstNavigationBlockId: navBlockIds === null || navBlockIds === void 0 ? void 0 : navBlockIds[0],
61
- clientIdToRef: idToRef,
62
- navigationMenus: getEntityRecords(...navigationMenusQuery),
63
- isResolvingNavigationMenus: isResolving('getEntityRecords', navigationMenusQuery),
64
- hasResolvedNavigationMenus: hasFinishedResolution('getEntityRecords', navigationMenusQuery)
65
- };
66
- }, []);
67
- const firstNavRefInTemplate = clientIdToRef[firstNavigationBlockId];
68
- const firstNavigationMenuRef = navigationMenus === null || navigationMenus === void 0 ? void 0 : (_navigationMenus$ = navigationMenus[0]) === null || _navigationMenus$ === void 0 ? void 0 : _navigationMenus$.id; // Default Navigation Menu is either:
69
- // - the Navigation Menu referenced by the first Nav block within the template.
70
- // - the first of the available Navigation Menus (`wp_navigation`) posts.
71
-
72
- const defaultNavigationMenuId = firstNavRefInTemplate || firstNavigationMenuRef; // The Navigation Menu manually selected by the user within the Nav inspector.
73
-
74
- const [currentMenuId, setCurrentMenuId] = useState(firstNavRefInTemplate); // If a Nav block is selected within the canvas then set the
75
- // Navigation Menu referenced by it's `ref` attribute to be
76
- // active within the Navigation sidebar.
77
-
78
- useEffect(() => {
79
- if (selectedNavigationBlockId) {
80
- setCurrentMenuId(clientIdToRef[selectedNavigationBlockId]);
81
- }
82
- }, [selectedNavigationBlockId]);
83
- const [innerBlocks, onInput, onChange] = useEntityBlockEditor('postType', 'wp_navigation', {
84
- id: currentMenuId || defaultNavigationMenuId
85
- });
86
- const {
87
- isLoadingInnerBlocks,
88
- hasLoadedInnerBlocks
89
- } = useSelect(select => {
90
- const {
91
- isResolving,
92
- hasFinishedResolution
93
- } = select(coreStore);
94
- return {
95
- isLoadingInnerBlocks: isResolving('getEntityRecord', ['postType', 'wp_navigation', currentMenuId || defaultNavigationMenuId]),
96
- hasLoadedInnerBlocks: hasFinishedResolution('getEntityRecord', ['postType', 'wp_navigation', currentMenuId || defaultNavigationMenuId])
97
- };
98
- }, [currentMenuId, defaultNavigationMenuId]);
99
- const isLoading = !(hasResolvedNavigationMenus && hasLoadedInnerBlocks);
100
- const hasNavigationMenus = !!(navigationMenus !== null && navigationMenus !== void 0 && navigationMenus.length); // Entity block editor will return entities that are not currently published.
101
- // Guard by only allowing their usage if there are published Nav Menus.
102
-
103
- const publishedInnerBlocks = hasNavigationMenus ? innerBlocks : [];
104
- const hasInnerBlocks = !!(publishedInnerBlocks !== null && publishedInnerBlocks !== void 0 && publishedInnerBlocks.length);
105
- useEffect(() => {
106
- if (isResolvingNavigationMenus) {
107
- speak('Loading Navigation sidebar menus.');
108
- }
109
-
110
- if (hasResolvedNavigationMenus) {
111
- speak('Navigation sidebar menus have loaded.');
112
- }
113
- }, [isResolvingNavigationMenus, hasResolvedNavigationMenus]);
114
- useEffect(() => {
115
- if (isLoadingInnerBlocks) {
116
- speak('Loading Navigation sidebar selected menu items.');
117
- }
118
-
119
- if (hasLoadedInnerBlocks) {
120
- speak('Navigation sidebar selected menu items have loaded.');
121
- }
122
- }, [isLoadingInnerBlocks, hasLoadedInnerBlocks]);
123
- return createElement("div", {
124
- className: "edit-site-navigation-inspector"
125
- }, hasResolvedNavigationMenus && !hasNavigationMenus && createElement("p", {
126
- className: "edit-site-navigation-inspector__empty-msg"
127
- }, __('There are no Navigation Menus.')), !hasResolvedNavigationMenus && createElement("div", {
128
- className: "edit-site-navigation-inspector__placeholder"
129
- }), isLoading && createElement(Fragment, null, createElement("div", {
130
- className: "edit-site-navigation-inspector__placeholder is-child"
131
- }), createElement("div", {
132
- className: "edit-site-navigation-inspector__placeholder is-child"
133
- }), createElement("div", {
134
- className: "edit-site-navigation-inspector__placeholder is-child"
135
- })), hasInnerBlocks && !isLoading && createElement(BlockEditorProvider, {
136
- value: publishedInnerBlocks,
137
- onChange: onChange,
138
- onInput: onInput
139
- }, createElement(NavigationMenu, {
140
- innerBlocks: publishedInnerBlocks,
141
- onSelect: onSelect
142
- })), !hasInnerBlocks && !isLoading && createElement("p", {
143
- className: "edit-site-navigation-inspector__empty-msg"
144
- }, __('Navigation Menu is empty.')));
145
- }
146
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/navigation-inspector/index.js"],"names":["useSelect","useState","useEffect","store","coreStore","useEntityBlockEditor","blockEditorStore","BlockEditorProvider","speak","__","NavigationMenu","NAVIGATION_MENUS_QUERY","per_page","status","NavigationInspector","onSelect","selectedNavigationBlockId","clientIdToRef","navigationMenus","isResolvingNavigationMenus","hasResolvedNavigationMenus","firstNavigationBlockId","select","__experimentalGetActiveBlockIdByBlockNames","__experimentalGetGlobalBlocksByName","getBlock","getEntityRecords","hasFinishedResolution","isResolving","navigationMenusQuery","selectedNavId","navBlockIds","idToRef","forEach","id","attributes","ref","firstNavRefInTemplate","firstNavigationMenuRef","defaultNavigationMenuId","currentMenuId","setCurrentMenuId","innerBlocks","onInput","onChange","isLoadingInnerBlocks","hasLoadedInnerBlocks","isLoading","hasNavigationMenus","length","publishedInnerBlocks","hasInnerBlocks"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AACA,SAASC,KAAK,IAAIC,SAAlB,EAA6BC,oBAA7B,QAAyD,sBAAzD;AACA,SACCF,KAAK,IAAIG,gBADV,EAECC,mBAFD,QAGO,yBAHP;AAIA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AAEA,MAAMC,sBAAsB,GAAG,CAAE;AAAEC,EAAAA,QAAQ,EAAE,CAAC,CAAb;AAAgBC,EAAAA,MAAM,EAAE;AAAxB,CAAF,CAA/B;AAEA,eAAe,SAASC,mBAAT,OAA6C;AAAA;;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AAC3D,QAAM;AACLC,IAAAA,yBADK;AAELC,IAAAA,aAFK;AAGLC,IAAAA,eAHK;AAILC,IAAAA,0BAJK;AAKLC,IAAAA,0BALK;AAMLC,IAAAA;AANK,MAOFrB,SAAS,CAAIsB,MAAF,IAAc;AAC5B,UAAM;AACLC,MAAAA,0CADK;AAELC,MAAAA,mCAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEhB,gBAAF,CAJV;AAMA,UAAM;AAAEoB,MAAAA,gBAAF;AAAoBC,MAAAA,qBAApB;AAA2CC,MAAAA;AAA3C,QACLN,MAAM,CAAElB,SAAF,CADP;AAGA,UAAMyB,oBAAoB,GAAG,CAC5B,UAD4B,EAE5B,eAF4B,EAG5BlB,sBAAsB,CAAE,CAAF,CAHM,CAA7B,CAV4B,CAgB5B;;AACA,UAAMmB,aAAa,GAClBP,0CAA0C,CAAE,iBAAF,CAD3C,C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CAAF,CAAL;AACA;AACD,GARQ,EAQN,CAAEW,0BAAF,EAA8BC,0BAA9B,CARM,CAAT;AAUAlB,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAK2C,oBAAL,EAA4B;AAC3BrC,MAAAA,KAAK,CAAE,iDAAF,CAAL;AACA;;AAED,QAAKsC,oBAAL,EAA4B;AAC3BtC,MAAAA,KAAK,CAAE,qDAAF,CAAL;AACA;AACD,GARQ,EAQN,CAAEqC,oBAAF,EAAwBC,oBAAxB,CARM,CAAT;AAUA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG1B,0BAA0B,IAAI,CAAE4B,kBAAhC,IACD;AAAG,IAAA,SAAS,EAAC;AAAb,KACGvC,EAAE,CAAE,gCAAF,CADL,CAFF,EAOG,CAAEW,0BAAF,IACD;AAAK,IAAA,SAAS,EAAC;AAAf,IARF,EAUG2B,SAAS,IACV,8BACC;AAAK,IAAA,SAAS,EAAC;AAAf,IADD,EAEC;AAAK,IAAA,SAAS,EAAC;AAAf,IAFD,EAGC;AAAK,IAAA,SAAS,EAAC;AAAf,IAHD,CAXF,EAiBGI,cAAc,IAAI,CAAEJ,SAApB,IACD,cAAC,mBAAD;AACC,IAAA,KAAK,EAAGG,oBADT;AAEC,IAAA,QAAQ,EAAGN,QAFZ;AAGC,IAAA,OAAO,EAAGD;AAHX,KAKC,cAAC,cAAD;AACC,IAAA,WAAW,EAAGO,oBADf;AAEC,IAAA,QAAQ,EAAGnC;AAFZ,IALD,CAlBF,EA8BG,CAAEoC,cAAF,IAAoB,CAAEJ,SAAtB,IACD;AAAG,IAAA,SAAS,EAAC;AAAb,KACGtC,EAAE,CAAE,2BAAF,CADL,CA/BF,CADD;AAsCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useEffect } from '@wordpress/element';\nimport { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tstore as blockEditorStore,\n\tBlockEditorProvider,\n} from '@wordpress/block-editor';\nimport { speak } from '@wordpress/a11y';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport NavigationMenu from './navigation-menu';\n\nconst NAVIGATION_MENUS_QUERY = [ { per_page: -1, status: 'publish' } ];\n\nexport default function NavigationInspector( { onSelect } ) {\n\tconst {\n\t\tselectedNavigationBlockId,\n\t\tclientIdToRef,\n\t\tnavigationMenus,\n\t\tisResolvingNavigationMenus,\n\t\thasResolvedNavigationMenus,\n\t\tfirstNavigationBlockId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetActiveBlockIdByBlockNames,\n\t\t\t__experimentalGetGlobalBlocksByName,\n\t\t\tgetBlock,\n\t\t} = select( blockEditorStore );\n\n\t\tconst { getEntityRecords, hasFinishedResolution, isResolving } =\n\t\t\tselect( coreStore );\n\n\t\tconst navigationMenusQuery = [\n\t\t\t'postType',\n\t\t\t'wp_navigation',\n\t\t\tNAVIGATION_MENUS_QUERY[ 0 ],\n\t\t];\n\n\t\t// Get the active Navigation block (if present).\n\t\tconst selectedNavId =\n\t\t\t__experimentalGetActiveBlockIdByBlockNames( 'core/navigation' );\n\n\t\t// Get all Navigation blocks currently within the editor canvas.\n\t\tconst navBlockIds =\n\t\t\t__experimentalGetGlobalBlocksByName( 'core/navigation' );\n\t\tconst idToRef = {};\n\t\tnavBlockIds.forEach( ( id ) => {\n\t\t\tidToRef[ id ] = getBlock( id )?.attributes?.ref;\n\t\t} );\n\t\treturn {\n\t\t\tselectedNavigationBlockId: selectedNavId,\n\t\t\tfirstNavigationBlockId: navBlockIds?.[ 0 ],\n\t\t\tclientIdToRef: idToRef,\n\t\t\tnavigationMenus: getEntityRecords( ...navigationMenusQuery ),\n\t\t\tisResolvingNavigationMenus: isResolving(\n\t\t\t\t'getEntityRecords',\n\t\t\t\tnavigationMenusQuery\n\t\t\t),\n\t\t\thasResolvedNavigationMenus: hasFinishedResolution(\n\t\t\t\t'getEntityRecords',\n\t\t\t\tnavigationMenusQuery\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst firstNavRefInTemplate = clientIdToRef[ firstNavigationBlockId ];\n\tconst firstNavigationMenuRef = navigationMenus?.[ 0 ]?.id;\n\n\t// Default Navigation Menu is either:\n\t// - the Navigation Menu referenced by the first Nav block within the template.\n\t// - the first of the available Navigation Menus (`wp_navigation`) posts.\n\tconst defaultNavigationMenuId =\n\t\tfirstNavRefInTemplate || firstNavigationMenuRef;\n\n\t// The Navigation Menu manually selected by the user within the Nav inspector.\n\tconst [ currentMenuId, setCurrentMenuId ] = useState(\n\t\tfirstNavRefInTemplate\n\t);\n\n\t// If a Nav block is selected within the canvas then set the\n\t// Navigation Menu referenced by it's `ref` attribute to be\n\t// active within the Navigation sidebar.\n\tuseEffect( () => {\n\t\tif ( selectedNavigationBlockId ) {\n\t\t\tsetCurrentMenuId( clientIdToRef[ selectedNavigationBlockId ] );\n\t\t}\n\t}, [ selectedNavigationBlockId ] );\n\n\tconst [ innerBlocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_navigation',\n\t\t{ id: currentMenuId || defaultNavigationMenuId }\n\t);\n\n\tconst { isLoadingInnerBlocks, hasLoadedInnerBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isResolving, hasFinishedResolution } = select( coreStore );\n\t\t\treturn {\n\t\t\t\tisLoadingInnerBlocks: isResolving( 'getEntityRecord', [\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_navigation',\n\t\t\t\t\tcurrentMenuId || defaultNavigationMenuId,\n\t\t\t\t] ),\n\t\t\t\thasLoadedInnerBlocks: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecord',\n\t\t\t\t\t[\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_navigation',\n\t\t\t\t\t\tcurrentMenuId || defaultNavigationMenuId,\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ currentMenuId, defaultNavigationMenuId ]\n\t);\n\n\tconst isLoading = ! ( hasResolvedNavigationMenus && hasLoadedInnerBlocks );\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\t// Entity block editor will return entities that are not currently published.\n\t// Guard by only allowing their usage if there are published Nav Menus.\n\tconst publishedInnerBlocks = hasNavigationMenus ? innerBlocks : [];\n\n\tconst hasInnerBlocks = !! publishedInnerBlocks?.length;\n\n\tuseEffect( () => {\n\t\tif ( isResolvingNavigationMenus ) {\n\t\t\tspeak( 'Loading Navigation sidebar menus.' );\n\t\t}\n\n\t\tif ( hasResolvedNavigationMenus ) {\n\t\t\tspeak( 'Navigation sidebar menus have loaded.' );\n\t\t}\n\t}, [ isResolvingNavigationMenus, hasResolvedNavigationMenus ] );\n\n\tuseEffect( () => {\n\t\tif ( isLoadingInnerBlocks ) {\n\t\t\tspeak( 'Loading Navigation sidebar selected menu items.' );\n\t\t}\n\n\t\tif ( hasLoadedInnerBlocks ) {\n\t\t\tspeak( 'Navigation sidebar selected menu items have loaded.' );\n\t\t}\n\t}, [ isLoadingInnerBlocks, hasLoadedInnerBlocks ] );\n\n\treturn (\n\t\t<div className=\"edit-site-navigation-inspector\">\n\t\t\t{ hasResolvedNavigationMenus && ! hasNavigationMenus && (\n\t\t\t\t<p className=\"edit-site-navigation-inspector__empty-msg\">\n\t\t\t\t\t{ __( 'There are no Navigation Menus.' ) }\n\t\t\t\t</p>\n\t\t\t) }\n\n\t\t\t{ ! hasResolvedNavigationMenus && (\n\t\t\t\t<div className=\"edit-site-navigation-inspector__placeholder\" />\n\t\t\t) }\n\t\t\t{ isLoading && (\n\t\t\t\t<>\n\t\t\t\t\t<div className=\"edit-site-navigation-inspector__placeholder is-child\" />\n\t\t\t\t\t<div className=\"edit-site-navigation-inspector__placeholder is-child\" />\n\t\t\t\t\t<div className=\"edit-site-navigation-inspector__placeholder is-child\" />\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ hasInnerBlocks && ! isLoading && (\n\t\t\t\t<BlockEditorProvider\n\t\t\t\t\tvalue={ publishedInnerBlocks }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tonInput={ onInput }\n\t\t\t\t>\n\t\t\t\t\t<NavigationMenu\n\t\t\t\t\t\tinnerBlocks={ publishedInnerBlocks }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t/>\n\t\t\t\t</BlockEditorProvider>\n\t\t\t) }\n\n\t\t\t{ ! hasInnerBlocks && ! isLoading && (\n\t\t\t\t<p className=\"edit-site-navigation-inspector__empty-msg\">\n\t\t\t\t\t{ __( 'Navigation Menu is empty.' ) }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"]}