@antv/dumi-theme-antv 0.2.2 → 0.3.0-beta.10

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 (265) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -33
  3. package/dist/builtins/Playground/index.d.ts +21 -0
  4. package/dist/builtins/Playground/index.js +69 -0
  5. package/dist/builtins/Playground/index.module.less +15 -0
  6. package/dist/context.d.ts +6 -0
  7. package/dist/context.js +2 -0
  8. package/dist/layouts/DocLayout.d.ts +7 -0
  9. package/dist/layouts/DocLayout.js +48 -0
  10. package/dist/layouts/entry/API.d.ts +10 -0
  11. package/dist/layouts/entry/API.js +12 -0
  12. package/dist/layouts/entry/Index.d.ts +7 -0
  13. package/dist/layouts/entry/Index.js +79 -0
  14. package/dist/layouts/entry/Manual.d.ts +8 -0
  15. package/dist/layouts/entry/Manual.js +13 -0
  16. package/dist/locales/en.json +98 -0
  17. package/dist/locales/zh.json +98 -0
  18. package/dist/pages/404.d.ts +6 -0
  19. package/dist/pages/404.js +18 -0
  20. package/dist/pages/Example/index.d.ts +6 -0
  21. package/dist/pages/Example/index.js +115 -0
  22. package/dist/pages/Example/index.module.less +82 -0
  23. package/dist/pages/Example/utils.d.ts +1 -0
  24. package/dist/pages/Example/utils.js +9 -0
  25. package/dist/pages/Examples/components/Accouncement/index.d.ts +6 -0
  26. package/dist/pages/Examples/components/Accouncement/index.js +60 -0
  27. package/dist/pages/Examples/components/Accouncement/index.module.less +9 -0
  28. package/dist/pages/Examples/components/Article/index.d.ts +2 -0
  29. package/dist/pages/Examples/components/Article/index.js +8 -0
  30. package/dist/pages/Examples/components/Article/index.module.less +2 -0
  31. package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.d.ts +10 -0
  32. package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.js +74 -0
  33. package/dist/pages/Examples/components/ExampleTopicMenu/index.d.ts +9 -0
  34. package/{es/builtins/Example.js → dist/pages/Examples/components/ExampleTopicMenu/index.js} +47 -33
  35. package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.d.ts +10 -0
  36. package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +33 -0
  37. package/dist/pages/Examples/components/GalleryPageContent/index.d.ts +10 -0
  38. package/dist/pages/Examples/components/GalleryPageContent/index.js +81 -0
  39. package/dist/pages/Examples/index.d.ts +8 -0
  40. package/dist/pages/Examples/index.js +95 -0
  41. package/dist/pages/Examples/index.module.less +607 -0
  42. package/dist/pages/Examples/types.d.ts +34 -0
  43. package/dist/pages/Examples/types.js +1 -0
  44. package/dist/plugin/examples.d.ts +21 -0
  45. package/dist/plugin/examples.js +105 -0
  46. package/dist/plugin/index.d.ts +3 -0
  47. package/dist/plugin/index.js +113 -0
  48. package/dist/plugin/utils.d.ts +5 -0
  49. package/dist/plugin/utils.js +46 -0
  50. package/dist/slots/404.d.ts +2 -0
  51. package/{es/antv/404/index.js → dist/slots/404.js} +4 -9
  52. package/{es/antv/Cases/Cases.d.ts → dist/slots/Cases/index.d.ts} +5 -4
  53. package/{es/antv/Cases/Cases.js → dist/slots/Cases/index.js} +25 -25
  54. package/{src/antv/Cases/Cases.module.less → dist/slots/Cases/index.module.less} +36 -5
  55. package/dist/slots/CodeEditor/Toolbar.d.ts +67 -0
  56. package/dist/slots/CodeEditor/Toolbar.js +140 -0
  57. package/dist/slots/CodeEditor/Toolbar.module.less +81 -0
  58. package/dist/slots/CodeEditor/index.d.ts +58 -0
  59. package/dist/slots/CodeEditor/index.js +226 -0
  60. package/dist/slots/CodeEditor/index.module.less +11 -0
  61. package/dist/slots/CodeEditor/utils.d.ts +42 -0
  62. package/dist/slots/CodeEditor/utils.js +157 -0
  63. package/dist/slots/CodePreview/CodeHeader.d.ts +19 -0
  64. package/dist/slots/CodePreview/CodeHeader.js +32 -0
  65. package/dist/slots/CodePreview/CodeHeader.module.less +0 -0
  66. package/dist/slots/CodePreview/index.d.ts +17 -0
  67. package/dist/slots/CodePreview/index.js +29 -0
  68. package/dist/slots/CodePreview/index.module.less +43 -0
  69. package/dist/slots/CodeRunner/index.d.ts +15 -0
  70. package/dist/slots/CodeRunner/index.js +79 -0
  71. package/dist/slots/CodeRunner/index.module.less +0 -0
  72. package/dist/slots/CodeRunner/utils.d.ts +11 -0
  73. package/dist/slots/CodeRunner/utils.js +36 -0
  74. package/dist/slots/Companies/index.d.ts +13 -0
  75. package/dist/slots/Companies/index.js +49 -0
  76. package/dist/slots/Companies/index.module.less +82 -0
  77. package/dist/slots/Detail/News.d.ts +10 -0
  78. package/{es/antv/Banner/Notification.js → dist/slots/Detail/News.js} +8 -11
  79. package/{src/antv/Banner/Notification.module.less → dist/slots/Detail/News.module.less} +15 -3
  80. package/dist/slots/Detail/index.d.ts +27 -0
  81. package/dist/slots/Detail/index.js +124 -0
  82. package/{src/antv/Banner/Banner.module.less → dist/slots/Detail/index.module.less} +42 -74
  83. package/dist/slots/ExampleSider/index.d.ts +21 -0
  84. package/dist/slots/ExampleSider/index.js +196 -0
  85. package/dist/slots/ExampleSider/index.module.less +141 -0
  86. package/{es/antv → dist/slots}/Features/FeatureCard.d.ts +2 -1
  87. package/{es/antv → dist/slots}/Features/FeatureCard.js +6 -6
  88. package/{src/antv → dist/slots}/Features/FeatureCard.module.less +8 -1
  89. package/{es/antv → dist/slots}/Features/index.d.ts +2 -2
  90. package/{es/antv → dist/slots}/Features/index.js +19 -26
  91. package/{src/antv/Features/Features.module.less → dist/slots/Features/index.module.less} +34 -3
  92. package/dist/slots/Footer/index.d.ts +18 -0
  93. package/dist/slots/Footer/index.js +188 -0
  94. package/dist/slots/Footer/index.module.less +86 -0
  95. package/dist/slots/Header/Logo.d.ts +7 -0
  96. package/{es/antv → dist/slots}/Header/Logo.js +6 -2
  97. package/dist/slots/Header/LogoWhite.d.ts +7 -0
  98. package/dist/slots/Header/LogoWhite.js +19 -0
  99. package/dist/slots/Header/Navs.d.ts +26 -0
  100. package/dist/slots/Header/Navs.js +63 -0
  101. package/dist/slots/Header/Products/NavigatorBanner.d.ts +10 -0
  102. package/dist/slots/Header/Products/NavigatorBanner.js +34 -0
  103. package/dist/slots/Header/Products/NavigatorBanner.module.less +39 -0
  104. package/{es/antv → dist/slots/Header}/Products/Product.d.ts +3 -3
  105. package/{es/antv → dist/slots/Header}/Products/Product.js +11 -16
  106. package/{src/antv → dist/slots/Header}/Products/Product.module.less +10 -8
  107. package/{es/antv → dist/slots/Header}/Products/getProducts.d.ts +2 -7
  108. package/dist/slots/Header/Products/getProducts.js +67 -0
  109. package/dist/slots/Header/Products/index.d.ts +9 -0
  110. package/{es/antv → dist/slots/Header}/Products/index.js +15 -22
  111. package/dist/slots/Header/Search.d.ts +12 -0
  112. package/dist/slots/Header/Search.js +90 -0
  113. package/dist/slots/Header/Search.module.less +39 -0
  114. package/dist/slots/Header/index.d.ts +66 -0
  115. package/dist/slots/Header/index.js +380 -0
  116. package/dist/slots/Header/index.module.less +382 -0
  117. package/dist/slots/Header/utils.d.ts +1 -0
  118. package/dist/slots/Header/utils.js +26 -0
  119. package/dist/slots/Loading/index.d.ts +7 -0
  120. package/dist/slots/Loading/index.js +79 -0
  121. package/dist/slots/Loading/index.module.less +279 -0
  122. package/dist/slots/ManualContent/NavigatorBanner.d.ts +9 -0
  123. package/dist/slots/ManualContent/NavigatorBanner.js +36 -0
  124. package/dist/slots/ManualContent/NavigatorBanner.module.less +39 -0
  125. package/dist/slots/ManualContent/ReadingTime.d.ts +3 -0
  126. package/dist/slots/ManualContent/ReadingTime.js +10 -0
  127. package/dist/slots/ManualContent/index.d.ts +9 -0
  128. package/dist/slots/ManualContent/index.js +344 -0
  129. package/dist/slots/ManualContent/index.module.less +668 -0
  130. package/dist/slots/ManualContent/utils.d.ts +3 -0
  131. package/dist/slots/ManualContent/utils.js +35 -0
  132. package/dist/slots/SEO.d.ts +10 -0
  133. package/dist/slots/SEO.js +59 -0
  134. package/dist/slots/TOC.d.ts +5 -0
  135. package/dist/slots/TOC.js +6 -0
  136. package/dist/slots/_.less +83 -0
  137. package/dist/slots/global.d.ts +1 -0
  138. package/dist/slots/global.js +7 -0
  139. package/dist/slots/hooks.d.ts +16 -0
  140. package/{es/antv → dist/slots}/hooks.js +60 -37
  141. package/dist/slots/utils.d.ts +5 -0
  142. package/dist/slots/utils.js +112 -0
  143. package/dist/types.d.ts +86 -0
  144. package/dist/types.js +1 -0
  145. package/dist/typings.d.ts +24 -0
  146. package/package.json +110 -47
  147. package/es/antv/404/index.d.ts +0 -2
  148. package/es/antv/Banner/Banner.module.less +0 -412
  149. package/es/antv/Banner/Notification.d.ts +0 -10
  150. package/es/antv/Banner/Notification.module.less +0 -108
  151. package/es/antv/Banner/index.d.ts +0 -25
  152. package/es/antv/Banner/index.js +0 -104
  153. package/es/antv/Cases/Cases.module.less +0 -203
  154. package/es/antv/Features/FeatureCard.module.less +0 -51
  155. package/es/antv/Features/Features.module.less +0 -169
  156. package/es/antv/Footer/Footer.module.less +0 -36
  157. package/es/antv/Footer/index.d.ts +0 -12
  158. package/es/antv/Footer/index.js +0 -237
  159. package/es/antv/Header/Logo.d.ts +0 -4
  160. package/es/antv/Products/Product.module.less +0 -146
  161. package/es/antv/Products/getNewProducts.d.ts +0 -24
  162. package/es/antv/Products/getNewProducts.js +0 -35
  163. package/es/antv/Products/getProducts.js +0 -460
  164. package/es/antv/Products/index.d.ts +0 -9
  165. package/es/antv/hooks.d.ts +0 -14
  166. package/es/antv/mixins.less +0 -21
  167. package/es/antv/utils.d.ts +0 -5
  168. package/es/antv/utils.js +0 -49
  169. package/es/builtins/API.d.ts +0 -3
  170. package/es/builtins/API.js +0 -37
  171. package/es/builtins/Alert.d.ts +0 -3
  172. package/es/builtins/Alert.js +0 -7
  173. package/es/builtins/Alert.less +0 -62
  174. package/es/builtins/Badge.d.ts +0 -3
  175. package/es/builtins/Badge.js +0 -7
  176. package/es/builtins/Badge.less +0 -31
  177. package/es/builtins/Example.d.ts +0 -5
  178. package/es/builtins/Example.less +0 -47
  179. package/es/builtins/Previewer.d.ts +0 -39
  180. package/es/builtins/Previewer.js +0 -225
  181. package/es/builtins/Previewer.less +0 -406
  182. package/es/builtins/SourceCode.d.ts +0 -10
  183. package/es/builtins/SourceCode.js +0 -70
  184. package/es/builtins/SourceCode.less +0 -103
  185. package/es/builtins/Table.d.ts +0 -4
  186. package/es/builtins/Table.js +0 -56
  187. package/es/builtins/Table.less +0 -43
  188. package/es/builtins/Tree.d.ts +0 -4
  189. package/es/builtins/Tree.js +0 -213
  190. package/es/builtins/Tree.less +0 -159
  191. package/es/components/Dark.d.ts +0 -9
  192. package/es/components/Dark.js +0 -125
  193. package/es/components/Dark.less +0 -121
  194. package/es/components/LocaleSelect.d.ts +0 -6
  195. package/es/components/LocaleSelect.js +0 -53
  196. package/es/components/LocaleSelect.less +0 -59
  197. package/es/components/Navbar.d.ts +0 -10
  198. package/es/components/Navbar.js +0 -155
  199. package/es/components/Navbar.less +0 -180
  200. package/es/components/SearchBar.d.ts +0 -4
  201. package/es/components/SearchBar.js +0 -81
  202. package/es/components/SearchBar.less +0 -165
  203. package/es/components/SideMenu.d.ts +0 -10
  204. package/es/components/SideMenu.js +0 -99
  205. package/es/components/SideMenu.less +0 -379
  206. package/es/components/SlugList.d.ts +0 -7
  207. package/es/components/SlugList.js +0 -38
  208. package/es/components/SlugList.less +0 -18
  209. package/es/declaration.d.ts +0 -1
  210. package/es/layout.d.ts +0 -5
  211. package/es/layout.js +0 -276
  212. package/es/style/layout.less +0 -402
  213. package/es/style/markdown.less +0 -240
  214. package/es/style/variables.less +0 -37
  215. package/src/antv/404/index.tsx +0 -25
  216. package/src/antv/Banner/Notification.tsx +0 -45
  217. package/src/antv/Banner/index.tsx +0 -139
  218. package/src/antv/Cases/Cases.tsx +0 -116
  219. package/src/antv/Features/FeatureCard.tsx +0 -24
  220. package/src/antv/Features/index.tsx +0 -86
  221. package/src/antv/Footer/Footer.module.less +0 -36
  222. package/src/antv/Footer/index.tsx +0 -272
  223. package/src/antv/Header/Logo.tsx +0 -85
  224. package/src/antv/Products/Product.tsx +0 -80
  225. package/src/antv/Products/getNewProducts.tsx +0 -53
  226. package/src/antv/Products/getProducts.tsx +0 -626
  227. package/src/antv/Products/index.tsx +0 -70
  228. package/src/antv/hooks.ts +0 -87
  229. package/src/antv/mixins.less +0 -21
  230. package/src/antv/utils.ts +0 -44
  231. package/src/builtins/API.tsx +0 -57
  232. package/src/builtins/Alert.less +0 -62
  233. package/src/builtins/Alert.tsx +0 -4
  234. package/src/builtins/Badge.less +0 -31
  235. package/src/builtins/Badge.tsx +0 -4
  236. package/src/builtins/Example.less +0 -47
  237. package/src/builtins/Example.tsx +0 -34
  238. package/src/builtins/Previewer.less +0 -406
  239. package/src/builtins/Previewer.tsx +0 -264
  240. package/src/builtins/SourceCode.less +0 -103
  241. package/src/builtins/SourceCode.tsx +0 -55
  242. package/src/builtins/Table.less +0 -43
  243. package/src/builtins/Table.tsx +0 -42
  244. package/src/builtins/Tree.less +0 -159
  245. package/src/builtins/Tree.tsx +0 -130
  246. package/src/components/Dark.less +0 -121
  247. package/src/components/Dark.tsx +0 -78
  248. package/src/components/LocaleSelect.less +0 -59
  249. package/src/components/LocaleSelect.tsx +0 -53
  250. package/src/components/Navbar.less +0 -180
  251. package/src/components/Navbar.tsx +0 -152
  252. package/src/components/SearchBar.less +0 -165
  253. package/src/components/SearchBar.tsx +0 -68
  254. package/src/components/SideMenu.less +0 -379
  255. package/src/components/SideMenu.tsx +0 -148
  256. package/src/components/SlugList.less +0 -18
  257. package/src/components/SlugList.tsx +0 -20
  258. package/src/declaration.d.ts +0 -1
  259. package/src/layout.tsx +0 -225
  260. package/src/style/layout.less +0 -402
  261. package/src/style/markdown.less +0 -240
  262. package/src/style/variables.less +0 -37
  263. package/src/test/SearchBar.test.ts +0 -32
  264. package/src/test/Table.test.tsx +0 -41
  265. package/src/test/index.test.tsx +0 -377
@@ -0,0 +1,380 @@
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
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+
9
+ 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
+ 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
+
17
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
+
19
+ // import { navigate } from 'gatsby';
20
+ import React, { useState, useEffect } from 'react';
21
+ import { useMedia } from 'react-use';
22
+ import { useNavigate } from "react-router-dom";
23
+ import cx from 'classnames';
24
+ import { useSiteData, useLocale } from 'dumi';
25
+ import { GithubOutlined, MenuOutlined, CaretDownFilled, DownOutlined, WechatOutlined, LinkOutlined, CheckOutlined } from '@ant-design/icons';
26
+ import { Popover, Menu, Dropdown, Select } from 'antd';
27
+ import { map, size } from 'lodash-es';
28
+ import { Search } from "./Search";
29
+ import { Products } from "./Products";
30
+ import { Navs } from "./Navs";
31
+ import { Logo } from "./Logo";
32
+ import { LogoWhite } from "./LogoWhite";
33
+ import { getLangUrl } from "./utils";
34
+ import { useT } from "../hooks";
35
+ import styles from "./index.module.less";
36
+
37
+ /**
38
+ * 头部菜单
39
+ */
40
+ var HeaderComponent = function HeaderComponent(_ref) {
41
+ var _cx, _cx4;
42
+
43
+ var _ref$subTitle = _ref.subTitle,
44
+ subTitle = _ref$subTitle === void 0 ? '' : _ref$subTitle,
45
+ subTitleHref = _ref.subTitleHref,
46
+ _ref$pathPrefix = _ref.pathPrefix,
47
+ pathPrefix = _ref$pathPrefix === void 0 ? '' : _ref$pathPrefix,
48
+ _ref$navs = _ref.navs,
49
+ navs = _ref$navs === void 0 ? [] : _ref$navs,
50
+ _ref$showSearch = _ref.showSearch,
51
+ showSearch = _ref$showSearch === void 0 ? true : _ref$showSearch,
52
+ _ref$showGithubStar = _ref.showGithubStar,
53
+ showGithubStar = _ref$showGithubStar === void 0 ? false : _ref$showGithubStar,
54
+ _ref$showGithubCorner = _ref.showGithubCorner,
55
+ showGithubCorner = _ref$showGithubCorner === void 0 ? true : _ref$showGithubCorner,
56
+ _ref$showAntVProducts = _ref.showAntVProductsCard,
57
+ showAntVProductsCard = _ref$showAntVProducts === void 0 ? true : _ref$showAntVProducts,
58
+ _ref$showLanguageSwit = _ref.showLanguageSwitcher,
59
+ showLanguageSwitcher = _ref$showLanguageSwit === void 0 ? true : _ref$showLanguageSwit,
60
+ _ref$showChinaMirror = _ref.showChinaMirror,
61
+ showChinaMirror = _ref$showChinaMirror === void 0 ? true : _ref$showChinaMirror,
62
+ logo = _ref.logo,
63
+ onLanguageChange = _ref.onLanguageChange,
64
+ _ref$showWxQrcode = _ref.showWxQrcode,
65
+ showWxQrcode = _ref$showWxQrcode === void 0 ? true : _ref$showWxQrcode,
66
+ siteUrl = _ref.siteUrl,
67
+ _ref$githubUrl = _ref.githubUrl,
68
+ githubUrl = _ref$githubUrl === void 0 ? 'https://github.com/antvis' : _ref$githubUrl,
69
+ defaultLanguage = _ref.defaultLanguage,
70
+ _ref$Link = _ref.Link,
71
+ Link = _ref$Link === void 0 ? 'a' : _ref$Link,
72
+ transparent = _ref.transparent,
73
+ isHomePage = _ref.isHomePage,
74
+ _ref$isAntVSite = _ref.isAntVSite,
75
+ isAntVSite = _ref$isAntVSite === void 0 ? false : _ref$isAntVSite,
76
+ _ref$rootDomain = _ref.rootDomain,
77
+ rootDomain = _ref$rootDomain === void 0 ? '' : _ref$rootDomain,
78
+ versions = _ref.versions,
79
+ ecosystems = _ref.ecosystems,
80
+ searchOptions = _ref.searchOptions;
81
+ var isAntVHome = isAntVSite && isHomePage; // 是否为AntV官网首页
82
+
83
+ var locale = useLocale();
84
+ var nav = useNavigate();
85
+
86
+ var _useState = useState(locale.id),
87
+ _useState2 = _slicedToArray(_useState, 2),
88
+ lang = _useState2[0],
89
+ setLang = _useState2[1];
90
+
91
+ var _useState3 = useState(false),
92
+ _useState4 = _slicedToArray(_useState3, 2),
93
+ productMenuVisible = _useState4[0],
94
+ setProductMenuVisible = _useState4[1];
95
+
96
+ var productMenuHovering = false;
97
+
98
+ var onProductMouseEnter = function onProductMouseEnter(e) {
99
+ productMenuHovering = true;
100
+ e.persist();
101
+ setTimeout(function () {
102
+ if (e.target instanceof Element && e.target.matches(':hover')) {
103
+ setProductMenuVisible(true);
104
+ }
105
+ }, 200);
106
+ };
107
+
108
+ var onProductMouseLeave = function onProductMouseLeave(e) {
109
+ e.persist();
110
+ productMenuHovering = false;
111
+ setTimeout(function () {
112
+ if (productMenuHovering) {
113
+ return;
114
+ }
115
+
116
+ setProductMenuVisible(false);
117
+ }, 200);
118
+ };
119
+
120
+ var onToggleProductMenuVisible = function onToggleProductMenuVisible() {
121
+ setProductMenuVisible(!productMenuVisible);
122
+ };
123
+
124
+ var _useState5 = useState(false),
125
+ _useState6 = _slicedToArray(_useState5, 2),
126
+ popupMenuVisible = _useState6[0],
127
+ setPopupMenuVisible = _useState6[1];
128
+
129
+ var onTogglePopupMenuVisible = function onTogglePopupMenuVisible() {
130
+ setPopupMenuVisible(!popupMenuVisible);
131
+ };
132
+
133
+ var _img$link$logo = _objectSpread({
134
+ img: isAntVHome ? /*#__PURE__*/React.createElement(LogoWhite, {
135
+ style: {}
136
+ }) : /*#__PURE__*/React.createElement(Logo, {
137
+ style: {}
138
+ }),
139
+ link: ''
140
+ }, logo),
141
+ img = _img$link$logo.img,
142
+ link = _img$link$logo.link;
143
+
144
+ useEffect(function () {
145
+ if (popupMenuVisible) {
146
+ setPopupMenuVisible(false);
147
+ }
148
+ }, [window.location.pathname]); // 移动端下弹出菜单时,禁止页面滚动
149
+
150
+ useEffect(function () {
151
+ if (popupMenuVisible) {
152
+ document.documentElement.style.overflow = 'hidden';
153
+ } else {
154
+ document.documentElement.style.overflow = '';
155
+ }
156
+
157
+ return function () {
158
+ document.documentElement.style.overflow = '';
159
+ };
160
+ }, [popupMenuVisible]);
161
+ var isWide = useMedia('(min-width: 767.99px)', true);
162
+ var menuIcon = !isWide ? /*#__PURE__*/React.createElement(MenuOutlined, {
163
+ className: styles.menuIcon,
164
+ onClick: onTogglePopupMenuVisible
165
+ }) : null;
166
+ var productItemProps = isWide ? {
167
+ onMouseEnter: onProductMouseEnter,
168
+ onMouseLeave: onProductMouseLeave
169
+ } : {
170
+ onClick: onToggleProductMenuVisible
171
+ };
172
+ var menu = /*#__PURE__*/React.createElement("ul", {
173
+ className: cx(styles.menu, (_cx = {}, _defineProperty(_cx, styles.popup, !isWide), _defineProperty(_cx, styles.popupHidden, !popupMenuVisible), _cx))
174
+ },
175
+ /** 最左侧的菜单,一般是 教程、API、示例,或者其他自定义,有配置文件中的 `navs` 决定 */
176
+ size(navs) ? /*#__PURE__*/React.createElement(Navs, {
177
+ navs: navs,
178
+ path: window.location.pathname
179
+ }) : null,
180
+ /** 生态产品 */
181
+ size(ecosystems) ? /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Dropdown, {
182
+ className: styles.ecoSystems,
183
+ overlay: /*#__PURE__*/React.createElement(Menu, null, map(ecosystems, function (_ref2) {
184
+ var url = _ref2.url,
185
+ ecosystemName = _ref2.name;
186
+ return /*#__PURE__*/React.createElement(Menu.Item, {
187
+ key: ecosystemName === null || ecosystemName === void 0 ? void 0 : ecosystemName[lang]
188
+ }, /*#__PURE__*/React.createElement("a", {
189
+ target: "_blank",
190
+ rel: "noreferrer",
191
+ href: url
192
+ }, ecosystemName === null || ecosystemName === void 0 ? void 0 : ecosystemName[lang], " ", /*#__PURE__*/React.createElement(LinkOutlined, null)));
193
+ }))
194
+ }, /*#__PURE__*/React.createElement("span", null, useT('周边生态'), /*#__PURE__*/React.createElement(DownOutlined, {
195
+ style: {
196
+ marginLeft: '6px'
197
+ }
198
+ })))) : null,
199
+ /** 产品列表 */
200
+ showAntVProductsCard && /*#__PURE__*/React.createElement("li", productItemProps, /*#__PURE__*/React.createElement("a", null, useT('所有产品'), !isAntVHome ? /*#__PURE__*/React.createElement("img", {
201
+ src: "https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png",
202
+ alt: "antv logo arrow",
203
+ className: cx(styles.arrow, _defineProperty({}, styles.open, productMenuVisible))
204
+ }) : /*#__PURE__*/React.createElement(CaretDownFilled, {
205
+ style: {
206
+ top: '1px',
207
+ color: '#fff'
208
+ },
209
+ className: cx(styles.arrow, _defineProperty({}, styles.open, productMenuVisible))
210
+ })), /*#__PURE__*/React.createElement(Products, {
211
+ className: styles.productsMenu,
212
+ show: productMenuVisible,
213
+ rootDomain: rootDomain,
214
+ language: defaultLanguage
215
+ })),
216
+ /** 版本列表 */
217
+ versions && /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Select, {
218
+ defaultValue: Object.keys(versions)[0],
219
+ className: styles.versions,
220
+ bordered: false,
221
+ size: "small",
222
+ onChange: function onChange(value) {
223
+ window.location.href = value;
224
+ }
225
+ }, Object.keys(versions).map(function (version) {
226
+ var url = versions[version];
227
+
228
+ if (url.startsWith('http')) {
229
+ return /*#__PURE__*/React.createElement(Select.Option, {
230
+ key: url,
231
+ value: url
232
+ }, version);
233
+ }
234
+
235
+ return null;
236
+ }))),
237
+ /** 切换网站语言 */
238
+ showLanguageSwitcher && /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Dropdown, {
239
+ placement: "bottomRight",
240
+ overlay: /*#__PURE__*/React.createElement(Menu, {
241
+ defaultSelectedKeys: [lang],
242
+ selectable: true,
243
+ onSelect: function onSelect(_ref3) {
244
+ var key = _ref3.key;
245
+
246
+ if (key === lang) {
247
+ return;
248
+ }
249
+
250
+ setLang(key);
251
+
252
+ if (onLanguageChange) {
253
+ onLanguageChange(key.toString());
254
+ return;
255
+ }
256
+
257
+ var newUrl = getLangUrl(window.location.href, key);
258
+ nav(newUrl.replace(window.location.origin, ''));
259
+ }
260
+ }, /*#__PURE__*/React.createElement(Menu.Item, {
261
+ key: "en"
262
+ }, /*#__PURE__*/React.createElement(CheckOutlined, {
263
+ style: {
264
+ visibility: lang === 'en' ? 'visible' : 'hidden',
265
+ color: '#52c41a'
266
+ }
267
+ }), "English"), /*#__PURE__*/React.createElement(Menu.Item, {
268
+ key: "zh"
269
+ }, /*#__PURE__*/React.createElement(CheckOutlined, {
270
+ style: {
271
+ visibility: lang === 'zh' ? 'visible' : 'hidden',
272
+ color: '#52c41a'
273
+ }
274
+ }), "\u7B80\u4F53\u4E2D\u6587")),
275
+ className: styles.translation
276
+ }, /*#__PURE__*/React.createElement("a", {
277
+ className: "ant-dropdown-link",
278
+ onClick: function onClick(e) {
279
+ return e.preventDefault();
280
+ }
281
+ }, /*#__PURE__*/React.createElement("svg", {
282
+ className: styles.translation,
283
+ xmlns: "http://www.w3.org/2000/svg",
284
+ width: "24",
285
+ height: "24",
286
+ viewBox: "0 0 24 24"
287
+ }, /*#__PURE__*/React.createElement("path", {
288
+ 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"
289
+ }))))),
290
+ /** 微信公众号 */
291
+ showWxQrcode && /*#__PURE__*/React.createElement("li", {
292
+ className: styles.wxQrcode
293
+ }, /*#__PURE__*/React.createElement(Popover, {
294
+ content: /*#__PURE__*/React.createElement("img", {
295
+ width: "100%",
296
+ height: "100%",
297
+ src: "https://gw.alipayobjects.com/zos/antfincdn/ZKlx96dsfs/qrcode_for_gh_f52d8b6aa591_258.jpg",
298
+ alt: "wx-qrcode"
299
+ }),
300
+ title: "\u5FAE\u4FE1\u626B\u4E00\u626B\u5173\u6CE8",
301
+ overlayClassName: "wx-qrcode-popover",
302
+ overlayStyle: {
303
+ width: 128,
304
+ height: 128
305
+ },
306
+ overlayInnerStyle: {
307
+ padding: 2
308
+ }
309
+ }, /*#__PURE__*/React.createElement(WechatOutlined, null))),
310
+ /** GitHub icon */
311
+ showGithubCorner && /*#__PURE__*/React.createElement("li", {
312
+ className: styles.githubCorner
313
+ }, /*#__PURE__*/React.createElement("a", {
314
+ href: githubUrl,
315
+ target: "_blank",
316
+ rel: "noreferrer"
317
+ }, /*#__PURE__*/React.createElement(GithubOutlined, null))));
318
+ return /*#__PURE__*/React.createElement("header", {
319
+ className: cx(styles.header, (_cx4 = {}, _defineProperty(_cx4, styles.transparent, !!transparent && !productMenuVisible), _defineProperty(_cx4, styles.isHomePage, !!isHomePage && !isAntVHome), _defineProperty(_cx4, styles.lightTheme, !!isAntVHome && !productMenuVisible && isWide), _defineProperty(_cx4, styles.fixed, popupMenuVisible), _cx4))
320
+ }, /*#__PURE__*/React.createElement("div", {
321
+ className: styles.container
322
+ }, /*#__PURE__*/React.createElement("div", {
323
+ className: styles.left
324
+ }, /*#__PURE__*/React.createElement("h1", null, /*#__PURE__*/React.createElement("a", {
325
+ href: siteUrl
326
+ }, img)), subTitle && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
327
+ className: styles.divider
328
+ }), /*#__PURE__*/React.createElement("h2", {
329
+ className: styles.subProduceName
330
+ }, /*#__PURE__*/React.createElement("a", {
331
+ href: window.location.pathname.startsWith('/en') ? '/en' : '/'
332
+ }, subTitle))), showSearch && !isAntVHome && /*#__PURE__*/React.createElement(Search, searchOptions)), /*#__PURE__*/React.createElement("nav", {
333
+ className: styles.nav
334
+ }, menu, menuIcon)));
335
+ };
336
+
337
+ export var Header = function Header(props) {
338
+ var _useSiteData = useSiteData(),
339
+ themeConfig = _useSiteData.themeConfig;
340
+
341
+ var title = themeConfig.title,
342
+ siteUrl = themeConfig.siteUrl,
343
+ githubUrl = themeConfig.githubUrl,
344
+ isAntVSite = themeConfig.isAntVSite,
345
+ subTitleHref = themeConfig.subTitleHref,
346
+ showSearch = themeConfig.showSearch,
347
+ showGithubCorner = themeConfig.showGithubCorner,
348
+ showGithubStars = themeConfig.showGithubStars,
349
+ showLanguageSwitcher = themeConfig.showLanguageSwitcher,
350
+ showWxQrcode = themeConfig.showWxQrcode,
351
+ defaultLanguage = themeConfig.defaultLanguage,
352
+ showAntVProductsCard = themeConfig.showAntVProductsCard,
353
+ versions = themeConfig.versions,
354
+ ecosystems = themeConfig.ecosystems,
355
+ navs = themeConfig.navs,
356
+ docsearchOptions = themeConfig.docsearchOptions;
357
+ var searchOptions = {
358
+ docsearchOptions: docsearchOptions
359
+ };
360
+ var headerProps = {
361
+ subTitle: title,
362
+ subTitleHref: subTitleHref,
363
+ githubUrl: githubUrl,
364
+ isAntVSite: isAntVSite,
365
+ siteUrl: siteUrl,
366
+ showSearch: showSearch,
367
+ showGithubCorner: showGithubCorner,
368
+ showGithubStars: showGithubStars,
369
+ showLanguageSwitcher: showLanguageSwitcher,
370
+ showWxQrcode: showWxQrcode,
371
+ defaultLanguage: defaultLanguage,
372
+ showAntVProductsCard: showAntVProductsCard,
373
+ versions: versions,
374
+ ecosystems: ecosystems,
375
+ navs: navs,
376
+ searchOptions: searchOptions,
377
+ isHomePage: true
378
+ };
379
+ return /*#__PURE__*/React.createElement(HeaderComponent, Object.assign({}, headerProps, props));
380
+ };