dumi-theme-lobehub 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -67,6 +67,35 @@ $ pnpm install
67
67
  $ pnpm start
68
68
  ```
69
69
 
70
+ Theme Config:
71
+
72
+ ```ts
73
+ interface SiteThemeConfig {
74
+ actions: HeroProps['actions'];
75
+ apiHeader?: ApiHeaderConfig | false;
76
+ description?: string;
77
+ features: FeaturesProps['items'];
78
+ footer?: string | false;
79
+ footerConfig?: FooterConfig;
80
+ giscus?: {
81
+ category: string;
82
+ categoryId: string;
83
+ repo: `${string}/${string}`;
84
+ repoId: string;
85
+ };
86
+ hero?: HeroConfig | Record<string, HeroConfig>;
87
+ hideHomeNav?: boolean;
88
+ logo?: string;
89
+ name?: string;
90
+ siteToken?: SiteConfigToken;
91
+ socialLinks?: {
92
+ discord?: `https://discord.gg/${string}`;
93
+ github?: string;
94
+ };
95
+ title?: string;
96
+ }
97
+ ```
98
+
70
99
  <div align="right">
71
100
 
72
101
  [![][back-to-top]](#readme-top)
@@ -77,23 +106,11 @@ $ pnpm start
77
106
 
78
107
  <!-- CONTRIBUTION GROUP -->
79
108
 
80
- > 📊 Total: <kbd>**5**</kbd>
109
+ > 📊 Total: <kbd>**1**</kbd>
81
110
 
82
111
  <a href="https://github.com/canisminor1990" title="canisminor1990">
83
112
  <img src="https://avatars.githubusercontent.com/u/17870709?v=4" width="50" />
84
113
  </a>
85
- <a href="https://github.com/arvinxx" title="arvinxx">
86
- <img src="https://avatars.githubusercontent.com/u/28616219?v=4" width="50" />
87
- </a>
88
- <a href="https://github.com/apps/dependabot" title="dependabot[bot]">
89
- <img src="https://avatars.githubusercontent.com/in/29110?v=4" width="50" />
90
- </a>
91
- <a href="https://github.com/actions-user" title="actions-user">
92
- <img src="https://avatars.githubusercontent.com/u/65916846?v=4" width="50" />
93
- </a>
94
- <a href="https://github.com/meganjohnson96" title="meganjohnson96">
95
- <img src="https://avatars.githubusercontent.com/u/136729222?v=4" width="50" />
96
- </a>
97
114
 
98
115
  <!-- CONTRIBUTION END -->
99
116
 
@@ -6,7 +6,7 @@ import { Center } from 'react-layout-kit';
6
6
  import { shallow } from 'zustand/shallow';
7
7
  import ApiHeader from "dumi/theme/slots/ApiHeader";
8
8
  import Content from "dumi/theme/slots/Content";
9
- import { isApiPageSel, useSiteStore } from "../../store";
9
+ import { giscusSel, isApiPageSel, useSiteStore } from "../../store";
10
10
  import { useStyles } from "./styles";
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -15,19 +15,26 @@ var Documents = /*#__PURE__*/memo(function () {
15
15
  var outlet = useOutlet();
16
16
  var _useResponsive = useResponsive(),
17
17
  mobile = _useResponsive.mobile;
18
- var isApiPage = useSiteStore(isApiPageSel, shallow);
18
+ var _useSiteStore = useSiteStore(function (st) {
19
+ return {
20
+ giscus: giscusSel(st),
21
+ isApiPage: isApiPageSel(st)
22
+ };
23
+ }, shallow),
24
+ isApiPage = _useSiteStore.isApiPage,
25
+ giscus = _useSiteStore.giscus;
19
26
  var _useStyles = useStyles(),
20
27
  styles = _useStyles.styles;
21
28
  var Comment = useCallback(function () {
22
- return /*#__PURE__*/_jsx(Giscus, {
23
- category: "Q&A",
24
- categoryId: "DIC_kwDOJloKoM4CXsCu",
29
+ return giscus && /*#__PURE__*/_jsx(Giscus, {
30
+ category: giscus.category,
31
+ categoryId: giscus.categoryId,
25
32
  id: "lobehub",
26
33
  mapping: "title",
27
- repo: "lobehub/lobe-ui",
28
- repoId: "R_kgDOJloKoA"
34
+ repo: giscus.repo,
35
+ repoId: giscus.repoId
29
36
  });
30
- }, [location.pathname]);
37
+ }, [giscus, location.pathname]);
31
38
  return /*#__PURE__*/_jsxs(_Fragment, {
32
39
  children: [/*#__PURE__*/_jsx("div", {
33
40
  className: styles.background
@@ -44,7 +51,7 @@ var Documents = /*#__PURE__*/memo(function () {
44
51
  },
45
52
  children: /*#__PURE__*/_jsx(ApiHeader, {})
46
53
  }) : undefined, /*#__PURE__*/_jsxs(Content, {
47
- children: [outlet, /*#__PURE__*/_jsx(Comment, {})]
54
+ children: [outlet, giscus && /*#__PURE__*/_jsx(Comment, {})]
48
55
  })]
49
56
  })]
50
57
  });
@@ -24,7 +24,7 @@ var Footer = /*#__PURE__*/memo(function () {
24
24
  mobile = _useResponsive.mobile;
25
25
  if (!themeConfig.footer) return;
26
26
  var footer = themeConfig.footerConfig;
27
- var columns = (footer === null || footer === void 0 ? void 0 : footer.columns) === false ? undefined : getColumns({
27
+ var columns = footer !== null && footer !== void 0 && footer.columns ? undefined : getColumns({
28
28
  github: githubUrl || pkg.homepage
29
29
  });
30
30
  var bottomFooter = (footer === null || footer === void 0 ? void 0 : footer.bottom) || themeConfig.footer;
@@ -50,7 +50,7 @@ var Footer = /*#__PURE__*/memo(function () {
50
50
  }),
51
51
  columns: columns,
52
52
  contentMaxWidth: theme.contentMaxWidth,
53
- theme: (footer === null || footer === void 0 ? void 0 : footer.theme) || theme.appearance
53
+ theme: theme.appearance
54
54
  });
55
55
  });
56
56
  export default Footer;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const DiscordButton: import("react").NamedExoticComponent<object>;
3
+ export default DiscordButton;
@@ -0,0 +1,32 @@
1
+ var _templateObject;
2
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
+ import { ActionIcon } from '@lobehub/ui';
4
+ import { createStyles } from 'antd-style';
5
+ import { createLucideIcon } from 'lucide-react';
6
+ import { memo } from 'react';
7
+ import { discordSel, useSiteStore } from "../../store";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ var Discord = createLucideIcon('Discord', [['path', {
10
+ d: 'M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z',
11
+ key: '18tl5t'
12
+ }]]);
13
+ var useStyles = createStyles(function (_ref) {
14
+ var css = _ref.css;
15
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n svg {\n overflow: visible !important;\n }\n "])));
16
+ });
17
+ var DiscordButton = /*#__PURE__*/memo(function () {
18
+ var inviteUrl = useSiteStore(discordSel);
19
+ var _useStyles = useStyles(),
20
+ styles = _useStyles.styles;
21
+ return inviteUrl ? /*#__PURE__*/_jsx("a", {
22
+ href: inviteUrl,
23
+ rel: "noreferrer",
24
+ target: '_blank',
25
+ children: /*#__PURE__*/_jsx(ActionIcon, {
26
+ className: styles,
27
+ icon: Discord,
28
+ size: "site"
29
+ })
30
+ }) : undefined;
31
+ });
32
+ export default DiscordButton;
@@ -6,6 +6,7 @@ import Navbar from "dumi/theme/slots/Navbar";
6
6
  import SearchBar from "dumi/theme/slots/SearchBar";
7
7
  import { useSiteStore } from "../../store/useSiteStore";
8
8
  import Burger from "./Burger";
9
+ import DiscordButton from "./DiscordButton";
9
10
  import GithubButton from "./GithubButton";
10
11
  import LangSwitch from "./LangSwitch";
11
12
  import ThemeSwitch from "./ThemeSwitch";
@@ -21,7 +22,7 @@ var Header = /*#__PURE__*/memo(function () {
21
22
  if (!hasHeader) return;
22
23
  return /*#__PURE__*/_jsx(Head, {
23
24
  actions: mobile ? /*#__PURE__*/_jsx(ThemeSwitch, {}) : /*#__PURE__*/_jsxs(_Fragment, {
24
- children: [' ', /*#__PURE__*/_jsx(SearchBar, {}), /*#__PURE__*/_jsx(LangSwitch, {}), /*#__PURE__*/_jsx(GithubButton, {}), /*#__PURE__*/_jsx(ThemeSwitch, {})]
25
+ children: [/*#__PURE__*/_jsx(SearchBar, {}), " ", /*#__PURE__*/_jsx(LangSwitch, {}), /*#__PURE__*/_jsx(GithubButton, {}), /*#__PURE__*/_jsx(DiscordButton, {}), /*#__PURE__*/_jsx(ThemeSwitch, {})]
25
26
  }),
26
27
  logo: /*#__PURE__*/_jsx(Logo, {}),
27
28
  nav: mobile ? /*#__PURE__*/_jsx(Burger, {}) : /*#__PURE__*/_jsx(Navbar, {})
@@ -1,6 +1,6 @@
1
1
  import { type IPreviewerProps } from 'dumi';
2
2
  import { type FC, type ReactNode } from 'react';
3
- export interface IPreviewerActionsProps extends IPreviewerProps {
3
+ export interface PreviewerActionsProps extends IPreviewerProps {
4
4
  demoContainer: HTMLDivElement | HTMLIFrameElement;
5
5
  /**
6
6
  * disabled actions
@@ -9,5 +9,5 @@ export interface IPreviewerActionsProps extends IPreviewerProps {
9
9
  extra?: ReactNode;
10
10
  forceShowCode?: boolean;
11
11
  }
12
- declare const PreviewerActions: FC<IPreviewerActionsProps>;
12
+ declare const PreviewerActions: FC<PreviewerActionsProps>;
13
13
  export default PreviewerActions;
@@ -1,17 +1,8 @@
1
1
  export * from './selectors';
2
2
  export * from './useSiteStore';
3
3
  export * from './useThemeStore';
4
- /**
5
- * @title 数据选择器
6
- */
7
4
  export declare const siteSelectors: {
8
- /**
9
- * @title API 头部选择器
10
- */
11
5
  apiHeader: (s: import("./useSiteStore").SiteStore) => import("../components/ApiHeader").ApiHeaderProps;
12
- /**
13
- * @title 扁平化侧边栏选择器
14
- */
15
6
  flattenSidebar: (s: import("./useSiteStore").SiteStore) => import("dumi/dist/client/theme-api/types").ISidebarItem[];
16
7
  token: (s: import("./useSiteStore").SiteStore) => any;
17
8
  };
@@ -2,18 +2,8 @@ import { apiHeaderSel, flattenSidebarSel, tokenSel } from "./selectors";
2
2
  export * from "./selectors";
3
3
  export * from "./useSiteStore";
4
4
  export * from "./useThemeStore";
5
-
6
- /**
7
- * @title 数据选择器
8
- */
9
5
  export var siteSelectors = {
10
- /**
11
- * @title API 头部选择器
12
- */
13
6
  apiHeader: apiHeaderSel,
14
- /**
15
- * @title 扁平化侧边栏选择器
16
- */
17
7
  flattenSidebar: flattenSidebarSel,
18
8
  token: tokenSel
19
9
  };
@@ -25,8 +25,6 @@ export var apiHeaderSel = function apiHeaderSel(s) {
25
25
  var REPO_BASE = githubSel(s);
26
26
  var fm = s.routeMeta.frontmatter;
27
27
  var localeId = s.locale.id;
28
-
29
- // 统一的路径匹配替换方法
30
28
  var replaceUrl = function replaceUrl(rawString) {
31
29
  return rawString.replace('{github}', REPO_BASE).replace('{atomId}', fm.atomId || '').replace('{title}', fm.title).replace('{locale}', localeId);
32
30
  };
@@ -35,18 +33,8 @@ export var apiHeaderSel = function apiHeaderSel(s) {
35
33
  package_ = _ref$pkg === void 0 ? s.siteData.pkg.name : _ref$pkg,
36
34
  sourceUrlMatch = _ref.sourceUrl,
37
35
  documentUrlMatch = _ref.docUrl;
38
-
39
- // 1. 兜底默认使用文档的 apiHeader.pkg
40
- // 2. 如果 themeConfig 里配置了 pkg, 则使用配置的 pkg
41
- // 3. 兜底使用 package.json 中的 name
42
36
  var displayPackage = ((_fm$apiHeader = fm.apiHeader) === null || _fm$apiHeader === void 0 ? void 0 : _fm$apiHeader.pkg) || package_;
43
-
44
- // 1. 默认使用文档的 fm.atomId
45
- // 2. 兜底到文档 title
46
37
  var componentName = fm.atomId || fm.title;
47
-
48
- // 1. 优先选择使用文档 apiHeader.defaultImport
49
- // 2. 默认使用 false
50
38
  var defaultImport = ((_fm$apiHeader2 = fm.apiHeader) === null || _fm$apiHeader2 === void 0 ? void 0 : _fm$apiHeader2.defaultImport) || false;
51
39
  var sourceUrl = ((_fm$apiHeader3 = fm.apiHeader) === null || _fm$apiHeader3 === void 0 ? void 0 : _fm$apiHeader3.sourceUrl) || (haseUrl(sourceUrlMatch) ? replaceUrl(sourceUrlMatch) : undefined);
52
40
  var documentUrl = ((_fm$apiHeader4 = fm.apiHeader) === null || _fm$apiHeader4 === void 0 ? void 0 : _fm$apiHeader4.docUrl) || (haseUrl(documentUrlMatch) ? replaceUrl(documentUrlMatch) : undefined);
@@ -1,22 +1,7 @@
1
1
  import { type FeatureItem } from '@lobehub/ui';
2
2
  import { SiteStore } from '../useSiteStore';
3
3
  export declare const isHeroPageSel: (s: SiteStore) => boolean;
4
- /**
5
- * Hero Title 选择器
6
- * 选择逻辑:优先使用 hero 配置的 title, 再兜底到 themeConfig 中的 name
7
- */
8
4
  export declare const heroTitleSel: (s: SiteStore) => any;
9
- /**
10
- * Hero description 选择器
11
- * 选择逻辑:优先使用 hero 配置的 description, 再兜底到 themeConfig 中的 name
12
- */
13
5
  export declare const heroDescSel: (s: SiteStore) => any;
14
- /**
15
- * Hero Action 选择器
16
- * 选择逻辑:优先使用 hero 配置的 actions, 再兜底到 themeConfig 中的 actions
17
- */
18
6
  export declare const heroActionsSel: (s: SiteStore) => any;
19
- /**
20
- * Features 选择器
21
- */
22
7
  export declare const featuresSel: (s: SiteStore) => FeatureItem[];
@@ -6,54 +6,20 @@ var localeValueSel = function localeValueSel(s, value) {
6
6
  if (value[s.locale.id]) return value[s.locale.id];
7
7
  return value;
8
8
  };
9
-
10
- /**
11
- * Hero Title 选择器
12
- * 选择逻辑:优先使用 hero 配置的 title, 再兜底到 themeConfig 中的 name
13
- */
14
9
  export var heroTitleSel = function heroTitleSel(s) {
15
10
  var _s$routeMeta$frontmat, _localeValueSel;
16
- return ((_s$routeMeta$frontmat = s.routeMeta.frontmatter.hero) === null || _s$routeMeta$frontmat === void 0 ? void 0 : _s$routeMeta$frontmat.title) || ( // hero title 中选择
17
- (_localeValueSel = localeValueSel(s, s.siteData.themeConfig.hero)) === null || _localeValueSel === void 0 ? void 0 : _localeValueSel.title) ||
18
- // @deprecated 1.0 正式版本移除
19
- // 从 hero 的 title 中选择
20
- localeValueSel(s, s.siteData.themeConfig.title) || s.siteData.themeConfig.name;
11
+ return ((_s$routeMeta$frontmat = s.routeMeta.frontmatter.hero) === null || _s$routeMeta$frontmat === void 0 ? void 0 : _s$routeMeta$frontmat.title) || ((_localeValueSel = localeValueSel(s, s.siteData.themeConfig.hero)) === null || _localeValueSel === void 0 ? void 0 : _localeValueSel.title) || localeValueSel(s, s.siteData.themeConfig.title) || s.siteData.themeConfig.name;
21
12
  };
22
-
23
- /**
24
- * Hero description 选择器
25
- * 选择逻辑:优先使用 hero 配置的 description, 再兜底到 themeConfig 中的 name
26
- */
27
13
  export var heroDescSel = function heroDescSel(s) {
28
14
  var _s$routeMeta$frontmat2, _localeValueSel2;
29
- return ((_s$routeMeta$frontmat2 = s.routeMeta.frontmatter.hero) === null || _s$routeMeta$frontmat2 === void 0 ? void 0 : _s$routeMeta$frontmat2.description) || ( // hero description 中选择
30
- (_localeValueSel2 = localeValueSel(s, s.siteData.themeConfig.hero)) === null || _localeValueSel2 === void 0 ? void 0 : _localeValueSel2.description) ||
31
- // @deprecated 1.0 正式版本移除
32
- // 从 hero 的 description 中选择
33
- localeValueSel(s, s.siteData.themeConfig.description);
15
+ return ((_s$routeMeta$frontmat2 = s.routeMeta.frontmatter.hero) === null || _s$routeMeta$frontmat2 === void 0 ? void 0 : _s$routeMeta$frontmat2.description) || ((_localeValueSel2 = localeValueSel(s, s.siteData.themeConfig.hero)) === null || _localeValueSel2 === void 0 ? void 0 : _localeValueSel2.description) || localeValueSel(s, s.siteData.themeConfig.description);
34
16
  };
35
-
36
- /**
37
- * Hero Action 选择器
38
- * 选择逻辑:优先使用 hero 配置的 actions, 再兜底到 themeConfig 中的 actions
39
- */
40
17
  export var heroActionsSel = function heroActionsSel(s) {
41
18
  var _s$routeMeta$frontmat3, _localeValueSel3;
42
- return ((_s$routeMeta$frontmat3 = s.routeMeta.frontmatter.hero) === null || _s$routeMeta$frontmat3 === void 0 ? void 0 : _s$routeMeta$frontmat3.actions) || ( // hero actions 中选择
43
- (_localeValueSel3 = localeValueSel(s, s.siteData.themeConfig.hero)) === null || _localeValueSel3 === void 0 ? void 0 : _localeValueSel3.actions) ||
44
- // @deprecated 1.0 正式版本移除
45
- localeValueSel(s, s.siteData.themeConfig.actions);
19
+ return ((_s$routeMeta$frontmat3 = s.routeMeta.frontmatter.hero) === null || _s$routeMeta$frontmat3 === void 0 ? void 0 : _s$routeMeta$frontmat3.actions) || ((_localeValueSel3 = localeValueSel(s, s.siteData.themeConfig.hero)) === null || _localeValueSel3 === void 0 ? void 0 : _localeValueSel3.actions) || localeValueSel(s, s.siteData.themeConfig.actions);
46
20
  };
47
-
48
- /**
49
- * Features 选择器
50
- */
51
21
  export var featuresSel = function featuresSel(s) {
52
22
  var _localeValueSel4;
53
23
  if (!isHeroPageSel(s)) return [];
54
- return ((_localeValueSel4 = localeValueSel(s, s.siteData.themeConfig.hero)) === null || _localeValueSel4 === void 0 ? void 0 : _localeValueSel4.features) ||
55
- // @deprecated 1.0 正式版本移除
56
- localeValueSel(s, s.siteData.themeConfig.features) ||
57
- // 在themeConfig 没有配置的话,尝试兜底到 frontmatter 中的配置
58
- s.routeMeta.frontmatter.features || [];
24
+ return ((_localeValueSel4 = localeValueSel(s, s.siteData.themeConfig.hero)) === null || _localeValueSel4 === void 0 ? void 0 : _localeValueSel4.features) || localeValueSel(s, s.siteData.themeConfig.features) || s.routeMeta.frontmatter.features || [];
59
25
  };
@@ -1,6 +1,10 @@
1
1
  import { SiteStore } from '../useSiteStore';
2
- /**
3
- * 站点标题选择器
4
- */
5
- export declare const siteTitleSel: (s: SiteStore) => any;
6
- export declare const githubSel: (s: SiteStore) => any;
2
+ export declare const siteTitleSel: (s: SiteStore) => string | undefined;
3
+ export declare const githubSel: (s: SiteStore) => string;
4
+ export declare const discordSel: (s: SiteStore) => "" | `https://discord.gg/${string}`;
5
+ export declare const giscusSel: (s: SiteStore) => {
6
+ category: string;
7
+ categoryId: string;
8
+ repo: `${string}/${string}`;
9
+ repoId: string;
10
+ } | undefined;
@@ -1,14 +1,14 @@
1
- /**
2
- * 站点标题选择器
3
- */
4
1
  export var siteTitleSel = function siteTitleSel(s) {
5
2
  return s.siteData.themeConfig.title;
6
3
  };
7
4
  export var githubSel = function githubSel(s) {
8
5
  var _s$siteData$themeConf;
9
- return (
10
- // 优先取 socialLinks 里的 github
11
- // TODO: 后面的 github 1.0 里废弃
12
- ((_s$siteData$themeConf = s.siteData.themeConfig.socialLinks) === null || _s$siteData$themeConf === void 0 ? void 0 : _s$siteData$themeConf.github) || s.siteData.themeConfig.github
13
- );
6
+ return ((_s$siteData$themeConf = s.siteData.themeConfig.socialLinks) === null || _s$siteData$themeConf === void 0 ? void 0 : _s$siteData$themeConf.github) || '';
7
+ };
8
+ export var discordSel = function discordSel(s) {
9
+ var _s$siteData$themeConf2;
10
+ return ((_s$siteData$themeConf2 = s.siteData.themeConfig.socialLinks) === null || _s$siteData$themeConf2 === void 0 ? void 0 : _s$siteData$themeConf2.discord) || '';
11
+ };
12
+ export var giscusSel = function giscusSel(s) {
13
+ return s.siteData.themeConfig.giscus;
14
14
  };
@@ -1,8 +1,9 @@
1
1
  import { AtomAsset } from 'dumi-assets-types';
2
- import { ILocale, ILocalesConfig, INavItem, IPreviewerProps, IRouteMeta, ISidebarGroup, IThemeConfig } from 'dumi/dist/client/theme-api/types';
2
+ import { ILocale, ILocalesConfig, INavItem, IPreviewerProps, IRouteMeta, ISidebarGroup } from 'dumi/dist/client/theme-api/types';
3
3
  import { PICKED_PKG_FIELDS } from 'dumi/dist/constants';
4
4
  import type { Location } from 'history';
5
5
  import { ComponentType } from 'react';
6
+ import { SiteThemeConfig } from "../types";
6
7
  export declare type NavData = (INavItem & {
7
8
  children?: INavItem[] | undefined;
8
9
  })[];
@@ -18,7 +19,7 @@ export interface ISiteData {
18
19
  locales: ILocalesConfig;
19
20
  pkg: Partial<Record<keyof typeof PICKED_PKG_FIELDS, any>>;
20
21
  setLoading: (status: boolean) => void;
21
- themeConfig: IThemeConfig;
22
+ themeConfig: SiteThemeConfig;
22
23
  }
23
24
  export interface SiteStore {
24
25
  locale: ILocale;
@@ -1,20 +1,19 @@
1
1
  import type { ThemeMode } from 'antd-style';
2
- interface Store {
2
+ export interface ThemeStore {
3
3
  themeMode: ThemeMode;
4
4
  }
5
- export declare const useThemeStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<Store>, "persist"> & {
5
+ export declare const useThemeStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<ThemeStore>, "persist"> & {
6
6
  persist: {
7
- setOptions: (options: Partial<import("zustand/middleware").PersistOptions<Store, {
7
+ setOptions: (options: Partial<import("zustand/middleware").PersistOptions<ThemeStore, {
8
8
  themeMode: ThemeMode;
9
9
  }>>) => void;
10
10
  clearStorage: () => void;
11
11
  rehydrate: () => void | Promise<void>;
12
12
  hasHydrated: () => boolean;
13
- onHydrate: (fn: (state: Store) => void) => () => void;
14
- onFinishHydration: (fn: (state: Store) => void) => () => void;
15
- getOptions: () => Partial<import("zustand/middleware").PersistOptions<Store, {
13
+ onHydrate: (fn: (state: ThemeStore) => void) => () => void;
14
+ onFinishHydration: (fn: (state: ThemeStore) => void) => () => void;
15
+ getOptions: () => Partial<import("zustand/middleware").PersistOptions<ThemeStore, {
16
16
  themeMode: ThemeMode;
17
17
  }>>;
18
18
  };
19
19
  }>;
20
- export {};
@@ -1,101 +1,38 @@
1
- import { FooterColumn } from 'rc-footer/es/column';
2
- import { SiteCustomToken } from '../styles/customToken';
3
- import { IHero } from './hero';
1
+ import type { FeaturesProps, FooterProps, HeroProps } from '@lobehub/ui';
2
+ import type { SiteCustomToken } from "../styles/customToken";
3
+ import type { HeroConfig } from './hero';
4
4
  export interface ApiHeaderConfig {
5
- /**
6
- * @title 文档链接
7
- * @description 点击 ApiHeader 组件的文档链接跳转的地址
8
- */
9
5
  docUrl?: string | false;
10
- /**
11
- * @title 匹配路由
12
- * @description ApiHeader 组件的匹配路由
13
- * @default ["/api", "/components"]
14
- */
15
6
  match?: string[];
16
- /**
17
- * @title 组件库包名
18
- * @description 可以从 package.json 中引入名称
19
- */
20
7
  pkg?: string;
21
- /**
22
- * @title 源代码链接
23
- * @description 点击 ApiHeader 组件的源代码链接跳转的地址
24
- */
25
8
  sourceUrl?: string | false;
26
9
  }
27
- /**
28
- * @title 页面底部 Footer 组件的配置
29
- */
30
- export interface IFooter {
31
- /**
32
- * @title 底部内容
33
- */
34
- bottom?: string;
35
- /**
36
- * @title 列配置
37
- */
38
- columns?: FooterColumn[] | false;
39
- /**
40
- * @title 主题
41
- * @enum ['dark', 'light']
42
- * @enumNames ['黑色', '白色']
43
- */
44
- theme?: 'dark' | 'light';
10
+ export interface FooterConfig {
11
+ bottom?: FooterProps['bottom'];
12
+ columns?: FooterProps['columns'];
45
13
  }
46
- /**
47
- * 网站主题配置
48
- */
49
14
  export interface SiteThemeConfig {
50
- /**
51
- * API 文档页头部配置
52
- * @type ApiHeaderConfig | false
53
- */
15
+ actions: HeroProps['actions'];
54
16
  apiHeader?: ApiHeaderConfig | false;
55
- /**
56
- * 网站页脚
57
- * @type string | false
58
- */
17
+ description?: string;
18
+ features: FeaturesProps['items'];
59
19
  footer?: string | false;
60
- /**
61
- * 网站页脚配置
62
- * @type IFooter
63
- */
64
- footerConfig?: IFooter;
65
- /**
66
- * 导航栏 Github 图标链接,如不配置该字段,则不展示。
67
- */
68
- github?: string;
69
- /**
70
- * 网站首页头部
71
- * @type IHero | Record<string, IHero>
72
- */
73
- hero?: IHero | Record<string, IHero>;
74
- /**
75
- * 是否隐藏首页的 nav tab,配置为 `false` 则不展示首页的 tab
76
- */
20
+ footerConfig?: FooterConfig;
21
+ giscus?: {
22
+ category: string;
23
+ categoryId: string;
24
+ repo: `${string}/${string}`;
25
+ repoId: string;
26
+ };
27
+ hero?: HeroConfig | Record<string, HeroConfig>;
77
28
  hideHomeNav?: boolean;
78
- /**
79
- * 网站 logo 图片链接
80
- */
81
29
  logo?: string;
82
- /**
83
- * 网站名称
84
- */
85
30
  name?: string;
86
- /**
87
- * 网站主题 Token 配置
88
- */
89
31
  siteToken?: SiteConfigToken;
90
32
  socialLinks?: {
91
- facebook?: string;
33
+ discord?: `https://discord.gg/${string}`;
92
34
  github?: string;
93
- gitlab?: string;
94
- linkedin?: string;
95
- twitter?: string;
96
- weibo?: string;
97
- yueque?: string;
98
- zhihu?: string;
99
35
  };
36
+ title?: string;
100
37
  }
101
38
  export declare type SiteConfigToken = Partial<Pick<SiteCustomToken, 'headerHeight' | 'footerHeight' | 'sidebarWidth' | 'tocWidth' | 'contentMaxWidth'>>;
@@ -1,6 +1,6 @@
1
1
  import { type FeatureItem, type HeroAction } from '@lobehub/ui';
2
2
  export declare type ImageContainerType = 'light' | 'primary' | 'soon';
3
- export interface IHero {
3
+ export interface HeroConfig {
4
4
  actions: HeroAction[];
5
5
  description?: string;
6
6
  features?: FeatureItem[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dumi-theme-lobehub",
3
- "version": "1.3.0",
3
+ "version": "1.4.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",