@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,11 +1,13 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
7
|
-
import { typography, border, color, layout } from '@wordpress/icons';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { __experimentalItemGroup as ItemGroup, __experimentalHStack as HStack, __experimentalSpacer as Spacer, FlexItem, CardBody, CardDivider } from '@wordpress/components';
|
|
7
|
+
import { typography, border, color, layout, chevronLeft, chevronRight } from '@wordpress/icons';
|
|
8
|
+
import { isRTL, __ } from '@wordpress/i18n';
|
|
9
|
+
import { useSelect } from '@wordpress/data';
|
|
10
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
9
11
|
/**
|
|
10
12
|
* Internal dependencies
|
|
11
13
|
*/
|
|
@@ -16,6 +18,7 @@ import { useHasDimensionsPanel } from './dimensions-panel';
|
|
|
16
18
|
import { useHasTypographyPanel } from './typography-panel';
|
|
17
19
|
import { useHasVariationsPanel } from './variations-panel';
|
|
18
20
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
21
|
+
import { IconWithCurrentColor } from './icon-with-current-color';
|
|
19
22
|
import { ScreenVariations } from './screen-variations';
|
|
20
23
|
|
|
21
24
|
function ContextMenu(_ref) {
|
|
@@ -29,7 +32,25 @@ function ContextMenu(_ref) {
|
|
|
29
32
|
const hasDimensionsPanel = useHasDimensionsPanel(name);
|
|
30
33
|
const hasLayoutPanel = hasDimensionsPanel;
|
|
31
34
|
const hasVariationsPanel = useHasVariationsPanel(name, parentMenu);
|
|
32
|
-
|
|
35
|
+
const {
|
|
36
|
+
canEditCSS
|
|
37
|
+
} = useSelect(select => {
|
|
38
|
+
var _globalStyles$_links$, _globalStyles$_links;
|
|
39
|
+
|
|
40
|
+
const {
|
|
41
|
+
getEntityRecord,
|
|
42
|
+
__experimentalGetCurrentGlobalStylesId
|
|
43
|
+
} = select(coreStore);
|
|
44
|
+
|
|
45
|
+
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
46
|
+
|
|
47
|
+
const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
|
|
48
|
+
return {
|
|
49
|
+
canEditCSS: (_globalStyles$_links$ = !!(globalStyles !== null && globalStyles !== void 0 && (_globalStyles$_links = globalStyles._links) !== null && _globalStyles$_links !== void 0 && _globalStyles$_links['wp:action-edit-css'])) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : false
|
|
50
|
+
};
|
|
51
|
+
}, []);
|
|
52
|
+
const isBlocksPanel = parentMenu.includes('blocks') && !parentMenu.includes('variations');
|
|
53
|
+
return createElement(Fragment, null, createElement(ItemGroup, null, hasTypographyPanel && createElement(NavigationButtonAsItem, {
|
|
33
54
|
icon: typography,
|
|
34
55
|
path: parentMenu + '/typography',
|
|
35
56
|
"aria-label": __('Typography styles')
|
|
@@ -40,15 +61,26 @@ function ContextMenu(_ref) {
|
|
|
40
61
|
}, __('Colors')), hasBorderPanel && createElement(NavigationButtonAsItem, {
|
|
41
62
|
icon: border,
|
|
42
63
|
path: parentMenu + '/border',
|
|
43
|
-
"aria-label": __('Border styles')
|
|
44
|
-
}, __('Border')), hasLayoutPanel && createElement(NavigationButtonAsItem, {
|
|
64
|
+
"aria-label": __('Border & shadow styles')
|
|
65
|
+
}, __('Border & Shadow')), hasLayoutPanel && createElement(NavigationButtonAsItem, {
|
|
45
66
|
icon: layout,
|
|
46
67
|
path: parentMenu + '/layout',
|
|
47
68
|
"aria-label": __('Layout styles')
|
|
48
69
|
}, __('Layout')), hasVariationsPanel && createElement(ScreenVariations, {
|
|
49
70
|
name: name,
|
|
50
71
|
path: parentMenu
|
|
51
|
-
}))
|
|
72
|
+
}), isBlocksPanel && canEditCSS && createElement(Fragment, null, createElement(CardDivider, null), createElement(CardBody, null, createElement(Spacer, {
|
|
73
|
+
as: "p",
|
|
74
|
+
paddingTop: 2,
|
|
75
|
+
marginBottom: 4
|
|
76
|
+
}, __('Add your own CSS to customize the block appearance.')), createElement(ItemGroup, null, createElement(NavigationButtonAsItem, {
|
|
77
|
+
path: parentMenu + '/css',
|
|
78
|
+
"aria-label": __('Additional block CSS')
|
|
79
|
+
}, createElement(HStack, {
|
|
80
|
+
justify: "space-between"
|
|
81
|
+
}, createElement(FlexItem, null, __('Additional block CSS')), createElement(IconWithCurrentColor, {
|
|
82
|
+
icon: isRTL() ? chevronLeft : chevronRight
|
|
83
|
+
}))))), createElement(CardDivider, null))));
|
|
52
84
|
}
|
|
53
85
|
|
|
54
86
|
export default ContextMenu;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/context-menu.js"],"names":["__experimentalItemGroup","ItemGroup","typography","border","color","layout","__","useHasBorderPanel","useHasColorPanel","useHasDimensionsPanel","useHasTypographyPanel","useHasVariationsPanel","NavigationButtonAsItem","ScreenVariations","ContextMenu","name","parentMenu","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","hasVariationsPanel"],"mappings":";;AAAA;AACA;AACA;AACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/context-menu.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalHStack","HStack","__experimentalSpacer","Spacer","FlexItem","CardBody","CardDivider","typography","border","color","layout","chevronLeft","chevronRight","isRTL","__","useSelect","store","coreStore","useHasBorderPanel","useHasColorPanel","useHasDimensionsPanel","useHasTypographyPanel","useHasVariationsPanel","NavigationButtonAsItem","IconWithCurrentColor","ScreenVariations","ContextMenu","name","parentMenu","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","hasVariationsPanel","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","isBlocksPanel","includes"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalSpacer as Spacer,\n\tFlexItem,\n\tCardBody,\n\tCardDivider,\n} from '@wordpress/components';\nimport {\n\ttypography,\n\tborder,\n\tcolor,\n\tlayout,\n\tchevronLeft,\n\tchevronRight,\n} from '@wordpress/icons';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useHasBorderPanel } from './border-panel';\nimport { useHasColorPanel } from './color-utils';\nimport { useHasDimensionsPanel } from './dimensions-panel';\nimport { useHasTypographyPanel } from './typography-panel';\nimport { useHasVariationsPanel } from './variations-panel';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { IconWithCurrentColor } from './icon-with-current-color';\nimport { ScreenVariations } from './screen-variations';\n\nfunction ContextMenu( { name, parentMenu = '' } ) {\n\tconst hasTypographyPanel = useHasTypographyPanel( name );\n\tconst hasColorPanel = useHasColorPanel( name );\n\tconst hasBorderPanel = useHasBorderPanel( name );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( name );\n\tconst hasLayoutPanel = hasDimensionsPanel;\n\tconst hasVariationsPanel = useHasVariationsPanel( name, parentMenu );\n\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\n\tconst isBlocksPanel =\n\t\tparentMenu.includes( 'blocks' ) &&\n\t\t! parentMenu.includes( 'variations' );\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup>\n\t\t\t\t{ hasTypographyPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ typography }\n\t\t\t\t\t\tpath={ parentMenu + '/typography' }\n\t\t\t\t\t\taria-label={ __( 'Typography styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Typography' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasColorPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ color }\n\t\t\t\t\t\tpath={ parentMenu + '/colors' }\n\t\t\t\t\t\taria-label={ __( 'Colors styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Colors' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasBorderPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ border }\n\t\t\t\t\t\tpath={ parentMenu + '/border' }\n\t\t\t\t\t\taria-label={ __( 'Border & shadow styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Border & Shadow' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasLayoutPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\tpath={ parentMenu + '/layout' }\n\t\t\t\t\t\taria-label={ __( 'Layout styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Layout' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasVariationsPanel && (\n\t\t\t\t\t<ScreenVariations name={ name } path={ parentMenu } />\n\t\t\t\t) }\n\t\t\t\t{ isBlocksPanel && canEditCSS && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<CardDivider />\n\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t<Spacer as=\"p\" paddingTop={ 2 } marginBottom={ 4 }>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Add your own CSS to customize the block appearance.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\t\t\t\tpath={ parentMenu + '/css' }\n\t\t\t\t\t\t\t\t\taria-label={ __( 'Additional block CSS' ) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Additional block CSS' ) }\n\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t<IconWithCurrentColor\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t\t<CardDivider />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\nexport default ContextMenu;\n"]}
|
|
@@ -3,17 +3,31 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { useState } from '@wordpress/element';
|
|
7
|
+
import { TextareaControl, Panel, PanelBody, __experimentalVStack as VStack, Tooltip, Icon } from '@wordpress/components';
|
|
7
8
|
import { __ } from '@wordpress/i18n';
|
|
9
|
+
import { experiments as blockEditorExperiments, transformStyles } from '@wordpress/block-editor';
|
|
10
|
+
import { info } from '@wordpress/icons';
|
|
8
11
|
/**
|
|
9
12
|
* Internal dependencies
|
|
10
13
|
*/
|
|
11
14
|
|
|
12
|
-
import {
|
|
15
|
+
import { unlock } from '../../experiments';
|
|
16
|
+
import Subtitle from './subtitle';
|
|
17
|
+
const {
|
|
18
|
+
useGlobalStyle
|
|
19
|
+
} = unlock(blockEditorExperiments);
|
|
13
20
|
|
|
14
|
-
function CustomCSSControl() {
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
function CustomCSSControl(_ref) {
|
|
22
|
+
let {
|
|
23
|
+
blockName
|
|
24
|
+
} = _ref;
|
|
25
|
+
// If blockName is defined, we are customizing CSS at the block level:
|
|
26
|
+
// styles.blocks.blockName.css
|
|
27
|
+
const block = !!blockName ? blockName : null;
|
|
28
|
+
const [customCSS, setCustomCSS] = useGlobalStyle('css', block);
|
|
29
|
+
const [themeCSS] = useGlobalStyle('css', block, 'base');
|
|
30
|
+
const [cssError, setCSSError] = useState(null);
|
|
17
31
|
const ignoreThemeCustomCSS = '/* IgnoreThemeCustomCSS */'; // If there is custom css from theme.json show it in the edit box
|
|
18
32
|
// so the user can selectively overwrite it, rather than have the user CSS
|
|
19
33
|
// completely overwrite the theme CSS by default.
|
|
@@ -29,23 +43,55 @@ function CustomCSSControl() {
|
|
|
29
43
|
}
|
|
30
44
|
|
|
31
45
|
setCustomCSS(value);
|
|
46
|
+
|
|
47
|
+
if (cssError) {
|
|
48
|
+
const [transformed] = transformStyles([{
|
|
49
|
+
css: value
|
|
50
|
+
}], '.editor-styles-wrapper');
|
|
51
|
+
|
|
52
|
+
if (transformed) {
|
|
53
|
+
setCSSError(null);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function handleOnBlur(event) {
|
|
59
|
+
var _event$target;
|
|
60
|
+
|
|
61
|
+
if (!(event !== null && event !== void 0 && (_event$target = event.target) !== null && _event$target !== void 0 && _event$target.value)) {
|
|
62
|
+
setCSSError(null);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const [transformed] = transformStyles([{
|
|
67
|
+
css: event.target.value
|
|
68
|
+
}], '.editor-styles-wrapper');
|
|
69
|
+
setCSSError(transformed === null ? __('There is an error with your CSS structure.') : null);
|
|
32
70
|
}
|
|
33
71
|
|
|
34
72
|
const originalThemeCustomCSS = themeCSS && customCSS && themeCustomCSS !== customCSS ? themeCSS : undefined;
|
|
35
|
-
return createElement(Fragment, null, createElement(
|
|
36
|
-
__nextHasNoMarginBottom: true,
|
|
37
|
-
value: (customCSS === null || customCSS === void 0 ? void 0 : customCSS.replace(ignoreThemeCustomCSS, '')) || themeCustomCSS,
|
|
38
|
-
onChange: value => handleOnChange(value),
|
|
39
|
-
rows: 15,
|
|
40
|
-
className: "edit-site-global-styles__custom-css-input",
|
|
41
|
-
spellCheck: false,
|
|
42
|
-
help: __("Enter your custom CSS in the textarea and preview in the editor. Changes won't take effect until you've saved the template.")
|
|
43
|
-
}), originalThemeCustomCSS && createElement(Panel, null, createElement(PanelBody, {
|
|
73
|
+
return createElement(Fragment, null, originalThemeCustomCSS && createElement(Panel, null, createElement(PanelBody, {
|
|
44
74
|
title: __('Original Theme Custom CSS'),
|
|
45
75
|
initialOpen: false
|
|
46
76
|
}, createElement("pre", {
|
|
47
77
|
className: "edit-site-global-styles__custom-css-theme-css"
|
|
48
|
-
}, originalThemeCustomCSS)))
|
|
78
|
+
}, originalThemeCustomCSS))), createElement(VStack, {
|
|
79
|
+
spacing: 3
|
|
80
|
+
}, createElement(Subtitle, null, __('ADDITIONAL CSS')), createElement(TextareaControl, {
|
|
81
|
+
__nextHasNoMarginBottom: true,
|
|
82
|
+
value: (customCSS === null || customCSS === void 0 ? void 0 : customCSS.replace(ignoreThemeCustomCSS, '')) || themeCustomCSS,
|
|
83
|
+
onChange: value => handleOnChange(value),
|
|
84
|
+
onBlur: handleOnBlur,
|
|
85
|
+
className: "edit-site-global-styles__custom-css-input",
|
|
86
|
+
spellCheck: false
|
|
87
|
+
}), cssError && createElement(Tooltip, {
|
|
88
|
+
text: cssError
|
|
89
|
+
}, createElement("div", {
|
|
90
|
+
className: "edit-site-global-styles__custom-css-validation-wrapper"
|
|
91
|
+
}, createElement(Icon, {
|
|
92
|
+
icon: info,
|
|
93
|
+
className: "edit-site-global-styles__custom-css-validation-icon"
|
|
94
|
+
})))));
|
|
49
95
|
}
|
|
50
96
|
|
|
51
97
|
export default CustomCSSControl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/custom-css.js"],"names":["TextareaControl","Panel","PanelBody","__","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/custom-css.js"],"names":["useState","TextareaControl","Panel","PanelBody","__experimentalVStack","VStack","Tooltip","Icon","__","experiments","blockEditorExperiments","transformStyles","info","unlock","Subtitle","useGlobalStyle","CustomCSSControl","blockName","block","customCSS","setCustomCSS","themeCSS","cssError","setCSSError","ignoreThemeCustomCSS","themeCustomCSS","undefined","handleOnChange","value","transformed","css","handleOnBlur","event","target","originalThemeCustomCSS","replace"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport {\n\tTextareaControl,\n\tPanel,\n\tPanelBody,\n\t__experimentalVStack as VStack,\n\tTooltip,\n\tIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\texperiments as blockEditorExperiments,\n\ttransformStyles,\n} from '@wordpress/block-editor';\nimport { info } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../experiments';\nimport Subtitle from './subtitle';\n\nconst { useGlobalStyle } = unlock( blockEditorExperiments );\nfunction CustomCSSControl( { blockName } ) {\n\t// If blockName is defined, we are customizing CSS at the block level:\n\t// styles.blocks.blockName.css\n\tconst block = !! blockName ? blockName : null;\n\n\tconst [ customCSS, setCustomCSS ] = useGlobalStyle( 'css', block );\n\tconst [ themeCSS ] = useGlobalStyle( 'css', block, 'base' );\n\tconst [ cssError, setCSSError ] = useState( null );\n\tconst ignoreThemeCustomCSS = '/* IgnoreThemeCustomCSS */';\n\n\t// If there is custom css from theme.json show it in the edit box\n\t// so the user can selectively overwrite it, rather than have the user CSS\n\t// completely overwrite the theme CSS by default.\n\tconst themeCustomCSS =\n\t\t! customCSS && themeCSS\n\t\t\t? `/* ${ __(\n\t\t\t\t\t'Theme Custom CSS start'\n\t\t\t ) } */\\n${ themeCSS }\\n/* ${ __( 'Theme Custom CSS end' ) } */`\n\t\t\t: undefined;\n\n\tfunction handleOnChange( value ) {\n\t\t// If there is theme custom CSS, but the user clears the input box then save the\n\t\t// ignoreThemeCustomCSS string so that the theme custom CSS is not re-applied.\n\t\tif ( themeCSS && value === '' ) {\n\t\t\tsetCustomCSS( ignoreThemeCustomCSS );\n\t\t\treturn;\n\t\t}\n\t\tsetCustomCSS( value );\n\t\tif ( cssError ) {\n\t\t\tconst [ transformed ] = transformStyles(\n\t\t\t\t[ { css: value } ],\n\t\t\t\t'.editor-styles-wrapper'\n\t\t\t);\n\t\t\tif ( transformed ) {\n\t\t\t\tsetCSSError( null );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction handleOnBlur( event ) {\n\t\tif ( ! event?.target?.value ) {\n\t\t\tsetCSSError( null );\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ transformed ] = transformStyles(\n\t\t\t[ { css: event.target.value } ],\n\t\t\t'.editor-styles-wrapper'\n\t\t);\n\n\t\tsetCSSError(\n\t\t\ttransformed === null\n\t\t\t\t? __( 'There is an error with your CSS structure.' )\n\t\t\t\t: null\n\t\t);\n\t}\n\n\tconst originalThemeCustomCSS =\n\t\tthemeCSS && customCSS && themeCustomCSS !== customCSS\n\t\t\t? themeCSS\n\t\t\t: undefined;\n\n\treturn (\n\t\t<>\n\t\t\t{ originalThemeCustomCSS && (\n\t\t\t\t<Panel>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\ttitle={ __( 'Original Theme Custom CSS' ) }\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t<pre className=\"edit-site-global-styles__custom-css-theme-css\">\n\t\t\t\t\t\t\t{ originalThemeCustomCSS }\n\t\t\t\t\t\t</pre>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</Panel>\n\t\t\t) }\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t<Subtitle>{ __( 'ADDITIONAL CSS' ) }</Subtitle>\n\t\t\t\t<TextareaControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tvalue={\n\t\t\t\t\t\tcustomCSS?.replace( ignoreThemeCustomCSS, '' ) ||\n\t\t\t\t\t\tthemeCustomCSS\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( value ) => handleOnChange( value ) }\n\t\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\t\tclassName=\"edit-site-global-styles__custom-css-input\"\n\t\t\t\t\tspellCheck={ false }\n\t\t\t\t/>\n\t\t\t\t{ cssError && (\n\t\t\t\t\t<Tooltip text={ cssError }>\n\t\t\t\t\t\t<div className=\"edit-site-global-styles__custom-css-validation-wrapper\">\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={ info }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-global-styles__custom-css-validation-icon\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</>\n\t);\n}\n\nexport default CustomCSSControl;\n"]}
|
|
@@ -10,13 +10,18 @@ import classnames from 'classnames';
|
|
|
10
10
|
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
12
|
import { __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, __experimentalBoxControl as BoxControl, __experimentalHStack as HStack, __experimentalUnitControl as UnitControl, __experimentalUseCustomUnits as useCustomUnits, __experimentalView as View } from '@wordpress/components';
|
|
13
|
-
import { __experimentalUseCustomSides as useCustomSides,
|
|
13
|
+
import { __experimentalUseCustomSides as useCustomSides, HeightControl, __experimentalSpacingSizesControl as SpacingSizesControl, experiments as blockEditorExperiments } from '@wordpress/block-editor';
|
|
14
14
|
import { Icon, positionCenter, stretchWide } from '@wordpress/icons';
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { getSupportedGlobalStylesPanels
|
|
19
|
+
import { getSupportedGlobalStylesPanels } from './hooks';
|
|
20
|
+
import { unlock } from '../../experiments';
|
|
21
|
+
const {
|
|
22
|
+
useGlobalSetting,
|
|
23
|
+
useGlobalStyle
|
|
24
|
+
} = unlock(blockEditorExperiments);
|
|
20
25
|
const AXIAL_SIDES = ['horizontal', 'vertical'];
|
|
21
26
|
export function useHasDimensionsPanel(name) {
|
|
22
27
|
const hasContentSize = useHasContentSize(name);
|
|
@@ -30,43 +35,51 @@ export function useHasDimensionsPanel(name) {
|
|
|
30
35
|
|
|
31
36
|
function useHasContentSize(name) {
|
|
32
37
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
33
|
-
const [settings] =
|
|
38
|
+
const [settings] = useGlobalSetting('layout.contentSize', name);
|
|
34
39
|
return settings && supports.includes('contentSize');
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
function useHasWideSize(name) {
|
|
38
43
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
39
|
-
const [settings] =
|
|
44
|
+
const [settings] = useGlobalSetting('layout.wideSize', name);
|
|
40
45
|
return settings && supports.includes('wideSize');
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
function useHasPadding(name) {
|
|
44
49
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
45
|
-
const [settings] =
|
|
50
|
+
const [settings] = useGlobalSetting('spacing.padding', name);
|
|
46
51
|
return settings && supports.includes('padding');
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
function useHasMargin(name) {
|
|
50
55
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
51
|
-
const [settings] =
|
|
56
|
+
const [settings] = useGlobalSetting('spacing.margin', name);
|
|
52
57
|
return settings && supports.includes('margin');
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
function useHasGap(name) {
|
|
56
61
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
57
|
-
const [settings] =
|
|
62
|
+
const [settings] = useGlobalSetting('spacing.blockGap', name);
|
|
58
63
|
return settings && supports.includes('blockGap');
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
function useHasMinHeight(name) {
|
|
62
67
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
63
|
-
const [settings] =
|
|
68
|
+
const [settings] = useGlobalSetting('dimensions.minHeight', name);
|
|
64
69
|
return settings && supports.includes('minHeight');
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
function useHasSpacingPresets() {
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
var _ref, _ref2;
|
|
74
|
+
|
|
75
|
+
const [settings] = useGlobalSetting('spacing.spacingSizes');
|
|
76
|
+
const {
|
|
77
|
+
custom,
|
|
78
|
+
theme,
|
|
79
|
+
default: defaultPresets
|
|
80
|
+
} = settings || {};
|
|
81
|
+
const presets = (_ref = (_ref2 = custom !== null && custom !== void 0 ? custom : theme) !== null && _ref2 !== void 0 ? _ref2 : defaultPresets) !== null && _ref !== void 0 ? _ref : [];
|
|
82
|
+
return settings && presets.length > 0;
|
|
70
83
|
}
|
|
71
84
|
|
|
72
85
|
function filterValuesBySides(values, sides) {
|
|
@@ -129,8 +142,8 @@ function splitGapValue(value) {
|
|
|
129
142
|
|
|
130
143
|
|
|
131
144
|
function useContentSizeProps(name) {
|
|
132
|
-
const [contentSizeValue, setContentSizeValue] =
|
|
133
|
-
const [userSetContentSizeValue] =
|
|
145
|
+
const [contentSizeValue, setContentSizeValue] = useGlobalSetting('layout.contentSize', name);
|
|
146
|
+
const [userSetContentSizeValue] = useGlobalSetting('layout.contentSize', name, 'user');
|
|
134
147
|
|
|
135
148
|
const hasUserSetContentSizeValue = () => !!userSetContentSizeValue;
|
|
136
149
|
|
|
@@ -146,8 +159,8 @@ function useContentSizeProps(name) {
|
|
|
146
159
|
|
|
147
160
|
|
|
148
161
|
function useWideSizeProps(name) {
|
|
149
|
-
const [wideSizeValue, setWideSizeValue] =
|
|
150
|
-
const [userSetWideSizeValue] =
|
|
162
|
+
const [wideSizeValue, setWideSizeValue] = useGlobalSetting('layout.wideSize', name);
|
|
163
|
+
const [userSetWideSizeValue] = useGlobalSetting('layout.wideSize', name, 'user');
|
|
151
164
|
|
|
152
165
|
const hasUserSetWideSizeValue = () => !!userSetWideSizeValue;
|
|
153
166
|
|
|
@@ -163,8 +176,9 @@ function useWideSizeProps(name) {
|
|
|
163
176
|
|
|
164
177
|
|
|
165
178
|
function usePaddingProps(name) {
|
|
166
|
-
let
|
|
167
|
-
const
|
|
179
|
+
let variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
180
|
+
const prefix = variation ? `variations.${variation}.` : '';
|
|
181
|
+
const [rawPadding, setRawPadding] = useGlobalStyle(prefix + 'spacing.padding', name);
|
|
168
182
|
const paddingValues = splitStyleValue(rawPadding);
|
|
169
183
|
const paddingSides = useCustomSides(name, 'padding');
|
|
170
184
|
const isAxialPadding = paddingSides && paddingSides.some(side => AXIAL_SIDES.includes(side));
|
|
@@ -176,7 +190,7 @@ function usePaddingProps(name) {
|
|
|
176
190
|
|
|
177
191
|
const resetPaddingValue = () => setPaddingValues({});
|
|
178
192
|
|
|
179
|
-
const [userSetPaddingValue] =
|
|
193
|
+
const [userSetPaddingValue] = useGlobalStyle(prefix + 'spacing.padding', name, 'user'); // The `hasPaddingValue` check does not need a parsed value, as `userSetPaddingValue` will be `undefined` if not set.
|
|
180
194
|
|
|
181
195
|
const hasPaddingValue = () => !!userSetPaddingValue;
|
|
182
196
|
|
|
@@ -192,8 +206,9 @@ function usePaddingProps(name) {
|
|
|
192
206
|
|
|
193
207
|
|
|
194
208
|
function useMarginProps(name) {
|
|
195
|
-
let
|
|
196
|
-
const
|
|
209
|
+
let variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
210
|
+
const prefix = variation ? `variations.${variation}.` : '';
|
|
211
|
+
const [rawMargin, setRawMargin] = useGlobalStyle(prefix + 'spacing.margin', name);
|
|
197
212
|
const marginValues = splitStyleValue(rawMargin);
|
|
198
213
|
const marginSides = useCustomSides(name, 'margin');
|
|
199
214
|
const isAxialMargin = marginSides && marginSides.some(side => AXIAL_SIDES.includes(side));
|
|
@@ -219,15 +234,16 @@ function useMarginProps(name) {
|
|
|
219
234
|
|
|
220
235
|
|
|
221
236
|
function useBlockGapProps(name) {
|
|
222
|
-
let
|
|
223
|
-
const
|
|
237
|
+
let variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
238
|
+
const prefix = variation ? `variations.${variation}.` : '';
|
|
239
|
+
const [gapValue, setGapValue] = useGlobalStyle(prefix + 'spacing.blockGap', name);
|
|
224
240
|
const gapValues = splitGapValue(gapValue);
|
|
225
241
|
const gapSides = useCustomSides(name, 'blockGap');
|
|
226
242
|
const isAxialGap = gapSides && gapSides.some(side => AXIAL_SIDES.includes(side));
|
|
227
243
|
|
|
228
244
|
const resetGapValue = () => setGapValue(undefined);
|
|
229
245
|
|
|
230
|
-
const [userSetGapValue] =
|
|
246
|
+
const [userSetGapValue] = useGlobalStyle(prefix + 'spacing.blockGap', name, 'user');
|
|
231
247
|
|
|
232
248
|
const hasGapValue = () => !!userSetGapValue;
|
|
233
249
|
|
|
@@ -261,8 +277,9 @@ function useBlockGapProps(name) {
|
|
|
261
277
|
|
|
262
278
|
|
|
263
279
|
function useMinHeightProps(name) {
|
|
264
|
-
let
|
|
265
|
-
const
|
|
280
|
+
let variation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
281
|
+
const prefix = variation ? `variations.${variation}.` : '';
|
|
282
|
+
const [minHeightValue, setMinHeightValue] = useGlobalStyle(prefix + 'dimensions.minHeight', name);
|
|
266
283
|
|
|
267
284
|
const resetMinHeightValue = () => setMinHeightValue(undefined);
|
|
268
285
|
|
|
@@ -276,11 +293,11 @@ function useMinHeightProps(name) {
|
|
|
276
293
|
};
|
|
277
294
|
}
|
|
278
295
|
|
|
279
|
-
export default function DimensionsPanel(
|
|
296
|
+
export default function DimensionsPanel(_ref3) {
|
|
280
297
|
let {
|
|
281
298
|
name,
|
|
282
|
-
|
|
283
|
-
} =
|
|
299
|
+
variation = ''
|
|
300
|
+
} = _ref3;
|
|
284
301
|
const showContentSizeControl = useHasContentSize(name);
|
|
285
302
|
const showWideSizeControl = useHasWideSize(name);
|
|
286
303
|
const showPaddingControl = useHasPadding(name);
|
|
@@ -289,7 +306,7 @@ export default function DimensionsPanel(_ref) {
|
|
|
289
306
|
const showMinHeightControl = useHasMinHeight(name);
|
|
290
307
|
const showSpacingPresetsControl = useHasSpacingPresets();
|
|
291
308
|
const units = useCustomUnits({
|
|
292
|
-
availableUnits:
|
|
309
|
+
availableUnits: useGlobalSetting('spacing.units', name)[0] || ['%', 'px', 'em', 'rem', 'vw']
|
|
293
310
|
}); // Props for managing `layout.contentSize`.
|
|
294
311
|
|
|
295
312
|
const {
|
|
@@ -313,7 +330,7 @@ export default function DimensionsPanel(_ref) {
|
|
|
313
330
|
setPaddingValues,
|
|
314
331
|
resetPaddingValue,
|
|
315
332
|
hasPaddingValue
|
|
316
|
-
} = usePaddingProps(name,
|
|
333
|
+
} = usePaddingProps(name, variation); // Props for managing `spacing.margin`.
|
|
317
334
|
|
|
318
335
|
const {
|
|
319
336
|
marginValues,
|
|
@@ -322,7 +339,7 @@ export default function DimensionsPanel(_ref) {
|
|
|
322
339
|
setMarginValues,
|
|
323
340
|
resetMarginValue,
|
|
324
341
|
hasMarginValue
|
|
325
|
-
} = useMarginProps(name,
|
|
342
|
+
} = useMarginProps(name, variation); // Props for managing `spacing.blockGap`.
|
|
326
343
|
|
|
327
344
|
const {
|
|
328
345
|
gapValue,
|
|
@@ -333,14 +350,14 @@ export default function DimensionsPanel(_ref) {
|
|
|
333
350
|
setGapValues,
|
|
334
351
|
resetGapValue,
|
|
335
352
|
hasGapValue
|
|
336
|
-
} = useBlockGapProps(name,
|
|
353
|
+
} = useBlockGapProps(name, variation); // Props for managing `dimensions.minHeight`.
|
|
337
354
|
|
|
338
355
|
const {
|
|
339
356
|
minHeightValue,
|
|
340
357
|
setMinHeightValue,
|
|
341
358
|
resetMinHeightValue,
|
|
342
359
|
hasMinHeightValue
|
|
343
|
-
} = useMinHeightProps(name,
|
|
360
|
+
} = useMinHeightProps(name, variation);
|
|
344
361
|
|
|
345
362
|
const resetAll = () => {
|
|
346
363
|
resetPaddingValue();
|