@wordpress/edit-site 6.10.0 → 6.11.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 +2 -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 -0
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/use-editor-iframe-props.js +29 -20
- 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 +23 -10
- 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 +2 -2
- 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 +2 -2
- 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 +9 -10
- 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 +7 -0
- 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-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/index.js +22 -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/use-pattern-settings.js +1 -1
- package/build/components/page-patterns/use-pattern-settings.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 +8 -4
- package/build/components/post-edit/index.js.map +1 -1
- package/build/components/post-fields/index.js +6 -52
- package/build/components/post-fields/index.js.map +1 -1
- package/build/components/post-list/index.js +1 -1
- 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-dataviews/default-views.js +2 -5
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- 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 +30 -10
- package/build/components/sidebar-navigation-screen-global-styles/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 +28 -0
- package/build/components/site-editor-routes/styles-edit.js.map +1 -0
- package/build/components/site-editor-routes/styles-view.js +27 -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 +3 -2
- 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 +75 -10
- 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 +46 -3
- package/build/components/style-book/examples.js.map +1 -1
- package/build/components/style-book/index.js +92 -36
- 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 +6 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +46 -30
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +10 -6
- package/build/hooks/commands/use-edit-mode-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/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 -2
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/use-editor-iframe-props.js +30 -21
- 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 +23 -10
- 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 +3 -3
- 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 +2 -2
- 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 +9 -10
- 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 +7 -0
- 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-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/index.js +22 -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/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/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 +8 -4
- package/build-module/components/post-edit/index.js.map +1 -1
- package/build-module/components/post-fields/index.js +7 -51
- package/build-module/components/post-fields/index.js.map +1 -1
- package/build-module/components/post-list/index.js +1 -1
- 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-dataviews/default-views.js +2 -5
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- 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 +30 -10
- package/build-module/components/sidebar-navigation-screen-global-styles/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 +20 -0
- package/build-module/components/site-editor-routes/styles-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/styles-view.js +19 -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 +3 -2
- 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 +74 -9
- 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 +47 -3
- package/build-module/components/style-book/examples.js.map +1 -1
- package/build-module/components/style-book/index.js +94 -38
- 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 +6 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +46 -30
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +10 -6
- package/build-module/hooks/commands/use-edit-mode-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/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 +10 -13
- package/build-style/posts.css +10 -13
- package/build-style/style-rtl.css +127 -26
- package/build-style/style.css +127 -26
- package/package.json +43 -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 -2
- package/src/components/block-editor/use-editor-iframe-props.js +22 -18
- package/src/components/block-editor/use-site-editor-settings.js +12 -10
- package/src/components/editor/index.js +34 -13
- package/src/components/editor/use-adapt-editor-to-canvas.js +53 -0
- package/src/components/editor/use-editor-title.js +3 -3
- 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 +2 -2
- 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 +12 -13
- 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 +11 -0
- 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-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/index.js +16 -34
- 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/use-pattern-settings.js +1 -1
- package/src/components/page-templates/index.js +0 -1
- package/src/components/pagination/index.js +1 -1
- package/src/components/post-edit/index.js +35 -4
- package/src/components/post-fields/index.js +7 -54
- package/src/components/post-fields/style.scss +3 -0
- package/src/components/post-list/index.js +1 -1
- package/src/components/post-list/style.scss +1 -1
- 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-dataviews/default-views.js +2 -5
- package/src/components/sidebar-navigation-screen/index.js +2 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +47 -29
- 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 +17 -0
- package/src/components/site-editor-routes/styles-view.js +16 -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 +2 -2
- package/src/components/site-hub/style.scss +4 -0
- package/src/components/style-book/color-examples.tsx +44 -0
- package/src/components/style-book/constants.ts +83 -10
- package/src/components/style-book/duotone-examples.tsx +53 -0
- package/src/components/style-book/examples.tsx +113 -0
- package/src/components/style-book/index.js +149 -52
- 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 +11 -1
- package/src/hooks/commands/use-common-commands.js +60 -40
- package/src/hooks/commands/use-edit-mode-commands.js +14 -18
- package/src/hooks/commands/use-set-command-context.js +7 -9
- 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 -0
- 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-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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["privateApis","routerPrivateApis","useSelect","store","coreStore","unlock","Editor","SidebarNavigationScreen","SidebarNavigationScreenMain","DataViewsSidebarContent","PostList","jsx","_jsx","useLocation","
|
|
1
|
+
{"version":3,"names":["privateApis","routerPrivateApis","useSelect","store","coreStore","unlock","Editor","SidebarNavigationScreen","SidebarNavigationScreenMain","DataViewsSidebarContent","PostList","jsx","_jsx","useLocation","useActiveRoute","params","postType","layout","canvas","labels","select","getPostType","includes","isListLayout","name","areas","sidebar","title","isRoot","content","preview","isPostsList","mobile","widths","undefined"],"sources":["@wordpress/edit-site/src/components/posts-app/router.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport Editor from '../editor';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\nimport PostList from '../post-list';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function useActiveRoute() {\n\tconst { params = {} } = useLocation();\n\tconst { postType, layout, canvas } = params;\n\tconst labels = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).getPostType( postType )?.labels;\n\t\t},\n\t\t[ postType ]\n\t);\n\n\t// Posts list.\n\tif ( [ 'post' ].includes( postType ) ) {\n\t\tconst isListLayout = layout === 'list' || ! layout;\n\t\treturn {\n\t\t\tname: 'posts-list',\n\t\t\tareas: {\n\t\t\t\tsidebar: (\n\t\t\t\t\t<SidebarNavigationScreen\n\t\t\t\t\t\ttitle={ labels?.name }\n\t\t\t\t\t\tisRoot\n\t\t\t\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\tcontent: <PostList postType={ postType } />,\n\t\t\t\tpreview: ( isListLayout || canvas === 'edit' ) && (\n\t\t\t\t\t<Editor isPostsList />\n\t\t\t\t),\n\t\t\t\tmobile:\n\t\t\t\t\tcanvas === 'edit' ? (\n\t\t\t\t\t\t<Editor isPostsList />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<PostList postType={ postType } />\n\t\t\t\t\t),\n\t\t\t},\n\t\t\twidths: {\n\t\t\t\tcontent: isListLayout ? 380 : undefined,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Fallback shows the home page preview\n\treturn {\n\t\tname: 'default',\n\t\tareas: {\n\t\t\tsidebar: <SidebarNavigationScreenMain />,\n\t\t\tpreview: <Editor isPostsList />,\n\t\t\tmobile: canvas === 'edit' && <Editor isPostsList />,\n\t\t},\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,2BAA2B,MAAM,mCAAmC;AAC3E,OAAOC,uBAAuB,MAAM,sBAAsB;AAC1D,OAAOC,QAAQ,MAAM,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEpC,MAAM;EAAEC;AAAY,CAAC,GAAGR,MAAM,CAAEJ,iBAAkB,CAAC;AAEnD,eAAe,SAASa,cAAcA,CAAA,EAAG;EACxC,MAAM;IAAEC,MAAM,GAAG,CAAC;EAAE,CAAC,GAAGF,WAAW,CAAC,CAAC;EACrC,MAAM;IAAEG,QAAQ;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGH,MAAM;EAC3C,MAAMI,MAAM,GAAGjB,SAAS,CACrBkB,MAAM,IAAM;IACb,OAAOA,MAAM,CAAEhB,SAAU,CAAC,CAACiB,WAAW,CAAEL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9
|
import { useState, useRef } from '@wordpress/element';
|
|
10
10
|
import { ResizableBox, Tooltip, __unstableMotion as motion } from '@wordpress/components';
|
|
11
11
|
import { useInstanceId, useReducedMotion } from '@wordpress/compose';
|
|
12
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
13
12
|
import { __, isRTL } from '@wordpress/i18n';
|
|
13
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
18
|
import { unlock } from '../../lock-unlock';
|
|
19
|
-
import {
|
|
19
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
const {
|
|
21
|
+
useLocation,
|
|
22
|
+
useHistory
|
|
23
|
+
} = unlock(routerPrivateApis);
|
|
20
24
|
|
|
21
25
|
// Removes the inline styles in the drag handles.
|
|
22
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
26
|
const HANDLE_STYLES_OVERRIDE = {
|
|
24
27
|
position: undefined,
|
|
25
28
|
userSelect: undefined,
|
|
@@ -70,6 +73,13 @@ function ResizableFrame({
|
|
|
70
73
|
defaultSize,
|
|
71
74
|
innerContentStyle
|
|
72
75
|
}) {
|
|
76
|
+
const history = useHistory();
|
|
77
|
+
const {
|
|
78
|
+
params
|
|
79
|
+
} = useLocation();
|
|
80
|
+
const {
|
|
81
|
+
canvas = 'view'
|
|
82
|
+
} = params;
|
|
73
83
|
const disableMotion = useReducedMotion();
|
|
74
84
|
const [frameSize, setFrameSize] = useState(INITIAL_FRAME_SIZE);
|
|
75
85
|
// The width of the resizable frame when a new resize gesture starts.
|
|
@@ -77,10 +87,6 @@ function ResizableFrame({
|
|
|
77
87
|
const [isResizing, setIsResizing] = useState(false);
|
|
78
88
|
const [shouldShowHandle, setShouldShowHandle] = useState(false);
|
|
79
89
|
const [resizeRatio, setResizeRatio] = useState(1);
|
|
80
|
-
const canvasMode = useSelect(select => unlock(select(editSiteStore)).getCanvasMode(), []);
|
|
81
|
-
const {
|
|
82
|
-
setCanvasMode
|
|
83
|
-
} = unlock(useDispatch(editSiteStore));
|
|
84
90
|
const FRAME_TRANSITION = {
|
|
85
91
|
type: 'tween',
|
|
86
92
|
duration: isResizing ? 0 : 0.5
|
|
@@ -127,7 +133,12 @@ function ResizableFrame({
|
|
|
127
133
|
setFrameSize(INITIAL_FRAME_SIZE);
|
|
128
134
|
} else {
|
|
129
135
|
// Trigger full screen if the frame is resized far enough to the left.
|
|
130
|
-
|
|
136
|
+
history.push({
|
|
137
|
+
...params,
|
|
138
|
+
canvas: 'edit'
|
|
139
|
+
}, undefined, {
|
|
140
|
+
transition: 'canvas-mode-edit-transition'
|
|
141
|
+
});
|
|
131
142
|
}
|
|
132
143
|
};
|
|
133
144
|
|
|
@@ -204,7 +215,7 @@ function ResizableFrame({
|
|
|
204
215
|
});
|
|
205
216
|
}
|
|
206
217
|
},
|
|
207
|
-
whileHover:
|
|
218
|
+
whileHover: canvas === 'view' ? {
|
|
208
219
|
scale: 1.005,
|
|
209
220
|
transition: {
|
|
210
221
|
duration: disableMotion ? 0 : 0.5,
|
|
@@ -243,7 +254,7 @@ function ResizableFrame({
|
|
|
243
254
|
onMouseOver: () => setShouldShowHandle(true),
|
|
244
255
|
onMouseOut: () => setShouldShowHandle(false),
|
|
245
256
|
handleComponent: {
|
|
246
|
-
[isRTL() ? 'right' : 'left']:
|
|
257
|
+
[isRTL() ? 'right' : 'left']: canvas === 'view' && /*#__PURE__*/_jsxs(_Fragment, {
|
|
247
258
|
children: [/*#__PURE__*/_jsx(Tooltip, {
|
|
248
259
|
text: __('Drag to resize'),
|
|
249
260
|
children: /*#__PURE__*/_jsx(motion.button, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useState","useRef","ResizableBox","Tooltip","__unstableMotion","motion","useInstanceId","useReducedMotion","useDispatch","useSelect","__","isRTL","unlock","store","editSiteStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","width","height","top","right","bottom","left","FRAME_MIN_WIDTH","FRAME_REFERENCE_WIDTH","FRAME_TARGET_ASPECT_RATIO","SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD","INITIAL_FRAME_SIZE","calculateNewHeight","initialAspectRatio","lerp","a","b","amount","lerpFactor","Math","max","min","intermediateAspectRatio","ResizableFrame","isFullWidth","isOversized","setIsOversized","isReady","children","defaultSize","innerContentStyle","disableMotion","frameSize","setFrameSize","startingWidth","setStartingWidth","isResizing","setIsResizing","shouldShowHandle","setShouldShowHandle","resizeRatio","setResizeRatio","canvasMode","select","getCanvasMode","setCanvasMode","FRAME_TRANSITION","type","duration","frameRef","resizableHandleHelpId","defaultAspectRatio","handleResizeStart","_event","_direction","ref","offsetWidth","handleResize","_ref","delta","normalizedDelta","deltaAbs","abs","maxDoubledDelta","deltaToDouble","doubleSegment","singleSegment","updatedWidth","handleResizeStop","remainingWidth","ownerDocument","documentElement","handleResizableHandleKeyDown","event","includes","key","preventDefault","step","shiftKey","newWidth","current","resizable","frameAnimationVariants","default","flexGrow","fullWidth","resizeHandleVariants","hidden","opacity","visible","active","scaleY","currentResizeHandleVariant","as","div","initial","variants","animate","onAnimationComplete","definition","whileHover","scale","transition","ease","size","enable","topRight","bottomRight","bottomLeft","topLeft","handleClasses","handleStyles","minWidth","maxWidth","maxHeight","onFocus","onBlur","onMouseOver","onMouseOut","handleComponent","text","button","role","className","onKeyDown","exit","whileFocus","id","onResizeStart","onResize","onResizeStop","showHandle","style"],"sources":["@wordpress/edit-site/src/components/resizable-frame/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport {\n\tResizableBox,\n\tTooltip,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\n// The minimum width of the frame (in px) while resizing.\nconst FRAME_MIN_WIDTH = 320;\n// The reference width of the frame (in px) used to calculate the aspect ratio.\nconst FRAME_REFERENCE_WIDTH = 1300;\n// 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.\nconst FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;\n// The minimum distance (in px) between the frame resize handle and the\n// viewport's edge. If the frame is resized to be closer to the viewport's edge\n// than this distance, then \"canvas mode\" will be enabled.\nconst SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;\n// Default size for the `frameSize` state.\nconst INITIAL_FRAME_SIZE = { width: '100%', height: '100%' };\n\nfunction calculateNewHeight( width, initialAspectRatio ) {\n\tconst lerp = ( a, b, amount ) => {\n\t\treturn a + ( b - a ) * amount;\n\t};\n\n\t// Calculate the intermediate aspect ratio based on the current width.\n\tconst lerpFactor =\n\t\t1 -\n\t\tMath.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\t1,\n\t\t\t\t( width - FRAME_MIN_WIDTH ) /\n\t\t\t\t\t( FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH )\n\t\t\t)\n\t\t);\n\n\t// Calculate the height based on the intermediate aspect ratio\n\t// ensuring the frame arrives at the target aspect ratio.\n\tconst intermediateAspectRatio = lerp(\n\t\tinitialAspectRatio,\n\t\tFRAME_TARGET_ASPECT_RATIO,\n\t\tlerpFactor\n\t);\n\n\treturn width / intermediateAspectRatio;\n}\n\nfunction ResizableFrame( {\n\tisFullWidth,\n\tisOversized,\n\tsetIsOversized,\n\tisReady,\n\tchildren,\n\t/** The default (unresized) width/height of the frame, based on the space availalbe in the viewport. */\n\tdefaultSize,\n\tinnerContentStyle,\n} ) {\n\tconst disableMotion = useReducedMotion();\n\tconst [ frameSize, setFrameSize ] = useState( INITIAL_FRAME_SIZE );\n\t// The width of the resizable frame when a new resize gesture starts.\n\tconst [ startingWidth, setStartingWidth ] = useState();\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ shouldShowHandle, setShouldShowHandle ] = useState( false );\n\tconst [ resizeRatio, setResizeRatio ] = useState( 1 );\n\tconst canvasMode = useSelect(\n\t\t( select ) => unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };\n\tconst frameRef = useRef( null );\n\tconst resizableHandleHelpId = useInstanceId(\n\t\tResizableFrame,\n\t\t'edit-site-resizable-frame-handle-help'\n\t);\n\tconst defaultAspectRatio = defaultSize.width / defaultSize.height;\n\n\tconst handleResizeStart = ( _event, _direction, ref ) => {\n\t\t// Remember the starting width so we don't have to get `ref.offsetWidth` on\n\t\t// every resize event thereafter, which will cause layout thrashing.\n\t\tsetStartingWidth( ref.offsetWidth );\n\t\tsetIsResizing( true );\n\t};\n\n\t// Calculate the frame size based on the window width as its resized.\n\tconst handleResize = ( _event, _direction, _ref, delta ) => {\n\t\tconst normalizedDelta = delta.width / resizeRatio;\n\t\tconst deltaAbs = Math.abs( normalizedDelta );\n\t\tconst maxDoubledDelta =\n\t\t\tdelta.width < 0 // is shrinking\n\t\t\t\t? deltaAbs\n\t\t\t\t: ( defaultSize.width - startingWidth ) / 2;\n\t\tconst deltaToDouble = Math.min( deltaAbs, maxDoubledDelta );\n\t\tconst doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;\n\t\tconst singleSegment = 1 - doubleSegment;\n\n\t\tsetResizeRatio( singleSegment + doubleSegment * 2 );\n\n\t\tconst updatedWidth = startingWidth + delta.width;\n\n\t\tsetIsOversized( updatedWidth > defaultSize.width );\n\n\t\t// Width will be controlled by the library (via `resizeRatio`),\n\t\t// so we only need to update the height.\n\t\tsetFrameSize( {\n\t\t\theight: isOversized\n\t\t\t\t? '100%'\n\t\t\t\t: calculateNewHeight( updatedWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst handleResizeStop = ( _event, _direction, ref ) => {\n\t\tsetIsResizing( false );\n\n\t\tif ( ! isOversized ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsOversized( false );\n\n\t\tconst remainingWidth =\n\t\t\tref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;\n\n\t\tif ( remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD ) {\n\t\t\t// Reset the initial aspect ratio if the frame is resized slightly\n\t\t\t// above the sidebar but not far enough to trigger full screen.\n\t\t\tsetFrameSize( INITIAL_FRAME_SIZE );\n\t\t} else {\n\t\t\t// Trigger full screen if the frame is resized far enough to the left.\n\t\t\tsetCanvasMode( 'edit' );\n\t\t}\n\t};\n\n\t// Handle resize by arrow keys\n\tconst handleResizableHandleKeyDown = ( event ) => {\n\t\tif ( ! [ 'ArrowLeft', 'ArrowRight' ].includes( event.key ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tconst step = 20 * ( event.shiftKey ? 5 : 1 );\n\t\tconst delta =\n\t\t\tstep *\n\t\t\t( event.key === 'ArrowLeft' ? 1 : -1 ) *\n\t\t\t( isRTL() ? -1 : 1 );\n\t\tconst newWidth = Math.min(\n\t\t\tMath.max(\n\t\t\t\tFRAME_MIN_WIDTH,\n\t\t\t\tframeRef.current.resizable.offsetWidth + delta\n\t\t\t),\n\t\t\tdefaultSize.width\n\t\t);\n\n\t\tsetFrameSize( {\n\t\t\twidth: newWidth,\n\t\t\theight: calculateNewHeight( newWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst frameAnimationVariants = {\n\t\tdefault: {\n\t\t\tflexGrow: 0,\n\t\t\theight: frameSize.height,\n\t\t},\n\t\tfullWidth: {\n\t\t\tflexGrow: 1,\n\t\t\theight: frameSize.height,\n\t\t},\n\t};\n\n\tconst resizeHandleVariants = {\n\t\thidden: {\n\t\t\topacity: 0,\n\t\t\t...( isRTL() ? { right: 0 } : { left: 0 } ),\n\t\t},\n\t\tvisible: {\n\t\t\topacity: 1,\n\t\t\t// Account for the handle's width.\n\t\t\t...( isRTL() ? { right: -14 } : { left: -14 } ),\n\t\t},\n\t\tactive: {\n\t\t\topacity: 1,\n\t\t\t// Account for the handle's width.\n\t\t\t...( isRTL() ? { right: -14 } : { left: -14 } ),\n\t\t\tscaleY: 1.3,\n\t\t},\n\t};\n\tconst currentResizeHandleVariant = ( () => {\n\t\tif ( isResizing ) {\n\t\t\treturn 'active';\n\t\t}\n\t\treturn shouldShowHandle ? 'visible' : 'hidden';\n\t} )();\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tas={ motion.div }\n\t\t\tref={ frameRef }\n\t\t\tinitial={ false }\n\t\t\tvariants={ frameAnimationVariants }\n\t\t\tanimate={ isFullWidth ? 'fullWidth' : 'default' }\n\t\t\tonAnimationComplete={ ( definition ) => {\n\t\t\t\tif ( definition === 'fullWidth' ) {\n\t\t\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t\t\t}\n\t\t\t} }\n\t\t\twhileHover={\n\t\t\t\tcanvasMode === 'view'\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tscale: 1.005,\n\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.5,\n\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t }\n\t\t\t\t\t: {}\n\t\t\t}\n\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\tsize={ frameSize }\n\t\t\tenable={ {\n\t\t\t\ttop: false,\n\t\t\t\tbottom: false,\n\t\t\t\t// Resizing will be disabled until the editor content is loaded.\n\t\t\t\t...( isRTL()\n\t\t\t\t\t? { right: isReady, left: false }\n\t\t\t\t\t: { left: isReady, right: false } ),\n\t\t\t\ttopRight: false,\n\t\t\t\tbottomRight: false,\n\t\t\t\tbottomLeft: false,\n\t\t\t\ttopLeft: false,\n\t\t\t} }\n\t\t\tresizeRatio={ resizeRatio }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t\tminWidth={ FRAME_MIN_WIDTH }\n\t\t\tmaxWidth={ isFullWidth ? '100%' : '150%' }\n\t\t\tmaxHeight=\"100%\"\n\t\t\tonFocus={ () => setShouldShowHandle( true ) }\n\t\t\tonBlur={ () => setShouldShowHandle( false ) }\n\t\t\tonMouseOver={ () => setShouldShowHandle( true ) }\n\t\t\tonMouseOut={ () => setShouldShowHandle( false ) }\n\t\t\thandleComponent={ {\n\t\t\t\t[ isRTL() ? 'right' : 'left' ]: canvasMode === 'view' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Tooltip text={ __( 'Drag to resize' ) }>\n\t\t\t\t\t\t\t{ /* Disable reason: role=\"separator\" does in fact support aria-valuenow */ }\n\t\t\t\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/role-supports-aria-props */ }\n\t\t\t\t\t\t\t<motion.button\n\t\t\t\t\t\t\t\tkey=\"handle\"\n\t\t\t\t\t\t\t\trole=\"separator\"\n\t\t\t\t\t\t\t\taria-orientation=\"vertical\"\n\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t'edit-site-resizable-frame__handle',\n\t\t\t\t\t\t\t\t\t{ 'is-resizing': isResizing }\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tvariants={ resizeHandleVariants }\n\t\t\t\t\t\t\t\tanimate={ currentResizeHandleVariant }\n\t\t\t\t\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\t\t\t\t\taria-describedby={ resizableHandleHelpId }\n\t\t\t\t\t\t\t\taria-valuenow={\n\t\t\t\t\t\t\t\t\tframeRef.current?.resizable?.offsetWidth ||\n\t\t\t\t\t\t\t\t\tundefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-valuemin={ FRAME_MIN_WIDTH }\n\t\t\t\t\t\t\t\taria-valuemax={ defaultSize.width }\n\t\t\t\t\t\t\t\tonKeyDown={ handleResizableHandleKeyDown }\n\t\t\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\t\t\texit=\"hidden\"\n\t\t\t\t\t\t\t\twhileFocus=\"active\"\n\t\t\t\t\t\t\t\twhileHover=\"active\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t<div hidden id={ resizableHandleHelpId }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t} }\n\t\t\tonResizeStart={ handleResizeStart }\n\t\t\tonResize={ handleResize }\n\t\t\tonResizeStop={ handleResizeStop }\n\t\t\tclassName={ clsx( 'edit-site-resizable-frame__inner', {\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t} ) }\n\t\t\tshowHandle={ false } // Do not show the default handle, as we're using a custom one.\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-resizable-frame__inner-content\"\n\t\t\t\tstyle={ innerContentStyle }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableFrame;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAA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E8D;IAChB,CAAE,CAAG;IACL+F,UAAU,EAAG,KAAO,CAAC;IAAA;IAAAvG,QAAA,eAErBrC,IAAA;MACCoI,SAAS,EAAC,0CAA0C;MACpDS,KAAK,EAAGtG,iBAAmB;MAAAF,QAAA,EAEzBA;IAAQ,CACN;EAAC,CACO,CAAC;AAEjB;AAEA,eAAeL,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","useState","useRef","ResizableBox","Tooltip","__unstableMotion","motion","useInstanceId","useReducedMotion","__","isRTL","privateApis","routerPrivateApis","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useLocation","useHistory","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","width","height","top","right","bottom","left","FRAME_MIN_WIDTH","FRAME_REFERENCE_WIDTH","FRAME_TARGET_ASPECT_RATIO","SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD","INITIAL_FRAME_SIZE","calculateNewHeight","initialAspectRatio","lerp","a","b","amount","lerpFactor","Math","max","min","intermediateAspectRatio","ResizableFrame","isFullWidth","isOversized","setIsOversized","isReady","children","defaultSize","innerContentStyle","history","params","canvas","disableMotion","frameSize","setFrameSize","startingWidth","setStartingWidth","isResizing","setIsResizing","shouldShowHandle","setShouldShowHandle","resizeRatio","setResizeRatio","FRAME_TRANSITION","type","duration","frameRef","resizableHandleHelpId","defaultAspectRatio","handleResizeStart","_event","_direction","ref","offsetWidth","handleResize","_ref","delta","normalizedDelta","deltaAbs","abs","maxDoubledDelta","deltaToDouble","doubleSegment","singleSegment","updatedWidth","handleResizeStop","remainingWidth","ownerDocument","documentElement","push","transition","handleResizableHandleKeyDown","event","includes","key","preventDefault","step","shiftKey","newWidth","current","resizable","frameAnimationVariants","default","flexGrow","fullWidth","resizeHandleVariants","hidden","opacity","visible","active","scaleY","currentResizeHandleVariant","as","div","initial","variants","animate","onAnimationComplete","definition","whileHover","scale","ease","size","enable","topRight","bottomRight","bottomLeft","topLeft","handleClasses","handleStyles","minWidth","maxWidth","maxHeight","onFocus","onBlur","onMouseOver","onMouseOut","handleComponent","text","button","role","className","onKeyDown","exit","whileFocus","id","onResizeStart","onResize","onResizeStop","showHandle","style"],"sources":["@wordpress/edit-site/src/components/resizable-frame/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport {\n\tResizableBox,\n\tTooltip,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\n// The minimum width of the frame (in px) while resizing.\nconst FRAME_MIN_WIDTH = 320;\n// The reference width of the frame (in px) used to calculate the aspect ratio.\nconst FRAME_REFERENCE_WIDTH = 1300;\n// 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.\nconst FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;\n// The minimum distance (in px) between the frame resize handle and the\n// viewport's edge. If the frame is resized to be closer to the viewport's edge\n// than this distance, then \"canvas mode\" will be enabled.\nconst SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;\n// Default size for the `frameSize` state.\nconst INITIAL_FRAME_SIZE = { width: '100%', height: '100%' };\n\nfunction calculateNewHeight( width, initialAspectRatio ) {\n\tconst lerp = ( a, b, amount ) => {\n\t\treturn a + ( b - a ) * amount;\n\t};\n\n\t// Calculate the intermediate aspect ratio based on the current width.\n\tconst lerpFactor =\n\t\t1 -\n\t\tMath.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\t1,\n\t\t\t\t( width - FRAME_MIN_WIDTH ) /\n\t\t\t\t\t( FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH )\n\t\t\t)\n\t\t);\n\n\t// Calculate the height based on the intermediate aspect ratio\n\t// ensuring the frame arrives at the target aspect ratio.\n\tconst intermediateAspectRatio = lerp(\n\t\tinitialAspectRatio,\n\t\tFRAME_TARGET_ASPECT_RATIO,\n\t\tlerpFactor\n\t);\n\n\treturn width / intermediateAspectRatio;\n}\n\nfunction ResizableFrame( {\n\tisFullWidth,\n\tisOversized,\n\tsetIsOversized,\n\tisReady,\n\tchildren,\n\t/** The default (unresized) width/height of the frame, based on the space availalbe in the viewport. */\n\tdefaultSize,\n\tinnerContentStyle,\n} ) {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst { canvas = 'view' } = params;\n\tconst disableMotion = useReducedMotion();\n\tconst [ frameSize, setFrameSize ] = useState( INITIAL_FRAME_SIZE );\n\t// The width of the resizable frame when a new resize gesture starts.\n\tconst [ startingWidth, setStartingWidth ] = useState();\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ shouldShowHandle, setShouldShowHandle ] = useState( false );\n\tconst [ resizeRatio, setResizeRatio ] = useState( 1 );\n\n\tconst FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };\n\tconst frameRef = useRef( null );\n\tconst resizableHandleHelpId = useInstanceId(\n\t\tResizableFrame,\n\t\t'edit-site-resizable-frame-handle-help'\n\t);\n\tconst defaultAspectRatio = defaultSize.width / defaultSize.height;\n\n\tconst handleResizeStart = ( _event, _direction, ref ) => {\n\t\t// Remember the starting width so we don't have to get `ref.offsetWidth` on\n\t\t// every resize event thereafter, which will cause layout thrashing.\n\t\tsetStartingWidth( ref.offsetWidth );\n\t\tsetIsResizing( true );\n\t};\n\n\t// Calculate the frame size based on the window width as its resized.\n\tconst handleResize = ( _event, _direction, _ref, delta ) => {\n\t\tconst normalizedDelta = delta.width / resizeRatio;\n\t\tconst deltaAbs = Math.abs( normalizedDelta );\n\t\tconst maxDoubledDelta =\n\t\t\tdelta.width < 0 // is shrinking\n\t\t\t\t? deltaAbs\n\t\t\t\t: ( defaultSize.width - startingWidth ) / 2;\n\t\tconst deltaToDouble = Math.min( deltaAbs, maxDoubledDelta );\n\t\tconst doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;\n\t\tconst singleSegment = 1 - doubleSegment;\n\n\t\tsetResizeRatio( singleSegment + doubleSegment * 2 );\n\n\t\tconst updatedWidth = startingWidth + delta.width;\n\n\t\tsetIsOversized( updatedWidth > defaultSize.width );\n\n\t\t// Width will be controlled by the library (via `resizeRatio`),\n\t\t// so we only need to update the height.\n\t\tsetFrameSize( {\n\t\t\theight: isOversized\n\t\t\t\t? '100%'\n\t\t\t\t: calculateNewHeight( updatedWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst handleResizeStop = ( _event, _direction, ref ) => {\n\t\tsetIsResizing( false );\n\n\t\tif ( ! isOversized ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsOversized( false );\n\n\t\tconst remainingWidth =\n\t\t\tref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;\n\n\t\tif ( remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD ) {\n\t\t\t// Reset the initial aspect ratio if the frame is resized slightly\n\t\t\t// above the sidebar but not far enough to trigger full screen.\n\t\t\tsetFrameSize( INITIAL_FRAME_SIZE );\n\t\t} else {\n\t\t\t// Trigger full screen if the frame is resized far enough to the left.\n\t\t\thistory.push(\n\t\t\t\t{\n\t\t\t\t\t...params,\n\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t},\n\t\t\t\tundefined,\n\t\t\t\t{\n\t\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\t// Handle resize by arrow keys\n\tconst handleResizableHandleKeyDown = ( event ) => {\n\t\tif ( ! [ 'ArrowLeft', 'ArrowRight' ].includes( event.key ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tconst step = 20 * ( event.shiftKey ? 5 : 1 );\n\t\tconst delta =\n\t\t\tstep *\n\t\t\t( event.key === 'ArrowLeft' ? 1 : -1 ) *\n\t\t\t( isRTL() ? -1 : 1 );\n\t\tconst newWidth = Math.min(\n\t\t\tMath.max(\n\t\t\t\tFRAME_MIN_WIDTH,\n\t\t\t\tframeRef.current.resizable.offsetWidth + delta\n\t\t\t),\n\t\t\tdefaultSize.width\n\t\t);\n\n\t\tsetFrameSize( {\n\t\t\twidth: newWidth,\n\t\t\theight: calculateNewHeight( newWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst frameAnimationVariants = {\n\t\tdefault: {\n\t\t\tflexGrow: 0,\n\t\t\theight: frameSize.height,\n\t\t},\n\t\tfullWidth: {\n\t\t\tflexGrow: 1,\n\t\t\theight: frameSize.height,\n\t\t},\n\t};\n\n\tconst resizeHandleVariants = {\n\t\thidden: {\n\t\t\topacity: 0,\n\t\t\t...( isRTL() ? { right: 0 } : { left: 0 } ),\n\t\t},\n\t\tvisible: {\n\t\t\topacity: 1,\n\t\t\t// Account for the handle's width.\n\t\t\t...( isRTL() ? { right: -14 } : { left: -14 } ),\n\t\t},\n\t\tactive: {\n\t\t\topacity: 1,\n\t\t\t// Account for the handle's width.\n\t\t\t...( isRTL() ? { right: -14 } : { left: -14 } ),\n\t\t\tscaleY: 1.3,\n\t\t},\n\t};\n\tconst currentResizeHandleVariant = ( () => {\n\t\tif ( isResizing ) {\n\t\t\treturn 'active';\n\t\t}\n\t\treturn shouldShowHandle ? 'visible' : 'hidden';\n\t} )();\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tas={ motion.div }\n\t\t\tref={ frameRef }\n\t\t\tinitial={ false }\n\t\t\tvariants={ frameAnimationVariants }\n\t\t\tanimate={ isFullWidth ? 'fullWidth' : 'default' }\n\t\t\tonAnimationComplete={ ( definition ) => {\n\t\t\t\tif ( definition === 'fullWidth' ) {\n\t\t\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t\t\t}\n\t\t\t} }\n\t\t\twhileHover={\n\t\t\t\tcanvas === 'view'\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tscale: 1.005,\n\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.5,\n\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t }\n\t\t\t\t\t: {}\n\t\t\t}\n\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\tsize={ frameSize }\n\t\t\tenable={ {\n\t\t\t\ttop: false,\n\t\t\t\tbottom: false,\n\t\t\t\t// Resizing will be disabled until the editor content is loaded.\n\t\t\t\t...( isRTL()\n\t\t\t\t\t? { right: isReady, left: false }\n\t\t\t\t\t: { left: isReady, right: false } ),\n\t\t\t\ttopRight: false,\n\t\t\t\tbottomRight: false,\n\t\t\t\tbottomLeft: false,\n\t\t\t\ttopLeft: false,\n\t\t\t} }\n\t\t\tresizeRatio={ resizeRatio }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t\tminWidth={ FRAME_MIN_WIDTH }\n\t\t\tmaxWidth={ isFullWidth ? '100%' : '150%' }\n\t\t\tmaxHeight=\"100%\"\n\t\t\tonFocus={ () => setShouldShowHandle( true ) }\n\t\t\tonBlur={ () => setShouldShowHandle( false ) }\n\t\t\tonMouseOver={ () => setShouldShowHandle( true ) }\n\t\t\tonMouseOut={ () => setShouldShowHandle( false ) }\n\t\t\thandleComponent={ {\n\t\t\t\t[ isRTL() ? 'right' : 'left' ]: canvas === 'view' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Tooltip text={ __( 'Drag to resize' ) }>\n\t\t\t\t\t\t\t{ /* Disable reason: role=\"separator\" does in fact support aria-valuenow */ }\n\t\t\t\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/role-supports-aria-props */ }\n\t\t\t\t\t\t\t<motion.button\n\t\t\t\t\t\t\t\tkey=\"handle\"\n\t\t\t\t\t\t\t\trole=\"separator\"\n\t\t\t\t\t\t\t\taria-orientation=\"vertical\"\n\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t'edit-site-resizable-frame__handle',\n\t\t\t\t\t\t\t\t\t{ 'is-resizing': isResizing }\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tvariants={ resizeHandleVariants }\n\t\t\t\t\t\t\t\tanimate={ currentResizeHandleVariant }\n\t\t\t\t\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\t\t\t\t\taria-describedby={ resizableHandleHelpId }\n\t\t\t\t\t\t\t\taria-valuenow={\n\t\t\t\t\t\t\t\t\tframeRef.current?.resizable?.offsetWidth ||\n\t\t\t\t\t\t\t\t\tundefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-valuemin={ FRAME_MIN_WIDTH }\n\t\t\t\t\t\t\t\taria-valuemax={ defaultSize.width }\n\t\t\t\t\t\t\t\tonKeyDown={ handleResizableHandleKeyDown }\n\t\t\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\t\t\texit=\"hidden\"\n\t\t\t\t\t\t\t\twhileFocus=\"active\"\n\t\t\t\t\t\t\t\twhileHover=\"active\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t<div hidden id={ resizableHandleHelpId }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t} }\n\t\t\tonResizeStart={ handleResizeStart }\n\t\t\tonResize={ handleResize }\n\t\t\tonResizeStop={ handleResizeStop }\n\t\t\tclassName={ clsx( 'edit-site-resizable-frame__inner', {\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t} ) }\n\t\t\tshowHandle={ false } // Do not show the default handle, as we're using a custom one.\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-resizable-frame__inner-content\"\n\t\t\t\tstyle={ innerContentStyle }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableFrame;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD,SACCC,YAAY,EACZC,OAAO,EACPC,gBAAgB,IAAIC,MAAM,QACpB,uBAAuB;AAC9B,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,oBAAoB;AACpE,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAE3C,MAAM;EAAEC,WAAW;EAAEC;AAAW,CAAC,GAAGR,MAAM,CAAED,iBAAkB,CAAC;;AAE/D;AACA,MAAMU,sBAAsB,GAAG;EAC9BC,QAAQ,EAAEC,SAAS;EACnBC,UAAU,EAAED,SAAS;EACrBE,MAAM,EAAEF,SAAS;EACjBG,KAAK,EAAEH,SAAS;EAChBI,MAAM,EAAEJ,SAAS;EACjBK,GAAG,EAAEL,SAAS;EACdM,KAAK,EAAEN,SAAS;EAChBO,MAAM,EAAEP,SAAS;EACjBQ,IAAI,EAAER;AACP,CAAC;;AA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AW,CAAC5B,KAAO;YACnC2H,SAAS,EAAGnD,4BAA8B;YAC1CuB,OAAO,EAAC,QAAQ;YAChB6B,IAAI,EAAC,QAAQ;YACbC,UAAU,EAAC,QAAQ;YACnBzB,UAAU,EAAC;UAAQ,GArBf,QAsBJ;QAAC,CACM,CAAC,eACVhH,IAAA;UAAKmG,MAAM;UAACuC,EAAE,EAAG9E,qBAAuB;UAAArB,QAAA,EACrC7C,EAAE,CACH,gGACD;QAAC,CACG,CAAC;MAAA,CACL;IAEJ,CAAG;IACHiJ,aAAa,EAAG7E,iBAAmB;IACnC8E,QAAQ,EAAGzE,YAAc;IACzB0E,YAAY,EAAG/D,gBAAkB;IACjCwD,SAAS,EAAGrJ,IAAI,CAAE,kCAAkC,EAAE;MACrD,aAAa,EAAEiE;IAChB,CAAE,CAAG;IACL4F,UAAU,EAAG,KAAO,CAAC;IAAA;IAAAvG,QAAA,eAErBvC,IAAA;MACCsI,SAAS,EAAC,0CAA0C;MACpDS,KAAK,EAAGtG,iBAAmB;MAAAF,QAAA,EAEzBA;IAAQ,CACN;EAAC,CACO,CAAC;AAEjB;AAEA,eAAeL,cAAc","ignoreList":[]}
|
|
@@ -44,7 +44,7 @@ function Revisions({
|
|
|
44
44
|
const originalSettings = useSelect(select => select(blockEditorStore).getSettings(), []);
|
|
45
45
|
const settings = useMemo(() => ({
|
|
46
46
|
...originalSettings,
|
|
47
|
-
|
|
47
|
+
isPreviewMode: true
|
|
48
48
|
}), [originalSettings]);
|
|
49
49
|
const [globalStyles] = useGlobalStylesOutputWithConfig(mergedConfig);
|
|
50
50
|
const editorStyles = !isObjectEmpty(globalStyles) && !isObjectEmpty(userConfig) ? globalStyles : settings.styles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Disabled","__","BlockList","privateApis","blockEditorPrivateApis","store","blockEditorStore","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","editorPrivateApis","useSelect","useContext","useMemo","unlock","EditorCanvasContainer","jsx","_jsx","jsxs","_jsxs","ExperimentalBlockEditorProvider","GlobalStylesContext","useGlobalStylesOutputWithConfig","__unstableBlockStyleVariationOverridesWithConfig","mergeBaseAndUserConfigs","isObjectEmpty","object","Object","keys","length","Revisions","userConfig","blocks","base","baseConfig","mergedConfig","renderedBlocksArray","Array","isArray","originalSettings","select","getSettings","settings","
|
|
1
|
+
{"version":3,"names":["Disabled","__","BlockList","privateApis","blockEditorPrivateApis","store","blockEditorStore","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","editorPrivateApis","useSelect","useContext","useMemo","unlock","EditorCanvasContainer","jsx","_jsx","jsxs","_jsxs","ExperimentalBlockEditorProvider","GlobalStylesContext","useGlobalStylesOutputWithConfig","__unstableBlockStyleVariationOverridesWithConfig","mergeBaseAndUserConfigs","isObjectEmpty","object","Object","keys","length","Revisions","userConfig","blocks","base","baseConfig","mergedConfig","renderedBlocksArray","Array","isArray","originalSettings","select","getSettings","settings","isPreviewMode","globalStyles","editorStyles","styles","title","closeButtonLabel","enableResizing","children","className","name","tabIndex","value","renderAppender","config"],"sources":["@wordpress/edit-site/src/components/revisions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Disabled } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockList,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n} from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\nimport { unlock } from '../../lock-unlock';\nimport EditorCanvasContainer from '../editor-canvas-container';\n\nconst {\n\tExperimentalBlockEditorProvider,\n\tGlobalStylesContext,\n\tuseGlobalStylesOutputWithConfig,\n\t__unstableBlockStyleVariationOverridesWithConfig,\n} = unlock( blockEditorPrivateApis );\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\nfunction Revisions( { userConfig, blocks } ) {\n\tconst { base: baseConfig } = useContext( GlobalStylesContext );\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! isObjectEmpty( userConfig ) && ! isObjectEmpty( baseConfig ) ) {\n\t\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t\t}\n\t\treturn {};\n\t}, [ baseConfig, userConfig ] );\n\n\tconst renderedBlocksArray = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\n\tconst [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );\n\n\tconst editorStyles =\n\t\t! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig )\n\t\t\t? globalStyles\n\t\t\t: settings.styles;\n\n\treturn (\n\t\t<EditorCanvasContainer\n\t\t\ttitle={ __( 'Revisions' ) }\n\t\t\tcloseButtonLabel={ __( 'Close revisions' ) }\n\t\t\tenableResizing\n\t\t>\n\t\t\t<Iframe\n\t\t\t\tclassName=\"edit-site-revisions__iframe\"\n\t\t\t\tname=\"revisions\"\n\t\t\t\ttabIndex={ 0 }\n\t\t\t>\n\t\t\t\t<style>\n\t\t\t\t\t{\n\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t`.is-root-container { display: flow-root; }`\n\t\t\t\t\t}\n\t\t\t\t</style>\n\t\t\t\t<Disabled className=\"edit-site-revisions__example-preview__content\">\n\t\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\t\tvalue={ renderedBlocksArray }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockList renderAppender={ false } />\n\t\t\t\t\t\t{ /*\n\t\t\t\t\t\t * Styles are printed inside the block editor provider,\n\t\t\t\t\t\t * so they can access any registered style overrides.\n\t\t\t\t\t\t */ }\n\t\t\t\t\t\t<EditorStyles styles={ editorStyles } />\n\t\t\t\t\t\t<__unstableBlockStyleVariationOverridesWithConfig\n\t\t\t\t\t\t\tconfig={ mergedConfig }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t</Disabled>\n\t\t\t</Iframe>\n\t\t</EditorCanvasContainer>\n\t);\n}\n\nexport default Revisions;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,SAAS,EACTC,WAAW,IAAIC,sBAAsB,EACrCC,KAAK,IAAIC,gBAAgB,EACzBC,sBAAsB,IAAIC,YAAY,EACtCC,gBAAgB,IAAIC,MAAM,QACpB,yBAAyB;AAChC,SAASP,WAAW,IAAIQ,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;;AAExD;AACA;AACA;;AAEA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,qBAAqB,MAAM,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE/D,MAAM;EACLC,+BAA+B;EAC/BC,mBAAmB;EACnBC,+BAA+B;EAC/BC;AACD,CAAC,GAAGT,MAAM,CAAEX,sBAAuB,CAAC;AACpC,MAAM;EAAEqB;AAAwB,CAAC,GAAGV,MAAM,CAAEJ,iBAAkB,CAAC;AAE/D,SAASe,aAAaA,CAAEC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WAAY,CAAG;IAC3BgD,gBAAgB,EAAGhD,EAAE,CAAE,iBAAkB,CAAG;IAC5CiD,cAAc;IAAAC,QAAA,eAEd/B,KAAA,CAACV,MAAM;MACN0C,SAAS,EAAC,6BAA6B;MACvCC,IAAI,EAAC,WAAW;MAChBC,QAAQ,EAAG,CAAG;MAAAH,QAAA,gBAEdjC,IAAA;QAAAiC,QAAA;QAEE;QACA;QACA;MAA4C,CAEvC,CAAC,eACRjC,IAAA,CAAClB,QAAQ;QAACoD,SAAS,EAAC,+CAA+C;QAAAD,QAAA,eAClE/B,KAAA,CAACC,+BAA+B;UAC/BkC,KAAK,EAAGlB,mBAAqB;UAC7BM,QAAQ,EAAGA,QAAU;UAAAQ,QAAA,gBAErBjC,IAAA,CAAChB,SAAS;YAACsD,cAAc,EAAG;UAAO,CAAE,CAAC,eAKtCtC,IAAA,CAACV,YAAY;YAACuC,MAAM,EAAGD;UAAc,CAAE,CAAC,eACxC5B,IAAA,CAACM,gDAAgD;YAChDiC,MAAM,EAAGrB;UAAc,CACvB,CAAC;QAAA,CAC8B;MAAC,CACzB,CAAC;IAAA,CACJ;EAAC,CACa,CAAC;AAE1B;AAEA,eAAeL,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useEffect } from '@wordpress/element';
|
|
5
|
+
import { useShortcut, store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
9
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import { store as editSiteStore } from '../../store';
|
|
15
|
+
const shortcutName = 'core/edit-site/save';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Register the save keyboard shortcut in view mode.
|
|
19
|
+
*
|
|
20
|
+
* @return {null} Returns null.
|
|
21
|
+
*/
|
|
22
|
+
export default function SaveKeyboardShortcut() {
|
|
23
|
+
const {
|
|
24
|
+
__experimentalGetDirtyEntityRecords,
|
|
25
|
+
isSavingEntityRecord
|
|
26
|
+
} = useSelect(coreStore);
|
|
27
|
+
const {
|
|
28
|
+
hasNonPostEntityChanges,
|
|
29
|
+
isPostSavingLocked
|
|
30
|
+
} = useSelect(editorStore);
|
|
31
|
+
const {
|
|
32
|
+
savePost
|
|
33
|
+
} = useDispatch(editorStore);
|
|
34
|
+
const {
|
|
35
|
+
setIsSaveViewOpened
|
|
36
|
+
} = useDispatch(editSiteStore);
|
|
37
|
+
const {
|
|
38
|
+
registerShortcut,
|
|
39
|
+
unregisterShortcut
|
|
40
|
+
} = useDispatch(keyboardShortcutsStore);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
registerShortcut({
|
|
43
|
+
name: shortcutName,
|
|
44
|
+
category: 'global',
|
|
45
|
+
description: __('Save your changes.'),
|
|
46
|
+
keyCombination: {
|
|
47
|
+
modifier: 'primary',
|
|
48
|
+
character: 's'
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return () => {
|
|
52
|
+
unregisterShortcut(shortcutName);
|
|
53
|
+
};
|
|
54
|
+
}, [registerShortcut, unregisterShortcut]);
|
|
55
|
+
useShortcut('core/edit-site/save', event => {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
|
|
58
|
+
const hasDirtyEntities = !!dirtyEntityRecords.length;
|
|
59
|
+
const isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key));
|
|
60
|
+
if (!hasDirtyEntities || isSaving) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (hasNonPostEntityChanges()) {
|
|
64
|
+
setIsSaveViewOpened(true);
|
|
65
|
+
} else if (!isPostSavingLocked()) {
|
|
66
|
+
savePost();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useShortcut","store","keyboardShortcutsStore","__","useDispatch","useSelect","coreStore","editorStore","editSiteStore","shortcutName","SaveKeyboardShortcut","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","hasNonPostEntityChanges","isPostSavingLocked","savePost","setIsSaveViewOpened","registerShortcut","unregisterShortcut","name","category","description","keyCombination","modifier","character","event","preventDefault","dirtyEntityRecords","hasDirtyEntities","length","isSaving","some","record","kind","key"],"sources":["@wordpress/edit-site/src/components/save-keyboard-shortcut/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nconst shortcutName = 'core/edit-site/save';\n\n/**\n * Register the save keyboard shortcut in view mode.\n *\n * @return {null} Returns null.\n */\nexport default function SaveKeyboardShortcut() {\n\tconst { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } =\n\t\tuseSelect( coreStore );\n\tconst { hasNonPostEntityChanges, isPostSavingLocked } =\n\t\tuseSelect( editorStore );\n\tconst { savePost } = useDispatch( editorStore );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\tconst { registerShortcut, unregisterShortcut } = useDispatch(\n\t\tkeyboardShortcutsStore\n\t);\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: shortcutName,\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\t\treturn () => {\n\t\t\tunregisterShortcut( shortcutName );\n\t\t};\n\t}, [ registerShortcut, unregisterShortcut ] );\n\n\tuseShortcut( 'core/edit-site/save', ( event ) => {\n\t\tevent.preventDefault();\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\tconst hasDirtyEntities = !! dirtyEntityRecords.length;\n\t\tconst isSaving = dirtyEntityRecords.some( ( record ) =>\n\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t);\n\t\tif ( ! hasDirtyEntities || isSaving ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( hasNonPostEntityChanges() ) {\n\t\t\tsetIsSaveViewOpened( true );\n\t\t} else if ( ! isPostSavingLocked() ) {\n\t\t\tsavePost();\n\t\t}\n\t} );\n\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SACCC,WAAW,EACXC,KAAK,IAAIC,sBAAsB,QACzB,+BAA+B;AACtC,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASJ,KAAK,IAAIK,SAAS,QAAQ,sBAAsB;AACzD,SAASL,KAAK,IAAIM,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASN,KAAK,IAAIO,aAAa,QAAQ,aAAa;AAEpD,MAAMC,YAAY,GAAG,qBAAqB;;AAE1C;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAM;IAAEC,mCAAmC;IAAEC;EAAqB,CAAC,GAClEP,SAAS,CAAEC,SAAU,CAAC;EACvB,MAAM;IAAEO,uBAAuB;IAAEC;EAAmB,CAAC,GACpDT,SAAS,CAAEE,WAAY,CAAC;EACzB,MAAM;IAA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edStates, useEntitiesSavedStatesIsDirty, privateApis } from
|
|
|
11
11
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
12
12
|
import { __, sprintf } from '@wordpress/i18n';
|
|
13
13
|
import { store as coreStore } from '@wordpress/core-data';
|
|
14
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
15
|
+
import { useEffect } from '@wordpress/element';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Internal dependencies
|
|
@@ -25,6 +27,9 @@ const {
|
|
|
25
27
|
EntitiesSavedStatesExtensible,
|
|
26
28
|
NavigableRegion
|
|
27
29
|
} = unlock(privateApis);
|
|
30
|
+
const {
|
|
31
|
+
useLocation
|
|
32
|
+
} = unlock(routerPrivateApis);
|
|
28
33
|
const EntitiesSavedStatesForPreview = ({
|
|
29
34
|
onClose
|
|
30
35
|
}) => {
|
|
@@ -39,7 +44,7 @@ const EntitiesSavedStatesForPreview = ({
|
|
|
39
44
|
const currentTheme = useActualCurrentTheme();
|
|
40
45
|
const previewingTheme = useSelect(select => select(coreStore).getCurrentTheme(), []);
|
|
41
46
|
const additionalPrompt = /*#__PURE__*/_jsx("p", {
|
|
42
|
-
children: sprintf(/* translators:
|
|
47
|
+
children: sprintf(/* translators: 1: The name of active theme, 2: The name of theme to be activated. */
|
|
43
48
|
__('Saving your changes will change your active theme from %1$s to %2$s.'), (_currentTheme$name$re = currentTheme?.name?.rendered) !== null && _currentTheme$name$re !== void 0 ? _currentTheme$name$re : '...', (_previewingTheme$name = previewingTheme?.name?.rendered) !== null && _previewingTheme$name !== void 0 ? _previewingTheme$name : '...')
|
|
44
49
|
});
|
|
45
50
|
const activateTheme = useActivateTheme();
|
|
@@ -71,9 +76,14 @@ const _EntitiesSavedStates = ({
|
|
|
71
76
|
});
|
|
72
77
|
};
|
|
73
78
|
export default function SavePanel() {
|
|
79
|
+
const {
|
|
80
|
+
params
|
|
81
|
+
} = useLocation();
|
|
82
|
+
const {
|
|
83
|
+
canvas = 'view'
|
|
84
|
+
} = params;
|
|
74
85
|
const {
|
|
75
86
|
isSaveViewOpen,
|
|
76
|
-
canvasMode,
|
|
77
87
|
isDirty,
|
|
78
88
|
isSaving
|
|
79
89
|
} = useSelect(select => {
|
|
@@ -85,15 +95,13 @@ export default function SavePanel() {
|
|
|
85
95
|
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
|
|
86
96
|
const isActivatingTheme = isResolving('activateTheme');
|
|
87
97
|
const {
|
|
88
|
-
isSaveViewOpened
|
|
89
|
-
getCanvasMode
|
|
98
|
+
isSaveViewOpened
|
|
90
99
|
} = unlock(select(editSiteStore));
|
|
91
100
|
|
|
92
101
|
// The currently selected entity to display.
|
|
93
102
|
// Typically template or template part in the site editor.
|
|
94
103
|
return {
|
|
95
104
|
isSaveViewOpen: isSaveViewOpened(),
|
|
96
|
-
canvasMode: getCanvasMode(),
|
|
97
105
|
isDirty: dirtyEntityRecords.length > 0,
|
|
98
106
|
isSaving: dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key)) || isActivatingTheme
|
|
99
107
|
};
|
|
@@ -102,7 +110,10 @@ export default function SavePanel() {
|
|
|
102
110
|
setIsSaveViewOpened
|
|
103
111
|
} = useDispatch(editSiteStore);
|
|
104
112
|
const onClose = () => setIsSaveViewOpened(false);
|
|
105
|
-
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
setIsSaveViewOpened(false);
|
|
115
|
+
}, [canvas, setIsSaveViewOpened]);
|
|
116
|
+
if (canvas === 'view') {
|
|
106
117
|
return isSaveViewOpen ? /*#__PURE__*/_jsx(Modal, {
|
|
107
118
|
className: "edit-site-save-panel__modal",
|
|
108
119
|
onRequestClose: onClose,
|
|
@@ -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;E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AI;EACT;EACA,MAAM4C,mBAAmB,GAAGpD,iBAAiB,CAAC,CAAC,IAAIa,OAAO;EAC1D,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{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AE,CAChB,0CACD,CAAG;MAAA8B,QAAA,eAEHlB,IAAA,CAAC2B,oBAAoB;QAACpB,OAAO,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":[]}
|
|
@@ -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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,EAAE3B,eAAe;QACzB4B,KAAK,EAAE;MACR,CAAC;IAEH,CAAC,EACD;MACCvB,KAAK,EAAEpB,EAAE,CAAE,SAAU,CAAC;MACtBuC,IAAI,EAAE,SAAS;MACfC,IAAI,EAAElC,OAAO;MACbmC,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,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":[]}
|
|
@@ -89,7 +89,8 @@ export default function SidebarNavigationScreen({
|
|
|
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,GAAGZ,MAAM,CAAEH,iBAAkB,CAAC;AAE/D,eAAe,SAASgB,uBAAuBA,CAAE;EAChDC,MAAM;EACNC,KAAK;EACLC,OAAO;EACPC,IAAI;EACJC,OAAO;EACPC,MAAM;EACNC,WAAW;EACXC,QAAQ,EAAEC;AACX,CAAC,EAAG;EACH,MAAM;IAAEC,aAAa;IAA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M,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,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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