@wordpress/edit-site 5.3.3 → 5.4.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-template/new-template.js +1 -20
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +1 -0
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/editor/index.js +3 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +4 -4
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +5 -2
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/color-utils.js +1 -1
- package/build/components/global-styles/color-utils.js.map +1 -1
- package/build/components/global-styles/context-menu.js +16 -3
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/custom-css.js +1 -1
- package/build/components/global-styles/custom-css.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +8 -7
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +8 -3
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/header.js +3 -1
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/hooks.js +14 -51
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/palette.js +3 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +3 -2
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +14 -3
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +7 -5
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +8 -6
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-heading-color.js +8 -6
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +3 -2
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +3 -2
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +3 -1
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/shadow-panel.js +2 -3
- package/build/components/global-styles/shadow-panel.js.map +1 -1
- package/build/components/global-styles/subtitle.js +3 -2
- package/build/components/global-styles/subtitle.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +23 -300
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/navigation-inspector/index.js +0 -29
- package/build/components/navigation-inspector/index.js.map +1 -1
- package/build/components/navigation-inspector/navigation-menu.js +4 -2
- package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build/components/sidebar/index.js +1 -20
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +1 -1
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-card/index.js +9 -2
- package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-card/last-revision.js +84 -0
- package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
- package/build/components/start-template-options/index.js +175 -0
- package/build/components/start-template-options/index.js.map +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js +5 -4
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +1 -18
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +1 -0
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/editor/index.js +2 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +5 -5
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +5 -2
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/color-utils.js +2 -2
- package/build-module/components/global-styles/color-utils.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +13 -2
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +1 -1
- package/build-module/components/global-styles/custom-css.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +9 -8
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +8 -3
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/header.js +3 -1
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +12 -49
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/palette.js +3 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +4 -3
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +12 -3
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +8 -6
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +9 -7
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-heading-color.js +9 -7
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +4 -3
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +4 -3
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +3 -1
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel.js +3 -4
- package/build-module/components/global-styles/shadow-panel.js.map +1 -1
- package/build-module/components/global-styles/subtitle.js +3 -2
- package/build-module/components/global-styles/subtitle.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +27 -300
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/navigation-inspector/index.js +0 -27
- package/build-module/components/navigation-inspector/index.js.map +1 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +4 -2
- package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build-module/components/sidebar/index.js +1 -18
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +1 -1
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-card/index.js +9 -4
- package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-card/last-revision.js +70 -0
- package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
- package/build-module/components/start-template-options/index.js +156 -0
- package/build-module/components/start-template-options/index.js.map +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js +6 -5
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-style/style-rtl.css +73 -4
- package/build-style/style.css +73 -4
- package/package.json +31 -31
- package/src/components/add-new-template/new-template.js +1 -16
- package/src/components/app/index.js +0 -1
- package/src/components/block-editor/editor-canvas.js +1 -0
- package/src/components/editor/index.js +2 -0
- package/src/components/global-styles/border-panel.js +5 -5
- package/src/components/global-styles/color-palette-panel.js +3 -0
- package/src/components/global-styles/color-utils.js +2 -3
- package/src/components/global-styles/context-menu.js +17 -2
- package/src/components/global-styles/custom-css.js +1 -1
- package/src/components/global-styles/dimensions-panel.js +12 -8
- package/src/components/global-styles/gradients-palette-panel.js +4 -1
- package/src/components/global-styles/header.js +7 -1
- package/src/components/global-styles/hooks.js +17 -90
- package/src/components/global-styles/palette.js +1 -1
- package/src/components/global-styles/screen-background-color.js +3 -2
- package/src/components/global-styles/screen-block-list.js +19 -3
- package/src/components/global-styles/screen-button-color.js +8 -6
- package/src/components/global-styles/screen-colors.js +7 -7
- package/src/components/global-styles/screen-heading-color.js +9 -7
- package/src/components/global-styles/screen-link-color.js +3 -2
- package/src/components/global-styles/screen-text-color.js +3 -2
- package/src/components/global-styles/screen-typography.js +1 -1
- package/src/components/global-styles/shadow-panel.js +6 -3
- package/src/components/global-styles/style.scss +5 -0
- package/src/components/global-styles/subtitle.js +5 -2
- package/src/components/global-styles/typography-panel.js +30 -394
- package/src/components/navigation-inspector/index.js +0 -32
- package/src/components/navigation-inspector/navigation-menu.js +8 -2
- package/src/components/sidebar/index.js +4 -17
- package/src/components/sidebar-edit-mode/index.js +1 -1
- package/src/components/sidebar-edit-mode/template-card/index.js +24 -14
- package/src/components/sidebar-edit-mode/template-card/last-revision.js +75 -0
- package/src/components/sidebar-edit-mode/template-card/style.scss +4 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +0 -4
- package/src/components/start-template-options/index.js +171 -0
- package/src/components/start-template-options/style.scss +76 -0
- package/src/hooks/push-changes-to-global-styles/index.js +26 -21
- package/src/style.scss +1 -0
|
@@ -27,7 +27,7 @@ import { Icon, positionCenter, stretchWide } from '@wordpress/icons';
|
|
|
27
27
|
/**
|
|
28
28
|
* Internal dependencies
|
|
29
29
|
*/
|
|
30
|
-
import {
|
|
30
|
+
import { useSupportedStyles } from './hooks';
|
|
31
31
|
import { unlock } from '../../private-apis';
|
|
32
32
|
|
|
33
33
|
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
@@ -53,42 +53,42 @@ export function useHasDimensionsPanel( name ) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
function useHasContentSize( name ) {
|
|
56
|
-
const supports =
|
|
56
|
+
const supports = useSupportedStyles( name );
|
|
57
57
|
const [ settings ] = useGlobalSetting( 'layout.contentSize', name );
|
|
58
58
|
|
|
59
59
|
return settings && supports.includes( 'contentSize' );
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function useHasWideSize( name ) {
|
|
63
|
-
const supports =
|
|
63
|
+
const supports = useSupportedStyles( name );
|
|
64
64
|
const [ settings ] = useGlobalSetting( 'layout.wideSize', name );
|
|
65
65
|
|
|
66
66
|
return settings && supports.includes( 'wideSize' );
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
function useHasPadding( name ) {
|
|
70
|
-
const supports =
|
|
70
|
+
const supports = useSupportedStyles( name );
|
|
71
71
|
const [ settings ] = useGlobalSetting( 'spacing.padding', name );
|
|
72
72
|
|
|
73
73
|
return settings && supports.includes( 'padding' );
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
function useHasMargin( name ) {
|
|
77
|
-
const supports =
|
|
77
|
+
const supports = useSupportedStyles( name );
|
|
78
78
|
const [ settings ] = useGlobalSetting( 'spacing.margin', name );
|
|
79
79
|
|
|
80
80
|
return settings && supports.includes( 'margin' );
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
function useHasGap( name ) {
|
|
84
|
-
const supports =
|
|
84
|
+
const supports = useSupportedStyles( name );
|
|
85
85
|
const [ settings ] = useGlobalSetting( 'spacing.blockGap', name );
|
|
86
86
|
|
|
87
87
|
return settings && supports.includes( 'blockGap' );
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
function useHasMinHeight( name ) {
|
|
91
|
-
const supports =
|
|
91
|
+
const supports = useSupportedStyles( name );
|
|
92
92
|
const [ settings ] = useGlobalSetting( 'dimensions.minHeight', name );
|
|
93
93
|
|
|
94
94
|
return settings && supports.includes( 'minHeight' );
|
|
@@ -413,7 +413,11 @@ export default function DimensionsPanel( { name, variation = '' } ) {
|
|
|
413
413
|
};
|
|
414
414
|
|
|
415
415
|
return (
|
|
416
|
-
<ToolsPanel
|
|
416
|
+
<ToolsPanel
|
|
417
|
+
label={ __( 'Dimensions' ) }
|
|
418
|
+
resetAll={ resetAll }
|
|
419
|
+
headingLevel={ 3 }
|
|
420
|
+
>
|
|
417
421
|
{ ( showContentSizeControl || showWideSizeControl ) && (
|
|
418
422
|
<span className="span-columns">
|
|
419
423
|
{ __( 'Set the width of the main content area.' ) }
|
|
@@ -75,6 +75,7 @@ export default function GradientPalettePanel( { name } ) {
|
|
|
75
75
|
gradients={ themeGradients }
|
|
76
76
|
onChange={ setThemeGradients }
|
|
77
77
|
paletteLabel={ __( 'Theme' ) }
|
|
78
|
+
paletteLabelHeadingLevel={ 3 }
|
|
78
79
|
/>
|
|
79
80
|
) }
|
|
80
81
|
{ !! defaultGradients &&
|
|
@@ -86,12 +87,14 @@ export default function GradientPalettePanel( { name } ) {
|
|
|
86
87
|
gradients={ defaultGradients }
|
|
87
88
|
onChange={ setDefaultGradients }
|
|
88
89
|
paletteLabel={ __( 'Default' ) }
|
|
90
|
+
paletteLabelLevel={ 3 }
|
|
89
91
|
/>
|
|
90
92
|
) }
|
|
91
93
|
<PaletteEdit
|
|
92
94
|
gradients={ customGradients }
|
|
93
95
|
onChange={ setCustomGradients }
|
|
94
96
|
paletteLabel={ __( 'Custom' ) }
|
|
97
|
+
paletteLabelLevel={ 3 }
|
|
95
98
|
emptyMessage={ __(
|
|
96
99
|
'Custom gradients are empty! Add some gradients to create your own palette.'
|
|
97
100
|
) }
|
|
@@ -99,7 +102,7 @@ export default function GradientPalettePanel( { name } ) {
|
|
|
99
102
|
/>
|
|
100
103
|
{ !! duotonePalette && !! duotonePalette.length && (
|
|
101
104
|
<div>
|
|
102
|
-
<Subtitle>{ __( 'Duotone' ) }</Subtitle>
|
|
105
|
+
<Subtitle level={ 3 }>{ __( 'Duotone' ) }</Subtitle>
|
|
103
106
|
<Spacer margin={ 3 } />
|
|
104
107
|
<DuotonePicker
|
|
105
108
|
duotonePalette={ duotonePalette }
|
|
@@ -29,7 +29,13 @@ function ScreenHeader( { title, description } ) {
|
|
|
29
29
|
aria-label={ __( 'Navigate to the previous view' ) }
|
|
30
30
|
/>
|
|
31
31
|
<Spacer>
|
|
32
|
-
<Heading
|
|
32
|
+
<Heading
|
|
33
|
+
className="edit-site-global-styles-header"
|
|
34
|
+
level={ 2 }
|
|
35
|
+
size={ 13 }
|
|
36
|
+
>
|
|
37
|
+
{ title }
|
|
38
|
+
</Heading>
|
|
33
39
|
</Spacer>
|
|
34
40
|
</HStack>
|
|
35
41
|
</Spacer>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
4
|
import { colord, extend } from 'colord';
|
|
6
5
|
import a11yPlugin from 'colord/plugins/a11y';
|
|
7
6
|
|
|
@@ -10,107 +9,20 @@ import a11yPlugin from 'colord/plugins/a11y';
|
|
|
10
9
|
*/
|
|
11
10
|
import { _x } from '@wordpress/i18n';
|
|
12
11
|
import { useMemo } from '@wordpress/element';
|
|
13
|
-
import {
|
|
14
|
-
getBlockType,
|
|
15
|
-
__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,
|
|
16
|
-
} from '@wordpress/blocks';
|
|
12
|
+
import { store as blocksStore } from '@wordpress/blocks';
|
|
17
13
|
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
18
14
|
|
|
19
15
|
/**
|
|
20
16
|
* Internal dependencies
|
|
21
17
|
*/
|
|
22
18
|
import { unlock } from '../../private-apis';
|
|
19
|
+
import { useSelect } from '@wordpress/data';
|
|
23
20
|
|
|
24
21
|
const { useGlobalSetting } = unlock( blockEditorPrivateApis );
|
|
25
22
|
|
|
26
23
|
// Enable colord's a11y plugin.
|
|
27
24
|
extend( [ a11yPlugin ] );
|
|
28
25
|
|
|
29
|
-
const ROOT_BLOCK_SUPPORTS = [
|
|
30
|
-
'background',
|
|
31
|
-
'backgroundColor',
|
|
32
|
-
'color',
|
|
33
|
-
'linkColor',
|
|
34
|
-
'buttonColor',
|
|
35
|
-
'fontFamily',
|
|
36
|
-
'fontSize',
|
|
37
|
-
'fontStyle',
|
|
38
|
-
'fontWeight',
|
|
39
|
-
'lineHeight',
|
|
40
|
-
'textDecoration',
|
|
41
|
-
'padding',
|
|
42
|
-
'contentSize',
|
|
43
|
-
'wideSize',
|
|
44
|
-
'blockGap',
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
export function getSupportedGlobalStylesPanels( name ) {
|
|
48
|
-
if ( ! name ) {
|
|
49
|
-
return ROOT_BLOCK_SUPPORTS;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const blockType = getBlockType( name );
|
|
53
|
-
|
|
54
|
-
if ( ! blockType ) {
|
|
55
|
-
return [];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const supportKeys = [];
|
|
59
|
-
|
|
60
|
-
// Check for blockGap support.
|
|
61
|
-
// Block spacing support doesn't map directly to a single style property, so needs to be handled separately.
|
|
62
|
-
// Also, only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.
|
|
63
|
-
if (
|
|
64
|
-
blockType?.supports?.spacing?.blockGap &&
|
|
65
|
-
blockType?.supports?.spacing?.__experimentalSkipSerialization !==
|
|
66
|
-
true &&
|
|
67
|
-
! blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(
|
|
68
|
-
( spacingType ) => spacingType === 'blockGap'
|
|
69
|
-
)
|
|
70
|
-
) {
|
|
71
|
-
supportKeys.push( 'blockGap' );
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// check for shadow support
|
|
75
|
-
if ( blockType?.supports?.shadow ) {
|
|
76
|
-
supportKeys.push( 'shadow' );
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
Object.keys( STYLE_PROPERTY ).forEach( ( styleName ) => {
|
|
80
|
-
if ( ! STYLE_PROPERTY[ styleName ].support ) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Opting out means that, for certain support keys like background color,
|
|
85
|
-
// blocks have to explicitly set the support value false. If the key is
|
|
86
|
-
// unset, we still enable it.
|
|
87
|
-
if ( STYLE_PROPERTY[ styleName ].requiresOptOut ) {
|
|
88
|
-
if (
|
|
89
|
-
STYLE_PROPERTY[ styleName ].support[ 0 ] in
|
|
90
|
-
blockType.supports &&
|
|
91
|
-
get(
|
|
92
|
-
blockType.supports,
|
|
93
|
-
STYLE_PROPERTY[ styleName ].support
|
|
94
|
-
) !== false
|
|
95
|
-
) {
|
|
96
|
-
return supportKeys.push( styleName );
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (
|
|
101
|
-
get(
|
|
102
|
-
blockType.supports,
|
|
103
|
-
STYLE_PROPERTY[ styleName ].support,
|
|
104
|
-
false
|
|
105
|
-
)
|
|
106
|
-
) {
|
|
107
|
-
return supportKeys.push( styleName );
|
|
108
|
-
}
|
|
109
|
-
} );
|
|
110
|
-
|
|
111
|
-
return supportKeys;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
26
|
export function useColorsPerOrigin( name ) {
|
|
115
27
|
const [ customColors ] = useGlobalSetting( 'color.palette.custom', name );
|
|
116
28
|
const [ themeColors ] = useGlobalSetting( 'color.palette.theme', name );
|
|
@@ -240,3 +152,18 @@ export function useColorRandomizer( name ) {
|
|
|
240
152
|
? [ randomizeColors ]
|
|
241
153
|
: [];
|
|
242
154
|
}
|
|
155
|
+
|
|
156
|
+
export function useSupportedStyles( name, element ) {
|
|
157
|
+
const { supportedPanels } = useSelect(
|
|
158
|
+
( select ) => {
|
|
159
|
+
return {
|
|
160
|
+
supportedPanels: unlock(
|
|
161
|
+
select( blocksStore )
|
|
162
|
+
).getSupportedStyles( name, element ),
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
[ name, element ]
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
return supportedPanels;
|
|
169
|
+
}
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
*/
|
|
18
18
|
import ScreenHeader from './header';
|
|
19
19
|
import {
|
|
20
|
-
|
|
20
|
+
useSupportedStyles,
|
|
21
21
|
useColorsPerOrigin,
|
|
22
22
|
useGradientsPerOrigin,
|
|
23
23
|
} from './hooks';
|
|
@@ -27,7 +27,7 @@ const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
|
27
27
|
|
|
28
28
|
function ScreenBackgroundColor( { name, variation = '' } ) {
|
|
29
29
|
const prefix = variation ? `variations.${ variation }.` : '';
|
|
30
|
-
const supports =
|
|
30
|
+
const supports = useSupportedStyles( name );
|
|
31
31
|
const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
|
|
32
32
|
const [ areCustomGradientsEnabled ] = useGlobalSetting(
|
|
33
33
|
'color.customGradient',
|
|
@@ -122,6 +122,7 @@ function ScreenBackgroundColor( { name, variation = '' } ) {
|
|
|
122
122
|
showTitle={ false }
|
|
123
123
|
enableAlpha
|
|
124
124
|
__experimentalIsRenderedInSidebar
|
|
125
|
+
headingLevel={ 3 }
|
|
125
126
|
{ ...controlProps }
|
|
126
127
|
/>
|
|
127
128
|
</>
|
|
@@ -10,7 +10,10 @@ import {
|
|
|
10
10
|
} from '@wordpress/components';
|
|
11
11
|
import { useSelect } from '@wordpress/data';
|
|
12
12
|
import { useState, useMemo, useEffect, useRef } from '@wordpress/element';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
BlockIcon,
|
|
15
|
+
privateApis as blockEditorPrivateApis,
|
|
16
|
+
} from '@wordpress/block-editor';
|
|
14
17
|
import { useDebounce } from '@wordpress/compose';
|
|
15
18
|
import { speak } from '@wordpress/a11y';
|
|
16
19
|
|
|
@@ -20,10 +23,17 @@ import { speak } from '@wordpress/a11y';
|
|
|
20
23
|
import { useHasBorderPanel } from './border-panel';
|
|
21
24
|
import { useHasColorPanel } from './color-utils';
|
|
22
25
|
import { useHasDimensionsPanel } from './dimensions-panel';
|
|
23
|
-
import { useHasTypographyPanel } from './typography-panel';
|
|
24
26
|
import { useHasVariationsPanel } from './variations-panel';
|
|
25
27
|
import ScreenHeader from './header';
|
|
26
28
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
29
|
+
import { unlock } from '../../private-apis';
|
|
30
|
+
import { useSupportedStyles } from './hooks';
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
useHasTypographyPanel,
|
|
34
|
+
useGlobalSetting,
|
|
35
|
+
overrideSettingsWithSupports,
|
|
36
|
+
} = unlock( blockEditorPrivateApis );
|
|
27
37
|
|
|
28
38
|
function useSortedBlockTypes() {
|
|
29
39
|
const blockItems = useSelect(
|
|
@@ -49,7 +59,13 @@ function useSortedBlockTypes() {
|
|
|
49
59
|
}
|
|
50
60
|
|
|
51
61
|
function BlockMenuItem( { block } ) {
|
|
52
|
-
const
|
|
62
|
+
const [ rawSettings ] = useGlobalSetting( '', block.name );
|
|
63
|
+
const supports = useSupportedStyles( block.name );
|
|
64
|
+
const settings = useMemo(
|
|
65
|
+
() => overrideSettingsWithSupports( rawSettings, supports ),
|
|
66
|
+
[ rawSettings, supports ]
|
|
67
|
+
);
|
|
68
|
+
const hasTypographyPanel = useHasTypographyPanel( settings );
|
|
53
69
|
const hasColorPanel = useHasColorPanel( block.name );
|
|
54
70
|
const hasBorderPanel = useHasBorderPanel( block.name );
|
|
55
71
|
const hasDimensionsPanel = useHasDimensionsPanel( block.name );
|
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
13
|
import ScreenHeader from './header';
|
|
14
|
-
import {
|
|
14
|
+
import { useSupportedStyles, useColorsPerOrigin } from './hooks';
|
|
15
15
|
import { unlock } from '../../private-apis';
|
|
16
16
|
|
|
17
17
|
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
18
18
|
|
|
19
19
|
function ScreenButtonColor( { name, variation = '' } ) {
|
|
20
20
|
const prefix = variation ? `variations.${ variation }.` : '';
|
|
21
|
-
const supports =
|
|
21
|
+
const supports = useSupportedStyles( name );
|
|
22
22
|
const colorsPerOrigin = useColorsPerOrigin( name );
|
|
23
23
|
const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
|
|
24
24
|
const [ isBackgroundEnabled ] = useGlobalSetting(
|
|
@@ -64,9 +64,9 @@ function ScreenButtonColor( { name, variation = '' } ) {
|
|
|
64
64
|
) }
|
|
65
65
|
/>
|
|
66
66
|
|
|
67
|
-
<
|
|
67
|
+
<h3 className="edit-site-global-styles-section-title">
|
|
68
68
|
{ __( 'Text color' ) }
|
|
69
|
-
</
|
|
69
|
+
</h3>
|
|
70
70
|
|
|
71
71
|
<ColorGradientControl
|
|
72
72
|
className="edit-site-screen-button-color__control"
|
|
@@ -78,11 +78,12 @@ function ScreenButtonColor( { name, variation = '' } ) {
|
|
|
78
78
|
colorValue={ buttonTextColor }
|
|
79
79
|
onColorChange={ setButtonTextColor }
|
|
80
80
|
clearable={ buttonTextColor === userButtonTextColor }
|
|
81
|
+
headingLevel={ 4 }
|
|
81
82
|
/>
|
|
82
83
|
|
|
83
|
-
<
|
|
84
|
+
<h3 className="edit-site-global-styles-section-title">
|
|
84
85
|
{ __( 'Background color' ) }
|
|
85
|
-
</
|
|
86
|
+
</h3>
|
|
86
87
|
|
|
87
88
|
<ColorGradientControl
|
|
88
89
|
className="edit-site-screen-button-color__control"
|
|
@@ -94,6 +95,7 @@ function ScreenButtonColor( { name, variation = '' } ) {
|
|
|
94
95
|
colorValue={ buttonBgColor }
|
|
95
96
|
onColorChange={ setButtonBgColor }
|
|
96
97
|
clearable={ buttonBgColor === userButtonBgColor }
|
|
98
|
+
headingLevel={ 4 }
|
|
97
99
|
/>
|
|
98
100
|
</>
|
|
99
101
|
);
|
|
@@ -18,7 +18,7 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
|
18
18
|
import ScreenHeader from './header';
|
|
19
19
|
import Palette from './palette';
|
|
20
20
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
21
|
-
import {
|
|
21
|
+
import { useSupportedStyles } from './hooks';
|
|
22
22
|
import Subtitle from './subtitle';
|
|
23
23
|
import ColorIndicatorWrapper from './color-indicator-wrapper';
|
|
24
24
|
import BlockPreviewPanel from './block-preview-panel';
|
|
@@ -30,7 +30,7 @@ const { useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
|
30
30
|
function BackgroundColorItem( { name, parentMenu, variation = '' } ) {
|
|
31
31
|
const prefix = variation ? `variations.${ variation }.` : '';
|
|
32
32
|
const urlPrefix = variation ? `/variations/${ variation }` : '';
|
|
33
|
-
const supports =
|
|
33
|
+
const supports = useSupportedStyles( name );
|
|
34
34
|
const hasSupport =
|
|
35
35
|
supports.includes( 'backgroundColor' ) ||
|
|
36
36
|
supports.includes( 'background' );
|
|
@@ -67,7 +67,7 @@ function BackgroundColorItem( { name, parentMenu, variation = '' } ) {
|
|
|
67
67
|
function TextColorItem( { name, parentMenu, variation = '' } ) {
|
|
68
68
|
const prefix = variation ? `variations.${ variation }.` : '';
|
|
69
69
|
const urlPrefix = variation ? `/variations/${ variation }` : '';
|
|
70
|
-
const supports =
|
|
70
|
+
const supports = useSupportedStyles( name );
|
|
71
71
|
const hasSupport = supports.includes( 'color' );
|
|
72
72
|
const [ color ] = useGlobalStyle( prefix + 'color.text', name );
|
|
73
73
|
|
|
@@ -98,7 +98,7 @@ function TextColorItem( { name, parentMenu, variation = '' } ) {
|
|
|
98
98
|
function LinkColorItem( { name, parentMenu, variation = '' } ) {
|
|
99
99
|
const prefix = variation ? `variations.${ variation }.` : '';
|
|
100
100
|
const urlPrefix = variation ? `/variations/${ variation }` : '';
|
|
101
|
-
const supports =
|
|
101
|
+
const supports = useSupportedStyles( name );
|
|
102
102
|
const hasSupport = supports.includes( 'linkColor' );
|
|
103
103
|
const [ color ] = useGlobalStyle(
|
|
104
104
|
prefix + 'elements.link.color.text',
|
|
@@ -138,7 +138,7 @@ function LinkColorItem( { name, parentMenu, variation = '' } ) {
|
|
|
138
138
|
function HeadingColorItem( { name, parentMenu, variation = '' } ) {
|
|
139
139
|
const prefix = variation ? `variations.${ variation }.` : '';
|
|
140
140
|
const urlPrefix = variation ? `/variations/${ variation }` : '';
|
|
141
|
-
const supports =
|
|
141
|
+
const supports = useSupportedStyles( name );
|
|
142
142
|
const hasSupport = supports.includes( 'color' );
|
|
143
143
|
const [ color ] = useGlobalStyle(
|
|
144
144
|
prefix + 'elements.heading.color.text',
|
|
@@ -176,7 +176,7 @@ function HeadingColorItem( { name, parentMenu, variation = '' } ) {
|
|
|
176
176
|
function ButtonColorItem( { name, parentMenu, variation = '' } ) {
|
|
177
177
|
const prefix = variation ? `variations.${ variation }.` : '';
|
|
178
178
|
const urlPrefix = variation ? `/variations/${ variation }` : '';
|
|
179
|
-
const supports =
|
|
179
|
+
const supports = useSupportedStyles( name );
|
|
180
180
|
const hasSupport = supports.includes( 'buttonColor' );
|
|
181
181
|
const [ color ] = useGlobalStyle(
|
|
182
182
|
prefix + 'elements.button.color.text',
|
|
@@ -233,7 +233,7 @@ function ScreenColors( { name, variation = '' } ) {
|
|
|
233
233
|
<Palette name={ name } />
|
|
234
234
|
|
|
235
235
|
<VStack spacing={ 3 }>
|
|
236
|
-
<Subtitle>{ __( 'Elements' ) }</Subtitle>
|
|
236
|
+
<Subtitle level={ 3 }>{ __( 'Elements' ) }</Subtitle>
|
|
237
237
|
<ItemGroup isBordered isSeparated>
|
|
238
238
|
<BackgroundColorItem
|
|
239
239
|
name={ name }
|
|
@@ -17,7 +17,7 @@ import { useState } from '@wordpress/element';
|
|
|
17
17
|
*/
|
|
18
18
|
import ScreenHeader from './header';
|
|
19
19
|
import {
|
|
20
|
-
|
|
20
|
+
useSupportedStyles,
|
|
21
21
|
useColorsPerOrigin,
|
|
22
22
|
useGradientsPerOrigin,
|
|
23
23
|
} from './hooks';
|
|
@@ -28,7 +28,7 @@ const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
|
28
28
|
function ScreenHeadingColor( { name, variation = '' } ) {
|
|
29
29
|
const prefix = variation ? `variations.${ variation }.` : '';
|
|
30
30
|
const [ selectedLevel, setCurrentTab ] = useState( 'heading' );
|
|
31
|
-
const supports =
|
|
31
|
+
const supports = useSupportedStyles( name );
|
|
32
32
|
const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
|
|
33
33
|
const [ areCustomGradientsEnabled ] = useGlobalSetting(
|
|
34
34
|
'color.customGradient',
|
|
@@ -125,7 +125,7 @@ function ScreenHeadingColor( { name, variation = '' } ) {
|
|
|
125
125
|
) }
|
|
126
126
|
/>
|
|
127
127
|
<div className="edit-site-global-styles-screen-heading-color">
|
|
128
|
-
<
|
|
128
|
+
<h3>{ __( 'Select heading level' ) }</h3>
|
|
129
129
|
|
|
130
130
|
<ToggleGroupControl
|
|
131
131
|
__nextHasNoMarginBottom
|
|
@@ -151,7 +151,7 @@ function ScreenHeadingColor( { name, variation = '' } ) {
|
|
|
151
151
|
</div>
|
|
152
152
|
{ hasTextColor && (
|
|
153
153
|
<div className="edit-site-global-styles-screen-heading-color">
|
|
154
|
-
<
|
|
154
|
+
<h3>
|
|
155
155
|
{ selectedLevel === 'heading'
|
|
156
156
|
? __( 'Text color for all heading levels' )
|
|
157
157
|
: sprintf(
|
|
@@ -159,7 +159,7 @@ function ScreenHeadingColor( { name, variation = '' } ) {
|
|
|
159
159
|
__( 'Text color for %s' ),
|
|
160
160
|
selectedLevel.toUpperCase()
|
|
161
161
|
) }
|
|
162
|
-
</
|
|
162
|
+
</h3>
|
|
163
163
|
<ColorGradientControl
|
|
164
164
|
className="edit-site-screen-heading-text-color__control"
|
|
165
165
|
colors={ colorsPerOrigin }
|
|
@@ -170,12 +170,13 @@ function ScreenHeadingColor( { name, variation = '' } ) {
|
|
|
170
170
|
colorValue={ color }
|
|
171
171
|
onColorChange={ setColor }
|
|
172
172
|
clearable={ color === userColor }
|
|
173
|
+
headingLevel={ 4 }
|
|
173
174
|
/>
|
|
174
175
|
</div>
|
|
175
176
|
) }
|
|
176
177
|
{ hasBackgroundColor && (
|
|
177
178
|
<div className="edit-site-global-styles-screen-heading-color">
|
|
178
|
-
<
|
|
179
|
+
<h3>
|
|
179
180
|
{ selectedLevel === 'heading'
|
|
180
181
|
? __( 'Background color for all heading levels' )
|
|
181
182
|
: sprintf(
|
|
@@ -183,7 +184,7 @@ function ScreenHeadingColor( { name, variation = '' } ) {
|
|
|
183
184
|
__( 'Background color for %s' ),
|
|
184
185
|
selectedLevel.toUpperCase()
|
|
185
186
|
) }
|
|
186
|
-
</
|
|
187
|
+
</h3>
|
|
187
188
|
<ColorGradientControl
|
|
188
189
|
className="edit-site-screen-heading-background-color__control"
|
|
189
190
|
colors={ colorsPerOrigin }
|
|
@@ -193,6 +194,7 @@ function ScreenHeadingColor( { name, variation = '' } ) {
|
|
|
193
194
|
showTitle={ false }
|
|
194
195
|
enableAlpha
|
|
195
196
|
__experimentalIsRenderedInSidebar
|
|
197
|
+
headingLevel={ 4 }
|
|
196
198
|
{ ...controlProps }
|
|
197
199
|
/>
|
|
198
200
|
</div>
|
|
@@ -12,14 +12,14 @@ import { TabPanel } from '@wordpress/components';
|
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
14
|
import ScreenHeader from './header';
|
|
15
|
-
import {
|
|
15
|
+
import { useSupportedStyles, useColorsPerOrigin } from './hooks';
|
|
16
16
|
import { unlock } from '../../private-apis';
|
|
17
17
|
|
|
18
18
|
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
19
19
|
|
|
20
20
|
function ScreenLinkColor( { name, variation = '' } ) {
|
|
21
21
|
const prefix = variation ? `variations.${ variation }.` : '';
|
|
22
|
-
const supports =
|
|
22
|
+
const supports = useSupportedStyles( name );
|
|
23
23
|
const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
|
|
24
24
|
const colorsPerOrigin = useColorsPerOrigin( name );
|
|
25
25
|
const [ isLinkEnabled ] = useGlobalSetting( 'color.link', name );
|
|
@@ -111,6 +111,7 @@ function ScreenLinkColor( { name, variation = '' } ) {
|
|
|
111
111
|
pseudoSelectorConfig.value ===
|
|
112
112
|
pseudoSelectorConfig.userValue
|
|
113
113
|
}
|
|
114
|
+
headingLevel={ 3 }
|
|
114
115
|
/>
|
|
115
116
|
</>
|
|
116
117
|
);
|
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
13
|
import ScreenHeader from './header';
|
|
14
|
-
import {
|
|
14
|
+
import { useSupportedStyles, useColorsPerOrigin } from './hooks';
|
|
15
15
|
import { unlock } from '../../private-apis';
|
|
16
16
|
|
|
17
17
|
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
18
18
|
|
|
19
19
|
function ScreenTextColor( { name, variation = '' } ) {
|
|
20
20
|
const prefix = variation ? `variations.${ variation }.` : '';
|
|
21
|
-
const supports =
|
|
21
|
+
const supports = useSupportedStyles( name );
|
|
22
22
|
const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
|
|
23
23
|
const [ isTextEnabled ] = useGlobalSetting( 'color.text', name );
|
|
24
24
|
const colorsPerOrigin = useColorsPerOrigin( name );
|
|
@@ -53,6 +53,7 @@ function ScreenTextColor( { name, variation = '' } ) {
|
|
|
53
53
|
colorValue={ color }
|
|
54
54
|
onColorChange={ setColor }
|
|
55
55
|
clearable={ color === userColor }
|
|
56
|
+
headingLevel={ 3 }
|
|
56
57
|
/>
|
|
57
58
|
</>
|
|
58
59
|
);
|
|
@@ -109,7 +109,7 @@ function ScreenTypography( { name, variation = '' } ) {
|
|
|
109
109
|
{ ! name && (
|
|
110
110
|
<div className="edit-site-global-styles-screen-typography">
|
|
111
111
|
<VStack spacing={ 3 }>
|
|
112
|
-
<Subtitle>{ __( 'Elements' ) }</Subtitle>
|
|
112
|
+
<Subtitle level={ 3 }>{ __( 'Elements' ) }</Subtitle>
|
|
113
113
|
<ItemGroup isBordered isSeparated>
|
|
114
114
|
<Item
|
|
115
115
|
name={ name }
|
|
@@ -27,14 +27,14 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
|
27
27
|
/**
|
|
28
28
|
* Internal dependencies
|
|
29
29
|
*/
|
|
30
|
-
import {
|
|
30
|
+
import { useSupportedStyles } from './hooks';
|
|
31
31
|
import { IconWithCurrentColor } from './icon-with-current-color';
|
|
32
32
|
import { unlock } from '../../private-apis';
|
|
33
33
|
|
|
34
34
|
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
35
35
|
|
|
36
36
|
export function useHasShadowControl( name ) {
|
|
37
|
-
const supports =
|
|
37
|
+
const supports = useSupportedStyles( name );
|
|
38
38
|
return supports.includes( 'shadow' );
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -44,7 +44,10 @@ export default function ShadowPanel( { name, variation = '' } ) {
|
|
|
44
44
|
const [ userShadow ] = useGlobalStyle( `${ prefix }shadow`, name, 'user' );
|
|
45
45
|
const hasShadow = () => !! userShadow;
|
|
46
46
|
|
|
47
|
-
const resetShadow = (
|
|
47
|
+
const resetShadow = useCallback(
|
|
48
|
+
() => setShadow( undefined ),
|
|
49
|
+
[ setShadow ]
|
|
50
|
+
);
|
|
48
51
|
const resetAll = useCallback(
|
|
49
52
|
() => resetShadow( undefined ),
|
|
50
53
|
[ resetShadow ]
|
|
@@ -62,6 +62,11 @@
|
|
|
62
62
|
padding: 0 $grid-unit-20;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
.edit-site-global-styles-header {
|
|
66
|
+
// Need to override the too specific bottom margin for complementary areas.
|
|
67
|
+
margin-bottom: 0 !important;
|
|
68
|
+
}
|
|
69
|
+
|
|
65
70
|
.edit-site-global-styles-subtitle {
|
|
66
71
|
// Need to override the too specific styles for complementary areas.
|
|
67
72
|
margin-bottom: 0 !important;
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __experimentalHeading as Heading } from '@wordpress/components';
|
|
5
5
|
|
|
6
|
-
function Subtitle( { children } ) {
|
|
6
|
+
function Subtitle( { children, level } ) {
|
|
7
7
|
return (
|
|
8
|
-
<Heading
|
|
8
|
+
<Heading
|
|
9
|
+
className="edit-site-global-styles-subtitle"
|
|
10
|
+
level={ level ?? 2 }
|
|
11
|
+
>
|
|
9
12
|
{ children }
|
|
10
13
|
</Heading>
|
|
11
14
|
);
|