@wordpress/editor 14.33.3 → 14.34.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 (301) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/collab-sidebar/comment-author-info.js +26 -14
  3. package/build/components/collab-sidebar/comment-author-info.js.map +2 -2
  4. package/build/components/document-bar/index.js +16 -3
  5. package/build/components/document-bar/index.js.map +2 -2
  6. package/build/components/editor/index.js +23 -4
  7. package/build/components/editor/index.js.map +3 -3
  8. package/build/components/editor-interface/index.js +15 -10
  9. package/build/components/editor-interface/index.js.map +3 -3
  10. package/build/components/entities-saved-states/entity-type-list.js +19 -15
  11. package/build/components/entities-saved-states/entity-type-list.js.map +3 -3
  12. package/build/components/global-styles/block-link.js +70 -0
  13. package/build/components/global-styles/block-link.js.map +7 -0
  14. package/build/components/global-styles/header.js +54 -0
  15. package/build/components/global-styles/header.js.map +7 -0
  16. package/build/components/global-styles/hooks.js +176 -0
  17. package/build/components/global-styles/hooks.js.map +7 -0
  18. package/build/components/global-styles/index.js +138 -0
  19. package/build/components/global-styles/index.js.map +7 -0
  20. package/build/components/global-styles/menu.js +95 -0
  21. package/build/components/global-styles/menu.js.map +7 -0
  22. package/build/components/global-styles-provider/index.js +3 -49
  23. package/build/components/global-styles-provider/index.js.map +3 -3
  24. package/build/components/global-styles-renderer/index.js +55 -0
  25. package/build/components/global-styles-renderer/index.js.map +7 -0
  26. package/build/components/global-styles-sidebar/default-sidebar.js +66 -0
  27. package/build/components/global-styles-sidebar/default-sidebar.js.map +7 -0
  28. package/build/components/global-styles-sidebar/index.js +182 -0
  29. package/build/components/global-styles-sidebar/index.js.map +7 -0
  30. package/build/components/global-styles-sidebar/welcome-guide-image.js +37 -0
  31. package/build/components/global-styles-sidebar/welcome-guide-image.js.map +7 -0
  32. package/build/components/global-styles-sidebar/welcome-guide.js +143 -0
  33. package/build/components/global-styles-sidebar/welcome-guide.js.map +7 -0
  34. package/build/components/header/index.js +12 -9
  35. package/build/components/header/index.js.map +2 -2
  36. package/build/components/post-featured-image/index.js +32 -1
  37. package/build/components/post-featured-image/index.js.map +3 -3
  38. package/build/components/provider/index.js +0 -2
  39. package/build/components/provider/index.js.map +3 -3
  40. package/build/components/style-book/categories.js +86 -0
  41. package/build/components/style-book/categories.js.map +7 -0
  42. package/build/components/style-book/color-examples.js +64 -0
  43. package/build/components/style-book/color-examples.js.map +7 -0
  44. package/build/components/style-book/constants.js +319 -0
  45. package/build/components/style-book/constants.js.map +7 -0
  46. package/build/components/style-book/duotone-examples.js +68 -0
  47. package/build/components/style-book/duotone-examples.js.map +7 -0
  48. package/build/components/style-book/examples.js +237 -0
  49. package/build/components/style-book/examples.js.map +7 -0
  50. package/build/components/style-book/index.js +627 -0
  51. package/build/components/style-book/index.js.map +7 -0
  52. package/build/components/style-book/types.js +17 -0
  53. package/build/components/style-book/types.js.map +7 -0
  54. package/build/components/styles-canvas/index.js +138 -0
  55. package/build/components/styles-canvas/index.js.map +7 -0
  56. package/build/components/styles-canvas/revisions.js +121 -0
  57. package/build/components/styles-canvas/revisions.js.map +7 -0
  58. package/build/components/styles-canvas/style-book.js +68 -0
  59. package/build/components/styles-canvas/style-book.js.map +7 -0
  60. package/build/components/visual-editor/index.js +4 -3
  61. package/build/components/visual-editor/index.js.map +2 -2
  62. package/build/dataviews/fields/content-preview/content-preview-view.js.map +2 -2
  63. package/build/hooks/index.js +1 -0
  64. package/build/hooks/index.js.map +2 -2
  65. package/build/hooks/media-upload.js +15 -4
  66. package/build/hooks/media-upload.js.map +3 -3
  67. package/build/hooks/push-changes-to-global-styles/index.js +322 -0
  68. package/build/hooks/push-changes-to-global-styles/index.js.map +7 -0
  69. package/build/hooks/use-global-styles-output.js +74 -0
  70. package/build/hooks/use-global-styles-output.js.map +7 -0
  71. package/build/private-apis.js +10 -5
  72. package/build/private-apis.js.map +3 -3
  73. package/build/store/private-actions.js +23 -0
  74. package/build/store/private-actions.js.map +2 -2
  75. package/build/store/private-selectors.js +10 -0
  76. package/build/store/private-selectors.js.map +2 -2
  77. package/build/store/reducer.js +24 -0
  78. package/build/store/reducer.js.map +2 -2
  79. package/build/{components/editor-interface/content-slot-fill.js → utils/set-nested-value.js} +24 -10
  80. package/build/utils/set-nested-value.js.map +7 -0
  81. package/build-module/components/collab-sidebar/comment-author-info.js +26 -14
  82. package/build-module/components/collab-sidebar/comment-author-info.js.map +2 -2
  83. package/build-module/components/document-bar/index.js +16 -3
  84. package/build-module/components/document-bar/index.js.map +2 -2
  85. package/build-module/components/editor/index.js +23 -4
  86. package/build-module/components/editor/index.js.map +2 -2
  87. package/build-module/components/editor-interface/index.js +15 -10
  88. package/build-module/components/editor-interface/index.js.map +2 -2
  89. package/build-module/components/entities-saved-states/entity-type-list.js +18 -14
  90. package/build-module/components/entities-saved-states/entity-type-list.js.map +2 -2
  91. package/build-module/components/global-styles/block-link.js +46 -0
  92. package/build-module/components/global-styles/block-link.js.map +7 -0
  93. package/build-module/components/global-styles/header.js +41 -0
  94. package/build-module/components/global-styles/header.js.map +7 -0
  95. package/build-module/components/global-styles/hooks.js +154 -0
  96. package/build-module/components/global-styles/hooks.js.map +7 -0
  97. package/build-module/components/global-styles/index.js +112 -0
  98. package/build-module/components/global-styles/index.js.map +7 -0
  99. package/build-module/components/global-styles/menu.js +71 -0
  100. package/build-module/components/global-styles/menu.js.map +7 -0
  101. package/build-module/components/global-styles-provider/index.js +3 -37
  102. package/build-module/components/global-styles-provider/index.js.map +2 -2
  103. package/build-module/components/global-styles-renderer/index.js +31 -0
  104. package/build-module/components/global-styles-renderer/index.js.map +7 -0
  105. package/build-module/components/global-styles-sidebar/default-sidebar.js +49 -0
  106. package/build-module/components/global-styles-sidebar/default-sidebar.js.map +7 -0
  107. package/build-module/components/global-styles-sidebar/index.js +152 -0
  108. package/build-module/components/global-styles-sidebar/index.js.map +7 -0
  109. package/build-module/components/global-styles-sidebar/welcome-guide-image.js +17 -0
  110. package/build-module/components/global-styles-sidebar/welcome-guide-image.js.map +7 -0
  111. package/build-module/components/global-styles-sidebar/welcome-guide.js +113 -0
  112. package/build-module/components/global-styles-sidebar/welcome-guide.js.map +7 -0
  113. package/build-module/components/header/index.js +12 -9
  114. package/build-module/components/header/index.js.map +2 -2
  115. package/build-module/components/post-featured-image/index.js +35 -3
  116. package/build-module/components/post-featured-image/index.js.map +2 -2
  117. package/build-module/components/provider/index.js +0 -2
  118. package/build-module/components/provider/index.js.map +2 -2
  119. package/build-module/components/style-book/categories.js +64 -0
  120. package/build-module/components/style-book/categories.js.map +7 -0
  121. package/build-module/components/style-book/color-examples.js +37 -0
  122. package/build-module/components/style-book/color-examples.js.map +7 -0
  123. package/build-module/components/style-book/constants.js +290 -0
  124. package/build-module/components/style-book/constants.js.map +7 -0
  125. package/build-module/components/style-book/duotone-examples.js +48 -0
  126. package/build-module/components/style-book/duotone-examples.js.map +7 -0
  127. package/build-module/components/style-book/examples.js +208 -0
  128. package/build-module/components/style-book/examples.js.map +7 -0
  129. package/build-module/components/style-book/index.js +618 -0
  130. package/build-module/components/style-book/index.js.map +7 -0
  131. package/build-module/components/style-book/types.js +1 -0
  132. package/build-module/components/style-book/types.js.map +7 -0
  133. package/build-module/components/styles-canvas/index.js +104 -0
  134. package/build-module/components/styles-canvas/index.js.map +7 -0
  135. package/build-module/components/styles-canvas/revisions.js +107 -0
  136. package/build-module/components/styles-canvas/revisions.js.map +7 -0
  137. package/build-module/components/styles-canvas/style-book.js +38 -0
  138. package/build-module/components/styles-canvas/style-book.js.map +7 -0
  139. package/build-module/components/visual-editor/index.js +4 -3
  140. package/build-module/components/visual-editor/index.js.map +2 -2
  141. package/build-module/dataviews/fields/content-preview/content-preview-view.js.map +2 -2
  142. package/build-module/hooks/index.js +1 -0
  143. package/build-module/hooks/index.js.map +2 -2
  144. package/build-module/hooks/media-upload.js +19 -5
  145. package/build-module/hooks/media-upload.js.map +2 -2
  146. package/build-module/hooks/push-changes-to-global-styles/index.js +309 -0
  147. package/build-module/hooks/push-changes-to-global-styles/index.js.map +7 -0
  148. package/build-module/hooks/use-global-styles-output.js +49 -0
  149. package/build-module/hooks/use-global-styles-output.js.map +7 -0
  150. package/build-module/private-apis.js +10 -8
  151. package/build-module/private-apis.js.map +2 -2
  152. package/build-module/store/private-actions.js +20 -0
  153. package/build-module/store/private-actions.js.map +2 -2
  154. package/build-module/store/private-selectors.js +8 -0
  155. package/build-module/store/private-selectors.js.map +2 -2
  156. package/build-module/store/reducer.js +22 -0
  157. package/build-module/store/reducer.js.map +2 -2
  158. package/build-module/utils/set-nested-value.js +23 -0
  159. package/build-module/utils/set-nested-value.js.map +7 -0
  160. package/build-style/style-rtl.css +3017 -11
  161. package/build-style/style.css +3018 -11
  162. package/build-types/components/collab-sidebar/comment-author-info.d.ts +5 -16
  163. package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +1 -1
  164. package/build-types/components/document-bar/index.d.ts +2 -2
  165. package/build-types/components/document-bar/index.d.ts.map +1 -1
  166. package/build-types/components/editor/index.d.ts.map +1 -1
  167. package/build-types/components/editor-interface/index.d.ts +1 -3
  168. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  169. package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -1
  170. package/build-types/components/global-styles/block-link.d.ts +12 -0
  171. package/build-types/components/global-styles/block-link.d.ts.map +1 -0
  172. package/build-types/components/global-styles/header.d.ts +7 -0
  173. package/build-types/components/global-styles/header.d.ts.map +1 -0
  174. package/build-types/components/global-styles/hooks.d.ts +24 -0
  175. package/build-types/components/global-styles/hooks.d.ts.map +1 -0
  176. package/build-types/components/global-styles/index.d.ts +6 -0
  177. package/build-types/components/global-styles/index.d.ts.map +1 -0
  178. package/build-types/components/global-styles/menu.d.ts +13 -0
  179. package/build-types/components/global-styles/menu.d.ts.map +1 -0
  180. package/build-types/components/global-styles-provider/index.d.ts +1 -5
  181. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  182. package/build-types/components/global-styles-renderer/index.d.ts +4 -0
  183. package/build-types/components/global-styles-renderer/index.d.ts.map +1 -0
  184. package/build-types/components/global-styles-sidebar/default-sidebar.d.ts +13 -0
  185. package/build-types/components/global-styles-sidebar/default-sidebar.d.ts.map +1 -0
  186. package/build-types/components/global-styles-sidebar/index.d.ts +2 -0
  187. package/build-types/components/global-styles-sidebar/index.d.ts.map +1 -0
  188. package/build-types/components/global-styles-sidebar/welcome-guide-image.d.ts +5 -0
  189. package/build-types/components/global-styles-sidebar/welcome-guide-image.d.ts.map +1 -0
  190. package/build-types/components/global-styles-sidebar/welcome-guide.d.ts +2 -0
  191. package/build-types/components/global-styles-sidebar/welcome-guide.d.ts.map +1 -0
  192. package/build-types/components/header/index.d.ts +1 -3
  193. package/build-types/components/header/index.d.ts.map +1 -1
  194. package/build-types/components/provider/index.d.ts.map +1 -1
  195. package/build-types/components/style-book/categories.d.ts +18 -0
  196. package/build-types/components/style-book/categories.d.ts.map +1 -0
  197. package/build-types/components/style-book/color-examples.d.ts +7 -0
  198. package/build-types/components/style-book/color-examples.d.ts.map +1 -0
  199. package/build-types/components/style-book/constants.d.ts +11 -0
  200. package/build-types/components/style-book/constants.d.ts.map +1 -0
  201. package/build-types/components/style-book/duotone-examples.d.ts +9 -0
  202. package/build-types/components/style-book/duotone-examples.d.ts.map +1 -0
  203. package/build-types/components/style-book/examples.d.ts +12 -0
  204. package/build-types/components/style-book/examples.d.ts.map +1 -0
  205. package/build-types/components/style-book/index.d.ts +31 -0
  206. package/build-types/components/style-book/index.d.ts.map +1 -0
  207. package/build-types/components/style-book/types.d.ts +72 -0
  208. package/build-types/components/style-book/types.d.ts.map +1 -0
  209. package/build-types/components/styles-canvas/index.d.ts +16 -0
  210. package/build-types/components/styles-canvas/index.d.ts.map +1 -0
  211. package/build-types/components/styles-canvas/revisions.d.ts +5 -0
  212. package/build-types/components/styles-canvas/revisions.d.ts.map +1 -0
  213. package/build-types/components/styles-canvas/style-book.d.ts +6 -0
  214. package/build-types/components/styles-canvas/style-book.d.ts.map +1 -0
  215. package/build-types/components/visual-editor/index.d.ts +1 -2
  216. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  217. package/build-types/dataviews/fields/content-preview/content-preview-view.d.ts.map +1 -1
  218. package/build-types/hooks/push-changes-to-global-styles/index.d.ts +2 -0
  219. package/build-types/hooks/push-changes-to-global-styles/index.d.ts.map +1 -0
  220. package/build-types/hooks/use-global-styles-output.d.ts +18 -0
  221. package/build-types/hooks/use-global-styles-output.d.ts.map +1 -0
  222. package/build-types/private-apis.d.ts.map +1 -1
  223. package/build-types/store/private-actions.d.ts +20 -0
  224. package/build-types/store/private-actions.d.ts.map +1 -1
  225. package/build-types/store/private-selectors.d.ts +14 -0
  226. package/build-types/store/private-selectors.d.ts.map +1 -1
  227. package/build-types/store/reducer.d.ts +20 -0
  228. package/build-types/store/reducer.d.ts.map +1 -1
  229. package/build-types/utils/set-nested-value.d.ts +20 -0
  230. package/build-types/utils/set-nested-value.d.ts.map +1 -0
  231. package/package.json +40 -40
  232. package/src/components/collab-sidebar/comment-author-info.js +32 -25
  233. package/src/components/collab-sidebar/style.scss +1 -1
  234. package/src/components/document-bar/index.js +18 -3
  235. package/src/components/editor/index.js +25 -1
  236. package/src/components/editor-help/style.scss +1 -1
  237. package/src/components/editor-interface/index.js +40 -39
  238. package/src/components/entities-saved-states/entity-type-list.js +19 -17
  239. package/src/components/global-styles/block-link.js +65 -0
  240. package/src/components/global-styles/header.js +48 -0
  241. package/src/components/global-styles/hooks.js +216 -0
  242. package/src/components/global-styles/index.js +125 -0
  243. package/src/components/global-styles/menu.js +101 -0
  244. package/src/components/global-styles/style.scss +11 -0
  245. package/src/components/global-styles-provider/index.js +3 -45
  246. package/src/components/global-styles-renderer/index.js +39 -0
  247. package/src/components/global-styles-sidebar/default-sidebar.js +46 -0
  248. package/src/components/global-styles-sidebar/index.js +177 -0
  249. package/src/components/global-styles-sidebar/style.scss +119 -0
  250. package/src/components/global-styles-sidebar/welcome-guide-image.js +11 -0
  251. package/src/components/global-styles-sidebar/welcome-guide.js +136 -0
  252. package/src/components/header/index.js +11 -6
  253. package/src/components/post-featured-image/index.js +44 -1
  254. package/src/components/post-last-revision/style.scss +1 -1
  255. package/src/components/post-panel-row/style.scss +1 -0
  256. package/src/components/post-publish-panel/style.scss +1 -1
  257. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -2
  258. package/src/components/provider/index.js +0 -2
  259. package/src/components/style-book/categories.ts +97 -0
  260. package/src/components/style-book/color-examples.tsx +56 -0
  261. package/src/components/style-book/constants.ts +308 -0
  262. package/src/components/style-book/duotone-examples.tsx +56 -0
  263. package/src/components/style-book/examples.tsx +273 -0
  264. package/src/components/style-book/index.js +794 -0
  265. package/src/components/style-book/style.scss +44 -0
  266. package/src/components/style-book/test/categories.js +166 -0
  267. package/src/components/style-book/types.ts +80 -0
  268. package/src/components/styles-canvas/index.js +126 -0
  269. package/src/components/styles-canvas/revisions.js +144 -0
  270. package/src/components/styles-canvas/style-book.js +57 -0
  271. package/src/components/styles-canvas/style.scss +40 -0
  272. package/src/components/visual-editor/index.js +2 -1
  273. package/src/dataviews/fields/content-preview/content-preview-view.tsx +2 -0
  274. package/src/hooks/index.js +1 -0
  275. package/src/hooks/media-upload.js +25 -5
  276. package/src/hooks/push-changes-to-global-styles/index.js +391 -0
  277. package/src/hooks/push-changes-to-global-styles/style.scss +4 -0
  278. package/src/hooks/use-global-styles-output.js +76 -0
  279. package/src/private-apis.js +10 -8
  280. package/src/store/private-actions.js +37 -0
  281. package/src/store/private-selectors.js +20 -0
  282. package/src/store/reducer.js +36 -0
  283. package/src/style.scss +7 -1
  284. package/src/utils/set-nested-value.js +39 -0
  285. package/tsconfig.json +3 -0
  286. package/tsconfig.tsbuildinfo +1 -1
  287. package/build/components/block-settings-menu/content-only-settings-menu.js +0 -186
  288. package/build/components/block-settings-menu/content-only-settings-menu.js.map +0 -7
  289. package/build/components/editor-interface/content-slot-fill.js.map +0 -7
  290. package/build-module/components/block-settings-menu/content-only-settings-menu.js +0 -161
  291. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +0 -7
  292. package/build-module/components/editor-interface/content-slot-fill.js +0 -9
  293. package/build-module/components/editor-interface/content-slot-fill.js.map +0 -7
  294. package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts +0 -2
  295. package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +0 -1
  296. package/build-types/components/editor-interface/content-slot-fill.d.ts +0 -14
  297. package/build-types/components/editor-interface/content-slot-fill.d.ts.map +0 -1
  298. package/src/components/block-settings-menu/content-only-settings-menu.js +0 -185
  299. package/src/components/block-settings-menu/content-only-settings-menu.native.js +0 -4
  300. package/src/components/block-settings-menu/style.scss +0 -6
  301. package/src/components/editor-interface/content-slot-fill.js +0 -10
@@ -0,0 +1,46 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ ComplementaryArea,
6
+ ComplementaryAreaMoreMenuItem,
7
+ } from '@wordpress/interface';
8
+
9
+ export default function DefaultSidebar( {
10
+ className,
11
+ identifier,
12
+ title,
13
+ icon,
14
+ children,
15
+ closeLabel,
16
+ header,
17
+ headerClassName,
18
+ panelClassName,
19
+ isActiveByDefault,
20
+ } ) {
21
+ return (
22
+ <>
23
+ <ComplementaryArea
24
+ className={ className }
25
+ scope="core"
26
+ identifier={ identifier }
27
+ title={ title }
28
+ icon={ icon }
29
+ closeLabel={ closeLabel }
30
+ header={ header }
31
+ headerClassName={ headerClassName }
32
+ panelClassName={ panelClassName }
33
+ isActiveByDefault={ isActiveByDefault }
34
+ >
35
+ { children }
36
+ </ComplementaryArea>
37
+ <ComplementaryAreaMoreMenuItem
38
+ scope="core"
39
+ identifier={ identifier }
40
+ icon={ icon }
41
+ >
42
+ { title }
43
+ </ComplementaryAreaMoreMenuItem>
44
+ </>
45
+ );
46
+ }
@@ -0,0 +1,177 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { FlexItem, Flex, Button } from '@wordpress/components';
5
+ import { __ } from '@wordpress/i18n';
6
+ import { styles, seen, backup } from '@wordpress/icons';
7
+ import { useSelect, useDispatch } from '@wordpress/data';
8
+ import { useEffect } from '@wordpress/element';
9
+ import { store as preferencesStore } from '@wordpress/preferences';
10
+ import { useViewportMatch, usePrevious } from '@wordpress/compose';
11
+ import { store as coreStore } from '@wordpress/core-data';
12
+ import { store as interfaceStore } from '@wordpress/interface';
13
+
14
+ /**
15
+ * Internal dependencies
16
+ */
17
+ import GlobalStylesUI from '../global-styles';
18
+ import { GlobalStylesActionMenu } from '../global-styles/menu';
19
+ import { store as editorStore } from '../../store';
20
+ import { unlock } from '../../lock-unlock';
21
+ import DefaultSidebar from './default-sidebar';
22
+ import WelcomeGuideStyles from './welcome-guide';
23
+
24
+ export default function GlobalStylesSidebar() {
25
+ const {
26
+ shouldResetNavigation,
27
+ stylesPath,
28
+ showStylebook,
29
+ showListViewByDefault,
30
+ hasRevisions,
31
+ activeComplementaryArea,
32
+ } = useSelect( ( select ) => {
33
+ const { getActiveComplementaryArea } = select( interfaceStore );
34
+ const { getStylesPath, getShowStylebook } = unlock(
35
+ select( editorStore )
36
+ );
37
+ const _isVisualEditorMode =
38
+ 'visual' === select( editorStore ).getEditorMode();
39
+ const _showListViewByDefault = select( preferencesStore ).get(
40
+ 'core',
41
+ 'showListViewByDefault'
42
+ );
43
+ const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
44
+ select( coreStore );
45
+
46
+ const globalStylesId = __experimentalGetCurrentGlobalStylesId();
47
+ const globalStyles = globalStylesId
48
+ ? getEntityRecord( 'root', 'globalStyles', globalStylesId )
49
+ : undefined;
50
+
51
+ return {
52
+ stylesPath: getStylesPath(),
53
+ showStylebook: getShowStylebook(),
54
+ shouldResetNavigation:
55
+ 'edit-site/global-styles' !==
56
+ getActiveComplementaryArea( 'core' ) ||
57
+ ! _isVisualEditorMode,
58
+ showListViewByDefault: _showListViewByDefault,
59
+ hasRevisions:
60
+ !! globalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count,
61
+ activeComplementaryArea:
62
+ select( interfaceStore ).getActiveComplementaryArea( 'core' ),
63
+ };
64
+ }, [] );
65
+ const { setStylesPath, setShowStylebook, resetStylesNavigation } = unlock(
66
+ useDispatch( editorStore )
67
+ );
68
+ const isMobileViewport = useViewportMatch( 'medium', '<' );
69
+
70
+ // Derive state from path and showStylebook
71
+ const isRevisionsOpened =
72
+ stylesPath.startsWith( '/revisions' ) && ! showStylebook;
73
+ const isRevisionsStyleBookOpened =
74
+ stylesPath.startsWith( '/revisions' ) && showStylebook;
75
+
76
+ const previousActiveArea = usePrevious( activeComplementaryArea );
77
+
78
+ // Reset navigation when sidebar opens
79
+ useEffect( () => {
80
+ if (
81
+ activeComplementaryArea === 'edit-site/global-styles' &&
82
+ previousActiveArea !== 'edit-site/global-styles'
83
+ ) {
84
+ resetStylesNavigation();
85
+ }
86
+ }, [ activeComplementaryArea, previousActiveArea, resetStylesNavigation ] );
87
+
88
+ useEffect( () => {
89
+ if ( shouldResetNavigation ) {
90
+ resetStylesNavigation();
91
+ }
92
+ }, [ shouldResetNavigation, resetStylesNavigation ] );
93
+
94
+ const { setIsListViewOpened } = useDispatch( editorStore );
95
+
96
+ const toggleRevisions = () => {
97
+ setIsListViewOpened( false );
98
+ if ( isRevisionsOpened || isRevisionsStyleBookOpened ) {
99
+ // Close revisions, go back to root
100
+ setStylesPath( '/' );
101
+ } else {
102
+ // Open revisions
103
+ setStylesPath( '/revisions' );
104
+ }
105
+ };
106
+ const toggleStyleBook = () => {
107
+ setIsListViewOpened( showStylebook && showListViewByDefault );
108
+ setShowStylebook( ! showStylebook );
109
+ };
110
+
111
+ return (
112
+ <>
113
+ <DefaultSidebar
114
+ className="editor-global-styles-sidebar"
115
+ identifier="edit-site/global-styles"
116
+ title={ __( 'Styles' ) }
117
+ icon={ styles }
118
+ closeLabel={ __( 'Close Styles' ) }
119
+ panelClassName="editor-global-styles-sidebar__panel"
120
+ header={
121
+ <Flex
122
+ className="editor-global-styles-sidebar__header"
123
+ gap={ 1 }
124
+ >
125
+ <FlexItem>
126
+ <h2 className="editor-global-styles-sidebar__header-title">
127
+ { __( 'Styles' ) }
128
+ </h2>
129
+ </FlexItem>
130
+ <Flex
131
+ justify="flex-end"
132
+ gap={ 1 }
133
+ className="editor-global-styles-sidebar__header-actions"
134
+ >
135
+ { ! isMobileViewport && (
136
+ <FlexItem>
137
+ <Button
138
+ icon={ seen }
139
+ label={ __( 'Style Book' ) }
140
+ isPressed={ showStylebook }
141
+ accessibleWhenDisabled
142
+ disabled={ shouldResetNavigation }
143
+ onClick={ toggleStyleBook }
144
+ size="compact"
145
+ />
146
+ </FlexItem>
147
+ ) }
148
+ <FlexItem>
149
+ <Button
150
+ label={ __( 'Revisions' ) }
151
+ icon={ backup }
152
+ onClick={ toggleRevisions }
153
+ accessibleWhenDisabled
154
+ disabled={ ! hasRevisions }
155
+ isPressed={
156
+ isRevisionsOpened ||
157
+ isRevisionsStyleBookOpened
158
+ }
159
+ size="compact"
160
+ />
161
+ </FlexItem>
162
+ <GlobalStylesActionMenu
163
+ onChangePath={ setStylesPath }
164
+ />
165
+ </Flex>
166
+ </Flex>
167
+ }
168
+ >
169
+ <GlobalStylesUI
170
+ path={ stylesPath }
171
+ onPathChange={ setStylesPath }
172
+ />
173
+ </DefaultSidebar>
174
+ <WelcomeGuideStyles />
175
+ </>
176
+ );
177
+ }
@@ -0,0 +1,119 @@
1
+ @use "@wordpress/base-styles/colors" as *;
2
+ @use "@wordpress/base-styles/variables" as *;
3
+
4
+ .editor-global-styles-sidebar {
5
+ display: flex;
6
+ flex-direction: column;
7
+ min-height: 100%;
8
+
9
+ &__panel {
10
+ flex: 1;
11
+ }
12
+
13
+ .components-navigator-screen {
14
+ padding: 0;
15
+ }
16
+ }
17
+
18
+ .editor-global-styles-sidebar .editor-global-styles-sidebar__header-title {
19
+ margin: 0;
20
+ }
21
+
22
+ .editor-global-styles-sidebar .editor-global-styles-sidebar__header-actions {
23
+ flex: 1;
24
+ }
25
+
26
+ .editor-global-styles-sidebar .components-navigation__menu-title-heading {
27
+ font-size: $default-font-size * 1.2;
28
+ font-weight: $font-weight-medium;
29
+ }
30
+
31
+ .editor-global-styles-sidebar .components-navigation__item > button span {
32
+ font-weight: $font-weight-medium;
33
+ }
34
+
35
+ .editor-global-styles-sidebar .block-editor-panel-color-gradient-settings {
36
+ border: 0;
37
+ }
38
+
39
+ .editor-global-styles-sidebar .single-column {
40
+ grid-column: span 1;
41
+ }
42
+
43
+ .editor-global-styles-sidebar .components-tools-panel .span-columns {
44
+ grid-column: 1 / -1;
45
+ }
46
+
47
+ .editor-global-styles-sidebar__blocks-group {
48
+ padding-top: $grid-unit-30;
49
+ border-top: $border-width solid $gray-200;
50
+ }
51
+
52
+ .editor-global-styles-sidebar__blocks-group-help {
53
+ padding: 0 $grid-unit-20;
54
+ }
55
+
56
+ .global-styles-ui-color-palette-panel,
57
+ .global-styles-ui-gradient-palette-panel {
58
+ padding: $grid-unit-20;
59
+ }
60
+
61
+ // Override the `hr` styles defined in the `ComplementaryArea` component
62
+ // from the `@wordpress/interface` package.
63
+ .editor-global-styles-sidebar hr {
64
+ margin: 0;
65
+ }
66
+
67
+ .show-icon-labels {
68
+ .editor-global-styles-sidebar__header {
69
+ .components-button.has-icon {
70
+ width: auto;
71
+
72
+ // Hide the button icons when labels are set to display...
73
+ svg {
74
+ display: none;
75
+ }
76
+ // ... and display labels.
77
+ &::after {
78
+ content: attr(aria-label);
79
+ font-size: $helptext-font-size;
80
+ }
81
+ }
82
+ }
83
+ }
84
+
85
+ .editor-welcome-guide {
86
+ width: 312px;
87
+
88
+ &.guide-styles .editor-welcome-guide__image {
89
+ background: #00a0d2;
90
+ }
91
+
92
+ &__image {
93
+ margin: 0 0 $grid-unit-20;
94
+ > img {
95
+ display: block;
96
+ max-width: 100%;
97
+ object-fit: cover;
98
+ }
99
+ }
100
+
101
+ &__heading {
102
+ font-family: $default-font;
103
+ font-size: 24px;
104
+ line-height: 1.4;
105
+ margin: $grid-unit-20 0 $grid-unit-20 0;
106
+ padding: 0 $grid-unit-40;
107
+ }
108
+
109
+ &__text {
110
+ font-size: $default-font-size;
111
+ line-height: 1.4;
112
+ margin: 0 0 $grid-unit-20 0;
113
+ padding: 0 $grid-unit-40;
114
+
115
+ img {
116
+ vertical-align: bottom;
117
+ }
118
+ }
119
+ }
@@ -0,0 +1,11 @@
1
+ export default function WelcomeGuideImage( { nonAnimatedSrc, animatedSrc } ) {
2
+ return (
3
+ <picture className="editor-welcome-guide__image">
4
+ <source
5
+ srcSet={ nonAnimatedSrc }
6
+ media="(prefers-reduced-motion: reduce)"
7
+ />
8
+ <img src={ animatedSrc } width="312" height="240" alt="" />
9
+ </picture>
10
+ );
11
+ }
@@ -0,0 +1,136 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useDispatch, useSelect } from '@wordpress/data';
5
+ import { ExternalLink, Guide } from '@wordpress/components';
6
+ import { __ } from '@wordpress/i18n';
7
+ import { store as preferencesStore } from '@wordpress/preferences';
8
+ import { store as interfaceStore } from '@wordpress/interface';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import WelcomeGuideImage from './welcome-guide-image';
14
+
15
+ export default function WelcomeGuideStyles() {
16
+ const { toggle } = useDispatch( preferencesStore );
17
+
18
+ const { isActive, isStylesOpen } = useSelect( ( select ) => {
19
+ const sidebar =
20
+ select( interfaceStore ).getActiveComplementaryArea( 'core' );
21
+
22
+ return {
23
+ isActive: !! select( preferencesStore ).get(
24
+ 'core/edit-site',
25
+ 'welcomeGuideStyles'
26
+ ),
27
+ isStylesOpen: sidebar === 'edit-site/global-styles',
28
+ };
29
+ }, [] );
30
+
31
+ if ( ! isActive || ! isStylesOpen ) {
32
+ return null;
33
+ }
34
+
35
+ const welcomeLabel = __( 'Welcome to Styles' );
36
+
37
+ return (
38
+ <Guide
39
+ className="editor-welcome-guide guide-styles"
40
+ contentLabel={ welcomeLabel }
41
+ finishButtonText={ __( 'Get started' ) }
42
+ onFinish={ () => toggle( 'core/edit-site', 'welcomeGuideStyles' ) }
43
+ pages={ [
44
+ {
45
+ image: (
46
+ <WelcomeGuideImage
47
+ nonAnimatedSrc="https://s.w.org/images/block-editor/welcome-to-styles.svg?1"
48
+ animatedSrc="https://s.w.org/images/block-editor/welcome-to-styles.gif?1"
49
+ />
50
+ ),
51
+ content: (
52
+ <>
53
+ <h1 className="editor-welcome-guide__heading">
54
+ { welcomeLabel }
55
+ </h1>
56
+ <p className="editor-welcome-guide__text">
57
+ { __(
58
+ 'Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.'
59
+ ) }
60
+ </p>
61
+ </>
62
+ ),
63
+ },
64
+ {
65
+ image: (
66
+ <WelcomeGuideImage
67
+ nonAnimatedSrc="https://s.w.org/images/block-editor/set-the-design.svg?1"
68
+ animatedSrc="https://s.w.org/images/block-editor/set-the-design.gif?1"
69
+ />
70
+ ),
71
+ content: (
72
+ <>
73
+ <h1 className="editor-welcome-guide__heading">
74
+ { __( 'Set the design' ) }
75
+ </h1>
76
+ <p className="editor-welcome-guide__text">
77
+ { __(
78
+ 'You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle!'
79
+ ) }
80
+ </p>
81
+ </>
82
+ ),
83
+ },
84
+ {
85
+ image: (
86
+ <WelcomeGuideImage
87
+ nonAnimatedSrc="https://s.w.org/images/block-editor/personalize-blocks.svg?1"
88
+ animatedSrc="https://s.w.org/images/block-editor/personalize-blocks.gif?1"
89
+ />
90
+ ),
91
+ content: (
92
+ <>
93
+ <h1 className="editor-welcome-guide__heading">
94
+ { __( 'Personalize blocks' ) }
95
+ </h1>
96
+ <p className="editor-welcome-guide__text">
97
+ { __(
98
+ 'You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.'
99
+ ) }
100
+ </p>
101
+ </>
102
+ ),
103
+ },
104
+ {
105
+ image: (
106
+ <WelcomeGuideImage
107
+ nonAnimatedSrc="https://s.w.org/images/block-editor/welcome-documentation.svg"
108
+ animatedSrc="https://s.w.org/images/block-editor/welcome-documentation.gif"
109
+ />
110
+ ),
111
+ content: (
112
+ <>
113
+ <h1 className="editor-welcome-guide__heading">
114
+ { __( 'Learn more' ) }
115
+ </h1>
116
+ <p className="editor-welcome-guide__text">
117
+ { __(
118
+ 'New to block themes and styling your site?'
119
+ ) }{ ' ' }
120
+ <ExternalLink
121
+ href={ __(
122
+ 'https://wordpress.org/documentation/article/styles-overview/'
123
+ ) }
124
+ >
125
+ { __(
126
+ 'Here’s a detailed guide to learn how to make the most of it.'
127
+ ) }
128
+ </ExternalLink>
129
+ </p>
130
+ </>
131
+ ),
132
+ },
133
+ ] }
134
+ />
135
+ );
136
+ }
@@ -50,9 +50,7 @@ const backButtonVariations = {
50
50
  function Header( {
51
51
  customSaveButton,
52
52
  forceIsDirty,
53
- forceDisableBlockTools,
54
53
  setEntitiesSavedStatesCallback,
55
- title,
56
54
  } ) {
57
55
  const isWideViewport = useViewportMatch( 'large' );
58
56
  const isLargeViewport = useViewportMatch( 'medium' );
@@ -65,6 +63,7 @@ function Header( {
65
63
  hasFixedToolbar,
66
64
  hasBlockSelection,
67
65
  hasSectionRootClientId,
66
+ isStylesCanvasActive,
68
67
  } = useSelect( ( select ) => {
69
68
  const { get: getPreference } = select( preferencesStore );
70
69
  const {
@@ -72,6 +71,9 @@ function Header( {
72
71
  getCurrentPostType,
73
72
  isPublishSidebarOpened: _isPublishSidebarOpened,
74
73
  } = select( editorStore );
74
+ const { getStylesPath, getShowStylebook } = unlock(
75
+ select( editorStore )
76
+ );
75
77
  const { getBlockSelectionStart, getSectionRootClientId } = unlock(
76
78
  select( blockEditorStore )
77
79
  );
@@ -84,6 +86,9 @@ function Header( {
84
86
  hasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),
85
87
  hasBlockSelection: !! getBlockSelectionStart(),
86
88
  hasSectionRootClientId: !! getSectionRootClientId(),
89
+ isStylesCanvasActive:
90
+ !! getStylesPath()?.startsWith( '/revisions' ) ||
91
+ getShowStylebook(),
87
92
  };
88
93
  }, [] );
89
94
 
@@ -96,7 +101,7 @@ function Header( {
96
101
  NAVIGATION_POST_TYPE,
97
102
  TEMPLATE_PART_POST_TYPE,
98
103
  PATTERN_POST_TYPE,
99
- ].includes( postType ) || forceDisableBlockTools;
104
+ ].includes( postType ) || isStylesCanvasActive;
100
105
 
101
106
  const [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =
102
107
  useState( true );
@@ -129,7 +134,7 @@ function Header( {
129
134
  transition={ { type: 'tween' } }
130
135
  >
131
136
  <DocumentTools
132
- disableBlockTools={ forceDisableBlockTools || isTextEditor }
137
+ disableBlockTools={ isStylesCanvasActive || isTextEditor }
133
138
  />
134
139
  { hasFixedToolbar && isLargeViewport && (
135
140
  <CollapsibleBlockToolbar
@@ -144,7 +149,7 @@ function Header( {
144
149
  variants={ toolbarVariations }
145
150
  transition={ { type: 'tween' } }
146
151
  >
147
- <DocumentBar title={ title } />
152
+ <DocumentBar />
148
153
  </motion.div>
149
154
  ) }
150
155
  <motion.div
@@ -176,7 +181,7 @@ function Header( {
176
181
  />
177
182
 
178
183
  { isWideViewport && canBeZoomedOut && (
179
- <ZoomOutToggle disabled={ forceDisableBlockTools } />
184
+ <ZoomOutToggle disabled={ isStylesCanvasActive } />
180
185
  ) }
181
186
 
182
187
  { ( isWideViewport || ! showIconLabels ) && (
@@ -25,15 +25,19 @@ import {
25
25
  MediaUpload,
26
26
  MediaUploadCheck,
27
27
  store as blockEditorStore,
28
+ privateApis as blockEditorPrivateApis,
28
29
  } from '@wordpress/block-editor';
29
30
  import { store as coreStore } from '@wordpress/core-data';
30
31
 
31
32
  /**
32
33
  * Internal dependencies
33
34
  */
35
+ import { unlock } from '../../lock-unlock';
34
36
  import PostFeaturedImageCheck from './check';
35
37
  import { store as editorStore } from '../../store';
36
38
 
39
+ const { MediaUploadModal } = unlock( blockEditorPrivateApis );
40
+
37
41
  const ALLOWED_MEDIA_TYPES = [ 'image' ];
38
42
 
39
43
  // Used when labels from post type were not yet loaded or when they are not present.
@@ -48,6 +52,45 @@ const instructions = (
48
52
  </p>
49
53
  );
50
54
 
55
+ /**
56
+ * Conditional Media component that uses MediaUploadModal when experiment is enabled,
57
+ * otherwise falls back to MediaUpload.
58
+ *
59
+ * @param {Object} root0 Component props.
60
+ * @param {Function} root0.render Render prop function that receives { open } object.
61
+ * @return {JSX.Element} The component.
62
+ */
63
+ function ConditionalMediaUpload( { render, ...props } ) {
64
+ const [ isModalOpen, setIsModalOpen ] = useState( false );
65
+ const mediaUpload = useSelect( ( select ) => {
66
+ const { getSettings } = select( blockEditorStore );
67
+ return getSettings().mediaUpload;
68
+ }, [] );
69
+
70
+ if ( window.__experimentalDataViewsMediaModal ) {
71
+ return (
72
+ <>
73
+ { render && render( { open: () => setIsModalOpen( true ) } ) }
74
+ <MediaUploadModal
75
+ { ...props }
76
+ isOpen={ isModalOpen }
77
+ onClose={ () => {
78
+ setIsModalOpen( false );
79
+ props.onClose?.();
80
+ } }
81
+ onSelect={ ( media ) => {
82
+ setIsModalOpen( false );
83
+ props.onSelect?.( media );
84
+ } }
85
+ onUpload={ mediaUpload }
86
+ />
87
+ </>
88
+ );
89
+ }
90
+
91
+ return <MediaUpload { ...props } render={ render } />;
92
+ }
93
+
51
94
  function getMediaDetails( media, postId ) {
52
95
  if ( ! media ) {
53
96
  return {};
@@ -181,7 +224,7 @@ function PostFeaturedImage( {
181
224
  </div>
182
225
  ) }
183
226
  <MediaUploadCheck fallback={ instructions }>
184
- <MediaUpload
227
+ <ConditionalMediaUpload
185
228
  title={
186
229
  postType?.labels?.featured_image ||
187
230
  DEFAULT_FEATURE_IMAGE_LABEL
@@ -3,7 +3,7 @@
3
3
 
4
4
  .editor-post-last-revision__title {
5
5
  width: 100%;
6
- font-weight: 500;
6
+ font-weight: $font-weight-medium;
7
7
  }
8
8
 
9
9
  .editor-post-last-revision__title.components-button.has-icon {
@@ -32,6 +32,7 @@
32
32
  text-wrap: pretty;
33
33
  height: auto;
34
34
  min-height: $button-size-compact;
35
+ font-weight: $font-weight-regular;
35
36
  }
36
37
 
37
38
  .components-dropdown {
@@ -182,7 +182,7 @@
182
182
  }
183
183
 
184
184
  .post-publish-panel__postpublish-header {
185
- font-weight: 500;
185
+ font-weight: $font-weight-medium;
186
186
  }
187
187
 
188
188
  .post-publish-panel__postpublish-subheader {
@@ -19,7 +19,7 @@ exports[`PostPublishPanel should render the post-publish panel if the post is pu
19
19
 
20
20
  .emotion-4 {
21
21
  font-size: 11px;
22
- font-weight: 500;
22
+ font-weight: 499;
23
23
  line-height: 1.4;
24
24
  text-transform: uppercase;
25
25
  display: block;
@@ -246,7 +246,7 @@ exports[`PostPublishPanel should render the post-publish panel if the post is sc
246
246
 
247
247
  .emotion-4 {
248
248
  font-size: 11px;
249
- font-weight: 500;
249
+ font-weight: 499;
250
250
  line-height: 1.4;
251
251
  text-transform: uppercase;
252
252
  display: block;
@@ -32,7 +32,6 @@ import useCommands from '../commands';
32
32
  import BlockRemovalWarnings from '../block-removal-warnings';
33
33
  import StartPageOptions from '../start-page-options';
34
34
  import KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';
35
- import ContentOnlySettingsMenu from '../block-settings-menu/content-only-settings-menu';
36
35
  import StartTemplateOptions from '../start-template-options';
37
36
  import EditorKeyboardShortcuts from '../global-keyboard-shortcuts';
38
37
  import PatternRenameModal from '../pattern-rename-modal';
@@ -370,7 +369,6 @@ export const ExperimentalEditorProvider = withRegistryProvider(
370
369
  <>
371
370
  <PatternsMenuItems />
372
371
  <TemplatePartMenuItems />
373
- <ContentOnlySettingsMenu />
374
372
  { mode === 'template-locked' && (
375
373
  <DisableNonPageContentBlocks />
376
374
  ) }