@antv/dumi-theme-antv 0.5.7-beta.1 → 0.5.7-beta.3

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.
@@ -106,5 +106,18 @@ export var useMenu = function useMenu() {
106
106
  var flattedMenuData = useMemo(function () {
107
107
  return flattenMenu(menuData);
108
108
  }, [menuData]);
109
- return [menuData, pathname, flattedMenuData];
109
+ var selectedKey = pathname;
110
+ // 如果当前路径不在菜单中,选中第一个有 link 的菜单项
111
+ if (!flattedMenuData.find(function (item) {
112
+ return item.link === selectedKey;
113
+ })) {
114
+ var firstValidMenuItem = flattedMenuData.find(function (item) {
115
+ return item.link;
116
+ });
117
+ if (firstValidMenuItem) {
118
+ navigate(firstValidMenuItem.link);
119
+ selectedKey = firstValidMenuItem.link;
120
+ }
121
+ }
122
+ return [menuData, selectedKey, flattedMenuData];
110
123
  };
@@ -141,7 +141,7 @@
141
141
  "移动定制(F版)产品": "Mobile (F series) products",
142
142
  "感谢信赖": "WE ARE TRUSTED BY",
143
143
  "更多产品": "More Productions",
144
- "帮助改进此文档": "Edit this page",
144
+ "在 GitHub 上编辑此页": "Edit this page on GitHub",
145
145
  "文档贡献者": "Contributors",
146
146
  "这个页面对你有帮助吗?": "Was this page helpful?",
147
147
  "如果遇到问题或发现某些功能无法正常工作,请通过": "If something is broken or if you need a reply to a problem you've encountered, please ",
@@ -149,7 +149,7 @@
149
149
  "来反馈。否则,团队将无法提供进一步的答复或获取更多信息。": ". Otherwise, the team won't be able to answer back or ask for more information.",
150
150
  "你觉得我们可以如何改进此页面?(可选)": "How can we improve this page? (optional)",
151
151
  "你认为这个页面有哪些做的好的地方?(可选)": "What did you like about this page? (optional)",
152
- "📖 你认为": "How can we improve",
152
+ "你认为": "How can we improve",
153
153
  "部分如何改进更好?": "section? ",
154
154
  "谢谢你的反馈意见!": "Feedback Submitted",
155
155
  "报错了,请稍后再试": "Error, please try again later",
@@ -157,7 +157,7 @@
157
157
  "如果问题持续,请前往 GitHub 提交 issue。": "Go head to GitHub issue if the problem persists.",
158
158
  "你遇到的问题是什么?": "What kind of problem are you facing?",
159
159
  "🚀 留下你的真实感受": "🚀 What is the reason for your feedback?",
160
- "易于理解": "Easy to understand",
160
+ "容易理解": "Easy to understand",
161
161
  "解决了我的问题": "Resolved my problem",
162
162
  "其它": "Other",
163
163
  "缺少我需要的信息": "Missing the information I need",
@@ -42,7 +42,7 @@
42
42
  "api.component.not.found": "未找到 {id} 组件的属性定义",
43
43
  "content.tabs.default": "文档",
44
44
  "content.footer.last.updated": "最后更新时间:",
45
- "content.footer.actions.edit": "帮助改进此文档",
45
+ "content.footer.actions.edit": "在 GitHub 上编辑此页",
46
46
  "content.footer.actions.previous": "上一篇",
47
47
  "content.footer.actions.next": "下一篇",
48
48
  "search.not.found": "未找到相关内容",
@@ -140,7 +140,7 @@
140
140
  "移动定制(F版)产品": "移动定制(F版)产品",
141
141
  "感谢信赖": "感谢信赖",
142
142
  "更多产品": "更多产品",
143
- "帮助改进此文档": "帮助改进此文档",
143
+ "在 GitHub 上编辑此页": "在 GitHub 上编辑此页",
144
144
  "文档贡献者": "文档贡献者",
145
145
  "这个页面对你有帮助吗?": "这个页面对你有帮助吗?",
146
146
  "如果遇到问题或发现某些功能无法正常工作,请通过": "如果遇到问题或发现某些功能无法正常工作,请通过",
@@ -148,7 +148,7 @@
148
148
  "来反馈。否则,团队将无法提供进一步的答复或获取更多信息。": "来反馈。否则,团队将无法提供进一步的答复或获取更多信息。",
149
149
  "你觉得我们可以如何改进此页面?(可选)": "你觉得我们可以如何改进此页面?(可选)",
150
150
  "你认为这个页面有哪些做的好的地方?(可选)": "你认为这个页面有哪些做的好的地方?(可选)",
151
- "📖 你认为": "📖 你认为",
151
+ "你认为": "你认为",
152
152
  "部分如何改进更好?": "部分如何改进更好?",
153
153
  "谢谢你的反馈意见!": "谢谢你的反馈意见!",
154
154
  "报错了,请稍后再试": "报错了,请稍后再试",
@@ -156,7 +156,7 @@
156
156
  "如果问题持续,请前往 GitHub 提交 issue。": "如果问题持续,请前往 GitHub 提交 issue。",
157
157
  "你遇到的问题是什么?": "你遇到的问题是什么?",
158
158
  "🚀 留下你的真实感受": "🚀 留下你的真实感受",
159
- "易于理解": "易于理解",
159
+ "容易理解": "容易理解",
160
160
  "解决了我的问题": "有效解决了我的问题",
161
161
  "其它": "其它",
162
162
  "缺少我需要的信息": "缺少我需要的信息",
@@ -48,7 +48,7 @@ var plugin_default = (api) => {
48
48
  memo.mfsu = false;
49
49
  memo.jsMinifier = "terser";
50
50
  memo.favicons = ["https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*7svFR6wkPMoAAAAAAAAAAAAADmJ7AQ/original"];
51
- memo.extraRemarkPlugins = [import_remarkFeedback.default];
51
+ memo.extraRemarkPlugins = memo.themeConfig.feedback ? [import_remarkFeedback.default] : [];
52
52
  memo.extraRehypePlugins = [import_rehypeObservable.default];
53
53
  return memo;
54
54
  });
@@ -36,7 +36,7 @@ var visit;
36
36
  (async () => {
37
37
  ({ visit } = await import("unist-util-visit"));
38
38
  })();
39
- var icon = '<span role="img" aria-label="edit" class="anticon anticon-edit"><svg viewBox="64 64 896 896" focusable="false" data-icon="edit" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"></path></svg></span>';
39
+ var icon = '<span role="img" aria-label="message" class="anticon anticon-message"><svg viewBox="64 64 896 896" focusable="false" data-icon="message" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M464 512a48 48 0 1096 0 48 48 0 10-96 0zm200 0a48 48 0 1096 0 48 48 0 10-96 0zm-400 0a48 48 0 1096 0 48 48 0 10-96 0zm661.2-173.6c-22.6-53.7-55-101.9-96.3-143.3a444.35 444.35 0 00-143.3-96.3C630.6 75.7 572.2 64 512 64h-2c-60.6.3-119.3 12.3-174.5 35.9a445.35 445.35 0 00-142 96.5c-40.9 41.3-73 89.3-95.2 142.8-23 55.4-34.6 114.3-34.3 174.9A449.4 449.4 0 00112 714v152a46 46 0 0046 46h152.1A449.4 449.4 0 00510 960h2.1c59.9 0 118-11.6 172.7-34.3a444.48 444.48 0 00142.8-95.2c41.3-40.9 73.8-88.7 96.5-142 23.6-55.2 35.6-113.9 35.9-174.5.3-60.9-11.5-120-34.8-175.6zm-151.1 438C704 845.8 611 884 512 884h-1.7c-60.3-.3-120.2-15.3-173.1-43.5l-8.4-4.5H188V695.2l-4.5-8.4C155.3 633.9 140.3 574 140 513.7c-.4-99.7 37.7-193.3 107.6-263.8 69.8-70.5 163.1-109.5 262.8-109.9h1.7c50 0 98.5 9.7 144.2 28.9 44.6 18.7 84.6 45.6 119 80 34.3 34.3 61.3 74.4 80 119 19.4 46.2 29.1 95.2 28.9 145.8-.6 99.6-39.7 192.9-110.1 262.7z"></path></svg></span>';
40
40
  function remarkFeedback() {
41
41
  return (tree) => {
42
42
  visit(tree, "heading", (node) => {
@@ -1,4 +1,4 @@
1
- import { useIntl, useSiteData } from 'dumi';
1
+ import { useIntl, useRouteMeta, useSiteData } from 'dumi';
2
2
  import path from 'path';
3
3
  import React from 'react';
4
4
  import styled from 'styled-components';
@@ -8,19 +8,19 @@ import { ContributorAvatar } from "./ContributorAvatar";
8
8
  var StyledContributorsWrapper = styled.div.withConfig({
9
9
  displayName: "StyledContributorsWrapper",
10
10
  componentId: "dumi-theme-antv-c7ef__sc-11d631u-0"
11
- })(["margin-top:80px;.title{margin-bottom:12px;color:#bfbfbf;font-size:13px;}.list{display:flex;flex-wrap:wrap;clear:both;li{height:24px;transition:all 0.3s;margin-inline-end:-8px;}&:hover{li{margin-inline-end:0;}}}"]);
12
- export var Contributors = function Contributors(_ref) {
13
- var filename = _ref.filename;
11
+ })(["margin-top:80px;.title{margin-bottom:14px;color:#bfbfbf;}.list{display:flex;flex-wrap:wrap;clear:both;li{height:24px;transition:all 0.3s;margin-inline-end:-8px;}&:hover{li{margin-inline-end:0;}}}"]);
12
+ export var Contributors = function Contributors() {
14
13
  var _useIntl = useIntl(),
15
14
  formatMessage = _useIntl.formatMessage;
16
- var _useSiteData$themeCon = useSiteData().themeConfig,
17
- _useSiteData$themeCon2 = _useSiteData$themeCon.branch,
18
- branch = _useSiteData$themeCon2 === void 0 ? 'main' : _useSiteData$themeCon2,
19
- siteRelativePath = _useSiteData$themeCon.siteRelativePath;
15
+ var _useSiteData$themeCon = useSiteData().themeConfig.sitePackagePath,
16
+ sitePackagePath = _useSiteData$themeCon === void 0 ? '/packages/site' : _useSiteData$themeCon;
20
17
  var _useGithubRepo = useGithubRepo(),
21
18
  owner = _useGithubRepo.owner,
22
- repo = _useGithubRepo.repo;
23
- if (!filename) {
19
+ repo = _useGithubRepo.repo,
20
+ defaultBranch = _useGithubRepo.defaultBranch;
21
+ var meta = useRouteMeta();
22
+ var editable = !meta.frontmatter.readonly;
23
+ if (!editable || !meta.frontmatter.filename) {
24
24
  return null;
25
25
  }
26
26
  return /*#__PURE__*/React.createElement(StyledContributorsWrapper, null, /*#__PURE__*/React.createElement("div", {
@@ -31,7 +31,7 @@ export var Contributors = function Contributors(_ref) {
31
31
  cache: true,
32
32
  repo: repo,
33
33
  owner: owner,
34
- fileName: path.join(siteRelativePath, filename),
34
+ fileName: path.join(sitePackagePath, meta.frontmatter.filename),
35
35
  className: "list",
36
36
  renderItem: function renderItem(item, loading) {
37
37
  return /*#__PURE__*/React.createElement(ContributorAvatar, {
@@ -40,6 +40,6 @@ export var Contributors = function Contributors(_ref) {
40
40
  key: item === null || item === void 0 ? void 0 : item.url
41
41
  });
42
42
  },
43
- branch: branch
43
+ branch: defaultBranch
44
44
  }));
45
45
  };
@@ -1,42 +1,37 @@
1
- import { EditOutlined } from '@ant-design/icons';
2
- import { Button } from 'antd';
1
+ import { FormOutlined } from '@ant-design/icons';
3
2
  import { useIntl, useRouteMeta, useSiteData } from 'dumi';
4
3
  import path from 'path';
5
4
  import React from 'react';
6
- import { styled } from 'styled-components';
7
- var StyledWrapper = styled.div.withConfig({
8
- displayName: "StyledWrapper",
9
- componentId: "dumi-theme-antv-c7ef__sc-lci7vy-0"
10
- })([".button{color:rgba(0,0,0,0.65);}"]);
11
- export var EditButton = function EditButton(_ref) {
12
- var style = _ref.style;
5
+ import { useGithubRepo } from "../../utils/github";
6
+ export var EditButton = function EditButton() {
13
7
  var meta = useRouteMeta();
14
8
  var _useIntl = useIntl(),
15
9
  formatMessage = _useIntl.formatMessage;
16
10
  var _useSiteData = useSiteData(),
17
11
  themeConfig = _useSiteData.themeConfig;
18
12
  var githubUrl = themeConfig.githubUrl,
19
- _themeConfig$branch = themeConfig.branch,
20
- branch = _themeConfig$branch === void 0 ? 'main' : _themeConfig$branch,
21
- siteRelativePath = themeConfig.siteRelativePath;
22
- var branchUrl = "".concat(githubUrl, "/edit/").concat(branch);
23
- var url = meta.frontmatter.redirect ? path.join(branchUrl, meta.frontmatter.redirect) : path.join(branchUrl, siteRelativePath, meta.frontmatter.filename || '');
24
- return /*#__PURE__*/React.createElement(StyledWrapper, null, /*#__PURE__*/React.createElement(Button, {
25
- type: "text",
26
- className: "button",
27
- style: style,
28
- icon: /*#__PURE__*/React.createElement(EditOutlined, {
29
- style: {
30
- fontSize: 16,
31
- transform: 'translateY(2px)'
32
- }
33
- }),
13
+ _themeConfig$sitePack = themeConfig.sitePackagePath,
14
+ sitePackagePath = _themeConfig$sitePack === void 0 ? '/packages/site' : _themeConfig$sitePack;
15
+ var _useGithubRepo = useGithubRepo(),
16
+ defaultBranch = _useGithubRepo.defaultBranch;
17
+ var editable = !meta.frontmatter.readonly;
18
+ if (!editable) {
19
+ return null;
20
+ }
21
+ var branchUrl = "".concat(githubUrl, "/edit/").concat(defaultBranch);
22
+ var url = meta.frontmatter.redirect ? path.join(branchUrl, meta.frontmatter.redirect) : path.join(branchUrl, sitePackagePath, meta.frontmatter.filename || '');
23
+ return /*#__PURE__*/React.createElement("a", {
34
24
  onClick: function onClick() {
35
25
  return window.open(url, '_blank');
36
26
  }
37
- }, /*#__PURE__*/React.createElement("span", {
27
+ }, /*#__PURE__*/React.createElement(FormOutlined, {
28
+ style: {
29
+ fontSize: 16,
30
+ marginRight: 8
31
+ }
32
+ }), /*#__PURE__*/React.createElement("span", {
38
33
  className: "button-text"
39
34
  }, formatMessage({
40
- id: '帮助改进此文档'
41
- }))));
35
+ id: '在 GitHub 上编辑此页'
36
+ })));
42
37
  };
@@ -45,7 +45,7 @@ export var SectionFeedbackCommentForm = function SectionFeedbackCommentForm() {
45
45
  var leftQuote = currentLocale === 'zh' ? '「' : '"';
46
46
  var rightQuote = currentLocale === 'zh' ? '」' : '"';
47
47
  return /*#__PURE__*/React.createElement("div", null, formatMessage({
48
- id: '📖 你认为'
48
+ id: '你认为'
49
49
  }), ' ', /*#__PURE__*/React.createElement("b", null, leftQuote, feedbackState.section, rightQuote), ' ', formatMessage({
50
50
  id: '部分如何改进更好?'
51
51
  }));
@@ -1,4 +1,4 @@
1
- import { useRouteMeta } from 'dumi';
1
+ import { useSiteData } from 'dumi';
2
2
  import React from 'react';
3
3
  import { styled } from 'styled-components';
4
4
  import { Contributors } from "./Contributors";
@@ -10,13 +10,11 @@ var StyledWrapper = styled.div.withConfig({
10
10
  componentId: "dumi-theme-antv-c7ef__sc-yubwx0-0"
11
11
  })(["margin-top:40px;"]);
12
12
  export var Feedback = function Feedback() {
13
- var meta = useRouteMeta();
14
- var editable = !meta.frontmatter.readonly;
15
- return /*#__PURE__*/React.createElement(StyledWrapper, null, editable && /*#__PURE__*/React.createElement(EditButton, {
16
- style: {
17
- transform: 'translateX(-12px)'
18
- }
19
- }), editable && /*#__PURE__*/React.createElement(Contributors, {
20
- filename: meta.frontmatter.filename
21
- }), /*#__PURE__*/React.createElement(SectionFeedback, null), /*#__PURE__*/React.createElement(PageFeedback, null));
13
+ var _useSiteData = useSiteData(),
14
+ themeConfig = _useSiteData.themeConfig;
15
+ var feedback = themeConfig.feedback;
16
+ if (!feedback) {
17
+ return null;
18
+ }
19
+ return /*#__PURE__*/React.createElement(StyledWrapper, null, /*#__PURE__*/React.createElement(EditButton, null), /*#__PURE__*/React.createElement(Contributors, null), /*#__PURE__*/React.createElement(SectionFeedback, null), /*#__PURE__*/React.createElement(PageFeedback, null));
22
20
  };
@@ -1,3 +1,9 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
8
  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."); }
3
9
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -6,20 +12,23 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
6
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
13
  import { VerticalAlignTopOutlined } from '@ant-design/icons';
8
14
  import { BackTop, Layout } from 'antd';
9
- import { useRouteMeta } from 'dumi';
15
+ import { useRouteMeta, useSiteData } from 'dumi';
10
16
  import React from 'react';
11
17
  import { useMedia } from 'react-use';
12
18
  import readingTime from 'reading-time';
13
19
  import { useMenu } from "../../hooks/useMenu";
14
20
  import { ContentTable } from "dumi/theme/slots/ContentTable";
15
21
  import { Feedback } from "dumi/theme/slots/Feedback";
22
+ import styles from "./index.module.less";
16
23
  import { PrevAndNext } from "./PrevAndNext";
17
24
  import ReadingTime from "./ReadingTime";
18
- import styles from "./index.module.less";
19
25
  import { usePreview } from "./usePreview";
20
26
  export var Main = function Main(_ref) {
21
27
  var children = _ref.children;
22
28
  var meta = useRouteMeta();
29
+ var _useSiteData = useSiteData(),
30
+ themeConfig = _useSiteData.themeConfig;
31
+ var feedback = themeConfig.feedback;
23
32
  var text = meta.texts.reduce(function (prev, next) {
24
33
  return prev + next.value;
25
34
  }, '');
@@ -45,10 +54,11 @@ export var Main = function Main(_ref) {
45
54
  })), /*#__PURE__*/React.createElement("div", {
46
55
  className: styles.markdown
47
56
  }, children), /*#__PURE__*/React.createElement(Feedback, null), /*#__PURE__*/React.createElement(PrevAndNext, null)), /*#__PURE__*/React.createElement(BackTop, {
48
- style: {
49
- right: 32,
57
+ style: _objectSpread({
58
+ right: 32
59
+ }, feedback && {
50
60
  bottom: 100
51
- }
61
+ })
52
62
  }, /*#__PURE__*/React.createElement("div", {
53
63
  className: styles.backTop
54
64
  }, /*#__PURE__*/React.createElement(VerticalAlignTopOutlined, null)))), showToc && /*#__PURE__*/React.createElement(Layout.Sider, {
@@ -9,6 +9,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
9
9
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
11
  import { useSiteData } from 'dumi';
12
+ import useSWR from 'swr';
12
13
  export var useGithubRepo = function useGithubRepo() {
13
14
  var githubUrl = useSiteData().themeConfig.githubUrl;
14
15
  var regex = /https:\/\/github\.com\/([^\/]+)\/([^\/]+)/;
@@ -16,9 +17,14 @@ export var useGithubRepo = function useGithubRepo() {
16
17
  _githubUrl$match2 = _slicedToArray(_githubUrl$match, 3),
17
18
  owner = _githubUrl$match2[1],
18
19
  repo = _githubUrl$match2[2];
20
+ var _useSWR = useSWR("/repos/".concat(owner, "/").concat(repo), function () {
21
+ return getRepoDetails(owner, repo);
22
+ }),
23
+ details = _useSWR.data;
19
24
  return {
20
25
  owner: owner,
21
- repo: repo
26
+ repo: repo,
27
+ defaultBranch: details === null || details === void 0 ? void 0 : details.default_branch
22
28
  };
23
29
  };
24
30
  export function getLatestVersion(_x, _x2) {
@@ -51,4 +57,35 @@ function _getLatestVersion() {
51
57
  }, _callee, null, [[0, 10]]);
52
58
  }));
53
59
  return _getLatestVersion.apply(this, arguments);
60
+ }
61
+ export function getRepoDetails(_x3, _x4) {
62
+ return _getRepoDetails.apply(this, arguments);
63
+ }
64
+ function _getRepoDetails() {
65
+ _getRepoDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(owner, repo) {
66
+ var response, data;
67
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
68
+ while (1) switch (_context2.prev = _context2.next) {
69
+ case 0:
70
+ _context2.prev = 0;
71
+ _context2.next = 3;
72
+ return fetch("https://api.github.com/repos/".concat(owner, "/").concat(repo));
73
+ case 3:
74
+ response = _context2.sent;
75
+ _context2.next = 6;
76
+ return response.json();
77
+ case 6:
78
+ data = _context2.sent;
79
+ return _context2.abrupt("return", data);
80
+ case 10:
81
+ _context2.prev = 10;
82
+ _context2.t0 = _context2["catch"](0);
83
+ return _context2.abrupt("return", undefined);
84
+ case 13:
85
+ case "end":
86
+ return _context2.stop();
87
+ }
88
+ }, _callee2, null, [[0, 10]]);
89
+ }));
90
+ return _getRepoDetails.apply(this, arguments);
54
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/dumi-theme-antv",
3
- "version": "0.5.7-beta.1",
3
+ "version": "0.5.7-beta.3",
4
4
  "description": "AntV website theme based on dumi2.",
5
5
  "keywords": [
6
6
  "dumi",
@@ -129,8 +129,7 @@
129
129
  "react-dom": ">=16.9.0"
130
130
  },
131
131
  "publishConfig": {
132
- "access": "public",
133
- "tag": "beta"
132
+ "access": "public"
134
133
  },
135
134
  "authors": [
136
135
  "dumi",