@antv/dumi-theme-antv 0.1.0 → 0.2.2

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 (54) hide show
  1. package/README.md +47 -1
  2. package/es/antv/404/index.d.ts +2 -0
  3. package/es/antv/404/index.js +1 -0
  4. package/es/antv/Banner/Notification.d.ts +10 -0
  5. package/es/antv/Banner/index.d.ts +25 -0
  6. package/es/antv/Banner/index.js +25 -36
  7. package/es/antv/Cases/Cases.d.ts +18 -0
  8. package/es/antv/Cases/Cases.js +1 -3
  9. package/es/antv/Features/FeatureCard.d.ts +8 -0
  10. package/es/antv/Features/index.d.ts +15 -0
  11. package/es/antv/Features/index.js +1 -1
  12. package/es/antv/Footer/index.d.ts +12 -0
  13. package/es/antv/Footer/index.js +22 -17
  14. package/es/antv/Header/Logo.d.ts +4 -0
  15. package/es/antv/Products/Product.d.ts +14 -0
  16. package/es/antv/Products/Product.js +4 -4
  17. package/es/antv/Products/getNewProducts.d.ts +24 -0
  18. package/es/antv/Products/getNewProducts.js +3 -9
  19. package/es/antv/Products/getProducts.d.ts +51 -0
  20. package/es/antv/Products/getProducts.js +3 -9
  21. package/es/antv/Products/index.d.ts +9 -0
  22. package/es/antv/Products/index.js +2 -2
  23. package/es/antv/hooks.d.ts +14 -0
  24. package/es/antv/utils.d.ts +5 -0
  25. package/es/builtins/API.d.ts +3 -0
  26. package/es/builtins/Alert.d.ts +3 -0
  27. package/es/builtins/Alert.js +1 -3
  28. package/es/builtins/Badge.d.ts +3 -0
  29. package/es/builtins/Badge.js +1 -3
  30. package/es/builtins/Example.d.ts +5 -0
  31. package/es/builtins/Previewer.d.ts +39 -0
  32. package/es/builtins/Previewer.js +7 -7
  33. package/es/builtins/SourceCode.d.ts +10 -0
  34. package/es/builtins/SourceCode.js +5 -7
  35. package/es/builtins/Table.d.ts +4 -0
  36. package/es/builtins/Tree.d.ts +4 -0
  37. package/es/builtins/Tree.js +3 -9
  38. package/es/components/Dark.d.ts +9 -0
  39. package/es/components/LocaleSelect.d.ts +6 -0
  40. package/es/components/Navbar.d.ts +10 -0
  41. package/es/components/Navbar.js +3 -3
  42. package/es/components/SearchBar.d.ts +4 -0
  43. package/es/components/SearchBar.js +3 -5
  44. package/es/components/SideMenu.d.ts +10 -0
  45. package/es/components/SideMenu.js +5 -5
  46. package/es/components/SlugList.d.ts +7 -0
  47. package/es/components/SlugList.js +16 -11
  48. package/es/declaration.d.ts +1 -0
  49. package/es/layout.d.ts +5 -0
  50. package/es/layout.js +7 -7
  51. package/package.json +8 -3
  52. package/src/antv/Banner/index.tsx +51 -33
  53. package/src/declaration.d.ts +1 -0
  54. package/src/layout.tsx +1 -1
package/README.md CHANGED
@@ -2,8 +2,54 @@
2
2
 
3
3
  dumi theme for antv site
4
4
 
5
- ## install
5
+ ## Install
6
6
 
7
7
  ```
8
8
  yarn add @antv/dumi-theme-antv --save-dev
9
+
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ > Refer to the documentation for the [Dumi theme](https://d.umijs.org/zh-CN/config#themeconfig)
15
+
16
+ <strong >note ⚠️<strong>
17
+ Since `*.module.less` is used in `@antv/dumi-theme-antv`, extraBabelIncludes needs to be configured:
18
+
19
+ ```tsx
20
+ export default {
21
+ //...
22
+ mode: "site",
23
+ extraBabelIncludes: ["@antv/dumi-theme-antv"],
24
+ };
25
+ ```
26
+
27
+ ## Contributing
28
+
29
+ ### Development install
30
+
31
+ - start `@antv/dumi-theme-antv`
32
+
33
+ ```bash
34
+ - 1. git clone https://github.com/antvis/dumi-theme-antv.git
35
+ - 2. yarn // install deps
36
+ - 3. npm run start //start dev
37
+
38
+ ```
39
+
40
+ - start demo of antv sub product site
41
+
42
+ ```bash
43
+
44
+ - 1. npm link
45
+
46
+ - 2. cd site
47
+
48
+ - 3. note: remove `@antv/dumi-theme-antv` from `devDependencies` in `package.json`
49
+
50
+ - 4. yarn // install deps
51
+
52
+ - 5. npm link @antv/dumi-theme-antv
53
+
54
+ - 6. npm run start
9
55
  ```
@@ -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
  });