dumi-theme-lobehub 1.6.0 → 1.7.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/README.md +55 -76
- package/dist/components/ApiHeader/index.d.ts +2 -16
- package/dist/components/ApiHeader/index.js +3 -1
- package/dist/layouts/DocLayout/DocumentLayout.d.ts +3 -0
- package/dist/layouts/DocLayout/DocumentLayout.js +111 -0
- package/dist/layouts/DocLayout/index.d.ts +2 -2
- package/dist/layouts/DocLayout/index.js +10 -110
- package/dist/pages/Changelog/index.js +5 -1
- package/dist/pages/Docs/index.js +17 -8
- package/dist/pages/Home/index.js +5 -1
- package/dist/slots/Content/index.js +19 -6
- package/dist/slots/Content/style.d.ts +2 -2
- package/dist/slots/Content/style.js +5 -4
- package/dist/slots/Features/index.js +2 -2
- package/dist/slots/Footer/columns.js +22 -7
- package/dist/slots/Footer/index.js +7 -4
- package/dist/slots/Header/ThemeSwitch.js +6 -1
- package/dist/slots/Logo/index.js +11 -12
- package/dist/store/index.d.ts +3 -3
- package/dist/store/initialState.d.ts +33 -0
- package/dist/store/initialState.js +35 -0
- package/dist/store/selectors/apiHeader.js +4 -1
- package/dist/store/selectors/siteBasicInfo.d.ts +1 -0
- package/dist/store/selectors/siteBasicInfo.js +3 -0
- package/dist/store/useSiteStore.d.ts +2 -32
- package/dist/store/useSiteStore.js +5 -44
- package/dist/types/config.d.ts +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,18 +10,17 @@
|
|
|
10
10
|
|
|
11
11
|
dumi-theme-lobehub is a documentation site theme package designed for `Dumi 2`. <br/>It provides a more beautiful and user-friendly development and reading experience based on `@lobehub/ui`
|
|
12
12
|
|
|
13
|
-
[
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
[![
|
|
18
|
-
[![
|
|
19
|
-
[![
|
|
20
|
-
[![
|
|
21
|
-
[![
|
|
22
|
-
|
|
23
|
-
[
|
|
24
|
-
[![issues][issues-shield]][issues-url]
|
|
13
|
+
[![][npm-release-shield]][npm-release-link]
|
|
14
|
+
[![][github-releasedate-shield]][github-releasedate-link]
|
|
15
|
+
[![][github-action-test-shield]][github-action-test-link]
|
|
16
|
+
[![][github-action-release-shield]][github-action-release-link]<br/>
|
|
17
|
+
[![][github-contributors-shield]][github-contributors-link]
|
|
18
|
+
[![][github-forks-shield]][github-forks-link]
|
|
19
|
+
[![][github-stars-shield]][github-stars-link]
|
|
20
|
+
[![][github-issues-shield]][github-issues-link]
|
|
21
|
+
[![][github-license-shield]][github-license-link]
|
|
22
|
+
|
|
23
|
+
[Changelog](./CHANGELOG.md) · [Report Bug][github-issues-link] · [Request Feature][github-issues-link]
|
|
25
24
|
|
|
26
25
|

|
|
27
26
|
|
|
@@ -59,10 +58,12 @@ dumi-theme-lobehub is a documentation site theme package designed for `Dumi 2`.
|
|
|
59
58
|
|
|
60
59
|
## 📦 Installation
|
|
61
60
|
|
|
62
|
-
|
|
61
|
+
To install `dumi-theme-lobehub`, run the following command:
|
|
62
|
+
|
|
63
|
+
[![][bun-shield]][bun-link]
|
|
63
64
|
|
|
64
65
|
```bash
|
|
65
|
-
|
|
66
|
+
$ bun add dumi dumi-theme-lobehub
|
|
66
67
|
```
|
|
67
68
|
|
|
68
69
|
<div align="right">
|
|
@@ -102,7 +103,8 @@ interface SiteThemeConfig {
|
|
|
102
103
|
}
|
|
103
104
|
```
|
|
104
105
|
|
|
105
|
-
>
|
|
106
|
+
> **Note**\
|
|
107
|
+
> For detailed configuration, please refer to the [Type file](https://github.com/lobehub/dumi-theme-lobehub/blob/master/src/types/config.ts) | [Example](https://github.com/lobehub/dumi-theme-lobehub/blob/master/example/.dumirc.ts).
|
|
106
108
|
|
|
107
109
|
<div align="right">
|
|
108
110
|
|
|
@@ -112,17 +114,19 @@ interface SiteThemeConfig {
|
|
|
112
114
|
|
|
113
115
|
## ⌨️ Local Development
|
|
114
116
|
|
|
115
|
-
You can use
|
|
117
|
+
You can use Github Codespaces for online development:
|
|
116
118
|
|
|
117
|
-
[![
|
|
119
|
+
[![][github-codespace-shield]][github-codespace-link]
|
|
118
120
|
|
|
119
121
|
Or clone it for local development:
|
|
120
122
|
|
|
123
|
+
[![][bun-shield]][bun-link]
|
|
124
|
+
|
|
121
125
|
```bash
|
|
122
126
|
$ git clone https://github.com/lobehub/dumi-theme-lobehub.git
|
|
123
127
|
$ cd dumi-theme-lobehub
|
|
124
|
-
$
|
|
125
|
-
$
|
|
128
|
+
$ bun install
|
|
129
|
+
$ bun dev
|
|
126
130
|
```
|
|
127
131
|
|
|
128
132
|
<div align="right">
|
|
@@ -133,18 +137,11 @@ $ pnpm start
|
|
|
133
137
|
|
|
134
138
|
## 🤝 Contributing
|
|
135
139
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
> 📊 Total: <kbd>**2**</kbd>
|
|
140
|
+
Contributions of all types are more than welcome, if you are interested in contributing code, feel free to check out our GitHub [Issues][github-issues-link] to get stuck in to show us what you’re made of.
|
|
139
141
|
|
|
140
|
-
|
|
141
|
-
<img src="https://avatars.githubusercontent.com/u/17870709?v=4" width="50" />
|
|
142
|
-
</a>
|
|
143
|
-
<a href="https://github.com/actions-user" title="actions-user">
|
|
144
|
-
<img src="https://avatars.githubusercontent.com/u/65916846?v=4" width="50" />
|
|
145
|
-
</a>
|
|
142
|
+
[![][pr-welcome-shield]][pr-welcome-link]
|
|
146
143
|
|
|
147
|
-
|
|
144
|
+
[![][github-contrib-shield]][github-contrib-link]
|
|
148
145
|
|
|
149
146
|
<div align="right">
|
|
150
147
|
|
|
@@ -156,54 +153,36 @@ $ pnpm start
|
|
|
156
153
|
|
|
157
154
|
#### 📝 License
|
|
158
155
|
|
|
159
|
-
Copyright © 2023 [LobeHub][profile-
|
|
156
|
+
Copyright © 2023 [LobeHub][profile-link]. <br />
|
|
160
157
|
This project is [MIT](./LICENSE) licensed.
|
|
161
158
|
|
|
162
159
|
<!-- LINK GROUP -->
|
|
163
160
|
|
|
164
|
-
[
|
|
165
|
-
[
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
[
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
[
|
|
174
|
-
[
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
[
|
|
179
|
-
[
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
[
|
|
184
|
-
[
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
[
|
|
189
|
-
[
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
[contributors-shield]: https://img.shields.io/github/contributors/lobehub/dumi-theme-lobehub.svg?style=flat
|
|
194
|
-
[contributors-url]: https://github.com/lobehub/dumi-theme-lobehub/graphs/contributors
|
|
195
|
-
|
|
196
|
-
<!-- forks -->
|
|
197
|
-
|
|
198
|
-
[forks-shield]: https://img.shields.io/github/forks/lobehub/dumi-theme-lobehub.svg?style=flat
|
|
199
|
-
[forks-url]: https://github.com/lobehub/dumi-theme-lobehub/network/members
|
|
200
|
-
|
|
201
|
-
<!-- stargazers -->
|
|
202
|
-
|
|
203
|
-
[stargazers-shield]: https://img.shields.io/github/stars/lobehub/dumi-theme-lobehub.svg?style=flat
|
|
204
|
-
[stargazers-url]: https://github.com/lobehub/dumi-theme-lobehub/stargazers
|
|
205
|
-
|
|
206
|
-
<!-- issues -->
|
|
207
|
-
|
|
208
|
-
[issues-shield]: https://img.shields.io/github/issues/lobehub/dumi-theme-lobehub.svg?style=flat
|
|
209
|
-
[issues-url]: https://github.com/lobehub/dumi-theme-lobehub/issues/new/choose
|
|
161
|
+
[back-to-top]: https://img.shields.io/badge/-BACK_TO_TOP-black?style=flat-square
|
|
162
|
+
[bun-link]: https://bun.sh
|
|
163
|
+
[bun-shield]: https://img.shields.io/badge/-speedup%20with%20bun-black?logo=bun&style=for-the-badge
|
|
164
|
+
[github-action-release-link]: https://github.com/lobehub/dumi-theme-lobehub/actions/workflows/release.yml
|
|
165
|
+
[github-action-release-shield]: https://img.shields.io/github/actions/workflow/status/lobehub/dumi-theme-lobehub/release.yml?label=release&labelColor=black&logo=githubactions&logoColor=white&style=flat-square
|
|
166
|
+
[github-action-test-link]: https://github.com/lobehub/dumi-theme-lobehub/actions/workflows/test.yml
|
|
167
|
+
[github-action-test-shield]: https://img.shields.io/github/actions/workflow/status/lobehub/dumi-theme-lobehub/test.yml?label=test&labelColor=black&logo=githubactions&logoColor=white&style=flat-square
|
|
168
|
+
[github-codespace-link]: https://codespaces.new/lobehub/dumi-theme-lobehub
|
|
169
|
+
[github-codespace-shield]: https://github.com/codespaces/badge.svg
|
|
170
|
+
[github-contrib-link]: https://github.com/lobehub/dumi-theme-lobehub/graphs/contributors
|
|
171
|
+
[github-contrib-shield]: https://contrib.rocks/image?repo=lobehub%2Fdumi-theme-lobehub
|
|
172
|
+
[github-contributors-link]: https://github.com/lobehub/dumi-theme-lobehub/graphs/contributors
|
|
173
|
+
[github-contributors-shield]: https://img.shields.io/github/contributors/lobehub/dumi-theme-lobehub?color=c4f042&labelColor=black&style=flat-square
|
|
174
|
+
[github-forks-link]: https://github.com/lobehub/dumi-theme-lobehub/network/members
|
|
175
|
+
[github-forks-shield]: https://img.shields.io/github/forks/lobehub/dumi-theme-lobehub?color=8ae8ff&labelColor=black&style=flat-square
|
|
176
|
+
[github-issues-link]: https://github.com/lobehub/dumi-theme-lobehub/issues
|
|
177
|
+
[github-issues-shield]: https://img.shields.io/github/issues/lobehub/dumi-theme-lobehub?color=ff80eb&labelColor=black&style=flat-square
|
|
178
|
+
[github-license-link]: https://github.com/lobehub/dumi-theme-lobehub/blob/main/LICENSE
|
|
179
|
+
[github-license-shield]: https://img.shields.io/github/license/lobehub/dumi-theme-lobehub?color=white&labelColor=black&style=flat-square
|
|
180
|
+
[github-releasedate-link]: https://github.com/lobehub/dumi-theme-lobehub/releases
|
|
181
|
+
[github-releasedate-shield]: https://img.shields.io/github/release-date/lobehub/dumi-theme-lobehub?labelColor=black&style=flat-square
|
|
182
|
+
[github-stars-link]: https://github.com/lobehub/dumi-theme-lobehub/network/stargazers
|
|
183
|
+
[github-stars-shield]: https://img.shields.io/github/stars/lobehub/dumi-theme-lobehub?color=ffcb47&labelColor=black&style=flat-square
|
|
184
|
+
[npm-release-link]: https://www.npmjs.com/package/@lobehub/chat
|
|
185
|
+
[npm-release-shield]: https://img.shields.io/npm/v/@lobehub/chat?color=369eff&labelColor=black&logo=npm&logoColor=white&style=flat-square
|
|
186
|
+
[pr-welcome-link]: https://github.com/lobehub/dumi-theme-lobehub/pulls
|
|
187
|
+
[pr-welcome-shield]: https://img.shields.io/badge/%F0%9F%A4%AF%20PR%20WELCOME-%E2%86%92-ffcb47?labelColor=black&style=for-the-badge
|
|
188
|
+
[profile-link]: https://github.com/lobehub
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
import { ApiHeaderConfig } from "../../types";
|
|
2
3
|
/**
|
|
3
4
|
* @title ApiHeaderProps
|
|
4
5
|
* @category Props
|
|
5
6
|
* @description ApiHeader 组件的 props 类型定义
|
|
6
7
|
*/
|
|
7
|
-
export interface ApiHeaderProps {
|
|
8
|
+
export interface ApiHeaderProps extends ApiHeaderConfig {
|
|
8
9
|
/**
|
|
9
10
|
* @title 组件名
|
|
10
11
|
* @description ApiHeader 组件的名称
|
|
@@ -21,21 +22,6 @@ export interface ApiHeaderProps {
|
|
|
21
22
|
* @description ApiHeader 组件的描述信息
|
|
22
23
|
*/
|
|
23
24
|
description?: string;
|
|
24
|
-
/**
|
|
25
|
-
* @title 文档链接
|
|
26
|
-
* @description ApiHeader 组件文档的链接
|
|
27
|
-
*/
|
|
28
|
-
docUrl?: string;
|
|
29
|
-
/**
|
|
30
|
-
* @title 包名
|
|
31
|
-
* @description ApiHeader 组件所在的包名
|
|
32
|
-
*/
|
|
33
|
-
pkg?: string;
|
|
34
|
-
/**
|
|
35
|
-
* @title 源代码链接
|
|
36
|
-
* @description ApiHeader 组件源代码的链接
|
|
37
|
-
*/
|
|
38
|
-
sourceUrl?: string;
|
|
39
25
|
/**
|
|
40
26
|
* @title 标题
|
|
41
27
|
* @description ApiHeader 组件的标题
|
|
@@ -19,6 +19,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
19
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
export var ApiHeader = /*#__PURE__*/memo(function (_ref) {
|
|
21
21
|
var title = _ref.title,
|
|
22
|
+
type = _ref.type,
|
|
22
23
|
componentName = _ref.componentName,
|
|
23
24
|
description = _ref.description,
|
|
24
25
|
defaultImport = _ref.defaultImport,
|
|
@@ -31,6 +32,7 @@ export var ApiHeader = /*#__PURE__*/memo(function (_ref) {
|
|
|
31
32
|
styles = _useStyles.styles;
|
|
32
33
|
var _useResponsive = useResponsive(),
|
|
33
34
|
mobile = _useResponsive.mobile;
|
|
35
|
+
var isDoc = type === 'doc';
|
|
34
36
|
var items = [sourceUrl && {
|
|
35
37
|
children: 'Source',
|
|
36
38
|
icon: /*#__PURE__*/_jsx(Icon, {
|
|
@@ -56,7 +58,7 @@ export var ApiHeader = /*#__PURE__*/memo(function (_ref) {
|
|
|
56
58
|
type: 'secondary',
|
|
57
59
|
children: description
|
|
58
60
|
})
|
|
59
|
-
}), /*#__PURE__*/_jsxs(Flexbox, {
|
|
61
|
+
}), !isDoc && /*#__PURE__*/_jsxs(Flexbox, {
|
|
60
62
|
gap: mobile ? 16 : 24,
|
|
61
63
|
style: {
|
|
62
64
|
marginTop: 16
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Layout } from '@lobehub/ui';
|
|
2
|
+
import { useResponsive, useTheme } from 'antd-style';
|
|
3
|
+
import { Helmet, useIntl, useLocation } from 'dumi';
|
|
4
|
+
import isEqual from 'fast-deep-equal';
|
|
5
|
+
import { memo, useCallback, useEffect } from 'react';
|
|
6
|
+
import { shallow } from 'zustand/shallow';
|
|
7
|
+
import Changelog from "../../pages/Changelog";
|
|
8
|
+
import Docs from "../../pages/Docs";
|
|
9
|
+
import Home from "../../pages/Home";
|
|
10
|
+
import Footer from "dumi/theme/slots/Footer";
|
|
11
|
+
import Header from "dumi/theme/slots/Header";
|
|
12
|
+
import Sidebar from "dumi/theme/slots/Sidebar";
|
|
13
|
+
import Toc from "dumi/theme/slots/Toc";
|
|
14
|
+
import { isHeroPageSel, siteTitleSel, tocAnchorItemSel, useSiteStore } from "../../store";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
|
+
var DocumentLayout = /*#__PURE__*/memo(function () {
|
|
19
|
+
var intl = useIntl();
|
|
20
|
+
var _useLocation = useLocation(),
|
|
21
|
+
hash = _useLocation.hash;
|
|
22
|
+
var theme = useTheme();
|
|
23
|
+
var _useResponsive = useResponsive(),
|
|
24
|
+
mobile = _useResponsive.mobile,
|
|
25
|
+
laptop = _useResponsive.laptop;
|
|
26
|
+
var _useSiteStore = useSiteStore(function (s) {
|
|
27
|
+
var isChanlogPage = s.location.pathname === '/changelog';
|
|
28
|
+
var isHomePage = isHeroPageSel(s);
|
|
29
|
+
var page;
|
|
30
|
+
if (isHomePage) {
|
|
31
|
+
page = 'home';
|
|
32
|
+
} else if (isChanlogPage) {
|
|
33
|
+
page = 'changelog';
|
|
34
|
+
} else {
|
|
35
|
+
page = 'docs';
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
loading: s.siteData.loading,
|
|
39
|
+
noToc: tocAnchorItemSel(s).length === 0,
|
|
40
|
+
page: page,
|
|
41
|
+
siteTitle: siteTitleSel(s)
|
|
42
|
+
};
|
|
43
|
+
}, shallow),
|
|
44
|
+
loading = _useSiteStore.loading,
|
|
45
|
+
page = _useSiteStore.page,
|
|
46
|
+
siteTitle = _useSiteStore.siteTitle,
|
|
47
|
+
noToc = _useSiteStore.noToc;
|
|
48
|
+
var fm = useSiteStore(function (s) {
|
|
49
|
+
return s.routeMeta.frontmatter;
|
|
50
|
+
}, isEqual);
|
|
51
|
+
var hideSidebar = page !== 'docs' || mobile || fm.sidebar === false;
|
|
52
|
+
var shouldHideToc = fm.toc === false || noToc;
|
|
53
|
+
var hideToc = mobile ? shouldHideToc : !laptop || shouldHideToc;
|
|
54
|
+
var HelmetBlock = useCallback(function () {
|
|
55
|
+
return /*#__PURE__*/_jsxs(Helmet, {
|
|
56
|
+
children: [/*#__PURE__*/_jsx("html", {
|
|
57
|
+
lang: intl.locale.replace(/-.+$/, '')
|
|
58
|
+
}), fm.title && /*#__PURE__*/_jsx("meta", {
|
|
59
|
+
content: fm.title,
|
|
60
|
+
property: "og:title"
|
|
61
|
+
}), fm.description && /*#__PURE__*/_jsx("meta", {
|
|
62
|
+
content: fm.description,
|
|
63
|
+
name: "description"
|
|
64
|
+
}), fm.description && /*#__PURE__*/_jsx("meta", {
|
|
65
|
+
content: fm.description,
|
|
66
|
+
property: "og:description"
|
|
67
|
+
}), fm.keywords && /*#__PURE__*/_jsx("meta", {
|
|
68
|
+
content: fm.keywords.join(','),
|
|
69
|
+
name: "keywords"
|
|
70
|
+
}), fm.keywords && /*#__PURE__*/_jsx("meta", {
|
|
71
|
+
content: fm.keywords.join(','),
|
|
72
|
+
property: "og:keywords"
|
|
73
|
+
}), !fm.title || page === 'home' ? /*#__PURE__*/_jsx("title", {
|
|
74
|
+
children: siteTitle
|
|
75
|
+
}) : /*#__PURE__*/_jsxs("title", {
|
|
76
|
+
children: [fm.title, " - ", siteTitle]
|
|
77
|
+
})]
|
|
78
|
+
});
|
|
79
|
+
}, [intl, fm, siteTitle, page]);
|
|
80
|
+
|
|
81
|
+
// handle hash change or visit page hash after async chunk loaded
|
|
82
|
+
useEffect(function () {
|
|
83
|
+
var id = hash.replace('#', '');
|
|
84
|
+
if (!id) return;
|
|
85
|
+
setTimeout(function () {
|
|
86
|
+
var elm = document.querySelector("#".concat(decodeURIComponent(id)));
|
|
87
|
+
if (elm) {
|
|
88
|
+
elm.scrollIntoView();
|
|
89
|
+
window.scrollBy({
|
|
90
|
+
top: -80
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}, 1);
|
|
94
|
+
}, [loading, hash]);
|
|
95
|
+
useEffect(function () {
|
|
96
|
+
document.body.scrollTo(0, 0);
|
|
97
|
+
}, [siteTitle]);
|
|
98
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
99
|
+
children: [/*#__PURE__*/_jsx(HelmetBlock, {}), /*#__PURE__*/_jsxs(Layout, {
|
|
100
|
+
asideWidth: theme.sidebarWidth,
|
|
101
|
+
footer: /*#__PURE__*/_jsx(Footer, {}),
|
|
102
|
+
header: /*#__PURE__*/_jsx(Header, {}),
|
|
103
|
+
headerHeight: mobile && page !== 'home' ? theme.headerHeight + 36 : theme.headerHeight,
|
|
104
|
+
sidebar: hideSidebar ? undefined : /*#__PURE__*/_jsx(Sidebar, {}),
|
|
105
|
+
toc: hideToc ? undefined : /*#__PURE__*/_jsx(Toc, {}),
|
|
106
|
+
tocWidth: hideToc ? 0 : theme.tocWidth,
|
|
107
|
+
children: [page === 'home' && /*#__PURE__*/_jsx(Home, {}), page === 'changelog' && /*#__PURE__*/_jsx(Changelog, {}), page === 'docs' && /*#__PURE__*/_jsx(Docs, {})]
|
|
108
|
+
})]
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
export default DocumentLayout;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const App: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
export default App;
|
|
@@ -1,121 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { extractStaticStyle
|
|
3
|
-
import {
|
|
4
|
-
import isEqual from 'fast-deep-equal';
|
|
5
|
-
import { memo, useCallback, useEffect } from 'react';
|
|
1
|
+
import { ThemeProvider } from '@lobehub/ui';
|
|
2
|
+
import { extractStaticStyle } from 'antd-style';
|
|
3
|
+
import { memo } from 'react';
|
|
6
4
|
import { shallow } from 'zustand/shallow';
|
|
7
5
|
import Favicons from "../../components/Favicons";
|
|
8
6
|
import { StoreUpdater } from "../../components/StoreUpdater";
|
|
9
7
|
import GlobalStyle from "./GlobalStyle";
|
|
10
|
-
import
|
|
11
|
-
import Docs from "../../pages/Docs";
|
|
12
|
-
import Home from "../../pages/Home";
|
|
13
|
-
import Footer from "dumi/theme/slots/Footer";
|
|
14
|
-
import Header from "dumi/theme/slots/Header";
|
|
15
|
-
import Sidebar from "dumi/theme/slots/Sidebar";
|
|
16
|
-
import Toc from "dumi/theme/slots/Toc";
|
|
17
|
-
import { isHeroPageSel, siteTitleSel, tocAnchorItemSel, useSiteStore, useThemeStore } from "../../store";
|
|
8
|
+
import { useThemeStore } from "../../store";
|
|
18
9
|
import customToken from "../../styles/customToken";
|
|
10
|
+
import DocumentLayout from "./DocumentLayout";
|
|
11
|
+
|
|
12
|
+
// @ts-ignore
|
|
19
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
15
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
|
-
var DocumentLayout = /*#__PURE__*/memo(function () {
|
|
23
|
-
var intl = useIntl();
|
|
24
|
-
var _useLocation = useLocation(),
|
|
25
|
-
hash = _useLocation.hash;
|
|
26
|
-
var theme = useTheme();
|
|
27
|
-
var _useResponsive = useResponsive(),
|
|
28
|
-
mobile = _useResponsive.mobile,
|
|
29
|
-
laptop = _useResponsive.laptop;
|
|
30
|
-
var _useSiteStore = useSiteStore(function (s) {
|
|
31
|
-
var isChanlogPage = s.location.pathname === '/changelog';
|
|
32
|
-
var isHomePage = isHeroPageSel(s);
|
|
33
|
-
var page;
|
|
34
|
-
if (isHomePage) {
|
|
35
|
-
page = 'home';
|
|
36
|
-
} else if (isChanlogPage) {
|
|
37
|
-
page = 'changelog';
|
|
38
|
-
} else {
|
|
39
|
-
page = 'docs';
|
|
40
|
-
}
|
|
41
|
-
return {
|
|
42
|
-
loading: s.siteData.loading,
|
|
43
|
-
noToc: tocAnchorItemSel(s).length === 0,
|
|
44
|
-
page: page,
|
|
45
|
-
siteTitle: siteTitleSel(s)
|
|
46
|
-
};
|
|
47
|
-
}, shallow),
|
|
48
|
-
loading = _useSiteStore.loading,
|
|
49
|
-
page = _useSiteStore.page,
|
|
50
|
-
siteTitle = _useSiteStore.siteTitle,
|
|
51
|
-
noToc = _useSiteStore.noToc;
|
|
52
|
-
var fm = useSiteStore(function (s) {
|
|
53
|
-
return s.routeMeta.frontmatter;
|
|
54
|
-
}, isEqual);
|
|
55
|
-
var hideSidebar = page !== 'docs' || mobile || fm.sidebar === false;
|
|
56
|
-
var shouldHideToc = fm.toc === false || noToc;
|
|
57
|
-
var hideToc = mobile ? shouldHideToc : !laptop || shouldHideToc;
|
|
58
|
-
var HelmetBlock = useCallback(function () {
|
|
59
|
-
return /*#__PURE__*/_jsxs(Helmet, {
|
|
60
|
-
children: [/*#__PURE__*/_jsx("html", {
|
|
61
|
-
lang: intl.locale.replace(/-.+$/, '')
|
|
62
|
-
}), fm.title && /*#__PURE__*/_jsx("meta", {
|
|
63
|
-
content: fm.title,
|
|
64
|
-
property: "og:title"
|
|
65
|
-
}), fm.description && /*#__PURE__*/_jsx("meta", {
|
|
66
|
-
content: fm.description,
|
|
67
|
-
name: "description"
|
|
68
|
-
}), fm.description && /*#__PURE__*/_jsx("meta", {
|
|
69
|
-
content: fm.description,
|
|
70
|
-
property: "og:description"
|
|
71
|
-
}), fm.keywords && /*#__PURE__*/_jsx("meta", {
|
|
72
|
-
content: fm.keywords.join(','),
|
|
73
|
-
name: "keywords"
|
|
74
|
-
}), fm.keywords && /*#__PURE__*/_jsx("meta", {
|
|
75
|
-
content: fm.keywords.join(','),
|
|
76
|
-
property: "og:keywords"
|
|
77
|
-
}), !fm.title || page === 'home' ? /*#__PURE__*/_jsx("title", {
|
|
78
|
-
children: siteTitle
|
|
79
|
-
}) : /*#__PURE__*/_jsxs("title", {
|
|
80
|
-
children: [fm.title, " - ", siteTitle]
|
|
81
|
-
})]
|
|
82
|
-
});
|
|
83
|
-
}, [intl, fm, siteTitle, page]);
|
|
84
|
-
|
|
85
|
-
// handle hash change or visit page hash after async chunk loaded
|
|
86
|
-
useEffect(function () {
|
|
87
|
-
var id = hash.replace('#', '');
|
|
88
|
-
if (!id) return;
|
|
89
|
-
setTimeout(function () {
|
|
90
|
-
var elm = document.querySelector("#".concat(decodeURIComponent(id)));
|
|
91
|
-
if (elm) {
|
|
92
|
-
elm.scrollIntoView();
|
|
93
|
-
window.scrollBy({
|
|
94
|
-
top: -80
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}, 1);
|
|
98
|
-
}, [loading, hash]);
|
|
99
|
-
useEffect(function () {
|
|
100
|
-
document.body.scrollTo(0, 0);
|
|
101
|
-
}, [siteTitle]);
|
|
102
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
103
|
-
children: [/*#__PURE__*/_jsx(HelmetBlock, {}), /*#__PURE__*/_jsxs(Layout, {
|
|
104
|
-
asideWidth: theme.sidebarWidth,
|
|
105
|
-
footer: /*#__PURE__*/_jsx(Footer, {}),
|
|
106
|
-
header: /*#__PURE__*/_jsx(Header, {}),
|
|
107
|
-
headerHeight: mobile && page !== 'home' ? theme.headerHeight + 36 : theme.headerHeight,
|
|
108
|
-
sidebar: hideSidebar ? undefined : /*#__PURE__*/_jsx(Sidebar, {}),
|
|
109
|
-
toc: hideToc ? undefined : /*#__PURE__*/_jsx(Toc, {}),
|
|
110
|
-
tocWidth: hideToc ? 0 : theme.tocWidth,
|
|
111
|
-
children: [page === 'home' && /*#__PURE__*/_jsx(Home, {}), page === 'changelog' && /*#__PURE__*/_jsx(Changelog, {}), page === 'docs' && /*#__PURE__*/_jsx(Docs, {})]
|
|
112
|
-
})]
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// @ts-ignore
|
|
117
16
|
global.__ANTD_CACHE__ = extractStaticStyle.cache;
|
|
118
|
-
|
|
17
|
+
var App = /*#__PURE__*/memo(function () {
|
|
119
18
|
var themeMode = useThemeStore(function (st) {
|
|
120
19
|
return st.themeMode;
|
|
121
20
|
}, shallow);
|
|
@@ -127,4 +26,5 @@ export default /*#__PURE__*/memo(function () {
|
|
|
127
26
|
children: [/*#__PURE__*/_jsx(GlobalStyle, {}), /*#__PURE__*/_jsx(DocumentLayout, {})]
|
|
128
27
|
})]
|
|
129
28
|
});
|
|
130
|
-
});
|
|
29
|
+
});
|
|
30
|
+
export default App;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useResponsive } from 'antd-style';
|
|
2
2
|
import { useOutlet } from 'dumi';
|
|
3
3
|
import isEqual from 'fast-deep-equal';
|
|
4
|
-
import { memo } from 'react';
|
|
4
|
+
import { memo, useEffect } from 'react';
|
|
5
5
|
import { Center } from 'react-layout-kit';
|
|
6
6
|
import { shallow } from 'zustand/shallow';
|
|
7
7
|
import { ApiHeader } from "../../components/ApiHeader";
|
|
@@ -29,6 +29,10 @@ var Changelog = /*#__PURE__*/memo(function () {
|
|
|
29
29
|
fm = _useSiteStore2.fm;
|
|
30
30
|
var _useStyles = useStyles(),
|
|
31
31
|
styles = _useStyles.styles;
|
|
32
|
+
useEffect(function () {
|
|
33
|
+
window.scrollTo(0, 0);
|
|
34
|
+
document.body.scrollTo(0, 0);
|
|
35
|
+
}, []);
|
|
32
36
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
33
37
|
children: [/*#__PURE__*/_jsx("div", {
|
|
34
38
|
className: styles.background
|
package/dist/pages/Docs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Giscus } from '@lobehub/ui';
|
|
2
2
|
import { useResponsive } from 'antd-style';
|
|
3
3
|
import { useOutlet } from 'dumi';
|
|
4
|
-
import { memo, useCallback } from 'react';
|
|
4
|
+
import { memo, useCallback, useEffect } from 'react';
|
|
5
5
|
import { Center } from 'react-layout-kit';
|
|
6
6
|
import { shallow } from 'zustand/shallow';
|
|
7
7
|
import ApiHeader from "dumi/theme/slots/ApiHeader";
|
|
@@ -25,14 +25,23 @@ var Documents = /*#__PURE__*/memo(function () {
|
|
|
25
25
|
giscus = _useSiteStore.giscus;
|
|
26
26
|
var _useStyles = useStyles(),
|
|
27
27
|
styles = _useStyles.styles;
|
|
28
|
+
useEffect(function () {
|
|
29
|
+
window.scrollTo(0, 0);
|
|
30
|
+
document.body.scrollTo(0, 0);
|
|
31
|
+
}, [location.pathname]);
|
|
28
32
|
var Comment = useCallback(function () {
|
|
29
|
-
return giscus && /*#__PURE__*/_jsx(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
return giscus && /*#__PURE__*/_jsx("div", {
|
|
34
|
+
style: {
|
|
35
|
+
marginTop: 64
|
|
36
|
+
},
|
|
37
|
+
children: /*#__PURE__*/_jsx(Giscus, {
|
|
38
|
+
category: giscus.category,
|
|
39
|
+
categoryId: giscus.categoryId,
|
|
40
|
+
id: "lobehub",
|
|
41
|
+
mapping: "title",
|
|
42
|
+
repo: giscus.repo,
|
|
43
|
+
repoId: giscus.repoId
|
|
44
|
+
})
|
|
36
45
|
});
|
|
37
46
|
}, [giscus, location.pathname]);
|
|
38
47
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
package/dist/pages/Home/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useOutlet } from 'dumi';
|
|
2
|
-
import { memo } from 'react';
|
|
2
|
+
import { memo, useEffect } from 'react';
|
|
3
3
|
import { Flexbox } from 'react-layout-kit';
|
|
4
4
|
import Features from "dumi/theme/slots/Features";
|
|
5
5
|
import Hero from "dumi/theme/slots/Hero";
|
|
@@ -7,6 +7,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
7
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
var Home = /*#__PURE__*/memo(function () {
|
|
9
9
|
var outlet = useOutlet();
|
|
10
|
+
useEffect(function () {
|
|
11
|
+
window.scrollTo(0, 0);
|
|
12
|
+
document.body.scrollTo(0, 0);
|
|
13
|
+
}, []);
|
|
10
14
|
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
11
15
|
align: 'center',
|
|
12
16
|
gap: 64,
|
|
@@ -7,12 +7,13 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
7
7
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
8
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
9
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
-
import { Skeleton
|
|
10
|
+
import { Skeleton } from 'antd';
|
|
11
11
|
import { useResponsive } from 'antd-style';
|
|
12
|
-
import
|
|
12
|
+
import isEqual from 'fast-deep-equal';
|
|
13
|
+
import { memo, useEffect } from 'react';
|
|
13
14
|
import { Flexbox } from 'react-layout-kit';
|
|
14
15
|
import ContentFooter from "dumi/theme/slots/ContentFooter";
|
|
15
|
-
import { useSiteStore } from "../../store";
|
|
16
|
+
import { themeConfig, useSiteStore } from "../../store";
|
|
16
17
|
import { useStyles } from "./style";
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -22,21 +23,33 @@ var Content = /*#__PURE__*/memo(function (_ref) {
|
|
|
22
23
|
var loading = useSiteStore(function (s) {
|
|
23
24
|
return s.siteData.loading;
|
|
24
25
|
});
|
|
25
|
-
var
|
|
26
|
+
var _useSiteStore = useSiteStore(themeConfig, isEqual),
|
|
27
|
+
docStyle = _useSiteStore.docStyle;
|
|
28
|
+
var _useStyles = useStyles(docStyle === 'pure'),
|
|
26
29
|
styles = _useStyles.styles,
|
|
27
30
|
cx = _useStyles.cx;
|
|
28
31
|
var _useResponsive = useResponsive(),
|
|
29
32
|
mobile = _useResponsive.mobile;
|
|
33
|
+
useEffect(function () {
|
|
34
|
+
document.body.scrollTo(0, 0);
|
|
35
|
+
}, [loading]);
|
|
30
36
|
return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
|
|
31
37
|
gap: mobile ? 0 : 24,
|
|
32
38
|
width: '100%'
|
|
33
39
|
}, props), {}, {
|
|
34
|
-
children: [/*#__PURE__*/_jsx(
|
|
40
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
41
|
+
style: {
|
|
42
|
+
height: 0
|
|
43
|
+
}
|
|
44
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
35
45
|
className: cx('dumi-antd-style-content', styles.content),
|
|
36
46
|
children: [/*#__PURE__*/_jsx(Skeleton, {
|
|
37
47
|
active: true,
|
|
38
48
|
loading: loading,
|
|
39
|
-
paragraph: true
|
|
49
|
+
paragraph: true,
|
|
50
|
+
style: {
|
|
51
|
+
minHeight: '50vh'
|
|
52
|
+
}
|
|
40
53
|
}), /*#__PURE__*/_jsx("div", {
|
|
41
54
|
style: {
|
|
42
55
|
display: loading ? 'none' : undefined
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const useStyles: (props?:
|
|
2
|
-
content:
|
|
1
|
+
export declare const useStyles: (props?: boolean | undefined) => import("antd-style").ReturnStyles<{
|
|
2
|
+
content: string;
|
|
3
3
|
}>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
var _templateObject;
|
|
1
|
+
var _templateObject, _templateObject2;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
|
-
export var useStyles = createStyles(function (_ref) {
|
|
5
|
-
var
|
|
4
|
+
export var useStyles = createStyles(function (_ref, isPure) {
|
|
5
|
+
var cx = _ref.cx,
|
|
6
|
+
token = _ref.token,
|
|
6
7
|
responsive = _ref.responsive,
|
|
7
8
|
css = _ref.css,
|
|
8
9
|
stylish = _ref.stylish;
|
|
9
10
|
return {
|
|
10
|
-
content: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
|
11
|
+
content: cx(!isPure && css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 24px 48px;\n background-color: ", ";\n border-radius: 10px;\n\n ", " {\n padding: 8px 16px;\n border-radius: 0;\n }\n "])), token.colorBgContainer, responsive.mobile), css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex: 1;\n box-sizing: border-box;\n width: 100%;\n min-height: 400px;\n\n &:has([data-page-tabs='true']) {\n padding-top: 8px;\n }\n\n .markdown {\n ", ";\n h2,\n h3 {\n &[id^='version'] {\n color: ", ";\n }\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n transition: all 400ms ", ";\n\n > a[aria-hidden]:first-child {\n float: left;\n\n width: 20px;\n margin-inline-start: -24px;\n padding-inline-end: 4px;\n\n font-size: inherit;\n line-height: inherit;\n color: ", ";\n text-align: right;\n\n &:hover {\n border: 0;\n }\n\n > .icon-link::before {\n content: '#';\n font-size: inherit;\n color: ", ";\n }\n }\n\n &:hover {\n color: ", ";\n }\n\n &:not(:hover) > a[aria-hidden]:first-child > .icon-link {\n visibility: hidden;\n }\n }\n\n ol,\n ul {\n padding-inline-start: 18px;\n }\n }\n "])), stylish.markdown, token.colorText, token.motionEaseOut, token.colorText, token.colorTextTertiary, token.colorText))
|
|
11
12
|
};
|
|
12
13
|
});
|
|
@@ -9,10 +9,10 @@ var Features = /*#__PURE__*/memo(function () {
|
|
|
9
9
|
var theme = useTheme();
|
|
10
10
|
if (!(features !== null && features !== void 0 && features.length)) return;
|
|
11
11
|
return /*#__PURE__*/_jsx(F, {
|
|
12
|
-
contentMaxWidth: theme.contentMaxWidth,
|
|
13
12
|
items: features,
|
|
14
13
|
style: {
|
|
15
|
-
margin: '0 16px'
|
|
14
|
+
margin: '0 16px',
|
|
15
|
+
maxWidth: theme.contentMaxWidth
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
});
|
|
@@ -11,14 +11,14 @@ export var getColumns = function getColumns(_ref) {
|
|
|
11
11
|
title: 'Lobe UI',
|
|
12
12
|
url: 'https://github.com/lobehub/lobe-ui'
|
|
13
13
|
}, {
|
|
14
|
-
description: '
|
|
14
|
+
description: 'Awesome lint configs',
|
|
15
15
|
openExternal: true,
|
|
16
|
-
title: 'Lobe
|
|
16
|
+
title: 'Lobe Lint',
|
|
17
17
|
url: 'https://github.com/lobehub/lobe-chat'
|
|
18
18
|
}, {
|
|
19
|
-
description: '
|
|
19
|
+
description: 'Lobe Dumi Theme',
|
|
20
20
|
openExternal: true,
|
|
21
|
-
title: '
|
|
21
|
+
title: 'Dsigned for Dumi 2',
|
|
22
22
|
url: 'https://github.com/lobehub/lobe-flow'
|
|
23
23
|
}],
|
|
24
24
|
title: 'Resources'
|
|
@@ -65,15 +65,30 @@ export var getColumns = function getColumns(_ref) {
|
|
|
65
65
|
};
|
|
66
66
|
var more = {
|
|
67
67
|
items: [{
|
|
68
|
+
description: 'OpenAI Chat Bot',
|
|
69
|
+
openExternal: true,
|
|
70
|
+
title: '🤖 Lobe Chat',
|
|
71
|
+
url: 'https://github.com/lobehub/lobe-chat'
|
|
72
|
+
}, {
|
|
73
|
+
description: 'Stable Diffusion Extension',
|
|
74
|
+
openExternal: true,
|
|
75
|
+
title: '🤯 Lobe Theme',
|
|
76
|
+
url: 'https://github.com/lobehub/sd-webui-lobe-theme'
|
|
77
|
+
}, {
|
|
78
|
+
description: 'Gen intelligently',
|
|
79
|
+
openExternal: true,
|
|
80
|
+
title: '📝 Readme Generator',
|
|
81
|
+
url: 'https://ui.lobehub.com'
|
|
82
|
+
}, {
|
|
68
83
|
description: 'AI Commit CLI',
|
|
69
84
|
openExternal: true,
|
|
70
85
|
title: '💌 Lobe Commit',
|
|
71
86
|
url: 'https://github.com/lobehub/lobe-commit'
|
|
72
87
|
}, {
|
|
73
|
-
description: '
|
|
88
|
+
description: 'AI i18n CLI',
|
|
74
89
|
openExternal: true,
|
|
75
|
-
title: '
|
|
76
|
-
url: 'https://github.com/lobehub/lobe-
|
|
90
|
+
title: '🌐 Lobe i18n',
|
|
91
|
+
url: 'https://github.com/lobehub/lobe-commit'
|
|
77
92
|
}],
|
|
78
93
|
title: 'More Products'
|
|
79
94
|
};
|
|
@@ -16,18 +16,21 @@ var Footer = /*#__PURE__*/memo(function () {
|
|
|
16
16
|
}, isEqual),
|
|
17
17
|
themeConfig = _useSiteStore.themeConfig,
|
|
18
18
|
pkg = _useSiteStore.pkg;
|
|
19
|
+
var footerConfig = themeConfig.footerConfig,
|
|
20
|
+
footer = themeConfig.footer;
|
|
19
21
|
var githubUrl = useSiteStore(githubSel, shallow);
|
|
20
22
|
var _useStyles = useStyles(),
|
|
21
23
|
styles = _useStyles.styles,
|
|
22
24
|
theme = _useStyles.theme;
|
|
23
25
|
var _useResponsive = useResponsive(),
|
|
24
26
|
mobile = _useResponsive.mobile;
|
|
25
|
-
if (!
|
|
26
|
-
var
|
|
27
|
-
var columns = footer !== null && footer !== void 0 && footer.columns ? undefined : getColumns({
|
|
27
|
+
if (!footer) return;
|
|
28
|
+
var columns = footerConfig !== null && footerConfig !== void 0 && footerConfig.columns ? footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.columns : getColumns({
|
|
28
29
|
github: githubUrl || pkg.homepage
|
|
29
30
|
});
|
|
30
|
-
|
|
31
|
+
if (footerConfig !== null && footerConfig !== void 0 && footerConfig.resources) columns[0] = footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.resources;
|
|
32
|
+
if (footerConfig !== null && footerConfig !== void 0 && footerConfig.resources) columns[0] = footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.resources;
|
|
33
|
+
var bottomFooter = (footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.bottom) || footer;
|
|
31
34
|
return /*#__PURE__*/_jsx(Foot, {
|
|
32
35
|
bottom: mobile ? /*#__PURE__*/_jsxs(Center, {
|
|
33
36
|
className: styles.container,
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { ThemeSwitch as ThemeSwitchButton } from '@lobehub/ui';
|
|
2
|
-
import {
|
|
2
|
+
import { usePrefersColor } from 'dumi';
|
|
3
|
+
import { memo, useEffect } from 'react';
|
|
3
4
|
import { useThemeStore } from "../../store/useThemeStore";
|
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
var ThemeSwitch = /*#__PURE__*/memo(function () {
|
|
6
7
|
var themeMode = useThemeStore(function (s) {
|
|
7
8
|
return s.themeMode;
|
|
8
9
|
});
|
|
10
|
+
var setColorMode = usePrefersColor()[2];
|
|
11
|
+
useEffect(function () {
|
|
12
|
+
return setColorMode(themeMode);
|
|
13
|
+
}, [themeMode]);
|
|
9
14
|
return /*#__PURE__*/_jsx(ThemeSwitchButton, {
|
|
10
15
|
onThemeSwitch: function onThemeSwitch(themeMode) {
|
|
11
16
|
useThemeStore.setState({
|
package/dist/slots/Logo/index.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { Logo as SiteLogo } from '@lobehub/ui';
|
|
1
|
+
import { Avatar, Logo as SiteLogo } from '@lobehub/ui';
|
|
2
2
|
import { useResponsive } from 'antd-style';
|
|
3
3
|
import { Link } from 'dumi';
|
|
4
4
|
import isEqual from 'fast-deep-equal';
|
|
5
5
|
import { memo } from 'react';
|
|
6
|
+
import { themeConfig } from "../../store/selectors/siteBasicInfo";
|
|
6
7
|
import { useSiteStore } from "../../store/useSiteStore";
|
|
7
8
|
import { useStyles } from "./style";
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
10
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
10
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
12
|
var Logo = /*#__PURE__*/memo(function () {
|
|
12
|
-
var
|
|
13
|
-
return s.siteData.themeConfig;
|
|
14
|
-
}, isEqual);
|
|
13
|
+
var config = useSiteStore(themeConfig, isEqual);
|
|
15
14
|
var locale = useSiteStore(function (s) {
|
|
16
15
|
return s.locale;
|
|
17
16
|
}, isEqual);
|
|
@@ -20,18 +19,18 @@ var Logo = /*#__PURE__*/memo(function () {
|
|
|
20
19
|
cx = _useStyles.cx;
|
|
21
20
|
var _useResponsive = useResponsive(),
|
|
22
21
|
mobile = _useResponsive.mobile;
|
|
23
|
-
return
|
|
22
|
+
return config && /*#__PURE__*/_jsx(Link, {
|
|
24
23
|
className: cx(styles),
|
|
25
24
|
to: 'base' in locale ? locale.base : '/',
|
|
26
|
-
children:
|
|
27
|
-
children: [/*#__PURE__*/_jsx(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}),
|
|
25
|
+
children: config.logo ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
26
|
+
children: [/*#__PURE__*/_jsx(Avatar, {
|
|
27
|
+
avatar: config.logo,
|
|
28
|
+
size: mobile ? 32 : 36
|
|
29
|
+
}), config.name]
|
|
31
30
|
}) : /*#__PURE__*/_jsx(SiteLogo, {
|
|
32
|
-
extra:
|
|
31
|
+
extra: config.name,
|
|
33
32
|
size: mobile ? 32 : 36,
|
|
34
|
-
type:
|
|
33
|
+
type: config.logoType || 'combine'
|
|
35
34
|
})
|
|
36
35
|
});
|
|
37
36
|
});
|
package/dist/store/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export * from './selectors';
|
|
|
2
2
|
export * from './useSiteStore';
|
|
3
3
|
export * from './useThemeStore';
|
|
4
4
|
export declare const siteSelectors: {
|
|
5
|
-
apiHeader: (s: import("./
|
|
6
|
-
flattenSidebar: (s: import("./
|
|
7
|
-
token: (s: import("./
|
|
5
|
+
apiHeader: (s: import("./initialState").SiteStore) => import("../components/ApiHeader").ApiHeaderProps;
|
|
6
|
+
flattenSidebar: (s: import("./initialState").SiteStore) => import("dumi/dist/client/theme-api/types").ISidebarItem[];
|
|
7
|
+
token: (s: import("./initialState").SiteStore) => any;
|
|
8
8
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AtomAsset } from 'dumi-assets-types';
|
|
2
|
+
import { ILocale, ILocalesConfig, INavItem, IPreviewerProps, IRouteMeta, ISidebarGroup } from 'dumi/dist/client/theme-api/types';
|
|
3
|
+
import { PICKED_PKG_FIELDS } from 'dumi/dist/constants';
|
|
4
|
+
import type { Location } from 'history';
|
|
5
|
+
import { ComponentType } from 'react';
|
|
6
|
+
import { SiteThemeConfig } from "../types";
|
|
7
|
+
export type NavData = (INavItem & {
|
|
8
|
+
children?: INavItem[] | undefined;
|
|
9
|
+
})[];
|
|
10
|
+
export interface ISiteData {
|
|
11
|
+
components: Record<string, AtomAsset>;
|
|
12
|
+
demos: Record<string, {
|
|
13
|
+
asset: IPreviewerProps['asset'];
|
|
14
|
+
component: ComponentType;
|
|
15
|
+
routeId: string;
|
|
16
|
+
}>;
|
|
17
|
+
entryExports: Record<string, any>;
|
|
18
|
+
loading: boolean;
|
|
19
|
+
locales: ILocalesConfig;
|
|
20
|
+
pkg: Partial<Record<keyof typeof PICKED_PKG_FIELDS, any>>;
|
|
21
|
+
setLoading: (status: boolean) => void;
|
|
22
|
+
themeConfig: SiteThemeConfig;
|
|
23
|
+
}
|
|
24
|
+
export interface SiteStore {
|
|
25
|
+
locale: ILocale;
|
|
26
|
+
location: Location;
|
|
27
|
+
navData: NavData;
|
|
28
|
+
routeMeta: IRouteMeta;
|
|
29
|
+
sidebar?: ISidebarGroup[];
|
|
30
|
+
siteData: ISiteData;
|
|
31
|
+
tabMeta?: NonNullable<IRouteMeta['tabs']>[0]['meta'];
|
|
32
|
+
}
|
|
33
|
+
export declare const initialState: SiteStore;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export var initialState = {
|
|
2
|
+
locale: {
|
|
3
|
+
id: 'zh-CN',
|
|
4
|
+
name: '中文',
|
|
5
|
+
suffix: ''
|
|
6
|
+
},
|
|
7
|
+
location: {
|
|
8
|
+
hash: '',
|
|
9
|
+
key: '',
|
|
10
|
+
pathname: '',
|
|
11
|
+
search: '',
|
|
12
|
+
state: ''
|
|
13
|
+
},
|
|
14
|
+
navData: [],
|
|
15
|
+
routeMeta: {
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
frontmatter: {},
|
|
18
|
+
tabs: undefined,
|
|
19
|
+
texts: [],
|
|
20
|
+
toc: []
|
|
21
|
+
},
|
|
22
|
+
sidebar: [],
|
|
23
|
+
siteData: {
|
|
24
|
+
components: {},
|
|
25
|
+
demos: {},
|
|
26
|
+
entryExports: {},
|
|
27
|
+
loading: true,
|
|
28
|
+
locales: [],
|
|
29
|
+
pkg: {},
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
setLoading: undefined,
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
themeConfig: {}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
@@ -29,6 +29,8 @@ export var apiHeaderSel = function apiHeaderSel(s) {
|
|
|
29
29
|
return rawString.replace('{github}', REPO_BASE).replace('{atomId}', fm.atomId || '').replace('{title}', fm.title).replace('{locale}', localeId);
|
|
30
30
|
};
|
|
31
31
|
var _ref = s.siteData.themeConfig.apiHeader || {},
|
|
32
|
+
_ref$type = _ref.type,
|
|
33
|
+
type = _ref$type === void 0 ? 'component' : _ref$type,
|
|
32
34
|
_ref$pkg = _ref.pkg,
|
|
33
35
|
package_ = _ref$pkg === void 0 ? s.siteData.pkg.name : _ref$pkg,
|
|
34
36
|
sourceUrlMatch = _ref.sourceUrl,
|
|
@@ -45,6 +47,7 @@ export var apiHeaderSel = function apiHeaderSel(s) {
|
|
|
45
47
|
docUrl: documentUrl,
|
|
46
48
|
pkg: displayPackage,
|
|
47
49
|
sourceUrl: sourceUrl,
|
|
48
|
-
title: fm.title
|
|
50
|
+
title: fm.title,
|
|
51
|
+
type: type
|
|
49
52
|
};
|
|
50
53
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SiteStore } from '../useSiteStore';
|
|
2
|
+
export declare const themeConfig: (s: SiteStore) => import("../..").SiteThemeConfig;
|
|
2
3
|
export declare const siteTitleSel: (s: SiteStore) => string | undefined;
|
|
3
4
|
export declare const githubSel: (s: SiteStore) => string;
|
|
4
5
|
export declare const discordSel: (s: SiteStore) => "" | `https://discord.gg/${string}`;
|
|
@@ -1,37 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ILocale, ILocalesConfig, INavItem, IPreviewerProps, IRouteMeta, ISidebarGroup } from 'dumi/dist/client/theme-api/types';
|
|
3
|
-
import { PICKED_PKG_FIELDS } from 'dumi/dist/constants';
|
|
4
|
-
import type { Location } from 'history';
|
|
5
|
-
import { ComponentType } from 'react';
|
|
6
|
-
import { SiteThemeConfig } from "../types";
|
|
7
|
-
export type NavData = (INavItem & {
|
|
8
|
-
children?: INavItem[] | undefined;
|
|
9
|
-
})[];
|
|
10
|
-
export interface ISiteData {
|
|
11
|
-
components: Record<string, AtomAsset>;
|
|
12
|
-
demos: Record<string, {
|
|
13
|
-
asset: IPreviewerProps['asset'];
|
|
14
|
-
component: ComponentType;
|
|
15
|
-
routeId: string;
|
|
16
|
-
}>;
|
|
17
|
-
entryExports: Record<string, any>;
|
|
18
|
-
loading: boolean;
|
|
19
|
-
locales: ILocalesConfig;
|
|
20
|
-
pkg: Partial<Record<keyof typeof PICKED_PKG_FIELDS, any>>;
|
|
21
|
-
setLoading: (status: boolean) => void;
|
|
22
|
-
themeConfig: SiteThemeConfig;
|
|
23
|
-
}
|
|
24
|
-
export interface SiteStore {
|
|
25
|
-
locale: ILocale;
|
|
26
|
-
location: Location;
|
|
27
|
-
navData: NavData;
|
|
28
|
-
routeMeta: IRouteMeta;
|
|
29
|
-
sidebar?: ISidebarGroup[];
|
|
30
|
-
siteData: ISiteData;
|
|
31
|
-
tabMeta?: NonNullable<IRouteMeta['tabs']>[0]['meta'];
|
|
32
|
-
}
|
|
1
|
+
import { SiteStore } from './initialState';
|
|
33
2
|
export declare const useSiteStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<SiteStore>, "setState"> & {
|
|
34
3
|
setState<A extends string | {
|
|
35
4
|
type: unknown;
|
|
36
5
|
}>(partial: SiteStore | Partial<SiteStore> | ((state: SiteStore) => SiteStore | Partial<SiteStore>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
37
6
|
}>;
|
|
7
|
+
export * from './initialState';
|
|
@@ -1,48 +1,9 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
1
|
import { create } from 'zustand';
|
|
8
2
|
import { devtools } from 'zustand/middleware';
|
|
9
|
-
|
|
10
|
-
locale: {
|
|
11
|
-
id: 'zh-CN',
|
|
12
|
-
name: '中文',
|
|
13
|
-
suffix: ''
|
|
14
|
-
},
|
|
15
|
-
location: {
|
|
16
|
-
hash: '',
|
|
17
|
-
key: '',
|
|
18
|
-
pathname: '',
|
|
19
|
-
search: '',
|
|
20
|
-
state: ''
|
|
21
|
-
},
|
|
22
|
-
navData: [],
|
|
23
|
-
routeMeta: {
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
frontmatter: {},
|
|
26
|
-
tabs: undefined,
|
|
27
|
-
texts: [],
|
|
28
|
-
toc: []
|
|
29
|
-
},
|
|
30
|
-
sidebar: [],
|
|
31
|
-
siteData: {
|
|
32
|
-
components: {},
|
|
33
|
-
demos: {},
|
|
34
|
-
entryExports: {},
|
|
35
|
-
loading: true,
|
|
36
|
-
locales: [],
|
|
37
|
-
pkg: {},
|
|
38
|
-
// @ts-ignore
|
|
39
|
-
setLoading: undefined,
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
themeConfig: {}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
3
|
+
import { initialState } from "./initialState";
|
|
44
4
|
export var useSiteStore = create()(devtools(function () {
|
|
45
|
-
return
|
|
5
|
+
return initialState;
|
|
46
6
|
}, {
|
|
47
|
-
name: '
|
|
48
|
-
}));
|
|
7
|
+
name: 'dumi-theme-lobehub'
|
|
8
|
+
}));
|
|
9
|
+
export * from "./initialState";
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { FeaturesProps, FooterProps, HeroProps } from '@lobehub/ui';
|
|
1
|
+
import type { FeaturesProps, FooterProps, HeroProps, LogoProps } from '@lobehub/ui';
|
|
2
|
+
import { FooterColumn } from 'rc-footer/es/column';
|
|
2
3
|
import type { SiteCustomToken } from "../styles/customToken";
|
|
3
4
|
import type { HeroConfig } from './hero';
|
|
4
5
|
export interface ApiHeaderConfig {
|
|
@@ -6,15 +7,19 @@ export interface ApiHeaderConfig {
|
|
|
6
7
|
match?: string[];
|
|
7
8
|
pkg?: string;
|
|
8
9
|
sourceUrl?: string | false;
|
|
10
|
+
type?: 'component' | 'doc';
|
|
9
11
|
}
|
|
10
12
|
export interface FooterConfig {
|
|
11
13
|
bottom?: FooterProps['bottom'];
|
|
12
14
|
columns?: FooterProps['columns'];
|
|
15
|
+
moreProducts?: FooterColumn;
|
|
16
|
+
resources?: FooterColumn;
|
|
13
17
|
}
|
|
14
18
|
export interface SiteThemeConfig {
|
|
15
19
|
actions: HeroProps['actions'];
|
|
16
20
|
apiHeader?: ApiHeaderConfig | false;
|
|
17
21
|
description?: string;
|
|
22
|
+
docStyle?: 'block' | 'pure';
|
|
18
23
|
features: FeaturesProps['items'];
|
|
19
24
|
footer?: string | false;
|
|
20
25
|
footerConfig?: FooterConfig;
|
|
@@ -27,6 +32,7 @@ export interface SiteThemeConfig {
|
|
|
27
32
|
hero?: HeroConfig | Record<string, HeroConfig>;
|
|
28
33
|
hideHomeNav?: boolean;
|
|
29
34
|
logo?: string;
|
|
35
|
+
logoType?: LogoProps['type'];
|
|
30
36
|
name?: string;
|
|
31
37
|
siteToken?: SiteConfigToken;
|
|
32
38
|
socialLinks?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dumi-theme-lobehub",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
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",
|