@antv/dumi-theme-antv 0.3.19-beta.1 → 0.3.20
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.
|
@@ -6,8 +6,8 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { Layout } from 'antd';
|
|
8
8
|
import { useLocale, useSiteData } from 'dumi';
|
|
9
|
-
import { get } from 'lodash-es';
|
|
10
|
-
import React, { useContext, useEffect, useState } from 'react';
|
|
9
|
+
import { get, find } from 'lodash-es';
|
|
10
|
+
import React, { useContext, useEffect, useState, useMemo } from 'react';
|
|
11
11
|
import { useLocation, useNavigate, useParams } from 'react-router-dom';
|
|
12
12
|
import { ThemeAntVContext } from "../../context";
|
|
13
13
|
import { CodeRunner } from "dumi/theme/slots/CodeRunner";
|
|
@@ -35,7 +35,15 @@ var Example = function Example() {
|
|
|
35
35
|
var _useSiteData = useSiteData(),
|
|
36
36
|
themeConfig = _useSiteData.themeConfig;
|
|
37
37
|
var exampleTopics = metaData.meta.exampleTopics;
|
|
38
|
-
var demo =
|
|
38
|
+
var demo = useMemo(function () {
|
|
39
|
+
var examples = get(exampleTopics, ['0', 'examples']);
|
|
40
|
+
var exampleDemo = find(examples, function (_ref) {
|
|
41
|
+
var id = _ref.id;
|
|
42
|
+
return id === example;
|
|
43
|
+
});
|
|
44
|
+
// examples/case/id hash 为空,可以默认第一个 example 对应的 demo
|
|
45
|
+
return hash.slice(1) || get(exampleDemo, ['demos', '0', 'id']);
|
|
46
|
+
}, [hash, exampleTopics, example]);
|
|
39
47
|
var _useState = useState(),
|
|
40
48
|
_useState2 = _slicedToArray(_useState, 2),
|
|
41
49
|
currentDemo = _useState2[0],
|
|
@@ -17,7 +17,7 @@ import { useNavigate } from "react-router-dom";
|
|
|
17
17
|
import cx from 'classnames';
|
|
18
18
|
import { useSiteData, useLocale, FormattedMessage } from 'dumi';
|
|
19
19
|
import { GithubOutlined, MenuOutlined, CaretDownFilled, DownOutlined, WechatOutlined, LinkOutlined, CheckOutlined } from '@ant-design/icons';
|
|
20
|
-
import { Modal, Button, Popover, Menu, Dropdown, Select } from 'antd';
|
|
20
|
+
import { Alert, Modal, Button, Popover, Menu, Dropdown, Select } from 'antd';
|
|
21
21
|
import { get, map, size } from 'lodash-es';
|
|
22
22
|
import { Search } from "./Search";
|
|
23
23
|
import { Products } from "./Products";
|
|
@@ -30,6 +30,13 @@ import styles from "./index.module.less";
|
|
|
30
30
|
function redirectChinaMirror(chinaMirrorOrigin) {
|
|
31
31
|
window.location.href = window.location.href.replace(window.location.origin, chinaMirrorOrigin);
|
|
32
32
|
}
|
|
33
|
+
function fetchBanner() {
|
|
34
|
+
return fetch('https://assets.antv.antgroup.com/antv/banner.json' // 生产环境
|
|
35
|
+
// 'https://site-data-pre.alipay.com/antv/banner.json', // 预发测试
|
|
36
|
+
).then(function (res) {
|
|
37
|
+
return res.json();
|
|
38
|
+
});
|
|
39
|
+
}
|
|
33
40
|
|
|
34
41
|
/**
|
|
35
42
|
* 头部菜单
|
|
@@ -76,12 +83,40 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
76
83
|
searchOptions = _ref.searchOptions;
|
|
77
84
|
var isAntVHome = isAntVSite && isHomePage; // 是否为AntV官网首页
|
|
78
85
|
|
|
79
|
-
var showChinaMirror = !!internalSite;
|
|
80
|
-
var chinaMirrorUrl = get(internalSite, 'url');
|
|
81
86
|
var _useState = useState(false),
|
|
82
87
|
_useState2 = _slicedToArray(_useState, 2),
|
|
83
|
-
|
|
84
|
-
|
|
88
|
+
bannerVisible = _useState2[0],
|
|
89
|
+
setBannerVisible = _useState2[1];
|
|
90
|
+
var _useState3 = useState(null),
|
|
91
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
92
|
+
banner = _useState4[0],
|
|
93
|
+
setBanner = _useState4[1];
|
|
94
|
+
useEffect(function () {
|
|
95
|
+
fetchBanner().then(function (_ref2) {
|
|
96
|
+
var id = _ref2.id,
|
|
97
|
+
html = _ref2.html;
|
|
98
|
+
if (id && html) {
|
|
99
|
+
setBanner({
|
|
100
|
+
id: id,
|
|
101
|
+
html: html
|
|
102
|
+
});
|
|
103
|
+
setBannerVisible(localStorage.getItem(id) !== 'x');
|
|
104
|
+
}
|
|
105
|
+
}).catch(function () {
|
|
106
|
+
setBanner(null);
|
|
107
|
+
setBannerVisible(false);
|
|
108
|
+
});
|
|
109
|
+
}, []);
|
|
110
|
+
function onBannerClose() {
|
|
111
|
+
localStorage.setItem(banner.id, 'x');
|
|
112
|
+
setBannerVisible(false);
|
|
113
|
+
}
|
|
114
|
+
var showChinaMirror = !!internalSite;
|
|
115
|
+
var chinaMirrorUrl = get(internalSite, 'url');
|
|
116
|
+
var _useState5 = useState(false),
|
|
117
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
118
|
+
chinaMirrorHintVisible = _useState6[0],
|
|
119
|
+
updateChinaMirrorHintVisible = _useState6[1];
|
|
85
120
|
useEffect(function () {
|
|
86
121
|
var timeout = setTimeout(function () {
|
|
87
122
|
if (showChinaMirror && lang === 'zh' && !localStorage.getItem('china-mirror-no-more-hint') && window.location.host.includes('antv.vision')) {
|
|
@@ -94,14 +129,14 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
94
129
|
});
|
|
95
130
|
var locale = useLocale();
|
|
96
131
|
var nav = useNavigate();
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
lang =
|
|
100
|
-
setLang =
|
|
101
|
-
var
|
|
102
|
-
|
|
103
|
-
productMenuVisible =
|
|
104
|
-
setProductMenuVisible =
|
|
132
|
+
var _useState7 = useState(locale.id),
|
|
133
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
134
|
+
lang = _useState8[0],
|
|
135
|
+
setLang = _useState8[1];
|
|
136
|
+
var _useState9 = useState(false),
|
|
137
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
138
|
+
productMenuVisible = _useState10[0],
|
|
139
|
+
setProductMenuVisible = _useState10[1];
|
|
105
140
|
var productMenuHovering = false;
|
|
106
141
|
var onProductMouseEnter = function onProductMouseEnter(e) {
|
|
107
142
|
productMenuHovering = true;
|
|
@@ -125,10 +160,10 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
125
160
|
var onToggleProductMenuVisible = function onToggleProductMenuVisible() {
|
|
126
161
|
setProductMenuVisible(!productMenuVisible);
|
|
127
162
|
};
|
|
128
|
-
var
|
|
129
|
-
|
|
130
|
-
popupMenuVisible =
|
|
131
|
-
setPopupMenuVisible =
|
|
163
|
+
var _useState11 = useState(false),
|
|
164
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
165
|
+
popupMenuVisible = _useState12[0],
|
|
166
|
+
setPopupMenuVisible = _useState12[1];
|
|
132
167
|
var onTogglePopupMenuVisible = function onTogglePopupMenuVisible() {
|
|
133
168
|
setPopupMenuVisible(!popupMenuVisible);
|
|
134
169
|
};
|
|
@@ -180,9 +215,9 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
180
215
|
}) : null, /** 生态产品 */
|
|
181
216
|
size(ecosystems) ? /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
182
217
|
className: styles.ecoSystems,
|
|
183
|
-
overlay: /*#__PURE__*/React.createElement(Menu, null, map(ecosystems, function (
|
|
184
|
-
var url =
|
|
185
|
-
ecosystemName =
|
|
218
|
+
overlay: /*#__PURE__*/React.createElement(Menu, null, map(ecosystems, function (_ref3) {
|
|
219
|
+
var url = _ref3.url,
|
|
220
|
+
ecosystemName = _ref3.name;
|
|
186
221
|
return /*#__PURE__*/React.createElement(Menu.Item, {
|
|
187
222
|
key: ecosystemName === null || ecosystemName === void 0 ? void 0 : ecosystemName[lang]
|
|
188
223
|
}, /*#__PURE__*/React.createElement("a", {
|
|
@@ -311,8 +346,8 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
311
346
|
overlay: /*#__PURE__*/React.createElement(Menu, {
|
|
312
347
|
defaultSelectedKeys: [lang],
|
|
313
348
|
selectable: true,
|
|
314
|
-
onSelect: function onSelect(
|
|
315
|
-
var key =
|
|
349
|
+
onSelect: function onSelect(_ref4) {
|
|
350
|
+
var key = _ref4.key;
|
|
316
351
|
if (key === lang) {
|
|
317
352
|
return;
|
|
318
353
|
}
|
|
@@ -382,7 +417,19 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
382
417
|
}, /*#__PURE__*/React.createElement(GithubOutlined, null))));
|
|
383
418
|
return /*#__PURE__*/React.createElement("header", {
|
|
384
419
|
className: cx(styles.header, (_cx4 = {}, _defineProperty(_cx4, styles.transparent, !!transparent && !productMenuVisible), _defineProperty(_cx4, styles.isHomePage, !!isHomePage && !isAntVHome), _defineProperty(_cx4, styles.lightTheme, !!isAntVHome && !productMenuVisible && isWide), _defineProperty(_cx4, styles.fixed, popupMenuVisible), _cx4))
|
|
385
|
-
}, /*#__PURE__*/React.createElement(
|
|
420
|
+
}, bannerVisible && /*#__PURE__*/React.createElement(Alert, {
|
|
421
|
+
className: styles.banner,
|
|
422
|
+
message: /*#__PURE__*/React.createElement("div", {
|
|
423
|
+
dangerouslySetInnerHTML: {
|
|
424
|
+
__html: banner.html
|
|
425
|
+
}
|
|
426
|
+
}),
|
|
427
|
+
type: "info",
|
|
428
|
+
banner: true,
|
|
429
|
+
closable: true,
|
|
430
|
+
showIcon: false,
|
|
431
|
+
onClose: onBannerClose
|
|
432
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
386
433
|
className: styles.container
|
|
387
434
|
}, /*#__PURE__*/React.createElement("div", {
|
|
388
435
|
className: styles.left
|
|
@@ -79,9 +79,7 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
79
79
|
// 递归
|
|
80
80
|
rootList.forEach(function (item) {
|
|
81
81
|
var href = (!baseRoute.startsWith('/en') ? "/".concat(item.slug) : "/en/".concat(item.slug)).toLocaleLowerCase();
|
|
82
|
-
var
|
|
83
|
-
var splitCount = hasPrefix ? 3 : 2;
|
|
84
|
-
var id = href.split('/').splice(0, splitCount).join('/');
|
|
82
|
+
var id = href.split('/').slice(0, href.split('/').length - 1).join('/');
|
|
85
83
|
if (href.includes(baseRoute)) {
|
|
86
84
|
if (id === hrefId) {
|
|
87
85
|
list.push(_objectSpread(_objectSpread({}, item), {}, {
|
package/package.json
CHANGED
|
@@ -1,35 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/dumi-theme-antv",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.20",
|
|
4
4
|
"description": "AntV website theme based on dumi2.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"dumi",
|
|
7
|
-
"dumi-theme",
|
|
8
|
-
"dumi-theme-antv"
|
|
9
|
-
],
|
|
10
|
-
"homepage": "https://github.com/antvis/dumi-theme-antv#readme",
|
|
11
|
-
"bugs": {
|
|
12
|
-
"url": "https://github.com/antvis/dumi-theme-antv/issues"
|
|
13
|
-
},
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "https://github.com/antvis/dumi-theme-antv"
|
|
17
|
-
},
|
|
18
|
-
"license": "MIT",
|
|
19
5
|
"types": "dist/types.d.ts",
|
|
20
|
-
"files": [
|
|
21
|
-
"dist"
|
|
22
|
-
],
|
|
23
6
|
"scripts": {
|
|
24
|
-
"build": "father build",
|
|
25
7
|
"dev": "father dev",
|
|
26
8
|
"dev:example-site": "cd example && npm run start",
|
|
9
|
+
"build": "father build",
|
|
10
|
+
"prepare": "father link-dev-theme",
|
|
27
11
|
"lint": "npm run lint:es && npm run lint:css",
|
|
28
12
|
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
|
29
13
|
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
30
|
-
"prepare": "father link-dev-theme",
|
|
31
14
|
"prepublishOnly": "npm run build"
|
|
32
15
|
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"dumi",
|
|
18
|
+
"dumi-theme",
|
|
19
|
+
"dumi-theme-antv"
|
|
20
|
+
],
|
|
21
|
+
"authors": [
|
|
22
|
+
"dumi",
|
|
23
|
+
"antv"
|
|
24
|
+
],
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
33
29
|
"commitlint": {
|
|
34
30
|
"extends": [
|
|
35
31
|
"@commitlint/config-conventional"
|
|
@@ -52,6 +48,9 @@
|
|
|
52
48
|
"prettier --parser=typescript --write"
|
|
53
49
|
]
|
|
54
50
|
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
55
54
|
"dependencies": {
|
|
56
55
|
"@ant-design/icons": "^4.7.0",
|
|
57
56
|
"@babel/plugin-syntax-unicode-sets-regex": "^7.18.6",
|
|
@@ -74,7 +73,6 @@
|
|
|
74
73
|
"lodash-es": "^4.17.21",
|
|
75
74
|
"monaco-editor": "^0.25.0",
|
|
76
75
|
"parse-github-url": "^1.0.2",
|
|
77
|
-
"prettier": "^2.7.1",
|
|
78
76
|
"rc-drawer": "^4.0.0",
|
|
79
77
|
"rc-footer": "^0.6.6",
|
|
80
78
|
"react": "^18.2.0",
|
|
@@ -93,10 +91,15 @@
|
|
|
93
91
|
"unified": "^10.1.2",
|
|
94
92
|
"unist-util-visit": "^4.1.2",
|
|
95
93
|
"uri-parse": "^1.0.0",
|
|
96
|
-
"video-react": "^0.16.0"
|
|
94
|
+
"video-react": "^0.16.0",
|
|
95
|
+
"prettier": "^2.7.1"
|
|
96
|
+
},
|
|
97
|
+
"peerDependencies": {
|
|
98
|
+
"dumi": "^2.0.0",
|
|
99
|
+
"react": ">=16.9.0",
|
|
100
|
+
"react-dom": ">=16.9.0"
|
|
97
101
|
},
|
|
98
102
|
"devDependencies": {
|
|
99
|
-
"@antv/g2": "^4.2.10",
|
|
100
103
|
"@commitlint/cli": "^17.1.2",
|
|
101
104
|
"@commitlint/config-conventional": "^17.1.0",
|
|
102
105
|
"@types/classnames": "^2.3.1",
|
|
@@ -108,7 +111,6 @@
|
|
|
108
111
|
"@types/react-router-dom": "^5.3.3",
|
|
109
112
|
"@types/react-slick": "^0.23.10",
|
|
110
113
|
"@umijs/lint": "^4.0.0",
|
|
111
|
-
"d3-regression": "^1.3.10",
|
|
112
114
|
"dumi": "^2.0.0",
|
|
113
115
|
"eslint": "^8.23.0",
|
|
114
116
|
"father": "^4.1.0",
|
|
@@ -121,16 +123,12 @@
|
|
|
121
123
|
"react-dom": "^18.0.0",
|
|
122
124
|
"stylelint": "^14.9.1"
|
|
123
125
|
},
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
"react-dom": ">=16.9.0"
|
|
126
|
+
"repository": {
|
|
127
|
+
"type": "git",
|
|
128
|
+
"url": "https://github.com/antvis/dumi-theme-antv"
|
|
128
129
|
},
|
|
129
|
-
"
|
|
130
|
-
"
|
|
130
|
+
"bugs": {
|
|
131
|
+
"url": "https://github.com/antvis/dumi-theme-antv/issues"
|
|
131
132
|
},
|
|
132
|
-
"
|
|
133
|
-
"dumi",
|
|
134
|
-
"antv"
|
|
135
|
-
]
|
|
133
|
+
"homepage": "https://github.com/antvis/dumi-theme-antv#readme"
|
|
136
134
|
}
|