@antv/dumi-theme-antv 0.3.0-beta.13 → 0.3.0-beta.15

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 (38) hide show
  1. package/dist/builtins/Playground/index.js +1 -1
  2. package/dist/layouts/entry/Index.js +11 -10
  3. package/dist/layouts/entry/Manual.js +3 -3
  4. package/dist/pages/404.js +4 -4
  5. package/dist/pages/Example/index.js +4 -4
  6. package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +5 -3
  7. package/dist/pages/Examples/index.js +3 -3
  8. package/dist/pages/Examples/index.module.less +6 -0
  9. package/dist/slots/Article/index.d.ts +3 -0
  10. package/dist/slots/Article/index.js +11 -0
  11. package/dist/slots/Article/index.module.less +8 -0
  12. package/dist/slots/Banner/Notification.d.ts +10 -0
  13. package/dist/slots/Banner/Notification.js +43 -0
  14. package/dist/slots/Banner/Notification.module.less +120 -0
  15. package/dist/slots/Banner/index.d.ts +26 -0
  16. package/dist/slots/Banner/index.js +184 -0
  17. package/dist/slots/Banner/index.module.less +449 -0
  18. package/dist/slots/Cases/index.js +8 -4
  19. package/dist/slots/CodeEditor/Toolbar.js +13 -6
  20. package/dist/slots/CodeEditor/index.js +1 -1
  21. package/dist/slots/CodePreview/CodeHeader.js +1 -1
  22. package/dist/slots/CodePreview/index.js +4 -2
  23. package/dist/slots/CodeRunner/index.js +5 -4
  24. package/dist/slots/Companies/index.d.ts +1 -1
  25. package/dist/slots/ExampleSider/index.js +7 -4
  26. package/dist/slots/Footer/index.js +31 -12
  27. package/dist/slots/Header/LogoWhite.js +1 -2
  28. package/dist/slots/Header/Products/NavigatorBanner.js +4 -3
  29. package/dist/slots/Header/Products/Product.js +7 -3
  30. package/dist/slots/Header/Products/index.js +5 -3
  31. package/dist/slots/Header/Search.js +5 -3
  32. package/dist/slots/Header/index.js +14 -6
  33. package/dist/slots/ManualContent/NavigatorBanner.js +5 -3
  34. package/dist/slots/ManualContent/ReadingTime.js +6 -2
  35. package/dist/slots/ManualContent/index.js +3 -3
  36. package/dist/slots/hooks.d.ts +0 -1
  37. package/dist/slots/hooks.js +1 -7
  38. package/package.json +3 -2
@@ -13,8 +13,7 @@ import { default as RCFooter } from 'rc-footer';
13
13
  import { GithubOutlined, WeiboOutlined, ZhihuOutlined, QuestionCircleOutlined } from '@ant-design/icons';
14
14
  import { omit } from 'lodash-es';
15
15
  import classnames from 'classnames';
16
- import { useLocale } from 'dumi';
17
- import { useT } from "../hooks";
16
+ import { useLocale, FormattedMessage } from 'dumi';
18
17
  import 'rc-footer/assets/index.less';
19
18
  import styles from "./index.module.less";
20
19
 
@@ -51,33 +50,45 @@ export var Footer = function Footer(props) {
51
50
  openExternal: true
52
51
  }, {
53
52
  title: 'Umi',
54
- description: useT('React 应用开发框架'),
53
+ description: /*#__PURE__*/React.createElement(FormattedMessage, {
54
+ id: "React \u5E94\u7528\u5F00\u53D1\u6846\u67B6"
55
+ }),
55
56
  url: 'https://umijs.org',
56
57
  openExternal: true
57
58
  }, {
58
59
  title: 'Dumi',
59
- description: useT('组件/文档研发工具'),
60
+ description: /*#__PURE__*/React.createElement(FormattedMessage, {
61
+ id: "\u7EC4\u4EF6/\u6587\u6863\u7814\u53D1\u5DE5\u5177"
62
+ }),
60
63
  url: 'https://d.umijs.org',
61
64
  openExternal: true
62
65
  }, {
63
66
  title: 'ahooks',
64
- description: useT('React Hooks 库'),
67
+ description: /*#__PURE__*/React.createElement(FormattedMessage, {
68
+ id: "React Hooks \u5E93"
69
+ }),
65
70
  url: 'https://github.com/alibaba/hooks',
66
71
  openExternal: true
67
72
  }, {
68
- title: useT('国内镜像'),
73
+ title: /*#__PURE__*/React.createElement(FormattedMessage, {
74
+ id: "\u56FD\u5185\u955C\u50CF"
75
+ }),
69
76
  url: 'https://antv.antgroup.com/'
70
77
  }]
71
78
  };
72
79
  var col2 = {
73
- title: useT('社区'),
80
+ title: /*#__PURE__*/React.createElement(FormattedMessage, {
81
+ id: "\u793E\u533A"
82
+ }),
74
83
  items: [{
75
84
  icon: /*#__PURE__*/React.createElement(ZhihuOutlined, {
76
85
  style: {
77
86
  color: '#0084ff'
78
87
  }
79
88
  }),
80
- title: useT('体验科技专栏'),
89
+ title: /*#__PURE__*/React.createElement(FormattedMessage, {
90
+ id: "\u4F53\u9A8C\u79D1\u6280\u4E13\u680F"
91
+ }),
81
92
  url: 'http://zhuanlan.zhihu.com/xtech',
82
93
  openExternal: true
83
94
  }, {
@@ -86,13 +97,17 @@ export var Footer = function Footer(props) {
86
97
  alt: "seeconf"
87
98
  }),
88
99
  title: 'SEE Conf',
89
- description: useT('蚂蚁体验科技大会'),
100
+ description: /*#__PURE__*/React.createElement(FormattedMessage, {
101
+ id: "\u8682\u8681\u4F53\u9A8C\u79D1\u6280\u5927\u4F1A"
102
+ }),
90
103
  url: 'https://seeconf.antfin.com/',
91
104
  openExternal: true
92
105
  }]
93
106
  };
94
107
  var col3 = {
95
- title: useT('帮助'),
108
+ title: /*#__PURE__*/React.createElement(FormattedMessage, {
109
+ id: "\u5E2E\u52A9"
110
+ }),
96
111
  items: [{
97
112
  icon: /*#__PURE__*/React.createElement(GithubOutlined, null),
98
113
  title: 'GitHub',
@@ -100,7 +115,9 @@ export var Footer = function Footer(props) {
100
115
  openExternal: true
101
116
  }, {
102
117
  icon: /*#__PURE__*/React.createElement(QuestionCircleOutlined, null),
103
- title: useT('StackOverflow'),
118
+ title: /*#__PURE__*/React.createElement(FormattedMessage, {
119
+ id: "StackOverflow"
120
+ }),
104
121
  url: 'http://stackoverflow.com/questions/tagged/antv',
105
122
  openExternal: true
106
123
  }]
@@ -181,7 +198,9 @@ export var Footer = function Footer(props) {
181
198
  rel: "noopener noreferrer"
182
199
  }, /*#__PURE__*/React.createElement(GithubOutlined, null)), /*#__PURE__*/React.createElement("a", {
183
200
  href: "".concat(rootDomain, "/").concat(lang, "/about")
184
- }, useT('关于我们'))), /*#__PURE__*/React.createElement("div", null, "\xA9 ", new Date().getFullYear(), " Made with \u2764 by", ' ', /*#__PURE__*/React.createElement("a", {
201
+ }, /*#__PURE__*/React.createElement(FormattedMessage, {
202
+ id: "\u5173\u4E8E\u6211\u4EEC"
203
+ }))), /*#__PURE__*/React.createElement("div", null, "\xA9 ", new Date().getFullYear(), " Made with \u2764 by", ' ', /*#__PURE__*/React.createElement("a", {
185
204
  href: "https://xtech.antfin.com/"
186
205
  }, "AntV"))))
187
206
  }, omit(restProps, ['githubUrl'])));
@@ -6,8 +6,7 @@ import React from 'react';
6
6
  export var LogoWhite = function LogoWhite(_ref) {
7
7
  var style = _ref.style;
8
8
  return /*#__PURE__*/React.createElement("svg", {
9
- viewBox: "0 0 94 28",
10
- style: style,
9
+ viewBox: "0 0 3313 1024",
11
10
  version: "1.1",
12
11
  xmlns: "http://www.w3.org/2000/svg",
13
12
  width: "94",
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
2
  import classNames from 'classnames';
3
- import { Link } from 'dumi';
3
+ import { Link, FormattedMessage } from 'dumi';
4
4
  import styles from "./NavigatorBanner.module.less";
5
- import { useT } from "../../hooks";
6
5
 
7
6
  var NavigatorBanner = function NavigatorBanner(_ref) {
8
7
  var post = _ref.post,
@@ -26,7 +25,9 @@ var NavigatorBanner = function NavigatorBanner(_ref) {
26
25
  className: classNames(styles.button, styles[type])
27
26
  }, /*#__PURE__*/React.createElement("div", {
28
27
  className: styles.label
29
- }, useT(type === 'prev' ? '上一篇' : '下一篇')), /*#__PURE__*/React.createElement("div", {
28
+ }, /*#__PURE__*/React.createElement(FormattedMessage, {
29
+ id: type === 'prev' ? '上一篇' : '下一篇'
30
+ })), /*#__PURE__*/React.createElement("div", {
30
31
  className: styles.title
31
32
  }, title));
32
33
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { useT } from "../../hooks";
2
+ import { FormattedMessage } from 'dumi';
3
3
  import styles from "./Product.module.less";
4
4
 
5
5
  var getTarget = function getTarget(url) {
@@ -46,11 +46,15 @@ var Product = function Product(_ref) {
46
46
  href: links.home.url,
47
47
  target: getTarget(links.home.url || ''),
48
48
  key: links.home.url
49
- }, (_links$home$title = links.home.title) !== null && _links$home$title !== void 0 ? _links$home$title : useT('产品首页')), links.example && /*#__PURE__*/React.createElement("a", {
49
+ }, (_links$home$title = links.home.title) !== null && _links$home$title !== void 0 ? _links$home$title : /*#__PURE__*/React.createElement(FormattedMessage, {
50
+ id: "\u4EA7\u54C1\u9996\u9875"
51
+ })), links.example && /*#__PURE__*/React.createElement("a", {
50
52
  href: links.example.url,
51
53
  target: getTarget(links.example.url || ''),
52
54
  key: links.example.url
53
- }, (_links$example$title = links.example.title) !== null && _links$example$title !== void 0 ? _links$example$title : useT('图表示例')))));
55
+ }, (_links$example$title = links.example.title) !== null && _links$example$title !== void 0 ? _links$example$title : /*#__PURE__*/React.createElement(FormattedMessage, {
56
+ id: "\u56FE\u8868\u793A\u4F8B"
57
+ })))));
54
58
  };
55
59
 
56
60
  export default Product;
@@ -14,11 +14,11 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
14
 
15
15
  import React from 'react';
16
16
  import cx from 'classnames';
17
+ import { useLocale, FormattedMessage } from 'dumi';
17
18
  import Product from "./Product";
18
19
  import { CATEGORIES, getNewProducts } from "./getProducts";
19
- import { useChinaMirrorHost, useT } from "../../hooks";
20
+ import { useChinaMirrorHost } from "../../hooks";
20
21
  import styles from "./Product.module.less";
21
- import { useLocale } from 'dumi';
22
22
  export var Products = function Products(_ref) {
23
23
  var show = _ref.show,
24
24
  language = _ref.language,
@@ -52,7 +52,9 @@ export var Products = function Products(_ref) {
52
52
  type = _ref2.type;
53
53
  return /*#__PURE__*/React.createElement(React.Fragment, {
54
54
  key: idx
55
- }, /*#__PURE__*/React.createElement("h3", null, useT(name)), /*#__PURE__*/React.createElement("ul", null, products.filter(function (item) {
55
+ }, /*#__PURE__*/React.createElement("h3", null, /*#__PURE__*/React.createElement(FormattedMessage, {
56
+ id: name
57
+ })), /*#__PURE__*/React.createElement("ul", null, products.filter(function (item) {
56
58
  return item.category === type;
57
59
  }).map(function (product) {
58
60
  var _product$links, _product$links$home;
@@ -1,8 +1,7 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import { SearchOutlined } from '@ant-design/icons';
3
3
  import { DocSearch } from '@docsearch/react';
4
- import { useLocale } from 'dumi';
5
- import { useT } from "../hooks";
4
+ import { useLocale, useIntl } from 'dumi';
6
5
  import '@docsearch/css';
7
6
  import styles from "./Search.module.less";
8
7
  import 'docsearch.js/dist/cdn/docsearch.min.css';
@@ -49,6 +48,7 @@ function initDocSearchV2(_ref) {
49
48
  export var Search = function Search(_ref3) {
50
49
  var docsearchOptions = _ref3.docsearchOptions;
51
50
  var locale = useLocale();
51
+ var intl = useIntl();
52
52
 
53
53
  var _ref4 = docsearchOptions || {},
54
54
  _ref4$apiKey = _ref4.apiKey,
@@ -85,6 +85,8 @@ export var Search = function Search(_ref3) {
85
85
  }), /*#__PURE__*/React.createElement("input", {
86
86
  className: styles.input,
87
87
  id: "search",
88
- placeholder: useT('搜索…')
88
+ placeholder: intl.formatMessage({
89
+ id: '搜索…'
90
+ })
89
91
  })));
90
92
  };
@@ -21,7 +21,7 @@ import React, { useState, useEffect } from 'react';
21
21
  import { useMedia } from 'react-use';
22
22
  import { useNavigate } from "react-router-dom";
23
23
  import cx from 'classnames';
24
- import { useSiteData, useLocale } from 'dumi';
24
+ import { useSiteData, useLocale, FormattedMessage } from 'dumi';
25
25
  import { GithubOutlined, MenuOutlined, CaretDownFilled, DownOutlined, WechatOutlined, LinkOutlined, CheckOutlined } from '@ant-design/icons';
26
26
  import { Modal, Button, Popover, Menu, Dropdown, Select } from 'antd';
27
27
  import { get, map, size } from 'lodash-es';
@@ -31,7 +31,7 @@ import { Navs } from "./Navs";
31
31
  import { Logo } from "./Logo";
32
32
  import { LogoWhite } from "./LogoWhite";
33
33
  import { getLangUrl } from "./utils";
34
- import { ic, useT } from "../hooks";
34
+ import { ic } from "../hooks";
35
35
  import styles from "./index.module.less";
36
36
 
37
37
  function redirectChinaMirror(chinaMirrorOrigin) {
@@ -213,7 +213,9 @@ var HeaderComponent = function HeaderComponent(_ref) {
213
213
  href: url
214
214
  }, ecosystemName === null || ecosystemName === void 0 ? void 0 : ecosystemName[lang], " ", /*#__PURE__*/React.createElement(LinkOutlined, null)));
215
215
  }))
216
- }, /*#__PURE__*/React.createElement("span", null, useT('周边生态'), /*#__PURE__*/React.createElement(DownOutlined, {
216
+ }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(FormattedMessage, {
217
+ id: "\u5468\u8FB9\u751F\u6001"
218
+ }), /*#__PURE__*/React.createElement(DownOutlined, {
217
219
  style: {
218
220
  marginLeft: '6px'
219
221
  }
@@ -291,7 +293,9 @@ var HeaderComponent = function HeaderComponent(_ref) {
291
293
  className: styles.remindHref
292
294
  }, ic(get(internalSite, 'name')), /*#__PURE__*/React.createElement(LinkOutlined, null)), /*#__PURE__*/React.createElement("span", null, " \u7AD9\u70B9\u3002"))),
293
295
  /** 产品列表 */
294
- showAntVProductsCard && /*#__PURE__*/React.createElement("li", productItemProps, /*#__PURE__*/React.createElement("a", null, useT('所有产品'), !isAntVHome ? /*#__PURE__*/React.createElement("img", {
296
+ showAntVProductsCard && /*#__PURE__*/React.createElement("li", productItemProps, /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(FormattedMessage, {
297
+ id: "\u6240\u6709\u4EA7\u54C1"
298
+ }), !isAntVHome ? /*#__PURE__*/React.createElement("img", {
295
299
  src: "https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png",
296
300
  alt: "antv logo arrow",
297
301
  className: cx(styles.arrow, _defineProperty({}, styles.open, productMenuVisible))
@@ -417,7 +421,7 @@ var HeaderComponent = function HeaderComponent(_ref) {
417
421
  className: styles.left
418
422
  }, /*#__PURE__*/React.createElement("h1", null, /*#__PURE__*/React.createElement("a", {
419
423
  href: siteUrl
420
- }, img)), subTitle && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
424
+ }, img)), !isAntVHome && subTitle && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
421
425
  className: styles.divider
422
426
  }), /*#__PURE__*/React.createElement("h2", {
423
427
  className: styles.subProduceName
@@ -452,6 +456,9 @@ export var Header = function Header(props) {
452
456
  var searchOptions = {
453
457
  docsearchOptions: docsearchOptions
454
458
  };
459
+ var locale = useLocale();
460
+ var path = window.location.pathname;
461
+ var isHomePage = path === '/' || path === "/".concat(locale.id) || path === "/".concat(locale.id, "/");
455
462
  var headerProps = {
456
463
  subTitle: title,
457
464
  subTitleHref: subTitleHref,
@@ -470,7 +477,8 @@ export var Header = function Header(props) {
470
477
  ecosystems: ecosystems,
471
478
  navs: navs,
472
479
  searchOptions: searchOptions,
473
- isHomePage: true
480
+ isHomePage: isHomePage,
481
+ transparent: isHomePage && isAntVSite
474
482
  };
475
483
  return /*#__PURE__*/React.createElement(HeaderComponent, Object.assign({}, headerProps, props));
476
484
  };
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import classNames from 'classnames';
3
- import { history } from 'dumi';
3
+ import { history, FormattedMessage } from 'dumi';
4
4
  import styles from "./NavigatorBanner.module.less";
5
- import { useScrollToTop, useT } from "../hooks";
5
+ import { useScrollToTop } from "../hooks";
6
6
  export var NavigatorBanner = function NavigatorBanner(_ref) {
7
7
  var post = _ref.post,
8
8
  type = _ref.type;
@@ -30,7 +30,9 @@ export var NavigatorBanner = function NavigatorBanner(_ref) {
30
30
  onClick: go
31
31
  }, /*#__PURE__*/React.createElement("div", {
32
32
  className: styles.label
33
- }, useT(type === 'prev' ? '上一篇' : '下一篇')), /*#__PURE__*/React.createElement("div", {
33
+ }, /*#__PURE__*/React.createElement(FormattedMessage, {
34
+ id: type === 'prev' ? '上一篇' : '下一篇'
35
+ })), /*#__PURE__*/React.createElement("div", {
34
36
  className: styles.title
35
37
  }, title));
36
38
  };
@@ -1,10 +1,14 @@
1
1
  import React from 'react';
2
2
  import { Tag } from 'antd';
3
- import { useT } from "../hooks";
3
+ import { FormattedMessage } from 'dumi';
4
4
 
5
5
  var ReadingTime = function ReadingTime(_ref) {
6
6
  var readingTime = _ref.readingTime;
7
- return /*#__PURE__*/React.createElement(Tag, null, "".concat(useT('阅读时间约'), " ").concat(Math.ceil(readingTime / 60000), " ").concat(useT('分钟')));
7
+ return /*#__PURE__*/React.createElement(Tag, null, /*#__PURE__*/React.createElement(FormattedMessage, {
8
+ id: "\u9605\u8BFB\u65F6\u95F4\u7EA6"
9
+ }), " ", Math.ceil(readingTime / 60000), " ", /*#__PURE__*/React.createElement(FormattedMessage, {
10
+ id: "\u5206\u949F"
11
+ }));
8
12
  };
9
13
 
10
14
  export default ReadingTime;
@@ -27,11 +27,11 @@ import { useNavigate } from "react-router-dom";
27
27
  import { EditOutlined, MenuFoldOutlined, MenuUnfoldOutlined, VerticalAlignTopOutlined } from '@ant-design/icons';
28
28
  import readingTime from 'reading-time';
29
29
  import URI from 'uri-parse';
30
- import { SEO } from "../SEO";
30
+ import { SEO } from "dumi/theme/slots/SEO";
31
31
  import { getBaseRoute, getIndexRoute, getOpenKeys, getNavigateUrl } from "./utils";
32
32
  import { NavigatorBanner } from "./NavigatorBanner";
33
33
  import ReadingTime from "./ReadingTime";
34
- import { TOC } from "../TOC";
34
+ import { TOC } from "dumi/theme/slots/TOC";
35
35
  import { useScrollToTop } from "../hooks";
36
36
  import 'rc-drawer/assets/index.css';
37
37
  import styles from "./index.module.less";
@@ -92,7 +92,7 @@ export var ManualContent = function ManualContent(_ref) {
92
92
  function fullSidebarDataToMenuData(rootList, hrefId, list) {
93
93
  // 递归
94
94
  rootList.forEach(function (item) {
95
- var href = !baseRoute.startsWith('/en') ? "/".concat(item.slug) : "/en/".concat(item.slug);
95
+ var href = (!baseRoute.startsWith('/en') ? "/".concat(item.slug) : "/en/".concat(item.slug)).toLocaleLowerCase();
96
96
  var id = href.split("/").slice(0, href.split("/").length - 1).join("/");
97
97
 
98
98
  if (href.includes(baseRoute)) {
@@ -1,7 +1,6 @@
1
1
  import { NavigatorBannerProps } from './ManualContent/NavigatorBanner';
2
2
  export declare const useChinaMirrorHost: () => [boolean];
3
3
  export declare const useScrollToTop: () => void;
4
- export declare const useT: (transformedMessage: string) => string;
5
4
  export declare const useLogoLink: ({ link, siteUrl, lang, }: {
6
5
  link?: string;
7
6
  siteUrl?: string;
@@ -14,7 +14,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
14
 
15
15
  import { useEffect, useState } from 'react';
16
16
  import { get } from 'lodash-es';
17
- import { useIntl, useLocale } from 'dumi';
17
+ import { useLocale } from 'dumi';
18
18
  export var useChinaMirrorHost = function useChinaMirrorHost() {
19
19
  var _useState = useState(false),
20
20
  _useState2 = _slicedToArray(_useState, 2),
@@ -31,12 +31,6 @@ export var useChinaMirrorHost = function useChinaMirrorHost() {
31
31
  export var useScrollToTop = function useScrollToTop() {
32
32
  document.body.scrollTop = document.documentElement.scrollTop = 0;
33
33
  };
34
- export var useT = function useT(transformedMessage) {
35
- var intl = useIntl();
36
- return intl.formatMessage({
37
- id: transformedMessage
38
- });
39
- };
40
34
  export var useLogoLink = function useLogoLink(_ref) {
41
35
  var _ref$link = _ref.link,
42
36
  link = _ref$link === void 0 ? '' : _ref$link,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/dumi-theme-antv",
3
- "version": "0.3.0-beta.13",
3
+ "version": "0.3.0-beta.15",
4
4
  "description": "AntV website theme based on dumi2.",
5
5
  "types": "dist/types.d.ts",
6
6
  "scripts": {
@@ -85,7 +85,8 @@
85
85
  "reading-time": "^1.5.0",
86
86
  "size-sensor": "^1.0.1",
87
87
  "slick-carousel": "^1.8.1",
88
- "uri-parse": "^1.0.0"
88
+ "uri-parse": "^1.0.0",
89
+ "video-react": "^0.16.0"
89
90
  },
90
91
  "peerDependencies": {
91
92
  "dumi": "^2.0.0-beta.15",