@wordpress/edit-site 6.10.0 → 6.12.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-post/index.js +1 -1
- package/build/components/add-new-post/index.js.map +1 -1
- package/build/components/add-new-template/index.js +1 -1
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/add-new-template/utils.js +8 -8
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +2 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/use-editor-iframe-props.js +29 -22
- package/build/components/block-editor/use-editor-iframe-props.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +10 -8
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +32 -14
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-adapt-editor-to-canvas.js +49 -0
- package/build/components/editor/use-adapt-editor-to-canvas.js.map +1 -0
- package/build/components/editor/use-editor-title.js +30 -13
- package/build/components/editor/use-editor-title.js.map +1 -1
- package/build/components/global-styles/font-sizes/font-size.js +6 -6
- package/build/components/global-styles/font-sizes/font-size.js.map +1 -1
- package/build/components/global-styles/font-sizes/font-sizes-count.js +0 -1
- package/build/components/global-styles/font-sizes/font-sizes-count.js.map +1 -1
- package/build/components/global-styles/font-sizes/font-sizes.js +4 -4
- package/build/components/global-styles/font-sizes/font-sizes.js.map +1 -1
- package/build/components/global-styles/palette.js +16 -13
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/root-menu.js +0 -4
- package/build/components/global-styles/root-menu.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +0 -4
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-css.js +1 -1
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +26 -24
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-root.js +0 -3
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +5 -1
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +11 -13
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/shadows-panel.js +0 -3
- package/build/components/global-styles/shadows-panel.js.map +1 -1
- package/build/components/global-styles/typography-elements.js +1 -4
- package/build/components/global-styles/typography-elements.js.map +1 -1
- package/build/components/global-styles/ui.js +49 -2
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +2 -2
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-panel.js +0 -1
- package/build/components/global-styles/variations/variations-panel.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +6 -8
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/global-styles-sidebar/default-sidebar.js +0 -1
- package/build/components/global-styles-sidebar/default-sidebar.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +43 -30
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/animation.js +1 -3
- package/build/components/layout/animation.js.map +1 -1
- package/build/components/layout/hooks.js +1 -10
- package/build/components/layout/hooks.js.map +1 -1
- package/build/components/layout/index.js +23 -35
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +17 -140
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-patterns/delete-category-menu-item.js +3 -3
- package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build/components/page-patterns/fields.js +3 -7
- package/build/components/page-patterns/fields.js.map +1 -1
- package/build/components/page-patterns/use-pattern-settings.js +1 -1
- package/build/components/page-patterns/use-pattern-settings.js.map +1 -1
- package/build/components/page-templates/fields.js +1 -2
- package/build/components/page-templates/fields.js.map +1 -1
- package/build/components/page-templates/index.js +1 -2
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/pagination/index.js +1 -1
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/post-edit/index.js +15 -5
- package/build/components/post-edit/index.js.map +1 -1
- package/build/components/post-fields/index.js +4 -244
- package/build/components/post-fields/index.js.map +1 -1
- package/build/components/post-list/index.js +12 -2
- package/build/components/post-list/index.js.map +1 -1
- package/build/components/posts-app/index.js.map +1 -1
- package/build/components/posts-app/router.js +4 -4
- package/build/components/posts-app/router.js.map +1 -1
- package/build/components/resizable-frame/index.js +21 -9
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/revisions/index.js +1 -1
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/save-keyboard-shortcut/index.js +78 -0
- package/build/components/save-keyboard-shortcut/index.js.map +1 -0
- package/build/components/save-panel/index.js +17 -6
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +11 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +2 -5
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-global-styles-wrapper/index.js +129 -0
- package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen/index.js +2 -1
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +33 -71
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +43 -42
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +3 -3
- package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +7 -12
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/site-editor-routes/home-edit.js +26 -0
- package/build/components/site-editor-routes/home-edit.js.map +1 -0
- package/build/components/site-editor-routes/home-view.js +25 -0
- package/build/components/site-editor-routes/home-view.js.map +1 -0
- package/build/components/site-editor-routes/index.js +49 -0
- package/build/components/site-editor-routes/index.js.map +1 -0
- package/build/components/site-editor-routes/navigation-edit.js +29 -0
- package/build/components/site-editor-routes/navigation-edit.js.map +1 -0
- package/build/components/site-editor-routes/navigation-item-edit.js +31 -0
- package/build/components/site-editor-routes/navigation-item-edit.js.map +1 -0
- package/build/components/site-editor-routes/navigation-item-view.js +30 -0
- package/build/components/site-editor-routes/navigation-item-view.js.map +1 -0
- package/build/components/site-editor-routes/navigation-view.js +28 -0
- package/build/components/site-editor-routes/navigation-view.js.map +1 -0
- package/build/components/site-editor-routes/pages-edit.js +43 -0
- package/build/components/site-editor-routes/pages-edit.js.map +1 -0
- package/build/components/site-editor-routes/pages-list-view-quick-edit.js +64 -0
- package/build/components/site-editor-routes/pages-list-view-quick-edit.js.map +1 -0
- package/build/components/site-editor-routes/pages-list-view.js +47 -0
- package/build/components/site-editor-routes/pages-list-view.js.map +1 -0
- package/build/components/site-editor-routes/pages-view-quick-edit.js +61 -0
- package/build/components/site-editor-routes/pages-view-quick-edit.js.map +1 -0
- package/build/components/site-editor-routes/pages-view.js +42 -0
- package/build/components/site-editor-routes/pages-view.js.map +1 -0
- package/build/components/site-editor-routes/patterns-edit.js +31 -0
- package/build/components/site-editor-routes/patterns-edit.js.map +1 -0
- package/build/components/site-editor-routes/patterns-view.js +29 -0
- package/build/components/site-editor-routes/patterns-view.js.map +1 -0
- package/build/components/site-editor-routes/styles-edit.js +33 -0
- package/build/components/site-editor-routes/styles-edit.js.map +1 -0
- package/build/components/site-editor-routes/styles-view.js +33 -0
- package/build/components/site-editor-routes/styles-view.js.map +1 -0
- package/build/components/site-editor-routes/templates-edit.js +31 -0
- package/build/components/site-editor-routes/templates-edit.js.map +1 -0
- package/build/components/site-editor-routes/templates-list-view.js +34 -0
- package/build/components/site-editor-routes/templates-list-view.js.map +1 -0
- package/build/components/site-editor-routes/templates-view.js +29 -0
- package/build/components/site-editor-routes/templates-view.js.map +1 -0
- package/build/components/site-hub/index.js +22 -8
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/color-examples.js +46 -0
- package/build/components/style-book/color-examples.js.map +1 -0
- package/build/components/style-book/constants.js +85 -13
- package/build/components/style-book/constants.js.map +1 -1
- package/build/components/style-book/duotone-examples.js +55 -0
- package/build/components/style-book/duotone-examples.js.map +1 -0
- package/build/components/style-book/examples.js +116 -3
- package/build/components/style-book/examples.js.map +1 -1
- package/build/components/style-book/index.js +161 -46
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/style-book/types.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +38 -33
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/welcome-guide/index.js +4 -2
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +1 -9
- package/build/components/welcome-guide/page.js.map +1 -1
- package/build/components/welcome-guide/template.js +1 -12
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +61 -45
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-set-command-context.js +12 -15
- package/build/hooks/commands/use-set-command-context.js.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/posts.js +1 -0
- package/build/posts.js.map +1 -1
- package/build/store/private-actions.js +8 -60
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +4 -12
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +9 -18
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/add-new-post/index.js +1 -1
- package/build-module/components/add-new-post/index.js.map +1 -1
- package/build-module/components/add-new-template/index.js +1 -1
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +9 -9
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +4 -4
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/use-editor-iframe-props.js +30 -23
- package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +10 -8
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +32 -14
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-adapt-editor-to-canvas.js +42 -0
- package/build-module/components/editor/use-adapt-editor-to-canvas.js.map +1 -0
- package/build-module/components/editor/use-editor-title.js +31 -14
- package/build-module/components/editor/use-editor-title.js.map +1 -1
- package/build-module/components/global-styles/font-sizes/font-size.js +6 -6
- package/build-module/components/global-styles/font-sizes/font-size.js.map +1 -1
- package/build-module/components/global-styles/font-sizes/font-sizes-count.js +0 -1
- package/build-module/components/global-styles/font-sizes/font-sizes-count.js.map +1 -1
- package/build-module/components/global-styles/font-sizes/font-sizes.js +4 -4
- package/build-module/components/global-styles/font-sizes/font-sizes.js.map +1 -1
- package/build-module/components/global-styles/palette.js +17 -14
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/root-menu.js +0 -4
- package/build-module/components/global-styles/root-menu.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +0 -4
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +1 -1
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +27 -25
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +0 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +5 -1
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +11 -13
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/shadows-panel.js +0 -3
- package/build-module/components/global-styles/shadows-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-elements.js +2 -5
- package/build-module/components/global-styles/typography-elements.js.map +1 -1
- package/build-module/components/global-styles/ui.js +50 -3
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +3 -3
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-panel.js +0 -1
- package/build-module/components/global-styles/variations/variations-panel.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +6 -8
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/global-styles-sidebar/default-sidebar.js +0 -1
- package/build-module/components/global-styles-sidebar/default-sidebar.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +44 -31
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/animation.js +1 -3
- package/build-module/components/layout/animation.js.map +1 -1
- package/build-module/components/layout/hooks.js +1 -9
- package/build-module/components/layout/hooks.js.map +1 -1
- package/build-module/components/layout/index.js +23 -35
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +17 -139
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-patterns/delete-category-menu-item.js +4 -4
- package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/fields.js +4 -8
- package/build-module/components/page-patterns/fields.js.map +1 -1
- package/build-module/components/page-patterns/use-pattern-settings.js +1 -1
- package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -1
- package/build-module/components/page-templates/fields.js +1 -2
- package/build-module/components/page-templates/fields.js.map +1 -1
- package/build-module/components/page-templates/index.js +1 -2
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/pagination/index.js +1 -1
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/post-edit/index.js +15 -5
- package/build-module/components/post-edit/index.js.map +1 -1
- package/build-module/components/post-fields/index.js +7 -246
- package/build-module/components/post-fields/index.js.map +1 -1
- package/build-module/components/post-list/index.js +12 -2
- package/build-module/components/post-list/index.js.map +1 -1
- package/build-module/components/posts-app/index.js +2 -2
- package/build-module/components/posts-app/index.js.map +1 -1
- package/build-module/components/posts-app/router.js +3 -3
- package/build-module/components/posts-app/router.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +21 -10
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/revisions/index.js +1 -1
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/save-keyboard-shortcut/index.js +71 -0
- package/build-module/components/save-keyboard-shortcut/index.js.map +1 -0
- package/build-module/components/save-panel/index.js +17 -6
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +11 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +2 -5
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-global-styles-wrapper/index.js +121 -0
- package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen/index.js +2 -1
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +34 -72
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +43 -43
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +4 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +8 -13
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/site-editor-routes/home-edit.js +18 -0
- package/build-module/components/site-editor-routes/home-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/home-view.js +17 -0
- package/build-module/components/site-editor-routes/home-view.js.map +1 -0
- package/build-module/components/site-editor-routes/index.js +42 -0
- package/build-module/components/site-editor-routes/index.js.map +1 -0
- package/build-module/components/site-editor-routes/navigation-edit.js +21 -0
- package/build-module/components/site-editor-routes/navigation-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/navigation-item-edit.js +23 -0
- package/build-module/components/site-editor-routes/navigation-item-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/navigation-item-view.js +22 -0
- package/build-module/components/site-editor-routes/navigation-item-view.js.map +1 -0
- package/build-module/components/site-editor-routes/navigation-view.js +20 -0
- package/build-module/components/site-editor-routes/navigation-view.js.map +1 -0
- package/build-module/components/site-editor-routes/pages-edit.js +35 -0
- package/build-module/components/site-editor-routes/pages-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js +56 -0
- package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/pages-list-view.js +39 -0
- package/build-module/components/site-editor-routes/pages-list-view.js.map +1 -0
- package/build-module/components/site-editor-routes/pages-view-quick-edit.js +53 -0
- package/build-module/components/site-editor-routes/pages-view-quick-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/pages-view.js +34 -0
- package/build-module/components/site-editor-routes/pages-view.js.map +1 -0
- package/build-module/components/site-editor-routes/patterns-edit.js +23 -0
- package/build-module/components/site-editor-routes/patterns-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/patterns-view.js +21 -0
- package/build-module/components/site-editor-routes/patterns-view.js.map +1 -0
- package/build-module/components/site-editor-routes/styles-edit.js +25 -0
- package/build-module/components/site-editor-routes/styles-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/styles-view.js +25 -0
- package/build-module/components/site-editor-routes/styles-view.js.map +1 -0
- package/build-module/components/site-editor-routes/templates-edit.js +23 -0
- package/build-module/components/site-editor-routes/templates-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/templates-list-view.js +26 -0
- package/build-module/components/site-editor-routes/templates-list-view.js.map +1 -0
- package/build-module/components/site-editor-routes/templates-view.js +21 -0
- package/build-module/components/site-editor-routes/templates-view.js.map +1 -0
- package/build-module/components/site-hub/index.js +22 -8
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/color-examples.js +38 -0
- package/build-module/components/style-book/color-examples.js.map +1 -0
- package/build-module/components/style-book/constants.js +84 -12
- package/build-module/components/style-book/constants.js.map +1 -1
- package/build-module/components/style-book/duotone-examples.js +48 -0
- package/build-module/components/style-book/duotone-examples.js.map +1 -0
- package/build-module/components/style-book/examples.js +117 -3
- package/build-module/components/style-book/examples.js.map +1 -1
- package/build-module/components/style-book/index.js +164 -49
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/style-book/types.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +38 -33
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +4 -2
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +1 -9
- package/build-module/components/welcome-guide/page.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +1 -11
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +61 -45
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-set-command-context.js +12 -15
- package/build-module/hooks/commands/use-set-command-context.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/posts.js +1 -0
- package/build-module/posts.js.map +1 -1
- package/build-module/store/private-actions.js +6 -58
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +3 -11
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +9 -18
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/posts-rtl.css +60 -14
- package/build-style/posts.css +60 -14
- package/build-style/style-rtl.css +232 -50
- package/build-style/style.css +232 -50
- package/package.json +42 -41
- package/src/components/add-new-post/index.js +1 -1
- package/src/components/add-new-template/index.js +1 -1
- package/src/components/add-new-template/utils.js +12 -9
- package/src/components/app/index.js +4 -4
- package/src/components/block-editor/use-editor-iframe-props.js +23 -20
- package/src/components/block-editor/use-site-editor-settings.js +12 -10
- package/src/components/editor/index.js +50 -17
- package/src/components/editor/use-adapt-editor-to-canvas.js +53 -0
- package/src/components/editor/use-editor-title.js +40 -16
- package/src/components/editor-canvas-container/style.scss +0 -1
- package/src/components/global-styles/font-sizes/font-size.js +11 -15
- package/src/components/global-styles/font-sizes/font-sizes-count.js +1 -4
- package/src/components/global-styles/font-sizes/font-sizes.js +7 -9
- package/src/components/global-styles/palette.js +21 -18
- package/src/components/global-styles/root-menu.js +3 -16
- package/src/components/global-styles/screen-block-list.js +0 -7
- package/src/components/global-styles/screen-css.js +1 -0
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +30 -33
- package/src/components/global-styles/screen-revisions/style.scss +11 -17
- package/src/components/global-styles/screen-root.js +3 -12
- package/src/components/global-styles/screen-style-variations.js +4 -1
- package/src/components/global-styles/shadows-edit-panel.js +16 -15
- package/src/components/global-styles/shadows-panel.js +0 -4
- package/src/components/global-styles/typography-elements.js +3 -11
- package/src/components/global-styles/ui.js +53 -2
- package/src/components/global-styles/variations/variation.js +3 -3
- package/src/components/global-styles/variations/variations-panel.js +0 -1
- package/src/components/global-styles-renderer/index.js +4 -10
- package/src/components/global-styles-sidebar/default-sidebar.js +0 -1
- package/src/components/global-styles-sidebar/index.js +86 -65
- package/src/components/global-styles-sidebar/style.scss +6 -0
- package/src/components/layout/animation.js +0 -1
- package/src/components/layout/hooks.js +1 -7
- package/src/components/layout/index.js +22 -35
- package/src/components/layout/router.js +18 -133
- package/src/components/layout/style.scss +2 -2
- package/src/components/page-patterns/delete-category-menu-item.js +4 -4
- package/src/components/page-patterns/fields.js +6 -12
- package/src/components/page-patterns/style.scss +0 -5
- package/src/components/page-patterns/use-pattern-settings.js +1 -1
- package/src/components/page-templates/fields.js +2 -3
- package/src/components/page-templates/index.js +0 -1
- package/src/components/pagination/index.js +1 -1
- package/src/components/post-edit/index.js +45 -6
- package/src/components/post-edit/style.scss +7 -0
- package/src/components/post-fields/index.js +22 -323
- package/src/components/post-fields/style.scss +3 -0
- package/src/components/post-list/index.js +10 -4
- package/src/components/post-list/style.scss +30 -4
- package/src/components/posts-app/index.js +2 -2
- package/src/components/posts-app/router.js +3 -3
- package/src/components/resizable-frame/index.js +19 -10
- package/src/components/revisions/index.js +4 -1
- package/src/components/save-keyboard-shortcut/index.js +69 -0
- package/src/components/save-panel/index.js +30 -32
- package/src/components/sidebar/index.js +23 -7
- package/src/components/sidebar-dataviews/default-views.js +2 -5
- package/src/components/sidebar-global-styles-wrapper/index.js +150 -0
- package/src/components/sidebar-global-styles-wrapper/style.scss +35 -0
- package/src/components/sidebar-navigation-item/style.scss +2 -2
- package/src/components/sidebar-navigation-screen/index.js +2 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +42 -99
- package/src/components/sidebar-navigation-screen-main/index.js +46 -45
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -2
- package/src/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +4 -4
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +11 -13
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +1 -1
- package/src/components/site-editor-routes/README.md +20 -0
- package/src/components/site-editor-routes/home-edit.js +17 -0
- package/src/components/site-editor-routes/home-view.js +16 -0
- package/src/components/site-editor-routes/index.js +60 -0
- package/src/components/site-editor-routes/navigation-edit.js +22 -0
- package/src/components/site-editor-routes/navigation-item-edit.js +26 -0
- package/src/components/site-editor-routes/navigation-item-view.js +25 -0
- package/src/components/site-editor-routes/navigation-view.js +21 -0
- package/src/components/site-editor-routes/pages-edit.js +35 -0
- package/src/components/site-editor-routes/pages-list-view-quick-edit.js +56 -0
- package/src/components/site-editor-routes/pages-list-view.js +44 -0
- package/src/components/site-editor-routes/pages-view-quick-edit.js +53 -0
- package/src/components/site-editor-routes/pages-view.js +39 -0
- package/src/components/site-editor-routes/patterns-edit.js +24 -0
- package/src/components/site-editor-routes/patterns-view.js +22 -0
- package/src/components/site-editor-routes/styles-edit.js +26 -0
- package/src/components/site-editor-routes/styles-view.js +26 -0
- package/src/components/site-editor-routes/templates-edit.js +22 -0
- package/src/components/site-editor-routes/templates-list-view.js +28 -0
- package/src/components/site-editor-routes/templates-view.js +22 -0
- package/src/components/site-hub/index.js +35 -18
- package/src/components/site-hub/style.scss +4 -0
- package/src/components/site-icon/style.scss +16 -0
- package/src/components/style-book/color-examples.tsx +44 -0
- package/src/components/style-book/constants.ts +94 -13
- package/src/components/style-book/duotone-examples.tsx +53 -0
- package/src/components/style-book/examples.tsx +217 -0
- package/src/components/style-book/index.js +235 -60
- package/src/components/style-book/style.scss +12 -14
- package/src/components/style-book/test/categories.js +0 -5
- package/src/components/style-book/types.ts +34 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +65 -65
- package/src/components/welcome-guide/index.js +3 -3
- package/src/components/welcome-guide/page.js +1 -7
- package/src/components/welcome-guide/template.js +1 -8
- package/src/hooks/commands/use-common-commands.js +257 -230
- package/src/hooks/commands/use-set-command-context.js +7 -9
- package/src/index.js +1 -0
- package/src/posts.js +1 -0
- package/src/store/private-actions.js +7 -79
- package/src/store/private-selectors.js +4 -11
- package/src/store/reducer.js +10 -18
- package/src/style.scss +3 -1
- package/build/components/async/index.js +0 -51
- package/build/components/async/index.js.map +0 -1
- package/build/components/keyboard-shortcuts/global.js +0 -53
- package/build/components/keyboard-shortcuts/global.js.map +0 -1
- package/build/components/keyboard-shortcuts/register.js +0 -34
- package/build/components/keyboard-shortcuts/register.js.map +0 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +0 -69
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +0 -1
- package/build/components/use-edited-entity-record/index.js +0 -60
- package/build/components/use-edited-entity-record/index.js.map +0 -1
- package/build/hooks/commands/use-edit-mode-commands.js +0 -175
- package/build/hooks/commands/use-edit-mode-commands.js.map +0 -1
- package/build-module/components/async/index.js +0 -44
- package/build-module/components/async/index.js.map +0 -1
- package/build-module/components/keyboard-shortcuts/global.js +0 -46
- package/build-module/components/keyboard-shortcuts/global.js.map +0 -1
- package/build-module/components/keyboard-shortcuts/register.js +0 -27
- package/build-module/components/keyboard-shortcuts/register.js.map +0 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +0 -62
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +0 -1
- package/build-module/components/use-edited-entity-record/index.js +0 -53
- package/build-module/components/use-edited-entity-record/index.js.map +0 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +0 -167
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +0 -1
- package/src/components/async/index.js +0 -43
- package/src/components/keyboard-shortcuts/global.js +0 -47
- package/src/components/keyboard-shortcuts/register.js +0 -27
- package/src/components/style-book/examples.ts +0 -63
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +0 -73
- package/src/components/use-edited-entity-record/index.js +0 -58
- package/src/hooks/commands/use-edit-mode-commands.js +0 -172
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","Button","Modal","EntitiesSavedStates","useEntitiesSavedStatesIsDirty","privateApis","useDispatch","useSelect","__","sprintf","store","coreStore","editSiteStore","unlock","useActivateTheme","useActualCurrentTheme","isPreviewingTheme","jsx","_jsx","jsxs","_jsxs","EntitiesSavedStatesExtensible","NavigableRegion","EntitiesSavedStatesForPreview","onClose","_currentTheme$name$re","_previewingTheme$name","isDirtyProps","activateSaveLabel","isDirty","currentTheme","previewingTheme","select","getCurrentTheme","additionalPrompt","children","name","rendered","activateTheme","onSave","values","close","saveEnabled","saveLabel","_EntitiesSavedStates","renderDialog","undefined","SavePanel","isSaveViewOpen","canvasMode","isSaving","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","isResolving","dirtyEntityRecords","isActivatingTheme","isSaveViewOpened","getCanvasMode","length","some","record","kind","key","setIsSaveViewOpened","className","onRequestClose","__experimentalHideHeader","contentLabel","activateSaveEnabled","disabled","ariaLabel","__next40pxDefaultSize","variant","onClick","accessibleWhenDisabled"],"sources":["@wordpress/edit-site/src/components/save-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Modal } from '@wordpress/components';\nimport {\n\tEntitiesSavedStates,\n\tuseEntitiesSavedStatesIsDirty,\n\tprivateApis,\n} from '@wordpress/editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useActivateTheme } from '../../utils/use-activate-theme';\nimport { useActualCurrentTheme } from '../../utils/use-actual-current-theme';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\n\nconst { EntitiesSavedStatesExtensible, NavigableRegion } =\n\tunlock( privateApis );\n\nconst EntitiesSavedStatesForPreview = ( { onClose } ) => {\n\tconst isDirtyProps = useEntitiesSavedStatesIsDirty();\n\tlet activateSaveLabel;\n\tif ( isDirtyProps.isDirty ) {\n\t\tactivateSaveLabel = __( 'Activate & Save' );\n\t} else {\n\t\tactivateSaveLabel = __( 'Activate' );\n\t}\n\n\tconst currentTheme = useActualCurrentTheme();\n\n\tconst previewingTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\n\tconst additionalPrompt = (\n\t\t<p>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: %1$s: The name of active theme, %2$s: The name of theme to be activated. */\n\t\t\t\t__(\n\t\t\t\t\t'Saving your changes will change your active theme from %1$s to %2$s.'\n\t\t\t\t),\n\t\t\t\tcurrentTheme?.name?.rendered ?? '...',\n\t\t\t\tpreviewingTheme?.name?.rendered ?? '...'\n\t\t\t) }\n\t\t</p>\n\t);\n\n\tconst activateTheme = useActivateTheme();\n\tconst onSave = async ( values ) => {\n\t\tawait activateTheme();\n\t\treturn values;\n\t};\n\n\treturn (\n\t\t<EntitiesSavedStatesExtensible\n\t\t\t{ ...{\n\t\t\t\t...isDirtyProps,\n\t\t\t\tadditionalPrompt,\n\t\t\t\tclose: onClose,\n\t\t\t\tonSave,\n\t\t\t\tsaveEnabled: true,\n\t\t\t\tsaveLabel: activateSaveLabel,\n\t\t\t} }\n\t\t/>\n\t);\n};\n\nconst _EntitiesSavedStates = ( { onClose, renderDialog = undefined } ) => {\n\tif ( isPreviewingTheme() ) {\n\t\treturn <EntitiesSavedStatesForPreview onClose={ onClose } />;\n\t}\n\treturn (\n\t\t<EntitiesSavedStates close={ onClose } renderDialog={ renderDialog } />\n\t);\n};\n\nexport default function SavePanel() {\n\tconst { isSaveViewOpen, canvasMode, isDirty, isSaving } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\t\tisSavingEntityRecord,\n\t\t\t\tisResolving,\n\t\t\t} = select( coreStore );\n\t\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t\tconst isActivatingTheme = isResolving( 'activateTheme' );\n\t\t\tconst { isSaveViewOpened, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\n\t\t\t// The currently selected entity to display.\n\t\t\t// Typically template or template part in the site editor.\n\t\t\treturn {\n\t\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\t\tisSaving:\n\t\t\t\t\tdirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\t\tisSavingEntityRecord(\n\t\t\t\t\t\t\trecord.kind,\n\t\t\t\t\t\t\trecord.name,\n\t\t\t\t\t\t\trecord.key\n\t\t\t\t\t\t)\n\t\t\t\t\t) || isActivatingTheme,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\tconst onClose = () => setIsSaveViewOpened( false );\n\n\tif ( canvasMode === 'view' ) {\n\t\treturn isSaveViewOpen ? (\n\t\t\t<Modal\n\t\t\t\tclassName=\"edit-site-save-panel__modal\"\n\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t__experimentalHideHeader\n\t\t\t\tcontentLabel={ __(\n\t\t\t\t\t'Save site, content, and template changes'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<_EntitiesSavedStates onClose={ onClose } />\n\t\t\t</Modal>\n\t\t) : null;\n\t}\n\tconst activateSaveEnabled = isPreviewingTheme() || isDirty;\n\tconst disabled = isSaving || ! activateSaveEnabled;\n\treturn (\n\t\t<NavigableRegion\n\t\t\tclassName={ clsx( 'edit-site-layout__actions', {\n\t\t\t\t'is-entity-save-view-open': isSaveViewOpen,\n\t\t\t} ) }\n\t\t\tariaLabel={ __( 'Save panel' ) }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={ clsx( 'edit-site-editor__toggle-save-panel', {\n\t\t\t\t\t'screen-reader-text': isSaveViewOpen,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\tonClick={ () => setIsSaveViewOpened( true ) }\n\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t\t{ isSaveViewOpen && (\n\t\t\t\t<_EntitiesSavedStates onClose={ onClose } renderDialog />\n\t\t\t) }\n\t\t</NavigableRegion>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,MAAM,EAAEC,KAAK,QAAQ,uBAAuB;AACrD,SACCC,mBAAmB,EACnBC,6BAA6B,EAC7BC,WAAW,QACL,mBAAmB;AAC1B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,gBAAgB,QAAQ,gCAAgC;AACjE,SAASC,qBAAqB,QAAQ,sCAAsC;AAC5E,SAASC,iBAAiB,QAAQ,iCAAiC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEpE,MAAM;EAAEC,6BAA6B;EAAEC;AAAgB,CAAC,GACvDT,MAAM,CAAER,WAAY,CAAC;AAEtB,MAAMkB,6BAA6B,GAAGA,CAAE;EAAEC;AAAQ,CAAC,KAAM;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EACxD,MAAMC,YAAY,GAAGvB,6BAA6B,CAAC,CAAC;EACpD,IAAIwB,iBAAiB;EACrB,IAAKD,YAAY,CAACE,OAAO,EAAG;IAC3BD,iBAAiB,GAAGpB,EAAE,CAAE,iBAAkB,CAAC;EAC5C,CAAC,MAAM;IACNoB,iBAAiB,GAAGpB,EAAE,CAAE,UAAW,CAAC;EACrC;EAEA,M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MAAMwC,QAAQ,GAAGnB,QAAQ,IAAI,CAAEkB,mBAAmB;EAClD,oBACChD,KAAA,CAACE,eAAe;IACf0C,SAAS,EAAGhE,IAAI,CAAE,2BAA2B,EAAE;MAC9C,0BAA0B,EAAEgD;IAC7B,CAAE,CAAG;IACLsB,SAAS,EAAG9D,EAAE,CAAE,YAAa,CAAG;IAAA2B,QAAA,gBAEhCjB,IAAA;MACC8C,SAAS,EAAGhE,IAAI,CAAE,qCAAqC,EAAE;QACxD,oBAAoB,EAAEgD;MACvB,CAAE,CAAG;MAAAb,QAAA,eAELjB,IAAA,CAACjB,MAAM;QACNsE,qBAAqB;QACrBC,OAAO,EAAC,WAAW;QACnBR,SAAS,EAAC,4CAA4C;QACtDS,OAAO,EAAGA,CAAA,KAAMV,mBAAmB,CAAE,IAAK,CAAG;QAC7C,iBAAc,QAAQ;QACtBM,QAAQ,EAAGA,QAAU;QACrBK,sBAAsB;QAAAvC,QAAA,EAEpB3B,EAAE,CAAE,iBAAkB;MAAC,CAClB;IAAC,CACL,CAAC,EACJwC,cAAc,iBACf9B,IAAA,CAAC0B,oBAAoB;MAACpB,OAAO,EAAGA,OAAS;MAACqB,YAAY;IAAA,CAAE,CACxD;EAAA,CACe,CAAC;AAEpB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","Button","Modal","EntitiesSavedStates","useEntitiesSavedStatesIsDirty","privateApis","useDispatch","useSelect","__","sprintf","store","coreStore","routerPrivateApis","useEffect","editSiteStore","unlock","useActivateTheme","useActualCurrentTheme","isPreviewingTheme","jsx","_jsx","jsxs","_jsxs","EntitiesSavedStatesExtensible","NavigableRegion","useLocation","EntitiesSavedStatesForPreview","onClose","_currentTheme$name$re","_previewingTheme$name","isDirtyProps","activateSaveLabel","isDirty","currentTheme","previewingTheme","select","getCurrentTheme","additionalPrompt","children","name","rendered","activateTheme","onSave","values","close","saveEnabled","saveLabel","_EntitiesSavedStates","renderDialog","undefined","SavePanel","params","canvas","isSaveViewOpen","isSaving","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","isResolving","dirtyEntityRecords","isActivatingTheme","isSaveViewOpened","length","some","record","kind","key","setIsSaveViewOpened","className","onRequestClose","__experimentalHideHeader","contentLabel","activateSaveEnabled","disabled","ariaLabel","__next40pxDefaultSize","variant","onClick","accessibleWhenDisabled"],"sources":["@wordpress/edit-site/src/components/save-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Modal } from '@wordpress/components';\nimport {\n\tEntitiesSavedStates,\n\tuseEntitiesSavedStatesIsDirty,\n\tprivateApis,\n} from '@wordpress/editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useActivateTheme } from '../../utils/use-activate-theme';\nimport { useActualCurrentTheme } from '../../utils/use-actual-current-theme';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\n\nconst { EntitiesSavedStatesExtensible, NavigableRegion } =\n\tunlock( privateApis );\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst EntitiesSavedStatesForPreview = ( { onClose } ) => {\n\tconst isDirtyProps = useEntitiesSavedStatesIsDirty();\n\tlet activateSaveLabel;\n\tif ( isDirtyProps.isDirty ) {\n\t\tactivateSaveLabel = __( 'Activate & Save' );\n\t} else {\n\t\tactivateSaveLabel = __( 'Activate' );\n\t}\n\n\tconst currentTheme = useActualCurrentTheme();\n\n\tconst previewingTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\n\tconst additionalPrompt = (\n\t\t<p>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: 1: The name of active theme, 2: The name of theme to be activated. */\n\t\t\t\t__(\n\t\t\t\t\t'Saving your changes will change your active theme from %1$s to %2$s.'\n\t\t\t\t),\n\t\t\t\tcurrentTheme?.name?.rendered ?? '...',\n\t\t\t\tpreviewingTheme?.name?.rendered ?? '...'\n\t\t\t) }\n\t\t</p>\n\t);\n\n\tconst activateTheme = useActivateTheme();\n\tconst onSave = async ( values ) => {\n\t\tawait activateTheme();\n\t\treturn values;\n\t};\n\n\treturn (\n\t\t<EntitiesSavedStatesExtensible\n\t\t\t{ ...{\n\t\t\t\t...isDirtyProps,\n\t\t\t\tadditionalPrompt,\n\t\t\t\tclose: onClose,\n\t\t\t\tonSave,\n\t\t\t\tsaveEnabled: true,\n\t\t\t\tsaveLabel: activateSaveLabel,\n\t\t\t} }\n\t\t/>\n\t);\n};\n\nconst _EntitiesSavedStates = ( { onClose, renderDialog = undefined } ) => {\n\tif ( isPreviewingTheme() ) {\n\t\treturn <EntitiesSavedStatesForPreview onClose={ onClose } />;\n\t}\n\treturn (\n\t\t<EntitiesSavedStates close={ onClose } renderDialog={ renderDialog } />\n\t);\n};\n\nexport default function SavePanel() {\n\tconst { params } = useLocation();\n\tconst { canvas = 'view' } = params;\n\tconst { isSaveViewOpen, isDirty, isSaving } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\tisSavingEntityRecord,\n\t\t\tisResolving,\n\t\t} = select( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\tconst isActivatingTheme = isResolving( 'activateTheme' );\n\t\tconst { isSaveViewOpened } = unlock( select( editSiteStore ) );\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\tisSaving:\n\t\t\t\tdirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t\t\t) || isActivatingTheme,\n\t\t};\n\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\tconst onClose = () => setIsSaveViewOpened( false );\n\tuseEffect( () => {\n\t\tsetIsSaveViewOpened( false );\n\t}, [ canvas, setIsSaveViewOpened ] );\n\n\tif ( canvas === 'view' ) {\n\t\treturn isSaveViewOpen ? (\n\t\t\t<Modal\n\t\t\t\tclassName=\"edit-site-save-panel__modal\"\n\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t__experimentalHideHeader\n\t\t\t\tcontentLabel={ __(\n\t\t\t\t\t'Save site, content, and template changes'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<_EntitiesSavedStates onClose={ onClose } />\n\t\t\t</Modal>\n\t\t) : null;\n\t}\n\tconst activateSaveEnabled = isPreviewingTheme() || isDirty;\n\tconst disabled = isSaving || ! activateSaveEnabled;\n\treturn (\n\t\t<NavigableRegion\n\t\t\tclassName={ clsx( 'edit-site-layout__actions', {\n\t\t\t\t'is-entity-save-view-open': isSaveViewOpen,\n\t\t\t} ) }\n\t\t\tariaLabel={ __( 'Save panel' ) }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={ clsx( 'edit-site-editor__toggle-save-panel', {\n\t\t\t\t\t'screen-reader-text': isSaveViewOpen,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\tonClick={ () => setIsSaveViewOpened( true ) }\n\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t\t{ isSaveViewOpen && (\n\t\t\t\t<_EntitiesSavedStates onClose={ onClose } renderDialog />\n\t\t\t) }\n\t\t</N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,EAAGA;MAAS,CAAE;IAAC,CACtC,CAAC,GACL,IAAI;EACT;EACA,MAAM4C,mBAAmB,GAAGrD,iBAAiB,CAAC,CAAC,IAAIc,OAAO;EAC1D,MAAMwC,QAAQ,GAAGlB,QAAQ,IAAI,CAAEiB,mBAAmB;EAClD,oBACCjD,KAAA,CAACE,eAAe;IACf2C,SAAS,EAAGnE,IAAI,CAAE,2BAA2B,EAAE;MAC9C,0BAA0B,EAAEqD;IAC7B,CAAE,CAAG;IACLoB,SAAS,EAAGjE,EAAE,CAAE,YAAa,CAAG;IAAA8B,QAAA,gBAEhClB,IAAA;MACC+C,SAAS,EAAGnE,IAAI,CAAE,qCAAqC,EAAE;QACxD,oBAAoB,EAAEqD;MACvB,CAAE,CAAG;MAAAf,QAAA,eAELlB,IAAA,CAACnB,MAAM;QACNyE,qBAAqB;QACrBC,OAAO,EAAC,WAAW;QACnBR,SAAS,EAAC,4CAA4C;QACtDS,OAAO,EAAGA,CAAA,KAAMV,mBAAmB,CAAE,IAAK,CAAG;QAC7C,iBAAc,QAAQ;QACtBM,QAAQ,EAAGA,QAAU;QACrBK,sBAAsB;QAAAvC,QAAA,EAEpB9B,EAAE,CAAE,iBAAkB;MAAC,CAClB;IAAC,CACL,CAAC,EACJ6C,cAAc,iBACfjC,IAAA,CAAC2B,oBAAoB;MAACpB,OAAO,EAAGA,OAAS;MAACqB,YAAY;IAAA,CAAE,CACxD;EAAA,CACe,CAAC;AAEpB","ignoreList":[]}
|
|
@@ -45,7 +45,8 @@ function createNavState() {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
function SidebarContentWrapper({
|
|
48
|
-
children
|
|
48
|
+
children,
|
|
49
|
+
shouldAnimate
|
|
49
50
|
}) {
|
|
50
51
|
const navState = useContext(SidebarNavigationContext);
|
|
51
52
|
const wrapperRef = useRef();
|
|
@@ -58,10 +59,15 @@ function SidebarContentWrapper({
|
|
|
58
59
|
focusSidebarElement(wrapperRef.current, direction, focusSelector);
|
|
59
60
|
setNavAnimation(direction);
|
|
60
61
|
}, [navState]);
|
|
61
|
-
const wrapperCls = clsx('edit-site-sidebar__screen-wrapper',
|
|
62
|
+
const wrapperCls = clsx('edit-site-sidebar__screen-wrapper',
|
|
63
|
+
/*
|
|
64
|
+
* Some panes do not have sub-panes and therefore
|
|
65
|
+
* should not animate when clicked on.
|
|
66
|
+
*/
|
|
67
|
+
shouldAnimate ? {
|
|
62
68
|
'slide-from-left': navAnimation === 'back',
|
|
63
69
|
'slide-from-right': navAnimation === 'forward'
|
|
64
|
-
});
|
|
70
|
+
} : {});
|
|
65
71
|
return /*#__PURE__*/_jsx("div", {
|
|
66
72
|
ref: wrapperRef,
|
|
67
73
|
className: wrapperCls,
|
|
@@ -70,6 +76,7 @@ function SidebarContentWrapper({
|
|
|
70
76
|
}
|
|
71
77
|
export default function SidebarContent({
|
|
72
78
|
routeKey,
|
|
79
|
+
shouldAnimate,
|
|
73
80
|
children
|
|
74
81
|
}) {
|
|
75
82
|
const [navState] = useState(createNavState);
|
|
@@ -78,6 +85,7 @@ export default function SidebarContent({
|
|
|
78
85
|
children: /*#__PURE__*/_jsx("div", {
|
|
79
86
|
className: "edit-site-sidebar__content",
|
|
80
87
|
children: /*#__PURE__*/_jsx(SidebarContentWrapper, {
|
|
88
|
+
shouldAnimate: shouldAnimate,
|
|
81
89
|
children: children
|
|
82
90
|
}, routeKey)
|
|
83
91
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","createContext","useContext","useState","useRef","useLayoutEffect","focus","jsx","_jsx","SidebarNavigationContext","focusSidebarElement","el","direction","focusSelector","elementToFocus","querySelector","firstTabbable","tabbable","find","createNavState","state","get","navigate","SidebarContentWrapper","children","navState","wrapperRef","navAnimation","setNavAnimation","current","wrapperCls","ref","className","SidebarContent","routeKey","Provider","value"],"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseState,\n\tuseRef,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\n\nexport const SidebarNavigationContext = createContext( () => {} );\n// Focus a sidebar element after a navigation. The element to focus is either\n// specified by `focusSelector` (when navigating back) or it is the first\n// tabbable element (usually the \"Back\" button).\nfunction focusSidebarElement( el, direction, focusSelector ) {\n\tlet elementToFocus;\n\tif ( direction === 'back' && focusSelector ) {\n\t\telementToFocus = el.querySelector( focusSelector );\n\t}\n\tif ( direction !== null && ! elementToFocus ) {\n\t\tconst [ firstTabbable ] = focus.tabbable.find( el );\n\t\telementToFocus = firstTabbable ?? el;\n\t}\n\telementToFocus?.focus();\n}\n\n// Navigation state that is updated when navigating back or forward. Helps us\n// manage the animations and also focus.\nfunction createNavState() {\n\tlet state = {\n\t\tdirection: null,\n\t\tfocusSelector: null,\n\t};\n\n\treturn {\n\t\tget() {\n\t\t\treturn state;\n\t\t},\n\t\tnavigate( direction, focusSelector = null ) {\n\t\t\tstate = {\n\t\t\t\tdirection,\n\t\t\t\tfocusSelector:\n\t\t\t\t\tdirection === 'forward' && focusSelector\n\t\t\t\t\t\t? focusSelector\n\t\t\t\t\t\t: state.focusSelector,\n\t\t\t};\n\t\t},\n\t};\n}\n\nfunction SidebarContentWrapper( { children } ) {\n\tconst navState = useContext( SidebarNavigationContext );\n\tconst wrapperRef = useRef();\n\tconst [ navAnimation, setNavAnimation ] = useState( null );\n\n\tuseLayoutEffect( () => {\n\t\tconst { direction, focusSelector } = navState.get();\n\t\tfocusSidebarElement( wrapperRef.current, direction, focusSelector );\n\t\tsetNavAnimation( direction );\n\t}, [ navState ] );\n\n\tconst wrapperCls = clsx(
|
|
1
|
+
{"version":3,"names":["clsx","createContext","useContext","useState","useRef","useLayoutEffect","focus","jsx","_jsx","SidebarNavigationContext","focusSidebarElement","el","direction","focusSelector","elementToFocus","querySelector","firstTabbable","tabbable","find","createNavState","state","get","navigate","SidebarContentWrapper","children","shouldAnimate","navState","wrapperRef","navAnimation","setNavAnimation","current","wrapperCls","ref","className","SidebarContent","routeKey","Provider","value"],"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseState,\n\tuseRef,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { focus } from '@wordpress/dom';\n\nexport const SidebarNavigationContext = createContext( () => {} );\n// Focus a sidebar element after a navigation. The element to focus is either\n// specified by `focusSelector` (when navigating back) or it is the first\n// tabbable element (usually the \"Back\" button).\nfunction focusSidebarElement( el, direction, focusSelector ) {\n\tlet elementToFocus;\n\tif ( direction === 'back' && focusSelector ) {\n\t\telementToFocus = el.querySelector( focusSelector );\n\t}\n\tif ( direction !== null && ! elementToFocus ) {\n\t\tconst [ firstTabbable ] = focus.tabbable.find( el );\n\t\telementToFocus = firstTabbable ?? el;\n\t}\n\telementToFocus?.focus();\n}\n\n// Navigation state that is updated when navigating back or forward. Helps us\n// manage the animations and also focus.\nfunction createNavState() {\n\tlet state = {\n\t\tdirection: null,\n\t\tfocusSelector: null,\n\t};\n\n\treturn {\n\t\tget() {\n\t\t\treturn state;\n\t\t},\n\t\tnavigate( direction, focusSelector = null ) {\n\t\t\tstate = {\n\t\t\t\tdirection,\n\t\t\t\tfocusSelector:\n\t\t\t\t\tdirection === 'forward' && focusSelector\n\t\t\t\t\t\t? focusSelector\n\t\t\t\t\t\t: state.focusSelector,\n\t\t\t};\n\t\t},\n\t};\n}\n\nfunction SidebarContentWrapper( { children, shouldAnimate } ) {\n\tconst navState = useContext( SidebarNavigationContext );\n\tconst wrapperRef = useRef();\n\tconst [ navAnimation, setNavAnimation ] = useState( null );\n\n\tuseLayoutEffect( () => {\n\t\tconst { direction, focusSelector } = navState.get();\n\t\tfocusSidebarElement( wrapperRef.current, direction, focusSelector );\n\t\tsetNavAnimation( direction );\n\t}, [ navState ] );\n\n\tconst wrapperCls = clsx(\n\t\t'edit-site-sidebar__screen-wrapper',\n\t\t/*\n\t\t * Some panes do not have sub-panes and therefore\n\t\t * should not animate when clicked on.\n\t\t */\n\t\tshouldAnimate\n\t\t\t? {\n\t\t\t\t\t'slide-from-left': navAnimation === 'back',\n\t\t\t\t\t'slide-from-right': navAnimation === 'forward',\n\t\t\t }\n\t\t\t: {}\n\t);\n\n\treturn (\n\t\t<div ref={ wrapperRef } className={ wrapperCls }>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default function SidebarContent( {\n\trouteKey,\n\tshouldAnimate,\n\tchildren,\n} ) {\n\tconst [ navState ] = useState( createNavState );\n\n\treturn (\n\t\t<SidebarNavigationContext.Provider value={ navState }>\n\t\t\t<div className=\"edit-site-sidebar__content\">\n\t\t\t\t<SidebarContentWrapper\n\t\t\t\t\tshouldAnimate={ shouldAnimate }\n\t\t\t\t\tkey={ routeKey }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</SidebarContentWrapper>\n\t\t\t</div>\n\t\t</SidebarNavigationContext.Provider>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,aAAa,EACbC,UAAU,EACVC,QAAQ,EACRC,MAAM,EACNC,eAAe,QACT,oBAAoB;AAC3B,SAASC,KAAK,QAAQ,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEvC,OAAO,MAAMC,wBAAwB,GAAGR,aAAa,CAAE,MAAM,CAAC,CAAE,CAAC;AACjE;AACA;AACA;AACA,SAASS,mBAAmBA,CAAEC,EAAE,EAAEC,SAAS,EAAEC,aAAa,EAAG;EAC5D,IAAIC,cAAc;EAClB,IAAKF,SAAS,KAAK,MAAM,IAAIC,aAAa,EAAG;IAC5CC,cAAc,GAAGH,EAAE,CAACI,aAAa,CAAEF,aAAc,CAAC;EACnD;EACA,IA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EyB,aAAa,GACV;IACA,iBAAiB,EAAEG,YAAY,KAAK,MAAM;IAC1C,kBAAkB,EAAEA,YAAY,KAAK;EACrC,CAAC,GACD,CAAC,CACL,CAAC;EAED,oBACCpB,IAAA;IAAKwB,GAAG,EAAGL,UAAY;IAACM,SAAS,EAAGF,UAAY;IAAAP,QAAA,EAC7CA;EAAQ,CACN,CAAC;AAER;AAEA,eAAe,SAASU,cAAcA,CAAE;EACvCC,QAAQ;EACRV,aAAa;EACbD;AACD,CAAC,EAAG;EACH,MAAM,CAAEE,QAAQ,CAAE,GAAGvB,QAAQ,CAAEgB,cAAe,CAAC;EAE/C,oBACCX,IAAA,CAACC,wBAAwB,CAAC2B,QAAQ;IAACC,KAAK,EAAGX,QAAU;IAAAF,QAAA,eACpDhB,IAAA;MAAKyB,SAAS,EAAC,4BAA4B;MAAAT,QAAA,eAC1ChB,IAAA,CAACe,qBAAqB;QACrBE,aAAa,EAAGA,aAAe;QAAAD,QAAA,EAG7BA;MAAQ,GAFJW,QAGgB;IAAC,CACpB;EAAC,CAC4B,CAAC;AAEtC","ignoreList":[]}
|
|
@@ -16,9 +16,6 @@ export const defaultLayouts = {
|
|
|
16
16
|
layout: {
|
|
17
17
|
primaryField: 'title',
|
|
18
18
|
styles: {
|
|
19
|
-
'featured-image': {
|
|
20
|
-
width: '1%'
|
|
21
|
-
},
|
|
22
19
|
title: {
|
|
23
20
|
maxWidth: 300
|
|
24
21
|
}
|
|
@@ -27,14 +24,14 @@ export const defaultLayouts = {
|
|
|
27
24
|
},
|
|
28
25
|
[LAYOUT_GRID]: {
|
|
29
26
|
layout: {
|
|
30
|
-
mediaField: '
|
|
27
|
+
mediaField: 'featured_media',
|
|
31
28
|
primaryField: 'title'
|
|
32
29
|
}
|
|
33
30
|
},
|
|
34
31
|
[LAYOUT_LIST]: {
|
|
35
32
|
layout: {
|
|
36
33
|
primaryField: 'title',
|
|
37
|
-
mediaField: '
|
|
34
|
+
mediaField: 'featured_media'
|
|
38
35
|
}
|
|
39
36
|
}
|
|
40
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","trash","pages","drafts","published","scheduled","pending","notAllowed","useSelect","store","coreStore","useMemo","LAYOUT_LIST","LAYOUT_TABLE","LAYOUT_GRID","OPERATOR_IS_ANY","defaultLayouts","layout","primaryField","styles","
|
|
1
|
+
{"version":3,"names":["__","trash","pages","drafts","published","scheduled","pending","notAllowed","useSelect","store","coreStore","useMemo","LAYOUT_LIST","LAYOUT_TABLE","LAYOUT_GRID","OPERATOR_IS_ANY","defaultLayouts","layout","primaryField","styles","title","maxWidth","mediaField","DEFAULT_POST_BASE","type","search","filters","page","perPage","sort","field","direction","fields","useDefaultViews","postType","labels","select","getPostType","all_items","slug","icon","view","operator","value"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/default-views.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nimport {\n\ttrash,\n\tpages,\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n} from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_LIST,\n\tLAYOUT_TABLE,\n\tLAYOUT_GRID,\n\tOPERATOR_IS_ANY,\n} from '../../utils/constants';\n\nexport const defaultLayouts = {\n\t[ LAYOUT_TABLE ]: {\n\t\tlayout: {\n\t\t\tprimaryField: 'title',\n\t\t\tstyles: {\n\t\t\t\ttitle: {\n\t\t\t\t\tmaxWidth: 300,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tlayout: {\n\t\t\tmediaField: 'featured_media',\n\t\t\tprimaryField: 'title',\n\t\t},\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tlayout: {\n\t\t\tprimaryField: 'title',\n\t\t\tmediaField: 'featured_media',\n\t\t},\n\t},\n};\n\nconst DEFAULT_POST_BASE = {\n\ttype: LAYOUT_LIST,\n\tsearch: '',\n\tfilters: [],\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'date',\n\t\tdirection: 'desc',\n\t},\n\tfields: [ 'title', 'author', 'status' ],\n\tlayout: defaultLayouts[ LAYOUT_LIST ].layout,\n};\n\nexport function useDefaultViews( { postType } ) {\n\tconst labels = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\treturn getPostType( postType )?.labels;\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo( () => {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttitle: labels?.all_items || __( 'All items' ),\n\t\t\t\tslug: 'all',\n\t\t\t\ticon: pages,\n\t\t\t\tview: DEFAULT_POST_BASE,\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Published' ),\n\t\t\t\tslug: 'published',\n\t\t\t\ticon: published,\n\t\t\t\tview: DEFAULT_POST_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'publish',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Scheduled' ),\n\t\t\t\tslug: 'future',\n\t\t\t\ticon: scheduled,\n\t\t\t\tview: DEFAULT_POST_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'future',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Drafts' ),\n\t\t\t\tslug: 'drafts',\n\t\t\t\ticon: drafts,\n\t\t\t\tview: DEFAULT_POST_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'draft',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Pending' ),\n\t\t\t\tslug: 'pending',\n\t\t\t\ticon: pending,\n\t\t\t\tview: DEFAULT_POST_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'pending',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Private' ),\n\t\t\t\tslug: 'private',\n\t\t\t\ticon: notAllowed,\n\t\t\t\tview: DEFAULT_POST_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'private',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Trash' ),\n\t\t\t\tslug: 'trash',\n\t\t\t\ticon: trash,\n\t\t\t\tview: {\n\t\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\t\ttype: LAYOUT_TABLE,\n\t\t\t\t\tlayout: defaultLayouts[ LAYOUT_TABLE ].layout,\n\t\t\t\t},\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'trash',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t];\n\t}, [ labels ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AAEpC,SACCC,KAAK,EACLC,KAAK,EACLC,MAAM,EACNC,SAAS,EACTC,SAAS,EACTC,O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EACD;MACCvB,KAAK,EAAEpB,EAAE,CAAE,SAAU,CAAC;MACtBuC,IAAI,EAAE,SAAS;MACfC,IAAI,EAAEjC,UAAU;MAChBkC,IAAI,EAAElB,iBAAiB;MACvBG,OAAO,EAAE,CACR;QACCI,KAAK,EAAE,QAAQ;QACfY,QAAQ,EAAE3B,eAAe;QACzB4B,KAAK,EAAE;MACR,CAAC;IAEH,CAAC,EACD;MACCvB,KAAK,EAAEpB,EAAE,CAAE,OAAQ,CAAC;MACpBuC,IAAI,EAAE,OAAO;MACbC,IAAI,EAAEvC,KAAK;MACXwC,IAAI,EAAE;QACL,GAAGlB,iBAAiB;QACpBC,IAAI,EAAEX,YAAY;QAClBI,MAAM,EAAED,cAAc,CAAEH,YAAY,CAAE,CAACI;MACxC,CAAC;MACDS,OAAO,EAAE,CACR;QACCI,KAAK,EAAE,QAAQ;QACfY,QAAQ,EAAE3B,eAAe;QACzB4B,KAAK,EAAE;MACR,CAAC;IAEH,CAAC,CACD;EACF,CAAC,EAAE,CAAER,MAAM,CAAG,CAAC;AAChB","ignoreList":[]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useMemo, useState } from '@wordpress/element';
|
|
6
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
7
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
8
|
+
import { Button, privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import GlobalStylesUI from '../global-styles/ui';
|
|
14
|
+
import Page from '../page';
|
|
15
|
+
import { unlock } from '../../lock-unlock';
|
|
16
|
+
import StyleBook from '../style-book';
|
|
17
|
+
import { STYLE_BOOK_COLOR_GROUPS } from '../style-book/constants';
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
|
+
const {
|
|
20
|
+
useLocation,
|
|
21
|
+
useHistory
|
|
22
|
+
} = unlock(routerPrivateApis);
|
|
23
|
+
const {
|
|
24
|
+
Menu
|
|
25
|
+
} = unlock(componentsPrivateApis);
|
|
26
|
+
const GLOBAL_STYLES_PATH_PREFIX = '/wp_global_styles';
|
|
27
|
+
const GlobalStylesPageActions = ({
|
|
28
|
+
isStyleBookOpened,
|
|
29
|
+
setIsStyleBookOpened
|
|
30
|
+
}) => {
|
|
31
|
+
return /*#__PURE__*/_jsxs(Menu, {
|
|
32
|
+
trigger: /*#__PURE__*/_jsx(Button, {
|
|
33
|
+
__next40pxDefaultSize: true,
|
|
34
|
+
variant: "tertiary",
|
|
35
|
+
size: "compact",
|
|
36
|
+
children: __('Preview')
|
|
37
|
+
}),
|
|
38
|
+
children: [/*#__PURE__*/_jsxs(Menu.RadioItem, {
|
|
39
|
+
value: true,
|
|
40
|
+
checked: isStyleBookOpened,
|
|
41
|
+
name: "styles-preview-actions",
|
|
42
|
+
onChange: () => setIsStyleBookOpened(true),
|
|
43
|
+
defaultChecked: true,
|
|
44
|
+
children: [/*#__PURE__*/_jsx(Menu.ItemLabel, {
|
|
45
|
+
children: __('Style book')
|
|
46
|
+
}), /*#__PURE__*/_jsx(Menu.ItemHelpText, {
|
|
47
|
+
children: __('Preview blocks and styles.')
|
|
48
|
+
})]
|
|
49
|
+
}), /*#__PURE__*/_jsxs(Menu.RadioItem, {
|
|
50
|
+
value: false,
|
|
51
|
+
checked: !isStyleBookOpened,
|
|
52
|
+
name: "styles-preview-actions",
|
|
53
|
+
onChange: () => setIsStyleBookOpened(false),
|
|
54
|
+
children: [/*#__PURE__*/_jsx(Menu.ItemLabel, {
|
|
55
|
+
children: __('Site')
|
|
56
|
+
}), /*#__PURE__*/_jsx(Menu.ItemHelpText, {
|
|
57
|
+
children: __('Preview your site.')
|
|
58
|
+
})]
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
export default function GlobalStylesUIWrapper() {
|
|
63
|
+
const {
|
|
64
|
+
params
|
|
65
|
+
} = useLocation();
|
|
66
|
+
const history = useHistory();
|
|
67
|
+
const {
|
|
68
|
+
canvas = 'view'
|
|
69
|
+
} = params;
|
|
70
|
+
const [isStyleBookOpened, setIsStyleBookOpened] = useState(false);
|
|
71
|
+
const isMobileViewport = useViewportMatch('medium', '<');
|
|
72
|
+
const pathWithPrefix = params.path;
|
|
73
|
+
const [path, onPathChange] = useMemo(() => {
|
|
74
|
+
const processedPath = pathWithPrefix.substring(GLOBAL_STYLES_PATH_PREFIX.length);
|
|
75
|
+
return [processedPath ? processedPath : '/', newPath => {
|
|
76
|
+
history.push({
|
|
77
|
+
path: !newPath || newPath === '/' ? GLOBAL_STYLES_PATH_PREFIX : `${GLOBAL_STYLES_PATH_PREFIX}${newPath}`
|
|
78
|
+
});
|
|
79
|
+
}];
|
|
80
|
+
}, [pathWithPrefix, history]);
|
|
81
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
82
|
+
children: [/*#__PURE__*/_jsx(Page, {
|
|
83
|
+
actions: !isMobileViewport ? /*#__PURE__*/_jsx(GlobalStylesPageActions, {
|
|
84
|
+
isStyleBookOpened: isStyleBookOpened,
|
|
85
|
+
setIsStyleBookOpened: setIsStyleBookOpened
|
|
86
|
+
}) : null,
|
|
87
|
+
className: "edit-site-styles",
|
|
88
|
+
title: __('Styles'),
|
|
89
|
+
children: /*#__PURE__*/_jsx(GlobalStylesUI, {
|
|
90
|
+
path: path,
|
|
91
|
+
onPathChange: onPathChange
|
|
92
|
+
})
|
|
93
|
+
}), canvas === 'view' && isStyleBookOpened && /*#__PURE__*/_jsx(StyleBook, {
|
|
94
|
+
enableResizing: false,
|
|
95
|
+
showCloseButton: false,
|
|
96
|
+
showTabs: false,
|
|
97
|
+
isSelected: blockName =>
|
|
98
|
+
// Match '/blocks/core%2Fbutton' and
|
|
99
|
+
// '/blocks/core%2Fbutton/typography', but not
|
|
100
|
+
// '/blocks/core%2Fbuttons'.
|
|
101
|
+
path === `/wp_global_styles/blocks/${encodeURIComponent(blockName)}` || path.startsWith(`/wp_global_styles/blocks/${encodeURIComponent(blockName)}/`),
|
|
102
|
+
path: path,
|
|
103
|
+
onSelect: blockName => {
|
|
104
|
+
if (STYLE_BOOK_COLOR_GROUPS.find(group => group.slug === blockName)) {
|
|
105
|
+
// Go to color palettes Global Styles.
|
|
106
|
+
onPathChange('/colors/palette');
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (blockName === 'typography') {
|
|
110
|
+
// Go to typography Global Styles.
|
|
111
|
+
onPathChange('/typography');
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Now go to the selected block.
|
|
116
|
+
onPathChange(`/blocks/${encodeURIComponent(blockName)}`);
|
|
117
|
+
}
|
|
118
|
+
})]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__","useMemo","useState","privateApis","routerPrivateApis","useViewportMatch","Button","componentsPrivateApis","GlobalStylesUI","Page","unlock","StyleBook","STYLE_BOOK_COLOR_GROUPS","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useLocation","useHistory","Menu","GLOBAL_STYLES_PATH_PREFIX","GlobalStylesPageActions","isStyleBookOpened","setIsStyleBookOpened","trigger","__next40pxDefaultSize","variant","size","children","RadioItem","value","checked","name","onChange","defaultChecked","ItemLabel","ItemHelpText","GlobalStylesUIWrapper","params","history","canvas","isMobileViewport","pathWithPrefix","path","onPathChange","processedPath","substring","length","newPath","push","actions","className","title","enableResizing","showCloseButton","showTabs","isSelected","blockName","encodeURIComponent","startsWith","onSelect","find","group","slug"],"sources":["@wordpress/edit-site/src/components/sidebar-global-styles-wrapper/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tButton,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport GlobalStylesUI from '../global-styles/ui';\nimport Page from '../page';\nimport { unlock } from '../../lock-unlock';\nimport StyleBook from '../style-book';\nimport { STYLE_BOOK_COLOR_GROUPS } from '../style-book/constants';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\nconst { Menu } = unlock( componentsPrivateApis );\nconst GLOBAL_STYLES_PATH_PREFIX = '/wp_global_styles';\n\nconst GlobalStylesPageActions = ( {\n\tisStyleBookOpened,\n\tsetIsStyleBookOpened,\n} ) => {\n\treturn (\n\t\t<Menu\n\t\t\ttrigger={\n\t\t\t\t<Button __next40pxDefaultSize variant=\"tertiary\" size=\"compact\">\n\t\t\t\t\t{ __( 'Preview' ) }\n\t\t\t\t</Button>\n\t\t\t}\n\t\t>\n\t\t\t<Menu.RadioItem\n\t\t\t\tvalue\n\t\t\t\tchecked={ isStyleBookOpened }\n\t\t\t\tname=\"styles-preview-actions\"\n\t\t\t\tonChange={ () => setIsStyleBookOpened( true ) }\n\t\t\t\tdefaultChecked\n\t\t\t>\n\t\t\t\t<Menu.ItemLabel>{ __( 'Style book' ) }</Menu.ItemLabel>\n\t\t\t\t<Menu.ItemHelpText>\n\t\t\t\t\t{ __( 'Preview blocks and styles.' ) }\n\t\t\t\t</Menu.ItemHelpText>\n\t\t\t</Menu.RadioItem>\n\t\t\t<Menu.RadioItem\n\t\t\t\tvalue={ false }\n\t\t\t\tchecked={ ! isStyleBookOpened }\n\t\t\t\tname=\"styles-preview-actions\"\n\t\t\t\tonChange={ () => setIsStyleBookOpened( false ) }\n\t\t\t>\n\t\t\t\t<Menu.ItemLabel>{ __( 'Site' ) }</Menu.ItemLabel>\n\t\t\t\t<Menu.ItemHelpText>\n\t\t\t\t\t{ __( 'Preview your site.' ) }\n\t\t\t\t</Menu.ItemHelpText>\n\t\t\t</Menu.RadioItem>\n\t\t</Menu>\n\t);\n};\n\nexport default function GlobalStylesUIWrapper() {\n\tconst { params } = useLocation();\n\tconst history = useHistory();\n\tconst { canvas = 'view' } = params;\n\tconst [ isStyleBookOpened, setIsStyleBookOpened ] = useState( false );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst pathWithPrefix = params.path;\n\tconst [ path, onPathChange ] = useMemo( () => {\n\t\tconst processedPath = pathWithPrefix.substring(\n\t\t\tGLOBAL_STYLES_PATH_PREFIX.length\n\t\t);\n\t\treturn [\n\t\t\tprocessedPath ? processedPath : '/',\n\t\t\t( newPath ) => {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath:\n\t\t\t\t\t\t! newPath || newPath === '/'\n\t\t\t\t\t\t\t? GLOBAL_STYLES_PATH_PREFIX\n\t\t\t\t\t\t\t: `${ GLOBAL_STYLES_PATH_PREFIX }${ newPath }`,\n\t\t\t\t} );\n\t\t\t},\n\t\t];\n\t}, [ pathWithPrefix, history ] );\n\n\treturn (\n\t\t<>\n\t\t\t<Page\n\t\t\t\tactions={\n\t\t\t\t\t! isMobileViewport ? (\n\t\t\t\t\t\t<GlobalStylesPageActions\n\t\t\t\t\t\t\tisStyleBookOpened={ isStyleBookOpened }\n\t\t\t\t\t\t\tsetIsStyleBookOpened={ setIsStyleBookOpened }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null\n\t\t\t\t}\n\t\t\t\tclassName=\"edit-site-styles\"\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t>\n\t\t\t\t<GlobalStylesUI path={ path } onPathChange={ onPathChange } />\n\t\t\t</Page>\n\t\t\t{ canvas === 'view' && isStyleBookOpened && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t\tisSelected={ ( blockName ) =>\n\t\t\t\t\t\t// Match '/blocks/core%2Fbutton' and\n\t\t\t\t\t\t// '/blocks/core%2Fbutton/typography', but not\n\t\t\t\t\t\t// '/blocks/core%2Fbuttons'.\n\t\t\t\t\t\tpath ===\n\t\t\t\t\t\t\t`/wp_global_styles/blocks/${ encodeURIComponent(\n\t\t\t\t\t\t\t\tblockName\n\t\t\t\t\t\t\t) }` ||\n\t\t\t\t\t\tpath.startsWith(\n\t\t\t\t\t\t\t`/wp_global_styles/blocks/${ encodeURIComponent(\n\t\t\t\t\t\t\t\tblockName\n\t\t\t\t\t\t\t) }/`\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tpath={ path }\n\t\t\t\t\tonSelect={ ( blockName ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tSTYLE_BOOK_COLOR_GROUPS.find(\n\t\t\t\t\t\t\t\t( group ) => group.slug === blockName\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// Go to color palettes Global Styles.\n\t\t\t\t\t\t\tonPathChange( '/colors/palette' );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( blockName === 'typography' ) {\n\t\t\t\t\t\t\t// Go to typography Global Styles.\n\t\t\t\t\t\t\tonPathChange( '/typography' );\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Now go to the selected block.\n\t\t\t\t\t\tonPathChange(\n\t\t\t\t\t\t\t`/blocks/${ encodeURIComponent( blockName ) }`\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,gBAAgB,QAAQ,oBAAoB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ebarNavigationScreen({
|
|
|
89
89
|
color: '#e0e0e0' /* $gray-200 */,
|
|
90
90
|
level: 1,
|
|
91
91
|
size: 20,
|
|
92
|
-
children: !isPreviewingTheme() ? title : sprintf(
|
|
92
|
+
children: !isPreviewingTheme() ? title : sprintf(/* translators: 1: theme name. 2: title */
|
|
93
|
+
__('Previewing %1$s: %2$s'), previewingThemeName, title)
|
|
93
94
|
}), actions && /*#__PURE__*/_jsx("div", {
|
|
94
95
|
className: "edit-site-sidebar-navigation-screen__actions",
|
|
95
96
|
children: actions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","__experimentalHStack","HStack","__experimentalHeading","Heading","__experimentalVStack","VStack","isRTL","__","sprintf","chevronRight","chevronLeft","store","coreStore","useSelect","privateApis","routerPrivateApis","useContext","editSiteStore","unlock","SidebarButton","isPreviewingTheme","currentlyPreviewingTheme","SidebarNavigationContext","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useHistory","useLocation","SidebarNavigationScreen","isRoot","title","actions","meta","content","footer","description","backPath","backPathProp","dashboardLink","dashboardLinkText","previewingThemeName","select","getSettings","currentlyPreviewingThemeId","__experimentalDashboardLink","__experimentalDashboardLinkText","getTheme","name","rendered","undefined","location","history","navigate","state","icon","children","className","spacing","justify","alignment","onClick","push","label","showTooltip","href","color","level","size"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalHeading as Heading,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { isRTL, __, sprintf } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport SidebarButton from '../sidebar-button';\nimport {\n\tisPreviewingTheme,\n\tcurrentlyPreviewingTheme,\n} from '../../utils/is-previewing-theme';\nimport { SidebarNavigationContext } from '../sidebar';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\nexport default function SidebarNavigationScreen( {\n\tisRoot,\n\ttitle,\n\tactions,\n\tmeta,\n\tcontent,\n\tfooter,\n\tdescription,\n\tbackPath: backPathProp,\n} ) {\n\tconst { dashboardLink, dashboardLinkText, previewingThemeName } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\t\tconst currentlyPreviewingThemeId = currentlyPreviewingTheme();\n\t\t\treturn {\n\t\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t\t\tdashboardLinkText:\n\t\t\t\t\tgetSettings().__experimentalDashboardLinkText,\n\t\t\t\t// Do not call `getTheme` with null, it will cause a request to\n\t\t\t\t// the server.\n\t\t\t\tpreviewingThemeName: currentlyPreviewingThemeId\n\t\t\t\t\t? select( coreStore ).getTheme( currentlyPreviewingThemeId )\n\t\t\t\t\t\t\t?.name?.rendered\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst { navigate } = useContext( SidebarNavigationContext );\n\tconst backPath = backPathProp ?? location.state?.backPath;\n\tconst icon = isRTL() ? chevronRight : chevronLeft;\n\n\treturn (\n\t\t<>\n\t\t\t<VStack\n\t\t\t\tclassName={ clsx( 'edit-site-sidebar-navigation-screen__main', {\n\t\t\t\t\t'has-footer': !! footer,\n\t\t\t\t} ) }\n\t\t\t\tspacing={ 0 }\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\talignment=\"flex-start\"\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title-icon\"\n\t\t\t\t>\n\t\t\t\t\t{ ! isRoot && (\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\thistory.push( backPath );\n\t\t\t\t\t\t\t\tnavigate( 'back' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tlabel={ __( 'Back' ) }\n\t\t\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isRoot && (\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tdashboardLinkText || __( 'Go to the Dashboard' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thref={ dashboardLink || 'index.php' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<Heading\n\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title\"\n\t\t\t\t\t\tcolor={ '#e0e0e0' /* $gray-200 */ }\n\t\t\t\t\t\tlevel={ 1 }\n\t\t\t\t\t\tsize={ 20 }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! isPreviewingTheme()\n\t\t\t\t\t\t\t? title\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t'Previewing %1$s: %2$s',\n\t\t\t\t\t\t\t\t\tpreviewingThemeName,\n\t\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</Heading>\n\t\t\t\t\t{ actions && (\n\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen__actions\">\n\t\t\t\t\t\t\t{ actions }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t\t{ meta && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen__meta\">\n\t\t\t\t\t\t\t{ meta }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen__content\">\n\t\t\t\t\t{ description && (\n\t\t\t\t\t\t<p className=\"edit-site-sidebar-navigation-screen__description\">\n\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t{ content }\n\t\t\t\t</div>\n\t\t\t</VStack>\n\t\t\t{ footer && (\n\t\t\t\t<footer className=\"edit-site-sidebar-navigation-screen__footer\">\n\t\t\t\t\t{ footer }\n\t\t\t\t</footer>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,oBAAoB,IAAIC,MAAM,EAC9BC,qBAAqB,IAAIC,OAAO,EAChCC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,KAAK,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACpD,SAASC,YAAY,EAAEC,WAAW,QAAQ,kBAAkB;AAC5D,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,SAASL,KAAK,IAAIM,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,SACCC,iBAAiB,EACjBC,wBAAwB,QAClB,iCAAiC;AACxC,SAASC,wBAAwB,QAAQ,YAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAEtD,MAAM;EAAEC,UAAU;EAAEC;AAAY,CAAC,GA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MAClB,CAAE,CAAG;MACLuB,OAAO,EAAG,CAAG;MACbC,OAAO,EAAC,YAAY;MAAAH,QAAA,gBAEpBhC,KAAA,CAACzB,MAAM;QACN2D,OAAO,EAAG,CAAG;QACbE,SAAS,EAAC,YAAY;QACtBH,SAAS,EAAC,iDAAiD;QAAAD,QAAA,GAEzD,CAAE1B,MAAM,iBACTR,IAAA,CAACL,aAAa;UACb4C,OAAO,EAAGA,CAAA,KAAM;YACfT,OAAO,CAACU,IAAI,CAAEzB,QAAS,CAAC;YACxBgB,QAAQ,CAAE,MAAO,CAAC;UACnB,CAAG;UACHE,IAAI,EAAGA,IAAM;UACbQ,KAAK,EAAG1D,EAAE,CAAE,MAAO,CAAG;UACtB2D,WAAW,EAAG;QAAO,CACrB,CACD,EACClC,MAAM,iBACPR,IAAA,CAACL,aAAa;UACbsC,IAAI,EAAGA,IAAM;UACbQ,KAAK,EACJvB,iBAAiB,IAAInC,EAAE,CAAE,qBAAsB,CAC/C;UACD4D,IAAI,EAAG1B,aAAa,IAAI;QAAa,CACrC,CACD,eACDjB,IAAA,CAACrB,OAAO;UACPwD,SAAS,EAAC,4CAA4C;UACtDS,KAAK,EAAG,SAAS,CAAC,eAAiB;UACnCC,KAAK,EAAG,CAAG;UACXC,IAAI,EAAG,EAAI;UAAAZ,QAAA,EAET,CAAEtC,iBAAiB,CAAC,CAAC,GACpBa,KAAK,GACLzB,OAAO,CACP,
|
|
1
|
+
{"version":3,"names":["clsx","__experimentalHStack","HStack","__experimentalHeading","Heading","__experimentalVStack","VStack","isRTL","__","sprintf","chevronRight","chevronLeft","store","coreStore","useSelect","privateApis","routerPrivateApis","useContext","editSiteStore","unlock","SidebarButton","isPreviewingTheme","currentlyPreviewingTheme","SidebarNavigationContext","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useHistory","useLocation","SidebarNavigationScreen","isRoot","title","actions","meta","content","footer","description","backPath","backPathProp","dashboardLink","dashboardLinkText","previewingThemeName","select","getSettings","currentlyPreviewingThemeId","__experimentalDashboardLink","__experimentalDashboardLinkText","getTheme","name","rendered","undefined","location","history","navigate","state","icon","children","className","spacing","justify","alignment","onClick","push","label","showTooltip","href","color","level","size"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalHeading as Heading,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { isRTL, __, sprintf } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport SidebarButton from '../sidebar-button';\nimport {\n\tisPreviewingTheme,\n\tcurrentlyPreviewingTheme,\n} from '../../utils/is-previewing-theme';\nimport { SidebarNavigationContext } from '../sidebar';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\nexport default function SidebarNavigationScreen( {\n\tisRoot,\n\ttitle,\n\tactions,\n\tmeta,\n\tcontent,\n\tfooter,\n\tdescription,\n\tbackPath: backPathProp,\n} ) {\n\tconst { dashboardLink, dashboardLinkText, previewingThemeName } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\t\tconst currentlyPreviewingThemeId = currentlyPreviewingTheme();\n\t\t\treturn {\n\t\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t\t\tdashboardLinkText:\n\t\t\t\t\tgetSettings().__experimentalDashboardLinkText,\n\t\t\t\t// Do not call `getTheme` with null, it will cause a request to\n\t\t\t\t// the server.\n\t\t\t\tpreviewingThemeName: currentlyPreviewingThemeId\n\t\t\t\t\t? select( coreStore ).getTheme( currentlyPreviewingThemeId )\n\t\t\t\t\t\t\t?.name?.rendered\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst { navigate } = useContext( SidebarNavigationContext );\n\tconst backPath = backPathProp ?? location.state?.backPath;\n\tconst icon = isRTL() ? chevronRight : chevronLeft;\n\n\treturn (\n\t\t<>\n\t\t\t<VStack\n\t\t\t\tclassName={ clsx( 'edit-site-sidebar-navigation-screen__main', {\n\t\t\t\t\t'has-footer': !! footer,\n\t\t\t\t} ) }\n\t\t\t\tspacing={ 0 }\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\talignment=\"flex-start\"\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title-icon\"\n\t\t\t\t>\n\t\t\t\t\t{ ! isRoot && (\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\thistory.push( backPath );\n\t\t\t\t\t\t\t\tnavigate( 'back' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tlabel={ __( 'Back' ) }\n\t\t\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isRoot && (\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tdashboardLinkText || __( 'Go to the Dashboard' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thref={ dashboardLink || 'index.php' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<Heading\n\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title\"\n\t\t\t\t\t\tcolor={ '#e0e0e0' /* $gray-200 */ }\n\t\t\t\t\t\tlevel={ 1 }\n\t\t\t\t\t\tsize={ 20 }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! isPreviewingTheme()\n\t\t\t\t\t\t\t? title\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: 1: theme name. 2: title */\n\t\t\t\t\t\t\t\t\t__( 'Previewing %1$s: %2$s' ),\n\t\t\t\t\t\t\t\t\tpreviewingThemeName,\n\t\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</Heading>\n\t\t\t\t\t{ actions && (\n\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen__actions\">\n\t\t\t\t\t\t\t{ actions }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t\t{ meta && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen__meta\">\n\t\t\t\t\t\t\t{ meta }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen__content\">\n\t\t\t\t\t{ description && (\n\t\t\t\t\t\t<p className=\"edit-site-sidebar-navigation-screen__description\">\n\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t{ content }\n\t\t\t\t</div>\n\t\t\t</VStack>\n\t\t\t{ footer && (\n\t\t\t\t<footer className=\"edit-site-sidebar-navigation-screen__footer\">\n\t\t\t\t\t{ footer }\n\t\t\t\t</footer>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,oBAAoB,IAAIC,MAAM,EAC9BC,qBAAqB,IAAIC,OAAO,EAChCC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,KAAK,EAAEC,EAAE,EAAEC,OAAO,QAAQ,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B,IAAA,CAACrB,OAAO;UACPwD,SAAS,EAAC,4CAA4C;UACtDS,KAAK,EAAG,SAAS,CAAC,eAAiB;UACnCC,KAAK,EAAG,CAAG;UACXC,IAAI,EAAG,EAAI;UAAAZ,QAAA,EAET,CAAEtC,iBAAiB,CAAC,CAAC,GACpBa,KAAK,GACLzB,OAAO,CACP;UACAD,EAAE,CAAE,uBAAwB,CAAC,EAC7BoC,mBAAmB,EACnBV,KACA;QAAC,CACI,CAAC,EACRC,OAAO,iBACRV,IAAA;UAAKmC,SAAS,EAAC,8CAA8C;UAAAD,QAAA,EAC1DxB;QAAO,CACL,CACL;MAAA,CACM,CAAC,EACPC,IAAI,iBACLX,IAAA,CAAAI,SAAA;QAAA8B,QAAA,eACClC,IAAA;UAAKmC,SAAS,EAAC,2CAA2C;UAAAD,QAAA,EACvDvB;QAAI,CACF;MAAC,CACL,CACF,eAEDT,KAAA;QAAKiC,SAAS,EAAC,8CAA8C;QAAAD,QAAA,GAC1DpB,WAAW,iBACZd,IAAA;UAAGmC,SAAS,EAAC,kDAAkD;UAAAD,QAAA,EAC5DpB;QAAW,CACX,CACH,EACCF,OAAO;MAAA,CACL,CAAC;IAAA,CACC,CAAC,EACPC,MAAM,iBACPb,IAAA;MAAQmC,SAAS,EAAC,6CAA6C;MAAAD,QAAA,EAC5DrB;IAAM,CACD,CACR;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { edit, seen } from '@wordpress/icons';
|
|
6
5
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
9
7
|
import { useCallback } from '@wordpress/element';
|
|
10
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
11
8
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
9
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
12
|
* Internal dependencies
|
|
@@ -16,20 +14,19 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
16
14
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
17
15
|
import { unlock } from '../../lock-unlock';
|
|
18
16
|
import { store as editSiteStore } from '../../store';
|
|
19
|
-
import SidebarButton from '../sidebar-button';
|
|
20
17
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
21
|
-
import StyleBook from '../style-book';
|
|
22
18
|
import useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';
|
|
23
19
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
24
|
-
import
|
|
25
|
-
import { jsx as _jsx, Fragment as _Fragment
|
|
20
|
+
import { MainSidebarNavigationContent } from '../sidebar-navigation-screen-main';
|
|
21
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
|
+
const {
|
|
23
|
+
useLocation,
|
|
24
|
+
useHistory
|
|
25
|
+
} = unlock(routerPrivateApis);
|
|
26
26
|
export function SidebarNavigationItemGlobalStyles(props) {
|
|
27
27
|
const {
|
|
28
|
-
|
|
29
|
-
} =
|
|
30
|
-
const {
|
|
31
|
-
setCanvasMode
|
|
32
|
-
} = unlock(useDispatch(editSiteStore));
|
|
28
|
+
params
|
|
29
|
+
} = useLocation();
|
|
33
30
|
const hasGlobalStyleVariations = useSelect(select => !!select(coreStore).__experimentalGetCurrentThemeGlobalStylesVariations()?.length, []);
|
|
34
31
|
if (hasGlobalStyleVariations) {
|
|
35
32
|
return /*#__PURE__*/_jsx(SidebarNavigationItem, {
|
|
@@ -37,22 +34,19 @@ export function SidebarNavigationItemGlobalStyles(props) {
|
|
|
37
34
|
params: {
|
|
38
35
|
path: '/wp_global_styles'
|
|
39
36
|
},
|
|
40
|
-
uid: "global-styles-navigation-item"
|
|
37
|
+
uid: "global-styles-navigation-item",
|
|
38
|
+
"aria-current": params.path && params.path.startsWith('/wp_global_styles')
|
|
41
39
|
});
|
|
42
40
|
}
|
|
43
41
|
return /*#__PURE__*/_jsx(SidebarNavigationItem, {
|
|
44
|
-
...props
|
|
45
|
-
onClick: () => {
|
|
46
|
-
// Switch to edit mode.
|
|
47
|
-
setCanvasMode('edit');
|
|
48
|
-
// Open global styles sidebar.
|
|
49
|
-
openGeneralSidebar('edit-site/global-styles');
|
|
50
|
-
}
|
|
42
|
+
...props
|
|
51
43
|
});
|
|
52
44
|
}
|
|
53
|
-
export default function SidebarNavigationScreenGlobalStyles({
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
export default function SidebarNavigationScreenGlobalStyles() {
|
|
46
|
+
const history = useHistory();
|
|
47
|
+
const {
|
|
48
|
+
params
|
|
49
|
+
} = useLocation();
|
|
56
50
|
const {
|
|
57
51
|
revisions,
|
|
58
52
|
isLoading: isLoadingRevisions
|
|
@@ -61,23 +55,12 @@ export default function SidebarNavigationScreenGlobalStyles({
|
|
|
61
55
|
openGeneralSidebar
|
|
62
56
|
} = useDispatch(editSiteStore);
|
|
63
57
|
const {
|
|
64
|
-
setIsListViewOpened
|
|
65
|
-
} = useDispatch(editorStore);
|
|
66
|
-
const isMobileViewport = useViewportMatch('medium', '<');
|
|
67
|
-
const {
|
|
68
|
-
setCanvasMode,
|
|
69
58
|
setEditorCanvasContainerView
|
|
70
59
|
} = unlock(useDispatch(editSiteStore));
|
|
71
60
|
const {
|
|
72
|
-
isViewMode,
|
|
73
|
-
isStyleBookOpened,
|
|
74
61
|
revisionsCount
|
|
75
62
|
} = useSelect(select => {
|
|
76
63
|
var _globalStyles$_links$;
|
|
77
|
-
const {
|
|
78
|
-
getCanvasMode,
|
|
79
|
-
getEditorCanvasContainerView
|
|
80
|
-
} = unlock(select(editSiteStore));
|
|
81
64
|
const {
|
|
82
65
|
getEntityRecord,
|
|
83
66
|
__experimentalGetCurrentGlobalStylesId
|
|
@@ -85,8 +68,6 @@ export default function SidebarNavigationScreenGlobalStyles({
|
|
|
85
68
|
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
86
69
|
const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
|
|
87
70
|
return {
|
|
88
|
-
isViewMode: 'view' === getCanvasMode(),
|
|
89
|
-
isStyleBookOpened: 'style-book' === getEditorCanvasContainerView(),
|
|
90
71
|
revisionsCount: (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0
|
|
91
72
|
};
|
|
92
73
|
}, []);
|
|
@@ -94,16 +75,14 @@ export default function SidebarNavigationScreenGlobalStyles({
|
|
|
94
75
|
set: setPreference
|
|
95
76
|
} = useDispatch(preferencesStore);
|
|
96
77
|
const openGlobalStyles = useCallback(async () => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
setIsListViewOpened(false);
|
|
106
|
-
}, [openGlobalStyles, setEditorCanvasContainerView, setIsListViewOpened]);
|
|
78
|
+
history.push({
|
|
79
|
+
...params,
|
|
80
|
+
canvas: 'edit'
|
|
81
|
+
}, undefined, {
|
|
82
|
+
transition: 'canvas-mode-edit-transition'
|
|
83
|
+
});
|
|
84
|
+
return Promise.all([setPreference('core', 'distractionFree', false), openGeneralSidebar('edit-site/global-styles')]);
|
|
85
|
+
}, [history, params, openGeneralSidebar, setPreference]);
|
|
107
86
|
const openRevisions = useCallback(async () => {
|
|
108
87
|
await openGlobalStyles();
|
|
109
88
|
// Open the global styles revisions once the canvas mode is set to edit,
|
|
@@ -117,36 +96,19 @@ export default function SidebarNavigationScreenGlobalStyles({
|
|
|
117
96
|
const hasRevisions = revisionsCount > 0;
|
|
118
97
|
const modifiedDateTime = revisions?.[0]?.modified;
|
|
119
98
|
const shouldShowGlobalStylesFooter = hasRevisions && !isLoadingRevisions && modifiedDateTime;
|
|
120
|
-
return /*#__PURE__*/
|
|
121
|
-
children:
|
|
122
|
-
title: __('
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
content: /*#__PURE__*/_jsx(
|
|
99
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
100
|
+
children: /*#__PURE__*/_jsx(SidebarNavigationScreen, {
|
|
101
|
+
title: __('Design'),
|
|
102
|
+
isRoot: true,
|
|
103
|
+
description: __('Customize the appearance of your website using the block editor.'),
|
|
104
|
+
content: /*#__PURE__*/_jsx(MainSidebarNavigationContent, {
|
|
105
|
+
activeItem: "styles-navigation-item"
|
|
106
|
+
}),
|
|
126
107
|
footer: shouldShowGlobalStylesFooter && /*#__PURE__*/_jsx(SidebarNavigationScreenDetailsFooter, {
|
|
127
108
|
record: revisions?.[0],
|
|
128
109
|
onClick: openRevisions
|
|
129
|
-
}),
|
|
130
|
-
actions: /*#__PURE__*/_jsxs(_Fragment, {
|
|
131
|
-
children: [!isMobileViewport && /*#__PURE__*/_jsx(SidebarButton, {
|
|
132
|
-
icon: seen,
|
|
133
|
-
label: __('Style Book'),
|
|
134
|
-
onClick: () => setEditorCanvasContainerView(!isStyleBookOpened ? 'style-book' : undefined),
|
|
135
|
-
isPressed: isStyleBookOpened
|
|
136
|
-
}), /*#__PURE__*/_jsx(SidebarButton, {
|
|
137
|
-
icon: edit,
|
|
138
|
-
label: __('Edit styles'),
|
|
139
|
-
onClick: async () => await openGlobalStyles()
|
|
140
|
-
})]
|
|
141
110
|
})
|
|
142
|
-
})
|
|
143
|
-
enableResizing: false,
|
|
144
|
-
isSelected: () => false,
|
|
145
|
-
onClick: openStyleBook,
|
|
146
|
-
onSelect: openStyleBook,
|
|
147
|
-
showCloseButton: false,
|
|
148
|
-
showTabs: false
|
|
149
|
-
})]
|
|
111
|
+
})
|
|
150
112
|
});
|
|
151
113
|
}
|
|
152
114
|
//# sourceMappingURL=index.js.map
|