@wordpress/edit-site 5.12.4 → 5.12.6
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/add-new-template/new-template.js +1 -1
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +1 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +7 -7
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +9 -1
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/page/index.js +3 -1
- package/build/components/page/index.js.map +1 -1
- package/build/components/page-main/index.js +8 -4
- package/build/components/page-main/index.js.map +1 -1
- package/build/components/{page-library → page-patterns}/grid-item.js +52 -27
- package/build/components/page-patterns/grid-item.js.map +1 -0
- package/build/components/{page-library → page-patterns}/grid.js +1 -1
- package/build/components/page-patterns/grid.js.map +1 -0
- package/build/components/{page-library → page-patterns}/index.js +6 -6
- package/build/components/page-patterns/index.js.map +1 -0
- package/build/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/build/components/page-patterns/no-patterns.js.map +1 -0
- package/build/components/{page-library → page-patterns}/patterns-list.js +6 -6
- package/build/components/page-patterns/patterns-list.js.map +1 -0
- package/build/components/page-patterns/search-items.js.map +1 -0
- package/build/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +3 -3
- package/build/components/page-patterns/use-pattern-settings.js.map +1 -0
- package/build/components/{page-library → page-patterns}/use-patterns.js +12 -2
- package/build/components/page-patterns/use-patterns.js.map +1 -0
- package/build/components/{page-library → page-patterns}/utils.js +3 -3
- package/build/components/page-patterns/utils.js.map +1 -0
- package/build/components/page-template-parts/index.js +102 -0
- package/build/components/page-template-parts/index.js.map +1 -0
- package/build/components/sidebar/index.js +6 -6
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +7 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +20 -8
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +2 -2
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +2 -4
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +16 -4
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +13 -8
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +23 -0
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/index.js +55 -15
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +30 -0
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -20
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +11 -63
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/welcome-guide/editor.js +1 -1
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/index.js +5 -1
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +70 -0
- package/build/components/welcome-guide/page.js.map +1 -0
- package/build/components/welcome-guide/styles.js +1 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/components/welcome-guide/template.js +71 -0
- package/build/components/welcome-guide/template.js.map +1 -0
- package/build/hooks/commands/use-common-commands.js +17 -2
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +2 -1
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +5 -2
- package/build/store/actions.js.map +1 -1
- package/build/utils/get-is-list-page.js +2 -2
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +2 -2
- 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/create-pattern-modal/index.js +7 -7
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +10 -2
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/page/index.js +2 -1
- package/build-module/components/page/index.js.map +1 -1
- package/build-module/components/page-main/index.js +6 -3
- package/build-module/components/page-main/index.js.map +1 -1
- package/build-module/components/{page-library → page-patterns}/grid-item.js +56 -29
- package/build-module/components/page-patterns/grid-item.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/grid.js +1 -1
- package/build-module/components/page-patterns/grid.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/index.js +5 -5
- package/build-module/components/page-patterns/index.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/build-module/components/page-patterns/no-patterns.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/patterns-list.js +6 -6
- package/build-module/components/page-patterns/patterns-list.js.map +1 -0
- package/build-module/components/page-patterns/search-items.js.map +1 -0
- package/build-module/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +2 -2
- package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/use-patterns.js +12 -2
- package/build-module/components/page-patterns/use-patterns.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/utils.js +3 -3
- package/build-module/components/page-patterns/utils.js.map +1 -0
- package/build-module/components/page-template-parts/index.js +81 -0
- package/build-module/components/page-template-parts/index.js.map +1 -0
- package/build-module/components/sidebar/index.js +5 -5
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +6 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +19 -8
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +2 -2
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +2 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +15 -5
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -2
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +12 -7
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +21 -0
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/index.js +54 -16
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +20 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -17
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +12 -62
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +1 -1
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +3 -1
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +59 -0
- package/build-module/components/welcome-guide/page.js.map +1 -0
- package/build-module/components/welcome-guide/styles.js +1 -1
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +60 -0
- package/build-module/components/welcome-guide/template.js.map +1 -0
- package/build-module/hooks/commands/use-common-commands.js +16 -2
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +2 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/index.js +2 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +5 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +2 -2
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-style/style-rtl.css +43 -26
- package/build-style/style.css +43 -26
- package/package.json +19 -19
- package/src/components/add-new-template/new-template.js +2 -2
- package/src/components/block-editor/editor-canvas.js +3 -1
- package/src/components/create-pattern-modal/index.js +10 -11
- package/src/components/header-edit-mode/document-actions/index.js +9 -1
- package/src/components/page/index.js +5 -1
- package/src/components/page-main/index.js +6 -3
- package/src/components/{page-library → page-patterns}/grid-item.js +74 -24
- package/src/components/{page-library → page-patterns}/grid.js +1 -1
- package/src/components/{page-library → page-patterns}/index.js +5 -5
- package/src/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/src/components/{page-library → page-patterns}/patterns-list.js +6 -6
- package/src/components/{page-library → page-patterns}/style.scss +16 -12
- package/src/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +1 -1
- package/src/components/{page-library → page-patterns}/use-patterns.js +11 -2
- package/src/components/{page-library → page-patterns}/utils.js +3 -3
- package/src/components/page-template-parts/index.js +105 -0
- package/src/components/sidebar/index.js +6 -6
- package/src/components/sidebar-edit-mode/settings-header/index.js +7 -2
- package/src/components/sidebar-navigation-screen-global-styles/index.js +26 -15
- package/src/components/sidebar-navigation-screen-main/index.js +2 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +2 -6
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +12 -4
- package/src/components/sidebar-navigation-screen-pages/index.js +2 -2
- package/src/components/sidebar-navigation-screen-pattern/index.js +13 -6
- package/src/components/sidebar-navigation-screen-pattern/style.scss +4 -0
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +43 -1
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/index.js +75 -22
- package/src/components/sidebar-navigation-screen-patterns/style.scss +3 -0
- package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +23 -0
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +1 -18
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
- package/src/components/sidebar-navigation-screen-templates/index.js +15 -82
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +2 -0
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/src/components/welcome-guide/editor.js +1 -1
- package/src/components/welcome-guide/index.js +4 -0
- package/src/components/welcome-guide/page.js +75 -0
- package/src/components/welcome-guide/style.scss +15 -1
- package/src/components/welcome-guide/styles.js +1 -1
- package/src/components/welcome-guide/template.js +82 -0
- package/src/hooks/commands/use-common-commands.js +13 -1
- package/src/hooks/commands/use-edit-mode-commands.js +5 -1
- package/src/index.js +2 -0
- package/src/store/actions.js +8 -1
- package/src/style.scss +2 -2
- package/src/utils/get-is-list-page.js +4 -3
- package/build/components/page-library/grid-item.js.map +0 -1
- package/build/components/page-library/grid.js.map +0 -1
- package/build/components/page-library/index.js.map +0 -1
- package/build/components/page-library/no-patterns.js.map +0 -1
- package/build/components/page-library/patterns-list.js.map +0 -1
- package/build/components/page-library/search-items.js.map +0 -1
- package/build/components/page-library/use-library-settings.js.map +0 -1
- package/build/components/page-library/use-patterns.js.map +0 -1
- package/build/components/page-library/utils.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
- package/build-module/components/page-library/grid-item.js.map +0 -1
- package/build-module/components/page-library/grid.js.map +0 -1
- package/build-module/components/page-library/index.js.map +0 -1
- package/build-module/components/page-library/no-patterns.js.map +0 -1
- package/build-module/components/page-library/patterns-list.js.map +0 -1
- package/build-module/components/page-library/search-items.js.map +0 -1
- package/build-module/components/page-library/use-library-settings.js.map +0 -1
- package/build-module/components/page-library/use-patterns.js.map +0 -1
- package/build-module/components/page-library/utils.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
- package/src/components/sidebar-navigation-screen-library/style.scss +0 -3
- /package/build/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-template-part-areas.js +0 -0
- /package/build-module/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-template-part-areas.js +0 -0
- /package/src/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-template-part-areas.js +0 -0
|
@@ -13,7 +13,9 @@ import { Icon } from '@wordpress/components';
|
|
|
13
13
|
|
|
14
14
|
import { useAddedBy } from '../list/added-by';
|
|
15
15
|
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
16
|
+
import useNavigationMenuContent from './use-navigation-menu-content';
|
|
16
17
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
18
|
+
import { SidebarNavigationScreenDetailsPanel, SidebarNavigationScreenDetailsPanelRow, SidebarNavigationScreenDetailsPanelLabel, SidebarNavigationScreenDetailsPanelValue } from '../sidebar-navigation-screen-details-panel';
|
|
17
19
|
export default function usePatternDetails(postType, postId) {
|
|
18
20
|
const {
|
|
19
21
|
getDescription,
|
|
@@ -55,9 +57,28 @@ export default function usePatternDetails(postType, postId) {
|
|
|
55
57
|
const footer = !!record?.modified ? createElement(SidebarNavigationScreenDetailsFooter, {
|
|
56
58
|
lastModifiedDateTime: record.modified
|
|
57
59
|
}) : null;
|
|
60
|
+
const details = [];
|
|
61
|
+
|
|
62
|
+
if (postType === 'wp_block') {
|
|
63
|
+
details.push({
|
|
64
|
+
label: __('Syncing'),
|
|
65
|
+
value: record.meta?.sync_status === 'unsynced' ? __('Not synced') : __('Fully synced')
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const content = createElement(Fragment, null, !!details.length && createElement(SidebarNavigationScreenDetailsPanel, {
|
|
70
|
+
spacing: 5,
|
|
71
|
+
title: __('Details')
|
|
72
|
+
}, details.map(({
|
|
73
|
+
label,
|
|
74
|
+
value
|
|
75
|
+
}) => createElement(SidebarNavigationScreenDetailsPanelRow, {
|
|
76
|
+
key: label
|
|
77
|
+
}, createElement(SidebarNavigationScreenDetailsPanelLabel, null, label), createElement(SidebarNavigationScreenDetailsPanelValue, null, value)))), useNavigationMenuContent(postType, postId));
|
|
58
78
|
return {
|
|
59
79
|
title,
|
|
60
80
|
description,
|
|
81
|
+
content,
|
|
61
82
|
footer
|
|
62
83
|
};
|
|
63
84
|
}
|
package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"names":["__","sprintf","_x","store","coreStore","useSelect","Icon","useAddedBy","useEditedEntityRecord","SidebarNavigationScreenDetailsFooter","usePatternDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","description","imageUrl","icon","isCustomized","footer","modified"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,IAAT,QAAqB,uBAArB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,OAAOC,qBAAP,MAAkC,6BAAlC;AACA,OAAOC,oCAAP,MAAiD,6CAAjD;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"names":["__","sprintf","_x","store","coreStore","useSelect","Icon","useAddedBy","useEditedEntityRecord","useNavigationMenuContent","SidebarNavigationScreenDetailsFooter","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","usePatternDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","description","imageUrl","icon","isCustomized","footer","modified","details","push","label","value","meta","sync_status","content","length","map"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,IAAT,QAAqB,uBAArB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,OAAOC,qBAAP,MAAkC,6BAAlC;AACA,OAAOC,wBAAP,MAAqC,+BAArC;AACA,OAAOC,oCAAP,MAAiD,6CAAjD;AACA,SACCC,mCADD,EAECC,sCAFD,EAGCC,wCAHD,EAICC,wCAJD,QAKO,4CALP;AAOA,eAAe,SAASC,iBAAT,CAA4BC,QAA5B,EAAsCC,MAAtC,EAA+C;AAC7D,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA;AAA5B,MAAuCZ,qBAAqB,CACjEQ,QADiE,EAEjEC,MAFiE,CAAlE;AAIA,QAAMI,YAAY,GAAGhB,SAAS,CAC3BiB,MAAF,IAAcA,MAAM,CAAElB,SAAF,CAAN,CAAoBmB,eAApB,EADe,EAE7B,EAF6B,CAA9B;AAIA,QAAMC,OAAO,GAAGjB,UAAU,CAAES,QAAF,EAAYC,MAAZ,CAA1B;AACA,QAAMQ,oBAAoB,GACzBD,OAAO,CAACE,IAAR,KAAiB,OAAjB,IAA4BN,MAAM,CAACO,KAAP,KAAiBN,YAAY,EAAEO,UAD5D;AAEA,QAAMC,KAAK,GAAGV,QAAQ,EAAtB;AACA,MAAIW,eAAe,GAAGZ,cAAc,EAApC;;AAEA,MAAK,CAAEY,eAAF,IAAqBN,OAAO,CAACO,IAAlC,EAAyC;AACxCD,IAAAA,eAAe,GAAG7B,OAAO,EACxB;AAC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EAAaC,WAAb,KAA6B,UAA7B,GACG3C,EAAE,CAAE,YAAF,CADL,GAEGA,EAAE,CAAE,cAAF;AALO,KAAd;AAOA;;AAED,QAAM4C,OAAO,GACZ,8BACG,CAAC,CAAEN,OAAO,CAACO,MAAX,IACD,cAAC,mCAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,KAAK,EAAG7C,EAAE,CAAE,SAAF;AAFX,KAIGsC,OAAO,CAACQ,GAAR,CAAa,CAAE;AAAEN,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAF,KACd,cAAC,sCAAD;AAAwC,IAAA,GAAG,EAAGD;AAA9C,KACC,cAAC,wCAAD,QACGA,KADH,CADD,EAIC,cAAC,wCAAD,QACGC,KADH,CAJD,CADC,CAJH,CAFF,EAkBGhC,wBAAwB,CAAEO,QAAF,EAAYC,MAAZ,CAlB3B,CADD;AAuBA,SAAO;AAAEY,IAAAA,KAAF;AAASG,IAAAA,WAAT;AAAsBY,IAAAA,OAAtB;AAA+BR,IAAAA;AAA/B,GAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { Icon } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from '../list/added-by';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport useNavigationMenuContent from './use-navigation-menu-content';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\n\nexport default function usePatternDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet descriptionText = getDescription();\n\n\tif ( ! descriptionText && addedBy.text ) {\n\t\tdescriptionText = sprintf(\n\t\t\t// translators: %s: pattern title e.g: \"Header\".\n\t\t\t__( 'This is your %s pattern.' ),\n\t\t\tgetTitle()\n\t\t);\n\t}\n\n\tif ( ! descriptionText && postType === 'wp_block' && record?.title ) {\n\t\tdescriptionText = sprintf(\n\t\t\t// translators: %s: user created pattern title e.g. \"Footer\".\n\t\t\t__( 'This is your %s pattern.' ),\n\t\t\trecord.title\n\t\t);\n\t}\n\n\tconst description = (\n\t\t<>\n\t\t\t{ descriptionText }\n\n\t\t\t{ addedBy.text && ! isAddedByActiveTheme && (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description\">\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author\">\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author-icon\">\n\t\t\t\t\t\t\t{ addedBy.imageUrl ? (\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tsrc={ addedBy.imageUrl }\n\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\twidth=\"24\"\n\t\t\t\t\t\t\t\t\theight=\"24\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Icon icon={ addedBy.icon } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ addedBy.text }\n\t\t\t\t\t</span>\n\n\t\t\t\t\t{ addedBy.isCustomized && (\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized\">\n\t\t\t\t\t\t\t{ _x( '(Customized)', 'pattern' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\tconst footer = !! record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\tlastModifiedDateTime={ record.modified }\n\t\t/>\n\t) : null;\n\n\tconst details = [];\n\n\tif ( postType === 'wp_block' ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Syncing' ),\n\t\t\tvalue:\n\t\t\t\trecord.meta?.sync_status === 'unsynced'\n\t\t\t\t\t? __( 'Not synced' )\n\t\t\t\t\t: __( 'Fully synced' ),\n\t\t} );\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ !! details.length && (\n\t\t\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\ttitle={ __( 'Details' ) }\n\t\t\t\t>\n\t\t\t\t\t{ details.map( ( { label, value } ) => (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t\t) ) }\n\t\t\t\t</SidebarNavigationScreenDetailsPanel>\n\t\t\t) }\n\t\t\t{ useNavigationMenuContent( postType, postId ) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n"]}
|
|
@@ -14,14 +14,14 @@ export default function CategoryItem({
|
|
|
14
14
|
type
|
|
15
15
|
}) {
|
|
16
16
|
const linkInfo = useLink({
|
|
17
|
-
path: '/
|
|
17
|
+
path: '/patterns',
|
|
18
18
|
categoryType: type,
|
|
19
19
|
categoryId: id
|
|
20
20
|
}, {
|
|
21
21
|
// Keep a record of where we came from in state so we can
|
|
22
|
-
// use the browser's back button to go back to
|
|
22
|
+
// use the browser's back button to go back to Patterns.
|
|
23
23
|
// See the implementation of the back button in patterns-list.
|
|
24
|
-
backPath: '/
|
|
24
|
+
backPath: '/patterns'
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
if (!count) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js"],"names":["SidebarNavigationItem","useLink","CategoryItem","count","icon","id","isActive","label","type","linkInfo","path","categoryType","categoryId","backPath","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,qBAAP,MAAkC,4BAAlC;AACA,SAASC,OAAT,QAAwB,gBAAxB;AAEA,eAAe,SAASC,YAAT,CAAuB;AACrCC,EAAAA,KADqC;AAErCC,EAAAA,IAFqC;AAGrCC,EAAAA,EAHqC;AAIrCC,EAAAA,QAJqC;AAKrCC,EAAAA,KALqC;AAMrCC,EAAAA;AANqC,CAAvB,EAOX;AACH,QAAMC,QAAQ,GAAGR,OAAO,CACvB;AACCS,IAAAA,IAAI,EAAE,WADP;AAECC,IAAAA,YAAY,EAAEH,IAFf;AAGCI,IAAAA,UAAU,EAAEP;AAHb,GADuB,EAMvB;AACC;AACA;AACA;AACAQ,IAAAA,QAAQ,EAAE;AAJX,GANuB,CAAxB;;AAcA,MAAK,CAAEV,KAAP,EAAe;AACd;AACA;;AAED,SACC,cAAC,qBAAD,OACMM,QADN;AAEC,IAAA,IAAI,EAAGL,IAFR;AAGC,IAAA,MAAM,EAAG,4BAAQD,KAAR,CAHV;AAIC,oBAAeG,QAAQ,GAAG,MAAH,GAAYQ;AAJpC,KAMGP,KANH,CADD;AAUA","sourcesContent":["/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useLink } from '../routes/link';\n\nexport default function CategoryItem( {\n\tcount,\n\ticon,\n\tid,\n\tisActive,\n\tlabel,\n\ttype,\n} ) {\n\tconst linkInfo = useLink(\n\t\t{\n\t\t\tpath: '/patterns',\n\t\t\tcategoryType: type,\n\t\t\tcategoryId: id,\n\t\t},\n\t\t{\n\t\t\t// Keep a record of where we came from in state so we can\n\t\t\t// use the browser's back button to go back to Patterns.\n\t\t\t// See the implementation of the back button in patterns-list.\n\t\t\tbackPath: '/patterns',\n\t\t}\n\t);\n\n\tif ( ! count ) {\n\t\treturn;\n\t}\n\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...linkInfo }\n\t\t\ticon={ icon }\n\t\t\tsuffix={ <span>{ count }</span> }\n\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t>\n\t\t\t{ label }\n\t\t</SidebarNavigationItem>\n\t);\n}\n"]}
|
|
@@ -3,13 +3,13 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item } from '@wordpress/components';
|
|
6
|
+
import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item, Flex, Icon, Tooltip } from '@wordpress/components';
|
|
7
7
|
import { useViewportMatch } from '@wordpress/compose';
|
|
8
8
|
import { useSelect } from '@wordpress/data';
|
|
9
9
|
import { getTemplatePartIcon } from '@wordpress/editor';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
11
|
import { getQueryArgs } from '@wordpress/url';
|
|
12
|
-
import { file } from '@wordpress/icons';
|
|
12
|
+
import { file, starFilled, lockSmall } from '@wordpress/icons';
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
@@ -18,9 +18,11 @@ import AddNewPattern from '../add-new-pattern';
|
|
|
18
18
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
19
19
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
20
20
|
import CategoryItem from './category-item';
|
|
21
|
-
import { DEFAULT_CATEGORY, DEFAULT_TYPE } from '../page-
|
|
21
|
+
import { DEFAULT_CATEGORY, DEFAULT_TYPE } from '../page-patterns/utils';
|
|
22
22
|
import { store as editSiteStore } from '../../store';
|
|
23
|
+
import { useLink } from '../routes/link';
|
|
23
24
|
import usePatternCategories from './use-pattern-categories';
|
|
25
|
+
import useMyPatterns from './use-my-patterns';
|
|
24
26
|
import useTemplatePartAreas from './use-template-part-areas';
|
|
25
27
|
const templatePartAreaLabels = {
|
|
26
28
|
header: __('Headers'),
|
|
@@ -28,7 +30,7 @@ const templatePartAreaLabels = {
|
|
|
28
30
|
sidebar: __('Sidebar'),
|
|
29
31
|
uncategorized: __('Uncategorized')
|
|
30
32
|
};
|
|
31
|
-
export default function
|
|
33
|
+
export default function SidebarNavigationScreenPatterns() {
|
|
32
34
|
const isMobileViewport = useViewportMatch('medium', '<');
|
|
33
35
|
const {
|
|
34
36
|
categoryType,
|
|
@@ -45,24 +47,45 @@ export default function SidebarNavigationScreenLibrary() {
|
|
|
45
47
|
patternCategories,
|
|
46
48
|
hasPatterns
|
|
47
49
|
} = usePatternCategories();
|
|
50
|
+
const {
|
|
51
|
+
myPatterns,
|
|
52
|
+
hasPatterns: hasMyPatterns
|
|
53
|
+
} = useMyPatterns();
|
|
48
54
|
const isTemplatePartsMode = useSelect(select => {
|
|
49
55
|
const settings = select(editSiteStore).getSettings();
|
|
50
56
|
return !!settings.supportsTemplatePartsMode;
|
|
51
57
|
}, []);
|
|
58
|
+
const templatePartsLink = useLink({
|
|
59
|
+
path: '/wp_template_part/all'
|
|
60
|
+
});
|
|
61
|
+
const footer = !isMobileViewport ? createElement(ItemGroup, null, createElement(SidebarNavigationItem, {
|
|
62
|
+
withChevron: true,
|
|
63
|
+
...templatePartsLink
|
|
64
|
+
}, __('Manage all template parts')), createElement(SidebarNavigationItem, {
|
|
65
|
+
as: "a",
|
|
66
|
+
href: "edit.php?post_type=wp_block",
|
|
67
|
+
withChevron: true
|
|
68
|
+
}, __('Manage all of my patterns'))) : undefined;
|
|
52
69
|
return createElement(SidebarNavigationScreen, {
|
|
53
70
|
isRoot: isTemplatePartsMode,
|
|
54
|
-
title: __('
|
|
71
|
+
title: __('Patterns'),
|
|
55
72
|
description: __('Manage what patterns are available when editing your site.'),
|
|
56
73
|
actions: createElement(AddNewPattern, null),
|
|
57
|
-
footer:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
74
|
+
footer: footer,
|
|
75
|
+
content: createElement(Fragment, null, isLoading && __('Loading patterns'), !isLoading && createElement(Fragment, null, !hasTemplateParts && !hasPatterns && createElement(ItemGroup, {
|
|
76
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
77
|
+
}, createElement(Item, null, __('No template parts or patterns found'))), hasMyPatterns && createElement(ItemGroup, {
|
|
78
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
79
|
+
}, createElement(CategoryItem, {
|
|
80
|
+
key: myPatterns.name,
|
|
81
|
+
count: myPatterns.count,
|
|
82
|
+
label: myPatterns.label,
|
|
83
|
+
icon: starFilled,
|
|
84
|
+
id: myPatterns.name,
|
|
85
|
+
type: "wp_block",
|
|
86
|
+
isActive: currentCategory === `${myPatterns.name}` && currentType === 'wp_block'
|
|
87
|
+
})), hasTemplateParts && createElement(ItemGroup, {
|
|
88
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
66
89
|
}, Object.entries(templatePartAreas).map(([area, parts]) => createElement(CategoryItem, {
|
|
67
90
|
key: area,
|
|
68
91
|
count: parts.length,
|
|
@@ -72,11 +95,26 @@ export default function SidebarNavigationScreenLibrary() {
|
|
|
72
95
|
type: "wp_template_part",
|
|
73
96
|
isActive: currentCategory === area && currentType === 'wp_template_part'
|
|
74
97
|
}))), hasPatterns && createElement(ItemGroup, {
|
|
75
|
-
className: "edit-site-sidebar-navigation-screen-
|
|
98
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
76
99
|
}, patternCategories.map(category => createElement(CategoryItem, {
|
|
77
100
|
key: category.name,
|
|
78
101
|
count: category.count,
|
|
79
|
-
label:
|
|
102
|
+
label: createElement(Flex, {
|
|
103
|
+
justify: "left",
|
|
104
|
+
align: "center",
|
|
105
|
+
gap: 0
|
|
106
|
+
}, category.label, createElement(Tooltip, {
|
|
107
|
+
position: "top center",
|
|
108
|
+
text: __('Theme patterns cannot be edited.')
|
|
109
|
+
}, createElement("span", {
|
|
110
|
+
className: "edit-site-sidebar-navigation-screen-pattern__lock-icon"
|
|
111
|
+
}, createElement(Icon, {
|
|
112
|
+
style: {
|
|
113
|
+
fill: 'currentcolor'
|
|
114
|
+
},
|
|
115
|
+
icon: lockSmall,
|
|
116
|
+
size: 24
|
|
117
|
+
})))),
|
|
80
118
|
icon: file,
|
|
81
119
|
id: category.name,
|
|
82
120
|
type: "pattern",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","Flex","Icon","Tooltip","useViewportMatch","useSelect","getTemplatePartIcon","__","getQueryArgs","file","starFilled","lockSmall","AddNewPattern","SidebarNavigationItem","SidebarNavigationScreen","CategoryItem","DEFAULT_CATEGORY","DEFAULT_TYPE","store","editSiteStore","useLink","usePatternCategories","useMyPatterns","useTemplatePartAreas","templatePartAreaLabels","header","footer","sidebar","uncategorized","SidebarNavigationScreenPatterns","isMobileViewport","categoryType","categoryId","window","location","href","currentCategory","currentType","templatePartAreas","hasTemplateParts","isLoading","patternCategories","hasPatterns","myPatterns","hasMyPatterns","isTemplatePartsMode","select","settings","getSettings","supportsTemplatePartsMode","templatePartsLink","path","undefined","name","count","label","Object","entries","map","area","parts","length","category","fill"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,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AF,IACxB,cAAC,YAAD;AACC,MAAA,GAAG,EAAGA,QAAQ,CAACT,IADhB;AAEC,MAAA,KAAK,EAAGS,QAAQ,CAACR,KAFlB;AAGC,MAAA,KAAK,EACJ,cAAC,IAAD;AACC,QAAA,OAAO,EAAC,MADT;AAEC,QAAA,KAAK,EAAC,QAFP;AAGC,QAAA,GAAG,EAAG;AAHP,SAKGQ,QAAQ,CAACP,KALZ,EAMC,cAAC,OAAD;AACC,QAAA,QAAQ,EAAC,YADV;AAEC,QAAA,IAAI,EAAGhD,EAAE,CACR,kCADQ;AAFV,SAMC;AAAM,QAAA,SAAS,EAAC;AAAhB,SACC,cAAC,IAAD;AACC,QAAA,KAAK,EAAG;AACPwD,UAAAA,IAAI,EAAE;AADC,SADT;AAIC,QAAA,IAAI,EACHpD,SALF;AAOC,QAAA,IAAI,EAAG;AAPR,QADD,CAND,CAND,CAJF;AA8BC,MAAA,IAAI,EAAGF,IA9BR;AA+BC,MAAA,EAAE,EAAGqD,QAAQ,CAACT,IA/Bf;AAgCC,MAAA,IAAI,EAAC,SAhCN;AAiCC,MAAA,QAAQ,EACPjB,eAAe,KACb,GAAG0B,QAAQ,CAACT,IAAM,EADpB,IAEAhB,WAAW,KAAK;AApClB,MADC,CADH,CAvDF,CAHF;AATF,IADD;AAsHA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\tFlex,\n\tIcon,\n\tTooltip,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getTemplatePartIcon } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { getQueryArgs } from '@wordpress/url';\nimport { file, starFilled, lockSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport AddNewPattern from '../add-new-pattern';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport CategoryItem from './category-item';\nimport { DEFAULT_CATEGORY, DEFAULT_TYPE } from '../page-patterns/utils';\nimport { store as editSiteStore } from '../../store';\nimport { useLink } from '../routes/link';\nimport usePatternCategories from './use-pattern-categories';\nimport useMyPatterns from './use-my-patterns';\nimport useTemplatePartAreas from './use-template-part-areas';\n\nconst templatePartAreaLabels = {\n\theader: __( 'Headers' ),\n\tfooter: __( 'Footers' ),\n\tsidebar: __( 'Sidebar' ),\n\tuncategorized: __( 'Uncategorized' ),\n};\n\nexport default function SidebarNavigationScreenPatterns() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { categoryType, categoryId } = getQueryArgs( window.location.href );\n\tconst currentCategory = categoryId || DEFAULT_CATEGORY;\n\tconst currentType = categoryType || DEFAULT_TYPE;\n\n\tconst { templatePartAreas, hasTemplateParts, isLoading } =\n\t\tuseTemplatePartAreas();\n\tconst { patternCategories, hasPatterns } = usePatternCategories();\n\tconst { myPatterns, hasPatterns: hasMyPatterns } = useMyPatterns();\n\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\tconst templatePartsLink = useLink( { path: '/wp_template_part/all' } );\n\tconst footer = ! isMobileViewport ? (\n\t\t<ItemGroup>\n\t\t\t<SidebarNavigationItem withChevron { ...templatePartsLink }>\n\t\t\t\t{ __( 'Manage all template parts' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tas=\"a\"\n\t\t\t\thref=\"edit.php?post_type=wp_block\"\n\t\t\t\twithChevron\n\t\t\t>\n\t\t\t\t{ __( 'Manage all of my patterns' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t</ItemGroup>\n\t) : undefined;\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ isTemplatePartsMode }\n\t\t\ttitle={ __( 'Patterns' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Manage what patterns are available when editing your site.'\n\t\t\t) }\n\t\t\tactions={ <AddNewPattern /> }\n\t\t\tfooter={ footer }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading patterns' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! hasTemplateParts && ! hasPatterns && (\n\t\t\t\t\t\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'No template parts or patterns found'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ hasMyPatterns && (\n\t\t\t\t\t\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\t\t\t\t\tkey={ myPatterns.name }\n\t\t\t\t\t\t\t\t\t\tcount={ myPatterns.count }\n\t\t\t\t\t\t\t\t\t\tlabel={ myPatterns.label }\n\t\t\t\t\t\t\t\t\t\ticon={ starFilled }\n\t\t\t\t\t\t\t\t\t\tid={ myPatterns.name }\n\t\t\t\t\t\t\t\t\t\ttype=\"wp_block\"\n\t\t\t\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\t\t\t\tcurrentCategory ===\n\t\t\t\t\t\t\t\t\t\t\t\t`${ myPatterns.name }` &&\n\t\t\t\t\t\t\t\t\t\t\tcurrentType === 'wp_block'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ hasTemplateParts && (\n\t\t\t\t\t\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t\t\t\t\t\t{ Object.entries( templatePartAreas ).map(\n\t\t\t\t\t\t\t\t\t\t( [ area, parts ] ) => (\n\t\t\t\t\t\t\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ area }\n\t\t\t\t\t\t\t\t\t\t\t\tcount={ parts.length }\n\t\t\t\t\t\t\t\t\t\t\t\ticon={ getTemplatePartIcon(\n\t\t\t\t\t\t\t\t\t\t\t\t\tarea\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\t\t\ttemplatePartAreaLabels[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tarea\n\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tid={ area }\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"wp_template_part\"\n\t\t\t\t\t\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\t\t\t\t\t\tcurrentCategory === area &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tcurrentType ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'wp_template_part'\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ hasPatterns && (\n\t\t\t\t\t\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t\t\t\t\t\t{ patternCategories.map( ( category ) => (\n\t\t\t\t\t\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\t\t\t\t\t\tkey={ category.name }\n\t\t\t\t\t\t\t\t\t\t\tcount={ category.count }\n\t\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\t\t<Flex\n\t\t\t\t\t\t\t\t\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\t\t\t\t\t\t\t\t\talign=\"center\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tgap={ 0 }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ category.label }\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tposition=\"top center\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'Theme patterns cannot be edited.'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__lock-icon\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfill: 'currentcolor',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlockSmall\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\ticon={ file }\n\t\t\t\t\t\t\t\t\t\t\tid={ category.name }\n\t\t\t\t\t\t\t\t\t\t\ttype=\"pattern\"\n\t\t\t\t\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\t\t\t\t\tcurrentCategory ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t`${ category.name }` &&\n\t\t\t\t\t\t\t\t\t\t\t\tcurrentType === 'pattern'\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js"],"names":["store","coreStore","useSelect","unlock","editSiteStore","useDefaultPatternCategories","blockPatternCategories","select","getSettings","settings","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatternCategories","getBlockPatternCategories"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,mBAAvB;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,2BAAT,GAAuC;AACrD,QAAMC,sBAAsB,GAAGJ,SAAS,CAAIK,MAAF,IAAc;AAAA;;AACvD,UAAM;AAAEC,MAAAA;AAAF,QAAkBL,MAAM,CAAEI,MAAM,CAAEH,aAAF,CAAR,CAA9B;AACA,UAAMK,QAAQ,GAAGD,WAAW,EAA5B;AAEA,oCACCC,QAAQ,CAACC,8CADV,yEAECD,QAAQ,CAACE,oCAFV;AAIA,GARuC,CAAxC;AAUA,QAAMC,0BAA0B,GAAGV,SAAS,CAAIK,MAAF,IAC7CA,MAAM,CAAEN,SAAF,CAAN,CAAoBY,yBAApB,EAD2C,CAA5C;AAIA,SAAO,CACN,IAAKP,sBAAsB,IAAI,EAA/B,CADM,EAEN,IAAKM,0BAA0B,IAAI,EAAnC,CAFM,CAAP;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nexport default function useDefaultPatternCategories() {\n\tconst blockPatternCategories = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\tconst settings = getSettings();\n\n\t\treturn (\n\t\t\tsettings.__experimentalAdditionalBlockPatternCategories ??\n\t\t\tsettings.__experimentalBlockPatternCategories\n\t\t);\n\t} );\n\n\tconst restBlockPatternCategories = useSelect( ( select ) =>\n\t\tselect( coreStore ).getBlockPatternCategories()\n\t);\n\n\treturn [\n\t\t...( blockPatternCategories || [] ),\n\t\t...( restBlockPatternCategories || [] ),\n\t];\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
export default function useMyPatterns() {
|
|
8
|
+
const myPatterns = useSelect(select => select(coreStore).getEntityRecords('postType', 'wp_block', {
|
|
9
|
+
per_page: -1
|
|
10
|
+
}));
|
|
11
|
+
return {
|
|
12
|
+
myPatterns: {
|
|
13
|
+
count: myPatterns?.length || 0,
|
|
14
|
+
name: 'my-patterns',
|
|
15
|
+
label: __('My patterns')
|
|
16
|
+
},
|
|
17
|
+
hasPatterns: !!myPatterns?.length
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=use-my-patterns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js"],"names":["store","coreStore","useSelect","__","useMyPatterns","myPatterns","select","getEntityRecords","per_page","count","length","name","label","hasPatterns"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA,eAAe,SAASC,aAAT,GAAyB;AACvC,QAAMC,UAAU,GAAGH,SAAS,CAAII,MAAF,IAC7BA,MAAM,CAAEL,SAAF,CAAN,CAAoBM,gBAApB,CAAsC,UAAtC,EAAkD,UAAlD,EAA8D;AAC7DC,IAAAA,QAAQ,EAAE,CAAC;AADkD,GAA9D,CAD2B,CAA5B;AAMA,SAAO;AACNH,IAAAA,UAAU,EAAE;AACXI,MAAAA,KAAK,EAAEJ,UAAU,EAAEK,MAAZ,IAAsB,CADlB;AAEXC,MAAAA,IAAI,EAAE,aAFK;AAGXC,MAAAA,KAAK,EAAET,EAAE,CAAE,aAAF;AAHE,KADN;AAMNU,IAAAA,WAAW,EAAE,CAAC,CAAER,UAAU,EAAEK;AANtB,GAAP;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\nexport default function useMyPatterns() {\n\tconst myPatterns = useSelect( ( select ) =>\n\t\tselect( coreStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\tper_page: -1,\n\t\t} )\n\t);\n\n\treturn {\n\t\tmyPatterns: {\n\t\t\tcount: myPatterns?.length || 0,\n\t\t\tname: 'my-patterns',\n\t\t\tlabel: __( 'My patterns' ),\n\t\t},\n\t\thasPatterns: !! myPatterns?.length,\n\t};\n}\n"]}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
6
4
|
import { useMemo } from '@wordpress/element';
|
|
7
|
-
import { __ } from '@wordpress/i18n';
|
|
8
5
|
/**
|
|
9
6
|
* Internal dependencies
|
|
10
7
|
*/
|
|
@@ -14,9 +11,6 @@ import useThemePatterns from './use-theme-patterns';
|
|
|
14
11
|
export default function usePatternCategories() {
|
|
15
12
|
const defaultCategories = useDefaultPatternCategories();
|
|
16
13
|
const themePatterns = useThemePatterns();
|
|
17
|
-
const userPatterns = useSelect(select => select(coreStore).getEntityRecords('postType', 'wp_block', {
|
|
18
|
-
per_page: -1
|
|
19
|
-
}));
|
|
20
14
|
const patternCategories = useMemo(() => {
|
|
21
15
|
const categoryMap = {};
|
|
22
16
|
const categoriesWithCounts = []; // Create a map for easier counting of patterns in categories.
|
|
@@ -41,18 +35,9 @@ export default function usePatternCategories() {
|
|
|
41
35
|
if (categoryMap[category.name].count) {
|
|
42
36
|
categoriesWithCounts.push(categoryMap[category.name]);
|
|
43
37
|
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
if (userPatterns?.length) {
|
|
47
|
-
categoriesWithCounts.push({
|
|
48
|
-
count: userPatterns.length || 0,
|
|
49
|
-
name: 'custom-patterns',
|
|
50
|
-
label: __('Custom patterns')
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
38
|
+
});
|
|
54
39
|
return categoriesWithCounts;
|
|
55
|
-
}, [defaultCategories, themePatterns
|
|
40
|
+
}, [defaultCategories, themePatterns]);
|
|
56
41
|
return {
|
|
57
42
|
patternCategories,
|
|
58
43
|
hasPatterns: !!patternCategories.length
|
package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js"],"names":["useMemo","useDefaultPatternCategories","useThemePatterns","usePatternCategories","defaultCategories","themePatterns","patternCategories","categoryMap","categoriesWithCounts","forEach","category","name","count","pattern","categories","push","hasPatterns","length"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,OAAOC,2BAAP,MAAwC,kCAAxC;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;AAEA,eAAe,SAASC,oBAAT,GAAgC;AAC9C,QAAMC,iBAAiB,GAAGH,2BAA2B,EAArD;AACA,QAAMI,aAAa,GAAGH,gBAAgB,EAAtC;AAEA,QAAMI,iBAAiB,GAAGN,OAAO,CAAE,MAAM;AACxC,UAAMO,WAAW,GAAG,EAApB;AACA,UAAMC,oBAAoB,GAAG,EAA7B,CAFwC,CAIxC;;AACAJ,IAAAA,iBAAiB,CAACK,OAAlB,CAA6BC,QAAF,IAAgB;AAC1C,UAAK,CAAEH,WAAW,CAAEG,QAAQ,CAACC,IAAX,CAAlB,EAAsC;AACrCJ,QAAAA,WAAW,CAAEG,QAAQ,CAACC,IAAX,CAAX,GAA+B,EAAE,GAAGD,QAAL;AAAeE,UAAAA,KAAK,EAAE;AAAtB,SAA/B;AACA;AACD,KAJD,EALwC,CAWxC;;AACAP,IAAAA,aAAa,CAACI,OAAd,CAAyBI,OAAF,IAAe;AACrCA,MAAAA,OAAO,CAACC,UAAR,EAAoBL,OAApB,CAA+BC,QAAF,IAAgB;AAC5C,YAAKH,WAAW,CAAEG,QAAF,CAAhB,EAA+B;AAC9BH,UAAAA,WAAW,CAAEG,QAAF,CAAX,CAAwBE,KAAxB,IAAiC,CAAjC;AACA;AACD,OAJD;AAKA,KAND,EAZwC,CAoBxC;;AACAR,IAAAA,iBAAiB,CAACK,OAAlB,CAA6BC,QAAF,IAAgB;AAC1C,UAAKH,WAAW,CAAEG,QAAQ,CAACC,IAAX,CAAX,CAA6BC,KAAlC,EAA0C;AACzCJ,QAAAA,oBAAoB,CAACO,IAArB,CAA2BR,WAAW,CAAEG,QAAQ,CAACC,IAAX,CAAtC;AACA;AACD,KAJD;AAMA,WAAOH,oBAAP;AACA,GA5BgC,EA4B9B,CAAEJ,iBAAF,EAAqBC,aAArB,CA5B8B,CAAjC;AA8BA,SAAO;AAAEC,IAAAA,iBAAF;AAAqBU,IAAAA,WAAW,EAAE,CAAC,CAAEV,iBAAiB,CAACW;AAAvD,GAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useDefaultPatternCategories from './use-default-pattern-categories';\nimport useThemePatterns from './use-theme-patterns';\n\nexport default function usePatternCategories() {\n\tconst defaultCategories = useDefaultPatternCategories();\n\tconst themePatterns = useThemePatterns();\n\n\tconst patternCategories = useMemo( () => {\n\t\tconst categoryMap = {};\n\t\tconst categoriesWithCounts = [];\n\n\t\t// Create a map for easier counting of patterns in categories.\n\t\tdefaultCategories.forEach( ( category ) => {\n\t\t\tif ( ! categoryMap[ category.name ] ) {\n\t\t\t\tcategoryMap[ category.name ] = { ...category, count: 0 };\n\t\t\t}\n\t\t} );\n\n\t\t// Update the category counts to reflect theme registered patterns.\n\t\tthemePatterns.forEach( ( pattern ) => {\n\t\t\tpattern.categories?.forEach( ( category ) => {\n\t\t\t\tif ( categoryMap[ category ] ) {\n\t\t\t\t\tcategoryMap[ category ].count += 1;\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\n\t\t// Filter categories so we only have those containing patterns.\n\t\tdefaultCategories.forEach( ( category ) => {\n\t\t\tif ( categoryMap[ category.name ].count ) {\n\t\t\t\tcategoriesWithCounts.push( categoryMap[ category.name ] );\n\t\t\t}\n\t\t} );\n\n\t\treturn categoriesWithCounts;\n\t}, [ defaultCategories, themePatterns ] );\n\n\treturn { patternCategories, hasPatterns: !! patternCategories.length };\n}\n"]}
|
package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js"],"names":["useEntityRecords","getTemplatePartAreas","items","allItems","groupedByArea","reduce","accumulator","item","key","area","push","header","footer","sidebar","uncategorized","useTemplatePartAreas","records","templateParts","isResolving","isLoading","per_page","hasTemplateParts","length","templatePartAreas"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,QAAiC,sBAAjC;;AAEA,MAAMC,oBAAoB,GAAKC,KAAF,IAAa;AACzC,QAAMC,QAAQ,GAAGD,KAAK,IAAI,EAA1B;AAEA,QAAME,aAAa,GAAGD,QAAQ,CAACE,MAAT,CACrB,CAAEC,WAAF,EAAeC,IAAf,KAAyB;AACxB,UAAMC,GAAG,GAAGF,WAAW,CAAEC,IAAI,CAACE,IAAP,CAAX,GAA2BF,IAAI,CAACE,IAAhC,GAAuC,eAAnD;AACAH,IAAAA,WAAW,CAAEE,GAAF,CAAX,CAAmBE,IAAnB,CAAyBH,IAAzB;AACA,WAAOD,WAAP;AACA,GALoB,EAMrB;AAAEK,IAAAA,MAAM,EAAE,EAAV;AAAcC,IAAAA,MAAM,EAAE,EAAtB;AAA0BC,IAAAA,OAAO,EAAE,EAAnC;AAAuCC,IAAAA,aAAa,EAAE;AAAtD,GANqB,CAAtB;AASA,SAAOV,aAAP;AACA,CAbD;;AAeA,eAAe,SAASW,oBAAT,GAAgC;AAC9C,QAAM;AAAEC,IAAAA,OAAO,EAAEC,aAAX;AAA0BC,IAAAA,WAAW,EAAEC;AAAvC,MAAqDnB,gBAAgB,CAC1E,UAD0E,EAE1E,kBAF0E,EAG1E;AAAEoB,IAAAA,QAAQ,EAAE,CAAC;AAAb,GAH0E,CAA3E;AAMA,SAAO;AACNC,IAAAA,gBAAgB,EAAEJ,aAAa,GAAG,CAAC,CAAEA,aAAa,CAACK,MAApB,GAA6B,KADtD;AAENH,IAAAA,SAFM;AAGNI,IAAAA,iBAAiB,EAAEtB,oBAAoB,CAAEgB,aAAF;AAHjC,GAAP;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\n\nconst getTemplatePartAreas = ( items ) => {\n\tconst allItems = items || [];\n\n\tconst groupedByArea = allItems.reduce(\n\t\t( accumulator, item ) => {\n\t\t\tconst key = accumulator[ item.area ] ? item.area : 'uncategorized';\n\t\t\taccumulator[ key ].push( item );\n\t\t\treturn accumulator;\n\t\t},\n\t\t{ header: [], footer: [], sidebar: [], uncategorized: [] }\n\t);\n\n\treturn groupedByArea;\n};\n\nexport default function useTemplatePartAreas() {\n\tconst { records: templateParts, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t{ per_page: -1 }\n\t);\n\n\treturn {\n\t\thasTemplateParts: templateParts ? !! templateParts.length : false,\n\t\tisLoading,\n\t\ttemplatePartAreas: getTemplatePartAreas( templateParts ),\n\t};\n}\n"]}
|
|
@@ -8,7 +8,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { CORE_PATTERN_SOURCES, filterOutDuplicatesByName } from '../page-
|
|
11
|
+
import { CORE_PATTERN_SOURCES, filterOutDuplicatesByName } from '../page-patterns/utils';
|
|
12
12
|
import { unlock } from '../../lock-unlock';
|
|
13
13
|
import { store as editSiteStore } from '../../store';
|
|
14
14
|
export default function useThemePatterns() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js"],"names":["store","coreStore","useSelect","useMemo","CORE_PATTERN_SOURCES","filterOutDuplicatesByName","unlock","editSiteStore","useThemePatterns","blockPatterns","select","getSettings","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","getBlockPatterns","patterns","filter","pattern","includes","source"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SACCC,oBADD,EAECC,yBAFD,QAGO,wBAHP;AAIA,SAASC,MAAT,QAAuB,mBAAvB;AACA,SAASN,KAAK,IAAIO,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,gBAAT,GAA4B;AAC1C,QAAMC,aAAa,GAAGP,SAAS,CAAIQ,MAAF,IAAc;AAAA;;AAC9C,UAAM;AAAEC,MAAAA;AAAF,QAAkBL,MAAM,CAAEI,MAAM,CAAEH,aAAF,CAAR,CAA9B;AAEA,oCACCI,WAAW,GAAGC,qCADf,yEAECD,WAAW,GAAGE,2BAFf;AAIA,GAP8B,CAA/B;AASA,QAAMC,iBAAiB,GAAGZ,SAAS,CAAIQ,MAAF,IACpCA,MAAM,CAAET,SAAF,CAAN,CAAoBc,gBAApB,EADkC,CAAnC;AAIA,QAAMC,QAAQ,GAAGb,OAAO,CACvB,MACC,CAAE,IAAKM,aAAa,IAAI,EAAtB,CAAF,EAA8B,IAAKK,iBAAiB,IAAI,EAA1B,CAA9B,EACEG,MADF,CAEIC,OAAF,IACC,CAAEd,oBAAoB,CAACe,QAArB,CAA+BD,OAAO,CAACE,MAAvC,CAHL,EAKEH,MALF,CAKUZ,yBALV,CAFsB,EAQvB,CAAEI,aAAF,EAAiBK,iBAAjB,CARuB,CAAxB;AAWA,SAAOE,QAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tCORE_PATTERN_SOURCES,\n\tfilterOutDuplicatesByName,\n} from '../page-patterns/utils';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nexport default function useThemePatterns() {\n\tconst blockPatterns = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn (\n\t\t\tgetSettings().__experimentalAdditionalBlockPatterns ??\n\t\t\tgetSettings().__experimentalBlockPatterns\n\t\t);\n\t} );\n\n\tconst restBlockPatterns = useSelect( ( select ) =>\n\t\tselect( coreStore ).getBlockPatterns()\n\t);\n\n\tconst patterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( blockPatterns || [] ), ...( restBlockPatterns || [] ) ]\n\t\t\t\t.filter(\n\t\t\t\t\t( pattern ) =>\n\t\t\t\t\t\t! CORE_PATTERN_SOURCES.includes( pattern.source )\n\t\t\t\t)\n\t\t\t\t.filter( filterOutDuplicatesByName ),\n\t\t[ blockPatterns, restBlockPatterns ]\n\t);\n\n\treturn patterns;\n}\n"]}
|
|
@@ -3,13 +3,12 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item
|
|
6
|
+
import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item } from '@wordpress/components';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
8
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
9
9
|
import { useSelect } from '@wordpress/data';
|
|
10
10
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
11
11
|
import { useViewportMatch } from '@wordpress/compose';
|
|
12
|
-
import { getTemplatePartIcon } from '@wordpress/editor';
|
|
13
12
|
/**
|
|
14
13
|
* Internal dependencies
|
|
15
14
|
*/
|
|
@@ -20,40 +19,6 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
|
20
19
|
import AddNewTemplate from '../add-new-template';
|
|
21
20
|
import { store as editSiteStore } from '../../store';
|
|
22
21
|
import SidebarButton from '../sidebar-button';
|
|
23
|
-
const config = {
|
|
24
|
-
wp_template: {
|
|
25
|
-
labels: {
|
|
26
|
-
title: __('Templates'),
|
|
27
|
-
loading: __('Loading templates'),
|
|
28
|
-
notFound: __('No templates found'),
|
|
29
|
-
manage: __('Manage all templates'),
|
|
30
|
-
description: __('Express the layout of your site with templates.')
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
wp_template_part: {
|
|
34
|
-
labels: {
|
|
35
|
-
title: __('Library'),
|
|
36
|
-
loading: __('Loading library'),
|
|
37
|
-
notFound: __('No patterns found'),
|
|
38
|
-
manage: __('Manage all template parts'),
|
|
39
|
-
reusableBlocks: __('Manage patterns'),
|
|
40
|
-
description: __('Template Parts are small pieces of a layout that can be reused across multiple templates and always appear the same way. Common template parts include the site header, footer, or sidebar.')
|
|
41
|
-
},
|
|
42
|
-
sortCallback: items => {
|
|
43
|
-
const groupedByArea = items.reduce((accumulator, item) => {
|
|
44
|
-
const key = accumulator[item.area] ? item.area : 'rest';
|
|
45
|
-
accumulator[key].push(item);
|
|
46
|
-
return accumulator;
|
|
47
|
-
}, {
|
|
48
|
-
header: [],
|
|
49
|
-
footer: [],
|
|
50
|
-
sidebar: [],
|
|
51
|
-
rest: []
|
|
52
|
-
});
|
|
53
|
-
return [...groupedByArea.header, ...groupedByArea.footer, ...groupedByArea.sidebar, ...groupedByArea.rest];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
22
|
|
|
58
23
|
const TemplateItem = ({
|
|
59
24
|
postType,
|
|
@@ -70,11 +35,6 @@ const TemplateItem = ({
|
|
|
70
35
|
};
|
|
71
36
|
|
|
72
37
|
export default function SidebarNavigationScreenTemplates() {
|
|
73
|
-
const {
|
|
74
|
-
params: {
|
|
75
|
-
postType
|
|
76
|
-
}
|
|
77
|
-
} = useNavigator();
|
|
78
38
|
const isMobileViewport = useViewportMatch('medium', '<');
|
|
79
39
|
const isTemplatePartsMode = useSelect(select => {
|
|
80
40
|
const settings = select(editSiteStore).getSettings();
|
|
@@ -83,45 +43,35 @@ export default function SidebarNavigationScreenTemplates() {
|
|
|
83
43
|
const {
|
|
84
44
|
records: templates,
|
|
85
45
|
isResolving: isLoading
|
|
86
|
-
} = useEntityRecords('postType',
|
|
46
|
+
} = useEntityRecords('postType', 'wp_template', {
|
|
87
47
|
per_page: -1
|
|
88
48
|
});
|
|
89
|
-
|
|
49
|
+
const sortedTemplates = templates ? [...templates] : [];
|
|
90
50
|
sortedTemplates.sort((a, b) => a.title.rendered.localeCompare(b.title.rendered));
|
|
91
|
-
|
|
92
|
-
if (config[postType].sortCallback) {
|
|
93
|
-
sortedTemplates = config[postType].sortCallback(sortedTemplates);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
51
|
const browseAllLink = useLink({
|
|
97
|
-
path: '/
|
|
52
|
+
path: '/wp_template/all'
|
|
98
53
|
});
|
|
99
54
|
const canCreate = !isMobileViewport && !isTemplatePartsMode;
|
|
100
|
-
const isTemplateList = postType === 'wp_template';
|
|
101
55
|
return createElement(SidebarNavigationScreen, {
|
|
102
56
|
isRoot: isTemplatePartsMode,
|
|
103
|
-
title:
|
|
104
|
-
description:
|
|
57
|
+
title: __('Templates'),
|
|
58
|
+
description: __('Express the layout of your site with templates'),
|
|
105
59
|
actions: canCreate && createElement(AddNewTemplate, {
|
|
106
|
-
templateType:
|
|
60
|
+
templateType: 'wp_template',
|
|
107
61
|
toggleProps: {
|
|
108
62
|
as: SidebarButton
|
|
109
63
|
}
|
|
110
64
|
}),
|
|
111
|
-
content: createElement(Fragment, null, isLoading &&
|
|
112
|
-
postType:
|
|
65
|
+
content: createElement(Fragment, null, isLoading && __('Loading templates'), !isLoading && createElement(ItemGroup, null, !templates?.length && createElement(Item, null, __('No templates found')), sortedTemplates.map(template => createElement(TemplateItem, {
|
|
66
|
+
postType: 'wp_template',
|
|
113
67
|
postId: template.id,
|
|
114
68
|
key: template.id,
|
|
115
|
-
withChevron: true
|
|
116
|
-
icon: !isTemplateList && getTemplatePartIcon(template.area)
|
|
69
|
+
withChevron: true
|
|
117
70
|
}, decodeEntities(template.title?.rendered || template.slug))))),
|
|
118
|
-
footer: !isMobileViewport && createElement(
|
|
71
|
+
footer: !isMobileViewport && createElement(SidebarNavigationItem, {
|
|
119
72
|
withChevron: true,
|
|
120
73
|
...browseAllLink
|
|
121
|
-
},
|
|
122
|
-
as: "a",
|
|
123
|
-
href: "edit.php?post_type=wp_block"
|
|
124
|
-
}, config[postType].labels.reusableBlocks))
|
|
74
|
+
}, __('Manage all templates'))
|
|
125
75
|
});
|
|
126
76
|
}
|
|
127
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalUseNavigator","useNavigator","__","useEntityRecords","useSelect","decodeEntities","useViewportMatch","getTemplatePartIcon","SidebarNavigationScreen","useLink","SidebarNavigationItem","AddNewTemplate","store","editSiteStore","SidebarButton","config","wp_template","labels","title","loading","notFound","manage","description","wp_template_part","reusableBlocks","sortCallback","items","groupedByArea","reduce","accumulator","item","key","area","push","header","footer","sidebar","rest","TemplateItem","postType","postId","props","linkInfo","SidebarNavigationScreenTemplates","params","isMobileViewport","isTemplatePartsMode","select","settings","getSettings","supportsTemplatePartsMode","records","templates","isResolving","isLoading","per_page","sortedTemplates","sort","a","b","rendered","localeCompare","browseAllLink","path","canCreate","isTemplateList","as","length","map","template","id","slug"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,kBAAkB,IAAIC,IAFvB,EAGCC,0BAA0B,IAAIC,YAH/B,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,gBAAT,QAAiC,sBAAjC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,mBAAT,QAAoC,mBAApC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,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B,CAA0BG,QAD7B,CAFF,EAMGoC,eAAe,CAACY,GAAhB,CAAuBC,QAAF,IACtB,cAAC,YAAD;AACC,MAAA,QAAQ,EAAG9B,QADZ;AAEC,MAAA,MAAM,EAAG8B,QAAQ,CAACC,EAFnB;AAGC,MAAA,GAAG,EAAGD,QAAQ,CAACC,EAHhB;AAIC,MAAA,WAAW,MAJZ;AAKC,MAAA,IAAI,EACH,CAAEL,cAAF,IACA1D,mBAAmB,CAAE8D,QAAQ,CAACrC,IAAX;AAPrB,OAUG3B,cAAc,CACfgE,QAAQ,CAACnD,KAAT,EAAgB0C,QAAhB,IACCS,QAAQ,CAACE,IAFK,CAVjB,CADC,CANH,CAHF,CAfF;AA6CC,IAAA,MAAM,EACL,CAAE1B,gBAAF,IACC,8BACC,cAAC,qBAAD;AAAuB,MAAA,WAAW,MAAlC;AAAA,SAAwCiB;AAAxC,OACG/C,MAAM,CAAEwB,QAAF,CAAN,CAAmBtB,MAAnB,CAA0BI,MAD7B,CADD,EAIG,CAAC,CAAEN,MAAM,CAAEwB,QAAF,CAAN,CAAmBtB,MAAnB,CAA0BO,cAA7B,IACD,cAAC,qBAAD;AACC,MAAA,EAAE,EAAC,GADJ;AAEC,MAAA,IAAI,EAAC;AAFN,OAIGT,MAAM,CAAEwB,QAAF,CAAN,CAAmBtB,MAAnB,CAA0BO,cAJ7B,CALF;AA/CH,IADD;AAiEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { getTemplatePartIcon } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nconst config = {\n\twp_template: {\n\t\tlabels: {\n\t\t\ttitle: __( 'Templates' ),\n\t\t\tloading: __( 'Loading templates' ),\n\t\t\tnotFound: __( 'No templates found' ),\n\t\t\tmanage: __( 'Manage all templates' ),\n\t\t\tdescription: __(\n\t\t\t\t'Express the layout of your site with templates.'\n\t\t\t),\n\t\t},\n\t},\n\twp_template_part: {\n\t\tlabels: {\n\t\t\ttitle: __( 'Library' ),\n\t\t\tloading: __( 'Loading library' ),\n\t\t\tnotFound: __( 'No patterns found' ),\n\t\t\tmanage: __( 'Manage all template parts' ),\n\t\t\treusableBlocks: __( 'Manage patterns' ),\n\t\t\tdescription: __(\n\t\t\t\t'Template Parts are small pieces of a layout that can be reused across multiple templates and always appear the same way. Common template parts include the site header, footer, or sidebar.'\n\t\t\t),\n\t\t},\n\t\tsortCallback: ( items ) => {\n\t\t\tconst groupedByArea = items.reduce(\n\t\t\t\t( accumulator, item ) => {\n\t\t\t\t\tconst key = accumulator[ item.area ] ? item.area : 'rest';\n\t\t\t\t\taccumulator[ key ].push( item );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ header: [], footer: [], sidebar: [], rest: [] }\n\t\t\t);\n\t\t\treturn [\n\t\t\t\t...groupedByArea.header,\n\t\t\t\t...groupedByArea.footer,\n\t\t\t\t...groupedByArea.sidebar,\n\t\t\t\t...groupedByArea.rest,\n\t\t\t];\n\t\t},\n\t},\n};\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates() {\n\tconst {\n\t\tparams: { postType },\n\t} = useNavigator();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tpostType,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tlet sortedTemplates = templates ? [ ...templates ] : [];\n\tsortedTemplates.sort( ( a, b ) =>\n\t\ta.title.rendered.localeCompare( b.title.rendered )\n\t);\n\tif ( config[ postType ].sortCallback ) {\n\t\tsortedTemplates = config[ postType ].sortCallback( sortedTemplates );\n\t}\n\n\tconst browseAllLink = useLink( {\n\t\tpath: '/' + postType + '/all',\n\t} );\n\n\tconst canCreate = ! isMobileViewport && ! isTemplatePartsMode;\n\tconst isTemplateList = postType === 'wp_template';\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ isTemplatePartsMode }\n\t\t\ttitle={ config[ postType ].labels.title }\n\t\t\tdescription={ config[ postType ].labels.description }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ postType }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: SidebarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && config[ postType ].labels.loading }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t{ ! templates?.length && (\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t{ config[ postType ].labels.notFound }\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ sortedTemplates.map( ( template ) => (\n\t\t\t\t\t\t\t\t<TemplateItem\n\t\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t! isTemplateList &&\n\t\t\t\t\t\t\t\t\t\tgetTemplatePartIcon( template.area )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\ttemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\ttemplate.slug\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</TemplateItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<SidebarNavigationItem withChevron { ...browseAllLink }>\n\t\t\t\t\t\t\t{ config[ postType ].labels.manage }\n\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t\t{ !! config[ postType ].labels.reusableBlocks && (\n\t\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\t\tas=\"a\"\n\t\t\t\t\t\t\t\thref=\"edit.php?post_type=wp_block\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ config[ postType ].labels.reusableBlocks }\n\t\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t)\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__","useEntityRecords","useSelect","decodeEntities","useViewportMatch","SidebarNavigationScreen","useLink","SidebarNavigationItem","AddNewTemplate","store","editSiteStore","SidebarButton","TemplateItem","postType","postId","props","linkInfo","SidebarNavigationScreenTemplates","isMobileViewport","isTemplatePartsMode","select","settings","getSettings","supportsTemplatePartsMode","records","templates","isResolving","isLoading","per_page","sortedTemplates","sort","a","b","title","rendered","localeCompare","browseAllLink","path","canCreate","as","length","map","template","id","slug"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,kBAAkB,IAAIC,IAFvB,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,gBAAT,QAAiC,sBAAjC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,OAAT,QAAwB,gBAAxB;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,OAAOC,cAAP,MAA2B,qBAA3B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;;AAEA,MAAMC,YAAY,GAAG,CAAE;AAAEC,EAAAA,QAAF;AAAYC,EAAAA,MAAZ;AAAoB,KAAGC;AAAvB,CAAF,KAAsC;AAC1D,QAAMC,QAAQ,GAAGV,OAAO,CAAE;AACzBO,IAAAA,QADyB;AAEzBC,IAAAA;AAFyB,GAAF,CAAxB;AAIA,SAAO,cAAC,qBAAD,OAA4BE,QAA5B;AAAA,OAA4CD;AAA5C,IAAP;AACA,CAND;;AAQA,eAAe,SAASE,gCAAT,GAA4C;AAC1D,QAAMC,gBAAgB,GAAGd,gBAAgB,CAAE,QAAF,EAAY,GAAZ,CAAzC;AACA,QAAMe,mBAAmB,GAAGjB,SAAS,CAAIkB,MAAF,IAAc;AACpD,UAAMC,QAAQ,GAAGD,MAAM,CAAEV,aAAF,CAAN,CAAwBY,WAAxB,EAAjB;AAEA,WAAO,CAAC,CAAED,QAAQ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,EAAGA,QAAQ,CAACC,EAFnB;AAGC,MAAA,GAAG,EAAGD,QAAQ,CAACC,EAHhB;AAIC,MAAA,WAAW;AAJZ,OAMGxC,cAAc,CACfuC,QAAQ,CAACT,KAAT,EAAgBC,QAAhB,IACCQ,QAAQ,CAACE,IAFK,CANjB,CADC,CAJH,CAHF,CAjBF;AAyCC,IAAA,MAAM,EACL,CAAE1B,gBAAF,IACC,cAAC,qBAAD;AAAuB,MAAA,WAAW,MAAlC;AAAA,SAAwCkB;AAAxC,OACGpC,EAAE,CAAE,sBAAF,CADL;AA3CH,IADD;AAmDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\t'wp_template',\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tconst sortedTemplates = templates ? [ ...templates ] : [];\n\tsortedTemplates.sort( ( a, b ) =>\n\t\ta.title.rendered.localeCompare( b.title.rendered )\n\t);\n\n\tconst browseAllLink = useLink( { path: '/wp_template/all' } );\n\tconst canCreate = ! isMobileViewport && ! isTemplatePartsMode;\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ isTemplatePartsMode }\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Express the layout of your site with templates'\n\t\t\t) }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ 'wp_template' }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: SidebarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading templates' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t{ ! templates?.length && (\n\t\t\t\t\t\t\t\t<Item>{ __( 'No templates found' ) }</Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ sortedTemplates.map( ( template ) => (\n\t\t\t\t\t\t\t\t<TemplateItem\n\t\t\t\t\t\t\t\t\tpostType={ 'wp_template' }\n\t\t\t\t\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\ttemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\ttemplate.slug\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</TemplateItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<SidebarNavigationItem withChevron { ...browseAllLink }>\n\t\t\t\t\t\t{ __( 'Manage all templates' ) }\n\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t)\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -17,7 +17,8 @@ const config = {
|
|
|
17
17
|
},
|
|
18
18
|
wp_template_part: {
|
|
19
19
|
title: __('All template parts'),
|
|
20
|
-
description: __('Create new template parts, or reset any customizations made to the template parts supplied by your theme.')
|
|
20
|
+
description: __('Create new template parts, or reset any customizations made to the template parts supplied by your theme.'),
|
|
21
|
+
backPath: '/patterns'
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
24
|
export default function SidebarNavigationScreenTemplatesBrowse() {
|
|
@@ -28,7 +29,8 @@ export default function SidebarNavigationScreenTemplatesBrowse() {
|
|
|
28
29
|
} = useNavigator();
|
|
29
30
|
return createElement(SidebarNavigationScreen, {
|
|
30
31
|
title: config[postType].title,
|
|
31
|
-
description: config[postType].description
|
|
32
|
+
description: config[postType].description,
|
|
33
|
+
backPath: config[postType].backPath
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"names":["__","__experimentalUseNavigator","useNavigator","SidebarNavigationScreen","config","wp_template","title","description","wp_template_part","SidebarNavigationScreenTemplatesBrowse","params","postType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,KAAK,EAAEN,EAAE,CAAE,eAAF,CADG;AAEZO,IAAAA,WAAW,EAAEP,EAAE,CACd,iGADc;AAFH,GADC;AAOdQ,EAAAA,gBAAgB,EAAE;AACjBF,IAAAA,KAAK,EAAEN,EAAE,CAAE,oBAAF,CADQ;AAEjBO,IAAAA,WAAW,EAAEP,EAAE,CACd,2GADc;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"names":["__","__experimentalUseNavigator","useNavigator","SidebarNavigationScreen","config","wp_template","title","description","wp_template_part","backPath","SidebarNavigationScreenTemplatesBrowse","params","postType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,KAAK,EAAEN,EAAE,CAAE,eAAF,CADG;AAEZO,IAAAA,WAAW,EAAEP,EAAE,CACd,iGADc;AAFH,GADC;AAOdQ,EAAAA,gBAAgB,EAAE;AACjBF,IAAAA,KAAK,EAAEN,EAAE,CAAE,oBAAF,CADQ;AAEjBO,IAAAA,WAAW,EAAEP,EAAE,CACd,2GADc,CAFE;AAKjBS,IAAAA,QAAQ,EAAE;AALO;AAPJ,CAAf;AAgBA,eAAe,SAASC,sCAAT,GAAkD;AAChE,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADH,MAEFV,YAAY,EAFhB;AAGA,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGE,MAAM,CAAEQ,QAAF,CAAN,CAAmBN,KAD5B;AAEC,IAAA,WAAW,EAAGF,MAAM,CAAEQ,QAAF,CAAN,CAAmBL,WAFlC;AAGC,IAAA,QAAQ,EAAGH,MAAM,CAAEQ,QAAF,CAAN,CAAmBH;AAH/B,IADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\n\nconst config = {\n\twp_template: {\n\t\ttitle: __( 'All templates' ),\n\t\tdescription: __(\n\t\t\t'Create new templates, or reset any customizations made to the templates supplied by your theme.'\n\t\t),\n\t},\n\twp_template_part: {\n\t\ttitle: __( 'All template parts' ),\n\t\tdescription: __(\n\t\t\t'Create new template parts, or reset any customizations made to the template parts supplied by your theme.'\n\t\t),\n\t\tbackPath: '/patterns',\n\t},\n};\n\nexport default function SidebarNavigationScreenTemplatesBrowse() {\n\tconst {\n\t\tparams: { postType },\n\t} = useNavigator();\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ config[ postType ].title }\n\t\t\tdescription={ config[ postType ].description }\n\t\t\tbackPath={ config[ postType ].backPath }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -81,7 +81,7 @@ export default function useSyncPathWithURL() {
|
|
|
81
81
|
postId: navigatorParams?.postId,
|
|
82
82
|
path: undefined
|
|
83
83
|
});
|
|
84
|
-
} else if (navigatorLocation.path === '/
|
|
84
|
+
} else if (navigatorLocation.path === '/patterns') {
|
|
85
85
|
updateUrlParams({
|
|
86
86
|
postType: undefined,
|
|
87
87
|
postId: undefined,
|