@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.
- package/CHANGELOG.md +2 -0
- package/build/components/add-new-page/index.js +2 -1
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/app/index.js +17 -1
- package/build/components/app/index.js.map +1 -1
- package/build/components/editor/index.js +55 -69
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-editor-title.js +39 -0
- package/build/components/editor/use-editor-title.js.map +1 -0
- package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/screen-css.js +1 -1
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +4 -23
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +1 -0
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +11 -16
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +2 -1
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +1 -0
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +2 -0
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/index.js +23 -95
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +1 -0
- package/build/components/page/header.js.map +1 -1
- package/build/components/page-patterns/header.js +2 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +5 -5
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/pagination/index.js +17 -8
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/posts-app/index.js +50 -0
- package/build/components/posts-app/index.js.map +1 -0
- package/build/components/sidebar-dataviews/dataview-item.js +6 -2
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +1 -1
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/site-hub/index.js +38 -128
- package/build/components/site-hub/index.js.map +1 -1
- package/build/hooks/commands/use-set-command-context.js +53 -0
- package/build/hooks/commands/use-set-command-context.js.map +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js +3 -2
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +20 -88
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +15 -2
- package/build/index.js.map +1 -1
- package/build/posts.js +34 -0
- package/build/posts.js.map +1 -0
- package/build/store/private-actions.js +33 -18
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/add-new-page/index.js +2 -1
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/app/index.js +17 -1
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/editor/index.js +55 -69
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-editor-title.js +31 -0
- package/build-module/components/editor/use-editor-title.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +1 -1
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +4 -23
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +1 -0
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +11 -16
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +3 -2
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +1 -0
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +2 -0
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/index.js +27 -99
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +1 -0
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page-patterns/header.js +2 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +5 -5
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/pagination/index.js +17 -8
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/posts-app/index.js +43 -0
- package/build-module/components/posts-app/index.js.map +1 -0
- package/build-module/components/sidebar-dataviews/dataview-item.js +6 -2
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +40 -130
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/hooks/commands/use-set-command-context.js +46 -0
- package/build-module/hooks/commands/use-set-command-context.js.map +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js +3 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +19 -86
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +8 -2
- package/build-module/index.js.map +1 -1
- package/build-module/posts.js +27 -0
- package/build-module/posts.js.map +1 -0
- package/build-module/store/private-actions.js +33 -18
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/posts-rtl.css +1707 -0
- package/build-style/posts.css +1707 -0
- package/build-style/style-rtl.css +59 -104
- package/build-style/style.css +59 -104
- package/package.json +41 -41
- package/src/components/add-new-page/index.js +2 -1
- package/src/components/app/index.js +17 -1
- package/src/components/block-editor/style.scss +11 -0
- package/src/components/editor/index.js +69 -103
- package/src/components/editor/style.scss +1 -5
- package/src/components/editor/use-editor-title.js +35 -0
- package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- package/src/components/global-styles/screen-css.js +1 -1
- package/src/components/global-styles/screen-revisions/index.js +4 -24
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/src/components/global-styles/screen-revisions/style.scss +4 -8
- package/src/components/global-styles/shadows-edit-panel.js +1 -0
- package/src/components/global-styles/style.scss +1 -7
- package/src/components/global-styles/variations/variation.js +14 -19
- package/src/components/global-styles/variations/variations-color.js +12 -4
- package/src/components/global-styles/variations/variations-typography.js +5 -1
- package/src/components/global-styles-sidebar/index.js +2 -0
- package/src/components/global-styles-sidebar/style.scss +0 -1
- package/src/components/layout/index.js +41 -137
- package/src/components/layout/style.scss +18 -58
- package/src/components/page/header.js +1 -0
- package/src/components/page/style.scss +6 -0
- package/src/components/page-patterns/header.js +8 -2
- package/src/components/page-patterns/index.js +15 -12
- package/src/components/page-patterns/style.scss +6 -0
- package/src/components/pagination/index.js +21 -16
- package/src/components/posts-app/index.js +39 -0
- package/src/components/sidebar/style.scss +4 -4
- package/src/components/sidebar-dataviews/dataview-item.js +6 -2
- package/src/components/sidebar-navigation-screen/index.js +1 -1
- package/src/components/sidebar-navigation-screen/style.scss +2 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +11 -2
- package/src/components/sidebar-navigation-screen-patterns/index.js +5 -1
- package/src/components/site-hub/index.js +55 -146
- package/src/components/site-hub/style.scss +1 -4
- package/src/components/site-icon/style.scss +0 -4
- package/src/hooks/commands/use-set-command-context.js +37 -0
- package/src/hooks/push-changes-to-global-styles/index.js +3 -2
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +1 -875
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +29 -117
- package/src/index.js +10 -2
- package/src/posts.js +29 -0
- package/src/posts.scss +46 -0
- package/src/store/private-actions.js +58 -30
- package/build/components/block-editor/block-inspector-button.js +0 -57
- package/build/components/block-editor/block-inspector-button.js.map +0 -1
- package/build/components/block-editor/inserter-media-categories.js +0 -183
- package/build/components/block-editor/inserter-media-categories.js.map +0 -1
- package/build/components/template-part-converter/convert-to-regular.js +0 -38
- package/build/components/template-part-converter/convert-to-regular.js.map +0 -1
- package/build/components/template-part-converter/convert-to-template-part.js +0 -84
- package/build/components/template-part-converter/convert-to-template-part.js.map +0 -1
- package/build/components/template-part-converter/index.js +0 -67
- package/build/components/template-part-converter/index.js.map +0 -1
- package/build-module/components/block-editor/block-inspector-button.js +0 -50
- package/build-module/components/block-editor/block-inspector-button.js.map +0 -1
- package/build-module/components/block-editor/inserter-media-categories.js +0 -177
- package/build-module/components/block-editor/inserter-media-categories.js.map +0 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +0 -31
- package/build-module/components/template-part-converter/convert-to-regular.js.map +0 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +0 -79
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +0 -1
- package/build-module/components/template-part-converter/index.js +0 -59
- package/build-module/components/template-part-converter/index.js.map +0 -1
- package/src/components/block-editor/block-inspector-button.js +0 -60
- package/src/components/block-editor/inserter-media-categories.js +0 -227
- package/src/components/template-part-converter/convert-to-regular.js +0 -32
- package/src/components/template-part-converter/convert-to-template-part.js +0 -78
- 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
|
-
|
|
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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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 } =
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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;
|
|
@@ -58,12 +58,18 @@ export default function PatternsHeader( {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
return (
|
|
61
|
-
<VStack className="edit-site-patterns__section-header" spacing={
|
|
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
|
|
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', '
|
|
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
|
-
{
|
|
302
|
-
(
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
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
|
},
|
|
@@ -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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
|
42
|
-
isCustom: isCustom ? 'true' :
|
|
45
|
+
activeView,
|
|
46
|
+
isCustom: isCustom ? 'true' : undefined,
|
|
43
47
|
} );
|
|
44
48
|
return (
|
|
45
49
|
<HStack
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
position: sticky;
|
|
60
60
|
top: 0;
|
|
61
61
|
background: $gray-900;
|
|
62
|
-
padding-top: $grid-unit-60
|
|
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 {
|