@antv/dumi-theme-antv 0.3.16 → 0.3.18
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/plugin/index.js +0 -2
- package/dist/plugin/rehypeObservable.js +0 -2
- package/dist/slots/Header/Products/Product.js +3 -5
- package/dist/slots/Header/Search/index.js +3 -2
- package/dist/slots/ManualContent/index.js +3 -3
- package/dist/slots/ManualContent/usePreview.d.ts +1 -1
- package/dist/slots/ManualContent/usePreview.js +7 -2
- package/package.json +3 -3
package/dist/plugin/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { FormattedMessage } from 'dumi';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import styles from "./Product.module.less";
|
|
4
4
|
var getTarget = function getTarget(url) {
|
|
5
5
|
return url.startsWith('http') && !url.includes('gitee.io') && !url.includes('antv.vision') ? '_blank' : '_self';
|
|
@@ -41,14 +41,12 @@ var Product = function Product(_ref) {
|
|
|
41
41
|
className: styles.productLinks
|
|
42
42
|
}, links.home && /*#__PURE__*/React.createElement("a", {
|
|
43
43
|
href: links.home.url,
|
|
44
|
-
target: getTarget(links.home.url || '')
|
|
45
|
-
key: links.home.url
|
|
44
|
+
target: getTarget(links.home.url || '')
|
|
46
45
|
}, (_links$home$title = links.home.title) !== null && _links$home$title !== void 0 ? _links$home$title : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
47
46
|
id: "\u4EA7\u54C1\u9996\u9875"
|
|
48
47
|
})), links.example && /*#__PURE__*/React.createElement("a", {
|
|
49
48
|
href: links.example.url,
|
|
50
|
-
target: getTarget(links.example.url || '')
|
|
51
|
-
key: links.example.url
|
|
49
|
+
target: getTarget(links.example.url || '')
|
|
52
50
|
}, (_links$example$title = links.example.title) !== null && _links$example$title !== void 0 ? _links$example$title : /*#__PURE__*/React.createElement(FormattedMessage, {
|
|
53
51
|
id: "\u56FE\u8868\u793A\u4F8B"
|
|
54
52
|
})))));
|
|
@@ -26,8 +26,9 @@ export var Search = function Search() {
|
|
|
26
26
|
}, [result]);
|
|
27
27
|
useEffect(function () {
|
|
28
28
|
var close = function close(e) {
|
|
29
|
-
var _e$target
|
|
30
|
-
|
|
29
|
+
var _e$target;
|
|
30
|
+
var className = (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.className;
|
|
31
|
+
if (!(typeof className === 'string' && className.match(styles.input))) {
|
|
31
32
|
setOpen(false);
|
|
32
33
|
}
|
|
33
34
|
};
|
|
@@ -188,13 +188,13 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
188
188
|
if (window.location.pathname == indexRoute) {
|
|
189
189
|
setDefaultOpenKeys(getOpenKeys());
|
|
190
190
|
}
|
|
191
|
-
setDefaultSelectedKey(
|
|
191
|
+
setDefaultSelectedKey(window.location.pathname);
|
|
192
192
|
}, [window.location.pathname]);
|
|
193
193
|
useEffect(function () {
|
|
194
194
|
// 监听选中的menu-item 拿到 prev and next
|
|
195
195
|
getPreAndNext();
|
|
196
196
|
}, [defaultSelectedKey]);
|
|
197
|
-
usePreview();
|
|
197
|
+
usePreview({}, defaultSelectedKey);
|
|
198
198
|
function getPreAndNext() {
|
|
199
199
|
var menuNodes = document.querySelectorAll('aside .ant-menu-item');
|
|
200
200
|
var currentMenuNode = document.querySelector('aside .ant-menu-item-selected');
|
|
@@ -228,7 +228,7 @@ export var ManualContent = function ManualContent(_ref) {
|
|
|
228
228
|
onOpenChange: function onOpenChange(openKeys) {
|
|
229
229
|
setDefaultOpenKeys(openKeys);
|
|
230
230
|
},
|
|
231
|
-
selectedKeys: defaultSelectedKey,
|
|
231
|
+
selectedKeys: [defaultSelectedKey],
|
|
232
232
|
openKeys: defaultOpenKeys,
|
|
233
233
|
mode: "inline",
|
|
234
234
|
items: renderSidebar,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function usePreview(options
|
|
1
|
+
export declare function usePreview(options: {}, select: any): void;
|
|
@@ -27,10 +27,15 @@ function sourceOf(block) {
|
|
|
27
27
|
});
|
|
28
28
|
return cloned.textContent;
|
|
29
29
|
}
|
|
30
|
+
function blockOf() {
|
|
31
|
+
return Array.from(document.querySelectorAll('.ob-codeblock .dumi-default-source-code'));
|
|
32
|
+
}
|
|
30
33
|
export function usePreview() {
|
|
31
34
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
35
|
+
var select = arguments.length > 1 ? arguments[1] : undefined;
|
|
36
|
+
var key = select + ',' + blockOf().length;
|
|
32
37
|
useEffect(function () {
|
|
33
|
-
var blocks =
|
|
38
|
+
var blocks = blockOf();
|
|
34
39
|
|
|
35
40
|
// 过滤实际展示的 block
|
|
36
41
|
var I = Array.from({
|
|
@@ -93,5 +98,5 @@ export function usePreview() {
|
|
|
93
98
|
_iterator2.f();
|
|
94
99
|
}
|
|
95
100
|
};
|
|
96
|
-
});
|
|
101
|
+
}, [key]);
|
|
97
102
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/dumi-theme-antv",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.18",
|
|
4
4
|
"description": "AntV website theme based on dumi2.",
|
|
5
5
|
"types": "dist/types.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -91,7 +91,8 @@
|
|
|
91
91
|
"unified": "^10.1.2",
|
|
92
92
|
"unist-util-visit": "^4.1.2",
|
|
93
93
|
"uri-parse": "^1.0.0",
|
|
94
|
-
"video-react": "^0.16.0"
|
|
94
|
+
"video-react": "^0.16.0",
|
|
95
|
+
"prettier": "^2.7.1"
|
|
95
96
|
},
|
|
96
97
|
"peerDependencies": {
|
|
97
98
|
"dumi": "^2.0.0",
|
|
@@ -116,7 +117,6 @@
|
|
|
116
117
|
"father-plugin-dumi-theme": "^1.0.0-beta.1",
|
|
117
118
|
"husky": "^8.0.1",
|
|
118
119
|
"lint-staged": "^13.0.3",
|
|
119
|
-
"prettier": "^2.7.1",
|
|
120
120
|
"prettier-plugin-organize-imports": "^3.0.0",
|
|
121
121
|
"prettier-plugin-packagejson": "^2.2.18",
|
|
122
122
|
"react": "^18.0.0",
|