@wordpress/edit-site 5.8.0 → 5.10.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 +4 -0
- package/build/components/add-new-template/add-custom-template-modal.js +21 -6
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +8 -2
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +8 -4
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js +8 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/back-button.js +10 -3
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +39 -6
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +7 -7
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/editor/index.js +43 -9
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +131 -0
- package/build/components/editor-canvas-container/index.js.map +1 -0
- package/build/components/global-styles/block-preview-panel.js +1 -1
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +53 -5
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +14 -3
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +17 -18
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +4 -18
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +14 -3
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/root-menu.js +61 -0
- package/build/components/global-styles/root-menu.js.map +1 -0
- package/build/components/global-styles/screen-block-list.js +3 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +158 -7
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +9 -26
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +20 -15
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +4 -17
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +148 -0
- package/build/components/global-styles/screen-revisions/index.js.map +1 -0
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +132 -0
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +130 -0
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
- package/build/components/global-styles/screen-root.js +2 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +0 -3
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +11 -39
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +3 -8
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +7 -11
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +66 -120
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/variations-panel.js +4 -28
- package/build/components/global-styles/variations-panel.js.map +1 -1
- package/build/components/header-edit-mode/index.js +11 -7
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +1 -1
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +22 -14
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/index.js +9 -3
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +4 -4
- package/build/components/list/table.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +44 -0
- package/build/components/plugin-template-setting-panel/index.js.map +1 -0
- package/build/components/revisions/index.js +95 -0
- package/build/components/revisions/index.js.map +1 -0
- package/build/components/routes/link.js +17 -2
- package/build/components/routes/link.js.map +1 -1
- package/build/components/routes/use-title.js +8 -2
- package/build/components/routes/use-title.js.map +1 -1
- package/build/components/save-button/index.js +31 -6
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +14 -31
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/save-panel/index.js +20 -7
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +2 -7
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +16 -2
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +35 -14
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +9 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +40 -0
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
- package/build/components/sidebar-edit-mode/template-card/index.js +1 -8
- package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +1 -1
- package/build/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
- package/build/components/sidebar-navigation-item/index.js +5 -7
- package/build/components/sidebar-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +14 -4
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +24 -7
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +17 -5
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +3 -3
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +67 -0
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pages/index.js +74 -0
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +5 -3
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-subtitle/index.js +18 -0
- package/build/components/sidebar-navigation-subtitle/index.js.map +1 -0
- package/build/components/site-hub/index.js +64 -12
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +8 -7
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/start-template-options/index.js +21 -24
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +9 -41
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +13 -5
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +9 -4
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +17 -3
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +3 -1
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +9 -3
- package/build/components/template-details/template-areas.js.map +1 -1
- package/build/hooks/template-part-edit.js +8 -2
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +8 -0
- package/build/index.js.map +1 -1
- package/build/store/private-actions.js +19 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +13 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +23 -1
- package/build/store/reducer.js.map +1 -1
- package/build/utils/is-previewing-theme.js +27 -0
- package/build/utils/is-previewing-theme.js.map +1 -0
- package/build/utils/use-activate-theme.js +46 -0
- package/build/utils/use-activate-theme.js.map +1 -0
- package/build-module/components/add-new-template/add-custom-template-modal.js +21 -6
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +5 -1
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +7 -3
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js +6 -2
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +6 -1
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +37 -6
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +6 -6
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/editor/index.js +45 -11
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +115 -0
- package/build-module/components/editor-canvas-container/index.js.map +1 -0
- package/build-module/components/global-styles/block-preview-panel.js +1 -1
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +54 -5
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +13 -3
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +17 -18
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +5 -19
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +13 -3
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/root-menu.js +47 -0
- package/build-module/components/global-styles/root-menu.js.map +1 -0
- package/build-module/components/global-styles/screen-block-list.js +4 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +151 -7
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +9 -25
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +20 -15
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +4 -16
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +128 -0
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -0
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +121 -0
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +116 -0
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
- package/build-module/components/global-styles/screen-root.js +2 -2
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +0 -3
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +11 -37
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +3 -7
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +7 -11
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +66 -118
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/variations-panel.js +3 -22
- package/build-module/components/global-styles/variations-panel.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +10 -7
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +1 -1
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +17 -10
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/index.js +5 -1
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +4 -4
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +35 -0
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -0
- package/build-module/components/revisions/index.js +77 -0
- package/build-module/components/revisions/index.js.map +1 -0
- package/build-module/components/routes/link.js +13 -1
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/routes/use-title.js +5 -1
- package/build-module/components/routes/use-title.js.map +1 -1
- package/build-module/components/save-button/index.js +28 -6
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +13 -32
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +19 -7
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +3 -8
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +11 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +35 -16
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +10 -5
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +29 -0
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/template-card/index.js +2 -7
- package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +1 -1
- package/build-module/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-item/index.js +6 -8
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +13 -5
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +25 -8
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +13 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +3 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +48 -0
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pages/index.js +57 -0
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -3
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-subtitle/index.js +10 -0
- package/build-module/components/sidebar-navigation-subtitle/index.js.map +1 -0
- package/build-module/components/site-hub/index.js +64 -14
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +8 -7
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +22 -25
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/style-book/index.js +10 -41
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -4
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +5 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +13 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-details/index.js +3 -1
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +5 -1
- package/build-module/components/template-details/template-areas.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +5 -1
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/private-actions.js +15 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +11 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +23 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/utils/is-previewing-theme.js +17 -0
- package/build-module/utils/is-previewing-theme.js.map +1 -0
- package/build-module/utils/use-activate-theme.js +36 -0
- package/build-module/utils/use-activate-theme.js.map +1 -0
- package/build-style/style-rtl.css +310 -137
- package/build-style/style.css +310 -137
- package/package.json +37 -35
- package/src/components/add-new-template/add-custom-template-modal.js +31 -8
- package/src/components/add-new-template/new-template-part.js +4 -1
- package/src/components/add-new-template/new-template.js +6 -1
- package/src/components/add-new-template/style.scss +52 -48
- package/src/components/app/index.js +6 -3
- package/src/components/block-editor/back-button.js +4 -1
- package/src/components/block-editor/editor-canvas.js +36 -8
- package/src/components/block-editor/index.js +8 -8
- package/src/components/block-editor/style.scss +15 -8
- package/src/components/editor/index.js +48 -7
- package/src/components/editor-canvas-container/index.js +128 -0
- package/src/components/editor-canvas-container/style.scss +19 -0
- package/src/components/global-styles/block-preview-panel.js +1 -1
- package/src/components/global-styles/border-panel.js +46 -3
- package/src/components/global-styles/color-palette-panel.js +9 -0
- package/src/components/global-styles/dimensions-panel.js +15 -15
- package/src/components/global-styles/global-styles-provider.js +4 -18
- package/src/components/global-styles/gradients-palette-panel.js +8 -0
- package/src/components/global-styles/root-menu.js +66 -0
- package/src/components/global-styles/screen-block-list.js +2 -2
- package/src/components/global-styles/screen-block.js +184 -7
- package/src/components/global-styles/screen-colors.js +9 -16
- package/src/components/global-styles/screen-css.js +21 -21
- package/src/components/global-styles/screen-layout.js +5 -9
- package/src/components/global-styles/screen-revisions/index.js +177 -0
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +131 -0
- package/src/components/global-styles/screen-revisions/style.scss +99 -0
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +125 -0
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +103 -0
- package/src/components/global-styles/screen-root.js +2 -2
- package/src/components/global-styles/screen-typography-element.js +1 -3
- package/src/components/global-styles/screen-typography.js +44 -79
- package/src/components/global-styles/style-variations-container.js +4 -10
- package/src/components/global-styles/style.scss +1 -23
- package/src/components/global-styles/typography-panel.js +12 -13
- package/src/components/global-styles/ui.js +82 -107
- package/src/components/global-styles/variations-panel.js +3 -26
- package/src/components/header-edit-mode/index.js +17 -5
- package/src/components/keyboard-shortcuts/register.js +1 -1
- package/src/components/layout/index.js +16 -19
- package/src/components/layout/style.scss +32 -7
- package/src/components/list/index.js +4 -1
- package/src/components/list/style.scss +4 -0
- package/src/components/list/table.js +19 -3
- package/src/components/plugin-template-setting-panel/index.js +33 -0
- package/src/components/revisions/index.js +104 -0
- package/src/components/routes/link.js +16 -1
- package/src/components/routes/use-title.js +4 -1
- package/src/components/save-button/index.js +27 -6
- package/src/components/save-hub/index.js +17 -35
- package/src/components/save-panel/index.js +15 -3
- package/src/components/secondary-sidebar/list-view-sidebar.js +2 -6
- package/src/components/secondary-sidebar/style.scss +23 -5
- package/src/components/sidebar/index.js +12 -1
- package/src/components/sidebar/style.scss +2 -1
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +39 -18
- package/src/components/sidebar-edit-mode/index.js +17 -6
- package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +26 -0
- package/src/components/sidebar-edit-mode/style.scss +10 -0
- package/src/components/sidebar-edit-mode/template-card/index.js +1 -9
- package/src/components/sidebar-navigation-item/index.js +13 -14
- package/src/components/sidebar-navigation-item/style.scss +8 -1
- package/src/components/sidebar-navigation-screen/index.js +26 -5
- package/src/components/sidebar-navigation-screen-main/index.js +43 -22
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +3 -9
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +13 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +3 -3
- package/src/components/sidebar-navigation-screen-page/index.js +59 -0
- package/src/components/sidebar-navigation-screen-pages/index.js +82 -0
- package/src/components/sidebar-navigation-screen-pages/style.scss +4 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +5 -1
- package/src/components/sidebar-navigation-subtitle/index.js +5 -0
- package/src/components/sidebar-navigation-subtitle/style.scss +7 -0
- package/src/components/site-hub/index.js +92 -33
- package/src/components/site-hub/style.scss +8 -0
- package/src/components/site-icon/index.js +6 -11
- package/src/components/site-icon/style.scss +8 -3
- package/src/components/start-template-options/index.js +32 -39
- package/src/components/start-template-options/style.scss +36 -46
- package/src/components/style-book/index.js +7 -51
- package/src/components/style-book/style.scss +0 -18
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -4
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +3 -1
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +14 -1
- package/src/components/template-details/index.js +1 -0
- package/src/components/template-details/template-areas.js +4 -1
- package/src/hooks/template-part-edit.js +4 -1
- package/src/index.js +1 -0
- package/src/store/private-actions.js +14 -0
- package/src/store/private-selectors.js +11 -0
- package/src/store/reducer.js +18 -0
- package/src/store/test/actions.js +6 -14
- package/src/style.scss +5 -1
- package/src/utils/is-previewing-theme.js +18 -0
- package/src/utils/use-activate-theme.js +38 -0
- package/build/components/global-styles/context-menu.js +0 -126
- package/build/components/global-styles/context-menu.js.map +0 -1
- package/build/components/global-styles/custom-css.js +0 -113
- package/build/components/global-styles/custom-css.js.map +0 -1
- package/build/components/global-styles/effects-panel.js +0 -53
- package/build/components/global-styles/effects-panel.js.map +0 -1
- package/build/components/global-styles/filters-panel.js +0 -45
- package/build/components/global-styles/filters-panel.js.map +0 -1
- package/build/components/global-styles/screen-border.js +0 -61
- package/build/components/global-styles/screen-border.js.map +0 -1
- package/build/components/global-styles/screen-effects.js +0 -61
- package/build/components/global-styles/screen-effects.js.map +0 -1
- package/build/components/global-styles/screen-filters.js +0 -46
- package/build/components/global-styles/screen-filters.js.map +0 -1
- package/build/components/global-styles/screen-variations.js +0 -71
- package/build/components/global-styles/screen-variations.js.map +0 -1
- package/build/components/routes/index.js +0 -60
- package/build/components/routes/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
- package/build/hooks/commands/index.js +0 -19
- package/build/hooks/commands/index.js.map +0 -1
- package/build/hooks/commands/use-navigation-commands.js +0 -117
- package/build/hooks/commands/use-navigation-commands.js.map +0 -1
- package/build/hooks/commands/use-wp-admin-commands.js +0 -94
- package/build/hooks/commands/use-wp-admin-commands.js.map +0 -1
- package/build/utils/history.js +0 -41
- package/build/utils/history.js.map +0 -1
- package/build-module/components/global-styles/context-menu.js +0 -107
- package/build-module/components/global-styles/context-menu.js.map +0 -1
- package/build-module/components/global-styles/custom-css.js +0 -98
- package/build-module/components/global-styles/custom-css.js.map +0 -1
- package/build-module/components/global-styles/effects-panel.js +0 -43
- package/build-module/components/global-styles/effects-panel.js.map +0 -1
- package/build-module/components/global-styles/filters-panel.js +0 -35
- package/build-module/components/global-styles/filters-panel.js.map +0 -1
- package/build-module/components/global-styles/screen-border.js +0 -44
- package/build-module/components/global-styles/screen-border.js.map +0 -1
- package/build-module/components/global-styles/screen-effects.js +0 -44
- package/build-module/components/global-styles/screen-effects.js.map +0 -1
- package/build-module/components/global-styles/screen-filters.js +0 -33
- package/build-module/components/global-styles/screen-filters.js.map +0 -1
- package/build-module/components/global-styles/screen-variations.js +0 -54
- package/build-module/components/global-styles/screen-variations.js.map +0 -1
- package/build-module/components/routes/index.js +0 -47
- package/build-module/components/routes/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
- package/build-module/hooks/commands/index.js +0 -10
- package/build-module/hooks/commands/index.js.map +0 -1
- package/build-module/hooks/commands/use-navigation-commands.js +0 -101
- package/build-module/hooks/commands/use-navigation-commands.js.map +0 -1
- package/build-module/hooks/commands/use-wp-admin-commands.js +0 -79
- package/build-module/hooks/commands/use-wp-admin-commands.js.map +0 -1
- package/build-module/utils/history.js +0 -31
- package/build-module/utils/history.js.map +0 -1
- package/src/components/global-styles/context-menu.js +0 -175
- package/src/components/global-styles/custom-css.js +0 -131
- package/src/components/global-styles/effects-panel.js +0 -40
- package/src/components/global-styles/filters-panel.js +0 -33
- package/src/components/global-styles/screen-border.js +0 -35
- package/src/components/global-styles/screen-effects.js +0 -35
- package/src/components/global-styles/screen-filters.js +0 -27
- package/src/components/global-styles/screen-variations.js +0 -46
- package/src/components/routes/index.js +0 -53
- package/src/hooks/commands/index.js +0 -10
- package/src/hooks/commands/use-navigation-commands.js +0 -103
- package/src/hooks/commands/use-wp-admin-commands.js +0 -77
- package/src/utils/history.js +0 -39
- /package/src/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +0 -0
|
@@ -37,8 +37,6 @@ var _screenTypography = _interopRequireDefault(require("./screen-typography"));
|
|
|
37
37
|
|
|
38
38
|
var _screenTypographyElement = _interopRequireDefault(require("./screen-typography-element"));
|
|
39
39
|
|
|
40
|
-
var _screenFilters = _interopRequireDefault(require("./screen-filters"));
|
|
41
|
-
|
|
42
40
|
var _screenColors = _interopRequireDefault(require("./screen-colors"));
|
|
43
41
|
|
|
44
42
|
var _screenColorPalette = _interopRequireDefault(require("./screen-color-palette"));
|
|
@@ -47,17 +45,15 @@ var _screenLayout = _interopRequireDefault(require("./screen-layout"));
|
|
|
47
45
|
|
|
48
46
|
var _screenStyleVariations = _interopRequireDefault(require("./screen-style-variations"));
|
|
49
47
|
|
|
50
|
-
var _screenVariations = require("./screen-variations");
|
|
51
|
-
|
|
52
|
-
var _screenBorder = _interopRequireDefault(require("./screen-border"));
|
|
53
|
-
|
|
54
48
|
var _styleBook = _interopRequireDefault(require("../style-book"));
|
|
55
49
|
|
|
56
50
|
var _screenCss = _interopRequireDefault(require("./screen-css"));
|
|
57
51
|
|
|
52
|
+
var _screenRevisions = _interopRequireDefault(require("./screen-revisions"));
|
|
53
|
+
|
|
58
54
|
var _privateApis = require("../../private-apis");
|
|
59
55
|
|
|
60
|
-
var
|
|
56
|
+
var _store = require("../../store");
|
|
61
57
|
|
|
62
58
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
63
59
|
|
|
@@ -82,9 +78,10 @@ function GlobalStylesActionMenu() {
|
|
|
82
78
|
toggle
|
|
83
79
|
} = (0, _data.useDispatch)(_preferences.store);
|
|
84
80
|
const {
|
|
85
|
-
canEditCSS
|
|
81
|
+
canEditCSS,
|
|
82
|
+
revisionsCount
|
|
86
83
|
} = (0, _data.useSelect)(select => {
|
|
87
|
-
var _globalStyles$_links$, _globalStyles$_links;
|
|
84
|
+
var _globalStyles$_links$, _globalStyles$_links, _globalStyles$_links$2, _globalStyles$_links2, _globalStyles$_links3, _globalStyles$_links4;
|
|
88
85
|
|
|
89
86
|
const {
|
|
90
87
|
getEntityRecord,
|
|
@@ -95,7 +92,8 @@ function GlobalStylesActionMenu() {
|
|
|
95
92
|
|
|
96
93
|
const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
|
|
97
94
|
return {
|
|
98
|
-
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
|
|
95
|
+
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,
|
|
96
|
+
revisionsCount: (_globalStyles$_links$2 = globalStyles === null || globalStyles === void 0 ? void 0 : (_globalStyles$_links2 = globalStyles._links) === null || _globalStyles$_links2 === void 0 ? void 0 : (_globalStyles$_links3 = _globalStyles$_links2['version-history']) === null || _globalStyles$_links3 === void 0 ? void 0 : (_globalStyles$_links4 = _globalStyles$_links3[0]) === null || _globalStyles$_links4 === void 0 ? void 0 : _globalStyles$_links4.count) !== null && _globalStyles$_links$2 !== void 0 ? _globalStyles$_links$2 : 0
|
|
99
97
|
};
|
|
100
98
|
}, []);
|
|
101
99
|
const {
|
|
@@ -105,9 +103,18 @@ function GlobalStylesActionMenu() {
|
|
|
105
103
|
const {
|
|
106
104
|
goTo
|
|
107
105
|
} = (0, _components.__experimentalUseNavigator)();
|
|
106
|
+
const {
|
|
107
|
+
setEditorCanvasContainerView
|
|
108
|
+
} = (0, _privateApis.unlock)((0, _data.useDispatch)(_store.store));
|
|
108
109
|
|
|
109
110
|
const loadCustomCSS = () => goTo('/css');
|
|
110
111
|
|
|
112
|
+
const loadRevisions = () => {
|
|
113
|
+
goTo('/revisions');
|
|
114
|
+
setEditorCanvasContainerView('global-styles-revisions');
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const hasRevisions = revisionsCount >= 2;
|
|
111
118
|
return (0, _element.createElement)(GlobalStylesMenuFill, null, (0, _element.createElement)(_components.DropdownMenu, {
|
|
112
119
|
icon: _icons.moreVertical,
|
|
113
120
|
label: (0, _i18n.__)('Styles actions'),
|
|
@@ -121,6 +128,11 @@ function GlobalStylesActionMenu() {
|
|
|
121
128
|
}, ...(canEditCSS ? [{
|
|
122
129
|
title: (0, _i18n.__)('Additional CSS'),
|
|
123
130
|
onClick: loadCustomCSS
|
|
131
|
+
}] : []), ...(hasRevisions ? [{
|
|
132
|
+
title: (0, _i18n.sprintf)(
|
|
133
|
+
/* translators: %d: number of revisions */
|
|
134
|
+
(0, _i18n._n)('%d Revision', '%d Revisions', revisionsCount), revisionsCount),
|
|
135
|
+
onClick: loadRevisions
|
|
124
136
|
}] : [])]
|
|
125
137
|
}));
|
|
126
138
|
}
|
|
@@ -135,50 +147,26 @@ function GlobalStylesNavigationScreen(_ref) {
|
|
|
135
147
|
}, props));
|
|
136
148
|
}
|
|
137
149
|
|
|
138
|
-
function
|
|
139
|
-
let {
|
|
140
|
-
name
|
|
141
|
-
} = _ref2;
|
|
142
|
-
const blockStyleVariations = (0, _data.useSelect)(select => {
|
|
143
|
-
const {
|
|
144
|
-
getBlockStyles
|
|
145
|
-
} = select(_blocks.store);
|
|
146
|
-
return getBlockStyles(name);
|
|
147
|
-
}, [name]);
|
|
148
|
-
|
|
149
|
-
if (!(blockStyleVariations !== null && blockStyleVariations !== void 0 && blockStyleVariations.length)) {
|
|
150
|
-
return null;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return blockStyleVariations.map(variation => (0, _element.createElement)(ContextScreens, {
|
|
154
|
-
key: variation.name + name,
|
|
155
|
-
name: name,
|
|
156
|
-
parentMenu: '/blocks/' + encodeURIComponent(name) + '/variations/' + encodeURIComponent(variation.name),
|
|
157
|
-
variation: variation.name
|
|
158
|
-
}));
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function BlockStylesNavigationScreens(_ref3) {
|
|
150
|
+
function BlockStylesNavigationScreens(_ref2) {
|
|
162
151
|
let {
|
|
163
152
|
parentMenu,
|
|
164
153
|
blockStyles,
|
|
165
154
|
blockName
|
|
166
|
-
} =
|
|
155
|
+
} = _ref2;
|
|
167
156
|
return blockStyles.map((style, index) => (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
168
157
|
key: index,
|
|
169
158
|
path: parentMenu + '/variations/' + style.name
|
|
170
|
-
}, (0, _element.createElement)(
|
|
171
|
-
|
|
172
|
-
|
|
159
|
+
}, (0, _element.createElement)(_screenBlock.default, {
|
|
160
|
+
name: blockName,
|
|
161
|
+
variation: style.name
|
|
173
162
|
})));
|
|
174
163
|
}
|
|
175
164
|
|
|
176
|
-
function ContextScreens(
|
|
165
|
+
function ContextScreens(_ref3) {
|
|
177
166
|
let {
|
|
178
167
|
name,
|
|
179
|
-
parentMenu = ''
|
|
180
|
-
|
|
181
|
-
} = _ref4;
|
|
168
|
+
parentMenu = ''
|
|
169
|
+
} = _ref3;
|
|
182
170
|
const blockStyleVariations = (0, _data.useSelect)(select => {
|
|
183
171
|
const {
|
|
184
172
|
getBlockStyles
|
|
@@ -186,67 +174,9 @@ function ContextScreens(_ref4) {
|
|
|
186
174
|
return getBlockStyles(name);
|
|
187
175
|
}, [name]);
|
|
188
176
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
189
|
-
path: parentMenu + '/typography'
|
|
190
|
-
}, (0, _element.createElement)(_screenTypography.default, {
|
|
191
|
-
name: name,
|
|
192
|
-
variation: variation
|
|
193
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
194
|
-
path: parentMenu + '/typography/text'
|
|
195
|
-
}, (0, _element.createElement)(_screenTypographyElement.default, {
|
|
196
|
-
name: name,
|
|
197
|
-
element: "text"
|
|
198
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
199
|
-
path: parentMenu + '/typography/link'
|
|
200
|
-
}, (0, _element.createElement)(_screenTypographyElement.default, {
|
|
201
|
-
name: name,
|
|
202
|
-
element: "link"
|
|
203
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
204
|
-
path: parentMenu + '/typography/heading'
|
|
205
|
-
}, (0, _element.createElement)(_screenTypographyElement.default, {
|
|
206
|
-
name: name,
|
|
207
|
-
element: "heading"
|
|
208
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
209
|
-
path: parentMenu + '/typography/caption'
|
|
210
|
-
}, (0, _element.createElement)(_screenTypographyElement.default, {
|
|
211
|
-
name: name,
|
|
212
|
-
element: "caption"
|
|
213
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
214
|
-
path: parentMenu + '/typography/button'
|
|
215
|
-
}, (0, _element.createElement)(_screenTypographyElement.default, {
|
|
216
|
-
name: name,
|
|
217
|
-
element: "button"
|
|
218
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
219
|
-
path: parentMenu + '/colors'
|
|
220
|
-
}, (0, _element.createElement)(_screenColors.default, {
|
|
221
|
-
name: name,
|
|
222
|
-
variation: variation
|
|
223
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
224
177
|
path: parentMenu + '/colors/palette'
|
|
225
178
|
}, (0, _element.createElement)(_screenColorPalette.default, {
|
|
226
179
|
name: name
|
|
227
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
228
|
-
path: parentMenu + '/filters'
|
|
229
|
-
}, (0, _element.createElement)(_screenFilters.default, {
|
|
230
|
-
name: name
|
|
231
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
232
|
-
path: parentMenu + '/border'
|
|
233
|
-
}, (0, _element.createElement)(_screenBorder.default, {
|
|
234
|
-
name: name,
|
|
235
|
-
variation: variation
|
|
236
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
237
|
-
path: parentMenu + '/effects'
|
|
238
|
-
}, (0, _element.createElement)(_screenEffects.default, {
|
|
239
|
-
name: name,
|
|
240
|
-
variation: variation
|
|
241
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
242
|
-
path: parentMenu + '/layout'
|
|
243
|
-
}, (0, _element.createElement)(_screenLayout.default, {
|
|
244
|
-
name: name,
|
|
245
|
-
variation: variation
|
|
246
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
247
|
-
path: parentMenu + '/css'
|
|
248
|
-
}, (0, _element.createElement)(_screenCss.default, {
|
|
249
|
-
name: name
|
|
250
180
|
})), !!(blockStyleVariations !== null && blockStyleVariations !== void 0 && blockStyleVariations.length) && (0, _element.createElement)(BlockStylesNavigationScreens, {
|
|
251
181
|
parentMenu: parentMenu,
|
|
252
182
|
blockStyles: blockStyleVariations,
|
|
@@ -254,10 +184,7 @@ function ContextScreens(_ref4) {
|
|
|
254
184
|
}));
|
|
255
185
|
}
|
|
256
186
|
|
|
257
|
-
function GlobalStylesStyleBook(
|
|
258
|
-
let {
|
|
259
|
-
onClose
|
|
260
|
-
} = _ref5;
|
|
187
|
+
function GlobalStylesStyleBook() {
|
|
261
188
|
const navigator = (0, _components.__experimentalUseNavigator)();
|
|
262
189
|
const {
|
|
263
190
|
path
|
|
@@ -270,8 +197,7 @@ function GlobalStylesStyleBook(_ref5) {
|
|
|
270
197
|
onSelect: blockName => {
|
|
271
198
|
// Now go to the selected block.
|
|
272
199
|
navigator.goTo('/blocks/' + encodeURIComponent(blockName));
|
|
273
|
-
}
|
|
274
|
-
onClose: onClose
|
|
200
|
+
}
|
|
275
201
|
});
|
|
276
202
|
}
|
|
277
203
|
|
|
@@ -315,12 +241,9 @@ function GlobalStylesBlockLink() {
|
|
|
315
241
|
}, [selectedBlockClientId, selectedBlockName, blockHasGlobalStyles]);
|
|
316
242
|
}
|
|
317
243
|
|
|
318
|
-
function GlobalStylesUI(
|
|
319
|
-
let {
|
|
320
|
-
isStyleBookOpened,
|
|
321
|
-
onCloseStyleBook
|
|
322
|
-
} = _ref6;
|
|
244
|
+
function GlobalStylesUI() {
|
|
323
245
|
const blocks = (0, _blocks.getBlockTypes)();
|
|
246
|
+
const editorCanvasContainerView = (0, _data.useSelect)(select => (0, _privateApis.unlock)(select(_store.store)).getEditorCanvasContainerView(), []);
|
|
324
247
|
return (0, _element.createElement)(_components.__experimentalNavigatorProvider, {
|
|
325
248
|
className: "edit-site-global-styles-sidebar__navigator-provider",
|
|
326
249
|
initialPath: "/"
|
|
@@ -330,7 +253,37 @@ function GlobalStylesUI(_ref6) {
|
|
|
330
253
|
path: "/variations"
|
|
331
254
|
}, (0, _element.createElement)(_screenStyleVariations.default, null)), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
332
255
|
path: "/blocks"
|
|
333
|
-
}, (0, _element.createElement)(_screenBlockList.default, null)),
|
|
256
|
+
}, (0, _element.createElement)(_screenBlockList.default, null)), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
257
|
+
path: "/typography"
|
|
258
|
+
}, (0, _element.createElement)(_screenTypography.default, null)), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
259
|
+
path: "/typography/text"
|
|
260
|
+
}, (0, _element.createElement)(_screenTypographyElement.default, {
|
|
261
|
+
element: "text"
|
|
262
|
+
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
263
|
+
path: "/typography/link"
|
|
264
|
+
}, (0, _element.createElement)(_screenTypographyElement.default, {
|
|
265
|
+
element: "link"
|
|
266
|
+
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
267
|
+
path: "/typography/heading"
|
|
268
|
+
}, (0, _element.createElement)(_screenTypographyElement.default, {
|
|
269
|
+
element: "heading"
|
|
270
|
+
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
271
|
+
path: "/typography/caption"
|
|
272
|
+
}, (0, _element.createElement)(_screenTypographyElement.default, {
|
|
273
|
+
element: "caption"
|
|
274
|
+
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
275
|
+
path: "/typography/button"
|
|
276
|
+
}, (0, _element.createElement)(_screenTypographyElement.default, {
|
|
277
|
+
element: "button"
|
|
278
|
+
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
279
|
+
path: "/colors"
|
|
280
|
+
}, (0, _element.createElement)(_screenColors.default, null)), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
281
|
+
path: "/layout"
|
|
282
|
+
}, (0, _element.createElement)(_screenLayout.default, null)), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
283
|
+
path: "/css"
|
|
284
|
+
}, (0, _element.createElement)(_screenCss.default, null)), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
285
|
+
path: '/revisions'
|
|
286
|
+
}, (0, _element.createElement)(_screenRevisions.default, null)), blocks.map(block => (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
334
287
|
key: 'menu-block-' + block.name,
|
|
335
288
|
path: '/blocks/' + encodeURIComponent(block.name)
|
|
336
289
|
}, (0, _element.createElement)(_screenBlock.default, {
|
|
@@ -339,14 +292,7 @@ function GlobalStylesUI(_ref6) {
|
|
|
339
292
|
key: 'screens-block-' + block.name,
|
|
340
293
|
name: block.name,
|
|
341
294
|
parentMenu: '/blocks/' + encodeURIComponent(block.name)
|
|
342
|
-
})),
|
|
343
|
-
return (0, _element.createElement)(BlockStyleVariationsScreens, {
|
|
344
|
-
key: 'screens-block-styles-' + block.name + index,
|
|
345
|
-
name: block.name
|
|
346
|
-
});
|
|
347
|
-
}), isStyleBookOpened && (0, _element.createElement)(GlobalStylesStyleBook, {
|
|
348
|
-
onClose: onCloseStyleBook
|
|
349
|
-
}), (0, _element.createElement)(GlobalStylesActionMenu, null), (0, _element.createElement)(GlobalStylesBlockLink, null));
|
|
295
|
+
})), 'style-book' === editorCanvasContainerView && (0, _element.createElement)(GlobalStylesStyleBook, null), (0, _element.createElement)(GlobalStylesActionMenu, null), (0, _element.createElement)(GlobalStylesBlockLink, null));
|
|
350
296
|
}
|
|
351
297
|
|
|
352
298
|
var _default = GlobalStylesUI;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/ui.js"],"names":["SLOT_FILL_NAME","Slot","GlobalStylesMenuSlot","Fill","GlobalStylesMenuFill","GlobalStylesActionMenu","toggle","preferencesStore","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","coreStore","globalStylesId","globalStyles","undefined","_links","useGlobalStylesReset","blockEditorPrivateApis","canReset","onReset","goTo","loadCustomCSS","moreVertical","title","onClick","isDisabled","GlobalStylesNavigationScreen","className","props","filter","Boolean","join","BlockStyleVariationsScreens","name","blockStyleVariations","getBlockStyles","blocksStore","length","map","variation","encodeURIComponent","BlockStylesNavigationScreens","parentMenu","blockStyles","blockName","style","index","ContextScreens","GlobalStylesStyleBook","onClose","navigator","path","location","startsWith","GlobalStylesBlockLink","isMounted","selectedBlockName","selectedBlockClientId","getSelectedBlockClientId","getBlockName","blockEditorStore","clientId","blockHasGlobalStyles","current","skipFocus","GlobalStylesUI","isStyleBookOpened","onCloseStyleBook","blocks","block"],"mappings":";;;;;;;;;AAoBA;;;;AAjBA;;AAOA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AA3CA;AACA;AACA;;AAoBA;AACA;AACA;AAqBA,MAAMA,cAAc,GAAG,kBAAvB;AACA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,oBAAR;AAA8BC,EAAAA,IAAI,EAAEC;AAApC,IACL,gCAAgBJ,cAAhB,CADD;;;AAGA,SAASK,sBAAT,GAAkC;AACjC,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAaC,kBAAb,CAAnB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAiB,qBAAaC,MAAF,IAAc;AAAA;;AAC/C,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QACLF,MAAM,CAAEG,eAAF,CADP;;AAGA,UAAMC,cAAc,GAAGF,sCAAsC,EAA7D;;AACA,UAAMG,YAAY,GAAGD,cAAc,GAChCH,eAAe,CAAE,MAAF,EAAU,cAAV,EAA0BG,cAA1B,CADiB,GAEhCE,SAFH;AAIA,WAAO;AACNP,MAAAA,UAAU,2BACT,CAAC,EAAEM,YAAF,aAAEA,YAAF,uCAAEA,YAAY,CAAE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,IADC,CA3BH,EAmCGmC,MAAM,CAAC9B,GAAP,CAAY,CAAE+B,KAAF,EAASvB,KAAT,KAAoB;AACjC,WACC,4BAAC,2BAAD;AACC,MAAA,GAAG,EAAG,0BAA0BuB,KAAK,CAACpC,IAAhC,GAAuCa,KAD9C;AAEC,MAAA,IAAI,EAAGuB,KAAK,CAACpC;AAFd,MADD;AAMA,GAPC,CAnCH,EA2CGiC,iBAAiB,IAClB,4BAAC,qBAAD;AAAuB,IAAA,OAAO,EAAGC;AAAjC,IA5CF,EA+CC,4BAAC,sBAAD,OA/CD,EAgDC,4BAAC,qBAAD,OAhDD,CADD;AAoDA;;eAEcF,c","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n\t__experimentalUseNavigator as useNavigator,\n\tcreateSlotFill,\n\tDropdownMenu,\n} from '@wordpress/components';\nimport { getBlockTypes, store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ScreenRoot from './screen-root';\nimport {\n\tuseBlockHasGlobalStyles,\n\tdefault as ScreenBlockList,\n} from './screen-block-list';\nimport ScreenBlock from './screen-block';\nimport ScreenTypography from './screen-typography';\nimport ScreenTypographyElement from './screen-typography-element';\nimport ScreenFilters from './screen-filters';\nimport ScreenColors from './screen-colors';\nimport ScreenColorPalette from './screen-color-palette';\nimport ScreenLayout from './screen-layout';\nimport ScreenStyleVariations from './screen-style-variations';\nimport { ScreenVariation } from './screen-variations';\nimport ScreenBorder from './screen-border';\nimport StyleBook from '../style-book';\nimport ScreenCSS from './screen-css';\nimport { unlock } from '../../private-apis';\nimport ScreenEffects from './screen-effects';\n\nconst SLOT_FILL_NAME = 'GlobalStylesMenu';\nconst { Slot: GlobalStylesMenuSlot, Fill: GlobalStylesMenuFill } =\n\tcreateSlotFill( SLOT_FILL_NAME );\n\nfunction GlobalStylesActionMenu() {\n\tconst { toggle } = useDispatch( preferencesStore );\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\tconst { useGlobalStylesReset } = unlock( blockEditorPrivateApis );\n\tconst [ canReset, onReset ] = useGlobalStylesReset();\n\tconst { goTo } = useNavigator();\n\tconst loadCustomCSS = () => goTo( '/css' );\n\treturn (\n\t\t<GlobalStylesMenuFill>\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'Styles actions' ) }\n\t\t\t\tcontrols={ [\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle: __( 'Reset to defaults' ),\n\t\t\t\t\t\tonClick: onReset,\n\t\t\t\t\t\tisDisabled: ! canReset,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle: __( 'Welcome Guide' ),\n\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\ttoggle( 'core/edit-site', 'welcomeGuideStyles' ),\n\t\t\t\t\t},\n\t\t\t\t\t...( canEditCSS\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttitle: __( 'Additional CSS' ),\n\t\t\t\t\t\t\t\t\tonClick: loadCustomCSS,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t: [] ),\n\t\t\t\t] }\n\t\t\t/>\n\t\t</GlobalStylesMenuFill>\n\t);\n}\n\nfunction GlobalStylesNavigationScreen( { className, ...props } ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName={ [\n\t\t\t\t'edit-site-global-styles-sidebar__navigator-screen',\n\t\t\t\tclassName,\n\t\t\t]\n\t\t\t\t.filter( Boolean )\n\t\t\t\t.join( ' ' ) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction BlockStyleVariationsScreens( { name } ) {\n\tconst blockStyleVariations = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\tif ( ! blockStyleVariations?.length ) {\n\t\treturn null;\n\t}\n\n\treturn blockStyleVariations.map( ( variation ) => (\n\t\t<ContextScreens\n\t\t\tkey={ variation.name + name }\n\t\t\tname={ name }\n\t\t\tparentMenu={\n\t\t\t\t'/blocks/' +\n\t\t\t\tencodeURIComponent( name ) +\n\t\t\t\t'/variations/' +\n\t\t\t\tencodeURIComponent( variation.name )\n\t\t\t}\n\t\t\tvariation={ variation.name }\n\t\t/>\n\t) );\n}\n\nfunction BlockStylesNavigationScreens( {\n\tparentMenu,\n\tblockStyles,\n\tblockName,\n} ) {\n\treturn blockStyles.map( ( style, index ) => (\n\t\t<GlobalStylesNavigationScreen\n\t\t\tkey={ index }\n\t\t\tpath={ parentMenu + '/variations/' + style.name }\n\t\t>\n\t\t\t<ScreenVariation blockName={ blockName } style={ style } />\n\t\t</GlobalStylesNavigationScreen>\n\t) );\n}\n\nfunction ContextScreens( { name, parentMenu = '', variation = '' } ) {\n\tconst blockStyleVariations = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/typography' }>\n\t\t\t\t<ScreenTypography name={ name } variation={ variation } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/text' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"text\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/link' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"link\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/heading' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"heading\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/caption' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"caption\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/button' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"button\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors' }>\n\t\t\t\t<ScreenColors name={ name } variation={ variation } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/palette' }\n\t\t\t>\n\t\t\t\t<ScreenColorPalette name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/filters' }>\n\t\t\t\t<ScreenFilters name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/border' }>\n\t\t\t\t<ScreenBorder name={ name } variation={ variation } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/effects' }>\n\t\t\t\t<ScreenEffects name={ name } variation={ variation } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/layout' }>\n\t\t\t\t<ScreenLayout name={ name } variation={ variation } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/css' }>\n\t\t\t\t<ScreenCSS name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t{ !! blockStyleVariations?.length && (\n\t\t\t\t<BlockStylesNavigationScreens\n\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\tblockStyles={ blockStyleVariations }\n\t\t\t\t\tblockName={ name }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction GlobalStylesStyleBook( { onClose } ) {\n\tconst navigator = useNavigator();\n\tconst { path } = navigator.location;\n\treturn (\n\t\t<StyleBook\n\t\t\tisSelected={ ( blockName ) =>\n\t\t\t\t// Match '/blocks/core%2Fbutton' and\n\t\t\t\t// '/blocks/core%2Fbutton/typography', but not\n\t\t\t\t// '/blocks/core%2Fbuttons'.\n\t\t\t\tpath === `/blocks/${ encodeURIComponent( blockName ) }` ||\n\t\t\t\tpath.startsWith(\n\t\t\t\t\t`/blocks/${ encodeURIComponent( blockName ) }/`\n\t\t\t\t)\n\t\t\t}\n\t\t\tonSelect={ ( blockName ) => {\n\t\t\t\t// Now go to the selected block.\n\t\t\t\tnavigator.goTo( '/blocks/' + encodeURIComponent( blockName ) );\n\t\t\t} }\n\t\t\tonClose={ onClose }\n\t\t/>\n\t);\n}\n\nfunction GlobalStylesBlockLink() {\n\tconst navigator = useNavigator();\n\tconst isMounted = useRef();\n\tconst { selectedBlockName, selectedBlockClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSelectedBlockClientId, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\treturn {\n\t\t\t\tselectedBlockName: getBlockName( clientId ),\n\t\t\t\tselectedBlockClientId: clientId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst blockHasGlobalStyles = useBlockHasGlobalStyles( selectedBlockName );\n\tuseEffect( () => {\n\t\t// Avoid navigating to the block screen on mount.\n\t\tif ( ! isMounted.current ) {\n\t\t\tisMounted.current = true;\n\t\t\treturn;\n\t\t}\n\t\tif ( ! selectedBlockClientId || ! blockHasGlobalStyles ) {\n\t\t\treturn;\n\t\t}\n\t\tconst path = '/blocks/' + encodeURIComponent( selectedBlockName );\n\t\t// Avoid navigating to the same path. This can happen when selecting\n\t\t// a new block of the same type.\n\t\tif ( path !== navigator.location.path ) {\n\t\t\tnavigator.goTo( path, { skipFocus: true } );\n\t\t}\n\t}, [ selectedBlockClientId, selectedBlockName, blockHasGlobalStyles ] );\n}\n\nfunction GlobalStylesUI( { isStyleBookOpened, onCloseStyleBook } ) {\n\tconst blocks = getBlockTypes();\n\n\treturn (\n\t\t<NavigatorProvider\n\t\t\tclassName=\"edit-site-global-styles-sidebar__navigator-provider\"\n\t\t\tinitialPath=\"/\"\n\t\t>\n\t\t\t<GlobalStylesNavigationScreen path=\"/\">\n\t\t\t\t<ScreenRoot />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/variations\">\n\t\t\t\t<ScreenStyleVariations />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/blocks\">\n\t\t\t\t<ScreenBlockList />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\t\tkey={ 'menu-block-' + block.name }\n\t\t\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\t\t>\n\t\t\t\t\t<ScreenBlock name={ block.name } />\n\t\t\t\t</GlobalStylesNavigationScreen>\n\t\t\t) ) }\n\n\t\t\t<ContextScreens />\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<ContextScreens\n\t\t\t\t\tkey={ 'screens-block-' + block.name }\n\t\t\t\t\tname={ block.name }\n\t\t\t\t\tparentMenu={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\t\t/>\n\t\t\t) ) }\n\n\t\t\t{ blocks.map( ( block, index ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<BlockStyleVariationsScreens\n\t\t\t\t\t\tkey={ 'screens-block-styles-' + block.name + index }\n\t\t\t\t\t\tname={ block.name }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ isStyleBookOpened && (\n\t\t\t\t<GlobalStylesStyleBook onClose={ onCloseStyleBook } />\n\t\t\t) }\n\n\t\t\t<GlobalStylesActionMenu />\n\t\t\t<GlobalStylesBlockLink />\n\t\t</NavigatorProvider>\n\t);\n}\nexport { GlobalStylesMenuSlot };\nexport default GlobalStylesUI;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/ui.js"],"names":["SLOT_FILL_NAME","Slot","GlobalStylesMenuSlot","Fill","GlobalStylesMenuFill","GlobalStylesActionMenu","toggle","preferencesStore","canEditCSS","revisionsCount","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","coreStore","globalStylesId","globalStyles","undefined","_links","count","useGlobalStylesReset","blockEditorPrivateApis","canReset","onReset","goTo","setEditorCanvasContainerView","editSiteStore","loadCustomCSS","loadRevisions","hasRevisions","moreVertical","title","onClick","isDisabled","GlobalStylesNavigationScreen","className","props","filter","Boolean","join","BlockStylesNavigationScreens","parentMenu","blockStyles","blockName","map","style","index","name","ContextScreens","blockStyleVariations","getBlockStyles","blocksStore","length","GlobalStylesStyleBook","navigator","path","location","encodeURIComponent","startsWith","GlobalStylesBlockLink","isMounted","selectedBlockName","selectedBlockClientId","getSelectedBlockClientId","getBlockName","blockEditorStore","clientId","blockHasGlobalStyles","current","skipFocus","GlobalStylesUI","blocks","editorCanvasContainerView","getEditorCanvasContainerView","block"],"mappings":";;;;;;;;;AAoBA;;;;AAjBA;;AAOA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAzCA;AACA;AACA;;AAoBA;AACA;AACA;AAmBA,MAAMA,cAAc,GAAG,kBAAvB;AACA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,oBAAR;AAA8BC,EAAAA,IAAI,EAAEC;AAApC,IACL,gCAAgBJ,cAAhB,CADD;;;AAGA,SAASK,sBAAT,GAAkC;AACjC,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAaC,kBAAb,CAAnB;AACA,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAAiC,qBAAaC,MAAF,IAAc;AAAA;;AAC/D,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QACLF,MAAM,CAAEG,eAAF,CADP;;AAGA,UAAMC,cAAc,GAAGF,sCAAsC,EAA7D;;AACA,UAAMG,YAAY,GAAGD,cAAc,GAChCH,eAAe,CAAE,MAAF,EAAU,cAAV,EAA0BG,cAA1B,CADiB,GAEhCE,SAFH;AAIA,WAAO;AACNR,MAAAA,UAAU,2BACT,CAAC,EAAEO,YAAF,aAAEA,YAAF,uCAAEA,YAAY,CAAEE,MAAhB,iDAAE,qBAAwB,oBAAxB,CAAF,CADQ,yEAC4C,KAFhD;AAGNR,MAAAA,cAAc,4BACbM,YADa,aACbA,YADa,gDACbA,YAAY,CAAEE,MADD,mFACb,sBAAwB,iBAAxB,CADa,mFACb,sBAA+C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kB,CAAEiB,KAAK,CAAC3B,IAAR;AAH7C,IADC,CAnEH,EA2EG,iBAAiByB,yBAAjB,IACD,4BAAC,qBAAD,OA5EF,EA+EC,4BAAC,sBAAD,OA/ED,EAgFC,4BAAC,qBAAD,OAhFD,CADD;AAoFA;;eAEcF,c","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n\t__experimentalUseNavigator as useNavigator,\n\tcreateSlotFill,\n\tDropdownMenu,\n} from '@wordpress/components';\nimport { getBlockTypes, store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ScreenRoot from './screen-root';\nimport {\n\tuseBlockHasGlobalStyles,\n\tdefault as ScreenBlockList,\n} from './screen-block-list';\nimport ScreenBlock from './screen-block';\nimport ScreenTypography from './screen-typography';\nimport ScreenTypographyElement from './screen-typography-element';\nimport ScreenColors from './screen-colors';\nimport ScreenColorPalette from './screen-color-palette';\nimport ScreenLayout from './screen-layout';\nimport ScreenStyleVariations from './screen-style-variations';\nimport StyleBook from '../style-book';\nimport ScreenCSS from './screen-css';\nimport ScreenRevisions from './screen-revisions';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nconst SLOT_FILL_NAME = 'GlobalStylesMenu';\nconst { Slot: GlobalStylesMenuSlot, Fill: GlobalStylesMenuFill } =\n\tcreateSlotFill( SLOT_FILL_NAME );\n\nfunction GlobalStylesActionMenu() {\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { canEditCSS, revisionsCount } = 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\trevisionsCount:\n\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0,\n\t\t};\n\t}, [] );\n\tconst { useGlobalStylesReset } = unlock( blockEditorPrivateApis );\n\tconst [ canReset, onReset ] = useGlobalStylesReset();\n\tconst { goTo } = useNavigator();\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst loadCustomCSS = () => goTo( '/css' );\n\tconst loadRevisions = () => {\n\t\tgoTo( '/revisions' );\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t};\n\tconst hasRevisions = revisionsCount >= 2;\n\n\treturn (\n\t\t<GlobalStylesMenuFill>\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'Styles actions' ) }\n\t\t\t\tcontrols={ [\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle: __( 'Reset to defaults' ),\n\t\t\t\t\t\tonClick: onReset,\n\t\t\t\t\t\tisDisabled: ! canReset,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle: __( 'Welcome Guide' ),\n\t\t\t\t\t\tonClick: () =>\n\t\t\t\t\t\t\ttoggle( 'core/edit-site', 'welcomeGuideStyles' ),\n\t\t\t\t\t},\n\t\t\t\t\t...( canEditCSS\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttitle: __( 'Additional CSS' ),\n\t\t\t\t\t\t\t\t\tonClick: loadCustomCSS,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t: [] ),\n\t\t\t\t\t...( hasRevisions\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: %d: number of revisions */\n\t\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t\t'%d Revision',\n\t\t\t\t\t\t\t\t\t\t\t'%d Revisions',\n\t\t\t\t\t\t\t\t\t\t\trevisionsCount\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\trevisionsCount\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tonClick: loadRevisions,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t ]\n\t\t\t\t\t\t: [] ),\n\t\t\t\t] }\n\t\t\t/>\n\t\t</GlobalStylesMenuFill>\n\t);\n}\n\nfunction GlobalStylesNavigationScreen( { className, ...props } ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName={ [\n\t\t\t\t'edit-site-global-styles-sidebar__navigator-screen',\n\t\t\t\tclassName,\n\t\t\t]\n\t\t\t\t.filter( Boolean )\n\t\t\t\t.join( ' ' ) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction BlockStylesNavigationScreens( {\n\tparentMenu,\n\tblockStyles,\n\tblockName,\n} ) {\n\treturn blockStyles.map( ( style, index ) => (\n\t\t<GlobalStylesNavigationScreen\n\t\t\tkey={ index }\n\t\t\tpath={ parentMenu + '/variations/' + style.name }\n\t\t>\n\t\t\t<ScreenBlock name={ blockName } variation={ style.name } />\n\t\t</GlobalStylesNavigationScreen>\n\t) );\n}\n\nfunction ContextScreens( { name, parentMenu = '' } ) {\n\tconst blockStyleVariations = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/palette' }\n\t\t\t>\n\t\t\t\t<ScreenColorPalette name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t{ !! blockStyleVariations?.length && (\n\t\t\t\t<BlockStylesNavigationScreens\n\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\tblockStyles={ blockStyleVariations }\n\t\t\t\t\tblockName={ name }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction GlobalStylesStyleBook() {\n\tconst navigator = useNavigator();\n\tconst { path } = navigator.location;\n\treturn (\n\t\t<StyleBook\n\t\t\tisSelected={ ( blockName ) =>\n\t\t\t\t// Match '/blocks/core%2Fbutton' and\n\t\t\t\t// '/blocks/core%2Fbutton/typography', but not\n\t\t\t\t// '/blocks/core%2Fbuttons'.\n\t\t\t\tpath === `/blocks/${ encodeURIComponent( blockName ) }` ||\n\t\t\t\tpath.startsWith(\n\t\t\t\t\t`/blocks/${ encodeURIComponent( blockName ) }/`\n\t\t\t\t)\n\t\t\t}\n\t\t\tonSelect={ ( blockName ) => {\n\t\t\t\t// Now go to the selected block.\n\t\t\t\tnavigator.goTo( '/blocks/' + encodeURIComponent( blockName ) );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction GlobalStylesBlockLink() {\n\tconst navigator = useNavigator();\n\tconst isMounted = useRef();\n\tconst { selectedBlockName, selectedBlockClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSelectedBlockClientId, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\treturn {\n\t\t\t\tselectedBlockName: getBlockName( clientId ),\n\t\t\t\tselectedBlockClientId: clientId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst blockHasGlobalStyles = useBlockHasGlobalStyles( selectedBlockName );\n\tuseEffect( () => {\n\t\t// Avoid navigating to the block screen on mount.\n\t\tif ( ! isMounted.current ) {\n\t\t\tisMounted.current = true;\n\t\t\treturn;\n\t\t}\n\t\tif ( ! selectedBlockClientId || ! blockHasGlobalStyles ) {\n\t\t\treturn;\n\t\t}\n\t\tconst path = '/blocks/' + encodeURIComponent( selectedBlockName );\n\t\t// Avoid navigating to the same path. This can happen when selecting\n\t\t// a new block of the same type.\n\t\tif ( path !== navigator.location.path ) {\n\t\t\tnavigator.goTo( path, { skipFocus: true } );\n\t\t}\n\t}, [ selectedBlockClientId, selectedBlockName, blockHasGlobalStyles ] );\n}\n\nfunction GlobalStylesUI() {\n\tconst blocks = getBlockTypes();\n\tconst editorCanvasContainerView = useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( editSiteStore ) ).getEditorCanvasContainerView(),\n\t\t[]\n\t);\n\treturn (\n\t\t<NavigatorProvider\n\t\t\tclassName=\"edit-site-global-styles-sidebar__navigator-provider\"\n\t\t\tinitialPath=\"/\"\n\t\t>\n\t\t\t<GlobalStylesNavigationScreen path=\"/\">\n\t\t\t\t<ScreenRoot />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/variations\">\n\t\t\t\t<ScreenStyleVariations />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/blocks\">\n\t\t\t\t<ScreenBlockList />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/typography\">\n\t\t\t\t<ScreenTypography />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/typography/text\">\n\t\t\t\t<ScreenTypographyElement element=\"text\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/typography/link\">\n\t\t\t\t<ScreenTypographyElement element=\"link\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/typography/heading\">\n\t\t\t\t<ScreenTypographyElement element=\"heading\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/typography/caption\">\n\t\t\t\t<ScreenTypographyElement element=\"caption\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/typography/button\">\n\t\t\t\t<ScreenTypographyElement element=\"button\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/colors\">\n\t\t\t\t<ScreenColors />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/layout\">\n\t\t\t\t<ScreenLayout />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/css\">\n\t\t\t\t<ScreenCSS />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ '/revisions' }>\n\t\t\t\t<ScreenRevisions />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\t\tkey={ 'menu-block-' + block.name }\n\t\t\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\t\t>\n\t\t\t\t\t<ScreenBlock name={ block.name } />\n\t\t\t\t</GlobalStylesNavigationScreen>\n\t\t\t) ) }\n\n\t\t\t<ContextScreens />\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<ContextScreens\n\t\t\t\t\tkey={ 'screens-block-' + block.name }\n\t\t\t\t\tname={ block.name }\n\t\t\t\t\tparentMenu={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\t\t/>\n\t\t\t) ) }\n\n\t\t\t{ 'style-book' === editorCanvasContainerView && (\n\t\t\t\t<GlobalStylesStyleBook />\n\t\t\t) }\n\n\t\t\t<GlobalStylesActionMenu />\n\t\t\t<GlobalStylesBlockLink />\n\t\t</NavigatorProvider>\n\t);\n}\nexport { GlobalStylesMenuSlot };\nexport default GlobalStylesUI;\n"]}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
exports.VariationPanel = VariationPanel;
|
|
9
6
|
exports.VariationsPanel = VariationsPanel;
|
|
10
|
-
exports.
|
|
7
|
+
exports.useBlockVariations = useBlockVariations;
|
|
11
8
|
|
|
12
9
|
var _element = require("@wordpress/element");
|
|
13
10
|
|
|
@@ -19,8 +16,6 @@ var _components = require("@wordpress/components");
|
|
|
19
16
|
|
|
20
17
|
var _navigationButton = require("./navigation-button");
|
|
21
18
|
|
|
22
|
-
var _contextMenu = _interopRequireDefault(require("./context-menu"));
|
|
23
|
-
|
|
24
19
|
/**
|
|
25
20
|
* WordPress dependencies
|
|
26
21
|
*/
|
|
@@ -32,9 +27,7 @@ function getCoreBlockStyles(blockStyles) {
|
|
|
32
27
|
return blockStyles === null || blockStyles === void 0 ? void 0 : blockStyles.filter(style => style.source === 'block');
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
function
|
|
36
|
-
let parentMenu = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
37
|
-
const isInsideVariationsPanel = parentMenu.includes('variations');
|
|
30
|
+
function useBlockVariations(name) {
|
|
38
31
|
const blockStyles = (0, _data.useSelect)(select => {
|
|
39
32
|
const {
|
|
40
33
|
getBlockStyles
|
|
@@ -42,20 +35,14 @@ function useHasVariationsPanel(name) {
|
|
|
42
35
|
return getBlockStyles(name);
|
|
43
36
|
}, [name]);
|
|
44
37
|
const coreBlockStyles = getCoreBlockStyles(blockStyles);
|
|
45
|
-
return
|
|
38
|
+
return coreBlockStyles;
|
|
46
39
|
}
|
|
47
40
|
|
|
48
41
|
function VariationsPanel(_ref) {
|
|
49
42
|
let {
|
|
50
43
|
name
|
|
51
44
|
} = _ref;
|
|
52
|
-
const
|
|
53
|
-
const {
|
|
54
|
-
getBlockStyles
|
|
55
|
-
} = select(_blocks.store);
|
|
56
|
-
return getBlockStyles(name);
|
|
57
|
-
}, [name]);
|
|
58
|
-
const coreBlockStyles = getCoreBlockStyles(blockStyles);
|
|
45
|
+
const coreBlockStyles = useBlockVariations(name);
|
|
59
46
|
return (0, _element.createElement)(_components.__experimentalItemGroup, {
|
|
60
47
|
isBordered: true,
|
|
61
48
|
isSeparated: true
|
|
@@ -71,15 +58,4 @@ function VariationsPanel(_ref) {
|
|
|
71
58
|
}, style.label);
|
|
72
59
|
}));
|
|
73
60
|
}
|
|
74
|
-
|
|
75
|
-
function VariationPanel(_ref2) {
|
|
76
|
-
let {
|
|
77
|
-
blockName,
|
|
78
|
-
styleName
|
|
79
|
-
} = _ref2;
|
|
80
|
-
return (0, _element.createElement)(_contextMenu.default, {
|
|
81
|
-
parentMenu: '/blocks/' + encodeURIComponent(blockName) + '/variations/' + encodeURIComponent(styleName),
|
|
82
|
-
name: blockName
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
61
|
//# sourceMappingURL=variations-panel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/variations-panel.js"],"names":["getCoreBlockStyles","blockStyles","filter","style","source","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/variations-panel.js"],"names":["getCoreBlockStyles","blockStyles","filter","style","source","useBlockVariations","name","select","getBlockStyles","blocksStore","coreBlockStyles","VariationsPanel","map","index","isDefault","encodeURIComponent","label"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIA,SAASA,kBAAT,CAA6BC,WAA7B,EAA2C;AAC1C,SAAOA,WAAP,aAAOA,WAAP,uBAAOA,WAAW,CAAEC,MAAb,CAAuBC,KAAF,IAAaA,KAAK,CAACC,MAAN,KAAiB,OAAnD,CAAP;AACA;;AAEM,SAASC,kBAAT,CAA6BC,IAA7B,EAAoC;AAC1C,QAAML,WAAW,GAAG,qBACjBM,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAqBD,MAAM,CAAEE,aAAF,CAAjC;AACA,WAAOD,cAAc,CAAEF,IAAF,CAArB;AACA,GAJkB,EAKnB,CAAEA,IAAF,CALmB,CAApB;AAOA,QAAMI,eAAe,GAAGV,kBAAkB,CAAEC,WAAF,CAA1C;AACA,SAAOS,eAAP;AACA;;AAEM,SAASC,eAAT,OAAqC;AAAA,MAAX;AAAEL,IAAAA;AAAF,GAAW;AAC3C,QAAMI,eAAe,GAAGL,kBAAkB,CAAEC,IAAF,CAA1C;AAEA,SACC,4BAAC,mCAAD;AAAW,IAAA,UAAU,MAArB;AAAsB,IAAA,WAAW;AAAjC,KACGI,eAAe,CAACE,GAAhB,CAAqB,CAAET,KAAF,EAASU,KAAT,KAAoB;AAC1C,QAAKV,KAAL,aAAKA,KAAL,eAAKA,KAAK,CAAEW,SAAZ,EAAwB;AACvB,aAAO,IAAP;AACA;;AACD,WACC,4BAAC,wCAAD;AACC,MAAA,GAAG,EAAGD,KADP;AAEC,MAAA,IAAI,EACH,aACAE,kBAAkB,CAAET,IAAF,CADlB,GAEA,cAFA,GAGAS,kBAAkB,CAAEZ,KAAK,CAACG,IAAR,CANpB;AAQC,oBAAaH,KAAK,CAACa;AARpB,OAUGb,KAAK,CAACa,KAVT,CADD;AAcA,GAlBC,CADH,CADD;AAuBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n/**\n * Internal dependencies\n */\n\nimport { NavigationButtonAsItem } from './navigation-button';\n\nfunction getCoreBlockStyles( blockStyles ) {\n\treturn blockStyles?.filter( ( style ) => style.source === 'block' );\n}\n\nexport function useBlockVariations( name ) {\n\tconst blockStyles = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\tconst coreBlockStyles = getCoreBlockStyles( blockStyles );\n\treturn coreBlockStyles;\n}\n\nexport function VariationsPanel( { name } ) {\n\tconst coreBlockStyles = useBlockVariations( name );\n\n\treturn (\n\t\t<ItemGroup isBordered isSeparated>\n\t\t\t{ coreBlockStyles.map( ( style, index ) => {\n\t\t\t\tif ( style?.isDefault ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\tpath={\n\t\t\t\t\t\t\t'/blocks/' +\n\t\t\t\t\t\t\tencodeURIComponent( name ) +\n\t\t\t\t\t\t\t'/variations/' +\n\t\t\t\t\t\t\tencodeURIComponent( style.name )\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-label={ style.label }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ style.label }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ItemGroup>\n\t);\n}\n"]}
|
|
@@ -43,7 +43,9 @@ var _documentActions = _interopRequireDefault(require("./document-actions"));
|
|
|
43
43
|
|
|
44
44
|
var _store = require("../../store");
|
|
45
45
|
|
|
46
|
-
var
|
|
46
|
+
var _editorCanvasContainer = require("../editor-canvas-container");
|
|
47
|
+
|
|
48
|
+
var _privateApis = require("../../private-apis");
|
|
47
49
|
|
|
48
50
|
/**
|
|
49
51
|
* External dependencies
|
|
@@ -73,7 +75,8 @@ function HeaderEditMode() {
|
|
|
73
75
|
isVisualMode,
|
|
74
76
|
blockEditorMode,
|
|
75
77
|
homeUrl,
|
|
76
|
-
showIconLabels
|
|
78
|
+
showIconLabels,
|
|
79
|
+
editorCanvasView
|
|
77
80
|
} = (0, _data.useSelect)(select => {
|
|
78
81
|
var _getUnstableBase;
|
|
79
82
|
|
|
@@ -104,7 +107,8 @@ function HeaderEditMode() {
|
|
|
104
107
|
isVisualMode: getEditorMode() === 'visual',
|
|
105
108
|
blockEditorMode: __unstableGetEditorMode(),
|
|
106
109
|
homeUrl: (_getUnstableBase = getUnstableBase()) === null || _getUnstableBase === void 0 ? void 0 : _getUnstableBase.home,
|
|
107
|
-
showIconLabels: select(_preferences.store).get('core/edit-site', 'showIconLabels')
|
|
110
|
+
showIconLabels: select(_preferences.store).get('core/edit-site', 'showIconLabels'),
|
|
111
|
+
editorCanvasView: (0, _privateApis.unlock)(select(_store.store)).getEditorCanvasContainerView()
|
|
108
112
|
};
|
|
109
113
|
}, []);
|
|
110
114
|
const {
|
|
@@ -128,7 +132,7 @@ function HeaderEditMode() {
|
|
|
128
132
|
}
|
|
129
133
|
}, [isInserterOpen, setIsInserterOpened]);
|
|
130
134
|
const toggleListView = (0, _element.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
|
|
131
|
-
const
|
|
135
|
+
const hasDefaultEditorCanvasView = !(0, _editorCanvasContainer.useHasEditorCanvasContainer)();
|
|
132
136
|
const isFocusMode = templateType === 'wp_template_part';
|
|
133
137
|
/* translators: button label text should, if possible, be under 16 characters. */
|
|
134
138
|
|
|
@@ -140,7 +144,7 @@ function HeaderEditMode() {
|
|
|
140
144
|
className: (0, _classnames.default)('edit-site-header-edit-mode', {
|
|
141
145
|
'show-icon-labels': showIconLabels
|
|
142
146
|
})
|
|
143
|
-
},
|
|
147
|
+
}, hasDefaultEditorCanvasView && (0, _element.createElement)(_blockEditor.NavigableToolbar, {
|
|
144
148
|
className: "edit-site-header-edit-mode__start",
|
|
145
149
|
"aria-label": (0, _i18n.__)('Document tools')
|
|
146
150
|
}, (0, _element.createElement)("div", {
|
|
@@ -198,11 +202,11 @@ function HeaderEditMode() {
|
|
|
198
202
|
}
|
|
199
203
|
})))), (0, _element.createElement)("div", {
|
|
200
204
|
className: "edit-site-header-edit-mode__center"
|
|
201
|
-
},
|
|
205
|
+
}, !hasDefaultEditorCanvasView ? (0, _editorCanvasContainer.getEditorCanvasContainerTitle)(editorCanvasView) : (0, _element.createElement)(_documentActions.default, null)), (0, _element.createElement)("div", {
|
|
202
206
|
className: "edit-site-header-edit-mode__end"
|
|
203
207
|
}, (0, _element.createElement)("div", {
|
|
204
208
|
className: "edit-site-header-edit-mode__actions"
|
|
205
|
-
}, !isFocusMode &&
|
|
209
|
+
}, !isFocusMode && hasDefaultEditorCanvasView && (0, _element.createElement)("div", {
|
|
206
210
|
className: (0, _classnames.default)('edit-site-header-edit-mode__preview-options', {
|
|
207
211
|
'is-zoomed-out': isZoomedOutView
|
|
208
212
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/header-edit-mode/index.js"],"names":["preventDefault","event","HeaderEditMode","inserterButton","deviceType","templateType","isInserterOpen","isListViewOpen","listViewShortcut","isVisualMode","blockEditorMode","homeUrl","showIconLabels","select","__experimentalGetPreviewDeviceType","getEditedPostType","isInserterOpened","isListViewOpened","getEditorMode","editSiteStore","getShortcutRepresentation","keyboardShortcutsStore","__unstableGetEditorMode","blockEditorStore","postType","getUnstableBase","coreStore","home","preferencesStore","get","__experimentalSetPreviewDeviceType","setPreviewDeviceType","setIsInserterOpened","setIsListViewOpened","__unstableSetEditorMode","isLargeViewport","toggleInserter","current","focus","toggleListView","hasStyleBook","isFocusMode","longLabel","shortLabel","isZoomedOutViewExperimentEnabled","window","__experimentalEnableZoomedOutView","isZoomedOutView","Button","plus","ToolSelector","undefined","UndoButton","RedoButton","listView","chevronUpDown","external"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;A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A,IAAI,EAAG6C;AAHR,KAKG,cAAI,WAAJ,CALH,EAMC,4BAAC,0BAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB;AAEE;AACA,gBAAI,sBAAJ,CAHF,CAND,CADD,CAND,CAND,CAFF,EAgCC,4BAAC,mBAAD,OAhCD,EAiCC,4BAAC,sBAAD,CAAa,IAAb;AAAkB,IAAA,KAAK,EAAC;AAAxB,IAjCD,EAkCC,4BAAC,iBAAD;AAAU,IAAA,cAAc,EAAG5C;AAA3B,IAlCD,CADD,CA7FD,CADD;AAsIA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tToolSelector,\n\t__experimentalPreviewOptions as PreviewOptions,\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { PinnedItems } from '@wordpress/interface';\nimport { _x, __ } from '@wordpress/i18n';\nimport { listView, plus, external, chevronUpDown } from '@wordpress/icons';\nimport {\n\tButton,\n\tToolbarItem,\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport MoreMenu from './more-menu';\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport DocumentActions from './document-actions';\nimport { store as editSiteStore } from '../../store';\nimport { useHasStyleBook } from '../style-book';\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nexport default function HeaderEditMode() {\n\tconst inserterButton = useRef();\n\tconst {\n\t\tdeviceType,\n\t\ttemplateType,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tisVisualMode,\n\t\tblockEditorMode,\n\t\thomeUrl,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetEditedPostType,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\tgetEditorMode,\n\t\t} = select( editSiteStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\tconst postType = getEditedPostType();\n\n\t\tconst {\n\t\t\tgetUnstableBase, // Site index.\n\t\t} = select( coreStore );\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\ttemplateType: postType,\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-site/toggle-list-view'\n\t\t\t),\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst {\n\t\t__experimentalSetPreviewDeviceType: setPreviewDeviceType,\n\t\tsetIsInserterOpened,\n\t\tsetIsListViewOpened,\n\t} = useDispatch( editSiteStore );\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpen, setIsInserterOpened ] );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst hasStyleBook = useHasStyleBook();\n\n\tconst isFocusMode = templateType === 'wp_template_part';\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpen ? __( 'Add' ) : __( 'Close' );\n\n\tconst isZoomedOutViewExperimentEnabled =\n\t\twindow?.__experimentalEnableZoomedOutView && isVisualMode;\n\tconst isZoomedOutView = blockEditorMode === 'zoom-out';\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'edit-site-header-edit-mode', {\n\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ ! hasStyleBook && (\n\t\t\t\t<NavigableToolbar\n\t\t\t\t\tclassName=\"edit-site-header-edit-mode__start\"\n\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"edit-site-header-edit-mode__toolbar\">\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__inserter-toggle\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\t\t\tdisabled={ ! isVisualMode }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdisabled={ ! isVisualMode }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ UndoButton }\n\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ RedoButton }\n\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__list-view-toggle\"\n\t\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\t\t! isVisualMode || isZoomedOutView\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ isZoomedOutViewExperimentEnabled && (\n\t\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__zoom-out-view-toggle\"\n\t\t\t\t\t\t\t\t\t\ticon={ chevronUpDown }\n\t\t\t\t\t\t\t\t\t\tisPressed={ isZoomedOutView }\n\t\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Zoom-out View' ) }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetPreviewDeviceType( 'desktop' );\n\t\t\t\t\t\t\t\t\t\t\t__unstableSetEditorMode(\n\t\t\t\t\t\t\t\t\t\t\t\tisZoomedOutView\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'edit'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'zoom-out'\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/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</NavigableToolbar>\n\t\t\t) }\n\n\t\t\t<div className=\"edit-site-header-edit-mode__center\">\n\t\t\t\t{ hasStyleBook ? __( 'Style Book' ) : <DocumentActions /> }\n\t\t\t</div>\n\n\t\t\t<div className=\"edit-site-header-edit-mode__end\">\n\t\t\t\t<div className=\"edit-site-header-edit-mode__actions\">\n\t\t\t\t\t{ ! isFocusMode && ! hasStyleBook && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'edit-site-header-edit-mode__preview-options',\n\t\t\t\t\t\t\t\t{ 'is-zoomed-out': isZoomedOutView }\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PreviewOptions\n\t\t\t\t\t\t\t\tdeviceType={ deviceType }\n\t\t\t\t\t\t\t\tsetDeviceType={ setPreviewDeviceType }\n\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\tviewLabel={ __( 'View' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'View site' ) }\n\t\t\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t</PreviewOptions>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/header-edit-mode/index.js"],"names":["preventDefault","event","HeaderEditMode","inserterButton","deviceType","templateType","isInserterOpen","isListViewOpen","listViewShortcut","isVisualMode","blockEditorMode","homeUrl","showIconLabels","editorCanvasView","select","__experimentalGetPreviewDeviceType","getEditedPostType","isInserterOpened","isListViewOpened","getEditorMode","editSiteStore","getShortcutRepresentation","keyboardShortcutsStore","__unstableGetEditorMode","blockEditorStore","postType","getUnstableBase","coreStore","home","preferencesStore","get","getEditorCanvasContainerView","__experimentalSetPreviewDeviceType","setPreviewDeviceType","setIsInserterOpened","setIsListViewOpened","__unstableSetEditorMode","isLargeViewport","toggleInserter","current","focus","toggleListView","hasDefaultEditorCanvasView","isFocusMode","longLabel","shortLabel","isZoomedOutViewExperimentEnabled","window","__experimentalEnableZoomedOutView","isZoomedOutView","Button","plus","ToolSelector","undefined","UndoButton","RedoButton","listView","chevronUpDown","external"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AA5CA;AACA;AACA;;AAGA;AACA;AACA;;AAwBA;AACA;AACA;AAaA,MAAMA,cAAc,GAAKC,KAAF,IAAa;AACnCA,EAAAA,KAAK,CAACD,cAAN;AACA,CAFD;;AAIe,SAASE,cAAT,GAA0B;AAAA;;AACxC,QAAMC,cAAc,GAAG,sBAAvB;AACA,QAAM;AACLC,IAAAA,UADK;AAELC,IAAAA,YAFK;AAGLC,IAAAA,cAHK;AAILC,IAAAA,cAJK;AAKLC,IAAAA,gBALK;AAMLC,IAAAA,YANK;AAOLC,IAAAA,eAPK;AAQLC,IAAAA,OARK;AASLC,IAAAA,cATK;AAULC,IAAAA;AAVK,MAWF,qBAAaC,MAAF,IAAc;AAAA;;AAC5B,UAAM;AACLC,MAAAA,kCADK;AAELC,MAAAA,iBAFK;AAGLC,MAAAA,gBAHK;AAILC,MAA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SAAS,EAAGR;AACZ;AALD;AAMC,IAAA,KAAK,EAAG,cAAI,eAAJ,CANT;AAOC,IAAA,OAAO,EAAG,MAAM;AACfhB,MAAAA,oBAAoB,CAAE,SAAF,CAApB;;AACAG,MAAAA,uBAAuB,CACtBa,eAAe,GACZ,MADY,GAEZ,UAHmB,CAAvB;AAKA;AAdF,IAzCF,CAfF,CAJD,CANF,EAyFC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,CAAEP,0BAAF,GACD,0DAA+B7B,gBAA/B,CADC,GAGD,4BAAC,wBAAD,OAJF,CAzFD,EAiGC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,CAAE8B,WAAF,IAAiBD,0BAAjB,IACD;AACC,IAAA,SAAS,EAAG,yBACX,6CADW,EAEX;AAAE,uBAAiBO;AAAnB,KAFW;AADb,KAMC,4BAAC,yCAAD;AACC,IAAA,UAAU,EAAG7C,UADd;AAEC,IAAA,aAAa,EAAG6B;AAChB;AAHD;AAIC,IAAA,SAAS,EAAG,cAAI,MAAJ;AAJb,KAMC,4BAAC,qBAAD,QACC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAGtB,OADR;AAEC,IAAA,MAAM,EAAC,QAFR;AAGC,IAAA,IAAI,EAAG+C;AAHR,KAKG,cAAI,WAAJ,CALH,EAMC,4BAAC,0BAAD;AAAgB,IAAA,EAAE,EAAC;AAAnB;AAEE;AACA,gBAAI,sBAAJ,CAHF,CAND,CADD,CAND,CAND,CAFF,EAgCC,4BAAC,mBAAD,OAhCD,EAiCC,4BAAC,sBAAD,CAAa,IAAb;AAAkB,IAAA,KAAK,EAAC;AAAxB,IAjCD,EAkCC,4BAAC,iBAAD;AAAU,IAAA,cAAc,EAAG9C;AAA3B,IAlCD,CADD,CAjGD,CADD;AA0IA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tToolSelector,\n\t__experimentalPreviewOptions as PreviewOptions,\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { PinnedItems } from '@wordpress/interface';\nimport { _x, __ } from '@wordpress/i18n';\nimport { listView, plus, external, chevronUpDown } from '@wordpress/icons';\nimport {\n\tButton,\n\tToolbarItem,\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport MoreMenu from './more-menu';\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport DocumentActions from './document-actions';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tgetEditorCanvasContainerTitle,\n\tuseHasEditorCanvasContainer,\n} from '../editor-canvas-container';\nimport { unlock } from '../../private-apis';\n\nconst preventDefault = ( event ) => {\n\tevent.preventDefault();\n};\n\nexport default function HeaderEditMode() {\n\tconst inserterButton = useRef();\n\tconst {\n\t\tdeviceType,\n\t\ttemplateType,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tlistViewShortcut,\n\t\tisVisualMode,\n\t\tblockEditorMode,\n\t\thomeUrl,\n\t\tshowIconLabels,\n\t\teditorCanvasView,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetEditedPostType,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t\tgetEditorMode,\n\t\t} = select( editSiteStore );\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\tconst postType = getEditedPostType();\n\n\t\tconst {\n\t\t\tgetUnstableBase, // Site index.\n\t\t} = select( coreStore );\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\ttemplateType: postType,\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tlistViewShortcut: getShortcutRepresentation(\n\t\t\t\t'core/edit-site/toggle-list-view'\n\t\t\t),\n\t\t\tisVisualMode: getEditorMode() === 'visual',\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\teditorCanvasView: unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView(),\n\t\t};\n\t}, [] );\n\n\tconst {\n\t\t__experimentalSetPreviewDeviceType: setPreviewDeviceType,\n\t\tsetIsInserterOpened,\n\t\tsetIsListViewOpened,\n\t} = useDispatch( editSiteStore );\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst toggleInserter = useCallback( () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button should close the inserter popover.\n\t\t\t// However, there are some cases it won't close when the focus is lost.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/43090 for more details.\n\t\t\tinserterButton.current.focus();\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tsetIsInserterOpened( true );\n\t\t}\n\t}, [ isInserterOpen, setIsInserterOpened ] );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();\n\n\tconst isFocusMode = templateType === 'wp_template_part';\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst longLabel = _x(\n\t\t'Toggle block inserter',\n\t\t'Generic label for block inserter button'\n\t);\n\tconst shortLabel = ! isInserterOpen ? __( 'Add' ) : __( 'Close' );\n\n\tconst isZoomedOutViewExperimentEnabled =\n\t\twindow?.__experimentalEnableZoomedOutView && isVisualMode;\n\tconst isZoomedOutView = blockEditorMode === 'zoom-out';\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'edit-site-header-edit-mode', {\n\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t} ) }\n\t\t>\n\t\t\t{ hasDefaultEditorCanvasView && (\n\t\t\t\t<NavigableToolbar\n\t\t\t\t\tclassName=\"edit-site-header-edit-mode__start\"\n\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"edit-site-header-edit-mode__toolbar\">\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__inserter-toggle\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\tonMouseDown={ preventDefault }\n\t\t\t\t\t\t\tonClick={ toggleInserter }\n\t\t\t\t\t\t\tdisabled={ ! isVisualMode }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\tlabel={ showIconLabels ? shortLabel : longLabel }\n\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ ToolSelector }\n\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdisabled={ ! isVisualMode }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ UndoButton }\n\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ RedoButton }\n\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__list-view-toggle\"\n\t\t\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\t\t\t! isVisualMode || isZoomedOutView\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\t\tshortcut={ listViewShortcut }\n\t\t\t\t\t\t\t\t\tshowTooltip={ ! showIconLabels }\n\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\tshowIconLabels ? 'tertiary' : undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ isZoomedOutViewExperimentEnabled && (\n\t\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-header-edit-mode__zoom-out-view-toggle\"\n\t\t\t\t\t\t\t\t\t\ticon={ chevronUpDown }\n\t\t\t\t\t\t\t\t\t\tisPressed={ isZoomedOutView }\n\t\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Zoom-out View' ) }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetPreviewDeviceType( 'desktop' );\n\t\t\t\t\t\t\t\t\t\t\t__unstableSetEditorMode(\n\t\t\t\t\t\t\t\t\t\t\t\tisZoomedOutView\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'edit'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'zoom-out'\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/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</NavigableToolbar>\n\t\t\t) }\n\n\t\t\t<div className=\"edit-site-header-edit-mode__center\">\n\t\t\t\t{ ! hasDefaultEditorCanvasView ? (\n\t\t\t\t\tgetEditorCanvasContainerTitle( editorCanvasView )\n\t\t\t\t) : (\n\t\t\t\t\t<DocumentActions />\n\t\t\t\t) }\n\t\t\t</div>\n\n\t\t\t<div className=\"edit-site-header-edit-mode__end\">\n\t\t\t\t<div className=\"edit-site-header-edit-mode__actions\">\n\t\t\t\t\t{ ! isFocusMode && hasDefaultEditorCanvasView && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'edit-site-header-edit-mode__preview-options',\n\t\t\t\t\t\t\t\t{ 'is-zoomed-out': isZoomedOutView }\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PreviewOptions\n\t\t\t\t\t\t\t\tdeviceType={ deviceType }\n\t\t\t\t\t\t\t\tsetDeviceType={ setPreviewDeviceType }\n\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\tviewLabel={ __( 'View' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'View site' ) }\n\t\t\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t</PreviewOptions>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t<MoreMenu showIconLabels={ showIconLabels } />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|