@wordpress/edit-site 5.15.0 → 5.16.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 (229) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-pattern/index.js +2 -1
  3. package/build/components/add-new-pattern/index.js.map +1 -1
  4. package/build/components/block-editor/use-site-editor-settings.js +29 -2
  5. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  6. package/build/components/editor/index.js +4 -4
  7. package/build/components/editor/index.js.map +1 -1
  8. package/build/components/global-styles/global-styles-provider.js +12 -7
  9. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  10. package/build/components/global-styles/screen-block.js +16 -0
  11. package/build/components/global-styles/screen-block.js.map +1 -1
  12. package/build/components/global-styles/screen-revisions/index.js +12 -5
  13. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  14. package/build/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
  15. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  16. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +32 -25
  17. package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  18. package/build/components/global-styles/style-variations-container.js +5 -3
  19. package/build/components/global-styles/style-variations-container.js.map +1 -1
  20. package/build/components/header-edit-mode/document-actions/index.js +4 -2
  21. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  22. package/build/components/keyboard-shortcuts/edit-mode.js +7 -5
  23. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  24. package/build/components/layout/index.js +9 -2
  25. package/build/components/layout/index.js.map +1 -1
  26. package/build/components/page/index.js +3 -3
  27. package/build/components/page/index.js.map +1 -1
  28. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -1
  29. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  30. package/build/components/page-patterns/patterns-list.js +18 -4
  31. package/build/components/page-patterns/patterns-list.js.map +1 -1
  32. package/build/components/page-patterns/use-patterns.js +20 -3
  33. package/build/components/page-patterns/use-patterns.js.map +1 -1
  34. package/build/components/page-template-parts/index.js +1 -2
  35. package/build/components/page-template-parts/index.js.map +1 -1
  36. package/build/components/page-templates/index.js +1 -16
  37. package/build/components/page-templates/index.js.map +1 -1
  38. package/build/components/resizable-frame/index.js +11 -19
  39. package/build/components/resizable-frame/index.js.map +1 -1
  40. package/build/components/save-button/index.js +4 -2
  41. package/build/components/save-button/index.js.map +1 -1
  42. package/build/components/save-hub/index.js +10 -4
  43. package/build/components/save-hub/index.js.map +1 -1
  44. package/build/components/sidebar-edit-mode/template-panel/index.js +15 -8
  45. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  46. package/build/components/sidebar-navigation-screen/index.js +24 -14
  47. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  48. package/build/components/sidebar-navigation-screen-global-styles/index.js +34 -40
  49. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  50. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  51. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  52. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
  53. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  54. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +8 -0
  55. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  56. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -1
  57. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  58. package/build/components/sidebar-navigation-screen-pages/index.js +2 -0
  59. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  60. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
  61. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  62. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +8 -1
  63. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
  64. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +50 -26
  65. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  66. package/build/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
  67. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  68. package/build/components/sidebar-navigation-screen-patterns/index.js +0 -9
  69. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  70. package/build/components/sidebar-navigation-screen-templates/index.js +1 -10
  71. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  72. package/build/components/sidebar-navigation-screen-templates-browse/index.js +9 -0
  73. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  74. package/build/components/site-hub/index.js +5 -2
  75. package/build/components/site-hub/index.js.map +1 -1
  76. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
  77. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  78. package/build/hooks/commands/use-common-commands.js +57 -27
  79. package/build/hooks/commands/use-common-commands.js.map +1 -1
  80. package/build/hooks/commands/use-edit-mode-commands.js +65 -7
  81. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  82. package/build/hooks/push-changes-to-global-styles/index.js +84 -49
  83. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  84. package/build/store/private-actions.js +2 -1
  85. package/build/store/private-actions.js.map +1 -1
  86. package/build/utils/use-debounced-input.js +5 -7
  87. package/build/utils/use-debounced-input.js.map +1 -1
  88. package/build-module/components/add-new-pattern/index.js +2 -1
  89. package/build-module/components/add-new-pattern/index.js.map +1 -1
  90. package/build-module/components/block-editor/use-site-editor-settings.js +29 -2
  91. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  92. package/build-module/components/editor/index.js +4 -4
  93. package/build-module/components/editor/index.js.map +1 -1
  94. package/build-module/components/global-styles/global-styles-provider.js +12 -7
  95. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  96. package/build-module/components/global-styles/screen-block.js +16 -0
  97. package/build-module/components/global-styles/screen-block.js.map +1 -1
  98. package/build-module/components/global-styles/screen-revisions/index.js +13 -6
  99. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  100. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
  101. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  102. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +28 -21
  103. package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
  104. package/build-module/components/global-styles/style-variations-container.js +5 -3
  105. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  106. package/build-module/components/header-edit-mode/document-actions/index.js +6 -4
  107. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  108. package/build-module/components/keyboard-shortcuts/edit-mode.js +7 -5
  109. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  110. package/build-module/components/layout/index.js +9 -2
  111. package/build-module/components/layout/index.js.map +1 -1
  112. package/build-module/components/page/index.js +3 -3
  113. package/build-module/components/page/index.js.map +1 -1
  114. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -1
  115. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  116. package/build-module/components/page-patterns/patterns-list.js +19 -5
  117. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  118. package/build-module/components/page-patterns/use-patterns.js +19 -3
  119. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  120. package/build-module/components/page-template-parts/index.js +1 -2
  121. package/build-module/components/page-template-parts/index.js.map +1 -1
  122. package/build-module/components/page-templates/index.js +2 -15
  123. package/build-module/components/page-templates/index.js.map +1 -1
  124. package/build-module/components/resizable-frame/index.js +12 -20
  125. package/build-module/components/resizable-frame/index.js.map +1 -1
  126. package/build-module/components/save-button/index.js +4 -2
  127. package/build-module/components/save-button/index.js.map +1 -1
  128. package/build-module/components/save-hub/index.js +10 -4
  129. package/build-module/components/save-hub/index.js.map +1 -1
  130. package/build-module/components/sidebar-edit-mode/template-panel/index.js +15 -9
  131. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  132. package/build-module/components/sidebar-navigation-screen/index.js +21 -14
  133. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  134. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +34 -40
  135. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  136. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  137. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  138. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
  139. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  140. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +7 -0
  141. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  142. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +2 -2
  143. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  144. package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -0
  145. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  146. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
  147. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  148. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +7 -1
  149. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
  150. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +49 -26
  151. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  152. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
  153. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  154. package/build-module/components/sidebar-navigation-screen-patterns/index.js +0 -7
  155. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  156. package/build-module/components/sidebar-navigation-screen-templates/index.js +1 -8
  157. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  158. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -0
  159. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  160. package/build-module/components/site-hub/index.js +4 -2
  161. package/build-module/components/site-hub/index.js.map +1 -1
  162. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
  163. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  164. package/build-module/hooks/commands/use-common-commands.js +57 -27
  165. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  166. package/build-module/hooks/commands/use-edit-mode-commands.js +65 -9
  167. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  168. package/build-module/hooks/push-changes-to-global-styles/index.js +84 -49
  169. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  170. package/build-module/store/private-actions.js +2 -1
  171. package/build-module/store/private-actions.js.map +1 -1
  172. package/build-module/utils/use-debounced-input.js +5 -7
  173. package/build-module/utils/use-debounced-input.js.map +1 -1
  174. package/build-style/style-rtl.css +67 -47
  175. package/build-style/style.css +67 -47
  176. package/package.json +39 -39
  177. package/src/components/add-new-pattern/index.js +2 -0
  178. package/src/components/block-editor/use-site-editor-settings.js +22 -2
  179. package/src/components/editor/index.js +3 -3
  180. package/src/components/global-styles/global-styles-provider.js +7 -2
  181. package/src/components/global-styles/screen-block.js +15 -0
  182. package/src/components/global-styles/screen-revisions/index.js +64 -58
  183. package/src/components/global-styles/screen-revisions/revisions-buttons.js +17 -31
  184. package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +14 -1
  185. package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +64 -48
  186. package/src/components/global-styles/style-variations-container.js +2 -0
  187. package/src/components/header-edit-mode/document-actions/index.js +8 -4
  188. package/src/components/header-edit-mode/document-actions/style.scss +41 -28
  189. package/src/components/keyboard-shortcuts/edit-mode.js +4 -5
  190. package/src/components/layout/index.js +33 -20
  191. package/src/components/layout/style.scss +2 -2
  192. package/src/components/page/index.js +8 -8
  193. package/src/components/page/style.scss +8 -5
  194. package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -1
  195. package/src/components/page-patterns/patterns-list.js +25 -12
  196. package/src/components/page-patterns/style.scss +9 -8
  197. package/src/components/page-patterns/use-patterns.js +19 -3
  198. package/src/components/page-template-parts/index.js +0 -1
  199. package/src/components/page-templates/index.js +6 -19
  200. package/src/components/resizable-frame/index.js +10 -25
  201. package/src/components/save-button/index.js +2 -0
  202. package/src/components/save-hub/index.js +6 -1
  203. package/src/components/save-hub/style.scss +1 -1
  204. package/src/components/sidebar-edit-mode/template-panel/index.js +15 -11
  205. package/src/components/sidebar-navigation-screen/index.js +24 -16
  206. package/src/components/sidebar-navigation-screen/style.scss +4 -0
  207. package/src/components/sidebar-navigation-screen-details-panel/style.scss +1 -0
  208. package/src/components/sidebar-navigation-screen-global-styles/index.js +48 -44
  209. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -2
  210. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
  211. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +27 -15
  212. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -4
  213. package/src/components/sidebar-navigation-screen-pages/index.js +9 -4
  214. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
  215. package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +11 -1
  216. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +69 -41
  217. package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -13
  218. package/src/components/sidebar-navigation-screen-patterns/index.js +0 -8
  219. package/src/components/sidebar-navigation-screen-templates/index.js +1 -9
  220. package/src/components/sidebar-navigation-screen-templates-browse/index.js +10 -0
  221. package/src/components/site-hub/index.js +3 -1
  222. package/src/components/site-hub/style.scss +1 -2
  223. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -4
  224. package/src/components/table/style.scss +1 -0
  225. package/src/hooks/commands/use-common-commands.js +63 -23
  226. package/src/hooks/commands/use-edit-mode-commands.js +94 -23
  227. package/src/hooks/push-changes-to-global-styles/index.js +83 -46
  228. package/src/store/private-actions.js +5 -1
  229. package/src/utils/use-debounced-input.js +8 -7
@@ -58,7 +58,7 @@
58
58
  display: flex;
59
59
  }
60
60
 
61
- .edit-site-layout__sidebar {
61
+ .edit-site-layout__sidebar-region {
62
62
  z-index: z-index(".edit-site-layout__sidebar");
63
63
  width: 100vw;
64
64
  flex-shrink: 0;
@@ -75,7 +75,7 @@
75
75
  top: 0;
76
76
  }
77
77
 
78
- > div {
78
+ .edit-site-layout__sidebar {
79
79
  display: flex;
80
80
  flex-direction: column;
81
81
  height: 100%;
@@ -26,17 +26,17 @@ export default function Page( {
26
26
 
27
27
  return (
28
28
  <NavigableRegion className={ classes } ariaLabel={ title }>
29
- { ! hideTitleFromUI && title && (
30
- <Header
31
- title={ title }
32
- subTitle={ subTitle }
33
- actions={ actions }
34
- />
35
- ) }
36
29
  <div className="edit-site-page-content">
30
+ { ! hideTitleFromUI && title && (
31
+ <Header
32
+ title={ title }
33
+ subTitle={ subTitle }
34
+ actions={ actions }
35
+ />
36
+ ) }
37
37
  { children }
38
- <EditorSnackbars />
39
38
  </div>
39
+ <EditorSnackbars />
40
40
  </NavigableRegion>
41
41
  );
42
42
  }
@@ -2,7 +2,7 @@
2
2
  color: $gray-800;
3
3
  background: $white;
4
4
  flex-grow: 1;
5
- overflow: auto;
5
+ overflow: hidden;
6
6
  margin: 0;
7
7
  margin-top: $header-height;
8
8
  @include break-medium() {
@@ -13,8 +13,7 @@
13
13
 
14
14
  .edit-site-page-header {
15
15
  padding: 0 $grid-unit-40;
16
- height: $header-height;
17
- padding-left: $grid-unit-40;
16
+ min-height: $header-height;
18
17
  border-bottom: 1px solid $gray-100;
19
18
  background: $white;
20
19
  position: sticky;
@@ -33,6 +32,10 @@
33
32
  }
34
33
 
35
34
  .edit-site-page-content {
36
- padding: $grid-unit-40 $grid-unit-40;
37
- overflow-x: auto;
35
+ height: 100%;
36
+ display: flex;
37
+ overflow: auto;
38
+ flex-flow: column;
39
+ position: relative;
40
+ z-index: z-index(".edit-site-page-content");
38
41
  }
@@ -49,7 +49,7 @@ export function useDisableNonPageContentBlocks() {
49
49
 
50
50
  const withDisableNonPageContentBlocks = createHigherOrderComponent(
51
51
  ( BlockEdit ) => ( props ) => {
52
- const isDescendentOfQueryLoop = !! props.context.queryId;
52
+ const isDescendentOfQueryLoop = props.context.queryId !== undefined;
53
53
  const isPageContent =
54
54
  PAGE_CONTENT_BLOCK_TYPES.includes( props.name ) &&
55
55
  ! isDescendentOfQueryLoop;
@@ -27,7 +27,7 @@ import usePatterns from './use-patterns';
27
27
  import SidebarButton from '../sidebar-button';
28
28
  import useDebouncedInput from '../../utils/use-debounced-input';
29
29
  import { unlock } from '../../lock-unlock';
30
- import { SYNC_TYPES, USER_PATTERN_CATEGORY } from './utils';
30
+ import { SYNC_TYPES, USER_PATTERN_CATEGORY, PATTERNS } from './utils';
31
31
  import Pagination from './pagination';
32
32
 
33
33
  const { useLocation, useHistory } = unlock( routerPrivateApis );
@@ -63,9 +63,12 @@ export default function PatternsList( { categoryId, type } ) {
63
63
 
64
64
  const deferredSyncedFilter = useDeferredValue( syncFilter );
65
65
 
66
+ const isUncategorizedThemePatterns =
67
+ type === PATTERNS && categoryId === 'uncategorized';
68
+
66
69
  const { patterns, isResolving } = usePatterns(
67
70
  type,
68
- categoryId !== 'uncategorized' ? categoryId : '',
71
+ isUncategorizedThemePatterns ? '' : categoryId,
69
72
  {
70
73
  search: deferredFilterValue,
71
74
  syncStatus:
@@ -75,6 +78,16 @@ export default function PatternsList( { categoryId, type } ) {
75
78
  }
76
79
  );
77
80
 
81
+ const updateSearchFilter = ( value ) => {
82
+ setCurrentPage( 1 );
83
+ setFilterValue( value );
84
+ };
85
+
86
+ const updateSyncFilter = ( value ) => {
87
+ setCurrentPage( 1 );
88
+ setSyncFilter( value );
89
+ };
90
+
78
91
  const id = useId();
79
92
  const titleId = `${ id }-title`;
80
93
  const descriptionId = `${ id }-description`;
@@ -87,14 +100,12 @@ export default function PatternsList( { categoryId, type } ) {
87
100
  const pageIndex = currentPage - 1;
88
101
  const numPages = Math.ceil( patterns.length / PAGE_SIZE );
89
102
 
90
- const list = useMemo(
91
- () =>
92
- patterns.slice(
93
- pageIndex * PAGE_SIZE,
94
- pageIndex * PAGE_SIZE + PAGE_SIZE
95
- ),
96
- [ pageIndex, patterns ]
97
- );
103
+ const list = useMemo( () => {
104
+ return patterns.slice(
105
+ pageIndex * PAGE_SIZE,
106
+ pageIndex * PAGE_SIZE + PAGE_SIZE
107
+ );
108
+ }, [ pageIndex, patterns ] );
98
109
 
99
110
  const asyncList = useAsyncList( list, { step: 10 } );
100
111
 
@@ -135,7 +146,9 @@ export default function PatternsList( { categoryId, type } ) {
135
146
  <FlexBlock className="edit-site-patterns__search-block">
136
147
  <SearchControl
137
148
  className="edit-site-patterns__search"
138
- onChange={ ( value ) => setFilterValue( value ) }
149
+ onChange={ ( value ) =>
150
+ updateSearchFilter( value )
151
+ }
139
152
  placeholder={ __( 'Search patterns' ) }
140
153
  label={ __( 'Search patterns' ) }
141
154
  value={ filterValue }
@@ -149,7 +162,7 @@ export default function PatternsList( { categoryId, type } ) {
149
162
  label={ __( 'Filter by sync status' ) }
150
163
  value={ syncFilter }
151
164
  isBlock
152
- onChange={ ( value ) => setSyncFilter( value ) }
165
+ onChange={ ( value ) => updateSyncFilter( value ) }
153
166
  __nextHasNoMarginBottom
154
167
  >
155
168
  { Object.entries( SYNC_FILTERS ).map(
@@ -6,14 +6,6 @@
6
6
  padding: 0;
7
7
  overflow-x: auto;
8
8
 
9
- .edit-site-page-content {
10
- height: 100%;
11
- position: relative;
12
- padding: 0;
13
- display: flex;
14
- flex-flow: column;
15
- }
16
-
17
9
  .components-base-control {
18
10
  width: 100%;
19
11
  @include break-medium {
@@ -68,6 +60,9 @@
68
60
  width: 300px;
69
61
  }
70
62
  }
63
+ .edit-site-patterns__sync-status-filter-option:not([aria-checked="true"]) {
64
+ color: $gray-600;
65
+ }
71
66
  .edit-site-patterns__sync-status-filter-option:active {
72
67
  background: $gray-700;
73
68
  color: $gray-100;
@@ -128,6 +123,12 @@
128
123
  @include break-large {
129
124
  grid-template-columns: 1fr 1fr;
130
125
  }
126
+ @include break-huge {
127
+ grid-template-columns: 1fr 1fr 1fr;
128
+ }
129
+ @include break-xhuge {
130
+ grid-template-columns: 1fr 1fr 1fr 1fr;
131
+ }
131
132
  .edit-site-patterns__pattern {
132
133
  break-inside: avoid-column;
133
134
  display: flex;
@@ -4,6 +4,7 @@
4
4
  import { parse } from '@wordpress/blocks';
5
5
  import { useSelect } from '@wordpress/data';
6
6
  import { store as coreStore } from '@wordpress/core-data';
7
+ import { store as editorStore } from '@wordpress/editor';
7
8
  import { decodeEntities } from '@wordpress/html-entities';
8
9
 
9
10
  /**
@@ -39,14 +40,12 @@ const templatePartToPattern = ( templatePart ) => ( {
39
40
  templatePart,
40
41
  } );
41
42
 
42
- const templatePartHasCategory = ( item, category ) =>
43
- item.templatePart.area === category;
44
-
45
43
  const selectTemplatePartsAsPatterns = (
46
44
  select,
47
45
  { categoryId, search = '' } = {}
48
46
  ) => {
49
47
  const { getEntityRecords, getIsResolving } = select( coreStore );
48
+ const { __experimentalGetDefaultTemplatePartAreas } = select( editorStore );
50
49
  const query = { per_page: -1 };
51
50
  const rawTemplateParts =
52
51
  getEntityRecords( 'postType', TEMPLATE_PARTS, query ) ??
@@ -55,6 +54,23 @@ const selectTemplatePartsAsPatterns = (
55
54
  templatePartToPattern( templatePart )
56
55
  );
57
56
 
57
+ // In the case where a custom template part area has been removed we need
58
+ // the current list of areas to cross check against so orphaned template
59
+ // parts can be treated as uncategorized.
60
+ const knownAreas = __experimentalGetDefaultTemplatePartAreas() || [];
61
+ const templatePartAreas = knownAreas.map( ( area ) => area.area );
62
+
63
+ const templatePartHasCategory = ( item, category ) => {
64
+ if ( category !== 'uncategorized' ) {
65
+ return item.templatePart.area === category;
66
+ }
67
+
68
+ return (
69
+ item.templatePart.area === category ||
70
+ ! templatePartAreas.includes( item.templatePart.area )
71
+ );
72
+ };
73
+
58
74
  const isResolving = getIsResolving( 'getEntityRecords', [
59
75
  'postType',
60
76
  'wp_template_part',
@@ -39,7 +39,6 @@ export default function PageTemplateParts() {
39
39
  params={ {
40
40
  postId: templatePart.id,
41
41
  postType: templatePart.type,
42
- canvas: 'view',
43
42
  } }
44
43
  state={ { backPath: '/wp_template_part/all' } }
45
44
  >
@@ -8,8 +8,7 @@ import {
8
8
  __experimentalVStack as VStack,
9
9
  } from '@wordpress/components';
10
10
  import { __ } from '@wordpress/i18n';
11
- import { useSelect } from '@wordpress/data';
12
- import { store as coreStore, useEntityRecords } from '@wordpress/core-data';
11
+ import { useEntityRecords } from '@wordpress/core-data';
13
12
  import { decodeEntities } from '@wordpress/html-entities';
14
13
 
15
14
  /**
@@ -21,7 +20,6 @@ import Link from '../routes/link';
21
20
  import AddedBy from '../list/added-by';
22
21
  import TemplateActions from '../template-actions';
23
22
  import AddNewTemplate from '../add-new-template';
24
- import { store as editSiteStore } from '../../store';
25
23
 
26
24
  export default function PageTemplates() {
27
25
  const { records: templates } = useEntityRecords(
@@ -32,15 +30,6 @@ export default function PageTemplates() {
32
30
  }
33
31
  );
34
32
 
35
- const { canCreate } = useSelect( ( select ) => {
36
- const { supportsTemplatePartsMode } =
37
- select( editSiteStore ).getSettings();
38
- return {
39
- postType: select( coreStore ).getPostType( 'wp_template' ),
40
- canCreate: ! supportsTemplatePartsMode,
41
- };
42
- } );
43
-
44
33
  const columns = [
45
34
  {
46
35
  header: __( 'Template' ),
@@ -89,13 +78,11 @@ export default function PageTemplates() {
89
78
  <Page
90
79
  title={ __( 'Templates' ) }
91
80
  actions={
92
- canCreate && (
93
- <AddNewTemplate
94
- templateType={ 'wp_template' }
95
- showIcon={ false }
96
- toggleProps={ { variant: 'primary' } }
97
- />
98
- )
81
+ <AddNewTemplate
82
+ templateType={ 'wp_template' }
83
+ showIcon={ false }
84
+ toggleProps={ { variant: 'primary' } }
85
+ />
99
86
  }
100
87
  >
101
88
  { templates && <Table data={ templates } columns={ columns } /> }
@@ -6,7 +6,7 @@ import classnames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { useState, useRef, useEffect } from '@wordpress/element';
9
+ import { useState, useRef } from '@wordpress/element';
10
10
  import {
11
11
  ResizableBox,
12
12
  Tooltip,
@@ -82,6 +82,8 @@ function ResizableFrame( {
82
82
  setIsOversized,
83
83
  isReady,
84
84
  children,
85
+ /** The default (unresized) width/height of the frame, based on the space availalbe in the viewport. */
86
+ defaultSize,
85
87
  innerContentStyle,
86
88
  } ) {
87
89
  const [ frameSize, setFrameSize ] = useState( INITIAL_FRAME_SIZE );
@@ -95,22 +97,13 @@ function ResizableFrame( {
95
97
  []
96
98
  );
97
99
  const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
98
- const initialAspectRatioRef = useRef( null );
99
- // The width of the resizable frame on initial render.
100
- const initialComputedWidthRef = useRef( null );
101
100
  const FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };
102
101
  const frameRef = useRef( null );
103
102
  const resizableHandleHelpId = useInstanceId(
104
103
  ResizableFrame,
105
104
  'edit-site-resizable-frame-handle-help'
106
105
  );
107
-
108
- // Remember frame dimensions on initial render.
109
- useEffect( () => {
110
- const { offsetWidth, offsetHeight } = frameRef.current.resizable;
111
- initialComputedWidthRef.current = offsetWidth;
112
- initialAspectRatioRef.current = offsetWidth / offsetHeight;
113
- }, [] );
106
+ const defaultAspectRatio = defaultSize.width / defaultSize.height;
114
107
 
115
108
  const handleResizeStart = ( _event, _direction, ref ) => {
116
109
  // Remember the starting width so we don't have to get `ref.offsetWidth` on
@@ -126,7 +119,7 @@ function ResizableFrame( {
126
119
  const maxDoubledDelta =
127
120
  delta.width < 0 // is shrinking
128
121
  ? deltaAbs
129
- : ( initialComputedWidthRef.current - startingWidth ) / 2;
122
+ : ( defaultSize.width - startingWidth ) / 2;
130
123
  const deltaToDouble = Math.min( deltaAbs, maxDoubledDelta );
131
124
  const doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;
132
125
  const singleSegment = 1 - doubleSegment;
@@ -135,17 +128,14 @@ function ResizableFrame( {
135
128
 
136
129
  const updatedWidth = startingWidth + delta.width;
137
130
 
138
- setIsOversized( updatedWidth > initialComputedWidthRef.current );
131
+ setIsOversized( updatedWidth > defaultSize.width );
139
132
 
140
133
  // Width will be controlled by the library (via `resizeRatio`),
141
134
  // so we only need to update the height.
142
135
  setFrameSize( {
143
136
  height: isOversized
144
137
  ? '100%'
145
- : calculateNewHeight(
146
- updatedWidth,
147
- initialAspectRatioRef.current
148
- ),
138
+ : calculateNewHeight( updatedWidth, defaultAspectRatio ),
149
139
  } );
150
140
  };
151
141
 
@@ -186,15 +176,12 @@ function ResizableFrame( {
186
176
  FRAME_MIN_WIDTH,
187
177
  frameRef.current.resizable.offsetWidth + delta
188
178
  ),
189
- initialComputedWidthRef.current
179
+ defaultSize.width
190
180
  );
191
181
 
192
182
  setFrameSize( {
193
183
  width: newWidth,
194
- height: calculateNewHeight(
195
- newWidth,
196
- initialAspectRatioRef.current
197
- ),
184
+ height: calculateNewHeight( newWidth, defaultAspectRatio ),
198
185
  } );
199
186
  };
200
187
 
@@ -291,9 +278,7 @@ function ResizableFrame( {
291
278
  undefined
292
279
  }
293
280
  aria-valuemin={ FRAME_MIN_WIDTH }
294
- aria-valuemax={
295
- initialComputedWidthRef.current
296
- }
281
+ aria-valuemax={ defaultSize.width }
297
282
  onKeyDown={ handleResizableHandleKeyDown }
298
283
  initial="hidden"
299
284
  exit="hidden"
@@ -19,6 +19,7 @@ export default function SaveButton( {
19
19
  showTooltip = true,
20
20
  defaultLabel,
21
21
  icon,
22
+ __next40pxDefaultSize = false,
22
23
  } ) {
23
24
  const { isDirty, isSaving, isSaveViewOpen } = useSelect( ( select ) => {
24
25
  const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } =
@@ -83,6 +84,7 @@ export default function SaveButton( {
83
84
  */
84
85
  showTooltip={ showTooltip }
85
86
  icon={ icon }
87
+ __next40pxDefaultSize={ __next40pxDefaultSize }
86
88
  >
87
89
  { label }
88
90
  </Button>
@@ -27,12 +27,13 @@ const PUBLISH_ON_SAVE_ENTITIES = [
27
27
  ];
28
28
 
29
29
  export default function SaveHub() {
30
+ const saveNoticeId = 'site-edit-save-notice';
30
31
  const { params } = useLocation();
31
32
 
32
33
  const { __unstableMarkLastChangeAsPersistent } =
33
34
  useDispatch( blockEditorStore );
34
35
 
35
- const { createSuccessNotice, createErrorNotice } =
36
+ const { createSuccessNotice, createErrorNotice, removeNotice } =
36
37
  useDispatch( noticesStore );
37
38
 
38
39
  const { dirtyCurrentEntity, countUnsavedChanges, isDirty, isSaving } =
@@ -107,6 +108,7 @@ export default function SaveHub() {
107
108
  const saveCurrentEntity = async () => {
108
109
  if ( ! dirtyCurrentEntity ) return;
109
110
 
111
+ removeNotice( saveNoticeId );
110
112
  const { kind, name, key, property } = dirtyCurrentEntity;
111
113
 
112
114
  try {
@@ -132,6 +134,7 @@ export default function SaveHub() {
132
134
 
133
135
  createSuccessNotice( __( 'Site updated.' ), {
134
136
  type: 'snackbar',
137
+ id: saveNoticeId,
135
138
  } );
136
139
  } catch ( error ) {
137
140
  createErrorNotice( `${ __( 'Saving failed.' ) } ${ error }` );
@@ -148,6 +151,7 @@ export default function SaveHub() {
148
151
  disabled={ isSaving }
149
152
  aria-disabled={ isSaving }
150
153
  className="edit-site-save-hub__button"
154
+ __next40pxDefaultSize
151
155
  >
152
156
  { label }
153
157
  </Button>
@@ -158,6 +162,7 @@ export default function SaveHub() {
158
162
  showTooltip={ false }
159
163
  icon={ disabled && ! isSaving ? check : null }
160
164
  defaultLabel={ label }
165
+ __next40pxDefaultSize
161
166
  />
162
167
  ) }
163
168
  </HStack>
@@ -3,7 +3,7 @@
3
3
  border-top: 1px solid $gray-800;
4
4
  flex-shrink: 0;
5
5
  margin: 0;
6
- padding: $canvas-padding;
6
+ padding: $grid-unit-20 + $grid-unit-05 $canvas-padding;
7
7
  }
8
8
 
9
9
  .edit-site-save-hub__button {
@@ -7,7 +7,7 @@ import { store as editorStore } from '@wordpress/editor';
7
7
  import { store as coreStore } from '@wordpress/core-data';
8
8
  import { decodeEntities } from '@wordpress/html-entities';
9
9
  import { __ } from '@wordpress/i18n';
10
- import { navigation as navigationIcon } from '@wordpress/icons';
10
+ import { navigation, symbol } from '@wordpress/icons';
11
11
 
12
12
  /**
13
13
  * Internal dependencies
@@ -18,11 +18,13 @@ import TemplateAreas from './template-areas';
18
18
  import LastRevision from './last-revision';
19
19
  import SidebarCard from '../sidebar-card';
20
20
 
21
+ const CARD_ICONS = {
22
+ wp_block: symbol,
23
+ wp_navigation: navigation,
24
+ };
25
+
21
26
  export default function TemplatePanel() {
22
- const {
23
- info: { title, description, icon },
24
- record,
25
- } = useSelect( ( select ) => {
27
+ const { title, description, icon, record } = useSelect( ( select ) => {
26
28
  const { getEditedPostType, getEditedPostId } = select( editSiteStore );
27
29
  const { getEditedEntityRecord } = select( coreStore );
28
30
  const { __experimentalGetTemplateInfo: getTemplateInfo } =
@@ -31,10 +33,14 @@ export default function TemplatePanel() {
31
33
  const postType = getEditedPostType();
32
34
  const postId = getEditedPostId();
33
35
  const _record = getEditedEntityRecord( 'postType', postType, postId );
36
+ const info = getTemplateInfo( _record );
34
37
 
35
- const info = _record ? getTemplateInfo( _record ) : {};
36
-
37
- return { info, record: _record };
38
+ return {
39
+ title: info.title,
40
+ description: info.description,
41
+ icon: info.icon,
42
+ record: _record,
43
+ };
38
44
  }, [] );
39
45
 
40
46
  if ( ! title && ! description ) {
@@ -46,9 +52,7 @@ export default function TemplatePanel() {
46
52
  <SidebarCard
47
53
  className="edit-site-template-card"
48
54
  title={ decodeEntities( title ) }
49
- icon={
50
- record?.type === 'wp_navigation' ? navigationIcon : icon
51
- }
55
+ icon={ CARD_ICONS[ record?.type ] ?? icon }
52
56
  description={ decodeEntities( description ) }
53
57
  actions={ <TemplateActions template={ record } /> }
54
58
  >
@@ -1,3 +1,8 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import classnames from 'classnames';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
@@ -11,6 +16,7 @@ import { isRTL, __, sprintf } from '@wordpress/i18n';
11
16
  import { chevronRight, chevronLeft } from '@wordpress/icons';
12
17
  import { store as coreStore } from '@wordpress/core-data';
13
18
  import { useSelect } from '@wordpress/data';
19
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
14
20
 
15
21
  /**
16
22
  * Internal dependencies
@@ -23,6 +29,8 @@ import {
23
29
  currentlyPreviewingTheme,
24
30
  } from '../../utils/is-previewing-theme';
25
31
 
32
+ const { useLocation } = unlock( routerPrivateApis );
33
+
26
34
  export default function SidebarNavigationScreen( {
27
35
  isRoot,
28
36
  title,
@@ -31,7 +39,7 @@ export default function SidebarNavigationScreen( {
31
39
  content,
32
40
  footer,
33
41
  description,
34
- backPath,
42
+ backPath: backPathProp,
35
43
  } ) {
36
44
  const { dashboardLink } = useSelect( ( select ) => {
37
45
  const { getSettings } = unlock( select( editSiteStore ) );
@@ -40,6 +48,7 @@ export default function SidebarNavigationScreen( {
40
48
  };
41
49
  }, [] );
42
50
  const { getTheme } = useSelect( coreStore );
51
+ const location = useLocation();
43
52
  const navigator = useNavigator();
44
53
  const theme = getTheme( currentlyPreviewingTheme() );
45
54
  const icon = isRTL() ? chevronRight : chevronLeft;
@@ -47,7 +56,12 @@ export default function SidebarNavigationScreen( {
47
56
  return (
48
57
  <>
49
58
  <VStack
50
- className="edit-site-sidebar-navigation-screen__main"
59
+ className={ classnames(
60
+ 'edit-site-sidebar-navigation-screen__main',
61
+ {
62
+ 'has-footer': !! footer,
63
+ }
64
+ ) }
51
65
  spacing={ 0 }
52
66
  justify="flex-start"
53
67
  >
@@ -56,13 +70,17 @@ export default function SidebarNavigationScreen( {
56
70
  alignment="flex-start"
57
71
  className="edit-site-sidebar-navigation-screen__title-icon"
58
72
  >
59
- { ! isRoot && ! backPath && (
73
+ { ! isRoot && (
60
74
  <SidebarButton
61
75
  onClick={ () => {
62
- if ( navigator.location.isInitial ) {
63
- navigator.goToParent( { replace: true } );
76
+ const backPath =
77
+ backPathProp ?? location.state?.backPath;
78
+ if ( backPath ) {
79
+ navigator.goTo( backPath, {
80
+ isBack: true,
81
+ } );
64
82
  } else {
65
- navigator.goBack();
83
+ navigator.goToParent();
66
84
  }
67
85
  } }
68
86
  icon={ icon }
@@ -70,16 +88,6 @@ export default function SidebarNavigationScreen( {
70
88
  showTooltip={ false }
71
89
  />
72
90
  ) }
73
- { ! isRoot && backPath && (
74
- <SidebarButton
75
- onClick={ () =>
76
- navigator.goTo( backPath, { isBack: true } )
77
- }
78
- icon={ icon }
79
- label={ __( 'Back' ) }
80
- showTooltip={ false }
81
- />
82
- ) }
83
91
  { isRoot && (
84
92
  <SidebarButton
85
93
  icon={ icon }
@@ -9,6 +9,10 @@
9
9
  // Ensure the sidebar is always at least as tall as the viewport.
10
10
  // This allows the footer section to be sticky at the bottom of the viewport.
11
11
  flex-grow: 1;
12
+ margin-bottom: $grid-unit-20;
13
+ &.has-footer {
14
+ margin-bottom: 0;
15
+ }
12
16
  }
13
17
 
14
18
  .edit-site-sidebar-navigation-screen__content {
@@ -18,6 +18,7 @@
18
18
  .edit-site-sidebar-navigation-details-screen-panel__label.edit-site-sidebar-navigation-details-screen-panel__label {
19
19
  color: $gray-600;
20
20
  width: 100px;
21
+ flex-shrink: 0;
21
22
  }
22
23
 
23
24
  .edit-site-sidebar-navigation-details-screen-panel__value.edit-site-sidebar-navigation-details-screen-panel__value {