dumi-theme-lobehub 1.8.0 → 1.8.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/dist/components/ApiHeader/index.d.ts +1 -1
- package/dist/components/ApiHeader/index.js +15 -3
- package/dist/components/StoreUpdater/index.d.ts +2 -1
- package/dist/components/StoreUpdater/index.js +29 -21
- package/dist/components/StoreUpdater/useRouteMeta.d.ts +1 -0
- package/dist/components/StoreUpdater/useRouteMeta.js +33 -0
- package/dist/layouts/DocLayout/DocumentLayout.js +1 -2
- package/dist/layouts/DocLayout/ThemeProvider.d.ts +5 -0
- package/dist/layouts/DocLayout/ThemeProvider.js +22 -0
- package/dist/layouts/DocLayout/index.d.ts +2 -2
- package/dist/layouts/DocLayout/index.js +35 -20
- package/dist/pages/Changelog/index.js +13 -26
- package/dist/pages/Docs/index.js +11 -21
- package/dist/pages/Docs/styles.d.ts +0 -1
- package/dist/pages/Docs/styles.js +5 -8
- package/dist/plugin/index.js +3 -2
- package/dist/slots/ApiHeader/index.d.ts +2 -1
- package/dist/slots/ApiHeader/index.js +5 -3
- package/dist/slots/Content/index.js +3 -3
- package/dist/slots/Features/index.d.ts +1 -1
- package/dist/slots/Footer/columns.js +20 -20
- package/dist/slots/Footer/index.d.ts +1 -1
- package/dist/slots/Footer/index.js +1 -2
- package/dist/slots/Header/Burger.js +1 -2
- package/dist/slots/Header/DiscordButton.d.ts +1 -1
- package/dist/slots/Header/GithubButton.d.ts +1 -1
- package/dist/slots/Header/LangSwitch.d.ts +1 -1
- package/dist/slots/Header/index.d.ts +1 -1
- package/dist/slots/Loading/index.d.ts +3 -0
- package/dist/slots/Loading/index.js +28 -0
- package/dist/slots/Navbar/index.js +8 -8
- package/dist/slots/SearchBar/index.js +2 -1
- package/dist/slots/Sidebar/index.d.ts +1 -1
- package/dist/slots/Toc/index.d.ts +1 -1
- package/dist/store/index.d.ts +14 -3
- package/dist/store/index.js +13 -1
- package/dist/store/selectors/hero.d.ts +17 -0
- package/dist/store/selectors/hero.js +49 -9
- package/dist/store/selectors/siteBasicInfo.d.ts +9 -9
- package/dist/store/selectors/siteBasicInfo.js +10 -0
- package/dist/store/useSiteStore.d.ts +36 -3
- package/dist/store/useSiteStore.js +15 -8
- package/dist/store/useThemeStore.d.ts +7 -6
- package/dist/store/useThemeStore.js +5 -4
- package/package.json +11 -10
|
@@ -60,4 +60,4 @@ export interface ServiceItem {
|
|
|
60
60
|
*/
|
|
61
61
|
url: string;
|
|
62
62
|
}
|
|
63
|
-
export declare const ApiHeader: import("react").NamedExoticComponent<ApiTitleProps>;
|
|
63
|
+
export declare const ApiHeader: import("react").NamedExoticComponent<ApiTitleProps & import("react-layout-kit/lib/FlexBasic").FlexBasicProps & import("react-layout-kit").CommonProps>;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["title", "type", "componentName", "description", "defaultImport", "pkg", "sourceUrl", "docUrl", "serviceList"];
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
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
|
+
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; }
|
|
1
10
|
import { Icon, Markdown, Snippet } from '@lobehub/ui';
|
|
2
11
|
import { Divider, Space, Typography } from 'antd';
|
|
3
12
|
import { useResponsive } from 'antd-style';
|
|
@@ -27,7 +36,8 @@ export var ApiHeader = /*#__PURE__*/memo(function (_ref) {
|
|
|
27
36
|
sourceUrl = _ref.sourceUrl,
|
|
28
37
|
docUrl = _ref.docUrl,
|
|
29
38
|
_ref$serviceList = _ref.serviceList,
|
|
30
|
-
serviceList = _ref$serviceList === void 0 ? [] : _ref$serviceList
|
|
39
|
+
serviceList = _ref$serviceList === void 0 ? [] : _ref$serviceList,
|
|
40
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
31
41
|
var _useStyles = useStyles(),
|
|
32
42
|
styles = _useStyles.styles;
|
|
33
43
|
var _useResponsive = useResponsive(),
|
|
@@ -47,11 +57,13 @@ export var ApiHeader = /*#__PURE__*/memo(function (_ref) {
|
|
|
47
57
|
url: docUrl
|
|
48
58
|
}].filter(Boolean);
|
|
49
59
|
var importString = defaultImport ? "import ".concat(componentName, " from '").concat(pkg, "';") : "import { ".concat(componentName, " } from '").concat(pkg, "';");
|
|
50
|
-
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
60
|
+
return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
|
|
51
61
|
id: 'api-header',
|
|
52
62
|
style: {
|
|
53
63
|
marginBottom: 24
|
|
54
64
|
},
|
|
65
|
+
width: '100%'
|
|
66
|
+
}, rest), {}, {
|
|
55
67
|
children: [/*#__PURE__*/_jsx(Typography.Title, {
|
|
56
68
|
className: styles.title,
|
|
57
69
|
children: title
|
|
@@ -122,5 +134,5 @@ export var ApiHeader = /*#__PURE__*/memo(function (_ref) {
|
|
|
122
134
|
})]
|
|
123
135
|
})]
|
|
124
136
|
})]
|
|
125
|
-
});
|
|
137
|
+
}));
|
|
126
138
|
});
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const StoreUpdater: React.MemoExoticComponent<() => null>;
|
|
@@ -13,10 +13,11 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
13
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
14
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
15
|
import { useDebounceEffect } from 'ahooks';
|
|
16
|
-
import { useLocale, useLocation, useNavData,
|
|
16
|
+
import { useLocale, useLocation, useNavData, useSidebarData, useSiteData, useTabMeta } from 'dumi';
|
|
17
17
|
import isEqual from 'fast-deep-equal';
|
|
18
|
-
import React, { useEffect } from 'react';
|
|
19
|
-
import {
|
|
18
|
+
import React, { memo, useEffect } from 'react';
|
|
19
|
+
import { useStoreApi } from "../../store/useSiteStore";
|
|
20
|
+
import { useRouteMeta } from "./useRouteMeta";
|
|
20
21
|
var isBrowser = typeof window !== 'undefined';
|
|
21
22
|
var SSRInit = {};
|
|
22
23
|
var useReact18xUpdater = function useReact18xUpdater(effect, deps) {
|
|
@@ -36,8 +37,9 @@ var useLegacyUpdater = function useLegacyUpdater(effect, deps) {
|
|
|
36
37
|
};
|
|
37
38
|
var useUpdater = typeof React.startTransition === 'function' ? useReact18xUpdater : useLegacyUpdater;
|
|
38
39
|
var useSyncState = function useSyncState(key, value, updateMethod) {
|
|
40
|
+
var storeApi = useStoreApi();
|
|
39
41
|
var updater = updateMethod ? updateMethod : function (key, value) {
|
|
40
|
-
return
|
|
42
|
+
return storeApi.setState(_defineProperty({}, key, value));
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
// 如果是 Node 环境,直接更新一次 store
|
|
@@ -50,42 +52,48 @@ var useSyncState = function useSyncState(key, value, updateMethod) {
|
|
|
50
52
|
updater(key, value);
|
|
51
53
|
}, [value]);
|
|
52
54
|
};
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
title: 'Home'
|
|
55
|
+
var displayLangHomeNavMap = {
|
|
56
|
+
'en-US': 'Home',
|
|
57
|
+
'zh-CN': '首页'
|
|
57
58
|
};
|
|
58
|
-
|
|
59
|
+
var getHomeNav = function getHomeNav(id) {
|
|
60
|
+
return {
|
|
61
|
+
activePath: '/',
|
|
62
|
+
link: '/',
|
|
63
|
+
title: displayLangHomeNavMap[id]
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export var StoreUpdater = /*#__PURE__*/memo(function () {
|
|
59
67
|
var siteData = useSiteData();
|
|
60
68
|
var sidebar = useSidebarData();
|
|
61
|
-
var routeMeta = useRouteMeta();
|
|
62
69
|
var tabMeta = useTabMeta();
|
|
63
70
|
var navData = useNavData();
|
|
64
71
|
var location = useLocation();
|
|
65
72
|
var locale = useLocale();
|
|
73
|
+
var storeApi = useStoreApi();
|
|
74
|
+
useRouteMeta();
|
|
66
75
|
useSyncState('siteData', siteData, function () {
|
|
67
76
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
68
77
|
var setLoading = siteData.setLoading,
|
|
69
78
|
data = _objectWithoutProperties(siteData, _excluded);
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
_ =
|
|
73
|
-
|
|
74
|
-
if (isEqual(data,
|
|
75
|
-
|
|
79
|
+
var _storeApi$getState = storeApi.getState(),
|
|
80
|
+
_storeApi$getState$si = _storeApi$getState.siteData,
|
|
81
|
+
_ = _storeApi$getState$si.setLoading,
|
|
82
|
+
prevData = _objectWithoutProperties(_storeApi$getState$si, _excluded2);
|
|
83
|
+
if (isEqual(data, prevData)) return;
|
|
84
|
+
storeApi.setState({
|
|
76
85
|
siteData: siteData
|
|
77
86
|
});
|
|
78
87
|
});
|
|
79
88
|
useSyncState('sidebar', sidebar);
|
|
80
|
-
useSyncState('routeMeta', routeMeta);
|
|
81
89
|
useSyncState('location', location);
|
|
82
90
|
useSyncState('tabMeta', tabMeta);
|
|
83
91
|
useSyncState('locale', locale);
|
|
84
92
|
useSyncState('navData', navData, function () {
|
|
85
|
-
var data = siteData.themeConfig.hideHomeNav ? navData : [
|
|
86
|
-
|
|
93
|
+
var data = siteData.themeConfig.hideHomeNav ? navData : [getHomeNav(locale.id)].concat(_toConsumableArray(navData));
|
|
94
|
+
storeApi.setState({
|
|
87
95
|
navData: data
|
|
88
96
|
});
|
|
89
97
|
});
|
|
90
|
-
return
|
|
91
|
-
};
|
|
98
|
+
return null;
|
|
99
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useRouteMeta: () => void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getRouteMetaById, useMatchedRoute } from 'dumi';
|
|
2
|
+
import useSWR from 'swr';
|
|
3
|
+
import { useStoreApi } from "../../store/useSiteStore";
|
|
4
|
+
var EMPTY_META = {
|
|
5
|
+
frontmatter: {},
|
|
6
|
+
texts: [],
|
|
7
|
+
toc: []
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// https://github.com/umijs/dumi/pull/2165
|
|
11
|
+
export var useRouteMeta = function useRouteMeta() {
|
|
12
|
+
var storeApi = useStoreApi();
|
|
13
|
+
var matched = useMatchedRoute();
|
|
14
|
+
var merge = function merge() {
|
|
15
|
+
var meta = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : EMPTY_META;
|
|
16
|
+
if (matched.meta) {
|
|
17
|
+
for (var _i = 0, _Object$keys = Object.keys(matched.meta); _i < _Object$keys.length; _i++) {
|
|
18
|
+
var _ref, _ref$key;
|
|
19
|
+
var key = _Object$keys[_i];
|
|
20
|
+
(_ref$key = (_ref = meta)[key]) !== null && _ref$key !== void 0 ? _ref$key : _ref[key] = matched.meta[key];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return meta;
|
|
24
|
+
};
|
|
25
|
+
useSWR(matched.id, getRouteMetaById, {
|
|
26
|
+
fallback: EMPTY_META,
|
|
27
|
+
onSuccess: function onSuccess(meta) {
|
|
28
|
+
storeApi.setState({
|
|
29
|
+
routeMeta: merge(meta)
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
@@ -3,7 +3,6 @@ import { useResponsive, useTheme } from 'antd-style';
|
|
|
3
3
|
import { Helmet, useIntl, useLocation } from 'dumi';
|
|
4
4
|
import isEqual from 'fast-deep-equal';
|
|
5
5
|
import { memo, useCallback, useEffect } from 'react';
|
|
6
|
-
import { shallow } from 'zustand/shallow';
|
|
7
6
|
import Changelog from "../../pages/Changelog";
|
|
8
7
|
import Docs from "../../pages/Docs";
|
|
9
8
|
import Home from "../../pages/Home";
|
|
@@ -40,7 +39,7 @@ var DocumentLayout = /*#__PURE__*/memo(function () {
|
|
|
40
39
|
page: page,
|
|
41
40
|
siteTitle: siteTitleSel(s)
|
|
42
41
|
};
|
|
43
|
-
}
|
|
42
|
+
}),
|
|
44
43
|
loading = _useSiteStore.loading,
|
|
45
44
|
page = _useSiteStore.page,
|
|
46
45
|
siteTitle = _useSiteStore.siteTitle,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ThemeProvider } from '@lobehub/ui';
|
|
2
|
+
import isEqual from 'fast-deep-equal';
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import GlobalStyle from "./GlobalStyle";
|
|
5
|
+
import { siteSelectors, useSiteStore, useThemeStore } from "../../store";
|
|
6
|
+
import _customToken from "../../styles/customToken";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
export default /*#__PURE__*/memo(function (_ref) {
|
|
10
|
+
var children = _ref.children;
|
|
11
|
+
var themeMode = useThemeStore(function (st) {
|
|
12
|
+
return st.themeMode;
|
|
13
|
+
});
|
|
14
|
+
var userToken = useSiteStore(siteSelectors.token, isEqual);
|
|
15
|
+
return /*#__PURE__*/_jsxs(ThemeProvider, {
|
|
16
|
+
customToken: function customToken(themeToken) {
|
|
17
|
+
return Object.assign({}, _customToken(themeToken), userToken);
|
|
18
|
+
},
|
|
19
|
+
themeMode: themeMode,
|
|
20
|
+
children: [/*#__PURE__*/_jsx(GlobalStyle, {}), children]
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const _default: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
export default _default;
|
|
@@ -1,28 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
import { shallow } from 'zustand/shallow';
|
|
1
|
+
import { useLocale, useLocation, useNavData, useRouteMeta, useSidebarData, useSiteData, useTabMeta } from 'dumi';
|
|
2
|
+
import { memo, useMemo } from 'react';
|
|
4
3
|
import Favicons from "../../components/Favicons";
|
|
5
4
|
import { StoreUpdater } from "../../components/StoreUpdater";
|
|
6
|
-
import
|
|
7
|
-
import { siteSelectors, useSiteStore, useThemeStore } from "../../store";
|
|
8
|
-
import _customToken from "../../styles/customToken";
|
|
5
|
+
import { Provider, createStore as _createStore } from "../../store";
|
|
9
6
|
import DocumentLayout from "./DocumentLayout";
|
|
7
|
+
import ThemeProvider from "./ThemeProvider";
|
|
10
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
customToken: function customToken(themeToken) {
|
|
21
|
-
return Object.assign({}, _customToken(themeToken), userToken);
|
|
22
|
-
},
|
|
23
|
-
themeMode: themeMode,
|
|
24
|
-
children: [/*#__PURE__*/_jsx(GlobalStyle, {}), /*#__PURE__*/_jsx(DocumentLayout, {})]
|
|
10
|
+
var App = /*#__PURE__*/memo(function (_ref) {
|
|
11
|
+
var initState = _ref.initState;
|
|
12
|
+
return /*#__PURE__*/_jsxs(Provider, {
|
|
13
|
+
createStore: function createStore() {
|
|
14
|
+
return _createStore(initState);
|
|
15
|
+
},
|
|
16
|
+
children: [/*#__PURE__*/_jsx(Favicons, {}), /*#__PURE__*/_jsx(StoreUpdater, {}), /*#__PURE__*/_jsx(ThemeProvider, {
|
|
17
|
+
children: /*#__PURE__*/_jsx(DocumentLayout, {})
|
|
25
18
|
})]
|
|
26
19
|
});
|
|
27
20
|
});
|
|
28
|
-
export default
|
|
21
|
+
export default /*#__PURE__*/memo(function () {
|
|
22
|
+
var siteData = useSiteData();
|
|
23
|
+
var sidebar = useSidebarData();
|
|
24
|
+
var routeMeta = useRouteMeta();
|
|
25
|
+
var tabMeta = useTabMeta();
|
|
26
|
+
var navData = useNavData();
|
|
27
|
+
var location = useLocation();
|
|
28
|
+
var locale = useLocale();
|
|
29
|
+
var initState = useMemo(function () {
|
|
30
|
+
return {
|
|
31
|
+
locale: locale,
|
|
32
|
+
location: location,
|
|
33
|
+
navData: navData,
|
|
34
|
+
routeMeta: routeMeta,
|
|
35
|
+
sidebar: sidebar,
|
|
36
|
+
siteData: siteData,
|
|
37
|
+
tabMeta: tabMeta
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
return /*#__PURE__*/_jsx(App, {
|
|
41
|
+
initState: initState
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -3,14 +3,12 @@ import { useOutlet } from 'dumi';
|
|
|
3
3
|
import isEqual from 'fast-deep-equal';
|
|
4
4
|
import { memo, useEffect } from 'react';
|
|
5
5
|
import { Center } from 'react-layout-kit';
|
|
6
|
-
import { shallow } from 'zustand/shallow';
|
|
7
6
|
import { ApiHeader } from "../../components/ApiHeader";
|
|
8
7
|
import { useStyles } from "../Docs/styles";
|
|
9
8
|
import Content from "dumi/theme/slots/Content";
|
|
10
9
|
import { githubSel, useSiteStore } from "../../store";
|
|
11
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
12
|
var Changelog = /*#__PURE__*/memo(function () {
|
|
15
13
|
var outlet = useOutlet();
|
|
16
14
|
var _useResponsive = useResponsive(),
|
|
@@ -19,7 +17,7 @@ var Changelog = /*#__PURE__*/memo(function () {
|
|
|
19
17
|
return {
|
|
20
18
|
repoBase: githubSel(s)
|
|
21
19
|
};
|
|
22
|
-
}
|
|
20
|
+
}),
|
|
23
21
|
repoBase = _useSiteStore.repoBase;
|
|
24
22
|
var _useSiteStore2 = useSiteStore(function (s) {
|
|
25
23
|
return {
|
|
@@ -33,29 +31,18 @@ var Changelog = /*#__PURE__*/memo(function () {
|
|
|
33
31
|
window.scrollTo(0, 0);
|
|
34
32
|
document.body.scrollTo(0, 0);
|
|
35
33
|
}, []);
|
|
36
|
-
return /*#__PURE__*/_jsxs(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
children: /*#__PURE__*/_jsx(ApiHeader, {
|
|
50
|
-
description: fm.description,
|
|
51
|
-
docUrl: "".concat(repoBase, "/blob/master/CHANGELOG.md"),
|
|
52
|
-
sourceUrl: "".concat(repoBase, "/blob/master/CHANGELOG.md"),
|
|
53
|
-
title: fm.title
|
|
54
|
-
})
|
|
55
|
-
}), /*#__PURE__*/_jsx(Content, {
|
|
56
|
-
className: styles.changelog,
|
|
57
|
-
children: outlet
|
|
58
|
-
})]
|
|
34
|
+
return /*#__PURE__*/_jsxs(Center, {
|
|
35
|
+
className: styles.content,
|
|
36
|
+
padding: mobile ? 0 : 24,
|
|
37
|
+
children: [/*#__PURE__*/_jsx(ApiHeader, {
|
|
38
|
+
description: fm.description,
|
|
39
|
+
docUrl: "".concat(repoBase, "/blob/master/CHANGELOG.md"),
|
|
40
|
+
padding: mobile ? 16 : 0,
|
|
41
|
+
sourceUrl: "".concat(repoBase, "/blob/master/CHANGELOG.md"),
|
|
42
|
+
title: fm.title
|
|
43
|
+
}), /*#__PURE__*/_jsx(Content, {
|
|
44
|
+
className: styles.changelog,
|
|
45
|
+
children: outlet
|
|
59
46
|
})]
|
|
60
47
|
});
|
|
61
48
|
});
|
package/dist/pages/Docs/index.js
CHANGED
|
@@ -3,14 +3,12 @@ import { useResponsive } from 'antd-style';
|
|
|
3
3
|
import { useOutlet } from 'dumi';
|
|
4
4
|
import { memo, useCallback, useEffect } from 'react';
|
|
5
5
|
import { Center } from 'react-layout-kit';
|
|
6
|
-
import { shallow } from 'zustand/shallow';
|
|
7
6
|
import ApiHeader from "dumi/theme/slots/ApiHeader";
|
|
8
7
|
import Content from "dumi/theme/slots/Content";
|
|
9
8
|
import { giscusSel, isApiPageSel, useSiteStore } from "../../store";
|
|
10
9
|
import { useStyles } from "./styles";
|
|
11
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
12
|
var Documents = /*#__PURE__*/memo(function () {
|
|
15
13
|
var outlet = useOutlet();
|
|
16
14
|
var _useResponsive = useResponsive(),
|
|
@@ -20,7 +18,7 @@ var Documents = /*#__PURE__*/memo(function () {
|
|
|
20
18
|
giscus: giscusSel(st),
|
|
21
19
|
isApiPage: isApiPageSel(st)
|
|
22
20
|
};
|
|
23
|
-
}
|
|
21
|
+
}),
|
|
24
22
|
isApiPage = _useSiteStore.isApiPage,
|
|
25
23
|
giscus = _useSiteStore.giscus;
|
|
26
24
|
var _useStyles = useStyles(),
|
|
@@ -44,24 +42,16 @@ var Documents = /*#__PURE__*/memo(function () {
|
|
|
44
42
|
})
|
|
45
43
|
});
|
|
46
44
|
}, [giscus, location.pathname]);
|
|
47
|
-
return /*#__PURE__*/_jsxs(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
children: [
|
|
57
|
-
style: {
|
|
58
|
-
padding: mobile ? 16 : 0,
|
|
59
|
-
width: '100%'
|
|
60
|
-
},
|
|
61
|
-
children: /*#__PURE__*/_jsx(ApiHeader, {})
|
|
62
|
-
}) : undefined, /*#__PURE__*/_jsxs(Content, {
|
|
63
|
-
children: [outlet, giscus && /*#__PURE__*/_jsx(Comment, {})]
|
|
64
|
-
})]
|
|
45
|
+
return /*#__PURE__*/_jsxs(Center, {
|
|
46
|
+
className: styles.content,
|
|
47
|
+
style: {
|
|
48
|
+
marginBottom: 48,
|
|
49
|
+
padding: mobile ? 0 : 24
|
|
50
|
+
},
|
|
51
|
+
children: [isApiPage && /*#__PURE__*/_jsx(ApiHeader, {
|
|
52
|
+
padding: mobile ? 16 : 0
|
|
53
|
+
}), /*#__PURE__*/_jsxs(Content, {
|
|
54
|
+
children: [outlet, giscus && /*#__PURE__*/_jsx(Comment, {})]
|
|
65
55
|
})]
|
|
66
56
|
});
|
|
67
57
|
});
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
var _templateObject, _templateObject2
|
|
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
4
|
export var useStyles = createStyles(function (_ref) {
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
token = _ref.token,
|
|
8
|
-
stylish = _ref.stylish;
|
|
5
|
+
var css = _ref.css,
|
|
6
|
+
token = _ref.token;
|
|
9
7
|
return {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
content: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n max-width: ", "px;\n margin: 0 auto;\n "])), token.contentMaxWidth)
|
|
8
|
+
changelog: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .markdown {\n font-size: 16px;\n\n h1 {\n display: none;\n }\n\n h2,\n h3 {\n margin-bottom: 0;\n font-size: 28px;\n }\n\n sup {\n color: ", ";\n }\n\n details {\n font-size: 14px;\n }\n\n summary > kbd {\n margin-left: 6px;\n padding: unset;\n\n font-size: inherit;\n line-height: inherit;\n\n background: unset;\n border: unset;\n }\n\n a[href='/changelog#readme-top'] {\n display: block;\n margin-bottom: 32px;\n padding-bottom: 32px;\n border-bottom: 1px solid ", ";\n\n > img {\n display: none;\n }\n }\n }\n "])), token.colorTextDescription, token.colorBorderSecondary),
|
|
9
|
+
content: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 100%;\n max-width: ", "px;\n margin: 0 auto;\n "])), token.contentMaxWidth)
|
|
13
10
|
};
|
|
14
11
|
});
|
package/dist/plugin/index.js
CHANGED
|
@@ -41,7 +41,8 @@ var SSRPlugin = (api) => {
|
|
|
41
41
|
api.describe({
|
|
42
42
|
key: "@"
|
|
43
43
|
});
|
|
44
|
-
if (!api.userConfig.ssr)
|
|
44
|
+
if (!api.userConfig.ssr)
|
|
45
|
+
return;
|
|
45
46
|
api.logger.info("detect ssr config, when building html will extract css.");
|
|
46
47
|
const writeCSSFile = (key, hashKey, cssString) => {
|
|
47
48
|
const fileName = `ssr-${key}.${(0, import_utils.getHash)(hashKey)}.css`;
|
|
@@ -58,7 +59,7 @@ var SSRPlugin = (api) => {
|
|
|
58
59
|
};
|
|
59
60
|
api.modifyExportHTMLFiles(
|
|
60
61
|
(files) => files.filter((f) => !f.path.includes(":")).map((file) => {
|
|
61
|
-
const antdCache = global.
|
|
62
|
+
const antdCache = global.__LOBE_CACHE__;
|
|
62
63
|
const styles = (0, import_antd_style.extractStaticStyle)(file.content, { antdCache });
|
|
63
64
|
for (const result of styles) {
|
|
64
65
|
api.logger.event(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { FlexboxProps } from 'react-layout-kit';
|
|
3
|
+
declare const ApiHeader: import("react").NamedExoticComponent<FlexboxProps>;
|
|
3
4
|
export default ApiHeader;
|
|
@@ -4,6 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
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
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
7
8
|
import isEqual from 'fast-deep-equal';
|
|
8
9
|
import { memo, useMemo } from 'react';
|
|
9
10
|
import { ApiHeader as Header } from "../../components/ApiHeader";
|
|
@@ -14,7 +15,8 @@ import NpmFilled from "./NpmFilled";
|
|
|
14
15
|
import PackagePhobia from "./PackagePhobia";
|
|
15
16
|
import Unpkg from "./Unpkg";
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
var ApiHeader = /*#__PURE__*/memo(function () {
|
|
18
|
+
var ApiHeader = /*#__PURE__*/memo(function (_ref) {
|
|
19
|
+
var rest = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
18
20
|
var props = useSiteStore(apiHeaderSel, isEqual);
|
|
19
21
|
var pkg = props.pkg;
|
|
20
22
|
var packages = useMemo(function () {
|
|
@@ -46,8 +48,8 @@ var ApiHeader = /*#__PURE__*/memo(function () {
|
|
|
46
48
|
url: "https://npm.anvaka.com/#/view/2d/".concat(encodeURIComponent(packageURL))
|
|
47
49
|
}];
|
|
48
50
|
}, [pkg]);
|
|
49
|
-
return /*#__PURE__*/_jsx(Header, _objectSpread({
|
|
51
|
+
return /*#__PURE__*/_jsx(Header, _objectSpread(_objectSpread({
|
|
50
52
|
serviceList: packages
|
|
51
|
-
}, props));
|
|
53
|
+
}, props), rest));
|
|
52
54
|
});
|
|
53
55
|
export default ApiHeader;
|
|
@@ -27,8 +27,7 @@ var Content = /*#__PURE__*/memo(function (_ref) {
|
|
|
27
27
|
var _useSiteStore = useSiteStore(themeConfig, isEqual),
|
|
28
28
|
docStyle = _useSiteStore.docStyle;
|
|
29
29
|
var _useStyles = useStyles(docStyle === 'pure'),
|
|
30
|
-
styles = _useStyles.styles
|
|
31
|
-
cx = _useStyles.cx;
|
|
30
|
+
styles = _useStyles.styles;
|
|
32
31
|
var _useResponsive = useResponsive(),
|
|
33
32
|
mobile = _useResponsive.mobile;
|
|
34
33
|
useEffect(function () {
|
|
@@ -39,12 +38,13 @@ var Content = /*#__PURE__*/memo(function (_ref) {
|
|
|
39
38
|
width: '100%'
|
|
40
39
|
}, props), {}, {
|
|
41
40
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
42
|
-
className:
|
|
41
|
+
className: styles.content,
|
|
43
42
|
children: [/*#__PURE__*/_jsx(Skeleton, {
|
|
44
43
|
active: true,
|
|
45
44
|
loading: loading,
|
|
46
45
|
paragraph: true
|
|
47
46
|
}), /*#__PURE__*/_jsx(Typography, {
|
|
47
|
+
headerMultiple: 0.5,
|
|
48
48
|
style: {
|
|
49
49
|
display: loading ? 'none' : undefined
|
|
50
50
|
},
|
|
@@ -11,15 +11,20 @@ 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: 'AI / LLM Icon Collection',
|
|
15
15
|
openExternal: true,
|
|
16
|
-
title: 'Lobe
|
|
17
|
-
url: 'https://github.com/lobehub/lobe-
|
|
16
|
+
title: 'Lobe Icon',
|
|
17
|
+
url: 'https://github.com/lobehub/lobe-icons'
|
|
18
|
+
}, {
|
|
19
|
+
description: 'Modern Charts',
|
|
20
|
+
openExternal: true,
|
|
21
|
+
title: 'Lobe Charts',
|
|
22
|
+
url: 'https://github.com/lobehub/lobe-charts'
|
|
18
23
|
}, {
|
|
19
|
-
description: '
|
|
24
|
+
description: 'TTS/STT Library',
|
|
20
25
|
openExternal: true,
|
|
21
|
-
title: '
|
|
22
|
-
url: 'https://github.com/lobehub/lobe-
|
|
26
|
+
title: 'Lobe TTS',
|
|
27
|
+
url: 'https://github.com/lobehub/lobe-tts'
|
|
23
28
|
}],
|
|
24
29
|
title: 'Resources'
|
|
25
30
|
};
|
|
@@ -65,27 +70,22 @@ export var getColumns = function getColumns(_ref) {
|
|
|
65
70
|
};
|
|
66
71
|
var more = {
|
|
67
72
|
items: [{
|
|
68
|
-
description: '
|
|
73
|
+
description: 'AI/LLM Chat Framework',
|
|
69
74
|
openExternal: true,
|
|
70
|
-
title: '
|
|
75
|
+
title: '🤯 Lobe Chat',
|
|
71
76
|
url: 'https://github.com/lobehub/lobe-chat'
|
|
72
77
|
}, {
|
|
73
|
-
description: '
|
|
74
|
-
openExternal: true,
|
|
75
|
-
title: '🤯 Lobe Theme',
|
|
76
|
-
url: 'https://github.com/lobehub/sd-webui-lobe-theme'
|
|
77
|
-
}, {
|
|
78
|
-
description: 'Gen intelligently',
|
|
78
|
+
description: 'Virtual Idols for EveryOne',
|
|
79
79
|
openExternal: true,
|
|
80
|
-
title: '
|
|
81
|
-
url: 'https://
|
|
80
|
+
title: '🧸 Lobe Vidol',
|
|
81
|
+
url: 'https://github.com/lobehub/lobe-vidol'
|
|
82
82
|
}, {
|
|
83
|
-
description: '
|
|
83
|
+
description: 'Stable Diffusion Extension',
|
|
84
84
|
openExternal: true,
|
|
85
|
-
title: '
|
|
86
|
-
url: 'https://github.com/lobehub/lobe-
|
|
85
|
+
title: '🅰️ Lobe Theme',
|
|
86
|
+
url: 'https://github.com/lobehub/sd-webui-lobe-theme'
|
|
87
87
|
}, {
|
|
88
|
-
description: 'AI
|
|
88
|
+
description: 'AI i18next CLI',
|
|
89
89
|
openExternal: true,
|
|
90
90
|
title: '🌐 Lobe i18n',
|
|
91
91
|
url: 'https://github.com/lobehub/lobe-commit'
|
|
@@ -4,7 +4,6 @@ import { useResponsive } from 'antd-style';
|
|
|
4
4
|
import isEqual from 'fast-deep-equal';
|
|
5
5
|
import { memo } from 'react';
|
|
6
6
|
import { Center, Flexbox } from 'react-layout-kit';
|
|
7
|
-
import { shallow } from 'zustand/shallow';
|
|
8
7
|
import { githubSel, useSiteStore } from "../../store";
|
|
9
8
|
import { getColumns } from "./columns";
|
|
10
9
|
import { useStyles } from "./style";
|
|
@@ -18,7 +17,7 @@ var Footer = /*#__PURE__*/memo(function () {
|
|
|
18
17
|
pkg = _useSiteStore.pkg;
|
|
19
18
|
var footerConfig = themeConfig.footerConfig,
|
|
20
19
|
footer = themeConfig.footer;
|
|
21
|
-
var githubUrl = useSiteStore(githubSel
|
|
20
|
+
var githubUrl = useSiteStore(githubSel);
|
|
22
21
|
var _useStyles = useStyles(),
|
|
23
22
|
styles = _useStyles.styles,
|
|
24
23
|
theme = _useStyles.theme;
|
|
@@ -9,7 +9,6 @@ import { Link } from 'dumi';
|
|
|
9
9
|
import isEqual from 'fast-deep-equal';
|
|
10
10
|
import { uniq } from 'lodash-es';
|
|
11
11
|
import { memo, useMemo, useState } from 'react';
|
|
12
|
-
import { shallow } from 'zustand/shallow';
|
|
13
12
|
import { activePathSel, useSiteStore } from "../../store";
|
|
14
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
14
|
var Burger = /*#__PURE__*/memo(function () {
|
|
@@ -28,7 +27,7 @@ var Burger = /*#__PURE__*/memo(function () {
|
|
|
28
27
|
activePath: activePathSel(s),
|
|
29
28
|
pathname: s.location.pathname
|
|
30
29
|
};
|
|
31
|
-
}
|
|
30
|
+
}),
|
|
32
31
|
pathname = _useSiteStore.pathname,
|
|
33
32
|
activePath = _useSiteStore.activePath;
|
|
34
33
|
var items = useMemo(function () {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Icon } from '@lobehub/ui';
|
|
2
|
+
import { Typography } from 'antd';
|
|
3
|
+
import { LoaderCircle } from 'lucide-react';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { Center, Flexbox } from 'react-layout-kit';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
export default /*#__PURE__*/memo(function () {
|
|
9
|
+
return /*#__PURE__*/_jsx(Center, {
|
|
10
|
+
flex: 1,
|
|
11
|
+
height: '100%',
|
|
12
|
+
width: '100%',
|
|
13
|
+
children: /*#__PURE__*/_jsxs(Flexbox, {
|
|
14
|
+
align: 'center',
|
|
15
|
+
gap: 8,
|
|
16
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
17
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
18
|
+
icon: LoaderCircle,
|
|
19
|
+
size: 'large',
|
|
20
|
+
spin: true
|
|
21
|
+
})
|
|
22
|
+
}), /*#__PURE__*/_jsx(Typography.Text, {
|
|
23
|
+
type: 'secondary',
|
|
24
|
+
children: "Loading..."
|
|
25
|
+
})]
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -5,7 +5,6 @@ import { createStyles } from 'antd-style';
|
|
|
5
5
|
import { Link, history } from 'dumi';
|
|
6
6
|
import NavbarExtra from 'dumi/theme-default/slots/NavbarExtra';
|
|
7
7
|
import { memo } from 'react';
|
|
8
|
-
import { shallow } from 'zustand/shallow';
|
|
9
8
|
import { activePathSel, useSiteStore } from "../../store";
|
|
10
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
10
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -24,9 +23,10 @@ var useStyles = createStyles(function (_ref) {
|
|
|
24
23
|
var Navbar = /*#__PURE__*/memo(function () {
|
|
25
24
|
var _useStyles = useStyles(),
|
|
26
25
|
styles = _useStyles.styles;
|
|
26
|
+
var regLink = /^(\w+:)\/\/|^(mailto|tel):/;
|
|
27
27
|
var nav = useSiteStore(function (s) {
|
|
28
28
|
return s.navData;
|
|
29
|
-
}
|
|
29
|
+
});
|
|
30
30
|
var activePath = useSiteStore(activePathSel);
|
|
31
31
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
32
32
|
children: [/*#__PURE__*/_jsx(TabsNav, {
|
|
@@ -35,25 +35,25 @@ var Navbar = /*#__PURE__*/memo(function () {
|
|
|
35
35
|
items: nav.map(function (item) {
|
|
36
36
|
return {
|
|
37
37
|
key: String(item.activePath || item.link),
|
|
38
|
-
label:
|
|
38
|
+
label: regLink.test(item.link || '') ? /*#__PURE__*/_jsx("a", {
|
|
39
39
|
className: styles.link,
|
|
40
|
-
href:
|
|
40
|
+
href: item.link,
|
|
41
41
|
rel: "noreferrer",
|
|
42
42
|
target: "_blank",
|
|
43
43
|
children: item.title
|
|
44
44
|
}) : /*#__PURE__*/_jsx(Link, {
|
|
45
45
|
className: styles.link,
|
|
46
|
-
to:
|
|
46
|
+
to: item.link,
|
|
47
47
|
children: item.title
|
|
48
48
|
})
|
|
49
49
|
};
|
|
50
50
|
}),
|
|
51
51
|
onChange: function onChange(path) {
|
|
52
52
|
var _nav$find;
|
|
53
|
-
var url = (_nav$find = nav.find(function (
|
|
54
|
-
return
|
|
53
|
+
var url = (_nav$find = nav.find(function (i) {
|
|
54
|
+
return i.activePath === path || i.link === path;
|
|
55
55
|
})) === null || _nav$find === void 0 ? void 0 : _nav$find.link;
|
|
56
|
-
if (!url) return;
|
|
56
|
+
if (!url || regLink.test(url)) return;
|
|
57
57
|
history.push(url);
|
|
58
58
|
}
|
|
59
59
|
}), /*#__PURE__*/_jsx(NavbarExtra, {})]
|
|
@@ -38,7 +38,8 @@ var SearchBar = /*#__PURE__*/memo(function () {
|
|
|
38
38
|
onFocus: function onFocus() {
|
|
39
39
|
return setFocusing(true);
|
|
40
40
|
},
|
|
41
|
-
spotlight: true
|
|
41
|
+
spotlight: true,
|
|
42
|
+
type: 'block'
|
|
42
43
|
}), keywords.trim() && focusing && (result.length > 0 || !loading) && /*#__PURE__*/_jsx("div", {
|
|
43
44
|
className: styles.popover,
|
|
44
45
|
children: /*#__PURE__*/_jsx(SearchResult, {
|
package/dist/store/index.d.ts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
export { initialState } from './initialState';
|
|
1
2
|
export * from './selectors';
|
|
2
3
|
export * from './useSiteStore';
|
|
3
4
|
export * from './useThemeStore';
|
|
5
|
+
/**
|
|
6
|
+
* @title 数据选择器
|
|
7
|
+
*/
|
|
4
8
|
export declare const siteSelectors: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @title API 头部选择器
|
|
11
|
+
*/
|
|
12
|
+
apiHeader: (s: import("./useSiteStore").SiteStore) => import("../components/ApiHeader").ApiHeaderProps;
|
|
13
|
+
/**
|
|
14
|
+
* @title 扁平化侧边栏选择器
|
|
15
|
+
*/
|
|
16
|
+
flattenSidebar: (s: import("./useSiteStore").SiteStore) => import("dumi/dist/client/theme-api/types").ISidebarItem[];
|
|
17
|
+
logo: (s: import("./useSiteStore").SiteStore) => string;
|
|
18
|
+
token: (s: import("./useSiteStore").SiteStore) => any;
|
|
8
19
|
};
|
package/dist/store/index.js
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import { apiHeaderSel, flattenSidebarSel, tokenSel } from "./selectors";
|
|
1
|
+
import { apiHeaderSel, flattenSidebarSel, logoSel, tokenSel } from "./selectors";
|
|
2
|
+
export { initialState } from "./initialState";
|
|
2
3
|
export * from "./selectors";
|
|
3
4
|
export * from "./useSiteStore";
|
|
4
5
|
export * from "./useThemeStore";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @title 数据选择器
|
|
9
|
+
*/
|
|
5
10
|
export var siteSelectors = {
|
|
11
|
+
/**
|
|
12
|
+
* @title API 头部选择器
|
|
13
|
+
*/
|
|
6
14
|
apiHeader: apiHeaderSel,
|
|
15
|
+
/**
|
|
16
|
+
* @title 扁平化侧边栏选择器
|
|
17
|
+
*/
|
|
7
18
|
flattenSidebar: flattenSidebarSel,
|
|
19
|
+
logo: logoSel,
|
|
8
20
|
token: tokenSel
|
|
9
21
|
};
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { type FeatureItem } from '@lobehub/ui';
|
|
2
2
|
import { SiteStore } from '../useSiteStore';
|
|
3
3
|
export declare const isHeroPageSel: (s: SiteStore) => boolean;
|
|
4
|
+
export declare const showHeroPageCustomContent: (s: SiteStore) => boolean;
|
|
5
|
+
export declare const localeValueSel: (s: SiteStore, value: any) => any;
|
|
6
|
+
/**
|
|
7
|
+
* Hero Title 选择器
|
|
8
|
+
* 选择逻辑:优先使用 hero 配置的 title, 再兜底到 themeConfig 中的 name
|
|
9
|
+
*/
|
|
4
10
|
export declare const heroTitleSel: (s: SiteStore) => any;
|
|
11
|
+
/**
|
|
12
|
+
* Hero description 选择器
|
|
13
|
+
* 选择逻辑:优先使用 hero 配置的 description, 再兜底到 themeConfig 中的 name
|
|
14
|
+
*/
|
|
5
15
|
export declare const heroDescSel: (s: SiteStore) => any;
|
|
16
|
+
/**
|
|
17
|
+
* Hero Action 选择器
|
|
18
|
+
* 选择逻辑:优先使用 hero 配置的 actions, 再兜底到 themeConfig 中的 actions
|
|
19
|
+
*/
|
|
6
20
|
export declare const heroActionsSel: (s: SiteStore) => any;
|
|
21
|
+
/**
|
|
22
|
+
* Features 选择器
|
|
23
|
+
*/
|
|
7
24
|
export declare const featuresSel: (s: SiteStore) => FeatureItem[];
|
|
@@ -1,25 +1,65 @@
|
|
|
1
1
|
export var isHeroPageSel = function isHeroPageSel(s) {
|
|
2
|
-
return
|
|
2
|
+
return s.location.pathname === '/';
|
|
3
3
|
};
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
// 是否展示首页的自定义内容
|
|
6
|
+
export var showHeroPageCustomContent = function showHeroPageCustomContent(s) {
|
|
7
|
+
var _s$routeMeta$frontmat, _s$siteData$themeConf;
|
|
8
|
+
return !!((_s$routeMeta$frontmat = s.routeMeta.frontmatter.hero) !== null && _s$routeMeta$frontmat !== void 0 && _s$routeMeta$frontmat.showCustomContent) || !!((_s$siteData$themeConf = s.siteData.themeConfig.hero) !== null && _s$siteData$themeConf !== void 0 && _s$siteData$themeConf.showCustomContent);
|
|
9
|
+
};
|
|
10
|
+
export var localeValueSel = function localeValueSel(s, value) {
|
|
5
11
|
if (!value) return;
|
|
6
12
|
if (value[s.locale.id]) return value[s.locale.id];
|
|
7
13
|
return value;
|
|
8
14
|
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Hero Title 选择器
|
|
18
|
+
* 选择逻辑:优先使用 hero 配置的 title, 再兜底到 themeConfig 中的 name
|
|
19
|
+
*/
|
|
9
20
|
export var heroTitleSel = function heroTitleSel(s) {
|
|
10
|
-
var _s$routeMeta$
|
|
11
|
-
return ((_s$routeMeta$
|
|
21
|
+
var _s$routeMeta$frontmat2, _localeValueSel;
|
|
22
|
+
return ((_s$routeMeta$frontmat2 = s.routeMeta.frontmatter.hero) === null || _s$routeMeta$frontmat2 === void 0 ? void 0 : _s$routeMeta$frontmat2.title) || ( // 从 hero 的 title 中选择
|
|
23
|
+
(_localeValueSel = localeValueSel(s, s.siteData.themeConfig.hero)) === null || _localeValueSel === void 0 ? void 0 : _localeValueSel.title) ||
|
|
24
|
+
// @deprecated 1.0 正式版本移除
|
|
25
|
+
// 从 hero 的 title 中选择
|
|
26
|
+
localeValueSel(s, s.siteData.themeConfig.title) || s.siteData.themeConfig.name;
|
|
12
27
|
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Hero description 选择器
|
|
31
|
+
* 选择逻辑:优先使用 hero 配置的 description, 再兜底到 themeConfig 中的 name
|
|
32
|
+
*/
|
|
13
33
|
export var heroDescSel = function heroDescSel(s) {
|
|
14
|
-
var _s$routeMeta$
|
|
15
|
-
return ((_s$routeMeta$
|
|
34
|
+
var _s$routeMeta$frontmat3, _localeValueSel2;
|
|
35
|
+
return ((_s$routeMeta$frontmat3 = s.routeMeta.frontmatter.hero) === null || _s$routeMeta$frontmat3 === void 0 ? void 0 : _s$routeMeta$frontmat3.description) || ( // 从 hero 的 description 中选择
|
|
36
|
+
(_localeValueSel2 = localeValueSel(s, s.siteData.themeConfig.hero)) === null || _localeValueSel2 === void 0 ? void 0 : _localeValueSel2.description) ||
|
|
37
|
+
// @deprecated 1.0 正式版本移除
|
|
38
|
+
// 从 hero 的 description 中选择
|
|
39
|
+
localeValueSel(s, s.siteData.themeConfig.description);
|
|
16
40
|
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Hero Action 选择器
|
|
44
|
+
* 选择逻辑:优先使用 hero 配置的 actions, 再兜底到 themeConfig 中的 actions
|
|
45
|
+
*/
|
|
17
46
|
export var heroActionsSel = function heroActionsSel(s) {
|
|
18
|
-
var _s$routeMeta$
|
|
19
|
-
return ((_s$routeMeta$
|
|
47
|
+
var _s$routeMeta$frontmat4, _localeValueSel3;
|
|
48
|
+
return ((_s$routeMeta$frontmat4 = s.routeMeta.frontmatter.hero) === null || _s$routeMeta$frontmat4 === void 0 ? void 0 : _s$routeMeta$frontmat4.actions) || ( // 从 hero 的 actions 中选择
|
|
49
|
+
(_localeValueSel3 = localeValueSel(s, s.siteData.themeConfig.hero)) === null || _localeValueSel3 === void 0 ? void 0 : _localeValueSel3.actions) ||
|
|
50
|
+
// @deprecated 1.0 正式版本移除
|
|
51
|
+
localeValueSel(s, s.siteData.themeConfig.actions);
|
|
20
52
|
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Features 选择器
|
|
56
|
+
*/
|
|
21
57
|
export var featuresSel = function featuresSel(s) {
|
|
22
58
|
var _localeValueSel4;
|
|
23
59
|
if (!isHeroPageSel(s)) return [];
|
|
24
|
-
return ((_localeValueSel4 = localeValueSel(s, s.siteData.themeConfig.hero)) === null || _localeValueSel4 === void 0 ? void 0 : _localeValueSel4.features) ||
|
|
60
|
+
return ((_localeValueSel4 = localeValueSel(s, s.siteData.themeConfig.hero)) === null || _localeValueSel4 === void 0 ? void 0 : _localeValueSel4.features) ||
|
|
61
|
+
// @deprecated 1.0 正式版本移除
|
|
62
|
+
localeValueSel(s, s.siteData.themeConfig.features) ||
|
|
63
|
+
// 在themeConfig 没有配置的话,尝试兜底到 frontmatter 中的配置
|
|
64
|
+
s.routeMeta.frontmatter.features || [];
|
|
25
65
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { SiteStore } from '../useSiteStore';
|
|
2
|
-
export declare const themeConfig: (s: SiteStore) => import("
|
|
3
|
-
|
|
2
|
+
export declare const themeConfig: (s: SiteStore) => import("dumi/dist/client/theme-api/types").IThemeConfig & {
|
|
3
|
+
socialLinks?: {
|
|
4
|
+
discord?: string | undefined;
|
|
5
|
+
} | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare const siteTitleSel: (s: SiteStore) => any;
|
|
4
8
|
export declare const githubSel: (s: SiteStore) => string;
|
|
5
|
-
export declare const discordSel: (s: SiteStore) =>
|
|
6
|
-
export declare const giscusSel: (s: SiteStore) =>
|
|
7
|
-
|
|
8
|
-
categoryId: string;
|
|
9
|
-
repo: `${string}/${string}`;
|
|
10
|
-
repoId: string;
|
|
11
|
-
} | undefined;
|
|
9
|
+
export declare const discordSel: (s: SiteStore) => string;
|
|
10
|
+
export declare const giscusSel: (s: SiteStore) => any;
|
|
11
|
+
export declare const logoSel: (s: SiteStore) => string;
|
|
@@ -14,4 +14,14 @@ export var discordSel = function discordSel(s) {
|
|
|
14
14
|
};
|
|
15
15
|
export var giscusSel = function giscusSel(s) {
|
|
16
16
|
return s.siteData.themeConfig.giscus;
|
|
17
|
+
};
|
|
18
|
+
export var logoSel = function logoSel(s) {
|
|
19
|
+
var logo = s.siteData.themeConfig.logo;
|
|
20
|
+
if (!logo) return logo || '';
|
|
21
|
+
|
|
22
|
+
// 如果是 url 地址,则什么也不处理
|
|
23
|
+
if (logo.startsWith('http')) return logo;
|
|
24
|
+
|
|
25
|
+
// TODO: 如果是相对路径,则拼接上 base
|
|
26
|
+
return logo;
|
|
17
27
|
};
|
|
@@ -1,7 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ISiteContext } from 'dumi/dist/client/theme-api/context';
|
|
3
|
+
import { ILocale, INavItem, IRouteMeta, ISidebarGroup, IThemeConfig } from 'dumi/dist/client/theme-api/types';
|
|
4
|
+
import type { Location } from 'history';
|
|
5
|
+
import { StoreApi } from 'zustand';
|
|
6
|
+
export type NavData = (INavItem & {
|
|
7
|
+
children?: INavItem[] | undefined;
|
|
8
|
+
})[];
|
|
9
|
+
export type ISiteData = ISiteContext & {
|
|
10
|
+
themeConfig: IThemeConfig & {
|
|
11
|
+
socialLinks?: {
|
|
12
|
+
discord?: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export interface SiteStore {
|
|
17
|
+
locale: ILocale;
|
|
18
|
+
location: Location;
|
|
19
|
+
navData: NavData;
|
|
20
|
+
routeMeta: IRouteMeta;
|
|
21
|
+
sidebar?: ISidebarGroup[];
|
|
22
|
+
siteData: ISiteData;
|
|
23
|
+
tabMeta?: NonNullable<IRouteMeta['tabs']>[0]['meta'];
|
|
24
|
+
}
|
|
25
|
+
export declare const createStore: (initState: SiteStore) => import("zustand/traditional").UseBoundStoreWithEqualityFn<Omit<StoreApi<SiteStore>, "setState"> & {
|
|
3
26
|
setState<A extends string | {
|
|
4
27
|
type: string;
|
|
5
28
|
}>(partial: SiteStore | Partial<SiteStore> | ((state: SiteStore) => SiteStore | Partial<SiteStore>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
6
29
|
}>;
|
|
7
|
-
|
|
30
|
+
declare const useStore: import("zustand-utils").UseContextStore<StoreApi<SiteStore>>, useStoreApi: () => {
|
|
31
|
+
setState: (partial: SiteStore | Partial<SiteStore> | ((state: SiteStore) => SiteStore | Partial<SiteStore>), replace?: boolean | undefined) => void;
|
|
32
|
+
getState: () => SiteStore;
|
|
33
|
+
getInitialState: () => SiteStore;
|
|
34
|
+
subscribe: (listener: (state: SiteStore, prevState: SiteStore) => void) => () => void;
|
|
35
|
+
destroy: () => void;
|
|
36
|
+
}, Provider: ({ createStore, children }: {
|
|
37
|
+
createStore: () => StoreApi<SiteStore>;
|
|
38
|
+
children: import("react").ReactNode;
|
|
39
|
+
}) => import("react").FunctionComponentElement<import("react").ProviderProps<StoreApi<SiteStore> | undefined>>;
|
|
40
|
+
export { Provider, useStore as useSiteStore, useStoreApi };
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createContext } from 'zustand-utils';
|
|
2
2
|
import { devtools } from 'zustand/middleware';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
3
|
+
import { shallow } from 'zustand/shallow';
|
|
4
|
+
import { createWithEqualityFn } from 'zustand/traditional';
|
|
5
|
+
export var createStore = function createStore(initState) {
|
|
6
|
+
return createWithEqualityFn()(devtools(function () {
|
|
7
|
+
return initState;
|
|
8
|
+
}, {
|
|
9
|
+
name: 'lobe-docs'
|
|
10
|
+
}), shallow);
|
|
11
|
+
};
|
|
12
|
+
var _createContext = createContext(),
|
|
13
|
+
useStore = _createContext.useStore,
|
|
14
|
+
useStoreApi = _createContext.useStoreApi,
|
|
15
|
+
Provider = _createContext.Provider;
|
|
16
|
+
export { Provider, useStore as useSiteStore, useStoreApi };
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import type { ThemeMode } from 'antd-style';
|
|
2
|
-
|
|
2
|
+
interface Store {
|
|
3
3
|
themeMode: ThemeMode;
|
|
4
4
|
}
|
|
5
|
-
export declare const useThemeStore: import("zustand").
|
|
5
|
+
export declare const useThemeStore: import("zustand/traditional").UseBoundStoreWithEqualityFn<Omit<import("zustand").StoreApi<Store>, "persist"> & {
|
|
6
6
|
persist: {
|
|
7
|
-
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<
|
|
7
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<Store, {
|
|
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:
|
|
14
|
-
onFinishHydration: (fn: (state:
|
|
15
|
-
getOptions: () => Partial<import("zustand/middleware").PersistOptions<
|
|
13
|
+
onHydrate: (fn: (state: Store) => void) => () => void;
|
|
14
|
+
onFinishHydration: (fn: (state: Store) => void) => () => void;
|
|
15
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<Store, {
|
|
16
16
|
themeMode: ThemeMode;
|
|
17
17
|
}>>;
|
|
18
18
|
};
|
|
19
19
|
}>;
|
|
20
|
+
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { create } from 'zustand';
|
|
2
1
|
import { persist } from 'zustand/middleware';
|
|
3
|
-
|
|
2
|
+
import { shallow } from 'zustand/shallow';
|
|
3
|
+
import { createWithEqualityFn } from 'zustand/traditional';
|
|
4
|
+
export var useThemeStore = createWithEqualityFn()(persist(function () {
|
|
4
5
|
return {
|
|
5
6
|
themeMode: 'auto'
|
|
6
7
|
};
|
|
7
8
|
}, {
|
|
8
|
-
name: '
|
|
9
|
-
}));
|
|
9
|
+
name: 'LOBE_DOC_STORE'
|
|
10
|
+
}), shallow);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dumi-theme-lobehub",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.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,29 +25,30 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@floating-ui/react": "^0.26.
|
|
29
|
-
"
|
|
30
|
-
"@lobehub/ui": "^1.142.4",
|
|
31
|
-
"ahooks": "^3.8.0",
|
|
32
|
-
"antd": "^5.18.2",
|
|
33
|
-
"antd-style": "^3.6.2",
|
|
28
|
+
"@floating-ui/react": "^0.26.28",
|
|
29
|
+
"ahooks": "^3.8.1",
|
|
34
30
|
"chalk": "^4.1.2",
|
|
35
31
|
"fast-deep-equal": "^3.1.3",
|
|
36
32
|
"history": "^5.3.0",
|
|
37
33
|
"lodash-es": "^4.17.21",
|
|
38
|
-
"lucide-react": "^0.395.0",
|
|
39
34
|
"polished": "^4.3.1",
|
|
40
35
|
"rc-footer": "^0.6.8",
|
|
41
36
|
"react-layout-kit": "^1.9.0",
|
|
37
|
+
"swr": "^2.2.5",
|
|
42
38
|
"use-merge-value": "^1.2.0",
|
|
43
|
-
"zustand": "^4.5.
|
|
39
|
+
"zustand": "^4.5.5",
|
|
40
|
+
"zustand-utils": "^1.3.2"
|
|
44
41
|
},
|
|
45
42
|
"peerDependencies": {
|
|
43
|
+
"@giscus/react": ">=3",
|
|
44
|
+
"@lobehub/ui": ">=1",
|
|
46
45
|
"antd": ">=5",
|
|
47
46
|
"antd-style": ">=3",
|
|
48
47
|
"dumi": ">=2",
|
|
48
|
+
"lucide-react": ">=0.292",
|
|
49
49
|
"react": ">=18",
|
|
50
|
-
"react-dom": ">=18"
|
|
50
|
+
"react-dom": ">=18",
|
|
51
|
+
"react-layout-kit": ">=1"
|
|
51
52
|
},
|
|
52
53
|
"publishConfig": {
|
|
53
54
|
"access": "public",
|