dumi-theme-lobehub 2.0.0 → 2.0.2

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
@@ -45,9 +45,6 @@ dumi-theme-lobehub is a documentation site theme package designed for `Dumi 2`.
45
45
 
46
46
  </details>
47
47
 
48
- > \[!WARNING]
49
- > Not Support Dumi >= 2.3 yet
50
-
51
48
  ## ✨ Features
52
49
 
53
50
  - [x] 🤯 **Modern Theme Style:** This theme package adopts modern design techniques such as gradient colors, frosted glass, lighting effects, and natural animations to present the interface in a more concise and visually appealing way, making the documents more intuitive, readable, and user-friendly.
@@ -1,33 +1,16 @@
1
- import { ThemeProvider } from '@lobehub/ui';
2
1
  import { useLocale, useLocation, useNavData, useOutlet, useRouteMeta, useSidebarData, useSiteData, useTabMeta } from 'dumi';
3
- import isEqual from 'fast-deep-equal';
4
- import { memo, useMemo } from 'react';
5
- import { Provider, createStore as _createStore, useThemeStore } from "../../store";
6
- import AntdV5MonkeyPatch from "../DocLayout/AntdV5MonkeyPatch";
2
+ import { memo } from 'react';
3
+ import { Provider, createStore as _createStore } from "../../store";
7
4
  import Analytics from "../DocLayout/Head/Analytics";
8
5
  import Favicons from "../DocLayout/Head/Favicons";
9
6
  import Og from "../DocLayout/Head/Og";
10
7
  import StructuredData from "../DocLayout/Head/StructuredData";
8
+ import ThemeProvider from "../DocLayout/ThemeProvider";
11
9
  import GlobalStyle from "./GlobalStyle";
12
10
  import { jsx as _jsx } from "react/jsx-runtime";
13
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
- var App = /*#__PURE__*/memo(function (_ref) {
15
- var initState = _ref.initState;
16
- var themeMode = useThemeStore(function (st) {
17
- return st.themeMode;
18
- }, isEqual);
19
- var outlet = useOutlet();
20
- return /*#__PURE__*/_jsxs(Provider, {
21
- createStore: function createStore() {
22
- return _createStore(initState);
23
- },
24
- children: [/*#__PURE__*/_jsx(Favicons, {}), /*#__PURE__*/_jsx(Og, {}), /*#__PURE__*/_jsx(Analytics, {}), /*#__PURE__*/_jsx(StructuredData, {}), /*#__PURE__*/_jsxs(ThemeProvider, {
25
- themeMode: themeMode,
26
- children: [/*#__PURE__*/_jsx(GlobalStyle, {}), outlet]
27
- }), /*#__PURE__*/_jsx(AntdV5MonkeyPatch, {})]
28
- });
29
- });
30
- export default /*#__PURE__*/memo(function () {
12
+ var DemoProvider = /*#__PURE__*/memo(function (_ref) {
13
+ var children = _ref.children;
31
14
  var siteData = useSiteData();
32
15
  var sidebar = useSidebarData();
33
16
  var routeMeta = useRouteMeta();
@@ -35,18 +18,29 @@ export default /*#__PURE__*/memo(function () {
35
18
  var navData = useNavData();
36
19
  var location = useLocation();
37
20
  var locale = useLocale();
38
- var initState = useMemo(function () {
39
- return {
40
- locale: locale,
41
- location: location,
42
- navData: navData,
43
- routeMeta: routeMeta,
44
- sidebar: sidebar,
45
- siteData: siteData,
46
- tabMeta: tabMeta
47
- };
48
- }, []);
49
- return /*#__PURE__*/_jsx(App, {
50
- initState: initState
21
+ return /*#__PURE__*/_jsxs(Provider, {
22
+ createStore: function createStore() {
23
+ return (
24
+ // @ts-ignore
25
+ _createStore({
26
+ locale: locale,
27
+ location: location,
28
+ navData: navData,
29
+ routeMeta: routeMeta,
30
+ sidebar: sidebar,
31
+ siteData: siteData,
32
+ tabMeta: tabMeta
33
+ })
34
+ );
35
+ },
36
+ children: [/*#__PURE__*/_jsx(Favicons, {}), /*#__PURE__*/_jsx(Og, {}), /*#__PURE__*/_jsx(Analytics, {}), /*#__PURE__*/_jsx(StructuredData, {}), /*#__PURE__*/_jsxs(ThemeProvider, {
37
+ children: [/*#__PURE__*/_jsx(GlobalStyle, {}), children]
38
+ })]
39
+ });
40
+ });
41
+ export default /*#__PURE__*/memo(function () {
42
+ var outlet = useOutlet();
43
+ return /*#__PURE__*/_jsx(DemoProvider, {
44
+ children: outlet
51
45
  });
52
46
  });
@@ -1,3 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare const DocumentLayout: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
2
+ declare const DocumentLayout: import("react").NamedExoticComponent<{
3
+ children?: import("react").ReactNode;
4
+ }>;
3
5
  export default DocumentLayout;
@@ -14,7 +14,8 @@ import { heroSelectors, siteSelectors, useSiteStore } from "../../store";
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
16
  import { Fragment as _Fragment } from "react/jsx-runtime";
17
- var DocumentLayout = /*#__PURE__*/memo(function () {
17
+ var DocumentLayout = /*#__PURE__*/memo(function (_ref) {
18
+ var children = _ref.children;
18
19
  var intl = useIntl();
19
20
  var _useLocation = useLocation(),
20
21
  hash = _useLocation.hash;
@@ -104,7 +105,13 @@ var DocumentLayout = /*#__PURE__*/memo(function () {
104
105
  sidebar: hideSidebar ? undefined : /*#__PURE__*/_jsx(Sidebar, {}),
105
106
  toc: hideToc ? undefined : /*#__PURE__*/_jsx(Toc, {}),
106
107
  tocWidth: hideToc ? 0 : theme.tocWidth,
107
- children: [page === 'home' && /*#__PURE__*/_jsx(Home, {}), page === 'changelog' && /*#__PURE__*/_jsx(Changelog, {}), page === 'docs' && /*#__PURE__*/_jsx(Docs, {})]
108
+ children: [page === 'home' && /*#__PURE__*/_jsx(Home, {
109
+ children: children
110
+ }), page === 'changelog' && /*#__PURE__*/_jsx(Changelog, {
111
+ children: children
112
+ }), page === 'docs' && /*#__PURE__*/_jsx(Docs, {
113
+ children: children
114
+ })]
108
115
  })]
109
116
  });
110
117
  });
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import 'antd/dist/reset.css';
2
3
  declare const _default: import("react").NamedExoticComponent<{
3
4
  children?: import("react").ReactNode;
4
5
  }>;
@@ -1,11 +1,11 @@
1
1
  import { ThemeProvider } from '@lobehub/ui';
2
2
  import { StyleProvider, extractStaticStyle } from 'antd-style';
3
+ import 'antd/dist/reset.css';
3
4
  import isEqual from 'fast-deep-equal';
4
5
  import { memo } from 'react';
5
6
  import GlobalStyle from "./GlobalStyle";
6
7
  import { siteSelectors, useSiteStore, useThemeStore } from "../../store";
7
8
  import _customToken from "../../styles/customToken";
8
- import AntdV5MonkeyPatch from "./AntdV5MonkeyPatch";
9
9
 
10
10
  //@ts-ignore
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -17,15 +17,19 @@ export default /*#__PURE__*/memo(function (_ref) {
17
17
  return st.themeMode;
18
18
  });
19
19
  var userToken = useSiteStore(siteSelectors.token, isEqual);
20
- return /*#__PURE__*/_jsxs(StyleProvider, {
20
+ return /*#__PURE__*/_jsx(StyleProvider, {
21
21
  cache: extractStaticStyle.cache,
22
22
  speedy: process.env.NODE_ENV === 'production',
23
- children: [/*#__PURE__*/_jsxs(ThemeProvider, {
23
+ children: /*#__PURE__*/_jsxs(ThemeProvider, {
24
+ appearance: themeMode !== 'auto' ? themeMode : undefined,
24
25
  customToken: function customToken(themeToken) {
25
26
  return Object.assign({}, _customToken(themeToken), userToken);
26
27
  },
28
+ theme: {
29
+ cssVar: true
30
+ },
27
31
  themeMode: themeMode,
28
32
  children: [/*#__PURE__*/_jsx(GlobalStyle, {}), children]
29
- }), /*#__PURE__*/_jsx(AntdV5MonkeyPatch, {})]
33
+ })
30
34
  });
31
35
  });
@@ -1,5 +1,6 @@
1
+ import { useOutlet } from "../../../example/.dumi/tmp/exports";
1
2
  import { useLocale, useLocation, useNavData, useRouteMeta, useSidebarData, useSiteData, useTabMeta } from 'dumi';
2
- import { memo, useMemo } from 'react';
3
+ import { memo } from 'react';
3
4
  import { StoreUpdater } from "../../components/StoreUpdater";
4
5
  import { Provider, createStore as _createStore } from "../../store";
5
6
  import DocumentLayout from "./DocumentLayout";
@@ -10,37 +11,40 @@ import StructuredData from "./Head/StructuredData";
10
11
  import ThemeProvider from "./ThemeProvider";
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
12
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
- var App = /*#__PURE__*/memo(function (_ref) {
14
- var initState = _ref.initState;
14
+ var DocProvider = /*#__PURE__*/memo(function (_ref) {
15
+ var children = _ref.children;
16
+ var siteData = useSiteData();
17
+ var sidebar = useSidebarData();
18
+ var routeMeta = useRouteMeta();
19
+ var tabMeta = useTabMeta();
20
+ var navData = useNavData();
21
+ var location = useLocation();
22
+ var locale = useLocale();
15
23
  return /*#__PURE__*/_jsxs(Provider, {
16
24
  createStore: function createStore() {
17
- return _createStore(initState);
25
+ return (
26
+ // @ts-ignore
27
+ _createStore({
28
+ locale: locale,
29
+ location: location,
30
+ navData: navData,
31
+ routeMeta: routeMeta,
32
+ sidebar: sidebar,
33
+ siteData: siteData,
34
+ tabMeta: tabMeta
35
+ })
36
+ );
18
37
  },
19
38
  children: [/*#__PURE__*/_jsx(Favicons, {}), /*#__PURE__*/_jsx(Og, {}), /*#__PURE__*/_jsx(Analytics, {}), /*#__PURE__*/_jsx(StructuredData, {}), /*#__PURE__*/_jsx(StoreUpdater, {}), /*#__PURE__*/_jsx(ThemeProvider, {
20
- children: /*#__PURE__*/_jsx(DocumentLayout, {})
39
+ children: /*#__PURE__*/_jsx(DocumentLayout, {
40
+ children: children
41
+ })
21
42
  })]
22
43
  });
23
44
  });
24
45
  export default /*#__PURE__*/memo(function () {
25
- var siteData = useSiteData();
26
- var sidebar = useSidebarData();
27
- var routeMeta = useRouteMeta();
28
- var tabMeta = useTabMeta();
29
- var navData = useNavData();
30
- var location = useLocation();
31
- var locale = useLocale();
32
- var initState = useMemo(function () {
33
- return {
34
- locale: locale,
35
- location: location,
36
- navData: navData,
37
- routeMeta: routeMeta,
38
- sidebar: sidebar,
39
- siteData: siteData,
40
- tabMeta: tabMeta
41
- };
42
- }, []);
43
- return /*#__PURE__*/_jsx(App, {
44
- initState: initState
46
+ var outlet = useOutlet();
47
+ return /*#__PURE__*/_jsx(DocProvider, {
48
+ children: outlet
45
49
  });
46
50
  });
@@ -1,3 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare const Changelog: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
2
+ declare const Changelog: import("react").NamedExoticComponent<{
3
+ children?: import("react").ReactNode;
4
+ }>;
3
5
  export default Changelog;
@@ -1,5 +1,4 @@
1
1
  import { useResponsive } from 'antd-style';
2
- import { useOutlet } from 'dumi';
3
2
  import isEqual from 'fast-deep-equal';
4
3
  import { memo, useEffect } from 'react';
5
4
  import { Center } from 'react-layout-kit';
@@ -9,8 +8,8 @@ import Content from "dumi/theme/slots/Content";
9
8
  import { siteSelectors, useSiteStore } from "../../store";
10
9
  import { jsx as _jsx } from "react/jsx-runtime";
11
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
- var Changelog = /*#__PURE__*/memo(function () {
13
- var outlet = useOutlet();
11
+ var Changelog = /*#__PURE__*/memo(function (_ref) {
12
+ var children = _ref.children;
14
13
  var _useResponsive = useResponsive(),
15
14
  mobile = _useResponsive.mobile;
16
15
  var repoBase = useSiteStore(siteSelectors.github);
@@ -38,7 +37,7 @@ var Changelog = /*#__PURE__*/memo(function () {
38
37
  title: fm.title
39
38
  }), /*#__PURE__*/_jsx(Content, {
40
39
  className: styles.changelog,
41
- children: outlet
40
+ children: children
42
41
  })]
43
42
  });
44
43
  });
@@ -1,3 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare const Documents: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
2
+ declare const Documents: import("react").NamedExoticComponent<{
3
+ children?: import("react").ReactNode;
4
+ }>;
3
5
  export default Documents;
@@ -1,6 +1,5 @@
1
1
  import { Giscus } from '@lobehub/ui/awesome';
2
2
  import { useResponsive } from 'antd-style';
3
- import { useOutlet } from 'dumi';
4
3
  import { memo, useCallback, useEffect } from 'react';
5
4
  import { Center } from 'react-layout-kit';
6
5
  import ApiHeader from "dumi/theme/slots/ApiHeader";
@@ -9,8 +8,8 @@ import { apiHeaderSelectors, siteSelectors, useSiteStore } from "../../store";
9
8
  import { useStyles } from "./styles";
10
9
  import { jsx as _jsx } from "react/jsx-runtime";
11
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
- var Documents = /*#__PURE__*/memo(function () {
13
- var outlet = useOutlet();
11
+ var Documents = /*#__PURE__*/memo(function (_ref) {
12
+ var children = _ref.children;
14
13
  var _useResponsive = useResponsive(),
15
14
  mobile = _useResponsive.mobile;
16
15
  var _useSiteStore = useSiteStore(function (s) {
@@ -54,7 +53,7 @@ var Documents = /*#__PURE__*/memo(function () {
54
53
  children: [isApiPage && /*#__PURE__*/_jsx(ApiHeader, {
55
54
  padding: mobile ? 16 : 0
56
55
  }), /*#__PURE__*/_jsxs(Content, {
57
- children: [outlet, giscus && /*#__PURE__*/_jsx(Comment, {})]
56
+ children: [children, giscus && /*#__PURE__*/_jsx(Comment, {})]
58
57
  })]
59
58
  });
60
59
  });
@@ -1,3 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare const Home: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
2
+ declare const Home: import("react").NamedExoticComponent<{
3
+ children?: import("react").ReactNode;
4
+ }>;
3
5
  export default Home;
@@ -1,12 +1,11 @@
1
- import { useOutlet } from 'dumi';
2
1
  import { memo, useEffect } from 'react';
3
2
  import { Flexbox } from 'react-layout-kit';
4
3
  import Features from "dumi/theme/slots/Features";
5
4
  import Hero from "dumi/theme/slots/Hero";
6
5
  import { jsx as _jsx } from "react/jsx-runtime";
7
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
- var Home = /*#__PURE__*/memo(function () {
9
- var outlet = useOutlet();
7
+ var Home = /*#__PURE__*/memo(function (_ref) {
8
+ var children = _ref.children;
10
9
  useEffect(function () {
11
10
  var _window, _document;
12
11
  (_window = window) === null || _window === void 0 || _window.scrollTo(0, 0);
@@ -19,7 +18,7 @@ var Home = /*#__PURE__*/memo(function () {
19
18
  minHeight: '64vh',
20
19
  padding: '64px 24px'
21
20
  },
22
- children: [/*#__PURE__*/_jsx(Hero, {}), /*#__PURE__*/_jsx(Features, {}), outlet]
21
+ children: [/*#__PURE__*/_jsx(Hero, {}), /*#__PURE__*/_jsx(Features, {}), children]
23
22
  });
24
23
  });
25
24
  export default Home;
@@ -55,7 +55,7 @@ export declare const siteSelectors: {
55
55
  } | undefined;
56
56
  siteDesc: (s: SiteStore) => string | undefined;
57
57
  siteTitle: (s: SiteStore) => string | undefined;
58
- themeConfig: (s: SiteStore) => import("dumi/dist/client/theme-api/types").IThemeConfig & import("../../types").SiteThemeConfig & Partial<import("../../types").SiteThemeConfig>;
58
+ themeConfig: (s: SiteStore) => Partial<import("../../types").SiteThemeConfig> & import("dumi/dist/client/theme-api/types").IThemeConfig & import("../../types").SiteThemeConfig;
59
59
  tocAnchorItem: (s: SiteStore) => AnchorItem[];
60
60
  token: (s: SiteStore) => any;
61
61
  };
@@ -7,7 +7,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
7
7
  import { merge } from 'lodash-es';
8
8
  import { initialThemeConfig } from "../initialState";
9
9
  var themeConfig = function themeConfig(s) {
10
- return merge(s.siteData.themeConfig, initialThemeConfig);
10
+ return merge(initialThemeConfig, s.siteData.themeConfig);
11
11
  };
12
12
  var siteTitle = function siteTitle(s) {
13
13
  return themeConfig(s).title;
@@ -19,7 +19,7 @@ export interface SiteStore {
19
19
  siteData: ISiteData;
20
20
  tabMeta?: NonNullable<IRouteMeta['tabs']>[0]['meta'];
21
21
  }
22
- export declare const createStore: (initState: SiteStore) => import("zustand/traditional").UseBoundStoreWithEqualityFn<Omit<StoreApi<SiteStore>, "setState"> & {
22
+ export declare const createStore: (initState: SiteStore) => import("zustand/traditional").UseBoundStoreWithEqualityFn<Omit<StoreApi<SiteStore>, "setState" | "devtools"> & {
23
23
  setState(partial: SiteStore | Partial<SiteStore> | ((state: SiteStore) => SiteStore | Partial<SiteStore>), replace?: false | undefined, action?: (string | {
24
24
  [x: string]: unknown;
25
25
  [x: number]: unknown;
@@ -32,6 +32,9 @@ export declare const createStore: (initState: SiteStore) => import("zustand/trad
32
32
  [x: symbol]: unknown;
33
33
  type: string;
34
34
  }) | undefined): void;
35
+ devtools: {
36
+ cleanup: () => void;
37
+ };
35
38
  }>;
36
39
  declare const useStore: import("zustand-utils").UseContextStore<StoreApi<SiteStore>>, useStoreApi: () => {
37
40
  setState: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dumi-theme-lobehub",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
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",
@@ -25,10 +25,10 @@
25
25
  "dist"
26
26
  ],
27
27
  "dependencies": {
28
- "@floating-ui/react": "^0.27.5",
28
+ "@floating-ui/react": "^0.27.15",
29
29
  "@giscus/react": "^3.1.0",
30
- "@lobehub/ui": "^2.0.0",
31
- "ahooks": "^3.8.4",
30
+ "@lobehub/ui": "^2.9.4",
31
+ "ahooks": "^3.9.3",
32
32
  "animated-scroll-to": "^2.3.2",
33
33
  "antd-style": "^3.7.1",
34
34
  "chalk": "^4.1.2",
@@ -37,11 +37,11 @@
37
37
  "lucide-react": "^0.469.0",
38
38
  "polished": "^4.3.1",
39
39
  "rc-footer": "^0.6.8",
40
- "react-layout-kit": "^1.9.1",
41
- "swr": "^2.3.3",
40
+ "react-layout-kit": "^1.9.2",
41
+ "swr": "^2.3.6",
42
42
  "url-join": "^5.0.0",
43
43
  "use-merge-value": "^1.2.0",
44
- "zustand": "^5.0.3",
44
+ "zustand": "^5.0.7",
45
45
  "zustand-utils": "^1.3.2"
46
46
  },
47
47
  "peerDependencies": {