@antv/dumi-theme-antv 0.3.4 → 0.3.6

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 (57) hide show
  1. package/dist/builtins/Playground/index.js +14 -26
  2. package/dist/layouts/DocLayout.js +17 -20
  3. package/dist/layouts/entry/API.js +0 -1
  4. package/dist/layouts/entry/Index.js +27 -31
  5. package/dist/layouts/entry/Manual.js +0 -1
  6. package/dist/pages/404.js +1 -2
  7. package/dist/pages/Example/index.js +19 -37
  8. package/dist/pages/Examples/components/Accouncement/index.js +9 -13
  9. package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.js +9 -20
  10. package/dist/pages/Examples/components/ExampleTopicMenu/index.js +6 -14
  11. package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +3 -5
  12. package/dist/pages/Examples/components/GalleryPageContent/index.js +8 -6
  13. package/dist/pages/Examples/index.js +8 -19
  14. package/dist/plugin/examples.js +5 -0
  15. package/dist/plugin/index.js +6 -0
  16. package/dist/plugin/utils.js +4 -0
  17. package/dist/slots/Article/index.js +0 -2
  18. package/dist/slots/Banner/Notification.js +6 -10
  19. package/dist/slots/Banner/index.js +24 -46
  20. package/dist/slots/Cases/index.js +4 -13
  21. package/dist/slots/CodeEditor/Toolbar.js +26 -36
  22. package/dist/slots/CodeEditor/index.js +66 -76
  23. package/dist/slots/CodeEditor/utils.js +28 -43
  24. package/dist/slots/CodePreview/CodeHeader.js +4 -4
  25. package/dist/slots/CodePreview/index.js +4 -6
  26. package/dist/slots/CodeRunner/index.js +22 -33
  27. package/dist/slots/CodeRunner/utils.js +5 -6
  28. package/dist/slots/Companies/index.js +4 -4
  29. package/dist/slots/ContentTable/index.js +1 -1
  30. package/dist/slots/Detail/News.js +6 -8
  31. package/dist/slots/Detail/index.js +25 -34
  32. package/dist/slots/ExampleSider/index.js +36 -43
  33. package/dist/slots/Features/FeatureCard.js +2 -4
  34. package/dist/slots/Features/index.js +7 -11
  35. package/dist/slots/Footer/index.js +13 -19
  36. package/dist/slots/Header/Logo.js +1 -1
  37. package/dist/slots/Header/LogoWhite.js +1 -1
  38. package/dist/slots/Header/Navs.js +8 -11
  39. package/dist/slots/Header/Products/NavigatorBanner.js +2 -8
  40. package/dist/slots/Header/Products/Product.js +9 -13
  41. package/dist/slots/Header/Products/getProducts.js +5 -11
  42. package/dist/slots/Header/Products/index.js +14 -22
  43. package/dist/slots/Header/Search.js +15 -20
  44. package/dist/slots/Header/index.d.ts +4 -0
  45. package/dist/slots/Header/index.js +96 -130
  46. package/dist/slots/Header/utils.d.ts +1 -0
  47. package/dist/slots/Header/utils.js +9 -3
  48. package/dist/slots/Loading/index.js +1 -3
  49. package/dist/slots/ManualContent/NavigatorBanner.js +2 -7
  50. package/dist/slots/ManualContent/ReadingTime.js +0 -2
  51. package/dist/slots/ManualContent/index.js +51 -86
  52. package/dist/slots/ManualContent/utils.js +7 -13
  53. package/dist/slots/SEO.js +8 -10
  54. package/dist/slots/global.js +2 -1
  55. package/dist/slots/hooks.js +17 -29
  56. package/dist/slots/utils.js +32 -57
  57. package/package.json +2 -1
@@ -1,17 +1,13 @@
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; }
2
-
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
4
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
3
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
-
5
6
  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."); }
6
-
7
7
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
-
9
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10
-
11
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
12
-
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
13
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
-
15
11
  import React from 'react';
16
12
  import cx from 'classnames';
17
13
  import { useLocale, FormattedMessage } from 'dumi';
@@ -21,19 +17,16 @@ import { useChinaMirrorHost } from "../../hooks";
21
17
  import styles from "./Product.module.less";
22
18
  export var Products = function Products(_ref) {
23
19
  var show = _ref.show,
24
- language = _ref.language,
25
- className = _ref.className;
20
+ language = _ref.language,
21
+ className = _ref.className;
26
22
  var locale = useLocale();
27
-
28
23
  var _useChinaMirrorHost = useChinaMirrorHost(),
29
- _useChinaMirrorHost2 = _slicedToArray(_useChinaMirrorHost, 1),
30
- isChinaMirrorHost = _useChinaMirrorHost2[0];
31
-
24
+ _useChinaMirrorHost2 = _slicedToArray(_useChinaMirrorHost, 1),
25
+ isChinaMirrorHost = _useChinaMirrorHost2[0];
32
26
  var _React$useState = React.useState([]),
33
- _React$useState2 = _slicedToArray(_React$useState, 2),
34
- products = _React$useState2[0],
35
- setProducts = _React$useState2[1];
36
-
27
+ _React$useState2 = _slicedToArray(_React$useState, 2),
28
+ products = _React$useState2[0],
29
+ setProducts = _React$useState2[1];
37
30
  var lang = locale.id === 'zh' ? 'zh' : 'en';
38
31
  React.useEffect(function () {
39
32
  getNewProducts({
@@ -49,7 +42,7 @@ export var Products = function Products(_ref) {
49
42
  className: styles.container
50
43
  }, CATEGORIES.map(function (_ref2, idx) {
51
44
  var name = _ref2.name,
52
- type = _ref2.type;
45
+ type = _ref2.type;
53
46
  return /*#__PURE__*/React.createElement(React.Fragment, {
54
47
  key: idx
55
48
  }, /*#__PURE__*/React.createElement("h3", null, /*#__PURE__*/React.createElement(FormattedMessage, {
@@ -58,7 +51,6 @@ export var Products = function Products(_ref) {
58
51
  return item.category === type;
59
52
  }).map(function (product) {
60
53
  var _product$links, _product$links$home;
61
-
62
54
  return /*#__PURE__*/React.createElement(Product, {
63
55
  key: product.title,
64
56
  name: product.title,
@@ -5,18 +5,15 @@ import { useLocale, useIntl } from 'dumi';
5
5
  import '@docsearch/css';
6
6
  import styles from "./Search.module.less";
7
7
  import 'docsearch.js/dist/cdn/docsearch.min.css';
8
-
9
8
  function initDocSearchV2(_ref) {
10
9
  var docsearchV2 = _ref.docsearchV2,
11
- lang = _ref.lang,
12
- docsearchOptions = _ref.docsearchOptions;
13
-
10
+ lang = _ref.lang,
11
+ docsearchOptions = _ref.docsearchOptions;
14
12
  var _ref2 = docsearchOptions || {},
15
- _ref2$apiKey = _ref2.apiKey,
16
- apiKey = _ref2$apiKey === void 0 ? '194b1be7fb1254c787f4e036912af3eb' : _ref2$apiKey,
17
- _ref2$indexName = _ref2.indexName,
18
- indexName = _ref2$indexName === void 0 ? 'antv' : _ref2$indexName;
19
-
13
+ _ref2$apiKey = _ref2.apiKey,
14
+ apiKey = _ref2$apiKey === void 0 ? '194b1be7fb1254c787f4e036912af3eb' : _ref2$apiKey,
15
+ _ref2$indexName = _ref2.indexName,
16
+ indexName = _ref2$indexName === void 0 ? 'antv' : _ref2$indexName;
20
17
  docsearchV2({
21
18
  apiKey: apiKey,
22
19
  indexName: indexName,
@@ -38,10 +35,10 @@ function initDocSearchV2(_ref) {
38
35
  hit.url = hit.url.replace('#gatsby-focus-wrapper', '');
39
36
  /* eslint-enable no-param-reassign */
40
37
  });
38
+
41
39
  return hits;
42
40
  },
43
41
  debug: false // Set debug to true if you want to inspect the dropdown
44
-
45
42
  });
46
43
  }
47
44
 
@@ -49,17 +46,15 @@ export var Search = function Search(_ref3) {
49
46
  var docsearchOptions = _ref3.docsearchOptions;
50
47
  var locale = useLocale();
51
48
  var intl = useIntl();
52
-
53
49
  var _ref4 = docsearchOptions || {},
54
- _ref4$apiKey = _ref4.apiKey,
55
- apiKey = _ref4$apiKey === void 0 ? '' : _ref4$apiKey,
56
- _ref4$indexName = _ref4.indexName,
57
- indexName = _ref4$indexName === void 0 ? '' : _ref4$indexName,
58
- _ref4$versionV = _ref4.versionV3,
59
- versionV3 = _ref4$versionV === void 0 ? false : _ref4$versionV,
60
- _ref4$appId = _ref4.appId,
61
- appId = _ref4$appId === void 0 ? '' : _ref4$appId;
62
-
50
+ _ref4$apiKey = _ref4.apiKey,
51
+ apiKey = _ref4$apiKey === void 0 ? '' : _ref4$apiKey,
52
+ _ref4$indexName = _ref4.indexName,
53
+ indexName = _ref4$indexName === void 0 ? '' : _ref4$indexName,
54
+ _ref4$versionV = _ref4.versionV3,
55
+ versionV3 = _ref4$versionV === void 0 ? false : _ref4$versionV,
56
+ _ref4$appId = _ref4.appId,
57
+ appId = _ref4$appId === void 0 ? '' : _ref4$appId;
63
58
  useEffect(function () {
64
59
  if (typeof window !== 'undefined' && !versionV3) {
65
60
  import('docsearch.js').then(function (_ref5) {
@@ -49,6 +49,10 @@ export declare type HeaderProps = {
49
49
  rootDomain?: string;
50
50
  /** 是否显示 AntV 产品卡片 */
51
51
  showAntVProductsCard?: boolean;
52
+ /**
53
+ * 当前版本
54
+ */
55
+ version?: string;
52
56
  /** 展示版本切换 */
53
57
  versions?: {
54
58
  [key: string]: string;
@@ -1,21 +1,15 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1
2
  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
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
-
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
-
9
8
  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."); }
10
-
11
9
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12
-
13
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
14
-
15
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
16
-
10
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
17
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
-
19
13
  // import { navigate } from 'gatsby';
20
14
  import React, { useState, useEffect } from 'react';
21
15
  import { useMedia } from 'react-use';
@@ -30,68 +24,64 @@ import { Products } from "./Products";
30
24
  import { Navs } from "./Navs";
31
25
  import { Logo } from "./Logo";
32
26
  import { LogoWhite } from "./LogoWhite";
33
- import { getLangUrl } from "./utils";
27
+ import { findVersion, getLangUrl } from "./utils";
34
28
  import { ic } from "../hooks";
35
29
  import styles from "./index.module.less";
36
-
37
30
  function redirectChinaMirror(chinaMirrorOrigin) {
38
31
  window.location.href = window.location.href.replace(window.location.origin, chinaMirrorOrigin);
39
32
  }
33
+
40
34
  /**
41
35
  * 头部菜单
42
36
  */
43
-
44
-
45
37
  var HeaderComponent = function HeaderComponent(_ref) {
46
38
  var _cx, _cx4;
47
-
48
39
  var _ref$subTitle = _ref.subTitle,
49
- subTitle = _ref$subTitle === void 0 ? '' : _ref$subTitle,
50
- subTitleHref = _ref.subTitleHref,
51
- _ref$pathPrefix = _ref.pathPrefix,
52
- pathPrefix = _ref$pathPrefix === void 0 ? '' : _ref$pathPrefix,
53
- _ref$navs = _ref.navs,
54
- navs = _ref$navs === void 0 ? [] : _ref$navs,
55
- _ref$showSearch = _ref.showSearch,
56
- showSearch = _ref$showSearch === void 0 ? true : _ref$showSearch,
57
- _ref$showGithubStar = _ref.showGithubStar,
58
- showGithubStar = _ref$showGithubStar === void 0 ? false : _ref$showGithubStar,
59
- _ref$showGithubCorner = _ref.showGithubCorner,
60
- showGithubCorner = _ref$showGithubCorner === void 0 ? true : _ref$showGithubCorner,
61
- _ref$showAntVProducts = _ref.showAntVProductsCard,
62
- showAntVProductsCard = _ref$showAntVProducts === void 0 ? true : _ref$showAntVProducts,
63
- _ref$showLanguageSwit = _ref.showLanguageSwitcher,
64
- showLanguageSwitcher = _ref$showLanguageSwit === void 0 ? true : _ref$showLanguageSwit,
65
- logo = _ref.logo,
66
- onLanguageChange = _ref.onLanguageChange,
67
- _ref$showWxQrcode = _ref.showWxQrcode,
68
- showWxQrcode = _ref$showWxQrcode === void 0 ? true : _ref$showWxQrcode,
69
- siteUrl = _ref.siteUrl,
70
- _ref$githubUrl = _ref.githubUrl,
71
- githubUrl = _ref$githubUrl === void 0 ? 'https://github.com/antvis' : _ref$githubUrl,
72
- defaultLanguage = _ref.defaultLanguage,
73
- _ref$Link = _ref.Link,
74
- Link = _ref$Link === void 0 ? 'a' : _ref$Link,
75
- transparent = _ref.transparent,
76
- isHomePage = _ref.isHomePage,
77
- _ref$isAntVSite = _ref.isAntVSite,
78
- isAntVSite = _ref$isAntVSite === void 0 ? false : _ref$isAntVSite,
79
- _ref$rootDomain = _ref.rootDomain,
80
- rootDomain = _ref$rootDomain === void 0 ? '' : _ref$rootDomain,
81
- versions = _ref.versions,
82
- internalSite = _ref.internalSite,
83
- ecosystems = _ref.ecosystems,
84
- searchOptions = _ref.searchOptions;
40
+ subTitle = _ref$subTitle === void 0 ? '' : _ref$subTitle,
41
+ subTitleHref = _ref.subTitleHref,
42
+ _ref$pathPrefix = _ref.pathPrefix,
43
+ pathPrefix = _ref$pathPrefix === void 0 ? '' : _ref$pathPrefix,
44
+ _ref$navs = _ref.navs,
45
+ navs = _ref$navs === void 0 ? [] : _ref$navs,
46
+ _ref$showSearch = _ref.showSearch,
47
+ showSearch = _ref$showSearch === void 0 ? true : _ref$showSearch,
48
+ _ref$showGithubStar = _ref.showGithubStar,
49
+ showGithubStar = _ref$showGithubStar === void 0 ? false : _ref$showGithubStar,
50
+ _ref$showGithubCorner = _ref.showGithubCorner,
51
+ showGithubCorner = _ref$showGithubCorner === void 0 ? true : _ref$showGithubCorner,
52
+ _ref$showAntVProducts = _ref.showAntVProductsCard,
53
+ showAntVProductsCard = _ref$showAntVProducts === void 0 ? true : _ref$showAntVProducts,
54
+ _ref$showLanguageSwit = _ref.showLanguageSwitcher,
55
+ showLanguageSwitcher = _ref$showLanguageSwit === void 0 ? true : _ref$showLanguageSwit,
56
+ logo = _ref.logo,
57
+ onLanguageChange = _ref.onLanguageChange,
58
+ _ref$showWxQrcode = _ref.showWxQrcode,
59
+ showWxQrcode = _ref$showWxQrcode === void 0 ? true : _ref$showWxQrcode,
60
+ siteUrl = _ref.siteUrl,
61
+ _ref$githubUrl = _ref.githubUrl,
62
+ githubUrl = _ref$githubUrl === void 0 ? 'https://github.com/antvis' : _ref$githubUrl,
63
+ defaultLanguage = _ref.defaultLanguage,
64
+ _ref$Link = _ref.Link,
65
+ Link = _ref$Link === void 0 ? 'a' : _ref$Link,
66
+ transparent = _ref.transparent,
67
+ isHomePage = _ref.isHomePage,
68
+ _ref$isAntVSite = _ref.isAntVSite,
69
+ isAntVSite = _ref$isAntVSite === void 0 ? false : _ref$isAntVSite,
70
+ _ref$rootDomain = _ref.rootDomain,
71
+ rootDomain = _ref$rootDomain === void 0 ? '' : _ref$rootDomain,
72
+ version = _ref.version,
73
+ versions = _ref.versions,
74
+ internalSite = _ref.internalSite,
75
+ ecosystems = _ref.ecosystems,
76
+ searchOptions = _ref.searchOptions;
85
77
  var isAntVHome = isAntVSite && isHomePage; // 是否为AntV官网首页
86
78
 
87
79
  var showChinaMirror = !!internalSite;
88
80
  var chinaMirrorUrl = get(internalSite, 'url');
89
-
90
81
  var _useState = useState(false),
91
- _useState2 = _slicedToArray(_useState, 2),
92
- chinaMirrorHintVisible = _useState2[0],
93
- updateChinaMirrorHintVisible = _useState2[1];
94
-
82
+ _useState2 = _slicedToArray(_useState, 2),
83
+ chinaMirrorHintVisible = _useState2[0],
84
+ updateChinaMirrorHintVisible = _useState2[1];
95
85
  useEffect(function () {
96
86
  var timeout = setTimeout(function () {
97
87
  if (showChinaMirror && lang === 'zh' && !localStorage.getItem('china-mirror-no-more-hint') && window.location.host.includes('antv.vision')) {
@@ -104,19 +94,15 @@ var HeaderComponent = function HeaderComponent(_ref) {
104
94
  });
105
95
  var locale = useLocale();
106
96
  var nav = useNavigate();
107
-
108
97
  var _useState3 = useState(locale.id),
109
- _useState4 = _slicedToArray(_useState3, 2),
110
- lang = _useState4[0],
111
- setLang = _useState4[1];
112
-
98
+ _useState4 = _slicedToArray(_useState3, 2),
99
+ lang = _useState4[0],
100
+ setLang = _useState4[1];
113
101
  var _useState5 = useState(false),
114
- _useState6 = _slicedToArray(_useState5, 2),
115
- productMenuVisible = _useState6[0],
116
- setProductMenuVisible = _useState6[1];
117
-
102
+ _useState6 = _slicedToArray(_useState5, 2),
103
+ productMenuVisible = _useState6[0],
104
+ setProductMenuVisible = _useState6[1];
118
105
  var productMenuHovering = false;
119
-
120
106
  var onProductMouseEnter = function onProductMouseEnter(e) {
121
107
  productMenuHovering = true;
122
108
  e.persist();
@@ -126,7 +112,6 @@ var HeaderComponent = function HeaderComponent(_ref) {
126
112
  }
127
113
  }, 200);
128
114
  };
129
-
130
115
  var onProductMouseLeave = function onProductMouseLeave(e) {
131
116
  e.persist();
132
117
  productMenuHovering = false;
@@ -134,48 +119,42 @@ var HeaderComponent = function HeaderComponent(_ref) {
134
119
  if (productMenuHovering) {
135
120
  return;
136
121
  }
137
-
138
122
  setProductMenuVisible(false);
139
123
  }, 200);
140
124
  };
141
-
142
125
  var onToggleProductMenuVisible = function onToggleProductMenuVisible() {
143
126
  setProductMenuVisible(!productMenuVisible);
144
127
  };
145
-
146
128
  var _useState7 = useState(false),
147
- _useState8 = _slicedToArray(_useState7, 2),
148
- popupMenuVisible = _useState8[0],
149
- setPopupMenuVisible = _useState8[1];
150
-
129
+ _useState8 = _slicedToArray(_useState7, 2),
130
+ popupMenuVisible = _useState8[0],
131
+ setPopupMenuVisible = _useState8[1];
151
132
  var onTogglePopupMenuVisible = function onTogglePopupMenuVisible() {
152
133
  setPopupMenuVisible(!popupMenuVisible);
153
134
  };
154
-
155
135
  var _img$link$logo = _objectSpread({
156
- img: isAntVHome ? /*#__PURE__*/React.createElement(LogoWhite, {
157
- style: {}
158
- }) : /*#__PURE__*/React.createElement(Logo, {
159
- style: {}
160
- }),
161
- link: ''
162
- }, logo),
163
- img = _img$link$logo.img,
164
- link = _img$link$logo.link;
165
-
136
+ img: isAntVHome ? /*#__PURE__*/React.createElement(LogoWhite, {
137
+ style: {}
138
+ }) : /*#__PURE__*/React.createElement(Logo, {
139
+ style: {}
140
+ }),
141
+ link: ''
142
+ }, logo),
143
+ img = _img$link$logo.img,
144
+ link = _img$link$logo.link;
166
145
  useEffect(function () {
167
146
  if (popupMenuVisible) {
168
147
  setPopupMenuVisible(false);
169
148
  }
170
- }, [window.location.pathname]); // 移动端下弹出菜单时,禁止页面滚动
149
+ }, [window.location.pathname]);
171
150
 
151
+ // 移动端下弹出菜单时,禁止页面滚动
172
152
  useEffect(function () {
173
153
  if (popupMenuVisible) {
174
154
  document.documentElement.style.overflow = 'hidden';
175
155
  } else {
176
156
  document.documentElement.style.overflow = '';
177
157
  }
178
-
179
158
  return function () {
180
159
  document.documentElement.style.overflow = '';
181
160
  };
@@ -194,18 +173,16 @@ var HeaderComponent = function HeaderComponent(_ref) {
194
173
  };
195
174
  var menu = /*#__PURE__*/React.createElement("ul", {
196
175
  className: cx(styles.menu, (_cx = {}, _defineProperty(_cx, styles.popup, !isWide), _defineProperty(_cx, styles.popupHidden, !popupMenuVisible), _cx))
197
- },
198
- /** 最左侧的菜单,一般是 教程、API、示例,或者其他自定义,有配置文件中的 `navs` 决定 */
176
+ }, /** 最左侧的菜单,一般是 教程、API、示例,或者其他自定义,有配置文件中的 `navs` 决定 */
199
177
  size(navs) ? /*#__PURE__*/React.createElement(Navs, {
200
178
  navs: navs,
201
179
  path: window.location.pathname
202
- }) : null,
203
- /** 生态产品 */
180
+ }) : null, /** 生态产品 */
204
181
  size(ecosystems) ? /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Dropdown, {
205
182
  className: styles.ecoSystems,
206
183
  overlay: /*#__PURE__*/React.createElement(Menu, null, map(ecosystems, function (_ref2) {
207
184
  var url = _ref2.url,
208
- ecosystemName = _ref2.name;
185
+ ecosystemName = _ref2.name;
209
186
  return /*#__PURE__*/React.createElement(Menu.Item, {
210
187
  key: ecosystemName === null || ecosystemName === void 0 ? void 0 : ecosystemName[lang]
211
188
  }, /*#__PURE__*/React.createElement("a", {
@@ -292,8 +269,7 @@ var HeaderComponent = function HeaderComponent(_ref) {
292
269
  window.location.href = chinaMirrorUrl;
293
270
  },
294
271
  className: styles.remindHref
295
- }, ic(get(internalSite, 'name')), /*#__PURE__*/React.createElement(LinkOutlined, null)), /*#__PURE__*/React.createElement("span", null, " \u7AD9\u70B9\u3002"))),
296
- /** 产品列表 */
272
+ }, ic(get(internalSite, 'name')), /*#__PURE__*/React.createElement(LinkOutlined, null)), /*#__PURE__*/React.createElement("span", null, " \u7AD9\u70B9\u3002"))), /** 产品列表 */
297
273
  showAntVProductsCard && /*#__PURE__*/React.createElement("li", productItemProps, /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(FormattedMessage, {
298
274
  id: "\u6240\u6709\u4EA7\u54C1"
299
275
  }), !isAntVHome ? /*#__PURE__*/React.createElement("img", {
@@ -311,10 +287,9 @@ var HeaderComponent = function HeaderComponent(_ref) {
311
287
  show: productMenuVisible,
312
288
  rootDomain: rootDomain,
313
289
  language: defaultLanguage
314
- })),
315
- /** 版本列表 */
290
+ })), /** 版本列表 */
316
291
  versions && /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Select, {
317
- defaultValue: Object.keys(versions)[0],
292
+ defaultValue: versions[findVersion(version, Object.keys(versions))],
318
293
  className: styles.versions,
319
294
  bordered: false,
320
295
  size: "small",
@@ -323,17 +298,14 @@ var HeaderComponent = function HeaderComponent(_ref) {
323
298
  }
324
299
  }, Object.keys(versions).map(function (version) {
325
300
  var url = versions[version];
326
-
327
301
  if (url.startsWith('http')) {
328
302
  return /*#__PURE__*/React.createElement(Select.Option, {
329
303
  key: url,
330
304
  value: url
331
305
  }, version);
332
306
  }
333
-
334
307
  return null;
335
- }))),
336
- /** 切换网站语言 */
308
+ }))), /** 切换网站语言 */
337
309
  showLanguageSwitcher && /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Dropdown, {
338
310
  placement: "bottomRight",
339
311
  overlay: /*#__PURE__*/React.createElement(Menu, {
@@ -341,18 +313,14 @@ var HeaderComponent = function HeaderComponent(_ref) {
341
313
  selectable: true,
342
314
  onSelect: function onSelect(_ref3) {
343
315
  var key = _ref3.key;
344
-
345
316
  if (key === lang) {
346
317
  return;
347
318
  }
348
-
349
319
  setLang(key);
350
-
351
320
  if (onLanguageChange) {
352
321
  onLanguageChange(key.toString());
353
322
  return;
354
323
  }
355
-
356
324
  var newUrl = getLangUrl(window.location.href, key);
357
325
  nav(newUrl.replace(window.location.origin, ''));
358
326
  }
@@ -385,8 +353,7 @@ var HeaderComponent = function HeaderComponent(_ref) {
385
353
  viewBox: "0 0 24 24"
386
354
  }, /*#__PURE__*/React.createElement("path", {
387
355
  d: "M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"
388
- }))))),
389
- /** 微信公众号 */
356
+ }))))), /** 微信公众号 */
390
357
  showWxQrcode && /*#__PURE__*/React.createElement("li", {
391
358
  className: styles.wxQrcode
392
359
  }, /*#__PURE__*/React.createElement(Popover, {
@@ -405,8 +372,7 @@ var HeaderComponent = function HeaderComponent(_ref) {
405
372
  overlayInnerStyle: {
406
373
  padding: 2
407
374
  }
408
- }, /*#__PURE__*/React.createElement(WechatOutlined, null))),
409
- /** GitHub icon */
375
+ }, /*#__PURE__*/React.createElement(WechatOutlined, null))), /** GitHub icon */
410
376
  showGithubCorner && /*#__PURE__*/React.createElement("li", {
411
377
  className: styles.githubCorner
412
378
  }, /*#__PURE__*/React.createElement("a", {
@@ -432,28 +398,27 @@ var HeaderComponent = function HeaderComponent(_ref) {
432
398
  className: styles.nav
433
399
  }, menu, menuIcon)));
434
400
  };
435
-
436
401
  export var Header = function Header(props) {
437
402
  var _useSiteData = useSiteData(),
438
- themeConfig = _useSiteData.themeConfig;
439
-
403
+ themeConfig = _useSiteData.themeConfig;
440
404
  var title = themeConfig.title,
441
- siteUrl = themeConfig.siteUrl,
442
- githubUrl = themeConfig.githubUrl,
443
- isAntVSite = themeConfig.isAntVSite,
444
- subTitleHref = themeConfig.subTitleHref,
445
- internalSite = themeConfig.internalSite,
446
- showSearch = themeConfig.showSearch,
447
- showGithubCorner = themeConfig.showGithubCorner,
448
- showGithubStars = themeConfig.showGithubStars,
449
- showLanguageSwitcher = themeConfig.showLanguageSwitcher,
450
- showWxQrcode = themeConfig.showWxQrcode,
451
- defaultLanguage = themeConfig.defaultLanguage,
452
- showAntVProductsCard = themeConfig.showAntVProductsCard,
453
- versions = themeConfig.versions,
454
- ecosystems = themeConfig.ecosystems,
455
- navs = themeConfig.navs,
456
- docsearchOptions = themeConfig.docsearchOptions;
405
+ siteUrl = themeConfig.siteUrl,
406
+ githubUrl = themeConfig.githubUrl,
407
+ isAntVSite = themeConfig.isAntVSite,
408
+ subTitleHref = themeConfig.subTitleHref,
409
+ internalSite = themeConfig.internalSite,
410
+ showSearch = themeConfig.showSearch,
411
+ showGithubCorner = themeConfig.showGithubCorner,
412
+ showGithubStars = themeConfig.showGithubStars,
413
+ showLanguageSwitcher = themeConfig.showLanguageSwitcher,
414
+ showWxQrcode = themeConfig.showWxQrcode,
415
+ defaultLanguage = themeConfig.defaultLanguage,
416
+ showAntVProductsCard = themeConfig.showAntVProductsCard,
417
+ version = themeConfig.version,
418
+ versions = themeConfig.versions,
419
+ ecosystems = themeConfig.ecosystems,
420
+ navs = themeConfig.navs,
421
+ docsearchOptions = themeConfig.docsearchOptions;
457
422
  var searchOptions = {
458
423
  docsearchOptions: docsearchOptions
459
424
  };
@@ -474,6 +439,7 @@ export var Header = function Header(props) {
474
439
  showWxQrcode: showWxQrcode,
475
440
  defaultLanguage: defaultLanguage,
476
441
  showAntVProductsCard: showAntVProductsCard,
442
+ version: version,
477
443
  versions: versions,
478
444
  ecosystems: ecosystems,
479
445
  navs: navs,
@@ -7,3 +7,4 @@ export declare function getLangUrl(url: string, lang: string): string;
7
7
  * @param url
8
8
  */
9
9
  export declare function getNavCategory(url: string): string;
10
+ export declare function findVersion(v: string, versions: string[]): string;
@@ -1,4 +1,6 @@
1
1
  import URI from 'uri-parse';
2
+ import semver from 'semver';
3
+
2
4
  /*
3
5
  * parse url like this
4
6
  *
@@ -16,14 +18,13 @@ import URI from 'uri-parse';
16
18
 
17
19
  export function getLangUrl(url, lang) {
18
20
  var uri = new URI(url);
19
-
20
21
  if (uri.path.startsWith('en') || uri.path.startsWith('zh')) {
21
22
  uri.path = uri.path.slice(3);
22
23
  }
23
-
24
24
  uri.path = lang === 'en' ? "en/".concat(uri.path) : uri.path;
25
25
  return uri.toURI();
26
26
  }
27
+
27
28
  /**
28
29
  * /en/api/xxx -> api
29
30
  * /api/xxx -> api
@@ -31,9 +32,14 @@ export function getLangUrl(url, lang) {
31
32
  * api/xxx -> api
32
33
  * @param url
33
34
  */
34
-
35
35
  export function getNavCategory(url) {
36
36
  return (url || '').split('/').find(function (d) {
37
37
  return !['en', 'zh', 'docs', ''].includes(d);
38
38
  });
39
+ }
40
+ export function findVersion(v, versions) {
41
+ var version = versions.find(function (version) {
42
+ return semver.satisfies(v, version);
43
+ });
44
+ return version ? version : versions[0];
39
45
  }
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import styles from "./index.module.less";
3
+
3
4
  /**
4
5
  * Loading
5
6
  */
6
-
7
7
  var Loading = function Loading() {
8
8
  return /*#__PURE__*/React.createElement("div", {
9
9
  style: {
@@ -67,7 +67,6 @@ var Loading = function Loading() {
67
67
  className: "loading-text"
68
68
  }, /*#__PURE__*/React.createElement("p", null, "Loading...")))));
69
69
  };
70
-
71
70
  var PageLoading = function PageLoading() {
72
71
  return /*#__PURE__*/React.createElement("div", {
73
72
  style: {
@@ -75,5 +74,4 @@ var PageLoading = function PageLoading() {
75
74
  }
76
75
  }, /*#__PURE__*/React.createElement(Loading, null));
77
76
  };
78
-
79
77
  export { Loading, PageLoading };
@@ -5,26 +5,21 @@ import styles from "./NavigatorBanner.module.less";
5
5
  import { useScrollToTop } from "../hooks";
6
6
  export var NavigatorBanner = function NavigatorBanner(_ref) {
7
7
  var post = _ref.post,
8
- type = _ref.type;
9
-
8
+ type = _ref.type;
10
9
  if (!post) {
11
10
  return /*#__PURE__*/React.createElement("div", {
12
11
  className: classNames(styles.button, styles.hidden)
13
12
  });
14
13
  }
15
-
16
14
  var slug = post.slug,
17
- title = post.title;
18
-
15
+ title = post.title;
19
16
  if (!slug || !title) {
20
17
  return null;
21
18
  }
22
-
23
19
  function go() {
24
20
  history.push(slug);
25
21
  useScrollToTop();
26
22
  }
27
-
28
23
  return /*#__PURE__*/React.createElement("div", {
29
24
  className: classNames(styles.button, styles[type]),
30
25
  onClick: go
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Tag } from 'antd';
3
3
  import { FormattedMessage } from 'dumi';
4
-
5
4
  var ReadingTime = function ReadingTime(_ref) {
6
5
  var readingTime = _ref.readingTime;
7
6
  return /*#__PURE__*/React.createElement(Tag, null, /*#__PURE__*/React.createElement(FormattedMessage, {
@@ -10,5 +9,4 @@ var ReadingTime = function ReadingTime(_ref) {
10
9
  id: "\u5206\u949F"
11
10
  }));
12
11
  };
13
-
14
12
  export default ReadingTime;