@wordpress/edit-site 5.4.0 → 5.5.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/add-custom-template-modal.js +12 -3
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +8 -7
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +3 -6
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/editor/index.js +3 -3
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +1 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +11 -8
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +41 -487
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/duotone-panel.js +78 -0
- package/build/components/global-styles/duotone-panel.js.map +1 -0
- package/build/components/global-styles/filter-utils.js +17 -0
- package/build/components/global-styles/filter-utils.js.map +1 -0
- package/build/components/global-styles/preview.js +9 -5
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +4 -8
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-border.js +1 -1
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-filters.js +46 -0
- package/build/components/global-styles/screen-filters.js.map +1 -0
- package/build/components/global-styles/screen-layout.js +13 -5
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-variations.js +1 -1
- package/build/components/global-styles/screen-variations.js.map +1 -1
- package/build/components/global-styles/shadow-panel.js +6 -4
- package/build/components/global-styles/shadow-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +2 -5
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +7 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +124 -0
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build/components/keyboard-shortcuts/global.js +48 -0
- package/build/components/keyboard-shortcuts/global.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +67 -0
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +153 -0
- package/build/components/keyboard-shortcuts/register.js.map +1 -0
- package/build/components/layout/index.js +5 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +41 -42
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/table.js +3 -2
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-inspector/navigation-menu.js +22 -5
- package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build/components/save-button/index.js +5 -2
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-panel/index.js +11 -1
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +28 -16
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +30 -0
- package/build/components/sidebar-button/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +10 -10
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +3 -3
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +17 -16
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +10 -4
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +9 -19
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +25 -15
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +8 -7
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/style-book/index.js +17 -2
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +65 -18
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +7 -9
- package/build/components/template-details/index.js.map +1 -1
- package/build/index.js +10 -22
- package/build/index.js.map +1 -1
- package/build/store/actions.js +2 -2
- package/build/store/actions.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js +13 -4
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +8 -7
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +3 -6
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/editor/index.js +3 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +1 -1
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +12 -9
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +43 -480
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/duotone-panel.js +67 -0
- package/build-module/components/global-styles/duotone-panel.js.map +1 -0
- package/build-module/components/global-styles/filter-utils.js +9 -0
- package/build-module/components/global-styles/filter-utils.js.map +1 -0
- package/build-module/components/global-styles/preview.js +10 -6
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +4 -6
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +1 -1
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-filters.js +33 -0
- package/build-module/components/global-styles/screen-filters.js.map +1 -0
- package/build-module/components/global-styles/screen-layout.js +11 -2
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-variations.js +1 -1
- package/build-module/components/global-styles/screen-variations.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel.js +6 -4
- package/build-module/components/global-styles/shadow-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +2 -5
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +6 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +108 -0
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/global.js +37 -0
- package/build-module/components/keyboard-shortcuts/global.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +65 -0
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +141 -0
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -0
- package/build-module/components/layout/index.js +3 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +43 -44
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/table.js +3 -2
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +25 -8
- package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build-module/components/save-button/index.js +5 -2
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +8 -1
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +25 -18
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +18 -0
- package/build-module/components/sidebar-button/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +8 -11
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +3 -3
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +16 -17
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +10 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +8 -18
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +23 -16
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -7
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/style-book/index.js +17 -3
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +63 -18
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-details/index.js +7 -8
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/index.js +12 -22
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +2 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-style/style-rtl.css +41 -38
- package/build-style/style.css +41 -38
- package/package.json +31 -31
- package/src/components/add-new-template/add-custom-template-modal.js +14 -10
- package/src/components/add-new-template/new-template-part.js +7 -9
- package/src/components/add-new-template/new-template.js +3 -6
- package/src/components/add-new-template/style.scss +0 -5
- package/src/components/block-editor/style.scss +1 -1
- package/src/components/editor/index.js +4 -3
- package/src/components/editor/style.scss +0 -6
- package/src/components/global-styles/border-panel.js +1 -1
- package/src/components/global-styles/context-menu.js +16 -10
- package/src/components/global-styles/dimensions-panel.js +43 -577
- package/src/components/global-styles/duotone-panel.js +82 -0
- package/src/components/global-styles/filter-utils.js +9 -0
- package/src/components/global-styles/preview.js +155 -140
- package/src/components/global-styles/screen-block-list.js +4 -9
- package/src/components/global-styles/screen-border.js +1 -1
- package/src/components/global-styles/screen-filters.js +27 -0
- package/src/components/global-styles/screen-layout.js +9 -2
- package/src/components/global-styles/screen-variations.js +0 -1
- package/src/components/global-styles/shadow-panel.js +4 -3
- package/src/components/global-styles/typography-panel.js +5 -7
- package/src/components/global-styles/ui.js +6 -1
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -0
- package/src/components/keyboard-shortcuts/edit-mode.js +116 -0
- package/src/components/keyboard-shortcuts/global.js +35 -0
- package/src/components/keyboard-shortcuts/index.js +70 -0
- package/src/components/keyboard-shortcuts/register.js +157 -0
- package/src/components/layout/index.js +4 -0
- package/src/components/layout/style.scss +8 -1
- package/src/components/list/added-by.js +48 -55
- package/src/components/list/style.scss +5 -13
- package/src/components/list/table.js +4 -5
- package/src/components/navigation-inspector/navigation-menu.js +24 -6
- package/src/components/save-button/index.js +2 -2
- package/src/components/save-panel/index.js +8 -1
- package/src/components/sidebar/index.js +32 -14
- package/src/components/sidebar-button/index.js +21 -0
- package/src/components/sidebar-button/style.scss +23 -0
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +3 -7
- package/src/components/sidebar-edit-mode/style.scss +16 -0
- package/src/components/sidebar-navigation-screen/index.js +31 -38
- package/src/components/sidebar-navigation-screen/style.scss +1 -9
- package/src/components/sidebar-navigation-screen-main/index.js +3 -3
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +24 -20
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +7 -3
- package/src/components/sidebar-navigation-screen-template/index.js +7 -19
- package/src/components/sidebar-navigation-screen-templates/index.js +22 -14
- package/src/components/sidebar-navigation-screen-templates/style.scss +0 -5
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +6 -11
- package/src/components/style-book/index.js +25 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +28 -23
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +72 -17
- package/src/components/template-details/index.js +5 -6
- package/src/index.js +6 -21
- package/src/store/actions.js +2 -2
- package/src/style.scss +1 -0
- package/src/utils/get-is-list-page.js +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import {
|
|
6
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
7
|
+
DuotonePicker,
|
|
8
|
+
} from '@wordpress/components';
|
|
9
|
+
import {
|
|
10
|
+
privateApis as blockEditorPrivateApis,
|
|
11
|
+
useSetting,
|
|
12
|
+
} from '@wordpress/block-editor';
|
|
13
|
+
import { useMemo } from '@wordpress/element';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
import { unlock } from '../../private-apis';
|
|
19
|
+
const { useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
20
|
+
|
|
21
|
+
const EMPTY_ARRAY = [];
|
|
22
|
+
|
|
23
|
+
function useMultiOriginPresets( { presetSetting, defaultSetting } ) {
|
|
24
|
+
const disableDefault = ! useSetting( defaultSetting );
|
|
25
|
+
const userPresets =
|
|
26
|
+
useSetting( `${ presetSetting }.custom` ) || EMPTY_ARRAY;
|
|
27
|
+
const themePresets =
|
|
28
|
+
useSetting( `${ presetSetting }.theme` ) || EMPTY_ARRAY;
|
|
29
|
+
const defaultPresets =
|
|
30
|
+
useSetting( `${ presetSetting }.default` ) || EMPTY_ARRAY;
|
|
31
|
+
return useMemo(
|
|
32
|
+
() => [
|
|
33
|
+
...userPresets,
|
|
34
|
+
...themePresets,
|
|
35
|
+
...( disableDefault ? EMPTY_ARRAY : defaultPresets ),
|
|
36
|
+
],
|
|
37
|
+
[ disableDefault, userPresets, themePresets, defaultPresets ]
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function DuotonePanel( { name } ) {
|
|
42
|
+
const [ themeDuotone, setThemeDuotone ] = useGlobalStyle(
|
|
43
|
+
'filter.duotone',
|
|
44
|
+
name
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const duotonePalette = useMultiOriginPresets( {
|
|
48
|
+
presetSetting: 'color.duotone',
|
|
49
|
+
defaultSetting: 'color.defaultDuotone',
|
|
50
|
+
} );
|
|
51
|
+
const colorPalette = useMultiOriginPresets( {
|
|
52
|
+
presetSetting: 'color.palette',
|
|
53
|
+
defaultSetting: 'color.defaultPalette',
|
|
54
|
+
} );
|
|
55
|
+
|
|
56
|
+
if ( duotonePalette?.length === 0 ) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return (
|
|
60
|
+
<>
|
|
61
|
+
<ToolsPanel label={ __( 'Duotone' ) }>
|
|
62
|
+
<span className="span-columns">
|
|
63
|
+
{ __(
|
|
64
|
+
'Create a two-tone color effect without losing your original image.'
|
|
65
|
+
) }
|
|
66
|
+
</span>
|
|
67
|
+
<div className="span-columns">
|
|
68
|
+
<DuotonePicker
|
|
69
|
+
colorPalette={ colorPalette }
|
|
70
|
+
duotonePalette={ duotonePalette }
|
|
71
|
+
disableCustomColors={ true }
|
|
72
|
+
disableCustomDuotone={ true }
|
|
73
|
+
value={ themeDuotone }
|
|
74
|
+
onChange={ setThemeDuotone }
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
</ToolsPanel>
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export default DuotonePanel;
|
|
@@ -107,163 +107,178 @@ const StylesPreview = ( { label, isFocused, withHoverView } ) => {
|
|
|
107
107
|
|
|
108
108
|
return styles;
|
|
109
109
|
}, [ styles ] );
|
|
110
|
+
const isReady = !! width;
|
|
110
111
|
|
|
111
112
|
return (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
onMouseLeave={ () => setIsHovered( false ) }
|
|
121
|
-
tabIndex={ -1 }
|
|
122
|
-
>
|
|
123
|
-
{ containerResizeListener }
|
|
124
|
-
<motion.div
|
|
125
|
-
style={ {
|
|
126
|
-
height: normalizedHeight * ratio,
|
|
127
|
-
width: '100%',
|
|
128
|
-
background: gradientValue ?? backgroundColor,
|
|
129
|
-
cursor: 'pointer',
|
|
130
|
-
} }
|
|
131
|
-
initial="start"
|
|
132
|
-
animate={
|
|
133
|
-
( isHovered || isFocused ) && ! disableMotion && label
|
|
134
|
-
? 'hover'
|
|
135
|
-
: 'start'
|
|
136
|
-
}
|
|
137
|
-
>
|
|
138
|
-
<motion.div
|
|
139
|
-
variants={ firstFrame }
|
|
113
|
+
<>
|
|
114
|
+
<div style={ { position: 'relative' } }>
|
|
115
|
+
{ containerResizeListener }
|
|
116
|
+
</div>
|
|
117
|
+
{ isReady && (
|
|
118
|
+
<Iframe
|
|
119
|
+
className="edit-site-global-styles-preview__iframe"
|
|
120
|
+
head={ <EditorStyles styles={ editorStyles } /> }
|
|
140
121
|
style={ {
|
|
141
|
-
height:
|
|
142
|
-
overflow: 'hidden',
|
|
122
|
+
height: normalizedHeight * ratio,
|
|
143
123
|
} }
|
|
124
|
+
onMouseEnter={ () => setIsHovered( true ) }
|
|
125
|
+
onMouseLeave={ () => setIsHovered( false ) }
|
|
126
|
+
tabIndex={ -1 }
|
|
144
127
|
>
|
|
145
|
-
<
|
|
146
|
-
spacing={ 10 * ratio }
|
|
147
|
-
justify="center"
|
|
128
|
+
<motion.div
|
|
148
129
|
style={ {
|
|
149
|
-
height:
|
|
150
|
-
|
|
130
|
+
height: normalizedHeight * ratio,
|
|
131
|
+
width: '100%',
|
|
132
|
+
background: gradientValue ?? backgroundColor,
|
|
133
|
+
cursor: 'pointer',
|
|
151
134
|
} }
|
|
135
|
+
initial="start"
|
|
136
|
+
animate={
|
|
137
|
+
( isHovered || isFocused ) &&
|
|
138
|
+
! disableMotion &&
|
|
139
|
+
label
|
|
140
|
+
? 'hover'
|
|
141
|
+
: 'start'
|
|
142
|
+
}
|
|
152
143
|
>
|
|
153
144
|
<motion.div
|
|
145
|
+
variants={ firstFrame }
|
|
154
146
|
style={ {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
color: headingColor,
|
|
158
|
-
fontWeight: headingFontWeight,
|
|
147
|
+
height: '100%',
|
|
148
|
+
overflow: 'hidden',
|
|
159
149
|
} }
|
|
160
|
-
animate={ { scale: 1, opacity: 1 } }
|
|
161
|
-
initial={ { scale: 0.1, opacity: 0 } }
|
|
162
|
-
transition={ { delay: 0.3, type: 'tween' } }
|
|
163
150
|
>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
normalizedColorSwatchSize *
|
|
174
|
-
ratio,
|
|
175
|
-
width:
|
|
176
|
-
normalizedColorSwatchSize *
|
|
177
|
-
ratio,
|
|
178
|
-
background: color,
|
|
179
|
-
borderRadius:
|
|
180
|
-
( normalizedColorSwatchSize *
|
|
181
|
-
ratio ) /
|
|
182
|
-
2,
|
|
183
|
-
} }
|
|
184
|
-
animate={ { scale: 1, opacity: 1 } }
|
|
185
|
-
initial={ { scale: 0.1, opacity: 0 } }
|
|
186
|
-
transition={ {
|
|
187
|
-
delay: index === 1 ? 0.2 : 0.1,
|
|
188
|
-
} }
|
|
189
|
-
/>
|
|
190
|
-
)
|
|
191
|
-
) }
|
|
192
|
-
</VStack>
|
|
193
|
-
</HStack>
|
|
194
|
-
</motion.div>
|
|
195
|
-
<motion.div
|
|
196
|
-
variants={ withHoverView && midFrame }
|
|
197
|
-
style={ {
|
|
198
|
-
height: '100%',
|
|
199
|
-
width: '100%',
|
|
200
|
-
position: 'absolute',
|
|
201
|
-
top: 0,
|
|
202
|
-
overflow: 'hidden',
|
|
203
|
-
filter: 'blur(60px)',
|
|
204
|
-
opacity: 0.1,
|
|
205
|
-
} }
|
|
206
|
-
>
|
|
207
|
-
<HStack
|
|
208
|
-
spacing={ 0 }
|
|
209
|
-
justify="flex-start"
|
|
210
|
-
style={ {
|
|
211
|
-
height: '100%',
|
|
212
|
-
overflow: 'hidden',
|
|
213
|
-
} }
|
|
214
|
-
>
|
|
215
|
-
{ paletteColors
|
|
216
|
-
.slice( 0, 4 )
|
|
217
|
-
.map( ( { color }, index ) => (
|
|
218
|
-
<div
|
|
219
|
-
key={ index }
|
|
151
|
+
<HStack
|
|
152
|
+
spacing={ 10 * ratio }
|
|
153
|
+
justify="center"
|
|
154
|
+
style={ {
|
|
155
|
+
height: '100%',
|
|
156
|
+
overflow: 'hidden',
|
|
157
|
+
} }
|
|
158
|
+
>
|
|
159
|
+
<motion.div
|
|
220
160
|
style={ {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
161
|
+
fontFamily: headingFontFamily,
|
|
162
|
+
fontSize: 65 * ratio,
|
|
163
|
+
color: headingColor,
|
|
164
|
+
fontWeight: headingFontWeight,
|
|
224
165
|
} }
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
166
|
+
animate={ { scale: 1, opacity: 1 } }
|
|
167
|
+
initial={ { scale: 0.1, opacity: 0 } }
|
|
168
|
+
transition={ { delay: 0.3, type: 'tween' } }
|
|
169
|
+
>
|
|
170
|
+
Aa
|
|
171
|
+
</motion.div>
|
|
172
|
+
<VStack spacing={ 4 * ratio }>
|
|
173
|
+
{ highlightedColors.map(
|
|
174
|
+
( { slug, color }, index ) => (
|
|
175
|
+
<motion.div
|
|
176
|
+
key={ slug }
|
|
177
|
+
style={ {
|
|
178
|
+
height:
|
|
179
|
+
normalizedColorSwatchSize *
|
|
180
|
+
ratio,
|
|
181
|
+
width:
|
|
182
|
+
normalizedColorSwatchSize *
|
|
183
|
+
ratio,
|
|
184
|
+
background: color,
|
|
185
|
+
borderRadius:
|
|
186
|
+
( normalizedColorSwatchSize *
|
|
187
|
+
ratio ) /
|
|
188
|
+
2,
|
|
189
|
+
} }
|
|
190
|
+
animate={ {
|
|
191
|
+
scale: 1,
|
|
192
|
+
opacity: 1,
|
|
193
|
+
} }
|
|
194
|
+
initial={ {
|
|
195
|
+
scale: 0.1,
|
|
196
|
+
opacity: 0,
|
|
197
|
+
} }
|
|
198
|
+
transition={ {
|
|
199
|
+
delay:
|
|
200
|
+
index === 1 ? 0.2 : 0.1,
|
|
201
|
+
} }
|
|
202
|
+
/>
|
|
203
|
+
)
|
|
204
|
+
) }
|
|
205
|
+
</VStack>
|
|
206
|
+
</HStack>
|
|
207
|
+
</motion.div>
|
|
208
|
+
<motion.div
|
|
209
|
+
variants={ withHoverView && midFrame }
|
|
210
|
+
style={ {
|
|
211
|
+
height: '100%',
|
|
212
|
+
width: '100%',
|
|
213
|
+
position: 'absolute',
|
|
214
|
+
top: 0,
|
|
215
|
+
overflow: 'hidden',
|
|
216
|
+
filter: 'blur(60px)',
|
|
217
|
+
opacity: 0.1,
|
|
218
|
+
} }
|
|
219
|
+
>
|
|
220
|
+
<HStack
|
|
221
|
+
spacing={ 0 }
|
|
222
|
+
justify="flex-start"
|
|
251
223
|
style={ {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
color: headingColor,
|
|
255
|
-
fontWeight: headingFontWeight,
|
|
256
|
-
lineHeight: '1em',
|
|
257
|
-
textAlign: 'center',
|
|
224
|
+
height: '100%',
|
|
225
|
+
overflow: 'hidden',
|
|
258
226
|
} }
|
|
259
227
|
>
|
|
260
|
-
{
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
228
|
+
{ paletteColors
|
|
229
|
+
.slice( 0, 4 )
|
|
230
|
+
.map( ( { color }, index ) => (
|
|
231
|
+
<div
|
|
232
|
+
key={ index }
|
|
233
|
+
style={ {
|
|
234
|
+
height: '100%',
|
|
235
|
+
background: color,
|
|
236
|
+
flexGrow: 1,
|
|
237
|
+
} }
|
|
238
|
+
/>
|
|
239
|
+
) ) }
|
|
240
|
+
</HStack>
|
|
241
|
+
</motion.div>
|
|
242
|
+
<motion.div
|
|
243
|
+
variants={ secondFrame }
|
|
244
|
+
style={ {
|
|
245
|
+
height: '100%',
|
|
246
|
+
width: '100%',
|
|
247
|
+
overflow: 'hidden',
|
|
248
|
+
position: 'absolute',
|
|
249
|
+
top: 0,
|
|
250
|
+
} }
|
|
251
|
+
>
|
|
252
|
+
<VStack
|
|
253
|
+
spacing={ 3 * ratio }
|
|
254
|
+
justify="center"
|
|
255
|
+
style={ {
|
|
256
|
+
height: '100%',
|
|
257
|
+
overflow: 'hidden',
|
|
258
|
+
padding: 10 * ratio,
|
|
259
|
+
boxSizing: 'border-box',
|
|
260
|
+
} }
|
|
261
|
+
>
|
|
262
|
+
{ label && (
|
|
263
|
+
<div
|
|
264
|
+
style={ {
|
|
265
|
+
fontSize: 40 * ratio,
|
|
266
|
+
fontFamily: headingFontFamily,
|
|
267
|
+
color: headingColor,
|
|
268
|
+
fontWeight: headingFontWeight,
|
|
269
|
+
lineHeight: '1em',
|
|
270
|
+
textAlign: 'center',
|
|
271
|
+
} }
|
|
272
|
+
>
|
|
273
|
+
{ label }
|
|
274
|
+
</div>
|
|
275
|
+
) }
|
|
276
|
+
</VStack>
|
|
277
|
+
</motion.div>
|
|
278
|
+
</motion.div>
|
|
279
|
+
</Iframe>
|
|
280
|
+
) }
|
|
281
|
+
</>
|
|
267
282
|
);
|
|
268
283
|
};
|
|
269
284
|
|
|
@@ -22,17 +22,16 @@ import { speak } from '@wordpress/a11y';
|
|
|
22
22
|
*/
|
|
23
23
|
import { useHasBorderPanel } from './border-panel';
|
|
24
24
|
import { useHasColorPanel } from './color-utils';
|
|
25
|
-
import { useHasDimensionsPanel } from './dimensions-panel';
|
|
26
25
|
import { useHasVariationsPanel } from './variations-panel';
|
|
27
26
|
import ScreenHeader from './header';
|
|
28
27
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
29
28
|
import { unlock } from '../../private-apis';
|
|
30
|
-
import { useSupportedStyles } from './hooks';
|
|
31
29
|
|
|
32
30
|
const {
|
|
31
|
+
useHasDimensionsPanel,
|
|
33
32
|
useHasTypographyPanel,
|
|
34
33
|
useGlobalSetting,
|
|
35
|
-
|
|
34
|
+
useSettingsForBlockElement,
|
|
36
35
|
} = unlock( blockEditorPrivateApis );
|
|
37
36
|
|
|
38
37
|
function useSortedBlockTypes() {
|
|
@@ -60,15 +59,11 @@ function useSortedBlockTypes() {
|
|
|
60
59
|
|
|
61
60
|
function BlockMenuItem( { block } ) {
|
|
62
61
|
const [ rawSettings ] = useGlobalSetting( '', block.name );
|
|
63
|
-
const
|
|
64
|
-
const settings = useMemo(
|
|
65
|
-
() => overrideSettingsWithSupports( rawSettings, supports ),
|
|
66
|
-
[ rawSettings, supports ]
|
|
67
|
-
);
|
|
62
|
+
const settings = useSettingsForBlockElement( rawSettings, block.name );
|
|
68
63
|
const hasTypographyPanel = useHasTypographyPanel( settings );
|
|
69
64
|
const hasColorPanel = useHasColorPanel( block.name );
|
|
70
65
|
const hasBorderPanel = useHasBorderPanel( block.name );
|
|
71
|
-
const hasDimensionsPanel = useHasDimensionsPanel(
|
|
66
|
+
const hasDimensionsPanel = useHasDimensionsPanel( settings );
|
|
72
67
|
const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
|
|
73
68
|
const hasVariationsPanel = useHasVariationsPanel( block.name );
|
|
74
69
|
const hasBlockMenuItem =
|
|
@@ -16,7 +16,7 @@ function ScreenBorder( { name, variation = '' } ) {
|
|
|
16
16
|
const variationClassName = getVariationClassName( variation );
|
|
17
17
|
return (
|
|
18
18
|
<>
|
|
19
|
-
<ScreenHeader title={ __( 'Border
|
|
19
|
+
<ScreenHeader title={ __( 'Border' ) } />
|
|
20
20
|
<BlockPreviewPanel name={ name } variation={ variationClassName } />
|
|
21
21
|
{ hasBorderPanel && (
|
|
22
22
|
<BorderPanel name={ name } variation={ variation } />
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import DuotonePanel from './duotone-panel';
|
|
10
|
+
import BlockPreviewPanel from './block-preview-panel';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import ScreenHeader from './header';
|
|
16
|
+
|
|
17
|
+
function ScreenFilters( { name } ) {
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<ScreenHeader title={ __( 'Filters' ) } />
|
|
21
|
+
<BlockPreviewPanel name={ name } />
|
|
22
|
+
<DuotonePanel name={ name } />
|
|
23
|
+
</>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default ScreenFilters;
|
|
@@ -2,17 +2,24 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
8
9
|
*/
|
|
9
|
-
import DimensionsPanel
|
|
10
|
+
import DimensionsPanel from './dimensions-panel';
|
|
10
11
|
import ScreenHeader from './header';
|
|
11
12
|
import BlockPreviewPanel from './block-preview-panel';
|
|
12
13
|
import { getVariationClassName } from './utils';
|
|
14
|
+
import { unlock } from '../../private-apis';
|
|
15
|
+
|
|
16
|
+
const { useHasDimensionsPanel, useGlobalSetting, useSettingsForBlockElement } =
|
|
17
|
+
unlock( blockEditorPrivateApis );
|
|
13
18
|
|
|
14
19
|
function ScreenLayout( { name, variation = '' } ) {
|
|
15
|
-
const
|
|
20
|
+
const [ rawSettings ] = useGlobalSetting( '', name );
|
|
21
|
+
const settings = useSettingsForBlockElement( rawSettings, name );
|
|
22
|
+
const hasDimensionsPanel = useHasDimensionsPanel( settings );
|
|
16
23
|
const variationClassName = getVariationClassName( variation );
|
|
17
24
|
return (
|
|
18
25
|
<>
|
|
@@ -24,7 +24,6 @@ export function ScreenVariations( { name, path = '' } ) {
|
|
|
24
24
|
return (
|
|
25
25
|
<div className="edit-site-global-styles-screen-variations">
|
|
26
26
|
<VStack spacing={ 3 }>
|
|
27
|
-
<p>Manage style variations, saved block appearence presets.</p>
|
|
28
27
|
<Subtitle>{ __( 'Style Variations' ) }</Subtitle>
|
|
29
28
|
<VariationsPanel name={ name } />
|
|
30
29
|
</VStack>
|
|
@@ -146,9 +146,9 @@ function ShadowPopoverContainer( { shadow, onShadowChange } ) {
|
|
|
146
146
|
function ShadowPresets( { presets, activeShadow, onSelect } ) {
|
|
147
147
|
return ! presets ? null : (
|
|
148
148
|
<Grid columns={ 6 } gap={ 0 } align="center" justify="center">
|
|
149
|
-
{ presets.map( ( { name, shadow }
|
|
149
|
+
{ presets.map( ( { name, slug, shadow } ) => (
|
|
150
150
|
<ShadowIndicator
|
|
151
|
-
key={
|
|
151
|
+
key={ slug }
|
|
152
152
|
label={ name }
|
|
153
153
|
isActive={ shadow === activeShadow }
|
|
154
154
|
onSelect={ () =>
|
|
@@ -167,8 +167,9 @@ function ShadowIndicator( { label, isActive, onSelect, shadow } ) {
|
|
|
167
167
|
<Button
|
|
168
168
|
className="edit-site-global-styles__shadow-indicator"
|
|
169
169
|
onClick={ onSelect }
|
|
170
|
-
|
|
170
|
+
label={ label }
|
|
171
171
|
style={ { boxShadow: shadow } }
|
|
172
|
+
showTooltip
|
|
172
173
|
>
|
|
173
174
|
{ isActive && <Icon icon={ check } /> }
|
|
174
175
|
</Button>
|
|
@@ -2,18 +2,16 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
5
|
-
import { useMemo } from '@wordpress/element';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Internal dependencies
|
|
9
8
|
*/
|
|
10
9
|
import { unlock } from '../../private-apis';
|
|
11
|
-
import { useSupportedStyles } from './hooks';
|
|
12
10
|
|
|
13
11
|
const {
|
|
14
12
|
useGlobalStyle,
|
|
15
13
|
useGlobalSetting,
|
|
16
|
-
|
|
14
|
+
useSettingsForBlockElement,
|
|
17
15
|
TypographyPanel: StylesTypographyPanel,
|
|
18
16
|
} = unlock( blockEditorPrivateApis );
|
|
19
17
|
|
|
@@ -40,10 +38,10 @@ export default function TypographyPanel( {
|
|
|
40
38
|
} );
|
|
41
39
|
const [ rawSettings ] = useGlobalSetting( '', name );
|
|
42
40
|
const usedElement = element === 'heading' ? headingLevel : element;
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
const settings = useSettingsForBlockElement(
|
|
42
|
+
rawSettings,
|
|
43
|
+
name,
|
|
44
|
+
usedElement
|
|
47
45
|
);
|
|
48
46
|
|
|
49
47
|
return (
|
|
@@ -24,6 +24,7 @@ import ScreenBlockList from './screen-block-list';
|
|
|
24
24
|
import ScreenBlock from './screen-block';
|
|
25
25
|
import ScreenTypography from './screen-typography';
|
|
26
26
|
import ScreenTypographyElement from './screen-typography-element';
|
|
27
|
+
import ScreenFilters from './screen-filters';
|
|
27
28
|
import ScreenColors from './screen-colors';
|
|
28
29
|
import ScreenColorPalette from './screen-color-palette';
|
|
29
30
|
import ScreenBackgroundColor from './screen-background-color';
|
|
@@ -68,7 +69,7 @@ function GlobalStylesActionMenu() {
|
|
|
68
69
|
<GlobalStylesMenuFill>
|
|
69
70
|
<DropdownMenu
|
|
70
71
|
icon={ moreVertical }
|
|
71
|
-
label={ __( '
|
|
72
|
+
label={ __( 'Styles actions' ) }
|
|
72
73
|
controls={ [
|
|
73
74
|
{
|
|
74
75
|
title: __( 'Reset to defaults' ),
|
|
@@ -205,6 +206,10 @@ function ContextScreens( { name, parentMenu = '', variation = '' } ) {
|
|
|
205
206
|
<ScreenBackgroundColor name={ name } variation={ variation } />
|
|
206
207
|
</GlobalStylesNavigationScreen>
|
|
207
208
|
|
|
209
|
+
<GlobalStylesNavigationScreen path={ parentMenu + '/filters' }>
|
|
210
|
+
<ScreenFilters name={ name } />
|
|
211
|
+
</GlobalStylesNavigationScreen>
|
|
212
|
+
|
|
208
213
|
<GlobalStylesNavigationScreen path={ parentMenu + '/colors/text' }>
|
|
209
214
|
<ScreenTextColor name={ name } variation={ variation } />
|
|
210
215
|
</GlobalStylesNavigationScreen>
|
|
@@ -36,4 +36,14 @@ export const textFormattingShortcuts = [
|
|
|
36
36
|
keyCombination: { modifier: 'access', character: 'x' },
|
|
37
37
|
description: __( 'Make the selected text inline code.' ),
|
|
38
38
|
},
|
|
39
|
+
{
|
|
40
|
+
keyCombination: { modifier: 'access', character: '0' },
|
|
41
|
+
description: __( 'Convert the current heading to a paragraph.' ),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
keyCombination: { modifier: 'access', character: '1-6' },
|
|
45
|
+
description: __(
|
|
46
|
+
'Convert the current paragraph or heading to a heading of level 1 to 6.'
|
|
47
|
+
),
|
|
48
|
+
},
|
|
39
49
|
];
|