@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
|
@@ -27,8 +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
|
-
import { useHasColorPanel } from './color-utils';
|
|
32
30
|
import { useHasFilterPanel } from './filter-utils';
|
|
33
31
|
import { useHasVariationsPanel } from './variations-panel';
|
|
34
32
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
@@ -40,6 +38,8 @@ import { unlock } from '../../private-apis';
|
|
|
40
38
|
const {
|
|
41
39
|
useHasDimensionsPanel,
|
|
42
40
|
useHasTypographyPanel,
|
|
41
|
+
useHasBorderPanel,
|
|
42
|
+
useHasColorPanel,
|
|
43
43
|
useGlobalSetting,
|
|
44
44
|
useSettingsForBlockElement,
|
|
45
45
|
} = unlock( blockEditorPrivateApis );
|
|
@@ -48,8 +48,8 @@ function ContextMenu( { name, parentMenu = '' } ) {
|
|
|
48
48
|
const [ rawSettings ] = useGlobalSetting( '', name );
|
|
49
49
|
const settings = useSettingsForBlockElement( rawSettings, name );
|
|
50
50
|
const hasTypographyPanel = useHasTypographyPanel( settings );
|
|
51
|
-
const hasColorPanel = useHasColorPanel(
|
|
52
|
-
const hasBorderPanel = useHasBorderPanel(
|
|
51
|
+
const hasColorPanel = useHasColorPanel( settings );
|
|
52
|
+
const hasBorderPanel = useHasBorderPanel( settings );
|
|
53
53
|
const hasEffectsPanel = useHasShadowControl( name );
|
|
54
54
|
const hasFilterPanel = useHasFilterPanel( name );
|
|
55
55
|
const hasDimensionsPanel = useHasDimensionsPanel( settings );
|
|
@@ -7,8 +7,6 @@ import a11yPlugin from 'colord/plugins/a11y';
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
import { _x } from '@wordpress/i18n';
|
|
11
|
-
import { useMemo } from '@wordpress/element';
|
|
12
10
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
13
11
|
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
14
12
|
|
|
@@ -23,105 +21,6 @@ const { useGlobalSetting } = unlock( blockEditorPrivateApis );
|
|
|
23
21
|
// Enable colord's a11y plugin.
|
|
24
22
|
extend( [ a11yPlugin ] );
|
|
25
23
|
|
|
26
|
-
export function useColorsPerOrigin( name ) {
|
|
27
|
-
const [ customColors ] = useGlobalSetting( 'color.palette.custom', name );
|
|
28
|
-
const [ themeColors ] = useGlobalSetting( 'color.palette.theme', name );
|
|
29
|
-
const [ defaultColors ] = useGlobalSetting( 'color.palette.default', name );
|
|
30
|
-
const [ shouldDisplayDefaultColors ] = useGlobalSetting(
|
|
31
|
-
'color.defaultPalette'
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
return useMemo( () => {
|
|
35
|
-
const result = [];
|
|
36
|
-
if ( themeColors && themeColors.length ) {
|
|
37
|
-
result.push( {
|
|
38
|
-
name: _x(
|
|
39
|
-
'Theme',
|
|
40
|
-
'Indicates this palette comes from the theme.'
|
|
41
|
-
),
|
|
42
|
-
colors: themeColors,
|
|
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 ] );
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function useGradientsPerOrigin( name ) {
|
|
72
|
-
const [ customGradients ] = useGlobalSetting(
|
|
73
|
-
'color.gradients.custom',
|
|
74
|
-
name
|
|
75
|
-
);
|
|
76
|
-
const [ themeGradients ] = useGlobalSetting(
|
|
77
|
-
'color.gradients.theme',
|
|
78
|
-
name
|
|
79
|
-
);
|
|
80
|
-
const [ defaultGradients ] = useGlobalSetting(
|
|
81
|
-
'color.gradients.default',
|
|
82
|
-
name
|
|
83
|
-
);
|
|
84
|
-
const [ shouldDisplayDefaultGradients ] = useGlobalSetting(
|
|
85
|
-
'color.defaultGradients'
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
return useMemo( () => {
|
|
89
|
-
const result = [];
|
|
90
|
-
if ( themeGradients && themeGradients.length ) {
|
|
91
|
-
result.push( {
|
|
92
|
-
name: _x(
|
|
93
|
-
'Theme',
|
|
94
|
-
'Indicates this palette comes from the theme.'
|
|
95
|
-
),
|
|
96
|
-
gradients: themeGradients,
|
|
97
|
-
} );
|
|
98
|
-
}
|
|
99
|
-
if (
|
|
100
|
-
shouldDisplayDefaultGradients &&
|
|
101
|
-
defaultGradients &&
|
|
102
|
-
defaultGradients.length
|
|
103
|
-
) {
|
|
104
|
-
result.push( {
|
|
105
|
-
name: _x(
|
|
106
|
-
'Default',
|
|
107
|
-
'Indicates this palette comes from WordPress.'
|
|
108
|
-
),
|
|
109
|
-
gradients: defaultGradients,
|
|
110
|
-
} );
|
|
111
|
-
}
|
|
112
|
-
if ( customGradients && customGradients.length ) {
|
|
113
|
-
result.push( {
|
|
114
|
-
name: _x(
|
|
115
|
-
'Custom',
|
|
116
|
-
'Indicates this palette is created by the user.'
|
|
117
|
-
),
|
|
118
|
-
gradients: customGradients,
|
|
119
|
-
} );
|
|
120
|
-
}
|
|
121
|
-
return result;
|
|
122
|
-
}, [ customGradients, themeGradients, defaultGradients ] );
|
|
123
|
-
}
|
|
124
|
-
|
|
125
24
|
export function useColorRandomizer( name ) {
|
|
126
25
|
const [ themeColors, setThemeColors ] = useGlobalSetting(
|
|
127
26
|
'color.palette.theme',
|
|
@@ -117,7 +117,6 @@ const StylesPreview = ( { label, isFocused, withHoverView } ) => {
|
|
|
117
117
|
{ isReady && (
|
|
118
118
|
<Iframe
|
|
119
119
|
className="edit-site-global-styles-preview__iframe"
|
|
120
|
-
head={ <EditorStyles styles={ editorStyles } /> }
|
|
121
120
|
style={ {
|
|
122
121
|
height: normalizedHeight * ratio,
|
|
123
122
|
} }
|
|
@@ -125,6 +124,7 @@ const StylesPreview = ( { label, isFocused, withHoverView } ) => {
|
|
|
125
124
|
onMouseLeave={ () => setIsHovered( false ) }
|
|
126
125
|
tabIndex={ -1 }
|
|
127
126
|
>
|
|
127
|
+
<EditorStyles styles={ editorStyles } />
|
|
128
128
|
<motion.div
|
|
129
129
|
style={ {
|
|
130
130
|
height: normalizedHeight * ratio,
|
|
@@ -20,8 +20,6 @@ import { speak } from '@wordpress/a11y';
|
|
|
20
20
|
/**
|
|
21
21
|
* Internal dependencies
|
|
22
22
|
*/
|
|
23
|
-
import { useHasBorderPanel } from './border-panel';
|
|
24
|
-
import { useHasColorPanel } from './color-utils';
|
|
25
23
|
import { useHasVariationsPanel } from './variations-panel';
|
|
26
24
|
import ScreenHeader from './header';
|
|
27
25
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
@@ -30,8 +28,10 @@ import { unlock } from '../../private-apis';
|
|
|
30
28
|
const {
|
|
31
29
|
useHasDimensionsPanel,
|
|
32
30
|
useHasTypographyPanel,
|
|
31
|
+
useHasBorderPanel,
|
|
33
32
|
useGlobalSetting,
|
|
34
33
|
useSettingsForBlockElement,
|
|
34
|
+
useHasColorPanel,
|
|
35
35
|
} = unlock( blockEditorPrivateApis );
|
|
36
36
|
|
|
37
37
|
function useSortedBlockTypes() {
|
|
@@ -61,8 +61,8 @@ function BlockMenuItem( { block } ) {
|
|
|
61
61
|
const [ rawSettings ] = useGlobalSetting( '', block.name );
|
|
62
62
|
const settings = useSettingsForBlockElement( rawSettings, block.name );
|
|
63
63
|
const hasTypographyPanel = useHasTypographyPanel( settings );
|
|
64
|
-
const hasColorPanel = useHasColorPanel(
|
|
65
|
-
const hasBorderPanel = useHasBorderPanel(
|
|
64
|
+
const hasColorPanel = useHasColorPanel( settings );
|
|
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
|
<>
|
|
@@ -2,14 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
6
|
-
__experimentalItemGroup as ItemGroup,
|
|
7
|
-
__experimentalHStack as HStack,
|
|
8
|
-
__experimentalVStack as VStack,
|
|
9
|
-
__experimentalZStack as ZStack,
|
|
10
|
-
FlexItem,
|
|
11
|
-
ColorIndicator,
|
|
12
|
-
} from '@wordpress/components';
|
|
5
|
+
import { __experimentalVStack as VStack } from '@wordpress/components';
|
|
13
6
|
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
14
7
|
|
|
15
8
|
/**
|
|
@@ -17,205 +10,32 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
|
17
10
|
*/
|
|
18
11
|
import ScreenHeader from './header';
|
|
19
12
|
import Palette from './palette';
|
|
20
|
-
import { NavigationButtonAsItem } from './navigation-button';
|
|
21
|
-
import { useSupportedStyles } from './hooks';
|
|
22
|
-
import Subtitle from './subtitle';
|
|
23
|
-
import ColorIndicatorWrapper from './color-indicator-wrapper';
|
|
24
13
|
import BlockPreviewPanel from './block-preview-panel';
|
|
25
14
|
import { getVariationClassName } from './utils';
|
|
26
15
|
import { unlock } from '../../private-apis';
|
|
27
16
|
|
|
28
|
-
const {
|
|
17
|
+
const {
|
|
18
|
+
useGlobalStyle,
|
|
19
|
+
useGlobalSetting,
|
|
20
|
+
useSettingsForBlockElement,
|
|
21
|
+
ColorPanel: StylesColorPanel,
|
|
22
|
+
} = unlock( blockEditorPrivateApis );
|
|
29
23
|
|
|
30
|
-
function
|
|
31
|
-
const
|
|
32
|
-
const urlPrefix = variation ? `/variations/${ variation }` : '';
|
|
33
|
-
const supports = useSupportedStyles( name );
|
|
34
|
-
const hasSupport =
|
|
35
|
-
supports.includes( 'backgroundColor' ) ||
|
|
36
|
-
supports.includes( 'background' );
|
|
37
|
-
const [ backgroundColor ] = useGlobalStyle(
|
|
38
|
-
prefix + 'color.background',
|
|
39
|
-
name
|
|
40
|
-
);
|
|
41
|
-
const [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient', name );
|
|
42
|
-
|
|
43
|
-
if ( ! hasSupport ) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<NavigationButtonAsItem
|
|
49
|
-
path={ parentMenu + urlPrefix + '/colors/background' }
|
|
50
|
-
aria-label={ __( 'Colors background styles' ) }
|
|
51
|
-
>
|
|
52
|
-
<HStack justify="flex-start">
|
|
53
|
-
<ColorIndicatorWrapper expanded={ false }>
|
|
54
|
-
<ColorIndicator
|
|
55
|
-
colorValue={ gradientValue ?? backgroundColor }
|
|
56
|
-
data-testid="background-color-indicator"
|
|
57
|
-
/>
|
|
58
|
-
</ColorIndicatorWrapper>
|
|
59
|
-
<FlexItem className="edit-site-global-styles__color-label">
|
|
60
|
-
{ __( 'Background' ) }
|
|
61
|
-
</FlexItem>
|
|
62
|
-
</HStack>
|
|
63
|
-
</NavigationButtonAsItem>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function TextColorItem( { name, parentMenu, variation = '' } ) {
|
|
68
|
-
const prefix = variation ? `variations.${ variation }.` : '';
|
|
69
|
-
const urlPrefix = variation ? `/variations/${ variation }` : '';
|
|
70
|
-
const supports = useSupportedStyles( name );
|
|
71
|
-
const hasSupport = supports.includes( 'color' );
|
|
72
|
-
const [ color ] = useGlobalStyle( prefix + 'color.text', name );
|
|
73
|
-
|
|
74
|
-
if ( ! hasSupport ) {
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<NavigationButtonAsItem
|
|
80
|
-
path={ parentMenu + urlPrefix + '/colors/text' }
|
|
81
|
-
aria-label={ __( 'Colors text styles' ) }
|
|
82
|
-
>
|
|
83
|
-
<HStack justify="flex-start">
|
|
84
|
-
<ColorIndicatorWrapper expanded={ false }>
|
|
85
|
-
<ColorIndicator
|
|
86
|
-
colorValue={ color }
|
|
87
|
-
data-testid="text-color-indicator"
|
|
88
|
-
/>
|
|
89
|
-
</ColorIndicatorWrapper>
|
|
90
|
-
<FlexItem className="edit-site-global-styles__color-label">
|
|
91
|
-
{ __( 'Text' ) }
|
|
92
|
-
</FlexItem>
|
|
93
|
-
</HStack>
|
|
94
|
-
</NavigationButtonAsItem>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function LinkColorItem( { name, parentMenu, variation = '' } ) {
|
|
99
|
-
const prefix = variation ? `variations.${ variation }.` : '';
|
|
100
|
-
const urlPrefix = variation ? `/variations/${ variation }` : '';
|
|
101
|
-
const supports = useSupportedStyles( name );
|
|
102
|
-
const hasSupport = supports.includes( 'linkColor' );
|
|
103
|
-
const [ color ] = useGlobalStyle(
|
|
104
|
-
prefix + 'elements.link.color.text',
|
|
105
|
-
name
|
|
106
|
-
);
|
|
107
|
-
const [ colorHover ] = useGlobalStyle(
|
|
108
|
-
prefix + 'elements.link.:hover.color.text',
|
|
109
|
-
name
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
if ( ! hasSupport ) {
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<NavigationButtonAsItem
|
|
118
|
-
path={ parentMenu + urlPrefix + '/colors/link' }
|
|
119
|
-
aria-label={ __( 'Colors link styles' ) }
|
|
120
|
-
>
|
|
121
|
-
<HStack justify="flex-start">
|
|
122
|
-
<ZStack isLayered={ false } offset={ -8 }>
|
|
123
|
-
<ColorIndicatorWrapper expanded={ false }>
|
|
124
|
-
<ColorIndicator colorValue={ color } />
|
|
125
|
-
</ColorIndicatorWrapper>
|
|
126
|
-
<ColorIndicatorWrapper expanded={ false }>
|
|
127
|
-
<ColorIndicator colorValue={ colorHover } />
|
|
128
|
-
</ColorIndicatorWrapper>
|
|
129
|
-
</ZStack>
|
|
130
|
-
<FlexItem className="edit-site-global-styles__color-label">
|
|
131
|
-
{ __( 'Links' ) }
|
|
132
|
-
</FlexItem>
|
|
133
|
-
</HStack>
|
|
134
|
-
</NavigationButtonAsItem>
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function HeadingColorItem( { name, parentMenu, variation = '' } ) {
|
|
139
|
-
const prefix = variation ? `variations.${ variation }.` : '';
|
|
140
|
-
const urlPrefix = variation ? `/variations/${ variation }` : '';
|
|
141
|
-
const supports = useSupportedStyles( name );
|
|
142
|
-
const hasSupport = supports.includes( 'color' );
|
|
143
|
-
const [ color ] = useGlobalStyle(
|
|
144
|
-
prefix + 'elements.heading.color.text',
|
|
145
|
-
name
|
|
146
|
-
);
|
|
147
|
-
const [ bgColor ] = useGlobalStyle(
|
|
148
|
-
prefix + 'elements.heading.color.background',
|
|
149
|
-
name
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
if ( ! hasSupport ) {
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return (
|
|
157
|
-
<NavigationButtonAsItem
|
|
158
|
-
path={ parentMenu + urlPrefix + '/colors/heading' }
|
|
159
|
-
aria-label={ __( 'Colors heading styles' ) }
|
|
160
|
-
>
|
|
161
|
-
<HStack justify="flex-start">
|
|
162
|
-
<ZStack isLayered={ false } offset={ -8 }>
|
|
163
|
-
<ColorIndicatorWrapper expanded={ false }>
|
|
164
|
-
<ColorIndicator colorValue={ bgColor } />
|
|
165
|
-
</ColorIndicatorWrapper>
|
|
166
|
-
<ColorIndicatorWrapper expanded={ false }>
|
|
167
|
-
<ColorIndicator colorValue={ color } />
|
|
168
|
-
</ColorIndicatorWrapper>
|
|
169
|
-
</ZStack>
|
|
170
|
-
<FlexItem>{ __( 'Headings' ) }</FlexItem>
|
|
171
|
-
</HStack>
|
|
172
|
-
</NavigationButtonAsItem>
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function ButtonColorItem( { name, parentMenu, variation = '' } ) {
|
|
177
|
-
const prefix = variation ? `variations.${ variation }.` : '';
|
|
178
|
-
const urlPrefix = variation ? `/variations/${ variation }` : '';
|
|
179
|
-
const supports = useSupportedStyles( name );
|
|
180
|
-
const hasSupport = supports.includes( 'buttonColor' );
|
|
181
|
-
const [ color ] = useGlobalStyle(
|
|
182
|
-
prefix + 'elements.button.color.text',
|
|
183
|
-
name
|
|
184
|
-
);
|
|
185
|
-
const [ bgColor ] = useGlobalStyle(
|
|
186
|
-
prefix + 'elements.button.color.background',
|
|
187
|
-
name
|
|
188
|
-
);
|
|
24
|
+
function ScreenColors( { name, variation = '' } ) {
|
|
25
|
+
const variationClassName = getVariationClassName( variation );
|
|
189
26
|
|
|
190
|
-
|
|
191
|
-
|
|
27
|
+
let prefixParts = [];
|
|
28
|
+
if ( variation ) {
|
|
29
|
+
prefixParts = [ 'variations', variation ].concat( prefixParts );
|
|
192
30
|
}
|
|
31
|
+
const prefix = prefixParts.join( '.' );
|
|
193
32
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
<ColorIndicatorWrapper expanded={ false }>
|
|
201
|
-
<ColorIndicator colorValue={ bgColor } />
|
|
202
|
-
</ColorIndicatorWrapper>
|
|
203
|
-
<ColorIndicatorWrapper expanded={ false }>
|
|
204
|
-
<ColorIndicator colorValue={ color } />
|
|
205
|
-
</ColorIndicatorWrapper>
|
|
206
|
-
</ZStack>
|
|
207
|
-
<FlexItem className="edit-site-global-styles__color-label">
|
|
208
|
-
{ __( 'Buttons' ) }
|
|
209
|
-
</FlexItem>
|
|
210
|
-
</HStack>
|
|
211
|
-
</NavigationButtonAsItem>
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function ScreenColors( { name, variation = '' } ) {
|
|
216
|
-
const parentMenu =
|
|
217
|
-
name === undefined ? '' : '/blocks/' + encodeURIComponent( name );
|
|
218
|
-
const variationClassName = getVariationClassName( variation );
|
|
33
|
+
const [ style ] = useGlobalStyle( prefix, name, 'user', false );
|
|
34
|
+
const [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {
|
|
35
|
+
shouldDecodeEncode: false,
|
|
36
|
+
} );
|
|
37
|
+
const [ rawSettings ] = useGlobalSetting( '', name );
|
|
38
|
+
const settings = useSettingsForBlockElement( rawSettings, name );
|
|
219
39
|
|
|
220
40
|
return (
|
|
221
41
|
<>
|
|
@@ -232,36 +52,12 @@ function ScreenColors( { name, variation = '' } ) {
|
|
|
232
52
|
<VStack spacing={ 10 }>
|
|
233
53
|
<Palette name={ name } />
|
|
234
54
|
|
|
235
|
-
<
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
variation={ variation }
|
|
242
|
-
/>
|
|
243
|
-
<TextColorItem
|
|
244
|
-
name={ name }
|
|
245
|
-
parentMenu={ parentMenu }
|
|
246
|
-
variation={ variation }
|
|
247
|
-
/>
|
|
248
|
-
<LinkColorItem
|
|
249
|
-
name={ name }
|
|
250
|
-
parentMenu={ parentMenu }
|
|
251
|
-
variation={ variation }
|
|
252
|
-
/>
|
|
253
|
-
<HeadingColorItem
|
|
254
|
-
name={ name }
|
|
255
|
-
parentMenu={ parentMenu }
|
|
256
|
-
variation={ variation }
|
|
257
|
-
/>
|
|
258
|
-
<ButtonColorItem
|
|
259
|
-
name={ name }
|
|
260
|
-
parentMenu={ parentMenu }
|
|
261
|
-
variation={ variation }
|
|
262
|
-
/>
|
|
263
|
-
</ItemGroup>
|
|
264
|
-
</VStack>
|
|
55
|
+
<StylesColorPanel
|
|
56
|
+
inheritedValue={ inheritedStyle }
|
|
57
|
+
value={ style }
|
|
58
|
+
onChange={ setStyle }
|
|
59
|
+
settings={ settings }
|
|
60
|
+
/>
|
|
265
61
|
</VStack>
|
|
266
62
|
</div>
|
|
267
63
|
</>
|
|
@@ -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 ) => (
|
|
@@ -29,6 +29,10 @@ const elements = {
|
|
|
29
29
|
description: __( 'Manage the fonts and typography used on headings.' ),
|
|
30
30
|
title: __( 'Headings' ),
|
|
31
31
|
},
|
|
32
|
+
caption: {
|
|
33
|
+
description: __( 'Manage the fonts and typography used on captions.' ),
|
|
34
|
+
title: __( 'Captions' ),
|
|
35
|
+
},
|
|
32
36
|
button: {
|
|
33
37
|
description: __( 'Manage the fonts and typography used on buttons.' ),
|
|
34
38
|
title: __( 'Buttons' ),
|
|
@@ -129,6 +129,12 @@ function ScreenTypography( { name, variation = '' } ) {
|
|
|
129
129
|
element="heading"
|
|
130
130
|
label={ __( 'Headings' ) }
|
|
131
131
|
/>
|
|
132
|
+
<Item
|
|
133
|
+
name={ name }
|
|
134
|
+
parentMenu={ parentMenu }
|
|
135
|
+
element="caption"
|
|
136
|
+
label={ __( 'Captions' ) }
|
|
137
|
+
/>
|
|
132
138
|
<Item
|
|
133
139
|
name={ name }
|
|
134
140
|
parentMenu={ parentMenu }
|