@wordpress/editor 14.33.3-next.36001005c.0 → 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 (353) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/bindings/post-data.js +10 -17
  3. package/build/bindings/post-data.js.map +2 -2
  4. package/build/bindings/post-meta.js +7 -14
  5. package/build/bindings/post-meta.js.map +2 -2
  6. package/build/bindings/term-data.js +6 -16
  7. package/build/bindings/term-data.js.map +2 -2
  8. package/build/components/collab-sidebar/add-comment.js +26 -3
  9. package/build/components/collab-sidebar/add-comment.js.map +3 -3
  10. package/build/components/collab-sidebar/comment-author-info.js +26 -14
  11. package/build/components/collab-sidebar/comment-author-info.js.map +2 -2
  12. package/build/components/collab-sidebar/comment-indicator-toolbar.js +6 -22
  13. package/build/components/collab-sidebar/comment-indicator-toolbar.js.map +3 -3
  14. package/build/components/collab-sidebar/comments.js +105 -28
  15. package/build/components/collab-sidebar/comments.js.map +3 -3
  16. package/build/components/collab-sidebar/hooks.js +3 -4
  17. package/build/components/collab-sidebar/hooks.js.map +2 -2
  18. package/build/components/collab-sidebar/index.js +42 -57
  19. package/build/components/collab-sidebar/index.js.map +3 -3
  20. package/build/components/document-bar/index.js +16 -3
  21. package/build/components/document-bar/index.js.map +2 -2
  22. package/build/components/editor/index.js +25 -4
  23. package/build/components/editor/index.js.map +3 -3
  24. package/build/components/editor-interface/index.js +15 -10
  25. package/build/components/editor-interface/index.js.map +3 -3
  26. package/build/components/entities-saved-states/entity-type-list.js +19 -15
  27. package/build/components/entities-saved-states/entity-type-list.js.map +3 -3
  28. package/build/components/global-styles/block-link.js +70 -0
  29. package/build/components/global-styles/block-link.js.map +7 -0
  30. package/build/components/global-styles/header.js +54 -0
  31. package/build/components/global-styles/header.js.map +7 -0
  32. package/build/components/global-styles/hooks.js +176 -0
  33. package/build/components/global-styles/hooks.js.map +7 -0
  34. package/build/components/global-styles/index.js +138 -0
  35. package/build/components/global-styles/index.js.map +7 -0
  36. package/build/components/global-styles/menu.js +95 -0
  37. package/build/components/global-styles/menu.js.map +7 -0
  38. package/build/components/global-styles-provider/index.js +3 -49
  39. package/build/components/global-styles-provider/index.js.map +3 -3
  40. package/build/components/global-styles-renderer/index.js +55 -0
  41. package/build/components/global-styles-renderer/index.js.map +7 -0
  42. package/build/components/global-styles-sidebar/default-sidebar.js +66 -0
  43. package/build/components/global-styles-sidebar/default-sidebar.js.map +7 -0
  44. package/build/components/global-styles-sidebar/index.js +182 -0
  45. package/build/components/global-styles-sidebar/index.js.map +7 -0
  46. package/build/components/global-styles-sidebar/welcome-guide-image.js +37 -0
  47. package/build/components/global-styles-sidebar/welcome-guide-image.js.map +7 -0
  48. package/build/components/global-styles-sidebar/welcome-guide.js +143 -0
  49. package/build/components/global-styles-sidebar/welcome-guide.js.map +7 -0
  50. package/build/components/header/index.js +12 -12
  51. package/build/components/header/index.js.map +3 -3
  52. package/build/components/post-featured-image/index.js +32 -1
  53. package/build/components/post-featured-image/index.js.map +3 -3
  54. package/build/components/post-template/hooks.js +7 -38
  55. package/build/components/post-template/hooks.js.map +2 -2
  56. package/build/components/provider/index.js +1 -1
  57. package/build/components/provider/index.js.map +2 -2
  58. package/build/components/style-book/categories.js +86 -0
  59. package/build/components/style-book/categories.js.map +7 -0
  60. package/build/components/style-book/color-examples.js +64 -0
  61. package/build/components/style-book/color-examples.js.map +7 -0
  62. package/build/components/style-book/constants.js +319 -0
  63. package/build/components/style-book/constants.js.map +7 -0
  64. package/build/components/style-book/duotone-examples.js +68 -0
  65. package/build/components/style-book/duotone-examples.js.map +7 -0
  66. package/build/components/style-book/examples.js +237 -0
  67. package/build/components/style-book/examples.js.map +7 -0
  68. package/build/components/style-book/index.js +627 -0
  69. package/build/components/style-book/index.js.map +7 -0
  70. package/build/components/style-book/types.js +17 -0
  71. package/build/components/style-book/types.js.map +7 -0
  72. package/build/components/styles-canvas/index.js +138 -0
  73. package/build/components/styles-canvas/index.js.map +7 -0
  74. package/build/components/styles-canvas/revisions.js +121 -0
  75. package/build/components/styles-canvas/revisions.js.map +7 -0
  76. package/build/components/styles-canvas/style-book.js +68 -0
  77. package/build/components/styles-canvas/style-book.js.map +7 -0
  78. package/build/components/visual-editor/index.js +4 -3
  79. package/build/components/visual-editor/index.js.map +2 -2
  80. package/build/dataviews/fields/content-preview/content-preview-view.js.map +2 -2
  81. package/build/hooks/index.js +1 -0
  82. package/build/hooks/index.js.map +2 -2
  83. package/build/hooks/media-upload.js +15 -4
  84. package/build/hooks/media-upload.js.map +3 -3
  85. package/build/hooks/push-changes-to-global-styles/index.js +322 -0
  86. package/build/hooks/push-changes-to-global-styles/index.js.map +7 -0
  87. package/build/hooks/use-global-styles-output.js +74 -0
  88. package/build/hooks/use-global-styles-output.js.map +7 -0
  89. package/build/private-apis.js +10 -5
  90. package/build/private-apis.js.map +3 -3
  91. package/build/store/actions.js +1 -1
  92. package/build/store/actions.js.map +2 -2
  93. package/build/store/private-actions.js +23 -0
  94. package/build/store/private-actions.js.map +2 -2
  95. package/build/store/private-selectors.js +10 -0
  96. package/build/store/private-selectors.js.map +2 -2
  97. package/build/store/reducer.js +24 -0
  98. package/build/store/reducer.js.map +2 -2
  99. package/build/{components/editor-interface/content-slot-fill.js → utils/set-nested-value.js} +24 -10
  100. package/build/utils/set-nested-value.js.map +7 -0
  101. package/build-module/bindings/post-data.js +10 -17
  102. package/build-module/bindings/post-data.js.map +2 -2
  103. package/build-module/bindings/post-meta.js +7 -14
  104. package/build-module/bindings/post-meta.js.map +2 -2
  105. package/build-module/bindings/term-data.js +6 -16
  106. package/build-module/bindings/term-data.js.map +2 -2
  107. package/build-module/components/collab-sidebar/add-comment.js +27 -4
  108. package/build-module/components/collab-sidebar/add-comment.js.map +2 -2
  109. package/build-module/components/collab-sidebar/comment-author-info.js +26 -14
  110. package/build-module/components/collab-sidebar/comment-author-info.js.map +2 -2
  111. package/build-module/components/collab-sidebar/comment-indicator-toolbar.js +6 -12
  112. package/build-module/components/collab-sidebar/comment-indicator-toolbar.js.map +2 -2
  113. package/build-module/components/collab-sidebar/comments.js +114 -31
  114. package/build-module/components/collab-sidebar/comments.js.map +2 -2
  115. package/build-module/components/collab-sidebar/hooks.js +3 -4
  116. package/build-module/components/collab-sidebar/hooks.js.map +2 -2
  117. package/build-module/components/collab-sidebar/index.js +42 -57
  118. package/build-module/components/collab-sidebar/index.js.map +2 -2
  119. package/build-module/components/document-bar/index.js +16 -3
  120. package/build-module/components/document-bar/index.js.map +2 -2
  121. package/build-module/components/editor/index.js +25 -4
  122. package/build-module/components/editor/index.js.map +2 -2
  123. package/build-module/components/editor-interface/index.js +15 -10
  124. package/build-module/components/editor-interface/index.js.map +2 -2
  125. package/build-module/components/entities-saved-states/entity-type-list.js +18 -14
  126. package/build-module/components/entities-saved-states/entity-type-list.js.map +2 -2
  127. package/build-module/components/global-styles/block-link.js +46 -0
  128. package/build-module/components/global-styles/block-link.js.map +7 -0
  129. package/build-module/components/global-styles/header.js +41 -0
  130. package/build-module/components/global-styles/header.js.map +7 -0
  131. package/build-module/components/global-styles/hooks.js +154 -0
  132. package/build-module/components/global-styles/hooks.js.map +7 -0
  133. package/build-module/components/global-styles/index.js +112 -0
  134. package/build-module/components/global-styles/index.js.map +7 -0
  135. package/build-module/components/global-styles/menu.js +71 -0
  136. package/build-module/components/global-styles/menu.js.map +7 -0
  137. package/build-module/components/global-styles-provider/index.js +3 -37
  138. package/build-module/components/global-styles-provider/index.js.map +2 -2
  139. package/build-module/components/global-styles-renderer/index.js +31 -0
  140. package/build-module/components/global-styles-renderer/index.js.map +7 -0
  141. package/build-module/components/global-styles-sidebar/default-sidebar.js +49 -0
  142. package/build-module/components/global-styles-sidebar/default-sidebar.js.map +7 -0
  143. package/build-module/components/global-styles-sidebar/index.js +152 -0
  144. package/build-module/components/global-styles-sidebar/index.js.map +7 -0
  145. package/build-module/components/global-styles-sidebar/welcome-guide-image.js +17 -0
  146. package/build-module/components/global-styles-sidebar/welcome-guide-image.js.map +7 -0
  147. package/build-module/components/global-styles-sidebar/welcome-guide.js +113 -0
  148. package/build-module/components/global-styles-sidebar/welcome-guide.js.map +7 -0
  149. package/build-module/components/header/index.js +12 -12
  150. package/build-module/components/header/index.js.map +2 -2
  151. package/build-module/components/post-featured-image/index.js +35 -3
  152. package/build-module/components/post-featured-image/index.js.map +2 -2
  153. package/build-module/components/post-template/hooks.js +7 -38
  154. package/build-module/components/post-template/hooks.js.map +2 -2
  155. package/build-module/components/provider/index.js +1 -1
  156. package/build-module/components/provider/index.js.map +2 -2
  157. package/build-module/components/style-book/categories.js +64 -0
  158. package/build-module/components/style-book/categories.js.map +7 -0
  159. package/build-module/components/style-book/color-examples.js +37 -0
  160. package/build-module/components/style-book/color-examples.js.map +7 -0
  161. package/build-module/components/style-book/constants.js +290 -0
  162. package/build-module/components/style-book/constants.js.map +7 -0
  163. package/build-module/components/style-book/duotone-examples.js +48 -0
  164. package/build-module/components/style-book/duotone-examples.js.map +7 -0
  165. package/build-module/components/style-book/examples.js +208 -0
  166. package/build-module/components/style-book/examples.js.map +7 -0
  167. package/build-module/components/style-book/index.js +618 -0
  168. package/build-module/components/style-book/index.js.map +7 -0
  169. package/build-module/components/style-book/types.js +1 -0
  170. package/build-module/components/style-book/types.js.map +7 -0
  171. package/build-module/components/styles-canvas/index.js +104 -0
  172. package/build-module/components/styles-canvas/index.js.map +7 -0
  173. package/build-module/components/styles-canvas/revisions.js +107 -0
  174. package/build-module/components/styles-canvas/revisions.js.map +7 -0
  175. package/build-module/components/styles-canvas/style-book.js +38 -0
  176. package/build-module/components/styles-canvas/style-book.js.map +7 -0
  177. package/build-module/components/visual-editor/index.js +4 -3
  178. package/build-module/components/visual-editor/index.js.map +2 -2
  179. package/build-module/dataviews/fields/content-preview/content-preview-view.js.map +2 -2
  180. package/build-module/hooks/index.js +1 -0
  181. package/build-module/hooks/index.js.map +2 -2
  182. package/build-module/hooks/media-upload.js +19 -5
  183. package/build-module/hooks/media-upload.js.map +2 -2
  184. package/build-module/hooks/push-changes-to-global-styles/index.js +309 -0
  185. package/build-module/hooks/push-changes-to-global-styles/index.js.map +7 -0
  186. package/build-module/hooks/use-global-styles-output.js +49 -0
  187. package/build-module/hooks/use-global-styles-output.js.map +7 -0
  188. package/build-module/private-apis.js +10 -8
  189. package/build-module/private-apis.js.map +2 -2
  190. package/build-module/store/actions.js +1 -1
  191. package/build-module/store/actions.js.map +2 -2
  192. package/build-module/store/private-actions.js +20 -0
  193. package/build-module/store/private-actions.js.map +2 -2
  194. package/build-module/store/private-selectors.js +8 -0
  195. package/build-module/store/private-selectors.js.map +2 -2
  196. package/build-module/store/reducer.js +22 -0
  197. package/build-module/store/reducer.js.map +2 -2
  198. package/build-module/utils/set-nested-value.js +23 -0
  199. package/build-module/utils/set-nested-value.js.map +7 -0
  200. package/build-style/style-rtl.css +3011 -16
  201. package/build-style/style.css +3012 -16
  202. package/build-types/bindings/post-data.d.ts +6 -16
  203. package/build-types/bindings/post-meta.d.ts +6 -13
  204. package/build-types/bindings/term-data.d.ts +6 -16
  205. package/build-types/components/collab-sidebar/add-comment.d.ts +6 -1
  206. package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -1
  207. package/build-types/components/collab-sidebar/comment-author-info.d.ts +5 -16
  208. package/build-types/components/collab-sidebar/comment-author-info.d.ts.map +1 -1
  209. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts +1 -2
  210. package/build-types/components/collab-sidebar/comment-indicator-toolbar.d.ts.map +1 -1
  211. package/build-types/components/collab-sidebar/comments.d.ts +12 -26
  212. package/build-types/components/collab-sidebar/comments.d.ts.map +1 -1
  213. package/build-types/components/collab-sidebar/hooks.d.ts +0 -1
  214. package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
  215. package/build-types/components/collab-sidebar/index.d.ts +1 -4
  216. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  217. package/build-types/components/document-bar/index.d.ts +2 -2
  218. package/build-types/components/document-bar/index.d.ts.map +1 -1
  219. package/build-types/components/editor/index.d.ts.map +1 -1
  220. package/build-types/components/editor-interface/index.d.ts +1 -3
  221. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  222. package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -1
  223. package/build-types/components/global-styles/block-link.d.ts +12 -0
  224. package/build-types/components/global-styles/block-link.d.ts.map +1 -0
  225. package/build-types/components/global-styles/header.d.ts +7 -0
  226. package/build-types/components/global-styles/header.d.ts.map +1 -0
  227. package/build-types/components/global-styles/hooks.d.ts +24 -0
  228. package/build-types/components/global-styles/hooks.d.ts.map +1 -0
  229. package/build-types/components/global-styles/index.d.ts +6 -0
  230. package/build-types/components/global-styles/index.d.ts.map +1 -0
  231. package/build-types/components/global-styles/menu.d.ts +13 -0
  232. package/build-types/components/global-styles/menu.d.ts.map +1 -0
  233. package/build-types/components/global-styles-provider/index.d.ts +1 -5
  234. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  235. package/build-types/components/global-styles-renderer/index.d.ts +4 -0
  236. package/build-types/components/global-styles-renderer/index.d.ts.map +1 -0
  237. package/build-types/components/global-styles-sidebar/default-sidebar.d.ts +13 -0
  238. package/build-types/components/global-styles-sidebar/default-sidebar.d.ts.map +1 -0
  239. package/build-types/components/global-styles-sidebar/index.d.ts +2 -0
  240. package/build-types/components/global-styles-sidebar/index.d.ts.map +1 -0
  241. package/build-types/components/global-styles-sidebar/welcome-guide-image.d.ts +5 -0
  242. package/build-types/components/global-styles-sidebar/welcome-guide-image.d.ts.map +1 -0
  243. package/build-types/components/global-styles-sidebar/welcome-guide.d.ts +2 -0
  244. package/build-types/components/global-styles-sidebar/welcome-guide.d.ts.map +1 -0
  245. package/build-types/components/header/index.d.ts +1 -3
  246. package/build-types/components/header/index.d.ts.map +1 -1
  247. package/build-types/components/post-template/hooks.d.ts +1 -1
  248. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  249. package/build-types/components/provider/index.d.ts.map +1 -1
  250. package/build-types/components/style-book/categories.d.ts +18 -0
  251. package/build-types/components/style-book/categories.d.ts.map +1 -0
  252. package/build-types/components/style-book/color-examples.d.ts +7 -0
  253. package/build-types/components/style-book/color-examples.d.ts.map +1 -0
  254. package/build-types/components/style-book/constants.d.ts +11 -0
  255. package/build-types/components/style-book/constants.d.ts.map +1 -0
  256. package/build-types/components/style-book/duotone-examples.d.ts +9 -0
  257. package/build-types/components/style-book/duotone-examples.d.ts.map +1 -0
  258. package/build-types/components/style-book/examples.d.ts +12 -0
  259. package/build-types/components/style-book/examples.d.ts.map +1 -0
  260. package/build-types/components/style-book/index.d.ts +31 -0
  261. package/build-types/components/style-book/index.d.ts.map +1 -0
  262. package/build-types/components/style-book/types.d.ts +72 -0
  263. package/build-types/components/style-book/types.d.ts.map +1 -0
  264. package/build-types/components/styles-canvas/index.d.ts +16 -0
  265. package/build-types/components/styles-canvas/index.d.ts.map +1 -0
  266. package/build-types/components/styles-canvas/revisions.d.ts +5 -0
  267. package/build-types/components/styles-canvas/revisions.d.ts.map +1 -0
  268. package/build-types/components/styles-canvas/style-book.d.ts +6 -0
  269. package/build-types/components/styles-canvas/style-book.d.ts.map +1 -0
  270. package/build-types/components/visual-editor/index.d.ts +1 -2
  271. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  272. package/build-types/dataviews/fields/content-preview/content-preview-view.d.ts.map +1 -1
  273. package/build-types/hooks/push-changes-to-global-styles/index.d.ts +2 -0
  274. package/build-types/hooks/push-changes-to-global-styles/index.d.ts.map +1 -0
  275. package/build-types/hooks/use-global-styles-output.d.ts +18 -0
  276. package/build-types/hooks/use-global-styles-output.d.ts.map +1 -0
  277. package/build-types/private-apis.d.ts.map +1 -1
  278. package/build-types/store/actions.d.ts.map +1 -1
  279. package/build-types/store/private-actions.d.ts +20 -0
  280. package/build-types/store/private-actions.d.ts.map +1 -1
  281. package/build-types/store/private-selectors.d.ts +14 -0
  282. package/build-types/store/private-selectors.d.ts.map +1 -1
  283. package/build-types/store/reducer.d.ts +20 -0
  284. package/build-types/store/reducer.d.ts.map +1 -1
  285. package/build-types/utils/set-nested-value.d.ts +20 -0
  286. package/build-types/utils/set-nested-value.d.ts.map +1 -0
  287. package/package.json +40 -40
  288. package/src/bindings/post-data.js +9 -20
  289. package/src/bindings/post-meta.js +6 -17
  290. package/src/bindings/term-data.js +6 -21
  291. package/src/components/collab-sidebar/add-comment.js +31 -3
  292. package/src/components/collab-sidebar/comment-author-info.js +32 -25
  293. package/src/components/collab-sidebar/comment-indicator-toolbar.js +6 -22
  294. package/src/components/collab-sidebar/comments.js +108 -35
  295. package/src/components/collab-sidebar/hooks.js +3 -4
  296. package/src/components/collab-sidebar/index.js +34 -42
  297. package/src/components/collab-sidebar/style.scss +1 -22
  298. package/src/components/document-bar/index.js +18 -3
  299. package/src/components/editor/index.js +27 -1
  300. package/src/components/editor-interface/index.js +40 -39
  301. package/src/components/entities-saved-states/entity-type-list.js +19 -17
  302. package/src/components/global-styles/block-link.js +65 -0
  303. package/src/components/global-styles/header.js +48 -0
  304. package/src/components/global-styles/hooks.js +216 -0
  305. package/src/components/global-styles/index.js +125 -0
  306. package/src/components/global-styles/menu.js +101 -0
  307. package/src/components/global-styles/style.scss +11 -0
  308. package/src/components/global-styles-provider/index.js +3 -45
  309. package/src/components/global-styles-renderer/index.js +39 -0
  310. package/src/components/global-styles-sidebar/default-sidebar.js +46 -0
  311. package/src/components/global-styles-sidebar/index.js +177 -0
  312. package/src/components/global-styles-sidebar/style.scss +119 -0
  313. package/src/components/global-styles-sidebar/welcome-guide-image.js +11 -0
  314. package/src/components/global-styles-sidebar/welcome-guide.js +136 -0
  315. package/src/components/header/index.js +11 -13
  316. package/src/components/post-featured-image/index.js +44 -1
  317. package/src/components/post-template/hooks.js +10 -51
  318. package/src/components/provider/index.js +1 -4
  319. package/src/components/style-book/categories.ts +97 -0
  320. package/src/components/style-book/color-examples.tsx +56 -0
  321. package/src/components/style-book/constants.ts +308 -0
  322. package/src/components/style-book/duotone-examples.tsx +56 -0
  323. package/src/components/style-book/examples.tsx +273 -0
  324. package/src/components/style-book/index.js +794 -0
  325. package/src/components/style-book/style.scss +44 -0
  326. package/src/components/style-book/test/categories.js +166 -0
  327. package/src/components/style-book/types.ts +80 -0
  328. package/src/components/styles-canvas/index.js +126 -0
  329. package/src/components/styles-canvas/revisions.js +144 -0
  330. package/src/components/styles-canvas/style-book.js +57 -0
  331. package/src/components/styles-canvas/style.scss +40 -0
  332. package/src/components/visual-editor/index.js +2 -1
  333. package/src/dataviews/fields/content-preview/content-preview-view.tsx +2 -0
  334. package/src/hooks/index.js +1 -0
  335. package/src/hooks/media-upload.js +25 -5
  336. package/src/hooks/push-changes-to-global-styles/index.js +391 -0
  337. package/src/hooks/push-changes-to-global-styles/style.scss +4 -0
  338. package/src/hooks/use-global-styles-output.js +76 -0
  339. package/src/private-apis.js +10 -8
  340. package/src/store/actions.js +4 -1
  341. package/src/store/private-actions.js +37 -0
  342. package/src/store/private-selectors.js +20 -0
  343. package/src/store/reducer.js +36 -0
  344. package/src/style.scss +7 -0
  345. package/src/utils/set-nested-value.js +39 -0
  346. package/tsconfig.json +3 -0
  347. package/tsconfig.tsbuildinfo +1 -1
  348. package/build/components/editor-interface/content-slot-fill.js.map +0 -7
  349. package/build-module/components/editor-interface/content-slot-fill.js +0 -9
  350. package/build-module/components/editor-interface/content-slot-fill.js.map +0 -7
  351. package/build-types/components/editor-interface/content-slot-fill.d.ts +0 -14
  352. package/build-types/components/editor-interface/content-slot-fill.d.ts.map +0 -1
  353. package/src/components/editor-interface/content-slot-fill.js +0 -10
@@ -0,0 +1,125 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { store as coreStore } from '@wordpress/core-data';
5
+ import { useSelect } from '@wordpress/data';
6
+ import { useMemo } from '@wordpress/element';
7
+ import { GlobalStylesUI } from '@wordpress/global-styles-ui';
8
+ import { uploadMedia } from '@wordpress/media-utils';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import { store as editorStore } from '../../store';
14
+ import { GlobalStylesBlockLink } from './block-link';
15
+ import { useGlobalStyles } from './hooks';
16
+
17
+ /**
18
+ * Hook to fetch server CSS and settings for BlockEditorProvider that are not Global Styles.
19
+ */
20
+ function useServerData() {
21
+ const {
22
+ styles,
23
+ __unstableResolvedAssets,
24
+ colors,
25
+ gradients,
26
+ __experimentalDiscussionSettings,
27
+ mediaUploadHandler,
28
+ fontLibraryEnabled,
29
+ } = useSelect( ( select ) => {
30
+ const { getEditorSettings } = select( editorStore );
31
+ const { canUser } = select( coreStore );
32
+ const editorSettings = getEditorSettings();
33
+
34
+ const canUserUploadMedia = canUser( 'create', {
35
+ kind: 'root',
36
+ name: 'media',
37
+ } );
38
+
39
+ return {
40
+ styles: editorSettings?.styles || [],
41
+ __unstableResolvedAssets:
42
+ editorSettings?.__unstableResolvedAssets || {},
43
+ colors: editorSettings?.colors || [],
44
+ gradients: editorSettings?.gradients || [],
45
+ __experimentalDiscussionSettings:
46
+ editorSettings?.__experimentalDiscussionSettings,
47
+ mediaUploadHandler: canUserUploadMedia ? uploadMedia : undefined,
48
+ fontLibraryEnabled: editorSettings?.fontLibraryEnabled ?? true,
49
+ };
50
+ }, [] );
51
+
52
+ // Filter out global styles to get only server-provided styles
53
+ const serverCSS = useMemo( () => {
54
+ if ( ! styles ) {
55
+ return [];
56
+ }
57
+ return styles.filter( ( style ) => ! style.isGlobalStyles );
58
+ }, [ styles ] );
59
+
60
+ // Create server settings object
61
+ const serverSettings = useMemo( () => {
62
+ return {
63
+ __unstableResolvedAssets,
64
+ settings: {
65
+ color: {
66
+ palette: {
67
+ theme: colors,
68
+ },
69
+ gradients: {
70
+ theme: gradients,
71
+ },
72
+ duotone: {
73
+ theme: [],
74
+ },
75
+ },
76
+ },
77
+ __experimentalDiscussionSettings,
78
+ mediaUpload: mediaUploadHandler,
79
+ };
80
+ }, [
81
+ __unstableResolvedAssets,
82
+ colors,
83
+ gradients,
84
+ __experimentalDiscussionSettings,
85
+ mediaUploadHandler,
86
+ ] );
87
+
88
+ return { serverCSS, serverSettings, fontLibraryEnabled };
89
+ }
90
+
91
+ export default function GlobalStylesUIWrapper( { path, onPathChange } ) {
92
+ const {
93
+ user: userConfig,
94
+ base: baseConfig,
95
+ setUser: setUserConfig,
96
+ isReady,
97
+ } = useGlobalStyles();
98
+ const { serverCSS, serverSettings, fontLibraryEnabled } = useServerData();
99
+
100
+ // Show loading state while data is being fetched
101
+ if ( ! isReady ) {
102
+ return null;
103
+ }
104
+
105
+ return (
106
+ <>
107
+ <GlobalStylesUI
108
+ value={ userConfig }
109
+ baseValue={ baseConfig || {} }
110
+ onChange={ setUserConfig }
111
+ path={ path }
112
+ onPathChange={ onPathChange }
113
+ fontLibraryEnabled={ fontLibraryEnabled }
114
+ serverCSS={ serverCSS }
115
+ serverSettings={ serverSettings }
116
+ />
117
+ <GlobalStylesBlockLink
118
+ path={ path }
119
+ onPathChange={ onPathChange }
120
+ />
121
+ </>
122
+ );
123
+ }
124
+
125
+ export { useGlobalStyles, useStyle, useSetting } from './hooks';
@@ -0,0 +1,101 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
5
+ import { useSelect, useDispatch } from '@wordpress/data';
6
+ import { __ } from '@wordpress/i18n';
7
+ import { store as preferencesStore } from '@wordpress/preferences';
8
+ import { moreVertical } from '@wordpress/icons';
9
+ import { store as coreStore } from '@wordpress/core-data';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import { useGlobalStyles } from './hooks';
15
+
16
+ /**
17
+ * Action menu with Reset, Welcome Guide, and Additional CSS.
18
+ *
19
+ * @param {Object} props Component props.
20
+ * @param {boolean} props.hideWelcomeGuide Whether to hide the Welcome Guide option.
21
+ * @param {Function} props.onChangePath Callback for navigation to different paths (e.g., '/css').
22
+ * @return {JSX.Element} The Global Styles Action Menu component.
23
+ */
24
+ export function GlobalStylesActionMenu( {
25
+ hideWelcomeGuide = false,
26
+ onChangePath,
27
+ } ) {
28
+ const { user, setUser } = useGlobalStyles();
29
+
30
+ // Check if there are user customizations that can be reset
31
+ const canReset =
32
+ !! user &&
33
+ ( Object.keys( user?.styles ?? {} ).length > 0 ||
34
+ Object.keys( user?.settings ?? {} ).length > 0 );
35
+
36
+ // Reset function to clear all user customizations
37
+ const onReset = () => {
38
+ setUser( { styles: {}, settings: {} } );
39
+ };
40
+ const { toggle } = useDispatch( preferencesStore );
41
+ const { canEditCSS } = useSelect( ( select ) => {
42
+ const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
43
+ select( coreStore );
44
+
45
+ const globalStylesId = __experimentalGetCurrentGlobalStylesId();
46
+ const globalStyles = globalStylesId
47
+ ? getEntityRecord( 'root', 'globalStyles', globalStylesId )
48
+ : undefined;
49
+
50
+ return {
51
+ canEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],
52
+ };
53
+ }, [] );
54
+ const loadCustomCSS = () => {
55
+ onChangePath( '/css' );
56
+ };
57
+
58
+ return (
59
+ <DropdownMenu
60
+ icon={ moreVertical }
61
+ label={ __( 'More' ) }
62
+ toggleProps={ { size: 'compact' } }
63
+ >
64
+ { ( { onClose } ) => (
65
+ <>
66
+ <MenuGroup>
67
+ { canEditCSS && (
68
+ <MenuItem onClick={ loadCustomCSS }>
69
+ { __( 'Additional CSS' ) }
70
+ </MenuItem>
71
+ ) }
72
+ { ! hideWelcomeGuide && (
73
+ <MenuItem
74
+ onClick={ () => {
75
+ toggle(
76
+ 'core/edit-site',
77
+ 'welcomeGuideStyles'
78
+ );
79
+ onClose();
80
+ } }
81
+ >
82
+ { __( 'Welcome Guide' ) }
83
+ </MenuItem>
84
+ ) }
85
+ </MenuGroup>
86
+ <MenuGroup>
87
+ <MenuItem
88
+ onClick={ () => {
89
+ onReset();
90
+ onClose();
91
+ } }
92
+ disabled={ ! canReset }
93
+ >
94
+ { __( 'Reset styles' ) }
95
+ </MenuItem>
96
+ </MenuGroup>
97
+ </>
98
+ ) }
99
+ </DropdownMenu>
100
+ );
101
+ }
@@ -0,0 +1,11 @@
1
+ @use "@wordpress/base-styles/colors" as *;
2
+ @use "@wordpress/base-styles/variables" as *;
3
+
4
+ .editor-global-styles-header__description {
5
+ padding: 0 $grid-unit-20;
6
+ }
7
+
8
+ .editor-global-styles-header {
9
+ // Need to override the too specific bottom margin for complementary areas.
10
+ margin-bottom: 0 !important;
11
+ }
@@ -1,9 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import deepmerge from 'deepmerge';
5
- import { isPlainObject } from 'is-plain-object';
6
-
7
1
  /**
8
2
  * WordPress dependencies
9
3
  */
@@ -11,37 +5,14 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
11
5
  import { store as coreStore } from '@wordpress/core-data';
12
6
  import { useSelect, useDispatch } from '@wordpress/data';
13
7
  import { useMemo, useCallback } from '@wordpress/element';
8
+ import { mergeGlobalStyles } from '@wordpress/global-styles-engine';
14
9
 
15
10
  /**
16
11
  * Internal dependencies
17
12
  */
18
13
  import { unlock } from '../../lock-unlock';
19
14
 
20
- const { GlobalStylesContext, cleanEmptyObject } = unlock(
21
- blockEditorPrivateApis
22
- );
23
-
24
- export function mergeBaseAndUserConfigs( base, user ) {
25
- return deepmerge( base, user, {
26
- /*
27
- * We only pass as arrays the presets,
28
- * in which case we want the new array of values
29
- * to override the old array (no merging).
30
- */
31
- isMergeableObject: isPlainObject,
32
- /*
33
- * Exceptions to the above rule.
34
- * Background images should be replaced, not merged,
35
- * as they themselves are specific object definitions for the style.
36
- */
37
- customMerge: ( key ) => {
38
- if ( key === 'backgroundImage' ) {
39
- return ( baseConfig, userConfig ) => userConfig;
40
- }
41
- return undefined;
42
- },
43
- } );
44
- }
15
+ const { cleanEmptyObject } = unlock( blockEditorPrivateApis );
45
16
 
46
17
  function useGlobalStylesUserConfig() {
47
18
  const { globalStylesId, isReady, settings, styles, _links } = useSelect(
@@ -212,7 +183,7 @@ export function useGlobalStylesContext() {
212
183
  return {};
213
184
  }
214
185
 
215
- return mergeBaseAndUserConfigs( baseConfig, userConfig );
186
+ return mergeGlobalStyles( baseConfig, userConfig );
216
187
  }, [ userConfig, baseConfig ] );
217
188
 
218
189
  const context = useMemo( () => {
@@ -234,16 +205,3 @@ export function useGlobalStylesContext() {
234
205
 
235
206
  return context;
236
207
  }
237
-
238
- export function GlobalStylesProvider( { children } ) {
239
- const context = useGlobalStylesContext();
240
- if ( ! context.isReady ) {
241
- return null;
242
- }
243
-
244
- return (
245
- <GlobalStylesContext.Provider value={ context }>
246
- { children }
247
- </GlobalStylesContext.Provider>
248
- );
249
- }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useEffect } from '@wordpress/element';
5
+ import { useSelect, useDispatch } from '@wordpress/data';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { store as editorStore } from '../../store';
11
+ import { useGlobalStylesOutput } from '../../hooks/use-global-styles-output';
12
+
13
+ function useGlobalStylesRenderer( disableRootPadding ) {
14
+ const [ styles, settings ] = useGlobalStylesOutput( disableRootPadding );
15
+ const { getEditorSettings } = useSelect( editorStore );
16
+ const { updateEditorSettings } = useDispatch( editorStore );
17
+
18
+ useEffect( () => {
19
+ if ( ! styles || ! settings ) {
20
+ return;
21
+ }
22
+
23
+ const currentStoreSettings = getEditorSettings();
24
+ const nonGlobalStyles = Object.values(
25
+ currentStoreSettings.styles ?? []
26
+ ).filter( ( style ) => ! style.isGlobalStyles );
27
+ updateEditorSettings( {
28
+ ...currentStoreSettings,
29
+ styles: [ ...nonGlobalStyles, ...styles ],
30
+ __experimentalFeatures: settings,
31
+ } );
32
+ }, [ styles, settings, updateEditorSettings, getEditorSettings ] );
33
+ }
34
+
35
+ export function GlobalStylesRenderer( { disableRootPadding } ) {
36
+ useGlobalStylesRenderer( disableRootPadding );
37
+
38
+ return null;
39
+ }
@@ -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
+ }