@wordpress/edit-site 6.10.0 → 6.11.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 (439) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-post/index.js +1 -1
  3. package/build/components/add-new-post/index.js.map +1 -1
  4. package/build/components/add-new-template/index.js +1 -1
  5. package/build/components/add-new-template/index.js.map +1 -1
  6. package/build/components/add-new-template/utils.js +8 -8
  7. package/build/components/add-new-template/utils.js.map +1 -1
  8. package/build/components/app/index.js +2 -0
  9. package/build/components/app/index.js.map +1 -1
  10. package/build/components/block-editor/use-editor-iframe-props.js +29 -20
  11. package/build/components/block-editor/use-editor-iframe-props.js.map +1 -1
  12. package/build/components/block-editor/use-site-editor-settings.js +10 -8
  13. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  14. package/build/components/editor/index.js +23 -10
  15. package/build/components/editor/index.js.map +1 -1
  16. package/build/components/editor/use-adapt-editor-to-canvas.js +49 -0
  17. package/build/components/editor/use-adapt-editor-to-canvas.js.map +1 -0
  18. package/build/components/editor/use-editor-title.js +2 -2
  19. package/build/components/editor/use-editor-title.js.map +1 -1
  20. package/build/components/global-styles/font-sizes/font-size.js +6 -6
  21. package/build/components/global-styles/font-sizes/font-size.js.map +1 -1
  22. package/build/components/global-styles/font-sizes/font-sizes-count.js +0 -1
  23. package/build/components/global-styles/font-sizes/font-sizes-count.js.map +1 -1
  24. package/build/components/global-styles/font-sizes/font-sizes.js +4 -4
  25. package/build/components/global-styles/font-sizes/font-sizes.js.map +1 -1
  26. package/build/components/global-styles/palette.js +16 -13
  27. package/build/components/global-styles/palette.js.map +1 -1
  28. package/build/components/global-styles/root-menu.js +0 -4
  29. package/build/components/global-styles/root-menu.js.map +1 -1
  30. package/build/components/global-styles/screen-block-list.js +0 -4
  31. package/build/components/global-styles/screen-block-list.js.map +1 -1
  32. package/build/components/global-styles/screen-css.js +1 -1
  33. package/build/components/global-styles/screen-css.js.map +1 -1
  34. package/build/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  35. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  36. package/build/components/global-styles/screen-root.js +0 -3
  37. package/build/components/global-styles/screen-root.js.map +1 -1
  38. package/build/components/global-styles/screen-style-variations.js +5 -1
  39. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  40. package/build/components/global-styles/shadows-edit-panel.js +9 -10
  41. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  42. package/build/components/global-styles/shadows-panel.js +0 -3
  43. package/build/components/global-styles/shadows-panel.js.map +1 -1
  44. package/build/components/global-styles/typography-elements.js +1 -4
  45. package/build/components/global-styles/typography-elements.js.map +1 -1
  46. package/build/components/global-styles/ui.js +7 -0
  47. package/build/components/global-styles/ui.js.map +1 -1
  48. package/build/components/global-styles/variations/variation.js +2 -2
  49. package/build/components/global-styles/variations/variation.js.map +1 -1
  50. package/build/components/global-styles/variations/variations-panel.js +0 -1
  51. package/build/components/global-styles/variations/variations-panel.js.map +1 -1
  52. package/build/components/global-styles-sidebar/default-sidebar.js +0 -1
  53. package/build/components/global-styles-sidebar/default-sidebar.js.map +1 -1
  54. package/build/components/global-styles-sidebar/index.js +43 -30
  55. package/build/components/global-styles-sidebar/index.js.map +1 -1
  56. package/build/components/layout/animation.js +1 -3
  57. package/build/components/layout/animation.js.map +1 -1
  58. package/build/components/layout/index.js +22 -35
  59. package/build/components/layout/index.js.map +1 -1
  60. package/build/components/layout/router.js +17 -140
  61. package/build/components/layout/router.js.map +1 -1
  62. package/build/components/page-patterns/delete-category-menu-item.js +3 -3
  63. package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
  64. package/build/components/page-patterns/use-pattern-settings.js +1 -1
  65. package/build/components/page-patterns/use-pattern-settings.js.map +1 -1
  66. package/build/components/page-templates/index.js +1 -2
  67. package/build/components/page-templates/index.js.map +1 -1
  68. package/build/components/pagination/index.js +1 -1
  69. package/build/components/pagination/index.js.map +1 -1
  70. package/build/components/post-edit/index.js +8 -4
  71. package/build/components/post-edit/index.js.map +1 -1
  72. package/build/components/post-fields/index.js +6 -52
  73. package/build/components/post-fields/index.js.map +1 -1
  74. package/build/components/post-list/index.js +1 -1
  75. package/build/components/post-list/index.js.map +1 -1
  76. package/build/components/posts-app/index.js.map +1 -1
  77. package/build/components/posts-app/router.js +4 -4
  78. package/build/components/posts-app/router.js.map +1 -1
  79. package/build/components/resizable-frame/index.js +21 -9
  80. package/build/components/resizable-frame/index.js.map +1 -1
  81. package/build/components/revisions/index.js +1 -1
  82. package/build/components/revisions/index.js.map +1 -1
  83. package/build/components/save-keyboard-shortcut/index.js +78 -0
  84. package/build/components/save-keyboard-shortcut/index.js.map +1 -0
  85. package/build/components/save-panel/index.js +17 -6
  86. package/build/components/save-panel/index.js.map +1 -1
  87. package/build/components/sidebar-dataviews/default-views.js +2 -5
  88. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  89. package/build/components/sidebar-navigation-screen/index.js +2 -1
  90. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  91. package/build/components/sidebar-navigation-screen-global-styles/index.js +30 -10
  92. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  93. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  94. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  95. package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +3 -3
  96. package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -1
  97. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +7 -12
  98. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  99. package/build/components/site-editor-routes/home-edit.js +26 -0
  100. package/build/components/site-editor-routes/home-edit.js.map +1 -0
  101. package/build/components/site-editor-routes/home-view.js +25 -0
  102. package/build/components/site-editor-routes/home-view.js.map +1 -0
  103. package/build/components/site-editor-routes/index.js +49 -0
  104. package/build/components/site-editor-routes/index.js.map +1 -0
  105. package/build/components/site-editor-routes/navigation-edit.js +29 -0
  106. package/build/components/site-editor-routes/navigation-edit.js.map +1 -0
  107. package/build/components/site-editor-routes/navigation-item-edit.js +31 -0
  108. package/build/components/site-editor-routes/navigation-item-edit.js.map +1 -0
  109. package/build/components/site-editor-routes/navigation-item-view.js +30 -0
  110. package/build/components/site-editor-routes/navigation-item-view.js.map +1 -0
  111. package/build/components/site-editor-routes/navigation-view.js +28 -0
  112. package/build/components/site-editor-routes/navigation-view.js.map +1 -0
  113. package/build/components/site-editor-routes/pages-edit.js +43 -0
  114. package/build/components/site-editor-routes/pages-edit.js.map +1 -0
  115. package/build/components/site-editor-routes/pages-list-view-quick-edit.js +64 -0
  116. package/build/components/site-editor-routes/pages-list-view-quick-edit.js.map +1 -0
  117. package/build/components/site-editor-routes/pages-list-view.js +47 -0
  118. package/build/components/site-editor-routes/pages-list-view.js.map +1 -0
  119. package/build/components/site-editor-routes/pages-view-quick-edit.js +61 -0
  120. package/build/components/site-editor-routes/pages-view-quick-edit.js.map +1 -0
  121. package/build/components/site-editor-routes/pages-view.js +42 -0
  122. package/build/components/site-editor-routes/pages-view.js.map +1 -0
  123. package/build/components/site-editor-routes/patterns-edit.js +31 -0
  124. package/build/components/site-editor-routes/patterns-edit.js.map +1 -0
  125. package/build/components/site-editor-routes/patterns-view.js +29 -0
  126. package/build/components/site-editor-routes/patterns-view.js.map +1 -0
  127. package/build/components/site-editor-routes/styles-edit.js +28 -0
  128. package/build/components/site-editor-routes/styles-edit.js.map +1 -0
  129. package/build/components/site-editor-routes/styles-view.js +27 -0
  130. package/build/components/site-editor-routes/styles-view.js.map +1 -0
  131. package/build/components/site-editor-routes/templates-edit.js +31 -0
  132. package/build/components/site-editor-routes/templates-edit.js.map +1 -0
  133. package/build/components/site-editor-routes/templates-list-view.js +34 -0
  134. package/build/components/site-editor-routes/templates-list-view.js.map +1 -0
  135. package/build/components/site-editor-routes/templates-view.js +29 -0
  136. package/build/components/site-editor-routes/templates-view.js.map +1 -0
  137. package/build/components/site-hub/index.js +3 -2
  138. package/build/components/site-hub/index.js.map +1 -1
  139. package/build/components/style-book/color-examples.js +46 -0
  140. package/build/components/style-book/color-examples.js.map +1 -0
  141. package/build/components/style-book/constants.js +75 -10
  142. package/build/components/style-book/constants.js.map +1 -1
  143. package/build/components/style-book/duotone-examples.js +55 -0
  144. package/build/components/style-book/duotone-examples.js.map +1 -0
  145. package/build/components/style-book/examples.js +46 -3
  146. package/build/components/style-book/examples.js.map +1 -1
  147. package/build/components/style-book/index.js +92 -36
  148. package/build/components/style-book/index.js.map +1 -1
  149. package/build/components/style-book/types.js.map +1 -1
  150. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +6 -1
  151. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  152. package/build/hooks/commands/use-common-commands.js +46 -30
  153. package/build/hooks/commands/use-common-commands.js.map +1 -1
  154. package/build/hooks/commands/use-edit-mode-commands.js +10 -6
  155. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  156. package/build/hooks/commands/use-set-command-context.js +12 -15
  157. package/build/hooks/commands/use-set-command-context.js.map +1 -1
  158. package/build/store/private-actions.js +8 -60
  159. package/build/store/private-actions.js.map +1 -1
  160. package/build/store/private-selectors.js +4 -12
  161. package/build/store/private-selectors.js.map +1 -1
  162. package/build/store/reducer.js +9 -18
  163. package/build/store/reducer.js.map +1 -1
  164. package/build-module/components/add-new-post/index.js +1 -1
  165. package/build-module/components/add-new-post/index.js.map +1 -1
  166. package/build-module/components/add-new-template/index.js +1 -1
  167. package/build-module/components/add-new-template/index.js.map +1 -1
  168. package/build-module/components/add-new-template/utils.js +9 -9
  169. package/build-module/components/add-new-template/utils.js.map +1 -1
  170. package/build-module/components/app/index.js +4 -2
  171. package/build-module/components/app/index.js.map +1 -1
  172. package/build-module/components/block-editor/use-editor-iframe-props.js +30 -21
  173. package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -1
  174. package/build-module/components/block-editor/use-site-editor-settings.js +10 -8
  175. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  176. package/build-module/components/editor/index.js +23 -10
  177. package/build-module/components/editor/index.js.map +1 -1
  178. package/build-module/components/editor/use-adapt-editor-to-canvas.js +42 -0
  179. package/build-module/components/editor/use-adapt-editor-to-canvas.js.map +1 -0
  180. package/build-module/components/editor/use-editor-title.js +3 -3
  181. package/build-module/components/editor/use-editor-title.js.map +1 -1
  182. package/build-module/components/global-styles/font-sizes/font-size.js +6 -6
  183. package/build-module/components/global-styles/font-sizes/font-size.js.map +1 -1
  184. package/build-module/components/global-styles/font-sizes/font-sizes-count.js +0 -1
  185. package/build-module/components/global-styles/font-sizes/font-sizes-count.js.map +1 -1
  186. package/build-module/components/global-styles/font-sizes/font-sizes.js +4 -4
  187. package/build-module/components/global-styles/font-sizes/font-sizes.js.map +1 -1
  188. package/build-module/components/global-styles/palette.js +17 -14
  189. package/build-module/components/global-styles/palette.js.map +1 -1
  190. package/build-module/components/global-styles/root-menu.js +0 -4
  191. package/build-module/components/global-styles/root-menu.js.map +1 -1
  192. package/build-module/components/global-styles/screen-block-list.js +0 -4
  193. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  194. package/build-module/components/global-styles/screen-css.js +1 -1
  195. package/build-module/components/global-styles/screen-css.js.map +1 -1
  196. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  197. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  198. package/build-module/components/global-styles/screen-root.js +0 -3
  199. package/build-module/components/global-styles/screen-root.js.map +1 -1
  200. package/build-module/components/global-styles/screen-style-variations.js +5 -1
  201. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  202. package/build-module/components/global-styles/shadows-edit-panel.js +9 -10
  203. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  204. package/build-module/components/global-styles/shadows-panel.js +0 -3
  205. package/build-module/components/global-styles/shadows-panel.js.map +1 -1
  206. package/build-module/components/global-styles/typography-elements.js +2 -5
  207. package/build-module/components/global-styles/typography-elements.js.map +1 -1
  208. package/build-module/components/global-styles/ui.js +7 -0
  209. package/build-module/components/global-styles/ui.js.map +1 -1
  210. package/build-module/components/global-styles/variations/variation.js +3 -3
  211. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  212. package/build-module/components/global-styles/variations/variations-panel.js +0 -1
  213. package/build-module/components/global-styles/variations/variations-panel.js.map +1 -1
  214. package/build-module/components/global-styles-sidebar/default-sidebar.js +0 -1
  215. package/build-module/components/global-styles-sidebar/default-sidebar.js.map +1 -1
  216. package/build-module/components/global-styles-sidebar/index.js +44 -31
  217. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  218. package/build-module/components/layout/animation.js +1 -3
  219. package/build-module/components/layout/animation.js.map +1 -1
  220. package/build-module/components/layout/index.js +22 -35
  221. package/build-module/components/layout/index.js.map +1 -1
  222. package/build-module/components/layout/router.js +17 -139
  223. package/build-module/components/layout/router.js.map +1 -1
  224. package/build-module/components/page-patterns/delete-category-menu-item.js +4 -4
  225. package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
  226. package/build-module/components/page-patterns/use-pattern-settings.js +1 -1
  227. package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -1
  228. package/build-module/components/page-templates/index.js +1 -2
  229. package/build-module/components/page-templates/index.js.map +1 -1
  230. package/build-module/components/pagination/index.js +1 -1
  231. package/build-module/components/pagination/index.js.map +1 -1
  232. package/build-module/components/post-edit/index.js +8 -4
  233. package/build-module/components/post-edit/index.js.map +1 -1
  234. package/build-module/components/post-fields/index.js +7 -51
  235. package/build-module/components/post-fields/index.js.map +1 -1
  236. package/build-module/components/post-list/index.js +1 -1
  237. package/build-module/components/post-list/index.js.map +1 -1
  238. package/build-module/components/posts-app/index.js +2 -2
  239. package/build-module/components/posts-app/index.js.map +1 -1
  240. package/build-module/components/posts-app/router.js +3 -3
  241. package/build-module/components/posts-app/router.js.map +1 -1
  242. package/build-module/components/resizable-frame/index.js +21 -10
  243. package/build-module/components/resizable-frame/index.js.map +1 -1
  244. package/build-module/components/revisions/index.js +1 -1
  245. package/build-module/components/revisions/index.js.map +1 -1
  246. package/build-module/components/save-keyboard-shortcut/index.js +71 -0
  247. package/build-module/components/save-keyboard-shortcut/index.js.map +1 -0
  248. package/build-module/components/save-panel/index.js +17 -6
  249. package/build-module/components/save-panel/index.js.map +1 -1
  250. package/build-module/components/sidebar-dataviews/default-views.js +2 -5
  251. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  252. package/build-module/components/sidebar-navigation-screen/index.js +2 -1
  253. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  254. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +30 -10
  255. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  256. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -2
  257. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  258. package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +4 -4
  259. package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -1
  260. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +8 -13
  261. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  262. package/build-module/components/site-editor-routes/home-edit.js +18 -0
  263. package/build-module/components/site-editor-routes/home-edit.js.map +1 -0
  264. package/build-module/components/site-editor-routes/home-view.js +17 -0
  265. package/build-module/components/site-editor-routes/home-view.js.map +1 -0
  266. package/build-module/components/site-editor-routes/index.js +42 -0
  267. package/build-module/components/site-editor-routes/index.js.map +1 -0
  268. package/build-module/components/site-editor-routes/navigation-edit.js +21 -0
  269. package/build-module/components/site-editor-routes/navigation-edit.js.map +1 -0
  270. package/build-module/components/site-editor-routes/navigation-item-edit.js +23 -0
  271. package/build-module/components/site-editor-routes/navigation-item-edit.js.map +1 -0
  272. package/build-module/components/site-editor-routes/navigation-item-view.js +22 -0
  273. package/build-module/components/site-editor-routes/navigation-item-view.js.map +1 -0
  274. package/build-module/components/site-editor-routes/navigation-view.js +20 -0
  275. package/build-module/components/site-editor-routes/navigation-view.js.map +1 -0
  276. package/build-module/components/site-editor-routes/pages-edit.js +35 -0
  277. package/build-module/components/site-editor-routes/pages-edit.js.map +1 -0
  278. package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js +56 -0
  279. package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js.map +1 -0
  280. package/build-module/components/site-editor-routes/pages-list-view.js +39 -0
  281. package/build-module/components/site-editor-routes/pages-list-view.js.map +1 -0
  282. package/build-module/components/site-editor-routes/pages-view-quick-edit.js +53 -0
  283. package/build-module/components/site-editor-routes/pages-view-quick-edit.js.map +1 -0
  284. package/build-module/components/site-editor-routes/pages-view.js +34 -0
  285. package/build-module/components/site-editor-routes/pages-view.js.map +1 -0
  286. package/build-module/components/site-editor-routes/patterns-edit.js +23 -0
  287. package/build-module/components/site-editor-routes/patterns-edit.js.map +1 -0
  288. package/build-module/components/site-editor-routes/patterns-view.js +21 -0
  289. package/build-module/components/site-editor-routes/patterns-view.js.map +1 -0
  290. package/build-module/components/site-editor-routes/styles-edit.js +20 -0
  291. package/build-module/components/site-editor-routes/styles-edit.js.map +1 -0
  292. package/build-module/components/site-editor-routes/styles-view.js +19 -0
  293. package/build-module/components/site-editor-routes/styles-view.js.map +1 -0
  294. package/build-module/components/site-editor-routes/templates-edit.js +23 -0
  295. package/build-module/components/site-editor-routes/templates-edit.js.map +1 -0
  296. package/build-module/components/site-editor-routes/templates-list-view.js +26 -0
  297. package/build-module/components/site-editor-routes/templates-list-view.js.map +1 -0
  298. package/build-module/components/site-editor-routes/templates-view.js +21 -0
  299. package/build-module/components/site-editor-routes/templates-view.js.map +1 -0
  300. package/build-module/components/site-hub/index.js +3 -2
  301. package/build-module/components/site-hub/index.js.map +1 -1
  302. package/build-module/components/style-book/color-examples.js +38 -0
  303. package/build-module/components/style-book/color-examples.js.map +1 -0
  304. package/build-module/components/style-book/constants.js +74 -9
  305. package/build-module/components/style-book/constants.js.map +1 -1
  306. package/build-module/components/style-book/duotone-examples.js +48 -0
  307. package/build-module/components/style-book/duotone-examples.js.map +1 -0
  308. package/build-module/components/style-book/examples.js +47 -3
  309. package/build-module/components/style-book/examples.js.map +1 -1
  310. package/build-module/components/style-book/index.js +94 -38
  311. package/build-module/components/style-book/index.js.map +1 -1
  312. package/build-module/components/style-book/types.js.map +1 -1
  313. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +6 -1
  314. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  315. package/build-module/hooks/commands/use-common-commands.js +46 -30
  316. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  317. package/build-module/hooks/commands/use-edit-mode-commands.js +10 -6
  318. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  319. package/build-module/hooks/commands/use-set-command-context.js +12 -15
  320. package/build-module/hooks/commands/use-set-command-context.js.map +1 -1
  321. package/build-module/store/private-actions.js +6 -58
  322. package/build-module/store/private-actions.js.map +1 -1
  323. package/build-module/store/private-selectors.js +3 -11
  324. package/build-module/store/private-selectors.js.map +1 -1
  325. package/build-module/store/reducer.js +9 -18
  326. package/build-module/store/reducer.js.map +1 -1
  327. package/build-style/posts-rtl.css +10 -13
  328. package/build-style/posts.css +10 -13
  329. package/build-style/style-rtl.css +127 -26
  330. package/build-style/style.css +127 -26
  331. package/package.json +43 -41
  332. package/src/components/add-new-post/index.js +1 -1
  333. package/src/components/add-new-template/index.js +1 -1
  334. package/src/components/add-new-template/utils.js +12 -9
  335. package/src/components/app/index.js +4 -2
  336. package/src/components/block-editor/use-editor-iframe-props.js +22 -18
  337. package/src/components/block-editor/use-site-editor-settings.js +12 -10
  338. package/src/components/editor/index.js +34 -13
  339. package/src/components/editor/use-adapt-editor-to-canvas.js +53 -0
  340. package/src/components/editor/use-editor-title.js +3 -3
  341. package/src/components/global-styles/font-sizes/font-size.js +11 -15
  342. package/src/components/global-styles/font-sizes/font-sizes-count.js +1 -4
  343. package/src/components/global-styles/font-sizes/font-sizes.js +7 -9
  344. package/src/components/global-styles/palette.js +21 -18
  345. package/src/components/global-styles/root-menu.js +3 -16
  346. package/src/components/global-styles/screen-block-list.js +0 -7
  347. package/src/components/global-styles/screen-css.js +1 -0
  348. package/src/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
  349. package/src/components/global-styles/screen-root.js +3 -12
  350. package/src/components/global-styles/screen-style-variations.js +4 -1
  351. package/src/components/global-styles/shadows-edit-panel.js +12 -13
  352. package/src/components/global-styles/shadows-panel.js +0 -4
  353. package/src/components/global-styles/typography-elements.js +3 -11
  354. package/src/components/global-styles/ui.js +11 -0
  355. package/src/components/global-styles/variations/variation.js +3 -3
  356. package/src/components/global-styles/variations/variations-panel.js +0 -1
  357. package/src/components/global-styles-sidebar/default-sidebar.js +0 -1
  358. package/src/components/global-styles-sidebar/index.js +86 -65
  359. package/src/components/global-styles-sidebar/style.scss +6 -0
  360. package/src/components/layout/animation.js +0 -1
  361. package/src/components/layout/index.js +16 -34
  362. package/src/components/layout/router.js +18 -133
  363. package/src/components/layout/style.scss +2 -2
  364. package/src/components/page-patterns/delete-category-menu-item.js +4 -4
  365. package/src/components/page-patterns/use-pattern-settings.js +1 -1
  366. package/src/components/page-templates/index.js +0 -1
  367. package/src/components/pagination/index.js +1 -1
  368. package/src/components/post-edit/index.js +35 -4
  369. package/src/components/post-fields/index.js +7 -54
  370. package/src/components/post-fields/style.scss +3 -0
  371. package/src/components/post-list/index.js +1 -1
  372. package/src/components/post-list/style.scss +1 -1
  373. package/src/components/posts-app/index.js +2 -2
  374. package/src/components/posts-app/router.js +3 -3
  375. package/src/components/resizable-frame/index.js +19 -10
  376. package/src/components/revisions/index.js +4 -1
  377. package/src/components/save-keyboard-shortcut/index.js +69 -0
  378. package/src/components/save-panel/index.js +30 -32
  379. package/src/components/sidebar-dataviews/default-views.js +2 -5
  380. package/src/components/sidebar-navigation-screen/index.js +2 -1
  381. package/src/components/sidebar-navigation-screen-global-styles/index.js +47 -29
  382. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -2
  383. package/src/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +4 -4
  384. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +11 -13
  385. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +1 -1
  386. package/src/components/site-editor-routes/README.md +20 -0
  387. package/src/components/site-editor-routes/home-edit.js +17 -0
  388. package/src/components/site-editor-routes/home-view.js +16 -0
  389. package/src/components/site-editor-routes/index.js +60 -0
  390. package/src/components/site-editor-routes/navigation-edit.js +22 -0
  391. package/src/components/site-editor-routes/navigation-item-edit.js +26 -0
  392. package/src/components/site-editor-routes/navigation-item-view.js +25 -0
  393. package/src/components/site-editor-routes/navigation-view.js +21 -0
  394. package/src/components/site-editor-routes/pages-edit.js +35 -0
  395. package/src/components/site-editor-routes/pages-list-view-quick-edit.js +56 -0
  396. package/src/components/site-editor-routes/pages-list-view.js +44 -0
  397. package/src/components/site-editor-routes/pages-view-quick-edit.js +53 -0
  398. package/src/components/site-editor-routes/pages-view.js +39 -0
  399. package/src/components/site-editor-routes/patterns-edit.js +24 -0
  400. package/src/components/site-editor-routes/patterns-view.js +22 -0
  401. package/src/components/site-editor-routes/styles-edit.js +17 -0
  402. package/src/components/site-editor-routes/styles-view.js +16 -0
  403. package/src/components/site-editor-routes/templates-edit.js +22 -0
  404. package/src/components/site-editor-routes/templates-list-view.js +28 -0
  405. package/src/components/site-editor-routes/templates-view.js +22 -0
  406. package/src/components/site-hub/index.js +2 -2
  407. package/src/components/site-hub/style.scss +4 -0
  408. package/src/components/style-book/color-examples.tsx +44 -0
  409. package/src/components/style-book/constants.ts +83 -10
  410. package/src/components/style-book/duotone-examples.tsx +53 -0
  411. package/src/components/style-book/examples.tsx +113 -0
  412. package/src/components/style-book/index.js +149 -52
  413. package/src/components/style-book/style.scss +12 -14
  414. package/src/components/style-book/test/categories.js +0 -5
  415. package/src/components/style-book/types.ts +34 -1
  416. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +11 -1
  417. package/src/hooks/commands/use-common-commands.js +60 -40
  418. package/src/hooks/commands/use-edit-mode-commands.js +14 -18
  419. package/src/hooks/commands/use-set-command-context.js +7 -9
  420. package/src/store/private-actions.js +7 -79
  421. package/src/store/private-selectors.js +4 -11
  422. package/src/store/reducer.js +10 -18
  423. package/src/style.scss +3 -0
  424. package/build/components/keyboard-shortcuts/global.js +0 -53
  425. package/build/components/keyboard-shortcuts/global.js.map +0 -1
  426. package/build/components/keyboard-shortcuts/register.js +0 -34
  427. package/build/components/keyboard-shortcuts/register.js.map +0 -1
  428. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +0 -69
  429. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +0 -1
  430. package/build-module/components/keyboard-shortcuts/global.js +0 -46
  431. package/build-module/components/keyboard-shortcuts/global.js.map +0 -1
  432. package/build-module/components/keyboard-shortcuts/register.js +0 -27
  433. package/build-module/components/keyboard-shortcuts/register.js.map +0 -1
  434. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +0 -62
  435. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +0 -1
  436. package/src/components/keyboard-shortcuts/global.js +0 -47
  437. package/src/components/keyboard-shortcuts/register.js +0 -27
  438. package/src/components/style-book/examples.ts +0 -63
  439. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +0 -73
@@ -7,6 +7,43 @@ import { __ } from '@wordpress/i18n';
7
7
  * Internal dependencies
8
8
  */
9
9
 
10
+ export const STYLE_BOOK_COLOR_GROUPS = [{
11
+ slug: 'theme-colors',
12
+ title: __('Theme Colors'),
13
+ origin: 'theme',
14
+ type: 'colors'
15
+ }, {
16
+ slug: 'theme-gradients',
17
+ title: __('Theme Gradients'),
18
+ origin: 'theme',
19
+ type: 'gradients'
20
+ }, {
21
+ slug: 'custom-colors',
22
+ title: __('Custom Colors'),
23
+ origin: 'custom',
24
+ type: 'colors'
25
+ }, {
26
+ slug: 'custom-gradients',
27
+ title: __('Custom Gradients'),
28
+ origin: 'custom',
29
+ // User.
30
+ type: 'gradients'
31
+ }, {
32
+ slug: 'duotones',
33
+ title: __('Duotones'),
34
+ origin: 'theme',
35
+ type: 'duotones'
36
+ }, {
37
+ slug: 'default-colors',
38
+ title: __('Default Colors'),
39
+ origin: 'default',
40
+ type: 'colors'
41
+ }, {
42
+ slug: 'default-gradients',
43
+ title: __('Default Gradients'),
44
+ origin: 'default',
45
+ type: 'gradients'
46
+ }];
10
47
  export const STYLE_BOOK_THEME_SUBCATEGORIES = [{
11
48
  slug: 'site-identity',
12
49
  title: __('Site Identity'),
@@ -32,7 +69,7 @@ export const STYLE_BOOK_CATEGORIES = [{
32
69
  }, {
33
70
  slug: 'colors',
34
71
  title: __('Colors'),
35
- blocks: ['custom/colors']
72
+ blocks: []
36
73
  }, {
37
74
  slug: 'theme',
38
75
  title: __('Theme'),
@@ -51,6 +88,13 @@ export const STYLE_BOOK_CATEGORIES = [{
51
88
  include: []
52
89
  }];
53
90
 
91
+ // Forming a "block formatting context" to prevent margin collapsing.
92
+ // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
93
+ const ROOT_CONTAINER = `
94
+ .is-root-container {
95
+ display: flow-root;
96
+ }
97
+ `;
54
98
  // The content area of the Style Book is rendered within an iframe so that global styles
55
99
  // are applied to elements within the entire content area. To support elements that are
56
100
  // not part of the block previews, such as headings and layout for the block previews,
@@ -59,17 +103,13 @@ export const STYLE_BOOK_CATEGORIES = [{
59
103
  // applied to the `button` element, targeted via `.edit-site-style-book__example`.
60
104
  // This is to ensure that browser default styles for buttons are not applied to the previews.
61
105
  export const STYLE_BOOK_IFRAME_STYLES = `
62
- // Forming a "block formatting context" to prevent margin collapsing.
63
- // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
64
- .is-root-container {
65
- display: flow-root;
66
- }
67
-
68
106
  body {
69
107
  position: relative;
70
108
  padding: 32px !important;
71
109
  }
72
110
 
111
+ ${ROOT_CONTAINER}
112
+
73
113
  .edit-site-style-book__examples {
74
114
  max-width: 1200px;
75
115
  margin: 0 auto;
@@ -94,15 +134,40 @@ export const STYLE_BOOK_IFRAME_STYLES = `
94
134
  box-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
95
135
  }
96
136
 
137
+ .edit-site-style-book__example.is-disabled-example {
138
+ pointer-events: none;
139
+ }
140
+
97
141
  .edit-site-style-book__example:focus:not(:disabled) {
98
142
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
99
143
  outline: 3px solid transparent;
100
144
  }
101
145
 
146
+ .edit-site-style-book__duotone-example > div:first-child {
147
+ display: flex;
148
+ aspect-ratio: 16 / 9;
149
+ grid-row: span 1;
150
+ grid-column: span 2;
151
+ }
152
+ .edit-site-style-book__duotone-example img {
153
+ width: 100%;
154
+ height: 100%;
155
+ object-fit: cover;
156
+ }
157
+ .edit-site-style-book__duotone-example > div:not(:first-child) {
158
+ height: 20px;
159
+ border: 1px solid #ddd;
160
+ }
161
+
162
+ .edit-site-style-book__color-example {
163
+ height: 52px;
164
+ border: 1px solid #ddd;
165
+ }
166
+
102
167
  .edit-site-style-book__examples.is-wide .edit-site-style-book__example {
103
168
  flex-direction: row;
104
169
  }
105
-
170
+
106
171
  .edit-site-style-book__subcategory-title,
107
172
  .edit-site-style-book__example-title {
108
173
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
@@ -113,7 +178,7 @@ export const STYLE_BOOK_IFRAME_STYLES = `
113
178
  text-align: left;
114
179
  text-transform: uppercase;
115
180
  }
116
-
181
+
117
182
  .edit-site-style-book__subcategory-title {
118
183
  font-size: 16px;
119
184
  margin-bottom: 40px;
@@ -1 +1 @@
1
- {"version":3,"names":["__","STYLE_BOOK_THEME_SUBCATEGORIES","slug","title","blocks","exclude","STYLE_BOOK_CATEGORIES","subcategories","include","STYLE_BOOK_IFRAME_STYLES"],"sources":["@wordpress/edit-site/src/components/style-book/constants.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { StyleBookCategory } from './types';\n\nexport const STYLE_BOOK_THEME_SUBCATEGORIES: Omit<\n\tStyleBookCategory,\n\t'subcategories'\n>[] = [\n\t{\n\t\tslug: 'site-identity',\n\t\ttitle: __( 'Site Identity' ),\n\t\tblocks: [ 'core/site-logo', 'core/site-title', 'core/site-tagline' ],\n\t},\n\t{\n\t\tslug: 'design',\n\t\ttitle: __( 'Design' ),\n\t\tblocks: [ 'core/navigation', 'core/avatar', 'core/post-time-to-read' ],\n\t\texclude: [ 'core/home-link', 'core/navigation-link' ],\n\t},\n\t{\n\t\tslug: 'posts',\n\t\ttitle: __( 'Posts' ),\n\t\tblocks: [\n\t\t\t'core/post-title',\n\t\t\t'core/post-excerpt',\n\t\t\t'core/post-author',\n\t\t\t'core/post-author-name',\n\t\t\t'core/post-author-biography',\n\t\t\t'core/post-date',\n\t\t\t'core/post-terms',\n\t\t\t'core/term-description',\n\t\t\t'core/query-title',\n\t\t\t'core/query-no-results',\n\t\t\t'core/query-pagination',\n\t\t\t'core/query-numbers',\n\t\t],\n\t},\n\t{\n\t\tslug: 'comments',\n\t\ttitle: __( 'Comments' ),\n\t\tblocks: [\n\t\t\t'core/comments-title',\n\t\t\t'core/comments-pagination',\n\t\t\t'core/comments-pagination-numbers',\n\t\t\t'core/comments',\n\t\t\t'core/comments-author-name',\n\t\t\t'core/comment-content',\n\t\t\t'core/comment-date',\n\t\t\t'core/comment-edit-link',\n\t\t\t'core/comment-reply-link',\n\t\t\t'core/comment-template',\n\t\t\t'core/post-comments-count',\n\t\t\t'core/post-comments-link',\n\t\t],\n\t},\n];\n\nexport const STYLE_BOOK_CATEGORIES: StyleBookCategory[] = [\n\t{\n\t\tslug: 'text',\n\t\ttitle: __( 'Text' ),\n\t\tblocks: [\n\t\t\t'core/post-content',\n\t\t\t'core/home-link',\n\t\t\t'core/navigation-link',\n\t\t],\n\t},\n\t{\n\t\tslug: 'colors',\n\t\ttitle: __( 'Colors' ),\n\t\tblocks: [ 'custom/colors' ],\n\t},\n\t{\n\t\tslug: 'theme',\n\t\ttitle: __( 'Theme' ),\n\t\tsubcategories: STYLE_BOOK_THEME_SUBCATEGORIES,\n\t},\n\t{\n\t\tslug: 'media',\n\t\ttitle: __( 'Media' ),\n\t\tblocks: [ 'core/post-featured-image' ],\n\t},\n\t{\n\t\tslug: 'widgets',\n\t\ttitle: __( 'Widgets' ),\n\t\tblocks: [],\n\t},\n\t{\n\t\tslug: 'embed',\n\t\ttitle: __( 'Embeds' ),\n\t\tinclude: [],\n\t},\n];\n\n// The content area of the Style Book is rendered within an iframe so that global styles\n// are applied to elements within the entire content area. To support elements that are\n// not part of the block previews, such as headings and layout for the block previews,\n// additional CSS rules need to be passed into the iframe. These are hard-coded below.\n// Note that button styles are unset, and then focus rules from the `Button` component are\n// applied to the `button` element, targeted via `.edit-site-style-book__example`.\n// This is to ensure that browser default styles for buttons are not applied to the previews.\nexport const STYLE_BOOK_IFRAME_STYLES = `\n\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t.is-root-container {\n\t\tdisplay: flow-root;\n\t}\n\t\n\tbody {\n\t\tposition: relative;\n\t\tpadding: 32px !important;\n\t}\n\n\t.edit-site-style-book__examples {\n\t\tmax-width: 1200px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.edit-site-style-book__example {\n\t max-width: 900px;\n\t\tborder-radius: 2px;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 40px;\n\t\tpadding: 16px;\n\t\twidth: 100%;\n\t\tbox-sizing: border-box;\n\t\tscroll-margin-top: 32px;\n\t\tscroll-margin-bottom: 32px;\n\t\tmargin: 0 auto 40px auto;\n\t}\n\n\t.edit-site-style-book__example.is-selected {\n\t\tbox-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t}\n\n\t.edit-site-style-book__example:focus:not(:disabled) {\n\t\tbox-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t\toutline: 3px solid transparent;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example {\n\t\tflex-direction: row;\n\t}\n\t\n\t.edit-site-style-book__subcategory-title,\n\t.edit-site-style-book__example-title {\n\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\tfont-size: 11px;\n\t\tfont-weight: 500;\n\t\tline-height: normal;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\ttext-transform: uppercase;\n\t}\n\t\n\t.edit-site-style-book__subcategory-title {\n\t\tfont-size: 16px;\n\t\tmargin-bottom: 40px;\n \tborder-bottom: 1px solid #ddd;\n \tpadding-bottom: 8px;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example-title {\n\t\ttext-align: right;\n\t\twidth: 120px;\n\t}\n\n\t.edit-site-style-book__example-preview {\n\t\twidth: 100%;\n\t}\n\n\t.edit-site-style-book__example-preview .block-editor-block-list__insertion-point,\n\t.edit-site-style-book__example-preview .block-list-appender {\n\t\tdisplay: none;\n\t}\n\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:first-child {\n\t\tmargin-top: 0;\n\t}\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:last-child {\n\t\tmargin-bottom: 0;\n\t}\n`;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;;AAGA,OAAO,MAAMC,8BAGV,GAAG,CACL;EACCC,IAAI,EAAE,eAAe;EACrBC,KAAK,EAAEH,EAAE,CAAE,eAAgB,CAAC;EAC5BI,MAAM,EAAE,CAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB;AACnE,CAAC,EACD;EACCF,IAAI,EAAE,QAAQ;EACdC,KAAK,EAAEH,EAAE,CAAE,QAAS,CAAC;EACrBI,MAAM,EAAE,CAAE,iBAAiB,EAAE,aAAa,EAAE,wBAAwB,CAAE;EACtEC,OAAO,EAAE,CAAE,gBAAgB,EAAE,sBAAsB;AACpD,CAAC,EACD;EACCH,IAAI,EAAE,OAAO;EACbC,KAAK,EAAEH,EAAE,CAAE,OAAQ,CAAC;EACpBI,MAAM,EAAE,CACP,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,4BAA4B,EAC5B,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB;AAEtB,CAAC,EACD;EACCF,IAAI,EAAE,UAAU;EAChBC,KAAK,EAAEH,EAAE,CAAE,UAAW,CAAC;EACvBI,MAAM,EAAE,CACP,qBAAqB,EACrB,0BAA0B,EAC1B,kCAAkC,EAClC,eAAe,EACf,2BAA2B,EAC3B,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,0BAA0B,EAC1B,yBAAyB;AAE3B,CAAC,CACD;AAED,OAAO,MAAME,qBAA0C,GAAG,CACzD;EACCJ,IAAI,EAAE,MAAM;EACZC,KAAK,EAAEH,EAAE,CAAE,MAAO,CAAC;EACnBI,MAAM,EAAE,CACP,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB;AAExB,CAAC,EACD;EACCF,IAAI,EAAE,QAAQ;EACdC,KAAK,EAAEH,EAAE,CAAE,QAAS,CAAC;EACrBI,MAAM,EAAE,CAAE,eAAe;AAC1B,CAAC,EACD;EACCF,IAAI,EAAE,OAAO;EACbC,KAAK,EAAEH,EAAE,CAAE,OAAQ,CAAC;EACpBO,aAAa,EAAEN;AAChB,CAAC,EACD;EACCC,IAAI,EAAE,OAAO;EACbC,KAAK,EAAEH,EAAE,CAAE,OAAQ,CAAC;EACpBI,MAAM,EAAE,CAAE,0BAA0B;AACrC,CAAC,EACD;EACCF,IAAI,EAAE,SAAS;EACfC,KAAK,EAAEH,EAAE,CAAE,SAAU,CAAC;EACtBI,MAAM,EAAE;AACT,CAAC,EACD;EACCF,IAAI,EAAE,OAAO;EACbC,KAAK,EAAEH,EAAE,CAAE,QAAS,CAAC;EACrBQ,OAAO,EAAE;AACV,CAAC,CACD;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,wBAAwB,GAAG;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__","STYLE_BOOK_COLOR_GROUPS","slug","title","origin","type","STYLE_BOOK_THEME_SUBCATEGORIES","blocks","exclude","STYLE_BOOK_CATEGORIES","subcategories","include","ROOT_CONTAINER","STYLE_BOOK_IFRAME_STYLES"],"sources":["@wordpress/edit-site/src/components/style-book/constants.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { StyleBookCategory, StyleBookColorGroup } from './types';\n\nexport const STYLE_BOOK_COLOR_GROUPS: StyleBookColorGroup[] = [\n\t{\n\t\tslug: 'theme-colors',\n\t\ttitle: __( 'Theme Colors' ),\n\t\torigin: 'theme',\n\t\ttype: 'colors',\n\t},\n\t{\n\t\tslug: 'theme-gradients',\n\t\ttitle: __( 'Theme Gradients' ),\n\t\torigin: 'theme',\n\t\ttype: 'gradients',\n\t},\n\t{\n\t\tslug: 'custom-colors',\n\t\ttitle: __( 'Custom Colors' ),\n\t\torigin: 'custom',\n\t\ttype: 'colors',\n\t},\n\t{\n\t\tslug: 'custom-gradients',\n\t\ttitle: __( 'Custom Gradients' ),\n\t\torigin: 'custom', // User.\n\t\ttype: 'gradients',\n\t},\n\t{\n\t\tslug: 'duotones',\n\t\ttitle: __( 'Duotones' ),\n\t\torigin: 'theme',\n\t\ttype: 'duotones',\n\t},\n\t{\n\t\tslug: 'default-colors',\n\t\ttitle: __( 'Default Colors' ),\n\t\torigin: 'default',\n\t\ttype: 'colors',\n\t},\n\t{\n\t\tslug: 'default-gradients',\n\t\ttitle: __( 'Default Gradients' ),\n\t\torigin: 'default',\n\t\ttype: 'gradients',\n\t},\n];\n\nexport const STYLE_BOOK_THEME_SUBCATEGORIES: Omit<\n\tStyleBookCategory,\n\t'subcategories'\n>[] = [\n\t{\n\t\tslug: 'site-identity',\n\t\ttitle: __( 'Site Identity' ),\n\t\tblocks: [ 'core/site-logo', 'core/site-title', 'core/site-tagline' ],\n\t},\n\t{\n\t\tslug: 'design',\n\t\ttitle: __( 'Design' ),\n\t\tblocks: [ 'core/navigation', 'core/avatar', 'core/post-time-to-read' ],\n\t\texclude: [ 'core/home-link', 'core/navigation-link' ],\n\t},\n\t{\n\t\tslug: 'posts',\n\t\ttitle: __( 'Posts' ),\n\t\tblocks: [\n\t\t\t'core/post-title',\n\t\t\t'core/post-excerpt',\n\t\t\t'core/post-author',\n\t\t\t'core/post-author-name',\n\t\t\t'core/post-author-biography',\n\t\t\t'core/post-date',\n\t\t\t'core/post-terms',\n\t\t\t'core/term-description',\n\t\t\t'core/query-title',\n\t\t\t'core/query-no-results',\n\t\t\t'core/query-pagination',\n\t\t\t'core/query-numbers',\n\t\t],\n\t},\n\t{\n\t\tslug: 'comments',\n\t\ttitle: __( 'Comments' ),\n\t\tblocks: [\n\t\t\t'core/comments-title',\n\t\t\t'core/comments-pagination',\n\t\t\t'core/comments-pagination-numbers',\n\t\t\t'core/comments',\n\t\t\t'core/comments-author-name',\n\t\t\t'core/comment-content',\n\t\t\t'core/comment-date',\n\t\t\t'core/comment-edit-link',\n\t\t\t'core/comment-reply-link',\n\t\t\t'core/comment-template',\n\t\t\t'core/post-comments-count',\n\t\t\t'core/post-comments-link',\n\t\t],\n\t},\n];\n\nexport const STYLE_BOOK_CATEGORIES: StyleBookCategory[] = [\n\t{\n\t\tslug: 'text',\n\t\ttitle: __( 'Text' ),\n\t\tblocks: [\n\t\t\t'core/post-content',\n\t\t\t'core/home-link',\n\t\t\t'core/navigation-link',\n\t\t],\n\t},\n\t{\n\t\tslug: 'colors',\n\t\ttitle: __( 'Colors' ),\n\t\tblocks: [],\n\t},\n\t{\n\t\tslug: 'theme',\n\t\ttitle: __( 'Theme' ),\n\t\tsubcategories: STYLE_BOOK_THEME_SUBCATEGORIES,\n\t},\n\t{\n\t\tslug: 'media',\n\t\ttitle: __( 'Media' ),\n\t\tblocks: [ 'core/post-featured-image' ],\n\t},\n\t{\n\t\tslug: 'widgets',\n\t\ttitle: __( 'Widgets' ),\n\t\tblocks: [],\n\t},\n\t{\n\t\tslug: 'embed',\n\t\ttitle: __( 'Embeds' ),\n\t\tinclude: [],\n\t},\n];\n\n// Forming a \"block formatting context\" to prevent margin collapsing.\n// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\nconst ROOT_CONTAINER = `\n\t.is-root-container {\n\t\tdisplay: flow-root;\n\t}\n`;\n// The content area of the Style Book is rendered within an iframe so that global styles\n// are applied to elements within the entire content area. To support elements that are\n// not part of the block previews, such as headings and layout for the block previews,\n// additional CSS rules need to be passed into the iframe. These are hard-coded below.\n// Note that button styles are unset, and then focus rules from the `Button` component are\n// applied to the `button` element, targeted via `.edit-site-style-book__example`.\n// This is to ensure that browser default styles for buttons are not applied to the previews.\nexport const STYLE_BOOK_IFRAME_STYLES = `\n\tbody {\n\t\tposition: relative;\n\t\tpadding: 32px !important;\n\t}\n\n\t${ ROOT_CONTAINER }\n\n\t.edit-site-style-book__examples {\n\t\tmax-width: 1200px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.edit-site-style-book__example {\n\t max-width: 900px;\n\t\tborder-radius: 2px;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 40px;\n\t\tpadding: 16px;\n\t\twidth: 100%;\n\t\tbox-sizing: border-box;\n\t\tscroll-margin-top: 32px;\n\t\tscroll-margin-bottom: 32px;\n\t\tmargin: 0 auto 40px auto;\n\t}\n\n\t.edit-site-style-book__example.is-selected {\n\t\tbox-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t}\n\n\t.edit-site-style-book__example.is-disabled-example {\n\t\tpointer-events: none;\n\t}\n\n\t.edit-site-style-book__example:focus:not(:disabled) {\n\t\tbox-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t\toutline: 3px solid transparent;\n\t}\n\n\t.edit-site-style-book__duotone-example > div:first-child {\n\t\tdisplay: flex;\n\t\taspect-ratio: 16 / 9;\n\t\tgrid-row: span 1;\n\t\tgrid-column: span 2;\n\t}\n\t.edit-site-style-book__duotone-example img {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tobject-fit: cover;\n\t}\n\t.edit-site-style-book__duotone-example > div:not(:first-child) {\n\t\theight: 20px;\n\t\tborder: 1px solid #ddd;\n\t}\n\n\t.edit-site-style-book__color-example {\n\t\theight: 52px;\n\t\tborder: 1px solid #ddd;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example {\n\t\tflex-direction: row;\n\t}\n\n\t.edit-site-style-book__subcategory-title,\n\t.edit-site-style-book__example-title {\n\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\tfont-size: 11px;\n\t\tfont-weight: 500;\n\t\tline-height: normal;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\ttext-transform: uppercase;\n\t}\n\n\t.edit-site-style-book__subcategory-title {\n\t\tfont-size: 16px;\n\t\tmargin-bottom: 40px;\n \tborder-bottom: 1px solid #ddd;\n \tpadding-bottom: 8px;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example-title {\n\t\ttext-align: right;\n\t\twidth: 120px;\n\t}\n\n\t.edit-site-style-book__example-preview {\n\t\twidth: 100%;\n\t}\n\n\t.edit-site-style-book__example-preview .block-editor-block-list__insertion-point,\n\t.edit-site-style-book__example-preview .block-list-appender {\n\t\tdisplay: none;\n\t}\n\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:first-child {\n\t\tmargin-top: 0;\n\t}\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:last-child {\n\t\tmargin-bottom: 0;\n\t}\n`;\n"],"mappings":"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CA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,wBAAwB,GAAG;AACxC;AACA;AACA;AACA;AACA;AACA,GAAID,cAAc;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __experimentalGrid as Grid } from '@wordpress/components';
5
+ import { View } from '@wordpress/primitives';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ const DuotoneExamples = ({
12
+ duotones
13
+ }) => {
14
+ if (!duotones) {
15
+ return null;
16
+ }
17
+ return /*#__PURE__*/_jsx(Grid, {
18
+ columns: 2,
19
+ rowGap: 16,
20
+ columnGap: 16,
21
+ children: duotones.map(duotone => {
22
+ return /*#__PURE__*/_jsxs(Grid, {
23
+ className: "edit-site-style-book__duotone-example",
24
+ columns: 2,
25
+ rowGap: 8,
26
+ columnGap: 8,
27
+ children: [/*#__PURE__*/_jsx(View, {
28
+ children: /*#__PURE__*/_jsx("img", {
29
+ alt: `Duotone example: ${duotone.slug}`,
30
+ src: "https://s.w.org/images/core/5.3/MtBlanc1.jpg",
31
+ style: {
32
+ filter: `url(#wp-duotone-${duotone.slug})`
33
+ }
34
+ })
35
+ }), duotone.colors.map(color => {
36
+ return /*#__PURE__*/_jsx(View, {
37
+ className: "edit-site-style-book__color-example",
38
+ style: {
39
+ backgroundColor: color
40
+ }
41
+ }, color);
42
+ })]
43
+ }, duotone.slug);
44
+ })
45
+ });
46
+ };
47
+ export default DuotoneExamples;
48
+ //# sourceMappingURL=duotone-examples.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__experimentalGrid","Grid","View","jsx","_jsx","jsxs","_jsxs","DuotoneExamples","duotones","columns","rowGap","columnGap","children","map","duotone","className","alt","slug","src","style","filter","colors","color","backgroundColor"],"sources":["@wordpress/edit-site/src/components/style-book/duotone-examples.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalGrid as Grid } from '@wordpress/components';\nimport { View } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport type { Duotone } from './types';\n\nconst DuotoneExamples = ( { duotones } ): JSX.Element | null => {\n\tif ( ! duotones ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Grid columns={ 2 } rowGap={ 16 } columnGap={ 16 }>\n\t\t\t{ duotones.map( ( duotone: Duotone ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Grid\n\t\t\t\t\t\tkey={ duotone.slug }\n\t\t\t\t\t\tclassName=\"edit-site-style-book__duotone-example\"\n\t\t\t\t\t\tcolumns={ 2 }\n\t\t\t\t\t\trowGap={ 8 }\n\t\t\t\t\t\tcolumnGap={ 8 }\n\t\t\t\t\t>\n\t\t\t\t\t\t<View>\n\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\talt={ `Duotone example: ${ duotone.slug }` }\n\t\t\t\t\t\t\t\tsrc=\"https://s.w.org/images/core/5.3/MtBlanc1.jpg\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tfilter: `url(#wp-duotone-${ duotone.slug })`,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t\t{ duotone.colors.map( ( color ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\t\tkey={ color }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-style-book__color-example\"\n\t\t\t\t\t\t\t\t\tstyle={ { backgroundColor: color } }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t</Grid>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Grid>\n\t);\n};\n\nexport default DuotoneExamples;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,kBAAkB,IAAIC,IAAI,QAAQ,uBAAuB;AAClE,SAASC,IAAI,QAAQ,uBAAuB;;AAE5C;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAKA,MAAMC,eAAe,GAAGA,CAAE;EAAEC;AAAS,CAAC,KAA0B;EAC/D,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,oBACCJ,IAAA,CAACH,IAAI;IAACQ,OAAO,EAAG,CAAG;IAACC,MAAM,EAAG,EAAI;IAACC,SAAS,EAAG,EAAI;IAAAC,QAAA,EAC/CJ,QAAQ,CAACK,GAAG,CAAIC,OAAgB,IAAM;MACvC,oBACCR,KAAA,CAACL,IAAI;QAEJc,SAAS,EAAC,uCAAuC;QACjDN,OAAO,EAAG,CAAG;QACbC,MAAM,EAAG,CAAG;QACZC,SAAS,EAAG,CAAG;QAAAC,QAAA,gBAEfR,IAAA,CAACF,IAAI;UAAAU,QAAA,eACJR,IAAA;YACCY,GAAG,EAAG,oBAAqBF,OAAO,CAACG,IAAI,EAAK;YAC5CC,GAAG,EAAC,8CAA8C;YAClDC,KAAK,EAAG;cACPC,MAAM,EAAE,mBAAoBN,OAAO,CAACG,IAAI;YACzC;UAAG,CACH;QAAC,CACG,CAAC,EACLH,OAAO,CAACO,MAAM,CAACR,GAAG,CAAIS,KAAK,IAAM;UAClC,oBACClB,IAAA,CAACF,IAAI;YAEJa,SAAS,EAAC,qCAAqC;YAC/CI,KAAK,EAAG;cAAEI,eAAe,EAAED;YAAM;UAAG,GAF9BA,KAGN,CAAC;QAEJ,CAAE,CAAC;MAAA,GAvBGR,OAAO,CAACG,IAwBT,CAAC;IAET,CAAE;EAAC,CACE,CAAC;AAET,CAAC;AAED,eAAeV,eAAe","ignoreList":[]}
@@ -8,19 +8,62 @@ import { getBlockType, getBlockTypes, getBlockFromExample, createBlock } from '@
8
8
  * Internal dependencies
9
9
  */
10
10
 
11
+ import ColorExamples from './color-examples';
12
+ import DuotoneExamples from './duotone-examples';
13
+ import { STYLE_BOOK_COLOR_GROUPS } from './constants';
14
+
15
+ /**
16
+ * Returns examples color examples for each origin
17
+ * e.g. Core (Default), Theme, and User.
18
+ *
19
+ * @param {MultiOriginPalettes} colors Global Styles color palettes per origin.
20
+ * @return {BlockExample[]} An array of color block examples.
21
+ */
22
+ import { jsx as _jsx } from "react/jsx-runtime";
23
+ function getColorExamples(colors) {
24
+ if (!colors) {
25
+ return [];
26
+ }
27
+ const examples = [];
28
+ STYLE_BOOK_COLOR_GROUPS.forEach(group => {
29
+ const palette = colors[group.type].find(origin => origin.slug === group.origin);
30
+ if (palette?.[group.type]) {
31
+ const example = {
32
+ name: group.slug,
33
+ title: group.title,
34
+ category: 'colors'
35
+ };
36
+ if (group.type === 'duotones') {
37
+ example.content = /*#__PURE__*/_jsx(DuotoneExamples, {
38
+ duotones: palette[group.type]
39
+ });
40
+ examples.push(example);
41
+ } else {
42
+ example.content = /*#__PURE__*/_jsx(ColorExamples, {
43
+ colors: palette[group.type],
44
+ type: group.type
45
+ });
46
+ examples.push(example);
47
+ }
48
+ }
49
+ });
50
+ return examples;
51
+ }
52
+
11
53
  /**
12
54
  * Returns a list of examples for registered block types.
13
55
  *
56
+ * @param {MultiOriginPalettes} colors Global styles colors grouped by origin e.g. Core, Theme, and User.
14
57
  * @return {BlockExample[]} An array of block examples.
15
58
  */
16
- export function getExamples() {
59
+ export function getExamples(colors) {
17
60
  const nonHeadingBlockExamples = getBlockTypes().filter(blockType => {
18
61
  const {
19
62
  name,
20
63
  example,
21
64
  supports
22
65
  } = blockType;
23
- return name !== 'core/heading' && !!example && supports.inserter !== false;
66
+ return name !== 'core/heading' && !!example && supports?.inserter !== false;
24
67
  }).map(blockType => ({
25
68
  name: blockType.name,
26
69
  title: blockType.title,
@@ -47,6 +90,7 @@ export function getExamples() {
47
90
  });
48
91
  })
49
92
  };
50
- return [headingsExample, ...nonHeadingBlockExamples];
93
+ const colorExamples = getColorExamples(colors);
94
+ return [headingsExample, ...colorExamples, ...nonHeadingBlockExamples];
51
95
  }
52
96
  //# sourceMappingURL=examples.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","getBlockType","getBlockTypes","getBlockFromExample","createBlock","getExamples","nonHeadingBlockExamples","filter","blockType","name","example","supports","inserter","map","title","category","blocks","isHeadingBlockRegistered","headingsExample","level","content"],"sources":["@wordpress/edit-site/src/components/style-book/examples.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tgetBlockType,\n\tgetBlockTypes,\n\tgetBlockFromExample,\n\tcreateBlock,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport type { BlockExample } from './types';\n\n/**\n * Returns a list of examples for registered block types.\n *\n * @return {BlockExample[]} An array of block examples.\n */\nexport function getExamples(): BlockExample[] {\n\tconst nonHeadingBlockExamples = getBlockTypes()\n\t\t.filter( ( blockType ) => {\n\t\t\tconst { name, example, supports } = blockType;\n\t\t\treturn (\n\t\t\t\tname !== 'core/heading' &&\n\t\t\t\t!! example &&\n\t\t\t\tsupports.inserter !== false\n\t\t\t);\n\t\t} )\n\t\t.map( ( blockType ) => ( {\n\t\t\tname: blockType.name,\n\t\t\ttitle: blockType.title,\n\t\t\tcategory: blockType.category,\n\t\t\tblocks: getBlockFromExample( blockType.name, blockType.example ),\n\t\t} ) );\n\tconst isHeadingBlockRegistered = !! getBlockType( 'core/heading' );\n\n\tif ( ! isHeadingBlockRegistered ) {\n\t\treturn nonHeadingBlockExamples;\n\t}\n\n\t// Use our own example for the Heading block so that we can show multiple\n\t// heading levels.\n\tconst headingsExample = {\n\t\tname: 'core/heading',\n\t\ttitle: __( 'Headings' ),\n\t\tcategory: 'text',\n\t\tblocks: [ 1, 2, 3, 4, 5, 6 ].map( ( level ) => {\n\t\t\treturn createBlock( 'core/heading', {\n\t\t\t\tcontent: sprintf(\n\t\t\t\t\t// translators: %d: heading level e.g: \"1\", \"2\", \"3\"\n\t\t\t\t\t__( 'Heading %d' ),\n\t\t\t\t\tlevel\n\t\t\t\t),\n\t\t\t\tlevel,\n\t\t\t} );\n\t\t} ),\n\t};\n\n\treturn [ headingsExample, ...nonHeadingBlockExamples ];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,YAAY,EACZC,aAAa,EACbC,mBAAmB,EACnBC,WAAW,QACL,mBAAmB;;AAE1B;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAA,EAAmB;EAC7C,MAAMC,uBAAuB,GAAGJ,aAAa,CAAC,CAAC,CAC7CK,MAAM,CAAIC,SAAS,IAAM;IACzB,MAAM;MAAEC,IAAI;MAAEC,OAAO;MAAEC;IAAS,CAAC,GAAGH,SAAS;IAC7C,OACCC,IAAI,KAAK,cAAc,IACvB,CAAC,CAAEC,OAAO,IACVC,QAAQ,CAACC,QAAQ,KAAK,KAAK;EAE7B,CAAE,CAAC,CACFC,GAAG,CAAIL,SAAS,KAAQ;IACxBC,IAAI,EAAED,SAAS,CAACC,IAAI;IACpBK,KAAK,EAAEN,SAAS,CAACM,KAAK;IACtBC,QAAQ,EAAEP,SAAS,CAACO,QAAQ;IAC5BC,MAAM,EAAEb,mBAAmB,CAAEK,SAAS,CAACC,IAAI,EAAED,SAAS,CAACE,OAAQ;EAChE,CAAC,CAAG,CAAC;EACN,MAAMO,wBAAwB,GAAG,CAAC,CAAEhB,YAAY,CAAE,cAAe,CAAC;EAElE,IAAK,CAAEgB,wBAAwB,EAAG;IACjC,OAAOX,uBAAuB;EAC/B;;EAEA;EACA;EACA,MAAMY,eAAe,GAAG;IACvBT,IAAI,EAAE,cAAc;IACpBK,KAAK,EAAEf,EAAE,CAAE,UAAW,CAAC;IACvBgB,QAAQ,EAAE,MAAM;IAChBC,MAAM,EAAE,CAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAE,CAACH,GAAG,CAAIM,KAAK,IAAM;MAC9C,OAAOf,WAAW,CAAE,cAAc,EAAE;QACnCgB,OAAO,EAAEpB,OAAO;QACf;QACAD,EAAE,CAAE,YAAa,CAAC,EAClBoB,KACD,CAAC;QACDA;MACD,CAAE,CAAC;IACJ,CAAE;EACH,CAAC;EAED,OAAO,CAAED,eAAe,EAAE,GAAGZ,uBAAuB,CAAE;AACvD","ignoreList":[]}
1
+ {"version":3,"names":["__","sprintf","getBlockType","getBlockTypes","getBlockFromExample","createBlock","ColorExamples","DuotoneExamples","STYLE_BOOK_COLOR_GROUPS","jsx","_jsx","getColorExamples","colors","examples","forEach","group","palette","type","find","origin","slug","example","name","title","category","content","duotones","push","getExamples","nonHeadingBlockExamples","filter","blockType","supports","inserter","map","blocks","isHeadingBlockRegistered","headingsExample","level","colorExamples"],"sources":["@wordpress/edit-site/src/components/style-book/examples.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tgetBlockType,\n\tgetBlockTypes,\n\tgetBlockFromExample,\n\tcreateBlock,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport type { BlockExample, ColorOrigin, MultiOriginPalettes } from './types';\nimport ColorExamples from './color-examples';\nimport DuotoneExamples from './duotone-examples';\nimport { STYLE_BOOK_COLOR_GROUPS } from './constants';\n\n/**\n * Returns examples color examples for each origin\n * e.g. Core (Default), Theme, and User.\n *\n * @param {MultiOriginPalettes} colors Global Styles color palettes per origin.\n * @return {BlockExample[]} An array of color block examples.\n */\nfunction getColorExamples( colors: MultiOriginPalettes ): BlockExample[] {\n\tif ( ! colors ) {\n\t\treturn [];\n\t}\n\n\tconst examples: BlockExample[] = [];\n\n\tSTYLE_BOOK_COLOR_GROUPS.forEach( ( group ) => {\n\t\tconst palette = colors[ group.type ].find(\n\t\t\t( origin: ColorOrigin ) => origin.slug === group.origin\n\t\t);\n\n\t\tif ( palette?.[ group.type ] ) {\n\t\t\tconst example: BlockExample = {\n\t\t\t\tname: group.slug,\n\t\t\t\ttitle: group.title,\n\t\t\t\tcategory: 'colors',\n\t\t\t};\n\t\t\tif ( group.type === 'duotones' ) {\n\t\t\t\texample.content = (\n\t\t\t\t\t<DuotoneExamples duotones={ palette[ group.type ] } />\n\t\t\t\t);\n\t\t\t\texamples.push( example );\n\t\t\t} else {\n\t\t\t\texample.content = (\n\t\t\t\t\t<ColorExamples\n\t\t\t\t\t\tcolors={ palette[ group.type ] }\n\t\t\t\t\t\ttype={ group.type }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t\texamples.push( example );\n\t\t\t}\n\t\t}\n\t} );\n\n\treturn examples;\n}\n\n/**\n * Returns a list of examples for registered block types.\n *\n * @param {MultiOriginPalettes} colors Global styles colors grouped by origin e.g. Core, Theme, and User.\n * @return {BlockExample[]} An array of block examples.\n */\nexport function getExamples( colors: MultiOriginPalettes ): BlockExample[] {\n\tconst nonHeadingBlockExamples = getBlockTypes()\n\t\t.filter( ( blockType ) => {\n\t\t\tconst { name, example, supports } = blockType;\n\t\t\treturn (\n\t\t\t\tname !== 'core/heading' &&\n\t\t\t\t!! example &&\n\t\t\t\tsupports?.inserter !== false\n\t\t\t);\n\t\t} )\n\t\t.map( ( blockType ) => ( {\n\t\t\tname: blockType.name,\n\t\t\ttitle: blockType.title,\n\t\t\tcategory: blockType.category,\n\t\t\tblocks: getBlockFromExample( blockType.name, blockType.example ),\n\t\t} ) );\n\tconst isHeadingBlockRegistered = !! getBlockType( 'core/heading' );\n\n\tif ( ! isHeadingBlockRegistered ) {\n\t\treturn nonHeadingBlockExamples;\n\t}\n\n\t// Use our own example for the Heading block so that we can show multiple\n\t// heading levels.\n\tconst headingsExample = {\n\t\tname: 'core/heading',\n\t\ttitle: __( 'Headings' ),\n\t\tcategory: 'text',\n\t\tblocks: [ 1, 2, 3, 4, 5, 6 ].map( ( level ) => {\n\t\t\treturn createBlock( 'core/heading', {\n\t\t\t\tcontent: sprintf(\n\t\t\t\t\t// translators: %d: heading level e.g: \"1\", \"2\", \"3\"\n\t\t\t\t\t__( 'Heading %d' ),\n\t\t\t\t\tlevel\n\t\t\t\t),\n\t\t\t\tlevel,\n\t\t\t} );\n\t\t} ),\n\t};\n\tconst colorExamples = getColorExamples( colors );\n\n\treturn [ headingsExample, ...colorExamples, ...nonHeadingBlockExamples ];\n}\n"],"mappings":"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","ignoreList":[]}
@@ -7,8 +7,8 @@ import clsx from 'clsx';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { Disabled, Composite, privateApis as componentsPrivateApis } from '@wordpress/components';
10
- import { __, sprintf } from '@wordpress/i18n';
11
- import { BlockList, privateApis as blockEditorPrivateApis, store as blockEditorStore, __unstableEditorStyles as EditorStyles, __unstableIframe as Iframe } from '@wordpress/block-editor';
10
+ import { __, _x, sprintf } from '@wordpress/i18n';
11
+ import { BlockList, privateApis as blockEditorPrivateApis, store as blockEditorStore, useSettings, __unstableEditorStyles as EditorStyles, __unstableIframe as Iframe, __experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients } from '@wordpress/block-editor';
12
12
  import { privateApis as editorPrivateApis } from '@wordpress/editor';
13
13
  import { useSelect } from '@wordpress/data';
14
14
  import { useResizeObserver } from '@wordpress/compose';
@@ -39,6 +39,53 @@ const {
39
39
  function isObjectEmpty(object) {
40
40
  return !object || Object.keys(object).length === 0;
41
41
  }
42
+
43
+ /**
44
+ * Retrieves colors, gradients, and duotone filters from Global Styles.
45
+ * The inclusion of default (Core) palettes is controlled by the relevant
46
+ * theme.json property e.g. defaultPalette, defaultGradients, defaultDuotone.
47
+ *
48
+ * @return {Object} Object containing properties for each type of palette.
49
+ */
50
+ function useMultiOriginPalettes() {
51
+ const {
52
+ colors,
53
+ gradients
54
+ } = useMultipleOriginColorsAndGradients();
55
+
56
+ // Add duotone filters to the palettes data.
57
+ const [shouldDisplayDefaultDuotones, customDuotones, themeDuotones, defaultDuotones] = useSettings('color.defaultDuotone', 'color.duotone.custom', 'color.duotone.theme', 'color.duotone.default');
58
+ const palettes = useMemo(() => {
59
+ const result = {
60
+ colors,
61
+ gradients,
62
+ duotones: []
63
+ };
64
+ if (themeDuotones && themeDuotones.length) {
65
+ result.duotones.push({
66
+ name: _x('Theme', 'Indicates these duotone filters come from the theme.'),
67
+ slug: 'theme',
68
+ duotones: themeDuotones
69
+ });
70
+ }
71
+ if (shouldDisplayDefaultDuotones && defaultDuotones && defaultDuotones.length) {
72
+ result.duotones.push({
73
+ name: _x('Default', 'Indicates these duotone filters come from WordPress.'),
74
+ slug: 'default',
75
+ duotones: defaultDuotones
76
+ });
77
+ }
78
+ if (customDuotones && customDuotones.length) {
79
+ result.duotones.push({
80
+ name: _x('Custom', 'Indicates these doutone filters are created by the user.'),
81
+ slug: 'custom',
82
+ duotones: customDuotones
83
+ });
84
+ }
85
+ return result;
86
+ }, [colors, gradients, customDuotones, themeDuotones, defaultDuotones, shouldDisplayDefaultDuotones]);
87
+ return palettes;
88
+ }
42
89
  function StyleBook({
43
90
  enableResizing = true,
44
91
  isSelected,
@@ -52,7 +99,8 @@ function StyleBook({
52
99
  const [resizeObserver, sizes] = useResizeObserver();
53
100
  const [textColor] = useGlobalStyle('color.text');
54
101
  const [backgroundColor] = useGlobalStyle('color.background');
55
- const [examples] = useState(getExamples);
102
+ const colors = useMultiOriginPalettes();
103
+ const examples = useMemo(() => getExamples(colors), [colors]);
56
104
  const tabs = useMemo(() => getTopLevelStyleBookCategories().filter(category => examples.some(example => example.category === category.slug)), [examples]);
57
105
  const {
58
106
  base: baseConfig
@@ -67,12 +115,12 @@ function StyleBook({
67
115
  // Copied from packages/edit-site/src/components/revisions/index.js
68
116
  // could we create a shared hook?
69
117
  const originalSettings = useSelect(select => select(blockEditorStore).getSettings(), []);
118
+ const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig);
70
119
  const settings = useMemo(() => ({
71
120
  ...originalSettings,
72
- __unstableIsPreviewMode: true
73
- }), [originalSettings]);
74
- const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig);
75
- settings.styles = !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : settings.styles;
121
+ styles: !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : originalSettings.styles,
122
+ isPreviewMode: true
123
+ }), [globalStyles, originalSettings, userConfig]);
76
124
  return /*#__PURE__*/_jsx(EditorCanvasContainer, {
77
125
  onClose: onClose,
78
126
  enableResizing: enableResizing,
@@ -86,31 +134,29 @@ function StyleBook({
86
134
  color: textColor,
87
135
  background: backgroundColor
88
136
  },
89
- children: [resizeObserver, showTabs ? /*#__PURE__*/_jsx("div", {
90
- className: "edit-site-style-book__tabs",
91
- children: /*#__PURE__*/_jsxs(Tabs, {
92
- children: [/*#__PURE__*/_jsx("div", {
93
- className: "edit-site-style-book__tablist-container",
94
- children: /*#__PURE__*/_jsx(Tabs.TabList, {
95
- children: tabs.map(tab => /*#__PURE__*/_jsx(Tabs.Tab, {
96
- tabId: tab.slug,
97
- children: tab.title
98
- }, tab.slug))
99
- })
100
- }), tabs.map(tab => /*#__PURE__*/_jsx(Tabs.TabPanel, {
101
- tabId: tab.slug,
102
- focusable: false,
103
- children: /*#__PURE__*/_jsx(StyleBookBody, {
104
- category: tab.slug,
105
- examples: examples,
106
- isSelected: isSelected,
107
- onSelect: onSelect,
108
- settings: settings,
109
- sizes: sizes,
110
- title: tab.title
111
- })
112
- }, tab.slug))]
113
- })
137
+ children: [resizeObserver, showTabs ? /*#__PURE__*/_jsxs(Tabs, {
138
+ children: [/*#__PURE__*/_jsx("div", {
139
+ className: "edit-site-style-book__tablist-container",
140
+ children: /*#__PURE__*/_jsx(Tabs.TabList, {
141
+ children: tabs.map(tab => /*#__PURE__*/_jsx(Tabs.Tab, {
142
+ tabId: tab.slug,
143
+ children: tab.title
144
+ }, tab.slug))
145
+ })
146
+ }), tabs.map(tab => /*#__PURE__*/_jsx(Tabs.TabPanel, {
147
+ tabId: tab.slug,
148
+ focusable: false,
149
+ className: "edit-site-style-book__tabpanel",
150
+ children: /*#__PURE__*/_jsx(StyleBookBody, {
151
+ category: tab.slug,
152
+ examples: examples,
153
+ isSelected: isSelected,
154
+ onSelect: onSelect,
155
+ settings: settings,
156
+ sizes: sizes,
157
+ title: tab.title
158
+ })
159
+ }, tab.slug))]
114
160
  }) : /*#__PURE__*/_jsx(StyleBookBody, {
115
161
  examples: examples,
116
162
  isSelected: isSelected,
@@ -209,6 +255,7 @@ const Examples = memo(({
209
255
  children: [!!filteredExamples?.examples?.length && filteredExamples.examples.map(example => /*#__PURE__*/_jsx(Example, {
210
256
  id: `example-${example.name}`,
211
257
  title: example.title,
258
+ content: example.content,
212
259
  blocks: example.blocks,
213
260
  isSelected: isSelected(example.name),
214
261
  onClick: () => {
@@ -237,6 +284,7 @@ const Subcategory = ({
237
284
  return !!examples?.length && examples.map(example => /*#__PURE__*/_jsx(Example, {
238
285
  id: `example-${example.name}`,
239
286
  title: example.title,
287
+ content: example.content,
240
288
  blocks: example.blocks,
241
289
  isSelected: isSelected(example.name),
242
290
  onClick: () => {
@@ -244,30 +292,37 @@ const Subcategory = ({
244
292
  }
245
293
  }, example.name));
246
294
  };
295
+ const disabledExamples = ['example-duotones'];
247
296
  const Example = ({
248
297
  id,
249
298
  title,
250
299
  blocks,
251
300
  isSelected,
252
- onClick
301
+ onClick,
302
+ content
253
303
  }) => {
254
304
  const originalSettings = useSelect(select => select(blockEditorStore).getSettings(), []);
255
305
  const settings = useMemo(() => ({
256
306
  ...originalSettings,
257
307
  focusMode: false,
258
308
  // Disable "Spotlight mode".
259
- __unstableIsPreviewMode: true
309
+ isPreviewMode: true
260
310
  }), [originalSettings]);
261
311
 
262
312
  // Cache the list of blocks to avoid additional processing when the component is re-rendered.
263
313
  const renderedBlocks = useMemo(() => Array.isArray(blocks) ? blocks : [blocks], [blocks]);
314
+ const disabledProps = disabledExamples.includes(id) ? {
315
+ disabled: true,
316
+ accessibleWhenDisabled: true
317
+ } : {};
264
318
  return /*#__PURE__*/_jsx("div", {
265
319
  role: "row",
266
320
  children: /*#__PURE__*/_jsx("div", {
267
321
  role: "gridcell",
268
322
  children: /*#__PURE__*/_jsxs(Composite.Item, {
269
323
  className: clsx('edit-site-style-book__example', {
270
- 'is-selected': isSelected
324
+ 'is-selected': isSelected,
325
+ 'is-disabled-example': !!disabledProps?.disabled
271
326
  }),
272
327
  id: id,
273
328
  "aria-label": sprintf(
@@ -276,6 +331,7 @@ const Example = ({
276
331
  render: /*#__PURE__*/_jsx("div", {}),
277
332
  role: "button",
278
333
  onClick: onClick,
334
+ ...disabledProps,
279
335
  children: [/*#__PURE__*/_jsx("span", {
280
336
  className: "edit-site-style-book__example-title",
281
337
  children: title
@@ -284,12 +340,12 @@ const Example = ({
284
340
  "aria-hidden": true,
285
341
  children: /*#__PURE__*/_jsx(Disabled, {
286
342
  className: "edit-site-style-book__example-preview__content",
287
- children: /*#__PURE__*/_jsx(ExperimentalBlockEditorProvider, {
343
+ children: content ? content : /*#__PURE__*/_jsxs(ExperimentalBlockEditorProvider, {
288
344
  value: renderedBlocks,
289
345
  settings: settings,
290
- children: /*#__PURE__*/_jsx(BlockList, {
346
+ children: [/*#__PURE__*/_jsx(EditorStyles, {}), /*#__PURE__*/_jsx(BlockList, {
291
347
  renderAppender: false
292
- })
348
+ })]
293
349
  })
294
350
  })
295
351
  })]