@wordpress/edit-site 6.12.0 → 6.12.1-next.082ed6819.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 (221) hide show
  1. package/build/components/add-new-template/utils.js +1 -2
  2. package/build/components/add-new-template/utils.js.map +1 -1
  3. package/build/components/app/index.js +0 -3
  4. package/build/components/app/index.js.map +1 -1
  5. package/build/components/block-editor/use-site-editor-settings.js +4 -12
  6. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  7. package/build/components/editor/index.js +18 -27
  8. package/build/components/editor/index.js.map +1 -1
  9. package/build/components/editor/use-editor-title.js +13 -5
  10. package/build/components/editor/use-editor-title.js.map +1 -1
  11. package/build/components/editor/use-resolve-edited-entity.js +133 -0
  12. package/build/components/editor/use-resolve-edited-entity.js.map +1 -0
  13. package/build/components/editor-canvas-container/index.js +1 -1
  14. package/build/components/editor-canvas-container/index.js.map +1 -1
  15. package/build/components/global-styles/block-preview-panel.js +8 -10
  16. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  17. package/build/components/global-styles/screen-block.js +18 -5
  18. package/build/components/global-styles/screen-block.js.map +1 -1
  19. package/build/components/global-styles/screen-style-variations.js +11 -5
  20. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  21. package/build/components/global-styles/ui.js.map +1 -1
  22. package/build/components/global-styles-sidebar/index.js +17 -1
  23. package/build/components/global-styles-sidebar/index.js.map +1 -1
  24. package/build/components/page-patterns/header.js +2 -2
  25. package/build/components/page-patterns/header.js.map +1 -1
  26. package/build/components/page-patterns/use-patterns.js +4 -8
  27. package/build/components/page-patterns/use-patterns.js.map +1 -1
  28. package/build/components/post-edit/index.js +10 -12
  29. package/build/components/post-edit/index.js.map +1 -1
  30. package/build/components/post-list/index.js +3 -3
  31. package/build/components/post-list/index.js.map +1 -1
  32. package/build/components/posts-app/index.js +3 -4
  33. package/build/components/posts-app/index.js.map +1 -1
  34. package/build/components/posts-app-routes/home.js +48 -0
  35. package/build/components/posts-app-routes/home.js.map +1 -0
  36. package/build/components/posts-app-routes/index.js +37 -0
  37. package/build/components/posts-app-routes/index.js.map +1 -0
  38. package/build/components/posts-app-routes/posts-edit.js +44 -0
  39. package/build/components/posts-app-routes/posts-edit.js.map +1 -0
  40. package/build/components/posts-app-routes/posts-list-view-quick-edit.js +63 -0
  41. package/build/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
  42. package/build/components/posts-app-routes/posts-list-view.js +48 -0
  43. package/build/components/posts-app-routes/posts-list-view.js.map +1 -0
  44. package/build/components/posts-app-routes/posts-view-quick-edit.js +60 -0
  45. package/build/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
  46. package/build/components/posts-app-routes/posts-view.js +41 -0
  47. package/build/components/posts-app-routes/posts-view.js.map +1 -0
  48. package/build/components/sidebar-navigation-screen-details-footer/index.js +17 -23
  49. package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  50. package/build/components/sidebar-navigation-screen-global-styles/index.js +4 -18
  51. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  52. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  53. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  54. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +2 -3
  55. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  56. package/build/components/site-editor-routes/index.js +1 -2
  57. package/build/components/site-editor-routes/index.js.map +1 -1
  58. package/build/components/style-book/examples.js +24 -2
  59. package/build/components/style-book/examples.js.map +1 -1
  60. package/build/index.js +0 -9
  61. package/build/index.js.map +1 -1
  62. package/build/store/actions.js +13 -0
  63. package/build/store/actions.js.map +1 -1
  64. package/build/store/selectors.js +21 -1
  65. package/build/store/selectors.js.map +1 -1
  66. package/build-module/components/add-new-template/utils.js +1 -2
  67. package/build-module/components/add-new-template/utils.js.map +1 -1
  68. package/build-module/components/app/index.js +0 -3
  69. package/build-module/components/app/index.js.map +1 -1
  70. package/build-module/components/block-editor/use-site-editor-settings.js +4 -12
  71. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  72. package/build-module/components/editor/index.js +18 -27
  73. package/build-module/components/editor/index.js.map +1 -1
  74. package/build-module/components/editor/use-editor-title.js +13 -5
  75. package/build-module/components/editor/use-editor-title.js.map +1 -1
  76. package/build-module/components/editor/use-resolve-edited-entity.js +125 -0
  77. package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -0
  78. package/build-module/components/editor-canvas-container/index.js +1 -1
  79. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  80. package/build-module/components/global-styles/block-preview-panel.js +8 -10
  81. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  82. package/build-module/components/global-styles/screen-block.js +18 -5
  83. package/build-module/components/global-styles/screen-block.js.map +1 -1
  84. package/build-module/components/global-styles/screen-style-variations.js +11 -5
  85. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  86. package/build-module/components/global-styles/ui.js +1 -1
  87. package/build-module/components/global-styles/ui.js.map +1 -1
  88. package/build-module/components/global-styles-sidebar/index.js +18 -2
  89. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  90. package/build-module/components/page-patterns/header.js +2 -2
  91. package/build-module/components/page-patterns/header.js.map +1 -1
  92. package/build-module/components/page-patterns/use-patterns.js +4 -8
  93. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  94. package/build-module/components/post-edit/index.js +9 -11
  95. package/build-module/components/post-edit/index.js.map +1 -1
  96. package/build-module/components/post-list/index.js +2 -2
  97. package/build-module/components/post-list/index.js.map +1 -1
  98. package/build-module/components/posts-app/index.js +3 -4
  99. package/build-module/components/posts-app/index.js.map +1 -1
  100. package/build-module/components/posts-app-routes/home.js +40 -0
  101. package/build-module/components/posts-app-routes/home.js.map +1 -0
  102. package/build-module/components/posts-app-routes/index.js +30 -0
  103. package/build-module/components/posts-app-routes/index.js.map +1 -0
  104. package/build-module/components/posts-app-routes/posts-edit.js +36 -0
  105. package/build-module/components/posts-app-routes/posts-edit.js.map +1 -0
  106. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js +55 -0
  107. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
  108. package/build-module/components/posts-app-routes/posts-list-view.js +40 -0
  109. package/build-module/components/posts-app-routes/posts-list-view.js.map +1 -0
  110. package/build-module/components/posts-app-routes/posts-view-quick-edit.js +52 -0
  111. package/build-module/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
  112. package/build-module/components/posts-app-routes/posts-view.js +33 -0
  113. package/build-module/components/posts-app-routes/posts-view.js.map +1 -0
  114. package/build-module/components/sidebar-navigation-screen-details-footer/index.js +20 -26
  115. package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  116. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +4 -18
  117. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  118. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  119. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  120. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +3 -4
  121. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  122. package/build-module/components/site-editor-routes/index.js +1 -2
  123. package/build-module/components/site-editor-routes/index.js.map +1 -1
  124. package/build-module/components/style-book/examples.js +24 -2
  125. package/build-module/components/style-book/examples.js.map +1 -1
  126. package/build-module/index.js +1 -10
  127. package/build-module/index.js.map +1 -1
  128. package/build-module/store/actions.js +13 -0
  129. package/build-module/store/actions.js.map +1 -1
  130. package/build-module/store/selectors.js +21 -1
  131. package/build-module/store/selectors.js.map +1 -1
  132. package/build-style/posts-rtl.css +59 -18
  133. package/build-style/posts.css +59 -18
  134. package/build-style/style-rtl.css +74 -57
  135. package/build-style/style.css +74 -57
  136. package/package.json +38 -38
  137. package/src/components/add-new-template/utils.js +2 -2
  138. package/src/components/app/index.js +0 -3
  139. package/src/components/block-editor/use-site-editor-settings.js +7 -21
  140. package/src/components/editor/index.js +22 -33
  141. package/src/components/editor/use-editor-title.js +17 -4
  142. package/src/components/editor/use-resolve-edited-entity.js +132 -0
  143. package/src/components/editor-canvas-container/index.js +1 -1
  144. package/src/components/global-styles/block-preview-panel.js +10 -10
  145. package/src/components/global-styles/screen-block.js +26 -8
  146. package/src/components/global-styles/screen-style-variations.js +14 -5
  147. package/src/components/global-styles/ui.js +1 -1
  148. package/src/components/global-styles-sidebar/index.js +16 -2
  149. package/src/components/page-patterns/header.js +3 -2
  150. package/src/components/page-patterns/use-patterns.js +9 -7
  151. package/src/components/page-templates/style.scss +1 -0
  152. package/src/components/post-edit/index.js +10 -13
  153. package/src/components/post-list/index.js +1 -2
  154. package/src/components/posts-app/index.js +3 -4
  155. package/src/components/posts-app-routes/home.js +36 -0
  156. package/src/components/posts-app-routes/index.js +36 -0
  157. package/src/components/posts-app-routes/posts-edit.js +31 -0
  158. package/src/components/posts-app-routes/posts-list-view-quick-edit.js +52 -0
  159. package/src/components/posts-app-routes/posts-list-view.js +40 -0
  160. package/src/components/posts-app-routes/posts-view-quick-edit.js +49 -0
  161. package/src/components/posts-app-routes/posts-view.js +35 -0
  162. package/src/components/sidebar-navigation-screen/style.scss +7 -2
  163. package/src/components/sidebar-navigation-screen-details-footer/index.js +27 -38
  164. package/src/components/sidebar-navigation-screen-details-footer/style.scss +0 -4
  165. package/src/components/sidebar-navigation-screen-global-styles/index.js +8 -17
  166. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +8 -0
  167. package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  168. package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +4 -4
  169. package/src/components/site-editor-routes/README.md +2 -2
  170. package/src/components/site-editor-routes/index.js +0 -2
  171. package/src/components/site-hub/style.scss +1 -1
  172. package/src/components/style-book/examples.tsx +24 -2
  173. package/src/index.js +1 -13
  174. package/src/store/actions.js +15 -0
  175. package/src/store/selectors.js +24 -1
  176. package/src/style.scss +0 -2
  177. package/build/components/post-fields/index.js +0 -96
  178. package/build/components/post-fields/index.js.map +0 -1
  179. package/build/components/posts-app/router.js +0 -85
  180. package/build/components/posts-app/router.js.map +0 -1
  181. package/build/components/sidebar-navigation-screen-details-panel/index.js +0 -54
  182. package/build/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
  183. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -21
  184. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
  185. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -33
  186. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
  187. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -21
  188. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
  189. package/build/components/site-editor-routes/styles-edit.js +0 -33
  190. package/build/components/site-editor-routes/styles-edit.js.map +0 -1
  191. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -219
  192. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
  193. package/build-module/components/post-fields/index.js +0 -88
  194. package/build-module/components/post-fields/index.js.map +0 -1
  195. package/build-module/components/posts-app/router.js +0 -77
  196. package/build-module/components/posts-app/router.js.map +0 -1
  197. package/build-module/components/sidebar-navigation-screen-details-panel/index.js +0 -29
  198. package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
  199. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
  200. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
  201. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -25
  202. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
  203. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
  204. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
  205. package/build-module/components/site-editor-routes/styles-edit.js +0 -25
  206. package/build-module/components/site-editor-routes/styles-edit.js.map +0 -1
  207. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -212
  208. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
  209. package/src/components/post-fields/index.js +0 -107
  210. package/src/components/post-fields/style.scss +0 -3
  211. package/src/components/posts-app/router.js +0 -69
  212. package/src/components/sidebar-navigation-screen-details-panel/index.js +0 -40
  213. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
  214. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -31
  215. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
  216. package/src/components/sidebar-navigation-screen-details-panel/style.scss +0 -26
  217. package/src/components/site-editor-routes/styles-edit.js +0 -26
  218. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -257
  219. package/src/store/test/actions.js +0 -83
  220. package/src/store/test/reducer.js +0 -69
  221. package/src/store/test/selectors.js +0 -41
@@ -0,0 +1,36 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import Editor from '../editor';
10
+ import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
11
+ import { unlock } from '../../lock-unlock';
12
+
13
+ const { useLocation } = unlock( routerPrivateApis );
14
+
15
+ function HomeMobileView() {
16
+ const { params = {} } = useLocation();
17
+ const { canvas = 'view' } = params;
18
+
19
+ return canvas === 'edit' ? (
20
+ <Editor isPostsList />
21
+ ) : (
22
+ <SidebarNavigationScreenMain />
23
+ );
24
+ }
25
+
26
+ export const homeRoute = {
27
+ name: 'home',
28
+ match: () => {
29
+ return true;
30
+ },
31
+ areas: {
32
+ sidebar: <SidebarNavigationScreenMain />,
33
+ preview: <Editor isPostsList />,
34
+ mobile: HomeMobileView,
35
+ },
36
+ };
@@ -0,0 +1,36 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useRegistry, useDispatch } from '@wordpress/data';
5
+ import { useEffect } from '@wordpress/element';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { unlock } from '../../lock-unlock';
11
+ import { store as siteEditorStore } from '../../store';
12
+ import { homeRoute } from './home';
13
+ import { postsListViewQuickEditRoute } from './posts-list-view-quick-edit';
14
+ import { postsListViewRoute } from './posts-list-view';
15
+ import { postsViewQuickEditRoute } from './posts-view-quick-edit';
16
+ import { postsViewRoute } from './posts-view';
17
+ import { postsEditRoute } from './posts-edit';
18
+
19
+ const routes = [
20
+ postsListViewQuickEditRoute,
21
+ postsListViewRoute,
22
+ postsViewQuickEditRoute,
23
+ postsViewRoute,
24
+ postsEditRoute,
25
+ homeRoute,
26
+ ];
27
+
28
+ export function useRegisterPostsAppRoutes() {
29
+ const registry = useRegistry();
30
+ const { registerRoute } = unlock( useDispatch( siteEditorStore ) );
31
+ useEffect( () => {
32
+ registry.batch( () => {
33
+ routes.forEach( registerRoute );
34
+ } );
35
+ }, [ registry, registerRoute ] );
36
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import PostList from '../post-list';
10
+ import DataViewsSidebarContent from '../sidebar-dataviews';
11
+ import SidebarNavigationScreen from '../sidebar-navigation-screen';
12
+ import Editor from '../editor';
13
+
14
+ export const postsEditRoute = {
15
+ name: 'posts-edit',
16
+ match: ( params ) => {
17
+ return params.postType === 'post' && params.canvas === 'edit';
18
+ },
19
+ areas: {
20
+ sidebar: (
21
+ <SidebarNavigationScreen
22
+ title={ __( 'Posts' ) }
23
+ isRoot
24
+ content={ <DataViewsSidebarContent /> }
25
+ />
26
+ ),
27
+ content: <PostList postType="post" />,
28
+ mobile: <Editor isPostsList />,
29
+ preview: <Editor isPostsList />,
30
+ },
31
+ };
@@ -0,0 +1,52 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import PostList from '../post-list';
11
+ import DataViewsSidebarContent from '../sidebar-dataviews';
12
+ import SidebarNavigationScreen from '../sidebar-navigation-screen';
13
+ import { unlock } from '../../lock-unlock';
14
+ import { PostEdit } from '../post-edit';
15
+ import Editor from '../editor';
16
+
17
+ const { useLocation } = unlock( routerPrivateApis );
18
+
19
+ function PostQuickEdit() {
20
+ const { params } = useLocation();
21
+ return <PostEdit postType="post" postId={ params.postId } />;
22
+ }
23
+
24
+ export const postsListViewQuickEditRoute = {
25
+ name: 'posts-list-view-quick-edit',
26
+ match: ( params ) => {
27
+ return (
28
+ params.isCustom !== 'true' &&
29
+ ( params.layout ?? 'list' ) === 'list' &&
30
+ !! params.quickEdit &&
31
+ params.postType === 'post' &&
32
+ params.canvas !== 'edit'
33
+ );
34
+ },
35
+ areas: {
36
+ sidebar: (
37
+ <SidebarNavigationScreen
38
+ title={ __( 'Posts' ) }
39
+ isRoot
40
+ content={ <DataViewsSidebarContent /> }
41
+ />
42
+ ),
43
+ content: <PostList postType="post" />,
44
+ mobile: <PostList postType="post" />,
45
+ preview: <Editor />,
46
+ edit: <PostQuickEdit />,
47
+ },
48
+ widths: {
49
+ content: 380,
50
+ edit: 380,
51
+ },
52
+ };
@@ -0,0 +1,40 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import PostList from '../post-list';
10
+ import DataViewsSidebarContent from '../sidebar-dataviews';
11
+ import SidebarNavigationScreen from '../sidebar-navigation-screen';
12
+ import Editor from '../editor';
13
+
14
+ export const postsListViewRoute = {
15
+ name: 'posts-list-view',
16
+ match: ( params ) => {
17
+ return (
18
+ params.isCustom !== 'true' &&
19
+ ( params.layout ?? 'list' ) === 'list' &&
20
+ ! params.quickEdit &&
21
+ params.postType === 'post' &&
22
+ params.canvas !== 'edit'
23
+ );
24
+ },
25
+ areas: {
26
+ sidebar: (
27
+ <SidebarNavigationScreen
28
+ title={ __( 'Posts' ) }
29
+ isRoot
30
+ content={ <DataViewsSidebarContent /> }
31
+ />
32
+ ),
33
+ content: <PostList postType="post" />,
34
+ preview: <Editor isPostsList />,
35
+ mobile: <PostList postType="post" />,
36
+ },
37
+ widths: {
38
+ content: 380,
39
+ },
40
+ };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import PostList from '../post-list';
11
+ import DataViewsSidebarContent from '../sidebar-dataviews';
12
+ import SidebarNavigationScreen from '../sidebar-navigation-screen';
13
+ import { unlock } from '../../lock-unlock';
14
+ import { PostEdit } from '../post-edit';
15
+
16
+ const { useLocation } = unlock( routerPrivateApis );
17
+
18
+ function PostQuickEdit() {
19
+ const { params } = useLocation();
20
+ return <PostEdit postType="post" postId={ params.postId } />;
21
+ }
22
+
23
+ export const postsViewQuickEditRoute = {
24
+ name: 'posts-view-quick-edit',
25
+ match: ( params ) => {
26
+ return (
27
+ ( params.isCustom === 'true' ||
28
+ ( params.layout ?? 'list' ) !== 'list' ) &&
29
+ !! params.quickEdit &&
30
+ params.postType === 'post' &&
31
+ params.canvas !== 'edit'
32
+ );
33
+ },
34
+ areas: {
35
+ sidebar: (
36
+ <SidebarNavigationScreen
37
+ title={ __( 'Posts' ) }
38
+ isRoot
39
+ content={ <DataViewsSidebarContent /> }
40
+ />
41
+ ),
42
+ content: <PostList postType="post" />,
43
+ mobile: <PostList postType="post" />,
44
+ edit: <PostQuickEdit />,
45
+ },
46
+ widths: {
47
+ edit: 380,
48
+ },
49
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import PostList from '../post-list';
10
+ import DataViewsSidebarContent from '../sidebar-dataviews';
11
+ import SidebarNavigationScreen from '../sidebar-navigation-screen';
12
+
13
+ export const postsViewRoute = {
14
+ name: 'posts-view',
15
+ match: ( params ) => {
16
+ return (
17
+ ( params.isCustom === 'true' ||
18
+ ( params.layout ?? 'list' ) !== 'list' ) &&
19
+ ! params.quickEdit &&
20
+ params.postType === 'post' &&
21
+ params.canvas !== 'edit'
22
+ );
23
+ },
24
+ areas: {
25
+ sidebar: (
26
+ <SidebarNavigationScreen
27
+ title={ __( 'Posts' ) }
28
+ isRoot
29
+ content={ <DataViewsSidebarContent /> }
30
+ />
31
+ ),
32
+ content: <PostList postType="post" />,
33
+ mobile: <PostList postType="post" />,
34
+ },
35
+ };
@@ -18,7 +18,7 @@
18
18
  .edit-site-sidebar-navigation-screen__content {
19
19
  padding: 0 $grid-unit-20;
20
20
 
21
- .components-item-group {
21
+ .edit-site-sidebar-navigation-screen-details-footer {
22
22
  margin-left: -$grid-unit-20;
23
23
  margin-right: -$grid-unit-20;
24
24
  }
@@ -127,9 +127,14 @@
127
127
  bottom: 0;
128
128
  background-color: $gray-900;
129
129
  gap: 0;
130
- padding: $grid-unit-20 0;
130
+ padding: $grid-unit-10 $grid-unit-20;
131
131
  margin: $grid-unit-20 0 0;
132
132
  border-top: 1px solid $gray-800;
133
+
134
+ .components-item-group {
135
+ margin-left: -$grid-unit-20;
136
+ margin-right: -$grid-unit-20;
137
+ }
133
138
  }
134
139
 
135
140
  /* In general style overrides are discouraged.
@@ -1,28 +1,19 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __, sprintf } from '@wordpress/i18n';
5
- import { humanTimeDiff } from '@wordpress/date';
6
- import { createInterpolateElement } from '@wordpress/element';
4
+ import { _n, sprintf } from '@wordpress/i18n';
7
5
  import { addQueryArgs } from '@wordpress/url';
8
- import {
9
- Icon,
10
- __experimentalItemGroup as ItemGroup,
11
- } from '@wordpress/components';
6
+ import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
12
7
  import { backup } from '@wordpress/icons';
13
8
 
14
9
  /**
15
10
  * Internal dependencies
16
11
  */
17
- import {
18
- SidebarNavigationScreenDetailsPanelRow,
19
- SidebarNavigationScreenDetailsPanelLabel,
20
- SidebarNavigationScreenDetailsPanelValue,
21
- } from '../sidebar-navigation-screen-details-panel';
22
12
  import SidebarNavigationItem from '../sidebar-navigation-item';
23
13
 
24
14
  export default function SidebarNavigationScreenDetailsFooter( {
25
15
  record,
16
+ revisionsCount,
26
17
  ...otherProps
27
18
  } ) {
28
19
  /*
@@ -34,9 +25,20 @@ export default function SidebarNavigationScreenDetailsFooter( {
34
25
  const hrefProps = {};
35
26
  const lastRevisionId =
36
27
  record?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;
37
- const revisionsCount =
38
- record?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;
39
- // Enable the revisions link if there is a last revision and there are more than one revisions.
28
+
29
+ // Use incoming prop first, then the record's version history, if available.
30
+ revisionsCount =
31
+ revisionsCount ||
32
+ record?._links?.[ 'version-history' ]?.[ 0 ]?.count ||
33
+ 0;
34
+
35
+ /*
36
+ * Enable the revisions link if there is a last revision and there is more than one revision.
37
+ * This link is used for theme assets, e.g., templates, which have no database record until they're edited.
38
+ * For these files there's only a "revision" after they're edited twice,
39
+ * which means the revision.php page won't display a proper diff.
40
+ * See: https://github.com/WordPress/gutenberg/issues/49164.
41
+ */
40
42
  if ( lastRevisionId && revisionsCount > 1 ) {
41
43
  hrefProps.href = addQueryArgs( 'revision.php', {
42
44
  revision: record?._links[ 'predecessor-version' ][ 0 ].id,
@@ -44,33 +46,20 @@ export default function SidebarNavigationScreenDetailsFooter( {
44
46
  hrefProps.as = 'a';
45
47
  }
46
48
  return (
47
- <ItemGroup className="edit-site-sidebar-navigation-screen-details-footer">
49
+ <ItemGroup
50
+ size="large"
51
+ className="edit-site-sidebar-navigation-screen-details-footer"
52
+ >
48
53
  <SidebarNavigationItem
49
- aria-label={ __( 'Revisions' ) }
54
+ icon={ backup }
50
55
  { ...hrefProps }
51
56
  { ...otherProps }
52
57
  >
53
- <SidebarNavigationScreenDetailsPanelRow justify="space-between">
54
- <SidebarNavigationScreenDetailsPanelLabel>
55
- { __( 'Last modified' ) }
56
- </SidebarNavigationScreenDetailsPanelLabel>
57
- <SidebarNavigationScreenDetailsPanelValue>
58
- { createInterpolateElement(
59
- sprintf(
60
- /* translators: %s: is the relative time when the post was last modified. */
61
- __( '<time>%s</time>' ),
62
- humanTimeDiff( record.modified )
63
- ),
64
- {
65
- time: <time dateTime={ record.modified } />,
66
- }
67
- ) }
68
- </SidebarNavigationScreenDetailsPanelValue>
69
- <Icon
70
- className="edit-site-sidebar-navigation-screen-details-footer__icon"
71
- icon={ backup }
72
- />
73
- </SidebarNavigationScreenDetailsPanelRow>
58
+ { sprintf(
59
+ /* translators: %d: Number of Styles revisions. */
60
+ _n( '%d Revision', '%d Revisions', revisionsCount ),
61
+ revisionsCount
62
+ ) }
74
63
  </SidebarNavigationItem>
75
64
  </ItemGroup>
76
65
  );
@@ -5,8 +5,4 @@
5
5
  div.edit-site-sidebar-navigation-item.components-item[aria-current] {
6
6
  background: none;
7
7
  }
8
- .edit-site-sidebar-navigation-screen-details-footer__icon {
9
- margin-left: auto;
10
- fill: $gray-600;
11
- }
12
8
  }
@@ -48,24 +48,15 @@ export function SidebarNavigationItemGlobalStyles( props ) {
48
48
  export default function SidebarNavigationScreenGlobalStyles() {
49
49
  const history = useHistory();
50
50
  const { params } = useLocation();
51
- const { revisions, isLoading: isLoadingRevisions } =
52
- useGlobalStylesRevisions();
51
+ const {
52
+ revisions,
53
+ isLoading: isLoadingRevisions,
54
+ revisionsCount,
55
+ } = useGlobalStylesRevisions();
53
56
  const { openGeneralSidebar } = useDispatch( editSiteStore );
54
57
  const { setEditorCanvasContainerView } = unlock(
55
58
  useDispatch( editSiteStore )
56
59
  );
57
- const { revisionsCount } = useSelect( ( select ) => {
58
- const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
59
- select( coreStore );
60
- const globalStylesId = __experimentalGetCurrentGlobalStylesId();
61
- const globalStyles = globalStylesId
62
- ? getEntityRecord( 'root', 'globalStyles', globalStylesId )
63
- : undefined;
64
- return {
65
- revisionsCount:
66
- globalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0,
67
- };
68
- }, [] );
69
60
  const { set: setPreference } = useDispatch( preferencesStore );
70
61
 
71
62
  const openGlobalStyles = useCallback( async () => {
@@ -95,10 +86,9 @@ export default function SidebarNavigationScreenGlobalStyles() {
95
86
  }, [ openGlobalStyles, setEditorCanvasContainerView ] );
96
87
 
97
88
  // If there are no revisions, do not render a footer.
98
- const hasRevisions = revisionsCount > 0;
99
- const modifiedDateTime = revisions?.[ 0 ]?.modified;
100
89
  const shouldShowGlobalStylesFooter =
101
- hasRevisions && ! isLoadingRevisions && modifiedDateTime;
90
+ !! revisionsCount && ! isLoadingRevisions;
91
+
102
92
  return (
103
93
  <>
104
94
  <SidebarNavigationScreen
@@ -114,6 +104,7 @@ export default function SidebarNavigationScreenGlobalStyles() {
114
104
  shouldShowGlobalStylesFooter && (
115
105
  <SidebarNavigationScreenDetailsFooter
116
106
  record={ revisions?.[ 0 ] }
107
+ revisionsCount={ revisionsCount }
117
108
  onClick={ openRevisions }
118
109
  />
119
110
  )
@@ -27,6 +27,14 @@
27
27
  color: $white;
28
28
  }
29
29
  }
30
+
31
+ .block-editor-list-view-block__menu {
32
+ color: $gray-600;
33
+ &:hover,
34
+ &:focus {
35
+ color: $white;
36
+ }
37
+ }
30
38
  }
31
39
 
32
40
  .edit-site-sidebar-navigation-screen-navigation-menus__loading.components-spinner {
@@ -69,7 +69,7 @@ export default function usePatternCategories() {
69
69
  // If the pattern has no categories, add it to uncategorized.
70
70
  if (
71
71
  ! pattern.wp_pattern_category?.length ||
72
- ! pattern.wp_pattern_category.some( ( catId ) =>
72
+ ! pattern.wp_pattern_category?.some( ( catId ) =>
73
73
  userPatternCategories.find( ( cat ) => cat.id === catId )
74
74
  )
75
75
  ) {
@@ -1,9 +1,8 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useEntityRecords } from '@wordpress/core-data';
4
+ import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
5
5
  import { useSelect } from '@wordpress/data';
6
- import { store as editorStore } from '@wordpress/editor';
7
6
 
8
7
  /**
9
8
  * Internal dependencies
@@ -18,7 +17,8 @@ const useTemplatePartsGroupedByArea = ( items ) => {
18
17
 
19
18
  const templatePartAreas = useSelect(
20
19
  ( select ) =>
21
- select( editorStore ).__experimentalGetDefaultTemplatePartAreas(),
20
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
21
+ ?.default_template_part_areas || [],
22
22
  []
23
23
  );
24
24
 
@@ -43,7 +43,7 @@ const useTemplatePartsGroupedByArea = ( items ) => {
43
43
  const key = accumulator[ item.area ]
44
44
  ? item.area
45
45
  : TEMPLATE_PART_AREA_DEFAULT_CATEGORY;
46
- accumulator[ key ].templateParts.push( item );
46
+ accumulator[ key ]?.templateParts?.push( item );
47
47
  return accumulator;
48
48
  }, knownAreas );
49
49
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Areas
4
4
 
5
- When `canvasMode` is not `edit`, the areas avaliable to use are:
5
+ When `canvasMode` is not `edit`, the areas available to use are:
6
6
 
7
7
  | Area | Non-mobile viewport | Mobile viewport |
8
8
  | --- | --- | --- |
@@ -12,7 +12,7 @@ When `canvasMode` is not `edit`, the areas avaliable to use are:
12
12
  | `edit` | Rendered if provided. | Not rendered. |
13
13
  | `mobile` | Not rendered | Rendered as full-screen, if provided. |
14
14
 
15
- When `canvasMode` is `edit`, the areas avaliable to use are:
15
+ When `canvasMode` is `edit`, the areas available to use are:
16
16
 
17
17
  | Area | Non-mobile viewport | Mobile viewport |
18
18
  | --- | --- | --- |
@@ -15,7 +15,6 @@ import { navigationViewRoute } from './navigation-view';
15
15
  import { navigationEditRoute } from './navigation-edit';
16
16
  import { navigationItemEditRoute } from './navigation-item-edit';
17
17
  import { navigationItemViewRoute } from './navigation-item-view';
18
- import { stylesEditRoute } from './styles-edit';
19
18
  import { stylesViewRoute } from './styles-view';
20
19
  import { patternsEditRoute } from './patterns-edit';
21
20
  import { patternsViewRoute } from './patterns-view';
@@ -40,7 +39,6 @@ const routes = [
40
39
  patternsViewRoute,
41
40
  patternsEditRoute,
42
41
  stylesViewRoute,
43
- stylesEditRoute,
44
42
  navigationItemViewRoute,
45
43
  navigationItemEditRoute,
46
44
  navigationViewRoute,
@@ -4,7 +4,7 @@
4
4
  justify-content: space-between;
5
5
  gap: $grid-unit-10;
6
6
  margin-right: $grid-unit-15;
7
- height: $grid-unit-70;
7
+ height: $header-height;
8
8
  }
9
9
 
10
10
  .edit-site-site-hub__actions {
@@ -150,7 +150,18 @@ function getOverviewBlockExamples(
150
150
  name: blockName,
151
151
  title: blockType.title,
152
152
  category: 'overview',
153
- blocks: getBlockFromExample( blockName, blockType.example ),
153
+ /*
154
+ * CSS generated from style attributes will take precedence over global styles CSS,
155
+ * so remove the style attribute from the example to ensure the example
156
+ * demonstrates changes to global styles.
157
+ */
158
+ blocks: getBlockFromExample( blockName, {
159
+ ...blockType.example,
160
+ attributes: {
161
+ ...blockType.example.attributes,
162
+ style: undefined,
163
+ },
164
+ } ),
154
165
  };
155
166
  examples.push( blockExample );
156
167
  }
@@ -179,7 +190,18 @@ export function getExamples( colors: MultiOriginPalettes ): BlockExample[] {
179
190
  name: blockType.name,
180
191
  title: blockType.title,
181
192
  category: blockType.category,
182
- blocks: getBlockFromExample( blockType.name, blockType.example ),
193
+ /*
194
+ * CSS generated from style attributes will take precedence over global styles CSS,
195
+ * so remove the style attribute from the example to ensure the example
196
+ * demonstrates changes to global styles.
197
+ */
198
+ blocks: getBlockFromExample( blockType.name, {
199
+ ...blockType.example,
200
+ attributes: {
201
+ ...blockType.example.attributes,
202
+ style: undefined,
203
+ },
204
+ } ),
183
205
  } ) );
184
206
  const isHeadingBlockRegistered = !! getBlockType( 'core/heading' );
185
207
 
package/src/index.js CHANGED
@@ -10,10 +10,7 @@ import {
10
10
  import { dispatch } from '@wordpress/data';
11
11
  import deprecated from '@wordpress/deprecated';
12
12
  import { createRoot, StrictMode } from '@wordpress/element';
13
- import {
14
- store as editorStore,
15
- privateApis as editorPrivateApis,
16
- } from '@wordpress/editor';
13
+ import { privateApis as editorPrivateApis } from '@wordpress/editor';
17
14
  import { store as preferencesStore } from '@wordpress/preferences';
18
15
  import {
19
16
  registerLegacyWidgetBlock,
@@ -88,15 +85,6 @@ export function initializeEditor( id, settings ) {
88
85
 
89
86
  dispatch( editSiteStore ).updateSettings( settings );
90
87
 
91
- // Keep the defaultTemplateTypes in the core/editor settings too,
92
- // so that they can be selected with core/editor selectors in any editor.
93
- // This is needed because edit-site doesn't initialize with EditorProvider,
94
- // which internally uses updateEditorSettings as well.
95
- dispatch( editorStore ).updateEditorSettings( {
96
- defaultTemplateTypes: settings.defaultTemplateTypes,
97
- defaultTemplatePartAreas: settings.defaultTemplatePartAreas,
98
- } );
99
-
100
88
  // Prevent the default browser action for files dropped outside of dropzones.
101
89
  window.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );
102
90
  window.addEventListener( 'drop', ( e ) => e.preventDefault(), false );