@antv/dumi-theme-antv 0.3.0-beta.1 → 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 (61) hide show
  1. package/dist/builtins/Playground/index.d.ts +2 -5
  2. package/dist/builtins/Playground/index.js +17 -3
  3. package/dist/context.d.ts +2 -1
  4. package/dist/layouts/DocLayout.js +26 -16
  5. package/dist/layouts/entry/Index.js +10 -2
  6. package/dist/layouts/entry/Manual.js +1 -2
  7. package/dist/pages/404.js +5 -1
  8. package/dist/pages/Example/index.js +28 -52
  9. package/dist/pages/Example/index.module.less +50 -8
  10. package/dist/pages/Example/utils.d.ts +1 -0
  11. package/dist/pages/Example/utils.js +9 -0
  12. package/dist/pages/Examples/components/GalleryPageContent/DemoCard/index.js +1 -1
  13. package/dist/pages/Examples/index.js +22 -2
  14. package/dist/pages/Examples/index.module.less +2 -0
  15. package/dist/pages/Examples/types.d.ts +7 -6
  16. package/dist/plugin/examples.d.ts +16 -2
  17. package/dist/plugin/examples.js +32 -10
  18. package/dist/plugin/index.js +30 -20
  19. package/dist/plugin/utils.d.ts +5 -0
  20. package/dist/plugin/utils.js +46 -0
  21. package/dist/slots/Cases/index.d.ts +1 -0
  22. package/dist/slots/CodeEditor/Toolbar.js +4 -16
  23. package/dist/slots/CodeEditor/index.js +40 -14
  24. package/dist/slots/CodeEditor/utils.js +1 -1
  25. package/dist/slots/CodePreview/CodeHeader.js +2 -2
  26. package/dist/slots/CodePreview/index.js +1 -1
  27. package/dist/slots/CodePreview/index.module.less +7 -6
  28. package/dist/slots/CodeRunner/index.d.ts +3 -2
  29. package/dist/slots/CodeRunner/index.js +6 -3
  30. package/dist/slots/CodeRunner/utils.d.ts +3 -2
  31. package/dist/slots/CodeRunner/utils.js +1 -1
  32. package/dist/slots/Detail/News.d.ts +1 -0
  33. package/dist/slots/Detail/index.d.ts +1 -0
  34. package/dist/slots/Detail/index.js +1 -1
  35. package/dist/slots/ExampleSider/index.d.ts +4 -38
  36. package/dist/slots/ExampleSider/index.js +22 -44
  37. package/dist/slots/ExampleSider/index.module.less +1 -1
  38. package/dist/slots/Features/FeatureCard.d.ts +1 -0
  39. package/dist/slots/Features/index.js +2 -1
  40. package/dist/slots/Footer/index.js +3 -2
  41. package/dist/slots/Footer/index.module.less +1 -0
  42. package/dist/slots/Header/Navs.d.ts +10 -1
  43. package/dist/slots/Header/Navs.js +35 -18
  44. package/dist/slots/Header/index.js +8 -7
  45. package/dist/slots/Loading/index.d.ts +6 -1
  46. package/dist/slots/Loading/index.js +24 -10
  47. package/dist/slots/Loading/index.module.less +276 -9
  48. package/dist/slots/ManualContent/index.js +136 -113
  49. package/dist/slots/ManualContent/index.module.less +43 -31
  50. package/dist/slots/ManualContent/utils.d.ts +3 -0
  51. package/dist/slots/ManualContent/utils.js +35 -0
  52. package/dist/slots/SEO.d.ts +10 -0
  53. package/dist/slots/SEO.js +59 -0
  54. package/dist/slots/hooks.d.ts +3 -3
  55. package/dist/slots/utils.d.ts +4 -19
  56. package/dist/slots/utils.js +77 -119
  57. package/dist/types.d.ts +83 -0
  58. package/dist/typings.d.ts +0 -113
  59. package/package.json +6 -4
  60. package/dist/slots/Loading.d.ts +0 -5
  61. package/dist/slots/Loading.js +0 -8
@@ -1,11 +1,3 @@
1
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
-
3
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
-
7
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
-
9
1
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
10
2
 
11
3
  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; }
@@ -34,9 +26,12 @@ import { useLocale, useSiteData, useFullSidebarData, useRouteMeta } from 'dumi';
34
26
  import { useNavigate } from "react-router-dom";
35
27
  import { EditOutlined, MenuFoldOutlined, MenuUnfoldOutlined, VerticalAlignTopOutlined } from '@ant-design/icons';
36
28
  import readingTime from 'reading-time';
29
+ import { SEO } from "../SEO";
30
+ import { getBaseRoute, getIndexRoute, getOpenKeys } from "./utils";
37
31
  import { NavigatorBanner } from "./NavigatorBanner";
38
32
  import ReadingTime from "./ReadingTime";
39
33
  import { TOC } from "../TOC";
34
+ import { Footer } from "../Footer";
40
35
  import { useScrollToTop } from "../hooks";
41
36
  import 'rc-drawer/assets/index.css';
42
37
  import styles from "./index.module.less";
@@ -56,14 +51,15 @@ export var ManualContent = function ManualContent(_ref) {
56
51
  docs = _useSiteData$themeCon.docs;
57
52
 
58
53
  var sidebar = useFullSidebarData();
59
- var isWide = useMedia('(min-width: 767.99px)', true);
54
+ var is767Wide = useMedia('(min-width: 767.99px)', true);
55
+ var is991Wide = useMedia('(min-width: 991.99px)', true);
60
56
 
61
57
  var _useState = useState(false),
62
58
  _useState2 = _slicedToArray(_useState, 2),
63
59
  drawOpen = _useState2[0],
64
60
  setDrawOpen = _useState2[1];
65
61
 
66
- var navigate = useNavigate(); // 获取阅读时间
62
+ var navigate = useNavigate(); // 获取阅读时间
67
63
 
68
64
  var mdInfo = useRouteMeta();
69
65
  var text = mdInfo.texts.reduce(function (prev, next) {
@@ -71,132 +67,147 @@ export var ManualContent = function ManualContent(_ref) {
71
67
  }, '');
72
68
 
73
69
  var _readingTime = readingTime(text),
74
- time = _readingTime.time; // menu渲染
75
- // linkoTitle用来映射路由和Title
70
+ time = _readingTime.time; // linkoTitle用来映射路由和Title
76
71
 
77
72
 
78
73
  var linkoTitle = {};
79
74
 
80
- function getBaseRoute() {
81
- var matchRoute = window.location.pathname;
82
- var reg = window.location.pathname.startsWith('/en') ? /(\/[A-z]*\/?\/[A-z]*)\/?/ : /(\/[A-z]*)\/?/;
83
- var mainRoute = matchRoute.match(reg);
84
- return mainRoute[1];
75
+ for (var _i2 = 0, _Object$values = Object.values(sidebar); _i2 < _Object$values.length; _i2++) {
76
+ var route = _Object$values[_i2];
77
+ route[0].children.forEach(function (item) {
78
+ linkoTitle[item.link] = item.title;
79
+ });
85
80
  }
81
+ /**
82
+ * /api/xxx --> /api
83
+ * /en/api --> /en/api
84
+ */
85
+
86
+
87
+ var baseRoute = getBaseRoute(); // 获取最终的 MenuData
88
+
89
+ var renderSidebar = getMenuData(sidebar, docs, baseRoute, []);
90
+
91
+ function getMenuData(funllSidebarData, rootList, hrefId, list) {
92
+ function fullSidebarDataToMenuData(rootList, hrefId, list) {
93
+ // 递归
94
+ rootList.forEach(function (item) {
95
+ var href = !baseRoute.startsWith('/en') ? "/".concat(item.slug) : "/en/".concat(item.slug);
96
+ var id = href.split("/").slice(0, href.split("/").length - 1).join("/");
97
+
98
+ if (href.includes(baseRoute)) {
99
+ if (id === hrefId) {
100
+ list.push(_objectSpread(_objectSpread({}, item), {}, {
101
+ key: href,
102
+ label: item.title[currentLocale]
103
+ }));
104
+ }
105
+ }
106
+ });
86
107
 
87
- var baseRoute = getBaseRoute();
88
-
89
- function fullSidebarDataToMenuData(rootList, hrefId, list) {
90
- // 递归
91
- rootList.forEach(function (item) {
92
- var href = !baseRoute.startsWith('/en') ? "/".concat(item.slug) : "/en/".concat(item.slug);
93
- var id = href.split("/").slice(0, href.split("/").length - 1).join("/");
94
-
95
- if (href.includes(baseRoute)) {
96
- if (id === hrefId) {
97
- list.push(_objectSpread(_objectSpread({}, item), {}, {
98
- key: href,
99
- label: item.title[currentLocale]
100
- }));
108
+ var _iterator = _createForOfIteratorHelper(list),
109
+ _step;
110
+
111
+ try {
112
+ var _loop = function _loop() {
113
+ var _funllSidebarData$ite;
114
+
115
+ var item = _step.value;
116
+ item.children = [];
117
+ fullSidebarDataToMenuData(rootList, item.key, item.children);
118
+ (_funllSidebarData$ite = funllSidebarData[item.key][0].children) === null || _funllSidebarData$ite === void 0 ? void 0 : _funllSidebarData$ite.forEach(function (itemChild) {
119
+ var label = itemChild.title;
120
+ var key = itemChild.link;
121
+ item.children.push(_objectSpread(_objectSpread({}, itemChild), {}, {
122
+ label: label,
123
+ key: key
124
+ }));
125
+ });
126
+
127
+ if (item.children.length == 0) {
128
+ delete item.children;
129
+ }
130
+ };
131
+
132
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
133
+ _loop();
101
134
  }
135
+ } catch (err) {
136
+ _iterator.e(err);
137
+ } finally {
138
+ _iterator.f();
102
139
  }
103
- });
104
-
105
- var _iterator = _createForOfIteratorHelper(list),
106
- _step;
107
140
 
108
- try {
109
- var _loop = function _loop() {
110
- var _sidebar$item$key$0$c;
141
+ if (hrefId == baseRoute) {
142
+ var _funllSidebarData$bas;
111
143
 
112
- var item = _step.value;
113
- item.children = [];
114
- fullSidebarDataToMenuData(rootList, item.key, item.children);
115
- (_sidebar$item$key$0$c = sidebar[item.key][0].children) === null || _sidebar$item$key$0$c === void 0 ? void 0 : _sidebar$item$key$0$c.forEach(function (itemChild) {
116
- var label = itemChild.title;
144
+ funllSidebarData[baseRoute] && ((_funllSidebarData$bas = funllSidebarData[baseRoute][0].children) === null || _funllSidebarData$bas === void 0 ? void 0 : _funllSidebarData$bas.forEach(function (itemChild) {
117
145
  var key = itemChild.link;
118
- item.children.push(_objectSpread(_objectSpread({}, itemChild), {}, {
146
+ var label = itemChild.title;
147
+ list.push(_objectSpread(_objectSpread({}, itemChild), {}, {
119
148
  label: label,
120
149
  key: key
121
150
  }));
122
- linkoTitle[key] = label;
151
+ }));
152
+ list.sort(function (a, b) {
153
+ return a.order - b.order;
123
154
  });
124
-
125
- if (item.children.length == 0) {
126
- delete item.children;
127
- }
128
- };
129
-
130
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
131
- _loop();
155
+ return list;
132
156
  }
133
- } catch (err) {
134
- _iterator.e(err);
135
- } finally {
136
- _iterator.f();
137
- }
138
-
139
- if (hrefId == baseRoute) {
140
- var _sidebar$baseRoute$0$;
141
-
142
- sidebar[baseRoute] && ((_sidebar$baseRoute$0$ = sidebar[baseRoute][0].children) === null || _sidebar$baseRoute$0$ === void 0 ? void 0 : _sidebar$baseRoute$0$.forEach(function (itemChild) {
143
- var label = itemChild.title;
144
- list.push(_objectSpread(_objectSpread({}, itemChild), {}, {
145
- label: label,
146
- key: itemChild.link
147
- }));
148
- }));
149
- list.sort(function (a, b) {
150
- return a.order - b.order;
151
- });
152
- return list;
153
157
  }
154
- } // 获取最终的MenuData
155
-
156
158
 
157
- var renderSidebar = fullSidebarDataToMenuData(docs, baseRoute, []); // 获取默认打开的菜单栏
159
+ return fullSidebarDataToMenuData(rootList, hrefId, list);
160
+ } // 获取打开的菜单栏
158
161
 
159
- function getDefaultOpenKeys(MenuData) {
160
- var defaultOpenKeys = [];
161
- var topRoute = MenuData[0];
162
- defaultOpenKeys.push(topRoute.key);
163
162
 
164
- while (topRoute.children) {
165
- topRoute = topRoute.children[0];
166
- defaultOpenKeys.push(topRoute.key);
167
- }
163
+ var _useState3 = useState(function () {
164
+ return getOpenKeys();
165
+ }),
166
+ _useState4 = _slicedToArray(_useState3, 2),
167
+ defaultOpenKeys = _useState4[0],
168
+ setDefaultOpenKeys = _useState4[1]; // 获取第一个md文件的路由
168
169
 
169
- return defaultOpenKeys;
170
- }
171
170
 
172
- var defaultOpenKeys = getDefaultOpenKeys(renderSidebar); // 点击菜单栏
171
+ var indexRoute = getIndexRoute(renderSidebar); // 点击菜单栏
173
172
 
174
173
  var onClick = function onClick(e) {
175
174
  navigate(e.key);
176
175
  useScrollToTop();
177
176
  };
178
177
 
179
- var _useState3 = useState([renderSidebar[0].key]),
180
- _useState4 = _slicedToArray(_useState3, 2),
181
- defaultSelectedKey = _useState4[0],
182
- setDefaultSelectedKey = _useState4[1]; //上一夜下一页
183
-
184
-
185
- var _useState5 = useState(undefined),
178
+ var _useState5 = useState(renderSidebar.length !== 0 ? [renderSidebar[0].key] : ['']),
186
179
  _useState6 = _slicedToArray(_useState5, 2),
187
- prev = _useState6[0],
188
- setPrev = _useState6[1];
180
+ defaultSelectedKey = _useState6[0],
181
+ setDefaultSelectedKey = _useState6[1]; //上一夜下一页
182
+
189
183
 
190
184
  var _useState7 = useState(undefined),
191
185
  _useState8 = _slicedToArray(_useState7, 2),
192
- next = _useState8[0],
193
- setNext = _useState8[1]; // 监听路由去改变selected menu-item
186
+ prev = _useState8[0],
187
+ setPrev = _useState8[1];
188
+
189
+ var _useState9 = useState(undefined),
190
+ _useState10 = _slicedToArray(_useState9, 2),
191
+ next = _useState10[0],
192
+ setNext = _useState10[1]; // 所有的 sidebar 路由
193
+
194
+
195
+ var sidebarRoutes = [];
196
+
197
+ for (var _i3 = 0, _Object$keys = Object.keys(linkoTitle); _i3 < _Object$keys.length; _i3++) {
198
+ var route = _Object$keys[_i3];
199
+ sidebarRoutes.push(route);
200
+ } // 兜底 如果 nav 指定有误则自动重定向到 indexDocRoute
201
+
202
+
203
+ if (window.location.pathname.startsWith('/docs/') || !sidebarRoutes.includes(window.location.pathname)) {
204
+ navigate(indexRoute);
205
+ } // 改变菜单栏选中和 openKeys 状态
194
206
 
195
207
 
196
208
  useEffect(function () {
197
- if (window.location.pathname == baseRoute) {
198
- navigate(renderSidebar[0].key);
199
- return;
209
+ if (window.location.pathname == indexRoute) {
210
+ setDefaultOpenKeys(getOpenKeys());
200
211
  }
201
212
 
202
213
  setDefaultSelectedKey([window.location.pathname]);
@@ -240,18 +251,24 @@ export var ManualContent = function ManualContent(_ref) {
240
251
 
241
252
  var menu = /*#__PURE__*/React.createElement(Menu, {
242
253
  onClick: onClick,
243
- defaultSelectedKeys: defaultSelectedKey,
254
+ onOpenChange: function onOpenChange(openKeys) {
255
+ setDefaultOpenKeys(openKeys);
256
+ },
244
257
  selectedKeys: defaultSelectedKey,
245
- defaultOpenKeys: _toConsumableArray(defaultOpenKeys),
258
+ openKeys: defaultOpenKeys,
246
259
  mode: "inline",
247
260
  items: renderSidebar,
248
261
  inlineIndent: 16,
249
262
  style: {
250
263
  height: '100%'
251
264
  },
252
- forceSubMenuRender: true
265
+ forceSubMenuRender: true,
266
+ triggerSubMenuAction: "click"
253
267
  });
254
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Layout, {
268
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SEO, {
269
+ title: linkoTitle[window.location.pathname],
270
+ lang: locale.id
271
+ }), /*#__PURE__*/React.createElement(Layout, {
255
272
  style: {
256
273
  background: '#fff'
257
274
  },
@@ -261,9 +278,9 @@ export var ManualContent = function ManualContent(_ref) {
261
278
  offsetTop: 0,
262
279
  className: styles.affix,
263
280
  style: {
264
- height: isWide ? '100vh' : 'inherit'
281
+ height: is767Wide ? '100vh' : 'inherit'
265
282
  }
266
- }, isWide ? /*#__PURE__*/React.createElement(Layout.Sider, {
283
+ }, is767Wide ? /*#__PURE__*/React.createElement(Layout.Sider, {
267
284
  width: "auto",
268
285
  theme: "light",
269
286
  className: styles.sider
@@ -281,8 +298,10 @@ export var ManualContent = function ManualContent(_ref) {
281
298
  }, menu)), /*#__PURE__*/React.createElement(Layout.Content, {
282
299
  className: styles.content
283
300
  }, /*#__PURE__*/React.createElement("div", {
284
- className: styles.contentMain
285
- }, /*#__PURE__*/React.createElement("h1", null, linkoTitle[window.location.pathname], /*#__PURE__*/React.createElement(Tooltip, {
301
+ className: styles.main
302
+ }, /*#__PURE__*/React.createElement("h1", {
303
+ className: styles.contentTitle
304
+ }, linkoTitle[window.location.pathname], /*#__PURE__*/React.createElement(Tooltip, {
286
305
  title: '在 GitHub 上编辑'
287
306
  }, /*#__PURE__*/React.createElement("a", {
288
307
  href: getGithubSourceUrl({
@@ -293,10 +312,12 @@ export var ManualContent = function ManualContent(_ref) {
293
312
  target: "_blank",
294
313
  rel: "noopener noreferrer",
295
314
  className: styles.editOnGtiHubButton
296
- }, /*#__PURE__*/React.createElement(EditOutlined, null)))), /*#__PURE__*/React.createElement(ReadingTime, {
315
+ }, /*#__PURE__*/React.createElement(EditOutlined, null)))), /*#__PURE__*/React.createElement("div", {
316
+ className: styles.readtimeContainer
317
+ }, /*#__PURE__*/React.createElement(ReadingTime, {
297
318
  readingTime: time,
298
319
  className: styles.readtime
299
- }), /*#__PURE__*/React.createElement("div", {
320
+ })), /*#__PURE__*/React.createElement("div", {
300
321
  className: styles.markdown
301
322
  }, children), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
302
323
  className: styles.preandnext
@@ -312,10 +333,12 @@ export var ManualContent = function ManualContent(_ref) {
312
333
  }
313
334
  }, /*#__PURE__*/React.createElement("div", {
314
335
  className: styles.backTop
315
- }, /*#__PURE__*/React.createElement(VerticalAlignTopOutlined, null))))))), /*#__PURE__*/React.createElement(Layout.Sider, {
336
+ }, /*#__PURE__*/React.createElement(VerticalAlignTopOutlined, null)))))), /*#__PURE__*/React.createElement(Footer, {
337
+ className: styles.footer
338
+ })), is991Wide ? /*#__PURE__*/React.createElement(Layout.Sider, {
316
339
  theme: "light",
317
340
  width: 260
318
341
  }, /*#__PURE__*/React.createElement(Affix, {
319
342
  className: styles.toc
320
- }, /*#__PURE__*/React.createElement(TOC, null)))));
343
+ }, /*#__PURE__*/React.createElement(TOC, null))) : /*#__PURE__*/React.createElement("div", null)));
321
344
  };
@@ -203,10 +203,11 @@
203
203
  }
204
204
 
205
205
  .main {
206
- width: calc(100% - @toc-width);
206
+ width: 100%;
207
207
  padding-left: 48px;
208
208
  padding-right: 24px;
209
209
  overflow: hidden;
210
+ min-height: 760px; // 大概一屏幕占位,防止切换文档的时候,有黑影!
210
211
 
211
212
  .meta {
212
213
  margin-bottom: 1.2em;
@@ -236,21 +237,39 @@
236
237
 
237
238
  // reference yuque UI
238
239
  .toc {
239
- :global {
240
- .dumi-default-toc {
241
- > li {
242
- > a {
243
- font-size: 12px;
244
-
245
- &.active {
246
- border-left: 1px solid @primary-color !important;
247
- }
248
- }
249
- }
240
+ width: @toc-width;
241
+ float: right;
242
+ font-size: 12px;
243
+ background: #fff;
244
+ max-height: 100vh;
245
+ overflow: scroll;
246
+
247
+ position: sticky;
248
+ top: 0;
249
+
250
+ ul>li {
251
+ list-style: none !important;
252
+ padding: 0 !important;
253
+ margin-left: 1em !important;
254
+
255
+ // 超出部分省略号显示
256
+ text-overflow: ellipsis;
257
+ overflow: hidden;
258
+ white-space: nowrap;
259
+
260
+ a {
261
+ color: @text-color;
250
262
  }
251
263
  }
252
264
  }
253
-
265
+ .contentTitle{
266
+ margin-top: 8px;
267
+ margin-bottom: 20px;
268
+ font-weight: 500;
269
+ font-size: 30px;
270
+ font-family: Avenir, -apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
271
+ line-height: 38px;
272
+ }
254
273
  .sider {
255
274
  width: 280px !important;
256
275
  height: inherit;
@@ -460,16 +479,11 @@
460
479
  padding-left: 32px;
461
480
  padding-right: 32px;
462
481
  }
463
-
464
- .toc {
465
- display: none;
466
- }
467
482
  }
468
-
469
- .sider {
470
- width: 240px !important;
483
+ .tocSiderbar {
484
+ display: none;
471
485
  }
472
-
486
+
473
487
  .gallery {
474
488
  .galleryCard {
475
489
  width: 50%;
@@ -487,11 +501,9 @@
487
501
  }
488
502
 
489
503
  .sider {
490
- width: 100% !important;
491
504
  margin-bottom: 32px;
492
505
  padding-bottom: 32px;
493
506
  border-bottom: 1px solid #e8e8e8;
494
- display: none;
495
507
  }
496
508
 
497
509
  .markdown {
@@ -596,19 +608,17 @@
596
608
  margin-bottom: 20px;
597
609
  font-weight: 500;
598
610
  font-size: 30px;
599
- font-family: Avenir, -apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
600
611
  line-height: 38px;
601
612
  }
602
613
 
603
614
  .content {
604
- display: flex;
605
- justify-content: center;
615
+ width: 100% !important;
606
616
  min-width: 400px;
617
+ justify-content: center;
618
+ }
607
619
 
608
- .contentMain {
609
- width: 100%;
610
- padding: 0 24px 0 48px;
611
- }
620
+ .footer {
621
+ width: 100%;
612
622
  }
613
623
 
614
624
  .menuSwitch {
@@ -632,8 +642,10 @@
632
642
 
633
643
 
634
644
 
635
- .readtime {
645
+ .readtimeContainer{
636
646
  margin-bottom: 1.2em;
647
+ }
648
+ .readtime {
637
649
  color: #0d1a26;
638
650
  line-height: 1.5715;
639
651
  list-style: none;
@@ -0,0 +1,3 @@
1
+ export declare function getOpenKeys(): any[];
2
+ export declare function getBaseRoute(): string;
3
+ export declare function getIndexRoute(MenuData: any): any;
@@ -0,0 +1,35 @@
1
+ export function getOpenKeys() {
2
+ var pathname = window.location.pathname;
3
+ var pathArr = pathname.split('/');
4
+ var openKeys = [];
5
+
6
+ for (var i = pathArr.length; i > 0; i--) {
7
+ var tem = pathArr.slice(0, i);
8
+ openKeys.push(tem.join('/'));
9
+ }
10
+
11
+ return openKeys;
12
+ }
13
+ export function getBaseRoute() {
14
+ var matchRoute = window.location.pathname; // 兼容 zh
15
+
16
+ matchRoute = matchRoute.replace('/zh/', '/'); // 兼容带有docs的route
17
+
18
+ matchRoute = matchRoute.replace('/docs', ''); // 查找 baseRoute
19
+
20
+ var reg = window.location.pathname.startsWith('/en') ? /(\/[A-z]*\/?\/[A-z]*)\/?/ : /(\/[A-z]*)\/?/;
21
+ var mainRoute = matchRoute.match(reg);
22
+ return mainRoute[1];
23
+ }
24
+ export function getIndexRoute(MenuData) {
25
+ var defaultOpenKeys = [];
26
+ var topRoute = MenuData[0];
27
+ defaultOpenKeys.push(topRoute.key);
28
+
29
+ while (topRoute.children) {
30
+ topRoute = topRoute.children[0];
31
+ defaultOpenKeys.push(topRoute.key);
32
+ }
33
+
34
+ return defaultOpenKeys[defaultOpenKeys.length - 1];
35
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface SEOProps {
3
+ description?: string;
4
+ lang?: string;
5
+ meta?: any[];
6
+ title?: string;
7
+ titleSuffix?: string;
8
+ }
9
+ export declare const SEO: React.FC<SEOProps>;
10
+ export {};
@@ -0,0 +1,59 @@
1
+ import { useSiteData } from 'dumi';
2
+ import React from 'react';
3
+ import { Helmet } from 'react-helmet';
4
+ export var SEO = function SEO(_ref) {
5
+ var description = _ref.description,
6
+ _ref$lang = _ref.lang,
7
+ lang = _ref$lang === void 0 ? '' : _ref$lang,
8
+ _ref$meta = _ref.meta,
9
+ meta = _ref$meta === void 0 ? [] : _ref$meta,
10
+ title = _ref.title,
11
+ titleSuffix = _ref.titleSuffix;
12
+
13
+ var _useSiteData = useSiteData(),
14
+ themeConfig = _useSiteData.themeConfig;
15
+
16
+ var defaultTitle = themeConfig.title,
17
+ defaultDescription = themeConfig.defaultDescription;
18
+ var metaDescription = description || defaultDescription;
19
+ return /*#__PURE__*/React.createElement(Helmet, {
20
+ htmlAttributes: {
21
+ lang: lang
22
+ },
23
+ title: title,
24
+ titleTemplate: "%s | ".concat(titleSuffix || defaultTitle),
25
+ meta: [{
26
+ name: "description",
27
+ content: metaDescription
28
+ }, {
29
+ property: "og:title",
30
+ content: title
31
+ }, {
32
+ property: "og:description",
33
+ content: metaDescription
34
+ }, {
35
+ property: "og:image",
36
+ content: 'https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png'
37
+ }, {
38
+ property: "og:type",
39
+ content: "website"
40
+ }, {
41
+ name: "twitter:card",
42
+ content: "summary"
43
+ }, {
44
+ name: "twitter:title",
45
+ content: title
46
+ }, {
47
+ name: "twitter:description",
48
+ content: metaDescription
49
+ }, {
50
+ property: "twitter:image",
51
+ content: 'https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png'
52
+ }].concat(meta)
53
+ });
54
+ };
55
+ SEO.defaultProps = {
56
+ lang: "zh",
57
+ meta: [],
58
+ description: ""
59
+ };
@@ -3,9 +3,9 @@ export declare const useChinaMirrorHost: () => [boolean];
3
3
  export declare const useScrollToTop: () => void;
4
4
  export declare const useT: (transformedMessage: string) => string;
5
5
  export declare const useLogoLink: ({ link, siteUrl, lang, }: {
6
- link?: string | undefined;
7
- siteUrl?: string | undefined;
8
- lang?: string | undefined;
6
+ link?: string;
7
+ siteUrl?: string;
8
+ lang?: string;
9
9
  }) => [string];
10
10
  export declare const usePrevAndNext: () => NavigatorBannerProps['post'][];
11
11
  /**
@@ -1,20 +1,5 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- /// <reference types="node" />
5
- /// <reference types="lodash" />
6
- declare type Status = 'responded' | 'error' | 'timeout';
7
- export declare const ping: (callback: (status: Status) => void) => NodeJS.Timeout;
1
+ import { Status, TreeNode } from '../types';
2
+ export declare function ping(): Promise<Status>;
8
3
  export declare const getChinaMirrorHost: (host?: string) => string;
9
- export declare function getGithubSourceUrl(githubUrl: string, relativePath: string, prefix?: string): string;
10
- export declare const getAllDemosInCategory: (allDemos: any[], lang: string) => import("lodash").Dictionary<any[]>;
11
- export declare const getSortedCategories: (allDemosInCategory: any, locale: string) => string[];
12
- export declare const getGroupedEdges: (edges: any) => import("lodash").Dictionary<any[]>;
13
- export declare const getGroupedEdgesDataEdit: (examples: any, edges: any, local: string) => string[];
14
- export declare const getTreeDataByExamplesAndEdges: (examples: any, edges: any, locale: string) => {
15
- title: any;
16
- value: string;
17
- icon: any;
18
- children: any[];
19
- }[];
20
- export {};
4
+ export declare function getGithubSourceURL(githubUrl: string, relativePath: string, prefix?: string): string;
5
+ export declare const filterTreeNode: (treeNode: TreeNode, keyValue: string, locale: string) => TreeNode;