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

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 (258) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -33
  3. package/dist/builtins/Playground/index.d.ts +24 -0
  4. package/{es/builtins/Example.js → dist/builtins/Playground/index.js} +40 -33
  5. package/dist/builtins/Playground/index.module.less +15 -0
  6. package/dist/context.d.ts +5 -0
  7. package/dist/context.js +2 -0
  8. package/dist/layouts/DocLayout.d.ts +7 -0
  9. package/dist/layouts/DocLayout.js +38 -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 +71 -0
  14. package/dist/layouts/entry/Manual.d.ts +8 -0
  15. package/dist/layouts/entry/Manual.js +14 -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 +14 -0
  20. package/dist/pages/Example/index.d.ts +6 -0
  21. package/dist/pages/Example/index.js +139 -0
  22. package/dist/pages/Example/index.module.less +40 -0
  23. package/dist/pages/Examples/components/Accouncement/index.d.ts +6 -0
  24. package/dist/pages/Examples/components/Accouncement/index.js +60 -0
  25. package/dist/pages/Examples/components/Accouncement/index.module.less +9 -0
  26. package/dist/pages/Examples/components/Article/index.d.ts +2 -0
  27. package/dist/pages/Examples/components/Article/index.js +8 -0
  28. package/dist/pages/Examples/components/Article/index.module.less +2 -0
  29. package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.d.ts +10 -0
  30. package/dist/pages/Examples/components/ExampleTopicMenu/components/LeftMenu/index.js +74 -0
  31. package/dist/pages/Examples/components/ExampleTopicMenu/index.d.ts +9 -0
  32. package/{es/builtins/Table.js → dist/pages/Examples/components/ExampleTopicMenu/index.js} +47 -41
  33. package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.d.ts +10 -0
  34. package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +33 -0
  35. package/dist/pages/Examples/components/GalleryPageContent/index.d.ts +10 -0
  36. package/dist/pages/Examples/components/GalleryPageContent/index.js +81 -0
  37. package/dist/pages/Examples/index.d.ts +8 -0
  38. package/dist/pages/Examples/index.js +75 -0
  39. package/dist/pages/Examples/index.module.less +605 -0
  40. package/dist/pages/Examples/types.d.ts +33 -0
  41. package/dist/pages/Examples/types.js +1 -0
  42. package/dist/plugin/examples.d.ts +7 -0
  43. package/dist/plugin/examples.js +83 -0
  44. package/dist/plugin/index.d.ts +3 -0
  45. package/dist/plugin/index.js +103 -0
  46. package/dist/slots/404.d.ts +2 -0
  47. package/{es/antv/404/index.js → dist/slots/404.js} +4 -9
  48. package/{es/antv/Cases/Cases.d.ts → dist/slots/Cases/index.d.ts} +4 -4
  49. package/{es/antv/Cases/Cases.js → dist/slots/Cases/index.js} +25 -25
  50. package/{src/antv/Cases/Cases.module.less → dist/slots/Cases/index.module.less} +36 -5
  51. package/dist/slots/CodeEditor/Toolbar.d.ts +67 -0
  52. package/dist/slots/CodeEditor/Toolbar.js +152 -0
  53. package/dist/slots/CodeEditor/Toolbar.module.less +81 -0
  54. package/dist/slots/CodeEditor/index.d.ts +58 -0
  55. package/dist/slots/CodeEditor/index.js +200 -0
  56. package/dist/slots/CodeEditor/index.module.less +11 -0
  57. package/dist/slots/CodeEditor/utils.d.ts +42 -0
  58. package/dist/slots/CodeEditor/utils.js +157 -0
  59. package/dist/slots/CodePreview/CodeHeader.d.ts +19 -0
  60. package/dist/slots/CodePreview/CodeHeader.js +32 -0
  61. package/dist/slots/CodePreview/CodeHeader.module.less +0 -0
  62. package/dist/slots/CodePreview/index.d.ts +17 -0
  63. package/dist/slots/CodePreview/index.js +29 -0
  64. package/dist/slots/CodePreview/index.module.less +42 -0
  65. package/dist/slots/CodeRunner/index.d.ts +14 -0
  66. package/dist/slots/CodeRunner/index.js +76 -0
  67. package/dist/slots/CodeRunner/index.module.less +0 -0
  68. package/dist/slots/CodeRunner/utils.d.ts +10 -0
  69. package/dist/slots/CodeRunner/utils.js +36 -0
  70. package/dist/slots/Companies/index.d.ts +13 -0
  71. package/dist/slots/Companies/index.js +49 -0
  72. package/dist/slots/Companies/index.module.less +82 -0
  73. package/dist/slots/Detail/News.d.ts +9 -0
  74. package/{es/antv/Banner/Notification.js → dist/slots/Detail/News.js} +8 -11
  75. package/{src/antv/Banner/Notification.module.less → dist/slots/Detail/News.module.less} +15 -3
  76. package/dist/slots/Detail/index.d.ts +26 -0
  77. package/dist/slots/Detail/index.js +124 -0
  78. package/{src/antv/Banner/Banner.module.less → dist/slots/Detail/index.module.less} +42 -74
  79. package/dist/slots/ExampleSider/index.d.ts +55 -0
  80. package/dist/slots/ExampleSider/index.js +218 -0
  81. package/dist/slots/ExampleSider/index.module.less +141 -0
  82. package/{es/antv → dist/slots}/Features/FeatureCard.d.ts +1 -1
  83. package/{es/antv → dist/slots}/Features/FeatureCard.js +6 -6
  84. package/{src/antv → dist/slots}/Features/FeatureCard.module.less +8 -1
  85. package/{es/antv → dist/slots}/Features/index.d.ts +2 -2
  86. package/{es/antv → dist/slots}/Features/index.js +17 -25
  87. package/{src/antv/Features/Features.module.less → dist/slots/Features/index.module.less} +34 -3
  88. package/dist/slots/Footer/index.d.ts +18 -0
  89. package/dist/slots/Footer/index.js +187 -0
  90. package/dist/slots/Footer/index.module.less +85 -0
  91. package/dist/slots/Header/Logo.d.ts +7 -0
  92. package/{es/antv → dist/slots}/Header/Logo.js +6 -2
  93. package/dist/slots/Header/LogoWhite.d.ts +7 -0
  94. package/dist/slots/Header/LogoWhite.js +19 -0
  95. package/dist/slots/Header/Navs.d.ts +17 -0
  96. package/dist/slots/Header/Navs.js +46 -0
  97. package/dist/slots/Header/Products/NavigatorBanner.d.ts +10 -0
  98. package/dist/slots/Header/Products/NavigatorBanner.js +34 -0
  99. package/dist/slots/Header/Products/NavigatorBanner.module.less +39 -0
  100. package/{es/antv → dist/slots/Header}/Products/Product.d.ts +3 -3
  101. package/{es/antv → dist/slots/Header}/Products/Product.js +11 -16
  102. package/{src/antv → dist/slots/Header}/Products/Product.module.less +10 -8
  103. package/{es/antv → dist/slots/Header}/Products/getProducts.d.ts +2 -7
  104. package/dist/slots/Header/Products/getProducts.js +67 -0
  105. package/dist/slots/Header/Products/index.d.ts +9 -0
  106. package/{es/antv → dist/slots/Header}/Products/index.js +15 -22
  107. package/dist/slots/Header/Search.d.ts +12 -0
  108. package/dist/slots/Header/Search.js +90 -0
  109. package/dist/slots/Header/Search.module.less +39 -0
  110. package/dist/slots/Header/index.d.ts +66 -0
  111. package/dist/slots/Header/index.js +379 -0
  112. package/dist/slots/Header/index.module.less +382 -0
  113. package/dist/slots/Header/utils.d.ts +1 -0
  114. package/dist/slots/Header/utils.js +26 -0
  115. package/dist/slots/Loading/index.d.ts +2 -0
  116. package/dist/slots/Loading/index.js +65 -0
  117. package/dist/slots/Loading/index.module.less +12 -0
  118. package/dist/slots/Loading.d.ts +5 -0
  119. package/dist/slots/Loading.js +8 -0
  120. package/dist/slots/ManualContent/NavigatorBanner.d.ts +9 -0
  121. package/dist/slots/ManualContent/NavigatorBanner.js +36 -0
  122. package/dist/slots/ManualContent/NavigatorBanner.module.less +39 -0
  123. package/dist/slots/ManualContent/ReadingTime.d.ts +3 -0
  124. package/dist/slots/ManualContent/ReadingTime.js +10 -0
  125. package/dist/slots/ManualContent/index.d.ts +9 -0
  126. package/dist/slots/ManualContent/index.js +321 -0
  127. package/dist/slots/ManualContent/index.module.less +656 -0
  128. package/dist/slots/TOC.d.ts +5 -0
  129. package/dist/slots/TOC.js +6 -0
  130. package/dist/slots/_.less +83 -0
  131. package/dist/slots/global.d.ts +1 -0
  132. package/dist/slots/global.js +7 -0
  133. package/dist/slots/hooks.d.ts +16 -0
  134. package/{es/antv → dist/slots}/hooks.js +60 -37
  135. package/dist/slots/utils.d.ts +20 -0
  136. package/dist/slots/utils.js +154 -0
  137. package/dist/types.d.ts +3 -0
  138. package/dist/types.js +1 -0
  139. package/dist/typings.d.ts +137 -0
  140. package/package.json +108 -47
  141. package/es/antv/404/index.d.ts +0 -2
  142. package/es/antv/Banner/Banner.module.less +0 -412
  143. package/es/antv/Banner/Notification.d.ts +0 -10
  144. package/es/antv/Banner/Notification.module.less +0 -108
  145. package/es/antv/Banner/index.d.ts +0 -25
  146. package/es/antv/Banner/index.js +0 -104
  147. package/es/antv/Cases/Cases.module.less +0 -203
  148. package/es/antv/Features/FeatureCard.module.less +0 -51
  149. package/es/antv/Features/Features.module.less +0 -169
  150. package/es/antv/Footer/Footer.module.less +0 -36
  151. package/es/antv/Footer/index.d.ts +0 -12
  152. package/es/antv/Footer/index.js +0 -237
  153. package/es/antv/Header/Logo.d.ts +0 -4
  154. package/es/antv/Products/Product.module.less +0 -146
  155. package/es/antv/Products/getNewProducts.d.ts +0 -24
  156. package/es/antv/Products/getNewProducts.js +0 -35
  157. package/es/antv/Products/getProducts.js +0 -460
  158. package/es/antv/Products/index.d.ts +0 -9
  159. package/es/antv/hooks.d.ts +0 -14
  160. package/es/antv/mixins.less +0 -21
  161. package/es/antv/utils.d.ts +0 -5
  162. package/es/antv/utils.js +0 -49
  163. package/es/builtins/API.d.ts +0 -3
  164. package/es/builtins/API.js +0 -37
  165. package/es/builtins/Alert.d.ts +0 -3
  166. package/es/builtins/Alert.js +0 -7
  167. package/es/builtins/Alert.less +0 -62
  168. package/es/builtins/Badge.d.ts +0 -3
  169. package/es/builtins/Badge.js +0 -7
  170. package/es/builtins/Badge.less +0 -31
  171. package/es/builtins/Example.d.ts +0 -5
  172. package/es/builtins/Example.less +0 -47
  173. package/es/builtins/Previewer.d.ts +0 -39
  174. package/es/builtins/Previewer.js +0 -225
  175. package/es/builtins/Previewer.less +0 -406
  176. package/es/builtins/SourceCode.d.ts +0 -10
  177. package/es/builtins/SourceCode.js +0 -70
  178. package/es/builtins/SourceCode.less +0 -103
  179. package/es/builtins/Table.d.ts +0 -4
  180. package/es/builtins/Table.less +0 -43
  181. package/es/builtins/Tree.d.ts +0 -4
  182. package/es/builtins/Tree.js +0 -213
  183. package/es/builtins/Tree.less +0 -159
  184. package/es/components/Dark.d.ts +0 -9
  185. package/es/components/Dark.js +0 -125
  186. package/es/components/Dark.less +0 -121
  187. package/es/components/LocaleSelect.d.ts +0 -6
  188. package/es/components/LocaleSelect.js +0 -53
  189. package/es/components/LocaleSelect.less +0 -59
  190. package/es/components/Navbar.d.ts +0 -10
  191. package/es/components/Navbar.js +0 -155
  192. package/es/components/Navbar.less +0 -180
  193. package/es/components/SearchBar.d.ts +0 -4
  194. package/es/components/SearchBar.js +0 -81
  195. package/es/components/SearchBar.less +0 -165
  196. package/es/components/SideMenu.d.ts +0 -10
  197. package/es/components/SideMenu.js +0 -99
  198. package/es/components/SideMenu.less +0 -379
  199. package/es/components/SlugList.d.ts +0 -7
  200. package/es/components/SlugList.js +0 -38
  201. package/es/components/SlugList.less +0 -18
  202. package/es/declaration.d.ts +0 -1
  203. package/es/layout.d.ts +0 -5
  204. package/es/layout.js +0 -276
  205. package/es/style/layout.less +0 -402
  206. package/es/style/markdown.less +0 -240
  207. package/es/style/variables.less +0 -37
  208. package/src/antv/404/index.tsx +0 -25
  209. package/src/antv/Banner/Notification.tsx +0 -45
  210. package/src/antv/Banner/index.tsx +0 -139
  211. package/src/antv/Cases/Cases.tsx +0 -116
  212. package/src/antv/Features/FeatureCard.tsx +0 -24
  213. package/src/antv/Features/index.tsx +0 -86
  214. package/src/antv/Footer/Footer.module.less +0 -36
  215. package/src/antv/Footer/index.tsx +0 -272
  216. package/src/antv/Header/Logo.tsx +0 -85
  217. package/src/antv/Products/Product.tsx +0 -80
  218. package/src/antv/Products/getNewProducts.tsx +0 -53
  219. package/src/antv/Products/getProducts.tsx +0 -626
  220. package/src/antv/Products/index.tsx +0 -70
  221. package/src/antv/hooks.ts +0 -87
  222. package/src/antv/mixins.less +0 -21
  223. package/src/antv/utils.ts +0 -44
  224. package/src/builtins/API.tsx +0 -57
  225. package/src/builtins/Alert.less +0 -62
  226. package/src/builtins/Alert.tsx +0 -4
  227. package/src/builtins/Badge.less +0 -31
  228. package/src/builtins/Badge.tsx +0 -4
  229. package/src/builtins/Example.less +0 -47
  230. package/src/builtins/Example.tsx +0 -34
  231. package/src/builtins/Previewer.less +0 -406
  232. package/src/builtins/Previewer.tsx +0 -264
  233. package/src/builtins/SourceCode.less +0 -103
  234. package/src/builtins/SourceCode.tsx +0 -55
  235. package/src/builtins/Table.less +0 -43
  236. package/src/builtins/Table.tsx +0 -42
  237. package/src/builtins/Tree.less +0 -159
  238. package/src/builtins/Tree.tsx +0 -130
  239. package/src/components/Dark.less +0 -121
  240. package/src/components/Dark.tsx +0 -78
  241. package/src/components/LocaleSelect.less +0 -59
  242. package/src/components/LocaleSelect.tsx +0 -53
  243. package/src/components/Navbar.less +0 -180
  244. package/src/components/Navbar.tsx +0 -152
  245. package/src/components/SearchBar.less +0 -165
  246. package/src/components/SearchBar.tsx +0 -68
  247. package/src/components/SideMenu.less +0 -379
  248. package/src/components/SideMenu.tsx +0 -148
  249. package/src/components/SlugList.less +0 -18
  250. package/src/components/SlugList.tsx +0 -20
  251. package/src/declaration.d.ts +0 -1
  252. package/src/layout.tsx +0 -225
  253. package/src/style/layout.less +0 -402
  254. package/src/style/markdown.less +0 -240
  255. package/src/style/variables.less +0 -37
  256. package/src/test/SearchBar.test.ts +0 -32
  257. package/src/test/Table.test.tsx +0 -41
  258. package/src/test/index.test.tsx +0 -377
@@ -1,12 +1,12 @@
1
- import React from "react";
2
- import { ProductType } from "./getProducts";
1
+ import React from 'react';
2
+ import { ProductType } from './getProducts';
3
3
  interface ProductProps {
4
4
  name?: string;
5
5
  icon?: string;
6
6
  slogan?: string;
7
7
  description?: string;
8
8
  url?: string;
9
- links: ProductType["links"];
9
+ links: ProductType['links'];
10
10
  style?: React.CSSProperties;
11
11
  language?: string;
12
12
  }
@@ -1,29 +1,24 @@
1
- import React from "react";
2
- import { useTranslation } from "react-i18next"; //@ts-ignore
3
-
1
+ import React from 'react';
2
+ import { useT } from "../../hooks";
4
3
  import styles from "./Product.module.less";
5
4
 
6
5
  var getTarget = function getTarget(url) {
7
- return url.startsWith("http") && !url.includes("gitee.io") && !url.includes("antv.vision") ? "_blank" : "_self";
6
+ return url.startsWith('http') && !url.includes('gitee.io') && !url.includes('antv.vision') ? '_blank' : '_self';
8
7
  };
9
8
 
10
9
  var Product = function Product(_ref) {
10
+ var _links$home$title, _links$example$title;
11
+
11
12
  var name = _ref.name,
12
13
  icon = _ref.icon,
13
14
  _ref$url = _ref.url,
14
- url = _ref$url === void 0 ? "" : _ref$url,
15
+ url = _ref$url === void 0 ? '' : _ref$url,
15
16
  slogan = _ref.slogan,
16
17
  description = _ref.description,
17
18
  _ref$links = _ref.links,
18
19
  links = _ref$links === void 0 ? {} : _ref$links,
19
20
  style = _ref.style,
20
21
  language = _ref.language;
21
-
22
- var _a, _b;
23
-
24
- var _useTranslation = useTranslation(),
25
- t = _useTranslation.t;
26
-
27
22
  return /*#__PURE__*/React.createElement("li", {
28
23
  className: styles.product,
29
24
  style: style
@@ -41,7 +36,7 @@ var Product = function Product(_ref) {
41
36
  }, /*#__PURE__*/React.createElement("h4", null, name, /*#__PURE__*/React.createElement("span", {
42
37
  className: styles.productSlogan,
43
38
  style: {
44
- opacity: language === "en" ? 0.7 : ""
39
+ opacity: language === 'en' ? 0.7 : ''
45
40
  }
46
41
  }, slogan))), /*#__PURE__*/React.createElement("div", {
47
42
  className: styles.productDescription
@@ -49,13 +44,13 @@ var Product = function Product(_ref) {
49
44
  className: styles.productLinks
50
45
  }, links.home && /*#__PURE__*/React.createElement("a", {
51
46
  href: links.home.url,
52
- target: getTarget(links.home.url || ""),
47
+ target: getTarget(links.home.url || ''),
53
48
  key: links.home.url
54
- }, (_a = links.home.title) !== null && _a !== void 0 ? _a : t("产品首页")), links.example && /*#__PURE__*/React.createElement("a", {
49
+ }, (_links$home$title = links.home.title) !== null && _links$home$title !== void 0 ? _links$home$title : useT('产品首页')), links.example && /*#__PURE__*/React.createElement("a", {
55
50
  href: links.example.url,
56
- target: getTarget(links.example.url || ""),
51
+ target: getTarget(links.example.url || ''),
57
52
  key: links.example.url
58
- }, (_b = links.example.title) !== null && _b !== void 0 ? _b : t("图表示例")))));
53
+ }, (_links$example$title = links.example.title) !== null && _links$example$title !== void 0 ? _links$example$title : useT('图表示例')))));
59
54
  };
60
55
 
61
56
  export default Product;
@@ -1,4 +1,5 @@
1
- @import '../mixins';
1
+ @import '~antd/es/style/themes/default.less';
2
+ @import '../../_.less';
2
3
 
3
4
  .products {
4
5
  width: 100%;
@@ -7,11 +8,12 @@
7
8
  left: 0;
8
9
  top: 64px;
9
10
  opacity: 0;
11
+ max-height: calc(100vh - 64px);
10
12
  transform: translateY(-12px);
11
13
  transition: all 0.3s ease-in;
12
14
  background: #fff;
13
- padding: 0;
14
- overflow: hidden;
15
+ padding: 8px 0 0;
16
+ overflow: auto;
15
17
  box-shadow: none;
16
18
  line-height: 1.5;
17
19
  font-weight: normal;
@@ -26,18 +28,18 @@
26
28
  opacity: 1;
27
29
  box-shadow: 0 2px 8px #f0f1f2 inset;
28
30
  pointer-events: auto;
29
- max-height: unset !important;
30
31
  transform: translateY(0);
32
+ height: auto !important;
31
33
  }
32
34
 
33
- &.show + .mask {
35
+ &.show+.mask {
34
36
  opacity: 1;
35
37
  }
36
38
 
37
39
  h3 {
38
40
  font-size: 14px;
39
41
  line-height: 22px;
40
- margin: 32px 0 24px 0;
42
+ margin: 24px 0;
41
43
  color: #a3b1bf;
42
44
  font-weight: normal;
43
45
  padding-bottom: 8px;
@@ -97,7 +99,7 @@
97
99
  }
98
100
 
99
101
  .productLinks {
100
- > a {
102
+ >a {
101
103
  margin-right: 12px;
102
104
  font-size: 12px;
103
105
  line-height: 20px;
@@ -143,4 +145,4 @@
143
145
  padding-right: 0;
144
146
  }
145
147
  }
146
- }
148
+ }
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  declare const Categories: ["basic", "extension", "ecology"];
3
3
  export interface ProductItem {
4
4
  title: string;
@@ -14,11 +14,6 @@ export interface ProductItem {
14
14
  }>;
15
15
  }
16
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
17
  declare const CATEGORY_TYPE: ["basic", "extension", "mobile", "ecology"];
23
18
  export declare const CATEGORIES: Array<{
24
19
  type: typeof CATEGORY_TYPE[number];
@@ -45,7 +40,7 @@ export declare type ProductType = {
45
40
  [k: string]: any;
46
41
  };
47
42
  export declare function getNewProducts({ language, isChinaMirrorHost, }: {
48
- language: "zh" | "en";
43
+ language: 'zh' | 'en';
49
44
  isChinaMirrorHost: boolean;
50
45
  }): Promise<ProductType[]>;
51
46
  export {};
@@ -0,0 +1,67 @@
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
+ import { each } from 'lodash-es';
8
+
9
+ var tuple = function tuple() {
10
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
11
+ args[_key] = arguments[_key];
12
+ }
13
+
14
+ return args;
15
+ };
16
+
17
+ var Categories = tuple('basic', 'extension', 'ecology');
18
+ var Link = tuple('home', 'example', 'api');
19
+ var ANTV_DOMAIN = 'antv.vision';
20
+ var CATEGORY_TYPE = tuple('basic', 'extension', 'mobile', 'ecology');
21
+ export var CATEGORIES = [{
22
+ type: 'basic',
23
+ name: '标准版基础产品'
24
+ }, {
25
+ type: 'extension',
26
+ name: '标准版扩展产品'
27
+ }, {
28
+ type: 'mobile',
29
+ name: '移动定制(F版)产品'
30
+ }, {
31
+ type: 'ecology',
32
+ name: '周边生态'
33
+ }];
34
+ export function getNewProducts(_ref) {
35
+ var language = _ref.language,
36
+ isChinaMirrorHost = _ref.isChinaMirrorHost;
37
+ // 如需要修改产品信息,请到 https://yuyan.antfin-inc.com/datavprod/antv-site-datas/schemas/site-products-h5data/console 修改区块内容
38
+ return fetch('https://render.alipay.com/p/h5data/antv-site-datas_site-products-h5data.json').then(function (res) {
39
+ return res.json();
40
+ }).then(function (products) {
41
+ return products.filter(function (d) {
42
+ return d.lang === language;
43
+ }).map(function (d) {
44
+ var links = typeof d.links === 'string' ? JSON.parse(d.links) : _objectSpread({}, d.links);
45
+ var newLinks = {};
46
+ each(links, function (value, k) {
47
+ var actualUrl = (value === null || value === void 0 ? void 0 : value.url) || '';
48
+
49
+ if (isChinaMirrorHost) {
50
+ // g2plot.antv.vision => antv-g2plot.gitee.io
51
+ var match = actualUrl.match(/([http|https]):\/\/(.*)\.antv\.vision/);
52
+
53
+ if (match && match[2]) {
54
+ actualUrl = actualUrl.replace("".concat(match[2], ".antv.vision"), "antv-".concat(match[2], ".gitee.io"));
55
+ }
56
+ }
57
+
58
+ newLinks[k] = _objectSpread(_objectSpread({}, value), {}, {
59
+ url: actualUrl
60
+ });
61
+ });
62
+ return _objectSpread(_objectSpread({}, d), {}, {
63
+ links: newLinks
64
+ });
65
+ });
66
+ });
67
+ }
@@ -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
+ export declare const Products: React.FC<ProductsProps>;
9
+ export {};
@@ -12,23 +12,18 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
12
12
 
13
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
14
 
15
- import classNames from "classnames";
16
- import React from "react";
17
- import { useTranslation } from "react-i18next";
18
- import { useChinaMirrorHost } from "../hooks";
15
+ import React from 'react';
16
+ import cx from 'classnames';
17
+ import Product from "./Product";
19
18
  import { CATEGORIES, getNewProducts } from "./getProducts";
20
- import Product from "./Product"; //@ts-ignore
21
-
19
+ import { useChinaMirrorHost, useT } from "../../hooks";
22
20
  import styles from "./Product.module.less";
23
-
24
- var Products = function Products(_ref) {
21
+ import { useLocale } from 'dumi';
22
+ export var Products = function Products(_ref) {
25
23
  var show = _ref.show,
26
24
  language = _ref.language,
27
25
  className = _ref.className;
28
-
29
- var _useTranslation = useTranslation(),
30
- t = _useTranslation.t,
31
- i18n = _useTranslation.i18n;
26
+ var locale = useLocale();
32
27
 
33
28
  var _useChinaMirrorHost = useChinaMirrorHost(),
34
29
  _useChinaMirrorHost2 = _slicedToArray(_useChinaMirrorHost, 1),
@@ -39,7 +34,7 @@ var Products = function Products(_ref) {
39
34
  products = _React$useState2[0],
40
35
  setProducts = _React$useState2[1];
41
36
 
42
- var lang = i18n.language === "zh" ? "zh" : "en";
37
+ var lang = locale.id === 'zh' ? 'zh' : 'en';
43
38
  React.useEffect(function () {
44
39
  getNewProducts({
45
40
  language: lang,
@@ -49,7 +44,7 @@ var Products = function Products(_ref) {
49
44
  });
50
45
  }, [lang, isChinaMirrorHost]);
51
46
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
52
- className: classNames(styles.products, className, _defineProperty({}, styles.show, !!show))
47
+ className: cx(styles.products, className, _defineProperty({}, styles.show, !!show))
53
48
  }, /*#__PURE__*/React.createElement("div", {
54
49
  className: styles.container
55
50
  }, CATEGORIES.map(function (_ref2, idx) {
@@ -57,25 +52,23 @@ var Products = function Products(_ref) {
57
52
  type = _ref2.type;
58
53
  return /*#__PURE__*/React.createElement(React.Fragment, {
59
54
  key: idx
60
- }, /*#__PURE__*/React.createElement("h3", null, t(name)), /*#__PURE__*/React.createElement("ul", null, products.filter(function (item) {
55
+ }, /*#__PURE__*/React.createElement("h3", null, useT(name)), /*#__PURE__*/React.createElement("ul", null, products.filter(function (item) {
61
56
  return item.category === type;
62
57
  }).map(function (product) {
63
- var _a, _b;
58
+ var _product$links, _product$links$home;
64
59
 
65
60
  return /*#__PURE__*/React.createElement(Product, {
66
61
  key: product.title,
67
62
  name: product.title,
68
- slogan: product.slogan || "",
63
+ slogan: product.slogan || '',
69
64
  description: product.description,
70
- url: (_b = (_a = product.links) === null || _a === void 0 ? void 0 : _a.home) === null || _b === void 0 ? void 0 : _b.url,
65
+ 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,
71
66
  icon: product.icon,
72
67
  links: product.links,
73
- language: language || i18n.language
68
+ language: language || locale.id
74
69
  });
75
70
  })));
76
71
  }))), /*#__PURE__*/React.createElement("div", {
77
72
  className: styles.mask
78
73
  }));
79
- };
80
-
81
- export default Products;
74
+ };
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import '@docsearch/css';
3
+ import 'docsearch.js/dist/cdn/docsearch.min.css';
4
+ export interface SearchProps {
5
+ docsearchOptions?: {
6
+ versionV3?: boolean;
7
+ appId?: string;
8
+ apiKey: string;
9
+ indexName: string;
10
+ };
11
+ }
12
+ export declare const Search: React.FC<SearchProps>;
@@ -0,0 +1,90 @@
1
+ import React, { useEffect } from 'react';
2
+ import { SearchOutlined } from '@ant-design/icons';
3
+ import { DocSearch } from '@docsearch/react';
4
+ import { useLocale } from 'dumi';
5
+ import { useT } from "../hooks";
6
+ import '@docsearch/css';
7
+ import styles from "./Search.module.less";
8
+ import 'docsearch.js/dist/cdn/docsearch.min.css';
9
+
10
+ function initDocSearchV2(_ref) {
11
+ var docsearchV2 = _ref.docsearchV2,
12
+ lang = _ref.lang,
13
+ docsearchOptions = _ref.docsearchOptions;
14
+
15
+ var _ref2 = docsearchOptions || {},
16
+ _ref2$apiKey = _ref2.apiKey,
17
+ apiKey = _ref2$apiKey === void 0 ? '194b1be7fb1254c787f4e036912af3eb' : _ref2$apiKey,
18
+ _ref2$indexName = _ref2.indexName,
19
+ indexName = _ref2$indexName === void 0 ? 'antv' : _ref2$indexName;
20
+
21
+ docsearchV2({
22
+ apiKey: apiKey,
23
+ indexName: indexName,
24
+ inputSelector: ".".concat(styles.input),
25
+ algoliaOptions: {
26
+ facetFilters: ["tags:".concat(lang)]
27
+ },
28
+ transformData: function transformData(hits) {
29
+ hits.forEach(function (hit) {
30
+ /* eslint-disable no-param-reassign */
31
+ hit.url = hit.url.replace('g2.antv.vision', window.location.host);
32
+ hit.url = hit.url.replace('g6.antv.vision', window.location.host);
33
+ hit.url = hit.url.replace('f2.antv.vision', window.location.host);
34
+ hit.url = hit.url.replace('l7.antv.vision', window.location.host);
35
+ hit.url = hit.url.replace('x6.antv.vision', window.location.host);
36
+ hit.url = hit.url.replace('g2plot.antv.vision', window.location.host);
37
+ hit.url = hit.url.replace('graphin.antv.vision', window.location.host);
38
+ hit.url = hit.url.replace('https:', window.location.protocol);
39
+ hit.url = hit.url.replace('#gatsby-focus-wrapper', '');
40
+ /* eslint-enable no-param-reassign */
41
+ });
42
+ return hits;
43
+ },
44
+ debug: false // Set debug to true if you want to inspect the dropdown
45
+
46
+ });
47
+ }
48
+
49
+ export var Search = function Search(_ref3) {
50
+ var docsearchOptions = _ref3.docsearchOptions;
51
+ var locale = useLocale();
52
+
53
+ 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
+
63
+ useEffect(function () {
64
+ if (typeof window !== 'undefined' && !versionV3) {
65
+ import('docsearch.js').then(function (_ref5) {
66
+ var docsearchV2 = _ref5.default;
67
+ initDocSearchV2({
68
+ docsearchV2: docsearchV2,
69
+ lang: locale.id,
70
+ docsearchOptions: docsearchOptions
71
+ });
72
+ });
73
+ }
74
+ }, []);
75
+ return /*#__PURE__*/React.createElement("label", {
76
+ className: styles.search,
77
+ htmlFor: "search",
78
+ id: "search"
79
+ }, versionV3 ? /*#__PURE__*/React.createElement(DocSearch, {
80
+ appId: appId,
81
+ indexName: indexName,
82
+ apiKey: apiKey
83
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SearchOutlined, {
84
+ className: styles.icon
85
+ }), /*#__PURE__*/React.createElement("input", {
86
+ className: styles.input,
87
+ id: "search",
88
+ placeholder: useT('搜索…')
89
+ })));
90
+ };
@@ -0,0 +1,39 @@
1
+ .search {
2
+ margin-left: 36px;
3
+ line-height: 1.5;
4
+ white-space: nowrap;
5
+ transition: all 0.3s;
6
+
7
+ .icon {
8
+ color: #a3b1bf;
9
+ opacity: 0.75;
10
+ margin-right: 8px;
11
+ }
12
+
13
+ .input {
14
+ border: none;
15
+ height: 32px;
16
+ line-height: 32px;
17
+ outline: none;
18
+ background: transparent;
19
+ vertical-align: baseline !important;
20
+
21
+ &::placeholder {
22
+ color: #a3b1bf;
23
+ }
24
+ }
25
+
26
+ :global {
27
+ .DocSearch-Search-Icon {
28
+ width: 1em !important;
29
+ height: 1em !important;
30
+ color: #a3b1bf !important;
31
+ }
32
+ }
33
+ }
34
+
35
+ @media only screen and (max-width: 931.99px) {
36
+ .search {
37
+ display: none;
38
+ }
39
+ }
@@ -0,0 +1,66 @@
1
+ import React from 'react';
2
+ import { INav } from './Navs';
3
+ export declare type HeaderProps = {
4
+ pathPrefix?: string;
5
+ /** 子标题 */
6
+ subTitle?: React.ReactNode;
7
+ /** 子标题的链接 */
8
+ subTitleHref?: string;
9
+ /** 文档和演示的菜单数据 */
10
+ navs?: INav[];
11
+ /** 是否显示搜索框 */
12
+ showSearch?: boolean;
13
+ /** 是否显示 Github 图标 */
14
+ showGithubCorner?: boolean;
15
+ /** 是否显示 Github Star */
16
+ showGithubStar?: boolean;
17
+ /** 是否显示切换语言选项 */
18
+ showLanguageSwitcher?: boolean;
19
+ /** 切换语言的回调 */
20
+ onLanguageChange?: (language: string) => void;
21
+ /** 是否二维码 */
22
+ showWxQrcode?: boolean;
23
+ /** 自定义 logo */
24
+ logo?: {
25
+ img?: React.ReactNode;
26
+ link?: string;
27
+ };
28
+ siteUrl?: string;
29
+ /** github 仓库地址 */
30
+ githubUrl?: string;
31
+ /** 默认语言 */
32
+ defaultLanguage?: 'zh' | 'en';
33
+ /** 自定义 Link */
34
+ Link?: React.ComponentType<any>;
35
+ /** 底色是否透明 */
36
+ transparent?: boolean;
37
+ /** 是否首页模式 */
38
+ isHomePage?: boolean;
39
+ /** 是否是AntV官网 */
40
+ isAntVSite?: boolean;
41
+ /** AntV root 域名,直接用主题的可不传 */
42
+ rootDomain?: string;
43
+ /** 是否展示国内镜像链接 */
44
+ showChinaMirror?: boolean;
45
+ /** 是否显示 AntV 产品卡片 */
46
+ showAntVProductsCard?: boolean;
47
+ /** 展示版本切换 */
48
+ versions?: {
49
+ [key: string]: string;
50
+ };
51
+ /** 展示周边生态 */
52
+ ecosystems?: Array<{
53
+ name: Record<string /** zh, en */, string>;
54
+ url: string;
55
+ }>;
56
+ /** 头部搜索框配置 */
57
+ searchOptions?: {
58
+ docsearchOptions: {
59
+ versionV3: boolean;
60
+ apiKey: string;
61
+ indexName: string;
62
+ appId: string;
63
+ };
64
+ };
65
+ };
66
+ export declare const Header: React.FC<Partial<HeaderProps>>;