@wordpress/edit-site 5.5.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/add-new-template/new-template.js +16 -10
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js +4 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +2 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/editor/index.js +2 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +20 -159
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +2 -3
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/hooks.js +11 -26
- package/build/components/global-styles/hooks.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-border.js +13 -5
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-root.js +2 -1
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +2 -1
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/layout/index.js +7 -0
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +128 -136
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/index.js +2 -1
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +6 -5
- package/build/components/list/table.js.map +1 -1
- package/build/components/routes/link.js +4 -1
- package/build/components/routes/link.js.map +1 -1
- package/build/components/save-button/index.js +2 -5
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +82 -0
- package/build/components/save-hub/index.js.map +1 -0
- package/build/components/sidebar/index.js +2 -4
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +5 -2
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +13 -13
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +9 -14
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +87 -10
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build/components/sidebar-navigation-screen-template/index.js +59 -10
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +5 -2
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +3 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/index.js +134 -19
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +0 -3
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-part-converter/convert-to-regular.js +8 -12
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +2 -2
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/template-part-converter/index.js +19 -14
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +6 -6
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/index.js +3 -0
- package/build/index.js.map +1 -1
- package/build/utils/history.js +8 -2
- package/build/utils/history.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +18 -11
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js +3 -2
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +2 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/editor/index.js +2 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +21 -157
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +2 -2
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +11 -26
- package/build-module/components/global-styles/hooks.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-border.js +11 -2
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +2 -1
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +2 -1
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/layout/index.js +7 -0
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +126 -137
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/index.js +2 -1
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +6 -5
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/routes/link.js +5 -2
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/save-button/index.js +2 -5
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +68 -0
- package/build-module/components/save-hub/index.js.map +1 -0
- package/build-module/components/sidebar/index.js +2 -4
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +13 -13
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +13 -18
- 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 +81 -10
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-template/index.js +60 -13
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +3 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/index.js +135 -22
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
- 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 +0 -3
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +9 -13
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +3 -3
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +20 -15
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +6 -6
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/index.js +4 -1
- package/build-module/index.js.map +1 -1
- package/build-module/utils/history.js +9 -3
- package/build-module/utils/history.js.map +1 -1
- package/build-style/style-rtl.css +168 -111
- package/build-style/style.css +168 -111
- package/package.json +31 -31
- package/src/components/add-new-template/new-template.js +57 -32
- package/src/components/add-new-template/style.scss +12 -1
- package/src/components/app/index.js +9 -6
- package/src/components/block-editor/editor-canvas.js +2 -1
- package/src/components/editor/index.js +61 -65
- package/src/components/global-styles/border-panel.js +24 -199
- package/src/components/global-styles/context-menu.js +2 -2
- package/src/components/global-styles/hooks.js +12 -36
- package/src/components/global-styles/screen-block-list.js +2 -2
- package/src/components/global-styles/screen-border.js +9 -2
- package/src/components/global-styles/screen-root.js +1 -1
- package/src/components/global-styles/screen-style-variations.js +5 -1
- package/src/components/global-styles/style.scss +10 -0
- package/src/components/layout/index.js +15 -0
- package/src/components/layout/style.scss +1 -3
- package/src/components/list/added-by.js +144 -140
- package/src/components/list/index.js +3 -1
- package/src/components/list/table.js +7 -4
- package/src/components/routes/link.js +9 -2
- package/src/components/save-button/index.js +2 -2
- package/src/components/save-hub/index.js +78 -0
- package/src/components/save-hub/style.scss +15 -0
- package/src/components/sidebar/index.js +2 -3
- package/src/components/sidebar/style.scss +4 -3
- package/src/components/sidebar-button/style.scss +2 -1
- package/src/components/sidebar-navigation-item/style.scss +1 -23
- package/src/components/sidebar-navigation-screen/index.js +6 -0
- package/src/components/sidebar-navigation-screen/style.scss +15 -0
- package/src/components/sidebar-navigation-screen-main/index.js +21 -8
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +30 -21
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +92 -9
- package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +108 -1
- package/src/components/sidebar-navigation-screen-template/index.js +82 -11
- package/src/components/sidebar-navigation-screen-template/style.scss +25 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +7 -0
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -1
- package/src/components/site-hub/index.js +5 -1
- package/src/components/site-hub/style.scss +5 -1
- package/src/components/style-book/index.js +209 -54
- package/src/components/style-book/style.scss +1 -45
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +12 -7
- package/src/components/template-details/index.js +0 -3
- package/src/components/template-part-converter/convert-to-regular.js +10 -17
- package/src/components/template-part-converter/convert-to-template-part.js +9 -16
- package/src/components/template-part-converter/index.js +28 -12
- package/src/components/use-edited-entity-record/index.js +26 -18
- package/src/index.js +5 -1
- package/src/store/test/actions.js +0 -2
- package/src/style.scss +2 -1
- package/src/utils/history.js +13 -9
- package/build/components/navigation-inspector/index.js +0 -161
- package/build/components/navigation-inspector/index.js.map +0 -1
- package/build/components/navigation-inspector/navigation-menu.js +0 -79
- package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/build-module/components/navigation-inspector/index.js +0 -146
- package/build-module/components/navigation-inspector/index.js.map +0 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +0 -69
- package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/src/components/navigation-inspector/index.js +0 -191
- package/src/components/navigation-inspector/navigation-menu.js +0 -84
- package/src/components/navigation-inspector/style.scss +0 -46
|
@@ -32,7 +32,7 @@ import WelcomeGuide from '../welcome-guide';
|
|
|
32
32
|
import StartTemplateOptions from '../start-template-options';
|
|
33
33
|
import { store as editSiteStore } from '../../store';
|
|
34
34
|
import { GlobalStylesRenderer } from '../global-styles-renderer';
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
import useTitle from '../routes/use-title';
|
|
37
37
|
import CanvasSpinner from '../canvas-spinner';
|
|
38
38
|
import { unlock } from '../../private-apis';
|
|
@@ -157,70 +157,66 @@ export default function Editor() {
|
|
|
157
157
|
type={ editedPostType }
|
|
158
158
|
id={ editedPostId }
|
|
159
159
|
>
|
|
160
|
-
<
|
|
161
|
-
<
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
<
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
(
|
|
198
|
-
<
|
|
199
|
-
) )
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
} }
|
|
221
|
-
/>
|
|
222
|
-
</BlockContextProvider>
|
|
223
|
-
</GlobalStylesProvider>
|
|
160
|
+
<BlockContextProvider value={ blockContext }>
|
|
161
|
+
<SidebarComplementaryAreaFills />
|
|
162
|
+
{ isEditMode && <StartTemplateOptions /> }
|
|
163
|
+
<InterfaceSkeleton
|
|
164
|
+
enableRegionNavigation={ false }
|
|
165
|
+
className={ showIconLabels && 'show-icon-labels' }
|
|
166
|
+
notices={ isEditMode && <EditorSnackbars /> }
|
|
167
|
+
content={
|
|
168
|
+
<>
|
|
169
|
+
<GlobalStylesRenderer />
|
|
170
|
+
{ isEditMode && <EditorNotices /> }
|
|
171
|
+
{ showVisualEditor && editedPost && (
|
|
172
|
+
<BlockEditor />
|
|
173
|
+
) }
|
|
174
|
+
{ editorMode === 'text' &&
|
|
175
|
+
editedPost &&
|
|
176
|
+
isEditMode && <CodeEditor /> }
|
|
177
|
+
{ hasLoadedPost && ! editedPost && (
|
|
178
|
+
<Notice
|
|
179
|
+
status="warning"
|
|
180
|
+
isDismissible={ false }
|
|
181
|
+
>
|
|
182
|
+
{ __(
|
|
183
|
+
"You attempted to edit an item that doesn't exist. Perhaps it was deleted?"
|
|
184
|
+
) }
|
|
185
|
+
</Notice>
|
|
186
|
+
) }
|
|
187
|
+
{ isEditMode && (
|
|
188
|
+
<KeyboardShortcutsEditMode />
|
|
189
|
+
) }
|
|
190
|
+
</>
|
|
191
|
+
}
|
|
192
|
+
secondarySidebar={
|
|
193
|
+
isEditMode &&
|
|
194
|
+
( ( shouldShowInserter && (
|
|
195
|
+
<InserterSidebar />
|
|
196
|
+
) ) ||
|
|
197
|
+
( shouldShowListView && (
|
|
198
|
+
<ListViewSidebar />
|
|
199
|
+
) ) )
|
|
200
|
+
}
|
|
201
|
+
sidebar={
|
|
202
|
+
isEditMode &&
|
|
203
|
+
isRightSidebarOpen && (
|
|
204
|
+
<ComplementaryArea.Slot scope="core/edit-site" />
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
footer={
|
|
208
|
+
showBlockBreakcrumb && (
|
|
209
|
+
<BlockBreadcrumb
|
|
210
|
+
rootLabelText={ __( 'Template' ) }
|
|
211
|
+
/>
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
labels={ {
|
|
215
|
+
...interfaceLabels,
|
|
216
|
+
secondarySidebar: secondarySidebarLabel,
|
|
217
|
+
} }
|
|
218
|
+
/>
|
|
219
|
+
</BlockContextProvider>
|
|
224
220
|
</EntityProvider>
|
|
225
221
|
</EntityProvider>
|
|
226
222
|
</>
|
|
@@ -1,215 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalBorderRadiusControl as BorderRadiusControl,
|
|
6
|
-
privateApis as blockEditorPrivateApis,
|
|
7
|
-
} from '@wordpress/block-editor';
|
|
8
|
-
import {
|
|
9
|
-
__experimentalBorderBoxControl as BorderBoxControl,
|
|
10
|
-
__experimentalHasSplitBorders as hasSplitBorders,
|
|
11
|
-
__experimentalIsDefinedBorder as isDefinedBorder,
|
|
12
|
-
__experimentalToolsPanel as ToolsPanel,
|
|
13
|
-
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
14
|
-
} from '@wordpress/components';
|
|
15
|
-
import { useCallback } from '@wordpress/element';
|
|
16
|
-
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
17
5
|
|
|
18
6
|
/**
|
|
19
7
|
* Internal dependencies
|
|
20
8
|
*/
|
|
21
|
-
import { useSupportedStyles, useColorsPerOrigin } from './hooks';
|
|
22
9
|
import { unlock } from '../../private-apis';
|
|
23
10
|
|
|
24
|
-
const {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
useHasBorderStyleControl( name ),
|
|
31
|
-
useHasBorderWidthControl( name ),
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
return controls.some( Boolean );
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function useHasBorderColorControl( name ) {
|
|
38
|
-
const supports = useSupportedStyles( name );
|
|
39
|
-
return (
|
|
40
|
-
useGlobalSetting( 'border.color', name )[ 0 ] &&
|
|
41
|
-
supports.includes( 'borderColor' )
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function useHasBorderRadiusControl( name ) {
|
|
46
|
-
const supports = useSupportedStyles( name );
|
|
47
|
-
return (
|
|
48
|
-
useGlobalSetting( 'border.radius', name )[ 0 ] &&
|
|
49
|
-
supports.includes( 'borderRadius' )
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function useHasBorderStyleControl( name ) {
|
|
54
|
-
const supports = useSupportedStyles( name );
|
|
55
|
-
return (
|
|
56
|
-
useGlobalSetting( 'border.style', name )[ 0 ] &&
|
|
57
|
-
supports.includes( 'borderStyle' )
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function useHasBorderWidthControl( name ) {
|
|
62
|
-
const supports = useSupportedStyles( name );
|
|
63
|
-
return (
|
|
64
|
-
useGlobalSetting( 'border.width', name )[ 0 ] &&
|
|
65
|
-
supports.includes( 'borderWidth' )
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function applyFallbackStyle( border ) {
|
|
70
|
-
if ( ! border ) {
|
|
71
|
-
return border;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if ( ! border.style && ( border.color || border.width ) ) {
|
|
75
|
-
return { ...border, style: 'solid' };
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return border;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function applyAllFallbackStyles( border ) {
|
|
82
|
-
if ( ! border ) {
|
|
83
|
-
return border;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if ( hasSplitBorders( border ) ) {
|
|
87
|
-
return {
|
|
88
|
-
top: applyFallbackStyle( border.top ),
|
|
89
|
-
right: applyFallbackStyle( border.right ),
|
|
90
|
-
bottom: applyFallbackStyle( border.bottom ),
|
|
91
|
-
left: applyFallbackStyle( border.left ),
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return applyFallbackStyle( border );
|
|
96
|
-
}
|
|
11
|
+
const {
|
|
12
|
+
useGlobalStyle,
|
|
13
|
+
useGlobalSetting,
|
|
14
|
+
useSettingsForBlockElement,
|
|
15
|
+
BorderPanel: StylesBorderPanel,
|
|
16
|
+
} = unlock( blockEditorPrivateApis );
|
|
97
17
|
|
|
98
18
|
export default function BorderPanel( { name, variation = '' } ) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
name,
|
|
105
|
-
'user'
|
|
106
|
-
);
|
|
107
|
-
const [ border, setBorder ] = useGlobalStyle( `${ prefix }border`, name );
|
|
108
|
-
const colors = useColorsPerOrigin( name );
|
|
109
|
-
|
|
110
|
-
const showBorderColor = useHasBorderColorControl( name );
|
|
111
|
-
const showBorderStyle = useHasBorderStyleControl( name );
|
|
112
|
-
const showBorderWidth = useHasBorderWidthControl( name );
|
|
113
|
-
|
|
114
|
-
// Border radius.
|
|
115
|
-
const showBorderRadius = useHasBorderRadiusControl( name );
|
|
116
|
-
const [ borderRadiusValues, setBorderRadius ] = useGlobalStyle(
|
|
117
|
-
`${ prefix }border.radius`,
|
|
118
|
-
name
|
|
119
|
-
);
|
|
120
|
-
const hasBorderRadius = () => {
|
|
121
|
-
const borderValues = userBorderStyles?.radius;
|
|
122
|
-
if ( typeof borderValues === 'object' ) {
|
|
123
|
-
return Object.entries( borderValues ).some( Boolean );
|
|
124
|
-
}
|
|
125
|
-
return !! borderValues;
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const resetBorder = () => {
|
|
129
|
-
if ( hasBorderRadius() ) {
|
|
130
|
-
return setBorder( { radius: userBorderStyles.radius } );
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
setBorder( undefined );
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const resetAll = useCallback( () => setBorder( undefined ), [ setBorder ] );
|
|
137
|
-
const onBorderChange = useCallback(
|
|
138
|
-
( newBorder ) => {
|
|
139
|
-
// Ensure we have a visible border style when a border width or
|
|
140
|
-
// color is being selected.
|
|
141
|
-
const newBorderWithStyle = applyAllFallbackStyles( newBorder );
|
|
142
|
-
|
|
143
|
-
// As we can't conditionally generate styles based on if other
|
|
144
|
-
// style properties have been set we need to force split border
|
|
145
|
-
// definitions for user set border styles. Border radius is derived
|
|
146
|
-
// from the same property i.e. `border.radius` if it is a string
|
|
147
|
-
// that is used. The longhand border radii styles are only generated
|
|
148
|
-
// if that property is an object.
|
|
149
|
-
//
|
|
150
|
-
// For borders (color, style, and width) those are all properties on
|
|
151
|
-
// the `border` style property. This means if the theme.json defined
|
|
152
|
-
// split borders and the user condenses them into a flat border or
|
|
153
|
-
// vice-versa we'd get both sets of styles which would conflict.
|
|
154
|
-
const updatedBorder = ! hasSplitBorders( newBorderWithStyle )
|
|
155
|
-
? {
|
|
156
|
-
top: newBorderWithStyle,
|
|
157
|
-
right: newBorderWithStyle,
|
|
158
|
-
bottom: newBorderWithStyle,
|
|
159
|
-
left: newBorderWithStyle,
|
|
160
|
-
}
|
|
161
|
-
: {
|
|
162
|
-
color: null,
|
|
163
|
-
style: null,
|
|
164
|
-
width: null,
|
|
165
|
-
...newBorderWithStyle,
|
|
166
|
-
};
|
|
19
|
+
let prefixParts = [];
|
|
20
|
+
if ( variation ) {
|
|
21
|
+
prefixParts = [ 'variations', variation ].concat( prefixParts );
|
|
22
|
+
}
|
|
23
|
+
const prefix = prefixParts.join( '.' );
|
|
167
24
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
);
|
|
25
|
+
const [ style ] = useGlobalStyle( prefix, name, 'user', false );
|
|
26
|
+
const [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {
|
|
27
|
+
shouldDecodeEncode: false,
|
|
28
|
+
} );
|
|
29
|
+
const [ rawSettings ] = useGlobalSetting( '', name );
|
|
30
|
+
const settings = useSettingsForBlockElement( rawSettings, name );
|
|
175
31
|
|
|
176
32
|
return (
|
|
177
|
-
<
|
|
178
|
-
{
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
isShownByDefault={ true }
|
|
184
|
-
>
|
|
185
|
-
<BorderBoxControl
|
|
186
|
-
colors={ colors }
|
|
187
|
-
enableAlpha={ true }
|
|
188
|
-
enableStyle={ showBorderStyle }
|
|
189
|
-
onChange={ onBorderChange }
|
|
190
|
-
popoverOffset={ 40 }
|
|
191
|
-
popoverPlacement="left-start"
|
|
192
|
-
value={ border }
|
|
193
|
-
__experimentalIsRenderedInSidebar={ true }
|
|
194
|
-
size={ '__unstable-large' }
|
|
195
|
-
/>
|
|
196
|
-
</ToolsPanelItem>
|
|
197
|
-
) }
|
|
198
|
-
{ showBorderRadius && (
|
|
199
|
-
<ToolsPanelItem
|
|
200
|
-
hasValue={ hasBorderRadius }
|
|
201
|
-
label={ __( 'Radius' ) }
|
|
202
|
-
onDeselect={ () => setBorderRadius( undefined ) }
|
|
203
|
-
isShownByDefault={ true }
|
|
204
|
-
>
|
|
205
|
-
<BorderRadiusControl
|
|
206
|
-
values={ borderRadiusValues }
|
|
207
|
-
onChange={ ( value ) => {
|
|
208
|
-
setBorderRadius( value || undefined );
|
|
209
|
-
} }
|
|
210
|
-
/>
|
|
211
|
-
</ToolsPanelItem>
|
|
212
|
-
) }
|
|
213
|
-
</ToolsPanel>
|
|
33
|
+
<StylesBorderPanel
|
|
34
|
+
inheritedValue={ inheritedStyle }
|
|
35
|
+
value={ style }
|
|
36
|
+
onChange={ setStyle }
|
|
37
|
+
settings={ settings }
|
|
38
|
+
/>
|
|
214
39
|
);
|
|
215
40
|
}
|
|
@@ -27,7 +27,6 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
|
27
27
|
/**
|
|
28
28
|
* Internal dependencies
|
|
29
29
|
*/
|
|
30
|
-
import { useHasBorderPanel } from './border-panel';
|
|
31
30
|
import { useHasColorPanel } from './color-utils';
|
|
32
31
|
import { useHasFilterPanel } from './filter-utils';
|
|
33
32
|
import { useHasVariationsPanel } from './variations-panel';
|
|
@@ -40,6 +39,7 @@ import { unlock } from '../../private-apis';
|
|
|
40
39
|
const {
|
|
41
40
|
useHasDimensionsPanel,
|
|
42
41
|
useHasTypographyPanel,
|
|
42
|
+
useHasBorderPanel,
|
|
43
43
|
useGlobalSetting,
|
|
44
44
|
useSettingsForBlockElement,
|
|
45
45
|
} = unlock( blockEditorPrivateApis );
|
|
@@ -49,7 +49,7 @@ function ContextMenu( { name, parentMenu = '' } ) {
|
|
|
49
49
|
const settings = useSettingsForBlockElement( rawSettings, name );
|
|
50
50
|
const hasTypographyPanel = useHasTypographyPanel( settings );
|
|
51
51
|
const hasColorPanel = useHasColorPanel( name );
|
|
52
|
-
const hasBorderPanel = useHasBorderPanel(
|
|
52
|
+
const hasBorderPanel = useHasBorderPanel( settings );
|
|
53
53
|
const hasEffectsPanel = useHasShadowControl( name );
|
|
54
54
|
const hasFilterPanel = useHasFilterPanel( name );
|
|
55
55
|
const hasDimensionsPanel = useHasDimensionsPanel( settings );
|
|
@@ -18,7 +18,8 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
|
18
18
|
import { unlock } from '../../private-apis';
|
|
19
19
|
import { useSelect } from '@wordpress/data';
|
|
20
20
|
|
|
21
|
-
const { useGlobalSetting } =
|
|
21
|
+
const { useGlobalSetting, useColorsPerOrigin: useColorsPerOriginFromSettings } =
|
|
22
|
+
unlock( blockEditorPrivateApis );
|
|
22
23
|
|
|
23
24
|
// Enable colord's a11y plugin.
|
|
24
25
|
extend( [ a11yPlugin ] );
|
|
@@ -31,41 +32,16 @@ export function useColorsPerOrigin( name ) {
|
|
|
31
32
|
'color.defaultPalette'
|
|
32
33
|
);
|
|
33
34
|
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
if (
|
|
46
|
-
shouldDisplayDefaultColors &&
|
|
47
|
-
defaultColors &&
|
|
48
|
-
defaultColors.length
|
|
49
|
-
) {
|
|
50
|
-
result.push( {
|
|
51
|
-
name: _x(
|
|
52
|
-
'Default',
|
|
53
|
-
'Indicates this palette comes from WordPress.'
|
|
54
|
-
),
|
|
55
|
-
colors: defaultColors,
|
|
56
|
-
} );
|
|
57
|
-
}
|
|
58
|
-
if ( customColors && customColors.length ) {
|
|
59
|
-
result.push( {
|
|
60
|
-
name: _x(
|
|
61
|
-
'Custom',
|
|
62
|
-
'Indicates this palette is created by the user.'
|
|
63
|
-
),
|
|
64
|
-
colors: customColors,
|
|
65
|
-
} );
|
|
66
|
-
}
|
|
67
|
-
return result;
|
|
68
|
-
}, [ customColors, themeColors, defaultColors ] );
|
|
35
|
+
return useColorsPerOriginFromSettings( {
|
|
36
|
+
color: {
|
|
37
|
+
palette: {
|
|
38
|
+
custom: customColors,
|
|
39
|
+
theme: themeColors,
|
|
40
|
+
default: defaultColors,
|
|
41
|
+
},
|
|
42
|
+
defaultPalette: shouldDisplayDefaultColors,
|
|
43
|
+
},
|
|
44
|
+
} );
|
|
69
45
|
}
|
|
70
46
|
|
|
71
47
|
export function useGradientsPerOrigin( name ) {
|
|
@@ -20,7 +20,6 @@ import { speak } from '@wordpress/a11y';
|
|
|
20
20
|
/**
|
|
21
21
|
* Internal dependencies
|
|
22
22
|
*/
|
|
23
|
-
import { useHasBorderPanel } from './border-panel';
|
|
24
23
|
import { useHasColorPanel } from './color-utils';
|
|
25
24
|
import { useHasVariationsPanel } from './variations-panel';
|
|
26
25
|
import ScreenHeader from './header';
|
|
@@ -30,6 +29,7 @@ import { unlock } from '../../private-apis';
|
|
|
30
29
|
const {
|
|
31
30
|
useHasDimensionsPanel,
|
|
32
31
|
useHasTypographyPanel,
|
|
32
|
+
useHasBorderPanel,
|
|
33
33
|
useGlobalSetting,
|
|
34
34
|
useSettingsForBlockElement,
|
|
35
35
|
} = unlock( blockEditorPrivateApis );
|
|
@@ -62,7 +62,7 @@ function BlockMenuItem( { block } ) {
|
|
|
62
62
|
const settings = useSettingsForBlockElement( rawSettings, block.name );
|
|
63
63
|
const hasTypographyPanel = useHasTypographyPanel( settings );
|
|
64
64
|
const hasColorPanel = useHasColorPanel( block.name );
|
|
65
|
-
const hasBorderPanel = useHasBorderPanel(
|
|
65
|
+
const hasBorderPanel = useHasBorderPanel( settings );
|
|
66
66
|
const hasDimensionsPanel = useHasDimensionsPanel( settings );
|
|
67
67
|
const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
|
|
68
68
|
const hasVariationsPanel = useHasVariationsPanel( block.name );
|
|
@@ -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
10
|
import ScreenHeader from './header';
|
|
10
|
-
import BorderPanel
|
|
11
|
+
import BorderPanel from './border-panel';
|
|
11
12
|
import BlockPreviewPanel from './block-preview-panel';
|
|
12
13
|
import { getVariationClassName } from './utils';
|
|
14
|
+
import { unlock } from '../../private-apis';
|
|
15
|
+
|
|
16
|
+
const { useHasBorderPanel, useGlobalSetting, useSettingsForBlockElement } =
|
|
17
|
+
unlock( blockEditorPrivateApis );
|
|
13
18
|
|
|
14
19
|
function ScreenBorder( { name, variation = '' } ) {
|
|
15
|
-
const
|
|
20
|
+
const [ rawSettings ] = useGlobalSetting( '', name );
|
|
21
|
+
const settings = useSettingsForBlockElement( rawSettings, name );
|
|
22
|
+
const hasBorderPanel = useHasBorderPanel( settings );
|
|
16
23
|
const variationClassName = getVariationClassName( variation );
|
|
17
24
|
return (
|
|
18
25
|
<>
|
|
@@ -172,7 +172,11 @@ function ScreenStyleVariations() {
|
|
|
172
172
|
) }
|
|
173
173
|
/>
|
|
174
174
|
|
|
175
|
-
<Card
|
|
175
|
+
<Card
|
|
176
|
+
size="small"
|
|
177
|
+
isBorderless
|
|
178
|
+
className="edit-site-global-styles-screen-style-variations"
|
|
179
|
+
>
|
|
176
180
|
<CardBody>
|
|
177
181
|
<Grid columns={ 2 }>
|
|
178
182
|
{ withEmptyVariation?.map( ( variation, index ) => (
|
|
@@ -241,3 +241,13 @@
|
|
|
241
241
|
height: 24px;
|
|
242
242
|
width: 24px;
|
|
243
243
|
}
|
|
244
|
+
|
|
245
|
+
.edit-site-global-styles-screen-root.edit-site-global-styles-screen-root,
|
|
246
|
+
.edit-site-global-styles-screen-style-variations.edit-site-global-styles-screen-style-variations {
|
|
247
|
+
background: unset;
|
|
248
|
+
color: inherit;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.edit-site-global-styles-sidebar__panel .block-editor-block-icon svg {
|
|
252
|
+
fill: currentColor;
|
|
253
|
+
}
|
|
@@ -277,6 +277,21 @@ export default function Layout() {
|
|
|
277
277
|
{ canvasResizer }
|
|
278
278
|
{ !! canvasSize.width && (
|
|
279
279
|
<motion.div
|
|
280
|
+
whileHover={
|
|
281
|
+
isEditorPage && canvasMode === 'view'
|
|
282
|
+
? {
|
|
283
|
+
scale: 1.005,
|
|
284
|
+
transition: {
|
|
285
|
+
duration:
|
|
286
|
+
disableMotion ||
|
|
287
|
+
isResizing
|
|
288
|
+
? 0
|
|
289
|
+
: 0.5,
|
|
290
|
+
ease: 'easeOut',
|
|
291
|
+
},
|
|
292
|
+
}
|
|
293
|
+
: {}
|
|
294
|
+
}
|
|
280
295
|
initial={ false }
|
|
281
296
|
layout="position"
|
|
282
297
|
className="edit-site-layout__canvas"
|