@wordpress/edit-site 4.3.10 → 4.6.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 +6 -0
- package/build/components/add-new-template/new-template.js +2 -2
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/global-styles/border-panel.js +95 -79
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +3 -3
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/header.js +15 -11
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +4 -4
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +1 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +1 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +3 -3
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-root.js +13 -3
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +1 -1
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +19 -14
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/list/table.js +1 -1
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/constants.js +2 -2
- package/build/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build/components/preferences-modal/index.js +5 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/routes/use-title.js +3 -1
- package/build/components/routes/use-title.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +1 -5
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/navigation-menu-sidebar/index.js +4 -2
- package/build/components/sidebar/navigation-menu-sidebar/index.js.map +1 -1
- package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js +1 -5
- package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build/index.js +11 -3
- package/build/index.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +2 -2
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +98 -80
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +4 -4
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/header.js +16 -11
- 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/palette.js +2 -2
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +2 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +4 -4
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +15 -5
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +2 -2
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +18 -14
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/list/table.js +1 -1
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js +2 -2
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +5 -1
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/routes/use-title.js +2 -1
- package/build-module/components/routes/use-title.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -5
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js +4 -2
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js +1 -5
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build-module/index.js +10 -3
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +25 -34
- package/build-style/style.css +25 -34
- package/package.json +29 -29
- package/src/components/add-new-template/new-template.js +2 -2
- package/src/components/global-styles/border-panel.js +102 -109
- package/src/components/global-styles/context-menu.js +7 -7
- package/src/components/global-styles/header.js +20 -17
- package/src/components/global-styles/navigation-button.js +3 -3
- package/src/components/global-styles/palette.js +3 -3
- package/src/components/global-styles/screen-block-list.js +3 -3
- package/src/components/global-styles/screen-colors.js +7 -7
- package/src/components/global-styles/screen-root.js +34 -24
- package/src/components/global-styles/screen-typography.js +3 -3
- package/src/components/global-styles/test/use-global-styles-output.js +1 -0
- package/src/components/global-styles/use-global-styles-output.js +31 -11
- package/src/components/header/document-actions/style.scss +1 -1
- package/src/components/header/style.scss +14 -29
- package/src/components/list/style.scss +1 -0
- package/src/components/list/table.js +1 -4
- package/src/components/navigation-sidebar/navigation-panel/constants.js +2 -2
- package/src/components/preferences-modal/index.js +8 -1
- package/src/components/routes/use-title.js +3 -2
- package/src/components/secondary-sidebar/list-view-sidebar.js +1 -5
- package/src/components/sidebar/index.js +2 -0
- package/src/components/sidebar/navigation-menu-sidebar/index.js +4 -1
- package/src/components/sidebar/navigation-menu-sidebar/navigation-menu.js +1 -7
- package/src/components/sidebar/style.scss +7 -0
- package/src/index.js +17 -1
|
@@ -12,7 +12,7 @@ import { useHasBorderPanel } from './border-panel';
|
|
|
12
12
|
import { useHasColorPanel } from './color-utils';
|
|
13
13
|
import { useHasDimensionsPanel } from './dimensions-panel';
|
|
14
14
|
import { useHasTypographyPanel } from './typography-panel';
|
|
15
|
-
import {
|
|
15
|
+
import { NavigationButtonAsItem } from './navigation-button';
|
|
16
16
|
|
|
17
17
|
function ContextMenu( { name, parentMenu = '' } ) {
|
|
18
18
|
const hasTypographyPanel = useHasTypographyPanel( name );
|
|
@@ -24,28 +24,28 @@ function ContextMenu( { name, parentMenu = '' } ) {
|
|
|
24
24
|
return (
|
|
25
25
|
<ItemGroup>
|
|
26
26
|
{ hasTypographyPanel && (
|
|
27
|
-
<
|
|
27
|
+
<NavigationButtonAsItem
|
|
28
28
|
icon={ typography }
|
|
29
29
|
path={ parentMenu + '/typography' }
|
|
30
30
|
>
|
|
31
31
|
{ __( 'Typography' ) }
|
|
32
|
-
</
|
|
32
|
+
</NavigationButtonAsItem>
|
|
33
33
|
) }
|
|
34
34
|
{ hasColorPanel && (
|
|
35
|
-
<
|
|
35
|
+
<NavigationButtonAsItem
|
|
36
36
|
icon={ color }
|
|
37
37
|
path={ parentMenu + '/colors' }
|
|
38
38
|
>
|
|
39
39
|
{ __( 'Colors' ) }
|
|
40
|
-
</
|
|
40
|
+
</NavigationButtonAsItem>
|
|
41
41
|
) }
|
|
42
42
|
{ hasLayoutPanel && (
|
|
43
|
-
<
|
|
43
|
+
<NavigationButtonAsItem
|
|
44
44
|
icon={ layout }
|
|
45
45
|
path={ parentMenu + '/layout' }
|
|
46
46
|
>
|
|
47
47
|
{ __( 'Layout' ) }
|
|
48
|
-
</
|
|
48
|
+
</NavigationButtonAsItem>
|
|
49
49
|
) }
|
|
50
50
|
</ItemGroup>
|
|
51
51
|
);
|
|
@@ -7,30 +7,33 @@ import {
|
|
|
7
7
|
__experimentalSpacer as Spacer,
|
|
8
8
|
__experimentalHeading as Heading,
|
|
9
9
|
__experimentalView as View,
|
|
10
|
+
__experimentalNavigatorBackButton as NavigatorBackButton,
|
|
10
11
|
} from '@wordpress/components';
|
|
11
12
|
import { isRTL, __ } from '@wordpress/i18n';
|
|
12
13
|
import { chevronRight, chevronLeft } from '@wordpress/icons';
|
|
13
14
|
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
import { NavigationBackButton } from './navigation-button';
|
|
18
|
-
|
|
19
15
|
function ScreenHeader( { title, description } ) {
|
|
20
16
|
return (
|
|
21
|
-
<VStack spacing={
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
<VStack spacing={ 0 }>
|
|
18
|
+
<View>
|
|
19
|
+
<Spacer marginBottom={ 0 } paddingX={ 4 } paddingY={ 3 }>
|
|
20
|
+
<HStack spacing={ 2 }>
|
|
21
|
+
<NavigatorBackButton
|
|
22
|
+
style={
|
|
23
|
+
// TODO: This style override is also used in ToolsPanelHeader.
|
|
24
|
+
// It should be supported out-of-the-box by Button.
|
|
25
|
+
{ minWidth: 24, padding: 0 }
|
|
26
|
+
}
|
|
27
|
+
icon={ isRTL() ? chevronRight : chevronLeft }
|
|
28
|
+
isSmall
|
|
29
|
+
aria-label={ __( 'Navigate to the previous view' ) }
|
|
30
|
+
/>
|
|
31
|
+
<Spacer>
|
|
32
|
+
<Heading level={ 5 }>{ title }</Heading>
|
|
33
|
+
</Spacer>
|
|
34
|
+
</HStack>
|
|
32
35
|
</Spacer>
|
|
33
|
-
</
|
|
36
|
+
</View>
|
|
34
37
|
{ description && (
|
|
35
38
|
<p className="edit-site-global-styles-header__description">
|
|
36
39
|
{ description }
|
|
@@ -28,12 +28,12 @@ function GenericNavigationButton( { icon, children, ...props } ) {
|
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
function
|
|
31
|
+
function NavigationButtonAsItem( props ) {
|
|
32
32
|
return <NavigatorButton as={ GenericNavigationButton } { ...props } />;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
function
|
|
35
|
+
function NavigationBackButtonAsItem( props ) {
|
|
36
36
|
return <NavigatorBackButton as={ GenericNavigationButton } { ...props } />;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export {
|
|
39
|
+
export { NavigationButtonAsItem, NavigationBackButtonAsItem };
|
|
@@ -16,7 +16,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
18
|
import Subtitle from './subtitle';
|
|
19
|
-
import {
|
|
19
|
+
import { NavigationButtonAsItem } from './navigation-button';
|
|
20
20
|
import { useSetting } from './hooks';
|
|
21
21
|
import ColorIndicatorWrapper from './color-indicator-wrapper';
|
|
22
22
|
|
|
@@ -58,7 +58,7 @@ function Palette( { name } ) {
|
|
|
58
58
|
<VStack spacing={ 3 }>
|
|
59
59
|
<Subtitle>{ __( 'Palette' ) }</Subtitle>
|
|
60
60
|
<ItemGroup isBordered isSeparated>
|
|
61
|
-
<
|
|
61
|
+
<NavigationButtonAsItem path={ screenPath }>
|
|
62
62
|
<HStack
|
|
63
63
|
direction={
|
|
64
64
|
colors.length === 0 ? 'row-reverse' : 'row'
|
|
@@ -73,7 +73,7 @@ function Palette( { name } ) {
|
|
|
73
73
|
</ZStack>
|
|
74
74
|
<FlexItem>{ paletteButtonText }</FlexItem>
|
|
75
75
|
</HStack>
|
|
76
|
-
</
|
|
76
|
+
</NavigationButtonAsItem>
|
|
77
77
|
</ItemGroup>
|
|
78
78
|
</VStack>
|
|
79
79
|
);
|
|
@@ -22,7 +22,7 @@ import { useHasColorPanel } from './color-utils';
|
|
|
22
22
|
import { useHasDimensionsPanel } from './dimensions-panel';
|
|
23
23
|
import { useHasTypographyPanel } from './typography-panel';
|
|
24
24
|
import ScreenHeader from './header';
|
|
25
|
-
import {
|
|
25
|
+
import { NavigationButtonAsItem } from './navigation-button';
|
|
26
26
|
|
|
27
27
|
function useSortedBlockTypes() {
|
|
28
28
|
const blockItems = useSelect(
|
|
@@ -61,12 +61,12 @@ function BlockMenuItem( { block } ) {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
return (
|
|
64
|
-
<
|
|
64
|
+
<NavigationButtonAsItem path={ '/blocks/' + block.name }>
|
|
65
65
|
<HStack justify="flex-start">
|
|
66
66
|
<BlockIcon icon={ block.icon } />
|
|
67
67
|
<FlexItem>{ block.title }</FlexItem>
|
|
68
68
|
</HStack>
|
|
69
|
-
</
|
|
69
|
+
</NavigationButtonAsItem>
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
*/
|
|
16
16
|
import ScreenHeader from './header';
|
|
17
17
|
import Palette from './palette';
|
|
18
|
-
import {
|
|
18
|
+
import { NavigationButtonAsItem } from './navigation-button';
|
|
19
19
|
import { getSupportedGlobalStylesPanels, useStyle } from './hooks';
|
|
20
20
|
import Subtitle from './subtitle';
|
|
21
21
|
import ColorIndicatorWrapper from './color-indicator-wrapper';
|
|
@@ -33,7 +33,7 @@ function BackgroundColorItem( { name, parentMenu } ) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
|
-
<
|
|
36
|
+
<NavigationButtonAsItem path={ parentMenu + '/colors/background' }>
|
|
37
37
|
<HStack justify="flex-start">
|
|
38
38
|
<ColorIndicatorWrapper expanded={ false }>
|
|
39
39
|
<ColorIndicator
|
|
@@ -42,7 +42,7 @@ function BackgroundColorItem( { name, parentMenu } ) {
|
|
|
42
42
|
</ColorIndicatorWrapper>
|
|
43
43
|
<FlexItem>{ __( 'Background' ) }</FlexItem>
|
|
44
44
|
</HStack>
|
|
45
|
-
</
|
|
45
|
+
</NavigationButtonAsItem>
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -56,14 +56,14 @@ function TextColorItem( { name, parentMenu } ) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
return (
|
|
59
|
-
<
|
|
59
|
+
<NavigationButtonAsItem path={ parentMenu + '/colors/text' }>
|
|
60
60
|
<HStack justify="flex-start">
|
|
61
61
|
<ColorIndicatorWrapper expanded={ false }>
|
|
62
62
|
<ColorIndicator colorValue={ color } />
|
|
63
63
|
</ColorIndicatorWrapper>
|
|
64
64
|
<FlexItem>{ __( 'Text' ) }</FlexItem>
|
|
65
65
|
</HStack>
|
|
66
|
-
</
|
|
66
|
+
</NavigationButtonAsItem>
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -77,14 +77,14 @@ function LinkColorItem( { name, parentMenu } ) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
return (
|
|
80
|
-
<
|
|
80
|
+
<NavigationButtonAsItem path={ parentMenu + '/colors/link' }>
|
|
81
81
|
<HStack justify="flex-start">
|
|
82
82
|
<ColorIndicatorWrapper expanded={ false }>
|
|
83
83
|
<ColorIndicator colorValue={ color } />
|
|
84
84
|
</ColorIndicatorWrapper>
|
|
85
85
|
<FlexItem>{ __( 'Links' ) }</FlexItem>
|
|
86
86
|
</HStack>
|
|
87
|
-
</
|
|
87
|
+
</NavigationButtonAsItem>
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
__experimentalItemGroup as ItemGroup,
|
|
6
|
-
__experimentalItem as Item,
|
|
7
6
|
__experimentalHStack as HStack,
|
|
7
|
+
__experimentalSpacer as Spacer,
|
|
8
8
|
__experimentalVStack as VStack,
|
|
9
9
|
FlexItem,
|
|
10
10
|
CardBody,
|
|
@@ -21,7 +21,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
21
21
|
* Internal dependencies
|
|
22
22
|
*/
|
|
23
23
|
import { IconWithCurrentColor } from './icon-with-current-color';
|
|
24
|
-
import {
|
|
24
|
+
import { NavigationButtonAsItem } from './navigation-button';
|
|
25
25
|
import ContextMenu from './context-menu';
|
|
26
26
|
import StylesPreview from './preview';
|
|
27
27
|
|
|
@@ -37,48 +37,58 @@ function ScreenRoot() {
|
|
|
37
37
|
return (
|
|
38
38
|
<Card size="small">
|
|
39
39
|
<CardBody>
|
|
40
|
-
<VStack spacing={
|
|
40
|
+
<VStack spacing={ 4 }>
|
|
41
41
|
<Card>
|
|
42
42
|
<CardMedia>
|
|
43
43
|
<StylesPreview />
|
|
44
44
|
</CardMedia>
|
|
45
45
|
</Card>
|
|
46
46
|
{ !! variations?.length && (
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
<ItemGroup>
|
|
48
|
+
<NavigationButtonAsItem path="/variations">
|
|
49
|
+
<HStack justify="space-between">
|
|
50
|
+
<FlexItem>
|
|
51
|
+
{ __( 'Browse styles' ) }
|
|
52
|
+
</FlexItem>
|
|
53
|
+
<IconWithCurrentColor
|
|
54
|
+
icon={
|
|
55
|
+
isRTL() ? chevronLeft : chevronRight
|
|
56
|
+
}
|
|
57
|
+
/>
|
|
58
|
+
</HStack>
|
|
59
|
+
</NavigationButtonAsItem>
|
|
60
|
+
</ItemGroup>
|
|
57
61
|
) }
|
|
62
|
+
<ContextMenu />
|
|
58
63
|
</VStack>
|
|
59
64
|
</CardBody>
|
|
60
65
|
|
|
61
|
-
<CardBody>
|
|
62
|
-
<ContextMenu />
|
|
63
|
-
</CardBody>
|
|
64
|
-
|
|
65
66
|
<CardDivider />
|
|
66
67
|
|
|
67
68
|
<CardBody>
|
|
69
|
+
<Spacer
|
|
70
|
+
as="p"
|
|
71
|
+
paddingTop={ 2 }
|
|
72
|
+
/*
|
|
73
|
+
* 13px matches the text inset of the NavigationButton (12px padding, plus the width of the button's border).
|
|
74
|
+
* This is an ad hoc override for this particular instance only and should be reconsidered before making into a pattern.
|
|
75
|
+
*/
|
|
76
|
+
paddingX="13px"
|
|
77
|
+
marginBottom={ 4 }
|
|
78
|
+
>
|
|
79
|
+
{ __(
|
|
80
|
+
'Customize the appearance of specific blocks for the whole site.'
|
|
81
|
+
) }
|
|
82
|
+
</Spacer>
|
|
68
83
|
<ItemGroup>
|
|
69
|
-
<
|
|
70
|
-
{ __(
|
|
71
|
-
'Customize the appearance of specific blocks for the whole site.'
|
|
72
|
-
) }
|
|
73
|
-
</Item>
|
|
74
|
-
<NavigationButton path="/blocks">
|
|
84
|
+
<NavigationButtonAsItem path="/blocks">
|
|
75
85
|
<HStack justify="space-between">
|
|
76
86
|
<FlexItem>{ __( 'Blocks' ) }</FlexItem>
|
|
77
87
|
<IconWithCurrentColor
|
|
78
88
|
icon={ isRTL() ? chevronLeft : chevronRight }
|
|
79
89
|
/>
|
|
80
90
|
</HStack>
|
|
81
|
-
</
|
|
91
|
+
</NavigationButtonAsItem>
|
|
82
92
|
</ItemGroup>
|
|
83
93
|
</CardBody>
|
|
84
94
|
</Card>
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
import ScreenHeader from './header';
|
|
16
|
-
import {
|
|
16
|
+
import { NavigationButtonAsItem } from './navigation-button';
|
|
17
17
|
import { useStyle } from './hooks';
|
|
18
18
|
import Subtitle from './subtitle';
|
|
19
19
|
import TypographyPanel from './typography-panel';
|
|
@@ -44,7 +44,7 @@ function Item( { name, parentMenu, element, label } ) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
|
-
<
|
|
47
|
+
<NavigationButtonAsItem path={ parentMenu + '/typography/' + element }>
|
|
48
48
|
<HStack justify="flex-start">
|
|
49
49
|
<FlexItem
|
|
50
50
|
className="edit-site-global-styles-screen-typography__indicator"
|
|
@@ -62,7 +62,7 @@ function Item( { name, parentMenu, element, label } ) {
|
|
|
62
62
|
</FlexItem>
|
|
63
63
|
<FlexItem>{ label }</FlexItem>
|
|
64
64
|
</HStack>
|
|
65
|
-
</
|
|
65
|
+
</NavigationButtonAsItem>
|
|
66
66
|
);
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -379,6 +379,7 @@ describe( 'global styles renderer', () => {
|
|
|
379
379
|
expect( toStyles( tree, blockSelectors ) ).toEqual(
|
|
380
380
|
'body {margin: 0;}' +
|
|
381
381
|
'body{background-color: red;margin: 10px;padding: 10px;}h1{font-size: 42px;}.wp-block-group{margin-top: 10px;margin-right: 20px;margin-bottom: 30px;margin-left: 40px;padding-top: 11px;padding-right: 22px;padding-bottom: 33px;padding-left: 44px;}h1,h2,h3,h4,h5,h6{color: orange;}h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{color: hotpink;}' +
|
|
382
|
+
'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }' +
|
|
382
383
|
'.has-white-color{color: var(--wp--preset--color--white) !important;}.has-white-background-color{background-color: var(--wp--preset--color--white) !important;}.has-white-border-color{border-color: var(--wp--preset--color--white) !important;}.has-black-color{color: var(--wp--preset--color--black) !important;}.has-black-background-color{background-color: var(--wp--preset--color--black) !important;}.has-black-border-color{border-color: var(--wp--preset--color--black) !important;}h1.has-blue-color,h2.has-blue-color,h3.has-blue-color,h4.has-blue-color,h5.has-blue-color,h6.has-blue-color{color: var(--wp--preset--color--blue) !important;}h1.has-blue-background-color,h2.has-blue-background-color,h3.has-blue-background-color,h4.has-blue-background-color,h5.has-blue-background-color,h6.has-blue-background-color{background-color: var(--wp--preset--color--blue) !important;}h1.has-blue-border-color,h2.has-blue-border-color,h3.has-blue-border-color,h4.has-blue-border-color,h5.has-blue-border-color,h6.has-blue-border-color{border-color: var(--wp--preset--color--blue) !important;}'
|
|
383
384
|
);
|
|
384
385
|
} );
|
|
@@ -26,15 +26,12 @@ import { useEffect, useState, useContext } from '@wordpress/element';
|
|
|
26
26
|
import { getCSSRules } from '@wordpress/style-engine';
|
|
27
27
|
import { __unstablePresetDuotoneFilter as PresetDuotoneFilter } from '@wordpress/block-editor';
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* Internal dependencies
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
29
|
/**
|
|
34
30
|
* Internal dependencies
|
|
35
31
|
*/
|
|
36
32
|
import { PRESET_METADATA, ROOT_BLOCK_SELECTOR } from './utils';
|
|
37
33
|
import { GlobalStylesContext } from './context';
|
|
34
|
+
import { useSetting } from './hooks';
|
|
38
35
|
|
|
39
36
|
function compileStyleValue( uncompiledValue ) {
|
|
40
37
|
const VARIABLE_REFERENCE_PREFIX = 'var:';
|
|
@@ -223,11 +220,8 @@ function getStylesDeclarations( blockStyles = {} ) {
|
|
|
223
220
|
|
|
224
221
|
// The goal is to move everything to server side generated engine styles
|
|
225
222
|
// This is temporary as we absorb more and more styles into the engine.
|
|
226
|
-
const extraRules = getCSSRules( blockStyles
|
|
223
|
+
const extraRules = getCSSRules( blockStyles );
|
|
227
224
|
extraRules.forEach( ( rule ) => {
|
|
228
|
-
if ( rule.selector !== 'self' ) {
|
|
229
|
-
throw "This style can't be added as inline style";
|
|
230
|
-
}
|
|
231
225
|
const cssProperty = rule.key.startsWith( '--' )
|
|
232
226
|
? rule.key
|
|
233
227
|
: kebabCase( rule.key );
|
|
@@ -363,7 +357,7 @@ export const toCustomProperties = ( tree, blockSelectors ) => {
|
|
|
363
357
|
return ruleset;
|
|
364
358
|
};
|
|
365
359
|
|
|
366
|
-
export const toStyles = ( tree, blockSelectors ) => {
|
|
360
|
+
export const toStyles = ( tree, blockSelectors, hasBlockGapSupport ) => {
|
|
367
361
|
const nodesWithStyles = getNodesWithStyles( tree, blockSelectors );
|
|
368
362
|
const nodesWithSettings = getNodesWithSettings( tree, blockSelectors );
|
|
369
363
|
|
|
@@ -402,6 +396,26 @@ export const toStyles = ( tree, blockSelectors ) => {
|
|
|
402
396
|
ruleset = ruleset + `${ selector }{${ declarations.join( ';' ) };}`;
|
|
403
397
|
} );
|
|
404
398
|
|
|
399
|
+
/* Add alignment / layout styles */
|
|
400
|
+
ruleset =
|
|
401
|
+
ruleset +
|
|
402
|
+
'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';
|
|
403
|
+
ruleset =
|
|
404
|
+
ruleset +
|
|
405
|
+
'.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';
|
|
406
|
+
ruleset =
|
|
407
|
+
ruleset +
|
|
408
|
+
'.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';
|
|
409
|
+
|
|
410
|
+
if ( hasBlockGapSupport ) {
|
|
411
|
+
ruleset =
|
|
412
|
+
ruleset +
|
|
413
|
+
'.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }';
|
|
414
|
+
ruleset =
|
|
415
|
+
ruleset +
|
|
416
|
+
'.wp-site-blocks > * + * { margin-block-start: var( --wp--style--block-gap ); }';
|
|
417
|
+
}
|
|
418
|
+
|
|
405
419
|
nodesWithSettings.forEach( ( { selector, presets } ) => {
|
|
406
420
|
if ( ROOT_BLOCK_SELECTOR === selector ) {
|
|
407
421
|
// Do not add extra specificity for top-level classes.
|
|
@@ -448,6 +462,8 @@ export function useGlobalStylesOutput() {
|
|
|
448
462
|
const [ settings, setSettings ] = useState( {} );
|
|
449
463
|
const [ svgFilters, setSvgFilters ] = useState( {} );
|
|
450
464
|
const { merged: mergedConfig } = useContext( GlobalStylesContext );
|
|
465
|
+
const [ blockGap ] = useSetting( 'spacing.blockGap' );
|
|
466
|
+
const hasBlockGapSupport = blockGap !== null;
|
|
451
467
|
|
|
452
468
|
useEffect( () => {
|
|
453
469
|
if ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {
|
|
@@ -459,7 +475,11 @@ export function useGlobalStylesOutput() {
|
|
|
459
475
|
mergedConfig,
|
|
460
476
|
blockSelectors
|
|
461
477
|
);
|
|
462
|
-
const globalStyles = toStyles(
|
|
478
|
+
const globalStyles = toStyles(
|
|
479
|
+
mergedConfig,
|
|
480
|
+
blockSelectors,
|
|
481
|
+
hasBlockGapSupport
|
|
482
|
+
);
|
|
463
483
|
const filters = toSvgFilters( mergedConfig, blockSelectors );
|
|
464
484
|
setStylesheets( [
|
|
465
485
|
{
|
|
@@ -475,5 +495,5 @@ export function useGlobalStylesOutput() {
|
|
|
475
495
|
setSvgFilters( filters );
|
|
476
496
|
}, [ mergedConfig ] );
|
|
477
497
|
|
|
478
|
-
return [ stylesheets, settings, svgFilters ];
|
|
498
|
+
return [ stylesheets, settings, svgFilters, hasBlockGapSupport ];
|
|
479
499
|
}
|
|
@@ -104,8 +104,9 @@ body.is-navigation-sidebar-open {
|
|
|
104
104
|
margin: 0 -6px 0;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
|
|
107
108
|
/**
|
|
108
|
-
* Buttons
|
|
109
|
+
* Buttons on the right side
|
|
109
110
|
*/
|
|
110
111
|
|
|
111
112
|
.edit-site-header__actions {
|
|
@@ -113,36 +114,23 @@ body.is-navigation-sidebar-open {
|
|
|
113
114
|
align-items: center;
|
|
114
115
|
padding-right: $grid-unit-05;
|
|
115
116
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
@include break-medium() {
|
|
120
|
-
display: inline-flex;
|
|
121
|
-
}
|
|
117
|
+
@include break-small () {
|
|
118
|
+
padding-right: $grid-unit-20 - ($grid-unit-15 * 0.5);
|
|
122
119
|
}
|
|
123
120
|
|
|
124
|
-
|
|
125
|
-
.editor-post-saved-state,
|
|
126
|
-
.components-button.components-button {
|
|
127
|
-
margin-right: $grid-unit-05;
|
|
128
|
-
|
|
129
|
-
@include break-small() {
|
|
130
|
-
margin-right: $grid-unit-15;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
121
|
+
gap: $grid-unit-05;
|
|
133
122
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
padding: 0 #{$grid-unit-15 * 0.5};
|
|
123
|
+
@include break-small() {
|
|
124
|
+
gap: $grid-unit-10;
|
|
137
125
|
}
|
|
138
126
|
|
|
139
|
-
|
|
140
|
-
.interface-pinned-items
|
|
141
|
-
|
|
142
|
-
}
|
|
127
|
+
// Pinned items.
|
|
128
|
+
.interface-pinned-items {
|
|
129
|
+
display: none;
|
|
143
130
|
|
|
144
|
-
|
|
145
|
-
|
|
131
|
+
@include break-medium() {
|
|
132
|
+
display: inline-flex;
|
|
133
|
+
}
|
|
146
134
|
}
|
|
147
135
|
}
|
|
148
136
|
|
|
@@ -192,11 +180,8 @@ body.is-navigation-sidebar-open {
|
|
|
192
180
|
.edit-site-save-button__button {
|
|
193
181
|
padding-left: 6px;
|
|
194
182
|
padding-right: 6px;
|
|
195
|
-
margin-right: $grid-unit-05;
|
|
196
|
-
}
|
|
197
|
-
.block-editor-post-preview__button-toggle {
|
|
198
|
-
margin-right: $grid-unit-05;
|
|
199
183
|
}
|
|
184
|
+
|
|
200
185
|
// The inserter and the template details toggle have custom labels, different from their aria-label, so we don't want to display both.
|
|
201
186
|
.edit-site-header-toolbar__inserter-toggle.edit-site-header-toolbar__inserter-toggle,
|
|
202
187
|
.edit-site-document-actions__get-info.edit-site-document-actions__get-info.edit-site-document-actions__get-info {
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect } from '@wordpress/data';
|
|
5
|
-
import {
|
|
6
|
-
store as coreStore,
|
|
7
|
-
__experimentalUseEntityRecords as useEntityRecords,
|
|
8
|
-
} from '@wordpress/core-data';
|
|
5
|
+
import { store as coreStore, useEntityRecords } from '@wordpress/core-data';
|
|
9
6
|
import { __, sprintf } from '@wordpress/i18n';
|
|
10
7
|
import {
|
|
11
8
|
VisuallyHidden,
|
|
@@ -31,7 +31,7 @@ export const TEMPLATES_SECONDARY = [
|
|
|
31
31
|
'date',
|
|
32
32
|
'tag',
|
|
33
33
|
'attachment',
|
|
34
|
-
'single
|
|
34
|
+
'single',
|
|
35
35
|
'front-page',
|
|
36
36
|
];
|
|
37
37
|
|
|
@@ -45,7 +45,7 @@ export const TEMPLATES_GENERAL = [ 'page-home' ];
|
|
|
45
45
|
export const TEMPLATES_POSTS_PREFIXES = [
|
|
46
46
|
'post-',
|
|
47
47
|
'author-',
|
|
48
|
-
'single-
|
|
48
|
+
'single-',
|
|
49
49
|
'tag-',
|
|
50
50
|
];
|
|
51
51
|
|
|
@@ -39,7 +39,14 @@ export default function EditSitePreferencesModal( {
|
|
|
39
39
|
<EnableFeature
|
|
40
40
|
featureName="showIconLabels"
|
|
41
41
|
label={ __( 'Show button text labels' ) }
|
|
42
|
-
help={ __( 'Show text instead of icons on buttons' ) }
|
|
42
|
+
help={ __( 'Show text instead of icons on buttons.' ) }
|
|
43
|
+
/>
|
|
44
|
+
<EnableFeature
|
|
45
|
+
featureName="showListViewByDefault"
|
|
46
|
+
help={ __(
|
|
47
|
+
'Opens the block list view sidebar by default.'
|
|
48
|
+
) }
|
|
49
|
+
label={ __( 'Always open list view' ) }
|
|
43
50
|
/>
|
|
44
51
|
</PreferencesModalSection>
|
|
45
52
|
),
|
|
@@ -6,6 +6,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
6
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
7
7
|
import { __, sprintf } from '@wordpress/i18n';
|
|
8
8
|
import { speak } from '@wordpress/a11y';
|
|
9
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Internal dependencies
|
|
@@ -36,8 +37,8 @@ export default function useTitle( title ) {
|
|
|
36
37
|
const formattedTitle = sprintf(
|
|
37
38
|
/* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */
|
|
38
39
|
__( '%1$s ‹ %2$s — WordPress' ),
|
|
39
|
-
title,
|
|
40
|
-
siteTitle
|
|
40
|
+
decodeEntities( title ),
|
|
41
|
+
decodeEntities( siteTitle )
|
|
41
42
|
);
|
|
42
43
|
|
|
43
44
|
document.title = formattedTitle;
|
|
@@ -46,6 +46,7 @@ export function SidebarComplementaryAreaFills() {
|
|
|
46
46
|
[]
|
|
47
47
|
);
|
|
48
48
|
const { enableComplementaryArea } = useDispatch( interfaceStore );
|
|
49
|
+
|
|
49
50
|
useEffect( () => {
|
|
50
51
|
if ( ! isEditorSidebarOpened ) return;
|
|
51
52
|
if ( hasBlockSelection ) {
|
|
@@ -54,6 +55,7 @@ export function SidebarComplementaryAreaFills() {
|
|
|
54
55
|
enableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );
|
|
55
56
|
}
|
|
56
57
|
}, [ hasBlockSelection, isEditorSidebarOpened ] );
|
|
58
|
+
|
|
57
59
|
let sidebarName = sidebar;
|
|
58
60
|
if ( ! isEditorSidebarOpened ) {
|
|
59
61
|
sidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;
|
|
@@ -16,7 +16,7 @@ export default function NavigationMenuSidebar() {
|
|
|
16
16
|
<DefaultSidebar
|
|
17
17
|
className="edit-site-navigation-menu-sidebar"
|
|
18
18
|
identifier="edit-site/navigation-menu"
|
|
19
|
-
title={ __( 'Navigation
|
|
19
|
+
title={ __( 'Navigation' ) }
|
|
20
20
|
icon={ navigation }
|
|
21
21
|
closeLabel={ __( 'Close navigation menu sidebar' ) }
|
|
22
22
|
panelClassName="edit-site-navigation-menu-sidebar__panel"
|
|
@@ -24,6 +24,9 @@ export default function NavigationMenuSidebar() {
|
|
|
24
24
|
<Flex>
|
|
25
25
|
<FlexBlock>
|
|
26
26
|
<strong>{ __( 'Navigation Menus' ) }</strong>
|
|
27
|
+
<span className="edit-site-navigation-sidebar__beta">
|
|
28
|
+
{ __( 'Beta' ) }
|
|
29
|
+
</span>
|
|
27
30
|
</FlexBlock>
|
|
28
31
|
</Flex>
|
|
29
32
|
}
|