@wordpress/edit-site 7.3.2-next.v.202608281122.0 → 7.4.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 +17 -1
- package/build/components/add-new-template/add-custom-template-modal-content.cjs +3 -1
- package/build/components/add-new-template/add-custom-template-modal-content.cjs.map +2 -2
- package/build/components/add-new-template/index.cjs +6 -4
- package/build/components/add-new-template/index.cjs.map +2 -2
- package/build/components/add-new-template/utils.cjs +84 -9
- package/build/components/add-new-template/utils.cjs.map +2 -2
- package/build/components/dataviews-actions/index.cjs +2 -55
- package/build/components/dataviews-actions/index.cjs.map +3 -3
- package/build/components/layout/index.cjs +2 -2
- package/build/components/layout/index.cjs.map +2 -2
- package/build/components/more-menu/welcome-guide-menu-item.cjs +10 -2
- package/build/components/more-menu/welcome-guide-menu-item.cjs.map +3 -3
- package/build/components/page-templates/fields.cjs +2 -126
- package/build/components/page-templates/fields.cjs.map +3 -3
- package/build/components/page-templates/index.cjs +46 -230
- package/build/components/page-templates/index.cjs.map +3 -3
- package/build/components/post-list/index.cjs +7 -17
- package/build/components/post-list/index.cjs.map +2 -2
- package/build/components/sidebar-global-styles/index.cjs +2 -2
- package/build/components/sidebar-global-styles/index.cjs.map +2 -2
- package/build/components/sidebar-identity/index.cjs +17 -22
- package/build/components/sidebar-identity/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-item/index.cjs +1 -8
- package/build/components/sidebar-navigation-item/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-templates-browse/content.cjs +34 -72
- package/build/components/sidebar-navigation-screen-templates-browse/content.cjs.map +3 -3
- package/build/components/sidebar-navigation-screen-templates-browse/index.cjs +1 -2
- package/build/components/sidebar-navigation-screen-templates-browse/index.cjs.map +3 -3
- package/build/components/site-editor-routes/templates.cjs +2 -4
- package/build/components/site-editor-routes/templates.cjs.map +3 -3
- package/build/index.cjs +0 -1
- package/build/index.cjs.map +2 -2
- package/build-module/components/add-new-template/add-custom-template-modal-content.mjs +3 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.mjs.map +2 -2
- package/build-module/components/add-new-template/index.mjs +7 -4
- package/build-module/components/add-new-template/index.mjs.map +2 -2
- package/build-module/components/add-new-template/utils.mjs +84 -9
- package/build-module/components/add-new-template/utils.mjs.map +2 -2
- package/build-module/components/dataviews-actions/index.mjs +1 -53
- package/build-module/components/dataviews-actions/index.mjs.map +2 -2
- package/build-module/components/layout/index.mjs +2 -2
- package/build-module/components/layout/index.mjs.map +2 -2
- package/build-module/components/more-menu/welcome-guide-menu-item.mjs +10 -2
- package/build-module/components/more-menu/welcome-guide-menu-item.mjs.map +2 -2
- package/build-module/components/page-templates/fields.mjs +3 -129
- package/build-module/components/page-templates/fields.mjs.map +3 -3
- package/build-module/components/page-templates/index.mjs +52 -253
- package/build-module/components/page-templates/index.mjs.map +2 -2
- package/build-module/components/post-list/index.mjs +8 -18
- package/build-module/components/post-list/index.mjs.map +2 -2
- package/build-module/components/sidebar-global-styles/index.mjs +2 -2
- package/build-module/components/sidebar-global-styles/index.mjs.map +2 -2
- package/build-module/components/sidebar-identity/index.mjs +17 -22
- package/build-module/components/sidebar-identity/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-item/index.mjs +1 -8
- package/build-module/components/sidebar-navigation-item/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.mjs +42 -75
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.mjs +1 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.mjs.map +2 -2
- package/build-module/components/site-editor-routes/templates.mjs +2 -4
- package/build-module/components/site-editor-routes/templates.mjs.map +2 -2
- package/build-module/index.mjs +0 -1
- package/build-module/index.mjs.map +2 -2
- package/build-style/style-rtl.css +38 -81
- package/build-style/style.css +38 -81
- package/package.json +41 -38
- package/src/components/add-new-template/add-custom-template-modal-content.jsx +3 -1
- package/src/components/add-new-template/index.jsx +9 -4
- package/src/components/add-new-template/style.scss +8 -21
- package/src/components/add-new-template/utils.js +118 -9
- package/src/components/dataviews-actions/index.js +0 -61
- package/src/components/layout/index.jsx +5 -2
- package/src/components/more-menu/welcome-guide-menu-item.jsx +8 -3
- package/src/components/page-templates/fields.jsx +2 -146
- package/src/components/page-templates/index.jsx +30 -256
- package/src/components/post-list/index.jsx +7 -20
- package/src/components/sidebar-global-styles/index.jsx +7 -5
- package/src/components/sidebar-global-styles/style.scss +6 -0
- package/src/components/sidebar-identity/index.jsx +23 -19
- package/src/components/sidebar-identity/style.scss +7 -0
- package/src/components/sidebar-navigation-item/index.jsx +1 -7
- package/src/components/sidebar-navigation-screen-templates-browse/content.jsx +45 -80
- package/src/components/sidebar-navigation-screen-templates-browse/index.jsx +1 -8
- package/src/components/site-editor-routes/templates.jsx +2 -19
- package/src/components/welcome-guide/style.scss +1 -1
- package/src/index.jsx +0 -1
- package/src/style.scss +1 -1
- package/src/utils/test/get-filtered-template-parts.js +1 -0
- package/build/components/add-new-template-legacy/add-custom-generic-template-modal-content.cjs +0 -107
- package/build/components/add-new-template-legacy/add-custom-generic-template-modal-content.cjs.map +0 -7
- package/build/components/add-new-template-legacy/add-custom-template-modal-content.cjs +0 -327
- package/build/components/add-new-template-legacy/add-custom-template-modal-content.cjs.map +0 -7
- package/build/components/add-new-template-legacy/index.cjs +0 -390
- package/build/components/add-new-template-legacy/index.cjs.map +0 -7
- package/build/components/add-new-template-legacy/utils.cjs +0 -623
- package/build/components/add-new-template-legacy/utils.cjs.map +0 -7
- package/build/components/page-templates/hooks.cjs +0 -94
- package/build/components/page-templates/hooks.cjs.map +0 -7
- package/build/components/page-templates/index-legacy.cjs +0 -167
- package/build/components/page-templates/index-legacy.cjs.map +0 -7
- package/build/components/page-templates/view-utils.cjs +0 -79
- package/build/components/page-templates/view-utils.cjs.map +0 -7
- package/build/components/sidebar-navigation-screen-templates-browse/content-legacy.cjs +0 -78
- package/build/components/sidebar-navigation-screen-templates-browse/content-legacy.cjs.map +0 -7
- package/build-module/components/add-new-template-legacy/add-custom-generic-template-modal-content.mjs +0 -91
- package/build-module/components/add-new-template-legacy/add-custom-generic-template-modal-content.mjs.map +0 -7
- package/build-module/components/add-new-template-legacy/add-custom-template-modal-content.mjs +0 -315
- package/build-module/components/add-new-template-legacy/add-custom-template-modal-content.mjs.map +0 -7
- package/build-module/components/add-new-template-legacy/index.mjs +0 -391
- package/build-module/components/add-new-template-legacy/index.mjs.map +0 -7
- package/build-module/components/add-new-template-legacy/utils.mjs +0 -592
- package/build-module/components/add-new-template-legacy/utils.mjs.map +0 -7
- package/build-module/components/page-templates/hooks.mjs +0 -74
- package/build-module/components/page-templates/hooks.mjs.map +0 -7
- package/build-module/components/page-templates/index-legacy.mjs +0 -136
- package/build-module/components/page-templates/index-legacy.mjs.map +0 -7
- package/build-module/components/page-templates/view-utils.mjs +0 -52
- package/build-module/components/page-templates/view-utils.mjs.map +0 -7
- package/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.mjs +0 -52
- package/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.mjs.map +0 -7
- package/src/components/add-new-template-legacy/add-custom-generic-template-modal-content.jsx +0 -85
- package/src/components/add-new-template-legacy/add-custom-template-modal-content.jsx +0 -306
- package/src/components/add-new-template-legacy/index.jsx +0 -440
- package/src/components/add-new-template-legacy/utils.js +0 -757
- package/src/components/page-templates/hooks.js +0 -93
- package/src/components/page-templates/index-legacy.jsx +0 -143
- package/src/components/page-templates/view-utils.js +0 -50
- package/src/components/sidebar-navigation-screen-templates-browse/content-legacy.jsx +0 -52
- package/src/components/sidebar-navigation-screen-templates-browse/style.scss +0 -6
|
@@ -6,7 +6,9 @@ import { store as coreStore } from "@wordpress/core-data";
|
|
|
6
6
|
import { DataForm } from "@wordpress/dataviews";
|
|
7
7
|
import { MediaEdit } from "@wordpress/fields";
|
|
8
8
|
import { decodeEntities } from "@wordpress/html-entities";
|
|
9
|
+
import { useViewConfig } from "@wordpress/views";
|
|
9
10
|
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
var VIEW_CONFIG_FIELDS = ["form"];
|
|
10
12
|
var fields = [
|
|
11
13
|
{
|
|
12
14
|
id: "title",
|
|
@@ -53,39 +55,32 @@ var fields = [
|
|
|
53
55
|
})
|
|
54
56
|
}
|
|
55
57
|
];
|
|
56
|
-
var form = {
|
|
57
|
-
layout: {
|
|
58
|
-
type: "regular",
|
|
59
|
-
labelPosition: "top"
|
|
60
|
-
},
|
|
61
|
-
fields: ["title", "description", "site_logo", "site_icon"]
|
|
62
|
-
};
|
|
63
58
|
function SidebarIdentity() {
|
|
64
59
|
const data = useSelect(
|
|
65
60
|
(select) => select(coreStore).getEditedEntityRecord("root", "site"),
|
|
66
61
|
[]
|
|
67
62
|
);
|
|
68
63
|
const { editEntityRecord } = useDispatch(coreStore);
|
|
64
|
+
const { form } = useViewConfig({
|
|
65
|
+
kind: "root",
|
|
66
|
+
name: "site",
|
|
67
|
+
fields: VIEW_CONFIG_FIELDS
|
|
68
|
+
});
|
|
69
69
|
const onChange = (edits) => {
|
|
70
70
|
editEntityRecord("root", "site", void 0, edits);
|
|
71
71
|
};
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
if (!form) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return /* @__PURE__ */ jsx(Page, { title: _x("Identity", "site identity"), headingLevel: 2, children: /* @__PURE__ */ jsx("div", { className: "edit-site-sidebar-identity__form", children: /* @__PURE__ */ jsx(
|
|
76
|
+
DataForm,
|
|
74
77
|
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
DataForm,
|
|
80
|
-
{
|
|
81
|
-
data,
|
|
82
|
-
fields,
|
|
83
|
-
form,
|
|
84
|
-
onChange
|
|
85
|
-
}
|
|
86
|
-
)
|
|
78
|
+
data,
|
|
79
|
+
fields,
|
|
80
|
+
form,
|
|
81
|
+
onChange
|
|
87
82
|
}
|
|
88
|
-
);
|
|
83
|
+
) }) });
|
|
89
84
|
}
|
|
90
85
|
export {
|
|
91
86
|
SidebarIdentity as default
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar-identity/index.jsx"],
|
|
4
|
-
"sourcesContent": ["import { Page } from '@wordpress/admin-ui';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { DataForm } from '@wordpress/dataviews';\nimport { MediaEdit } from '@wordpress/fields';\nimport { decodeEntities } from '@wordpress/html-entities';\n\nconst fields = [\n\t{\n\t\tid: 'title',\n\t\ttype: 'text',\n\t\tlabel: __( 'Site Title' ),\n\t\tdescription: __(\n\t\t\t\"Displays in your site's layout via the Site Title block.\"\n\t\t),\n\t\tgetValue: ( { item } ) => decodeEntities( item.title ?? '' ),\n\t},\n\t{\n\t\tid: 'description',\n\t\ttype: 'text',\n\t\tlabel: __( 'Site Tagline' ),\n\t\tdescription: __(\n\t\t\t\"In a few words, explain what this site is about. Displays in your site's layout via the Site Tagline block.\"\n\t\t),\n\t\tgetValue: ( { item } ) => decodeEntities( item.description ?? '' ),\n\t},\n\t{\n\t\tid: 'site_logo',\n\t\ttype: 'media',\n\t\tlabel: __( 'Site Logo' ),\n\t\tdescription: __(\n\t\t\t\"Displays in your site's layout via the Site Logo block.\"\n\t\t),\n\t\tplaceholder: __( 'Choose logo' ),\n\t\tEdit: MediaEdit,\n\t\tsetValue: ( { value } ) => ( {\n\t\t\tsite_logo: value ?? 0,\n\t\t} ),\n\t},\n\t{\n\t\tid: 'site_icon',\n\t\ttype: 'media',\n\t\tlabel: __( 'Site Icon' ),\n\t\tdescription: __(\n\t\t\t'Shown in browser tabs, bookmarks, and mobile apps. It should be square and at least 512 by 512 pixels.'\n\t\t),\n\t\tplaceholder: __( 'Choose icon' ),\n\t\tEdit: MediaEdit,\n\t\tsetValue: ( { value } ) => ( {\n\t\t\tsite_icon: value ?? 0,\n\t\t} ),\n\t},\n];\n\
|
|
5
|
-
"mappings": ";AAAA,SAAS,YAAY;AACrB,SAAS,IAAI,UAAU;AACvB,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,iBAAiB;AACnC,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;
|
|
4
|
+
"sourcesContent": ["import { Page } from '@wordpress/admin-ui';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { DataForm } from '@wordpress/dataviews';\nimport { MediaEdit } from '@wordpress/fields';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewConfig } from '@wordpress/views';\n\n// The screen only renders a form, so it requests the `form` of the entity\n// view configuration alone.\nconst VIEW_CONFIG_FIELDS = [ 'form' ];\n\nconst fields = [\n\t{\n\t\tid: 'title',\n\t\ttype: 'text',\n\t\tlabel: __( 'Site Title' ),\n\t\tdescription: __(\n\t\t\t\"Displays in your site's layout via the Site Title block.\"\n\t\t),\n\t\tgetValue: ( { item } ) => decodeEntities( item.title ?? '' ),\n\t},\n\t{\n\t\tid: 'description',\n\t\ttype: 'text',\n\t\tlabel: __( 'Site Tagline' ),\n\t\tdescription: __(\n\t\t\t\"In a few words, explain what this site is about. Displays in your site's layout via the Site Tagline block.\"\n\t\t),\n\t\tgetValue: ( { item } ) => decodeEntities( item.description ?? '' ),\n\t},\n\t{\n\t\tid: 'site_logo',\n\t\ttype: 'media',\n\t\tlabel: __( 'Site Logo' ),\n\t\tdescription: __(\n\t\t\t\"Displays in your site's layout via the Site Logo block.\"\n\t\t),\n\t\tplaceholder: __( 'Choose logo' ),\n\t\tEdit: MediaEdit,\n\t\tsetValue: ( { value } ) => ( {\n\t\t\tsite_logo: value ?? 0,\n\t\t} ),\n\t},\n\t{\n\t\tid: 'site_icon',\n\t\ttype: 'media',\n\t\tlabel: __( 'Site Icon' ),\n\t\tdescription: __(\n\t\t\t'Shown in browser tabs, bookmarks, and mobile apps. It should be square and at least 512 by 512 pixels.'\n\t\t),\n\t\tplaceholder: __( 'Choose icon' ),\n\t\tEdit: MediaEdit,\n\t\tsetValue: ( { value } ) => ( {\n\t\t\tsite_icon: value ?? 0,\n\t\t} ),\n\t},\n];\n\nexport default function SidebarIdentity() {\n\tconst data = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEditedEntityRecord( 'root', 'site' ),\n\t\t[]\n\t);\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { form } = useViewConfig( {\n\t\tkind: 'root',\n\t\tname: 'site',\n\t\tfields: VIEW_CONFIG_FIELDS,\n\t} );\n\n\tconst onChange = ( edits ) => {\n\t\teditEntityRecord( 'root', 'site', undefined, edits );\n\t};\n\n\tif ( ! form ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Page title={ _x( 'Identity', 'site identity' ) } headingLevel={ 2 }>\n\t\t\t<div className=\"edit-site-sidebar-identity__form\">\n\t\t\t\t<DataForm\n\t\t\t\t\tdata={ data }\n\t\t\t\t\tfields={ fields }\n\t\t\t\t\tform={ form }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Page>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,YAAY;AACrB,SAAS,IAAI,UAAU;AACvB,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,iBAAiB;AACnC,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AA6E1B;AAzEJ,IAAM,qBAAqB,CAAE,MAAO;AAEpC,IAAM,SAAS;AAAA,EACd;AAAA,IACC,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,OAAO,GAAI,YAAa;AAAA,IACxB,aAAa;AAAA,MACZ;AAAA,IACD;AAAA,IACA,UAAU,CAA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,cAAe,GAChE,8BAAC,SAAI,WAAU,oCACd;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACD,GACD,GACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -60,14 +60,7 @@ function SidebarNavigationItemContent({
|
|
|
60
60
|
"aria-current": isActive ? true : void 0,
|
|
61
61
|
...props,
|
|
62
62
|
children: /* @__PURE__ */ jsxs(Stack, { direction: "row", align: "center", justify: "start", gap: "sm", children: [
|
|
63
|
-
icon && /* @__PURE__ */ jsx(
|
|
64
|
-
Icon,
|
|
65
|
-
{
|
|
66
|
-
style: { fill: "currentcolor" },
|
|
67
|
-
icon,
|
|
68
|
-
size: 24
|
|
69
|
-
}
|
|
70
|
-
),
|
|
63
|
+
icon && /* @__PURE__ */ jsx(Icon, { icon, size: 24 }),
|
|
71
64
|
/* @__PURE__ */ jsx(FlexBlock, { children }),
|
|
72
65
|
withChevron && /* @__PURE__ */ jsx(
|
|
73
66
|
Icon,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar-navigation-item/index.jsx"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport { __experimentalItem as Item, FlexBlock } from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { isRTL } from '@wordpress/i18n';\nimport { chevronRightSmall, chevronLeftSmall, Icon } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useContext } from '@wordpress/element';\nimport { unlock } from '../../lock-unlock';\nimport { SidebarNavigationContext } from '../sidebar';\n\nconst { useHistory, useLink, useLocation } = unlock( routerPrivateApis );\n\nexport default function SidebarNavigationItem( {\n\tisHidden = false,\n\t...props\n} ) {\n\tif ( isHidden ) {\n\t\treturn null;\n\t}\n\n\treturn <SidebarNavigationItemContent { ...props } />;\n}\n\nfunction SidebarNavigationItemContent( {\n\tclassName,\n\ticon,\n\twithChevron = false,\n\tsuffix,\n\tuid,\n\tto,\n\tonClick,\n\tactiveOnRouteName,\n\tchildren,\n\t...props\n} ) {\n\tconst history = useHistory();\n\tconst linkProps = useLink( to );\n\tconst { name } = useLocation();\n\tconst { navigate } = useContext( SidebarNavigationContext );\n\n\tconst isActive = activeOnRouteName && name === activeOnRouteName;\n\t// If there is no custom click handler, create one that navigates to `params`.\n\tfunction handleClick( e ) {\n\t\tif ( onClick ) {\n\t\t\tonClick( e );\n\t\t\tnavigate( 'forward' );\n\t\t} else if ( to ) {\n\t\t\te.preventDefault();\n\t\t\thistory.navigate( to );\n\t\t\tnavigate( 'forward', `[id=\"${ uid }\"]` );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Item\n\t\t\tclassName={ clsx(\n\t\t\t\t'edit-site-sidebar-navigation-item',\n\t\t\t\t{ 'with-suffix': ! withChevron && suffix },\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\tid={ uid }\n\t\t\tonClick={ handleClick }\n\t\t\thref={ to ? linkProps.href : undefined }\n\t\t\taria-current={ isActive ? true : undefined }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<Stack direction=\"row\" align=\"center\" justify=\"start\" gap=\"sm\">\n\t\t\t\t{ icon &&
|
|
5
|
-
"mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,sBAAsB,MAAM,iBAAiB;AACtD,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,mBAAmB,kBAAkB,YAAY;AAC1D,SAAS,eAAe,yBAAyB;AACjD,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,gCAAgC;AAYjC,cA8CL,YA9CK;AAVR,IAAM,EAAE,YAAY,SAAS,YAAY,IAAI,OAAQ,iBAAkB;AAExD,SAAR,sBAAwC;AAAA,EAC9C,WAAW;AAAA,EACX,GAAG;AACJ,GAAI;AACH,MAAK,UAAW;AACf,WAAO;AAAA,EACR;AAEA,SAAO,oBAAC,gCAA+B,GAAG,OAAQ;AACnD;AAEA,SAAS,6BAA8B;AAAA,EACtC;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAAI;AACH,QAAM,UAAU,WAAW;AAC3B,QAAM,YAAY,QAAS,EAAG;AAC9B,QAAM,EAAE,KAAK,IAAI,YAAY;AAC7B,QAAM,EAAE,SAAS,IAAI,WAAY,wBAAyB;AAE1D,QAAM,WAAW,qBAAqB,SAAS;AAE/C,WAAS,YAAa,GAAI;AACzB,QAAK,SAAU;AACd,cAAS,CAAE;AACX,eAAU,SAAU;AAAA,IACrB,WAAY,IAAK;AAChB,QAAE,eAAe;AACjB,cAAQ,SAAU,EAAG;AACrB,eAAU,WAAW,QAAS,GAAI,IAAK;AAAA,IACxC;AAAA,EACD;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAY;AAAA,QACX;AAAA,QACA,EAAE,eAAe,CAAE,eAAe,OAAO;AAAA,QACzC;AAAA,MACD;AAAA,MACA,IAAK;AAAA,MACL,SAAU;AAAA,MACV,MAAO,KAAK,UAAU,OAAO;AAAA,MAC7B,gBAAe,WAAW,OAAO;AAAA,MAC/B,GAAG;AAAA,MAEL,+BAAC,SAAM,WAAU,OAAM,OAAM,UAAS,SAAQ,SAAQ,KAAI,MACvD;AAAA,
|
|
4
|
+
"sourcesContent": ["import clsx from 'clsx';\nimport { __experimentalItem as Item, FlexBlock } from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { isRTL } from '@wordpress/i18n';\nimport { chevronRightSmall, chevronLeftSmall, Icon } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useContext } from '@wordpress/element';\nimport { unlock } from '../../lock-unlock';\nimport { SidebarNavigationContext } from '../sidebar';\n\nconst { useHistory, useLink, useLocation } = unlock( routerPrivateApis );\n\nexport default function SidebarNavigationItem( {\n\tisHidden = false,\n\t...props\n} ) {\n\tif ( isHidden ) {\n\t\treturn null;\n\t}\n\n\treturn <SidebarNavigationItemContent { ...props } />;\n}\n\nfunction SidebarNavigationItemContent( {\n\tclassName,\n\ticon,\n\twithChevron = false,\n\tsuffix,\n\tuid,\n\tto,\n\tonClick,\n\tactiveOnRouteName,\n\tchildren,\n\t...props\n} ) {\n\tconst history = useHistory();\n\tconst linkProps = useLink( to );\n\tconst { name } = useLocation();\n\tconst { navigate } = useContext( SidebarNavigationContext );\n\n\tconst isActive = activeOnRouteName && name === activeOnRouteName;\n\t// If there is no custom click handler, create one that navigates to `params`.\n\tfunction handleClick( e ) {\n\t\tif ( onClick ) {\n\t\t\tonClick( e );\n\t\t\tnavigate( 'forward' );\n\t\t} else if ( to ) {\n\t\t\te.preventDefault();\n\t\t\thistory.navigate( to );\n\t\t\tnavigate( 'forward', `[id=\"${ uid }\"]` );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Item\n\t\t\tclassName={ clsx(\n\t\t\t\t'edit-site-sidebar-navigation-item',\n\t\t\t\t{ 'with-suffix': ! withChevron && suffix },\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\tid={ uid }\n\t\t\tonClick={ handleClick }\n\t\t\thref={ to ? linkProps.href : undefined }\n\t\t\taria-current={ isActive ? true : undefined }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<Stack direction=\"row\" align=\"center\" justify=\"start\" gap=\"sm\">\n\t\t\t\t{ icon && <Icon icon={ icon } size={ 24 } /> }\n\t\t\t\t<FlexBlock>{ children }</FlexBlock>\n\t\t\t\t{ withChevron && (\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ isRTL() ? chevronLeftSmall : chevronRightSmall }\n\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-item__drilldown-indicator\"\n\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! withChevron && suffix }\n\t\t\t</Stack>\n\t\t</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O;AAAA,MAC/B,GAAG;AAAA,MAEL,+BAAC,SAAM,WAAU,OAAM,OAAM,UAAS,SAAQ,SAAQ,KAAI,MACvD;AAAA,gBAAQ,oBAAC,QAAK,MAAc,MAAO,IAAK;AAAA,QAC1C,oBAAC,aAAY,UAAU;AAAA,QACrB,eACD;AAAA,UAAC;AAAA;AAAA,YACA,MAAO,MAAM,IAAI,mBAAmB;AAAA,YACpC,WAAU;AAAA,YACV,MAAO;AAAA;AAAA,QACR;AAAA,QAEC,CAAE,eAAe;AAAA,SACpB;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,84 +1,51 @@
|
|
|
1
1
|
// packages/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.jsx
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import { jsx
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import { store as coreStore } from "@wordpress/core-data";
|
|
3
|
+
import { useSelect } from "@wordpress/data";
|
|
4
|
+
import {
|
|
5
|
+
commentAuthorAvatar,
|
|
6
|
+
layout,
|
|
7
|
+
plugins as pluginIcon,
|
|
8
|
+
globe
|
|
9
|
+
} from "@wordpress/icons";
|
|
10
|
+
import { TEMPLATE_POST_TYPE } from "../../utils/constants.mjs";
|
|
11
|
+
import DataViewsSidebarContent from "../sidebar-dataviews/index.mjs";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
var SOURCE_TO_ICON = {
|
|
14
|
+
user: commentAuthorAvatar,
|
|
15
|
+
theme: layout,
|
|
16
|
+
plugin: pluginIcon,
|
|
17
|
+
site: globe
|
|
18
|
+
};
|
|
19
|
+
function DataviewsTemplatesSidebarContent() {
|
|
20
|
+
const authorSourceMap = useSelect((select) => {
|
|
21
|
+
const templates = select(coreStore).getEntityRecords(
|
|
22
|
+
"postType",
|
|
23
|
+
TEMPLATE_POST_TYPE,
|
|
24
|
+
{ per_page: -1 }
|
|
25
|
+
);
|
|
26
|
+
if (!templates) {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
const map = {};
|
|
30
|
+
for (const template of templates) {
|
|
31
|
+
if (template.author_text && template.original_source && !map[template.author_text]) {
|
|
32
|
+
map[template.author_text] = template.original_source;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return map;
|
|
36
|
+
}, []);
|
|
37
|
+
const resolveIcon = (view) => {
|
|
38
|
+
const source = authorSourceMap[view.slug];
|
|
39
|
+
return SOURCE_TO_ICON[source] ?? layout;
|
|
40
|
+
};
|
|
17
41
|
return /* @__PURE__ */ jsx(
|
|
18
|
-
|
|
42
|
+
DataViewsSidebarContent,
|
|
19
43
|
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"aria-current": isActive,
|
|
23
|
-
children: text
|
|
44
|
+
postType: TEMPLATE_POST_TYPE,
|
|
45
|
+
resolveIcon
|
|
24
46
|
}
|
|
25
47
|
);
|
|
26
48
|
}
|
|
27
|
-
function DataviewsTemplatesSidebarContent() {
|
|
28
|
-
const {
|
|
29
|
-
query: { activeView = "active" }
|
|
30
|
-
} = useLocation();
|
|
31
|
-
const { records } = useEntityRecords("root", "registeredTemplate", {
|
|
32
|
-
// This should not be needed, the endpoint returns all registered
|
|
33
|
-
// templates, but it's not possible right now to turn off pagination for
|
|
34
|
-
// entity configs.
|
|
35
|
-
per_page: -1
|
|
36
|
-
});
|
|
37
|
-
const firstItemPerAuthorText = useMemo(() => {
|
|
38
|
-
const firstItemPerAuthor = records?.reduce((acc, template) => {
|
|
39
|
-
const author = template.author_text;
|
|
40
|
-
if (author && !acc[author]) {
|
|
41
|
-
acc[author] = template;
|
|
42
|
-
}
|
|
43
|
-
return acc;
|
|
44
|
-
}, {});
|
|
45
|
-
return (firstItemPerAuthor && Object.values(firstItemPerAuthor)) ?? EMPTY_ARRAY;
|
|
46
|
-
}, [records]);
|
|
47
|
-
return /* @__PURE__ */ jsxs(ItemGroup, { className: "edit-site-sidebar-navigation-screen-templates-browse", children: [
|
|
48
|
-
/* @__PURE__ */ jsx(
|
|
49
|
-
SidebarNavigationItem,
|
|
50
|
-
{
|
|
51
|
-
to: "/template",
|
|
52
|
-
icon: published,
|
|
53
|
-
"aria-current": activeView === "active",
|
|
54
|
-
children: __("Active templates")
|
|
55
|
-
}
|
|
56
|
-
),
|
|
57
|
-
/* @__PURE__ */ jsx(
|
|
58
|
-
SidebarNavigationItem,
|
|
59
|
-
{
|
|
60
|
-
to: addQueryArgs("/template", { activeView: "user" }),
|
|
61
|
-
icon: commentAuthorAvatar,
|
|
62
|
-
"aria-current": activeView === "user",
|
|
63
|
-
// Let's avoid calling them "custom templates" to avoid
|
|
64
|
-
// confusion. "Created" is closest to meaning database
|
|
65
|
-
// templates, created by users.
|
|
66
|
-
// https://developer.wordpress.org/themes/classic-themes/templates/page-template-files/#creating-custom-page-templates-for-global-use
|
|
67
|
-
children: __("Created templates")
|
|
68
|
-
}
|
|
69
|
-
),
|
|
70
|
-
firstItemPerAuthorText.map((template) => {
|
|
71
|
-
return /* @__PURE__ */ jsx(
|
|
72
|
-
TemplateDataviewItem,
|
|
73
|
-
{
|
|
74
|
-
template,
|
|
75
|
-
isActive: activeView === template.author_text
|
|
76
|
-
},
|
|
77
|
-
template.author_text
|
|
78
|
-
);
|
|
79
|
-
})
|
|
80
|
-
] });
|
|
81
|
-
}
|
|
82
49
|
export {
|
|
83
50
|
DataviewsTemplatesSidebarContent as default
|
|
84
51
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar-navigation-screen-templates-browse/content.jsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": ";AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tcommentAuthorAvatar,\n\tlayout,\n\tplugins as pluginIcon,\n\tglobe,\n} from '@wordpress/icons';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\n\nconst SOURCE_TO_ICON = {\n\tuser: commentAuthorAvatar,\n\ttheme: layout,\n\tplugin: pluginIcon,\n\tsite: globe,\n};\nexport default function DataviewsTemplatesSidebarContent() {\n\tconst authorSourceMap = useSelect( ( select ) => {\n\t\tconst templates = select( coreStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t{ per_page: -1 }\n\t\t);\n\t\tif ( ! templates ) {\n\t\t\treturn {};\n\t\t}\n\t\tconst map = {};\n\t\tfor ( const template of templates ) {\n\t\t\tif (\n\t\t\t\ttemplate.author_text &&\n\t\t\t\ttemplate.original_source &&\n\t\t\t\t! map[ template.author_text ]\n\t\t\t) {\n\t\t\t\tmap[ template.author_text ] = template.original_source;\n\t\t\t}\n\t\t}\n\t\treturn map;\n\t}, [] );\n\n\tconst resolveIcon = ( view ) => {\n\t\tconst source = authorSourceMap[ view.slug ];\n\t\treturn SOURCE_TO_ICON[ source ] ?? layout;\n\t};\n\n\treturn (\n\t\t<DataViewsSidebarContent\n\t\t\tpostType={ TEMPLATE_POST_TYPE }\n\t\t\tresolveIcon={ resolveIcon }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,SAAS,iBAAiB;AACnC,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,OACM;AACP,SAAS,0BAA0B;AACnC,OAAO,6BAA6B;AAqClC;AAnCF,IAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACP;AACe,SAAR,mCAAoD;AAC1D,QAAM,kBAAkB,UAAW,CAAE,WAAY;AAChD,UAAM,YAAY,OAAQ,SAAU,EAAE;AAAA,MACrC;AAAA,MACA;AAAA,MACA,EAAE,UAAU,GAAG;AAAA,IAChB;AACA,QAAK,CAAE,WAAY;AAClB,aAAO,CAAC;AAAA,IACT;AACA,UAAM,MAAM,CAAC;AACb,eAAY,YAAY,WAAY;AACnC,UACC,SAAS,eACT,SAAS,mBACT,CAAE,IAAK,SAAS,WAAY,GAC3B;AACD,YAAK,SAAS,WAAY,IAAI,SAAS;AAAA,MACxC;AAAA,IACD;AACA,WAAO;AAAA,EACR,GAAG,CAAC,CAAE;AAEN,QAAM,cAAc,CAAE,SAAU;AAC/B,UAAM,SAAS,gBAAiB,KAAK,IAAK;AAC1C,WAAO,eAAgB,MAAO,KAAK;AAAA,EACpC;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAW;AAAA,MACX;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { __ } from "@wordpress/i18n";
|
|
3
3
|
import SidebarNavigationScreen from "../sidebar-navigation-screen/index.mjs";
|
|
4
4
|
import DataviewsTemplatesSidebarContent from "./content.mjs";
|
|
5
|
-
import DataviewsTemplatesSidebarContentLegacy from "./content-legacy.mjs";
|
|
6
5
|
import { jsx } from "react/jsx-runtime";
|
|
7
6
|
function SidebarNavigationScreenTemplatesBrowse({ backPath }) {
|
|
8
7
|
return /* @__PURE__ */ jsx(
|
|
@@ -13,7 +12,7 @@ function SidebarNavigationScreenTemplatesBrowse({ backPath }) {
|
|
|
13
12
|
"Manage the templates that define the structure of your pages, or reset any customizations made to those supplied by your theme."
|
|
14
13
|
),
|
|
15
14
|
backPath,
|
|
16
|
-
content:
|
|
15
|
+
content: /* @__PURE__ */ jsx(DataviewsTemplatesSidebarContent, {})
|
|
17
16
|
}
|
|
18
17
|
);
|
|
19
18
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar-navigation-screen-templates-browse/index.jsx"],
|
|
4
|
-
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport DataviewsTemplatesSidebarContent from './content';\
|
|
5
|
-
"mappings": ";AAAA,SAAS,UAAU;AACnB,OAAO,6BAA6B;AACpC,OAAO,sCAAsC;
|
|
4
|
+
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport DataviewsTemplatesSidebarContent from './content';\n\nexport default function SidebarNavigationScreenTemplatesBrowse( { backPath } ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Manage the templates that define the structure of your pages, or reset any customizations made to those supplied by your theme.'\n\t\t\t) }\n\t\t\tbackPath={ backPath }\n\t\t\tcontent={ <DataviewsTemplatesSidebarContent /> }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,UAAU;AACnB,OAAO,6BAA6B;AACpC,OAAO,sCAAsC;AAUhC;AARE,SAAR,uCAAyD,EAAE,SAAS,GAAI;AAC9E,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,WAAY;AAAA,MACxB,aAAc;AAAA,QACb;AAAA,MACD;AAAA,MACA;AAAA,MACA,SAAU,oBAAC,oCAAiC;AAAA;AAAA,EAC7C;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,7 +6,6 @@ import Editor from "../editor/index.mjs";
|
|
|
6
6
|
import SidebarNavigationScreenTemplatesBrowse from "../sidebar-navigation-screen-templates-browse/index.mjs";
|
|
7
7
|
import SidebarNavigationScreenUnsupported from "../sidebar-navigation-screen-unsupported/index.mjs";
|
|
8
8
|
import PageTemplates from "../page-templates/index.mjs";
|
|
9
|
-
import PageTemplatesLegacy from "../page-templates/index-legacy.mjs";
|
|
10
9
|
import { unlock } from "../../lock-unlock.mjs";
|
|
11
10
|
import { isThemeDataLoaded } from "./utils.mjs";
|
|
12
11
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
@@ -42,7 +41,7 @@ var templatesRoute = {
|
|
|
42
41
|
if (!isBlockTheme) {
|
|
43
42
|
return void 0;
|
|
44
43
|
}
|
|
45
|
-
return
|
|
44
|
+
return /* @__PURE__ */ jsx(PageTemplates, {});
|
|
46
45
|
},
|
|
47
46
|
async preview({ query, siteData }) {
|
|
48
47
|
const isBlockTheme = siteData.currentTheme?.is_block_theme;
|
|
@@ -66,8 +65,7 @@ var templatesRoute = {
|
|
|
66
65
|
if (!isBlockTheme) {
|
|
67
66
|
return void 0;
|
|
68
67
|
}
|
|
69
|
-
|
|
70
|
-
return isTemplateActivateEnabled ? /* @__PURE__ */ jsx(PageTemplates, {}) : /* @__PURE__ */ jsx(PageTemplatesLegacy, {});
|
|
68
|
+
return /* @__PURE__ */ jsx(PageTemplates, {});
|
|
71
69
|
}
|
|
72
70
|
},
|
|
73
71
|
widths: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/site-editor-routes/templates.jsx"],
|
|
4
|
-
"sourcesContent": ["import { resolveSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { loadView } from '@wordpress/views';\nimport Editor from '../editor';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';\nimport PageTemplates from '../page-templates';\nimport
|
|
5
|
-
"mappings": ";AAAA,SAAS,qBAAqB;AAC9B,SAAS,SAAS,iBAAiB;AACnC,SAAS,gBAAgB;AACzB,OAAO,YAAY;AACnB,OAAO,4CAA4C;AACnD,OAAO,wCAAwC;AAC/C,OAAO,mBAAmB;AAC1B,
|
|
4
|
+
"sourcesContent": ["import { resolveSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { loadView } from '@wordpress/views';\nimport Editor from '../editor';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';\nimport PageTemplates from '../page-templates';\nimport { unlock } from '../../lock-unlock';\nimport { isThemeDataLoaded } from './utils';\n\nasync function isTemplateListView( query ) {\n\tconst { activeView = 'active' } = query;\n\tconst config = await unlock( resolveSelect( coreStore ) ).getViewConfig(\n\t\t'postType',\n\t\t'wp_template'\n\t);\n\tconst defaultView = config?.default_view;\n\tconst activeViewOverrides =\n\t\tconfig?.view_list?.find( ( v ) => v.slug === activeView )?.view ?? {};\n\tconst view = await loadView( {\n\t\tkind: 'postType',\n\t\tname: 'wp_template',\n\t\tslug: 'default',\n\t\tdefaultView,\n\t\tactiveViewOverrides,\n\t} );\n\treturn view.type === 'list';\n}\n\nexport const templatesRoute = {\n\tname: 'templates',\n\tpath: '/template',\n\tareas: {\n\t\tsidebar( { siteData } ) {\n\t\t\tif ( ! isThemeDataLoaded( siteData ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn siteData.currentTheme.is_block_theme ? (\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse backPath=\"/\" />\n\t\t\t) : (\n\t\t\t\t<SidebarNavigationScreenUnsupported />\n\t\t\t);\n\t\t},\n\t\tcontent( { siteData } ) {\n\t\t\tconst isBlockTheme = siteData.currentTheme?.is_block_theme;\n\t\t\tif ( ! isBlockTheme ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn <PageTemplates />;\n\t\t},\n\t\tasync preview( { query, siteData } ) {\n\t\t\tconst isBlockTheme = siteData.currentTheme?.is_block_theme;\n\t\t\tif ( ! isBlockTheme ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst isListView = await isTemplateListView( query );\n\t\t\treturn isListView ? <Editor /> : undefined;\n\t\t},\n\t\tmobileSidebar( { siteData } ) {\n\t\t\tif ( ! isThemeDataLoaded( siteData ) ) {\n\t\t\t\treturn <></>;\n\t\t\t}\n\t\t\tif ( ! siteData.currentTheme.is_block_theme ) {\n\t\t\t\treturn <SidebarNavigationScreenUnsupported />;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t\tmobileContent( { siteData } ) {\n\t\t\tconst isBlockTheme = siteData.currentTheme?.is_block_theme;\n\t\t\tif ( ! isBlockTheme ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn <PageTemplates />;\n\t\t},\n\t},\n\twidths: {\n\t\tasync content( { query } ) {\n\t\t\tconst isListView = await isTemplateListView( query );\n\t\t\treturn isListView ? 380 : undefined;\n\t\t},\n\t},\n};\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,qBAAqB;AAC9B,SAAS,SAAS,iBAAiB;AACnC,SAAS,gBAAgB;AACzB,OAAO,YAAY;AACnB,OAAO,4CAA4C;AACnD,OAAO,wCAAwC;AAC/C,OAAO,mBAAmB;AAC1B,SAAS,cAAc;AACvB,SAAS,yBAAyB;AA8B9B,SAsBO,UAtBP;AA5BJ,eAAe,mBAAoB,OAAQ;AAC1C,QAAM,EAAE,aAAa,SAAS,IAAI;AAClC,QAAM,SAAS,MAAM,OAAQ,cAAe,SAAU,CAAE,EAAE;AAAA,IACzD;AAAA,IACA;AAAA,EACD;AACA,QAAM,cAAc,QAAQ;AAC5B,QAAM,sBACL,QAAQ,WAAW,KAAM,CAAE,MAAO,EAAE,SAAS,UAAW,GAAG,QAAQ,CAAC;AACrE,QAAM,OAAO,MAAM,SAAU;AAAA,IAC5B,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD,CAAE;AACF,SAAO,KAAK,SAAS;AACtB;AAEO,IAAM,iBAAiB;AAAA,EAC7B,MAAM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3
|
"sources": ["../src/index.jsx"],
|
|
4
|
-
"sourcesContent": ["import { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport { store as editSiteStore } from './store';\nimport { unlock } from './lock-unlock';\nimport App from './components/app';\n\nconst { registerCoreBlockBindingsSources } = unlock( editorPrivateApis );\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tregisterCoreBlockBindingsSources();\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\
|
|
5
|
-
"mappings": ";AAAA,SAAS,SAAS,mBAAmB;AACrC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,gBAAgB;AACzB,OAAO,gBAAgB;AACvB,SAAS,YAAY,kBAAkB;AACvC,SAAS,eAAe,yBAAyB;AACjD,SAAS,SAAS,wBAAwB;AAC1C;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,SAAS,SAAS,qBAAqB;AACvC,SAAS,cAAc;AACvB,OAAO,SAAS;
|
|
4
|
+
"sourcesContent": ["import { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport { store as editSiteStore } from './store';\nimport { unlock } from './lock-unlock';\nimport App from './components/app';\n\nconst { registerCoreBlockBindingsSources } = unlock( editorPrivateApis );\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tregisterCoreBlockBindingsSources();\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t\tenableChoosePatternModal: true,\n\t\tshowCollaborationCursor: false,\n\t\tshowCollaborationJoinNotifications: true,\n\t\tshowCollaborationLeaveNotifications: true,\n\t\tshowCollaborationPostSaveNotifications: true,\n\t} );\n\n\tif ( window.__clientSideMediaProcessing ) {\n\t\tdispatch( preferencesStore ).setDefaults( 'core/media', {\n\t\t\trequireApproval: true,\n\t\t\toptimizeOnUpload: true,\n\t\t} );\n\t}\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<App />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\nexport { store } from './store';\nexport * from './deprecated';\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,SAAS,mBAAmB;AACrC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,gBAAgB;AACzB,OAAO,gBAAgB;AACvB,SAAS,YAAY,kBAAkB;AACvC,SAAS,eAAe,yBAAyB;AACjD,SAAS,SAAS,wBAAwB;AAC1C;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP,SAAS,SAAS,qBAAqB;AACvC,SAAS,cAAc;AACvB,OAAO,SAAS;AAqFhB,SAAoB,WAAXA,gBAA6C;AACtD,SAAS,aAAa;AACtB,cAAc;AAhBX;AArEH,IAAM,EAAE,iCAAiC,IAAI,OAAQ,iBAAkB;AAQhE,SAAS,iBAAkB,IAAI,UAAW;AAChD,QAAM,SAAS,SAAS,eAAgB,EAAG;AAC3C,QAAM,OAAO,WAAY,MAAO;AAEhC,WAAU,WAAY,EAAE,wBAAwB;AAChD,QAAM,aAAa,4BAA4B,EAAE;AAAA,IAChD,CAAE,EAAE,KAAK,MAAO,SAAS;AAAA,EAC1B;AACA,qBAAoB,UAAW;AAC/B,mCAAiC;AACjC,WAAU,WAAY,EAAE,6BAA8B,WAAY;AAClE,4BAA2B,EAAE,UAAU,MAAM,CAAE;AAC/C,2BAA0B,EAAE,UAAU,MAAM,CAAE;AAC9C,MAAK,WAAW,qBAAsB;AACrC,iDAA8C;AAAA,MAC7C,iBAAiB;AAAA,IAClB,CAAE;AAAA,EACH;AAIA,WAAU,gBAAiB,EAAE,YAAa,kBAAkB;AAAA,IAC3D,cAAc;AAAA,IACd,oBAAoB;AAAA,IACpB,kBAAkB;AAAA,IAClB,sBAAsB;AAAA,EACvB,CAAE;AAEF,WAAU,gBAAiB,EAAE,YAAa,QAAQ;AAAA,IACjD,0BAA0B;AAAA,IAC1B,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,WAAW;AAAA,I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