@wordpress/edit-site 5.1.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 +8 -0
- package/LICENSE.md +1 -1
- 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 -9
- package/build/components/add-new-template/new-template-part.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/editor-canvas.js +0 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +25 -59
- 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/block-editor/resize-handle.js +2 -1
- package/build/components/block-editor/resize-handle.js.map +1 -1
- 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 +10 -4
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +18 -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 +47 -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 +50 -27
- 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 +28 -13
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +4 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-border.js +16 -4
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +17 -9
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +59 -26
- 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 +24 -16
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +9 -3
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +19 -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 +15 -7
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +23 -11
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/screen-variations.js +71 -0
- package/build/components/global-styles/screen-variations.js.map +1 -0
- 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 +37 -22
- 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 +139 -21
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/utils.js +8 -290
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles/variations-panel.js +85 -0
- package/build/components/global-styles/variations-panel.js.map +1 -0
- 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 +86 -15
- 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} +3 -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 +11 -11
- 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/sync-state-with-url/use-sync-canvas-mode-with-url.js +54 -0
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build/components/template-details/edit-template-title.js +1 -0
- package/build/components/template-details/edit-template-title.js.map +1 -1
- package/build/components/template-details/template-part-area-selector.js +1 -0
- package/build/components/template-details/template-part-area-selector.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 +68 -9
- 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/reducer.js +1 -1
- package/build/store/reducer.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 +5 -9
- package/build-module/components/add-new-template/new-template-part.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/editor-canvas.js +0 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +27 -57
- 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/block-editor/resize-handle.js +2 -1
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- 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 +10 -4
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +18 -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 +46 -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 +50 -28
- 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 +27 -15
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +3 -1
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +14 -4
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +17 -11
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +56 -27
- 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 +24 -18
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +8 -3
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +19 -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 +15 -9
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +19 -10
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/screen-variations.js +54 -0
- package/build-module/components/global-styles/screen-variations.js.map +1 -0
- 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 +37 -24
- 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 +132 -22
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/utils.js +7 -277
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles/variations-panel.js +68 -0
- package/build-module/components/global-styles/variations-panel.js.map +1 -0
- 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 +86 -17
- 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} +3 -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 +12 -11
- 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/sync-state-with-url/use-sync-canvas-mode-with-url.js +43 -0
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build-module/components/template-details/edit-template-title.js +1 -0
- package/build-module/components/template-details/edit-template-title.js.map +1 -1
- package/build-module/components/template-details/template-part-area-selector.js +1 -0
- package/build-module/components/template-details/template-part-area-selector.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 +65 -6
- 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/reducer.js +1 -1
- package/build-module/store/reducer.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 +448 -278
- package/build-style/style.css +448 -278
- 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 +12 -11
- package/src/components/add-new-template/style.scss +0 -4
- package/src/components/app/index.js +2 -2
- package/src/components/block-editor/editor-canvas.js +0 -1
- package/src/components/block-editor/index.js +21 -77
- package/src/components/block-editor/inserter-media-categories.js +247 -0
- package/src/components/block-editor/resize-handle.js +6 -2
- package/src/components/block-editor/style.scss +55 -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 +5 -3
- 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 +16 -4
- package/src/components/global-styles/border-panel.js +22 -16
- package/src/components/global-styles/color-palette-panel.js +10 -7
- package/src/components/global-styles/context-menu.js +117 -41
- package/src/components/global-styles/custom-css.js +76 -19
- package/src/components/global-styles/dimensions-panel.js +58 -31
- 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 +42 -19
- package/src/components/global-styles/screen-block-list.js +6 -1
- package/src/components/global-styles/screen-border.js +13 -5
- package/src/components/global-styles/screen-button-color.js +21 -19
- package/src/components/global-styles/screen-colors.js +66 -22
- 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 +7 -4
- package/src/components/global-styles/screen-link-color.js +34 -22
- 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 -15
- package/src/components/global-styles/screen-typography.js +34 -12
- package/src/components/global-styles/screen-variations.js +47 -0
- package/src/components/global-styles/shadow-panel.js +174 -0
- package/src/components/global-styles/style.scss +94 -1
- package/src/components/global-styles/typography-panel.js +58 -23
- package/src/components/global-styles/typography-preview.js +28 -9
- package/src/components/global-styles/ui.js +130 -17
- package/src/components/global-styles/utils.js +7 -330
- package/src/components/global-styles/variations-panel.js +78 -0
- 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 +116 -21
- package/src/components/layout/style.scss +29 -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} +3 -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 +4 -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 +120 -109
- 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/sync-state-with-url/use-sync-canvas-mode-with-url.js +40 -0
- package/src/components/template-details/edit-template-title.js +1 -0
- package/src/components/template-details/template-part-area-selector.js +1 -0
- 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 +66 -8
- package/src/index.js +51 -59
- package/src/store/reducer.js +1 -1
- 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 -857
- 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 -815
- 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 -936
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -37
|
@@ -2,50 +2,62 @@
|
|
|
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
|
import { TabPanel } from '@wordpress/components';
|
|
10
|
+
|
|
7
11
|
/**
|
|
8
12
|
* Internal dependencies
|
|
9
13
|
*/
|
|
10
14
|
import ScreenHeader from './header';
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
useSetting,
|
|
14
|
-
useStyle,
|
|
15
|
-
useColorsPerOrigin,
|
|
16
|
-
} from './hooks';
|
|
15
|
+
import { getSupportedGlobalStylesPanels, useColorsPerOrigin } from './hooks';
|
|
16
|
+
import { unlock } from '../../experiments';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
const supports = getSupportedGlobalStylesPanels( name );
|
|
20
|
-
const [ solids ] = useSetting( 'color.palette', name );
|
|
21
|
-
const [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );
|
|
18
|
+
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
|
|
22
19
|
|
|
20
|
+
function ScreenLinkColor( { name, variation = '' } ) {
|
|
21
|
+
const prefix = variation ? `variations.${ variation }.` : '';
|
|
22
|
+
const supports = getSupportedGlobalStylesPanels( name );
|
|
23
|
+
const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
|
|
23
24
|
const colorsPerOrigin = useColorsPerOrigin( name );
|
|
24
|
-
|
|
25
|
-
const [ isLinkEnabled ] = useSetting( 'color.link', name );
|
|
25
|
+
const [ isLinkEnabled ] = useGlobalSetting( 'color.link', name );
|
|
26
26
|
|
|
27
27
|
const hasLinkColor =
|
|
28
28
|
supports.includes( 'linkColor' ) &&
|
|
29
29
|
isLinkEnabled &&
|
|
30
|
-
(
|
|
30
|
+
( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
|
|
31
31
|
|
|
32
32
|
const pseudoStates = {
|
|
33
33
|
default: {
|
|
34
34
|
label: __( 'Default' ),
|
|
35
|
-
value:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
value: useGlobalStyle(
|
|
36
|
+
prefix + 'elements.link.color.text',
|
|
37
|
+
name
|
|
38
|
+
)[ 0 ],
|
|
39
|
+
handler: useGlobalStyle(
|
|
40
|
+
prefix + 'elements.link.color.text',
|
|
41
|
+
name
|
|
42
|
+
)[ 1 ],
|
|
43
|
+
userValue: useGlobalStyle(
|
|
44
|
+
prefix + 'elements.link.color.text',
|
|
39
45
|
name,
|
|
40
46
|
'user'
|
|
41
47
|
)[ 0 ],
|
|
42
48
|
},
|
|
43
49
|
hover: {
|
|
44
50
|
label: __( 'Hover' ),
|
|
45
|
-
value:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
value: useGlobalStyle(
|
|
52
|
+
prefix + 'elements.link.:hover.color.text',
|
|
53
|
+
name
|
|
54
|
+
)[ 0 ],
|
|
55
|
+
handler: useGlobalStyle(
|
|
56
|
+
prefix + 'elements.link.:hover.color.text',
|
|
57
|
+
name
|
|
58
|
+
)[ 1 ],
|
|
59
|
+
userValue: useGlobalStyle(
|
|
60
|
+
prefix + 'elements.link.:hover.color.text',
|
|
49
61
|
name,
|
|
50
62
|
'user'
|
|
51
63
|
)[ 0 ],
|
|
@@ -16,6 +16,7 @@ import { isRTL, __ } from '@wordpress/i18n';
|
|
|
16
16
|
import { chevronLeft, chevronRight } from '@wordpress/icons';
|
|
17
17
|
import { useSelect } from '@wordpress/data';
|
|
18
18
|
import { store as coreStore } from '@wordpress/core-data';
|
|
19
|
+
import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Internal dependencies
|
|
@@ -24,19 +25,31 @@ import { IconWithCurrentColor } from './icon-with-current-color';
|
|
|
24
25
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
25
26
|
import ContextMenu from './context-menu';
|
|
26
27
|
import StylesPreview from './preview';
|
|
28
|
+
import { unlock } from '../../experiments';
|
|
27
29
|
|
|
28
30
|
function ScreenRoot() {
|
|
29
|
-
const {
|
|
31
|
+
const { useGlobalStyle } = unlock( blockEditorExperiments );
|
|
32
|
+
const [ customCSS ] = useGlobalStyle( 'css' );
|
|
33
|
+
|
|
34
|
+
const { variations, canEditCSS } = useSelect( ( select ) => {
|
|
35
|
+
const {
|
|
36
|
+
getEntityRecord,
|
|
37
|
+
__experimentalGetCurrentGlobalStylesId,
|
|
38
|
+
__experimentalGetCurrentThemeGlobalStylesVariations,
|
|
39
|
+
} = select( coreStore );
|
|
40
|
+
|
|
41
|
+
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
42
|
+
const globalStyles = globalStylesId
|
|
43
|
+
? getEntityRecord( 'root', 'globalStyles', globalStylesId )
|
|
44
|
+
: undefined;
|
|
45
|
+
|
|
30
46
|
return {
|
|
31
|
-
variations:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
).__experimentalGetCurrentThemeGlobalStylesVariations(),
|
|
47
|
+
variations: __experimentalGetCurrentThemeGlobalStylesVariations(),
|
|
48
|
+
canEditCSS:
|
|
49
|
+
!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,
|
|
35
50
|
};
|
|
36
51
|
}, [] );
|
|
37
52
|
|
|
38
|
-
const __experimentalGlobalStylesCustomCSS =
|
|
39
|
-
window?.__experimentalEnableGlobalStylesCustomCSS;
|
|
40
53
|
return (
|
|
41
54
|
<Card size="small">
|
|
42
55
|
<CardBody>
|
|
@@ -102,7 +115,7 @@ function ScreenRoot() {
|
|
|
102
115
|
</ItemGroup>
|
|
103
116
|
</CardBody>
|
|
104
117
|
|
|
105
|
-
{
|
|
118
|
+
{ canEditCSS && !! customCSS && (
|
|
106
119
|
<>
|
|
107
120
|
<CardDivider />
|
|
108
121
|
<CardBody>
|
|
@@ -122,7 +135,9 @@ function ScreenRoot() {
|
|
|
122
135
|
aria-label={ __( 'Additional CSS' ) }
|
|
123
136
|
>
|
|
124
137
|
<HStack justify="space-between">
|
|
125
|
-
<FlexItem>
|
|
138
|
+
<FlexItem>
|
|
139
|
+
{ __( 'Additional CSS' ) }
|
|
140
|
+
</FlexItem>
|
|
126
141
|
<IconWithCurrentColor
|
|
127
142
|
icon={
|
|
128
143
|
isRTL() ? chevronLeft : chevronRight
|
|
@@ -23,15 +23,20 @@ import {
|
|
|
23
23
|
CardBody,
|
|
24
24
|
} from '@wordpress/components';
|
|
25
25
|
import { __ } from '@wordpress/i18n';
|
|
26
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
store as blockEditorStore,
|
|
28
|
+
experiments as blockEditorExperiments,
|
|
29
|
+
} from '@wordpress/block-editor';
|
|
27
30
|
|
|
28
31
|
/**
|
|
29
32
|
* Internal dependencies
|
|
30
33
|
*/
|
|
31
34
|
import { mergeBaseAndUserConfigs } from './global-styles-provider';
|
|
32
|
-
import { GlobalStylesContext } from './context';
|
|
33
35
|
import StylesPreview from './preview';
|
|
34
36
|
import ScreenHeader from './header';
|
|
37
|
+
import { unlock } from '../../experiments';
|
|
38
|
+
|
|
39
|
+
const { GlobalStylesContext } = unlock( blockEditorExperiments );
|
|
35
40
|
|
|
36
41
|
function compareVariations( a, b ) {
|
|
37
42
|
return (
|
|
@@ -2,34 +2,34 @@
|
|
|
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 );
|
|
22
|
-
const [ isTextEnabled ] = useSetting( 'color.text', name );
|
|
17
|
+
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
|
|
23
18
|
|
|
19
|
+
function ScreenTextColor( { name, variation = '' } ) {
|
|
20
|
+
const prefix = variation ? `variations.${ variation }.` : '';
|
|
21
|
+
const supports = getSupportedGlobalStylesPanels( name );
|
|
22
|
+
const [ areCustomSolidsEnabled ] = useGlobalSetting( 'color.custom', name );
|
|
23
|
+
const [ isTextEnabled ] = useGlobalSetting( 'color.text', name );
|
|
24
24
|
const colorsPerOrigin = useColorsPerOrigin( name );
|
|
25
25
|
|
|
26
26
|
const hasTextColor =
|
|
27
27
|
supports.includes( 'color' ) &&
|
|
28
28
|
isTextEnabled &&
|
|
29
|
-
(
|
|
29
|
+
( colorsPerOrigin.length > 0 || areCustomSolidsEnabled );
|
|
30
30
|
|
|
31
|
-
const [ color, setColor ] =
|
|
32
|
-
const [ userColor ] =
|
|
31
|
+
const [ color, setColor ] = useGlobalStyle( prefix + 'color.text', name );
|
|
32
|
+
const [ userColor ] = useGlobalStyle( prefix + 'color.text', name, 'user' );
|
|
33
33
|
|
|
34
34
|
if ( ! hasTextColor ) {
|
|
35
35
|
return null;
|
|
@@ -8,16 +8,20 @@ import {
|
|
|
8
8
|
__experimentalHStack as HStack,
|
|
9
9
|
FlexItem,
|
|
10
10
|
} from '@wordpress/components';
|
|
11
|
+
import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Internal dependencies
|
|
14
15
|
*/
|
|
15
16
|
import ScreenHeader from './header';
|
|
16
17
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
17
|
-
import { useStyle } from './hooks';
|
|
18
18
|
import Subtitle from './subtitle';
|
|
19
19
|
import TypographyPanel from './typography-panel';
|
|
20
20
|
import BlockPreviewPanel from './block-preview-panel';
|
|
21
|
+
import { getVariationClassName } from './utils';
|
|
22
|
+
import { unlock } from '../../experiments';
|
|
23
|
+
|
|
24
|
+
const { useGlobalStyle } = unlock( blockEditorExperiments );
|
|
21
25
|
|
|
22
26
|
function Item( { name, parentMenu, element, label } ) {
|
|
23
27
|
const hasSupport = ! name;
|
|
@@ -29,16 +33,28 @@ function Item( { name, parentMenu, element, label } ) {
|
|
|
29
33
|
textDecoration: 'underline',
|
|
30
34
|
}
|
|
31
35
|
: {};
|
|
32
|
-
const [ fontFamily ] =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
const [ fontFamily ] = useGlobalStyle(
|
|
37
|
+
prefix + 'typography.fontFamily',
|
|
38
|
+
name
|
|
39
|
+
);
|
|
40
|
+
const [ fontStyle ] = useGlobalStyle(
|
|
41
|
+
prefix + 'typography.fontStyle',
|
|
42
|
+
name
|
|
43
|
+
);
|
|
44
|
+
const [ fontWeight ] = useGlobalStyle(
|
|
45
|
+
prefix + 'typography.fontWeight',
|
|
46
|
+
name
|
|
47
|
+
);
|
|
48
|
+
const [ letterSpacing ] = useGlobalStyle(
|
|
36
49
|
prefix + 'typography.letterSpacing',
|
|
37
50
|
name
|
|
38
51
|
);
|
|
39
|
-
const [ backgroundColor ] =
|
|
40
|
-
|
|
41
|
-
|
|
52
|
+
const [ backgroundColor ] = useGlobalStyle(
|
|
53
|
+
prefix + 'color.background',
|
|
54
|
+
name
|
|
55
|
+
);
|
|
56
|
+
const [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient', name );
|
|
57
|
+
const [ color ] = useGlobalStyle( prefix + 'color.text', name );
|
|
42
58
|
|
|
43
59
|
if ( ! hasSupport ) {
|
|
44
60
|
return null;
|
|
@@ -76,9 +92,9 @@ function Item( { name, parentMenu, element, label } ) {
|
|
|
76
92
|
);
|
|
77
93
|
}
|
|
78
94
|
|
|
79
|
-
function ScreenTypography( { name } ) {
|
|
95
|
+
function ScreenTypography( { name, variation = '' } ) {
|
|
80
96
|
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
81
|
-
|
|
97
|
+
const variationClassName = getVariationClassName( variation );
|
|
82
98
|
return (
|
|
83
99
|
<>
|
|
84
100
|
<ScreenHeader
|
|
@@ -88,7 +104,7 @@ function ScreenTypography( { name } ) {
|
|
|
88
104
|
) }
|
|
89
105
|
/>
|
|
90
106
|
|
|
91
|
-
<BlockPreviewPanel name={ name } />
|
|
107
|
+
<BlockPreviewPanel name={ name } variation={ variationClassName } />
|
|
92
108
|
|
|
93
109
|
{ ! name && (
|
|
94
110
|
<div className="edit-site-global-styles-screen-typography">
|
|
@@ -124,7 +140,13 @@ function ScreenTypography( { name } ) {
|
|
|
124
140
|
</div>
|
|
125
141
|
) }
|
|
126
142
|
{ /* No typography elements support yet for blocks. */ }
|
|
127
|
-
{ !! name &&
|
|
143
|
+
{ !! name && (
|
|
144
|
+
<TypographyPanel
|
|
145
|
+
name={ name }
|
|
146
|
+
variation={ variation }
|
|
147
|
+
element="text"
|
|
148
|
+
/>
|
|
149
|
+
) }
|
|
128
150
|
</>
|
|
129
151
|
);
|
|
130
152
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { __experimentalVStack as VStack } from '@wordpress/components';
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
VariationPanel,
|
|
11
|
+
VariationsPanel,
|
|
12
|
+
useHasVariationsPanel,
|
|
13
|
+
} from './variations-panel';
|
|
14
|
+
import ScreenHeader from './header';
|
|
15
|
+
import BlockPreviewPanel from './block-preview-panel';
|
|
16
|
+
import Subtitle from './subtitle';
|
|
17
|
+
|
|
18
|
+
export function ScreenVariations( { name, path = '' } ) {
|
|
19
|
+
const hasVariationsPanel = useHasVariationsPanel( name, path );
|
|
20
|
+
|
|
21
|
+
if ( ! hasVariationsPanel ) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return (
|
|
25
|
+
<div className="edit-site-global-styles-screen-variations">
|
|
26
|
+
<VStack spacing={ 3 }>
|
|
27
|
+
<p>Manage style variations, saved block appearence presets.</p>
|
|
28
|
+
<Subtitle>{ __( 'Style Variations' ) }</Subtitle>
|
|
29
|
+
<VariationsPanel name={ name } />
|
|
30
|
+
</VStack>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function ScreenVariation( { blockName, style } ) {
|
|
36
|
+
const { name: styleName, label: styleLabel } = style;
|
|
37
|
+
return (
|
|
38
|
+
<>
|
|
39
|
+
<ScreenHeader title={ styleLabel } />
|
|
40
|
+
<BlockPreviewPanel
|
|
41
|
+
name={ blockName }
|
|
42
|
+
variation={ `is-style-${ styleName }` }
|
|
43
|
+
/>
|
|
44
|
+
<VariationPanel blockName={ blockName } styleName={ styleName } />
|
|
45
|
+
</>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
11
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
12
|
+
__experimentalItemGroup as ItemGroup,
|
|
13
|
+
__experimentalHStack as HStack,
|
|
14
|
+
__experimentalVStack as VStack,
|
|
15
|
+
__experimentalGrid as Grid,
|
|
16
|
+
__experimentalHeading as Heading,
|
|
17
|
+
FlexItem,
|
|
18
|
+
Dropdown,
|
|
19
|
+
__experimentalDropdownContentWrapper as DropdownContentWrapper,
|
|
20
|
+
Button,
|
|
21
|
+
} from '@wordpress/components';
|
|
22
|
+
import { __ } from '@wordpress/i18n';
|
|
23
|
+
import { shadow as shadowIcon, Icon, check } from '@wordpress/icons';
|
|
24
|
+
import { useCallback } from '@wordpress/element';
|
|
25
|
+
import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Internal dependencies
|
|
29
|
+
*/
|
|
30
|
+
import { getSupportedGlobalStylesPanels } from './hooks';
|
|
31
|
+
import { IconWithCurrentColor } from './icon-with-current-color';
|
|
32
|
+
import { unlock } from '../../experiments';
|
|
33
|
+
|
|
34
|
+
const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );
|
|
35
|
+
|
|
36
|
+
export function useHasShadowControl( name ) {
|
|
37
|
+
const supports = getSupportedGlobalStylesPanels( name );
|
|
38
|
+
return supports.includes( 'shadow' );
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default function ShadowPanel( { name, variation = '' } ) {
|
|
42
|
+
const prefix = variation ? `variations.${ variation }.` : '';
|
|
43
|
+
const [ shadow, setShadow ] = useGlobalStyle( `${ prefix }shadow`, name );
|
|
44
|
+
const [ userShadow ] = useGlobalStyle( `${ prefix }shadow`, name, 'user' );
|
|
45
|
+
const hasShadow = () => !! userShadow;
|
|
46
|
+
|
|
47
|
+
const resetShadow = () => setShadow( undefined );
|
|
48
|
+
const resetAll = useCallback(
|
|
49
|
+
() => resetShadow( undefined ),
|
|
50
|
+
[ resetShadow ]
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<ToolsPanel label={ __( 'Shadow' ) } resetAll={ resetAll }>
|
|
55
|
+
<ToolsPanelItem
|
|
56
|
+
label={ __( 'Shadow' ) }
|
|
57
|
+
hasValue={ hasShadow }
|
|
58
|
+
onDeselect={ resetShadow }
|
|
59
|
+
isShownByDefault
|
|
60
|
+
>
|
|
61
|
+
<ItemGroup isBordered isSeparated>
|
|
62
|
+
<ShadowPopover
|
|
63
|
+
shadow={ shadow }
|
|
64
|
+
onShadowChange={ setShadow }
|
|
65
|
+
/>
|
|
66
|
+
</ItemGroup>
|
|
67
|
+
</ToolsPanelItem>
|
|
68
|
+
</ToolsPanel>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const ShadowPopover = ( { shadow, onShadowChange } ) => {
|
|
73
|
+
const popoverProps = {
|
|
74
|
+
placement: 'left-start',
|
|
75
|
+
offset: 36,
|
|
76
|
+
shift: true,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<Dropdown
|
|
81
|
+
popoverProps={ popoverProps }
|
|
82
|
+
className="edit-site-global-styles__shadow-dropdown"
|
|
83
|
+
renderToggle={ renderShadowToggle() }
|
|
84
|
+
renderContent={ () => (
|
|
85
|
+
<DropdownContentWrapper paddingSize="medium">
|
|
86
|
+
<ShadowPopoverContainer
|
|
87
|
+
shadow={ shadow }
|
|
88
|
+
onShadowChange={ onShadowChange }
|
|
89
|
+
/>
|
|
90
|
+
</DropdownContentWrapper>
|
|
91
|
+
) }
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
function renderShadowToggle() {
|
|
97
|
+
return ( { onToggle, isOpen } ) => {
|
|
98
|
+
const toggleProps = {
|
|
99
|
+
onClick: onToggle,
|
|
100
|
+
className: classnames( { 'is-open': isOpen } ),
|
|
101
|
+
'aria-expanded': isOpen,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<Button { ...toggleProps }>
|
|
106
|
+
<HStack justify="flex-start">
|
|
107
|
+
<IconWithCurrentColor icon={ shadowIcon } size={ 24 } />
|
|
108
|
+
<FlexItem className="edit-site-global-styles__shadow-label">
|
|
109
|
+
{ __( 'Shadow' ) }
|
|
110
|
+
</FlexItem>
|
|
111
|
+
</HStack>
|
|
112
|
+
</Button>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function ShadowPopoverContainer( { shadow, onShadowChange } ) {
|
|
118
|
+
const [ defaultShadows ] = useGlobalSetting( 'shadow.presets.default' );
|
|
119
|
+
const [ themeShadows ] = useGlobalSetting( 'shadow.presets.theme' );
|
|
120
|
+
const [ defaultPresetsEnabled ] = useGlobalSetting(
|
|
121
|
+
'shadow.defaultPresets'
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const shadows = [
|
|
125
|
+
...( defaultPresetsEnabled ? defaultShadows : [] ),
|
|
126
|
+
...( themeShadows || [] ),
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<div className="edit-site-global-styles__shadow-panel">
|
|
131
|
+
<VStack spacing={ 4 }>
|
|
132
|
+
<Heading level={ 5 }>{ __( 'Shadows' ) }</Heading>
|
|
133
|
+
<ShadowPresets
|
|
134
|
+
presets={ shadows }
|
|
135
|
+
activeShadow={ shadow }
|
|
136
|
+
onSelect={ onShadowChange }
|
|
137
|
+
/>
|
|
138
|
+
</VStack>
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function ShadowPresets( { presets, activeShadow, onSelect } ) {
|
|
144
|
+
return ! presets ? null : (
|
|
145
|
+
<Grid columns={ 6 } gap={ 0 } align="center" justify="center">
|
|
146
|
+
{ presets.map( ( { name, shadow }, i ) => (
|
|
147
|
+
<ShadowIndicator
|
|
148
|
+
key={ i }
|
|
149
|
+
label={ name }
|
|
150
|
+
isActive={ shadow === activeShadow }
|
|
151
|
+
onSelect={ () =>
|
|
152
|
+
onSelect( shadow === activeShadow ? undefined : shadow )
|
|
153
|
+
}
|
|
154
|
+
shadow={ shadow }
|
|
155
|
+
/>
|
|
156
|
+
) ) }
|
|
157
|
+
</Grid>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function ShadowIndicator( { label, isActive, onSelect, shadow } ) {
|
|
162
|
+
return (
|
|
163
|
+
<div className="edit-site-global-styles__shadow-indicator-wrapper">
|
|
164
|
+
<Button
|
|
165
|
+
className="edit-site-global-styles__shadow-indicator"
|
|
166
|
+
onClick={ onSelect }
|
|
167
|
+
aria-label={ label }
|
|
168
|
+
style={ { boxShadow: shadow } }
|
|
169
|
+
>
|
|
170
|
+
{ isActive && <Icon icon={ check } /> }
|
|
171
|
+
</Button>
|
|
172
|
+
</div>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
@@ -84,7 +84,8 @@ $block-preview-height: 150px;
|
|
|
84
84
|
|
|
85
85
|
.edit-site-screen-text-color__control,
|
|
86
86
|
.edit-site-screen-link-color__control,
|
|
87
|
-
.edit-site-screen-button-color__control
|
|
87
|
+
.edit-site-screen-button-color__control,
|
|
88
|
+
.edit-site-screen-background-color__control.has-no-tabs {
|
|
88
89
|
padding: $grid-unit-20;
|
|
89
90
|
}
|
|
90
91
|
|
|
@@ -135,10 +136,46 @@ $block-preview-height: 150px;
|
|
|
135
136
|
border-radius: $radius-block-ui;
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
.edit-site-global-styles-screen-css {
|
|
140
|
+
flex: 1 1 auto;
|
|
141
|
+
display: flex;
|
|
142
|
+
flex-direction: column;
|
|
143
|
+
|
|
144
|
+
.components-v-stack {
|
|
145
|
+
flex: 1 1 auto;
|
|
146
|
+
|
|
147
|
+
.edit-site-global-styles__custom-css-input {
|
|
148
|
+
flex: 1 1 auto;
|
|
149
|
+
display: flex;
|
|
150
|
+
flex-direction: column;
|
|
151
|
+
|
|
152
|
+
.components-base-control__field {
|
|
153
|
+
flex: 1 1 auto;
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-direction: column;
|
|
156
|
+
|
|
157
|
+
.components-textarea-control__input {
|
|
158
|
+
flex: 1 1 auto;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
138
165
|
.edit-site-global-styles__custom-css-input textarea {
|
|
139
166
|
font-family: $editor_html_font;
|
|
140
167
|
}
|
|
141
168
|
|
|
169
|
+
.edit-site-global-styles__custom-css-validation-wrapper {
|
|
170
|
+
position: absolute;
|
|
171
|
+
bottom: $grid-unit-20;
|
|
172
|
+
right: $grid-unit * 3;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.edit-site-global-styles__custom-css-validation-icon {
|
|
176
|
+
fill: $alert-red;
|
|
177
|
+
}
|
|
178
|
+
|
|
142
179
|
.edit-site-global-styles__custom-css-theme-css {
|
|
143
180
|
width: 100%;
|
|
144
181
|
line-break: anywhere;
|
|
@@ -146,3 +183,59 @@ $block-preview-height: 150px;
|
|
|
146
183
|
max-height: 200px;
|
|
147
184
|
overflow-y: scroll;
|
|
148
185
|
}
|
|
186
|
+
|
|
187
|
+
.edit-site-global-styles-screen-css-help-link {
|
|
188
|
+
padding-left: $grid-unit-20;
|
|
189
|
+
}
|
|
190
|
+
.edit-site-global-styles-screen-variations {
|
|
191
|
+
margin-top: $grid-unit-20;
|
|
192
|
+
border-top: 1px solid $gray-300;
|
|
193
|
+
|
|
194
|
+
& > * {
|
|
195
|
+
margin: $grid-unit-30 $grid-unit-20;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.edit-site-global-styles-sidebar__navigator-screen {
|
|
200
|
+
display: flex;
|
|
201
|
+
flex-direction: column;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.edit-site-global-styles__shadow-panel {
|
|
205
|
+
width: 230px;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.edit-site-global-styles__shadow-dropdown {
|
|
209
|
+
display: block;
|
|
210
|
+
padding: 0;
|
|
211
|
+
|
|
212
|
+
> button {
|
|
213
|
+
width: 100%;
|
|
214
|
+
padding: $grid-unit-10;
|
|
215
|
+
|
|
216
|
+
&.is-open {
|
|
217
|
+
background-color: $gray-100;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// wrapper to clip the shadow beyond 6px
|
|
223
|
+
.edit-site-global-styles__shadow-indicator-wrapper {
|
|
224
|
+
padding: 6px;
|
|
225
|
+
overflow: hidden;
|
|
226
|
+
display: flex;
|
|
227
|
+
align-items: center;
|
|
228
|
+
justify-content: center;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// These styles are similar to the color palette.
|
|
232
|
+
.edit-site-global-styles__shadow-indicator {
|
|
233
|
+
color: $gray-800;
|
|
234
|
+
border: $gray-200 $border-width solid;
|
|
235
|
+
border-radius: $radius-block-ui;
|
|
236
|
+
cursor: pointer;
|
|
237
|
+
padding: 0;
|
|
238
|
+
|
|
239
|
+
height: 24px;
|
|
240
|
+
width: 24px;
|
|
241
|
+
}
|