@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,9 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import {
|
|
5
|
+
__experimentalItemGroup as ItemGroup,
|
|
6
|
+
__experimentalHStack as HStack,
|
|
7
|
+
__experimentalSpacer as Spacer,
|
|
8
|
+
FlexItem,
|
|
9
|
+
CardBody,
|
|
10
|
+
CardDivider,
|
|
11
|
+
} from '@wordpress/components';
|
|
12
|
+
import {
|
|
13
|
+
typography,
|
|
14
|
+
border,
|
|
15
|
+
color,
|
|
16
|
+
layout,
|
|
17
|
+
chevronLeft,
|
|
18
|
+
chevronRight,
|
|
19
|
+
} from '@wordpress/icons';
|
|
20
|
+
import { isRTL, __ } from '@wordpress/i18n';
|
|
21
|
+
import { useSelect } from '@wordpress/data';
|
|
22
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
7
23
|
|
|
8
24
|
/**
|
|
9
25
|
* Internal dependencies
|
|
@@ -14,6 +30,7 @@ import { useHasDimensionsPanel } from './dimensions-panel';
|
|
|
14
30
|
import { useHasTypographyPanel } from './typography-panel';
|
|
15
31
|
import { useHasVariationsPanel } from './variations-panel';
|
|
16
32
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
33
|
+
import { IconWithCurrentColor } from './icon-with-current-color';
|
|
17
34
|
import { ScreenVariations } from './screen-variations';
|
|
18
35
|
|
|
19
36
|
function ContextMenu( { name, parentMenu = '' } ) {
|
|
@@ -24,48 +41,101 @@ function ContextMenu( { name, parentMenu = '' } ) {
|
|
|
24
41
|
const hasLayoutPanel = hasDimensionsPanel;
|
|
25
42
|
const hasVariationsPanel = useHasVariationsPanel( name, parentMenu );
|
|
26
43
|
|
|
44
|
+
const { canEditCSS } = useSelect( ( select ) => {
|
|
45
|
+
const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
|
|
46
|
+
select( coreStore );
|
|
47
|
+
|
|
48
|
+
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
49
|
+
const globalStyles = globalStylesId
|
|
50
|
+
? getEntityRecord( 'root', 'globalStyles', globalStylesId )
|
|
51
|
+
: undefined;
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
canEditCSS:
|
|
55
|
+
!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,
|
|
56
|
+
};
|
|
57
|
+
}, [] );
|
|
58
|
+
|
|
59
|
+
const isBlocksPanel =
|
|
60
|
+
parentMenu.includes( 'blocks' ) &&
|
|
61
|
+
! parentMenu.includes( 'variations' );
|
|
62
|
+
|
|
27
63
|
return (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
<>
|
|
65
|
+
<ItemGroup>
|
|
66
|
+
{ hasTypographyPanel && (
|
|
67
|
+
<NavigationButtonAsItem
|
|
68
|
+
icon={ typography }
|
|
69
|
+
path={ parentMenu + '/typography' }
|
|
70
|
+
aria-label={ __( 'Typography styles' ) }
|
|
71
|
+
>
|
|
72
|
+
{ __( 'Typography' ) }
|
|
73
|
+
</NavigationButtonAsItem>
|
|
74
|
+
) }
|
|
75
|
+
{ hasColorPanel && (
|
|
76
|
+
<NavigationButtonAsItem
|
|
77
|
+
icon={ color }
|
|
78
|
+
path={ parentMenu + '/colors' }
|
|
79
|
+
aria-label={ __( 'Colors styles' ) }
|
|
80
|
+
>
|
|
81
|
+
{ __( 'Colors' ) }
|
|
82
|
+
</NavigationButtonAsItem>
|
|
83
|
+
) }
|
|
84
|
+
{ hasBorderPanel && (
|
|
85
|
+
<NavigationButtonAsItem
|
|
86
|
+
icon={ border }
|
|
87
|
+
path={ parentMenu + '/border' }
|
|
88
|
+
aria-label={ __( 'Border & shadow styles' ) }
|
|
89
|
+
>
|
|
90
|
+
{ __( 'Border & Shadow' ) }
|
|
91
|
+
</NavigationButtonAsItem>
|
|
92
|
+
) }
|
|
93
|
+
{ hasLayoutPanel && (
|
|
94
|
+
<NavigationButtonAsItem
|
|
95
|
+
icon={ layout }
|
|
96
|
+
path={ parentMenu + '/layout' }
|
|
97
|
+
aria-label={ __( 'Layout styles' ) }
|
|
98
|
+
>
|
|
99
|
+
{ __( 'Layout' ) }
|
|
100
|
+
</NavigationButtonAsItem>
|
|
101
|
+
) }
|
|
102
|
+
{ hasVariationsPanel && (
|
|
103
|
+
<ScreenVariations name={ name } path={ parentMenu } />
|
|
104
|
+
) }
|
|
105
|
+
{ isBlocksPanel && canEditCSS && (
|
|
106
|
+
<>
|
|
107
|
+
<CardDivider />
|
|
108
|
+
<CardBody>
|
|
109
|
+
<Spacer as="p" paddingTop={ 2 } marginBottom={ 4 }>
|
|
110
|
+
{ __(
|
|
111
|
+
'Add your own CSS to customize the block appearance.'
|
|
112
|
+
) }
|
|
113
|
+
</Spacer>
|
|
114
|
+
<ItemGroup>
|
|
115
|
+
<NavigationButtonAsItem
|
|
116
|
+
path={ parentMenu + '/css' }
|
|
117
|
+
aria-label={ __( 'Additional block CSS' ) }
|
|
118
|
+
>
|
|
119
|
+
<HStack justify="space-between">
|
|
120
|
+
<FlexItem>
|
|
121
|
+
{ __( 'Additional block CSS' ) }
|
|
122
|
+
</FlexItem>
|
|
123
|
+
<IconWithCurrentColor
|
|
124
|
+
icon={
|
|
125
|
+
isRTL()
|
|
126
|
+
? chevronLeft
|
|
127
|
+
: chevronRight
|
|
128
|
+
}
|
|
129
|
+
/>
|
|
130
|
+
</HStack>
|
|
131
|
+
</NavigationButtonAsItem>
|
|
132
|
+
</ItemGroup>
|
|
133
|
+
</CardBody>
|
|
134
|
+
<CardDivider />
|
|
135
|
+
</>
|
|
136
|
+
) }
|
|
137
|
+
</ItemGroup>
|
|
138
|
+
</>
|
|
69
139
|
);
|
|
70
140
|
}
|
|
71
141
|
|
|
@@ -1,17 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { useState } from '@wordpress/element';
|
|
5
|
+
import {
|
|
6
|
+
TextareaControl,
|
|
7
|
+
Panel,
|
|
8
|
+
PanelBody,
|
|
9
|
+
__experimentalVStack as VStack,
|
|
10
|
+
Tooltip,
|
|
11
|
+
Icon,
|
|
12
|
+
} from '@wordpress/components';
|
|
5
13
|
import { __ } from '@wordpress/i18n';
|
|
14
|
+
import {
|
|
15
|
+
experiments as blockEditorExperiments,
|
|
16
|
+
transformStyles,
|
|
17
|
+
} from '@wordpress/block-editor';
|
|
18
|
+
import { info } from '@wordpress/icons';
|
|
6
19
|
|
|
7
20
|
/**
|
|
8
21
|
* Internal dependencies
|
|
9
22
|
*/
|
|
10
|
-
import {
|
|
23
|
+
import { unlock } from '../../experiments';
|
|
24
|
+
import Subtitle from './subtitle';
|
|
11
25
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
26
|
+
const { useGlobalStyle } = unlock( blockEditorExperiments );
|
|
27
|
+
function CustomCSSControl( { blockName } ) {
|
|
28
|
+
// If blockName is defined, we are customizing CSS at the block level:
|
|
29
|
+
// styles.blocks.blockName.css
|
|
30
|
+
const block = !! blockName ? blockName : null;
|
|
31
|
+
|
|
32
|
+
const [ customCSS, setCustomCSS ] = useGlobalStyle( 'css', block );
|
|
33
|
+
const [ themeCSS ] = useGlobalStyle( 'css', block, 'base' );
|
|
34
|
+
const [ cssError, setCSSError ] = useState( null );
|
|
15
35
|
const ignoreThemeCustomCSS = '/* IgnoreThemeCustomCSS */';
|
|
16
36
|
|
|
17
37
|
// If there is custom css from theme.json show it in the edit box
|
|
@@ -32,6 +52,33 @@ function CustomCSSControl() {
|
|
|
32
52
|
return;
|
|
33
53
|
}
|
|
34
54
|
setCustomCSS( value );
|
|
55
|
+
if ( cssError ) {
|
|
56
|
+
const [ transformed ] = transformStyles(
|
|
57
|
+
[ { css: value } ],
|
|
58
|
+
'.editor-styles-wrapper'
|
|
59
|
+
);
|
|
60
|
+
if ( transformed ) {
|
|
61
|
+
setCSSError( null );
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function handleOnBlur( event ) {
|
|
67
|
+
if ( ! event?.target?.value ) {
|
|
68
|
+
setCSSError( null );
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const [ transformed ] = transformStyles(
|
|
73
|
+
[ { css: event.target.value } ],
|
|
74
|
+
'.editor-styles-wrapper'
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
setCSSError(
|
|
78
|
+
transformed === null
|
|
79
|
+
? __( 'There is an error with your CSS structure.' )
|
|
80
|
+
: null
|
|
81
|
+
);
|
|
35
82
|
}
|
|
36
83
|
|
|
37
84
|
const originalThemeCustomCSS =
|
|
@@ -41,20 +88,6 @@ function CustomCSSControl() {
|
|
|
41
88
|
|
|
42
89
|
return (
|
|
43
90
|
<>
|
|
44
|
-
<TextareaControl
|
|
45
|
-
__nextHasNoMarginBottom
|
|
46
|
-
value={
|
|
47
|
-
customCSS?.replace( ignoreThemeCustomCSS, '' ) ||
|
|
48
|
-
themeCustomCSS
|
|
49
|
-
}
|
|
50
|
-
onChange={ ( value ) => handleOnChange( value ) }
|
|
51
|
-
rows={ 15 }
|
|
52
|
-
className="edit-site-global-styles__custom-css-input"
|
|
53
|
-
spellCheck={ false }
|
|
54
|
-
help={ __(
|
|
55
|
-
"Enter your custom CSS in the textarea and preview in the editor. Changes won't take effect until you've saved the template."
|
|
56
|
-
) }
|
|
57
|
-
/>
|
|
58
91
|
{ originalThemeCustomCSS && (
|
|
59
92
|
<Panel>
|
|
60
93
|
<PanelBody
|
|
@@ -67,6 +100,30 @@ function CustomCSSControl() {
|
|
|
67
100
|
</PanelBody>
|
|
68
101
|
</Panel>
|
|
69
102
|
) }
|
|
103
|
+
<VStack spacing={ 3 }>
|
|
104
|
+
<Subtitle>{ __( 'ADDITIONAL CSS' ) }</Subtitle>
|
|
105
|
+
<TextareaControl
|
|
106
|
+
__nextHasNoMarginBottom
|
|
107
|
+
value={
|
|
108
|
+
customCSS?.replace( ignoreThemeCustomCSS, '' ) ||
|
|
109
|
+
themeCustomCSS
|
|
110
|
+
}
|
|
111
|
+
onChange={ ( value ) => handleOnChange( value ) }
|
|
112
|
+
onBlur={ handleOnBlur }
|
|
113
|
+
className="edit-site-global-styles__custom-css-input"
|
|
114
|
+
spellCheck={ false }
|
|
115
|
+
/>
|
|
116
|
+
{ cssError && (
|
|
117
|
+
<Tooltip text={ cssError }>
|
|
118
|
+
<div className="edit-site-global-styles__custom-css-validation-wrapper">
|
|
119
|
+
<Icon
|
|
120
|
+
icon={ info }
|
|
121
|
+
className="edit-site-global-styles__custom-css-validation-icon"
|
|
122
|
+
/>
|
|
123
|
+
</div>
|
|
124
|
+
</Tooltip>
|
|
125
|
+
) }
|
|
126
|
+
</VStack>
|
|
70
127
|
</>
|
|
71
128
|
);
|
|
72
129
|
}
|
|
@@ -18,15 +18,19 @@ import {
|
|
|
18
18
|
} from '@wordpress/components';
|
|
19
19
|
import {
|
|
20
20
|
__experimentalUseCustomSides as useCustomSides,
|
|
21
|
-
|
|
21
|
+
HeightControl,
|
|
22
22
|
__experimentalSpacingSizesControl as SpacingSizesControl,
|
|
23
|
+
experiments as blockEditorExperiments,
|
|
23
24
|
} from '@wordpress/block-editor';
|
|
24
25
|
import { Icon, positionCenter, stretchWide } from '@wordpress/icons';
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Internal dependencies
|
|
28
29
|
*/
|
|
29
|
-
import { getSupportedGlobalStylesPanels
|
|
30
|
+
import { getSupportedGlobalStylesPanels } from './hooks';
|
|
31
|
+
import { unlock } from '../../experiments';
|
|
32
|
+
|
|
33
|
+
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
|
|
30
34
|
|
|
31
35
|
const AXIAL_SIDES = [ 'horizontal', 'vertical' ];
|
|
32
36
|
|
|
@@ -50,50 +54,52 @@ export function useHasDimensionsPanel( name ) {
|
|
|
50
54
|
|
|
51
55
|
function useHasContentSize( name ) {
|
|
52
56
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
53
|
-
const [ settings ] =
|
|
57
|
+
const [ settings ] = useGlobalSetting( 'layout.contentSize', name );
|
|
54
58
|
|
|
55
59
|
return settings && supports.includes( 'contentSize' );
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
function useHasWideSize( name ) {
|
|
59
63
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
60
|
-
const [ settings ] =
|
|
64
|
+
const [ settings ] = useGlobalSetting( 'layout.wideSize', name );
|
|
61
65
|
|
|
62
66
|
return settings && supports.includes( 'wideSize' );
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
function useHasPadding( name ) {
|
|
66
70
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
67
|
-
const [ settings ] =
|
|
71
|
+
const [ settings ] = useGlobalSetting( 'spacing.padding', name );
|
|
68
72
|
|
|
69
73
|
return settings && supports.includes( 'padding' );
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
function useHasMargin( name ) {
|
|
73
77
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
74
|
-
const [ settings ] =
|
|
78
|
+
const [ settings ] = useGlobalSetting( 'spacing.margin', name );
|
|
75
79
|
|
|
76
80
|
return settings && supports.includes( 'margin' );
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
function useHasGap( name ) {
|
|
80
84
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
81
|
-
const [ settings ] =
|
|
85
|
+
const [ settings ] = useGlobalSetting( 'spacing.blockGap', name );
|
|
82
86
|
|
|
83
87
|
return settings && supports.includes( 'blockGap' );
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
function useHasMinHeight( name ) {
|
|
87
91
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
88
|
-
const [ settings ] =
|
|
92
|
+
const [ settings ] = useGlobalSetting( 'dimensions.minHeight', name );
|
|
89
93
|
|
|
90
94
|
return settings && supports.includes( 'minHeight' );
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
function useHasSpacingPresets() {
|
|
94
|
-
const [ settings ] =
|
|
98
|
+
const [ settings ] = useGlobalSetting( 'spacing.spacingSizes' );
|
|
99
|
+
const { custom, theme, default: defaultPresets } = settings || {};
|
|
100
|
+
const presets = custom ?? theme ?? defaultPresets ?? [];
|
|
95
101
|
|
|
96
|
-
return settings &&
|
|
102
|
+
return settings && presets.length > 0;
|
|
97
103
|
}
|
|
98
104
|
|
|
99
105
|
function filterValuesBySides( values, sides ) {
|
|
@@ -156,11 +162,11 @@ function splitGapValue( value ) {
|
|
|
156
162
|
|
|
157
163
|
// Props for managing `layout.contentSize`.
|
|
158
164
|
function useContentSizeProps( name ) {
|
|
159
|
-
const [ contentSizeValue, setContentSizeValue ] =
|
|
165
|
+
const [ contentSizeValue, setContentSizeValue ] = useGlobalSetting(
|
|
160
166
|
'layout.contentSize',
|
|
161
167
|
name
|
|
162
168
|
);
|
|
163
|
-
const [ userSetContentSizeValue ] =
|
|
169
|
+
const [ userSetContentSizeValue ] = useGlobalSetting(
|
|
164
170
|
'layout.contentSize',
|
|
165
171
|
name,
|
|
166
172
|
'user'
|
|
@@ -177,11 +183,11 @@ function useContentSizeProps( name ) {
|
|
|
177
183
|
|
|
178
184
|
// Props for managing `layout.wideSize`.
|
|
179
185
|
function useWideSizeProps( name ) {
|
|
180
|
-
const [ wideSizeValue, setWideSizeValue ] =
|
|
186
|
+
const [ wideSizeValue, setWideSizeValue ] = useGlobalSetting(
|
|
181
187
|
'layout.wideSize',
|
|
182
188
|
name
|
|
183
189
|
);
|
|
184
|
-
const [ userSetWideSizeValue ] =
|
|
190
|
+
const [ userSetWideSizeValue ] = useGlobalSetting(
|
|
185
191
|
'layout.wideSize',
|
|
186
192
|
name,
|
|
187
193
|
'user'
|
|
@@ -197,9 +203,10 @@ function useWideSizeProps( name ) {
|
|
|
197
203
|
}
|
|
198
204
|
|
|
199
205
|
// Props for managing `spacing.padding`.
|
|
200
|
-
function usePaddingProps( name,
|
|
201
|
-
const
|
|
202
|
-
|
|
206
|
+
function usePaddingProps( name, variation = '' ) {
|
|
207
|
+
const prefix = variation ? `variations.${ variation }.` : '';
|
|
208
|
+
const [ rawPadding, setRawPadding ] = useGlobalStyle(
|
|
209
|
+
prefix + 'spacing.padding',
|
|
203
210
|
name
|
|
204
211
|
);
|
|
205
212
|
const paddingValues = splitStyleValue( rawPadding );
|
|
@@ -213,8 +220,8 @@ function usePaddingProps( name, variationPath = '' ) {
|
|
|
213
220
|
setRawPadding( padding );
|
|
214
221
|
};
|
|
215
222
|
const resetPaddingValue = () => setPaddingValues( {} );
|
|
216
|
-
const [ userSetPaddingValue ] =
|
|
217
|
-
|
|
223
|
+
const [ userSetPaddingValue ] = useGlobalStyle(
|
|
224
|
+
prefix + 'spacing.padding',
|
|
218
225
|
name,
|
|
219
226
|
'user'
|
|
220
227
|
);
|
|
@@ -232,9 +239,10 @@ function usePaddingProps( name, variationPath = '' ) {
|
|
|
232
239
|
}
|
|
233
240
|
|
|
234
241
|
// Props for managing `spacing.margin`.
|
|
235
|
-
function useMarginProps( name,
|
|
236
|
-
const
|
|
237
|
-
|
|
242
|
+
function useMarginProps( name, variation = '' ) {
|
|
243
|
+
const prefix = variation ? `variations.${ variation }.` : '';
|
|
244
|
+
const [ rawMargin, setRawMargin ] = useGlobalStyle(
|
|
245
|
+
prefix + 'spacing.margin',
|
|
238
246
|
name
|
|
239
247
|
);
|
|
240
248
|
const marginValues = splitStyleValue( rawMargin );
|
|
@@ -262,9 +270,10 @@ function useMarginProps( name, variationPath = '' ) {
|
|
|
262
270
|
}
|
|
263
271
|
|
|
264
272
|
// Props for managing `spacing.blockGap`.
|
|
265
|
-
function useBlockGapProps( name,
|
|
266
|
-
const
|
|
267
|
-
|
|
273
|
+
function useBlockGapProps( name, variation = '' ) {
|
|
274
|
+
const prefix = variation ? `variations.${ variation }.` : '';
|
|
275
|
+
const [ gapValue, setGapValue ] = useGlobalStyle(
|
|
276
|
+
prefix + 'spacing.blockGap',
|
|
268
277
|
name
|
|
269
278
|
);
|
|
270
279
|
const gapValues = splitGapValue( gapValue );
|
|
@@ -272,8 +281,8 @@ function useBlockGapProps( name, variationPath = '' ) {
|
|
|
272
281
|
const isAxialGap =
|
|
273
282
|
gapSides && gapSides.some( ( side ) => AXIAL_SIDES.includes( side ) );
|
|
274
283
|
const resetGapValue = () => setGapValue( undefined );
|
|
275
|
-
const [ userSetGapValue ] =
|
|
276
|
-
|
|
284
|
+
const [ userSetGapValue ] = useGlobalStyle(
|
|
285
|
+
prefix + 'spacing.blockGap',
|
|
277
286
|
name,
|
|
278
287
|
'user'
|
|
279
288
|
);
|
|
@@ -305,9 +314,10 @@ function useBlockGapProps( name, variationPath = '' ) {
|
|
|
305
314
|
}
|
|
306
315
|
|
|
307
316
|
// Props for managing `dimensions.minHeight`.
|
|
308
|
-
function useMinHeightProps( name,
|
|
309
|
-
const
|
|
310
|
-
|
|
317
|
+
function useMinHeightProps( name, variation = '' ) {
|
|
318
|
+
const prefix = variation ? `variations.${ variation }.` : '';
|
|
319
|
+
const [ minHeightValue, setMinHeightValue ] = useGlobalStyle(
|
|
320
|
+
prefix + 'dimensions.minHeight',
|
|
311
321
|
name
|
|
312
322
|
);
|
|
313
323
|
const resetMinHeightValue = () => setMinHeightValue( undefined );
|
|
@@ -320,7 +330,7 @@ function useMinHeightProps( name, variationPath = '' ) {
|
|
|
320
330
|
};
|
|
321
331
|
}
|
|
322
332
|
|
|
323
|
-
export default function DimensionsPanel( { name,
|
|
333
|
+
export default function DimensionsPanel( { name, variation = '' } ) {
|
|
324
334
|
const showContentSizeControl = useHasContentSize( name );
|
|
325
335
|
const showWideSizeControl = useHasWideSize( name );
|
|
326
336
|
const showPaddingControl = useHasPadding( name );
|
|
@@ -329,7 +339,7 @@ export default function DimensionsPanel( { name, variationPath = '' } ) {
|
|
|
329
339
|
const showMinHeightControl = useHasMinHeight( name );
|
|
330
340
|
const showSpacingPresetsControl = useHasSpacingPresets();
|
|
331
341
|
const units = useCustomUnits( {
|
|
332
|
-
availableUnits:
|
|
342
|
+
availableUnits: useGlobalSetting( 'spacing.units', name )[ 0 ] || [
|
|
333
343
|
'%',
|
|
334
344
|
'px',
|
|
335
345
|
'em',
|
|
@@ -362,7 +372,7 @@ export default function DimensionsPanel( { name, variationPath = '' } ) {
|
|
|
362
372
|
setPaddingValues,
|
|
363
373
|
resetPaddingValue,
|
|
364
374
|
hasPaddingValue,
|
|
365
|
-
} = usePaddingProps( name,
|
|
375
|
+
} = usePaddingProps( name, variation );
|
|
366
376
|
|
|
367
377
|
// Props for managing `spacing.margin`.
|
|
368
378
|
const {
|
|
@@ -372,7 +382,7 @@ export default function DimensionsPanel( { name, variationPath = '' } ) {
|
|
|
372
382
|
setMarginValues,
|
|
373
383
|
resetMarginValue,
|
|
374
384
|
hasMarginValue,
|
|
375
|
-
} = useMarginProps( name,
|
|
385
|
+
} = useMarginProps( name, variation );
|
|
376
386
|
|
|
377
387
|
// Props for managing `spacing.blockGap`.
|
|
378
388
|
const {
|
|
@@ -384,7 +394,7 @@ export default function DimensionsPanel( { name, variationPath = '' } ) {
|
|
|
384
394
|
setGapValues,
|
|
385
395
|
resetGapValue,
|
|
386
396
|
hasGapValue,
|
|
387
|
-
} = useBlockGapProps( name,
|
|
397
|
+
} = useBlockGapProps( name, variation );
|
|
388
398
|
|
|
389
399
|
// Props for managing `dimensions.minHeight`.
|
|
390
400
|
const {
|
|
@@ -392,7 +402,7 @@ export default function DimensionsPanel( { name, variationPath = '' } ) {
|
|
|
392
402
|
setMinHeightValue,
|
|
393
403
|
resetMinHeightValue,
|
|
394
404
|
hasMinHeightValue,
|
|
395
|
-
} = useMinHeightProps( name,
|
|
405
|
+
} = useMinHeightProps( name, variation );
|
|
396
406
|
|
|
397
407
|
const resetAll = () => {
|
|
398
408
|
resetPaddingValue();
|
|
@@ -9,11 +9,15 @@ import { mergeWith, isEmpty, mapValues } from 'lodash';
|
|
|
9
9
|
import { useMemo, useCallback } from '@wordpress/element';
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
11
|
import { store as coreStore } from '@wordpress/core-data';
|
|
12
|
+
import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
15
16
|
*/
|
|
16
|
-
import
|
|
17
|
+
import CanvasSpinner from '../canvas-spinner';
|
|
18
|
+
import { unlock } from '../../experiments';
|
|
19
|
+
|
|
20
|
+
const { GlobalStylesContext } = unlock( blockEditorExperiments );
|
|
17
21
|
|
|
18
22
|
function mergeTreesCustomizer( _, srcValue ) {
|
|
19
23
|
// We only pass as arrays the presets,
|
|
@@ -165,7 +169,7 @@ function useGlobalStylesContext() {
|
|
|
165
169
|
export function GlobalStylesProvider( { children } ) {
|
|
166
170
|
const context = useGlobalStylesContext();
|
|
167
171
|
if ( ! context.isReady ) {
|
|
168
|
-
return
|
|
172
|
+
return <CanvasSpinner />;
|
|
169
173
|
}
|
|
170
174
|
|
|
171
175
|
return (
|
|
@@ -8,48 +8,54 @@ import {
|
|
|
8
8
|
DuotonePicker,
|
|
9
9
|
} from '@wordpress/components';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Internal dependencies
|
|
14
15
|
*/
|
|
15
|
-
import { useSetting } from './hooks';
|
|
16
16
|
import Subtitle from './subtitle';
|
|
17
|
+
import { unlock } from '../../experiments';
|
|
18
|
+
|
|
19
|
+
const { useGlobalSetting } = unlock( blockEditorExperiments );
|
|
17
20
|
|
|
18
21
|
const noop = () => {};
|
|
19
22
|
|
|
20
23
|
export default function GradientPalettePanel( { name } ) {
|
|
21
|
-
const [ themeGradients, setThemeGradients ] =
|
|
24
|
+
const [ themeGradients, setThemeGradients ] = useGlobalSetting(
|
|
22
25
|
'color.gradients.theme',
|
|
23
26
|
name
|
|
24
27
|
);
|
|
25
|
-
const [ baseThemeGradients ] =
|
|
28
|
+
const [ baseThemeGradients ] = useGlobalSetting(
|
|
26
29
|
'color.gradients.theme',
|
|
27
30
|
name,
|
|
28
31
|
'base'
|
|
29
32
|
);
|
|
30
|
-
const [ defaultGradients, setDefaultGradients ] =
|
|
33
|
+
const [ defaultGradients, setDefaultGradients ] = useGlobalSetting(
|
|
31
34
|
'color.gradients.default',
|
|
32
35
|
name
|
|
33
36
|
);
|
|
34
|
-
const [ baseDefaultGradients ] =
|
|
37
|
+
const [ baseDefaultGradients ] = useGlobalSetting(
|
|
35
38
|
'color.gradients.default',
|
|
36
39
|
name,
|
|
37
40
|
'base'
|
|
38
41
|
);
|
|
39
|
-
const [ customGradients, setCustomGradients ] =
|
|
42
|
+
const [ customGradients, setCustomGradients ] = useGlobalSetting(
|
|
40
43
|
'color.gradients.custom',
|
|
41
44
|
name
|
|
42
45
|
);
|
|
43
46
|
|
|
44
|
-
const [ defaultPaletteEnabled ] =
|
|
47
|
+
const [ defaultPaletteEnabled ] = useGlobalSetting(
|
|
45
48
|
'color.defaultGradients',
|
|
46
49
|
name
|
|
47
50
|
);
|
|
48
51
|
|
|
49
|
-
const [ customDuotone ] =
|
|
50
|
-
const [ defaultDuotone ] =
|
|
51
|
-
|
|
52
|
-
const [
|
|
52
|
+
const [ customDuotone ] = useGlobalSetting( 'color.duotone.custom' ) || [];
|
|
53
|
+
const [ defaultDuotone ] =
|
|
54
|
+
useGlobalSetting( 'color.duotone.default' ) || [];
|
|
55
|
+
const [ themeDuotone ] = useGlobalSetting( 'color.duotone.theme' ) || [];
|
|
56
|
+
const [ defaultDuotoneEnabled ] = useGlobalSetting(
|
|
57
|
+
'color.defaultDuotone'
|
|
58
|
+
);
|
|
53
59
|
|
|
54
60
|
const duotonePalette = [
|
|
55
61
|
...( customDuotone || [] ),
|