@wordpress/edit-site 5.0.0 → 5.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.
- package/CHANGELOG.md +12 -1
- package/build/components/block-editor/index.js +3 -2
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/editor/index.js +4 -16
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +20 -5
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +0 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/custom-css.js +1 -0
- package/build/components/global-styles/custom-css.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +3 -2
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +0 -1
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block.js +2 -6
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-border.js +4 -0
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +0 -2
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +4 -0
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-heading-color.js +1 -3
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +4 -0
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +0 -1
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +7 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +0 -1
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +4 -0
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +17 -5
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/utils.js +11 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +10 -41
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/layout/index.js +52 -83
- package/build/components/layout/index.js.map +1 -1
- package/build/components/sidebar/index.js +5 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +3 -1
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +1 -31
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +3 -22
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/site-hub/index.js +149 -0
- package/build/components/site-hub/index.js.map +1 -0
- package/build/components/use-edited-entity-record/index.js +60 -0
- package/build/components/use-edited-entity-record/index.js.map +1 -0
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +144 -0
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -0
- package/build/index.js +5 -0
- package/build/index.js.map +1 -1
- package/build-module/components/block-editor/index.js +3 -2
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/editor/index.js +1 -12
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +19 -5
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +0 -1
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +1 -0
- package/build-module/components/global-styles/custom-css.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +3 -2
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +0 -1
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +2 -5
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +3 -0
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +0 -2
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +3 -0
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-heading-color.js +1 -3
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +3 -0
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +0 -1
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +8 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +0 -1
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +3 -0
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +17 -5
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/utils.js +9 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +10 -38
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/layout/index.js +51 -81
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +4 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +3 -1
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +11 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +2 -27
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -23
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +126 -0
- package/build-module/components/site-hub/index.js.map +1 -0
- package/build-module/components/use-edited-entity-record/index.js +48 -0
- package/build-module/components/use-edited-entity-record/index.js.map +1 -0
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +132 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -0
- package/build-module/index.js +4 -0
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +106 -113
- package/build-style/style.css +106 -113
- package/package.json +30 -29
- package/src/components/block-editor/index.js +3 -5
- package/src/components/editor/index.js +1 -16
- package/src/components/global-styles/block-preview-panel.js +24 -9
- package/src/components/global-styles/border-panel.js +0 -1
- package/src/components/global-styles/custom-css.js +1 -0
- package/src/components/global-styles/global-styles-provider.js +11 -5
- package/src/components/global-styles/screen-background-color.js +0 -1
- package/src/components/global-styles/screen-block.js +1 -4
- package/src/components/global-styles/screen-border.js +2 -0
- package/src/components/global-styles/screen-button-color.js +0 -2
- package/src/components/global-styles/screen-colors.js +3 -0
- package/src/components/global-styles/screen-heading-color.js +1 -3
- package/src/components/global-styles/screen-layout.js +2 -0
- package/src/components/global-styles/screen-link-color.js +0 -1
- package/src/components/global-styles/screen-root.js +34 -27
- package/src/components/global-styles/screen-text-color.js +0 -1
- package/src/components/global-styles/screen-typography.js +3 -0
- package/src/components/global-styles/test/typography-utils.js +72 -23
- package/src/components/global-styles/typography-utils.js +24 -4
- package/src/components/global-styles/utils.js +10 -1
- package/src/components/header-edit-mode/document-actions/index.js +18 -37
- package/src/components/header-edit-mode/style.scss +1 -0
- package/src/components/layout/index.js +122 -165
- package/src/components/layout/style.scss +70 -63
- package/src/components/list/style.scss +1 -8
- package/src/components/sidebar/index.js +4 -1
- package/src/components/sidebar-edit-mode/index.js +1 -1
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
- package/src/components/sidebar-navigation-screen/style.scss +2 -4
- package/src/components/sidebar-navigation-screen-main/index.js +1 -29
- package/src/components/sidebar-navigation-screen-templates/index.js +9 -27
- package/src/components/site-hub/index.js +150 -0
- package/src/components/site-hub/style.scss +31 -0
- package/src/components/use-edited-entity-record/index.js +37 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/push-changes-to-global-styles/index.js +162 -0
- package/src/hooks/push-changes-to-global-styles/style.scss +4 -0
- package/src/index.js +2 -0
- package/src/style.scss +2 -0
- package/build/components/site-title/index.js +0 -55
- package/build/components/site-title/index.js.map +0 -1
- package/build-module/components/site-title/index.js +0 -43
- package/build-module/components/site-title/index.js.map +0 -1
- package/src/components/site-title/index.js +0 -39
|
@@ -6,12 +6,11 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useSelect
|
|
9
|
+
import { useSelect } from '@wordpress/data';
|
|
10
10
|
import {
|
|
11
|
-
Button,
|
|
12
|
-
__experimentalHStack as HStack,
|
|
13
11
|
__unstableMotion as motion,
|
|
14
12
|
__unstableAnimatePresence as AnimatePresence,
|
|
13
|
+
__unstableUseNavigateRegions as useNavigateRegions,
|
|
15
14
|
} from '@wordpress/components';
|
|
16
15
|
import {
|
|
17
16
|
useReducedMotion,
|
|
@@ -19,14 +18,14 @@ import {
|
|
|
19
18
|
useResizeObserver,
|
|
20
19
|
} from '@wordpress/compose';
|
|
21
20
|
import { __ } from '@wordpress/i18n';
|
|
22
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
23
21
|
import { useState, useEffect } from '@wordpress/element';
|
|
24
22
|
import { NavigableRegion } from '@wordpress/interface';
|
|
23
|
+
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
26
|
* Internal dependencies
|
|
28
27
|
*/
|
|
29
|
-
import
|
|
28
|
+
import Sidebar from '../sidebar';
|
|
30
29
|
import Editor from '../editor';
|
|
31
30
|
import ListPage from '../list';
|
|
32
31
|
import ErrorBoundary from '../error-boundary';
|
|
@@ -34,9 +33,8 @@ import { store as editSiteStore } from '../../store';
|
|
|
34
33
|
import { useLocation } from '../routes';
|
|
35
34
|
import getIsListPage from '../../utils/get-is-list-page';
|
|
36
35
|
import Header from '../header-edit-mode';
|
|
37
|
-
import SiteIcon from '../site-icon';
|
|
38
|
-
import SiteTitle from '../site-title';
|
|
39
36
|
import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
|
|
37
|
+
import SiteHub from '../site-hub';
|
|
40
38
|
|
|
41
39
|
const ANIMATION_DURATION = 0.5;
|
|
42
40
|
|
|
@@ -47,17 +45,28 @@ export default function Layout( { onError } ) {
|
|
|
47
45
|
const { params } = useLocation();
|
|
48
46
|
const isListPage = getIsListPage( params );
|
|
49
47
|
const isEditorPage = ! isListPage;
|
|
50
|
-
const { canvasMode,
|
|
51
|
-
( select ) =>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
const { canvasMode, previousShortcut, nextShortcut } = useSelect(
|
|
49
|
+
( select ) => {
|
|
50
|
+
const { getAllShortcutKeyCombinations } = select(
|
|
51
|
+
keyboardShortcutsStore
|
|
52
|
+
);
|
|
53
|
+
const { __unstableGetCanvasMode } = select( editSiteStore );
|
|
54
|
+
return {
|
|
55
|
+
canvasMode: __unstableGetCanvasMode(),
|
|
56
|
+
previousShortcut: getAllShortcutKeyCombinations(
|
|
57
|
+
'core/edit-site/previous-region'
|
|
58
|
+
),
|
|
59
|
+
nextShortcut: getAllShortcutKeyCombinations(
|
|
60
|
+
'core/edit-site/next-region'
|
|
61
|
+
),
|
|
62
|
+
};
|
|
63
|
+
},
|
|
57
64
|
[]
|
|
58
65
|
);
|
|
59
|
-
const
|
|
60
|
-
|
|
66
|
+
const navigateRegionsProps = useNavigateRegions( {
|
|
67
|
+
previous: previousShortcut,
|
|
68
|
+
next: nextShortcut,
|
|
69
|
+
} );
|
|
61
70
|
const disableMotion = useReducedMotion();
|
|
62
71
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
63
72
|
const [ isMobileCanvasVisible, setIsMobileCanvasVisible ] =
|
|
@@ -70,14 +79,10 @@ export default function Layout( { onError } ) {
|
|
|
70
79
|
( isMobileViewport && isMobileCanvasVisible ) || ! isMobileViewport;
|
|
71
80
|
const showFrame =
|
|
72
81
|
! isEditorPage || ( canvasMode === 'view' && ! isMobileViewport );
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
isMobileViewport
|
|
76
|
-
canvasMode === 'view' &&
|
|
82
|
+
|
|
83
|
+
const isFullCanvas =
|
|
84
|
+
( isEditorPage && canvasMode === 'edit' && ! isMobileViewport ) ||
|
|
77
85
|
isMobileCanvasVisible;
|
|
78
|
-
const isBackToDashboardButton =
|
|
79
|
-
( ! isMobileViewport && canvasMode === 'view' ) ||
|
|
80
|
-
( isMobileViewport && ! isMobileCanvasVisible );
|
|
81
86
|
// Ideally this effect could be removed if we move the "isMobileCanvasVisible" into the store.
|
|
82
87
|
const [ canvasResizer, canvasSize ] = useResizeObserver();
|
|
83
88
|
const [ fullResizer, fullSize ] = useResizeObserver();
|
|
@@ -90,94 +95,44 @@ export default function Layout( { onError } ) {
|
|
|
90
95
|
setIsMobileCanvasVisible( true );
|
|
91
96
|
}
|
|
92
97
|
}, [ canvasMode, isMobileViewport ] );
|
|
93
|
-
const siteIconButtonProps = isBackToDashboardButton
|
|
94
|
-
? {
|
|
95
|
-
href: dashboardLink || 'index.php',
|
|
96
|
-
'aria-label': __( 'Go back to the dashboard' ),
|
|
97
|
-
}
|
|
98
|
-
: {
|
|
99
|
-
label: __( 'Open Navigation Sidebar' ),
|
|
100
|
-
onClick: () => {
|
|
101
|
-
clearSelectedBlock();
|
|
102
|
-
setIsMobileCanvasVisible( false );
|
|
103
|
-
__unstableSetCanvasMode( 'view' );
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
98
|
|
|
107
99
|
return (
|
|
108
100
|
<>
|
|
109
101
|
{ fullResizer }
|
|
110
102
|
<div
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
103
|
+
{ ...navigateRegionsProps }
|
|
104
|
+
ref={ navigateRegionsProps.ref }
|
|
105
|
+
className={ classnames(
|
|
106
|
+
'edit-site-layout',
|
|
107
|
+
navigateRegionsProps.className,
|
|
108
|
+
{
|
|
109
|
+
'is-full-canvas': isFullCanvas,
|
|
110
|
+
'is-edit-mode': canvasMode === 'edit',
|
|
111
|
+
}
|
|
112
|
+
) }
|
|
118
113
|
>
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
>
|
|
125
|
-
<SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
|
|
126
|
-
</Button>
|
|
127
|
-
<AnimatePresence initial={ false }>
|
|
128
|
-
{ ( isBackToDashboardButton || showEditButton ) && (
|
|
129
|
-
<motion.div
|
|
130
|
-
initial={ { opacity: 0 } }
|
|
131
|
-
exit={ { opacity: 0 } }
|
|
132
|
-
animate={ { opacity: 1 } }
|
|
133
|
-
style={ {
|
|
134
|
-
position: 'absolute',
|
|
135
|
-
left: 60,
|
|
136
|
-
} }
|
|
137
|
-
>
|
|
138
|
-
<HStack>
|
|
139
|
-
{ isBackToDashboardButton && (
|
|
140
|
-
<SiteTitle />
|
|
141
|
-
) }
|
|
114
|
+
<SiteHub
|
|
115
|
+
className="edit-site-layout__hub"
|
|
116
|
+
isMobileCanvasVisible={ isMobileCanvasVisible }
|
|
117
|
+
setIsMobileCanvasVisible={ setIsMobileCanvasVisible }
|
|
118
|
+
/>
|
|
142
119
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
label={ __(
|
|
147
|
-
'Open the editor'
|
|
148
|
-
) }
|
|
149
|
-
onClick={ () => {
|
|
150
|
-
__unstableSetCanvasMode(
|
|
151
|
-
'edit'
|
|
152
|
-
);
|
|
153
|
-
} }
|
|
154
|
-
>
|
|
155
|
-
{ __( 'Edit' ) }
|
|
156
|
-
</Button>
|
|
157
|
-
) }
|
|
158
|
-
</HStack>
|
|
159
|
-
</motion.div>
|
|
160
|
-
) }
|
|
161
|
-
</AnimatePresence>
|
|
162
|
-
|
|
163
|
-
{ isMobileViewport && ! isMobileCanvasVisible && (
|
|
164
|
-
<Button
|
|
165
|
-
onClick={ () =>
|
|
166
|
-
setIsMobileCanvasVisible( true )
|
|
167
|
-
}
|
|
168
|
-
style={ { position: 'fixed', right: 0 } }
|
|
169
|
-
>
|
|
170
|
-
{ __( 'View Editor' ) }
|
|
171
|
-
</Button>
|
|
172
|
-
) }
|
|
173
|
-
</div>
|
|
174
|
-
<AnimatePresence>
|
|
175
|
-
{ isEditorPage && canvasMode === 'edit' && (
|
|
120
|
+
<AnimatePresence initial={ false }>
|
|
121
|
+
{ isEditorPage &&
|
|
122
|
+
( canvasMode === 'edit' || isMobileCanvasVisible ) && (
|
|
176
123
|
<NavigableRegion
|
|
124
|
+
className="edit-site-layout__header"
|
|
125
|
+
ariaLabel={ __( 'Editor top bar' ) }
|
|
177
126
|
as={ motion.div }
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
127
|
+
animate={ {
|
|
128
|
+
y: 0,
|
|
129
|
+
} }
|
|
130
|
+
initial={ {
|
|
131
|
+
y: '-100%',
|
|
132
|
+
} }
|
|
133
|
+
exit={ {
|
|
134
|
+
y: '-100%',
|
|
135
|
+
} }
|
|
181
136
|
transition={ {
|
|
182
137
|
type: 'tween',
|
|
183
138
|
duration: disableMotion
|
|
@@ -185,55 +140,26 @@ export default function Layout( { onError } ) {
|
|
|
185
140
|
: ANIMATION_DURATION,
|
|
186
141
|
ease: 'easeOut',
|
|
187
142
|
} }
|
|
188
|
-
className="edit-site-layout__editor-header"
|
|
189
|
-
ariaLabel={ __( 'Editor top bar' ) }
|
|
190
143
|
>
|
|
191
|
-
<Header />
|
|
144
|
+
{ canvasMode === 'edit' && <Header /> }
|
|
192
145
|
</NavigableRegion>
|
|
193
146
|
) }
|
|
194
|
-
</AnimatePresence>
|
|
195
|
-
</div>
|
|
196
|
-
|
|
197
|
-
<AnimatePresence initial={ false }>
|
|
198
|
-
{ showSidebar && (
|
|
199
|
-
<motion.div
|
|
200
|
-
initial={ {
|
|
201
|
-
opacity: 0,
|
|
202
|
-
} }
|
|
203
|
-
animate={ {
|
|
204
|
-
opacity: 1,
|
|
205
|
-
} }
|
|
206
|
-
exit={ {
|
|
207
|
-
opacity: 0,
|
|
208
|
-
} }
|
|
209
|
-
transition={ {
|
|
210
|
-
type: 'tween',
|
|
211
|
-
duration: disableMotion
|
|
212
|
-
? 0
|
|
213
|
-
: ANIMATION_DURATION,
|
|
214
|
-
ease: 'easeOut',
|
|
215
|
-
} }
|
|
216
|
-
className="edit-site-layout__sidebar"
|
|
217
|
-
>
|
|
218
|
-
<Sidebar />
|
|
219
|
-
</motion.div>
|
|
220
|
-
) }
|
|
221
147
|
</AnimatePresence>
|
|
222
148
|
|
|
223
|
-
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
149
|
+
<div className="edit-site-layout__content">
|
|
150
|
+
<AnimatePresence initial={ false }>
|
|
151
|
+
{ showSidebar && (
|
|
152
|
+
<NavigableRegion
|
|
153
|
+
as={ motion.div }
|
|
154
|
+
initial={ {
|
|
155
|
+
opacity: 0,
|
|
156
|
+
} }
|
|
157
|
+
animate={ {
|
|
158
|
+
opacity: 1,
|
|
159
|
+
} }
|
|
160
|
+
exit={ {
|
|
161
|
+
opacity: 0,
|
|
162
|
+
} }
|
|
237
163
|
transition={ {
|
|
238
164
|
type: 'tween',
|
|
239
165
|
duration: disableMotion
|
|
@@ -241,20 +167,28 @@ export default function Layout( { onError } ) {
|
|
|
241
167
|
: ANIMATION_DURATION,
|
|
242
168
|
ease: 'easeOut',
|
|
243
169
|
} }
|
|
170
|
+
className="edit-site-layout__sidebar"
|
|
171
|
+
ariaLabel={ __( 'Navigation sidebar' ) }
|
|
244
172
|
>
|
|
173
|
+
<Sidebar />
|
|
174
|
+
</NavigableRegion>
|
|
175
|
+
) }
|
|
176
|
+
</AnimatePresence>
|
|
177
|
+
|
|
178
|
+
{ showCanvas && (
|
|
179
|
+
<div
|
|
180
|
+
className="edit-site-layout__canvas-container"
|
|
181
|
+
style={ {
|
|
182
|
+
paddingTop: showFrame ? canvasPadding : 0,
|
|
183
|
+
paddingBottom: showFrame ? canvasPadding : 0,
|
|
184
|
+
} }
|
|
185
|
+
>
|
|
186
|
+
{ canvasResizer }
|
|
187
|
+
{ !! canvasSize.width && (
|
|
245
188
|
<motion.div
|
|
246
|
-
style={ {
|
|
247
|
-
position: 'absolute',
|
|
248
|
-
top: 0,
|
|
249
|
-
left: 0,
|
|
250
|
-
bottom: 0,
|
|
251
|
-
} }
|
|
252
189
|
initial={ false }
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
? canvasSize.width - canvasPadding
|
|
256
|
-
: fullSize.width,
|
|
257
|
-
} }
|
|
190
|
+
layout="position"
|
|
191
|
+
className="edit-site-layout__canvas"
|
|
258
192
|
transition={ {
|
|
259
193
|
type: 'tween',
|
|
260
194
|
duration: disableMotion
|
|
@@ -263,15 +197,38 @@ export default function Layout( { onError } ) {
|
|
|
263
197
|
ease: 'easeOut',
|
|
264
198
|
} }
|
|
265
199
|
>
|
|
266
|
-
<
|
|
267
|
-
{
|
|
268
|
-
|
|
269
|
-
|
|
200
|
+
<motion.div
|
|
201
|
+
style={ {
|
|
202
|
+
position: 'absolute',
|
|
203
|
+
top: 0,
|
|
204
|
+
left: 0,
|
|
205
|
+
bottom: 0,
|
|
206
|
+
} }
|
|
207
|
+
initial={ false }
|
|
208
|
+
animate={ {
|
|
209
|
+
width: showFrame
|
|
210
|
+
? canvasSize.width -
|
|
211
|
+
canvasPadding
|
|
212
|
+
: fullSize.width,
|
|
213
|
+
} }
|
|
214
|
+
transition={ {
|
|
215
|
+
type: 'tween',
|
|
216
|
+
duration: disableMotion
|
|
217
|
+
? 0
|
|
218
|
+
: ANIMATION_DURATION,
|
|
219
|
+
ease: 'easeOut',
|
|
220
|
+
} }
|
|
221
|
+
>
|
|
222
|
+
<ErrorBoundary onError={ onError }>
|
|
223
|
+
{ isEditorPage && <Editor /> }
|
|
224
|
+
{ isListPage && <ListPage /> }
|
|
225
|
+
</ErrorBoundary>
|
|
226
|
+
</motion.div>
|
|
270
227
|
</motion.div>
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
228
|
+
) }
|
|
229
|
+
</div>
|
|
230
|
+
) }
|
|
231
|
+
</div>
|
|
275
232
|
</div>
|
|
276
233
|
</>
|
|
277
234
|
);
|
|
@@ -1,83 +1,96 @@
|
|
|
1
|
+
$hub-height: $grid-unit-20 * 2 + $button-size;
|
|
2
|
+
|
|
1
3
|
.edit-site-layout {
|
|
2
|
-
|
|
4
|
+
height: 100%;
|
|
3
5
|
background: $gray-900;
|
|
4
6
|
color: $white;
|
|
5
7
|
display: flex;
|
|
6
8
|
flex-direction: column;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.edit-site-layout__hub {
|
|
12
|
+
position: fixed;
|
|
13
|
+
top: $canvas-padding;
|
|
14
|
+
left: $canvas-padding;
|
|
15
|
+
width: calc(100vw - #{$canvas-padding * 2});
|
|
16
|
+
height: $hub-height;
|
|
17
|
+
z-index: z-index(".edit-site-layout__hub");
|
|
18
|
+
|
|
19
|
+
background: $black;
|
|
20
|
+
padding: $grid-unit-20;
|
|
21
|
+
padding-left: 0;
|
|
22
|
+
border-radius: $radius-block-ui * 4;
|
|
23
|
+
box-shadow: $shadow-modal;
|
|
24
|
+
|
|
25
|
+
.edit-site-layout.is-full-canvas & {
|
|
26
|
+
top: 0;
|
|
27
|
+
left: 0;
|
|
28
|
+
padding: 0;
|
|
29
|
+
padding-right: $grid-unit-20;
|
|
30
|
+
height: $header-height;
|
|
31
|
+
border-radius: 0;
|
|
32
|
+
width: 100vw;
|
|
33
|
+
box-shadow: none;
|
|
34
|
+
|
|
35
|
+
@include break-medium {
|
|
36
|
+
width: auto;
|
|
37
|
+
padding-right: 0;
|
|
19
38
|
}
|
|
20
39
|
}
|
|
21
|
-
}
|
|
22
40
|
|
|
23
|
-
.edit-site-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
41
|
+
.edit-site-layout.is-full-canvas.is-edit-mode & {
|
|
42
|
+
width: auto;
|
|
43
|
+
padding-right: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@include break-medium {
|
|
47
|
+
width: calc(#{$nav-sidebar-width} - #{$canvas-padding * 2});
|
|
48
|
+
}
|
|
27
49
|
}
|
|
28
50
|
|
|
29
|
-
.edit-site-
|
|
30
|
-
align-items: center;
|
|
51
|
+
.edit-site-layout__header {
|
|
31
52
|
height: $header-height;
|
|
32
53
|
display: flex;
|
|
33
|
-
|
|
54
|
+
z-index: z-index(".edit-site-layout__header");
|
|
34
55
|
|
|
35
|
-
|
|
36
|
-
|
|
56
|
+
// This is only necessary for the exit animation
|
|
57
|
+
.edit-site-layout:not(.is-full-canvas) & {
|
|
58
|
+
position: fixed;
|
|
59
|
+
width: 100vw;
|
|
37
60
|
}
|
|
38
61
|
}
|
|
39
62
|
|
|
40
|
-
.edit-site-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
63
|
+
.edit-site-layout__content {
|
|
64
|
+
flex-grow: 1;
|
|
65
|
+
display: flex;
|
|
66
|
+
|
|
67
|
+
// Hide scrollbars during the edit/view animation.
|
|
68
|
+
overflow: hidden;
|
|
44
69
|
}
|
|
45
70
|
|
|
46
71
|
.edit-site-layout__sidebar {
|
|
47
|
-
|
|
48
|
-
z-index: 1;
|
|
72
|
+
z-index: z-index(".edit-site-layout__sidebar");
|
|
49
73
|
overflow-y: auto;
|
|
50
|
-
|
|
74
|
+
width: 100vw;
|
|
51
75
|
@include custom-scrollbars-on-hover;
|
|
52
76
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
display: none;
|
|
56
|
-
@include break-small {
|
|
57
|
-
display: block;
|
|
58
|
-
grid-area: header;
|
|
59
|
-
position: absolute;
|
|
60
|
-
top: 60px;
|
|
61
|
-
}
|
|
77
|
+
@include break-medium {
|
|
78
|
+
width: $nav-sidebar-width;
|
|
62
79
|
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.edit-site-layout__editor-header {
|
|
66
|
-
flex-grow: 1;
|
|
67
80
|
|
|
68
81
|
// This is only necessary for the exit animation
|
|
69
|
-
.edit-site-layout
|
|
82
|
+
.edit-site-layout.is-full-canvas & {
|
|
70
83
|
position: fixed;
|
|
71
|
-
|
|
72
|
-
|
|
84
|
+
height: 100vh;
|
|
85
|
+
left: 0;
|
|
86
|
+
top: 0;
|
|
73
87
|
}
|
|
74
88
|
}
|
|
75
89
|
|
|
76
90
|
.edit-site-layout__canvas-container {
|
|
77
|
-
grid-area: canvas;
|
|
78
91
|
position: relative;
|
|
79
92
|
flex-grow: 1;
|
|
80
|
-
z-index:
|
|
93
|
+
z-index: z-index(".edit-site-layout__canvas-container");
|
|
81
94
|
}
|
|
82
95
|
|
|
83
96
|
.edit-site-layout__canvas {
|
|
@@ -92,7 +105,7 @@
|
|
|
92
105
|
color: $gray-900;
|
|
93
106
|
background: $white;
|
|
94
107
|
}
|
|
95
|
-
@include break-
|
|
108
|
+
@include break-medium {
|
|
96
109
|
top: $canvas-padding;
|
|
97
110
|
bottom: $canvas-padding;
|
|
98
111
|
width: calc(100% - #{$canvas-padding});
|
|
@@ -124,11 +137,14 @@
|
|
|
124
137
|
|
|
125
138
|
.edit-site-layout__view-mode-toggle.components-button {
|
|
126
139
|
position: relative;
|
|
127
|
-
background: $gray-900;
|
|
128
140
|
color: $white;
|
|
129
|
-
height:
|
|
130
|
-
|
|
131
|
-
|
|
141
|
+
height: 100%;
|
|
142
|
+
width: 100%;
|
|
143
|
+
border-radius: $radius-block-ui;
|
|
144
|
+
padding: 0;
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: center;
|
|
132
148
|
|
|
133
149
|
&:hover,
|
|
134
150
|
&:active {
|
|
@@ -150,15 +166,6 @@
|
|
|
150
166
|
bottom: 9px;
|
|
151
167
|
left: 9px;
|
|
152
168
|
border-radius: $radius-block-ui + $border-width + $border-width;
|
|
153
|
-
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $gray-900;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// Hover color.
|
|
157
|
-
&:hover::before {
|
|
158
|
-
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $gray-700;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
&.has-icon:hover::before {
|
|
162
169
|
box-shadow: none;
|
|
163
170
|
}
|
|
164
171
|
|
|
@@ -170,7 +177,7 @@
|
|
|
170
177
|
}
|
|
171
178
|
|
|
172
179
|
.edit-site-layout__view-mode-toggle-icon {
|
|
180
|
+
display: flex;
|
|
173
181
|
border-radius: $radius-block-ui;
|
|
174
|
-
object-fit: cover;
|
|
175
182
|
}
|
|
176
183
|
}
|
|
@@ -44,18 +44,11 @@
|
|
|
44
44
|
.interface-interface-skeleton__content {
|
|
45
45
|
background: $white;
|
|
46
46
|
padding: $grid-unit-20;
|
|
47
|
-
|
|
48
|
-
.interface-navigable-region__stacker {
|
|
49
|
-
align-items: center;
|
|
50
|
-
}
|
|
47
|
+
align-items: center;
|
|
51
48
|
|
|
52
49
|
@include break-medium() {
|
|
53
50
|
padding: $grid-unit * 9;
|
|
54
51
|
}
|
|
55
|
-
|
|
56
|
-
& > .interface-navigable-region__stacker {
|
|
57
|
-
height: auto;
|
|
58
|
-
}
|
|
59
52
|
}
|
|
60
53
|
}
|
|
61
54
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { memo } from '@wordpress/element';
|
|
4
5
|
import { __experimentalNavigatorProvider as NavigatorProvider } from '@wordpress/components';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -22,7 +23,7 @@ function SidebarScreens() {
|
|
|
22
23
|
);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
function Sidebar() {
|
|
26
27
|
return (
|
|
27
28
|
<NavigatorProvider
|
|
28
29
|
className="edit-site-sidebar__content"
|
|
@@ -32,3 +33,5 @@ export function Sidebar() {
|
|
|
32
33
|
</NavigatorProvider>
|
|
33
34
|
);
|
|
34
35
|
}
|
|
36
|
+
|
|
37
|
+
export default memo( Sidebar );
|
|
@@ -69,7 +69,7 @@ export function SidebarComplementaryAreaFills() {
|
|
|
69
69
|
// See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.
|
|
70
70
|
let MaybeNavigationMenuSidebar = Fragment;
|
|
71
71
|
|
|
72
|
-
if (
|
|
72
|
+
if ( window?.__experimentalEnableOffCanvasNavigationEditor === true ) {
|
|
73
73
|
MaybeNavigationMenuSidebar = NavigationMenuSidebar;
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
__experimentalListView as ListView,
|
|
6
|
+
__experimentalOffCanvasEditor as OffCanvasEditor,
|
|
6
7
|
store as blockEditorStore,
|
|
7
8
|
} from '@wordpress/block-editor';
|
|
8
9
|
import { useEffect } from '@wordpress/element';
|
|
@@ -48,5 +49,14 @@ export default function NavigationMenu( { innerBlocks, id } ) {
|
|
|
48
49
|
}
|
|
49
50
|
} );
|
|
50
51
|
}, [ updateBlockListSettings, innerBlocks ] );
|
|
52
|
+
|
|
53
|
+
if ( window?.__experimentalEnableOffCanvasNavigationEditor ) {
|
|
54
|
+
return (
|
|
55
|
+
<OffCanvasEditor
|
|
56
|
+
blocks={ innerBlocks }
|
|
57
|
+
selectBlockInCanvas={ false }
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
51
61
|
return <ListView id={ id } />;
|
|
52
62
|
}
|
|
@@ -6,16 +6,14 @@
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
.edit-site-sidebar-navigation-screen__content {
|
|
9
|
-
margin: 0 $grid-unit-20
|
|
10
|
-
flex-grow: 1;
|
|
11
|
-
overflow-y: auto;
|
|
9
|
+
margin: 0 $grid-unit-20 $grid-unit-20 $button-size;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
12
|
.edit-site-sidebar-navigation-screen__title-icon {
|
|
15
13
|
position: sticky;
|
|
16
14
|
top: 0;
|
|
17
15
|
background: $gray-900;
|
|
18
|
-
padding-top: $grid-unit-
|
|
16
|
+
padding-top: $grid-unit-60 + $hub-height + $canvas-padding * 2;
|
|
19
17
|
box-shadow: 0 $grid-unit-10 $grid-unit-20 $gray-900;
|
|
20
18
|
margin-bottom: $grid-unit-10;
|
|
21
19
|
padding-bottom: $grid-unit-10;
|