@antv/dumi-theme-antv 0.6.4-beta.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builtins/Playground/index.js +1 -1
- package/dist/common/ClientOnly.js +21 -0
- package/dist/common/CommonHelmet.js +85 -0
- package/dist/common/InViewSuspense.js +29 -0
- package/dist/hooks/useLocale.js +11 -0
- package/dist/hooks/useMenu.js +68 -73
- package/dist/layouts/DocLayout.js +32 -23
- package/dist/layouts/IndexLayout/index.js +16 -0
- package/dist/layouts/{entry/Manual.js → ManualLayout/index.js} +6 -6
- package/dist/pages/404.js +5 -4
- package/dist/pages/Example/index.js +76 -53
- package/dist/pages/Examples/components/ExampleTopicMenu/index.js +3 -2
- package/dist/pages/Examples/index.js +28 -32
- package/dist/{slots → pages/Index/components}/Cases/index.js +1 -1
- package/dist/{slots → pages/Index/components}/Detail/News.js +1 -1
- package/dist/{slots → pages/Index/components}/Detail/index.js +1 -1
- package/dist/{slots → pages/Index/components}/Features/FeatureCard.js +1 -1
- package/dist/{slots → pages/Index/components}/Features/index.js +1 -1
- package/dist/pages/Index/components/_.less +119 -0
- package/dist/{layouts/entry/Index.js → pages/Index/index.js} +18 -22
- package/dist/plugin/index.js +63 -43
- package/dist/slots/CodeEditor/index.js +4 -3
- package/dist/slots/CodePreview/CodeHeader.js +3 -2
- package/dist/slots/CodePreview/index.js +3 -2
- package/dist/slots/CodeRunner/index.js +34 -29
- package/dist/slots/ExampleSider/index.js +3 -2
- package/dist/slots/Feedback/Contributors.js +3 -2
- package/dist/slots/Feedback/EditButton.js +3 -2
- package/dist/slots/Feedback/PageFeedback.js +4 -3
- package/dist/slots/Feedback/SectionFeedback.js +3 -2
- package/dist/slots/Feedback/index.js +12 -10
- package/dist/slots/Footer/index.js +3 -2
- package/dist/slots/Header/Navs.js +66 -6
- package/dist/slots/Header/Search/index.js +1 -1
- package/dist/slots/Header/index.js +64 -105
- package/dist/slots/ManualContent/Main.js +16 -17
- package/dist/slots/ManualContent/NavigatorBanner.js +4 -2
- package/dist/slots/ManualContent/ObPreview.js +17 -0
- package/dist/slots/ManualContent/index.js +11 -4
- package/dist/slots/ManualContent/usePreview.js +6 -1
- package/dist/slots/ManualContent/utils.js +3 -13
- package/dist/slots/global.js +4 -4
- package/dist/slots/hooks.js +0 -25
- package/dist/slots/utils.js +0 -7
- package/dist/utils/env.js +10 -0
- package/dist/utils/location.js +6 -0
- package/dist/utils/user.js +13 -25
- package/package.json +6 -4
- package/dist/common/SEO.js +0 -61
- package/dist/layouts/entry/API.js +0 -12
- package/dist/pages/Example/utils.js +0 -9
- package/dist/slots/Article/index.js +0 -9
- package/dist/slots/Article/index.module.less +0 -8
- package/dist/slots/CodePreview/CodeHeader.module.less +0 -0
- package/dist/slots/Header/Products/NavigatorBanner.js +0 -29
- package/dist/slots/Header/Products/NavigatorBanner.module.less +0 -39
- /package/dist/{slots → pages/Index/components}/Cases/index.module.less +0 -0
- /package/dist/{slots → pages/Index/components}/Companies/index.js +0 -0
- /package/dist/{slots → pages/Index/components}/Companies/index.module.less +0 -0
- /package/dist/{slots → pages/Index/components}/Detail/News.module.less +0 -0
- /package/dist/{slots → pages/Index/components}/Detail/index.module.less +0 -0
- /package/dist/{slots → pages/Index/components}/Features/FeatureCard.module.less +0 -0
- /package/dist/{slots → pages/Index/components}/Features/index.module.less +0 -0
|
@@ -1,77 +1,100 @@
|
|
|
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(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
1
|
import { Layout } from 'antd';
|
|
8
2
|
import { useLocale, useSiteData } from 'dumi';
|
|
9
3
|
import { every, find, get } from 'lodash-es';
|
|
10
|
-
import React, { useContext
|
|
4
|
+
import React, { useContext } from 'react';
|
|
11
5
|
import { useLocation, useNavigate, useParams } from 'react-router-dom';
|
|
12
6
|
import { useSnapshot } from 'valtio';
|
|
13
|
-
import
|
|
7
|
+
import CommonHelmet from "../../common/CommonHelmet";
|
|
8
|
+
import InViewSuspense from "../../common/InViewSuspense";
|
|
14
9
|
import { ThemeAntVContext } from "../../context";
|
|
15
10
|
import { store } from "../../model";
|
|
16
11
|
import { API } from "dumi/theme/slots/API";
|
|
17
|
-
import
|
|
12
|
+
import CodeRunner from "dumi/theme/slots/CodeRunner";
|
|
18
13
|
import { getDemoInfo } from "../../slots/CodeRunner/utils";
|
|
19
|
-
import { ExampleSider } from "dumi/theme/slots/ExampleSider";
|
|
20
|
-
import { Header } from "dumi/theme/slots/Header";
|
|
21
14
|
import { CollapsedIcon } from "./components/CollapsedIcon";
|
|
22
15
|
import styles from "./index.module.less";
|
|
23
|
-
import { getCurrentTitle } from "./utils";
|
|
24
16
|
var Sider = Layout.Sider,
|
|
25
17
|
Content = Layout.Content;
|
|
18
|
+
var Header = /*#__PURE__*/React.lazy(function () {
|
|
19
|
+
return import("dumi/theme/slots/Header");
|
|
20
|
+
});
|
|
21
|
+
var ExampleSider = /*#__PURE__*/React.lazy(function () {
|
|
22
|
+
return import("dumi/theme/slots/ExampleSider");
|
|
23
|
+
});
|
|
26
24
|
/**
|
|
27
|
-
*
|
|
25
|
+
* 解析 Example 页面的元数据
|
|
28
26
|
*/
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
var
|
|
27
|
+
var useExampleMeta = function useExampleMeta() {
|
|
28
|
+
var _exampleTopics$find;
|
|
29
|
+
/** 示例页面的元数据信息 */
|
|
30
|
+
var metaData = useContext(ThemeAntVContext);
|
|
31
|
+
var exampleTopics = metaData.meta.exampleTopics;
|
|
33
32
|
var _useParams = useParams(),
|
|
34
33
|
topic = _useParams.topic,
|
|
35
34
|
example = _useParams.example;
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
var _useLocation = useLocation(),
|
|
36
|
+
hash = _useLocation.hash;
|
|
37
|
+
var examples = (_exampleTopics$find = exampleTopics.find(function (_ref) {
|
|
38
|
+
var id = _ref.id;
|
|
39
|
+
return id === topic;
|
|
40
|
+
})) === null || _exampleTopics$find === void 0 ? void 0 : _exampleTopics$find.examples;
|
|
41
|
+
var exampleDemo = find(examples, function (_ref2) {
|
|
42
|
+
var id = _ref2.id;
|
|
43
|
+
return id === example;
|
|
44
|
+
});
|
|
45
|
+
// examples/case/id hash 为空,可以默认第一个 example 对应的 demo
|
|
46
|
+
var demo = hash.slice(1) || get(exampleDemo, ['demos', '0', 'id']);
|
|
47
|
+
var locale = useLocale();
|
|
48
|
+
var exampleTitle = get(exampleDemo, ['title', locale.id]);
|
|
49
|
+
var currentDemo = getDemoInfo(exampleTopics, topic, example, demo);
|
|
50
|
+
var demoTitle = get(currentDemo, ['title', locale.id]);
|
|
51
|
+
return {
|
|
52
|
+
// all example topics
|
|
53
|
+
exampleTopics: exampleTopics,
|
|
54
|
+
// topic id
|
|
55
|
+
topic: topic,
|
|
56
|
+
// example id
|
|
57
|
+
example: example,
|
|
58
|
+
// example title
|
|
59
|
+
exampleTitle: exampleTitle,
|
|
60
|
+
// demo id
|
|
61
|
+
demo: demo,
|
|
62
|
+
// current demo info
|
|
63
|
+
currentDemo: currentDemo,
|
|
64
|
+
// demo title
|
|
65
|
+
demoTitle: demoTitle
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 具体单个案例的页面
|
|
71
|
+
*/
|
|
72
|
+
var Example = function Example() {
|
|
73
|
+
var state = useSnapshot(store);
|
|
74
|
+
var navigate = useNavigate();
|
|
38
75
|
var locale = useLocale();
|
|
76
|
+
var _useExampleMeta = useExampleMeta(),
|
|
77
|
+
exampleTopics = _useExampleMeta.exampleTopics,
|
|
78
|
+
exampleTitle = _useExampleMeta.exampleTitle,
|
|
79
|
+
currentDemo = _useExampleMeta.currentDemo,
|
|
80
|
+
topic = _useExampleMeta.topic,
|
|
81
|
+
example = _useExampleMeta.example,
|
|
82
|
+
demo = _useExampleMeta.demo,
|
|
83
|
+
demoTitle = _useExampleMeta.demoTitle;
|
|
39
84
|
var _useSiteData = useSiteData(),
|
|
40
85
|
themeConfig = _useSiteData.themeConfig;
|
|
41
|
-
var exampleTopics = metaData.meta.exampleTopics;
|
|
42
|
-
var demo = useMemo(function () {
|
|
43
|
-
var examples = get(exampleTopics, ['0', 'examples']);
|
|
44
|
-
var exampleDemo = find(examples, function (_ref) {
|
|
45
|
-
var id = _ref.id;
|
|
46
|
-
return id === example;
|
|
47
|
-
});
|
|
48
|
-
// examples/case/id hash 为空,可以默认第一个 example 对应的 demo
|
|
49
|
-
return hash.slice(1) || get(exampleDemo, ['demos', '0', 'id']);
|
|
50
|
-
}, [hash, exampleTopics, example]);
|
|
51
|
-
var _useState = useState(),
|
|
52
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
-
currentDemo = _useState2[0],
|
|
54
|
-
setCurrentDemo = _useState2[1];
|
|
55
|
-
var state = useSnapshot(store);
|
|
56
|
-
var _useState3 = useState({}),
|
|
57
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
58
|
-
title = _useState4[0],
|
|
59
|
-
setTitle = _useState4[1];
|
|
60
|
-
useEffect(function () {
|
|
61
|
-
if (topic && example && demo) {
|
|
62
|
-
var targetDemoInfo = getDemoInfo(exampleTopics, topic, example, demo);
|
|
63
|
-
setCurrentDemo(targetDemoInfo);
|
|
64
|
-
setTitle(getCurrentTitle(exampleTopics, topic, example));
|
|
65
|
-
}
|
|
66
|
-
}, [topic, example, hash]);
|
|
67
86
|
var showAPI = every([get(themeConfig, 'showAPIDoc'), topic, example], Boolean);
|
|
87
|
+
if (!currentDemo) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
68
90
|
return /*#__PURE__*/React.createElement("div", {
|
|
69
91
|
className: styles.example
|
|
70
|
-
}, /*#__PURE__*/React.createElement(
|
|
71
|
-
title:
|
|
72
|
-
|
|
92
|
+
}, /*#__PURE__*/React.createElement(CommonHelmet, {
|
|
93
|
+
title: exampleTitle,
|
|
94
|
+
description: demoTitle
|
|
95
|
+
}), /*#__PURE__*/React.createElement(InViewSuspense, null, /*#__PURE__*/React.createElement(Header, {
|
|
73
96
|
isHomePage: false
|
|
74
|
-
}), /*#__PURE__*/React.createElement(Layout, {
|
|
97
|
+
})), /*#__PURE__*/React.createElement(Layout, {
|
|
75
98
|
className: styles.container
|
|
76
99
|
}, /*#__PURE__*/React.createElement(Sider, {
|
|
77
100
|
collapsedWidth: 0,
|
|
@@ -81,7 +104,7 @@ var Example = function Example() {
|
|
|
81
104
|
collapsed: state.hideMenu,
|
|
82
105
|
className: styles.menuSider,
|
|
83
106
|
theme: "light"
|
|
84
|
-
},
|
|
107
|
+
}, /*#__PURE__*/React.createElement(InViewSuspense, null, /*#__PURE__*/React.createElement(ExampleSider, {
|
|
85
108
|
showExampleDemoTitle: true,
|
|
86
109
|
currentDemo: currentDemo,
|
|
87
110
|
onDemoClicked: function onDemoClicked(example) {
|
|
@@ -90,10 +113,10 @@ var Example = function Example() {
|
|
|
90
113
|
targetTopic = example.targetTopic;
|
|
91
114
|
// eg: /zh/examples/case/area/#area1
|
|
92
115
|
var newURL = "/".concat(locale.id, "/examples/").concat(targetTopic === null || targetTopic === void 0 ? void 0 : targetTopic.id, "/").concat(targetExample === null || targetExample === void 0 ? void 0 : targetExample.id, "/#").concat(demoId);
|
|
93
|
-
|
|
116
|
+
navigate(newURL);
|
|
94
117
|
},
|
|
95
118
|
exampleTopics: exampleTopics
|
|
96
|
-
}), /*#__PURE__*/React.createElement(CollapsedIcon, {
|
|
119
|
+
})), /*#__PURE__*/React.createElement(CollapsedIcon, {
|
|
97
120
|
isCollapsed: state.hideMenu,
|
|
98
121
|
onClick: function onClick(show) {
|
|
99
122
|
store.hideMenu = show;
|
|
@@ -104,7 +127,7 @@ var Example = function Example() {
|
|
|
104
127
|
}
|
|
105
128
|
})), /*#__PURE__*/React.createElement(Content, {
|
|
106
129
|
className: styles.content
|
|
107
|
-
},
|
|
130
|
+
}, /*#__PURE__*/React.createElement(CodeRunner, {
|
|
108
131
|
exampleTopics: exampleTopics,
|
|
109
132
|
topic: topic,
|
|
110
133
|
example: example,
|
|
@@ -18,7 +18,7 @@ import { LeftMenu } from "./components/LeftMenu";
|
|
|
18
18
|
* @param {LeftMenuProps} props 相关参数,详见类型定义
|
|
19
19
|
* @returns {React.FC} React.FC
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
var ExampleTopicMenu = function ExampleTopicMenu(props) {
|
|
22
22
|
var exampleTopics = props.exampleTopics;
|
|
23
23
|
var isWide = useMedia('(min-width: 767.99px)', true);
|
|
24
24
|
var _useState = useState(false),
|
|
@@ -51,4 +51,5 @@ export var ExampleTopicMenu = function ExampleTopicMenu(props) {
|
|
|
51
51
|
}, /*#__PURE__*/React.createElement(LeftMenu, {
|
|
52
52
|
exampleTopics: exampleTopics
|
|
53
53
|
})));
|
|
54
|
-
};
|
|
54
|
+
};
|
|
55
|
+
export default ExampleTopicMenu;
|
|
@@ -6,39 +6,41 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { VerticalAlignTopOutlined } from '@ant-design/icons';
|
|
8
8
|
import { Layout as AntLayout, BackTop } from 'antd';
|
|
9
|
-
import {
|
|
10
|
-
import React, { useContext, useEffect } from 'react';
|
|
9
|
+
import React, { lazy, useContext, useEffect } from 'react';
|
|
11
10
|
import { useNavigate } from 'react-router-dom';
|
|
12
|
-
import
|
|
11
|
+
import InViewSuspense from "../../common/InViewSuspense";
|
|
12
|
+
import CommonHelmet from "../../common/CommonHelmet";
|
|
13
13
|
import { ThemeAntVContext } from "../../context";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import { usePrevAndNext } from "../../slots/hooks";
|
|
14
|
+
import useLocale from "../../hooks/useLocale";
|
|
15
|
+
import Footer from "dumi/theme/slots/Footer";
|
|
16
|
+
import Header from "dumi/theme/slots/Header";
|
|
18
17
|
import { Article } from "./components/Article";
|
|
19
|
-
import { ExampleTopicMenu } from "./components/ExampleTopicMenu";
|
|
20
18
|
import { GalleryPageContent } from "./components/GalleryPageContent";
|
|
21
19
|
import styles from "./index.module.less";
|
|
20
|
+
var ExampleTopicMenu = /*#__PURE__*/lazy(function () {
|
|
21
|
+
return import("./components/ExampleTopicMenu");
|
|
22
|
+
});
|
|
23
|
+
var locales = {
|
|
24
|
+
zh: {
|
|
25
|
+
title: '所有图表'
|
|
26
|
+
},
|
|
27
|
+
en: {
|
|
28
|
+
title: 'Gallery'
|
|
29
|
+
}
|
|
30
|
+
};
|
|
22
31
|
|
|
23
32
|
/**
|
|
24
33
|
* Examples 页面
|
|
25
|
-
*
|
|
26
|
-
* @author YuZhanglong <loveyzl1123@gmail.com>
|
|
27
34
|
*/
|
|
28
|
-
var
|
|
35
|
+
var Examples = function Examples() {
|
|
29
36
|
var nav = useNavigate();
|
|
30
|
-
var
|
|
37
|
+
var _useLocale = useLocale(locales),
|
|
38
|
+
_useLocale2 = _slicedToArray(_useLocale, 1),
|
|
39
|
+
locale = _useLocale2[0];
|
|
40
|
+
|
|
31
41
|
/** 示例页面的元数据信息 */
|
|
32
42
|
var metaData = useContext(ThemeAntVContext);
|
|
33
43
|
var exampleTopics = metaData.meta.exampleTopics;
|
|
34
|
-
var _usePrevAndNext = usePrevAndNext(),
|
|
35
|
-
_usePrevAndNext2 = _slicedToArray(_usePrevAndNext, 2),
|
|
36
|
-
prev = _usePrevAndNext2[0],
|
|
37
|
-
next = _usePrevAndNext2[1];
|
|
38
|
-
var title = {
|
|
39
|
-
zh: '所有图表',
|
|
40
|
-
en: 'Gallery'
|
|
41
|
-
}[locale.id];
|
|
42
44
|
|
|
43
45
|
// 为 zh 做兜底
|
|
44
46
|
useEffect(function () {
|
|
@@ -47,16 +49,16 @@ var Example = function Example() {
|
|
|
47
49
|
nav(p.replace('/zh/', '/'));
|
|
48
50
|
}
|
|
49
51
|
}, []);
|
|
50
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
51
|
-
title: title
|
|
52
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CommonHelmet, {
|
|
53
|
+
title: locale.title
|
|
52
54
|
}), /*#__PURE__*/React.createElement(Header, {
|
|
53
55
|
isHomePage: false
|
|
54
56
|
}), /*#__PURE__*/React.createElement(AntLayout, {
|
|
55
57
|
hasSider: true,
|
|
56
58
|
className: styles.layout
|
|
57
|
-
}, /*#__PURE__*/React.createElement(ExampleTopicMenu, {
|
|
59
|
+
}, /*#__PURE__*/React.createElement(InViewSuspense, null, /*#__PURE__*/React.createElement(ExampleTopicMenu, {
|
|
58
60
|
exampleTopics: exampleTopics
|
|
59
|
-
}), /*#__PURE__*/React.createElement(Article, {
|
|
61
|
+
})), /*#__PURE__*/React.createElement(Article, {
|
|
60
62
|
className: styles.markdown
|
|
61
63
|
}, /*#__PURE__*/React.createElement("div", {
|
|
62
64
|
className: styles.main,
|
|
@@ -65,13 +67,7 @@ var Example = function Example() {
|
|
|
65
67
|
}
|
|
66
68
|
}, /*#__PURE__*/React.createElement(GalleryPageContent, {
|
|
67
69
|
exampleTopics: exampleTopics
|
|
68
|
-
}), /*#__PURE__*/React.createElement(
|
|
69
|
-
type: "prev",
|
|
70
|
-
post: prev
|
|
71
|
-
}), /*#__PURE__*/React.createElement(NavigatorBanner, {
|
|
72
|
-
type: "next",
|
|
73
|
-
post: next
|
|
74
|
-
})), /*#__PURE__*/React.createElement(BackTop, {
|
|
70
|
+
}), /*#__PURE__*/React.createElement(BackTop, {
|
|
75
71
|
style: {
|
|
76
72
|
right: 24
|
|
77
73
|
}
|
|
@@ -81,4 +77,4 @@ var Example = function Example() {
|
|
|
81
77
|
isDynamicFooter: true
|
|
82
78
|
}));
|
|
83
79
|
};
|
|
84
|
-
export default
|
|
80
|
+
export default Examples;
|
|
@@ -4,7 +4,7 @@ import cx from 'classnames';
|
|
|
4
4
|
import { FormattedMessage, Link, useLocale } from 'dumi';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import Slider from 'react-slick';
|
|
7
|
-
import { ic, icWithLocale } from "
|
|
7
|
+
import { ic, icWithLocale } from "../../../../slots/hooks";
|
|
8
8
|
import 'slick-carousel/slick/slick-theme.css';
|
|
9
9
|
import 'slick-carousel/slick/slick.css';
|
|
10
10
|
import styles from "./index.module.less";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Link, useLocale } from 'dumi';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ic } from "
|
|
3
|
+
import { ic } from "../../../../slots/hooks";
|
|
4
4
|
import styles from "./News.module.less";
|
|
5
5
|
var numberImages = ['https://gw.alipayobjects.com/zos/antfincdn/IqREAm36K7/1.png', 'https://gw.alipayobjects.com/zos/antfincdn/3fG1Iqjfnz/2.png'];
|
|
6
6
|
export var News = function News(_ref) {
|
|
@@ -19,8 +19,8 @@ import { useLocale } from 'dumi/dist/client/theme-api';
|
|
|
19
19
|
import gh from 'parse-github-url';
|
|
20
20
|
import React, { useEffect, useState } from 'react';
|
|
21
21
|
import GitHubButton from 'react-github-button';
|
|
22
|
-
import { ic } from "../hooks";
|
|
23
22
|
import { News } from "./News";
|
|
23
|
+
import { ic } from "../../../../slots/hooks";
|
|
24
24
|
import styles from "./index.module.less";
|
|
25
25
|
/**
|
|
26
26
|
* Index.技术栈的描述区域!
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Col, Row } from 'antd';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { ic } from "
|
|
4
|
+
import { ic } from "../../../../slots/hooks";
|
|
5
5
|
import FeatureCard from "./FeatureCard";
|
|
6
6
|
import styles from "./index.module.less";
|
|
7
7
|
export var Features = function Features(_ref) {
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
@import '~antd/dist/antd.less';
|
|
2
|
+
|
|
3
|
+
@primary-color: #873bf4;
|
|
4
|
+
|
|
5
|
+
.ant-btn,
|
|
6
|
+
.ant-input,
|
|
7
|
+
.ant-notification-notice,
|
|
8
|
+
.ant-select-selector {
|
|
9
|
+
border-radius: 8px !important;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
h1,
|
|
13
|
+
h2,
|
|
14
|
+
h3,
|
|
15
|
+
h4,
|
|
16
|
+
h5,
|
|
17
|
+
h6 {
|
|
18
|
+
> a[aria-hidden]:first-child {
|
|
19
|
+
float: left;
|
|
20
|
+
width: 20px;
|
|
21
|
+
font-size: 0;
|
|
22
|
+
line-height: inherit;
|
|
23
|
+
text-align: right;
|
|
24
|
+
padding-inline-end: 6px;
|
|
25
|
+
margin-inline-start: -20px;
|
|
26
|
+
|
|
27
|
+
&:hover {
|
|
28
|
+
border: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
> .icon-link::before {
|
|
32
|
+
font-size: 20px;
|
|
33
|
+
content: '#';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:not(:hover) > a[aria-hidden]:first-child > .icon-link {
|
|
38
|
+
visibility: hidden;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.container1440() {
|
|
43
|
+
width: 1440px;
|
|
44
|
+
max-width: calc(100% - 80px);
|
|
45
|
+
margin-right: auto;
|
|
46
|
+
margin-left: auto;
|
|
47
|
+
|
|
48
|
+
@media only screen and (max-width: 931.99px) {
|
|
49
|
+
& {
|
|
50
|
+
max-width: calc(100% - 80px);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@media only screen and (max-width: 767.99px) {
|
|
55
|
+
& {
|
|
56
|
+
max-width: calc(100% - 32px);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// 非常关键,用于 react-split-pane 的样式,如果没有,会没有办法鼠标拖拽
|
|
62
|
+
// 参考:https://codesandbox.io/s/mow7x4zyqx
|
|
63
|
+
:global {
|
|
64
|
+
.Pane1,
|
|
65
|
+
.Pane2 {
|
|
66
|
+
overflow: auto;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.Resizer {
|
|
70
|
+
z-index: 1;
|
|
71
|
+
box-sizing: border-box;
|
|
72
|
+
background: #000;
|
|
73
|
+
background-clip: padding-box;
|
|
74
|
+
opacity: 0.1;
|
|
75
|
+
|
|
76
|
+
&:hover {
|
|
77
|
+
transition: all 2s ease;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&.horizontal {
|
|
81
|
+
width: 100%;
|
|
82
|
+
height: 11px;
|
|
83
|
+
margin: -5px 0;
|
|
84
|
+
border-top: 5px solid rgba(255, 255, 255, 0);
|
|
85
|
+
border-bottom: 5px solid rgba(255, 255, 255, 0);
|
|
86
|
+
cursor: row-resize;
|
|
87
|
+
|
|
88
|
+
&:hover {
|
|
89
|
+
border-top: 5px solid rgba(0, 0, 0, 0.5);
|
|
90
|
+
border-bottom: 5px solid rgba(0, 0, 0, 0.5);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&.vertical {
|
|
95
|
+
width: 11px;
|
|
96
|
+
margin: 0 -5px;
|
|
97
|
+
border-right: 5px solid rgba(255, 255, 255, 0);
|
|
98
|
+
border-left: 5px solid rgba(255, 255, 255, 0);
|
|
99
|
+
cursor: col-resize;
|
|
100
|
+
|
|
101
|
+
Pane2 {
|
|
102
|
+
border-left: 1px solid #e6e6e6;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&:hover {
|
|
106
|
+
border-right: 5px solid rgba(0, 0, 0, 0.5);
|
|
107
|
+
border-left: 5px solid rgba(0, 0, 0, 0.5);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&.disabled {
|
|
112
|
+
cursor: not-allowed;
|
|
113
|
+
|
|
114
|
+
&:hover {
|
|
115
|
+
border-color: transparent;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -4,26 +4,19 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
import {
|
|
7
|
+
import { useIntl, useSiteData } from 'dumi';
|
|
8
8
|
import { get, isArray, size } from 'lodash-es';
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Index 路由下的入口
|
|
20
|
-
* - 获取数据
|
|
21
|
-
* - 组合 slots 下的木偶组件
|
|
22
|
-
*/
|
|
23
|
-
export var Index = function Index() {
|
|
10
|
+
import CommonHelmet from "../../common/CommonHelmet";
|
|
11
|
+
import { ic } from "../../slots/hooks";
|
|
12
|
+
import { Cases } from "./components/Cases";
|
|
13
|
+
import { Companies } from "./components/Companies";
|
|
14
|
+
import { Detail } from "./components/Detail";
|
|
15
|
+
import { Features } from "./components/Features";
|
|
16
|
+
var Index = function Index() {
|
|
24
17
|
var _useSiteData = useSiteData(),
|
|
25
18
|
themeConfig = _useSiteData.themeConfig;
|
|
26
|
-
var title = themeConfig.title,
|
|
19
|
+
var title = themeConfig.metas.title,
|
|
27
20
|
githubUrl = themeConfig.githubUrl,
|
|
28
21
|
isAntVSite = themeConfig.isAntVSite,
|
|
29
22
|
showGithubStars = themeConfig.showGithubStars,
|
|
@@ -35,6 +28,8 @@ export var Index = function Index() {
|
|
|
35
28
|
className = themeConfig.className,
|
|
36
29
|
style = themeConfig.style,
|
|
37
30
|
id = themeConfig.id;
|
|
31
|
+
var _useIntl = useIntl(),
|
|
32
|
+
formatMessage = _useIntl.formatMessage;
|
|
38
33
|
var detailProps = _objectSpread({
|
|
39
34
|
githubUrl: githubUrl,
|
|
40
35
|
showGithubStars: showGithubStars,
|
|
@@ -52,13 +47,14 @@ export var Index = function Index() {
|
|
|
52
47
|
style: style,
|
|
53
48
|
className: className
|
|
54
49
|
};
|
|
55
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
56
|
-
title: title,
|
|
50
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CommonHelmet, {
|
|
51
|
+
title: ic(title),
|
|
57
52
|
titleSuffix: "AntV"
|
|
58
|
-
}),
|
|
59
|
-
title:
|
|
53
|
+
}), size(detail) ? /*#__PURE__*/React.createElement(Detail, detailProps) : null, size(featuresProps.features) ? /*#__PURE__*/React.createElement(Features, featuresProps) : null, size(cases) ? /*#__PURE__*/React.createElement(Cases, casesProps) : null, size(companies) ? /*#__PURE__*/React.createElement(Companies, {
|
|
54
|
+
title: formatMessage({
|
|
60
55
|
id: isAntVSite ? '2000+ 公司正在使用' : '感谢信赖'
|
|
61
56
|
}),
|
|
62
57
|
companies: companies
|
|
63
|
-
}) : null
|
|
64
|
-
};
|
|
58
|
+
}) : null);
|
|
59
|
+
};
|
|
60
|
+
export default Index;
|
package/dist/plugin/index.js
CHANGED
|
@@ -44,6 +44,17 @@ var plugin_default = (api) => {
|
|
|
44
44
|
api.describe({ key: `dumi-theme:${require("../../package.json").name}` });
|
|
45
45
|
api.modifyDefaultConfig((memo) => {
|
|
46
46
|
memo.resolve.codeBlockMode = "passive";
|
|
47
|
+
memo.chainWebpack = (memo2) => {
|
|
48
|
+
memo2.module.rule("less").test(/\.less$/).use("style-loader").loader("style-loader").before("css-loader").end().use("css-loader").loader("css-loader").options({
|
|
49
|
+
importLoaders: 1,
|
|
50
|
+
modules: { auto: true }
|
|
51
|
+
// 启用 CSS Modules(可选)
|
|
52
|
+
}).end().use("less-loader").loader("less-loader").options({
|
|
53
|
+
javascriptEnabled: true
|
|
54
|
+
});
|
|
55
|
+
return memo2;
|
|
56
|
+
};
|
|
57
|
+
memo.exportStatic = {};
|
|
47
58
|
memo.exportStatic.extraRoutePaths = (0, import_examples.getExamplePaths)();
|
|
48
59
|
memo.mfsu = false;
|
|
49
60
|
memo.jsMinifier = "terser";
|
|
@@ -61,42 +72,6 @@ var plugin_default = (api) => {
|
|
|
61
72
|
memo.extraRehypePlugins = [import_rehypeObservable.default];
|
|
62
73
|
return memo;
|
|
63
74
|
});
|
|
64
|
-
const pages = [
|
|
65
|
-
{
|
|
66
|
-
id: "dumi-theme-antv-homepage",
|
|
67
|
-
absPath: "/"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
id: "dumi-theme-antv-en-homepage",
|
|
71
|
-
absPath: "/en/"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
id: "dumi-theme-antv-zh-homepage",
|
|
75
|
-
absPath: "/zh/"
|
|
76
|
-
},
|
|
77
|
-
// Examples gallery page.
|
|
78
|
-
{
|
|
79
|
-
id: "dumi-theme-antv-example-list-zh",
|
|
80
|
-
absPath: "/examples",
|
|
81
|
-
file: `${PAGES_DIR}/Examples`
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
id: "dumi-theme-antv-example-list-lang",
|
|
85
|
-
absPath: "/:language/examples",
|
|
86
|
-
file: `${PAGES_DIR}/Examples`
|
|
87
|
-
},
|
|
88
|
-
// single example preview page.
|
|
89
|
-
{
|
|
90
|
-
id: "dumi-theme-antv-single-example-zh",
|
|
91
|
-
absPath: "/examples/:topic/:example",
|
|
92
|
-
file: `${PAGES_DIR}/Example`
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
id: "dumi-theme-antv-single-example-lang",
|
|
96
|
-
absPath: "/:language/examples/:topic/:example",
|
|
97
|
-
file: `${PAGES_DIR}/Example`
|
|
98
|
-
}
|
|
99
|
-
];
|
|
100
75
|
api.modifyConfig((memo) => {
|
|
101
76
|
memo.extraRemarkPlugins = memo.themeConfig.feedback ? [import_remarkFeedback.default] : [];
|
|
102
77
|
return memo;
|
|
@@ -136,18 +111,63 @@ export default function ThemeAntVContextWrapper() {
|
|
|
136
111
|
file: `${api.paths.absTmpPath}/theme-antv/ContextWrapper.tsx`
|
|
137
112
|
}));
|
|
138
113
|
api.modifyRoutes((routes) => {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
id:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
file:
|
|
114
|
+
const extraRoutesList = [
|
|
115
|
+
{
|
|
116
|
+
id: "dumi-theme-antv-homepage",
|
|
117
|
+
absPath: "/",
|
|
118
|
+
path: "",
|
|
119
|
+
file: `${PAGES_DIR}/Index`
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: "dumi-theme-antv-homepage-en",
|
|
123
|
+
absPath: "/en/",
|
|
124
|
+
path: "en",
|
|
125
|
+
file: `${PAGES_DIR}/Index`
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: "dumi-theme-antv-homepage-zh",
|
|
129
|
+
absPath: "/zh/",
|
|
130
|
+
path: "zh",
|
|
131
|
+
file: `${PAGES_DIR}/Index`
|
|
132
|
+
},
|
|
133
|
+
// Examples gallery page.
|
|
134
|
+
{
|
|
135
|
+
id: "dumi-theme-antv-example-list-zh",
|
|
136
|
+
absPath: "/examples",
|
|
137
|
+
path: "examples",
|
|
138
|
+
file: `${PAGES_DIR}/Examples`
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
id: "dumi-theme-antv-example-list-lang",
|
|
142
|
+
absPath: "/:language/examples",
|
|
143
|
+
path: ":language/examples",
|
|
144
|
+
file: `${PAGES_DIR}/Examples`
|
|
145
|
+
},
|
|
146
|
+
// single example preview page.
|
|
147
|
+
{
|
|
148
|
+
id: "dumi-theme-antv-single-example-zh",
|
|
149
|
+
absPath: "/examples/:topic/:example",
|
|
150
|
+
path: "examples/:topic/:example",
|
|
151
|
+
file: `${PAGES_DIR}/Example`
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: "dumi-theme-antv-single-example-lang",
|
|
155
|
+
absPath: "/:language/examples/:topic/:example",
|
|
156
|
+
path: ":language/examples/:topic/:example",
|
|
157
|
+
file: `${PAGES_DIR}/Example`
|
|
158
|
+
}
|
|
159
|
+
];
|
|
160
|
+
extraRoutesList.forEach((itemRoute) => {
|
|
161
|
+
routes[itemRoute.id] = {
|
|
162
|
+
id: itemRoute.id,
|
|
163
|
+
path: itemRoute.path,
|
|
164
|
+
absPath: itemRoute.absPath,
|
|
165
|
+
file: itemRoute.file,
|
|
145
166
|
parentId: "DocLayout",
|
|
146
167
|
meta: MOCK_META
|
|
147
168
|
};
|
|
148
169
|
});
|
|
149
170
|
routes["404"].file = `${PAGES_DIR}/404`;
|
|
150
|
-
routes["404"].meta = MOCK_META;
|
|
151
171
|
return routes;
|
|
152
172
|
});
|
|
153
173
|
api.addTmpGenerateWatcherPaths(() => [path.resolve(process.cwd(), "examples")]);
|