@wordpress/edit-site 6.2.0 → 6.3.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-page → add-new-post}/index.js +21 -17
- package/build/components/add-new-post/index.js.map +1 -0
- package/build/components/block-editor/use-site-editor-settings.js +5 -3
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +21 -3
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +0 -5
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +13 -30
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/hooks.js +0 -40
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview-typography.js +47 -0
- package/build/components/global-styles/preview-typography.js.map +1 -0
- package/build/components/global-styles/screen-block.js +14 -0
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +5 -1
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +1 -2
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +5 -5
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/typography-elements.js +0 -2
- package/build/components/global-styles/typography-elements.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +4 -4
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +4 -3
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +14 -28
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +2 -2
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/index.js +16 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +20 -41
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-patterns/index.js +43 -39
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/search-items.js +29 -4
- package/build/components/page-patterns/search-items.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +22 -55
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/index.js +18 -19
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/pagination/index.js +4 -4
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/posts-app/index.js +11 -17
- package/build/components/posts-app/index.js.map +1 -1
- package/build/components/{page-pages/index.js → posts-app/posts-list.js} +135 -40
- package/build/components/posts-app/posts-list.js.map +1 -0
- package/build/components/posts-app/router.js +85 -0
- package/build/components/posts-app/router.js.map +1 -0
- package/build/components/revisions/index.js +10 -7
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/save-panel/index.js +1 -1
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +4 -1
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +98 -84
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +4 -1
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +3 -3
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/site-hub/index.js +81 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +65 -42
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +6 -0
- package/build/index.js.map +1 -1
- package/build/posts.js +57 -2
- package/build/posts.js.map +1 -1
- package/build/store/private-actions.js +7 -2
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/{add-new-page → add-new-post}/index.js +21 -17
- package/build-module/components/add-new-post/index.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +5 -3
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +21 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +0 -5
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +14 -31
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +0 -38
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview-typography.js +39 -0
- package/build-module/components/global-styles/preview-typography.js.map +1 -0
- package/build-module/components/global-styles/screen-block.js +15 -0
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +5 -1
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +1 -2
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +6 -6
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/typography-elements.js +0 -2
- package/build-module/components/global-styles/typography-elements.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +5 -5
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +4 -3
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +16 -29
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +2 -2
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/index.js +14 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +20 -41
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-patterns/index.js +44 -40
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/search-items.js +28 -4
- package/build-module/components/page-patterns/search-items.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +23 -56
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/index.js +18 -19
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/pagination/index.js +4 -4
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/posts-app/index.js +11 -17
- package/build-module/components/posts-app/index.js.map +1 -1
- package/build-module/components/{page-pages/index.js → posts-app/posts-list.js} +134 -39
- package/build-module/components/posts-app/posts-list.js.map +1 -0
- package/build-module/components/posts-app/router.js +77 -0
- package/build-module/components/posts-app/router.js.map +1 -0
- package/build-module/components/revisions/index.js +10 -7
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +1 -1
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +4 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +96 -83
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +5 -2
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +3 -3
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/site-hub/index.js +81 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +61 -38
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +7 -2
- package/build-module/index.js.map +1 -1
- package/build-module/posts.js +57 -2
- package/build-module/posts.js.map +1 -1
- package/build-module/store/private-actions.js +7 -2
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/posts-rtl.css +108 -28
- package/build-style/posts.css +108 -28
- package/build-style/style-rtl.css +112 -144
- package/build-style/style.css +112 -144
- package/package.json +41 -41
- package/src/components/{add-new-page → add-new-post}/index.js +28 -22
- package/src/components/block-editor/use-site-editor-settings.js +33 -28
- package/src/components/editor/index.js +21 -5
- package/src/components/global-styles/background-panel.js +0 -8
- package/src/components/global-styles/font-library-modal/font-collection.js +17 -32
- package/src/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/src/components/global-styles/font-library-modal/style.scss +17 -10
- package/src/components/global-styles/hooks.js +0 -41
- package/src/components/global-styles/preview-typography.js +39 -0
- package/src/components/global-styles/screen-block.js +22 -0
- package/src/components/global-styles/screen-layout.js +5 -1
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/src/components/global-styles/shadows-edit-panel.js +1 -2
- package/src/components/global-styles/style-variations-container.js +10 -7
- package/src/components/global-styles/typography-elements.js +0 -4
- package/src/components/global-styles/variations/variation.js +5 -5
- package/src/components/global-styles/variations/variations-color.js +5 -3
- package/src/components/global-styles/variations/variations-typography.js +15 -32
- package/src/components/global-styles-sidebar/index.js +2 -2
- package/src/components/layout/index.js +13 -4
- package/src/components/layout/router.js +20 -36
- package/src/components/layout/style.scss +12 -0
- package/src/components/page-patterns/index.js +47 -56
- package/src/components/page-patterns/search-items.js +37 -3
- package/src/components/page-patterns/style.scss +1 -8
- package/src/components/page-patterns/use-patterns.js +43 -82
- package/src/components/page-templates/index.js +17 -19
- package/src/components/page-templates/style.scss +1 -6
- package/src/components/pagination/index.js +4 -4
- package/src/components/posts-app/index.js +9 -11
- package/src/components/{page-pages/index.js → posts-app/posts-list.js} +126 -39
- package/src/components/posts-app/router.js +69 -0
- package/src/components/{page-pages → posts-app}/style.scss +22 -8
- package/src/components/revisions/index.js +9 -1
- package/src/components/save-panel/index.js +1 -1
- package/src/components/sidebar/style.scss +6 -0
- package/src/components/sidebar-dataviews/add-new-view.js +2 -1
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/src/components/sidebar-dataviews/default-views.js +110 -97
- package/src/components/sidebar-dataviews/index.js +3 -3
- package/src/components/sidebar-navigation-screen-global-styles/index.js +7 -6
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -1
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -2
- package/src/components/site-hub/index.js +84 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -2
- package/src/hooks/push-changes-to-global-styles/index.js +1 -1
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +28 -24
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +72 -47
- package/src/index.js +8 -1
- package/src/posts.js +63 -2
- package/src/posts.scss +9 -0
- package/src/store/private-actions.js +7 -3
- package/src/style.scss +1 -2
- package/build/components/add-new-page/index.js.map +0 -1
- package/build/components/page-pages/index.js.map +0 -1
- package/build/components/table/index.js +0 -35
- package/build/components/table/index.js.map +0 -1
- package/build-module/components/add-new-page/index.js.map +0 -1
- package/build-module/components/page-pages/index.js.map +0 -1
- package/build-module/components/table/index.js +0 -30
- package/build-module/components/table/index.js.map +0 -1
- package/src/components/table/index.js +0 -33
- package/src/components/table/style.scss +0 -38
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
5
6
|
import {
|
|
6
7
|
trash,
|
|
7
8
|
pages,
|
|
@@ -11,6 +12,9 @@ import {
|
|
|
11
12
|
pending,
|
|
12
13
|
notAllowed,
|
|
13
14
|
} from '@wordpress/icons';
|
|
15
|
+
import { useSelect } from '@wordpress/data';
|
|
16
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
17
|
+
import { useMemo } from '@wordpress/element';
|
|
14
18
|
|
|
15
19
|
/**
|
|
16
20
|
* Internal dependencies
|
|
@@ -36,7 +40,7 @@ export const DEFAULT_CONFIG_PER_VIEW_TYPE = {
|
|
|
36
40
|
},
|
|
37
41
|
};
|
|
38
42
|
|
|
39
|
-
const
|
|
43
|
+
const DEFAULT_POST_BASE = {
|
|
40
44
|
type: LAYOUT_LIST,
|
|
41
45
|
search: '',
|
|
42
46
|
filters: [],
|
|
@@ -46,111 +50,120 @@ const DEFAULT_PAGE_BASE = {
|
|
|
46
50
|
field: 'date',
|
|
47
51
|
direction: 'desc',
|
|
48
52
|
},
|
|
49
|
-
|
|
50
|
-
// better to keep track of the hidden ones.
|
|
51
|
-
hiddenFields: [ 'date', 'featured-image' ],
|
|
53
|
+
fields: [ 'title', 'author', 'status' ],
|
|
52
54
|
layout: {
|
|
53
55
|
...DEFAULT_CONFIG_PER_VIEW_TYPE[ LAYOUT_LIST ],
|
|
54
56
|
},
|
|
55
57
|
};
|
|
56
58
|
|
|
57
|
-
export
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
icon: pages,
|
|
63
|
-
view: DEFAULT_PAGE_BASE,
|
|
59
|
+
export function useDefaultViews( { postType } ) {
|
|
60
|
+
const labels = useSelect(
|
|
61
|
+
( select ) => {
|
|
62
|
+
const { getPostType } = select( coreStore );
|
|
63
|
+
return getPostType( postType )?.labels;
|
|
64
64
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
[ postType ]
|
|
66
|
+
);
|
|
67
|
+
return useMemo( () => {
|
|
68
|
+
return {
|
|
69
|
+
[ postType ]: [
|
|
70
|
+
{
|
|
71
|
+
title: labels?.all_items || __( 'All items' ),
|
|
72
|
+
slug: 'all',
|
|
73
|
+
icon: pages,
|
|
74
|
+
view: DEFAULT_POST_BASE,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
title: __( 'Published' ),
|
|
78
|
+
slug: 'published',
|
|
79
|
+
icon: published,
|
|
80
|
+
view: {
|
|
81
|
+
...DEFAULT_POST_BASE,
|
|
82
|
+
filters: [
|
|
83
|
+
{
|
|
84
|
+
field: 'status',
|
|
85
|
+
operator: OPERATOR_IS_ANY,
|
|
86
|
+
value: 'publish',
|
|
87
|
+
},
|
|
88
|
+
],
|
|
76
89
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
title: __( 'Scheduled' ),
|
|
93
|
+
slug: 'future',
|
|
94
|
+
icon: scheduled,
|
|
95
|
+
view: {
|
|
96
|
+
...DEFAULT_POST_BASE,
|
|
97
|
+
filters: [
|
|
98
|
+
{
|
|
99
|
+
field: 'status',
|
|
100
|
+
operator: OPERATOR_IS_ANY,
|
|
101
|
+
value: 'future',
|
|
102
|
+
},
|
|
103
|
+
],
|
|
91
104
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
title: __( 'Drafts' ),
|
|
108
|
+
slug: 'drafts',
|
|
109
|
+
icon: drafts,
|
|
110
|
+
view: {
|
|
111
|
+
...DEFAULT_POST_BASE,
|
|
112
|
+
filters: [
|
|
113
|
+
{
|
|
114
|
+
field: 'status',
|
|
115
|
+
operator: OPERATOR_IS_ANY,
|
|
116
|
+
value: 'draft',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
106
119
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
title: __( 'Pending' ),
|
|
123
|
+
slug: 'pending',
|
|
124
|
+
icon: pending,
|
|
125
|
+
view: {
|
|
126
|
+
...DEFAULT_POST_BASE,
|
|
127
|
+
filters: [
|
|
128
|
+
{
|
|
129
|
+
field: 'status',
|
|
130
|
+
operator: OPERATOR_IS_ANY,
|
|
131
|
+
value: 'pending',
|
|
132
|
+
},
|
|
133
|
+
],
|
|
121
134
|
},
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
title: __( 'Private' ),
|
|
138
|
+
slug: 'private',
|
|
139
|
+
icon: notAllowed,
|
|
140
|
+
view: {
|
|
141
|
+
...DEFAULT_POST_BASE,
|
|
142
|
+
filters: [
|
|
143
|
+
{
|
|
144
|
+
field: 'status',
|
|
145
|
+
operator: OPERATOR_IS_ANY,
|
|
146
|
+
value: 'private',
|
|
147
|
+
},
|
|
148
|
+
],
|
|
136
149
|
},
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
title: __( 'Trash' ),
|
|
153
|
+
slug: 'trash',
|
|
154
|
+
icon: trash,
|
|
155
|
+
view: {
|
|
156
|
+
...DEFAULT_POST_BASE,
|
|
157
|
+
filters: [
|
|
158
|
+
{
|
|
159
|
+
field: 'status',
|
|
160
|
+
operator: OPERATOR_IS_ANY,
|
|
161
|
+
value: 'trash',
|
|
162
|
+
},
|
|
163
|
+
],
|
|
151
164
|
},
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
]
|
|
156
|
-
}
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
};
|
|
168
|
+
}, [ labels, postType ] );
|
|
169
|
+
}
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
5
|
-
|
|
6
5
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
6
|
+
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
import { DEFAULT_VIEWS } from './default-views';
|
|
10
|
+
import { useDefaultViews } from './default-views';
|
|
12
11
|
import { unlock } from '../../lock-unlock';
|
|
13
12
|
const { useLocation } = unlock( routerPrivateApis );
|
|
14
13
|
import DataViewItem from './dataview-item';
|
|
@@ -18,6 +17,7 @@ export default function DataViewsSidebarContent() {
|
|
|
18
17
|
const {
|
|
19
18
|
params: { postType, activeView = 'all', isCustom = 'false' },
|
|
20
19
|
} = useLocation();
|
|
20
|
+
const DEFAULT_VIEWS = useDefaultViews( { postType } );
|
|
21
21
|
if ( ! postType ) {
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
@@ -26,10 +26,7 @@ import useGlobalStylesRevisions from '../global-styles/screen-revisions/use-glob
|
|
|
26
26
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
27
27
|
import ColorVariations from '../global-styles/variations/variations-color';
|
|
28
28
|
import TypographyVariations from '../global-styles/variations/variations-typography';
|
|
29
|
-
import {
|
|
30
|
-
useColorVariations,
|
|
31
|
-
useTypographyVariations,
|
|
32
|
-
} from '../global-styles/hooks';
|
|
29
|
+
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
33
30
|
|
|
34
31
|
const noop = () => {};
|
|
35
32
|
|
|
@@ -75,8 +72,12 @@ function SidebarNavigationScreenGlobalStylesContent() {
|
|
|
75
72
|
};
|
|
76
73
|
}, [] );
|
|
77
74
|
|
|
78
|
-
const colorVariations =
|
|
79
|
-
|
|
75
|
+
const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig( [
|
|
76
|
+
'color',
|
|
77
|
+
] );
|
|
78
|
+
const typographyVariations =
|
|
79
|
+
useCurrentMergeThemeStyleVariationsWithUserConfig( [ 'typography' ] );
|
|
80
|
+
|
|
80
81
|
const gap = 3;
|
|
81
82
|
|
|
82
83
|
// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
|
|
@@ -36,6 +36,7 @@ export default function RenameModal( { menuTitle, onClose, onSave } ) {
|
|
|
36
36
|
value={ editedMenuTitle }
|
|
37
37
|
placeholder={ __( 'Navigation title' ) }
|
|
38
38
|
onChange={ setEditedMenuTitle }
|
|
39
|
+
label={ __( 'Name' ) }
|
|
39
40
|
/>
|
|
40
41
|
<HStack justify="right">
|
|
41
42
|
<Button
|
|
@@ -48,7 +49,7 @@ export default function RenameModal( { menuTitle, onClose, onSave } ) {
|
|
|
48
49
|
|
|
49
50
|
<Button
|
|
50
51
|
__next40pxDefaultSize
|
|
51
|
-
|
|
52
|
+
accessibleWhenDisabled
|
|
52
53
|
disabled={ ! isEditedMenuTitleValid }
|
|
53
54
|
variant="primary"
|
|
54
55
|
type="submit"
|
|
@@ -58,13 +58,21 @@ export default function usePatternCategories() {
|
|
|
58
58
|
|
|
59
59
|
// Update the category counts to reflect user registered patterns.
|
|
60
60
|
userPatterns.forEach( ( pattern ) => {
|
|
61
|
-
pattern.
|
|
61
|
+
pattern.wp_pattern_category?.forEach( ( catId ) => {
|
|
62
|
+
const category = userPatternCategories.find(
|
|
63
|
+
( cat ) => cat.id === catId
|
|
64
|
+
)?.name;
|
|
62
65
|
if ( categoryMap[ category ] ) {
|
|
63
66
|
categoryMap[ category ].count += 1;
|
|
64
67
|
}
|
|
65
68
|
} );
|
|
66
69
|
// If the pattern has no categories, add it to uncategorized.
|
|
67
|
-
if (
|
|
70
|
+
if (
|
|
71
|
+
! pattern.wp_pattern_category?.length ||
|
|
72
|
+
! pattern.wp_pattern_category.some( ( catId ) =>
|
|
73
|
+
userPatternCategories.find( ( cat ) => cat.id === catId )
|
|
74
|
+
)
|
|
75
|
+
) {
|
|
68
76
|
categoryMap.uncategorized.count += 1;
|
|
69
77
|
}
|
|
70
78
|
} );
|
|
@@ -11,11 +11,12 @@ import { Button, __experimentalHStack as HStack } from '@wordpress/components';
|
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
13
13
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
14
|
-
import { memo, forwardRef } from '@wordpress/element';
|
|
14
|
+
import { memo, forwardRef, useContext } from '@wordpress/element';
|
|
15
15
|
import { search } from '@wordpress/icons';
|
|
16
16
|
import { store as commandsStore } from '@wordpress/commands';
|
|
17
17
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
18
18
|
import { filterURLForDisplay } from '@wordpress/url';
|
|
19
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Internal dependencies
|
|
@@ -23,6 +24,8 @@ import { filterURLForDisplay } from '@wordpress/url';
|
|
|
23
24
|
import { store as editSiteStore } from '../../store';
|
|
24
25
|
import SiteIcon from '../site-icon';
|
|
25
26
|
import { unlock } from '../../lock-unlock';
|
|
27
|
+
const { useHistory } = unlock( routerPrivateApis );
|
|
28
|
+
import { SidebarNavigationContext } from '../sidebar';
|
|
26
29
|
|
|
27
30
|
const SiteHub = memo(
|
|
28
31
|
forwardRef( ( { isTransparent }, ref ) => {
|
|
@@ -103,3 +106,83 @@ const SiteHub = memo(
|
|
|
103
106
|
);
|
|
104
107
|
|
|
105
108
|
export default SiteHub;
|
|
109
|
+
|
|
110
|
+
export const SiteHubMobile = memo(
|
|
111
|
+
forwardRef( ( { isTransparent }, ref ) => {
|
|
112
|
+
const history = useHistory();
|
|
113
|
+
const { navigate } = useContext( SidebarNavigationContext );
|
|
114
|
+
|
|
115
|
+
const { homeUrl, siteTitle } = useSelect( ( select ) => {
|
|
116
|
+
const {
|
|
117
|
+
getSite,
|
|
118
|
+
getUnstableBase, // Site index.
|
|
119
|
+
} = select( coreStore );
|
|
120
|
+
const _site = getSite();
|
|
121
|
+
return {
|
|
122
|
+
homeUrl: getUnstableBase()?.home,
|
|
123
|
+
siteTitle:
|
|
124
|
+
! _site?.title && !! _site?.url
|
|
125
|
+
? filterURLForDisplay( _site?.url )
|
|
126
|
+
: _site?.title,
|
|
127
|
+
};
|
|
128
|
+
}, [] );
|
|
129
|
+
const { open: openCommandCenter } = useDispatch( commandsStore );
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<div className="edit-site-site-hub">
|
|
133
|
+
<HStack justify="flex-start" spacing="0">
|
|
134
|
+
<div
|
|
135
|
+
className={ clsx(
|
|
136
|
+
'edit-site-site-hub__view-mode-toggle-container',
|
|
137
|
+
{
|
|
138
|
+
'has-transparent-background': isTransparent,
|
|
139
|
+
}
|
|
140
|
+
) }
|
|
141
|
+
>
|
|
142
|
+
<Button
|
|
143
|
+
ref={ ref }
|
|
144
|
+
label={ __( 'Go to Site Editor' ) }
|
|
145
|
+
className="edit-site-layout__view-mode-toggle"
|
|
146
|
+
style={ {
|
|
147
|
+
transform: 'scale(0.5)',
|
|
148
|
+
borderRadius: 4,
|
|
149
|
+
} }
|
|
150
|
+
onClick={ () => {
|
|
151
|
+
history.push( {} );
|
|
152
|
+
navigate( 'back' );
|
|
153
|
+
} }
|
|
154
|
+
>
|
|
155
|
+
<SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
|
|
156
|
+
</Button>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<HStack>
|
|
160
|
+
<div className="edit-site-site-hub__title">
|
|
161
|
+
<Button
|
|
162
|
+
variant="link"
|
|
163
|
+
href={ homeUrl }
|
|
164
|
+
target="_blank"
|
|
165
|
+
label={ __( 'View site (opens in a new tab)' ) }
|
|
166
|
+
>
|
|
167
|
+
{ decodeEntities( siteTitle ) }
|
|
168
|
+
</Button>
|
|
169
|
+
</div>
|
|
170
|
+
<HStack
|
|
171
|
+
spacing={ 0 }
|
|
172
|
+
expanded={ false }
|
|
173
|
+
className="edit-site-site-hub__actions"
|
|
174
|
+
>
|
|
175
|
+
<Button
|
|
176
|
+
className="edit-site-site-hub_toggle-command-center"
|
|
177
|
+
icon={ search }
|
|
178
|
+
onClick={ () => openCommandCenter() }
|
|
179
|
+
label={ __( 'Open command palette' ) }
|
|
180
|
+
shortcut={ displayShortcut.primary( 'k' ) }
|
|
181
|
+
/>
|
|
182
|
+
</HStack>
|
|
183
|
+
</HStack>
|
|
184
|
+
</HStack>
|
|
185
|
+
</div>
|
|
186
|
+
);
|
|
187
|
+
} )
|
|
188
|
+
);
|
|
@@ -27,7 +27,7 @@ const postTypesWithoutParentTemplate = [
|
|
|
27
27
|
PATTERN_TYPES.user,
|
|
28
28
|
];
|
|
29
29
|
|
|
30
|
-
const authorizedPostTypes = [ 'page' ];
|
|
30
|
+
const authorizedPostTypes = [ 'page', 'post' ];
|
|
31
31
|
|
|
32
32
|
function useResolveEditedEntityAndContext( { postId, postType } ) {
|
|
33
33
|
const {
|
|
@@ -213,7 +213,8 @@ function useResolveEditedEntityAndContext( { postId, postType } ) {
|
|
|
213
213
|
if ( postType && postId && authorizedPostTypes.includes( postType ) ) {
|
|
214
214
|
return { postType, postId };
|
|
215
215
|
}
|
|
216
|
-
|
|
216
|
+
// TODO: for post types lists we should probably not render the front page, but maybe a placeholder
|
|
217
|
+
// with a message like "Select a page" or something similar.
|
|
217
218
|
if ( homepageId ) {
|
|
218
219
|
return { postType: 'page', postId: homepageId };
|
|
219
220
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
filterObjectByProperties,
|
|
6
|
+
removePropertiesFromObject,
|
|
7
7
|
} from '../use-theme-style-variations-by-property';
|
|
8
8
|
|
|
9
|
-
describe( '
|
|
9
|
+
describe( 'filterObjectByProperties', () => {
|
|
10
10
|
const noop = () => {};
|
|
11
11
|
test.each( [
|
|
12
12
|
{
|
|
@@ -14,21 +14,21 @@ describe( 'filterObjectByProperty', () => {
|
|
|
14
14
|
foo: 'bar',
|
|
15
15
|
array: [ 1, 3, 4 ],
|
|
16
16
|
},
|
|
17
|
-
|
|
17
|
+
properties: [ 'array' ],
|
|
18
18
|
expected: { array: [ 1, 3, 4 ] },
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
object: {
|
|
22
22
|
foo: 'bar',
|
|
23
23
|
},
|
|
24
|
-
|
|
24
|
+
properties: [ 'does-not-exist' ],
|
|
25
25
|
expected: {},
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
object: {
|
|
29
29
|
foo: 'bar',
|
|
30
30
|
},
|
|
31
|
-
|
|
31
|
+
properties: false,
|
|
32
32
|
expected: {},
|
|
33
33
|
},
|
|
34
34
|
{
|
|
@@ -39,7 +39,7 @@ describe( 'filterObjectByProperty', () => {
|
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
|
-
|
|
42
|
+
properties: [ 'null' ],
|
|
43
43
|
expected: {
|
|
44
44
|
dig: {
|
|
45
45
|
deeper: {
|
|
@@ -52,19 +52,19 @@ describe( 'filterObjectByProperty', () => {
|
|
|
52
52
|
object: {
|
|
53
53
|
function: noop,
|
|
54
54
|
},
|
|
55
|
-
|
|
55
|
+
properties: [ 'function' ],
|
|
56
56
|
expected: {
|
|
57
57
|
function: noop,
|
|
58
58
|
},
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
object: [],
|
|
62
|
-
|
|
62
|
+
properties: [ 'something' ],
|
|
63
63
|
expected: {},
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
object: {},
|
|
67
|
-
|
|
67
|
+
properties: undefined,
|
|
68
68
|
expected: {},
|
|
69
69
|
},
|
|
70
70
|
{
|
|
@@ -74,7 +74,7 @@ describe( 'filterObjectByProperty', () => {
|
|
|
74
74
|
array: [ 1, 3, 4 ],
|
|
75
75
|
},
|
|
76
76
|
},
|
|
77
|
-
|
|
77
|
+
properties: [ 'nested-object-foo' ],
|
|
78
78
|
expected: {
|
|
79
79
|
'nested-object': {
|
|
80
80
|
'nested-object-foo': 'bar',
|
|
@@ -82,15 +82,15 @@ describe( 'filterObjectByProperty', () => {
|
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
84
|
] )(
|
|
85
|
-
'should filter object by $
|
|
86
|
-
( { expected, object,
|
|
87
|
-
const result =
|
|
85
|
+
'should filter object by $properties',
|
|
86
|
+
( { expected, object, properties } ) => {
|
|
87
|
+
const result = filterObjectByProperties( object, properties );
|
|
88
88
|
expect( result ).toEqual( expected );
|
|
89
89
|
}
|
|
90
90
|
);
|
|
91
91
|
} );
|
|
92
92
|
|
|
93
|
-
describe( '
|
|
93
|
+
describe( 'removePropertiesFromObject', () => {
|
|
94
94
|
const mockBaseVariation = {
|
|
95
95
|
settings: {
|
|
96
96
|
typography: {
|
|
@@ -188,34 +188,38 @@ describe( 'removePropertyFromObject', () => {
|
|
|
188
188
|
},
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
-
it( 'should return with no
|
|
191
|
+
it( 'should return with no properties', () => {
|
|
192
192
|
const object = { test: 'me' };
|
|
193
|
-
expect(
|
|
193
|
+
expect( removePropertiesFromObject( object, undefined ) ).toEqual(
|
|
194
194
|
object
|
|
195
195
|
);
|
|
196
196
|
} );
|
|
197
197
|
|
|
198
|
-
it( 'should return with non-string
|
|
198
|
+
it( 'should return with non-string properties', () => {
|
|
199
199
|
const object = { test: 'you' };
|
|
200
|
-
expect(
|
|
200
|
+
expect( removePropertiesFromObject( object, true ) ).toEqual( object );
|
|
201
201
|
} );
|
|
202
202
|
|
|
203
203
|
it( 'should return with empty object', () => {
|
|
204
204
|
const object = {};
|
|
205
|
-
expect(
|
|
205
|
+
expect( removePropertiesFromObject( object, [ 'color' ] ) ).toEqual(
|
|
206
|
+
object
|
|
207
|
+
);
|
|
206
208
|
} );
|
|
207
209
|
|
|
208
210
|
it( 'should return with null', () => {
|
|
209
|
-
expect(
|
|
211
|
+
expect( removePropertiesFromObject( null, [ 'color' ] ) ).toEqual(
|
|
212
|
+
null
|
|
213
|
+
);
|
|
210
214
|
} );
|
|
211
215
|
|
|
212
|
-
it( 'should remove the specified
|
|
216
|
+
it( 'should remove the specified properties from the object', () => {
|
|
213
217
|
expect(
|
|
214
|
-
|
|
218
|
+
removePropertiesFromObject(
|
|
215
219
|
{
|
|
216
220
|
...mockBaseVariation,
|
|
217
221
|
},
|
|
218
|
-
'typography'
|
|
222
|
+
[ 'typography' ]
|
|
219
223
|
)
|
|
220
224
|
).toEqual( {
|
|
221
225
|
settings: {
|