@wordpress/edit-site 4.2.0 → 4.3.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/block-editor/index.js +53 -4
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/global-styles/color-indicator-wrapper.js +37 -0
- package/build/components/global-styles/color-indicator-wrapper.js.map +1 -0
- package/build/components/global-styles/dimensions-panel.js +32 -1
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/header.js +1 -4
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/icon-with-current-color.js +34 -0
- package/build/components/global-styles/icon-with-current-color.js.map +1 -0
- package/build/components/global-styles/navigation-button.js +7 -3
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +8 -5
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +142 -26
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +2 -2
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +11 -3
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-root.js +7 -5
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +12 -5
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/sidebar/index.js +12 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/navigation-menu-sidebar/index.js +40 -0
- package/build/components/sidebar/navigation-menu-sidebar/index.js.map +1 -0
- package/build/components/sidebar/navigation-menu-sidebar/navigation-inspector.js +185 -0
- package/build/components/sidebar/navigation-menu-sidebar/navigation-inspector.js.map +1 -0
- package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js +54 -0
- package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -0
- package/build/components/template-part-converter/convert-to-regular.js +6 -0
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/block-editor/index.js +51 -6
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/global-styles/color-indicator-wrapper.js +25 -0
- package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -0
- package/build-module/components/global-styles/dimensions-panel.js +33 -2
- package/build-module/components/global-styles/dimensions-panel.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/icon-with-current-color.js +22 -0
- package/build-module/components/global-styles/icon-with-current-color.js.map +1 -0
- package/build-module/components/global-styles/navigation-button.js +7 -3
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +8 -6
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +141 -27
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +2 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +10 -3
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +8 -7
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +13 -6
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/sidebar/index.js +11 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js +26 -0
- package/build-module/components/sidebar/navigation-menu-sidebar/index.js.map +1 -0
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-inspector.js +168 -0
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-inspector.js.map +1 -0
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js +45 -0
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -0
- package/build-module/components/template-part-converter/convert-to-regular.js +6 -0
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-style/style-rtl.css +51 -4
- package/build-style/style.css +51 -4
- package/package.json +29 -29
- package/src/components/block-editor/index.js +79 -9
- package/src/components/global-styles/color-indicator-wrapper.js +23 -0
- package/src/components/global-styles/dimensions-panel.js +39 -1
- package/src/components/global-styles/header.js +2 -7
- package/src/components/global-styles/icon-with-current-color.js +21 -0
- package/src/components/global-styles/navigation-button.js +6 -4
- package/src/components/global-styles/palette.js +8 -11
- package/src/components/global-styles/preview.js +186 -29
- package/src/components/global-styles/screen-block-list.js +1 -3
- package/src/components/global-styles/screen-colors.js +7 -6
- package/src/components/global-styles/screen-root.js +15 -17
- package/src/components/global-styles/screen-style-variations.js +13 -4
- package/src/components/global-styles/style.scss +18 -6
- package/src/components/sidebar/index.js +12 -0
- package/src/components/sidebar/navigation-menu-sidebar/index.js +34 -0
- package/src/components/sidebar/navigation-menu-sidebar/navigation-inspector.js +224 -0
- package/src/components/sidebar/navigation-menu-sidebar/navigation-menu.js +62 -0
- package/src/components/sidebar/navigation-menu-sidebar/style.scss +42 -0
- package/src/components/sidebar/style.scss +1 -1
- package/src/components/template-part-converter/convert-to-regular.js +9 -0
- package/src/style.scss +1 -0
package/build-style/style.css
CHANGED
|
@@ -773,20 +773,30 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
|
|
|
773
773
|
|
|
774
774
|
.edit-site-global-styles-variations_item {
|
|
775
775
|
box-sizing: border-box;
|
|
776
|
+
}
|
|
777
|
+
.edit-site-global-styles-variations_item .edit-site-global-styles-variations_item-preview {
|
|
776
778
|
padding: 2px;
|
|
777
779
|
border-radius: 2px;
|
|
778
780
|
border: #e0e0e0 1px solid;
|
|
779
781
|
}
|
|
780
|
-
.edit-site-global-styles-variations_item.is-active {
|
|
782
|
+
.edit-site-global-styles-variations_item.is-active .edit-site-global-styles-variations_item-preview {
|
|
781
783
|
border: #1e1e1e 1px solid;
|
|
782
784
|
}
|
|
783
|
-
.edit-site-global-styles-variations_item:hover {
|
|
785
|
+
.edit-site-global-styles-variations_item:hover .edit-site-global-styles-variations_item-preview {
|
|
784
786
|
border: var(--wp-admin-theme-color) 1px solid;
|
|
785
787
|
}
|
|
786
|
-
.edit-site-global-styles-variations_item:focus {
|
|
788
|
+
.edit-site-global-styles-variations_item:focus .edit-site-global-styles-variations_item-preview {
|
|
787
789
|
border: var(--wp-admin-theme-color) 1px solid;
|
|
788
790
|
}
|
|
789
791
|
|
|
792
|
+
.edit-site-global-styles-icon-with-current-color {
|
|
793
|
+
fill: currentColor;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
.edit-site-global-styles__color-indicator-wrapper {
|
|
797
|
+
height: 24px;
|
|
798
|
+
}
|
|
799
|
+
|
|
790
800
|
.edit-site-header {
|
|
791
801
|
align-items: center;
|
|
792
802
|
background-color: #fff;
|
|
@@ -1537,7 +1547,7 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1537
1547
|
padding: 0 8px;
|
|
1538
1548
|
height: 24px;
|
|
1539
1549
|
border-radius: 2px;
|
|
1540
|
-
background-color: #
|
|
1550
|
+
background-color: #1e1e1e;
|
|
1541
1551
|
color: #fff;
|
|
1542
1552
|
align-items: center;
|
|
1543
1553
|
font-size: 12px;
|
|
@@ -1614,6 +1624,43 @@ body.is-fullscreen-mode .edit-site-list-header {
|
|
|
1614
1624
|
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 -4px 0 0 var(--wp-admin-theme-color);
|
|
1615
1625
|
}
|
|
1616
1626
|
|
|
1627
|
+
@keyframes loadingpulse {
|
|
1628
|
+
0% {
|
|
1629
|
+
opacity: 1;
|
|
1630
|
+
}
|
|
1631
|
+
50% {
|
|
1632
|
+
opacity: 0.5;
|
|
1633
|
+
}
|
|
1634
|
+
100% {
|
|
1635
|
+
opacity: 1;
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
.edit-site-navigation-inspector {
|
|
1639
|
+
padding: 16px;
|
|
1640
|
+
}
|
|
1641
|
+
.edit-site-navigation-inspector .block-editor-list-view-leaf .block-editor-list-view-block-contents {
|
|
1642
|
+
align-items: flex-start;
|
|
1643
|
+
white-space: normal;
|
|
1644
|
+
}
|
|
1645
|
+
.edit-site-navigation-inspector .block-editor-list-view-block__title {
|
|
1646
|
+
margin-top: 3px;
|
|
1647
|
+
}
|
|
1648
|
+
.edit-site-navigation-inspector .block-editor-list-view-block__menu-cell {
|
|
1649
|
+
padding-right: 0;
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
.edit-site-navigation-inspector__placeholder {
|
|
1653
|
+
padding: 8px;
|
|
1654
|
+
margin: 8px;
|
|
1655
|
+
background-color: #f0f0f0;
|
|
1656
|
+
animation: loadingpulse 1s linear infinite;
|
|
1657
|
+
animation-delay: 0.5s;
|
|
1658
|
+
}
|
|
1659
|
+
.edit-site-navigation-inspector__placeholder.is-child {
|
|
1660
|
+
margin-left: 24px;
|
|
1661
|
+
width: 50%;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1617
1664
|
.edit-site-template-card {
|
|
1618
1665
|
display: flex;
|
|
1619
1666
|
align-items: flex-start;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,33 +27,33 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/a11y": "^3.
|
|
31
|
-
"@wordpress/api-fetch": "^6.
|
|
32
|
-
"@wordpress/block-editor": "^8.
|
|
33
|
-
"@wordpress/block-library": "^7.
|
|
34
|
-
"@wordpress/blocks": "^11.
|
|
35
|
-
"@wordpress/components": "^19.
|
|
36
|
-
"@wordpress/compose": "^5.
|
|
37
|
-
"@wordpress/core-data": "^4.
|
|
38
|
-
"@wordpress/data": "^6.
|
|
39
|
-
"@wordpress/deprecated": "^3.
|
|
40
|
-
"@wordpress/editor": "^12.
|
|
41
|
-
"@wordpress/element": "^4.
|
|
42
|
-
"@wordpress/hooks": "^3.
|
|
43
|
-
"@wordpress/html-entities": "^3.
|
|
44
|
-
"@wordpress/i18n": "^4.
|
|
45
|
-
"@wordpress/icons": "^8.
|
|
46
|
-
"@wordpress/interface": "^4.
|
|
47
|
-
"@wordpress/keyboard-shortcuts": "^3.
|
|
48
|
-
"@wordpress/keycodes": "^3.
|
|
49
|
-
"@wordpress/media-utils": "^3.
|
|
50
|
-
"@wordpress/notices": "^3.
|
|
51
|
-
"@wordpress/plugins": "^4.
|
|
52
|
-
"@wordpress/preferences": "^1.
|
|
53
|
-
"@wordpress/reusable-blocks": "^3.
|
|
54
|
-
"@wordpress/style-engine": "^0.
|
|
55
|
-
"@wordpress/url": "^3.
|
|
56
|
-
"@wordpress/viewport": "^4.
|
|
30
|
+
"@wordpress/a11y": "^3.6.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.3.0",
|
|
32
|
+
"@wordpress/block-editor": "^8.5.0",
|
|
33
|
+
"@wordpress/block-library": "^7.3.0",
|
|
34
|
+
"@wordpress/blocks": "^11.5.0",
|
|
35
|
+
"@wordpress/components": "^19.8.0",
|
|
36
|
+
"@wordpress/compose": "^5.4.0",
|
|
37
|
+
"@wordpress/core-data": "^4.4.0",
|
|
38
|
+
"@wordpress/data": "^6.6.0",
|
|
39
|
+
"@wordpress/deprecated": "^3.6.0",
|
|
40
|
+
"@wordpress/editor": "^12.5.0",
|
|
41
|
+
"@wordpress/element": "^4.4.0",
|
|
42
|
+
"@wordpress/hooks": "^3.6.0",
|
|
43
|
+
"@wordpress/html-entities": "^3.6.0",
|
|
44
|
+
"@wordpress/i18n": "^4.6.0",
|
|
45
|
+
"@wordpress/icons": "^8.2.0",
|
|
46
|
+
"@wordpress/interface": "^4.5.0",
|
|
47
|
+
"@wordpress/keyboard-shortcuts": "^3.4.0",
|
|
48
|
+
"@wordpress/keycodes": "^3.6.0",
|
|
49
|
+
"@wordpress/media-utils": "^3.4.0",
|
|
50
|
+
"@wordpress/notices": "^3.6.0",
|
|
51
|
+
"@wordpress/plugins": "^4.4.0",
|
|
52
|
+
"@wordpress/preferences": "^1.2.0",
|
|
53
|
+
"@wordpress/reusable-blocks": "^3.4.0",
|
|
54
|
+
"@wordpress/style-engine": "^0.5.0",
|
|
55
|
+
"@wordpress/url": "^3.7.0",
|
|
56
|
+
"@wordpress/viewport": "^4.4.0",
|
|
57
57
|
"classnames": "^2.3.1",
|
|
58
58
|
"downloadjs": "^1.4.7",
|
|
59
59
|
"history": "^5.1.0",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "11eb1241e63c9240018323551c6753f8a5fa96f9"
|
|
72
72
|
}
|
|
@@ -8,20 +8,26 @@ import classnames from 'classnames';
|
|
|
8
8
|
*/
|
|
9
9
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
10
|
import { useCallback, useRef } from '@wordpress/element';
|
|
11
|
-
import { useEntityBlockEditor } from '@wordpress/core-data';
|
|
11
|
+
import { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';
|
|
12
12
|
import {
|
|
13
13
|
BlockList,
|
|
14
14
|
BlockEditorProvider,
|
|
15
15
|
__experimentalLinkControl,
|
|
16
16
|
BlockInspector,
|
|
17
17
|
BlockTools,
|
|
18
|
+
__unstableBlockToolbarLastItem,
|
|
18
19
|
__unstableBlockSettingsMenuFirstItem,
|
|
19
20
|
__unstableUseTypingObserver as useTypingObserver,
|
|
20
21
|
BlockEditorKeyboardShortcuts,
|
|
21
22
|
store as blockEditorStore,
|
|
23
|
+
__unstableBlockNameContext,
|
|
22
24
|
} from '@wordpress/block-editor';
|
|
23
25
|
import { useMergeRefs, useViewportMatch } from '@wordpress/compose';
|
|
24
26
|
import { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';
|
|
27
|
+
import { listView } from '@wordpress/icons';
|
|
28
|
+
import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
29
|
+
import { __ } from '@wordpress/i18n';
|
|
30
|
+
import { store as interfaceStore } from '@wordpress/interface';
|
|
25
31
|
|
|
26
32
|
/**
|
|
27
33
|
* Internal dependencies
|
|
@@ -42,17 +48,44 @@ const LAYOUT = {
|
|
|
42
48
|
};
|
|
43
49
|
|
|
44
50
|
export default function BlockEditor( { setIsInserterOpen } ) {
|
|
45
|
-
const { settings
|
|
51
|
+
const { settings } = useSelect(
|
|
46
52
|
( select ) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
let storedSettings = select( editSiteStore ).getSettings(
|
|
54
|
+
setIsInserterOpen
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
if ( ! storedSettings.__experimentalBlockPatterns ) {
|
|
58
|
+
storedSettings = {
|
|
59
|
+
...storedSettings,
|
|
60
|
+
__experimentalBlockPatterns: select(
|
|
61
|
+
coreStore
|
|
62
|
+
).getBlockPatterns(),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if ( ! storedSettings.__experimentalBlockPatternCategories ) {
|
|
67
|
+
storedSettings = {
|
|
68
|
+
...storedSettings,
|
|
69
|
+
__experimentalBlockPatternCategories: select(
|
|
70
|
+
coreStore
|
|
71
|
+
).getBlockPatternCategories(),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
settings: storedSettings,
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
[ setIsInserterOpen ]
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const { templateType, templateId, page } = useSelect(
|
|
83
|
+
( select ) => {
|
|
84
|
+
const { getEditedPostType, getEditedPostId, getPage } = select(
|
|
85
|
+
editSiteStore
|
|
86
|
+
);
|
|
53
87
|
|
|
54
88
|
return {
|
|
55
|
-
settings: getSettings( setIsInserterOpen ),
|
|
56
89
|
templateType: getEditedPostType(),
|
|
57
90
|
templateId: getEditedPostId(),
|
|
58
91
|
page: getPage(),
|
|
@@ -60,11 +93,19 @@ export default function BlockEditor( { setIsInserterOpen } ) {
|
|
|
60
93
|
},
|
|
61
94
|
[ setIsInserterOpen ]
|
|
62
95
|
);
|
|
96
|
+
|
|
63
97
|
const [ blocks, onInput, onChange ] = useEntityBlockEditor(
|
|
64
98
|
'postType',
|
|
65
99
|
templateType
|
|
66
100
|
);
|
|
67
101
|
const { setPage } = useDispatch( editSiteStore );
|
|
102
|
+
const { enableComplementaryArea } = useDispatch( interfaceStore );
|
|
103
|
+
const openNavigationSidebar = useCallback( () => {
|
|
104
|
+
enableComplementaryArea(
|
|
105
|
+
'core/edit-site',
|
|
106
|
+
'edit-site/navigation-menu'
|
|
107
|
+
);
|
|
108
|
+
}, [ enableComplementaryArea ] );
|
|
68
109
|
const contentRef = useRef();
|
|
69
110
|
const mergedRefs = useMergeRefs( [ contentRef, useTypingObserver() ] );
|
|
70
111
|
const isMobileViewport = useViewportMatch( 'small', '<' );
|
|
@@ -72,6 +113,26 @@ export default function BlockEditor( { setIsInserterOpen } ) {
|
|
|
72
113
|
|
|
73
114
|
const isTemplatePart = templateType === 'wp_template_part';
|
|
74
115
|
|
|
116
|
+
const NavMenuSidebarToggle = () => (
|
|
117
|
+
<ToolbarGroup>
|
|
118
|
+
<ToolbarButton
|
|
119
|
+
className="components-toolbar__control"
|
|
120
|
+
label={ __( 'Open list view' ) }
|
|
121
|
+
onClick={ openNavigationSidebar }
|
|
122
|
+
icon={ listView }
|
|
123
|
+
/>
|
|
124
|
+
</ToolbarGroup>
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
// Conditionally include NavMenu sidebar in Plugin only.
|
|
128
|
+
// Optimise for dead code elimination.
|
|
129
|
+
// See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.
|
|
130
|
+
let MaybeNavMenuSidebarToggle = 'Fragment';
|
|
131
|
+
|
|
132
|
+
if ( process.env.IS_GUTENBERG_PLUGIN ) {
|
|
133
|
+
MaybeNavMenuSidebarToggle = NavMenuSidebarToggle;
|
|
134
|
+
}
|
|
135
|
+
|
|
75
136
|
return (
|
|
76
137
|
<BlockEditorProvider
|
|
77
138
|
settings={ settings }
|
|
@@ -133,6 +194,15 @@ export default function BlockEditor( { setIsInserterOpen } ) {
|
|
|
133
194
|
<BlockInspectorButton onClick={ onClose } />
|
|
134
195
|
) }
|
|
135
196
|
</__unstableBlockSettingsMenuFirstItem>
|
|
197
|
+
<__unstableBlockToolbarLastItem>
|
|
198
|
+
<__unstableBlockNameContext.Consumer>
|
|
199
|
+
{ ( blockName ) =>
|
|
200
|
+
blockName === 'core/navigation' && (
|
|
201
|
+
<MaybeNavMenuSidebarToggle />
|
|
202
|
+
)
|
|
203
|
+
}
|
|
204
|
+
</__unstableBlockNameContext.Consumer>
|
|
205
|
+
</__unstableBlockToolbarLastItem>
|
|
136
206
|
</BlockTools>
|
|
137
207
|
<ReusableBlocksMenuItems />
|
|
138
208
|
</BlockEditorProvider>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { Flex } from '@wordpress/components';
|
|
10
|
+
|
|
11
|
+
function ColorIndicatorWrapper( { className, ...props } ) {
|
|
12
|
+
return (
|
|
13
|
+
<Flex
|
|
14
|
+
className={ classnames(
|
|
15
|
+
'edit-site-global-styles__color-indicator-wrapper',
|
|
16
|
+
className
|
|
17
|
+
) }
|
|
18
|
+
{ ...props }
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default ColorIndicatorWrapper;
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
__experimentalToolsPanel as ToolsPanel,
|
|
7
7
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
8
8
|
__experimentalBoxControl as BoxControl,
|
|
9
|
+
__experimentalUnitControl as UnitControl,
|
|
9
10
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
10
11
|
} from '@wordpress/components';
|
|
11
12
|
import { __experimentalUseCustomSides as useCustomSides } from '@wordpress/block-editor';
|
|
@@ -20,8 +21,9 @@ const AXIAL_SIDES = [ 'horizontal', 'vertical' ];
|
|
|
20
21
|
export function useHasDimensionsPanel( name ) {
|
|
21
22
|
const hasPadding = useHasPadding( name );
|
|
22
23
|
const hasMargin = useHasMargin( name );
|
|
24
|
+
const hasGap = useHasGap( name );
|
|
23
25
|
|
|
24
|
-
return hasPadding || hasMargin;
|
|
26
|
+
return hasPadding || hasMargin || hasGap;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
function useHasPadding( name ) {
|
|
@@ -38,6 +40,18 @@ function useHasMargin( name ) {
|
|
|
38
40
|
return settings && supports.includes( 'margin' );
|
|
39
41
|
}
|
|
40
42
|
|
|
43
|
+
function useHasGap( name ) {
|
|
44
|
+
const supports = getSupportedGlobalStylesPanels( name );
|
|
45
|
+
const [ settings ] = useSetting( 'spacing.blockGap', name );
|
|
46
|
+
// Do not show the gap control panel for block-level global styles
|
|
47
|
+
// as they do not work on the frontend.
|
|
48
|
+
// See: https://github.com/WordPress/gutenberg/pull/39845.
|
|
49
|
+
// We can revert this condition when they're working again.
|
|
50
|
+
return !! name
|
|
51
|
+
? false
|
|
52
|
+
: settings && supports.includes( '--wp--style--block-gap' );
|
|
53
|
+
}
|
|
54
|
+
|
|
41
55
|
function filterValuesBySides( values, sides ) {
|
|
42
56
|
if ( ! sides ) {
|
|
43
57
|
// If no custom side configuration all sides are opted into by default.
|
|
@@ -79,6 +93,7 @@ function splitStyleValue( value ) {
|
|
|
79
93
|
export default function DimensionsPanel( { name } ) {
|
|
80
94
|
const showPaddingControl = useHasPadding( name );
|
|
81
95
|
const showMarginControl = useHasMargin( name );
|
|
96
|
+
const showGapControl = useHasGap( name );
|
|
82
97
|
const units = useCustomUnits( {
|
|
83
98
|
availableUnits: useSetting( 'spacing.units', name )[ 0 ] || [
|
|
84
99
|
'%',
|
|
@@ -118,9 +133,15 @@ export default function DimensionsPanel( { name } ) {
|
|
|
118
133
|
const resetMarginValue = () => setMarginValues( {} );
|
|
119
134
|
const hasMarginValue = () =>
|
|
120
135
|
!! marginValues && Object.keys( marginValues ).length;
|
|
136
|
+
|
|
137
|
+
const [ gapValue, setGapValue ] = useStyle( 'spacing.blockGap', name );
|
|
138
|
+
const resetGapValue = () => setGapValue( undefined );
|
|
139
|
+
const hasGapValue = () => !! gapValue;
|
|
140
|
+
|
|
121
141
|
const resetAll = () => {
|
|
122
142
|
resetPaddingValue();
|
|
123
143
|
resetMarginValue();
|
|
144
|
+
resetGapValue();
|
|
124
145
|
};
|
|
125
146
|
|
|
126
147
|
return (
|
|
@@ -161,6 +182,23 @@ export default function DimensionsPanel( { name } ) {
|
|
|
161
182
|
/>
|
|
162
183
|
</ToolsPanelItem>
|
|
163
184
|
) }
|
|
185
|
+
{ showGapControl && (
|
|
186
|
+
<ToolsPanelItem
|
|
187
|
+
hasValue={ hasGapValue }
|
|
188
|
+
label={ __( 'Block spacing' ) }
|
|
189
|
+
onDeselect={ resetGapValue }
|
|
190
|
+
isShownByDefault={ true }
|
|
191
|
+
>
|
|
192
|
+
<UnitControl
|
|
193
|
+
label={ __( 'Block spacing' ) }
|
|
194
|
+
__unstableInputWidth="80px"
|
|
195
|
+
min={ 0 }
|
|
196
|
+
onChange={ setGapValue }
|
|
197
|
+
units={ units }
|
|
198
|
+
value={ gapValue }
|
|
199
|
+
/>
|
|
200
|
+
</ToolsPanelItem>
|
|
201
|
+
) }
|
|
164
202
|
</ToolsPanel>
|
|
165
203
|
);
|
|
166
204
|
}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
__experimentalView as View,
|
|
10
10
|
} from '@wordpress/components';
|
|
11
11
|
import { isRTL, __ } from '@wordpress/i18n';
|
|
12
|
-
import { chevronRight, chevronLeft
|
|
12
|
+
import { chevronRight, chevronLeft } from '@wordpress/icons';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
@@ -22,12 +22,7 @@ function ScreenHeader( { title, description } ) {
|
|
|
22
22
|
<HStack spacing={ 2 }>
|
|
23
23
|
<View>
|
|
24
24
|
<NavigationBackButton
|
|
25
|
-
icon={
|
|
26
|
-
<Icon
|
|
27
|
-
icon={ isRTL() ? chevronRight : chevronLeft }
|
|
28
|
-
variant="muted"
|
|
29
|
-
/>
|
|
30
|
-
}
|
|
25
|
+
icon={ isRTL() ? chevronRight : chevronLeft }
|
|
31
26
|
size="small"
|
|
32
27
|
aria-label={ __( 'Navigate to the previous view' ) }
|
|
33
28
|
/>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { Icon } from '@wordpress/components';
|
|
10
|
+
|
|
11
|
+
export function IconWithCurrentColor( { className, ...props } ) {
|
|
12
|
+
return (
|
|
13
|
+
<Icon
|
|
14
|
+
className={ classnames(
|
|
15
|
+
className,
|
|
16
|
+
'edit-site-global-styles-icon-with-current-color'
|
|
17
|
+
) }
|
|
18
|
+
{ ...props }
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -8,16 +8,18 @@ import {
|
|
|
8
8
|
FlexItem,
|
|
9
9
|
__experimentalHStack as HStack,
|
|
10
10
|
} from '@wordpress/components';
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import { IconWithCurrentColor } from './icon-with-current-color';
|
|
12
16
|
|
|
13
17
|
function GenericNavigationButton( { icon, children, ...props } ) {
|
|
14
18
|
return (
|
|
15
19
|
<Item { ...props }>
|
|
16
20
|
{ icon && (
|
|
17
21
|
<HStack justify="flex-start">
|
|
18
|
-
<
|
|
19
|
-
<Icon icon={ icon } size={ 24 } />
|
|
20
|
-
</FlexItem>
|
|
22
|
+
<IconWithCurrentColor icon={ icon } size={ 24 } />
|
|
21
23
|
<FlexItem>{ children }</FlexItem>
|
|
22
24
|
</HStack>
|
|
23
25
|
) }
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
__experimentalHStack as HStack,
|
|
8
8
|
__experimentalZStack as ZStack,
|
|
9
9
|
__experimentalVStack as VStack,
|
|
10
|
-
FlexBlock,
|
|
11
10
|
ColorIndicator,
|
|
12
11
|
} from '@wordpress/components';
|
|
13
12
|
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
@@ -19,6 +18,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
19
18
|
import Subtitle from './subtitle';
|
|
20
19
|
import { NavigationButton } from './navigation-button';
|
|
21
20
|
import { useSetting } from './hooks';
|
|
21
|
+
import ColorIndicatorWrapper from './color-indicator-wrapper';
|
|
22
22
|
|
|
23
23
|
const EMPTY_COLORS = [];
|
|
24
24
|
|
|
@@ -64,16 +64,13 @@ function Palette( { name } ) {
|
|
|
64
64
|
colors.length === 0 ? 'row-reverse' : 'row'
|
|
65
65
|
}
|
|
66
66
|
>
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<ColorIndicator
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
) ) }
|
|
75
|
-
</ZStack>
|
|
76
|
-
</FlexBlock>
|
|
67
|
+
<ZStack isLayered={ false } offset={ -8 }>
|
|
68
|
+
{ colors.slice( 0, 5 ).map( ( { color } ) => (
|
|
69
|
+
<ColorIndicatorWrapper key={ color }>
|
|
70
|
+
<ColorIndicator colorValue={ color } />
|
|
71
|
+
</ColorIndicatorWrapper>
|
|
72
|
+
) ) }
|
|
73
|
+
</ZStack>
|
|
77
74
|
<FlexItem>{ paletteButtonText }</FlexItem>
|
|
78
75
|
</HStack>
|
|
79
76
|
</NavigationButton>
|