@wordpress/edit-site 5.12.5 → 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
|
@@ -4,14 +4,12 @@
|
|
|
4
4
|
import {
|
|
5
5
|
__experimentalItemGroup as ItemGroup,
|
|
6
6
|
__experimentalItem as Item,
|
|
7
|
-
__experimentalUseNavigator as useNavigator,
|
|
8
7
|
} from '@wordpress/components';
|
|
9
8
|
import { __ } from '@wordpress/i18n';
|
|
10
9
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
11
10
|
import { useSelect } from '@wordpress/data';
|
|
12
11
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
13
12
|
import { useViewportMatch } from '@wordpress/compose';
|
|
14
|
-
import { getTemplatePartIcon } from '@wordpress/editor';
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
15
|
* Internal dependencies
|
|
@@ -23,48 +21,6 @@ import AddNewTemplate from '../add-new-template';
|
|
|
23
21
|
import { store as editSiteStore } from '../../store';
|
|
24
22
|
import SidebarButton from '../sidebar-button';
|
|
25
23
|
|
|
26
|
-
const config = {
|
|
27
|
-
wp_template: {
|
|
28
|
-
labels: {
|
|
29
|
-
title: __( 'Templates' ),
|
|
30
|
-
loading: __( 'Loading templates' ),
|
|
31
|
-
notFound: __( 'No templates found' ),
|
|
32
|
-
manage: __( 'Manage all templates' ),
|
|
33
|
-
description: __(
|
|
34
|
-
'Express the layout of your site with templates.'
|
|
35
|
-
),
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
wp_template_part: {
|
|
39
|
-
labels: {
|
|
40
|
-
title: __( 'Library' ),
|
|
41
|
-
loading: __( 'Loading library' ),
|
|
42
|
-
notFound: __( 'No patterns found' ),
|
|
43
|
-
manage: __( 'Manage all template parts' ),
|
|
44
|
-
reusableBlocks: __( 'Manage patterns' ),
|
|
45
|
-
description: __(
|
|
46
|
-
'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.'
|
|
47
|
-
),
|
|
48
|
-
},
|
|
49
|
-
sortCallback: ( items ) => {
|
|
50
|
-
const groupedByArea = items.reduce(
|
|
51
|
-
( accumulator, item ) => {
|
|
52
|
-
const key = accumulator[ item.area ] ? item.area : 'rest';
|
|
53
|
-
accumulator[ key ].push( item );
|
|
54
|
-
return accumulator;
|
|
55
|
-
},
|
|
56
|
-
{ header: [], footer: [], sidebar: [], rest: [] }
|
|
57
|
-
);
|
|
58
|
-
return [
|
|
59
|
-
...groupedByArea.header,
|
|
60
|
-
...groupedByArea.footer,
|
|
61
|
-
...groupedByArea.sidebar,
|
|
62
|
-
...groupedByArea.rest,
|
|
63
|
-
];
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
|
|
68
24
|
const TemplateItem = ( { postType, postId, ...props } ) => {
|
|
69
25
|
const linkInfo = useLink( {
|
|
70
26
|
postType,
|
|
@@ -74,9 +30,6 @@ const TemplateItem = ( { postType, postId, ...props } ) => {
|
|
|
74
30
|
};
|
|
75
31
|
|
|
76
32
|
export default function SidebarNavigationScreenTemplates() {
|
|
77
|
-
const {
|
|
78
|
-
params: { postType },
|
|
79
|
-
} = useNavigator();
|
|
80
33
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
81
34
|
const isTemplatePartsMode = useSelect( ( select ) => {
|
|
82
35
|
const settings = select( editSiteStore ).getSettings();
|
|
@@ -86,34 +39,30 @@ export default function SidebarNavigationScreenTemplates() {
|
|
|
86
39
|
|
|
87
40
|
const { records: templates, isResolving: isLoading } = useEntityRecords(
|
|
88
41
|
'postType',
|
|
89
|
-
|
|
42
|
+
'wp_template',
|
|
90
43
|
{
|
|
91
44
|
per_page: -1,
|
|
92
45
|
}
|
|
93
46
|
);
|
|
94
|
-
|
|
47
|
+
|
|
48
|
+
const sortedTemplates = templates ? [ ...templates ] : [];
|
|
95
49
|
sortedTemplates.sort( ( a, b ) =>
|
|
96
50
|
a.title.rendered.localeCompare( b.title.rendered )
|
|
97
51
|
);
|
|
98
|
-
if ( config[ postType ].sortCallback ) {
|
|
99
|
-
sortedTemplates = config[ postType ].sortCallback( sortedTemplates );
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const browseAllLink = useLink( {
|
|
103
|
-
path: '/' + postType + '/all',
|
|
104
|
-
} );
|
|
105
52
|
|
|
53
|
+
const browseAllLink = useLink( { path: '/wp_template/all' } );
|
|
106
54
|
const canCreate = ! isMobileViewport && ! isTemplatePartsMode;
|
|
107
|
-
const isTemplateList = postType === 'wp_template';
|
|
108
55
|
return (
|
|
109
56
|
<SidebarNavigationScreen
|
|
110
57
|
isRoot={ isTemplatePartsMode }
|
|
111
|
-
title={
|
|
112
|
-
description={
|
|
58
|
+
title={ __( 'Templates' ) }
|
|
59
|
+
description={ __(
|
|
60
|
+
'Express the layout of your site with templates'
|
|
61
|
+
) }
|
|
113
62
|
actions={
|
|
114
63
|
canCreate && (
|
|
115
64
|
<AddNewTemplate
|
|
116
|
-
templateType={
|
|
65
|
+
templateType={ 'wp_template' }
|
|
117
66
|
toggleProps={ {
|
|
118
67
|
as: SidebarButton,
|
|
119
68
|
} }
|
|
@@ -122,24 +71,18 @@ export default function SidebarNavigationScreenTemplates() {
|
|
|
122
71
|
}
|
|
123
72
|
content={
|
|
124
73
|
<>
|
|
125
|
-
{ isLoading &&
|
|
74
|
+
{ isLoading && __( 'Loading templates' ) }
|
|
126
75
|
{ ! isLoading && (
|
|
127
76
|
<ItemGroup>
|
|
128
77
|
{ ! templates?.length && (
|
|
129
|
-
<Item>
|
|
130
|
-
{ config[ postType ].labels.notFound }
|
|
131
|
-
</Item>
|
|
78
|
+
<Item>{ __( 'No templates found' ) }</Item>
|
|
132
79
|
) }
|
|
133
80
|
{ sortedTemplates.map( ( template ) => (
|
|
134
81
|
<TemplateItem
|
|
135
|
-
postType={
|
|
82
|
+
postType={ 'wp_template' }
|
|
136
83
|
postId={ template.id }
|
|
137
84
|
key={ template.id }
|
|
138
85
|
withChevron
|
|
139
|
-
icon={
|
|
140
|
-
! isTemplateList &&
|
|
141
|
-
getTemplatePartIcon( template.area )
|
|
142
|
-
}
|
|
143
86
|
>
|
|
144
87
|
{ decodeEntities(
|
|
145
88
|
template.title?.rendered ||
|
|
@@ -153,19 +96,9 @@ export default function SidebarNavigationScreenTemplates() {
|
|
|
153
96
|
}
|
|
154
97
|
footer={
|
|
155
98
|
! isMobileViewport && (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
</SidebarNavigationItem>
|
|
160
|
-
{ !! config[ postType ].labels.reusableBlocks && (
|
|
161
|
-
<SidebarNavigationItem
|
|
162
|
-
as="a"
|
|
163
|
-
href="edit.php?post_type=wp_block"
|
|
164
|
-
>
|
|
165
|
-
{ config[ postType ].labels.reusableBlocks }
|
|
166
|
-
</SidebarNavigationItem>
|
|
167
|
-
) }
|
|
168
|
-
</>
|
|
99
|
+
<SidebarNavigationItem withChevron { ...browseAllLink }>
|
|
100
|
+
{ __( 'Manage all templates' ) }
|
|
101
|
+
</SidebarNavigationItem>
|
|
169
102
|
)
|
|
170
103
|
}
|
|
171
104
|
/>
|
|
@@ -21,6 +21,7 @@ const config = {
|
|
|
21
21
|
description: __(
|
|
22
22
|
'Create new template parts, or reset any customizations made to the template parts supplied by your theme.'
|
|
23
23
|
),
|
|
24
|
+
backPath: '/patterns',
|
|
24
25
|
},
|
|
25
26
|
};
|
|
26
27
|
|
|
@@ -32,6 +33,7 @@ export default function SidebarNavigationScreenTemplatesBrowse() {
|
|
|
32
33
|
<SidebarNavigationScreen
|
|
33
34
|
title={ config[ postType ].title }
|
|
34
35
|
description={ config[ postType ].description }
|
|
36
|
+
backPath={ config[ postType ].backPath }
|
|
35
37
|
/>
|
|
36
38
|
);
|
|
37
39
|
}
|
|
@@ -87,7 +87,7 @@ export default function useSyncPathWithURL() {
|
|
|
87
87
|
postId: navigatorParams?.postId,
|
|
88
88
|
path: undefined,
|
|
89
89
|
} );
|
|
90
|
-
} else if ( navigatorLocation.path === '/
|
|
90
|
+
} else if ( navigatorLocation.path === '/patterns' ) {
|
|
91
91
|
updateUrlParams( {
|
|
92
92
|
postType: undefined,
|
|
93
93
|
postId: undefined,
|
|
@@ -30,7 +30,7 @@ export default function WelcomeGuideEditor() {
|
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
32
|
<Guide
|
|
33
|
-
className="edit-site-welcome-guide"
|
|
33
|
+
className="edit-site-welcome-guide guide-editor"
|
|
34
34
|
contentLabel={ __( 'Welcome to the site editor' ) }
|
|
35
35
|
finishButtonText={ __( 'Get started' ) }
|
|
36
36
|
onFinish={ () => toggle( 'core/edit-site', 'welcomeGuide' ) }
|
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import WelcomeGuideEditor from './editor';
|
|
5
5
|
import WelcomeGuideStyles from './styles';
|
|
6
|
+
import WelcomeGuidePage from './page';
|
|
7
|
+
import WelcomeGuideTemplate from './template';
|
|
6
8
|
|
|
7
9
|
export default function WelcomeGuide() {
|
|
8
10
|
return (
|
|
9
11
|
<>
|
|
10
12
|
<WelcomeGuideEditor />
|
|
11
13
|
<WelcomeGuideStyles />
|
|
14
|
+
<WelcomeGuidePage />
|
|
15
|
+
<WelcomeGuideTemplate />
|
|
12
16
|
</>
|
|
13
17
|
);
|
|
14
18
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
|
+
import { Guide } from '@wordpress/components';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { store as editSiteStore } from '../../store';
|
|
13
|
+
|
|
14
|
+
export default function WelcomeGuidePage() {
|
|
15
|
+
const { toggle } = useDispatch( preferencesStore );
|
|
16
|
+
|
|
17
|
+
const isVisible = useSelect( ( select ) => {
|
|
18
|
+
const isPageActive = !! select( preferencesStore ).get(
|
|
19
|
+
'core/edit-site',
|
|
20
|
+
'welcomeGuidePage'
|
|
21
|
+
);
|
|
22
|
+
const isEditorActive = !! select( preferencesStore ).get(
|
|
23
|
+
'core/edit-site',
|
|
24
|
+
'welcomeGuide'
|
|
25
|
+
);
|
|
26
|
+
const { hasPageContentFocus } = select( editSiteStore );
|
|
27
|
+
return isPageActive && ! isEditorActive && hasPageContentFocus();
|
|
28
|
+
}, [] );
|
|
29
|
+
|
|
30
|
+
if ( ! isVisible ) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const heading = __( 'Editing your page' );
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Guide
|
|
38
|
+
className="edit-site-welcome-guide guide-page"
|
|
39
|
+
contentLabel={ heading }
|
|
40
|
+
finishButtonText={ __( 'Continue' ) }
|
|
41
|
+
onFinish={ () => toggle( 'core/edit-site', 'welcomeGuidePage' ) }
|
|
42
|
+
pages={ [
|
|
43
|
+
{
|
|
44
|
+
image: (
|
|
45
|
+
<video
|
|
46
|
+
className="edit-site-welcome-guide__video"
|
|
47
|
+
autoPlay
|
|
48
|
+
loop
|
|
49
|
+
muted
|
|
50
|
+
width="312"
|
|
51
|
+
height="240"
|
|
52
|
+
>
|
|
53
|
+
<source
|
|
54
|
+
src="https://s.w.org/images/block-editor/editing-your-page.mp4"
|
|
55
|
+
type="video/mp4"
|
|
56
|
+
/>
|
|
57
|
+
</video>
|
|
58
|
+
),
|
|
59
|
+
content: (
|
|
60
|
+
<>
|
|
61
|
+
<h1 className="edit-site-welcome-guide__heading">
|
|
62
|
+
{ heading }
|
|
63
|
+
</h1>
|
|
64
|
+
<p className="edit-site-welcome-guide__text">
|
|
65
|
+
{ __(
|
|
66
|
+
'We’ve recently introduced the ability to edit pages within the site editor. You can switch to editing your template using the settings sidebar.'
|
|
67
|
+
) }
|
|
68
|
+
</p>
|
|
69
|
+
</>
|
|
70
|
+
),
|
|
71
|
+
},
|
|
72
|
+
] }
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
.edit-site-welcome-guide {
|
|
2
2
|
width: 312px;
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
&.guide-editor .edit-site-welcome-guide__image
|
|
5
|
+
&.guide-styles .edit-site-welcome-guide__image {
|
|
5
6
|
background: #00a0d2;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&.guide-page .edit-site-welcome-guide__video {
|
|
10
|
+
border-right: #3858e9 $grid-unit-20 solid;
|
|
11
|
+
border-top: #3858e9 $grid-unit-20 solid;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&.guide-template .edit-site-welcome-guide__video {
|
|
15
|
+
border-left: #3858e9 $grid-unit-20 solid;
|
|
16
|
+
border-top: #3858e9 $grid-unit-20 solid;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&__image {
|
|
6
20
|
margin: 0 0 $grid-unit-20;
|
|
7
21
|
> img {
|
|
8
22
|
display: block;
|
|
@@ -38,7 +38,7 @@ export default function WelcomeGuideStyles() {
|
|
|
38
38
|
|
|
39
39
|
return (
|
|
40
40
|
<Guide
|
|
41
|
-
className="edit-site-welcome-guide"
|
|
41
|
+
className="edit-site-welcome-guide guide-styles"
|
|
42
42
|
contentLabel={ welcomeLabel }
|
|
43
43
|
finishButtonText={ __( 'Get started' ) }
|
|
44
44
|
onFinish={ () => toggle( 'core/edit-site', 'welcomeGuideStyles' ) }
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
|
+
import { Guide } from '@wordpress/components';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { store as editSiteStore } from '../../store';
|
|
13
|
+
|
|
14
|
+
export default function WelcomeGuideTemplate() {
|
|
15
|
+
const { toggle } = useDispatch( preferencesStore );
|
|
16
|
+
|
|
17
|
+
const isVisible = useSelect( ( select ) => {
|
|
18
|
+
const isTemplateActive = !! select( preferencesStore ).get(
|
|
19
|
+
'core/edit-site',
|
|
20
|
+
'welcomeGuideTemplate'
|
|
21
|
+
);
|
|
22
|
+
const isEditorActive = !! select( preferencesStore ).get(
|
|
23
|
+
'core/edit-site',
|
|
24
|
+
'welcomeGuide'
|
|
25
|
+
);
|
|
26
|
+
const { isPage, hasPageContentFocus } = select( editSiteStore );
|
|
27
|
+
return (
|
|
28
|
+
isTemplateActive &&
|
|
29
|
+
! isEditorActive &&
|
|
30
|
+
isPage() &&
|
|
31
|
+
! hasPageContentFocus()
|
|
32
|
+
);
|
|
33
|
+
}, [] );
|
|
34
|
+
|
|
35
|
+
if ( ! isVisible ) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const heading = __( 'Editing your template' );
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Guide
|
|
43
|
+
className="edit-site-welcome-guide guide-template"
|
|
44
|
+
contentLabel={ heading }
|
|
45
|
+
finishButtonText={ __( 'Continue' ) }
|
|
46
|
+
onFinish={ () =>
|
|
47
|
+
toggle( 'core/edit-site', 'welcomeGuideTemplate' )
|
|
48
|
+
}
|
|
49
|
+
pages={ [
|
|
50
|
+
{
|
|
51
|
+
image: (
|
|
52
|
+
<video
|
|
53
|
+
className="edit-site-welcome-guide__video"
|
|
54
|
+
autoPlay
|
|
55
|
+
loop
|
|
56
|
+
muted
|
|
57
|
+
width="312"
|
|
58
|
+
height="240"
|
|
59
|
+
>
|
|
60
|
+
<source
|
|
61
|
+
src="https://s.w.org/images/block-editor/editing-your-template.mp4"
|
|
62
|
+
type="video/mp4"
|
|
63
|
+
/>
|
|
64
|
+
</video>
|
|
65
|
+
),
|
|
66
|
+
content: (
|
|
67
|
+
<>
|
|
68
|
+
<h1 className="edit-site-welcome-guide__heading">
|
|
69
|
+
{ heading }
|
|
70
|
+
</h1>
|
|
71
|
+
<p className="edit-site-welcome-guide__text">
|
|
72
|
+
{ __(
|
|
73
|
+
'You’re now editing your page’s template. To switch back to editing your page you can click the back button in the toolbar.'
|
|
74
|
+
) }
|
|
75
|
+
</p>
|
|
76
|
+
</>
|
|
77
|
+
),
|
|
78
|
+
},
|
|
79
|
+
] }
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -10,6 +10,7 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
|
10
10
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
11
11
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
12
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
13
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Internal dependencies
|
|
@@ -104,14 +105,19 @@ export function useCommonCommands() {
|
|
|
104
105
|
useDispatch( editSiteStore )
|
|
105
106
|
);
|
|
106
107
|
const { set } = useDispatch( preferencesStore );
|
|
108
|
+
const { createInfoNotice } = useDispatch( noticesStore );
|
|
107
109
|
const history = useHistory();
|
|
108
|
-
const { homeUrl } = useSelect( ( select ) => {
|
|
110
|
+
const { homeUrl, isDistractionFree } = useSelect( ( select ) => {
|
|
109
111
|
const {
|
|
110
112
|
getUnstableBase, // Site index.
|
|
111
113
|
} = select( coreStore );
|
|
112
114
|
|
|
113
115
|
return {
|
|
114
116
|
homeUrl: getUnstableBase()?.home,
|
|
117
|
+
isDistractionFree: select( preferencesStore ).get(
|
|
118
|
+
editSiteStore.name,
|
|
119
|
+
'distractionFree'
|
|
120
|
+
),
|
|
115
121
|
};
|
|
116
122
|
}, [] );
|
|
117
123
|
|
|
@@ -139,6 +145,12 @@ export function useCommonCommands() {
|
|
|
139
145
|
path: '/wp_global_styles',
|
|
140
146
|
canvas: 'edit',
|
|
141
147
|
} );
|
|
148
|
+
if ( isDistractionFree ) {
|
|
149
|
+
set( editSiteStore.name, 'distractionFree', false );
|
|
150
|
+
createInfoNotice( __( 'Distraction free mode turned off.' ), {
|
|
151
|
+
type: 'snackbar',
|
|
152
|
+
} );
|
|
153
|
+
}
|
|
142
154
|
openGeneralSidebar( 'edit-site/global-styles' );
|
|
143
155
|
},
|
|
144
156
|
icon: styles,
|
|
@@ -111,6 +111,10 @@ function useManipulateDocumentCommands() {
|
|
|
111
111
|
template.type === 'wp_template'
|
|
112
112
|
? __( 'Delete template' )
|
|
113
113
|
: __( 'Delete template part' );
|
|
114
|
+
const path =
|
|
115
|
+
template.type === 'wp_template'
|
|
116
|
+
? '/wp_template'
|
|
117
|
+
: '/wp_template_part/all';
|
|
114
118
|
commands.push( {
|
|
115
119
|
name: 'core/remove-template',
|
|
116
120
|
label,
|
|
@@ -119,7 +123,7 @@ function useManipulateDocumentCommands() {
|
|
|
119
123
|
removeTemplate( template );
|
|
120
124
|
// Navigate to the template list
|
|
121
125
|
history.push( {
|
|
122
|
-
path
|
|
126
|
+
path,
|
|
123
127
|
} );
|
|
124
128
|
close();
|
|
125
129
|
},
|
package/src/index.js
CHANGED
|
@@ -67,6 +67,8 @@ export function initializeEditor( id, settings ) {
|
|
|
67
67
|
keepCaretInsideBlock: false,
|
|
68
68
|
welcomeGuide: true,
|
|
69
69
|
welcomeGuideStyles: true,
|
|
70
|
+
welcomeGuidePage: true,
|
|
71
|
+
welcomeGuideTemplate: true,
|
|
70
72
|
showListViewByDefault: false,
|
|
71
73
|
showBlockBreadcrumbs: true,
|
|
72
74
|
} );
|
package/src/store/actions.js
CHANGED
|
@@ -141,11 +141,18 @@ export const removeTemplate =
|
|
|
141
141
|
throw lastError;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
// Depending on how the entity was retrieved it's title might be
|
|
145
|
+
// an object or simple string.
|
|
146
|
+
const templateTitle =
|
|
147
|
+
typeof template.title === 'string'
|
|
148
|
+
? template.title
|
|
149
|
+
: template.title?.rendered;
|
|
150
|
+
|
|
144
151
|
registry.dispatch( noticesStore ).createSuccessNotice(
|
|
145
152
|
sprintf(
|
|
146
153
|
/* translators: The template/part's name. */
|
|
147
154
|
__( '"%s" deleted.' ),
|
|
148
|
-
decodeEntities(
|
|
155
|
+
decodeEntities( templateTitle )
|
|
149
156
|
),
|
|
150
157
|
{ type: 'snackbar', id: 'site-editor-template-deleted-success' }
|
|
151
158
|
);
|
package/src/style.scss
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
@import "./components/header-edit-mode/document-actions/style.scss";
|
|
11
11
|
@import "./components/list/style.scss";
|
|
12
12
|
@import "./components/page/style.scss";
|
|
13
|
-
@import "./components/page-
|
|
13
|
+
@import "./components/page-patterns/style.scss";
|
|
14
14
|
@import "./components/table/style.scss";
|
|
15
15
|
@import "./components/sidebar-edit-mode/style.scss";
|
|
16
16
|
@import "./components/sidebar-edit-mode/page-panels/style.scss";
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
@import "./components/sidebar-navigation-screen/style.scss";
|
|
34
34
|
@import "./components/sidebar-navigation-screen-details-footer/style.scss";
|
|
35
35
|
@import "./components/sidebar-navigation-screen-global-styles/style.scss";
|
|
36
|
-
@import "./components/sidebar-navigation-screen-library/style.scss";
|
|
37
36
|
@import "./components/sidebar-navigation-screen-navigation-menu/style.scss";
|
|
38
37
|
@import "./components/sidebar-navigation-screen-page/style.scss";
|
|
39
38
|
@import "components/sidebar-navigation-screen-details-panel/style.scss";
|
|
40
39
|
@import "./components/sidebar-navigation-screen-pattern/style.scss";
|
|
40
|
+
@import "./components/sidebar-navigation-screen-patterns/style.scss";
|
|
41
41
|
@import "./components/sidebar-navigation-screen-template/style.scss";
|
|
42
42
|
@import "./components/site-hub/style.scss";
|
|
43
43
|
@import "./components/sidebar-navigation-screen-navigation-menus/style.scss";
|
|
@@ -15,9 +15,10 @@ export default function getIsListPage(
|
|
|
15
15
|
) {
|
|
16
16
|
return (
|
|
17
17
|
path === '/wp_template/all' ||
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
//
|
|
18
|
+
path === '/wp_template_part/all' ||
|
|
19
|
+
( path === '/patterns' &&
|
|
20
|
+
// Don't treat "/patterns" without categoryType and categoryId as a
|
|
21
|
+
// list page in mobile because the sidebar covers the whole page.
|
|
21
22
|
( ! isMobileViewport || ( !! categoryType && !! categoryId ) ) )
|
|
22
23
|
);
|
|
23
24
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/grid-item.js"],"names":["GridItem","categoryId","composite","icon","item","instanceId","descriptionId","isDeleteDialogOpen","setIsDeleteDialogOpen","__experimentalDeleteReusableBlock","reusableBlocksStore","createErrorNotice","createSuccessNotice","noticesStore","onClick","postType","type","postId","USER_PATTERNS","id","name","categoryType","canvas","onKeyDown","event","DELETE","keyCode","BACKSPACE","isEmpty","blocks","length","patternClassNames","previewClassNames","PATTERNS","deletePattern","error","errorMessage","message","code","isUserPattern","ariaDescription","description","undefined","title","display","moreHorizontal","placement","className","isSmall","describedBy","tabIndex"],"mappings":";;;;;;;;;AAoBA;;AAjBA;;AAKA;;AACA;;AASA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAoBA;AACA;AACA;AAIe,SAASA,QAAT,CAAmB;AAAEC,EAAAA,UAAF;AAAcC,EAAAA,SAAd;AAAyBC,EAAAA,IAAzB;AAA+BC,EAAAA;AA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,CAAE,KAAF;AAFvC,KAIG,cAAI,+CAAJ,CAJH,CA7EF,CADD;AAuFA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { BlockPreview } from '@wordpress/block-editor';\nimport {\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalHeading as Heading,\n\t__experimentalHStack as HStack,\n\t__unstableCompositeItem as CompositeItem,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Icon, moreHorizontal } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as reusableBlocksStore } from '@wordpress/reusable-blocks';\nimport { DELETE, BACKSPACE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { PATTERNS, USER_PATTERNS } from './utils';\nimport { useLink } from '../routes/link';\n\nexport default function GridItem( { categoryId, composite, icon, item } ) {\n\tconst instanceId = useInstanceId( GridItem );\n\tconst descriptionId = `edit-site-library__pattern-description-${ instanceId }`;\n\tconst [ isDeleteDialogOpen, setIsDeleteDialogOpen ] = useState( false );\n\n\tconst { __experimentalDeleteReusableBlock } =\n\t\tuseDispatch( reusableBlocksStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst { onClick } = useLink( {\n\t\tpostType: item.type,\n\t\tpostId: item.type === USER_PATTERNS ? item.id : item.name,\n\t\tcategoryId,\n\t\tcategoryType: item.type,\n\t\tcanvas: 'view',\n\t} );\n\n\tconst onKeyDown = ( event ) => {\n\t\tif ( DELETE === event.keyCode || BACKSPACE === event.keyCode ) {\n\t\t\tsetIsDeleteDialogOpen( true );\n\t\t}\n\t};\n\n\tconst isEmpty = ! item.blocks?.length;\n\tconst patternClassNames = classnames( 'edit-site-library__pattern', {\n\t\t'is-placeholder': isEmpty,\n\t} );\n\tconst previewClassNames = classnames( 'edit-site-library__preview', {\n\t\t'is-inactive': item.type === PATTERNS,\n\t} );\n\n\tconst deletePattern = async () => {\n\t\ttry {\n\t\t\tawait __experimentalDeleteReusableBlock( item.id );\n\t\t\tcreateSuccessNotice( __( 'Pattern successfully deleted.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the pattern.' );\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n\tconst isUserPattern = item.type === USER_PATTERNS;\n\tlet ariaDescription;\n\tif ( isUserPattern ) {\n\t\t// User patterns don't have descriptions, but can be edited and deleted, so include some help text.\n\t\tariaDescription = __(\n\t\t\t'Press Enter to edit, or Delete to delete the pattern.'\n\t\t);\n\t} else if ( item.description ) {\n\t\tariaDescription = item.description;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<div className={ patternClassNames }>\n\t\t\t\t<CompositeItem\n\t\t\t\t\tclassName={ previewClassNames }\n\t\t\t\t\trole=\"option\"\n\t\t\t\t\tas=\"div\"\n\t\t\t\t\t{ ...composite }\n\t\t\t\t\tonClick={ item.type !== PATTERNS ? onClick : undefined }\n\t\t\t\t\tonKeyDown={ isUserPattern ? onKeyDown : undefined }\n\t\t\t\t\taria-label={ item.title }\n\t\t\t\t\taria-describedby={\n\t\t\t\t\t\tariaDescription ? descriptionId : undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ isEmpty && __( 'Empty pattern' ) }\n\t\t\t\t\t{ ! isEmpty && <BlockPreview blocks={ item.blocks } /> }\n\t\t\t\t</CompositeItem>\n\t\t\t\t{ ariaDescription && (\n\t\t\t\t\t<div\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tstyle={ { display: 'none' } }\n\t\t\t\t\t\tid={ descriptionId }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ariaDescription }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<HStack\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tclassName=\"edit-site-library__footer\"\n\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\t\tclassName=\"edit-site-library__pattern-title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ icon && <Icon icon={ icon } /> }\n\t\t\t\t\t\t<Heading level={ 5 }>{ item.title }</Heading>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t{ item.type === USER_PATTERNS && (\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\ticon={ moreHorizontal }\n\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\tclassName=\"edit-site-library__dropdown\"\n\t\t\t\t\t\t\tpopoverProps={ { placement: 'bottom-end' } }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tclassName: 'edit-site-library__button',\n\t\t\t\t\t\t\t\tisSmall: true,\n\t\t\t\t\t\t\t\tdescribedBy: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: pattern name */\n\t\t\t\t\t\t\t\t\t__( 'Action menu for %s pattern' ),\n\t\t\t\t\t\t\t\t\titem.title\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t// The dropdown menu is not focusable using the\n\t\t\t\t\t\t\t\t// keyboard as this would interfere with the grid's\n\t\t\t\t\t\t\t\t// roving tab index system. Instead, keyboard users\n\t\t\t\t\t\t\t\t// use keyboard shortcuts to trigger actions.\n\t\t\t\t\t\t\t\ttabIndex: -1,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ () => (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetIsDeleteDialogOpen( true )\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\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</DropdownMenu>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</div>\n\t\t\t{ isDeleteDialogOpen && (\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tonConfirm={ deletePattern }\n\t\t\t\t\tonCancel={ () => setIsDeleteDialogOpen( false ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Are you sure you want to delete this pattern?' ) }\n\t\t\t\t</ConfirmDialog>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/grid.js"],"names":["Grid","categoryId","label","icon","items","composite","orientation","length","map","item","name"],"mappings":";;;;;;;;;;;AAGA;;AAQA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGe,SAASA,IAAT,CAAe;AAAEC,EAAAA,UAAF;AAAcC,EAAAA,KAAd;AAAqBC,EAAAA,IAArB;AAA2BC,EAAAA;AAA3B,CAAf,EAAoD;AAClE,QAAMC,SAAS,GAAG,6CAAmB;AAAEC,IAAAA,WAAW,EAAE;AAAf,GAAnB,CAAlB;;AAEA,MAAK,CAAEF,KAAK,EAAEG,MAAd,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,+BAAD,OACMF,SADN;AAEC,IAAA,IAAI,EAAC,SAFN;AAGC,IAAA,SAAS,EAAC,yBAHX;AAIC,kBAAaH;AAJd,KAMGE,KAAK,CAACI,GAAN,CAAaC,IAAF,IACZ,4BAAC,iBAAD;AACC,IAAA,GAAG,EAAGA,IAAI,CAACC,IADZ;AAEC,IAAA,IAAI,EAAGP,IAFR;AAGC,IAAA,IAAI,EAAGM,IAHR;AAIC,IAAA,UAAU,EAAGR,UAJd;AAKC,IAAA,SAAS,EAAGI;AALb,IADC,CANH,CADD;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport GridItem from './grid-item';\n\nexport default function Grid( { categoryId, label, icon, items } ) {\n\tconst composite = useCompositeState( { orientation: 'vertical' } );\n\n\tif ( ! items?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Composite\n\t\t\t{ ...composite }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"edit-site-library__grid\"\n\t\t\taria-label={ label }\n\t\t>\n\t\t\t{ items.map( ( item ) => (\n\t\t\t\t<GridItem\n\t\t\t\t\tkey={ item.name }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\titem={ item }\n\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\tcomposite={ composite }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</Composite>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/index.js"],"names":["ExperimentalBlockEditorProvider","blockEditorPrivateApis","PageLibrary","categoryType","categoryId","window","location","href","type","DEFAULT_TYPE","category","DEFAULT_CATEGORY","settings"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAKA;AACA;AACA;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAsC,wBAAQC,wBAAR,CAA5C;;AAEe,SAASC,WAAT,GAAuB;AACrC,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAA+B,uBAAcC,MAAM,CAACC,QAAP,CAAgBC,IAA9B,CAArC;AACA,QAAMC,IAAI,GAAGL,YAAY,IAAIM,mBAA7B;AACA,QAAMC,QAAQ,GAAGN,UAAU,IAAIO,uBAA/B;AACA,QAAMC,QAAQ,GAAG,kCAAjB,CAJqC,CAMrC;AACA;AACA;;AACA,SACC,4BAAC,+BAAD;AAAiC,IAAA,QAAQ,EAAGA;AAA5C,KACC,4BAAC,aAAD;AACC,IAAA,SAAS,EAAC,mBADX;AAEC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CAFT;AAGC,IAAA,eAAe;AAHhB,KAKC,4BAAC,qBAAD;AAAc,IAAA,IAAI,EAAGJ,IAArB;AAA4B,IAAA,UAAU,EAAGE;AAAzC,IALD,CADD,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { DEFAULT_CATEGORY, DEFAULT_TYPE } from './utils';\nimport Page from '../page';\nimport PatternsList from './patterns-list';\nimport useLibrarySettings from './use-library-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nexport default function PageLibrary() {\n\tconst { categoryType, categoryId } = getQueryArgs( window.location.href );\n\tconst type = categoryType || DEFAULT_TYPE;\n\tconst category = categoryId || DEFAULT_CATEGORY;\n\tconst settings = useLibrarySettings();\n\n\t// Wrap everything in a block editor provider.\n\t// This ensures 'styles' that are needed for the previews are synced\n\t// from the site editor store to the block editor store.\n\treturn (\n\t\t<ExperimentalBlockEditorProvider settings={ settings }>\n\t\t\t<Page\n\t\t\t\tclassName=\"edit-site-library\"\n\t\t\t\ttitle={ __( 'Library content' ) }\n\t\t\t\thideTitleFromUI\n\t\t\t>\n\t\t\t\t<PatternsList type={ type } categoryId={ category } />\n\t\t\t</Page>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/no-patterns.js"],"names":["NoPatterns"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,UAAT,GAAsB;AACpC,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,cAAI,oBAAJ,CADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport default function NoPatterns() {\n\treturn (\n\t\t<div className=\"edit-site-library__no-results\">\n\t\t\t{ __( 'No patterns found.' ) }\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/patterns-list.js"],"names":["useLocation","useHistory","routerPrivateApis","PatternsList","categoryId","type","location","history","isMobileViewport","filterValue","setFilterValue","delayedFilterValue","patterns","isResolving","syncedPatterns","unsyncedPatterns","hasPatterns","length","chevronRight","chevronLeft","state","backPath","back","push","path","value","symbol"],"mappings":";;;;;;;;;;;AAIA;;AAQA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAeA;AACA;AACA;AAQA,MAAM;AAAEA,EAAAA,WAAF;AAAeC,EAAAA;AAAf,IAA8B,wBAAQC,mBAAR,CAApC;;AAEe,SAASC,YAAT,CAAuB;AAAEC,EAAAA,UAAF;AAAcC,EAAAA;AAAd,CAAvB,EAA8C;AAC5D,QAAMC,QAAQ,GAAGN,WAAW,EAA5B;AACA,QAAMO,OAAO,GAAGN,UAAU,EAA1B;AACA,QAAMO,gBAAgB,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAzB;AACA,QAAM,CAAEC,WAAF,EAAeC,cAAf,EAA+BC,kBA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4BAAC,iCAAD;AAAS,IAAA,KAAK,EAAG;AAAjB,KAAuB,cAAI,QAAJ,CAAvB,CADD,EAEC,4BAAC,8BAAD;AAAM,IAAA,OAAO,EAAC,OAAd;AAAsB,IAAA,EAAE,EAAC;AAAzB,KACG,cACD,iDADC,CADH,CAFD,CADD,EASC,4BAAC,aAAD;AACC,IAAA,IAAI,EAAGS,aADR;AAEC,IAAA,UAAU,EAAGtB,UAFd;AAGC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CAHT;AAIC,IAAA,KAAK,EAAGU;AAJT,IATD,CA9BF,EA+CG,CAAED,WAAF,IAAiB,CAAC,CAAEE,gBAAgB,CAACE,MAArC,IACD,qDACC,4BAAC,gCAAD;AAAQ,IAAA,SAAS,EAAC;AAAlB,KACC,4BAAC,iCAAD;AAAS,IAAA,KAAK,EAAG;AAAjB,KAAuB,cAAI,UAAJ,CAAvB,CADD,EAEC,4BAAC,8BAAD;AAAM,IAAA,OAAO,EAAC,OAAd;AAAsB,IAAA,EAAE,EAAC;AAAzB,KACG,cACD,iEADC,CADH,CAFD,CADD,EASC,4BAAC,aAAD;AACC,IAAA,UAAU,EAAGb,UADd;AAEC,IAAA,KAAK,EAAG,cAAI,mBAAJ,CAFT;AAGC,IAAA,KAAK,EAAGW;AAHT,IATD,CAhDF,EAgEG,CAAEF,WAAF,IAAiB,CAAEG,WAAnB,IAAkC,4BAAC,mBAAD,OAhErC,CADD;AAoEA","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport {\n\tSearchControl,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tFlex,\n\tFlexBlock,\n} from '@wordpress/components';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { symbol, chevronLeft, chevronRight } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Grid from './grid';\nimport NoPatterns from './no-patterns';\nimport usePatterns from './use-patterns';\nimport SidebarButton from '../sidebar-button';\nimport useDebouncedInput from '../../utils/use-debounced-input';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport default function PatternsList( { categoryId, type } ) {\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst [ filterValue, setFilterValue, delayedFilterValue ] =\n\t\tuseDebouncedInput( '' );\n\n\tconst [ patterns, isResolving ] = usePatterns(\n\t\ttype,\n\t\tcategoryId,\n\t\tdelayedFilterValue\n\t);\n\n\tconst { syncedPatterns, unsyncedPatterns } = patterns;\n\tconst hasPatterns = !! syncedPatterns.length || !! unsyncedPatterns.length;\n\n\treturn (\n\t\t<VStack spacing={ 6 }>\n\t\t\t<Flex>\n\t\t\t\t{ isMobileViewport && (\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\tlabel={ __( 'Back' ) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t// Go back in history if we came from the library page.\n\t\t\t\t\t\t\t// Otherwise push a stack onto the history.\n\t\t\t\t\t\t\tif ( location.state?.backPath === '/library' ) {\n\t\t\t\t\t\t\t\thistory.back();\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\thistory.push( { path: '/library' } );\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\t<FlexBlock>\n\t\t\t\t\t<SearchControl\n\t\t\t\t\t\tclassName=\"edit-site-library__search\"\n\t\t\t\t\t\tonChange={ ( value ) => setFilterValue( value ) }\n\t\t\t\t\t\tplaceholder={ __( 'Search patterns' ) }\n\t\t\t\t\t\tlabel={ __( 'Search patterns' ) }\n\t\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</FlexBlock>\n\t\t\t</Flex>\n\t\t\t{ isResolving && __( 'Loading' ) }\n\t\t\t{ ! isResolving && !! syncedPatterns.length && (\n\t\t\t\t<>\n\t\t\t\t\t<VStack className=\"edit-site-library__section-header\">\n\t\t\t\t\t\t<Heading level={ 4 }>{ __( 'Synced' ) }</Heading>\n\t\t\t\t\t\t<Text variant=\"muted\" as=\"p\">\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Patterns that are kept in sync across your site'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</VStack>\n\t\t\t\t\t<Grid\n\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\t\tlabel={ __( 'Synced patterns' ) }\n\t\t\t\t\t\titems={ syncedPatterns }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! isResolving && !! unsyncedPatterns.length && (\n\t\t\t\t<>\n\t\t\t\t\t<VStack className=\"edit-site-library__section-header\">\n\t\t\t\t\t\t<Heading level={ 4 }>{ __( 'Standard' ) }</Heading>\n\t\t\t\t\t\t<Text variant=\"muted\" as=\"p\">\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Patterns that can be changed freely without affecting your site'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</VStack>\n\t\t\t\t\t<Grid\n\t\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\t\tlabel={ __( 'Standard patterns' ) }\n\t\t\t\t\t\titems={ unsyncedPatterns }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ ! isResolving && ! hasPatterns && <NoPatterns /> }\n\t\t</VStack>\n\t);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/search-items.js"],"names":["defaultGetName","item","name","defaultGetTitle","title","defaultGetDescription","description","defaultGetKeywords","keywords","defaultHasCategory","extractWords","input","splitRegexp","stripRegexp","split","filter","Boolean","normalizeSearchInput","replace","toLowerCase","getNormalizedSearchTerms","removeMatchingTerms","unmatchedTerms","unprocessedTerms","term","some","unprocessedTerm","includes","searchItems","items","searchInput","config","normalizedSearchTerms","onlyFilterByCategory","length","searchRankConfig","threshold","rankedItems","map","getItemSearchRank","rank","sort","rank1","rank2","searchTerm","categoryId","getName","getTitle","getDescription","getKeywords","hasCategory","normalizedSearchInput","normalizedTitle","startsWith","terms","join"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA;AACA,MAAMA,cAAc,GAAKC,IAAF,IAAYA,IAAI,CAACC,IAAL,IAAa,EAAhD;;AACA,MAAMC,eAAe,GAAKF,IAAF,IAAYA,IAAI,CAACG,KAAzC;;AACA,MAAMC,qBAAqB,GAAKJ,IAAF,IAAYA,IAAI,CAACK,WAAL,IAAoB,EAA9D;;AACA,MAAMC,kBAAkB,GAAKN,IAAF,IAAYA,IAAI,CAACO,QAAL,IAAiB,EAAxD;;AACA,MAAMC,kBAAkB,GAAG,MAAM,KAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,YAAT,CAAuBC,KAAK,GAAG,EAA/B,EAAoC;AACnC,SAAO,wBAAQA,KAAR,EAAe;AACrBC,IAAAA,WAAW,EAAE,CACZ,yCADY,EAC+B;AAC3C,sDAFY,CAEwC;AAFxC,KADQ;AAKrBC,IAAAA,WAAW,EAAE,yBALQ,CAKmB;;AALnB,GAAf,EAOLC,KAPK,CAOE,GAPF,EAQLC,MARK,CAQGC,OARH,CAAP;AASA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,oBAAT,CAA+BN,KAAK,GAAG,EAAvC,EAA4C;AAC3C;AACA;AACAA,EAAAA,KAAK,GAAG,4BAAeA,KAAf,CAAR,CAH2C,CAK3C;AACA;;AACAA,EAAAA,KAAK,GAAGA,KAAK,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AAE2B,UAAF,CAAlD;AACA,QAAMQ,eAAe,GAAGnC,oBAAoB,CAAEb,KAAF,CAA5C,CAzBsD,CA2BtD;AACA;AACA;;AACA,MAAK+C,qBAAqB,KAAKC,eAA/B,EAAiD;AAChDZ,IAAAA,IAAI,IAAI,EAAR;AACA,GAFD,MAEO,IAAKY,eAAe,CAACC,UAAhB,CAA4BF,qBAA5B,CAAL,EAA2D;AACjEX,IAAAA,IAAI,IAAI,EAAR;AACA,GAFM,MAEA;AACN,UAAMc,KAAK,GAAG,CAAEpD,IAAF,EAAQE,KAAR,EAAeE,WAAf,EAA4B,GAAGE,QAA/B,EAA0C+C,IAA1C,CAAgD,GAAhD,CAAd;AACA,UAAMvB,qBAAqB,GAAGtB,YAAY,CAAEyC,qBAAF,CAA1C;AACA,UAAM7B,cAAc,GAAGD,mBAAmB,CACzCW,qBADyC,EAEzCsB,KAFyC,CAA1C;;AAKA,QAAKhC,cAAc,CAACY,MAAf,KAA0B,CAA/B,EAAmC;AAClCM,MAAAA,IAAI,IAAI,EAAR;AACA;AACD;;AAED,SAAOA,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\nimport { noCase } from 'change-case';\n\n// Default search helpers.\nconst defaultGetName = ( item ) => item.name || '';\nconst defaultGetTitle = ( item ) => item.title;\nconst defaultGetDescription = ( item ) => item.description || '';\nconst defaultGetKeywords = ( item ) => item.keywords || [];\nconst defaultHasCategory = () => false;\n\n/**\n * Extracts words from an input string.\n *\n * @param {string} input The input string.\n *\n * @return {Array} Words, extracted from the input string.\n */\nfunction extractWords( input = '' ) {\n\treturn noCase( input, {\n\t\tsplitRegexp: [\n\t\t\t/([\\p{Ll}\\p{Lo}\\p{N}])([\\p{Lu}\\p{Lt}])/gu, // One lowercase or digit, followed by one uppercase.\n\t\t\t/([\\p{Lu}\\p{Lt}])([\\p{Lu}\\p{Lt}][\\p{Ll}\\p{Lo}])/gu, // One uppercase followed by one uppercase and one lowercase.\n\t\t],\n\t\tstripRegexp: /(\\p{C}|\\p{P}|\\p{S})+/giu, // Anything that's not a punctuation, symbol or control/format character.\n\t} )\n\t\t.split( ' ' )\n\t\t.filter( Boolean );\n}\n\n/**\n * Sanitizes the search input string.\n *\n * @param {string} input The search input to normalize.\n *\n * @return {string} The normalized search input.\n */\nfunction normalizeSearchInput( input = '' ) {\n\t// Disregard diacritics.\n\t// Input: \"média\"\n\tinput = removeAccents( input );\n\n\t// Accommodate leading slash, matching autocomplete expectations.\n\t// Input: \"/media\"\n\tinput = input.replace( /^\\//, '' );\n\n\t// Lowercase.\n\t// Input: \"MEDIA\"\n\tinput = input.toLowerCase();\n\n\treturn input;\n}\n\n/**\n * Converts the search term into a list of normalized terms.\n *\n * @param {string} input The search term to normalize.\n *\n * @return {string[]} The normalized list of search terms.\n */\nexport const getNormalizedSearchTerms = ( input = '' ) => {\n\treturn extractWords( normalizeSearchInput( input ) );\n};\n\nconst removeMatchingTerms = ( unmatchedTerms, unprocessedTerms ) => {\n\treturn unmatchedTerms.filter(\n\t\t( term ) =>\n\t\t\t! getNormalizedSearchTerms( unprocessedTerms ).some(\n\t\t\t\t( unprocessedTerm ) => unprocessedTerm.includes( term )\n\t\t\t)\n\t);\n};\n\n/**\n * Filters an item list given a search term.\n *\n * @param {Array} items Item list\n * @param {string} searchInput Search input.\n * @param {Object} config Search Config.\n *\n * @return {Array} Filtered item list.\n */\nexport const searchItems = ( items = [], searchInput = '', config = {} ) => {\n\tconst normalizedSearchTerms = getNormalizedSearchTerms( searchInput );\n\tconst onlyFilterByCategory = ! normalizedSearchTerms.length;\n\tconst searchRankConfig = { ...config, onlyFilterByCategory };\n\n\t// If we aren't filtering on search terms, matching on category is satisfactory.\n\t// If we are, then we need more than a category match.\n\tconst threshold = onlyFilterByCategory ? 0 : 1;\n\n\tconst rankedItems = items\n\t\t.map( ( item ) => {\n\t\t\treturn [\n\t\t\t\titem,\n\t\t\t\tgetItemSearchRank( item, searchInput, searchRankConfig ),\n\t\t\t];\n\t\t} )\n\t\t.filter( ( [ , rank ] ) => rank > threshold );\n\n\t// If we didn't have terms to search on, there's no point sorting.\n\tif ( normalizedSearchTerms.length === 0 ) {\n\t\treturn rankedItems.map( ( [ item ] ) => item );\n\t}\n\n\trankedItems.sort( ( [ , rank1 ], [ , rank2 ] ) => rank2 - rank1 );\n\treturn rankedItems.map( ( [ item ] ) => item );\n};\n\n/**\n * Get the search rank for a given item and a specific search term.\n * The better the match, the higher the rank.\n * If the rank equals 0, it should be excluded from the results.\n *\n * @param {Object} item Item to filter.\n * @param {string} searchTerm Search term.\n * @param {Object} config Search Config.\n *\n * @return {number} Search Rank.\n */\nfunction getItemSearchRank( item, searchTerm, config ) {\n\tconst {\n\t\tcategoryId,\n\t\tgetName = defaultGetName,\n\t\tgetTitle = defaultGetTitle,\n\t\tgetDescription = defaultGetDescription,\n\t\tgetKeywords = defaultGetKeywords,\n\t\thasCategory = defaultHasCategory,\n\t\tonlyFilterByCategory,\n\t} = config;\n\n\tlet rank = hasCategory( item, categoryId ) ? 1 : 0;\n\n\t// If an item doesn't belong to the current category or we don't have\n\t// search terms to filter by, return the initial rank value.\n\tif ( ! rank || onlyFilterByCategory ) {\n\t\treturn rank;\n\t}\n\n\tconst name = getName( item );\n\tconst title = getTitle( item );\n\tconst description = getDescription( item );\n\tconst keywords = getKeywords( item );\n\n\tconst normalizedSearchInput = normalizeSearchInput( searchTerm );\n\tconst normalizedTitle = normalizeSearchInput( title );\n\n\t// Prefers exact matches\n\t// Then prefers if the beginning of the title matches the search term\n\t// name, keywords, description matches come later.\n\tif ( normalizedSearchInput === normalizedTitle ) {\n\t\trank += 30;\n\t} else if ( normalizedTitle.startsWith( normalizedSearchInput ) ) {\n\t\trank += 20;\n\t} else {\n\t\tconst terms = [ name, title, description, ...keywords ].join( ' ' );\n\t\tconst normalizedSearchTerms = extractWords( normalizedSearchInput );\n\t\tconst unmatchedTerms = removeMatchingTerms(\n\t\t\tnormalizedSearchTerms,\n\t\t\tterms\n\t\t);\n\n\t\tif ( unmatchedTerms.length === 0 ) {\n\t\t\trank += 10;\n\t\t}\n\t}\n\n\treturn rank;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-library/use-library-settings.js"],"names":["useLibrarySettings","storedSettings","select","getSettings","editSiteStore","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","coreStore","getBlockPatterns","blockPatterns","filter","filterOutDuplicatesByName","settings","restStoredSettings","__unstableIsPreviewMode"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAZA;AACA;AACA;;AAKA;AACA;AACA;AAKe,SAASA,kBAAT,GAA8B;AAAA;;AAC5C,QAAMC,cAAc,GAAG,qBAAaC,MAAF,IAAc;AAC/C,UAAM;AAAEC,MAAAA;AAAF,QAAkB,wBAAQD,MAAM,CAAEE,YAAF,CAAd,CAAxB;AACA,WAAOD,WAAW,EAAlB;AACA,GAHsB,EAGpB,EAHoB,CAAvB;AAKA,QAAME,qBAAqB,4BAC1BJ,cAAc,CAACK,qCADW,yEAC8B;AACxDL,EAAAA,cAAc,CAACM,2BAFhB,CAN4C,CAQC;;AAE7C,QAAMC,iBAAiB,GAAG,qBACvBN,MAAF,IAAcA,MAAM,CAAEO,eAAF,CAAN,CAAoBC,gBAApB,EADW,EAEzB,EAFyB,CAA1B;AAKA,QAAMC,aAAa,GAAG,sBACrB,MACC,CACC,IAAKN,qBAAqB,IAAI,EAA9B,CADD,EAEC,IAAKG,iBAAiB,IAAI,EAA1B,CAFD,EAGEI,MAHF,CAGUC,gCAHV,CAFoB,EAMrB,CAAER,qBAAF,EAAyBG,iBAAzB,CANqB,CAAtB;AASA,QAAMM,QAAQ,GAAG,sBAAS,MAAM;AAC/B,UAAM;AAAER,MAAAA,qCAAF;AAAyC,SAAGS;AAA5C,QACLd,cADD;AAGA,WAAO,EACN,GAAGc,kBADG;AAENR,MAAAA,2BAA2B,EAAEI,aAFvB;AAGNK,MAAAA,uBAAuB,EAAE;AAHnB,KAAP;AAKA,GATgB,EASd,CAAEf,cAAF,EAAkBU,aAAlB,CATc,CAAjB;AAWA,SAAOG,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 { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport { filterOutDuplicatesByName } from './utils';\n\nexport default function useLibrarySettings() {\n\tconst storedSettings = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\treturn getSettings();\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\n\tconst restBlockPatterns = useSelect(\n\t\t( select ) => select( coreStore ).getBlockPatterns(),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t].filter( filterOutDuplicatesByName ),\n\t\t[ settingsBlockPatterns, restBlockPatterns ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\tconst { __experimentalAdditionalBlockPatterns, ...restStoredSettings } =\n\t\t\tstoredSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__unstableIsPreviewMode: true,\n\t\t};\n\t}, [ storedSettings, blockPatterns ] );\n\n\treturn settings;\n}\n"]}
|