dumi-theme-lobehub 1.5.0 β†’ 1.6.1

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
@@ -135,7 +135,7 @@ $ pnpm start
135
135
 
136
136
  <!-- CONTRIBUTION GROUP -->
137
137
 
138
- > πŸ“Š Total: <kbd>**2**</kbd>
138
+ > πŸ“Š Total: <kbd>**4**</kbd>
139
139
 
140
140
  <a href="https://github.com/canisminor1990" title="canisminor1990">
141
141
  <img src="https://avatars.githubusercontent.com/u/17870709?v=4" width="50" />
@@ -143,6 +143,12 @@ $ pnpm start
143
143
  <a href="https://github.com/actions-user" title="actions-user">
144
144
  <img src="https://avatars.githubusercontent.com/u/65916846?v=4" width="50" />
145
145
  </a>
146
+ <a href="https://github.com/arvinxx" title="arvinxx">
147
+ <img src="https://avatars.githubusercontent.com/u/28616219?v=4" width="50" />
148
+ </a>
149
+ <a href="https://github.com/apps/dependabot" title="dependabot[bot]">
150
+ <img src="https://avatars.githubusercontent.com/in/29110?v=4" width="50" />
151
+ </a>
146
152
 
147
153
  <!-- CONTRIBUTION END -->
148
154
 
@@ -1,13 +1,43 @@
1
- import { Meta } from '@lobehub/ui';
2
1
  import { Helmet } from 'dumi';
3
2
  import { memo } from 'react';
4
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
5
  var Favicons = /*#__PURE__*/memo(function () {
6
- return /*#__PURE__*/_jsx(Helmet, {
7
- children: /*#__PURE__*/_jsx(Meta, {
8
- title: 'LobeUI',
9
- withManifest: true
10
- })
6
+ return /*#__PURE__*/_jsxs(Helmet, {
7
+ children: [/*#__PURE__*/_jsx("link", {
8
+ href: "https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/apple-touch-icon.png",
9
+ rel: "apple-touch-icon",
10
+ sizes: "180x180"
11
+ }), /*#__PURE__*/_jsx("link", {
12
+ href: "https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/favicon-32x32.png",
13
+ rel: "icon",
14
+ sizes: "32x32",
15
+ type: "image/png"
16
+ }), /*#__PURE__*/_jsx("link", {
17
+ href: "https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/favicon-16x16.png",
18
+ rel: "icon",
19
+ sizes: "16x16",
20
+ type: "image/png"
21
+ }), /*#__PURE__*/_jsx("link", {
22
+ href: "https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/site.webmanifest",
23
+ rel: "manifest"
24
+ }), /*#__PURE__*/_jsx("link", {
25
+ color: "#000000",
26
+ href: "https://registry.npmmirror.com/@lobehub/assets-favicons/1.1.0/files/assets/safari-pinned-tab.svg",
27
+ rel: "mask-icon"
28
+ }), /*#__PURE__*/_jsx("meta", {
29
+ content: "LobeHub",
30
+ name: "apple-mobile-web-app-title"
31
+ }), /*#__PURE__*/_jsx("meta", {
32
+ content: "LobeHub",
33
+ name: "application-name"
34
+ }), /*#__PURE__*/_jsx("meta", {
35
+ content: "#000000",
36
+ name: "msapplication-TileColor"
37
+ }), /*#__PURE__*/_jsx("meta", {
38
+ content: "#000000",
39
+ name: "theme-color"
40
+ })]
11
41
  });
12
42
  });
13
43
  export default Favicons;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const DocumentLayout: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
3
+ export default DocumentLayout;
@@ -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 _default: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
3
- export default _default;
2
+ declare const App: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
3
+ export default App;
@@ -1,121 +1,20 @@
1
- import { Layout, ThemeProvider } from '@lobehub/ui';
2
- import { extractStaticStyle, 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';
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 Changelog from "../../pages/Changelog";
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
- export default /*#__PURE__*/memo(function () {
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
@@ -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,6 +25,10 @@ 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
33
  return giscus && /*#__PURE__*/_jsx(Giscus, {
30
34
  category: giscus.category,
@@ -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,9 +7,9 @@ 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, Typography } from 'antd';
10
+ import { Skeleton } from 'antd';
11
11
  import { useResponsive } from 'antd-style';
12
- import { memo } from 'react';
12
+ import { memo, useEffect } from 'react';
13
13
  import { Flexbox } from 'react-layout-kit';
14
14
  import ContentFooter from "dumi/theme/slots/ContentFooter";
15
15
  import { useSiteStore } from "../../store";
@@ -27,16 +27,26 @@ var Content = /*#__PURE__*/memo(function (_ref) {
27
27
  cx = _useStyles.cx;
28
28
  var _useResponsive = useResponsive(),
29
29
  mobile = _useResponsive.mobile;
30
+ useEffect(function () {
31
+ document.body.scrollTo(0, 0);
32
+ }, [loading]);
30
33
  return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
31
34
  gap: mobile ? 0 : 24,
32
35
  width: '100%'
33
36
  }, props), {}, {
34
- children: [/*#__PURE__*/_jsx(Typography, {}), /*#__PURE__*/_jsxs("div", {
37
+ children: [/*#__PURE__*/_jsx("div", {
38
+ style: {
39
+ height: 0
40
+ }
41
+ }), /*#__PURE__*/_jsxs("div", {
35
42
  className: cx('dumi-antd-style-content', styles.content),
36
43
  children: [/*#__PURE__*/_jsx(Skeleton, {
37
44
  active: true,
38
45
  loading: loading,
39
- paragraph: true
46
+ paragraph: true,
47
+ style: {
48
+ minHeight: '50vh'
49
+ }
40
50
  }), /*#__PURE__*/_jsx("div", {
41
51
  style: {
42
52
  display: loading ? 'none' : undefined
@@ -1,11 +1,16 @@
1
1
  import { ThemeSwitch as ThemeSwitchButton } from '@lobehub/ui';
2
- import { memo } from 'react';
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({
@@ -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("./useSiteStore").SiteStore) => import("../components/ApiHeader").ApiHeaderProps;
6
- flattenSidebar: (s: import("./useSiteStore").SiteStore) => import("dumi/dist/client/theme-api/types").ISidebarItem[];
7
- token: (s: import("./useSiteStore").SiteStore) => any;
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
+ };
@@ -1,37 +1,7 @@
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
- }
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
- var initialState = {
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 _objectSpread({}, initialState);
5
+ return initialState;
46
6
  }, {
47
- name: '@'
48
- }));
7
+ name: 'dumi-theme-lobehub'
8
+ }));
9
+ export * from "./initialState";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dumi-theme-lobehub",
3
- "version": "1.5.0",
3
+ "version": "1.6.1",
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",