@wordpress/edit-site 5.28.1 → 5.28.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/add-new-pattern/index.js +18 -8
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/editor/index.js +1 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +2 -2
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-details.js +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-details.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +1 -1
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +84 -7
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +1 -1
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +10 -7
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js +14 -1
- package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js +64 -8
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +6 -4
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/layout/index.js +8 -3
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +26 -5
- package/build/components/layout/router.js.map +1 -1
- package/build/components/media/index.js +3 -3
- package/build/components/media/index.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +10 -5
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates-template-parts/index.js +1 -0
- package/build/components/page-templates-template-parts/index.js.map +1 -1
- package/build/components/sidebar/index.js +10 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +1 -1
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +3 -1
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +8 -8
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/store/private-actions.js +3 -1
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +18 -8
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/editor/index.js +1 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +2 -2
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-details.js +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-details.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +1 -1
- 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 +87 -10
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +1 -1
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +11 -8
- 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/index.js +2 -2
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js +13 -1
- package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +63 -8
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +6 -4
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/layout/index.js +8 -3
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +26 -5
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/media/index.js +3 -3
- package/build-module/components/media/index.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +10 -5
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates-template-parts/index.js +1 -0
- package/build-module/components/page-templates-template-parts/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +10 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +2 -2
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +3 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +8 -8
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/store/private-actions.js +3 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/style-rtl.css +33 -11
- package/build-style/style.css +33 -11
- package/package.json +42 -42
- package/src/components/add-new-pattern/index.js +27 -11
- package/src/components/editor/index.js +1 -0
- package/src/components/global-styles/block-preview-panel.js +2 -2
- package/src/components/global-styles/font-library-modal/collection-font-details.js +1 -1
- package/src/components/global-styles/font-library-modal/context.js +1 -1
- package/src/components/global-styles/font-library-modal/font-collection.js +118 -13
- package/src/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +1 -1
- package/src/components/global-styles/font-library-modal/installed-fonts.js +25 -23
- package/src/components/global-styles/font-library-modal/style.scss +2 -5
- package/src/components/global-styles/font-library-modal/utils/index.js +2 -2
- package/src/components/global-styles/font-library-modal/utils/make-families-from-faces.js +13 -1
- package/src/components/global-styles/font-library-modal/utils/preview-styles.js +72 -15
- package/src/components/global-styles/font-library-modal/utils/test/preview-styles.spec.js +60 -5
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +7 -5
- package/src/components/global-styles/screen-revisions/style.scss +11 -6
- package/src/components/layout/index.js +47 -30
- package/src/components/layout/router.js +31 -2
- package/src/components/layout/style.scss +7 -0
- package/src/components/media/index.js +7 -9
- package/src/components/page-patterns/style.scss +10 -0
- package/src/components/page-patterns/use-patterns.js +13 -5
- package/src/components/page-templates-template-parts/index.js +1 -0
- package/src/components/page-templates-template-parts/style.scss +6 -0
- package/src/components/sidebar/index.js +14 -5
- package/src/components/sidebar-dataviews/default-views.js +2 -2
- package/src/components/sidebar-edit-mode/page-panels/style.scss +0 -1
- package/src/components/sidebar-navigation-screen-pages/index.js +10 -6
- package/src/hooks/commands/use-edit-mode-commands.js +14 -14
- package/src/store/private-actions.js +4 -0
- package/build/components/global-styles/font-library-modal/fonts-grid.js +0 -57
- package/build/components/global-styles/font-library-modal/fonts-grid.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js +0 -92
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/fonts-grid.js +0 -50
- package/build-module/components/global-styles/font-library-modal/fonts-grid.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js +0 -84
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js.map +0 -1
- package/src/components/global-styles/font-library-modal/fonts-grid.js +0 -59
- package/src/components/sidebar-navigation-screen-pages-dataviews/index.js +0 -103
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = SidebarNavigationScreenPagesDataViews;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _icons = require("@wordpress/icons");
|
|
11
|
-
var _element = require("@wordpress/element");
|
|
12
|
-
var _coreData = require("@wordpress/core-data");
|
|
13
|
-
var _htmlEntities = require("@wordpress/html-entities");
|
|
14
|
-
var _i18n = require("@wordpress/i18n");
|
|
15
|
-
var _data = require("@wordpress/data");
|
|
16
|
-
var _link = require("../routes/link");
|
|
17
|
-
var _constants = require("../../utils/constants");
|
|
18
|
-
var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigation-item"));
|
|
19
|
-
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
20
|
-
var _sidebarDataviews = _interopRequireDefault(require("../sidebar-dataviews"));
|
|
21
|
-
/**
|
|
22
|
-
* WordPress dependencies
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Internal dependencies
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
const PageItem = ({
|
|
30
|
-
postType = 'page',
|
|
31
|
-
postId,
|
|
32
|
-
...props
|
|
33
|
-
}) => {
|
|
34
|
-
const linkInfo = (0, _link.useLink)({
|
|
35
|
-
postType,
|
|
36
|
-
postId
|
|
37
|
-
}, {
|
|
38
|
-
backPath: '/page'
|
|
39
|
-
});
|
|
40
|
-
return (0, _react.createElement)(_sidebarNavigationItem.default, {
|
|
41
|
-
...linkInfo,
|
|
42
|
-
...props
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
function SidebarNavigationScreenPagesDataViews() {
|
|
46
|
-
const {
|
|
47
|
-
records: templateRecords
|
|
48
|
-
} = (0, _coreData.useEntityRecords)('postType', _constants.TEMPLATE_POST_TYPE, {
|
|
49
|
-
per_page: -1
|
|
50
|
-
});
|
|
51
|
-
const {
|
|
52
|
-
frontPage,
|
|
53
|
-
postsPage
|
|
54
|
-
} = (0, _data.useSelect)(select => {
|
|
55
|
-
const {
|
|
56
|
-
getEntityRecord
|
|
57
|
-
} = select(_coreData.store);
|
|
58
|
-
const siteSettings = getEntityRecord('root', 'site');
|
|
59
|
-
return {
|
|
60
|
-
frontPage: siteSettings?.page_on_front,
|
|
61
|
-
postsPage: siteSettings?.page_for_posts
|
|
62
|
-
};
|
|
63
|
-
}, []);
|
|
64
|
-
const templates = (0, _element.useMemo)(() => {
|
|
65
|
-
if (!templateRecords) {
|
|
66
|
-
return [];
|
|
67
|
-
}
|
|
68
|
-
const isHomePageBlog = frontPage === postsPage;
|
|
69
|
-
const homeTemplate = templateRecords?.find(template => template.slug === 'front-page') || templateRecords?.find(template => template.slug === 'home') || templateRecords?.find(template => template.slug === 'index');
|
|
70
|
-
return [isHomePageBlog ? homeTemplate : null, ...templateRecords?.filter(({
|
|
71
|
-
slug
|
|
72
|
-
}) => ['404', 'search'].includes(slug))].filter(Boolean);
|
|
73
|
-
}, [templateRecords, frontPage, postsPage]);
|
|
74
|
-
return (0, _react.createElement)(_sidebarNavigationScreen.default, {
|
|
75
|
-
title: (0, _i18n.__)('Pages'),
|
|
76
|
-
description: (0, _i18n.__)('Browse and manage pages.'),
|
|
77
|
-
content: (0, _react.createElement)(_sidebarDataviews.default, null),
|
|
78
|
-
backPath: "/page",
|
|
79
|
-
footer: (0, _react.createElement)(_components.__experimentalVStack, {
|
|
80
|
-
spacing: 0
|
|
81
|
-
}, templates?.map(item => (0, _react.createElement)(PageItem, {
|
|
82
|
-
postType: _constants.TEMPLATE_POST_TYPE,
|
|
83
|
-
postId: item.id,
|
|
84
|
-
key: item.id,
|
|
85
|
-
icon: _icons.layout,
|
|
86
|
-
withChevron: true
|
|
87
|
-
}, (0, _react.createElement)(_components.__experimentalTruncate, {
|
|
88
|
-
numberOfLines: 1
|
|
89
|
-
}, (0, _htmlEntities.decodeEntities)(item.title?.rendered || (0, _i18n.__)('(no title)'))))))
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_icons","_element","_coreData","_htmlEntities","_i18n","_data","_link","_constants","_sidebarNavigationItem","_interopRequireDefault","_sidebarNavigationScreen","_sidebarDataviews","PageItem","postType","postId","props","linkInfo","useLink","backPath","_react","createElement","default","SidebarNavigationScreenPagesDataViews","records","templateRecords","useEntityRecords","TEMPLATE_POST_TYPE","per_page","frontPage","postsPage","useSelect","select","getEntityRecord","coreStore","siteSettings","page_on_front","page_for_posts","templates","useMemo","isHomePageBlog","homeTemplate","find","template","slug","filter","includes","Boolean","title","__","description","content","footer","__experimentalVStack","spacing","map","item","id","key","icon","layout","withChevron","__experimentalTruncate","numberOfLines","decodeEntities","rendered"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pages-dataviews/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { layout } from '@wordpress/icons';\nimport { useMemo } from '@wordpress/element';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../routes/link';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\n\nconst PageItem = ( { postType = 'page', postId, ...props } ) => {\n\tconst linkInfo = useLink(\n\t\t{\n\t\t\tpostType,\n\t\t\tpostId,\n\t\t},\n\t\t{\n\t\t\tbackPath: '/page',\n\t\t}\n\t);\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenPagesDataViews() {\n\tconst { records: templateRecords } = useEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_POST_TYPE,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tconst { frontPage, postsPage } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\treturn {\n\t\t\tfrontPage: siteSettings?.page_on_front,\n\t\t\tpostsPage: siteSettings?.page_for_posts,\n\t\t};\n\t}, [] );\n\n\tconst templates = useMemo( () => {\n\t\tif ( ! templateRecords ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst isHomePageBlog = frontPage === postsPage;\n\t\tconst homeTemplate =\n\t\t\ttemplateRecords?.find(\n\t\t\t\t( template ) => template.slug === 'front-page'\n\t\t\t) ||\n\t\t\ttemplateRecords?.find( ( template ) => template.slug === 'home' ) ||\n\t\t\ttemplateRecords?.find( ( template ) => template.slug === 'index' );\n\n\t\treturn [\n\t\t\tisHomePageBlog ? homeTemplate : null,\n\t\t\t...templateRecords?.filter( ( { slug } ) =>\n\t\t\t\t[ '404', 'search' ].includes( slug )\n\t\t\t),\n\t\t].filter( Boolean );\n\t}, [ templateRecords, frontPage, postsPage ] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Pages' ) }\n\t\t\tdescription={ __( 'Browse and manage pages.' ) }\n\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\tbackPath=\"/page\"\n\t\t\tfooter={\n\t\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t\t{ templates?.map( ( item ) => (\n\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\tpostType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\t\t\tpostId={ item.id }\n\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t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AC,aAAA,EAACT,iBAAA,CAAAU,OAAuB,MAAE,CAAG;IACvCH,QAAQ,EAAC,OAAO;IAChBiC,MAAM,EACL,IAAAhC,MAAA,CAAAC,aAAA,EAACtB,WAAA,CAAAsD,oBAAM;MAACC,OAAO,EAAG;IAAG,GAClBhB,SAAS,EAAEiB,GAAG,CAAIC,IAAI,IACvB,IAAApC,MAAA,CAAAC,aAAA,EAACR,QAAQ;MACRC,QAAQ,EAAGa,6BAAoB;MAC/BZ,MAAM,EAAGyC,IAAI,CAACC,EAAI;MAClBC,GAAG,EAAGF,IAAI,CAACC,EAAI;MACfE,IAAI,EAAGC,aAAQ;MACfC,WAAW;IAAA,GAEX,IAAAzC,MAAA,CAAAC,aAAA,EAACtB,WAAA,CAAA+D,sBAAQ;MAACC,aAAa,EAAG;IAAG,GAC1B,IAAAC,4BAAc,EACfR,IAAI,CAACR,KAAK,EAAEiB,QAAQ,IAAI,IAAAhB,QAAE,EAAE,YAAa,CAC1C,CACS,CACD,CACT,CACK;EACR,CACD,CAAC;AAEJ"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { __experimentalVStack as VStack, __experimentalText as Text, __experimentalSpacer as Spacer } from '@wordpress/components';
|
|
6
|
-
import { useState, useEffect } from '@wordpress/element';
|
|
7
|
-
function FontsGrid({
|
|
8
|
-
title,
|
|
9
|
-
children,
|
|
10
|
-
pageSize = 32
|
|
11
|
-
}) {
|
|
12
|
-
const [lastItem, setLastItem] = useState(null);
|
|
13
|
-
const [page, setPage] = useState(1);
|
|
14
|
-
const itemsLimit = page * pageSize;
|
|
15
|
-
const items = children.slice(0, itemsLimit);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
if (lastItem) {
|
|
18
|
-
const observer = new window.IntersectionObserver(([entry]) => {
|
|
19
|
-
if (entry.isIntersecting) {
|
|
20
|
-
setPage(prevPage => prevPage + 1);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
observer.observe(lastItem);
|
|
24
|
-
return () => observer.disconnect();
|
|
25
|
-
}
|
|
26
|
-
}, [lastItem]);
|
|
27
|
-
return createElement("div", {
|
|
28
|
-
className: "font-library-modal__fonts-grid"
|
|
29
|
-
}, createElement(VStack, {
|
|
30
|
-
spacing: 0
|
|
31
|
-
}, title && createElement(Fragment, null, createElement(Text, {
|
|
32
|
-
className: "font-library-modal__subtitle"
|
|
33
|
-
}, title), createElement(Spacer, {
|
|
34
|
-
margin: 2
|
|
35
|
-
})), createElement("div", {
|
|
36
|
-
className: "font-library-modal__fonts-grid__main"
|
|
37
|
-
}, items.map((child, i) => {
|
|
38
|
-
if (i === itemsLimit - 1) {
|
|
39
|
-
return createElement("div", {
|
|
40
|
-
key: child.key,
|
|
41
|
-
ref: setLastItem
|
|
42
|
-
}, child);
|
|
43
|
-
}
|
|
44
|
-
return createElement("div", {
|
|
45
|
-
key: child.key
|
|
46
|
-
}, child);
|
|
47
|
-
}))));
|
|
48
|
-
}
|
|
49
|
-
export default FontsGrid;
|
|
50
|
-
//# sourceMappingURL=fonts-grid.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalVStack","VStack","__experimentalText","Text","__experimentalSpacer","Spacer","useState","useEffect","FontsGrid","title","children","pageSize","lastItem","setLastItem","page","setPage","itemsLimit","items","slice","observer","window","IntersectionObserver","entry","isIntersecting","prevPage","observe","disconnect","createElement","className","spacing","Fragment","margin","map","child","i","key","ref"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/fonts-grid.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\n\nfunction FontsGrid( { title, children, pageSize = 32 } ) {\n\tconst [ lastItem, setLastItem ] = useState( null );\n\tconst [ page, setPage ] = useState( 1 );\n\tconst itemsLimit = page * pageSize;\n\tconst items = children.slice( 0, itemsLimit );\n\n\tuseEffect( () => {\n\t\tif ( lastItem ) {\n\t\t\tconst observer = new window.IntersectionObserver( ( [ entry ] ) => {\n\t\t\t\tif ( entry.isIntersecting ) {\n\t\t\t\t\tsetPage( ( prevPage ) => prevPage + 1 );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tobserver.observe( lastItem );\n\n\t\t\treturn () => observer.disconnect();\n\t\t}\n\t}, [ lastItem ] );\n\n\treturn (\n\t\t<div className=\"font-library-modal__fonts-grid\">\n\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t{ title && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Text className=\"font-library-modal__subtitle\">\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t<Spacer margin={ 2 } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<div className=\"font-library-modal__fonts-grid__main\">\n\t\t\t\t\t{ items.map( ( child, i ) => {\n\t\t\t\t\t\tif ( i === itemsLimit - 1 ) {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<div key={ child.key } ref={ setLastItem }>\n\t\t\t\t\t\t\t\t\t{ child }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn <div key={ child.key }>{ child }</div>;\n\t\t\t\t\t} ) }\n\t\t\t\t</div>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nexport default FontsGrid;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AAExD,SAASC,SAASA,CAAE;EAAEC,KAAK;EAAEC,QAAQ;EAA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,GAAG,EAAGvB;MAAa,GACvCoB,KACE,CAAC;IAER;IACA,OAAON,aAAA;MAAKQ,GAAG,EAAGF,KAAK,CAACE;IAAK,GAAGF,KAAY,CAAC;EAC9C,CAAE,CACE,CACE,CACJ,CAAC;AAER;AAEA,eAAezB,SAAS"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { __experimentalTruncate as Truncate, __experimentalVStack as VStack } from '@wordpress/components';
|
|
6
|
-
import { layout } from '@wordpress/icons';
|
|
7
|
-
import { useMemo } from '@wordpress/element';
|
|
8
|
-
import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
|
|
9
|
-
import { decodeEntities } from '@wordpress/html-entities';
|
|
10
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { useSelect } from '@wordpress/data';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
import { useLink } from '../routes/link';
|
|
17
|
-
import { TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
18
|
-
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
19
|
-
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
20
|
-
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
21
|
-
const PageItem = ({
|
|
22
|
-
postType = 'page',
|
|
23
|
-
postId,
|
|
24
|
-
...props
|
|
25
|
-
}) => {
|
|
26
|
-
const linkInfo = useLink({
|
|
27
|
-
postType,
|
|
28
|
-
postId
|
|
29
|
-
}, {
|
|
30
|
-
backPath: '/page'
|
|
31
|
-
});
|
|
32
|
-
return createElement(SidebarNavigationItem, {
|
|
33
|
-
...linkInfo,
|
|
34
|
-
...props
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
export default function SidebarNavigationScreenPagesDataViews() {
|
|
38
|
-
const {
|
|
39
|
-
records: templateRecords
|
|
40
|
-
} = useEntityRecords('postType', TEMPLATE_POST_TYPE, {
|
|
41
|
-
per_page: -1
|
|
42
|
-
});
|
|
43
|
-
const {
|
|
44
|
-
frontPage,
|
|
45
|
-
postsPage
|
|
46
|
-
} = useSelect(select => {
|
|
47
|
-
const {
|
|
48
|
-
getEntityRecord
|
|
49
|
-
} = select(coreStore);
|
|
50
|
-
const siteSettings = getEntityRecord('root', 'site');
|
|
51
|
-
return {
|
|
52
|
-
frontPage: siteSettings?.page_on_front,
|
|
53
|
-
postsPage: siteSettings?.page_for_posts
|
|
54
|
-
};
|
|
55
|
-
}, []);
|
|
56
|
-
const templates = useMemo(() => {
|
|
57
|
-
if (!templateRecords) {
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
|
-
const isHomePageBlog = frontPage === postsPage;
|
|
61
|
-
const homeTemplate = templateRecords?.find(template => template.slug === 'front-page') || templateRecords?.find(template => template.slug === 'home') || templateRecords?.find(template => template.slug === 'index');
|
|
62
|
-
return [isHomePageBlog ? homeTemplate : null, ...templateRecords?.filter(({
|
|
63
|
-
slug
|
|
64
|
-
}) => ['404', 'search'].includes(slug))].filter(Boolean);
|
|
65
|
-
}, [templateRecords, frontPage, postsPage]);
|
|
66
|
-
return createElement(SidebarNavigationScreen, {
|
|
67
|
-
title: __('Pages'),
|
|
68
|
-
description: __('Browse and manage pages.'),
|
|
69
|
-
content: createElement(DataViewsSidebarContent, null),
|
|
70
|
-
backPath: "/page",
|
|
71
|
-
footer: createElement(VStack, {
|
|
72
|
-
spacing: 0
|
|
73
|
-
}, templates?.map(item => createElement(PageItem, {
|
|
74
|
-
postType: TEMPLATE_POST_TYPE,
|
|
75
|
-
postId: item.id,
|
|
76
|
-
key: item.id,
|
|
77
|
-
icon: layout,
|
|
78
|
-
withChevron: true
|
|
79
|
-
}, createElement(Truncate, {
|
|
80
|
-
numberOfLines: 1
|
|
81
|
-
}, decodeEntities(item.title?.rendered || __('(no title)'))))))
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalTruncate","Truncate","__experimentalVStack","VStack","layout","useMemo","useEntityRecords","store","coreStore","decodeEntities","__","useSelect","useLink","TEMPLATE_POST_TYPE","SidebarNavigationItem","SidebarNavigationScreen","DataViewsSidebarContent","PageItem","postType","postId","props","linkInfo","backPath","createElement","SidebarNavigationScreenPagesDataViews","records","templateRecords","per_page","frontPage","postsPage","select","getEntityRecord","siteSettings","page_on_front","page_for_posts","templates","isHomePageBlog","homeTemplate","find","template","slug","filter","includes","Boolean","title","description","content","footer","spacing","map","item","id","key","icon","withChevron","numberOfLines","rendered"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pages-dataviews/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { layout } from '@wordpress/icons';\nimport { useMemo } from '@wordpress/element';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../routes/link';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\n\nconst PageItem = ( { postType = 'page', postId, ...props } ) => {\n\tconst linkInfo = useLink(\n\t\t{\n\t\t\tpostType,\n\t\t\tpostId,\n\t\t},\n\t\t{\n\t\t\tbackPath: '/page',\n\t\t}\n\t);\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenPagesDataViews() {\n\tconst { records: templateRecords } = useEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_POST_TYPE,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tconst { frontPage, postsPage } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\treturn {\n\t\t\tfrontPage: siteSettings?.page_on_front,\n\t\t\tpostsPage: siteSettings?.page_for_posts,\n\t\t};\n\t}, [] );\n\n\tconst templates = useMemo( () => {\n\t\tif ( ! templateRecords ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst isHomePageBlog = frontPage === postsPage;\n\t\tconst homeTemplate =\n\t\t\ttemplateRecords?.find(\n\t\t\t\t( template ) => template.slug === 'front-page'\n\t\t\t) ||\n\t\t\ttemplateRecords?.find( ( template ) => template.slug === 'home' ) ||\n\t\t\ttemplateRecords?.find( ( template ) => template.slug === 'index' );\n\n\t\treturn [\n\t\t\tisHomePageBlog ? homeTemplate : null,\n\t\t\t...templateRecords?.filter( ( { slug } ) =>\n\t\t\t\t[ '404', 'search' ].includes( slug )\n\t\t\t),\n\t\t].filter( Boolean );\n\t}, [ templateRecords, frontPage, postsPage ] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Pages' ) }\n\t\t\tdescription={ __( 'Browse and manage pages.' ) }\n\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\tbackPath=\"/page\"\n\t\t\tfooter={\n\t\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t\t{ templates?.map( ( item ) => (\n\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\tpostType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\t\t\tpostId={ item.id }\n\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\titem.title?.rendered || __( '(no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B,aAAA,CAACpB,MAAM;MAAC6C,OAAO,EAAG;IAAG,GAClBb,SAAS,EAAEc,GAAG,CAAIC,IAAI,IACvB3B,aAAA,CAACN,QAAQ;MACRC,QAAQ,EAAGL,kBAAoB;MAC/BM,MAAM,EAAG+B,IAAI,CAACC,EAAI;MAClBC,GAAG,EAAGF,IAAI,CAACC,EAAI;MACfE,IAAI,EAAGjD,MAAQ;MACfkD,WAAW;IAAA,GAEX/B,aAAA,CAACtB,QAAQ;MAACsD,aAAa,EAAG;IAAG,GAC1B9C,cAAc,CACfyC,IAAI,CAACN,KAAK,EAAEY,QAAQ,IAAI9C,EAAE,CAAE,YAAa,CAC1C,CACS,CACD,CACT,CACK;EACR,CACD,CAAC;AAEJ"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalVStack as VStack,
|
|
6
|
-
__experimentalText as Text,
|
|
7
|
-
__experimentalSpacer as Spacer,
|
|
8
|
-
} from '@wordpress/components';
|
|
9
|
-
import { useState, useEffect } from '@wordpress/element';
|
|
10
|
-
|
|
11
|
-
function FontsGrid( { title, children, pageSize = 32 } ) {
|
|
12
|
-
const [ lastItem, setLastItem ] = useState( null );
|
|
13
|
-
const [ page, setPage ] = useState( 1 );
|
|
14
|
-
const itemsLimit = page * pageSize;
|
|
15
|
-
const items = children.slice( 0, itemsLimit );
|
|
16
|
-
|
|
17
|
-
useEffect( () => {
|
|
18
|
-
if ( lastItem ) {
|
|
19
|
-
const observer = new window.IntersectionObserver( ( [ entry ] ) => {
|
|
20
|
-
if ( entry.isIntersecting ) {
|
|
21
|
-
setPage( ( prevPage ) => prevPage + 1 );
|
|
22
|
-
}
|
|
23
|
-
} );
|
|
24
|
-
|
|
25
|
-
observer.observe( lastItem );
|
|
26
|
-
|
|
27
|
-
return () => observer.disconnect();
|
|
28
|
-
}
|
|
29
|
-
}, [ lastItem ] );
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div className="font-library-modal__fonts-grid">
|
|
33
|
-
<VStack spacing={ 0 }>
|
|
34
|
-
{ title && (
|
|
35
|
-
<>
|
|
36
|
-
<Text className="font-library-modal__subtitle">
|
|
37
|
-
{ title }
|
|
38
|
-
</Text>
|
|
39
|
-
<Spacer margin={ 2 } />
|
|
40
|
-
</>
|
|
41
|
-
) }
|
|
42
|
-
<div className="font-library-modal__fonts-grid__main">
|
|
43
|
-
{ items.map( ( child, i ) => {
|
|
44
|
-
if ( i === itemsLimit - 1 ) {
|
|
45
|
-
return (
|
|
46
|
-
<div key={ child.key } ref={ setLastItem }>
|
|
47
|
-
{ child }
|
|
48
|
-
</div>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
return <div key={ child.key }>{ child }</div>;
|
|
52
|
-
} ) }
|
|
53
|
-
</div>
|
|
54
|
-
</VStack>
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export default FontsGrid;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalTruncate as Truncate,
|
|
6
|
-
__experimentalVStack as VStack,
|
|
7
|
-
} from '@wordpress/components';
|
|
8
|
-
import { layout } from '@wordpress/icons';
|
|
9
|
-
import { useMemo } from '@wordpress/element';
|
|
10
|
-
import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
|
|
11
|
-
import { decodeEntities } from '@wordpress/html-entities';
|
|
12
|
-
import { __ } from '@wordpress/i18n';
|
|
13
|
-
import { useSelect } from '@wordpress/data';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
import { useLink } from '../routes/link';
|
|
19
|
-
import { TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
20
|
-
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
21
|
-
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
22
|
-
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
23
|
-
|
|
24
|
-
const PageItem = ( { postType = 'page', postId, ...props } ) => {
|
|
25
|
-
const linkInfo = useLink(
|
|
26
|
-
{
|
|
27
|
-
postType,
|
|
28
|
-
postId,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
backPath: '/page',
|
|
32
|
-
}
|
|
33
|
-
);
|
|
34
|
-
return <SidebarNavigationItem { ...linkInfo } { ...props } />;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export default function SidebarNavigationScreenPagesDataViews() {
|
|
38
|
-
const { records: templateRecords } = useEntityRecords(
|
|
39
|
-
'postType',
|
|
40
|
-
TEMPLATE_POST_TYPE,
|
|
41
|
-
{
|
|
42
|
-
per_page: -1,
|
|
43
|
-
}
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const { frontPage, postsPage } = useSelect( ( select ) => {
|
|
47
|
-
const { getEntityRecord } = select( coreStore );
|
|
48
|
-
const siteSettings = getEntityRecord( 'root', 'site' );
|
|
49
|
-
return {
|
|
50
|
-
frontPage: siteSettings?.page_on_front,
|
|
51
|
-
postsPage: siteSettings?.page_for_posts,
|
|
52
|
-
};
|
|
53
|
-
}, [] );
|
|
54
|
-
|
|
55
|
-
const templates = useMemo( () => {
|
|
56
|
-
if ( ! templateRecords ) {
|
|
57
|
-
return [];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const isHomePageBlog = frontPage === postsPage;
|
|
61
|
-
const homeTemplate =
|
|
62
|
-
templateRecords?.find(
|
|
63
|
-
( template ) => template.slug === 'front-page'
|
|
64
|
-
) ||
|
|
65
|
-
templateRecords?.find( ( template ) => template.slug === 'home' ) ||
|
|
66
|
-
templateRecords?.find( ( template ) => template.slug === 'index' );
|
|
67
|
-
|
|
68
|
-
return [
|
|
69
|
-
isHomePageBlog ? homeTemplate : null,
|
|
70
|
-
...templateRecords?.filter( ( { slug } ) =>
|
|
71
|
-
[ '404', 'search' ].includes( slug )
|
|
72
|
-
),
|
|
73
|
-
].filter( Boolean );
|
|
74
|
-
}, [ templateRecords, frontPage, postsPage ] );
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<SidebarNavigationScreen
|
|
78
|
-
title={ __( 'Pages' ) }
|
|
79
|
-
description={ __( 'Browse and manage pages.' ) }
|
|
80
|
-
content={ <DataViewsSidebarContent /> }
|
|
81
|
-
backPath="/page"
|
|
82
|
-
footer={
|
|
83
|
-
<VStack spacing={ 0 }>
|
|
84
|
-
{ templates?.map( ( item ) => (
|
|
85
|
-
<PageItem
|
|
86
|
-
postType={ TEMPLATE_POST_TYPE }
|
|
87
|
-
postId={ item.id }
|
|
88
|
-
key={ item.id }
|
|
89
|
-
icon={ layout }
|
|
90
|
-
withChevron
|
|
91
|
-
>
|
|
92
|
-
<Truncate numberOfLines={ 1 }>
|
|
93
|
-
{ decodeEntities(
|
|
94
|
-
item.title?.rendered || __( '(no title)' )
|
|
95
|
-
) }
|
|
96
|
-
</Truncate>
|
|
97
|
-
</PageItem>
|
|
98
|
-
) ) }
|
|
99
|
-
</VStack>
|
|
100
|
-
}
|
|
101
|
-
/>
|
|
102
|
-
);
|
|
103
|
-
}
|