@antv/dumi-theme-antv 0.6.4-beta.3 → 0.6.4-beta.4
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/builtins/Playground/index.js +1 -1
- package/dist/common/ClientOnly.js +21 -0
- package/dist/common/CommonHelmet.js +85 -0
- package/dist/common/InViewSuspense.js +29 -0
- package/dist/hooks/useLocale.js +11 -0
- package/dist/hooks/useMenu.js +68 -73
- package/dist/layouts/DocLayout.js +32 -23
- package/dist/layouts/IndexLayout/index.js +16 -0
- package/dist/layouts/{entry/Manual.js → ManualLayout/index.js} +6 -6
- package/dist/pages/404.js +5 -4
- package/dist/pages/Example/index.js +76 -53
- package/dist/pages/Examples/components/ExampleTopicMenu/index.js +3 -2
- package/dist/pages/Examples/index.js +28 -32
- package/dist/{slots → pages/Index/components}/Cases/index.js +1 -1
- package/dist/{slots → pages/Index/components}/Detail/News.js +1 -1
- package/dist/{slots → pages/Index/components}/Detail/index.js +1 -1
- package/dist/{slots → pages/Index/components}/Features/FeatureCard.js +1 -1
- package/dist/{slots → pages/Index/components}/Features/index.js +1 -1
- package/dist/pages/Index/components/_.less +119 -0
- package/dist/{layouts/entry/Index.js → pages/Index/index.js} +18 -22
- package/dist/plugin/index.js +52 -43
- package/dist/slots/CodeEditor/index.js +4 -3
- package/dist/slots/CodePreview/CodeHeader.js +3 -2
- package/dist/slots/CodePreview/index.js +3 -2
- package/dist/slots/CodeRunner/index.js +34 -29
- package/dist/slots/ExampleSider/index.js +3 -2
- package/dist/slots/Feedback/Contributors.js +3 -2
- package/dist/slots/Feedback/EditButton.js +3 -2
- package/dist/slots/Feedback/PageFeedback.js +4 -3
- package/dist/slots/Feedback/SectionFeedback.js +3 -2
- package/dist/slots/Feedback/index.js +12 -10
- package/dist/slots/Footer/index.js +3 -2
- package/dist/slots/Header/Navs.js +66 -6
- package/dist/slots/Header/Search/index.js +1 -1
- package/dist/slots/Header/index.js +64 -105
- package/dist/slots/ManualContent/Main.js +16 -17
- package/dist/slots/ManualContent/NavigatorBanner.js +4 -2
- package/dist/slots/ManualContent/ObPreview.js +17 -0
- package/dist/slots/ManualContent/index.js +11 -4
- package/dist/slots/ManualContent/usePreview.js +6 -1
- package/dist/slots/ManualContent/utils.js +3 -13
- package/dist/slots/global.js +4 -4
- package/dist/slots/hooks.js +0 -25
- package/dist/slots/utils.js +0 -7
- package/dist/utils/env.js +10 -0
- package/dist/utils/location.js +6 -0
- package/dist/utils/user.js +13 -25
- package/package.json +5 -4
- package/dist/common/SEO.js +0 -61
- package/dist/layouts/entry/API.js +0 -12
- package/dist/pages/Example/utils.js +0 -9
- package/dist/slots/Article/index.js +0 -9
- package/dist/slots/Article/index.module.less +0 -8
- package/dist/slots/CodePreview/CodeHeader.module.less +0 -0
- package/dist/slots/Header/Products/NavigatorBanner.js +0 -29
- package/dist/slots/Header/Products/NavigatorBanner.module.less +0 -39
- /package/dist/{slots → pages/Index/components}/Cases/index.module.less +0 -0
- /package/dist/{slots → pages/Index/components}/Companies/index.js +0 -0
- /package/dist/{slots → pages/Index/components}/Companies/index.module.less +0 -0
- /package/dist/{slots → pages/Index/components}/Detail/News.module.less +0 -0
- /package/dist/{slots → pages/Index/components}/Detail/index.module.less +0 -0
- /package/dist/{slots → pages/Index/components}/Features/FeatureCard.module.less +0 -0
- /package/dist/{slots → pages/Index/components}/Features/index.module.less +0 -0
package/dist/utils/user.js
CHANGED
|
@@ -35,7 +35,7 @@ var fetchWithTimeout = /*#__PURE__*/function () {
|
|
|
35
35
|
case 7:
|
|
36
36
|
response = _context.sent;
|
|
37
37
|
clearTimeout(timeoutId);
|
|
38
|
-
return _context.abrupt("return", response
|
|
38
|
+
return _context.abrupt("return", response);
|
|
39
39
|
case 12:
|
|
40
40
|
_context.prev = 12;
|
|
41
41
|
_context.t0 = _context["catch"](4);
|
|
@@ -51,8 +51,6 @@ var fetchWithTimeout = /*#__PURE__*/function () {
|
|
|
51
51
|
return _ref.apply(this, arguments);
|
|
52
52
|
};
|
|
53
53
|
}();
|
|
54
|
-
|
|
55
|
-
// 仅限于蚂蚁用户为 true
|
|
56
54
|
var isInternalUser;
|
|
57
55
|
|
|
58
56
|
/**
|
|
@@ -60,7 +58,7 @@ var isInternalUser;
|
|
|
60
58
|
*/
|
|
61
59
|
export var determineUserType = /*#__PURE__*/function () {
|
|
62
60
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
63
|
-
var url, timeout
|
|
61
|
+
var url, timeout;
|
|
64
62
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
65
63
|
while (1) switch (_context2.prev = _context2.next) {
|
|
66
64
|
case 0:
|
|
@@ -70,36 +68,26 @@ export var determineUserType = /*#__PURE__*/function () {
|
|
|
70
68
|
}
|
|
71
69
|
return _context2.abrupt("return", isInternalUser);
|
|
72
70
|
case 2:
|
|
73
|
-
url = 'https://
|
|
74
|
-
timeout = 5000;
|
|
71
|
+
url = 'https://webgw.antgroup-inc.cn/180020010001271369/visservice/api/oneclip';
|
|
72
|
+
timeout = 5000; // 请求超时设置
|
|
75
73
|
_context2.prev = 4;
|
|
76
74
|
_context2.next = 7;
|
|
77
|
-
return fetchWithTimeout(url, {
|
|
78
|
-
method: 'GET',
|
|
79
|
-
headers: {
|
|
80
|
-
'Content-Type': 'application/json; charset=utf-8'
|
|
81
|
-
}
|
|
82
|
-
}, timeout);
|
|
75
|
+
return fetchWithTimeout(url, {}, timeout);
|
|
83
76
|
case 7:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
isInternalUser = false; // 集团用户
|
|
87
|
-
} else {
|
|
88
|
-
isInternalUser = true; // 蚂蚁用户
|
|
89
|
-
}
|
|
90
|
-
_context2.next = 14;
|
|
77
|
+
isInternalUser = true;
|
|
78
|
+
_context2.next = 13;
|
|
91
79
|
break;
|
|
92
|
-
case
|
|
93
|
-
_context2.prev =
|
|
80
|
+
case 10:
|
|
81
|
+
_context2.prev = 10;
|
|
94
82
|
_context2.t0 = _context2["catch"](4);
|
|
95
|
-
isInternalUser = false;
|
|
96
|
-
case
|
|
83
|
+
isInternalUser = false;
|
|
84
|
+
case 13:
|
|
97
85
|
return _context2.abrupt("return", isInternalUser);
|
|
98
|
-
case
|
|
86
|
+
case 14:
|
|
99
87
|
case "end":
|
|
100
88
|
return _context2.stop();
|
|
101
89
|
}
|
|
102
|
-
}, _callee2, null, [[4,
|
|
90
|
+
}, _callee2, null, [[4, 10]]);
|
|
103
91
|
}));
|
|
104
92
|
return function determineUserType() {
|
|
105
93
|
return _ref2.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/dumi-theme-antv",
|
|
3
|
-
"version": "0.6.4-beta.
|
|
3
|
+
"version": "0.6.4-beta.4",
|
|
4
4
|
"description": "AntV website theme based on dumi2.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dumi",
|
|
@@ -67,14 +67,13 @@
|
|
|
67
67
|
"monaco-editor": "^0.25.2",
|
|
68
68
|
"nprogress": "^0.2.0",
|
|
69
69
|
"parse-github-url": "^1.0.3",
|
|
70
|
-
"prettier": "^2.8.8",
|
|
71
70
|
"rc-drawer": "^4.4.3",
|
|
72
71
|
"rc-footer": "^0.6.8",
|
|
73
72
|
"react": "^18.3.1",
|
|
74
73
|
"react-dom": "^18.3.1",
|
|
75
74
|
"react-error-boundary": "^3.1.4",
|
|
76
75
|
"react-github-button": "^0.1.11",
|
|
77
|
-
"react-
|
|
76
|
+
"react-intersection-observer": "^9.16.0",
|
|
78
77
|
"react-markdown": "^9.0.1",
|
|
79
78
|
"react-router-dom": "^6.28.0",
|
|
80
79
|
"react-slick": "^0.29.0",
|
|
@@ -119,6 +118,7 @@
|
|
|
119
118
|
"less": "^4.2.1",
|
|
120
119
|
"less-loader": "^12.2.0",
|
|
121
120
|
"lint-staged": "^13.3.0",
|
|
121
|
+
"prettier": "^2.8.8",
|
|
122
122
|
"prettier-plugin-organize-imports": "^3.2.4",
|
|
123
123
|
"prettier-plugin-packagejson": "^2.5.3",
|
|
124
124
|
"stylelint": "^14.16.1"
|
|
@@ -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",
|
package/dist/common/SEO.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
-
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; }
|
|
7
|
-
import { Helmet, useLocale, useRouteMeta, useSiteData } from 'dumi';
|
|
8
|
-
import React from 'react';
|
|
9
|
-
var SEO = function SEO(_ref) {
|
|
10
|
-
var titleSuffix = _ref.titleSuffix,
|
|
11
|
-
propTitle = _ref.title,
|
|
12
|
-
propDescription = _ref.description,
|
|
13
|
-
_ref$meta = _ref.meta,
|
|
14
|
-
propMeta = _ref$meta === void 0 ? [] : _ref$meta;
|
|
15
|
-
var meta = useRouteMeta();
|
|
16
|
-
var locale = useLocale();
|
|
17
|
-
var lang = locale.id;
|
|
18
|
-
var _useSiteData = useSiteData(),
|
|
19
|
-
themeConfig = _useSiteData.themeConfig;
|
|
20
|
-
var defaultTitle = themeConfig.title,
|
|
21
|
-
defaultDescription = themeConfig.defaultDescription;
|
|
22
|
-
var title = propTitle || meta.frontmatter.title;
|
|
23
|
-
var description = propDescription || meta.frontmatter.description || defaultDescription;
|
|
24
|
-
var defaultMeta = [{
|
|
25
|
-
name: "description",
|
|
26
|
-
content: description
|
|
27
|
-
}, {
|
|
28
|
-
property: "og:title",
|
|
29
|
-
content: title
|
|
30
|
-
}, {
|
|
31
|
-
property: "og:description",
|
|
32
|
-
content: description
|
|
33
|
-
}, {
|
|
34
|
-
property: "og:image",
|
|
35
|
-
content: 'https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png'
|
|
36
|
-
}, {
|
|
37
|
-
property: "og:type",
|
|
38
|
-
content: "website"
|
|
39
|
-
}, {
|
|
40
|
-
name: "twitter:card",
|
|
41
|
-
content: "summary"
|
|
42
|
-
}, {
|
|
43
|
-
name: "twitter:title",
|
|
44
|
-
content: title
|
|
45
|
-
}, {
|
|
46
|
-
name: "twitter:description",
|
|
47
|
-
content: description
|
|
48
|
-
}, {
|
|
49
|
-
property: "twitter:image",
|
|
50
|
-
content: 'https://gw.alipayobjects.com/zos/antfincdn/FLrTNDvlna/antv.png'
|
|
51
|
-
}];
|
|
52
|
-
return /*#__PURE__*/React.createElement(Helmet, {
|
|
53
|
-
htmlAttributes: {
|
|
54
|
-
lang: lang
|
|
55
|
-
},
|
|
56
|
-
titleTemplate: "%s | ".concat(titleSuffix || defaultTitle),
|
|
57
|
-
title: title,
|
|
58
|
-
meta: [].concat(defaultMeta, _toConsumableArray(propMeta))
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
export default SEO;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Manual } from "./Manual";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* API 路由下的入口
|
|
6
|
-
* - 读取 API markdown 文件
|
|
7
|
-
* - 渲染 UI
|
|
8
|
-
*/
|
|
9
|
-
export var API = function API(_ref) {
|
|
10
|
-
var children = _ref.children;
|
|
11
|
-
return /*#__PURE__*/React.createElement(Manual, null, children);
|
|
12
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export function getCurrentTitle(exampleTopics, topic, example) {
|
|
2
|
-
var topicItem = exampleTopics.find(function (item) {
|
|
3
|
-
return item.id === topic;
|
|
4
|
-
});
|
|
5
|
-
var exmapleItem = topicItem.examples.find(function (item) {
|
|
6
|
-
return item.id === example;
|
|
7
|
-
});
|
|
8
|
-
return exmapleItem.title;
|
|
9
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Layout } from 'antd';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import styles from "./index.module.less";
|
|
4
|
-
var Article = function Article(props) {
|
|
5
|
-
return /*#__PURE__*/React.createElement(Layout.Content, {
|
|
6
|
-
className: styles.article
|
|
7
|
-
}, /*#__PURE__*/React.createElement("article", props));
|
|
8
|
-
};
|
|
9
|
-
export default Article;
|
|
File without changes
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import { FormattedMessage, Link } from 'dumi';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import styles from "./NavigatorBanner.module.less";
|
|
5
|
-
var NavigatorBanner = function NavigatorBanner(_ref) {
|
|
6
|
-
var post = _ref.post,
|
|
7
|
-
type = _ref.type;
|
|
8
|
-
if (!post) {
|
|
9
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
10
|
-
className: classNames(styles.button, styles.hidden)
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
var slug = post.slug,
|
|
14
|
-
title = post.title;
|
|
15
|
-
if (!slug || !title) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
return /*#__PURE__*/React.createElement(Link, {
|
|
19
|
-
to: slug,
|
|
20
|
-
className: classNames(styles.button, styles[type])
|
|
21
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
22
|
-
className: styles.label
|
|
23
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
24
|
-
id: type === 'prev' ? '上一篇' : '下一篇'
|
|
25
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
26
|
-
className: styles.title
|
|
27
|
-
}, title));
|
|
28
|
-
};
|
|
29
|
-
export default NavigatorBanner;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
.button {
|
|
2
|
-
width: 50%;
|
|
3
|
-
display: inline-block;
|
|
4
|
-
margin-top: 32px;
|
|
5
|
-
padding: 32px 0 0;
|
|
6
|
-
cursor: pointer;
|
|
7
|
-
border-top: 1px solid #e8e8e8;
|
|
8
|
-
line-height: 1.5;
|
|
9
|
-
vertical-align: top;
|
|
10
|
-
|
|
11
|
-
&.hidden {
|
|
12
|
-
height: 86px;
|
|
13
|
-
cursor: auto;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.label {
|
|
17
|
-
margin-bottom: 8px;
|
|
18
|
-
font-size: 14px;
|
|
19
|
-
color: #bfbfbf;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.title {
|
|
23
|
-
font-size: 16px;
|
|
24
|
-
font-weight: 500;
|
|
25
|
-
color: #333;
|
|
26
|
-
transition: all 0.3s;
|
|
27
|
-
white-space: nowrap;
|
|
28
|
-
overflow: hidden;
|
|
29
|
-
text-overflow: ellipsis;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&:hover .title {
|
|
33
|
-
color: #000;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&.next {
|
|
37
|
-
text-align: right;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|