@antv/dumi-theme-antv 0.5.0 → 0.5.1
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/README.md +4 -1
- package/dist/plugin/examples.js +1 -1
- package/dist/slots/CodeEditor/index.js +1 -1
- package/dist/slots/Detail/index.js +3 -1
- package/dist/slots/Footer/index.js +11 -0
- package/dist/slots/Header/Products/Product.module.less +9 -0
- package/dist/slots/Header/Products/index.d.ts +1 -0
- package/dist/slots/Header/Products/index.js +3 -2
- package/dist/slots/Header/index.js +14 -13
- package/dist/slots/Loading/index.d.ts +2 -3
- package/dist/slots/Loading/index.js +1 -8
- package/dist/slots/ManualContent/index.module.less +2 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ TODO
|
|
|
34
34
|
## Development
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
$
|
|
37
|
+
$ npm install
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
After the dependencies are installed, a symlink from `example/.dumi/theme` to `../../src` will be created automatically, the symlink makes dumi load our theme package as a local theme, so we can start the example directly, HMR is also available:
|
|
@@ -43,6 +43,9 @@ After the dependencies are installed, a symlink from `example/.dumi/theme` to `.
|
|
|
43
43
|
# switch to example directory
|
|
44
44
|
$ cd example
|
|
45
45
|
|
|
46
|
+
# downloads the dependencies
|
|
47
|
+
npm install
|
|
48
|
+
|
|
46
49
|
# start dev server to preview
|
|
47
50
|
npm run dev
|
|
48
51
|
```
|
package/dist/plugin/examples.js
CHANGED
|
@@ -57,7 +57,7 @@ var getExampleDemos = (exampleDir) => {
|
|
|
57
57
|
return demos;
|
|
58
58
|
};
|
|
59
59
|
var getTopicExamples = (topicPath, showAPIDoc) => {
|
|
60
|
-
const examplePaths = glob.sync(`${topicPath}/*`).filter((item) => {
|
|
60
|
+
const examplePaths = glob.sync(`${topicPath.replace(/\\/g, "/")}/*`).filter((item) => {
|
|
61
61
|
return !item.endsWith(".js");
|
|
62
62
|
});
|
|
63
63
|
return examplePaths.map((item) => {
|
|
@@ -21,7 +21,7 @@ import { format } from 'prettier';
|
|
|
21
21
|
import parserBabel from 'prettier/parser-babel';
|
|
22
22
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
23
23
|
import { bind, clear } from 'size-sensor';
|
|
24
|
-
import
|
|
24
|
+
import Loading from "dumi/theme/slots/Loading";
|
|
25
25
|
import { EDITOR_TABS, Toolbar } from "./Toolbar";
|
|
26
26
|
import styles from "./index.module.less";
|
|
27
27
|
import { compile, execute, replaceInsertCss } from "./utils";
|
|
@@ -47,7 +47,9 @@ export var Detail = function Detail(_ref) {
|
|
|
47
47
|
setRemoteNews = _useState2[1];
|
|
48
48
|
var lang = useLocale().id;
|
|
49
49
|
useEffect(function () {
|
|
50
|
-
fetch('https://
|
|
50
|
+
fetch('https://assets.antv.antgroup.com/antv/banner-messages.json' // 生产环境
|
|
51
|
+
// 'https://site-data-pre.alipay.com/antv/banner-messages.json', // 预发测试
|
|
52
|
+
).then(function (res) {
|
|
51
53
|
return res.json();
|
|
52
54
|
}).then(function (data) {
|
|
53
55
|
setRemoteNews(data);
|
|
@@ -171,6 +171,17 @@ export var Footer = function Footer(props) {
|
|
|
171
171
|
}),
|
|
172
172
|
url: 'https://kitchen.alipay.com',
|
|
173
173
|
openExternal: true
|
|
174
|
+
}, {
|
|
175
|
+
icon: /*#__PURE__*/React.createElement("img", {
|
|
176
|
+
src: "https://mdn.alipayobjects.com/huamei_j9rjmc/afts/img/A*3ittT5OEo2gAAAAAAAAAAAAADvGmAQ/original",
|
|
177
|
+
width: 16,
|
|
178
|
+
height: 16,
|
|
179
|
+
alt: "Galacean"
|
|
180
|
+
}),
|
|
181
|
+
title: "Galacean",
|
|
182
|
+
description: "互动图形解决方案",
|
|
183
|
+
url: 'https://galacean.antgroup.com/',
|
|
184
|
+
openExternal: true
|
|
174
185
|
}, {
|
|
175
186
|
icon: /*#__PURE__*/React.createElement("img", {
|
|
176
187
|
src: "https://gw.alipayobjects.com/zos/rmsportal/nBVXkrFdWHxbZlmMbsaH.svg",
|
|
@@ -18,7 +18,8 @@ import styles from "./Product.module.less";
|
|
|
18
18
|
export var Products = function Products(_ref) {
|
|
19
19
|
var show = _ref.show,
|
|
20
20
|
language = _ref.language,
|
|
21
|
-
className = _ref.className
|
|
21
|
+
className = _ref.className,
|
|
22
|
+
bannerVisible = _ref.bannerVisible;
|
|
22
23
|
var locale = useLocale();
|
|
23
24
|
var _useChinaMirrorHost = useChinaMirrorHost(),
|
|
24
25
|
_useChinaMirrorHost2 = _slicedToArray(_useChinaMirrorHost, 1),
|
|
@@ -37,7 +38,7 @@ export var Products = function Products(_ref) {
|
|
|
37
38
|
});
|
|
38
39
|
}, [lang, isChinaMirrorHost]);
|
|
39
40
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
40
|
-
className: cx(styles.products, className, _defineProperty({}, styles.show, !!show))
|
|
41
|
+
className: cx(styles.products, className, _defineProperty(_defineProperty({}, styles.show, !!show), styles.bannerVisible, !!bannerVisible))
|
|
41
42
|
}, /*#__PURE__*/React.createElement("div", {
|
|
42
43
|
className: styles.container
|
|
43
44
|
}, CATEGORIES.map(function (_ref2, idx) {
|
|
@@ -71,13 +71,6 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
71
71
|
_useState2 = _slicedToArray(_useState, 2),
|
|
72
72
|
bannerVisible = _useState2[0],
|
|
73
73
|
setBannerVisible = _useState2[1];
|
|
74
|
-
useEffect(function () {
|
|
75
|
-
setBannerVisible(localStorage.getItem(ANNOUNCEMENT_LOCALSTORAGE_ID) !== 'true');
|
|
76
|
-
}, [announcement]);
|
|
77
|
-
function onBannerClose() {
|
|
78
|
-
localStorage.setItem(ANNOUNCEMENT_LOCALSTORAGE_ID, 'true');
|
|
79
|
-
setBannerVisible(false);
|
|
80
|
-
}
|
|
81
74
|
var showChinaMirror = !!internalSite;
|
|
82
75
|
var chinaMirrorUrl = get(internalSite, 'url');
|
|
83
76
|
var _useState3 = useState(false),
|
|
@@ -100,6 +93,19 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
100
93
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
101
94
|
lang = _useState6[0],
|
|
102
95
|
setLang = _useState6[1];
|
|
96
|
+
var announcementTitle = useMemo(function () {
|
|
97
|
+
return get(announcement, ['title', lang]);
|
|
98
|
+
}, [announcement, lang]);
|
|
99
|
+
var announcementLinkTitle = useMemo(function () {
|
|
100
|
+
return get(announcement, ['link', 'text', lang]);
|
|
101
|
+
}, [announcement, lang]);
|
|
102
|
+
useEffect(function () {
|
|
103
|
+
setBannerVisible(!!announcementTitle && localStorage.getItem(ANNOUNCEMENT_LOCALSTORAGE_ID) !== 'true');
|
|
104
|
+
}, [announcementTitle]);
|
|
105
|
+
function onBannerClose() {
|
|
106
|
+
localStorage.setItem(ANNOUNCEMENT_LOCALSTORAGE_ID, 'true');
|
|
107
|
+
setBannerVisible(false);
|
|
108
|
+
}
|
|
103
109
|
var _useState7 = useState(false),
|
|
104
110
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
105
111
|
productMenuVisible = _useState8[0],
|
|
@@ -296,6 +302,7 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
296
302
|
className: cx(styles.arrow, _defineProperty({}, styles.open, productMenuVisible))
|
|
297
303
|
})), /*#__PURE__*/React.createElement(Products, {
|
|
298
304
|
className: styles.productsMenu,
|
|
305
|
+
bannerVisible: bannerVisible,
|
|
299
306
|
show: productMenuVisible,
|
|
300
307
|
rootDomain: rootDomain,
|
|
301
308
|
language: defaultLanguage
|
|
@@ -394,12 +401,6 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
394
401
|
target: "_blank",
|
|
395
402
|
rel: "noreferrer"
|
|
396
403
|
}, /*#__PURE__*/React.createElement(GithubOutlined, null))));
|
|
397
|
-
var announcementTitle = useMemo(function () {
|
|
398
|
-
return get(announcement, ['title', lang]);
|
|
399
|
-
}, [announcement, lang]);
|
|
400
|
-
var announcementLinkTitle = useMemo(function () {
|
|
401
|
-
return get(announcement, ['link', 'text', lang]);
|
|
402
|
-
}, [announcement, lang]);
|
|
403
404
|
return /*#__PURE__*/React.createElement("header", {
|
|
404
405
|
className: cx(styles.header, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.transparent, !!transparent && !productMenuVisible), styles.isHomePage, !!isHomePage && !isAntVHome), styles.lightTheme, !!isAntVHome && !productMenuVisible && isWide), styles.isAntVHome, !!isAntVHome), styles.fixed, popupMenuVisible))
|
|
405
406
|
}, bannerVisible && announcementTitle && /*#__PURE__*/React.createElement(Alert, {
|
|
@@ -67,11 +67,4 @@ var Loading = function Loading() {
|
|
|
67
67
|
className: "loading-text"
|
|
68
68
|
}, /*#__PURE__*/React.createElement("p", null, "Loading...")))));
|
|
69
69
|
};
|
|
70
|
-
|
|
71
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
72
|
-
style: {
|
|
73
|
-
height: '100vh'
|
|
74
|
-
}
|
|
75
|
-
}, /*#__PURE__*/React.createElement(Loading, null));
|
|
76
|
-
};
|
|
77
|
-
export { Loading, PageLoading };
|
|
70
|
+
export default Loading;
|
|
@@ -254,7 +254,7 @@
|
|
|
254
254
|
font-size: 12px;
|
|
255
255
|
background: #fff;
|
|
256
256
|
max-height: 100vh;
|
|
257
|
-
overflow:
|
|
257
|
+
overflow: auto;
|
|
258
258
|
|
|
259
259
|
position: sticky;
|
|
260
260
|
top: 0;
|
|
@@ -693,4 +693,4 @@
|
|
|
693
693
|
transition: all .3s;
|
|
694
694
|
background-color: #fff;
|
|
695
695
|
font-family: Avenir, -apple-system, BlinkMacSystemFont, Segoe UI, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
|
|
696
|
-
}
|
|
696
|
+
}
|
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.1",
|
|
4
4
|
"description": "AntV website theme based on dumi2.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dumi",
|
|
@@ -105,6 +105,7 @@
|
|
|
105
105
|
"@types/classnames": "^2.3.1",
|
|
106
106
|
"@types/fs-extra": "^9.0.13",
|
|
107
107
|
"@types/glob": "^8.0.0",
|
|
108
|
+
"@types/hast": "^2.3.5",
|
|
108
109
|
"@types/lodash-es": "^4.17.6",
|
|
109
110
|
"@types/node": "^18.11.3",
|
|
110
111
|
"@types/react": "^18.0.21",
|