@antv/dumi-theme-antv 0.6.2 → 0.6.3-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/pages/Examples/index.js +1 -1
- package/dist/slots/Feedback/EditButton.js +2 -3
- package/dist/slots/Feedback/PageFeedback.js +1 -1
- package/dist/slots/Feedback/index.js +1 -2
- package/dist/slots/Header/index.js +50 -2
- package/dist/slots/ManualContent/Main.js +6 -16
- package/dist/utils/user.js +95 -0
- package/package.json +3 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FormOutlined } from '@ant-design/icons';
|
|
2
2
|
import { useIntl, useRouteMeta, useSiteData } from 'dumi';
|
|
3
|
-
import path from 'path';
|
|
4
3
|
import React from 'react';
|
|
5
4
|
import { useGithubRepo } from "../../utils/github";
|
|
6
5
|
export var EditButton = function EditButton() {
|
|
@@ -11,7 +10,7 @@ export var EditButton = function EditButton() {
|
|
|
11
10
|
themeConfig = _useSiteData.themeConfig;
|
|
12
11
|
var githubUrl = themeConfig.githubUrl,
|
|
13
12
|
_themeConfig$sitePack = themeConfig.sitePackagePath,
|
|
14
|
-
sitePackagePath = _themeConfig$sitePack === void 0 ? '
|
|
13
|
+
sitePackagePath = _themeConfig$sitePack === void 0 ? 'site' : _themeConfig$sitePack;
|
|
15
14
|
var _useGithubRepo = useGithubRepo(),
|
|
16
15
|
defaultBranch = _useGithubRepo.defaultBranch;
|
|
17
16
|
var editable = !meta.frontmatter.readonly;
|
|
@@ -19,7 +18,7 @@ export var EditButton = function EditButton() {
|
|
|
19
18
|
return null;
|
|
20
19
|
}
|
|
21
20
|
var branchUrl = "".concat(githubUrl, "/edit/").concat(defaultBranch);
|
|
22
|
-
var url = meta.frontmatter.redirect ?
|
|
21
|
+
var url = meta.frontmatter.redirect ? "".concat(branchUrl, "/").concat(meta.frontmatter.redirect) : "".concat(branchUrl, "/").concat(sitePackagePath, "/").concat(meta.frontmatter.filename || '');
|
|
23
22
|
return /*#__PURE__*/React.createElement("a", {
|
|
24
23
|
onClick: function onClick() {
|
|
25
24
|
return window.open(url, '_blank');
|
|
@@ -5,7 +5,7 @@ import { PageFeedbackVoteButtons } from "./PageFeedbackVoteButtons";
|
|
|
5
5
|
var StyledWrapper = styled.div.withConfig({
|
|
6
6
|
displayName: "StyledWrapper",
|
|
7
7
|
componentId: "dumi-theme-antv-c7ef__sc-1vamzhw-0"
|
|
8
|
-
})(["
|
|
8
|
+
})(["margin:2px 4px 8px 4px;box-shadow:0 2px 6px 0 rgba(0,0,0,.08);border-radius:8px;padding:10px 12px;width:fit-content;background-color:#fff;font-size:14px;}"]);
|
|
9
9
|
export var PageFeedback = function PageFeedback() {
|
|
10
10
|
return /*#__PURE__*/React.createElement(StyledWrapper, null, /*#__PURE__*/React.createElement(PageFeedbackVoteButtons, null), /*#__PURE__*/React.createElement(PageFeedbackReasonForm, null));
|
|
11
11
|
};
|
|
@@ -3,7 +3,6 @@ import React from 'react';
|
|
|
3
3
|
import { styled } from 'styled-components';
|
|
4
4
|
import { Contributors } from "./Contributors";
|
|
5
5
|
import { EditButton } from "./EditButton";
|
|
6
|
-
import { PageFeedback } from "./PageFeedback";
|
|
7
6
|
import { SectionFeedback } from "./SectionFeedback";
|
|
8
7
|
var StyledWrapper = styled.div.withConfig({
|
|
9
8
|
displayName: "StyledWrapper",
|
|
@@ -16,5 +15,5 @@ export var Feedback = function Feedback() {
|
|
|
16
15
|
if (!feedback) {
|
|
17
16
|
return null;
|
|
18
17
|
}
|
|
19
|
-
return /*#__PURE__*/React.createElement(StyledWrapper, null, /*#__PURE__*/React.createElement(EditButton, null), /*#__PURE__*/React.createElement(Contributors, null), /*#__PURE__*/React.createElement(SectionFeedback, null)
|
|
18
|
+
return /*#__PURE__*/React.createElement(StyledWrapper, null, /*#__PURE__*/React.createElement(EditButton, null), /*#__PURE__*/React.createElement(Contributors, null), /*#__PURE__*/React.createElement(SectionFeedback, null));
|
|
20
19
|
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
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); }); }; }
|
|
2
5
|
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
6
|
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
7
|
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; }
|
|
@@ -25,6 +28,7 @@ import { Search } from "./Search";
|
|
|
25
28
|
import { findVersion, getLangUrl } from "./utils";
|
|
26
29
|
import { Assistant } from '@petercatai/assistant';
|
|
27
30
|
import '@petercatai/assistant/style';
|
|
31
|
+
import { determineUserType } from "../../utils/user";
|
|
28
32
|
import styles from "./index.module.less";
|
|
29
33
|
function redirectChinaMirror(chinaMirrorOrigin) {
|
|
30
34
|
window.location.href = window.location.href.replace(window.location.origin, chinaMirrorOrigin);
|
|
@@ -456,7 +460,8 @@ export var Header = function Header(props) {
|
|
|
456
460
|
navs = themeConfig.navs,
|
|
457
461
|
docsearchOptions = themeConfig.docsearchOptions,
|
|
458
462
|
announcement = themeConfig.announcement,
|
|
459
|
-
petercat = themeConfig.petercat
|
|
463
|
+
petercat = themeConfig.petercat,
|
|
464
|
+
links = themeConfig.links;
|
|
460
465
|
var searchOptions = {
|
|
461
466
|
docsearchOptions: docsearchOptions
|
|
462
467
|
};
|
|
@@ -487,7 +492,50 @@ export var Header = function Header(props) {
|
|
|
487
492
|
announcement: announcement,
|
|
488
493
|
petercat: petercat
|
|
489
494
|
};
|
|
490
|
-
|
|
495
|
+
var _useState11 = useState(undefined),
|
|
496
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
497
|
+
isInternalUser = _useState12[0],
|
|
498
|
+
setIsInternalUser = _useState12[1];
|
|
499
|
+
var isPetercatShow = petercat === null || petercat === void 0 ? void 0 : petercat.show;
|
|
500
|
+
useEffect(function () {
|
|
501
|
+
var checkUserType = /*#__PURE__*/function () {
|
|
502
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
503
|
+
var result;
|
|
504
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
505
|
+
while (1) switch (_context.prev = _context.next) {
|
|
506
|
+
case 0:
|
|
507
|
+
_context.next = 2;
|
|
508
|
+
return determineUserType();
|
|
509
|
+
case 2:
|
|
510
|
+
result = _context.sent;
|
|
511
|
+
setIsInternalUser(result);
|
|
512
|
+
case 4:
|
|
513
|
+
case "end":
|
|
514
|
+
return _context.stop();
|
|
515
|
+
}
|
|
516
|
+
}, _callee);
|
|
517
|
+
}));
|
|
518
|
+
return function checkUserType() {
|
|
519
|
+
return _ref4.apply(this, arguments);
|
|
520
|
+
};
|
|
521
|
+
}();
|
|
522
|
+
checkUserType();
|
|
523
|
+
}, []);
|
|
524
|
+
useEffect(function () {
|
|
525
|
+
var script = null;
|
|
526
|
+
if (isInternalUser && links) {
|
|
527
|
+
script = document.createElement('script');
|
|
528
|
+
script.src = 'https://links.alipay.com/widgetInit/67a96a296b6fa80490bdf892';
|
|
529
|
+
script.async = true;
|
|
530
|
+
document.body.appendChild(script);
|
|
531
|
+
}
|
|
532
|
+
return function () {
|
|
533
|
+
if (script) {
|
|
534
|
+
document.body.removeChild(script);
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
}, [isInternalUser]);
|
|
538
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HeaderComponent, Object.assign({}, headerProps, props)), isPetercatShow && isInternalUser === false && /*#__PURE__*/React.createElement(Assistant, {
|
|
491
539
|
token: petercat === null || petercat === void 0 ? void 0 : petercat.token,
|
|
492
540
|
apiDomain: "https://api.petercat.ai"
|
|
493
541
|
}));
|
|
@@ -1,9 +1,3 @@
|
|
|
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
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
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."); }
|
|
9
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); }
|
|
@@ -12,13 +6,14 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
12
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
7
|
import { VerticalAlignTopOutlined } from '@ant-design/icons';
|
|
14
8
|
import { BackTop, Layout } from 'antd';
|
|
15
|
-
import { useRouteMeta
|
|
9
|
+
import { useRouteMeta } from 'dumi';
|
|
16
10
|
import React from 'react';
|
|
17
11
|
import { useMedia } from 'react-use';
|
|
18
12
|
import readingTime from 'reading-time';
|
|
19
13
|
import { useMenu } from "../../hooks/useMenu";
|
|
20
14
|
import { ContentTable } from "dumi/theme/slots/ContentTable";
|
|
21
15
|
import { Feedback } from "dumi/theme/slots/Feedback";
|
|
16
|
+
import { PageFeedback } from "../Feedback/PageFeedback";
|
|
22
17
|
import styles from "./index.module.less";
|
|
23
18
|
import { PrevAndNext } from "./PrevAndNext";
|
|
24
19
|
import ReadingTime from "./ReadingTime";
|
|
@@ -26,9 +21,6 @@ import { usePreview } from "./usePreview";
|
|
|
26
21
|
export var Main = function Main(_ref) {
|
|
27
22
|
var children = _ref.children;
|
|
28
23
|
var meta = useRouteMeta();
|
|
29
|
-
var _useSiteData = useSiteData(),
|
|
30
|
-
themeConfig = _useSiteData.themeConfig;
|
|
31
|
-
var feedback = themeConfig.feedback;
|
|
32
24
|
var text = meta.texts.reduce(function (prev, next) {
|
|
33
25
|
return prev + next.value;
|
|
34
26
|
}, '');
|
|
@@ -54,11 +46,9 @@ export var Main = function Main(_ref) {
|
|
|
54
46
|
})), /*#__PURE__*/React.createElement("div", {
|
|
55
47
|
className: styles.markdown
|
|
56
48
|
}, children), /*#__PURE__*/React.createElement(Feedback, null), /*#__PURE__*/React.createElement(PrevAndNext, null)), /*#__PURE__*/React.createElement(BackTop, {
|
|
57
|
-
style:
|
|
58
|
-
right:
|
|
59
|
-
}
|
|
60
|
-
bottom: 100
|
|
61
|
-
})
|
|
49
|
+
style: {
|
|
50
|
+
right: 24
|
|
51
|
+
}
|
|
62
52
|
}, /*#__PURE__*/React.createElement("div", {
|
|
63
53
|
className: styles.backTop
|
|
64
54
|
}, /*#__PURE__*/React.createElement(VerticalAlignTopOutlined, null)))), showToc && /*#__PURE__*/React.createElement(Layout.Sider, {
|
|
@@ -66,5 +56,5 @@ export var Main = function Main(_ref) {
|
|
|
66
56
|
width: 260
|
|
67
57
|
}, /*#__PURE__*/React.createElement("div", {
|
|
68
58
|
className: styles.toc
|
|
69
|
-
}, /*#__PURE__*/React.createElement(ContentTable, null))));
|
|
59
|
+
}, /*#__PURE__*/React.createElement(PageFeedback, null), /*#__PURE__*/React.createElement(ContentTable, null))));
|
|
70
60
|
};
|
|
@@ -0,0 +1,95 @@
|
|
|
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 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; }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
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); }
|
|
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
|
+
* 请求超时包装函数
|
|
12
|
+
*/
|
|
13
|
+
var fetchWithTimeout = /*#__PURE__*/function () {
|
|
14
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
|
|
15
|
+
var options,
|
|
16
|
+
timeout,
|
|
17
|
+
controller,
|
|
18
|
+
timeoutId,
|
|
19
|
+
response,
|
|
20
|
+
_args = arguments;
|
|
21
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
22
|
+
while (1) switch (_context.prev = _context.next) {
|
|
23
|
+
case 0:
|
|
24
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
25
|
+
timeout = _args.length > 2 && _args[2] !== undefined ? _args[2] : 3000;
|
|
26
|
+
controller = new AbortController();
|
|
27
|
+
timeoutId = setTimeout(function () {
|
|
28
|
+
return controller.abort();
|
|
29
|
+
}, timeout);
|
|
30
|
+
_context.prev = 4;
|
|
31
|
+
_context.next = 7;
|
|
32
|
+
return fetch(url, _objectSpread(_objectSpread({}, options), {}, {
|
|
33
|
+
signal: controller.signal
|
|
34
|
+
}));
|
|
35
|
+
case 7:
|
|
36
|
+
response = _context.sent;
|
|
37
|
+
clearTimeout(timeoutId);
|
|
38
|
+
return _context.abrupt("return", response);
|
|
39
|
+
case 12:
|
|
40
|
+
_context.prev = 12;
|
|
41
|
+
_context.t0 = _context["catch"](4);
|
|
42
|
+
clearTimeout(timeoutId);
|
|
43
|
+
throw _context.t0;
|
|
44
|
+
case 16:
|
|
45
|
+
case "end":
|
|
46
|
+
return _context.stop();
|
|
47
|
+
}
|
|
48
|
+
}, _callee, null, [[4, 12]]);
|
|
49
|
+
}));
|
|
50
|
+
return function fetchWithTimeout(_x) {
|
|
51
|
+
return _ref.apply(this, arguments);
|
|
52
|
+
};
|
|
53
|
+
}();
|
|
54
|
+
var isInternalUser;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 通过请求一个内网资源来判断用户类型
|
|
58
|
+
*/
|
|
59
|
+
export var determineUserType = /*#__PURE__*/function () {
|
|
60
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
61
|
+
var url, timeout;
|
|
62
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
63
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
if (!(isInternalUser !== undefined)) {
|
|
66
|
+
_context2.next = 2;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
return _context2.abrupt("return", isInternalUser);
|
|
70
|
+
case 2:
|
|
71
|
+
url = 'https://webgw.antgroup-inc.cn/180020010001271369/visservice/api/oneclip';
|
|
72
|
+
timeout = 5000; // 请求超时设置
|
|
73
|
+
_context2.prev = 4;
|
|
74
|
+
_context2.next = 7;
|
|
75
|
+
return fetchWithTimeout(url, {}, timeout);
|
|
76
|
+
case 7:
|
|
77
|
+
isInternalUser = true;
|
|
78
|
+
_context2.next = 13;
|
|
79
|
+
break;
|
|
80
|
+
case 10:
|
|
81
|
+
_context2.prev = 10;
|
|
82
|
+
_context2.t0 = _context2["catch"](4);
|
|
83
|
+
isInternalUser = false;
|
|
84
|
+
case 13:
|
|
85
|
+
return _context2.abrupt("return", isInternalUser);
|
|
86
|
+
case 14:
|
|
87
|
+
case "end":
|
|
88
|
+
return _context2.stop();
|
|
89
|
+
}
|
|
90
|
+
}, _callee2, null, [[4, 10]]);
|
|
91
|
+
}));
|
|
92
|
+
return function determineUserType() {
|
|
93
|
+
return _ref2.apply(this, arguments);
|
|
94
|
+
};
|
|
95
|
+
}();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/dumi-theme-antv",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3-beta.0",
|
|
4
4
|
"description": "AntV website theme based on dumi2.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dumi",
|
|
@@ -129,7 +129,8 @@
|
|
|
129
129
|
"react-dom": ">=16.9.0"
|
|
130
130
|
},
|
|
131
131
|
"publishConfig": {
|
|
132
|
-
"access": "public"
|
|
132
|
+
"access": "public",
|
|
133
|
+
"tag": "beta"
|
|
133
134
|
},
|
|
134
135
|
"authors": [
|
|
135
136
|
"dumi",
|