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.
Files changed (146) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +162 -0
  3. package/dist/builtins/Container/index.d.ts +7 -0
  4. package/dist/builtins/Container/index.js +28 -0
  5. package/dist/builtins/Container/style.d.ts +5 -0
  6. package/dist/builtins/Container/style.js +27 -0
  7. package/dist/builtins/Features/index.d.ts +2 -0
  8. package/dist/builtins/Features/index.js +19 -0
  9. package/dist/builtins/Previewer/index.d.ts +8 -0
  10. package/dist/builtins/Previewer/index.js +26 -0
  11. package/dist/builtins/Previewer/style.d.ts +9 -0
  12. package/dist/builtins/Previewer/style.js +18 -0
  13. package/dist/builtins/SourceCode/index.d.ts +7 -0
  14. package/dist/builtins/SourceCode/index.js +17 -0
  15. package/dist/components/ApiHeader/index.d.ts +77 -0
  16. package/dist/components/ApiHeader/index.js +124 -0
  17. package/dist/components/ApiHeader/style.d.ts +7 -0
  18. package/dist/components/ApiHeader/style.js +16 -0
  19. package/dist/components/Favicons/index.d.ts +3 -0
  20. package/dist/components/Favicons/index.js +43 -0
  21. package/dist/components/NativeSelect/SelectItem/index.d.ts +12 -0
  22. package/dist/components/NativeSelect/SelectItem/index.js +37 -0
  23. package/dist/components/NativeSelect/SelectItem/style.d.ts +5 -0
  24. package/dist/components/NativeSelect/SelectItem/style.js +13 -0
  25. package/dist/components/NativeSelect/index.d.ts +17 -0
  26. package/dist/components/NativeSelect/index.js +248 -0
  27. package/dist/components/NativeSelect/style.d.ts +4 -0
  28. package/dist/components/NativeSelect/style.js +13 -0
  29. package/dist/components/StoreUpdater/index.d.ts +1 -0
  30. package/dist/components/StoreUpdater/index.js +91 -0
  31. package/dist/config.d.ts +2 -0
  32. package/dist/config.js +3 -0
  33. package/dist/hooks/useCopied.d.ts +4 -0
  34. package/dist/hooks/useCopied.js +31 -0
  35. package/dist/index.d.ts +3 -0
  36. package/dist/index.js +3 -0
  37. package/dist/layouts/DemoLayout/index.d.ts +3 -0
  38. package/dist/layouts/DemoLayout/index.js +21 -0
  39. package/dist/layouts/DocLayout/GlobalStyle.d.ts +3 -0
  40. package/dist/layouts/DocLayout/GlobalStyle.js +8 -0
  41. package/dist/layouts/DocLayout/index.d.ts +3 -0
  42. package/dist/layouts/DocLayout/index.js +130 -0
  43. package/dist/pages/Changelog/index.d.ts +3 -0
  44. package/dist/pages/Changelog/index.js +58 -0
  45. package/dist/pages/Docs/index.d.ts +3 -0
  46. package/dist/pages/Docs/index.js +52 -0
  47. package/dist/pages/Docs/styles.d.ts +5 -0
  48. package/dist/pages/Docs/styles.js +14 -0
  49. package/dist/pages/Home/index.d.ts +3 -0
  50. package/dist/pages/Home/index.js +20 -0
  51. package/dist/plugin/index.d.ts +3 -0
  52. package/dist/plugin/index.js +77 -0
  53. package/dist/plugin/utils.d.ts +1 -0
  54. package/dist/plugin/utils.js +30 -0
  55. package/dist/slots/ApiHeader/BundlephobiaFilled.d.ts +3 -0
  56. package/dist/slots/ApiHeader/BundlephobiaFilled.js +15 -0
  57. package/dist/slots/ApiHeader/Graph.d.ts +3 -0
  58. package/dist/slots/ApiHeader/Graph.js +14 -0
  59. package/dist/slots/ApiHeader/NpmFilled.d.ts +3 -0
  60. package/dist/slots/ApiHeader/NpmFilled.js +16 -0
  61. package/dist/slots/ApiHeader/PackagePhobia.d.ts +3 -0
  62. package/dist/slots/ApiHeader/PackagePhobia.js +27 -0
  63. package/dist/slots/ApiHeader/Unpkg.d.ts +3 -0
  64. package/dist/slots/ApiHeader/Unpkg.js +14 -0
  65. package/dist/slots/ApiHeader/index.d.ts +3 -0
  66. package/dist/slots/ApiHeader/index.js +53 -0
  67. package/dist/slots/Content/index.d.ts +4 -0
  68. package/dist/slots/Content/index.js +49 -0
  69. package/dist/slots/Content/style.d.ts +3 -0
  70. package/dist/slots/Content/style.js +12 -0
  71. package/dist/slots/ContentFooter/Linker.d.ts +8 -0
  72. package/dist/slots/ContentFooter/Linker.js +65 -0
  73. package/dist/slots/ContentFooter/Linker.style.d.ts +6 -0
  74. package/dist/slots/ContentFooter/Linker.style.js +13 -0
  75. package/dist/slots/ContentFooter/index.d.ts +3 -0
  76. package/dist/slots/ContentFooter/index.js +35 -0
  77. package/dist/slots/ContentTabs/index.d.ts +10 -0
  78. package/dist/slots/ContentTabs/index.js +49 -0
  79. package/dist/slots/ContentTabs/style.d.ts +3 -0
  80. package/dist/slots/ContentTabs/style.js +13 -0
  81. package/dist/slots/Features/index.d.ts +3 -0
  82. package/dist/slots/Features/index.js +19 -0
  83. package/dist/slots/Footer/columns.d.ts +6 -0
  84. package/dist/slots/Footer/columns.js +81 -0
  85. package/dist/slots/Footer/index.d.ts +3 -0
  86. package/dist/slots/Footer/index.js +56 -0
  87. package/dist/slots/Footer/style.d.ts +4 -0
  88. package/dist/slots/Footer/style.js +13 -0
  89. package/dist/slots/Header/Burger.d.ts +3 -0
  90. package/dist/slots/Header/Burger.js +72 -0
  91. package/dist/slots/Header/GithubButton.d.ts +3 -0
  92. package/dist/slots/Header/GithubButton.js +18 -0
  93. package/dist/slots/Header/LangSwitch.d.ts +3 -0
  94. package/dist/slots/Header/LangSwitch.js +133 -0
  95. package/dist/slots/Header/ThemeSwitch.d.ts +3 -0
  96. package/dist/slots/Header/ThemeSwitch.js +18 -0
  97. package/dist/slots/Header/index.d.ts +3 -0
  98. package/dist/slots/Header/index.js +30 -0
  99. package/dist/slots/Hero/index.d.ts +3 -0
  100. package/dist/slots/Hero/index.js +15 -0
  101. package/dist/slots/Logo/index.d.ts +3 -0
  102. package/dist/slots/Logo/index.js +38 -0
  103. package/dist/slots/Logo/style.d.ts +1 -0
  104. package/dist/slots/Logo/style.js +9 -0
  105. package/dist/slots/Navbar/index.d.ts +3 -0
  106. package/dist/slots/Navbar/index.js +55 -0
  107. package/dist/slots/PreviewerActions/index.d.ts +13 -0
  108. package/dist/slots/PreviewerActions/index.js +109 -0
  109. package/dist/slots/PreviewerActions/style.d.ts +4 -0
  110. package/dist/slots/PreviewerActions/style.js +11 -0
  111. package/dist/slots/SearchBar/index.d.ts +3 -0
  112. package/dist/slots/SearchBar/index.js +51 -0
  113. package/dist/slots/SearchBar/style.d.ts +7 -0
  114. package/dist/slots/SearchBar/style.js +16 -0
  115. package/dist/slots/Sidebar/index.d.ts +3 -0
  116. package/dist/slots/Sidebar/index.js +35 -0
  117. package/dist/slots/Sidebar/style.d.ts +4 -0
  118. package/dist/slots/Sidebar/style.js +11 -0
  119. package/dist/slots/Toc/index.d.ts +3 -0
  120. package/dist/slots/Toc/index.js +46 -0
  121. package/dist/store/index.d.ts +17 -0
  122. package/dist/store/index.js +19 -0
  123. package/dist/store/selectors/apiHeader.d.ts +5 -0
  124. package/dist/store/selectors/apiHeader.js +62 -0
  125. package/dist/store/selectors/hero.d.ts +22 -0
  126. package/dist/store/selectors/hero.js +59 -0
  127. package/dist/store/selectors/index.d.ts +23 -0
  128. package/dist/store/selectors/index.js +71 -0
  129. package/dist/store/selectors/siteBasicInfo.d.ts +6 -0
  130. package/dist/store/selectors/siteBasicInfo.js +14 -0
  131. package/dist/store/selectors/token.d.ts +2 -0
  132. package/dist/store/selectors/token.js +5 -0
  133. package/dist/store/useSiteStore.d.ts +36 -0
  134. package/dist/store/useSiteStore.js +48 -0
  135. package/dist/store/useThemeStore.d.ts +20 -0
  136. package/dist/store/useThemeStore.js +9 -0
  137. package/dist/styles/customToken.d.ts +10 -0
  138. package/dist/styles/customToken.js +10 -0
  139. package/dist/types/config.d.ts +101 -0
  140. package/dist/types/config.js +1 -0
  141. package/dist/types/global.d.ts +16 -0
  142. package/dist/types/hero.d.ts +8 -0
  143. package/dist/types/hero.js +1 -0
  144. package/dist/types/index.d.ts +26 -0
  145. package/dist/types/index.js +7 -0
  146. package/package.json +119 -0
@@ -0,0 +1,133 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { Button } from 'antd';
8
+ import { Link, history, useLocation } from 'dumi';
9
+ import { memo, useEffect, useState } from 'react';
10
+ import NativeSelect from "../../components/NativeSelect";
11
+ import { useSiteStore } from "../../store";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ function getTargetLocalePath(_ref) {
14
+ var pathname = _ref.pathname,
15
+ current = _ref.current,
16
+ target = _ref.target;
17
+ var clearPath = 'base' in current ?
18
+ // handle '/en-US/a' => '/a' or '/en-US' => '' => '/'
19
+ pathname.replace(current.base.replace(/\/$/, ''), '') || '/' : pathname.replace(new RegExp("".concat(current.suffix, "$")), '');
20
+ return 'base' in target ? "".concat(
21
+ // for `/` base, strip duplicated leading slash
22
+ target.base.replace(/\/$/, '')).concat(clearPath) // for `/` clearPath, strip duplicated ending slash
23
+ .replace(/([^/])\/$/, '$1') : "".concat(clearPath).concat(target.suffix);
24
+ }
25
+ var languageMap = {
26
+ 'de-DE': '🇩🇪',
27
+ 'en-US': '🇺🇸',
28
+ 'es-ES': '🇪🇸',
29
+ 'fr-FR': '🇫🇷',
30
+ 'it-IT': '🇮🇹',
31
+ 'jp-JP': '🇯🇵',
32
+ 'ko-KR': '🇰🇷',
33
+ 'pt-BR': '🇧🇷',
34
+ 'ru-RU': '🇷🇺',
35
+ 'tr-TR': '🇹🇷',
36
+ 'vi-VN': '🇻🇳',
37
+ 'zh-CN': '🇨🇳'
38
+ };
39
+ var displayLangMap = {
40
+ 'en-US': 'EN',
41
+ 'zh-CN': '中'
42
+ };
43
+ var SingleSwitch = /*#__PURE__*/memo(function (_ref2) {
44
+ var locale = _ref2.locale,
45
+ current = _ref2.current;
46
+ var _useLocation = useLocation(),
47
+ pathname = _useLocation.pathname;
48
+ var _useState = useState(function () {
49
+ return getTargetLocalePath({
50
+ current: current,
51
+ pathname: pathname,
52
+ target: locale
53
+ });
54
+ }),
55
+ _useState2 = _slicedToArray(_useState, 2),
56
+ path = _useState2[0],
57
+ setPath = _useState2[1];
58
+ useEffect(function () {
59
+ setPath(getTargetLocalePath({
60
+ current: current,
61
+ pathname: pathname,
62
+ target: locale
63
+ }));
64
+ }, [pathname, current.id, locale.id]);
65
+ return /*#__PURE__*/_jsx(Link, {
66
+ to: path,
67
+ children: /*#__PURE__*/_jsx(Button, {
68
+ style: {
69
+ alignItems: 'center',
70
+ display: 'flex',
71
+ justifyContent: 'center',
72
+ minWidth: 34,
73
+ padding: 0
74
+ },
75
+ children: displayLangMap[locale.id]
76
+ })
77
+ });
78
+ });
79
+ var LangSwitch = /*#__PURE__*/memo(function () {
80
+ var locales = useSiteStore(function (s) {
81
+ return s.siteData.locales;
82
+ });
83
+ var current = useSiteStore(function (s) {
84
+ return s.locale;
85
+ });
86
+
87
+ // do not render in single language
88
+ if (locales.length <= 1) return;
89
+ return locales.length > 2 ? /*#__PURE__*/_jsx(NativeSelect, {
90
+ onChange: function onChange(index) {
91
+ console.log(getTargetLocalePath({
92
+ current: current,
93
+ pathname: location.pathname,
94
+ target: locales[index]
95
+ }));
96
+ history.push(getTargetLocalePath({
97
+ current: current,
98
+ pathname: location.pathname,
99
+ target: locales[index]
100
+ }));
101
+ },
102
+ options: locales.map(function (item) {
103
+ return {
104
+ label: displayLangMap[item.id],
105
+ value: item.id
106
+ };
107
+ }),
108
+ renderItem: function renderItem(item, index) {
109
+ return "".concat(languageMap[locales[index].id], " ").concat(locales[index].name);
110
+ },
111
+ style: {
112
+ alignItems: 'center',
113
+ display: 'flex',
114
+ height: 32,
115
+ justifyContent: 'center',
116
+ minWidth: 32,
117
+ padding: 0
118
+ },
119
+ value: locales.findIndex(function (l) {
120
+ return l.id === current.id;
121
+ })
122
+ }) :
123
+ /*#__PURE__*/
124
+ // single language switch
125
+ _jsx(SingleSwitch, {
126
+ current: current,
127
+ locale: locales.find(function (_ref3) {
128
+ var id = _ref3.id;
129
+ return id !== current.id;
130
+ })
131
+ });
132
+ });
133
+ export default LangSwitch;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const ThemeSwitch: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
3
+ export default ThemeSwitch;
@@ -0,0 +1,18 @@
1
+ import { ThemeSwitch as ThemeSwitchButton } from '@lobehub/ui';
2
+ import { memo } from 'react';
3
+ import { useThemeStore } from "../../store/useThemeStore";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ var ThemeSwitch = /*#__PURE__*/memo(function () {
6
+ var themeMode = useThemeStore(function (s) {
7
+ return s.themeMode;
8
+ });
9
+ return /*#__PURE__*/_jsx(ThemeSwitchButton, {
10
+ onThemeSwitch: function onThemeSwitch(themeMode) {
11
+ useThemeStore.setState({
12
+ themeMode: themeMode
13
+ });
14
+ },
15
+ themeMode: themeMode
16
+ });
17
+ });
18
+ export default ThemeSwitch;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const Header: import("react").NamedExoticComponent<object>;
3
+ export default Header;
@@ -0,0 +1,30 @@
1
+ import { Header as Head } from '@lobehub/ui';
2
+ import { useResponsive } from 'antd-style';
3
+ import { memo } from 'react';
4
+ import Logo from "dumi/theme/slots/Logo";
5
+ import Navbar from "dumi/theme/slots/Navbar";
6
+ import SearchBar from "dumi/theme/slots/SearchBar";
7
+ import { useSiteStore } from "../../store/useSiteStore";
8
+ import Burger from "./Burger";
9
+ import GithubButton from "./GithubButton";
10
+ import LangSwitch from "./LangSwitch";
11
+ import ThemeSwitch from "./ThemeSwitch";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { Fragment as _Fragment } from "react/jsx-runtime";
14
+ import { jsxs as _jsxs } from "react/jsx-runtime";
15
+ var Header = /*#__PURE__*/memo(function () {
16
+ var hasHeader = useSiteStore(function (s) {
17
+ return Boolean(s.routeMeta.frontmatter);
18
+ });
19
+ var _useResponsive = useResponsive(),
20
+ mobile = _useResponsive.mobile;
21
+ if (!hasHeader) return;
22
+ return /*#__PURE__*/_jsx(Head, {
23
+ actions: mobile ? /*#__PURE__*/_jsx(ThemeSwitch, {}) : /*#__PURE__*/_jsxs(_Fragment, {
24
+ children: [' ', /*#__PURE__*/_jsx(SearchBar, {}), /*#__PURE__*/_jsx(LangSwitch, {}), /*#__PURE__*/_jsx(GithubButton, {}), /*#__PURE__*/_jsx(ThemeSwitch, {})]
25
+ }),
26
+ logo: /*#__PURE__*/_jsx(Logo, {}),
27
+ nav: mobile ? /*#__PURE__*/_jsx(Burger, {}) : /*#__PURE__*/_jsx(Navbar, {})
28
+ });
29
+ });
30
+ export default Header;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const Hero: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
3
+ export default Hero;
@@ -0,0 +1,15 @@
1
+ import { Hero as H } from '@lobehub/ui';
2
+ import { memo } from 'react';
3
+ import { heroActionsSel, heroDescSel, heroTitleSel, useSiteStore } from "../../store";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ var Hero = /*#__PURE__*/memo(function () {
6
+ var title = useSiteStore(heroTitleSel);
7
+ var description = useSiteStore(heroDescSel);
8
+ var actions = useSiteStore(heroActionsSel);
9
+ return /*#__PURE__*/_jsx(H, {
10
+ actions: actions,
11
+ description: description,
12
+ title: title
13
+ });
14
+ });
15
+ export default Hero;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const Logo: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
3
+ export default Logo;
@@ -0,0 +1,38 @@
1
+ import { Logo as SiteLogo } from '@lobehub/ui';
2
+ import { useResponsive } from 'antd-style';
3
+ import { Link } from 'dumi';
4
+ import isEqual from 'fast-deep-equal';
5
+ import { memo } from 'react';
6
+ import { useSiteStore } from "../../store/useSiteStore";
7
+ import { useStyles } from "./style";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { Fragment as _Fragment } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ var Logo = /*#__PURE__*/memo(function () {
12
+ var themeConfig = useSiteStore(function (s) {
13
+ return s.siteData.themeConfig;
14
+ }, isEqual);
15
+ var locale = useSiteStore(function (s) {
16
+ return s.locale;
17
+ }, isEqual);
18
+ var _useStyles = useStyles(),
19
+ styles = _useStyles.styles,
20
+ cx = _useStyles.cx;
21
+ var _useResponsive = useResponsive(),
22
+ mobile = _useResponsive.mobile;
23
+ return themeConfig && /*#__PURE__*/_jsx(Link, {
24
+ className: cx(styles),
25
+ to: 'base' in locale ? locale.base : '/',
26
+ children: themeConfig.logo ? /*#__PURE__*/_jsxs(_Fragment, {
27
+ children: [/*#__PURE__*/_jsx("img", {
28
+ height: mobile ? 32 : 36,
29
+ src: themeConfig.logo
30
+ }), themeConfig.name]
31
+ }) : /*#__PURE__*/_jsx(SiteLogo, {
32
+ extra: themeConfig.name,
33
+ size: mobile ? 32 : 36,
34
+ type: "combine"
35
+ })
36
+ });
37
+ });
38
+ export default Logo;
@@ -0,0 +1 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<import("antd-style").SerializedStyles>;
@@ -0,0 +1,9 @@
1
+ var _templateObject;
2
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
+ import { createStyles } from 'antd-style';
4
+ export var useStyles = createStyles(function (_ref) {
5
+ var css = _ref.css,
6
+ responsive = _ref.responsive,
7
+ token = _ref.token;
8
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n align-items: center;\n\n font-size: 22px;\n font-weight: 500;\n line-height: 1;\n color: ", ";\n text-decoration: none;\n\n ", " {\n font-size: 18px;\n }\n "])), token.colorText, responsive.mobile);
9
+ });
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const Navbar: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
3
+ export default Navbar;
@@ -0,0 +1,55 @@
1
+ var _templateObject, _templateObject2;
2
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
3
+ import { TabsNav } from '@lobehub/ui';
4
+ import { createStyles } from 'antd-style';
5
+ import { Link, history } from 'dumi';
6
+ import NavbarExtra from 'dumi/theme-default/slots/NavbarExtra';
7
+ import { memo } from 'react';
8
+ import { shallow } from 'zustand/shallow';
9
+ import { activePathSel, useSiteStore } from "../../store";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { Fragment as _Fragment } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ var useStyles = createStyles(function (_ref) {
14
+ var css = _ref.css,
15
+ stylish = _ref.stylish,
16
+ token = _ref.token,
17
+ responsive = _ref.responsive;
18
+ return {
19
+ link: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n "])), stylish.resetLinkColor),
20
+ tabs: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ant-tabs-tab-active a {\n color: ", " !important;\n }\n ", " {\n display: none;\n }\n "])), token.colorText, responsive.mobile)
21
+ };
22
+ });
23
+ var Navbar = /*#__PURE__*/memo(function () {
24
+ var _useStyles = useStyles(),
25
+ styles = _useStyles.styles;
26
+ var nav = useSiteStore(function (s) {
27
+ return s.navData;
28
+ }, shallow);
29
+ var activePath = useSiteStore(activePathSel);
30
+ return /*#__PURE__*/_jsxs(_Fragment, {
31
+ children: [/*#__PURE__*/_jsx(TabsNav, {
32
+ activeKey: activePath,
33
+ className: styles.tabs,
34
+ items: nav.map(function (item) {
35
+ return {
36
+ key: String(item.activePath || item.link),
37
+ label: /*#__PURE__*/_jsx(Link, {
38
+ className: styles.link,
39
+ to: String(item.link),
40
+ children: item.title
41
+ })
42
+ };
43
+ }),
44
+ onChange: function onChange(path) {
45
+ var _nav$find;
46
+ var url = (_nav$find = nav.find(function (index) {
47
+ return index.activePath === path || index.link === path;
48
+ })) === null || _nav$find === void 0 ? void 0 : _nav$find.link;
49
+ if (!url) return;
50
+ history.push(url);
51
+ }
52
+ }), /*#__PURE__*/_jsx(NavbarExtra, {})]
53
+ });
54
+ });
55
+ export default Navbar;
@@ -0,0 +1,13 @@
1
+ import { type IPreviewerProps } from 'dumi';
2
+ import { type FC, type ReactNode } from 'react';
3
+ export interface IPreviewerActionsProps extends IPreviewerProps {
4
+ demoContainer: HTMLDivElement | HTMLIFrameElement;
5
+ /**
6
+ * disabled actions
7
+ */
8
+ disabledActions?: ('CSB' | 'STACKBLITZ' | 'EXTERNAL' | 'HTML2SKETCH')[];
9
+ extra?: ReactNode;
10
+ forceShowCode?: boolean;
11
+ }
12
+ declare const PreviewerActions: FC<IPreviewerActionsProps>;
13
+ export default PreviewerActions;
@@ -0,0 +1,109 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { ActionIcon, TabsNav } from '@lobehub/ui';
8
+ import { openCodeSandbox, openStackBlitz, useIntl } from 'dumi';
9
+ import SourceCode from "../../../example/.dumi/tmp/dumi/theme/builtins/SourceCode";
10
+ import { Code, Code2, Codesandbox, MonitorUp, Zap } from 'lucide-react';
11
+ import { useState } from 'react';
12
+ import { useStyles } from "./style";
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { jsxs as _jsxs } from "react/jsx-runtime";
15
+ import { Fragment as _Fragment } from "react/jsx-runtime";
16
+ var SIZE = {
17
+ blockSize: 24,
18
+ fontSize: 16,
19
+ strokeWidth: 2
20
+ };
21
+ var PreviewerActions = function PreviewerActions(props) {
22
+ var _files$activeKey$0$ma, _props$disabledAction, _props$disabledAction2, _props$disabledAction3;
23
+ var intl = useIntl();
24
+ var files = Object.entries(props.asset.dependencies).filter(function (_ref) {
25
+ var _ref2 = _slicedToArray(_ref, 2),
26
+ type = _ref2[1].type;
27
+ return type === 'FILE';
28
+ });
29
+ var _useState = useState(0),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ activeKey = _useState2[0],
32
+ setActiveKey = _useState2[1];
33
+ var _useState3 = useState(props.forceShowCode || props.defaultShowCode),
34
+ _useState4 = _slicedToArray(_useState3, 2),
35
+ showCode = _useState4[0],
36
+ setShowCode = _useState4[1];
37
+ var isSingleFile = files.length === 1;
38
+ var lang = ((_files$activeKey$0$ma = files[activeKey][0].match(/\.([^.]+)$/)) === null || _files$activeKey$0$ma === void 0 ? void 0 : _files$activeKey$0$ma[1]) || 'text';
39
+ var _useStyles = useStyles(),
40
+ styles = _useStyles.styles;
41
+ return /*#__PURE__*/_jsxs(_Fragment, {
42
+ children: [/*#__PURE__*/_jsxs("div", {
43
+ className: styles.actionBar,
44
+ children: [!((_props$disabledAction = props.disabledActions) !== null && _props$disabledAction !== void 0 && _props$disabledAction.includes('CSB')) && /*#__PURE__*/_jsx(ActionIcon, {
45
+ icon: Codesandbox,
46
+ onClick: function onClick() {
47
+ return openCodeSandbox(props);
48
+ },
49
+ size: SIZE,
50
+ title: intl.formatMessage({
51
+ id: 'previewer.actions.codesandbox'
52
+ })
53
+ }), !((_props$disabledAction2 = props.disabledActions) !== null && _props$disabledAction2 !== void 0 && _props$disabledAction2.includes('STACKBLITZ')) && /*#__PURE__*/_jsx(ActionIcon, {
54
+ icon: Zap,
55
+ onClick: function onClick() {
56
+ return openStackBlitz(props);
57
+ },
58
+ size: SIZE,
59
+ title: intl.formatMessage({
60
+ id: 'previewer.actions.stackblitz'
61
+ })
62
+ }), !((_props$disabledAction3 = props.disabledActions) !== null && _props$disabledAction3 !== void 0 && _props$disabledAction3.includes('EXTERNAL')) && /*#__PURE__*/_jsx("a", {
63
+ href: props.demoUrl,
64
+ rel: "noreferrer",
65
+ target: "_blank",
66
+ children: /*#__PURE__*/_jsx(ActionIcon, {
67
+ icon: MonitorUp,
68
+ size: SIZE,
69
+ title: intl.formatMessage({
70
+ id: 'previewer.actions.separate'
71
+ })
72
+ })
73
+ }), !props.forceShowCode && /*#__PURE__*/_jsx(ActionIcon, {
74
+ icon: showCode ? Code2 : Code,
75
+ onClick: function onClick() {
76
+ return setShowCode(function (previous) {
77
+ return !previous;
78
+ });
79
+ },
80
+ size: SIZE,
81
+ title: intl.formatMessage({
82
+ id: "previewer.actions.code.".concat(showCode ? 'shrink' : 'expand')
83
+ })
84
+ })]
85
+ }), showCode && /*#__PURE__*/_jsxs(_Fragment, {
86
+ children: [/*#__PURE__*/_jsx("div", {
87
+ className: styles.tabs,
88
+ children: !isSingleFile && /*#__PURE__*/_jsx(TabsNav, {
89
+ activeKey: String(activeKey),
90
+ items: files.map(function (_ref3, index) {
91
+ var _ref4 = _slicedToArray(_ref3, 1),
92
+ filename = _ref4[0];
93
+ return {
94
+ key: String(index),
95
+ label: filename
96
+ };
97
+ }),
98
+ onChange: function onChange(key) {
99
+ return setActiveKey(Number(key));
100
+ }
101
+ })
102
+ }), /*#__PURE__*/_jsx(SourceCode, {
103
+ lang: lang,
104
+ children: files[activeKey][1].value
105
+ })]
106
+ })]
107
+ });
108
+ };
109
+ export default PreviewerActions;
@@ -0,0 +1,4 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ actionBar: import("antd-style").SerializedStyles;
3
+ tabs: import("antd-style").SerializedStyles;
4
+ }>;
@@ -0,0 +1,11 @@
1
+ var _templateObject, _templateObject2;
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 token = _ref.token,
6
+ css = _ref.css;
7
+ return {
8
+ actionBar: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n gap: 8px;\n align-items: center;\n justify-content: center;\n\n height: 36px;\n "]))),
9
+ tabs: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 0 12px;\n background: ", ";\n border-top: 1px dashed ", ";\n border-bottom: 1px dashed ", ";\n "])), token.colorBgLayout, token.colorBorderSecondary, token.colorBorderSecondary)
10
+ };
11
+ });
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const SearchBar: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
3
+ export default SearchBar;
@@ -0,0 +1,51 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { SearchBar as Input } from '@lobehub/ui';
8
+ import { useSiteSearch } from 'dumi';
9
+ import SearchResult from 'dumi/theme-default/slots/SearchResult';
10
+ import { memo, useState } from 'react';
11
+ import { useStyles } from "./style";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ var SearchBar = /*#__PURE__*/memo(function () {
15
+ var _useStyles = useStyles(),
16
+ styles = _useStyles.styles;
17
+ var _useState = useState(false),
18
+ _useState2 = _slicedToArray(_useState, 2),
19
+ focusing = _useState2[0],
20
+ setFocusing = _useState2[1];
21
+ var _useSiteSearch = useSiteSearch(),
22
+ keywords = _useSiteSearch.keywords,
23
+ setKeywords = _useSiteSearch.setKeywords,
24
+ result = _useSiteSearch.result,
25
+ loading = _useSiteSearch.loading;
26
+ return /*#__PURE__*/_jsxs("div", {
27
+ className: styles.container,
28
+ children: [/*#__PURE__*/_jsx(Input, {
29
+ enableShortKey: true,
30
+ onBlur: function onBlur() {
31
+ setTimeout(function () {
32
+ setFocusing(false);
33
+ }, 1);
34
+ },
35
+ onChange: function onChange(e) {
36
+ return setKeywords(e.target.value);
37
+ },
38
+ onFocus: function onFocus() {
39
+ return setFocusing(true);
40
+ },
41
+ spotlight: true
42
+ }), keywords.trim() && focusing && (result.length > 0 || !loading) && /*#__PURE__*/_jsx("div", {
43
+ className: styles.popover,
44
+ children: /*#__PURE__*/_jsx(SearchResult, {
45
+ data: result,
46
+ loading: loading
47
+ })
48
+ })]
49
+ });
50
+ });
51
+ export default SearchBar;
@@ -0,0 +1,7 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ container: import("antd-style").SerializedStyles;
3
+ input: import("antd-style").SerializedStyles;
4
+ popover: import("antd-style").SerializedStyles;
5
+ shortcut: string;
6
+ svg: string;
7
+ }>;
@@ -0,0 +1,16 @@
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
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 token = _ref.token,
6
+ responsive = _ref.responsive,
7
+ css = _ref.css,
8
+ cx = _ref.cx;
9
+ return {
10
+ container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n // TODO: support search for mobile devices\n ", " {\n display: none;\n }\n "])), responsive.mobile),
11
+ input: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n width: 280px;\n height: ", "px;\n padding: 0;\n padding-inline-start: 40px;\n padding-inline-end: 12px;\n\n font-size: 14px;\n color: ", ";\n\n background-color: transparent;\n border: 1px solid ", ";\n border-radius: 20px;\n outline: none;\n\n transition: all 0.3s;\n\n &::input-placeholder {\n color: ", ";\n }\n\n &:focus {\n background: ", ";\n border-color: ", ";\n\n ~ .site-header-shortcut {\n opacity: 0;\n }\n }\n "])), token.controlHeightLG, token.colorTextSecondary, token.colorBorder, token.colorTextPlaceholder, token.colorBgElevated, token.colorBorderSecondary),
12
+ popover: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n top: 100%;\n inset-inline-end: 0;\n\n overflow: auto;\n overscroll-behavior: contain;\n flex: 1;\n\n width: 540px;\n min-height: 60px;\n max-height: 400px;\n margin-top: 8px;\n\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n box-shadow: ", ";\n\n -webkit-overflow-scrolling: touch;\n\n .dumi-default-search-result {\n > dl {\n > dt {\n color: ", ";\n background: ", ";\n }\n\n > dd {\n > a {\n > h4 {\n color: ", ";\n }\n\n > p {\n color: ", ";\n }\n\n &:hover {\n background: ", ";\n }\n }\n\n + dd {\n border-color: ", ";\n }\n }\n }\n\n mark {\n color: #000;\n background: ", ";\n }\n }\n "])), token.colorBgElevated, token.colorBorder, token.borderRadiusLG, token.boxShadow, token.colorText, token.colorFillTertiary, token.colorTextSecondary, token.colorTextDescription, token.colorFillSecondary, token.colorBorderSecondary, token.yellow9),
13
+ shortcut: cx('site-header-shortcut', css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n pointer-events: none;\n\n position: absolute;\n top: 50%;\n inset-inline-end: 11px;\n transform: translateY(-50%);\n\n display: inline-block;\n\n padding: 4px 8px;\n\n font-size: 12px;\n line-height: 1;\n color: ", ";\n white-space: nowrap;\n\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 11px;\n\n transition: all 0.3s;\n\n ", " {\n display: none;\n }\n "])), token.colorTextDescription, token.colorFillSecondary, token.colorBorderSecondary, responsive.mobile)),
14
+ svg: cx(css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: absolute;\n top: 50%;\n inset-inline-start: 16px;\n transform: translateY(-50%);\n\n width: 16px;\n margin-top: 1px;\n\n color: ", ";\n "])), token.colorTextPlaceholder))
15
+ };
16
+ });
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const Sidebar: import("react").NamedExoticComponent<object>;
3
+ export default Sidebar;
@@ -0,0 +1,35 @@
1
+ import { NavLink } from 'dumi';
2
+ import isEqual from 'fast-deep-equal';
3
+ import { memo } from 'react';
4
+ import { useSiteStore } from "../../store/useSiteStore";
5
+ import { useStyles } from "./style";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { jsxs as _jsxs } from "react/jsx-runtime";
8
+ var Sidebar = /*#__PURE__*/memo(function () {
9
+ var sidebar = useSiteStore(function (s) {
10
+ return s.sidebar;
11
+ }, isEqual);
12
+ var _useStyles = useStyles(),
13
+ styles = _useStyles.styles;
14
+ var isEmptySideBar = !sidebar || sidebar.length === 0;
15
+ return isEmptySideBar ? undefined : /*#__PURE__*/_jsx("section", {
16
+ className: styles.sidebarInner,
17
+ children: sidebar.map(function (item, index) {
18
+ return /*#__PURE__*/_jsxs("dl", {
19
+ children: [item.title && /*#__PURE__*/_jsx("dt", {
20
+ children: item.title
21
+ }), item.children.map(function (child) {
22
+ return /*#__PURE__*/_jsx("dd", {
23
+ children: /*#__PURE__*/_jsx(NavLink, {
24
+ end: true,
25
+ title: child.title,
26
+ to: child.link,
27
+ children: child.title
28
+ })
29
+ }, child.link);
30
+ })]
31
+ }, String(index));
32
+ })
33
+ });
34
+ });
35
+ export default Sidebar;
@@ -0,0 +1,4 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ sidebar: import("antd-style").SerializedStyles;
3
+ sidebarInner: import("antd-style").SerializedStyles;
4
+ }>;
@@ -0,0 +1,11 @@
1
+ var _templateObject, _templateObject2;
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 css = _ref.css,
6
+ token = _ref.token;
7
+ return {
8
+ sidebar: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-top: ", "px;\n "])), token.headerHeight),
9
+ sidebarInner: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: auto;\n width: 100%;\n height: 100%;\n padding: 16px;\n\n dl {\n margin: 0;\n padding: 0;\n line-height: 1;\n\n > dt {\n overflow: hidden;\n\n margin: 8px 0;\n\n font-weight: 500;\n color: ", ";\n text-overflow: ellipsis;\n text-transform: uppercase;\n white-space: nowrap;\n }\n\n > dd {\n margin: 0;\n padding: 2px 0;\n\n > a {\n overflow: hidden;\n display: block;\n\n padding: 6px 12px;\n\n font-size: ", "px;\n line-height: ", ";\n color: ", ";\n text-decoration: none;\n text-overflow: ellipsis;\n white-space: nowrap;\n\n border-radius: 6px;\n\n transition: color 600ms ", ",\n background-color 100ms ", ";\n\n &:hover {\n color: ", ";\n background: ", ";\n }\n\n &:active {\n color: ", ";\n background-color: ", ";\n }\n\n &.active {\n color: ", ";\n background-color: ", ";\n\n &:hover {\n color: ", ";\n background: ", ";\n }\n\n &:active {\n color: ", ";\n background-color: ", ";\n }\n }\n }\n }\n\n + dl {\n margin-top: 16px;\n padding-top: 16px;\n border-top: 1px dashed ", ";\n }\n }\n "])), token.colorText, token.fontSize, token.lineHeight, token.colorTextSecondary, token.motionEaseOut, token.motionEaseOut, token.colorText, token.colorFillTertiary, token.colorText, token.colorFill, token.colorText, token.colorFillSecondary, token.colorText, token.colorFillSecondary, token.colorText, token.colorFill, token.colorBorder)
10
+ };
11
+ });
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const Toc: import("react").NamedExoticComponent<object>;
3
+ export default Toc;