@antv/dumi-theme-antv 0.3.0-beta.8 → 0.3.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.d.ts +3 -6
- package/dist/builtins/Playground/index.js +27 -7
- package/dist/layouts/DocLayout.js +4 -5
- package/dist/layouts/entry/Index.js +21 -12
- package/dist/layouts/entry/Manual.js +6 -4
- package/dist/pages/404.js +7 -4
- package/dist/pages/Example/index.js +15 -4
- package/dist/pages/Example/utils.d.ts +1 -0
- package/dist/pages/Example/utils.js +9 -0
- package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.js +2 -1
- package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +10 -5
- package/dist/pages/Examples/components/GalleryPageContent/index.js +2 -1
- package/dist/pages/Examples/index.js +13 -4
- package/dist/pages/Examples/index.module.less +13 -0
- package/dist/pages/Examples/utils.d.ts +1 -0
- package/dist/pages/Examples/utils.js +3 -0
- package/dist/plugin/index.js +11 -0
- package/dist/slots/Article/index.d.ts +3 -0
- package/dist/slots/Article/index.js +11 -0
- package/dist/slots/Article/index.module.less +8 -0
- package/dist/slots/Banner/Notification.d.ts +10 -0
- package/dist/slots/Banner/Notification.js +43 -0
- package/dist/slots/Banner/Notification.module.less +120 -0
- package/dist/slots/Banner/index.d.ts +26 -0
- package/dist/slots/Banner/index.js +184 -0
- package/dist/slots/Banner/index.module.less +449 -0
- package/dist/slots/Cases/index.d.ts +1 -1
- package/dist/slots/Cases/index.js +13 -7
- package/dist/slots/Cases/index.module.less +2 -1
- package/dist/slots/CodeEditor/Toolbar.js +13 -6
- package/dist/slots/CodeEditor/index.d.ts +4 -0
- package/dist/slots/CodeEditor/index.js +43 -21
- package/dist/slots/CodeEditor/utils.js +1 -1
- package/dist/slots/CodePreview/CodeHeader.js +15 -14
- package/dist/slots/CodePreview/index.d.ts +8 -0
- package/dist/slots/CodePreview/index.js +15 -6
- package/dist/slots/CodePreview/index.module.less +11 -2
- package/dist/slots/CodeRunner/index.d.ts +2 -0
- package/dist/slots/CodeRunner/index.js +13 -5
- package/dist/slots/Companies/index.d.ts +1 -1
- package/dist/slots/{TOC.d.ts → ContentTable/index.d.ts} +2 -1
- package/dist/slots/{TOC.js → ContentTable/index.js} +2 -1
- package/dist/slots/ContentTable/index.module.less +11 -0
- package/dist/slots/Detail/News.js +3 -2
- package/dist/slots/Detail/index.js +3 -1
- package/dist/slots/ExampleSider/index.js +21 -20
- package/dist/slots/Features/index.js +5 -2
- package/dist/slots/Features/index.module.less +3 -3
- package/dist/slots/Footer/index.js +34 -14
- package/dist/slots/Header/LogoWhite.js +1 -2
- package/dist/slots/Header/Navs.d.ts +10 -1
- package/dist/slots/Header/Navs.js +36 -25
- package/dist/slots/Header/Products/NavigatorBanner.js +4 -3
- package/dist/slots/Header/Products/Product.js +7 -3
- package/dist/slots/Header/Products/getProducts.js +4 -2
- package/dist/slots/Header/Products/index.js +5 -3
- package/dist/slots/Header/Search.js +5 -3
- package/dist/slots/Header/index.d.ts +7 -2
- package/dist/slots/Header/index.js +128 -24
- package/dist/slots/ManualContent/NavigatorBanner.js +5 -3
- package/dist/slots/ManualContent/ReadingTime.js +6 -2
- package/dist/slots/ManualContent/index.js +36 -30
- package/dist/slots/ManualContent/index.module.less +52 -33
- package/dist/slots/ManualContent/utils.d.ts +15 -0
- package/dist/slots/ManualContent/utils.js +30 -1
- package/dist/slots/SEO.d.ts +10 -0
- package/dist/slots/SEO.js +59 -0
- package/dist/slots/_.less +1 -1
- package/dist/slots/hooks.d.ts +1 -1
- package/dist/slots/hooks.js +5 -8
- package/dist/slots/utils.js +6 -1
- package/package.json +5 -2
|
@@ -9,7 +9,7 @@ export declare type PlaygroundProps = {
|
|
|
9
9
|
*/
|
|
10
10
|
rid?: string;
|
|
11
11
|
/**
|
|
12
|
-
* 预览区、代码区的宽度占比,默认为 0.
|
|
12
|
+
* 预览区、代码区的宽度占比,默认为 0.38
|
|
13
13
|
*/
|
|
14
14
|
ratio?: number;
|
|
15
15
|
/**
|
|
@@ -17,8 +17,5 @@ export declare type PlaygroundProps = {
|
|
|
17
17
|
*/
|
|
18
18
|
height?: number;
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*/
|
|
23
|
-
declare const Playground: React.FC<PlaygroundProps>;
|
|
24
|
-
export default Playground;
|
|
20
|
+
declare const _default: React.FC<PlaygroundProps>;
|
|
21
|
+
export default _default;
|
|
@@ -10,9 +10,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
10
10
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|
|
13
|
+
import { useSiteData } from 'dumi';
|
|
14
|
+
import { get } from 'lodash-es';
|
|
13
15
|
import React, { useContext } from 'react';
|
|
16
|
+
import { ErrorBoundary } from 'react-error-boundary';
|
|
14
17
|
import { ThemeAntVContext } from "../../context";
|
|
15
|
-
import { CodeRunner } from "
|
|
18
|
+
import { CodeRunner } from "dumi/theme/slots/CodeRunner";
|
|
16
19
|
import styles from "./index.module.less";
|
|
17
20
|
|
|
18
21
|
/**
|
|
@@ -21,8 +24,7 @@ import styles from "./index.module.less";
|
|
|
21
24
|
var Playground = function Playground(_ref) {
|
|
22
25
|
var rid = _ref.rid,
|
|
23
26
|
path = _ref.path,
|
|
24
|
-
|
|
25
|
-
ratio = _ref$ratio === void 0 ? 0.62 : _ref$ratio,
|
|
27
|
+
ratio = _ref.ratio,
|
|
26
28
|
_ref$height = _ref.height,
|
|
27
29
|
height = _ref$height === void 0 ? 400 : _ref$height;
|
|
28
30
|
|
|
@@ -30,26 +32,44 @@ var Playground = function Playground(_ref) {
|
|
|
30
32
|
var _useContext = useContext(ThemeAntVContext),
|
|
31
33
|
meta = _useContext.meta;
|
|
32
34
|
|
|
33
|
-
var exampleTopics = meta.exampleTopics; // '
|
|
35
|
+
var exampleTopics = meta.exampleTopics; // 'case/area/demo/area5.ts'
|
|
34
36
|
|
|
35
|
-
var _ref2 = path.match(
|
|
37
|
+
var _ref2 = path.match(/([\w-]+)\/([\w-]+)\/demo\/([\w-]+)/i),
|
|
36
38
|
_ref3 = _slicedToArray(_ref2, 4),
|
|
37
39
|
_ = _ref3[0],
|
|
38
40
|
topic = _ref3[1],
|
|
39
41
|
example = _ref3[2],
|
|
40
42
|
demo = _ref3[3];
|
|
41
43
|
|
|
44
|
+
var themeConfig = useSiteData();
|
|
45
|
+
var defaultSize = get(themeConfig, 'editor.playgroundSize', 0.38);
|
|
46
|
+
var size = isNaN(Number(ratio)) ? defaultSize : Number(ratio);
|
|
42
47
|
return /*#__PURE__*/React.createElement("div", {
|
|
43
48
|
className: styles.container,
|
|
44
49
|
style: {
|
|
45
50
|
height: height
|
|
46
51
|
}
|
|
47
52
|
}, /*#__PURE__*/React.createElement(CodeRunner, {
|
|
53
|
+
isPlayground: true,
|
|
48
54
|
exampleTopics: exampleTopics,
|
|
49
55
|
topic: topic,
|
|
50
56
|
example: example,
|
|
51
|
-
demo: demo
|
|
57
|
+
demo: demo,
|
|
58
|
+
size: size,
|
|
59
|
+
replaceId: rid
|
|
52
60
|
}));
|
|
53
61
|
};
|
|
54
62
|
|
|
55
|
-
|
|
63
|
+
function ErrorFallback(_ref4) {
|
|
64
|
+
var error = _ref4.error;
|
|
65
|
+
console.log(error);
|
|
66
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
role: "alert"
|
|
68
|
+
}, /*#__PURE__*/React.createElement("p", null, "Something went wrong:"), /*#__PURE__*/React.createElement("pre", null, error.message));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default (function (props) {
|
|
72
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
73
|
+
FallbackComponent: ErrorFallback
|
|
74
|
+
}, /*#__PURE__*/React.createElement(Playground, props));
|
|
75
|
+
});
|
|
@@ -29,11 +29,10 @@ export default (function () {
|
|
|
29
29
|
|
|
30
30
|
if (p === '/' || p === '/zh' || p === '/en' || p === '/en/') return /*#__PURE__*/React.createElement(Index, null); // 匹配 navs 中的 docs 路由
|
|
31
31
|
|
|
32
|
-
var
|
|
33
|
-
return nav.slug.startsWith('docs/');
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
return nav.slug.split('/').find(function (item) {
|
|
32
|
+
var docsRoutes = navs.filter(function (nav) {
|
|
33
|
+
return nav.slug && nav.slug.startsWith('docs/');
|
|
34
|
+
}).map(function (nav) {
|
|
35
|
+
return nav.slug && nav.slug.split('/').find(function (item) {
|
|
37
36
|
return item !== 'docs';
|
|
38
37
|
});
|
|
39
38
|
});
|
|
@@ -5,14 +5,15 @@ 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';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
8
|
+
import { useLocale, useSiteData, FormattedMessage } from 'dumi';
|
|
9
|
+
import { SEO } from "dumi/theme/slots/SEO";
|
|
10
|
+
import { Header } from "dumi/theme/slots/Header";
|
|
11
|
+
import { Detail } from 'dumi/theme/slots/Detail';
|
|
12
|
+
import { Features } from "dumi/theme/slots/Features";
|
|
13
|
+
import { Cases } from "dumi/theme/slots/Cases";
|
|
14
|
+
import { Companies } from "dumi/theme/slots/Companies";
|
|
15
|
+
import { Footer } from "dumi/theme/slots/Footer";
|
|
16
|
+
import { size } from 'lodash-es';
|
|
16
17
|
/**
|
|
17
18
|
* Index 路由下的入口
|
|
18
19
|
* - 获取数据
|
|
@@ -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
|
|
|
@@ -53,7 +56,6 @@ export var Index = function Index() {
|
|
|
53
56
|
}, detail);
|
|
54
57
|
|
|
55
58
|
var featuresProps = {
|
|
56
|
-
title: title,
|
|
57
59
|
features: features,
|
|
58
60
|
className: className,
|
|
59
61
|
style: style,
|
|
@@ -64,8 +66,15 @@ export var Index = function Index() {
|
|
|
64
66
|
style: style,
|
|
65
67
|
className: className
|
|
66
68
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
var metaTitle = detailProps.title;
|
|
70
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SEO, {
|
|
71
|
+
title: "".concat(metaTitle[locale.id]),
|
|
72
|
+
titleSuffix: "AntV",
|
|
73
|
+
lang: locale.id
|
|
74
|
+
}), /*#__PURE__*/React.createElement(Header, null), size(detail) ? /*#__PURE__*/React.createElement(Detail, detailProps) : null, size(features) ? /*#__PURE__*/React.createElement(Features, featuresProps) : null, size(cases) ? /*#__PURE__*/React.createElement(Cases, casesProps) : null, size(companies) ? /*#__PURE__*/React.createElement(Companies, {
|
|
75
|
+
title: /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
76
|
+
id: isAntVSite ? "2000+ 公司正在使用" : "感谢信赖"
|
|
77
|
+
}),
|
|
69
78
|
companies: companies
|
|
70
|
-
}), /*#__PURE__*/React.createElement(Footer, null));
|
|
79
|
+
}) : null, /*#__PURE__*/React.createElement(Footer, null));
|
|
71
80
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ManualContent } from "
|
|
3
|
-
import { Header } from "
|
|
4
|
-
import { Footer } from "
|
|
2
|
+
import { ManualContent } from "dumi/theme/slots/ManualContent";
|
|
3
|
+
import { Header } from "dumi/theme/slots/Header";
|
|
4
|
+
import { Footer } from "dumi/theme/slots/Footer";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Manual 路由下的入口
|
|
@@ -10,5 +10,7 @@ export var Manual = function Manual(_ref) {
|
|
|
10
10
|
var children = _ref.children;
|
|
11
11
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, {
|
|
12
12
|
isHomePage: false
|
|
13
|
-
}), /*#__PURE__*/React.createElement(ManualContent, null, " ", children, " "), /*#__PURE__*/React.createElement(Footer,
|
|
13
|
+
}), /*#__PURE__*/React.createElement(ManualContent, null, " ", children, " "), /*#__PURE__*/React.createElement(Footer, {
|
|
14
|
+
isDynamicFooter: true
|
|
15
|
+
}));
|
|
14
16
|
};
|
package/dist/pages/404.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { SEO } from "dumi/theme/slots/SEO";
|
|
3
|
+
import { Header } from "dumi/theme/slots/Header";
|
|
4
|
+
import { NotFound as NotFoundPage } from "dumi/theme/slots/404";
|
|
5
|
+
import { Footer } from "dumi/theme/slots/Footer";
|
|
5
6
|
/**
|
|
6
7
|
* 404 页面
|
|
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 {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
18
|
+
import { SEO } from "dumi/theme/slots/SEO";
|
|
19
|
+
import { Header } from "dumi/theme/slots/Header";
|
|
20
|
+
import { ExampleSider } from "dumi/theme/slots/ExampleSider";
|
|
21
|
+
import { CodeRunner } from "dumi/theme/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
|
|
@@ -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,7 @@ import React, { useState } from 'react';
|
|
|
14
14
|
import { Anchor, Menu } from 'antd';
|
|
15
15
|
import { useLocale } from 'dumi';
|
|
16
16
|
import { createFromIconfontCN } from '@ant-design/icons';
|
|
17
|
+
import { getCategoryId } from "../../../../utils";
|
|
17
18
|
import styles from "../../../../index.module.less";
|
|
18
19
|
var MenuIcon = createFromIconfontCN({
|
|
19
20
|
scriptUrl: '//at.alicdn.com/t/font_470089_1lnym745udm.js' // generated by iconfont.cn
|
|
@@ -66,7 +67,7 @@ export var LeftMenu = function LeftMenu(props) {
|
|
|
66
67
|
return /*#__PURE__*/React.createElement(Menu.Item, {
|
|
67
68
|
key: example.id
|
|
68
69
|
}, /*#__PURE__*/React.createElement(Anchor.Link, {
|
|
69
|
-
href: "#
|
|
70
|
+
href: "#".concat(getCategoryId(topic.id, example.id)),
|
|
70
71
|
title: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, example.title[locale.id]))
|
|
71
72
|
}));
|
|
72
73
|
}));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Link, useLocale } from 'dumi';
|
|
3
|
+
import cx from 'classnames';
|
|
3
4
|
import { Badge } from 'antd';
|
|
5
|
+
import { ic } from "../../../../../slots/hooks";
|
|
4
6
|
import styles from "../../../index.module.less";
|
|
5
7
|
/**
|
|
6
8
|
* DEMO 的卡片预览
|
|
@@ -17,10 +19,13 @@ export var DemoCard = function DemoCard(props) {
|
|
|
17
19
|
var locale = useLocale();
|
|
18
20
|
|
|
19
21
|
var renderCardInternal = function renderCardInternal() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
var img = demo.screenshot || 'https://gw.alipayobjects.com/os/s/prod/antv/assets/image/screenshot-placeholder-b8e70.png';
|
|
23
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
className: cx('demo-card-screenshot', styles.screenshot),
|
|
25
|
+
style: {
|
|
26
|
+
backgroundImage: "url(\"".concat(img, "\")")
|
|
27
|
+
}
|
|
28
|
+
}));
|
|
24
29
|
};
|
|
25
30
|
|
|
26
31
|
return /*#__PURE__*/React.createElement(Link, {
|
|
@@ -29,5 +34,5 @@ export var DemoCard = function DemoCard(props) {
|
|
|
29
34
|
}, demo.isNew ? /*#__PURE__*/React.createElement(Badge.Ribbon, {
|
|
30
35
|
text: "new",
|
|
31
36
|
className: styles.customRibbon
|
|
32
|
-
}, renderCardInternal()) : renderCardInternal(), /*#__PURE__*/React.createElement("h4", null, demo.title
|
|
37
|
+
}, renderCardInternal()) : renderCardInternal(), /*#__PURE__*/React.createElement("h4", null, ic(demo.title)));
|
|
33
38
|
};
|
|
@@ -7,6 +7,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { useLocale } from 'dumi';
|
|
9
9
|
import { DemoCard } from "./DemoCard";
|
|
10
|
+
import { getCategoryId } from "../../utils";
|
|
10
11
|
import styles from "../../index.module.less";
|
|
11
12
|
/**
|
|
12
13
|
* Examples 首页内容预览组件
|
|
@@ -63,7 +64,7 @@ export var GalleryPageContent = function GalleryPageContent(props) {
|
|
|
63
64
|
return /*#__PURE__*/React.createElement("div", {
|
|
64
65
|
key: i
|
|
65
66
|
}, /*#__PURE__*/React.createElement("h2", {
|
|
66
|
-
id:
|
|
67
|
+
id: getCategoryId(example.targetTopic.id, example.id)
|
|
67
68
|
}, example.title[locale.id]), /*#__PURE__*/React.createElement("ul", {
|
|
68
69
|
className: styles.galleryList
|
|
69
70
|
}, example.demos.map(function (demo) {
|
|
@@ -14,8 +14,10 @@ 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 {
|
|
18
|
-
import {
|
|
17
|
+
import { useLocale } from 'dumi';
|
|
18
|
+
import { SEO } from "dumi/theme/slots/SEO";
|
|
19
|
+
import { Header } from "dumi/theme/slots/Header";
|
|
20
|
+
import { Footer } from "dumi/theme/slots/Footer";
|
|
19
21
|
import NavigatorBanner from "../../slots/Header/Products/NavigatorBanner";
|
|
20
22
|
import { VerticalAlignTopOutlined } from '@ant-design/icons';
|
|
21
23
|
import { Article } from "./components/Article";
|
|
@@ -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,
|
|
@@ -199,6 +199,11 @@
|
|
|
199
199
|
|
|
200
200
|
.layout {
|
|
201
201
|
margin: 24px 0 32px;
|
|
202
|
+
:global {
|
|
203
|
+
.ant-layout-content {
|
|
204
|
+
background-color: #ffffff;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
202
207
|
}
|
|
203
208
|
|
|
204
209
|
.main {
|
|
@@ -206,6 +211,7 @@
|
|
|
206
211
|
width: calc(100% - @toc-width);
|
|
207
212
|
padding-left: 48px;
|
|
208
213
|
padding-right: 24px;
|
|
214
|
+
padding-bottom: 24px;
|
|
209
215
|
overflow: hidden;
|
|
210
216
|
|
|
211
217
|
.meta {
|
|
@@ -369,6 +375,12 @@
|
|
|
369
375
|
transition: all 0.3s;
|
|
370
376
|
margin: 12px;
|
|
371
377
|
|
|
378
|
+
.screenshot {
|
|
379
|
+
background-size: contain;
|
|
380
|
+
background-repeat: no-repeat;
|
|
381
|
+
background-position: center;
|
|
382
|
+
}
|
|
383
|
+
|
|
372
384
|
> div {
|
|
373
385
|
border: 1px solid @border-color-split;
|
|
374
386
|
border-radius: 6px;
|
|
@@ -515,6 +527,7 @@
|
|
|
515
527
|
margin-top: 30px;
|
|
516
528
|
padding-left: 24px;
|
|
517
529
|
padding-right: 24px;
|
|
530
|
+
margin-bottom: 30px;
|
|
518
531
|
}
|
|
519
532
|
}
|
|
520
533
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCategoryId(topicId: any, exampleId: any): string;
|
package/dist/plugin/index.js
CHANGED
|
@@ -33,6 +33,9 @@ var plugin_default = (api) => {
|
|
|
33
33
|
api.modifyDefaultConfig((memo) => {
|
|
34
34
|
memo.resolve.codeBlockMode = "passive";
|
|
35
35
|
memo.exportStatic.extraRoutePaths = (0, import_examples.getExamplePaths)();
|
|
36
|
+
memo.mfsu = false;
|
|
37
|
+
memo.jsMinifier = "terser";
|
|
38
|
+
memo.favicons = ["https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*7svFR6wkPMoAAAAAAAAAAAAADmJ7AQ/original"];
|
|
36
39
|
return memo;
|
|
37
40
|
});
|
|
38
41
|
const pages = [
|
|
@@ -40,6 +43,14 @@ var plugin_default = (api) => {
|
|
|
40
43
|
id: "dumi-theme-antv-homepage",
|
|
41
44
|
absPath: "/"
|
|
42
45
|
},
|
|
46
|
+
{
|
|
47
|
+
id: "dumi-theme-antv-en-homepage",
|
|
48
|
+
absPath: "/en/"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "dumi-theme-antv-zh-homepage",
|
|
52
|
+
absPath: "/zh/"
|
|
53
|
+
},
|
|
43
54
|
{
|
|
44
55
|
id: "dumi-theme-antv-example-list-zh",
|
|
45
56
|
absPath: "/examples",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Layout } from 'antd';
|
|
3
|
+
import styles from "./index.module.less";
|
|
4
|
+
|
|
5
|
+
var Article = function Article(props) {
|
|
6
|
+
return /*#__PURE__*/React.createElement(Layout.Content, {
|
|
7
|
+
className: styles.article
|
|
8
|
+
}, /*#__PURE__*/React.createElement("article", props));
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default Article;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link } from 'dumi';
|
|
3
|
+
import styles from "./Notification.module.less";
|
|
4
|
+
var numberImages = ['https://gw.alipayobjects.com/zos/antfincdn/IqREAm36K7/1.png', 'https://gw.alipayobjects.com/zos/antfincdn/3fG1Iqjfnz/2.png'];
|
|
5
|
+
|
|
6
|
+
var Notification = function Notification(_ref) {
|
|
7
|
+
var _ref$index = _ref.index,
|
|
8
|
+
index = _ref$index === void 0 ? 0 : _ref$index,
|
|
9
|
+
type = _ref.type,
|
|
10
|
+
title = _ref.title,
|
|
11
|
+
date = _ref.date,
|
|
12
|
+
_ref$link = _ref.link,
|
|
13
|
+
link = _ref$link === void 0 ? '' : _ref$link;
|
|
14
|
+
var children = /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
className: styles.container
|
|
16
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
17
|
+
className: styles.number,
|
|
18
|
+
src: numberImages[index],
|
|
19
|
+
alt: index.toString()
|
|
20
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: styles.content
|
|
22
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
23
|
+
className: styles.description
|
|
24
|
+
}, type, " \u2027 ", title), /*#__PURE__*/React.createElement("p", {
|
|
25
|
+
className: styles.date
|
|
26
|
+
}, date)));
|
|
27
|
+
|
|
28
|
+
if (link.startsWith('http')) {
|
|
29
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
30
|
+
href: link,
|
|
31
|
+
target: "_blank",
|
|
32
|
+
rel: "noopener noreferrer",
|
|
33
|
+
className: styles.notification
|
|
34
|
+
}, children);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return /*#__PURE__*/React.createElement(Link, {
|
|
38
|
+
to: link,
|
|
39
|
+
className: styles.notification
|
|
40
|
+
}, children);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default Notification;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
.notification {
|
|
2
|
+
width: 50%;
|
|
3
|
+
margin-right: 2%;
|
|
4
|
+
|
|
5
|
+
&:last-child {
|
|
6
|
+
margin-right: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.container {
|
|
10
|
+
height: 44px;
|
|
11
|
+
display: flex;
|
|
12
|
+
|
|
13
|
+
.number {
|
|
14
|
+
height: 100%;
|
|
15
|
+
width: 44px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.content {
|
|
19
|
+
padding-left: 20px;
|
|
20
|
+
color: rgba(49, 70, 89, 1);
|
|
21
|
+
text-align: left;
|
|
22
|
+
|
|
23
|
+
.description {
|
|
24
|
+
top: 0;
|
|
25
|
+
font-size: 1.14em;
|
|
26
|
+
margin-bottom: 0;
|
|
27
|
+
transition: all 0.3s;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.date {
|
|
31
|
+
color: rgba(216, 203, 249, 1);
|
|
32
|
+
bottom: 0;
|
|
33
|
+
font-size: 1em;
|
|
34
|
+
margin-top: 4px;
|
|
35
|
+
margin-bottom: 0;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:hover .description {
|
|
41
|
+
color: rgba(89, 126, 247, 1);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@media (max-width: 900px) {
|
|
46
|
+
.notification {
|
|
47
|
+
position: absolute;
|
|
48
|
+
width: 100%;
|
|
49
|
+
|
|
50
|
+
&:nth-child(1) {
|
|
51
|
+
animation: showAndHide0 6s infinite;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&:nth-child(2) {
|
|
55
|
+
top: 44px;
|
|
56
|
+
animation: showAndHide1 6s infinite;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@media (max-width: 768px) {
|
|
62
|
+
.notification {
|
|
63
|
+
width: 100%;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@keyframes showAndHide0 {
|
|
68
|
+
0% {
|
|
69
|
+
opacity: 1;
|
|
70
|
+
top: 0px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
33.3% {
|
|
74
|
+
opacity: 1;
|
|
75
|
+
top: 0px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
50% {
|
|
79
|
+
opacity: 0;
|
|
80
|
+
top: -30px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
83.3% {
|
|
84
|
+
opacity: 0;
|
|
85
|
+
top: 30px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
100% {
|
|
89
|
+
opacity: 1;
|
|
90
|
+
top: 0px;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Standard syntax */
|
|
95
|
+
@keyframes showAndHide1 {
|
|
96
|
+
0% {
|
|
97
|
+
opacity: 0;
|
|
98
|
+
top: 30px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
33.3% {
|
|
102
|
+
opacity: 0;
|
|
103
|
+
top: 30px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
50% {
|
|
107
|
+
opacity: 1;
|
|
108
|
+
top: 0px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
83.3% {
|
|
112
|
+
opacity: 1;
|
|
113
|
+
top: 0px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
100% {
|
|
117
|
+
opacity: 0;
|
|
118
|
+
top: -30px;
|
|
119
|
+
}
|
|
120
|
+
}
|