@wordpress/edit-site 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/build/components/add-new-template/add-custom-generic-template-modal.js +8 -10
- package/build/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
- package/build/components/add-new-template/add-custom-template-modal.js +0 -1
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +5 -29
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/utils.js +1 -9
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +2 -7
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/index.js +13 -11
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/inserter-media-categories.js +237 -0
- package/build/components/block-editor/inserter-media-categories.js.map +1 -0
- package/build/components/canvas-spinner/index.js +20 -0
- package/build/components/canvas-spinner/index.js.map +1 -0
- package/build/components/create-template-part-modal/index.js +4 -2
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +4 -2
- package/build/components/editor/index.js.map +1 -1
- package/build/components/error-boundary/index.js +2 -12
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/error-boundary/warning.js +5 -28
- package/build/components/error-boundary/warning.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +2 -2
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +17 -9
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +13 -7
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +39 -4
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/custom-css.js +65 -14
- package/build/components/global-styles/custom-css.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +49 -31
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +13 -3
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +17 -11
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +21 -142
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +0 -28
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/palette.js +11 -4
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +18 -15
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +27 -13
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-border.js +10 -4
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +16 -9
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +43 -34
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +20 -8
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-heading-color.js +23 -16
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +3 -3
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +18 -11
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +25 -9
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +8 -4
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +14 -7
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +18 -12
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/shadow-panel.js +196 -0
- package/build/components/global-styles/shadow-panel.js.map +1 -0
- package/build/components/global-styles/typography-panel.js +43 -29
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +19 -9
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/ui.js +85 -34
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/utils.js +5 -334
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +7 -5
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +2 -2
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/layout/index.js +6 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/actions/rename-menu-item.js +8 -11
- package/build/components/list/actions/rename-menu-item.js.map +1 -1
- package/build/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +1 -2
- package/build/components/navigation-inspector/index.js.map +1 -0
- package/build/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -15
- package/build/components/navigation-inspector/navigation-menu.js.map +1 -0
- package/build/components/sidebar/index.js +3 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +3 -18
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +1 -14
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +3 -2
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +23 -1
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +35 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +3 -8
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/site-hub/index.js +2 -2
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +1 -1
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/style-book/index.js +7 -4
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +5 -9
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/experiments.js +19 -0
- package/build/experiments.js.map +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js +65 -6
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/index.js +53 -60
- package/build/index.js.map +1 -1
- package/build/store/selectors.js +7 -27
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +77 -0
- package/build/store/utils.js.map +1 -0
- package/build/utils/template-part-create.js +71 -0
- package/build/utils/template-part-create.js.map +1 -0
- package/build-module/components/add-new-template/add-custom-generic-template-modal.js +9 -11
- package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js +0 -1
- 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 +4 -27
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +0 -5
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +2 -7
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/index.js +14 -12
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/inserter-media-categories.js +225 -0
- package/build-module/components/block-editor/inserter-media-categories.js.map +1 -0
- package/build-module/components/canvas-spinner/index.js +12 -0
- package/build-module/components/canvas-spinner/index.js.map +1 -0
- package/build-module/components/create-template-part-modal/index.js +5 -3
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +3 -2
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +2 -12
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/error-boundary/warning.js +5 -28
- package/build-module/components/error-boundary/warning.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +2 -2
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +17 -11
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +11 -7
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +40 -8
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +61 -15
- package/build-module/components/global-styles/custom-css.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +49 -32
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +7 -2
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +15 -11
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +23 -134
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +0 -2
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/palette.js +10 -5
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +18 -14
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +26 -15
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +10 -5
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +16 -11
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +43 -37
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +21 -9
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-heading-color.js +23 -18
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +4 -4
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +18 -13
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +23 -9
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +5 -2
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +14 -9
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +16 -12
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel.js +177 -0
- package/build-module/components/global-styles/shadow-panel.js.map +1 -0
- package/build-module/components/global-styles/typography-panel.js +43 -31
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +17 -9
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/ui.js +80 -35
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/utils.js +4 -319
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +5 -5
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +2 -2
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/layout/index.js +6 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/actions/rename-menu-item.js +9 -12
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
- package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +1 -2
- package/build-module/components/navigation-inspector/index.js.map +1 -0
- package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -16
- package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -0
- package/build-module/components/sidebar/index.js +2 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +6 -21
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +1 -13
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +3 -2
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +22 -2
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +23 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +4 -9
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +2 -2
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +1 -1
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/style-book/index.js +8 -5
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +5 -9
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/experiments.js +9 -0
- package/build-module/experiments.js.map +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js +62 -3
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/index.js +52 -60
- package/build-module/index.js.map +1 -1
- package/build-module/store/selectors.js +6 -26
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +66 -0
- package/build-module/store/utils.js.map +1 -0
- package/build-module/utils/template-part-create.js +53 -0
- package/build-module/utils/template-part-create.js.map +1 -0
- package/build-style/style-rtl.css +314 -216
- package/build-style/style.css +314 -216
- package/package.json +32 -30
- package/src/components/add-new-template/add-custom-generic-template-modal.js +20 -28
- package/src/components/add-new-template/add-custom-template-modal.js +0 -1
- package/src/components/add-new-template/new-template-part.js +11 -32
- package/src/components/add-new-template/style.scss +0 -4
- package/src/components/add-new-template/utils.js +0 -14
- package/src/components/app/index.js +2 -2
- package/src/components/block-editor/index.js +12 -25
- package/src/components/block-editor/inserter-media-categories.js +247 -0
- package/src/components/block-editor/style.scss +19 -7
- package/src/components/canvas-spinner/index.js +12 -0
- package/src/components/canvas-spinner/style.scss +7 -0
- package/src/components/create-template-part-modal/index.js +75 -67
- package/src/components/create-template-part-modal/style.scss +0 -10
- package/src/components/editor/index.js +4 -2
- package/src/components/error-boundary/index.js +2 -10
- package/src/components/error-boundary/warning.js +6 -35
- package/src/components/global-styles/README.md +1 -75
- package/src/components/global-styles/block-preview-panel.js +2 -2
- package/src/components/global-styles/border-panel.js +19 -17
- package/src/components/global-styles/color-palette-panel.js +10 -7
- package/src/components/global-styles/context-menu.js +114 -44
- package/src/components/global-styles/custom-css.js +76 -19
- package/src/components/global-styles/dimensions-panel.js +46 -36
- package/src/components/global-styles/global-styles-provider.js +6 -2
- package/src/components/global-styles/gradients-palette-panel.js +17 -11
- package/src/components/global-styles/hooks.js +31 -155
- package/src/components/global-styles/index.js +0 -2
- package/src/components/global-styles/palette.js +9 -5
- package/src/components/global-styles/preview.js +19 -13
- package/src/components/global-styles/screen-background-color.js +37 -21
- package/src/components/global-styles/screen-border.js +10 -5
- package/src/components/global-styles/screen-button-color.js +21 -19
- package/src/components/global-styles/screen-colors.js +48 -65
- package/src/components/global-styles/screen-css.js +30 -14
- package/src/components/global-styles/screen-heading-color.js +32 -27
- package/src/components/global-styles/screen-layout.js +4 -7
- package/src/components/global-styles/screen-link-color.js +26 -26
- package/src/components/global-styles/screen-root.js +24 -9
- package/src/components/global-styles/screen-style-variations.js +7 -2
- package/src/components/global-styles/screen-text-color.js +15 -19
- package/src/components/global-styles/screen-typography.js +27 -12
- package/src/components/global-styles/shadow-panel.js +174 -0
- package/src/components/global-styles/style.scss +85 -1
- package/src/components/global-styles/typography-panel.js +60 -48
- package/src/components/global-styles/typography-preview.js +28 -9
- package/src/components/global-styles/ui.js +78 -53
- package/src/components/global-styles/utils.js +4 -371
- package/src/components/global-styles-renderer/index.js +3 -4
- package/src/components/header-edit-mode/document-actions/index.js +1 -1
- package/src/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/src/components/layout/index.js +9 -2
- package/src/components/layout/style.scss +4 -5
- package/src/components/list/actions/rename-menu-item.js +14 -23
- package/src/components/list/style.scss +0 -4
- package/src/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +1 -4
- package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +10 -12
- package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/style.scss +0 -17
- package/src/components/sidebar/index.js +2 -0
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +8 -32
- package/src/components/sidebar-edit-mode/index.js +0 -11
- package/src/components/sidebar-edit-mode/settings-header/style.scss +8 -0
- package/src/components/sidebar-navigation-item/style.scss +28 -3
- package/src/components/sidebar-navigation-screen/index.js +4 -3
- package/src/components/sidebar-navigation-screen/style.scss +2 -0
- package/src/components/sidebar-navigation-screen-main/index.js +23 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +25 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +12 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +12 -19
- package/src/components/site-hub/index.js +1 -1
- package/src/components/site-hub/style.scss +7 -1
- package/src/components/site-icon/index.js +1 -1
- package/src/components/site-icon/style.scss +2 -2
- package/src/components/style-book/index.js +10 -5
- package/src/components/template-part-converter/convert-to-template-part.js +12 -10
- package/src/experiments.js +10 -0
- package/src/hooks/push-changes-to-global-styles/index.js +63 -5
- package/src/index.js +51 -59
- package/src/store/selectors.js +6 -26
- package/src/store/test/utils.js +181 -0
- package/src/store/utils.js +69 -0
- package/src/style.scss +4 -2
- package/src/utils/template-part-create.js +62 -0
- package/src/utils/test/template-part-create.js +63 -0
- package/build/components/global-styles/context.js +0 -22
- package/build/components/global-styles/context.js.map +0 -1
- package/build/components/global-styles/typography-utils.js +0 -92
- package/build/components/global-styles/typography-utils.js.map +0 -1
- package/build/components/global-styles/use-global-styles-output.js +0 -943
- package/build/components/global-styles/use-global-styles-output.js.map +0 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -42
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
- package/build-module/components/global-styles/context.js +0 -12
- package/build-module/components/global-styles/context.js.map +0 -1
- package/build-module/components/global-styles/typography-utils.js +0 -84
- package/build-module/components/global-styles/typography-utils.js.map +0 -1
- package/build-module/components/global-styles/use-global-styles-output.js +0 -901
- package/build-module/components/global-styles/use-global-styles-output.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -28
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
- package/src/components/global-styles/context.js +0 -15
- package/src/components/global-styles/test/typography-utils.js +0 -393
- package/src/components/global-styles/test/use-global-styles-output.js +0 -814
- package/src/components/global-styles/test/utils.js +0 -206
- package/src/components/global-styles/typography-utils.js +0 -87
- package/src/components/global-styles/use-global-styles-output.js +0 -1059
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -37
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
5
|
-
import { get, set } from 'lodash';
|
|
4
|
+
import { get } from 'lodash';
|
|
6
5
|
import { colord, extend } from 'colord';
|
|
7
6
|
import a11yPlugin from 'colord/plugins/a11y';
|
|
8
7
|
|
|
@@ -10,162 +9,23 @@ import a11yPlugin from 'colord/plugins/a11y';
|
|
|
10
9
|
* WordPress dependencies
|
|
11
10
|
*/
|
|
12
11
|
import { _x } from '@wordpress/i18n';
|
|
13
|
-
import {
|
|
12
|
+
import { useMemo } from '@wordpress/element';
|
|
14
13
|
import {
|
|
15
14
|
getBlockType,
|
|
16
|
-
__EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE,
|
|
17
15
|
__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,
|
|
18
16
|
} from '@wordpress/blocks';
|
|
17
|
+
import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* Internal dependencies
|
|
22
21
|
*/
|
|
23
|
-
import {
|
|
24
|
-
|
|
22
|
+
import { unlock } from '../../experiments';
|
|
23
|
+
|
|
24
|
+
const { useGlobalSetting } = unlock( blockEditorExperiments );
|
|
25
25
|
|
|
26
26
|
// Enable colord's a11y plugin.
|
|
27
27
|
extend( [ a11yPlugin ] );
|
|
28
28
|
|
|
29
|
-
const EMPTY_CONFIG = { settings: {}, styles: {} };
|
|
30
|
-
|
|
31
|
-
export const useGlobalStylesReset = () => {
|
|
32
|
-
const { user: config, setUserConfig } = useContext( GlobalStylesContext );
|
|
33
|
-
const canReset = !! config && ! fastDeepEqual( config, EMPTY_CONFIG );
|
|
34
|
-
return [
|
|
35
|
-
canReset,
|
|
36
|
-
useCallback(
|
|
37
|
-
() => setUserConfig( () => EMPTY_CONFIG ),
|
|
38
|
-
[ setUserConfig ]
|
|
39
|
-
),
|
|
40
|
-
];
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export function useSetting( path, blockName, source = 'all' ) {
|
|
44
|
-
const {
|
|
45
|
-
merged: mergedConfig,
|
|
46
|
-
base: baseConfig,
|
|
47
|
-
user: userConfig,
|
|
48
|
-
setUserConfig,
|
|
49
|
-
} = useContext( GlobalStylesContext );
|
|
50
|
-
|
|
51
|
-
const fullPath = ! blockName
|
|
52
|
-
? `settings.${ path }`
|
|
53
|
-
: `settings.blocks.${ blockName }.${ path }`;
|
|
54
|
-
|
|
55
|
-
const setSetting = ( newValue ) => {
|
|
56
|
-
setUserConfig( ( currentConfig ) => {
|
|
57
|
-
// Deep clone `currentConfig` to avoid mutating it later.
|
|
58
|
-
const newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );
|
|
59
|
-
const pathToSet = PATHS_WITH_MERGE[ path ]
|
|
60
|
-
? fullPath + '.custom'
|
|
61
|
-
: fullPath;
|
|
62
|
-
set( newUserConfig, pathToSet, newValue );
|
|
63
|
-
|
|
64
|
-
return newUserConfig;
|
|
65
|
-
} );
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const getSettingValueForContext = ( name ) => {
|
|
69
|
-
const currentPath = ! name
|
|
70
|
-
? `settings.${ path }`
|
|
71
|
-
: `settings.blocks.${ name }.${ path }`;
|
|
72
|
-
|
|
73
|
-
const getSettingValue = ( configToUse ) => {
|
|
74
|
-
const result = get( configToUse, currentPath );
|
|
75
|
-
if ( PATHS_WITH_MERGE[ path ] ) {
|
|
76
|
-
return result?.custom ?? result?.theme ?? result?.default;
|
|
77
|
-
}
|
|
78
|
-
return result;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
let result;
|
|
82
|
-
switch ( source ) {
|
|
83
|
-
case 'all':
|
|
84
|
-
result = getSettingValue( mergedConfig );
|
|
85
|
-
break;
|
|
86
|
-
case 'user':
|
|
87
|
-
result = getSettingValue( userConfig );
|
|
88
|
-
break;
|
|
89
|
-
case 'base':
|
|
90
|
-
result = getSettingValue( baseConfig );
|
|
91
|
-
break;
|
|
92
|
-
default:
|
|
93
|
-
throw 'Unsupported source';
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return result;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
// Unlike styles settings get inherited from top level settings.
|
|
100
|
-
const resultWithFallback =
|
|
101
|
-
getSettingValueForContext( blockName ) ?? getSettingValueForContext();
|
|
102
|
-
|
|
103
|
-
return [ resultWithFallback, setSetting ];
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export function useStyle( path, blockName, source = 'all' ) {
|
|
107
|
-
const {
|
|
108
|
-
merged: mergedConfig,
|
|
109
|
-
base: baseConfig,
|
|
110
|
-
user: userConfig,
|
|
111
|
-
setUserConfig,
|
|
112
|
-
} = useContext( GlobalStylesContext );
|
|
113
|
-
const finalPath = ! blockName
|
|
114
|
-
? `styles.${ path }`
|
|
115
|
-
: `styles.blocks.${ blockName }.${ path }`;
|
|
116
|
-
|
|
117
|
-
const setStyle = ( newValue ) => {
|
|
118
|
-
setUserConfig( ( currentConfig ) => {
|
|
119
|
-
// Deep clone `currentConfig` to avoid mutating it later.
|
|
120
|
-
const newUserConfig = JSON.parse( JSON.stringify( currentConfig ) );
|
|
121
|
-
set(
|
|
122
|
-
newUserConfig,
|
|
123
|
-
finalPath,
|
|
124
|
-
getPresetVariableFromValue(
|
|
125
|
-
mergedConfig.settings,
|
|
126
|
-
blockName,
|
|
127
|
-
path,
|
|
128
|
-
newValue
|
|
129
|
-
)
|
|
130
|
-
);
|
|
131
|
-
return newUserConfig;
|
|
132
|
-
} );
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
let result;
|
|
136
|
-
switch ( source ) {
|
|
137
|
-
case 'all':
|
|
138
|
-
result = getValueFromVariable(
|
|
139
|
-
mergedConfig,
|
|
140
|
-
blockName,
|
|
141
|
-
// The stlyes.css path is allowed to be empty, so don't revert to base if undefined.
|
|
142
|
-
finalPath === 'styles.css'
|
|
143
|
-
? get( userConfig, finalPath )
|
|
144
|
-
: get( userConfig, finalPath ) ??
|
|
145
|
-
get( baseConfig, finalPath )
|
|
146
|
-
);
|
|
147
|
-
break;
|
|
148
|
-
case 'user':
|
|
149
|
-
result = getValueFromVariable(
|
|
150
|
-
mergedConfig,
|
|
151
|
-
blockName,
|
|
152
|
-
get( userConfig, finalPath )
|
|
153
|
-
);
|
|
154
|
-
break;
|
|
155
|
-
case 'base':
|
|
156
|
-
result = getValueFromVariable(
|
|
157
|
-
baseConfig,
|
|
158
|
-
blockName,
|
|
159
|
-
get( baseConfig, finalPath )
|
|
160
|
-
);
|
|
161
|
-
break;
|
|
162
|
-
default:
|
|
163
|
-
throw 'Unsupported source';
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return [ result, setStyle ];
|
|
167
|
-
}
|
|
168
|
-
|
|
169
29
|
const ROOT_BLOCK_SUPPORTS = [
|
|
170
30
|
'background',
|
|
171
31
|
'backgroundColor',
|
|
@@ -211,6 +71,11 @@ export function getSupportedGlobalStylesPanels( name ) {
|
|
|
211
71
|
supportKeys.push( 'blockGap' );
|
|
212
72
|
}
|
|
213
73
|
|
|
74
|
+
// check for shadow support
|
|
75
|
+
if ( blockType?.supports?.shadow ) {
|
|
76
|
+
supportKeys.push( 'shadow' );
|
|
77
|
+
}
|
|
78
|
+
|
|
214
79
|
Object.keys( STYLE_PROPERTY ).forEach( ( styleName ) => {
|
|
215
80
|
if ( ! STYLE_PROPERTY[ styleName ].support ) {
|
|
216
81
|
return;
|
|
@@ -247,10 +112,12 @@ export function getSupportedGlobalStylesPanels( name ) {
|
|
|
247
112
|
}
|
|
248
113
|
|
|
249
114
|
export function useColorsPerOrigin( name ) {
|
|
250
|
-
const [ customColors ] =
|
|
251
|
-
const [ themeColors ] =
|
|
252
|
-
const [ defaultColors ] =
|
|
253
|
-
const [ shouldDisplayDefaultColors ] =
|
|
115
|
+
const [ customColors ] = useGlobalSetting( 'color.palette.custom', name );
|
|
116
|
+
const [ themeColors ] = useGlobalSetting( 'color.palette.theme', name );
|
|
117
|
+
const [ defaultColors ] = useGlobalSetting( 'color.palette.default', name );
|
|
118
|
+
const [ shouldDisplayDefaultColors ] = useGlobalSetting(
|
|
119
|
+
'color.defaultPalette'
|
|
120
|
+
);
|
|
254
121
|
|
|
255
122
|
return useMemo( () => {
|
|
256
123
|
const result = [];
|
|
@@ -290,10 +157,19 @@ export function useColorsPerOrigin( name ) {
|
|
|
290
157
|
}
|
|
291
158
|
|
|
292
159
|
export function useGradientsPerOrigin( name ) {
|
|
293
|
-
const [ customGradients ] =
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
160
|
+
const [ customGradients ] = useGlobalSetting(
|
|
161
|
+
'color.gradients.custom',
|
|
162
|
+
name
|
|
163
|
+
);
|
|
164
|
+
const [ themeGradients ] = useGlobalSetting(
|
|
165
|
+
'color.gradients.theme',
|
|
166
|
+
name
|
|
167
|
+
);
|
|
168
|
+
const [ defaultGradients ] = useGlobalSetting(
|
|
169
|
+
'color.gradients.default',
|
|
170
|
+
name
|
|
171
|
+
);
|
|
172
|
+
const [ shouldDisplayDefaultGradients ] = useGlobalSetting(
|
|
297
173
|
'color.defaultGradients'
|
|
298
174
|
);
|
|
299
175
|
|
|
@@ -335,7 +211,7 @@ export function useGradientsPerOrigin( name ) {
|
|
|
335
211
|
}
|
|
336
212
|
|
|
337
213
|
export function useColorRandomizer( name ) {
|
|
338
|
-
const [ themeColors, setThemeColors ] =
|
|
214
|
+
const [ themeColors, setThemeColors ] = useGlobalSetting(
|
|
339
215
|
'color.palette.theme',
|
|
340
216
|
name
|
|
341
217
|
);
|
|
@@ -13,23 +13,27 @@ import {
|
|
|
13
13
|
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
14
14
|
import { shuffle } from '@wordpress/icons';
|
|
15
15
|
import { useMemo } from '@wordpress/element';
|
|
16
|
+
import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Internal dependencies
|
|
19
20
|
*/
|
|
20
21
|
import Subtitle from './subtitle';
|
|
21
22
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
22
|
-
import { useColorRandomizer
|
|
23
|
+
import { useColorRandomizer } from './hooks';
|
|
23
24
|
import ColorIndicatorWrapper from './color-indicator-wrapper';
|
|
25
|
+
import { unlock } from '../../experiments';
|
|
26
|
+
|
|
27
|
+
const { useGlobalSetting } = unlock( blockEditorExperiments );
|
|
24
28
|
|
|
25
29
|
const EMPTY_COLORS = [];
|
|
26
30
|
|
|
27
31
|
function Palette( { name } ) {
|
|
28
|
-
const [ customColors ] =
|
|
29
|
-
const [ themeColors ] =
|
|
30
|
-
const [ defaultColors ] =
|
|
32
|
+
const [ customColors ] = useGlobalSetting( 'color.palette.custom' );
|
|
33
|
+
const [ themeColors ] = useGlobalSetting( 'color.palette.theme' );
|
|
34
|
+
const [ defaultColors ] = useGlobalSetting( 'color.palette.default' );
|
|
31
35
|
|
|
32
|
-
const [ defaultPaletteEnabled ] =
|
|
36
|
+
const [ defaultPaletteEnabled ] = useGlobalSetting(
|
|
33
37
|
'color.defaultPalette',
|
|
34
38
|
name
|
|
35
39
|
);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import {
|
|
5
5
|
__unstableIframe as Iframe,
|
|
6
6
|
__unstableEditorStyles as EditorStyles,
|
|
7
|
+
experiments as blockEditorExperiments,
|
|
7
8
|
} from '@wordpress/block-editor';
|
|
8
9
|
import {
|
|
9
10
|
__unstableMotion as motion,
|
|
@@ -16,8 +17,11 @@ import { useState, useMemo } from '@wordpress/element';
|
|
|
16
17
|
/**
|
|
17
18
|
* Internal dependencies
|
|
18
19
|
*/
|
|
19
|
-
import {
|
|
20
|
-
|
|
20
|
+
import { unlock } from '../../experiments';
|
|
21
|
+
|
|
22
|
+
const { useGlobalSetting, useGlobalStyle, useGlobalStylesOutput } = unlock(
|
|
23
|
+
blockEditorExperiments
|
|
24
|
+
);
|
|
21
25
|
|
|
22
26
|
const firstFrame = {
|
|
23
27
|
start: {
|
|
@@ -56,23 +60,25 @@ const normalizedHeight = 152;
|
|
|
56
60
|
const normalizedColorSwatchSize = 32;
|
|
57
61
|
|
|
58
62
|
const StylesPreview = ( { label, isFocused, withHoverView } ) => {
|
|
59
|
-
const [ fontWeight ] =
|
|
60
|
-
const [ fontFamily = 'serif' ] =
|
|
61
|
-
const [ headingFontFamily = fontFamily ] =
|
|
63
|
+
const [ fontWeight ] = useGlobalStyle( 'typography.fontWeight' );
|
|
64
|
+
const [ fontFamily = 'serif' ] = useGlobalStyle( 'typography.fontFamily' );
|
|
65
|
+
const [ headingFontFamily = fontFamily ] = useGlobalStyle(
|
|
62
66
|
'elements.h1.typography.fontFamily'
|
|
63
67
|
);
|
|
64
|
-
const [ headingFontWeight = fontWeight ] =
|
|
68
|
+
const [ headingFontWeight = fontWeight ] = useGlobalStyle(
|
|
65
69
|
'elements.h1.typography.fontWeight'
|
|
66
70
|
);
|
|
67
|
-
const [ textColor = 'black' ] =
|
|
68
|
-
const [ headingColor = textColor ] =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
const [ textColor = 'black' ] = useGlobalStyle( 'color.text' );
|
|
72
|
+
const [ headingColor = textColor ] = useGlobalStyle(
|
|
73
|
+
'elements.h1.color.text'
|
|
74
|
+
);
|
|
75
|
+
const [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );
|
|
76
|
+
const [ gradientValue ] = useGlobalStyle( 'color.gradient' );
|
|
71
77
|
const [ styles ] = useGlobalStylesOutput();
|
|
72
78
|
const disableMotion = useReducedMotion();
|
|
73
|
-
const [ coreColors ] =
|
|
74
|
-
const [ themeColors ] =
|
|
75
|
-
const [ customColors ] =
|
|
79
|
+
const [ coreColors ] = useGlobalSetting( 'color.palette.core' );
|
|
80
|
+
const [ themeColors ] = useGlobalSetting( 'color.palette.theme' );
|
|
81
|
+
const [ customColors ] = useGlobalSetting( 'color.palette.custom' );
|
|
76
82
|
const [ isHovered, setIsHovered ] = useState( false );
|
|
77
83
|
const [ containerResizeListener, { width } ] = useResizeObserver();
|
|
78
84
|
const ratio = width ? width / normalizedWidth : 1;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
4
9
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
__experimentalColorGradientControl as ColorGradientControl,
|
|
12
|
+
experiments as blockEditorExperiments,
|
|
13
|
+
} from '@wordpress/block-editor';
|
|
6
14
|
|
|
7
15
|
/**
|
|
8
16
|
* Internal dependencies
|
|
@@ -12,47 +20,49 @@ import {
|
|
|
12
20
|
getSupportedGlobalStylesPanels,
|
|
13
21
|
useColorsPerOrigin,
|
|
14
22
|
useGradientsPerOrigin,
|
|
15
|
-
useSetting,
|
|
16
|
-
useStyle,
|
|
17
23
|
} from './hooks';
|
|
24
|
+
import { unlock } from '../../experiments';
|
|
25
|
+
|
|
26
|
+
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
|
|
18
27
|
|
|
19
|
-
function ScreenBackgroundColor( { name,
|
|
28
|
+
function ScreenBackgroundColor( { name, variation = '' } ) {
|
|
29
|
+
const prefix = variation ? `variations.${ variation }.` : '';
|
|
20
30
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
21
|
-
const [
|
|
22
|
-
const [
|
|
23
|
-
const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
|
|
24
|
-
const [ areCustomGradientsEnabled ] = useSetting(
|
|
31
|
+
const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
|
|
32
|
+
const [ areCustomGradientsEnabled ] = useGlobalSetting(
|
|
25
33
|
'color.customGradient',
|
|
26
34
|
name
|
|
27
35
|
);
|
|
28
|
-
|
|
29
36
|
const colorsPerOrigin = useColorsPerOrigin( name );
|
|
30
37
|
const gradientsPerOrigin = useGradientsPerOrigin( name );
|
|
31
38
|
|
|
32
|
-
const [ isBackgroundEnabled ] =
|
|
39
|
+
const [ isBackgroundEnabled ] = useGlobalSetting(
|
|
40
|
+
'color.background',
|
|
41
|
+
name
|
|
42
|
+
);
|
|
33
43
|
|
|
34
44
|
const hasBackgroundColor =
|
|
35
45
|
supports.includes( 'backgroundColor' ) &&
|
|
36
46
|
isBackgroundEnabled &&
|
|
37
|
-
(
|
|
47
|
+
( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
|
|
38
48
|
const hasGradientColor =
|
|
39
49
|
supports.includes( 'background' ) &&
|
|
40
|
-
(
|
|
41
|
-
const [ backgroundColor, setBackgroundColor ] =
|
|
42
|
-
|
|
50
|
+
( gradientsPerOrigin.length > 0 || areCustomGradientsEnabled );
|
|
51
|
+
const [ backgroundColor, setBackgroundColor ] = useGlobalStyle(
|
|
52
|
+
prefix + 'color.background',
|
|
43
53
|
name
|
|
44
54
|
);
|
|
45
|
-
const [ userBackgroundColor ] =
|
|
46
|
-
|
|
55
|
+
const [ userBackgroundColor ] = useGlobalStyle(
|
|
56
|
+
prefix + 'color.background',
|
|
47
57
|
name,
|
|
48
58
|
'user'
|
|
49
59
|
);
|
|
50
|
-
const [ gradient, setGradient ] =
|
|
51
|
-
|
|
60
|
+
const [ gradient, setGradient ] = useGlobalStyle(
|
|
61
|
+
prefix + 'color.gradient',
|
|
52
62
|
name
|
|
53
63
|
);
|
|
54
|
-
const [ userGradient ] =
|
|
55
|
-
|
|
64
|
+
const [ userGradient ] = useGlobalStyle(
|
|
65
|
+
prefix + 'color.gradient',
|
|
56
66
|
name,
|
|
57
67
|
'user'
|
|
58
68
|
);
|
|
@@ -98,7 +108,13 @@ function ScreenBackgroundColor( { name, variationPath = '' } ) {
|
|
|
98
108
|
) }
|
|
99
109
|
/>
|
|
100
110
|
<ColorGradientControl
|
|
101
|
-
className=
|
|
111
|
+
className={ classnames(
|
|
112
|
+
'edit-site-screen-background-color__control',
|
|
113
|
+
{
|
|
114
|
+
'has-no-tabs':
|
|
115
|
+
! hasBackgroundColor || ! hasGradientColor,
|
|
116
|
+
}
|
|
117
|
+
) }
|
|
102
118
|
colors={ colorsPerOrigin }
|
|
103
119
|
gradients={ gradientsPerOrigin }
|
|
104
120
|
disableCustomColors={ ! areCustomSolidsEnabled }
|
|
@@ -9,17 +9,22 @@ import { __ } from '@wordpress/i18n';
|
|
|
9
9
|
import ScreenHeader from './header';
|
|
10
10
|
import BorderPanel, { useHasBorderPanel } from './border-panel';
|
|
11
11
|
import BlockPreviewPanel from './block-preview-panel';
|
|
12
|
-
import {
|
|
12
|
+
import { getVariationClassName } from './utils';
|
|
13
|
+
import ShadowPanel, { useHasShadowControl } from './shadow-panel';
|
|
13
14
|
|
|
14
|
-
function ScreenBorder( { name,
|
|
15
|
+
function ScreenBorder( { name, variation = '' } ) {
|
|
15
16
|
const hasBorderPanel = useHasBorderPanel( name );
|
|
16
|
-
const variationClassName =
|
|
17
|
+
const variationClassName = getVariationClassName( variation );
|
|
18
|
+
const hasShadowPanel = useHasShadowControl( name );
|
|
17
19
|
return (
|
|
18
20
|
<>
|
|
19
|
-
<ScreenHeader title={ __( 'Border' ) } />
|
|
21
|
+
<ScreenHeader title={ __( 'Border & Shadow' ) } />
|
|
20
22
|
<BlockPreviewPanel name={ name } variation={ variationClassName } />
|
|
21
23
|
{ hasBorderPanel && (
|
|
22
|
-
<BorderPanel name={ name }
|
|
24
|
+
<BorderPanel name={ name } variation={ variation } />
|
|
25
|
+
) }
|
|
26
|
+
{ hasShadowPanel && (
|
|
27
|
+
<ShadowPanel name={ name } variation={ variation } />
|
|
23
28
|
) }
|
|
24
29
|
</>
|
|
25
30
|
);
|
|
@@ -2,48 +2,50 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
__experimentalColorGradientControl as ColorGradientControl,
|
|
7
|
+
experiments as blockEditorExperiments,
|
|
8
|
+
} from '@wordpress/block-editor';
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* Internal dependencies
|
|
9
12
|
*/
|
|
10
13
|
import ScreenHeader from './header';
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
useSetting,
|
|
14
|
-
useStyle,
|
|
15
|
-
useColorsPerOrigin,
|
|
16
|
-
} from './hooks';
|
|
14
|
+
import { getSupportedGlobalStylesPanels, useColorsPerOrigin } from './hooks';
|
|
15
|
+
import { unlock } from '../../experiments';
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
const supports = getSupportedGlobalStylesPanels( name );
|
|
20
|
-
const [ solids ] = useSetting( 'color.palette', name );
|
|
21
|
-
const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
|
|
17
|
+
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
|
|
22
18
|
|
|
19
|
+
function ScreenButtonColor( { name, variation = '' } ) {
|
|
20
|
+
const prefix = variation ? `variations.${ variation }.` : '';
|
|
21
|
+
const supports = getSupportedGlobalStylesPanels( name );
|
|
23
22
|
const colorsPerOrigin = useColorsPerOrigin( name );
|
|
24
|
-
|
|
25
|
-
const [ isBackgroundEnabled ] =
|
|
23
|
+
const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
|
|
24
|
+
const [ isBackgroundEnabled ] = useGlobalSetting(
|
|
25
|
+
'color.background',
|
|
26
|
+
name
|
|
27
|
+
);
|
|
26
28
|
|
|
27
29
|
const hasButtonColor =
|
|
28
30
|
supports.includes( 'buttonColor' ) &&
|
|
29
31
|
isBackgroundEnabled &&
|
|
30
|
-
(
|
|
32
|
+
( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
|
|
31
33
|
|
|
32
|
-
const [ buttonTextColor, setButtonTextColor ] =
|
|
33
|
-
|
|
34
|
+
const [ buttonTextColor, setButtonTextColor ] = useGlobalStyle(
|
|
35
|
+
prefix + 'elements.button.color.text',
|
|
34
36
|
name
|
|
35
37
|
);
|
|
36
|
-
const [ userButtonTextColor ] =
|
|
38
|
+
const [ userButtonTextColor ] = useGlobalStyle(
|
|
37
39
|
'elements.button.color.text',
|
|
38
40
|
name,
|
|
39
41
|
'user'
|
|
40
42
|
);
|
|
41
43
|
|
|
42
|
-
const [ buttonBgColor, setButtonBgColor ] =
|
|
44
|
+
const [ buttonBgColor, setButtonBgColor ] = useGlobalStyle(
|
|
43
45
|
'elements.button.color.background',
|
|
44
46
|
name
|
|
45
47
|
);
|
|
46
|
-
const [ userButtonBgColor ] =
|
|
48
|
+
const [ userButtonBgColor ] = useGlobalStyle(
|
|
47
49
|
'elements.button.color.background',
|
|
48
50
|
name,
|
|
49
51
|
'user'
|