@wordpress/edit-site 5.3.2 → 5.3.4
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 +1 -0
- package/build/components/add-new-template/new-template-part.js +8 -5
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +8 -5
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +3 -3
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +3 -3
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/editor/index.js +25 -23
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +2 -2
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +2 -2
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/custom-css.js +2 -2
- package/build/components/global-styles/custom-css.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +2 -2
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +2 -2
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +2 -2
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/header.js +1 -1
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/hooks.js +2 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +1 -1
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +2 -2
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +2 -2
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +2 -2
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +2 -2
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +2 -2
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +5 -5
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-heading-color.js +2 -2
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +2 -2
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +2 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +2 -2
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +2 -2
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +2 -2
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/shadow-panel.js +2 -2
- package/build/components/global-styles/shadow-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +2 -2
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +2 -2
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/ui.js +3 -10
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +2 -2
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +6 -3
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/layout/index.js +10 -23
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/actions/rename-menu-item.js +1 -1
- package/build/components/list/actions/rename-menu-item.js.map +1 -1
- package/build/components/list/table.js +1 -0
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-inspector/navigation-menu.js +2 -2
- package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build/components/save-panel/index.js +4 -3
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +17 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +28 -7
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +72 -0
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +70 -0
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +32 -82
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +43 -0
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -0
- package/build/components/site-hub/index.js +14 -49
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/index.js +10 -3
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +55 -20
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +3 -3
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js → use-sync-path-with-url.js} +12 -12
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -0
- package/build/components/use-edited-entity-record/index.js +6 -2
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +2 -2
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/{experiments.js → private-apis.js} +3 -3
- package/build/private-apis.js.map +1 -0
- package/build/store/index.js +3 -3
- package/build/store/index.js.map +1 -1
- package/build/utils/get-is-list-page.js +5 -6
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +7 -4
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +7 -4
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +1 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +3 -3
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/editor/index.js +25 -24
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +3 -3
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +3 -3
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +3 -3
- package/build-module/components/global-styles/custom-css.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +3 -3
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +3 -3
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +3 -3
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/header.js +2 -2
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +3 -3
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +2 -2
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +3 -3
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +3 -3
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +3 -3
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +3 -3
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +3 -3
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +5 -5
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-heading-color.js +3 -3
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +3 -3
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +3 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +3 -3
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +3 -3
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +3 -3
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel.js +3 -3
- package/build-module/components/global-styles/shadow-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +3 -3
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +3 -3
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/ui.js +4 -11
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +3 -3
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +6 -3
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/layout/index.js +10 -23
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/actions/rename-menu-item.js +1 -1
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
- package/build-module/components/list/table.js +1 -0
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +3 -3
- package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build-module/components/save-panel/index.js +3 -2
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +14 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +27 -9
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +55 -0
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +53 -0
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +34 -81
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +31 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -0
- package/build-module/components/site-hub/index.js +14 -46
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/index.js +11 -4
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +55 -21
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js → use-sync-path-with-url.js} +11 -11
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -0
- package/build-module/components/use-edited-entity-record/index.js +6 -2
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +3 -3
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/{experiments.js → private-apis.js} +2 -2
- package/build-module/private-apis.js.map +1 -0
- package/build-module/store/index.js +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +5 -6
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-style/style-rtl.css +18 -37
- package/build-style/style.css +18 -37
- package/package.json +20 -20
- package/src/components/add-new-template/new-template-part.js +7 -4
- package/src/components/add-new-template/new-template.js +8 -6
- package/src/components/block-editor/editor-canvas.js +1 -1
- package/src/components/block-editor/index.js +3 -3
- package/src/components/editor/index.js +29 -28
- package/src/components/global-styles/border-panel.js +3 -3
- package/src/components/global-styles/color-palette-panel.js +3 -3
- package/src/components/global-styles/custom-css.js +3 -3
- package/src/components/global-styles/dimensions-panel.js +3 -3
- package/src/components/global-styles/global-styles-provider.js +3 -3
- package/src/components/global-styles/gradients-palette-panel.js +3 -3
- package/src/components/global-styles/header.js +2 -2
- package/src/components/global-styles/hooks.js +3 -3
- package/src/components/global-styles/navigation-button.js +4 -2
- package/src/components/global-styles/palette.js +3 -3
- package/src/components/global-styles/preview.js +3 -3
- package/src/components/global-styles/screen-background-color.js +3 -3
- package/src/components/global-styles/screen-button-color.js +3 -3
- package/src/components/global-styles/screen-colors.js +3 -3
- package/src/components/global-styles/screen-css.js +14 -7
- package/src/components/global-styles/screen-heading-color.js +3 -3
- package/src/components/global-styles/screen-link-color.js +3 -3
- package/src/components/global-styles/screen-root.js +3 -3
- package/src/components/global-styles/screen-style-variations.js +3 -3
- package/src/components/global-styles/screen-text-color.js +3 -3
- package/src/components/global-styles/screen-typography.js +3 -3
- package/src/components/global-styles/shadow-panel.js +3 -3
- package/src/components/global-styles/style.scss +2 -1
- package/src/components/global-styles/typography-panel.js +3 -3
- package/src/components/global-styles/typography-preview.js +3 -3
- package/src/components/global-styles/ui.js +3 -8
- package/src/components/global-styles-renderer/index.js +3 -3
- package/src/components/header-edit-mode/index.js +6 -3
- package/src/components/keyboard-shortcut-help-modal/config.js +1 -1
- package/src/components/layout/index.js +35 -48
- package/src/components/layout/style.scss +11 -23
- package/src/components/list/actions/rename-menu-item.js +1 -1
- package/src/components/list/table.js +4 -0
- package/src/components/navigation-inspector/navigation-menu.js +3 -3
- package/src/components/save-panel/index.js +4 -1
- package/src/components/sidebar/index.js +10 -2
- package/src/components/sidebar-navigation-screen/index.js +27 -11
- package/src/components/sidebar-navigation-screen/style.scss +4 -6
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +52 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +1 -1
- package/src/components/sidebar-navigation-screen-template/index.js +52 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +49 -83
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +31 -0
- package/src/components/site-hub/index.js +67 -122
- package/src/components/site-hub/style.scss +1 -11
- package/src/components/style-book/index.js +11 -7
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +48 -14
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
- package/src/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js → use-sync-path-with-url.js} +10 -10
- package/src/components/use-edited-entity-record/index.js +6 -2
- package/src/hooks/push-changes-to-global-styles/index.js +3 -3
- package/src/{experiments.js → private-apis.js} +1 -1
- package/src/store/index.js +1 -1
- package/src/utils/get-is-list-page.js +5 -5
- package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +0 -1
- package/build/experiments.js.map +0 -1
- package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +0 -1
- package/build-module/experiments.js.map +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
10
|
+
|
|
11
|
+
const config = {
|
|
12
|
+
wp_template: {
|
|
13
|
+
path: '/templates/all',
|
|
14
|
+
title: __( 'All templates' ),
|
|
15
|
+
},
|
|
16
|
+
wp_template_part: {
|
|
17
|
+
path: '/template-parts/all',
|
|
18
|
+
title: __( 'All template parts' ),
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default function SidebarNavigationScreenTemplatesBrowse( {
|
|
23
|
+
postType = 'wp_template',
|
|
24
|
+
} ) {
|
|
25
|
+
return (
|
|
26
|
+
<SidebarNavigationScreen
|
|
27
|
+
path={ config[ postType ].path }
|
|
28
|
+
title={ config[ postType ].title }
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -11,9 +11,8 @@ import {
|
|
|
11
11
|
Button,
|
|
12
12
|
__unstableMotion as motion,
|
|
13
13
|
__experimentalHStack as HStack,
|
|
14
|
-
__experimentalVStack as VStack,
|
|
15
14
|
} from '@wordpress/components';
|
|
16
|
-
import { useReducedMotion
|
|
15
|
+
import { useReducedMotion } from '@wordpress/compose';
|
|
17
16
|
import { __ } from '@wordpress/i18n';
|
|
18
17
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
19
18
|
import { store as coreStore } from '@wordpress/core-data';
|
|
@@ -23,137 +22,83 @@ import { forwardRef } from '@wordpress/element';
|
|
|
23
22
|
* Internal dependencies
|
|
24
23
|
*/
|
|
25
24
|
import { store as editSiteStore } from '../../store';
|
|
26
|
-
import { useLocation } from '../routes';
|
|
27
|
-
import getIsListPage from '../../utils/get-is-list-page';
|
|
28
25
|
import SiteIcon from '../site-icon';
|
|
29
|
-
import
|
|
30
|
-
import { unlock } from '../../experiments';
|
|
26
|
+
import { unlock } from '../../private-apis';
|
|
31
27
|
|
|
32
28
|
const HUB_ANIMATION_DURATION = 0.3;
|
|
33
29
|
|
|
34
|
-
const SiteHub = forwardRef(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const { canvasMode, dashboardLink, entityConfig } = useSelect(
|
|
40
|
-
( select ) => {
|
|
41
|
-
select( editSiteStore ).getEditedPostType();
|
|
42
|
-
const { getCanvasMode, getSettings, getEditedPostType } =
|
|
43
|
-
unlock( select( editSiteStore ) );
|
|
44
|
-
return {
|
|
45
|
-
canvasMode: getCanvasMode(),
|
|
46
|
-
dashboardLink: getSettings().__experimentalDashboardLink,
|
|
47
|
-
entityConfig: select( coreStore ).getEntityConfig(
|
|
48
|
-
'postType',
|
|
49
|
-
getEditedPostType()
|
|
50
|
-
),
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
[]
|
|
30
|
+
const SiteHub = forwardRef( ( props, ref ) => {
|
|
31
|
+
const { canvasMode, dashboardLink } = useSelect( ( select ) => {
|
|
32
|
+
select( editSiteStore ).getEditedPostType();
|
|
33
|
+
const { getCanvasMode, getSettings } = unlock(
|
|
34
|
+
select( editSiteStore )
|
|
54
35
|
);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
36
|
+
return {
|
|
37
|
+
canvasMode: getCanvasMode(),
|
|
38
|
+
dashboardLink: getSettings().__experimentalDashboardLink,
|
|
39
|
+
};
|
|
40
|
+
}, [] );
|
|
41
|
+
const disableMotion = useReducedMotion();
|
|
42
|
+
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
43
|
+
const { clearSelectedBlock } = useDispatch( blockEditorStore );
|
|
44
|
+
const isBackToDashboardButton = canvasMode === 'view';
|
|
45
|
+
const showLabels = canvasMode !== 'edit';
|
|
46
|
+
const siteIconButtonProps = isBackToDashboardButton
|
|
47
|
+
? {
|
|
48
|
+
href: dashboardLink || 'index.php',
|
|
49
|
+
'aria-label': __( 'Go back to the dashboard' ),
|
|
50
|
+
}
|
|
51
|
+
: {
|
|
52
|
+
label: __( 'Open Navigation Sidebar' ),
|
|
53
|
+
onClick: () => {
|
|
54
|
+
clearSelectedBlock();
|
|
55
|
+
setCanvasMode( 'view' );
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
const siteTitle = useSelect(
|
|
59
|
+
( select ) =>
|
|
60
|
+
select( coreStore ).getEntityRecord( 'root', 'site' )?.title,
|
|
61
|
+
[]
|
|
62
|
+
);
|
|
82
63
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
64
|
+
return (
|
|
65
|
+
<motion.div
|
|
66
|
+
ref={ ref }
|
|
67
|
+
{ ...props }
|
|
68
|
+
className={ classnames( 'edit-site-site-hub', props.className ) }
|
|
69
|
+
layout
|
|
70
|
+
transition={ {
|
|
71
|
+
type: 'tween',
|
|
72
|
+
duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
|
|
73
|
+
ease: 'easeOut',
|
|
74
|
+
} }
|
|
75
|
+
>
|
|
76
|
+
<HStack
|
|
77
|
+
justify="flex-start"
|
|
78
|
+
className="edit-site-site-hub__text-content"
|
|
79
|
+
spacing="0"
|
|
97
80
|
>
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
81
|
+
<motion.div
|
|
82
|
+
className="edit-site-site-hub__view-mode-toggle-container"
|
|
83
|
+
layout
|
|
84
|
+
transition={ {
|
|
85
|
+
type: 'tween',
|
|
86
|
+
duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
|
|
87
|
+
ease: 'easeOut',
|
|
88
|
+
} }
|
|
102
89
|
>
|
|
103
|
-
<motion.div
|
|
104
|
-
className="edit-site-site-hub__view-mode-toggle-container"
|
|
105
|
-
layout
|
|
106
|
-
transition={ {
|
|
107
|
-
type: 'tween',
|
|
108
|
-
duration: disableMotion
|
|
109
|
-
? 0
|
|
110
|
-
: HUB_ANIMATION_DURATION,
|
|
111
|
-
ease: 'easeOut',
|
|
112
|
-
} }
|
|
113
|
-
>
|
|
114
|
-
<Button
|
|
115
|
-
{ ...siteIconButtonProps }
|
|
116
|
-
className="edit-site-layout__view-mode-toggle"
|
|
117
|
-
>
|
|
118
|
-
<SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
|
|
119
|
-
</Button>
|
|
120
|
-
</motion.div>
|
|
121
|
-
|
|
122
|
-
{ showLabels && (
|
|
123
|
-
<VStack spacing={ 0 }>
|
|
124
|
-
<div className="edit-site-site-hub__title">
|
|
125
|
-
{ getTitle() }
|
|
126
|
-
</div>
|
|
127
|
-
<div className="edit-site-site-hub__post-type">
|
|
128
|
-
{ entityConfig?.label }
|
|
129
|
-
</div>
|
|
130
|
-
</VStack>
|
|
131
|
-
) }
|
|
132
|
-
</HStack>
|
|
133
|
-
|
|
134
|
-
{ showEditButton && (
|
|
135
90
|
<Button
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
setCanvasMode( 'edit' );
|
|
139
|
-
} }
|
|
140
|
-
variant="primary"
|
|
91
|
+
{ ...siteIconButtonProps }
|
|
92
|
+
className="edit-site-layout__view-mode-toggle"
|
|
141
93
|
>
|
|
142
|
-
|
|
94
|
+
<SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
|
|
143
95
|
</Button>
|
|
144
|
-
|
|
96
|
+
</motion.div>
|
|
145
97
|
|
|
146
|
-
{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
{ __( 'View Editor' ) }
|
|
152
|
-
</Button>
|
|
153
|
-
) }
|
|
154
|
-
</motion.div>
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
);
|
|
98
|
+
{ showLabels && <div>{ siteTitle }</div> }
|
|
99
|
+
</HStack>
|
|
100
|
+
</motion.div>
|
|
101
|
+
);
|
|
102
|
+
} );
|
|
158
103
|
|
|
159
104
|
export default SiteHub;
|
|
@@ -5,11 +5,6 @@
|
|
|
5
5
|
gap: $grid-unit-10;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.edit-site-site-hub__edit-button {
|
|
9
|
-
height: $grid-unit-40;
|
|
10
|
-
color: $white;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
8
|
.edit-site-site-hub__post-type {
|
|
14
9
|
opacity: 0.6;
|
|
15
10
|
}
|
|
@@ -18,12 +13,7 @@
|
|
|
18
13
|
height: $header-height;
|
|
19
14
|
width: $header-height + 4px;
|
|
20
15
|
flex-shrink: 0;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.edit-site-layout.is-edit-mode {
|
|
24
|
-
.edit-site-site-hub__view-mode-toggle-container {
|
|
25
|
-
width: $header-height;
|
|
26
|
-
}
|
|
16
|
+
background: $gray-900;
|
|
27
17
|
}
|
|
28
18
|
|
|
29
19
|
.edit-site-site-hub__text-content {
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from '@wordpress/blocks';
|
|
22
22
|
import {
|
|
23
23
|
BlockPreview,
|
|
24
|
-
|
|
24
|
+
privateApis as blockEditorPrivateApis,
|
|
25
25
|
} from '@wordpress/block-editor';
|
|
26
26
|
import { closeSmall } from '@wordpress/icons';
|
|
27
27
|
import { useResizeObserver } from '@wordpress/compose';
|
|
@@ -30,9 +30,9 @@ import { useMemo, memo } from '@wordpress/element';
|
|
|
30
30
|
/**
|
|
31
31
|
* Internal dependencies
|
|
32
32
|
*/
|
|
33
|
-
import { unlock } from '../../
|
|
33
|
+
import { unlock } from '../../private-apis';
|
|
34
34
|
|
|
35
|
-
const { useGlobalStyle } = unlock(
|
|
35
|
+
const { useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
36
36
|
|
|
37
37
|
const SLOT_FILL_NAME = 'EditSiteStyleBook';
|
|
38
38
|
const { Slot: StyleBookSlot, Fill: StyleBookFill } =
|
|
@@ -70,10 +70,14 @@ function getExamples() {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
const otherExamples = getBlockTypes()
|
|
73
|
-
.filter(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
.filter( ( blockType ) => {
|
|
74
|
+
const { name, example, supports } = blockType;
|
|
75
|
+
return (
|
|
76
|
+
name !== 'core/heading' &&
|
|
77
|
+
!! example &&
|
|
78
|
+
supports.inserter !== false
|
|
79
|
+
);
|
|
80
|
+
} )
|
|
77
81
|
.map( ( blockType ) => ( {
|
|
78
82
|
name: blockType.name,
|
|
79
83
|
title: blockType.title,
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useEffect } from '@wordpress/element';
|
|
5
|
-
import { useDispatch } from '@wordpress/data';
|
|
5
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
+
import { store as coreDataStore } from '@wordpress/core-data';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
@@ -11,22 +12,55 @@ import { useLocation } from '../routes';
|
|
|
11
12
|
import { store as editSiteStore } from '../../store';
|
|
12
13
|
|
|
13
14
|
export default function useInitEditedEntityFromURL() {
|
|
15
|
+
const { params: { postId, postType, path = '/' } = {} } = useLocation();
|
|
16
|
+
const { isRequestingSite, homepageId } = useSelect( ( select ) => {
|
|
17
|
+
const { getSite } = select( coreDataStore );
|
|
18
|
+
const siteData = getSite();
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
isRequestingSite: ! siteData,
|
|
22
|
+
homepageId:
|
|
23
|
+
siteData?.show_on_front === 'page'
|
|
24
|
+
? siteData.page_on_front
|
|
25
|
+
: null,
|
|
26
|
+
};
|
|
27
|
+
}, [] );
|
|
28
|
+
|
|
14
29
|
const { setTemplate, setTemplatePart, setPage } =
|
|
15
30
|
useDispatch( editSiteStore );
|
|
16
|
-
const {
|
|
17
|
-
params: { postId, postType },
|
|
18
|
-
} = useLocation();
|
|
19
31
|
|
|
20
|
-
// Set correct entity on page navigation.
|
|
21
32
|
useEffect( () => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
switch ( path ) {
|
|
34
|
+
case '/templates/single':
|
|
35
|
+
setTemplate( postId );
|
|
36
|
+
break;
|
|
37
|
+
case '/template-parts/single':
|
|
38
|
+
setTemplatePart( postId );
|
|
39
|
+
break;
|
|
40
|
+
case '/navigation/single':
|
|
41
|
+
setPage( {
|
|
42
|
+
context: { postType, postId },
|
|
43
|
+
} );
|
|
44
|
+
break;
|
|
45
|
+
default: {
|
|
46
|
+
if ( homepageId ) {
|
|
47
|
+
setPage( {
|
|
48
|
+
context: { postType: 'page', postId: homepageId },
|
|
49
|
+
} );
|
|
50
|
+
} else if ( ! isRequestingSite ) {
|
|
51
|
+
setPage( {
|
|
52
|
+
path: '/',
|
|
53
|
+
} );
|
|
54
|
+
}
|
|
55
|
+
}
|
|
30
56
|
}
|
|
31
|
-
}, [
|
|
57
|
+
}, [
|
|
58
|
+
path,
|
|
59
|
+
postId,
|
|
60
|
+
homepageId,
|
|
61
|
+
isRequestingSite,
|
|
62
|
+
setPage,
|
|
63
|
+
setTemplate,
|
|
64
|
+
setTemplatePart,
|
|
65
|
+
] );
|
|
32
66
|
}
|
|
@@ -9,7 +9,7 @@ import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
9
9
|
*/
|
|
10
10
|
import { store as editSiteStore } from '../../store';
|
|
11
11
|
import { useLocation, useHistory } from '../routes';
|
|
12
|
-
import { unlock } from '../../
|
|
12
|
+
import { unlock } from '../../private-apis';
|
|
13
13
|
|
|
14
14
|
export default function useSyncCanvasModeWithURL() {
|
|
15
15
|
const history = useHistory();
|
|
@@ -9,28 +9,28 @@ import { useEffect, useRef } from '@wordpress/element';
|
|
|
9
9
|
*/
|
|
10
10
|
import { useLocation, useHistory } from '../routes';
|
|
11
11
|
|
|
12
|
-
export default function
|
|
12
|
+
export default function useSyncPathWithURL() {
|
|
13
13
|
const history = useHistory();
|
|
14
14
|
const { params } = useLocation();
|
|
15
|
-
const {
|
|
15
|
+
const { path = '/' } = params;
|
|
16
16
|
const { location, goTo } = useNavigator();
|
|
17
|
-
const
|
|
17
|
+
const currentPath = useRef( path );
|
|
18
18
|
const currentNavigatorLocation = useRef( location.path );
|
|
19
19
|
useEffect( () => {
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
-
goTo(
|
|
20
|
+
currentPath.current = path;
|
|
21
|
+
if ( path !== currentNavigatorLocation.current ) {
|
|
22
|
+
goTo( path );
|
|
23
23
|
}
|
|
24
|
-
}, [
|
|
24
|
+
}, [ path ] );
|
|
25
25
|
useEffect( () => {
|
|
26
26
|
currentNavigatorLocation.current = location.path;
|
|
27
|
-
if ( location.path !==
|
|
27
|
+
if ( location.path !== currentPath.current ) {
|
|
28
28
|
history.push( {
|
|
29
29
|
...params,
|
|
30
|
-
|
|
30
|
+
path: location.path,
|
|
31
31
|
} );
|
|
32
32
|
}
|
|
33
33
|
}, [ location.path, history ] );
|
|
34
34
|
|
|
35
|
-
return
|
|
35
|
+
return path;
|
|
36
36
|
}
|
|
@@ -12,7 +12,7 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
12
12
|
import { store as editSiteStore } from '../../store';
|
|
13
13
|
|
|
14
14
|
export default function useEditedEntityRecord() {
|
|
15
|
-
const { record, title, isLoaded } = useSelect( ( select ) => {
|
|
15
|
+
const { record, title, description, isLoaded } = useSelect( ( select ) => {
|
|
16
16
|
const { getEditedPostType, getEditedPostId } = select( editSiteStore );
|
|
17
17
|
const { getEditedEntityRecord } = select( coreStore );
|
|
18
18
|
const { __experimentalGetTemplateInfo: getTemplateInfo } =
|
|
@@ -21,10 +21,12 @@ export default function useEditedEntityRecord() {
|
|
|
21
21
|
const postId = getEditedPostId();
|
|
22
22
|
const _record = getEditedEntityRecord( 'postType', postType, postId );
|
|
23
23
|
const _isLoaded = !! postId;
|
|
24
|
+
const templateInfo = getTemplateInfo( _record );
|
|
24
25
|
|
|
25
26
|
return {
|
|
26
27
|
record: _record,
|
|
27
|
-
title:
|
|
28
|
+
title: templateInfo.title,
|
|
29
|
+
description: templateInfo.description,
|
|
28
30
|
isLoaded: _isLoaded,
|
|
29
31
|
};
|
|
30
32
|
}, [] );
|
|
@@ -33,5 +35,7 @@ export default function useEditedEntityRecord() {
|
|
|
33
35
|
isLoaded,
|
|
34
36
|
record,
|
|
35
37
|
getTitle: () => ( title ? decodeEntities( title ) : null ),
|
|
38
|
+
getDescription: () =>
|
|
39
|
+
description ? decodeEntities( description ) : null,
|
|
36
40
|
};
|
|
37
41
|
}
|
|
@@ -11,7 +11,7 @@ import { createHigherOrderComponent } from '@wordpress/compose';
|
|
|
11
11
|
import {
|
|
12
12
|
InspectorAdvancedControls,
|
|
13
13
|
store as blockEditorStore,
|
|
14
|
-
|
|
14
|
+
privateApis as blockEditorPrivateApis,
|
|
15
15
|
} from '@wordpress/block-editor';
|
|
16
16
|
import { BaseControl, Button } from '@wordpress/components';
|
|
17
17
|
import { __, sprintf } from '@wordpress/i18n';
|
|
@@ -27,9 +27,9 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
27
27
|
* Internal dependencies
|
|
28
28
|
*/
|
|
29
29
|
import { getSupportedGlobalStylesPanels } from '../../components/global-styles/hooks';
|
|
30
|
-
import { unlock } from '../../
|
|
30
|
+
import { unlock } from '../../private-apis';
|
|
31
31
|
|
|
32
|
-
const { GlobalStylesContext } = unlock(
|
|
32
|
+
const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
|
|
33
33
|
|
|
34
34
|
// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be
|
|
35
35
|
// removed by moving PushChangesToGlobalStylesControl to
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/
|
|
4
|
+
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
|
|
5
5
|
|
|
6
6
|
export const { lock, unlock } =
|
|
7
7
|
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
package/src/store/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import * as privateActions from './private-actions';
|
|
|
12
12
|
import * as selectors from './selectors';
|
|
13
13
|
import * as privateSelectors from './private-selectors';
|
|
14
14
|
import { STORE_NAME } from './constants';
|
|
15
|
-
import { unlock } from '../
|
|
15
|
+
import { unlock } from '../private-apis';
|
|
16
16
|
|
|
17
17
|
export const storeConfig = {
|
|
18
18
|
reducer,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns if the params match the list page route.
|
|
3
3
|
*
|
|
4
|
-
* @param {Object} params
|
|
5
|
-
* @param {string} params.
|
|
6
|
-
*
|
|
4
|
+
* @param {Object} params The url params.
|
|
5
|
+
* @param {string} params.path The current path.
|
|
6
|
+
*
|
|
7
7
|
* @return {boolean} Is list page or not.
|
|
8
8
|
*/
|
|
9
|
-
export default function getIsListPage( {
|
|
10
|
-
return
|
|
9
|
+
export default function getIsListPage( { path } ) {
|
|
10
|
+
return path === '/templates/all' || path === '/template-parts/all';
|
|
11
11
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-sidebar-path-with-url.js"],"names":["useSyncSidebarPathWithURL","history","params","sidebar","location","goTo","currentSidebar","currentNavigatorLocation","path","current","push"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGe,SAASA,yBAAT,GAAqC;AACnD,QAAMC,OAAO,GAAG,yBAAhB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAa,0BAAnB;AACA,QAAM;AAAEC,IAAAA,OAAO,GAAG;AAAZ,MAAoBD,MAA1B;AACA,QAAM;AAAEE,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAqB,6CAA3B;AACA,QAAMC,cAAc,GAAG,qBAAQH,OAAR,CAAvB;AACA,QAAMI,wBAAwB,GAAG,qBAAQH,QAAQ,CAACI,IAAjB,CAAjC;AACA,0BAAW,MAAM;AAChBF,IAAAA,cAAc,CAACG,OAAf,GAAyBN,OAAzB;;AACA,QAAKA,OAAO,KAAKI,wBAAwB,CAACE,OAA1C,EAAoD;AACnDJ,MAAAA,IAAI,CAAEF,OAAF,CAAJ;AACA;AACD,GALD,EAKG,CAAEA,OAAF,CALH;AAMA,0BAAW,MAAM;AAChBI,IAAAA,wBAAwB,CAACE,OAAzB,GAAmCL,QAAQ,CAACI,IAA5C;;AACA,QAAKJ,QAAQ,CAACI,IAAT,KAAkBF,cAAc,CAACG,OAAtC,EAAgD;AAC/CR,MAAAA,OAAO,CAACS,IAAR,CAAc,EACb,GAAGR,MADU;AAEbC,QAAAA,OAAO,EAAEC,QAAQ,CAACI;AAFL,OAAd;AAIA;AACD,GARD,EAQG,CAAEJ,QAAQ,CAACI,IAAX,EAAiBP,OAAjB,CARH;AAUA,SAAOE,OAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useLocation, useHistory } from '../routes';\n\nexport default function useSyncSidebarPathWithURL() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst { sidebar = '/' } = params;\n\tconst { location, goTo } = useNavigator();\n\tconst currentSidebar = useRef( sidebar );\n\tconst currentNavigatorLocation = useRef( location.path );\n\tuseEffect( () => {\n\t\tcurrentSidebar.current = sidebar;\n\t\tif ( sidebar !== currentNavigatorLocation.current ) {\n\t\t\tgoTo( sidebar );\n\t\t}\n\t}, [ sidebar ] );\n\tuseEffect( () => {\n\t\tcurrentNavigatorLocation.current = location.path;\n\t\tif ( location.path !== currentSidebar.current ) {\n\t\t\thistory.push( {\n\t\t\t\t...params,\n\t\t\t\tsidebar: location.path,\n\t\t\t} );\n\t\t}\n\t}, [ location.path, history ] );\n\n\treturn sidebar;\n}\n"]}
|
package/build/experiments.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/experiments.js"],"names":["lock","unlock"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAM;AAAEA,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZ,mEACC,8GADD,EAEC,sBAFD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/edit-site'\n\t);\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-sidebar-path-with-url.js"],"names":["__experimentalUseNavigator","useNavigator","useEffect","useRef","useLocation","useHistory","useSyncSidebarPathWithURL","history","params","sidebar","location","goTo","currentSidebar","currentNavigatorLocation","path","current","push"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AACA,SAASC,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,UAAtB,QAAwC,WAAxC;AAEA,eAAe,SAASC,yBAAT,GAAqC;AACnD,QAAMC,OAAO,GAAGF,UAAU,EAA1B;AACA,QAAM;AAAEG,IAAAA;AAAF,MAAaJ,WAAW,EAA9B;AACA,QAAM;AAAEK,IAAAA,OAAO,GAAG;AAAZ,MAAoBD,MAA1B;AACA,QAAM;AAAEE,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAqBV,YAAY,EAAvC;AACA,QAAMW,cAAc,GAAGT,MAAM,CAAEM,OAAF,CAA7B;AACA,QAAMI,wBAAwB,GAAGV,MAAM,CAAEO,QAAQ,CAACI,IAAX,CAAvC;AACAZ,EAAAA,SAAS,CAAE,MAAM;AAChBU,IAAAA,cAAc,CAACG,OAAf,GAAyBN,OAAzB;;AACA,QAAKA,OAAO,KAAKI,wBAAwB,CAACE,OAA1C,EAAoD;AACnDJ,MAAAA,IAAI,CAAEF,OAAF,CAAJ;AACA;AACD,GALQ,EAKN,CAAEA,OAAF,CALM,CAAT;AAMAP,EAAAA,SAAS,CAAE,MAAM;AAChBW,IAAAA,wBAAwB,CAACE,OAAzB,GAAmCL,QAAQ,CAACI,IAA5C;;AACA,QAAKJ,QAAQ,CAACI,IAAT,KAAkBF,cAAc,CAACG,OAAtC,EAAgD;AAC/CR,MAAAA,OAAO,CAACS,IAAR,CAAc,EACb,GAAGR,MADU;AAEbC,QAAAA,OAAO,EAAEC,QAAQ,CAACI;AAFL,OAAd;AAIA;AACD,GARQ,EAQN,CAAEJ,QAAQ,CAACI,IAAX,EAAiBP,OAAjB,CARM,CAAT;AAUA,SAAOE,OAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useLocation, useHistory } from '../routes';\n\nexport default function useSyncSidebarPathWithURL() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst { sidebar = '/' } = params;\n\tconst { location, goTo } = useNavigator();\n\tconst currentSidebar = useRef( sidebar );\n\tconst currentNavigatorLocation = useRef( location.path );\n\tuseEffect( () => {\n\t\tcurrentSidebar.current = sidebar;\n\t\tif ( sidebar !== currentNavigatorLocation.current ) {\n\t\t\tgoTo( sidebar );\n\t\t}\n\t}, [ sidebar ] );\n\tuseEffect( () => {\n\t\tcurrentNavigatorLocation.current = location.path;\n\t\tif ( location.path !== currentSidebar.current ) {\n\t\t\thistory.push( {\n\t\t\t\t...params,\n\t\t\t\tsidebar: location.path,\n\t\t\t} );\n\t\t}\n\t}, [ location.path, history ] );\n\n\treturn sidebar;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/experiments.js"],"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAT,QAAiE,wBAAjE;AAEA,OAAO,MAAM;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZF,gDAAgD,CAC/C,8GAD+C,EAE/C,sBAF+C,CAD1C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/edit-site'\n\t);\n"]}
|