@wordpress/edit-site 3.0.18-next.33ec3857e2.0 → 3.0.21
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/build/components/block-editor/index.js +1 -1
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +37 -8
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/global-styles/border-panel.js +22 -81
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +7 -3
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +10 -9
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +1 -1
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +10 -6
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +10 -6
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/ui.js +14 -27
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/list/actions/index.js +0 -1
- package/build/components/list/actions/index.js.map +1 -1
- package/build/components/list/added-by.js +9 -3
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/constants.js +1 -11
- package/build/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js +10 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build/components/sidebar/default-sidebar.js +2 -4
- package/build/components/sidebar/default-sidebar.js.map +1 -1
- package/build/components/sidebar/global-styles-sidebar.js +0 -1
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/plugins/site-export.js +1 -1
- package/build/plugins/site-export.js.map +1 -1
- package/build-module/components/block-editor/index.js +2 -2
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +37 -8
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +23 -82
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +5 -4
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +11 -9
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +1 -1
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +11 -7
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +11 -7
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/ui.js +14 -26
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/list/actions/index.js +0 -1
- package/build-module/components/list/actions/index.js.map +1 -1
- package/build-module/components/list/added-by.js +10 -4
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js +0 -5
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js +11 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build-module/components/sidebar/default-sidebar.js +2 -4
- package/build-module/components/sidebar/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar/global-styles-sidebar.js +0 -1
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/plugins/site-export.js +2 -2
- package/build-module/plugins/site-export.js.map +1 -1
- package/build-style/style-rtl.css +62 -32
- package/build-style/style.css +62 -32
- package/package.json +28 -28
- package/src/components/block-editor/index.js +2 -2
- package/src/components/block-editor/resizable-editor.js +52 -13
- package/src/components/block-editor/style.scss +18 -10
- package/src/components/global-styles/border-panel.js +42 -106
- package/src/components/global-styles/gradients-palette-panel.js +4 -4
- package/src/components/global-styles/screen-background-color.js +10 -7
- package/src/components/global-styles/screen-colors.js +1 -1
- package/src/components/global-styles/screen-link-color.js +14 -6
- package/src/components/global-styles/screen-text-color.js +14 -6
- package/src/components/global-styles/style.scss +19 -1
- package/src/components/global-styles/ui.js +25 -50
- package/src/components/header/document-actions/style.scss +9 -1
- package/src/components/header/style.scss +1 -2
- package/src/components/list/actions/index.js +0 -1
- package/src/components/list/added-by.js +25 -9
- package/src/components/navigation-sidebar/navigation-panel/constants.js +0 -15
- package/src/components/navigation-sidebar/navigation-toggle/index.js +12 -0
- package/src/components/navigation-sidebar/navigation-toggle/style.scss +8 -4
- package/src/components/sidebar/default-sidebar.js +0 -2
- package/src/components/sidebar/global-styles-sidebar.js +0 -1
- package/src/components/sidebar/style.scss +14 -21
- package/src/plugins/site-export.js +2 -2
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js +0 -101
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/content-categories.js +0 -82
- package/build/components/navigation-sidebar/navigation-panel/menus/content-categories.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/content-pages.js +0 -82
- package/build/components/navigation-sidebar/navigation-panel/menus/content-pages.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/content-posts.js +0 -107
- package/build/components/navigation-sidebar/navigation-panel/menus/content-posts.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/index.js +0 -57
- package/build/components/navigation-sidebar/navigation-panel/menus/index.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +0 -48
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js +0 -100
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +0 -62
- package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/templates.js +0 -143
- package/build/components/navigation-sidebar/navigation-panel/menus/templates.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +0 -76
- package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +0 -125
- package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/search-results.js +0 -132
- package/build/components/navigation-sidebar/navigation-panel/search-results.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js +0 -86
- package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/template-preview.js +0 -46
- package/build/components/navigation-sidebar/navigation-panel/template-preview.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/use-debounced-search.js +0 -47
- package/build/components/navigation-sidebar/navigation-panel/use-debounced-search.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/utils.js +0 -21
- package/build/components/navigation-sidebar/navigation-panel/utils.js.map +0 -1
- package/build/utils/get-closest-available-template.js +0 -48
- package/build/utils/get-closest-available-template.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js +0 -86
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-categories.js +0 -65
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-categories.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-pages.js +0 -65
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-pages.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-posts.js +0 -90
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-posts.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/index.js +0 -40
- package/build-module/components/navigation-sidebar/navigation-panel/menus/index.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +0 -35
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js +0 -84
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +0 -50
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js +0 -124
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +0 -65
- package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +0 -106
- package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/search-results.js +0 -116
- package/build-module/components/navigation-sidebar/navigation-panel/search-results.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js +0 -71
- package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js +0 -38
- package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/use-debounced-search.js +0 -37
- package/build-module/components/navigation-sidebar/navigation-panel/use-debounced-search.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/utils.js +0 -8
- package/build-module/components/navigation-sidebar/navigation-panel/utils.js.map +0 -1
- package/build-module/utils/get-closest-available-template.js +0 -40
- package/build-module/utils/get-closest-available-template.js.map +0 -1
- package/src/components/navigation-sidebar/navigation-panel/content-navigation-item.js +0 -89
- package/src/components/navigation-sidebar/navigation-panel/menus/content-categories.js +0 -85
- package/src/components/navigation-sidebar/navigation-panel/menus/content-pages.js +0 -85
- package/src/components/navigation-sidebar/navigation-panel/menus/content-posts.js +0 -117
- package/src/components/navigation-sidebar/navigation-panel/menus/index.js +0 -61
- package/src/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +0 -34
- package/src/components/navigation-sidebar/navigation-panel/menus/template-parts.js +0 -94
- package/src/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +0 -42
- package/src/components/navigation-sidebar/navigation-panel/menus/templates.js +0 -147
- package/src/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +0 -53
- package/src/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +0 -110
- package/src/components/navigation-sidebar/navigation-panel/search-results.js +0 -117
- package/src/components/navigation-sidebar/navigation-panel/template-navigation-item.js +0 -83
- package/src/components/navigation-sidebar/navigation-panel/template-preview.js +0 -32
- package/src/components/navigation-sidebar/navigation-panel/use-debounced-search.js +0 -47
- package/src/components/navigation-sidebar/navigation-panel/utils.js +0 -11
- package/src/utils/get-closest-available-template.js +0 -31
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalNavigationMenu as NavigationMenu,
|
|
6
|
-
__experimentalNavigationItem as NavigationItem,
|
|
7
|
-
} from '@wordpress/components';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import { MENU_CONTENT_CATEGORIES, MENU_ROOT } from '../constants';
|
|
16
|
-
import ContentNavigationItem from '../content-navigation-item';
|
|
17
|
-
import SearchResults from '../search-results';
|
|
18
|
-
import useDebouncedSearch from '../use-debounced-search';
|
|
19
|
-
|
|
20
|
-
export default function ContentCategoriesMenu() {
|
|
21
|
-
const {
|
|
22
|
-
search,
|
|
23
|
-
searchQuery,
|
|
24
|
-
onSearch,
|
|
25
|
-
isDebouncing,
|
|
26
|
-
} = useDebouncedSearch();
|
|
27
|
-
|
|
28
|
-
const { categories, isResolved } = useSelect(
|
|
29
|
-
( select ) => {
|
|
30
|
-
const { getEntityRecords, hasFinishedResolution } = select(
|
|
31
|
-
coreStore
|
|
32
|
-
);
|
|
33
|
-
const query = searchQuery
|
|
34
|
-
? {
|
|
35
|
-
search: searchQuery,
|
|
36
|
-
}
|
|
37
|
-
: undefined;
|
|
38
|
-
const getEntityRecordsArgs = [ 'taxonomy', 'category', query ];
|
|
39
|
-
const hasResolvedPosts = hasFinishedResolution(
|
|
40
|
-
'getEntityRecords',
|
|
41
|
-
getEntityRecordsArgs
|
|
42
|
-
);
|
|
43
|
-
return {
|
|
44
|
-
categories: getEntityRecords( ...getEntityRecordsArgs ),
|
|
45
|
-
isResolved: hasResolvedPosts,
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
[ searchQuery ]
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const shouldShowLoadingForDebouncing = search && isDebouncing;
|
|
52
|
-
const showLoading = ! isResolved || shouldShowLoadingForDebouncing;
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<NavigationMenu
|
|
56
|
-
menu={ MENU_CONTENT_CATEGORIES }
|
|
57
|
-
title={ __( 'Categories' ) }
|
|
58
|
-
parentMenu={ MENU_ROOT }
|
|
59
|
-
hasSearch={ true }
|
|
60
|
-
onSearch={ onSearch }
|
|
61
|
-
search={ search }
|
|
62
|
-
isSearchDebouncing={ isDebouncing || ! isResolved }
|
|
63
|
-
>
|
|
64
|
-
{ search && ! isDebouncing && (
|
|
65
|
-
<SearchResults
|
|
66
|
-
items={ categories }
|
|
67
|
-
search={ search }
|
|
68
|
-
disableFilter
|
|
69
|
-
/>
|
|
70
|
-
) }
|
|
71
|
-
|
|
72
|
-
{ ! search &&
|
|
73
|
-
categories?.map( ( category ) => (
|
|
74
|
-
<ContentNavigationItem
|
|
75
|
-
item={ category }
|
|
76
|
-
key={ `${ category.taxonomy }-${ category.id }` }
|
|
77
|
-
/>
|
|
78
|
-
) ) }
|
|
79
|
-
|
|
80
|
-
{ showLoading && (
|
|
81
|
-
<NavigationItem title={ __( 'Loading…' ) } isText />
|
|
82
|
-
) }
|
|
83
|
-
</NavigationMenu>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalNavigationMenu as NavigationMenu,
|
|
6
|
-
__experimentalNavigationItem as NavigationItem,
|
|
7
|
-
} from '@wordpress/components';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import { MENU_CONTENT_PAGES, MENU_ROOT } from '../constants';
|
|
16
|
-
import ContentNavigationItem from '../content-navigation-item';
|
|
17
|
-
import SearchResults from '../search-results';
|
|
18
|
-
import useDebouncedSearch from '../use-debounced-search';
|
|
19
|
-
|
|
20
|
-
export default function ContentPagesMenu() {
|
|
21
|
-
const {
|
|
22
|
-
search,
|
|
23
|
-
searchQuery,
|
|
24
|
-
onSearch,
|
|
25
|
-
isDebouncing,
|
|
26
|
-
} = useDebouncedSearch();
|
|
27
|
-
|
|
28
|
-
const { pages, isResolved } = useSelect(
|
|
29
|
-
( select ) => {
|
|
30
|
-
const { getEntityRecords, hasFinishedResolution } = select(
|
|
31
|
-
coreStore
|
|
32
|
-
);
|
|
33
|
-
const query = searchQuery
|
|
34
|
-
? {
|
|
35
|
-
search: searchQuery,
|
|
36
|
-
}
|
|
37
|
-
: undefined;
|
|
38
|
-
const getEntityRecordsArgs = [ 'postType', 'page', query ];
|
|
39
|
-
const hasResolvedPosts = hasFinishedResolution(
|
|
40
|
-
'getEntityRecords',
|
|
41
|
-
getEntityRecordsArgs
|
|
42
|
-
);
|
|
43
|
-
return {
|
|
44
|
-
pages: getEntityRecords( ...getEntityRecordsArgs ),
|
|
45
|
-
isResolved: hasResolvedPosts,
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
[ searchQuery ]
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const shouldShowLoadingForDebouncing = search && isDebouncing;
|
|
52
|
-
const showLoading = ! isResolved || shouldShowLoadingForDebouncing;
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<NavigationMenu
|
|
56
|
-
menu={ MENU_CONTENT_PAGES }
|
|
57
|
-
title={ __( 'Pages' ) }
|
|
58
|
-
parentMenu={ MENU_ROOT }
|
|
59
|
-
hasSearch={ true }
|
|
60
|
-
onSearch={ onSearch }
|
|
61
|
-
search={ search }
|
|
62
|
-
isSearchDebouncing={ isDebouncing || ! isResolved }
|
|
63
|
-
>
|
|
64
|
-
{ search && ! isDebouncing && (
|
|
65
|
-
<SearchResults
|
|
66
|
-
items={ pages }
|
|
67
|
-
search={ search }
|
|
68
|
-
disableFilter
|
|
69
|
-
/>
|
|
70
|
-
) }
|
|
71
|
-
|
|
72
|
-
{ ! search &&
|
|
73
|
-
pages?.map( ( page ) => (
|
|
74
|
-
<ContentNavigationItem
|
|
75
|
-
item={ page }
|
|
76
|
-
key={ `${ page.type }-${ page.id }` }
|
|
77
|
-
/>
|
|
78
|
-
) ) }
|
|
79
|
-
|
|
80
|
-
{ showLoading && (
|
|
81
|
-
<NavigationItem title={ __( 'Loading…' ) } isText />
|
|
82
|
-
) }
|
|
83
|
-
</NavigationMenu>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalNavigationMenu as NavigationMenu,
|
|
6
|
-
__experimentalNavigationItem as NavigationItem,
|
|
7
|
-
} from '@wordpress/components';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import { useCallback } from '@wordpress/element';
|
|
10
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
import { MENU_CONTENT_POSTS, MENU_ROOT } from '../constants';
|
|
17
|
-
import ContentNavigationItem from '../content-navigation-item';
|
|
18
|
-
import SearchResults from '../search-results';
|
|
19
|
-
import useDebouncedSearch from '../use-debounced-search';
|
|
20
|
-
import { store as editSiteStore } from '../../../../store';
|
|
21
|
-
|
|
22
|
-
export default function ContentPostsMenu() {
|
|
23
|
-
const {
|
|
24
|
-
search,
|
|
25
|
-
searchQuery,
|
|
26
|
-
onSearch,
|
|
27
|
-
isDebouncing,
|
|
28
|
-
} = useDebouncedSearch();
|
|
29
|
-
|
|
30
|
-
const { posts, showOnFront, isResolved } = useSelect(
|
|
31
|
-
( select ) => {
|
|
32
|
-
const {
|
|
33
|
-
getEntityRecords,
|
|
34
|
-
getEditedEntityRecord,
|
|
35
|
-
hasFinishedResolution,
|
|
36
|
-
} = select( coreStore );
|
|
37
|
-
const query = searchQuery
|
|
38
|
-
? {
|
|
39
|
-
search: searchQuery,
|
|
40
|
-
}
|
|
41
|
-
: undefined;
|
|
42
|
-
const getEntityRecodsArgs = [ 'postType', 'post', query ];
|
|
43
|
-
const hasResolvedPosts = hasFinishedResolution(
|
|
44
|
-
'getEntityRecords',
|
|
45
|
-
getEntityRecodsArgs
|
|
46
|
-
);
|
|
47
|
-
return {
|
|
48
|
-
posts: getEntityRecords( ...getEntityRecodsArgs ),
|
|
49
|
-
isResolved: hasResolvedPosts,
|
|
50
|
-
showOnFront: getEditedEntityRecord( 'root', 'site' )
|
|
51
|
-
.show_on_front,
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
[ searchQuery ]
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const { setPage, setIsNavigationPanelOpened } = useDispatch(
|
|
58
|
-
editSiteStore
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
const onActivateFrontItem = useCallback( () => {
|
|
62
|
-
setPage( {
|
|
63
|
-
type: 'page',
|
|
64
|
-
path: '/',
|
|
65
|
-
context: {
|
|
66
|
-
queryContext: { page: 1 },
|
|
67
|
-
},
|
|
68
|
-
} );
|
|
69
|
-
setIsNavigationPanelOpened( false );
|
|
70
|
-
}, [ setPage, setIsNavigationPanelOpened ] );
|
|
71
|
-
|
|
72
|
-
const shouldShowLoadingForDebouncing = search && isDebouncing;
|
|
73
|
-
const showLoading = ! isResolved || shouldShowLoadingForDebouncing;
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<NavigationMenu
|
|
77
|
-
menu={ MENU_CONTENT_POSTS }
|
|
78
|
-
title={ __( 'Posts' ) }
|
|
79
|
-
parentMenu={ MENU_ROOT }
|
|
80
|
-
hasSearch={ true }
|
|
81
|
-
onSearch={ onSearch }
|
|
82
|
-
search={ search }
|
|
83
|
-
isSearchDebouncing={ isDebouncing || ! isResolved }
|
|
84
|
-
>
|
|
85
|
-
{ search && ! isDebouncing && (
|
|
86
|
-
<SearchResults
|
|
87
|
-
items={ posts }
|
|
88
|
-
search={ search }
|
|
89
|
-
disableFilter
|
|
90
|
-
/>
|
|
91
|
-
) }
|
|
92
|
-
|
|
93
|
-
{ ! search && (
|
|
94
|
-
<>
|
|
95
|
-
{ showOnFront === 'posts' && (
|
|
96
|
-
<NavigationItem
|
|
97
|
-
item={ 'post-/' }
|
|
98
|
-
title={ __( 'All Posts' ) }
|
|
99
|
-
onClick={ onActivateFrontItem }
|
|
100
|
-
/>
|
|
101
|
-
) }
|
|
102
|
-
|
|
103
|
-
{ posts?.map( ( post ) => (
|
|
104
|
-
<ContentNavigationItem
|
|
105
|
-
item={ post }
|
|
106
|
-
key={ `${ post.type }-${ post.id }` }
|
|
107
|
-
/>
|
|
108
|
-
) ) }
|
|
109
|
-
</>
|
|
110
|
-
) }
|
|
111
|
-
|
|
112
|
-
{ showLoading && (
|
|
113
|
-
<NavigationItem title={ __( 'Loading…' ) } isText />
|
|
114
|
-
) }
|
|
115
|
-
</NavigationMenu>
|
|
116
|
-
);
|
|
117
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalNavigationGroup as NavigationGroup,
|
|
6
|
-
__experimentalNavigationItem as NavigationItem,
|
|
7
|
-
__experimentalNavigationMenu as NavigationMenu,
|
|
8
|
-
} from '@wordpress/components';
|
|
9
|
-
import { __ } from '@wordpress/i18n';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import {
|
|
15
|
-
MENU_TEMPLATES,
|
|
16
|
-
MENU_TEMPLATE_PARTS,
|
|
17
|
-
MENU_CONTENT_CATEGORIES,
|
|
18
|
-
MENU_CONTENT_PAGES,
|
|
19
|
-
MENU_CONTENT_POSTS,
|
|
20
|
-
} from '../constants';
|
|
21
|
-
import ContentPagesMenu from './content-pages';
|
|
22
|
-
import ContentCategoriesMenu from './content-categories';
|
|
23
|
-
import ContentPostsMenu from './content-posts';
|
|
24
|
-
import TemplatesMenu from './templates';
|
|
25
|
-
import TemplatePartsMenu from './template-parts';
|
|
26
|
-
|
|
27
|
-
export default function SiteMenu() {
|
|
28
|
-
return (
|
|
29
|
-
<NavigationMenu>
|
|
30
|
-
<NavigationGroup title={ __( 'Theme' ) }>
|
|
31
|
-
<NavigationItem
|
|
32
|
-
title={ __( 'Templates' ) }
|
|
33
|
-
navigateToMenu={ MENU_TEMPLATES }
|
|
34
|
-
/>
|
|
35
|
-
<NavigationItem
|
|
36
|
-
title={ __( 'Template Parts' ) }
|
|
37
|
-
navigateToMenu={ MENU_TEMPLATE_PARTS }
|
|
38
|
-
/>
|
|
39
|
-
</NavigationGroup>
|
|
40
|
-
<NavigationGroup title={ __( 'Content' ) }>
|
|
41
|
-
<NavigationItem
|
|
42
|
-
title={ __( 'Pages' ) }
|
|
43
|
-
navigateToMenu={ MENU_CONTENT_PAGES }
|
|
44
|
-
/>
|
|
45
|
-
<NavigationItem
|
|
46
|
-
title={ __( 'Categories' ) }
|
|
47
|
-
navigateToMenu={ MENU_CONTENT_CATEGORIES }
|
|
48
|
-
/>
|
|
49
|
-
<NavigationItem
|
|
50
|
-
title={ __( 'Posts' ) }
|
|
51
|
-
navigateToMenu={ MENU_CONTENT_POSTS }
|
|
52
|
-
/>
|
|
53
|
-
</NavigationGroup>
|
|
54
|
-
<TemplatesMenu />
|
|
55
|
-
<TemplatePartsMenu />
|
|
56
|
-
<ContentPagesMenu />
|
|
57
|
-
<ContentCategoriesMenu />
|
|
58
|
-
<ContentPostsMenu />
|
|
59
|
-
</NavigationMenu>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { map } from 'lodash';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { __experimentalNavigationMenu as NavigationMenu } from '@wordpress/components';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import TemplateNavigationItem from '../template-navigation-item';
|
|
15
|
-
import { MENU_TEMPLATE_PARTS } from '../constants';
|
|
16
|
-
|
|
17
|
-
export default function TemplatePartsSubMenu( { menu, title, templateParts } ) {
|
|
18
|
-
return (
|
|
19
|
-
<NavigationMenu
|
|
20
|
-
className="edit-site-navigation-panel__template-parts"
|
|
21
|
-
menu={ menu }
|
|
22
|
-
title={ title }
|
|
23
|
-
parentMenu={ MENU_TEMPLATE_PARTS }
|
|
24
|
-
isEmpty={ ! templateParts || templateParts.length === 0 }
|
|
25
|
-
>
|
|
26
|
-
{ map( templateParts, ( templatePart ) => (
|
|
27
|
-
<TemplateNavigationItem
|
|
28
|
-
item={ templatePart }
|
|
29
|
-
key={ `wp_template_part-${ templatePart.id }` }
|
|
30
|
-
/>
|
|
31
|
-
) ) }
|
|
32
|
-
</NavigationMenu>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { groupBy } from 'lodash';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { __ } from '@wordpress/i18n';
|
|
10
|
-
import { useSelect } from '@wordpress/data';
|
|
11
|
-
import {
|
|
12
|
-
__experimentalNavigationMenu as NavigationMenu,
|
|
13
|
-
__experimentalNavigationItem as NavigationItem,
|
|
14
|
-
} from '@wordpress/components';
|
|
15
|
-
import { useState, useCallback } from '@wordpress/element';
|
|
16
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Internal dependencies
|
|
20
|
-
*/
|
|
21
|
-
import {
|
|
22
|
-
MENU_ROOT,
|
|
23
|
-
MENU_TEMPLATE_PARTS,
|
|
24
|
-
TEMPLATE_PARTS_SUB_MENUS,
|
|
25
|
-
} from '../constants';
|
|
26
|
-
import SearchResults from '../search-results';
|
|
27
|
-
import TemplatePartsSubMenu from './template-parts-sub';
|
|
28
|
-
|
|
29
|
-
export default function TemplatePartsMenu() {
|
|
30
|
-
const [ search, setSearch ] = useState( '' );
|
|
31
|
-
const onSearch = useCallback( ( value ) => {
|
|
32
|
-
setSearch( value );
|
|
33
|
-
} );
|
|
34
|
-
|
|
35
|
-
const { isLoading, templateParts, templatePartsByArea } = useSelect(
|
|
36
|
-
( select ) => {
|
|
37
|
-
const templatePartRecords = select( coreStore ).getEntityRecords(
|
|
38
|
-
'postType',
|
|
39
|
-
'wp_template_part'
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const _templateParts = templatePartRecords || [];
|
|
43
|
-
const _templatePartsByArea = groupBy( _templateParts, 'area' );
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
isLoading: templatePartRecords === null,
|
|
47
|
-
templateParts: _templateParts,
|
|
48
|
-
templatePartsByArea: _templatePartsByArea,
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
[]
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<>
|
|
56
|
-
<NavigationMenu
|
|
57
|
-
menu={ MENU_TEMPLATE_PARTS }
|
|
58
|
-
title={ __( 'Template Parts' ) }
|
|
59
|
-
parentMenu={ MENU_ROOT }
|
|
60
|
-
hasSearch={ true }
|
|
61
|
-
onSearch={ onSearch }
|
|
62
|
-
search={ search }
|
|
63
|
-
>
|
|
64
|
-
{ search && (
|
|
65
|
-
<SearchResults items={ templateParts } search={ search } />
|
|
66
|
-
) }
|
|
67
|
-
|
|
68
|
-
{ ! search &&
|
|
69
|
-
TEMPLATE_PARTS_SUB_MENUS.map( ( { title, menu } ) => (
|
|
70
|
-
<NavigationItem
|
|
71
|
-
key={ `template-parts-navigate-to-${ menu }` }
|
|
72
|
-
className="edit-site-navigation-panel__template-part-item"
|
|
73
|
-
navigateToMenu={ menu }
|
|
74
|
-
title={ title }
|
|
75
|
-
hideIfTargetMenuEmpty
|
|
76
|
-
/>
|
|
77
|
-
) ) }
|
|
78
|
-
|
|
79
|
-
{ ! search && isLoading && (
|
|
80
|
-
<NavigationItem title={ __( 'Loading…' ) } isText />
|
|
81
|
-
) }
|
|
82
|
-
</NavigationMenu>
|
|
83
|
-
|
|
84
|
-
{ TEMPLATE_PARTS_SUB_MENUS.map( ( { area, menu, title } ) => (
|
|
85
|
-
<TemplatePartsSubMenu
|
|
86
|
-
key={ `template-parts-menu-${ menu }` }
|
|
87
|
-
menu={ menu }
|
|
88
|
-
title={ title }
|
|
89
|
-
templateParts={ templatePartsByArea[ area ] }
|
|
90
|
-
/>
|
|
91
|
-
) ) }
|
|
92
|
-
</>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { map } from 'lodash';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { __experimentalNavigationMenu as NavigationMenu } from '@wordpress/components';
|
|
10
|
-
import { useMemo } from '@wordpress/element';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import TemplateNavigationItem from '../template-navigation-item';
|
|
16
|
-
import { MENU_TEMPLATES } from '../constants';
|
|
17
|
-
|
|
18
|
-
export default function TemplatesSubMenu( { menu, title, templates } ) {
|
|
19
|
-
const templatesFiltered = useMemo(
|
|
20
|
-
() =>
|
|
21
|
-
templates
|
|
22
|
-
?.filter( ( { location } ) => location === menu )
|
|
23
|
-
?.map( ( { template } ) => template ) ?? [],
|
|
24
|
-
[ menu, templates ]
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<NavigationMenu
|
|
29
|
-
menu={ menu }
|
|
30
|
-
title={ title }
|
|
31
|
-
parentMenu={ MENU_TEMPLATES }
|
|
32
|
-
isEmpty={ templatesFiltered.length === 0 }
|
|
33
|
-
>
|
|
34
|
-
{ map( templatesFiltered, ( template ) => (
|
|
35
|
-
<TemplateNavigationItem
|
|
36
|
-
item={ template }
|
|
37
|
-
key={ `wp_template-${ template.id }` }
|
|
38
|
-
/>
|
|
39
|
-
) ) }
|
|
40
|
-
</NavigationMenu>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { map, find } from 'lodash';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import {
|
|
10
|
-
__experimentalNavigationItem as NavigationItem,
|
|
11
|
-
__experimentalNavigationMenu as NavigationMenu,
|
|
12
|
-
} from '@wordpress/components';
|
|
13
|
-
import { useSelect } from '@wordpress/data';
|
|
14
|
-
import { __ } from '@wordpress/i18n';
|
|
15
|
-
import { useState, useCallback, useMemo } from '@wordpress/element';
|
|
16
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Internal dependencies
|
|
20
|
-
*/
|
|
21
|
-
import {
|
|
22
|
-
MENU_ROOT,
|
|
23
|
-
MENU_TEMPLATES,
|
|
24
|
-
MENU_TEMPLATES_GENERAL,
|
|
25
|
-
MENU_TEMPLATES_PAGES,
|
|
26
|
-
MENU_TEMPLATES_POSTS,
|
|
27
|
-
MENU_TEMPLATES_UNUSED,
|
|
28
|
-
} from '../constants';
|
|
29
|
-
import NewTemplateDropdown from '../new-template-dropdown';
|
|
30
|
-
import TemplateNavigationItem from '../template-navigation-item';
|
|
31
|
-
import SearchResults from '../search-results';
|
|
32
|
-
import TemplatesSubMenu from './templates-sub';
|
|
33
|
-
import {
|
|
34
|
-
getTemplatesLocationMap,
|
|
35
|
-
getUnusedTemplates,
|
|
36
|
-
} from '../template-hierarchy';
|
|
37
|
-
|
|
38
|
-
export default function TemplatesMenu() {
|
|
39
|
-
const [ search, setSearch ] = useState( '' );
|
|
40
|
-
const onSearch = useCallback( ( value ) => {
|
|
41
|
-
setSearch( value );
|
|
42
|
-
} );
|
|
43
|
-
|
|
44
|
-
const { templates, showOnFront } = useSelect( ( select ) => {
|
|
45
|
-
const { getEntityRecords, getEditedEntityRecord } = select( coreStore );
|
|
46
|
-
return {
|
|
47
|
-
templates: getEntityRecords( 'postType', 'wp_template' ),
|
|
48
|
-
showOnFront: getEditedEntityRecord( 'root', 'site' ).show_on_front,
|
|
49
|
-
};
|
|
50
|
-
}, [] );
|
|
51
|
-
|
|
52
|
-
const templatesWithLocation = useMemo( () => {
|
|
53
|
-
if ( ! templates ) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const unusedTemplates = getUnusedTemplates( templates, showOnFront );
|
|
58
|
-
const templateLocations = getTemplatesLocationMap( templates );
|
|
59
|
-
|
|
60
|
-
return templates.map( ( template ) => ( {
|
|
61
|
-
template,
|
|
62
|
-
location: find( unusedTemplates, { slug: template.slug } )
|
|
63
|
-
? MENU_TEMPLATES_UNUSED
|
|
64
|
-
: templateLocations[ template.slug ],
|
|
65
|
-
} ) );
|
|
66
|
-
}, [ templates ] );
|
|
67
|
-
|
|
68
|
-
const topLevelTemplates = useMemo(
|
|
69
|
-
() =>
|
|
70
|
-
templatesWithLocation
|
|
71
|
-
?.filter( ( { location } ) => location === MENU_TEMPLATES )
|
|
72
|
-
?.map( ( { template } ) => template ) ?? [],
|
|
73
|
-
[ templatesWithLocation ]
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<NavigationMenu
|
|
78
|
-
menu={ MENU_TEMPLATES }
|
|
79
|
-
title={ __( 'Templates' ) }
|
|
80
|
-
titleAction={ <NewTemplateDropdown /> }
|
|
81
|
-
parentMenu={ MENU_ROOT }
|
|
82
|
-
hasSearch={ true }
|
|
83
|
-
onSearch={ onSearch }
|
|
84
|
-
search={ search }
|
|
85
|
-
>
|
|
86
|
-
{ search && (
|
|
87
|
-
<SearchResults items={ templates } search={ search } />
|
|
88
|
-
) }
|
|
89
|
-
|
|
90
|
-
{ ! search && (
|
|
91
|
-
<>
|
|
92
|
-
{ map( topLevelTemplates, ( template ) => (
|
|
93
|
-
<TemplateNavigationItem
|
|
94
|
-
item={ template }
|
|
95
|
-
key={ `wp_template-${ template.id }` }
|
|
96
|
-
/>
|
|
97
|
-
) ) }
|
|
98
|
-
<NavigationItem
|
|
99
|
-
navigateToMenu={ MENU_TEMPLATES_POSTS }
|
|
100
|
-
title={ __( 'Post templates' ) }
|
|
101
|
-
hideIfTargetMenuEmpty
|
|
102
|
-
/>
|
|
103
|
-
<NavigationItem
|
|
104
|
-
navigateToMenu={ MENU_TEMPLATES_PAGES }
|
|
105
|
-
title={ __( 'Page templates' ) }
|
|
106
|
-
hideIfTargetMenuEmpty
|
|
107
|
-
/>
|
|
108
|
-
<NavigationItem
|
|
109
|
-
navigateToMenu={ MENU_TEMPLATES_GENERAL }
|
|
110
|
-
title={ __( 'General templates' ) }
|
|
111
|
-
hideIfTargetMenuEmpty
|
|
112
|
-
/>
|
|
113
|
-
<NavigationItem
|
|
114
|
-
navigateToMenu={ MENU_TEMPLATES_UNUSED }
|
|
115
|
-
title={ __( 'Unused templates' ) }
|
|
116
|
-
hideIfTargetMenuEmpty
|
|
117
|
-
/>
|
|
118
|
-
</>
|
|
119
|
-
) }
|
|
120
|
-
|
|
121
|
-
{ ! search && templates === null && (
|
|
122
|
-
<NavigationItem title={ __( 'Loading…' ) } isText />
|
|
123
|
-
) }
|
|
124
|
-
|
|
125
|
-
<TemplatesSubMenu
|
|
126
|
-
menu={ MENU_TEMPLATES_POSTS }
|
|
127
|
-
title={ __( 'Post templates' ) }
|
|
128
|
-
templates={ templatesWithLocation }
|
|
129
|
-
/>
|
|
130
|
-
<TemplatesSubMenu
|
|
131
|
-
menu={ MENU_TEMPLATES_PAGES }
|
|
132
|
-
title={ __( 'Page templates' ) }
|
|
133
|
-
templates={ templatesWithLocation }
|
|
134
|
-
/>
|
|
135
|
-
<TemplatesSubMenu
|
|
136
|
-
menu={ MENU_TEMPLATES_GENERAL }
|
|
137
|
-
title={ __( 'General templates' ) }
|
|
138
|
-
templates={ templatesWithLocation }
|
|
139
|
-
/>
|
|
140
|
-
<TemplatesSubMenu
|
|
141
|
-
menu={ MENU_TEMPLATES_UNUSED }
|
|
142
|
-
title={ __( 'Unused templates' ) }
|
|
143
|
-
templates={ templatesWithLocation }
|
|
144
|
-
/>
|
|
145
|
-
</NavigationMenu>
|
|
146
|
-
);
|
|
147
|
-
}
|