@antv/dumi-theme-antv 0.3.0-beta.3 → 0.3.0-beta.5
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 +13 -9
- package/dist/pages/Example/index.js +8 -49
- package/dist/pages/Example/index.module.less +50 -8
- package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +1 -1
- package/dist/pages/Examples/index.js +13 -2
- package/dist/pages/Examples/index.module.less +2 -0
- package/dist/plugin/examples.d.ts +10 -5
- package/dist/plugin/examples.js +6 -3
- package/dist/plugin/index.js +4 -0
- package/dist/slots/Cases/index.d.ts +1 -0
- package/dist/slots/CodeEditor/Toolbar.js +4 -16
- package/dist/slots/CodeEditor/index.js +8 -2
- package/dist/slots/CodePreview/CodeHeader.js +2 -2
- package/dist/slots/CodePreview/index.module.less +3 -5
- package/dist/slots/CodeRunner/index.d.ts +2 -2
- package/dist/slots/CodeRunner/index.js +4 -2
- package/dist/slots/CodeRunner/utils.d.ts +3 -2
- package/dist/slots/CodeRunner/utils.js +1 -1
- package/dist/slots/Detail/News.d.ts +1 -0
- package/dist/slots/Detail/index.d.ts +1 -0
- package/dist/slots/Detail/index.js +1 -1
- package/dist/slots/ExampleSider/index.d.ts +0 -35
- package/dist/slots/ExampleSider/index.js +20 -42
- package/dist/slots/ExampleSider/index.module.less +1 -1
- package/dist/slots/Features/FeatureCard.d.ts +1 -0
- package/dist/slots/Features/index.js +2 -1
- package/dist/slots/Header/Navs.js +3 -1
- package/dist/slots/Header/index.js +8 -7
- package/dist/slots/Loading/index.d.ts +6 -1
- package/dist/slots/Loading/index.js +24 -10
- package/dist/slots/Loading/index.module.less +276 -9
- package/dist/slots/ManualContent/index.js +19 -9
- package/dist/slots/hooks.d.ts +3 -3
- package/dist/slots/utils.d.ts +4 -19
- package/dist/slots/utils.js +77 -119
- package/dist/types.d.ts +84 -0
- package/dist/typings.d.ts +0 -116
- package/package.json +4 -4
- package/dist/slots/Loading.d.ts +0 -5
- package/dist/slots/Loading.js +0 -8
|
@@ -4,14 +4,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
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
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
-
|
|
9
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
-
|
|
11
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
|
-
|
|
13
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
14
|
-
|
|
15
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
8
|
|
|
17
9
|
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."); }
|
|
@@ -29,10 +21,10 @@ import { Input, Menu, Tooltip } from 'antd';
|
|
|
29
21
|
import { useLocale } from 'dumi';
|
|
30
22
|
import { createFromIconfontCN, SearchOutlined, VerticalAlignTopOutlined } from '@ant-design/icons';
|
|
31
23
|
import classNames from 'classnames';
|
|
32
|
-
import { reduce, size } from 'lodash-es';
|
|
33
24
|
import { useT } from "../hooks";
|
|
34
25
|
import styles from "./index.module.less";
|
|
35
|
-
// menu icon
|
|
26
|
+
import { filterTreeNode } from "../utils"; // menu icon
|
|
27
|
+
|
|
36
28
|
var MenuIcon = createFromIconfontCN({
|
|
37
29
|
scriptUrl: '//at.alicdn.com/t/font_470089_1lnym745udm.js' // generated by iconfont.cn
|
|
38
30
|
|
|
@@ -64,37 +56,23 @@ export var ExampleSider = function ExampleSider(props) {
|
|
|
64
56
|
searchValue = _useState6[0],
|
|
65
57
|
setSearchValue = _useState6[1];
|
|
66
58
|
|
|
67
|
-
var locale = useLocale();
|
|
68
|
-
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return value;
|
|
85
|
-
}, []);
|
|
86
|
-
}; // 获取默认展开的keys数组 传入treeData 和 底层的 key 返回符合条件的 keys
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var getDefaultOpenKeys = function getDefaultOpenKeys(data, key) {
|
|
90
|
-
return reduce(data, function (value, item) {
|
|
91
|
-
if (item.children) {
|
|
92
|
-
var keys = getDefaultOpenKeys(item.children, key);
|
|
93
|
-
return keys.length ? [].concat(_toConsumableArray(value), [item.value], _toConsumableArray(keys)) : value;
|
|
94
|
-
}
|
|
59
|
+
var locale = useLocale();
|
|
60
|
+
|
|
61
|
+
var getCurrentTopics = function getCurrentTopics() {
|
|
62
|
+
if (searchValue) {
|
|
63
|
+
var res = filterTreeNode({
|
|
64
|
+
id: 'FAKE_ID',
|
|
65
|
+
childrenKey: 'exampleTopics',
|
|
66
|
+
title: {
|
|
67
|
+
'zh': 'FAKE_TITLE',
|
|
68
|
+
'en': 'FAKE_TITLE'
|
|
69
|
+
},
|
|
70
|
+
exampleTopics: exampleTopics
|
|
71
|
+
}, searchValue, locale.id);
|
|
72
|
+
return (res === null || res === void 0 ? void 0 : res.exampleTopics) || [];
|
|
73
|
+
}
|
|
95
74
|
|
|
96
|
-
|
|
97
|
-
}, []);
|
|
75
|
+
return exampleTopics;
|
|
98
76
|
}; // 初始化菜单栏展开keys
|
|
99
77
|
|
|
100
78
|
|
|
@@ -142,7 +120,7 @@ export var ExampleSider = function ExampleSider(props) {
|
|
|
142
120
|
};
|
|
143
121
|
|
|
144
122
|
var renderSubMenu = function renderSubMenu() {
|
|
145
|
-
return
|
|
123
|
+
return getCurrentTopics().map(function (topic) {
|
|
146
124
|
return /*#__PURE__*/React.createElement(Menu.SubMenu, {
|
|
147
125
|
key: "TOPIC-".concat(topic.id),
|
|
148
126
|
title: /*#__PURE__*/React.createElement("div", null, topic.icon && /*#__PURE__*/React.createElement(MenuIcon, {
|
|
@@ -208,7 +186,7 @@ export var ExampleSider = function ExampleSider(props) {
|
|
|
208
186
|
style: {
|
|
209
187
|
width: '100%'
|
|
210
188
|
},
|
|
211
|
-
className: styles.
|
|
189
|
+
className: styles.sideBarMenu,
|
|
212
190
|
openKeys: openKeys,
|
|
213
191
|
selectedKeys: ["DEMO-".concat(currentDemo.id)],
|
|
214
192
|
onOpenChange: function onOpenChange(keys) {
|
|
@@ -3,6 +3,7 @@ import { Row, Col } from 'antd';
|
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import FeatureCard from "./FeatureCard";
|
|
5
5
|
import styles from "./index.module.less";
|
|
6
|
+
import { ic } from "../hooks";
|
|
6
7
|
export var Features = function Features(_ref) {
|
|
7
8
|
var title = _ref.title,
|
|
8
9
|
_ref$features = _ref.features,
|
|
@@ -15,7 +16,7 @@ export var Features = function Features(_ref) {
|
|
|
15
16
|
var children = features.map(function (card) {
|
|
16
17
|
return /*#__PURE__*/React.createElement(Col, {
|
|
17
18
|
className: styles.cardWrapper,
|
|
18
|
-
key: card.title,
|
|
19
|
+
key: ic(card.title),
|
|
19
20
|
md: 8,
|
|
20
21
|
xs: 24
|
|
21
22
|
}, /*#__PURE__*/React.createElement(FeatureCard, card));
|
|
@@ -27,6 +27,7 @@ export var Navs = function Navs(_ref) {
|
|
|
27
27
|
return /*#__PURE__*/React.createElement(React.Fragment, null, navs.map(function (nav) {
|
|
28
28
|
var href = nav.slug.startsWith('http') ? nav.slug : "/".concat(nav.slug);
|
|
29
29
|
var title = getDocument(navs, nav.slug).title[locale.id];
|
|
30
|
+
href = nav.slug.startsWith('/') ? nav.slug : "/".concat(nav.slug);
|
|
30
31
|
|
|
31
32
|
if (window.location.pathname.includes('en')) {
|
|
32
33
|
href = "/en".concat(href);
|
|
@@ -38,7 +39,8 @@ export var Navs = function Navs(_ref) {
|
|
|
38
39
|
className: className
|
|
39
40
|
}, nav.target === '_blank' || href.startsWith('http') ? /*#__PURE__*/React.createElement("a", {
|
|
40
41
|
href: href,
|
|
41
|
-
target: "_blank"
|
|
42
|
+
target: "_blank",
|
|
43
|
+
rel: "noreferrer"
|
|
42
44
|
}, title, /*#__PURE__*/React.createElement(LinkOutlined, null)) : /*#__PURE__*/React.createElement(Link, {
|
|
43
45
|
to: href
|
|
44
46
|
}, title));
|
|
@@ -22,7 +22,7 @@ import { useMedia } from 'react-use';
|
|
|
22
22
|
import { useNavigate } from "react-router-dom";
|
|
23
23
|
import cx from 'classnames';
|
|
24
24
|
import { useSiteData, useLocale } from 'dumi';
|
|
25
|
-
import { GithubOutlined, MenuOutlined, CaretDownFilled, DownOutlined, WechatOutlined,
|
|
25
|
+
import { GithubOutlined, MenuOutlined, CaretDownFilled, DownOutlined, WechatOutlined, LinkOutlined, CheckOutlined } from '@ant-design/icons';
|
|
26
26
|
import { Popover, Menu, Dropdown, Select } from 'antd';
|
|
27
27
|
import { map, size } from 'lodash-es';
|
|
28
28
|
import { Search } from "./Search";
|
|
@@ -173,12 +173,12 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
173
173
|
className: cx(styles.menu, (_cx = {}, _defineProperty(_cx, styles.popup, !isWide), _defineProperty(_cx, styles.popupHidden, !popupMenuVisible), _cx))
|
|
174
174
|
},
|
|
175
175
|
/** 最左侧的菜单,一般是 教程、API、示例,或者其他自定义,有配置文件中的 `navs` 决定 */
|
|
176
|
-
size(navs)
|
|
176
|
+
size(navs) ? /*#__PURE__*/React.createElement(Navs, {
|
|
177
177
|
navs: navs,
|
|
178
178
|
path: window.location.pathname
|
|
179
|
-
}),
|
|
179
|
+
}) : null,
|
|
180
180
|
/** 生态产品 */
|
|
181
|
-
size(ecosystems)
|
|
181
|
+
size(ecosystems) ? /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
182
182
|
className: styles.ecoSystems,
|
|
183
183
|
overlay: /*#__PURE__*/React.createElement(Menu, null, map(ecosystems, function (_ref2) {
|
|
184
184
|
var url = _ref2.url,
|
|
@@ -189,13 +189,13 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
189
189
|
target: "_blank",
|
|
190
190
|
rel: "noreferrer",
|
|
191
191
|
href: url
|
|
192
|
-
}, ecosystemName === null || ecosystemName === void 0 ? void 0 : ecosystemName[lang], " ", /*#__PURE__*/React.createElement(
|
|
192
|
+
}, ecosystemName === null || ecosystemName === void 0 ? void 0 : ecosystemName[lang], " ", /*#__PURE__*/React.createElement(LinkOutlined, null)));
|
|
193
193
|
}))
|
|
194
194
|
}, /*#__PURE__*/React.createElement("span", null, useT('周边生态'), /*#__PURE__*/React.createElement(DownOutlined, {
|
|
195
195
|
style: {
|
|
196
196
|
marginLeft: '6px'
|
|
197
197
|
}
|
|
198
|
-
})))),
|
|
198
|
+
})))) : null,
|
|
199
199
|
/** 产品列表 */
|
|
200
200
|
showAntVProductsCard && /*#__PURE__*/React.createElement("li", productItemProps, /*#__PURE__*/React.createElement("a", null, useT('所有产品'), !isAntVHome ? /*#__PURE__*/React.createElement("img", {
|
|
201
201
|
src: "https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png",
|
|
@@ -312,7 +312,8 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
312
312
|
className: styles.githubCorner
|
|
313
313
|
}, /*#__PURE__*/React.createElement("a", {
|
|
314
314
|
href: githubUrl,
|
|
315
|
-
target: "_blank"
|
|
315
|
+
target: "_blank",
|
|
316
|
+
rel: "noreferrer"
|
|
316
317
|
}, /*#__PURE__*/React.createElement(GithubOutlined, null))));
|
|
317
318
|
return /*#__PURE__*/React.createElement("header", {
|
|
318
319
|
className: cx(styles.header, (_cx4 = {}, _defineProperty(_cx4, styles.transparent, !!transparent && !productMenuVisible), _defineProperty(_cx4, styles.isHomePage, !!isHomePage && !isAntVHome), _defineProperty(_cx4, styles.lightTheme, !!isAntVHome && !productMenuVisible && isWide), _defineProperty(_cx4, styles.fixed, popupMenuVisible), _cx4))
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import styles from "./index.module.less";
|
|
3
|
+
/**
|
|
4
|
+
* Loading
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
var Loading = function Loading() {
|
|
3
8
|
return /*#__PURE__*/React.createElement("div", {
|
|
4
|
-
style: {
|
|
5
|
-
height: '100vh'
|
|
6
|
-
}
|
|
7
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
8
9
|
style: {
|
|
9
10
|
position: 'relative',
|
|
10
|
-
height: '100%'
|
|
11
|
+
height: '100%',
|
|
12
|
+
width: '100%'
|
|
11
13
|
}
|
|
12
14
|
}, /*#__PURE__*/React.createElement("div", {
|
|
13
|
-
className:
|
|
14
|
-
}, /*#__PURE__*/React.createElement("div",
|
|
15
|
+
className: styles.loading
|
|
16
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
className: "container"
|
|
18
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
15
19
|
className: "loader"
|
|
16
20
|
}, /*#__PURE__*/React.createElement("svg", {
|
|
17
21
|
viewBox: "0 0 80 80"
|
|
@@ -61,5 +65,15 @@ export var Loading = function Loading() {
|
|
|
61
65
|
stroke: "url(#gradient)"
|
|
62
66
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
63
67
|
className: "loading-text"
|
|
64
|
-
}, /*#__PURE__*/React.createElement("p", null, "Loading...")))))
|
|
65
|
-
};
|
|
68
|
+
}, /*#__PURE__*/React.createElement("p", null, "Loading...")))));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var PageLoading = function PageLoading() {
|
|
72
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
style: {
|
|
74
|
+
height: '100vh'
|
|
75
|
+
}
|
|
76
|
+
}, /*#__PURE__*/React.createElement(Loading, null));
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export { Loading, PageLoading };
|
|
@@ -1,12 +1,279 @@
|
|
|
1
|
-
|
|
1
|
+
.loading {
|
|
2
|
+
position: absolute;
|
|
3
|
+
left: 0;
|
|
4
|
+
top: 0;
|
|
5
|
+
z-index: 9999;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
background-color: #fff;
|
|
9
|
+
border: 1px solid #f0f0f0;
|
|
2
10
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
11
|
+
:global {
|
|
12
|
+
.container {
|
|
13
|
+
display: inline-block;
|
|
14
|
+
position: absolute;
|
|
15
|
+
left: 50%;
|
|
16
|
+
top: 50%;
|
|
17
|
+
margin: -50px 0 0 -120px;
|
|
18
|
+
}
|
|
19
|
+
.loader {
|
|
20
|
+
--duration: 3s;
|
|
21
|
+
width: 44px;
|
|
22
|
+
height: 44px;
|
|
23
|
+
position: relative;
|
|
24
|
+
display: inline-block;
|
|
25
|
+
margin: 0 16px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.loader:before {
|
|
29
|
+
content: ' ';
|
|
30
|
+
width: 6px;
|
|
31
|
+
height: 6px;
|
|
32
|
+
border-radius: 50%;
|
|
33
|
+
position: absolute;
|
|
34
|
+
display: block;
|
|
35
|
+
background: #ff700a;
|
|
36
|
+
top: 37px;
|
|
37
|
+
left: 19px;
|
|
38
|
+
-webkit-transform: translate(-18px, -18px);
|
|
39
|
+
transform: translate(-18px, -18px);
|
|
40
|
+
-webkit-animation: dotRect var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
|
41
|
+
animation: dotRect var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.loader svg {
|
|
45
|
+
display: block;
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 100%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.loader svg rect,
|
|
51
|
+
.loader svg polygon,
|
|
52
|
+
.loader svg circle {
|
|
53
|
+
fill: none;
|
|
54
|
+
stroke-width: 10px;
|
|
55
|
+
stroke-linejoin: round;
|
|
56
|
+
stroke-linecap: round;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.loader svg polygon {
|
|
60
|
+
stroke-dasharray: 145 76 145 76;
|
|
61
|
+
stroke-dashoffset: 0;
|
|
62
|
+
-webkit-animation: pathTriangle var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
|
63
|
+
animation: pathTriangle var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.loader svg rect {
|
|
67
|
+
stroke-dasharray: 192 64 192 64;
|
|
68
|
+
stroke-dashoffset: 0;
|
|
69
|
+
-webkit-animation: pathRect 3s cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
|
70
|
+
animation: pathRect 3s cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.loader svg circle {
|
|
74
|
+
stroke-dasharray: 150 50 150 50;
|
|
75
|
+
stroke-dashoffset: 75;
|
|
76
|
+
-webkit-animation: pathCircle var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
|
77
|
+
animation: pathCircle var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.loader.triangle {
|
|
81
|
+
width: 48px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.loader.triangle:before {
|
|
85
|
+
left: 21px;
|
|
86
|
+
-webkit-transform: translate(-10px, -18px);
|
|
87
|
+
transform: translate(-10px, -18px);
|
|
88
|
+
-webkit-animation: dotTriangle var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
|
89
|
+
animation: dotTriangle var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.loading-text {
|
|
93
|
+
text-align: center;
|
|
94
|
+
height: 40px;
|
|
95
|
+
line-height: 40px;
|
|
96
|
+
font-size: 12px;
|
|
97
|
+
letter-spacing: 0.1em;
|
|
98
|
+
color: #666;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@-webkit-keyframes ~":global(pathTriangle)" {
|
|
104
|
+
33% {
|
|
105
|
+
stroke-dashoffset: 74;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
66% {
|
|
109
|
+
stroke-dashoffset: 147;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
100% {
|
|
113
|
+
stroke-dashoffset: 221;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@keyframes ~":global(pathTriangle)" {
|
|
118
|
+
33% {
|
|
119
|
+
stroke-dashoffset: 74;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
66% {
|
|
123
|
+
stroke-dashoffset: 147;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
100% {
|
|
127
|
+
stroke-dashoffset: 221;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@-webkit-keyframes ~":global(dotTriangle)" {
|
|
132
|
+
33% {
|
|
133
|
+
-webkit-transform: translate(0, 0);
|
|
134
|
+
transform: translate(0, 0);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
66% {
|
|
138
|
+
-webkit-transform: translate(10px, -18px);
|
|
139
|
+
transform: translate(10px, -18px);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
100% {
|
|
143
|
+
-webkit-transform: translate(-10px, -18px);
|
|
144
|
+
transform: translate(-10px, -18px);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@keyframes ~":global(dotTriangle)" {
|
|
149
|
+
33% {
|
|
150
|
+
-webkit-transform: translate(0, 0);
|
|
151
|
+
transform: translate(0, 0);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
66% {
|
|
155
|
+
-webkit-transform: translate(10px, -18px);
|
|
156
|
+
transform: translate(10px, -18px);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
100% {
|
|
160
|
+
-webkit-transform: translate(-10px, -18px);
|
|
161
|
+
transform: translate(-10px, -18px);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@-webkit-keyframes ~":global(pathRect)" {
|
|
166
|
+
25% {
|
|
167
|
+
stroke-dashoffset: 64;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
50% {
|
|
171
|
+
stroke-dashoffset: 128;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
75% {
|
|
175
|
+
stroke-dashoffset: 192;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
100% {
|
|
179
|
+
stroke-dashoffset: 256;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@keyframes ~":global(pathRect)" {
|
|
184
|
+
25% {
|
|
185
|
+
stroke-dashoffset: 64;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
50% {
|
|
189
|
+
stroke-dashoffset: 128;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
75% {
|
|
193
|
+
stroke-dashoffset: 192;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
100% {
|
|
197
|
+
stroke-dashoffset: 256;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@-webkit-keyframes ~":global(dotRect)" {
|
|
202
|
+
25% {
|
|
203
|
+
-webkit-transform: translate(0, 0);
|
|
204
|
+
transform: translate(0, 0);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
50% {
|
|
208
|
+
-webkit-transform: translate(18px, -18px);
|
|
209
|
+
transform: translate(18px, -18px);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
75% {
|
|
213
|
+
-webkit-transform: translate(0, -36px);
|
|
214
|
+
transform: translate(0, -36px);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
100% {
|
|
218
|
+
-webkit-transform: translate(-18px, -18px);
|
|
219
|
+
transform: translate(-18px, -18px);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
@keyframes ~":global(dotRect)" {
|
|
224
|
+
25% {
|
|
225
|
+
-webkit-transform: translate(0, 0);
|
|
226
|
+
transform: translate(0, 0);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
50% {
|
|
230
|
+
-webkit-transform: translate(18px, -18px);
|
|
231
|
+
transform: translate(18px, -18px);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
75% {
|
|
235
|
+
-webkit-transform: translate(0, -36px);
|
|
236
|
+
transform: translate(0, -36px);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
100% {
|
|
240
|
+
-webkit-transform: translate(-18px, -18px);
|
|
241
|
+
transform: translate(-18px, -18px);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
@-webkit-keyframes ~":global(pathCircle)" {
|
|
246
|
+
25% {
|
|
247
|
+
stroke-dashoffset: 125;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
50% {
|
|
251
|
+
stroke-dashoffset: 175;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
75% {
|
|
255
|
+
stroke-dashoffset: 225;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
100% {
|
|
259
|
+
stroke-dashoffset: 275;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
@keyframes ~":global(pathCircle)" {
|
|
264
|
+
25% {
|
|
265
|
+
stroke-dashoffset: 125;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
50% {
|
|
269
|
+
stroke-dashoffset: 175;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
75% {
|
|
273
|
+
stroke-dashoffset: 225;
|
|
274
|
+
}
|
|
6
275
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
color: @primary-color;
|
|
10
|
-
text-align: center;
|
|
276
|
+
100% {
|
|
277
|
+
stroke-dashoffset: 275;
|
|
11
278
|
}
|
|
12
|
-
}
|
|
279
|
+
}
|
|
@@ -78,7 +78,12 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
78
78
|
var linkoTitle = {};
|
|
79
79
|
|
|
80
80
|
function getBaseRoute() {
|
|
81
|
-
var matchRoute = window.location.pathname;
|
|
81
|
+
var matchRoute = window.location.pathname; // 兼容 zh
|
|
82
|
+
|
|
83
|
+
matchRoute = matchRoute.replace('/zh/', '/'); // 兼容带有docs的route
|
|
84
|
+
|
|
85
|
+
matchRoute = matchRoute.replace('/docs', ''); // 查找 baseRoute
|
|
86
|
+
|
|
82
87
|
var reg = window.location.pathname.startsWith('/en') ? /(\/[A-z]*\/?\/[A-z]*)\/?/ : /(\/[A-z]*)\/?/;
|
|
83
88
|
var mainRoute = matchRoute.match(reg);
|
|
84
89
|
return mainRoute[1];
|
|
@@ -140,18 +145,20 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
140
145
|
var _sidebar$baseRoute$0$;
|
|
141
146
|
|
|
142
147
|
sidebar[baseRoute] && ((_sidebar$baseRoute$0$ = sidebar[baseRoute][0].children) === null || _sidebar$baseRoute$0$ === void 0 ? void 0 : _sidebar$baseRoute$0$.forEach(function (itemChild) {
|
|
148
|
+
var key = itemChild.link;
|
|
143
149
|
var label = itemChild.title;
|
|
144
150
|
list.push(_objectSpread(_objectSpread({}, itemChild), {}, {
|
|
145
151
|
label: label,
|
|
146
|
-
key:
|
|
152
|
+
key: key
|
|
147
153
|
}));
|
|
154
|
+
linkoTitle[key] = label;
|
|
148
155
|
}));
|
|
149
156
|
list.sort(function (a, b) {
|
|
150
157
|
return a.order - b.order;
|
|
151
158
|
});
|
|
152
159
|
return list;
|
|
153
160
|
}
|
|
154
|
-
} // 获取最终的MenuData
|
|
161
|
+
} // 获取最终的 MenuData
|
|
155
162
|
|
|
156
163
|
|
|
157
164
|
var renderSidebar = fullSidebarDataToMenuData(docs, baseRoute, []); // 获取默认打开的菜单栏
|
|
@@ -169,14 +176,15 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
169
176
|
return defaultOpenKeys;
|
|
170
177
|
}
|
|
171
178
|
|
|
172
|
-
var defaultOpenKeys = getDefaultOpenKeys(renderSidebar);
|
|
179
|
+
var defaultOpenKeys = getDefaultOpenKeys(renderSidebar);
|
|
180
|
+
var indexRoute = defaultOpenKeys[defaultOpenKeys.length - 1]; // 点击菜单栏
|
|
173
181
|
|
|
174
182
|
var onClick = function onClick(e) {
|
|
175
183
|
navigate(e.key);
|
|
176
184
|
useScrollToTop();
|
|
177
185
|
};
|
|
178
186
|
|
|
179
|
-
var _useState3 = useState([renderSidebar[0].key]),
|
|
187
|
+
var _useState3 = useState(renderSidebar.length !== 0 ? [renderSidebar[0].key] : ['']),
|
|
180
188
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
181
189
|
defaultSelectedKey = _useState4[0],
|
|
182
190
|
setDefaultSelectedKey = _useState4[1]; //上一夜下一页
|
|
@@ -190,15 +198,17 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
190
198
|
var _useState7 = useState(undefined),
|
|
191
199
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
192
200
|
next = _useState8[0],
|
|
193
|
-
setNext = _useState8[1]; // 监听路由去改变selected menu-item
|
|
201
|
+
setNext = _useState8[1]; // 监听路由去改变 selected menu-item
|
|
194
202
|
|
|
195
203
|
|
|
196
204
|
useEffect(function () {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
205
|
+
// 兜底 如果 nav 指定有误则重定向到 indexDocRoute
|
|
206
|
+
if (window.location.pathname !== indexRoute) {
|
|
207
|
+
navigate(indexRoute);
|
|
200
208
|
}
|
|
209
|
+
}, []); // 改变菜单栏选中状态
|
|
201
210
|
|
|
211
|
+
useEffect(function () {
|
|
202
212
|
setDefaultSelectedKey([window.location.pathname]);
|
|
203
213
|
}, [window.location.pathname]);
|
|
204
214
|
useEffect(function () {
|
package/dist/slots/hooks.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ export declare const useChinaMirrorHost: () => [boolean];
|
|
|
3
3
|
export declare const useScrollToTop: () => void;
|
|
4
4
|
export declare const useT: (transformedMessage: string) => string;
|
|
5
5
|
export declare const useLogoLink: ({ link, siteUrl, lang, }: {
|
|
6
|
-
link?: string
|
|
7
|
-
siteUrl?: string
|
|
8
|
-
lang?: string
|
|
6
|
+
link?: string;
|
|
7
|
+
siteUrl?: string;
|
|
8
|
+
lang?: string;
|
|
9
9
|
}) => [string];
|
|
10
10
|
export declare const usePrevAndNext: () => NavigatorBannerProps['post'][];
|
|
11
11
|
/**
|
package/dist/slots/utils.d.ts
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
/// <reference types="node" />
|
|
5
|
-
/// <reference types="lodash" />
|
|
6
|
-
declare type Status = 'responded' | 'error' | 'timeout';
|
|
7
|
-
export declare const ping: (callback: (status: Status) => void) => NodeJS.Timeout;
|
|
1
|
+
import { Status } from '../types';
|
|
2
|
+
export declare function ping(): Promise<Status>;
|
|
8
3
|
export declare const getChinaMirrorHost: (host?: string) => string;
|
|
9
|
-
export declare function
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const getSortedCategories: (allDemosInCategory: any, locale: string) => string[];
|
|
12
|
-
export declare const getGroupedEdges: (edges: any) => import("lodash").Dictionary<any[]>;
|
|
13
|
-
export declare const getGroupedEdgesDataEdit: (examples: any, edges: any, local: string) => string[];
|
|
14
|
-
export declare const getTreeDataByExamplesAndEdges: (examples: any, edges: any, locale: string) => {
|
|
15
|
-
title: any;
|
|
16
|
-
value: string;
|
|
17
|
-
icon: any;
|
|
18
|
-
children: any[];
|
|
19
|
-
}[];
|
|
20
|
-
export {};
|
|
4
|
+
export declare function getGithubSourceURL(githubUrl: string, relativePath: string, prefix?: string): string;
|
|
5
|
+
export declare const filterTreeNode: (treeNode: ExamplesPage.TreeNode, keyValue: string, locale: string) => ExamplesPage.TreeNode;
|