@wordpress/edit-site 6.0.0 → 6.1.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 (205) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-page/index.js +2 -1
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/app/index.js +17 -1
  5. package/build/components/app/index.js.map +1 -1
  6. package/build/components/editor/index.js +55 -69
  7. package/build/components/editor/index.js.map +1 -1
  8. package/build/components/editor/use-editor-title.js +39 -0
  9. package/build/components/editor/use-editor-title.js.map +1 -0
  10. package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  11. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  12. package/build/components/global-styles/screen-css.js +1 -1
  13. package/build/components/global-styles/screen-css.js.map +1 -1
  14. package/build/components/global-styles/screen-revisions/index.js +4 -23
  15. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  16. package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  17. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  18. package/build/components/global-styles/shadows-edit-panel.js +1 -0
  19. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  20. package/build/components/global-styles/variations/variation.js +11 -16
  21. package/build/components/global-styles/variations/variation.js.map +1 -1
  22. package/build/components/global-styles/variations/variations-color.js +2 -1
  23. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  24. package/build/components/global-styles/variations/variations-typography.js +1 -0
  25. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  26. package/build/components/global-styles-sidebar/index.js +2 -0
  27. package/build/components/global-styles-sidebar/index.js.map +1 -1
  28. package/build/components/layout/index.js +23 -95
  29. package/build/components/layout/index.js.map +1 -1
  30. package/build/components/page/header.js +1 -0
  31. package/build/components/page/header.js.map +1 -1
  32. package/build/components/page-patterns/header.js +2 -1
  33. package/build/components/page-patterns/header.js.map +1 -1
  34. package/build/components/page-patterns/index.js +5 -5
  35. package/build/components/page-patterns/index.js.map +1 -1
  36. package/build/components/pagination/index.js +17 -8
  37. package/build/components/pagination/index.js.map +1 -1
  38. package/build/components/posts-app/index.js +50 -0
  39. package/build/components/posts-app/index.js.map +1 -0
  40. package/build/components/sidebar-dataviews/dataview-item.js +6 -2
  41. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  42. package/build/components/sidebar-navigation-screen/index.js +1 -1
  43. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  44. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  45. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
  46. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
  47. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  48. package/build/components/sidebar-navigation-screen-patterns/category-item.js +1 -1
  49. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  50. package/build/components/sidebar-navigation-screen-patterns/index.js +1 -1
  51. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  52. package/build/components/site-hub/index.js +38 -128
  53. package/build/components/site-hub/index.js.map +1 -1
  54. package/build/hooks/commands/use-set-command-context.js +53 -0
  55. package/build/hooks/commands/use-set-command-context.js.map +1 -0
  56. package/build/hooks/push-changes-to-global-styles/index.js +3 -2
  57. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  58. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +20 -88
  59. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  60. package/build/index.js +15 -2
  61. package/build/index.js.map +1 -1
  62. package/build/posts.js +34 -0
  63. package/build/posts.js.map +1 -0
  64. package/build/store/private-actions.js +33 -18
  65. package/build/store/private-actions.js.map +1 -1
  66. package/build-module/components/add-new-page/index.js +2 -1
  67. package/build-module/components/add-new-page/index.js.map +1 -1
  68. package/build-module/components/app/index.js +17 -1
  69. package/build-module/components/app/index.js.map +1 -1
  70. package/build-module/components/editor/index.js +55 -69
  71. package/build-module/components/editor/index.js.map +1 -1
  72. package/build-module/components/editor/use-editor-title.js +31 -0
  73. package/build-module/components/editor/use-editor-title.js.map +1 -0
  74. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  75. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  76. package/build-module/components/global-styles/screen-css.js +1 -1
  77. package/build-module/components/global-styles/screen-css.js.map +1 -1
  78. package/build-module/components/global-styles/screen-revisions/index.js +4 -23
  79. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  80. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  81. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  82. package/build-module/components/global-styles/shadows-edit-panel.js +1 -0
  83. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  84. package/build-module/components/global-styles/variations/variation.js +11 -16
  85. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  86. package/build-module/components/global-styles/variations/variations-color.js +3 -2
  87. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  88. package/build-module/components/global-styles/variations/variations-typography.js +1 -0
  89. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  90. package/build-module/components/global-styles-sidebar/index.js +2 -0
  91. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  92. package/build-module/components/layout/index.js +27 -99
  93. package/build-module/components/layout/index.js.map +1 -1
  94. package/build-module/components/page/header.js +1 -0
  95. package/build-module/components/page/header.js.map +1 -1
  96. package/build-module/components/page-patterns/header.js +2 -1
  97. package/build-module/components/page-patterns/header.js.map +1 -1
  98. package/build-module/components/page-patterns/index.js +5 -5
  99. package/build-module/components/page-patterns/index.js.map +1 -1
  100. package/build-module/components/pagination/index.js +17 -8
  101. package/build-module/components/pagination/index.js.map +1 -1
  102. package/build-module/components/posts-app/index.js +43 -0
  103. package/build-module/components/posts-app/index.js.map +1 -0
  104. package/build-module/components/sidebar-dataviews/dataview-item.js +6 -2
  105. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  106. package/build-module/components/sidebar-navigation-screen/index.js +1 -1
  107. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  108. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  109. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
  110. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
  111. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  112. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +2 -2
  113. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  114. package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -1
  115. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  116. package/build-module/components/site-hub/index.js +40 -130
  117. package/build-module/components/site-hub/index.js.map +1 -1
  118. package/build-module/hooks/commands/use-set-command-context.js +46 -0
  119. package/build-module/hooks/commands/use-set-command-context.js.map +1 -0
  120. package/build-module/hooks/push-changes-to-global-styles/index.js +3 -2
  121. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  122. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +19 -86
  123. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  124. package/build-module/index.js +8 -2
  125. package/build-module/index.js.map +1 -1
  126. package/build-module/posts.js +27 -0
  127. package/build-module/posts.js.map +1 -0
  128. package/build-module/store/private-actions.js +33 -18
  129. package/build-module/store/private-actions.js.map +1 -1
  130. package/build-style/posts-rtl.css +1707 -0
  131. package/build-style/posts.css +1707 -0
  132. package/build-style/style-rtl.css +59 -104
  133. package/build-style/style.css +59 -104
  134. package/package.json +41 -41
  135. package/src/components/add-new-page/index.js +2 -1
  136. package/src/components/app/index.js +17 -1
  137. package/src/components/block-editor/style.scss +11 -0
  138. package/src/components/editor/index.js +69 -103
  139. package/src/components/editor/style.scss +1 -5
  140. package/src/components/editor/use-editor-title.js +35 -0
  141. package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  142. package/src/components/global-styles/screen-css.js +1 -1
  143. package/src/components/global-styles/screen-revisions/index.js +4 -24
  144. package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  145. package/src/components/global-styles/screen-revisions/style.scss +4 -8
  146. package/src/components/global-styles/shadows-edit-panel.js +1 -0
  147. package/src/components/global-styles/style.scss +1 -7
  148. package/src/components/global-styles/variations/variation.js +14 -19
  149. package/src/components/global-styles/variations/variations-color.js +12 -4
  150. package/src/components/global-styles/variations/variations-typography.js +5 -1
  151. package/src/components/global-styles-sidebar/index.js +2 -0
  152. package/src/components/global-styles-sidebar/style.scss +0 -1
  153. package/src/components/layout/index.js +41 -137
  154. package/src/components/layout/style.scss +18 -58
  155. package/src/components/page/header.js +1 -0
  156. package/src/components/page/style.scss +6 -0
  157. package/src/components/page-patterns/header.js +8 -2
  158. package/src/components/page-patterns/index.js +15 -12
  159. package/src/components/page-patterns/style.scss +6 -0
  160. package/src/components/pagination/index.js +21 -16
  161. package/src/components/posts-app/index.js +39 -0
  162. package/src/components/sidebar/style.scss +4 -4
  163. package/src/components/sidebar-dataviews/dataview-item.js +6 -2
  164. package/src/components/sidebar-navigation-screen/index.js +1 -1
  165. package/src/components/sidebar-navigation-screen/style.scss +2 -2
  166. package/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  167. package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
  168. package/src/components/sidebar-navigation-screen-patterns/category-item.js +11 -2
  169. package/src/components/sidebar-navigation-screen-patterns/index.js +5 -1
  170. package/src/components/site-hub/index.js +55 -146
  171. package/src/components/site-hub/style.scss +1 -4
  172. package/src/components/site-icon/style.scss +0 -4
  173. package/src/hooks/commands/use-set-command-context.js +37 -0
  174. package/src/hooks/push-changes-to-global-styles/index.js +3 -2
  175. package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +1 -875
  176. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +29 -117
  177. package/src/index.js +10 -2
  178. package/src/posts.js +29 -0
  179. package/src/posts.scss +46 -0
  180. package/src/store/private-actions.js +58 -30
  181. package/build/components/block-editor/block-inspector-button.js +0 -57
  182. package/build/components/block-editor/block-inspector-button.js.map +0 -1
  183. package/build/components/block-editor/inserter-media-categories.js +0 -183
  184. package/build/components/block-editor/inserter-media-categories.js.map +0 -1
  185. package/build/components/template-part-converter/convert-to-regular.js +0 -38
  186. package/build/components/template-part-converter/convert-to-regular.js.map +0 -1
  187. package/build/components/template-part-converter/convert-to-template-part.js +0 -84
  188. package/build/components/template-part-converter/convert-to-template-part.js.map +0 -1
  189. package/build/components/template-part-converter/index.js +0 -67
  190. package/build/components/template-part-converter/index.js.map +0 -1
  191. package/build-module/components/block-editor/block-inspector-button.js +0 -50
  192. package/build-module/components/block-editor/block-inspector-button.js.map +0 -1
  193. package/build-module/components/block-editor/inserter-media-categories.js +0 -177
  194. package/build-module/components/block-editor/inserter-media-categories.js.map +0 -1
  195. package/build-module/components/template-part-converter/convert-to-regular.js +0 -31
  196. package/build-module/components/template-part-converter/convert-to-regular.js.map +0 -1
  197. package/build-module/components/template-part-converter/convert-to-template-part.js +0 -79
  198. package/build-module/components/template-part-converter/convert-to-template-part.js.map +0 -1
  199. package/build-module/components/template-part-converter/index.js +0 -59
  200. package/build-module/components/template-part-converter/index.js.map +0 -1
  201. package/src/components/block-editor/block-inspector-button.js +0 -60
  202. package/src/components/block-editor/inserter-media-categories.js +0 -227
  203. package/src/components/template-part-converter/convert-to-regular.js +0 -32
  204. package/src/components/template-part-converter/convert-to-template-part.js +0 -78
  205. package/src/components/template-part-converter/index.js +0 -59
@@ -16,100 +16,65 @@ import {
16
16
  useReducedMotion,
17
17
  useViewportMatch,
18
18
  useResizeObserver,
19
+ usePrevious,
19
20
  } from '@wordpress/compose';
20
21
  import { __ } from '@wordpress/i18n';
21
- import { useState } from '@wordpress/element';
22
+ import { useState, useRef, useEffect } from '@wordpress/element';
22
23
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
23
- import {
24
- CommandMenu,
25
- privateApis as commandsPrivateApis,
26
- } from '@wordpress/commands';
27
- import { store as preferencesStore } from '@wordpress/preferences';
28
- import {
29
- privateApis as blockEditorPrivateApis,
30
- store as blockEditorStore,
31
- } from '@wordpress/block-editor';
32
- import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
24
+ import { CommandMenu } from '@wordpress/commands';
25
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
33
26
  import {
34
27
  EditorSnackbars,
35
28
  privateApis as editorPrivateApis,
36
29
  } from '@wordpress/editor';
30
+ import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
37
31
 
38
32
  /**
39
33
  * Internal dependencies
40
34
  */
41
35
  import ErrorBoundary from '../error-boundary';
42
36
  import { store as editSiteStore } from '../../store';
43
- import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
44
37
  import SiteHub from '../site-hub';
45
38
  import ResizableFrame from '../resizable-frame';
46
- import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
47
39
  import { unlock } from '../../lock-unlock';
48
40
  import SavePanel from '../save-panel';
49
41
  import KeyboardShortcutsRegister from '../keyboard-shortcuts/register';
50
42
  import KeyboardShortcutsGlobal from '../keyboard-shortcuts/global';
51
- import { useCommonCommands } from '../../hooks/commands/use-common-commands';
52
- import { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';
53
43
  import { useIsSiteEditorLoading } from './hooks';
54
- import useLayoutAreas from './router';
55
44
  import useMovingAnimation from './animation';
56
45
  import SidebarContent from '../sidebar';
57
46
  import SaveHub from '../save-hub';
47
+ import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
58
48
 
59
49
  const { useCommands } = unlock( coreCommandsPrivateApis );
60
- const { useCommandContext } = unlock( commandsPrivateApis );
61
50
  const { useGlobalStyle } = unlock( blockEditorPrivateApis );
62
51
  const { NavigableRegion } = unlock( editorPrivateApis );
63
52
 
64
53
  const ANIMATION_DURATION = 0.3;
65
54
 
66
- export default function Layout() {
67
- // This ensures the edited entity id and type are initialized properly.
68
- useInitEditedEntityFromURL();
55
+ export default function Layout( { route } ) {
69
56
  useSyncCanvasModeWithURL();
70
57
  useCommands();
71
- useEditModeCommands();
72
- useCommonCommands();
73
-
74
58
  const isMobileViewport = useViewportMatch( 'medium', '<' );
75
-
76
- const {
77
- isDistractionFree,
78
- hasFixedToolbar,
79
- hasBlockSelected,
80
- canvasMode,
81
- previousShortcut,
82
- nextShortcut,
83
- hasBlockBreadcrumbs,
84
- } = useSelect( ( select ) => {
85
- const { getAllShortcutKeyCombinations } = select(
86
- keyboardShortcutsStore
87
- );
88
- const { getCanvasMode } = unlock( select( editSiteStore ) );
89
- return {
90
- canvasMode: getCanvasMode(),
91
- previousShortcut: getAllShortcutKeyCombinations(
92
- 'core/editor/previous-region'
93
- ),
94
- nextShortcut: getAllShortcutKeyCombinations(
95
- 'core/editor/next-region'
96
- ),
97
- hasFixedToolbar: select( preferencesStore ).get(
98
- 'core',
99
- 'fixedToolbar'
100
- ),
101
- isDistractionFree: select( preferencesStore ).get(
102
- 'core',
103
- 'distractionFree'
104
- ),
105
- hasBlockBreadcrumbs: select( preferencesStore ).get(
106
- 'core',
107
- 'showBlockBreadcrumbs'
108
- ),
109
- hasBlockSelected:
110
- select( blockEditorStore ).getBlockSelectionStart(),
111
- };
112
- }, [] );
59
+ const toggleRef = useRef();
60
+ const { canvasMode, previousShortcut, nextShortcut } = useSelect(
61
+ ( select ) => {
62
+ const { getAllShortcutKeyCombinations } = select(
63
+ keyboardShortcutsStore
64
+ );
65
+ const { getCanvasMode } = unlock( select( editSiteStore ) );
66
+ return {
67
+ canvasMode: getCanvasMode(),
68
+ previousShortcut: getAllShortcutKeyCombinations(
69
+ 'core/editor/previous-region'
70
+ ),
71
+ nextShortcut: getAllShortcutKeyCombinations(
72
+ 'core/editor/next-region'
73
+ ),
74
+ };
75
+ },
76
+ []
77
+ );
113
78
  const navigateRegionsProps = useNavigateRegions( {
114
79
  previous: previousShortcut,
115
80
  next: nextShortcut,
@@ -120,45 +85,21 @@ export default function Layout() {
120
85
  const isEditorLoading = useIsSiteEditorLoading();
121
86
  const [ isResizableFrameOversized, setIsResizableFrameOversized ] =
122
87
  useState( false );
123
- const { key: routeKey, areas, widths } = useLayoutAreas();
88
+ const { key: routeKey, areas, widths } = route;
124
89
  const animationRef = useMovingAnimation( {
125
90
  triggerAnimationOnChange: canvasMode + '__' + routeKey,
126
91
  } );
127
92
 
128
- // This determines which animation variant should apply to the header.
129
- // There is also a `isDistractionFreeHovering` state that gets priority
130
- // when hovering the `edit-site-layout__header-container` in distraction
131
- // free mode. It's set via framer and trickles down to all the children
132
- // so they can use this variant state too.
133
- //
134
- // TODO: The issue with this is we want to have the hover state stick when hovering
135
- // a popover opened via the header. We'll probably need to lift this state to
136
- // handle it ourselves. Also, focusWithin the header needs to be handled.
137
- let headerAnimationState;
138
-
139
- if ( canvasMode === 'view' ) {
140
- // We need 'view' to always take priority so 'isDistractionFree'
141
- // doesn't bleed over into the view (sidebar) state
142
- headerAnimationState = 'view';
143
- } else if ( isDistractionFree ) {
144
- headerAnimationState = 'isDistractionFree';
145
- } else {
146
- headerAnimationState = canvasMode; // edit, view, init
147
- }
148
-
149
- // Sets the right context for the command palette
150
- let commandContext = 'site-editor';
151
-
152
- if ( canvasMode === 'edit' ) {
153
- commandContext = 'entity-edit';
154
- }
155
- if ( hasBlockSelected ) {
156
- commandContext = 'block-selection-edit';
157
- }
158
- useCommandContext( commandContext );
159
-
160
93
  const [ backgroundColor ] = useGlobalStyle( 'color.background' );
161
94
  const [ gradientValue ] = useGlobalStyle( 'color.gradient' );
95
+ const previousCanvaMode = usePrevious( canvasMode );
96
+ useEffect( () => {
97
+ if ( previousCanvaMode === 'edit' ) {
98
+ toggleRef.current?.focus();
99
+ }
100
+ // Should not depend on the previous canvas mode value but the next.
101
+ // eslint-disable-next-line react-hooks/exhaustive-deps
102
+ }, [ canvasMode ] );
162
103
 
163
104
  // Synchronizing the URL with the store value of canvasMode happens in an effect
164
105
  // This condition ensures the component is only rendered after the synchronization happens
@@ -180,53 +121,10 @@ export default function Layout() {
180
121
  'edit-site-layout',
181
122
  navigateRegionsProps.className,
182
123
  {
183
- 'is-distraction-free':
184
- isDistractionFree && canvasMode === 'edit',
185
124
  'is-full-canvas': canvasMode === 'edit',
186
- 'has-fixed-toolbar': hasFixedToolbar,
187
- 'is-block-toolbar-visible': hasBlockSelected,
188
- 'has-block-breadcrumbs':
189
- hasBlockBreadcrumbs &&
190
- ! isDistractionFree &&
191
- canvasMode === 'edit',
192
125
  }
193
126
  ) }
194
127
  >
195
- <motion.div
196
- className="edit-site-layout__header-container"
197
- variants={ {
198
- isDistractionFree: {
199
- opacity: 0,
200
- transition: {
201
- type: 'tween',
202
- delay: 0.8,
203
- delayChildren: 0.8,
204
- }, // How long to wait before the header exits
205
- },
206
- isDistractionFreeHovering: {
207
- opacity: 1,
208
- transition: {
209
- type: 'tween',
210
- delay: 0.2,
211
- delayChildren: 0.2,
212
- }, // How long to wait before the header shows
213
- },
214
- view: { opacity: 1 },
215
- edit: { opacity: 1 },
216
- } }
217
- whileHover={
218
- isDistractionFree
219
- ? 'isDistractionFreeHovering'
220
- : undefined
221
- }
222
- animate={ headerAnimationState }
223
- >
224
- <SiteHub
225
- isTransparent={ isResizableFrameOversized }
226
- className="edit-site-layout__hub"
227
- />
228
- </motion.div>
229
-
230
128
  <div className="edit-site-layout__content">
231
129
  { /*
232
130
  The NavigableRegion must always be rendered and not use
@@ -255,6 +153,12 @@ export default function Layout() {
255
153
  } }
256
154
  className="edit-site-layout__sidebar"
257
155
  >
156
+ <SiteHub
157
+ ref={ toggleRef }
158
+ isTransparent={
159
+ isResizableFrameOversized
160
+ }
161
+ />
258
162
  <SidebarContent routeKey={ routeKey }>
259
163
  { areas.sidebar }
260
164
  </SidebarContent>
@@ -4,39 +4,13 @@
4
4
  color: $gray-400;
5
5
  display: flex;
6
6
  flex-direction: column;
7
- }
8
-
9
- .edit-site-layout__hub {
10
- position: fixed;
11
- top: 0;
12
- left: 0;
13
- width: calc(100vw - #{$canvas-padding * 2});
14
- height: $header-height;
15
- z-index: z-index(".edit-site-layout__hub");
16
-
17
- @include break-medium {
18
- width: calc(#{$nav-sidebar-width} - #{$grid-unit-15});
19
- }
20
-
21
- .edit-site-layout.is-full-canvas & {
22
- padding-right: 0;
23
- border-radius: 0;
24
- width: $header-height;
25
- box-shadow: none;
26
- }
27
- }
28
7
 
29
- .edit-site-layout__header-container:has(+ .edit-site-layout__content > .edit-site-layout__mobile>.edit-site-page) {
30
- margin-bottom: $header-height;
31
- @include break-medium {
32
- margin-bottom: 0;
8
+ // Show a dark background in "frame" mode to avoid edge artifacts.
9
+ &:not(.is-full-canvas) .editor-visual-editor {
10
+ background: $gray-900;
33
11
  }
34
12
  }
35
13
 
36
- .edit-site-layout__header-container {
37
- z-index: z-index(".edit-site-layout__header-container");
38
- }
39
-
40
14
  .edit-site-layout__content {
41
15
  height: 100%;
42
16
  flex-grow: 1;
@@ -158,10 +132,22 @@
158
132
  height: 100%;
159
133
  }
160
134
 
135
+ /* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
136
+ html.canvas-mode-edit-transition::view-transition-group(toggle) {
137
+ animation-delay: 255ms;
138
+ }
139
+ /* stylelint-enable */
140
+
141
+ .edit-site-layout.is-full-canvas .edit-site-layout__sidebar-region .edit-site-layout__view-mode-toggle {
142
+ display: none;
143
+ }
144
+
161
145
  .edit-site-layout__view-mode-toggle.components-button {
146
+ /* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
147
+ view-transition-name: toggle;
148
+ /* stylelint-enable */
162
149
  position: relative;
163
150
  color: $white;
164
- border-radius: 0;
165
151
  height: $header-height;
166
152
  width: $header-height;
167
153
  overflow: hidden;
@@ -169,6 +155,8 @@
169
155
  display: flex;
170
156
  align-items: center;
171
157
  justify-content: center;
158
+ background: $gray-900;
159
+ border-radius: 0;
172
160
 
173
161
  &:hover,
174
162
  &:active {
@@ -202,7 +190,6 @@
202
190
 
203
191
  .edit-site-layout__view-mode-toggle-icon {
204
192
  display: flex;
205
- border-radius: $radius-block-ui;
206
193
  height: $grid-unit-80;
207
194
  width: $grid-unit-80;
208
195
  justify-content: center;
@@ -239,33 +226,6 @@
239
226
  }
240
227
  }
241
228
 
242
- .edit-site-layout.is-distraction-free {
243
- .edit-site-layout__header-container {
244
- height: $header-height;
245
- position: absolute;
246
- top: 0;
247
- left: 0;
248
- right: 0;
249
- z-index: z-index(".edit-site-layout__header-container");
250
- width: 100%;
251
-
252
- // We need ! important because we override inline styles
253
- // set by the motion component.
254
- &:focus-within {
255
- opacity: 1 !important;
256
- div {
257
- transform: translateX(0) translateY(0) translateZ(0) !important;
258
- }
259
- }
260
- }
261
-
262
- .edit-site-site-hub {
263
- position: absolute;
264
- top: 0;
265
- z-index: z-index(".edit-site-layout__hub");
266
- }
267
- }
268
-
269
229
  .edit-site-layout__area {
270
230
  flex-grow: 1;
271
231
  margin: 0;
@@ -22,6 +22,7 @@ export default function Header( { title, subTitle, actions } ) {
22
22
  level={ 3 }
23
23
  weight={ 500 }
24
24
  className="edit-site-page-header__title"
25
+ truncate
25
26
  >
26
27
  { title }
27
28
  </Heading>
@@ -24,6 +24,12 @@
24
24
 
25
25
  .edit-site-page-header__page-title {
26
26
  min-height: $grid-unit-50;
27
+
28
+ .components-heading {
29
+ flex-grow: 1;
30
+ flex-basis: 0;
31
+ white-space: nowrap;
32
+ }
27
33
  }
28
34
 
29
35
  .edit-site-page-header__sub-title {
@@ -58,12 +58,18 @@ export default function PatternsHeader( {
58
58
  }
59
59
 
60
60
  return (
61
- <VStack className="edit-site-patterns__section-header" spacing={ 0 }>
61
+ <VStack className="edit-site-patterns__section-header" spacing={ 1 }>
62
62
  <HStack
63
63
  justify="space-between"
64
64
  className="edit-site-patterns__title"
65
65
  >
66
- <Heading as="h2" level={ 3 } id={ titleId } weight={ 500 }>
66
+ <Heading
67
+ as="h2"
68
+ level={ 3 }
69
+ id={ titleId }
70
+ weight={ 500 }
71
+ truncate
72
+ >
67
73
  { title }
68
74
  </Heading>
69
75
  <HStack expanded={ false }>
@@ -86,15 +86,12 @@ const DEFAULT_VIEW = {
86
86
  const SYNC_FILTERS = [
87
87
  {
88
88
  value: PATTERN_SYNC_TYPES.full,
89
- label: _x( 'Synced', 'Option that shows all synchronized patterns' ),
89
+ label: _x( 'Synced', 'pattern (singular)' ),
90
90
  description: __( 'Patterns that are kept in sync across the site.' ),
91
91
  },
92
92
  {
93
93
  value: PATTERN_SYNC_TYPES.unsynced,
94
- label: _x(
95
- 'Not synced',
96
- 'Option that shows all patterns that are not synchronized'
97
- ),
94
+ label: _x( 'Not synced', 'pattern (singular)' ),
98
95
  description: __(
99
96
  'Patterns that can be changed freely without affecting the site.'
100
97
  ),
@@ -298,13 +295,19 @@ export default function DataviewsPatterns() {
298
295
  <span
299
296
  className={ `edit-site-patterns__field-sync-status-${ item.syncStatus }` }
300
297
  >
301
- { SYNC_FILTERS.find(
302
- ( { value } ) => value === item.syncStatus
303
- )?.label ||
304
- SYNC_FILTERS.find(
305
- ( { value } ) =>
306
- value === PATTERN_SYNC_TYPES.unsynced
307
- ).label }
298
+ {
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
+ )
309
+ ).label
310
+ }
308
311
  </span>
309
312
  );
310
313
  },
@@ -98,6 +98,12 @@
98
98
 
99
99
  .edit-site-patterns__title {
100
100
  min-height: $grid-unit-50;
101
+
102
+ .components-heading {
103
+ flex-grow: 1;
104
+ flex-basis: 0;
105
+ white-space: nowrap;
106
+ }
101
107
  }
102
108
 
103
109
  .edit-site-patterns__sub-title {
@@ -12,6 +12,7 @@ import {
12
12
  Button,
13
13
  } from '@wordpress/components';
14
14
  import { __, _x, _n, sprintf } from '@wordpress/i18n';
15
+ import { previous, chevronLeft, chevronRight, next } from '@wordpress/icons';
15
16
 
16
17
  export default function Pagination( {
17
18
  currentPage,
@@ -46,19 +47,21 @@ export default function Pagination( {
46
47
  <Button
47
48
  variant={ buttonVariant }
48
49
  onClick={ () => changePage( 1 ) }
50
+ __experimentalIsFocusable
49
51
  disabled={ disabled || currentPage === 1 }
50
- aria-label={ __( 'First page' ) }
51
- >
52
- «
53
- </Button>
52
+ label={ __( 'First page' ) }
53
+ icon={ previous }
54
+ size="compact"
55
+ />
54
56
  <Button
55
57
  variant={ buttonVariant }
56
58
  onClick={ () => changePage( currentPage - 1 ) }
59
+ __experimentalIsFocusable
57
60
  disabled={ disabled || currentPage === 1 }
58
- aria-label={ __( 'Previous page' ) }
59
- >
60
-
61
- </Button>
61
+ label={ __( 'Previous page' ) }
62
+ icon={ chevronLeft }
63
+ size="compact"
64
+ />
62
65
  </HStack>
63
66
  <Text variant="muted">
64
67
  { sprintf(
@@ -72,19 +75,21 @@ export default function Pagination( {
72
75
  <Button
73
76
  variant={ buttonVariant }
74
77
  onClick={ () => changePage( currentPage + 1 ) }
78
+ __experimentalIsFocusable
75
79
  disabled={ disabled || currentPage === numPages }
76
- aria-label={ __( 'Next page' ) }
77
- >
78
-
79
- </Button>
80
+ label={ __( 'Next page' ) }
81
+ icon={ chevronRight }
82
+ size="compact"
83
+ />
80
84
  <Button
81
85
  variant={ buttonVariant }
82
86
  onClick={ () => changePage( numPages ) }
87
+ __experimentalIsFocusable
83
88
  disabled={ disabled || currentPage === numPages }
84
- aria-label={ __( 'Last page' ) }
85
- >
86
- »
87
- </Button>
89
+ label={ __( 'Last page' ) }
90
+ icon={ next }
91
+ size="compact"
92
+ />
88
93
  </HStack>
89
94
  </HStack>
90
95
  );
@@ -0,0 +1,39 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ UnsavedChangesWarning,
6
+ privateApis as editorPrivateApis,
7
+ } from '@wordpress/editor';
8
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import Layout from '../layout';
14
+ import Page from '../page';
15
+ import { unlock } from '../../lock-unlock';
16
+
17
+ const { RouterProvider } = unlock( routerPrivateApis );
18
+ const { GlobalStylesProvider } = unlock( editorPrivateApis );
19
+
20
+ const defaultRoute = {
21
+ key: 'index',
22
+ areas: {
23
+ sidebar: 'Empty Sidebar',
24
+ content: <Page>Welcome to Posts</Page>,
25
+ preview: undefined,
26
+ mobile: <Page>Welcome to Posts</Page>,
27
+ },
28
+ };
29
+
30
+ export default function PostsApp() {
31
+ return (
32
+ <GlobalStylesProvider>
33
+ <UnsavedChangesWarning />
34
+ <RouterProvider>
35
+ <Layout route={ defaultRoute } />
36
+ </RouterProvider>
37
+ </GlobalStylesProvider>
38
+ );
39
+ }
@@ -3,7 +3,7 @@
3
3
  overflow-y: auto;
4
4
  }
5
5
 
6
- @keyframes slide-from-right {
6
+ @keyframes local--slide-from-right {
7
7
  from {
8
8
  transform: translateX(50px);
9
9
  opacity: 0;
@@ -14,7 +14,7 @@
14
14
  }
15
15
  }
16
16
 
17
- @keyframes slide-from-left {
17
+ @keyframes local--slide-from-left {
18
18
  from {
19
19
  transform: translateX(-50px);
20
20
  opacity: 0;
@@ -47,11 +47,11 @@
47
47
  }
48
48
 
49
49
  &.slide-from-left {
50
- animation-name: slide-from-left;
50
+ animation-name: local--slide-from-left;
51
51
  }
52
52
 
53
53
  &.slide-from-right {
54
- animation-name: slide-from-right;
54
+ animation-name: local--slide-from-right;
55
55
  }
56
56
 
57
57
  }
@@ -35,11 +35,15 @@ export default function DataViewItem( {
35
35
  const iconToUse =
36
36
  icon || VIEW_LAYOUTS.find( ( v ) => v.type === type ).icon;
37
37
 
38
+ let activeView = isCustom ? customViewId : slug;
39
+ if ( activeView === 'all' ) {
40
+ activeView = undefined;
41
+ }
38
42
  const linkInfo = useLink( {
39
43
  postType,
40
44
  layout,
41
- activeView: isCustom ? customViewId : slug,
42
- isCustom: isCustom ? 'true' : 'false',
45
+ activeView,
46
+ isCustom: isCustom ? 'true' : undefined,
43
47
  } );
44
48
  return (
45
49
  <HStack
@@ -76,7 +76,7 @@ export default function SidebarNavigationScreen( {
76
76
  justify="flex-start"
77
77
  >
78
78
  <HStack
79
- spacing={ 4 }
79
+ spacing={ 3 }
80
80
  alignment="flex-start"
81
81
  className="edit-site-sidebar-navigation-screen__title-icon"
82
82
  >
@@ -59,7 +59,7 @@
59
59
  position: sticky;
60
60
  top: 0;
61
61
  background: $gray-900;
62
- padding-top: $grid-unit-60 + $header-height;
62
+ padding-top: $grid-unit-60;
63
63
  margin-bottom: $grid-unit-10;
64
64
  padding-bottom: $grid-unit-10;
65
65
  z-index: z-index(".edit-site-sidebar-navigation-screen__title-icon");
@@ -67,8 +67,8 @@
67
67
 
68
68
  .edit-site-sidebar-navigation-screen__title {
69
69
  flex-grow: 1;
70
- padding: $grid-unit-15 * 0.5 0 0 0;
71
70
  overflow-wrap: break-word;
71
+ padding: $grid-unit-05 * 0.5 0 0 0;
72
72
  }
73
73
 
74
74
  .edit-site-sidebar-navigation-screen__actions {
@@ -16,6 +16,7 @@ export default function DeleteConfirmDialog( { onClose, onConfirm } ) {
16
16
  } }
17
17
  onCancel={ onClose }
18
18
  confirmButtonText={ __( 'Delete' ) }
19
+ size="medium"
19
20
  >
20
21
  { __( 'Are you sure you want to delete this Navigation Menu?' ) }
21
22
  </ConfirmDialog>
@@ -43,6 +43,7 @@ export default function RenameModal( { menuTitle, onClose, onSave } ) {
43
43
 
44
44
  <Button
45
45
  __next40pxDefaultSize
46
+ __experimentalIsFocusable
46
47
  disabled={ ! isEditedMenuTitleValid }
47
48
  variant="primary"
48
49
  type="submit"