@wordpress/edit-site 5.4.0 → 5.6.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 (339) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/add-custom-template-modal.js +12 -3
  3. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  4. package/build/components/add-new-template/new-template-part.js +8 -7
  5. package/build/components/add-new-template/new-template-part.js.map +1 -1
  6. package/build/components/add-new-template/new-template.js +19 -16
  7. package/build/components/add-new-template/new-template.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 +2 -1
  11. package/build/components/block-editor/editor-canvas.js.map +1 -1
  12. package/build/components/editor/index.js +5 -7
  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 +13 -11
  17. package/build/components/global-styles/context-menu.js.map +1 -1
  18. package/build/components/global-styles/dimensions-panel.js +41 -487
  19. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  20. package/build/components/global-styles/duotone-panel.js +78 -0
  21. package/build/components/global-styles/duotone-panel.js.map +1 -0
  22. package/build/components/global-styles/filter-utils.js +17 -0
  23. package/build/components/global-styles/filter-utils.js.map +1 -0
  24. package/build/components/global-styles/hooks.js +11 -26
  25. package/build/components/global-styles/hooks.js.map +1 -1
  26. package/build/components/global-styles/preview.js +9 -5
  27. package/build/components/global-styles/preview.js.map +1 -1
  28. package/build/components/global-styles/screen-block-list.js +6 -11
  29. package/build/components/global-styles/screen-block-list.js.map +1 -1
  30. package/build/components/global-styles/screen-border.js +14 -6
  31. package/build/components/global-styles/screen-border.js.map +1 -1
  32. package/build/components/global-styles/screen-filters.js +46 -0
  33. package/build/components/global-styles/screen-filters.js.map +1 -0
  34. package/build/components/global-styles/screen-layout.js +13 -5
  35. package/build/components/global-styles/screen-layout.js.map +1 -1
  36. package/build/components/global-styles/screen-root.js +2 -1
  37. package/build/components/global-styles/screen-root.js.map +1 -1
  38. package/build/components/global-styles/screen-style-variations.js +2 -1
  39. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  40. package/build/components/global-styles/screen-variations.js +1 -1
  41. package/build/components/global-styles/screen-variations.js.map +1 -1
  42. package/build/components/global-styles/shadow-panel.js +6 -4
  43. package/build/components/global-styles/shadow-panel.js.map +1 -1
  44. package/build/components/global-styles/typography-panel.js +2 -5
  45. package/build/components/global-styles/typography-panel.js.map +1 -1
  46. package/build/components/global-styles/ui.js +7 -1
  47. package/build/components/global-styles/ui.js.map +1 -1
  48. package/build/components/keyboard-shortcut-help-modal/config.js +12 -0
  49. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  50. package/build/components/keyboard-shortcuts/edit-mode.js +124 -0
  51. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -0
  52. package/build/components/keyboard-shortcuts/global.js +48 -0
  53. package/build/components/keyboard-shortcuts/global.js.map +1 -0
  54. package/build/components/keyboard-shortcuts/index.js +67 -0
  55. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  56. package/build/components/keyboard-shortcuts/register.js +153 -0
  57. package/build/components/keyboard-shortcuts/register.js.map +1 -0
  58. package/build/components/layout/index.js +12 -1
  59. package/build/components/layout/index.js.map +1 -1
  60. package/build/components/list/added-by.js +127 -136
  61. package/build/components/list/added-by.js.map +1 -1
  62. package/build/components/list/index.js +2 -1
  63. package/build/components/list/index.js.map +1 -1
  64. package/build/components/list/table.js +9 -7
  65. package/build/components/list/table.js.map +1 -1
  66. package/build/components/routes/link.js +4 -1
  67. package/build/components/routes/link.js.map +1 -1
  68. package/build/components/save-hub/index.js +82 -0
  69. package/build/components/save-hub/index.js.map +1 -0
  70. package/build/components/save-panel/index.js +11 -1
  71. package/build/components/save-panel/index.js.map +1 -1
  72. package/build/components/sidebar/index.js +27 -17
  73. package/build/components/sidebar/index.js.map +1 -1
  74. package/build/components/sidebar-button/index.js +30 -0
  75. package/build/components/sidebar-button/index.js.map +1 -0
  76. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
  77. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  78. package/build/components/sidebar-navigation-screen/index.js +14 -11
  79. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  80. package/build/components/sidebar-navigation-screen-main/index.js +16 -16
  81. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  82. package/build/components/sidebar-navigation-screen-navigation-item/index.js +22 -26
  83. package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  84. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +97 -14
  85. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  86. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
  87. package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  88. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
  89. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  90. package/build/components/sidebar-navigation-screen-template/index.js +66 -27
  91. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  92. package/build/components/sidebar-navigation-screen-templates/index.js +30 -17
  93. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  94. package/build/components/sidebar-navigation-screen-templates-browse/index.js +14 -10
  95. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  96. package/build/components/site-hub/index.js +3 -1
  97. package/build/components/site-hub/index.js.map +1 -1
  98. package/build/components/style-book/index.js +151 -21
  99. package/build/components/style-book/index.js.map +1 -1
  100. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
  101. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  102. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  103. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  104. package/build/components/sync-state-with-url/use-sync-path-with-url.js +67 -18
  105. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  106. package/build/components/template-details/index.js +5 -10
  107. package/build/components/template-details/index.js.map +1 -1
  108. package/build/components/template-part-converter/convert-to-regular.js +8 -12
  109. package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
  110. package/build/components/template-part-converter/convert-to-template-part.js +2 -2
  111. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  112. package/build/components/template-part-converter/index.js +19 -14
  113. package/build/components/template-part-converter/index.js.map +1 -1
  114. package/build/components/use-edited-entity-record/index.js +6 -6
  115. package/build/components/use-edited-entity-record/index.js.map +1 -1
  116. package/build/index.js +13 -22
  117. package/build/index.js.map +1 -1
  118. package/build/store/actions.js +2 -2
  119. package/build/store/actions.js.map +1 -1
  120. package/build/utils/get-is-list-page.js +1 -1
  121. package/build/utils/get-is-list-page.js.map +1 -1
  122. package/build/utils/history.js +8 -2
  123. package/build/utils/history.js.map +1 -1
  124. package/build-module/components/add-new-template/add-custom-template-modal.js +13 -4
  125. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  126. package/build-module/components/add-new-template/new-template-part.js +8 -7
  127. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  128. package/build-module/components/add-new-template/new-template.js +21 -17
  129. package/build-module/components/add-new-template/new-template.js.map +1 -1
  130. package/build-module/components/app/index.js +3 -2
  131. package/build-module/components/app/index.js.map +1 -1
  132. package/build-module/components/block-editor/editor-canvas.js +2 -1
  133. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  134. package/build-module/components/editor/index.js +5 -6
  135. package/build-module/components/editor/index.js.map +1 -1
  136. package/build-module/components/global-styles/border-panel.js +21 -157
  137. package/build-module/components/global-styles/border-panel.js.map +1 -1
  138. package/build-module/components/global-styles/context-menu.js +14 -11
  139. package/build-module/components/global-styles/context-menu.js.map +1 -1
  140. package/build-module/components/global-styles/dimensions-panel.js +43 -480
  141. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  142. package/build-module/components/global-styles/duotone-panel.js +67 -0
  143. package/build-module/components/global-styles/duotone-panel.js.map +1 -0
  144. package/build-module/components/global-styles/filter-utils.js +9 -0
  145. package/build-module/components/global-styles/filter-utils.js.map +1 -0
  146. package/build-module/components/global-styles/hooks.js +11 -26
  147. package/build-module/components/global-styles/hooks.js.map +1 -1
  148. package/build-module/components/global-styles/preview.js +10 -6
  149. package/build-module/components/global-styles/preview.js.map +1 -1
  150. package/build-module/components/global-styles/screen-block-list.js +6 -8
  151. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  152. package/build-module/components/global-styles/screen-border.js +12 -3
  153. package/build-module/components/global-styles/screen-border.js.map +1 -1
  154. package/build-module/components/global-styles/screen-filters.js +33 -0
  155. package/build-module/components/global-styles/screen-filters.js.map +1 -0
  156. package/build-module/components/global-styles/screen-layout.js +11 -2
  157. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  158. package/build-module/components/global-styles/screen-root.js +2 -1
  159. package/build-module/components/global-styles/screen-root.js.map +1 -1
  160. package/build-module/components/global-styles/screen-style-variations.js +2 -1
  161. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  162. package/build-module/components/global-styles/screen-variations.js +1 -1
  163. package/build-module/components/global-styles/screen-variations.js.map +1 -1
  164. package/build-module/components/global-styles/shadow-panel.js +6 -4
  165. package/build-module/components/global-styles/shadow-panel.js.map +1 -1
  166. package/build-module/components/global-styles/typography-panel.js +2 -5
  167. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  168. package/build-module/components/global-styles/ui.js +6 -1
  169. package/build-module/components/global-styles/ui.js.map +1 -1
  170. package/build-module/components/keyboard-shortcut-help-modal/config.js +12 -0
  171. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  172. package/build-module/components/keyboard-shortcuts/edit-mode.js +108 -0
  173. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -0
  174. package/build-module/components/keyboard-shortcuts/global.js +37 -0
  175. package/build-module/components/keyboard-shortcuts/global.js.map +1 -0
  176. package/build-module/components/keyboard-shortcuts/index.js +65 -0
  177. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  178. package/build-module/components/keyboard-shortcuts/register.js +141 -0
  179. package/build-module/components/keyboard-shortcuts/register.js.map +1 -0
  180. package/build-module/components/layout/index.js +10 -1
  181. package/build-module/components/layout/index.js.map +1 -1
  182. package/build-module/components/list/added-by.js +126 -138
  183. package/build-module/components/list/added-by.js.map +1 -1
  184. package/build-module/components/list/index.js +2 -1
  185. package/build-module/components/list/index.js.map +1 -1
  186. package/build-module/components/list/table.js +9 -7
  187. package/build-module/components/list/table.js.map +1 -1
  188. package/build-module/components/routes/link.js +5 -2
  189. package/build-module/components/routes/link.js.map +1 -1
  190. package/build-module/components/save-hub/index.js +68 -0
  191. package/build-module/components/save-hub/index.js.map +1 -0
  192. package/build-module/components/save-panel/index.js +8 -1
  193. package/build-module/components/save-panel/index.js.map +1 -1
  194. package/build-module/components/sidebar/index.js +24 -19
  195. package/build-module/components/sidebar/index.js.map +1 -1
  196. package/build-module/components/sidebar-button/index.js +18 -0
  197. package/build-module/components/sidebar-button/index.js.map +1 -0
  198. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
  199. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  200. package/build-module/components/sidebar-navigation-screen/index.js +12 -12
  201. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  202. package/build-module/components/sidebar-navigation-screen-main/index.js +16 -16
  203. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  204. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +24 -30
  205. package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
  206. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +91 -14
  207. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  208. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
  209. package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
  210. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
  211. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
  212. package/build-module/components/sidebar-navigation-screen-template/index.js +67 -30
  213. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  214. package/build-module/components/sidebar-navigation-screen-templates/index.js +28 -18
  215. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  216. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +13 -10
  217. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  218. package/build-module/components/site-hub/index.js +3 -1
  219. package/build-module/components/site-hub/index.js.map +1 -1
  220. package/build-module/components/style-book/index.js +152 -25
  221. package/build-module/components/style-book/index.js.map +1 -1
  222. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
  223. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  224. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
  225. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  226. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +65 -18
  227. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  228. package/build-module/components/template-details/index.js +5 -9
  229. package/build-module/components/template-details/index.js.map +1 -1
  230. package/build-module/components/template-part-converter/convert-to-regular.js +9 -13
  231. package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
  232. package/build-module/components/template-part-converter/convert-to-template-part.js +3 -3
  233. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  234. package/build-module/components/template-part-converter/index.js +20 -15
  235. package/build-module/components/template-part-converter/index.js.map +1 -1
  236. package/build-module/components/use-edited-entity-record/index.js +6 -6
  237. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  238. package/build-module/index.js +16 -23
  239. package/build-module/index.js.map +1 -1
  240. package/build-module/store/actions.js +2 -2
  241. package/build-module/store/actions.js.map +1 -1
  242. package/build-module/utils/get-is-list-page.js +1 -1
  243. package/build-module/utils/get-is-list-page.js.map +1 -1
  244. package/build-module/utils/history.js +9 -3
  245. package/build-module/utils/history.js.map +1 -1
  246. package/build-style/style-rtl.css +203 -143
  247. package/build-style/style.css +203 -143
  248. package/package.json +31 -31
  249. package/src/components/add-new-template/add-custom-template-modal.js +14 -10
  250. package/src/components/add-new-template/new-template-part.js +7 -9
  251. package/src/components/add-new-template/new-template.js +60 -38
  252. package/src/components/add-new-template/style.scss +12 -6
  253. package/src/components/app/index.js +9 -6
  254. package/src/components/block-editor/editor-canvas.js +2 -1
  255. package/src/components/block-editor/style.scss +1 -1
  256. package/src/components/editor/index.js +62 -65
  257. package/src/components/editor/style.scss +0 -6
  258. package/src/components/global-styles/border-panel.js +24 -199
  259. package/src/components/global-styles/context-menu.js +18 -12
  260. package/src/components/global-styles/dimensions-panel.js +43 -577
  261. package/src/components/global-styles/duotone-panel.js +82 -0
  262. package/src/components/global-styles/filter-utils.js +9 -0
  263. package/src/components/global-styles/hooks.js +12 -36
  264. package/src/components/global-styles/preview.js +155 -140
  265. package/src/components/global-styles/screen-block-list.js +6 -11
  266. package/src/components/global-styles/screen-border.js +10 -3
  267. package/src/components/global-styles/screen-filters.js +27 -0
  268. package/src/components/global-styles/screen-layout.js +9 -2
  269. package/src/components/global-styles/screen-root.js +1 -1
  270. package/src/components/global-styles/screen-style-variations.js +5 -1
  271. package/src/components/global-styles/screen-variations.js +0 -1
  272. package/src/components/global-styles/shadow-panel.js +4 -3
  273. package/src/components/global-styles/style.scss +10 -0
  274. package/src/components/global-styles/typography-panel.js +5 -7
  275. package/src/components/global-styles/ui.js +6 -1
  276. package/src/components/keyboard-shortcut-help-modal/config.js +10 -0
  277. package/src/components/keyboard-shortcuts/edit-mode.js +116 -0
  278. package/src/components/keyboard-shortcuts/global.js +35 -0
  279. package/src/components/keyboard-shortcuts/index.js +70 -0
  280. package/src/components/keyboard-shortcuts/register.js +157 -0
  281. package/src/components/layout/index.js +19 -0
  282. package/src/components/layout/style.scss +9 -4
  283. package/src/components/list/added-by.js +152 -155
  284. package/src/components/list/index.js +3 -1
  285. package/src/components/list/style.scss +5 -13
  286. package/src/components/list/table.js +11 -9
  287. package/src/components/routes/link.js +9 -2
  288. package/src/components/save-hub/index.js +78 -0
  289. package/src/components/save-hub/style.scss +15 -0
  290. package/src/components/save-panel/index.js +8 -1
  291. package/src/components/sidebar/index.js +33 -16
  292. package/src/components/sidebar/style.scss +4 -3
  293. package/src/components/sidebar-button/index.js +21 -0
  294. package/src/components/sidebar-button/style.scss +24 -0
  295. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +3 -7
  296. package/src/components/sidebar-edit-mode/style.scss +16 -0
  297. package/src/components/sidebar-navigation-item/style.scss +1 -23
  298. package/src/components/sidebar-navigation-screen/index.js +37 -38
  299. package/src/components/sidebar-navigation-screen/style.scss +16 -9
  300. package/src/components/sidebar-navigation-screen-main/index.js +24 -11
  301. package/src/components/sidebar-navigation-screen-navigation-item/index.js +39 -26
  302. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +99 -12
  303. package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
  304. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
  305. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +108 -1
  306. package/src/components/sidebar-navigation-screen-template/index.js +89 -30
  307. package/src/components/sidebar-navigation-screen-template/style.scss +25 -0
  308. package/src/components/sidebar-navigation-screen-templates/index.js +29 -14
  309. package/src/components/sidebar-navigation-screen-templates/style.scss +0 -5
  310. package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -6
  311. package/src/components/site-hub/index.js +5 -1
  312. package/src/components/site-hub/style.scss +5 -1
  313. package/src/components/style-book/index.js +234 -55
  314. package/src/components/style-book/style.scss +1 -45
  315. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +28 -23
  316. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
  317. package/src/components/sync-state-with-url/use-sync-path-with-url.js +77 -17
  318. package/src/components/template-details/index.js +4 -8
  319. package/src/components/template-part-converter/convert-to-regular.js +10 -17
  320. package/src/components/template-part-converter/convert-to-template-part.js +9 -16
  321. package/src/components/template-part-converter/index.js +28 -12
  322. package/src/components/use-edited-entity-record/index.js +26 -18
  323. package/src/index.js +11 -22
  324. package/src/store/actions.js +2 -2
  325. package/src/store/test/actions.js +0 -2
  326. package/src/style.scss +3 -1
  327. package/src/utils/get-is-list-page.js +1 -1
  328. package/src/utils/history.js +13 -9
  329. package/build/components/navigation-inspector/index.js +0 -161
  330. package/build/components/navigation-inspector/index.js.map +0 -1
  331. package/build/components/navigation-inspector/navigation-menu.js +0 -62
  332. package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
  333. package/build-module/components/navigation-inspector/index.js +0 -146
  334. package/build-module/components/navigation-inspector/index.js.map +0 -1
  335. package/build-module/components/navigation-inspector/navigation-menu.js +0 -52
  336. package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
  337. package/src/components/navigation-inspector/index.js +0 -191
  338. package/src/components/navigation-inspector/navigation-menu.js +0 -66
  339. package/src/components/navigation-inspector/style.scss +0 -46
@@ -0,0 +1,82 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import {
6
+ __experimentalToolsPanel as ToolsPanel,
7
+ DuotonePicker,
8
+ } from '@wordpress/components';
9
+ import {
10
+ privateApis as blockEditorPrivateApis,
11
+ useSetting,
12
+ } from '@wordpress/block-editor';
13
+ import { useMemo } from '@wordpress/element';
14
+
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import { unlock } from '../../private-apis';
19
+ const { useGlobalStyle } = unlock( blockEditorPrivateApis );
20
+
21
+ const EMPTY_ARRAY = [];
22
+
23
+ function useMultiOriginPresets( { presetSetting, defaultSetting } ) {
24
+ const disableDefault = ! useSetting( defaultSetting );
25
+ const userPresets =
26
+ useSetting( `${ presetSetting }.custom` ) || EMPTY_ARRAY;
27
+ const themePresets =
28
+ useSetting( `${ presetSetting }.theme` ) || EMPTY_ARRAY;
29
+ const defaultPresets =
30
+ useSetting( `${ presetSetting }.default` ) || EMPTY_ARRAY;
31
+ return useMemo(
32
+ () => [
33
+ ...userPresets,
34
+ ...themePresets,
35
+ ...( disableDefault ? EMPTY_ARRAY : defaultPresets ),
36
+ ],
37
+ [ disableDefault, userPresets, themePresets, defaultPresets ]
38
+ );
39
+ }
40
+
41
+ function DuotonePanel( { name } ) {
42
+ const [ themeDuotone, setThemeDuotone ] = useGlobalStyle(
43
+ 'filter.duotone',
44
+ name
45
+ );
46
+
47
+ const duotonePalette = useMultiOriginPresets( {
48
+ presetSetting: 'color.duotone',
49
+ defaultSetting: 'color.defaultDuotone',
50
+ } );
51
+ const colorPalette = useMultiOriginPresets( {
52
+ presetSetting: 'color.palette',
53
+ defaultSetting: 'color.defaultPalette',
54
+ } );
55
+
56
+ if ( duotonePalette?.length === 0 ) {
57
+ return null;
58
+ }
59
+ return (
60
+ <>
61
+ <ToolsPanel label={ __( 'Duotone' ) }>
62
+ <span className="span-columns">
63
+ { __(
64
+ 'Create a two-tone color effect without losing your original image.'
65
+ ) }
66
+ </span>
67
+ <div className="span-columns">
68
+ <DuotonePicker
69
+ colorPalette={ colorPalette }
70
+ duotonePalette={ duotonePalette }
71
+ disableCustomColors={ true }
72
+ disableCustomDuotone={ true }
73
+ value={ themeDuotone }
74
+ onChange={ setThemeDuotone }
75
+ />
76
+ </div>
77
+ </ToolsPanel>
78
+ </>
79
+ );
80
+ }
81
+
82
+ export default DuotonePanel;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { useSupportedStyles } from './hooks';
5
+
6
+ export function useHasFilterPanel( name ) {
7
+ const supports = useSupportedStyles( name );
8
+ return supports.includes( 'filter' );
9
+ }
@@ -18,7 +18,8 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
18
18
  import { unlock } from '../../private-apis';
19
19
  import { useSelect } from '@wordpress/data';
20
20
 
21
- const { useGlobalSetting } = unlock( blockEditorPrivateApis );
21
+ const { useGlobalSetting, useColorsPerOrigin: useColorsPerOriginFromSettings } =
22
+ unlock( blockEditorPrivateApis );
22
23
 
23
24
  // Enable colord's a11y plugin.
24
25
  extend( [ a11yPlugin ] );
@@ -31,41 +32,16 @@ export function useColorsPerOrigin( name ) {
31
32
  'color.defaultPalette'
32
33
  );
33
34
 
34
- return useMemo( () => {
35
- const result = [];
36
- if ( themeColors && themeColors.length ) {
37
- result.push( {
38
- name: _x(
39
- 'Theme',
40
- 'Indicates this palette comes from the theme.'
41
- ),
42
- colors: themeColors,
43
- } );
44
- }
45
- if (
46
- shouldDisplayDefaultColors &&
47
- defaultColors &&
48
- defaultColors.length
49
- ) {
50
- result.push( {
51
- name: _x(
52
- 'Default',
53
- 'Indicates this palette comes from WordPress.'
54
- ),
55
- colors: defaultColors,
56
- } );
57
- }
58
- if ( customColors && customColors.length ) {
59
- result.push( {
60
- name: _x(
61
- 'Custom',
62
- 'Indicates this palette is created by the user.'
63
- ),
64
- colors: customColors,
65
- } );
66
- }
67
- return result;
68
- }, [ customColors, themeColors, defaultColors ] );
35
+ return useColorsPerOriginFromSettings( {
36
+ color: {
37
+ palette: {
38
+ custom: customColors,
39
+ theme: themeColors,
40
+ default: defaultColors,
41
+ },
42
+ defaultPalette: shouldDisplayDefaultColors,
43
+ },
44
+ } );
69
45
  }
70
46
 
71
47
  export function useGradientsPerOrigin( name ) {
@@ -107,163 +107,178 @@ const StylesPreview = ( { label, isFocused, withHoverView } ) => {
107
107
 
108
108
  return styles;
109
109
  }, [ styles ] );
110
+ const isReady = !! width;
110
111
 
111
112
  return (
112
- <Iframe
113
- className="edit-site-global-styles-preview__iframe"
114
- head={ <EditorStyles styles={ editorStyles } /> }
115
- style={ {
116
- height: normalizedHeight * ratio,
117
- visibility: ! width ? 'hidden' : 'visible',
118
- } }
119
- onMouseEnter={ () => setIsHovered( true ) }
120
- onMouseLeave={ () => setIsHovered( false ) }
121
- tabIndex={ -1 }
122
- >
123
- { containerResizeListener }
124
- <motion.div
125
- style={ {
126
- height: normalizedHeight * ratio,
127
- width: '100%',
128
- background: gradientValue ?? backgroundColor,
129
- cursor: 'pointer',
130
- } }
131
- initial="start"
132
- animate={
133
- ( isHovered || isFocused ) && ! disableMotion && label
134
- ? 'hover'
135
- : 'start'
136
- }
137
- >
138
- <motion.div
139
- variants={ firstFrame }
113
+ <>
114
+ <div style={ { position: 'relative' } }>
115
+ { containerResizeListener }
116
+ </div>
117
+ { isReady && (
118
+ <Iframe
119
+ className="edit-site-global-styles-preview__iframe"
120
+ head={ <EditorStyles styles={ editorStyles } /> }
140
121
  style={ {
141
- height: '100%',
142
- overflow: 'hidden',
122
+ height: normalizedHeight * ratio,
143
123
  } }
124
+ onMouseEnter={ () => setIsHovered( true ) }
125
+ onMouseLeave={ () => setIsHovered( false ) }
126
+ tabIndex={ -1 }
144
127
  >
145
- <HStack
146
- spacing={ 10 * ratio }
147
- justify="center"
128
+ <motion.div
148
129
  style={ {
149
- height: '100%',
150
- overflow: 'hidden',
130
+ height: normalizedHeight * ratio,
131
+ width: '100%',
132
+ background: gradientValue ?? backgroundColor,
133
+ cursor: 'pointer',
151
134
  } }
135
+ initial="start"
136
+ animate={
137
+ ( isHovered || isFocused ) &&
138
+ ! disableMotion &&
139
+ label
140
+ ? 'hover'
141
+ : 'start'
142
+ }
152
143
  >
153
144
  <motion.div
145
+ variants={ firstFrame }
154
146
  style={ {
155
- fontFamily: headingFontFamily,
156
- fontSize: 65 * ratio,
157
- color: headingColor,
158
- fontWeight: headingFontWeight,
147
+ height: '100%',
148
+ overflow: 'hidden',
159
149
  } }
160
- animate={ { scale: 1, opacity: 1 } }
161
- initial={ { scale: 0.1, opacity: 0 } }
162
- transition={ { delay: 0.3, type: 'tween' } }
163
150
  >
164
- Aa
165
- </motion.div>
166
- <VStack spacing={ 4 * ratio }>
167
- { highlightedColors.map(
168
- ( { slug, color }, index ) => (
169
- <motion.div
170
- key={ slug }
171
- style={ {
172
- height:
173
- normalizedColorSwatchSize *
174
- ratio,
175
- width:
176
- normalizedColorSwatchSize *
177
- ratio,
178
- background: color,
179
- borderRadius:
180
- ( normalizedColorSwatchSize *
181
- ratio ) /
182
- 2,
183
- } }
184
- animate={ { scale: 1, opacity: 1 } }
185
- initial={ { scale: 0.1, opacity: 0 } }
186
- transition={ {
187
- delay: index === 1 ? 0.2 : 0.1,
188
- } }
189
- />
190
- )
191
- ) }
192
- </VStack>
193
- </HStack>
194
- </motion.div>
195
- <motion.div
196
- variants={ withHoverView && midFrame }
197
- style={ {
198
- height: '100%',
199
- width: '100%',
200
- position: 'absolute',
201
- top: 0,
202
- overflow: 'hidden',
203
- filter: 'blur(60px)',
204
- opacity: 0.1,
205
- } }
206
- >
207
- <HStack
208
- spacing={ 0 }
209
- justify="flex-start"
210
- style={ {
211
- height: '100%',
212
- overflow: 'hidden',
213
- } }
214
- >
215
- { paletteColors
216
- .slice( 0, 4 )
217
- .map( ( { color }, index ) => (
218
- <div
219
- key={ index }
151
+ <HStack
152
+ spacing={ 10 * ratio }
153
+ justify="center"
154
+ style={ {
155
+ height: '100%',
156
+ overflow: 'hidden',
157
+ } }
158
+ >
159
+ <motion.div
220
160
  style={ {
221
- height: '100%',
222
- background: color,
223
- flexGrow: 1,
161
+ fontFamily: headingFontFamily,
162
+ fontSize: 65 * ratio,
163
+ color: headingColor,
164
+ fontWeight: headingFontWeight,
224
165
  } }
225
- />
226
- ) ) }
227
- </HStack>
228
- </motion.div>
229
- <motion.div
230
- variants={ secondFrame }
231
- style={ {
232
- height: '100%',
233
- width: '100%',
234
- overflow: 'hidden',
235
- position: 'absolute',
236
- top: 0,
237
- } }
238
- >
239
- <VStack
240
- spacing={ 3 * ratio }
241
- justify="center"
242
- style={ {
243
- height: '100%',
244
- overflow: 'hidden',
245
- padding: 10 * ratio,
246
- boxSizing: 'border-box',
247
- } }
248
- >
249
- { label && (
250
- <div
166
+ animate={ { scale: 1, opacity: 1 } }
167
+ initial={ { scale: 0.1, opacity: 0 } }
168
+ transition={ { delay: 0.3, type: 'tween' } }
169
+ >
170
+ Aa
171
+ </motion.div>
172
+ <VStack spacing={ 4 * ratio }>
173
+ { highlightedColors.map(
174
+ ( { slug, color }, index ) => (
175
+ <motion.div
176
+ key={ slug }
177
+ style={ {
178
+ height:
179
+ normalizedColorSwatchSize *
180
+ ratio,
181
+ width:
182
+ normalizedColorSwatchSize *
183
+ ratio,
184
+ background: color,
185
+ borderRadius:
186
+ ( normalizedColorSwatchSize *
187
+ ratio ) /
188
+ 2,
189
+ } }
190
+ animate={ {
191
+ scale: 1,
192
+ opacity: 1,
193
+ } }
194
+ initial={ {
195
+ scale: 0.1,
196
+ opacity: 0,
197
+ } }
198
+ transition={ {
199
+ delay:
200
+ index === 1 ? 0.2 : 0.1,
201
+ } }
202
+ />
203
+ )
204
+ ) }
205
+ </VStack>
206
+ </HStack>
207
+ </motion.div>
208
+ <motion.div
209
+ variants={ withHoverView && midFrame }
210
+ style={ {
211
+ height: '100%',
212
+ width: '100%',
213
+ position: 'absolute',
214
+ top: 0,
215
+ overflow: 'hidden',
216
+ filter: 'blur(60px)',
217
+ opacity: 0.1,
218
+ } }
219
+ >
220
+ <HStack
221
+ spacing={ 0 }
222
+ justify="flex-start"
251
223
  style={ {
252
- fontSize: 40 * ratio,
253
- fontFamily: headingFontFamily,
254
- color: headingColor,
255
- fontWeight: headingFontWeight,
256
- lineHeight: '1em',
257
- textAlign: 'center',
224
+ height: '100%',
225
+ overflow: 'hidden',
258
226
  } }
259
227
  >
260
- { label }
261
- </div>
262
- ) }
263
- </VStack>
264
- </motion.div>
265
- </motion.div>
266
- </Iframe>
228
+ { paletteColors
229
+ .slice( 0, 4 )
230
+ .map( ( { color }, index ) => (
231
+ <div
232
+ key={ index }
233
+ style={ {
234
+ height: '100%',
235
+ background: color,
236
+ flexGrow: 1,
237
+ } }
238
+ />
239
+ ) ) }
240
+ </HStack>
241
+ </motion.div>
242
+ <motion.div
243
+ variants={ secondFrame }
244
+ style={ {
245
+ height: '100%',
246
+ width: '100%',
247
+ overflow: 'hidden',
248
+ position: 'absolute',
249
+ top: 0,
250
+ } }
251
+ >
252
+ <VStack
253
+ spacing={ 3 * ratio }
254
+ justify="center"
255
+ style={ {
256
+ height: '100%',
257
+ overflow: 'hidden',
258
+ padding: 10 * ratio,
259
+ boxSizing: 'border-box',
260
+ } }
261
+ >
262
+ { label && (
263
+ <div
264
+ style={ {
265
+ fontSize: 40 * ratio,
266
+ fontFamily: headingFontFamily,
267
+ color: headingColor,
268
+ fontWeight: headingFontWeight,
269
+ lineHeight: '1em',
270
+ textAlign: 'center',
271
+ } }
272
+ >
273
+ { label }
274
+ </div>
275
+ ) }
276
+ </VStack>
277
+ </motion.div>
278
+ </motion.div>
279
+ </Iframe>
280
+ ) }
281
+ </>
267
282
  );
268
283
  };
269
284
 
@@ -20,19 +20,18 @@ import { speak } from '@wordpress/a11y';
20
20
  /**
21
21
  * Internal dependencies
22
22
  */
23
- import { useHasBorderPanel } from './border-panel';
24
23
  import { useHasColorPanel } from './color-utils';
25
- import { useHasDimensionsPanel } from './dimensions-panel';
26
24
  import { useHasVariationsPanel } from './variations-panel';
27
25
  import ScreenHeader from './header';
28
26
  import { NavigationButtonAsItem } from './navigation-button';
29
27
  import { unlock } from '../../private-apis';
30
- import { useSupportedStyles } from './hooks';
31
28
 
32
29
  const {
30
+ useHasDimensionsPanel,
33
31
  useHasTypographyPanel,
32
+ useHasBorderPanel,
34
33
  useGlobalSetting,
35
- overrideSettingsWithSupports,
34
+ useSettingsForBlockElement,
36
35
  } = unlock( blockEditorPrivateApis );
37
36
 
38
37
  function useSortedBlockTypes() {
@@ -60,15 +59,11 @@ function useSortedBlockTypes() {
60
59
 
61
60
  function BlockMenuItem( { block } ) {
62
61
  const [ rawSettings ] = useGlobalSetting( '', block.name );
63
- const supports = useSupportedStyles( block.name );
64
- const settings = useMemo(
65
- () => overrideSettingsWithSupports( rawSettings, supports ),
66
- [ rawSettings, supports ]
67
- );
62
+ const settings = useSettingsForBlockElement( rawSettings, block.name );
68
63
  const hasTypographyPanel = useHasTypographyPanel( settings );
69
64
  const hasColorPanel = useHasColorPanel( block.name );
70
- const hasBorderPanel = useHasBorderPanel( block.name );
71
- const hasDimensionsPanel = useHasDimensionsPanel( block.name );
65
+ const hasBorderPanel = useHasBorderPanel( settings );
66
+ const hasDimensionsPanel = useHasDimensionsPanel( settings );
72
67
  const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
73
68
  const hasVariationsPanel = useHasVariationsPanel( block.name );
74
69
  const hasBlockMenuItem =
@@ -2,21 +2,28 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
8
9
  */
9
10
  import ScreenHeader from './header';
10
- import BorderPanel, { useHasBorderPanel } from './border-panel';
11
+ import BorderPanel from './border-panel';
11
12
  import BlockPreviewPanel from './block-preview-panel';
12
13
  import { getVariationClassName } from './utils';
14
+ import { unlock } from '../../private-apis';
15
+
16
+ const { useHasBorderPanel, useGlobalSetting, useSettingsForBlockElement } =
17
+ unlock( blockEditorPrivateApis );
13
18
 
14
19
  function ScreenBorder( { name, variation = '' } ) {
15
- const hasBorderPanel = useHasBorderPanel( name );
20
+ const [ rawSettings ] = useGlobalSetting( '', name );
21
+ const settings = useSettingsForBlockElement( rawSettings, name );
22
+ const hasBorderPanel = useHasBorderPanel( settings );
16
23
  const variationClassName = getVariationClassName( variation );
17
24
  return (
18
25
  <>
19
- <ScreenHeader title={ __( 'Border & Shadow' ) } />
26
+ <ScreenHeader title={ __( 'Border' ) } />
20
27
  <BlockPreviewPanel name={ name } variation={ variationClassName } />
21
28
  { hasBorderPanel && (
22
29
  <BorderPanel name={ name } variation={ variation } />
@@ -0,0 +1,27 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import DuotonePanel from './duotone-panel';
10
+ import BlockPreviewPanel from './block-preview-panel';
11
+
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+ import ScreenHeader from './header';
16
+
17
+ function ScreenFilters( { name } ) {
18
+ return (
19
+ <>
20
+ <ScreenHeader title={ __( 'Filters' ) } />
21
+ <BlockPreviewPanel name={ name } />
22
+ <DuotonePanel name={ name } />
23
+ </>
24
+ );
25
+ }
26
+
27
+ export default ScreenFilters;
@@ -2,17 +2,24 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
8
9
  */
9
- import DimensionsPanel, { useHasDimensionsPanel } from './dimensions-panel';
10
+ import DimensionsPanel from './dimensions-panel';
10
11
  import ScreenHeader from './header';
11
12
  import BlockPreviewPanel from './block-preview-panel';
12
13
  import { getVariationClassName } from './utils';
14
+ import { unlock } from '../../private-apis';
15
+
16
+ const { useHasDimensionsPanel, useGlobalSetting, useSettingsForBlockElement } =
17
+ unlock( blockEditorPrivateApis );
13
18
 
14
19
  function ScreenLayout( { name, variation = '' } ) {
15
- const hasDimensionsPanel = useHasDimensionsPanel( name );
20
+ const [ rawSettings ] = useGlobalSetting( '', name );
21
+ const settings = useSettingsForBlockElement( rawSettings, name );
22
+ const hasDimensionsPanel = useHasDimensionsPanel( settings );
16
23
  const variationClassName = getVariationClassName( variation );
17
24
  return (
18
25
  <>
@@ -51,7 +51,7 @@ function ScreenRoot() {
51
51
  }, [] );
52
52
 
53
53
  return (
54
- <Card size="small">
54
+ <Card size="small" className="edit-site-global-styles-screen-root">
55
55
  <CardBody>
56
56
  <VStack spacing={ 4 }>
57
57
  <Card>
@@ -172,7 +172,11 @@ function ScreenStyleVariations() {
172
172
  ) }
173
173
  />
174
174
 
175
- <Card size="small" isBorderless>
175
+ <Card
176
+ size="small"
177
+ isBorderless
178
+ className="edit-site-global-styles-screen-style-variations"
179
+ >
176
180
  <CardBody>
177
181
  <Grid columns={ 2 }>
178
182
  { withEmptyVariation?.map( ( variation, index ) => (
@@ -24,7 +24,6 @@ export function ScreenVariations( { name, path = '' } ) {
24
24
  return (
25
25
  <div className="edit-site-global-styles-screen-variations">
26
26
  <VStack spacing={ 3 }>
27
- <p>Manage style variations, saved block appearence presets.</p>
28
27
  <Subtitle>{ __( 'Style Variations' ) }</Subtitle>
29
28
  <VariationsPanel name={ name } />
30
29
  </VStack>
@@ -146,9 +146,9 @@ function ShadowPopoverContainer( { shadow, onShadowChange } ) {
146
146
  function ShadowPresets( { presets, activeShadow, onSelect } ) {
147
147
  return ! presets ? null : (
148
148
  <Grid columns={ 6 } gap={ 0 } align="center" justify="center">
149
- { presets.map( ( { name, shadow }, i ) => (
149
+ { presets.map( ( { name, slug, shadow } ) => (
150
150
  <ShadowIndicator
151
- key={ i }
151
+ key={ slug }
152
152
  label={ name }
153
153
  isActive={ shadow === activeShadow }
154
154
  onSelect={ () =>
@@ -167,8 +167,9 @@ function ShadowIndicator( { label, isActive, onSelect, shadow } ) {
167
167
  <Button
168
168
  className="edit-site-global-styles__shadow-indicator"
169
169
  onClick={ onSelect }
170
- aria-label={ label }
170
+ label={ label }
171
171
  style={ { boxShadow: shadow } }
172
+ showTooltip
172
173
  >
173
174
  { isActive && <Icon icon={ check } /> }
174
175
  </Button>
@@ -241,3 +241,13 @@
241
241
  height: 24px;
242
242
  width: 24px;
243
243
  }
244
+
245
+ .edit-site-global-styles-screen-root.edit-site-global-styles-screen-root,
246
+ .edit-site-global-styles-screen-style-variations.edit-site-global-styles-screen-style-variations {
247
+ background: unset;
248
+ color: inherit;
249
+ }
250
+
251
+ .edit-site-global-styles-sidebar__panel .block-editor-block-icon svg {
252
+ fill: currentColor;
253
+ }