@wordpress/edit-site 3.0.27 → 4.0.1-next.f435e9e01b.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/LICENSE.md +1 -1
- package/README.md +7 -1
- package/build/components/add-new-template/new-template-part.js +1 -4
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +1 -0
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/code-editor/code-editor-text-area.js +95 -0
- package/build/components/code-editor/code-editor-text-area.js.map +1 -0
- package/build/components/code-editor/index.js +79 -0
- package/build/components/code-editor/index.js.map +1 -0
- package/build/components/editor/index.js +28 -8
- package/build/components/editor/index.js.map +1 -1
- package/build/components/error-boundary/index.js +27 -11
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +81 -22
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +4 -6
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +1 -0
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/header.js +2 -7
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +35 -12
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +3 -3
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +46 -15
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +1 -3
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +2 -3
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +0 -1
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +0 -2
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +5 -6
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +0 -2
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +0 -2
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +22 -3
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +138 -0
- package/build/components/global-styles/screen-style-variations.js.map +1 -0
- package/build/components/global-styles/screen-text-color.js +0 -2
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +0 -2
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +2 -3
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/ui.js +31 -14
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header/index.js +12 -4
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/mode-switcher/index.js +78 -0
- package/build/components/header/mode-switcher/index.js.map +1 -0
- package/build/components/header/more-menu/copy-content-menu-item.js +74 -0
- package/build/components/header/more-menu/copy-content-menu-item.js.map +1 -0
- package/build/components/header/more-menu/index.js +6 -2
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +17 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/list/actions/index.js +5 -4
- package/build/components/list/actions/index.js.map +1 -1
- package/build/components/list/actions/rename-menu-item.js +3 -3
- package/build/components/list/actions/rename-menu-item.js.map +1 -1
- package/build/components/routes/redirect-to-homepage.js +3 -22
- package/build/components/routes/redirect-to-homepage.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +13 -3
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/default-sidebar.js +4 -2
- package/build/components/sidebar/default-sidebar.js.map +1 -1
- package/build/components/sidebar/global-styles-sidebar.js +1 -0
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +1 -4
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/index.js +2 -16
- package/build/index.js.map +1 -1
- package/build/store/actions.js +29 -9
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +2 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +11 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +13 -0
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +1 -4
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +1 -0
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/code-editor/code-editor-text-area.js +83 -0
- package/build-module/components/code-editor/code-editor-text-area.js.map +1 -0
- package/build-module/components/code-editor/index.js +62 -0
- package/build-module/components/code-editor/index.js.map +1 -0
- package/build-module/components/editor/index.js +27 -9
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +26 -9
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +82 -23
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +1 -1
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +1 -1
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/header.js +2 -5
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +35 -10
- 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/preview.js +45 -15
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +1 -3
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +1 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +0 -1
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +0 -2
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +2 -3
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +0 -2
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +0 -2
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +21 -4
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +119 -0
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -0
- package/build-module/components/global-styles/screen-text-color.js +0 -2
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +0 -2
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +1 -2
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/ui.js +29 -14
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header/index.js +13 -5
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/mode-switcher/index.js +65 -0
- package/build-module/components/header/mode-switcher/index.js.map +1 -0
- package/build-module/components/header/more-menu/copy-content-menu-item.js +59 -0
- package/build-module/components/header/more-menu/copy-content-menu-item.js.map +1 -0
- package/build-module/components/header/more-menu/index.js +4 -2
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +17 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/list/actions/index.js +5 -4
- package/build-module/components/list/actions/index.js.map +1 -1
- package/build-module/components/list/actions/rename-menu-item.js +3 -3
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
- package/build-module/components/routes/redirect-to-homepage.js +3 -22
- package/build-module/components/routes/redirect-to-homepage.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +14 -4
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/default-sidebar.js +4 -2
- package/build-module/components/sidebar/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar/global-styles-sidebar.js +1 -0
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +1 -4
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/index.js +2 -14
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +25 -9
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +2 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +11 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +11 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +148 -68
- package/build-style/style.css +148 -68
- package/package.json +28 -30
- package/src/components/add-new-template/new-template-part.js +1 -7
- package/src/components/block-editor/resizable-editor.js +1 -0
- package/src/components/block-editor/style.scss +10 -18
- package/src/components/code-editor/code-editor-text-area.js +79 -0
- package/src/components/code-editor/index.js +65 -0
- package/src/components/code-editor/style.scss +100 -0
- package/src/components/editor/index.js +41 -10
- package/src/components/error-boundary/index.js +28 -11
- package/src/components/global-styles/border-panel.js +106 -42
- package/src/components/global-styles/context-menu.js +1 -1
- package/src/components/global-styles/global-styles-provider.js +1 -2
- package/src/components/global-styles/header.js +3 -5
- package/src/components/global-styles/navigation-button.js +31 -10
- package/src/components/global-styles/palette.js +6 -2
- package/src/components/global-styles/preview.js +46 -18
- package/src/components/global-styles/screen-background-color.js +1 -3
- package/src/components/global-styles/screen-block-list.js +1 -2
- package/src/components/global-styles/screen-block.js +1 -1
- package/src/components/global-styles/screen-color-palette.js +0 -2
- package/src/components/global-styles/screen-colors.js +2 -3
- package/src/components/global-styles/screen-layout.js +1 -5
- package/src/components/global-styles/screen-link-color.js +0 -2
- package/src/components/global-styles/screen-root.js +32 -3
- package/src/components/global-styles/screen-style-variations.js +130 -0
- package/src/components/global-styles/screen-text-color.js +0 -2
- package/src/components/global-styles/screen-typography-element.js +0 -4
- package/src/components/global-styles/screen-typography.js +2 -3
- package/src/components/global-styles/style.scss +24 -25
- package/src/components/global-styles/ui.js +55 -25
- package/src/components/header/document-actions/style.scss +1 -9
- package/src/components/header/index.js +10 -2
- package/src/components/header/mode-switcher/index.js +67 -0
- package/src/components/header/more-menu/copy-content-menu-item.js +53 -0
- package/src/components/header/more-menu/index.js +4 -0
- package/src/components/header/style.scss +2 -1
- package/src/components/keyboard-shortcuts/index.js +17 -1
- package/src/components/list/actions/index.js +5 -4
- package/src/components/list/actions/rename-menu-item.js +3 -3
- package/src/components/routes/redirect-to-homepage.js +4 -27
- package/src/components/secondary-sidebar/inserter-sidebar.js +14 -3
- package/src/components/secondary-sidebar/list-view-sidebar.js +12 -5
- package/src/components/secondary-sidebar/style.scss +0 -4
- package/src/components/sidebar/default-sidebar.js +2 -0
- package/src/components/sidebar/global-styles-sidebar.js +1 -0
- package/src/components/sidebar/style.scss +21 -14
- package/src/components/template-part-converter/convert-to-template-part.js +1 -6
- package/src/index.js +2 -18
- package/src/store/actions.js +25 -10
- package/src/store/defaults.js +1 -0
- package/src/store/reducer.js +6 -0
- package/src/store/selectors.js +11 -0
- package/src/store/test/actions.js +2 -2
- package/src/style.scss +1 -0
- package/build/components/error-boundary/warning.js +0 -70
- package/build/components/error-boundary/warning.js.map +0 -1
- package/build-module/components/error-boundary/warning.js +0 -60
- package/build-module/components/error-boundary/warning.js.map +0 -1
- package/src/components/error-boundary/warning.js +0 -59
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
__experimentalColorGradientControl as ColorGradientControl,
|
|
8
8
|
} from '@wordpress/block-editor';
|
|
9
9
|
import {
|
|
10
|
-
|
|
10
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
11
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
11
12
|
__experimentalUnitControl as UnitControl,
|
|
12
13
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
13
14
|
} from '@wordpress/components';
|
|
@@ -68,6 +69,18 @@ function useHasBorderWidthControl( name ) {
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
export default function BorderPanel( { name } ) {
|
|
72
|
+
// To better reflect if the user has customized a value we need to
|
|
73
|
+
// ensure the style value being checked is from the `user` origin.
|
|
74
|
+
const [ userBorderStyles ] = useStyle( 'border', name, 'user' );
|
|
75
|
+
const createHasValueCallback = ( feature ) => () =>
|
|
76
|
+
!! userBorderStyles?.[ feature ];
|
|
77
|
+
|
|
78
|
+
const createResetCallback = ( setStyle ) => () => setStyle( undefined );
|
|
79
|
+
|
|
80
|
+
const handleOnChange = ( setStyle ) => ( value ) => {
|
|
81
|
+
setStyle( value || undefined );
|
|
82
|
+
};
|
|
83
|
+
|
|
71
84
|
const units = useCustomUnits( {
|
|
72
85
|
availableUnits: useSetting( 'spacing.units' )[ 0 ] || [
|
|
73
86
|
'px',
|
|
@@ -77,70 +90,121 @@ export default function BorderPanel( { name } ) {
|
|
|
77
90
|
} );
|
|
78
91
|
|
|
79
92
|
// Border width.
|
|
80
|
-
const
|
|
93
|
+
const showBorderWidth = useHasBorderWidthControl( name );
|
|
81
94
|
const [ borderWidthValue, setBorderWidth ] = useStyle(
|
|
82
95
|
'border.width',
|
|
83
96
|
name
|
|
84
97
|
);
|
|
85
98
|
|
|
86
99
|
// Border style.
|
|
87
|
-
const
|
|
100
|
+
const showBorderStyle = useHasBorderStyleControl( name );
|
|
88
101
|
const [ borderStyle, setBorderStyle ] = useStyle( 'border.style', name );
|
|
89
102
|
|
|
90
103
|
// Border color.
|
|
104
|
+
const showBorderColor = useHasBorderColorControl( name );
|
|
105
|
+
const [ borderColor, setBorderColor ] = useStyle( 'border.color', name );
|
|
91
106
|
const [ colors = EMPTY_ARRAY ] = useSetting( 'color.palette' );
|
|
92
107
|
const disableCustomColors = ! useSetting( 'color.custom' )[ 0 ];
|
|
93
108
|
const disableCustomGradients = ! useSetting( 'color.customGradient' )[ 0 ];
|
|
94
|
-
const hasBorderColor = useHasBorderColorControl( name );
|
|
95
|
-
const [ borderColor, setBorderColor ] = useStyle( 'border.color', name );
|
|
96
109
|
|
|
97
110
|
// Border radius.
|
|
98
|
-
const
|
|
111
|
+
const showBorderRadius = useHasBorderRadiusControl( name );
|
|
99
112
|
const [ borderRadiusValues, setBorderRadius ] = useStyle(
|
|
100
113
|
'border.radius',
|
|
101
114
|
name
|
|
102
115
|
);
|
|
116
|
+
const hasBorderRadius = () => {
|
|
117
|
+
const borderValues = userBorderStyles?.radius;
|
|
118
|
+
if ( typeof borderValues === 'object' ) {
|
|
119
|
+
return Object.entries( borderValues ).some( Boolean );
|
|
120
|
+
}
|
|
121
|
+
return !! borderValues;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const resetAll = () => {
|
|
125
|
+
setBorderColor( undefined );
|
|
126
|
+
setBorderRadius( undefined );
|
|
127
|
+
setBorderStyle( undefined );
|
|
128
|
+
setBorderWidth( undefined );
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// When we set a border color or width ensure we have a style so the user
|
|
132
|
+
// can see a visible border.
|
|
133
|
+
const handleOnChangeWithStyle = ( setStyle ) => ( value ) => {
|
|
134
|
+
if ( !! value && ! borderStyle ) {
|
|
135
|
+
setBorderStyle( 'solid' );
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
setStyle( value || undefined );
|
|
139
|
+
};
|
|
103
140
|
|
|
104
141
|
return (
|
|
105
|
-
<
|
|
106
|
-
{
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
142
|
+
<ToolsPanel label={ __( 'Border' ) } resetAll={ resetAll }>
|
|
143
|
+
{ showBorderWidth && (
|
|
144
|
+
<ToolsPanelItem
|
|
145
|
+
className="single-column"
|
|
146
|
+
hasValue={ createHasValueCallback( 'width' ) }
|
|
147
|
+
label={ __( 'Width' ) }
|
|
148
|
+
onDeselect={ createResetCallback( setBorderWidth ) }
|
|
149
|
+
isShownByDefault={ true }
|
|
150
|
+
>
|
|
151
|
+
<UnitControl
|
|
152
|
+
value={ borderWidthValue }
|
|
153
|
+
label={ __( 'Width' ) }
|
|
154
|
+
min={ MIN_BORDER_WIDTH }
|
|
155
|
+
onChange={ handleOnChangeWithStyle( setBorderWidth ) }
|
|
156
|
+
units={ units }
|
|
157
|
+
/>
|
|
158
|
+
</ToolsPanelItem>
|
|
159
|
+
) }
|
|
160
|
+
{ showBorderStyle && (
|
|
161
|
+
<ToolsPanelItem
|
|
162
|
+
className="single-column"
|
|
163
|
+
hasValue={ createHasValueCallback( 'style' ) }
|
|
164
|
+
label={ __( 'Style' ) }
|
|
165
|
+
onDeselect={ createResetCallback( setBorderStyle ) }
|
|
166
|
+
isShownByDefault={ true }
|
|
167
|
+
>
|
|
168
|
+
<BorderStyleControl
|
|
169
|
+
value={ borderStyle }
|
|
170
|
+
onChange={ handleOnChange( setBorderStyle ) }
|
|
171
|
+
/>
|
|
172
|
+
</ToolsPanelItem>
|
|
126
173
|
) }
|
|
127
|
-
{
|
|
128
|
-
<
|
|
174
|
+
{ showBorderColor && (
|
|
175
|
+
<ToolsPanelItem
|
|
176
|
+
hasValue={ createHasValueCallback( 'color' ) }
|
|
129
177
|
label={ __( 'Color' ) }
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
178
|
+
onDeselect={ createResetCallback( setBorderColor ) }
|
|
179
|
+
isShownByDefault={ true }
|
|
180
|
+
>
|
|
181
|
+
<ColorGradientControl
|
|
182
|
+
label={ __( 'Color' ) }
|
|
183
|
+
colorValue={ borderColor }
|
|
184
|
+
colors={ colors }
|
|
185
|
+
gradients={ undefined }
|
|
186
|
+
disableCustomColors={ disableCustomColors }
|
|
187
|
+
disableCustomGradients={ disableCustomGradients }
|
|
188
|
+
onColorChange={ handleOnChangeWithStyle(
|
|
189
|
+
setBorderColor
|
|
190
|
+
) }
|
|
191
|
+
clearable={ false }
|
|
192
|
+
/>
|
|
193
|
+
</ToolsPanelItem>
|
|
137
194
|
) }
|
|
138
|
-
{
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
195
|
+
{ showBorderRadius && (
|
|
196
|
+
<ToolsPanelItem
|
|
197
|
+
hasValue={ hasBorderRadius }
|
|
198
|
+
label={ __( 'Radius' ) }
|
|
199
|
+
onDeselect={ createResetCallback( setBorderRadius ) }
|
|
200
|
+
isShownByDefault={ true }
|
|
201
|
+
>
|
|
202
|
+
<BorderRadiusControl
|
|
203
|
+
values={ borderRadiusValues }
|
|
204
|
+
onChange={ handleOnChange( setBorderRadius ) }
|
|
205
|
+
/>
|
|
206
|
+
</ToolsPanelItem>
|
|
143
207
|
) }
|
|
144
|
-
</
|
|
208
|
+
</ToolsPanel>
|
|
145
209
|
);
|
|
146
210
|
}
|
|
@@ -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 NavigationButton from './navigation-button';
|
|
15
|
+
import { NavigationButton } from './navigation-button';
|
|
16
16
|
|
|
17
17
|
function ContextMenu( { name, parentMenu = '' } ) {
|
|
18
18
|
const hasTypographyPanel = useHasTypographyPanel( name );
|
|
@@ -31,7 +31,7 @@ function mergeTreesCustomizer( _, srcValue ) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
function mergeBaseAndUserConfigs( base, user ) {
|
|
34
|
+
export function mergeBaseAndUserConfigs( base, user ) {
|
|
35
35
|
return mergeWith( {}, base, user, mergeTreesCustomizer );
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -67,7 +67,6 @@ function useGlobalStylesUserConfig() {
|
|
|
67
67
|
|
|
68
68
|
const { getEditedEntityRecord } = useSelect( coreStore );
|
|
69
69
|
const { editEntityRecord } = useDispatch( coreStore );
|
|
70
|
-
|
|
71
70
|
const config = useMemo( () => {
|
|
72
71
|
return {
|
|
73
72
|
settings: settings ?? {},
|
|
@@ -14,15 +14,14 @@ import { chevronRight, chevronLeft, Icon } from '@wordpress/icons';
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
|
-
import
|
|
17
|
+
import { NavigationBackButton } from './navigation-button';
|
|
18
18
|
|
|
19
|
-
function ScreenHeader( {
|
|
19
|
+
function ScreenHeader( { title, description } ) {
|
|
20
20
|
return (
|
|
21
21
|
<VStack spacing={ 2 }>
|
|
22
22
|
<HStack spacing={ 2 }>
|
|
23
23
|
<View>
|
|
24
|
-
<
|
|
25
|
-
path={ back }
|
|
24
|
+
<NavigationBackButton
|
|
26
25
|
icon={
|
|
27
26
|
<Icon
|
|
28
27
|
icon={ isRTL() ? chevronRight : chevronLeft }
|
|
@@ -30,7 +29,6 @@ function ScreenHeader( { back, title, description } ) {
|
|
|
30
29
|
/>
|
|
31
30
|
}
|
|
32
31
|
size="small"
|
|
33
|
-
isBack
|
|
34
32
|
aria-label={ __( 'Navigate to the previous view' ) }
|
|
35
33
|
/>
|
|
36
34
|
</View>
|
|
@@ -9,16 +9,9 @@ import {
|
|
|
9
9
|
} from '@wordpress/components';
|
|
10
10
|
import { Icon } from '@wordpress/icons';
|
|
11
11
|
|
|
12
|
-
function
|
|
13
|
-
path,
|
|
14
|
-
icon,
|
|
15
|
-
children,
|
|
16
|
-
isBack = false,
|
|
17
|
-
...props
|
|
18
|
-
} ) {
|
|
19
|
-
const navigator = useNavigator();
|
|
12
|
+
function GenericNavigationButton( { icon, children, ...props } ) {
|
|
20
13
|
return (
|
|
21
|
-
<Item
|
|
14
|
+
<Item { ...props }>
|
|
22
15
|
{ icon && (
|
|
23
16
|
<HStack justify="flex-start">
|
|
24
17
|
<FlexItem>
|
|
@@ -32,4 +25,32 @@ function NavigationButton( {
|
|
|
32
25
|
);
|
|
33
26
|
}
|
|
34
27
|
|
|
35
|
-
|
|
28
|
+
function NavigationButton( { path, ...props } ) {
|
|
29
|
+
const { goTo } = useNavigator();
|
|
30
|
+
|
|
31
|
+
const dataAttrName = 'data-navigator-focusable-id';
|
|
32
|
+
const dataAttrValue = path;
|
|
33
|
+
|
|
34
|
+
const dataAttrCssSelector = `[${ dataAttrName }="${ dataAttrValue }"]`;
|
|
35
|
+
|
|
36
|
+
const buttonProps = {
|
|
37
|
+
...props,
|
|
38
|
+
[ dataAttrName ]: dataAttrValue,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<GenericNavigationButton
|
|
43
|
+
onClick={ () =>
|
|
44
|
+
goTo( path, { focusTargetSelector: dataAttrCssSelector } )
|
|
45
|
+
}
|
|
46
|
+
{ ...buttonProps }
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function NavigationBackButton( { ...props } ) {
|
|
52
|
+
const { goBack } = useNavigator();
|
|
53
|
+
return <GenericNavigationButton onClick={ goBack } { ...props } />;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { NavigationButton, NavigationBackButton };
|
|
@@ -17,7 +17,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
17
17
|
* Internal dependencies
|
|
18
18
|
*/
|
|
19
19
|
import Subtitle from './subtitle';
|
|
20
|
-
import NavigationButton from './navigation-button';
|
|
20
|
+
import { NavigationButton } from './navigation-button';
|
|
21
21
|
import { useSetting } from './hooks';
|
|
22
22
|
|
|
23
23
|
const EMPTY_COLORS = [];
|
|
@@ -59,7 +59,11 @@ function Palette( { name } ) {
|
|
|
59
59
|
<Subtitle>{ __( 'Palette' ) }</Subtitle>
|
|
60
60
|
<ItemGroup isBordered isSeparated>
|
|
61
61
|
<NavigationButton path={ screenPath }>
|
|
62
|
-
<HStack
|
|
62
|
+
<HStack
|
|
63
|
+
direction={
|
|
64
|
+
colors.length === 0 ? 'row-reverse' : 'row'
|
|
65
|
+
}
|
|
66
|
+
>
|
|
63
67
|
<FlexBlock>
|
|
64
68
|
<ZStack isLayered={ false } offset={ -8 }>
|
|
65
69
|
{ colors.slice( 0, 5 ).map( ( { color } ) => (
|
|
@@ -2,41 +2,69 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
ColorIndicator,
|
|
9
|
-
} from '@wordpress/components';
|
|
5
|
+
__unstableIframe as Iframe,
|
|
6
|
+
__unstableEditorStyles as EditorStyles,
|
|
7
|
+
} from '@wordpress/block-editor';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* Internal dependencies
|
|
13
11
|
*/
|
|
14
12
|
import { useStyle } from './hooks';
|
|
13
|
+
import { useGlobalStylesOutput } from './use-global-styles-output';
|
|
15
14
|
|
|
16
|
-
const StylesPreview = () => {
|
|
15
|
+
const StylesPreview = ( { height = 150 } ) => {
|
|
17
16
|
const [ fontFamily = 'serif' ] = useStyle( 'typography.fontFamily' );
|
|
18
17
|
const [ textColor = 'black' ] = useStyle( 'color.text' );
|
|
19
18
|
const [ linkColor = 'blue' ] = useStyle( 'elements.link.color.text' );
|
|
20
19
|
const [ backgroundColor = 'white' ] = useStyle( 'color.background' );
|
|
21
20
|
const [ gradientValue ] = useStyle( 'color.gradient' );
|
|
21
|
+
const [ styles ] = useGlobalStylesOutput();
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
|
-
<
|
|
25
|
-
className="edit-site-global-styles-
|
|
26
|
-
|
|
24
|
+
<Iframe
|
|
25
|
+
className="edit-site-global-styles-preview__iframe"
|
|
26
|
+
head={ <EditorStyles styles={ styles } /> }
|
|
27
|
+
style={ { height } }
|
|
27
28
|
>
|
|
28
|
-
<
|
|
29
|
+
<div
|
|
30
|
+
style={ {
|
|
31
|
+
display: 'flex',
|
|
32
|
+
gap: 20,
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
height: '100%',
|
|
36
|
+
transform: `scale(${ height / 150 })`,
|
|
37
|
+
background: gradientValue ?? backgroundColor,
|
|
38
|
+
cursor: 'pointer',
|
|
39
|
+
} }
|
|
40
|
+
>
|
|
41
|
+
<div style={ { fontFamily, fontSize: '80px' } }>Aa</div>
|
|
29
42
|
<div
|
|
30
|
-
style={ {
|
|
43
|
+
style={ {
|
|
44
|
+
display: 'flex',
|
|
45
|
+
gap: 20,
|
|
46
|
+
flexDirection: 'column',
|
|
47
|
+
} }
|
|
31
48
|
>
|
|
32
|
-
|
|
49
|
+
<div
|
|
50
|
+
style={ {
|
|
51
|
+
height: 40,
|
|
52
|
+
width: 40,
|
|
53
|
+
background: textColor,
|
|
54
|
+
borderRadius: 20,
|
|
55
|
+
} }
|
|
56
|
+
/>{ ' ' }
|
|
57
|
+
<div
|
|
58
|
+
style={ {
|
|
59
|
+
height: 40,
|
|
60
|
+
width: 40,
|
|
61
|
+
background: linkColor,
|
|
62
|
+
borderRadius: 20,
|
|
63
|
+
} }
|
|
64
|
+
/>
|
|
33
65
|
</div>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<ColorIndicator colorValue={ linkColor } />
|
|
37
|
-
</VStack>
|
|
38
|
-
</HStack>
|
|
39
|
-
</Card>
|
|
66
|
+
</div>
|
|
67
|
+
</Iframe>
|
|
40
68
|
);
|
|
41
69
|
};
|
|
42
70
|
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
} from './hooks';
|
|
18
18
|
|
|
19
19
|
function ScreenBackgroundColor( { name } ) {
|
|
20
|
-
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
21
20
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
22
21
|
const [ solids ] = useSetting( 'color.palette', name );
|
|
23
22
|
const [ gradients ] = useSetting( 'color.gradients', name );
|
|
@@ -86,10 +85,9 @@ function ScreenBackgroundColor( { name } ) {
|
|
|
86
85
|
return (
|
|
87
86
|
<>
|
|
88
87
|
<ScreenHeader
|
|
89
|
-
back={ parentMenu + '/colors' }
|
|
90
88
|
title={ __( 'Background' ) }
|
|
91
89
|
description={ __(
|
|
92
|
-
'Set a background color or gradient for the whole
|
|
90
|
+
'Set a background color or gradient for the whole site.'
|
|
93
91
|
) }
|
|
94
92
|
/>
|
|
95
93
|
<ColorGradientControl
|
|
@@ -17,7 +17,7 @@ import { useHasColorPanel } from './color-utils';
|
|
|
17
17
|
import { useHasDimensionsPanel } from './dimensions-panel';
|
|
18
18
|
import { useHasTypographyPanel } from './typography-panel';
|
|
19
19
|
import ScreenHeader from './header';
|
|
20
|
-
import NavigationButton from './navigation-button';
|
|
20
|
+
import { NavigationButton } from './navigation-button';
|
|
21
21
|
|
|
22
22
|
function BlockMenuItem( { block } ) {
|
|
23
23
|
const hasTypographyPanel = useHasTypographyPanel( block.name );
|
|
@@ -48,7 +48,6 @@ function ScreenBlockList() {
|
|
|
48
48
|
return (
|
|
49
49
|
<>
|
|
50
50
|
<ScreenHeader
|
|
51
|
-
back="/"
|
|
52
51
|
title={ __( 'Blocks' ) }
|
|
53
52
|
description={ __(
|
|
54
53
|
'Customize the appearance of specific blocks and for the whole site.'
|
|
@@ -17,12 +17,10 @@ import ScreenHeader from './header';
|
|
|
17
17
|
|
|
18
18
|
function ScreenColorPalette( { name } ) {
|
|
19
19
|
const [ currentTab, setCurrentTab ] = useState( 'solid' );
|
|
20
|
-
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
21
20
|
|
|
22
21
|
return (
|
|
23
22
|
<>
|
|
24
23
|
<ScreenHeader
|
|
25
|
-
back={ parentMenu + '/colors' }
|
|
26
24
|
title={ __( 'Palette' ) }
|
|
27
25
|
description={ __(
|
|
28
26
|
'Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.'
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
*/
|
|
16
16
|
import ScreenHeader from './header';
|
|
17
17
|
import Palette from './palette';
|
|
18
|
-
import NavigationButton from './navigation-button';
|
|
18
|
+
import { NavigationButton } from './navigation-button';
|
|
19
19
|
import { getSupportedGlobalStylesPanels, useStyle } from './hooks';
|
|
20
20
|
import Subtitle from './subtitle';
|
|
21
21
|
|
|
@@ -93,10 +93,9 @@ function ScreenColors( { name } ) {
|
|
|
93
93
|
return (
|
|
94
94
|
<>
|
|
95
95
|
<ScreenHeader
|
|
96
|
-
back={ parentMenu ? parentMenu : '/' }
|
|
97
96
|
title={ __( 'Colors' ) }
|
|
98
97
|
description={ __(
|
|
99
|
-
'Manage palettes and the default color of different global elements on the
|
|
98
|
+
'Manage palettes and the default color of different global elements on the site.'
|
|
100
99
|
) }
|
|
101
100
|
/>
|
|
102
101
|
|
|
@@ -11,16 +11,12 @@ import DimensionsPanel, { useHasDimensionsPanel } from './dimensions-panel';
|
|
|
11
11
|
import ScreenHeader from './header';
|
|
12
12
|
|
|
13
13
|
function ScreenLayout( { name } ) {
|
|
14
|
-
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
15
14
|
const hasBorderPanel = useHasBorderPanel( name );
|
|
16
15
|
const hasDimensionsPanel = useHasDimensionsPanel( name );
|
|
17
16
|
|
|
18
17
|
return (
|
|
19
18
|
<>
|
|
20
|
-
<ScreenHeader
|
|
21
|
-
back={ parentMenu ? parentMenu : '/' }
|
|
22
|
-
title={ __( 'Layout' ) }
|
|
23
|
-
/>
|
|
19
|
+
<ScreenHeader title={ __( 'Layout' ) } />
|
|
24
20
|
{ hasDimensionsPanel && <DimensionsPanel name={ name } /> }
|
|
25
21
|
{ hasBorderPanel && <BorderPanel name={ name } /> }
|
|
26
22
|
</>
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
} from './hooks';
|
|
17
17
|
|
|
18
18
|
function ScreenLinkColor( { name } ) {
|
|
19
|
-
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
20
19
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
21
20
|
const [ solids ] = useSetting( 'color.palette', name );
|
|
22
21
|
const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
|
|
@@ -47,7 +46,6 @@ function ScreenLinkColor( { name } ) {
|
|
|
47
46
|
return (
|
|
48
47
|
<>
|
|
49
48
|
<ScreenHeader
|
|
50
|
-
back={ parentMenu + '/colors' }
|
|
51
49
|
title={ __( 'Links' ) }
|
|
52
50
|
description={ __(
|
|
53
51
|
'Set the default color used for links across the site.'
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
__experimentalItemGroup as ItemGroup,
|
|
6
6
|
__experimentalItem as Item,
|
|
7
7
|
__experimentalHStack as HStack,
|
|
8
|
+
__experimentalVStack as VStack,
|
|
8
9
|
FlexItem,
|
|
9
10
|
CardBody,
|
|
10
11
|
Card,
|
|
@@ -12,19 +13,47 @@ import {
|
|
|
12
13
|
} from '@wordpress/components';
|
|
13
14
|
import { isRTL, __ } from '@wordpress/i18n';
|
|
14
15
|
import { chevronLeft, chevronRight, Icon } from '@wordpress/icons';
|
|
16
|
+
import { useSelect } from '@wordpress/data';
|
|
17
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
15
18
|
|
|
16
19
|
/**
|
|
17
20
|
* Internal dependencies
|
|
18
21
|
*/
|
|
19
|
-
import
|
|
20
|
-
import NavigationButton from './navigation-button';
|
|
22
|
+
import { NavigationButton } from './navigation-button';
|
|
21
23
|
import ContextMenu from './context-menu';
|
|
24
|
+
import StylesPreview from './preview';
|
|
22
25
|
|
|
23
26
|
function ScreenRoot() {
|
|
27
|
+
const { variations } = useSelect( ( select ) => {
|
|
28
|
+
return {
|
|
29
|
+
variations: select(
|
|
30
|
+
coreStore
|
|
31
|
+
).__experimentalGetCurrentThemeGlobalStylesVariations(),
|
|
32
|
+
};
|
|
33
|
+
}, [] );
|
|
34
|
+
|
|
24
35
|
return (
|
|
25
36
|
<Card size="small">
|
|
26
37
|
<CardBody>
|
|
27
|
-
<
|
|
38
|
+
<VStack spacing={ 2 }>
|
|
39
|
+
<Card>
|
|
40
|
+
<StylesPreview />
|
|
41
|
+
</Card>
|
|
42
|
+
{ !! variations?.length && (
|
|
43
|
+
<NavigationButton path="/variations">
|
|
44
|
+
<HStack justify="space-between">
|
|
45
|
+
<FlexItem>{ __( 'Other styles' ) }</FlexItem>
|
|
46
|
+
<FlexItem>
|
|
47
|
+
<Icon
|
|
48
|
+
icon={
|
|
49
|
+
isRTL() ? chevronLeft : chevronRight
|
|
50
|
+
}
|
|
51
|
+
/>
|
|
52
|
+
</FlexItem>
|
|
53
|
+
</HStack>
|
|
54
|
+
</NavigationButton>
|
|
55
|
+
) }
|
|
56
|
+
</VStack>
|
|
28
57
|
</CardBody>
|
|
29
58
|
|
|
30
59
|
<CardBody>
|