@antv/dumi-theme-antv 0.5.7-beta.1 → 0.5.7-beta.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.
- package/dist/hooks/useMenu.js +13 -1
- package/dist/locales/en.json +2 -2
- package/dist/locales/zh.json +3 -3
- package/dist/plugin/remarkFeedback.js +1 -1
- package/dist/slots/Feedback/Contributors.js +7 -6
- package/dist/slots/Feedback/EditButton.js +17 -23
- package/dist/slots/Feedback/SectionFeedbackCommentForm.js +1 -1
- package/dist/slots/Feedback/index.js +8 -10
- package/package.json +2 -3
package/dist/hooks/useMenu.js
CHANGED
|
@@ -106,5 +106,17 @@ export var useMenu = function useMenu() {
|
|
|
106
106
|
var flattedMenuData = useMemo(function () {
|
|
107
107
|
return flattenMenu(menuData);
|
|
108
108
|
}, [menuData]);
|
|
109
|
-
|
|
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
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return [menuData, selectedKey, flattedMenuData];
|
|
110
122
|
};
|
package/dist/locales/en.json
CHANGED
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"移动定制(F版)产品": "Mobile (F series) products",
|
|
142
142
|
"感谢信赖": "WE ARE TRUSTED BY",
|
|
143
143
|
"更多产品": "More Productions",
|
|
144
|
-
"
|
|
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
|
-
"
|
|
152
|
+
"你认为": "How can we improve",
|
|
153
153
|
"部分如何改进更好?": "section? ",
|
|
154
154
|
"谢谢你的反馈意见!": "Feedback Submitted",
|
|
155
155
|
"报错了,请稍后再试": "Error, please try again later",
|
package/dist/locales/zh.json
CHANGED
|
@@ -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
|
"报错了,请稍后再试": "报错了,请稍后再试",
|
|
@@ -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="
|
|
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,9 +8,8 @@ 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:
|
|
12
|
-
export var Contributors = function Contributors(
|
|
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
15
|
var _useSiteData$themeCon = useSiteData().themeConfig,
|
|
@@ -20,7 +19,9 @@ export var Contributors = function Contributors(_ref) {
|
|
|
20
19
|
var _useGithubRepo = useGithubRepo(),
|
|
21
20
|
owner = _useGithubRepo.owner,
|
|
22
21
|
repo = _useGithubRepo.repo;
|
|
23
|
-
|
|
22
|
+
var meta = useRouteMeta();
|
|
23
|
+
var editable = !meta.frontmatter.readonly;
|
|
24
|
+
if (!editable) {
|
|
24
25
|
return null;
|
|
25
26
|
}
|
|
26
27
|
return /*#__PURE__*/React.createElement(StyledContributorsWrapper, null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -31,7 +32,7 @@ export var Contributors = function Contributors(_ref) {
|
|
|
31
32
|
cache: true,
|
|
32
33
|
repo: repo,
|
|
33
34
|
owner: owner,
|
|
34
|
-
fileName: path.join(siteRelativePath, filename),
|
|
35
|
+
fileName: path.join(siteRelativePath, meta.frontmatter.filename),
|
|
35
36
|
className: "list",
|
|
36
37
|
renderItem: function renderItem(item, loading) {
|
|
37
38
|
return /*#__PURE__*/React.createElement(ContributorAvatar, {
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
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
|
+
export var EditButton = function EditButton() {
|
|
13
6
|
var meta = useRouteMeta();
|
|
14
7
|
var _useIntl = useIntl(),
|
|
15
8
|
formatMessage = _useIntl.formatMessage;
|
|
@@ -18,25 +11,26 @@ export var EditButton = function EditButton(_ref) {
|
|
|
18
11
|
var githubUrl = themeConfig.githubUrl,
|
|
19
12
|
_themeConfig$branch = themeConfig.branch,
|
|
20
13
|
branch = _themeConfig$branch === void 0 ? 'main' : _themeConfig$branch,
|
|
21
|
-
|
|
14
|
+
_themeConfig$siteRela = themeConfig.siteRelativePath,
|
|
15
|
+
siteRelativePath = _themeConfig$siteRela === void 0 ? '/packages/site' : _themeConfig$siteRela;
|
|
16
|
+
var editable = !meta.frontmatter.readonly;
|
|
17
|
+
if (!editable) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
22
20
|
var branchUrl = "".concat(githubUrl, "/edit/").concat(branch);
|
|
23
21
|
var url = meta.frontmatter.redirect ? path.join(branchUrl, meta.frontmatter.redirect) : path.join(branchUrl, siteRelativePath, meta.frontmatter.filename || '');
|
|
24
|
-
return /*#__PURE__*/React.createElement(
|
|
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
|
-
}),
|
|
22
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
34
23
|
onClick: function onClick() {
|
|
35
24
|
return window.open(url, '_blank');
|
|
36
25
|
}
|
|
37
|
-
}, /*#__PURE__*/React.createElement(
|
|
26
|
+
}, /*#__PURE__*/React.createElement(FormOutlined, {
|
|
27
|
+
style: {
|
|
28
|
+
fontSize: 16,
|
|
29
|
+
marginRight: 8
|
|
30
|
+
}
|
|
31
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
38
32
|
className: "button-text"
|
|
39
33
|
}, formatMessage({
|
|
40
|
-
id: '
|
|
41
|
-
})))
|
|
34
|
+
id: '在 GitHub 上编辑此页'
|
|
35
|
+
})));
|
|
42
36
|
};
|
|
@@ -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 {
|
|
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
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/dumi-theme-antv",
|
|
3
|
-
"version": "0.5.7-beta.
|
|
3
|
+
"version": "0.5.7-beta.2",
|
|
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",
|