@wordpress/edit-site 6.8.6 → 6.9.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/editor-canvas-container/index.js +1 -1
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-card.js +1 -1
- package/build/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +4 -4
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +1 -1
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +5 -5
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-sizes/font-size.js +15 -6
- package/build/components/global-styles/font-sizes/font-size.js.map +1 -1
- package/build/components/global-styles/header.js +1 -1
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +2 -2
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +1 -2
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +4 -1
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +6 -19
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +1 -1
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/page-patterns/fields.js +2 -4
- package/build/components/page-patterns/fields.js.map +1 -1
- package/build/components/resizable-frame/index.js +25 -7
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/routes/link.js +6 -3
- package/build/components/routes/link.js.map +1 -1
- package/build/components/save-panel/index.js +2 -4
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +2 -4
- package/build/components/sidebar-button/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +4 -8
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/site-hub/index.js +12 -24
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/categories.js +70 -0
- package/build/components/style-book/categories.js.map +1 -0
- package/build/components/style-book/constants.js +151 -0
- package/build/components/style-book/constants.js.map +1 -0
- package/build/components/style-book/examples.js +58 -0
- package/build/components/style-book/examples.js.map +1 -0
- package/build/components/style-book/index.js +52 -133
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/style-book/types.js +6 -0
- package/build/components/style-book/types.js.map +1 -0
- package/build/store/selectors.js +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +1 -1
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-card.js +1 -1
- package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +5 -5
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +5 -5
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-sizes/font-size.js +16 -7
- package/build-module/components/global-styles/font-sizes/font-size.js.map +1 -1
- package/build-module/components/global-styles/header.js +2 -2
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +3 -3
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +1 -2
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +4 -1
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +3 -16
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +1 -1
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/page-patterns/fields.js +2 -4
- package/build-module/components/page-patterns/fields.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +26 -8
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/routes/link.js +6 -3
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/save-panel/index.js +2 -4
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +2 -4
- package/build-module/components/sidebar-button/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +4 -8
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/site-hub/index.js +12 -24
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/categories.js +64 -0
- package/build-module/components/style-book/categories.js.map +1 -0
- package/build-module/components/style-book/constants.js +145 -0
- package/build-module/components/style-book/constants.js.map +1 -0
- package/build-module/components/style-book/examples.js +52 -0
- package/build-module/components/style-book/examples.js.map +1 -0
- package/build-module/components/style-book/index.js +51 -132
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/style-book/types.js +2 -0
- package/build-module/components/style-book/types.js.map +1 -0
- package/build-module/store/selectors.js +1 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/posts-rtl.css +32 -12
- package/build-style/posts.css +32 -12
- package/build-style/style-rtl.css +44 -21
- package/build-style/style.css +44 -21
- package/package.json +41 -41
- package/src/components/editor-canvas-container/index.js +1 -1
- package/src/components/editor-canvas-container/style.scss +2 -2
- package/src/components/global-styles/font-library-modal/font-card.js +1 -1
- package/src/components/global-styles/font-library-modal/font-collection.js +8 -10
- package/src/components/global-styles/font-library-modal/index.js +1 -1
- package/src/components/global-styles/font-library-modal/installed-fonts.js +9 -11
- package/src/components/global-styles/font-library-modal/style.scss +5 -1
- package/src/components/global-styles/font-sizes/font-size.js +15 -8
- package/src/components/global-styles/header.js +2 -2
- package/src/components/global-styles/navigation-button.js +3 -4
- package/src/components/global-styles/screen-revisions/index.js +1 -2
- package/src/components/global-styles/shadows-edit-panel.js +5 -1
- package/src/components/global-styles/ui.js +5 -19
- package/src/components/global-styles-sidebar/index.js +1 -1
- package/src/components/global-styles-sidebar/style.scss +1 -8
- package/src/components/layout/style.scss +7 -2
- package/src/components/page-patterns/fields.js +1 -2
- package/src/components/resizable-frame/index.js +14 -8
- package/src/components/routes/link.js +6 -3
- package/src/components/save-panel/index.js +1 -2
- package/src/components/sidebar-button/index.js +1 -2
- package/src/components/sidebar-dataviews/add-new-view.js +2 -4
- package/src/components/site-hub/index.js +6 -12
- package/src/components/style-book/categories.ts +91 -0
- package/src/components/style-book/constants.ts +191 -0
- package/src/components/style-book/examples.ts +63 -0
- package/src/components/style-book/index.js +76 -163
- package/src/components/style-book/style.scss +9 -5
- package/src/components/style-book/test/categories.js +171 -0
- package/src/components/style-book/types.ts +27 -0
- package/src/store/selectors.js +1 -1
|
@@ -5,7 +5,7 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
|
5
5
|
import { __, sprintf } from '@wordpress/i18n';
|
|
6
6
|
import {
|
|
7
7
|
__experimentalSpacer as Spacer,
|
|
8
|
-
|
|
8
|
+
useNavigator,
|
|
9
9
|
__experimentalView as View,
|
|
10
10
|
__experimentalHStack as HStack,
|
|
11
11
|
__experimentalVStack as VStack,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
ToggleControl,
|
|
16
16
|
} from '@wordpress/components';
|
|
17
17
|
import { moreVertical } from '@wordpress/icons';
|
|
18
|
-
import { useState } from '@wordpress/element';
|
|
18
|
+
import { useState, useEffect } from '@wordpress/element';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Internal dependencies
|
|
@@ -36,7 +36,6 @@ function FontSize() {
|
|
|
36
36
|
|
|
37
37
|
const {
|
|
38
38
|
params: { origin, slug },
|
|
39
|
-
goBack,
|
|
40
39
|
goTo,
|
|
41
40
|
} = useNavigator();
|
|
42
41
|
|
|
@@ -52,12 +51,23 @@ function FontSize() {
|
|
|
52
51
|
// Get the font size by slug.
|
|
53
52
|
const fontSize = sizes.find( ( size ) => size.slug === slug );
|
|
54
53
|
|
|
54
|
+
// Navigate to the font sizes list if the font size is not available.
|
|
55
|
+
useEffect( () => {
|
|
56
|
+
if ( ! fontSize ) {
|
|
57
|
+
goTo( '/typography/font-sizes/', { isBack: true } );
|
|
58
|
+
}
|
|
59
|
+
}, [ fontSize, goTo ] );
|
|
60
|
+
|
|
61
|
+
if ( ! origin || ! slug || ! fontSize ) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
55
65
|
// Whether the font size is fluid. If not defined, use the global fluid value of the theme.
|
|
56
66
|
const isFluid =
|
|
57
|
-
fontSize
|
|
67
|
+
fontSize?.fluid !== undefined ? !! fontSize.fluid : !! globalFluid;
|
|
58
68
|
|
|
59
69
|
// Whether custom fluid values are used.
|
|
60
|
-
const isCustomFluid = typeof fontSize
|
|
70
|
+
const isCustomFluid = typeof fontSize?.fluid === 'object';
|
|
61
71
|
|
|
62
72
|
const handleNameChange = ( value ) => {
|
|
63
73
|
updateFontSize( 'name', value );
|
|
@@ -107,9 +117,6 @@ function FontSize() {
|
|
|
107
117
|
};
|
|
108
118
|
|
|
109
119
|
const handleRemoveFontSize = () => {
|
|
110
|
-
// Navigate to the font sizes list.
|
|
111
|
-
goBack();
|
|
112
|
-
|
|
113
120
|
const newFontSizes = sizes.filter( ( size ) => size.slug !== slug );
|
|
114
121
|
setFontSizes( {
|
|
115
122
|
...fontSizes,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
__experimentalSpacer as Spacer,
|
|
8
8
|
__experimentalHeading as Heading,
|
|
9
9
|
__experimentalView as View,
|
|
10
|
-
|
|
10
|
+
Navigator,
|
|
11
11
|
} from '@wordpress/components';
|
|
12
12
|
import { isRTL, __ } from '@wordpress/i18n';
|
|
13
13
|
import { chevronRight, chevronLeft } from '@wordpress/icons';
|
|
@@ -18,7 +18,7 @@ function ScreenHeader( { title, description, onBack } ) {
|
|
|
18
18
|
<View>
|
|
19
19
|
<Spacer marginBottom={ 0 } paddingX={ 4 } paddingY={ 3 }>
|
|
20
20
|
<HStack spacing={ 2 }>
|
|
21
|
-
<
|
|
21
|
+
<Navigator.BackButton
|
|
22
22
|
icon={ isRTL() ? chevronRight : chevronLeft }
|
|
23
23
|
size="small"
|
|
24
24
|
label={ __( 'Back' ) }
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
__experimentalNavigatorBackButton as NavigatorBackButton,
|
|
5
|
+
Navigator,
|
|
7
6
|
__experimentalItem as Item,
|
|
8
7
|
FlexItem,
|
|
9
8
|
__experimentalHStack as HStack,
|
|
@@ -29,11 +28,11 @@ function GenericNavigationButton( { icon, children, ...props } ) {
|
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
function NavigationButtonAsItem( props ) {
|
|
32
|
-
return <
|
|
31
|
+
return <Navigator.Button as={ GenericNavigationButton } { ...props } />;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
function NavigationBackButtonAsItem( props ) {
|
|
36
|
-
return <
|
|
35
|
+
return <Navigator.BackButton as={ GenericNavigationButton } { ...props } />;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
export { NavigationButtonAsItem, NavigationBackButtonAsItem };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
useNavigator,
|
|
7
7
|
__experimentalConfirmDialog as ConfirmDialog,
|
|
8
8
|
Spinner,
|
|
9
9
|
} from '@wordpress/components';
|
|
@@ -72,7 +72,6 @@ function ScreenRevisions() {
|
|
|
72
72
|
);
|
|
73
73
|
|
|
74
74
|
const onCloseRevisions = () => {
|
|
75
|
-
goTo( '/' ); // Return to global styles main panel.
|
|
76
75
|
const canvasContainerView =
|
|
77
76
|
editorCanvasContainerView === 'global-styles-revisions:style-book'
|
|
78
77
|
? 'style-book'
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
__experimentalUnitControl as UnitControl,
|
|
16
16
|
__experimentalGrid as Grid,
|
|
17
17
|
__experimentalDropdownContentWrapper as DropdownContentWrapper,
|
|
18
|
-
|
|
18
|
+
useNavigator,
|
|
19
19
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
20
20
|
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
21
21
|
__experimentalConfirmDialog as ConfirmDialog,
|
|
@@ -96,6 +96,10 @@ export default function ShadowsEditPanel() {
|
|
|
96
96
|
const [ isRenameModalVisible, setIsRenameModalVisible ] = useState( false );
|
|
97
97
|
const [ shadowName, setShadowName ] = useState( selectedShadow.name );
|
|
98
98
|
|
|
99
|
+
if ( ! category || ! slug ) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
|
|
99
103
|
const onShadowChange = ( shadow ) => {
|
|
100
104
|
setSelectedShadow( { ...selectedShadow, shadow } );
|
|
101
105
|
const updatedShadows = shadows.map( ( s ) =>
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
__experimentalUseNavigator as useNavigator,
|
|
5
|
+
Navigator,
|
|
6
|
+
useNavigator,
|
|
8
7
|
createSlotFill,
|
|
9
8
|
DropdownMenu,
|
|
10
9
|
MenuGroup,
|
|
@@ -124,7 +123,7 @@ function GlobalStylesActionMenu() {
|
|
|
124
123
|
|
|
125
124
|
function GlobalStylesNavigationScreen( { className, ...props } ) {
|
|
126
125
|
return (
|
|
127
|
-
<
|
|
126
|
+
<Navigator.Screen
|
|
128
127
|
className={ [
|
|
129
128
|
'edit-site-global-styles-sidebar__navigator-screen',
|
|
130
129
|
className,
|
|
@@ -271,19 +270,6 @@ function GlobalStylesEditorCanvasContainerLink() {
|
|
|
271
270
|
goTo( '/' );
|
|
272
271
|
}
|
|
273
272
|
break;
|
|
274
|
-
default:
|
|
275
|
-
/*
|
|
276
|
-
* Example: the user has navigated to "Browse styles" or elsewhere
|
|
277
|
-
* and changes the editorCanvasContainerView, e.g., closes the style book.
|
|
278
|
-
* The panel should not be affected.
|
|
279
|
-
* Exclude revisions panel from this behavior,
|
|
280
|
-
* as it should close when the editorCanvasContainerView doesn't correspond.
|
|
281
|
-
*/
|
|
282
|
-
if ( path !== '/' && ! isRevisionsOpen ) {
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
goTo( '/' );
|
|
286
|
-
break;
|
|
287
273
|
}
|
|
288
274
|
}, [ editorCanvasContainerView, isRevisionsOpen, goTo ] );
|
|
289
275
|
}
|
|
@@ -296,7 +282,7 @@ function GlobalStylesUI() {
|
|
|
296
282
|
[]
|
|
297
283
|
);
|
|
298
284
|
return (
|
|
299
|
-
<
|
|
285
|
+
<Navigator
|
|
300
286
|
className="edit-site-global-styles-sidebar__navigator-provider"
|
|
301
287
|
initialPath="/"
|
|
302
288
|
>
|
|
@@ -398,7 +384,7 @@ function GlobalStylesUI() {
|
|
|
398
384
|
<GlobalStylesActionMenu />
|
|
399
385
|
<GlobalStylesBlockLink />
|
|
400
386
|
<GlobalStylesEditorCanvasContainerLink />
|
|
401
|
-
</
|
|
387
|
+
</Navigator>
|
|
402
388
|
);
|
|
403
389
|
}
|
|
404
390
|
export { GlobalStylesMenuSlot };
|
|
@@ -114,14 +114,18 @@
|
|
|
114
114
|
width: calc(100% - #{$canvas-padding});
|
|
115
115
|
|
|
116
116
|
.edit-site-resizable-frame__inner-content {
|
|
117
|
-
box-shadow:
|
|
118
|
-
transition: border-radius 0.4s;
|
|
117
|
+
box-shadow: $elevation-x-small;
|
|
118
|
+
transition: border-radius, box-shadow 0.4s;
|
|
119
119
|
// This ensure the radius work properly.
|
|
120
120
|
overflow: hidden;
|
|
121
121
|
|
|
122
122
|
.edit-site-layout:not(.is-full-canvas) & {
|
|
123
123
|
border-radius: $radius-large;
|
|
124
124
|
}
|
|
125
|
+
|
|
126
|
+
&:hover {
|
|
127
|
+
box-shadow: $elevation-large;
|
|
128
|
+
}
|
|
125
129
|
}
|
|
126
130
|
}
|
|
127
131
|
|
|
@@ -246,6 +250,7 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
|
|
|
246
250
|
flex-grow: 1;
|
|
247
251
|
margin: 0;
|
|
248
252
|
overflow: hidden;
|
|
253
|
+
box-shadow: $elevation-x-small;
|
|
249
254
|
@include break-medium() {
|
|
250
255
|
border-radius: 8px;
|
|
251
256
|
margin: $canvas-padding $canvas-padding $canvas-padding 0;
|
|
@@ -133,8 +133,7 @@ function TitleField( { item } ) {
|
|
|
133
133
|
title
|
|
134
134
|
) : (
|
|
135
135
|
<Button
|
|
136
|
-
|
|
137
|
-
__next40pxDefaultSize={ false }
|
|
136
|
+
__next40pxDefaultSize
|
|
138
137
|
variant="link"
|
|
139
138
|
onClick={ onClick }
|
|
140
139
|
// Required for the grid's roving tab index system.
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from '@wordpress/components';
|
|
15
15
|
import { useInstanceId, useReducedMotion } from '@wordpress/compose';
|
|
16
16
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
17
|
-
import { __ } from '@wordpress/i18n';
|
|
17
|
+
import { __, isRTL } from '@wordpress/i18n';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Internal dependencies
|
|
@@ -171,7 +171,10 @@ function ResizableFrame( {
|
|
|
171
171
|
event.preventDefault();
|
|
172
172
|
|
|
173
173
|
const step = 20 * ( event.shiftKey ? 5 : 1 );
|
|
174
|
-
const delta =
|
|
174
|
+
const delta =
|
|
175
|
+
step *
|
|
176
|
+
( event.key === 'ArrowLeft' ? 1 : -1 ) *
|
|
177
|
+
( isRTL() ? -1 : 1 );
|
|
175
178
|
const newWidth = Math.min(
|
|
176
179
|
Math.max(
|
|
177
180
|
FRAME_MIN_WIDTH,
|
|
@@ -200,15 +203,17 @@ function ResizableFrame( {
|
|
|
200
203
|
const resizeHandleVariants = {
|
|
201
204
|
hidden: {
|
|
202
205
|
opacity: 0,
|
|
203
|
-
left: 0,
|
|
206
|
+
...( isRTL() ? { right: 0 } : { left: 0 } ),
|
|
204
207
|
},
|
|
205
208
|
visible: {
|
|
206
209
|
opacity: 1,
|
|
207
|
-
|
|
210
|
+
// Account for the handle's width.
|
|
211
|
+
...( isRTL() ? { right: -14 } : { left: -14 } ),
|
|
208
212
|
},
|
|
209
213
|
active: {
|
|
210
214
|
opacity: 1,
|
|
211
|
-
|
|
215
|
+
// Account for the handle's width.
|
|
216
|
+
...( isRTL() ? { right: -14 } : { left: -14 } ),
|
|
212
217
|
scaleY: 1.3,
|
|
213
218
|
},
|
|
214
219
|
};
|
|
@@ -246,10 +251,11 @@ function ResizableFrame( {
|
|
|
246
251
|
size={ frameSize }
|
|
247
252
|
enable={ {
|
|
248
253
|
top: false,
|
|
249
|
-
right: false,
|
|
250
254
|
bottom: false,
|
|
251
255
|
// Resizing will be disabled until the editor content is loaded.
|
|
252
|
-
|
|
256
|
+
...( isRTL()
|
|
257
|
+
? { right: isReady, left: false }
|
|
258
|
+
: { left: isReady, right: false } ),
|
|
253
259
|
topRight: false,
|
|
254
260
|
bottomRight: false,
|
|
255
261
|
bottomLeft: false,
|
|
@@ -269,7 +275,7 @@ function ResizableFrame( {
|
|
|
269
275
|
onMouseOver={ () => setShouldShowHandle( true ) }
|
|
270
276
|
onMouseOut={ () => setShouldShowHandle( false ) }
|
|
271
277
|
handleComponent={ {
|
|
272
|
-
left: canvasMode === 'view' && (
|
|
278
|
+
[ isRTL() ? 'right' : 'left' ]: canvasMode === 'view' && (
|
|
273
279
|
<>
|
|
274
280
|
<Tooltip text={ __( 'Drag to resize' ) }>
|
|
275
281
|
{ /* Disable reason: role="separator" does in fact support aria-valuenow */ }
|
|
@@ -33,14 +33,17 @@ export function useLink( params, state, shouldReplace = false ) {
|
|
|
33
33
|
...Object.keys( currentArgs )
|
|
34
34
|
);
|
|
35
35
|
|
|
36
|
+
let extraParams = {};
|
|
36
37
|
if ( isPreviewingTheme() ) {
|
|
37
|
-
|
|
38
|
-
...params,
|
|
38
|
+
extraParams = {
|
|
39
39
|
wp_theme_preview: currentlyPreviewingTheme(),
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const newUrl = addQueryArgs( currentUrlWithoutArgs,
|
|
43
|
+
const newUrl = addQueryArgs( currentUrlWithoutArgs, {
|
|
44
|
+
...params,
|
|
45
|
+
...extraParams,
|
|
46
|
+
} );
|
|
44
47
|
|
|
45
48
|
return {
|
|
46
49
|
href: newUrl,
|
|
@@ -150,8 +150,7 @@ export default function SavePanel() {
|
|
|
150
150
|
} ) }
|
|
151
151
|
>
|
|
152
152
|
<Button
|
|
153
|
-
|
|
154
|
-
__next40pxDefaultSize={ false }
|
|
153
|
+
__next40pxDefaultSize
|
|
155
154
|
variant="secondary"
|
|
156
155
|
className="edit-site-editor__toggle-save-panel-button"
|
|
157
156
|
onClick={ () => setIsSaveViewOpened( true ) }
|
|
@@ -11,8 +11,7 @@ import { Button } from '@wordpress/components';
|
|
|
11
11
|
export default function SidebarButton( props ) {
|
|
12
12
|
return (
|
|
13
13
|
<Button
|
|
14
|
-
|
|
15
|
-
__next40pxDefaultSize={ false }
|
|
14
|
+
__next40pxDefaultSize
|
|
16
15
|
{ ...props }
|
|
17
16
|
className={ clsx( 'edit-site-sidebar-button', props.className ) }
|
|
18
17
|
/>
|
|
@@ -88,8 +88,7 @@ function AddNewItemModalContent( { type, setIsAdding } ) {
|
|
|
88
88
|
/>
|
|
89
89
|
<HStack justify="right">
|
|
90
90
|
<Button
|
|
91
|
-
|
|
92
|
-
__next40pxDefaultSize={ false }
|
|
91
|
+
__next40pxDefaultSize
|
|
93
92
|
variant="tertiary"
|
|
94
93
|
onClick={ () => {
|
|
95
94
|
setIsAdding( false );
|
|
@@ -99,8 +98,7 @@ function AddNewItemModalContent( { type, setIsAdding } ) {
|
|
|
99
98
|
</Button>
|
|
100
99
|
|
|
101
100
|
<Button
|
|
102
|
-
|
|
103
|
-
__next40pxDefaultSize={ false }
|
|
101
|
+
__next40pxDefaultSize
|
|
104
102
|
variant="primary"
|
|
105
103
|
type="submit"
|
|
106
104
|
aria-disabled={ ! title || isSaving }
|
|
@@ -62,8 +62,7 @@ const SiteHub = memo(
|
|
|
62
62
|
) }
|
|
63
63
|
>
|
|
64
64
|
<Button
|
|
65
|
-
|
|
66
|
-
__next40pxDefaultSize={ false }
|
|
65
|
+
__next40pxDefaultSize
|
|
67
66
|
ref={ ref }
|
|
68
67
|
href={ dashboardLink }
|
|
69
68
|
label={ __( 'Go to the Dashboard' ) }
|
|
@@ -80,8 +79,7 @@ const SiteHub = memo(
|
|
|
80
79
|
<HStack>
|
|
81
80
|
<div className="edit-site-site-hub__title">
|
|
82
81
|
<Button
|
|
83
|
-
|
|
84
|
-
__next40pxDefaultSize={ false }
|
|
82
|
+
__next40pxDefaultSize
|
|
85
83
|
variant="link"
|
|
86
84
|
href={ homeUrl }
|
|
87
85
|
target="_blank"
|
|
@@ -101,8 +99,7 @@ const SiteHub = memo(
|
|
|
101
99
|
className="edit-site-site-hub__actions"
|
|
102
100
|
>
|
|
103
101
|
<Button
|
|
104
|
-
|
|
105
|
-
__next40pxDefaultSize={ false }
|
|
102
|
+
__next40pxDefaultSize
|
|
106
103
|
className="edit-site-site-hub_toggle-command-center"
|
|
107
104
|
icon={ search }
|
|
108
105
|
onClick={ () => openCommandCenter() }
|
|
@@ -149,8 +146,7 @@ export const SiteHubMobile = memo(
|
|
|
149
146
|
) }
|
|
150
147
|
>
|
|
151
148
|
<Button
|
|
152
|
-
|
|
153
|
-
__next40pxDefaultSize={ false }
|
|
149
|
+
__next40pxDefaultSize
|
|
154
150
|
ref={ ref }
|
|
155
151
|
label={ __( 'Go to Site Editor' ) }
|
|
156
152
|
className="edit-site-layout__view-mode-toggle"
|
|
@@ -170,8 +166,7 @@ export const SiteHubMobile = memo(
|
|
|
170
166
|
<HStack>
|
|
171
167
|
<div className="edit-site-site-hub__title">
|
|
172
168
|
<Button
|
|
173
|
-
|
|
174
|
-
__next40pxDefaultSize={ false }
|
|
169
|
+
__next40pxDefaultSize
|
|
175
170
|
variant="link"
|
|
176
171
|
href={ homeUrl }
|
|
177
172
|
target="_blank"
|
|
@@ -186,8 +181,7 @@ export const SiteHubMobile = memo(
|
|
|
186
181
|
className="edit-site-site-hub__actions"
|
|
187
182
|
>
|
|
188
183
|
<Button
|
|
189
|
-
|
|
190
|
-
__next40pxDefaultSize={ false }
|
|
184
|
+
__next40pxDefaultSize
|
|
191
185
|
className="edit-site-site-hub_toggle-command-center"
|
|
192
186
|
icon={ search }
|
|
193
187
|
onClick={ () => openCommandCenter() }
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { getCategories } from '@wordpress/blocks';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import type {
|
|
10
|
+
BlockExample,
|
|
11
|
+
StyleBookCategory,
|
|
12
|
+
CategoryExamples,
|
|
13
|
+
} from './types';
|
|
14
|
+
import {
|
|
15
|
+
STYLE_BOOK_CATEGORIES,
|
|
16
|
+
STYLE_BOOK_THEME_SUBCATEGORIES,
|
|
17
|
+
} from './constants';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Returns category examples for a given category definition and list of examples.
|
|
21
|
+
* @param {StyleBookCategory} categoryDefinition The category definition.
|
|
22
|
+
* @param {BlockExample[]} examples An array of block examples.
|
|
23
|
+
* @return {CategoryExamples|undefined} An object containing the category examples.
|
|
24
|
+
*/
|
|
25
|
+
export function getExamplesByCategory(
|
|
26
|
+
categoryDefinition: StyleBookCategory,
|
|
27
|
+
examples: BlockExample[]
|
|
28
|
+
): CategoryExamples | undefined {
|
|
29
|
+
if ( ! categoryDefinition?.slug || ! examples?.length ) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if ( categoryDefinition?.subcategories?.length ) {
|
|
34
|
+
return categoryDefinition.subcategories.reduce(
|
|
35
|
+
( acc, subcategoryDefinition ) => {
|
|
36
|
+
const subcategoryExamples = getExamplesByCategory(
|
|
37
|
+
subcategoryDefinition,
|
|
38
|
+
examples
|
|
39
|
+
);
|
|
40
|
+
if ( subcategoryExamples ) {
|
|
41
|
+
acc.subcategories = [
|
|
42
|
+
...acc.subcategories,
|
|
43
|
+
subcategoryExamples,
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
return acc;
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
title: categoryDefinition.title,
|
|
50
|
+
slug: categoryDefinition.slug,
|
|
51
|
+
subcategories: [],
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const blocksToInclude = categoryDefinition?.blocks || [];
|
|
57
|
+
const blocksToExclude = categoryDefinition?.exclude || [];
|
|
58
|
+
const categoryExamples = examples.filter( ( example ) => {
|
|
59
|
+
return (
|
|
60
|
+
! blocksToExclude.includes( example.name ) &&
|
|
61
|
+
( example.category === categoryDefinition.slug ||
|
|
62
|
+
blocksToInclude.includes( example.name ) )
|
|
63
|
+
);
|
|
64
|
+
} );
|
|
65
|
+
|
|
66
|
+
if ( ! categoryExamples.length ) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
title: categoryDefinition.title,
|
|
72
|
+
slug: categoryDefinition.slug,
|
|
73
|
+
examples: categoryExamples,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Returns category examples for a given category definition and list of examples.
|
|
79
|
+
*
|
|
80
|
+
* @return {StyleBookCategory[]} An array of top-level category definitions.
|
|
81
|
+
*/
|
|
82
|
+
export function getTopLevelStyleBookCategories(): StyleBookCategory[] {
|
|
83
|
+
const reservedCategories = [
|
|
84
|
+
...STYLE_BOOK_THEME_SUBCATEGORIES,
|
|
85
|
+
...STYLE_BOOK_CATEGORIES,
|
|
86
|
+
].map( ( { slug } ) => slug );
|
|
87
|
+
const extraCategories = getCategories().filter(
|
|
88
|
+
( { slug } ) => ! reservedCategories.includes( slug )
|
|
89
|
+
);
|
|
90
|
+
return [ ...STYLE_BOOK_CATEGORIES, ...extraCategories ];
|
|
91
|
+
}
|