@wordpress/edit-site 5.5.0 → 5.7.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 +4 -0
- package/build/components/add-new-template/new-template-part.js +3 -11
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +23 -17
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/add-new-template/utils.js +1 -1
- package/build/components/add-new-template/utils.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 +7 -9
- 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 +4 -6
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/hooks.js +0 -72
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview.js +3 -4
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +5 -7
- 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-colors.js +22 -211
- package/build/components/global-styles/screen-colors.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/global-styles/screen-typography-element.js +4 -0
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +5 -0
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/ui.js +5 -35
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +1 -2
- package/build/components/global-styles-renderer/index.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/secondary-sidebar/list-view-sidebar.js +6 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- 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/start-template-options/index.js +44 -9
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +133 -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/hooks/push-changes-to-global-styles/index.js +1 -0
- package/build/hooks/push-changes-to-global-styles/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-part.js +3 -9
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +25 -18
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +1 -1
- package/build-module/components/add-new-template/utils.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 +8 -10
- 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 +4 -4
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +0 -66
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview.js +3 -4
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +5 -5
- 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-colors.js +23 -208
- package/build-module/components/global-styles/screen-colors.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/global-styles/screen-typography-element.js +4 -0
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +5 -0
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/ui.js +5 -30
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +1 -2
- package/build-module/components/global-styles-renderer/index.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/secondary-sidebar/list-view-sidebar.js +6 -2
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- 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/start-template-options/index.js +45 -10
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/style-book/index.js +133 -21
- 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/hooks/push-changes-to-global-styles/index.js +1 -0
- package/build-module/hooks/push-changes-to-global-styles/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 +172 -128
- package/build-style/style.css +172 -128
- package/package.json +31 -31
- package/src/components/add-new-template/new-template-part.js +1 -6
- package/src/components/add-new-template/new-template.js +60 -38
- package/src/components/add-new-template/style.scss +12 -1
- package/src/components/add-new-template/utils.js +1 -1
- package/src/components/app/index.js +9 -6
- package/src/components/block-editor/editor-canvas.js +13 -22
- 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 +4 -4
- package/src/components/global-styles/hooks.js +0 -101
- package/src/components/global-styles/preview.js +1 -1
- package/src/components/global-styles/screen-block-list.js +4 -4
- package/src/components/global-styles/screen-border.js +9 -2
- package/src/components/global-styles/screen-colors.js +25 -229
- 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/screen-typography-element.js +4 -0
- package/src/components/global-styles/screen-typography.js +6 -0
- package/src/components/global-styles/stories/index.js +425 -0
- package/src/components/global-styles/style.scss +14 -18
- package/src/components/global-styles/ui.js +6 -31
- package/src/components/global-styles-renderer/index.js +1 -2
- 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/secondary-sidebar/list-view-sidebar.js +4 -3
- 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/start-template-options/index.js +40 -8
- package/src/components/style-book/index.js +203 -54
- package/src/components/style-book/style.scss +2 -46
- 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/hooks/push-changes-to-global-styles/index.js +1 -0
- 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/global-styles/color-utils.js +0 -17
- package/build/components/global-styles/color-utils.js.map +0 -1
- package/build/components/global-styles/screen-background-color.js +0 -114
- package/build/components/global-styles/screen-background-color.js.map +0 -1
- package/build/components/global-styles/screen-button-color.js +0 -88
- package/build/components/global-styles/screen-button-color.js.map +0 -1
- package/build/components/global-styles/screen-heading-color.js +0 -165
- package/build/components/global-styles/screen-heading-color.js.map +0 -1
- package/build/components/global-styles/screen-link-color.js +0 -105
- package/build/components/global-styles/screen-link-color.js.map +0 -1
- package/build/components/global-styles/screen-text-color.js +0 -71
- package/build/components/global-styles/screen-text-color.js.map +0 -1
- 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/global-styles/color-utils.js +0 -9
- package/build-module/components/global-styles/color-utils.js.map +0 -1
- package/build-module/components/global-styles/screen-background-color.js +0 -97
- package/build-module/components/global-styles/screen-background-color.js.map +0 -1
- package/build-module/components/global-styles/screen-button-color.js +0 -73
- package/build-module/components/global-styles/screen-button-color.js.map +0 -1
- package/build-module/components/global-styles/screen-heading-color.js +0 -149
- package/build-module/components/global-styles/screen-heading-color.js.map +0 -1
- package/build-module/components/global-styles/screen-link-color.js +0 -89
- package/build-module/components/global-styles/screen-link-color.js.map +0 -1
- package/build-module/components/global-styles/screen-text-color.js +0 -56
- package/build-module/components/global-styles/screen-text-color.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/global-styles/color-utils.js +0 -14
- package/src/components/global-styles/screen-background-color.js +0 -132
- package/src/components/global-styles/screen-button-color.js +0 -104
- package/src/components/global-styles/screen-heading-color.js +0 -206
- package/src/components/global-styles/screen-link-color.js +0 -124
- package/src/components/global-styles/screen-text-color.js +0 -62
- 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
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { privateApis as blockEditorPrivateApis, store as blockEditorStore, BlockList, BlockTools } from '@wordpress/block-editor';
|
|
7
|
-
import { useEffect } from '@wordpress/element';
|
|
8
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { unlock } from '../../private-apis';
|
|
14
|
-
const ALLOWED_BLOCKS = {
|
|
15
|
-
'core/navigation': ['core/navigation-link', 'core/search', 'core/social-links', 'core/page-list', 'core/spacer', 'core/home-link', 'core/site-title', 'core/site-logo', 'core/navigation-submenu'],
|
|
16
|
-
'core/social-links': ['core/social-link'],
|
|
17
|
-
'core/navigation-submenu': ['core/navigation-link', 'core/navigation-submenu'],
|
|
18
|
-
'core/navigation-link': ['core/navigation-link', 'core/navigation-submenu'],
|
|
19
|
-
'core/page-list': ['core/page-list-item']
|
|
20
|
-
};
|
|
21
|
-
export default function NavigationMenu(_ref) {
|
|
22
|
-
let {
|
|
23
|
-
innerBlocks,
|
|
24
|
-
onSelect
|
|
25
|
-
} = _ref;
|
|
26
|
-
const {
|
|
27
|
-
clientIdsTree
|
|
28
|
-
} = useSelect(select => {
|
|
29
|
-
const {
|
|
30
|
-
__unstableGetClientIdsTree
|
|
31
|
-
} = select(blockEditorStore);
|
|
32
|
-
return {
|
|
33
|
-
clientIdsTree: __unstableGetClientIdsTree()
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
const {
|
|
37
|
-
updateBlockListSettings
|
|
38
|
-
} = useDispatch(blockEditorStore);
|
|
39
|
-
const {
|
|
40
|
-
OffCanvasEditor,
|
|
41
|
-
LeafMoreMenu
|
|
42
|
-
} = unlock(blockEditorPrivateApis); //TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList
|
|
43
|
-
//Think through a better way of doing this, possible with adding allowed blocks to block library metadata
|
|
44
|
-
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
updateBlockListSettings('', {
|
|
47
|
-
allowedBlocks: ALLOWED_BLOCKS['core/navigation']
|
|
48
|
-
});
|
|
49
|
-
innerBlocks.forEach(block => {
|
|
50
|
-
if (ALLOWED_BLOCKS[block.name]) {
|
|
51
|
-
updateBlockListSettings(block.clientId, {
|
|
52
|
-
allowedBlocks: ALLOWED_BLOCKS[block.name]
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}, [updateBlockListSettings, innerBlocks]); // The hidden block is needed because it makes block edit side effects trigger.
|
|
57
|
-
// For example a navigation page list load its items has an effect on edit to load its items.
|
|
58
|
-
|
|
59
|
-
return createElement(Fragment, null, createElement(OffCanvasEditor, {
|
|
60
|
-
blocks: clientIdsTree,
|
|
61
|
-
onSelect: onSelect,
|
|
62
|
-
LeafMoreMenu: LeafMoreMenu
|
|
63
|
-
}), createElement("div", {
|
|
64
|
-
style: {
|
|
65
|
-
display: 'none'
|
|
66
|
-
}
|
|
67
|
-
}, createElement(BlockTools, null, createElement(BlockList, null))));
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=navigation-menu.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-inspector/navigation-menu.js"],"names":["privateApis","blockEditorPrivateApis","store","blockEditorStore","BlockList","BlockTools","useEffect","useSelect","useDispatch","unlock","ALLOWED_BLOCKS","NavigationMenu","innerBlocks","onSelect","clientIdsTree","select","__unstableGetClientIdsTree","updateBlockListSettings","OffCanvasEditor","LeafMoreMenu","allowedBlocks","forEach","block","name","clientId","display"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,WAAW,IAAIC,sBADhB,EAECC,KAAK,IAAIC,gBAFV,EAGCC,SAHD,EAICC,UAJD,QAKO,yBALP;AAMA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAMC,cAAc,GAAG;AACtB,qBAAmB,CAClB,sBADkB,EAElB,aAFkB,EAGlB,mBAHkB,EAIlB,gBAJkB,EAKlB,aALkB,EAMlB,gBANkB,EAOlB,iBAPkB,EAQlB,gBARkB,EASlB,yBATkB,CADG;AAYtB,uBAAqB,CAAE,kBAAF,CAZC;AAatB,6BAA2B,CAC1B,sBAD0B,EAE1B,yBAF0B,CAbL;AAiBtB,0BAAwB,CACvB,sBADuB,EAEvB,yBAFuB,CAjBF;AAqBtB,oBAAkB,CAAE,qBAAF;AArBI,CAAvB;AAwBA,eAAe,SAASC,cAAT,OAAqD;AAAA,MAA5B;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,GAA4B;AACnE,QAAM;AAAEC,IAAAA;AAAF,MAAoBP,SAAS,CAAIQ,MAAF,IAAc;AAClD,UAAM;AAAEC,MAAAA;AAAF,QAAiCD,MAAM,CAAEZ,gBAAF,CAA7C;AACA,WAAO;AACNW,MAAAA,aAAa,EAAEE,0BAA0B;AADnC,KAAP;AAGA,GALkC,CAAnC;AAMA,QAAM;AAAEC,IAAAA;AAAF,MAA8BT,WAAW,CAAEL,gBAAF,CAA/C;AAEA,QAAM;AAAEe,IAAAA,eAAF;AAAmBC,IAAAA;AAAnB,MAAoCV,MAAM,CAAER,sBAAF,CAAhD,CATmE,CAWnE;AACA;;AACAK,EAAAA,SAAS,CAAE,MAAM;AAChBW,IAAAA,uBAAuB,CAAE,EAAF,EAAM;AAC5BG,MAAAA,aAAa,EAAEV,cAAc,CAAE,iBAAF;AADD,KAAN,CAAvB;AAGAE,IAAAA,WAAW,CAACS,OAAZ,CAAuBC,KAAF,IAAa;AACjC,UAAKZ,cAAc,CAAEY,KAAK,CAACC,IAAR,CAAnB,EAAoC;AACnCN,QAAAA,uBAAuB,CAAEK,KAAK,CAACE,QAAR,EAAkB;AACxCJ,UAAAA,aAAa,EAAEV,cAAc,CAAEY,KAAK,CAACC,IAAR;AADW,SAAlB,CAAvB;AAGA;AACD,KAND;AAOA,GAXQ,EAWN,CAAEN,uBAAF,EAA2BL,WAA3B,CAXM,CAAT,CAbmE,CA0BnE;AACA;;AACA,SACC,8BACC,cAAC,eAAD;AACC,IAAA,MAAM,EAAGE,aADV;AAEC,IAAA,QAAQ,EAAGD,QAFZ;AAGC,IAAA,YAAY,EAAGM;AAHhB,IADD,EAMC;AAAK,IAAA,KAAK,EAAG;AAAEM,MAAAA,OAAO,EAAE;AAAX;AAAb,KACC,cAAC,UAAD,QACC,cAAC,SAAD,OADD,CADD,CAND,CADD;AAcA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tBlockList,\n\tBlockTools,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\n\nconst ALLOWED_BLOCKS = {\n\t'core/navigation': [\n\t\t'core/navigation-link',\n\t\t'core/search',\n\t\t'core/social-links',\n\t\t'core/page-list',\n\t\t'core/spacer',\n\t\t'core/home-link',\n\t\t'core/site-title',\n\t\t'core/site-logo',\n\t\t'core/navigation-submenu',\n\t],\n\t'core/social-links': [ 'core/social-link' ],\n\t'core/navigation-submenu': [\n\t\t'core/navigation-link',\n\t\t'core/navigation-submenu',\n\t],\n\t'core/navigation-link': [\n\t\t'core/navigation-link',\n\t\t'core/navigation-submenu',\n\t],\n\t'core/page-list': [ 'core/page-list-item' ],\n};\n\nexport default function NavigationMenu( { innerBlocks, onSelect } ) {\n\tconst { clientIdsTree } = useSelect( ( select ) => {\n\t\tconst { __unstableGetClientIdsTree } = select( blockEditorStore );\n\t\treturn {\n\t\t\tclientIdsTree: __unstableGetClientIdsTree(),\n\t\t};\n\t} );\n\tconst { updateBlockListSettings } = useDispatch( blockEditorStore );\n\n\tconst { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorPrivateApis );\n\n\t//TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList\n\t//Think through a better way of doing this, possible with adding allowed blocks to block library metadata\n\tuseEffect( () => {\n\t\tupdateBlockListSettings( '', {\n\t\t\tallowedBlocks: ALLOWED_BLOCKS[ 'core/navigation' ],\n\t\t} );\n\t\tinnerBlocks.forEach( ( block ) => {\n\t\t\tif ( ALLOWED_BLOCKS[ block.name ] ) {\n\t\t\t\tupdateBlockListSettings( block.clientId, {\n\t\t\t\t\tallowedBlocks: ALLOWED_BLOCKS[ block.name ],\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}, [ updateBlockListSettings, innerBlocks ] );\n\n\t// The hidden block is needed because it makes block edit side effects trigger.\n\t// For example a navigation page list load its items has an effect on edit to load its items.\n\treturn (\n\t\t<>\n\t\t\t<OffCanvasEditor\n\t\t\t\tblocks={ clientIdsTree }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tLeafMoreMenu={ LeafMoreMenu }\n\t\t\t/>\n\t\t\t<div style={ { display: 'none' } }>\n\t\t\t\t<BlockTools>\n\t\t\t\t\t<BlockList />\n\t\t\t\t</BlockTools>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSupportedStyles } from './hooks';
|
|
5
|
-
|
|
6
|
-
export function useHasColorPanel( name ) {
|
|
7
|
-
const supports = useSupportedStyles( name );
|
|
8
|
-
return (
|
|
9
|
-
supports.includes( 'color' ) ||
|
|
10
|
-
supports.includes( 'backgroundColor' ) ||
|
|
11
|
-
supports.includes( 'background' ) ||
|
|
12
|
-
supports.includes( 'linkColor' )
|
|
13
|
-
);
|
|
14
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { __ } from '@wordpress/i18n';
|
|
10
|
-
import {
|
|
11
|
-
__experimentalColorGradientControl as ColorGradientControl,
|
|
12
|
-
privateApis as blockEditorPrivateApis,
|
|
13
|
-
} from '@wordpress/block-editor';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
import ScreenHeader from './header';
|
|
19
|
-
import {
|
|
20
|
-
useSupportedStyles,
|
|
21
|
-
useColorsPerOrigin,
|
|
22
|
-
useGradientsPerOrigin,
|
|
23
|
-
} from './hooks';
|
|
24
|
-
import { unlock } from '../../private-apis';
|
|
25
|
-
|
|
26
|
-
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
27
|
-
|
|
28
|
-
function ScreenBackgroundColor( { name, variation = '' } ) {
|
|
29
|
-
const prefix = variation ? `variations.${ variation }.` : '';
|
|
30
|
-
const supports = useSupportedStyles( name );
|
|
31
|
-
const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
|
|
32
|
-
const [ areCustomGradientsEnabled ] = useGlobalSetting(
|
|
33
|
-
'color.customGradient',
|
|
34
|
-
name
|
|
35
|
-
);
|
|
36
|
-
const colorsPerOrigin = useColorsPerOrigin( name );
|
|
37
|
-
const gradientsPerOrigin = useGradientsPerOrigin( name );
|
|
38
|
-
|
|
39
|
-
const [ isBackgroundEnabled ] = useGlobalSetting(
|
|
40
|
-
'color.background',
|
|
41
|
-
name
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
const hasBackgroundColor =
|
|
45
|
-
supports.includes( 'backgroundColor' ) &&
|
|
46
|
-
isBackgroundEnabled &&
|
|
47
|
-
( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
|
|
48
|
-
const hasGradientColor =
|
|
49
|
-
supports.includes( 'background' ) &&
|
|
50
|
-
( gradientsPerOrigin.length > 0 || areCustomGradientsEnabled );
|
|
51
|
-
const [ backgroundColor, setBackgroundColor ] = useGlobalStyle(
|
|
52
|
-
prefix + 'color.background',
|
|
53
|
-
name
|
|
54
|
-
);
|
|
55
|
-
const [ userBackgroundColor ] = useGlobalStyle(
|
|
56
|
-
prefix + 'color.background',
|
|
57
|
-
name,
|
|
58
|
-
'user'
|
|
59
|
-
);
|
|
60
|
-
const [ gradient, setGradient ] = useGlobalStyle(
|
|
61
|
-
prefix + 'color.gradient',
|
|
62
|
-
name
|
|
63
|
-
);
|
|
64
|
-
const [ userGradient ] = useGlobalStyle(
|
|
65
|
-
prefix + 'color.gradient',
|
|
66
|
-
name,
|
|
67
|
-
'user'
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
if ( ! hasBackgroundColor && ! hasGradientColor ) {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
let backgroundSettings = {};
|
|
75
|
-
if ( hasBackgroundColor ) {
|
|
76
|
-
backgroundSettings = {
|
|
77
|
-
colorValue: backgroundColor,
|
|
78
|
-
onColorChange: setBackgroundColor,
|
|
79
|
-
};
|
|
80
|
-
if ( backgroundColor ) {
|
|
81
|
-
backgroundSettings.clearable =
|
|
82
|
-
backgroundColor === userBackgroundColor;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
let gradientSettings = {};
|
|
87
|
-
if ( hasGradientColor ) {
|
|
88
|
-
gradientSettings = {
|
|
89
|
-
gradientValue: gradient,
|
|
90
|
-
onGradientChange: setGradient,
|
|
91
|
-
};
|
|
92
|
-
if ( gradient ) {
|
|
93
|
-
gradientSettings.clearable = gradient === userGradient;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const controlProps = {
|
|
98
|
-
...backgroundSettings,
|
|
99
|
-
...gradientSettings,
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
return (
|
|
103
|
-
<>
|
|
104
|
-
<ScreenHeader
|
|
105
|
-
title={ __( 'Background' ) }
|
|
106
|
-
description={ __(
|
|
107
|
-
'Set a background color or gradient for the whole site.'
|
|
108
|
-
) }
|
|
109
|
-
/>
|
|
110
|
-
<ColorGradientControl
|
|
111
|
-
className={ classnames(
|
|
112
|
-
'edit-site-screen-background-color__control',
|
|
113
|
-
{
|
|
114
|
-
'has-no-tabs':
|
|
115
|
-
! hasBackgroundColor || ! hasGradientColor,
|
|
116
|
-
}
|
|
117
|
-
) }
|
|
118
|
-
colors={ colorsPerOrigin }
|
|
119
|
-
gradients={ gradientsPerOrigin }
|
|
120
|
-
disableCustomColors={ ! areCustomSolidsEnabled }
|
|
121
|
-
disableCustomGradients={ ! areCustomGradientsEnabled }
|
|
122
|
-
showTitle={ false }
|
|
123
|
-
enableAlpha
|
|
124
|
-
__experimentalIsRenderedInSidebar
|
|
125
|
-
headingLevel={ 3 }
|
|
126
|
-
{ ...controlProps }
|
|
127
|
-
/>
|
|
128
|
-
</>
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export default ScreenBackgroundColor;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
6
|
-
__experimentalColorGradientControl as ColorGradientControl,
|
|
7
|
-
privateApis as blockEditorPrivateApis,
|
|
8
|
-
} from '@wordpress/block-editor';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import ScreenHeader from './header';
|
|
14
|
-
import { useSupportedStyles, useColorsPerOrigin } from './hooks';
|
|
15
|
-
import { unlock } from '../../private-apis';
|
|
16
|
-
|
|
17
|
-
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
18
|
-
|
|
19
|
-
function ScreenButtonColor( { name, variation = '' } ) {
|
|
20
|
-
const prefix = variation ? `variations.${ variation }.` : '';
|
|
21
|
-
const supports = useSupportedStyles( name );
|
|
22
|
-
const colorsPerOrigin = useColorsPerOrigin( name );
|
|
23
|
-
const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
|
|
24
|
-
const [ isBackgroundEnabled ] = useGlobalSetting(
|
|
25
|
-
'color.background',
|
|
26
|
-
name
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const hasButtonColor =
|
|
30
|
-
supports.includes( 'buttonColor' ) &&
|
|
31
|
-
isBackgroundEnabled &&
|
|
32
|
-
( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
|
|
33
|
-
|
|
34
|
-
const [ buttonTextColor, setButtonTextColor ] = useGlobalStyle(
|
|
35
|
-
prefix + 'elements.button.color.text',
|
|
36
|
-
name
|
|
37
|
-
);
|
|
38
|
-
const [ userButtonTextColor ] = useGlobalStyle(
|
|
39
|
-
'elements.button.color.text',
|
|
40
|
-
name,
|
|
41
|
-
'user'
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
const [ buttonBgColor, setButtonBgColor ] = useGlobalStyle(
|
|
45
|
-
'elements.button.color.background',
|
|
46
|
-
name
|
|
47
|
-
);
|
|
48
|
-
const [ userButtonBgColor ] = useGlobalStyle(
|
|
49
|
-
'elements.button.color.background',
|
|
50
|
-
name,
|
|
51
|
-
'user'
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
if ( ! hasButtonColor ) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<>
|
|
60
|
-
<ScreenHeader
|
|
61
|
-
title={ __( 'Buttons' ) }
|
|
62
|
-
description={ __(
|
|
63
|
-
'Set the default colors used for buttons across the site.'
|
|
64
|
-
) }
|
|
65
|
-
/>
|
|
66
|
-
|
|
67
|
-
<h3 className="edit-site-global-styles-section-title">
|
|
68
|
-
{ __( 'Text color' ) }
|
|
69
|
-
</h3>
|
|
70
|
-
|
|
71
|
-
<ColorGradientControl
|
|
72
|
-
className="edit-site-screen-button-color__control"
|
|
73
|
-
colors={ colorsPerOrigin }
|
|
74
|
-
disableCustomColors={ ! areCustomSolidsEnabled }
|
|
75
|
-
showTitle={ false }
|
|
76
|
-
enableAlpha
|
|
77
|
-
__experimentalIsRenderedInSidebar
|
|
78
|
-
colorValue={ buttonTextColor }
|
|
79
|
-
onColorChange={ setButtonTextColor }
|
|
80
|
-
clearable={ buttonTextColor === userButtonTextColor }
|
|
81
|
-
headingLevel={ 4 }
|
|
82
|
-
/>
|
|
83
|
-
|
|
84
|
-
<h3 className="edit-site-global-styles-section-title">
|
|
85
|
-
{ __( 'Background color' ) }
|
|
86
|
-
</h3>
|
|
87
|
-
|
|
88
|
-
<ColorGradientControl
|
|
89
|
-
className="edit-site-screen-button-color__control"
|
|
90
|
-
colors={ colorsPerOrigin }
|
|
91
|
-
disableCustomColors={ ! areCustomSolidsEnabled }
|
|
92
|
-
showTitle={ false }
|
|
93
|
-
enableAlpha
|
|
94
|
-
__experimentalIsRenderedInSidebar
|
|
95
|
-
colorValue={ buttonBgColor }
|
|
96
|
-
onColorChange={ setButtonBgColor }
|
|
97
|
-
clearable={ buttonBgColor === userButtonBgColor }
|
|
98
|
-
headingLevel={ 4 }
|
|
99
|
-
/>
|
|
100
|
-
</>
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export default ScreenButtonColor;
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { sprintf, __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
6
|
-
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
7
|
-
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
8
|
-
} from '@wordpress/components';
|
|
9
|
-
import {
|
|
10
|
-
__experimentalColorGradientControl as ColorGradientControl,
|
|
11
|
-
privateApis as blockEditorPrivateApis,
|
|
12
|
-
} from '@wordpress/block-editor';
|
|
13
|
-
import { useState } from '@wordpress/element';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
import ScreenHeader from './header';
|
|
19
|
-
import {
|
|
20
|
-
useSupportedStyles,
|
|
21
|
-
useColorsPerOrigin,
|
|
22
|
-
useGradientsPerOrigin,
|
|
23
|
-
} from './hooks';
|
|
24
|
-
import { unlock } from '../../private-apis';
|
|
25
|
-
|
|
26
|
-
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
27
|
-
|
|
28
|
-
function ScreenHeadingColor( { name, variation = '' } ) {
|
|
29
|
-
const prefix = variation ? `variations.${ variation }.` : '';
|
|
30
|
-
const [ selectedLevel, setCurrentTab ] = useState( 'heading' );
|
|
31
|
-
const supports = useSupportedStyles( name );
|
|
32
|
-
const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
|
|
33
|
-
const [ areCustomGradientsEnabled ] = useGlobalSetting(
|
|
34
|
-
'color.customGradient',
|
|
35
|
-
name
|
|
36
|
-
);
|
|
37
|
-
const [ isTextEnabled ] = useGlobalSetting( 'color.text', name );
|
|
38
|
-
const [ isBackgroundEnabled ] = useGlobalSetting(
|
|
39
|
-
'color.background',
|
|
40
|
-
name
|
|
41
|
-
);
|
|
42
|
-
const colorsPerOrigin = useColorsPerOrigin( name );
|
|
43
|
-
const gradientsPerOrigin = useGradientsPerOrigin( name );
|
|
44
|
-
|
|
45
|
-
const hasTextColor =
|
|
46
|
-
supports.includes( 'color' ) &&
|
|
47
|
-
isTextEnabled &&
|
|
48
|
-
( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
|
|
49
|
-
|
|
50
|
-
const hasBackgroundColor =
|
|
51
|
-
supports.includes( 'backgroundColor' ) &&
|
|
52
|
-
isBackgroundEnabled &&
|
|
53
|
-
( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
|
|
54
|
-
const hasGradientColor =
|
|
55
|
-
supports.includes( 'background' ) &&
|
|
56
|
-
( gradientsPerOrigin.length > 0 || areCustomGradientsEnabled );
|
|
57
|
-
|
|
58
|
-
const [ color, setColor ] = useGlobalStyle(
|
|
59
|
-
prefix + 'elements.' + selectedLevel + '.color.text',
|
|
60
|
-
name
|
|
61
|
-
);
|
|
62
|
-
const [ userColor ] = useGlobalStyle(
|
|
63
|
-
prefix + 'elements.' + selectedLevel + '.color.text',
|
|
64
|
-
name,
|
|
65
|
-
'user'
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
const [ backgroundColor, setBackgroundColor ] = useGlobalStyle(
|
|
69
|
-
prefix + 'elements.' + selectedLevel + '.color.background',
|
|
70
|
-
name
|
|
71
|
-
);
|
|
72
|
-
const [ userBackgroundColor ] = useGlobalStyle(
|
|
73
|
-
prefix + 'elements.' + selectedLevel + '.color.background',
|
|
74
|
-
name,
|
|
75
|
-
'user'
|
|
76
|
-
);
|
|
77
|
-
const [ gradient, setGradient ] = useGlobalStyle(
|
|
78
|
-
prefix + 'elements.' + selectedLevel + '.color.gradient',
|
|
79
|
-
name
|
|
80
|
-
);
|
|
81
|
-
const [ userGradient ] = useGlobalStyle(
|
|
82
|
-
prefix + 'elements.' + selectedLevel + '.color.gradient',
|
|
83
|
-
name,
|
|
84
|
-
'user'
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
if ( ! hasTextColor && ! hasBackgroundColor && ! hasGradientColor ) {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
let backgroundSettings = {};
|
|
92
|
-
if ( hasBackgroundColor ) {
|
|
93
|
-
backgroundSettings = {
|
|
94
|
-
colorValue: backgroundColor,
|
|
95
|
-
onColorChange: setBackgroundColor,
|
|
96
|
-
};
|
|
97
|
-
if ( backgroundColor ) {
|
|
98
|
-
backgroundSettings.clearable =
|
|
99
|
-
backgroundColor === userBackgroundColor;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
let gradientSettings = {};
|
|
104
|
-
if ( hasGradientColor ) {
|
|
105
|
-
gradientSettings = {
|
|
106
|
-
gradientValue: gradient,
|
|
107
|
-
onGradientChange: setGradient,
|
|
108
|
-
};
|
|
109
|
-
if ( gradient ) {
|
|
110
|
-
gradientSettings.clearable = gradient === userGradient;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const controlProps = {
|
|
115
|
-
...backgroundSettings,
|
|
116
|
-
...gradientSettings,
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
return (
|
|
120
|
-
<>
|
|
121
|
-
<ScreenHeader
|
|
122
|
-
title={ __( 'Headings' ) }
|
|
123
|
-
description={ __(
|
|
124
|
-
'Set the default color used for headings across the site.'
|
|
125
|
-
) }
|
|
126
|
-
/>
|
|
127
|
-
<div className="edit-site-global-styles-screen-heading-color">
|
|
128
|
-
<h3>{ __( 'Select heading level' ) }</h3>
|
|
129
|
-
|
|
130
|
-
<ToggleGroupControl
|
|
131
|
-
__nextHasNoMarginBottom
|
|
132
|
-
label={ __( 'Select heading level' ) }
|
|
133
|
-
hideLabelFromVision={ true }
|
|
134
|
-
value={ selectedLevel }
|
|
135
|
-
onChange={ setCurrentTab }
|
|
136
|
-
isBlock
|
|
137
|
-
>
|
|
138
|
-
<ToggleGroupControlOption
|
|
139
|
-
value="heading"
|
|
140
|
-
/* translators: 'All' refers to selecting all heading levels
|
|
141
|
-
and applying the same style to h1-h6. */
|
|
142
|
-
label={ __( 'All' ) }
|
|
143
|
-
/>
|
|
144
|
-
<ToggleGroupControlOption value="h1" label={ __( 'H1' ) } />
|
|
145
|
-
<ToggleGroupControlOption value="h2" label={ __( 'H2' ) } />
|
|
146
|
-
<ToggleGroupControlOption value="h3" label={ __( 'H3' ) } />
|
|
147
|
-
<ToggleGroupControlOption value="h4" label={ __( 'H4' ) } />
|
|
148
|
-
<ToggleGroupControlOption value="h5" label={ __( 'H5' ) } />
|
|
149
|
-
<ToggleGroupControlOption value="h6" label={ __( 'H6' ) } />
|
|
150
|
-
</ToggleGroupControl>
|
|
151
|
-
</div>
|
|
152
|
-
{ hasTextColor && (
|
|
153
|
-
<div className="edit-site-global-styles-screen-heading-color">
|
|
154
|
-
<h3>
|
|
155
|
-
{ selectedLevel === 'heading'
|
|
156
|
-
? __( 'Text color for all heading levels' )
|
|
157
|
-
: sprintf(
|
|
158
|
-
/* translators: %s: heading level (h1-h6) */
|
|
159
|
-
__( 'Text color for %s' ),
|
|
160
|
-
selectedLevel.toUpperCase()
|
|
161
|
-
) }
|
|
162
|
-
</h3>
|
|
163
|
-
<ColorGradientControl
|
|
164
|
-
className="edit-site-screen-heading-text-color__control"
|
|
165
|
-
colors={ colorsPerOrigin }
|
|
166
|
-
disableCustomColors={ ! areCustomSolidsEnabled }
|
|
167
|
-
showTitle={ false }
|
|
168
|
-
enableAlpha
|
|
169
|
-
__experimentalIsRenderedInSidebar
|
|
170
|
-
colorValue={ color }
|
|
171
|
-
onColorChange={ setColor }
|
|
172
|
-
clearable={ color === userColor }
|
|
173
|
-
headingLevel={ 4 }
|
|
174
|
-
/>
|
|
175
|
-
</div>
|
|
176
|
-
) }
|
|
177
|
-
{ hasBackgroundColor && (
|
|
178
|
-
<div className="edit-site-global-styles-screen-heading-color">
|
|
179
|
-
<h3>
|
|
180
|
-
{ selectedLevel === 'heading'
|
|
181
|
-
? __( 'Background color for all heading levels' )
|
|
182
|
-
: sprintf(
|
|
183
|
-
/* translators: %s: heading level (h1-h6) */
|
|
184
|
-
__( 'Background color for %s' ),
|
|
185
|
-
selectedLevel.toUpperCase()
|
|
186
|
-
) }
|
|
187
|
-
</h3>
|
|
188
|
-
<ColorGradientControl
|
|
189
|
-
className="edit-site-screen-heading-background-color__control"
|
|
190
|
-
colors={ colorsPerOrigin }
|
|
191
|
-
gradients={ gradientsPerOrigin }
|
|
192
|
-
disableCustomColors={ ! areCustomSolidsEnabled }
|
|
193
|
-
disableCustomGradients={ ! areCustomGradientsEnabled }
|
|
194
|
-
showTitle={ false }
|
|
195
|
-
enableAlpha
|
|
196
|
-
__experimentalIsRenderedInSidebar
|
|
197
|
-
headingLevel={ 4 }
|
|
198
|
-
{ ...controlProps }
|
|
199
|
-
/>
|
|
200
|
-
</div>
|
|
201
|
-
) }
|
|
202
|
-
</>
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export default ScreenHeadingColor;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
6
|
-
__experimentalColorGradientControl as ColorGradientControl,
|
|
7
|
-
privateApis as blockEditorPrivateApis,
|
|
8
|
-
} from '@wordpress/block-editor';
|
|
9
|
-
import { TabPanel } from '@wordpress/components';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import ScreenHeader from './header';
|
|
15
|
-
import { useSupportedStyles, useColorsPerOrigin } from './hooks';
|
|
16
|
-
import { unlock } from '../../private-apis';
|
|
17
|
-
|
|
18
|
-
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
19
|
-
|
|
20
|
-
function ScreenLinkColor( { name, variation = '' } ) {
|
|
21
|
-
const prefix = variation ? `variations.${ variation }.` : '';
|
|
22
|
-
const supports = useSupportedStyles( name );
|
|
23
|
-
const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
|
|
24
|
-
const colorsPerOrigin = useColorsPerOrigin( name );
|
|
25
|
-
const [ isLinkEnabled ] = useGlobalSetting( 'color.link', name );
|
|
26
|
-
|
|
27
|
-
const hasLinkColor =
|
|
28
|
-
supports.includes( 'linkColor' ) &&
|
|
29
|
-
isLinkEnabled &&
|
|
30
|
-
( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
|
|
31
|
-
|
|
32
|
-
const pseudoStates = {
|
|
33
|
-
default: {
|
|
34
|
-
label: __( 'Default' ),
|
|
35
|
-
value: useGlobalStyle(
|
|
36
|
-
prefix + 'elements.link.color.text',
|
|
37
|
-
name
|
|
38
|
-
)[ 0 ],
|
|
39
|
-
handler: useGlobalStyle(
|
|
40
|
-
prefix + 'elements.link.color.text',
|
|
41
|
-
name
|
|
42
|
-
)[ 1 ],
|
|
43
|
-
userValue: useGlobalStyle(
|
|
44
|
-
prefix + 'elements.link.color.text',
|
|
45
|
-
name,
|
|
46
|
-
'user'
|
|
47
|
-
)[ 0 ],
|
|
48
|
-
},
|
|
49
|
-
hover: {
|
|
50
|
-
label: __( 'Hover' ),
|
|
51
|
-
value: useGlobalStyle(
|
|
52
|
-
prefix + 'elements.link.:hover.color.text',
|
|
53
|
-
name
|
|
54
|
-
)[ 0 ],
|
|
55
|
-
handler: useGlobalStyle(
|
|
56
|
-
prefix + 'elements.link.:hover.color.text',
|
|
57
|
-
name
|
|
58
|
-
)[ 1 ],
|
|
59
|
-
userValue: useGlobalStyle(
|
|
60
|
-
prefix + 'elements.link.:hover.color.text',
|
|
61
|
-
name,
|
|
62
|
-
'user'
|
|
63
|
-
)[ 0 ],
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
if ( ! hasLinkColor ) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const tabs = Object.entries( pseudoStates ).map(
|
|
72
|
-
( [ selector, config ] ) => {
|
|
73
|
-
return {
|
|
74
|
-
name: selector,
|
|
75
|
-
title: config.label,
|
|
76
|
-
className: `color-text-${ selector }`,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<>
|
|
83
|
-
<ScreenHeader
|
|
84
|
-
title={ __( 'Links' ) }
|
|
85
|
-
description={ __(
|
|
86
|
-
'Set the colors used for links across the site.'
|
|
87
|
-
) }
|
|
88
|
-
/>
|
|
89
|
-
|
|
90
|
-
<TabPanel tabs={ tabs }>
|
|
91
|
-
{ ( tab ) => {
|
|
92
|
-
const pseudoSelectorConfig =
|
|
93
|
-
pseudoStates[ tab.name ] ?? null;
|
|
94
|
-
|
|
95
|
-
if ( ! pseudoSelectorConfig ) {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return (
|
|
100
|
-
<>
|
|
101
|
-
<ColorGradientControl
|
|
102
|
-
className="edit-site-screen-link-color__control"
|
|
103
|
-
colors={ colorsPerOrigin }
|
|
104
|
-
disableCustomColors={ ! areCustomSolidsEnabled }
|
|
105
|
-
showTitle={ false }
|
|
106
|
-
enableAlpha
|
|
107
|
-
__experimentalIsRenderedInSidebar
|
|
108
|
-
colorValue={ pseudoSelectorConfig.value }
|
|
109
|
-
onColorChange={ pseudoSelectorConfig.handler }
|
|
110
|
-
clearable={
|
|
111
|
-
pseudoSelectorConfig.value ===
|
|
112
|
-
pseudoSelectorConfig.userValue
|
|
113
|
-
}
|
|
114
|
-
headingLevel={ 3 }
|
|
115
|
-
/>
|
|
116
|
-
</>
|
|
117
|
-
);
|
|
118
|
-
} }
|
|
119
|
-
</TabPanel>
|
|
120
|
-
</>
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export default ScreenLinkColor;
|