@wordpress/edit-site 6.19.0 → 6.20.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 (140) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/utils.js +1 -1
  3. package/build/components/add-new-template/utils.js.map +1 -1
  4. package/build/components/app/index.js +19 -2
  5. package/build/components/app/index.js.map +1 -1
  6. package/build/components/editor/site-preview.js +9 -10
  7. package/build/components/editor/site-preview.js.map +1 -1
  8. package/build/components/editor/use-editor-title.js +3 -2
  9. package/build/components/editor/use-editor-title.js.map +1 -1
  10. package/build/components/global-styles/shadows-panel.js +19 -23
  11. package/build/components/global-styles/shadows-panel.js.map +1 -1
  12. package/build/components/layout/index.js +23 -15
  13. package/build/components/layout/index.js.map +1 -1
  14. package/build/components/page-patterns/header.js +1 -1
  15. package/build/components/page-patterns/header.js.map +1 -1
  16. package/build/components/page-patterns/use-patterns.js +3 -2
  17. package/build/components/page-patterns/use-patterns.js.map +1 -1
  18. package/build/components/sidebar/index.js +17 -11
  19. package/build/components/sidebar/index.js.map +1 -1
  20. package/build/components/sidebar-navigation-screen-main/index.js +1 -1
  21. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  22. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +28 -30
  23. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  24. package/build/components/sidebar-navigation-screen-patterns/index.js +1 -0
  25. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  26. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +1 -1
  27. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  28. package/build/components/sidebar-navigation-screen-unsupported/index.js +24 -0
  29. package/build/components/sidebar-navigation-screen-unsupported/index.js.map +1 -0
  30. package/build/components/site-editor-routes/home.js +22 -5
  31. package/build/components/site-editor-routes/home.js.map +1 -1
  32. package/build/components/site-editor-routes/navigation-item.js +21 -5
  33. package/build/components/site-editor-routes/navigation-item.js.map +1 -1
  34. package/build/components/site-editor-routes/navigation.js +21 -5
  35. package/build/components/site-editor-routes/navigation.js.map +1 -1
  36. package/build/components/site-editor-routes/page-item.js +25 -9
  37. package/build/components/site-editor-routes/page-item.js.map +1 -1
  38. package/build/components/site-editor-routes/pages.js +32 -11
  39. package/build/components/site-editor-routes/pages.js.map +1 -1
  40. package/build/components/site-editor-routes/pattern-item.js +10 -3
  41. package/build/components/site-editor-routes/pattern-item.js.map +1 -1
  42. package/build/components/site-editor-routes/patterns.js +23 -24
  43. package/build/components/site-editor-routes/patterns.js.map +1 -1
  44. package/build/components/site-editor-routes/stylebook.js +25 -11
  45. package/build/components/site-editor-routes/stylebook.js.map +1 -1
  46. package/build/components/site-editor-routes/template-item.js +21 -5
  47. package/build/components/site-editor-routes/template-item.js.map +1 -1
  48. package/build/components/site-editor-routes/templates.js +27 -6
  49. package/build/components/site-editor-routes/templates.js.map +1 -1
  50. package/build/components/site-editor-routes/utils.js +20 -0
  51. package/build/components/site-editor-routes/utils.js.map +1 -0
  52. package/build/components/site-hub/index.js +37 -15
  53. package/build/components/site-hub/index.js.map +1 -1
  54. package/build-module/components/add-new-template/utils.js +1 -1
  55. package/build-module/components/add-new-template/utils.js.map +1 -1
  56. package/build-module/components/app/index.js +20 -3
  57. package/build-module/components/app/index.js.map +1 -1
  58. package/build-module/components/editor/site-preview.js +9 -10
  59. package/build-module/components/editor/site-preview.js.map +1 -1
  60. package/build-module/components/editor/use-editor-title.js +3 -2
  61. package/build-module/components/editor/use-editor-title.js.map +1 -1
  62. package/build-module/components/global-styles/shadows-panel.js +20 -24
  63. package/build-module/components/global-styles/shadows-panel.js.map +1 -1
  64. package/build-module/components/layout/index.js +22 -14
  65. package/build-module/components/layout/index.js.map +1 -1
  66. package/build-module/components/page-patterns/header.js +1 -1
  67. package/build-module/components/page-patterns/header.js.map +1 -1
  68. package/build-module/components/page-patterns/use-patterns.js +3 -2
  69. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  70. package/build-module/components/sidebar/index.js +15 -10
  71. package/build-module/components/sidebar/index.js.map +1 -1
  72. package/build-module/components/sidebar-navigation-screen-main/index.js +1 -1
  73. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  74. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +28 -30
  75. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  76. package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -0
  77. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  78. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +1 -1
  79. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  80. package/build-module/components/sidebar-navigation-screen-unsupported/index.js +17 -0
  81. package/build-module/components/sidebar-navigation-screen-unsupported/index.js.map +1 -0
  82. package/build-module/components/site-editor-routes/home.js +22 -5
  83. package/build-module/components/site-editor-routes/home.js.map +1 -1
  84. package/build-module/components/site-editor-routes/navigation-item.js +21 -5
  85. package/build-module/components/site-editor-routes/navigation-item.js.map +1 -1
  86. package/build-module/components/site-editor-routes/navigation.js +21 -5
  87. package/build-module/components/site-editor-routes/navigation.js.map +1 -1
  88. package/build-module/components/site-editor-routes/page-item.js +25 -9
  89. package/build-module/components/site-editor-routes/page-item.js.map +1 -1
  90. package/build-module/components/site-editor-routes/pages.js +32 -11
  91. package/build-module/components/site-editor-routes/pages.js.map +1 -1
  92. package/build-module/components/site-editor-routes/pattern-item.js +10 -3
  93. package/build-module/components/site-editor-routes/pattern-item.js.map +1 -1
  94. package/build-module/components/site-editor-routes/patterns.js +23 -24
  95. package/build-module/components/site-editor-routes/patterns.js.map +1 -1
  96. package/build-module/components/site-editor-routes/stylebook.js +25 -11
  97. package/build-module/components/site-editor-routes/stylebook.js.map +1 -1
  98. package/build-module/components/site-editor-routes/template-item.js +21 -5
  99. package/build-module/components/site-editor-routes/template-item.js.map +1 -1
  100. package/build-module/components/site-editor-routes/templates.js +27 -6
  101. package/build-module/components/site-editor-routes/templates.js.map +1 -1
  102. package/build-module/components/site-editor-routes/utils.js +14 -0
  103. package/build-module/components/site-editor-routes/utils.js.map +1 -0
  104. package/build-module/components/site-hub/index.js +37 -15
  105. package/build-module/components/site-hub/index.js.map +1 -1
  106. package/build-style/posts-rtl.css +7 -10
  107. package/build-style/posts.css +7 -10
  108. package/build-style/style-rtl.css +7 -11
  109. package/build-style/style.css +7 -11
  110. package/package.json +42 -42
  111. package/src/components/add-new-template/utils.js +1 -2
  112. package/src/components/app/index.js +18 -3
  113. package/src/components/editor/site-preview.js +9 -15
  114. package/src/components/editor/use-editor-title.js +6 -6
  115. package/src/components/global-styles/shadows-panel.js +25 -31
  116. package/src/components/global-styles/style.scss +0 -1
  117. package/src/components/layout/index.js +36 -22
  118. package/src/components/layout/style.scss +2 -0
  119. package/src/components/page/style.scss +1 -5
  120. package/src/components/page-patterns/header.js +1 -1
  121. package/src/components/page-patterns/use-patterns.js +7 -7
  122. package/src/components/sidebar/index.js +15 -13
  123. package/src/components/sidebar-navigation-screen-main/index.js +1 -1
  124. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +38 -40
  125. package/src/components/sidebar-navigation-screen-patterns/index.js +1 -0
  126. package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +1 -1
  127. package/src/components/sidebar-navigation-screen-unsupported/index.js +17 -0
  128. package/src/components/site-editor-routes/home.js +27 -3
  129. package/src/components/site-editor-routes/navigation-item.js +25 -5
  130. package/src/components/site-editor-routes/navigation.js +21 -3
  131. package/src/components/site-editor-routes/page-item.js +29 -9
  132. package/src/components/site-editor-routes/pages.js +30 -10
  133. package/src/components/site-editor-routes/pattern-item.js +9 -1
  134. package/src/components/site-editor-routes/patterns.js +22 -21
  135. package/src/components/site-editor-routes/stylebook.js +25 -11
  136. package/src/components/site-editor-routes/template-item.js +25 -3
  137. package/src/components/site-editor-routes/templates.js +26 -4
  138. package/src/components/site-editor-routes/utils.js +14 -0
  139. package/src/components/site-hub/index.js +49 -16
  140. package/tsconfig.tsbuildinfo +1 -1
@@ -3,7 +3,8 @@
3
3
  */
4
4
  import { useSelect } from '@wordpress/data';
5
5
  import { privateApis as routerPrivateApis } from '@wordpress/router';
6
- import { useCallback } from '@wordpress/element';
6
+ import { useCallback, useMemo } from '@wordpress/element';
7
+ import { store as coreStore } from '@wordpress/core-data';
7
8
 
8
9
  /**
9
10
  * Internal dependencies
@@ -30,9 +31,15 @@ function AppLayout() {
30
31
 
31
32
  export default function App() {
32
33
  useRegisterSiteEditorRoutes();
33
- const routes = useSelect( ( select ) => {
34
- return unlock( select( editSiteStore ) ).getRoutes();
34
+ const { routes, currentTheme, editorSettings } = useSelect( ( select ) => {
35
+ return {
36
+ routes: unlock( select( editSiteStore ) ).getRoutes(),
37
+ currentTheme: select( coreStore ).getCurrentTheme(),
38
+ // This is a temp solution until the has_theme_json value is available for the current theme.
39
+ editorSettings: select( editSiteStore ).getSettings(),
40
+ };
35
41
  }, [] );
42
+
36
43
  const beforeNavigate = useCallback( ( { path, query } ) => {
37
44
  if ( ! isPreviewingTheme() ) {
38
45
  return { path, query };
@@ -50,11 +57,19 @@ export default function App() {
50
57
  };
51
58
  }, [] );
52
59
 
60
+ const matchResolverArgsValue = useMemo(
61
+ () => ( {
62
+ siteData: { currentTheme, editorSettings },
63
+ } ),
64
+ [ currentTheme, editorSettings ]
65
+ );
66
+
53
67
  return (
54
68
  <RouterProvider
55
69
  routes={ routes }
56
70
  pathArg="p"
57
71
  beforeNavigate={ beforeNavigate }
72
+ matchResolverArgs={ matchResolverArgsValue }
58
73
  >
59
74
  <AppLayout />
60
75
  </RouterProvider>
@@ -4,6 +4,8 @@
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import { useSelect } from '@wordpress/data';
6
6
  import { store as coreStore } from '@wordpress/core-data';
7
+ import { focus } from '@wordpress/dom';
8
+ import { addQueryArgs } from '@wordpress/url';
7
9
 
8
10
  export default function SitePreview() {
9
11
  const siteUrl = useSelect( ( select ) => {
@@ -12,10 +14,12 @@ export default function SitePreview() {
12
14
  return siteData?.home;
13
15
  }, [] );
14
16
 
15
- // If theme is block based, return the Editor, otherwise return the site preview.
16
17
  return (
17
18
  <iframe
18
- src={ siteUrl }
19
+ src={ addQueryArgs( siteUrl, {
20
+ // Parameter for hiding the admin bar.
21
+ wp_site_preview: 1,
22
+ } ) }
19
23
  title={ __( 'Site Preview' ) }
20
24
  style={ {
21
25
  display: 'block',
@@ -24,20 +28,10 @@ export default function SitePreview() {
24
28
  backgroundColor: '#fff',
25
29
  } }
26
30
  onLoad={ ( event ) => {
27
- // Hide the admin bar in the front-end preview.
28
- const document = event.target.contentDocument;
29
- document.getElementById( 'wpadminbar' ).remove();
30
- document
31
- .getElementsByTagName( 'html' )[ 0 ]
32
- .setAttribute( 'style', 'margin-top: 0 !important;' );
33
- document
34
- .getElementsByTagName( 'body' )[ 0 ]
35
- .classList.remove( 'admin-bar' );
36
31
  // Make interactive elements unclickable.
37
- const interactiveElements = document.querySelectorAll(
38
- 'a, button, input, details, audio'
39
- );
40
- interactiveElements.forEach( ( element ) => {
32
+ const document = event.target.contentDocument;
33
+ const focusableElements = focus.focusable.find( document );
34
+ focusableElements.forEach( ( element ) => {
41
35
  element.style.pointerEvents = 'none';
42
36
  element.tabIndex = -1;
43
37
  element.setAttribute( 'aria-hidden', 'true' );
@@ -19,8 +19,11 @@ const { getTemplateInfo } = unlock( editorPrivateApis );
19
19
  function useEditorTitle( postType, postId ) {
20
20
  const { title, isLoaded } = useSelect(
21
21
  ( select ) => {
22
- const { getEditedEntityRecord, hasFinishedResolution } =
23
- select( coreStore );
22
+ const {
23
+ getEditedEntityRecord,
24
+ getCurrentTheme,
25
+ hasFinishedResolution,
26
+ } = select( coreStore );
24
27
 
25
28
  if ( ! postId ) {
26
29
  return { isLoaded: false };
@@ -33,10 +36,7 @@ function useEditorTitle( postType, postId ) {
33
36
  );
34
37
 
35
38
  const { default_template_types: templateTypes = [] } =
36
- select( coreStore ).getEntityRecord(
37
- 'root',
38
- '__unstableBase'
39
- ) ?? {};
39
+ getCurrentTheme() ?? {};
40
40
 
41
41
  const templateInfo = getTemplateInfo( {
42
42
  template: _record,
@@ -6,7 +6,6 @@ import {
6
6
  __experimentalVStack as VStack,
7
7
  __experimentalItemGroup as ItemGroup,
8
8
  Button,
9
- Flex,
10
9
  FlexItem,
11
10
  privateApis as componentsPrivateApis,
12
11
  } from '@wordpress/components';
@@ -134,14 +133,9 @@ function ShadowList( {
134
133
  return (
135
134
  <VStack spacing={ 2 }>
136
135
  <HStack justify="space-between">
137
- <Flex
138
- align="center"
139
- className="edit-site-global-styles__shadows-panel__title"
140
- >
141
- <Subtitle level={ 3 }>{ label }</Subtitle>
142
- </Flex>
143
- { canCreate && (
144
- <FlexItem className="edit-site-global-styles__shadows-panel__options-container">
136
+ <Subtitle level={ 3 }>{ label }</Subtitle>
137
+ <FlexItem className="edit-site-global-styles__shadows-panel__options-container">
138
+ { canCreate && (
145
139
  <Button
146
140
  size="small"
147
141
  icon={ plus }
@@ -150,28 +144,28 @@ function ShadowList( {
150
144
  handleAddShadow();
151
145
  } }
152
146
  />
153
- </FlexItem>
154
- ) }
155
- { !! shadows?.length && category === 'custom' && (
156
- <Menu>
157
- <Menu.TriggerButton
158
- render={
159
- <Button
160
- size="small"
161
- icon={ moreVertical }
162
- label={ __( 'Shadow options' ) }
163
- />
164
- }
165
- />
166
- <Menu.Popover>
167
- <Menu.Item onClick={ onReset }>
168
- <Menu.ItemLabel>
169
- { __( 'Remove all custom shadows' ) }
170
- </Menu.ItemLabel>
171
- </Menu.Item>
172
- </Menu.Popover>
173
- </Menu>
174
- ) }
147
+ ) }
148
+ { !! shadows?.length && category === 'custom' && (
149
+ <Menu>
150
+ <Menu.TriggerButton
151
+ render={
152
+ <Button
153
+ size="small"
154
+ icon={ moreVertical }
155
+ label={ __( 'Shadow options' ) }
156
+ />
157
+ }
158
+ />
159
+ <Menu.Popover>
160
+ <Menu.Item onClick={ onReset }>
161
+ <Menu.ItemLabel>
162
+ { __( 'Remove all custom shadows' ) }
163
+ </Menu.ItemLabel>
164
+ </Menu.Item>
165
+ </Menu.Popover>
166
+ </Menu>
167
+ ) }
168
+ </FlexItem>
175
169
  </HStack>
176
170
  { shadows.length > 0 && (
177
171
  <ItemGroup isBordered isSeparated>
@@ -104,7 +104,6 @@
104
104
  flex-shrink: 0;
105
105
  }
106
106
 
107
- .edit-site-global-styles__shadows-panel__title,
108
107
  .edit-site-global-styles__shadows-panel__options-container {
109
108
  height: $grid-unit * 3;
110
109
  }
@@ -44,7 +44,7 @@ import { unlock } from '../../lock-unlock';
44
44
  import SaveKeyboardShortcut from '../save-keyboard-shortcut';
45
45
  import { useIsSiteEditorLoading } from './hooks';
46
46
  import useMovingAnimation from './animation';
47
- import SidebarContent from '../sidebar';
47
+ import { SidebarContent, SidebarNavigationProvider } from '../sidebar';
48
48
  import SaveHub from '../save-hub';
49
49
  import SavePanel from '../save-panel';
50
50
 
@@ -141,16 +141,18 @@ function Layout() {
141
141
  isResizableFrameOversized
142
142
  }
143
143
  />
144
- <SidebarContent
145
- shouldAnimate={
146
- routeKey !== 'styles'
147
- }
148
- routeKey={ routeKey }
149
- >
150
- <ErrorBoundary>
151
- { areas.sidebar }
152
- </ErrorBoundary>
153
- </SidebarContent>
144
+ <SidebarNavigationProvider>
145
+ <SidebarContent
146
+ shouldAnimate={
147
+ routeKey !== 'styles'
148
+ }
149
+ routeKey={ routeKey }
150
+ >
151
+ <ErrorBoundary>
152
+ { areas.sidebar }
153
+ </ErrorBoundary>
154
+ </SidebarContent>
155
+ </SidebarNavigationProvider>
154
156
  <SaveHub />
155
157
  <SavePanel />
156
158
  </motion.div>
@@ -163,17 +165,29 @@ function Layout() {
163
165
 
164
166
  { isMobileViewport && areas.mobile && (
165
167
  <div className="edit-site-layout__mobile">
166
- { canvas !== 'edit' && (
167
- <SidebarContent routeKey={ routeKey }>
168
- <SiteHubMobile
169
- ref={ toggleRef }
170
- isTransparent={
171
- isResizableFrameOversized
172
- }
173
- />
174
- </SidebarContent>
175
- ) }
176
- <ErrorBoundary>{ areas.mobile }</ErrorBoundary>
168
+ <SidebarNavigationProvider>
169
+ { canvas !== 'edit' ? (
170
+ <>
171
+ <SiteHubMobile
172
+ ref={ toggleRef }
173
+ isTransparent={
174
+ isResizableFrameOversized
175
+ }
176
+ />
177
+ <SidebarContent routeKey={ routeKey }>
178
+ <ErrorBoundary>
179
+ { areas.mobile }
180
+ </ErrorBoundary>
181
+ </SidebarContent>
182
+ <SaveHub />
183
+ <SavePanel />
184
+ </>
185
+ ) : (
186
+ <ErrorBoundary>
187
+ { areas.mobile }
188
+ </ErrorBoundary>
189
+ ) }
190
+ </SidebarNavigationProvider>
177
191
  </div>
178
192
  ) }
179
193
 
@@ -56,6 +56,8 @@
56
56
  position: relative;
57
57
  width: 100%;
58
58
  z-index: z-index(".edit-site-layout__canvas-container");
59
+ display: flex;
60
+ flex-direction: column;
59
61
 
60
62
  /*
61
63
  * The SiteHubMobile component is displayed
@@ -1,17 +1,13 @@
1
1
  .edit-site-page {
2
2
  color: $gray-800;
3
3
  background: $white;
4
- height: calc(100% - #{$header-height});
4
+ height: 100%;
5
5
  /* stylelint-disable-next-line property-no-unknown -- '@container' not globally permitted */
6
6
  container: edit-site-page / inline-size;
7
7
 
8
8
  @media not (prefers-reduced-motion) {
9
9
  transition: width ease-out 0.2s;
10
10
  }
11
-
12
- @include break-medium() {
13
- height: 100%;
14
- }
15
11
  }
16
12
 
17
13
  .edit-site-page-header {
@@ -32,7 +32,7 @@ export default function PatternsHeader( {
32
32
  const { patternCategories } = usePatternCategories();
33
33
  const templatePartAreas = useSelect(
34
34
  ( select ) =>
35
- select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
35
+ select( coreStore ).getCurrentTheme()
36
36
  ?.default_template_part_areas || [],
37
37
  []
38
38
  );
@@ -25,8 +25,11 @@ const EMPTY_PATTERN_LIST = [];
25
25
 
26
26
  const selectTemplateParts = createSelector(
27
27
  ( select, categoryId, search = '' ) => {
28
- const { getEntityRecords, isResolving: isResolvingSelector } =
29
- select( coreStore );
28
+ const {
29
+ getEntityRecords,
30
+ getCurrentTheme,
31
+ isResolving: isResolvingSelector,
32
+ } = select( coreStore );
30
33
 
31
34
  const query = { per_page: -1 };
32
35
  const templateParts =
@@ -36,9 +39,7 @@ const selectTemplateParts = createSelector(
36
39
  // In the case where a custom template part area has been removed we need
37
40
  // the current list of areas to cross check against so orphaned template
38
41
  // parts can be treated as uncategorized.
39
- const knownAreas =
40
- select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
41
- ?.default_template_part_areas || [];
42
+ const knownAreas = getCurrentTheme()?.default_template_part_areas || [];
42
43
 
43
44
  const templatePartAreas = knownAreas.map( ( area ) => area.area );
44
45
 
@@ -79,8 +80,7 @@ const selectTemplateParts = createSelector(
79
80
  TEMPLATE_PART_POST_TYPE,
80
81
  { per_page: -1 },
81
82
  ] ),
82
- select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
83
- ?.default_template_part_areas,
83
+ select( coreStore ).getCurrentTheme()?.default_template_part_areas,
84
84
  ]
85
85
  );
86
86
 
@@ -87,23 +87,25 @@ function SidebarContentWrapper( { children, shouldAnimate } ) {
87
87
  );
88
88
  }
89
89
 
90
- export default function SidebarContent( {
91
- routeKey,
92
- shouldAnimate,
93
- children,
94
- } ) {
90
+ export function SidebarNavigationProvider( { children } ) {
95
91
  const [ navState ] = useState( createNavState );
96
92
 
97
93
  return (
98
94
  <SidebarNavigationContext.Provider value={ navState }>
99
- <div className="edit-site-sidebar__content">
100
- <SidebarContentWrapper
101
- shouldAnimate={ shouldAnimate }
102
- key={ routeKey }
103
- >
104
- { children }
105
- </SidebarContentWrapper>
106
- </div>
95
+ { children }
107
96
  </SidebarNavigationContext.Provider>
108
97
  );
109
98
  }
99
+
100
+ export function SidebarContent( { routeKey, shouldAnimate, children } ) {
101
+ return (
102
+ <div className="edit-site-sidebar__content">
103
+ <SidebarContentWrapper
104
+ shouldAnimate={ shouldAnimate }
105
+ key={ routeKey }
106
+ >
107
+ { children }
108
+ </SidebarContentWrapper>
109
+ </div>
110
+ );
111
+ }
@@ -100,7 +100,7 @@ export default function SidebarNavigationScreenMain( { customDescription } ) {
100
100
  );
101
101
  } else {
102
102
  description = __(
103
- 'Explore block styles and patterns to refine your site'
103
+ 'Explore block styles and patterns to refine your site.'
104
104
  );
105
105
  }
106
106
 
@@ -45,47 +45,45 @@ export default function ScreenNavigationMoreMenu( props ) {
45
45
  popoverProps={ POPOVER_PROPS }
46
46
  >
47
47
  { ( { onClose } ) => (
48
- <div>
49
- <MenuGroup>
50
- <MenuItem
51
- onClick={ () => {
52
- openRenameModal();
53
- // Close the dropdown after opening the modal.
54
- onClose();
55
- } }
56
- >
57
- { __( 'Rename' ) }
58
- </MenuItem>
59
- <MenuItem
60
- onClick={ () => {
61
- history.navigate(
62
- `/wp_navigation/${ menuId }?canvas=edit`
63
- );
64
- } }
65
- >
66
- { __( 'Edit' ) }
67
- </MenuItem>
68
- <MenuItem
69
- onClick={ () => {
70
- onDuplicate();
71
- onClose();
72
- } }
73
- >
74
- { __( 'Duplicate' ) }
75
- </MenuItem>
76
- <MenuItem
77
- isDestructive
78
- onClick={ () => {
79
- openDeleteConfirmDialog();
48
+ <MenuGroup>
49
+ <MenuItem
50
+ onClick={ () => {
51
+ openRenameModal();
52
+ // Close the dropdown after opening the modal.
53
+ onClose();
54
+ } }
55
+ >
56
+ { __( 'Rename' ) }
57
+ </MenuItem>
58
+ <MenuItem
59
+ onClick={ () => {
60
+ history.navigate(
61
+ `/wp_navigation/${ menuId }?canvas=edit`
62
+ );
63
+ } }
64
+ >
65
+ { __( 'Edit' ) }
66
+ </MenuItem>
67
+ <MenuItem
68
+ onClick={ () => {
69
+ onDuplicate();
70
+ onClose();
71
+ } }
72
+ >
73
+ { __( 'Duplicate' ) }
74
+ </MenuItem>
75
+ <MenuItem
76
+ isDestructive
77
+ onClick={ () => {
78
+ openDeleteConfirmDialog();
80
79
 
81
- // Close the dropdown after opening the modal.
82
- onClose();
83
- } }
84
- >
85
- { __( 'Delete' ) }
86
- </MenuItem>
87
- </MenuGroup>
88
- </div>
80
+ // Close the dropdown after opening the modal.
81
+ onClose();
82
+ } }
83
+ >
84
+ { __( 'Delete' ) }
85
+ </MenuItem>
86
+ </MenuGroup>
89
87
  ) }
90
88
  </DropdownMenu>
91
89
  { deleteConfirmDialogOpen && (
@@ -120,6 +120,7 @@ export default function SidebarNavigationScreenPatterns( { backPath } ) {
120
120
  description={ __(
121
121
  'Manage what patterns are available when editing the site.'
122
122
  ) }
123
+ isRoot={ ! backPath }
123
124
  backPath={ backPath }
124
125
  content={
125
126
  <>
@@ -17,7 +17,7 @@ const useTemplatePartsGroupedByArea = ( items ) => {
17
17
 
18
18
  const templatePartAreas = useSelect(
19
19
  ( select ) =>
20
- select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
20
+ select( coreStore ).getCurrentTheme()
21
21
  ?.default_template_part_areas || [],
22
22
  []
23
23
  );
@@ -0,0 +1,17 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import { Notice, __experimentalSpacer as Spacer } from '@wordpress/components';
6
+
7
+ export default function SidebarNavigationScreenUnsupported() {
8
+ return (
9
+ <Spacer padding={ 3 }>
10
+ <Notice status="warning" isDismissible={ false }>
11
+ { __(
12
+ 'The theme you are currently using does not support this screen.'
13
+ ) }
14
+ </Notice>
15
+ </Spacer>
16
+ );
17
+ }
@@ -2,14 +2,38 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
5
+ import SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';
5
6
  import Editor from '../editor';
7
+ import { isClassicThemeWithStyleBookSupport } from './utils';
6
8
 
7
9
  export const homeRoute = {
8
10
  name: 'home',
9
11
  path: '/',
10
12
  areas: {
11
- sidebar: <SidebarNavigationScreenMain />,
12
- preview: <Editor isHomeRoute />,
13
- mobile: <SidebarNavigationScreenMain />,
13
+ sidebar( { siteData } ) {
14
+ const isBlockTheme = siteData.currentTheme?.is_block_theme;
15
+ return isBlockTheme ||
16
+ isClassicThemeWithStyleBookSupport( siteData ) ? (
17
+ <SidebarNavigationScreenMain />
18
+ ) : (
19
+ <SidebarNavigationScreenUnsupported />
20
+ );
21
+ },
22
+ preview( { siteData } ) {
23
+ const isBlockTheme = siteData.currentTheme?.is_block_theme;
24
+ return isBlockTheme ||
25
+ isClassicThemeWithStyleBookSupport( siteData ) ? (
26
+ <Editor isHomeRoute />
27
+ ) : undefined;
28
+ },
29
+ mobile( { siteData } ) {
30
+ const isBlockTheme = siteData.currentTheme?.is_block_theme;
31
+ return isBlockTheme ||
32
+ isClassicThemeWithStyleBookSupport( siteData ) ? (
33
+ <SidebarNavigationScreenMain />
34
+ ) : (
35
+ <SidebarNavigationScreenUnsupported />
36
+ );
37
+ },
14
38
  },
15
39
  };
@@ -8,6 +8,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
8
8
  */
9
9
  import Editor from '../editor';
10
10
  import SidebarNavigationScreenNavigationMenu from '../sidebar-navigation-screen-navigation-menu';
11
+ import SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';
11
12
  import { unlock } from '../../lock-unlock';
12
13
 
13
14
  const { useLocation } = unlock( routerPrivateApis );
@@ -27,10 +28,29 @@ export const navigationItemRoute = {
27
28
  name: 'navigation-item',
28
29
  path: '/wp_navigation/:postId',
29
30
  areas: {
30
- sidebar: (
31
- <SidebarNavigationScreenNavigationMenu backPath="/navigation" />
32
- ),
33
- preview: <Editor />,
34
- mobile: <MobileNavigationItemView />,
31
+ sidebar( { siteData } ) {
32
+ const isBlockTheme = siteData.currentTheme?.is_block_theme;
33
+ return isBlockTheme ? (
34
+ <SidebarNavigationScreenNavigationMenu backPath="/navigation" />
35
+ ) : (
36
+ <SidebarNavigationScreenUnsupported />
37
+ );
38
+ },
39
+ preview( { siteData } ) {
40
+ const isBlockTheme = siteData.currentTheme?.is_block_theme;
41
+ return isBlockTheme ? (
42
+ <Editor />
43
+ ) : (
44
+ <SidebarNavigationScreenUnsupported />
45
+ );
46
+ },
47
+ mobile( { siteData } ) {
48
+ const isBlockTheme = siteData.currentTheme?.is_block_theme;
49
+ return isBlockTheme ? (
50
+ <MobileNavigationItemView />
51
+ ) : (
52
+ <SidebarNavigationScreenUnsupported />
53
+ );
54
+ },
35
55
  },
36
56
  };
@@ -8,6 +8,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
8
8
  */
9
9
  import Editor from '../editor';
10
10
  import SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';
11
+ import SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';
11
12
  import { unlock } from '../../lock-unlock';
12
13
 
13
14
  const { useLocation } = unlock( routerPrivateApis );
@@ -27,8 +28,25 @@ export const navigationRoute = {
27
28
  name: 'navigation',
28
29
  path: '/navigation',
29
30
  areas: {
30
- sidebar: <SidebarNavigationScreenNavigationMenus backPath="/" />,
31
- preview: <Editor />,
32
- mobile: <MobileNavigationView />,
31
+ sidebar( { siteData } ) {
32
+ const isBlockTheme = siteData.currentTheme?.is_block_theme;
33
+ return isBlockTheme ? (
34
+ <SidebarNavigationScreenNavigationMenus backPath="/" />
35
+ ) : (
36
+ <SidebarNavigationScreenUnsupported />
37
+ );
38
+ },
39
+ preview( { siteData } ) {
40
+ const isBlockTheme = siteData.currentTheme?.is_block_theme;
41
+ return isBlockTheme ? <Editor /> : undefined;
42
+ },
43
+ mobile( { siteData } ) {
44
+ const isBlockTheme = siteData.currentTheme?.is_block_theme;
45
+ return isBlockTheme ? (
46
+ <MobileNavigationView />
47
+ ) : (
48
+ <SidebarNavigationScreenUnsupported />
49
+ );
50
+ },
33
51
  },
34
52
  };