dumi-theme-lobehub 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +162 -0
- package/dist/builtins/Container/index.d.ts +7 -0
- package/dist/builtins/Container/index.js +28 -0
- package/dist/builtins/Container/style.d.ts +5 -0
- package/dist/builtins/Container/style.js +27 -0
- package/dist/builtins/Features/index.d.ts +2 -0
- package/dist/builtins/Features/index.js +19 -0
- package/dist/builtins/Previewer/index.d.ts +8 -0
- package/dist/builtins/Previewer/index.js +26 -0
- package/dist/builtins/Previewer/style.d.ts +9 -0
- package/dist/builtins/Previewer/style.js +18 -0
- package/dist/builtins/SourceCode/index.d.ts +7 -0
- package/dist/builtins/SourceCode/index.js +17 -0
- package/dist/components/ApiHeader/index.d.ts +77 -0
- package/dist/components/ApiHeader/index.js +124 -0
- package/dist/components/ApiHeader/style.d.ts +7 -0
- package/dist/components/ApiHeader/style.js +16 -0
- package/dist/components/Favicons/index.d.ts +3 -0
- package/dist/components/Favicons/index.js +43 -0
- package/dist/components/NativeSelect/SelectItem/index.d.ts +12 -0
- package/dist/components/NativeSelect/SelectItem/index.js +37 -0
- package/dist/components/NativeSelect/SelectItem/style.d.ts +5 -0
- package/dist/components/NativeSelect/SelectItem/style.js +13 -0
- package/dist/components/NativeSelect/index.d.ts +17 -0
- package/dist/components/NativeSelect/index.js +248 -0
- package/dist/components/NativeSelect/style.d.ts +4 -0
- package/dist/components/NativeSelect/style.js +13 -0
- package/dist/components/StoreUpdater/index.d.ts +1 -0
- package/dist/components/StoreUpdater/index.js +91 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +3 -0
- package/dist/hooks/useCopied.d.ts +4 -0
- package/dist/hooks/useCopied.js +31 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/layouts/DemoLayout/index.d.ts +3 -0
- package/dist/layouts/DemoLayout/index.js +21 -0
- package/dist/layouts/DocLayout/GlobalStyle.d.ts +3 -0
- package/dist/layouts/DocLayout/GlobalStyle.js +8 -0
- package/dist/layouts/DocLayout/index.d.ts +3 -0
- package/dist/layouts/DocLayout/index.js +130 -0
- package/dist/pages/Changelog/index.d.ts +3 -0
- package/dist/pages/Changelog/index.js +58 -0
- package/dist/pages/Docs/index.d.ts +3 -0
- package/dist/pages/Docs/index.js +52 -0
- package/dist/pages/Docs/styles.d.ts +5 -0
- package/dist/pages/Docs/styles.js +14 -0
- package/dist/pages/Home/index.d.ts +3 -0
- package/dist/pages/Home/index.js +20 -0
- package/dist/plugin/index.d.ts +3 -0
- package/dist/plugin/index.js +77 -0
- package/dist/plugin/utils.d.ts +1 -0
- package/dist/plugin/utils.js +30 -0
- package/dist/slots/ApiHeader/BundlephobiaFilled.d.ts +3 -0
- package/dist/slots/ApiHeader/BundlephobiaFilled.js +15 -0
- package/dist/slots/ApiHeader/Graph.d.ts +3 -0
- package/dist/slots/ApiHeader/Graph.js +14 -0
- package/dist/slots/ApiHeader/NpmFilled.d.ts +3 -0
- package/dist/slots/ApiHeader/NpmFilled.js +16 -0
- package/dist/slots/ApiHeader/PackagePhobia.d.ts +3 -0
- package/dist/slots/ApiHeader/PackagePhobia.js +27 -0
- package/dist/slots/ApiHeader/Unpkg.d.ts +3 -0
- package/dist/slots/ApiHeader/Unpkg.js +14 -0
- package/dist/slots/ApiHeader/index.d.ts +3 -0
- package/dist/slots/ApiHeader/index.js +53 -0
- package/dist/slots/Content/index.d.ts +4 -0
- package/dist/slots/Content/index.js +49 -0
- package/dist/slots/Content/style.d.ts +3 -0
- package/dist/slots/Content/style.js +12 -0
- package/dist/slots/ContentFooter/Linker.d.ts +8 -0
- package/dist/slots/ContentFooter/Linker.js +65 -0
- package/dist/slots/ContentFooter/Linker.style.d.ts +6 -0
- package/dist/slots/ContentFooter/Linker.style.js +13 -0
- package/dist/slots/ContentFooter/index.d.ts +3 -0
- package/dist/slots/ContentFooter/index.js +35 -0
- package/dist/slots/ContentTabs/index.d.ts +10 -0
- package/dist/slots/ContentTabs/index.js +49 -0
- package/dist/slots/ContentTabs/style.d.ts +3 -0
- package/dist/slots/ContentTabs/style.js +13 -0
- package/dist/slots/Features/index.d.ts +3 -0
- package/dist/slots/Features/index.js +19 -0
- package/dist/slots/Footer/columns.d.ts +6 -0
- package/dist/slots/Footer/columns.js +81 -0
- package/dist/slots/Footer/index.d.ts +3 -0
- package/dist/slots/Footer/index.js +56 -0
- package/dist/slots/Footer/style.d.ts +4 -0
- package/dist/slots/Footer/style.js +13 -0
- package/dist/slots/Header/Burger.d.ts +3 -0
- package/dist/slots/Header/Burger.js +72 -0
- package/dist/slots/Header/GithubButton.d.ts +3 -0
- package/dist/slots/Header/GithubButton.js +18 -0
- package/dist/slots/Header/LangSwitch.d.ts +3 -0
- package/dist/slots/Header/LangSwitch.js +133 -0
- package/dist/slots/Header/ThemeSwitch.d.ts +3 -0
- package/dist/slots/Header/ThemeSwitch.js +18 -0
- package/dist/slots/Header/index.d.ts +3 -0
- package/dist/slots/Header/index.js +30 -0
- package/dist/slots/Hero/index.d.ts +3 -0
- package/dist/slots/Hero/index.js +15 -0
- package/dist/slots/Logo/index.d.ts +3 -0
- package/dist/slots/Logo/index.js +38 -0
- package/dist/slots/Logo/style.d.ts +1 -0
- package/dist/slots/Logo/style.js +9 -0
- package/dist/slots/Navbar/index.d.ts +3 -0
- package/dist/slots/Navbar/index.js +55 -0
- package/dist/slots/PreviewerActions/index.d.ts +13 -0
- package/dist/slots/PreviewerActions/index.js +109 -0
- package/dist/slots/PreviewerActions/style.d.ts +4 -0
- package/dist/slots/PreviewerActions/style.js +11 -0
- package/dist/slots/SearchBar/index.d.ts +3 -0
- package/dist/slots/SearchBar/index.js +51 -0
- package/dist/slots/SearchBar/style.d.ts +7 -0
- package/dist/slots/SearchBar/style.js +16 -0
- package/dist/slots/Sidebar/index.d.ts +3 -0
- package/dist/slots/Sidebar/index.js +35 -0
- package/dist/slots/Sidebar/style.d.ts +4 -0
- package/dist/slots/Sidebar/style.js +11 -0
- package/dist/slots/Toc/index.d.ts +3 -0
- package/dist/slots/Toc/index.js +46 -0
- package/dist/store/index.d.ts +17 -0
- package/dist/store/index.js +19 -0
- package/dist/store/selectors/apiHeader.d.ts +5 -0
- package/dist/store/selectors/apiHeader.js +62 -0
- package/dist/store/selectors/hero.d.ts +22 -0
- package/dist/store/selectors/hero.js +59 -0
- package/dist/store/selectors/index.d.ts +23 -0
- package/dist/store/selectors/index.js +71 -0
- package/dist/store/selectors/siteBasicInfo.d.ts +6 -0
- package/dist/store/selectors/siteBasicInfo.js +14 -0
- package/dist/store/selectors/token.d.ts +2 -0
- package/dist/store/selectors/token.js +5 -0
- package/dist/store/useSiteStore.d.ts +36 -0
- package/dist/store/useSiteStore.js +48 -0
- package/dist/store/useThemeStore.d.ts +20 -0
- package/dist/store/useThemeStore.js +9 -0
- package/dist/styles/customToken.d.ts +10 -0
- package/dist/styles/customToken.js +10 -0
- package/dist/types/config.d.ts +101 -0
- package/dist/types/config.js +1 -0
- package/dist/types/global.d.ts +16 -0
- package/dist/types/hero.d.ts +8 -0
- package/dist/types/hero.js +1 -0
- package/dist/types/index.d.ts +26 -0
- package/dist/types/index.js +7 -0
- package/package.json +119 -0
|
@@ -0,0 +1,130 @@
|
|
|
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';
|
|
6
|
+
import { shallow } from 'zustand/shallow';
|
|
7
|
+
import Favicons from "../../components/Favicons";
|
|
8
|
+
import { StoreUpdater } from "../../components/StoreUpdater";
|
|
9
|
+
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";
|
|
18
|
+
import customToken from "../../styles/customToken";
|
|
19
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
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
|
+
global.__ANTD_CACHE__ = extractStaticStyle.cache;
|
|
118
|
+
export default /*#__PURE__*/memo(function () {
|
|
119
|
+
var themeMode = useThemeStore(function (st) {
|
|
120
|
+
return st.themeMode;
|
|
121
|
+
}, shallow);
|
|
122
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
123
|
+
children: [/*#__PURE__*/_jsx(Favicons, {}), /*#__PURE__*/_jsx(StoreUpdater, {}), /*#__PURE__*/_jsxs(ThemeProvider, {
|
|
124
|
+
cache: extractStaticStyle.cache,
|
|
125
|
+
customToken: customToken,
|
|
126
|
+
themeMode: themeMode,
|
|
127
|
+
children: [/*#__PURE__*/_jsx(GlobalStyle, {}), /*#__PURE__*/_jsx(DocumentLayout, {})]
|
|
128
|
+
})]
|
|
129
|
+
});
|
|
130
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useResponsive } from 'antd-style';
|
|
2
|
+
import { useOutlet } from 'dumi';
|
|
3
|
+
import isEqual from 'fast-deep-equal';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { Center } from 'react-layout-kit';
|
|
6
|
+
import { shallow } from 'zustand/shallow';
|
|
7
|
+
import { ApiHeader } from "../../components/ApiHeader";
|
|
8
|
+
import { useStyles } from "../Docs/styles";
|
|
9
|
+
import Content from "dumi/theme/slots/Content";
|
|
10
|
+
import { githubSel, useSiteStore } from "../../store";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
var Changelog = /*#__PURE__*/memo(function () {
|
|
15
|
+
var outlet = useOutlet();
|
|
16
|
+
var _useResponsive = useResponsive(),
|
|
17
|
+
mobile = _useResponsive.mobile;
|
|
18
|
+
var _useSiteStore = useSiteStore(function (s) {
|
|
19
|
+
return {
|
|
20
|
+
repoBase: githubSel(s)
|
|
21
|
+
};
|
|
22
|
+
}, shallow),
|
|
23
|
+
repoBase = _useSiteStore.repoBase;
|
|
24
|
+
var _useSiteStore2 = useSiteStore(function (s) {
|
|
25
|
+
return {
|
|
26
|
+
fm: s.routeMeta.frontmatter
|
|
27
|
+
};
|
|
28
|
+
}, isEqual),
|
|
29
|
+
fm = _useSiteStore2.fm;
|
|
30
|
+
var _useStyles = useStyles(),
|
|
31
|
+
styles = _useStyles.styles;
|
|
32
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
33
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
34
|
+
className: styles.background
|
|
35
|
+
}), /*#__PURE__*/_jsxs(Center, {
|
|
36
|
+
className: styles.content,
|
|
37
|
+
style: {
|
|
38
|
+
padding: mobile ? 0 : 24
|
|
39
|
+
},
|
|
40
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
41
|
+
style: {
|
|
42
|
+
padding: mobile ? 16 : 0,
|
|
43
|
+
width: '100%'
|
|
44
|
+
},
|
|
45
|
+
children: /*#__PURE__*/_jsx(ApiHeader, {
|
|
46
|
+
description: fm.description,
|
|
47
|
+
docUrl: "".concat(repoBase, "/blob/master/CHANGELOG.md"),
|
|
48
|
+
sourceUrl: "".concat(repoBase, "/blob/master/CHANGELOG.md"),
|
|
49
|
+
title: fm.title
|
|
50
|
+
})
|
|
51
|
+
}), /*#__PURE__*/_jsx(Content, {
|
|
52
|
+
className: styles.changelog,
|
|
53
|
+
children: outlet
|
|
54
|
+
})]
|
|
55
|
+
})]
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
export default Changelog;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Giscus } from '@lobehub/ui';
|
|
2
|
+
import { useResponsive } from 'antd-style';
|
|
3
|
+
import { useOutlet } from 'dumi';
|
|
4
|
+
import { memo, useCallback } from 'react';
|
|
5
|
+
import { Center } from 'react-layout-kit';
|
|
6
|
+
import { shallow } from 'zustand/shallow';
|
|
7
|
+
import ApiHeader from "dumi/theme/slots/ApiHeader";
|
|
8
|
+
import Content from "dumi/theme/slots/Content";
|
|
9
|
+
import { isApiPageSel, useSiteStore } from "../../store";
|
|
10
|
+
import { useStyles } from "./styles";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
var Documents = /*#__PURE__*/memo(function () {
|
|
15
|
+
var outlet = useOutlet();
|
|
16
|
+
var _useResponsive = useResponsive(),
|
|
17
|
+
mobile = _useResponsive.mobile;
|
|
18
|
+
var isApiPage = useSiteStore(isApiPageSel, shallow);
|
|
19
|
+
var _useStyles = useStyles(),
|
|
20
|
+
styles = _useStyles.styles;
|
|
21
|
+
var Comment = useCallback(function () {
|
|
22
|
+
return /*#__PURE__*/_jsx(Giscus, {
|
|
23
|
+
category: "Q&A",
|
|
24
|
+
categoryId: "DIC_kwDOJloKoM4CXsCu",
|
|
25
|
+
id: "lobehub",
|
|
26
|
+
mapping: "title",
|
|
27
|
+
repo: "lobehub/lobe-ui",
|
|
28
|
+
repoId: "R_kgDOJloKoA"
|
|
29
|
+
});
|
|
30
|
+
}, [location.pathname]);
|
|
31
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
32
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
33
|
+
className: styles.background
|
|
34
|
+
}), /*#__PURE__*/_jsxs(Center, {
|
|
35
|
+
className: styles.content,
|
|
36
|
+
style: {
|
|
37
|
+
marginBottom: 48,
|
|
38
|
+
padding: mobile ? 0 : 24
|
|
39
|
+
},
|
|
40
|
+
children: [isApiPage ? /*#__PURE__*/_jsx("div", {
|
|
41
|
+
style: {
|
|
42
|
+
padding: mobile ? 16 : 0,
|
|
43
|
+
width: '100%'
|
|
44
|
+
},
|
|
45
|
+
children: /*#__PURE__*/_jsx(ApiHeader, {})
|
|
46
|
+
}) : undefined, /*#__PURE__*/_jsxs(Content, {
|
|
47
|
+
children: [outlet, /*#__PURE__*/_jsx(Comment, {})]
|
|
48
|
+
})]
|
|
49
|
+
})]
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
export default Documents;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
export var useStyles = createStyles(function (_ref) {
|
|
5
|
+
var cx = _ref.cx,
|
|
6
|
+
css = _ref.css,
|
|
7
|
+
token = _ref.token,
|
|
8
|
+
stylish = _ref.stylish;
|
|
9
|
+
return {
|
|
10
|
+
background: cx(stylish.gradientAnimation, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n pointer-events: none;\n\n position: absolute;\n z-index: 0;\n top: -100px;\n right: -20vw;\n transform: rotate(4deg);\n\n width: 60vw;\n height: 200px;\n\n opacity: 0.2;\n filter: blur(100px);\n "])))),
|
|
11
|
+
changelog: css(_templateObject2 || (_templateObject2 = _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 }\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),
|
|
12
|
+
content: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 100%;\n max-width: ", "px;\n margin: 0 auto;\n "])), token.contentMaxWidth)
|
|
13
|
+
};
|
|
14
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useOutlet } from 'dumi';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { Flexbox } from 'react-layout-kit';
|
|
4
|
+
import Features from "dumi/theme/slots/Features";
|
|
5
|
+
import Hero from "dumi/theme/slots/Hero";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
var Home = /*#__PURE__*/memo(function () {
|
|
9
|
+
var outlet = useOutlet();
|
|
10
|
+
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
11
|
+
align: 'center',
|
|
12
|
+
gap: 64,
|
|
13
|
+
style: {
|
|
14
|
+
minHeight: '64vh',
|
|
15
|
+
padding: '64px 24px'
|
|
16
|
+
},
|
|
17
|
+
children: [/*#__PURE__*/_jsx(Hero, {}), /*#__PURE__*/_jsx(Features, {}), outlet]
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
export default Home;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/plugin/index.ts
|
|
30
|
+
var plugin_exports = {};
|
|
31
|
+
__export(plugin_exports, {
|
|
32
|
+
default: () => plugin_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(plugin_exports);
|
|
35
|
+
var import_antd_style = require("antd-style");
|
|
36
|
+
var import_chalk = __toESM(require("chalk"));
|
|
37
|
+
var import_node_fs = __toESM(require("node:fs"));
|
|
38
|
+
var import_node_path = require("node:path");
|
|
39
|
+
var import_utils = require("./utils");
|
|
40
|
+
var SSRPlugin = (api) => {
|
|
41
|
+
api.describe({
|
|
42
|
+
key: "@"
|
|
43
|
+
});
|
|
44
|
+
if (!api.userConfig.ssr)
|
|
45
|
+
return;
|
|
46
|
+
api.logger.info("detect ssr config, when building html will extract css.");
|
|
47
|
+
const writeCSSFile = (key, hashKey, cssString) => {
|
|
48
|
+
const fileName = `ssr-${key}.${(0, import_utils.getHash)(hashKey)}.css`;
|
|
49
|
+
const filePath = (0, import_node_path.join)(api.paths.absOutputPath, fileName);
|
|
50
|
+
if (!import_node_fs.default.existsSync(filePath)) {
|
|
51
|
+
api.logger.event(import_chalk.default.grey(`write to: ${filePath}`));
|
|
52
|
+
import_node_fs.default.writeFileSync(filePath, cssString, "utf8");
|
|
53
|
+
}
|
|
54
|
+
return fileName;
|
|
55
|
+
};
|
|
56
|
+
const addLinkStyle = (html, cssFile) => {
|
|
57
|
+
const prefix = api.userConfig.publicPath || api.config.publicPath;
|
|
58
|
+
return html.replace("</head>", `<link rel="stylesheet" href="${prefix + cssFile}"></head>`);
|
|
59
|
+
};
|
|
60
|
+
api.modifyExportHTMLFiles(
|
|
61
|
+
(files) => files.filter((f) => !f.path.includes(":")).map((file) => {
|
|
62
|
+
const antdCache = global.__ANTD_CACHE__;
|
|
63
|
+
const styles = (0, import_antd_style.extractStaticStyle)(file.content, { antdCache });
|
|
64
|
+
for (const result of styles) {
|
|
65
|
+
api.logger.event(
|
|
66
|
+
`${import_chalk.default.yellow(file.path)} include ${import_chalk.default.blue`[${result.key}]`} ${import_chalk.default.yellow(
|
|
67
|
+
result.ids.length
|
|
68
|
+
)} styles`
|
|
69
|
+
);
|
|
70
|
+
const cssFile = writeCSSFile(result.key, result.ids.join(""), result.css);
|
|
71
|
+
file.content = addLinkStyle(file.content, cssFile);
|
|
72
|
+
}
|
|
73
|
+
return file;
|
|
74
|
+
})
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
var plugin_default = SSRPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getHash: (string_: string, length?: number) => string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/plugin/utils.ts
|
|
20
|
+
var utils_exports = {};
|
|
21
|
+
__export(utils_exports, {
|
|
22
|
+
getHash: () => getHash
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(utils_exports);
|
|
25
|
+
var import_node_crypto = require("node:crypto");
|
|
26
|
+
var getHash = (string_, length = 8) => (0, import_node_crypto.createHash)("md5").update(string_).digest("hex").slice(0, length);
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
getHash
|
|
30
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
export default /*#__PURE__*/memo(function () {
|
|
4
|
+
return /*#__PURE__*/_jsx("svg", {
|
|
5
|
+
fill: "currentColor",
|
|
6
|
+
height: "1em",
|
|
7
|
+
viewBox: "64 64 896 896",
|
|
8
|
+
width: "1em",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
11
|
+
d: "M503.783 64 960 263.576V761.46L521.625 955.734V473.5h-17.5v486.351l-.342.149L64 761.46V263.576L503.783 64Zm.13 19.158L84.37 273.548 512 466.131 939.386 273.66l-435.473-190.5Z",
|
|
12
|
+
fillRule: "evenodd"
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
export default /*#__PURE__*/memo(function () {
|
|
4
|
+
return /*#__PURE__*/_jsx("svg", {
|
|
5
|
+
fill: "currentColor",
|
|
6
|
+
height: "1em",
|
|
7
|
+
viewBox: "0 0 24 24",
|
|
8
|
+
width: "1em",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
11
|
+
d: "M14.051 2.751l4.935 2.85a2.144 2.144 0 013.409.4 2.146 2.146 0 01-1.354 3.151v5.699a2.132 2.132 0 011.348 3.15 2.143 2.143 0 01-3.453.353l-4.905 2.832a2.14 2.14 0 11-4.171.678c0-.205.029-.41.088-.609l-4.936-2.847a2.14 2.14 0 11-2.052-3.559l.001-5.699A2.141 2.141 0 011.604 6a2.143 2.143 0 013.407-.405l4.938-2.85A2.138 2.138 0 0112 0a2.137 2.137 0 012.051 2.751zm-.515.877a.793.793 0 01-.058.058l6.461 11.19c.026-.009.056-.016.082-.023V9.146a2.135 2.135 0 01-1.558-2.588l.019-.072-4.946-2.858zm-3.015.059l-.06-.06-4.946 2.852a2.136 2.136 0 01-1.461 2.645l-.076.021v5.708l.084.023 6.461-11.19-.002.001zm2.076.507c-.39.112-.803.112-1.192 0l-6.46 11.189c.294.283.502.645.6 1.041h12.911c.097-.398.307-.761.603-1.044L12.597 4.194zm.986 16.227l4.913-2.838a1.748 1.748 0 01-.038-.142H5.542l-.021.083 4.939 2.852a2.126 2.126 0 011.54-.653c.627 0 1.19.269 1.583.698z"
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
export default /*#__PURE__*/memo(function () {
|
|
4
|
+
return /*#__PURE__*/_jsx("svg", {
|
|
5
|
+
height: "14px",
|
|
6
|
+
version: "1.1",
|
|
7
|
+
viewBox: "0 0 14 14",
|
|
8
|
+
width: "14px",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
11
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
12
|
+
d: "M13,0 C13.5522847,-1.01453063e-16 14,0.44771525 14,1 L14,13 C14,13.5522847 13.5522847,14 13,14 L1,14 C0.44771525,14 -4.87476137e-16,13.5522847 0,13 L0,1 C-6.76353751e-17,0.44771525 0.44771525,-4.5365845e-16 1,0 L13,0 Z M11.375,2.625 L2.625,2.625 L2.625,11.375 L7,11.375 L7,4.375 L9.625,4.375 L9.625,11.375 L11.375,11.375 L11.375,2.625 Z",
|
|
13
|
+
fill: "#C12127"
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
export default /*#__PURE__*/memo(function () {
|
|
5
|
+
return /*#__PURE__*/_jsxs("svg", {
|
|
6
|
+
height: "1em",
|
|
7
|
+
viewBox: "0 0 108 108",
|
|
8
|
+
width: "1em",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
children: [/*#__PURE__*/_jsx("defs", {
|
|
11
|
+
children: /*#__PURE__*/_jsxs("linearGradient", {
|
|
12
|
+
id: "main",
|
|
13
|
+
children: [/*#__PURE__*/_jsx("stop", {
|
|
14
|
+
offset: "0",
|
|
15
|
+
stopColor: "#006838"
|
|
16
|
+
}), /*#__PURE__*/_jsx("stop", {
|
|
17
|
+
offset: "1",
|
|
18
|
+
stopColor: "#32de85"
|
|
19
|
+
})]
|
|
20
|
+
})
|
|
21
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
22
|
+
d: "M21.667 73.809V33.867l28.33-16.188 28.337 16.188V66.13L49.997 82.321 35 73.75V41.604l14.997-8.57L65 41.604v16.788l-15.003 8.571-1.663-.95v-16.67l8.382-4.792-6.719-3.838-8.33 4.763V69.88l8.33 4.762 21.67-12.383V37.737l-21.67-12.379-21.663 12.379v39.88L49.997 90 85 70V30L49.997 10 15 30v40z",
|
|
23
|
+
fill: "url(#main)",
|
|
24
|
+
transform: "matrix(1.25 0 0 1.25 -8.75 -7.5)"
|
|
25
|
+
})]
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
export default /*#__PURE__*/memo(function () {
|
|
4
|
+
return /*#__PURE__*/_jsx("svg", {
|
|
5
|
+
fill: "currentColor",
|
|
6
|
+
height: "1em",
|
|
7
|
+
viewBox: "0 0 24 24",
|
|
8
|
+
width: "1em",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
11
|
+
d: "M16.509 16.845c.148-.507.091-.97-.155-1.315-.225-.317-.605-.5-1.062-.521l-8.659-.113a.155.155 0 01-.134-.071.194.194 0 01-.02-.155.239.239 0 01.203-.156l8.736-.113c1.034-.048 2.16-.886 2.554-1.913l.5-1.301a.28.28 0 00.013-.168 5.69 5.69 0 00-10.938-.584 2.585 2.585 0 00-1.793-.5 2.561 2.561 0 00-2.223 3.18 3.634 3.634 0 00-3.53 3.636c0 .176.013.352.034.528a.174.174 0 00.169.148h15.981a.22.22 0 00.204-.155zm2.757-5.564c-.077 0-.162 0-.24.011-.055 0-.105.042-.126.098l-.337 1.175c-.148.506-.092.97.154 1.315.226.317.605.5 1.063.52l1.843.114c.056 0 .105.026.133.07a.2.2 0 01.021.156.238.238 0 01-.204.155l-1.92.113c-1.041.049-2.16.887-2.553 1.914l-.141.358c-.028.071.02.141.098.141h6.598a.173.173 0 00.17-.125 4.81 4.81 0 00.175-1.28 4.739 4.739 0 00-4.734-4.727"
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
import isEqual from 'fast-deep-equal';
|
|
8
|
+
import { memo, useMemo } from 'react';
|
|
9
|
+
import { ApiHeader as Header } from "../../components/ApiHeader";
|
|
10
|
+
import { apiHeaderSel, useSiteStore } from "../../store";
|
|
11
|
+
import BundlephobiaFilled from "./BundlephobiaFilled";
|
|
12
|
+
import Graph from "./Graph";
|
|
13
|
+
import NpmFilled from "./NpmFilled";
|
|
14
|
+
import PackagePhobia from "./PackagePhobia";
|
|
15
|
+
import Unpkg from "./Unpkg";
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
var ApiHeader = /*#__PURE__*/memo(function () {
|
|
18
|
+
var props = useSiteStore(apiHeaderSel, isEqual);
|
|
19
|
+
var pkg = props.pkg;
|
|
20
|
+
var packages = useMemo(function () {
|
|
21
|
+
var packageURL = encodeURIComponent(String(pkg));
|
|
22
|
+
return [{
|
|
23
|
+
children: 'NPM',
|
|
24
|
+
icon: /*#__PURE__*/_jsx(NpmFilled, {}),
|
|
25
|
+
label: 'NPM',
|
|
26
|
+
url: "https://www.npmjs.com/package/".concat(packageURL)
|
|
27
|
+
}, {
|
|
28
|
+
children: 'UNPKG',
|
|
29
|
+
icon: /*#__PURE__*/_jsx(Unpkg, {}),
|
|
30
|
+
label: 'Check package files',
|
|
31
|
+
url: "https://unpkg.com/browse/".concat(packageURL, "/")
|
|
32
|
+
}, {
|
|
33
|
+
children: 'BundlePhobia',
|
|
34
|
+
icon: /*#__PURE__*/_jsx(BundlephobiaFilled, {}),
|
|
35
|
+
label: 'Check bundle size',
|
|
36
|
+
url: "https://bundlephobia.com/package/".concat(packageURL)
|
|
37
|
+
}, {
|
|
38
|
+
children: 'PackagePhobia',
|
|
39
|
+
icon: /*#__PURE__*/_jsx(PackagePhobia, {}),
|
|
40
|
+
label: 'Check package size',
|
|
41
|
+
url: "https://packagephobia.com/result?p=".concat(packageURL)
|
|
42
|
+
}, {
|
|
43
|
+
children: 'Anvaka Graph',
|
|
44
|
+
icon: /*#__PURE__*/_jsx(Graph, {}),
|
|
45
|
+
label: 'Dependence graph',
|
|
46
|
+
url: "https://npm.anvaka.com/#/view/2d/".concat(encodeURIComponent(packageURL))
|
|
47
|
+
}];
|
|
48
|
+
}, [pkg]);
|
|
49
|
+
return /*#__PURE__*/_jsx(Header, _objectSpread({
|
|
50
|
+
serviceList: packages
|
|
51
|
+
}, props));
|
|
52
|
+
});
|
|
53
|
+
export default ApiHeader;
|