@wordpress/edit-site 5.4.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 +4 -0
- package/build/components/add-new-template/add-custom-template-modal.js +12 -3
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +8 -7
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +19 -16
- 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 +5 -7
- 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 +13 -11
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +41 -487
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/duotone-panel.js +78 -0
- package/build/components/global-styles/duotone-panel.js.map +1 -0
- package/build/components/global-styles/filter-utils.js +17 -0
- package/build/components/global-styles/filter-utils.js.map +1 -0
- package/build/components/global-styles/hooks.js +11 -26
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview.js +9 -5
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +6 -11
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-border.js +14 -6
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-filters.js +46 -0
- package/build/components/global-styles/screen-filters.js.map +1 -0
- package/build/components/global-styles/screen-layout.js +13 -5
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-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-variations.js +1 -1
- package/build/components/global-styles/screen-variations.js.map +1 -1
- package/build/components/global-styles/shadow-panel.js +6 -4
- package/build/components/global-styles/shadow-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +2 -5
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +7 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +124 -0
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build/components/keyboard-shortcuts/global.js +48 -0
- package/build/components/keyboard-shortcuts/global.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +67 -0
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +153 -0
- package/build/components/keyboard-shortcuts/register.js.map +1 -0
- package/build/components/layout/index.js +12 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +127 -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 +9 -7
- 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-hub/index.js +82 -0
- package/build/components/save-hub/index.js.map +1 -0
- package/build/components/save-panel/index.js +11 -1
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +27 -17
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +30 -0
- package/build/components/sidebar-button/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +14 -11
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +16 -16
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +22 -26
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +97 -14
- 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 +66 -27
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +30 -17
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +14 -10
- 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 +151 -21
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-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 +67 -18
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +5 -10
- 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 +13 -22
- package/build/index.js.map +1 -1
- package/build/store/actions.js +2 -2
- package/build/store/actions.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/history.js +8 -2
- package/build/utils/history.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js +13 -4
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +8 -7
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +21 -17
- 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 +5 -6
- 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 +14 -11
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +43 -480
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/duotone-panel.js +67 -0
- package/build-module/components/global-styles/duotone-panel.js.map +1 -0
- package/build-module/components/global-styles/filter-utils.js +9 -0
- package/build-module/components/global-styles/filter-utils.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +11 -26
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview.js +10 -6
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +6 -8
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +12 -3
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-filters.js +33 -0
- package/build-module/components/global-styles/screen-filters.js.map +1 -0
- package/build-module/components/global-styles/screen-layout.js +11 -2
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-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-variations.js +1 -1
- package/build-module/components/global-styles/screen-variations.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel.js +6 -4
- package/build-module/components/global-styles/shadow-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +2 -5
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +6 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +108 -0
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/global.js +37 -0
- package/build-module/components/keyboard-shortcuts/global.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +65 -0
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +141 -0
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -0
- package/build-module/components/layout/index.js +10 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +126 -138
- 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 +9 -7
- 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-hub/index.js +68 -0
- package/build-module/components/save-hub/index.js.map +1 -0
- package/build-module/components/save-panel/index.js +8 -1
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +24 -19
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +18 -0
- package/build-module/components/sidebar-button/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +12 -12
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +16 -16
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +24 -30
- 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 +91 -14
- 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 +67 -30
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +28 -18
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +13 -10
- 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 +152 -25
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-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 +65 -18
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-details/index.js +5 -9
- 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 +16 -23
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +2 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/history.js +9 -3
- package/build-module/utils/history.js.map +1 -1
- package/build-style/style-rtl.css +203 -143
- package/build-style/style.css +203 -143
- package/package.json +31 -31
- package/src/components/add-new-template/add-custom-template-modal.js +14 -10
- package/src/components/add-new-template/new-template-part.js +7 -9
- package/src/components/add-new-template/new-template.js +60 -38
- package/src/components/add-new-template/style.scss +12 -6
- package/src/components/app/index.js +9 -6
- package/src/components/block-editor/editor-canvas.js +2 -1
- package/src/components/block-editor/style.scss +1 -1
- package/src/components/editor/index.js +62 -65
- package/src/components/editor/style.scss +0 -6
- package/src/components/global-styles/border-panel.js +24 -199
- package/src/components/global-styles/context-menu.js +18 -12
- package/src/components/global-styles/dimensions-panel.js +43 -577
- package/src/components/global-styles/duotone-panel.js +82 -0
- package/src/components/global-styles/filter-utils.js +9 -0
- package/src/components/global-styles/hooks.js +12 -36
- package/src/components/global-styles/preview.js +155 -140
- package/src/components/global-styles/screen-block-list.js +6 -11
- package/src/components/global-styles/screen-border.js +10 -3
- package/src/components/global-styles/screen-filters.js +27 -0
- package/src/components/global-styles/screen-layout.js +9 -2
- package/src/components/global-styles/screen-root.js +1 -1
- package/src/components/global-styles/screen-style-variations.js +5 -1
- package/src/components/global-styles/screen-variations.js +0 -1
- package/src/components/global-styles/shadow-panel.js +4 -3
- package/src/components/global-styles/style.scss +10 -0
- package/src/components/global-styles/typography-panel.js +5 -7
- package/src/components/global-styles/ui.js +6 -1
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -0
- package/src/components/keyboard-shortcuts/edit-mode.js +116 -0
- package/src/components/keyboard-shortcuts/global.js +35 -0
- package/src/components/keyboard-shortcuts/index.js +70 -0
- package/src/components/keyboard-shortcuts/register.js +157 -0
- package/src/components/layout/index.js +19 -0
- package/src/components/layout/style.scss +9 -4
- package/src/components/list/added-by.js +152 -155
- package/src/components/list/index.js +3 -1
- package/src/components/list/style.scss +5 -13
- package/src/components/list/table.js +11 -9
- package/src/components/routes/link.js +9 -2
- package/src/components/save-hub/index.js +78 -0
- package/src/components/save-hub/style.scss +15 -0
- package/src/components/save-panel/index.js +8 -1
- package/src/components/sidebar/index.js +33 -16
- package/src/components/sidebar/style.scss +4 -3
- package/src/components/sidebar-button/index.js +21 -0
- package/src/components/sidebar-button/style.scss +24 -0
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +3 -7
- package/src/components/sidebar-edit-mode/style.scss +16 -0
- package/src/components/sidebar-navigation-item/style.scss +1 -23
- package/src/components/sidebar-navigation-screen/index.js +37 -38
- package/src/components/sidebar-navigation-screen/style.scss +16 -9
- package/src/components/sidebar-navigation-screen-main/index.js +24 -11
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +39 -26
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +99 -12
- 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 +89 -30
- package/src/components/sidebar-navigation-screen-template/style.scss +25 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +29 -14
- package/src/components/sidebar-navigation-screen-templates/style.scss +0 -5
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -6
- 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 +234 -55
- package/src/components/style-book/style.scss +1 -45
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +28 -23
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +77 -17
- package/src/components/template-details/index.js +4 -8
- 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 +11 -22
- package/src/store/actions.js +2 -2
- package/src/store/test/actions.js +0 -2
- package/src/style.scss +3 -1
- package/src/utils/get-is-list-page.js +1 -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 -62
- 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 -52
- 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 -66
- package/src/components/navigation-inspector/style.scss +0 -46
|
@@ -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
|
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
typography,
|
|
14
14
|
border,
|
|
15
|
+
filter,
|
|
15
16
|
shadow,
|
|
16
17
|
color,
|
|
17
18
|
layout,
|
|
@@ -22,40 +23,36 @@ import { isRTL, __ } from '@wordpress/i18n';
|
|
|
22
23
|
import { useSelect } from '@wordpress/data';
|
|
23
24
|
import { store as coreStore } from '@wordpress/core-data';
|
|
24
25
|
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
25
|
-
import { useMemo } from '@wordpress/element';
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Internal dependencies
|
|
29
29
|
*/
|
|
30
|
-
import { useHasBorderPanel } from './border-panel';
|
|
31
30
|
import { useHasColorPanel } from './color-utils';
|
|
32
|
-
import {
|
|
31
|
+
import { useHasFilterPanel } from './filter-utils';
|
|
33
32
|
import { useHasVariationsPanel } from './variations-panel';
|
|
34
33
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
35
34
|
import { IconWithCurrentColor } from './icon-with-current-color';
|
|
36
35
|
import { ScreenVariations } from './screen-variations';
|
|
37
36
|
import { useHasShadowControl } from './shadow-panel';
|
|
38
37
|
import { unlock } from '../../private-apis';
|
|
39
|
-
import { useSupportedStyles } from './hooks';
|
|
40
38
|
|
|
41
39
|
const {
|
|
40
|
+
useHasDimensionsPanel,
|
|
42
41
|
useHasTypographyPanel,
|
|
42
|
+
useHasBorderPanel,
|
|
43
43
|
useGlobalSetting,
|
|
44
|
-
|
|
44
|
+
useSettingsForBlockElement,
|
|
45
45
|
} = unlock( blockEditorPrivateApis );
|
|
46
46
|
|
|
47
47
|
function ContextMenu( { name, parentMenu = '' } ) {
|
|
48
48
|
const [ rawSettings ] = useGlobalSetting( '', name );
|
|
49
|
-
const
|
|
50
|
-
const settings = useMemo(
|
|
51
|
-
() => overrideSettingsWithSupports( rawSettings, supports ),
|
|
52
|
-
[ rawSettings, supports ]
|
|
53
|
-
);
|
|
49
|
+
const settings = useSettingsForBlockElement( rawSettings, name );
|
|
54
50
|
const hasTypographyPanel = useHasTypographyPanel( settings );
|
|
55
51
|
const hasColorPanel = useHasColorPanel( name );
|
|
56
|
-
const hasBorderPanel = useHasBorderPanel(
|
|
52
|
+
const hasBorderPanel = useHasBorderPanel( settings );
|
|
57
53
|
const hasEffectsPanel = useHasShadowControl( name );
|
|
58
|
-
const
|
|
54
|
+
const hasFilterPanel = useHasFilterPanel( name );
|
|
55
|
+
const hasDimensionsPanel = useHasDimensionsPanel( settings );
|
|
59
56
|
const hasLayoutPanel = hasDimensionsPanel;
|
|
60
57
|
const hasVariationsPanel = useHasVariationsPanel( name, parentMenu );
|
|
61
58
|
|
|
@@ -117,6 +114,15 @@ function ContextMenu( { name, parentMenu = '' } ) {
|
|
|
117
114
|
{ __( 'Shadow' ) }
|
|
118
115
|
</NavigationButtonAsItem>
|
|
119
116
|
) }
|
|
117
|
+
{ hasFilterPanel && (
|
|
118
|
+
<NavigationButtonAsItem
|
|
119
|
+
icon={ filter }
|
|
120
|
+
path={ parentMenu + '/filters' }
|
|
121
|
+
aria-label={ __( 'Filters styles' ) }
|
|
122
|
+
>
|
|
123
|
+
{ __( 'Filters' ) }
|
|
124
|
+
</NavigationButtonAsItem>
|
|
125
|
+
) }
|
|
120
126
|
{ hasLayoutPanel && (
|
|
121
127
|
<NavigationButtonAsItem
|
|
122
128
|
icon={ layout }
|