@wordpress/edit-site 5.33.0 → 5.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/add-new-page/index.js +3 -0
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +8 -7
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +20 -5
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +3 -0
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +28 -5
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +9 -3
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +7 -2
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +22 -20
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +8 -2
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/header-edit-mode/index.js +33 -49
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +3 -97
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +0 -49
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +7 -4
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +9 -38
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-pages/index.js +4 -3
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +11 -7
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build/components/page-patterns/header.js +3 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +20 -49
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +1 -0
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/hooks.js.map +1 -0
- package/build/components/{page-templates-template-parts → page-templates}/index.js +67 -80
- package/build/components/page-templates/index.js.map +1 -0
- package/build/components/pattern-modal/duplicate.js +7 -5
- package/build/components/pattern-modal/duplicate.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +9 -0
- package/build/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +9 -6
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +3 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +40 -9
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +24 -17
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +2 -5
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +39 -8
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +6 -13
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +34 -28
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +5 -35
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/template-actions/index.js +1 -1
- package/build/components/template-actions/index.js.map +1 -1
- package/build/deprecated.js +55 -0
- package/build/deprecated.js.map +1 -0
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +35 -4
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +18 -18
- package/build/index.js.map +1 -1
- package/build/utils/constants.js +1 -2
- package/build/utils/constants.js.map +1 -1
- package/build-module/components/add-new-page/index.js +3 -0
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +8 -7
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +21 -6
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +3 -0
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +28 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +9 -3
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +7 -2
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +22 -20
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +8 -2
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +39 -55
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +5 -99
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +0 -49
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +7 -4
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +9 -38
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-pages/index.js +5 -4
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +11 -7
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build-module/components/page-patterns/header.js +3 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +22 -51
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +1 -0
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/hooks.js.map +1 -0
- package/build-module/components/{page-templates-template-parts → page-templates}/index.js +67 -80
- package/build-module/components/page-templates/index.js.map +1 -0
- package/build-module/components/pattern-modal/duplicate.js +7 -5
- package/build-module/components/pattern-modal/duplicate.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +8 -0
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +9 -6
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +4 -3
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +43 -12
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +25 -17
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +3 -6
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +40 -9
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +6 -13
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +35 -29
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +5 -35
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +1 -1
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/deprecated.js +45 -0
- package/build-module/deprecated.js.map +1 -0
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +34 -4
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +2 -4
- package/build-module/index.js.map +1 -1
- package/build-module/utils/constants.js +0 -1
- package/build-module/utils/constants.js.map +1 -1
- package/build-style/style-rtl.css +79 -125
- package/build-style/style.css +79 -125
- package/package.json +42 -42
- package/src/components/add-new-page/index.js +7 -1
- package/src/components/add-new-pattern/index.js +15 -12
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- package/src/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/src/components/block-editor/resize-handle.js +30 -11
- package/src/components/block-editor/style.scss +10 -15
- package/src/components/create-template-part-modal/index.js +3 -0
- package/src/components/editor/index.js +42 -3
- package/src/components/editor/style.scss +6 -1
- package/src/components/global-styles/font-library-modal/context.js +9 -3
- package/src/components/global-styles/font-library-modal/font-collection.js +31 -12
- package/src/components/global-styles/font-library-modal/installed-fonts.js +82 -54
- package/src/components/global-styles/font-library-modal/style.scss +17 -0
- package/src/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/src/components/global-styles/style-variations-container.js +11 -2
- package/src/components/header-edit-mode/index.js +56 -76
- package/src/components/header-edit-mode/more-menu/index.js +8 -145
- package/src/components/header-edit-mode/style.scss +13 -85
- package/src/components/keyboard-shortcuts/register.js +0 -58
- package/src/components/layout/index.js +11 -2
- package/src/components/layout/router.js +9 -49
- package/src/components/page-pages/index.js +14 -4
- package/src/components/page-pages/style.scss +11 -0
- package/src/components/page-patterns/dataviews-pattern-actions.js +8 -9
- package/src/components/page-patterns/header.js +3 -1
- package/src/components/page-patterns/index.js +17 -76
- package/src/components/page-patterns/style.scss +14 -1
- package/src/components/page-patterns/use-patterns.js +1 -0
- package/src/components/{page-templates-template-parts → page-templates}/index.js +23 -46
- package/src/components/{page-templates-template-parts → page-templates}/style.scss +2 -2
- package/src/components/pattern-modal/duplicate.js +4 -3
- package/src/components/plugin-template-setting-panel/index.js +8 -0
- package/src/components/resizable-frame/index.js +4 -3
- package/src/components/sidebar-edit-mode/index.js +13 -2
- package/src/components/sidebar-edit-mode/page-panels/index.js +49 -21
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +31 -19
- package/src/components/sidebar-edit-mode/template-panel/index.js +2 -12
- package/src/components/sidebar-navigation-screen-page/index.js +48 -9
- package/src/components/sidebar-navigation-screen-pattern/index.js +6 -11
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +2 -1
- package/src/components/sidebar-navigation-screen-patterns/index.js +30 -38
- package/src/components/sidebar-navigation-screen-template/index.js +1 -1
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +7 -39
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -4
- package/src/components/template-actions/index.js +1 -1
- package/src/deprecated.js +42 -0
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +69 -16
- package/src/index.js +2 -9
- package/src/style.scss +1 -5
- package/src/utils/constants.js +1 -1
- package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -59
- package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
- package/build/components/header-edit-mode/tools-more-menu-group/index.js +0 -23
- package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +0 -56
- package/build/components/keyboard-shortcuts/edit-mode.js.map +0 -1
- package/build/components/page-templates-template-parts/add-new-template-part.js +0 -65
- package/build/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
- package/build/components/page-templates-template-parts/hooks.js.map +0 -1
- package/build/components/page-templates-template-parts/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +0 -188
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
- package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -52
- package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -49
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +0 -1
- package/build-module/components/page-templates-template-parts/add-new-template-part.js +0 -57
- package/build-module/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
- package/build-module/components/page-templates-template-parts/hooks.js.map +0 -1
- package/build-module/components/page-templates-template-parts/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +0 -180
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
- package/src/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -51
- package/src/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
- package/src/components/keyboard-shortcuts/edit-mode.js +0 -59
- package/src/components/page-templates-template-parts/add-new-template-part.js +0 -62
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +0 -249
- package/src/components/sidebar-edit-mode/page-panels/style.scss +0 -34
- /package/build/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
- /package/build-module/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
- /package/src/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SidebarNavigationItem","useLink","CategoryItem","count","icon","id","isActive","label","type","
|
|
1
|
+
{"version":3,"names":["SidebarNavigationItem","useLink","CategoryItem","count","icon","id","isActive","label","type","path","linkInfo","categoryType","categoryId","createElement","suffix","undefined"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js"],"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\tpath = '/patterns',\n} ) {\n\tconst linkInfo = useLink( {\n\t\tpath,\n\t\tcategoryType: type,\n\t\tcategoryId: id,\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"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,qBAAqB,MAAM,4BAA4B;AAC9D,SAASC,OAAO,QAAQ,gBAAgB;AAExC,eAAe,SAASC,YAAYA,CAAE;EACrCC,KAAK;EACLC,IAAI;EACJC,EAAE;EACFC,QAAQ;EACRC,KAAK;EACLC,IAAI;EACJC,IAAI,GAAG;AACR,CAAC,EAAG;EACH,MAAMC,QAAQ,GAAGT,OAAO,CAAE;IACzBQ,IAAI;IACJE,YAAY,EAAEH,IAAI;IAClBI,UAAU,EAAEP;EACb,CAAE,CAAC;EAEH,IAAK,CAAEF,KAAK,EAAG;IACd;EACD;EAEA,OACCU,aAAA,CAACb,qBAAqB;IAAA,GAChBU,QAAQ;IACbN,IAAI,EAAGA,IAAM;IACbU,MAAM,EAAGD,aAAA,eAAQV,KAAa,CAAG;IACjC,gBAAeG,QAAQ,GAAG,MAAM,GAAGS;EAAW,GAE5CR,KACoB,CAAC;AAE1B","ignoreList":[]}
|
|
@@ -3,27 +3,28 @@ import { createElement, Fragment } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item } from '@wordpress/components';
|
|
6
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
7
6
|
import { getTemplatePartIcon } from '@wordpress/editor';
|
|
8
7
|
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import { getQueryArgs } from '@wordpress/url';
|
|
10
8
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
9
|
import { useSelect } from '@wordpress/data';
|
|
12
10
|
import { file } from '@wordpress/icons';
|
|
11
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Internal dependencies
|
|
16
15
|
*/
|
|
17
16
|
import AddNewPattern from '../add-new-pattern';
|
|
18
|
-
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
19
17
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
20
18
|
import CategoryItem from './category-item';
|
|
21
|
-
import { PATTERN_DEFAULT_CATEGORY, PATTERN_TYPES, TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
|
|
22
|
-
import { useLink } from '../routes/link';
|
|
19
|
+
import { PATTERN_DEFAULT_CATEGORY, PATTERN_TYPES, TEMPLATE_PART_POST_TYPE, TEMPLATE_PART_ALL_AREAS_CATEGORY } from '../../utils/constants';
|
|
23
20
|
import usePatternCategories from './use-pattern-categories';
|
|
24
21
|
import useTemplatePartAreas from './use-template-part-areas';
|
|
25
|
-
import {
|
|
22
|
+
import { unlock } from '../../lock-unlock';
|
|
23
|
+
const {
|
|
24
|
+
useLocation
|
|
25
|
+
} = unlock(routerPrivateApis);
|
|
26
26
|
function CategoriesGroup({
|
|
27
|
+
path,
|
|
27
28
|
templatePartAreas,
|
|
28
29
|
patternCategories,
|
|
29
30
|
currentCategory,
|
|
@@ -34,19 +35,21 @@ function CategoriesGroup({
|
|
|
34
35
|
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
35
36
|
}, createElement(CategoryItem, {
|
|
36
37
|
key: "all",
|
|
38
|
+
path: path,
|
|
37
39
|
count: Object.values(templatePartAreas).map(({
|
|
38
40
|
templateParts
|
|
39
41
|
}) => templateParts?.length || 0).reduce((acc, val) => acc + val, 0),
|
|
40
42
|
icon: getTemplatePartIcon() /* no name, so it provides the fallback icon */,
|
|
41
43
|
label: __('All template parts'),
|
|
42
|
-
id:
|
|
44
|
+
id: TEMPLATE_PART_ALL_AREAS_CATEGORY,
|
|
43
45
|
type: TEMPLATE_PART_POST_TYPE,
|
|
44
|
-
isActive: currentCategory ===
|
|
46
|
+
isActive: currentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY && currentType === TEMPLATE_PART_POST_TYPE
|
|
45
47
|
}), Object.entries(templatePartAreas).map(([area, {
|
|
46
48
|
label,
|
|
47
49
|
templateParts
|
|
48
50
|
}]) => createElement(CategoryItem, {
|
|
49
51
|
key: area,
|
|
52
|
+
path: path,
|
|
50
53
|
count: templateParts?.length,
|
|
51
54
|
icon: getTemplatePartIcon(area),
|
|
52
55
|
label: label,
|
|
@@ -57,6 +60,7 @@ function CategoriesGroup({
|
|
|
57
60
|
className: "edit-site-sidebar-navigation-screen-patterns__divider"
|
|
58
61
|
}), allPatterns && createElement(CategoryItem, {
|
|
59
62
|
key: allPatterns.name,
|
|
63
|
+
path: path,
|
|
60
64
|
count: allPatterns.count,
|
|
61
65
|
label: allPatterns.label,
|
|
62
66
|
icon: file,
|
|
@@ -65,6 +69,7 @@ function CategoriesGroup({
|
|
|
65
69
|
isActive: currentCategory === `${allPatterns.name}` && (currentType === PATTERN_TYPES.theme || currentType === PATTERN_TYPES.user)
|
|
66
70
|
}), otherPatterns.map(category => createElement(CategoryItem, {
|
|
67
71
|
key: category.name,
|
|
72
|
+
path: path,
|
|
68
73
|
count: category.count,
|
|
69
74
|
label: category.label,
|
|
70
75
|
icon: file,
|
|
@@ -74,11 +79,13 @@ function CategoriesGroup({
|
|
|
74
79
|
})));
|
|
75
80
|
}
|
|
76
81
|
export default function SidebarNavigationScreenPatterns() {
|
|
77
|
-
const isMobileViewport = useViewportMatch('medium', '<');
|
|
78
82
|
const {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
params: {
|
|
84
|
+
categoryType,
|
|
85
|
+
categoryId,
|
|
86
|
+
path
|
|
87
|
+
}
|
|
88
|
+
} = useLocation();
|
|
82
89
|
const currentCategory = categoryId || PATTERN_DEFAULT_CATEGORY;
|
|
83
90
|
const currentType = categoryType || PATTERN_TYPES.theme;
|
|
84
91
|
const {
|
|
@@ -91,29 +98,28 @@ export default function SidebarNavigationScreenPatterns() {
|
|
|
91
98
|
hasPatterns
|
|
92
99
|
} = usePatternCategories();
|
|
93
100
|
const isBlockBasedTheme = useSelect(select => select(coreStore).getCurrentTheme()?.is_block_theme, []);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}, __('Manage all template parts'))) : undefined;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* This sidebar needs to temporarily accomodate two different "URLs":
|
|
104
|
+
*
|
|
105
|
+
* 1. path = /patterns
|
|
106
|
+
* Block based themes. Also classic themes can access this URL, though it's not linked anywhere.
|
|
107
|
+
*
|
|
108
|
+
* 2. path = /wp_template_part/all
|
|
109
|
+
* Classic themes with support for block-template-parts. We need to list only Template Parts in this case.
|
|
110
|
+
* The URL is accessible from the Appearance > Template Parts menu.
|
|
111
|
+
*
|
|
112
|
+
* This is temporary. We aim to consolidate to /patterns.
|
|
113
|
+
*/
|
|
108
114
|
return createElement(SidebarNavigationScreen, {
|
|
109
115
|
isRoot: !isBlockBasedTheme,
|
|
110
116
|
title: __('Patterns'),
|
|
111
117
|
description: __('Manage what patterns are available when editing the site.'),
|
|
112
118
|
actions: createElement(AddNewPattern, null),
|
|
113
|
-
|
|
114
|
-
content: createElement(Fragment, null, isLoading && __('Loading patterns…'), !isLoading && createElement(Fragment, null, !hasTemplateParts && !hasPatterns && createElement(ItemGroup, {
|
|
119
|
+
content: createElement(Fragment, null, isLoading && __('Loading items…'), !isLoading && createElement(Fragment, null, !hasTemplateParts && !hasPatterns && createElement(ItemGroup, {
|
|
115
120
|
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
116
|
-
}, createElement(Item, null, __('No
|
|
121
|
+
}, createElement(Item, null, __('No items found'))), createElement(CategoriesGroup, {
|
|
122
|
+
path: path,
|
|
117
123
|
templatePartAreas: templatePartAreas,
|
|
118
124
|
patternCategories: patternCategories,
|
|
119
125
|
currentCategory: currentCategory,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","useViewportMatch","getTemplatePartIcon","__","getQueryArgs","store","coreStore","useSelect","file","AddNewPattern","SidebarNavigationItem","SidebarNavigationScreen","CategoryItem","PATTERN_DEFAULT_CATEGORY","PATTERN_TYPES","TEMPLATE_PART_POST_TYPE","useLink","usePatternCategories","useTemplatePartAreas","editSiteStore","CategoriesGroup","templatePartAreas","patternCategories","currentCategory","currentType","allPatterns","otherPatterns","createElement","className","key","count","Object","values","map","templateParts","length","reduce","acc","val","icon","label","id","type","isActive","entries","area","name","theme","user","category","SidebarNavigationScreenPatterns","isMobileViewport","categoryType","categoryId","window","location","href","hasTemplateParts","isLoading","hasPatterns","isBlockBasedTheme","select","getCurrentTheme","is_block_theme","isTemplatePartsMode","settings","getSettings","supportsTemplatePartsMode","templatePartsLink","path","didAccessPatternsPage","undefined","footer","withChevron","isRoot","title","description","actions","content","Fragment"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { getTemplatePartIcon } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { getQueryArgs } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { file } 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 {\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\nimport { useLink } from '../routes/link';\nimport usePatternCategories from './use-pattern-categories';\nimport useTemplatePartAreas from './use-template-part-areas';\nimport { store as editSiteStore } from '../../store';\n\nfunction CategoriesGroup( {\n\ttemplatePartAreas,\n\tpatternCategories,\n\tcurrentCategory,\n\tcurrentType,\n} ) {\n\tconst [ allPatterns, ...otherPatterns ] = patternCategories;\n\n\treturn (\n\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t<CategoryItem\n\t\t\t\tkey=\"all\"\n\t\t\t\tcount={ Object.values( templatePartAreas )\n\t\t\t\t\t.map( ( { templateParts } ) => templateParts?.length || 0 )\n\t\t\t\t\t.reduce( ( acc, val ) => acc + val, 0 ) }\n\t\t\t\ticon={ getTemplatePartIcon() } /* no name, so it provides the fallback icon */\n\t\t\t\tlabel={ __( 'All template parts' ) }\n\t\t\t\tid={ 'all-parts' }\n\t\t\t\ttype={ TEMPLATE_PART_POST_TYPE }\n\t\t\t\tisActive={\n\t\t\t\t\tcurrentCategory === 'all-parts' &&\n\t\t\t\t\tcurrentType === TEMPLATE_PART_POST_TYPE\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ Object.entries( templatePartAreas ).map(\n\t\t\t\t( [ area, { label, templateParts } ] ) => (\n\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\tkey={ area }\n\t\t\t\t\t\tcount={ templateParts?.length }\n\t\t\t\t\t\ticon={ getTemplatePartIcon( area ) }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tid={ area }\n\t\t\t\t\t\ttype={ TEMPLATE_PART_POST_TYPE }\n\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\tcurrentCategory === area &&\n\t\t\t\t\t\t\tcurrentType === TEMPLATE_PART_POST_TYPE\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\t<div className=\"edit-site-sidebar-navigation-screen-patterns__divider\" />\n\t\t\t{ allPatterns && (\n\t\t\t\t<CategoryItem\n\t\t\t\t\tkey={ allPatterns.name }\n\t\t\t\t\tcount={ allPatterns.count }\n\t\t\t\t\tlabel={ allPatterns.label }\n\t\t\t\t\ticon={ file }\n\t\t\t\t\tid={ allPatterns.name }\n\t\t\t\t\ttype=\"pattern\"\n\t\t\t\t\tisActive={\n\t\t\t\t\t\tcurrentCategory === `${ allPatterns.name }` &&\n\t\t\t\t\t\t( currentType === PATTERN_TYPES.theme ||\n\t\t\t\t\t\t\tcurrentType === PATTERN_TYPES.user )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ otherPatterns.map( ( category ) => (\n\t\t\t\t<CategoryItem\n\t\t\t\t\tkey={ category.name }\n\t\t\t\t\tcount={ category.count }\n\t\t\t\t\tlabel={ category.label }\n\t\t\t\t\ticon={ file }\n\t\t\t\t\tid={ category.name }\n\t\t\t\t\ttype=\"pattern\"\n\t\t\t\t\tisActive={\n\t\t\t\t\t\tcurrentCategory === `${ category.name }` &&\n\t\t\t\t\t\t( currentType === PATTERN_TYPES.theme ||\n\t\t\t\t\t\t\tcurrentType === PATTERN_TYPES.user )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</ItemGroup>\n\t);\n}\n\nexport default function SidebarNavigationScreenPatterns() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { categoryType, categoryId } = getQueryArgs( window.location.href );\n\tconst currentCategory = categoryId || PATTERN_DEFAULT_CATEGORY;\n\tconst currentType = categoryType || PATTERN_TYPES.theme;\n\n\tconst { templatePartAreas, hasTemplateParts, isLoading } =\n\t\tuseTemplatePartAreas();\n\tconst { patternCategories, hasPatterns } = usePatternCategories();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\tconst templatePartsLink = useLink( {\n\t\tpath: '/wp_template_part/all',\n\t\t// If a classic theme that supports template parts accessed\n\t\t// the Patterns page directly, preserve that state in the URL.\n\t\tdidAccessPatternsPage:\n\t\t\t! isBlockBasedTheme && isTemplatePartsMode ? 1 : undefined,\n\t} );\n\n\tconst footer = ! isMobileViewport ? (\n\t\t<ItemGroup>\n\t\t\t{ ( isBlockBasedTheme || isTemplatePartsMode ) && (\n\t\t\t\t<SidebarNavigationItem withChevron { ...templatePartsLink }>\n\t\t\t\t\t{ __( 'Manage all template parts' ) }\n\t\t\t\t</SidebarNavigationItem>\n\t\t\t) }\n\t\t</ItemGroup>\n\t) : undefined;\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ ! isBlockBasedTheme }\n\t\t\ttitle={ __( 'Patterns' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Manage what patterns are available when editing the 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<CategoriesGroup\n\t\t\t\t\t\t\t\ttemplatePartAreas={ templatePartAreas }\n\t\t\t\t\t\t\t\tpatternCategories={ patternCategories }\n\t\t\t\t\t\t\t\tcurrentCategory={ currentCategory }\n\t\t\t\t\t\t\t\tcurrentType={ currentType }\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"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,QACpB,uBAAuB;AAC9B,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,mBAAmB,QAAQ,mBAAmB;AACvD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,IAAI,QAAQ,kBAAkB;;AAEvC;AACA;AACA;AACA,OAAOC,aAAa,MAAM,oBAAoB;AAC9C,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,YAAY,MAAM,i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GxE,EAAE,CAAE,UAAW,CAAG;IAC1ByE,WAAW,EAAGzE,EAAE,CACf,2DACD,CAAG;IACH0E,OAAO,EAAGlD,aAAA,CAAClB,aAAa,MAAE,CAAG;IAC7B+D,MAAM,EAAGA,MAAQ;IACjBM,OAAO,EACNnD,aAAA,CAAAoD,QAAA,QACGrB,SAAS,IAAIvD,EAAE,CAAE,mBAAoB,CAAC,EACtC,CAAEuD,SAAS,IACZ/B,aAAA,CAAAoD,QAAA,QACG,CAAEtB,gBAAgB,IAAI,CAAEE,WAAW,IACpChC,aAAA,CAAC7B,SAAS;MAAC8B,SAAS,EAAC;IAAqD,GACzED,aAAA,CAAC3B,IAAI,QACFG,EAAE,CACH,qCACD,CACK,CACI,CACX,EACDwB,aAAA,CAACP,eAAe;MACfC,iBAAiB,EAAGA,iBAAmB;MACvCC,iBAAiB,EAAGA,iBAAmB;MACvCC,eAAe,EAAGA,eAAiB;MACnCC,WAAW,EAAGA;IAAa,CAC3B,CACA,CAEF;EACF,CACD,CAAC;AAEJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","getTemplatePartIcon","__","store","coreStore","useSelect","file","privateApis","routerPrivateApis","AddNewPattern","SidebarNavigationScreen","CategoryItem","PATTERN_DEFAULT_CATEGORY","PATTERN_TYPES","TEMPLATE_PART_POST_TYPE","TEMPLATE_PART_ALL_AREAS_CATEGORY","usePatternCategories","useTemplatePartAreas","unlock","useLocation","CategoriesGroup","path","templatePartAreas","patternCategories","currentCategory","currentType","allPatterns","otherPatterns","createElement","className","key","count","Object","values","map","templateParts","length","reduce","acc","val","icon","label","id","type","isActive","entries","area","name","theme","user","category","SidebarNavigationScreenPatterns","params","categoryType","categoryId","hasTemplateParts","isLoading","hasPatterns","isBlockBasedTheme","select","getCurrentTheme","is_block_theme","isRoot","title","description","actions","content","Fragment"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n} from '@wordpress/components';\nimport { getTemplatePartIcon } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { file } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport AddNewPattern from '../add-new-pattern';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport CategoryItem from './category-item';\nimport {\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_PART_ALL_AREAS_CATEGORY,\n} from '../../utils/constants';\nimport usePatternCategories from './use-pattern-categories';\nimport useTemplatePartAreas from './use-template-part-areas';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction CategoriesGroup( {\n\tpath,\n\ttemplatePartAreas,\n\tpatternCategories,\n\tcurrentCategory,\n\tcurrentType,\n} ) {\n\tconst [ allPatterns, ...otherPatterns ] = patternCategories;\n\n\treturn (\n\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t<CategoryItem\n\t\t\t\tkey=\"all\"\n\t\t\t\tpath={ path }\n\t\t\t\tcount={ Object.values( templatePartAreas )\n\t\t\t\t\t.map( ( { templateParts } ) => templateParts?.length || 0 )\n\t\t\t\t\t.reduce( ( acc, val ) => acc + val, 0 ) }\n\t\t\t\ticon={ getTemplatePartIcon() } /* no name, so it provides the fallback icon */\n\t\t\t\tlabel={ __( 'All template parts' ) }\n\t\t\t\tid={ TEMPLATE_PART_ALL_AREAS_CATEGORY }\n\t\t\t\ttype={ TEMPLATE_PART_POST_TYPE }\n\t\t\t\tisActive={\n\t\t\t\t\tcurrentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY &&\n\t\t\t\t\tcurrentType === TEMPLATE_PART_POST_TYPE\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ Object.entries( templatePartAreas ).map(\n\t\t\t\t( [ area, { label, templateParts } ] ) => (\n\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\tkey={ area }\n\t\t\t\t\t\tpath={ path }\n\t\t\t\t\t\tcount={ templateParts?.length }\n\t\t\t\t\t\ticon={ getTemplatePartIcon( area ) }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tid={ area }\n\t\t\t\t\t\ttype={ TEMPLATE_PART_POST_TYPE }\n\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\tcurrentCategory === area &&\n\t\t\t\t\t\t\tcurrentType === TEMPLATE_PART_POST_TYPE\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\t<div className=\"edit-site-sidebar-navigation-screen-patterns__divider\" />\n\t\t\t{ allPatterns && (\n\t\t\t\t<CategoryItem\n\t\t\t\t\tkey={ allPatterns.name }\n\t\t\t\t\tpath={ path }\n\t\t\t\t\tcount={ allPatterns.count }\n\t\t\t\t\tlabel={ allPatterns.label }\n\t\t\t\t\ticon={ file }\n\t\t\t\t\tid={ allPatterns.name }\n\t\t\t\t\ttype=\"pattern\"\n\t\t\t\t\tisActive={\n\t\t\t\t\t\tcurrentCategory === `${ allPatterns.name }` &&\n\t\t\t\t\t\t( currentType === PATTERN_TYPES.theme ||\n\t\t\t\t\t\t\tcurrentType === PATTERN_TYPES.user )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ otherPatterns.map( ( category ) => (\n\t\t\t\t<CategoryItem\n\t\t\t\t\tkey={ category.name }\n\t\t\t\t\tpath={ path }\n\t\t\t\t\tcount={ category.count }\n\t\t\t\t\tlabel={ category.label }\n\t\t\t\t\ticon={ file }\n\t\t\t\t\tid={ category.name }\n\t\t\t\t\ttype=\"pattern\"\n\t\t\t\t\tisActive={\n\t\t\t\t\t\tcurrentCategory === `${ category.name }` &&\n\t\t\t\t\t\t( currentType === PATTERN_TYPES.theme ||\n\t\t\t\t\t\t\tcurrentType === PATTERN_TYPES.user )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</ItemGroup>\n\t);\n}\n\nexport default function SidebarNavigationScreenPatterns() {\n\tconst {\n\t\tparams: { categoryType, categoryId, path },\n\t} = useLocation();\n\tconst currentCategory = categoryId || PATTERN_DEFAULT_CATEGORY;\n\tconst currentType = categoryType || PATTERN_TYPES.theme;\n\n\tconst { templatePartAreas, hasTemplateParts, isLoading } =\n\t\tuseTemplatePartAreas();\n\tconst { patternCategories, hasPatterns } = usePatternCategories();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\n\t/**\n\t * This sidebar needs to temporarily accomodate two different \"URLs\":\n\t *\n\t * 1. path = /patterns\n\t * Block based themes. Also classic themes can access this URL, though it's not linked anywhere.\n\t *\n\t * 2. path = /wp_template_part/all\n\t * Classic themes with support for block-template-parts. We need to list only Template Parts in this case.\n\t * The URL is accessible from the Appearance > Template Parts menu.\n\t *\n\t * This is temporary. We aim to consolidate to /patterns.\n\t */\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ ! isBlockBasedTheme }\n\t\t\ttitle={ __( 'Patterns' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Manage what patterns are available when editing the site.'\n\t\t\t) }\n\t\t\tactions={ <AddNewPattern /> }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading items…' ) }\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>{ __( 'No items found' ) }</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<CategoriesGroup\n\t\t\t\t\t\t\t\tpath={ path }\n\t\t\t\t\t\t\t\ttemplatePartAreas={ templatePartAreas }\n\t\t\t\t\t\t\t\tpatternCategories={ patternCategories }\n\t\t\t\t\t\t\t\tcurrentCategory={ currentCategory }\n\t\t\t\t\t\t\t\tcurrentType={ currentType }\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"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,QACpB,uBAAuB;AAC9B,SAASC,mBAAmB,QAAQ,mBAAmB;AACvD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,IAAI,QAAQ,kBAAkB;AACvC,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,aAAa,MAAM,oBAAoB;AAC9C,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,SACCC,wBAAwB,EACxBC,aAAa,EACbC,uBAAuB,EACvBC,gCAAgC,QAC1B,uBAAuB;AAC9B,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAY,CAAC,GAAGD,MAAM,CAAEV,iBAAkB,CAAC;AAEnD,SAASY,eAAeA,CAAE;EACzBC,IAAI;EACJC,iBAAiB;EACjBC,iBAAiB;EACjBC,eAAe;EACfC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,WAAW,EAAE,GAAGC,aAAa,CA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B,MAAM;IAAEM,iBAAiB;IAAEkC;EAAY,CAAC,GAAGzC,oBAAoB,CAAC,CAAC;EACjE,MAAM0C,iBAAiB,GAAGrD,SAAS,CAChCsD,MAAM,IAAMA,MAAM,CAAEvD,SAAU,CAAC,CAACwD,eAAe,CAAC,CAAC,EAAEC,cAAc,EACnE,EACD,CAAC;;EAED;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,OACCjC,aAAA,CAAClB,uBAAuB;IACvBoD,MAAM,EAAG,CAAEJ,iBAAmB;IAC9BK,KAAK,EAAG7D,EAAE,CAAE,UAAW,CAAG;IAC1B8D,WAAW,EAAG9D,EAAE,CACf,2DACD,CAAG;IACH+D,OAAO,EAAGrC,aAAA,CAACnB,aAAa,MAAE,CAAG;IAC7ByD,OAAO,EACNtC,aAAA,CAAAuC,QAAA,QACGX,SAAS,IAAItD,EAAE,CAAE,gBAAiB,CAAC,EACnC,CAAEsD,SAAS,IACZ5B,aAAA,CAAAuC,QAAA,QACG,CAAEZ,gBAAgB,IAAI,CAAEE,WAAW,IACpC7B,aAAA,CAAC9B,SAAS;MAAC+B,SAAS,EAAC;IAAqD,GACzED,aAAA,CAAC5B,IAAI,QAAGE,EAAE,CAAE,gBAAiB,CAAS,CAC5B,CACX,EACD0B,aAAA,CAACR,eAAe;MACfC,IAAI,EAAGA,IAAM;MACbC,iBAAiB,EAAGA,iBAAmB;MACvCC,iBAAiB,EAAGA,iBAAmB;MACvCC,eAAe,EAAGA,eAAiB;MACnCC,WAAW,EAAGA;IAAa,CAC3B,CACA,CAEF;EACF,CACD,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -18,7 +18,7 @@ import useEditedEntityRecord from '../use-edited-entity-record';
|
|
|
18
18
|
import { unlock } from '../../lock-unlock';
|
|
19
19
|
import { store as editSiteStore } from '../../store';
|
|
20
20
|
import SidebarButton from '../sidebar-button';
|
|
21
|
-
import { useAddedBy } from '../page-templates
|
|
21
|
+
import { useAddedBy } from '../page-templates/hooks';
|
|
22
22
|
import TemplateActions from '../template-actions';
|
|
23
23
|
import HomeTemplateDetails from './home-template-details';
|
|
24
24
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","_x","useDispatch","useSelect","pencil","Icon","store","coreStore","privateApis","routerPrivateApis","TemplateAreas","SidebarNavigationScreen","useEditedEntityRecord","unlock","editSiteStore","SidebarButton","useAddedBy","TemplateActions","HomeTemplateDetails","SidebarNavigationScreenDetailsFooter","useHistory","useLocation","useTemplateDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","content","slug","createElement","Fragment","footer","modified","description","className","imageUrl","src","alt","width","height","icon","isCustomized","SidebarNavigationScreenTemplate","history","params","setCanvasMode","actions","toggleProps","as","onRemove","push","path","onClick","label"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport { Icon } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport TemplateAreas from './template-areas';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport { useAddedBy } from '../page-templates
|
|
1
|
+
{"version":3,"names":["__","_x","useDispatch","useSelect","pencil","Icon","store","coreStore","privateApis","routerPrivateApis","TemplateAreas","SidebarNavigationScreen","useEditedEntityRecord","unlock","editSiteStore","SidebarButton","useAddedBy","TemplateActions","HomeTemplateDetails","SidebarNavigationScreenDetailsFooter","useHistory","useLocation","useTemplateDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","content","slug","createElement","Fragment","footer","modified","description","className","imageUrl","src","alt","width","height","icon","isCustomized","SidebarNavigationScreenTemplate","history","params","setCanvasMode","actions","toggleProps","as","onRemove","push","path","onClick","label"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport { Icon } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport TemplateAreas from './template-areas';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport { useAddedBy } from '../page-templates/hooks';\nimport TemplateActions from '../template-actions';\nimport HomeTemplateDetails from './home-template-details';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\nfunction useTemplateDetails( 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 = __(\n\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t);\n\t}\n\n\tconst content =\n\t\trecord?.slug === 'home' || record?.slug === 'index' ? (\n\t\t\t<>\n\t\t\t\t<HomeTemplateDetails />\n\t\t\t\t<TemplateAreas />\n\t\t\t</>\n\t\t) : (\n\t\t\t<TemplateAreas />\n\t\t);\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\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-template__added-by-description\">\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author\">\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__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-template__added-by-description-customized\">\n\t\t\t\t\t\t\t{ _x( '(Customized)', 'template' ) }\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\treturn { title, description, content, footer };\n}\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst history = useHistory();\n\tconst {\n\t\tparams: { postType, postId },\n\t} = useLocation();\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { title, content, description, footer } = useTemplateDetails(\n\t\tpostType,\n\t\tpostId\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<TemplateActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\ttoggleProps={ { as: SidebarButton } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\thistory.push( { path: '/' + postType } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tdescription={ description }\n\t\t\tcontent={ content }\n\t\t\tfooter={ footer }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,qBAAqB,MAAM,6BAA6B;AAC/D,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASP,KAAK,IAAIQ,aAAa,QAAQ,aAAa;AACpD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,SAASC,UAAU,QAAQ,yBAAyB;AACpD,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,mBAAmB,MAAM,yBAAyB;AACz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W,EAAG;QAAEC,EAAE,EAAE7C;MAAc,CAAG;MACrC8C,QAAQ,EAAGA,CAAA,KAAM;QAChBN,OAAO,CAACO,IAAI,CAAE;UAAEC,IAAI,EAAE,GAAG,GAAGxC;QAAS,CAAE,CAAC;MACzC;IAAG,CACH,CAAC,EACFkB,aAAA,CAAC1B,aAAa;MACbiD,OAAO,EAAGA,CAAA,KAAMP,aAAa,CAAE,MAAO,CAAG;MACzCQ,KAAK,EAAGjE,EAAE,CAAE,MAAO,CAAG;MACtBoD,IAAI,EAAGhD;IAAQ,CACf,CACA,CACF;IACDyC,WAAW,EAAGA,WAAa;IAC3BN,OAAO,EAAGA,OAAS;IACnBI,MAAM,EAAGA;EAAQ,CACjB,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -10,8 +10,9 @@ import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
import DataViewItem from '../sidebar-dataviews/dataview-item';
|
|
13
|
-
import { useAddedBy } from '../page-templates
|
|
13
|
+
import { useAddedBy } from '../page-templates/hooks';
|
|
14
14
|
import { layout } from '@wordpress/icons';
|
|
15
|
+
import { TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
15
16
|
const EMPTY_ARRAY = [];
|
|
16
17
|
function TemplateDataviewItem({
|
|
17
18
|
template,
|
|
@@ -32,12 +33,11 @@ function TemplateDataviewItem({
|
|
|
32
33
|
}
|
|
33
34
|
export default function DataviewsTemplatesSidebarContent({
|
|
34
35
|
activeView,
|
|
35
|
-
postType,
|
|
36
36
|
title
|
|
37
37
|
}) {
|
|
38
38
|
const {
|
|
39
39
|
records
|
|
40
|
-
} = useEntityRecords('postType',
|
|
40
|
+
} = useEntityRecords('postType', TEMPLATE_POST_TYPE, {
|
|
41
41
|
per_page: -1
|
|
42
42
|
});
|
|
43
43
|
const firstItemPerAuthorText = useMemo(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEntityRecords","useMemo","__experimentalItemGroup","ItemGroup","DataViewItem","useAddedBy","layout","EMPTY_ARRAY","TemplateDataviewItem","template","isActive","text","icon","type","id","createElement","key","slug","title","isCustom","DataviewsTemplatesSidebarContent","activeView","
|
|
1
|
+
{"version":3,"names":["useEntityRecords","useMemo","__experimentalItemGroup","ItemGroup","DataViewItem","useAddedBy","layout","TEMPLATE_POST_TYPE","EMPTY_ARRAY","TemplateDataviewItem","template","isActive","text","icon","type","id","createElement","key","slug","title","isCustom","DataviewsTemplatesSidebarContent","activeView","records","per_page","firstItemPerAuthorText","_ref","firstItemPerAuthor","reduce","acc","author","author_text","Object","values","map"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport DataViewItem from '../sidebar-dataviews/dataview-item';\nimport { useAddedBy } from '../page-templates/hooks';\nimport { layout } from '@wordpress/icons';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst EMPTY_ARRAY = [];\n\nfunction TemplateDataviewItem( { template, isActive } ) {\n\tconst { text, icon } = useAddedBy( template.type, template.id );\n\treturn (\n\t\t<DataViewItem\n\t\t\tkey={ text }\n\t\t\tslug={ text }\n\t\t\ttitle={ text }\n\t\t\ticon={ icon }\n\t\t\tisActive={ isActive }\n\t\t\tisCustom={ false }\n\t\t/>\n\t);\n}\n\nexport default function DataviewsTemplatesSidebarContent( {\n\tactiveView,\n\ttitle,\n} ) {\n\tconst { records } = useEntityRecords( 'postType', TEMPLATE_POST_TYPE, {\n\t\tper_page: -1,\n\t} );\n\tconst firstItemPerAuthorText = useMemo( () => {\n\t\tconst firstItemPerAuthor = records?.reduce( ( acc, template ) => {\n\t\t\tconst author = template.author_text;\n\t\t\tif ( author && ! acc[ author ] ) {\n\t\t\t\tacc[ author ] = template;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn (\n\t\t\t( firstItemPerAuthor && Object.values( firstItemPerAuthor ) ) ??\n\t\t\tEMPTY_ARRAY\n\t\t);\n\t}, [ records ] );\n\n\treturn (\n\t\t<ItemGroup>\n\t\t\t<DataViewItem\n\t\t\t\tslug={ 'all' }\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ layout }\n\t\t\t\tisActive={ activeView === 'all' }\n\t\t\t\tisCustom={ false }\n\t\t\t/>\n\t\t\t{ firstItemPerAuthorText.map( ( template ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<TemplateDataviewItem\n\t\t\t\t\t\tkey={ template.author_text }\n\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\tisActive={ activeView === template.author_text }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ItemGroup>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,uBAAuB,IAAIC,SAAS,QAAQ,uBAAuB;;AAE5E;AACA;AACA;AACA,OAAOC,YAAY,MAAM,oCAAoC;AAC7D,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,MAAMC,WAAW,GAAG,EAAE;AAEtB,SAASC,oBAAoBA,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EACvD,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAC,GAAGR,UAAU,CAAEK,QAAQ,CAACI,IAAI,EAAEJ,QAAQ,CAACK,EAAG,CAAC;EAC/D,OACCC,aAAA,CAACZ,YAAY;IACZa,GAAG,EAAGL,IAAM;IACZM,IAAI,EAAGN,IAAM;IACbO,KAAK,EAAGP,IAAM;IACdC,IAAI,EAAGA,IAA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Aa,CAChD,CAAC;EAEJ,CAAE,CACQ,CAAC;AAEd","ignoreList":[]}
|
|
@@ -3,59 +3,29 @@ import { createElement } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { useSelect } from '@wordpress/data';
|
|
7
6
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Internal dependencies
|
|
11
10
|
*/
|
|
12
11
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
13
|
-
import { store as editSiteStore } from '../../store';
|
|
14
|
-
import { TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
|
|
15
12
|
import { unlock } from '../../lock-unlock';
|
|
16
13
|
import DataviewsTemplatesSidebarContent from './content';
|
|
17
|
-
const config = {
|
|
18
|
-
[TEMPLATE_POST_TYPE]: {
|
|
19
|
-
title: __('Manage templates'),
|
|
20
|
-
description: __('Create new templates, or reset any customizations made to the templates supplied by your theme.'),
|
|
21
|
-
contentTitle: __('All templates')
|
|
22
|
-
},
|
|
23
|
-
[TEMPLATE_PART_POST_TYPE]: {
|
|
24
|
-
title: __('Manage template parts'),
|
|
25
|
-
description: __('Create new template parts, or reset any customizations made to the template parts supplied by your theme.'),
|
|
26
|
-
backPath: {
|
|
27
|
-
path: '/patterns'
|
|
28
|
-
},
|
|
29
|
-
contentTitle: __('All template parts')
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
14
|
const {
|
|
33
15
|
useLocation
|
|
34
16
|
} = unlock(routerPrivateApis);
|
|
35
|
-
export default function SidebarNavigationScreenTemplatesBrowse({
|
|
36
|
-
postType
|
|
37
|
-
}) {
|
|
17
|
+
export default function SidebarNavigationScreenTemplatesBrowse() {
|
|
38
18
|
const {
|
|
39
19
|
params: {
|
|
40
|
-
didAccessPatternsPage,
|
|
41
20
|
activeView = 'all'
|
|
42
21
|
}
|
|
43
22
|
} = useLocation();
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return createElement(SidebarNavigationScreen
|
|
48
|
-
// If a classic theme that supports template parts has never
|
|
49
|
-
// accessed the Patterns page, return to the dashboard.
|
|
50
|
-
, {
|
|
51
|
-
isRoot: isTemplatePartsMode && !didAccessPatternsPage,
|
|
52
|
-
title: config[postType].title,
|
|
53
|
-
description: config[postType].description,
|
|
54
|
-
backPath: config[postType].backPath,
|
|
23
|
+
return createElement(SidebarNavigationScreen, {
|
|
24
|
+
title: __('Manage templates'),
|
|
25
|
+
description: __('Create new templates, or reset any customizations made to the templates supplied by your theme.'),
|
|
55
26
|
content: createElement(DataviewsTemplatesSidebarContent, {
|
|
56
27
|
activeView: activeView,
|
|
57
|
-
|
|
58
|
-
title: config[postType].contentTitle
|
|
28
|
+
title: __('All templates')
|
|
59
29
|
})
|
|
60
30
|
});
|
|
61
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","
|
|
1
|
+
{"version":3,"names":["__","privateApis","routerPrivateApis","SidebarNavigationScreen","unlock","DataviewsTemplatesSidebarContent","useLocation","SidebarNavigationScreenTemplatesBrowse","params","activeView","createElement","title","description","content"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport DataviewsTemplatesSidebarContent from './content';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function SidebarNavigationScreenTemplatesBrowse() {\n\tconst {\n\t\tparams: { activeView = 'all' },\n\t} = useLocation();\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Manage templates' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Create new templates, or reset any customizations made to the templates supplied by your theme.'\n\t\t\t) }\n\t\t\tcontent={\n\t\t\t\t<DataviewsTemplatesSidebarContent\n\t\t\t\t\tactiveView={ activeView }\n\t\t\t\t\ttitle={ __( 'All templates' ) }\n\t\t\t\t/>\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,gCAAgC,MAAM,WAAW;AAExD,MAAM;EAAEC;AAAY,CAAC,GAAGF,MAAM,CAAEF,iBAAkB,CAAC;AAEnD,eAAe,SAASK,sCAAsCA,CAAA,EAAG;EAChE,MAAM;IACLC,MAAM,EAAE;MAAEC,UAAU,GAAG;IAAM;EAC9B,CAAC,GAAGH,WAAW,CAAC,CAAC;EAEjB,OACCI,aAAA,CAACP,uBAAuB;IACvBQ,KAAK,EAAGX,EAAE,CAAE,kBAAmB,CAAG;IAClCY,WAAW,EAAGZ,EAAE,CACf,iGACD,CAAG;IACHa,OAAO,EACNH,aAAA,CAACL,gCAAgC;MAChCI,UAAU,EAAGA,UAAY;MACzBE,KAAK,EAAGX,EAAE,CAAE,eAAgB;IAAG,CAC/B;EACD,CACD,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -179,14 +179,6 @@ function useResolveEditedEntityAndContext({
|
|
|
179
179
|
context
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
|
-
if (path === '/wp_template_part/all' && postId) {
|
|
183
|
-
return {
|
|
184
|
-
isReady: true,
|
|
185
|
-
postType: 'wp_template_part',
|
|
186
|
-
postId,
|
|
187
|
-
context
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
182
|
if (postTypesWithoutParentTemplate.includes(postType)) {
|
|
191
183
|
return {
|
|
192
184
|
isReady: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useMemo","useSelect","useDispatch","store","coreDataStore","privateApis","routerPrivateApis","editSiteStore","unlock","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","PATTERN_TYPES","useLocation","postTypesWithoutParentTemplate","user","useResolveEditedEntityAndContext","path","postId","postType","hasLoadedAllDependencies","homepageId","postsPageId","url","frontPageTemplateId","select","getSite","getUnstableBase","getEntityRecords","siteData","base","templates","per_page","_homepageId","show_on_front","includes","page_on_front","toString","_postsPageId","page_for_posts","_frontPageTemplateId","frontPageTemplate","find","t","slug","id","home","resolvedTemplateId","undefined","getEditedEntityRecord","getDefaultTemplateId","__experimentalGetTemplateForLink","resolveTemplateForPostTypeAndId","postTypeToResolve","postIdToResolve","editedEntity","link","currentTemplateSlug","template","currentTemplate","slugToCheck","context","isReady","useInitEditedEntityFromURL","params","setEditedEntity"],"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst postTypesWithoutParentTemplate = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nfunction useResolveEditedEntityAndContext( { path, postId, postType } ) {\n\tconst {\n\t\thasLoadedAllDependencies,\n\t\thomepageId,\n\t\tpostsPageId,\n\t\turl,\n\t\tfrontPageTemplateId,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSite, getUnstableBase, getEntityRecords } =\n\t\t\tselect( coreDataStore );\n\t\tconst siteData = getSite();\n\t\tconst base = getUnstableBase();\n\t\tconst templates = getEntityRecords( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t} );\n\t\tconst _homepageId =\n\t\t\tsiteData?.show_on_front === 'page' &&\n\t\t\t[ 'number', 'string' ].includes( typeof siteData.page_on_front ) &&\n\t\t\t!! +siteData.page_on_front // We also need to check if it's not zero(`0`).\n\t\t\t\t? siteData.page_on_front.toString()\n\t\t\t\t: null;\n\t\tconst _postsPageId =\n\t\t\tsiteData?.show_on_front === 'page' &&\n\t\t\t[ 'number', 'string' ].includes( typeof siteData.page_for_posts )\n\t\t\t\t? siteData.page_for_posts.toString()\n\t\t\t\t: null;\n\t\tlet _frontPageTemplateId;\n\t\tif ( templates ) {\n\t\t\tconst frontPageTemplate = templates.find(\n\t\t\t\t( t ) => t.slug === 'front-page'\n\t\t\t);\n\t\t\t_frontPageTemplateId = frontPageTemplate\n\t\t\t\t? frontPageTemplate.id\n\t\t\t\t: false;\n\t\t}\n\t\treturn {\n\t\t\thasLoadedAllDependencies: !! base && !! siteData,\n\t\t\thomepageId: _homepageId,\n\t\t\tpostsPageId: _postsPageId,\n\t\t\turl: base?.home,\n\t\t\tfrontPageTemplateId: _frontPageTemplateId,\n\t\t};\n\t}, [] );\n\n\t/**\n\t * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId\n\t * in order to match the frontend as closely as possible in the site editor.\n\t *\n\t * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.\n\t */\n\tconst resolvedTemplateId = useSelect(\n\t\t( select ) => {\n\t\t\t// If we're rendering a post type that doesn't have a template\n\t\t\t// no need to resolve its template.\n\t\t\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\tgetEntityRecords,\n\t\t\t\tgetDefaultTemplateId,\n\t\t\t\t__experimentalGetTemplateForLink,\n\t\t\t} = select( coreDataStore );\n\n\t\t\tfunction resolveTemplateForPostTypeAndId(\n\t\t\t\tpostTypeToResolve,\n\t\t\t\tpostIdToResolve\n\t\t\t) {\n\t\t\t\t// For the front page, we always use the front page template if existing.\n\t\t\t\tif (\n\t\t\t\t\tpostTypeToResolve === 'page' &&\n\t\t\t\t\thomepageId === postIdToResolve\n\t\t\t\t) {\n\t\t\t\t\t// We're still checking whether the front page template exists.\n\t\t\t\t\t// Don't resolve the template yet.\n\t\t\t\t\tif ( frontPageTemplateId === undefined ) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( !! frontPageTemplateId ) {\n\t\t\t\t\t\treturn frontPageTemplateId;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst editedEntity = getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostTypeToResolve,\n\t\t\t\t\tpostIdToResolve\n\t\t\t\t);\n\t\t\t\tif ( ! editedEntity ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\t// Check if the current page is the posts page.\n\t\t\t\tif (\n\t\t\t\t\tpostTypeToResolve === 'page' &&\n\t\t\t\t\tpostsPageId === postIdToResolve\n\t\t\t\t) {\n\t\t\t\t\treturn __experimentalGetTemplateForLink( editedEntity.link )\n\t\t\t\t\t\t?.id;\n\t\t\t\t}\n\t\t\t\t// First see if the post/page has an assigned template and fetch it.\n\t\t\t\tconst currentTemplateSlug = editedEntity.template;\n\t\t\t\tif ( currentTemplateSlug ) {\n\t\t\t\t\tconst currentTemplate = getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t\t}\n\t\t\t\t\t)?.find( ( { slug } ) => slug === currentTemplateSlug );\n\t\t\t\t\tif ( currentTemplate ) {\n\t\t\t\t\t\treturn currentTemplate.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If no template is assigned, use the default template.\n\t\t\t\tlet slugToCheck;\n\t\t\t\t// In `draft` status we might not have a slug available, so we use the `single`\n\t\t\t\t// post type templates slug(ex page, single-post, single-product etc..).\n\t\t\t\t// Pages do not need the `single` prefix in the slug to be prioritized\n\t\t\t\t// through template hierarchy.\n\t\t\t\tif ( editedEntity.slug ) {\n\t\t\t\t\tslugToCheck =\n\t\t\t\t\t\tpostTypeToResolve === 'page'\n\t\t\t\t\t\t\t? `${ postTypeToResolve }-${ editedEntity.slug }`\n\t\t\t\t\t\t\t: `single-${ postTypeToResolve }-${ editedEntity.slug }`;\n\t\t\t\t} else {\n\t\t\t\t\tslugToCheck =\n\t\t\t\t\t\tpostTypeToResolve === 'page'\n\t\t\t\t\t\t\t? 'page'\n\t\t\t\t\t\t\t: `single-${ postTypeToResolve }`;\n\t\t\t\t}\n\t\t\t\treturn getDefaultTemplateId( {\n\t\t\t\t\tslug: slugToCheck,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( ! hasLoadedAllDependencies ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t// If we're rendering a specific page, post... we need to resolve its template.\n\t\t\tif ( postType && postId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( postType, postId );\n\t\t\t}\n\n\t\t\t// Some URLs in list views are different\n\t\t\tif ( path === '/page' && postId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( 'page', postId );\n\t\t\t}\n\n\t\t\t// If we're rendering the home page, and we have a static home page, resolve its template.\n\t\t\tif ( homepageId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( 'page', homepageId );\n\t\t\t}\n\n\t\t\t// If we're not rendering a specific page, use the front page template.\n\t\t\tif ( url ) {\n\t\t\t\tconst template = __experimentalGetTemplateForLink( url );\n\t\t\t\treturn template?.id;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\thomepageId,\n\t\t\tpostsPageId,\n\t\t\thasLoadedAllDependencies,\n\t\t\turl,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tpath,\n\t\t\tfrontPageTemplateId,\n\t\t]\n\t);\n\n\tconst context = useMemo( () => {\n\t\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif ( postType && postId ) {\n\t\t\treturn { postType, postId };\n\t\t}\n\n\t\t// Some URLs in list views are different\n\t\tif ( path === '/page' && postId ) {\n\t\t\treturn { postType: 'page', postId };\n\t\t}\n\n\t\tif ( homepageId ) {\n\t\t\treturn { postType: 'page', postId: homepageId };\n\t\t}\n\n\t\treturn {};\n\t}, [ homepageId, postType, postId, path ] );\n\n\tif ( path === '/wp_template' && postId ) {\n\t\treturn { isReady: true, postType: 'wp_template', postId, context };\n\t}\n\n\tif ( path === '/wp_template_part/all' && postId ) {\n\t\treturn { isReady: true, postType: 'wp_template_part', postId, context };\n\t}\n\n\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\treturn { isReady: true, postType, postId, context };\n\t}\n\n\tif ( hasLoadedAllDependencies ) {\n\t\treturn {\n\t\t\tisReady: resolvedTemplateId !== undefined,\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tpostId: resolvedTemplateId,\n\t\t\tcontext,\n\t\t};\n\t}\n\n\treturn { isReady: false };\n}\n\nexport default function useInitEditedEntityFromURL() {\n\tconst { params = {} } = useLocation();\n\tconst { postType, postId, context, isReady } =\n\t\tuseResolveEditedEntityAndContext( params );\n\n\tconst { setEditedEntity } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( isReady ) {\n\t\t\tsetEditedEntity( postType, postId, context );\n\t\t}\n\t}, [ isReady, postType, postId, context, setEditedEntity ] );\n}\n"],"mappings":"AAAA;AACA;AACA;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;EAEA,IAAK5C,IAAI,KAAK,uBAAuB,IAAIC,MAAM,EAAG;IACjD,OAAO;MAAE4C,OAAO,EAAE,IAAI;MAAE3C,QAAQ,EAAE,kBAAkB;MAAED,MAAM;MAAE2C;IAAQ,CAAC;EACxE;EAEA,IAAK/C,8BAA8B,CAACqB,QAAQ,CAAEhB,QAAS,CAAC,EAAG;IAC1D,OAAO;MAAE2C,OAAO,EAAE,IAAI;MAAE3C,QAAQ;MAAED,MAAM;MAAE2C;IAAQ,CAAC;EACpD;EAEA,IAAKzC,wBAAwB,EAAG;IAC/B,OAAO;MACN0C,OAAO,EAAEf,kBAAkB,KAAKC,SAAS;MACzC7B,QAAQ,EAAEV,kBAAkB;MAC5BS,MAAM,EAAE6B,kBAAkB;MAC1Bc;IACD,CAAC;EACF;EAEA,OAAO;IAAEC,OAAO,EAAE;EAAM,CAAC;AAC1B;AAEA,eAAe,SAASC,0BAA0BA,CAAA,EAAG;EACpD,MAAM;IAAEC,MAAM,GAAG,CAAC;EAAE,CAAC,GAAGnD,WAAW,CAAC,CAAC;EACrC,MAAM;IAAEM,QAAQ;IAAED,MAAM;IAAE2C,OAAO;IAAEC;EAAQ,CAAC,GAC3C9C,gCAAgC,CAAEgD,MAAO,CAAC;EAE3C,MAAM;IAAEC;EAAgB,CAAC,GAAG/D,WAAW,CAAEK,aAAc,CAAC;EAExDR,SAAS,CAAE,MAAM;IAChB,IAAK+D,OAAO,EAAG;MACdG,eAAe,CAAE9C,QAAQ,EAAED,MAAM,EAAE2C,OAAQ,CAAC;IAC7C;EACD,CAAC,EAAE,CAAEC,OAAO,EAAE3C,QAAQ,EAAED,MAAM,EAAE2C,OAAO,EAAEI,eAAe,CAAG,CAAC;AAC7D","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useEffect","useMemo","useSelect","useDispatch","store","coreDataStore","privateApis","routerPrivateApis","editSiteStore","unlock","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","PATTERN_TYPES","useLocation","postTypesWithoutParentTemplate","user","useResolveEditedEntityAndContext","path","postId","postType","hasLoadedAllDependencies","homepageId","postsPageId","url","frontPageTemplateId","select","getSite","getUnstableBase","getEntityRecords","siteData","base","templates","per_page","_homepageId","show_on_front","includes","page_on_front","toString","_postsPageId","page_for_posts","_frontPageTemplateId","frontPageTemplate","find","t","slug","id","home","resolvedTemplateId","undefined","getEditedEntityRecord","getDefaultTemplateId","__experimentalGetTemplateForLink","resolveTemplateForPostTypeAndId","postTypeToResolve","postIdToResolve","editedEntity","link","currentTemplateSlug","template","currentTemplate","slugToCheck","context","isReady","useInitEditedEntityFromURL","params","setEditedEntity"],"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst postTypesWithoutParentTemplate = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nfunction useResolveEditedEntityAndContext( { path, postId, postType } ) {\n\tconst {\n\t\thasLoadedAllDependencies,\n\t\thomepageId,\n\t\tpostsPageId,\n\t\turl,\n\t\tfrontPageTemplateId,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSite, getUnstableBase, getEntityRecords } =\n\t\t\tselect( coreDataStore );\n\t\tconst siteData = getSite();\n\t\tconst base = getUnstableBase();\n\t\tconst templates = getEntityRecords( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t} );\n\t\tconst _homepageId =\n\t\t\tsiteData?.show_on_front === 'page' &&\n\t\t\t[ 'number', 'string' ].includes( typeof siteData.page_on_front ) &&\n\t\t\t!! +siteData.page_on_front // We also need to check if it's not zero(`0`).\n\t\t\t\t? siteData.page_on_front.toString()\n\t\t\t\t: null;\n\t\tconst _postsPageId =\n\t\t\tsiteData?.show_on_front === 'page' &&\n\t\t\t[ 'number', 'string' ].includes( typeof siteData.page_for_posts )\n\t\t\t\t? siteData.page_for_posts.toString()\n\t\t\t\t: null;\n\t\tlet _frontPageTemplateId;\n\t\tif ( templates ) {\n\t\t\tconst frontPageTemplate = templates.find(\n\t\t\t\t( t ) => t.slug === 'front-page'\n\t\t\t);\n\t\t\t_frontPageTemplateId = frontPageTemplate\n\t\t\t\t? frontPageTemplate.id\n\t\t\t\t: false;\n\t\t}\n\t\treturn {\n\t\t\thasLoadedAllDependencies: !! base && !! siteData,\n\t\t\thomepageId: _homepageId,\n\t\t\tpostsPageId: _postsPageId,\n\t\t\turl: base?.home,\n\t\t\tfrontPageTemplateId: _frontPageTemplateId,\n\t\t};\n\t}, [] );\n\n\t/**\n\t * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId\n\t * in order to match the frontend as closely as possible in the site editor.\n\t *\n\t * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.\n\t */\n\tconst resolvedTemplateId = useSelect(\n\t\t( select ) => {\n\t\t\t// If we're rendering a post type that doesn't have a template\n\t\t\t// no need to resolve its template.\n\t\t\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\tgetEntityRecords,\n\t\t\t\tgetDefaultTemplateId,\n\t\t\t\t__experimentalGetTemplateForLink,\n\t\t\t} = select( coreDataStore );\n\n\t\t\tfunction resolveTemplateForPostTypeAndId(\n\t\t\t\tpostTypeToResolve,\n\t\t\t\tpostIdToResolve\n\t\t\t) {\n\t\t\t\t// For the front page, we always use the front page template if existing.\n\t\t\t\tif (\n\t\t\t\t\tpostTypeToResolve === 'page' &&\n\t\t\t\t\thomepageId === postIdToResolve\n\t\t\t\t) {\n\t\t\t\t\t// We're still checking whether the front page template exists.\n\t\t\t\t\t// Don't resolve the template yet.\n\t\t\t\t\tif ( frontPageTemplateId === undefined ) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( !! frontPageTemplateId ) {\n\t\t\t\t\t\treturn frontPageTemplateId;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst editedEntity = getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostTypeToResolve,\n\t\t\t\t\tpostIdToResolve\n\t\t\t\t);\n\t\t\t\tif ( ! editedEntity ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\t// Check if the current page is the posts page.\n\t\t\t\tif (\n\t\t\t\t\tpostTypeToResolve === 'page' &&\n\t\t\t\t\tpostsPageId === postIdToResolve\n\t\t\t\t) {\n\t\t\t\t\treturn __experimentalGetTemplateForLink( editedEntity.link )\n\t\t\t\t\t\t?.id;\n\t\t\t\t}\n\t\t\t\t// First see if the post/page has an assigned template and fetch it.\n\t\t\t\tconst currentTemplateSlug = editedEntity.template;\n\t\t\t\tif ( currentTemplateSlug ) {\n\t\t\t\t\tconst currentTemplate = getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t\t}\n\t\t\t\t\t)?.find( ( { slug } ) => slug === currentTemplateSlug );\n\t\t\t\t\tif ( currentTemplate ) {\n\t\t\t\t\t\treturn currentTemplate.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If no template is assigned, use the default template.\n\t\t\t\tlet slugToCheck;\n\t\t\t\t// In `draft` status we might not have a slug available, so we use the `single`\n\t\t\t\t// post type templates slug(ex page, single-post, single-product etc..).\n\t\t\t\t// Pages do not need the `single` prefix in the slug to be prioritized\n\t\t\t\t// through template hierarchy.\n\t\t\t\tif ( editedEntity.slug ) {\n\t\t\t\t\tslugToCheck =\n\t\t\t\t\t\tpostTypeToResolve === 'page'\n\t\t\t\t\t\t\t? `${ postTypeToResolve }-${ editedEntity.slug }`\n\t\t\t\t\t\t\t: `single-${ postTypeToResolve }-${ editedEntity.slug }`;\n\t\t\t\t} else {\n\t\t\t\t\tslugToCheck =\n\t\t\t\t\t\tpostTypeToResolve === 'page'\n\t\t\t\t\t\t\t? 'page'\n\t\t\t\t\t\t\t: `single-${ postTypeToResolve }`;\n\t\t\t\t}\n\t\t\t\treturn getDefaultTemplateId( {\n\t\t\t\t\tslug: slugToCheck,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( ! hasLoadedAllDependencies ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t// If we're rendering a specific page, post... we need to resolve its template.\n\t\t\tif ( postType && postId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( postType, postId );\n\t\t\t}\n\n\t\t\t// Some URLs in list views are different\n\t\t\tif ( path === '/page' && postId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( 'page', postId );\n\t\t\t}\n\n\t\t\t// If we're rendering the home page, and we have a static home page, resolve its template.\n\t\t\tif ( homepageId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( 'page', homepageId );\n\t\t\t}\n\n\t\t\t// If we're not rendering a specific page, use the front page template.\n\t\t\tif ( url ) {\n\t\t\t\tconst template = __experimentalGetTemplateForLink( url );\n\t\t\t\treturn template?.id;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\thomepageId,\n\t\t\tpostsPageId,\n\t\t\thasLoadedAllDependencies,\n\t\t\turl,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tpath,\n\t\t\tfrontPageTemplateId,\n\t\t]\n\t);\n\n\tconst context = useMemo( () => {\n\t\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif ( postType && postId ) {\n\t\t\treturn { postType, postId };\n\t\t}\n\n\t\t// Some URLs in list views are different\n\t\tif ( path === '/page' && postId ) {\n\t\t\treturn { postType: 'page', postId };\n\t\t}\n\n\t\tif ( homepageId ) {\n\t\t\treturn { postType: 'page', postId: homepageId };\n\t\t}\n\n\t\treturn {};\n\t}, [ homepageId, postType, postId, path ] );\n\n\tif ( path === '/wp_template' && postId ) {\n\t\treturn { isReady: true, postType: 'wp_template', postId, context };\n\t}\n\n\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\treturn { isReady: true, postType, postId, context };\n\t}\n\n\tif ( hasLoadedAllDependencies ) {\n\t\treturn {\n\t\t\tisReady: resolvedTemplateId !== undefined,\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tpostId: resolvedTemplateId,\n\t\t\tcontext,\n\t\t};\n\t}\n\n\treturn { isReady: false };\n}\n\nexport default function useInitEditedEntityFromURL() {\n\tconst { params = {} } = useLocation();\n\tconst { postType, postId, context, isReady } =\n\t\tuseResolveEditedEntityAndContext( params );\n\n\tconst { setEditedEntity } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( isReady ) {\n\t\t\tsetEditedEntity( postType, postId, context );\n\t\t}\n\t}, [ isReady, postType, postId, context, setEditedEntity ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,OAAO,QAAQ,oBAAoB;AACvD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,aAAa,QAAQ,sBAAsB;AAC7D,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASH,KAAK,IAAII,aAAa,QAAQ,aAAa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7B,QAAQ,EAAEV,kBAAkB;MAC5BS,MAAM,EAAE6B,kBAAkB;MAC1Bc;IACD,CAAC;EACF;EAEA,OAAO;IAAEC,OAAO,EAAE;EAAM,CAAC;AAC1B;AAEA,eAAe,SAASC,0BAA0BA,CAAA,EAAG;EACpD,MAAM;IAAEC,MAAM,GAAG,CAAC;EAAE,CAAC,GAAGnD,WAAW,CAAC,CAAC;EACrC,MAAM;IAAEM,QAAQ;IAAED,MAAM;IAAE2C,OAAO;IAAEC;EAAQ,CAAC,GAC3C9C,gCAAgC,CAAEgD,MAAO,CAAC;EAE3C,MAAM;IAAEC;EAAgB,CAAC,GAAG/D,WAAW,CAAEK,aAAc,CAAC;EAExDR,SAAS,CAAE,MAAM;IAChB,IAAK+D,OAAO,EAAG;MACdG,eAAe,CAAE9C,QAAQ,EAAED,MAAM,EAAE2C,OAAQ,CAAC;IAC7C;EACD,CAAC,EAAE,CAAEC,OAAO,EAAE3C,QAAQ,EAAED,MAAM,EAAE2C,OAAO,EAAEI,eAAe,CAAG,CAAC;AAC7D","ignoreList":[]}
|
|
@@ -101,7 +101,7 @@ function ResetMenuItem({
|
|
|
101
101
|
},
|
|
102
102
|
onCancel: () => setIsModalOpen(false),
|
|
103
103
|
confirmButtonText: __('Reset')
|
|
104
|
-
}, __('
|
|
104
|
+
}, __('Reset to default and clear all customizations?')));
|
|
105
105
|
}
|
|
106
106
|
function DeleteMenuItem({
|
|
107
107
|
onRemove,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","useSelect","store","coreStore","useState","__","sprintf","DropdownMenu","MenuGroup","MenuItem","__experimentalConfirmDialog","ConfirmDialog","moreVertical","noticesStore","decodeEntities","editSiteStore","isTemplateRemovable","isTemplateRevertable","RenamePostMenuItem","TEMPLATE_POST_TYPE","TemplateActions","postType","postId","className","toggleProps","onRemove","template","select","getEntityRecord","removeTemplate","isRemovable","isRevertable","createElement","icon","label","onClose","Fragment","post","DeleteMenuItem","title","rendered","ResetMenuItem","isModalOpen","setIsModalOpen","revertTemplate","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","revertAndSaveTemplate","allowUndo","type","id","error","fallbackErrorMessage","errorMessage","message","code","onClick","isOpen","onConfirm","onCancel","confirmButtonText","isDestructive"],"sources":["@wordpress/edit-site/src/components/template-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport RenamePostMenuItem from '../rename-post-menu-item';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nexport default function TemplateActions( {\n\tpostType,\n\tpostId,\n\tclassName,\n\ttoggleProps,\n\tonRemove,\n} ) {\n\tconst template = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'postType', postType, postId ),\n\t\t[ postType, postId ]\n\t);\n\tconst { removeTemplate } = useDispatch( editSiteStore );\n\tconst isRemovable = isTemplateRemovable( template );\n\tconst isRevertable = isTemplateRevertable( template );\n\n\tif ( ! isRemovable && ! isRevertable ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Actions' ) }\n\t\t\tclassName={ className }\n\t\t\ttoggleProps={ toggleProps }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ isRemovable && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RenamePostMenuItem\n\t\t\t\t\t\t\t\tpost={ template }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<DeleteMenuItem\n\t\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\t\tremoveTemplate( template );\n\t\t\t\t\t\t\t\t\tonRemove?.();\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttitle={ template.title.rendered }\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\t{ isRevertable && (\n\t\t\t\t\t\t<ResetMenuItem\n\t\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction ResetMenuItem( { template, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tasync function revertAndSaveTemplate() {\n\t\ttry {\n\t\t\tawait revertTemplate( template, { allowUndo: false } );\n\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" reset.' ),\n\t\t\t\t\tdecodeEntities( template.title.rendered )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'edit-site-template-reverted',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst fallbackErrorMessage =\n\t\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t? __( 'An error occurred while reverting the template.' )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while reverting the template part.'\n\t\t\t\t\t );\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: fallbackErrorMessage;\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\treturn (\n\t\t<>\n\t\t\t<MenuItem onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Reset' ) }\n\t\t\t</MenuItem>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ isModalOpen }\n\t\t\t\tonConfirm={ () => {\n\t\t\t\t\trevertAndSaveTemplate();\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t\tonCancel={ () => setIsModalOpen( false ) }\n\t\t\t\tconfirmButtonText={ __( 'Reset' ) }\n\t\t\t>\n\t\t\t\t{ __( '
|
|
1
|
+
{"version":3,"names":["useDispatch","useSelect","store","coreStore","useState","__","sprintf","DropdownMenu","MenuGroup","MenuItem","__experimentalConfirmDialog","ConfirmDialog","moreVertical","noticesStore","decodeEntities","editSiteStore","isTemplateRemovable","isTemplateRevertable","RenamePostMenuItem","TEMPLATE_POST_TYPE","TemplateActions","postType","postId","className","toggleProps","onRemove","template","select","getEntityRecord","removeTemplate","isRemovable","isRevertable","createElement","icon","label","onClose","Fragment","post","DeleteMenuItem","title","rendered","ResetMenuItem","isModalOpen","setIsModalOpen","revertTemplate","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","revertAndSaveTemplate","allowUndo","type","id","error","fallbackErrorMessage","errorMessage","message","code","onClick","isOpen","onConfirm","onCancel","confirmButtonText","isDestructive"],"sources":["@wordpress/edit-site/src/components/template-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalConfirmDialog as ConfirmDialog,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport RenamePostMenuItem from '../rename-post-menu-item';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nexport default function TemplateActions( {\n\tpostType,\n\tpostId,\n\tclassName,\n\ttoggleProps,\n\tonRemove,\n} ) {\n\tconst template = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'postType', postType, postId ),\n\t\t[ postType, postId ]\n\t);\n\tconst { removeTemplate } = useDispatch( editSiteStore );\n\tconst isRemovable = isTemplateRemovable( template );\n\tconst isRevertable = isTemplateRevertable( template );\n\n\tif ( ! isRemovable && ! isRevertable ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Actions' ) }\n\t\t\tclassName={ className }\n\t\t\ttoggleProps={ toggleProps }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ isRemovable && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RenamePostMenuItem\n\t\t\t\t\t\t\t\tpost={ template }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<DeleteMenuItem\n\t\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\t\tremoveTemplate( template );\n\t\t\t\t\t\t\t\t\tonRemove?.();\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttitle={ template.title.rendered }\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\t{ isRevertable && (\n\t\t\t\t\t\t<ResetMenuItem\n\t\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction ResetMenuItem( { template, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tasync function revertAndSaveTemplate() {\n\t\ttry {\n\t\t\tawait revertTemplate( template, { allowUndo: false } );\n\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" reset.' ),\n\t\t\t\t\tdecodeEntities( template.title.rendered )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'edit-site-template-reverted',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst fallbackErrorMessage =\n\t\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t\t? __( 'An error occurred while reverting the template.' )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while reverting the template part.'\n\t\t\t\t\t );\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: fallbackErrorMessage;\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\treturn (\n\t\t<>\n\t\t\t<MenuItem onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Reset' ) }\n\t\t\t</MenuItem>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ isModalOpen }\n\t\t\t\tonConfirm={ () => {\n\t\t\t\t\trevertAndSaveTemplate();\n\t\t\t\t\tonClose();\n\t\t\t\t} }\n\t\t\t\tonCancel={ () => setIsModalOpen( false ) }\n\t\t\t\tconfirmButtonText={ __( 'Reset' ) }\n\t\t\t>\n\t\t\t\t{ __( 'Reset to default and clear all customizations?' ) }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n\nfunction DeleteMenuItem( { onRemove, title } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<MenuItem isDestructive onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Delete' ) }\n\t\t\t</MenuItem>\n\t\t\t<ConfirmDialog\n\t\t\t\tisOpen={ isModalOpen }\n\t\t\t\tonConfirm={ onRemove }\n\t\t\t\tonCancel={ () => setIsModalOpen( false ) }\n\t\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t\t>\n\t\t\t\t{ sprintf(\n\t\t\t\t\t// translators: %s: The template or template part's title.\n\t\t\t\t\t__( 'Are you sure you want to delete \"%s\"?' ),\n\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t) }\n\t\t\t</ConfirmDialog>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,EAAE,EAAEC,OAAO,QAAQ,i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