@antv/dumi-theme-antv 0.1.0 → 0.2.2

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 (54) hide show
  1. package/README.md +47 -1
  2. package/es/antv/404/index.d.ts +2 -0
  3. package/es/antv/404/index.js +1 -0
  4. package/es/antv/Banner/Notification.d.ts +10 -0
  5. package/es/antv/Banner/index.d.ts +25 -0
  6. package/es/antv/Banner/index.js +25 -36
  7. package/es/antv/Cases/Cases.d.ts +18 -0
  8. package/es/antv/Cases/Cases.js +1 -3
  9. package/es/antv/Features/FeatureCard.d.ts +8 -0
  10. package/es/antv/Features/index.d.ts +15 -0
  11. package/es/antv/Features/index.js +1 -1
  12. package/es/antv/Footer/index.d.ts +12 -0
  13. package/es/antv/Footer/index.js +22 -17
  14. package/es/antv/Header/Logo.d.ts +4 -0
  15. package/es/antv/Products/Product.d.ts +14 -0
  16. package/es/antv/Products/Product.js +4 -4
  17. package/es/antv/Products/getNewProducts.d.ts +24 -0
  18. package/es/antv/Products/getNewProducts.js +3 -9
  19. package/es/antv/Products/getProducts.d.ts +51 -0
  20. package/es/antv/Products/getProducts.js +3 -9
  21. package/es/antv/Products/index.d.ts +9 -0
  22. package/es/antv/Products/index.js +2 -2
  23. package/es/antv/hooks.d.ts +14 -0
  24. package/es/antv/utils.d.ts +5 -0
  25. package/es/builtins/API.d.ts +3 -0
  26. package/es/builtins/Alert.d.ts +3 -0
  27. package/es/builtins/Alert.js +1 -3
  28. package/es/builtins/Badge.d.ts +3 -0
  29. package/es/builtins/Badge.js +1 -3
  30. package/es/builtins/Example.d.ts +5 -0
  31. package/es/builtins/Previewer.d.ts +39 -0
  32. package/es/builtins/Previewer.js +7 -7
  33. package/es/builtins/SourceCode.d.ts +10 -0
  34. package/es/builtins/SourceCode.js +5 -7
  35. package/es/builtins/Table.d.ts +4 -0
  36. package/es/builtins/Tree.d.ts +4 -0
  37. package/es/builtins/Tree.js +3 -9
  38. package/es/components/Dark.d.ts +9 -0
  39. package/es/components/LocaleSelect.d.ts +6 -0
  40. package/es/components/Navbar.d.ts +10 -0
  41. package/es/components/Navbar.js +3 -3
  42. package/es/components/SearchBar.d.ts +4 -0
  43. package/es/components/SearchBar.js +3 -5
  44. package/es/components/SideMenu.d.ts +10 -0
  45. package/es/components/SideMenu.js +5 -5
  46. package/es/components/SlugList.d.ts +7 -0
  47. package/es/components/SlugList.js +16 -11
  48. package/es/declaration.d.ts +1 -0
  49. package/es/layout.d.ts +5 -0
  50. package/es/layout.js +7 -7
  51. package/package.json +8 -3
  52. package/src/antv/Banner/index.tsx +51 -33
  53. package/src/declaration.d.ts +1 -0
  54. package/src/layout.tsx +1 -1
@@ -0,0 +1,5 @@
1
+ import './Example.less';
2
+ declare const _default: (props: {
3
+ route: any;
4
+ }) => JSX.Element;
5
+ export default _default;
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import type { IPreviewerComponentProps } from 'dumi/theme';
3
+ import './Previewer.less';
4
+ export interface IPreviewerProps extends IPreviewerComponentProps {
5
+ /**
6
+ * enable transform to change CSS containing block for demo
7
+ */
8
+ transform?: boolean;
9
+ /**
10
+ * modify background for demo area
11
+ */
12
+ background?: string;
13
+ /**
14
+ * collapse padding of demo area
15
+ */
16
+ compact?: boolean;
17
+ /**
18
+ * configurations for action button
19
+ */
20
+ hideActions?: ('CSB' | 'EXTERNAL' | 'RIDDLE')[];
21
+ /**
22
+ * show source code by default
23
+ */
24
+ defaultShowCode?: boolean;
25
+ /**
26
+ * use iframe mode for this demo
27
+ */
28
+ iframe?: true | number;
29
+ /**
30
+ * replace builtin demo url
31
+ */
32
+ demoUrl?: string;
33
+ /**
34
+ * control action bar render
35
+ */
36
+ actionBarRender?: (actionBarNode: React.ReactNode) => React.ReactNode;
37
+ }
38
+ declare const Previewer: React.FC<IPreviewerProps>;
39
+ export default Previewer;
@@ -24,10 +24,10 @@ import './Previewer.less';
24
24
  */
25
25
 
26
26
  function getSourceType(file, source) {
27
- var _file$match;
27
+ var _a; // use file extension as source type first
28
28
 
29
- // use file extension as source type first
30
- var type = (_file$match = file.match(/\.(\w+)$/)) === null || _file$match === void 0 ? void 0 : _file$match[1];
29
+
30
+ var type = (_a = file.match(/\.(\w+)$/)) === null || _a === void 0 ? void 0 : _a[1];
31
31
 
32
32
  if (!type) {
33
33
  type = source.tsx ? 'tsx' : 'jsx';
@@ -37,7 +37,7 @@ function getSourceType(file, source) {
37
37
  }
38
38
 
39
39
  var Previewer = function Previewer(oProps) {
40
- var _props$hideActions, _props$hideActions2, _props$hideActions3;
40
+ var _a, _b, _c;
41
41
 
42
42
  var demoRef = useRef();
43
43
 
@@ -49,8 +49,8 @@ var Previewer = function Previewer(oProps) {
49
49
  var demoUrl = props.demoUrl || builtinDemoUrl;
50
50
  var isActive = (history === null || history === void 0 ? void 0 : history.location.hash) === "#".concat(props.identifier);
51
51
  var isSingleFile = Object.keys(props.sources).length === 1;
52
- var openCSB = useCodeSandbox(((_props$hideActions = props.hideActions) === null || _props$hideActions === void 0 ? void 0 : _props$hideActions.includes('CSB')) ? null : props);
53
- var openRiddle = useRiddle(((_props$hideActions2 = props.hideActions) === null || _props$hideActions2 === void 0 ? void 0 : _props$hideActions2.includes('RIDDLE')) ? null : props);
52
+ var openCSB = useCodeSandbox(((_a = props.hideActions) === null || _a === void 0 ? void 0 : _a.includes('CSB')) ? null : props);
53
+ var openRiddle = useRiddle(((_b = props.hideActions) === null || _b === void 0 ? void 0 : _b.includes('RIDDLE')) ? null : props);
54
54
 
55
55
  var _useMotions = useMotions(props.motions || [], demoRef.current),
56
56
  _useMotions2 = _slicedToArray(_useMotions, 2),
@@ -168,7 +168,7 @@ var Previewer = function Previewer(oProps) {
168
168
  onClick: function onClick() {
169
169
  return setIframeKey(Math.random());
170
170
  }
171
- }), !((_props$hideActions3 = props.hideActions) === null || _props$hideActions3 === void 0 ? void 0 : _props$hideActions3.includes('EXTERNAL')) && /*#__PURE__*/React.createElement(Link, {
171
+ }), !((_c = props.hideActions) === null || _c === void 0 ? void 0 : _c.includes('EXTERNAL')) && /*#__PURE__*/React.createElement(Link, {
172
172
  target: "_blank",
173
173
  to: demoUrl
174
174
  }, /*#__PURE__*/React.createElement("button", {
@@ -0,0 +1,10 @@
1
+ import type { Language } from 'prism-react-renderer';
2
+ import 'prismjs/themes/prism.css';
3
+ import './SourceCode.less';
4
+ export interface ICodeBlockProps {
5
+ code: string;
6
+ lang: Language;
7
+ showCopy?: boolean;
8
+ }
9
+ declare const _default: ({ code, lang, showCopy }: ICodeBlockProps) => JSX.Element;
10
+ export default _default;
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
2
 
5
3
  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."); }
@@ -38,7 +36,7 @@ export default (function (_ref) {
38
36
 
39
37
  return /*#__PURE__*/React.createElement("div", {
40
38
  className: "__dumi-default-code-block"
41
- }, /*#__PURE__*/React.createElement(Highlight, _extends({}, defaultProps, {
39
+ }, /*#__PURE__*/React.createElement(Highlight, Object.assign({}, defaultProps, {
42
40
  code: code,
43
41
  language: SIMILAR_DSL[lang] || lang,
44
42
  theme: undefined
@@ -58,14 +56,14 @@ export default (function (_ref) {
58
56
  return copyCode(code);
59
57
  }
60
58
  }), tokens.map(function (line, i) {
61
- return /*#__PURE__*/React.createElement("div", getLineProps({
59
+ return /*#__PURE__*/React.createElement("div", Object.assign({}, getLineProps({
62
60
  line: line,
63
61
  key: i
64
- }), line.map(function (token, key) {
65
- return /*#__PURE__*/React.createElement("span", getTokenProps({
62
+ })), line.map(function (token, key) {
63
+ return /*#__PURE__*/React.createElement("span", Object.assign({}, getTokenProps({
66
64
  token: token,
67
65
  key: key
68
- }));
66
+ })));
69
67
  }));
70
68
  }));
71
69
  }));
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import './Table.less';
3
+ declare const Table: React.FC;
4
+ export default Table;
@@ -0,0 +1,4 @@
1
+ import type { ComponentProps } from 'react';
2
+ import './Tree.less';
3
+ declare const _default: (props: ComponentProps<'div'>) => JSX.Element;
4
+ export default _default;
@@ -1,9 +1,3 @@
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
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
2
 
9
3
  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."); }
@@ -76,13 +70,13 @@ function getTreeFromList(nodes) {
76
70
  var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
77
71
  var data = [];
78
72
  [].concat(nodes).forEach(function (node, i) {
79
- var _data;
73
+ var _a;
80
74
 
81
75
  var key = "".concat(prefix ? "".concat(prefix, "-") : '').concat(i);
82
76
 
83
77
  switch (node.type) {
84
78
  case 'ul':
85
- var parent = ((_data = data[data.length - 1]) === null || _data === void 0 ? void 0 : _data.children) || data;
79
+ var parent = ((_a = data[data.length - 1]) === null || _a === void 0 ? void 0 : _a.children) || data;
86
80
  var ulLeafs = getTreeFromList(node.props.children || [], key);
87
81
  parent.push.apply(parent, _toConsumableArray(ulLeafs));
88
82
  break;
@@ -204,7 +198,7 @@ export default (function (props) {
204
198
  itemHeight: 20,
205
199
  showLine: true,
206
200
  selectable: false,
207
- motion: _objectSpread(_objectSpread({}, collapseMotion), {}, {
201
+ motion: Object.assign(Object.assign({}, collapseMotion), {
208
202
  motionAppear: false
209
203
  }),
210
204
  onClick: onClick,
@@ -0,0 +1,9 @@
1
+ import type { FC } from 'react';
2
+ import './Dark.less';
3
+ interface darkProps {
4
+ darkSwitch: boolean;
5
+ isSideMenu: boolean;
6
+ onDarkSwitchClick?: (ev: any) => void;
7
+ }
8
+ declare const Dark: FC<darkProps>;
9
+ export default Dark;
@@ -0,0 +1,6 @@
1
+ import type { FC } from 'react';
2
+ import './LocaleSelect.less';
3
+ declare const LocaleSelect: FC<{
4
+ location: any;
5
+ }>;
6
+ export default LocaleSelect;
@@ -0,0 +1,10 @@
1
+ import type { FC, MouseEvent } from 'react';
2
+ import React from 'react';
3
+ import './Navbar.less';
4
+ interface INavbarProps {
5
+ location: any;
6
+ navPrefix?: React.ReactNode;
7
+ onMobileMenuClick: (ev: MouseEvent<HTMLButtonElement>) => void;
8
+ }
9
+ declare const Navbar: FC<INavbarProps>;
10
+ export default Navbar;
@@ -116,9 +116,9 @@ var Navbar = function Navbar(_ref) {
116
116
  verticalAlign: 'top'
117
117
  }
118
118
  }, title))), /*#__PURE__*/React.createElement("nav", null, navPrefix, navItems.map(function (nav) {
119
- var _nav$children;
119
+ var _a;
120
120
 
121
- var child = Boolean((_nav$children = nav.children) === null || _nav$children === void 0 ? void 0 : _nav$children.length) && /*#__PURE__*/React.createElement("ul", null, nav.children.map(function (item) {
121
+ var child = Boolean((_a = nav.children) === null || _a === void 0 ? void 0 : _a.length) && /*#__PURE__*/React.createElement("ul", null, nav.children.map(function (item) {
122
122
  return /*#__PURE__*/React.createElement("li", {
123
123
  key: item.path
124
124
  }, /*#__PURE__*/React.createElement(NavLink, {
@@ -131,7 +131,7 @@ var Navbar = function Navbar(_ref) {
131
131
  to: nav.path,
132
132
  key: nav.path
133
133
  }, nav.title) : nav.title, child);
134
- }), /*#__PURE__*/React.createElement("span", productItemProps, "\u6240\u6709\u4EA7\u54C1", /*#__PURE__*/React.createElement("img", {
134
+ }), /*#__PURE__*/React.createElement("span", Object.assign({}, productItemProps), "\u6240\u6709\u4EA7\u54C1", /*#__PURE__*/React.createElement("img", {
135
135
  src: "https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png",
136
136
  alt: "antv logo arrow",
137
137
  className: "arrow ".concat(productMenuVisible && 'open')
@@ -0,0 +1,4 @@
1
+ import './SearchBar.less';
2
+ export declare const highlight: (key: string, title: string) => JSX.Element;
3
+ declare const _default: () => JSX.Element;
4
+ export default _default;
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
2
 
5
3
  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."); }
@@ -55,7 +53,7 @@ export default (function () {
55
53
  }, [result]);
56
54
  return /*#__PURE__*/React.createElement("div", {
57
55
  className: "__dumi-default-search"
58
- }, /*#__PURE__*/React.createElement("input", _extends({
56
+ }, /*#__PURE__*/React.createElement("input", Object.assign({
59
57
  className: "__dumi-default-search-input",
60
58
  type: "search",
61
59
  ref: input
@@ -65,7 +63,7 @@ export default (function () {
65
63
  return setKeywords(ev.target.value);
66
64
  }
67
65
  } : {})), /*#__PURE__*/React.createElement("ul", null, items.length > 0 && items.map(function (meta) {
68
- var _meta$parent;
66
+ var _a;
69
67
 
70
68
  return /*#__PURE__*/React.createElement("li", {
71
69
  key: meta.path,
@@ -74,7 +72,7 @@ export default (function () {
74
72
  }
75
73
  }, /*#__PURE__*/React.createElement(AnchorLink, {
76
74
  to: meta.path
77
- }, ((_meta$parent = meta.parent) === null || _meta$parent === void 0 ? void 0 : _meta$parent.title) && /*#__PURE__*/React.createElement("span", null, meta.parent.title), highlight(keywords, meta.title)));
75
+ }, ((_a = meta.parent) === null || _a === void 0 ? void 0 : _a.title) && /*#__PURE__*/React.createElement("span", null, meta.parent.title), highlight(keywords, meta.title)));
78
76
  }), items.length === 0 && keywords && /*#__PURE__*/React.createElement("li", {
79
77
  style: {
80
78
  textAlign: 'center'
@@ -0,0 +1,10 @@
1
+ import type { FC } from 'react';
2
+ import React from 'react';
3
+ import './SideMenu.less';
4
+ interface INavbarProps {
5
+ mobileMenuCollapsed: boolean;
6
+ location: any;
7
+ darkPrefix?: React.ReactNode;
8
+ }
9
+ declare const SideMenu: FC<INavbarProps>;
10
+ export default SideMenu;
@@ -45,9 +45,9 @@ var SideMenu = function SideMenu(_ref) {
45
45
  }, !!navItems.length && /*#__PURE__*/React.createElement("ul", {
46
46
  className: "__dumi-default-menu-nav-list"
47
47
  }, navItems.map(function (nav) {
48
- var _nav$children;
48
+ var _a;
49
49
 
50
- var child = Boolean((_nav$children = nav.children) === null || _nav$children === void 0 ? void 0 : _nav$children.length) && /*#__PURE__*/React.createElement("ul", null, nav.children.map(function (item) {
50
+ var child = Boolean((_a = nav.children) === null || _a === void 0 ? void 0 : _a.length) && /*#__PURE__*/React.createElement("ul", null, nav.children.map(function (item) {
51
51
  return /*#__PURE__*/React.createElement("li", {
52
52
  key: item.path || item.title
53
53
  }, /*#__PURE__*/React.createElement(NavLink, {
@@ -64,10 +64,10 @@ var SideMenu = function SideMenu(_ref) {
64
64
  }), darkPrefix), /*#__PURE__*/React.createElement("ul", {
65
65
  className: "__dumi-default-menu-list"
66
66
  }, !isHiddenMenus && menu.map(function (item) {
67
- var _meta$slugs;
67
+ var _a; // always use meta from routes to reduce menu data size
68
68
 
69
- // always use meta from routes to reduce menu data size
70
- var hasSlugs = Boolean((_meta$slugs = meta.slugs) === null || _meta$slugs === void 0 ? void 0 : _meta$slugs.length);
69
+
70
+ var hasSlugs = Boolean((_a = meta.slugs) === null || _a === void 0 ? void 0 : _a.length);
71
71
  var hasChildren = item.children && Boolean(item.children.length);
72
72
  var show1LevelSlugs = meta.toc === 'menu' && !hasChildren && hasSlugs && item.path === location.pathname.replace(/([^^])\/$/, '$1');
73
73
  var menuPaths = hasChildren ? item.children.map(function (i) {
@@ -0,0 +1,7 @@
1
+ import type { FC } from 'react';
2
+ import './SlugList.less';
3
+ declare const SlugsList: FC<{
4
+ slugs: any;
5
+ className?: string;
6
+ }>;
7
+ export default SlugsList;
@@ -1,23 +1,28 @@
1
- var _excluded = ["slugs"];
1
+ var __rest = this && this.__rest || function (s, e) {
2
+ var t = {};
2
3
 
3
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ for (var p in s) {
5
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6
+ }
4
7
 
5
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
-
7
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
9
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
8
13
 
9
14
  import React from 'react';
10
15
  import { AnchorLink } from 'dumi/theme';
11
16
  import './SlugList.less';
12
17
 
13
- var SlugsList = function SlugsList(_ref) {
14
- var slugs = _ref.slugs,
15
- props = _objectWithoutProperties(_ref, _excluded);
18
+ var SlugsList = function SlugsList(_a) {
19
+ var slugs = _a.slugs,
20
+ props = __rest(_a, ["slugs"]);
16
21
 
17
- return /*#__PURE__*/React.createElement("ul", _extends({
22
+ return /*#__PURE__*/React.createElement("ul", Object.assign({
18
23
  role: "slug-list"
19
- }, props), slugs.filter(function (_ref2) {
20
- var depth = _ref2.depth;
24
+ }, props), slugs.filter(function (_ref) {
25
+ var depth = _ref.depth;
21
26
  return depth > 1 && depth < 4;
22
27
  }).map(function (slug) {
23
28
  return /*#__PURE__*/React.createElement("li", {
@@ -0,0 +1 @@
1
+ declare module "*.module.less";
package/es/layout.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import type { IRouteComponentProps } from '@umijs/types';
2
+ import React from 'react';
3
+ import './style/layout.less';
4
+ declare const Layout: React.FC<IRouteComponentProps>;
5
+ export default Layout;
package/es/layout.js CHANGED
@@ -118,8 +118,8 @@ var BannerPanel = function BannerPanel(banner) {
118
118
  });
119
119
  return /*#__PURE__*/React.createElement(Banner, {
120
120
  coverImage: coverImage,
121
- title: title // @ts-ignore
122
- ,
121
+ title: title,
122
+ // @ts-ignore
123
123
  description: description,
124
124
  notifications: notifications,
125
125
  buttons: actions,
@@ -147,10 +147,11 @@ var Features = function Features(features) {
147
147
  };
148
148
 
149
149
  var Layout = function Layout(_ref) {
150
- var _meta$slugs, _match;
151
-
152
150
  var children = _ref.children,
153
151
  location = _ref.location;
152
+
153
+ var _a, _b;
154
+
154
155
  var Context = useContext(context);
155
156
  var _Context$config = Context.config,
156
157
  mode = _Context$config.mode,
@@ -161,7 +162,6 @@ var Layout = function Layout(_ref) {
161
162
  meta = _processRedirect.meta,
162
163
  isDirect = _processRedirect.isDirect;
163
164
 
164
- console.log('Context', Context, 'calculate meta', meta);
165
165
  var repoUrl = repository.url,
166
166
  branch = repository.branch,
167
167
  platform = repository.platform;
@@ -178,7 +178,7 @@ var Layout = function Layout(_ref) {
178
178
  var showFeatures = isSiteMode && meta.features;
179
179
  var showIdeas = isSiteMode && meta.ideas;
180
180
  var showSideMenu = meta.sidemenu !== false && !showHero && !showBanner && !showFeatures && !meta.gapless;
181
- var showSlugs = !showHero && !showBanner && !showFeatures && Boolean((_meta$slugs = meta.slugs) === null || _meta$slugs === void 0 ? void 0 : _meta$slugs.length) && (meta.toc === 'content' || meta.toc === undefined) && !meta.gapless;
181
+ var showSlugs = !showHero && !showBanner && !showFeatures && Boolean((_a = meta.slugs) === null || _a === void 0 ? void 0 : _a.length) && (meta.toc === 'content' || meta.toc === undefined) && !meta.gapless;
182
182
  var isCN = /^zh|cn$/i.test(locale); // eslint-disable-next-line @typescript-eslint/no-explicit-any
183
183
 
184
184
  var updatedTime = new Date(meta.updatedTime).toLocaleString([], {
@@ -187,7 +187,7 @@ var Layout = function Layout(_ref) {
187
187
  var repoPlatform = {
188
188
  github: 'GitHub',
189
189
  gitlab: 'GitLab'
190
- }[((_match = (repoUrl || '').match(/(github|gitlab)/)) === null || _match === void 0 ? void 0 : _match[1]) || 'nothing'] || platform; // 等dumi最新版发布后解决路由匹配问题
190
+ }[((_b = (repoUrl || '').match(/(github|gitlab)/)) === null || _b === void 0 ? void 0 : _b[1]) || 'nothing'] || platform; // 等dumi最新版发布后解决路由匹配问题
191
191
 
192
192
  if (isEmpty(meta) && !isDirect) {
193
193
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@antv/dumi-theme-antv",
3
- "version": "0.1.0",
3
+ "version": "0.2.2",
4
4
  "description": "The official antv site theme of dumi",
5
5
  "files": [
6
6
  "es",
7
7
  "src"
8
8
  ],
9
9
  "sideEffects": [
10
- "*.less"
10
+ "*.less",
11
+ "*.module.less",
12
+ "*.css"
11
13
  ],
12
14
  "scripts": {
13
15
  "start": "father build --watch",
@@ -23,6 +25,7 @@
23
25
  "i18next": "^21.6.14",
24
26
  "lodash": "^4.17.21",
25
27
  "lodash.throttle": "^4.1.1",
28
+ "omit.js": "^2.0.2",
26
29
  "parse-github-url": "^1.0.2",
27
30
  "prism-react-renderer": "^1.1.1",
28
31
  "prismjs": "^1.21.0",
@@ -33,7 +36,9 @@
33
36
  "react": "^17.0.1",
34
37
  "react-github-button": "^0.1.11",
35
38
  "react-i18next": "^11.16.2",
36
- "react-use": "^17.3.2"
39
+ "react-slick": "^0.28.1",
40
+ "react-use": "^17.3.2",
41
+ "slick-carousel": "^1.8.1"
37
42
  },
38
43
  "repository": {
39
44
  "type": "git",
@@ -1,16 +1,12 @@
1
- /* eslint-disable react/no-array-index-key */
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- import React, { useContext } from 'react';
4
-
5
- import GitHubButton from 'react-github-button';
6
- import gh from 'parse-github-url';
7
- import classNames from 'classnames';
8
- import { context } from 'dumi/theme';
9
- // @ts-ignore
10
- import styles from './Banner.module.less';
11
- import Notification, { NotificationProps } from './Notification';
12
-
13
- type BannerButtonShape = 'round' | 'square';
1
+ import classNames from "classnames";
2
+ import { context } from "dumi/theme";
3
+ import gh from "parse-github-url";
4
+ import React, { useContext } from "react";
5
+ import GitHubButton from "react-github-button";
6
+ //@ts-ignore
7
+ import styles from "./Banner.module.less";
8
+ import Notification, { NotificationProps } from "./Notification";
9
+ type BannerButtonShape = "round" | "square";
14
10
 
15
11
  interface BannerButton {
16
12
  text: string;
@@ -34,7 +30,8 @@ interface BannerProps {
34
30
  onPlayVideo?: () => void;
35
31
  }
36
32
 
37
- const backLeftBottom = 'https://gw.alipayobjects.com/zos/basement_prod/441d5eaf-e623-47cd-b9b9-2a581d9ce1e3.svg';
33
+ const backLeftBottom =
34
+ "https://gw.alipayobjects.com/zos/basement_prod/441d5eaf-e623-47cd-b9b9-2a581d9ce1e3.svg";
38
35
 
39
36
  const Banner: React.FC<BannerProps> = ({
40
37
  coverImage,
@@ -54,32 +51,34 @@ const Banner: React.FC<BannerProps> = ({
54
51
 
55
52
  const notificationsNode = notifications
56
53
  .slice(0, 2)
57
- .map((notification, i) => <Notification index={i} key={i} {...notification} />);
54
+ .map((notification, i) => (
55
+ <Notification index={i} key={i} {...notification} />
56
+ ));
58
57
 
59
58
  const renderButtons = buttons.map((button: BannerButton, i) => {
60
- const ButtonLink = 'a';
59
+ const ButtonLink = "a";
61
60
  const buttonProps = {} as any;
62
- if (button.link.startsWith('http')) {
63
- buttonProps.target = '_blank';
64
- buttonProps.rel = 'noopener noreferrer';
61
+ if (button.link.startsWith("http")) {
62
+ buttonProps.target = "_blank";
63
+ buttonProps.rel = "noopener noreferrer";
65
64
  }
66
- if (ButtonLink === 'a') {
65
+ if (ButtonLink === "a") {
67
66
  buttonProps.href = button.link;
68
67
  } else {
69
68
  buttonProps.to = button.link;
70
69
  }
71
- const { shape = 'round' } = button;
70
+ const { shape = "round" } = button;
72
71
  return (
73
72
  <ButtonLink
74
73
  {...buttonProps}
75
74
  className={classNames(
76
75
  styles.buttonLink,
77
- styles[button.type || ''],
78
- button.type === 'primary' ? 'primary-button' : 'common-button',
76
+ styles[button.type || ""],
77
+ button.type === "primary" ? "primary-button" : "common-button"
79
78
  )}
80
79
  key={i}
81
80
  style={{
82
- borderRadius: shape === 'round' ? '1000px' : '4px',
81
+ borderRadius: shape === "round" ? "1000px" : "4px",
83
82
  ...button.style,
84
83
  }}
85
84
  >
@@ -94,8 +93,13 @@ const Banner: React.FC<BannerProps> = ({
94
93
  if (githubObj && githubObj.owner && githubObj.name) {
95
94
  renderButtons.push(
96
95
  <div key="github" className={styles.githubWrapper}>
97
- <GitHubButton type="stargazers" size="large" namespace={githubObj.owner} repo={githubObj.name} />
98
- </div>,
96
+ <GitHubButton
97
+ type="stargazers"
98
+ size="large"
99
+ namespace={githubObj.owner}
100
+ repo={githubObj.name}
101
+ />
102
+ </div>
99
103
  );
100
104
  }
101
105
  }
@@ -104,15 +108,29 @@ const Banner: React.FC<BannerProps> = ({
104
108
  <section className={classNames(styles.wrapper, className)} style={style}>
105
109
  <div className={styles.content}>
106
110
  <div className={styles.text}>
107
- <div className={classNames(styles.title, 'banner-title')}>{title}</div>
108
- <div className={classNames(styles.description, 'banner-description')}>{description}</div>
109
- <div className={classNames(styles.buttons, 'banner-buttons')}>{renderButtons}</div>
111
+ <div className={classNames(styles.title, "banner-title")}>
112
+ {title}
113
+ </div>
114
+ <div className={classNames(styles.description, "banner-description")}>
115
+ {description}
116
+ </div>
117
+ <div className={classNames(styles.buttons, "banner-buttons")}>
118
+ {renderButtons}
119
+ </div>
120
+ </div>
121
+ <div className={classNames(styles.notifications, "notifications")}>
122
+ {notificationsNode}
110
123
  </div>
111
- <div className={classNames(styles.notifications, 'notifications')}>{notificationsNode}</div>
112
- <div className={classNames(styles.teaser, 'teaser')}>
113
- <div className={classNames(styles.teaserimg, 'teaser-img')}>{coverImage}</div>
124
+ <div className={classNames(styles.teaser, "teaser")}>
125
+ <div className={classNames(styles.teaserimg, "teaser-img")}>
126
+ {coverImage}
127
+ </div>
114
128
  </div>
115
- <img className={styles.backLeftBottom} src={backLeftBottom} alt="back" />
129
+ <img
130
+ className={styles.backLeftBottom}
131
+ src={backLeftBottom}
132
+ alt="back"
133
+ />
116
134
  </div>
117
135
  </section>
118
136
  );
@@ -0,0 +1 @@
1
+ declare module "*.module.less";
package/src/layout.tsx CHANGED
@@ -15,6 +15,7 @@ import SearchBar from './components/SearchBar';
15
15
  import SideMenu from './components/SideMenu';
16
16
  import SlugList from './components/SlugList';
17
17
  import './style/layout.less';
18
+
18
19
  i18n
19
20
  .use(initReactI18next) // passes i18n down to react-i18next
20
21
  .init({
@@ -120,7 +121,6 @@ const Layout: React.FC<IRouteComponentProps> = ({ children, location }) => {
120
121
  } = Context;
121
122
 
122
123
  const { meta, isDirect } = processRedirect(Context, location);
123
- console.log('Context', Context, 'calculate meta', meta);
124
124
  const { url: repoUrl, branch, platform } = repository;
125
125
  const [menuCollapsed, setMenuCollapsed] = useState<boolean>(true);
126
126
  const isSiteMode = mode === 'site';