@antv/dumi-theme-antv 0.3.0-beta.7 → 0.3.0-beta.9
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/layouts/DocLayout.js +2 -2
- package/dist/layouts/entry/Index.js +10 -2
- package/dist/layouts/entry/Manual.js +1 -2
- package/dist/pages/404.js +4 -1
- package/dist/pages/Example/index.js +13 -2
- package/dist/pages/Example/utils.d.ts +1 -0
- package/dist/pages/Example/utils.js +9 -0
- package/dist/pages/Examples/index.js +11 -2
- package/dist/plugin/index.js +1 -0
- package/dist/slots/CodeEditor/index.js +12 -8
- package/dist/slots/CodeEditor/utils.js +1 -1
- package/dist/slots/Footer/index.module.less +1 -0
- package/dist/slots/Header/Navs.d.ts +10 -1
- package/dist/slots/Header/Navs.js +35 -24
- package/dist/slots/ManualContent/index.js +22 -10
- package/dist/slots/ManualContent/index.module.less +42 -31
- package/dist/slots/SEO.d.ts +10 -0
- package/dist/slots/SEO.js +59 -0
- package/package.json +2 -1
|
@@ -30,10 +30,10 @@ export default (function () {
|
|
|
30
30
|
if (p === '/' || p === '/zh' || p === '/en' || p === '/en/') return /*#__PURE__*/React.createElement(Index, null); // 匹配 navs 中的 docs 路由
|
|
31
31
|
|
|
32
32
|
var hasDocsRoutes = navs.filter(function (nav) {
|
|
33
|
-
return nav.slug.startsWith('docs/');
|
|
33
|
+
return nav.slug && nav.slug.startsWith('docs/');
|
|
34
34
|
});
|
|
35
35
|
var docsRoutes = hasDocsRoutes.map(function (nav) {
|
|
36
|
-
return nav.slug.split('/').find(function (item) {
|
|
36
|
+
return nav.slug && nav.slug.split('/').find(function (item) {
|
|
37
37
|
return item !== 'docs';
|
|
38
38
|
});
|
|
39
39
|
});
|
|
@@ -5,7 +5,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import { useSiteData } from 'dumi';
|
|
8
|
+
import { useLocale, useSiteData } from 'dumi';
|
|
9
|
+
import { SEO } from "../../slots/SEO";
|
|
9
10
|
import { Header } from "../../slots/Header";
|
|
10
11
|
import { Detail } from "../../slots/Detail";
|
|
11
12
|
import { Features } from "../../slots/Features";
|
|
@@ -20,6 +21,8 @@ import { useT } from "../../slots/hooks";
|
|
|
20
21
|
*/
|
|
21
22
|
|
|
22
23
|
export var Index = function Index() {
|
|
24
|
+
var locale = useLocale();
|
|
25
|
+
|
|
23
26
|
var _useSiteData = useSiteData(),
|
|
24
27
|
themeConfig = _useSiteData.themeConfig;
|
|
25
28
|
|
|
@@ -64,7 +67,12 @@ export var Index = function Index() {
|
|
|
64
67
|
style: style,
|
|
65
68
|
className: className
|
|
66
69
|
};
|
|
67
|
-
|
|
70
|
+
var metaTitle = detailProps.title;
|
|
71
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SEO, {
|
|
72
|
+
title: "".concat(metaTitle[locale.id]),
|
|
73
|
+
titleSuffix: "AntV",
|
|
74
|
+
lang: locale.id
|
|
75
|
+
}), /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(Detail, detailProps), /*#__PURE__*/React.createElement(Features, featuresProps), /*#__PURE__*/React.createElement(Cases, casesProps), /*#__PURE__*/React.createElement(Companies, {
|
|
68
76
|
title: useT("感谢信赖"),
|
|
69
77
|
companies: companies
|
|
70
78
|
}), /*#__PURE__*/React.createElement(Footer, null));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ManualContent } from "../../slots/ManualContent";
|
|
3
3
|
import { Header } from "../../slots/Header";
|
|
4
|
-
import { Footer } from "../../slots/Footer";
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Manual 路由下的入口
|
|
@@ -10,5 +9,5 @@ export var Manual = function Manual(_ref) {
|
|
|
10
9
|
var children = _ref.children;
|
|
11
10
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, {
|
|
12
11
|
isHomePage: false
|
|
13
|
-
}), /*#__PURE__*/React.createElement(ManualContent, null, " ", children, " ")
|
|
12
|
+
}), /*#__PURE__*/React.createElement(ManualContent, null, " ", children, " "));
|
|
14
13
|
};
|
package/dist/pages/404.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { SEO } from "../slots/SEO";
|
|
2
3
|
import { Header } from "../slots/Header";
|
|
3
4
|
import { NotFound as NotFoundPage } from "../slots/404";
|
|
4
5
|
import { Footer } from "../slots/Footer";
|
|
@@ -7,7 +8,9 @@ import { Footer } from "../slots/Footer";
|
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
var NotFound = function NotFound() {
|
|
10
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
11
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SEO, {
|
|
12
|
+
title: "404: Not found"
|
|
13
|
+
}), /*#__PURE__*/React.createElement(Header, {
|
|
11
14
|
isHomePage: false
|
|
12
15
|
}), /*#__PURE__*/React.createElement(NotFoundPage, null), /*#__PURE__*/React.createElement(Footer, null));
|
|
13
16
|
};
|
|
@@ -15,12 +15,14 @@ import { useParams, useLocation, useNavigate } from 'react-router-dom';
|
|
|
15
15
|
import { get } from 'lodash-es';
|
|
16
16
|
import { Layout } from 'antd';
|
|
17
17
|
import { useLocale, useSiteData } from 'dumi';
|
|
18
|
+
import { SEO } from "../../slots/SEO";
|
|
18
19
|
import { Header } from "../../slots/Header";
|
|
19
20
|
import { ExampleSider } from "../../slots/ExampleSider";
|
|
20
21
|
import { CodeRunner } from "../../slots/CodeRunner";
|
|
21
22
|
import { getDemoInfo } from "../../slots/CodeRunner/utils";
|
|
22
23
|
import { ThemeAntVContext } from "../../context";
|
|
23
24
|
import styles from "./index.module.less";
|
|
25
|
+
import { getCurrentTitle } from "./utils";
|
|
24
26
|
var Sider = Layout.Sider,
|
|
25
27
|
Content = Layout.Content;
|
|
26
28
|
|
|
@@ -58,15 +60,24 @@ var Example = function Example() {
|
|
|
58
60
|
isCollapsed = _useState4[0],
|
|
59
61
|
setIsCollapsed = _useState4[1];
|
|
60
62
|
|
|
63
|
+
var _useState5 = useState({}),
|
|
64
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
65
|
+
title = _useState6[0],
|
|
66
|
+
setTitle = _useState6[1];
|
|
67
|
+
|
|
61
68
|
useEffect(function () {
|
|
62
69
|
if (topic && example && demo) {
|
|
63
70
|
var targetDemoInfo = getDemoInfo(exampleTopics, topic, example, demo);
|
|
64
71
|
setCurrentDemo(targetDemoInfo);
|
|
72
|
+
setTitle(getCurrentTitle(exampleTopics, topic, example));
|
|
65
73
|
}
|
|
66
74
|
}, [topic, example, hash]);
|
|
67
75
|
return /*#__PURE__*/React.createElement("div", {
|
|
68
76
|
className: styles.example
|
|
69
|
-
}, /*#__PURE__*/React.createElement(
|
|
77
|
+
}, /*#__PURE__*/React.createElement(SEO, {
|
|
78
|
+
title: title[locale.id],
|
|
79
|
+
lang: locale.id
|
|
80
|
+
}), /*#__PURE__*/React.createElement(Header, {
|
|
70
81
|
isHomePage: false
|
|
71
82
|
}), /*#__PURE__*/React.createElement(Layout, {
|
|
72
83
|
className: styles.container
|
|
@@ -97,7 +108,7 @@ var Example = function Example() {
|
|
|
97
108
|
topic: topic,
|
|
98
109
|
example: example,
|
|
99
110
|
demo: demo,
|
|
100
|
-
size: get(themeConfig, 'editor.size', 0.
|
|
111
|
+
size: get(themeConfig, 'editor.size', 0.38)
|
|
101
112
|
}))));
|
|
102
113
|
};
|
|
103
114
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCurrentTitle(exampleTopics: any, topic: any, example: any): any;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function getCurrentTitle(exampleTopics, topic, example) {
|
|
2
|
+
var topicItem = exampleTopics.find(function (item) {
|
|
3
|
+
return item.id === topic;
|
|
4
|
+
});
|
|
5
|
+
var exmapleItem = topicItem.examples.find(function (item) {
|
|
6
|
+
return item.id === example;
|
|
7
|
+
});
|
|
8
|
+
return exmapleItem.title;
|
|
9
|
+
}
|
|
@@ -14,6 +14,8 @@ import React from 'react';
|
|
|
14
14
|
import { useContext, useEffect } from 'react';
|
|
15
15
|
import { useNavigate } from 'react-router-dom';
|
|
16
16
|
import { BackTop, Layout as AntLayout } from 'antd';
|
|
17
|
+
import { useLocale } from 'dumi';
|
|
18
|
+
import { SEO } from "../../slots/SEO";
|
|
17
19
|
import { Header } from "../../slots/Header";
|
|
18
20
|
import { Footer } from "../../slots/Footer";
|
|
19
21
|
import NavigatorBanner from "../../slots/Header/Products/NavigatorBanner";
|
|
@@ -32,6 +34,7 @@ import styles from "./index.module.less";
|
|
|
32
34
|
|
|
33
35
|
var Example = function Example() {
|
|
34
36
|
var nav = useNavigate();
|
|
37
|
+
var locale = useLocale();
|
|
35
38
|
/** 示例页面的元数据信息 */
|
|
36
39
|
|
|
37
40
|
var metaData = useContext(ThemeAntVContext);
|
|
@@ -40,8 +43,12 @@ var Example = function Example() {
|
|
|
40
43
|
var _usePrevAndNext = usePrevAndNext(),
|
|
41
44
|
_usePrevAndNext2 = _slicedToArray(_usePrevAndNext, 2),
|
|
42
45
|
prev = _usePrevAndNext2[0],
|
|
43
|
-
next = _usePrevAndNext2[1];
|
|
46
|
+
next = _usePrevAndNext2[1];
|
|
44
47
|
|
|
48
|
+
var title = {
|
|
49
|
+
zh: '所有图表',
|
|
50
|
+
en: "Gallery"
|
|
51
|
+
}; // 为 zh 做兜底
|
|
45
52
|
|
|
46
53
|
useEffect(function () {
|
|
47
54
|
var p = window.location.pathname;
|
|
@@ -50,7 +57,9 @@ var Example = function Example() {
|
|
|
50
57
|
nav(p.replace('/zh/', '/'));
|
|
51
58
|
}
|
|
52
59
|
}, []);
|
|
53
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
60
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SEO, {
|
|
61
|
+
title: title[locale.id]
|
|
62
|
+
}), /*#__PURE__*/React.createElement(Header, {
|
|
54
63
|
isHomePage: false
|
|
55
64
|
}), /*#__PURE__*/React.createElement(AntLayout, {
|
|
56
65
|
hasSider: true,
|
package/dist/plugin/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import React, { useRef, useState, useCallback, useEffect } from 'react';
|
|
|
14
14
|
import MonacoEditor, { loader } from '@monaco-editor/react';
|
|
15
15
|
import { useSiteData, useLocale } from 'dumi';
|
|
16
16
|
import { debounce, noop } from 'lodash-es';
|
|
17
|
+
import { bind, clear } from 'size-sensor';
|
|
17
18
|
import { replaceInsertCss, execute, compile } from "./utils";
|
|
18
19
|
import { Toolbar, EDITOR_TABS } from "./Toolbar";
|
|
19
20
|
import { Loading } from "../Loading";
|
|
@@ -86,15 +87,15 @@ export var CodeEditor = function CodeEditor(_ref) {
|
|
|
86
87
|
window.dispatchEvent(e);
|
|
87
88
|
};
|
|
88
89
|
|
|
89
|
-
var reportError = useCallback(
|
|
90
|
+
var reportError = useCallback(function (e) {
|
|
90
91
|
if (e) {
|
|
91
|
-
console.
|
|
92
|
+
console.log(e);
|
|
92
93
|
onError(e);
|
|
93
|
-
e
|
|
94
|
+
e.preventDefault && e.preventDefault();
|
|
94
95
|
} else {
|
|
95
96
|
onError(null);
|
|
96
97
|
}
|
|
97
|
-
},
|
|
98
|
+
}, []);
|
|
98
99
|
useEffect(function () {
|
|
99
100
|
// 用于上报错误信息,使用 script 执行代码
|
|
100
101
|
if (typeof window !== 'undefined') {
|
|
@@ -113,16 +114,14 @@ export var CodeEditor = function CodeEditor(_ref) {
|
|
|
113
114
|
window.removeEventListener('unhandledrejection', reportError);
|
|
114
115
|
}
|
|
115
116
|
};
|
|
116
|
-
});
|
|
117
|
+
}, []);
|
|
117
118
|
var executeCode = useCallback(debounce(function (v) {
|
|
118
119
|
if (!v) return; // 1. 先编译代码
|
|
119
120
|
|
|
120
121
|
var compiled;
|
|
121
122
|
|
|
122
123
|
try {
|
|
123
|
-
compiled = compile(replaceInsertCss(v, locale.id), relativePath);
|
|
124
|
-
|
|
125
|
-
reportError(null);
|
|
124
|
+
compiled = compile(replaceInsertCss(v, locale.id), relativePath);
|
|
126
125
|
} catch (e) {
|
|
127
126
|
reportError(e); // 执行出错,后面的步骤不用做了!
|
|
128
127
|
|
|
@@ -139,6 +138,10 @@ export var CodeEditor = function CodeEditor(_ref) {
|
|
|
139
138
|
executeCode(code);
|
|
140
139
|
}, [code]);
|
|
141
140
|
useEffect(function () {
|
|
141
|
+
var dom = document.getElementById('playgroundScriptContainer');
|
|
142
|
+
bind(dom, debounce(function () {
|
|
143
|
+
dispatchResizeEvent();
|
|
144
|
+
}, 100));
|
|
142
145
|
onReady();
|
|
143
146
|
|
|
144
147
|
if (playground !== null && playground !== void 0 && playground.playgroundDidMount) {
|
|
@@ -146,6 +149,7 @@ export var CodeEditor = function CodeEditor(_ref) {
|
|
|
146
149
|
}
|
|
147
150
|
|
|
148
151
|
return function () {
|
|
152
|
+
clear(dom);
|
|
149
153
|
onDestroy();
|
|
150
154
|
|
|
151
155
|
if (playground !== null && playground !== void 0 && playground.playgroundWillUnmount) {
|
|
@@ -135,7 +135,7 @@ export function execute(code, playgroundScriptContainer, container) {
|
|
|
135
135
|
var script = document.createElement('script'); // replace container id in case of multi demos in document
|
|
136
136
|
|
|
137
137
|
var newCode = code.replace(/'container'|"container"/, "'".concat(replaceId, "'"));
|
|
138
|
-
script.innerHTML = "\n// Can only have one anonymous define call per script file\n// \u548C monaco loader \u52A0\u8F7D\u51B2\u7A81\nvar __runnerDefine = window['define'];\nwindow['define'] = null;\ntry {\n ".concat(newCode, "\n\n window.__reportErrorInPlayground && window.__reportErrorInPlayground(null);\n} catch(e) {\n window.__reportErrorInPlayground && window.__reportErrorInPlayground(e);\n} finally {\n window['define'] = __runnerDefine;\n}\n "); // 追加图表容器
|
|
138
|
+
script.innerHTML = "\n// Can only have one anonymous define call per script file\n// \u548C monaco loader \u52A0\u8F7D\u51B2\u7A81\nvar __runnerDefine = window['define'];\nwindow['define'] = null;\ntry {\n ".concat(newCode, "\n\n // \u6E05\u9664\u663E\u793A\u7684\u9519\u8BEF\n window.__reportErrorInPlayground && window.__reportErrorInPlayground(null);\n} catch(e) {\n window.__reportErrorInPlayground && window.__reportErrorInPlayground(e);\n} finally {\n window['define'] = __runnerDefine;\n}\n "); // 追加图表容器
|
|
139
139
|
|
|
140
140
|
node.innerHTML = container || "<div id=".concat(replaceId, " />"); // 运行 script
|
|
141
141
|
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
declare type dropdownItem = {
|
|
3
|
+
label: {
|
|
4
|
+
[key: string]: string;
|
|
5
|
+
};
|
|
6
|
+
key: string;
|
|
7
|
+
};
|
|
2
8
|
export declare type INav = {
|
|
3
|
-
slug
|
|
9
|
+
slug?: string;
|
|
4
10
|
order: number;
|
|
5
11
|
title: {
|
|
6
12
|
[key: string]: string;
|
|
7
13
|
};
|
|
8
14
|
target?: '_blank';
|
|
15
|
+
notPage?: boolean;
|
|
16
|
+
dropdownItems?: dropdownItem[];
|
|
9
17
|
};
|
|
10
18
|
export declare type NavProps = {
|
|
11
19
|
navs: INav[];
|
|
@@ -15,3 +23,4 @@ export declare type NavProps = {
|
|
|
15
23
|
* Header 中的导航菜单
|
|
16
24
|
*/
|
|
17
25
|
export declare const Navs: React.FC<NavProps>;
|
|
26
|
+
export {};
|
|
@@ -3,46 +3,57 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import cx from 'classnames';
|
|
5
5
|
import { isEqual } from 'lodash-es';
|
|
6
|
-
import { LinkOutlined } from '@ant-design/icons';
|
|
7
6
|
import { Link, useLocale } from 'dumi';
|
|
7
|
+
import { Dropdown, Menu } from 'antd';
|
|
8
|
+
import { DownOutlined, LinkOutlined } from '@ant-design/icons';
|
|
8
9
|
import styles from "./index.module.less";
|
|
9
10
|
|
|
10
|
-
var getDocument = function getDocument(navs) {
|
|
11
|
-
var slug = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
12
|
-
return navs.find(function (doc) {
|
|
13
|
-
return doc.slug === slug;
|
|
14
|
-
}) || {
|
|
15
|
-
title: {}
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
11
|
/**
|
|
19
12
|
* Header 中的导航菜单
|
|
20
13
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
14
|
export var Navs = function Navs(_ref) {
|
|
24
15
|
var navs = _ref.navs,
|
|
25
16
|
path = _ref.path;
|
|
26
17
|
var locale = useLocale();
|
|
27
18
|
return /*#__PURE__*/React.createElement(React.Fragment, null, navs.map(function (nav) {
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
var title = nav.title[locale.id];
|
|
20
|
+
var href = '';
|
|
21
|
+
var className = '';
|
|
22
|
+
|
|
23
|
+
if (nav.slug) {
|
|
24
|
+
href = nav.slug.startsWith('http') ? nav.slug : "/".concat(nav.slug);
|
|
33
25
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
if (locale.id == 'en' && !href.startsWith('http')) {
|
|
27
|
+
href = "/en".concat(href);
|
|
28
|
+
} // 去除 docs 防止二次点击相同nav跳转出现04
|
|
37
29
|
|
|
38
30
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
href = href.replace('/docs/', '/');
|
|
32
|
+
className = cx('header-menu-item-active', _defineProperty({}, styles.activeItem, path.startsWith(href) || isEqual(path.split('/').slice(0, 4), href.split('/').slice(0, 4))));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return nav.notPage ? /*#__PURE__*/React.createElement("li", {
|
|
36
|
+
key: title,
|
|
37
|
+
className: className
|
|
38
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
39
|
+
className: styles.ecoSystems,
|
|
40
|
+
placement: "bottom",
|
|
41
|
+
overlay: /*#__PURE__*/React.createElement(Menu, null, nav.dropdownItems.map(function (_ref2) {
|
|
42
|
+
var label = _ref2.label,
|
|
43
|
+
key = _ref2.key;
|
|
44
|
+
return /*#__PURE__*/React.createElement(Menu.Item, {
|
|
45
|
+
key: key
|
|
46
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
47
|
+
target: "_blank",
|
|
48
|
+
rel: "noreferrer",
|
|
49
|
+
href: key
|
|
50
|
+
}, label[locale.id], " ", /*#__PURE__*/React.createElement(LinkOutlined, null)));
|
|
51
|
+
}))
|
|
52
|
+
}, /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(DownOutlined, null)))) : /*#__PURE__*/React.createElement("li", {
|
|
42
53
|
key: title,
|
|
43
54
|
className: className
|
|
44
|
-
}, nav.target === '_blank' ||
|
|
45
|
-
href:
|
|
55
|
+
}, nav.target === '_blank' || href.startsWith('http') ? /*#__PURE__*/React.createElement("a", {
|
|
56
|
+
href: href,
|
|
46
57
|
target: "_blank",
|
|
47
58
|
rel: "noreferrer"
|
|
48
59
|
}, title, /*#__PURE__*/React.createElement(LinkOutlined, null)) : /*#__PURE__*/React.createElement(Link, {
|
|
@@ -26,10 +26,12 @@ import { useLocale, useSiteData, useFullSidebarData, useRouteMeta } from 'dumi';
|
|
|
26
26
|
import { useNavigate } from "react-router-dom";
|
|
27
27
|
import { EditOutlined, MenuFoldOutlined, MenuUnfoldOutlined, VerticalAlignTopOutlined } from '@ant-design/icons';
|
|
28
28
|
import readingTime from 'reading-time';
|
|
29
|
+
import { SEO } from "../SEO";
|
|
29
30
|
import { getBaseRoute, getIndexRoute, getOpenKeys } from "./utils";
|
|
30
31
|
import { NavigatorBanner } from "./NavigatorBanner";
|
|
31
32
|
import ReadingTime from "./ReadingTime";
|
|
32
33
|
import { TOC } from "../TOC";
|
|
34
|
+
import { Footer } from "../Footer";
|
|
33
35
|
import { useScrollToTop } from "../hooks";
|
|
34
36
|
import 'rc-drawer/assets/index.css';
|
|
35
37
|
import styles from "./index.module.less";
|
|
@@ -49,7 +51,8 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
49
51
|
docs = _useSiteData$themeCon.docs;
|
|
50
52
|
|
|
51
53
|
var sidebar = useFullSidebarData();
|
|
52
|
-
var
|
|
54
|
+
var is767Wide = useMedia('(min-width: 767.99px)', true);
|
|
55
|
+
var is991Wide = useMedia('(min-width: 991.99px)', true);
|
|
53
56
|
|
|
54
57
|
var _useState = useState(false),
|
|
55
58
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -262,7 +265,10 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
262
265
|
forceSubMenuRender: true,
|
|
263
266
|
triggerSubMenuAction: "click"
|
|
264
267
|
});
|
|
265
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
268
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SEO, {
|
|
269
|
+
title: linkoTitle[window.location.pathname],
|
|
270
|
+
lang: locale.id
|
|
271
|
+
}), /*#__PURE__*/React.createElement(Layout, {
|
|
266
272
|
style: {
|
|
267
273
|
background: '#fff'
|
|
268
274
|
},
|
|
@@ -272,9 +278,9 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
272
278
|
offsetTop: 0,
|
|
273
279
|
className: styles.affix,
|
|
274
280
|
style: {
|
|
275
|
-
height:
|
|
281
|
+
height: is767Wide ? '100vh' : 'inherit'
|
|
276
282
|
}
|
|
277
|
-
},
|
|
283
|
+
}, is767Wide ? /*#__PURE__*/React.createElement(Layout.Sider, {
|
|
278
284
|
width: "auto",
|
|
279
285
|
theme: "light",
|
|
280
286
|
className: styles.sider
|
|
@@ -292,8 +298,10 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
292
298
|
}, menu)), /*#__PURE__*/React.createElement(Layout.Content, {
|
|
293
299
|
className: styles.content
|
|
294
300
|
}, /*#__PURE__*/React.createElement("div", {
|
|
295
|
-
className: styles.
|
|
296
|
-
}, /*#__PURE__*/React.createElement("h1",
|
|
301
|
+
className: styles.main
|
|
302
|
+
}, /*#__PURE__*/React.createElement("h1", {
|
|
303
|
+
className: styles.contentTitle
|
|
304
|
+
}, linkoTitle[window.location.pathname], /*#__PURE__*/React.createElement(Tooltip, {
|
|
297
305
|
title: '在 GitHub 上编辑'
|
|
298
306
|
}, /*#__PURE__*/React.createElement("a", {
|
|
299
307
|
href: getGithubSourceUrl({
|
|
@@ -304,10 +312,12 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
304
312
|
target: "_blank",
|
|
305
313
|
rel: "noopener noreferrer",
|
|
306
314
|
className: styles.editOnGtiHubButton
|
|
307
|
-
}, /*#__PURE__*/React.createElement(EditOutlined, null)))), /*#__PURE__*/React.createElement(
|
|
315
|
+
}, /*#__PURE__*/React.createElement(EditOutlined, null)))), /*#__PURE__*/React.createElement("div", {
|
|
316
|
+
className: styles.readtimeContainer
|
|
317
|
+
}, /*#__PURE__*/React.createElement(ReadingTime, {
|
|
308
318
|
readingTime: time,
|
|
309
319
|
className: styles.readtime
|
|
310
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
320
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
311
321
|
className: styles.markdown
|
|
312
322
|
}, children), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
313
323
|
className: styles.preandnext
|
|
@@ -323,10 +333,12 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
323
333
|
}
|
|
324
334
|
}, /*#__PURE__*/React.createElement("div", {
|
|
325
335
|
className: styles.backTop
|
|
326
|
-
}, /*#__PURE__*/React.createElement(VerticalAlignTopOutlined, null))))))
|
|
336
|
+
}, /*#__PURE__*/React.createElement(VerticalAlignTopOutlined, null)))))), /*#__PURE__*/React.createElement(Footer, {
|
|
337
|
+
className: styles.footer
|
|
338
|
+
})), is991Wide ? /*#__PURE__*/React.createElement(Layout.Sider, {
|
|
327
339
|
theme: "light",
|
|
328
340
|
width: 260
|
|
329
341
|
}, /*#__PURE__*/React.createElement(Affix, {
|
|
330
342
|
className: styles.toc
|
|
331
|
-
}, /*#__PURE__*/React.createElement(TOC, null)))));
|
|
343
|
+
}, /*#__PURE__*/React.createElement(TOC, null))) : /*#__PURE__*/React.createElement("div", null)));
|
|
332
344
|
};
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
.main {
|
|
206
|
-
width:
|
|
206
|
+
width: 100%;
|
|
207
207
|
padding-left: 48px;
|
|
208
208
|
padding-right: 24px;
|
|
209
209
|
overflow: hidden;
|
|
@@ -236,21 +236,39 @@
|
|
|
236
236
|
|
|
237
237
|
// reference yuque UI
|
|
238
238
|
.toc {
|
|
239
|
-
:
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
239
|
+
width: @toc-width;
|
|
240
|
+
float: right;
|
|
241
|
+
font-size: 12px;
|
|
242
|
+
background: #fff;
|
|
243
|
+
max-height: 100vh;
|
|
244
|
+
overflow: scroll;
|
|
245
|
+
|
|
246
|
+
position: sticky;
|
|
247
|
+
top: 0;
|
|
248
|
+
|
|
249
|
+
ul>li {
|
|
250
|
+
list-style: none !important;
|
|
251
|
+
padding: 0 !important;
|
|
252
|
+
margin-left: 1em !important;
|
|
253
|
+
|
|
254
|
+
// 超出部分省略号显示
|
|
255
|
+
text-overflow: ellipsis;
|
|
256
|
+
overflow: hidden;
|
|
257
|
+
white-space: nowrap;
|
|
258
|
+
|
|
259
|
+
a {
|
|
260
|
+
color: @text-color;
|
|
250
261
|
}
|
|
251
262
|
}
|
|
252
263
|
}
|
|
253
|
-
|
|
264
|
+
.contentTitle{
|
|
265
|
+
margin-top: 8px;
|
|
266
|
+
margin-bottom: 20px;
|
|
267
|
+
font-weight: 500;
|
|
268
|
+
font-size: 30px;
|
|
269
|
+
font-family: Avenir, -apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
|
|
270
|
+
line-height: 38px;
|
|
271
|
+
}
|
|
254
272
|
.sider {
|
|
255
273
|
width: 280px !important;
|
|
256
274
|
height: inherit;
|
|
@@ -460,16 +478,11 @@
|
|
|
460
478
|
padding-left: 32px;
|
|
461
479
|
padding-right: 32px;
|
|
462
480
|
}
|
|
463
|
-
|
|
464
|
-
.toc {
|
|
465
|
-
display: none;
|
|
466
|
-
}
|
|
467
481
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
width: 240px !important;
|
|
482
|
+
.tocSiderbar {
|
|
483
|
+
display: none;
|
|
471
484
|
}
|
|
472
|
-
|
|
485
|
+
|
|
473
486
|
.gallery {
|
|
474
487
|
.galleryCard {
|
|
475
488
|
width: 50%;
|
|
@@ -487,11 +500,9 @@
|
|
|
487
500
|
}
|
|
488
501
|
|
|
489
502
|
.sider {
|
|
490
|
-
width: 100% !important;
|
|
491
503
|
margin-bottom: 32px;
|
|
492
504
|
padding-bottom: 32px;
|
|
493
505
|
border-bottom: 1px solid #e8e8e8;
|
|
494
|
-
display: none;
|
|
495
506
|
}
|
|
496
507
|
|
|
497
508
|
.markdown {
|
|
@@ -596,19 +607,17 @@
|
|
|
596
607
|
margin-bottom: 20px;
|
|
597
608
|
font-weight: 500;
|
|
598
609
|
font-size: 30px;
|
|
599
|
-
font-family: Avenir, -apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
|
|
600
610
|
line-height: 38px;
|
|
601
611
|
}
|
|
602
612
|
|
|
603
613
|
.content {
|
|
604
|
-
|
|
605
|
-
justify-content: center;
|
|
614
|
+
width: 100% !important;
|
|
606
615
|
min-width: 400px;
|
|
616
|
+
justify-content: center;
|
|
617
|
+
}
|
|
607
618
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
padding: 0 24px 0 48px;
|
|
611
|
-
}
|
|
619
|
+
.footer {
|
|
620
|
+
width: 100%;
|
|
612
621
|
}
|
|
613
622
|
|
|
614
623
|
.menuSwitch {
|
|
@@ -632,8 +641,10 @@
|
|
|
632
641
|
|
|
633
642
|
|
|
634
643
|
|
|
635
|
-
.
|
|
644
|
+
.readtimeContainer{
|
|
636
645
|
margin-bottom: 1.2em;
|
|
646
|
+
}
|
|
647
|
+
.readtime {
|
|
637
648
|
color: #0d1a26;
|
|
638
649
|
line-height: 1.5715;
|
|
639
650
|
list-style: none;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useSiteData } from 'dumi';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Helmet } from 'react-helmet';
|
|
4
|
+
export var SEO = function SEO(_ref) {
|
|
5
|
+
var description = _ref.description,
|
|
6
|
+
_ref$lang = _ref.lang,
|
|
7
|
+
lang = _ref$lang === void 0 ? '' : _ref$lang,
|
|
8
|
+
_ref$meta = _ref.meta,
|
|
9
|
+
meta = _ref$meta === void 0 ? [] : _ref$meta,
|
|
10
|
+
title = _ref.title,
|
|
11
|
+
titleSuffix = _ref.titleSuffix;
|
|
12
|
+
|
|
13
|
+
var _useSiteData = useSiteData(),
|
|
14
|
+
themeConfig = _useSiteData.themeConfig;
|
|
15
|
+
|
|
16
|
+
var defaultTitle = themeConfig.title,
|
|
17
|
+
defaultDescription = themeConfig.defaultDescription;
|
|
18
|
+
var metaDescription = description || defaultDescription;
|
|
19
|
+
return /*#__PURE__*/React.createElement(Helmet, {
|
|
20
|
+
htmlAttributes: {
|
|
21
|
+
lang: lang
|
|
22
|
+
},
|
|
23
|
+
title: title,
|
|
24
|
+
titleTemplate: "%s | ".concat(titleSuffix || defaultTitle),
|
|
25
|
+
meta: [{
|
|
26
|
+
name: "description",
|
|
27
|
+
content: metaDescription
|
|
28
|
+
}, {
|
|
29
|
+
property: "og:title",
|
|
30
|
+
content: title
|
|
31
|
+
}, {
|
|
32
|
+
property: "og:description",
|
|
33
|
+
content: metaDescription
|
|
34
|
+
}, {
|
|
35
|
+
property: "og:image",
|
|
36
|
+
content: 'https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png'
|
|
37
|
+
}, {
|
|
38
|
+
property: "og:type",
|
|
39
|
+
content: "website"
|
|
40
|
+
}, {
|
|
41
|
+
name: "twitter:card",
|
|
42
|
+
content: "summary"
|
|
43
|
+
}, {
|
|
44
|
+
name: "twitter:title",
|
|
45
|
+
content: title
|
|
46
|
+
}, {
|
|
47
|
+
name: "twitter:description",
|
|
48
|
+
content: metaDescription
|
|
49
|
+
}, {
|
|
50
|
+
property: "twitter:image",
|
|
51
|
+
content: 'https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png'
|
|
52
|
+
}].concat(meta)
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
SEO.defaultProps = {
|
|
56
|
+
lang: "zh",
|
|
57
|
+
meta: [],
|
|
58
|
+
description: ""
|
|
59
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/dumi-theme-antv",
|
|
3
|
-
"version": "0.3.0-beta.
|
|
3
|
+
"version": "0.3.0-beta.9",
|
|
4
4
|
"description": "AntV website theme based on dumi2.",
|
|
5
5
|
"types": "dist/types.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"react-split-pane": "^0.1.92",
|
|
82
82
|
"react-use": "^17.4.0",
|
|
83
83
|
"reading-time": "^1.5.0",
|
|
84
|
+
"size-sensor": "^1.0.1",
|
|
84
85
|
"slick-carousel": "^1.8.1",
|
|
85
86
|
"uri-parse": "^1.0.0"
|
|
86
87
|
},
|