dumi-theme-lobehub 1.10.2 → 1.10.4
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/dist/layouts/DocLayout/DocumentLayout.js +2 -1
- package/dist/layouts/DocLayout/Head/Og.js +6 -5
- package/dist/layouts/DocLayout/Head/StructuredData.js +11 -12
- package/dist/pages/Changelog/index.js +3 -2
- package/dist/pages/Docs/index.js +12 -9
- package/dist/pages/Home/index.js +3 -2
- package/dist/slots/Header/LangSwitch.js +9 -8
- package/dist/slots/SearchResult/index.js +10 -5
- package/dist/slots/Toc/index.js +8 -3
- package/package.json +1 -1
|
@@ -84,8 +84,9 @@ var DocumentLayout = /*#__PURE__*/memo(function () {
|
|
|
84
84
|
setTimeout(function () {
|
|
85
85
|
var elm = document.querySelector("#".concat(decodeURIComponent(id)));
|
|
86
86
|
if (elm) {
|
|
87
|
+
var _window;
|
|
87
88
|
elm.scrollIntoView();
|
|
88
|
-
window.scrollBy({
|
|
89
|
+
(_window = window) === null || _window === void 0 || _window.scrollBy({
|
|
89
90
|
top: -80
|
|
90
91
|
});
|
|
91
92
|
}
|
|
@@ -13,13 +13,14 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
var Og = function Og() {
|
|
14
14
|
var _metadata$openGraph, _metadata$openGraph2, _metadata$openGraph3, _metadata$openGraph4, _metadata$openGraph5, _metadata$twitter, _metadata$twitter2, _metadata$twitter3, _metadata$openGraph6, _metadata$twitter4, _metadata$openGraph7, _metadata$twitter5, _metadata$openGraph8;
|
|
15
15
|
var _useSiteStore = useSiteStore(function (s) {
|
|
16
|
-
return [siteSelectors.siteTitle(s), siteSelectors.siteDesc(s), siteSelectors.logo(s), siteSelectors.hostname(s)];
|
|
16
|
+
return [siteSelectors.siteTitle(s), siteSelectors.siteDesc(s), siteSelectors.logo(s), siteSelectors.hostname(s) || 'https://lobehub.com', s.location.pathname];
|
|
17
17
|
}),
|
|
18
|
-
_useSiteStore2 = _slicedToArray(_useSiteStore,
|
|
18
|
+
_useSiteStore2 = _slicedToArray(_useSiteStore, 5),
|
|
19
19
|
title = _useSiteStore2[0],
|
|
20
20
|
desc = _useSiteStore2[1],
|
|
21
21
|
logo = _useSiteStore2[2],
|
|
22
|
-
hostname = _useSiteStore2[3]
|
|
22
|
+
hostname = _useSiteStore2[3],
|
|
23
|
+
pathname = _useSiteStore2[4];
|
|
23
24
|
var metadata = useSiteStore(siteSelectors.metadata, isEqual);
|
|
24
25
|
return /*#__PURE__*/_jsxs(Helmet, {
|
|
25
26
|
children: [/*#__PURE__*/_jsx("title", {
|
|
@@ -28,7 +29,7 @@ var Og = function Og() {
|
|
|
28
29
|
content: (metadata === null || metadata === void 0 ? void 0 : metadata.description) || desc,
|
|
29
30
|
name: "description"
|
|
30
31
|
}), /*#__PURE__*/_jsx("link", {
|
|
31
|
-
href: hostname
|
|
32
|
+
href: hostname,
|
|
32
33
|
rel: "canonical"
|
|
33
34
|
}), /*#__PURE__*/_jsx("meta", {
|
|
34
35
|
content: (metadata === null || metadata === void 0 || (_metadata$openGraph = metadata.openGraph) === null || _metadata$openGraph === void 0 ? void 0 : _metadata$openGraph.title) || title,
|
|
@@ -37,7 +38,7 @@ var Og = function Og() {
|
|
|
37
38
|
content: (metadata === null || metadata === void 0 || (_metadata$openGraph2 = metadata.openGraph) === null || _metadata$openGraph2 === void 0 ? void 0 : _metadata$openGraph2.description) || desc,
|
|
38
39
|
property: "og:description"
|
|
39
40
|
}), /*#__PURE__*/_jsx("meta", {
|
|
40
|
-
content: urlJoin(hostname
|
|
41
|
+
content: urlJoin(hostname, pathname),
|
|
41
42
|
property: "og:url"
|
|
42
43
|
}), /*#__PURE__*/_jsx("meta", {
|
|
43
44
|
content: metadata === null || metadata === void 0 || (_metadata$openGraph3 = metadata.openGraph) === null || _metadata$openGraph3 === void 0 ? void 0 : _metadata$openGraph3.siteName,
|
|
@@ -13,7 +13,7 @@ var date = new Date().toISOString();
|
|
|
13
13
|
var StructuredData = function StructuredData() {
|
|
14
14
|
var _metadata$twitter, _metadata$openGraph, _metadata$twitter2, _metadata$openGraph2, _metadata$twitter3, _metadata$openGraph3;
|
|
15
15
|
var _useSiteStore = useSiteStore(function (s) {
|
|
16
|
-
return [siteSelectors.siteTitle(s), siteSelectors.siteDesc(s), siteSelectors.logo(s), siteSelectors.hostname(s)];
|
|
16
|
+
return [siteSelectors.siteTitle(s), siteSelectors.siteDesc(s), siteSelectors.logo(s), siteSelectors.hostname(s) || 'https://lobehub.com'];
|
|
17
17
|
}),
|
|
18
18
|
_useSiteStore2 = _slicedToArray(_useSiteStore, 4),
|
|
19
19
|
title = _useSiteStore2[0],
|
|
@@ -21,48 +21,47 @@ var StructuredData = function StructuredData() {
|
|
|
21
21
|
logo = _useSiteStore2[2],
|
|
22
22
|
hostname = _useSiteStore2[3];
|
|
23
23
|
var metadata = useSiteStore(siteSelectors.metadata, isEqual);
|
|
24
|
-
var host = hostname || location.origin;
|
|
25
24
|
var ld = {
|
|
26
25
|
'@context': 'https://schema.org',
|
|
27
26
|
'@graph': [{
|
|
28
|
-
'@id': urlJoin(
|
|
27
|
+
'@id': urlJoin(hostname, '#website'),
|
|
29
28
|
'@type': 'WebSite',
|
|
30
29
|
'description': desc,
|
|
31
30
|
'inLanguage': 'en-US',
|
|
32
31
|
'name': 'LobeHub',
|
|
33
32
|
'publisher': {
|
|
34
|
-
'@id': urlJoin(
|
|
33
|
+
'@id': urlJoin(hostname, '#organization')
|
|
35
34
|
},
|
|
36
|
-
'url':
|
|
35
|
+
'url': hostname
|
|
37
36
|
}, {
|
|
38
|
-
'@id':
|
|
37
|
+
'@id': hostname,
|
|
39
38
|
'@type': 'WebPage',
|
|
40
39
|
'about': {
|
|
41
|
-
'@id': urlJoin(
|
|
40
|
+
'@id': urlJoin(hostname, '#organization')
|
|
42
41
|
},
|
|
43
42
|
'dateModified': date,
|
|
44
43
|
'datePublished': date,
|
|
45
44
|
'description': desc,
|
|
46
45
|
'image': {
|
|
47
|
-
'@id': urlJoin(
|
|
46
|
+
'@id': urlJoin(hostname, '#primaryimage')
|
|
48
47
|
},
|
|
49
48
|
'inLanguage': 'en-US',
|
|
50
49
|
'isPartOf': {
|
|
51
|
-
'@id': urlJoin(
|
|
50
|
+
'@id': urlJoin(hostname, '#website')
|
|
52
51
|
},
|
|
53
52
|
'name': title,
|
|
54
53
|
'primaryImageOfPage': {
|
|
55
|
-
'@id': urlJoin(
|
|
54
|
+
'@id': urlJoin(hostname, '#primaryimage')
|
|
56
55
|
},
|
|
57
56
|
'thumbnailUrl': (metadata === null || metadata === void 0 || (_metadata$twitter = metadata.twitter) === null || _metadata$twitter === void 0 ? void 0 : _metadata$twitter.image) || (metadata === null || metadata === void 0 || (_metadata$openGraph = metadata.openGraph) === null || _metadata$openGraph === void 0 ? void 0 : _metadata$openGraph.image)
|
|
58
57
|
}, {
|
|
59
|
-
'@id': urlJoin(
|
|
58
|
+
'@id': urlJoin(hostname, '#primaryimage'),
|
|
60
59
|
'@type': 'ImageObject',
|
|
61
60
|
'contentUrl': (metadata === null || metadata === void 0 || (_metadata$twitter2 = metadata.twitter) === null || _metadata$twitter2 === void 0 ? void 0 : _metadata$twitter2.image) || (metadata === null || metadata === void 0 || (_metadata$openGraph2 = metadata.openGraph) === null || _metadata$openGraph2 === void 0 ? void 0 : _metadata$openGraph2.image) || logo,
|
|
62
61
|
'inLanguage': 'en-US',
|
|
63
62
|
'url': (metadata === null || metadata === void 0 || (_metadata$twitter3 = metadata.twitter) === null || _metadata$twitter3 === void 0 ? void 0 : _metadata$twitter3.image) || (metadata === null || metadata === void 0 || (_metadata$openGraph3 = metadata.openGraph) === null || _metadata$openGraph3 === void 0 ? void 0 : _metadata$openGraph3.image) || logo
|
|
64
63
|
}, {
|
|
65
|
-
'@id': urlJoin(
|
|
64
|
+
'@id': urlJoin(hostname, '#organization'),
|
|
66
65
|
'@type': 'Organization',
|
|
67
66
|
'alternateName': 'LobeHub',
|
|
68
67
|
'contactPoint': {
|
|
@@ -23,8 +23,9 @@ var Changelog = /*#__PURE__*/memo(function () {
|
|
|
23
23
|
var _useStyles = useStyles(),
|
|
24
24
|
styles = _useStyles.styles;
|
|
25
25
|
useEffect(function () {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
var _window, _document;
|
|
27
|
+
(_window = window) === null || _window === void 0 || _window.scrollTo(0, 0);
|
|
28
|
+
(_document = document) === null || _document === void 0 || _document.body.scrollTo(0, 0);
|
|
28
29
|
}, []);
|
|
29
30
|
return /*#__PURE__*/_jsxs(Center, {
|
|
30
31
|
className: styles.content,
|
package/dist/pages/Docs/index.js
CHANGED
|
@@ -13,20 +13,23 @@ var Documents = /*#__PURE__*/memo(function () {
|
|
|
13
13
|
var outlet = useOutlet();
|
|
14
14
|
var _useResponsive = useResponsive(),
|
|
15
15
|
mobile = _useResponsive.mobile;
|
|
16
|
-
var _useSiteStore = useSiteStore(function (
|
|
16
|
+
var _useSiteStore = useSiteStore(function (s) {
|
|
17
17
|
return {
|
|
18
|
-
giscus: siteSelectors.giscus(
|
|
19
|
-
isApiPage: apiHeaderSelectors.isApiPage(
|
|
18
|
+
giscus: siteSelectors.giscus(s),
|
|
19
|
+
isApiPage: apiHeaderSelectors.isApiPage(s),
|
|
20
|
+
pathname: s.location.pathname
|
|
20
21
|
};
|
|
21
22
|
}),
|
|
22
23
|
isApiPage = _useSiteStore.isApiPage,
|
|
23
|
-
giscus = _useSiteStore.giscus
|
|
24
|
+
giscus = _useSiteStore.giscus,
|
|
25
|
+
pathname = _useSiteStore.pathname;
|
|
24
26
|
var _useStyles = useStyles(),
|
|
25
27
|
styles = _useStyles.styles;
|
|
26
28
|
useEffect(function () {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
var _window, _document;
|
|
30
|
+
(_window = window) === null || _window === void 0 || _window.scrollTo(0, 0);
|
|
31
|
+
(_document = document) === null || _document === void 0 || _document.body.scrollTo(0, 0);
|
|
32
|
+
}, [pathname]);
|
|
30
33
|
var Comment = useCallback(function () {
|
|
31
34
|
return giscus && /*#__PURE__*/_jsx("div", {
|
|
32
35
|
style: {
|
|
@@ -35,13 +38,13 @@ var Documents = /*#__PURE__*/memo(function () {
|
|
|
35
38
|
children: /*#__PURE__*/_jsx(Giscus, {
|
|
36
39
|
category: giscus.category,
|
|
37
40
|
categoryId: giscus.categoryId,
|
|
38
|
-
id: "
|
|
41
|
+
id: "giscus",
|
|
39
42
|
mapping: "title",
|
|
40
43
|
repo: giscus.repo,
|
|
41
44
|
repoId: giscus.repoId
|
|
42
45
|
})
|
|
43
46
|
});
|
|
44
|
-
}, [giscus,
|
|
47
|
+
}, [giscus, pathname]);
|
|
45
48
|
return /*#__PURE__*/_jsxs(Center, {
|
|
46
49
|
className: styles.content,
|
|
47
50
|
style: {
|
package/dist/pages/Home/index.js
CHANGED
|
@@ -8,8 +8,9 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
var Home = /*#__PURE__*/memo(function () {
|
|
9
9
|
var outlet = useOutlet();
|
|
10
10
|
useEffect(function () {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
var _window, _document;
|
|
12
|
+
(_window = window) === null || _window === void 0 || _window.scrollTo(0, 0);
|
|
13
|
+
(_document = document) === null || _document === void 0 || _document.body.scrollTo(0, 0);
|
|
13
14
|
}, []);
|
|
14
15
|
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
15
16
|
align: 'center',
|
|
@@ -77,12 +77,13 @@ var SingleSwitch = /*#__PURE__*/memo(function (_ref2) {
|
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
79
|
var LangSwitch = /*#__PURE__*/memo(function () {
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
var _useSiteStore = useSiteStore(function (s) {
|
|
81
|
+
return [s.siteData.locales, s.locale, s.location.pathname];
|
|
82
|
+
}),
|
|
83
|
+
_useSiteStore2 = _slicedToArray(_useSiteStore, 3),
|
|
84
|
+
locales = _useSiteStore2[0],
|
|
85
|
+
current = _useSiteStore2[1],
|
|
86
|
+
pathname = _useSiteStore2[2];
|
|
86
87
|
|
|
87
88
|
// do not render in single language
|
|
88
89
|
if (locales.length <= 1) return;
|
|
@@ -90,12 +91,12 @@ var LangSwitch = /*#__PURE__*/memo(function () {
|
|
|
90
91
|
onChange: function onChange(index) {
|
|
91
92
|
console.log(getTargetLocalePath({
|
|
92
93
|
current: current,
|
|
93
|
-
pathname:
|
|
94
|
+
pathname: pathname,
|
|
94
95
|
target: locales[index]
|
|
95
96
|
}));
|
|
96
97
|
history.push(getTargetLocalePath({
|
|
97
98
|
current: current,
|
|
98
|
-
pathname:
|
|
99
|
+
pathname: pathname,
|
|
99
100
|
target: locales[index]
|
|
100
101
|
}));
|
|
101
102
|
},
|
|
@@ -9,10 +9,11 @@ import { Icon } from '@lobehub/ui';
|
|
|
9
9
|
import animateScrollTo from 'animated-scroll-to';
|
|
10
10
|
import { Empty, Typography } from 'antd';
|
|
11
11
|
import { useTheme } from 'antd-style';
|
|
12
|
-
import { FormattedMessage, Link, history
|
|
12
|
+
import { FormattedMessage, Link, history } from 'dumi';
|
|
13
13
|
import { FileBox, FileIcon, HeadingIcon, LetterText } from 'lucide-react';
|
|
14
14
|
import React, { Fragment, memo, useCallback, useEffect, useState } from 'react';
|
|
15
15
|
import { Center, Flexbox } from 'react-layout-kit';
|
|
16
|
+
import { siteSelectors, useSiteStore } from "../../store";
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -93,12 +94,16 @@ var SearchResult = /*#__PURE__*/memo(function (props) {
|
|
|
93
94
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
94
95
|
activeIndex = _useState4[0],
|
|
95
96
|
setActiveIndex = _useState4[1];
|
|
96
|
-
var
|
|
97
|
-
|
|
97
|
+
var _useSiteStore = useSiteStore(function (s) {
|
|
98
|
+
return [s.location.pathname, siteSelectors.hostname(s)];
|
|
99
|
+
}),
|
|
100
|
+
_useSiteStore2 = _slicedToArray(_useSiteStore, 2),
|
|
101
|
+
pathname = _useSiteStore2[0],
|
|
102
|
+
hostname = _useSiteStore2[1];
|
|
98
103
|
var onItemSelect = function onItemSelect(item) {
|
|
99
|
-
var _props$onItemSelect;
|
|
104
|
+
var _props$onItemSelect, _location;
|
|
100
105
|
(_props$onItemSelect = props.onItemSelect) === null || _props$onItemSelect === void 0 || _props$onItemSelect.call(props, item);
|
|
101
|
-
var url = new URL(item === null || item === void 0 ? void 0 : item.link, location.origin);
|
|
106
|
+
var url = new URL(item === null || item === void 0 ? void 0 : item.link, hostname || ((_location = location) === null || _location === void 0 ? void 0 : _location.origin));
|
|
102
107
|
if ((url === null || url === void 0 ? void 0 : url.pathname) === pathname && !url.hash) {
|
|
103
108
|
setTimeout(function () {
|
|
104
109
|
animateScrollTo(0, {
|
package/dist/slots/Toc/index.js
CHANGED
|
@@ -18,14 +18,18 @@ var Toc = /*#__PURE__*/memo(function () {
|
|
|
18
18
|
var _useResponsive = useResponsive(),
|
|
19
19
|
mobile = _useResponsive.mobile;
|
|
20
20
|
var theme = useTheme();
|
|
21
|
+
var hash = useSiteStore(function (s) {
|
|
22
|
+
return s.location.hash;
|
|
23
|
+
}, isEqual);
|
|
21
24
|
var _useState = useState(GAP),
|
|
22
25
|
_useState2 = _slicedToArray(_useState, 2),
|
|
23
26
|
spacing = _useState2[0],
|
|
24
27
|
setSpacing = _useState2[1];
|
|
25
28
|
useEffect(function () {
|
|
26
|
-
var
|
|
29
|
+
var _document;
|
|
30
|
+
var ApiTitle = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector('#api-header');
|
|
27
31
|
if (ApiTitle) setSpacing(ApiTitle.clientHeight + GAP);
|
|
28
|
-
}, [
|
|
32
|
+
}, [hash, items]);
|
|
29
33
|
if ((items === null || items === void 0 ? void 0 : items.length) < 1) return;
|
|
30
34
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
31
35
|
children: [!mobile && /*#__PURE__*/_jsx("div", {
|
|
@@ -34,7 +38,8 @@ var Toc = /*#__PURE__*/memo(function () {
|
|
|
34
38
|
}
|
|
35
39
|
}), /*#__PURE__*/_jsx(T, {
|
|
36
40
|
getContainer: function getContainer() {
|
|
37
|
-
|
|
41
|
+
var _document2;
|
|
42
|
+
return (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.body;
|
|
38
43
|
},
|
|
39
44
|
headerHeight: theme.headerHeight,
|
|
40
45
|
isMobile: mobile,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dumi-theme-lobehub",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.4",
|
|
4
4
|
"description": "dumi-theme-lobehub is a documentation site theme package designed for dumi2. It provides a more beautiful and user-friendly development and reading experience based on @lobehub/ui",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|