@antv/dumi-theme-antv 0.1.0 → 0.2.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/es/antv/404/index.d.ts +2 -0
- package/es/antv/404/index.js +1 -0
- package/es/antv/Banner/Notification.d.ts +10 -0
- package/es/antv/Banner/index.d.ts +25 -0
- package/es/antv/Banner/index.js +25 -36
- package/es/antv/Cases/Cases.d.ts +18 -0
- package/es/antv/Cases/Cases.js +1 -3
- package/es/antv/Features/FeatureCard.d.ts +8 -0
- package/es/antv/Features/index.d.ts +15 -0
- package/es/antv/Features/index.js +1 -1
- package/es/antv/Footer/index.d.ts +12 -0
- package/es/antv/Footer/index.js +22 -17
- package/es/antv/Header/Logo.d.ts +4 -0
- package/es/antv/Products/Product.d.ts +14 -0
- package/es/antv/Products/Product.js +4 -4
- package/es/antv/Products/getNewProducts.d.ts +24 -0
- package/es/antv/Products/getNewProducts.js +3 -9
- package/es/antv/Products/getProducts.d.ts +51 -0
- package/es/antv/Products/getProducts.js +3 -9
- package/es/antv/Products/index.d.ts +9 -0
- package/es/antv/Products/index.js +2 -2
- package/es/antv/hooks.d.ts +14 -0
- package/es/antv/utils.d.ts +5 -0
- package/es/builtins/API.d.ts +3 -0
- package/es/builtins/Alert.d.ts +3 -0
- package/es/builtins/Alert.js +1 -3
- package/es/builtins/Badge.d.ts +3 -0
- package/es/builtins/Badge.js +1 -3
- package/es/builtins/Example.d.ts +5 -0
- package/es/builtins/Previewer.d.ts +39 -0
- package/es/builtins/Previewer.js +7 -7
- package/es/builtins/SourceCode.d.ts +10 -0
- package/es/builtins/SourceCode.js +5 -7
- package/es/builtins/Table.d.ts +4 -0
- package/es/builtins/Tree.d.ts +4 -0
- package/es/builtins/Tree.js +3 -9
- package/es/components/Dark.d.ts +9 -0
- package/es/components/LocaleSelect.d.ts +6 -0
- package/es/components/Navbar.d.ts +10 -0
- package/es/components/Navbar.js +3 -3
- package/es/components/SearchBar.d.ts +4 -0
- package/es/components/SearchBar.js +3 -5
- package/es/components/SideMenu.d.ts +10 -0
- package/es/components/SideMenu.js +5 -5
- package/es/components/SlugList.d.ts +7 -0
- package/es/components/SlugList.js +16 -11
- package/es/declaration.d.ts +1 -0
- package/es/layout.d.ts +5 -0
- package/es/layout.js +7 -6
- package/package.json +7 -3
- package/src/antv/Banner/index.tsx +51 -33
- package/src/declaration.d.ts +1 -0
- package/src/layout.tsx +1 -0
package/es/antv/404/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { Link } from 'dumi/theme';
|
|
|
6
6
|
var NotFoundPage = function NotFoundPage() {
|
|
7
7
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Result // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
8
|
, {
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
10
|
status: '404',
|
|
10
11
|
title: "404",
|
|
11
12
|
subTitle: "Sorry, the page you visited does not exist.",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NotificationProps } from "./Notification";
|
|
3
|
+
declare type BannerButtonShape = "round" | "square";
|
|
4
|
+
interface BannerButton {
|
|
5
|
+
text: string;
|
|
6
|
+
link: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
type?: string;
|
|
9
|
+
shape?: BannerButtonShape;
|
|
10
|
+
}
|
|
11
|
+
interface BannerProps {
|
|
12
|
+
coverImage?: React.ReactNode;
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
notifications?: NotificationProps[];
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
className?: string;
|
|
18
|
+
video?: string;
|
|
19
|
+
showGithubStars?: boolean;
|
|
20
|
+
buttons?: BannerButton[];
|
|
21
|
+
onCloseVideo?: () => void;
|
|
22
|
+
onPlayVideo?: () => void;
|
|
23
|
+
}
|
|
24
|
+
declare const Banner: React.FC<BannerProps>;
|
|
25
|
+
export default Banner;
|
package/es/antv/Banner/index.js
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import { context } from "dumi/theme";
|
|
3
|
+
import gh from "parse-github-url";
|
|
4
|
+
import React, { useContext } from "react";
|
|
5
|
+
import GitHubButton from "react-github-button"; //@ts-ignore
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
8
|
-
|
|
9
|
-
/* eslint-disable react/no-array-index-key */
|
|
10
|
-
|
|
11
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
12
|
-
import React, { useContext } from 'react';
|
|
13
|
-
import GitHubButton from 'react-github-button';
|
|
14
|
-
import gh from 'parse-github-url';
|
|
15
|
-
import classNames from 'classnames';
|
|
16
|
-
import { context } from 'dumi/theme'; // @ts-ignore
|
|
17
|
-
|
|
18
|
-
import styles from './Banner.module.less';
|
|
19
|
-
import Notification from './Notification';
|
|
20
|
-
var backLeftBottom = 'https://gw.alipayobjects.com/zos/basement_prod/441d5eaf-e623-47cd-b9b9-2a581d9ce1e3.svg';
|
|
7
|
+
import styles from "./Banner.module.less";
|
|
8
|
+
import Notification from "./Notification";
|
|
9
|
+
var backLeftBottom = "https://gw.alipayobjects.com/zos/basement_prod/441d5eaf-e623-47cd-b9b9-2a581d9ce1e3.svg";
|
|
21
10
|
|
|
22
11
|
var Banner = function Banner(_ref) {
|
|
23
12
|
var coverImage = _ref.coverImage,
|
|
@@ -37,33 +26,33 @@ var Banner = function Banner(_ref) {
|
|
|
37
26
|
|
|
38
27
|
var githubUrl = repository.url;
|
|
39
28
|
var notificationsNode = notifications.slice(0, 2).map(function (notification, i) {
|
|
40
|
-
return /*#__PURE__*/React.createElement(Notification,
|
|
29
|
+
return /*#__PURE__*/React.createElement(Notification, Object.assign({
|
|
41
30
|
index: i,
|
|
42
31
|
key: i
|
|
43
32
|
}, notification));
|
|
44
33
|
});
|
|
45
34
|
var renderButtons = buttons.map(function (button, i) {
|
|
46
|
-
var ButtonLink =
|
|
35
|
+
var ButtonLink = "a";
|
|
47
36
|
var buttonProps = {};
|
|
48
37
|
|
|
49
|
-
if (button.link.startsWith(
|
|
50
|
-
buttonProps.target =
|
|
51
|
-
buttonProps.rel =
|
|
38
|
+
if (button.link.startsWith("http")) {
|
|
39
|
+
buttonProps.target = "_blank";
|
|
40
|
+
buttonProps.rel = "noopener noreferrer";
|
|
52
41
|
}
|
|
53
42
|
|
|
54
|
-
if (ButtonLink ===
|
|
43
|
+
if (ButtonLink === "a") {
|
|
55
44
|
buttonProps.href = button.link;
|
|
56
45
|
} else {
|
|
57
46
|
buttonProps.to = button.link;
|
|
58
47
|
}
|
|
59
48
|
|
|
60
49
|
var _button$shape = button.shape,
|
|
61
|
-
shape = _button$shape === void 0 ?
|
|
62
|
-
return /*#__PURE__*/React.createElement(ButtonLink,
|
|
63
|
-
className: classNames(styles.buttonLink, styles[button.type ||
|
|
50
|
+
shape = _button$shape === void 0 ? "round" : _button$shape;
|
|
51
|
+
return /*#__PURE__*/React.createElement(ButtonLink, Object.assign({}, buttonProps, {
|
|
52
|
+
className: classNames(styles.buttonLink, styles[button.type || ""], button.type === "primary" ? "primary-button" : "common-button"),
|
|
64
53
|
key: i,
|
|
65
|
-
style:
|
|
66
|
-
borderRadius: shape ===
|
|
54
|
+
style: Object.assign({
|
|
55
|
+
borderRadius: shape === "round" ? "1000px" : "4px"
|
|
67
56
|
}, button.style)
|
|
68
57
|
}), /*#__PURE__*/React.createElement("span", {
|
|
69
58
|
className: styles.button
|
|
@@ -94,17 +83,17 @@ var Banner = function Banner(_ref) {
|
|
|
94
83
|
}, /*#__PURE__*/React.createElement("div", {
|
|
95
84
|
className: styles.text
|
|
96
85
|
}, /*#__PURE__*/React.createElement("div", {
|
|
97
|
-
className: classNames(styles.title,
|
|
86
|
+
className: classNames(styles.title, "banner-title")
|
|
98
87
|
}, title), /*#__PURE__*/React.createElement("div", {
|
|
99
|
-
className: classNames(styles.description,
|
|
88
|
+
className: classNames(styles.description, "banner-description")
|
|
100
89
|
}, description), /*#__PURE__*/React.createElement("div", {
|
|
101
|
-
className: classNames(styles.buttons,
|
|
90
|
+
className: classNames(styles.buttons, "banner-buttons")
|
|
102
91
|
}, renderButtons)), /*#__PURE__*/React.createElement("div", {
|
|
103
|
-
className: classNames(styles.notifications,
|
|
92
|
+
className: classNames(styles.notifications, "notifications")
|
|
104
93
|
}, notificationsNode), /*#__PURE__*/React.createElement("div", {
|
|
105
|
-
className: classNames(styles.teaser,
|
|
94
|
+
className: classNames(styles.teaser, "teaser")
|
|
106
95
|
}, /*#__PURE__*/React.createElement("div", {
|
|
107
|
-
className: classNames(styles.teaserimg,
|
|
96
|
+
className: classNames(styles.teaserimg, "teaser-img")
|
|
108
97
|
}, coverImage)), /*#__PURE__*/React.createElement("img", {
|
|
109
98
|
className: styles.backLeftBottom,
|
|
110
99
|
src: backLeftBottom,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'slick-carousel/slick/slick.css';
|
|
3
|
+
import 'slick-carousel/slick/slick-theme.css';
|
|
4
|
+
interface Case {
|
|
5
|
+
logo?: string;
|
|
6
|
+
isAppLogo?: boolean;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
link?: string;
|
|
10
|
+
image: string;
|
|
11
|
+
}
|
|
12
|
+
interface CasesProps {
|
|
13
|
+
cases: Case[];
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const Cases: React.FC<CasesProps>;
|
|
18
|
+
export default Cases;
|
package/es/antv/Cases/Cases.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
2
|
import React from 'react';
|
|
5
3
|
import { ArrowLeftOutlined, ArrowRightOutlined } from '@ant-design/icons';
|
|
@@ -113,7 +111,7 @@ var Cases = function Cases(_ref) {
|
|
|
113
111
|
return /*#__PURE__*/React.createElement("div", {
|
|
114
112
|
className: classNames(styles.wrapper, className),
|
|
115
113
|
style: style
|
|
116
|
-
}, /*#__PURE__*/React.createElement(Slider,
|
|
114
|
+
}, /*#__PURE__*/React.createElement(Slider, Object.assign({}, sliderSettings, {
|
|
117
115
|
className: styles.slider,
|
|
118
116
|
ref: function ref(c) {
|
|
119
117
|
slider = c;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface Card {
|
|
3
|
+
icon: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
}
|
|
7
|
+
interface FeaturesProps {
|
|
8
|
+
title?: string;
|
|
9
|
+
features: Card[];
|
|
10
|
+
className?: string;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
id?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const Features: React.FC<FeaturesProps>;
|
|
15
|
+
export default Features;
|
|
@@ -21,7 +21,7 @@ var Features = function Features(_ref) {
|
|
|
21
21
|
key: card.title,
|
|
22
22
|
md: 8,
|
|
23
23
|
xs: 24
|
|
24
|
-
}, /*#__PURE__*/React.createElement(FeatureCard, card));
|
|
24
|
+
}, /*#__PURE__*/React.createElement(FeatureCard, Object.assign({}, card)));
|
|
25
25
|
});
|
|
26
26
|
return children;
|
|
27
27
|
}; // for small screen
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FooterProps as RcFooterProps } from "rc-footer";
|
|
2
|
+
import "rc-footer/assets/index.less";
|
|
3
|
+
import React from "react";
|
|
4
|
+
export declare const OLD_SITE_DOMAIN = "https://antv-2018.alipay.com";
|
|
5
|
+
interface FooterProps extends RcFooterProps {
|
|
6
|
+
rootDomain?: string;
|
|
7
|
+
language?: string;
|
|
8
|
+
githubUrl?: string;
|
|
9
|
+
location: Location;
|
|
10
|
+
}
|
|
11
|
+
declare const Footer: React.FC<FooterProps>;
|
|
12
|
+
export default Footer;
|
package/es/antv/Footer/index.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
var _excluded = ["columns", "bottom", "theme", "language", "rootDomain", "location"];
|
|
2
|
-
|
|
3
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
-
|
|
5
1
|
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
2
|
|
|
7
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -16,9 +12,18 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
16
12
|
|
|
17
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
16
|
+
var t = {};
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
for (var p in s) {
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
23
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
};
|
|
22
27
|
|
|
23
28
|
import { GithubOutlined, QuestionCircleOutlined, WeiboOutlined, ZhihuOutlined } from "@ant-design/icons";
|
|
24
29
|
import classnames from "classnames"; // import { withPrefix } from "gatsby";
|
|
@@ -36,16 +41,16 @@ var withPrefix = function withPrefix(str) {
|
|
|
36
41
|
return str;
|
|
37
42
|
};
|
|
38
43
|
|
|
39
|
-
var Footer = function Footer(
|
|
40
|
-
var columns =
|
|
41
|
-
bottom =
|
|
42
|
-
|
|
43
|
-
theme =
|
|
44
|
-
language =
|
|
45
|
-
|
|
46
|
-
rootDomain =
|
|
47
|
-
location =
|
|
48
|
-
restProps =
|
|
44
|
+
var Footer = function Footer(_a) {
|
|
45
|
+
var columns = _a.columns,
|
|
46
|
+
bottom = _a.bottom,
|
|
47
|
+
_a$theme = _a.theme,
|
|
48
|
+
theme = _a$theme === void 0 ? "dark" : _a$theme,
|
|
49
|
+
language = _a.language,
|
|
50
|
+
_a$rootDomain = _a.rootDomain,
|
|
51
|
+
rootDomain = _a$rootDomain === void 0 ? "" : _a$rootDomain,
|
|
52
|
+
location = _a.location,
|
|
53
|
+
restProps = __rest(_a, ["columns", "bottom", "theme", "language", "rootDomain", "location"]);
|
|
49
54
|
|
|
50
55
|
var _useState = useState(false),
|
|
51
56
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -198,7 +203,7 @@ var Footer = function Footer(_ref) {
|
|
|
198
203
|
return [col1, col2, col3, more];
|
|
199
204
|
};
|
|
200
205
|
|
|
201
|
-
return /*#__PURE__*/React.createElement(RCFooter,
|
|
206
|
+
return /*#__PURE__*/React.createElement(RCFooter, Object.assign({
|
|
202
207
|
maxColumnsPerRow: 5,
|
|
203
208
|
theme: theme,
|
|
204
209
|
columns: columns || getColums(),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ProductType } from "./getProducts";
|
|
3
|
+
interface ProductProps {
|
|
4
|
+
name?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
slogan?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
url?: string;
|
|
9
|
+
links: ProductType["links"];
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
language?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const Product: React.FC<ProductProps>;
|
|
14
|
+
export default Product;
|
|
@@ -8,8 +8,6 @@ var getTarget = function getTarget(url) {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
var Product = function Product(_ref) {
|
|
11
|
-
var _links$home$title, _links$example$title;
|
|
12
|
-
|
|
13
11
|
var name = _ref.name,
|
|
14
12
|
icon = _ref.icon,
|
|
15
13
|
_ref$url = _ref.url,
|
|
@@ -21,6 +19,8 @@ var Product = function Product(_ref) {
|
|
|
21
19
|
style = _ref.style,
|
|
22
20
|
language = _ref.language;
|
|
23
21
|
|
|
22
|
+
var _a, _b;
|
|
23
|
+
|
|
24
24
|
var _useTranslation = useTranslation(),
|
|
25
25
|
t = _useTranslation.t;
|
|
26
26
|
|
|
@@ -51,11 +51,11 @@ var Product = function Product(_ref) {
|
|
|
51
51
|
href: links.home.url,
|
|
52
52
|
target: getTarget(links.home.url || ""),
|
|
53
53
|
key: links.home.url
|
|
54
|
-
}, (
|
|
54
|
+
}, (_a = links.home.title) !== null && _a !== void 0 ? _a : t("产品首页")), links.example && /*#__PURE__*/React.createElement("a", {
|
|
55
55
|
href: links.example.url,
|
|
56
56
|
target: getTarget(links.example.url || ""),
|
|
57
57
|
key: links.example.url
|
|
58
|
-
}, (
|
|
58
|
+
}, (_b = links.example.title) !== null && _b !== void 0 ? _b : t("图表示例")))));
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
export default Product;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare type ProductType = {
|
|
2
|
+
links: {
|
|
3
|
+
/** 产品首页 */
|
|
4
|
+
readonly home?: {
|
|
5
|
+
url: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
};
|
|
8
|
+
/** 图表示例 */
|
|
9
|
+
readonly example?: {
|
|
10
|
+
url: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
};
|
|
13
|
+
/** 使用文档 */
|
|
14
|
+
readonly api?: {
|
|
15
|
+
url: string;
|
|
16
|
+
title?: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
[k: string]: any;
|
|
20
|
+
};
|
|
21
|
+
export declare function getNewProducts({ language, isChinaMirrorHost, }: {
|
|
22
|
+
language: "zh" | "en";
|
|
23
|
+
isChinaMirrorHost: boolean;
|
|
24
|
+
}): Promise<ProductType[]>;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
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
|
-
|
|
7
1
|
import { each } from "lodash";
|
|
8
2
|
export function getNewProducts(_ref) {
|
|
9
3
|
var language = _ref.language,
|
|
@@ -15,7 +9,7 @@ export function getNewProducts(_ref) {
|
|
|
15
9
|
return products.filter(function (d) {
|
|
16
10
|
return d.lang === language;
|
|
17
11
|
}).map(function (d) {
|
|
18
|
-
var links = typeof d.links === "string" ? JSON.parse(d.links) :
|
|
12
|
+
var links = typeof d.links === "string" ? JSON.parse(d.links) : Object.assign({}, d.links);
|
|
19
13
|
var newLinks = {};
|
|
20
14
|
each(links, function (value, k) {
|
|
21
15
|
var actualUrl = (value === null || value === void 0 ? void 0 : value.url) || "";
|
|
@@ -29,11 +23,11 @@ export function getNewProducts(_ref) {
|
|
|
29
23
|
}
|
|
30
24
|
}
|
|
31
25
|
|
|
32
|
-
newLinks[k] =
|
|
26
|
+
newLinks[k] = Object.assign(Object.assign({}, value), {
|
|
33
27
|
url: actualUrl
|
|
34
28
|
});
|
|
35
29
|
});
|
|
36
|
-
return
|
|
30
|
+
return Object.assign(Object.assign({}, d), {
|
|
37
31
|
links: newLinks
|
|
38
32
|
});
|
|
39
33
|
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const Categories: ["basic", "extension", "ecology"];
|
|
3
|
+
export interface ProductItem {
|
|
4
|
+
title: string;
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
slogan?: string;
|
|
7
|
+
description: string;
|
|
8
|
+
category: typeof Categories[number];
|
|
9
|
+
links?: Array<{
|
|
10
|
+
icon?: React.ReactNode;
|
|
11
|
+
title: React.ReactNode;
|
|
12
|
+
url?: string;
|
|
13
|
+
openExternal?: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
export declare type ValuesOf<T extends any[]> = T[number];
|
|
17
|
+
export declare const getProducts: ({ t, language, isChinaMirrorHost, }: {
|
|
18
|
+
t: (key: string) => string;
|
|
19
|
+
language: string;
|
|
20
|
+
isChinaMirrorHost?: boolean;
|
|
21
|
+
}) => ProductItem[];
|
|
22
|
+
declare const CATEGORY_TYPE: ["basic", "extension", "mobile", "ecology"];
|
|
23
|
+
export declare const CATEGORIES: Array<{
|
|
24
|
+
type: typeof CATEGORY_TYPE[number];
|
|
25
|
+
name: string;
|
|
26
|
+
}>;
|
|
27
|
+
export declare type ProductType = {
|
|
28
|
+
links: {
|
|
29
|
+
/** 产品首页 */
|
|
30
|
+
readonly home?: {
|
|
31
|
+
url: string;
|
|
32
|
+
title?: string;
|
|
33
|
+
};
|
|
34
|
+
/** 图表示例 */
|
|
35
|
+
readonly example?: {
|
|
36
|
+
url: string;
|
|
37
|
+
title?: string;
|
|
38
|
+
};
|
|
39
|
+
/** 使用文档 */
|
|
40
|
+
readonly api?: {
|
|
41
|
+
url: string;
|
|
42
|
+
title?: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
[k: string]: any;
|
|
46
|
+
};
|
|
47
|
+
export declare function getNewProducts({ language, isChinaMirrorHost, }: {
|
|
48
|
+
language: "zh" | "en";
|
|
49
|
+
isChinaMirrorHost: boolean;
|
|
50
|
+
}): Promise<ProductType[]>;
|
|
51
|
+
export {};
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
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
|
-
|
|
7
1
|
import { AreaChartOutlined, DingdingOutlined, GithubOutlined, HistoryOutlined, HomeOutlined, PieChartOutlined, ReadOutlined, YuqueOutlined } from "@ant-design/icons";
|
|
8
2
|
import { each } from "lodash";
|
|
9
3
|
import React from "react";
|
|
@@ -440,7 +434,7 @@ export function getNewProducts(_ref2) {
|
|
|
440
434
|
return products.filter(function (d) {
|
|
441
435
|
return d.lang === language;
|
|
442
436
|
}).map(function (d) {
|
|
443
|
-
var links = typeof d.links === "string" ? JSON.parse(d.links) :
|
|
437
|
+
var links = typeof d.links === "string" ? JSON.parse(d.links) : Object.assign({}, d.links);
|
|
444
438
|
var newLinks = {};
|
|
445
439
|
each(links, function (value, k) {
|
|
446
440
|
var actualUrl = (value === null || value === void 0 ? void 0 : value.url) || "";
|
|
@@ -454,11 +448,11 @@ export function getNewProducts(_ref2) {
|
|
|
454
448
|
}
|
|
455
449
|
}
|
|
456
450
|
|
|
457
|
-
newLinks[k] =
|
|
451
|
+
newLinks[k] = Object.assign(Object.assign({}, value), {
|
|
458
452
|
url: actualUrl
|
|
459
453
|
});
|
|
460
454
|
});
|
|
461
|
-
return
|
|
455
|
+
return Object.assign(Object.assign({}, d), {
|
|
462
456
|
links: newLinks
|
|
463
457
|
});
|
|
464
458
|
});
|
|
@@ -60,14 +60,14 @@ var Products = function Products(_ref) {
|
|
|
60
60
|
}, /*#__PURE__*/React.createElement("h3", null, t(name)), /*#__PURE__*/React.createElement("ul", null, products.filter(function (item) {
|
|
61
61
|
return item.category === type;
|
|
62
62
|
}).map(function (product) {
|
|
63
|
-
var
|
|
63
|
+
var _a, _b;
|
|
64
64
|
|
|
65
65
|
return /*#__PURE__*/React.createElement(Product, {
|
|
66
66
|
key: product.title,
|
|
67
67
|
name: product.title,
|
|
68
68
|
slogan: product.slogan || "",
|
|
69
69
|
description: product.description,
|
|
70
|
-
url: (
|
|
70
|
+
url: (_b = (_a = product.links) === null || _a === void 0 ? void 0 : _a.home) === null || _b === void 0 ? void 0 : _b.url,
|
|
71
71
|
icon: product.icon,
|
|
72
72
|
links: product.links,
|
|
73
73
|
language: language || i18n.language
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface NavigatorBannerProps {
|
|
2
|
+
post?: {
|
|
3
|
+
slug?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
};
|
|
6
|
+
type: "prev" | "next";
|
|
7
|
+
}
|
|
8
|
+
export declare const useChinaMirrorHost: () => [boolean];
|
|
9
|
+
export declare const usePrevAndNext: () => NavigatorBannerProps["post"][];
|
|
10
|
+
export declare const useLogoLink: ({ link, siteUrl, lang, }: {
|
|
11
|
+
link?: string;
|
|
12
|
+
siteUrl?: string;
|
|
13
|
+
lang?: string;
|
|
14
|
+
}) => [string];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare type Status = 'responded' | 'error' | 'timeout';
|
|
2
|
+
export declare const ping: (callback: (status: Status) => void) => NodeJS.Timeout;
|
|
3
|
+
export declare const capitalize: (s: string) => string;
|
|
4
|
+
export declare const getChinaMirrorHost: (host?: string) => string;
|
|
5
|
+
export {};
|
package/es/builtins/Alert.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
import React from 'react';
|
|
4
2
|
import './Alert.less';
|
|
5
3
|
export default (function (props) {
|
|
6
|
-
return /*#__PURE__*/React.createElement("div",
|
|
4
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
7
5
|
className: "__dumi-default-alert"
|
|
8
6
|
}, props));
|
|
9
7
|
});
|
package/es/builtins/Badge.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
import React from 'react';
|
|
4
2
|
import './Badge.less';
|
|
5
3
|
export default (function (props) {
|
|
6
|
-
return /*#__PURE__*/React.createElement("span",
|
|
4
|
+
return /*#__PURE__*/React.createElement("span", Object.assign({
|
|
7
5
|
className: "__dumi-default-badge"
|
|
8
6
|
}, props));
|
|
9
7
|
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IPreviewerComponentProps } from 'dumi/theme';
|
|
3
|
+
import './Previewer.less';
|
|
4
|
+
export interface IPreviewerProps extends IPreviewerComponentProps {
|
|
5
|
+
/**
|
|
6
|
+
* enable transform to change CSS containing block for demo
|
|
7
|
+
*/
|
|
8
|
+
transform?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* modify background for demo area
|
|
11
|
+
*/
|
|
12
|
+
background?: string;
|
|
13
|
+
/**
|
|
14
|
+
* collapse padding of demo area
|
|
15
|
+
*/
|
|
16
|
+
compact?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* configurations for action button
|
|
19
|
+
*/
|
|
20
|
+
hideActions?: ('CSB' | 'EXTERNAL' | 'RIDDLE')[];
|
|
21
|
+
/**
|
|
22
|
+
* show source code by default
|
|
23
|
+
*/
|
|
24
|
+
defaultShowCode?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* use iframe mode for this demo
|
|
27
|
+
*/
|
|
28
|
+
iframe?: true | number;
|
|
29
|
+
/**
|
|
30
|
+
* replace builtin demo url
|
|
31
|
+
*/
|
|
32
|
+
demoUrl?: string;
|
|
33
|
+
/**
|
|
34
|
+
* control action bar render
|
|
35
|
+
*/
|
|
36
|
+
actionBarRender?: (actionBarNode: React.ReactNode) => React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
declare const Previewer: React.FC<IPreviewerProps>;
|
|
39
|
+
export default Previewer;
|
package/es/builtins/Previewer.js
CHANGED
|
@@ -24,10 +24,10 @@ import './Previewer.less';
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
function getSourceType(file, source) {
|
|
27
|
-
var
|
|
27
|
+
var _a; // use file extension as source type first
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
var type = (
|
|
29
|
+
|
|
30
|
+
var type = (_a = file.match(/\.(\w+)$/)) === null || _a === void 0 ? void 0 : _a[1];
|
|
31
31
|
|
|
32
32
|
if (!type) {
|
|
33
33
|
type = source.tsx ? 'tsx' : 'jsx';
|
|
@@ -37,7 +37,7 @@ function getSourceType(file, source) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
var Previewer = function Previewer(oProps) {
|
|
40
|
-
var
|
|
40
|
+
var _a, _b, _c;
|
|
41
41
|
|
|
42
42
|
var demoRef = useRef();
|
|
43
43
|
|
|
@@ -49,8 +49,8 @@ var Previewer = function Previewer(oProps) {
|
|
|
49
49
|
var demoUrl = props.demoUrl || builtinDemoUrl;
|
|
50
50
|
var isActive = (history === null || history === void 0 ? void 0 : history.location.hash) === "#".concat(props.identifier);
|
|
51
51
|
var isSingleFile = Object.keys(props.sources).length === 1;
|
|
52
|
-
var openCSB = useCodeSandbox(((
|
|
53
|
-
var openRiddle = useRiddle(((
|
|
52
|
+
var openCSB = useCodeSandbox(((_a = props.hideActions) === null || _a === void 0 ? void 0 : _a.includes('CSB')) ? null : props);
|
|
53
|
+
var openRiddle = useRiddle(((_b = props.hideActions) === null || _b === void 0 ? void 0 : _b.includes('RIDDLE')) ? null : props);
|
|
54
54
|
|
|
55
55
|
var _useMotions = useMotions(props.motions || [], demoRef.current),
|
|
56
56
|
_useMotions2 = _slicedToArray(_useMotions, 2),
|
|
@@ -168,7 +168,7 @@ var Previewer = function Previewer(oProps) {
|
|
|
168
168
|
onClick: function onClick() {
|
|
169
169
|
return setIframeKey(Math.random());
|
|
170
170
|
}
|
|
171
|
-
}), !((
|
|
171
|
+
}), !((_c = props.hideActions) === null || _c === void 0 ? void 0 : _c.includes('EXTERNAL')) && /*#__PURE__*/React.createElement(Link, {
|
|
172
172
|
target: "_blank",
|
|
173
173
|
to: demoUrl
|
|
174
174
|
}, /*#__PURE__*/React.createElement("button", {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Language } from 'prism-react-renderer';
|
|
2
|
+
import 'prismjs/themes/prism.css';
|
|
3
|
+
import './SourceCode.less';
|
|
4
|
+
export interface ICodeBlockProps {
|
|
5
|
+
code: string;
|
|
6
|
+
lang: Language;
|
|
7
|
+
showCopy?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: ({ code, lang, showCopy }: ICodeBlockProps) => JSX.Element;
|
|
10
|
+
export default _default;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
2
|
|
|
5
3
|
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."); }
|
|
@@ -38,7 +36,7 @@ export default (function (_ref) {
|
|
|
38
36
|
|
|
39
37
|
return /*#__PURE__*/React.createElement("div", {
|
|
40
38
|
className: "__dumi-default-code-block"
|
|
41
|
-
}, /*#__PURE__*/React.createElement(Highlight,
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Highlight, Object.assign({}, defaultProps, {
|
|
42
40
|
code: code,
|
|
43
41
|
language: SIMILAR_DSL[lang] || lang,
|
|
44
42
|
theme: undefined
|
|
@@ -58,14 +56,14 @@ export default (function (_ref) {
|
|
|
58
56
|
return copyCode(code);
|
|
59
57
|
}
|
|
60
58
|
}), tokens.map(function (line, i) {
|
|
61
|
-
return /*#__PURE__*/React.createElement("div", getLineProps({
|
|
59
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({}, getLineProps({
|
|
62
60
|
line: line,
|
|
63
61
|
key: i
|
|
64
|
-
}), line.map(function (token, key) {
|
|
65
|
-
return /*#__PURE__*/React.createElement("span", getTokenProps({
|
|
62
|
+
})), line.map(function (token, key) {
|
|
63
|
+
return /*#__PURE__*/React.createElement("span", Object.assign({}, getTokenProps({
|
|
66
64
|
token: token,
|
|
67
65
|
key: key
|
|
68
|
-
}));
|
|
66
|
+
})));
|
|
69
67
|
}));
|
|
70
68
|
}));
|
|
71
69
|
}));
|
package/es/builtins/Tree.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
|
|
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
|
-
|
|
7
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
2
|
|
|
9
3
|
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."); }
|
|
@@ -76,13 +70,13 @@ function getTreeFromList(nodes) {
|
|
|
76
70
|
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
77
71
|
var data = [];
|
|
78
72
|
[].concat(nodes).forEach(function (node, i) {
|
|
79
|
-
var
|
|
73
|
+
var _a;
|
|
80
74
|
|
|
81
75
|
var key = "".concat(prefix ? "".concat(prefix, "-") : '').concat(i);
|
|
82
76
|
|
|
83
77
|
switch (node.type) {
|
|
84
78
|
case 'ul':
|
|
85
|
-
var parent = ((
|
|
79
|
+
var parent = ((_a = data[data.length - 1]) === null || _a === void 0 ? void 0 : _a.children) || data;
|
|
86
80
|
var ulLeafs = getTreeFromList(node.props.children || [], key);
|
|
87
81
|
parent.push.apply(parent, _toConsumableArray(ulLeafs));
|
|
88
82
|
break;
|
|
@@ -204,7 +198,7 @@ export default (function (props) {
|
|
|
204
198
|
itemHeight: 20,
|
|
205
199
|
showLine: true,
|
|
206
200
|
selectable: false,
|
|
207
|
-
motion:
|
|
201
|
+
motion: Object.assign(Object.assign({}, collapseMotion), {
|
|
208
202
|
motionAppear: false
|
|
209
203
|
}),
|
|
210
204
|
onClick: onClick,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FC, MouseEvent } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './Navbar.less';
|
|
4
|
+
interface INavbarProps {
|
|
5
|
+
location: any;
|
|
6
|
+
navPrefix?: React.ReactNode;
|
|
7
|
+
onMobileMenuClick: (ev: MouseEvent<HTMLButtonElement>) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const Navbar: FC<INavbarProps>;
|
|
10
|
+
export default Navbar;
|
package/es/components/Navbar.js
CHANGED
|
@@ -116,9 +116,9 @@ var Navbar = function Navbar(_ref) {
|
|
|
116
116
|
verticalAlign: 'top'
|
|
117
117
|
}
|
|
118
118
|
}, title))), /*#__PURE__*/React.createElement("nav", null, navPrefix, navItems.map(function (nav) {
|
|
119
|
-
var
|
|
119
|
+
var _a;
|
|
120
120
|
|
|
121
|
-
var child = Boolean((
|
|
121
|
+
var child = Boolean((_a = nav.children) === null || _a === void 0 ? void 0 : _a.length) && /*#__PURE__*/React.createElement("ul", null, nav.children.map(function (item) {
|
|
122
122
|
return /*#__PURE__*/React.createElement("li", {
|
|
123
123
|
key: item.path
|
|
124
124
|
}, /*#__PURE__*/React.createElement(NavLink, {
|
|
@@ -131,7 +131,7 @@ var Navbar = function Navbar(_ref) {
|
|
|
131
131
|
to: nav.path,
|
|
132
132
|
key: nav.path
|
|
133
133
|
}, nav.title) : nav.title, child);
|
|
134
|
-
}), /*#__PURE__*/React.createElement("span", productItemProps, "\u6240\u6709\u4EA7\u54C1", /*#__PURE__*/React.createElement("img", {
|
|
134
|
+
}), /*#__PURE__*/React.createElement("span", Object.assign({}, productItemProps), "\u6240\u6709\u4EA7\u54C1", /*#__PURE__*/React.createElement("img", {
|
|
135
135
|
src: "https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png",
|
|
136
136
|
alt: "antv logo arrow",
|
|
137
137
|
className: "arrow ".concat(productMenuVisible && 'open')
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
2
|
|
|
5
3
|
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."); }
|
|
@@ -55,7 +53,7 @@ export default (function () {
|
|
|
55
53
|
}, [result]);
|
|
56
54
|
return /*#__PURE__*/React.createElement("div", {
|
|
57
55
|
className: "__dumi-default-search"
|
|
58
|
-
}, /*#__PURE__*/React.createElement("input",
|
|
56
|
+
}, /*#__PURE__*/React.createElement("input", Object.assign({
|
|
59
57
|
className: "__dumi-default-search-input",
|
|
60
58
|
type: "search",
|
|
61
59
|
ref: input
|
|
@@ -65,7 +63,7 @@ export default (function () {
|
|
|
65
63
|
return setKeywords(ev.target.value);
|
|
66
64
|
}
|
|
67
65
|
} : {})), /*#__PURE__*/React.createElement("ul", null, items.length > 0 && items.map(function (meta) {
|
|
68
|
-
var
|
|
66
|
+
var _a;
|
|
69
67
|
|
|
70
68
|
return /*#__PURE__*/React.createElement("li", {
|
|
71
69
|
key: meta.path,
|
|
@@ -74,7 +72,7 @@ export default (function () {
|
|
|
74
72
|
}
|
|
75
73
|
}, /*#__PURE__*/React.createElement(AnchorLink, {
|
|
76
74
|
to: meta.path
|
|
77
|
-
}, ((
|
|
75
|
+
}, ((_a = meta.parent) === null || _a === void 0 ? void 0 : _a.title) && /*#__PURE__*/React.createElement("span", null, meta.parent.title), highlight(keywords, meta.title)));
|
|
78
76
|
}), items.length === 0 && keywords && /*#__PURE__*/React.createElement("li", {
|
|
79
77
|
style: {
|
|
80
78
|
textAlign: 'center'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './SideMenu.less';
|
|
4
|
+
interface INavbarProps {
|
|
5
|
+
mobileMenuCollapsed: boolean;
|
|
6
|
+
location: any;
|
|
7
|
+
darkPrefix?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const SideMenu: FC<INavbarProps>;
|
|
10
|
+
export default SideMenu;
|
|
@@ -45,9 +45,9 @@ var SideMenu = function SideMenu(_ref) {
|
|
|
45
45
|
}, !!navItems.length && /*#__PURE__*/React.createElement("ul", {
|
|
46
46
|
className: "__dumi-default-menu-nav-list"
|
|
47
47
|
}, navItems.map(function (nav) {
|
|
48
|
-
var
|
|
48
|
+
var _a;
|
|
49
49
|
|
|
50
|
-
var child = Boolean((
|
|
50
|
+
var child = Boolean((_a = nav.children) === null || _a === void 0 ? void 0 : _a.length) && /*#__PURE__*/React.createElement("ul", null, nav.children.map(function (item) {
|
|
51
51
|
return /*#__PURE__*/React.createElement("li", {
|
|
52
52
|
key: item.path || item.title
|
|
53
53
|
}, /*#__PURE__*/React.createElement(NavLink, {
|
|
@@ -64,10 +64,10 @@ var SideMenu = function SideMenu(_ref) {
|
|
|
64
64
|
}), darkPrefix), /*#__PURE__*/React.createElement("ul", {
|
|
65
65
|
className: "__dumi-default-menu-list"
|
|
66
66
|
}, !isHiddenMenus && menu.map(function (item) {
|
|
67
|
-
var
|
|
67
|
+
var _a; // always use meta from routes to reduce menu data size
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
var hasSlugs = Boolean((
|
|
69
|
+
|
|
70
|
+
var hasSlugs = Boolean((_a = meta.slugs) === null || _a === void 0 ? void 0 : _a.length);
|
|
71
71
|
var hasChildren = item.children && Boolean(item.children.length);
|
|
72
72
|
var show1LevelSlugs = meta.toc === 'menu' && !hasChildren && hasSlugs && item.path === location.pathname.replace(/([^^])\/$/, '$1');
|
|
73
73
|
var menuPaths = hasChildren ? item.children.map(function (i) {
|
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
var
|
|
1
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
2
|
+
var t = {};
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
for (var p in s) {
|
|
5
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
}
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
8
13
|
|
|
9
14
|
import React from 'react';
|
|
10
15
|
import { AnchorLink } from 'dumi/theme';
|
|
11
16
|
import './SlugList.less';
|
|
12
17
|
|
|
13
|
-
var SlugsList = function SlugsList(
|
|
14
|
-
var slugs =
|
|
15
|
-
props =
|
|
18
|
+
var SlugsList = function SlugsList(_a) {
|
|
19
|
+
var slugs = _a.slugs,
|
|
20
|
+
props = __rest(_a, ["slugs"]);
|
|
16
21
|
|
|
17
|
-
return /*#__PURE__*/React.createElement("ul",
|
|
22
|
+
return /*#__PURE__*/React.createElement("ul", Object.assign({
|
|
18
23
|
role: "slug-list"
|
|
19
|
-
}, props), slugs.filter(function (
|
|
20
|
-
var depth =
|
|
24
|
+
}, props), slugs.filter(function (_ref) {
|
|
25
|
+
var depth = _ref.depth;
|
|
21
26
|
return depth > 1 && depth < 4;
|
|
22
27
|
}).map(function (slug) {
|
|
23
28
|
return /*#__PURE__*/React.createElement("li", {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module "*.module.less";
|
package/es/layout.d.ts
ADDED
package/es/layout.js
CHANGED
|
@@ -118,8 +118,8 @@ var BannerPanel = function BannerPanel(banner) {
|
|
|
118
118
|
});
|
|
119
119
|
return /*#__PURE__*/React.createElement(Banner, {
|
|
120
120
|
coverImage: coverImage,
|
|
121
|
-
title: title
|
|
122
|
-
|
|
121
|
+
title: title,
|
|
122
|
+
// @ts-ignore
|
|
123
123
|
description: description,
|
|
124
124
|
notifications: notifications,
|
|
125
125
|
buttons: actions,
|
|
@@ -147,10 +147,11 @@ var Features = function Features(features) {
|
|
|
147
147
|
};
|
|
148
148
|
|
|
149
149
|
var Layout = function Layout(_ref) {
|
|
150
|
-
var _meta$slugs, _match;
|
|
151
|
-
|
|
152
150
|
var children = _ref.children,
|
|
153
151
|
location = _ref.location;
|
|
152
|
+
|
|
153
|
+
var _a, _b;
|
|
154
|
+
|
|
154
155
|
var Context = useContext(context);
|
|
155
156
|
var _Context$config = Context.config,
|
|
156
157
|
mode = _Context$config.mode,
|
|
@@ -178,7 +179,7 @@ var Layout = function Layout(_ref) {
|
|
|
178
179
|
var showFeatures = isSiteMode && meta.features;
|
|
179
180
|
var showIdeas = isSiteMode && meta.ideas;
|
|
180
181
|
var showSideMenu = meta.sidemenu !== false && !showHero && !showBanner && !showFeatures && !meta.gapless;
|
|
181
|
-
var showSlugs = !showHero && !showBanner && !showFeatures && Boolean((
|
|
182
|
+
var showSlugs = !showHero && !showBanner && !showFeatures && Boolean((_a = meta.slugs) === null || _a === void 0 ? void 0 : _a.length) && (meta.toc === 'content' || meta.toc === undefined) && !meta.gapless;
|
|
182
183
|
var isCN = /^zh|cn$/i.test(locale); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
183
184
|
|
|
184
185
|
var updatedTime = new Date(meta.updatedTime).toLocaleString([], {
|
|
@@ -187,7 +188,7 @@ var Layout = function Layout(_ref) {
|
|
|
187
188
|
var repoPlatform = {
|
|
188
189
|
github: 'GitHub',
|
|
189
190
|
gitlab: 'GitLab'
|
|
190
|
-
}[((
|
|
191
|
+
}[((_b = (repoUrl || '').match(/(github|gitlab)/)) === null || _b === void 0 ? void 0 : _b[1]) || 'nothing'] || platform; // 等dumi最新版发布后解决路由匹配问题
|
|
191
192
|
|
|
192
193
|
if (isEmpty(meta) && !isDirect) {
|
|
193
194
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/dumi-theme-antv",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "The official antv site theme of dumi",
|
|
5
5
|
"files": [
|
|
6
6
|
"es",
|
|
7
7
|
"src"
|
|
8
8
|
],
|
|
9
9
|
"sideEffects": [
|
|
10
|
-
"*.less"
|
|
10
|
+
"*.less",
|
|
11
|
+
"*.module.less",
|
|
12
|
+
"*.css"
|
|
11
13
|
],
|
|
12
14
|
"scripts": {
|
|
13
15
|
"start": "father build --watch",
|
|
@@ -33,7 +35,9 @@
|
|
|
33
35
|
"react": "^17.0.1",
|
|
34
36
|
"react-github-button": "^0.1.11",
|
|
35
37
|
"react-i18next": "^11.16.2",
|
|
36
|
-
"react-
|
|
38
|
+
"react-slick": "^0.28.1",
|
|
39
|
+
"react-use": "^17.3.2",
|
|
40
|
+
"slick-carousel": "^1.8.1"
|
|
37
41
|
},
|
|
38
42
|
"repository": {
|
|
39
43
|
"type": "git",
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import GitHubButton from
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import styles from './Banner.module.less';
|
|
11
|
-
import Notification, { NotificationProps } from './Notification';
|
|
12
|
-
|
|
13
|
-
type BannerButtonShape = 'round' | 'square';
|
|
1
|
+
import classNames from "classnames";
|
|
2
|
+
import { context } from "dumi/theme";
|
|
3
|
+
import gh from "parse-github-url";
|
|
4
|
+
import React, { useContext } from "react";
|
|
5
|
+
import GitHubButton from "react-github-button";
|
|
6
|
+
//@ts-ignore
|
|
7
|
+
import styles from "./Banner.module.less";
|
|
8
|
+
import Notification, { NotificationProps } from "./Notification";
|
|
9
|
+
type BannerButtonShape = "round" | "square";
|
|
14
10
|
|
|
15
11
|
interface BannerButton {
|
|
16
12
|
text: string;
|
|
@@ -34,7 +30,8 @@ interface BannerProps {
|
|
|
34
30
|
onPlayVideo?: () => void;
|
|
35
31
|
}
|
|
36
32
|
|
|
37
|
-
const backLeftBottom =
|
|
33
|
+
const backLeftBottom =
|
|
34
|
+
"https://gw.alipayobjects.com/zos/basement_prod/441d5eaf-e623-47cd-b9b9-2a581d9ce1e3.svg";
|
|
38
35
|
|
|
39
36
|
const Banner: React.FC<BannerProps> = ({
|
|
40
37
|
coverImage,
|
|
@@ -54,32 +51,34 @@ const Banner: React.FC<BannerProps> = ({
|
|
|
54
51
|
|
|
55
52
|
const notificationsNode = notifications
|
|
56
53
|
.slice(0, 2)
|
|
57
|
-
.map((notification, i) =>
|
|
54
|
+
.map((notification, i) => (
|
|
55
|
+
<Notification index={i} key={i} {...notification} />
|
|
56
|
+
));
|
|
58
57
|
|
|
59
58
|
const renderButtons = buttons.map((button: BannerButton, i) => {
|
|
60
|
-
const ButtonLink =
|
|
59
|
+
const ButtonLink = "a";
|
|
61
60
|
const buttonProps = {} as any;
|
|
62
|
-
if (button.link.startsWith(
|
|
63
|
-
buttonProps.target =
|
|
64
|
-
buttonProps.rel =
|
|
61
|
+
if (button.link.startsWith("http")) {
|
|
62
|
+
buttonProps.target = "_blank";
|
|
63
|
+
buttonProps.rel = "noopener noreferrer";
|
|
65
64
|
}
|
|
66
|
-
if (ButtonLink ===
|
|
65
|
+
if (ButtonLink === "a") {
|
|
67
66
|
buttonProps.href = button.link;
|
|
68
67
|
} else {
|
|
69
68
|
buttonProps.to = button.link;
|
|
70
69
|
}
|
|
71
|
-
const { shape =
|
|
70
|
+
const { shape = "round" } = button;
|
|
72
71
|
return (
|
|
73
72
|
<ButtonLink
|
|
74
73
|
{...buttonProps}
|
|
75
74
|
className={classNames(
|
|
76
75
|
styles.buttonLink,
|
|
77
|
-
styles[button.type ||
|
|
78
|
-
button.type ===
|
|
76
|
+
styles[button.type || ""],
|
|
77
|
+
button.type === "primary" ? "primary-button" : "common-button"
|
|
79
78
|
)}
|
|
80
79
|
key={i}
|
|
81
80
|
style={{
|
|
82
|
-
borderRadius: shape ===
|
|
81
|
+
borderRadius: shape === "round" ? "1000px" : "4px",
|
|
83
82
|
...button.style,
|
|
84
83
|
}}
|
|
85
84
|
>
|
|
@@ -94,8 +93,13 @@ const Banner: React.FC<BannerProps> = ({
|
|
|
94
93
|
if (githubObj && githubObj.owner && githubObj.name) {
|
|
95
94
|
renderButtons.push(
|
|
96
95
|
<div key="github" className={styles.githubWrapper}>
|
|
97
|
-
<GitHubButton
|
|
98
|
-
|
|
96
|
+
<GitHubButton
|
|
97
|
+
type="stargazers"
|
|
98
|
+
size="large"
|
|
99
|
+
namespace={githubObj.owner}
|
|
100
|
+
repo={githubObj.name}
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
99
103
|
);
|
|
100
104
|
}
|
|
101
105
|
}
|
|
@@ -104,15 +108,29 @@ const Banner: React.FC<BannerProps> = ({
|
|
|
104
108
|
<section className={classNames(styles.wrapper, className)} style={style}>
|
|
105
109
|
<div className={styles.content}>
|
|
106
110
|
<div className={styles.text}>
|
|
107
|
-
<div className={classNames(styles.title,
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
<div className={classNames(styles.title, "banner-title")}>
|
|
112
|
+
{title}
|
|
113
|
+
</div>
|
|
114
|
+
<div className={classNames(styles.description, "banner-description")}>
|
|
115
|
+
{description}
|
|
116
|
+
</div>
|
|
117
|
+
<div className={classNames(styles.buttons, "banner-buttons")}>
|
|
118
|
+
{renderButtons}
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
<div className={classNames(styles.notifications, "notifications")}>
|
|
122
|
+
{notificationsNode}
|
|
110
123
|
</div>
|
|
111
|
-
<div className={classNames(styles.
|
|
112
|
-
|
|
113
|
-
|
|
124
|
+
<div className={classNames(styles.teaser, "teaser")}>
|
|
125
|
+
<div className={classNames(styles.teaserimg, "teaser-img")}>
|
|
126
|
+
{coverImage}
|
|
127
|
+
</div>
|
|
114
128
|
</div>
|
|
115
|
-
<img
|
|
129
|
+
<img
|
|
130
|
+
className={styles.backLeftBottom}
|
|
131
|
+
src={backLeftBottom}
|
|
132
|
+
alt="back"
|
|
133
|
+
/>
|
|
116
134
|
</div>
|
|
117
135
|
</section>
|
|
118
136
|
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module "*.module.less";
|
package/src/layout.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import SearchBar from './components/SearchBar';
|
|
|
15
15
|
import SideMenu from './components/SideMenu';
|
|
16
16
|
import SlugList from './components/SlugList';
|
|
17
17
|
import './style/layout.less';
|
|
18
|
+
|
|
18
19
|
i18n
|
|
19
20
|
.use(initReactI18next) // passes i18n down to react-i18next
|
|
20
21
|
.init({
|