@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.
Files changed (53) hide show
  1. package/es/antv/404/index.d.ts +2 -0
  2. package/es/antv/404/index.js +1 -0
  3. package/es/antv/Banner/Notification.d.ts +10 -0
  4. package/es/antv/Banner/index.d.ts +25 -0
  5. package/es/antv/Banner/index.js +25 -36
  6. package/es/antv/Cases/Cases.d.ts +18 -0
  7. package/es/antv/Cases/Cases.js +1 -3
  8. package/es/antv/Features/FeatureCard.d.ts +8 -0
  9. package/es/antv/Features/index.d.ts +15 -0
  10. package/es/antv/Features/index.js +1 -1
  11. package/es/antv/Footer/index.d.ts +12 -0
  12. package/es/antv/Footer/index.js +22 -17
  13. package/es/antv/Header/Logo.d.ts +4 -0
  14. package/es/antv/Products/Product.d.ts +14 -0
  15. package/es/antv/Products/Product.js +4 -4
  16. package/es/antv/Products/getNewProducts.d.ts +24 -0
  17. package/es/antv/Products/getNewProducts.js +3 -9
  18. package/es/antv/Products/getProducts.d.ts +51 -0
  19. package/es/antv/Products/getProducts.js +3 -9
  20. package/es/antv/Products/index.d.ts +9 -0
  21. package/es/antv/Products/index.js +2 -2
  22. package/es/antv/hooks.d.ts +14 -0
  23. package/es/antv/utils.d.ts +5 -0
  24. package/es/builtins/API.d.ts +3 -0
  25. package/es/builtins/Alert.d.ts +3 -0
  26. package/es/builtins/Alert.js +1 -3
  27. package/es/builtins/Badge.d.ts +3 -0
  28. package/es/builtins/Badge.js +1 -3
  29. package/es/builtins/Example.d.ts +5 -0
  30. package/es/builtins/Previewer.d.ts +39 -0
  31. package/es/builtins/Previewer.js +7 -7
  32. package/es/builtins/SourceCode.d.ts +10 -0
  33. package/es/builtins/SourceCode.js +5 -7
  34. package/es/builtins/Table.d.ts +4 -0
  35. package/es/builtins/Tree.d.ts +4 -0
  36. package/es/builtins/Tree.js +3 -9
  37. package/es/components/Dark.d.ts +9 -0
  38. package/es/components/LocaleSelect.d.ts +6 -0
  39. package/es/components/Navbar.d.ts +10 -0
  40. package/es/components/Navbar.js +3 -3
  41. package/es/components/SearchBar.d.ts +4 -0
  42. package/es/components/SearchBar.js +3 -5
  43. package/es/components/SideMenu.d.ts +10 -0
  44. package/es/components/SideMenu.js +5 -5
  45. package/es/components/SlugList.d.ts +7 -0
  46. package/es/components/SlugList.js +16 -11
  47. package/es/declaration.d.ts +1 -0
  48. package/es/layout.d.ts +5 -0
  49. package/es/layout.js +7 -6
  50. package/package.json +7 -3
  51. package/src/antv/Banner/index.tsx +51 -33
  52. package/src/declaration.d.ts +1 -0
  53. package/src/layout.tsx +1 -0
@@ -0,0 +1,2 @@
1
+ declare const NotFoundPage: () => JSX.Element;
2
+ export default NotFoundPage;
@@ -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,10 @@
1
+ import React from 'react';
2
+ export interface NotificationProps {
3
+ index?: number;
4
+ type: string;
5
+ title: string;
6
+ date: string;
7
+ link: string;
8
+ }
9
+ declare const Notification: React.FC<NotificationProps>;
10
+ export default Notification;
@@ -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;
@@ -1,23 +1,12 @@
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; }
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
- 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
- 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, _extends({
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 = 'a';
35
+ var ButtonLink = "a";
47
36
  var buttonProps = {};
48
37
 
49
- if (button.link.startsWith('http')) {
50
- buttonProps.target = '_blank';
51
- buttonProps.rel = 'noopener noreferrer';
38
+ if (button.link.startsWith("http")) {
39
+ buttonProps.target = "_blank";
40
+ buttonProps.rel = "noopener noreferrer";
52
41
  }
53
42
 
54
- if (ButtonLink === 'a') {
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 ? 'round' : _button$shape;
62
- return /*#__PURE__*/React.createElement(ButtonLink, _extends({}, buttonProps, {
63
- className: classNames(styles.buttonLink, styles[button.type || ''], button.type === 'primary' ? 'primary-button' : 'common-button'),
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: _objectSpread({
66
- borderRadius: shape === 'round' ? '1000px' : '4px'
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, 'banner-title')
86
+ className: classNames(styles.title, "banner-title")
98
87
  }, title), /*#__PURE__*/React.createElement("div", {
99
- className: classNames(styles.description, 'banner-description')
88
+ className: classNames(styles.description, "banner-description")
100
89
  }, description), /*#__PURE__*/React.createElement("div", {
101
- className: classNames(styles.buttons, 'banner-buttons')
90
+ className: classNames(styles.buttons, "banner-buttons")
102
91
  }, renderButtons)), /*#__PURE__*/React.createElement("div", {
103
- className: classNames(styles.notifications, 'notifications')
92
+ className: classNames(styles.notifications, "notifications")
104
93
  }, notificationsNode), /*#__PURE__*/React.createElement("div", {
105
- className: classNames(styles.teaser, 'teaser')
94
+ className: classNames(styles.teaser, "teaser")
106
95
  }, /*#__PURE__*/React.createElement("div", {
107
- className: classNames(styles.teaserimg, 'teaser-img')
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;
@@ -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, _extends({}, sliderSettings, {
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,8 @@
1
+ import React from 'react';
2
+ interface FeatureProps {
3
+ icon: string;
4
+ title: string;
5
+ description: string;
6
+ }
7
+ declare const FeatureCard: React.FC<FeatureProps>;
8
+ export default FeatureCard;
@@ -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;
@@ -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
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
15
+ var __rest = this && this.__rest || function (s, e) {
16
+ var t = {};
20
17
 
21
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
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(_ref) {
40
- var columns = _ref.columns,
41
- bottom = _ref.bottom,
42
- _ref$theme = _ref.theme,
43
- theme = _ref$theme === void 0 ? "dark" : _ref$theme,
44
- language = _ref.language,
45
- _ref$rootDomain = _ref.rootDomain,
46
- rootDomain = _ref$rootDomain === void 0 ? "" : _ref$rootDomain,
47
- location = _ref.location,
48
- restProps = _objectWithoutProperties(_ref, _excluded);
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, _extends({
206
+ return /*#__PURE__*/React.createElement(RCFooter, Object.assign({
202
207
  maxColumnsPerRow: 5,
203
208
  theme: theme,
204
209
  columns: columns || getColums(),
@@ -0,0 +1,4 @@
1
+ declare const _default: ({ style }: {
2
+ style: any;
3
+ }) => JSX.Element;
4
+ export default _default;
@@ -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
- }, (_links$home$title = links.home.title) !== null && _links$home$title !== void 0 ? _links$home$title : t("产品首页")), links.example && /*#__PURE__*/React.createElement("a", {
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
- }, (_links$example$title = links.example.title) !== null && _links$example$title !== void 0 ? _links$example$title : t("图表示例")))));
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) : _objectSpread({}, 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] = _objectSpread(_objectSpread({}, value), {}, {
26
+ newLinks[k] = Object.assign(Object.assign({}, value), {
33
27
  url: actualUrl
34
28
  });
35
29
  });
36
- return _objectSpread(_objectSpread({}, d), {}, {
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) : _objectSpread({}, 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] = _objectSpread(_objectSpread({}, value), {}, {
451
+ newLinks[k] = Object.assign(Object.assign({}, value), {
458
452
  url: actualUrl
459
453
  });
460
454
  });
461
- return _objectSpread(_objectSpread({}, d), {}, {
455
+ return Object.assign(Object.assign({}, d), {
462
456
  links: newLinks
463
457
  });
464
458
  });
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ interface ProductsProps {
3
+ show: boolean;
4
+ rootDomain: string;
5
+ language?: "zh" | "en";
6
+ className?: string;
7
+ }
8
+ declare const Products: React.FC<ProductsProps>;
9
+ export default Products;
@@ -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 _product$links, _product$links$home;
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: (_product$links = product.links) === null || _product$links === void 0 ? void 0 : (_product$links$home = _product$links.home) === null || _product$links$home === void 0 ? void 0 : _product$links$home.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 {};
@@ -0,0 +1,3 @@
1
+ import type { IApiComponentProps } from 'dumi/theme';
2
+ declare const _default: ({ identifier, export: expt }: IApiComponentProps) => JSX.Element;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import './Alert.less';
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
@@ -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", _extends({
4
+ return /*#__PURE__*/React.createElement("div", Object.assign({
7
5
  className: "__dumi-default-alert"
8
6
  }, props));
9
7
  });
@@ -0,0 +1,3 @@
1
+ import './Badge.less';
2
+ declare const _default: (props: any) => JSX.Element;
3
+ export default _default;
@@ -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", _extends({
4
+ return /*#__PURE__*/React.createElement("span", Object.assign({
7
5
  className: "__dumi-default-badge"
8
6
  }, props));
9
7
  });
@@ -0,0 +1,5 @@
1
+ import './Example.less';
2
+ declare const _default: (props: {
3
+ route: any;
4
+ }) => JSX.Element;
5
+ export default _default;
@@ -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;
@@ -24,10 +24,10 @@ import './Previewer.less';
24
24
  */
25
25
 
26
26
  function getSourceType(file, source) {
27
- var _file$match;
27
+ var _a; // use file extension as source type first
28
28
 
29
- // use file extension as source type first
30
- var type = (_file$match = file.match(/\.(\w+)$/)) === null || _file$match === void 0 ? void 0 : _file$match[1];
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 _props$hideActions, _props$hideActions2, _props$hideActions3;
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(((_props$hideActions = props.hideActions) === null || _props$hideActions === void 0 ? void 0 : _props$hideActions.includes('CSB')) ? null : props);
53
- var openRiddle = useRiddle(((_props$hideActions2 = props.hideActions) === null || _props$hideActions2 === void 0 ? void 0 : _props$hideActions2.includes('RIDDLE')) ? null : props);
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
- }), !((_props$hideActions3 = props.hideActions) === null || _props$hideActions3 === void 0 ? void 0 : _props$hideActions3.includes('EXTERNAL')) && /*#__PURE__*/React.createElement(Link, {
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, _extends({}, defaultProps, {
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
  }));
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import './Table.less';
3
+ declare const Table: React.FC;
4
+ export default Table;
@@ -0,0 +1,4 @@
1
+ import type { ComponentProps } from 'react';
2
+ import './Tree.less';
3
+ declare const _default: (props: ComponentProps<'div'>) => JSX.Element;
4
+ export default _default;
@@ -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 _data;
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 = ((_data = data[data.length - 1]) === null || _data === void 0 ? void 0 : _data.children) || data;
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: _objectSpread(_objectSpread({}, collapseMotion), {}, {
201
+ motion: Object.assign(Object.assign({}, collapseMotion), {
208
202
  motionAppear: false
209
203
  }),
210
204
  onClick: onClick,
@@ -0,0 +1,9 @@
1
+ import type { FC } from 'react';
2
+ import './Dark.less';
3
+ interface darkProps {
4
+ darkSwitch: boolean;
5
+ isSideMenu: boolean;
6
+ onDarkSwitchClick?: (ev: any) => void;
7
+ }
8
+ declare const Dark: FC<darkProps>;
9
+ export default Dark;
@@ -0,0 +1,6 @@
1
+ import type { FC } from 'react';
2
+ import './LocaleSelect.less';
3
+ declare const LocaleSelect: FC<{
4
+ location: any;
5
+ }>;
6
+ export default LocaleSelect;
@@ -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;
@@ -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 _nav$children;
119
+ var _a;
120
120
 
121
- var child = Boolean((_nav$children = nav.children) === null || _nav$children === void 0 ? void 0 : _nav$children.length) && /*#__PURE__*/React.createElement("ul", null, nav.children.map(function (item) {
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')
@@ -0,0 +1,4 @@
1
+ import './SearchBar.less';
2
+ export declare const highlight: (key: string, title: string) => JSX.Element;
3
+ declare const _default: () => JSX.Element;
4
+ 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."); }
@@ -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", _extends({
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 _meta$parent;
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
- }, ((_meta$parent = meta.parent) === null || _meta$parent === void 0 ? void 0 : _meta$parent.title) && /*#__PURE__*/React.createElement("span", null, meta.parent.title), highlight(keywords, meta.title)));
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 _nav$children;
48
+ var _a;
49
49
 
50
- var child = Boolean((_nav$children = nav.children) === null || _nav$children === void 0 ? void 0 : _nav$children.length) && /*#__PURE__*/React.createElement("ul", null, nav.children.map(function (item) {
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 _meta$slugs;
67
+ var _a; // always use meta from routes to reduce menu data size
68
68
 
69
- // always use meta from routes to reduce menu data size
70
- var hasSlugs = Boolean((_meta$slugs = meta.slugs) === null || _meta$slugs === void 0 ? void 0 : _meta$slugs.length);
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) {
@@ -0,0 +1,7 @@
1
+ import type { FC } from 'react';
2
+ import './SlugList.less';
3
+ declare const SlugsList: FC<{
4
+ slugs: any;
5
+ className?: string;
6
+ }>;
7
+ export default SlugsList;
@@ -1,23 +1,28 @@
1
- var _excluded = ["slugs"];
1
+ var __rest = this && this.__rest || function (s, e) {
2
+ var t = {};
2
3
 
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
+ 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
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
-
7
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
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(_ref) {
14
- var slugs = _ref.slugs,
15
- props = _objectWithoutProperties(_ref, _excluded);
18
+ var SlugsList = function SlugsList(_a) {
19
+ var slugs = _a.slugs,
20
+ props = __rest(_a, ["slugs"]);
16
21
 
17
- return /*#__PURE__*/React.createElement("ul", _extends({
22
+ return /*#__PURE__*/React.createElement("ul", Object.assign({
18
23
  role: "slug-list"
19
- }, props), slugs.filter(function (_ref2) {
20
- var depth = _ref2.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
@@ -0,0 +1,5 @@
1
+ import type { IRouteComponentProps } from '@umijs/types';
2
+ import React from 'react';
3
+ import './style/layout.less';
4
+ declare const Layout: React.FC<IRouteComponentProps>;
5
+ export default Layout;
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 // @ts-ignore
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((_meta$slugs = meta.slugs) === null || _meta$slugs === void 0 ? void 0 : _meta$slugs.length) && (meta.toc === 'content' || meta.toc === undefined) && !meta.gapless;
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
- }[((_match = (repoUrl || '').match(/(github|gitlab)/)) === null || _match === void 0 ? void 0 : _match[1]) || 'nothing'] || platform; // 等dumi最新版发布后解决路由匹配问题
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.1.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-use": "^17.3.2"
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
- /* eslint-disable react/no-array-index-key */
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- import React, { useContext } from 'react';
4
-
5
- import GitHubButton from 'react-github-button';
6
- import gh from 'parse-github-url';
7
- import classNames from 'classnames';
8
- import { context } from 'dumi/theme';
9
- // @ts-ignore
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 = 'https://gw.alipayobjects.com/zos/basement_prod/441d5eaf-e623-47cd-b9b9-2a581d9ce1e3.svg';
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) => <Notification index={i} key={i} {...notification} />);
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 = 'a';
59
+ const ButtonLink = "a";
61
60
  const buttonProps = {} as any;
62
- if (button.link.startsWith('http')) {
63
- buttonProps.target = '_blank';
64
- buttonProps.rel = 'noopener noreferrer';
61
+ if (button.link.startsWith("http")) {
62
+ buttonProps.target = "_blank";
63
+ buttonProps.rel = "noopener noreferrer";
65
64
  }
66
- if (ButtonLink === 'a') {
65
+ if (ButtonLink === "a") {
67
66
  buttonProps.href = button.link;
68
67
  } else {
69
68
  buttonProps.to = button.link;
70
69
  }
71
- const { shape = 'round' } = button;
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 === 'primary' ? 'primary-button' : 'common-button',
76
+ styles[button.type || ""],
77
+ button.type === "primary" ? "primary-button" : "common-button"
79
78
  )}
80
79
  key={i}
81
80
  style={{
82
- borderRadius: shape === 'round' ? '1000px' : '4px',
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 type="stargazers" size="large" namespace={githubObj.owner} repo={githubObj.name} />
98
- </div>,
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, 'banner-title')}>{title}</div>
108
- <div className={classNames(styles.description, 'banner-description')}>{description}</div>
109
- <div className={classNames(styles.buttons, 'banner-buttons')}>{renderButtons}</div>
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.notifications, 'notifications')}>{notificationsNode}</div>
112
- <div className={classNames(styles.teaser, 'teaser')}>
113
- <div className={classNames(styles.teaserimg, 'teaser-img')}>{coverImage}</div>
124
+ <div className={classNames(styles.teaser, "teaser")}>
125
+ <div className={classNames(styles.teaserimg, "teaser-img")}>
126
+ {coverImage}
127
+ </div>
114
128
  </div>
115
- <img className={styles.backLeftBottom} src={backLeftBottom} alt="back" />
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({