@wordpress/edit-site 6.2.0 → 6.3.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 (245) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/{add-new-page → add-new-post}/index.js +21 -17
  3. package/build/components/add-new-post/index.js.map +1 -0
  4. package/build/components/block-editor/use-site-editor-settings.js +5 -3
  5. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  6. package/build/components/editor/index.js +21 -3
  7. package/build/components/editor/index.js.map +1 -1
  8. package/build/components/global-styles/background-panel.js +0 -5
  9. package/build/components/global-styles/background-panel.js.map +1 -1
  10. package/build/components/global-styles/font-library-modal/font-collection.js +13 -30
  11. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  12. package/build/components/global-styles/font-library-modal/installed-fonts.js +2 -2
  13. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  14. package/build/components/global-styles/hooks.js +0 -40
  15. package/build/components/global-styles/hooks.js.map +1 -1
  16. package/build/components/global-styles/preview-typography.js +47 -0
  17. package/build/components/global-styles/preview-typography.js.map +1 -0
  18. package/build/components/global-styles/screen-block.js +14 -0
  19. package/build/components/global-styles/screen-block.js.map +1 -1
  20. package/build/components/global-styles/screen-layout.js +5 -1
  21. package/build/components/global-styles/screen-layout.js.map +1 -1
  22. package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  23. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  24. package/build/components/global-styles/shadows-edit-panel.js +1 -2
  25. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  26. package/build/components/global-styles/style-variations-container.js +5 -5
  27. package/build/components/global-styles/style-variations-container.js.map +1 -1
  28. package/build/components/global-styles/typography-elements.js +0 -2
  29. package/build/components/global-styles/typography-elements.js.map +1 -1
  30. package/build/components/global-styles/variations/variation.js +4 -4
  31. package/build/components/global-styles/variations/variation.js.map +1 -1
  32. package/build/components/global-styles/variations/variations-color.js +4 -3
  33. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  34. package/build/components/global-styles/variations/variations-typography.js +14 -28
  35. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  36. package/build/components/global-styles-sidebar/index.js +2 -2
  37. package/build/components/global-styles-sidebar/index.js.map +1 -1
  38. package/build/components/layout/index.js +16 -8
  39. package/build/components/layout/index.js.map +1 -1
  40. package/build/components/layout/router.js +20 -41
  41. package/build/components/layout/router.js.map +1 -1
  42. package/build/components/page-patterns/index.js +43 -39
  43. package/build/components/page-patterns/index.js.map +1 -1
  44. package/build/components/page-patterns/search-items.js +29 -4
  45. package/build/components/page-patterns/search-items.js.map +1 -1
  46. package/build/components/page-patterns/use-patterns.js +22 -55
  47. package/build/components/page-patterns/use-patterns.js.map +1 -1
  48. package/build/components/page-templates/index.js +18 -19
  49. package/build/components/page-templates/index.js.map +1 -1
  50. package/build/components/pagination/index.js +4 -4
  51. package/build/components/pagination/index.js.map +1 -1
  52. package/build/components/posts-app/index.js +11 -17
  53. package/build/components/posts-app/index.js.map +1 -1
  54. package/build/components/{page-pages/index.js → posts-app/posts-list.js} +135 -40
  55. package/build/components/posts-app/posts-list.js.map +1 -0
  56. package/build/components/posts-app/router.js +85 -0
  57. package/build/components/posts-app/router.js.map +1 -0
  58. package/build/components/revisions/index.js +10 -7
  59. package/build/components/revisions/index.js.map +1 -1
  60. package/build/components/save-panel/index.js +1 -1
  61. package/build/components/save-panel/index.js.map +1 -1
  62. package/build/components/sidebar-dataviews/add-new-view.js +4 -1
  63. package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
  64. package/build/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
  65. package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  66. package/build/components/sidebar-dataviews/default-views.js +98 -84
  67. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  68. package/build/components/sidebar-dataviews/index.js +4 -1
  69. package/build/components/sidebar-dataviews/index.js.map +1 -1
  70. package/build/components/sidebar-navigation-screen-global-styles/index.js +3 -3
  71. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  72. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -2
  73. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  74. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
  75. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  76. package/build/components/site-hub/index.js +81 -1
  77. package/build/components/site-hub/index.js.map +1 -1
  78. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
  79. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  80. package/build/hooks/push-changes-to-global-styles/index.js +1 -1
  81. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  82. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +65 -42
  83. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  84. package/build/index.js +6 -0
  85. package/build/index.js.map +1 -1
  86. package/build/posts.js +57 -2
  87. package/build/posts.js.map +1 -1
  88. package/build/store/private-actions.js +7 -2
  89. package/build/store/private-actions.js.map +1 -1
  90. package/build-module/components/{add-new-page → add-new-post}/index.js +21 -17
  91. package/build-module/components/add-new-post/index.js.map +1 -0
  92. package/build-module/components/block-editor/use-site-editor-settings.js +5 -3
  93. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  94. package/build-module/components/editor/index.js +21 -3
  95. package/build-module/components/editor/index.js.map +1 -1
  96. package/build-module/components/global-styles/background-panel.js +0 -5
  97. package/build-module/components/global-styles/background-panel.js.map +1 -1
  98. package/build-module/components/global-styles/font-library-modal/font-collection.js +14 -31
  99. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  100. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +2 -2
  101. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  102. package/build-module/components/global-styles/hooks.js +0 -38
  103. package/build-module/components/global-styles/hooks.js.map +1 -1
  104. package/build-module/components/global-styles/preview-typography.js +39 -0
  105. package/build-module/components/global-styles/preview-typography.js.map +1 -0
  106. package/build-module/components/global-styles/screen-block.js +15 -0
  107. package/build-module/components/global-styles/screen-block.js.map +1 -1
  108. package/build-module/components/global-styles/screen-layout.js +5 -1
  109. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  110. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  111. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  112. package/build-module/components/global-styles/shadows-edit-panel.js +1 -2
  113. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  114. package/build-module/components/global-styles/style-variations-container.js +6 -6
  115. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  116. package/build-module/components/global-styles/typography-elements.js +0 -2
  117. package/build-module/components/global-styles/typography-elements.js.map +1 -1
  118. package/build-module/components/global-styles/variations/variation.js +5 -5
  119. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  120. package/build-module/components/global-styles/variations/variations-color.js +4 -3
  121. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  122. package/build-module/components/global-styles/variations/variations-typography.js +16 -29
  123. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  124. package/build-module/components/global-styles-sidebar/index.js +2 -2
  125. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  126. package/build-module/components/layout/index.js +14 -8
  127. package/build-module/components/layout/index.js.map +1 -1
  128. package/build-module/components/layout/router.js +20 -41
  129. package/build-module/components/layout/router.js.map +1 -1
  130. package/build-module/components/page-patterns/index.js +44 -40
  131. package/build-module/components/page-patterns/index.js.map +1 -1
  132. package/build-module/components/page-patterns/search-items.js +28 -4
  133. package/build-module/components/page-patterns/search-items.js.map +1 -1
  134. package/build-module/components/page-patterns/use-patterns.js +23 -56
  135. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  136. package/build-module/components/page-templates/index.js +18 -19
  137. package/build-module/components/page-templates/index.js.map +1 -1
  138. package/build-module/components/pagination/index.js +4 -4
  139. package/build-module/components/pagination/index.js.map +1 -1
  140. package/build-module/components/posts-app/index.js +11 -17
  141. package/build-module/components/posts-app/index.js.map +1 -1
  142. package/build-module/components/{page-pages/index.js → posts-app/posts-list.js} +134 -39
  143. package/build-module/components/posts-app/posts-list.js.map +1 -0
  144. package/build-module/components/posts-app/router.js +77 -0
  145. package/build-module/components/posts-app/router.js.map +1 -0
  146. package/build-module/components/revisions/index.js +10 -7
  147. package/build-module/components/revisions/index.js.map +1 -1
  148. package/build-module/components/save-panel/index.js +1 -1
  149. package/build-module/components/save-panel/index.js.map +1 -1
  150. package/build-module/components/sidebar-dataviews/add-new-view.js +4 -1
  151. package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
  152. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
  153. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  154. package/build-module/components/sidebar-dataviews/default-views.js +96 -83
  155. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  156. package/build-module/components/sidebar-dataviews/index.js +5 -2
  157. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  158. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +3 -3
  159. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  160. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -2
  161. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  162. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
  163. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  164. package/build-module/components/site-hub/index.js +81 -1
  165. package/build-module/components/site-hub/index.js.map +1 -1
  166. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
  167. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  168. package/build-module/hooks/push-changes-to-global-styles/index.js +1 -1
  169. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  170. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +61 -38
  171. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  172. package/build-module/index.js +7 -2
  173. package/build-module/index.js.map +1 -1
  174. package/build-module/posts.js +57 -2
  175. package/build-module/posts.js.map +1 -1
  176. package/build-module/store/private-actions.js +7 -2
  177. package/build-module/store/private-actions.js.map +1 -1
  178. package/build-style/posts-rtl.css +108 -28
  179. package/build-style/posts.css +108 -28
  180. package/build-style/style-rtl.css +112 -144
  181. package/build-style/style.css +112 -144
  182. package/package.json +41 -41
  183. package/src/components/{add-new-page → add-new-post}/index.js +28 -22
  184. package/src/components/block-editor/use-site-editor-settings.js +33 -28
  185. package/src/components/editor/index.js +21 -5
  186. package/src/components/global-styles/background-panel.js +0 -8
  187. package/src/components/global-styles/font-library-modal/font-collection.js +17 -32
  188. package/src/components/global-styles/font-library-modal/installed-fonts.js +2 -2
  189. package/src/components/global-styles/font-library-modal/style.scss +17 -10
  190. package/src/components/global-styles/hooks.js +0 -41
  191. package/src/components/global-styles/preview-typography.js +39 -0
  192. package/src/components/global-styles/screen-block.js +22 -0
  193. package/src/components/global-styles/screen-layout.js +5 -1
  194. package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  195. package/src/components/global-styles/shadows-edit-panel.js +1 -2
  196. package/src/components/global-styles/style-variations-container.js +10 -7
  197. package/src/components/global-styles/typography-elements.js +0 -4
  198. package/src/components/global-styles/variations/variation.js +5 -5
  199. package/src/components/global-styles/variations/variations-color.js +5 -3
  200. package/src/components/global-styles/variations/variations-typography.js +15 -32
  201. package/src/components/global-styles-sidebar/index.js +2 -2
  202. package/src/components/layout/index.js +13 -4
  203. package/src/components/layout/router.js +20 -36
  204. package/src/components/layout/style.scss +12 -0
  205. package/src/components/page-patterns/index.js +47 -56
  206. package/src/components/page-patterns/search-items.js +37 -3
  207. package/src/components/page-patterns/style.scss +1 -8
  208. package/src/components/page-patterns/use-patterns.js +43 -82
  209. package/src/components/page-templates/index.js +17 -19
  210. package/src/components/page-templates/style.scss +1 -6
  211. package/src/components/pagination/index.js +4 -4
  212. package/src/components/posts-app/index.js +9 -11
  213. package/src/components/{page-pages/index.js → posts-app/posts-list.js} +126 -39
  214. package/src/components/posts-app/router.js +69 -0
  215. package/src/components/{page-pages → posts-app}/style.scss +22 -8
  216. package/src/components/revisions/index.js +9 -1
  217. package/src/components/save-panel/index.js +1 -1
  218. package/src/components/sidebar/style.scss +6 -0
  219. package/src/components/sidebar-dataviews/add-new-view.js +2 -1
  220. package/src/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
  221. package/src/components/sidebar-dataviews/default-views.js +110 -97
  222. package/src/components/sidebar-dataviews/index.js +3 -3
  223. package/src/components/sidebar-navigation-screen-global-styles/index.js +7 -6
  224. package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -1
  225. package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -2
  226. package/src/components/site-hub/index.js +84 -1
  227. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -2
  228. package/src/hooks/push-changes-to-global-styles/index.js +1 -1
  229. package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +28 -24
  230. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +72 -47
  231. package/src/index.js +8 -1
  232. package/src/posts.js +63 -2
  233. package/src/posts.scss +9 -0
  234. package/src/store/private-actions.js +7 -3
  235. package/src/style.scss +1 -2
  236. package/build/components/add-new-page/index.js.map +0 -1
  237. package/build/components/page-pages/index.js.map +0 -1
  238. package/build/components/table/index.js +0 -35
  239. package/build/components/table/index.js.map +0 -1
  240. package/build-module/components/add-new-page/index.js.map +0 -1
  241. package/build-module/components/page-pages/index.js.map +0 -1
  242. package/build-module/components/table/index.js +0 -30
  243. package/build-module/components/table/index.js.map +0 -1
  244. package/src/components/table/index.js +0 -33
  245. package/src/components/table/style.scss +0 -38
@@ -3,21 +3,22 @@
3
3
  */
4
4
  import {
5
5
  __experimentalGrid as Grid,
6
- __experimentalVStack as HStack,
7
6
  __experimentalVStack as VStack,
8
7
  } from '@wordpress/components';
9
8
 
10
9
  /**
11
10
  * Internal dependencies
12
11
  */
13
- import { useTypographyVariations } from '../hooks';
14
- import TypographyExample from '../typography-example';
15
- import PreviewIframe from '../preview-iframe';
12
+
13
+ import StylesPreviewTypography from '../preview-typography';
14
+ import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
16
15
  import Variation from './variation';
17
16
  import Subtitle from '../subtitle';
18
17
 
19
18
  export default function TypographyVariations( { title, gap = 2 } ) {
20
- const typographyVariations = useTypographyVariations();
19
+ const propertiesToFilter = [ 'typography' ];
20
+ const typographyVariations =
21
+ useCurrentMergeThemeStyleVariationsWithUserConfig( propertiesToFilter );
21
22
 
22
23
  // Return null if there is only one variation (the default).
23
24
  if ( typographyVariations?.length <= 1 ) {
@@ -32,40 +33,22 @@ export default function TypographyVariations( { title, gap = 2 } ) {
32
33
  gap={ gap }
33
34
  className="edit-site-global-styles-style-variations-container"
34
35
  >
35
- { typographyVariations &&
36
- typographyVariations.length &&
37
- typographyVariations.map( ( variation, index ) => (
36
+ { typographyVariations.map( ( variation, index ) => {
37
+ return (
38
38
  <Variation
39
39
  key={ index }
40
40
  variation={ variation }
41
- property="typography"
41
+ properties={ propertiesToFilter }
42
42
  showTooltip
43
43
  >
44
- { ( isFocused ) => (
45
- <PreviewIframe
46
- label={ variation?.title }
47
- isFocused={ isFocused }
48
- >
49
- { ( { ratio, key } ) => (
50
- <HStack
51
- key={ key }
52
- spacing={ 10 * ratio }
53
- justify="center"
54
- style={ {
55
- height: '100%',
56
- overflow: 'hidden',
57
- } }
58
- >
59
- <TypographyExample
60
- variation={ variation }
61
- fontSize={ 85 * ratio }
62
- />
63
- </HStack>
64
- ) }
65
- </PreviewIframe>
44
+ { () => (
45
+ <StylesPreviewTypography
46
+ variation={ variation }
47
+ />
66
48
  ) }
67
49
  </Variation>
68
- ) ) }
50
+ );
51
+ } ) }
69
52
  </Grid>
70
53
  </VStack>
71
54
  );
@@ -152,7 +152,7 @@ export default function GlobalStylesSidebar() {
152
152
  isPressed={
153
153
  isStyleBookOpened || isRevisionsStyleBookOpened
154
154
  }
155
- __experimentalIsFocusable
155
+ accessibleWhenDisabled
156
156
  disabled={ shouldClearCanvasContainerView }
157
157
  onClick={ toggleStyleBook }
158
158
  size="compact"
@@ -163,7 +163,7 @@ export default function GlobalStylesSidebar() {
163
163
  label={ __( 'Revisions' ) }
164
164
  icon={ backup }
165
165
  onClick={ toggleRevisions }
166
- __experimentalIsFocusable
166
+ accessibleWhenDisabled
167
167
  disabled={ ! hasRevisions }
168
168
  isPressed={
169
169
  isRevisionsOpened || isRevisionsStyleBookOpened
@@ -34,16 +34,16 @@ import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands
34
34
  */
35
35
  import ErrorBoundary from '../error-boundary';
36
36
  import { store as editSiteStore } from '../../store';
37
- import SiteHub from '../site-hub';
37
+ import { default as SiteHub, SiteHubMobile } from '../site-hub';
38
38
  import ResizableFrame from '../resizable-frame';
39
39
  import { unlock } from '../../lock-unlock';
40
- import SavePanel from '../save-panel';
41
40
  import KeyboardShortcutsRegister from '../keyboard-shortcuts/register';
42
41
  import KeyboardShortcutsGlobal from '../keyboard-shortcuts/global';
43
42
  import { useIsSiteEditorLoading } from './hooks';
44
43
  import useMovingAnimation from './animation';
45
44
  import SidebarContent from '../sidebar';
46
45
  import SaveHub from '../save-hub';
46
+ import SavePanel from '../save-panel';
47
47
  import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
48
48
 
49
49
  const { useCommands } = unlock( coreCommandsPrivateApis );
@@ -163,6 +163,7 @@ export default function Layout( { route } ) {
163
163
  { areas.sidebar }
164
164
  </SidebarContent>
165
165
  <SaveHub />
166
+ <SavePanel />
166
167
  </motion.div>
167
168
  ) }
168
169
  </AnimatePresence>
@@ -173,6 +174,16 @@ export default function Layout( { route } ) {
173
174
 
174
175
  { isMobileViewport && areas.mobile && (
175
176
  <div className="edit-site-layout__mobile">
177
+ { canvasMode !== 'edit' && (
178
+ <SidebarContent routeKey={ routeKey }>
179
+ <SiteHubMobile
180
+ ref={ toggleRef }
181
+ isTransparent={
182
+ isResizableFrameOversized
183
+ }
184
+ />
185
+ </SidebarContent>
186
+ ) }
176
187
  { areas.mobile }
177
188
  </div>
178
189
  ) }
@@ -236,8 +247,6 @@ export default function Layout( { route } ) {
236
247
  </div>
237
248
  ) }
238
249
  </div>
239
-
240
- <SavePanel />
241
250
  </div>
242
251
  </>
243
252
  );
@@ -8,9 +8,8 @@ import { useEffect } from '@wordpress/element';
8
8
  * Internal dependencies
9
9
  */
10
10
  import { unlock } from '../../lock-unlock';
11
- import { useIsSiteEditorLoading } from './hooks';
12
11
  import Editor from '../editor';
13
- import PagePages from '../page-pages';
12
+ import PostsList from '../posts-app/posts-list';
14
13
  import PagePatterns from '../page-patterns';
15
14
  import PageTemplates from '../page-templates';
16
15
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
@@ -74,9 +73,9 @@ function useRedirectOldPaths() {
74
73
  }
75
74
 
76
75
  export default function useLayoutAreas() {
77
- const isSiteEditorLoading = useIsSiteEditorLoading();
78
76
  const { params } = useLocation();
79
77
  const { postType, postId, path, layout, isCustom, canvas } = params;
78
+ const hasEditCanvasMode = canvas === 'edit';
80
79
  useRedirectOldPaths();
81
80
 
82
81
  // Page list
@@ -92,16 +91,13 @@ export default function useLayoutAreas() {
92
91
  content={ <DataViewsSidebarContent /> }
93
92
  />
94
93
  ),
95
- content: <PagePages />,
96
- preview: ( isListLayout || canvas === 'edit' ) && (
97
- <Editor isLoading={ isSiteEditorLoading } />
94
+ content: <PostsList postType={ postType } />,
95
+ preview: ( isListLayout || hasEditCanvasMode ) && <Editor />,
96
+ mobile: hasEditCanvasMode ? (
97
+ <Editor />
98
+ ) : (
99
+ <PostsList postType={ postType } />
98
100
  ),
99
- mobile:
100
- canvas === 'edit' ? (
101
- <Editor isLoading={ isSiteEditorLoading } />
102
- ) : (
103
- <PagePages />
104
- ),
105
101
  },
106
102
  widths: {
107
103
  content: isListLayout ? 380 : undefined,
@@ -119,10 +115,8 @@ export default function useLayoutAreas() {
119
115
  <SidebarNavigationScreenTemplatesBrowse backPath={ {} } />
120
116
  ),
121
117
  content: <PageTemplates />,
122
- preview: ( isListLayout || canvas === 'edit' ) && (
123
- <Editor isLoading={ isSiteEditorLoading } />
124
- ),
125
- mobile: <PageTemplates />,
118
+ preview: ( isListLayout || hasEditCanvasMode ) && <Editor />,
119
+ mobile: hasEditCanvasMode ? <Editor /> : <PageTemplates />,
126
120
  },
127
121
  widths: {
128
122
  content: isListLayout ? 380 : undefined,
@@ -139,10 +133,8 @@ export default function useLayoutAreas() {
139
133
  areas: {
140
134
  sidebar: <SidebarNavigationScreenPatterns backPath={ {} } />,
141
135
  content: <PagePatterns />,
142
- mobile: <PagePatterns />,
143
- preview: canvas === 'edit' && (
144
- <Editor isLoading={ isSiteEditorLoading } />
145
- ),
136
+ mobile: hasEditCanvasMode ? <Editor /> : <PagePatterns />,
137
+ preview: hasEditCanvasMode && <Editor />,
146
138
  },
147
139
  };
148
140
  }
@@ -155,10 +147,8 @@ export default function useLayoutAreas() {
155
147
  sidebar: (
156
148
  <SidebarNavigationScreenGlobalStyles backPath={ {} } />
157
149
  ),
158
- preview: <Editor isLoading={ isSiteEditorLoading } />,
159
- mobile: canvas === 'edit' && (
160
- <Editor isLoading={ isSiteEditorLoading } />
161
- ),
150
+ preview: <Editor />,
151
+ mobile: hasEditCanvasMode && <Editor />,
162
152
  },
163
153
  };
164
154
  }
@@ -174,10 +164,8 @@ export default function useLayoutAreas() {
174
164
  backPath={ { postType: NAVIGATION_POST_TYPE } }
175
165
  />
176
166
  ),
177
- preview: <Editor isLoading={ isSiteEditorLoading } />,
178
- mobile: canvas === 'edit' && (
179
- <Editor isLoading={ isSiteEditorLoading } />
180
- ),
167
+ preview: <Editor />,
168
+ mobile: hasEditCanvasMode && <Editor />,
181
169
  },
182
170
  };
183
171
  }
@@ -187,10 +175,8 @@ export default function useLayoutAreas() {
187
175
  sidebar: (
188
176
  <SidebarNavigationScreenNavigationMenus backPath={ {} } />
189
177
  ),
190
- preview: <Editor isLoading={ isSiteEditorLoading } />,
191
- mobile: canvas === 'edit' && (
192
- <Editor isLoading={ isSiteEditorLoading } />
193
- ),
178
+ preview: <Editor />,
179
+ mobile: hasEditCanvasMode && <Editor />,
194
180
  },
195
181
  };
196
182
  }
@@ -200,10 +186,8 @@ export default function useLayoutAreas() {
200
186
  key: 'default',
201
187
  areas: {
202
188
  sidebar: <SidebarNavigationScreenMain />,
203
- preview: <Editor isLoading={ isSiteEditorLoading } />,
204
- mobile: canvas === 'edit' && (
205
- <Editor isLoading={ isSiteEditorLoading } />
206
- ),
189
+ preview: <Editor />,
190
+ mobile: hasEditCanvasMode && <Editor />,
207
191
  },
208
192
  };
209
193
  }
@@ -56,6 +56,18 @@
56
56
  position: relative;
57
57
  width: 100%;
58
58
  z-index: z-index(".edit-site-layout__canvas-container");
59
+
60
+ /*
61
+ * The SiteHubMobile component is displayed
62
+ * for pages that do not have a sidebar,
63
+ * yet it needs the Sidebar component for the React context.
64
+ *
65
+ * This removes the padding in this scenario.
66
+ * See https://github.com/WordPress/gutenberg/pull/63118
67
+ */
68
+ .edit-site-sidebar__screen-wrapper {
69
+ padding: 0;
70
+ }
59
71
  }
60
72
 
61
73
  .edit-site-layout__canvas-container {
@@ -13,13 +13,7 @@ import {
13
13
  Flex,
14
14
  } from '@wordpress/components';
15
15
  import { __, _x } from '@wordpress/i18n';
16
- import {
17
- useState,
18
- useMemo,
19
- useCallback,
20
- useId,
21
- useEffect,
22
- } from '@wordpress/element';
16
+ import { useState, useMemo, useId, useEffect } from '@wordpress/element';
23
17
  import {
24
18
  BlockPreview,
25
19
  privateApis as blockEditorPrivateApis,
@@ -30,6 +24,8 @@ import { usePrevious } from '@wordpress/compose';
30
24
  import { useEntityRecords } from '@wordpress/core-data';
31
25
  import { privateApis as editorPrivateApis } from '@wordpress/editor';
32
26
  import { privateApis as routerPrivateApis } from '@wordpress/router';
27
+ import { parse } from '@wordpress/blocks';
28
+ import { decodeEntities } from '@wordpress/html-entities';
33
29
 
34
30
  /**
35
31
  * Internal dependencies
@@ -53,6 +49,7 @@ import PatternsHeader from './header';
53
49
  import { useLink } from '../routes/link';
54
50
  import { useAddedBy } from '../page-templates/hooks';
55
51
  import { useEditPostAction } from '../dataviews-actions';
52
+ import { defaultGetTitle } from './search-items';
56
53
 
57
54
  const { ExperimentalBlockEditorProvider, useGlobalStyle } = unlock(
58
55
  blockEditorPrivateApis
@@ -61,14 +58,18 @@ const { usePostActions } = unlock( editorPrivateApis );
61
58
  const { useLocation } = unlock( routerPrivateApis );
62
59
 
63
60
  const EMPTY_ARRAY = [];
64
- const defaultConfigPerViewType = {
61
+ const defaultLayouts = {
65
62
  [ LAYOUT_TABLE ]: {
66
- primaryField: 'title',
63
+ layout: {
64
+ primaryField: 'title',
65
+ },
67
66
  },
68
67
  [ LAYOUT_GRID ]: {
69
- mediaField: 'preview',
70
- primaryField: 'title',
71
- badgeFields: [ 'sync-status' ],
68
+ layout: {
69
+ mediaField: 'preview',
70
+ primaryField: 'title',
71
+ badgeFields: [ 'sync-status' ],
72
+ },
72
73
  },
73
74
  };
74
75
  const DEFAULT_VIEW = {
@@ -76,10 +77,8 @@ const DEFAULT_VIEW = {
76
77
  search: '',
77
78
  page: 1,
78
79
  perPage: 20,
79
- hiddenFields: [],
80
- layout: {
81
- ...defaultConfigPerViewType[ LAYOUT_GRID ],
82
- },
80
+ layout: defaultLayouts[ LAYOUT_GRID ].layout,
81
+ fields: [ 'title', 'sync-status' ],
83
82
  filters: [],
84
83
  };
85
84
 
@@ -115,16 +114,24 @@ function PreviewWrapper( { item, onClick, ariaDescribedBy, children } ) {
115
114
 
116
115
  function Preview( { item, viewType } ) {
117
116
  const descriptionId = useId();
117
+ const description = item.description || item?.excerpt?.raw;
118
118
  const isUserPattern = item.type === PATTERN_TYPES.user;
119
119
  const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
120
- const isEmpty = ! item.blocks?.length;
121
-
122
120
  const [ backgroundColor ] = useGlobalStyle( 'color.background' );
123
121
  const { onClick } = useLink( {
124
122
  postType: item.type,
125
- postId: isUserPattern ? item.id : item.name,
123
+ postId: isUserPattern || isTemplatePart ? item.id : item.name,
126
124
  canvas: 'edit',
127
125
  } );
126
+ const blocks = useMemo( () => {
127
+ return (
128
+ item.blocks ??
129
+ parse( item.content.raw, {
130
+ __unstableSkipMigrationLogs: true,
131
+ } )
132
+ );
133
+ }, [ item?.content?.raw, item.blocks ] );
134
+ const isEmpty = ! blocks?.length;
128
135
 
129
136
  return (
130
137
  <div
@@ -134,22 +141,22 @@ function Preview( { item, viewType } ) {
134
141
  <PreviewWrapper
135
142
  item={ item }
136
143
  onClick={ onClick }
137
- ariaDescribedBy={ item.description ? descriptionId : undefined }
144
+ ariaDescribedBy={ !! description ? descriptionId : undefined }
138
145
  >
139
146
  { isEmpty && isTemplatePart && __( 'Empty template part' ) }
140
147
  { isEmpty && ! isTemplatePart && __( 'Empty pattern' ) }
141
148
  { ! isEmpty && (
142
149
  <Async>
143
150
  <BlockPreview
144
- blocks={ item.blocks }
151
+ blocks={ blocks }
145
152
  viewportWidth={ item.viewportWidth }
146
153
  />
147
154
  </Async>
148
155
  ) }
149
156
  </PreviewWrapper>
150
- { item.description && (
157
+ { !! description && (
151
158
  <div hidden id={ descriptionId }>
152
- { item.description }
159
+ { description }
153
160
  </div>
154
161
  ) }
155
162
  </div>
@@ -188,11 +195,13 @@ function Author( { item, viewType } ) {
188
195
 
189
196
  function Title( { item } ) {
190
197
  const isUserPattern = item.type === PATTERN_TYPES.user;
198
+ const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
191
199
  const { onClick } = useLink( {
192
200
  postType: item.type,
193
- postId: isUserPattern ? item.id : item.name,
201
+ postId: isUserPattern || isTemplatePart ? item.id : item.name,
194
202
  canvas: 'edit',
195
203
  } );
204
+ const title = decodeEntities( defaultGetTitle( item ) );
196
205
  return (
197
206
  <HStack alignment="center" justify="flex-start" spacing={ 2 }>
198
207
  <Flex
@@ -202,7 +211,7 @@ function Title( { item } ) {
202
211
  className="edit-site-patterns__pattern-title"
203
212
  >
204
213
  { item.type === PATTERN_TYPES.theme ? (
205
- item.title
214
+ title
206
215
  ) : (
207
216
  <Button
208
217
  variant="link"
@@ -211,7 +220,7 @@ function Title( { item } ) {
211
220
  // See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243.
212
221
  tabIndex="-1"
213
222
  >
214
- { item.title || item.name }
223
+ { title }
215
224
  </Button>
216
225
  ) }
217
226
  </Flex>
@@ -273,7 +282,6 @@ export default function DataviewsPatterns() {
273
282
  <Preview item={ item } viewType={ view.type } />
274
283
  ),
275
284
  enableSorting: false,
276
- enableHiding: false,
277
285
  width: '1%',
278
286
  },
279
287
  {
@@ -289,23 +297,20 @@ export default function DataviewsPatterns() {
289
297
  header: __( 'Sync status' ),
290
298
  id: 'sync-status',
291
299
  render: ( { item } ) => {
300
+ const syncStatus =
301
+ 'wp_pattern_sync_status' in item
302
+ ? item.wp_pattern_sync_status ||
303
+ PATTERN_SYNC_TYPES.full
304
+ : PATTERN_SYNC_TYPES.unsynced;
292
305
  // User patterns can have their sync statuses checked directly.
293
306
  // Non-user patterns are all unsynced for the time being.
294
307
  return (
295
308
  <span
296
- className={ `edit-site-patterns__field-sync-status-${ item.syncStatus }` }
309
+ className={ `edit-site-patterns__field-sync-status-${ syncStatus }` }
297
310
  >
298
311
  {
299
- (
300
- SYNC_FILTERS.find(
301
- ( { value } ) =>
302
- value === item.syncStatus
303
- ) ||
304
- SYNC_FILTERS.find(
305
- ( { value } ) =>
306
- value ===
307
- PATTERN_SYNC_TYPES.unsynced
308
- )
312
+ SYNC_FILTERS.find(
313
+ ( { value } ) => value === syncStatus
309
314
  ).label
310
315
  }
311
316
  </span>
@@ -322,7 +327,7 @@ export default function DataviewsPatterns() {
322
327
  _fields.push( {
323
328
  header: __( 'Author' ),
324
329
  id: 'author',
325
- getValue: ( { item } ) => item.templatePart.author_text,
330
+ getValue: ( { item } ) => item.author_text,
326
331
  render: ( { item } ) => {
327
332
  return <Author viewType={ view.type } item={ item } />;
328
333
  },
@@ -370,20 +375,6 @@ export default function DataviewsPatterns() {
370
375
  }
371
376
  return [ editAction, ...patternActions ].filter( Boolean );
372
377
  }, [ editAction, type, templatePartActions, patternActions ] );
373
- const onChangeView = useCallback(
374
- ( newView ) => {
375
- if ( newView.type !== view.type ) {
376
- newView = {
377
- ...newView,
378
- layout: {
379
- ...defaultConfigPerViewType[ newView.type ],
380
- },
381
- };
382
- }
383
- setView( newView );
384
- },
385
- [ view.type, setView ]
386
- );
387
378
  const id = useId();
388
379
  const settings = usePatternSettings();
389
380
  // Wrap everything in a block editor provider.
@@ -407,11 +398,11 @@ export default function DataviewsPatterns() {
407
398
  fields={ fields }
408
399
  actions={ actions }
409
400
  data={ data || EMPTY_ARRAY }
410
- getItemId={ ( item ) => item.name }
401
+ getItemId={ ( item ) => item.name ?? item.id }
411
402
  isLoading={ isResolving }
412
403
  view={ view }
413
- onChangeView={ onChangeView }
414
- supportedLayouts={ [ LAYOUT_GRID, LAYOUT_TABLE ] }
404
+ onChangeView={ setView }
405
+ defaultLayouts={ defaultLayouts }
415
406
  />
416
407
  </Page>
417
408
  </ExperimentalBlockEditorProvider>
@@ -20,12 +20,46 @@ import {
20
20
  PATTERN_DEFAULT_CATEGORY,
21
21
  PATTERN_USER_CATEGORY,
22
22
  PATTERN_TYPES,
23
+ TEMPLATE_PART_POST_TYPE,
23
24
  } from '../../utils/constants';
24
25
 
25
26
  // Default search helpers.
26
- const defaultGetName = ( item ) => item.name || '';
27
- const defaultGetTitle = ( item ) => item.title;
28
- const defaultGetDescription = ( item ) => item.description || '';
27
+ const defaultGetName = ( item ) => {
28
+ if ( item.type === PATTERN_TYPES.user ) {
29
+ return item.slug;
30
+ }
31
+
32
+ if ( item.type === TEMPLATE_PART_POST_TYPE ) {
33
+ return '';
34
+ }
35
+
36
+ return item.name || '';
37
+ };
38
+
39
+ export const defaultGetTitle = ( item ) => {
40
+ if ( typeof item.title === 'string' ) {
41
+ return item.title;
42
+ }
43
+
44
+ if ( item.title && item.title.rendered ) {
45
+ return item.title.rendered;
46
+ }
47
+
48
+ if ( item.title && item.title.raw ) {
49
+ return item.title.raw;
50
+ }
51
+
52
+ return '';
53
+ };
54
+
55
+ const defaultGetDescription = ( item ) => {
56
+ if ( item.type === PATTERN_TYPES.user ) {
57
+ return item.excerpt.raw;
58
+ }
59
+
60
+ return item.description || '';
61
+ };
62
+
29
63
  const defaultGetKeywords = ( item ) => item.keywords || [];
30
64
  const defaultHasCategory = () => false;
31
65
 
@@ -35,13 +35,6 @@
35
35
  display: flex;
36
36
  flex-direction: column;
37
37
  height: 100%;
38
- border-radius: 3px 3px 0 0;
39
-
40
- &.is-viewtype-grid {
41
- .block-editor-block-preview__container {
42
- border-radius: 3px 3px 0 0;
43
- }
44
- }
45
38
 
46
39
  &.is-viewtype-table {
47
40
  width: 96px;
@@ -62,7 +55,7 @@
62
55
  cursor: pointer;
63
56
  overflow: hidden;
64
57
  height: 100%;
65
- border-radius: 3px 3px 0 0;
58
+ border-radius: $grid-unit-05;
66
59
 
67
60
  &:focus-visible {
68
61
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);