@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
|
@@ -17,14 +17,14 @@ var _icons = require("@wordpress/icons");
|
|
|
17
17
|
|
|
18
18
|
var _data = require("@wordpress/data");
|
|
19
19
|
|
|
20
|
-
var _preferences = require("@wordpress/preferences");
|
|
21
|
-
|
|
22
20
|
var _defaultSidebar = _interopRequireDefault(require("./default-sidebar"));
|
|
23
21
|
|
|
24
22
|
var _globalStyles = require("../global-styles");
|
|
25
23
|
|
|
26
24
|
var _store = require("../../store");
|
|
27
25
|
|
|
26
|
+
var _ui = require("../global-styles/ui");
|
|
27
|
+
|
|
28
28
|
/**
|
|
29
29
|
* WordPress dependencies
|
|
30
30
|
*/
|
|
@@ -33,10 +33,6 @@ var _store = require("../../store");
|
|
|
33
33
|
* Internal dependencies
|
|
34
34
|
*/
|
|
35
35
|
function GlobalStylesSidebar() {
|
|
36
|
-
const [canReset, onReset] = (0, _globalStyles.useGlobalStylesReset)();
|
|
37
|
-
const {
|
|
38
|
-
toggle
|
|
39
|
-
} = (0, _data.useDispatch)(_preferences.store);
|
|
40
36
|
const [isStyleBookOpened, setIsStyleBookOpened] = (0, _element.useState)(false);
|
|
41
37
|
const editorMode = (0, _data.useSelect)(select => select(_store.store).getEditorMode(), []);
|
|
42
38
|
(0, _element.useEffect)(() => {
|
|
@@ -59,18 +55,7 @@ function GlobalStylesSidebar() {
|
|
|
59
55
|
onClick: () => {
|
|
60
56
|
setIsStyleBookOpened(!isStyleBookOpened);
|
|
61
57
|
}
|
|
62
|
-
})), (0, _element.createElement)(_components.FlexItem, null, (0, _element.createElement)(
|
|
63
|
-
icon: _icons.moreVertical,
|
|
64
|
-
label: (0, _i18n.__)('More Styles actions'),
|
|
65
|
-
controls: [{
|
|
66
|
-
title: (0, _i18n.__)('Reset to defaults'),
|
|
67
|
-
onClick: onReset,
|
|
68
|
-
isDisabled: !canReset
|
|
69
|
-
}, {
|
|
70
|
-
title: (0, _i18n.__)('Welcome Guide'),
|
|
71
|
-
onClick: () => toggle('core/edit-site', 'welcomeGuideStyles')
|
|
72
|
-
}]
|
|
73
|
-
})))
|
|
58
|
+
})), (0, _element.createElement)(_components.FlexItem, null, (0, _element.createElement)(_ui.GlobalStylesMenuSlot, null)))
|
|
74
59
|
}, (0, _element.createElement)(_globalStyles.GlobalStylesUI, {
|
|
75
60
|
isStyleBookOpened: isStyleBookOpened,
|
|
76
61
|
onCloseStyleBook: () => setIsStyleBookOpened(false)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/global-styles-sidebar.js"],"names":["GlobalStylesSidebar","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/global-styles-sidebar.js"],"names":["GlobalStylesSidebar","isStyleBookOpened","setIsStyleBookOpened","editorMode","select","editSiteStore","getEditorMode","styles","seen"],"mappings":";;;;;;;;;AAQA;;AALA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAQA;AACA;AACA;AAMe,SAASA,mBAAT,GAA+B;AAC7C,QAAM,CAAEC,iBAAF,EAAqBC,oBAArB,IAA8C,uBAAU,KAAV,CAApD;AACA,QAAMC,UAAU,GAAG,qBAChBC,MAAF,IAAcA,MAAM,CAAEC,YAAF,CAAN,CAAwBC,aAAxB,EADI,EAElB,EAFkB,CAAnB;AAKA,0BAAW,MAAM;AAChB,QAAKH,UAAU,KAAK,QAApB,EAA+B;AAC9BD,MAAAA,oBAAoB,CAAE,KAAF,CAApB;AACA;AACD,GAJD,EAIG,CAAEC,UAAF,CAJH;AAKA,SACC,4BAAC,uBAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,UAAU,EAAC,yBAFZ;AAGC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAHT;AAIC,IAAA,IAAI,EAAGI,aAJR;AAKC,IAAA,UAAU,EAAG,cAAI,sBAAJ,CALd;AAMC,IAAA,cAAc,EAAC,wCANhB;AAOC,IAAA,MAAM,EACL,4BAAC,gBAAD,QACC,4BAAC,qBAAD,QACC,4CAAU,cAAI,QAAJ,CAAV,CADD,CADD,EAIC,4BAAC,oBAAD,QACC,4BAAC,kBAAD;AACC,MAAA,IAAI,EAAGC,WADR;AAEC,MAAA,KAAK,EACJP,iBAAiB,GACd,cAAI,kBAAJ,CADc,GAEd,cAAI,iBAAJ,CALL;AAOC,MAAA,SAAS,EAAGA,iBAPb;AAQC,MAAA,QAAQ,EAAGE,UAAU,KAAK,QAR3B;AASC,MAAA,OAAO,EAAG,MAAM;AACfD,QAAAA,oBAAoB,CAAE,CAAED,iBAAJ,CAApB;AACA;AAXF,MADD,CAJD,EAmBC,4BAAC,oBAAD,QACC,4BAAC,wBAAD,OADD,CAnBD;AARF,KAiCC,4BAAC,4BAAD;AACC,IAAA,iBAAiB,EAAGA,iBADrB;AAEC,IAAA,gBAAgB,EAAG,MAAMC,oBAAoB,CAAE,KAAF;AAF9C,IAjCD,CADD;AAwCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { FlexItem, FlexBlock, Flex, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { styles, seen } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport { GlobalStylesUI } from '../global-styles';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesMenuSlot } from '../global-styles/ui';\n\nexport default function GlobalStylesSidebar() {\n\tconst [ isStyleBookOpened, setIsStyleBookOpened ] = useState( false );\n\tconst editorMode = useSelect(\n\t\t( select ) => select( editSiteStore ).getEditorMode(),\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( editorMode !== 'visual' ) {\n\t\t\tsetIsStyleBookOpened( false );\n\t\t}\n\t}, [ editorMode ] );\n\treturn (\n\t\t<DefaultSidebar\n\t\t\tclassName=\"edit-site-global-styles-sidebar\"\n\t\t\tidentifier=\"edit-site/global-styles\"\n\t\t\ttitle={ __( 'Styles' ) }\n\t\t\ticon={ styles }\n\t\t\tcloseLabel={ __( 'Close Styles sidebar' ) }\n\t\t\tpanelClassName=\"edit-site-global-styles-sidebar__panel\"\n\t\t\theader={\n\t\t\t\t<Flex>\n\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t<strong>{ __( 'Styles' ) }</strong>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisStyleBookOpened\n\t\t\t\t\t\t\t\t\t? __( 'Close Style Book' )\n\t\t\t\t\t\t\t\t\t: __( 'Open Style Book' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\tdisabled={ editorMode !== 'visual' }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsStyleBookOpened( ! isStyleBookOpened );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<GlobalStylesMenuSlot />\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t}\n\t\t>\n\t\t\t<GlobalStylesUI\n\t\t\t\tisStyleBookOpened={ isStyleBookOpened }\n\t\t\t\tonCloseStyleBook={ () => setIsStyleBookOpened( false ) }\n\t\t\t/>\n\t\t</DefaultSidebar>\n\t);\n}\n"]}
|
|
@@ -26,8 +26,6 @@ var _defaultSidebar = _interopRequireDefault(require("./default-sidebar"));
|
|
|
26
26
|
|
|
27
27
|
var _globalStylesSidebar = _interopRequireDefault(require("./global-styles-sidebar"));
|
|
28
28
|
|
|
29
|
-
var _navigationMenuSidebar = _interopRequireDefault(require("./navigation-menu-sidebar"));
|
|
30
|
-
|
|
31
29
|
var _constants = require("../../store/constants");
|
|
32
30
|
|
|
33
31
|
var _settingsHeader = _interopRequireDefault(require("./settings-header"));
|
|
@@ -53,8 +51,6 @@ const SidebarInspectorFill = InspectorFill;
|
|
|
53
51
|
exports.SidebarInspectorFill = SidebarInspectorFill;
|
|
54
52
|
|
|
55
53
|
function SidebarComplementaryAreaFills() {
|
|
56
|
-
var _window;
|
|
57
|
-
|
|
58
54
|
const {
|
|
59
55
|
sidebar,
|
|
60
56
|
isEditorSidebarOpened,
|
|
@@ -89,15 +85,6 @@ function SidebarComplementaryAreaFills() {
|
|
|
89
85
|
|
|
90
86
|
if (!isEditorSidebarOpened) {
|
|
91
87
|
sidebarName = hasBlockSelection ? _constants2.SIDEBAR_BLOCK : _constants2.SIDEBAR_TEMPLATE;
|
|
92
|
-
} // Conditionally include NavMenu sidebar in Plugin only.
|
|
93
|
-
// Optimise for dead code elimination.
|
|
94
|
-
// See https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/feature-flags.md#dead-code-elimination.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
let MaybeNavigationMenuSidebar = _element.Fragment;
|
|
98
|
-
|
|
99
|
-
if (((_window = window) === null || _window === void 0 ? void 0 : _window.__experimentalEnableOffCanvasNavigationEditor) === true) {
|
|
100
|
-
MaybeNavigationMenuSidebar = _navigationMenuSidebar.default;
|
|
101
88
|
}
|
|
102
89
|
|
|
103
90
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_defaultSidebar.default, {
|
|
@@ -111,6 +98,6 @@ function SidebarComplementaryAreaFills() {
|
|
|
111
98
|
headerClassName: "edit-site-sidebar-edit-mode__panel-tabs"
|
|
112
99
|
}, sidebarName === _constants2.SIDEBAR_TEMPLATE && (0, _element.createElement)(_components.PanelBody, null, (0, _element.createElement)(_templateCard.default, null)), sidebarName === _constants2.SIDEBAR_BLOCK && (0, _element.createElement)(InspectorSlot, {
|
|
113
100
|
bubblesVirtually: true
|
|
114
|
-
})), supportsGlobalStyles && (0, _element.createElement)(_globalStylesSidebar.default, null)
|
|
101
|
+
})), supportsGlobalStyles && (0, _element.createElement)(_globalStylesSidebar.default, null));
|
|
115
102
|
}
|
|
116
103
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/index.js"],"names":["Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","supportsGlobalStyles","select","_sidebar","interfaceStore","getActiveComplementaryArea","STORE_NAME","_isEditorSidebarOpened","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","includes","settings","editSiteStore","getSettings","blockEditorStore","getBlockSelectionStart","supportsTemplatePartsMode","enableComplementaryArea","sidebarName","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/index.js"],"names":["Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","supportsGlobalStyles","select","_sidebar","interfaceStore","getActiveComplementaryArea","STORE_NAME","_isEditorSidebarOpened","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","includes","settings","editSiteStore","getSettings","blockEditorStore","getBlockSelectionStart","supportsTemplatePartsMode","enableComplementaryArea","sidebarName","drawerLeft","drawerRight"],"mappings":";;;;;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AApBA;AACA;AACA;;AASA;AACA;AACA;AASA,MAAM;AAAEA,EAAAA,IAAI,EAAEC,aAAR;AAAuBC,EAAAA,IAAI,EAAEC;AAA7B,IAA+C,gCACpD,0BADoD,CAArD;AAGO,MAAMC,oBAAoB,GAAGD,aAA7B;;;AAEA,SAASE,6BAAT,GAAyC;AAC/C,QAAM;AACLC,IAAAA,OADK;AAELC,IAAAA,qBAFK;AAGLC,IAAAA,iBA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AUC,iBAAV,GAAuBC,kBAH/B;AAIC,IAAA,UAAU,EAAG,cAAI,wBAAJ,CAJd;AAKC,IAAA,MAAM,EAAG,4BAAC,uBAAD;AAAgB,MAAA,WAAW,EAAGF;AAA9B,MALV;AAMC,IAAA,eAAe,EAAC;AANjB,KAQGA,WAAW,KAAKT,4BAAhB,IACD,4BAAC,qBAAD,QACC,4BAAC,qBAAD,OADD,CATF,EAaGS,WAAW,KAAKV,yBAAhB,IACD,4BAAC,aAAD;AAAe,IAAA,gBAAgB;AAA/B,IAdF,CADD,EAkBGP,oBAAoB,IAAI,4BAAC,4BAAD,OAlB3B,CADD;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { useEffect, Fragment } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport { STORE_NAME } from '../../store/constants';\nimport SettingsHeader from './settings-header';\nimport TemplateCard from './template-card';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';\nimport { store as editSiteStore } from '../../store';\n\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nexport function SidebarComplementaryAreaFills() {\n\tconst {\n\t\tsidebar,\n\t\tisEditorSidebarOpened,\n\t\thasBlockSelection,\n\t\tsupportsGlobalStyles,\n\t} = useSelect( ( select ) => {\n\t\tconst _sidebar =\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea( STORE_NAME );\n\t\tconst _isEditorSidebarOpened = [\n\t\t\tSIDEBAR_BLOCK,\n\t\t\tSIDEBAR_TEMPLATE,\n\t\t].includes( _sidebar );\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tsidebar: _sidebar,\n\t\t\tisEditorSidebarOpened: _isEditorSidebarOpened,\n\t\t\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\tsupportsGlobalStyles: ! settings?.supportsTemplatePartsMode,\n\t\t};\n\t}, [] );\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\tif ( ! isEditorSidebarOpened ) return;\n\t\tif ( hasBlockSelection ) {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\t\t}\n\t}, [ hasBlockSelection, isEditorSidebarOpened ] );\n\n\tlet sidebarName = sidebar;\n\tif ( ! isEditorSidebarOpened ) {\n\t\tsidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ sidebarName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\t\tcloseLabel={ __( 'Close settings sidebar' ) }\n\t\t\t\theader={ <SettingsHeader sidebarName={ sidebarName } /> }\n\t\t\t\theaderClassName=\"edit-site-sidebar-edit-mode__panel-tabs\"\n\t\t\t>\n\t\t\t\t{ sidebarName === SIDEBAR_TEMPLATE && (\n\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t<TemplateCard />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t\t{ sidebarName === SIDEBAR_BLOCK && (\n\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t) }\n\t\t\t</DefaultSidebar>\n\t\t\t{ supportsGlobalStyles && <GlobalStylesSidebar /> }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -21,6 +21,7 @@ function SidebarNavigationScreen(_ref) {
|
|
|
21
21
|
path,
|
|
22
22
|
parentTitle,
|
|
23
23
|
title,
|
|
24
|
+
actions,
|
|
24
25
|
content
|
|
25
26
|
} = _ref;
|
|
26
27
|
return (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
|
|
@@ -40,9 +41,9 @@ function SidebarNavigationScreen(_ref) {
|
|
|
40
41
|
(0, _i18n.__)('Navigate to the previous view: %s'), parentTitle)
|
|
41
42
|
}) : (0, _element.createElement)("div", {
|
|
42
43
|
className: "edit-site-sidebar-navigation-screen__icon-placeholder"
|
|
43
|
-
}), (0, _element.createElement)("
|
|
44
|
+
}), (0, _element.createElement)("h2", {
|
|
44
45
|
className: "edit-site-sidebar-navigation-screen__title"
|
|
45
|
-
}, title)), (0, _element.createElement)("nav", {
|
|
46
|
+
}, title), actions), (0, _element.createElement)("nav", {
|
|
46
47
|
className: "edit-site-sidebar-navigation-screen__content"
|
|
47
48
|
}, content)));
|
|
48
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"names":["SidebarNavigationScreen","path","parentTitle","title","content","chevronRight","chevronLeft"],"mappings":";;;;;;;;;AAGA;;AAMA;;AACA;;AAVA;AACA;AACA;AAUe,SAASA,uBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"names":["SidebarNavigationScreen","path","parentTitle","title","actions","content","chevronRight","chevronLeft"],"mappings":";;;;;;;;;AAGA;;AAMA;;AACA;;AAVA;AACA;AACA;AAUe,SAASA,uBAAT,OAMX;AAAA,MAN6C;AAChDC,IAAAA,IADgD;AAEhDC,IAAAA,WAFgD;AAGhDC,IAAAA,KAHgD;AAIhDC,IAAAA,OAJgD;AAKhDC,IAAAA;AALgD,GAM7C;AACH,SACC,4BAAC,yCAAD;AACC,IAAA,SAAS,EAAC,qCADX;AAEC,IAAA,IAAI,EAAGJ;AAFR,KAIC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,gCAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,OAAO,EAAC,YAFT;AAGC,IAAA,SAAS,EAAC;AAHX,KAKGC,WAAW,GACZ,4BAAC,6CAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAG,qBAAUI,mBAAV,GAAyBC,kBAFjC;AAGC,kBAAa;AACZ;AACA,kBAAI,mCAAJ,CAFY,EAGZL,WAHY;AAHd,IADY,GAWZ;AAAK,IAAA,SAAS,EAAC;AAAf,IAhBF,EAkBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGC,KADH,CAlBD,EAqBGC,OArBH,CADD,EAyBC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGC,OADH,CAzBD,CAJD,CADD;AAoCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNavigatorBackButton as NavigatorBackButton,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { isRTL, __, sprintf } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\n\nexport default function SidebarNavigationScreen( {\n\tpath,\n\tparentTitle,\n\ttitle,\n\tactions,\n\tcontent,\n} ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName=\"edit-site-sidebar-navigation-screen\"\n\t\t\tpath={ path }\n\t\t>\n\t\t\t<VStack spacing={ 2 }>\n\t\t\t\t<HStack\n\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title-icon\"\n\t\t\t\t>\n\t\t\t\t\t{ parentTitle ? (\n\t\t\t\t\t\t<NavigatorBackButton\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__back\"\n\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: previous page. */\n\t\t\t\t\t\t\t\t__( 'Navigate to the previous view: %s' ),\n\t\t\t\t\t\t\t\tparentTitle\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen__icon-placeholder\" />\n\t\t\t\t\t) }\n\t\t\t\t\t<h2 className=\"edit-site-sidebar-navigation-screen__title\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</h2>\n\t\t\t\t\t{ actions }\n\t\t\t\t</HStack>\n\n\t\t\t\t<nav className=\"edit-site-sidebar-navigation-screen__content\">\n\t\t\t\t\t{ content }\n\t\t\t\t</nav>\n\t\t\t</VStack>\n\t\t</NavigatorScreen>\n\t);\n}\n"]}
|
|
@@ -15,6 +15,10 @@ var _i18n = require("@wordpress/i18n");
|
|
|
15
15
|
|
|
16
16
|
var _icons = require("@wordpress/icons");
|
|
17
17
|
|
|
18
|
+
var _data = require("@wordpress/data");
|
|
19
|
+
|
|
20
|
+
var _coreData = require("@wordpress/core-data");
|
|
21
|
+
|
|
18
22
|
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
19
23
|
|
|
20
24
|
var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigation-item"));
|
|
@@ -27,10 +31,28 @@ var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigati
|
|
|
27
31
|
* Internal dependencies
|
|
28
32
|
*/
|
|
29
33
|
function SidebarNavigationScreenMain() {
|
|
34
|
+
const {
|
|
35
|
+
navigationMenus
|
|
36
|
+
} = (0, _data.useSelect)(select => {
|
|
37
|
+
const {
|
|
38
|
+
getEntityRecords
|
|
39
|
+
} = select(_coreData.store);
|
|
40
|
+
return {
|
|
41
|
+
navigationMenus: getEntityRecords('postType', 'wp_navigation', {
|
|
42
|
+
per_page: -1,
|
|
43
|
+
status: 'publish'
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
});
|
|
30
47
|
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
31
48
|
path: "/",
|
|
32
49
|
title: (0, _i18n.__)('Design'),
|
|
33
|
-
content: (0, _element.createElement)(_components.__experimentalItemGroup, null, (0, _element.createElement)(_components.__experimentalNavigatorButton, {
|
|
50
|
+
content: (0, _element.createElement)(_components.__experimentalItemGroup, null, !!navigationMenus && navigationMenus.length > 0 && (0, _element.createElement)(_components.__experimentalNavigatorButton, {
|
|
51
|
+
as: _sidebarNavigationItem.default,
|
|
52
|
+
path: "/navigation",
|
|
53
|
+
withChevron: true,
|
|
54
|
+
icon: _icons.navigation
|
|
55
|
+
}, (0, _i18n.__)('Navigation')), (0, _element.createElement)(_components.__experimentalNavigatorButton, {
|
|
34
56
|
as: _sidebarNavigationItem.default,
|
|
35
57
|
path: "/templates",
|
|
36
58
|
withChevron: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"names":["SidebarNavigationScreenMain","SidebarNavigationItem","layout","symbolFilled"],"mappings":";;;;;;;;;;;AAGA;;AAIA;;AACA;;AAKA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"names":["SidebarNavigationScreenMain","navigationMenus","select","getEntityRecords","coreStore","per_page","status","length","SidebarNavigationItem","navigation","layout","symbolFilled"],"mappings":";;;;;;;;;;;AAGA;;AAIA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;AAIe,SAASA,2BAAT,GAAuC;AACrD,QAAM;AAAEC,IAAAA;AAAF,MAAsB,qBAAaC,MAAF,IAAc;AACpD,UAAM;AAAEC,MAAAA;AAAF,QAAuBD,MAAM,CAAEE,eAAF,CAAnC;AACA,WAAO;AACNH,MAAAA,eAAe,EAAEE,gBAAgB,CAAE,UAAF,EAAc,eAAd,EAA+B;AAC/DE,QAAAA,QAAQ,EAAE,CAAC,CADoD;AAE/DC,QAAAA,MAAM,EAAE;AAFuD,OAA/B;AAD3B,KAAP;AAMA,GAR2B,CAA5B;AAUA,SACC,4BAAC,gCAAD;AACC,IAAA,IAAI,EAAC,GADN;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,OAAO,EACN,4BAAC,mCAAD,QACG,CAAC,CAAEL,eAAH,IAAsBA,eAAe,CAACM,MAAhB,GAAyB,CAA/C,IACD,4BAAC,yCAAD;AACC,MAAA,EAAE,EAAGC,8BADN;AAEC,MAAA,IAAI,EAAC,aAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGC;AAJR,OAMG,cAAI,YAAJ,CANH,CAFF,EAWC,4BAAC,yCAAD;AACC,MAAA,EAAE,EAAGD,8BADN;AAEC,MAAA,IAAI,EAAC,YAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGE;AAJR,OAMG,cAAI,WAAJ,CANH,CAXD,EAmBC,4BAAC,yCAAD;AACC,MAAA,EAAE,EAAGF,8BADN;AAEC,MAAA,IAAI,EAAC,iBAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGG;AAJR,OAMG,cAAI,gBAAJ,CANH,CAnBD;AAJF,IADD;AAoCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalNavigatorButton as NavigatorButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbolFilled, navigation } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { navigationMenus } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords } = select( coreStore );\n\t\treturn {\n\t\t\tnavigationMenus: getEntityRecords( 'postType', 'wp_navigation', {\n\t\t\t\tper_page: -1,\n\t\t\t\tstatus: 'publish',\n\t\t\t} ),\n\t\t};\n\t} );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath=\"/\"\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tcontent={\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t{ !! navigationMenus && navigationMenus.length > 0 && (\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/navigation\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/templates\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Templates' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/template-parts\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ symbolFilled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template Parts' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t</ItemGroup>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = SidebarNavigationScreenNavigationMenus;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _i18n = require("@wordpress/i18n");
|
|
13
|
+
|
|
14
|
+
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
15
|
+
|
|
16
|
+
var _navigationInspector = _interopRequireDefault(require("../navigation-inspector"));
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* WordPress dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies
|
|
24
|
+
*/
|
|
25
|
+
function SidebarNavigationScreenNavigationMenus() {
|
|
26
|
+
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
27
|
+
path: "/navigation",
|
|
28
|
+
parentTitle: (0, _i18n.__)('Design'),
|
|
29
|
+
title: (0, _i18n.__)('Navigation'),
|
|
30
|
+
content: (0, _element.createElement)("div", {
|
|
31
|
+
className: "edit-site-sidebar-navigation-screen-navigation-menus"
|
|
32
|
+
}, (0, _element.createElement)(_navigationInspector.default, null))
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["SidebarNavigationScreenNavigationMenus"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIe,SAASA,sCAAT,GAAkD;AAChE,SACC,4BAAC,gCAAD;AACC,IAAA,IAAI,EAAC,aADN;AAEC,IAAA,WAAW,EAAG,cAAI,QAAJ,CAFf;AAGC,IAAA,KAAK,EAAG,cAAI,YAAJ,CAHT;AAIC,IAAA,OAAO,EACN;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,4BAAD,OADD;AALF,IADD;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport NavigationInspector from '../navigation-inspector';\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath=\"/navigation\"\n\t\t\tparentTitle={ __( 'Design' ) }\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\tcontent={\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus\">\n\t\t\t\t\t<NavigationInspector />\n\t\t\t\t</div>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -140,18 +140,13 @@ function SidebarNavigationScreenTemplates(_ref3) {
|
|
|
140
140
|
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
141
141
|
path: config[postType].path,
|
|
142
142
|
parentTitle: (0, _i18n.__)('Design'),
|
|
143
|
-
title:
|
|
144
|
-
|
|
145
|
-
}, (0, _element.createElement)("div", {
|
|
146
|
-
style: {
|
|
147
|
-
flexShrink: 0
|
|
148
|
-
}
|
|
149
|
-
}, config[postType].labels.title), !isMobileViewport && (0, _element.createElement)(_addNewTemplate.default, {
|
|
143
|
+
title: config[postType].labels.title,
|
|
144
|
+
actions: !isMobileViewport && (0, _element.createElement)(_addNewTemplate.default, {
|
|
150
145
|
templateType: postType,
|
|
151
146
|
toggleProps: {
|
|
152
147
|
className: 'edit-site-sidebar-navigation-screen-templates__add-button'
|
|
153
148
|
}
|
|
154
|
-
})
|
|
149
|
+
}),
|
|
155
150
|
content: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalItemGroup, null, items.map((item, index) => (0, _element.createElement)(Item, {
|
|
156
151
|
item: item,
|
|
157
152
|
key: index
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["omit","object","keys","Object","fromEntries","entries","filter","key","includes","Item","item","linkInfo","params","props","config","wp_template","path","labels","title","loading","notFound","manage","wp_template_part","SidebarNavigationScreenTemplates","postType","isMobileViewport","editedPostId","editedPostType","select","getEditedPostType","getEditedPostId","editSiteStore","records","templates","isResolving","isLoading","per_page","items","children","map","template","postId","id","rendered","slug","undefined","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["omit","object","keys","Object","fromEntries","entries","filter","key","includes","Item","item","linkInfo","params","props","config","wp_template","path","labels","title","loading","notFound","manage","wp_template_part","SidebarNavigationScreenTemplates","postType","isMobileViewport","editedPostId","editedPostType","select","getEditedPostType","getEditedPostId","editSiteStore","records","templates","isResolving","isLoading","per_page","items","children","map","template","postId","id","rendered","slug","undefined","className","index"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAQA;AACA;AACA;AAQA,SAASA,IAAT,CAAeC,MAAf,EAAuBC,IAAvB,EAA8B;AAC7B,SAAOC,MAAM,CAACC,WAAP,CACND,MAAM,CAACE,OAAP,CAAgBJ,MAAhB,EAAyBK,MAAzB,CAAiC;AAAA,QAAE,CAAEC,GAAF,CAAF;AAAA,WAAe,CAAEL,IAAI,CAACM,QAAL,CAAeD,GAAf,CAAjB;AAAA,GAAjC,CADM,CAAP;AAGA;;AAED,MAAME,IAAI,GAAG,SAAgB;AAAA,MAAd;AAAEC,IAAAA;AAAF,GAAc;AAC5B,QAAMC,QAAQ,GAAG,mBAASD,IAAI,CAACE,MAAd,CAAjB;AACA,QAAMC,KAAK,GAAGH,IAAI,CAACE,MAAL,GACX,EAAE,GAAGZ,IAAI,CAAEU,IAAF,EAAQ,QAAR,CAAT;AAA6B,OAAGC;AAAhC,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EC,IAAA,WAAW,EAAG,cAAI,QAAJ,CAFf;AAGC,IAAA,KAAK,EAAGF,MAAM,CAAEU,QAAF,CAAN,CAAmBP,MAAnB,CAA0BC,KAHnC;AAIC,IAAA,OAAO,EACN,CAAEO,gBAAF,IACC,4BAAC,uBAAD;AACC,MAAA,YAAY,EAAGD,QADhB;AAEC,MAAA,WAAW,EAAG;AACbsB,QAAAA,SAAS,EACR;AAFY;AAFf,MANH;AAeC,IAAA,OAAO,EACN,qDACC,4BAAC,mCAAD,QACGT,KAAK,CAACE,GAAN,CAAW,CAAE7B,IAAF,EAAQqC,KAAR,KACZ,4BAAC,IAAD;AAAM,MAAA,IAAI,EAAGrC,IAAb;AAAoB,MAAA,GAAG,EAAGqC;AAA1B,MADC,CADH,EAKC,4BAAC,8BAAD;AACC,MAAA,SAAS,EAAC;AADX,OAEM,mBAAS;AACbvB,MAAAA,QADa;AAEbiB,MAAAA,MAAM,EAAEI;AAFK,KAAT,CAFN;AAMC,sBACCjC,MAAM,CAACY,QAAP,KAAoBA,QAApB,IAAgC,CAAEZ,MAAM,CAAC6B,MAAzC,GACG,MADH,GAEGI,SATL;AAWC,MAAA,QAAQ,EAAG/B,MAAM,CAAEU,QAAF,CAAN,CAAmBP,MAAnB,CAA0BI;AAXtC,OALD,CADD;AAhBF,IADD;AAyCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useLocation } from '../routes';\nimport { store as editSiteStore } from '../../store';\nimport AddNewTemplate from '../add-new-template';\n\nfunction omit( object, keys ) {\n\treturn Object.fromEntries(\n\t\tObject.entries( object ).filter( ( [ key ] ) => ! keys.includes( key ) )\n\t);\n}\n\nconst Item = ( { item } ) => {\n\tconst linkInfo = useLink( item.params );\n\tconst props = item.params\n\t\t? { ...omit( item, 'params' ), ...linkInfo }\n\t\t: item;\n\treturn <SidebarNavigationItem { ...props } />;\n};\n\nconst config = {\n\twp_template: {\n\t\tpath: '/templates',\n\t\tlabels: {\n\t\t\ttitle: __( 'Templates' ),\n\t\t\tloading: __( 'Loading templates' ),\n\t\t\tnotFound: __( 'No templates found' ),\n\t\t\tmanage: __( 'Manage all templates' ),\n\t\t},\n\t},\n\twp_template_part: {\n\t\tpath: '/template-parts',\n\t\tlabels: {\n\t\t\ttitle: __( 'Template parts' ),\n\t\t\tloading: __( 'Loading template parts' ),\n\t\t\tnotFound: __( 'No template parts found' ),\n\t\t\tmanage: __( 'Manage all template parts' ),\n\t\t},\n\t},\n};\n\nexport default function SidebarNavigationScreenTemplates( {\n\tpostType = 'wp_template',\n} ) {\n\tconst { params } = useLocation();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\t// Ideally the URL params would be enough.\n\t// Loading the editor should ideally redirect to the home page\n\t// instead of fetching the edited entity here.\n\tconst { editedPostId, editedPostType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = select( editSiteStore );\n\t\treturn {\n\t\t\teditedPostId: getEditedPostId(),\n\t\t\teditedPostType: getEditedPostType(),\n\t\t};\n\t}, [] );\n\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tpostType,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tlet items = [];\n\tif ( isLoading ) {\n\t\titems = [\n\t\t\t{\n\t\t\t\tchildren: config[ postType ].labels.loading,\n\t\t\t},\n\t\t];\n\t} else if ( ! templates && ! isLoading ) {\n\t\titems = [\n\t\t\t{\n\t\t\t\tchildren: config[ postType ].labels.notFound,\n\t\t\t},\n\t\t];\n\t} else {\n\t\titems = templates?.map( ( template ) => ( {\n\t\t\tparams: {\n\t\t\t\tpostType,\n\t\t\t\tpostId: template.id,\n\t\t\t},\n\t\t\tchildren: decodeEntities(\n\t\t\t\ttemplate.title?.rendered || template.slug\n\t\t\t),\n\t\t\t'aria-current':\n\t\t\t\t( params.postType === postType &&\n\t\t\t\t\tparams.postId === template.id ) ||\n\t\t\t\t// This is a special case for the home page.\n\t\t\t\t( editedPostId === template.id &&\n\t\t\t\t\teditedPostType === postType &&\n\t\t\t\t\t!! params.postId )\n\t\t\t\t\t? 'page'\n\t\t\t\t\t: undefined,\n\t\t} ) );\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath={ config[ postType ].path }\n\t\t\tparentTitle={ __( 'Design' ) }\n\t\t\ttitle={ config[ postType ].labels.title }\n\t\t\tactions={\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ postType }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t\t'edit-site-sidebar-navigation-screen-templates__add-button',\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t{ items.map( ( item, index ) => (\n\t\t\t\t\t\t\t<Item item={ item } key={ index } />\n\t\t\t\t\t\t) ) }\n\n\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-templates__see-all\"\n\t\t\t\t\t\t\t{ ...useLink( {\n\t\t\t\t\t\t\t\tpostType,\n\t\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\taria-current={\n\t\t\t\t\t\t\t\tparams.postType === postType && ! params.postId\n\t\t\t\t\t\t\t\t\t? 'page'\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchildren={ config[ postType ].labels.manage }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ItemGroup>\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -113,7 +113,8 @@ const SiteHub = (0, _element.forwardRef)((_ref, ref) => {
|
|
|
113
113
|
}
|
|
114
114
|
}), (0, _element.createElement)(_components.__experimentalHStack, {
|
|
115
115
|
justify: "flex-start",
|
|
116
|
-
className: "edit-site-site-hub__text-content"
|
|
116
|
+
className: "edit-site-site-hub__text-content",
|
|
117
|
+
spacing: "0"
|
|
117
118
|
}, (0, _element.createElement)(_components.__unstableMotion.div, {
|
|
118
119
|
className: "edit-site-site-hub__view-mode-toggle-container",
|
|
119
120
|
layout: true,
|
|
@@ -134,7 +135,6 @@ const SiteHub = (0, _element.forwardRef)((_ref, ref) => {
|
|
|
134
135
|
className: "edit-site-site-hub__post-type"
|
|
135
136
|
}, entityConfig === null || entityConfig === void 0 ? void 0 : entityConfig.label))), showEditButton && (0, _element.createElement)(_components.Button, {
|
|
136
137
|
className: "edit-site-site-hub__edit-button",
|
|
137
|
-
label: (0, _i18n.__)('Open the editor'),
|
|
138
138
|
onClick: () => {
|
|
139
139
|
__unstableSetCanvasMode('edit');
|
|
140
140
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"names":["HUB_ANIMATION_DURATION","SiteHub","ref","isMobileCanvasVisible","setIsMobileCanvasVisible","props","params","isListPage","isEditorPage","canvasMode","dashboardLink","entityConfig","select","editSiteStore","getEditedPostType","__unstableGetCanvasMode","getSettings","__experimentalDashboardLink","coreStore","getEntityConfig","disableMotion","isMobileViewport","__unstableSetCanvasMode","clearSelectedBlock","blockEditorStore","showEditButton","isBackToDashboardButton","showLabels","siteIconButtonProps","href","label","onClick","getTitle","className","type","duration","ease"],"mappings":";;;;;;;;;AAmBA;;;;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CAAEY,gBAA7C,IACEA,gBAAgB,IACjBZ,UAAU,KAAK,MADd,IAEDN,qBAJF;AAKA,QAAMuB,uBAAuB,GAC1B,CAAEL,gBAAF,IAAsBZ,UAAU,KAAK,MAAvC,IACEY,gBAAgB,IAAI,CAAElB,qBAFzB;AAGA,QAAMwB,UAAU,GAAGlB,UAAU,KAAK,MAAlC;AACA,QAAMmB,mBAAmB,GAAGF,uBAAuB,GAChD;AACAG,IAAAA,IAAI,EAAEnB,aAAa,IAAI,WADvB;AAEA,kBAAc,cAAI,0BAAJ;AAFd,GADgD,GAKhD;AACAoB,IAAAA,KAAK,EAAE,cAAI,yBAAJ,CADP;AAEAC,IAAAA,OAAO,EAAE,MAAM;AACdR,MAAAA,kBAAkB;AAClBnB,MAAAA,wBAAwB,CAAE,KAAF,CAAxB;;AACAkB,MAAAA,uBAAuB,CAAE,MAAF,CAAvB;AACA;AAND,GALH;AAaA,QAAM;AAAEU,IAAAA;AAAF,MAAe,qCAArB;AAEA,SACC,4BAAC,4BAAD,CAAQ,GAAR;AACC,IAAA,GAAG,EAAG9B;AADP,KAEMG,KAFN;AAGC,IAAA,SAAS,EAAG,yBACX,oBADW,EAEXA,KAAK,CAAC4B,SAFK,CAHb;AAOC,IAAA,MAAM,MAPP;AAQC,IAAA,UAAU,EAAG;AACZC,MAAAA,IAAI,EAAE,OADM;AAEZC,MAAAA,QAAQ,EAAEf,aAAa,GAAG,CAAH,GAAOpB,sBAFlB;AAGZoC,MAAAA,IAAI,EAAE;AAHM;AARd,MAcC,4BAAC,gCAAD;AACC,IAAA,OAAO,EAAC,YADT;AAEC,IAAA,SAAS,EAAC;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"names":["HUB_ANIMATION_DURATION","SiteHub","ref","isMobileCanvasVisible","setIsMobileCanvasVisible","props","params","isListPage","isEditorPage","canvasMode","dashboardLink","entityConfig","select","editSiteStore","getEditedPostType","__unstableGetCanvasMode","getSettings","__experimentalDashboardLink","coreStore","getEntityConfig","disableMotion","isMobileViewport","__unstableSetCanvasMode","clearSelectedBlock","blockEditorStore","showEditButton","isBackToDashboardButton","showLabels","siteIconButtonProps","href","label","onClick","getTitle","className","type","duration","ease"],"mappings":";;;;;;;;;AAmBA;;;;AAhBA;;AAKA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;AAOA,MAAMA,sBAAsB,GAAG,GAA/B;AAEA,MAAMC,OAAO,GAAG,yBACf,OAAiEC,GAAjE,KAA0E;AAAA,MAAxE;AAAEC,IAAAA,qBAAF;AAAyBC,IAAAA,wBAAzB;AAAmD,OAAGC;AAAtD,GAAwE;AACzE,QAAM;AAAEC,IAAAA;AAAF,MAAa,0BAAnB;AACA,QAAMC,UAAU,GAAG,4BAAeD,MAAf,CAAnB;AACA,QAAME,YAAY,GAAG,CAAED,UAAvB;AACA,QAAM;AAAEE,IAAAA,UAAF;AAAcC,IAAAA,aAAd;AAA6BC,IAAAA;AAA7B,MAA8C,qBACjDC,MAAF,IAAc;AACbA,IAAAA,MAAM,CAAEC,YAAF,CAAN,CAAwBC,iBAAxB;AACA,UAAM;AACLC,MAAAA,uBADK;AAELC,MAAAA,WAFK;AAGLF,MAAAA;AAHK,QAIFF,MAAM,CAAEC,YAAF,CAJV;AAKA,WAAO;AACNJ,MAAAA,UAAU,EAAEM,uBAAuB,EAD7B;AAENL,MAAAA,aAAa,EAAEM,WAAW,GAAGC,2BAFvB;AAGNN,MAAAA,YAAY,EAAEC,MAAM,CAAEM,eAAF,CAAN,CAAoBC,eAApB,CACb,UADa,EAEbL,iBAAiB,EAFJ;AAHR,KAAP;AAQA,GAhBkD,EAiBnD,EAjBmD,CAApD;AAmBA,QAAMM,aAAa,GAAG,gCAAtB;AACA,QAAMC,gBAAgB,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAzB;AACA,QAAM;AAAEC,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,4BAAD,CAAQ,GAAR;AACC,IAAA,SAAS,EAAC,gDADX;AAEC,IAAA,MAAM,MAFP;AAGC,IAAA,UAAU,EAAG;AACZF,MAAAA,IAAI,EAAE,OADM;AAEZC,MAAAA,QAAQ,EAAEf,aAAa,GACpB,CADoB,GAEpBpB,sBAJS;AAKZoC,MAAAA,IAAI,EAAE;AALM;AAHd,KAWC,4BAAC,kBAAD,6BACMR,mBADN;AAEC,IAAA,SAAS,EAAC;AAFX,MAIC,4BAAC,iBAAD;AAAU,IAAA,SAAS,EAAC;AAApB,IAJD,CAXD,CALD,EAwBGD,UAAU,IACX,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGK,QAAQ,EADX,CADD,EAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGrB,YADH,aACGA,YADH,uBACGA,YAAY,CAAEmB,KADjB,CAJD,CAzBF,CAdD,EAkDGL,cAAc,IACf,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,OAAO,EAAG,MAAM;AACfH,MAAAA,uBAAuB,CAAE,MAAF,CAAvB;AACA,KAJF;AAKC,IAAA,OAAO,EAAC;AALT,KAOG,cAAI,MAAJ,CAPH,CAnDF,EA8DGD,gBAAgB,IAAI,CAAElB,qBAAtB,IACD,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAG,MAAMC,wBAAwB,CAAE,IAAF,CADzC;AAEC,IAAA,OAAO,EAAC;AAFT,KAIG,cAAI,aAAJ,CAJH,CA/DF,CADD;AAyEA,CA7Hc,CAAhB;eAgIeH,O","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useReducedMotion, useViewportMatch } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { useLocation } from '../routes';\nimport getIsListPage from '../../utils/get-is-list-page';\nimport SiteIcon from '../site-icon';\nimport useEditedEntityRecord from '../use-edited-entity-record';\n\nconst HUB_ANIMATION_DURATION = 0.3;\n\nconst SiteHub = forwardRef(\n\t( { isMobileCanvasVisible, setIsMobileCanvasVisible, ...props }, ref ) => {\n\t\tconst { params } = useLocation();\n\t\tconst isListPage = getIsListPage( params );\n\t\tconst isEditorPage = ! isListPage;\n\t\tconst { canvasMode, dashboardLink, entityConfig } = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tselect( editSiteStore ).getEditedPostType();\n\t\t\t\tconst {\n\t\t\t\t\t__unstableGetCanvasMode,\n\t\t\t\t\tgetSettings,\n\t\t\t\t\tgetEditedPostType,\n\t\t\t\t} = select( editSiteStore );\n\t\t\t\treturn {\n\t\t\t\t\tcanvasMode: __unstableGetCanvasMode(),\n\t\t\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t\t\t\tentityConfig: select( coreStore ).getEntityConfig(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tgetEditedPostType()\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t\tconst disableMotion = useReducedMotion();\n\t\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\t\tconst { __unstableSetCanvasMode } = useDispatch( editSiteStore );\n\t\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\t\tconst showEditButton =\n\t\t\t( isEditorPage && canvasMode === 'view' && ! isMobileViewport ) ||\n\t\t\t( isMobileViewport &&\n\t\t\t\tcanvasMode === 'view' &&\n\t\t\t\tisMobileCanvasVisible );\n\t\tconst isBackToDashboardButton =\n\t\t\t( ! isMobileViewport && canvasMode === 'view' ) ||\n\t\t\t( isMobileViewport && ! isMobileCanvasVisible );\n\t\tconst showLabels = canvasMode !== 'edit';\n\t\tconst siteIconButtonProps = isBackToDashboardButton\n\t\t\t? {\n\t\t\t\t\thref: dashboardLink || 'index.php',\n\t\t\t\t\t'aria-label': __( 'Go back to the dashboard' ),\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tlabel: __( 'Open Navigation Sidebar' ),\n\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\tsetIsMobileCanvasVisible( false );\n\t\t\t\t\t\t__unstableSetCanvasMode( 'view' );\n\t\t\t\t\t},\n\t\t\t };\n\t\tconst { getTitle } = useEditedEntityRecord();\n\n\t\treturn (\n\t\t\t<motion.div\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...props }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'edit-site-site-hub',\n\t\t\t\t\tprops.className\n\t\t\t\t) }\n\t\t\t\tlayout\n\t\t\t\ttransition={ {\n\t\t\t\t\ttype: 'tween',\n\t\t\t\t\tduration: disableMotion ? 0 : HUB_ANIMATION_DURATION,\n\t\t\t\t\tease: 'easeOut',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"edit-site-site-hub__text-content\"\n\t\t\t\t\tspacing=\"0\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"edit-site-site-hub__view-mode-toggle-container\"\n\t\t\t\t\t\tlayout\n\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t: HUB_ANIMATION_DURATION,\n\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t{ ...siteIconButtonProps }\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__view-mode-toggle\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-layout__view-mode-toggle-icon\" />\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</motion.div>\n\n\t\t\t\t\t{ showLabels && (\n\t\t\t\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t\t\t\t<div className=\"edit-site-site-hub__title\">\n\t\t\t\t\t\t\t\t{ getTitle() }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div className=\"edit-site-site-hub__post-type\">\n\t\t\t\t\t\t\t\t{ entityConfig?.label }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\n\t\t\t\t{ showEditButton && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-site-site-hub__edit-button\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t__unstableSetCanvasMode( 'edit' );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\n\t\t\t\t{ isMobileViewport && ! isMobileCanvasVisible && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={ () => setIsMobileCanvasVisible( true ) }\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'View Editor' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t);\n\t}\n);\n\nexport default SiteHub;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/site-icon/index.js"],"names":["SiteIcon","className","isRequestingSite","siteIconUrl","select","getEntityRecord","isResolving","coreDataStore","siteData","undefined","site_icon_url","icon","wordpress"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAZA;AACA;AACA;;AAGA;AACA;AACA;AAOA,SAASA,QAAT,OAAmC;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AAClC,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAAoC,qBAAaC,MAAF,IAAc;AAClE,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QAAmCF,MAAM,CAAEG,eAAF,CAA/C;AACA,UAAMC,QAAQ,GACbH,eAAe,CAAE,MAAF,EAAU,gBAAV,EAA4BI,SAA5B,CAAf,IAA0D,EAD3D;AAGA,WAAO;AACNP,MAAAA,gBAAgB,EAAEI,WAAW,CAAE,MAAF,EAAU,iBAAV,EAA6B,CACzD,MADyD,EAEzD,gBAFyD,EAGzDG,SAHyD,CAA7B,CADvB;AAMNN,MAAAA,WAAW,EAAEK,QAAQ,CAACE;AANhB,KAAP;AAQA,GAbyC,EAavC,EAbuC,CAA1C;;AAeA,MAAKR,gBAAgB,IAAI,CAAEC,WAA3B,EAAyC;AACxC,WAAO,IAAP;AACA;;AAED,QAAMQ,IAAI,GAAGR,WAAW,GACvB;AACC,IAAA,SAAS,EAAC,4BADX;AAEC,IAAA,GAAG,EAAG,cAAI,WAAJ,CAFP;AAGC,IAAA,GAAG,EAAGA;AAHP,IADuB,GAOvB,4BAAC,gBAAD;AACC,IAAA,SAAS,EAAC,2BADX;AAEC,IAAA,IAAI,EAAC,MAFN;AAGC,IAAA,IAAI,EAAGS;AAHR,IAPD;AAcA,SACC;AAAK,IAAA,SAAS,EAAG,yBAAYX,SAAZ,EAAuB,qBAAvB;AAAjB,KACGU,IADH,CADD;AAKA;;eAEcX,Q","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { Icon } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { wordpress } from '@wordpress/icons';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\nfunction SiteIcon( { className } ) {\n\tconst { isRequestingSite, siteIconUrl } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, isResolving } = select( coreDataStore );\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\tisRequestingSite: isResolving( 'core', 'getEntityRecord', [\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase',\n\t\t\t\tundefined,\n\t\t\t] ),\n\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t};\n\t}, [] );\n\n\tif ( isRequestingSite && ! siteIconUrl ) {\n\t\treturn null;\n\t}\n\n\tconst icon = siteIconUrl ? (\n\t\t<img\n\t\t\tclassName=\"edit-site-site-icon__image\"\n\t\t\talt={ __( 'Site Icon' ) }\n\t\t\tsrc={ siteIconUrl }\n\t\t/>\n\t) : (\n\t\t<Icon\n\t\t\tclassName=\"edit-site-site-icon__icon\"\n\t\t\tsize=\"
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/site-icon/index.js"],"names":["SiteIcon","className","isRequestingSite","siteIconUrl","select","getEntityRecord","isResolving","coreDataStore","siteData","undefined","site_icon_url","icon","wordpress"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAZA;AACA;AACA;;AAGA;AACA;AACA;AAOA,SAASA,QAAT,OAAmC;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AAClC,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAAoC,qBAAaC,MAAF,IAAc;AAClE,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QAAmCF,MAAM,CAAEG,eAAF,CAA/C;AACA,UAAMC,QAAQ,GACbH,eAAe,CAAE,MAAF,EAAU,gBAAV,EAA4BI,SAA5B,CAAf,IAA0D,EAD3D;AAGA,WAAO;AACNP,MAAAA,gBAAgB,EAAEI,WAAW,CAAE,MAAF,EAAU,iBAAV,EAA6B,CACzD,MADyD,EAEzD,gBAFyD,EAGzDG,SAHyD,CAA7B,CADvB;AAMNN,MAAAA,WAAW,EAAEK,QAAQ,CAACE;AANhB,KAAP;AAQA,GAbyC,EAavC,EAbuC,CAA1C;;AAeA,MAAKR,gBAAgB,IAAI,CAAEC,WAA3B,EAAyC;AACxC,WAAO,IAAP;AACA;;AAED,QAAMQ,IAAI,GAAGR,WAAW,GACvB;AACC,IAAA,SAAS,EAAC,4BADX;AAEC,IAAA,GAAG,EAAG,cAAI,WAAJ,CAFP;AAGC,IAAA,GAAG,EAAGA;AAHP,IADuB,GAOvB,4BAAC,gBAAD;AACC,IAAA,SAAS,EAAC,2BADX;AAEC,IAAA,IAAI,EAAC,MAFN;AAGC,IAAA,IAAI,EAAGS;AAHR,IAPD;AAcA,SACC;AAAK,IAAA,SAAS,EAAG,yBAAYX,SAAZ,EAAuB,qBAAvB;AAAjB,KACGU,IADH,CADD;AAKA;;eAEcX,Q","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { Icon } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { wordpress } from '@wordpress/icons';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\nfunction SiteIcon( { className } ) {\n\tconst { isRequestingSite, siteIconUrl } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, isResolving } = select( coreDataStore );\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\tisRequestingSite: isResolving( 'core', 'getEntityRecord', [\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase',\n\t\t\t\tundefined,\n\t\t\t] ),\n\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t};\n\t}, [] );\n\n\tif ( isRequestingSite && ! siteIconUrl ) {\n\t\treturn null;\n\t}\n\n\tconst icon = siteIconUrl ? (\n\t\t<img\n\t\t\tclassName=\"edit-site-site-icon__image\"\n\t\t\talt={ __( 'Site Icon' ) }\n\t\t\tsrc={ siteIconUrl }\n\t\t/>\n\t) : (\n\t\t<Icon\n\t\t\tclassName=\"edit-site-site-icon__icon\"\n\t\t\tsize=\"32px\"\n\t\t\ticon={ wordpress }\n\t\t/>\n\t);\n\n\treturn (\n\t\t<div className={ classnames( className, 'edit-site-site-icon' ) }>\n\t\t\t{ icon }\n\t\t</div>\n\t);\n}\n\nexport default SiteIcon;\n"]}
|
|
@@ -24,7 +24,7 @@ var _icons = require("@wordpress/icons");
|
|
|
24
24
|
|
|
25
25
|
var _compose = require("@wordpress/compose");
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _experiments = require("../../experiments");
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* External dependencies
|
|
@@ -37,6 +37,9 @@ var _globalStyles = require("../global-styles");
|
|
|
37
37
|
/**
|
|
38
38
|
* Internal dependencies
|
|
39
39
|
*/
|
|
40
|
+
const {
|
|
41
|
+
useGlobalStyle
|
|
42
|
+
} = (0, _experiments.unlock)(_blockEditor.experiments);
|
|
40
43
|
const SLOT_FILL_NAME = 'EditSiteStyleBook';
|
|
41
44
|
const {
|
|
42
45
|
Slot: StyleBookSlot,
|
|
@@ -83,8 +86,8 @@ function StyleBook(_ref) {
|
|
|
83
86
|
onClose
|
|
84
87
|
} = _ref;
|
|
85
88
|
const [resizeObserver, sizes] = (0, _compose.useResizeObserver)();
|
|
86
|
-
const [textColor] = (
|
|
87
|
-
const [backgroundColor] = (
|
|
89
|
+
const [textColor] = useGlobalStyle('color.text');
|
|
90
|
+
const [backgroundColor] = useGlobalStyle('color.background');
|
|
88
91
|
const examples = (0, _element.useMemo)(getExamples, []);
|
|
89
92
|
const tabs = (0, _element.useMemo)(() => (0, _blocks.getCategories)().filter(category => examples.some(example => example.category === category.slug)).map(category => ({
|
|
90
93
|
name: category.slug,
|
|
@@ -156,7 +159,7 @@ const Example = (0, _element.memo)(_ref3 => {
|
|
|
156
159
|
}, (0, _element.createElement)(_blockEditor.BlockPreview, {
|
|
157
160
|
blocks: blocks,
|
|
158
161
|
viewportWidth: 0,
|
|
159
|
-
|
|
162
|
+
additionalStyles: [{
|
|
160
163
|
css: '.wp-block:first-child { margin-top: 0; }' + '.wp-block:last-child { margin-bottom: 0; }'
|
|
161
164
|
}]
|
|
162
165
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/style-book/index.js"],"names":["SLOT_FILL_NAME","Slot","StyleBookSlot","Fill","StyleBookFill","getExamples","headingsExample","name","title","category","blocks","content","level","otherExamples","filter","blockType","example","map","StyleBook","isSelected","onSelect","onClose","resizeObserver","sizes","textColor","backgroundColor","examples","tabs","some","slug","icon","width","color","background","closeSmall","tab","Examples","Example","onClick","css","useHasStyleBook","fills","length"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/style-book/index.js"],"names":["useGlobalStyle","blockEditorExperiments","SLOT_FILL_NAME","Slot","StyleBookSlot","Fill","StyleBookFill","getExamples","headingsExample","name","title","category","blocks","content","level","otherExamples","filter","blockType","example","map","StyleBook","isSelected","onSelect","onClose","resizeObserver","sizes","textColor","backgroundColor","examples","tabs","some","slug","icon","width","color","background","closeSmall","tab","Examples","Example","onClick","css","useHasStyleBook","fills","length"],"mappings":";;;;;;;;;;AA2BA;;AAxBA;;AAKA;;AAMA;;AACA;;AAMA;;AAIA;;AACA;;AAMA;;AAhCA;AACA;AACA;;AAGA;AACA;AACA;;AAsBA;AACA;AACA;AAGA,MAAM;AAAEA,EAAAA;AAAF,IAAqB,yBAAQC,wBAAR,CAA3B;AAEA,MAAMC,cAAc,GAAG,mBAAvB;AACA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,aAAR;AAAuBC,EAAAA,IAAI,EAAEC;AAA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I,gCAAJ,CAFY,EAGZX,KAHY,CAJd;AASC,IAAA,OAAO,EAAG8B;AATX,KAWC;AAAM,IAAA,SAAS,EAAC;AAAhB,KAAwD9B,KAAxD,CAXD,EAYC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,yBAAD;AACC,IAAA,MAAM,EAAGE,MADV;AAEC,IAAA,aAAa,EAAG,CAFjB;AAGC,IAAA,gBAAgB,EAAG,CAClB;AACC6B,MAAAA,GAAG,EACF,6CACA;AAHF,KADkB;AAHpB,IADD,CAZD,CADqB;AAAA,CAAN,CAAhB;;AA6BA,SAASC,eAAT,GAA2B;AAC1B,QAAMC,KAAK,GAAG,4CAAczC,cAAd,CAAd;AACA,SAAO,CAAC,EAAEyC,KAAF,aAAEA,KAAF,eAAEA,KAAK,CAAEC,MAAT,CAAR;AACA;;AAEDxB,SAAS,CAACjB,IAAV,GAAiBC,aAAjB;eACegB,S","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tTabPanel,\n\tcreateSlotFill,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tgetCategories,\n\tgetBlockTypes,\n\tgetBlockFromExample,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport {\n\tBlockPreview,\n\texperiments as blockEditorExperiments,\n} from '@wordpress/block-editor';\nimport { closeSmall } from '@wordpress/icons';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { useMemo, memo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../experiments';\n\nconst { useGlobalStyle } = unlock( blockEditorExperiments );\n\nconst SLOT_FILL_NAME = 'EditSiteStyleBook';\nconst { Slot: StyleBookSlot, Fill: StyleBookFill } =\n\tcreateSlotFill( SLOT_FILL_NAME );\n\nfunction getExamples() {\n\t// Use our own example for the Heading block so that we can show multiple\n\t// heading levels.\n\tconst headingsExample = {\n\t\tname: 'core/heading',\n\t\ttitle: __( 'Headings' ),\n\t\tcategory: 'text',\n\t\tblocks: [\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 1,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 2,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 3,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 4,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 5,\n\t\t\t} ),\n\t\t],\n\t};\n\n\tconst otherExamples = getBlockTypes()\n\t\t.filter(\n\t\t\t( blockType ) =>\n\t\t\t\tblockType.name !== 'core/heading' && !! blockType.example\n\t\t)\n\t\t.map( ( blockType ) => ( {\n\t\t\tname: blockType.name,\n\t\t\ttitle: blockType.title,\n\t\t\tcategory: blockType.category,\n\t\t\tblocks: getBlockFromExample( blockType.name, blockType.example ),\n\t\t} ) );\n\n\treturn [ headingsExample, ...otherExamples ];\n}\n\nfunction StyleBook( { isSelected, onSelect, onClose } ) {\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\tconst [ textColor ] = useGlobalStyle( 'color.text' );\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\tconst examples = useMemo( getExamples, [] );\n\tconst tabs = useMemo(\n\t\t() =>\n\t\t\tgetCategories()\n\t\t\t\t.filter( ( category ) =>\n\t\t\t\t\texamples.some(\n\t\t\t\t\t\t( example ) => example.category === category.slug\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( category ) => ( {\n\t\t\t\t\tname: category.slug,\n\t\t\t\t\ttitle: category.title,\n\t\t\t\t\ticon: category.icon,\n\t\t\t\t} ) ),\n\t\t[ examples ]\n\t);\n\treturn (\n\t\t<StyleBookFill>\n\t\t\t<section\n\t\t\t\tclassName={ classnames( 'edit-site-style-book', {\n\t\t\t\t\t'is-wide': sizes.width > 600,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\tcolor: textColor,\n\t\t\t\t\tbackground: backgroundColor,\n\t\t\t\t} }\n\t\t\t\taria-label={ __( 'Style Book' ) }\n\t\t\t>\n\t\t\t\t{ resizeObserver }\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"edit-site-style-book__close-button\"\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close Style Book' ) }\n\t\t\t\t\tonClick={ onClose }\n\t\t\t\t/>\n\t\t\t\t<TabPanel\n\t\t\t\t\tclassName=\"edit-site-style-book__tab-panel\"\n\t\t\t\t\ttabs={ tabs }\n\t\t\t\t>\n\t\t\t\t\t{ ( tab ) => (\n\t\t\t\t\t\t<Examples\n\t\t\t\t\t\t\texamples={ examples }\n\t\t\t\t\t\t\tcategory={ tab.name }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TabPanel>\n\t\t\t</section>\n\t\t</StyleBookFill>\n\t);\n}\n\nconst Examples = memo( ( { examples, category, isSelected, onSelect } ) => (\n\t<div className=\"edit-site-style-book__examples\">\n\t\t{ examples\n\t\t\t.filter( ( example ) => example.category === category )\n\t\t\t.map( ( example ) => (\n\t\t\t\t<Example\n\t\t\t\t\tkey={ example.name }\n\t\t\t\t\ttitle={ example.title }\n\t\t\t\t\tblocks={ example.blocks }\n\t\t\t\t\tisSelected={ isSelected( example.name ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonSelect( example.name );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) ) }\n\t</div>\n) );\n\nconst Example = memo( ( { title, blocks, isSelected, onClick } ) => (\n\t<button\n\t\tclassName={ classnames( 'edit-site-style-book__example', {\n\t\t\t'is-selected': isSelected,\n\t\t} ) }\n\t\taria-label={ sprintf(\n\t\t\t// translators: %s: Title of a block, e.g. Heading.\n\t\t\t__( 'Open %s styles in Styles panel' ),\n\t\t\ttitle\n\t\t) }\n\t\tonClick={ onClick }\n\t>\n\t\t<span className=\"edit-site-style-book__example-title\">{ title }</span>\n\t\t<div className=\"edit-site-style-book__example-preview\">\n\t\t\t<BlockPreview\n\t\t\t\tblocks={ blocks }\n\t\t\t\tviewportWidth={ 0 }\n\t\t\t\tadditionalStyles={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tcss:\n\t\t\t\t\t\t\t'.wp-block:first-child { margin-top: 0; }' +\n\t\t\t\t\t\t\t'.wp-block:last-child { margin-bottom: 0; }',\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t</div>\n\t</button>\n) );\n\nfunction useHasStyleBook() {\n\tconst fills = useSlotFills( SLOT_FILL_NAME );\n\treturn !! fills?.length;\n}\n\nStyleBook.Slot = StyleBookSlot;\nexport default StyleBook;\nexport { useHasStyleBook };\n"]}
|
|
@@ -9,8 +9,6 @@ exports.default = ConvertToTemplatePart;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _lodash = require("lodash");
|
|
13
|
-
|
|
14
12
|
var _data = require("@wordpress/data");
|
|
15
13
|
|
|
16
14
|
var _blockEditor = require("@wordpress/block-editor");
|
|
@@ -31,9 +29,7 @@ var _createTemplatePartModal = _interopRequireDefault(require("../create-templat
|
|
|
31
29
|
|
|
32
30
|
var _store = require("../../store");
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
* External dependencies
|
|
36
|
-
*/
|
|
32
|
+
var _templatePartCreate = require("../../utils/template-part-create");
|
|
37
33
|
|
|
38
34
|
/**
|
|
39
35
|
* WordPress dependencies
|
|
@@ -57,6 +53,7 @@ function ConvertToTemplatePart(_ref) {
|
|
|
57
53
|
const {
|
|
58
54
|
createSuccessNotice
|
|
59
55
|
} = (0, _data.useDispatch)(_notices.store);
|
|
56
|
+
const existingTemplateParts = (0, _templatePartCreate.useExistingTemplateParts)();
|
|
60
57
|
const {
|
|
61
58
|
canCreate
|
|
62
59
|
} = (0, _data.useSelect)(select => {
|
|
@@ -77,12 +74,11 @@ function ConvertToTemplatePart(_ref) {
|
|
|
77
74
|
title,
|
|
78
75
|
area
|
|
79
76
|
} = _ref2;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const cleanSlug = (0, _lodash.kebabCase)(title).replace(/[^\w-]+/g, '') || 'wp-custom-part';
|
|
77
|
+
const uniqueTitle = (0, _templatePartCreate.getUniqueTemplatePartTitle)(title, existingTemplateParts);
|
|
78
|
+
const cleanSlug = (0, _templatePartCreate.getCleanTemplatePartSlug)(uniqueTitle);
|
|
83
79
|
const templatePart = await saveEntityRecord('postType', 'wp_template_part', {
|
|
84
80
|
slug: cleanSlug,
|
|
85
|
-
title,
|
|
81
|
+
title: uniqueTitle,
|
|
86
82
|
content: (0, _blocks.serialize)(blocks),
|
|
87
83
|
area
|
|
88
84
|
});
|