@antv/dumi-theme-antv 0.5.5 → 0.5.7-beta.0
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/common/AvatarList.js +123 -0
- package/dist/locales/en.json +17 -0
- package/dist/locales/zh.json +17 -0
- package/dist/model/feedback.js +19 -0
- package/dist/plugin/antVReactTechStack.js +101 -0
- package/dist/plugin/index.js +4 -0
- package/dist/plugin/remarkFeedback.js +52 -0
- package/dist/slots/Feedback/ContributorAvatar.js +42 -0
- package/dist/slots/Feedback/Contributors.js +45 -0
- package/dist/slots/Feedback/EditButton.js +42 -0
- package/dist/slots/Feedback/FeedbackMessage.js +234 -0
- package/dist/slots/Feedback/VoteButtons.js +52 -0
- package/dist/slots/Feedback/index.js +26 -0
- package/dist/slots/Feedback/service.js +27 -0
- package/dist/slots/Header/index.js +10 -4
- package/dist/slots/ManualContent/Main.js +7 -38
- package/dist/slots/ManualContent/PrevAndNext.js +48 -0
- package/dist/slots/_.less +26 -6
- package/dist/utils/github.js +54 -0
- package/package.json +9 -2
|
@@ -0,0 +1,123 @@
|
|
|
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); }
|
|
7
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
8
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
|
+
/**
|
|
11
|
+
* Github Contributors Avatar List
|
|
12
|
+
*/
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import useSWR from 'swr';
|
|
15
|
+
// 获取头像列表
|
|
16
|
+
var getAvatarList = /*#__PURE__*/function () {
|
|
17
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
18
|
+
var fileName, repo, owner, branch, url, data;
|
|
19
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
20
|
+
while (1) switch (_context.prev = _context.next) {
|
|
21
|
+
case 0:
|
|
22
|
+
fileName = _ref.fileName, repo = _ref.repo, owner = _ref.owner, branch = _ref.branch;
|
|
23
|
+
url = "https://proapi.azurewebsites.net/doc/getAvatarList?filename=".concat(fileName, "&owner=").concat(owner, "&repo=").concat(repo, "&branch=").concat(branch);
|
|
24
|
+
_context.next = 4;
|
|
25
|
+
return fetch(url, {
|
|
26
|
+
mode: 'cors'
|
|
27
|
+
}).then(function (res) {
|
|
28
|
+
return res.json();
|
|
29
|
+
}).catch(function (e) {
|
|
30
|
+
return console.log(e);
|
|
31
|
+
});
|
|
32
|
+
case 4:
|
|
33
|
+
data = _context.sent;
|
|
34
|
+
if (data) {
|
|
35
|
+
_context.next = 7;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
return _context.abrupt("return", []);
|
|
39
|
+
case 7:
|
|
40
|
+
return _context.abrupt("return", data);
|
|
41
|
+
case 8:
|
|
42
|
+
case "end":
|
|
43
|
+
return _context.stop();
|
|
44
|
+
}
|
|
45
|
+
}, _callee);
|
|
46
|
+
}));
|
|
47
|
+
return function getAvatarList(_x) {
|
|
48
|
+
return _ref2.apply(this, arguments);
|
|
49
|
+
};
|
|
50
|
+
}();
|
|
51
|
+
var AvatarList = function AvatarList(_ref3) {
|
|
52
|
+
var className = _ref3.className,
|
|
53
|
+
renderItem = _ref3.renderItem,
|
|
54
|
+
repo = _ref3.repo,
|
|
55
|
+
owner = _ref3.owner,
|
|
56
|
+
style = _ref3.style,
|
|
57
|
+
fileName = _ref3.fileName,
|
|
58
|
+
_ref3$filter = _ref3.filter,
|
|
59
|
+
filter = _ref3$filter === void 0 ? function () {
|
|
60
|
+
return true;
|
|
61
|
+
} : _ref3$filter,
|
|
62
|
+
emptyRender = _ref3.emptyRender,
|
|
63
|
+
_ref3$branch = _ref3.branch,
|
|
64
|
+
branch = _ref3$branch === void 0 ? 'master' : _ref3$branch;
|
|
65
|
+
var _useSWR = useSWR("/doc/getAvatarList?filename=".concat(fileName, "&owner=").concat(owner, "&repo=").concat(repo, "&branch=").concat(branch), function () {
|
|
66
|
+
return getAvatarList({
|
|
67
|
+
owner: owner,
|
|
68
|
+
repo: repo,
|
|
69
|
+
fileName: fileName,
|
|
70
|
+
branch: branch
|
|
71
|
+
});
|
|
72
|
+
}),
|
|
73
|
+
data = _useSWR.data,
|
|
74
|
+
isLoading = _useSWR.isLoading;
|
|
75
|
+
if (isLoading) {
|
|
76
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
className: className,
|
|
78
|
+
style: _objectSpread({
|
|
79
|
+
display: 'flex',
|
|
80
|
+
listStyle: 'none',
|
|
81
|
+
margin: 0,
|
|
82
|
+
padding: 0
|
|
83
|
+
}, style)
|
|
84
|
+
}, renderItem && renderItem({}, true) || /*#__PURE__*/React.createElement("span", null, "loading"));
|
|
85
|
+
}
|
|
86
|
+
var displayList = (data === null || data === void 0 ? void 0 : data.filter(filter)) || [];
|
|
87
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("ul", {
|
|
88
|
+
className: className,
|
|
89
|
+
style: _objectSpread({
|
|
90
|
+
display: 'flex',
|
|
91
|
+
boxSizing: 'border-box',
|
|
92
|
+
listStyle: 'none',
|
|
93
|
+
margin: 0,
|
|
94
|
+
padding: 0,
|
|
95
|
+
flexFlow: 'wrap'
|
|
96
|
+
}, style)
|
|
97
|
+
}, displayList.map(function (item) {
|
|
98
|
+
if (renderItem) {
|
|
99
|
+
return renderItem(item, isLoading);
|
|
100
|
+
}
|
|
101
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
102
|
+
key: item.username,
|
|
103
|
+
style: {
|
|
104
|
+
marginRight: 8,
|
|
105
|
+
borderRadius: 20,
|
|
106
|
+
boxSizing: 'border-box',
|
|
107
|
+
overflow: 'hidden',
|
|
108
|
+
border: '1px solid #ddd',
|
|
109
|
+
display: 'flex'
|
|
110
|
+
}
|
|
111
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
112
|
+
href: "https://github.com/".concat(item.username),
|
|
113
|
+
style: {
|
|
114
|
+
display: 'flex'
|
|
115
|
+
}
|
|
116
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
117
|
+
width: 40,
|
|
118
|
+
src: item.url,
|
|
119
|
+
alt: item.username
|
|
120
|
+
})));
|
|
121
|
+
}), displayList.length === 0 && emptyRender && emptyRender(fileName, owner, repo, branch)));
|
|
122
|
+
};
|
|
123
|
+
export default AvatarList;
|
package/dist/locales/en.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
+
"yes": "Yes",
|
|
3
|
+
"no": "No",
|
|
2
4
|
"header.search.placeholder": "Type keywords...",
|
|
3
5
|
"header.color.mode.light": "Light Mode",
|
|
4
6
|
"header.color.mode.dark": "Dark Mode",
|
|
@@ -120,6 +122,7 @@
|
|
|
120
122
|
"在 StackBlitz 中打开": "Open in StackBlitz",
|
|
121
123
|
"HTML 代码": "Html Source Code",
|
|
122
124
|
"取消": "Cancel",
|
|
125
|
+
"提交": "Submit",
|
|
123
126
|
"关于我们": "About us",
|
|
124
127
|
"返回旧版": "Old site",
|
|
125
128
|
"查看详情": "More",
|
|
@@ -138,6 +141,20 @@
|
|
|
138
141
|
"移动定制(F版)产品": "Mobile (F series) products",
|
|
139
142
|
"感谢信赖": "WE ARE TRUSTED BY",
|
|
140
143
|
"更多产品": "More Productions",
|
|
144
|
+
"帮助改进此文档": "Edit this page",
|
|
145
|
+
"文档贡献者": "Contributors",
|
|
146
|
+
"此文档有帮助吗?": "Was this page helpful?",
|
|
147
|
+
"如果遇到问题或发现某些功能无法正常工作,请通过": "If something is broken or if you need a reply to a problem you've encountered, please ",
|
|
148
|
+
"提交问题报告": "open an issue instead",
|
|
149
|
+
"来反馈。否则,团队将无法提供进一步的答复或获取更多信息。": ". Otherwise, the team won't be able to answer back or ask for more information.",
|
|
150
|
+
"你觉得我们可以如何改进此页面?(可选)": "How can we improve this page? (optional)",
|
|
151
|
+
"你认为这个页面有哪些做的好的地方?(可选)": "What did you like about this page? (optional)",
|
|
152
|
+
"你认为该": "How can we improve",
|
|
153
|
+
"部分如何改进更好?(可选)": "section? (optional)",
|
|
154
|
+
"反馈已提交": "Feedback Submitted",
|
|
155
|
+
"报错了,请稍后再试": "Error, please try again later",
|
|
156
|
+
"我们会尽快处理你的反馈,感谢你的支持!": "Thank you for your feedback! We will process it as soon as possible.",
|
|
157
|
+
"如果问题持续,请前往 GitHub 提交 issue。": "Go head to GitHub issue if the problem persists.",
|
|
141
158
|
"上一篇": "Previous",
|
|
142
159
|
"下一篇": "Next",
|
|
143
160
|
"演示代码报错,请检查": "演示代码报错,请检查",
|
package/dist/locales/zh.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
+
"yes": "是",
|
|
3
|
+
"no": "否",
|
|
2
4
|
"header.search.placeholder": "输入关键字搜索...",
|
|
3
5
|
"header.color.mode.light": "亮色模式",
|
|
4
6
|
"header.color.mode.dark": "暗色模式",
|
|
@@ -119,6 +121,7 @@
|
|
|
119
121
|
"在 StackBlitz 中打开": "在 StackBlitz 中打开",
|
|
120
122
|
"HTML 代码": "HTML 代码",
|
|
121
123
|
"取消": "取消",
|
|
124
|
+
"提交": "提交",
|
|
122
125
|
"关于我们": "关于我们",
|
|
123
126
|
"返回旧版": "返回旧版",
|
|
124
127
|
"查看详情": "查看详情",
|
|
@@ -137,6 +140,20 @@
|
|
|
137
140
|
"移动定制(F版)产品": "移动定制(F版)产品",
|
|
138
141
|
"感谢信赖": "感谢信赖",
|
|
139
142
|
"更多产品": "更多产品",
|
|
143
|
+
"帮助改进此文档": "帮助改进此文档",
|
|
144
|
+
"文档贡献者": "文档贡献者",
|
|
145
|
+
"此文档有帮助吗?": "此文档有帮助吗?",
|
|
146
|
+
"如果遇到问题或发现某些功能无法正常工作,请通过": "如果遇到问题或发现某些功能无法正常工作,请通过",
|
|
147
|
+
"提交问题报告": "提交问题报告",
|
|
148
|
+
"来反馈。否则,团队将无法提供进一步的答复或获取更多信息。": "来反馈。否则,团队将无法提供进一步的答复或获取更多信息。",
|
|
149
|
+
"你觉得我们可以如何改进此页面?(可选)": "你觉得我们可以如何改进此页面?(可选)",
|
|
150
|
+
"你认为这个页面有哪些做的好的地方?(可选)": "你认为这个页面有哪些做的好的地方?(可选)",
|
|
151
|
+
"你认为该": "你认为",
|
|
152
|
+
"部分如何改进更好?(可选)": "部分如何改进更好?(可选)",
|
|
153
|
+
"反馈已提交": "反馈已提交",
|
|
154
|
+
"报错了,请稍后再试": "报错了,请稍后再试",
|
|
155
|
+
"我们会尽快处理你的反馈,感谢你的支持!": "我们会尽快处理你的反馈,感谢你的支持!",
|
|
156
|
+
"如果问题持续,请前往 GitHub 提交 issue。": "如果问题持续,请前往 GitHub 提交 issue。",
|
|
140
157
|
"上一篇": "上一篇",
|
|
141
158
|
"下一篇": "下一篇",
|
|
142
159
|
"演示代码报错,请检查": "演示代码报错,请检查",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { proxy } from 'valtio';
|
|
2
|
+
export var feedbackStore = proxy({
|
|
3
|
+
show: false
|
|
4
|
+
});
|
|
5
|
+
export var resetFeedbackState = function resetFeedbackState() {
|
|
6
|
+
feedbackStore.show = false;
|
|
7
|
+
feedbackStore.rating = undefined;
|
|
8
|
+
feedbackStore.section = undefined;
|
|
9
|
+
};
|
|
10
|
+
export var invokePageFeedback = function invokePageFeedback(like) {
|
|
11
|
+
feedbackStore.show = true;
|
|
12
|
+
feedbackStore.rating = like ? '1' : '0';
|
|
13
|
+
feedbackStore.section = undefined;
|
|
14
|
+
};
|
|
15
|
+
export var invokeSectionFeedback = function invokeSectionFeedback(section) {
|
|
16
|
+
feedbackStore.show = true;
|
|
17
|
+
feedbackStore.rating = undefined;
|
|
18
|
+
feedbackStore.section = section;
|
|
19
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/plugin/antVReactTechStack.ts
|
|
30
|
+
var antVReactTechStack_exports = {};
|
|
31
|
+
__export(antVReactTechStack_exports, {
|
|
32
|
+
AntVReactTechStack: () => AntVReactTechStack
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(antVReactTechStack_exports);
|
|
35
|
+
var import_react = __toESM(require("dumi/dist/techStacks/react"));
|
|
36
|
+
var import_fs = __toESM(require("fs"));
|
|
37
|
+
var import_sylvanas = __toESM(require("sylvanas"));
|
|
38
|
+
var import_package = require("../../package.json");
|
|
39
|
+
var AntVReactTechStack = class extends import_react.default {
|
|
40
|
+
generatePreviewerProps(...[props, opts]) {
|
|
41
|
+
var _a;
|
|
42
|
+
props.pkgDependencyList = { ...import_package.devDependencies, ...import_package.dependencies };
|
|
43
|
+
props.jsx ?? (props.jsx = "");
|
|
44
|
+
if (opts.type === "code-block") {
|
|
45
|
+
props.jsx = (opts == null ? void 0 : opts.entryPointCode) ? import_sylvanas.default.parseText(opts.entryPointCode) : "";
|
|
46
|
+
}
|
|
47
|
+
if (opts.type === "external") {
|
|
48
|
+
const locale = (_a = opts.mdAbsPath.match(/[a-z-]+\.([a-z-]+)\.md$/i)) == null ? void 0 : _a[1];
|
|
49
|
+
const mdPath = opts.fileAbsPath.replace(/\.\w+$/, ".md");
|
|
50
|
+
const md = import_fs.default.existsSync(mdPath) ? import_fs.default.readFileSync(mdPath, "utf-8") : "";
|
|
51
|
+
const codePath = opts.fileAbsPath.replace(/\.\w+$/, ".tsx");
|
|
52
|
+
const code = import_fs.default.existsSync(codePath) ? import_fs.default.readFileSync(codePath, "utf-8") : "";
|
|
53
|
+
props.jsx = import_sylvanas.default.parseText(code);
|
|
54
|
+
if (md) {
|
|
55
|
+
const blocks = {};
|
|
56
|
+
const lines = md.split("\n");
|
|
57
|
+
let blockName = "";
|
|
58
|
+
let cacheList = [];
|
|
59
|
+
const getBlockName = (text) => {
|
|
60
|
+
if (text.startsWith("## ")) {
|
|
61
|
+
return text.replace("## ", "").trim();
|
|
62
|
+
}
|
|
63
|
+
if (text.startsWith("```css") || text.startsWith("<style>")) {
|
|
64
|
+
return "style";
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
};
|
|
68
|
+
const fillBlock = (name, lineList) => {
|
|
69
|
+
if (lineList.length) {
|
|
70
|
+
let fullText;
|
|
71
|
+
if (name === "style") {
|
|
72
|
+
fullText = lineList.join("\n").replace(/<\/?style>/g, "").replace(/```(\s*css)/g, "");
|
|
73
|
+
} else {
|
|
74
|
+
fullText = lineList.slice(1).join("\n");
|
|
75
|
+
}
|
|
76
|
+
blocks[name] = fullText;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
for (let i = 0; i < lines.length; i++) {
|
|
80
|
+
const line = lines[i];
|
|
81
|
+
const nextBlockName = getBlockName(line);
|
|
82
|
+
if (nextBlockName) {
|
|
83
|
+
fillBlock(blockName, cacheList);
|
|
84
|
+
blockName = nextBlockName;
|
|
85
|
+
cacheList = [line];
|
|
86
|
+
} else {
|
|
87
|
+
cacheList.push(line);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
fillBlock(blockName, cacheList);
|
|
91
|
+
props.description = blocks[locale];
|
|
92
|
+
props.style = blocks.style;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return props;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
+
0 && (module.exports = {
|
|
100
|
+
AntVReactTechStack
|
|
101
|
+
});
|
package/dist/plugin/index.js
CHANGED
|
@@ -34,8 +34,10 @@ __export(plugin_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(plugin_exports);
|
|
35
35
|
var import_plugin_utils = require("dumi/plugin-utils");
|
|
36
36
|
var path = __toESM(require("path"));
|
|
37
|
+
var import_antVReactTechStack = require("./antVReactTechStack");
|
|
37
38
|
var import_examples = require("./examples");
|
|
38
39
|
var import_rehypeObservable = __toESM(require("./rehypeObservable"));
|
|
40
|
+
var import_remarkFeedback = __toESM(require("./remarkFeedback"));
|
|
39
41
|
var PAGES_DIR = (0, import_plugin_utils.winPath)(path.join(__dirname, "../pages"));
|
|
40
42
|
var MOCK_META = { frontmatter: { title: "mock-meta" }, texts: [], toc: [] };
|
|
41
43
|
var plugin_default = (api) => {
|
|
@@ -46,6 +48,7 @@ var plugin_default = (api) => {
|
|
|
46
48
|
memo.mfsu = false;
|
|
47
49
|
memo.jsMinifier = "terser";
|
|
48
50
|
memo.favicons = ["https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*7svFR6wkPMoAAAAAAAAAAAAADmJ7AQ/original"];
|
|
51
|
+
memo.extraRemarkPlugins = [import_remarkFeedback.default];
|
|
49
52
|
memo.extraRehypePlugins = [import_rehypeObservable.default];
|
|
50
53
|
return memo;
|
|
51
54
|
});
|
|
@@ -135,4 +138,5 @@ export default function ThemeAntVContextWrapper() {
|
|
|
135
138
|
return routes;
|
|
136
139
|
});
|
|
137
140
|
api.addTmpGenerateWatcherPaths(() => [path.resolve(process.cwd(), "examples")]);
|
|
141
|
+
api.registerTechStack(() => new import_antVReactTechStack.AntVReactTechStack());
|
|
138
142
|
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/plugin/remarkFeedback.ts
|
|
30
|
+
var remarkFeedback_exports = {};
|
|
31
|
+
__export(remarkFeedback_exports, {
|
|
32
|
+
default: () => remarkFeedback
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(remarkFeedback_exports);
|
|
35
|
+
var visit;
|
|
36
|
+
(async () => {
|
|
37
|
+
({ visit } = await import("unist-util-visit"));
|
|
38
|
+
})();
|
|
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="M924.3 338.4a447.57 447.57 0 00-96.1-143.3 443.09 443.09 0 00-143-96.3A443.91 443.91 0 00512 64h-2c-60.5.3-119 12.3-174.1 35.9a444.08 444.08 0 00-141.7 96.5 445 445 0 00-95 142.8A449.89 449.89 0 0065 514.1c.3 69.4 16.9 138.3 47.9 199.9v152c0 25.4 20.6 46 45.9 46h151.8a447.72 447.72 0 00199.5 48h2.1c59.8 0 117.7-11.6 172.3-34.3A443.2 443.2 0 00827 830.5c41.2-40.9 73.6-88.7 96.3-142 23.5-55.2 35.5-113.9 35.8-174.5.2-60.9-11.6-120-34.8-175.6zM312.4 560c-26.4 0-47.9-21.5-47.9-48s21.5-48 47.9-48 47.9 21.5 47.9 48-21.4 48-47.9 48zm199.6 0c-26.4 0-47.9-21.5-47.9-48s21.5-48 47.9-48 47.9 21.5 47.9 48-21.5 48-47.9 48zm199.6 0c-26.4 0-47.9-21.5-47.9-48s21.5-48 47.9-48 47.9 21.5 47.9 48-21.5 48-47.9 48z"></path></svg></span>';
|
|
40
|
+
function remarkFeedback() {
|
|
41
|
+
return (tree) => {
|
|
42
|
+
visit(tree, "heading", (node) => {
|
|
43
|
+
const headingText = node.children.filter((child) => child.type === "text").map((child) => child.value).join(" ").split(" ").join("-");
|
|
44
|
+
const template = `<button title="Post a comment" data-feedback-hash=${headingText} type="button" class="ant-btn ant-btn-text ant-btn-icon-only button comment-link feedback-link">${icon}</button>`;
|
|
45
|
+
const button = {
|
|
46
|
+
type: "html",
|
|
47
|
+
value: template
|
|
48
|
+
};
|
|
49
|
+
node.children.push(button);
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Avatar, Skeleton, Tooltip } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
var AvatarPlaceholder = function AvatarPlaceholder(_ref) {
|
|
4
|
+
var _ref$num = _ref.num,
|
|
5
|
+
num = _ref$num === void 0 ? 3 : _ref$num;
|
|
6
|
+
return /*#__PURE__*/React.createElement("li", null, Array.from({
|
|
7
|
+
length: num
|
|
8
|
+
}).map(function (_, i) {
|
|
9
|
+
return /*#__PURE__*/React.createElement(Skeleton.Avatar, {
|
|
10
|
+
size: "small",
|
|
11
|
+
active: true,
|
|
12
|
+
key: i,
|
|
13
|
+
style: {
|
|
14
|
+
marginInlineStart: i === 0 ? 0 : -8
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}));
|
|
18
|
+
};
|
|
19
|
+
export var ContributorAvatar = function ContributorAvatar(props) {
|
|
20
|
+
var _props$item = props.item,
|
|
21
|
+
_props$item2 = _props$item === void 0 ? {} : _props$item,
|
|
22
|
+
username = _props$item2.username,
|
|
23
|
+
url = _props$item2.url,
|
|
24
|
+
loading = props.loading;
|
|
25
|
+
if (loading) {
|
|
26
|
+
return /*#__PURE__*/React.createElement(AvatarPlaceholder, null);
|
|
27
|
+
}
|
|
28
|
+
if (username !== null && username !== void 0 && username.includes('github-actions')) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
32
|
+
title: username
|
|
33
|
+
}, /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("a", {
|
|
34
|
+
href: "https://github.com/".concat(username),
|
|
35
|
+
target: "_blank",
|
|
36
|
+
rel: "noopener noreferrer"
|
|
37
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
38
|
+
size: "small",
|
|
39
|
+
src: url,
|
|
40
|
+
alt: username
|
|
41
|
+
}, username))));
|
|
42
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useIntl, useSiteData } from 'dumi';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import ContributorsList from "../../common/AvatarList";
|
|
6
|
+
import { useGithubRepo } from "../../utils/github";
|
|
7
|
+
import { ContributorAvatar } from "./ContributorAvatar";
|
|
8
|
+
var StyledContributorsWrapper = styled.div.withConfig({
|
|
9
|
+
displayName: "StyledContributorsWrapper",
|
|
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;
|
|
14
|
+
var _useIntl = useIntl(),
|
|
15
|
+
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;
|
|
20
|
+
var _useGithubRepo = useGithubRepo(),
|
|
21
|
+
owner = _useGithubRepo.owner,
|
|
22
|
+
repo = _useGithubRepo.repo;
|
|
23
|
+
if (!filename) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return /*#__PURE__*/React.createElement(StyledContributorsWrapper, null, /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: "title"
|
|
28
|
+
}, formatMessage({
|
|
29
|
+
id: '文档贡献者'
|
|
30
|
+
})), /*#__PURE__*/React.createElement(ContributorsList, {
|
|
31
|
+
cache: true,
|
|
32
|
+
repo: repo,
|
|
33
|
+
owner: owner,
|
|
34
|
+
fileName: path.join(siteRelativePath, filename),
|
|
35
|
+
className: "list",
|
|
36
|
+
renderItem: function renderItem(item, loading) {
|
|
37
|
+
return /*#__PURE__*/React.createElement(ContributorAvatar, {
|
|
38
|
+
item: item,
|
|
39
|
+
loading: loading,
|
|
40
|
+
key: item === null || item === void 0 ? void 0 : item.url
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
branch: branch
|
|
44
|
+
}));
|
|
45
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { GithubOutlined } from '@ant-design/icons';
|
|
2
|
+
import { Button } from 'antd';
|
|
3
|
+
import { useIntl, useRouteMeta, useSiteData } from 'dumi';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
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.8);&-text{color:rgba(0,0,0,0.65);}}"]);
|
|
11
|
+
export var EditButton = function EditButton(_ref) {
|
|
12
|
+
var style = _ref.style;
|
|
13
|
+
var meta = useRouteMeta();
|
|
14
|
+
var _useIntl = useIntl(),
|
|
15
|
+
formatMessage = _useIntl.formatMessage;
|
|
16
|
+
var _useSiteData = useSiteData(),
|
|
17
|
+
themeConfig = _useSiteData.themeConfig;
|
|
18
|
+
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(GithubOutlined, {
|
|
29
|
+
style: {
|
|
30
|
+
fontSize: 20,
|
|
31
|
+
transform: 'translateY(2px)'
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
onClick: function onClick() {
|
|
35
|
+
return window.open(url, '_blank');
|
|
36
|
+
}
|
|
37
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
38
|
+
className: "button-text"
|
|
39
|
+
}, formatMessage({
|
|
40
|
+
id: '帮助改进此文档'
|
|
41
|
+
}))));
|
|
42
|
+
};
|
|
@@ -0,0 +1,234 @@
|
|
|
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
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."); }
|
|
7
|
+
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); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
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
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import { MehOutlined, SmileOutlined } from '@ant-design/icons';
|
|
12
|
+
import { Alert, Button, Divider, Form, Input, notification, Switch } from 'antd';
|
|
13
|
+
import { useIntl, useLocale, useRouteMeta } from 'dumi';
|
|
14
|
+
import React, { useEffect, useState } from 'react';
|
|
15
|
+
import { Link } from 'react-router-dom';
|
|
16
|
+
import { styled } from 'styled-components';
|
|
17
|
+
import useSWR from 'swr';
|
|
18
|
+
import { useSnapshot } from 'valtio';
|
|
19
|
+
import { feedbackStore, invokeSectionFeedback, resetFeedbackState } from "../../model/feedback";
|
|
20
|
+
import { getLatestVersion, useGithubRepo } from "../../utils/github";
|
|
21
|
+
import { submitFeedback } from "./service";
|
|
22
|
+
var StyledFeedbackMessageWrapper = styled.div.withConfig({
|
|
23
|
+
displayName: "StyledFeedbackMessageWrapper",
|
|
24
|
+
componentId: "dumi-theme-antv-c7ef__sc-3o22sl-0"
|
|
25
|
+
})(["display:", ";.alert{margin:12px 0 16px;padding:16px;line-height:1.8;background-color:rgba(255,251,235,0.5);border:1px solid rgba(173,104,0,0.15);border-radius:8px;.ant-alert-icon{color:#cc8800;}}.alert-link{color:#56390c;font-weight:bold;text-decoration:underline;}"], function (props) {
|
|
26
|
+
return props.$show ? 'block' : 'none';
|
|
27
|
+
});
|
|
28
|
+
export var FeedbackMessage = function FeedbackMessage() {
|
|
29
|
+
var _useIntl = useIntl(),
|
|
30
|
+
formatMessage = _useIntl.formatMessage;
|
|
31
|
+
var _Form$useForm = Form.useForm(),
|
|
32
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
33
|
+
form = _Form$useForm2[0];
|
|
34
|
+
var feedbackState = useSnapshot(feedbackStore);
|
|
35
|
+
var _useGithubRepo = useGithubRepo(),
|
|
36
|
+
owner = _useGithubRepo.owner,
|
|
37
|
+
repo = _useGithubRepo.repo;
|
|
38
|
+
var meta = useRouteMeta();
|
|
39
|
+
var _useState = useState(false),
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
enableRealName = _useState2[0],
|
|
42
|
+
setEnableRealName = _useState2[1];
|
|
43
|
+
var pageUrl = window.location.href;
|
|
44
|
+
var locale = useLocale();
|
|
45
|
+
var currentLocale = locale.id;
|
|
46
|
+
var issueUrl = "https://github.com/".concat(owner, "/").concat(repo, "/issues/new?labels=status%3A+waiting+for+maintainer%2Cdocs-feedback&template=docs-feedback.yml&title=[docs]+&page-url=").concat(pageUrl);
|
|
47
|
+
var alertMsg = /*#__PURE__*/React.createElement("div", null, formatMessage({
|
|
48
|
+
id: '如果遇到问题或发现某些功能无法正常工作,请通过'
|
|
49
|
+
}), /*#__PURE__*/React.createElement(Link, {
|
|
50
|
+
to: issueUrl,
|
|
51
|
+
className: "alert-link"
|
|
52
|
+
}, formatMessage({
|
|
53
|
+
id: '提交问题报告'
|
|
54
|
+
})), formatMessage({
|
|
55
|
+
id: '来反馈。否则,团队将无法提供进一步的答复或获取更多信息。'
|
|
56
|
+
}));
|
|
57
|
+
var openNotification = function openNotification(success) {
|
|
58
|
+
notification.info({
|
|
59
|
+
message: formatMessage({
|
|
60
|
+
id: success ? '反馈已提交' : '报错了,请稍后再试'
|
|
61
|
+
}),
|
|
62
|
+
description: formatMessage({
|
|
63
|
+
id: success ? '我们会尽快处理你的反馈,感谢你的支持!' : '如果问题持续,请前往 GitHub 提交 issue。'
|
|
64
|
+
}),
|
|
65
|
+
icon: success ? /*#__PURE__*/React.createElement(SmileOutlined, {
|
|
66
|
+
style: {
|
|
67
|
+
color: '#873bf4'
|
|
68
|
+
}
|
|
69
|
+
}) : /*#__PURE__*/React.createElement(MehOutlined, {
|
|
70
|
+
style: {
|
|
71
|
+
color: '#873bf4'
|
|
72
|
+
}
|
|
73
|
+
}),
|
|
74
|
+
placement: 'bottomLeft'
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
var _useSWR = useSWR("https://api.github.com/repos/".concat(owner, "/").concat(repo, "/releases/latest"), function () {
|
|
78
|
+
return getLatestVersion(owner, repo);
|
|
79
|
+
}),
|
|
80
|
+
lastVersion = _useSWR.data;
|
|
81
|
+
var onFinish = /*#__PURE__*/function () {
|
|
82
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
|
|
83
|
+
var params;
|
|
84
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
85
|
+
while (1) switch (_context.prev = _context.next) {
|
|
86
|
+
case 0:
|
|
87
|
+
params = {
|
|
88
|
+
comment: values.comment,
|
|
89
|
+
locale: currentLocale,
|
|
90
|
+
url: pageUrl,
|
|
91
|
+
rating: feedbackState.rating,
|
|
92
|
+
repo: "".concat(owner, "/").concat(repo),
|
|
93
|
+
section: feedbackState.section,
|
|
94
|
+
ua: navigator.userAgent,
|
|
95
|
+
userId: enableRealName ? values.userId : 'anonymous',
|
|
96
|
+
version: lastVersion,
|
|
97
|
+
title: meta.frontmatter.title
|
|
98
|
+
};
|
|
99
|
+
submitFeedback(params).then(function (f) {
|
|
100
|
+
form.setFieldValue('comment', '');
|
|
101
|
+
openNotification(true);
|
|
102
|
+
}).catch(function () {
|
|
103
|
+
openNotification(false);
|
|
104
|
+
});
|
|
105
|
+
case 2:
|
|
106
|
+
case "end":
|
|
107
|
+
return _context.stop();
|
|
108
|
+
}
|
|
109
|
+
}, _callee);
|
|
110
|
+
}));
|
|
111
|
+
return function onFinish(_x) {
|
|
112
|
+
return _ref.apply(this, arguments);
|
|
113
|
+
};
|
|
114
|
+
}();
|
|
115
|
+
var onCancel = function onCancel() {
|
|
116
|
+
resetFeedbackState();
|
|
117
|
+
};
|
|
118
|
+
useEffect(function () {
|
|
119
|
+
var observer = new MutationObserver(function () {
|
|
120
|
+
var buttons = document.querySelectorAll('.comment-link');
|
|
121
|
+
if (!buttons || buttons.length === 0) return;
|
|
122
|
+
var focusCommentInput = function focusCommentInput(e) {
|
|
123
|
+
var button = e.target.closest('.comment-link');
|
|
124
|
+
invokeSectionFeedback(button.getAttribute('data-feedback-hash'));
|
|
125
|
+
};
|
|
126
|
+
buttons.forEach(function (button) {
|
|
127
|
+
button.addEventListener('click', focusCommentInput);
|
|
128
|
+
});
|
|
129
|
+
return function () {
|
|
130
|
+
buttons.forEach(function (button) {
|
|
131
|
+
button.removeEventListener('click', focusCommentInput);
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
observer.observe(document.body, {
|
|
136
|
+
childList: true,
|
|
137
|
+
subtree: true
|
|
138
|
+
});
|
|
139
|
+
return function () {
|
|
140
|
+
observer.disconnect();
|
|
141
|
+
};
|
|
142
|
+
}, []);
|
|
143
|
+
useEffect(function () {
|
|
144
|
+
if (!feedbackState.show) {
|
|
145
|
+
form.setFieldValue('comment', '');
|
|
146
|
+
setEnableRealName(false);
|
|
147
|
+
}
|
|
148
|
+
}, [feedbackState.show]);
|
|
149
|
+
useEffect(function () {
|
|
150
|
+
if (feedbackState.section) {
|
|
151
|
+
form.scrollToField('comment', {
|
|
152
|
+
behavior: 'smooth',
|
|
153
|
+
block: 'center'
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}, [feedbackState.section]);
|
|
157
|
+
var showAlert = feedbackState.rating !== '1';
|
|
158
|
+
var getCommentFieldLabel = function getCommentFieldLabel() {
|
|
159
|
+
if (feedbackState.rating === '1') {
|
|
160
|
+
return formatMessage({
|
|
161
|
+
id: '你认为这个页面有哪些做的好的地方?(可选)'
|
|
162
|
+
});
|
|
163
|
+
} else if (feedbackState.rating === '0') {
|
|
164
|
+
return formatMessage({
|
|
165
|
+
id: '你觉得我们可以如何改进此页面?(可选)'
|
|
166
|
+
});
|
|
167
|
+
} else {
|
|
168
|
+
var leftQuote = currentLocale === 'zh' ? '「' : '"';
|
|
169
|
+
var rightQuote = currentLocale === 'zh' ? '」' : '"';
|
|
170
|
+
return /*#__PURE__*/React.createElement("div", null, formatMessage({
|
|
171
|
+
id: '你认为该'
|
|
172
|
+
}), ' ', /*#__PURE__*/React.createElement("b", null, leftQuote, feedbackState.section, rightQuote), ' ', formatMessage({
|
|
173
|
+
id: '部分如何改进更好?(可选)'
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
return /*#__PURE__*/React.createElement(StyledFeedbackMessageWrapper, {
|
|
178
|
+
$show: feedbackState.show
|
|
179
|
+
}, /*#__PURE__*/React.createElement(Divider, {
|
|
180
|
+
dashed: true
|
|
181
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
182
|
+
className: "form"
|
|
183
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
184
|
+
form: form,
|
|
185
|
+
name: "comment",
|
|
186
|
+
onFinish: onFinish,
|
|
187
|
+
layout: "vertical"
|
|
188
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
189
|
+
checkedChildren: "\u5B9E\u540D",
|
|
190
|
+
unCheckedChildren: "\u533F\u540D",
|
|
191
|
+
checked: enableRealName,
|
|
192
|
+
onChange: setEnableRealName,
|
|
193
|
+
style: {
|
|
194
|
+
marginBottom: 16
|
|
195
|
+
}
|
|
196
|
+
}), enableRealName && /*#__PURE__*/React.createElement(Form.Item, {
|
|
197
|
+
name: "userId",
|
|
198
|
+
label: formatMessage({
|
|
199
|
+
id: 'Github ID'
|
|
200
|
+
})
|
|
201
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
202
|
+
style: {
|
|
203
|
+
width: '220px'
|
|
204
|
+
}
|
|
205
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
206
|
+
name: "comment",
|
|
207
|
+
label: getCommentFieldLabel()
|
|
208
|
+
}, /*#__PURE__*/React.createElement(Input.TextArea, {
|
|
209
|
+
rows: 5
|
|
210
|
+
})), showAlert && /*#__PURE__*/React.createElement(Alert, {
|
|
211
|
+
type: "warning",
|
|
212
|
+
className: "alert",
|
|
213
|
+
message: alertMsg,
|
|
214
|
+
showIcon: true
|
|
215
|
+
}), /*#__PURE__*/React.createElement(Form.Item, {
|
|
216
|
+
style: {
|
|
217
|
+
textAlign: 'right'
|
|
218
|
+
}
|
|
219
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
220
|
+
htmlType: "button",
|
|
221
|
+
type: "text",
|
|
222
|
+
onClick: onCancel,
|
|
223
|
+
style: {
|
|
224
|
+
marginRight: 8
|
|
225
|
+
}
|
|
226
|
+
}, formatMessage({
|
|
227
|
+
id: '取消'
|
|
228
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
229
|
+
type: "primary",
|
|
230
|
+
htmlType: "submit"
|
|
231
|
+
}, formatMessage({
|
|
232
|
+
id: '提交'
|
|
233
|
+
}))))));
|
|
234
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { DislikeFilled, LikeFilled } from '@ant-design/icons';
|
|
2
|
+
import { Button, Tooltip } from 'antd';
|
|
3
|
+
import { useIntl } from 'dumi';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { styled } from 'styled-components';
|
|
6
|
+
import { useSnapshot } from 'valtio';
|
|
7
|
+
import { feedbackStore, invokePageFeedback } from "../../model/feedback";
|
|
8
|
+
var StyledVoteButtonsWrapper = styled.div.withConfig({
|
|
9
|
+
displayName: "StyledVoteButtonsWrapper",
|
|
10
|
+
componentId: "dumi-theme-antv-c7ef__sc-1dcmgu-0"
|
|
11
|
+
})(["color:rgba(0,0,0,0.65);display:flex;align-items:center;gap:4px;.button{color:rgba(0,0,0,0.8);}.active-button{color:#873bf4;background-color:#f8f1ff;}"]);
|
|
12
|
+
export var VoteButtons = function VoteButtons() {
|
|
13
|
+
var _useIntl = useIntl(),
|
|
14
|
+
formatMessage = _useIntl.formatMessage;
|
|
15
|
+
var feedbackState = useSnapshot(feedbackStore);
|
|
16
|
+
var items = [{
|
|
17
|
+
title: formatMessage({
|
|
18
|
+
id: 'yes'
|
|
19
|
+
}),
|
|
20
|
+
icon: /*#__PURE__*/React.createElement(LikeFilled, null),
|
|
21
|
+
onClick: function onClick() {
|
|
22
|
+
return invokePageFeedback(true);
|
|
23
|
+
},
|
|
24
|
+
isActive: feedbackState.rating === '1'
|
|
25
|
+
}, {
|
|
26
|
+
title: formatMessage({
|
|
27
|
+
id: 'no'
|
|
28
|
+
}),
|
|
29
|
+
icon: /*#__PURE__*/React.createElement(DislikeFilled, null),
|
|
30
|
+
onClick: function onClick() {
|
|
31
|
+
return invokePageFeedback(false);
|
|
32
|
+
},
|
|
33
|
+
isActive: feedbackState.rating === '0'
|
|
34
|
+
}];
|
|
35
|
+
return /*#__PURE__*/React.createElement(StyledVoteButtonsWrapper, null, /*#__PURE__*/React.createElement("span", null, formatMessage({
|
|
36
|
+
id: '此文档有帮助吗?'
|
|
37
|
+
})), items.map(function (_ref) {
|
|
38
|
+
var title = _ref.title,
|
|
39
|
+
icon = _ref.icon,
|
|
40
|
+
onClick = _ref.onClick,
|
|
41
|
+
isActive = _ref.isActive;
|
|
42
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
43
|
+
key: title,
|
|
44
|
+
title: title
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
46
|
+
className: "button ".concat(isActive ? 'active-button' : ''),
|
|
47
|
+
type: "text",
|
|
48
|
+
icon: icon,
|
|
49
|
+
onClick: onClick
|
|
50
|
+
}));
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useRouteMeta } from 'dumi';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { styled } from 'styled-components';
|
|
4
|
+
import { Contributors } from "./Contributors";
|
|
5
|
+
import { EditButton } from "./EditButton";
|
|
6
|
+
import { FeedbackMessage } from "./FeedbackMessage";
|
|
7
|
+
import { VoteButtons } from "./VoteButtons";
|
|
8
|
+
var StyledWrapper = styled.div.withConfig({
|
|
9
|
+
displayName: "StyledWrapper",
|
|
10
|
+
componentId: "dumi-theme-antv-c7ef__sc-yubwx0-0"
|
|
11
|
+
})(["margin-top:40px;.buttons{display:flex;justify-content:space-between;}"]);
|
|
12
|
+
export var Feedback = function Feedback() {
|
|
13
|
+
var meta = useRouteMeta();
|
|
14
|
+
if (meta.frontmatter.readonly) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return /*#__PURE__*/React.createElement(StyledWrapper, null, /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
className: "buttons"
|
|
19
|
+
}, /*#__PURE__*/React.createElement(EditButton, {
|
|
20
|
+
style: {
|
|
21
|
+
transform: 'translateX(-12px)'
|
|
22
|
+
}
|
|
23
|
+
}), /*#__PURE__*/React.createElement(VoteButtons, null)), /*#__PURE__*/React.createElement(FeedbackMessage, null), /*#__PURE__*/React.createElement(Contributors, {
|
|
24
|
+
filename: meta.frontmatter.filename
|
|
25
|
+
}));
|
|
26
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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
|
+
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); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
/**
|
|
8
|
+
* 服务模块
|
|
9
|
+
* https://docs.leancloud.cn/sdk/storage/guide/js/
|
|
10
|
+
*/
|
|
11
|
+
import AV from 'leancloud-storage';
|
|
12
|
+
AV.init({
|
|
13
|
+
appId: 'iHqYaIUSgLOlOTkQxnqicMax-gzGzoHsz',
|
|
14
|
+
appKey: 'fyjYpAT54tFGui2Vn6CYDMaf',
|
|
15
|
+
serverURL: 'https://ihqyaius.lc-cn-n1-shared.com'
|
|
16
|
+
});
|
|
17
|
+
export function submitFeedback(params) {
|
|
18
|
+
var Feedback = AV.Object.extend('UserFeedback');
|
|
19
|
+
var f = new Feedback();
|
|
20
|
+
Object.entries(params).forEach(function (_ref) {
|
|
21
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
22
|
+
key = _ref2[0],
|
|
23
|
+
value = _ref2[1];
|
|
24
|
+
f.set(key, value);
|
|
25
|
+
});
|
|
26
|
+
return f.save();
|
|
27
|
+
}
|
|
@@ -10,7 +10,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
11
|
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; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
// import { navigate } from 'gatsby';
|
|
14
13
|
import { CaretDownFilled, CheckOutlined, DownOutlined, GithubOutlined, LinkOutlined, MenuOutlined, WechatOutlined } from '@ant-design/icons';
|
|
15
14
|
import { Alert, Button, Dropdown, Menu, Modal, Popover, Select } from 'antd';
|
|
16
15
|
import cx from 'classnames';
|
|
@@ -24,6 +23,8 @@ import { Navs } from "./Navs";
|
|
|
24
23
|
import { Products } from "./Products";
|
|
25
24
|
import { Search } from "./Search";
|
|
26
25
|
import { findVersion, getLangUrl } from "./utils";
|
|
26
|
+
import { Assistant } from '@petercatai/assistant';
|
|
27
|
+
import '@petercatai/assistant/style';
|
|
27
28
|
import styles from "./index.module.less";
|
|
28
29
|
function redirectChinaMirror(chinaMirrorOrigin) {
|
|
29
30
|
window.location.href = window.location.href.replace(window.location.origin, chinaMirrorOrigin);
|
|
@@ -454,7 +455,8 @@ export var Header = function Header(props) {
|
|
|
454
455
|
ecosystems = themeConfig.ecosystems,
|
|
455
456
|
navs = themeConfig.navs,
|
|
456
457
|
docsearchOptions = themeConfig.docsearchOptions,
|
|
457
|
-
announcement = themeConfig.announcement
|
|
458
|
+
announcement = themeConfig.announcement,
|
|
459
|
+
petercat = themeConfig.petercat;
|
|
458
460
|
var searchOptions = {
|
|
459
461
|
docsearchOptions: docsearchOptions
|
|
460
462
|
};
|
|
@@ -482,7 +484,11 @@ export var Header = function Header(props) {
|
|
|
482
484
|
searchOptions: searchOptions,
|
|
483
485
|
isHomePage: isHomePage,
|
|
484
486
|
transparent: isHomePage && isAntVSite,
|
|
485
|
-
announcement: announcement
|
|
487
|
+
announcement: announcement,
|
|
488
|
+
petercat: petercat
|
|
486
489
|
};
|
|
487
|
-
return /*#__PURE__*/React.createElement(HeaderComponent, Object.assign({}, headerProps, props))
|
|
490
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HeaderComponent, Object.assign({}, headerProps, props)), (petercat === null || petercat === void 0 ? void 0 : petercat.show) && /*#__PURE__*/React.createElement(Assistant, {
|
|
491
|
+
token: petercat === null || petercat === void 0 ? void 0 : petercat.token,
|
|
492
|
+
apiDomain: "https://api.petercat.ai"
|
|
493
|
+
}));
|
|
488
494
|
};
|
|
@@ -7,12 +7,13 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
7
7
|
import { VerticalAlignTopOutlined } from '@ant-design/icons';
|
|
8
8
|
import { BackTop, Layout } from 'antd';
|
|
9
9
|
import { useRouteMeta } from 'dumi';
|
|
10
|
-
import React
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import { useMedia } from 'react-use';
|
|
12
12
|
import readingTime from 'reading-time';
|
|
13
13
|
import { useMenu } from "../../hooks/useMenu";
|
|
14
14
|
import { ContentTable } from "dumi/theme/slots/ContentTable";
|
|
15
|
-
import {
|
|
15
|
+
import { Feedback } from "dumi/theme/slots/Feedback";
|
|
16
|
+
import { PrevAndNext } from "./PrevAndNext";
|
|
16
17
|
import ReadingTime from "./ReadingTime";
|
|
17
18
|
import styles from "./index.module.less";
|
|
18
19
|
import { usePreview } from "./usePreview";
|
|
@@ -25,32 +26,8 @@ export var Main = function Main(_ref) {
|
|
|
25
26
|
var _readingTime = readingTime(text),
|
|
26
27
|
time = _readingTime.time;
|
|
27
28
|
var _useMenu = useMenu(),
|
|
28
|
-
_useMenu2 = _slicedToArray(_useMenu,
|
|
29
|
-
selectedKey = _useMenu2[1]
|
|
30
|
-
flattenMenuItems = _useMenu2[2];
|
|
31
|
-
var _useMemo = useMemo(function () {
|
|
32
|
-
if (!flattenMenuItems) {
|
|
33
|
-
return [undefined, undefined];
|
|
34
|
-
}
|
|
35
|
-
var activeMenuItemIndex = -1;
|
|
36
|
-
flattenMenuItems.forEach(function (menuItem, i) {
|
|
37
|
-
if (menuItem && menuItem.key === selectedKey) {
|
|
38
|
-
activeMenuItemIndex = i;
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
var prevItem = flattenMenuItems[activeMenuItemIndex - 1];
|
|
42
|
-
var nextItem = flattenMenuItems[activeMenuItemIndex + 1];
|
|
43
|
-
return [prevItem ? {
|
|
44
|
-
slug: prevItem.link,
|
|
45
|
-
title: prevItem.title
|
|
46
|
-
} : undefined, nextItem ? {
|
|
47
|
-
slug: nextItem.link,
|
|
48
|
-
title: nextItem.title
|
|
49
|
-
} : undefined];
|
|
50
|
-
}, [flattenMenuItems, selectedKey]),
|
|
51
|
-
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
52
|
-
prev = _useMemo2[0],
|
|
53
|
-
next = _useMemo2[1];
|
|
29
|
+
_useMenu2 = _slicedToArray(_useMenu, 2),
|
|
30
|
+
selectedKey = _useMenu2[1];
|
|
54
31
|
var is991Wide = useMedia('(min-width: 991.99px)', true);
|
|
55
32
|
var showToc = is991Wide && meta.frontmatter.showToc !== false;
|
|
56
33
|
usePreview({}, selectedKey);
|
|
@@ -67,21 +44,13 @@ export var Main = function Main(_ref) {
|
|
|
67
44
|
className: styles.readtime
|
|
68
45
|
})), /*#__PURE__*/React.createElement("div", {
|
|
69
46
|
className: styles.markdown
|
|
70
|
-
}, children), /*#__PURE__*/React.createElement(
|
|
71
|
-
className: styles.preandnext
|
|
72
|
-
}, /*#__PURE__*/React.createElement(NavigatorBanner, {
|
|
73
|
-
type: "prev",
|
|
74
|
-
post: prev
|
|
75
|
-
}), /*#__PURE__*/React.createElement(NavigatorBanner, {
|
|
76
|
-
type: "next",
|
|
77
|
-
post: next
|
|
78
|
-
}), /*#__PURE__*/React.createElement(BackTop, {
|
|
47
|
+
}, children), /*#__PURE__*/React.createElement(Feedback, null), /*#__PURE__*/React.createElement(PrevAndNext, null)), /*#__PURE__*/React.createElement(BackTop, {
|
|
79
48
|
style: {
|
|
80
49
|
right: 32
|
|
81
50
|
}
|
|
82
51
|
}, /*#__PURE__*/React.createElement("div", {
|
|
83
52
|
className: styles.backTop
|
|
84
|
-
}, /*#__PURE__*/React.createElement(VerticalAlignTopOutlined, null))))
|
|
53
|
+
}, /*#__PURE__*/React.createElement(VerticalAlignTopOutlined, null)))), showToc && /*#__PURE__*/React.createElement(Layout.Sider, {
|
|
85
54
|
theme: "light",
|
|
86
55
|
width: 260
|
|
87
56
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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
|
+
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); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useMemo } from 'react';
|
|
8
|
+
import { useMenu } from "../../hooks/useMenu";
|
|
9
|
+
import { NavigatorBanner } from "./NavigatorBanner";
|
|
10
|
+
import styles from "./index.module.less";
|
|
11
|
+
export var PrevAndNext = function PrevAndNext() {
|
|
12
|
+
var _useMenu = useMenu(),
|
|
13
|
+
_useMenu2 = _slicedToArray(_useMenu, 3),
|
|
14
|
+
selectedKey = _useMenu2[1],
|
|
15
|
+
flattenMenuItems = _useMenu2[2];
|
|
16
|
+
var _useMemo = useMemo(function () {
|
|
17
|
+
if (!flattenMenuItems) {
|
|
18
|
+
return [undefined, undefined];
|
|
19
|
+
}
|
|
20
|
+
var activeMenuItemIndex = -1;
|
|
21
|
+
flattenMenuItems.forEach(function (menuItem, i) {
|
|
22
|
+
if (menuItem && menuItem.key === selectedKey) {
|
|
23
|
+
activeMenuItemIndex = i;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
var prevItem = flattenMenuItems[activeMenuItemIndex - 1];
|
|
27
|
+
var nextItem = flattenMenuItems[activeMenuItemIndex + 1];
|
|
28
|
+
return [prevItem ? {
|
|
29
|
+
slug: prevItem.link,
|
|
30
|
+
title: prevItem.title
|
|
31
|
+
} : undefined, nextItem ? {
|
|
32
|
+
slug: nextItem.link,
|
|
33
|
+
title: nextItem.title
|
|
34
|
+
} : undefined];
|
|
35
|
+
}, [flattenMenuItems, selectedKey]),
|
|
36
|
+
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
37
|
+
prev = _useMemo2[0],
|
|
38
|
+
next = _useMemo2[1];
|
|
39
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: styles.preandnext
|
|
41
|
+
}, /*#__PURE__*/React.createElement(NavigatorBanner, {
|
|
42
|
+
type: "prev",
|
|
43
|
+
post: prev
|
|
44
|
+
}), /*#__PURE__*/React.createElement(NavigatorBanner, {
|
|
45
|
+
type: "next",
|
|
46
|
+
post: next
|
|
47
|
+
}));
|
|
48
|
+
};
|
package/dist/slots/_.less
CHANGED
|
@@ -2,11 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
@primary-color: #873bf4;
|
|
4
4
|
|
|
5
|
+
.ant-btn,
|
|
6
|
+
.ant-input,
|
|
7
|
+
.ant-notification-notice {
|
|
8
|
+
border-radius: 8px !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// 段落反馈
|
|
12
|
+
.comment-link {
|
|
13
|
+
float: right;
|
|
14
|
+
color: #6d7c92;
|
|
15
|
+
transform: scale(0.9);
|
|
16
|
+
transition: background 0.3s, color 0.3s;
|
|
17
|
+
|
|
18
|
+
&:hover {
|
|
19
|
+
color: #873bf4;
|
|
20
|
+
background-color: #f8f1ff;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
5
25
|
.container1440() {
|
|
6
26
|
width: 1440px;
|
|
7
27
|
max-width: calc(100% - 80px);
|
|
8
|
-
margin-left: auto;
|
|
9
28
|
margin-right: auto;
|
|
29
|
+
margin-left: auto;
|
|
10
30
|
|
|
11
31
|
@media only screen and (max-width: 931.99px) {
|
|
12
32
|
& {
|
|
@@ -30,23 +50,23 @@
|
|
|
30
50
|
}
|
|
31
51
|
|
|
32
52
|
.Resizer {
|
|
33
|
-
background: #000;
|
|
34
|
-
opacity: 0.1;
|
|
35
53
|
z-index: 1;
|
|
36
54
|
box-sizing: border-box;
|
|
55
|
+
background: #000;
|
|
37
56
|
background-clip: padding-box;
|
|
57
|
+
opacity: 0.1;
|
|
38
58
|
|
|
39
59
|
&:hover {
|
|
40
60
|
transition: all 2s ease;
|
|
41
61
|
}
|
|
42
62
|
|
|
43
63
|
&.horizontal {
|
|
64
|
+
width: 100%;
|
|
44
65
|
height: 11px;
|
|
45
66
|
margin: -5px 0;
|
|
46
67
|
border-top: 5px solid rgba(255, 255, 255, 0);
|
|
47
68
|
border-bottom: 5px solid rgba(255, 255, 255, 0);
|
|
48
69
|
cursor: row-resize;
|
|
49
|
-
width: 100%;
|
|
50
70
|
|
|
51
71
|
&:hover {
|
|
52
72
|
border-top: 5px solid rgba(0, 0, 0, 0.5);
|
|
@@ -57,8 +77,8 @@
|
|
|
57
77
|
&.vertical {
|
|
58
78
|
width: 11px;
|
|
59
79
|
margin: 0 -5px;
|
|
60
|
-
border-left: 5px solid rgba(255, 255, 255, 0);
|
|
61
80
|
border-right: 5px solid rgba(255, 255, 255, 0);
|
|
81
|
+
border-left: 5px solid rgba(255, 255, 255, 0);
|
|
62
82
|
cursor: col-resize;
|
|
63
83
|
|
|
64
84
|
Pane2 {
|
|
@@ -66,8 +86,8 @@
|
|
|
66
86
|
}
|
|
67
87
|
|
|
68
88
|
&:hover {
|
|
69
|
-
border-left: 5px solid rgba(0, 0, 0, 0.5);
|
|
70
89
|
border-right: 5px solid rgba(0, 0, 0, 0.5);
|
|
90
|
+
border-left: 5px solid rgba(0, 0, 0, 0.5);
|
|
71
91
|
}
|
|
72
92
|
}
|
|
73
93
|
|
|
@@ -0,0 +1,54 @@
|
|
|
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
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."); }
|
|
7
|
+
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); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
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
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import { useSiteData } from 'dumi';
|
|
12
|
+
export var useGithubRepo = function useGithubRepo() {
|
|
13
|
+
var githubUrl = useSiteData().themeConfig.githubUrl;
|
|
14
|
+
var regex = /https:\/\/github\.com\/([^\/]+)\/([^\/]+)/;
|
|
15
|
+
var _githubUrl$match = githubUrl.match(regex),
|
|
16
|
+
_githubUrl$match2 = _slicedToArray(_githubUrl$match, 3),
|
|
17
|
+
owner = _githubUrl$match2[1],
|
|
18
|
+
repo = _githubUrl$match2[2];
|
|
19
|
+
return {
|
|
20
|
+
owner: owner,
|
|
21
|
+
repo: repo
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export function getLatestVersion(_x, _x2) {
|
|
25
|
+
return _getLatestVersion.apply(this, arguments);
|
|
26
|
+
}
|
|
27
|
+
function _getLatestVersion() {
|
|
28
|
+
_getLatestVersion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(owner, repo) {
|
|
29
|
+
var response, data;
|
|
30
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
31
|
+
while (1) switch (_context.prev = _context.next) {
|
|
32
|
+
case 0:
|
|
33
|
+
_context.prev = 0;
|
|
34
|
+
_context.next = 3;
|
|
35
|
+
return fetch("https://api.github.com/repos/".concat(owner, "/").concat(repo, "/releases/latest"));
|
|
36
|
+
case 3:
|
|
37
|
+
response = _context.sent;
|
|
38
|
+
_context.next = 6;
|
|
39
|
+
return response.json();
|
|
40
|
+
case 6:
|
|
41
|
+
data = _context.sent;
|
|
42
|
+
return _context.abrupt("return", data.tag_name);
|
|
43
|
+
case 10:
|
|
44
|
+
_context.prev = 10;
|
|
45
|
+
_context.t0 = _context["catch"](0);
|
|
46
|
+
return _context.abrupt("return", undefined);
|
|
47
|
+
case 13:
|
|
48
|
+
case "end":
|
|
49
|
+
return _context.stop();
|
|
50
|
+
}
|
|
51
|
+
}, _callee, null, [[0, 10]]);
|
|
52
|
+
}));
|
|
53
|
+
return _getLatestVersion.apply(this, arguments);
|
|
54
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/dumi-theme-antv",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7-beta.0",
|
|
4
4
|
"description": "AntV website theme based on dumi2.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dumi",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"@docsearch/css": "^3.8.0",
|
|
50
50
|
"@docsearch/react": "^3.8.0",
|
|
51
51
|
"@monaco-editor/react": "^4.6.0",
|
|
52
|
+
"@petercatai/assistant": "^2.0.17",
|
|
52
53
|
"@stackblitz/sdk": "^1.11.0",
|
|
53
54
|
"antd": "^4.24.16",
|
|
54
55
|
"classnames": "^2.5.1",
|
|
@@ -61,6 +62,7 @@
|
|
|
61
62
|
"hast": "^1.0.0",
|
|
62
63
|
"indent-string": "^5.0.0",
|
|
63
64
|
"insert-css": "^2.0.0",
|
|
65
|
+
"leancloud-storage": "^4.15.2",
|
|
64
66
|
"lodash-es": "^4.17.21",
|
|
65
67
|
"monaco-editor": "^0.25.2",
|
|
66
68
|
"nprogress": "^0.2.0",
|
|
@@ -84,6 +86,9 @@
|
|
|
84
86
|
"semver": "^7.6.3",
|
|
85
87
|
"size-sensor": "^1.0.2",
|
|
86
88
|
"slick-carousel": "^1.8.1",
|
|
89
|
+
"styled-components": "^6.1.14",
|
|
90
|
+
"swr": "^2.2.5",
|
|
91
|
+
"sylvanas": "^0.6.1",
|
|
87
92
|
"unified": "^10.1.2",
|
|
88
93
|
"unist-util-visit": "^4.1.2",
|
|
89
94
|
"uri-parse": "^1.0.0",
|
|
@@ -104,6 +109,7 @@
|
|
|
104
109
|
"@types/react": "^18.3.12",
|
|
105
110
|
"@types/react-router-dom": "^5.3.3",
|
|
106
111
|
"@types/react-slick": "^0.23.13",
|
|
112
|
+
"@types/styled-components": "^5.1.34",
|
|
107
113
|
"@umijs/lint": "^4.3.34",
|
|
108
114
|
"dumi": "^2.4.13",
|
|
109
115
|
"eslint": "^8.57.1",
|
|
@@ -123,7 +129,8 @@
|
|
|
123
129
|
"react-dom": ">=16.9.0"
|
|
124
130
|
},
|
|
125
131
|
"publishConfig": {
|
|
126
|
-
"access": "public"
|
|
132
|
+
"access": "public",
|
|
133
|
+
"tag": "beta"
|
|
127
134
|
},
|
|
128
135
|
"authors": [
|
|
129
136
|
"dumi",
|