@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
@@ -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>>;