@wordpress/edit-site 5.12.7 → 5.12.9

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 (166) hide show
  1. package/build/components/block-editor/editor-canvas.js +1 -1
  2. package/build/components/block-editor/editor-canvas.js.map +1 -1
  3. package/build/components/block-editor/index.js +0 -4
  4. package/build/components/block-editor/index.js.map +1 -1
  5. package/build/components/block-editor/use-site-editor-settings.js +12 -6
  6. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  7. package/build/components/create-pattern-modal/index.js +7 -3
  8. package/build/components/create-pattern-modal/index.js.map +1 -1
  9. package/build/components/page-patterns/duplicate-menu-item.js +163 -0
  10. package/build/components/page-patterns/duplicate-menu-item.js.map +1 -0
  11. package/build/components/page-patterns/grid-item.js +83 -59
  12. package/build/components/page-patterns/grid-item.js.map +1 -1
  13. package/build/components/page-patterns/grid.js +81 -13
  14. package/build/components/page-patterns/grid.js.map +1 -1
  15. package/build/components/page-patterns/header.js +69 -0
  16. package/build/components/page-patterns/header.js.map +1 -0
  17. package/build/components/page-patterns/index.js +3 -1
  18. package/build/components/page-patterns/index.js.map +1 -1
  19. package/build/components/page-patterns/patterns-list.js +66 -27
  20. package/build/components/page-patterns/patterns-list.js.map +1 -1
  21. package/build/components/page-patterns/rename-menu-item.js +109 -0
  22. package/build/components/page-patterns/rename-menu-item.js.map +1 -0
  23. package/build/components/page-patterns/use-patterns.js +99 -118
  24. package/build/components/page-patterns/use-patterns.js.map +1 -1
  25. package/build/components/page-template-parts/add-new-template-part.js +74 -0
  26. package/build/components/page-template-parts/add-new-template-part.js.map +1 -0
  27. package/build/components/page-template-parts/index.js +2 -23
  28. package/build/components/page-template-parts/index.js.map +1 -1
  29. package/build/components/resizable-frame/index.js +75 -32
  30. package/build/components/resizable-frame/index.js.map +1 -1
  31. package/build/components/sidebar-navigation-screen/index.js +14 -8
  32. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  33. package/build/components/sidebar-navigation-screen-main/template-part-hint.js +1 -1
  34. package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -1
  35. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  36. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  37. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
  38. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  39. package/build/components/sidebar-navigation-screen-page/status-label.js +1 -34
  40. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  41. package/build/components/sidebar-navigation-screen-pages/index.js +33 -25
  42. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  43. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
  44. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  45. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
  46. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  47. package/build/components/sidebar-navigation-screen-patterns/index.js +5 -6
  48. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  49. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
  50. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
  51. package/build/components/site-hub/index.js +4 -2
  52. package/build/components/site-hub/index.js.map +1 -1
  53. package/build/components/sync-state-with-url/use-sync-path-with-url.js +15 -12
  54. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  55. package/build/components/template-actions/index.js +3 -1
  56. package/build/components/template-actions/index.js.map +1 -1
  57. package/build/components/template-actions/rename-menu-item.js +9 -6
  58. package/build/components/template-actions/rename-menu-item.js.map +1 -1
  59. package/build/hooks/push-changes-to-global-styles/index.js +3 -1
  60. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  61. package/build/utils/use-activate-theme.js +1 -1
  62. package/build/utils/use-activate-theme.js.map +1 -1
  63. package/build-module/components/block-editor/editor-canvas.js +1 -1
  64. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  65. package/build-module/components/block-editor/index.js +0 -4
  66. package/build-module/components/block-editor/index.js.map +1 -1
  67. package/build-module/components/block-editor/use-site-editor-settings.js +13 -7
  68. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  69. package/build-module/components/create-pattern-modal/index.js +6 -3
  70. package/build-module/components/create-pattern-modal/index.js.map +1 -1
  71. package/build-module/components/page-patterns/duplicate-menu-item.js +147 -0
  72. package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -0
  73. package/build-module/components/page-patterns/grid-item.js +84 -65
  74. package/build-module/components/page-patterns/grid-item.js.map +1 -1
  75. package/build-module/components/page-patterns/grid.js +82 -15
  76. package/build-module/components/page-patterns/grid.js.map +1 -1
  77. package/build-module/components/page-patterns/header.js +54 -0
  78. package/build-module/components/page-patterns/header.js.map +1 -0
  79. package/build-module/components/page-patterns/index.js +3 -1
  80. package/build-module/components/page-patterns/index.js.map +1 -1
  81. package/build-module/components/page-patterns/patterns-list.js +68 -30
  82. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  83. package/build-module/components/page-patterns/rename-menu-item.js +97 -0
  84. package/build-module/components/page-patterns/rename-menu-item.js.map +1 -0
  85. package/build-module/components/page-patterns/use-patterns.js +100 -119
  86. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  87. package/build-module/components/page-template-parts/add-new-template-part.js +58 -0
  88. package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -0
  89. package/build-module/components/page-template-parts/index.js +3 -22
  90. package/build-module/components/page-template-parts/index.js.map +1 -1
  91. package/build-module/components/resizable-frame/index.js +76 -35
  92. package/build-module/components/resizable-frame/index.js.map +1 -1
  93. package/build-module/components/sidebar-navigation-screen/index.js +15 -9
  94. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  95. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +1 -1
  96. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -1
  97. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  98. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  99. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
  100. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  101. package/build-module/components/sidebar-navigation-screen-page/status-label.js +1 -32
  102. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  103. package/build-module/components/sidebar-navigation-screen-pages/index.js +33 -25
  104. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  105. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
  106. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  107. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
  108. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  109. package/build-module/components/sidebar-navigation-screen-patterns/index.js +5 -6
  110. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  111. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
  112. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
  113. package/build-module/components/site-hub/index.js +4 -2
  114. package/build-module/components/site-hub/index.js.map +1 -1
  115. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +16 -12
  116. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  117. package/build-module/components/template-actions/index.js +2 -1
  118. package/build-module/components/template-actions/index.js.map +1 -1
  119. package/build-module/components/template-actions/rename-menu-item.js +8 -6
  120. package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
  121. package/build-module/hooks/push-changes-to-global-styles/index.js +4 -2
  122. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  123. package/build-module/utils/use-activate-theme.js +1 -1
  124. package/build-module/utils/use-activate-theme.js.map +1 -1
  125. package/build-style/style-rtl.css +150 -54
  126. package/build-style/style.css +150 -54
  127. package/package.json +14 -14
  128. package/src/components/block-editor/editor-canvas.js +1 -1
  129. package/src/components/block-editor/index.js +0 -4
  130. package/src/components/block-editor/use-site-editor-settings.js +16 -11
  131. package/src/components/create-pattern-modal/index.js +5 -2
  132. package/src/components/header-edit-mode/document-actions/style.scss +4 -0
  133. package/src/components/layout/style.scss +1 -0
  134. package/src/components/page-patterns/duplicate-menu-item.js +196 -0
  135. package/src/components/page-patterns/grid-item.js +187 -137
  136. package/src/components/page-patterns/grid.js +118 -20
  137. package/src/components/page-patterns/header.js +69 -0
  138. package/src/components/page-patterns/index.js +6 -1
  139. package/src/components/page-patterns/patterns-list.js +87 -46
  140. package/src/components/page-patterns/rename-menu-item.js +115 -0
  141. package/src/components/page-patterns/style.scss +106 -26
  142. package/src/components/page-patterns/use-patterns.js +96 -167
  143. package/src/components/page-template-parts/add-new-template-part.js +57 -0
  144. package/src/components/page-template-parts/index.js +3 -22
  145. package/src/components/resizable-frame/index.js +100 -31
  146. package/src/components/resizable-frame/style.scss +26 -9
  147. package/src/components/sidebar-navigation-item/style.scss +10 -1
  148. package/src/components/sidebar-navigation-screen/index.js +14 -7
  149. package/src/components/sidebar-navigation-screen-main/template-part-hint.js +1 -3
  150. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  151. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +1 -1
  152. package/src/components/sidebar-navigation-screen-page/status-label.js +1 -35
  153. package/src/components/sidebar-navigation-screen-pages/index.js +39 -29
  154. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +2 -1
  155. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +2 -1
  156. package/src/components/sidebar-navigation-screen-patterns/index.js +20 -24
  157. package/src/components/sidebar-navigation-screen-patterns/style.scss +0 -3
  158. package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +7 -6
  159. package/src/components/site-hub/index.js +6 -2
  160. package/src/components/site-hub/style.scss +5 -0
  161. package/src/components/sync-state-with-url/use-sync-path-with-url.js +73 -66
  162. package/src/components/template-actions/index.js +2 -1
  163. package/src/components/template-actions/rename-menu-item.js +8 -6
  164. package/src/hooks/push-changes-to-global-styles/index.js +8 -1
  165. package/src/style.scss +10 -12
  166. package/src/utils/use-activate-theme.js +1 -1
@@ -9,9 +9,12 @@ import classnames from 'classnames';
9
9
  import { useState, useRef, useEffect } from '@wordpress/element';
10
10
  import {
11
11
  ResizableBox,
12
+ Tooltip,
12
13
  __unstableMotion as motion,
13
14
  } from '@wordpress/components';
14
- import { useDispatch } from '@wordpress/data';
15
+ import { useInstanceId } from '@wordpress/compose';
16
+ import { useDispatch, useSelect } from '@wordpress/data';
17
+ import { __ } from '@wordpress/i18n';
15
18
 
16
19
  /**
17
20
  * Internal dependencies
@@ -33,7 +36,7 @@ const HANDLE_STYLES_OVERRIDE = {
33
36
  };
34
37
 
35
38
  // The minimum width of the frame (in px) while resizing.
36
- const FRAME_MIN_WIDTH = 340;
39
+ const FRAME_MIN_WIDTH = 320;
37
40
  // The reference width of the frame (in px) used to calculate the aspect ratio.
38
41
  const FRAME_REFERENCE_WIDTH = 1300;
39
42
  // 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.
@@ -42,6 +45,8 @@ const FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;
42
45
  // viewport's edge. If the frame is resized to be closer to the viewport's edge
43
46
  // than this distance, then "canvas mode" will be enabled.
44
47
  const SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;
48
+ // Default size for the `frameSize` state.
49
+ const INITIAL_FRAME_SIZE = { width: '100%', height: '100%' };
45
50
 
46
51
  function calculateNewHeight( width, initialAspectRatio ) {
47
52
  const lerp = ( a, b, amount ) => {
@@ -78,22 +83,27 @@ function ResizableFrame( {
78
83
  oversizedClassName,
79
84
  innerContentStyle,
80
85
  } ) {
81
- const [ frameSize, setFrameSize ] = useState( {
82
- width: '100%',
83
- height: '100%',
84
- } );
86
+ const [ frameSize, setFrameSize ] = useState( INITIAL_FRAME_SIZE );
85
87
  // The width of the resizable frame when a new resize gesture starts.
86
88
  const [ startingWidth, setStartingWidth ] = useState();
87
89
  const [ isResizing, setIsResizing ] = useState( false );
88
- const [ isHovering, setIsHovering ] = useState( false );
90
+ const [ shouldShowHandle, setShouldShowHandle ] = useState( false );
89
91
  const [ isOversized, setIsOversized ] = useState( false );
90
92
  const [ resizeRatio, setResizeRatio ] = useState( 1 );
93
+ const canvasMode = useSelect(
94
+ ( select ) => unlock( select( editSiteStore ) ).getCanvasMode(),
95
+ []
96
+ );
91
97
  const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
92
98
  const initialAspectRatioRef = useRef( null );
93
99
  // The width of the resizable frame on initial render.
94
100
  const initialComputedWidthRef = useRef( null );
95
101
  const FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };
96
102
  const frameRef = useRef( null );
103
+ const resizableHandleHelpId = useInstanceId(
104
+ ResizableFrame,
105
+ 'edit-site-resizable-frame-handle-help'
106
+ );
97
107
 
98
108
  // Remember frame dimensions on initial render.
99
109
  useEffect( () => {
@@ -154,13 +164,40 @@ function ResizableFrame( {
154
164
  if ( remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD ) {
155
165
  // Reset the initial aspect ratio if the frame is resized slightly
156
166
  // above the sidebar but not far enough to trigger full screen.
157
- setFrameSize( { width: '100%', height: '100%' } );
167
+ setFrameSize( INITIAL_FRAME_SIZE );
158
168
  } else {
159
169
  // Trigger full screen if the frame is resized far enough to the left.
160
170
  setCanvasMode( 'edit' );
161
171
  }
162
172
  };
163
173
 
174
+ // Handle resize by arrow keys
175
+ const handleResizableHandleKeyDown = ( event ) => {
176
+ if ( ! [ 'ArrowLeft', 'ArrowRight' ].includes( event.key ) ) {
177
+ return;
178
+ }
179
+
180
+ event.preventDefault();
181
+
182
+ const step = 20 * ( event.shiftKey ? 5 : 1 );
183
+ const delta = step * ( event.key === 'ArrowLeft' ? 1 : -1 );
184
+ const newWidth = Math.min(
185
+ Math.max(
186
+ FRAME_MIN_WIDTH,
187
+ frameRef.current.resizable.offsetWidth + delta
188
+ ),
189
+ initialComputedWidthRef.current
190
+ );
191
+
192
+ setFrameSize( {
193
+ width: newWidth,
194
+ height: calculateNewHeight(
195
+ newWidth,
196
+ initialAspectRatioRef.current
197
+ ),
198
+ } );
199
+ };
200
+
164
201
  const frameAnimationVariants = {
165
202
  default: {
166
203
  flexGrow: 0,
@@ -173,16 +210,26 @@ function ResizableFrame( {
173
210
  };
174
211
 
175
212
  const resizeHandleVariants = {
176
- default: {
213
+ hidden: {
214
+ opacity: 0,
215
+ left: 0,
216
+ },
217
+ visible: {
177
218
  opacity: 1,
178
219
  left: -16,
179
220
  },
180
- resizing: {
221
+ active: {
181
222
  opacity: 1,
182
223
  left: -16,
183
224
  scaleY: 1.3,
184
225
  },
185
226
  };
227
+ const currentResizeHandleVariant = ( () => {
228
+ if ( isResizing ) {
229
+ return 'active';
230
+ }
231
+ return shouldShowHandle ? 'visible' : 'hidden';
232
+ } )();
186
233
 
187
234
  return (
188
235
  <ResizableBox
@@ -217,28 +264,50 @@ function ResizableFrame( {
217
264
  minWidth={ FRAME_MIN_WIDTH }
218
265
  maxWidth={ isFullWidth ? '100%' : '150%' }
219
266
  maxHeight={ '100%' }
220
- onMouseOver={ () => setIsHovering( true ) }
221
- onMouseOut={ () => setIsHovering( false ) }
267
+ onFocus={ () => setShouldShowHandle( true ) }
268
+ onBlur={ () => setShouldShowHandle( false ) }
269
+ onMouseOver={ () => setShouldShowHandle( true ) }
270
+ onMouseOut={ () => setShouldShowHandle( false ) }
222
271
  handleComponent={ {
223
- left:
224
- isHovering || isResizing ? (
225
- <motion.div
226
- key="handle"
227
- className="edit-site-resizable-frame__handle"
228
- variants={ resizeHandleVariants }
229
- animate={ isResizing ? 'resizing' : 'default' }
230
- title="Drag to resize"
231
- initial={ {
232
- opacity: 0,
233
- left: 0,
234
- } }
235
- exit={ {
236
- opacity: 0,
237
- left: 0,
238
- } }
239
- whileHover={ { scaleY: 1.3 } }
240
- />
241
- ) : null,
272
+ left: canvasMode === 'view' && (
273
+ <>
274
+ <Tooltip text={ __( 'Drag to resize' ) }>
275
+ { /* Disable reason: role="separator" does in fact support aria-valuenow */ }
276
+ { /* eslint-disable-next-line jsx-a11y/role-supports-aria-props */ }
277
+ <motion.button
278
+ key="handle"
279
+ role="separator"
280
+ aria-orientation="vertical"
281
+ className={ classnames(
282
+ 'edit-site-resizable-frame__handle',
283
+ { 'is-resizing': isResizing }
284
+ ) }
285
+ variants={ resizeHandleVariants }
286
+ animate={ currentResizeHandleVariant }
287
+ aria-label={ __( 'Drag to resize' ) }
288
+ aria-describedby={ resizableHandleHelpId }
289
+ aria-valuenow={
290
+ frameRef.current?.resizable?.offsetWidth ||
291
+ undefined
292
+ }
293
+ aria-valuemin={ FRAME_MIN_WIDTH }
294
+ aria-valuemax={
295
+ initialComputedWidthRef.current
296
+ }
297
+ onKeyDown={ handleResizableHandleKeyDown }
298
+ initial="hidden"
299
+ exit="hidden"
300
+ whileFocus="active"
301
+ whileHover="active"
302
+ />
303
+ </Tooltip>
304
+ <div hidden id={ resizableHandleHelpId }>
305
+ { __(
306
+ 'Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.'
307
+ ) }
308
+ </div>
309
+ </>
310
+ ),
242
311
  } }
243
312
  onResizeStart={ handleResizeStart }
244
313
  onResize={ handleResize }
@@ -1,6 +1,23 @@
1
1
  .edit-site-resizable-frame__inner {
2
2
  position: relative;
3
3
 
4
+ &.edit-site-layout__resizable-frame-oversized {
5
+ @at-root {
6
+ body:has(&) {
7
+ .edit-site-site-hub {
8
+ .edit-site-site-hub__site-title,
9
+ .edit-site-site-hub_toggle-command-center {
10
+ opacity: 0 !important;
11
+ }
12
+
13
+ .edit-site-site-hub__view-mode-toggle-container {
14
+ background-color: transparent;
15
+ }
16
+ }
17
+ }
18
+ }
19
+ }
20
+
4
21
  &.is-resizing {
5
22
  @at-root {
6
23
  body:has(&) {
@@ -30,11 +47,13 @@
30
47
  .edit-site-resizable-frame__handle {
31
48
  align-items: center;
32
49
  background-color: rgba($gray-700, 0.4);
50
+ border: 0;
33
51
  border-radius: $grid-unit-05;
34
52
  cursor: col-resize;
35
53
  display: flex;
36
54
  height: $grid-unit-80;
37
55
  justify-content: flex-end;
56
+ padding: 0;
38
57
  position: absolute;
39
58
  top: calc(50% - #{$grid-unit-40});
40
59
  width: $grid-unit-05;
@@ -56,16 +75,14 @@
56
75
  width: $grid-unit-40;
57
76
  }
58
77
 
59
- &:hover,
60
- .is-resizing & {
61
- background-color: var(--wp-admin-theme-color);
78
+ &:focus-visible {
79
+ // Works with Windows high contrast mode while also hiding weird outline in Safari.
80
+ outline: 2px solid transparent;
62
81
  }
63
82
 
64
- .edit-site-resizable-frame__handle-label {
65
- background: var(--wp-admin-theme-color);
66
- border-radius: 2px;
67
- color: #fff;
68
- margin-right: $grid-unit-10;
69
- padding: 4px 8px;
83
+ &:hover,
84
+ &:focus,
85
+ &.is-resizing {
86
+ background-color: var(--wp-admin-theme-color);
70
87
  }
71
88
  }
@@ -11,6 +11,10 @@
11
11
  &[aria-current] {
12
12
  color: $gray-200;
13
13
  background: $gray-800;
14
+
15
+ .edit-site-sidebar-navigation-item__drilldown-indicator {
16
+ fill: $gray-200;
17
+ }
14
18
  }
15
19
 
16
20
  &[aria-current] {
@@ -19,7 +23,7 @@
19
23
  }
20
24
 
21
25
  .edit-site-sidebar-navigation-item__drilldown-indicator {
22
- fill: $gray-700;
26
+ fill: $gray-600;
23
27
  }
24
28
 
25
29
  &:is(a) {
@@ -31,6 +35,11 @@
31
35
  box-shadow: none;
32
36
  outline: none;
33
37
  }
38
+
39
+ &:focus-visible {
40
+ box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
41
+ outline: 2px solid transparent;
42
+ }
34
43
  }
35
44
 
36
45
  &.with-suffix {
@@ -4,7 +4,6 @@
4
4
  import {
5
5
  __experimentalHStack as HStack,
6
6
  __experimentalHeading as Heading,
7
- __experimentalNavigatorToParentButton as NavigatorToParentButton,
8
7
  __experimentalUseNavigator as useNavigator,
9
8
  __experimentalVStack as VStack,
10
9
  } from '@wordpress/components';
@@ -41,7 +40,7 @@ export default function SidebarNavigationScreen( {
41
40
  };
42
41
  }, [] );
43
42
  const { getTheme } = useSelect( coreStore );
44
- const { goTo } = useNavigator();
43
+ const navigator = useNavigator();
45
44
  const theme = getTheme( currentlyPreviewingTheme() );
46
45
  const icon = isRTL() ? chevronRight : chevronLeft;
47
46
 
@@ -58,16 +57,24 @@ export default function SidebarNavigationScreen( {
58
57
  className="edit-site-sidebar-navigation-screen__title-icon"
59
58
  >
60
59
  { ! isRoot && ! backPath && (
61
- <NavigatorToParentButton
62
- as={ SidebarButton }
63
- icon={ isRTL() ? chevronRight : chevronLeft }
60
+ <SidebarButton
61
+ onClick={ () => {
62
+ if ( navigator.location.isInitial ) {
63
+ navigator.goToParent( { replace: true } );
64
+ } else {
65
+ navigator.goBack();
66
+ }
67
+ } }
68
+ icon={ icon }
64
69
  label={ __( 'Back' ) }
65
70
  showTooltip={ false }
66
71
  />
67
72
  ) }
68
73
  { ! isRoot && backPath && (
69
74
  <SidebarButton
70
- onClick={ () => goTo( backPath, { isBack: true } ) }
75
+ onClick={ () =>
76
+ navigator.goTo( backPath, { isBack: true } )
77
+ }
71
78
  icon={ icon }
72
79
  label={ __( 'Back' ) }
73
80
  showTooltip={ false }
@@ -78,7 +85,7 @@ export default function SidebarNavigationScreen( {
78
85
  icon={ icon }
79
86
  label={
80
87
  ! isPreviewingTheme()
81
- ? __( 'Go back to the Dashboard' )
88
+ ? __( 'Go to the Dashboard' )
82
89
  : __( 'Go back to the theme showcase' )
83
90
  }
84
91
  href={
@@ -28,9 +28,7 @@ export default function TemplatePartHint() {
28
28
  setPreference( 'core', PREFERENCE_NAME, false );
29
29
  } }
30
30
  >
31
- { __(
32
- 'Looking for template parts? You can now find them in the new "Patterns" page.'
33
- ) }
31
+ { __( 'Looking for template parts? Find them in "Patterns".' ) }
34
32
  </Notice>
35
33
  );
36
34
  }
@@ -33,6 +33,7 @@ export default function ScreenNavigationMoreMenu( props ) {
33
33
  <>
34
34
  <DropdownMenu
35
35
  className="sidebar-navigation__more-menu"
36
+ label={ __( 'Actions' ) }
36
37
  icon={ moreVertical }
37
38
  popoverProps={ POPOVER_PROPS }
38
39
  >
@@ -23,13 +23,13 @@ export default function SingleNavigationMenu( {
23
23
  <SidebarNavigationScreenWrapper
24
24
  actions={
25
25
  <>
26
- <EditButton postId={ navigationMenu?.id } />
27
26
  <ScreenNavigationMoreMenu
28
27
  menuTitle={ decodeEntities( menuTitle ) }
29
28
  onDelete={ handleDelete }
30
29
  onSave={ handleSave }
31
30
  onDuplicate={ handleDuplicate }
32
31
  />
32
+ <EditButton postId={ navigationMenu?.id } />
33
33
  </>
34
34
  }
35
35
  title={ decodeEntities( menuTitle ) }
@@ -9,42 +9,10 @@ import classnames from 'classnames';
9
9
  import { __, sprintf } from '@wordpress/i18n';
10
10
  import { dateI18n, getDate, humanTimeDiff } from '@wordpress/date';
11
11
  import { createInterpolateElement } from '@wordpress/element';
12
- import { Path, SVG } from '@wordpress/primitives';
13
-
14
- const publishedIcon = (
15
- <SVG fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
16
- <Path
17
- fillRule="evenodd"
18
- clipRule="evenodd"
19
- d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16Zm-1.067-5.6 4.2-5.667.8.6-4.8 6.467-3-2.267.6-.8 2.2 1.667Z"
20
- />
21
- </SVG>
22
- );
23
-
24
- const draftIcon = (
25
- <SVG fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
26
- <Path
27
- fillRule="evenodd"
28
- clipRule="evenodd"
29
- d="M14.5 8a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0ZM16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-8 4a4 4 0 0 0 0-8v8Z"
30
- />
31
- </SVG>
32
- );
33
-
34
- const pendingIcon = (
35
- <SVG fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
36
- <Path
37
- fillRule="evenodd"
38
- clipRule="evenodd"
39
- d="M14.5 8a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0ZM16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0ZM8 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z"
40
- />
41
- </SVG>
42
- );
43
12
 
44
13
  export default function StatusLabel( { status, date, short } ) {
45
14
  const relateToNow = humanTimeDiff( date );
46
15
  let statusLabel = status;
47
- let statusIcon = pendingIcon;
48
16
  switch ( status ) {
49
17
  case 'publish':
50
18
  statusLabel = date
@@ -57,7 +25,6 @@ export default function StatusLabel( { status, date, short } ) {
57
25
  { time: <time dateTime={ date } /> }
58
26
  )
59
27
  : __( 'Published' );
60
- statusIcon = publishedIcon;
61
28
  break;
62
29
  case 'future':
63
30
  const formattedDate = dateI18n(
@@ -77,7 +44,6 @@ export default function StatusLabel( { status, date, short } ) {
77
44
  break;
78
45
  case 'draft':
79
46
  statusLabel = __( 'Draft' );
80
- statusIcon = draftIcon;
81
47
  break;
82
48
  case 'pending':
83
49
  statusLabel = __( 'Pending' );
@@ -99,7 +65,7 @@ export default function StatusLabel( { status, date, short } ) {
99
65
  }
100
66
  ) }
101
67
  >
102
- { statusIcon } { statusLabel }
68
+ { statusLabel }
103
69
  </div>
104
70
  );
105
71
  }
@@ -58,13 +58,16 @@ export default function SidebarNavigationScreenPages() {
58
58
  templates?.find( ( template ) => template.slug === 'home' ) ||
59
59
  templates?.find( ( template ) => template.slug === 'index' );
60
60
 
61
+ const getPostsPageTemplate = () =>
62
+ templates?.find( ( template ) => template.slug === 'home' ) ||
63
+ templates?.find( ( template ) => template.slug === 'index' );
64
+
61
65
  const pagesAndTemplates = pages?.concat( dynamicPageTemplates, [
62
66
  homeTemplate,
63
67
  ] );
64
68
 
65
69
  const { frontPage, postsPage } = useSelect( ( select ) => {
66
70
  const { getEntityRecord } = select( coreStore );
67
-
68
71
  const siteSettings = getEntityRecord( 'root', 'site' );
69
72
  return {
70
73
  frontPage: siteSettings?.page_on_front,
@@ -106,6 +109,27 @@ export default function SidebarNavigationScreenPages() {
106
109
  setShowAddPage( false );
107
110
  };
108
111
 
112
+ const getPageProps = ( id ) => {
113
+ let itemIcon = page;
114
+ const postsPageTemplateId =
115
+ postsPage && postsPage === id ? getPostsPageTemplate()?.id : null;
116
+
117
+ switch ( id ) {
118
+ case frontPage:
119
+ itemIcon = home;
120
+ break;
121
+ case postsPage:
122
+ itemIcon = verse;
123
+ break;
124
+ }
125
+
126
+ return {
127
+ icon: itemIcon,
128
+ postType: postsPageTemplateId ? 'wp_template' : 'page',
129
+ postId: postsPageTemplateId || id,
130
+ };
131
+ };
132
+
109
133
  return (
110
134
  <>
111
135
  { showAddPage && (
@@ -152,34 +176,20 @@ export default function SidebarNavigationScreenPages() {
152
176
  </Truncate>
153
177
  </PageItem>
154
178
  ) }
155
- { reorderedPages?.map( ( item ) => {
156
- let itemIcon;
157
- switch ( item.id ) {
158
- case frontPage:
159
- itemIcon = home;
160
- break;
161
- case postsPage:
162
- itemIcon = verse;
163
- break;
164
- default:
165
- itemIcon = page;
166
- }
167
- return (
168
- <PageItem
169
- postId={ item.id }
170
- key={ item.id }
171
- icon={ itemIcon }
172
- withChevron
173
- >
174
- <Truncate numberOfLines={ 1 }>
175
- { decodeEntities(
176
- item?.title?.rendered ||
177
- __( '(no title)' )
178
- ) }
179
- </Truncate>
180
- </PageItem>
181
- );
182
- } ) }
179
+ { reorderedPages?.map( ( { id, title } ) => (
180
+ <PageItem
181
+ { ...getPageProps( id ) }
182
+ key={ id }
183
+ withChevron
184
+ >
185
+ <Truncate numberOfLines={ 1 }>
186
+ { decodeEntities(
187
+ title?.rendered ||
188
+ __( '(no title)' )
189
+ ) }
190
+ </Truncate>
191
+ </PageItem>
192
+ ) ) }
183
193
  </ItemGroup>
184
194
  ) }
185
195
  </>
@@ -19,8 +19,9 @@ export default function TemplatePartNavigationMenu( { id } ) {
19
19
  <>
20
20
  <Heading
21
21
  className="edit-site-sidebar-navigation-screen-template-part-navigation-menu__title"
22
- size="12"
22
+ size="11"
23
23
  upperCase={ true }
24
+ weight={ 500 }
24
25
  >
25
26
  { title?.rendered || __( 'Navigation' ) }
26
27
  </Heading>
@@ -22,8 +22,9 @@ export default function TemplatePartNavigationMenus( { menus } ) {
22
22
  <>
23
23
  <Heading
24
24
  className="edit-site-sidebar-navigation-screen-template-part-navigation-menu__title"
25
- size="12"
25
+ size="11"
26
26
  upperCase={ true }
27
+ weight={ 500 }
27
28
  >
28
29
  { __( 'Navigation' ) }
29
30
  </Heading>
@@ -35,7 +35,6 @@ function TemplatePartGroup( { areas, currentArea, currentType } ) {
35
35
  <>
36
36
  <div className="edit-site-sidebar-navigation-screen-patterns__group-header">
37
37
  <Heading level={ 2 }>{ __( 'Template parts' ) }</Heading>
38
- <p>{ __( 'Synced patterns for use in template building.' ) }</p>
39
38
  </div>
40
39
  <ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
41
40
  { Object.entries( areas ).map(
@@ -64,11 +63,6 @@ function ThemePatternsGroup( { categories, currentCategory, currentType } ) {
64
63
  <>
65
64
  <div className="edit-site-sidebar-navigation-screen-patterns__group-header">
66
65
  <Heading level={ 2 }>{ __( 'Theme patterns' ) }</Heading>
67
- <p>
68
- { __(
69
- 'For insertion into documents where they can then be customized.'
70
- ) }
71
- </p>
72
66
  </div>
73
67
  <ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
74
68
  { categories.map( ( category ) => (
@@ -113,7 +107,7 @@ export default function SidebarNavigationScreenPatterns() {
113
107
  const { templatePartAreas, hasTemplateParts, isLoading } =
114
108
  useTemplatePartAreas();
115
109
  const { patternCategories, hasPatterns } = usePatternCategories();
116
- const { myPatterns, hasPatterns: hasMyPatterns } = useMyPatterns();
110
+ const { myPatterns } = useMyPatterns();
117
111
 
118
112
  const isTemplatePartsMode = useSelect( ( select ) => {
119
113
  const settings = select( editSiteStore ).getSettings();
@@ -159,23 +153,25 @@ export default function SidebarNavigationScreenPatterns() {
159
153
  </Item>
160
154
  </ItemGroup>
161
155
  ) }
162
- { hasMyPatterns && (
163
- <ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
164
- <CategoryItem
165
- key={ myPatterns.name }
166
- count={ myPatterns.count }
167
- label={ myPatterns.label }
168
- icon={ starFilled }
169
- id={ myPatterns.name }
170
- type="wp_block"
171
- isActive={
172
- currentCategory ===
173
- `${ myPatterns.name }` &&
174
- currentType === 'wp_block'
175
- }
176
- />
177
- </ItemGroup>
178
- ) }
156
+ <ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
157
+ <CategoryItem
158
+ key={ myPatterns.name }
159
+ count={
160
+ ! myPatterns.count
161
+ ? '0'
162
+ : myPatterns.count
163
+ }
164
+ label={ myPatterns.label }
165
+ icon={ starFilled }
166
+ id={ myPatterns.name }
167
+ type="wp_block"
168
+ isActive={
169
+ currentCategory ===
170
+ `${ myPatterns.name }` &&
171
+ currentType === 'wp_block'
172
+ }
173
+ />
174
+ </ItemGroup>
179
175
  { hasTemplateParts && (
180
176
  <TemplatePartGroup
181
177
  areas={ templatePartAreas }
@@ -1,8 +1,5 @@
1
1
  .edit-site-sidebar-navigation-screen-patterns__group {
2
2
  margin-bottom: $grid-unit-40;
3
- padding-bottom: $grid-unit-30;
4
- border-bottom: 1px solid $gray-800;
5
-
6
3
  &:last-of-type,
7
4
  &:first-of-type {
8
5
  border-bottom: 0;